Browse Source

Show a message when cycle_setting command is invoked

Vincent Lang 9 years ago
parent
commit
fdd37f4a6a
2 changed files with 5 additions and 1 deletions
  1. 4 1
      src/settings/SettingsComponent.cpp
  2. 1 0
      src/system/SystemComponent.h

+ 4 - 1
src/settings/SettingsComponent.cpp

@@ -12,6 +12,7 @@
 #include <QJsonArray>
 #include <QList>
 #include "input/InputComponent.h"
+#include "system/SystemComponent.h"
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 SettingsComponent::SettingsComponent(QObject *parent) : ComponentBase(parent), m_settingsVersion(-1)
@@ -60,9 +61,11 @@ void SettingsComponent::cycleSetting(const QString& args)
   }
   if (nextValueIndex >= values.size())
     nextValueIndex = 0;
-  QVariant nextValue = values[nextValueIndex].toMap()["value"];
+  auto nextSetting = values[nextValueIndex].toMap();
+  auto nextValue = nextSetting["value"];
   QLOG_DEBUG() << "Setting" << settingName << "to" << nextValue;
   setValue(sectionID, valueName, nextValue);
+  emit SystemComponent::Get().settingsMessage(valueName, nextSetting["title"].toString());
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////

+ 1 - 0
src/system/SystemComponent.h

@@ -75,6 +75,7 @@ public:
 
 signals:
   void hostMessage(const QString& message);
+  void settingsMessage(const QString& setting, const QString& value);
   void scaleChanged(qreal scale);
 
 private: