mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
Ref T609, encapsulate PTT action/key
This commit is contained in:
@@ -33,17 +33,6 @@ namespace BlackCore
|
||||
return s;
|
||||
}
|
||||
|
||||
const QString &IContextAudio::pttHotkeyAction()
|
||||
{
|
||||
static const QString s("/Voice/Activate push-to-talk");
|
||||
return s;
|
||||
}
|
||||
|
||||
const QPixmap &IContextAudio::pttHotkeyIcon()
|
||||
{
|
||||
return CIcons::radio16();
|
||||
}
|
||||
|
||||
IContextAudio *IContextAudio::create(CCoreFacade *runtime, CCoreFacadeConfig::ContextMode mode, CDBusServer *server, QDBusConnection &connection)
|
||||
{
|
||||
switch (mode)
|
||||
|
||||
@@ -72,12 +72,6 @@ namespace BlackCore
|
||||
//! Object path
|
||||
static const QString &ObjectPath();
|
||||
|
||||
//! Hotkey identifier for PTT (push to talk)
|
||||
static const QString &pttHotkeyAction();
|
||||
|
||||
//! Hotkey icon for PTT (push to talk)
|
||||
static const QPixmap &pttHotkeyIcon();
|
||||
|
||||
//! \copydoc CContext::getPathAndContextId()
|
||||
virtual QString getPathAndContextId() const override { return this->buildPathAndContextId(ObjectPath()); }
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "blackmisc/audio/audiodeviceinfolist.h"
|
||||
#include "blackmisc/audio/notificationsounds.h"
|
||||
#include "blackmisc/audio/voiceroomlist.h"
|
||||
#include "blackmisc/input/actionhotkeydefs.h"
|
||||
#include "blackmisc/aviation/callsignset.h"
|
||||
#include "blackmisc/aviation/comsystem.h"
|
||||
#include "blackmisc/aviation/selcal.h"
|
||||
@@ -140,7 +141,7 @@ namespace BlackCore
|
||||
//! Voice channel by room
|
||||
QSharedPointer<IVoiceChannel> getVoiceChannelBy(const BlackMisc::Audio::CVoiceRoom &voiceRoom);
|
||||
|
||||
CActionBind m_actionPtt { pttHotkeyAction(), pttHotkeyIcon(), this, &CContextAudio::setVoiceTransmission };
|
||||
CActionBind m_actionPtt { BlackMisc::Input::pttHotkeyAction(), BlackMisc::Input::pttHotkeyIcon(), this, &CContextAudio::setVoiceTransmission };
|
||||
|
||||
std::unique_ptr<IVoice> m_voice; //!< underlying voice lib
|
||||
std::unique_ptr<IAudioMixer> m_audioMixer;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "blackcore/actionbind.h"
|
||||
#include "blackcore/network.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/input/actionhotkeydefs.h"
|
||||
|
||||
#include <QFrame>
|
||||
#include <QObject>
|
||||
@@ -58,7 +59,7 @@ namespace BlackGui
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CInfoBarStatusComponent> ui;
|
||||
BlackCore::CActionBind m_actionPtt { "/Voice/Activate push-to-talk", BlackMisc::CIcons::radio16(), this, &CInfoBarStatusComponent::onPttChanged };
|
||||
BlackCore::CActionBind m_actionPtt { BlackMisc::Input::pttHotkeyAction(), BlackMisc::Input::pttHotkeyIcon(), this, &CInfoBarStatusComponent::onPttChanged };
|
||||
BlackMisc::CDigestSignal m_dsResize { this, &CInfoBarStatusComponent::adjustTextSize, 1000, 50 };
|
||||
|
||||
//! Init the LEDs
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "blackcore/context/contextapplication.h"
|
||||
#include "blackcore/context/contextaudio.h"
|
||||
#include "blackcore/inputmanager.h"
|
||||
#include "blackmisc/input/actionhotkeydefs.h"
|
||||
#include "ui_settingshotkeycomponent.h"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
@@ -67,7 +68,7 @@ namespace BlackGui
|
||||
void CSettingsHotkeyComponent::registerDummyPttEntry()
|
||||
{
|
||||
Q_ASSERT_X(sApp && sApp->getInputManager(), Q_FUNC_INFO, "Missing input manager");
|
||||
sApp->getInputManager()->registerAction(IContextAudio::pttHotkeyAction(), IContextAudio::pttHotkeyIcon());
|
||||
sApp->getInputManager()->registerAction(pttHotkeyAction(), pttHotkeyIcon());
|
||||
}
|
||||
|
||||
void CSettingsHotkeyComponent::addEntry()
|
||||
|
||||
26
src/blackmisc/input/actionhotkeydefs.cpp
Normal file
26
src/blackmisc/input/actionhotkeydefs.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/* Copyright (C) 2019
|
||||
* swift project community / contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated,
|
||||
* or distributed except according to the terms contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "actionhotkeydefs.h"
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Input
|
||||
{
|
||||
const QString &pttHotkeyAction()
|
||||
{
|
||||
static const QString s("/Voice/Activate push-to-talk");
|
||||
return s;
|
||||
}
|
||||
|
||||
const QPixmap &pttHotkeyIcon()
|
||||
{
|
||||
return CIcons::radio16();
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
31
src/blackmisc/input/actionhotkeydefs.h
Normal file
31
src/blackmisc/input/actionhotkeydefs.h
Normal file
@@ -0,0 +1,31 @@
|
||||
/* Copyright (C) 2019
|
||||
* swift project community / contributors
|
||||
*
|
||||
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||
* directory of this distribution. No part of swift project, including this file, may be copied, modified, propagated,
|
||||
* or distributed except according to the terms contained in the LICENSE file.
|
||||
*/
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_INPUT_ACTIONHOTKEYDEFS_H
|
||||
#define BLACKMISC_INPUT_ACTIONHOTKEYDEFS_H
|
||||
|
||||
#include "blackmisc/icon.h"
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
namespace Input
|
||||
{
|
||||
//! PTT key
|
||||
BLACKMISC_EXPORT const QString &pttHotkeyAction();
|
||||
|
||||
//! PTT key
|
||||
BLACKMISC_EXPORT const QPixmap &pttHotkeyIcon();
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
#endif // guard
|
||||
Reference in New Issue
Block a user