VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp@ 47130

Last change on this file since 47130 was 47130, checked in by vboxsync, 11 years ago

FE/Qt: Global preferences: General page cleanup/rework.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Revision Author Id
File size: 4.6 KB
Line 
1/* $Id: UIGlobalSettingsGeneral.cpp 47130 2013-07-13 17:13:57Z vboxsync $ */
2/** @file
3 *
4 * VBox frontends: Qt4 GUI ("VirtualBox"):
5 * UIGlobalSettingsGeneral class implementation
6 */
7
8/*
9 * Copyright (C) 2006-2013 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20/* Global includes */
21#include <QDir>
22
23/* Local includes */
24#include "UIGlobalSettingsGeneral.h"
25#include "VBoxGlobal.h"
26
27/* General page constructor: */
28UIGlobalSettingsGeneral::UIGlobalSettingsGeneral()
29{
30 /* Apply UI decorations: */
31 Ui::UIGlobalSettingsGeneral::setupUi(this);
32
33#ifndef Q_WS_MAC
34 m_pPresentationModeLabel->hide();
35 m_pPresentationModeCheckbox->hide();
36#endif /* !Q_WS_MAC */
37 /* Hide checkbox for now: */
38 m_pHostScreenSaverLabel->hide();
39 m_pHostScreenSaverCheckbox->hide();
40
41 /* Setup widgets: */
42 m_pMachineFolderSelector->setHomeDir(vboxGlobal().virtualBox().GetHomeFolder());
43 m_pVRDPLibNameSelector->setHomeDir(vboxGlobal().virtualBox().GetHomeFolder());
44 m_pVRDPLibNameSelector->setMode(VBoxFilePathSelectorWidget::Mode_File_Open);
45
46 /* Apply language settings: */
47 retranslateUi();
48}
49
50/* Load data to cache from corresponding external object(s),
51 * this task COULD be performed in other than GUI thread: */
52void UIGlobalSettingsGeneral::loadToCacheFrom(QVariant &data)
53{
54 /* Fetch data to properties & settings: */
55 UISettingsPageGlobal::fetchData(data);
56
57 /* Load to cache: */
58 m_cache.m_strDefaultMachineFolder = m_properties.GetDefaultMachineFolder();
59 m_cache.m_strVRDEAuthLibrary = m_properties.GetVRDEAuthLibrary();
60#ifdef Q_WS_MAC
61 m_cache.m_fPresentationModeEnabled = m_settings.presentationModeEnabled();
62#endif /* Q_WS_MAC */
63 m_cache.m_fHostScreenSaverDisabled = m_settings.hostScreenSaverDisabled();
64
65 /* Upload properties & settings to data: */
66 UISettingsPageGlobal::uploadData(data);
67}
68
69/* Load data to corresponding widgets from cache,
70 * this task SHOULD be performed in GUI thread only: */
71void UIGlobalSettingsGeneral::getFromCache()
72{
73 /* Fetch from cache: */
74 m_pMachineFolderSelector->setPath(m_cache.m_strDefaultMachineFolder);
75 m_pVRDPLibNameSelector->setPath(m_cache.m_strVRDEAuthLibrary);
76#ifdef Q_WS_MAC
77 m_pPresentationModeCheckbox->setChecked(m_cache.m_fPresentationModeEnabled);
78#endif /* Q_WS_MAC */
79 m_pHostScreenSaverCheckbox->setChecked(m_cache.m_fHostScreenSaverDisabled);
80}
81
82/* Save data from corresponding widgets to cache,
83 * this task SHOULD be performed in GUI thread only: */
84void UIGlobalSettingsGeneral::putToCache()
85{
86 /* Upload to cache: */
87 m_cache.m_strDefaultMachineFolder = m_pMachineFolderSelector->path();
88 m_cache.m_strVRDEAuthLibrary = m_pVRDPLibNameSelector->path();
89#ifdef Q_WS_MAC
90 m_cache.m_fPresentationModeEnabled = m_pPresentationModeCheckbox->isChecked();
91#endif /* Q_WS_MAC */
92 m_cache.m_fHostScreenSaverDisabled = m_pHostScreenSaverCheckbox->isChecked();
93}
94
95/* Save data from cache to corresponding external object(s),
96 * this task COULD be performed in other than GUI thread: */
97void UIGlobalSettingsGeneral::saveFromCacheTo(QVariant &data)
98{
99 /* Fetch data to properties & settings: */
100 UISettingsPageGlobal::fetchData(data);
101
102 /* Save from cache: */
103 if (m_properties.isOk() && m_pMachineFolderSelector->isModified())
104 m_properties.SetDefaultMachineFolder(m_cache.m_strDefaultMachineFolder);
105 if (m_properties.isOk() && m_pVRDPLibNameSelector->isModified())
106 m_properties.SetVRDEAuthLibrary(m_cache.m_strVRDEAuthLibrary);
107#ifdef Q_WS_MAC
108 m_settings.setPresentationModeEnabled(m_cache.m_fPresentationModeEnabled);
109#endif /* Q_WS_MAC */
110 m_settings.setHostScreenSaverDisabled(m_cache.m_fHostScreenSaverDisabled);
111
112 /* Upload properties & settings to data: */
113 UISettingsPageGlobal::uploadData(data);
114}
115
116/* Navigation stuff: */
117void UIGlobalSettingsGeneral::setOrderAfter(QWidget *pWidget)
118{
119 setTabOrder(pWidget, m_pMachineFolderSelector);
120 setTabOrder(m_pMachineFolderSelector, m_pVRDPLibNameSelector);
121 setTabOrder(m_pVRDPLibNameSelector, m_pPresentationModeCheckbox);
122 setTabOrder(m_pPresentationModeCheckbox, m_pHostScreenSaverCheckbox);
123}
124
125/* Translation stuff: */
126void UIGlobalSettingsGeneral::retranslateUi()
127{
128 /* Translate uic generated strings: */
129 Ui::UIGlobalSettingsGeneral::retranslateUi(this);
130}
131
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