VirtualBox

Changeset 100887 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 16, 2023 6:00:51 PM (16 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10496, bugref:6699. Moving all the functionality of the options panel to the new panel.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/guestctrl
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.cpp

    r100880 r100887  
    256256    }
    257257
    258     m_pPanel = new UIFileManagerPanel;
     258    m_pPanel = new UIFileManagerPanel(this, UIFileManagerOptions::instance());
    259259    AssertReturnVoid(m_pPanel);
    260260    m_pVerticalSplitter->addWidget(m_pPanel);
     
    321321                this, &UIFileManager::sltHandleShowPanel);
    322322    }
    323 
     323    if (m_pPanel)
     324    {
     325        connect(m_pPanel, &UIFileManagerPanel::sigOptionsChanged,
     326                this, &UIFileManager::sltHandleOptionsUpdated);
     327    }
    324328    if (m_pOperationsPanel)
    325329    {
     
    333337        connect(m_pHostFileTable, &UIFileManagerHostTable::sigLogOutput,
    334338                this, &UIFileManager::sltReceieveLogOutput);
     339        connect(m_pHostFileTable, &UIFileManagerHostTable::sigDeleteConfirmationOptionChanged,
     340                this, &UIFileManager::sltHandleOptionsUpdated);
    335341        connect(m_pHostFileTable, &UIFileManagerGuestTable::sigSelectionChanged,
    336342                this, &UIFileManager::sltFileTableSelectionChanged);
     
    504510    if (m_pHostFileTable)
    505511        m_pHostFileTable->setEnabled(fIsRunning);
     512}
     513
     514void UIFileManager::sltHandleOptionsUpdated()
     515{
     516    if (m_pPanel)
     517        m_pPanel->update();
     518
     519    for (int i = 0; i < m_pGuestTablesContainer->count(); ++i)
     520    {
     521        UIFileManagerGuestTable *pTable = qobject_cast<UIFileManagerGuestTable*>(m_pGuestTablesContainer->widget(i));
     522        if (pTable)
     523            pTable->optionsUpdated();
     524    }
     525    if (m_pHostFileTable)
     526        m_pHostFileTable->optionsUpdated();
     527    saveOptions();
    506528}
    507529
     
    805827            connect(pGuestFileTable, &UIFileManagerGuestTable::sigStateChanged,
    806828                    this, &UIFileManager::sltGuestFileTableStateChanged);
     829            connect(pGuestFileTable, &UIFileManagerGuestTable::sigDeleteConfirmationOptionChanged,
     830                    this, &UIFileManager::sltHandleOptionsUpdated);
    807831        }
    808832    }
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.h

    r100880 r100887  
    128128    void sltCurrentTabChanged(int iIndex);
    129129    void sltGuestFileTableStateChanged(bool fIsRunning);
     130    void sltHandleOptionsUpdated();
    130131
    131132private:
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerPanel.cpp

    r100880 r100887  
    3535/* GUI includes: */
    3636#include "UIFileManagerPanel.h"
     37#include "UIFileManager.h"
    3738
    3839/* Other VBox includes: */
    3940#include <iprt/assert.h>
    4041
    41 UIFileManagerPanel::UIFileManagerPanel(QWidget *pParent /* = 0 */)
     42UIFileManagerPanel::UIFileManagerPanel(QWidget *pParent, UIFileManagerOptions *pFileManagerOptions)
    4243    : QIWithRetranslateUI<QWidget>(pParent)
    4344    , m_pTabWidget(0)
     
    4647    , m_pHumanReabableSizesCheckBox(0)
    4748    , m_pShowHiddenObjectsCheckBox(0)
     49    , m_pFileManagerOptions(pFileManagerOptions)
    4850{
    4951    prepare();
     
    7779    AssertReturnVoid(m_pShowHiddenObjectsCheckBox);
    7880
    79     connect(m_pListDirectoriesOnTopCheckBox, &QCheckBox::toggled, this, &UIFileManagerPanel::sigListDirectoryCheckBoxToogled);
    80     connect(m_pDeleteConfirmationCheckBox, &QCheckBox::toggled, this, &UIFileManagerPanel::sigDeleteConfirmationCheckBoxToogled);
    81     connect(m_pHumanReabableSizesCheckBox, &QCheckBox::toggled, this, &UIFileManagerPanel::sigHumanReabableSizesCheckBoxToogled);
    82     connect(m_pShowHiddenObjectsCheckBox, &QCheckBox::toggled, this, &UIFileManagerPanel::sigShowHiddenObjectsCheckBoxToggled);
     81    if (m_pFileManagerOptions)
     82    {
     83        if (m_pListDirectoriesOnTopCheckBox)
     84            m_pListDirectoriesOnTopCheckBox->setChecked(m_pFileManagerOptions->fListDirectoriesOnTop);
     85        if (m_pDeleteConfirmationCheckBox)
     86            m_pDeleteConfirmationCheckBox->setChecked(m_pFileManagerOptions->fAskDeleteConfirmation);
     87        if (m_pHumanReabableSizesCheckBox)
     88            m_pHumanReabableSizesCheckBox->setChecked(m_pFileManagerOptions->fShowHumanReadableSizes);
     89        if (m_pShowHiddenObjectsCheckBox)
     90            m_pShowHiddenObjectsCheckBox->setChecked(m_pFileManagerOptions->fShowHiddenObjects);
     91    }
     92
     93    connect(m_pListDirectoriesOnTopCheckBox, &QCheckBox::toggled,
     94            this, &UIFileManagerPanel::sltListDirectoryCheckBoxToogled);
     95
     96    connect(m_pDeleteConfirmationCheckBox, &QCheckBox::toggled,
     97            this, &UIFileManagerPanel::sltDeleteConfirmationCheckBoxToogled);
     98
     99    connect(m_pHumanReabableSizesCheckBox, &QCheckBox::toggled,
     100            this, &UIFileManagerPanel::sltHumanReabableSizesCheckBoxToogled);
     101
     102
     103    connect(m_pShowHiddenObjectsCheckBox, &QCheckBox::toggled,
     104            this, &UIFileManagerPanel::sltShowHiddenObjectsCheckBoxToggled);
    83105
    84106    QGridLayout *pPreferencesLayout = new QGridLayout(m_pPreferencesTab);
     
    92114}
    93115
    94 
     116void UIFileManagerPanel::sltListDirectoryCheckBoxToogled(bool bChecked)
     117{
     118    if (!m_pFileManagerOptions)
     119        return;
     120    m_pFileManagerOptions->fListDirectoriesOnTop = bChecked;
     121    emit sigOptionsChanged();
     122}
     123
     124void UIFileManagerPanel::sltDeleteConfirmationCheckBoxToogled(bool bChecked)
     125{
     126    if (!m_pFileManagerOptions)
     127        return;
     128    m_pFileManagerOptions->fAskDeleteConfirmation = bChecked;
     129    emit sigOptionsChanged();
     130}
     131
     132void UIFileManagerPanel::sltHumanReabableSizesCheckBoxToogled(bool bChecked)
     133{
     134    if (!m_pFileManagerOptions)
     135        return;
     136    m_pFileManagerOptions->fShowHumanReadableSizes = bChecked;
     137    emit sigOptionsChanged();
     138}
     139
     140void UIFileManagerPanel::sltShowHiddenObjectsCheckBoxToggled(bool bChecked)
     141{
     142    if (!m_pFileManagerOptions)
     143        return;
     144    m_pFileManagerOptions->fShowHiddenObjects = bChecked;
     145    emit sigOptionsChanged();
     146}
    95147
    96148void UIFileManagerPanel::retranslateUi()
     
    123175}
    124176
     177void UIFileManagerPanel::update()
     178{
     179    if (!m_pFileManagerOptions)
     180        return;
     181
     182    if (m_pListDirectoriesOnTopCheckBox)
     183    {
     184        m_pListDirectoriesOnTopCheckBox->blockSignals(true);
     185        m_pListDirectoriesOnTopCheckBox->setChecked(m_pFileManagerOptions->fListDirectoriesOnTop);
     186        m_pListDirectoriesOnTopCheckBox->blockSignals(false);
     187    }
     188
     189    if (m_pDeleteConfirmationCheckBox)
     190    {
     191        m_pDeleteConfirmationCheckBox->blockSignals(true);
     192        m_pDeleteConfirmationCheckBox->setChecked(m_pFileManagerOptions->fAskDeleteConfirmation);
     193        m_pDeleteConfirmationCheckBox->blockSignals(false);
     194    }
     195
     196    if (m_pHumanReabableSizesCheckBox)
     197    {
     198        m_pHumanReabableSizesCheckBox->blockSignals(true);
     199        m_pHumanReabableSizesCheckBox->setChecked(m_pFileManagerOptions->fShowHumanReadableSizes);
     200        m_pHumanReabableSizesCheckBox->blockSignals(false);
     201    }
     202
     203    if (m_pShowHiddenObjectsCheckBox)
     204    {
     205        m_pShowHiddenObjectsCheckBox->blockSignals(true);
     206        m_pShowHiddenObjectsCheckBox->setChecked(m_pFileManagerOptions->fShowHiddenObjects);
     207        m_pShowHiddenObjectsCheckBox->blockSignals(false);
     208    }
     209}
    125210
    126211
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerPanel.h

    r100879 r100887  
    3636#include "QIWithRetranslateUI.h"
    3737/* Forward declarations: */
     38
    3839class QTabWidget;
    3940class QCheckBox;
     41class UIFileManagerOptions;
    4042
    4143class UIFileManagerPanel : public QIWithRetranslateUI<QWidget>
     
    4547signals:
    4648
    47     void sigListDirectoryCheckBoxToogled(bool bChecked);
    48     void sigDeleteConfirmationCheckBoxToogled(bool bChecked);
    49     void sigHumanReabableSizesCheckBoxToogled(bool bChecked);
    50     void sigShowHiddenObjectsCheckBoxToggled(bool bChecked);
     49    void sigOptionsChanged();
    5150
    5251public:
    5352
    54     UIFileManagerPanel(QWidget *pParent = 0);
     53    UIFileManagerPanel(QWidget *pParent, UIFileManagerOptions *pFileManagerOptions);
     54    void update();
    5555
    5656protected:
     
    6060private slots:
    6161
     62    void sltListDirectoryCheckBoxToogled(bool bChecked);
     63    void sltDeleteConfirmationCheckBoxToogled(bool bChecked);
     64    void sltHumanReabableSizesCheckBoxToogled(bool bChecked);
     65    void sltShowHiddenObjectsCheckBoxToggled(bool bChecked);
    6266
    6367private:
     
    7478        QCheckBox  *m_pHumanReabableSizesCheckBox;
    7579        QCheckBox  *m_pShowHiddenObjectsCheckBox;
     80        UIFileManagerOptions *m_pFileManagerOptions;
    7681    /** @} */
    7782
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