mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 12:55:33 +08:00
swift launcher formatting
This commit is contained in:
@@ -50,30 +50,30 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->init();
|
||||
connect(ui->tb_SwiftCore, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
|
||||
connect(ui->tb_SwiftMappingTool, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
|
||||
connect(ui->tb_SwiftGui, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
|
||||
connect(ui->tb_Database, &QPushButton::pressed, this, &CSwiftLauncher::ps_startButtonPressed);
|
||||
connect(ui->tb_BackToMain, &QToolButton::pressed, this, &CSwiftLauncher::ps_showMainPage);
|
||||
connect(ui->tb_ConfigurationWizard, &QToolButton::pressed, this, &CSwiftLauncher::ps_startWizard);
|
||||
connect(ui->tb_Launcher, &QToolBox::currentChanged, this, &CSwiftLauncher::ps_tabChanged);
|
||||
connect(ui->comp_DistributionInfo, &CDistributionInfoComponent::distributionInfoAvailable, this, &CSwiftLauncher::ps_distributionInfoAvailable);
|
||||
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &CSwiftLauncher::ps_onStyleSheetsChanged);
|
||||
connect(ui->tb_SwiftCore, &QPushButton::pressed, this, &CSwiftLauncher::startButtonPressed);
|
||||
connect(ui->tb_SwiftMappingTool, &QPushButton::pressed, this, &CSwiftLauncher::startButtonPressed);
|
||||
connect(ui->tb_SwiftGui, &QPushButton::pressed, this, &CSwiftLauncher::startButtonPressed);
|
||||
connect(ui->tb_Database, &QPushButton::pressed, this, &CSwiftLauncher::startButtonPressed);
|
||||
connect(ui->tb_BackToMain, &QToolButton::pressed, this, &CSwiftLauncher::showMainPage);
|
||||
connect(ui->tb_ConfigurationWizard, &QToolButton::pressed, this, &CSwiftLauncher::startWizard);
|
||||
connect(ui->tb_Launcher, &QToolBox::currentChanged, this, &CSwiftLauncher::tabChanged);
|
||||
connect(ui->comp_DistributionInfo, &CDistributionInfoComponent::distributionInfoAvailable, this, &CSwiftLauncher::distributionInfoAvailable);
|
||||
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &CSwiftLauncher::onStyleSheetsChanged);
|
||||
|
||||
new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_L), this, SLOT(ps_showLogPage()));
|
||||
new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_L), this, SLOT(showLogPage()));
|
||||
|
||||
// default from settings
|
||||
this->setDefaults();
|
||||
|
||||
// periodically check
|
||||
connect(&m_checkTimer, &QTimer::timeout, this, &CSwiftLauncher::ps_checkRunningApplicationsAndCore);
|
||||
connect(&m_checkTimer, &QTimer::timeout, this, &CSwiftLauncher::checkRunningApplicationsAndCore);
|
||||
m_checkTimer.setInterval(2500);
|
||||
m_checkTimer.start();
|
||||
|
||||
// auto launch wizard
|
||||
if (sGui->isInstallerOptionSet())
|
||||
{
|
||||
QTimer::singleShot(2500, this, &CSwiftLauncher::ps_startWizard);
|
||||
QTimer::singleShot(2500, this, &CSwiftLauncher::startWizard);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ void CSwiftLauncher::mouseMoveEvent(QMouseEvent *event)
|
||||
if (!handleMouseMoveEvent(event)) { QDialog::mouseMoveEvent(event); }
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_displayLatestNews(QNetworkReply *reply)
|
||||
void CSwiftLauncher::displayLatestNews(QNetworkReply *reply)
|
||||
{
|
||||
QScopedPointer<QNetworkReply, QScopedPointerDeleteLater> nwReply(reply);
|
||||
if (nwReply->error() == QNetworkReply::NoError)
|
||||
@@ -136,7 +136,7 @@ void CSwiftLauncher::ps_displayLatestNews(QNetworkReply *reply)
|
||||
}
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_distributionInfoAvailable()
|
||||
void CSwiftLauncher::distributionInfoAvailable()
|
||||
{
|
||||
this->setHeaderInfo(ui->comp_DistributionInfo->getNewAvailableVersionForSelection());
|
||||
this->loadLatestNews();
|
||||
@@ -185,7 +185,7 @@ void CSwiftLauncher::loadLatestNews()
|
||||
CLogMessage(this).warning("No working news URL in %1") << newsUrls.toQString();
|
||||
return;
|
||||
}
|
||||
sGui->getFromNetwork(newsUrl, { this, &CSwiftLauncher::ps_displayLatestNews});
|
||||
sGui->getFromNetwork(newsUrl, { this, &CSwiftLauncher::displayLatestNews});
|
||||
}
|
||||
|
||||
void CSwiftLauncher::loadAbout()
|
||||
@@ -209,7 +209,7 @@ void CSwiftLauncher::initLogDisplay()
|
||||
auto logHandler = CLogHandler::instance()->handlerForPattern(
|
||||
CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo)
|
||||
);
|
||||
logHandler->subscribe(this, &CSwiftLauncher::ps_appendLogMessage);
|
||||
logHandler->subscribe(this, &CSwiftLauncher::appendLogMessage);
|
||||
|
||||
ui->comp_SwiftLauncherLog->showFilterBar();
|
||||
ui->comp_SwiftLauncherLog->filterUseRadioButtonDescriptiveIcons(false);
|
||||
@@ -268,7 +268,7 @@ bool CSwiftLauncher::setSwiftGuiExecutable()
|
||||
"DBus server for '" + dBus + "' can not be connected.\n\n" +
|
||||
"Likely the core is not running or is not reachable.\n\n" +
|
||||
"Details: " + msg, true);
|
||||
this->ps_showStatusMessage(m);
|
||||
this->showStatusMessage(m);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -350,7 +350,7 @@ QString CSwiftLauncher::toCmdLine(const QString &exe, const QStringList &exeArgs
|
||||
return cmd;
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_startButtonPressed()
|
||||
void CSwiftLauncher::startButtonPressed()
|
||||
{
|
||||
const QObject *sender = QObject::sender();
|
||||
if (sender == ui->tb_SwiftGui)
|
||||
@@ -381,42 +381,42 @@ void CSwiftLauncher::ps_startButtonPressed()
|
||||
}
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_dbusServerModeSelected(bool selected)
|
||||
void CSwiftLauncher::dbusServerModeSelected(bool selected)
|
||||
{
|
||||
if (!selected) { return; }
|
||||
if (!this->isStandaloneGuiSelected()) { return; }
|
||||
ui->rb_SwiftCoreAudioOnGui->setChecked(true);
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_showStatusMessage(const CStatusMessage &msg)
|
||||
void CSwiftLauncher::showStatusMessage(const CStatusMessage &msg)
|
||||
{
|
||||
ui->fr_SwiftLauncherMain->showOverlayMessage(msg, 5000);
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_appendLogMessage(const CStatusMessage &message)
|
||||
void CSwiftLauncher::appendLogMessage(const CStatusMessage &message)
|
||||
{
|
||||
ui->comp_SwiftLauncherLog->appendStatusMessageToList(message);
|
||||
if (message.getSeverity() == CStatusMessage::SeverityError)
|
||||
{
|
||||
this->ps_showStatusMessage(message);
|
||||
this->showStatusMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_appendLogMessages(const CStatusMessageList &messages)
|
||||
void CSwiftLauncher::appendLogMessages(const CStatusMessageList &messages)
|
||||
{
|
||||
ui->comp_SwiftLauncherLog->appendStatusMessagesToList(messages);
|
||||
if (messages.hasErrorMessages())
|
||||
{
|
||||
this->ps_showStatusMessage(messages.getErrorMessages().toSingleMessage());
|
||||
this->showStatusMessage(messages.getErrorMessages().toSingleMessage());
|
||||
}
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_showMainPage()
|
||||
void CSwiftLauncher::showMainPage()
|
||||
{
|
||||
ui->sw_SwiftLauncher->setCurrentWidget(ui->pg_SwiftLauncherMain);
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_tabChanged(int current)
|
||||
void CSwiftLauncher::tabChanged(int current)
|
||||
{
|
||||
if (current == static_cast<int>(PageUpdates))
|
||||
{
|
||||
@@ -424,12 +424,12 @@ void CSwiftLauncher::ps_tabChanged(int current)
|
||||
}
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_showLogPage()
|
||||
void CSwiftLauncher::showLogPage()
|
||||
{
|
||||
ui->sw_SwiftLauncher->setCurrentWidget(ui->pg_SwiftLauncherLog);
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_checkRunningApplicationsAndCore()
|
||||
void CSwiftLauncher::checkRunningApplicationsAndCore()
|
||||
{
|
||||
// wait some time before buttons are enabled (allows startup)
|
||||
if (m_startCoreWaitCycles > 0) { m_startCoreWaitCycles--; }
|
||||
@@ -446,7 +446,7 @@ void CSwiftLauncher::ps_checkRunningApplicationsAndCore()
|
||||
ui->tb_SwiftGui->setEnabled(!foundLocalPilotClientGui && m_startGuiWaitCycles < 1);
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_startWizard()
|
||||
void CSwiftLauncher::startWizard()
|
||||
{
|
||||
const bool show = this->warnAboutOtherSwiftApplications();
|
||||
if (!show) { return; }
|
||||
@@ -457,7 +457,7 @@ void CSwiftLauncher::ps_startWizard()
|
||||
m_wizard->show();
|
||||
}
|
||||
|
||||
void CSwiftLauncher::ps_onStyleSheetsChanged()
|
||||
void CSwiftLauncher::onStyleSheetsChanged()
|
||||
{
|
||||
this->initStyleSheet();
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ private:
|
||||
void setHeaderInfo(const QString &newVersionAvailable);
|
||||
|
||||
//! Latest news
|
||||
//! \sa CSwiftLauncher::ps_displayLatestNews
|
||||
//! \sa CSwiftLauncher::displayLatestNews
|
||||
void loadLatestNews();
|
||||
|
||||
//! Load credits and legal info
|
||||
@@ -139,48 +139,47 @@ private:
|
||||
//! Check for other swift applications, if so show message box
|
||||
bool warnAboutOtherSwiftApplications();
|
||||
|
||||
//! Command line
|
||||
static QString toCmdLine(const QString &exe, const QStringList &exeArgs);
|
||||
|
||||
private slots:
|
||||
//! Display latest news
|
||||
void ps_displayLatestNews(QNetworkReply *reply);
|
||||
void displayLatestNews(QNetworkReply *reply);
|
||||
|
||||
//! Distribution info is available
|
||||
void ps_distributionInfoAvailable();
|
||||
void distributionInfoAvailable();
|
||||
|
||||
//! Start button pressed
|
||||
void ps_startButtonPressed();
|
||||
void startButtonPressed();
|
||||
|
||||
//! DBus server mode selected
|
||||
void ps_dbusServerModeSelected(bool selected);
|
||||
void dbusServerModeSelected(bool selected);
|
||||
|
||||
//! Display status message as overlay
|
||||
void ps_showStatusMessage(const BlackMisc::CStatusMessage &msg);
|
||||
void showStatusMessage(const BlackMisc::CStatusMessage &msg);
|
||||
|
||||
//! Append status message
|
||||
void ps_appendLogMessage(const BlackMisc::CStatusMessage &message);
|
||||
void appendLogMessage(const BlackMisc::CStatusMessage &message);
|
||||
|
||||
//! Append status messages
|
||||
void ps_appendLogMessages(const BlackMisc::CStatusMessageList &messages);
|
||||
void appendLogMessages(const BlackMisc::CStatusMessageList &messages);
|
||||
|
||||
//! Show set main page
|
||||
void ps_showMainPage();
|
||||
void showMainPage();
|
||||
|
||||
//! Tab changed
|
||||
void ps_tabChanged(int current);
|
||||
void tabChanged(int current);
|
||||
|
||||
//! Show the log page
|
||||
void ps_showLogPage();
|
||||
void showLogPage();
|
||||
|
||||
//! Check if applications are already running
|
||||
void ps_checkRunningApplicationsAndCore();
|
||||
void checkRunningApplicationsAndCore();
|
||||
|
||||
//! Start the configuration wizard
|
||||
void ps_startWizard();
|
||||
void startWizard();
|
||||
|
||||
//! Style sheet has been changed
|
||||
void ps_onStyleSheetsChanged();
|
||||
void onStyleSheetsChanged();
|
||||
|
||||
//! Command line
|
||||
static QString toCmdLine(const QString &exe, const QStringList &exeArgs);
|
||||
};
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
<item>
|
||||
<widget class="QToolBox" name="tb_Launcher">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="tabSpacing">
|
||||
<number>6</number>
|
||||
@@ -772,6 +772,22 @@ p, li { white-space: pre-wrap; }
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>tbr_LatestNews</tabstop>
|
||||
<tabstop>rb_WindowNormal</tabstop>
|
||||
<tabstop>rb_WindowFrameless</tabstop>
|
||||
<tabstop>rb_SwiftStandalone</tabstop>
|
||||
<tabstop>rb_SwiftCoreAudioOnGui</tabstop>
|
||||
<tabstop>rb_SwiftCoreAudioOnCore</tabstop>
|
||||
<tabstop>sa_DataUpdates</tabstop>
|
||||
<tabstop>tbr_About</tabstop>
|
||||
<tabstop>tb_SwiftGui</tabstop>
|
||||
<tabstop>tb_SwiftCore</tabstop>
|
||||
<tabstop>tb_SwiftMappingTool</tabstop>
|
||||
<tabstop>tb_Database</tabstop>
|
||||
<tabstop>tb_ConfigurationWizard</tabstop>
|
||||
<tabstop>tb_BackToMain</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../blackmisc/blackmisc.qrc"/>
|
||||
<include location="swiftlauncher.qrc"/>
|
||||
|
||||
Reference in New Issue
Block a user