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: {
|
||||
// Request filter, then load episodes
|
||||
py.call('main.get_config_value', ['ui.qml.episode_list.filter_eql'], function (result) {
|
||||
setQuery(result);
|
||||
setQueryFromUpdate(result);
|
||||
reload();
|
||||
});
|
||||
}
|
||||
|
@ -67,10 +67,20 @@ ListModel {
|
|||
py.call('main.set_config_value', ['ui.qml.episode_list.filter_eql', filters[currentFilterIndex].query]);
|
||||
}
|
||||
|
||||
function setQueryFromUpdate(query) {
|
||||
setQueryEx(query, false);
|
||||
}
|
||||
|
||||
function setQuery(query) {
|
||||
setQueryEx(query, true);
|
||||
}
|
||||
|
||||
function setQueryEx(query, update) {
|
||||
for (var i=0; i<filters.length; i++) {
|
||||
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;
|
||||
return;
|
||||
}
|
||||
|
@ -79,7 +89,9 @@ ListModel {
|
|||
currentFilterIndex = -1;
|
||||
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) {
|
||||
|
|
|
@ -49,7 +49,7 @@ Connections {
|
|||
|
||||
onConfigChanged: {
|
||||
if (key === 'ui.qml.episode_list.filter_eql') {
|
||||
episodeListModel.setQuery(value);
|
||||
episodeListModel.setQueryFromUpdate(value);
|
||||
episodeListModel.reload();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue