From 422e6626c817b3666385f9e03bafdb0cba8daeaf Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sat, 18 Mar 2017 20:40:05 +0100 Subject: [PATCH] refs #912, formatting, typos, const --- src/blackcore/actionbind.h | 2 +- src/blackcore/context/contextaudio.h | 1 - src/blackcore/context/contextaudioimpl.h | 7 ++++--- src/blackgui/components/hotkeydialog.cpp | 5 ++--- src/blackgui/components/hotkeydialog.h | 10 +++++---- .../components/settingshotkeycomponent.cpp | 21 ++++++++++--------- src/blackgui/models/actionmodel.cpp | 4 ++-- src/blackgui/models/actionmodel.h | 1 + .../simulation/fscommon/fscommonutil.h | 2 +- .../simulator/xplane/simulatorxplane.cpp | 2 +- 10 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/blackcore/actionbind.h b/src/blackcore/actionbind.h index c8010cb74..cc851ce9b 100644 --- a/src/blackcore/actionbind.h +++ b/src/blackcore/actionbind.h @@ -61,7 +61,7 @@ namespace BlackCore //! Register action 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 m_deleteCallback; //!< called when deleted }; diff --git a/src/blackcore/context/contextaudio.h b/src/blackcore/context/contextaudio.h index e1837607f..2276d8965 100644 --- a/src/blackcore/context/contextaudio.h +++ b/src/blackcore/context/contextaudio.h @@ -88,7 +88,6 @@ namespace BlackCore virtual ~IContextAudio() {} signals: - //! Voice rooms changed //! \details the flag indicates, whether a room got connected or disconnected void changedVoiceRooms(const BlackMisc::Audio::CVoiceRoomList &voiceRooms, bool connected); diff --git a/src/blackcore/context/contextaudioimpl.h b/src/blackcore/context/contextaudioimpl.h index ac6e49dc9..03ff02502 100644 --- a/src/blackcore/context/contextaudioimpl.h +++ b/src/blackcore/context/contextaudioimpl.h @@ -114,7 +114,6 @@ namespace BlackCore CContextAudio *registerWithDBus(BlackMisc::CDBusServer *server); private slots: - //! \copydoc IVoice::connectionStatusChanged //! \sa IContextAudio::changedVoiceRooms void ps_connectionStatusChanged(IVoiceChannel::ConnectionStatus oldStatus, IVoiceChannel::ConnectionStatus newStatus); @@ -122,6 +121,7 @@ namespace BlackCore //! Init notification sounds void ps_initNotificationSounds(); + //! Enable/disable voice transmission void ps_setVoiceTransmission(bool enable); //! User joined the room @@ -137,10 +137,11 @@ namespace BlackCore //! Voice channel by room QSharedPointer getVoiceChannelBy(const BlackMisc::Audio::CVoiceRoom &voiceRoom); - const int MinUnmuteVolume = 20; //!< minimum volume when unmuted - CActionBind m_actionPtt { "/Voice/Activate push-to-talk", BlackMisc::CIcons::radio16(), this, &CContextAudio::ps_setVoiceTransmission }; + CActionBind m_actionPtt { pttHotkeyIdentifier(), pttHotkeyIcon(), this, &CContextAudio::ps_setVoiceTransmission }; + std::unique_ptr m_voice; //!< underlying voice lib std::unique_ptr m_audioMixer; + const int MinUnmuteVolume = 20; //!< minimum volume when unmuted int m_outVolumeBeforeMute = 90; // For easy access. diff --git a/src/blackgui/components/hotkeydialog.cpp b/src/blackgui/components/hotkeydialog.cpp index d1c28feb3..80dbab6db 100644 --- a/src/blackgui/components/hotkeydialog.cpp +++ b/src/blackgui/components/hotkeydialog.cpp @@ -14,7 +14,6 @@ #include "blackmisc/icons.h" #include "blackmisc/identifier.h" #include "blackmisc/input/hotkeycombination.h" -#include "blackmisc/input/keyboardkey.h" #include "blackmisc/input/keyboardkeylist.h" #include "blackmisc/logmessage.h" #include "blackmisc/statusmessage.h" @@ -80,8 +79,8 @@ namespace BlackGui if (!actionHotkey.getCombination().isEmpty()) { ui->pb_SelectedHotkey->setText(actionHotkey.getCombination().toQString()); } - CIdentifierList machinesUnique = applications.getMachinesUnique(); int index = -1; + const CIdentifierList machinesUnique = applications.getMachinesUnique(); for (const auto &app : machinesUnique) { ui->cb_Identifier->addItem(app.getMachineName(), QVariant::fromValue(app)); @@ -240,7 +239,7 @@ namespace BlackGui } ksb->setSelectedIndex(currentIndex); 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); connect(ksb, &CKeySelectionBox::keySelectionChanged, this, &CHotkeyDialog::advancedKeyChanged); } diff --git a/src/blackgui/components/hotkeydialog.h b/src/blackgui/components/hotkeydialog.h index 60762b9fe..117fd544d 100644 --- a/src/blackgui/components/hotkeydialog.h +++ b/src/blackgui/components/hotkeydialog.h @@ -79,8 +79,10 @@ namespace BlackGui void initStyleSheet(); //! Runs the hotkey dialog and returns the result - static BlackMisc::Input::CActionHotkey getActionHotkey(const BlackMisc::Input::CActionHotkey &initial, const BlackMisc::CIdentifierList &applications, - QWidget *parent = nullptr); + static BlackMisc::Input::CActionHotkey getActionHotkey( + const BlackMisc::Input::CActionHotkey &initial, + const BlackMisc::CIdentifierList &applications, + QWidget *parent = nullptr); private: void ps_advancedModeChanged(); @@ -88,9 +90,9 @@ namespace BlackGui void ps_combinationSelectionChanged(const BlackMisc::Input::CHotkeyCombination &combination); void ps_combinationSelectionFinished(const BlackMisc::Input::CHotkeyCombination &combination); void ps_changeSelectedAction(const QItemSelection &selected, const QItemSelection &deselected); - void changeApplicableMachine(int index); void ps_accept(); + void changeApplicableMachine(int index); void synchronize(); void synchronizeSimpleSelection(); void synchronizeAdvancedSelection(); @@ -102,7 +104,7 @@ namespace BlackGui QScopedPointer ui; BlackMisc::Input::CActionHotkey m_actionHotkey; BlackGui::Models::CActionModel m_actionModel; - BlackCore::CInputManager *m_inputManager; + BlackCore::CInputManager *m_inputManager = nullptr; }; } // ns } // ns diff --git a/src/blackgui/components/settingshotkeycomponent.cpp b/src/blackgui/components/settingshotkeycomponent.cpp index d959d676f..80c4f6674 100644 --- a/src/blackgui/components/settingshotkeycomponent.cpp +++ b/src/blackgui/components/settingshotkeycomponent.cpp @@ -7,13 +7,13 @@ * contained in the LICENSE file. */ -#include "blackcore/context/contextapplication.h" -#include "blackgui/components/hotkeydialog.h" +#include "blackgui/components/configurationwizard.h" #include "blackgui/components/settingshotkeycomponent.h" +#include "blackgui/components/hotkeydialog.h" #include "blackgui/guiapplication.h" -#include "blackmisc/identifier.h" -#include "blackmisc/identifierlist.h" -#include "blackmisc/input/hotkeycombination.h" +#include "blackcore/context/contextapplication.h" +#include "blackcore/context/contextaudio.h" +#include "blackcore/inputmanager.h" #include "ui_settingshotkeycomponent.h" #include @@ -53,8 +53,7 @@ namespace BlackGui } CSettingsHotkeyComponent::~CSettingsHotkeyComponent() - { - } + { } void CSettingsHotkeyComponent::ps_addEntry() { @@ -80,13 +79,15 @@ namespace BlackGui const auto model = ui->tv_Hotkeys->model(); const QModelIndex indexHotkey = model->index(index.row(), 0, QModelIndex()); - Q_ASSERT(indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).canConvert()); + Q_ASSERT_X(indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).canConvert(), Q_FUNC_INFO, "No action hotkey"); CActionHotkey actionHotkey = indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).value(); BlackMisc::CIdentifierList registeredApps; + Q_ASSERT_X(sGui, Q_FUNC_INFO, "Missing sGui"); if (sGui->getIContextApplication()) registeredApps = sGui->getIContextApplication()->getRegisteredApplications(); + // add local application 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 })) { updateHotkeyInSettings(actionHotkey, selectedActionHotkey); @@ -156,7 +157,7 @@ namespace BlackGui m_model.clear(); for (const auto &hotkey : hotkeys) { - int position = m_model.rowCount(); + const int position = m_model.rowCount(); m_model.insertRows(position, 1, QModelIndex()); QModelIndex index = m_model.index(position, 0, QModelIndex()); m_model.setData(index, QVariant::fromValue(hotkey), CActionHotkeyListModel::ActionHotkeyRole); diff --git a/src/blackgui/models/actionmodel.cpp b/src/blackgui/models/actionmodel.cpp index 6c0a49c7c..2daaf37fa 100644 --- a/src/blackgui/models/actionmodel.cpp +++ b/src/blackgui/models/actionmodel.cpp @@ -127,5 +127,5 @@ namespace BlackGui } } } - } -} + } // ns +} // ns diff --git a/src/blackgui/models/actionmodel.h b/src/blackgui/models/actionmodel.h index 0a4a7fb15..58cb49c7b 100644 --- a/src/blackgui/models/actionmodel.h +++ b/src/blackgui/models/actionmodel.h @@ -29,6 +29,7 @@ namespace BlackGui /*! * Action tree model, used with hotkey actions + * \remark data from CInputManager::instance() */ class BLACKGUI_EXPORT CActionModel : public QAbstractItemModel { diff --git a/src/blackmisc/simulation/fscommon/fscommonutil.h b/src/blackmisc/simulation/fscommon/fscommonutil.h index 858be1497..bbb57199f 100644 --- a/src/blackmisc/simulation/fscommon/fscommonutil.h +++ b/src/blackmisc/simulation/fscommon/fscommonutil.h @@ -24,7 +24,7 @@ namespace BlackMisc { namespace FsCommon { - //! FS9/X utils + //! FS9/X/P3D utils class BLACKMISC_EXPORT CFsCommonUtil { public: diff --git a/src/plugins/simulator/xplane/simulatorxplane.cpp b/src/plugins/simulator/xplane/simulatorxplane.cpp index 75a2f2dfb..d252f84f4 100644 --- a/src/plugins/simulator/xplane/simulatorxplane.cpp +++ b/src/plugins/simulator/xplane/simulatorxplane.cpp @@ -413,7 +413,7 @@ namespace BlackSimPlugin 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(); }