Don't set config value as reaction to a config change
This commit is contained in:
parent
a3fc3fe3c0
commit
0703e7ab59
2 changed files with 16 additions and 4 deletions
|
@ -57,7 +57,7 @@ ListModel {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
// Request filter, then load episodes
|
// Request filter, then load episodes
|
||||||
py.call('main.get_config_value', ['ui.qml.episode_list.filter_eql'], function (result) {
|
py.call('main.get_config_value', ['ui.qml.episode_list.filter_eql'], function (result) {
|
||||||
setQuery(result);
|
setQueryFromUpdate(result);
|
||||||
reload();
|
reload();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -67,10 +67,20 @@ ListModel {
|
||||||
py.call('main.set_config_value', ['ui.qml.episode_list.filter_eql', filters[currentFilterIndex].query]);
|
py.call('main.set_config_value', ['ui.qml.episode_list.filter_eql', filters[currentFilterIndex].query]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setQueryFromUpdate(query) {
|
||||||
|
setQueryEx(query, false);
|
||||||
|
}
|
||||||
|
|
||||||
function setQuery(query) {
|
function setQuery(query) {
|
||||||
|
setQueryEx(query, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
function setQueryEx(query, update) {
|
||||||
for (var i=0; i<filters.length; i++) {
|
for (var i=0; i<filters.length; i++) {
|
||||||
if (filters[i].query === query) {
|
if (filters[i].query === query) {
|
||||||
py.call('main.set_config_value', ['ui.qml.episode_list.filter_eql', query]);
|
if (update) {
|
||||||
|
py.call('main.set_config_value', ['ui.qml.episode_list.filter_eql', query]);
|
||||||
|
}
|
||||||
currentFilterIndex = i;
|
currentFilterIndex = i;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +89,9 @@ ListModel {
|
||||||
currentFilterIndex = -1;
|
currentFilterIndex = -1;
|
||||||
currentCustomQuery = query;
|
currentCustomQuery = query;
|
||||||
|
|
||||||
py.call('main.set_config_value', ['ui.qml.episode_list.filter_eql', query]);
|
if (update) {
|
||||||
|
py.call('main.set_config_value', ['ui.qml.episode_list.filter_eql', query]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadAllEpisodes(callback) {
|
function loadAllEpisodes(callback) {
|
||||||
|
|
|
@ -49,7 +49,7 @@ Connections {
|
||||||
|
|
||||||
onConfigChanged: {
|
onConfigChanged: {
|
||||||
if (key === 'ui.qml.episode_list.filter_eql') {
|
if (key === 'ui.qml.episode_list.filter_eql') {
|
||||||
episodeListModel.setQuery(value);
|
episodeListModel.setQueryFromUpdate(value);
|
||||||
episodeListModel.reload();
|
episodeListModel.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue