VirtualBox

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

Last change on this file since 2524 was 2354, checked in by vboxsync, 18 years ago

FE/Qt: Renamed class VMGlobalSettings to VBoxGlobalSettings.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.9 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt GUI ("VirtualBox"):
4 * VBoxGlobalSettingsData, VBoxGlobalSettings class declarations
5 */
6
7/*
8 * Copyright (C) 2006 InnoTek Systemberatung 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 as published by the Free Software Foundation,
14 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
15 * distribution. VirtualBox OSE is distributed in the hope that it will
16 * be useful, but WITHOUT ANY WARRANTY of any kind.
17 *
18 * If you received this file as part of a commercial VirtualBox
19 * distribution, then only the terms of your commercial VirtualBox
20 * license agreement apply instead of the previous paragraph.
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
48 friend class VBoxGlobalSettings;
49};
50
51/////////////////////////////////////////////////////////////////////////////
52
53class VBoxGlobalSettings : public QObject, public CIShared <VBoxGlobalSettingsData>
54{
55 Q_OBJECT
56 Q_PROPERTY (int hostKey READ hostKey WRITE setHostKey)
57 Q_PROPERTY (bool autoCapture READ autoCapture WRITE setAutoCapture)
58 Q_PROPERTY (QString guiFeatures READ guiFeatures WRITE setGuiFeatures)
59 Q_PROPERTY (QString languageId READ languageId WRITE setLanguageId)
60
61public:
62
63 VBoxGlobalSettings (bool null = true)
64 : CIShared <VBoxGlobalSettingsData> (null) {}
65 VBoxGlobalSettings (const VBoxGlobalSettings &that)
66 : QObject(), CIShared <VBoxGlobalSettingsData> (that) {}
67 VBoxGlobalSettings &operator= (const VBoxGlobalSettings &that) {
68 CIShared <VBoxGlobalSettingsData>::operator= (that);
69 return *this;
70 }
71
72 // Properties
73
74 int hostKey() const { return data()->hostkey; }
75 void setHostKey (int key);
76
77 bool autoCapture() const { return data()->autoCapture; }
78 void setAutoCapture (bool autoCapture) {
79 mData()->autoCapture = autoCapture;
80 resetError();
81 }
82
83 QString guiFeatures() const { return data()->guiFeatures; }
84 void setGuiFeatures (const QString &aFeatures)
85 {
86 mData()->guiFeatures = aFeatures;
87 }
88 bool isFeatureActive (const char*) const;
89
90 QString languageId() const { return data()->languageId; }
91 void setLanguageId (const QString &aLanguageId)
92 {
93 mData()->languageId = aLanguageId;
94 }
95
96 //
97
98 void load (CVirtualBox &vbox);
99 void save (CVirtualBox &vbox) const;
100
101 /**
102 * Returns true if the last setter or #load() operation has been failed
103 * and false otherwise.
104 */
105 bool operator !() const { return !last_err.isEmpty(); }
106
107 /**
108 * Returns the description of the error set by the last setter or #load()
109 * operation, or an empty (or null) string if the last operation was
110 * successful.
111 */
112 QString lastError() const { return last_err; }
113
114 QString publicProperty (const QString &publicName) const;
115 bool setPublicProperty (const QString &publicName, const QString &value);
116
117signals:
118
119 /**
120 * This sighal is emitted only when #setPublicProperty() or #load() is called.
121 * Direct modification of properties through individual setters or through
122 * QObject::setProperty() currently cannot be tracked.
123 */
124 void propertyChanged (const char *publicName, const char *name);
125
126private:
127
128 void setPropertyPrivate (int index, const QString &value);
129 void resetError() { last_err = QString::null; }
130
131 QString last_err;
132};
133
134#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