• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

kcachegrind

  • sources
  • kde-4.14
  • kdesdk
  • kcachegrind
  • libviews
globalguiconfig.h
Go to the documentation of this file.
1 /* This file is part of KCachegrind.
2  Copyright (C) 2010 Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
3 
4  KCachegrind is free software; you can redistribute it and/or
5  modify it under the terms of the GNU General Public
6  License as published by the Free Software Foundation, version 2.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; see the file COPYING. If not, write to
15  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16  Boston, MA 02110-1301, USA.
17 */
18 
19 /*
20  * Global configuration for GUI components of KCachegrind
21  */
22 
23 #ifndef GLOBALGUICONFIG_H
24 #define GLOBALGUICONFIG_H
25 
26 #include <QColor>
27 #include <QString>
28 #include <QHash>
29 
30 #include "globalconfig.h"
31 
39 class ConfigColorSetting
40 {
41  friend class GlobalGUIConfig;
42  friend class ConfigDlg;
43 
44 public:
45  QColor color() const { return _color; }
46  bool automatic() const { return _automatic; }
47 
48  static QColor colorForName(QString);
49  // returns automatic color calculated from name, but does not change color
50  QColor autoColor() const;
51 
52  // explicitly set a color, switches off automatic mode
53  void setColor(const QColor&);
54  // reset to automatic mode
55  void reset();
56 
57 private:
58  ConfigColorSetting(QString n); // color calculated from name
59  ConfigColorSetting(QString, QColor); // color set explicitly
60 
61  QString _name;
62  QColor _color;
63  bool _automatic;
64 };
65 
66 
71 class GlobalGUIConfig: public GlobalConfig
72 {
73  friend class ConfigDlg;
74 
75 public:
76  GlobalGUIConfig();
77  ~GlobalGUIConfig();
78 
79  // gets the singleton instance
80  static GlobalGUIConfig* config();
81 
82  void saveOptions();
83  void readOptions();
84 
85  // color for visualization of an object
86  static QColor functionColor(ProfileContext::Type gt, TraceFunction*);
87  static QColor groupColor(CostItem*);
88  static QColor eventTypeColor(EventType*);
89  static ConfigColorSetting* groupColorSetting(CostItem*);
90  static ConfigColorSetting* groupColorSetting(ProfileContext::Type, QString);
91 
92 protected:
93  static ConfigColorSetting* colorSetting(const QString&, bool createNew = true);
94  QHash<QString, ConfigColorSetting*> _colors;
95 };
96 
97 #endif // GLOBALGUICONFIG_H
GlobalGUIConfig::colorSetting
static ConfigColorSetting * colorSetting(const QString &, bool createNew=true)
Definition: globalguiconfig.cpp:231
globalconfig.h
ConfigColorSetting::colorForName
static QColor colorForName(QString)
Definition: globalguiconfig.cpp:50
GlobalGUIConfig::eventTypeColor
static QColor eventTypeColor(EventType *)
Definition: globalguiconfig.cpp:193
GlobalGUIConfig::functionColor
static QColor functionColor(ProfileContext::Type gt, TraceFunction *)
Definition: globalguiconfig.cpp:205
TraceFunction
A traced function.
Definition: tracedata.h:1122
CostItem
Base class for cost items.
Definition: costitem.h:37
GlobalGUIConfig::GlobalGUIConfig
GlobalGUIConfig()
Definition: globalguiconfig.cpp:77
ConfigColorSetting::automatic
bool automatic() const
Definition: globalguiconfig.h:46
EventType
A cost type, e.g.
Definition: eventtype.h:43
GlobalGUIConfig::groupColor
static QColor groupColor(CostItem *)
Definition: globalguiconfig.cpp:188
GlobalGUIConfig::groupColorSetting
static ConfigColorSetting * groupColorSetting(CostItem *)
Definition: globalguiconfig.cpp:171
QHash< QString, ConfigColorSetting * >
GlobalGUIConfig
Extension of global configuration for GUI options.
Definition: globalguiconfig.h:71
GlobalGUIConfig::readOptions
void readOptions()
Definition: globalguiconfig.cpp:125
QString
QColor
GlobalGUIConfig::config
static GlobalGUIConfig * config()
Definition: globalguiconfig.cpp:88
ConfigColorSetting::setColor
void setColor(const QColor &)
Definition: globalguiconfig.cpp:44
ConfigDlg
Definition: configdlg.h:40
ConfigColorSetting::color
QColor color() const
Definition: globalguiconfig.h:45
GlobalConfig
Global configuration (only non-GUI options).
Definition: globalconfig.h:37
ProfileContext::Type
Type
Definition: context.h:36
ConfigColorSetting
Color setting for a cost item Helper class for color settings in configuration.
Definition: globalguiconfig.h:39
GlobalGUIConfig::saveOptions
void saveOptions()
Definition: globalguiconfig.cpp:105
ConfigColorSetting::reset
void reset()
Definition: globalguiconfig.cpp:66
GlobalGUIConfig::_colors
QHash< QString, ConfigColorSetting * > _colors
Definition: globalguiconfig.h:94
GlobalGUIConfig::~GlobalGUIConfig
~GlobalGUIConfig()
Definition: globalguiconfig.cpp:82
ConfigColorSetting::autoColor
QColor autoColor() const
Definition: globalguiconfig.cpp:61
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:39:50 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kcachegrind

Skip menu "kcachegrind"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal