Misc. smaller fixes

* copy configuration dialog handles case if there is no other swift version
* QPointer "guard" for lambda
* first model set UI
This commit is contained in:
Klaus Basan
2018-05-23 23:13:39 +02:00
parent fcd08e7918
commit 26dcc547e6
4 changed files with 28 additions and 10 deletions

View File

@@ -51,6 +51,7 @@ namespace BlackGui
ui->setupUi(this);
this->initOtherSwiftVersions();
this->setWidths();
m_hasOtherSwiftVersions = CDirectoryUtils::hasOtherSwiftDataDirectories();
ui->cb_ShowAll->setChecked(m_nameFilterDisables);
connect(ui->rb_Cache, &QRadioButton::toggled, [ = ](bool) { this->initCurrentDirectories(true); });
@@ -249,7 +250,12 @@ namespace BlackGui
// source
const QString sourceDir = this->getOtherVersionsSelectedDirectory();
if (!sourceModel || m_initializedSourceDir != sourceDir)
if (!m_hasOtherSwiftVersions)
{
// no ther versions
return;
}
else if (!sourceModel || m_initializedSourceDir != sourceDir)
{
m_initializedSourceDir = sourceDir;
if (!sourceModel)
@@ -353,6 +359,7 @@ namespace BlackGui
QStringList CCopyConfigurationComponent::getSelectedFiles() const
{
if (!m_hasOtherSwiftVersions) { return QStringList(); }
const QModelIndexList indexes = ui->tv_Source->selectionModel()->selectedIndexes();
if (indexes.isEmpty()) { return QStringList(); }
const QFileSystemModel *sourceModel = qobject_cast<QFileSystemModel *>(ui->tv_Source->model());