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->setTextFormat(Qt::RichText);
ui->lbl_DatabaseUrl->setTextInteractionFlags(Qt::TextBrowserInteraction); ui->lbl_DatabaseUrl->setTextInteractionFlags(Qt::TextBrowserInteraction);
ui->lbl_DatabaseUrl->setOpenExternalLinks(true); 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_ReloadAircraft, &QToolButton::pressed, this, &CDbLoadOverviewComponent::ps_reloadPressed);
connect(ui->tb_ReloadAirlines, &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_ReloadModels, &QToolButton::pressed, this, &CDbLoadOverviewComponent::ps_reloadPressed);
connect(ui->tb_ReloadDistributors, &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); connect(sGui->getWebDataServices(), &CWebDataServices::dataRead, this, &CDbLoadOverviewComponent::ps_dataLoaded);
// QTimer::singleShot(2000, this, &CDbLoadOverviewComponent::ps_setValues);
} }
CDbLoadOverviewComponent::~CDbLoadOverviewComponent() CDbLoadOverviewComponent::~CDbLoadOverviewComponent()
@@ -101,10 +102,34 @@ namespace BlackGui
ui->le_CountriesDbCount->setText(dbCountForEntity(CEntityFlags::CountryEntity)); ui->le_CountriesDbCount->setText(dbCountForEntity(CEntityFlags::CountryEntity));
ui->le_DistributorsDbCount->setText(dbCountForEntity(CEntityFlags::DistributorEntity)); ui->le_DistributorsDbCount->setText(dbCountForEntity(CEntityFlags::DistributorEntity));
const QString urlHtml("<a href=\"%1\">Open DB</a>"); ui->le_AircraftSharedFileTs->setText(sharedFileTimestampForEntity(CEntityFlags::AircraftIcaoEntity));
const QString url = sGui->getGlobalSetup().getDbHomePageUrl().getFullUrl(); ui->le_AirlinesSharedFileTs->setText(sharedFileTimestampForEntity(CEntityFlags::AirlineIcaoEntity));
ui->lbl_DatabaseUrl->setText(urlHtml.arg(url)); 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); 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(); } if (this->m_loadIndicator) { this->m_loadIndicator->stopAnimation(); }
} }
@@ -148,6 +173,12 @@ namespace BlackGui
return c < 0 ? "-" : QString::number(c); 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) QString CDbLoadOverviewComponent::dbCountForEntity(CEntityFlags::Entity entity)
{ {
const int c = sGui->getWebDataServices()->getDbInfoCount(entity); const int c = sGui->getWebDataServices()->getDbInfoCount(entity);
@@ -164,10 +195,15 @@ namespace BlackGui
if (this->m_reloading) { return; } if (this->m_reloading) { return; }
QObject *sender = QObject::sender(); QObject *sender = QObject::sender();
CEntityFlags::Entity entity = CEntityFlags::singleEntityByName(sender->objectName()); CEntityFlags::Entity entity = CEntityFlags::singleEntityByName(sender->objectName());
// DB entities
CEntityFlags::Entity triggeredEntity = sGui->getWebDataServices()->triggerReloadFromDb(entity); CEntityFlags::Entity triggeredEntity = sGui->getWebDataServices()->triggerReloadFromDb(entity);
if (triggeredEntity == CEntityFlags::NoEntity) { return; } if (triggeredEntity == CEntityFlags::NoEntity) { return; }
this->m_reloading = true; this->m_reloading = true;
this->showLoading(); this->showLoading();
// shared files ts
sGui->getWebDataServices()->triggerLoadingOfSharedFilesHeaders(entity);
} }
void CDbLoadOverviewComponent::ps_dataLoaded(CEntityFlags::Entity entity, CEntityFlags::ReadState state, int number) void CDbLoadOverviewComponent::ps_dataLoaded(CEntityFlags::Entity entity, CEntityFlags::ReadState state, int number)

View File

@@ -63,6 +63,9 @@ namespace BlackGui
//! Formatted count for entity //! Formatted count for entity
static QString cacheCountForEntity(BlackMisc::Network::CEntityFlags::Entity 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 //! Formatted count for entity
static QString dbCountForEntity(BlackMisc::Network::CEntityFlags::Entity 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); ui->setupUi(this);
this->init(); this->init();
ui->tb_Launcher->setCurrentIndex(0);
connect(ui->pb_CheckForUpdates, &QPushButton::pressed, this, &CSwiftLauncher::ps_loadSetup); connect(ui->pb_CheckForUpdates, &QPushButton::pressed, this, &CSwiftLauncher::ps_loadSetup);
connect(ui->tb_SwiftCore, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed); connect(ui->tb_SwiftCore, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
connect(ui->tb_SwiftMappingTool, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed); connect(ui->tb_SwiftMappingTool, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);

View File

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