1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-06 17:46:07 +01:00
LibrePilot/ground/openpilotgcs/src/plugins/notify/NotificationItem.h

155 lines
4.5 KiB
C
Raw Normal View History

2011-09-14 23:38:18 +02:00
/**
******************************************************************************
*
* @file NotificationItem.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @brief Notify Plugin configuration header
* @see The GNU Public License (GPL) Version 3
* @defgroup notifyplugin
* @{
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef NOTIFICATION_ITEM_H
#define NOTIFICATION_ITEM_H
#include <coreplugin/iuavgadgetconfiguration.h>
#include "qsettings.h"
#include <qstringlist.h>
#include <QTimer>
using namespace Core;
#define DECLARE_SOUND(number) \
QString getSound##number() const { return _sound##number; } \
void setSound##number(QString text) { _sound##number = text; } \
// QString getSound2() const { return _sound2; }
// void setSound2(QString text) { _sound2 = text; }
// QString getSound3() const { return _sound3; }
// void setSound3(QString text) { _sound3 = text; }
class NotificationItem : public QObject
{
Q_OBJECT
public:
explicit NotificationItem(QObject *parent = 0);
void copyTo(NotificationItem*) const;
DECLARE_SOUND(1)
DECLARE_SOUND(2)
DECLARE_SOUND(3)
QString getValue() const { return _dataValue; }
void setValue(QString text) { _dataValue = text; }
QString getSayOrder() const { return _sayOrder; }
void setSayOrder(QString text) { _sayOrder = text; }
double getSpinBoxValue() const { return _spinBoxValue; }
void setSpinBoxValue(double value) { _spinBoxValue = value; }
QString getDataObject() const { return _dataObject; }
void setDataObject(QString text) { _dataObject = text; }
QString getObjectField() const { return _objectField; }
void setObjectField(QString text) { _objectField = text; }
QString getSoundCollectionPath() const { return _soundCollectionPath; }
void setSoundCollectionPath(QString path) { _soundCollectionPath = path; }
QString getCurrentLanguage() const { return _currentLanguage; }
void setCurrentLanguage(QString text) { _currentLanguage = text; }
QStringList getMessageSequence() const { return _messageSequence; }
void setMessageSequence(QStringList sequence) { _messageSequence = sequence; }
QString getRepeatFlag() const { return _repeatString; }
void setRepeatFlag(QString value) { _repeatString = value; }
bool getRepeatTimeout() const { return _repeatTimeout; }
void setRepeatTimeout(bool value) { _repeatTimeout = value; }
int getExpireTimeout() const { return _expireTimeout; }
void setExpireTimeout(int value) { _expireTimeout = value; }
bool getEnableFlag() const { return _enableFlag; }
void setEnableFlag(bool value) { _enableFlag = value; }
void saveState(QSettings* settings) const;
void restoreState(QSettings* settings);
QString parseNotifyMessage();
QTimer* timer;
QTimer* expireTimer;
bool isNowPlaying; //
bool firstStart;
private:
QStringList _messageSequence;
//! path to folder with sound files
QString _soundCollectionPath;
//! language in what notifications will be spelled
QString _currentLanguage;
//! one UAV object per one notification
QString _dataObject;
//! one field value change can be assigned to one notification
QString _objectField;
//! poled UAV field value
QString _dataValue;
//! possible sounds(at least one required to play notification)
QString _sound1;
QString _sound2;
QString _sound3;
//! order in what sounds 1-3 will be played
QString _sayOrder;
double _spinBoxValue;
QString _repeatString;
//! time when next notification must be fired
bool _repeatTimeout;
//! how often or what periodicaly notification should be played
int _repeatTimerValue;
//! time after event occured till notification became invalid
//! and will be removed from list
int _expireTimeout;
//! enables/disables playing of current notification
bool _enableFlag;
};
Q_DECLARE_METATYPE(NotificationItem*)
#endif // NotificationItem_H