summaryrefslogtreecommitdiff
path: root/src/mainwindow.cpp
diff options
context:
space:
mode:
authorAl12rs <gabriel.cortesi@outlook.com>2018-07-17 16:26:17 +0200
committerAl12rs <gabriel.cortesi@outlook.com>2018-07-17 16:26:17 +0200
commit023cacab7fc2a9c36749fe235255fce8c4edd65b (patch)
treea6a600623fc984dbded18b36850ecbd81f0aba52 /src/mainwindow.cpp
parent35bbe0001efa9aac48c56503643b98ec03c080e7 (diff)
Added ability to open mod information window by double cliking on plugins.
Diffstat (limited to 'src/mainwindow.cpp')
-rw-r--r--src/mainwindow.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 5999608c..c4e888ac 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -2872,6 +2872,44 @@ void MainWindow::on_modList_doubleClicked(const QModelIndex &index)
}
}
+void MainWindow::on_espList_doubleClicked(const QModelIndex &index)
+{
+ if (!index.isValid()) {
+ return;
+ }
+
+ if (m_OrganizerCore.pluginList()->timeElapsedSinceLastChecked() <= QApplication::doubleClickInterval()) {
+ // don't interpret double click if we only just checked a plugin
+ return;
+ }
+
+ QModelIndex sourceIdx = mapToModel(m_OrganizerCore.pluginList(), index);
+ if (!sourceIdx.isValid()) {
+ return;
+ }
+ try {
+
+ QItemSelectionModel *selection = ui->espList->selectionModel();
+
+ if (selection->hasSelection() && selection->selectedRows().count() == 1) {
+
+ QModelIndex idx = selection->currentIndex();
+ QString fileName = idx.data().toString();
+
+
+ displayModInformation(ModInfo::getIndex(m_OrganizerCore.pluginList()->origin(fileName)));
+ // workaround to cancel the editor that might have opened because of
+ // selection-click
+ ui->espList->closePersistentEditor(index);
+
+
+ }
+ }
+ catch (const std::exception &e) {
+ reportError(e.what());
+ }
+}
+
bool MainWindow::populateMenuCategories(QMenu *menu, int targetID)
{
ModInfo::Ptr modInfo = ModInfo::getByIndex(m_ContextRow);