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 # if defined (Q_OS_WIN)
51 # define P_EXPORT Q_DECL_IMPORT
52 # else
53 # define P_EXPORT Q_DECL_EXPORT
54 # endif
55 #endif
56 
57 struct MyStructure {
58  QString key, val, type;
59 };
60 QDBusArgument &operator<<(QDBusArgument &a, const MyStructure &mystruct);
61 const QDBusArgument &operator>>(const QDBusArgument &a, MyStructure &mystruct);
62 Q_DECLARE_METATYPE(MyStructure)
63 
64 
65 class ProfilePrivate;
66 
71 namespace ProfileName
72 {
73 const QString ringing = "general";
74 const QString silent = "silent";
75 const QString beep = "meeting";
76 const QString loud = "outdoors";
77 }
78 
83 class P_EXPORT Profile : public QObject
84 {
85  Q_OBJECT
86 
87 public:
93  explicit Profile(QObject* parent = 0);
97  virtual ~Profile();
98 
99 public Q_SLOTS:
100 
106  QString activeProfile();
107 
114  bool setActiveProfile(QString name);
115 
121  QStringList profileNames();
122 
132  int volumeLevel(QString profileName);
133 
141  bool isVibrationEnabled(QString profileName);
142 
151  int touchscreenVibrationLevel(QString profileName);
152 
163  bool setVolumeLevel(QString profileName, int level);
164 
173  bool setVibration(QString profileName, bool enabled);
174 
184  bool setTouchscreenVibrationLevel(QString profileName, int level);
185 
186 signals:
187 
197  void volumeLevelChanged(QString profileName, int level);
198 
207  void vibrationChanged(QString profileName, bool enabled);
208 
217  void touchscreenVibrationLevelChanged(QString profileName, int level);
218 
227  void activeProfileChanged(QString newActiveProfileName);
228 
229 private slots:
230  void handleProfileChanged(bool changed, bool active, QString profile, QList<MyStructure> keyValType);
231 
232 private:
233  ProfilePrivate* const d_ptr;
234  Profile(ProfilePrivate* dd, QObject* parent = 0);
235 
236 private:
237  Q_DECLARE_PRIVATE(Profile)
238  Q_DISABLE_COPY(Profile)
239 
240 #ifdef UNIT_TEST
241  friend class Ut_Profile;
242 #endif
243 };
244 
245 #endif // PROFILES_H
Definition: profile.h:84
void activeProfileChanged(QString newActiveProfileName)
void volumeLevelChanged(QString profileName, int level)
void touchscreenVibrationLevelChanged(QString profileName, int level)
void vibrationChanged(QString profileName, bool enabled)
Definition: profile.h:72
const QString silent
Definition: profile.h:74
const QString loud
Definition: profile.h:76
const QString beep
Definition: profile.h:75
const QString ringing
Definition: profile.h:73
Definition: profile.h:57

Copyright © 2009 Nokia Corporation Generated on Tue May 18 2021 21:41:09
Doxygen 1.9.1
System Control UI