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
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
};

View File

@@ -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);

View File

@@ -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<IVoiceChannel> 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<IVoice> m_voice; //!< underlying voice lib
std::unique_ptr<IAudioMixer> m_audioMixer;
const int MinUnmuteVolume = 20; //!< minimum volume when unmuted
int m_outVolumeBeforeMute = 90;
// For easy access.

View File

@@ -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);
}

View File

@@ -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::CHotkeyDialog> ui;
BlackMisc::Input::CActionHotkey m_actionHotkey;
BlackGui::Models::CActionModel m_actionModel;
BlackCore::CInputManager *m_inputManager;
BlackCore::CInputManager *m_inputManager = nullptr;
};
} // ns
} // ns

View File

@@ -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 <QAbstractItemModel>
@@ -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<CActionHotkey>());
Q_ASSERT_X(indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).canConvert<CActionHotkey>(), Q_FUNC_INFO, "No action hotkey");
CActionHotkey actionHotkey = indexHotkey.data(CActionHotkeyListModel::ActionHotkeyRole).value<CActionHotkey>();
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);

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
* \remark data from CInputManager::instance()
*/
class BLACKGUI_EXPORT CActionModel : public QAbstractItemModel
{

View File

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

View File

@@ -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();
}