refs #199, code formatting and Doxygen, icons, comments, typos

This commit is contained in:
Klaus Basan
2014-04-08 14:08:17 +02:00
parent 16b9c714af
commit 7b7fbee4c3
6 changed files with 113 additions and 197 deletions

View File

@@ -26,7 +26,6 @@ DESTDIR = ../../bin
HEADERS += *.h HEADERS += *.h
SOURCES += *.cpp SOURCES += *.cpp
OTHER_FILES += readme.txt blackcore.rc blackcore.ico OTHER_FILES += readme.txt blackcore.rc blackcore.ico
RESOURCES += blackcore.qrc RESOURCES += blackcore.qrc
win32: RC_FILE = blackcore.rc win32: RC_FILE = blackcore.rc

View File

@@ -47,46 +47,30 @@ class MainWindow : public QMainWindow
Q_OBJECT Q_OBJECT
public: public:
/*! //! Constructor
* \brief Constructor
*/
explicit MainWindow(GuiModes::WindowMode windowMode, QWidget *parent = nullptr); explicit MainWindow(GuiModes::WindowMode windowMode, QWidget *parent = nullptr);
/*! //! Destructor
* Destructor
*/
~MainWindow(); ~MainWindow();
/*! //! Init data
* \brief Init data
*/
void init(GuiModes::CoreMode coreMode); void init(GuiModes::CoreMode coreMode);
/*! //! Graceful shutdown
* \brief Graceful shutdown
*/
void gracefulShutdown(); void gracefulShutdown();
protected: protected:
/*! //! Close event, e.g. when window is closed
* \brief Close event, e.g. when window is closed
*/
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
/*! //! Mouse moving, required for frameless window
* \brief Mouse moving, required for frameless window
*/
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event);
/*! //! Mouse press, required for frameless window
* \brief Mouse press, required for frameless window
*/
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event);
/*! //! Main page indexes
* \brief Main page indexes //! \remarks keep the values in sync with the real tab indexes
* \remarks keep the values in sync with the real tab indexes
*/
enum MainPageIndex enum MainPageIndex
{ {
MainPageStatus = 0, MainPageStatus = 0,
@@ -100,6 +84,7 @@ protected:
MainPageSimulator = 8 MainPageSimulator = 8
}; };
//! Audio test modes
enum AudioTest enum AudioTest
{ {
NoAudioTest, NoAudioTest,
@@ -165,9 +150,7 @@ private:
QLabel *m_statusBarIcon; /*!< status bar icon */ QLabel *m_statusBarIcon; /*!< status bar icon */
QLabel *m_statusBarLabel; /*!< status bar label */ QLabel *m_statusBarLabel; /*!< status bar label */
/*! //! GUI status update
* \brief GUI status update
*/
void updateGuiStatusInformation(); void updateGuiStatusInformation();
/*! /*!
@@ -176,42 +159,28 @@ private:
*/ */
void updateGuiSelectedServerTextboxes(const BlackMisc::Network::CServer &server); void updateGuiSelectedServerTextboxes(const BlackMisc::Network::CServer &server);
/*! //! Selected server from textboxes
* \brief Selected server from textboxes
*/
BlackMisc::Network::CServer selectedServerFromTextboxes() const; BlackMisc::Network::CServer selectedServerFromTextboxes() const;
/*! //! 1st data reads
* \brief 1st data reads
*/
void initialDataReads(); void initialDataReads();
/*! //! Init GUI signals
* \brief Init GUI signals
*/
void initGuiSignals(); void initGuiSignals();
/*! //! Context network availability check, otherwise status message
* \brief Context network availability check, otherwise status message
*/
bool isContextNetworkAvailableCheck(); bool isContextNetworkAvailableCheck();
/*! //! Context voice availability check, otherwise status message
* \brief Context voice availability check, otherwise status message
*/
bool isContextAudioAvailableCheck(); bool isContextAudioAvailableCheck();
/*! //! Own cockpit, update from context
* \brief Own cockpit, update from context
*/
void updateCockpitFromContext(); void updateCockpitFromContext();
/*! //! Pending cockpit update operation
* \brief Pending cockpit update operation
*/
bool isCockpitUpdatePending() const; bool isCockpitUpdatePending() const;
//! \brief Update the COM frequency displays //! Update the COM frequency displays
void updateComFrequencyDisplays(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2); void updateComFrequencyDisplays(const BlackMisc::Aviation::CComSystem &com1, const BlackMisc::Aviation::CComSystem &com2);
/*! /*!
@@ -221,11 +190,7 @@ private:
*/ */
QWidget *addNewTextMessageTab(const QString &tabName); QWidget *addNewTextMessageTab(const QString &tabName);
/*! //! Find text message tab by its name
* \brief Find text message tab by its name
* \param name
* \return
*/
QWidget *findTextMessageTabByName(const QString &name) const; QWidget *findTextMessageTabByName(const QString &name) const;
/*! /*!
@@ -241,14 +206,10 @@ private:
*/ */
BlackMisc::Network::CTextMessage getTextMessageStubForChannel(); BlackMisc::Network::CTextMessage getTextMessageStubForChannel();
/*! //! Audio device lists
* \brief Audio device lists
*/
void setAudioDeviceLists(); void setAudioDeviceLists();
/*! //! Context availability, used by watchdog
* \brief Context availability, used by watchdog
*/
void setContextAvailability(); void setContextAvailability();
/*! /*!
@@ -259,14 +220,10 @@ private:
*/ */
void setTestPosition(const QString &wgsLatitude, const QString &wgsLongitude, const BlackMisc::Aviation::CAltitude &altitude); void setTestPosition(const QString &wgsLatitude, const QString &wgsLongitude, const BlackMisc::Aviation::CAltitude &altitude);
/*! //! Display the overlay window
* \brief Display the overlay window
*/
void displayOverlayInfo(const QString &message = ""); void displayOverlayInfo(const QString &message = "");
/*! //! Overlay info displaying status message
* \brief Overlay info displaying status message
*/
void displayOverlayInfo(const BlackMisc::CStatusMessage &message); void displayOverlayInfo(const BlackMisc::CStatusMessage &message);
/*! /*!
@@ -276,21 +233,13 @@ private:
*/ */
bool isMainPageSelected(MainPageIndex mainPage) const; bool isMainPageSelected(MainPageIndex mainPage) const;
/*! //! For this text message's recepient, is the current tab selected?
* \brief For this text message's receipient, is the current tab selected?
* \param textMessage to be checked
* \return
*/
bool isCorrespondingTextMessageTabSelected(BlackMisc::Network::CTextMessage textMessage) const; bool isCorrespondingTextMessageTabSelected(BlackMisc::Network::CTextMessage textMessage) const;
/*! //! Init the context menus
* \brief Init the context menus
*/
void initContextMenus(); void initContextMenus();
/*! //! Start all update timers
* \brief Start all update timers
*/
void startUpdateTimers(); void startUpdateTimers();
/*! /*!
@@ -299,22 +248,16 @@ private:
*/ */
void stopUpdateTimers(bool disconnect = false); void stopUpdateTimers(bool disconnect = false);
/*! //! Currently selected SELCAL code
* \brief Currently selected SELCAL code
*/
QString getSelcalCode() const; QString getSelcalCode() const;
/*! //! Audio test updates (timer) for progressbar and fetching results
* \brief Audio test updates (timer) for progressbar and fetching results
*/
void audioTestUpdate(); void audioTestUpdate();
/*! //! Play notifcation sound
* \brief Play notifcation sound
*/
void playNotifcationSound(BlackSound::CSoundGenerator::Notification notification) const; void playNotifcationSound(BlackSound::CSoundGenerator::Notification notification) const;
//! \brief Update simulator page with latest user aircraft data //! Update simulator page with latest user aircraft data
void updateSimulatorData(); void updateSimulatorData();
private slots: private slots:
@@ -323,38 +266,30 @@ private slots:
// Data received related slots // Data received related slots
// //
/*! //! Reload booked stations
* \brief Reload booked stations
*/
void reloadAtcStationsBooked(); void reloadAtcStationsBooked();
/*! //! Reload online stations
* \brief Reload online stations
*/
void reloadAtcStationsOnline(); void reloadAtcStationsOnline();
/*! //! Reload aircrafts in range
* \brief Reload aircrafts in range
*/
void reloadAircraftsInRange(); void reloadAircraftsInRange();
/*! //! Reload all (online) users
* \brief Reload all (online) users
*/
void reloadAllUsers(); void reloadAllUsers();
/*! //! Reload own aircraft
* \brief Reload own aircraft
* \return
*/
bool reloadOwnAircraft(); bool reloadOwnAircraft();
//! \brief Display status message //! Display status message
void displayStatusMessage(const BlackMisc::CStatusMessage &statusMessage); void displayStatusMessage(const BlackMisc::CStatusMessage &statusMessage);
//! \brief Display status messages //! Display status messages
void displayStatusMessages(const BlackMisc::CStatusMessageList &messages); void displayStatusMessages(const BlackMisc::CStatusMessageList &messages);
//! Redirected output
void displayRedirectedOutput(const BlackMisc::CStatusMessage &statusMessage, qint64 contextId);
/*! /*!
* \brief Connection status changed * \brief Connection status changed
* \param from old status, as uint so it is compliant with DBus * \param from old status, as uint so it is compliant with DBus
@@ -369,13 +304,14 @@ private slots:
*/ */
void appendTextMessagesToGui(const BlackMisc::Network::CTextMessageList &messages, bool sending = false); void appendTextMessagesToGui(const BlackMisc::Network::CTextMessageList &messages, bool sending = false);
//!\brief Reload settings //! Reload settings
void reloadSettings(); void reloadSettings();
//! \brief Send cockpit updates //! Send cockpit updates
void sendCockpitUpdates(); void sendCockpitUpdates();
void simulatorAvailable(); //! Simulator available
void simulatorConnectionChanged(bool isAvailable);
// //
// GUI related slots // GUI related slots
@@ -393,17 +329,13 @@ private slots:
*/ */
void setMainPage(MainPageIndex mainPage); void setMainPage(MainPageIndex mainPage);
/*! //! Connect to network
* \brief Connect to network
* \param userId
* \param password
*/
void toggleNetworkConnection(); void toggleNetworkConnection();
//! \brief Menu item clicked //! Menu item clicked
void menuClicked(); void menuClicked();
//! \brief Terminated connection //! Terminated connection
void connectionTerminated(); void connectionTerminated();
/*! /*!
@@ -418,17 +350,13 @@ private slots:
*/ */
void onlineAtcStationSelected(QModelIndex index); void onlineAtcStationSelected(QModelIndex index);
/*! //! Alter traffic server
* \brief Alter traffic server
*/
void alterTrafficServer(); void alterTrafficServer();
//! \brief Network settings have been changed //! Network settings have been changed
void changedSettings(uint typeValue); void changedSettings(uint typeValue);
/*! //! Update timer
* \brief Update timer
*/
void timerBasedUpdates(); void timerBasedUpdates();
/*! /*!
@@ -443,19 +371,19 @@ private slots:
*/ */
void middlePanelChanged(int index); void middlePanelChanged(int index);
//! \brief Command entered //! Command entered
void commandEntered(); void commandEntered();
//! \brief Get METAR for given ICAO airport code //! Get METAR for given ICAO airport code
void getMetar(const QString &airportIcaoCode = ""); void getMetar(const QString &airportIcaoCode = "");
//! \brief Request new ATIS //! Request new ATIS
void requestAtis(); void requestAtis();
//! \brief Close text message tab //! Close text message tab
void closeTextMessageTab(); void closeTextMessageTab();
//! \brief Cockpit values changed //! Cockpit values changed
void cockpitValuesChanged(); void cockpitValuesChanged();
/*! /*!
@@ -464,7 +392,7 @@ private slots:
*/ */
void audioDeviceSelected(int index); void audioDeviceSelected(int index);
//! \brief Reset transponder to Standby / Charly //! Reset transponder to Standby / Charly
void resetTransponderMode(); void resetTransponderMode();
/*! /*!
@@ -473,7 +401,7 @@ private slots:
*/ */
void setAudioVoiceRooms(); void setAudioVoiceRooms();
//! \brief Audio volume handling and mute //! Audio volume handling and mute
void audioVolumes(); void audioVolumes();
/*! /*!
@@ -482,16 +410,16 @@ private slots:
*/ */
void changeWindowOpacity(int opacity = -1); void changeWindowOpacity(int opacity = -1);
//! \brief Context menu for audio //! Context menu for audio
void audioIconContextMenu(const QPoint &position); void audioIconContextMenu(const QPoint &position);
//! \brief Context menu for message list //! Context menu for message list
void messageListContextMenu(const QPoint &position); void messageListContextMenu(const QPoint &position);
//! \brief Test SELCAL (code valid? play tone) //! Test SELCAL (code valid? play tone)
void testSelcal(); void testSelcal();
//! \brief start the MIC tests (Squelch) //! start the MIC tests (Squelch)
void startAudioTest(); void startAudioTest();
//! \brief Input focus changed, used to detect whether an input control has focus //! \brief Input focus changed, used to detect whether an input control has focus

View File

@@ -62,13 +62,8 @@ namespace BlackCore
//! Aircraft list has been changed //! Aircraft list has been changed
void changedAircraftsInRange(); void changedAircraftsInRange();
/*! //! Aircraft situation update
* \brief Aircraft situation update void changedAircraftSituation(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &situation);
* \param callsign
* \param situation
* \return
*/
void aircraftSituationUpdate(const BlackMisc::Aviation::CCallsign &callsign, const BlackMisc::Aviation::CAircraftSituation &situation);
//! Terminated connection //! Terminated connection
void connectionTerminated(); void connectionTerminated();

View File

@@ -91,7 +91,7 @@ namespace BlackCore
bool CDBusServer::newConnection(const QDBusConnection &connection) bool CDBusServer::newConnection(const QDBusConnection &connection)
{ {
QMap<QString, QObject *>::ConstIterator i = m_objects.begin(); QMap<QString, QObject *>::ConstIterator i = m_objects.begin();
QDBusConnection newConnection(connection); QDBusConnection newConnection(connection); // copy, because object will be registered on this connection
m_DBusConnections.insert(newConnection.name(), newConnection); m_DBusConnections.insert(newConnection.name(), newConnection);
bool success = true; bool success = true;
qDebug() << "New Connection from: " << newConnection.name(); qDebug() << "New Connection from: " << newConnection.name();
@@ -135,7 +135,6 @@ namespace BlackCore
{ {
Q_ASSERT_X(false, "CDBusServer::addObject", "Wrong server mode"); Q_ASSERT_X(false, "CDBusServer::addObject", "Wrong server mode");
} }
// Q_ASSERT_X(success, "CDBusServer::addObject", "Registration failed");
} }
/* /*

View File

@@ -61,26 +61,24 @@ namespace BlackCore
} }
public: public:
//! \brief Constructor //! Constructor
CDBusServer(const QString &address, QObject *parent = nullptr); CDBusServer(const QString &address, QObject *parent = nullptr);
//!! \brief Adds a QObject to be exposed to DBus //!! Adds a QObject to be exposed to DBus
void addObject(const QString &name, QObject *object); void addObject(const QString &name, QObject *object);
//! \brief Last error //! Last error
QDBusError lastError() const; QDBusError lastError() const;
//! \brief Connected? //! Connected?
bool isConnected() const bool isConnected() const { return this->m_busServer.isConnected(); }
{
return this->m_busServer.isConnected(); //! address
} QString address() const { return this->m_busServer.address(); }
//!
//! \brief address
QString address() const
{
return this->m_busServer.address();
}
//! \brief Connection by name //! \brief Connection by name
const QDBusConnection getDbusConnection(const QString &connectionName) const const QDBusConnection getDbusConnection(const QString &connectionName) const
@@ -88,28 +86,29 @@ namespace BlackCore
return this->m_DBusConnections.value(connectionName, CDBusServer::defaultConnection()); return this->m_DBusConnections.value(connectionName, CDBusServer::defaultConnection());
} }
//! \brief Get DBbus connections //! Get DBus connections
const QList<QDBusConnection> getDbusConnections() const const QList<QDBusConnection> getDBusConnections() const
{ {
// http://stackoverflow.com/questions/1124340/any-ideas-why-qhash-and-qmap-return-const-t-instead-of-const-t // http://stackoverflow.com/questions/1124340/any-ideas-why-qhash-and-qmap-return-const-t-instead-of-const-t
return this->m_DBusConnections.values(); return this->m_DBusConnections.values();
} }
//! \brief Default connection //! \brief Default connection
//! Default connection
static const QDBusConnection &defaultConnection() static const QDBusConnection &defaultConnection()
{ {
static QDBusConnection defaultConnection("default"); static QDBusConnection defaultConnection("default");
return defaultConnection; return defaultConnection;
} }
//! \brief Denotes a session DBus server //! Denotes a session DBus server
static const QString &sessionDBusServer() static const QString &sessionDBusServer()
{ {
static QString session("session"); static QString session("session");
return session; return session;
} }
//! \brief Denotes a session DBus server //! Denotes a session DBus server
static const QString &systemDBusServer() static const QString &systemDBusServer()
{ {
static QString system("system"); static QString system("system");

View File

@@ -29,9 +29,7 @@ namespace BlackMisc
TypeGui TypeGui
}; };
/*! //! Status severities
* \brief Status severities
*/
enum StatusSeverity enum StatusSeverity
{ {
SeverityInfo, SeverityInfo,
@@ -39,9 +37,7 @@ namespace BlackMisc
SeverityError SeverityError
}; };
/*! //! Properties by index
* \brief Properties by index
*/
enum ColumnIndex enum ColumnIndex
{ {
IndexType, IndexType,
@@ -60,46 +56,43 @@ namespace BlackMisc
QDateTime m_timestamp; QDateTime m_timestamp;
public: public:
//! \brief Constructor //! Constructor
CStatusMessage() : m_type(TypeUnknown), m_severity(SeverityInfo) {} CStatusMessage() : m_type(TypeUnknown), m_severity(SeverityInfo) {}
//! \brief Constructor //! Constructor
CStatusMessage(StatusType type, StatusSeverity severity, const char *message);
//! Constructor
CStatusMessage(StatusType type, StatusSeverity severity, const QString &message); CStatusMessage(StatusType type, StatusSeverity severity, const QString &message);
//! \brief Status type //! Status type
StatusType getType() const StatusType getType() const { return this->m_type; }
{
return this->m_type;
}
//! \brief Status severity //! Status severity
StatusSeverity getSeverity() const StatusSeverity getSeverity() const { return this->m_severity; }
{
return this->m_severity;
}
//! \brief Message //! Message
QString getMessage() const QString getMessage() const { return this->m_message; }
{
return this->m_message; //! Message empty
} bool isEmpty() const { return this->m_message.isEmpty(); }
//! \copydoc CValueObject::getValueHash() //! \copydoc CValueObject::getValueHash()
virtual uint getValueHash() const override; virtual uint getValueHash() const override;
//! \copydoc CValueObject::toQVariant() //! \copydoc CValueObject::toQVariant()
virtual QVariant toQVariant() const override virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
{
return QVariant::fromValue(*this);
}
//! \brief Type as string //! Type as string
const QString &getTypeAsString() const; const QString &getTypeAsString() const;
//! \brief representing icon //! Severity
void setSeverity(StatusSeverity severity) { this->m_severity = severity; }
//! Representing icon
virtual const QPixmap &toIcon() const override { return CStatusMessage::convertToIcon(*this); } virtual const QPixmap &toIcon() const override { return CStatusMessage::convertToIcon(*this); }
//! \brief Type as string //! Type as string
const QString &getSeverityAsString() const; const QString &getSeverityAsString() const;
//! \copydoc CValueObject::propertyByIndex(int) //! \copydoc CValueObject::propertyByIndex(int)
@@ -111,22 +104,25 @@ namespace BlackMisc
//! \copydoc CValueObject::propertyByIndexAsString //! \copydoc CValueObject::propertyByIndexAsString
virtual QString propertyByIndexAsString(int index, bool i18n) const override; virtual QString propertyByIndexAsString(int index, bool i18n) const override;
//! \brief Equal operator == //! To HTML
QString toHtml() const;
//! Equal operator ==
bool operator ==(const CStatusMessage &other) const; bool operator ==(const CStatusMessage &other) const;
//! \brief Unequal operator != //! Unequal operator !=
bool operator !=(const CStatusMessage &other) const; bool operator !=(const CStatusMessage &other) const;
//! \brief Register metadata //! Register metadata
static void registerMetadata(); static void registerMetadata();
//! \brief Validation error //! Validation error
static CStatusMessage getValidationError(const QString &message); static CStatusMessage getValidationError(const QString &message);
//! \brief (Unspecific) Info message //! (Unspecific) Info message
static CStatusMessage getInfoMessage(const QString &message, StatusType type = CStatusMessage::TypeUnspecific); static CStatusMessage getInfoMessage(const QString &message, StatusType type = CStatusMessage::TypeUnspecific);
//! \brief representing icon //! Representing icon
static const QPixmap &convertToIcon(const CStatusMessage &statusMessage); static const QPixmap &convertToIcon(const CStatusMessage &statusMessage);
protected: protected: