From c3c1183308dbe00a14b8cf5e3c58e92bd9edfaf6 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Thu, 12 Dec 2019 14:47:35 -0500 Subject: fixed alt colors in saves list for dark.qss translated some sanity checks warnings fixed filter list not refreshing selection correctly --- src/filterlist.cpp | 38 +++++++++++++++++++------------------- src/filterlist.h | 1 + src/organizer_en.ts | 17 +++++++++++++++++ src/sanitychecks.cpp | 21 ++++++++++++++------- src/stylesheets/dark.qss | 2 +- 5 files changed, 52 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/filterlist.cpp b/src/filterlist.cpp index 6a85bcaa..69aca4c5 100644 --- a/src/filterlist.cpp +++ b/src/filterlist.cpp @@ -275,10 +275,7 @@ void FilterList::addSpecialCriteria(int type) void FilterList::refresh() { - QStringList selectedItems; - for (QTreeWidgetItem *item : ui->filters->selectedItems()) { - selectedItems.append(item->text(0)); - } + const auto oldSelection = selectedCriteria(); ui->filters->clear(); @@ -315,33 +312,30 @@ void FilterList::refresh() } addCategoryCriteria(nullptr, categoriesUsed, 0); - - for (const QString &item : selectedItems) { - QList matches = ui->filters->findItems( - item, Qt::MatchFixedString | Qt::MatchRecursive); - - if (matches.size() > 0) { - matches.at(0)->setSelected(true); - } - } + setSelection(oldSelection); } void FilterList::setSelection(const std::vector& criteria) { for (int i = 0; i < ui->filters->topLevelItemCount(); ++i) { - const auto* item = dynamic_cast( - ui->filters->topLevelItem(i)); - + auto* item = dynamic_cast(ui->filters->topLevelItem(i)); if (!item) { continue; } + bool found = false; + for (auto&& c : criteria) { if (item->type() == c.type && item->id() == c.id) { - ui->filters->setCurrentItem(ui->filters->topLevelItem(i)); + item->setState(c.inverse ? CriteriaItem::Inverted : CriteriaItem::Active); + found = true; break; } } + + if (!found) { + item->setState(CriteriaItem::Inactive); + } } } @@ -378,7 +372,7 @@ bool FilterList::cycleItem(QTreeWidgetItem* item, int direction) return true; } -void FilterList::checkCriteria() +std::vector FilterList::selectedCriteria() const { std::vector criteria; @@ -395,7 +389,12 @@ void FilterList::checkCriteria() } } - emit criteriaChanged(criteria); + return criteria; +} + +void FilterList::checkCriteria() +{ + emit criteriaChanged(selectedCriteria()); } void FilterList::editCategories() @@ -404,6 +403,7 @@ void FilterList::editCategories() if (dialog.exec() == QDialog::Accepted) { dialog.commitChanges(); + refresh(); } } diff --git a/src/filterlist.h b/src/filterlist.h index 72cbe8bf..b0ebc9a4 100644 --- a/src/filterlist.h +++ b/src/filterlist.h @@ -39,6 +39,7 @@ private: void editCategories(); void checkCriteria(); + std::vector selectedCriteria() const; bool cycleItem(QTreeWidgetItem* item, int direction); QTreeWidgetItem* addCriteriaItem( diff --git a/src/organizer_en.ts b/src/organizer_en.ts index 95854200..6101c8e7 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -6754,6 +6754,23 @@ You can restart Mod Organizer as administrator and try launching the program aga Exit Now + + + '%1': file is blocked (%2) + '%1': file is blocked ('%2') + + + + + '%1' seems to be missing, an antivirus may have deleted it + + + + + %1 is loaded. This program is known to cause issues with Mod Organizer, such as freezing or blank windows. Consider uninstalling it. + %1 is loaded. This program is known to cause issues with Mod Organizer, such as freezing or blank windows. Consider uninstalling it. (%2) + + QueryOverwriteDialog diff --git a/src/sanitychecks.cpp b/src/sanitychecks.cpp index 330735ed..bdf762d9 100644 --- a/src/sanitychecks.cpp +++ b/src/sanitychecks.cpp @@ -110,7 +110,11 @@ bool isFileBlocked(const QFileInfo& fi) } // file is blocked - log::warn("'{}': file is blocked, zone id is {}", path, toString(z)); + log::warn("{}", QObject::tr( + "'%1': file is blocked (%2)") + .arg(path) + .arg(toString(z))); + return true; } @@ -199,9 +203,9 @@ int checkMissingFiles() const QFileInfo file(dir + "/" + name); if (!file.exists()) { - log::warn( - "'{}' seems to be missing, an antivirus may have deleted it", - file.absoluteFilePath()); + log::warn("{}", QObject::tr( + "'%1' seems to be missing, an antivirus may have deleted it") + .arg(file.absoluteFilePath())); ++n; } @@ -231,10 +235,13 @@ int checkIncompatibleModule(const env::Module& m) for (auto&& p : names) { if (file.fileName().compare(p.first, Qt::CaseInsensitive) == 0) { - log::warn( - "{} is loaded. This program is known to cause issues with " + log::warn("{}", QObject::tr( + "%1 is loaded. This program is known to cause issues with " "Mod Organizer, such as freezing or blank windows. Consider " - "uninstalling it. ({})", p.second, file.absoluteFilePath()); + "uninstalling it.") + .arg(p.second)); + + log::warn("{}", file.absoluteFilePath()); ++n; } diff --git a/src/stylesheets/dark.qss b/src/stylesheets/dark.qss index 9d11109d..91f808bc 100644 --- a/src/stylesheets/dark.qss +++ b/src/stylesheets/dark.qss @@ -349,7 +349,7 @@ QToolButton:hover padding-bottom: 2px; } -QTreeView +QTreeView, QListView { color: #E9E6E4; background-color: #3F4041; -- cgit v1.3.1