Home · All Namespaces · All Classes · Main Classes
profile.h
1
2/******************************************************************************
3** This file is part of profile-qt
4**
5** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
6** All rights reserved.
7**
8** Contact: Sakari Poussa <sakari.poussa@nokia.com>
9**
10** Redistribution and use in source and binary forms, with or without
11** modification, are permitted provided that the following conditions are met:
12**
13** Redistributions of source code must retain the above copyright notice,
14** this list of conditions and the following disclaimer. Redistributions in
15** binary form must reproduce the above copyright notice, this list of
16** conditions and the following disclaimer in the documentation and/or
17** other materials provided with the distribution.
18**
19** Neither the name of Nokia Corporation nor the names of its contributors
20** may be used to endorse or promote products derived from this software
21** without specific prior written permission.
22**
23** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
25** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26** PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
27** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
30** OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32** OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
33** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34******************************************************************************/
35
36#ifndef PROFILES_H
37#define PROFILES_H
38
39#include <QObject>
40#include <QStringList>
41#include <QList>
42
43#include <QtCore/QtGlobal>
44#include <QtDBus>
45
46
47#if defined(PROFILE_QT)
48 #define P_EXPORT Q_DECL_EXPORT
49#else
50 #define P_EXPORT Q_DECL_IMPORT
51#endif
52
54 QString key, val, type;
55};
56QDBusArgument &operator<<(QDBusArgument &a, const MyStructure &mystruct);
57const QDBusArgument &operator>>(const QDBusArgument &a, MyStructure &mystruct);
58Q_DECLARE_METATYPE(MyStructure)
59
60
61class ProfilePrivate;
62
67namespace ProfileName
68{
69const QString ringing = "general";
70const QString silent = "silent";
71const QString beep = "meeting";
72const QString loud = "outdoors";
73}
74
79class P_EXPORT Profile : public QObject
80{
81 Q_OBJECT
82
83public:
89 explicit Profile(QObject* parent = 0);
93 virtual ~Profile();
94
95public Q_SLOTS:
96
102 QString activeProfile();
103
110 bool setActiveProfile(QString name);
111
117 QStringList profileNames();
118
128 int volumeLevel(QString profileName);
129
137 bool isVibrationEnabled(QString profileName);
138
147 int touchscreenVibrationLevel(QString profileName);
148
159 bool setVolumeLevel(QString profileName, int level);
160
169 bool setVibration(QString profileName, bool enabled);
170
180 bool setTouchscreenVibrationLevel(QString profileName, int level);
181
182signals:
183
193 void volumeLevelChanged(QString profileName, int level);
194
203 void vibrationChanged(QString profileName, bool enabled);
204
213 void touchscreenVibrationLevelChanged(QString profileName, int level);
214
223 void activeProfileChanged(QString newActiveProfileName);
224
225private slots:
226 void handleProfileChanged(bool changed, bool active, QString profile, QList<MyStructure> keyValType);
227
228private:
229 ProfilePrivate* const d_ptr;
230 Profile(ProfilePrivate* dd, QObject* parent = 0);
231
232private:
233 Q_DECLARE_PRIVATE(Profile)
234 Q_DISABLE_COPY(Profile)
235
236#ifdef UNIT_TEST
237 friend class Ut_Profile;
238#endif
239};
240
241#endif // PROFILES_H
QString activeProfile()
Definition profile.cpp:193
int volumeLevel(QString profileName)
Definition profile.cpp:244
bool setVibration(QString profileName, bool enabled)
Definition profile.cpp:329
void activeProfileChanged(QString newActiveProfileName)
Profile(QObject *parent=0)
Definition profile.cpp:156
bool setVolumeLevel(QString profileName, int level)
Definition profile.cpp:300
bool setActiveProfile(QString name)
Definition profile.cpp:209
void volumeLevelChanged(QString profileName, int level)
bool setTouchscreenVibrationLevel(QString profileName, int level)
Definition profile.cpp:348
int touchscreenVibrationLevel(QString profileName)
Definition profile.cpp:282
QStringList profileNames()
Get available profile names.
Definition profile.cpp:225
void touchscreenVibrationLevelChanged(QString profileName, int level)
bool isVibrationEnabled(QString profileName)
Definition profile.cpp:265
void vibrationChanged(QString profileName, bool enabled)
Definition profile.h:68
const QString silent
Definition profile.h:70
const QString loud
Definition profile.h:72
const QString beep
Definition profile.h:71
const QString ringing
Definition profile.h:69
Definition profile.h:53

Copyright © 2009 Nokia Corporation Generated on Mon Mar 3 2025 11:00:20
Doxygen 1.13.2
System Control UI