mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
implemented repeat notifications options and add third sound
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1132 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
c98ba649db
commit
37c9e1affd
@ -11,11 +11,14 @@ QT += phonon
|
||||
HEADERS += notifyplugin.h \
|
||||
notifypluginoptionspage.h \
|
||||
notifypluginconfiguration.h \
|
||||
notifyitemdelegate.h
|
||||
notifyitemdelegate.h \
|
||||
notifytablemodel.h
|
||||
|
||||
SOURCES += notifyplugin.cpp \
|
||||
notifypluginoptionspage.cpp \
|
||||
notifypluginconfiguration.cpp \
|
||||
notifyitemdelegate.cpp
|
||||
notifyitemdelegate.cpp \
|
||||
notifytablemodel.cpp
|
||||
|
||||
OTHER_FILES += NotifyPlugin.pluginspec
|
||||
|
||||
|
@ -28,72 +28,6 @@
|
||||
#include "notifyitemdelegate.h"
|
||||
#include <QtGui>
|
||||
|
||||
//RepeatCounterDelegate::RepeatCounterDelegate(QObject *parent)
|
||||
// : QItemDelegate(parent) {}
|
||||
|
||||
// QWidget* RepeatCounterDelegate::createEditor(QWidget *parent,
|
||||
// const QStyleOptionViewItem &,
|
||||
// const QModelIndex &index) const
|
||||
// {
|
||||
// if (index.row() == 2) {
|
||||
// QSpinBox *editor = new QSpinBox(parent);
|
||||
// editor->setMinimum(0);
|
||||
// editor->setMaximum(100);
|
||||
// return editor;
|
||||
// }
|
||||
|
||||
// QLabel *editor = new QLabel(parent);
|
||||
|
||||
// connect(editor, SIGNAL(editingFinished()),
|
||||
// this, SLOT(commitAndCloseEditor()));
|
||||
// return editor;
|
||||
// }
|
||||
|
||||
// void RepeatCounterDelegate::commitAndCloseEditor()
|
||||
// {
|
||||
// QLabel* editor = qobject_cast<QLabel*>(sender());
|
||||
// emit commitData(editor);
|
||||
// emit closeEditor(editor);
|
||||
// }
|
||||
|
||||
// void RepeatCounterDelegate::setEditorData(QWidget *editor,
|
||||
// const QModelIndex &index) const
|
||||
// {
|
||||
// QLabel* edit = qobject_cast<QLabel*>(editor);
|
||||
// if (edit) {
|
||||
// edit->setText(index.model()->data(index, Qt::EditRole).toString());
|
||||
// } else {
|
||||
// QSpinBox* spinBox = static_cast<QSpinBox*>(editor);
|
||||
// if (spinBox)
|
||||
// {
|
||||
// int value = index.model()->data(index, Qt::EditRole).toInt();
|
||||
// spinBox->setValue(value);
|
||||
|
||||
// //repeatEditor->setCurrentIndex(repeatEditor->findText(index.model()->data(index, Qt::EditRole).toString()));
|
||||
//// repeatEditor->setDate(QDate::fromString(
|
||||
//// index.model()->data(index, Qt::EditRole).toString(),
|
||||
//// "d/M/yyyy"));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// void RepeatCounterDelegate::setModelData(QWidget *editor,
|
||||
// QAbstractItemModel *model, const QModelIndex &index) const
|
||||
// {
|
||||
// QLabel* edit = qobject_cast<QLabel*>(editor);
|
||||
// if (edit) {
|
||||
// model->setData(index, edit->text());
|
||||
// } else {
|
||||
// QSpinBox* spinBox = static_cast<QSpinBox*>(editor);
|
||||
// if (spinBox) {
|
||||
// spinBox->interpretText();
|
||||
// int value = spinBox->value();
|
||||
// model->setData(index, value, Qt::EditRole);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NotifyItemDelegate::NotifyItemDelegate(QStringList items,QObject *parent)
|
||||
: QItemDelegate(parent),
|
||||
@ -116,16 +50,23 @@
|
||||
//connect(repeatEditor,SIGNAL(activated (const QString& )),this,SLOT(selectRow(const QString& )));
|
||||
//QTableWidgetItem* item = qobject_cast<QTableWidgetItem *>(parent);
|
||||
//((QTableWidgetItem*)parent)->setSelected(true);
|
||||
connect(editor, SIGNAL(editingFinished()),
|
||||
this, SLOT(commitAndCloseEditor()));
|
||||
// connect(editor, SIGNAL(editingFinished()),
|
||||
// this, SLOT(commitAndCloseEditor()));
|
||||
return editor;
|
||||
} else
|
||||
{
|
||||
if(index.column() == 2)
|
||||
{
|
||||
QSpinBox* editor = new QSpinBox(parent);
|
||||
connect(editor, SIGNAL(editingFinished()),
|
||||
this, SLOT(commitAndCloseEditor()));
|
||||
return editor;
|
||||
}
|
||||
|
||||
}
|
||||
QLineEdit *editor = new QLineEdit(parent);
|
||||
|
||||
|
||||
|
||||
connect(editor, SIGNAL(editingFinished()),
|
||||
this, SLOT(commitAndCloseEditor()));
|
||||
// connect(editor, SIGNAL(editingFinished()),
|
||||
// this, SLOT(commitAndCloseEditor()));
|
||||
return editor;
|
||||
}
|
||||
|
||||
@ -136,16 +77,22 @@
|
||||
{
|
||||
emit commitData(editor);
|
||||
emit closeEditor(editor);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
} else {
|
||||
QComboBox* editor = qobject_cast<QComboBox*>(sender());
|
||||
if (editor)
|
||||
if (editor)
|
||||
{
|
||||
emit commitData(editor);
|
||||
emit closeEditor(editor);
|
||||
}
|
||||
}
|
||||
emit commitData(editor);
|
||||
emit closeEditor(editor);
|
||||
} else {
|
||||
QSpinBox* editor = qobject_cast<QSpinBox*>(sender());
|
||||
if (editor)
|
||||
{
|
||||
emit commitData(editor);
|
||||
emit closeEditor(editor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NotifyItemDelegate::setEditorData(QWidget *editor,
|
||||
@ -158,9 +105,12 @@
|
||||
QComboBox * repeatEditor = qobject_cast<QComboBox *>(editor);
|
||||
if (repeatEditor)
|
||||
repeatEditor->setCurrentIndex(repeatEditor->findText(index.model()->data(index, Qt::EditRole).toString()));
|
||||
// QTableWidgetItem* item = ((QTableWidget*)m_parent)->item(index.row(),1);
|
||||
// item->setSelected(true);
|
||||
else {
|
||||
QSpinBox * expireEditor = qobject_cast<QSpinBox *>(editor);
|
||||
if (expireEditor)
|
||||
expireEditor->setValue(index.model()->data(index, Qt::EditRole).toInt());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NotifyItemDelegate::setModelData(QWidget *editor,
|
||||
@ -173,12 +123,18 @@
|
||||
QComboBox * repeatEditor = qobject_cast<QComboBox *>(editor);
|
||||
if (repeatEditor) {
|
||||
model->setData(index, repeatEditor->currentText());
|
||||
// emit commitData(repeatEditor);
|
||||
// emit closeEditor(repeatEditor);
|
||||
|
||||
} else {
|
||||
QSpinBox * expireEditor = qobject_cast<QSpinBox *>(editor);
|
||||
if (expireEditor) {
|
||||
//expireEditor->interpretText();
|
||||
model->setData(index, expireEditor->value(), Qt::EditRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NotifyItemDelegate::selectRow(const QString & text)
|
||||
{
|
||||
//QList<QTableWidgetItem *> list = ((QTableWidget*)(sender()->parent()))->findItems(text,Qt::MatchExactly);
|
||||
@ -194,13 +150,11 @@ void NotifyItemDelegate::selectRow(const QString & text)
|
||||
//item->setSelected(true);
|
||||
}
|
||||
|
||||
// bool NotifyItemDelegate::editorEvent(QEvent * event, QAbstractItemModel * model,
|
||||
// const QStyleOptionViewItem & option, const QModelIndex & index )
|
||||
// {
|
||||
// if(event->type()==QEvent::EnabledChange)
|
||||
// {
|
||||
// QTableWidgetItem* item = ((QTableWidget*)parent())->item(index.row(),index.column());
|
||||
// item->setSelected(true);
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
QSize NotifyItemDelegate::sizeHint ( const QStyleOptionViewItem & option,
|
||||
const QModelIndex & index ) const
|
||||
{
|
||||
QSize s = QItemDelegate::sizeHint(option, index);
|
||||
s.setHeight(10);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@ -60,6 +60,8 @@ public:
|
||||
const QModelIndex &index) const;
|
||||
// bool editorEvent(QEvent * event, QAbstractItemModel * model,
|
||||
// const QStyleOptionViewItem & option, const QModelIndex & index );
|
||||
QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const;
|
||||
|
||||
private:
|
||||
QObject* m_parent;
|
||||
QStringList m_items;
|
||||
|
@ -32,12 +32,18 @@
|
||||
#include <QDebug>
|
||||
#include <QtPlugin>
|
||||
#include <QStringList>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <iostream>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <iostream>
|
||||
#include "qxttimer.h"
|
||||
|
||||
//#define DEBUG_NOTIFIES
|
||||
|
||||
SoundNotifyPlugin::SoundNotifyPlugin()
|
||||
{
|
||||
phonon.mo = NULL;
|
||||
phonon.ms = NULL;
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@ -74,125 +80,326 @@ void SoundNotifyPlugin::extensionsInitialized()
|
||||
setEnableSound(settings->value(QLatin1String("EnableSound"),0).toBool());
|
||||
settings->endGroup();
|
||||
|
||||
ExtensionSystem::PluginManager* pm = ExtensionSystem::PluginManager::instance();
|
||||
connect(pm, SIGNAL(objectAdded(QObject*)), this, SLOT(onTelemetryManagerAdded(QObject*)));
|
||||
removedNotifies.clear();
|
||||
connectNotifications();
|
||||
}
|
||||
|
||||
void SoundNotifyPlugin::onTelemetryManagerAdded(QObject* obj)
|
||||
{
|
||||
telMngr = qobject_cast<TelemetryManager *>(obj);
|
||||
if(telMngr)
|
||||
connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
}
|
||||
|
||||
void SoundNotifyPlugin::shutdown()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void SoundNotifyPlugin::onAutopilotDisconnect()
|
||||
{
|
||||
connectNotifications();
|
||||
}
|
||||
|
||||
/*!
|
||||
clear any notify timers from previous flight;
|
||||
reset will be perform on start of option page
|
||||
*/
|
||||
void SoundNotifyPlugin::resetNotification(void)
|
||||
{
|
||||
//first, reject empty args and unknown fields.
|
||||
foreach(NotifyPluginConfiguration* notify,lstNotifications) {
|
||||
if(notify->timer)
|
||||
{
|
||||
disconnect(notify->timer, SIGNAL(timeout()), this, SLOT(repeatTimerHandler()));
|
||||
notify->timer->stop();
|
||||
delete notify->timer;
|
||||
notify->timer = NULL;
|
||||
}
|
||||
if(notify->expireTimer)
|
||||
{
|
||||
disconnect(notify->expireTimer, SIGNAL(timeout()), this, SLOT(expireTimerHandler()));
|
||||
notify->expireTimer->stop();
|
||||
delete notify->expireTimer;
|
||||
notify->expireTimer = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
update list of notifies;
|
||||
will be perform on OK or APPLY press of option page
|
||||
*/
|
||||
void SoundNotifyPlugin::updateNotificationList(QList<NotifyPluginConfiguration*> list)
|
||||
{
|
||||
removedNotifies.clear();
|
||||
lstNotifications.clear();
|
||||
lstNotifications=list;
|
||||
connectNotifications();
|
||||
}
|
||||
|
||||
void SoundNotifyPlugin::connectNotifications()
|
||||
{
|
||||
foreach(UAVDataObject* obj,lstNotifiedUAVObjects) {
|
||||
if (obj != NULL)
|
||||
disconnect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(playNotification(UAVObject*)));
|
||||
disconnect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(appendNotification(UAVObject*)));
|
||||
}
|
||||
if(phonon.mo != NULL)
|
||||
delete phonon.mo;
|
||||
if(phonon.ms != NULL)
|
||||
delete phonon.ms;
|
||||
|
||||
if(!enableSound) return;
|
||||
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
|
||||
lstNotifiedUAVObjects.clear();
|
||||
pendingNotifications.clear();
|
||||
lstNotifications.append(removedNotifies);
|
||||
removedNotifies.clear();
|
||||
|
||||
// QList<Phonon::MediaObject*> deleteList = mapMediaObjects.values();
|
||||
// if(!deleteList.isEmpty())
|
||||
// foreach(Phonon::MediaObject* mediaObj,deleteList)
|
||||
// delete mediaObj;
|
||||
|
||||
// Check validity of arguments first, reject empty args and unknown fields.
|
||||
//first, reject empty args and unknown fields.
|
||||
foreach(NotifyPluginConfiguration* notify,lstNotifications) {
|
||||
notify->firstStart=true;
|
||||
notify->isNowPlaying=false;
|
||||
|
||||
// if(notify->timer)
|
||||
// {
|
||||
// disconnect(notify->timer, SIGNAL(timeout()), this, SLOT(repeatTimerHandler()));
|
||||
// notify->timer->stop();
|
||||
// delete notify->timer;
|
||||
// notify->timer = NULL;
|
||||
// }
|
||||
// if(notify->expireTimer)
|
||||
// {
|
||||
// disconnect(notify->expireTimer, SIGNAL(timeout()), this, SLOT(expireTimerHandler()));
|
||||
// notify->expireTimer->stop();
|
||||
// delete notify->expireTimer;
|
||||
// notify->expireTimer = NULL;
|
||||
// }
|
||||
|
||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( objManager->getObject(notify->getDataObject()) );
|
||||
if (obj != NULL ) {
|
||||
if(!lstNotifiedUAVObjects.contains(obj))
|
||||
{
|
||||
if(!lstNotifiedUAVObjects.contains(obj)) {
|
||||
lstNotifiedUAVObjects.append(obj);
|
||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(playNotification(UAVObject*)));
|
||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(appendNotification(UAVObject*)));
|
||||
}
|
||||
//lstMediaSource.append(new QList<Phonon::MediaSource>);
|
||||
|
||||
QMap<QString, PhononObject>::const_iterator iter = mapMediaObjects.find(obj->getName());
|
||||
if(iter==mapMediaObjects.end()) {
|
||||
// set notification message to current event
|
||||
mapMediaObjects[obj->getName()].mo = new Phonon::MediaObject;
|
||||
mapMediaObjects[obj->getName()].mo = Phonon::createPlayer(Phonon::NotificationCategory);
|
||||
mapMediaObjects[obj->getName()].ms = new QList<Phonon::MediaSource>;
|
||||
mapMediaObjects[obj->getName()].mo->clear();
|
||||
}
|
||||
|
||||
// notify->parseNotifyMessage();
|
||||
// foreach(QString item, notify->getNotifyMessageList())
|
||||
// {
|
||||
// mapMediaObjects[obj->getName()].ms->clear();
|
||||
// mapMediaObjects[obj->getName()].ms->append(Phonon::MediaSource(item));
|
||||
// }
|
||||
|
||||
//mapMediaObjects[obj->getName()].ms = lstMediaSource.last();
|
||||
} else {
|
||||
} else
|
||||
std::cout << "Error: Object is unknown (" << notify->getDataObject().toStdString() << ")." << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if(lstNotifications.isEmpty()) return;
|
||||
// set notification message to current event
|
||||
phonon.mo = new Phonon::MediaObject;
|
||||
phonon.mo = Phonon::createPlayer(Phonon::NotificationCategory);
|
||||
phonon.ms = new QList<Phonon::MediaSource>;
|
||||
phonon.mo->clear();
|
||||
connect(phonon.mo,SIGNAL(stateChanged(Phonon::State,Phonon::State)),
|
||||
this,SLOT(stateChanged(Phonon::State,Phonon::State)));
|
||||
}
|
||||
|
||||
void SoundNotifyPlugin::playNotification(UAVObject *object)
|
||||
void SoundNotifyPlugin::appendNotification(UAVObject *object)
|
||||
{
|
||||
UAVObjectField* field;
|
||||
disconnect(object, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(appendNotification(UAVObject*)));
|
||||
|
||||
foreach(NotifyPluginConfiguration* notification, lstNotifications) {
|
||||
if(object->getName()!=notification->getDataObject())
|
||||
continue;
|
||||
|
||||
if(nowPlayingConfiguration == notification)
|
||||
continue;
|
||||
|
||||
if(notification->getRepeatFlag()!= "Repeat Instantly" &&
|
||||
notification->getRepeatFlag()!= "Repeat Once" && !notification->firstStart)
|
||||
continue;
|
||||
|
||||
checkNotificationRule(notification,object);
|
||||
}
|
||||
connect(object, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(appendNotification(UAVObject*)));
|
||||
}
|
||||
|
||||
|
||||
void SoundNotifyPlugin::checkNotificationRule(NotifyPluginConfiguration* notification, UAVObject* object)
|
||||
{
|
||||
bool condition=false;
|
||||
double threshold;
|
||||
QString direction;
|
||||
QString fieldName;
|
||||
bool play = false;
|
||||
NotifyPluginConfiguration* notification;
|
||||
threshold = notification->getSpinBoxValue();
|
||||
direction = notification->getValue();
|
||||
fieldName = notification->getObjectField();
|
||||
UAVObjectField* field = object->getField(fieldName);
|
||||
if (field->getName()!="") {
|
||||
double value = field->getDouble();
|
||||
|
||||
foreach(notification, lstNotifications) {
|
||||
if(object->getName()==notification->getDataObject()) {
|
||||
fieldName = notification->getObjectField();
|
||||
field = object->getField(fieldName);
|
||||
threshold = notification->getSpinBoxValue();
|
||||
direction = notification->getValue();
|
||||
switch(direction[0].toAscii())
|
||||
{
|
||||
case 'E':
|
||||
if(value==threshold)
|
||||
condition = true;
|
||||
break;
|
||||
case 'G':
|
||||
if(value>threshold)
|
||||
condition = true;
|
||||
break;
|
||||
case 'L':
|
||||
if(value<threshold)
|
||||
condition = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (field) {
|
||||
double value = field->getDouble();
|
||||
//qDebug() << fieldName << " - value - " << value;
|
||||
|
||||
switch(direction[0].toAscii())
|
||||
if(condition)
|
||||
{
|
||||
if(!playNotification(notification))
|
||||
{
|
||||
if(!pendingNotifications.contains(notification))
|
||||
{
|
||||
case 'E':
|
||||
if(value==threshold)
|
||||
play = true;
|
||||
break;
|
||||
case 'G':
|
||||
if(value>threshold)
|
||||
play = true;
|
||||
break;
|
||||
case 'L':
|
||||
if(value<threshold)
|
||||
play = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(play)
|
||||
{
|
||||
play = false;
|
||||
if((mapMediaObjects[object->getName()].mo->state()==Phonon::PausedState) ||
|
||||
(mapMediaObjects[object->getName()].mo->state()==Phonon::StoppedState))
|
||||
if(notification->timer)
|
||||
if(notification->timer->isActive())
|
||||
notification->timer->stop();
|
||||
#ifdef DEBUG_NOTIFIES
|
||||
qDebug() << "add to pending list - " << notification->parseNotifyMessage();
|
||||
#endif
|
||||
// if audio is busy, start expiration timer
|
||||
//ms = (notification->getExpiredTimeout()[in sec])*1000
|
||||
//QxtTimer::singleShot(notification->getExpireTimeout()*1000, this, SLOT(expirationTimerHandler(NotifyPluginConfiguration*)), qVariantFromValue(notification));
|
||||
pendingNotifications.append(notification);
|
||||
if(!notification->expireTimer)
|
||||
{
|
||||
qDebug() << fieldName << " - value - " << value;
|
||||
mapMediaObjects[object->getName()].mo->clear();
|
||||
mapMediaObjects[object->getName()].ms->clear();
|
||||
notification->parseNotifyMessage();
|
||||
foreach(QString item, notification->getNotifyMessageList())
|
||||
mapMediaObjects[object->getName()].ms->append(Phonon::MediaSource(item));
|
||||
mapMediaObjects[object->getName()].mo->setQueue(*mapMediaObjects[object->getName()].ms);
|
||||
mapMediaObjects[object->getName()].mo->play();
|
||||
if(notification->getRepeatFlag()=="Once")
|
||||
lstNotifications.removeOne(notification);
|
||||
break;
|
||||
notification->expireTimer = new QTimer(notification);
|
||||
connect(notification->expireTimer, SIGNAL(timeout()), this, SLOT(expireTimerHandler()));
|
||||
}
|
||||
notification->expireTimer->start(notification->getExpireTimeout()*1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SoundNotifyPlugin::playNotification(NotifyPluginConfiguration* notification)
|
||||
{
|
||||
if((phonon.mo->state()==Phonon::PausedState) ||
|
||||
(phonon.mo->state()==Phonon::StoppedState))
|
||||
{
|
||||
// don't fire expire timer
|
||||
//notification->expire = false;
|
||||
nowPlayingConfiguration = notification;
|
||||
if(notification->expireTimer)
|
||||
notification->expireTimer->stop();
|
||||
|
||||
if(notification->getRepeatFlag()=="Repeat Once")
|
||||
{
|
||||
removedNotifies.append(lstNotifications.takeAt(lstNotifications.indexOf(notification)));
|
||||
//if(!notification->firstStart) return true;
|
||||
}
|
||||
else {
|
||||
if(notification->getRepeatFlag()!="Repeat Instantly")
|
||||
{
|
||||
QRegExp rxlen("(\\d+)");
|
||||
QString value;
|
||||
int timer_value;
|
||||
int pos = rxlen.indexIn(notification->getRepeatFlag());
|
||||
if (pos > -1) {
|
||||
value = rxlen.cap(1); // "189"
|
||||
timer_value = (value.toInt()+8)*1000; //ms*1000 + average duration of meassage
|
||||
}
|
||||
|
||||
if(!notification->timer)
|
||||
{
|
||||
notification->timer = new QTimer(notification);
|
||||
notification->timer->setInterval(timer_value);
|
||||
connect(notification->timer, SIGNAL(timeout()), this, SLOT(repeatTimerHandler()));
|
||||
}
|
||||
if(!notification->timer->isActive())
|
||||
notification->timer->start();
|
||||
|
||||
//QxtTimer::singleShot(timer_value, this, SLOT(repeatTimerHandler(NotifyPluginConfiguration*)), qVariantFromValue(notification));
|
||||
}
|
||||
}
|
||||
notification->firstStart=false;
|
||||
phonon.mo->clear();
|
||||
phonon.ms->clear();
|
||||
QString str = notification->parseNotifyMessage();
|
||||
#ifdef DEBUG_NOTIFIES
|
||||
qDebug() << "play notification - " << str;
|
||||
#endif
|
||||
foreach(QString item, notification->getNotifyMessageList())
|
||||
phonon.ms->append(Phonon::MediaSource(item));
|
||||
phonon.mo->setQueue(*phonon.ms);
|
||||
phonon.mo->play();
|
||||
}
|
||||
else
|
||||
return false; // if audio is busy
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//void SoundNotifyPlugin::repeatTimerHandler(NotifyPluginConfiguration* notification)
|
||||
//{
|
||||
// qDebug() << "repeatTimerHandler - " << notification->parseNotifyMessage();
|
||||
|
||||
// ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
// UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
// UAVObject* object = objManager->getObject(notification->getDataObject());
|
||||
// if(object)
|
||||
// checkNotificationRule(notification,object);
|
||||
//}
|
||||
|
||||
void SoundNotifyPlugin::repeatTimerHandler()
|
||||
{
|
||||
NotifyPluginConfiguration* notification = static_cast<NotifyPluginConfiguration*>(sender()->parent());
|
||||
#ifdef DEBUG_NOTIFIES
|
||||
qDebug() << "repeatTimerHandler - " << notification->parseNotifyMessage();
|
||||
#endif
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
UAVObject* object = objManager->getObject(notification->getDataObject());
|
||||
if(object)
|
||||
checkNotificationRule(notification,object);
|
||||
}
|
||||
|
||||
void SoundNotifyPlugin::expireTimerHandler()
|
||||
{
|
||||
// fire expire timer
|
||||
NotifyPluginConfiguration* notification = static_cast<NotifyPluginConfiguration*>(sender()->parent());
|
||||
notification->expireTimer->stop();
|
||||
|
||||
if(!pendingNotifications.isEmpty())
|
||||
{
|
||||
#ifdef DEBUG_NOTIFIES
|
||||
qDebug() << "expireTimerHandler - " << notification->parseNotifyMessage();
|
||||
#endif
|
||||
pendingNotifications.removeOne(notification);
|
||||
}
|
||||
}
|
||||
|
||||
void SoundNotifyPlugin::stateChanged(Phonon::State newstate, Phonon::State oldstate)
|
||||
{
|
||||
if((newstate == Phonon::PausedState) ||
|
||||
(newstate == Phonon::StoppedState))
|
||||
{
|
||||
nowPlayingConfiguration=NULL;
|
||||
if(!pendingNotifications.isEmpty())
|
||||
{
|
||||
NotifyPluginConfiguration* notification = pendingNotifications.takeFirst();
|
||||
#ifdef DEBUG_NOTIFIES
|
||||
qDebug() << "play audioFree - " << notification->parseNotifyMessage();
|
||||
#endif
|
||||
playNotification(notification);
|
||||
}
|
||||
}
|
||||
if(newstate == Phonon::ErrorState)
|
||||
{
|
||||
if(phonon.mo->errorType()==0) {
|
||||
qDebug() << "Phonon::ErrorState: ErrorType = " << phonon.mo->errorType();
|
||||
phonon.mo->clear();
|
||||
}
|
||||
}
|
||||
// if(newstate == Phonon::BufferingState)
|
||||
// qDebug() << "Phonon::BufferingState!!!";
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(SoundNotifyPlugin)
|
||||
|
@ -28,8 +28,10 @@
|
||||
#define SOUNDNOTIFYPLUGIN_H
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
#include "uavtalk/telemetrymanager.h"
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
#include "uavobjects/uavobject.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <phonon>
|
||||
|
||||
@ -39,6 +41,7 @@ class NotifyPluginConfiguration;
|
||||
typedef struct {
|
||||
Phonon::MediaObject* mo;
|
||||
QList<Phonon::MediaSource>* ms;
|
||||
NotifyPluginConfiguration* notify;
|
||||
} PhononObject, *pPhononObject;
|
||||
|
||||
class SoundNotifyPlugin : public ExtensionSystem::IPlugin
|
||||
@ -54,10 +57,11 @@ public:
|
||||
|
||||
|
||||
QList<NotifyPluginConfiguration*> getListNotifications() { return lstNotifications; }
|
||||
void setListNotifications(QList<NotifyPluginConfiguration*>& list_notify) { lstNotifications=list_notify; }
|
||||
//void setListNotifications(QList<NotifyPluginConfiguration*>& list_notify) { }
|
||||
|
||||
bool getEnableSound() const { return enableSound; }
|
||||
void setEnableSound(bool value) {enableSound = value; }
|
||||
|
||||
bool getEnableSound() const { return enableSound; }
|
||||
void setEnableSound(bool value) {enableSound = value; }
|
||||
|
||||
|
||||
private:
|
||||
@ -65,21 +69,36 @@ private:
|
||||
QList< QList<Phonon::MediaSource>* > lstMediaSource;
|
||||
QStringList mediaSource;
|
||||
//QMap<QString, Phonon::MediaObject*> mapMediaObjects;
|
||||
QMap<QString, PhononObject> mapMediaObjects;
|
||||
QMultiMap<QString, PhononObject> mapMediaObjects;
|
||||
|
||||
QSettings* settings;
|
||||
|
||||
QList<UAVDataObject*> lstNotifiedUAVObjects;
|
||||
|
||||
QList<NotifyPluginConfiguration*> lstNotifications;
|
||||
QList<NotifyPluginConfiguration*> pendingNotifications;
|
||||
QList<NotifyPluginConfiguration*> removedNotifies;
|
||||
|
||||
NotifyPluginConfiguration* nowPlayingConfiguration;
|
||||
|
||||
QString m_field;
|
||||
|
||||
|
||||
PhononObject phonon;
|
||||
NotifyPluginOptionsPage *mop;
|
||||
TelemetryManager* telMngr;
|
||||
|
||||
bool playNotification(NotifyPluginConfiguration* notification);
|
||||
void checkNotificationRule(NotifyPluginConfiguration* notification, UAVObject* object);
|
||||
|
||||
private slots:
|
||||
void onTelemetryManagerAdded(QObject* obj);
|
||||
void onAutopilotDisconnect();
|
||||
void connectNotifications();
|
||||
void playNotification(UAVObject *object);
|
||||
void updateNotificationList(QList<NotifyPluginConfiguration*> list);
|
||||
void resetNotification(void);
|
||||
void appendNotification(UAVObject *object);
|
||||
void repeatTimerHandler(void);
|
||||
void expireTimerHandler(void);
|
||||
void stateChanged(Phonon::State newstate, Phonon::State oldstate);
|
||||
};
|
||||
|
||||
#endif // SOUNDNOTIFYPLUGIN_H
|
||||
|
@ -1 +1,3 @@
|
||||
include(../../plugins/uavtalk/uavtalk.pri)
|
||||
include(../../plugins/uavobjects/uavobjects.pri)
|
||||
|
||||
|
@ -31,6 +31,8 @@
|
||||
|
||||
|
||||
NotifyPluginConfiguration::NotifyPluginConfiguration(QObject *parent) :
|
||||
isNowPlaying(0),
|
||||
firstStart(1),
|
||||
soundCollectionPath(""),
|
||||
currentLanguage("default"),
|
||||
dataObject(""),
|
||||
@ -38,11 +40,16 @@ NotifyPluginConfiguration::NotifyPluginConfiguration(QObject *parent) :
|
||||
value("Equal to"),
|
||||
sound1(""),
|
||||
sound2(""),
|
||||
sound3(""),
|
||||
sayOrder("Never"),
|
||||
spinBoxValue(0),
|
||||
repeatString("Continue")
|
||||
{
|
||||
repeatString("Repeat Instantly"),
|
||||
repeatTimeout(true),
|
||||
expireTimeout(15)
|
||||
|
||||
{
|
||||
timer = NULL;
|
||||
expireTimer = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -56,8 +63,10 @@ void NotifyPluginConfiguration::saveState(QSettings* settings) const
|
||||
settings->setValue(QLatin1String("ValueSpinBox"), getSpinBoxValue());
|
||||
settings->setValue(QLatin1String("Sound1"), getSound1());
|
||||
settings->setValue(QLatin1String("Sound2"), getSound2());
|
||||
settings->setValue(QLatin1String("Sound3"), getSound3());
|
||||
settings->setValue(QLatin1String("SayOrder"), getSayOrder());
|
||||
settings->setValue(QLatin1String("Repeat"), getRepeatFlag());
|
||||
settings->setValue(QLatin1String("ExpireTimeout"), getExpireTimeout());
|
||||
}
|
||||
|
||||
void NotifyPluginConfiguration::restoreState(QSettings* settings)
|
||||
@ -70,9 +79,11 @@ void NotifyPluginConfiguration::restoreState(QSettings* settings)
|
||||
setValue(settings->value(QLatin1String("Value"), tr("")).toString());
|
||||
setSound1(settings->value(QLatin1String("Sound1"), tr("")).toString());
|
||||
setSound2(settings->value(QLatin1String("Sound2"), tr("")).toString());
|
||||
setSound3(settings->value(QLatin1String("Sound3"), tr("")).toString());
|
||||
setSayOrder(settings->value(QLatin1String("SayOrder"), tr("")).toString());
|
||||
setSpinBoxValue(settings->value(QLatin1String("ValueSpinBox"), tr("")).toDouble());
|
||||
setRepeatFlag(settings->value(QLatin1String("Repeat"), tr("")).toString());
|
||||
setExpireTimeout(settings->value(QLatin1String("ExpireTimeout"), tr("")).toInt());
|
||||
}
|
||||
|
||||
|
||||
@ -104,29 +115,42 @@ QString NotifyPluginConfiguration::parseNotifyMessage()
|
||||
notifyMessageList.append(getSoundCollectionPath()+"\\default\\"+getSound2()+".wav");
|
||||
}
|
||||
|
||||
if(getSound3()!="")
|
||||
{
|
||||
if(QFile::exists(getSoundCollectionPath()+"\\"+getCurrentLanguage()+"\\"+getSound3()+".wav"))
|
||||
notifyMessageList.append(getSoundCollectionPath()+"\\"+getCurrentLanguage()+"\\"+getSound3()+".wav");
|
||||
else
|
||||
if(QFile::exists(getSoundCollectionPath()+"\\"+"\\default\\"+"\\"+getSound3()+".wav"))
|
||||
notifyMessageList.append(getSoundCollectionPath()+"\\default\\"+getSound3()+".wav");
|
||||
}
|
||||
|
||||
switch(str1.at(0).toAscii())
|
||||
{
|
||||
case 'N'://NEVER:
|
||||
str = getSound1()+" "+getSound2();
|
||||
str = getSound1()+" "+getSound2()+" "+getSound3();
|
||||
position = 0xFF;
|
||||
break;
|
||||
|
||||
case 'B'://BEFORE:
|
||||
str = QString("%L1 ").arg(getSpinBoxValue())+getSound1()+" "+getSound2();
|
||||
str = QString("%L1 ").arg(getSpinBoxValue())+getSound1()+" "+getSound2()+" "+getSound3();
|
||||
position = 0;
|
||||
break;
|
||||
|
||||
case 'A'://AFTER1:
|
||||
case 'A'://AFTER:
|
||||
switch(str1.at(6).toAscii())
|
||||
{
|
||||
case 'f':
|
||||
str = getSound1()+QString(" %L1 ").arg(getSpinBoxValue())+getSound2();
|
||||
str = getSound1()+QString(" %L1 ").arg(getSpinBoxValue())+getSound2()+" "+getSound3();
|
||||
position = 1;
|
||||
break;
|
||||
case 's':
|
||||
str = getSound1()+" "+getSound2()+QString(" %L1").arg(getSpinBoxValue());
|
||||
str = getSound1()+" "+getSound2()+QString(" %L1").arg(getSpinBoxValue())+" "+getSound3();
|
||||
position = 2;
|
||||
break;
|
||||
case 't':
|
||||
str = getSound1()+" "+getSound2()+" "+getSound3()+QString(" %L1").arg(getSpinBoxValue());
|
||||
position = 3;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <coreplugin/iuavgadgetconfiguration.h>
|
||||
#include "qsettings.h"
|
||||
#include <qstringlist.h>
|
||||
#include <qtimer>
|
||||
|
||||
using namespace Core;
|
||||
|
||||
@ -40,12 +41,20 @@ class NotifyPluginConfiguration : public QObject
|
||||
public:
|
||||
explicit NotifyPluginConfiguration(QObject *parent = 0);
|
||||
|
||||
QTimer* timer;
|
||||
QTimer* expireTimer;
|
||||
bool isNowPlaying; //
|
||||
bool firstStart;
|
||||
|
||||
QString getSound1() const { return sound1; }
|
||||
void setSound1(QString text) {sound1 = text; }
|
||||
|
||||
QString getSound2() const { return sound2; }
|
||||
void setSound2(QString text) {sound2 = text; }
|
||||
|
||||
QString getSound3() const { return sound3; }
|
||||
void setSound3(QString text) {sound3 = text; }
|
||||
|
||||
QString getValue() const { return value; }
|
||||
void setValue(QString text) {value = text; }
|
||||
|
||||
@ -74,6 +83,14 @@ public:
|
||||
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; }
|
||||
|
||||
|
||||
|
||||
void saveState(QSettings* settings) const;
|
||||
void restoreState(QSettings* settings);
|
||||
QString parseNotifyMessage();
|
||||
@ -88,12 +105,16 @@ private:
|
||||
QString value;
|
||||
QString sound1;
|
||||
QString sound2;
|
||||
QString sound3;
|
||||
QString sayOrder;
|
||||
double spinBoxValue;
|
||||
QString repeatString;
|
||||
bool repeatTimeout;
|
||||
int repeatTimerValue;
|
||||
int expireTimeout;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Q_DECLARE_METATYPE(NotifyPluginConfiguration*)
|
||||
|
||||
#endif // NOTIFYPLUGINCONFIGURATION_H
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
#include "notifyplugin.h"
|
||||
#include "notifyitemdelegate.h"
|
||||
#include "notifytablemodel.h"
|
||||
|
||||
NotifyPluginOptionsPage::NotifyPluginOptionsPage(/*NotifyPluginConfiguration *config,*/ QObject *parent) :
|
||||
IOptionsPage(parent),
|
||||
@ -61,26 +62,22 @@ QWidget *NotifyPluginOptionsPage::createPage(QWidget *parent)
|
||||
QWidget *optionsPageWidget = new QWidget;
|
||||
//main layout
|
||||
options_page->setupUi(optionsPageWidget);
|
||||
|
||||
delegateItems.clear();
|
||||
delegateItems << "Continue" << "Once";
|
||||
privListNotifications.clear();
|
||||
listSoundFiles.clear();
|
||||
|
||||
delegateItems << "Repeat Once"
|
||||
<< "Repeat Instantly"
|
||||
<< "Repeat 10 seconds"
|
||||
<< "Repeat 30 seconds"
|
||||
<< "Repeat 1 minute";
|
||||
|
||||
options_page->chkEnableSound->setChecked(owner->getEnableSound());
|
||||
options_page->SoundDirectoryPathChooser->setExpectedKind(Utils::PathChooser::Directory);
|
||||
options_page->SoundDirectoryPathChooser->setPromptDialogTitle(tr("Choose sound collection directory"));
|
||||
// connect(options_page->tableNotifications->model(),SIGNAL(rowsInserted ( const QModelIndex & , int , int )),this,
|
||||
// SLOT(showPersistentComboBox ( const QModelIndex & , int , int )));
|
||||
// connect(options_page->tableNotifications->model(),SIGNAL(dataChanged ( const QModelIndex & , const QModelIndex & )),this,
|
||||
// SLOT(showPersistentComboBox2( const QModelIndex & , const QModelIndex & )));
|
||||
|
||||
|
||||
options_page->tableNotifications->setRowCount(0);
|
||||
options_page->tableNotifications->setItemDelegate(new NotifyItemDelegate(delegateItems,options_page->tableNotifications));
|
||||
|
||||
QStringList labels;
|
||||
labels << "Name" << "Repeats";
|
||||
options_page->tableNotifications->setHorizontalHeaderLabels(labels);
|
||||
privListNotifications.clear();
|
||||
listSoundFiles.clear();
|
||||
|
||||
settings = Core::ICore::instance()->settings();
|
||||
settings->beginGroup(QLatin1String("NotifyPlugin"));
|
||||
@ -101,13 +98,18 @@ QWidget *NotifyPluginOptionsPage::createPage(QWidget *parent)
|
||||
connect(options_page->buttonAdd, SIGNAL(pressed()), this, SLOT(on_buttonAddNotification_clicked()));
|
||||
connect(options_page->buttonDelete, SIGNAL(pressed()), this, SLOT(on_buttonDeleteNotification_clicked()));
|
||||
connect(options_page->buttonModify, SIGNAL(pressed()), this, SLOT(on_buttonModifyNotification_clicked()));
|
||||
connect(options_page->buttonTestSound1, SIGNAL(clicked()), this, SLOT(on_buttonTestSound1_clicked()));
|
||||
connect(options_page->buttonTestSound2, SIGNAL(clicked()), this, SLOT(on_buttonTestSound2_clicked()));
|
||||
// connect(options_page->buttonTestSound1, SIGNAL(clicked()), this, SLOT(on_buttonTestSound1_clicked()));
|
||||
// connect(options_page->buttonTestSound2, SIGNAL(clicked()), this, SLOT(on_buttonTestSound2_clicked()));
|
||||
connect(options_page->buttonPlayNotification, SIGNAL(clicked()), this, SLOT(on_buttonTestSoundNotification_clicked()));
|
||||
connect(options_page->chkEnableSound, SIGNAL(toggled(bool)), this, SLOT(on_chkEnableSound_toggled(bool)));
|
||||
connect(options_page->tableNotifications, SIGNAL(itemSelectionChanged()), this, SLOT(on_tableNotification_changeSelection()));
|
||||
|
||||
|
||||
connect(options_page->UAVObject, SIGNAL(currentIndexChanged(QString)), this, SLOT(on_UAVObject_indexChanged(QString)));
|
||||
connect(this, SIGNAL(updateNotifications()), owner, SLOT(connectNotifications()));
|
||||
connect(this, SIGNAL(updateNotifications(QList<NotifyPluginConfiguration*>)),
|
||||
owner, SLOT(updateNotificationList(QList<NotifyPluginConfiguration*>)));
|
||||
connect(this, SIGNAL(resetNotification()),owner, SLOT(resetNotification()));
|
||||
|
||||
//emit resetNotification();
|
||||
|
||||
int size = settings->beginReadArray("listNotifies");
|
||||
for (int i = 0; i < size; ++i) {
|
||||
@ -127,35 +129,43 @@ QWidget *NotifyPluginOptionsPage::createPage(QWidget *parent)
|
||||
options_page->chkEnableSound->setChecked(settings->value(QLatin1String("EnableSound"),0).toBool());
|
||||
settings->endGroup();
|
||||
|
||||
foreach(NotifyPluginConfiguration* notification,privListNotifications)
|
||||
{
|
||||
options_page->tableNotifications->setRowCount(options_page->tableNotifications->rowCount()+1);
|
||||
options_page->tableNotifications->setItem (options_page->tableNotifications->rowCount()-1,0,
|
||||
new QTableWidgetItem(notification->parseNotifyMessage()));
|
||||
QStringList headerStrings;
|
||||
headerStrings << "Name" << "Repeats" << "Lifetime,sec";
|
||||
|
||||
QString str = notification->getRepeatFlag();
|
||||
options_page->tableNotifications->setItem (options_page->tableNotifications->rowCount()-1,1,
|
||||
new QTableWidgetItem(str));
|
||||
notifyRulesModel = new NotifyTableModel(&privListNotifications,headerStrings);
|
||||
options_page->notifyRulesView->setModel(notifyRulesModel);
|
||||
options_page->notifyRulesView->resizeRowsToContents();
|
||||
notifyRulesSelection = new QItemSelectionModel(notifyRulesModel);
|
||||
connect(notifyRulesSelection, SIGNAL(selectionChanged ( const QItemSelection &, const QItemSelection & )),
|
||||
this, SLOT(on_tableNotification_changeSelection( const QItemSelection & , const QItemSelection & )));
|
||||
connect(this, SIGNAL(entryUpdated(int)),
|
||||
notifyRulesModel, SLOT(entryUpdated(int)));
|
||||
connect(this, SIGNAL(entryAdded(int)),
|
||||
notifyRulesModel, SLOT(entryAdded(int)));
|
||||
|
||||
options_page->notifyRulesView->setSelectionModel(notifyRulesSelection);
|
||||
options_page->notifyRulesView->setItemDelegate(new NotifyItemDelegate(delegateItems,this));
|
||||
|
||||
}
|
||||
options_page->notifyRulesView->setColumnWidth(0,200);
|
||||
options_page->notifyRulesView->setColumnWidth(1,150);
|
||||
options_page->notifyRulesView->setColumnWidth(2,100);
|
||||
|
||||
options_page->buttonModify->setEnabled(false);
|
||||
options_page->buttonDelete->setEnabled(false);
|
||||
options_page->buttonPlayNotification->setEnabled(false);
|
||||
|
||||
sound1 = Phonon::createPlayer(Phonon::NotificationCategory);
|
||||
sound2 = Phonon::createPlayer(Phonon::NotificationCategory);
|
||||
// sound1 = Phonon::createPlayer(Phonon::NotificationCategory);
|
||||
// sound2 = Phonon::createPlayer(Phonon::NotificationCategory);
|
||||
notifySound = Phonon::createPlayer(Phonon::NotificationCategory);
|
||||
// audioOutput = new Phonon::AudioOutput(Phonon::NotificationCategory, this);
|
||||
// Phonon::createPath(sound1, audioOutput);
|
||||
// Phonon::createPath(sound2, audioOutput);
|
||||
// Phonon::createPath(notifySound, audioOutput);
|
||||
|
||||
connect(sound1,SIGNAL(stateChanged(Phonon::State,Phonon::State)),SLOT(changeButtonText(Phonon::State,Phonon::State)));
|
||||
connect(sound2,SIGNAL(stateChanged(Phonon::State,Phonon::State)),SLOT(changeButtonText(Phonon::State,Phonon::State)));
|
||||
connect(notifySound,SIGNAL(stateChanged(Phonon::State,Phonon::State)),SLOT(changeButtonText(Phonon::State,Phonon::State)));
|
||||
|
||||
// connect(sound1,SIGNAL(stateChanged(Phonon::State,Phonon::State)),SLOT(changeButtonText(Phonon::State,Phonon::State)));
|
||||
// connect(sound2,SIGNAL(stateChanged(Phonon::State,Phonon::State)),SLOT(changeButtonText(Phonon::State,Phonon::State)));
|
||||
connect(notifySound,SIGNAL(stateChanged(Phonon::State,Phonon::State)),
|
||||
this,SLOT(changeButtonText(Phonon::State,Phonon::State)));
|
||||
|
||||
return optionsPageWidget;
|
||||
}
|
||||
@ -171,7 +181,7 @@ void NotifyPluginOptionsPage::showPersistentComboBox2( const QModelIndex & topLe
|
||||
{
|
||||
//for (QModelIndex i=topLeft; i<bottomRight+1; i++)
|
||||
{
|
||||
options_page->tableNotifications->openPersistentEditor(options_page->tableNotifications->item(options_page->tableNotifications->currentRow(),1));
|
||||
// options_page->tableNotifications->openPersistentEditor(options_page->tableNotifications->item(options_page->tableNotifications->currentRow(),1));
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,14 +194,16 @@ void NotifyPluginOptionsPage::getOptionsPageValues(NotifyPluginConfiguration* no
|
||||
notification->setObjectField(options_page->UAVObjectField->currentText());
|
||||
notification->setSound1(options_page->Sound1->currentText());
|
||||
notification->setSound2(options_page->Sound2->currentText());
|
||||
notification->setSound3(options_page->Sound3->currentText());
|
||||
notification->setSayOrder(options_page->SayOrder->currentText());
|
||||
notification->setValue(options_page->Value->currentText());
|
||||
notification->setSpinBoxValue(options_page->ValueSpinBox->value());
|
||||
if(options_page->tableNotifications->currentRow()>-1)
|
||||
{
|
||||
qDebug() << "delegate value:" << options_page->tableNotifications->item(options_page->tableNotifications->currentRow(),1)->data(Qt::EditRole);
|
||||
notification->setRepeatFlag(options_page->tableNotifications->item(options_page->tableNotifications->currentRow(),1)->data(Qt::EditRole).toString());
|
||||
}
|
||||
|
||||
// if(notifyRulesSelection->currentIndex().row()>-1)
|
||||
// {
|
||||
// //qDebug() << "delegate value:" << options_page->tableNotifications->item(options_page->tableNotifications->currentRow(),1)->data(Qt::EditRole);
|
||||
// notification->setRepeatFlag(notifyRulesModel->data(notifyRulesSelection->currentIndex(),Qt::DisplayRole).toString());
|
||||
// }
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
@ -213,14 +225,12 @@ void NotifyPluginOptionsPage::apply()
|
||||
notification.saveState(settings);
|
||||
settings->endArray();
|
||||
|
||||
//settings->remove("listNotifies");
|
||||
|
||||
settings->beginGroup("listNotifies");
|
||||
settings->remove("");
|
||||
settings->endGroup();
|
||||
|
||||
settings->beginWriteArray("listNotifies");
|
||||
for (int i = 0; i < options_page->tableNotifications->rowCount(); i++) {
|
||||
for (int i = 0; i < privListNotifications.size(); i++) {
|
||||
settings->setArrayIndex(i);
|
||||
privListNotifications.at(i)->saveState(settings);
|
||||
}
|
||||
@ -229,12 +239,20 @@ void NotifyPluginOptionsPage::apply()
|
||||
settings->endGroup();
|
||||
|
||||
owner->setEnableSound(options_page->chkEnableSound->isChecked());
|
||||
owner->setListNotifications(privListNotifications);
|
||||
emit updateNotifications();
|
||||
//owner->setListNotifications(privListNotifications);
|
||||
emit updateNotifications(privListNotifications);
|
||||
}
|
||||
|
||||
void NotifyPluginOptionsPage::finish()
|
||||
{
|
||||
disconnect(notifySound,SIGNAL(stateChanged(Phonon::State,Phonon::State)),
|
||||
this,SLOT(changeButtonText(Phonon::State,Phonon::State)));
|
||||
if(notifySound)
|
||||
{
|
||||
notifySound->stop();
|
||||
notifySound->clear();
|
||||
}
|
||||
|
||||
delete options_page;
|
||||
}
|
||||
|
||||
@ -258,14 +276,10 @@ void NotifyPluginOptionsPage::on_UAVObject_indexChanged(QString val) {
|
||||
// locate collection folder on disk
|
||||
void NotifyPluginOptionsPage::on_buttonSoundFolder_clicked(const QString& path)
|
||||
{
|
||||
//disconnect(options_page->SoundCollectionList, SIGNAL(currentIndexChanged (int)), this, SLOT(on_soundLanguage_indexChanged(int)));
|
||||
|
||||
QDir dirPath(path);
|
||||
listDirCollections = dirPath.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
|
||||
options_page->SoundCollectionList->clear();
|
||||
options_page->SoundCollectionList->addItems(listDirCollections);
|
||||
|
||||
//connect(options_page->SoundCollectionList, SIGNAL(currentIndexChanged (int)), this, SLOT(on_soundLanguage_indexChanged(int)));
|
||||
}
|
||||
|
||||
|
||||
@ -283,100 +297,39 @@ void NotifyPluginOptionsPage::on_soundLanguage_indexChanged(int index)
|
||||
listSoundFiles.replaceInStrings(QRegExp(".mp3|.wav"), "");
|
||||
options_page->Sound1->clear();
|
||||
options_page->Sound2->clear();
|
||||
options_page->Sound3->clear();
|
||||
options_page->Sound1->addItems(listSoundFiles);
|
||||
options_page->Sound2->addItems(listSoundFiles);
|
||||
options_page->Sound2->addItem("");
|
||||
options_page->Sound2->addItems(listSoundFiles);
|
||||
options_page->Sound3->addItem("");
|
||||
options_page->Sound3->addItems(listSoundFiles);
|
||||
|
||||
}
|
||||
|
||||
void NotifyPluginOptionsPage::changeButtonText(Phonon::State newstate, Phonon::State oldstate)
|
||||
{
|
||||
if(sender()==sound1)
|
||||
{
|
||||
if(newstate == Phonon::PausedState) {
|
||||
options_page->buttonTestSound1->setText("Play");
|
||||
options_page->buttonTestSound1->setIcon(QPixmap(":/notify/images/play.png"));
|
||||
}
|
||||
else
|
||||
if(newstate == Phonon::PlayingState) {
|
||||
options_page->buttonTestSound1->setText("Stop");
|
||||
options_page->buttonTestSound1->setIcon(QPixmap(":/notify/images/stop.png"));
|
||||
}
|
||||
if(newstate == Phonon::PausedState || newstate == Phonon::StoppedState){
|
||||
options_page->buttonPlayNotification->setText("Play");
|
||||
options_page->buttonPlayNotification->setIcon(QPixmap(":/notify/images/play.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sender()==sound2)
|
||||
{
|
||||
if(newstate == Phonon::PausedState) {
|
||||
options_page->buttonTestSound2->setText("Play");
|
||||
options_page->buttonTestSound2->setIcon(QPixmap(":/notify/images/play.png"));
|
||||
}
|
||||
else
|
||||
if(newstate == Phonon::PlayingState) {
|
||||
options_page->buttonTestSound2->setText("Stop");
|
||||
options_page->buttonTestSound2->setIcon(QPixmap(":/notify/images/stop.png"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sender()==notifySound)
|
||||
{
|
||||
if(newstate == Phonon::PausedState){
|
||||
options_page->buttonPlayNotification->setText("Play");
|
||||
options_page->buttonPlayNotification->setIcon(QPixmap(":/notify/images/play.png"));
|
||||
}
|
||||
else
|
||||
if(newstate == Phonon::PlayingState) {
|
||||
options_page->buttonPlayNotification->setText("Stop");
|
||||
options_page->buttonPlayNotification->setIcon(QPixmap(":/notify/images/stop.png"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(newstate == Phonon::PlayingState) {
|
||||
options_page->buttonPlayNotification->setText("Stop");
|
||||
options_page->buttonPlayNotification->setIcon(QPixmap(":/notify/images/stop.png"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void NotifyPluginOptionsPage::on_buttonTestSound1_clicked()
|
||||
{
|
||||
if(options_page->Sound1->currentText()=="") return;
|
||||
|
||||
QFile file;
|
||||
QString currPath = options_page->SoundDirectoryPathChooser->path()+"\\"+
|
||||
options_page->SoundCollectionList->currentText()+"\\"+options_page->Sound1->currentText()+".wav";
|
||||
//currPath.replace(QString("\\"), QString("/"));
|
||||
|
||||
// file.setFileName(currPath);
|
||||
// file.open(QIODevice::ReadOnly);
|
||||
// QDataStream in(&file); // read the data serialized from the file
|
||||
// QByteArray buf;
|
||||
// in >> buf;
|
||||
|
||||
sound1->setCurrentSource(Phonon::MediaSource(currPath));
|
||||
sound1->play();
|
||||
}
|
||||
|
||||
void NotifyPluginOptionsPage::on_buttonTestSound2_clicked()
|
||||
{
|
||||
if(options_page->Sound2->currentText()=="") return;
|
||||
|
||||
QFile file;
|
||||
QString currPath = options_page->SoundDirectoryPathChooser->path()+"\\"+
|
||||
options_page->SoundCollectionList->currentText()+"\\"+options_page->Sound2->currentText()+".wav";
|
||||
//currPath.replace(QString("\\"), QString("/"));
|
||||
|
||||
sound2->setCurrentSource(Phonon::MediaSource(currPath));
|
||||
sound2->play();
|
||||
}
|
||||
|
||||
void NotifyPluginOptionsPage::on_buttonTestSoundNotification_clicked()
|
||||
{
|
||||
QList <Phonon::MediaSource> messageNotify;
|
||||
NotifyPluginConfiguration* notification = new NotifyPluginConfiguration;
|
||||
//getOptionsPageValues();
|
||||
if(options_page->tableNotifications->currentRow()==-1) return;
|
||||
notification = privListNotifications.at(options_page->tableNotifications->currentRow());
|
||||
|
||||
if(notifyRulesSelection->currentIndex().row()==-1) return;
|
||||
|
||||
notification = privListNotifications.at(notifyRulesSelection->currentIndex().row());
|
||||
notification->parseNotifyMessage();
|
||||
QStringList stringList = notification->getNotifyMessageList();
|
||||
foreach(QString item, stringList)
|
||||
foreach(QString item, notification->getNotifyMessageList())
|
||||
messageNotify.append(Phonon::MediaSource(item));
|
||||
notifySound->clear();
|
||||
notifySound->setQueue(messageNotify);
|
||||
@ -386,21 +339,10 @@ void NotifyPluginOptionsPage::on_buttonTestSoundNotification_clicked()
|
||||
void NotifyPluginOptionsPage::on_chkEnableSound_toggled(bool state)
|
||||
{
|
||||
bool state1 = 1^state;
|
||||
{
|
||||
QList<Phonon::Path> listOutputs = sound1->outputPaths();
|
||||
Phonon::AudioOutput * audioOutput = (Phonon::AudioOutput*)listOutputs.last().sink();
|
||||
audioOutput->setMuted(state1);
|
||||
}
|
||||
{
|
||||
QList<Phonon::Path> listOutputs = sound2->outputPaths();
|
||||
Phonon::AudioOutput * audioOutput = (Phonon::AudioOutput*)listOutputs.last().sink();
|
||||
audioOutput->setMuted(state1);
|
||||
}
|
||||
{
|
||||
QList<Phonon::Path> listOutputs = notifySound->outputPaths();
|
||||
Phonon::AudioOutput * audioOutput = (Phonon::AudioOutput*)listOutputs.last().sink();
|
||||
audioOutput->setMuted(state1);
|
||||
}
|
||||
|
||||
QList<Phonon::Path> listOutputs = notifySound->outputPaths();
|
||||
Phonon::AudioOutput * audioOutput = (Phonon::AudioOutput*)listOutputs.last().sink();
|
||||
audioOutput->setMuted(state1);
|
||||
}
|
||||
|
||||
void NotifyPluginOptionsPage::updateConfigView(NotifyPluginConfiguration* notification)
|
||||
@ -456,8 +398,7 @@ void NotifyPluginOptionsPage::updateConfigView(NotifyPluginConfiguration* notifi
|
||||
if(options_page->Sound2->findText(notification->getSound2())!=-1) {
|
||||
options_page->Sound2->setCurrentIndex(options_page->Sound2->findText(notification->getSound2()));
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// show item from default location
|
||||
options_page->SoundCollectionList->setCurrentIndex(options_page->SoundCollectionList->findText("default"));
|
||||
options_page->Sound2->setCurrentIndex(options_page->Sound2->findText(notification->getSound2()));
|
||||
@ -466,6 +407,15 @@ void NotifyPluginOptionsPage::updateConfigView(NotifyPluginConfiguration* notifi
|
||||
//options_page->Sound2->setCurrentIndex(-1);
|
||||
}
|
||||
|
||||
if(options_page->Sound3->findText(notification->getSound3())!=-1) {
|
||||
options_page->Sound3->setCurrentIndex(options_page->Sound3->findText(notification->getSound3()));
|
||||
}
|
||||
else {
|
||||
// show item from default location
|
||||
options_page->SoundCollectionList->setCurrentIndex(options_page->SoundCollectionList->findText("default"));
|
||||
options_page->Sound3->setCurrentIndex(options_page->Sound3->findText(notification->getSound3()));
|
||||
}
|
||||
|
||||
if(options_page->Value->findText(notification->getValue())!=-1) {
|
||||
options_page->Value->setCurrentIndex(options_page->Value->findText(notification->getValue()));
|
||||
}
|
||||
@ -476,18 +426,22 @@ void NotifyPluginOptionsPage::updateConfigView(NotifyPluginConfiguration* notifi
|
||||
options_page->ValueSpinBox->setValue(notification->getSpinBoxValue());
|
||||
}
|
||||
|
||||
void NotifyPluginOptionsPage::on_tableNotification_changeSelection()
|
||||
void NotifyPluginOptionsPage::on_tableNotification_changeSelection( const QItemSelection & selected, const QItemSelection & deselected )
|
||||
{
|
||||
QTableWidgetItem * item = options_page->tableNotifications->item(options_page->tableNotifications->currentRow(),0);
|
||||
bool select = true;
|
||||
notifySound->stop();
|
||||
if(selected.indexes().size())
|
||||
updateConfigView(privListNotifications.at(selected.indexes().at(0).row()));
|
||||
else
|
||||
select = false;
|
||||
|
||||
if(!item) return;
|
||||
|
||||
updateConfigView(privListNotifications.at(item->row()));
|
||||
options_page->buttonModify->setEnabled(item->isSelected());
|
||||
options_page->buttonDelete->setEnabled(item->isSelected());
|
||||
options_page->buttonPlayNotification->setEnabled(item->isSelected());
|
||||
options_page->buttonModify->setEnabled(select);
|
||||
options_page->buttonDelete->setEnabled(select);
|
||||
options_page->buttonPlayNotification->setEnabled(select);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void NotifyPluginOptionsPage::on_buttonAddNotification_clicked()
|
||||
{
|
||||
NotifyPluginConfiguration* notification = new NotifyPluginConfiguration;
|
||||
@ -512,40 +466,25 @@ void NotifyPluginOptionsPage::on_buttonAddNotification_clicked()
|
||||
notification->setSound1(options_page->Sound1->currentText());
|
||||
|
||||
notification->setSound2(options_page->Sound2->currentText());
|
||||
notification->setSound3(options_page->Sound3->currentText());
|
||||
|
||||
if((options_page->Sound2->currentText()=="")&&(options_page->SayOrder->currentText()=="After second"))
|
||||
if(((options_page->Sound2->currentText()=="")&&(options_page->SayOrder->currentText()=="After second"))
|
||||
|| ((options_page->Sound3->currentText()=="")&&(options_page->SayOrder->currentText()=="After third")))
|
||||
return;
|
||||
else
|
||||
notification->setSayOrder(options_page->SayOrder->currentText());
|
||||
|
||||
int row = options_page->tableNotifications->rowCount();
|
||||
options_page->tableNotifications->setRowCount(row+1);
|
||||
row = options_page->tableNotifications->rowCount();
|
||||
options_page->tableNotifications->setItem (row-1,0,new QTableWidgetItem(notification->parseNotifyMessage()));
|
||||
options_page->tableNotifications->setItem (row-1,1,new QTableWidgetItem(delegateItems.first()));
|
||||
//options_page->tableNotifications->openPersistentEditor(options_page->tableNotifications->item(row-1,1));
|
||||
|
||||
privListNotifications.append(notification);
|
||||
emit entryAdded(privListNotifications.size()-1);
|
||||
notifyRulesSelection->setCurrentIndex(notifyRulesModel->index(privListNotifications.size()-1,0,QModelIndex()),
|
||||
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
||||
}
|
||||
|
||||
|
||||
void NotifyPluginOptionsPage::on_buttonDeleteNotification_clicked()
|
||||
{
|
||||
QTableWidgetItem * item = options_page->tableNotifications->currentItem();
|
||||
int row = item->row();
|
||||
privListNotifications.removeAt(row);
|
||||
|
||||
// if(!privListNotifications.size())
|
||||
// notify = new NotifyPluginConfiguration;
|
||||
|
||||
if(options_page->tableNotifications->rowCount()>1 && row < options_page->tableNotifications->rowCount()-1
|
||||
/*&& row*/)
|
||||
if(item->isSelected())
|
||||
item->setSelected(false);
|
||||
|
||||
options_page->tableNotifications->removeRow(row);
|
||||
|
||||
if(!options_page->tableNotifications->rowCount())
|
||||
notifyRulesModel->removeRow(notifyRulesSelection->currentIndex().row());
|
||||
if(!notifyRulesModel->rowCount() && (notifyRulesSelection->currentIndex().row() > 0 && notifyRulesSelection->currentIndex().row() < notifyRulesModel->rowCount()))
|
||||
{
|
||||
options_page->buttonDelete->setEnabled(false);
|
||||
options_page->buttonModify->setEnabled(false);
|
||||
@ -557,13 +496,10 @@ void NotifyPluginOptionsPage::on_buttonDeleteNotification_clicked()
|
||||
void NotifyPluginOptionsPage::on_buttonModifyNotification_clicked()
|
||||
{
|
||||
NotifyPluginConfiguration* notification = new NotifyPluginConfiguration;
|
||||
//NotifyPluginConfiguration notification;
|
||||
|
||||
QTableWidgetItem * item = options_page->tableNotifications->item(options_page->tableNotifications->currentRow(),0);
|
||||
if(!item) return;
|
||||
//notify = privListNotifications.at(item->row()); // ???
|
||||
getOptionsPageValues(notification);
|
||||
privListNotifications.replace(item->row(),notification);
|
||||
item->setText(notification->parseNotifyMessage());
|
||||
notification->setRepeatFlag(privListNotifications.at(notifyRulesSelection->currentIndex().row())->getRepeatFlag());
|
||||
privListNotifications.replace(notifyRulesSelection->currentIndex().row(),notification);
|
||||
entryUpdated(notifyRulesSelection->currentIndex().row());
|
||||
|
||||
}
|
||||
|
||||
|
@ -35,10 +35,13 @@
|
||||
|
||||
#include "QString"
|
||||
#include <QStringList>
|
||||
#include <QItemSelectionModel>
|
||||
#include <QDebug>
|
||||
#include <QtCore/QSettings>
|
||||
#include <phonon>
|
||||
|
||||
class NotifyTableModel;
|
||||
|
||||
class NotifyPluginConfiguration;
|
||||
class SoundNotifyPlugin;
|
||||
|
||||
@ -83,27 +86,32 @@ private:
|
||||
Phonon::MediaObject *notifySound;
|
||||
Phonon::AudioOutput *audioOutput;
|
||||
QStringList delegateItems;
|
||||
|
||||
NotifyTableModel* notifyRulesModel;
|
||||
QItemSelectionModel *notifyRulesSelection;
|
||||
QList<NotifyPluginConfiguration*> privListNotifications;
|
||||
|
||||
Ui::NotifyPluginOptionsPage *options_page;
|
||||
//NotifyPluginConfiguration *notify;
|
||||
|
||||
signals:
|
||||
void updateNotifications();
|
||||
void updateNotifications(QList<NotifyPluginConfiguration*> list);
|
||||
void resetNotification(void);
|
||||
void entryUpdated(int index);
|
||||
void entryAdded(int position);
|
||||
|
||||
|
||||
private slots:
|
||||
void showPersistentComboBox( const QModelIndex & parent, int start, int end );
|
||||
void showPersistentComboBox2 ( const QModelIndex & topLeft, const QModelIndex & bottomRight );
|
||||
|
||||
void on_buttonTestSound1_clicked();
|
||||
void on_buttonTestSound2_clicked();
|
||||
// void on_buttonTestSound1_clicked();
|
||||
// void on_buttonTestSound2_clicked();
|
||||
void on_buttonTestSoundNotification_clicked();
|
||||
|
||||
void on_buttonAddNotification_clicked();
|
||||
void on_buttonDeleteNotification_clicked();
|
||||
void on_buttonModifyNotification_clicked();
|
||||
void on_tableNotification_changeSelection();
|
||||
void on_tableNotification_changeSelection( const QItemSelection & selected, const QItemSelection & deselected );
|
||||
void on_soundLanguage_indexChanged(int index);
|
||||
void on_buttonSoundFolder_clicked(const QString& path);
|
||||
void on_UAVObject_indexChanged(QString val);
|
||||
|
@ -19,184 +19,6 @@
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>150</y>
|
||||
<width>501</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="2" column="2" colspan="7">
|
||||
<widget class="QComboBox" name="Sound1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="13">
|
||||
<widget class="QPushButton" name="buttonTestSound2">
|
||||
<property name="text">
|
||||
<string>Play</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="res.qrc">
|
||||
<normaloff>:/notify/images/play.png</normaloff>:/notify/images/play.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="12">
|
||||
<widget class="QComboBox" name="Sound2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="7" colspan="3">
|
||||
<widget class="QDoubleSpinBox" name="ValueSpinBox">
|
||||
<property name="decimals">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999.899999999999636</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="5">
|
||||
<widget class="QComboBox" name="Value">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Equal to</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Greater than</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Less than</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="labelSound1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sound1:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="12" colspan="2">
|
||||
<widget class="QComboBox" name="SayOrder">
|
||||
<property name="toolTip">
|
||||
<string>Select if the value of the object should be spoken and if so, either before the configured sound or after it.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Never</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Before first</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>After first</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>After second</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelValue">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Value is</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="11">
|
||||
<widget class="QLabel" name="labelSayOrder">
|
||||
<property name="text">
|
||||
<string>Say Order</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="9">
|
||||
<widget class="QPushButton" name="buttonTestSound1">
|
||||
<property name="text">
|
||||
<string>Play</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="res.qrc">
|
||||
<normaloff>:/notify/images/play.png</normaloff>:/notify/images/play.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="10">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Maximum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="11">
|
||||
<widget class="QLabel" name="labelSound2">
|
||||
<property name="text">
|
||||
<string>Sound2:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -274,57 +96,6 @@ p, li { white-space: pre-wrap; }
|
||||
<property name="title">
|
||||
<string>Sound Notifcations</string>
|
||||
</property>
|
||||
<widget class="QTableWidget" name="tableNotifications">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>481</width>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>600</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::DoubleClicked</set>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>200</number>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderMinimumSectionSize">
|
||||
<number>100</number>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderDefaultSectionSize">
|
||||
<number>20</number>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderHighlightSections">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<column/>
|
||||
<column/>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -427,6 +198,28 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QTableView" name="notifyRulesView">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>481</width>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<attribute name="verticalHeaderDefaultSectionSize">
|
||||
<number>22</number>
|
||||
</attribute>
|
||||
<attribute name="verticalHeaderMinimumSectionSize">
|
||||
<number>22</number>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||
<property name="geometry">
|
||||
@ -487,6 +280,270 @@ p, li { white-space: pre-wrap; }
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>180</y>
|
||||
<width>501</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelSound1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sound1:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="Sound1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelSound2">
|
||||
<property name="text">
|
||||
<string>Sound2:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="Sound2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelSound3">
|
||||
<property name="text">
|
||||
<string>Sound3:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="Sound3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>150</y>
|
||||
<width>501</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelValue">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Value is</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="Value">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Equal to</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Greater than</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Less than</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="ValueSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>170</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>9999.899999999999636</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelSayOrder">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Say Order</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="SayOrder">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select if the value of the object should be spoken and if so, either before the configured sound or after it.</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Never</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Before first</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>After first</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>After second</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>After third</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
Loading…
x
Reference in New Issue
Block a user