************************************************************/
-#include <qpixmap.h>
+#include <QtGui/qpixmap.h>
//#include <qwindow.h>
-#include <qapp.h>
-#include <qframe.h>
-#include <qmlined.h>
-#include <qpainter.h>
-#include <qcolor.h>
-#include <qbrush.h>
-#include <qmenubar.h>
-#include <qpopmenu.h>
-#include <qfont.h>
-#include <qmsgbox.h>
-#include <qfiledlg.h>
-#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 <qfile.h>
-#include <qcursor.h>
-#include <qcombo.h>
-#include <qsocknot.h>
-#include <qdir.h>
-#include <qwindowsstyle.h>
+#include <QtGui/qapplication.h>
+#include <QtGui/qframe.h>
+#include <Qt3Support/q3multilineedit.h>
+#include <QtGui/qpainter.h>
+#include <QtGui/qcolor.h>
+#include <QtGui/qbrush.h>
+#include <QtGui/qmenubar.h>
+#include <Qt3Support/q3popupmenu.h>
+#include <QtGui/qfont.h>
+#include <QtGui/qmessagebox.h>
+#include <QtGui/qfiledialog.h>
+// #include <qtabdlg.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qrect.h>
+#include <QtGui/qdialog.h>
+#include <QtGui/qbuttongroup.h>
+#include <QtGui/qlabel.h>
+#include <Qt3Support/q3multilineedit.h>
+#include <Qt3Support/q3listbox.h>
+#include <QtGui/qpushbutton.h>
+#include <QtGui/qradiobutton.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qfile.h>
+#include <QtGui/qcursor.h>
+#include <QtGui/qcombobox.h>
+#include <QtCore/qsocketnotifier.h>
+#include <QtCore/qdir.h>
+#include <QtGui/qwindowsstyle.h>
#include <stdio.h>
#include <stdlib.h>
class QKernel : public QFrame {
Q_OBJECT
public:
- QMultiLineEdit *desktop;
+ Q3MultiLineEdit *desktop;
QMenuBar *bar;
- QPopupMenu *p;
- QPopupMenu *p1;
- QPopupMenu *p2;
+ Q3PopupMenu *p;
+ Q3PopupMenu *p1;
+ Q3PopupMenu *p2;
char progdir[256];
int NodeNumber;
int ConType;
virtual void closeEvent (QCloseEvent * e);
private:
- QList<InterpEntry> Interpreters;
- QList<ConnectEntry> ConnectList;
- QListBox *connections;
+ QList<InterpEntry*> Interpreters;
+ QList<ConnectEntry*> ConnectList;
+ Q3ListBox *connections;
/**
* number of working interpreters
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;
+// int lockid;
+// int unlockid;
+// int qid;
+// int cwid;
+// int optid;
+// int prid;
+// int mid;
+// int msgid;
+// int toolsid;
+// int hid;
int net_sock;
int freeINTid;
info_messages = TRUE;
wait_for_info = FALSE;
- setCaption("Virtual LOGLAN Processor");
- setBackgroundColor(white);
+// setCaption("Virtual LOGLAN Processor");// @TODO: Restore?
+// setBackgroundColor(white);
+ QAction *execute = new QAction("Execute", this);
+ connect(execute, SIGNAL(triggered()), this, SLOT(Run_Prog()));
+ QAction *kill = new QAction("Kill", this);
+ connect(kill, SIGNAL(triggered()), this, SLOT(KillInterpreter()));
+
+ QMenu *program;
+ program = menuBar()->addMenu("&Program");
+ program->addAction(execute);
+ program->addAction(kill);
+
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();
+// bar->setFont(f);
+
+
+// p = new Q3PopupMenu();
+// p->setFont(f2);
+// p->insertItem("Execute", this, SLOT(Run_Prog()));
+// p->insertItem("Kill", this, SLOT(KillInterpreter()));
+// prid = bar->insertItem("&Program", p);
+ p1 = new Q3PopupMenu();
p1->insertItem("Message", this, SLOT(MessageToNode()));
p1->insertSeparator();
p1->insertItem("Connect", this, SLOT(Connect()));
p1->setFont(f);
mid = bar->insertItem("&Machine", p1);
- p2 = new QPopupMenu();
+ p2 = new Q3PopupMenu();
cwid = p2->insertItem("Editor", this, SLOT(Edit()));
hid = p2->insertItem("Help", this, SLOT(Help()));
p2->insertSeparator();
qid = bar->insertItem("&Quit", this, SLOT(QuitProc()));
p->setFont(f);
- desktop = new QMultiLineEdit(this, "desktop");
+ desktop = new Q3MultiLineEdit(this, "desktop");
desktop->setAutoUpdate(TRUE);
desktop->setReadOnly(TRUE);
desktop->setFont(f1);
*/
void QKernel::Connect()
{
- QDialog d(this, "", TRUE);
- QLabel lab(&d, "IP Address:");
+ QDialog d(this);
+ QLabel lab("IP Address:", &d);
QLineEdit ed(&d, "");
- QPushButton ob(&d, "");
- QPushButton cb(&d, "");
+ QPushButton ob(&d);
+ QPushButton cb(&d);
MESSAGE m;
d.setFont(QFont("Helvetica", 12, QFont::Bold));
*/
void QKernel::AddAddress()
{
- QDialog d(this, "", TRUE);
- QLabel lab(&d, "IP Address:");
+ QDialog d(this);
+ QLabel lab("IP Address:", &d);
QLineEdit ed(&d, "");
- QPushButton ob(&d, "");
- QPushButton cb(&d, "");
+ QPushButton ob(&d);
+ QPushButton cb(&d);
if (connections) {
ob.setGeometry(30, 60, 80, 30);
QLineEdit *nodenr;
MESSAGE m;
- dlg = new QDialog(this, "Message", TRUE);
+ dlg = new QDialog(this);
- 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");
+ tmpQLabel = new QLabel(dlg);
tmpQLabel->setGeometry(10, 10, 77, 30);
tmpQLabel->setText("Node number:");
- tmpQLabel = new QLabel(dlg, "Label_2");
+ tmpQLabel = new QLabel(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(dlg);
ob->setGeometry(230, 10, 80, 30);
ob->setText("Send");
ob->setDefault(TRUE);
QPushButton *cb;
- cb = new QPushButton(dlg, "PushButton_2");
+ cb = new QPushButton(dlg);
cb->setGeometry(330, 10, 80, 30);
cb->setText("Cancel");
dlg->resize(430, 110);
MESSAGE m;
InterpEntry *pom;
- dlg = new QDialog(this, "Message", TRUE);
+ dlg = new QDialog(this);
- 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");
+ tmpQLabel = new QLabel(dlg);
tmpQLabel->setGeometry(10, 10, 77, 30);
tmpQLabel->setText("Interp. ID:");
QPushButton* ob, *cb;
- ob = new QPushButton(dlg, "PushButton_1");
+ ob = new QPushButton(dlg);
ob->setGeometry( 160, 10, 80, 30);
ob->setText("Kill");
ob->setDefault(TRUE);
- cb = new QPushButton(dlg, "PushButton_2");
+ cb = new QPushButton(dlg);
cb->setGeometry(260, 10, 80, 30);
cb->setText("Cancel");
dlg->resize(360, 50);
*/
void QKernel::SetOptions()
{
- QDialog dlg(this, "Options", TRUE);
+ QDialog dlg(this);
ConnectEntry *e;
unsigned int i;
progs->setText(progdir);
QLabel* tmpQLabel;
- tmpQLabel = new QLabel(&dlg, "Label_1");
+ tmpQLabel = new QLabel(&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(&dlg);
tmpQLabel->setGeometry(10, 80, 340, 30);
tmpQLabel->setText("Virtual Processor properties (activated after "
"restarting VLP):");
sprintf(nns, "%d", NodeNumber);
nn->setText(nns);
- tmpQLabel = new QLabel(&dlg, "Label_3");
+ tmpQLabel = new QLabel(&dlg);
tmpQLabel->setGeometry(20, 110, 90, 30);
tmpQLabel->setText("Node number:");
QRadioButton *exp, *reg;
- exp = new QRadioButton(&dlg, "RadioButton_3");
+ exp = new QRadioButton(&dlg);
exp->setGeometry(30, 170, 100, 30);
exp->setText("Explicit");
exp->setChecked(TRUE);
- reg = new QRadioButton(&dlg, "RadioButton_4");
+ reg = new QRadioButton(&dlg);
reg->setGeometry(30, 200, 100, 30);
reg->setText("Registration");
reg->setEnabled(FALSE);
- connections = new QListBox(&dlg, "ListBox_1");
+ connections = new Q3ListBox(&dlg);
connections->setGeometry(170, 140, 130, 100);
e = ConnectList.first();
while(e != NULL) {
connections->insertItem(e->addr);
- e = ConnectList.next();
+ e = ConnectList.takeFirst();
}
- tmpQLabel = new QLabel(&dlg, "Label_5");
+ tmpQLabel = new QLabel(&dlg);
tmpQLabel->setGeometry(170, 110, 100, 30);
tmpQLabel->setText("Connection list:");
QPushButton *delbtn;
QPushButton *okbtn;
QPushButton *cancelbtn;
- addbtn = new QPushButton(&dlg, "PushButton_1");
+ addbtn = new QPushButton(&dlg);
addbtn->setGeometry(310, 150, 60, 30);
addbtn->setText("Add");
- delbtn = new QPushButton(&dlg, "PushButton_2");
+ delbtn = new QPushButton(&dlg);
delbtn->setGeometry(310, 200, 60, 30);
delbtn->setText("Del");
connect(addbtn, SIGNAL(clicked()), this, SLOT(AddAddress()));
connect(delbtn, SIGNAL(clicked()), this, SLOT(DelAddress()));
- okbtn = new QPushButton(&dlg, "PushButton_3");
+ okbtn = new QPushButton(&dlg);
okbtn->setGeometry(80, 260, 100, 30);
okbtn->setText("Ok");
okbtn->setDefault(TRUE);
- cancelbtn = new QPushButton(&dlg, "PushButton_4");
+ cancelbtn = new QPushButton(&dlg);
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");
+ group = new QButtonGroup(&dlg);
group->setGeometry(20, 150, 120, 90);
group->setTitle("Connection type");
group->setAlignment(1);
*/
void QKernel::LockConsole()
{
- QDialog d(this, "Enter password", TRUE);
- QLabel lab(&d, "Password");
+ QDialog d(this);
+ QLabel lab("Password", &d);
QLineEdit ed(&d, "");
- QPushButton ob(&d, "");
- QPushButton cb(&d, "");
+ QPushButton ob(&d);
+ QPushButton cb(&d);
d.setCaption("Lock console");
ob.setGeometry(30, 60, 80, 30);
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);
+// 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);
bar->repaint();
WriteMessage("CONSOLE LOCKED");
LOCKED = TRUE;
*/
void QKernel::UnlockConsole()
{
- QDialog d(this, "Enter password", TRUE);
- QLabel lab(&d, "Password");
+ QDialog d(this);
+ QLabel lab("Password", &d);
QLineEdit ed(&d, "");
- QPushButton ob(&d, "");
- QPushButton cb(&d, "");
+ QPushButton ob(&d);
+ QPushButton cb(&d);
ob.setGeometry(30, 60, 80, 30);
ob.setText("Ok");
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->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;
if (pom->sock == _id)
break;
- pom = Interpreters.next();
+ pom = Interpreters.takeFirst();
}
return pom;
}
while (pom != NULL) {
if (pom->ID == _id)
break;
- pom = Interpreters.next();
+ pom = Interpreters.takeFirst();
}
return pom;
}
#include <signal.h>
#include <sys/stat.h>
#include <string.h>
-#include <qlist.h>
-#include <qfile.h>
-#include <qstring.h>
-#include <qstringlist.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
#include <unistd.h>
#include <libconfig.h>
char kername[256];
/* List of the Interpeter slots */
- QList<INTlink> Interpreters;
+ QList<INTlink*> Interpreters;
/* List of the Network slots */
- QList<NETlink> Links;
+ QList<NETlink*> Links;
NETMOD(char*);
strcpy(m.param.pstr, pomlink->addr);
break;
}
- pomlink = Links.next();
+ pomlink = Links.takeFirst();
}
write(sc, &m, sizeof(MESSAGE));
}
if (nrset < pomlink->sock) {
nrset = pomlink->sock;
}
- pomlink = Interpreters.next();
+ pomlink = Interpreters.takeFirst();
}
if (select(nrset + 1, &readset, &writeset, 0, (struct timeval *)&tout) >
}
}
} /* ISSET */
- pomlink=Interpreters.next();
+ pomlink=Interpreters.takeFirst();
} // while
/* Check internal socket */
pomlink = findINTlink(msg.param.pword[1]);
if (pomlink != NULL) {
close(pomlink->sock);
- Interpreters.remove(pomlink);
+ Interpreters.removeOne(pomlink);
}
};
break;
msg.param.pword[1]);
write_at_console(pomstr);
::close(lnk->sock);
- Links.remove(lnk);
+ Links.removeOne(lnk);
delete lnk;
break;
case NET_PROPAGATE:
max = pomlink->sock;
}
}
- pomlink=Links.next();
+ pomlink=Links.takeFirst();
}
if (select(max + 1, &rset, &wset, 0, (struct timeval *)&tout) > 0) {
if (FD_ISSET(pomlink->sock,&rset)) {
get_message(pomlink);
}
- pomlink=Links.next();
+ pomlink=Links.takeFirst();
}
}
}
if (max < pomlink2->sock) {
max=pomlink2->sock;
}
- pomlink2 = Interpreters.next();
+ pomlink2 = Interpreters.takeFirst();
}
pomlink = Links.first();
while (pomlink != NULL) {
max = pomlink->sock;
}
}
- pomlink=Links.next();
+ pomlink=Links.takeFirst();
}
/* odczyt */
}
}
}/* ISSET */
- pomlink2 = Interpreters.next();
+ pomlink2 = Interpreters.takeFirst();
}/* while */
/* Check internal socket */
pomlink2 = findINTlink(msg.param.pword[1]);
if (pomlink2 != NULL) {
close(pomlink2->sock);
- Interpreters.remove(pomlink2);
+ Interpreters.removeOne(pomlink2);
}
};
break;
while (pomlink != NULL) {
if (FD_ISSET(pomlink->sock, &rset))
get_message(pomlink);
- pomlink=Links.next();
+ pomlink=Links.takeFirst();
}
} // select
}
while (pom != NULL) {
if (strcmp(pom->addr, a) == 0)
return;
- pom = Links.next();
+ pom = Links.takeFirst();
}
pom = new NETlink;
strcpy(pom->addr, a);
sock_reopen(pomlink);
}
} /* not connected */
- pomlink = Links.next();
+ pomlink = Links.takeFirst();
} /* while */
} /* if */
all_connected = TRUE;
all_connected = FALSE;
break;
}
- pomlink = Links.next();
+ pomlink = Links.takeFirst();
}
}
pomlink = Links.first();
while (pomlink != NULL) {
write(pomlink->sock, msg, sizeof(MESSAGE));
- pomlink = Links.next();
+ pomlink = Links.takeFirst();
}
}
pomlink = Links.first();
while (pomlink != NULL) {
::close(pomlink->sock);
- pomlink = Links.next();
+ pomlink = Links.takeFirst();
}
exit(0);
}
p = Links.first();
while(p != NULL) {
send_to_node(p, &m);
- p=Links.next();
+ p=Links.takeFirst();
}
p = Links.first();
while(p != NULL) {
::close(p->sock);
- p = Links.next();
+ p = Links.takeFirst();
}
Links.clear();
}
if (pomlink->node_number == node)
return pomlink;
- pomlink = Links.next();
+ pomlink = Links.takeFirst();
}
return pomlink;
}
while(pomlink != NULL) {
if (pomlink->ID == id)
return pomlink;
- pomlink = Interpreters.next();
+ pomlink = Interpreters.takeFirst();
}
return pomlink;
}
write(sk, &m, sizeof(MESSAGE));
k = 0;
}
- pom = Links.next();
+ pom = Links.takeFirst();
}
if (k > 0) {
m.param.pword[1] = k;