mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 02:35:38 +08:00
refs #883, display core mode selection first
* show news only if new * removed duplicate call of this->ps_loadedUpdateInfo (avoid redundant loads)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f73ee87e13
commit
83dbd3fcb6
@@ -40,7 +40,6 @@ 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);
|
||||||
@@ -50,8 +49,12 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
|
|||||||
connect(ui->tb_Launcher, &QToolBox::currentChanged, this, &CSwiftLauncher::ps_tabChanged);
|
connect(ui->tb_Launcher, &QToolBox::currentChanged, this, &CSwiftLauncher::ps_tabChanged);
|
||||||
|
|
||||||
// use version signal as trigger for completion
|
// use version signal as trigger for completion
|
||||||
this->ps_loadedUpdateInfo(true); // defaults from settings, overridden by signal/slot when changed
|
|
||||||
connect(sGui, &CApplication::updateInfoAvailable, this, &CSwiftLauncher::ps_loadedUpdateInfo);
|
connect(sGui, &CApplication::updateInfoAvailable, this, &CSwiftLauncher::ps_loadedUpdateInfo);
|
||||||
|
QTimer::singleShot(10 * 1000, this, [ = ]
|
||||||
|
{
|
||||||
|
if (this->m_updateInfoLoaded) { return; }
|
||||||
|
this->ps_loadedUpdateInfo(true); // failover
|
||||||
|
});
|
||||||
|
|
||||||
new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_L), this, SLOT(ps_showLogPage()));
|
new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_L), this, SLOT(ps_showLogPage()));
|
||||||
ui->le_DBusServerPort->setValidator(new QIntValidator(0, 65535, this));
|
ui->le_DBusServerPort->setValidator(new QIntValidator(0, 65535, this));
|
||||||
@@ -112,7 +115,14 @@ void CSwiftLauncher::ps_displayLatestNews(QNetworkReply *reply)
|
|||||||
if (nwReply->error() == QNetworkReply::NoError)
|
if (nwReply->error() == QNetworkReply::NoError)
|
||||||
{
|
{
|
||||||
const QString html = nwReply->readAll().trimmed();
|
const QString html = nwReply->readAll().trimmed();
|
||||||
|
if (html.isEmpty()) { return; }
|
||||||
ui->te_LatestNews->setHtml(html);
|
ui->te_LatestNews->setHtml(html);
|
||||||
|
constexpr qint64 newNews = 72 * 3600 * 1000;
|
||||||
|
const qint64 deltaT = CNetworkUtils::lastModifiedSinceNow(nwReply.data());
|
||||||
|
if (deltaT > 0 && deltaT < newNews)
|
||||||
|
{
|
||||||
|
ui->tb_Launcher->setCurrentWidget(ui->pg_LatestNews);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,6 +150,9 @@ void CSwiftLauncher::init()
|
|||||||
this->initLogDisplay();
|
this->initLogDisplay();
|
||||||
this->initDBusGui();
|
this->initDBusGui();
|
||||||
this->initVersion();
|
this->initVersion();
|
||||||
|
|
||||||
|
ui->sw_SwiftLauncher->setCurrentWidget(ui->pg_SwiftLauncherMain);
|
||||||
|
ui->tb_Launcher->setCurrentWidget(ui->pg_CoreMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSwiftLauncher::initStyleSheet()
|
void CSwiftLauncher::initStyleSheet()
|
||||||
@@ -316,6 +329,7 @@ void CSwiftLauncher::ps_loadedUpdateInfo(bool success)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->m_updateInfoLoaded = true;
|
||||||
const CUpdateInfo updateInfo(this->m_updateInfo.get());
|
const CUpdateInfo updateInfo(this->m_updateInfo.get());
|
||||||
const QString latestVersion(updateInfo.getLatestVersion()) ; // need to get this from somewhere
|
const QString latestVersion(updateInfo.getLatestVersion()) ; // need to get this from somewhere
|
||||||
CFailoverUrlList downloadUrls(updateInfo.getDownloadUrls());
|
CFailoverUrlList downloadUrls(updateInfo.getDownloadUrls());
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
explicit CSwiftLauncher(QWidget *parent = nullptr);
|
explicit CSwiftLauncher(QWidget *parent = nullptr);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
~CSwiftLauncher();
|
virtual ~CSwiftLauncher();
|
||||||
|
|
||||||
//! Executable
|
//! Executable
|
||||||
const QString &getExecutable() const { return m_executable; }
|
const QString &getExecutable() const { return m_executable; }
|
||||||
@@ -85,6 +85,7 @@ private:
|
|||||||
QTimer m_checkTimer { this };
|
QTimer m_checkTimer { this };
|
||||||
int m_startCoreWaitCycles = 0;
|
int m_startCoreWaitCycles = 0;
|
||||||
int m_startMappingToolWaitCycles = 0;
|
int m_startMappingToolWaitCycles = 0;
|
||||||
|
bool m_updateInfoLoaded = false;
|
||||||
|
|
||||||
//! Get core mode
|
//! Get core mode
|
||||||
BlackCore::CoreModes::CoreMode getCoreMode() const;
|
BlackCore::CoreModes::CoreMode getCoreMode() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user