From 87292ca30fd628c29e3acdc7a9fb40eba3eb9ff4 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Sun, 2 Dec 2018 22:07:58 -0600 Subject: Add filter to "send to separator..." dialog --- src/listdialog.cpp | 46 ++++- src/listdialog.h | 16 +- src/listdialog.ui | 37 +++- src/organizer_en.ts | 540 +++++++++++++++++++++++++++------------------------- 4 files changed, 356 insertions(+), 283 deletions(-) (limited to 'src') diff --git a/src/listdialog.cpp b/src/listdialog.cpp index 4acfa5de..52bba80d 100644 --- a/src/listdialog.cpp +++ b/src/listdialog.cpp @@ -18,29 +18,57 @@ along with Mod Organizer. If not, see . #include "listdialog.h" #include "ui_listdialog.h" -ListDialog::ListDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::ListDialog) +ListDialog::ListDialog(QWidget *parent) + : QDialog(parent) + , ui(new Ui::ListDialog) + , m_Choices() { - ui->setupUi(this); + ui->setupUi(this); + ui->filterEdit->setFocus(); } ListDialog::~ListDialog() { - delete ui; + delete ui; } void ListDialog::setChoices(QStringList choices) { - ui->listWidget->clear(); - ui->listWidget->addItems(choices); + m_Choices = choices; + ui->choiceList->clear(); + ui->choiceList->addItems(m_Choices); } QString ListDialog::getChoice() const { - if (ui->listWidget->selectedItems().length()) { - return ui->listWidget->currentItem()->text(); + if (ui->choiceList->selectedItems().length()) { + return ui->choiceList->currentItem()->text(); } else { return ""; } } + +void ListDialog::on_filterEdit_textChanged(QString filter) +{ + QStringList newChoices; + for (auto choice : m_Choices) { + if (choice.contains(filter, Qt::CaseInsensitive)){ + newChoices << choice; + } + } + ui->choiceList->clear(); + ui->choiceList->addItems(newChoices); + + if (newChoices.length() == 1) { + QListWidgetItem *item = ui->choiceList->item(0); + ui->choiceList->setItemSelected(item, true); + ui->choiceList->setCurrentItem(item); + } + + if (!filter.isEmpty()) { + ui->choiceList->setStyleSheet("QListWidget { border: 2px ridge #f00; }"); + } else { + ui->choiceList->setStyleSheet(""); + } +} + diff --git a/src/listdialog.h b/src/listdialog.h index 5e826a30..7b5a5461 100644 --- a/src/listdialog.h +++ b/src/listdialog.h @@ -9,17 +9,21 @@ class ListDialog; class ListDialog : public QDialog { - Q_OBJECT + Q_OBJECT public: - explicit ListDialog(QWidget *parent = nullptr); - ~ListDialog(); + explicit ListDialog(QWidget *parent = nullptr); + ~ListDialog(); - void setChoices(QStringList choices); - QString getChoice() const; + void setChoices(QStringList choices); + QString getChoice() const; + +public slots: + void on_filterEdit_textChanged(QString filter); private: - Ui::ListDialog *ui; + Ui::ListDialog *ui; + QStringList m_Choices; }; #endif // LISTDIALOG_H diff --git a/src/listdialog.ui b/src/listdialog.ui index 38819c87..032bc131 100644 --- a/src/listdialog.ui +++ b/src/listdialog.ui @@ -7,18 +7,18 @@ 0 0 260 - 340 + 380 - Dialog + Select an item... - 90 - 299 - 161 + 10 + 345 + 240 32 @@ -32,13 +32,13 @@ QDialogButtonBox::Cancel|QDialogButtonBox::Ok - + 10 10 240 - 280 + 300 @@ -57,7 +57,30 @@ QAbstractItemView::ScrollPerPixel + + + + 10 + 320 + 240 + 20 + + + + + + + Filter + + + + + MOBase::LineEditClear + QLineEdit +
lineeditclear.h
+
+
diff --git a/src/organizer_en.ts b/src/organizer_en.ts index 518e49bc..191058ed 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -1442,6 +1442,19 @@ This is likely due to a corrupted or incompatible download or unrecognized archi + + ListDialog + + + Dialog + + + + + Filter + + + LockedDialog @@ -1607,7 +1620,7 @@ p, li { white-space: pre-wrap; } - + Create Backup @@ -1771,8 +1784,8 @@ p, li { white-space: pre-wrap; } - - + + Refresh @@ -1956,7 +1969,7 @@ p, li { white-space: pre-wrap; } - + Update @@ -1967,7 +1980,7 @@ p, li { white-space: pre-wrap; } - + No Problems @@ -1997,7 +2010,7 @@ Right now this has very limited functionality - + Endorse Mod Organizer @@ -2017,788 +2030,793 @@ Right now this has very limited functionality - + Toolbar - + Desktop - + Start Menu - + There is no supported sort mechanism for this game. You will probably have to use a third-party tool. - + Problems - + There are potential problems with your setup - + Everything seems to be in order - + Help on UI - + Documentation Wiki - + Report Issue - + Tutorials - + About - + About Qt - + Name - + Please enter a name for the new profile - + failed to create profile: %1 - + Show tutorial? - + You are starting Mod Organizer for the first time. Do you want to show a tutorial of its basic features? If you choose no you can always start the tutorial from the "Help"-menu. - + Downloads in progress - + There are still downloads in progress, do you really want to quit? - + Plugin "%1" failed: %2 - + Plugin "%1" failed - + Browse Mod Page - + Also in: <br> - + No conflict - + <Edit...> - + This bsa is enabled in the ini file so it may be required! - + Activating Network Proxy - + Notice: Your current MO version (%1) is lower than the previous version (%2).<br>The GUI may not downgrade gracefully, so you may experience oddities.<br>However, there should be no serious issues. - + Choose Mod - + Mod Archive - + Start Tutorial? - + You're about to start a tutorial. For technical reasons it's not possible to end the tutorial early. Continue? - + failed to spawn notepad.exe: %1 - + failed to change origin name: %1 - + failed to move "%1" from mod "%2" to "%3": %4 - + <Contains %1> - + <Checked> - + <Unchecked> - + <Update> - + <Mod Backup> - + <Managed by MO> - + <Managed outside MO> - + <No category> - + <Conflicted> - + <Not Endorsed> - + failed to rename mod: %1 - + Overwrite? - + This will replace the existing mod "%1". Continue? - + failed to remove mod "%1" - - - + + + failed to rename "%1" to "%2" - - - - + + + + Confirm - + Remove the following mods?<br><ul>%1</ul> - + failed to remove mod: %1 - - - + + + Failed - + Installation file no longer exists - + Mods installed with old versions of MO can't be reinstalled in this way. - + Failed to create backup. - + You need to be logged in with Nexus to resume a download - - + + You need to be logged in with Nexus to endorse - + Failed to display overwrite dialog: %1 - + Nexus ID for this Mod is unknown - + Web page for this mod is unknown - - - + + + Create Mod... - + This will create an empty mod. Please enter a name: - - + + A mod with this name already exists - + Create Separator... - + This will create a new separator. Please enter a name: - + A separator with this name already exists - + This will move all files from overwrite into a new, regular mod. Please enter a name: - - + + Are you sure? - + About to recursively delete: - + Not logged in, endorsement information will be wrong - + Continue? - + The versioning scheme decides which version is considered newer than another. This function will guess the versioning scheme under the assumption that the installed version is outdated. - - + + Sorry - + I don't know a versioning scheme where %1 is newer than %2. - + Really enable all visible mods? - + Really disable all visible mods? - + Export to csv - + CSV (Comma Separated Values) is a format that can be imported in programs like Excel to create a spreadsheet. You can also use online editors and converters instead. - + Select what mods you want export: - + All installed mods - + Only active (checked) mods from your current profile - + All currently visible mods in the mod list - + Choose what Columns to export: - + Mod_Priority - + Mod_Name - + Mod_Status - + Primary_Category - + Nexus_ID - + Mod_Nexus_URL - + Mod_Version - + Install_Date - + Download_File_Name - + export failed: %1 - + Open Game folder - + Open MyGames folder - + Open Instance folder - + Open Mods folder - + Open Profile folder - + Open Downloads folder - + Open MO2 Install folder - + Open MO2 Plugins folder - + Open MO2 Logs folder - + Install Mod... - + Create empty mod - + Create Separator - + Enable all visible - + Disable all visible - + Check all for update - + Export to csv... - - + + Send to - - + + Top - - + + Bottom - - + + Priority... - + + Separator... + + + + All Mods - + Sync to Mods... - + Clear Overwrite... - - + + Open in Explorer - + Restore Backup - + Remove Backup... - - + + Change Categories - - + + Primary Category - + Rename Separator... - + Remove Separator... - + Select Color... - + Reset Color - + Change versioning scheme - + Un-ignore update - + Ignore update - - + + Enable selected - - + + Disable selected - + Rename Mod... - + Reinstall Mod - + Remove Mod... - + Un-Endorse - - + + Endorse - + Won't endorse - + Endorsement state unknown - + Ignore missing data - + Mark as converted/working - + Visit on Nexus - + Visit web page - + Information... - - + + Exception: - - + + Unknown exception - + <All> - + <Multiple> - + %1 more - + Are you sure you want to remove the following %n save(s)?<br><ul>%1</ul><br>Removed saves will be sent to the Recycle Bin. @@ -2806,12 +2824,12 @@ You can also use online editors and converters instead. - + Enable Mods... - + Delete %n save(s) @@ -2819,335 +2837,335 @@ You can also use online editors and converters instead. - + failed to remove %1 - + failed to create %1 - + Can't change download directory while downloads are in progress! - + failed to write to file %1 - + %1 written - + Select binary - + Binary - + Enter Name - + Please enter a name for the executable - + Not an executable - + This is not a recognized executable. - - + + Replace file? - + There already is a hidden version of this file. Replace it? - - + + File operation failed - - + + Failed to remove "%1". Maybe you lack the required file permissions? - + There already is a visible version of this file. Replace it? - - + + Set Priority - + Set the priority of the selected plugins - + file not found: %1 - + failed to generate preview for %1 - + Sorry, can't preview anything. This function currently does not support extracting from bsas. - + Update available - + Open/Execute - + Add as Executable - + Preview - + Un-Hide - + Hide - + Write To File... - + Do you want to endorse Mod Organizer on %1 now? - + Thank you! - + Thank you for your endorsement! - + Request to Nexus failed: %1 - - + + failed to read %1: %2 - - + + Error - + failed to extract %1 (errorcode %2) - + Extract BSA - + This archive contains invalid hashes. Some files may be broken. - + Extract... - + This will restart MO, continue? - + Edit Categories... - + Deselect filter - + Remove - + Enable all - + Disable all - + Unlock load order - + Lock load order - + depends on missing "%1" - + incompatible with "%1" - + Please wait while LOOT is running - + loot failed. Exit code was: %1 - + failed to start loot - + failed to run loot: %1 - + Errors occured - + Backup of load order created - + Choose backup to restore - + No Backups - + There are no backups to restore - - + + Restore failed - - + + Failed to restore the backup. Errorcode: %1 - + Backup of modlist created - + A file with the same name has already been downloaded. What would you like to do? - + Overwrite - + Rename new file - + Ignore file - + Set the priority of the selected mods @@ -5425,18 +5443,18 @@ If the folder was still in use, restart MO and try again. - + Please use "Help" from the toolbar to get usage instructions to all elements - - + + <Manage...> - + failed to parse profile %1: %2 -- cgit v1.3.1