VirtualBox

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

Last change on this file since 6645 was 5999, checked in by vboxsync, 17 years ago

The Giant CDDL Dual-License Header Change.

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