Files
pilotclient/src/swiftlauncher/swiftlauncher.h
Klaus Basan d0daad7d34 refs #642, fixed setup loading, in same step refs #636 clear cache
* changed signals in setup reader
* explicit mode is default
* detailed information what is loaded
* new log pattern
* allow to add message list to log component
* allow to clear cache by cmd line arg
* consolidated cmd names
2016-05-05 20:49:13 +02:00

159 lines
4.3 KiB
C++

/* Copyright (C) 2015
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef SWIFTLAUNCHER_H
#define SWIFTLAUNCHER_H
#include "blackgui/overlaymessagesframe.h"
#include "blackgui/enableforframelesswindow.h"
#include "blackgui/mainwindowaccess.h"
#include "blackcore/data/globalsetup.h"
#include "blackcore/data/updateinfo.h"
#include "blackcore/coremodeenums.h"
#include "blackcore/settings/network.h"
#include <QDialog>
#include <QScopedPointer>
#include <QNetworkReply>
namespace Ui { class CSwiftLauncher; }
/*!
* swift launcher tool
* \note Besides the fact the launcher makes it easy to start our applications it also pre-fetches some
* cache files, hence reducing load times in the subsequent applications. Therefor starting via the launcher
* is preferable, but not mandatory.
*/
class CSwiftLauncher :
public QDialog,
public BlackGui::CEnableForFramelessWindow,
public BlackGui::IMainWindowAccess
{
Q_OBJECT
Q_INTERFACES(BlackGui::IMainWindowAccess)
public:
//! Constructor
explicit CSwiftLauncher(QWidget *parent = nullptr);
//! Destructor
~CSwiftLauncher();
//! Executable
const QString &getExecutable() const { return m_executable; }
//! Arguments
const QStringList &getExecutableArgs() const { return m_executableArgs; }
//! Current command line
QString getCmdLine() const;
protected:
//! \copydoc QDialog::mousePressEvent
virtual void mousePressEvent(QMouseEvent *event) override;
//! \copydoc QDialog::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event) override;
private slots:
void ps_displayLatestNews(QNetworkReply *reply);
private:
QScopedPointer<Ui::CSwiftLauncher> ui;
BlackMisc::CData<BlackCore::Data::UpdateInfo> m_updateInfo { this, &CSwiftLauncher::ps_changedUpdateInfoCache }; //!< version cache
BlackMisc::CSetting<BlackCore::Settings::Network::DBusServerAddress> m_dbusServerAddress { this }; //!< DBus address
QString m_executable;
QStringList m_executableArgs;
//! Get core mode
BlackCore::CoreModes::CoreMode getCoreMode() const;
//! select DBus address/mode
QString getDBusAddress() const;
//! Selected window mode
BlackGui::CEnableForFramelessWindow::WindowMode getWindowMode() const;
//! Init
void init();
//! style sheets
void initStyleSheet();
//! combobox for DBus
void initDBusGui();
//! Version string
void initVersion();
//! Log display
void initLogDisplay();
//! latest news
void loadLatestNews();
//! Start the core
void startSwiftCore();
//! Set executable for swift data
void setSwiftDataExecutable();
//! Set executable for swift GUI
bool setSwiftGuiExecutable();
//! Can DBus server be connected
bool canConnectDBusServer(QString &msg) const;
//! Standalone GUI selected
bool isStandaloneGuiSelected() const;
//! Set default
void setDefault(const QString &value);
//! Command line
static QString toCmdLine(const QString &exe, const QStringList &exeArgs);
private slots:
//! Load latest version
void ps_loadSetup();
//! Loaded latest version
void ps_loadedUpdateInfo(bool success);
//! Cache values have been changed
void ps_changedUpdateInfoCache();
//! Start button pressed
void ps_startButtonPressed();
//! Changed selection
void ps_dbusServerAddressSelectionChanged(const QString &currentText);
//! DBus server mode selected
void ps_dbusServerModeSelected(bool selected);
//! Display status message as overlay
void ps_showStatusMessage(const BlackMisc::CStatusMessage &msg);
//! Append status message
void ps_appendLogMessage(const BlackMisc::CStatusMessage &message);
//! Append status messages
void ps_appendLogMessages(const BlackMisc::CStatusMessageList &messages);
//! Show set main page
void ps_showMainPage();
//! Show the log page
void ps_showLogPage();
};
#endif // guard