VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsPage.h@ 35740

Last change on this file since 35740 was 34740, checked in by vboxsync, 13 years ago

FE/Qt: Add errors processing for settings save procedure (problem-reporter updated for inter-thread cases).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 4.2 KB
Line 
1/** @file
2 *
3 * VBox frontends: Qt4 GUI ("VirtualBox"):
4 * UISettingsPage class declaration
5 */
6
7/*
8 * Copyright (C) 2006-2010 Oracle Corporation
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 __UISettingsPage_h__
20#define __UISettingsPage_h__
21
22/* Global includes */
23#include <QWidget>
24#include <QVariant>
25
26/* Local includes */
27#include "QIWithRetranslateUI.h"
28#include "COMDefs.h"
29#include "VBoxGlobalSettings.h"
30
31/* Forward declarations */
32class QIWidgetValidator;
33
34/* Settings page types: */
35enum UISettingsPageType
36{
37 UISettingsPageType_Global,
38 UISettingsPageType_Machine
39};
40
41/* Global settings data wrapper: */
42struct UISettingsDataGlobal
43{
44 UISettingsDataGlobal() {}
45 UISettingsDataGlobal(const CSystemProperties &properties, const VBoxGlobalSettings &settings)
46 : m_properties(properties), m_settings(settings) {}
47 CSystemProperties m_properties;
48 VBoxGlobalSettings m_settings;
49};
50Q_DECLARE_METATYPE(UISettingsDataGlobal);
51
52/* Machine settings data wrapper: */
53struct UISettingsDataMachine
54{
55 UISettingsDataMachine() {}
56 UISettingsDataMachine(const CMachine &machine)
57 : m_machine(machine) {}
58 CMachine m_machine;
59};
60Q_DECLARE_METATYPE(UISettingsDataMachine);
61
62/* Settings page base class: */
63class UISettingsPage : public QIWithRetranslateUI<QWidget>
64{
65 Q_OBJECT;
66
67public:
68
69 /* Load data to cashe from corresponding external object(s),
70 * this task COULD be performed in other than GUI thread: */
71 virtual void loadToCacheFrom(QVariant &data) = 0;
72 /* Load data to corresponding widgets from cache,
73 * this task SHOULD be performed in GUI thread only: */
74 virtual void getFromCache() = 0;
75
76 /* Save data from corresponding widgets to cache,
77 * this task SHOULD be performed in GUI thread only: */
78 virtual void putToCache() = 0;
79 /* Save data from cache to corresponding external object(s),
80 * this task COULD be performed in other than GUI thread: */
81 virtual void saveFromCacheTo(QVariant &data) = 0;
82
83 /* Returns settings page type: */
84 virtual UISettingsPageType type() const;
85
86 /* Validation stuff: */
87 virtual void setValidator(QIWidgetValidator *pValidator);
88 virtual bool revalidate(QString &strWarningText, QString &strTitle);
89
90 /* Navigation stuff: */
91 virtual void setOrderAfter(QWidget *pWidget);
92
93 /* Page 'ID' stuff: */
94 int id() const;
95 void setId(int cId);
96
97 /* Page 'processed' stuff: */
98 bool processed() const;
99 void setProcessed(bool fProcessed);
100
101 /* Page 'failed' stuff: */
102 bool failed() const;
103 void setFailed(bool fFailed);
104
105protected:
106
107 /* Settings page constructor, hidden: */
108 UISettingsPage(UISettingsPageType type, QWidget *pParent = 0);
109
110 /* Variables: */
111 UISettingsPageType m_type;
112 int m_cId;
113 bool m_fProcessed;
114 bool m_fFailed;
115 QWidget *m_pFirstWidget;
116};
117
118/* Global settings page class: */
119class UISettingsPageGlobal : public UISettingsPage
120{
121 Q_OBJECT;
122
123protected:
124
125 /* Fetch data to m_properties & m_settings: */
126 void fetchData(const QVariant &data);
127
128 /* Upload m_properties & m_settings to data: */
129 void uploadData(QVariant &data) const;
130
131 /* Global settings page constructor, hidden: */
132 UISettingsPageGlobal(QWidget *pParent = 0);
133
134 /* Global data source: */
135 CSystemProperties m_properties;
136 VBoxGlobalSettings m_settings;
137};
138
139/* Machine settings page class: */
140class UISettingsPageMachine : public UISettingsPage
141{
142 Q_OBJECT;
143
144protected:
145
146 /* Fetch data to m_machine: */
147 void fetchData(const QVariant &data);
148
149 /* Upload m_machine to data: */
150 void uploadData(QVariant &data) const;
151
152 /* Machine settings page constructor, hidden: */
153 UISettingsPageMachine(QWidget *pParent = 0);
154
155 /* Machine data source: */
156 CMachine m_machine;
157};
158
159#endif // __UISettingsPage_h__
160
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use