From add47dfccd96de1853e986b448e102bc776b17b0 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Fri, 19 Jan 2018 05:25:05 +0100 Subject: [PATCH] The settings / cache directory can be opened from UI [..] --- .../components/copyconfigurationcomponent.cpp | 17 ++++ .../components/copyconfigurationcomponent.h | 3 + .../components/copyconfigurationcomponent.ui | 92 ++++++++++++++++--- 3 files changed, 100 insertions(+), 12 deletions(-) diff --git a/src/blackgui/components/copyconfigurationcomponent.cpp b/src/blackgui/components/copyconfigurationcomponent.cpp index fa59e0970..2cc19cf64 100644 --- a/src/blackgui/components/copyconfigurationcomponent.cpp +++ b/src/blackgui/components/copyconfigurationcomponent.cpp @@ -22,6 +22,8 @@ #include #include #include +#include +#include using namespace BlackMisc; using namespace BlackMisc::Simulation; @@ -55,6 +57,8 @@ namespace BlackGui connect(ui->pb_ClearSelection, &QPushButton::clicked, ui->tv_Source, &QTreeView::clearSelection); connect(ui->pb_CopyOver, &QPushButton::clicked, this, &CCopyConfigurationComponent::copySelectedFiles); connect(ui->cb_ShowAll, &QCheckBox::released, this, &CCopyConfigurationComponent::changeNameFilterDisables); + connect(ui->tb_OpenOtherVersionsDir, &QToolButton::clicked, this, &CCopyConfigurationComponent::openOtherVersionsSelectedDirectory); + connect(ui->tb_OpenThisVersionDir, &QToolButton::clicked, this, &CCopyConfigurationComponent::openOtherVersionsSelectedDirectory); // create default caches with timestamps on disk // possible for small caches, but not the large model sets (too slow) @@ -334,6 +338,19 @@ namespace BlackGui return dir; } + void CCopyConfigurationComponent::openOtherVersionsSelectedDirectory() + { + const QObject *s = sender(); + const QString d = (s == ui->tb_OpenOtherVersionsDir) ? + this->getOtherVersionsSelectedDirectory() : + this->getThisVersionDirectory(); + if (d.isEmpty()) { return; } + QDir dir(d); + if (!dir.exists()) { return; } + const QUrl url = QUrl::fromLocalFile(dir.path()); + QDesktopServices::openUrl(url); + } + QStringList CCopyConfigurationComponent::getSelectedFiles() const { const QModelIndexList indexes = ui->tv_Source->selectionModel()->selectedIndexes(); diff --git a/src/blackgui/components/copyconfigurationcomponent.h b/src/blackgui/components/copyconfigurationcomponent.h index c95334df4..918534af0 100644 --- a/src/blackgui/components/copyconfigurationcomponent.h +++ b/src/blackgui/components/copyconfigurationcomponent.h @@ -98,6 +98,9 @@ namespace BlackGui //! Get the selected directory QString getOtherVersionsSelectedDirectory() const; + //! Other the directory of that other version + void openOtherVersionsSelectedDirectory(); + //! Get the selected files QStringList getSelectedFiles() const; diff --git a/src/blackgui/components/copyconfigurationcomponent.ui b/src/blackgui/components/copyconfigurationcomponent.ui index 30645746d..bfb4f1b6f 100644 --- a/src/blackgui/components/copyconfigurationcomponent.ui +++ b/src/blackgui/components/copyconfigurationcomponent.ui @@ -13,13 +13,22 @@ Frame - - QFrame::StyledPanel - - QFrame::Raised + QFrame::Plain - + + + 0 + + + 0 + + + 0 + + + 0 + @@ -127,10 +136,44 @@ 4 - - - false + + + QFrame::StyledPanel + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + false + + + + + + + open this directory + + + ... + + + + @@ -171,10 +214,35 @@ 4 - - - true - + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + true + + + + + + + ... + + + +