1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox frontends: Qt GUI ("VirtualBox"):
|
---|
4 | * VBoxGlobalSettingsData, VBoxGlobalSettings class declarations
|
---|
5 | */
|
---|
6 |
|
---|
7 | /*
|
---|
8 | * Copyright (C) 2006-2011 Oracle Corporation
|
---|
9 | *
|
---|
10 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
11 | * available from http://www.virtualbox.org. This file is free software;
|
---|
12 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
13 | * General Public License (GPL) as published by the Free Software
|
---|
14 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
15 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
16 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
17 | */
|
---|
18 |
|
---|
19 | #ifndef __VBoxGlobalSettings_h__
|
---|
20 | #define __VBoxGlobalSettings_h__
|
---|
21 |
|
---|
22 | #include "CIShared.h"
|
---|
23 |
|
---|
24 | /* Qt includes */
|
---|
25 | #include <QObject>
|
---|
26 |
|
---|
27 | class CVirtualBox;
|
---|
28 |
|
---|
29 | class VBoxGlobalSettingsData
|
---|
30 | {
|
---|
31 | public:
|
---|
32 |
|
---|
33 | VBoxGlobalSettingsData();
|
---|
34 | VBoxGlobalSettingsData( const VBoxGlobalSettingsData &that );
|
---|
35 | virtual ~VBoxGlobalSettingsData();
|
---|
36 | bool operator==( const VBoxGlobalSettingsData &that ) const;
|
---|
37 |
|
---|
38 | private:
|
---|
39 |
|
---|
40 | QString hostCombo;
|
---|
41 | bool autoCapture;
|
---|
42 | QString guiFeatures;
|
---|
43 | QString languageId;
|
---|
44 | QString maxGuestRes;
|
---|
45 | QString remapScancodes;
|
---|
46 | bool trayIconEnabled;
|
---|
47 | bool presentationModeEnabled;
|
---|
48 | bool hostScreenSaverDisabled;
|
---|
49 |
|
---|
50 | friend class VBoxGlobalSettings;
|
---|
51 | };
|
---|
52 |
|
---|
53 | /////////////////////////////////////////////////////////////////////////////
|
---|
54 |
|
---|
55 | class VBoxGlobalSettings : public QObject, public CIShared <VBoxGlobalSettingsData>
|
---|
56 | {
|
---|
57 | Q_OBJECT
|
---|
58 | Q_PROPERTY (QString hostCombo READ hostCombo WRITE setHostCombo)
|
---|
59 | Q_PROPERTY (bool autoCapture READ autoCapture WRITE setAutoCapture)
|
---|
60 | Q_PROPERTY (QString guiFeatures READ guiFeatures WRITE setGuiFeatures)
|
---|
61 | Q_PROPERTY (QString languageId READ languageId WRITE setLanguageId)
|
---|
62 | Q_PROPERTY (QString maxGuestRes READ maxGuestRes WRITE setMaxGuestRes)
|
---|
63 | Q_PROPERTY (QString remapScancodes READ remapScancodes WRITE setRemapScancodes)
|
---|
64 | Q_PROPERTY (bool trayIconEnabled READ trayIconEnabled WRITE setTrayIconEnabled)
|
---|
65 | Q_PROPERTY (bool presentationModeEnabled READ presentationModeEnabled WRITE setPresentationModeEnabled)
|
---|
66 | Q_PROPERTY (bool hostScreenSaverDisabled READ hostScreenSaverDisabled WRITE setHostScreenSaverDisabled)
|
---|
67 |
|
---|
68 | public:
|
---|
69 |
|
---|
70 | VBoxGlobalSettings (bool null = true)
|
---|
71 | : CIShared <VBoxGlobalSettingsData> (null) {}
|
---|
72 | VBoxGlobalSettings (const VBoxGlobalSettings &that)
|
---|
73 | : QObject(), CIShared <VBoxGlobalSettingsData> (that) {}
|
---|
74 | VBoxGlobalSettings &operator= (const VBoxGlobalSettings &that) {
|
---|
75 | CIShared <VBoxGlobalSettingsData>::operator= (that);
|
---|
76 | return *this;
|
---|
77 | }
|
---|
78 |
|
---|
79 | // Properties
|
---|
80 |
|
---|
81 | QString hostCombo() const { return data()->hostCombo; }
|
---|
82 | void setHostCombo (const QString &hostCombo);
|
---|
83 |
|
---|
84 | bool autoCapture() const { return data()->autoCapture; }
|
---|
85 | void setAutoCapture (bool aAutoCapture)
|
---|
86 | {
|
---|
87 | mData()->autoCapture = aAutoCapture;
|
---|
88 | resetError();
|
---|
89 | }
|
---|
90 |
|
---|
91 | QString guiFeatures() const { return data()->guiFeatures; }
|
---|
92 | void setGuiFeatures (const QString &aFeatures)
|
---|
93 | {
|
---|
94 | mData()->guiFeatures = aFeatures;
|
---|
95 | }
|
---|
96 | bool isFeatureActive (const char*) const;
|
---|
97 |
|
---|
98 | QString languageId() const { return data()->languageId; }
|
---|
99 | void setLanguageId (const QString &aLanguageId)
|
---|
100 | {
|
---|
101 | mData()->languageId = aLanguageId;
|
---|
102 | }
|
---|
103 |
|
---|
104 | QString maxGuestRes() const { return data()->maxGuestRes; }
|
---|
105 | void setMaxGuestRes (const QString &aMaxGuestRes)
|
---|
106 | {
|
---|
107 | mData()->maxGuestRes = aMaxGuestRes;
|
---|
108 | }
|
---|
109 |
|
---|
110 | QString remapScancodes() const { return data()->remapScancodes; }
|
---|
111 | void setRemapScancodes (const QString &aRemapScancodes)
|
---|
112 | {
|
---|
113 | mData()->remapScancodes = aRemapScancodes;
|
---|
114 | }
|
---|
115 |
|
---|
116 |
|
---|
117 | bool trayIconEnabled() const { return data()->trayIconEnabled; }
|
---|
118 | void setTrayIconEnabled (bool enabled)
|
---|
119 | {
|
---|
120 | mData()->trayIconEnabled = enabled;
|
---|
121 | }
|
---|
122 |
|
---|
123 | bool presentationModeEnabled() const { return data()->presentationModeEnabled; }
|
---|
124 | void setPresentationModeEnabled (bool enabled)
|
---|
125 | {
|
---|
126 | mData()->presentationModeEnabled = enabled;
|
---|
127 | }
|
---|
128 |
|
---|
129 | bool hostScreenSaverDisabled() const { return data()->hostScreenSaverDisabled; }
|
---|
130 | void setHostScreenSaverDisabled (bool disabled)
|
---|
131 | {
|
---|
132 | mData()->hostScreenSaverDisabled = disabled;
|
---|
133 | }
|
---|
134 |
|
---|
135 | void load (CVirtualBox &vbox);
|
---|
136 | void save (CVirtualBox &vbox) const;
|
---|
137 |
|
---|
138 | /**
|
---|
139 | * Returns true if the last setter or #load() operation has been failed
|
---|
140 | * and false otherwise.
|
---|
141 | */
|
---|
142 | bool operator !() const { return !last_err.isEmpty(); }
|
---|
143 |
|
---|
144 | /**
|
---|
145 | * Returns the description of the error set by the last setter or #load()
|
---|
146 | * operation, or an empty (or null) string if the last operation was
|
---|
147 | * successful.
|
---|
148 | */
|
---|
149 | QString lastError() const { return last_err; }
|
---|
150 |
|
---|
151 | QString publicProperty (const QString &publicName) const;
|
---|
152 | bool setPublicProperty (const QString &publicName, const QString &value);
|
---|
153 |
|
---|
154 | signals:
|
---|
155 |
|
---|
156 | /**
|
---|
157 | * This sighal is emitted only when #setPublicProperty() or #load() is called.
|
---|
158 | * Direct modification of properties through individual setters or through
|
---|
159 | * QObject::setProperty() currently cannot be tracked.
|
---|
160 | */
|
---|
161 | void propertyChanged (const char *publicName, const char *name);
|
---|
162 |
|
---|
163 | private:
|
---|
164 |
|
---|
165 | void setPropertyPrivate (size_t index, const QString &value);
|
---|
166 | void resetError() { last_err = QString::null; }
|
---|
167 |
|
---|
168 | QString last_err;
|
---|
169 | };
|
---|
170 |
|
---|
171 | #endif // __VBoxGlobalSettings_h__
|
---|
172 |
|
---|