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

added ack support

parent 9765f7c0
...@@ -26,7 +26,7 @@ RESOURCES += alarm.qrc ...@@ -26,7 +26,7 @@ RESOURCES += alarm.qrc
INCLUDEPATH += src INCLUDEPATH += src
SOURCES += src/alarm.cpp \ SOURCES += src/alarm.cpp \
src/ackcmd.cpp \ src/acmd.cpp \
src/alarminfow.cpp \ src/alarminfow.cpp \
src/main.cpp \ src/main.cpp \
src/AlarmTreeWidget.cpp \ src/AlarmTreeWidget.cpp \
...@@ -38,7 +38,7 @@ SOURCES += src/alarm.cpp \ ...@@ -38,7 +38,7 @@ SOURCES += src/alarm.cpp \
HEADERS += src/alarm.h \ HEADERS += src/alarm.h \
src/AlarmTreeWidget.h \ src/AlarmTreeWidget.h \
src/AlarmTreeWidgetItem.h \ src/AlarmTreeWidgetItem.h \
src/ackcmd.h \ src/acmd.h \
src/alarminfow.h \ src/alarminfow.h \
src/filter.h \ src/filter.h \
src/Sound.h \ src/Sound.h \
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "alarm.h" #include "alarm.h"
#include "filter.h" #include "filter.h"
#include "ackcmd.h" #include "acmd.h"
#include "AlarmTreeWidget.h" #include "AlarmTreeWidget.h"
#include "AlarmTreeWidgetItem.h" #include "AlarmTreeWidgetItem.h"
#include <QMessageBox> #include <QMessageBox>
...@@ -60,8 +60,6 @@ Alarm::Alarm(CumbiaPool *cu_p, QWidget *parent) : QWidget(parent) ...@@ -60,8 +60,6 @@ Alarm::Alarm(CumbiaPool *cu_p, QWidget *parent) : QWidget(parent)
QString soundFileName, alarmSysTestServerName; QString soundFileName, alarmSysTestServerName;
QStringList args = qApp->arguments(); 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->pBAckAll, SIGNAL(clicked()), this, SLOT(ackAll()));
connect(ui->pBStopSound, SIGNAL(clicked()), this, SLOT(stopSound())); connect(ui->pBStopSound, SIGNAL(clicked()), this, SLOT(stopSound()));
...@@ -181,14 +179,8 @@ QList<QTreeWidgetItem *> Alarm::mGetSelectedItems() ...@@ -181,14 +179,8 @@ QList<QTreeWidgetItem *> Alarm::mGetSelectedItems()
void Alarm::silence() void Alarm::silence()
{ {
QList<QTreeWidgetItem *> selItems = mGetSelectedItems(); Acmd acmd;
QStringList toSilenceAlarms;for(int i = 0; i < selItems.size(); i++) { acmd.silence(ui->treeWidgetAlarms, false, cu_pool, m_ctrl_factory_pool);
QString dev;
QTreeWidgetItem *it = selItems[i];
if(it->columnCount() > AlarmTreeWidgetItem::Alarm)
toSilenceAlarms.push_back(it->text(AlarmTreeWidgetItem::Alarm));
tangoStringListCommand(dev, toSilenceAlarms, "Silence");
}
} }
void Alarm::testSound() { void Alarm::testSound() {
...@@ -200,32 +192,20 @@ void Alarm::beep() { ...@@ -200,32 +192,20 @@ void Alarm::beep() {
sound->play(); sound->play();
} }
void Alarm::onTestW(const CuData &d)
{
printf("Alarm.onTestW: data %s %s\n", vtoc2(d, "src"), vtoc2(d, "value"));
}
void Alarm::stopSound() { void Alarm::stopSound() {
sound->stop(); sound->stop();
} }
void Alarm::ack() { void Alarm::ack() {
AckCmd acmd; Acmd acmd;
acmd.ack(ui->treeWidgetAlarms, false, cu_pool, m_ctrl_factory_pool); acmd.ack(ui->treeWidgetAlarms, false, cu_pool, m_ctrl_factory_pool);
} }
void Alarm::ackAll() { void Alarm::ackAll() {
AckCmd acmd; Acmd acmd;
acmd.ack(ui->treeWidgetAlarms, true, cu_pool, m_ctrl_factory_pool); 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() void Alarm::applyFilter()
{ {
AlarmFilter filter; AlarmFilter filter;
...@@ -283,7 +263,7 @@ void Alarm::onItemSelectionChange() { ...@@ -283,7 +263,7 @@ void Alarm::onItemSelectionChange() {
} }
void Alarm::tabChanged(int t) { void Alarm::tabChanged(int t) {
if(t == 2) { if(t == 1) {
ui->pBAckAll->setHidden(true); ui->pBAckAll->setHidden(true);
ui->pBConfHistory->setHidden(false); ui->pBConfHistory->setHidden(false);
ui->pBConfHistory->setChecked(true); ui->pBConfHistory->setChecked(true);
...@@ -292,7 +272,7 @@ void Alarm::tabChanged(int t) { ...@@ -292,7 +272,7 @@ void Alarm::tabChanged(int t) {
ui->pBConfHistory->setHidden(true); ui->pBConfHistory->setHidden(true);
ui->pBStopSound->setHidden(true); ui->pBStopSound->setHidden(true);
} }
else if(t == 0 || t == 1) { else if(t == 0) {
ui->pBStopSound->setHidden(false); ui->pBStopSound->setHidden(false);
ui->pBAckAll->setHidden(false); ui->pBAckAll->setHidden(false);
ui->pBConfHistory->setHidden(true); ui->pBConfHistory->setHidden(true);
......
...@@ -72,12 +72,6 @@ protected slots: ...@@ -72,12 +72,6 @@ protected slots:
void beep(); void beep();
/// TEST
///
void onTestW(const CuData &d);
/// END TEST
protected: protected:
void closeEvent(QCloseEvent *); 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