2011-01-30 23:22:51 +00:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file notifypluginoptionspage.cpp
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @brief Notify Plugin options page
|
|
|
|
* @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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "notifypluginoptionspage.h"
|
|
|
|
#include <coreplugin/icore.h>
|
2011-09-15 00:38:18 +03:00
|
|
|
#include "notificationitem.h"
|
2011-01-30 23:22:51 +00:00
|
|
|
#include "ui_notifypluginoptionspage.h"
|
|
|
|
#include "extensionsystem/pluginmanager.h"
|
|
|
|
#include "utils/pathutils.h"
|
|
|
|
|
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QtAlgorithms>
|
|
|
|
#include <QStringList>
|
|
|
|
#include <QtCore/QSettings>
|
|
|
|
#include <QTableWidget>
|
|
|
|
#include <QPalette>
|
|
|
|
#include <QBuffer>
|
2011-09-29 20:26:46 +03:00
|
|
|
#include <QSpinBox>
|
|
|
|
#include <QLineEdit>
|
2011-01-30 23:22:51 +00:00
|
|
|
|
|
|
|
#include "notifyplugin.h"
|
|
|
|
#include "notifyitemdelegate.h"
|
|
|
|
#include "notifytablemodel.h"
|
2011-09-19 00:30:57 +03:00
|
|
|
#include "notifylogging.h"
|
2011-01-30 23:22:51 +00:00
|
|
|
|
2011-09-29 20:26:46 +03:00
|
|
|
static const char* cStrEqualTo = "Equal to";
|
|
|
|
static const char* cStrLargeThan = "Large than";
|
|
|
|
static const char* cStrLowerThan = "Lower than";
|
|
|
|
static const char* cStrInRange = "In range";
|
|
|
|
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
NotifyPluginOptionsPage::NotifyPluginOptionsPage(QObject *parent)
|
2011-09-16 02:24:35 +03:00
|
|
|
: IOptionsPage(parent)
|
2011-10-04 01:59:37 +03:00
|
|
|
, _objManager(*ExtensionSystem::PluginManager::instance()->getObject<UAVObjectManager>())
|
|
|
|
, _owner(qobject_cast<SoundNotifyPlugin*>(parent))
|
|
|
|
, _currentCollectionPath("")
|
2011-09-29 20:26:46 +03:00
|
|
|
, _valueRange(NULL)
|
|
|
|
, _sayOrder(NULL)
|
|
|
|
, _fieldValue(NULL)
|
|
|
|
, _fieldType(-1)
|
|
|
|
, _form(NULL)
|
2011-10-04 01:59:37 +03:00
|
|
|
, _selectedNotification(NULL)
|
|
|
|
{}
|
2011-01-30 23:22:51 +00:00
|
|
|
|
2011-09-16 02:24:35 +03:00
|
|
|
NotifyPluginOptionsPage::~NotifyPluginOptionsPage()
|
2011-10-04 01:59:37 +03:00
|
|
|
{}
|
2011-01-30 23:22:51 +00:00
|
|
|
|
|
|
|
QWidget *NotifyPluginOptionsPage::createPage(QWidget *parent)
|
|
|
|
{
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage.reset(new Ui::NotifyPluginOptionsPage());
|
2011-09-16 02:24:35 +03:00
|
|
|
//main widget
|
2011-09-29 20:26:46 +03:00
|
|
|
QWidget* optionsPageWidget = new QWidget;
|
|
|
|
_fieldValue = NULL;
|
|
|
|
_valueRange = NULL;
|
2011-10-04 01:59:37 +03:00
|
|
|
resetFieldType();
|
2011-09-29 20:26:46 +03:00
|
|
|
//save ref to form, needed for binding dynamic fields in future
|
|
|
|
_form = optionsPageWidget;
|
2011-09-16 02:24:35 +03:00
|
|
|
//main layout
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->setupUi(optionsPageWidget);
|
2011-09-16 18:39:20 +03:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
_listSoundFiles.clear();
|
2011-09-29 20:26:46 +03:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->SoundDirectoryPathChooser->setExpectedKind(Utils::PathChooser::Directory);
|
|
|
|
_optionsPage->SoundDirectoryPathChooser->setPromptDialogTitle(tr("Choose sound collection directory"));
|
2011-09-29 20:26:46 +03:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
connect(_optionsPage->SoundDirectoryPathChooser, SIGNAL(changed(const QString&)),
|
|
|
|
this, SLOT(on_buttonSoundFolder_clicked(const QString&)));
|
|
|
|
connect(_optionsPage->SoundCollectionList, SIGNAL(currentIndexChanged (int)),
|
|
|
|
this, SLOT(on_soundLanguage_indexChanged(int)));
|
2011-09-16 02:24:35 +03:00
|
|
|
|
2011-09-16 18:39:20 +03:00
|
|
|
connect(this, SIGNAL(updateNotifications(QList<NotificationItem*>)),
|
2011-10-04 01:59:37 +03:00
|
|
|
_owner, SLOT(updateNotificationList(QList<NotificationItem*>)));
|
2011-09-16 18:39:20 +03:00
|
|
|
//connect(this, SIGNAL(resetNotification()),owner, SLOT(resetNotification()));
|
2011-01-30 23:22:51 +00:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
_privListNotifications = _owner->getListNotifications();
|
|
|
|
|
2011-01-30 23:22:51 +00:00
|
|
|
|
2011-09-29 20:26:46 +03:00
|
|
|
// [1]
|
2011-10-04 01:59:37 +03:00
|
|
|
_selectedNotification = _owner->getCurrentNotification();
|
2011-09-29 20:26:46 +03:00
|
|
|
addDynamicValueLayout();
|
|
|
|
// [2]
|
|
|
|
updateConfigView(_selectedNotification);
|
2011-01-30 23:22:51 +00:00
|
|
|
|
2011-09-19 00:30:57 +03:00
|
|
|
initRulesTable();
|
2011-09-16 18:39:20 +03:00
|
|
|
initButtons();
|
|
|
|
initPhononPlayer();
|
2011-09-16 02:24:35 +03:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
_notifyRulesSelection->setCurrentIndex(_notifyRulesModel->index(0, 0, QModelIndex()),
|
|
|
|
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
2011-09-29 20:26:46 +03:00
|
|
|
|
2011-09-16 18:39:20 +03:00
|
|
|
return optionsPageWidget;
|
2011-09-16 02:24:35 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 20:26:46 +03:00
|
|
|
void NotifyPluginOptionsPage::apply()
|
|
|
|
{
|
2011-10-04 01:59:37 +03:00
|
|
|
getOptionsPageValues(_owner->getCurrentNotification());
|
|
|
|
_owner->setEnableSound(_optionsPage->chkEnableSound->isChecked());
|
|
|
|
emit updateNotifications(_privListNotifications);
|
2011-09-29 20:26:46 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyPluginOptionsPage::finish()
|
|
|
|
{
|
2011-10-04 01:59:37 +03:00
|
|
|
disconnect(_optionsPage->UAVObjectField, SIGNAL(currentIndexChanged(QString)),
|
|
|
|
this, SLOT(on_UAVField_indexChanged(QString)));
|
|
|
|
|
|
|
|
disconnect(_notifySound.data(),SIGNAL(stateChanged(Phonon::State,Phonon::State)),
|
|
|
|
this,SLOT(on_changeButtonText(Phonon::State,Phonon::State)));
|
|
|
|
if (_notifySound) {
|
|
|
|
_notifySound->stop();
|
|
|
|
_notifySound->clear();
|
2011-09-29 20:26:46 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyPluginOptionsPage::addDynamicValueLayout()
|
|
|
|
{
|
2011-10-04 01:59:37 +03:00
|
|
|
NotificationItem* curr = _owner->getCurrentNotification();
|
2011-09-29 20:26:46 +03:00
|
|
|
Q_ASSERT(curr);
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->dynamicValueLayout->addWidget(new QLabel("Say order ", _form));
|
2011-09-29 20:26:46 +03:00
|
|
|
|
|
|
|
_sayOrder = new QComboBox(_form);
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->dynamicValueLayout->addWidget(_sayOrder);
|
|
|
|
_sayOrder->addItems(NotificationItem::sayOrderValues);
|
2011-09-29 20:26:46 +03:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->dynamicValueLayout->addWidget(new QLabel("Value is ", _form));
|
2011-09-29 20:26:46 +03:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(_objManager.getObject(curr->getDataObject()));
|
2011-09-29 20:26:46 +03:00
|
|
|
UAVObjectField* field = obj->getField(curr->getObjectField());
|
|
|
|
Q_ASSERT(obj);
|
|
|
|
Q_ASSERT(field);
|
|
|
|
_valueRange = new QComboBox(_form);
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->dynamicValueLayout->addWidget(_valueRange);
|
2011-09-29 20:26:46 +03:00
|
|
|
|
|
|
|
addDynamicField(field);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyPluginOptionsPage::resetValueRange()
|
|
|
|
{
|
|
|
|
(static_cast<QLineEdit*>(_fieldValue))->setInputMask("999.99 - 999.99;");
|
|
|
|
(static_cast<QLineEdit*>(_fieldValue))->setText("0000000000");
|
|
|
|
(static_cast<QLineEdit*>(_fieldValue))->setCursorPosition(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyPluginOptionsPage::on_rangeValue_indexChanged(QString rangeStr)
|
|
|
|
{
|
|
|
|
Q_ASSERT(_fieldValue);
|
2011-10-04 01:59:37 +03:00
|
|
|
UAVObjectField* field = getObjectFieldFromPage();
|
|
|
|
Q_ASSERT(!!field);
|
|
|
|
setDynamicValueWidget(field);
|
|
|
|
setDynamicValueField(_selectedNotification);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyPluginOptionsPage::resetFieldType()
|
|
|
|
{
|
|
|
|
_fieldType = -1;
|
2011-09-29 20:26:46 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyPluginOptionsPage::addDynamicField(UAVObjectField* objField)
|
|
|
|
{
|
2011-10-04 01:59:37 +03:00
|
|
|
//qDebugNotify_ if (!objField || !parent) << "null input params";
|
2011-09-29 20:26:46 +03:00
|
|
|
Q_ASSERT(objField);
|
2011-10-04 01:59:37 +03:00
|
|
|
if (objField->getType() == _fieldType) {
|
|
|
|
if (QComboBox* fieldValue = dynamic_cast<QComboBox*>(_fieldValue)) {
|
2011-09-29 20:26:46 +03:00
|
|
|
fieldValue->clear();
|
|
|
|
QStringList enumValues(objField->getOptions());
|
|
|
|
fieldValue->addItems(enumValues);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
disconnect(_valueRange, SIGNAL(currentIndexChanged(QString)),
|
|
|
|
this, SLOT(on_rangeValue_indexChanged(QString)));
|
|
|
|
|
|
|
|
_valueRange->clear();
|
|
|
|
QStringList rangeValues;
|
2011-10-04 01:59:37 +03:00
|
|
|
if (UAVObjectField::ENUM == objField->getType()) {
|
2011-09-29 20:26:46 +03:00
|
|
|
rangeValues << cStrEqualTo << cStrInRange;
|
|
|
|
_valueRange->addItems(rangeValues);
|
2011-10-04 01:59:37 +03:00
|
|
|
_valueRange->setCurrentIndex(rangeValues.indexOf(_selectedNotification->range()));
|
|
|
|
|
|
|
|
} else {
|
2011-09-29 20:26:46 +03:00
|
|
|
rangeValues << cStrEqualTo << cStrLargeThan << cStrLowerThan << cStrInRange;
|
|
|
|
_valueRange->addItems(rangeValues);
|
|
|
|
connect(_valueRange, SIGNAL(currentIndexChanged(QString)),
|
|
|
|
this, SLOT(on_rangeValue_indexChanged(QString)));
|
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
setDynamicValueWidget(objField);
|
|
|
|
}
|
2011-09-29 20:26:46 +03:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
void NotifyPluginOptionsPage::setDynamicValueWidget(UAVObjectField* objField)
|
|
|
|
{
|
|
|
|
Q_ASSERT(_valueRange);
|
|
|
|
|
|
|
|
// check if dynamic fileld already settled,
|
|
|
|
// so if its exists remove it and install new field
|
|
|
|
if (_fieldValue) {
|
|
|
|
_optionsPage->dynamicValueLayout->removeWidget(_fieldValue);
|
|
|
|
delete _fieldValue;
|
|
|
|
_fieldValue = NULL;
|
|
|
|
}
|
2011-09-29 20:26:46 +03:00
|
|
|
_fieldType = objField->getType();
|
|
|
|
switch(_fieldType)
|
|
|
|
{
|
|
|
|
case UAVObjectField::ENUM:
|
|
|
|
{
|
|
|
|
_fieldValue = new QComboBox(_form);
|
|
|
|
QStringList enumValues(objField->getOptions());
|
|
|
|
(dynamic_cast<QComboBox*>(_fieldValue))->addItems(enumValues);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2011-10-04 01:59:37 +03:00
|
|
|
if (_valueRange->currentText() == cStrInRange) {
|
|
|
|
_fieldValue = new QLineEdit(_form);
|
2011-09-29 20:26:46 +03:00
|
|
|
resetValueRange();
|
|
|
|
} else {
|
|
|
|
_fieldValue = new QSpinBox(_form);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
};
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->dynamicValueLayout->addWidget(_fieldValue);
|
2011-09-29 20:26:46 +03:00
|
|
|
}
|
|
|
|
|
2011-09-16 02:24:35 +03:00
|
|
|
void NotifyPluginOptionsPage::initButtons()
|
|
|
|
{
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->chkEnableSound->setChecked(_owner->getEnableSound());
|
|
|
|
connect(_optionsPage->chkEnableSound, SIGNAL(toggled(bool)),
|
|
|
|
this, SLOT(on_checkEnableSound_toggled(bool)));
|
|
|
|
|
|
|
|
_optionsPage->buttonModify->setEnabled(false);
|
|
|
|
_optionsPage->buttonDelete->setEnabled(false);
|
|
|
|
_optionsPage->buttonPlayNotification->setEnabled(false);
|
|
|
|
connect(_optionsPage->buttonAdd, SIGNAL(pressed()),
|
|
|
|
this, SLOT(on_button_AddNotification_clicked()));
|
|
|
|
connect(_optionsPage->buttonDelete, SIGNAL(pressed()),
|
|
|
|
this, SLOT(on_button_DeleteNotification_clicked()));
|
|
|
|
connect(_optionsPage->buttonModify, SIGNAL(pressed()),
|
|
|
|
this, SLOT(on_button_ModifyNotification_clicked()));
|
|
|
|
connect(_optionsPage->buttonPlayNotification, SIGNAL(clicked()),
|
|
|
|
this, SLOT(on_button_TestSoundNotification_clicked()));
|
2011-09-16 02:24:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyPluginOptionsPage::initPhononPlayer()
|
|
|
|
{
|
2011-10-04 01:59:37 +03:00
|
|
|
_notifySound.reset(Phonon::createPlayer(Phonon::NotificationCategory));
|
|
|
|
connect(_notifySound.data(),SIGNAL(stateChanged(Phonon::State,Phonon::State)),
|
|
|
|
this,SLOT(on_changeButtonText(Phonon::State,Phonon::State)));
|
|
|
|
connect(_notifySound.data(), SIGNAL(finished(void)), this, SLOT(on_FinishedPlaying(void)));
|
2011-09-16 02:24:35 +03:00
|
|
|
}
|
2011-01-30 23:22:51 +00:00
|
|
|
|
2011-09-19 00:30:57 +03:00
|
|
|
void NotifyPluginOptionsPage::initRulesTable()
|
2011-09-16 02:24:35 +03:00
|
|
|
{
|
2011-09-19 00:30:57 +03:00
|
|
|
qNotifyDebug_if(_notifyRulesModel.isNull()) << "_notifyRulesModel.isNull())";
|
|
|
|
qNotifyDebug_if(!_notifyRulesSelection) << "_notifyRulesSelection.isNull())";
|
2011-10-04 01:59:37 +03:00
|
|
|
_notifyRulesModel.reset(new NotifyTableModel(_privListNotifications));
|
2011-09-19 00:30:57 +03:00
|
|
|
_notifyRulesSelection = new QItemSelectionModel(_notifyRulesModel.data());
|
|
|
|
|
|
|
|
connect(_notifyRulesSelection, SIGNAL(selectionChanged ( const QItemSelection &, const QItemSelection & )),
|
2011-10-04 01:59:37 +03:00
|
|
|
this, SLOT(on_table_changeSelection( const QItemSelection & , const QItemSelection & )));
|
2011-09-16 02:24:35 +03:00
|
|
|
connect(this, SIGNAL(entryUpdated(int)),
|
2011-10-04 01:59:37 +03:00
|
|
|
_notifyRulesModel.data(), SLOT(entryUpdated(int)));
|
|
|
|
|
|
|
|
_optionsPage->notifyRulesView->setModel(_notifyRulesModel.data());
|
|
|
|
_optionsPage->notifyRulesView->setSelectionModel(_notifyRulesSelection);
|
|
|
|
_optionsPage->notifyRulesView->setItemDelegate(new NotifyItemDelegate(this));
|
|
|
|
|
|
|
|
_optionsPage->notifyRulesView->resizeRowsToContents();
|
|
|
|
_optionsPage->notifyRulesView->setColumnWidth(eMessageName,200);
|
|
|
|
_optionsPage->notifyRulesView->setColumnWidth(eRepeatValue,120);
|
|
|
|
_optionsPage->notifyRulesView->setColumnWidth(eExpireTimer,100);
|
|
|
|
_optionsPage->notifyRulesView->setColumnWidth(eTurnOn,60);
|
|
|
|
_optionsPage->notifyRulesView->setDragEnabled(true);
|
|
|
|
_optionsPage->notifyRulesView->setAcceptDrops(true);
|
|
|
|
_optionsPage->notifyRulesView->setDropIndicatorShown(true);
|
|
|
|
_optionsPage->notifyRulesView->setDragDropMode(QAbstractItemView::InternalMove);
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|
|
|
|
|
2011-09-15 00:38:18 +03:00
|
|
|
void NotifyPluginOptionsPage::getOptionsPageValues(NotificationItem* notification)
|
2011-01-30 23:22:51 +00:00
|
|
|
{
|
2011-09-29 20:26:46 +03:00
|
|
|
Q_ASSERT(notification);
|
2011-10-04 01:59:37 +03:00
|
|
|
notification->setSoundCollectionPath(_optionsPage->SoundDirectoryPathChooser->path());
|
|
|
|
notification->setCurrentLanguage(_optionsPage->SoundCollectionList->currentText());
|
|
|
|
notification->setDataObject(_optionsPage->UAVObject->currentText());
|
|
|
|
notification->setObjectField(_optionsPage->UAVObjectField->currentText());
|
|
|
|
notification->setSound1(_optionsPage->Sound1->currentText());
|
|
|
|
notification->setSound2(_optionsPage->Sound2->currentText());
|
|
|
|
notification->setSound3(_optionsPage->Sound3->currentText());
|
2011-09-29 20:26:46 +03:00
|
|
|
notification->setSayOrder(_sayOrder->currentText());
|
|
|
|
notification->setRange(_valueRange->currentText());
|
2011-10-04 01:59:37 +03:00
|
|
|
if (QSpinBox* spinValue = dynamic_cast<QSpinBox*>(_fieldValue))
|
2011-09-29 20:26:46 +03:00
|
|
|
notification->setSingleValue(spinValue->value());
|
|
|
|
else {
|
2011-10-04 01:59:37 +03:00
|
|
|
if (QComboBox* comboBoxValue = dynamic_cast<QComboBox*>(_fieldValue))
|
2011-09-29 20:26:46 +03:00
|
|
|
notification->setSingleValue(comboBoxValue->currentIndex());
|
|
|
|
else {
|
2011-10-04 01:59:37 +03:00
|
|
|
if (QLineEdit* rangeValue = dynamic_cast<QLineEdit*>(_fieldValue)) {
|
2011-09-29 20:26:46 +03:00
|
|
|
QString str = rangeValue->text();
|
|
|
|
QStringList range = str.split('-');
|
|
|
|
notification->setSingleValue(range.at(0).toDouble());
|
|
|
|
notification->setValueRange2(range.at(1).toDouble());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
void NotifyPluginOptionsPage::on_UAVField_indexChanged(QString field)
|
|
|
|
{
|
|
|
|
resetFieldType();
|
|
|
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( _objManager.getObject(_optionsPage->UAVObject->currentText()));
|
2011-09-29 20:26:46 +03:00
|
|
|
addDynamicField(obj->getField(field));
|
|
|
|
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
void NotifyPluginOptionsPage::on_UAVObject_indexChanged(QString val)
|
|
|
|
{
|
|
|
|
resetFieldType();
|
|
|
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( _objManager.getObject(val) );
|
2011-01-30 23:22:51 +00:00
|
|
|
QList<UAVObjectField*> fieldList = obj->getFields();
|
2011-10-04 01:59:37 +03:00
|
|
|
disconnect(_optionsPage->UAVObjectField, SIGNAL(currentIndexChanged(QString)), this, SLOT(on_UAVField_indexChanged(QString)));
|
|
|
|
_optionsPage->UAVObjectField->clear();
|
2011-01-30 23:22:51 +00:00
|
|
|
foreach (UAVObjectField* field, fieldList) {
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->UAVObjectField->addItem(field->getName());
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|
2011-10-04 01:59:37 +03:00
|
|
|
connect(_optionsPage->UAVObjectField, SIGNAL(currentIndexChanged(QString)), this, SLOT(on_UAVField_indexChanged(QString)));
|
2011-09-29 20:26:46 +03:00
|
|
|
addDynamicField(fieldList.at(0));
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyPluginOptionsPage::on_buttonSoundFolder_clicked(const QString& path)
|
|
|
|
{
|
2011-09-16 18:39:20 +03:00
|
|
|
QDir dirPath(path);
|
2011-10-04 01:59:37 +03:00
|
|
|
_listDirCollections = dirPath.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
|
|
|
|
_optionsPage->SoundCollectionList->clear();
|
|
|
|
_optionsPage->SoundCollectionList->addItems(_listDirCollections);
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyPluginOptionsPage::on_soundLanguage_indexChanged(int index)
|
|
|
|
{
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->SoundCollectionList->setCurrentIndex(index);
|
|
|
|
_currentCollectionPath = _optionsPage->SoundDirectoryPathChooser->path()
|
|
|
|
+ QDir::toNativeSeparators("/" + _optionsPage->SoundCollectionList->currentText());
|
2011-01-30 23:22:51 +00:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
QDir dirPath(_currentCollectionPath);
|
2011-09-16 18:39:20 +03:00
|
|
|
QStringList filters;
|
|
|
|
filters << "*.mp3" << "*.wav";
|
|
|
|
dirPath.setNameFilters(filters);
|
2011-10-04 01:59:37 +03:00
|
|
|
_listSoundFiles = dirPath.entryList(filters);
|
|
|
|
_listSoundFiles.replaceInStrings(QRegExp(".mp3|.wav"), "");
|
|
|
|
_optionsPage->Sound1->clear();
|
|
|
|
_optionsPage->Sound2->clear();
|
|
|
|
_optionsPage->Sound3->clear();
|
|
|
|
_optionsPage->Sound1->addItems(_listSoundFiles);
|
|
|
|
_optionsPage->Sound2->addItem("");
|
|
|
|
_optionsPage->Sound2->addItems(_listSoundFiles);
|
|
|
|
_optionsPage->Sound3->addItem("");
|
|
|
|
_optionsPage->Sound3->addItems(_listSoundFiles);
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
void NotifyPluginOptionsPage::on_changeButtonText(Phonon::State newstate, Phonon::State oldstate)
|
2011-01-30 23:22:51 +00:00
|
|
|
{
|
2011-09-16 18:39:20 +03:00
|
|
|
//Q_ASSERT(Phonon::ErrorState != newstate);
|
|
|
|
|
|
|
|
if (newstate == Phonon::PausedState || newstate == Phonon::StoppedState) {
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->buttonPlayNotification->setText("Play");
|
|
|
|
_optionsPage->buttonPlayNotification->setIcon(QPixmap(":/notify/images/play.png"));
|
2011-09-16 18:39:20 +03:00
|
|
|
} else {
|
|
|
|
if (newstate == Phonon::PlayingState) {
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->buttonPlayNotification->setText("Stop");
|
|
|
|
_optionsPage->buttonPlayNotification->setIcon(QPixmap(":/notify/images/stop.png"));
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
|
|
|
}
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
void NotifyPluginOptionsPage::on_FinishedPlaying()
|
2011-09-15 00:38:18 +03:00
|
|
|
{
|
2011-10-04 01:59:37 +03:00
|
|
|
_notifySound->clear();
|
2011-09-15 00:38:18 +03:00
|
|
|
}
|
2011-01-30 23:22:51 +00:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
void NotifyPluginOptionsPage::on_button_TestSoundNotification_clicked()
|
2011-01-30 23:22:51 +00:00
|
|
|
{
|
2011-09-16 18:39:20 +03:00
|
|
|
NotificationItem* notification = NULL;
|
2011-09-29 20:26:46 +03:00
|
|
|
qNotifyDebug() << "on_buttonTestSoundNotification_clicked";
|
2011-10-04 01:59:37 +03:00
|
|
|
Q_ASSERT(-1 != _notifyRulesSelection->currentIndex().row());
|
|
|
|
_notifySound->clearQueue();
|
|
|
|
notification = _privListNotifications.at(_notifyRulesSelection->currentIndex().row());
|
|
|
|
QStringList sequence = notification->toSoundList();
|
|
|
|
if (sequence.isEmpty()) {
|
|
|
|
qNotifyDebug() << "message sequense is empty!";
|
|
|
|
return;
|
|
|
|
}
|
2011-09-29 20:26:46 +03:00
|
|
|
foreach(QString item, sequence) {
|
|
|
|
qNotifyDebug() << item;
|
2011-10-04 01:59:37 +03:00
|
|
|
_notifySound->enqueue(Phonon::MediaSource(item));
|
2011-09-29 20:26:46 +03:00
|
|
|
}
|
2011-10-04 01:59:37 +03:00
|
|
|
_notifySound->play();
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
void NotifyPluginOptionsPage::on_checkEnableSound_toggled(bool state)
|
2011-01-30 23:22:51 +00:00
|
|
|
{
|
2011-09-16 18:39:20 +03:00
|
|
|
bool state1 = 1^state;
|
2011-01-30 23:22:51 +00:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
QList<Phonon::Path> listOutputs = _notifySound->outputPaths();
|
2011-09-16 18:39:20 +03:00
|
|
|
Phonon::AudioOutput * audioOutput = (Phonon::AudioOutput*)listOutputs.last().sink();
|
|
|
|
audioOutput->setMuted(state1);
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|
|
|
|
|
2011-09-15 00:38:18 +03:00
|
|
|
void NotifyPluginOptionsPage::updateConfigView(NotificationItem* notification)
|
2011-01-30 23:22:51 +00:00
|
|
|
{
|
2011-09-29 20:26:46 +03:00
|
|
|
Q_ASSERT(notification);
|
2011-10-04 01:59:37 +03:00
|
|
|
disconnect(_optionsPage->UAVObject, SIGNAL(currentIndexChanged(QString)),
|
2011-09-29 20:26:46 +03:00
|
|
|
this, SLOT(on_UAVObject_indexChanged(QString)));
|
2011-10-04 01:59:37 +03:00
|
|
|
disconnect(_optionsPage->UAVObjectField, SIGNAL(currentIndexChanged(QString)),
|
|
|
|
this, SLOT(on_UAVField_indexChanged(QString)));
|
2011-09-29 20:26:46 +03:00
|
|
|
|
2011-09-16 18:39:20 +03:00
|
|
|
QString path = notification->getSoundCollectionPath();
|
2011-10-04 01:59:37 +03:00
|
|
|
if (path.isEmpty()) {
|
2011-09-29 20:26:46 +03:00
|
|
|
path = Utils::PathUtils().InsertDataPath("%%DATAPATH%%sounds");
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->SoundDirectoryPathChooser->setPath(path);
|
2011-09-16 18:39:20 +03:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
if (-1 != _optionsPage->SoundCollectionList->findText(notification->getCurrentLanguage())) {
|
|
|
|
_optionsPage->SoundCollectionList->setCurrentIndex(_optionsPage->SoundCollectionList->findText(notification->getCurrentLanguage()));
|
2011-09-16 18:39:20 +03:00
|
|
|
} else {
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->SoundCollectionList->setCurrentIndex(_optionsPage->SoundCollectionList->findText("default"));
|
2011-09-29 20:26:46 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Fills the combo boxes for the UAVObjects
|
2011-10-04 01:59:37 +03:00
|
|
|
QList< QList<UAVDataObject*> > objList = _objManager.getDataObjects();
|
2011-09-29 20:26:46 +03:00
|
|
|
foreach (QList<UAVDataObject*> list, objList) {
|
|
|
|
foreach (UAVDataObject* obj, list) {
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->UAVObject->addItem(obj->getName());
|
2011-09-29 20:26:46 +03:00
|
|
|
}
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
if (-1 != _optionsPage->UAVObject->findText(notification->getDataObject())) {
|
|
|
|
_optionsPage->UAVObject->setCurrentIndex(_optionsPage->UAVObject->findText(notification->getDataObject()));
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->UAVObjectField->clear();
|
2011-09-16 18:39:20 +03:00
|
|
|
QString uavDataObject = notification->getDataObject();
|
2011-10-04 01:59:37 +03:00
|
|
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(_objManager.getObject(uavDataObject));
|
2011-09-16 18:39:20 +03:00
|
|
|
if (obj != NULL ) {
|
2011-09-29 20:26:46 +03:00
|
|
|
QList<UAVObjectField*> fieldList = obj->getFields();
|
|
|
|
foreach (UAVObjectField* field, fieldList) {
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->UAVObjectField->addItem(field->getName());
|
2011-09-29 20:26:46 +03:00
|
|
|
}
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
if (-1 != _optionsPage->UAVObjectField->findText(notification->getObjectField())) {
|
|
|
|
_optionsPage->UAVObjectField->setCurrentIndex(_optionsPage->UAVObjectField->findText(notification->getObjectField()));
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
if (-1 != _optionsPage->Sound1->findText(notification->getSound1())) {
|
|
|
|
_optionsPage->Sound1->setCurrentIndex(_optionsPage->Sound1->findText(notification->getSound1()));
|
2011-09-16 18:39:20 +03:00
|
|
|
} else {
|
2011-09-29 20:26:46 +03:00
|
|
|
// show item from default location
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->SoundCollectionList->setCurrentIndex(_optionsPage->SoundCollectionList->findText("default"));
|
|
|
|
_optionsPage->Sound1->setCurrentIndex(_optionsPage->Sound1->findText(notification->getSound1()));
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
if (-1 != _optionsPage->Sound2->findText(notification->getSound2())) {
|
|
|
|
_optionsPage->Sound2->setCurrentIndex(_optionsPage->Sound2->findText(notification->getSound2()));
|
2011-09-16 18:39:20 +03:00
|
|
|
} else {
|
2011-09-29 20:26:46 +03:00
|
|
|
// show item from default location
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->SoundCollectionList->setCurrentIndex(_optionsPage->SoundCollectionList->findText("default"));
|
|
|
|
_optionsPage->Sound2->setCurrentIndex(_optionsPage->Sound2->findText(notification->getSound2()));
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
if (-1 != _optionsPage->Sound3->findText(notification->getSound3())) {
|
|
|
|
_optionsPage->Sound3->setCurrentIndex(_optionsPage->Sound3->findText(notification->getSound3()));
|
2011-09-16 18:39:20 +03:00
|
|
|
} else {
|
2011-09-29 20:26:46 +03:00
|
|
|
// show item from default location
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->SoundCollectionList->setCurrentIndex(_optionsPage->SoundCollectionList->findText("default"));
|
|
|
|
_optionsPage->Sound3->setCurrentIndex(_optionsPage->Sound3->findText(notification->getSound3()));
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 20:26:46 +03:00
|
|
|
if (-1 != _valueRange->findText(notification->range())) {
|
|
|
|
_valueRange->setCurrentIndex(_valueRange->findText(notification->range()));
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 20:26:46 +03:00
|
|
|
if (-1 != _sayOrder->findText(notification->getSayOrder())) {
|
|
|
|
_sayOrder->setCurrentIndex(_sayOrder->findText(notification->getSayOrder()));
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 20:26:46 +03:00
|
|
|
setDynamicValueField(notification);
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
connect(_optionsPage->UAVObject, SIGNAL(currentIndexChanged(QString)),
|
2011-09-29 20:26:46 +03:00
|
|
|
this, SLOT(on_UAVObject_indexChanged(QString)));
|
2011-10-04 01:59:37 +03:00
|
|
|
connect(_optionsPage->UAVObjectField, SIGNAL(currentIndexChanged(QString)),
|
|
|
|
this, SLOT(on_UAVField_indexChanged(QString)));
|
2011-09-29 20:26:46 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyPluginOptionsPage::setDynamicValueField(NotificationItem* notification)
|
|
|
|
{
|
2011-10-04 01:59:37 +03:00
|
|
|
if (QSpinBox* spinValue = dynamic_cast<QSpinBox*>(_fieldValue))
|
2011-09-29 20:26:46 +03:00
|
|
|
spinValue->setValue(notification->singleValue());
|
|
|
|
else {
|
2011-10-04 01:59:37 +03:00
|
|
|
if (QComboBox* comboBoxValue = dynamic_cast<QComboBox*>(_fieldValue))
|
2011-09-29 20:26:46 +03:00
|
|
|
comboBoxValue->setCurrentIndex(notification->singleValue());
|
|
|
|
else {
|
2011-10-04 01:59:37 +03:00
|
|
|
if (QLineEdit* rangeValue = dynamic_cast<QLineEdit*>(_fieldValue)) {
|
|
|
|
//resetValueRange();
|
|
|
|
QString str = QString("%1%2").arg(notification->singleValue(), 5, 'f', 2, '0')
|
|
|
|
.arg(notification->valueRange2(), 5, 'f', 2, '0');
|
|
|
|
rangeValue->setText(str);
|
2011-09-29 20:26:46 +03:00
|
|
|
} else {
|
|
|
|
qNotifyDebug() << "NotifyPluginOptionsPage::setDynamicValueField | unknown _fieldValue: " << _fieldValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
UAVObjectField* NotifyPluginOptionsPage::getObjectFieldFromPage()
|
|
|
|
{
|
|
|
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>( _objManager.getObject(_optionsPage->UAVObject->currentText()));
|
|
|
|
return obj->getField(_optionsPage->UAVObjectField->currentText());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UAVObjectField* NotifyPluginOptionsPage::getObjectFieldFromSelected()
|
|
|
|
{
|
|
|
|
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(_objManager.getObject(_selectedNotification->getDataObject()));
|
|
|
|
return obj->getField(_selectedNotification->getObjectField());
|
|
|
|
}
|
|
|
|
|
|
|
|
void NotifyPluginOptionsPage::on_table_changeSelection( const QItemSelection & selected, const QItemSelection & deselected )
|
2011-01-30 23:22:51 +00:00
|
|
|
{
|
2011-09-16 18:39:20 +03:00
|
|
|
bool select = false;
|
2011-10-04 01:59:37 +03:00
|
|
|
_notifySound->stop();
|
2011-09-16 18:39:20 +03:00
|
|
|
if (selected.indexes().size()) {
|
2011-09-29 20:26:46 +03:00
|
|
|
select = true;
|
2011-10-04 01:59:37 +03:00
|
|
|
_selectedNotification = _privListNotifications.at(selected.indexes().at(0).row());
|
|
|
|
UAVObjectField* field = getObjectFieldFromSelected();
|
2011-09-29 20:26:46 +03:00
|
|
|
addDynamicField(field);
|
2011-10-04 01:59:37 +03:00
|
|
|
updateConfigView(_selectedNotification);
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->buttonModify->setEnabled(select);
|
|
|
|
_optionsPage->buttonDelete->setEnabled(select);
|
|
|
|
_optionsPage->buttonPlayNotification->setEnabled(select);
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
void NotifyPluginOptionsPage::on_button_AddNotification_clicked()
|
2011-01-30 23:22:51 +00:00
|
|
|
{
|
2011-09-16 18:39:20 +03:00
|
|
|
NotificationItem* notification = new NotificationItem;
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
if (_optionsPage->SoundDirectoryPathChooser->path().isEmpty()) {
|
|
|
|
QPalette textPalette=_optionsPage->SoundDirectoryPathChooser->palette();
|
|
|
|
textPalette.setColor(QPalette::Normal,QPalette::Text, Qt::red);
|
|
|
|
_optionsPage->SoundDirectoryPathChooser->setPalette(textPalette);
|
|
|
|
_optionsPage->SoundDirectoryPathChooser->setPath("please select sound collection folder");
|
|
|
|
return;
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
notification->setSoundCollectionPath(_optionsPage->SoundDirectoryPathChooser->path());
|
|
|
|
notification->setCurrentLanguage(_optionsPage->SoundCollectionList->currentText());
|
|
|
|
notification->setDataObject(_optionsPage->UAVObject->currentText());
|
|
|
|
notification->setObjectField(_optionsPage->UAVObjectField->currentText());
|
2011-09-29 20:26:46 +03:00
|
|
|
notification->setRange(_valueRange->currentText());
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
if (QSpinBox* spinValue = dynamic_cast<QSpinBox*>(_fieldValue))
|
2011-09-29 20:26:46 +03:00
|
|
|
notification->setSingleValue(spinValue->value());
|
2011-09-16 18:39:20 +03:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
if (_optionsPage->Sound1->currentText().size() > 0)
|
|
|
|
notification->setSound1(_optionsPage->Sound1->currentText());
|
2011-09-16 18:39:20 +03:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
notification->setSound2(_optionsPage->Sound2->currentText());
|
|
|
|
notification->setSound3(_optionsPage->Sound3->currentText());
|
2011-09-16 18:39:20 +03:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
if ( ((!_optionsPage->Sound2->currentText().size()) && (_sayOrder->currentText()=="After second"))
|
|
|
|
|| ((!_optionsPage->Sound3->currentText().size()) && (_sayOrder->currentText()=="After third")) ) {
|
2011-09-16 18:39:20 +03:00
|
|
|
return;
|
|
|
|
} else {
|
2011-09-29 20:26:46 +03:00
|
|
|
notification->setSayOrder(_sayOrder->currentText());
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
2011-09-29 20:26:46 +03:00
|
|
|
|
|
|
|
_notifyRulesModel->entryAdded(notification);
|
2011-10-04 01:59:37 +03:00
|
|
|
_notifyRulesSelection->setCurrentIndex(_notifyRulesModel->index(_privListNotifications.size()-1,0,QModelIndex()),
|
2011-09-16 18:39:20 +03:00
|
|
|
QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
void NotifyPluginOptionsPage::on_button_DeleteNotification_clicked()
|
2011-01-30 23:22:51 +00:00
|
|
|
{
|
2011-09-19 00:30:57 +03:00
|
|
|
_notifyRulesModel->removeRow(_notifyRulesSelection->currentIndex().row());
|
|
|
|
if (!_notifyRulesModel->rowCount()
|
|
|
|
&& (_notifyRulesSelection->currentIndex().row() > 0
|
2011-09-29 20:26:46 +03:00
|
|
|
&& _notifyRulesSelection->currentIndex().row() < _notifyRulesModel->rowCount()) )
|
2011-09-16 18:39:20 +03:00
|
|
|
{
|
2011-10-04 01:59:37 +03:00
|
|
|
_optionsPage->buttonDelete->setEnabled(false);
|
|
|
|
_optionsPage->buttonModify->setEnabled(false);
|
|
|
|
_optionsPage->buttonPlayNotification->setEnabled(false);
|
2011-09-16 18:39:20 +03:00
|
|
|
}
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
void NotifyPluginOptionsPage::on_button_ModifyNotification_clicked()
|
2011-01-30 23:22:51 +00:00
|
|
|
{
|
2011-09-16 18:39:20 +03:00
|
|
|
NotificationItem* notification = new NotificationItem;
|
|
|
|
getOptionsPageValues(notification);
|
2011-10-04 01:59:37 +03:00
|
|
|
notification->setRetryString(_privListNotifications.at(_notifyRulesSelection->currentIndex().row())->retryString());
|
|
|
|
notification->setLifetime(_privListNotifications.at(_notifyRulesSelection->currentIndex().row())->lifetime());
|
|
|
|
notification->setMute(_privListNotifications.at(_notifyRulesSelection->currentIndex().row())->mute());
|
2011-09-19 00:30:57 +03:00
|
|
|
|
2011-10-04 01:59:37 +03:00
|
|
|
_privListNotifications.replace(_notifyRulesSelection->currentIndex().row(),notification);
|
2011-09-19 00:30:57 +03:00
|
|
|
entryUpdated(_notifyRulesSelection->currentIndex().row());
|
2011-01-30 23:22:51 +00:00
|
|
|
}
|