summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAl <gabriel.cortesi@outlook.com>2019-06-05 08:04:17 +0200
committerGitHub <noreply@github.com>2019-06-05 08:04:17 +0200
commitf4b33ac478be948e0340cb99d6d2089b3dc24a68 (patch)
tree3ac8f566825be0c96671b0f72fc523f51a3385a5 /src
parent37c4dc58488cf463dbd67946de30f833a78085a7 (diff)
parent63d62a40c261fd17cf3001808fce3a8d4bb705e2 (diff)
Merge pull request #753 from isanae/explore-data-file
Added "Open Origin in Explorer" to the data tab
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp45
-rw-r--r--src/mainwindow.h3
2 files changed, 37 insertions, 11 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index bf357c20..b19e7573 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -3399,7 +3399,7 @@ void MainWindow::openExplorer_clicked()
}
}
-void MainWindow::openOriginExplorer_clicked()
+void MainWindow::openPluginOriginExplorer_clicked()
{
QItemSelectionModel *selection = ui->espList->selectionModel();
if (selection->hasSelection() && selection->selectedRows().count() > 0) {
@@ -4743,7 +4743,7 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos)
// no selection
QMenu menu(this);
initModListContextMenu(&menu);
- menu.exec(modList->mapToGlobal(pos));
+ menu.exec(modList->viewport()->mapToGlobal(pos));
} else {
QMenu menu(this);
@@ -4888,7 +4888,7 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos)
menu.setDefaultAction(infoAction);
}
- menu.exec(modList->mapToGlobal(pos));
+ menu.exec(modList->viewport()->mapToGlobal(pos));
}
} catch (const std::exception &e) {
reportError(tr("Exception: ").arg(e.what()));
@@ -5027,7 +5027,7 @@ void MainWindow::on_savegameList_customContextMenuRequested(const QPoint &pos)
menu.addAction(deleteMenuLabel, this, SLOT(deleteSavegame_clicked()));
- menu.exec(ui->savegameList->mapToGlobal(pos));
+ menu.exec(ui->savegameList->viewport()->mapToGlobal(pos));
}
void MainWindow::linkToolbar()
@@ -5469,6 +5469,24 @@ void MainWindow::openDataFile()
m_OrganizerCore.executeFileVirtualized(this, targetInfo);
}
+void MainWindow::openDataOriginExplorer_clicked()
+{
+ if (m_ContextItem == nullptr) {
+ return;
+ }
+
+ const auto isArchive = m_ContextItem->data(0, Qt::UserRole + 1).toBool();
+ const auto isDirectory = m_ContextItem->data(0, Qt::UserRole + 3).toBool();
+
+ if (isArchive || isDirectory) {
+ return;
+ }
+
+ const auto fullPath = m_ContextItem->data(0, Qt::UserRole).toString();
+
+ qDebug().nospace() << "opening in explorer: " << fullPath;
+ shell::ExploreFile(fullPath);
+}
void MainWindow::updateAvailable()
{
@@ -5512,8 +5530,15 @@ void MainWindow::on_dataTree_customContextMenuRequested(const QPoint &pos)
menu.addAction(tr("Preview"), this, SLOT(previewDataFile()));
}
+ const auto isArchive = m_ContextItem->data(0, Qt::UserRole + 1).toBool();
+ const auto isDirectory = m_ContextItem->data(0, Qt::UserRole + 3).toBool();
+
+ if (!isArchive && !isDirectory) {
+ menu.addAction("Open Origin in Explorer", this, SLOT(openDataOriginExplorer_clicked()));
+ }
+
// offer to hide/unhide file, but not for files from archives
- if (!m_ContextItem->data(0, Qt::UserRole + 1).toBool()) {
+ if (!isArchive) {
if (m_ContextItem->text(0).endsWith(ModInfo::s_HiddenExt)) {
menu.addAction(tr("Un-Hide"), this, SLOT(unhideFile()));
} else {
@@ -5526,7 +5551,7 @@ void MainWindow::on_dataTree_customContextMenuRequested(const QPoint &pos)
menu.addAction(tr("Write To File..."), this, SLOT(writeDataToFile()));
menu.addAction(tr("Refresh"), this, SLOT(on_btnRefreshData_clicked()));
- menu.exec(dataTree->mapToGlobal(pos));
+ menu.exec(dataTree->viewport()->mapToGlobal(pos));
}
void MainWindow::on_conflictsCheckBox_toggled(bool)
@@ -6108,7 +6133,7 @@ void MainWindow::on_bsaList_customContextMenuRequested(const QPoint &pos)
QMenu menu;
menu.addAction(tr("Extract..."), this, SLOT(extractBSATriggered()));
- menu.exec(ui->bsaList->mapToGlobal(pos));
+ menu.exec(ui->bsaList->viewport()->mapToGlobal(pos));
}
void MainWindow::on_bsaList_itemChanged(QTreeWidgetItem*, int)
@@ -6185,7 +6210,7 @@ void MainWindow::on_categoriesList_customContextMenuRequested(const QPoint &pos)
menu.addAction(tr("Edit Categories..."), this, SLOT(editCategories()));
menu.addAction(tr("Deselect filter"), this, SLOT(deselectFilters()));
- menu.exec(ui->categoriesList->mapToGlobal(pos));
+ menu.exec(ui->categoriesList->viewport()->mapToGlobal(pos));
}
@@ -6293,7 +6318,7 @@ void MainWindow::on_espList_customContextMenuRequested(const QPoint &pos)
unsigned int modInfoIndex = ModInfo::getIndex(m_OrganizerCore.pluginList()->origin(idx.data().toString()));
//this is to avoid showing the option on game files like skyrim.esm
if (modInfoIndex != UINT_MAX) {
- menu.addAction(tr("Open Origin in Explorer"), this, SLOT(openOriginExplorer_clicked()));
+ menu.addAction(tr("Open Origin in Explorer"), this, SLOT(openPluginOriginExplorer_clicked()));
ModInfo::Ptr modInfo = ModInfo::getByIndex(modInfoIndex);
std::vector<ModInfo::EFlag> flags = modInfo->getFlags();
@@ -6304,7 +6329,7 @@ void MainWindow::on_espList_customContextMenuRequested(const QPoint &pos)
}
try {
- menu.exec(ui->espList->mapToGlobal(pos));
+ menu.exec(ui->espList->viewport()->mapToGlobal(pos));
} catch (const std::exception &e) {
reportError(tr("Exception: ").arg(e.what()));
} catch (...) {
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 35ac75a9..426b0881 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -450,7 +450,7 @@ private slots:
void visitOnNexus_clicked();
void visitWebPage_clicked();
void openExplorer_clicked();
- void openOriginExplorer_clicked();
+ void openPluginOriginExplorer_clicked();
void openOriginInformation_clicked();
void information_clicked();
void enableSelectedMods_clicked();
@@ -469,6 +469,7 @@ private slots:
void previewDataFile();
void hideFile();
void unhideFile();
+ void openDataOriginExplorer_clicked();
// pluginlist context menu
void enableSelectedPlugins_clicked();