~ubuntu-branches/ubuntu/maverick/bluedevil/maverick-proposed

« back to all changes in this revision

Viewing changes to src/kcmodule/bluedeviladapters.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2010-08-07 09:04:19 UTC
  • Revision ID: james.westby@ubuntu.com-20100807090419-68k54ucso2htcf5z
Tags: upstream-1.0~rc2
Import upstream version 1.0~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2010 Rafael Fernández López <ereslibre@kde.org>
 
3
 * Copyright (C) 2010 UFO Coders <info@ufocoders.com>
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2 of the License, or (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 * General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Library General Public License
 
16
 * along with this library; see the file COPYING.LIB.  If not, write to
 
17
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
18
 * Boston, MA 02110-1301, USA.
 
19
 */
 
20
 
 
21
#ifndef _BLUEDEVILADAPTERS_H
 
22
#define _BLUEDEVILADAPTERS_H
 
23
 
 
24
#include <QtGui/QGroupBox>
 
25
 
 
26
#include <kcmodule.h>
 
27
 
 
28
class QVBoxLayout;
 
29
class QRadioButton;
 
30
class QSlider;
 
31
class QLabel;
 
32
class QCheckBox;
 
33
class QFormLayout;
 
34
 
 
35
class KLineEdit;
 
36
 
 
37
class SystemCheck;
 
38
class AdapterSettings;
 
39
 
 
40
namespace BlueDevil {
 
41
    class Adapter;
 
42
}
 
43
 
 
44
typedef BlueDevil::Adapter Adapter;
 
45
 
 
46
class AdapterSettings
 
47
    : public QGroupBox
 
48
{
 
49
    Q_OBJECT
 
50
 
 
51
public:
 
52
    enum DiscoverOptions {
 
53
        Hidden = 0,
 
54
        AlwaysVisible,
 
55
        TemporaryVisible
 
56
    };
 
57
 
 
58
    AdapterSettings(Adapter *adapter, KCModule *parent);
 
59
    virtual ~AdapterSettings();
 
60
 
 
61
    bool isModified() const;
 
62
    void applyChanges();
 
63
 
 
64
    QString name() const;
 
65
    DiscoverOptions discoverOptions() const;
 
66
    quint32 discoverTime() const;
 
67
    bool powered() const;
 
68
 
 
69
private Q_SLOTS:
 
70
    void readChanges();
 
71
    void visibilityChanged();
 
72
    void slotSettingsChanged();
 
73
 
 
74
Q_SIGNALS:
 
75
    void settingsChanged(bool changed);
 
76
 
 
77
private:
 
78
    Adapter      *m_adapter;
 
79
    KLineEdit    *m_name;
 
80
    QString       m_nameOrig;
 
81
    QRadioButton *m_hidden;
 
82
    bool          m_hiddenOrig;
 
83
    QRadioButton *m_alwaysVisible;
 
84
    bool          m_alwaysVisibleOrig;
 
85
    QRadioButton *m_temporaryVisible;
 
86
    bool          m_temporaryVisibleOrig;
 
87
    QSlider      *m_discoverTime;
 
88
    QLabel       *m_discoverTimeLabel;
 
89
    QWidget      *m_discoverTimeWidget;
 
90
    int           m_discoverTimeOrig;
 
91
    QCheckBox    *m_powered;
 
92
    bool          m_poweredOrig;
 
93
 
 
94
    QFormLayout  *m_layout;
 
95
};
 
96
 
 
97
class KCMBlueDevilAdapters
 
98
    : public KCModule
 
99
{
 
100
    Q_OBJECT
 
101
 
 
102
public:
 
103
    KCMBlueDevilAdapters(QWidget *parent, const QVariantList&);
 
104
    virtual ~KCMBlueDevilAdapters();
 
105
 
 
106
    virtual void defaults();
 
107
    virtual void save();
 
108
 
 
109
private Q_SLOTS:
 
110
    void updateAdapters();
 
111
    void defaultAdapterChanged(Adapter *adapter);
 
112
    void adapterDiscoverableChanged();
 
113
    void generateNoAdaptersMessage();
 
114
    void updateInformationState();
 
115
    void adapterConfigurationChanged(bool modified);
 
116
 
 
117
private:
 
118
    void fillAdaptersInformation();
 
119
 
 
120
private:
 
121
    QVBoxLayout                     *m_layout;
 
122
    QMap<Adapter*, AdapterSettings*> m_adapterSettingsMap;
 
123
    QWidget                         *m_noAdaptersMessage;
 
124
 
 
125
    SystemCheck *m_systemCheck;
 
126
};
 
127
 
 
128
#endif