summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAl12rs <gabriel.cortesi@outlook.com>2018-04-17 01:32:03 +0200
committerAl12rs <gabriel.cortesi@outlook.com>2018-04-17 21:50:12 +0200
commit62dc387de644a0a47156079f78f7e0ab174abdaa (patch)
tree02ae8862367e3babbe09586472be11e1e8852929 /src
parentfc46a6a782108576ee43776109aceffbcb9668b1 (diff)
Added key shourtcuts to open in explorer a selected mo by pressing Enter or Return. Needs support for overwrte
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp18
-rw-r--r--src/mainwindow.h4
2 files changed, 22 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 401e3c8b..3eb7244a 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -150,6 +150,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QWhatsThis>
#include <QWidgetAction>
#include <QWebEngineProfile>
+#include <QShortcut>
#include <QDebug>
#include <QtGlobal>
@@ -369,6 +370,9 @@ MainWindow::MainWindow(QSettings &initSettings
connect(ui->espList->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(esplistSelectionsChanged(QItemSelection)));
connect(ui->modList->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this, SLOT(modlistSelectionsChanged(QItemSelection)));
+ new QShortcut(QKeySequence(Qt::Key_Enter), this, SLOT(openExplorer_activated()));
+ new QShortcut(QKeySequence(Qt::Key_Return), this, SLOT(openExplorer_activated()));
+
m_UpdateProblemsTimer.setSingleShot(true);
connect(&m_UpdateProblemsTimer, SIGNAL(timeout()), this, SLOT(updateProblemsButton()));
@@ -2615,6 +2619,20 @@ void MainWindow::openExplorer_clicked()
::ShellExecuteW(nullptr, L"explore", ToWString(modInfo->absolutePath()).c_str(), nullptr, nullptr, SW_SHOWNORMAL);
}
+void MainWindow::openExplorer_activated()
+{
+ QItemSelectionModel *selection = ui->modList->selectionModel();
+ if (selection->hasSelection() && selection->selectedRows().count() == 1 && ui->modList->hasFocus()) {
+
+ QModelIndex idx = selection->currentIndex();
+ ModInfo::Ptr modInfo = ModInfo::getByIndex(idx.data(Qt::UserRole + 1).toInt());
+ if (modInfo->isRegular()) {
+ ::ShellExecuteW(nullptr, L"explore", ToWString(modInfo->absolutePath()).c_str(), nullptr, nullptr, SW_SHOWNORMAL);
+ }
+
+ }
+}
+
void MainWindow::information_clicked()
{
try {
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 8faaa349..31c52bc0 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -386,6 +386,7 @@ private slots:
void showMessage(const QString &message);
void showError(const QString &message);
+
// main window actions
void helpTriggered();
void issueTriggered();
@@ -393,6 +394,9 @@ private slots:
void tutorialTriggered();
void extractBSATriggered();
+ //modlist shortcuts
+ void openExplorer_activated();
+
// modlist context menu
void installMod_clicked();
void createEmptyMod_clicked();