From a4b5fd34f5c3d98a438ae3519cd404c2aeeaf330 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 28 Jun 2011 06:33:02 +0000 Subject: Hnadle 'important' attribute on macros. --- client/macro.cc | 2 ++ client/macro.h | 2 ++ client/macrodrawer.cc | 19 +++++++++++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/client/macro.cc b/client/macro.cc index d6be5cc..dfe464d 100644 --- a/client/macro.cc +++ b/client/macro.cc @@ -45,6 +45,7 @@ Macro::Macro(Entities &e, NetCom &n, QString t, QScrollArea *s) isstatic = false; iscompact = false; + isimportant = false; } const char *Macro::type() @@ -62,6 +63,7 @@ void Macro::update(QDomNode &node) iscompleted = elem.attribute("completed", "false") == "true"; isstatic = elem.attribute("static", "false") == "true"; iscompact = elem.attribute("compact", "false") == "true"; + isimportant = elem.attribute("important", "false") == "true"; if(drawer == NULL) { drawer = new MacroDrawer(this, elem.attribute("caption", name)); diff --git a/client/macro.h b/client/macro.h index e5b116c..b24b809 100644 --- a/client/macro.h +++ b/client/macro.h @@ -46,6 +46,7 @@ class Macro : public Entity { public: Macro(Entities &entities, NetCom &netcom, QString templ, QScrollArea *scrollarea); + virtual ~Macro() {} const char *type(); @@ -67,6 +68,7 @@ public: bool isstatic; bool iscompact; + bool isimportant; MacroWindow *window; MacroDrawer *drawer; diff --git a/client/macrodrawer.cc b/client/macrodrawer.cc index 8c713b0..570ce54 100644 --- a/client/macrodrawer.cc +++ b/client/macrodrawer.cc @@ -45,7 +45,17 @@ MacroDrawer::MacroDrawer(Macro *macro, QString title) setFlat(true); { - QFont f = font(); f.setItalic(true); + QFont f = font(); + f.setItalic(true); + if(macro->isimportant) { + f.setBold(true); + // f.setPointSize(f.pointSize() * 1.2); + /* + QPalette palette; + palette.setBrush(QPalette::Foreground, QBrush(QColor(157, 30, 141))); + setPalette(palette); + */ + } setFont(f); } @@ -64,9 +74,10 @@ MacroDrawer::MacroDrawer(Macro *macro, QString title) connect(button, SIGNAL(clicked()), this, SLOT(toggleMe())); } - QMargins m = contentsMargins(); - m.setLeft(6); - setContentsMargins(m); + int l,t,r,b; + getContentsMargins(&l,&t,&r,&b); + l = 6; + setContentsMargins(l, t, r, b); } bool MacroDrawer::eventFilter(QObject *obj, QEvent *event) -- cgit v1.2.3