mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-13 07:35:41 +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:
@@ -25,5 +25,6 @@
|
||||
<file>icons/aircraft_arrival.jpg</file>
|
||||
<file>icons/sky.jpg</file>
|
||||
<file>icons/tower_framed.jpg</file>
|
||||
<file>icons/gnd_framed.jpg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -104,6 +104,7 @@ void BlackMisc::Network::registerMetadata()
|
||||
void BlackMisc::Settings::registerMetadata()
|
||||
{
|
||||
CSettingsNetwork::registerMetadata();
|
||||
CSettingsAudio::registerMetadata();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -18,7 +18,9 @@ namespace BlackMisc
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -129,7 +131,19 @@ namespace BlackMisc
|
||||
*/
|
||||
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());
|
||||
char value = (command == CSettingUtilities::CmdSetTrue()) ? '1' : '0' ;
|
||||
this->initNotificationFlags();
|
||||
this->m_notificationFlags.replace(index, 1, value);
|
||||
return msgs;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,8 @@ namespace BlackMisc
|
||||
|
||||
private:
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user