summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authordeva <deva>2009-07-30 08:36:12 +0000
committerdeva <deva>2009-07-30 08:36:12 +0000
commit77272458e7a8906d871b241b5385bbd0f783d861 (patch)
tree7e32f988654c042be251c4ba31b72902402059f3 /client
parent1f8c58836dfd8dc8c9a0abeeaef6789325189f1b (diff)
Removed the term 'course' everywhere, and replaced it by 'template'. This reduced/simplified the Template class structure a bit.
Diffstat (limited to 'client')
-rw-r--r--client/macro.cc4
-rw-r--r--client/macro.h2
-rw-r--r--client/macrowindow.cc18
-rw-r--r--client/macrowindow.h4
-rw-r--r--client/mainwindow.cc28
-rw-r--r--client/mainwindow.h6
-rw-r--r--client/netcom.cc8
-rw-r--r--client/netcom.h4
-rw-r--r--client/pracro.cc21
9 files changed, 48 insertions, 47 deletions
diff --git a/client/macro.cc b/client/macro.cc
index 2777cf5..7a1b51b 100644
--- a/client/macro.cc
+++ b/client/macro.cc
@@ -53,7 +53,7 @@ void Macro::update(QDomNode &n)
iscompleted = xml_elem.attribute("completed", "false") == "true";
}
-void Macro::init(QBoxLayout *layout, Macros &macros, bool initialising, NetCom &netcom, QString course)
+void Macro::init(QBoxLayout *layout, Macros &macros, bool initialising, NetCom &netcom, QString templ)
{
QDomElement xml_elem = node.toElement();
@@ -89,7 +89,7 @@ void Macro::init(QBoxLayout *layout, Macros &macros, bool initialising, NetCom &
// if(macros.find(name) == macros.end()) {
if(window == NULL) {
- window = new MacroWindow(netcom, node, course, !isstatic, iscompact);
+ window = new MacroWindow(netcom, node, templ, !isstatic, iscompact);
/*
QWidget *edge = new QWidget();
diff --git a/client/macro.h b/client/macro.h
index 610d3b2..20a4e14 100644
--- a/client/macro.h
+++ b/client/macro.h
@@ -46,7 +46,7 @@ public:
Macro() {}
Macro(QDomNode &node);
- void init(QBoxLayout *layout, Macros &macros, bool initialising, NetCom &netcom, QString course);
+ void init(QBoxLayout *layout, Macros &macros, bool initialising, NetCom &netcom, QString templ);
void update(QDomNode &node);
diff --git a/client/macrowindow.cc b/client/macrowindow.cc
index a96964b..7173e2a 100644
--- a/client/macrowindow.cc
+++ b/client/macrowindow.cc
@@ -44,13 +44,13 @@ extern QString user;
extern QString host;
extern quint16 port;
-MacroWindow::MacroWindow(NetCom &n, QDomNode &xml_doc, QString course,
+MacroWindow::MacroWindow(NetCom &n, QDomNode &xml_doc, QString templ,
bool collapsed, bool compact)
: Collapser(), netcom(n)
{
waschanged = false;
- this->course = course;
+ this->templ = templ;
setCollapsedWidget(new ResumeWidget(compact));
@@ -149,7 +149,7 @@ bool MacroWindow::doCommit()
// If all entries passed validation, continue commit
if(faulty == 0) {
- netcom.send(widgets, course, macro, version);
+ netcom.send(widgets, templ, macro, version);
emit updateOnCommit();
setCollapsed(true);
return true;
@@ -222,7 +222,7 @@ void MacroWindow::cont(QString name)
// FIXME: Hack to prevent XML clotching.
// The server could not differentiate the commit and the request.
- // TODO: Where to get the course var??
+ // TODO: Where to get the template var??
// new_macro("example", macro);
// close();
} else {
@@ -249,7 +249,7 @@ void MacroWindow::cont_nocommit(QString name)
// FIXME: Hack to prevent XML clotching.
// The server could not differentiate the commit and the request.
- // TODO: Where to get the course var??
+ // TODO: Where to get the template var??
// new_macro("example", macro);
// close();
} else {
@@ -305,7 +305,7 @@ void MacroWindow::expandWrapper()
luaprograms.clear();
waschanged = false;
- QDomDocument xml_doc = netcom.send(course, macro);
+ QDomDocument xml_doc = netcom.send(templ, macro);
//
// TODO: This is where the dependency checking should occur.
@@ -313,9 +313,9 @@ void MacroWindow::expandWrapper()
// Initiate the new macro window with the xml document and push
// it to the window list
- QDomNodeList courses = xml_doc.documentElement().childNodes();
- QDomNode coursenode = courses.at(0); // There can be only one! (Swush, flomp)
- QDomNodeList macronodes = coursenode.childNodes();
+ QDomNodeList templates = xml_doc.documentElement().childNodes();
+ QDomNode templatenode = templates.at(0); // There can be only one! (Swush, flomp)
+ QDomNodeList macronodes = templatenode.childNodes();
for(int j = 0; j < macronodes.count(); j++) {
QDomNode macronode = macronodes.at(j);
diff --git a/client/macrowindow.h b/client/macrowindow.h
index fad467b..51a675e 100644
--- a/client/macrowindow.h
+++ b/client/macrowindow.h
@@ -47,7 +47,7 @@ class MacroWindow : public Collapser
{
Q_OBJECT
public:
- MacroWindow(NetCom &netcom, QDomNode &xml_doc, QString course,
+ MacroWindow(NetCom &netcom, QDomNode &xml_doc, QString templ,
bool collapsed = true, bool compact = false);
~MacroWindow();
@@ -97,7 +97,7 @@ private:
QVector< Widget* > widgets;
QVector< Widget* > auxwidgets;
QString macro;
- QString course;
+ QString templ;
QString version;
QWidget *mainwidget;
ResumeWidget *resumewidget;
diff --git a/client/mainwindow.cc b/client/mainwindow.cc
index 14ed60b..beef88c 100644
--- a/client/mainwindow.cc
+++ b/client/mainwindow.cc
@@ -40,7 +40,7 @@
#include "macrodrawer.h"
-MainWindow::MainWindow(QString cpr, QString course, QString host, quint16 port, QString user)
+MainWindow::MainWindow(QString cpr, QString templ, QString host, quint16 port, QString user)
: QMainWindow(0, Qt::WindowContextHelpButtonHint),
netcom(host, port, user, cpr)
{
@@ -58,7 +58,7 @@ MainWindow::MainWindow(QString cpr, QString course, QString host, quint16 port,
s->setWidgetResizable(true);
w->setLayout(new QVBoxLayout());
- this->course = course;
+ this->templ = templ;
setStatusBar(status);
@@ -93,15 +93,15 @@ void MainWindow::init()
initialising = false;
}
-void MainWindow::updateCourseHeaders(QDomNode coursenode)
+void MainWindow::updateTemplateHeaders(QDomNode templatenode)
{
- QDomElement course_elem = coursenode.toElement();
- QString course_title = course_elem.attribute("title");
- QString course_name = course_elem.attribute("name");
+ QDomElement template_elem = templatenode.toElement();
+ QString template_title = template_elem.attribute("title");
+ QString template_name = template_elem.attribute("name");
if(!header) {
header = new QLabel();
- header->setText(course_title);
+ header->setText(template_title);
QFont headerfont = header->font();
headerfont.setBold(true);
headerfont.setPointSize(headerfont.pointSize() + 4);
@@ -110,20 +110,20 @@ void MainWindow::updateCourseHeaders(QDomNode coursenode)
w->layout()->addWidget(header);
}
- statusBar()->showMessage(course_title + " (" + course_name + ")");
+ statusBar()->showMessage(template_title + " (" + template_name + ")");
}
void MainWindow::update()
{
- QDomDocument xml_doc = netcom.send(course);
+ QDomDocument xml_doc = netcom.send(templ);
- QDomNodeList courses = xml_doc.documentElement().childNodes();
- QDomNode coursenode = courses.at(0); // There can be only one! (Swush, flomp)
+ QDomNodeList templates = xml_doc.documentElement().childNodes();
+ QDomNode templatenode = templates.at(0); // There can be only one! (Swush, flomp)
- updateCourseHeaders(coursenode);
+ updateTemplateHeaders(templatenode);
- QDomNodeList macronodes = coursenode.childNodes();
+ QDomNodeList macronodes = templatenode.childNodes();
for(int j = 0; j < macronodes.count(); j++) {
QDomNode macronode = macronodes.at(j);
@@ -165,7 +165,7 @@ void MainWindow::update()
Macros::iterator i = macros.begin();
while(i != macros.end()) {
Macro &macro = i.value();
- macro.init((QBoxLayout*)w->layout(), macros, initialising, netcom, course);
+ macro.init((QBoxLayout*)w->layout(), macros, initialising, netcom, templ);
if(macro.window != NULL) {
// Remove old connection (if any), to avoid multiple connections.
disconnect(macro.window, SIGNAL(updateOnCommit()), this, SLOT(update()));
diff --git a/client/mainwindow.h b/client/mainwindow.h
index d60db9d..e19b070 100644
--- a/client/mainwindow.h
+++ b/client/mainwindow.h
@@ -39,7 +39,7 @@
class MainWindow : public QMainWindow {
Q_OBJECT
public:
- MainWindow(QString cpr, QString course, QString host, quint16 port, QString user);
+ MainWindow(QString cpr, QString templ, QString host, quint16 port, QString user);
~MainWindow();
void closeEvent(QCloseEvent *event);
@@ -48,9 +48,9 @@ public slots:
void update();
private:
- void updateCourseHeaders(QDomNode coursenode);
+ void updateTemplateHeaders(QDomNode templatenode);
- QString course;
+ QString templ;
NetCom netcom;
// QMap< QString, MacroWindow* > macros;
diff --git a/client/netcom.cc b/client/netcom.cc
index 38b8b48..0da19f8 100644
--- a/client/netcom.cc
+++ b/client/netcom.cc
@@ -46,7 +46,7 @@ NetCom::~NetCom()
socket.disconnectFromHost();
}
-QDomDocument NetCom::send(QString course, QString macro)
+QDomDocument NetCom::send(QString templ, QString macro)
{
printf("Socket state: %d\n", socket.state());
if(socket.state() != 3) printf("Socket state not connected: %s\n", socket.errorString().toStdString().c_str());
@@ -66,7 +66,7 @@ QDomDocument NetCom::send(QString course, QString macro)
doc.appendChild(pracro_elem);
QDomElement request_elem = doc.createElement("request");
- request_elem.setAttribute("course", course);
+ request_elem.setAttribute("template", templ);
if(macro != "") request_elem.setAttribute("macro", macro);
pracro_elem.appendChild(request_elem);
@@ -96,7 +96,7 @@ void NetCom::readyRead()
buffer.append(socket.readAll());
}
-void NetCom::send(QVector< Widget* > widgets, QString course, QString macro, QString version)
+void NetCom::send(QVector< Widget* > widgets, QString templ, QString macro, QString version)
{
printf("Socket state: %d\n", socket.state());
if(socket.state() != 3) printf("Socket state not connected: %s\n", socket.errorString().toStdString().c_str());
@@ -115,7 +115,7 @@ void NetCom::send(QVector< Widget* > widgets, QString course, QString macro, QSt
doc.appendChild(pracro_elem);
QDomElement commit_elem = doc.createElement("commit");
- commit_elem.setAttribute("course", course);
+ commit_elem.setAttribute("template", templ);
commit_elem.setAttribute("macro", macro);
commit_elem.setAttribute("version", version);
pracro_elem.appendChild(commit_elem);
diff --git a/client/netcom.h b/client/netcom.h
index 13f3ac8..8cccaa9 100644
--- a/client/netcom.h
+++ b/client/netcom.h
@@ -41,8 +41,8 @@ public:
NetCom(QString host, quint16 port, QString user, QString cpr);
~NetCom();
- QDomDocument send(QString course, QString macro = "");
- void send(QVector< Widget* > widgets, QString course, QString macro, QString version);
+ QDomDocument send(QString templ, QString macro = "");
+ void send(QVector< Widget* > widgets, QString templ, QString macro, QString version);
public slots:
void readyRead();
diff --git a/client/pracro.cc b/client/pracro.cc
index 93c9429..6d9c574 100644
--- a/client/pracro.cc
+++ b/client/pracro.cc
@@ -38,7 +38,7 @@
#define CPR_DEFAULT ""
#define MACRO_DEFAULT ""
-#define COURSE_DEFAULT ""
+#define TEMPLATE_DEFAULT ""
#define USER_DEFAULT "testuser"
#define CONFIG_DEFAULT "pracro.ini"
@@ -58,11 +58,11 @@ static void print_usage()
printf(" -m, --macro MACRO Requests macro MACRO from the Pracro \n"
" Server, defaults to \""MACRO_DEFAULT"\".\n");
*/
- printf(" -c, --course COURSE Requests course COURSE from the Pracro \n"
- " Server, defaults to \""COURSE_DEFAULT"\".\n");
+ printf(" -t, --template TEMPLATE Requests template TEMPLATE from the Pracro \n"
+ " Server, defaults to \""TEMPLATE_DEFAULT"\".\n");
printf(" -C, --cpr CPR Defines the cpr for use with the macro,\n"
" defaults to \""CPR_DEFAULT"\".\n");
- printf(" -C, --config FILE The configfile to use. Default is \""CONFIG_DEFAULT"\"\n");
+ printf(" -c, --config FILE The configfile to use. Default is \""CONFIG_DEFAULT"\"\n");
printf(" -u, -U, --user USER Defines the requesting user(not the patient),\n"
" defaults to \""USER_DEFAULT"\"\n");
// printf(" -t, --test macro Run client in testmode, i.e. run without contactig any\n"
@@ -89,7 +89,7 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
QString macro = MACRO_DEFAULT;
- QString course = COURSE_DEFAULT;
+ QString templ = TEMPLATE_DEFAULT;
QStringList args = app.arguments();
QStringList::iterator arg = args.begin();
@@ -115,15 +115,16 @@ int main(int argc, char *argv[])
macro = getParam(args, arg);
}
*/
- else if(*arg == "--course" ||
- *arg == "-c") {
- course = getParam(args, arg);
+ else if(*arg == "--template" ||
+ *arg == "-t") {
+ templ = getParam(args, arg);
}
else if(*arg == "--cpr" ||
*arg == "-C") {
cpr = getParam(args, arg);
}
- else if(*arg == "--config") {
+ else if(*arg == "--config" ||
+ *arg == "-c") {
config = getParam(args, arg);
}
else {
@@ -146,7 +147,7 @@ int main(int argc, char *argv[])
translator.load("pracro_dk");
app.installTranslator(&translator);
- MainWindow mainwindow(cpr, course, host, port, user);
+ MainWindow mainwindow(cpr, templ, host, port, user);
mainwindow.show();
int ret = app.exec();