VirtualBox

Ignore:
Timestamp:
Aug 7, 2020 11:47:45 AM (4 years ago)
Author:
vboxsync
Message:

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

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

Legend:

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

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

    r82968 r85643  
    2222
    2323/* GUI includes: */
     24#include "QILabelSeparator.h"
     25#include "QITreeWidget.h"
     26#include "UICommon.h"
     27#include "UIErrorString.h"
    2428#include "UIIconPool.h"
    2529#include "UIMachineSettingsSF.h"
    2630#include "UIMachineSettingsSFDetails.h"
    27 #include "UIErrorString.h"
    28 #include "UICommon.h"
     31#include "UIToolBar.h"
    2932#include "VBoxUtils.h"
    3033
     
    277280    : m_pActionAdd(0), m_pActionEdit(0), m_pActionRemove(0)
    278281    , m_pCache(0)
     282    , m_pFoldersTreeWidget(0)
     283    , m_pNameSeparator(0)
     284    , m_pFoldersToolBar(0)
    279285{
    280286    /* Prepare: */
     
    356362{
    357363    /* Clear list initially: */
    358     mTwFolders->clear();
     364    m_pFoldersTreeWidget->clear();
    359365
    360366    /* Update root items visibility: */
     
    366372
    367373    /* Choose first folder as current: */
    368     mTwFolders->setCurrentItem(mTwFolders->topLevelItem(0));
    369     sltHandleCurrentItemChange(mTwFolders->currentItem());
     374    m_pFoldersTreeWidget->setCurrentItem(m_pFoldersTreeWidget->topLevelItem(0));
     375    sltHandleCurrentItemChange(m_pFoldersTreeWidget->currentItem());
    370376
    371377    /* Polish page finally: */
     
    379385
    380386    /* For each folder type: */
    381     QTreeWidgetItem *pMainRootItem = mTwFolders->invisibleRootItem();
     387    QTreeWidgetItem *pMainRootItem = m_pFoldersTreeWidget->invisibleRootItem();
    382388    for (int iFolderTypeIndex = 0; iFolderTypeIndex < pMainRootItem->childCount(); ++iFolderTypeIndex)
    383389    {
     
    410416}
    411417
     418
    412419void UIMachineSettingsSF::retranslateUi()
    413420{
    414     /* Translate uic generated strings: */
    415     Ui::UIMachineSettingsSF::retranslateUi(this);
     421    m_pNameSeparator->setText(tr("Shared &Folders"));
     422    QTreeWidgetItem *pQTreeWidgetItem = m_pFoldersTreeWidget->headerItem();
     423    pQTreeWidgetItem->setText(4, tr("At"));
     424    pQTreeWidgetItem->setText(3, tr("Auto Mount"));
     425    pQTreeWidgetItem->setText(2, tr("Access"));
     426    pQTreeWidgetItem->setText(1, tr("Path"));
     427    pQTreeWidgetItem->setText(0, tr("Name"));
     428#ifndef QT_NO_WHATSTHIS
     429    m_pFoldersTreeWidget->setWhatsThis(tr("Lists all shared folders accessible to this machine. Use 'net use x: \\\\vboxsvr\\share' to access a shared folder named <i>share</i> from a DOS-like OS, or 'mount -t vboxsf share mount_point' to access it from a Linux OS. This feature requires Guest Additions."));
     430#endif // QT_NO_WHATSTHIS
     431
    416432
    417433    m_pActionAdd->setText(tr("Add Shared Folder"));
     
    431447{
    432448    /* Polish shared folders page availability: */
    433     mNameSeparator->setEnabled(isMachineInValidMode());
     449    m_pNameSeparator->setEnabled(isMachineInValidMode());
    434450    m_pFoldersToolBar->setEnabled(isMachineInValidMode());
    435451    m_pFoldersToolBar->setEnabled(isMachineInValidMode());
     
    445461
    446462    /* Connect header-resize signal just before widget is shown after all the items properly loaded and initialized: */
    447     connect(mTwFolders->header(), &QHeaderView::sectionResized, this, &UIMachineSettingsSF::sltAdjustTreeFields);
     463    connect(m_pFoldersTreeWidget->header(), &QHeaderView::sectionResized, this, &UIMachineSettingsSF::sltAdjustTreeFields);
    448464
    449465    /* Adjusting size after all pending show events are processed: */
     
    486502
    487503        /* Sort tree-widget before adjusting: */
    488         mTwFolders->sortItems(0, Qt::AscendingOrder);
     504        m_pFoldersTreeWidget->sortItems(0, Qt::AscendingOrder);
    489505        /* Adjust tree-widget finally: */
    490506        sltAdjustTree();
     
    495511{
    496512    /* Check current folder item: */
    497     SFTreeViewItem *pItem = static_cast<SFTreeViewItem*>(mTwFolders->currentItem());
     513    SFTreeViewItem *pItem = static_cast<SFTreeViewItem*>(m_pFoldersTreeWidget->currentItem());
    498514    AssertPtrReturnVoid(pItem);
    499515    AssertPtrReturnVoid(pItem->parentItem());
     
    538554
    539555            /* Update tree-widget: */
    540             mTwFolders->scrollToItem(pItem);
    541             mTwFolders->setCurrentItem(pItem);
     556            m_pFoldersTreeWidget->scrollToItem(pItem);
     557            m_pFoldersTreeWidget->setCurrentItem(pItem);
    542558            sltHandleCurrentItemChange(pItem);
    543559        }
    544560
    545561        /* Sort tree-widget before adjusting: */
    546         mTwFolders->sortItems(0, Qt::AscendingOrder);
     562        m_pFoldersTreeWidget->sortItems(0, Qt::AscendingOrder);
    547563        /* Adjust tree-widget finally: */
    548564        sltAdjustTree();
     
    553569{
    554570    /* Check current folder item: */
    555     QTreeWidgetItem *pItem = mTwFolders->currentItem();
     571    QTreeWidgetItem *pItem = m_pFoldersTreeWidget->currentItem();
    556572    AssertPtrReturnVoid(pItem);
    557573
     
    584600{
    585601    QMenu menu;
    586     QTreeWidgetItem *pItem = mTwFolders->itemAt(position);
    587     if (mTwFolders->isEnabled() && pItem && pItem->flags() & Qt::ItemIsSelectable)
     602    QTreeWidgetItem *pItem = m_pFoldersTreeWidget->itemAt(position);
     603    if (m_pFoldersTreeWidget->isEnabled() && pItem && pItem->flags() & Qt::ItemIsSelectable)
    588604    {
    589605        menu.addAction(m_pActionEdit);
     
    595611    }
    596612    if (!menu.isEmpty())
    597         menu.exec(mTwFolders->viewport()->mapToGlobal(position));
     613        menu.exec(m_pFoldersTreeWidget->viewport()->mapToGlobal(position));
    598614}
    599615
     
    611627     * 4 = Auto mount point
    612628     */
    613     QAbstractItemView *pItemView = mTwFolders;
    614     QHeaderView *pItemHeader = mTwFolders->header();
    615     const int iTotal = mTwFolders->viewport()->width();
     629    QAbstractItemView *pItemView = m_pFoldersTreeWidget;
     630    QHeaderView *pItemHeader = m_pFoldersTreeWidget->header();
     631    const int iTotal = m_pFoldersTreeWidget->viewport()->width();
    616632
    617633    const int mw0 = qMax(pItemView->sizeHintForColumn(0), pItemHeader->sectionSizeHint(0));
     
    651667    }
    652668#endif
    653     mTwFolders->setColumnWidth(0, w0);
    654     mTwFolders->setColumnWidth(1, w1);
    655     mTwFolders->setColumnWidth(2, w2);
    656     mTwFolders->setColumnWidth(3, w3);
    657     mTwFolders->setColumnWidth(4, w4);
     669    m_pFoldersTreeWidget->setColumnWidth(0, w0);
     670    m_pFoldersTreeWidget->setColumnWidth(1, w1);
     671    m_pFoldersTreeWidget->setColumnWidth(2, w2);
     672    m_pFoldersTreeWidget->setColumnWidth(3, w3);
     673    m_pFoldersTreeWidget->setColumnWidth(4, w4);
    658674}
    659675
    660676void UIMachineSettingsSF::sltAdjustTreeFields()
    661677{
    662     QTreeWidgetItem *pMainRoot = mTwFolders->invisibleRootItem();
     678    QTreeWidgetItem *pMainRoot = m_pFoldersTreeWidget->invisibleRootItem();
    663679    for (int i = 0; i < pMainRoot->childCount(); ++i)
    664680    {
     
    673689}
    674690
     691void UIMachineSettingsSF::prepareWidgets()
     692{
     693    if (objectName().isEmpty())
     694        setObjectName(QStringLiteral("UIMachineSettingsSF"));
     695    resize(300, 228);
     696    QVBoxLayout *pMainLayout = new QVBoxLayout(this);
     697    pMainLayout->setObjectName(QStringLiteral("pMainLayout"));
     698    pMainLayout->setContentsMargins(0, 0, 0, 0);
     699    m_pNameSeparator = new QILabelSeparator(this);
     700    m_pNameSeparator->setObjectName(QStringLiteral("m_pNameSeparator"));
     701
     702    pMainLayout->addWidget(m_pNameSeparator);
     703
     704    QWidget *m_pFoldersTreeWidgetContainer = new QWidget(this);
     705    m_pFoldersTreeWidgetContainer->setObjectName(QStringLiteral("m_pFoldersTreeWidgetContainer"));
     706    QHBoxLayout *pFoldersLayout = new QHBoxLayout(m_pFoldersTreeWidgetContainer);
     707    pFoldersLayout->setSpacing(3);
     708    pFoldersLayout->setObjectName(QStringLiteral("pFoldersLayout"));
     709    pFoldersLayout->setContentsMargins(0, 0, 0, 0);
     710    m_pFoldersTreeWidget = new QITreeWidget(m_pFoldersTreeWidgetContainer);
     711    m_pFoldersTreeWidget->setObjectName(QStringLiteral("m_pFoldersTreeWidget"));
     712    m_pFoldersTreeWidget->setMinimumSize(QSize(0, 200));
     713    m_pFoldersTreeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
     714    m_pFoldersTreeWidget->setUniformRowHeights(true);
     715    m_pFoldersTreeWidget->setAllColumnsShowFocus(true);
     716
     717    pFoldersLayout->addWidget(m_pFoldersTreeWidget);
     718
     719    m_pFoldersToolBar = new UIToolBar(m_pFoldersTreeWidgetContainer);
     720    m_pFoldersToolBar->setObjectName(QStringLiteral("m_pFoldersToolBar"));
     721
     722    pFoldersLayout->addWidget(m_pFoldersToolBar);
     723    pMainLayout->addWidget(m_pFoldersTreeWidgetContainer);
     724    m_pNameSeparator->setBuddy(m_pFoldersTreeWidget);
     725}
     726
    675727void UIMachineSettingsSF::prepare()
    676728{
    677     /* Apply UI decorations: */
    678     Ui::UIMachineSettingsSF::setupUi(this);
     729    prepareWidgets();
    679730
    680731    /* Prepare cache: */
     
    699750{
    700751    /* Shared Folders tree-widget created in the .ui file. */
    701     AssertPtrReturnVoid(mTwFolders);
     752    AssertPtrReturnVoid(m_pFoldersTreeWidget);
    702753    {
    703754        /* Configure tree-widget: */
    704         mTwFolders->header()->setSectionsMovable(false);
     755        m_pFoldersTreeWidget->header()->setSectionsMovable(false);
    705756    }
    706757}
     
    751802{
    752803    /* Configure tree-widget connections: */
    753     connect(mTwFolders, &QITreeWidget::currentItemChanged,
     804    connect(m_pFoldersTreeWidget, &QITreeWidget::currentItemChanged,
    754805            this, &UIMachineSettingsSF::sltHandleCurrentItemChange);
    755     connect(mTwFolders, &QITreeWidget::itemDoubleClicked,
     806    connect(m_pFoldersTreeWidget, &QITreeWidget::itemDoubleClicked,
    756807            this, &UIMachineSettingsSF::sltHandleDoubleClick);
    757     connect(mTwFolders, &QITreeWidget::customContextMenuRequested,
     808    connect(m_pFoldersTreeWidget, &QITreeWidget::customContextMenuRequested,
    758809            this, &UIMachineSettingsSF::sltHandleContextMenuRequest);
    759810}
     
    770821    /* Search for the corresponding root item among all the top-level items: */
    771822    SFTreeViewItem *pRootItem = 0;
    772     QTreeWidgetItem *pMainRootItem = mTwFolders->invisibleRootItem();
     823    QTreeWidgetItem *pMainRootItem = m_pFoldersTreeWidget->invisibleRootItem();
    773824    for (int iFolderTypeIndex = 0; iFolderTypeIndex < pMainRootItem->childCount(); ++iFolderTypeIndex)
    774825    {
     
    792843    /* Make the used names list: */
    793844    QStringList list;
    794     QTreeWidgetItemIterator it(mTwFolders);
     845    QTreeWidgetItemIterator it(m_pFoldersTreeWidget);
    795846    while (*it)
    796847    {
     
    835886    {
    836887        /* Create new shared folder type item: */
    837         pRootItem = new SFTreeViewItem(mTwFolders, SFTreeViewItem::FormatType_EllipsisEnd);
     888        pRootItem = new SFTreeViewItem(m_pFoldersTreeWidget, SFTreeViewItem::FormatType_EllipsisEnd);
    838889        AssertPtrReturnVoid(pRootItem);
    839890        {
     
    873924        if (fChoose)
    874925        {
    875             mTwFolders->scrollToItem(pItem);
    876             mTwFolders->setCurrentItem(pItem);
     926            m_pFoldersTreeWidget->scrollToItem(pItem);
     927            m_pFoldersTreeWidget->setCurrentItem(pItem);
    877928            sltHandleCurrentItemChange(pItem);
    878929        }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.h

    r82968 r85643  
    2424/* GUI includes: */
    2525#include "UISettingsPage.h"
    26 #include "UIMachineSettingsSF.gen.h"
    2726
    2827/* COM includes: */
     
    3029
    3130/* Forward declarations: */
     31class QTreeWidgetItem;
     32class QITreeWidget;
     33class QILabelSeparator;
    3234class SFTreeViewItem;
     35class UIToolBar;
     36
    3337struct UIDataSettingsSharedFolder;
    3438struct UIDataSettingsSharedFolders;
     
    3741typedef UISettingsCachePool<UIDataSettingsSharedFolders, UISettingsCacheSharedFolder> UISettingsCacheSharedFolders;
    3842
     43
    3944/** Machine settings: Shared Folders page. */
    40 class SHARED_LIBRARY_STUFF UIMachineSettingsSF : public UISettingsPageMachine,
    41                                                  public Ui::UIMachineSettingsSF
     45class SHARED_LIBRARY_STUFF UIMachineSettingsSF : public UISettingsPageMachine
    4246{
    4347    Q_OBJECT;
     
    106110    /** Prepares all. */
    107111    void prepare();
     112    /** Prepares Widgets. */
     113    void prepareWidgets();
    108114    /** Prepares shared folders tree. */
    109115    void prepareFoldersTree();
     
    153159    /** Holds the page data cache instance. */
    154160    UISettingsCacheSharedFolders *m_pCache;
     161
     162    /** @name Widgets
     163      * @{ */
     164        QITreeWidget *m_pFoldersTreeWidget;
     165        QILabelSeparator *m_pNameSeparator;
     166        UIToolBar *m_pFoldersToolBar;
     167    /** @} */
    155168};
    156169
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