summaryrefslogtreecommitdiffstats
path: root/ksysv/ksv_conf.h
blob: f17176a9c4822e1d4306cfe94f952ecf70970b48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
/***************************************************************************
    begin                : Sun Oct 3 1999
    copyright            : (C) 1997-99 by Peter Putzer
    email                : putzer@kde.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; version 2.                              *
 *                                                                         *
 ***************************************************************************/

#ifndef KSV_CONF_H
#define KSV_CONF_H

#include <qstring.h>
#include <qpoint.h>
#include <qfont.h>
#include <qcolor.h>
#include <qmap.h>

#include "ksv_core.h"

class KConfig;

class KSVConfig
{
public:
  
  inline ~KSVConfig() {}

  void readSettings();
  void readLegacySettings ();
  void writeSettings();

  void setPanningFactor (int val);

  inline void setShowLog( bool val = false )
  {
    mShowLog = val;
  }

  void setNewNormalColor (const QColor& color);
  void setNewSelectedColor (const QColor& color);
  void setChangedNormalColor (const QColor& color);
  void setChangedSelectedColor (const QColor& color);

  void setServiceFont (const QFont& font);
  void setNumberFont (const QFont& font);

  void setScriptPath (const QString& path);
  void setRunlevelPath (const QString& path);

  inline void setConfigured( bool val = true )
  {
    mConfigured = val;
  }

  inline void setShowDescription (bool val)
  {
	mShowDescription = val;
  }

  inline bool showLog() const
  {
    return mShowLog;
  }

  inline int panningFactor() const
  {
    return mPanningFactor;
  }

  inline const QFont& serviceFont () const { return mServiceFont; }
  inline const QFont& numberFont () const { return mNumberFont; }

  QPoint position() const;

  inline const QColor& newNormalColor () const { return mNewNormalColor; }
  inline const QColor& newSelectedColor () const { return mNewSelectedColor; }

  inline const QColor& changedNormalColor () const { return mChangedNormalColor; }
  inline const QColor& changedSelectedColor () const { return mChangedSelectedColor; }
  
  bool showRunlevel (int index) const;
  void setShowRunlevel (int index, bool state);
  void readRunlevels ();
  void writeRunlevels ();

  /**
   * Have the necessary config entries
   * been written?
   */
  inline bool isConfigured() const
  {
    return mConfigured;
  }

  inline const QString& scriptPath() const
  {
    return mScriptPath;
  }

  inline const QString& runlevelPath() const
  {
    return mRunlevelPath;
  }

  inline bool showDescription() const
  {
	return mShowDescription;
  }

  bool showMessage (ksv::Messages msg) const;
  void setShowMessage (ksv::Messages msg, bool on);

  static KSVConfig* self ();

private:
  KSVConfig ();

  QString mScriptPath;
  QString mRunlevelPath;
  bool mShowLog;
  bool mConfigured;
  KConfig* mConfig;
  int mPanningFactor;

  QColor mNewNormalColor, mNewSelectedColor;
  QColor mChangedNormalColor, mChangedSelectedColor;

  bool mShowDescription;

  QMap<int, bool> mShowRunlevel;

  QFont mServiceFont;
  QFont mNumberFont;
};

#endif // KSV_CONF_H