From 408c7c5b36e1058a76741a22876593ee8c042dd4 Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 24 Jul 2009 13:59:36 +0000 Subject: Introduced a new template tag called 'header' to replace the macro-tag-with-header-attribute construct. --- client/macro.cc | 12 +++++++----- client/mainwindow.cc | 6 +++++- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'client') diff --git a/client/macro.cc b/client/macro.cc index bd7393f..2777cf5 100644 --- a/client/macro.cc +++ b/client/macro.cc @@ -45,8 +45,8 @@ void Macro::update(QDomNode &n) QDomElement xml_elem = node.toElement(); - if(xml_elem.tagName() != "macro") return; - if(xml_elem.hasAttribute("header")) return; + if(xml_elem.tagName() != "macro" && xml_elem.tagName() != "header") return; + // if(xml_elem.hasAttribute("header")) return; name = xml_elem.attribute("name"); @@ -57,7 +57,7 @@ void Macro::init(QBoxLayout *layout, Macros ¯os, bool initialising, NetCom & { QDomElement xml_elem = node.toElement(); - if(xml_elem.tagName() != "macro") return; + if(xml_elem.tagName() != "macro" && xml_elem.tagName() != "header") return; isstatic = xml_elem.attribute("static", "false") == "true"; iscompact = xml_elem.attribute("compact", "false") == "true"; @@ -67,14 +67,16 @@ void Macro::init(QBoxLayout *layout, Macros ¯os, bool initialising, NetCom & requires = xml_elem.attribute("requires").split(","); } - if(xml_elem.hasAttribute("header")) { + // if(xml_elem.hasAttribute("header")) { + if(xml_elem.tagName() == "header") { // Macro is a special headline macro. // Simply create a headline, and ignore the rest. // Only add header on initial contruction. if(initialising == true) { QLabel *header = new QLabel(); - header->setText(xml_elem.attribute("header")); + // header->setText(xml_elem.attribute("header")); + header->setText(xml_elem.attribute("caption")); QFont headerfont = header->font(); headerfont.setBold(true); headerfont.setPointSize(headerfont.pointSize() + 2); diff --git a/client/mainwindow.cc b/client/mainwindow.cc index 91d87a7..14ed60b 100644 --- a/client/mainwindow.cc +++ b/client/mainwindow.cc @@ -125,9 +125,12 @@ void MainWindow::update() QDomNodeList macronodes = coursenode.childNodes(); for(int j = 0; j < macronodes.count(); j++) { + QDomNode macronode = macronodes.at(j); QDomElement macroelement = macronode.toElement(); + // printf("%s\n", macroelement.tagName().toStdString().c_str()); + QString macroname = macroelement.attribute("name"); bool found = false; @@ -137,7 +140,8 @@ void MainWindow::update() i++; } - if(found == false || macroelement.hasAttribute("header")) { + // if(found == false || macroelement.hasAttribute("header")) { + if(found == false || macroelement.tagName() == "header") { QString num; num.sprintf("%04d", j); Macro macro(macronode); -- cgit v1.2.3