VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerSettingsPanel.cpp@ 75761

Last change on this file since 75761 was 75761, checked in by vboxsync, 6 years ago

FE/Qt: bugref:6699. Some tranlation and style corrections

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.4 KB
Line 
1/* $Id: UIGuestControlFileManagerSettingsPanel.cpp 75761 2018-11-27 09:10:13Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UIVMLogViewer class implementation.
4 */
5
6/*
7 * Copyright (C) 2010-2018 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifdef VBOX_WITH_PRECOMPILED_HEADERS
19# include <precomp.h>
20#else /* !VBOX_WITH_PRECOMPILED_HEADERS */
21
22/* Qt includes: */
23# include <QComboBox>
24# include <QHBoxLayout>
25# include <QFontDatabase>
26# include <QFontDialog>
27# include <QCheckBox>
28# include <QLabel>
29# include <QSpinBox>
30
31/* GUI includes: */
32# include "QIToolButton.h"
33# include "UIIconPool.h"
34# include "UIGuestControlFileManager.h"
35# include "UIGuestControlFileManagerSettingsPanel.h"
36
37#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
38
39UIGuestControlFileManagerSettingsPanel::UIGuestControlFileManagerSettingsPanel(UIGuestControlFileManager *pManagerWidget,
40 QWidget *pParent, UIGuestControlFileManagerSettings *pFileManagerSettings)
41 : UIGuestControlFileManagerPanel(pManagerWidget, pParent)
42 , m_pListDirectoriesOnTopCheckBox(0)
43 , m_pDeleteConfirmationCheckBox(0)
44 , m_pHumanReabableSizesCheckBox(0)
45 , m_pFileManagerSettings(pFileManagerSettings)
46{
47 prepare();
48}
49
50QString UIGuestControlFileManagerSettingsPanel::panelName() const
51{
52 return "SettingsPanel";
53}
54
55void UIGuestControlFileManagerSettingsPanel::update()
56{
57 if (!m_pFileManagerSettings)
58 return;
59
60 if (m_pListDirectoriesOnTopCheckBox)
61 {
62 m_pListDirectoriesOnTopCheckBox->blockSignals(true);
63 m_pListDirectoriesOnTopCheckBox->setChecked(m_pFileManagerSettings->bListDirectoriesOnTop);
64 m_pListDirectoriesOnTopCheckBox->blockSignals(false);
65 }
66
67 if (m_pDeleteConfirmationCheckBox)
68 {
69 m_pDeleteConfirmationCheckBox->blockSignals(true);
70 m_pDeleteConfirmationCheckBox->setChecked(m_pFileManagerSettings->bAskDeleteConfirmation);
71 m_pDeleteConfirmationCheckBox->blockSignals(false);
72 }
73
74 if (m_pHumanReabableSizesCheckBox)
75 {
76 m_pHumanReabableSizesCheckBox->blockSignals(true);
77 m_pHumanReabableSizesCheckBox->setChecked(m_pFileManagerSettings->bShowHumanReadableSizes);
78 m_pHumanReabableSizesCheckBox->blockSignals(false);
79 }
80}
81
82void UIGuestControlFileManagerSettingsPanel::prepareWidgets()
83{
84 if (!mainLayout())
85 return;
86
87 m_pListDirectoriesOnTopCheckBox = new QCheckBox;
88 if (m_pListDirectoriesOnTopCheckBox)
89 {
90 mainLayout()->addWidget(m_pListDirectoriesOnTopCheckBox, 0, Qt::AlignLeft);
91 }
92
93 m_pDeleteConfirmationCheckBox = new QCheckBox;
94 if (m_pDeleteConfirmationCheckBox)
95 {
96 mainLayout()->addWidget(m_pDeleteConfirmationCheckBox, 0, Qt::AlignLeft);
97 }
98
99 m_pHumanReabableSizesCheckBox = new QCheckBox;
100 if (m_pHumanReabableSizesCheckBox)
101 {
102 mainLayout()->addWidget(m_pHumanReabableSizesCheckBox, 0, Qt::AlignLeft);
103 }
104 /* Set initial checkbox status wrt. settings: */
105 if (m_pFileManagerSettings)
106 {
107 if (m_pListDirectoriesOnTopCheckBox)
108 m_pListDirectoriesOnTopCheckBox->setChecked(m_pFileManagerSettings->bListDirectoriesOnTop);
109 if (m_pDeleteConfirmationCheckBox)
110 m_pDeleteConfirmationCheckBox->setChecked(m_pFileManagerSettings->bAskDeleteConfirmation);
111 if (m_pHumanReabableSizesCheckBox)
112 m_pHumanReabableSizesCheckBox->setChecked(m_pFileManagerSettings->bShowHumanReadableSizes);
113 }
114 retranslateUi();
115 mainLayout()->addStretch(2);
116}
117
118void UIGuestControlFileManagerSettingsPanel::sltListDirectoryCheckBoxToogled(bool bChecked)
119{
120 if (!m_pFileManagerSettings)
121 return;
122 m_pFileManagerSettings->bListDirectoriesOnTop = bChecked;
123 emit sigSettingsChanged();
124}
125
126void UIGuestControlFileManagerSettingsPanel::sltDeleteConfirmationCheckBoxToogled(bool bChecked)
127{
128 if (!m_pFileManagerSettings)
129 return;
130 m_pFileManagerSettings->bAskDeleteConfirmation = bChecked;
131 emit sigSettingsChanged();
132}
133
134void UIGuestControlFileManagerSettingsPanel::sltHumanReabableSizesCheckBoxToogled(bool bChecked)
135{
136 if (!m_pFileManagerSettings)
137 return;
138 m_pFileManagerSettings->bShowHumanReadableSizes = bChecked;
139 emit sigSettingsChanged();
140}
141
142void UIGuestControlFileManagerSettingsPanel::prepareConnections()
143{
144 if (m_pListDirectoriesOnTopCheckBox)
145 connect(m_pListDirectoriesOnTopCheckBox, &QCheckBox::toggled,
146 this, &UIGuestControlFileManagerSettingsPanel::sltListDirectoryCheckBoxToogled);
147 if (m_pDeleteConfirmationCheckBox)
148 connect(m_pDeleteConfirmationCheckBox, &QCheckBox::toggled,
149 this, &UIGuestControlFileManagerSettingsPanel::sltDeleteConfirmationCheckBoxToogled);
150 if (m_pHumanReabableSizesCheckBox)
151 connect(m_pHumanReabableSizesCheckBox, &QCheckBox::toggled,
152 this, &UIGuestControlFileManagerSettingsPanel::sltHumanReabableSizesCheckBoxToogled);
153}
154
155void UIGuestControlFileManagerSettingsPanel::retranslateUi()
156{
157 UIGuestControlFileManagerPanel::retranslateUi();
158 if (m_pListDirectoriesOnTopCheckBox)
159 {
160 m_pListDirectoriesOnTopCheckBox->setText(UIGuestControlFileManager::tr("List directories on top"));
161 m_pListDirectoriesOnTopCheckBox->setToolTip(UIGuestControlFileManager::tr("List directories before files"));
162 }
163
164 if (m_pDeleteConfirmationCheckBox)
165 {
166 m_pDeleteConfirmationCheckBox->setText(UIGuestControlFileManager::tr("Ask before delete"));
167 m_pDeleteConfirmationCheckBox->setToolTip(UIGuestControlFileManager::tr("Show a confirmation dialog "
168 "before deleting files and directories"));
169 }
170
171 if (m_pHumanReabableSizesCheckBox)
172 {
173 m_pHumanReabableSizesCheckBox->setText(UIGuestControlFileManager::tr("Human readable sizes"));
174 m_pHumanReabableSizesCheckBox->setToolTip(UIGuestControlFileManager::tr("Show file/directory sizes in human "
175 "readable format rather than in bytes"));
176 }
177}
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