mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-05-06 01:57:31 +08:00
refs #473, own launcher subproject
* command line args for swift GUI * removed _ from swiftgui_standard * removed _ from swift_resources
This commit is contained in:
committed by
Mathew Sutcliffe
parent
8e57914e67
commit
6dd66284ca
@@ -7,6 +7,7 @@ BLACK_CONFIG += Unittests
|
|||||||
BLACK_CONFIG += SwiftData
|
BLACK_CONFIG += SwiftData
|
||||||
BLACK_CONFIG += SwiftCore
|
BLACK_CONFIG += SwiftCore
|
||||||
BLACK_CONFIG += SwiftGui
|
BLACK_CONFIG += SwiftGui
|
||||||
|
BLACK_CONFIG += SwiftLauncher
|
||||||
BLACK_CONFIG += FS9
|
BLACK_CONFIG += FS9
|
||||||
BLACK_CONFIG += FSX
|
BLACK_CONFIG += FSX
|
||||||
BLACK_CONFIG += XPlane
|
BLACK_CONFIG += XPlane
|
||||||
|
|||||||
@@ -41,6 +41,28 @@ namespace BlackGui
|
|||||||
setMode(frameless ? WindowFrameless : WindowTool);
|
setMode(frameless ? WindowFrameless : WindowTool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CEnableForFramelessWindow::WindowMode CEnableForFramelessWindow::stringToWindowMode(const QString &s)
|
||||||
|
{
|
||||||
|
QString ws(s.trimmed().toLower());
|
||||||
|
if (ws.isEmpty()) { return WindowNormal; }
|
||||||
|
if (ws.contains("frameless") || ws.startsWith("f")) { return WindowFrameless; }
|
||||||
|
if (ws.contains("tool") || ws.startsWith("t")) { return WindowTool; }
|
||||||
|
return WindowNormal;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CEnableForFramelessWindow::windowModeToString(CEnableForFramelessWindow::WindowMode m)
|
||||||
|
{
|
||||||
|
switch (m)
|
||||||
|
{
|
||||||
|
case WindowFrameless: return "frameless";
|
||||||
|
case WindowNormal: return "normal";
|
||||||
|
case WindowTool: return "tool";
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return "normal";
|
||||||
|
}
|
||||||
|
|
||||||
void CEnableForFramelessWindow::setWindowAttributes(CEnableForFramelessWindow::WindowMode mode)
|
void CEnableForFramelessWindow::setWindowAttributes(CEnableForFramelessWindow::WindowMode mode)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(this->m_widget, "CEnableForFramelessWindow::setWindowAttributes", "Missing widget representing window");
|
Q_ASSERT_X(this->m_widget, "CEnableForFramelessWindow::setWindowAttributes", "Missing widget representing window");
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ namespace BlackGui
|
|||||||
//! Window modes
|
//! Window modes
|
||||||
enum WindowMode
|
enum WindowMode
|
||||||
{
|
{
|
||||||
WindowFrameless,
|
|
||||||
WindowNormal,
|
WindowNormal,
|
||||||
|
WindowFrameless,
|
||||||
WindowTool
|
WindowTool
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -56,6 +56,12 @@ namespace BlackGui
|
|||||||
//! Corresponding QMainWindow
|
//! Corresponding QMainWindow
|
||||||
QWidget *getWidget() const { return m_widget; }
|
QWidget *getWidget() const { return m_widget; }
|
||||||
|
|
||||||
|
//! String to window mode
|
||||||
|
static WindowMode stringToWindowMode(const QString &s);
|
||||||
|
|
||||||
|
//! String to window mode
|
||||||
|
static QString windowModeToString(WindowMode m);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//! Resize grip handle
|
//! Resize grip handle
|
||||||
void addFramelessSizeGripToStatusBar(QStatusBar *statusBar);
|
void addFramelessSizeGripToStatusBar(QStatusBar *statusBar);
|
||||||
@@ -97,7 +103,6 @@ namespace BlackGui
|
|||||||
|
|
||||||
//! Mouse moving, required for frameless window
|
//! Mouse moving, required for frameless window
|
||||||
bool handleMouseMoveEvent(QMouseEvent *event);
|
bool handleMouseMoveEvent(QMouseEvent *event);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -126,6 +126,12 @@ namespace BlackMisc
|
|||||||
//! Whole info
|
//! Whole info
|
||||||
static QString convertToQString(const QString &separator = QString("\n"));
|
static QString convertToQString(const QString &separator = QString("\n"));
|
||||||
|
|
||||||
|
//! Environment variable indicating "dev.environment"
|
||||||
|
static const QString &envVarDevelopment();
|
||||||
|
|
||||||
|
//! Environment variable private resources directory
|
||||||
|
static const QString &envVarPrivateSetupDir();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Constructor
|
//! Constructor
|
||||||
CProject() {}
|
CProject() {}
|
||||||
@@ -136,16 +142,10 @@ namespace BlackMisc
|
|||||||
// --------------- env.vars. -------------
|
// --------------- env.vars. -------------
|
||||||
// centralized in one place here so we have an overview
|
// centralized in one place here so we have an overview
|
||||||
|
|
||||||
//! Environment variable indicating "dev.environment"
|
|
||||||
static const QString &envVarDevelopment();
|
|
||||||
|
|
||||||
//! Value
|
//! Value
|
||||||
//! \return true|false
|
//! \return true|false
|
||||||
static QString envVarDevelopmentValue();
|
static QString envVarDevelopmentValue();
|
||||||
|
|
||||||
//! Environment variable private resources directory
|
|
||||||
static const QString &envVarPrivateSetupDir();
|
|
||||||
|
|
||||||
//! Value
|
//! Value
|
||||||
//! \return directory path
|
//! \return directory path
|
||||||
static QString envVarPrivateSetupDirValue();
|
static QString envVarPrivateSetupDirValue();
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
/* Copyright (C) 2013
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef STDGUI_GUIMODEENUMS_H
|
|
||||||
#define STDGUI_GUIMODEENUMS_H
|
|
||||||
|
|
||||||
|
|
||||||
//! Modes, how GUI can be started (core/GUI)
|
|
||||||
struct GuiModes
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
//! Core runs how and where?
|
|
||||||
enum CoreMode
|
|
||||||
{
|
|
||||||
CoreInGuiProcess,
|
|
||||||
CoreExternal,
|
|
||||||
CoreExternalAudioLocal
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // guard
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
/* Copyright (C) 2013
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "introwindow.h"
|
|
||||||
#include "swiftguistd.h"
|
|
||||||
#include "guimodeenums.h"
|
|
||||||
#include "blackgui/stylesheetutility.h"
|
|
||||||
#include "blackcore/blackcorefreefunctions.h"
|
|
||||||
#include "blackcore/context_runtime_config.h"
|
|
||||||
#include "blackgui/guiutility.h"
|
|
||||||
#include "blackmisc/blackmiscfreefunctions.h"
|
|
||||||
#include "blackmisc/logmessage.h"
|
|
||||||
#include "blackmisc/icons.h"
|
|
||||||
#include "blackmisc/loghandler.h"
|
|
||||||
#include "blackmisc/filelogger.h"
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <QPushButton>
|
|
||||||
|
|
||||||
using namespace BlackGui;
|
|
||||||
using namespace BlackMisc;
|
|
||||||
using namespace BlackCore;
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
QApplication a(argc, argv);
|
|
||||||
CGuiUtility::initSwiftGuiApplication(a, "swiftgui", CIcons::swift24());
|
|
||||||
|
|
||||||
// modes
|
|
||||||
BlackGui::CEnableForFramelessWindow::WindowMode windowMode;
|
|
||||||
|
|
||||||
// Dialog to decide external or internal core
|
|
||||||
CIntroWindow intro;
|
|
||||||
intro.setWindowIcon(CIcons::swift24());
|
|
||||||
BlackCore::CRuntimeConfig runtimeConfig;
|
|
||||||
if (intro.exec() == QDialog::Rejected)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GuiModes::CoreMode coreMode = intro.getCoreMode();
|
|
||||||
windowMode = intro.getWindowMode();
|
|
||||||
QString dbusAddress = CDBusServer::fixAddressToDBusAddress(intro.getDBusAddress());
|
|
||||||
switch (coreMode)
|
|
||||||
{
|
|
||||||
case GuiModes::CoreExternal:
|
|
||||||
runtimeConfig = CRuntimeConfig::remote(dbusAddress);
|
|
||||||
break;
|
|
||||||
case GuiModes::CoreInGuiProcess:
|
|
||||||
runtimeConfig = CRuntimeConfig::local(dbusAddress);
|
|
||||||
break;
|
|
||||||
case GuiModes::CoreExternalAudioLocal:
|
|
||||||
runtimeConfig = CRuntimeConfig::remoteLocalAudio(dbusAddress);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
intro.close();
|
|
||||||
|
|
||||||
// show window
|
|
||||||
SwiftGuiStd w(windowMode);
|
|
||||||
w.init(runtimeConfig); // object is complete by now
|
|
||||||
w.show();
|
|
||||||
|
|
||||||
int r = a.exec();
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
56
src/swiftguistandard/guimodeenums.h
Normal file
56
src/swiftguistandard/guimodeenums.h
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
/* Copyright (C) 2013
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef STDGUI_GUIMODEENUMS_H
|
||||||
|
#define STDGUI_GUIMODEENUMS_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
//! Modes, how GUI can be started (core/GUI)
|
||||||
|
struct GuiModes
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
//! Core runs how and where?
|
||||||
|
enum CoreMode
|
||||||
|
{
|
||||||
|
CoreInGuiProcess,
|
||||||
|
CoreExternal,
|
||||||
|
CoreExternalAudioLocal
|
||||||
|
};
|
||||||
|
|
||||||
|
//! String to core mode
|
||||||
|
static CoreMode stringToCoreMode(const QString &m)
|
||||||
|
{
|
||||||
|
QString cm(m.toLower().trimmed());
|
||||||
|
if (cm.isEmpty()) { return CoreInGuiProcess; }
|
||||||
|
if (m == coreModeToString(CoreExternal)) { return CoreExternal; }
|
||||||
|
if (m == coreModeToString(CoreInGuiProcess)) { return CoreInGuiProcess; }
|
||||||
|
if (m == coreModeToString(CoreExternalAudioLocal)) { return CoreExternalAudioLocal; }
|
||||||
|
|
||||||
|
// some alternative names
|
||||||
|
if (cm.contains("audiolocal")) { return CoreExternalAudioLocal; }
|
||||||
|
if (cm.contains("localaudio")) { return CoreExternalAudioLocal; }
|
||||||
|
if (cm.contains("external")) { return CoreExternal; }
|
||||||
|
if (cm.contains("gui")) { return CoreInGuiProcess; }
|
||||||
|
return CoreInGuiProcess;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Core mode as string
|
||||||
|
static QString coreModeToString(CoreMode mode)
|
||||||
|
{
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case CoreInGuiProcess: return "coreinguiprocess";
|
||||||
|
case CoreExternal: return "coreexternal";
|
||||||
|
case CoreExternalAudioLocal: return "coreexternalaudiolocal";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif // guard
|
||||||
152
src/swiftguistandard/main.cpp
Normal file
152
src/swiftguistandard/main.cpp
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
/* Copyright (C) 2013
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "swiftguistd.h"
|
||||||
|
#include "guimodeenums.h"
|
||||||
|
#include "blackgui/stylesheetutility.h"
|
||||||
|
#include "blackcore/blackcorefreefunctions.h"
|
||||||
|
#include "blackcore/context_runtime_config.h"
|
||||||
|
#include "blackgui/guiutility.h"
|
||||||
|
#include "blackmisc/blackmiscfreefunctions.h"
|
||||||
|
#include "blackmisc/logmessage.h"
|
||||||
|
#include "blackmisc/icons.h"
|
||||||
|
#include "blackmisc/loghandler.h"
|
||||||
|
#include "blackmisc/filelogger.h"
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QProcessEnvironment>
|
||||||
|
|
||||||
|
using namespace BlackGui;
|
||||||
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackCore;
|
||||||
|
|
||||||
|
enum CommandLineParseResult
|
||||||
|
{
|
||||||
|
CommandLineOk,
|
||||||
|
CommandLineError,
|
||||||
|
CommandLineVersionRequested,
|
||||||
|
CommandLineHelpRequested
|
||||||
|
};
|
||||||
|
|
||||||
|
CommandLineParseResult parseCommandLine(QCommandLineParser &parser,
|
||||||
|
CEnableForFramelessWindow::WindowMode &windowMode,
|
||||||
|
GuiModes::CoreMode &coreMode,
|
||||||
|
QString &dBusAddress,
|
||||||
|
QString &errorMessage)
|
||||||
|
{
|
||||||
|
parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
|
||||||
|
|
||||||
|
// value core mode
|
||||||
|
QCommandLineOption modeOption(QStringList() << "c" << "core",
|
||||||
|
QCoreApplication::translate("main", "Core mode: (e)xternal, (g)ui (in GUI process), (l)ocalaudio (external, but local audio)."),
|
||||||
|
"coremode");
|
||||||
|
parser.addOption(modeOption);
|
||||||
|
|
||||||
|
// value DBus address
|
||||||
|
QCommandLineOption dBusOption(QStringList() << "dbus" << "dbus-address",
|
||||||
|
QCoreApplication::translate("main", "DBUS address."),
|
||||||
|
"dbusaddress");
|
||||||
|
parser.addOption(dBusOption);
|
||||||
|
|
||||||
|
// Window type
|
||||||
|
QCommandLineOption windowOption(QStringList() << "w" << "window",
|
||||||
|
QCoreApplication::translate("main", "Windows: (n)ormal, (f)rameless, (t)ool."),
|
||||||
|
"windowtype");
|
||||||
|
parser.addOption(windowOption);
|
||||||
|
|
||||||
|
// help/version
|
||||||
|
QCommandLineOption helpOption = parser.addHelpOption();
|
||||||
|
QCommandLineOption versionOption = parser.addVersionOption();
|
||||||
|
|
||||||
|
// evaluate
|
||||||
|
if (!parser.parse(QCoreApplication::arguments()))
|
||||||
|
{
|
||||||
|
errorMessage = parser.errorText();
|
||||||
|
return CommandLineError;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parser.isSet(helpOption)) { return CommandLineHelpRequested; }
|
||||||
|
if (parser.isSet(versionOption)) { return CommandLineVersionRequested; }
|
||||||
|
|
||||||
|
if (parser.isSet(dBusOption))
|
||||||
|
{
|
||||||
|
QString v(parser.value(dBusOption).trimmed());
|
||||||
|
dBusAddress = CDBusServer::fixAddressToDBusAddress(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parser.isSet(windowOption))
|
||||||
|
{
|
||||||
|
QString v(parser.value(windowOption).trimmed());
|
||||||
|
windowMode = CEnableForFramelessWindow::stringToWindowMode(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parser.isSet(modeOption))
|
||||||
|
{
|
||||||
|
QString v(parser.value(modeOption));
|
||||||
|
coreMode = GuiModes::stringToCoreMode(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CommandLineOk;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
const QString appName("swift pilot client GUI");
|
||||||
|
a.setApplicationVersion(CProject::swiftVersionString());
|
||||||
|
a.setApplicationName(appName);
|
||||||
|
|
||||||
|
// Process the actual command line arguments given by the user
|
||||||
|
QCommandLineParser parser;
|
||||||
|
parser.setApplicationDescription(appName);
|
||||||
|
|
||||||
|
CEnableForFramelessWindow::WindowMode windowMode = CEnableForFramelessWindow::WindowNormal;
|
||||||
|
GuiModes::CoreMode coreMode = GuiModes::CoreInGuiProcess;
|
||||||
|
QString dBusAddress, errorMessage;
|
||||||
|
switch (parseCommandLine(parser, windowMode, coreMode, dBusAddress, errorMessage))
|
||||||
|
{
|
||||||
|
case CommandLineOk:
|
||||||
|
break;
|
||||||
|
case CommandLineError:
|
||||||
|
CGuiUtility::commandLineErrorMessage(errorMessage, parser);
|
||||||
|
return 1;
|
||||||
|
case CommandLineVersionRequested:
|
||||||
|
CGuiUtility::commandLineVersionRequested();
|
||||||
|
return 0;
|
||||||
|
case CommandLineHelpRequested:
|
||||||
|
CGuiUtility::commandLineHelpRequested(parser);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlackCore::CRuntimeConfig runtimeConfig;
|
||||||
|
switch (coreMode)
|
||||||
|
{
|
||||||
|
case GuiModes::CoreExternal:
|
||||||
|
runtimeConfig = CRuntimeConfig::remote(dBusAddress);
|
||||||
|
break;
|
||||||
|
case GuiModes::CoreInGuiProcess:
|
||||||
|
runtimeConfig = CRuntimeConfig::local(dBusAddress);
|
||||||
|
break;
|
||||||
|
case GuiModes::CoreExternalAudioLocal:
|
||||||
|
runtimeConfig = CRuntimeConfig::remoteLocalAudio(dBusAddress);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// show window
|
||||||
|
CGuiUtility::initSwiftGuiApplication(a, appName, CIcons::swift24());
|
||||||
|
SwiftGuiStd w(windowMode);
|
||||||
|
w.init(runtimeConfig); // object is complete by now
|
||||||
|
w.show();
|
||||||
|
|
||||||
|
int r = a.exec();
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
@@ -4,7 +4,7 @@ QT += core dbus gui svg network xml multimedia
|
|||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
TARGET = swiftgui_std
|
TARGET = swiftguistd
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
SOURCES += *.cpp
|
SOURCES += *.cpp
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
#ifndef STDGUI_INTROWINDOW_H
|
#ifndef STDGUI_INTROWINDOW_H
|
||||||
#define STDGUI_INTROWINDOW_H
|
#define STDGUI_INTROWINDOW_H
|
||||||
|
|
||||||
#include "guimodeenums.h"
|
#include "swiftguistandard/guimodeenums.h"
|
||||||
#include "blackgui/enableforframelesswindow.h"
|
#include "blackgui/enableforframelesswindow.h"
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
54
src/swiftlauncher/main.cpp
Normal file
54
src/swiftlauncher/main.cpp
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
/* Copyright (C) 2013
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "swiftguistandard/guimodeenums.h"
|
||||||
|
#include "introwindow.h"
|
||||||
|
#include "blackcore/blackcorefreefunctions.h"
|
||||||
|
#include "blackgui/guiutility.h"
|
||||||
|
#include "blackmisc/blackmiscfreefunctions.h"
|
||||||
|
#include "blackmisc/logmessage.h"
|
||||||
|
#include "blackmisc/icons.h"
|
||||||
|
#include "blackmisc/project.h"
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QCommandLineParser>
|
||||||
|
|
||||||
|
using namespace BlackGui;
|
||||||
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackCore;
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
CGuiUtility::initSwiftGuiApplication(a, "swiftgui", CIcons::swift24());
|
||||||
|
|
||||||
|
// Dialog to decide external or internal core
|
||||||
|
CIntroWindow intro;
|
||||||
|
intro.setWindowIcon(CIcons::swift24());
|
||||||
|
if (intro.exec() == QDialog::Rejected) { return 0; }
|
||||||
|
|
||||||
|
GuiModes::CoreMode coreMode = intro.getCoreMode();
|
||||||
|
CEnableForFramelessWindow::WindowMode windowMode = intro.getWindowMode();
|
||||||
|
QString dBusAddress(intro.getDBusAddress());
|
||||||
|
intro.close();
|
||||||
|
|
||||||
|
QString args(" --core %1 --dbus %2 --window %3");
|
||||||
|
QString exe = QDir::currentPath() + "/swiftguistd.exe" +
|
||||||
|
args.arg(GuiModes::coreModeToString(coreMode)).arg(dBusAddress).arg(CEnableForFramelessWindow::windowModeToString(windowMode));
|
||||||
|
QProcess *process = new QProcess(QCoreApplication::instance());
|
||||||
|
Q_ASSERT_X(process, Q_FUNC_INFO, "Cannot start process");
|
||||||
|
Q_UNUSED(process);
|
||||||
|
process->startDetached(exe);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
BIN
src/swiftlauncher/swift.ico
Normal file
BIN
src/swiftlauncher/swift.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.6 KiB |
1
src/swiftlauncher/swift.rc
Normal file
1
src/swiftlauncher/swift.rc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
IDI_ICON1 ICON DISCARDABLE "swift.ico"
|
||||||
37
src/swiftlauncher/swiftlauncher.pro
Normal file
37
src/swiftlauncher/swiftlauncher.pro
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
load(common_pre)
|
||||||
|
|
||||||
|
QT += core dbus gui svg network xml multimedia
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
|
TARGET = swiftlauncher
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
SOURCES += *.cpp
|
||||||
|
HEADERS += *.h
|
||||||
|
FORMS += *.ui
|
||||||
|
CONFIG += blackmisc blacksound blackinput blackcore blackgui
|
||||||
|
|
||||||
|
macx {
|
||||||
|
CONFIG += app_bundle
|
||||||
|
|
||||||
|
deployment.files = ../blackgui/qss
|
||||||
|
deployment.path = Contents/MacOS
|
||||||
|
QMAKE_BUNDLE_DATA += deployment
|
||||||
|
}
|
||||||
|
|
||||||
|
DEPENDPATH += . $$SourceRoot/src/blackmisc \
|
||||||
|
$$SourceRoot/src/blacksound \
|
||||||
|
$$SourceRoot/src/blackcore \
|
||||||
|
$$SourceRoot/src/blackgui \
|
||||||
|
$$SourceRoot/src/blackinput
|
||||||
|
|
||||||
|
INCLUDEPATH += . $$SourceRoot/src
|
||||||
|
|
||||||
|
OTHER_FILES += *.qss *.ico *.rc
|
||||||
|
RC_FILE = swift.rc
|
||||||
|
DISTFILES += swift.rc
|
||||||
|
|
||||||
|
DESTDIR = $$DestRoot/bin
|
||||||
|
|
||||||
|
load(common_post)
|
||||||
@@ -4,7 +4,9 @@ TEMPLATE = subdirs
|
|||||||
CONFIG += ordered
|
CONFIG += ordered
|
||||||
|
|
||||||
SUBDIRS += src/blackmisc
|
SUBDIRS += src/blackmisc
|
||||||
SUBDIRS += resources/swift_resources.pro
|
SUBDIRS += resources/swiftresources.pro
|
||||||
|
OTHER_FILES += mkspecs/features/*.prf
|
||||||
|
OTHER_FILES += mkspecs/features/*.pri
|
||||||
|
|
||||||
contains(BLACK_CONFIG, BlackSound) {
|
contains(BLACK_CONFIG, BlackSound) {
|
||||||
SUBDIRS += src/blacksound
|
SUBDIRS += src/blacksound
|
||||||
@@ -19,7 +21,7 @@ contains(BLACK_CONFIG, BlackCore) {
|
|||||||
contains(BLACK_CONFIG, BlackGui) {
|
contains(BLACK_CONFIG, BlackGui) {
|
||||||
SUBDIRS += src/blackgui
|
SUBDIRS += src/blackgui
|
||||||
contains(BLACK_CONFIG, SwiftGui) {
|
contains(BLACK_CONFIG, SwiftGui) {
|
||||||
SUBDIRS += src/swiftgui_standard/swiftgui_standard.pro
|
SUBDIRS += src/swiftguistandard/swiftguistandard.pro
|
||||||
}
|
}
|
||||||
contains(BLACK_CONFIG, SwiftCore) {
|
contains(BLACK_CONFIG, SwiftCore) {
|
||||||
SUBDIRS += src/swiftcore/swiftcore.pro
|
SUBDIRS += src/swiftcore/swiftcore.pro
|
||||||
@@ -27,6 +29,9 @@ contains(BLACK_CONFIG, BlackCore) {
|
|||||||
contains(BLACK_CONFIG, SwiftData) {
|
contains(BLACK_CONFIG, SwiftData) {
|
||||||
SUBDIRS += src/swiftdata/swiftdata.pro
|
SUBDIRS += src/swiftdata/swiftdata.pro
|
||||||
}
|
}
|
||||||
|
contains(BLACK_CONFIG, SwiftLauncher) {
|
||||||
|
SUBDIRS += src/swiftlauncher/swiftlauncher.pro
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user