mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Ref T304, adjusted XSwiftDBus settings so P2P can be used
* XPlane now supports P2P XSwiftBus amd session bus * adjusted settings component
This commit is contained in:
@@ -38,9 +38,9 @@ namespace BlackGui
|
||||
this->set(sGui->getCmdDBusAddressValue());
|
||||
|
||||
ui->le_DBusServerPort->setValidator(new QIntValidator(0, 65535, this));
|
||||
connect(ui->rb_DBusP2P, &QRadioButton::released, this, &CDBusServerAddressSelector::radioButtonReleased);
|
||||
connect(ui->rb_DBusSession, &QRadioButton::released, this, &CDBusServerAddressSelector::radioButtonReleased);
|
||||
connect(ui->rb_DBusSystem, &QRadioButton::released, this, &CDBusServerAddressSelector::radioButtonReleased);
|
||||
connect(ui->rb_DBusP2P, &QRadioButton::released, this, &CDBusServerAddressSelector::onRadioButtonReleased);
|
||||
connect(ui->rb_DBusSession, &QRadioButton::released, this, &CDBusServerAddressSelector::onRadioButtonReleased);
|
||||
connect(ui->rb_DBusSystem, &QRadioButton::released, this, &CDBusServerAddressSelector::onRadioButtonReleased);
|
||||
connect(ui->le_DBusServerPort, &QLineEdit::editingFinished, this, &CDBusServerAddressSelector::editingFinished);
|
||||
connect(ui->cb_DBusServerAddress, &QComboBox::currentTextChanged, this, &CDBusServerAddressSelector::editingFinished);
|
||||
}
|
||||
@@ -116,6 +116,7 @@ namespace BlackGui
|
||||
ui->le_DBusServerPort->setText(port);
|
||||
}
|
||||
}
|
||||
this->onRadioButtonReleased();
|
||||
}
|
||||
|
||||
void CDBusServerAddressSelector::setSystemDBusVisible(bool visible)
|
||||
@@ -128,7 +129,19 @@ namespace BlackGui
|
||||
}
|
||||
}
|
||||
|
||||
void CDBusServerAddressSelector::radioButtonReleased()
|
||||
void CDBusServerAddressSelector::setP2PDBusVisible(bool visible)
|
||||
{
|
||||
ui->rb_DBusP2P->setVisible(visible);
|
||||
ui->fr_DBusServerAddress->setVisible(visible);
|
||||
}
|
||||
|
||||
void CDBusServerAddressSelector::setForXSwiftBus()
|
||||
{
|
||||
this->setP2PDBusVisible(true);
|
||||
this->setSystemDBusVisible(false);
|
||||
}
|
||||
|
||||
void CDBusServerAddressSelector::onRadioButtonReleased()
|
||||
{
|
||||
const bool p2p = this->isP2P();
|
||||
ui->le_DBusServerPort->setEnabled(p2p);
|
||||
|
||||
@@ -54,6 +54,12 @@ namespace BlackGui
|
||||
//! Set system DBus radio button visible/invisible
|
||||
void setSystemDBusVisible(bool visible);
|
||||
|
||||
//! P2P visible
|
||||
void setP2PDBusVisible(bool visible);
|
||||
|
||||
//! Set to be used for XSwiftBus
|
||||
void setForXSwiftBus();
|
||||
|
||||
signals:
|
||||
//! Is being edited
|
||||
void editingFinished();
|
||||
@@ -62,7 +68,7 @@ namespace BlackGui
|
||||
QScopedPointer<Ui::CDBusServerAddressSelector> ui;
|
||||
|
||||
//! Radio button clicked
|
||||
void radioButtonReleased();
|
||||
void onRadioButtonReleased();
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
<ui version="4.0">
|
||||
<class>CDBusServerAddressSelector</class>
|
||||
<widget class="QFrame" name="CDBusServerAddressSelector">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>149</width>
|
||||
<height>118</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace BlackGui
|
||||
void setDefaultDownloadName(const QString &defaultDownload);
|
||||
|
||||
private:
|
||||
static constexpr int OverlayMsgTimeoutMs = 5000; //!< how long overlay is displayed
|
||||
|
||||
QScopedPointer<Ui::CInstallXSwiftBusComponent> ui;
|
||||
BlackMisc::Simulation::Settings::CMultiSimulatorSettings m_simulatorSettings { this }; //!< for directories of XPlane
|
||||
BlackMisc::CDataReadOnly<BlackMisc::Db::TUpdateInfo> m_updates { this, &CInstallXSwiftBusComponent::updatesChanged };
|
||||
@@ -56,8 +58,6 @@ namespace BlackGui
|
||||
const QFileDialog::Options m_fileDialogOptions { QFileDialog::ShowDirsOnly | QFileDialog::ReadOnly | QFileDialog::DontResolveSymlinks };
|
||||
QString m_defaultDownloadName; //!< default name for download
|
||||
|
||||
static constexpr int OverlayMsgTimeoutMs = 5000; //!< how long overlay is displayed
|
||||
|
||||
//! Select X-Plane plugin directory
|
||||
void selectPluginDirectory();
|
||||
|
||||
|
||||
@@ -169,23 +169,17 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="gb_XSwiftBusSettings">
|
||||
<property name="title">
|
||||
<string>XSwiftBusSettings</string>
|
||||
<string>XSwiftBus settings</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="vl_XSwiftBusSettings">
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CSettingsXSwiftBusComponent" name="comp_SettingsXSwiftBus">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
@@ -214,6 +208,16 @@
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>le_XSwiftBusPluginDir</tabstop>
|
||||
<tabstop>tb_DialogInstallDir</tabstop>
|
||||
<tabstop>pb_OpenInstallDir</tabstop>
|
||||
<tabstop>le_DownloadDir</tabstop>
|
||||
<tabstop>tb_DialogDownloadDir</tabstop>
|
||||
<tabstop>pb_OpenDownloadDir</tabstop>
|
||||
<tabstop>cb_DownloadFile</tabstop>
|
||||
<tabstop>pb_Download</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||
</resources>
|
||||
|
||||
@@ -10,35 +10,54 @@
|
||||
#include "settingsxswiftbuscomponent.h"
|
||||
#include "ui_settingsxswiftbuscomponent.h"
|
||||
#include "blackmisc/dbusserver.h"
|
||||
#include "blackmisc/logmessage.h"
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation::Settings;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components
|
||||
{
|
||||
const CLogCategoryList &CSettingsXSwiftBusComponent::getLogCategories()
|
||||
{
|
||||
static const CLogCategoryList cats { CLogCategory::guiComponent() };
|
||||
return cats;
|
||||
}
|
||||
|
||||
CSettingsXSwiftBusComponent::CSettingsXSwiftBusComponent(QWidget *parent) :
|
||||
QFrame(parent),
|
||||
ui(new Ui::CSettingsXSwiftBusComponent)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->cb_XSwiftBusServer->addItem(CDBusServer::sessionBusAddress());
|
||||
ui->cb_XSwiftBusServer->addItem(CDBusServer::systemBusAddress());
|
||||
ui->cb_XSwiftBusServer->setCurrentText(m_xSwiftBusServerSetting.getThreadLocal());
|
||||
|
||||
connect(ui->cb_XSwiftBusServer, &QComboBox::currentTextChanged, this, &CSettingsXSwiftBusComponent::saveServer);
|
||||
connect(ui->pb_Save, &QPushButton::released, this, &CSettingsXSwiftBusComponent::saveServer);
|
||||
connect(ui->pb_Reset, &QPushButton::released, this, &CSettingsXSwiftBusComponent::resetServer);
|
||||
|
||||
const QString dBusAddress = m_xSwiftBusServerSetting.get();
|
||||
ui->comp_DBusServer->setForXSwiftBus();
|
||||
ui->comp_DBusServer->set(dBusAddress);
|
||||
}
|
||||
|
||||
CSettingsXSwiftBusComponent::~CSettingsXSwiftBusComponent()
|
||||
{ }
|
||||
|
||||
void CSettingsXSwiftBusComponent::saveServer(const QString &dBusAddress)
|
||||
void CSettingsXSwiftBusComponent::resetServer()
|
||||
{
|
||||
const QString s = TXSwiftBusServer::defaultValue();
|
||||
ui->comp_DBusServer->set(s);
|
||||
}
|
||||
|
||||
void CSettingsXSwiftBusComponent::saveServer()
|
||||
{
|
||||
const QString dBusAddress = ui->comp_DBusServer->getDBusAddress();
|
||||
if (dBusAddress.isEmpty()) { return; }
|
||||
if (dBusAddress != m_xSwiftBusServerSetting.getThreadLocal())
|
||||
{
|
||||
m_xSwiftBusServerSetting.setAndSave(dBusAddress);
|
||||
const CStatusMessage msg = m_xSwiftBusServerSetting.setAndSave(dBusAddress);
|
||||
CLogMessage::preformatted(msg);
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -12,9 +12,10 @@
|
||||
#ifndef BLACKGUI_COMPONENTS_SETTINGSXSWIFTBUSCOMPONENT_H
|
||||
#define BLACKGUI_COMPONENTS_SETTINGSXSWIFTBUSCOMPONENT_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/simulation/settings/xswiftbussettings.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/logcategorylist.h"
|
||||
#include <QFrame>
|
||||
#include <QScopedPointer>
|
||||
|
||||
@@ -31,6 +32,9 @@ namespace BlackGui
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Log categories
|
||||
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||
|
||||
//! Constructor
|
||||
explicit CSettingsXSwiftBusComponent(QWidget *parent = nullptr);
|
||||
|
||||
@@ -41,7 +45,8 @@ namespace BlackGui
|
||||
QScopedPointer<Ui::CSettingsXSwiftBusComponent> ui;
|
||||
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TXSwiftBusServer> m_xSwiftBusServerSetting { this };
|
||||
|
||||
void saveServer(const QString &dBusAddress);
|
||||
void resetServer();
|
||||
void saveServer();
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -6,38 +6,83 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>160</width>
|
||||
<height>26</height>
|
||||
<width>315</width>
|
||||
<height>116</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>XSwiftBus settings</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="fl_XSwiftBusSettings">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_XSwiftBusServer">
|
||||
<property name="text">
|
||||
<string>XSwiftBus server:</string>
|
||||
<layout class="QHBoxLayout" name="hl_SettingsXSwiftBus">
|
||||
<item>
|
||||
<widget class="BlackGui::Components::CDBusServerAddressSelector" name="comp_DBusServer">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>75</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cb_XSwiftBusServer"/>
|
||||
<item>
|
||||
<widget class="QFrame" name="fr_Buttons">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<spacer name="vs_Buttons">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QPushButton" name="pb_Reset">
|
||||
<property name="text">
|
||||
<string>reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignLeft">
|
||||
<widget class="QPushButton" name="pb_Save">
|
||||
<property name="text">
|
||||
<string>save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CDBusServerAddressSelector</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/components/dbusserveraddressselector.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>pb_Reset</tabstop>
|
||||
<tabstop>pb_Save</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -325,6 +325,11 @@ QLineEdit[readOnly="true"] {
|
||||
border: 1px solid rgba(50,50,50);
|
||||
}
|
||||
|
||||
QLineEdit:disabled {
|
||||
background: rgba(40,40,40);
|
||||
border: 1px solid rgba(50,50,50);
|
||||
}
|
||||
|
||||
QTextEdit {
|
||||
border: 1px solid green;
|
||||
background: transparent;
|
||||
@@ -392,6 +397,11 @@ QComboBox {
|
||||
selection-background-color: #3f98ff;
|
||||
}
|
||||
|
||||
QComboBox:disabled {
|
||||
background: rgba(40,40,40);
|
||||
border: 1px solid rgba(50,50,50);
|
||||
}
|
||||
|
||||
/* drop down list */
|
||||
QComboBox QAbstractItemView {
|
||||
background-color: black;
|
||||
|
||||
Reference in New Issue
Block a user