mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
refs #454 Remove old hotkey settings
This commit is contained in:
committed by
Mathew Sutcliffe
parent
9b6126c5db
commit
2636d53b45
@@ -59,7 +59,6 @@ namespace BlackCore
|
||||
CSettingsCache::instance()->changeValuesFromRemote(settings, origin);
|
||||
});
|
||||
|
||||
changeSettings(IContextSettings::SettingsHotKeys);
|
||||
bool s = connect(CInputManager::instance(), &CInputManager::hotkeyActionRegistered, [this](const QStringList &actions)
|
||||
{
|
||||
this->registerHotkeyActions(actions, {});
|
||||
@@ -110,18 +109,7 @@ namespace BlackCore
|
||||
|
||||
void IContextApplication::changeSettings(uint typeValue)
|
||||
{
|
||||
auto type = static_cast<IContextSettings::SettingsType>(typeValue);
|
||||
switch (type)
|
||||
{
|
||||
case IContextSettings::SettingsHotKeys:
|
||||
{
|
||||
CSettingKeyboardHotkeyList hotkeys = getIContextSettings()->getHotkeys();
|
||||
CInputManager::getInstance()->changeHotkeySettings(hotkeys);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
Q_UNUSED(typeValue);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -136,6 +136,7 @@ namespace BlackCore
|
||||
virtual bool existsFile(const QString &fileName) const = 0;
|
||||
|
||||
//! Change settings
|
||||
//! \todo Remove with old settings
|
||||
void changeSettings(uint typeValue);
|
||||
|
||||
};
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "blackcore/context.h"
|
||||
#include "blackcore/dbus_server.h"
|
||||
#include "blackinput/keyboard.h"
|
||||
#include "blackmisc/setkeyboardhotkeylist.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/dbus.h"
|
||||
#include "blackmisc/variant.h"
|
||||
@@ -48,7 +47,6 @@ namespace BlackCore
|
||||
//! Settings type
|
||||
enum SettingsType
|
||||
{
|
||||
SettingsHotKeys,
|
||||
SettingsNetwork,
|
||||
SettingsAudio,
|
||||
SettingsSimulator
|
||||
@@ -91,13 +89,6 @@ namespace BlackCore
|
||||
return s;
|
||||
}
|
||||
|
||||
//! Path for hotkeys
|
||||
static const QString &PathHotkeys()
|
||||
{
|
||||
static QString s("hotkeys");
|
||||
return s;
|
||||
}
|
||||
|
||||
//! Factory method
|
||||
static IContextSettings *create(CRuntime *parent, CRuntimeConfig::ContextMode mode, CDBusServer *server, QDBusConnection &conn);
|
||||
|
||||
@@ -116,9 +107,6 @@ namespace BlackCore
|
||||
//! Audio settings
|
||||
virtual BlackMisc::Settings::CSettingsAudio getAudioSettings() const = 0;
|
||||
|
||||
//! Hotkeys
|
||||
virtual BlackMisc::Settings::CSettingKeyboardHotkeyList getHotkeys() const = 0;
|
||||
|
||||
//! Save settings
|
||||
virtual BlackMisc::CStatusMessage write() const = 0;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Settings;
|
||||
using namespace BlackMisc::Hardware;
|
||||
using namespace BlackMisc::Input;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
@@ -57,15 +57,6 @@ namespace BlackCore
|
||||
this->m_settingsAudio.initDefaultValues();
|
||||
}
|
||||
|
||||
// init own members
|
||||
if (jsonObject.contains(IContextSettings::PathHotkeys()))
|
||||
{
|
||||
this->m_hotkeys.convertFromJson(
|
||||
jsonObject.value(IContextSettings::PathHotkeys()).toObject()
|
||||
);
|
||||
}
|
||||
this->m_hotkeys.initAsHotkeyList(false); // update missing parts
|
||||
|
||||
if (ok)
|
||||
{
|
||||
return CStatusMessage(CStatusMessage::SeverityInfo, QString("Read settings: %1").arg(this->getSettingsFileName()));
|
||||
@@ -108,7 +99,6 @@ namespace BlackCore
|
||||
*/
|
||||
CStatusMessage CContextSettings::reset(bool write)
|
||||
{
|
||||
this->m_hotkeys.initAsHotkeyList(true);
|
||||
this->m_settingsAudio.initDefaultValues();
|
||||
this->emitCompletelyChanged();
|
||||
if (write)
|
||||
@@ -134,7 +124,6 @@ namespace BlackCore
|
||||
{
|
||||
QJsonObject jsonObject;
|
||||
jsonObject.insert(IContextSettings::PathAudioSettings(), this->m_settingsAudio.toJson());
|
||||
jsonObject.insert(IContextSettings::PathHotkeys(), this->m_hotkeys.toJson());
|
||||
QJsonDocument doc(jsonObject);
|
||||
return doc;
|
||||
}
|
||||
@@ -144,20 +133,11 @@ namespace BlackCore
|
||||
*/
|
||||
void CContextSettings::emitCompletelyChanged()
|
||||
{
|
||||
emit this->changedSettings(IContextSettings::SettingsHotKeys);
|
||||
emit this->changedSettings(IContextSettings::SettingsNetwork);
|
||||
emit this->changedSettings(IContextSettings::SettingsAudio);
|
||||
emit this->changedSettings(IContextSettings::SettingsSimulator);
|
||||
}
|
||||
|
||||
/*
|
||||
* Hotkeys
|
||||
*/
|
||||
CSettingKeyboardHotkeyList CContextSettings::getHotkeys() const
|
||||
{
|
||||
return this->m_hotkeys;
|
||||
}
|
||||
|
||||
/*
|
||||
* Audio settings
|
||||
*/
|
||||
@@ -177,17 +157,6 @@ namespace BlackCore
|
||||
BlackMisc::CStatusMessageList msgs;
|
||||
if (path.contains(IContextSettings::PathRoot()))
|
||||
{
|
||||
if (path.contains(IContextSettings::PathHotkeys()))
|
||||
{
|
||||
if (command == CSettingUtilities::CmdUpdate())
|
||||
{
|
||||
auto hotkeys = value.value<BlackMisc::Settings::CSettingKeyboardHotkeyList>();
|
||||
this->m_hotkeys = hotkeys;
|
||||
msgs.push_back(this->write()); // write settings
|
||||
emit this->changedSettings(static_cast<uint>(SettingsHotKeys));
|
||||
return msgs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// next level
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
#include "blackcore/settingsallclasses.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/hardware/keyboardkeylist.h"
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
@@ -57,9 +56,6 @@ namespace BlackCore
|
||||
//! \copydoc IContextSettings::getAudioSettings()
|
||||
virtual BlackMisc::Settings::CSettingsAudio getAudioSettings() const override;
|
||||
|
||||
//! \copydoc IContextSettings::getHotkeys()
|
||||
virtual BlackMisc::Settings::CSettingKeyboardHotkeyList getHotkeys() const override;
|
||||
|
||||
//! read settings
|
||||
virtual BlackMisc::CStatusMessage read() override;
|
||||
|
||||
@@ -80,7 +76,6 @@ namespace BlackCore
|
||||
const QString &getSettingsDirectory() const { return BlackMisc::Settings::CSettingUtilities::getSettingsDirectory(); }
|
||||
|
||||
BlackMisc::Settings::CSettingsAudio m_settingsAudio;
|
||||
BlackMisc::Settings::CSettingKeyboardHotkeyList m_hotkeys;
|
||||
QJsonDocument toJsonDocument() const;
|
||||
void emitCompletelyChanged();
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Settings;
|
||||
using namespace BlackMisc::Network;
|
||||
using namespace BlackMisc::Hardware;
|
||||
using namespace BlackMisc::Input;
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
@@ -49,14 +49,6 @@ namespace BlackCore
|
||||
return this->m_dBusInterface->callDBusRet<CSettingsAudio>(QLatin1Literal("getAudioSettings"));
|
||||
}
|
||||
|
||||
/*
|
||||
* Relay to DBus
|
||||
*/
|
||||
CSettingKeyboardHotkeyList CContextSettingsProxy::getHotkeys() const
|
||||
{
|
||||
return this->m_dBusInterface->callDBusRet<CSettingKeyboardHotkeyList>(QLatin1Literal("getHotkeys"));
|
||||
}
|
||||
|
||||
/*
|
||||
* Relay to DBus, but make this no slot
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/genericdbusinterface.h"
|
||||
#include "blackmisc/settingutilities.h"
|
||||
#include "blackmisc/hardware/keyboardkeylist.h"
|
||||
|
||||
namespace BlackCore
|
||||
{
|
||||
@@ -46,9 +45,6 @@ namespace BlackCore
|
||||
//! \copydoc IContextSettings::getAudioSettings()
|
||||
virtual BlackMisc::Settings::CSettingsAudio getAudioSettings() const override;
|
||||
|
||||
//! \copydoc IContextSettings::getHotkeys()
|
||||
virtual BlackMisc::Settings::CSettingKeyboardHotkeyList getHotkeys() const override;
|
||||
|
||||
//! \copydoc IContextSettings::value
|
||||
virtual BlackMisc::CStatusMessageList value(const QString &path, const QString &command, const BlackMisc::CVariant &value) override;
|
||||
|
||||
|
||||
@@ -262,12 +262,6 @@ void SwiftGuiStd::ps_displayStatusMessageInGui(const CStatusMessage &statusMessa
|
||||
}
|
||||
}
|
||||
|
||||
void SwiftGuiStd::ps_onChangedSetttings(uint typeValue)
|
||||
{
|
||||
IContextSettings::SettingsType type = static_cast<IContextSettings::SettingsType>(typeValue);
|
||||
if (type == IContextSettings::SettingsHotKeys) this->ps_registerHotkeyFunctions();
|
||||
}
|
||||
|
||||
void SwiftGuiStd::ps_onConnectionTerminated()
|
||||
{
|
||||
this->updateGuiStatusInformation();
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "blackgui/models/serverlistmodel.h"
|
||||
#include "blackgui/models/userlistmodel.h"
|
||||
#include "blackgui/models/statusmessagelistmodel.h"
|
||||
#include "blackgui/models/keyboardkeylistmodel.h"
|
||||
#include "blackgui/enableforframelesswindow.h"
|
||||
#include "blackgui/managedstatusbar.h"
|
||||
#include "blackmisc/network/textmessage.h"
|
||||
@@ -195,9 +194,6 @@ private slots:
|
||||
//! Display status message
|
||||
void ps_displayStatusMessageInGui(const BlackMisc::CStatusMessage &);
|
||||
|
||||
//! Settings have been changed
|
||||
void ps_onChangedSetttings(uint typeValue);
|
||||
|
||||
//! Connection status changed
|
||||
//! \param from old status, as int so it is compliant with DBus
|
||||
//! \param to new status, as int so it is compliant with DBus
|
||||
|
||||
Reference in New Issue
Block a user