mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-28 11:45:40 +08:00
refs #507, launcher (new GUI)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
54cb61db19
commit
30e6831bf8
140
src/swiftlauncher/swiftlauncher.h
Normal file
140
src/swiftlauncher/swiftlauncher.h
Normal file
@@ -0,0 +1,140 @@
|
||||
/* 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 <QDialog>
|
||||
#include <QScopedPointer>
|
||||
#include "blackcore/setupreader.h"
|
||||
#include "blackgui/enableforframelesswindow.h"
|
||||
#include "blackgui/overlaymessagesframe.h"
|
||||
#include "swiftguistandard/guimodeenums.h"
|
||||
|
||||
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
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
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);
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CSwiftLauncher> ui;
|
||||
BlackCore::CData<BlackCore::Data::GlobalSetup> m_setup { this, &CSwiftLauncher::ps_loadedSetup }; //!< setup cache
|
||||
BlackCore::CData<BlackCore::Data::Download> m_download { this, &CSwiftLauncher::ps_loadedSetup };
|
||||
QString m_executable;
|
||||
QStringList m_executableArgs;
|
||||
|
||||
//! Get core mode
|
||||
GuiModes::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 displayLatestNews();
|
||||
|
||||
//! 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;
|
||||
|
||||
//! Command line
|
||||
static QString toCmdLine(const QString &exe, const QStringList &exeArgs);
|
||||
|
||||
private slots:
|
||||
//! Load latest version
|
||||
void ps_loadSetup();
|
||||
|
||||
//! Loaded latest version
|
||||
void ps_loadedSetup();
|
||||
|
||||
//! Start button pressed
|
||||
void ps_startButtonPressed();
|
||||
|
||||
//! Changed selection
|
||||
void ps_dbusServerAddressSelectionChanged(const QString ¤tText);
|
||||
|
||||
//! 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);
|
||||
|
||||
//! Show set main page
|
||||
void ps_showMainPage();
|
||||
|
||||
//! Show the log page
|
||||
void ps_showLogPage();
|
||||
};
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user