VirtualBox

Ignore:
Timestamp:
Aug 7, 2020 6:04:37 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9812. Removing UIMachineSettingsSFDetails.ui

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/VBoxUI.pro

    r85643 r85645  
    4141    src/settings/machine/UIMachineSettingsUSB.ui \
    4242    src/settings/machine/UIMachineSettingsUSBFilterDetails.ui \
    43     src/settings/machine/UIMachineSettingsSFDetails.ui \
    4443    src/settings/machine/UIMachineSettingsInterface.ui
    4544
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp

    r85643 r85645  
    2020#include <QMenu>
    2121#include <QTimer>
     22#include <QVBoxLayout>
    2223
    2324/* GUI includes: */
     
    693694    if (objectName().isEmpty())
    694695        setObjectName(QStringLiteral("UIMachineSettingsSF"));
    695     resize(300, 228);
     696    resize(300, 220);
    696697    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
    697698    pMainLayout->setObjectName(QStringLiteral("pMainLayout"));
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.cpp

    r82968 r85645  
    1717
    1818/* Qt includes */
     19#include <QCheckBox>
    1920#include <QDir>
     21#include <QGridLayout>
     22#include <QLabel>
     23#include <QLineEdit>
    2024#include <QPushButton>
    2125
    22 /* Other includes */
     26/* GUI includes */
     27#include "QIDialogButtonBox.h"
     28#include "UIFilePathSelector.h"
    2329#include "UIMachineSettingsSFDetails.h"
    2430#include "UICommon.h"
     
    2935                                                       const QStringList &usedNames,
    3036                                                       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();
    3853
    3954    /* Setup widgets: */
    40     mPsPath->setResetEnabled(false);
    41     mPsPath->setHomeDir(QDir::homePath());
    42     mCbPermanent->setHidden(!fEnableSelector);
     55    m_pPathSelector->setResetEnabled(false);
     56    m_pPathSelector->setHomeDir(QDir::homePath());
     57    m_pPermanentCheckBox->setHidden(!fEnableSelector);
    4358
    4459    /* Setup connections: */
    45     connect(mPsPath, static_cast<void(UIFilePathSelector::*)(int)>(&UIFilePathSelector::currentIndexChanged),
     60    connect(m_pPathSelector, static_cast<void(UIFilePathSelector::*)(int)>(&UIFilePathSelector::currentIndexChanged),
    4661            this, &UIMachineSettingsSFDetails::sltSelectPath);
    47     connect(mPsPath, &UIFilePathSelector::pathChanged, this, &UIMachineSettingsSFDetails::sltSelectPath);
    48     connect(mLeName, &QLineEdit::textChanged, this, &UIMachineSettingsSFDetails::sltValidate);
     62    connect(m_pPathSelector, &UIFilePathSelector::pathChanged, this, &UIMachineSettingsSFDetails::sltSelectPath);
     63    connect(m_pNameLineEdit, &QLineEdit::textChanged, this, &UIMachineSettingsSFDetails::sltValidate);
    4964    if (fEnableSelector)
    50         connect(mCbPermanent, &QCheckBox::toggled, this, &UIMachineSettingsSFDetails::sltValidate);
     65        connect(m_pPermanentCheckBox, &QCheckBox::toggled, this, &UIMachineSettingsSFDetails::sltValidate);
    5166
    5267     /* Applying language settings: */
     
    6580}
    6681
     82void 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
    67143void UIMachineSettingsSFDetails::setPath(const QString &strPath)
    68144{
    69     mPsPath->setPath(strPath);
     145    m_pPathSelector->setPath(strPath);
    70146}
    71147
    72148QString UIMachineSettingsSFDetails::path() const
    73149{
    74     return mPsPath->path();
     150    return m_pPathSelector->path();
    75151}
    76152
    77153void UIMachineSettingsSFDetails::setName(const QString &strName)
    78154{
    79     mLeName->setText(strName);
     155    m_pNameLineEdit->setText(strName);
    80156}
    81157
    82158QString UIMachineSettingsSFDetails::name() const
    83159{
    84     return mLeName->text();
     160    return m_pNameLineEdit->text();
    85161}
    86162
    87163void UIMachineSettingsSFDetails::setWriteable(bool fWritable)
    88164{
    89     mCbReadonly->setChecked(!fWritable);
     165    m_pReadonlyCheckBox->setChecked(!fWritable);
    90166}
    91167
    92168bool UIMachineSettingsSFDetails::isWriteable() const
    93169{
    94     return !mCbReadonly->isChecked();
     170    return !m_pReadonlyCheckBox->isChecked();
    95171}
    96172
    97173void UIMachineSettingsSFDetails::setAutoMount(bool fAutoMount)
    98174{
    99     mCbAutoMount->setChecked(fAutoMount);
     175    m_pAutoMountCheckBox->setChecked(fAutoMount);
    100176}
    101177
    102178bool UIMachineSettingsSFDetails::isAutoMounted() const
    103179{
    104     return mCbAutoMount->isChecked();
     180    return m_pAutoMountCheckBox->isChecked();
    105181}
    106182
    107183void UIMachineSettingsSFDetails::setAutoMountPoint(const QString &strAutoMountPoint)
    108184{
    109     mLeAutoMountPoint->setText(strAutoMountPoint);
     185    m_pAutoMountPointLineEdit->setText(strAutoMountPoint);
    110186}
    111187
    112188QString UIMachineSettingsSFDetails::autoMountPoint() const
    113189{
    114     return mLeAutoMountPoint->text();
     190    return m_pAutoMountPointLineEdit->text();
    115191}
    116192
    117193void UIMachineSettingsSFDetails::setPermanent(bool fPermanent)
    118194{
    119     mCbPermanent->setChecked(fPermanent);
     195    m_pPermanentCheckBox->setChecked(fPermanent);
    120196}
    121197
    122198bool UIMachineSettingsSFDetails::isPermanent() const
    123199{
    124     return m_fUsePermanent ? mCbPermanent->isChecked() : true;
     200    return m_fUsePermanent ? m_pPermanentCheckBox->isChecked() : true;
    125201}
    126202
    127203void UIMachineSettingsSFDetails::retranslateUi()
    128204{
    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"));
    131216
    132217    switch (m_type)
     
    145230void UIMachineSettingsSFDetails::sltValidate()
    146231{
    147     mButtonBox->button(QDialogButtonBox::Ok)->setEnabled(!mPsPath->path().isEmpty() &&
    148                                                          QDir(mPsPath->path()).exists() &&
    149                                                          !mLeName->text().trimmed().isEmpty() &&
    150                                                          !mLeName->text().contains(" ") &&
    151                                                          !m_usedNames.contains(mLeName->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()));
    152237}
    153238
    154239void UIMachineSettingsSFDetails::sltSelectPath()
    155240{
    156     if (!mPsPath->isPathSelected())
     241    if (!m_pPathSelector->isPathSelected())
    157242        return;
    158243
    159     QString strFolderName(mPsPath->path());
     244    QString strFolderName(m_pPathSelector->path());
    160245#if defined (VBOX_WS_WIN) || defined (Q_OS_OS2)
    161246    if (strFolderName[0].isLetter() && strFolderName[1] == ':' && strFolderName[2] == 0)
     
    164249         * Append the trailing backslash to get a valid root path 'X:\': */
    165250        strFolderName += "\\";
    166         mPsPath->setPath(strFolderName);
     251        m_pPathSelector->setPath(strFolderName);
    167252    }
    168253#endif /* VBOX_WS_WIN || Q_OS_OS2 */
     
    171256    {
    172257        /* Processing non-root folder */
    173         mLeName->setText(folder.dirName().replace(' ', '_'));
     258        m_pNameLineEdit->setText(folder.dirName().replace(' ', '_'));
    174259    }
    175260    else
     
    177262        /* Processing root folder: */
    178263#if defined (VBOX_WS_WIN) || defined (Q_OS_OS2)
    179         mLeName->setText(strFolderName.toUpper()[0] + "_DRIVE");
     264        m_pNameLineEdit->setText(strFolderName.toUpper()[0] + "_DRIVE");
    180265#elif defined (VBOX_WS_X11)
    181         mLeName->setText("ROOT");
     266        m_pNameLineEdit->setText("ROOT");
    182267#endif
    183268    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSFDetails.h

    r82968 r85645  
    2323
    2424/* Includes */
    25 #include "UIMachineSettingsSFDetails.gen.h"
    2625#include "QIDialog.h"
    2726#include "QIWithRetranslateUI.h"
    2827#include "UIMachineSettingsSF.h"
    2928
     29class UIFilePathSelector;
     30class QCheckBox;
     31class QLabel;
     32class QLineEdit;
     33class QIDialogButtonBox;
     34
    3035/* Shared folders details dialog: */
    31 class SHARED_LIBRARY_STUFF UIMachineSettingsSFDetails : public QIWithRetranslateUI2<QIDialog>,
    32                                                         public Ui::UIMachineSettingsSFDetails
     36class SHARED_LIBRARY_STUFF UIMachineSettingsSFDetails : public QIWithRetranslateUI2<QIDialog>
    3337{
    3438    Q_OBJECT;
     
    7680private:
    7781
     82    void prepareWidgets();
     83
    7884    SFDialogType  m_type;
    7985    bool          m_fUsePermanent;
    8086    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    /** @} */
    81102};
    82103
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette