summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clients/tde/misc/remotelabui.rc4
-rw-r--r--clients/tde/src/app/remotemdi.cpp15
-rw-r--r--clients/tde/src/app/views/Makefile.am2
-rw-r--r--clients/tde/src/app/views/instrumentview.cpp4
-rw-r--r--clients/tde/src/app/views/instrumentview.h10
-rw-r--r--clients/tde/src/part/fpgaview/part.cpp59
-rw-r--r--clients/tde/src/part/fpgaview/part.h19
-rw-r--r--lib/libtqtrla/src/tqtrla.cpp4
-rw-r--r--lib/libtqtrla/src/tqtrla.h4
9 files changed, 115 insertions, 6 deletions
diff --git a/clients/tde/misc/remotelabui.rc b/clients/tde/misc/remotelabui.rc
index 77b519a..76535f5 100644
--- a/clients/tde/misc/remotelabui.rc
+++ b/clients/tde/misc/remotelabui.rc
@@ -6,6 +6,10 @@
<Action name="connect_server"/>
<Action name="disconnect_server"/>
</Menu>
+ <Menu name="selectedInstrumentMenu">
+ <text>Current Instrument</text>
+ <ActionList name="selectedInstrument_actionlist"/>
+ </Menu>
<Menu name="dutMenu">
<text>Device Under Test</text>
<ActionList name="dutMenu_actionlist"/>
diff --git a/clients/tde/src/app/remotemdi.cpp b/clients/tde/src/app/remotemdi.cpp
index bb12837..163699f 100644
--- a/clients/tde/src/app/remotemdi.cpp
+++ b/clients/tde/src/app/remotemdi.cpp
@@ -163,6 +163,13 @@ void RemoteMDI::startModule() {
}
void RemoteMDI::finishConnectingToServer() {
+ if (!m_rsvSvrSocket) {
+ connToServerState = -1;
+ connToServerConnecting = false;
+ processLockouts();
+ return;
+ }
+
if (connToServerConnecting) {
switch(connToServerState) {
case 0:
@@ -410,6 +417,14 @@ void RemoteMDI::childWindowCloseRequest(KMdiChildView *pWnd) {
}
void RemoteMDI::currentChanged(KMdiChildView *current) {
+ RemoteLab::InstrumentView* view = dynamic_cast<RemoteLab::InstrumentView*>(current);
+
+ // Plug/unpug menus
+ unplugActionList("selectedInstrument_actionlist");
+ if (view) {
+ plugActionList("selectedInstrument_actionlist", view->menuActionList());
+ }
+
// Update status bar and list box
updateStatusBarMainMessage(i18n("Instrument %1 activated").arg(current->tabCaption()));
}
diff --git a/clients/tde/src/app/views/Makefile.am b/clients/tde/src/app/views/Makefile.am
index fa77152..fcb1de8 100644
--- a/clients/tde/src/app/views/Makefile.am
+++ b/clients/tde/src/app/views/Makefile.am
@@ -1,4 +1,4 @@
-INCLUDES = -I$(top_srcdir)/src/part $(all_includes)
+INCLUDES = -I$(top_srcdir)/src/part $(all_includes) $(KDE_INCLUDES)/tde
METASOURCES = AUTO
noinst_LTLIBRARIES = libinstrumentview.la
libinstrumentview_la_SOURCES = instrumentview.cpp
diff --git a/clients/tde/src/app/views/instrumentview.cpp b/clients/tde/src/app/views/instrumentview.cpp
index 52ce172..0d287a7 100644
--- a/clients/tde/src/app/views/instrumentview.cpp
+++ b/clients/tde/src/app/views/instrumentview.cpp
@@ -48,6 +48,10 @@ void InstrumentView::init() {
}
}
+TQPtrList<KAction> InstrumentView::menuActionList() {
+ return m_instrumentPart->menuActionList();
+}
+
void InstrumentView::setStatusMessage(const TQString& message) {
emit(statusMessageSet(message));
}
diff --git a/clients/tde/src/app/views/instrumentview.h b/clients/tde/src/app/views/instrumentview.h
index c0343c8..6482fd1 100644
--- a/clients/tde/src/app/views/instrumentview.h
+++ b/clients/tde/src/app/views/instrumentview.h
@@ -1,18 +1,20 @@
//Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>, (C) 2012
//Copyright: See COPYING file that comes with this distribution
-#ifndef SPECTRUMANALYZERVIEW_H
-#define SPECTRUMANALYZERVIEW_H
+#ifndef INSTRUMENTVIEW_H
+#define INSTRUMENTVIEW_H
#include <kconfig.h>
#include <kparts/part.h>
#include <kmdichildview.h>
+#include <tqtrla.h>
+
class KAction;
namespace RemoteLab {
-typedef KParts::ReadOnlyPart InstrumentPart;
+typedef KParts::RemoteInstrumentPart InstrumentPart;
class InstrumentView : public KMdiChildView
{
@@ -24,6 +26,8 @@ class InstrumentView : public KMdiChildView
~InstrumentView();
void connectServer(TQString server);
void closeConnections();
+
+ TQPtrList<KAction> menuActionList();
protected:
virtual void saveProperties(KConfig *);
diff --git a/clients/tde/src/part/fpgaview/part.cpp b/clients/tde/src/part/fpgaview/part.cpp
index 316fd48..6161562 100644
--- a/clients/tde/src/part/fpgaview/part.cpp
+++ b/clients/tde/src/part/fpgaview/part.cpp
@@ -54,7 +54,7 @@ K_EXPORT_COMPONENT_FACTORY(libremotelab_fpgaviewer, RemoteLab::Factory)
FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name, const TQStringList&)
- : RemoteInstrumentPart( parent, name ), m_socket(0), m_base(0), connToServerConnecting(false), connToServerState(-1), connToServerTimeoutTimer(NULL)
+ : RemoteInstrumentPart( parent, name ), m_socket(0), m_base(0), connToServerConnecting(false), connToServerState(-1), connToServerTimeoutTimer(NULL), m_interfaceMode(BasicInterfaceMode)
{
// Initialize mutex
m_connectionMutex = new TQMutex(false);
@@ -69,6 +69,19 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj
// Create widgets
m_base = new FPGAViewBase(widget());
+ // Create menu actions
+ // Submenus
+ KActionCollection *const ac = actionCollection();
+ m_modeSubMenu = new KActionMenu(i18n("Mode"), ac, "mode_submenu");
+ m_menuActionList.append(m_modeSubMenu);
+ // Menu items
+ m_modeBasicEnabled = new KToggleAction(i18n("Basic"), KShortcut(), TQT_TQOBJECT(this), TQT_SLOT(switchToBasicMode()), ac, "mode_basic_enabled");
+ m_modeSubMenu->insert(m_modeBasicEnabled);
+ m_modeIntermediateEnabled = new KToggleAction(i18n("Intermediate"), KShortcut(), TQT_TQOBJECT(this), TQT_SLOT(switchToIntermediateMode()), ac, "mode_intermediate_enabled");
+ m_modeSubMenu->insert(m_modeIntermediateEnabled);
+ m_modeAdvancedEnabled = new KToggleAction(i18n("Advanced"), KShortcut(), TQT_TQOBJECT(this), TQT_SLOT(switchToAdvancedMode()), ac, "mode_advanced_enabled");
+ m_modeSubMenu->insert(m_modeAdvancedEnabled);
+
processLockouts();
TQTimer::singleShot(0, this, TQT_SLOT(postInit()));
@@ -86,13 +99,44 @@ FPGAViewPart::~FPGAViewPart() {
void FPGAViewPart::processLockouts() {
TQWidget* mainWidget = widget();
if (mainWidget) {
- if ((m_socket) && (m_socket->state() == TQSocket::Connected)) {
+ if ((m_socket) && (m_socket->state() == TQSocket::Connected) && (connToServerState > 0) && (connToServerConnecting == false)) {
mainWidget->setEnabled(true);
}
else {
mainWidget->setEnabled(false);
}
}
+
+ if (m_interfaceMode == BasicInterfaceMode) {
+ m_modeBasicEnabled->setChecked(true);
+ m_modeIntermediateEnabled->setChecked(false);
+ m_modeAdvancedEnabled->setChecked(false);
+ }
+ if (m_interfaceMode == IntermediateInterfaceMode) {
+ m_modeBasicEnabled->setChecked(false);
+ m_modeIntermediateEnabled->setChecked(true);
+ m_modeAdvancedEnabled->setChecked(false);
+ }
+ if (m_interfaceMode == AdvancedInterfaceMode) {
+ m_modeBasicEnabled->setChecked(false);
+ m_modeIntermediateEnabled->setChecked(false);
+ m_modeAdvancedEnabled->setChecked(true);
+ }
+}
+
+void FPGAViewPart::switchToBasicMode() {
+ m_interfaceMode = BasicInterfaceMode;
+ processLockouts();
+}
+
+void FPGAViewPart::switchToIntermediateMode() {
+ m_interfaceMode = IntermediateInterfaceMode;
+ processLockouts();
+}
+
+void FPGAViewPart::switchToAdvancedMode() {
+ m_interfaceMode = AdvancedInterfaceMode;
+ processLockouts();
}
void FPGAViewPart::connectionClosed() {
@@ -127,6 +171,13 @@ void FPGAViewPart::disconnectFromServer() {
}
void FPGAViewPart::finishConnectingToServer() {
+ if (!m_socket) {
+ connToServerState = -1;
+ connToServerConnecting = false;
+ processLockouts();
+ return;
+ }
+
if (connToServerConnecting) {
switch(connToServerState) {
case 0:
@@ -254,6 +305,10 @@ int FPGAViewPart::connectToServer(TQString server) {
return 0;
}
+TQPtrList<KAction> FPGAViewPart::menuActionList() {
+ return m_menuActionList;
+}
+
void FPGAViewPart::updateDisplay() {
// RAJA FIXME
}
diff --git a/clients/tde/src/part/fpgaview/part.h b/clients/tde/src/part/fpgaview/part.h
index 02797d8..3e8ac07 100644
--- a/clients/tde/src/part/fpgaview/part.h
+++ b/clients/tde/src/part/fpgaview/part.h
@@ -45,6 +45,13 @@ namespace RemoteLab
class FPGAViewPart : public KParts::RemoteInstrumentPart
{
Q_OBJECT
+
+ public:
+ enum InterfaceMode {
+ BasicInterfaceMode,
+ IntermediateInterfaceMode,
+ AdvancedInterfaceMode
+ };
public:
FPGAViewPart(TQWidget *, const char *, TQObject *, const char *, const TQStringList&);
@@ -54,6 +61,7 @@ namespace RemoteLab
virtual bool closeURL();
static KAboutData *createAboutData();
int connectToServer(TQString server);
+ virtual TQPtrList<KAction> menuActionList();
public slots:
virtual bool openURL(const KURL &url);
@@ -65,6 +73,9 @@ namespace RemoteLab
void connectionClosed();
void disconnectFromServer();
void finishConnectingToServer();
+ void switchToBasicMode();
+ void switchToIntermediateMode();
+ void switchToAdvancedMode();
private:
TDEKerberosClientSocket* m_socket;
@@ -75,6 +86,14 @@ namespace RemoteLab
bool connToServerConnecting;
int connToServerState;
TQTimer *connToServerTimeoutTimer;
+
+ TQPtrList<KAction> m_menuActionList;
+ KActionMenu* m_modeSubMenu;
+ KToggleAction* m_modeBasicEnabled;
+ KToggleAction* m_modeIntermediateEnabled;
+ KToggleAction* m_modeAdvancedEnabled;
+
+ InterfaceMode m_interfaceMode;
};
}
diff --git a/lib/libtqtrla/src/tqtrla.cpp b/lib/libtqtrla/src/tqtrla.cpp
index e3001fb..7ec457c 100644
--- a/lib/libtqtrla/src/tqtrla.cpp
+++ b/lib/libtqtrla/src/tqtrla.cpp
@@ -56,6 +56,10 @@ namespace KParts
return false;
}
+ TQPtrList<KAction> RemoteInstrumentPart::menuActionList() {
+ return TQPtrList<KAction>();
+ }
+
void RemoteInstrumentPart::close() {
TQWidget* parentWidget = dynamic_cast<TQWidget*>(parent());
if (parentWidget) {
diff --git a/lib/libtqtrla/src/tqtrla.h b/lib/libtqtrla/src/tqtrla.h
index b43ea22..fe3c5ee 100644
--- a/lib/libtqtrla/src/tqtrla.h
+++ b/lib/libtqtrla/src/tqtrla.h
@@ -22,6 +22,9 @@
#define TQTRLA_H
#include <tqobject.h>
+#include <tqptrlist.h>
+
+#include <kaction.h>
#include <kparts/part.h>
@@ -45,6 +48,7 @@ namespace KParts
public:
KURL url() const { return m_url; }
virtual bool closeURL();
+ virtual TQPtrList<KAction> menuActionList();
protected slots:
void close();