summaryrefslogtreecommitdiffstats
path: root/ksysv/ksv_conf.h
blob: 6752cc6898d39abed169180e22bdb43aefe55461 (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 <tqstring.h>
#include <tqpoint.h>
#include <tqfont.h>
#include <tqcolor.h>
#include <tqmap.h>

#include "ksv_core.h"

class TDEConfig;

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 TQColor& color);
  void setNewSelectedColor (const TQColor& color);
  void setChangedNormalColor (const TQColor& color);
  void setChangedSelectedColor (const TQColor& color);

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

  void setScriptPath (const TQString& path);
  void setRunlevelPath (const TQString& 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 TQFont& serviceFont () const { return mServiceFont; }
  inline const TQFont& numberFont () const { return mNumberFont; }

  TQPoint position() const;

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

  inline const TQColor& changedNormalColor () const { return mChangedNormalColor; }
  inline const TQColor& 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 TQString& scriptPath() const
  {
    return mScriptPath;
  }

  inline const TQString& 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 ();

  TQString mScriptPath;
  TQString mRunlevelPath;
  bool mShowLog;
  bool mConfigured;
  TDEConfig* mConfig;
  int mPanningFactor;

  TQColor mNewNormalColor, mNewSelectedColor;
  TQColor mChangedNormalColor, mChangedSelectedColor;

  bool mShowDescription;

  TQMap<int, bool> mShowRunlevel;

  TQFont mServiceFont;
  TQFont mNumberFont;
};

#endif // KSV_CONF_H