mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
fixes as follow-up of meeting https://dev.vatsim-germany.org/boards/22/topics/1671
* asserts for relaySignals * relay "message" in connection status changed * bug in status message * bug in saving settings refs #198 refs #199 refs #207 refs #209
This commit is contained in:
@@ -27,14 +27,19 @@ namespace BlackCore
|
||||
void CContextApplicationProxy::relaySignals(const QString &serviceName, QDBusConnection &connection)
|
||||
{
|
||||
// signals originating from impl side
|
||||
connection.connect(serviceName, IContextApplication::ObjectPath(), IContextApplication::InterfaceName(),
|
||||
"statusMessage", this, SIGNAL(statusMessage(BlackMisc::CStatusMessage)));
|
||||
connection.connect(serviceName, IContextApplication::ObjectPath(), IContextApplication::InterfaceName(),
|
||||
"statusMessages", this, SIGNAL(statusMessages(BlackMisc::CStatusMessageList)));
|
||||
connection.connect(serviceName, IContextApplication::ObjectPath(), IContextApplication::InterfaceName(),
|
||||
"redirectedOutput", this, SIGNAL(redirectedOutput(BlackMisc::CStatusMessage, qint64)));
|
||||
connection.connect(serviceName, IContextApplication::ObjectPath(), IContextApplication::InterfaceName(),
|
||||
"componentChanged", this, SIGNAL(componentChanged(uint, uint)));
|
||||
bool s = connection.connect(serviceName, IContextApplication::ObjectPath(), IContextApplication::InterfaceName(),
|
||||
"statusMessage", this, SIGNAL(statusMessage(BlackMisc::CStatusMessage)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextApplication::ObjectPath(), IContextApplication::InterfaceName(),
|
||||
"statusMessages", this, SIGNAL(statusMessages(BlackMisc::CStatusMessageList)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextApplication::ObjectPath(), IContextApplication::InterfaceName(),
|
||||
"redirectedOutput", this, SIGNAL(redirectedOutput(BlackMisc::CStatusMessage, qint64)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextApplication::ObjectPath(), IContextApplication::InterfaceName(),
|
||||
"componentChanged", this, SIGNAL(componentChanged(uint, uint)));
|
||||
Q_ASSERT(s);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -96,4 +101,13 @@ namespace BlackCore
|
||||
if (fileName.isEmpty()) return false;
|
||||
return this->m_dBusInterface->callDBusRet<bool>(QLatin1Literal("deleteFile"), fileName);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check file
|
||||
*/
|
||||
bool CContextApplicationProxy::existsFile(const QString &fileName)
|
||||
{
|
||||
if (fileName.isEmpty()) return false;
|
||||
return this->m_dBusInterface->callDBusRet<bool>(QLatin1Literal("existsFile"), fileName);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -29,8 +29,10 @@ namespace BlackCore
|
||||
*/
|
||||
void CContextAudioProxy::relaySignals(const QString &serviceName, QDBusConnection &connection)
|
||||
{
|
||||
connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
||||
"audioTestCompleted", this, SIGNAL(audioTestCompleted()));
|
||||
bool s = connection.connect(serviceName, IContextAudio::ObjectPath(), IContextAudio::InterfaceName(),
|
||||
"audioTestCompleted", this, SIGNAL(audioTestCompleted()));
|
||||
Q_ASSERT(s);
|
||||
Q_UNUSED(s);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -65,10 +65,11 @@ namespace BlackCore
|
||||
* \brief Connection status changed
|
||||
* \param from old status
|
||||
* \param to new status
|
||||
* \param message further details
|
||||
* \remarks If I use the enum, adaptor / interface are not created correctly
|
||||
* \see INetwork::ConnectionStatus
|
||||
*/
|
||||
void connectionStatusChanged(uint from, uint to);
|
||||
void connectionStatusChanged(uint from, uint to, const QString &message);
|
||||
|
||||
//! Text messages received (also private chat messages, rfaio channel messages)
|
||||
void textMessagesReceived(const BlackMisc::Network::CTextMessageList &textMessages);
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace BlackCore
|
||||
/*
|
||||
* Connection status changed
|
||||
*/
|
||||
void CContextNetwork::psFsdConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to)
|
||||
void CContextNetwork::psFsdConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to, const QString &message)
|
||||
{
|
||||
if (this->getRuntime()->isSlotLogForNetworkEnabled()) this->getRuntime()->logSlot(Q_FUNC_INFO, QString::number(from), QString::number(to));
|
||||
CStatusMessageList msgs;
|
||||
@@ -285,12 +285,13 @@ namespace BlackCore
|
||||
// send as message
|
||||
QString m("connection status changed from %1 to %2");
|
||||
m = m.arg(INetwork::connectionStatusToString(from), INetwork::connectionStatusToString(to));
|
||||
if (!message.isEmpty()) m.append(" ").append(message);
|
||||
msgs.push_back(CStatusMessage(CStatusMessage::TypeTrafficNetwork,
|
||||
to == INetwork::DisconnectedError ? CStatusMessage::SeverityError : CStatusMessage::SeverityInfo, m));
|
||||
if (this->getIContextApplication()) this->getIContextApplication()->sendStatusMessages(msgs);
|
||||
|
||||
// send as own signal
|
||||
emit this->connectionStatusChanged(from, to);
|
||||
emit this->connectionStatusChanged(from, to, message);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace BlackCore
|
||||
* \param from old status
|
||||
* \param to new status
|
||||
*/
|
||||
void psFsdConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to);
|
||||
void psFsdConnectionStatusChanged(INetwork::ConnectionStatus from, INetwork::ConnectionStatus to, const QString &message);
|
||||
|
||||
//! \brief ATC position update
|
||||
void psFsdAtcPositionUpdate(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::PhysicalQuantities::CFrequency &frequency, const BlackMisc::Geo::CCoordinateGeodetic &position, const BlackMisc::PhysicalQuantities::CLength &range);
|
||||
|
||||
@@ -28,20 +28,28 @@ namespace BlackCore
|
||||
*/
|
||||
void CContextNetworkProxy::relaySignals(const QString &serviceName, QDBusConnection &connection)
|
||||
{
|
||||
connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"connectionStatusChanged", this, SIGNAL(connectionStatusChanged(uint, uint)));
|
||||
connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"changedAtcStationsBooked", this, SIGNAL(changedAtcStationsBooked()));
|
||||
connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"changedAtcStationsOnline", this, SIGNAL(changedAtcStationsOnline()));
|
||||
connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"connectionTerminated", this, SIGNAL(connectionTerminated()));
|
||||
connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"statusMessage", this, SIGNAL(statusMessage(BlackMisc::CStatusMessage)));
|
||||
connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"statusMessages", this, SIGNAL(statusMessages(BlackMisc::CStatusMessageList)));
|
||||
connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"textMessagesReceived", this, SIGNAL(textMessagesReceived(BlackMisc::Network::CTextMessageList)));
|
||||
bool s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"connectionStatusChanged", this, SIGNAL(connectionStatusChanged(uint, uint, const QString &)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"changedAtcStationsBooked", this, SIGNAL(changedAtcStationsBooked()));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"changedAtcStationsOnline", this, SIGNAL(changedAtcStationsOnline()));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"connectionTerminated", this, SIGNAL(connectionTerminated()));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"statusMessage", this, SIGNAL(statusMessage(BlackMisc::CStatusMessage)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"statusMessages", this, SIGNAL(statusMessages(BlackMisc::CStatusMessageList)));
|
||||
Q_ASSERT(s);
|
||||
s = connection.connect(serviceName, IContextNetwork::ObjectPath(), IContextNetwork::InterfaceName(),
|
||||
"textMessagesReceived", this, SIGNAL(textMessagesReceived(BlackMisc::Network::CTextMessageList)));
|
||||
Q_ASSERT(s);
|
||||
Q_UNUSED(s);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
/*
|
||||
* Reset settings file
|
||||
* Reset settings
|
||||
*/
|
||||
CStatusMessage CContextSettings::reset(bool write)
|
||||
{
|
||||
|
||||
@@ -35,8 +35,10 @@ namespace BlackCore
|
||||
*/
|
||||
void CContextSettingsProxy::relaySignals(const QString &serviceName, QDBusConnection &connection)
|
||||
{
|
||||
connection.connect(serviceName, IContextSettings::ObjectPath(), IContextSettings::InterfaceName(),
|
||||
"changedSettings", this, SIGNAL(changedSettings(uint)));
|
||||
bool s = connection.connect(serviceName, IContextSettings::ObjectPath(), IContextSettings::InterfaceName(),
|
||||
"changedSettings", this, SIGNAL(changedSettings(uint)));
|
||||
Q_ASSERT(s);
|
||||
Q_UNUSED(s);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user