summaryrefslogtreecommitdiffstats
path: root/kmilo/kmilo_kvaio/kvaio.h
blob: c16f27e5f5126a0dec119261d9b1b6865a653f10 (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
/* -*- C++ -*-

   This file declares the KVaio class.

   $ Author: Mirko Boehm $
   $ Copyright: (C) 1996-2003, Mirko Boehm $
   $ Contact: mirko@kde.org
         http://www.kde.org
         http://www.hackerbuero.org $
   $ License: LGPL with the following explicit clarification:
         This code may be linked against any version of the Qt toolkit
         from Troll Tech, Norway. $

   $Id$

   * Portions of this code are
   * (C) 2001-2002 Stelian Pop <stelian@popies.net> and
   * (C) 2001-2002 Alcove <www.alcove.com>.
   * Thanks to Stelian for the implementation of the sonypi driver.
*/

#ifndef _KVAIO_H
#define _KVAIO_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <qtimer.h>

#include <dcopclient.h>
#include <dcopref.h>
#include <kmainwindow.h>
#include "kvaiodriverinterface.h"
#include "monitor.h"
#include "kmilo_kvaio.h"

extern "C" {
#include <X11/Xlib.h>
//#include <X11/extensions/XTest.h>
}

class KVaio;
class KMiloKVaio;

/**
 * @short KVaio class
 * This class provides an interface between the Vaio driver and the
 * respective application (either the kmilod module or a single
 * application).
 * This class provides the application of the events created by the
 * KVaioDriverInterface class.
 * @author Mirko Boehm <mirko@hackerbuero.org>
 * @version 0.2
 */
class KVaio : public QObject
{
    Q_OBJECT
public:
//    KVaio(QObject *parent = 0, const char *name =0);
    KVaio(KMiloKVaio *parent = 0, const char *name =0);

    virtual ~KVaio();
    const KVaioDriverInterface *driver();
    void loadConfiguration(KConfig *);
    const int progress() { return m_progress; }

protected:
    KVaioDriverInterface *mDriver;
    Display *mDisp;
    DCOPClient mClient;
    bool isKScreensaverAvailable();
    bool isKMiloDAvailable();
    bool showTextMsg(const QString& msg);
    bool showProgressMsg(const QString& msg, int progress);
    bool showBatteryStatus ( bool force = false);
protected slots:
    void slotVaioEvent(int);
    void slotTimeout();
public slots:
    void blankScreen();
    void suspendToDisk();
    void BrightnessUp(int step);
    void BrightnessDown(int step);
    void VolumeUp(int step);
    void VolumeDown(int step);
    void mute();    
private:
    bool retrieveMute();
    bool retrieveVolume();
    void displayVolume();

    KMiloKVaio *myparent;

    DCOPRef *kmixClient, *kmixWindow;

    int m_progress;
    int m_volume, m_oldVolume, m_brightness;
    bool m_mute;

    int m_maxVolume, m_minVolume;
    int m_maxBright, m_minBright;

    int  m_VolumeStep;
    int  m_BrightnessStep;

    bool mReportUnknownEvents;
    bool mReportPowerStatus;
    bool mShowPowerStatusOnBackButton;
    QTimer *mTimer;
};

#endif // _KVAIO_H