VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobalSettings.h@ 7871

Last change on this file since 7871 was 7721, checked in by vboxsync, 17 years ago

FE/Qt4: Ported several classes from qt3 to qt4 and some minor changes.

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