VLP-28 Initial port to Qt4 of logker. 3.1.2-a2
authorRafał Długołęcki <kontakt@dlugolecki.net.pl>
Sat, 26 Oct 2013 23:21:12 +0000 (01:21 +0200)
committerRafał Długołęcki <kontakt@dlugolecki.net.pl>
Sat, 26 Oct 2013 23:21:12 +0000 (01:21 +0200)
Makefile.am
configure.ac
src/global/genint1.h
src/kernel/kernel.cpp

index 01ea3163d962e278c6e60795b222e2412ddd61fa..02664503bb87784af6d9a9d7a71af9b53cec9c74 100644 (file)
@@ -66,7 +66,8 @@ bin_logker_SOURCES = src/kernel/kernel.cpp src/kernel/kernel.moc
 bin_logker_CPPFLAGS = $(bin_logker_CFLAGS)
 bin_logker_LDADD = $(bin_logker_LIBS)
 src/kernel/kernel.moc:
-       $(MOC) -i src/kernel/kernel.cpp -o src/kernel/kernel.moc
+       moc-qt4 -i src/kernel/kernel.cpp -o src/kernel/kernel.moc
+#      $(MOC) -i src/kernel/kernel.cpp -o src/kernel/kernel.moc
        
 clean-logker-extra:
        rm -f src/kernel/*.moc
index 42d96b154528182473c2fa5e3ffefb1549cabfa8..859f94e9173d06220112a9f70b2de2f330718ec1 100644 (file)
@@ -1,4 +1,4 @@
-AC_INIT([Virtual Loglan Processor], [3.1.1], [bugz@dlugolecki.net.pl], [vlp], [http://dlugolecki.net.pl/software/vlp/])
+AC_INIT([Virtual Loglan Processor], [3.1.2-a2], [bugz@dlugolecki.net.pl], [vlp], [http://dlugolecki.net.pl/software/vlp/])
 AC_PREREQ([2.59])
 AM_INIT_AUTOMAKE([1.10 no-define])
 AC_CONFIG_HEADERS([config.h])
@@ -13,7 +13,7 @@ AC_CONFIG_FILES([Makefile])
 # qt3-dev-tools:i386
 PKG_CHECK_MODULES([bin_loggraph], [qt-mt < 4.0])
 PKG_CHECK_MODULES([bin_lognet], [qt-mt < 4.0 libconfig])
-PKG_CHECK_MODULES([bin_logker], [qt-mt < 4.0 libconfig])
+PKG_CHECK_MODULES([bin_logker], [QtCore >= 4.0 QtGui >= 4.0 libconfig])
 #PKG_CHECK_MODULES([bin_logint], [qt-mt < 4.0])
 PKG_CHECK_MODULES([bin_logedit], [QtCore >= 4.0 QtGui >= 4.0 ])
 PKG_CHECK_MODULES([bin_lgconfig], [qt-mt < 4.0 libconfig])
index 1bb97d31a14469397f0de905b4818e16e36ec6e8..c098f2a1ed76ee5c71b650fdd9705fa3c19c60c4 100644 (file)
@@ -28,6 +28,9 @@ or             Andrzej Salwicki
 =======================================================================
 */
 
+#ifndef __GENINT_H
+#define __GENINT_H
+
 #if GEN
 #define word address
 #endif
@@ -67,8 +70,14 @@ or             Andrzej Salwicki
 typedef int bool;
 #endif
 
+/* In Qt4 these 2 definitions are already made */
+#ifndef FALSE
 #define FALSE           0
+#endif
+
+#ifndef TRUE
 #define TRUE            1
+#endif
 
 
 /* Values identifying types and formal parameters: */
@@ -251,3 +260,5 @@ typedef struct {
 } protdescr,*pointprdsc;
 
 /** @} */
+
+#endif /* __GENINT_H */
index 16bda4f4ed2546a6526d2367b966c5ec947a69be..d05e12e949f200dc0e1bbea0a4adf921d825c065 100644 (file)
 
 #include <qpixmap.h>
 //#include <qwindow.h>
-#include <qapp.h>
-#include <qframe.h>
-#include <qmlined.h>
-#include <qpainter.h>
+#include <QtGui/QApplication>
+#include <QtGui/QMainWindow>
+//#include <qframe.h>
+//#include <qmlined.h>
+//#include <qpainter.h>
+#include <QtGui/QTextEdit>
 #include <qcolor.h>
 #include <qbrush.h>
-#include <qmenubar.h>
-#include <qpopmenu.h>
+#include <QtGui/QMenuBar>
+//#include <qmenubar.h>
+//#include <qpopmenu.h>
 #include <qfont.h>
-#include <qmsgbox.h>
-#include <qfiledlg.h>
-#include <qtabdlg.h>
+#include <QtGui/QMessageBox>
+//#include <qmsgbox.h>
+//#include <qfiledlg.h>
+#include <QtGui/QFileDialog>
+#include <QtGui/QDialog>
+//#include <qtabdlg.h>
 #include <qstring.h>
 #include <qrect.h>
-#include <qdialog.h>
-#include <qbttngrp.h>
-#include <qlabel.h>
-#include <qlined.h>
-#include <qlistbox.h>
-#include <qpushbt.h>
-#include <qradiobt.h>
-#include <qlist.h>
+//#include <qdialog.h>
+//#include <qbttngrp.h>
+#include <QtGui/QLabel>
+#include <QtGui/QLineEdit>
+#include <QtGui/QPushButton>
+#include <QtGui/QRadioButton>
+#include <QtGui/QGroupBox>
+#include <QtGui/QVBoxLayout>
+//#include <qlined.h>
+//#include <qlistbox.h>
+//#include <qpushbt.h>
+//#include <qradiobt.h>
+//#include <qlist.h>
+#include <QtCore/QList>
+#include <QtGui/QListWidget>
 #include <qfile.h>
 #include <qcursor.h>
-#include <qcombo.h>
-#include <qsocknot.h>
+//#include <qcombo.h>
+//#include <qsocknot.h>
+#include <QtCore/QSocketNotifier>
 #include <qdir.h>
 #include <qwindowsstyle.h>
 
@@ -131,14 +145,14 @@ QApplication *app;
 /**
  * Kernel class
  */
-class QKernel : public QFrame {
+class QKernel : public QMainWindow {
        Q_OBJECT
 public:
-       QMultiLineEdit *desktop;
+       QTextEdit *desktop;
        QMenuBar *bar;
-       QPopupMenu *p;
-       QPopupMenu *p1;
-       QPopupMenu *p2;
+       QMenu *programMenu;
+       QMenu *machineMenu;
+       QMenu *toolsMenu;
        char progdir[256];
        int NodeNumber;
        int ConType;
@@ -174,9 +188,9 @@ protected:
        virtual void closeEvent (QCloseEvent * e);
 
 private:
-       QList<InterpEntry> Interpreters;         
-       QList<ConnectEntry> ConnectList;
-       QListBox *connections;
+       QList<InterpEntry*> Interpreters;
+       QList<ConnectEntry*> ConnectList;
+       QListWidget *connections;
        
        /**
         * number of working interpreters
@@ -191,16 +205,16 @@ private:
        bool synchro;
        bool wait_for_info;
        char LockPasswd[25];
-       int lockid;
-       int unlockid;
-       int qid;
-       int cwid;
-       int optid;
-       int prid;
-       int mid;
-       int msgid;
-       int toolsid;
-       int hid;
+       QAction * lockid;
+       QAction * unlockid;
+       QAction * qid;
+       QAction * cwid;
+       QAction * optid;
+       QAction * prid;
+       QAction * mid;
+       QAction * msgid;
+       QAction * toolsid;
+       QAction * hid;
        
        int net_sock;
        int freeINTid;
@@ -233,9 +247,9 @@ void QKernel::closeEvent(QCloseEvent * e)
  */
 QKernel::QKernel()
 {
-       QFont f("Helvetica", 10, QFont::Bold);
-       QFont f1("Helvetica", 10, QFont::Normal);
-       QFont f2("Times Roman", 10, QFont::Normal);
+//     QFont f("Helvetica", 10, QFont::Bold);
+//     QFont f1("Helvetica", 10, QFont::Normal);
+//     QFont f2("Times Roman", 10, QFont::Normal);
        QDir q(REMOTE_PATH);
        char ss[255];
 
@@ -247,48 +261,65 @@ QKernel::QKernel()
        info_messages = TRUE;
        wait_for_info = FALSE;
 
-       setCaption(PACKAGE_NAME);
-       setBackgroundColor(white);
-
-       bar = new QMenuBar(this);
-       bar->setFont(f); 
-       p = new QPopupMenu();
-       p->setFont(f2);
-       p->insertItem("Execute", this, SLOT(Run_Prog()));
-       p->insertItem("Kill", this, SLOT(KillInterpreter()));
-       prid = bar->insertItem("&Program", p);
-       p1 = new QPopupMenu();
-       p1->insertItem("Message", this, SLOT(MessageToNode()));
-       p1->insertSeparator();
-       p1->insertItem("Connect", this, SLOT(Connect()));
-       p1->insertItem("Disconnect", this, SLOT(Disconnect()));
-       p1->insertItem("Info", this, SLOT(Info()));
-       p1->setFont(f);
-       mid = bar->insertItem("&Machine", p1);
-
-       p2 = new QPopupMenu();
-       cwid = p2->insertItem("Editor", this, SLOT(Edit()));
-       hid = p2->insertItem("Help", this, SLOT(Help()));
-       p2->insertSeparator(); 
-       optid = p2->insertItem("Options", this, SLOT(SetOptions()));
-       msgid = p2->insertItem("Info messages", this, SLOT(SetMessages()));
-       p2->setItemChecked(msgid, TRUE);
-       p2->insertSeparator(); 
-       lockid = p2->insertItem("Lock console", this, SLOT(LockConsole()));
-       unlockid = p2->insertItem("Unlock console", this, 
+       setWindowTitle(PACKAGE_NAME);
+//     setBackgroundColor(white);
+
+//     bar = new QMenuBar(this);
+//     bar->setFont(f);
+//     p = new QPopupMenu();
+       QMenu * programMenu = NULL;
+//     p->setFont(f2);
+       programMenu = menuBar()->addMenu("&Program");
+//     prid = bar->insertItem("&Program", p);
+       programMenu->addAction("Execute", this, SLOT(Run_Prog()));
+       programMenu->addAction("Kill", this, SLOT(KillInterpreter()));
+       
+
+//     mid = bar->insertItem("&Machine", p1);
+       machineMenu = menuBar()->addMenu("&Machine");
+//     p1 = new QPopupMenu();
+       machineMenu->addAction("Message", this, SLOT(MessageToNode()));
+       machineMenu->addSeparator();
+       machineMenu->addAction("Connect", this, SLOT(Connect()));
+       machineMenu->addAction("Disconnect", this, SLOT(Disconnect()));
+       machineMenu->addAction("Info", this, SLOT(Info()));
+//     machineMenu->setFont(f);
+
+//     toolsid = bar->insertItem("&Tools", p2);
+
+//     p2 = new QPopupMenu();
+       toolsMenu = menuBar()->addMenu("&Tools");
+       cwid = toolsMenu->addAction("Editor", this, SLOT(Edit()));
+       hid = toolsMenu->addAction("Help", this, SLOT(Help()));
+       toolsMenu->addSeparator(); 
+       optid = toolsMenu->addAction("Options", this, SLOT(SetOptions()));
+       msgid = toolsMenu->addAction("Info messages", this, SLOT(SetMessages()));
+       msgid->setCheckable(TRUE);
+       msgid->setChecked(TRUE);
+//     toolsMenu->setItemChecked(msgid, TRUE);
+       toolsMenu->addSeparator(); 
+       lockid = toolsMenu->addAction("Lock console", this, SLOT(LockConsole()));
+       unlockid = toolsMenu->addAction("Unlock console", this, 
                                                        SLOT(UnlockConsole()));
-       p2->setItemEnabled(unlockid, FALSE);
+//     toolsMenu->setItemEnabled(unlockid, FALSE);
+       unlockid->setDisabled(TRUE);
        LOCKED = FALSE;
-       p2->setFont(f);
-       toolsid = bar->insertItem("&Tools", p2);
+//     p2->setFont(f);
 
-       qid = bar->insertItem("&Quit", this, SLOT(QuitProc()));
-       p->setFont(f);
+       qid = menuBar()->addAction("&Quit", this, SLOT(QuitProc()));
+//     p->setFont(f);
 
-       desktop = new QMultiLineEdit(this, "desktop");
-       desktop->setAutoUpdate(TRUE);
+       desktop = new QTextEdit(this);
+//     desktop->setAutoUpdate(TRUE);
        desktop->setReadOnly(TRUE);
-       desktop->setFont(f1);
+//     desktop->setFont(f1);
+       QVBoxLayout * layout = new QVBoxLayout();
+       layout->setContentsMargins (3, 0, 3, 0);
+       layout->addWidget(desktop);
+//     layout->addWidget(msg);
+       QWidget *window = new QWidget();
+       window->setLayout(layout);
+       setCentralWidget(window);
 
        resize(400, 200);
        Tasks = 0;
@@ -308,10 +339,10 @@ QKernel::QKernel()
  */
 void QKernel::resizeEvent(QResizeEvent *ev)
 {
-       QFrame::resizeEvent(ev);
-       if (desktop)
-               desktop->setGeometry(0, bar->height(), width(), 
-                                               height() - bar->height());
+//     QFrame::resizeEvent(ev);
+//     if (desktop)
+//             desktop->setGeometry(0, bar->height(), width(), 
+//                                             height() - bar->height());
 }
 
 /**
@@ -433,15 +464,15 @@ void QKernel::LoadConfig(char * fname)
 void QKernel::Run_Prog()
 {
        int i;
-       QString s(QFileDialog::getOpenFileName(progdir, "*.log", this));
-       
+       QString s = QFileDialog::getOpenFileName(this, "Execute", progdir, "*.log");
+
        if (!s.isNull()) {
-               i = s.find(".log");
-               
+               i = s.indexOf(".log");
+
                if (i > 0)
                        s.remove(i, 4);
-                       
-               RunIntModule((char*)s.ascii(), 0);
+
+               RunIntModule((char*)s.toAscii().data(), 0);
        }
 }
 
@@ -536,14 +567,14 @@ void QKernel::RunNetModule()
  */
 void QKernel::Connect()
 {
-       QDialog d(this, "", TRUE);
-       QLabel lab(&d, "IP Address:");
-       QLineEdit ed(&d, "");
-       QPushButton ob(&d, "");
-       QPushButton cb(&d, "");
+       QDialog d(this, Qt::Dialog);
+       QLabel lab("IP Address:", &d);
+       QLineEdit ed("", &d);
+       QPushButton ob("", &d);
+       QPushButton cb("", &d);
        MESSAGE m;
 
-       d.setFont(QFont("Helvetica", 12, QFont::Bold)); 
+//     d.setFont(QFont("Helvetica", 12, QFont::Bold)); 
        ob.setGeometry(30, 60, 80, 30);
        ob.setText("Ok");
        ob.setDefault(TRUE);
@@ -559,7 +590,7 @@ void QKernel::Connect()
        if (d.exec()) {
                m.msg_type = MSG_NET;
                m.param.pword[0] = NET_CONNECT_TO;
-               strcpy(m.param.pstr, ed.text());
+               strcpy(m.param.pstr, ed.text().toAscii().data());
                write(net_sock, &m, sizeof(MESSAGE)); 
        }
 }
@@ -612,11 +643,11 @@ void QKernel::QuitProc()
  */
 void QKernel::AddAddress()
 {
-       QDialog d(this, "", TRUE);
-       QLabel lab(&d, "IP Address:");
-       QLineEdit ed(&d, "");
-       QPushButton ob(&d, "");
-       QPushButton cb(&d, "");
+       QDialog d(this, Qt::Dialog);
+       QLabel lab("IP Address:", &d);
+       QLineEdit ed("", &d);
+       QPushButton ob("", &d);
+       QPushButton cb("", &d);
 
        if (connections) {
                ob.setGeometry(30, 60, 80, 30);
@@ -631,8 +662,8 @@ void QKernel::AddAddress()
                connect(&ob, SIGNAL(clicked()), &d, SLOT(accept()));
                connect(&cb, SIGNAL(clicked()), &d, SLOT(reject())); 
                if (d.exec())
-                       if (strcmp(ed.text(), "") != 0) {
-                               connections->insertItem(ed.text());
+                       if (strcmp(ed.text().toAscii().data(), "") != 0) {
+                               connections->addItem(ed.text());
                        }
        }
 }
@@ -643,8 +674,10 @@ void QKernel::AddAddress()
 void QKernel::DelAddress()
 {
        if (connections) {
-               if (connections->currentItem() != -1)
-                       connections->removeItem(connections->currentItem());
+               if (connections->currentRow() != -1) {
+                       /* TODO: Checki if this work correctly after porting */
+                       connections->removeItemWidget(connections->currentItem());
+               }
        }
 }
 
@@ -659,49 +692,44 @@ void QKernel::MessageToNode()
        QLineEdit *nodenr;
        MESSAGE m;
 
-       dlg = new QDialog(this, "Message", TRUE);
+       dlg = new QDialog(this, Qt::Dialog);
+       dlg->setWindowTitle("Send message to node");
 
-       nodenr = new QLineEdit(dlg, "number");
+       nodenr = new QLineEdit("number", dlg);
        nodenr->setGeometry(90, 10, 50, 30);
        nodenr->setText("");
 
        QLabel *tmpQLabel;
-       tmpQLabel = new QLabel(dlg, "Label_1");
+       tmpQLabel = new QLabel("Node number:", dlg);
        tmpQLabel->setGeometry(10, 10, 77, 30);
-       tmpQLabel->setText("Node number:");
 
-       tmpQLabel = new QLabel(dlg, "Label_2");
+       tmpQLabel = new QLabel("Message:", dlg);
        tmpQLabel->setGeometry(10, 50, 70, 30);
-       tmpQLabel->setText("Message:");
 
        QLineEdit *msg;
-       msg = new QLineEdit(dlg, "LineEdit_1");
+       msg = new QLineEdit("", dlg);
        msg->setGeometry(80, 60, 330, 30);
-       msg->setText("");
 
        QPushButton *ob;
-       ob = new QPushButton(dlg, "PushButton_1");
+       ob = new QPushButton("Send", dlg);
        ob->setGeometry(230, 10, 80, 30);
-       ob->setText("Send");
        ob->setDefault(TRUE);
        
        QPushButton *cb;
-       cb = new QPushButton(dlg, "PushButton_2");
+       cb = new QPushButton("Cancel", dlg);
        cb->setGeometry(330, 10, 80, 30);
-       cb->setText("Cancel");
        dlg->resize(430, 110);
        connect(ob, SIGNAL(clicked()), dlg, SLOT(accept()));
        connect(cb, SIGNAL(clicked()), dlg, SLOT(reject())); 
-       dlg->setCaption("Send message to node");
 
        if (dlg->exec()) {
                m.msg_type = MSG_NET;
                m.param.pword[0] = NET_PROPAGATE;
                m.param.pword[1] = MSG_VLP;
                m.param.pword[2] = NodeNumber;
-               m.param.pword[4] = atoi(nodenr->text());
+               m.param.pword[4] = atoi(nodenr->text().toAscii().data());
                m.param.pword[6] = VLP_WRITE;
-               strcpy(m.param.pstr, msg->text());
+               strcpy(m.param.pstr, msg->text().toAscii().data());
                write(net_sock, &m, sizeof(MESSAGE));
        }
 }
@@ -718,32 +746,30 @@ void QKernel::KillInterpreter()
        MESSAGE m;
        InterpEntry *pom;
 
-       dlg = new QDialog(this, "Message", TRUE);
+       dlg = new QDialog(this, Qt::Dialog);
+       dlg->setWindowTitle("Kill interpreter");
 
-       nodenr = new QLineEdit(dlg, "number"); 
+       nodenr = new QLineEdit("", dlg); 
        nodenr->setGeometry(90, 10, 50, 30);
-       nodenr->setText("");
 
-       QLabel* tmpQLabel;
-       tmpQLabel = new QLabel(dlg, "Label_1");
+       QLabel * tmpQLabel = new QLabel("Interp. ID:", dlg);
        tmpQLabel->setGeometry(10, 10, 77, 30);
-       tmpQLabel->setText("Interp. ID:");
-       QPushButton* ob, *cb;
-       ob = new QPushButton(dlg, "PushButton_1");
+
+       QPushButton * ob = new QPushButton("Kill", dlg);
        ob->setGeometry( 160, 10, 80, 30);
-       ob->setText("Kill");
        ob->setDefault(TRUE);
-       cb = new QPushButton(dlg, "PushButton_2");
+
+       QPushButton * cb = new QPushButton("Cancel", dlg);
        cb->setGeometry(260, 10, 80, 30);
-       cb->setText("Cancel");
        dlg->resize(360, 50);
+
        connect(ob, SIGNAL(clicked()), dlg, SLOT(accept()));
        connect(cb, SIGNAL(clicked()), dlg, SLOT(reject())); 
-       dlg->setCaption("Kill interpreter");
+
        if (dlg->exec()) {
                m.msg_type = MSG_INT;
                m.param.pword[0] = INT_KILL;
-               pom = findINTbyID(atoi(nodenr->text()));
+               pom = findINTbyID(atoi(nodenr->text().toAscii().data()));
                if (pom != NULL) {
                        if (!(pom->remote))
                                write(pom->sock, &m, sizeof(MESSAGE));
@@ -844,11 +870,11 @@ void QKernel::NetMessage()
                                QString poms, poms1, poms2;
                                poms.sprintf("%s", msg.param.pstr);
                                while (poms.length() > 0) {
-                                       cnt = poms.find(';');
+                                       cnt = poms.indexOf(';');
                                        if (cnt!=-1) {
                                                poms1 = poms.left(cnt);
                                                poms = poms.right(poms.length() - cnt - 1);
-                                               cnt = poms1.find('=');
+                                               cnt = poms1.indexOf('=');
                                                if (cnt != -1) {
                                                        poms2 = poms1.left(cnt);
                                                        poms1 = poms1.right(
@@ -911,8 +937,9 @@ void QKernel::IntMessage(int sock)
                                if (e->remote == 0)
                                        CloseInstances(e);
                                delete e->notify;
-                               ::close(e->sock);   
-                               Interpreters.remove(e);
+                               ::close(e->sock);
+                               /* TODO: Check this */
+                               Interpreters.removeOne(e);
                                delete e;
 
                                if (info_messages) {
@@ -947,8 +974,9 @@ void QKernel::WriteMessage(char *msg)
 {
        int x;
        int y;
+       x = desktop->textCursor().blockNumber();
+       y = desktop->textCursor().columnNumber();
 
-       desktop->getCursorPosition(&x, &y);
        if (x > 100) {
                desktop->clear();
        }
@@ -956,27 +984,31 @@ void QKernel::WriteMessage(char *msg)
        desktop->setReadOnly(FALSE);
        desktop->append(msg);
        desktop->setReadOnly(TRUE);
-       desktop->setCursorPosition(desktop->numLines(), 1);
+//     desktop->setCursorPosition(desktop->blockCount(), 1);
+       QTextCursor tmpCursor = desktop->textCursor();
+       tmpCursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
+       desktop->setTextCursor(tmpCursor);
+
        desktop->repaint();
        
-       if (desktop->numLines() > 100) {
+       if (desktop->document()->blockCount() > 100) {
                desktop->clear();
        }
 }
 
 /**
- * Adds checkbox to menu item. It it is checked additional info messages are
+ * Adds checkbox to menu item. If it is checked additional info messages are
  * shown.
  */
 void QKernel::SetMessages()
 {
-       if (p2 != NULL) {
-               if (p2->isItemChecked(msgid)) {
-                       p2->setItemChecked(msgid, FALSE);
-                       info_messages=FALSE;
+       if (toolsMenu != NULL) {
+               if (msgid->isChecked()) {
+                       msgid->setChecked(FALSE);
+                       info_messages = FALSE;
                } else {
-                       p2->setItemChecked(msgid, TRUE);  
-                       info_messages=TRUE;
+                       msgid->setChecked(TRUE);
+                       info_messages = TRUE;
                }
        }
        /* bar->repaint(); */
@@ -989,93 +1021,89 @@ void QKernel::SetMessages()
  */
 void QKernel::SetOptions()
 {
-       QDialog dlg(this, "Options", TRUE);
+       QDialog dlg(this, Qt::Dialog);
+       dlg.setWindowTitle("Options");
        ConnectEntry *e;
        unsigned int i;
 
        QLineEdit* progs;
-       progs = new QLineEdit(&dlg, "progs");
+       progs = new QLineEdit(progdir, &dlg);
        progs->setGeometry(150, 20, 180, 30);
-       progs->setText(progdir);
 
        QLabel* tmpQLabel;
-       tmpQLabel = new QLabel(&dlg, "Label_1");
+       tmpQLabel = new QLabel("Programs directory", &dlg);
        tmpQLabel->setGeometry(30, 20, 120, 30);
-       tmpQLabel->setText("Programs directory");
 
        QFrame* tmpQFrame;
-       tmpQFrame = new QFrame(&dlg, "Frame_2");
+       tmpQFrame = new QFrame(&dlg);
        tmpQFrame->setGeometry(10, 60, 380, 30);
        tmpQFrame->setFrameStyle(52);
 
-       tmpQLabel = new QLabel(&dlg, "Label_2");
+       tmpQLabel = new QLabel("Virtual Processor properties (activated after "
+                                               "restarting VLP):", &dlg);
        tmpQLabel->setGeometry(10, 80, 340, 30);
-       tmpQLabel->setText("Virtual Processor properties (activated after "
-                                                       "restarting VLP):");
 
        QLineEdit *nn;
        char nns[256];
-       nn = new QLineEdit(&dlg, "LineEdit_2");
-       nn->setGeometry(110, 110, 40, 30);
        sprintf(nns, "%d", NodeNumber);
-       nn->setText(nns);
+       nn = new QLineEdit(nns, &dlg);
+       nn->setGeometry(110, 110, 40, 30);
 
-       tmpQLabel = new QLabel(&dlg, "Label_3");
+       tmpQLabel = new QLabel("Node number:", &dlg);
        tmpQLabel->setGeometry(20, 110, 90, 30);
-       tmpQLabel->setText("Node number:");
 
        QRadioButton *exp, *reg;
-       exp = new QRadioButton(&dlg, "RadioButton_3");
+       exp = new QRadioButton("Explicit", &dlg);
        exp->setGeometry(30, 170, 100, 30);
-       exp->setText("Explicit");
        exp->setChecked(TRUE);
 
-       reg = new QRadioButton(&dlg, "RadioButton_4");
+       reg = new QRadioButton("Registration", &dlg);
        reg->setGeometry(30, 200, 100, 30);
-       reg->setText("Registration");
        reg->setEnabled(FALSE);
 
-       connections = new QListBox(&dlg, "ListBox_1");
+       connections = new QListWidget(&dlg);
        connections->setGeometry(170, 140, 130, 100);
-       e = ConnectList.first();
-       while(e != NULL) {
-               connections->insertItem(e->addr);
-               e = ConnectList.next();
+
+       for (int i = 0; i < ConnectList.size(); i++) {
+               e = ConnectList.at(i);
+               connections->addItem(e->addr);
        }
 
-       tmpQLabel = new QLabel(&dlg, "Label_5");
+       tmpQLabel = new QLabel("Connection list:", &dlg);
        tmpQLabel->setGeometry(170, 110, 100, 30);
-       tmpQLabel->setText("Connection list:");
 
        QPushButton *addbtn;
        QPushButton *delbtn;
        QPushButton *okbtn;
        QPushButton *cancelbtn;
-       addbtn = new QPushButton(&dlg, "PushButton_1");
+       addbtn = new QPushButton("Add", &dlg);
        addbtn->setGeometry(310, 150, 60, 30);
-       addbtn->setText("Add");
-       delbtn = new QPushButton(&dlg, "PushButton_2");
-       delbtn->setGeometry(310, 200, 60, 30);
-       delbtn->setText("Del");
        connect(addbtn, SIGNAL(clicked()), this, SLOT(AddAddress()));
+
+       delbtn = new QPushButton("Del", &dlg);
+       delbtn->setGeometry(310, 200, 60, 30);
        connect(delbtn, SIGNAL(clicked()), this, SLOT(DelAddress()));
-       okbtn = new QPushButton(&dlg, "PushButton_3");
+
+       okbtn = new QPushButton("Ok", &dlg);
        okbtn->setGeometry(80, 260, 100, 30);
-       okbtn->setText("Ok");
        okbtn->setDefault(TRUE);
-       cancelbtn = new QPushButton(&dlg, "PushButton_4");
-       cancelbtn->setGeometry(210, 260, 100, 30);
-       cancelbtn->setText("Cancel");
        connect(okbtn, SIGNAL(clicked()), &dlg, SLOT(accept()));
-       connect(cancelbtn, SIGNAL(clicked()), &dlg, SLOT(reject()));        
-       QButtonGroup* group;
-       group = new QButtonGroup(&dlg, "ButtonGroup_1");
+
+       cancelbtn = new QPushButton("Cancel", &dlg);
+       cancelbtn->setGeometry(210, 260, 100, 30);
+       connect(cancelbtn, SIGNAL(clicked()), &dlg, SLOT(reject()));
+
+       QGroupBox* group;
+       group = new QGroupBox("Connection type", &dlg);
        group->setGeometry(20, 150, 120, 90);
-       group->setTitle("Connection type");
-       group->setAlignment(1);
+       group->setAlignment(Qt::AlignLeft);
        group->lower();
-       group->insert(exp, 1);
-       group->insert(reg, 2);  
+
+       QVBoxLayout *vbox = new QVBoxLayout();
+       vbox->addWidget(exp);
+       vbox->addWidget(reg);
+       vbox->addStretch(1);
+       group->setLayout(vbox);
 
        dlg.resize(400, 310);
        if (dlg.exec()) {
@@ -1088,12 +1116,12 @@ void QKernel::SetOptions()
 
                setting = config_setting_add(root, "progdir",
                                                        CONFIG_TYPE_STRING);
-               config_setting_set_string(setting, progs->text().ascii());
-               strcpy(progdir, progs->text());
+               config_setting_set_string(setting, progs->text().toAscii().data());
+               strcpy(progdir, progs->text().toAscii().data());
 
                setting = config_setting_add(root, "node_number",
                                                        CONFIG_TYPE_INT);
-               config_setting_set_int(setting, atoi(nn->text()));
+               config_setting_set_int(setting, atoi(nn->text().toAscii().data()));
 
                setting = config_setting_add(root, "homedir",
                                                        CONFIG_TYPE_STRING);
@@ -1111,7 +1139,7 @@ void QKernel::SetOptions()
                                setting = config_setting_add(hosts, NULL,
                                                        CONFIG_TYPE_STRING);
                                config_setting_set_string(setting,
-                                               connections->text(i).ascii());
+                                               connections->item(i)->text().toAscii().data());
                        }
                } else {
                        config_setting_set_string(setting, "register");
@@ -1132,40 +1160,48 @@ void QKernel::SetOptions()
  */
 void QKernel::LockConsole()
 {
-       QDialog d(this, "Enter password", TRUE);
-       QLabel lab(&d, "Password");
-       QLineEdit ed(&d, "");
-       QPushButton ob(&d, "");
-       QPushButton cb(&d, "");
+       QDialog d(this, Qt::Dialog);
+       d.setWindowTitle("Lock console");
 
-       d.setCaption("Lock console"); 
+       QPushButton ob("Ok", &d);
        ob.setGeometry(30, 60, 80, 30);
-       ob.setText("Ok");
        ob.setDefault(TRUE);
+       connect(&ob, SIGNAL(clicked()), &d, SLOT(accept()));
+
+       QLabel lab("Password:", &d);
        lab.setGeometry(10, 10, 60, 30);
-       lab.setText("Password:");
+
+       QLineEdit ed("", &d);
        ed.setGeometry(70, 10, 140, 30);
        ed.setEchoMode(QLineEdit::Password);
+
+       QPushButton cb("Cancel", &d);
        cb.setGeometry(130, 60, 80, 30);
-       cb.setText("Cancel");
-       d.resize(240, 100);
-       connect(&ob, SIGNAL(clicked()), &d, SLOT(accept()));
        connect(&cb, SIGNAL(clicked()), &d, SLOT(reject())); 
 
+       d.resize(240, 100);
+
        if (d.exec()) {
-               if (strcmp(ed.text(), "") != 0) {
-                       strcpy(LockPasswd, ed.text());
+               if (strcmp(ed.text().toAscii().data(), "") != 0) {
+                       strcpy(LockPasswd, ed.text().toAscii().data());
                        lab.setText("Retype:");
                        ed.setText("");
                        if (d.exec()) {
-                               if (strcmp(ed.text(), LockPasswd)==0) {
-                                       bar->setItemEnabled(qid, FALSE);
-                                       bar->setItemEnabled(prid, FALSE);
-                                       bar->setItemEnabled(mid, FALSE);
-                                       p2->setItemEnabled(unlockid, TRUE);
-                                       p2->setItemEnabled(lockid, FALSE);
-                                       p2->setItemEnabled(cwid, FALSE);
-                                       p2->setItemEnabled(optid, FALSE);
+                               if (strcmp(ed.text().toAscii().data(), LockPasswd)==0) {
+                                       qid->setEnabled(FALSE);
+                                       prid->setEnabled(FALSE);
+                                       mid->setEnabled(FALSE);
+                                       unlockid->setEnabled(TRUE);
+                                       lockid->setEnabled(FALSE);
+                                       cwid->setEnabled(FALSE);
+                                       optid->setEnabled(FALSE);
+//                                     menuBar()->setItemEnabled(qid, FALSE);
+//                                     bar->setItemEnabled(prid, FALSE);
+//                                     bar->setItemEnabled(mid, FALSE);
+//                                     p2->setItemEnabled(unlockid, TRUE);
+//                                     p2->setItemEnabled(lockid, FALSE);
+//                                     p2->setItemEnabled(cwid, FALSE);
+//                                     p2->setItemEnabled(optid, FALSE);
                                        bar->repaint();
                                        WriteMessage("CONSOLE LOCKED");
                                        LOCKED = TRUE;
@@ -1174,7 +1210,7 @@ void QKernel::LockConsole()
                                        msg.setText("Not matching!");
                                        msg.setButtonText(0, "Close");
                                        msg.show();
-                               }   
+                               }
                        } else {
                                strcpy(LockPasswd, "");
                        }
@@ -1189,43 +1225,52 @@ void QKernel::LockConsole()
  */
 void QKernel::UnlockConsole()
 {
-       QDialog d(this, "Enter password", TRUE);
-       QLabel lab(&d, "Password");
-       QLineEdit ed(&d, "");
-       QPushButton ob(&d, "");
-       QPushButton cb(&d, "");
+       QDialog d(this, Qt::Dialog);
+       d.setWindowTitle("Enter password");
 
-       ob.setGeometry(30, 60, 80, 30);
-       ob.setText("Ok");
-       ob.setDefault(TRUE);
+       QLabel lab("Password:", &d);
        lab.setGeometry(10, 10, 60, 30);
-       lab.setText("Password:");
+
+       QLineEdit ed("", &d);
        ed.setGeometry(70, 10, 140, 30);
        ed.setEchoMode(QLineEdit::Password);
-       cb.setGeometry(130, 60, 80, 30);
-       cb.setText("Cancel");
-       d.resize(240, 100);
+
+       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);
+
        if (d.exec()) {
-               if (strcmp(ed.text(), LockPasswd) == 0) {
-                       bar->setItemEnabled(qid, TRUE);
-                       bar->setItemEnabled(prid, TRUE);
-                       bar->setItemEnabled(mid, TRUE);
-                       p2->setItemEnabled(unlockid, FALSE);
-                       p2->setItemEnabled(lockid, TRUE);
-                       p2->setItemEnabled(cwid, TRUE);
-                       p2->setItemEnabled(optid, TRUE);
-                       bar->repaint();
+               if (strcmp(ed.text().toAscii().data(), LockPasswd) == 0) {
+                       qid->setEnabled(TRUE);
+                       prid->setEnabled(TRUE);
+                       mid->setEnabled(TRUE);
+                       unlockid->setEnabled(FALSE);
+                       lockid->setEnabled(TRUE);
+                       cwid->setEnabled(TRUE);
+                       optid->setEnabled(TRUE);
+//                     bar->setItemEnabled(qid, TRUE);
+//                     bar->setItemEnabled(prid, TRUE);
+//                     bar->setItemEnabled(mid, TRUE);
+//                     p2->setItemEnabled(unlockid, FALSE);
+//                     p2->setItemEnabled(lockid, TRUE);
+//                     p2->setItemEnabled(cwid, TRUE);
+//                     p2->setItemEnabled(optid, TRUE);
+//                     bar->repaint();
                        WriteMessage("CONSOLE UNLOCKED");
-                       LOCKED = FALSE;         
+                       LOCKED = FALSE;
                } else {
                        QMessageBox msg(this);
                        msg.setText("Wrong password!");
                        msg.setButtonText(0, "Close");
                        msg.show();
-               }      
+               }
        }
 }
 
@@ -1240,36 +1285,38 @@ void QKernel::InitMessage()
 /**
  * Finds Interpreter by its socket
  * @param _id ID of the socket
- * @return returns pointer to the found interpreter slot
+ * @return returns pointer to the found interpreter slot. NULL otherwise
  */
 InterpEntry *QKernel::findINTbySocket(int _id)
 {
-       InterpEntry *pom;
-       pom = Interpreters.first();
-
-       while (pom != NULL) {
-               if (pom->sock == _id)
+       InterpEntry *pom = NULL;
+       
+       for (int i = 0; i < Interpreters.size(); i++) {
+               if (Interpreters.at(i)->sock == _id) {
+                       pom = Interpreters.at(i);
                        break;
-
-               pom = Interpreters.next();
+               }
        }
+
        return pom;
 }
 
 /**
  * Finds Interpreter by its ID.
  * @param _id ID of the interpreter
- * @return returns pointer to the found interpreter slot
+ * @return returns pointer to the found interpreter slot. NULL otherwise
  */
 InterpEntry *QKernel::findINTbyID(int _id)
 {
-       InterpEntry *pom;
-       pom = Interpreters.first();
-       while (pom != NULL) {
-               if (pom->ID == _id)
+       InterpEntry *pom = NULL;
+       
+       for (int i = 0; i < Interpreters.size(); i++) {
+               if (Interpreters.at(i)->ID == _id) {
+                       pom = Interpreters.at(i);
                        break;
-               pom = Interpreters.next();
+               }
        }
+
        return pom;
 }
 
@@ -1515,9 +1562,9 @@ int main(int argc, char **argv)
        }
 
        app = new QApplication(argc, argv);
-       app->setStyle(new QWindowsStyle());
+//     app->setStyle(new QWindowsStyle());
        QKernel kernel;
-       app->setMainWidget(&kernel);
+//     app->setCentralWidget(&kernel);
        kernel.show();
        kernel.InitMessage();