From 82c32c05eb4741e98736099c456b3ffc93c755af Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 3 Jul 2009 11:59:24 +0000 Subject: Some tweaking in the new dependency system. Mostly GUI stuff. --- client/macro.cc | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'client/macro.cc') diff --git a/client/macro.cc b/client/macro.cc index 650a352..7a4cb89 100644 --- a/client/macro.cc +++ b/client/macro.cc @@ -29,7 +29,7 @@ #include #include - +#include #include "macrodrawer.h" Macro::Macro(QDomNode &n) @@ -89,16 +89,30 @@ void Macro::init(QBoxLayout *layout, Macros ¯os, bool initialising, NetCom & if(window == NULL) { window = new MacroWindow(netcom, node, course, !isstatic, iscompact); - MacroDrawer *g = new MacroDrawer(this, xml_elem.attribute("caption", name)); - g->connect(g, SIGNAL(toggle()), window, SLOT(toggleMacro())); - g->connect(window, SIGNAL(activationChanged(bool)), g, SLOT(activationChange(bool))); + /* + QWidget *edge = new QWidget(); + edge->setContentsMargins(1,1,1,1); + edge->setAutoFillBackground(true); + edge->setAttribute(Qt::WA_WindowPropagation, true); + QHBoxLayout *edgelayout = new QHBoxLayout(); + edgelayout->setContentsMargins(0,0,0,0); + edge->setLayout(edgelayout); + layout->addWidget(edge); + */ + + drawer = new MacroDrawer(this, xml_elem.attribute("caption", name), NULL/*edge*/); + drawer->connect(drawer, SIGNAL(toggle()), window, SLOT(toggleMacro())); + drawer->connect(window, SIGNAL(activationChanged(bool)), drawer, SLOT(activationChange(bool))); + //drawer->setAutoFillBackground(true); + //drawer->setContentsMargins(1,1,1,1); window->setActive(false); - - layout->addWidget(g); + //drawer->setPalette(QApplication::palette()); + //edge->layout()->addWidget(g); + layout->addWidget(drawer); QHBoxLayout *l = new QHBoxLayout(); l->setContentsMargins(10,0,10,0); - g->setLayout(l); + drawer->setLayout(l); l->addWidget(window); { QFont f = window->font(); @@ -116,22 +130,24 @@ void Macro::init(QBoxLayout *layout, Macros ¯os, bool initialising, NetCom & } QStringList::iterator rs = requires.begin(); + QStringList blocking; bool active = true; while(rs != requires.end()) { - printf("Testing if %s is completed...", rs->toStdString().c_str()); + // printf("Testing if %s is completed...", rs->toStdString().c_str()); Macros::iterator ms = macros.begin(); while(ms != macros.end()) { if(ms->name == *rs) { - printf("Found it %d", ms->iscompleted); + // printf("Found it %d", ms->iscompleted); + if(ms->iscompleted == false) blocking.append(ms->name); active = active && ms->iscompleted; } ms++; } - printf("\n"); + // printf("\n"); rs++; } window->setActive(active); - + if(!active) drawer->setToolTip(QObject::tr("Depends on: ") + blocking.join(", ")); } -- cgit v1.2.3