From e695987fa28de42d0a4e23fac9415ecabab505c0 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 27 May 2015 03:55:26 +0200 Subject: [PATCH] refs #432 Doxygen, formatting, added new file types in *.pro Minor tweaks: * GUI infobar minimum size * toogle lock protected * removed unused function * ASSERT_X * object name --- src/blackcore/airspace_monitor.cpp | 3 +++ src/blackcore/context_application.cpp | 3 --- src/blackcore/context_runtime.cpp | 8 ------- src/blackcore/context_runtime.h | 3 --- src/blackcore/simulator_common.cpp | 2 +- src/blackgui/blackgui.pro | 2 +- .../components/audiosetupcomponent.cpp | 5 ++--- src/blackgui/components/cockpitcomponent.h | 1 - .../components/cockpitinfoareacomponent.cpp | 1 + .../components/enablefordockwidgetinfoarea.h | 1 - src/blackgui/components/enableforruntime.h | 13 ++++------- .../components/infobarstatuscomponent.ui | 8 ++++++- src/blackgui/dockwidgetinfoarea.cpp | 8 +++---- src/blackgui/dockwidgetinfoarea.h | 14 ++++++------ src/blackgui/infoarea.h | 6 ++--- src/blackgui/models/airportlistmodel.cpp | 7 ++---- src/blackgui/models/airportlistmodel.h | 4 +--- src/blackgui/models/listmodelbase.h | 22 +++++++------------ src/blackgui/models/serverlistmodel.cpp | 18 ++++++--------- src/blackgui/models/serverlistmodel.h | 5 ++--- .../models/simulatedaircraftlistmodel.cpp | 3 --- src/blackgui/models/textmessagelistmodel.cpp | 3 --- src/blackgui/models/textmessagelistmodel.h | 6 ++--- src/blackinput/win/joystick_windows.cpp | 18 +++++++++------ 24 files changed, 67 insertions(+), 97 deletions(-) diff --git a/src/blackcore/airspace_monitor.cpp b/src/blackcore/airspace_monitor.cpp index 25815f2e9..98a7694df 100644 --- a/src/blackcore/airspace_monitor.cpp +++ b/src/blackcore/airspace_monitor.cpp @@ -174,6 +174,7 @@ namespace BlackCore bool CAirspaceMonitor::updateFastPositionEnabled(const CCallsign &callsign, bool enableFastPositonUpdates, const BlackMisc::COriginator &originator) { + //! \fixme CAirspaceMonitor: If in the long term originator is not used, remove from signature Q_UNUSED(originator); CPropertyIndexVariantMap vm(CSimulatedAircraft::IndexFastPositionUpdates, CVariant::fromValue(enableFastPositonUpdates)); QWriteLocker l(&m_lockAircraft); @@ -183,6 +184,7 @@ namespace BlackCore bool CAirspaceMonitor::updateAircraftRendered(const CCallsign &callsign, bool rendered, const BlackMisc::COriginator &originator) { + //! \fixme CAirspaceMonitor: If in the long term originator is not used, remove from signature Q_UNUSED(originator); CPropertyIndexVariantMap vm(CSimulatedAircraft::IndexRendered, CVariant::fromValue(rendered)); QWriteLocker l(&m_lockAircraft); @@ -192,6 +194,7 @@ namespace BlackCore void CAirspaceMonitor::updateMarkAllAsNotRendered(const BlackMisc::COriginator &originator) { + //! \fixme CAirspaceMonitor: If in the long term originator is not used, remove from signature Q_UNUSED(originator); QWriteLocker l(&m_lockAircraft); m_aircraftInRange.markAllAsNotRendered(); diff --git a/src/blackcore/context_application.cpp b/src/blackcore/context_application.cpp index a11d7891b..8c6b69a08 100644 --- a/src/blackcore/context_application.cpp +++ b/src/blackcore/context_application.cpp @@ -38,9 +38,6 @@ namespace BlackCore } } - /* - * Constructor - */ IContextApplication::IContextApplication(CRuntimeConfig::ContextMode mode, CRuntime *runtime) : CContext(mode, runtime) { diff --git a/src/blackcore/context_runtime.cpp b/src/blackcore/context_runtime.cpp index 23dbb6896..2612d2470 100644 --- a/src/blackcore/context_runtime.cpp +++ b/src/blackcore/context_runtime.cpp @@ -113,14 +113,6 @@ namespace BlackCore return !this->m_contextApplication->isUsingImplementingObject(); } - bool CRuntime::canPingApplicationContext() const - { - Q_ASSERT(this->m_contextApplication); - if (this->m_contextApplication->isUsingImplementingObject()) return true; - qint64 token = QDateTime::currentMSecsSinceEpoch(); - return (token == this->m_contextApplication->ping(token)); - } - void CRuntime::registerMetadata() { BlackMisc::registerMetadata(); diff --git a/src/blackcore/context_runtime.h b/src/blackcore/context_runtime.h index 65dca860a..495d215a1 100644 --- a/src/blackcore/context_runtime.h +++ b/src/blackcore/context_runtime.h @@ -148,9 +148,6 @@ namespace BlackCore //! Remote application context, indicates distributed environment bool hasRemoteApplicationContext() const; - //! Is application context available? - bool canPingApplicationContext() const; - //! Register metadata static void registerMetadata(); diff --git a/src/blackcore/simulator_common.cpp b/src/blackcore/simulator_common.cpp index a6612eaba..74cba880f 100644 --- a/src/blackcore/simulator_common.cpp +++ b/src/blackcore/simulator_common.cpp @@ -32,7 +32,7 @@ namespace BlackCore CPluginStorageAware(pluginStorageProvider), m_simulatorPluginInfo(info) { - this->setObjectName(info.getIdentifier()); + this->setObjectName("Simulator:" + info.getIdentifier()); // provider signals m_remoteAircraftProviderConnections = this->m_remoteAircraftProvider->connectRemoteAircraftProviderSignals( diff --git a/src/blackgui/blackgui.pro b/src/blackgui/blackgui.pro index 1c254f824..83228ddc8 100644 --- a/src/blackgui/blackgui.pro +++ b/src/blackgui/blackgui.pro @@ -46,7 +46,7 @@ RESOURCES += DESTDIR = $$BuildRoot/lib DLLDESTDIR = $$BuildRoot/bin -OTHER_FILES += ./qss/*.qss ./qss/*.css ./qss/*.ini +OTHER_FILES += ./qss/*.qss ./qss/*.css ./qss/*.ini *.ico *.rc win32:isEmpty(MINGW_IN_SHELL): COPY = xcopy /yi else: COPY = cp -r diff --git a/src/blackgui/components/audiosetupcomponent.cpp b/src/blackgui/components/audiosetupcomponent.cpp index 69e43d274..7de929951 100644 --- a/src/blackgui/components/audiosetupcomponent.cpp +++ b/src/blackgui/components/audiosetupcomponent.cpp @@ -28,7 +28,6 @@ namespace BlackGui { CAudioSetupComponent::CAudioSetupComponent(QWidget *parent) : QFrame(parent), - CEnableForRuntime(nullptr, false), ui(new Ui::CAudioSetupComponent) { ui->setupUi(this); @@ -45,11 +44,11 @@ namespace BlackGui void CAudioSetupComponent::runtimeHasBeenSet() { - if (!this->getIContextSettings()) qFatal("Settings missing"); + Q_ASSERT_X(this->getIContextSettings(), Q_FUNC_INFO, "missing settings"); this->connect(this->getIContextSettings(), &IContextSettings::changedSettings, this, &CAudioSetupComponent::ps_changedSettings); // based on audio context - Q_ASSERT(this->getIContextAudio()); + Q_ASSERT_X(this->getIContextAudio(), Q_FUNC_INFO, "missing audio"); if (this->getIContextAudio()) { this->initAudioDeviceLists(); diff --git a/src/blackgui/components/cockpitcomponent.h b/src/blackgui/components/cockpitcomponent.h index c0dd132ee..23902ee67 100644 --- a/src/blackgui/components/cockpitcomponent.h +++ b/src/blackgui/components/cockpitcomponent.h @@ -53,7 +53,6 @@ namespace BlackGui void ps_onToggleFloating(bool floating); private: - // toggle area on show/hide details void toggleShowHideDetails(bool show, bool considerCurrentSize); diff --git a/src/blackgui/components/cockpitinfoareacomponent.cpp b/src/blackgui/components/cockpitinfoareacomponent.cpp index 36d5a5c44..29f61fea4 100644 --- a/src/blackgui/components/cockpitinfoareacomponent.cpp +++ b/src/blackgui/components/cockpitinfoareacomponent.cpp @@ -25,6 +25,7 @@ namespace BlackGui ui->setupUi(this); this->initInfoArea(); this->ps_setTabBarPosition(QTabWidget::North); + this->ps_toggleTabBarLocked(true); } CCockpitInfoAreaComponent::~CCockpitInfoAreaComponent() diff --git a/src/blackgui/components/enablefordockwidgetinfoarea.h b/src/blackgui/components/enablefordockwidgetinfoarea.h index e376687af..d7270f094 100644 --- a/src/blackgui/components/enablefordockwidgetinfoarea.h +++ b/src/blackgui/components/enablefordockwidgetinfoarea.h @@ -66,7 +66,6 @@ namespace BlackGui private: BlackGui::CDockWidgetInfoArea *m_parentDockableInfoArea = nullptr; //!< my parent dockable widget - }; } } // namespace diff --git a/src/blackgui/components/enableforruntime.h b/src/blackgui/components/enableforruntime.h index fa4ee4a2a..446a3f4a7 100644 --- a/src/blackgui/components/enableforruntime.h +++ b/src/blackgui/components/enableforruntime.h @@ -34,12 +34,10 @@ namespace BlackGui namespace Components { - /*! - * \brief Component, which provides references to runtime objects - * \details Access to runtime allows to encapsualate many aspects of data access and makes - * the component widely independent from a central data provideer - * \sa BlackCore::CRuntime - */ + //! Component, which provides references to runtime objects + //! \details Access to runtime allows to encapsualate many aspects of data access and makes + //! the component widely independent from a central data provideer + //! \sa BlackCore::CRuntime class BLACKGUI_EXPORT CEnableForRuntime { public: @@ -119,9 +117,6 @@ namespace BlackGui //! \copydoc CRuntime::hasRemoteApplicationContext bool hasRemoteApplicationContext() const { return this->m_runtime->hasRemoteApplicationContext(); } - //! \copydoc CRuntime::canPingApplicationContext - bool canPingApplicationContext() const { return this->m_runtime->canPingApplicationContext(); } - //! Play a given notification sound void playNotifcationSound(BlackSound::CNotificationSounds::Notification notification) const; diff --git a/src/blackgui/components/infobarstatuscomponent.ui b/src/blackgui/components/infobarstatuscomponent.ui index cdd68c3ed..208f23587 100644 --- a/src/blackgui/components/infobarstatuscomponent.ui +++ b/src/blackgui/components/infobarstatuscomponent.ui @@ -6,10 +6,16 @@ 0 0 - 415 + 184 20 + + + 0 + 20 + + Info status bar diff --git a/src/blackgui/dockwidgetinfoarea.cpp b/src/blackgui/dockwidgetinfoarea.cpp index 64befc8e0..cc1bc851f 100644 --- a/src/blackgui/dockwidgetinfoarea.cpp +++ b/src/blackgui/dockwidgetinfoarea.cpp @@ -7,9 +7,9 @@ * contained in the LICENSE file. */ -#include "dockwidgetinfoarea.h" -#include "infoarea.h" -#include "components/maininfoareacomponent.h" +#include "blackgui/dockwidgetinfoarea.h" +#include "blackgui/infoarea.h" +#include "components/enablefordockwidgetinfoarea.h" #include "blackmisc/icons.h" using namespace BlackGui::Components; @@ -96,7 +96,7 @@ namespace BlackGui QList infoAreaDockWidgets = this->findEmbeddedDockWidgetInfoAreaComponents(); foreach(CEnableForDockWidgetInfoArea * dwia, infoAreaDockWidgets) { - Q_ASSERT(dwia); + Q_ASSERT_X(dwia, Q_FUNC_INFO, "Missing info area"); // KWB: potentially a risk when this object is deleted // but under normal situations the child object will be deleted as well, and we have diff --git a/src/blackgui/dockwidgetinfoarea.h b/src/blackgui/dockwidgetinfoarea.h index 6693d8bc1..7ec5ab51d 100644 --- a/src/blackgui/dockwidgetinfoarea.h +++ b/src/blackgui/dockwidgetinfoarea.h @@ -1,11 +1,11 @@ /* Copyright (C) 2014 - * 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 and at http://www.swift-project.org/license.html. 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. - */ +* 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 and at http://www.swift-project.org/license.html. 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 diff --git a/src/blackgui/infoarea.h b/src/blackgui/infoarea.h index 02e90c1e9..2f5c5206c 100644 --- a/src/blackgui/infoarea.h +++ b/src/blackgui/infoarea.h @@ -144,6 +144,9 @@ namespace BlackGui //! \remarks North or South working, East / West not void ps_setTabBarPosition(QTabWidget::TabPosition position); + //! Toogle lock tabbar + void ps_toggleTabBarLocked(bool locked); + private: QList m_dockWidgetInfoAreas ; QTabBar *m_tabBar = nullptr; @@ -226,9 +229,6 @@ namespace BlackGui //! Show tab bar void ps_showTabBar(bool show); - //! Toogle lock tabbar - void ps_toggleTabBarLocked(bool locked); - //! Toggle tab position North - South void ps_toggleTabBarPosition(); diff --git a/src/blackgui/models/airportlistmodel.cpp b/src/blackgui/models/airportlistmodel.cpp index 5111531ad..08583cc94 100644 --- a/src/blackgui/models/airportlistmodel.cpp +++ b/src/blackgui/models/airportlistmodel.cpp @@ -20,9 +20,6 @@ namespace BlackGui { namespace Models { - /* - * Constructor - */ CAirportListModel::CAirportListModel(QObject *parent) : CListModelBase("ViewAirportList", parent) { @@ -45,5 +42,5 @@ namespace BlackGui (void)QT_TRANSLATE_NOOP("ViewAirportList", "elevation"); (void)QT_TRANSLATE_NOOP("ViewAirportList", "bearing"); } - } -} + } // ns +} // ns diff --git a/src/blackgui/models/airportlistmodel.h b/src/blackgui/models/airportlistmodel.h index ca17e038f..a157fbc1e 100644 --- a/src/blackgui/models/airportlistmodel.h +++ b/src/blackgui/models/airportlistmodel.h @@ -22,9 +22,7 @@ namespace BlackGui namespace Models { - /*! - * Airport list model - */ + //! Airport list model class BLACKGUI_EXPORT CAirportListModel : public CListModelBase { diff --git a/src/blackgui/models/listmodelbase.h b/src/blackgui/models/listmodelbase.h index 089048ff4..9c77108c8 100644 --- a/src/blackgui/models/listmodelbase.h +++ b/src/blackgui/models/listmodelbase.h @@ -62,10 +62,8 @@ namespace BlackGui //! Set sort column virtual void setSortColumn(int column) { this->m_sortedColumn = column; } - /*! - * Set column for sorting - * \param propertyIndex index of column to be sorted - */ + //! Set column for sorting + //! \param propertyIndex index of column to be sorted virtual void setSortColumnByPropertyIndex(const BlackMisc::CPropertyIndex &propertyIndex); //! Get sort column property index @@ -100,11 +98,9 @@ namespace BlackGui int ps_updateContainer(const BlackMisc::CVariant &variant, bool sort); protected: - /*! - * Constructor - * \param translationContext I18N context - * \param parent - */ + //! Constructor + //! \param translationContext I18N context + //! \param parent CListModelBaseNonTemplate(const QString &translationContext, QObject *parent = nullptr) : QAbstractItemModel(parent), m_columns(translationContext), m_sortedColumn(-1), m_sortOrder(Qt::AscendingOrder) { @@ -217,11 +213,9 @@ namespace BlackGui protected: std::unique_ptr > m_filter; //!< Used filter - /*! - * Constructor - * \param translationContext I18N context - * \param parent - */ + //! Constructor + //! \param translationContext I18N context + //! \param parent CListModelBase(const QString &translationContext, QObject *parent = nullptr) : CListModelBaseNonTemplate(translationContext, parent) { } diff --git a/src/blackgui/models/serverlistmodel.cpp b/src/blackgui/models/serverlistmodel.cpp index 18ead6947..f9680c114 100644 --- a/src/blackgui/models/serverlistmodel.cpp +++ b/src/blackgui/models/serverlistmodel.cpp @@ -14,12 +14,8 @@ namespace BlackGui { namespace Models { - - /* - * Constructor - */ CServerListModel::CServerListModel(QObject *parent) : - CListModelBase("ViewServerList", parent) + CListModelBase("ModelServerList", parent) { this->m_columns.addColumn(CColumn::standardString("name", CServer::IndexName)); this->m_columns.addColumn(CColumn::standardString("description", CServer::IndexDescription)); @@ -29,12 +25,12 @@ namespace BlackGui this->m_columns.addColumn(CColumn::standardString("userid", { CServer::IndexUser, CUser::IndexId})); // force strings for translation in resource files - (void)QT_TRANSLATE_NOOP("ViewServerList", "name"); - (void)QT_TRANSLATE_NOOP("ViewServerList", "description"); - (void)QT_TRANSLATE_NOOP("ViewServerList", "address"); - (void)QT_TRANSLATE_NOOP("ViewServerList", "port"); - (void)QT_TRANSLATE_NOOP("ViewServerList", "realname"); - (void)QT_TRANSLATE_NOOP("ViewServerList", "userid"); + (void)QT_TRANSLATE_NOOP("ModelServerList", "name"); + (void)QT_TRANSLATE_NOOP("ModelServerList", "description"); + (void)QT_TRANSLATE_NOOP("ModelServerList", "address"); + (void)QT_TRANSLATE_NOOP("ModelServerList", "port"); + (void)QT_TRANSLATE_NOOP("ModelServerList", "realname"); + (void)QT_TRANSLATE_NOOP("ModelServerList", "userid"); } } // class diff --git a/src/blackgui/models/serverlistmodel.h b/src/blackgui/models/serverlistmodel.h index 3cb74554b..fdb042cec 100644 --- a/src/blackgui/models/serverlistmodel.h +++ b/src/blackgui/models/serverlistmodel.h @@ -24,7 +24,6 @@ namespace BlackGui //! Server list model class BLACKGUI_EXPORT CServerListModel : public CListModelBase { - public: //! Constructor @@ -33,6 +32,6 @@ namespace BlackGui //! Destructor virtual ~CServerListModel() {} }; - } -} + } // ns +} // ns #endif // guard diff --git a/src/blackgui/models/simulatedaircraftlistmodel.cpp b/src/blackgui/models/simulatedaircraftlistmodel.cpp index 73913c61f..2ac0564c0 100644 --- a/src/blackgui/models/simulatedaircraftlistmodel.cpp +++ b/src/blackgui/models/simulatedaircraftlistmodel.cpp @@ -21,9 +21,6 @@ namespace BlackGui { namespace Models { - /* - * Constructor - */ CSimulatedAircraftListModel::CSimulatedAircraftListModel(QObject *parent) : CListModelBase("ModelSimulatedAircraftList", parent) { this->setAircraftMode(InfoMode); diff --git a/src/blackgui/models/textmessagelistmodel.cpp b/src/blackgui/models/textmessagelistmodel.cpp index c2269def2..64d7f4189 100644 --- a/src/blackgui/models/textmessagelistmodel.cpp +++ b/src/blackgui/models/textmessagelistmodel.cpp @@ -18,9 +18,6 @@ namespace BlackGui { namespace Models { - /* - * Constructor - */ CTextMessageListModel::CTextMessageListModel(TextMessageMode mode, QObject *parent) : CListModelBase("ModelTextMessageList", parent), m_textMessageMode(NotSet) { diff --git a/src/blackgui/models/textmessagelistmodel.h b/src/blackgui/models/textmessagelistmodel.h index bee42abc8..b5de60242 100644 --- a/src/blackgui/models/textmessagelistmodel.h +++ b/src/blackgui/models/textmessagelistmodel.h @@ -23,7 +23,7 @@ namespace BlackGui { namespace Models { - //! ATC list model + //! Text message list model class BLACKGUI_EXPORT CTextMessageListModel : public CListModelBase { @@ -51,6 +51,6 @@ namespace BlackGui private: TextMessageMode m_textMessageMode = NotSet; }; - } -} + } // ns +} // ns #endif // guard diff --git a/src/blackinput/win/joystick_windows.cpp b/src/blackinput/win/joystick_windows.cpp index e1e4d0597..f662ec545 100644 --- a/src/blackinput/win/joystick_windows.cpp +++ b/src/blackinput/win/joystick_windows.cpp @@ -8,6 +8,7 @@ */ #include "joystick_windows.h" +#include "blackmisc/logmessage.h" #include // Qt5 defines UNICODE, hence we can expect an wchar_t strings. @@ -15,6 +16,7 @@ // using ascii functions of WINAPI. To fix it, introduce #ifdef UNICODE and add char // handling in the second branch. +using namespace BlackMisc; using namespace BlackMisc::Hardware; namespace BlackInput @@ -33,7 +35,7 @@ namespace BlackInput initDirectInput(); enumJoystickDevices(); - if (!m_availableJoystickDevices.isEmpty()) createJoystickDevice(); + if (!m_availableJoystickDevices.isEmpty()) { createJoystickDevice(); } } CJoystickWindows::~CJoystickWindows() @@ -48,7 +50,7 @@ namespace BlackInput void CJoystickWindows::triggerButton(const CJoystickButton button, bool isPressed) { - if(!isPressed) emit buttonUp(button); + if (!isPressed) emit buttonUp(button); else emit buttonDown(button); } @@ -70,16 +72,15 @@ namespace BlackInput HINSTANCE instance = GetModuleHandle(nullptr); if (instance == nullptr) { - qWarning() << "GetModuleHandle() failed with error code" << GetLastError(); + CLogMessage(this).error("GetModuleHandle() failed with error code: %1") << GetLastError(); return E_FAIL; } if (FAILED(hr = m_directInput->Initialize(instance, DIRECTINPUT_VERSION))) { - // TODO Print an error + CLogMessage(this).error("Direct input init failed"); return hr; } - return hr; } @@ -88,11 +89,14 @@ namespace BlackInput HRESULT hr; if (FAILED(hr = m_directInput->EnumDevices(DI8DEVTYPE_JOYSTICK, enumJoysticksCallback, this, DIEDFL_ATTACHEDONLY))) { - // TODO print error message + CLogMessage(this).error("Error reading joystick devices"); return hr; } - if (m_availableJoystickDevices.isEmpty()) qWarning() << "No joystick device found!"; + if (m_availableJoystickDevices.isEmpty()) + { + CLogMessage(this).info("No joystick device found"); + } return hr; }