#include <libconfig.h>
#include "kernel.h"
+#include "kernelwindow.h"
/* File resides in top directory (where are Makefiles)*/
#include "../../config.h"
e->ignore();
if (!LOCKED) {
- QuitProc();
+ on_actionQuit_triggered();
}
}
{
LOCKED = locked;
- quitAction->setDisabled(locked);
- programExecuteAction->setDisabled(locked);
- programKillAction->setDisabled(locked);
- machineMessageAction->setDisabled(locked);
- machineConnectAction->setDisabled(locked);
- machineDisconnectAction->setDisabled(locked);
- machineInfoAction->setDisabled(locked);
+ actionQuit->setDisabled(locked);
+
+ actionExecute->setDisabled(locked);
+ actionKill->setDisabled(locked);
+ actionMessage->setDisabled(locked);
+ actionConnect->setDisabled(locked);
+ actionDisconnect->setDisabled(locked);
+ actionInfo->setDisabled(locked);
+
/* Enable only menu entry for unlocking */
- toolsEditorAction->setDisabled(locked);
- toolsOptionsAction->setDisabled(locked);
- toolsLockAction->setDisabled(locked);
- toolsUnlockAction->setEnabled(locked);
+ actionEditor->setDisabled(locked);
+ actionOptions->setDisabled(locked);
+ actionLock_console->setDisabled(locked);
+ actionUnlock_console->setDisabled(!locked);
}
/**
*/
QKernel::QKernel()
{
+ setupUi(this);
+
QDir q(REMOTE_PATH);
char ss[255];
setWindowTitle(PACKAGE_NAME);
- QMenu * programMenu = NULL;
- programMenu = menuBar()->addMenu("&Program");
- programExecuteAction = programMenu->addAction("Execute", this, SLOT(Run_Prog()));
- programKillAction = programMenu->addAction("Kill", this, SLOT(KillInterpreter()));
-
- machineMenu = menuBar()->addMenu("&Machine");
- machineMessageAction = machineMenu->addAction("Message", this, SLOT(MessageToNode()));
- machineMenu->addSeparator();
- machineConnectAction = machineMenu->addAction("Connect", this, SLOT(Connect()));
- machineDisconnectAction = machineMenu->addAction("Disconnect", this, SLOT(Disconnect()));
- machineInfoAction = machineMenu->addAction("Info", this, SLOT(Info()));
-
- toolsMenu = menuBar()->addMenu("&Tools");
- toolsEditorAction = toolsMenu->addAction("Editor", this, SLOT(Edit()));
- toolsMenu->addAction("Help", this, SLOT(Help()));
- toolsMenu->addSeparator();
- toolsOptionsAction = toolsMenu->addAction("Options", this, SLOT(SetOptions()));
- toolsInfoAction = toolsMenu->addAction("Info messages", this, SLOT(SetMessages()));
- toolsInfoAction->setCheckable(TRUE);
- toolsInfoAction->setChecked(TRUE);
- toolsMenu->addSeparator();
- toolsLockAction = toolsMenu->addAction("Lock console", this, SLOT(LockConsole()));
- toolsUnlockAction = toolsMenu->addAction("Unlock console", this,
- SLOT(UnlockConsole()));
- toolsUnlockAction->setDisabled(TRUE);
LOCKED = FALSE;
- quitAction = menuBar()->addAction("&Quit", this, SLOT(QuitProc()));
-
desktop = new QTextEdit(this);
desktop->setReadOnly(TRUE);
QVBoxLayout * layout = new QVBoxLayout();
* Executes program.
* Additional window id displayed to set which code to execute.
*/
-void QKernel::Run_Prog()
+void QKernel::on_actionExecute_triggered()
{
int i;
QString s = QFileDialog::getOpenFileName(this, "Execute", progdir, "*.log");
/**
* Invokes editor program
*/
-void QKernel::Edit()
+void QKernel::on_actionEditor_triggered()
{
char cmd[255];
sprintf(cmd, "%s/modules/logedit %s %s %s %s %s %s &", HomeDir, HomeDir,
/**
* Invokes help program
*/
-void QKernel::Help()
+void QKernel::on_actionHelp_triggered()
{
char cmd[255];
sprintf(cmd, "%s/modules/loghelp %s/doc %s %s %s %s %s &", HomeDir,
WriteMessage("Cannot connect NETWORK resources");
WriteMessage("Exiting...");
sleep(2);
- QuitProc();
+ on_actionQuit_triggered();
}
/* system OK */
} else {
WriteMessage("Cannot connect NETWORK resources");
WriteMessage("Exiting...");
sleep(2);
- QuitProc();
+ on_actionQuit_triggered();
}
}
* Connects to the specified address
* Additional window is displayed to connect to the specified address
*/
-void QKernel::Connect()
+void QKernel::on_actionConnect_triggered()
{
QDialog d(this, Qt::Dialog);
QLabel lab("IP Address:", &d);
/**
* Disconnects from virtual machine
*/
-void QKernel::Disconnect()
+void QKernel::on_actionDisconnect_triggered()
{
MESSAGE msg;
/**
* Quits process. Closes VLP. Shows additional window to confirm exit.
*/
-void QKernel::QuitProc()
+void QKernel::on_actionQuit_triggered()
{
MESSAGE msg;
* Additional window is displayed to set Node Number of node where send message,
* and textfield to enter message.
*/
-void QKernel::MessageToNode()
+void QKernel::on_actionMessage_triggered()
{
QDialog *dlg;
QLineEdit *nodenr;
* Additional window is displayed to get ID of interpreter which should be
* killed.
*/
-void QKernel::KillInterpreter()
+void QKernel::on_actionKill_triggered()
{
QDialog *dlg;
QLineEdit *nodenr;
* Adds checkbox to menu item. If it is checked additional info messages are
* shown.
*/
-void QKernel::SetMessages()
+void QKernel::on_actionInfo_messages_triggered()
{
if (toolsMenu != NULL) {
- toolsInfoAction->setChecked(!toolsInfoAction->isChecked());
-// toolsInfoAction->toggle();
- info_messages = toolsInfoAction->isChecked();
- fprintf(stderr, "Info is checked? %s\n", toolsInfoAction->isChecked() ? "yes" : "no");
+ actionInfo_messages->setChecked(!actionInfo_messages->isChecked());
+// actionInfo_messages->toggle();
+ info_messages = actionInfo_messages->isChecked();
+ fprintf(stderr, "Info is checked? %s\n", actionInfo_messages->isChecked() ? "yes" : "no");
}
// menuBar()->repaint();
}
* Additional window is displayed to set kernel options which are saved in
* vlp.cfg file in kernel executable directory.
*/
-void QKernel::SetOptions()
+void QKernel::on_actionOptions_triggered()
{
QDialog dlg(this, Qt::Dialog);
dlg.setWindowTitle("Options");
* Additional window is displayed to enter password and retype it. If both are
* same kernel window is locked.
*/
-void QKernel::LockConsole()
+void QKernel::on_actionLock_console_triggered()
{
QDialog d(this, Qt::Dialog);
d.setWindowTitle("Lock console");
* Additional window is displayed to enter password. If it is correct, kernel
* window is unlocked
*/
-void QKernel::UnlockConsole()
+void QKernel::on_actionUnlock_console_triggered()
{
QDialog d(this, Qt::Dialog);
d.setWindowTitle("Enter password");
/**
* Displays information about virtual machine
*/
-void QKernel::Info()
+void QKernel::on_actionInfo_triggered()
{
MESSAGE m;
#include "comm.h"
+#include "kernelwindow.h"
+
#define GPATH "loggr"
#define IPATH "logi"
#define NPATH "logn"
/**
* Kernel class
*/
-class QKernel : public QMainWindow {
+class QKernel : public QMainWindow, private Ui::KernelWindow {
Q_OBJECT
public:
QTextEdit *desktop;
public slots:
void n_impl();
- void Run_Prog();
- void Edit();
- void Help();
- void SetOptions();
void AddAddress();
void DelAddress();
- void LockConsole();
- void UnlockConsole();
- void MessageToNode();
- void QuitProc();
void NetMessage();
void IntMessage(int);
- void KillInterpreter();
- void Disconnect();
- void SetMessages();
- void Connect();
- void Info();
protected:
virtual void closeEvent (QCloseEvent * e);
bool synchro;
bool wait_for_info;
char LockPasswd[25];
- QAction * toolsEditorAction;
- QAction * toolsOptionsAction;
- QAction * toolsInfoAction;
- QAction * programExecuteAction;
- QAction * programKillAction;
- QAction * machineMessageAction;
- QAction * machineConnectAction;
- QAction * machineDisconnectAction;
- QAction * machineInfoAction;
- QAction * toolsLockAction;
- QAction * toolsUnlockAction;
QAction * quitAction;
int net_sock;
* @param locked status which will be set on the menu entries.
*/
void setLocked(bool locked);
+
+private slots:
+ void on_actionExecute_triggered();
+ void on_actionKill_triggered();
+ void on_actionQuit_triggered();
+
+ void on_actionMessage_triggered();
+ void on_actionConnect_triggered();
+ void on_actionDisconnect_triggered();
+ void on_actionInfo_triggered();
+
+ void on_actionEditor_triggered();
+ void on_actionHelp_triggered();
+ void on_actionOptions_triggered();
+ void on_actionInfo_messages_triggered();
+ void on_actionLock_console_triggered();
+ void on_actionUnlock_console_triggered();
};
#endif /* VLP_KERNEL_H */
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>KernelWindow</class>
+ <widget class="QMainWindow" name="KernelWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>600</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget"/>
+ <widget class="QMenuBar" name="menubar">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>800</width>
+ <height>19</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuProgram">
+ <property name="title">
+ <string>Program</string>
+ </property>
+ <addaction name="actionExecute"/>
+ <addaction name="actionKill"/>
+ <addaction name="separator"/>
+ <addaction name="actionQuit"/>
+ </widget>
+ <widget class="QMenu" name="menuMachine">
+ <property name="title">
+ <string>Machine</string>
+ </property>
+ <addaction name="actionMessage"/>
+ <addaction name="separator"/>
+ <addaction name="actionConnect"/>
+ <addaction name="actionDisconnect"/>
+ <addaction name="actionInfo"/>
+ </widget>
+ <widget class="QMenu" name="menuTools">
+ <property name="title">
+ <string>Tools</string>
+ </property>
+ <addaction name="actionEditor"/>
+ <addaction name="actionHelp"/>
+ <addaction name="separator"/>
+ <addaction name="actionOptions"/>
+ <addaction name="actionInfo_messages"/>
+ <addaction name="separator"/>
+ <addaction name="actionLock_console"/>
+ <addaction name="actionUnlock_console"/>
+ </widget>
+ <addaction name="menuProgram"/>
+ <addaction name="menuMachine"/>
+ <addaction name="menuTools"/>
+ </widget>
+ <widget class="QStatusBar" name="statusbar"/>
+ <action name="actionExecute">
+ <property name="text">
+ <string>Execute</string>
+ </property>
+ </action>
+ <action name="actionKill">
+ <property name="text">
+ <string>Kill</string>
+ </property>
+ </action>
+ <action name="actionMessage">
+ <property name="text">
+ <string>Message</string>
+ </property>
+ </action>
+ <action name="actionConnect">
+ <property name="text">
+ <string>Connect</string>
+ </property>
+ </action>
+ <action name="actionDisconnect">
+ <property name="text">
+ <string>Disconnect</string>
+ </property>
+ </action>
+ <action name="actionInfo">
+ <property name="text">
+ <string>Info</string>
+ </property>
+ </action>
+ <action name="actionEditor">
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Editor</string>
+ </property>
+ </action>
+ <action name="actionHelp">
+ <property name="text">
+ <string>Help</string>
+ </property>
+ </action>
+ <action name="actionOptions">
+ <property name="text">
+ <string>Options</string>
+ </property>
+ </action>
+ <action name="actionInfo_messages">
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="enabled">
+ <bool>true</bool>
+ </property>
+ <property name="text">
+ <string>Info messages</string>
+ </property>
+ </action>
+ <action name="actionLock_console">
+ <property name="text">
+ <string>Lock console</string>
+ </property>
+ </action>
+ <action name="actionUnlock_console">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Unlock console</string>
+ </property>
+ </action>
+ <action name="actionQuit">
+ <property name="text">
+ <string>Quit</string>
+ </property>
+ </action>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>