VirtualBox

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

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

FE/Qt: bugref:6699. Misc. improvements in guest control file manager

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.2 KB
Line 
1/* $Id: UIGuestControlFileManagerSettingsPanel.cpp 75480 2018-11-15 12:26:08Z 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::prepareWidgets()
56{
57 if (!mainLayout())
58 return;
59
60 m_pListDirectoriesOnTopCheckBox = new QCheckBox;
61 if (m_pListDirectoriesOnTopCheckBox)
62 {
63 mainLayout()->addWidget(m_pListDirectoriesOnTopCheckBox, 0, Qt::AlignLeft);
64 }
65
66 m_pDeleteConfirmationCheckBox = new QCheckBox;
67 if (m_pDeleteConfirmationCheckBox)
68 {
69 mainLayout()->addWidget(m_pDeleteConfirmationCheckBox, 0, Qt::AlignLeft);
70 }
71
72 m_pHumanReabableSizesCheckBox = new QCheckBox;
73 if (m_pHumanReabableSizesCheckBox)
74 {
75 mainLayout()->addWidget(m_pHumanReabableSizesCheckBox, 0, Qt::AlignLeft);
76 }
77 /* Set initial checkbox status wrt. settings: */
78 if (m_pFileManagerSettings)
79 {
80 if (m_pListDirectoriesOnTopCheckBox)
81 m_pListDirectoriesOnTopCheckBox->setChecked(m_pFileManagerSettings->bListDirectoriesOnTop);
82 if (m_pDeleteConfirmationCheckBox)
83 m_pDeleteConfirmationCheckBox->setChecked(m_pFileManagerSettings->bAskDeleteConfirmation);
84 if (m_pHumanReabableSizesCheckBox)
85 m_pHumanReabableSizesCheckBox->setChecked(m_pFileManagerSettings->bShowHumanReadableSizes);
86 }
87 retranslateUi();
88 mainLayout()->addStretch(2);
89}
90
91void UIGuestControlFileManagerSettingsPanel::sltListDirectoryCheckBoxToogled(bool bChecked)
92{
93 if (!m_pFileManagerSettings)
94 return;
95 m_pFileManagerSettings->bListDirectoriesOnTop = bChecked;
96 emit sigSettingsChanged();
97}
98
99void UIGuestControlFileManagerSettingsPanel::sltDeleteConfirmationCheckBoxToogled(bool bChecked)
100{
101 if (!m_pFileManagerSettings)
102 return;
103 m_pFileManagerSettings->bAskDeleteConfirmation = bChecked;
104 emit sigSettingsChanged();
105}
106
107void UIGuestControlFileManagerSettingsPanel::sltHumanReabableSizesCheckBoxToogled(bool bChecked)
108{
109 if (!m_pFileManagerSettings)
110 return;
111 m_pFileManagerSettings->bShowHumanReadableSizes = bChecked;
112 emit sigSettingsChanged();
113}
114
115void UIGuestControlFileManagerSettingsPanel::prepareConnections()
116{
117 if (m_pListDirectoriesOnTopCheckBox)
118 connect(m_pListDirectoriesOnTopCheckBox, &QCheckBox::toggled,
119 this, &UIGuestControlFileManagerSettingsPanel::sltListDirectoryCheckBoxToogled);
120 if (m_pDeleteConfirmationCheckBox)
121 connect(m_pDeleteConfirmationCheckBox, &QCheckBox::toggled,
122 this, &UIGuestControlFileManagerSettingsPanel::sltDeleteConfirmationCheckBoxToogled);
123 if (m_pHumanReabableSizesCheckBox)
124 connect(m_pHumanReabableSizesCheckBox, &QCheckBox::toggled,
125 this, &UIGuestControlFileManagerSettingsPanel::sltHumanReabableSizesCheckBoxToogled);
126}
127
128void UIGuestControlFileManagerSettingsPanel::retranslateUi()
129{
130 UIGuestControlFileManagerPanel::retranslateUi();
131 if (m_pListDirectoriesOnTopCheckBox)
132 {
133 m_pListDirectoriesOnTopCheckBox->setText(UIGuestControlFileManager::tr("List directories on top"));
134 m_pListDirectoriesOnTopCheckBox->setToolTip(UIGuestControlFileManager::tr("List directories before files"));
135 }
136
137 if (m_pDeleteConfirmationCheckBox)
138 {
139 m_pDeleteConfirmationCheckBox->setText(UIGuestControlFileManager::tr("Ask before delete"));
140 m_pDeleteConfirmationCheckBox->setToolTip(UIGuestControlFileManager::tr("List directories before files"));
141 }
142
143 if (m_pHumanReabableSizesCheckBox)
144 {
145 m_pHumanReabableSizesCheckBox->setText(UIGuestControlFileManager::tr("Human readable sizes"));
146 m_pHumanReabableSizesCheckBox->setToolTip(UIGuestControlFileManager::tr("List directories before files"));
147 }
148}
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