VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobalSettings.h@ 25045

Last change on this file since 25045 was 25012, checked in by vboxsync, 15 years ago

FE/Qt4: fix some -Wshadow warnings

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VBoxGlobalSettingsData, VBoxGlobalSettings class declarations
5 */
6
7/*
8 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
19 * Clara, CA 95054 USA or visit http://www.sun.com if you need
20 * additional information or have any questions.
21 */
22
23#ifndef __VBoxGlobalSettings_h__
24#define __VBoxGlobalSettings_h__
25
26#include "CIShared.h"
27
28/* Qt includes */
29#include <QObject>
30
31class CVirtualBox;
32
33class VBoxGlobalSettingsData
34{
35public:
36
37 VBoxGlobalSettingsData();
38 VBoxGlobalSettingsData( const VBoxGlobalSettingsData &that );
39 virtual ~VBoxGlobalSettingsData();
40 bool operator==( const VBoxGlobalSettingsData &that ) const;
41
42private:
43
44 int hostkey;
45 bool autoCapture;
46 QString guiFeatures;
47 QString languageId;
48 QString maxGuestRes;
49 QString remapScancodes;
50 bool trayIconEnabled;
51 bool dockPreviewEnabled;
52
53 friend class VBoxGlobalSettings;
54};
55
56/////////////////////////////////////////////////////////////////////////////
57
58class VBoxGlobalSettings : public QObject, public CIShared <VBoxGlobalSettingsData>
59{
60 Q_OBJECT
61 Q_PROPERTY (int hostKey READ hostKey WRITE setHostKey)
62 Q_PROPERTY (bool autoCapture READ autoCapture WRITE setAutoCapture)
63 Q_PROPERTY (QString guiFeatures READ guiFeatures WRITE setGuiFeatures)
64 Q_PROPERTY (QString languageId READ languageId WRITE setLanguageId)
65 Q_PROPERTY (QString maxGuestRes READ maxGuestRes WRITE setMaxGuestRes)
66 Q_PROPERTY (QString remapScancodes READ remapScancodes WRITE setRemapScancodes)
67 Q_PROPERTY (bool trayIconEnabled READ trayIconEnabled WRITE setTrayIconEnabled)
68 Q_PROPERTY (bool dockPreviewEnabled READ dockPreviewEnabled WRITE setDockPreviewEnabled)
69
70public:
71
72 VBoxGlobalSettings (bool null = true)
73 : CIShared <VBoxGlobalSettingsData> (null) {}
74 VBoxGlobalSettings (const VBoxGlobalSettings &that)
75 : QObject(), CIShared <VBoxGlobalSettingsData> (that) {}
76 VBoxGlobalSettings &operator= (const VBoxGlobalSettings &that) {
77 CIShared <VBoxGlobalSettingsData>::operator= (that);
78 return *this;
79 }
80
81 // Properties
82
83 int hostKey() const { return data()->hostkey; }
84 void setHostKey (int key);
85
86 bool autoCapture() const { return data()->autoCapture; }
87 void setAutoCapture (bool aAutoCapture)
88 {
89 mData()->autoCapture = aAutoCapture;
90 resetError();
91 }
92
93 QString guiFeatures() const { return data()->guiFeatures; }
94 void setGuiFeatures (const QString &aFeatures)
95 {
96 mData()->guiFeatures = aFeatures;
97 }
98 bool isFeatureActive (const char*) const;
99
100 QString languageId() const { return data()->languageId; }
101 void setLanguageId (const QString &aLanguageId)
102 {
103 mData()->languageId = aLanguageId;
104 }
105
106 QString maxGuestRes() const { return data()->maxGuestRes; }
107 void setMaxGuestRes (const QString &aMaxGuestRes)
108 {
109 mData()->maxGuestRes = aMaxGuestRes;
110 }
111
112 QString remapScancodes() const { return data()->remapScancodes; }
113 void setRemapScancodes (const QString &aRemapScancodes)
114 {
115 mData()->remapScancodes = aRemapScancodes;
116 }
117
118
119 bool trayIconEnabled() const { return data()->trayIconEnabled; }
120 void setTrayIconEnabled (bool enabled)
121 {
122 mData()->trayIconEnabled = enabled;
123 }
124
125 bool dockPreviewEnabled() const { return data()->dockPreviewEnabled; }
126 void setDockPreviewEnabled (bool enabled)
127 {
128 mData()->dockPreviewEnabled = enabled;
129 }
130
131
132 //
133
134 void load (CVirtualBox &vbox);
135 void save (CVirtualBox &vbox) const;
136
137 /**
138 * Returns true if the last setter or #load() operation has been failed
139 * and false otherwise.
140 */
141 bool operator !() const { return !last_err.isEmpty(); }
142
143 /**
144 * Returns the description of the error set by the last setter or #load()
145 * operation, or an empty (or null) string if the last operation was
146 * successful.
147 */
148 QString lastError() const { return last_err; }
149
150 QString publicProperty (const QString &publicName) const;
151 bool setPublicProperty (const QString &publicName, const QString &value);
152
153signals:
154
155 /**
156 * This sighal is emitted only when #setPublicProperty() or #load() is called.
157 * Direct modification of properties through individual setters or through
158 * QObject::setProperty() currently cannot be tracked.
159 */
160 void propertyChanged (const char *publicName, const char *name);
161
162private:
163
164 void setPropertyPrivate (size_t index, const QString &value);
165 void resetError() { last_err = QString::null; }
166
167 QString last_err;
168};
169
170#endif // __VBoxGlobalSettings_h__
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette