VirtualBox

Changeset 72545 in vbox for trunk


Ignore:
Timestamp:
Jun 13, 2018 2:24:53 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: ​bugref:6769 Adding a way to provide an appliance wide home folder

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.cpp

    r72527 r72545  
    194194    /** Cache currently stored values, such as @a finalStates, @a finalValues and @a finalExtraValues. */
    195195    virtual void putBack(QVector<BOOL> &finalStates, QVector<QString> &finalValues, QVector<QString> &finalExtraValues) /* override */;
     196
     197    KVirtualSystemDescriptionType  systemDescriptionType() const;
    196198
    197199private:
     
    287289        childItem(i)->putBack(finalStates, finalValues, finalExtraValues);
    288290}
    289 
    290291
    291292/*********************************************************************************************************************************
     
    523524                    case KVirtualSystemDescriptionType_SoundCard:              value = UIIconPool::iconSet(":/sound_16px.png"); break;
    524525                    case KVirtualSystemDescriptionType_BaseFolder:             value = vboxGlobal().icon(QFileIconProvider::Folder); break;
    525                     case KVirtualSystemDescriptionType_PrimaryGroup:              value = UIIconPool::iconSet(":/vm_group_name_16px.png"); break;
     526                    case KVirtualSystemDescriptionType_PrimaryGroup:           value = UIIconPool::iconSet(":/vm_group_name_16px.png"); break;
    526527                    default: break;
    527528                }
     
    918919            {
    919920                m_strConfigValue = pComboBox->itemData(pComboBox->currentIndex()).toString();
    920                 printf("%s\n", qPrintable(pComboBox->itemData(pComboBox->currentIndex()).toString()));
    921921                fDone = true;
    922922            }
     
    964964}
    965965
     966
     967KVirtualSystemDescriptionType  UIVirtualHardwareItem::systemDescriptionType() const
     968{
     969    return m_enmVSDType;
     970}
    966971
    967972/*********************************************************************************************************************************
     
    11621167}
    11631168
     1169
     1170void UIApplianceModel::setVirtualSystemBaseFolder(const QString& path)
     1171{
     1172    if (!m_pRootItem)
     1173        return;
     1174    /* For each Virtual System: */
     1175    for (int i = 0; i < m_pRootItem->childCount(); ++i)
     1176    {
     1177        UIVirtualSystemItem *pVirtualSystem = dynamic_cast<UIVirtualSystemItem*>(m_pRootItem->childItem(i));
     1178        if (!pVirtualSystem)
     1179            continue;
     1180        int iItemCount = pVirtualSystem->childCount();
     1181        for (int j = 0; j < iItemCount; ++j)
     1182        {
     1183            UIVirtualHardwareItem *pHardwareItem = dynamic_cast<UIVirtualHardwareItem*>(pVirtualSystem->childItem(j));
     1184            if (!pHardwareItem)
     1185                continue;
     1186            if (pHardwareItem->systemDescriptionType() != KVirtualSystemDescriptionType_BaseFolder)
     1187                continue;
     1188            QVariant data(path);
     1189            pHardwareItem->setData(ApplianceViewSection_ConfigValue, data, Qt::EditRole);
     1190            QModelIndex index = createIndex(pHardwareItem->row(), 0, pHardwareItem);
     1191            emit dataChanged(index, index);
     1192        }
     1193    }
     1194}
    11641195
    11651196/*********************************************************************************************************************************
     
    13691400
    13701401    /* Create layout: */
    1371     QVBoxLayout *pLayout = new QVBoxLayout(this);
     1402    m_pLayout = new QVBoxLayout(this);
    13721403    {
    13731404        /* Configure information layout: */
    1374         pLayout->setContentsMargins(0, 0, 0, 0);
     1405        m_pLayout->setContentsMargins(0, 0, 0, 0);
    13751406
    13761407        /* Create information pane: */
     
    13781409        {
    13791410            /* Create information layout: */
    1380             QVBoxLayout *pLayoutInformation = new QVBoxLayout(m_pPaneInformation);
     1411            QVBoxLayout *m_pLayoutInformation = new QVBoxLayout(m_pPaneInformation);
    13811412            {
    13821413                /* Configure information layout: */
    1383                 pLayoutInformation->setContentsMargins(0, 0, 0, 0);
     1414                m_pLayoutInformation->setContentsMargins(0, 0, 0, 0);
    13841415
    13851416                /* Create tree-view: */
     
    13941425
    13951426                    /* Add tree-view into information layout: */
    1396                     pLayoutInformation->addWidget(m_pTreeViewSettings);
     1427                    m_pLayoutInformation->addWidget(m_pTreeViewSettings);
    13971428                }
    13981429
     
    14041435
    14051436                    /* Add tree-view into information layout: */
    1406                     pLayoutInformation->addWidget(m_pCheckBoxReinitMACs);
     1437                    m_pLayoutInformation->addWidget(m_pCheckBoxReinitMACs);
    14071438                }
    14081439            }
    14091440
    14101441            /* Add information pane into layout: */
    1411             pLayout->addWidget(m_pPaneInformation);
     1442            m_pLayout->addWidget(m_pPaneInformation);
    14121443        }
    14131444
     
    14201451
    14211452            /* Create warning layout: */
    1422             QVBoxLayout *pLayoutWarning = new QVBoxLayout(m_pPaneWarning);
     1453            QVBoxLayout *m_pLayoutWarning = new QVBoxLayout(m_pPaneWarning);
    14231454            {
    14241455                /* Configure warning layout: */
    1425                 pLayoutWarning->setContentsMargins(0, 0, 0, 0);
     1456                m_pLayoutWarning->setContentsMargins(0, 0, 0, 0);
    14261457
    14271458                /* Create label: */
     
    14291460                {
    14301461                    /* Add label into warning layout: */
    1431                     pLayoutWarning->addWidget(m_pLabelWarning);
     1462                    m_pLayoutWarning->addWidget(m_pLabelWarning);
    14321463                }
    14331464
     
    14411472
    14421473                    /* Add text-edit into warning layout: */
    1443                     pLayoutWarning->addWidget(m_pTextEditWarning);
     1474                    m_pLayoutWarning->addWidget(m_pTextEditWarning);
    14441475                }
    14451476            }
    14461477
    14471478            /* Add warning pane into layout: */
    1448             pLayout->addWidget(m_pPaneWarning);
     1479            m_pLayout->addWidget(m_pPaneWarning);
    14491480        }
    14501481    }
     
    14881519    }
    14891520}
     1521
     1522void UIApplianceEditorWidget::setVirtualSystemBaseFolder(const QString& path)
     1523{
     1524    if (!m_pModel)
     1525        return;
     1526    m_pModel->setVirtualSystemBaseFolder(path);
     1527}
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceEditorWidget.h

    r69500 r72545  
    3838class QTextEdit;
    3939class QITreeView;
    40 
     40class QVBoxLayout;
    4141
    4242/** Appliance tree-view section types. */
     
    101101    /** Cache currently stored values. */
    102102    void putBack();
     103
     104    void setVirtualSystemBaseFolder(const QString& path);
    103105
    104106private:
     
    211213    virtual void retranslateUi() /* override */;
    212214
     215    void setVirtualSystemBaseFolder(const QString& path);
     216
    213217    /** Holds the currently set appliance reference. */
    214218    CAppliance         *m_pAppliance;
    215219    /** Holds the Appliance model reference. */
    216220    UIApplianceModel *m_pModel;
     221
     222    QVBoxLayout *m_pLayout;
    217223
    218224    /** Holds the information pane instance. */
     
    246252
    247253#endif /* !___UIApplianceEditorWidget_h___ */
    248 
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.cpp

    r69500 r72545  
    2323# include <QCheckBox>
    2424# include <QTextEdit>
     25# include <QVBoxLayout>
    2526
    2627/* GUI includes: */
     28# include "QIRichTextLabel.h"
    2729# include "QITreeView.h"
    2830# include "UIApplianceImportEditorWidget.h"
     31# include "UIFilePathSelector.h"
     32# include "UIMessageCenter.h"
     33# include "UIWizardImportApp.h"
    2934# include "VBoxGlobal.h"
    30 # include "UIMessageCenter.h"
    3135
    3236/* COM includes: */
    3337# include "CAppliance.h"
     38# include "CSystemProperties.h"
    3439
    3540#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    5762    /* Show the MAC check box */
    5863    m_pCheckBoxReinitMACs->setHidden(false);
     64
     65    m_pPathSelectorLabel = new QIRichTextLabel(this);
     66    if (m_pPathSelectorLabel)
     67    {
     68        m_pLayout->addWidget(m_pPathSelectorLabel);
     69    }
     70    m_pPathSelector = new UIFilePathSelector(this);
     71    if (m_pPathSelector)
     72    {
     73        m_pPathSelector->setResetEnabled(true);
     74        m_pPathSelector->setDefaultPath(vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder());
     75        m_pPathSelector->setPath(vboxGlobal().virtualBox().GetSystemProperties().GetDefaultMachineFolder());
     76        connect(m_pPathSelector, &UIFilePathSelector::pathChanged, this, &UIApplianceImportEditorWidget::sltHandlePathChanged);
     77        m_pLayout->addWidget(m_pPathSelector);
     78    }
     79    m_pLayout->addStretch();
     80    retranslateUi();
    5981}
    6082
     
    137159        }
    138160    }
     161    /* Make sure we initialize model items with correct base folder path: */
     162    if (m_pPathSelector)
     163        sltHandlePathChanged(m_pPathSelector->path());
     164
    139165    return fResult;
    140166}
     
    199225}
    200226
     227void UIApplianceImportEditorWidget::retranslateUi()
     228{
     229    UIApplianceEditorWidget::retranslateUi();
     230    m_pPathSelectorLabel->setText(UIWizardImportApp::tr("You can modify the base folder which will host "
     231                                                        "all the virtual machines. Virtual home folders "
     232                                                        "can also be individually modified."));
     233
     234}
     235
     236void UIApplianceImportEditorWidget::sltHandlePathChanged(const QString &newPath)
     237{
     238    setVirtualSystemBaseFolder(newPath);
     239}
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIApplianceImportEditorWidget.h

    r69500 r72545  
    2222#include "UIApplianceEditorWidget.h"
    2323
     24/* Forward declarations: */
     25class UIFilePathSelector;
     26class QIRichTextLabel;
     27
    2428class UIApplianceImportEditorWidget: public UIApplianceEditorWidget
    2529{
     
    3438
    3539    QList<QPair<QString, QString> > licenseAgreements() const;
     40
     41protected:
     42    /** Handles translation event. */
     43    virtual void retranslateUi() /* override */;
     44
     45private slots:
     46
     47    void sltHandlePathChanged(const QString &newPath);
     48
     49private:
     50
     51    QIRichTextLabel    *m_pPathSelectorLabel;
     52    UIFilePathSelector *m_pPathSelector;
    3653};
    3754
    3855#endif /* __UIApplianceImportEditorWidget_h__ */
    39 
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.cpp

    r71318 r72545  
    2121
    2222/* Global includes: */
     23# include <QLabel>
     24# include <QPointer>
     25# include <QPushButton>
     26# include <QTextBrowser>
    2327# include <QVBoxLayout>
    24 # include <QTextBrowser>
    25 # include <QPushButton>
    26 # include <QPointer>
    27 # include <QLabel>
    2828
    2929/* Local includes: */
     30# include "QIDialogButtonBox.h"
     31# include "QIRichTextLabel.h"
     32# include "UIWizardImportApp.h"
    3033# include "UIWizardImportAppPageBasic2.h"
    31 # include "UIWizardImportApp.h"
    32 # include "QIRichTextLabel.h"
    33 # include "QIDialogButtonBox.h"
    3434
    3535/* COM includes: */
     
    296296    m_pTextBrowser->setText(QString("<table>%1</table>").arg(strTableContent));
    297297}
    298 
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/importappliance/UIWizardImportAppPageBasic2.h

    r69500 r72545  
    113113
    114114#endif /* !___UIWizardImportAppPageBasic2_h___ */
    115 
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