Restore compilation of loggraph, extract code layout of kernel's message dialog into...
authorRafał Długołęcki <rafal@dlugolecki.net.pl>
Fri, 29 Jan 2016 16:51:19 +0000 (17:51 +0100)
committerRafał Długołęcki <rafal@dlugolecki.net.pl>
Fri, 29 Jan 2016 16:51:19 +0000 (17:51 +0100)
Makefile.am
src/edit/editor.cpp
src/edit/editor.h
src/graph/loggraph.cpp
src/graph/loggraph.h [new file with mode: 0644]
src/kernel/MessageDialog.cpp [new file with mode: 0644]
src/kernel/MessageDialog.h [new file with mode: 0644]
src/kernel/kernel.cpp
src/kernel/ui/dialogs/MessageDialog.ui [new file with mode: 0644]

index 9aa17e31a933e02e1a7ebd86597149c2fdb5438f..410de45e6cf49017855ee125901676c830d96bf4 100644 (file)
@@ -20,10 +20,10 @@ EXTRA_DIST = \
        doc/CodingStyle \
        doc/vlp.cfg.sample
 
-#   bin/loggraph   \
 #  bin/loghelp
 
 bin_PROGRAMS = \
+  bin/loggraph   \
   bin/lognet \
   bin/logker \
   bin/logint \
@@ -32,7 +32,7 @@ bin_PROGRAMS = \
   bin/logcomp
 
 BUILT_SOURCES = \
-  src/graph/loggraph.moc \
+  src/graph/loggraph.moc.cpp \
   src/net/lognet.moc.cpp \
   src/kernel/kernel.moc.cpp \
   src/edit/editor.moc.cpp \
@@ -40,11 +40,13 @@ BUILT_SOURCES = \
   src/preproc/prep.moc.cpp \
   src/help/help.moc
 
-bin_loggraph_SOURCES = src/graph/loggraph.cpp src/graph/loggraph.moc
+bin_loggraph_SOURCES = src/graph/loggraph.cpp src/graph/loggraph.moc.cpp
 bin_loggraph_CPPFLAGS = $(bin_loggraph_CFLAGS)
 bin_loggraph_LDADD = $(bin_loggraph_LIBS)
-src/graph/loggraph.moc: 
-       $(MOC) -i src/graph/loggraph.cpp -o src/graph/loggraph.moc
+bin_lognet_HEADERS = \
+       src/graph/loggraph.h
+src/graph/loggraph.moc.cpp:
+       $(MOC) src/graph/loggraph.h -o src/graph/loggraph.moc.cpp
 
 clean-loggraph-extra:
        rm -f src/graph/*.moc.cpp
@@ -68,21 +70,29 @@ clean-lognet-extra:
 bin_logker_SOURCES = \
        src/kernel/kernel.cpp \
        src/kernel/kernel.moc.cpp \
+       src/kernel/ConnectDialog.cpp \
+       src/kernel/KillDialog.cpp \
        src/kernel/LockDialog.cpp \
        src/kernel/OptionsDialog.cpp \
        src/kernel/OptionsDialog.moc.cpp \
-       src/kernel/KillDialog.cpp \
-       src/kernel/ConnectDialog.cpp \
+       src/kernel/MessageDialog.cpp \
        src/global/vlp/config.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/ConnectDialog.h \
+       src/kernel/KillDialog.h \
        src/kernel/LockDialog.h \
        src/kernel/OptionsDialog.h \
-       src/kernel/KillDialog.h \
-       src/kernel/ConnectDialog.h \
+       src/kernel/MessageDialog.h \
+       src/kernel/ui/KernelWindow.h \
+       src/kernel/ui/dialogs/ConnectDialog.h \
+       src/kernel/ui/dialogs/KillDialog.h \
+       src/kernel/ui/dialogs/LockDialog.h \
+       src/kernel/ui/dialogs/OptionsDialog.h \
+       src/kernel/ui/dialogs/MessageDialog.h \
        src/global/vlp/config.h
 src/kernel/kernel.moc.cpp: \
                src/kernel/kernel.h \
@@ -90,7 +100,8 @@ src/kernel/kernel.moc.cpp: \
                src/kernel/ui/dialogs/LockDialog.h \
                src/kernel/ui/dialogs/OptionsDialog.h \
                src/kernel/ui/dialogs/KillDialog.h \
-               src/kernel/ui/dialogs/ConnectDialog.h
+               src/kernel/ui/dialogs/ConnectDialog.h \
+               src/kernel/ui/dialogs/MessageDialog.h
        moc-qt4 src/kernel/kernel.h -o src/kernel/kernel.moc.cpp
        moc-qt4 src/kernel/OptionsDialog.h -o src/kernel/OptionsDialog.moc.cpp
 #      $(MOC) -i src/kernel/kernel.cpp -o src/kernel/kernel.moc
@@ -110,6 +121,9 @@ src/kernel/ui/dialogs/KillDialog.h:
 src/kernel/ui/dialogs/ConnectDialog.h:
        uic src/kernel/ui/dialogs/ConnectDialog.ui -o src/kernel/ui/dialogs/ConnectDialog.h
 
+src/kernel/ui/dialogs/MessageDialog.h:
+       uic src/kernel/ui/dialogs/MessageDialog.ui -o src/kernel/ui/dialogs/MessageDialog.h
+
 
 clean-logker-extra:
        rm -f src/kernel/*.moc
index c697a32827bf4261e67f7394a9cc2ce3ca982f09..ae59c62df4eb97ecf29f885e07809c785830361b 100644 (file)
@@ -5,7 +5,6 @@
 #include <QtGui/QFileDialog>
 #include <QtGui/QColor>
 #include <QtGui/QPalette>
-#include <QtGui/QCloseEvent>
 #include <QtGui/QTextDocument>
 #include <QtGui/QMainWindow>
 #include <QtGui/QStatusBar>
@@ -36,6 +35,7 @@ Editor::Editor(int argc, char **argv)
 
        if (argc > 1) {
                strcpy(HomeDir, argv[1]);
+               fprintf(stderr, "EDIT: HomeDir inited with: %s (%s)\n", HomeDir, argv[1]);
        }
 
        find_text = "";
index 01e2e2a9918d994be3e086b2c69453b98f3781d9..9ff52a58a9fcb57754359816c84d72b9d9f96555 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef QWERTY_H
-#define QWERTY_H
+#ifndef _VLP_EDITOR_H
+#define _VLP_EDITOR_H
 
 #include <QtGui/QTextEdit>
 #include <QtGui/QMainWindow>
@@ -76,4 +76,4 @@ private slots:
 }
 }
 
-#endif // QWERTY_H
+#endif // _VLP_EDITOR_H
index 4a12ad40c270c6cb79b14e64806b37dc3310a3cc..f44ec66bf089988846c95206a6acb9a61f36a602 100644 (file)
@@ -6,6 +6,7 @@
 #include <QtGui/QButtonGroup>
 #include <QtGui/QApplication>
 #include <QtGui/QMainWindow>
+#include <QtGui/QFrame>
 #include <math.h>
 #include <QtGui/QPixmap>
 #include <QtGui/QScrollBar>
@@ -27,6 +28,7 @@
 #include <QtCore/QQueue>
 #include <QtGui/QMessageBox>
 #include <QtGui/QMenuBar>
+#include <QtGui/QMouseEvent>
 // #include <qpopmenu.h>
 #include <QtCore/qnamespace.h>
 
 #define REQUEST_NAME   "gr.req"
 #define PERM           0666
 
-class VGRMap {
-public:
-       QPixmap *map;
-       int number;
-
-       VGRMap(int n, QPixmap *m) {
-               number = n;
-               map = m;
-       };
-};
-
-class VGR : public QMainWindow {
-       Q_OBJECT
-public:
-       VGR(char*);
-       ~VGR();
-
-       int resp_sock;
-       int fcol;
-       int bcol;
-       int gfcol;
-       int gbcol;
-       int curx;
-       int cury;
-       int tx;
-       int ty;
-       QQueue<int> CharBuffer;
-
-       bool string_wait;
-       bool char_wait;
-       bool line_wait;
-       bool mouse_wait;
-       bool inkey_wait;
-       bool was_line;
-       QColor *lcolors[256];
-       QFont *prv_font;
-       QFont *italic_font;
-       QFont *bold_font;
-       QFont *normal_font;
-
-       void MakeColors();
-
-       void SetForeground(int);
-       void SetBackground(int);
-       void ClearAll();
-       void ClearArea(int, int, int, int);
-
-       void Line(int, int, int, int);
-       void Ellipse(int x, int y, int a, int b, int alfa, int beta, int fill);
-       void Rect(int x1, int y1, int x2, int y2, int col, int fill);
-       void Point(int x, int y);
-       void TextXY(int x, int y, char *s);
-       void CharXY(int x, int y, char a);
-       void IntXY(int x, int y, int val);
-
-       void WriteText(char *s);
-       void WriteChar(char a);
-       void WriteLine();
-       
-       /* Write Char w/o changing position */
-       void PutChar(char a);
-       void DelChar();
-
-       void Outstring(int x, int y, char *s, int b, int f);
-       void writeintxy(int x, int y, int val, int c);
-       void CurPos();
-
-       int Getmap(int w, int h);
-       void Putmap(int map); 
-
-       void MagicGraph(G_MESSAGE*);
-       bool GetInput(int);
-
-public slots:
-       void vscrolled(int);
-       void hscrolled(int);
-       void CloseMe();
-       void RequestMessage();
-
-protected:
-       virtual void resizeEvent(QResizeEvent *);
-       virtual void closeEvent(QCloseEvent *);
-       virtual void keyPressEvent(QKeyEvent *);
-       virtual void mousePressEvent(QMouseEvent *);
-       virtual void paintEvent(QPaintEvent *);
-       virtual void focusInEvent(QFocusEvent *);
-
-private:
-       QPixmap *canvas;
-       QScrollBar *hscroll;
-       QScrollBar *vscroll;
-       QPushButton *close_btn;
-       int ox,oy,lstep,pstep,gx,gy;
-       QList<VGRMap> maps;
-       int firstfreemap;
-       bool Closed;
-       bool MustRepaint;
-       bool GraphRead;
-       QSocketNotifier *request;
-       char internal_buffer[256];
-       int strcnt;
-};
-
-void VGR::MakeColors()
-{
-       /* black  */
-       lcolors[0] = new QColor(0, 0, 0);
-       /* blue dark */
-       lcolors[1] = new QColor(0, 0, 139);
-       /* green dark  */
-       lcolors[2] = new QColor(0, 100, 0);
-       /* turquoise dark   */
-       lcolors[3] = new QColor(0, 197, 205);
-       /* red dark */
-       lcolors[4] = new QColor(205, 0, 0);
-       /* violet */
-       lcolors[5] = new QColor(238, 130, 238);
-       /* brown */
-       lcolors[6] = new QColor(139,35, 35);
-       /* grey light */
-       lcolors[7] = new QColor(190, 190, 190);
-       /* grey dark */
-       lcolors[8] = new QColor(97, 97, 97);
-       /* blue */
-       lcolors[9] = new QColor(0, 0, 255);
-       /* green */
-       lcolors[10] = new QColor(0, 255, 0);
-       /* turquoise */
-       lcolors[11] = new QColor(0, 229, 238);
-       /* red light */
-       lcolors[12] = new QColor(255, 0, 0);
-       /* rose */
-       lcolors[13] = new QColor(255, 110, 180);
-       /* yellow */
-       lcolors[14] = new QColor(255, 255, 0);
-       /* white */
-       lcolors[15] = new QColor(255, 255, 255);
-}
+#include "loggraph.h"
 
 /*
  * Construct the DrawView with buttons.
  */
-VGR::VGR(char *sockname)
+VGR::VGR(int argc, char **argv)
        :QMainWindow()
 {
+       char *sockname = argv[1];
+
+       fprintf(stderr, "GRAPH: sockname inited with: %s (%s)\n", sockname, argv[1]);
+
        QPixmap mp;
        struct sockaddr_un svr;
        int len, i, optval, on;
@@ -206,14 +75,14 @@ VGR::VGR(char *sockname)
        tx = ty = 0;
        gx = gy = 0;
        
-       maps.setAutoDelete(TRUE);
+//     maps.setAutoDelete(TRUE);
        firstfreemap = 1;
        Closed = FALSE;
        GraphRead = FALSE;
        lstep = 10;
        pstep = 250;
-       hscroll = new QScrollBar(0, MAXWIDTH, lstep, pstep, 0, QScrollBar::Horizontal, this);
-       vscroll = new QScrollBar(0, MAXHEIGHT, lstep, pstep, 0, QScrollBar::Vertical, this);
+       hscroll = new QScrollBar(0, MAXWIDTH, lstep, pstep, 0, Qt::Orientation::Horizontal, this);
+       vscroll = new QScrollBar(0, MAXHEIGHT, lstep, pstep, 0, Qt::Orientation::Vertical, this);
        hscroll->setTracking(TRUE);
        vscroll->setTracking(TRUE);
        resize(640, 300);
@@ -261,9 +130,9 @@ VGR::VGR(char *sockname)
        char_wait = line_wait = mouse_wait = FALSE;
        was_line = FALSE;
        CharBuffer.clear(); 
-       CharBuffer.setAutoDelete(TRUE);
+//     CharBuffer.setAutoDelete(TRUE);
 
-       setFocusPolicy(QWidget::StrongFocus);
+       setFocusPolicy(Qt::StrongFocus);
        hscroll->setRange(0, MAXWIDTH - width() + 20);
        vscroll->setRange(0, MAXHEIGHT - height() + 20);
        hscroll->setSteps((int)(hscroll->width() / hscroll->maxValue()),
@@ -311,8 +180,9 @@ void VGR::resizeEvent( QResizeEvent *ev )
 
 void VGR::closeEvent(QCloseEvent *ev)
 {
-       if (Closed)
-               QFrame::closeEvent(ev);
+// @TODO: Check this
+//     if (Closed)
+//             QFrame::closeEvent(ev);
 }
 
 void VGR::mousePressEvent(QMouseEvent *ev)
@@ -325,13 +195,13 @@ void VGR::mousePressEvent(QMouseEvent *ev)
                msg.param.pword[2] = ev->pos().x() - ox;
                msg.param.pword[3] = ev->pos().y() - oy;
                switch(ev->button()) {
-               case LeftButton:
+               case Qt::LeftButton:
                        msg.param.pword[7] = 1;
                        break;
-               case RightButton:
+               case Qt::RightButton:
                        msg.param.pword[7] = 3;
                        break;
-               case MidButton:
+               case Qt::MidButton:
                        msg.param.pword[7] = 2;
                        break;
                default:
@@ -342,7 +212,9 @@ void VGR::mousePressEvent(QMouseEvent *ev)
 
                mouse_wait = FALSE;
        }
-       QFrame::mousePressEvent(ev);
+
+// @TODO: check
+//     QFrame::mousePressEvent(ev);
 }
 
 
@@ -571,6 +443,25 @@ void VGR::vscrolled(int val)
        setUpdatesEnabled(FALSE);
 }
 
+void VGR::MakeColors()
+{
+  lcolors[0] = new QColor(0, 0, 0 ); /* black  */
+  lcolors[1] = new QColor(0, 0, 139);     /* blue dark */
+  lcolors[2] = new QColor(0, 100, 0 );     /* green dark  */
+  lcolors[3] = new QColor(0, 197, 205 );     /* turquoise dark   */
+  lcolors[4] = new QColor(205,0 , 0 );   /* red dark */
+  lcolors[5] = new QColor(238, 130,238); /* violet */
+  lcolors[6] = new QColor(139,35,35 ); /* brown   */
+  lcolors[7] = new QColor(190,190,190 );       /* grey light */
+  lcolors[8] = new QColor(97, 97, 97 );       /* grey dark */
+  lcolors[9] = new QColor(0, 0, 255 );       /* blue */
+  lcolors[10] = new QColor(0, 255, 0 );       /* green */
+  lcolors[11] = new QColor(0, 229,238 );       /* turquoise */
+  lcolors[12] = new QColor(255, 0, 0 );       /* red light */
+  lcolors[13] = new QColor(255, 110,180 );       /* rose */
+  lcolors[14] = new QColor(255,255, 0 );       /* yellow */
+  lcolors[15] = new QColor(255, 255, 255 );       /* white */
+}
 
 /****************************************/
 
@@ -950,8 +841,10 @@ int VGR::Getmap(int w, int h)
 void VGR::Putmap(int map)
 {
        VGRMap *m;
-       m = maps.first();
-       while (m != NULL) {
+       QListIterator<VGRMap *> mapsIterator(maps);
+
+       while (mapsIterator.hasNext()) {
+               m = mapsIterator.next();
                if (m->number == map) {
                        bitBlt(canvas, curx, cury, m->map, 0, 0,
                                        m->map->width(), m->map->height());
@@ -959,7 +852,6 @@ void VGR::Putmap(int map)
                                        m->map->width(), m->map->height());
                        break;
                }
-               m = maps.next();
        }
 }
 
@@ -1291,16 +1183,18 @@ void VGR::MagicGraph(G_MESSAGE *msg)
                }
                break;
        /* Kill map */
-       case 309:
-               pmap = maps.first();
-               while (pmap != NULL) {
+       case 309: {
+               QListIterator<VGRMap *> mapsIterator(maps);
+
+               while (mapsIterator.hasNext()) {
+                       pmap = mapsIterator.next();
                        if (msg->param.pword[2] == pmap->number) {
                                maps.remove(pmap);
                                break;
                        }
-                       pmap = maps.next();
                }
                break;
+       }
        /* Line (x1,y1,x2,y2,col) */
        case 310:
                f = fcol;
@@ -1331,12 +1225,10 @@ void VGR::MagicGraph(G_MESSAGE *msg)
        }//switch
 }
 
-#include "loggraph.moc"
-
 int main(int argc, char **argv)
 {
        QApplication app(argc, argv);
-       VGR gs(argv[1]);
+       VGR gs(argc, argv);
        gs.show();
        return app.exec();
 }
diff --git a/src/graph/loggraph.h b/src/graph/loggraph.h
new file mode 100644 (file)
index 0000000..45703bb
--- /dev/null
@@ -0,0 +1,147 @@
+#ifndef _VLP_GRAPH_H
+#define _VLP_GRAPH_H
+
+#include <QtGui/QPainter>
+#include <QtGui/QPrinter>
+#include <QtGui/QPushButton>
+#include <QtGui/QRadioButton>
+#include <QtGui/QButtonGroup>
+#include <QtGui/QApplication>
+#include <QtGui/QMainWindow>
+#include <QtGui/QFrame>
+#include <math.h>
+#include <QtGui/QPixmap>
+#include <QtGui/QScrollBar>
+#include <QtGui/QColor>
+#include <stdio.h>
+#include <QtGui/QFont>
+#include <QtGui/QFontMetrics>
+#include <QtCore/QList>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <netinet/in.h>
+#include "genint1.h"
+#include "comm.h"
+#include "socu.h"
+#include <unistd.h>
+#include <QtCore/QSocketNotifier>
+#include <QtCore/QObject>
+#include <errno.h>
+#include <QtCore/QQueue>
+#include <QtGui/QMessageBox>
+#include <QtGui/QMenuBar>
+#include <QtGui/QMouseEvent>
+// #include <qpopmenu.h>
+#include <QtCore/qnamespace.h>
+
+#define MAXWIDTH       640
+#define MAXHEIGHT      480
+#define TEXT_LINES     50
+#define TEXT_COLS      100
+#define REQUEST_NAME   "gr.req"
+#define PERM           0666
+
+class VGRMap {
+public:
+       QPixmap *map;
+       int number;
+
+       VGRMap(int n, QPixmap *m) {
+               number = n;
+               map = m;
+       };
+};
+
+class VGR : public QMainWindow {
+       Q_OBJECT
+public:
+       VGR(int argc, char ** argv);
+       ~VGR();
+
+       int resp_sock;
+       int fcol;
+       int bcol;
+       int gfcol;
+       int gbcol;
+       int curx;
+       int cury;
+       int tx;
+       int ty;
+       QQueue<int *> CharBuffer;
+
+       bool string_wait;
+       bool char_wait;
+       bool line_wait;
+       bool mouse_wait;
+       bool inkey_wait;
+       bool was_line;
+       QColor *lcolors[256];
+       QFont *prv_font;
+       QFont *italic_font;
+       QFont *bold_font;
+       QFont *normal_font;
+
+       void MakeColors();
+
+       void SetForeground(int);
+       void SetBackground(int);
+       void ClearAll();
+       void ClearArea(int, int, int, int);
+
+       void Line(int, int, int, int);
+       void Ellipse(int x, int y, int a, int b, int alfa, int beta, int fill);
+       void Rect(int x1, int y1, int x2, int y2, int col, int fill);
+       void Point(int x, int y);
+       void TextXY(int x, int y, char *s);
+       void CharXY(int x, int y, char a);
+       void IntXY(int x, int y, int val);
+
+       void WriteText(char *s);
+       void WriteChar(char a);
+       void WriteLine();
+       
+       /* Write Char w/o changing position */
+       void PutChar(char a);
+       void DelChar();
+
+       void Outstring(int x, int y, char *s, int b, int f);
+       void writeintxy(int x, int y, int val, int c);
+       void CurPos();
+
+       int Getmap(int w, int h);
+       void Putmap(int map); 
+
+       void MagicGraph(G_MESSAGE*);
+       bool GetInput(int);
+
+public slots:
+       void vscrolled(int);
+       void hscrolled(int);
+       void CloseMe();
+       void RequestMessage();
+
+protected:
+       virtual void resizeEvent(QResizeEvent *);
+       virtual void closeEvent(QCloseEvent *);
+       virtual void keyPressEvent(QKeyEvent *);
+       virtual void mousePressEvent(QMouseEvent *);
+       virtual void paintEvent(QPaintEvent *);
+       virtual void focusInEvent(QFocusEvent *);
+
+private:
+       QPixmap *canvas;
+       QScrollBar *hscroll;
+       QScrollBar *vscroll;
+       QPushButton *close_btn;
+       int ox,oy,lstep,pstep,gx,gy;
+       QList<VGRMap *> maps;
+       int firstfreemap;
+       bool Closed;
+       bool MustRepaint;
+       bool GraphRead;
+       QSocketNotifier *request;
+       char internal_buffer[256];
+       int strcnt;
+};
+
+#endif /* _VLP_GRAPH_H */
diff --git a/src/kernel/MessageDialog.cpp b/src/kernel/MessageDialog.cpp
new file mode 100644 (file)
index 0000000..926c73a
--- /dev/null
@@ -0,0 +1,31 @@
+#include <QtGui/QDialog>
+
+#include "MessageDialog.h"
+
+namespace loglan {
+namespace vlp {
+namespace dialog {
+
+MessageDialog::MessageDialog(QWidget * parent)
+       : QDialog(parent, Qt::Dialog)
+{
+       setupUi(this);
+}
+
+MessageDialog::~MessageDialog()
+{
+}
+
+int MessageDialog::getNodeNumber()
+{
+       return spinBox->value();
+}
+
+QString MessageDialog::getMessage()
+{
+       return lineEdit->text();
+}
+
+}
+}
+}
diff --git a/src/kernel/MessageDialog.h b/src/kernel/MessageDialog.h
new file mode 100644 (file)
index 0000000..cb9d149
--- /dev/null
@@ -0,0 +1,28 @@
+#ifndef _VLP_KERNEL_MESSAGEDIALOG_H
+#define _VLP_KERNEL_MESSAGEDIALOG_H
+
+#include <QtGui/QDialog>
+
+#include "ui/dialogs/MessageDialog.h"
+
+namespace loglan {
+namespace vlp {
+namespace dialog {
+
+/**
+ * Message Dialog class
+ */
+class MessageDialog : public QDialog, private Ui::MessageDialog {
+public:
+       MessageDialog(QWidget * parent = 0);
+       ~MessageDialog();
+
+       int getNodeNumber();
+       QString getMessage();
+};
+
+}
+}
+}
+
+#endif /* _VLP_KERNEL_MESSAGEDIALOG_H */
index 31cb74d1a3277635f1b2a51fa1e02c7e5477540d..b39fa3cdc4e627b64168efbdd18ab7260fec11ad 100644 (file)
 
 #include "kernel.h"
 #include "ui/KernelWindow.h"
+#include "ConnectDialog.h"
+#include "KillDialog.h"
 #include "LockDialog.h"
 #include "OptionsDialog.h"
-#include "KillDialog.h"
-#include "ConnectDialog.h"
+#include "MessageDialog.h"
 
 #include "vlp/config.h"
 
+#include <sys/prctl.h>
 /* File resides in top directory (where are Makefiles)*/
 #include "../../config.h"
 
@@ -243,6 +245,7 @@ void QKernel::on_actionEditor_triggered()
        QString program = getHomeDir();
        program += "/modules/logedit";
 
+       fprintf(stderr, "Run EDIT Module: %s, %s\n", program.toStdString().c_str(), getHomeDir());
        pid_t pid = fork();
        if (pid == 0) {
                if (execl(program.toStdString().c_str(),
@@ -277,6 +280,8 @@ void QKernel::on_actionHelp_triggered()
        QString docDir = getHomeDir();
        docDir += "/doc";
 
+       fprintf(stderr, "Run HELP Module: %s, %s\n", program.toStdString().c_str(), docDir.toStdString().c_str());
+
        pid_t pid = fork();
        if (pid == 0) {
                if (execl(program.toStdString().c_str(),
@@ -309,6 +314,8 @@ void QKernel::RunGraphModule(char *sk)
        QString program = getHomeDir();
        program += "/modules/loggraph";
 
+       fprintf(stderr, "Run GRAPH Module: %s, %s\n", program.toStdString().c_str(), sk);
+
        pid_t pid = fork();
        if (pid == 0) {
                if (execl(program.toStdString().c_str(),
@@ -342,6 +349,7 @@ void QKernel::RunGraphModule(char *sk)
  */
 void QKernel::RunNetModule()
 {
+
        struct sockaddr_un svr;
        int len;
        int on;
@@ -350,6 +358,7 @@ void QKernel::RunNetModule()
        QString program = getHomeDir();
        program += "/modules/lognet";
 
+       fprintf(stderr, "Run NET Module: %s, %s %s\n", program.toStdString().c_str(), getNetModuleSocket(), getConfigFilePath().toStdString().c_str());
        pid_t pid = fork();
        if (pid == 0) {
                if (execl(program.toStdString().c_str(),
@@ -474,48 +483,17 @@ void QKernel::on_actionQuit_triggered()
  */
 void QKernel::on_actionMessage_triggered()
 {
-       QDialog *dlg;
-       QLineEdit *nodenr;
+       dialog::MessageDialog dialog(this);
        MESSAGE m;
 
-       dlg = new QDialog(this, Qt::Dialog);
-       dlg->setWindowTitle("Send message to node");
-
-       nodenr = new QLineEdit("number", dlg);
-       nodenr->setGeometry(90, 10, 50, 30);
-       nodenr->setText("");
-
-       QLabel *tmpQLabel;
-       tmpQLabel = new QLabel("Node number:", dlg);
-       tmpQLabel->setGeometry(10, 10, 77, 30);
-
-       tmpQLabel = new QLabel("Message:", dlg);
-       tmpQLabel->setGeometry(10, 50, 70, 30);
-
-       QLineEdit *msg;
-       msg = new QLineEdit("", dlg);
-       msg->setGeometry(80, 60, 330, 30);
-
-       QPushButton *ob;
-       ob = new QPushButton("Send", dlg);
-       ob->setGeometry(230, 10, 80, 30);
-       ob->setDefault(TRUE);
-       
-       QPushButton *cb;
-       cb = new QPushButton("Cancel", dlg);
-       cb->setGeometry(330, 10, 80, 30);
-       dlg->resize(430, 110);
-       connect(ob, SIGNAL(clicked()), dlg, SLOT(accept()));
-       connect(cb, SIGNAL(clicked()), dlg, SLOT(reject()));
-
-       if (dlg->exec()) {
+       if (dialog.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().toAscii().data());
+               m.param.pword[4] = dialog.getNodeNumber();
                m.param.pword[6] = VLP_WRITE;
-               strcpy(m.param.pstr, msg->text().toAscii().data());
+               strcpy(m.param.pstr, dialog.getMessage().toStdString().c_str());
                write(net_sock, &m, sizeof(MESSAGE));
        }
 }
@@ -584,17 +562,17 @@ void QKernel::NetMessage()
                                case VLP_WRITE:
                                        QApplication::beep();
                                        WriteMessage(CharLine);
-                                       WriteMessage(
-                                               "### Incoming Messsage ###");
-                                       sprintf(ss, "Mesg from Node %d: %s",
-                                                       msg.param.pword[2],
-                                                       msg.param.pstr);
+                                       WriteMessage("### Incoming Messsage ###");
+                                       sprintf(ss,
+                                               "Mesg from Node %d: %s",
+                                               msg.param.pword[2],
+                                               msg.param.pstr
+                                       );
                                        WriteMessage(ss);
                                        WriteMessage(CharLine);
                                        break;
                                case VLP_REMOTE_INSTANCE:
-                                       sprintf(ss, "%s/%s", getRemoteDir(),
-                                                               msg.param.pstr);
+                                       sprintf(ss, "%s/%s", getRemoteDir(), msg.param.pstr);
 
                                        if (info_messages) { 
                                                WriteMessage("Running program:");
@@ -679,6 +657,7 @@ void QKernel::IntMessage(int sock)
                switch (msg.msg_type) { 
                case MSG_GRAPH:
                        if (msg.param.pword[0] == GRAPH_ALLOCATE) {
+                               fprintf(stderr, "Running graph module with arg: %s\n", msg.param.pstr);
                                RunGraphModule(msg.param.pstr);
                        }
                        break;
@@ -897,6 +876,7 @@ InterpEntry *QKernel::findINTbyID(int _id)
  */
 InterpEntry *QKernel::RunIntModule(char *ss, int r)
 {
+       fprintf(stderr, "Run INT Module: %s, %d\n", ss, r);
        char a[256], b[255];
        struct sockaddr_un svr;
        int len, sock, on;
diff --git a/src/kernel/ui/dialogs/MessageDialog.ui b/src/kernel/ui/dialogs/MessageDialog.ui
new file mode 100644 (file)
index 0000000..5b5b0b7
--- /dev/null
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MessageDialog</class>
+ <widget class="QDialog" name="MessageDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>308</width>
+    <height>160</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Send message to node</string>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout_3">
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <widget class="QLabel" name="label">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="text">
+          <string>Node number</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QSpinBox" name="spinBox"/>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <widget class="QLabel" name="label_2">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="text">
+          <string>Message</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QLineEdit" name="lineEdit"/>
+       </item>
+       <item>
+        <spacer name="verticalSpacer">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Vertical</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>MessageDialog</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>MessageDialog</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>