Ref T180, setup loading dialog

* UI adjustments, style sheet
* use connectOnce for QFileSystemModel::directoryLoaded
This commit is contained in:
Klaus Basan
2017-11-03 16:46:08 +01:00
parent ef56590d85
commit 88872f9f3a
4 changed files with 68 additions and 26 deletions

View File

@@ -16,6 +16,7 @@
#include "blackmisc/settingscache.h"
#include "blackmisc/datacache.h"
#include "blackmisc/logmessage.h"
#include "blackmisc/slot.h"
#include <QDirIterator>
#include <QFileInfoList>
@@ -179,9 +180,9 @@ namespace BlackGui
void CCopyConfigurationComponent::initCurrentDirectories(bool preselectMissingOrOutdated)
{
const QString destinationDir = this->getThisVersionDirectory(); // cache or settings dir
if (this->m_initializedDestinationDir != destinationDir)
if (m_initializedDestinationDir != destinationDir)
{
this->m_initializedDestinationDir = destinationDir;
m_initializedDestinationDir = destinationDir;
const QDir thisVersionDirectory(destinationDir);
if (!thisVersionDirectory.exists())
{
@@ -204,7 +205,9 @@ namespace BlackGui
destinationModel->setNameFilters(this->getSourceFileFilter());
ui->tv_Destination->setModel(destinationModel);
ui->tv_Destination->setSortingEnabled(true);
connect(destinationModel, &QFileSystemModel::directoryLoaded, this, [ = ](const QString & path)
// disconnect when done, there have been problems that the lambda was called when the view was already destroyed
connectOnce(destinationModel, &QFileSystemModel::directoryLoaded, this, [ = ](const QString & path)
{
Q_UNUSED(path);
ui->tv_Destination->resizeColumnToContents(0);
@@ -217,9 +220,9 @@ namespace BlackGui
// source
const QString sourceDir = this->getOtherVersionsSelectedDirectory();
if (this->m_initializedSourceDir != sourceDir)
if (m_initializedSourceDir != sourceDir)
{
this->m_initializedSourceDir = sourceDir;
m_initializedSourceDir = sourceDir;
QFileSystemModel *sourceModel = qobject_cast<QFileSystemModel *>(ui->tv_Source->model());
if (!sourceModel)
{
@@ -229,7 +232,7 @@ namespace BlackGui
sourceModel->setNameFilters(this->getSourceFileFilter());
ui->tv_Source->setModel(sourceModel);
ui->tv_Source->setSortingEnabled(true); // hide/disable only
connect(sourceModel, &QFileSystemModel::directoryLoaded, this, [ = ](const QString & path)
connectOnce(sourceModel, &QFileSystemModel::directoryLoaded, this, [ = ](const QString & path)
{
Q_UNUSED(path);
ui->tv_Source->resizeColumnToContents(0);

View File

@@ -105,6 +105,7 @@ namespace BlackGui
if (!sApp || sApp->isShuttingDown()) { return; }
if (!this->hasSetupReader()) { return; }
sApp->getSetupReader()->prefillCacheWithLocalResourceBootstrapFile();
this->displaySetupCacheInfo();
}
void CSetupLoadingDialog::displaySetupCacheInfo()

View File

@@ -36,7 +36,10 @@
<number>6</number>
</property>
<item>
<widget class="QFrame" name="fr_Details">
<widget class="QGroupBox" name="gb_Details">
<property name="title">
<string>Setup and caches</string>
</property>
<layout class="QGridLayout" name="gl_Details" columnstretch="0,3,0,0,0">
<property name="topMargin">
<number>6</number>
@@ -49,18 +52,14 @@
</property>
<item row="3" column="1">
<widget class="QLineEdit" name="le_SetupCache">
<property name="whatsThis">
<string>Timestamp of the setup cache.</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pb_LoadFromDisk">
<property name="text">
<string> load from disk </string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_CmdLine">
<property name="text">
@@ -70,6 +69,9 @@
</item>
<item row="2" column="4">
<widget class="QLineEdit" name="le_BootstrapMode">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The mode, implicit means no URL is provided and the value is obtained from an existing setup.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
@@ -77,6 +79,9 @@
</item>
<item row="1" column="1" colspan="4">
<widget class="QLineEdit" name="le_CmdLine">
<property name="whatsThis">
<string>The command line.</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
@@ -101,6 +106,9 @@
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="le_BootstrapUrl">
<property name="whatsThis">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The bootstrap URL provided by command line options. This is where the setup data are loaded from.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
@@ -133,23 +141,39 @@
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="pb_LoadFromDisk">
<property name="text">
<string> load from disk </string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="BlackGui::Components::CLogComponent" name="comp_Messages">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>200</height>
</size>
<widget class="QGroupBox" name="gb_Log">
<property name="title">
<string>Log messages</string>
</property>
<layout class="QVBoxLayout" name="vl_LogMessages">
<item>
<widget class="BlackGui::Components::CLogComponent" name="comp_Messages">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>200</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>