mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 10:55:32 +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());
|
this->set(sGui->getCmdDBusAddressValue());
|
||||||
|
|
||||||
ui->le_DBusServerPort->setValidator(new QIntValidator(0, 65535, this));
|
ui->le_DBusServerPort->setValidator(new QIntValidator(0, 65535, this));
|
||||||
connect(ui->rb_DBusP2P, &QRadioButton::released, this, &CDBusServerAddressSelector::radioButtonReleased);
|
connect(ui->rb_DBusP2P, &QRadioButton::released, this, &CDBusServerAddressSelector::onRadioButtonReleased);
|
||||||
connect(ui->rb_DBusSession, &QRadioButton::released, this, &CDBusServerAddressSelector::radioButtonReleased);
|
connect(ui->rb_DBusSession, &QRadioButton::released, this, &CDBusServerAddressSelector::onRadioButtonReleased);
|
||||||
connect(ui->rb_DBusSystem, &QRadioButton::released, this, &CDBusServerAddressSelector::radioButtonReleased);
|
connect(ui->rb_DBusSystem, &QRadioButton::released, this, &CDBusServerAddressSelector::onRadioButtonReleased);
|
||||||
connect(ui->le_DBusServerPort, &QLineEdit::editingFinished, this, &CDBusServerAddressSelector::editingFinished);
|
connect(ui->le_DBusServerPort, &QLineEdit::editingFinished, this, &CDBusServerAddressSelector::editingFinished);
|
||||||
connect(ui->cb_DBusServerAddress, &QComboBox::currentTextChanged, this, &CDBusServerAddressSelector::editingFinished);
|
connect(ui->cb_DBusServerAddress, &QComboBox::currentTextChanged, this, &CDBusServerAddressSelector::editingFinished);
|
||||||
}
|
}
|
||||||
@@ -116,6 +116,7 @@ namespace BlackGui
|
|||||||
ui->le_DBusServerPort->setText(port);
|
ui->le_DBusServerPort->setText(port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this->onRadioButtonReleased();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDBusServerAddressSelector::setSystemDBusVisible(bool visible)
|
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();
|
const bool p2p = this->isP2P();
|
||||||
ui->le_DBusServerPort->setEnabled(p2p);
|
ui->le_DBusServerPort->setEnabled(p2p);
|
||||||
|
|||||||
@@ -54,6 +54,12 @@ namespace BlackGui
|
|||||||
//! Set system DBus radio button visible/invisible
|
//! Set system DBus radio button visible/invisible
|
||||||
void setSystemDBusVisible(bool visible);
|
void setSystemDBusVisible(bool visible);
|
||||||
|
|
||||||
|
//! P2P visible
|
||||||
|
void setP2PDBusVisible(bool visible);
|
||||||
|
|
||||||
|
//! Set to be used for XSwiftBus
|
||||||
|
void setForXSwiftBus();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
//! Is being edited
|
//! Is being edited
|
||||||
void editingFinished();
|
void editingFinished();
|
||||||
@@ -62,7 +68,7 @@ namespace BlackGui
|
|||||||
QScopedPointer<Ui::CDBusServerAddressSelector> ui;
|
QScopedPointer<Ui::CDBusServerAddressSelector> ui;
|
||||||
|
|
||||||
//! Radio button clicked
|
//! Radio button clicked
|
||||||
void radioButtonReleased();
|
void onRadioButtonReleased();
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>CDBusServerAddressSelector</class>
|
<class>CDBusServerAddressSelector</class>
|
||||||
<widget class="QFrame" name="CDBusServerAddressSelector">
|
<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">
|
<property name="windowTitle">
|
||||||
<string>Frame</string>
|
<string>Frame</string>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ namespace BlackGui
|
|||||||
void setDefaultDownloadName(const QString &defaultDownload);
|
void setDefaultDownloadName(const QString &defaultDownload);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static constexpr int OverlayMsgTimeoutMs = 5000; //!< how long overlay is displayed
|
||||||
|
|
||||||
QScopedPointer<Ui::CInstallXSwiftBusComponent> ui;
|
QScopedPointer<Ui::CInstallXSwiftBusComponent> ui;
|
||||||
BlackMisc::Simulation::Settings::CMultiSimulatorSettings m_simulatorSettings { this }; //!< for directories of XPlane
|
BlackMisc::Simulation::Settings::CMultiSimulatorSettings m_simulatorSettings { this }; //!< for directories of XPlane
|
||||||
BlackMisc::CDataReadOnly<BlackMisc::Db::TUpdateInfo> m_updates { this, &CInstallXSwiftBusComponent::updatesChanged };
|
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 };
|
const QFileDialog::Options m_fileDialogOptions { QFileDialog::ShowDirsOnly | QFileDialog::ReadOnly | QFileDialog::DontResolveSymlinks };
|
||||||
QString m_defaultDownloadName; //!< default name for download
|
QString m_defaultDownloadName; //!< default name for download
|
||||||
|
|
||||||
static constexpr int OverlayMsgTimeoutMs = 5000; //!< how long overlay is displayed
|
|
||||||
|
|
||||||
//! Select X-Plane plugin directory
|
//! Select X-Plane plugin directory
|
||||||
void selectPluginDirectory();
|
void selectPluginDirectory();
|
||||||
|
|
||||||
|
|||||||
@@ -169,23 +169,17 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="gb_XSwiftBusSettings">
|
<widget class="QGroupBox" name="gb_XSwiftBusSettings">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>XSwiftBusSettings</string>
|
<string>XSwiftBus settings</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="vl_XSwiftBusSettings">
|
||||||
<item>
|
<item>
|
||||||
<widget class="BlackGui::Components::CSettingsXSwiftBusComponent" name="comp_SettingsXSwiftBus">
|
<widget class="BlackGui::Components::CSettingsXSwiftBusComponent" name="comp_SettingsXSwiftBus">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>25</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShape">
|
|
||||||
<enum>QFrame::StyledPanel</enum>
|
|
||||||
</property>
|
|
||||||
<property name="frameShadow">
|
|
||||||
<enum>QFrame::Raised</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -214,6 +208,16 @@
|
|||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</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>
|
<resources>
|
||||||
<include location="../../blackmisc/blackmisc.qrc"/>
|
<include location="../../blackmisc/blackmisc.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -10,35 +10,54 @@
|
|||||||
#include "settingsxswiftbuscomponent.h"
|
#include "settingsxswiftbuscomponent.h"
|
||||||
#include "ui_settingsxswiftbuscomponent.h"
|
#include "ui_settingsxswiftbuscomponent.h"
|
||||||
#include "blackmisc/dbusserver.h"
|
#include "blackmisc/dbusserver.h"
|
||||||
|
#include "blackmisc/logmessage.h"
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackMisc::Simulation::Settings;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
const CLogCategoryList &CSettingsXSwiftBusComponent::getLogCategories()
|
||||||
|
{
|
||||||
|
static const CLogCategoryList cats { CLogCategory::guiComponent() };
|
||||||
|
return cats;
|
||||||
|
}
|
||||||
|
|
||||||
CSettingsXSwiftBusComponent::CSettingsXSwiftBusComponent(QWidget *parent) :
|
CSettingsXSwiftBusComponent::CSettingsXSwiftBusComponent(QWidget *parent) :
|
||||||
QFrame(parent),
|
QFrame(parent),
|
||||||
ui(new Ui::CSettingsXSwiftBusComponent)
|
ui(new Ui::CSettingsXSwiftBusComponent)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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()
|
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())
|
if (dBusAddress != m_xSwiftBusServerSetting.getThreadLocal())
|
||||||
{
|
{
|
||||||
m_xSwiftBusServerSetting.setAndSave(dBusAddress);
|
const CStatusMessage msg = m_xSwiftBusServerSetting.setAndSave(dBusAddress);
|
||||||
|
CLogMessage::preformatted(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -12,9 +12,10 @@
|
|||||||
#ifndef BLACKGUI_COMPONENTS_SETTINGSXSWIFTBUSCOMPONENT_H
|
#ifndef BLACKGUI_COMPONENTS_SETTINGSXSWIFTBUSCOMPONENT_H
|
||||||
#define BLACKGUI_COMPONENTS_SETTINGSXSWIFTBUSCOMPONENT_H
|
#define BLACKGUI_COMPONENTS_SETTINGSXSWIFTBUSCOMPONENT_H
|
||||||
|
|
||||||
|
#include "blackgui/blackguiexport.h"
|
||||||
#include "blackmisc/simulation/settings/xswiftbussettings.h"
|
#include "blackmisc/simulation/settings/xswiftbussettings.h"
|
||||||
#include "blackmisc/settingscache.h"
|
#include "blackmisc/settingscache.h"
|
||||||
#include "blackgui/blackguiexport.h"
|
#include "blackmisc/logcategorylist.h"
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QScopedPointer>
|
#include <QScopedPointer>
|
||||||
|
|
||||||
@@ -31,6 +32,9 @@ namespace BlackGui
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
//! Log categories
|
||||||
|
static const BlackMisc::CLogCategoryList &getLogCategories();
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
explicit CSettingsXSwiftBusComponent(QWidget *parent = nullptr);
|
explicit CSettingsXSwiftBusComponent(QWidget *parent = nullptr);
|
||||||
|
|
||||||
@@ -41,7 +45,8 @@ namespace BlackGui
|
|||||||
QScopedPointer<Ui::CSettingsXSwiftBusComponent> ui;
|
QScopedPointer<Ui::CSettingsXSwiftBusComponent> ui;
|
||||||
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TXSwiftBusServer> m_xSwiftBusServerSetting { this };
|
BlackMisc::CSetting<BlackMisc::Simulation::Settings::TXSwiftBusServer> m_xSwiftBusServerSetting { this };
|
||||||
|
|
||||||
void saveServer(const QString &dBusAddress);
|
void resetServer();
|
||||||
|
void saveServer();
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -6,38 +6,83 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>160</width>
|
<width>315</width>
|
||||||
<height>26</height>
|
<height>116</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>XSwiftBus settings</string>
|
<string>XSwiftBus settings</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QFormLayout" name="fl_XSwiftBusSettings">
|
<layout class="QHBoxLayout" name="hl_SettingsXSwiftBus">
|
||||||
<property name="leftMargin">
|
<item>
|
||||||
<number>2</number>
|
<widget class="BlackGui::Components::CDBusServerAddressSelector" name="comp_DBusServer">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>75</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
<property name="maximumSize">
|
||||||
<number>2</number>
|
<size>
|
||||||
</property>
|
<width>400</width>
|
||||||
<property name="rightMargin">
|
<height>16777215</height>
|
||||||
<number>2</number>
|
</size>
|
||||||
</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>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item>
|
||||||
<widget class="QComboBox" name="cb_XSwiftBusServer"/>
|
<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>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</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/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@@ -325,6 +325,11 @@ QLineEdit[readOnly="true"] {
|
|||||||
border: 1px solid rgba(50,50,50);
|
border: 1px solid rgba(50,50,50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QLineEdit:disabled {
|
||||||
|
background: rgba(40,40,40);
|
||||||
|
border: 1px solid rgba(50,50,50);
|
||||||
|
}
|
||||||
|
|
||||||
QTextEdit {
|
QTextEdit {
|
||||||
border: 1px solid green;
|
border: 1px solid green;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
@@ -392,6 +397,11 @@ QComboBox {
|
|||||||
selection-background-color: #3f98ff;
|
selection-background-color: #3f98ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QComboBox:disabled {
|
||||||
|
background: rgba(40,40,40);
|
||||||
|
border: 1px solid rgba(50,50,50);
|
||||||
|
}
|
||||||
|
|
||||||
/* drop down list */
|
/* drop down list */
|
||||||
QComboBox QAbstractItemView {
|
QComboBox QAbstractItemView {
|
||||||
background-color: black;
|
background-color: black;
|
||||||
|
|||||||
Reference in New Issue
Block a user