Commit cfe3c66a authored by Giacomo Strangolino's avatar Giacomo Strangolino
Browse files

added ack support

parent 9765f7c0
......@@ -26,7 +26,7 @@ RESOURCES += alarm.qrc
INCLUDEPATH += src
SOURCES += src/alarm.cpp \
src/ackcmd.cpp \
src/acmd.cpp \
src/alarminfow.cpp \
src/main.cpp \
src/AlarmTreeWidget.cpp \
......@@ -38,7 +38,7 @@ SOURCES += src/alarm.cpp \
HEADERS += src/alarm.h \
src/AlarmTreeWidget.h \
src/AlarmTreeWidgetItem.h \
src/ackcmd.h \
src/acmd.h \
src/alarminfow.h \
src/filter.h \
src/Sound.h \
......
......@@ -21,7 +21,7 @@
#include "alarm.h"
#include "filter.h"
#include "ackcmd.h"
#include "acmd.h"
#include "AlarmTreeWidget.h"
#include "AlarmTreeWidgetItem.h"
#include <QMessageBox>
......@@ -60,8 +60,6 @@ Alarm::Alarm(CumbiaPool *cu_p, QWidget *parent) : QWidget(parent)
QString soundFileName, alarmSysTestServerName;
QStringList args = qApp->arguments();
// connect(qtangoComHandle(), SIGNAL(newData(const TVariant&)), this, SLOT(refresh(const TVariant&))); //qui e' dove il nuovo allarme scatena il maeccanismo
connect(ui->pBAckAll, SIGNAL(clicked()), this, SLOT(ackAll()));
connect(ui->pBStopSound, SIGNAL(clicked()), this, SLOT(stopSound()));
......@@ -181,14 +179,8 @@ QList<QTreeWidgetItem *> Alarm::mGetSelectedItems()
void Alarm::silence()
{
QList<QTreeWidgetItem *> selItems = mGetSelectedItems();
QStringList toSilenceAlarms;for(int i = 0; i < selItems.size(); i++) {
QString dev;
QTreeWidgetItem *it = selItems[i];
if(it->columnCount() > AlarmTreeWidgetItem::Alarm)
toSilenceAlarms.push_back(it->text(AlarmTreeWidgetItem::Alarm));
tangoStringListCommand(dev, toSilenceAlarms, "Silence");
}
Acmd acmd;
acmd.silence(ui->treeWidgetAlarms, false, cu_pool, m_ctrl_factory_pool);
}
void Alarm::testSound() {
......@@ -200,32 +192,20 @@ void Alarm::beep() {
sound->play();
}
void Alarm::onTestW(const CuData &d)
{
printf("Alarm.onTestW: data %s %s\n", vtoc2(d, "src"), vtoc2(d, "value"));
}
void Alarm::stopSound() {
sound->stop();
}
void Alarm::ack() {
AckCmd acmd;
Acmd acmd;
acmd.ack(ui->treeWidgetAlarms, false, cu_pool, m_ctrl_factory_pool);
}
void Alarm::ackAll() {
AckCmd acmd;
Acmd acmd;
acmd.ack(ui->treeWidgetAlarms, true, cu_pool, m_ctrl_factory_pool);
}
void Alarm::tangoStringListCommand(const QString& device_name, const QStringList &names, const char *cmdname) {
QuWriter *w = new QuWriter(this, cu_pool, m_ctrl_factory_pool);
w->setAutoDestroy(true);
w->setTarget(QString("%s->%s").arg(device_name).arg(cmdname));
w->execute(names);
}
void Alarm::applyFilter()
{
AlarmFilter filter;
......@@ -283,7 +263,7 @@ void Alarm::onItemSelectionChange() {
}
void Alarm::tabChanged(int t) {
if(t == 2) {
if(t == 1) {
ui->pBAckAll->setHidden(true);
ui->pBConfHistory->setHidden(false);
ui->pBConfHistory->setChecked(true);
......@@ -292,7 +272,7 @@ void Alarm::tabChanged(int t) {
ui->pBConfHistory->setHidden(true);
ui->pBStopSound->setHidden(true);
}
else if(t == 0 || t == 1) {
else if(t == 0) {
ui->pBStopSound->setHidden(false);
ui->pBAckAll->setHidden(false);
ui->pBConfHistory->setHidden(true);
......
......@@ -72,12 +72,6 @@ protected slots:
void beep();
/// TEST
///
void onTestW(const CuData &d);
/// END TEST
protected:
void closeEvent(QCloseEvent *);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment