VirtualBox

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

Last change on this file since 14728 was 8888, checked in by vboxsync, 17 years ago

Frontends/VirtualBox: created a configuration setting for the maximum guest resolution allowed (see #2787c27-36)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.2 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#include <qobject.h>
29
30class CVirtualBox;
31
32class VBoxGlobalSettingsData
33{
34public:
35
36 VBoxGlobalSettingsData();
37 VBoxGlobalSettingsData( const VBoxGlobalSettingsData &that );
38 virtual ~VBoxGlobalSettingsData();
39 bool operator==( const VBoxGlobalSettingsData &that ) const;
40
41private:
42
43 int hostkey;
44 bool autoCapture;
45 QString guiFeatures;
46 QString languageId;
47 QString maxGuestRes;
48
49 friend class VBoxGlobalSettings;
50};
51
52/////////////////////////////////////////////////////////////////////////////
53
54class VBoxGlobalSettings : public QObject, public CIShared <VBoxGlobalSettingsData>
55{
56 Q_OBJECT
57 Q_PROPERTY (int hostKey READ hostKey WRITE setHostKey)
58 Q_PROPERTY (bool autoCapture READ autoCapture WRITE setAutoCapture)
59 Q_PROPERTY (QString guiFeatures READ guiFeatures WRITE setGuiFeatures)
60 Q_PROPERTY (QString languageId READ languageId WRITE setLanguageId)
61 Q_PROPERTY (QString maxGuestRes READ maxGuestRes WRITE setMaxGuestRes)
62
63public:
64
65 VBoxGlobalSettings (bool null = true)
66 : CIShared <VBoxGlobalSettingsData> (null) {}
67 VBoxGlobalSettings (const VBoxGlobalSettings &that)
68 : QObject(), CIShared <VBoxGlobalSettingsData> (that) {}
69 VBoxGlobalSettings &operator= (const VBoxGlobalSettings &that) {
70 CIShared <VBoxGlobalSettingsData>::operator= (that);
71 return *this;
72 }
73
74 // Properties
75
76 int hostKey() const { return data()->hostkey; }
77 void setHostKey (int key);
78
79 bool autoCapture() const { return data()->autoCapture; }
80 void setAutoCapture (bool autoCapture) {
81 mData()->autoCapture = autoCapture;
82 resetError();
83 }
84
85 QString guiFeatures() const { return data()->guiFeatures; }
86 void setGuiFeatures (const QString &aFeatures)
87 {
88 mData()->guiFeatures = aFeatures;
89 }
90 bool isFeatureActive (const char*) const;
91
92 QString languageId() const { return data()->languageId; }
93 void setLanguageId (const QString &aLanguageId)
94 {
95 mData()->languageId = aLanguageId;
96 }
97
98 QString maxGuestRes() const { return data()->maxGuestRes; }
99 void setMaxGuestRes (const QString &aMaxGuestRes)
100 {
101 mData()->maxGuestRes = aMaxGuestRes;
102 }
103
104 //
105
106 void load (CVirtualBox &vbox);
107 void save (CVirtualBox &vbox) const;
108
109 /**
110 * Returns true if the last setter or #load() operation has been failed
111 * and false otherwise.
112 */
113 bool operator !() const { return !last_err.isEmpty(); }
114
115 /**
116 * Returns the description of the error set by the last setter or #load()
117 * operation, or an empty (or null) string if the last operation was
118 * successful.
119 */
120 QString lastError() const { return last_err; }
121
122 QString publicProperty (const QString &publicName) const;
123 bool setPublicProperty (const QString &publicName, const QString &value);
124
125signals:
126
127 /**
128 * This sighal is emitted only when #setPublicProperty() or #load() is called.
129 * Direct modification of properties through individual setters or through
130 * QObject::setProperty() currently cannot be tracked.
131 */
132 void propertyChanged (const char *publicName, const char *name);
133
134private:
135
136 void setPropertyPrivate (int index, const QString &value);
137 void resetError() { last_err = QString::null; }
138
139 QString last_err;
140};
141
142#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