00001
00034 #include <iostream>
00035 #include <QtGui/QDoubleSpinBox>
00036 #include <QtGui/QVBoxLayout>
00037
00038 #include "configscreen.h"
00039
00040 using namespace AlarmNotifications;
00041
00042 ConfigScreen::ConfigScreen ( )
00043 : KConfigDialog ( nullptr, "AlarmNotifications Configuration", AlarmConfiguration::instance().internal_skel() ),
00044 _conf ( AlarmConfiguration::instance().internal_skel() ),
00045 _confman ( new KConfigDialogManager ( this, _conf ) ),
00046 _activemqscreen ( new QWidget ),
00047 _lactivemqscreen ( new QFormLayout ( _activemqscreen ) )
00048 {
00049 CreateActiveMQConnectivityWidgets();
00050
00051 _activemqscreen->setLayout ( _lactivemqscreen );
00052 _confman->updateWidgets();
00053 setButtons ( KDialog::ButtonCode::Ok | KDialog::ButtonCode::Apply | KDialog::ButtonCode::Cancel );
00054 addPage ( _activemqscreen, _conf, "Alarm notifications", "mail-forwarded", "Alarm notification settings" );
00055 setWindowTitle ( "AlarmNotifications Configuration" );
00056 setWindowIcon ( KIcon ( "preferences-system", nullptr ) );
00057 }
00058
00059 ConfigScreen::~ConfigScreen()
00060 {
00061
00062 }
00063
00064 void ConfigScreen::CreateActiveMQConnectivityWidgets()
00065 {
00066 QLineEdit* activemquri = new QLineEdit ( _activemqscreen );
00067 activemquri->setObjectName ( "kcfg_ActiveMQURI" );
00068 _lactivemqscreen->addRow ( "ActiveMQ URI:", activemquri );
00069 _confman->addWidget ( activemquri );
00070 QLineEdit* activemqusername = new QLineEdit ( _activemqscreen );
00071 activemqusername->setObjectName ( "kcfg_ActiveMQUsername" );
00072 _lactivemqscreen->addRow ( "ActiveMQ username:", activemqusername );
00073 _confman->addWidget ( activemqusername );
00074 QLineEdit* activemqpassword = new QLineEdit ( _activemqscreen );
00075 activemqpassword->setObjectName ( "kcfg_ActiveMQPassword" );
00076 _lactivemqscreen->addRow ( "ActiveMQ password:", activemqpassword );
00077 _confman->addWidget ( activemqpassword );
00078 QLineEdit* activemqtopicname = new QLineEdit ( _activemqscreen );
00079 activemqtopicname->setObjectName ( "kcfg_ActiveMQTopicName" );
00080 _lactivemqscreen->addRow ( "CSS Alarm Server topic name:", activemqtopicname );
00081 _confman->addWidget ( activemqtopicname );
00082 QSpinBox* laboratorynotificationtimeout = new QSpinBox ( _activemqscreen );
00083 laboratorynotificationtimeout->setMinimum ( 0 );
00084 laboratorynotificationtimeout->setMaximum ( 3600 );
00085 laboratorynotificationtimeout->setSuffix ( QString::fromUtf8 ( " seconds" ) );
00086 laboratorynotificationtimeout->setSpecialValueText ( QString::fromUtf8 ( "Notification disabled" ) );
00087 laboratorynotificationtimeout->setObjectName ( "kcfg_LaboratoryNotificationTimeout" );
00088 _lactivemqscreen->addRow ( "Laboratory notification timeout:", laboratorynotificationtimeout );
00089 _confman->addWidget ( laboratorynotificationtimeout );
00090 QSpinBox* desktopnotificationtimeout = new QSpinBox ( _activemqscreen );
00091 desktopnotificationtimeout->setMinimum ( 0 );
00092 desktopnotificationtimeout->setMaximum ( 3600 );
00093 desktopnotificationtimeout->setSuffix ( QString::fromUtf8 ( " seconds" ) );
00094 desktopnotificationtimeout->setSpecialValueText ( QString::fromUtf8 ( "Notification disabled" ) );
00095 desktopnotificationtimeout->setObjectName ( "kcfg_DesktopNotificationTimeout" );
00096 _lactivemqscreen->addRow ( "Desktop notification timeout:", desktopnotificationtimeout );
00097 _confman->addWidget ( desktopnotificationtimeout );
00098 QSpinBox* emailnotificationtimeout = new QSpinBox ( _activemqscreen );
00099 emailnotificationtimeout->setMinimum ( 0 );
00100 emailnotificationtimeout->setMaximum ( 3600 );
00101 emailnotificationtimeout->setSuffix ( QString::fromUtf8 ( " seconds" ) );
00102 emailnotificationtimeout->setSpecialValueText ( QString::fromUtf8 ( "Notification disabled" ) );
00103 emailnotificationtimeout->setObjectName ( "kcfg_EMailNotificationTimeout" );
00104 _lactivemqscreen->addRow ( "E-Mail notification timeout:", emailnotificationtimeout );
00105 _confman->addWidget ( emailnotificationtimeout );
00106 QLineEdit* emailnotificationfrom = new QLineEdit ( _activemqscreen );
00107 emailnotificationfrom->setObjectName ( "kcfg_EMailNotificationFrom" );
00108 _lactivemqscreen->addRow ( "E-Mail notification sender address:", emailnotificationfrom );
00109 _confman->addWidget ( emailnotificationfrom );
00110 QLineEdit* emailnotificationto = new QLineEdit ( _activemqscreen );
00111 emailnotificationto->setObjectName ( "kcfg_EMailNotificationTo" );
00112 _lactivemqscreen->addRow ( "E-Mail notification recipient address:", emailnotificationto );
00113 _confman->addWidget ( emailnotificationto );
00114 QLineEdit* emailnotificationservername = new QLineEdit ( _activemqscreen );
00115 emailnotificationservername->setObjectName ( "kcfg_EMailNotificationServerName" );
00116 _lactivemqscreen->addRow ( "SMTP server name:", emailnotificationservername );
00117 _confman->addWidget ( emailnotificationservername );
00118 QSpinBox* emailnotificationserverport = new QSpinBox ( _activemqscreen );
00119 emailnotificationserverport->setMinimum ( 0 );
00120 emailnotificationserverport->setMaximum ( 65535 );
00121 emailnotificationserverport->setObjectName ( "kcfg_EMailNotificationServerPort" );
00122 _lactivemqscreen->addRow ( "SMTP server port:", emailnotificationserverport );
00123 _confman->addWidget ( emailnotificationserverport );
00124 QLineEdit* flashlightrelaisdevicenode = new QLineEdit ( _activemqscreen );
00125 flashlightrelaisdevicenode->setObjectName ( QString::fromUtf8 ( "kcfg_FlashLightRelaisDeviceNode" ) );
00126 _lactivemqscreen->addRow ( QString::fromUtf8 ( "Device node of relais for red flash light:" ), flashlightrelaisdevicenode );
00127 _confman->addWidget ( flashlightrelaisdevicenode );
00128 }
00129
00130 #include "configscreen.moc"