refs #455 Examples how to register actions

This commit is contained in:
Roland Winklmeier
2015-09-03 16:32:54 +00:00
committed by Mathew Sutcliffe
parent 2636d53b45
commit be7ac1aa74
4 changed files with 19 additions and 1 deletions

View File

@@ -21,6 +21,7 @@
#include "voice_channel.h"
#include "audio_device.h"
#include "audio_mixer.h"
#include "actionbind.h"
#include "blackinput/keyboard.h"
#include "blackmisc/audio/voiceroomlist.h"
@@ -153,6 +154,7 @@ namespace BlackCore
QSharedPointer<IVoiceChannel> getVoiceChannelBy(const BlackMisc::Audio::CVoiceRoom &voiceRoom);
CActionBind m_actionPtt { "/Voice/Activate push-to-talk", this, &CContextAudio::ps_setVoiceTransmission };
std::unique_ptr<IVoice> m_voice; //!< underlying voice lib
std::unique_ptr<IAudioMixer> m_audioMixer;

View File

@@ -134,5 +134,9 @@ namespace BlackGui
return true;
}
void CSettingsHotkeyComponent::ps_hotkeySlot(bool keyDown)
{
if (keyDown) QMessageBox::information(this, "Test", "Push-To-Talk");
}
} // ns
} // ns

View File

@@ -15,7 +15,7 @@
#include "blackgui/models/actionhotkeylistmodel.h"
#include "blackgui/components/enableforruntime.h"
#include "blackcore/settings/application.h"
#include "blackcore/actionbind.h"
#include <QFrame>
namespace Ui {
@@ -55,6 +55,7 @@ namespace BlackGui
QScopedPointer<Ui::CSettingsHotkeyComponent> ui;
BlackGui::Models::CActionHotkeyListModel m_model;
BlackCore::CSetting<BlackCore::Settings::Application::ActionHotkeys> m_actionHotkeys { this };
BlackCore::CActionBind m_action { "/Test/Message", this, &CSettingsHotkeyComponent::ps_hotkeySlot };
void ps_hotkeySlot(bool keyDown);
};

View File

@@ -18,6 +18,7 @@
#include "guimodeenums.h"
#include "blackcore/context_all_interfaces.h"
#include "blackcore/actionbind.h"
#include "blackgui/components/enableforruntime.h"
#include "blackgui/components/infowindowcomponent.h"
#include "blackgui/components/maininfoareacomponent.h"
@@ -126,6 +127,10 @@ private:
QString m_transponderResetValue; //!< Temp. storage of XPdr mode to reset, req. until timer allows singleShoot with Lambdas
QWidget *m_inputFocusedWidget = nullptr; //!< currently used widget for input, mainly used with cockpit
// actions
BlackCore::CActionBind m_action50 { "/swiftGui/Change opacity to 50%", this, &SwiftGuiStd::ps_onChangedWindowOpacityTo50 };
BlackCore::CActionBind m_action100 { "/swiftGui/Change opacity to 100%", this, &SwiftGuiStd::ps_onChangedWindowOpacityTo100 };
//! GUI status update
void updateGuiStatusInformation();
@@ -224,6 +229,12 @@ private slots:
//! Update timer
void ps_handleTimerBasedUpdates();
//! Change opacity 0-100
void ps_onChangedWindowOpacityTo50(bool) { ps_onChangedWindowOpacity(50); }
//! Change opacity 0-100
void ps_onChangedWindowOpacityTo100(bool) { ps_onChangedWindowOpacity(100); }
//! Change opacity 0-100
void ps_onChangedWindowOpacity(int opacity = -1);