1
/* $Id: UIGlobalSettingsGeneral.cpp 33926 2010-11-10 09:02:39Z vboxsync $ */
4
* VBox frontends: Qt4 GUI ("VirtualBox"):
5
* UIGlobalSettingsGeneral class implementation
9
* Copyright (C) 2006-2010 Oracle Corporation
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.
24
#include "UIGlobalSettingsGeneral.h"
25
#include "VBoxGlobal.h"
27
/* General page constructor: */
28
UIGlobalSettingsGeneral::UIGlobalSettingsGeneral()
30
/* Apply UI decorations: */
31
Ui::UIGlobalSettingsGeneral::setupUi(this);
33
#ifndef VBOX_GUI_WITH_SYSTRAY
34
m_pEnableTrayIconCheckbox->hide();
35
m_pSpacerWidget1->hide();
36
#endif /* !VBOX_GUI_WITH_SYSTRAY */
38
m_pEnablePresentationModeCheckbox->hide();
39
m_pSpacerWidget2->hide();
40
#endif /* !Q_WS_MAC */
41
//#ifndef Q_WS_WIN /* Checkbox hidden for now! */
42
m_pDisableHostScreenSaverCheckbox->hide();
43
m_pSpacerWidget3->hide();
44
//#endif /* !Q_WS_WIN */
46
/* If all checkboxes hidden, hide separator too: */
47
if (m_pEnableTrayIconCheckbox->isHidden() &&
48
m_pEnablePresentationModeCheckbox->isHidden() &&
49
m_pDisableHostScreenSaverCheckbox->isHidden())
50
m_pLineSeparator2->hide();
53
m_pMachineFolderSelector->setHomeDir(vboxGlobal().virtualBox().GetHomeFolder());
54
m_pVRDPLibNameSelector->setHomeDir(vboxGlobal().virtualBox().GetHomeFolder());
55
m_pVRDPLibNameSelector->setMode(VBoxFilePathSelectorWidget::Mode_File_Open);
57
/* Apply language settings: */
61
/* Load data to cashe from corresponding external object(s),
62
* this task COULD be performed in other than GUI thread: */
63
void UIGlobalSettingsGeneral::loadToCacheFrom(QVariant &data)
65
/* Fetch data to properties & settings: */
66
UISettingsPageGlobal::fetchData(data);
69
m_cache.m_strDefaultMachineFolder = m_properties.GetDefaultMachineFolder();
70
m_cache.m_strVRDEAuthLibrary = m_properties.GetVRDEAuthLibrary();
71
m_cache.m_fTrayIconEnabled = m_settings.trayIconEnabled();
73
m_cache.m_fPresentationModeEnabled = m_settings.presentationModeEnabled();
75
m_cache.m_fHostScreenSaverDisables = m_settings.hostScreenSaverDisabled();
77
/* Upload properties & settings to data: */
78
UISettingsPageGlobal::uploadData(data);
81
/* Load data to corresponding widgets from cache,
82
* this task SHOULD be performed in GUI thread only: */
83
void UIGlobalSettingsGeneral::getFromCache()
85
/* Fetch from cache: */
86
m_pMachineFolderSelector->setPath(m_cache.m_strDefaultMachineFolder);
87
m_pVRDPLibNameSelector->setPath(m_cache.m_strVRDEAuthLibrary);
88
m_pEnableTrayIconCheckbox->setChecked(m_cache.m_fTrayIconEnabled);
90
m_pEnablePresentationModeCheckbox->setChecked(m_cache.m_fPresentationModeEnabled);
92
m_pDisableHostScreenSaverCheckbox->setChecked(m_cache.m_fHostScreenSaverDisables);
95
/* Save data from corresponding widgets to cache,
96
* this task SHOULD be performed in GUI thread only: */
97
void UIGlobalSettingsGeneral::putToCache()
99
/* Upload to cache: */
100
m_cache.m_strDefaultMachineFolder = m_pMachineFolderSelector->path();
101
m_cache.m_strVRDEAuthLibrary = m_pVRDPLibNameSelector->path();
102
m_cache.m_fTrayIconEnabled = m_pEnableTrayIconCheckbox->isChecked();
104
m_cache.m_fPresentationModeEnabled = m_pEnablePresentationModeCheckbox->isChecked();
105
#endif /* Q_WS_MAC */
106
m_cache.m_fHostScreenSaverDisables = m_pDisableHostScreenSaverCheckbox->isChecked();
109
/* Save data from cache to corresponding external object(s),
110
* this task COULD be performed in other than GUI thread: */
111
void UIGlobalSettingsGeneral::saveFromCacheTo(QVariant &data)
113
/* Fetch data to properties & settings: */
114
UISettingsPageGlobal::fetchData(data);
116
/* Save from cache: */
117
if (m_properties.isOk() && m_pMachineFolderSelector->isModified())
118
m_properties.SetDefaultMachineFolder(m_cache.m_strDefaultMachineFolder);
119
if (m_properties.isOk() && m_pVRDPLibNameSelector->isModified())
120
m_properties.SetVRDEAuthLibrary(m_cache.m_strVRDEAuthLibrary);
121
m_settings.setTrayIconEnabled(m_cache.m_fTrayIconEnabled);
123
m_settings.setPresentationModeEnabled(m_cache.m_fPresentationModeEnabled);
124
#endif /* Q_WS_MAC */
125
m_settings.setHostScreenSaverDisabled(m_cache.m_fHostScreenSaverDisables);
127
/* Upload properties & settings to data: */
128
UISettingsPageGlobal::uploadData(data);
131
/* Navigation stuff: */
132
void UIGlobalSettingsGeneral::setOrderAfter(QWidget *pWidget)
134
setTabOrder(pWidget, m_pMachineFolderSelector);
135
setTabOrder(m_pMachineFolderSelector, m_pVRDPLibNameSelector);
136
setTabOrder(m_pVRDPLibNameSelector, m_pEnableTrayIconCheckbox);
137
setTabOrder(m_pEnableTrayIconCheckbox, m_pEnablePresentationModeCheckbox);
138
setTabOrder(m_pEnablePresentationModeCheckbox, m_pDisableHostScreenSaverCheckbox);
141
/* Translation stuff: */
142
void UIGlobalSettingsGeneral::retranslateUi()
144
/* Translate uic generated strings: */
145
Ui::UIGlobalSettingsGeneral::retranslateUi(this);
147
m_pMachineFolderSelector->setWhatsThis(tr("Displays the path to the default virtual "
148
"machine folder. This folder is used, if not "
149
"explicitly specified otherwise, when creating "
150
"new virtual machines."));
151
m_pVRDPLibNameSelector->setWhatsThis(tr("Displays the path to the library that "
152
"provides authentication for Remote Display "