From 355772289f57522157759b6150ebfd2cc849c0ae Mon Sep 17 00:00:00 2001 From: deva Date: Mon, 22 Sep 2008 12:21:14 +0000 Subject: Made the client use the static attribute to set a macro always visible, non-collapsable. Made the macro widgetlist clear itself when loading a new macro. --- client/mainwindow.cc | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'client/mainwindow.cc') diff --git a/client/mainwindow.cc b/client/mainwindow.cc index 50ca8a9..efd4c31 100644 --- a/client/mainwindow.cc +++ b/client/mainwindow.cc @@ -80,20 +80,24 @@ void MainWindow::update() if(xml_elem.hasAttribute("name")) macroname = xml_elem.attribute("name"); if(macros.find(macroname) == macros.end()) { - macros[macroname] = new MacroWindow(netcom, macronode, course); - + bool isstatic = false; + if(xml_elem.attribute("static", "false") == "true") isstatic = true; + macros[macroname] = new MacroWindow(netcom, macronode, course, !isstatic); + QGroupBox *g = new QGroupBox(" " + xml_elem.attribute("caption", macroname)); g->setCheckable(false); g->setChecked(false); + ((QBoxLayout*)w->layout())->addWidget(g); - QPushButton *b = new QPushButton(">>", g); - b->setFixedSize(16,16); - b->show(); - b->move(0,0); + if(!isstatic) { + QPushButton *b = new QPushButton(">>", g); + b->setFixedSize(16,16); + b->show(); + b->move(0,0); - connect(b, SIGNAL(clicked()), this, SLOT(closeAll())); - connect(b, SIGNAL(clicked()), macros[macroname], SLOT(toggleMacro())); - ((QBoxLayout*)w->layout())->addWidget(g); + connect(b, SIGNAL(clicked()), this, SLOT(closeAll())); + connect(b, SIGNAL(clicked()), macros[macroname], SLOT(toggleMacro())); + } QHBoxLayout *l = new QHBoxLayout(); l->setContentsMargins(10,0,10,0); @@ -105,7 +109,9 @@ void MainWindow::update() } else { macros[macroname]->update(macronode); - macros[macroname]->setCollapsed(true); + if(xml_elem.attribute("static", "false") == "false") { + macros[macroname]->setCollapsed(true); + } } } -- cgit v1.2.3