diff options
| author | Al12rs <gabriel.cortesi@outlook.com> | 2018-10-28 02:16:20 +0200 |
|---|---|---|
| committer | Al12rs <gabriel.cortesi@outlook.com> | 2018-10-28 02:16:20 +0200 |
| commit | 42d2344f0b81cb1cf8dbe83e8f480b84ed0c3114 (patch) | |
| tree | 5f349dba87b9a6e34700e4b6dbd4ac6c19e95d42 /src/mainwindow.cpp | |
| parent | 18e49b71b509a7a306d89392cc4486bb3c960e4f (diff) | |
Added modlist Separators feature:
*New modType separator.
*Bold, italic and centralized name without _separator at the end.
*Added "create separator" option to context menu.
*Added "rename separator" option.
*Fixed rename separator issue with priority resetting.
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 04bd96c7..bc25ab70 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2629,8 +2629,9 @@ void MainWindow::modOpenNext(int tab) ModInfo::Ptr mod = ModInfo::getByIndex(m_ContextRow);
std::vector<ModInfo::EFlag> flags = mod->getFlags();
if ((std::find(flags.begin(), flags.end(), ModInfo::FLAG_OVERWRITE) != flags.end()) ||
- (std::find(flags.begin(), flags.end(), ModInfo::FLAG_BACKUP) != flags.end())) {
- // skip overwrite and backups
+ (std::find(flags.begin(), flags.end(), ModInfo::FLAG_BACKUP) != flags.end()) ||
+ (std::find(flags.begin(), flags.end(), ModInfo::FLAG_SEPARATOR) != flags.end())) {
+ // skip overwrite and backups and separators
modOpenNext(tab);
} else {
displayModInformation(m_ContextRow,tab);
@@ -2649,8 +2650,9 @@ void MainWindow::modOpenPrev(int tab) ModInfo::Ptr mod = ModInfo::getByIndex(m_ContextRow);
std::vector<ModInfo::EFlag> flags = mod->getFlags();
if ((std::find(flags.begin(), flags.end(), ModInfo::FLAG_OVERWRITE) != flags.end()) ||
- (std::find(flags.begin(), flags.end(), ModInfo::FLAG_BACKUP) != flags.end())) {
- // skip overwrite and backups
+ (std::find(flags.begin(), flags.end(), ModInfo::FLAG_BACKUP) != flags.end()) ||
+ (std::find(flags.begin(), flags.end(), ModInfo::FLAG_SEPARATOR) != flags.end())) {
+ // skip overwrite and backups and separators
modOpenPrev(tab);
} else {
displayModInformation(m_ContextRow,tab);
@@ -2839,6 +2841,33 @@ void MainWindow::createEmptyMod_clicked() m_OrganizerCore.refreshModList();
}
+void MainWindow::createSeparator_clicked()
+{
+ GuessedValue<QString> name;
+ name.setFilter(&fixDirectoryName);
+ while (name->isEmpty())
+ {
+ bool ok;
+ name.update(QInputDialog::getText(this, tr("Create Separator..."),
+ tr("This will create a new separator.\n"
+ "Please enter a name:"), QLineEdit::Normal, "", &ok),
+ GUESS_USER);
+ if (!ok) { return; }
+ }
+ if (m_OrganizerCore.getMod(name) != nullptr)
+ {
+ reportError(tr("A separator with this name already exists"));
+ return;
+ }
+ name->append("_separator");
+ if (m_OrganizerCore.getMod(name) != nullptr)
+ {
+ return;
+ }
+ if (m_OrganizerCore.createMod(name) == nullptr) { return; }
+ m_OrganizerCore.refreshModList();
+}
+
void MainWindow::createModFromOverwrite()
{
GuessedValue<QString> name;
@@ -3579,6 +3608,8 @@ QMenu *MainWindow::modListContextMenu() menu->addAction(tr("Create empty mod"), this, SLOT(createEmptyMod_clicked()));
+ menu->addAction(tr("Create separator"), this, SLOT(createSeparator_clicked()));
+
menu->addSeparator();
menu->addAction(tr("Enable all visible"), this, SLOT(enableVisibleMods()));
@@ -3623,6 +3654,9 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos) } else if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_BACKUP) != flags.end()) {
menu->addAction(tr("Restore Backup"), this, SLOT(restoreBackup_clicked()));
menu->addAction(tr("Remove Backup..."), this, SLOT(removeMod_clicked()));
+ } else if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_SEPARATOR) != flags.end()){
+ menu->addAction(tr("Rename Separator..."), this, SLOT(renameMod_clicked()));
+ menu->addAction(tr("Remove Separator..."), this, SLOT(removeMod_clicked()));
} else if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_FOREIGN) != flags.end()) {
// nop, nothing to do with this mod
} else {
|
