src/kernel/kernel.moc.cpp \
src/kernel/lock.cpp \
src/kernel/options.cpp \
- src/kernel/options.moc.cpp
+ src/kernel/options.moc.cpp \
+ src/kernel/kill_interpreter_dialog.cpp
bin_logker_CPPFLAGS = $(bin_logker_CFLAGS)
bin_logker_LDADD = $(bin_logker_LIBS) -lconfig++ -lX11
bin_logkerdir = src/kernel
bin_logker_HEADERS = \
src/kernel/kernel.h \
src/kernel/lock.h \
- src/kernel/options.h
-src/kernel/kernel.moc.cpp: src/kernel/kernel.h src/kernel/ui/kernelwindow.h src/kernel/ui/lock_dialog.h src/kernel/ui/optionsdialog.h
+ src/kernel/options.h \
+ src/kernel/kill_interpreter_dialog.h
+src/kernel/kernel.moc.cpp: src/kernel/kernel.h src/kernel/ui/kernelwindow.h src/kernel/ui/lock_dialog.h src/kernel/ui/optionsdialog.h src/kernel/ui/kill_dialog.h
moc-qt4 src/kernel/kernel.h -o src/kernel/kernel.moc.cpp
moc-qt4 src/kernel/options.h -o src/kernel/options.moc.cpp
# $(MOC) -i src/kernel/kernel.cpp -o src/kernel/kernel.moc
src/kernel/ui/optionsdialog.h:
uic src/kernel/ui/optionsdialog.ui -o src/kernel/ui/optionsdialog.h
+src/kernel/ui/kill_dialog.h:
+ uic src/kernel/ui/kill_dialog.ui -o src/kernel/ui/kill_dialog.h
+
clean-logker-extra:
rm -f src/kernel/*.moc
#include "ui/kernelwindow.h"
#include "lock.h"
#include "options.h"
+#include "kill_interpreter_dialog.h"
/* File resides in top directory (where are Makefiles)*/
#include "../../config.h"
*/
void QKernel::on_actionKill_triggered()
{
- QDialog *dlg;
- QLineEdit *nodenr;
- MESSAGE m;
- InterpEntry *pom;
-
- dlg = new QDialog(this, Qt::Dialog);
- dlg->setWindowTitle("Kill interpreter");
-
- nodenr = new QLineEdit("", dlg);
- nodenr->setGeometry(90, 10, 50, 30);
-
- QLabel * tmpQLabel = new QLabel("Interp. ID:", dlg);
- tmpQLabel->setGeometry(10, 10, 77, 30);
-
- QPushButton * ob = new QPushButton("Kill", dlg);
- ob->setGeometry( 160, 10, 80, 30);
- ob->setDefault(TRUE);
+ KillInterpreterDialog dialog(this);
+ dialog.setWindowTitle("Kill interpreter");
- QPushButton * cb = new QPushButton("Cancel", dlg);
- cb->setGeometry(260, 10, 80, 30);
- dlg->resize(360, 50);
-
- connect(ob, SIGNAL(clicked()), dlg, SLOT(accept()));
- connect(cb, SIGNAL(clicked()), dlg, SLOT(reject()));
+ MESSAGE m;
+ InterpEntry *interpreter;
- if (dlg->exec()) {
+ if (dialog.exec()) {
m.msg_type = MSG_INT;
m.param.pword[0] = INT_KILL;
- pom = findINTbyID(atoi(nodenr->text().toAscii().data()));
- if (pom != NULL) {
- if (!(pom->remote))
- write(pom->sock, &m, sizeof(MESSAGE));
+ interpreter = findINTbyID(dialog.getInterpreterId());
+ if (interpreter != NULL) {
+ if (!(interpreter->remote))
+ write(interpreter->sock, &m, sizeof(MESSAGE));
else
- WriteMessage("This is a remote instance of "
- "a program!");
+ WriteMessage("This is a remote instance of a program!");
}
else {
WriteMessage("Interpreter not found");
if (lockDialog.exec()) {
QString password = lockDialog.getPassword();
if (lockDialog.getPassword().size() > 0) {
- strcpy(LockPasswd, password.toAscii().data());
+ strcpy(LockPasswd, password.toStdString().c_str());
lockDialog.retype();
if (lockDialog.exec()) {
*/
void QKernel::on_actionUnlock_console_triggered()
{
- QDialog d(this, Qt::Dialog);
- d.setWindowTitle("Enter password");
-
- QLabel lab("Password:", &d);
- lab.setGeometry(10, 10, 60, 30);
-
- QLineEdit ed("", &d);
- ed.setGeometry(70, 10, 140, 30);
- ed.setEchoMode(QLineEdit::Password);
-
- QPushButton ob("Ok", &d);
- ob.setGeometry(30, 60, 80, 30);
- ob.setDefault(TRUE);
- connect(&ob, SIGNAL(clicked()), &d, SLOT(accept()));
-
- QPushButton cb("Cancel", &d);
- cb.setGeometry(130, 60, 80, 30);
- connect(&cb, SIGNAL(clicked()), &d, SLOT(reject()));
-
- d.resize(240, 100);
+ LockDialog lockDialog(this);
- if (d.exec()) {
- if (strcmp(ed.text().toAscii().data(), LockPasswd) == 0) {
+ if (lockDialog.exec()) {
+ QString password = lockDialog.getPassword();
+ if (strcmp(password.toStdString().c_str(), LockPasswd) == 0) {
setLocked(FALSE);
WriteMessage("CONSOLE UNLOCKED");
} else {
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>KillInterpreterDialog</class>
+ <widget class="QDialog" name="KillInterpreterDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>184</width>
+ <height>71</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Interp. ID:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="interpreterId"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>KillInterpreterDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>KillInterpreterDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>