summaryrefslogtreecommitdiffstats
path: root/archivebrowser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'archivebrowser.cpp')
-rw-r--r--archivebrowser.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/archivebrowser.cpp b/archivebrowser.cpp
index e648ec7..45f3618 100644
--- a/archivebrowser.cpp
+++ b/archivebrowser.cpp
@@ -38,6 +38,7 @@ ArchiveBrowser::ArchiveBrowser(QWidget *parent) : QWidget(parent), mSelectedSize
mModel = static_cast<ArchiveBrowserModel*>(SmGlobals::instance()->model("BrowserModel"));
mProxy = new ArchiveBrowserModelProxy;
mProxy->setSourceModel(mModel);
+ mProxy->readSettings();
mTree = new SmTreeView("ui/archivebrowserheaders");
mTree->setModel(mProxy);
mTree->setColumnHidden(ArchiveBrowserModel::GenericId, true);
@@ -61,11 +62,15 @@ ArchiveBrowser::ArchiveBrowser(QWidget *parent) : QWidget(parent), mSelectedSize
std::sort(genres.begin(), genres.end());
QActionGroup *gDataAG = new QActionGroup(this);
gDataAG->setExclusive(false);
+ const QStringList &includedGenres = mProxy->genreFilters();
for(const QString &g : std::as_const(genres)){
QAction *a = new QAction(g, this);
a->setCheckable(true);
gDataAG->addAction(a);
connect(a, &QAction::triggered, a, [=] { mProxy->toggleGenre(a); });
+ if(includedGenres.indexOf(g) != -1){
+ a->setChecked(true);
+ }
}
QIcon genreIcon = Helper::icon(Qt::transparent, qApp->palette().color(QPalette::Text), 'G', true, false);
QAction *genreA = new QAction(genreIcon, tr("Filter genres"), this);
@@ -75,11 +80,15 @@ ArchiveBrowser::ArchiveBrowser(QWidget *parent) : QWidget(parent), mSelectedSize
toolBar->addAction(genreA);
QActionGroup *gDataExcludedAG = new QActionGroup(this);
gDataExcludedAG->setExclusive(false);
+ const QStringList &excludedGenres = mProxy->exclucedGenreFilters();
for(const QString &g : std::as_const(genres)){
QAction *a = new QAction(g, this);
a->setCheckable(true);
gDataExcludedAG->addAction(a);
connect(a, &QAction::triggered, a, [=] { mProxy->toggleExcludedGenre(a); });
+ if(excludedGenres.indexOf(g) != -1){
+ a->setChecked(true);
+ }
}
QIcon excludedGenreIcon = Helper::icon(Qt::transparent, qApp->palette().color(QPalette::Text), 'E', true, false);
QAction *excludedGenreA = new QAction(excludedGenreIcon, tr("Filter genres"), this);
@@ -197,10 +206,12 @@ void ArchiveBrowser::readConfig(){
QSettings s;
QString qualFilter = s.value("ui/browserquality", tr("(none)")).toString();
mQualityFilter->setCurrentText(qualFilter);
+ mProxy->readSettings();
}
void ArchiveBrowser::writeSettings(){
mTree->writeHeaderConfig();
+ mProxy->writeSettings();
QSettings s;
s.setValue("ui/browserquality", mQualityFilter->currentText());
}