mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
refs #429 Rename swiftcorectrl to swiftcore
This commit is contained in:
@@ -274,9 +274,9 @@ namespace BlackGui
|
||||
return f;
|
||||
}
|
||||
|
||||
const QString &CStyleSheetUtility::fileNameSwiftCoreCtrl()
|
||||
const QString &CStyleSheetUtility::fileNameSwiftCore()
|
||||
{
|
||||
static const QString f("swiftcorectrl.qss");
|
||||
static const QString f("swiftcore.qss");
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,8 +87,8 @@ namespace BlackGui
|
||||
//! File name maininfoarea.qss
|
||||
static const QString &fileNameFilterDialog();
|
||||
|
||||
//! File name swiftcorectrl.qss
|
||||
static const QString &fileNameSwiftCoreCtrl();
|
||||
//! File name swiftcore.qss
|
||||
static const QString &fileNameSwiftCore();
|
||||
|
||||
//! File name ini file
|
||||
static const QString &fileNameIniFile();
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace BlackGui
|
||||
if (m_systemTrayMode.testFlag(AskOnClose))
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("Are you sure you want to close? This will quit swiftcorectrl!");
|
||||
msgBox.setText("Are you sure you want to close? This will quit swiftcore!");
|
||||
msgBox.setStandardButtons(QMessageBox::Close | QMessageBox::Cancel);
|
||||
msgBox.setDefaultButton(QMessageBox::Close);
|
||||
msgBox.setIcon(QMessageBox::Warning);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "swiftcorectrl.h"
|
||||
#include "swiftcore.h"
|
||||
|
||||
#include "blackcore/context_runtime.h"
|
||||
#include "blackcore/context_settings.h"
|
||||
@@ -28,7 +28,7 @@ enum CommandLineParseResult
|
||||
CommandLineHelpRequested
|
||||
};
|
||||
|
||||
CommandLineParseResult parseCommandLine(QCommandLineParser &parser, CSwiftCoreCtrl::SetupInfo *setup, QString *errorMessage)
|
||||
CommandLineParseResult parseCommandLine(QCommandLineParser &parser, CSwiftCore::SetupInfo *setup, QString *errorMessage)
|
||||
{
|
||||
parser.setSingleDashWordOptionMode(QCommandLineParser::ParseAsLongOptions);
|
||||
parser.addOption({{"s", "session"}, QCoreApplication::translate("main", "Use session bus.")});
|
||||
@@ -87,7 +87,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
CRuntime::registerMetadata(); // register metadata
|
||||
QApplication a(argc, argv);
|
||||
QApplication::setApplicationName("swiftcorectrl");
|
||||
QApplication::setApplicationName("swiftcore");
|
||||
QApplication::setApplicationVersion(CProject::version());
|
||||
|
||||
QCommandLineParser parser;
|
||||
@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
|
||||
CSwiftCoreCtrl::SetupInfo setup;
|
||||
CSwiftCore::SetupInfo setup;
|
||||
QString errorMessage;
|
||||
switch (parseCommandLine(parser, &setup, &errorMessage))
|
||||
{
|
||||
@@ -154,13 +154,13 @@ int main(int argc, char *argv[])
|
||||
const QString s = CStyleSheetUtility::instance().styles(
|
||||
{
|
||||
CStyleSheetUtility::fileNameFonts(),
|
||||
CStyleSheetUtility::fileNameSwiftCoreCtrl()
|
||||
CStyleSheetUtility::fileNameSwiftCore()
|
||||
}
|
||||
);
|
||||
a.installTranslator(&translator);
|
||||
a.setStyleSheet(s);
|
||||
|
||||
CSwiftCoreCtrl w(setup);
|
||||
CSwiftCore w(setup);
|
||||
if (!setup.m_minimzed) w.show();
|
||||
|
||||
return a.exec();
|
||||
@@ -7,8 +7,8 @@
|
||||
* contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "swiftcorectrl.h"
|
||||
#include "ui_swiftcorectrl.h"
|
||||
#include "swiftcore.h"
|
||||
#include "ui_swiftcore.h"
|
||||
#include "blackmisc/icon.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
#include "blackcore/dbus_server.h"
|
||||
@@ -23,9 +23,9 @@ using namespace BlackCore;
|
||||
using namespace BlackGui;
|
||||
using namespace BlackGui::Components;
|
||||
|
||||
CSwiftCoreCtrl::CSwiftCoreCtrl(const SetupInfo &info, QWidget *parent) :
|
||||
CSwiftCore::CSwiftCore(const SetupInfo &info, QWidget *parent) :
|
||||
CSystemTrayWindow(BlackMisc::CIcons::swiftNova24(), parent),
|
||||
ui(new Ui::CSwiftCoreCtrl)
|
||||
ui(new Ui::CSwiftCore)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@@ -40,28 +40,28 @@ CSwiftCoreCtrl::CSwiftCoreCtrl(const SetupInfo &info, QWidget *parent) :
|
||||
startCore(info);
|
||||
}
|
||||
|
||||
CSwiftCoreCtrl::~CSwiftCoreCtrl()
|
||||
CSwiftCore::~CSwiftCore()
|
||||
{
|
||||
}
|
||||
|
||||
void CSwiftCoreCtrl::ps_startCorePressed()
|
||||
void CSwiftCore::ps_startCorePressed()
|
||||
{
|
||||
SetupInfo setup;
|
||||
setup.m_dbusAddress = getDBusAddress();
|
||||
startCore(setup);
|
||||
}
|
||||
|
||||
void CSwiftCoreCtrl::ps_stopCorePressed()
|
||||
void CSwiftCore::ps_stopCorePressed()
|
||||
{
|
||||
stopCore();
|
||||
}
|
||||
|
||||
void CSwiftCoreCtrl::ps_appendLogMessage(const CStatusMessage &message)
|
||||
void CSwiftCore::ps_appendLogMessage(const CStatusMessage &message)
|
||||
{
|
||||
ui->comp_log->appendStatusMessageToList(message);
|
||||
}
|
||||
|
||||
void CSwiftCoreCtrl::ps_p2pModeToggled(bool checked)
|
||||
void CSwiftCore::ps_p2pModeToggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
@@ -69,31 +69,31 @@ void CSwiftCoreCtrl::ps_p2pModeToggled(bool checked)
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->le_p2pAddress->setText(QStringLiteral(""));
|
||||
ui->le_p2pAddress->setText(QString());
|
||||
ui->le_p2pAddress->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void CSwiftCoreCtrl::ps_onStyleSheetsChanged()
|
||||
void CSwiftCore::ps_onStyleSheetsChanged()
|
||||
{
|
||||
const QString s = CStyleSheetUtility::instance().styles(
|
||||
{
|
||||
CStyleSheetUtility::fileNameFonts(),
|
||||
CStyleSheetUtility::fileNameSwiftCoreCtrl()
|
||||
CStyleSheetUtility::fileNameSwiftCore()
|
||||
}
|
||||
);
|
||||
setStyleSheet(s);
|
||||
}
|
||||
|
||||
void CSwiftCoreCtrl::connectSlots()
|
||||
void CSwiftCore::connectSlots()
|
||||
{
|
||||
connect(ui->pb_startCore, &QPushButton::clicked, this, &CSwiftCoreCtrl::ps_startCorePressed);
|
||||
connect(ui->pb_stopCore, &QPushButton::clicked, this, &CSwiftCoreCtrl::ps_stopCorePressed);
|
||||
connect(ui->rb_p2pBus, &QRadioButton::toggled, this, &CSwiftCoreCtrl::ps_p2pModeToggled);
|
||||
connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &CSwiftCoreCtrl::ps_onStyleSheetsChanged);
|
||||
connect(ui->pb_startCore, &QPushButton::clicked, this, &CSwiftCore::ps_startCorePressed);
|
||||
connect(ui->pb_stopCore, &QPushButton::clicked, this, &CSwiftCore::ps_stopCorePressed);
|
||||
connect(ui->rb_p2pBus, &QRadioButton::toggled, this, &CSwiftCore::ps_p2pModeToggled);
|
||||
connect(&CStyleSheetUtility::instance(), &CStyleSheetUtility::styleSheetsChanged, this, &CSwiftCore::ps_onStyleSheetsChanged);
|
||||
}
|
||||
|
||||
void CSwiftCoreCtrl::setupLogDisplay()
|
||||
void CSwiftCore::setupLogDisplay()
|
||||
{
|
||||
CLogHandler::instance()->install();
|
||||
CLogHandler::instance()->enableConsoleOutput(false); // default disable
|
||||
@@ -101,10 +101,10 @@ void CSwiftCoreCtrl::setupLogDisplay()
|
||||
CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo)
|
||||
);
|
||||
|
||||
logHandler->subscribe(this, &CSwiftCoreCtrl::ps_appendLogMessage);
|
||||
logHandler->subscribe(this, &CSwiftCore::ps_appendLogMessage);
|
||||
}
|
||||
|
||||
void CSwiftCoreCtrl::startCore(const SetupInfo &setup)
|
||||
void CSwiftCore::startCore(const SetupInfo &setup)
|
||||
{
|
||||
if (getRuntime()) { return; }
|
||||
if (setup.m_dbusAddress.isEmpty()) { return; }
|
||||
@@ -119,7 +119,7 @@ void CSwiftCoreCtrl::startCore(const SetupInfo &setup)
|
||||
connect(ui->le_CommandLineInput, &CCommandInput::commandEntered, getRuntime(), &CRuntime::parseCommandLine);
|
||||
}
|
||||
|
||||
void CSwiftCoreCtrl::stopCore()
|
||||
void CSwiftCore::stopCore()
|
||||
{
|
||||
if (!getRuntime()) { return; }
|
||||
|
||||
@@ -131,12 +131,12 @@ void CSwiftCoreCtrl::stopCore()
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
QString CSwiftCoreCtrl::getDBusAddress() const
|
||||
QString CSwiftCore::getDBusAddress() const
|
||||
{
|
||||
if (ui->rb_sessionBus->isChecked()) { return CDBusServer::sessionDBusServer(); }
|
||||
if (ui->rb_systemBus->isChecked()) { return CDBusServer::systemDBusServer(); }
|
||||
if (ui->rb_p2pBus->isChecked()) { return CDBusServer::fixAddressToDBusAddress(ui->le_p2pAddress->text()); }
|
||||
|
||||
Q_ASSERT_X(false, "CSwiftCoreCtrl::getDBusAddress()", "The impossible happended!");
|
||||
Q_ASSERT_X(false, "CSwiftCore::getDBusAddress()", "The impossible happended!");
|
||||
return "";
|
||||
}
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef SWIFTCORECTRL_H
|
||||
#define SWIFTCORECTRL_H
|
||||
#ifndef SWIFTCORE_H
|
||||
#define SWIFTCORE_H
|
||||
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include "blackcore/context_runtime.h"
|
||||
@@ -20,11 +20,11 @@
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CSwiftCoreCtrl;
|
||||
class CSwiftCore;
|
||||
}
|
||||
|
||||
//! swift core control
|
||||
class CSwiftCoreCtrl :
|
||||
class CSwiftCore :
|
||||
public BlackGui::CSystemTrayWindow,
|
||||
public BlackGui::Components::CEnableForRuntime
|
||||
{
|
||||
@@ -32,7 +32,7 @@ class CSwiftCoreCtrl :
|
||||
|
||||
public:
|
||||
|
||||
//! SwiftCoreCtrl setup information
|
||||
//! SwiftCore setup information
|
||||
struct SetupInfo
|
||||
{
|
||||
SetupInfo() {}
|
||||
@@ -42,10 +42,10 @@ public:
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
CSwiftCoreCtrl(const SetupInfo &info, QWidget *parent = nullptr);
|
||||
CSwiftCore(const SetupInfo &info, QWidget *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
~CSwiftCoreCtrl();
|
||||
~CSwiftCore();
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
|
||||
QString getDBusAddress() const;
|
||||
|
||||
QScopedPointer<Ui::CSwiftCoreCtrl> ui;
|
||||
QScopedPointer<Ui::CSwiftCore> ui;
|
||||
};
|
||||
|
||||
#endif // SWIFTCORECTRL_H
|
||||
#endif // SWIFTCORE_H
|
||||
@@ -1,11 +1,11 @@
|
||||
include (../../config.pri)
|
||||
include (../../build.pri)
|
||||
include ($$SourceRoot/config.pri)
|
||||
include ($$SourceRoot/build.pri)
|
||||
|
||||
QT += core dbus network xml multimedia gui svg
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = swiftcorectrl
|
||||
TARGET = swiftcore
|
||||
TEMPLATE = app
|
||||
|
||||
SOURCES += *.cpp
|
||||
@@ -22,4 +22,4 @@ INCLUDEPATH += . $$SourceRoot/src
|
||||
DESTDIR = $$BuildRoot/bin
|
||||
OTHER_FILES += *.qss
|
||||
|
||||
include (../../libraries.pri)
|
||||
include ($$SourceRoot/libraries.pri)
|
||||
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CSwiftCoreCtrl</class>
|
||||
<widget class="BlackGui::CSystemTrayWindow" name="CSwiftCoreCtrl">
|
||||
<class>CSwiftCore</class>
|
||||
<widget class="BlackGui::CSystemTrayWindow" name="CSwiftCore">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>448</width>
|
||||
<width>460</width>
|
||||
<height>382</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>swiftcorectrl</string>
|
||||
<string>swiftcore</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
@@ -128,8 +128,8 @@ QTextEdit {
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>448</width>
|
||||
<height>20</height>
|
||||
<width>460</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -102,7 +102,7 @@ void CIntroWindow::buttonClicked() const
|
||||
{
|
||||
//! \todo make fully OS independent
|
||||
QString sfx = QFileInfo(QCoreApplication::applicationFilePath()).suffix();
|
||||
QString core = QDir(QApplication::applicationDirPath()).filePath("swiftcorectrl." + sfx);
|
||||
QString core = QDir(QApplication::applicationDirPath()).filePath("swiftcore." + sfx);
|
||||
QProcess::startDetached(core);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user