VirtualBox

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

Last change on this file since 21194 was 15664, checked in by vboxsync, 16 years ago

FE/Qt4-OSX: Added option to enable/disable the real time VM preview in the dock
icon.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.8 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 bool trayIconEnabled;
50 bool dockPreviewEnabled;
51
52 friend class VBoxGlobalSettings;
53};
54
55/////////////////////////////////////////////////////////////////////////////
56
57class VBoxGlobalSettings : public QObject, public CIShared <VBoxGlobalSettingsData>
58{
59 Q_OBJECT
60 Q_PROPERTY (int hostKey READ hostKey WRITE setHostKey)
61 Q_PROPERTY (bool autoCapture READ autoCapture WRITE setAutoCapture)
62 Q_PROPERTY (QString guiFeatures READ guiFeatures WRITE setGuiFeatures)
63 Q_PROPERTY (QString languageId READ languageId WRITE setLanguageId)
64 Q_PROPERTY (QString maxGuestRes READ maxGuestRes WRITE setMaxGuestRes)
65 Q_PROPERTY (bool trayIconEnabled READ trayIconEnabled WRITE setTrayIconEnabled)
66 Q_PROPERTY (bool dockPreviewEnabled READ dockPreviewEnabled WRITE setDockPreviewEnabled)
67
68public:
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 int hostKey() const { return data()->hostkey; }
82 void setHostKey (int key);
83
84 bool autoCapture() const { return data()->autoCapture; }
85 void setAutoCapture (bool autoCapture) {
86 mData()->autoCapture = autoCapture;
87 resetError();
88 }
89
90 QString guiFeatures() const { return data()->guiFeatures; }
91 void setGuiFeatures (const QString &aFeatures)
92 {
93 mData()->guiFeatures = aFeatures;
94 }
95 bool isFeatureActive (const char*) const;
96
97 QString languageId() const { return data()->languageId; }
98 void setLanguageId (const QString &aLanguageId)
99 {
100 mData()->languageId = aLanguageId;
101 }
102
103 QString maxGuestRes() const { return data()->maxGuestRes; }
104 void setMaxGuestRes (const QString &aMaxGuestRes)
105 {
106 mData()->maxGuestRes = aMaxGuestRes;
107 }
108
109 bool trayIconEnabled() const { return data()->trayIconEnabled; }
110 void setTrayIconEnabled (bool enabled)
111 {
112 mData()->trayIconEnabled = enabled;
113 }
114
115 bool dockPreviewEnabled() const { return data()->dockPreviewEnabled; }
116 void setDockPreviewEnabled (bool enabled)
117 {
118 mData()->dockPreviewEnabled = enabled;
119 }
120
121
122 //
123
124 void load (CVirtualBox &vbox);
125 void save (CVirtualBox &vbox) const;
126
127 /**
128 * Returns true if the last setter or #load() operation has been failed
129 * and false otherwise.
130 */
131 bool operator !() const { return !last_err.isEmpty(); }
132
133 /**
134 * Returns the description of the error set by the last setter or #load()
135 * operation, or an empty (or null) string if the last operation was
136 * successful.
137 */
138 QString lastError() const { return last_err; }
139
140 QString publicProperty (const QString &publicName) const;
141 bool setPublicProperty (const QString &publicName, const QString &value);
142
143signals:
144
145 /**
146 * This sighal is emitted only when #setPublicProperty() or #load() is called.
147 * Direct modification of properties through individual setters or through
148 * QObject::setProperty() currently cannot be tracked.
149 */
150 void propertyChanged (const char *publicName, const char *name);
151
152private:
153
154 void setPropertyPrivate (size_t index, const QString &value);
155 void resetError() { last_err = QString::null; }
156
157 QString last_err;
158};
159
160#endif // __VBoxGlobalSettings_h__
Note: See TracBrowser for help on using the repository browser.

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