mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-11 23:05:34 +08:00
refs #432, added new components to core GUI
This commit is contained in:
@@ -128,7 +128,25 @@ QTableView, QTreeView {
|
||||
background-image: url(:/textures/icons/textures/texture-inner.jpg);
|
||||
}
|
||||
|
||||
QSizeGrip {
|
||||
QSizeGrip { }
|
||||
|
||||
QScrollArea {
|
||||
border: 1px solid green;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
QScrollBar:horizontal {
|
||||
border: 2px solid gray;
|
||||
background: slategray;
|
||||
height: 10px;
|
||||
margin: 0px 5px 0px 5px;
|
||||
}
|
||||
|
||||
QScrollBar:vertical {
|
||||
border: 2px solid gray;
|
||||
background: slategray;
|
||||
width: 10px;
|
||||
margin: 5px 0px 5px 0;
|
||||
}
|
||||
|
||||
#le_CommandLineInput {
|
||||
@@ -138,11 +156,11 @@ QSizeGrip {
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
#comp_log {
|
||||
#comp_Log {
|
||||
background: transparent; /** background is background color here **/
|
||||
}
|
||||
|
||||
#gb_dbusMode {
|
||||
#gb_DBusMode {
|
||||
background: transparent; /** background is background color here **/
|
||||
background-image: url(:/textures/icons/textures/texture-inner.jpg);
|
||||
}
|
||||
@@ -150,4 +168,4 @@ QSizeGrip {
|
||||
#gb_Controls {
|
||||
background: transparent; /** background is background color here **/
|
||||
background-image: url(:/textures/icons/textures/texture-inner.jpg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
#include "ui_swiftcore.h"
|
||||
#include "blackmisc/icon.h"
|
||||
#include "blackmisc/loghandler.h"
|
||||
#include "blackmisc/project.h"
|
||||
#include "blackgui/components/logcomponent.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include "blackcore/dbus_server.h"
|
||||
#include "blackgui/stylesheetutility.h"
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QCloseEvent>
|
||||
@@ -24,25 +26,25 @@ using namespace BlackGui;
|
||||
using namespace BlackGui::Components;
|
||||
|
||||
CSwiftCore::CSwiftCore(const SetupInfo &info, QWidget *parent) :
|
||||
CSystemTrayWindow(BlackMisc::CIcons::swiftNova24(), parent),
|
||||
CSystemTrayWindow(CIcons::swiftNova24(), parent),
|
||||
ui(new Ui::CSwiftCore)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
const QString name("swiftcore " + CProject::version());
|
||||
SystemTrayMode mode = MinimizeToTray | QuitOnClose;
|
||||
setSystemTrayMode(mode);
|
||||
setToolTip(QStringLiteral("swiftcore"));
|
||||
|
||||
setToolTip(name);
|
||||
setWindowTitle(name);
|
||||
setWindowIcon(CIcons::swiftNova24());
|
||||
setWindowIconText(name);
|
||||
setupLogDisplay();
|
||||
|
||||
connectSlots();
|
||||
ps_onStyleSheetsChanged();
|
||||
startCore(info);
|
||||
}
|
||||
|
||||
CSwiftCore::~CSwiftCore()
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
void CSwiftCore::ps_startCorePressed()
|
||||
{
|
||||
@@ -58,19 +60,19 @@ void CSwiftCore::ps_stopCorePressed()
|
||||
|
||||
void CSwiftCore::ps_appendLogMessage(const CStatusMessage &message)
|
||||
{
|
||||
ui->comp_log->appendStatusMessageToList(message);
|
||||
ui->comp_InfoArea->getLogComponent()->appendStatusMessageToList(message);
|
||||
}
|
||||
|
||||
void CSwiftCore::ps_p2pModeToggled(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
ui->le_p2pAddress->setEnabled(true);
|
||||
ui->le_P2PAddress->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->le_p2pAddress->setText(QString());
|
||||
ui->le_p2pAddress->setEnabled(false);
|
||||
ui->le_P2PAddress->setText(QString());
|
||||
ui->le_P2PAddress->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,9 +89,9 @@ void CSwiftCore::ps_onStyleSheetsChanged()
|
||||
|
||||
void CSwiftCore::connectSlots()
|
||||
{
|
||||
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(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);
|
||||
}
|
||||
|
||||
@@ -100,7 +102,6 @@ void CSwiftCore::setupLogDisplay()
|
||||
auto logHandler = CLogHandler::instance()->handlerForPattern(
|
||||
CLogPattern().withSeverityAtOrAbove(CStatusMessage::SeverityInfo)
|
||||
);
|
||||
|
||||
logHandler->subscribe(this, &CSwiftCore::ps_appendLogMessage);
|
||||
}
|
||||
|
||||
@@ -109,9 +110,9 @@ void CSwiftCore::startCore(const SetupInfo &setup)
|
||||
if (getRuntime()) { return; }
|
||||
if (setup.m_dbusAddress.isEmpty()) { return; }
|
||||
|
||||
ui->pb_startCore->setEnabled(false);
|
||||
ui->pb_stopCore->setEnabled(true);
|
||||
ui->gb_dbusMode->setDisabled(true);
|
||||
ui->pb_StartCore->setEnabled(false);
|
||||
ui->pb_StopCore->setEnabled(true);
|
||||
ui->gb_DBusMode->setDisabled(true);
|
||||
|
||||
// context
|
||||
createRuntime(CRuntimeConfig::forCoreAllLocalInDBus(setup.m_dbusAddress), this);
|
||||
@@ -122,10 +123,11 @@ void CSwiftCore::startCore(const SetupInfo &setup)
|
||||
void CSwiftCore::stopCore()
|
||||
{
|
||||
if (!getRuntime()) { return; }
|
||||
getRuntime()->gracefulShutdown();
|
||||
|
||||
ui->pb_startCore->setEnabled(true);
|
||||
ui->pb_stopCore->setEnabled(false);
|
||||
ui->gb_dbusMode->setDisabled(false);
|
||||
ui->pb_StartCore->setEnabled(true);
|
||||
ui->pb_StopCore->setEnabled(false);
|
||||
ui->gb_DBusMode->setDisabled(false);
|
||||
|
||||
// Force quit, since we cannot close the runtime
|
||||
qApp->quit();
|
||||
@@ -133,10 +135,10 @@ void CSwiftCore::stopCore()
|
||||
|
||||
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()); }
|
||||
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, "CSwiftCore::getDBusAddress()", "The impossible happended!");
|
||||
Q_ASSERT_X(false, Q_FUNC_INFO, "The impossible happend!");
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -18,10 +18,7 @@
|
||||
#include "blackgui/components/enableforruntime.h"
|
||||
#include <QScopedPointer>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class CSwiftCore;
|
||||
}
|
||||
namespace Ui { class CSwiftCore; }
|
||||
|
||||
//! swift core control
|
||||
class CSwiftCore :
|
||||
@@ -38,7 +35,7 @@ public:
|
||||
SetupInfo() {}
|
||||
|
||||
bool m_minimzed = false; //!< Start minimized to tray
|
||||
QString m_dbusAddress; //!< DBus address (session, system, p2p)
|
||||
QString m_dbusAddress; //!< DBus address (session, system, p2p)
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
@@ -48,7 +45,6 @@ public:
|
||||
~CSwiftCore();
|
||||
|
||||
private slots:
|
||||
|
||||
// PushButton slots
|
||||
void ps_startCorePressed();
|
||||
void ps_stopCorePressed();
|
||||
@@ -59,15 +55,13 @@ private slots:
|
||||
virtual void ps_onStyleSheetsChanged();
|
||||
|
||||
private:
|
||||
|
||||
void connectSlots();
|
||||
void setupLogDisplay();
|
||||
void startCore(const SetupInfo &setup);
|
||||
void stopCore();
|
||||
|
||||
QString getDBusAddress() const;
|
||||
|
||||
QScopedPointer<Ui::CSwiftCore> ui;
|
||||
};
|
||||
|
||||
#endif // SWIFTCORE_H
|
||||
#endif // guard
|
||||
|
||||
@@ -13,10 +13,7 @@
|
||||
<property name="windowTitle">
|
||||
<string>swiftcore</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QWidget" name="qw_MainWidget">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="2">
|
||||
<widget class="QGroupBox" name="gb_Controls">
|
||||
@@ -25,7 +22,7 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="pb_startCore">
|
||||
<widget class="QPushButton" name="pb_StartCore">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">/** Main window **/
|
||||
QTextEdit {
|
||||
@@ -38,7 +35,7 @@ QTextEdit {
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="pb_stopCore">
|
||||
<widget class="QPushButton" name="pb_StopCore">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@@ -72,17 +69,14 @@ QTextEdit {
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="BlackGui::Components::CLogComponent" name="comp_log" native="true"/>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="gb_dbusMode">
|
||||
<widget class="QGroupBox" name="gb_DBusMode">
|
||||
<property name="title">
|
||||
<string>DBus Mode</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QRadioButton" name="rb_sessionBus">
|
||||
<widget class="QRadioButton" name="rb_SessionBus">
|
||||
<property name="text">
|
||||
<string>Session</string>
|
||||
</property>
|
||||
@@ -92,21 +86,21 @@ QTextEdit {
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="rb_p2pBus">
|
||||
<widget class="QRadioButton" name="rb_P2PBus">
|
||||
<property name="text">
|
||||
<string>P2P</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="rb_systemBus">
|
||||
<widget class="QRadioButton" name="rb_SystemBus">
|
||||
<property name="text">
|
||||
<string>System</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QLineEdit" name="le_p2pAddress">
|
||||
<widget class="QLineEdit" name="le_P2PAddress">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@@ -121,19 +115,11 @@ QTextEdit {
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="BlackGui::CCommandInput" name="le_CommandLineInput"/>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="BlackGui::Components::CCoreInfoAreaComponent" name="comp_InfoArea" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>460</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
@@ -149,18 +135,18 @@ QTextEdit {
|
||||
<header>blackgui/components/infobarstatuscomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CLogComponent</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>blackgui/components/logcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::CCommandInput</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>blackgui/commandinput.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CCoreInfoAreaComponent</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>blackgui/components/coreinfoareacomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
||||
Reference in New Issue
Block a user