The settings / cache directory can be opened from UI [..]

This commit is contained in:
Klaus Basan
2018-01-19 05:25:05 +01:00
parent d0141692a2
commit add47dfccd
3 changed files with 100 additions and 12 deletions

View File

@@ -22,6 +22,8 @@
#include <QDirIterator>
#include <QFileInfoList>
#include <QFileSystemModel>
#include <QDir>
#include <QDesktopServices>
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();