refs #912, formatting, typos, const

This commit is contained in:
Klaus Basan
2017-03-18 20:40:05 +01:00
committed by Mathew Sutcliffe
parent ea50533755
commit 422e6626c8
10 changed files with 29 additions and 26 deletions

View File

@@ -61,7 +61,7 @@ namespace BlackCore
//! Register action //! Register action
static QString registerAction(const QString &action, const QPixmap &icon); static QString registerAction(const QString &action, const QPixmap &icon);
int m_index = -1; //!< action indexx (unique) int m_index = -1; //!< action index (unique)
std::function<void()> m_deleteCallback; //!< called when deleted std::function<void()> m_deleteCallback; //!< called when deleted
}; };

View File

@@ -88,7 +88,6 @@ namespace BlackCore
virtual ~IContextAudio() {} virtual ~IContextAudio() {}
signals: signals:
//! Voice rooms changed //! Voice rooms changed
//! \details the flag indicates, whether a room got connected or disconnected //! \details the flag indicates, whether a room got connected or disconnected
void changedVoiceRooms(const BlackMisc::Audio::CVoiceRoomList &voiceRooms, bool connected); void changedVoiceRooms(const BlackMisc::Audio::CVoiceRoomList &voiceRooms, bool connected);

View File

@@ -114,7 +114,6 @@ namespace BlackCore
CContextAudio *registerWithDBus(BlackMisc::CDBusServer *server); CContextAudio *registerWithDBus(BlackMisc::CDBusServer *server);
private slots: private slots:
//! \copydoc IVoice::connectionStatusChanged //! \copydoc IVoice::connectionStatusChanged
//! \sa IContextAudio::changedVoiceRooms //! \sa IContextAudio::changedVoiceRooms
void ps_connectionStatusChanged(IVoiceChannel::ConnectionStatus oldStatus, IVoiceChannel::ConnectionStatus newStatus); void ps_connectionStatusChanged(IVoiceChannel::ConnectionStatus oldStatus, IVoiceChannel::ConnectionStatus newStatus);
@@ -122,6 +121,7 @@ namespace BlackCore
//! Init notification sounds //! Init notification sounds
void ps_initNotificationSounds(); void ps_initNotificationSounds();
//! Enable/disable voice transmission
void ps_setVoiceTransmission(bool enable); void ps_setVoiceTransmission(bool enable);
//! User joined the room //! User joined the room
@@ -137,10 +137,11 @@ namespace BlackCore
//! Voice channel by room //! Voice channel by room
QSharedPointer<IVoiceChannel> getVoiceChannelBy(const BlackMisc::Audio::CVoiceRoom &voiceRoom); QSharedPointer<IVoiceChannel> getVoiceChannelBy(const BlackMisc::Audio::CVoiceRoom &voiceRoom);
const int MinUnmuteVolume = 20; //!< minimum volume when unmuted CActionBind m_actionPtt { pttHotkeyIdentifier(), pttHotkeyIcon(), this, &CContextAudio::ps_setVoiceTransmission };
CActionBind m_actionPtt { "/Voice/Activate push-to-talk", BlackMisc::CIcons::radio16(), this, &CContextAudio::ps_setVoiceTransmission };
std::unique_ptr<IVoice> m_voice; //!< underlying voice lib std::unique_ptr<IVoice> m_voice; //!< underlying voice lib
std::unique_ptr<IAudioMixer> m_audioMixer; std::unique_ptr<IAudioMixer> m_audioMixer;
const int MinUnmuteVolume = 20; //!< minimum volume when unmuted
int m_outVolumeBeforeMute = 90; int m_outVolumeBeforeMute = 90;
// For easy access. // For easy access.

View File

@@ -14,7 +14,6 @@
#include "blackmisc/icons.h" #include "blackmisc/icons.h"
#include "blackmisc/identifier.h" #include "blackmisc/identifier.h"
#include "blackmisc/input/hotkeycombination.h" #include "blackmisc/input/hotkeycombination.h"
#include "blackmisc/input/keyboardkey.h"
#include "blackmisc/input/keyboardkeylist.h" #include "blackmisc/input/keyboardkeylist.h"
#include "blackmisc/logmessage.h" #include "blackmisc/logmessage.h"
#include "blackmisc/statusmessage.h" #include "blackmisc/statusmessage.h"
@@ -80,8 +79,8 @@ namespace BlackGui
if (!actionHotkey.getCombination().isEmpty()) { ui->pb_SelectedHotkey->setText(actionHotkey.getCombination().toQString()); } if (!actionHotkey.getCombination().isEmpty()) { ui->pb_SelectedHotkey->setText(actionHotkey.getCombination().toQString()); }
CIdentifierList machinesUnique = applications.getMachinesUnique();
int index = -1; int index = -1;
const CIdentifierList machinesUnique = applications.getMachinesUnique();
for (const auto &app : machinesUnique) for (const auto &app : machinesUnique)
{ {
ui->cb_Identifier->addItem(app.getMachineName(), QVariant::fromValue(app)); ui->cb_Identifier->addItem(app.getMachineName(), QVariant::fromValue(app));
@@ -240,7 +239,7 @@ namespace BlackGui
} }
ksb->setSelectedIndex(currentIndex); ksb->setSelectedIndex(currentIndex);
ui->qf_Advanced->layout()->addWidget(ksb); ui->qf_Advanced->layout()->addWidget(ksb);
int position = ui->qf_Advanced->layout()->count() - 1; const int position = ui->qf_Advanced->layout()->count() - 1;
ksb->setProperty("position", position); ksb->setProperty("position", position);
connect(ksb, &CKeySelectionBox::keySelectionChanged, this, &CHotkeyDialog::advancedKeyChanged); connect(ksb, &CKeySelectionBox::keySelectionChanged, this, &CHotkeyDialog::advancedKeyChanged);
} }

View File

@@ -79,7 +79,9 @@ namespace BlackGui
void initStyleSheet(); void initStyleSheet();
//! Runs the hotkey dialog and returns the result //! Runs the hotkey dialog and returns the result
static BlackMisc::Input::CActionHotkey getActionHotkey(const BlackMisc::Input::CActionHotkey &initial, const BlackMisc::CIdentifierList &applications, static BlackMisc::Input::CActionHotkey getActionHotkey(
const BlackMisc::Input::CActionHotkey &initial,
const BlackMisc::CIdentifierList &applications,
QWidget *parent = nullptr); QWidget *parent = nullptr);
private: private:
@@ -88,9 +90,9 @@ namespace BlackGui
void ps_combinationSelectionChanged(const BlackMisc::Input::CHotkeyCombination &combination); void ps_combinationSelectionChanged(const BlackMisc::Input::CHotkeyCombination &combination);
void ps_combinationSelectionFinished(const BlackMisc::Input::CHotkeyCombination &combination); void ps_combinationSelectionFinished(const BlackMisc::Input::CHotkeyCombination &combination);
void ps_changeSelectedAction(const QItemSelection &selected, const QItemSelection &deselected); void ps_changeSelectedAction(const QItemSelection &selected, const QItemSelection &deselected);
void changeApplicableMachine(int index);
void ps_accept(); void ps_accept();
void changeApplicableMachine(int index);
void synchronize(); void synchronize();
void synchronizeSimpleSelection(); void synchronizeSimpleSelection();
void synchronizeAdvancedSelection(); void synchronizeAdvancedSelection();
@@ -102,7 +104,7 @@ namespace BlackGui
QScopedPointer<Ui::CHotkeyDialog> ui; QScopedPointer<Ui::CHotkeyDialog> ui;
BlackMisc::Input::CActionHotkey m_actionHotkey; BlackMisc::Input::CActionHotkey m_actionHotkey;
BlackGui::Models::CActionModel m_actionModel; BlackGui::Models::CActionModel m_actionModel;
BlackCore::CInputManager *m_inputManager; BlackCore::CInputManager *m_inputManager = nullptr;
}; };
} // ns } // ns
} // ns } // ns

View File

@@ -7,13 +7,13 @@
* contained in the LICENSE file. * contained in the LICENSE file.
*/ */
#include "blackcore/context/contextapplication.h" #include "blackgui/components/configurationwizard.h"
#include "blackgui/components/hotkeydialog.h"
#include "blackgui/components/settingshotkeycomponent.h" #include "blackgui/components/settingshotkeycomponent.h"
#include "blackgui/components/hotkeydialog.h"
#include "blackgui/guiapplication.h" #include "blackgui/guiapplication.h"
#include "blackmisc/identifier.h" #include "blackcore/context/contextapplication.h"
#include "blackmisc/identifierlist.h" #include "blackcore/context/contextaudio.h"
#include "blackmisc/input/hotkeycombination.h" #include "blackcore/inputmanager.h"
#include "ui_settingshotkeycomponent.h" #include "ui_settingshotkeycomponent.h"
#include <QAbstractItemModel> #include <QAbstractItemModel>
@@ -53,8 +53,7 @@ namespace BlackGui
} }
CSettingsHotkeyComponent::~CSettingsHotkeyComponent() CSettingsHotkeyComponent::~CSettingsHotkeyComponent()
{ { }
}
void CSettingsHotkeyComponent::ps_addEntry() void CSettingsHotkeyComponent::ps_addEntry()
{ {
@@ -80,13 +79,15 @@ namespace BlackGui
const auto model = ui->tv_Hotkeys->model(); const auto model = ui->tv_Hotkeys->model();
const QModelIndex indexHotkey = model->index(index.row(), 0, QModelIndex()); const QModelIndex indexHotkey = model->index(index.row(), 0, QModelIndex());
Q_ASSERT(indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).canConvert<CActionHotkey>()); Q_ASSERT_X(indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).canConvert<CActionHotkey>(), Q_FUNC_INFO, "No action hotkey");
CActionHotkey actionHotkey = indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).value<CActionHotkey>(); CActionHotkey actionHotkey = indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).value<CActionHotkey>();
BlackMisc::CIdentifierList registeredApps; BlackMisc::CIdentifierList registeredApps;
Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui");
if (sGui->getIContextApplication()) registeredApps = sGui->getIContextApplication()->getRegisteredApplications(); if (sGui->getIContextApplication()) registeredApps = sGui->getIContextApplication()->getRegisteredApplications();
// add local application // add local application
registeredApps.push_back(CIdentifier()); registeredApps.push_back(CIdentifier());
auto selectedActionHotkey = CHotkeyDialog::getActionHotkey(actionHotkey, registeredApps, this); const auto selectedActionHotkey = CHotkeyDialog::getActionHotkey(actionHotkey, registeredApps, this);
if (selectedActionHotkey.isValid() && checkAndConfirmConflicts(selectedActionHotkey, { actionHotkey })) if (selectedActionHotkey.isValid() && checkAndConfirmConflicts(selectedActionHotkey, { actionHotkey }))
{ {
updateHotkeyInSettings(actionHotkey, selectedActionHotkey); updateHotkeyInSettings(actionHotkey, selectedActionHotkey);
@@ -156,7 +157,7 @@ namespace BlackGui
m_model.clear(); m_model.clear();
for (const auto &hotkey : hotkeys) for (const auto &hotkey : hotkeys)
{ {
int position = m_model.rowCount(); const int position = m_model.rowCount();
m_model.insertRows(position, 1, QModelIndex()); m_model.insertRows(position, 1, QModelIndex());
QModelIndex index = m_model.index(position, 0, QModelIndex()); QModelIndex index = m_model.index(position, 0, QModelIndex());
m_model.setData(index, QVariant::fromValue(hotkey), CActionHotkeyListModel::ActionHotkeyRole); m_model.setData(index, QVariant::fromValue(hotkey), CActionHotkeyListModel::ActionHotkeyRole);

View File

@@ -127,5 +127,5 @@ namespace BlackGui
} }
} }
} }
} } // ns
} } // ns

View File

@@ -29,6 +29,7 @@ namespace BlackGui
/*! /*!
* Action tree model, used with hotkey actions * Action tree model, used with hotkey actions
* \remark data from CInputManager::instance()
*/ */
class BLACKGUI_EXPORT CActionModel : public QAbstractItemModel class BLACKGUI_EXPORT CActionModel : public QAbstractItemModel
{ {

View File

@@ -24,7 +24,7 @@ namespace BlackMisc
{ {
namespace FsCommon namespace FsCommon
{ {
//! FS9/X utils //! FS9/X/P3D utils
class BLACKMISC_EXPORT CFsCommonUtil class BLACKMISC_EXPORT CFsCommonUtil
{ {
public: public:

View File

@@ -413,7 +413,7 @@ namespace BlackSimPlugin
bool CSimulatorXPlane::isPhysicallyRenderedAircraft(const CCallsign &callsign) const bool CSimulatorXPlane::isPhysicallyRenderedAircraft(const CCallsign &callsign) const
{ {
//! \todo XP implement isRenderedAircraft correctly. This work around, but not really telling me if callsign is really(!) visible in SIM //! \todo XP implement isRenderedAircraft correctly. This is a workaround, but not telling me if a callsign is really(!) visible in simulator
return getAircraftInRangeForCallsign(callsign).isRendered(); return getAircraftInRangeForCallsign(callsign).isRendered();
} }