COPASI API  4.16.103
CQTaskHeaderWidget.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2014 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2005 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 #include <QtGui/QPalette>
16 #include "CQTaskHeaderWidget.h"
17 #include "qtUtilities.h"
18 
19 CQTaskHeaderWidget::CQTaskHeaderWidget(QWidget* parent, Qt::WindowFlags f):
20  QWidget(parent, f)
21 {
22  setupUi(this);
23 
24  mUpdateChanged = false;
25  mExecutableChanged = false;
26 
27  int h, s, v;
28 
29  mSavedColor = palette().color(backgroundRole());
30  mSavedColor.getHsv(&h, &s, &v);
31 
32  if (s < 20) s = 20;
33 
34  mChangedColor.setHsv(240, s, v);
35 }
36 
38 {
39  // TODO Auto-generated destructor stub
40 }
41 
42 bool CQTaskHeaderWidget::setTaskName(const std::string & name)
43 {
44  mpLblName->setText("<h2>" + FROM_UTF8(name) + "</h2>");
45  return true;
46 }
47 
49 {
50  mUpdateChanged = false;
51  mpUpdateModel->setStyleSheet(QString(mpUpdateModel->metaObject()->className()) + " {background-color:" + mSavedColor.name() + ";}");
52 
53  mExecutableChanged = false;
54  mpBoxExecutable->setStyleSheet(QString(mpBoxExecutable->metaObject()->className()) + " {background-color:" + mSavedColor.name() + ";}");
55 }
56 
58 {
60 
61  if (mUpdateChanged)
62  {
63  mpUpdateModel->setStyleSheet(QString(mpUpdateModel->metaObject()->className()) + " {background-color:" + mChangedColor.name() + ";}");
64  }
65  else
66  {
67  mpUpdateModel->setStyleSheet(QString(mpUpdateModel->metaObject()->className()) + " {background-color:" + mSavedColor.name() + ";}");
68  }
69 }
70 
72 {
74 
76  {
77  mpBoxExecutable->setStyleSheet(QString(mpBoxExecutable->metaObject()->className()) + " {background-color:" + mChangedColor.name() + ";}");
78  }
79  else
80  {
81  mpBoxExecutable->setStyleSheet(QString(mpBoxExecutable->metaObject()->className()) + " {background-color:" + mSavedColor.name() + ";}");
82  }
83 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
CQTaskHeaderWidget(QWidget *parent=0, Qt::WindowFlags f=0)
bool setTaskName(const std::string &name)