VirtualBox

Changeset 100879 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 15, 2023 11:14:27 AM (19 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
158799
Message:

FE/Qt: bugref:10496, bugref:6699. Adding a panel widget t file manager.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
4 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r100297 r100879  
    848848        src/guestctrl/UIFileManagerOperationsPanel.h \
    849849        src/guestctrl/UIFileManagerOptionsPanel.h \
     850        src/guestctrl/UIFileManagerPanel.h \
    850851        src/guestctrl/UIFileManagerTable.h \
    851852        src/helpbrowser/UIHelpBrowserDialog.h \
     
    10631064        src/guestctrl/UIFileManagerLogPanel.cpp \
    10641065        src/guestctrl/UIFileManagerOperationsPanel.cpp \
     1066        src/guestctrl/UIFileManagerPanel.cpp \
    10651067        src/guestctrl/UIFileManagerTable.cpp \
    10661068        src/guestctrl/UIFileManagerGuestTable.cpp \
     
    14261428        src/guestctrl/UIFileManagerHostTable.cpp \
    14271429        src/guestctrl/UIFileManagerLogPanel.cpp \
     1430        src/guestctrl/UIFileManagerPanel.cpp \
    14281431        src/guestctrl/UIFileManagerOperationsPanel.cpp \
    14291432        src/guestctrl/UIFileManagerOptionsPanel.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.cpp

    r98103 r100879  
    4242#include "UIIconPool.h"
    4343#include "UIFileManager.h"
     44#include "UIFileManagerPanel.h"
    4445#include "UIFileManagerOptionsPanel.h"
    4546#include "UIFileManagerLogPanel.h"
     
    138139    , m_pLogPanel(0)
    139140    , m_pOperationsPanel(0)
     141    , m_pPanel(0)
    140142    , m_fCommitDataSignalReceived(false)
    141143{
     
    258260        m_pVerticalSplitter->setStretchFactor(2, 1);
    259261    }
     262
     263    m_pPanel = new UIFileManagerPanel;
     264    AssertReturnVoid(m_pPanel);
     265    m_pVerticalSplitter->addWidget(m_pPanel);
    260266}
    261267
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManager.h

    r98103 r100879  
    5454class UIDialogPanel;
    5555class UIFileManagerLogPanel;
     56class UIFileManagerPanel;
    5657class UIFileManagerOperationsPanel;
    5758class UIFileManagerOptionsPanel;
     
    184185    QMap<UIDialogPanel*, QAction*> m_panelActionMap;
    185186    QList<UIDialogPanel*>          m_visiblePanelsList;
    186     UIFileManagerOptionsPanel          *m_pOptionsPanel;
    187     UIFileManagerLogPanel              *m_pLogPanel;
    188     UIFileManagerOperationsPanel       *m_pOperationsPanel;
    189 
     187    UIFileManagerOptionsPanel     *m_pOptionsPanel;
     188    UIFileManagerLogPanel         *m_pLogPanel;
     189    UIFileManagerOperationsPanel  *m_pOperationsPanel;
     190    UIFileManagerPanel            *m_pPanel;
    190191    bool m_fCommitDataSignalReceived;
    191192
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerPanel.cpp

    r100868 r100879  
    2727
    2828/* Qt includes: */
     29#include <QCheckBox>
    2930#include <QHBoxLayout>
    3031#include <QMenu>
    3132#include <QSpinBox>
    32 #include <QTextEdit>
    33 #include <QTime>
     33#include <QTabWidget>
    3434
    3535/* GUI includes: */
    36 #include "QIToolButton.h"
    37 #include "UIIconPool.h"
    38 #include "UIFileManager.h"
    39 #include "UIFileManagerLogPanel.h"
     36#include "UIFileManagerPanel.h"
    4037
    4138
    42 /*********************************************************************************************************************************
    43 *   UIFileManagerLogViewer definition.                                                                                   *
    44 *********************************************************************************************************************************/
    45 
    46 class UIFileManagerLogViewer : public QTextEdit
     39UIFileManagerPanel::UIFileManagerPanel(QWidget *pParent /* = 0 */)
     40    : QIWithRetranslateUI<QWidget>(pParent)
     41    , m_pTabWidget(0)
     42    , m_pListDirectoriesOnTopCheckBox(0)
     43    , m_pDeleteConfirmationCheckBox(0)
     44    , m_pHumanReabableSizesCheckBox(0)
     45    , m_pShowHiddenObjectsCheckBox(0)
    4746{
    48 
    49     Q_OBJECT;
    50 
    51 public:
    52 
    53     UIFileManagerLogViewer(QWidget *pParent = 0);
    54 
    55 protected:
    56 
    57     virtual void contextMenuEvent(QContextMenuEvent * event) RT_OVERRIDE;
    58 
    59 private slots:
    60 
    61     void sltClear();
    62 };
    63 
    64 /*********************************************************************************************************************************
    65 *   UIFileManagerLogViewer implementation.                                                                                   *
    66 *********************************************************************************************************************************/
    67 
    68 UIFileManagerLogViewer::UIFileManagerLogViewer(QWidget *pParent /* = 0 */)
    69     :QTextEdit(pParent)
    70 {
    71     setUndoRedoEnabled(false);
    72     setReadOnly(true);
    73 }
    74 
    75 void UIFileManagerLogViewer::contextMenuEvent(QContextMenuEvent *event)
    76 {
    77     QMenu *menu = createStandardContextMenu();
    78 
    79     QAction *pClearAction = menu->addAction(UIFileManager::tr("Clear"));
    80     connect(pClearAction, &QAction::triggered, this, &UIFileManagerLogViewer::sltClear);
    81     menu->exec(event->globalPos());
    82     delete menu;
    83 }
    84 
    85 void UIFileManagerLogViewer::sltClear()
    86 {
    87     clear();
     47    prepare();
     48    retranslateUi();
    8849}
    8950
    9051
    91 /*********************************************************************************************************************************
    92 *   UIFileManagerLogPanel implementation.                                                                            *
    93 *********************************************************************************************************************************/
     52void UIFileManagerPanel::prepare()
     53{
     54    QHBoxLayout *pMainLayout = new QHBoxLayout(this);
     55    AssertReturnVoid(pMainLayout);
    9456
    95 UIFileManagerLogPanel::UIFileManagerLogPanel(QWidget *pParent /* = 0 */)
    96     : UIDialogPanel(pParent)
    97     , m_pLogTextEdit(0)
    98 {
    99     prepare();
     57    m_pTabWidget = new QTabWidget;
     58    AssertReturnVoid(m_pTabWidget);
     59    pMainLayout->addWidget(m_pTabWidget);
     60    preparePreferencesTab();
    10061}
    10162
    102 void UIFileManagerLogPanel::appendLog(const QString &strLog, const QString &strMachineName, FileManagerLogType eLogType)
     63void UIFileManagerPanel::preparePreferencesTab()
    10364{
    104     if (!m_pLogTextEdit)
    105         return;
    106     QString strStartTag("<font color=\"Black\">");
    107     QString strEndTag("</font>");
    108     if (eLogType == FileManagerLogType_Error)
    109     {
    110         strStartTag = "<b><font color=\"Red\">";
    111         strEndTag = "</font></b>";
    112     }
    113     QString strColoredLog = QString("%1 %2: %3 %4 %5").arg(strStartTag).arg(QTime::currentTime().toString("hh:mm:ss:z")).arg(strMachineName).arg(strLog).arg(strEndTag);
    114     m_pLogTextEdit->append(strColoredLog);
    115     m_pLogTextEdit->moveCursor(QTextCursor::End);
    116     m_pLogTextEdit->ensureCursorVisible();
    117     emit sigShowPanel(this);
     65    m_pPreferencesTab = new QWidget;
     66    m_pListDirectoriesOnTopCheckBox = new QCheckBox;
     67    m_pDeleteConfirmationCheckBox = new QCheckBox;
     68    m_pHumanReabableSizesCheckBox = new QCheckBox;
     69    m_pShowHiddenObjectsCheckBox = new QCheckBox;
     70
     71    AssertReturnVoid(m_pPreferencesTab);
     72    AssertReturnVoid(m_pListDirectoriesOnTopCheckBox);
     73    AssertReturnVoid(m_pDeleteConfirmationCheckBox);
     74    AssertReturnVoid(m_pHumanReabableSizesCheckBox);
     75    AssertReturnVoid(m_pShowHiddenObjectsCheckBox);
     76
     77    connect(m_pListDirectoriesOnTopCheckBox, &QCheckBox::toggled, this, &UIFileManagerPanel::sigListDirectoryCheckBoxToogled);
     78    connect(m_pDeleteConfirmationCheckBox, &QCheckBox::toggled, this, &UIFileManagerPanel::sigDeleteConfirmationCheckBoxToogled);
     79    connect(m_pHumanReabableSizesCheckBox, &QCheckBox::toggled, this, &UIFileManagerPanel::sigHumanReabableSizesCheckBoxToogled);
     80    connect(m_pShowHiddenObjectsCheckBox, &QCheckBox::toggled, this, &UIFileManagerPanel::sigShowHiddenObjectsCheckBoxToggled);
     81
     82    QGridLayout *pPreferencesLayout = new QGridLayout(m_pPreferencesTab);
     83    AssertReturnVoid(pPreferencesLayout);
     84    pPreferencesLayout->addWidget(m_pListDirectoriesOnTopCheckBox, 0, 0, 1, 1);
     85    pPreferencesLayout->addWidget(m_pDeleteConfirmationCheckBox,   1, 0, 1, 1);
     86    pPreferencesLayout->addWidget(m_pHumanReabableSizesCheckBox,   0, 1, 1, 1);
     87    pPreferencesLayout->addWidget(m_pShowHiddenObjectsCheckBox,    1, 1, 1, 1);
     88
     89    m_pTabWidget->addTab(m_pPreferencesTab, QApplication::translate("UIFileManager", "Preferences"));
    11890}
    11991
    120 QString UIFileManagerLogPanel::panelName() const
     92
     93
     94void UIFileManagerPanel::retranslateUi()
    12195{
    122     return "LogPanel";
    123 }
     96    if (m_pListDirectoriesOnTopCheckBox)
     97    {
     98        m_pListDirectoriesOnTopCheckBox->setText(QApplication::translate("UIFileManager", "List directories on top"));
     99        m_pListDirectoriesOnTopCheckBox->setToolTip(QApplication::translate("UIFileManager", "List directories before files"));
     100    }
    124101
    125 void UIFileManagerLogPanel::prepareWidgets()
    126 {
    127     if (!mainLayout())
    128         return;
    129     m_pLogTextEdit = new UIFileManagerLogViewer;
    130     if (m_pLogTextEdit)
     102    if (m_pDeleteConfirmationCheckBox)
    131103    {
    132         mainLayout()->addWidget(m_pLogTextEdit);
     104        m_pDeleteConfirmationCheckBox->setText(QApplication::translate("UIFileManager", "Ask before delete"));
     105        m_pDeleteConfirmationCheckBox->setToolTip(QApplication::translate("UIFileManager", "Show a confirmation dialog "
     106                                                                                "before deleting files and directories"));
     107    }
     108
     109    if (m_pHumanReabableSizesCheckBox)
     110    {
     111        m_pHumanReabableSizesCheckBox->setText(QApplication::translate("UIFileManager", "Human readable sizes"));
     112        m_pHumanReabableSizesCheckBox->setToolTip(QApplication::translate("UIFileManager", "Show file/directory sizes in human "
     113                                                                                "readable format rather than in bytes"));
     114    }
     115
     116    if (m_pShowHiddenObjectsCheckBox)
     117    {
     118        m_pShowHiddenObjectsCheckBox->setText(QApplication::translate("UIFileManager", "Show hidden objects"));
     119        m_pShowHiddenObjectsCheckBox->setToolTip(QApplication::translate("UIFileManager", "Show hidden files/directories"));
    133120    }
    134121}
    135122
    136 void UIFileManagerLogPanel::prepareConnections()
    137 {
    138 }
    139 
    140 void UIFileManagerLogPanel::retranslateUi()
    141 {
    142     UIDialogPanel::retranslateUi();
    143 
    144 }
    145123
    146124
    147 #include "UIFileManagerLogPanel.moc"
     125#include "UIFileManagerPanel.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIFileManagerPanel.h

    r100868 r100879  
    2626 */
    2727
    28 #ifndef FEQT_INCLUDED_SRC_guestctrl_UIFileManagerLogPanel_h
    29 #define FEQT_INCLUDED_SRC_guestctrl_UIFileManagerLogPanel_h
     28#ifndef FEQT_INCLUDED_SRC_guestctrl_UIFileManagerPanel_h
     29#define FEQT_INCLUDED_SRC_guestctrl_UIFileManagerPanel_h
    3030#ifndef RT_WITHOUT_PRAGMA_ONCE
    3131# pragma once
     
    3434/* GUI includes: */
    3535#include "UIGuestControlDefs.h"
    36 #include "UIDialogPanel.h"
     36#include "QIWithRetranslateUI.h"
     37/* Forward declarations: */
     38class QTabWidget;
     39class QCheckBox;
    3740
    38 /* Forward declarations: */
    39 class QTextEdit;
    40 class UIFileManager;
    41 
    42 /** UIDialogPanel extension to display file manager logs. */
    43 class UIFileManagerLogPanel : public UIDialogPanel
     41class UIFileManagerPanel : public QIWithRetranslateUI<QWidget>
    4442{
    4543    Q_OBJECT;
    4644
     45signals:
     46
     47    void sigListDirectoryCheckBoxToogled(bool bChecked);
     48    void sigDeleteConfirmationCheckBoxToogled(bool bChecked);
     49    void sigHumanReabableSizesCheckBoxToogled(bool bChecked);
     50    void sigShowHiddenObjectsCheckBoxToggled(bool bChecked);
     51
    4752public:
    4853
    49     UIFileManagerLogPanel(QWidget *pParent = 0);
    50     void appendLog(const QString &str, const QString &strMachineName, FileManagerLogType eLogType);
    51     virtual QString panelName() const RT_OVERRIDE;
     54    UIFileManagerPanel(QWidget *pParent = 0);
    5255
    5356protected:
    5457
    55     virtual void prepareWidgets() RT_OVERRIDE;
    56     virtual void prepareConnections() RT_OVERRIDE;
    57 
    58     /** Handles the translation event. */
    59     void retranslateUi();
     58    virtual void retranslateUi() final override;
    6059
    6160private slots:
     
    6463private:
    6564
    66     QTextEdit *m_pLogTextEdit;
     65    void prepare();
     66    void preparePreferencesTab();
     67    QTabWidget   *m_pTabWidget;
     68
     69    /** @name Preferences tab
     70     * @{ */
     71        QWidget    *m_pPreferencesTab;
     72        QCheckBox  *m_pListDirectoriesOnTopCheckBox;
     73        QCheckBox  *m_pDeleteConfirmationCheckBox;
     74        QCheckBox  *m_pHumanReabableSizesCheckBox;
     75        QCheckBox  *m_pShowHiddenObjectsCheckBox;
     76    /** @} */
     77
     78
    6779};
    6880
    69 #endif /* !FEQT_INCLUDED_SRC_guestctrl_UIFileManagerLogPanel_h */
     81#endif /* !FEQT_INCLUDED_SRC_guestctrl_UIFileManagerPanel_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/viso/UIVisoCreator.cpp

    r100876 r100879  
    9393    QILineEdit   *m_pCustomOptionsLineEdit;
    9494    QCheckBox    *m_pShowHiddenObjectsCheckBox;
    95     QILabel      *m_pShowHiddenObjectsLabel;
    9695    QGridLayout  *m_pVisoOptionsGridLayout;
    9796};
     
    110109    , m_pCustomOptionsLineEdit(0)
    111110    , m_pShowHiddenObjectsCheckBox(0)
    112     , m_pShowHiddenObjectsLabel(0)
    113111    , m_pVisoOptionsGridLayout(0)
    114112{
     
    172170    QHBoxLayout *pShowHiddenObjectsLayout = new QHBoxLayout;
    173171    m_pShowHiddenObjectsCheckBox = new QCheckBox;
    174     m_pShowHiddenObjectsLabel = new QILabel(QApplication::translate("UIVisoCreatorWidget", "Show Hidden Objects:"));
    175     m_pShowHiddenObjectsLabel->setBuddy(m_pShowHiddenObjectsCheckBox);
    176     pShowHiddenObjectsLayout->addWidget(m_pShowHiddenObjectsLabel);
    177172    pShowHiddenObjectsLayout->addWidget(m_pShowHiddenObjectsCheckBox);
    178173    pShowHiddenObjectsLayout->addStretch(1);
     
    202197    if (m_pCustomOptionsLineEdit)
    203198        m_pCustomOptionsLineEdit->setToolTip(QApplication::translate("UIVisoCreatorWidget", "The list of suctom options delimited with ';'."));
    204     if (m_pShowHiddenObjectsLabel)
    205         m_pShowHiddenObjectsLabel->setText(QApplication::translate("UIVisoCreatorWidget", "Show Hidden Objects:"));
    206199    if (m_pShowHiddenObjectsCheckBox)
     200    {
    207201        m_pShowHiddenObjectsCheckBox->setToolTip(QApplication::translate("UIVisoCreatorWidget", "When checked, "
    208202                                                                         "multiple hidden objects are shown in the file browser"));
     203        m_pShowHiddenObjectsCheckBox->setText(QApplication::translate("UIVisoCreatorWidget", "Show Hidden Objects"));
     204    }
    209205
    210206    //m_pVisoOptionsGridLayout->setColumnMinimumWidth(0, iLabelWidth);
Note: See TracChangeset for help on using the changeset viewer.

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