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/settingscache.h"
#include "blackmisc/datacache.h" #include "blackmisc/datacache.h"
#include "blackmisc/logmessage.h" #include "blackmisc/logmessage.h"
#include "blackmisc/slot.h"
#include <QDirIterator> #include <QDirIterator>
#include <QFileInfoList> #include <QFileInfoList>
@@ -179,9 +180,9 @@ namespace BlackGui
void CCopyConfigurationComponent::initCurrentDirectories(bool preselectMissingOrOutdated) void CCopyConfigurationComponent::initCurrentDirectories(bool preselectMissingOrOutdated)
{ {
const QString destinationDir = this->getThisVersionDirectory(); // cache or settings dir 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); const QDir thisVersionDirectory(destinationDir);
if (!thisVersionDirectory.exists()) if (!thisVersionDirectory.exists())
{ {
@@ -204,7 +205,9 @@ namespace BlackGui
destinationModel->setNameFilters(this->getSourceFileFilter()); destinationModel->setNameFilters(this->getSourceFileFilter());
ui->tv_Destination->setModel(destinationModel); ui->tv_Destination->setModel(destinationModel);
ui->tv_Destination->setSortingEnabled(true); 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); Q_UNUSED(path);
ui->tv_Destination->resizeColumnToContents(0); ui->tv_Destination->resizeColumnToContents(0);
@@ -217,9 +220,9 @@ namespace BlackGui
// source // source
const QString sourceDir = this->getOtherVersionsSelectedDirectory(); 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()); QFileSystemModel *sourceModel = qobject_cast<QFileSystemModel *>(ui->tv_Source->model());
if (!sourceModel) if (!sourceModel)
{ {
@@ -229,7 +232,7 @@ namespace BlackGui
sourceModel->setNameFilters(this->getSourceFileFilter()); sourceModel->setNameFilters(this->getSourceFileFilter());
ui->tv_Source->setModel(sourceModel); ui->tv_Source->setModel(sourceModel);
ui->tv_Source->setSortingEnabled(true); // hide/disable only 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); Q_UNUSED(path);
ui->tv_Source->resizeColumnToContents(0); ui->tv_Source->resizeColumnToContents(0);

View File

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

View File

@@ -36,7 +36,10 @@
<number>6</number> <number>6</number>
</property> </property>
<item> <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"> <layout class="QGridLayout" name="gl_Details" columnstretch="0,3,0,0,0">
<property name="topMargin"> <property name="topMargin">
<number>6</number> <number>6</number>
@@ -49,18 +52,14 @@
</property> </property>
<item row="3" column="1"> <item row="3" column="1">
<widget class="QLineEdit" name="le_SetupCache"> <widget class="QLineEdit" name="le_SetupCache">
<property name="whatsThis">
<string>Timestamp of the setup cache.</string>
</property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </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"> <item row="1" column="0">
<widget class="QLabel" name="lbl_CmdLine"> <widget class="QLabel" name="lbl_CmdLine">
<property name="text"> <property name="text">
@@ -70,6 +69,9 @@
</item> </item>
<item row="2" column="4"> <item row="2" column="4">
<widget class="QLineEdit" name="le_BootstrapMode"> <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"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -77,6 +79,9 @@
</item> </item>
<item row="1" column="1" colspan="4"> <item row="1" column="1" colspan="4">
<widget class="QLineEdit" name="le_CmdLine"> <widget class="QLineEdit" name="le_CmdLine">
<property name="whatsThis">
<string>The command line.</string>
</property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -101,6 +106,9 @@
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLineEdit" name="le_BootstrapUrl"> <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"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -133,23 +141,39 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2">
<widget class="QPushButton" name="pb_LoadFromDisk">
<property name="text">
<string> load from disk </string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="BlackGui::Components::CLogComponent" name="comp_Messages"> <widget class="QGroupBox" name="gb_Log">
<property name="sizePolicy"> <property name="title">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding"> <string>Log messages</string>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>200</height>
</size>
</property> </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> </widget>
</item> </item>
<item> <item>

View File

@@ -77,6 +77,20 @@ BlackGui--Components--CCopyConfigurationComponent {
} }
*/ */
/* setup load dialog */
BlackGui--Components--CSetupLoadingDialog {
background: black; /* background is background color here */
background-image: url(:/textures/icons/textures/texture-inner.jpg);
}
/* setup load dialog details frame */
/*
BlackGui--Components--CSetupLoadingDialog #fr_Details {
background-image: url(:/textures/icons/textures/texture-outer.jpg);
background-color: darkslategray;
}
*/
QFileDialog #sidebar { QFileDialog #sidebar {
background: black; background: black;
} }