Commit 36d52d10 authored by Don Gagne's avatar Don Gagne

Add showErrorsInToolBar support

parent 3cb8ec89
......@@ -60,6 +60,7 @@ UASMessageHandler::UASMessageHandler(QObject *parent)
, _errorCountTotal(0)
, _warningCount(0)
, _normalCount(0)
, _showErrorsInToolbar(false)
{
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
emit textMessageReceived(NULL);
......@@ -184,6 +185,10 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString
_mutex.unlock();
emit textMessageReceived(message);
emit textMessageCountChanged(count);
if (_showErrorsInToolbar && message->severityIsError()) {
qgcApp()->showToolBarMessage(message->getText());
}
}
int UASMessageHandler::getErrorCountTotal() {
......
......@@ -81,6 +81,7 @@ class UASMessageHandler : public QGCSingleton
{
Q_OBJECT
DECLARE_QGC_SINGLETON(UASMessageHandler, UASMessageHandler)
public:
explicit UASMessageHandler(QObject *parent = 0);
~UASMessageHandler();
......@@ -120,6 +121,10 @@ public:
* @brief Get latest error message
*/
QString getLatestError() { return _latestError; }
/// Begin to show message which are errors in the toolbar
void showErrorsInToolbar(void) { _showErrorsInToolbar = true; }
public slots:
/**
* @brief Set currently active UAS
......@@ -134,6 +139,7 @@ public slots:
* @param text Message Text
*/
void handleTextMessage(int uasid, int componentid, int severity, QString text);
signals:
/**
* @brief Sent out when new message arrives
......@@ -145,16 +151,18 @@ signals:
* @param count The new message count
*/
void textMessageCountChanged(int count);
private:
// Stores the UAS that we're currently receiving messages from.
UASInterface* _activeUAS;
QVector<UASMessage*> _messages;
QMutex _mutex;
int _errorCount;
int _errorCountTotal;
int _warningCount;
int _normalCount;
QMutex _mutex;
int _errorCount;
int _errorCountTotal;
int _warningCount;
int _normalCount;
QString _latestError;
bool _showErrorsInToolbar;
};
#endif // QGCMESSAGEHANDLER_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment