refs #787, display shared files timestamp in UI

This commit is contained in:
Klaus Basan
2016-11-03 02:38:24 +01:00
parent ff394f4785
commit 52cd84dd99
5 changed files with 879 additions and 412 deletions

View File

@@ -34,6 +34,9 @@ namespace BlackGui
ui->lbl_DatabaseUrl->setTextFormat(Qt::RichText);
ui->lbl_DatabaseUrl->setTextInteractionFlags(Qt::TextBrowserInteraction);
ui->lbl_DatabaseUrl->setOpenExternalLinks(true);
ui->lbl_SharedUrls->setTextFormat(Qt::RichText);
ui->lbl_SharedUrls->setTextInteractionFlags(Qt::TextBrowserInteraction);
ui->lbl_SharedUrls->setOpenExternalLinks(true);
connect(ui->tb_ReloadAircraft, &QToolButton::pressed, this, &CDbLoadOverviewComponent::ps_reloadPressed);
connect(ui->tb_ReloadAirlines, &QToolButton::pressed, this, &CDbLoadOverviewComponent::ps_reloadPressed);
@@ -43,8 +46,6 @@ namespace BlackGui
connect(ui->tb_ReloadModels, &QToolButton::pressed, this, &CDbLoadOverviewComponent::ps_reloadPressed);
connect(ui->tb_ReloadDistributors, &QToolButton::pressed, this, &CDbLoadOverviewComponent::ps_reloadPressed);
connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbLoadOverviewComponent::ps_dataLoaded);
// QTimer::singleShot(2000, this, &CDbLoadOverviewComponent::ps_setValues);
}
CDbLoadOverviewComponent::~CDbLoadOverviewComponent()
@@ -101,10 +102,34 @@ namespace BlackGui
ui->le_CountriesDbCount->setText(dbCountForEntity(CEntityFlags::CountryEntity));
ui->le_DistributorsDbCount->setText(dbCountForEntity(CEntityFlags::DistributorEntity));
const QString urlHtml("<a href=\"%1\">Open DB</a>");
const QString url = sGui->getGlobalSetup().getDbHomePageUrl().getFullUrl();
ui->lbl_DatabaseUrl->setText(urlHtml.arg(url));
ui->le_AircraftSharedFileTs->setText(sharedFileTimestampForEntity(CEntityFlags::AircraftIcaoEntity));
ui->le_AirlinesSharedFileTs->setText(sharedFileTimestampForEntity(CEntityFlags::AirlineIcaoEntity));
ui->le_AirportsSharedFileTs->setText(sharedFileTimestampForEntity(CEntityFlags::AirportEntity));
ui->le_LiveriesSharedFileTs->setText(sharedFileTimestampForEntity(CEntityFlags::LiveryEntity));
ui->le_ModelsSharedFileTs->setText(sharedFileTimestampForEntity(CEntityFlags::ModelEntity));
ui->le_CountriesSharedFileTs->setText(sharedFileTimestampForEntity(CEntityFlags::CountryEntity));
ui->le_DistributorsSharedFileTs->setText(sharedFileTimestampForEntity(CEntityFlags::DistributorEntity));
// DB URL
const QString dbUrlHtml("<a href=\"%1\">%2</a>");
QString url = sGui->getGlobalSetup().getDbHomePageUrl().getFullUrl();
ui->lbl_DatabaseUrl->setText(dbUrlHtml.arg(url, url));
ui->lbl_DatabaseUrl->setToolTip(url);
// Shared URLs
const CUrlList sharedUrls(sGui->getGlobalSetup().getSwiftSharedUrls());
const QString sharedUrlHtml("<a href=\"%1\">%2</a>");
QString sharedUrlsHtml;
for (const CUrl &url : sharedUrls)
{
sharedUrlsHtml += sharedUrlHtml.arg(url.getFullUrl(), url.getHost());
sharedUrlsHtml += " ";
}
ui->lbl_SharedUrls->setText(sharedUrlsHtml.trimmed());
ui->lbl_SharedUrls->setToolTip(sharedUrls.toQString());
// Indicator
if (this->m_loadIndicator) { this->m_loadIndicator->stopAnimation(); }
}
@@ -148,6 +173,12 @@ namespace BlackGui
return c < 0 ? "-" : QString::number(c);
}
QString CDbLoadOverviewComponent::sharedFileTimestampForEntity(CEntityFlags::Entity entity)
{
const QDateTime ts = sGui->getWebDataServices()->getSharedFileTimestamp(entity);
return formattedTimestamp(ts);
}
QString CDbLoadOverviewComponent::dbCountForEntity(CEntityFlags::Entity entity)
{
const int c = sGui->getWebDataServices()->getDbInfoCount(entity);
@@ -164,10 +195,15 @@ namespace BlackGui
if (this->m_reloading) { return; }
QObject *sender = QObject::sender();
CEntityFlags::Entity entity = CEntityFlags::singleEntityByName(sender->objectName());
// DB entities
CEntityFlags::Entity triggeredEntity = sGui->getWebDataServices()->triggerReloadFromDb(entity);
if (triggeredEntity == CEntityFlags::NoEntity) { return; }
this->m_reloading = true;
this->showLoading();
// shared files ts
sGui->getWebDataServices()->triggerLoadingOfSharedFilesHeaders(entity);
}
void CDbLoadOverviewComponent::ps_dataLoaded(CEntityFlags::Entity entity, CEntityFlags::ReadState state, int number)

View File

@@ -63,6 +63,9 @@ namespace BlackGui
//! Formatted count for entity
static QString cacheCountForEntity(BlackMisc::Network::CEntityFlags::Entity entity);
//! Formatted ts for entity
static QString sharedFileTimestampForEntity(BlackMisc::Network::CEntityFlags::Entity entity);
//! Formatted count for entity
static QString dbCountForEntity(BlackMisc::Network::CEntityFlags::Entity entity);

File diff suppressed because it is too large Load Diff

View File

@@ -40,6 +40,7 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
{
ui->setupUi(this);
this->init();
ui->tb_Launcher->setCurrentIndex(0);
connect(ui->pb_CheckForUpdates, &QPushButton::pressed, this, &CSwiftLauncher::ps_loadSetup);
connect(ui->tb_SwiftCore, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
connect(ui->tb_SwiftMappingTool, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);

View File

@@ -78,7 +78,7 @@
<item>
<widget class="QToolBox" name="tb_Launcher">
<property name="currentIndex">
<number>4</number>
<number>2</number>
</property>
<property name="tabSpacing">
<number>6</number>
@@ -181,8 +181,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>390</width>
<height>326</height>
<width>376</width>
<height>331</height>
</rect>
</property>
<attribute name="label">
@@ -204,6 +204,83 @@
<property name="spacing">
<number>4</number>
</property>
<item row="0" column="1" alignment="Qt::AlignHCenter">
<widget class="QRadioButton" name="rb_SwiftCoreGuiAudio">
<property name="text">
<string>GUI and core</string>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_CoreMode</string>
</attribute>
</widget>
</item>
<item row="0" column="2" alignment="Qt::AlignHCenter">
<widget class="QRadioButton" name="rb_SwiftCoreAudio">
<property name="text">
<string>GUI and core</string>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_CoreMode</string>
</attribute>
</widget>
</item>
<item row="0" column="0" alignment="Qt::AlignHCenter">
<widget class="QRadioButton" name="rb_SwiftStandalone">
<property name="text">
<string>standalone</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_CoreMode</string>
</attribute>
</widget>
</item>
<item row="2" column="1" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lbl_SwiftCoreIcon">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="swiftlauncher.qrc">:/launcher/icons/swiftGUIandCore115x85.png</pixmap>
</property>
</widget>
</item>
<item row="1" column="1" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lbl_AudioGui">
<property name="text">
<string>Audio on GUI side</string>
</property>
</widget>
</item>
<item row="2" column="2" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lbl_SwiftCoreAudioIcon">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="swiftlauncher.qrc">:/launcher/icons/swiftGUIandCore115x85.png</pixmap>
</property>
</widget>
</item>
<item row="2" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lbl_SwiftStandaloneIcon">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="swiftlauncher.qrc">:/launcher/icons/swiftNormal61x100.png</pixmap>
</property>
</widget>
</item>
<item row="1" column="2" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lbl_AudioCore">
<property name="text">
<string>Audio on core side</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QGroupBox" name="gb_DBusServer">
<property name="title">
@@ -322,81 +399,23 @@
</layout>
</widget>
</item>
<item row="0" column="1" alignment="Qt::AlignHCenter">
<widget class="QRadioButton" name="rb_SwiftCoreGuiAudio">
<property name="text">
<string>GUI and core</string>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_CoreMode</string>
</attribute>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="lbl_SwiftCoreIcon">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="swiftlauncher.qrc">:/launcher/icons/swiftGUIandCore115x85.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="2" alignment="Qt::AlignHCenter">
<widget class="QRadioButton" name="rb_SwiftCoreAudio">
<property name="text">
<string>GUI and core</string>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_CoreMode</string>
</attribute>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="lbl_SwiftCoreAudioIcon">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="swiftlauncher.qrc">:/launcher/icons/swiftGUIandCore115x85.png</pixmap>
</property>
</widget>
</item>
<item row="0" column="0" alignment="Qt::AlignHCenter">
<widget class="QRadioButton" name="rb_SwiftStandalone">
<property name="text">
<string>standalone</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<attribute name="buttonGroup">
<string notr="true">bg_CoreMode</string>
</attribute>
</widget>
</item>
<item row="1" column="1" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lbl_AudioGui">
<property name="text">
<string>Audio on GUI side</string>
</property>
</widget>
</item>
<item row="2" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lbl_SwiftStandaloneIcon">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="swiftlauncher.qrc">:/launcher/icons/swiftNormal61x100.png</pixmap>
</property>
</widget>
</item>
<item row="1" column="2" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="lbl_AudioCore">
<property name="text">
<string>Audio on core side</string>
</property>
<item row="4" column="0" colspan="3">
<widget class="QWidget" name="wi_CoreButtonSpace" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="vs_CoreButtomSpace">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
@@ -837,8 +856,8 @@ p, li { white-space: pre-wrap; }
</customwidget>
</customwidgets>
<resources>
<include location="../blackmisc/blackmisc.qrc"/>
<include location="swiftlauncher.qrc"/>
<include location="../blackmisc/blackmisc.qrc"/>
</resources>
<connections/>
<buttongroups>