diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-06-24 18:23:18 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-06-24 18:23:18 -0500 |
commit | e23898e185c0f639c6c6b98478b8b21f1ae83720 (patch) | |
tree | e5e2fd731ac59299cd68ed017d11f1ad9a9462d6 /clients/tde/src | |
parent | 8dcfe72c396a6f0c4bafd2ed23ba52a475154ef2 (diff) | |
download | ulab-e23898e185c0f639c6c6b98478b8b21f1ae83720.tar.gz ulab-e23898e185c0f639c6c6b98478b8b21f1ae83720.zip |
Update protocol and implement LIST/BIND logic
Diffstat (limited to 'clients/tde/src')
-rw-r--r-- | clients/tde/src/Makefile.am | 2 | ||||
-rw-r--r-- | clients/tde/src/app/Makefile.am | 4 | ||||
-rw-r--r-- | clients/tde/src/app/remotemdi.cpp | 24 | ||||
-rw-r--r-- | clients/tde/src/dialogs/Makefile.am | 4 | ||||
-rw-r--r-- | clients/tde/src/dialogs/selectserverdlg.cpp | 115 | ||||
-rw-r--r-- | clients/tde/src/dialogs/selectserverdlg.h | 47 | ||||
-rw-r--r-- | clients/tde/src/dialogs/selectserverdlgbase.ui | 67 |
7 files changed, 260 insertions, 3 deletions
diff --git a/clients/tde/src/Makefile.am b/clients/tde/src/Makefile.am index 23fbb4d..c44e4ca 100644 --- a/clients/tde/src/Makefile.am +++ b/clients/tde/src/Makefile.am @@ -1,3 +1,3 @@ -SUBDIRS = widgets app part +SUBDIRS = widgets dialogs app part INCLUDES = $(all_includes) METASOURCES = AUTO diff --git a/clients/tde/src/app/Makefile.am b/clients/tde/src/app/Makefile.am index 530c4c3..39cfe4c 100644 --- a/clients/tde/src/app/Makefile.am +++ b/clients/tde/src/app/Makefile.am @@ -1,9 +1,9 @@ SUBDIRS = views -INCLUDES = $(all_includes) -I$(top_srcdir)/src $(KDE_INCLUDES)/tde +INCLUDES = $(all_includes) -I$(top_srcdir)/src -I$(top_builddir)/src $(KDE_INCLUDES)/tde METASOURCES = AUTO # Application bin_PROGRAMS = remote_laboratory_client remote_laboratory_client_SOURCES = main.cpp remotemdi.cpp -remote_laboratory_client_LDADD = ./views/libinstrumentview.la $(LIB_KPARTS) $(LIB_TDEUI) +remote_laboratory_client_LDADD = ./views/libinstrumentview.la ../dialogs/libselectserverdlg.la $(LIB_KPARTS) $(LIB_TDEUI) remote_laboratory_client_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor -lkmdi -ltdekrbsocket -ltqtrla diff --git a/clients/tde/src/app/remotemdi.cpp b/clients/tde/src/app/remotemdi.cpp index 1df78df..9d40365 100644 --- a/clients/tde/src/app/remotemdi.cpp +++ b/clients/tde/src/app/remotemdi.cpp @@ -27,6 +27,7 @@ using namespace std; #include <kkeydialog.h> #include "views/instrumentview.h" +#include "dialogs/selectserverdlg.h" RemoteMDI::RemoteMDI() : KMdiMainFrm(0, "RemoteMDI", KMdi::ChildframeMode), m_children(0), m_rsvSvrSocket(NULL) @@ -165,6 +166,29 @@ void RemoteMDI::promptForStationType() { ds >> slist; printf("[RAJA DEBUG 200.2] Got list of stations, count is %d\n\r", slist.count()); fflush(stdout); + + SelectServerDialog select(this, 0, slist); + const int ret = select.exec(); + if (ret == KDialog::Accepted) { + TQString result; + ds << TQString("BIND"); + ds << select.m_selectedStation; + ds >> result; + if (result == "OK") { + // Success, do nothing + } + else if (result == "ERRUNAVAL") { + KMessageBox::error(this, i18n("<qt>No stations of the specified type are currently available<p>Please try again later</qt>"), i18n("Insufficient Laboratory Resources")); + disconnectFromServer(); + } + else { + KMessageBox::error(this, i18n("<qt>Unknown server error<p>Please reconnect and try again</qt>"), i18n("Internal Error")); + disconnectFromServer(); + } + } + else { + disconnectFromServer(); + } } void RemoteMDI::disconnectFromServer() { diff --git a/clients/tde/src/dialogs/Makefile.am b/clients/tde/src/dialogs/Makefile.am new file mode 100644 index 0000000..d66c5c7 --- /dev/null +++ b/clients/tde/src/dialogs/Makefile.am @@ -0,0 +1,4 @@ +INCLUDES = $(all_includes) -I$(top_srcdir)/src -I$(top_builddir)/src $(KDE_INCLUDES)/tde +METASOURCES = AUTO +noinst_LTLIBRARIES = libselectserverdlg.la +libselectserverdlg_la_SOURCES = selectserverdlg.cpp selectserverdlgbase.ui
\ No newline at end of file diff --git a/clients/tde/src/dialogs/selectserverdlg.cpp b/clients/tde/src/dialogs/selectserverdlg.cpp new file mode 100644 index 0000000..773ea98 --- /dev/null +++ b/clients/tde/src/dialogs/selectserverdlg.cpp @@ -0,0 +1,115 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * 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 2 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 <tqstringlist.h> +#include <tqlabel.h> +#include <tqmap.h> + +#include <kapplication.h> +#include <ksimpleconfig.h> +#include <klocale.h> +#include <kdebug.h> +#include <kstandarddirs.h> +#include <kiconloader.h> +#include <dcopclient.h> +#include <kprocess.h> +#include <kcombobox.h> +#include <kmessagebox.h> + +#include "selectserverdlg.h" +#include "selectserverdlgbase.h" + +class Q_EXPORT StationTypeListViewItem : public TQListViewItem +{ + public: + StationTypeListViewItem(TQListView * parent) : TQListViewItem(parent) {} + StationTypeListViewItem(TQListViewItem * parent) : TQListViewItem(parent) {} + StationTypeListViewItem(TQListView * parent, TQListViewItem * after) : TQListViewItem(parent, after) {} + StationTypeListViewItem(TQListViewItem * parent, TQListViewItem * after) : TQListViewItem(parent, after) {} + + StationTypeListViewItem(TQListView * parent, TQString s1, TQString s2 = TQString::null, TQString s3 = TQString::null, TQString s4 = TQString::null, TQString s5 = TQString::null, TQString s6 = TQString::null, TQString s7 = TQString::null, TQString s8 = TQString::null) : TQListViewItem(parent, s1, s2, s3, s4, s5, s6, s7, s8) {} + StationTypeListViewItem(TQListViewItem * parent, TQString s1, TQString s2 = TQString::null, TQString s3 = TQString::null, TQString s4 = TQString::null, TQString s5 = TQString::null, TQString s6 = TQString::null, TQString s7 = TQString::null, TQString s8 = TQString::null) : TQListViewItem(parent, s1, s2, s3, s4, s5, s6, s7, s8) {} + + StationTypeListViewItem(TQListView * parent, TQListViewItem * after, TQString s1, TQString s2 = TQString::null, TQString s3 = TQString::null, TQString s4 = TQString::null, TQString s5 = TQString::null, TQString s6 = TQString::null, TQString s7 = TQString::null, TQString s8 = TQString::null) : TQListViewItem(parent, after, s1, s2, s3, s4, s5, s6, s7, s8) {} + StationTypeListViewItem(TQListViewItem * parent, TQListViewItem * after, TQString s1, TQString s2 = TQString::null, TQString s3 = TQString::null, TQString s4 = TQString::null, TQString s5 = TQString::null, TQString s6 = TQString::null, TQString s7 = TQString::null, TQString s8 = TQString::null) : TQListViewItem(parent, after, s1, s2, s3, s4, s5, s6, s7, s8) {} + + ~StationTypeListViewItem() {} + + public: + StationType m_stationType; +}; + +SelectServerDialog::SelectServerDialog(TQWidget* parent, const char* name, StationList sl) + : KDialogBase(parent, name, true, i18n("Workspace Selection"), Ok|Cancel, Ok, true), m_stationList(sl) +{ + unsigned int i; + unsigned int j; + + m_base = new SelectServerDlg(this); + + setMainWidget(m_base); + + m_base->serverList->setAllColumnsShowFocus(true); + m_base->serverList->setFullWidth(true); + + connect(m_base->serverList, TQT_SIGNAL(executed(TQListViewItem*)), this, TQT_SLOT(slotOk())); + + for (i=0; i<m_stationList.count(); i++) { + StationType st = m_stationList[i]; + TQString services; + for (j=0; j<st.services.count(); j++) { + ServiceType servicetype = st.services[j]; + if (j > 0) { + services.append(", "); + } + services.append(servicetype.description); + } + bool newService = true; + TQListViewItemIterator it(m_base->serverList); + while (it.current()) { + StationTypeListViewItem* curItem = dynamic_cast<StationTypeListViewItem*>(it.current()); + if (curItem) { + if (curItem->m_stationType.services == st.services) { + newService = false; + } + ++it; + } + } + if (newService) { + StationTypeListViewItem* item = new StationTypeListViewItem(m_base->serverList, services); + item->m_stationType = st; + } + } +} + +void SelectServerDialog::slotOk() { + StationTypeListViewItem* curItem = dynamic_cast<StationTypeListViewItem*>(m_base->serverList->selectedItem()); + + if (!curItem) { + KMessageBox::error(this, i18n("You must select a workstation type to continue!"), i18n("Input Required")); + return; + } + + m_selectedStation = curItem->m_stationType; + + accept(); +} + +#include "selectserverdlg.moc" diff --git a/clients/tde/src/dialogs/selectserverdlg.h b/clients/tde/src/dialogs/selectserverdlg.h new file mode 100644 index 0000000..740f76b --- /dev/null +++ b/clients/tde/src/dialogs/selectserverdlg.h @@ -0,0 +1,47 @@ +/*************************************************************************** + * Copyright (C) 2012 by Timothy Pearson * + * kb9vqf@pearsoncomputing.net * + * * + * 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 2 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. * + ***************************************************************************/ + +#ifndef _SELECTSERVERDIALOG_H_ +#define _SELECTSERVERDIALOG_H_ + +#include <kdialogbase.h> +#include <kcombobox.h> + +#include <tqtrla.h> + +class SelectServerDlg; + +class SelectServerDialog : public KDialogBase +{ + Q_OBJECT + +public: + SelectServerDialog(TQWidget* parent = 0, const char* name = 0, StationList sl = StationList()); + +public slots: + void slotOk(); + +public: + SelectServerDlg *m_base; + StationList m_stationList; + StationType m_selectedStation; +}; + +#endif
\ No newline at end of file diff --git a/clients/tde/src/dialogs/selectserverdlgbase.ui b/clients/tde/src/dialogs/selectserverdlgbase.ui new file mode 100644 index 0000000..6be0eff --- /dev/null +++ b/clients/tde/src/dialogs/selectserverdlgbase.ui @@ -0,0 +1,67 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>SelectServerDlg</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>SelectServerDlg</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel" row="1" column="0" rowspan="1" colspan="1"> + <property name="name"> + <cstring>px_icon</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>Plain</enum> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="indent"> + <number>0</number> + </property> + </widget> + <widget class="TQLabel" row="1" column="1" colspan="2"> + <property name="name"> + <cstring>prompt</cstring> + </property> + <property name="text"> + <string>Please select the type of laboratory workspace you wish to use</string> + </property> + </widget> + <widget class="KListView" row="2" column="0" colspan="3"> + <column> + <property name="text"> + <string>Workspace Services</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizeable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>serverList</cstring> + </property> + <property name="rootIsDecorated"> + <bool>false</bool> + </property> + </widget> + </grid> +</widget> +<layoutdefaults spacing="3" margin="6"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> |