mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-17 19:05:31 +08:00
Some fixes found during testing with remote black core (different computer)
* Allow anonymous access for P2P * Fixed sound settings flags, if empty string is saved in settings * Fixed metadata registration
This commit is contained in:
@@ -26,6 +26,7 @@ namespace BlackCore
|
|||||||
parent), m_serverMode(CDBusServer::SERVERMODE_P2P)
|
parent), m_serverMode(CDBusServer::SERVERMODE_P2P)
|
||||||
{
|
{
|
||||||
ServerMode m = CDBusServer::addressToDBusMode(address);
|
ServerMode m = CDBusServer::addressToDBusMode(address);
|
||||||
|
m_busServer.setAnonymousAuthenticationAllowed(true);
|
||||||
switch (m)
|
switch (m)
|
||||||
{
|
{
|
||||||
case SERVERMODE_SESSIONBUS:
|
case SERVERMODE_SESSIONBUS:
|
||||||
|
|||||||
@@ -25,5 +25,6 @@
|
|||||||
<file>icons/aircraft_arrival.jpg</file>
|
<file>icons/aircraft_arrival.jpg</file>
|
||||||
<file>icons/sky.jpg</file>
|
<file>icons/sky.jpg</file>
|
||||||
<file>icons/tower_framed.jpg</file>
|
<file>icons/tower_framed.jpg</file>
|
||||||
|
<file>icons/gnd_framed.jpg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ void BlackMisc::Network::registerMetadata()
|
|||||||
void BlackMisc::Settings::registerMetadata()
|
void BlackMisc::Settings::registerMetadata()
|
||||||
{
|
{
|
||||||
CSettingsNetwork::registerMetadata();
|
CSettingsNetwork::registerMetadata();
|
||||||
|
CSettingsAudio::registerMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -18,7 +18,9 @@ namespace BlackMisc
|
|||||||
*/
|
*/
|
||||||
bool CSettingsAudio::getNotificationFlag(CNotificationSounds::Notification notification) const
|
bool CSettingsAudio::getNotificationFlag(CNotificationSounds::Notification notification) const
|
||||||
{
|
{
|
||||||
QChar f = m_notificationFlags.at(static_cast<int>(notification));
|
const int i = static_cast<int>(notification);
|
||||||
|
if (i >= m_notificationFlags.length()) return true; // default
|
||||||
|
QChar f = m_notificationFlags.at(i);
|
||||||
return '1' == f;
|
return '1' == f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,7 +131,19 @@ namespace BlackMisc
|
|||||||
*/
|
*/
|
||||||
void CSettingsAudio::initDefaultValues()
|
void CSettingsAudio::initDefaultValues()
|
||||||
{
|
{
|
||||||
this->m_notificationFlags = QString(1 + static_cast<int>(CNotificationSounds::Notification::NotificationsLoadSounds), '1');
|
this->initNotificationFlags();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CSettingsAudio::initNotificationFlags()
|
||||||
|
{
|
||||||
|
// if we add flags in the future, we automatically extend ...
|
||||||
|
static const int l = 1 + static_cast<int>(CNotificationSounds::Notification::NotificationsLoadSounds);
|
||||||
|
if (this->m_notificationFlags.length() < l)
|
||||||
|
{
|
||||||
|
int cl = m_notificationFlags.length();
|
||||||
|
this->m_notificationFlags.append(QString(l - cl, '1'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -155,6 +169,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
CNotificationSounds::Notification index = static_cast<CNotificationSounds::Notification>(value.toInt());
|
CNotificationSounds::Notification index = static_cast<CNotificationSounds::Notification>(value.toInt());
|
||||||
char value = (command == CSettingUtilities::CmdSetTrue()) ? '1' : '0' ;
|
char value = (command == CSettingUtilities::CmdSetTrue()) ? '1' : '0' ;
|
||||||
|
this->initNotificationFlags();
|
||||||
this->m_notificationFlags.replace(index, 1, value);
|
this->m_notificationFlags.replace(index, 1, value);
|
||||||
return msgs;
|
return msgs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,8 @@ namespace BlackMisc
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
BLACK_ENABLE_TUPLE_CONVERSION(CSettingsAudio)
|
BLACK_ENABLE_TUPLE_CONVERSION(CSettingsAudio)
|
||||||
QString m_notificationFlags; //!< play notification for notification x, a little trick to use a string here (streamable, hashable, ..)
|
QString m_notificationFlags; //!< play notification for notification x, a little trick to use a string here (streamable, hashable, ..)
|
||||||
|
void initNotificationFlags(); //!< init flags
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -168,12 +168,6 @@ namespace BlackSound
|
|||||||
*/
|
*/
|
||||||
static void playSelcal(qint32 volume, const BlackMisc::Aviation::CSelcal &selcal, const BlackMisc::Audio::CAudioDevice &audioDevice);
|
static void playSelcal(qint32 volume, const BlackMisc::Aviation::CSelcal &selcal, const BlackMisc::Audio::CAudioDevice &audioDevice);
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief Play notification
|
|
||||||
* \param volume 0-100
|
|
||||||
* \param notification
|
|
||||||
*/
|
|
||||||
static void playNotificationSound(qint32 volume, CNotificationSounds::Notification notification);
|
|
||||||
|
|
||||||
//! One cycle of tones takes t milliseconds
|
//! One cycle of tones takes t milliseconds
|
||||||
BlackMisc::PhysicalQuantities::CTime oneCycleDurationMs() const
|
BlackMisc::PhysicalQuantities::CTime oneCycleDurationMs() const
|
||||||
@@ -189,6 +183,13 @@ namespace BlackSound
|
|||||||
*/
|
*/
|
||||||
static void playFile(qint32 volume, const QString &file, bool removeFileAfterPlaying);
|
static void playFile(qint32 volume, const QString &file, bool removeFileAfterPlaying);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Play notification
|
||||||
|
* \param volume 0-100
|
||||||
|
* \param notification
|
||||||
|
*/
|
||||||
|
static void playNotificationSound(qint32 volume, CNotificationSounds::Notification notification);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/*!
|
/*!
|
||||||
* \brief Device was closed
|
* \brief Device was closed
|
||||||
|
|||||||
Reference in New Issue
Block a user