From c1421d07345617e7776dd8bdf0aec4dbef52a72a Mon Sep 17 00:00:00 2001 From: Al12rs Date: Wed, 28 Feb 2018 20:57:08 +0100 Subject: - Added Open Folders drop-down menu over the modlist (using new custom icon) and moved there all previuolsy added "open <> folder" menu options. - Added "Open MO install folder" option. --- src/mainwindow.cpp | 52 ++++++++++++++++++++++++------------- src/mainwindow.h | 3 +++ src/mainwindow.ui | 31 ++++++++++++++++++++-- src/resources.qrc | 3 ++- src/resources/open-Folder-Icon.png | Bin 0 -> 17646 bytes 5 files changed, 68 insertions(+), 21 deletions(-) create mode 100644 src/resources/open-Folder-Icon.png diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index abac9317..fe93b546 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -301,6 +301,8 @@ MainWindow::MainWindow(QSettings &initSettings ui->listOptionsBtn->setMenu(modListContextMenu()); + ui->openFolderMenu->setMenu(openFolderMenu()); + updateDownloadListDelegate(); ui->savegameList->installEventFilter(this); @@ -3033,6 +3035,11 @@ void MainWindow::openInstanceFolder() ::ShellExecuteW(nullptr, L"explore", ToWString(m_OrganizerCore.settings().getBaseDirectory()).c_str(), nullptr, nullptr, SW_SHOWNORMAL); } +void MainWindow::openInstallFolder() +{ + ::ShellExecuteW(nullptr, L"explore", ToWString(qApp->applicationDirPath()).c_str(), nullptr, nullptr, SW_SHOWNORMAL); +} + void MainWindow::openProfileFolder() { ::ShellExecuteW(nullptr, L"explore", ToWString(m_OrganizerCore.currentProfile()->absolutePath()).c_str(), nullptr, nullptr, SW_SHOWNORMAL); @@ -3219,6 +3226,30 @@ static void addMenuAsPushButton(QMenu *menu, QMenu *subMenu) menu->addAction(action); } +QMenu *MainWindow::openFolderMenu() +{ + + QMenu *FolderMenu = new QMenu(this); + + + FolderMenu->addAction(tr("Open Instance folder"), this, SLOT(openInstanceFolder())); + + FolderMenu->addAction(tr("Open Profile folder"), this, SLOT(openProfileFolder())); + + FolderMenu->addAction(tr("Open Downloads folder"), this, SLOT(openDownloadsFolder())); + + FolderMenu->addAction(tr("Open MO Install folder"), this, SLOT(openInstallFolder())); + + FolderMenu->addSeparator(); + + FolderMenu->addAction(tr("Open Game folder"), this, SLOT(openGameFolder())); + + FolderMenu->addAction(tr("Open MyGames folder"), this, SLOT(openMyGamesFolder())); + + + return FolderMenu; +} + QMenu *MainWindow::modListContextMenu() { QMenu *menu = new QMenu(this); @@ -3237,24 +3268,6 @@ QMenu *MainWindow::modListContextMenu() menu->addAction(tr("Export to csv..."), this, SLOT(exportModListCSV())); - menu->addSeparator(); - - QMenu *openSubMenu = new QMenu(this); - - - openSubMenu->addAction(tr("Open Instance folder"), this, SLOT(openInstanceFolder())); - - openSubMenu->addAction(tr("Open Profile folder"), this, SLOT(openProfileFolder())); - - openSubMenu->addAction(tr("Open Downloads folder"), this, SLOT(openDownloadsFolder())); - - openSubMenu->addAction(tr("Open Game folder"), this, SLOT(openGameFolder())); - - openSubMenu->addAction(tr("Open MyGames folder"), this, SLOT(openMyGamesFolder())); - - openSubMenu->setTitle(tr("Open Folder...")); - - menu->addMenu(openSubMenu); return menu; } @@ -3698,6 +3711,9 @@ void MainWindow::languageChange(const QString &newLanguage) updateProblemsButton(); ui->listOptionsBtn->setMenu(modListContextMenu()); + + ui->openFolderMenu->setMenu(openFolderMenu()); + } void MainWindow::writeDataToFile(QFile &file, const QString &directory, const DirectoryEntry &directoryEntry) diff --git a/src/mainwindow.h b/src/mainwindow.h index b7eca72e..2c2e2723 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -277,6 +277,8 @@ private: QMenu *modListContextMenu(); + QMenu *openFolderMenu(); + std::set enabledArchives(); void scheduleUpdateButton(); @@ -485,6 +487,7 @@ private slots: void disableVisibleMods(); void exportModListCSV(); void openInstanceFolder(); + void openInstallFolder(); void openDownloadsFolder(); void openProfileFolder(); void openGameFolder(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index f9e64349..31522c03 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -176,7 +176,7 @@ 2 - + @@ -247,10 +247,34 @@ p, li { white-space: pre-wrap; } 16 16 + + + + + + + Quickly open in Explorer relevant Folders... + + + + + + + :/MO/gui/open_folder:/MO/gui/open_folder + + + + + + + + + + Restore Backup... @@ -439,7 +463,7 @@ p, li { white-space: pre-wrap; } - + @@ -944,6 +968,9 @@ p, li { white-space: pre-wrap; } + + + Archives diff --git a/src/resources.qrc b/src/resources.qrc index 9b66a38c..618d3cfc 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -70,7 +70,8 @@ resources/status_inactive.png resources/mo_icon.png resources/package.png - resources/switch-instance-icon.png + resources/switch-instance-icon.png + resources/open-Folder-Icon.png resources/contents/jigsaw-piece.png diff --git a/src/resources/open-Folder-Icon.png b/src/resources/open-Folder-Icon.png new file mode 100644 index 00000000..345671f7 Binary files /dev/null and b/src/resources/open-Folder-Icon.png differ -- cgit v1.3.1