summaryrefslogtreecommitdiffstats
path: root/kicker-applets/ktimemon/confdlg.h
blob: 25d0501b7d179ff4dd1049be3026edcba80488bc (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
/* -*- C++ -*- */

/**********************************************************************/
/*   TimeMon (c)  1994  Helmut Maierhofer			                  */
/*   KDE-ified M. Maierhofer 1998                                     */
/*                                                                    */
/*   Ported to KDE 2.0 and other stuff:                               */
/*     Copyright (c) Dirk A. Mueller <dmuell@gmx.net>                 */
/*                                                                    */
/**********************************************************************/

/*
 * confdlg.h
 *
 * Definitions for the timemon configuration dialog.
 */

#ifndef CONFDLG_H
#define CONFDLG_H

#include <tqcolor.h>
#include <tqcheckbox.h>
#include <tqtabdialog.h>

#include <kcolorbutton.h>
#include <kcombobox.h>
#include <klineedit.h>
#include <knuminput.h>
#include <kdialogbase.h>
#include <kurlrequester.h>

#include "timemon.h"

// -- forward declaration ------------------------------------------------

class KTimeMon;
class QLineEdit;
class QSlider;
class KColorButton;

// -- KConfDialog declaration --------------------------------------------

/*
 * KConfDialog
 */

class KConfDialog : public KDialogBase
{

    Q_OBJECT

public:
    KConfDialog(KTimeMon *timemon);
    ~KConfDialog() {}

    void update();		// get values from timemon

  unsigned getInterval() const { return intervalEdit->value(); }
  TQColor getKernelColour() const { return kernelCB->color(); }
  TQColor getUserColour() const { return userCB->color(); }
  TQColor getNiceColour() const { return niceCB->color(); }
  TQColor getIOWaitColour() const { return iowaitCB->color(); }
  TQColor getCachedColour() const { return cachedCB->color(); }
  TQColor getUsedColour() const { return usedCB->color(); }
  TQColor getBuffersColour() const { return buffersCB->color(); }
  TQColor getMKernelColour() const { return mkernelCB->color(); }
  TQColor getSwapColour() const { return swapCB->color(); }
  TQColor getBgColour() const { return bgCB->color(); }

  bool getAutoScale() const { return autoScaleBox->isChecked(); }
  unsigned getPageScale() const { return pageScaleEdit->value(); }
  unsigned getSwapScale() const { return swapScaleEdit->value(); }
  unsigned getCtxScale() const { return ctxScaleEdit->value(); }

  unsigned getMouseAction(int i) const;
  TQString getMouseActionCommand(int i) const { return mouseLE[i]->lineEdit()->text(); }

private slots:
  void updateSampleWidget(const TQColor &); // update colours in configuration
  void toggle(bool state);	// enable/disable scales
  void mouseCommandEnable();

private:

  KTimeMon *timemon;
  KIntNumInput *intervalEdit, *swapScaleEdit, *pageScaleEdit, *ctxScaleEdit;
  TQLineEdit *procFileEdit;
  TQCheckBox *autoScaleBox;
  KColorButton *kernelCB, *userCB, *niceCB, *iowaitCB;
  KColorButton *buffersCB, *usedCB, *cachedCB, *mkernelCB;
  KColorButton *swapCB, *bgCB;
  KURLRequester *mouseLE[MAX_MOUSE_ACTIONS];
  KComboBox *mouseC[MAX_MOUSE_ACTIONS];
  bool haveWarned;

  friend class KTimeMon;
};

#endif // CONFDLG_H