summaryrefslogtreecommitdiffstats
path: root/clients/tde/src/part/fpgaview/part.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clients/tde/src/part/fpgaview/part.cpp')
-rw-r--r--clients/tde/src/part/fpgaview/part.cpp59
1 files changed, 57 insertions, 2 deletions
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
}