Changeset 85645 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Aug 7, 2020 6:04:37 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro
r85643 r85645 41 41 src/settings/machine/UIMachineSettingsUSB.ui \ 42 42 src/settings/machine/UIMachineSettingsUSBFilterDetails.ui \ 43 src/settings/machine/UIMachineSettingsSFDetails.ui \44 43 src/settings/machine/UIMachineSettingsInterface.ui 45 44 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
r85643 r85645 20 20 #include <QMenu> 21 21 #include <QTimer> 22 #include <QVBoxLayout> 22 23 23 24 /* GUI includes: */ … … 693 694 if (objectName().isEmpty()) 694 695 setObjectName(QStringLiteral("UIMachineSettingsSF")); 695 resize(300, 22 8);696 resize(300, 220); 696 697 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 697 698 pMainLayout->setObjectName(QStringLiteral("pMainLayout")); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.cpp
r82968 r85645 17 17 18 18 /* Qt includes */ 19 #include <QCheckBox> 19 20 #include <QDir> 21 #include <QGridLayout> 22 #include <QLabel> 23 #include <QLineEdit> 20 24 #include <QPushButton> 21 25 22 /* Other includes */ 26 /* GUI includes */ 27 #include "QIDialogButtonBox.h" 28 #include "UIFilePathSelector.h" 23 29 #include "UIMachineSettingsSFDetails.h" 24 30 #include "UICommon.h" … … 29 35 const QStringList &usedNames, 30 36 QWidget *pParent /* = 0 */) 31 : QIWithRetranslateUI2<QIDialog>(pParent) 32 , m_type(type) 33 , m_fUsePermanent(fEnableSelector) 34 , m_usedNames(usedNames) 35 { 36 /* Apply UI decorations: */ 37 Ui::UIMachineSettingsSFDetails::setupUi(this); 37 : QIWithRetranslateUI2<QIDialog>(pParent) 38 , m_type(type) 39 , m_fUsePermanent(fEnableSelector) 40 , m_usedNames(usedNames) 41 , m_pPathSelector(0) 42 , m_pPermanentCheckBox(0) 43 , m_pNameLineEdit(0) 44 , m_pReadonlyCheckBox(0) 45 , m_pAutoMountCheckBox(0) 46 , m_pAutoMountPointLineEdit(0) 47 , m_pPathLabel(0) 48 , m_pNameLabel(0) 49 , m_pAutoMountPointLabel(0) 50 , m_pButtonBox(0) 51 { 52 prepareWidgets(); 38 53 39 54 /* Setup widgets: */ 40 m PsPath->setResetEnabled(false);41 m PsPath->setHomeDir(QDir::homePath());42 m CbPermanent->setHidden(!fEnableSelector);55 m_pPathSelector->setResetEnabled(false); 56 m_pPathSelector->setHomeDir(QDir::homePath()); 57 m_pPermanentCheckBox->setHidden(!fEnableSelector); 43 58 44 59 /* Setup connections: */ 45 connect(m PsPath, static_cast<void(UIFilePathSelector::*)(int)>(&UIFilePathSelector::currentIndexChanged),60 connect(m_pPathSelector, static_cast<void(UIFilePathSelector::*)(int)>(&UIFilePathSelector::currentIndexChanged), 46 61 this, &UIMachineSettingsSFDetails::sltSelectPath); 47 connect(m PsPath, &UIFilePathSelector::pathChanged, this, &UIMachineSettingsSFDetails::sltSelectPath);48 connect(m LeName, &QLineEdit::textChanged, this, &UIMachineSettingsSFDetails::sltValidate);62 connect(m_pPathSelector, &UIFilePathSelector::pathChanged, this, &UIMachineSettingsSFDetails::sltSelectPath); 63 connect(m_pNameLineEdit, &QLineEdit::textChanged, this, &UIMachineSettingsSFDetails::sltValidate); 49 64 if (fEnableSelector) 50 connect(m CbPermanent, &QCheckBox::toggled, this, &UIMachineSettingsSFDetails::sltValidate);65 connect(m_pPermanentCheckBox, &QCheckBox::toggled, this, &UIMachineSettingsSFDetails::sltValidate); 51 66 52 67 /* Applying language settings: */ … … 65 80 } 66 81 82 void UIMachineSettingsSFDetails::prepareWidgets() 83 { 84 if (objectName().isEmpty()) 85 setObjectName(QStringLiteral("UIMachineSettingsSFDetails")); 86 resize(218, 196); 87 QGridLayout *gridLayout = new QGridLayout(this); 88 gridLayout->setObjectName(QStringLiteral("gridLayout")); 89 m_pPathLabel = new QLabel; 90 m_pPathLabel->setObjectName(QStringLiteral("m_pPathLabel")); 91 m_pPathLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 92 93 gridLayout->addWidget(m_pPathLabel, 0, 0, 1, 1); 94 95 m_pPathSelector = new UIFilePathSelector; 96 m_pPathSelector->setObjectName(QStringLiteral("m_pPathSelector")); 97 gridLayout->addWidget(m_pPathSelector, 0, 1, 1, 1); 98 99 m_pNameLabel = new QLabel; 100 m_pNameLabel->setObjectName(QStringLiteral("m_pNameLabel")); 101 m_pNameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 102 gridLayout->addWidget(m_pNameLabel, 1, 0, 1, 1); 103 104 m_pNameLineEdit = new QLineEdit; 105 m_pNameLineEdit->setObjectName(QStringLiteral("m_pNameLineEdit")); 106 gridLayout->addWidget(m_pNameLineEdit, 1, 1, 1, 1); 107 108 m_pReadonlyCheckBox = new QCheckBox; 109 m_pReadonlyCheckBox->setObjectName(QStringLiteral("m_pReadonlyCheckBox")); 110 gridLayout->addWidget(m_pReadonlyCheckBox, 2, 1, 1, 1); 111 112 m_pAutoMountCheckBox = new QCheckBox; 113 m_pAutoMountCheckBox->setObjectName(QStringLiteral("m_pAutoMountCheckBox")); 114 gridLayout->addWidget(m_pAutoMountCheckBox, 3, 1, 1, 1); 115 116 m_pAutoMountPointLabel = new QLabel; 117 m_pAutoMountPointLabel->setObjectName(QStringLiteral("m_pAutoMountPointLabel")); 118 m_pAutoMountPointLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 119 gridLayout->addWidget(m_pAutoMountPointLabel, 4, 0, 1, 1); 120 121 m_pAutoMountPointLineEdit = new QLineEdit; 122 m_pAutoMountPointLineEdit->setObjectName(QStringLiteral("m_pAutoMountPointLineEdit")); 123 gridLayout->addWidget(m_pAutoMountPointLineEdit, 4, 1, 1, 1); 124 125 m_pPermanentCheckBox = new QCheckBox; 126 m_pPermanentCheckBox->setObjectName(QStringLiteral("m_pPermanentCheckBox")); 127 gridLayout->addWidget(m_pPermanentCheckBox, 5, 1, 1, 1); 128 129 QSpacerItem *spacerItem = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); 130 gridLayout->addItem(spacerItem, 6, 1, 1, 1); 131 132 m_pButtonBox = new QIDialogButtonBox; 133 m_pButtonBox->setObjectName(QStringLiteral("m_pButtonBox")); 134 m_pButtonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok); 135 gridLayout->addWidget(m_pButtonBox, 7, 0, 1, 2); 136 137 138 QObject::connect(m_pButtonBox, &QIDialogButtonBox::accepted, this, &UIMachineSettingsSFDetails::accept); 139 QObject::connect(m_pButtonBox, &QIDialogButtonBox::rejected, this, &UIMachineSettingsSFDetails::reject); 140 } 141 142 67 143 void UIMachineSettingsSFDetails::setPath(const QString &strPath) 68 144 { 69 m PsPath->setPath(strPath);145 m_pPathSelector->setPath(strPath); 70 146 } 71 147 72 148 QString UIMachineSettingsSFDetails::path() const 73 149 { 74 return m PsPath->path();150 return m_pPathSelector->path(); 75 151 } 76 152 77 153 void UIMachineSettingsSFDetails::setName(const QString &strName) 78 154 { 79 m LeName->setText(strName);155 m_pNameLineEdit->setText(strName); 80 156 } 81 157 82 158 QString UIMachineSettingsSFDetails::name() const 83 159 { 84 return m LeName->text();160 return m_pNameLineEdit->text(); 85 161 } 86 162 87 163 void UIMachineSettingsSFDetails::setWriteable(bool fWritable) 88 164 { 89 m CbReadonly->setChecked(!fWritable);165 m_pReadonlyCheckBox->setChecked(!fWritable); 90 166 } 91 167 92 168 bool UIMachineSettingsSFDetails::isWriteable() const 93 169 { 94 return !m CbReadonly->isChecked();170 return !m_pReadonlyCheckBox->isChecked(); 95 171 } 96 172 97 173 void UIMachineSettingsSFDetails::setAutoMount(bool fAutoMount) 98 174 { 99 m CbAutoMount->setChecked(fAutoMount);175 m_pAutoMountCheckBox->setChecked(fAutoMount); 100 176 } 101 177 102 178 bool UIMachineSettingsSFDetails::isAutoMounted() const 103 179 { 104 return m CbAutoMount->isChecked();180 return m_pAutoMountCheckBox->isChecked(); 105 181 } 106 182 107 183 void UIMachineSettingsSFDetails::setAutoMountPoint(const QString &strAutoMountPoint) 108 184 { 109 m LeAutoMountPoint->setText(strAutoMountPoint);185 m_pAutoMountPointLineEdit->setText(strAutoMountPoint); 110 186 } 111 187 112 188 QString UIMachineSettingsSFDetails::autoMountPoint() const 113 189 { 114 return m LeAutoMountPoint->text();190 return m_pAutoMountPointLineEdit->text(); 115 191 } 116 192 117 193 void UIMachineSettingsSFDetails::setPermanent(bool fPermanent) 118 194 { 119 m CbPermanent->setChecked(fPermanent);195 m_pPermanentCheckBox->setChecked(fPermanent); 120 196 } 121 197 122 198 bool UIMachineSettingsSFDetails::isPermanent() const 123 199 { 124 return m_fUsePermanent ? m CbPermanent->isChecked() : true;200 return m_fUsePermanent ? m_pPermanentCheckBox->isChecked() : true; 125 201 } 126 202 127 203 void UIMachineSettingsSFDetails::retranslateUi() 128 204 { 129 /* Translate uic generated strings: */ 130 Ui::UIMachineSettingsSFDetails::retranslateUi(this); 205 m_pPathLabel->setText(QApplication::translate("UIMachineSettingsSFDetails", "Folder Path:")); 206 m_pNameLabel->setText(QApplication::translate("UIMachineSettingsSFDetails", "Folder Name:")); 207 m_pNameLineEdit->setToolTip(QApplication::translate("UIMachineSettingsSFDetails", "Holds the name of the shared folder (as it will be seen by the guest OS).")); 208 m_pReadonlyCheckBox->setToolTip(QApplication::translate("UIMachineSettingsSFDetails", "When checked, the guest OS will not be able to write to the specified shared folder.")); 209 m_pReadonlyCheckBox->setText(QApplication::translate("UIMachineSettingsSFDetails", "&Read-only")); 210 m_pAutoMountCheckBox->setToolTip(QApplication::translate("UIMachineSettingsSFDetails", "When checked, the guest OS will try to automatically mount the shared folder on startup.")); 211 m_pAutoMountCheckBox->setText(QApplication::translate("UIMachineSettingsSFDetails", "&Auto-mount")); 212 m_pAutoMountPointLabel->setText(QApplication::translate("UIMachineSettingsSFDetails", "Mount point:")); 213 m_pAutoMountPointLineEdit->setToolTip(QApplication::translate("UIMachineSettingsSFDetails", "Where to automatically mount the folder in the guest. A drive letter (e.g. 'G:') for Windows and OS/2 guests, path for the others. If left empty the guest will pick something fitting.")); 214 m_pPermanentCheckBox->setToolTip(QApplication::translate("UIMachineSettingsSFDetails", "When checked, this shared folder will be permanent.")); 215 m_pPermanentCheckBox->setText(QApplication::translate("UIMachineSettingsSFDetails", "&Make Permanent")); 131 216 132 217 switch (m_type) … … 145 230 void UIMachineSettingsSFDetails::sltValidate() 146 231 { 147 m ButtonBox->button(QDialogButtonBox::Ok)->setEnabled(!mPsPath->path().isEmpty() &&148 QDir(m PsPath->path()).exists() &&149 !m LeName->text().trimmed().isEmpty() &&150 !m LeName->text().contains(" ") &&151 !m_usedNames.contains(m LeName->text()));232 m_pButtonBox->button(QDialogButtonBox::Ok)->setEnabled(!m_pPathSelector->path().isEmpty() && 233 QDir(m_pPathSelector->path()).exists() && 234 !m_pNameLineEdit->text().trimmed().isEmpty() && 235 !m_pNameLineEdit->text().contains(" ") && 236 !m_usedNames.contains(m_pNameLineEdit->text())); 152 237 } 153 238 154 239 void UIMachineSettingsSFDetails::sltSelectPath() 155 240 { 156 if (!m PsPath->isPathSelected())241 if (!m_pPathSelector->isPathSelected()) 157 242 return; 158 243 159 QString strFolderName(m PsPath->path());244 QString strFolderName(m_pPathSelector->path()); 160 245 #if defined (VBOX_WS_WIN) || defined (Q_OS_OS2) 161 246 if (strFolderName[0].isLetter() && strFolderName[1] == ':' && strFolderName[2] == 0) … … 164 249 * Append the trailing backslash to get a valid root path 'X:\': */ 165 250 strFolderName += "\\"; 166 m PsPath->setPath(strFolderName);251 m_pPathSelector->setPath(strFolderName); 167 252 } 168 253 #endif /* VBOX_WS_WIN || Q_OS_OS2 */ … … 171 256 { 172 257 /* Processing non-root folder */ 173 m LeName->setText(folder.dirName().replace(' ', '_'));258 m_pNameLineEdit->setText(folder.dirName().replace(' ', '_')); 174 259 } 175 260 else … … 177 262 /* Processing root folder: */ 178 263 #if defined (VBOX_WS_WIN) || defined (Q_OS_OS2) 179 m LeName->setText(strFolderName.toUpper()[0] + "_DRIVE");264 m_pNameLineEdit->setText(strFolderName.toUpper()[0] + "_DRIVE"); 180 265 #elif defined (VBOX_WS_X11) 181 m LeName->setText("ROOT");266 m_pNameLineEdit->setText("ROOT"); 182 267 #endif 183 268 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.h
r82968 r85645 23 23 24 24 /* Includes */ 25 #include "UIMachineSettingsSFDetails.gen.h"26 25 #include "QIDialog.h" 27 26 #include "QIWithRetranslateUI.h" 28 27 #include "UIMachineSettingsSF.h" 29 28 29 class UIFilePathSelector; 30 class QCheckBox; 31 class QLabel; 32 class QLineEdit; 33 class QIDialogButtonBox; 34 30 35 /* Shared folders details dialog: */ 31 class SHARED_LIBRARY_STUFF UIMachineSettingsSFDetails : public QIWithRetranslateUI2<QIDialog>, 32 public Ui::UIMachineSettingsSFDetails 36 class SHARED_LIBRARY_STUFF UIMachineSettingsSFDetails : public QIWithRetranslateUI2<QIDialog> 33 37 { 34 38 Q_OBJECT; … … 76 80 private: 77 81 82 void prepareWidgets(); 83 78 84 SFDialogType m_type; 79 85 bool m_fUsePermanent; 80 86 QStringList m_usedNames; 87 UISettingsCacheSharedFolders *m_pCache; 88 89 /** @name Widgets 90 * @{ */ 91 UIFilePathSelector *m_pPathSelector; 92 QCheckBox *m_pPermanentCheckBox; 93 QLineEdit *m_pNameLineEdit; 94 QCheckBox *m_pReadonlyCheckBox; 95 QCheckBox *m_pAutoMountCheckBox; 96 QLineEdit *m_pAutoMountPointLineEdit; 97 QLabel *m_pPathLabel; 98 QLabel *m_pNameLabel; 99 QLabel *m_pAutoMountPointLabel; 100 QIDialogButtonBox *m_pButtonBox; 101 /** @} */ 81 102 }; 82 103
Note:
See TracChangeset
for help on using the changeset viewer.