VirtualBox

Changeset 75220 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Nov 2, 2018 8:07:11 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699. Moving 'session creation' and 'log' widgets to panels

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
9 edited
8 copied

Legend:

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

    r75209 r75220  
    841841        src/guestctrl/UIGuestControlFileManager.h \
    842842        src/guestctrl/UIGuestControlFileManagerDialog.h \
     843        src/guestctrl/UIGuestControlFileManagerPanel.h \
     844        src/guestctrl/UIGuestControlFileManagerSessionPanel.h \
     845        src/guestctrl/UIGuestControlFileManagerLogPanel.h \
     846        src/guestctrl/UIGuestControlFileManagerSettingsPanel.h \
    843847        src/guestctrl/UIGuestControlFileModel.h \
    844848        src/guestctrl/UIGuestControlFileTable.h \
     
    992996        src/guestctrl/UIGuestControlFileManager.h \
    993997        src/guestctrl/UIGuestControlFileManagerDialog.h \
     998        src/guestctrl/UIGuestControlFileManagerPanel.h \
     999        src/guestctrl/UIGuestControlFileManagerSessionPanel.h \
     1000        src/guestctrl/UIGuestControlFileManagerLogPanel.h \
     1001        src/guestctrl/UIGuestControlFileManagerSettingsPanel.h \
    9941002        src/guestctrl/UIGuestControlFileModel.h \
    9951003        src/guestctrl/UIGuestControlFileTable.h \
     
    12151223        src/runtime/UIIndicatorsPool.cpp \
    12161224        src/guestctrl/UIGuestControlFileManager.cpp \
     1225        src/guestctrl/UIGuestControlFileManagerAccounPanel.cpp \
     1226        src/guestctrl/UIGuestControlFileManagerLogPanel.cpp \
    12171227        src/guestctrl/UIGuestControlFileTable.cpp \
    12181228        src/guestctrl/UIGuestFileTable.cpp \
     
    12651275        src/runtime/UIIndicatorsPool.cpp \
    12661276        src/guestctrl/UIGuestControlFileManager.cpp \
     1277        src/guestctrl/UIGuestControlFileManagerSessionPanel.cpp \
     1278        src/guestctrl/UIGuestControlFileManagerLogPanel.cpp \
    12671279        src/guestctrl/UIGuestControlFileTable.cpp \
    12681280        src/guestctrl/UIGuestFileTable.cpp \
     
    15401552        src/guestctrl/UIGuestControlFileManager.cpp \
    15411553        src/guestctrl/UIGuestControlFileManagerDialog.cpp \
     1554        src/guestctrl/UIGuestControlFileManagerPanel.cpp \
     1555        src/guestctrl/UIGuestControlFileManagerSessionPanel.cpp \
     1556        src/guestctrl/UIGuestControlFileManagerLogPanel.cpp \
     1557        src/guestctrl/UIGuestControlFileManagerSettingsPanel.cpp \
    15421558        src/guestctrl/UIGuestControlFileModel.cpp \
    15431559        src/guestctrl/UIGuestControlFileTable.cpp \
     
    17141730        src/guestctrl/UIGuestControlFileManager.cpp \
    17151731        src/guestctrl/UIGuestControlFileManagerDialog.cpp \
     1732        src/guestctrl/UIGuestControlFileManagerPanel.cpp \
     1733        src/guestctrl/UIGuestControlFileManagerSessionPanel.cpp \
     1734        src/guestctrl/UIGuestControlFileManagerLogPanel.cpp \
     1735        src/guestctrl/UIGuestControlFileManagerSettingsPanel.cpp \
    17161736        src/guestctrl/UIGuestControlFileModel.cpp \
    17171737        src/guestctrl/UIGuestControlFileTable.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.cpp

    r75209 r75220  
    15581558    virtual void retranslateUi() /* override */
    15591559    {
    1560         setName(QApplication::translate("UIActionPool", "Copy the selected object(s) from host to guest"));
     1560        setName(QApplication::translate("UIActionPool", "Copy to guest"));
    15611561        setShortcutScope(QApplication::translate("UIActionPool", "Guest Control File Manager"));
    15621562        setToolTip(QApplication::translate("UIActionPool", "Copy the Selected Object(s) from Host to Guest"));
     
    15941594    virtual void retranslateUi() /* override */
    15951595    {
    1596         setName(QApplication::translate("UIActionPool", "Copy the selected object(s) from guest to host"));
     1596        setName(QApplication::translate("UIActionPool", "Copy to host"));
    15971597        setShortcutScope(QApplication::translate("UIActionPool", "Guest Control File Manager"));
    15981598        setToolTip(QApplication::translate("UIActionPool", "Copy the Selected Object(s) from Guest to Host"));
     
    16011601};
    16021602
    1603 
    1604 /** Simple action extension, used as 'File Manager Settings' in guest control file manager action class. */
    1605 class UIActionMenuGuestControlFileManagerSettings : public UIActionSimple
     1603/** Toggle action extension, used to toggle 'File Manager Settings' panel in guest control file manager. */
     1604class UIActionMenuGuestControlFileManagerSettings : public UIActionToggle
    16061605{
    16071606    Q_OBJECT;
     
    16111610    /** Constructs action passing @a pParent to the base-class. */
    16121611    UIActionMenuGuestControlFileManagerSettings(UIActionPool *pParent)
    1613         : UIActionSimple(pParent, ":/vm_delete_32px.png", ":/vm_delete_disabled_32px.png")
    1614     {}
    1615 
    1616 protected:
    1617 
    1618     /** Returns shortcut extra-data ID. */
    1619     virtual QString shortcutExtraDataID() const /* override */
    1620     {
    1621         return QString("FileManagerSettings");
     1612        : UIActionToggle(pParent,
     1613                         ":/log_viewer_bookmark_32px.png", ":/log_viewer_bookmark_disabled_32px.png")
     1614    {
     1615        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     1616    }
     1617
     1618protected:
     1619
     1620    /** Returns shortcut extra-data ID. */
     1621    virtual QString shortcutExtraDataID() const /* override */
     1622    {
     1623        return QString("ToggleFileManagerSettingsPanel");
    16221624    }
    16231625
     
    16321634    {
    16331635        setName(QApplication::translate("UIActionPool", "Settings"));
    1634         setShortcutScope(QApplication::translate("UIActionPool", "Guest Control File Manager"));
    1635         setStatusTip(QApplication::translate("UIActionPool", "Modify file manager settings"));
    1636         setToolTip(QApplication::translate("UIActionPool", "Modify File Manager Settings"));
    1637     }
    1638 };
     1636        setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
     1637        setStatusTip(QApplication::translate("UIActionPool", "Open panel with file manager settings"));
     1638        setToolTip(QApplication::translate("UIActionPool", "Open Panel With File Manager Settings"));
     1639    }
     1640};
     1641
     1642/** Toggle action extension, used to toggle 'File Manager Log' panel in guest control file manager. */
     1643class UIActionMenuGuestControlFileManagerLog : public UIActionToggle
     1644{
     1645    Q_OBJECT;
     1646
     1647public:
     1648
     1649    /** Constructs action passing @a pParent to the base-class. */
     1650    UIActionMenuGuestControlFileManagerLog(UIActionPool *pParent)
     1651        : UIActionToggle(pParent,
     1652                         ":/log_viewer_bookmark_32px.png", ":/log_viewer_bookmark_disabled_32px.png")
     1653    {
     1654        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     1655    }
     1656
     1657protected:
     1658
     1659    /** Returns shortcut extra-data ID. */
     1660    virtual QString shortcutExtraDataID() const /* override */
     1661    {
     1662        return QString("ToggleFileManagerLogPanel");
     1663    }
     1664
     1665    /** Returns default shortcut. */
     1666    virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
     1667    {
     1668        return QKeySequence();
     1669    }
     1670
     1671    /** Handles translation event. */
     1672    virtual void retranslateUi() /* override */
     1673    {
     1674        setName(QApplication::translate("UIActionPool", "Log"));
     1675        setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
     1676        setStatusTip(QApplication::translate("UIActionPool", "Open panel with to view file manager log"));
     1677        setToolTip(QApplication::translate("UIActionPool", "Open Panel With to View File Manager Log"));
     1678    }
     1679};
     1680
     1681/** Toggle action extension, used to toggle 'File Manager File Operations' panel in guest control file manager. */
     1682class UIActionMenuGuestControlFileManagerFileOperations : public UIActionToggle
     1683{
     1684    Q_OBJECT;
     1685
     1686public:
     1687
     1688    /** Constructs action passing @a pParent to the base-class. */
     1689    UIActionMenuGuestControlFileManagerFileOperations(UIActionPool *pParent)
     1690        : UIActionToggle(pParent,
     1691                         ":/log_viewer_bookmark_32px.png", ":/log_viewer_bookmark_disabled_32px.png")
     1692    {
     1693        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     1694    }
     1695
     1696protected:
     1697
     1698    /** Returns shortcut extra-data ID. */
     1699    virtual QString shortcutExtraDataID() const /* override */
     1700    {
     1701        return QString("ToggleFileManagerFileOperationsPanel");
     1702    }
     1703
     1704    /** Returns default shortcut. */
     1705    virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
     1706    {
     1707        return QKeySequence();
     1708    }
     1709
     1710    /** Handles translation event. */
     1711    virtual void retranslateUi() /* override */
     1712    {
     1713        setName(QApplication::translate("UIActionPool", "File Operations"));
     1714        setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
     1715        setStatusTip(QApplication::translate("UIActionPool", "Open panel with to view file manager file operations"));
     1716        setToolTip(QApplication::translate("UIActionPool", "Open Panel With to View File Manager File Operations"));
     1717    }
     1718};
     1719
     1720/** Toggle action extension, used to toggle 'File Manager Session' panel in guest control file manager. */
     1721class UIActionMenuGuestControlFileManagerSession : public UIActionToggle
     1722{
     1723    Q_OBJECT;
     1724
     1725public:
     1726
     1727    /** Constructs action passing @a pParent to the base-class. */
     1728    UIActionMenuGuestControlFileManagerSession(UIActionPool *pParent)
     1729        : UIActionToggle(pParent,
     1730                         ":/log_viewer_bookmark_32px.png", ":/log_viewer_bookmark_disabled_32px.png")
     1731    {
     1732        setShortcutContext(Qt::WidgetWithChildrenShortcut);
     1733    }
     1734
     1735protected:
     1736
     1737    /** Returns shortcut extra-data ID. */
     1738    virtual QString shortcutExtraDataID() const /* override */
     1739    {
     1740        return QString("ToggleFileManagerSessionPanel");
     1741    }
     1742
     1743    /** Returns default shortcut. */
     1744    virtual QKeySequence defaultShortcut(UIActionPoolType) const /* override */
     1745    {
     1746        return QKeySequence();
     1747    }
     1748
     1749    /** Handles translation event. */
     1750    virtual void retranslateUi() /* override */
     1751    {
     1752        setName(QApplication::translate("UIActionPool", "Session"));
     1753        setShortcutScope(QApplication::translate("UIActionPool", "File Manager"));
     1754        setStatusTip(QApplication::translate("UIActionPool", "Open file manager account"));
     1755        setToolTip(QApplication::translate("UIActionPool", "Open File Manager Session"));
     1756    }
     1757};
     1758
    16391759/** Simple action extension, used as 'Perform GoUp' in guest control file manager action class. */
    16401760class UIActionMenuGuestControlFileManagerGoUp : public UIActionSimple
     
    22832403    m_pool[UIActionIndex_M_GuestControlFileManager_S_CopyToHost] = new  UIActionMenuGuestControlFileManagerCopyToHost(this);
    22842404
    2285     m_pool[UIActionIndex_M_GuestControlFileManager_S_Settings] = new UIActionMenuGuestControlFileManagerSettings(this);
     2405    m_pool[UIActionIndex_M_GuestControlFileManager_T_Settings] = new UIActionMenuGuestControlFileManagerSettings(this);
     2406    m_pool[UIActionIndex_M_GuestControlFileManager_T_Log] = new UIActionMenuGuestControlFileManagerLog(this);
     2407    m_pool[UIActionIndex_M_GuestControlFileManager_T_FileOperations] = new UIActionMenuGuestControlFileManagerFileOperations(this);
     2408    m_pool[UIActionIndex_M_GuestControlFileManager_T_Session] = new UIActionMenuGuestControlFileManagerSession(this);
     2409
    22862410    m_pool[UIActionIndex_M_GuestControlFileManager_S_Host_GoUp] = new UIActionMenuGuestControlFileManagerGoUp(this);
    22872411    m_pool[UIActionIndex_M_GuestControlFileManager_S_Guest_GoUp] = new UIActionMenuGuestControlFileManagerGoUp(this);
     
    26272751void UIActionPool::updateMenuGuestControlFileManagerWrapper(UIMenu *pMenu)
    26282752{
    2629     addAction(pMenu, action(UIActionIndex_M_GuestControlFileManager_S_Settings));
     2753    addAction(pMenu, action(UIActionIndex_M_GuestControlFileManager_T_Settings));
    26302754    addAction(pMenu, action(UIActionIndex_M_GuestControlFileManager_M_HostSubmenu));
    26312755    addAction(pMenu, action(UIActionIndex_M_GuestControlFileManager_M_GuestSubmenu));
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h

    r75209 r75220  
    104104    UIActionIndex_M_GuestControlFileManager_S_CopyToGuest,
    105105    UIActionIndex_M_GuestControlFileManager_S_CopyToHost,
    106     UIActionIndex_M_GuestControlFileManager_S_Settings,
     106    UIActionIndex_M_GuestControlFileManager_T_Settings,
     107    UIActionIndex_M_GuestControlFileManager_T_Log,
     108    UIActionIndex_M_GuestControlFileManager_T_FileOperations,
     109    UIActionIndex_M_GuestControlFileManager_T_Session,
    107110    UIActionIndex_M_GuestControlFileManager_S_Host_GoUp,
    108111    UIActionIndex_M_GuestControlFileManager_S_Guest_GoUp,
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManager.cpp

    r75196 r75220  
    2727# include <QTextEdit>
    2828# include <QPushButton>
    29 # include <QSplitter>
    3029# include <QGridLayout>
    3130
     
    4241# include "UIGuestControlConsole.h"
    4342# include "UIGuestControlFileManager.h"
     43# include "UIGuestControlFileManagerSessionPanel.h"
     44# include "UIGuestControlFileManagerSettingsPanel.h"
     45# include "UIGuestControlFileManagerLogPanel.h"
    4446# include "UIGuestFileTable.h"
    4547# include "UIGuestControlInterface.h"
     
    5860#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    5961
    60 /*********************************************************************************************************************************
    61 *   UIFileManagerLogViewer definition.                                                                                   *
    62 *********************************************************************************************************************************/
    63 
    64 class UIFileManagerLogViewer : public QTextEdit
    65 {
    66 
    67     Q_OBJECT;
    68 
    69 public:
    70 
    71     UIFileManagerLogViewer(QWidget *pParent = 0);
    72 
    73 protected:
    74 
    75     virtual void contextMenuEvent(QContextMenuEvent * event) /* override */;
    76 
    77 private slots:
    78 
    79     void sltClear();
    80 };
     62
    8163
    8264/*********************************************************************************************************************************
     
    9476};
    9577
    96 /*********************************************************************************************************************************
    97 *   UIGuestSessionCreateWidget definition.                                                                                   *
    98 *********************************************************************************************************************************/
    99 
    100 class UIGuestSessionCreateWidget : public QIWithRetranslateUI<QWidget>
    101 {
    102     Q_OBJECT;
    103 
    104 signals:
    105 
    106     void sigCreateSession(QString strUserName, QString strPassword);
    107     void sigCloseButtonClick();
    108 
    109 public:
    110 
    111     UIGuestSessionCreateWidget(QWidget *pParent = 0);
    112     void switchSessionCreateMode();
    113     void switchSessionCloseMode();
    114 
    115 protected:
    116 
    117     void retranslateUi();
    118     void keyPressEvent(QKeyEvent * pEvent);
    119 
    120 private slots:
    121 
    122     void sltCreateButtonClick();
    123     void sltShowHidePassword(bool flag);
    124 
    125 private:
    126     void         prepareWidgets();
    127     QILineEdit   *m_pUserNameEdit;
    128     QILineEdit   *m_pPasswordEdit;
    129     QPushButton  *m_pCreateButton;
    130     QPushButton  *m_pCloseButton;
    131     QHBoxLayout  *m_pMainLayout;
    132     QCheckBox    *m_pShowPasswordCheckBox;
    133 
    134 };
    135 
    136 /*********************************************************************************************************************************
    137 *   UIFileManagerLogViewer implementation.                                                                                   *
    138 *********************************************************************************************************************************/
    139 
    140 UIFileManagerLogViewer::UIFileManagerLogViewer(QWidget *pParent /* = 0 */)
    141     :QTextEdit(pParent)
    142 {
    143 }
    144 
    145 void UIFileManagerLogViewer::contextMenuEvent(QContextMenuEvent *event)
    146 {
    147     QMenu *menu = createStandardContextMenu();
    148     void sltClear();
    149 
    150     QAction *pClearAction = menu->addAction(tr("Clear"));
    151     connect(pClearAction, &QAction::triggered, this, &UIFileManagerLogViewer::sltClear);
    152     menu->exec(event->globalPos());
    153     delete menu;
    154 }
    155 
    156 void UIFileManagerLogViewer::sltClear()
    157 {
    158     clear();
    159 }
    160 
    16178
    16279/*********************************************************************************************************************************
     
    16885UIGuestControlFileManagerSettings* UIGuestControlFileManagerSettings::instance()
    16986{
     87    if (!m_pInstance)
     88    m_pInstance = new UIGuestControlFileManagerSettings;
    17089    return m_pInstance;
    17190}
     
    205124
    206125/*********************************************************************************************************************************
    207 *   UIGuestSessionCreateWidget implementation.                                                                                   *
    208 *********************************************************************************************************************************/
    209 
    210 UIGuestSessionCreateWidget::UIGuestSessionCreateWidget(QWidget *pParent /* = 0 */)
    211     : QIWithRetranslateUI<QWidget>(pParent)
    212     , m_pUserNameEdit(0)
    213     , m_pPasswordEdit(0)
    214     , m_pCreateButton(0)
    215     , m_pCloseButton(0)
    216     , m_pMainLayout(0)
    217     , m_pShowPasswordCheckBox(0)
    218 {
    219     prepareWidgets();
    220 }
    221 
    222 void UIGuestSessionCreateWidget::prepareWidgets()
    223 {
    224     m_pMainLayout = new QHBoxLayout(this);
    225     if (!m_pMainLayout)
    226         return;
    227 
    228     m_pUserNameEdit = new QILineEdit;
    229     if (m_pUserNameEdit)
    230     {
    231         m_pMainLayout->addWidget(m_pUserNameEdit, 2);
    232         m_pUserNameEdit->setPlaceholderText("User Name");
    233     }
    234 
    235     m_pPasswordEdit = new QILineEdit;
    236     if (m_pPasswordEdit)
    237     {
    238         m_pMainLayout->addWidget(m_pPasswordEdit, 2);
    239         m_pPasswordEdit->setPlaceholderText("Password");
    240         m_pPasswordEdit->setEchoMode(QLineEdit::Password);
    241     }
    242 
    243     m_pShowPasswordCheckBox = new QCheckBox;
    244     if (m_pShowPasswordCheckBox)
    245     {
    246         m_pShowPasswordCheckBox->setText("Show Password");
    247         m_pMainLayout->addWidget(m_pShowPasswordCheckBox);
    248         connect(m_pShowPasswordCheckBox, &QCheckBox::toggled,
    249                 this, &UIGuestSessionCreateWidget::sltShowHidePassword);
    250     }
    251 
    252     m_pCreateButton = new QPushButton;
    253     if (m_pCreateButton)
    254     {
    255         m_pMainLayout->addWidget(m_pCreateButton);
    256         connect(m_pCreateButton, &QPushButton::clicked, this, &UIGuestSessionCreateWidget::sltCreateButtonClick);
    257     }
    258 
    259     m_pCloseButton = new QPushButton;
    260     if (m_pCloseButton)
    261     {
    262         m_pMainLayout->addWidget(m_pCloseButton);
    263         connect(m_pCloseButton, &QPushButton::clicked, this, &UIGuestSessionCreateWidget::sigCloseButtonClick);
    264     }
    265     m_pMainLayout->insertStretch(-1, 1);
    266     retranslateUi();
    267 }
    268 
    269 void UIGuestSessionCreateWidget::sltCreateButtonClick()
    270 {
    271     if (m_pUserNameEdit && m_pPasswordEdit)
    272         emit sigCreateSession(m_pUserNameEdit->text(), m_pPasswordEdit->text());
    273 }
    274 
    275 void UIGuestSessionCreateWidget::sltShowHidePassword(bool flag)
    276 {
    277     if (!m_pPasswordEdit)
    278         return;
    279     if (flag)
    280         m_pPasswordEdit->setEchoMode(QLineEdit::Normal);
    281     else
    282         m_pPasswordEdit->setEchoMode(QLineEdit::Password);
    283 }
    284 
    285 void UIGuestSessionCreateWidget::retranslateUi()
    286 {
    287     if (m_pUserNameEdit)
    288     {
    289         m_pUserNameEdit->setToolTip(QApplication::translate("UIGuestProcessControlWidget", "User name to authenticate session creation"));
    290         m_pUserNameEdit->setPlaceholderText(QApplication::translate("UIGuestProcessControlWidget", "User Name"));
    291 
    292     }
    293     if (m_pPasswordEdit)
    294     {
    295         m_pPasswordEdit->setToolTip(QApplication::translate("UIGuestProcessControlWidget", "Password to authenticate session creation"));
    296         m_pPasswordEdit->setPlaceholderText(QApplication::translate("UIGuestProcessControlWidget", "Password"));
    297     }
    298 
    299     if (m_pCreateButton)
    300         m_pCreateButton->setText(QApplication::translate("UIGuestProcessControlWidget", "Create Session"));
    301     if (m_pCloseButton)
    302         m_pCloseButton->setText(QApplication::translate("UIGuestProcessControlWidget", "Close Session"));
    303 }
    304 
    305 void UIGuestSessionCreateWidget::keyPressEvent(QKeyEvent * pEvent)
    306 {
    307     /* Emit sigCreateSession upon enter press: */
    308     if (pEvent->key() == Qt::Key_Enter || pEvent->key() == Qt::Key_Return)
    309     {
    310         if ((m_pUserNameEdit && m_pUserNameEdit->hasFocus()) ||
    311             (m_pPasswordEdit && m_pPasswordEdit->hasFocus()))
    312             sigCreateSession(m_pUserNameEdit->text(), m_pPasswordEdit->text());
    313     }
    314     QWidget::keyPressEvent(pEvent);
    315 }
    316 
    317 void UIGuestSessionCreateWidget::switchSessionCreateMode()
    318 {
    319     if (m_pUserNameEdit)
    320         m_pUserNameEdit->setEnabled(true);
    321     if (m_pPasswordEdit)
    322         m_pPasswordEdit->setEnabled(true);
    323     if (m_pCreateButton)
    324         m_pCreateButton->setEnabled(true);
    325     if (m_pCloseButton)
    326         m_pCloseButton->setEnabled(false);
    327 }
    328 
    329 void UIGuestSessionCreateWidget::switchSessionCloseMode()
    330 {
    331     if (m_pUserNameEdit)
    332         m_pUserNameEdit->setEnabled(false);
    333     if (m_pPasswordEdit)
    334         m_pPasswordEdit->setEnabled(false);
    335     if (m_pCreateButton)
    336         m_pCreateButton->setEnabled(false);
    337     if (m_pCloseButton)
    338         m_pCloseButton->setEnabled(true);
    339 }
    340 
    341 
    342 /*********************************************************************************************************************************
    343126*   UIGuestControlFileManager implementation.                                                                                    *
    344127*********************************************************************************************************************************/
    345128
    346129UIGuestControlFileManager::UIGuestControlFileManager(EmbedTo enmEmbedding, UIActionPool *pActionPool,
    347                                                      const CGuest &comGuest, QWidget *pParent)
     130                                                     const CGuest &comGuest, QWidget *pParent, bool fShowToolbar /* = true */)
    348131    : QIWithRetranslateUI<QWidget>(pParent)
    349132    , m_iMaxRecursionDepth(1)
    350133    , m_comGuest(comGuest)
    351134    , m_pMainLayout(0)
    352     , m_pVerticalSplitter(0)
    353     , m_pLogOutput(0)
    354135    , m_pToolBar(0)
    355136    , m_pFileTableContainerWidget(0)
    356137    , m_pFileTableContainerLayout(0)
    357     , m_pTabWidget(0)
    358     , m_pFileOperationsList(0)
    359     , m_pSessionCreateWidget(0)
    360138    , m_pGuestFileTable(0)
    361139    , m_pHostFileTable(0)
    362140    , m_enmEmbedding(enmEmbedding)
    363141    , m_pActionPool(pActionPool)
     142    , m_fShowToolbar(fShowToolbar)
     143    , m_pSettingsPanel(0)
     144    , m_pLogPanel(0)
     145    , m_pSessionPanel(0)
    364146{
    365147    prepareGuestListener();
     
    390172void UIGuestControlFileManager::retranslateUi()
    391173{
    392     m_pTabWidget->setTabText(0, QApplication::translate("UIGuestProcessControlWidget", "Log"));
    393     m_pTabWidget->setTabText(1, QApplication::translate("UIGuestProcessControlWidget", "File Operations"));
    394     m_pTabWidget->setTabText(2, QApplication::translate("UIGuestProcessControlWidget", "Terminal"));
    395174}
    396175
     
    417196    m_pMainLayout->setSpacing(0);
    418197
    419     m_pSessionCreateWidget = new UIGuestSessionCreateWidget();
    420     if (m_pSessionCreateWidget)
    421     {
    422         m_pMainLayout->addWidget(m_pSessionCreateWidget);
    423     }
    424 
    425     m_pVerticalSplitter = new QSplitter;
    426     if (m_pVerticalSplitter)
    427     {
    428         m_pMainLayout->addWidget(m_pVerticalSplitter);
    429         m_pVerticalSplitter->setOrientation(Qt::Vertical);
    430         m_pVerticalSplitter->setHandleWidth(4);
    431     }
     198    if (m_fShowToolbar)
     199        prepareToolBar();
     200
     201    // m_pSessionCreateWidget = new UIGuestSessionCreateWidget();
     202    // if (m_pSessionCreateWidget)
     203    // {
     204    //     m_pMainLayout->addWidget(m_pSessionCreateWidget);
     205    // }
    432206
    433207    m_pFileTableContainerWidget = new QWidget;
     
    451225                m_pFileTableContainerLayout->addWidget(m_pHostFileTable);
    452226            }
    453             prepareToolBar();
     227            prepareVerticalToolBar();
    454228             if (m_pGuestFileTable)
    455229            {
     
    460234
    461235        }
    462         m_pVerticalSplitter->addWidget(m_pFileTableContainerWidget);
    463     }
    464 
    465     m_pTabWidget = new QITabWidget;
    466     if (m_pTabWidget)
    467     {
    468         m_pVerticalSplitter->addWidget(m_pTabWidget);
    469         m_pTabWidget->setTabPosition(QTabWidget::South);
    470     }
    471 
    472     m_pLogOutput = new UIFileManagerLogViewer;
    473     if (m_pLogOutput)
    474     {
    475         m_pTabWidget->addTab(m_pLogOutput, "Log");
    476         m_pLogOutput->setReadOnly(true);
    477     }
    478 
    479     m_pFileOperationsList = new UIFileOperationsList;
    480     if (m_pFileOperationsList)
    481     {
    482         m_pTabWidget->addTab(m_pFileOperationsList, "File Operatiions");
    483         m_pFileOperationsList->header()->hide();
    484     }
    485 
    486     m_pVerticalSplitter->setStretchFactor(0, 3);
    487     m_pVerticalSplitter->setStretchFactor(1, 1);
    488 }
    489 
    490 void UIGuestControlFileManager::prepareToolBar()
     236        m_pMainLayout->addWidget(m_pFileTableContainerWidget);
     237    }
     238
     239    // m_pFileOperationsList = new UIFileOperationsList;
     240    // if (m_pFileOperationsList)
     241    // {
     242    //     m_pTabWidget->addTab(m_pFileOperationsList, "File Operatiions");
     243    //     m_pFileOperationsList->header()->hide();
     244    // }
     245
     246    /* Create the settings-panel: */
     247    m_pLogPanel = new UIGuestControlFileManagerLogPanel(this /* manager dialog */, 0 /*parent */);
     248    if (m_pLogPanel)
     249    {
     250        /* Configure panel: */
     251        m_pLogPanel->hide();
     252        m_panelActionMap.insert(m_pLogPanel, m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Log));
     253        /* Add into layout: */
     254        m_pMainLayout->addWidget(m_pLogPanel);
     255    }
     256    m_pSessionPanel = new UIGuestControlFileManagerSessionPanel(this /* manager dialog */, 0 /*parent */);
     257    if (m_pSessionPanel)
     258    {
     259        /* Configure panel: */
     260        m_pSessionPanel->hide();
     261        m_panelActionMap.insert(m_pSessionPanel, m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Session));
     262        /* Add into layout: */
     263        m_pMainLayout->addWidget(m_pSessionPanel);
     264    }
     265
     266    /* Create the settings-panel: */
     267    m_pSettingsPanel =
     268        new UIGuestControlFileManagerSettingsPanel(this /* manager dialog */,
     269                                                   0 /*parent */, UIGuestControlFileManagerSettings::instance());
     270    if (m_pSettingsPanel)
     271    {
     272        /* Configure panel: */
     273        m_pSettingsPanel->hide();
     274        m_panelActionMap.insert(m_pSettingsPanel, m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Settings));
     275        connect(m_pSettingsPanel, &UIGuestControlFileManagerSettingsPanel::sigListDirectoriesFirstChanged,
     276                this, &UIGuestControlFileManager::sltListDirectoriesBeforeChanged);
     277        /* Add into layout: */
     278        m_pMainLayout->addWidget(m_pSettingsPanel);
     279    }
     280
     281}
     282
     283void UIGuestControlFileManager::prepareVerticalToolBar()
    491284{
    492285    m_pToolBar = new UIToolBar;
     
    525318                this, &UIGuestControlFileManager::sltGuestSessionUnregistered);
    526319    }
    527     if (m_pSessionCreateWidget)
    528     {
    529         connect(m_pSessionCreateWidget, &UIGuestSessionCreateWidget::sigCreateSession,
     320    if (m_pSessionPanel)
     321    {
     322        connect(m_pSessionPanel, &UIGuestControlFileManagerSessionPanel::sigCreateSession,
    530323                this, &UIGuestControlFileManager::sltCreateSession);
    531         connect(m_pSessionCreateWidget, &UIGuestSessionCreateWidget::sigCloseButtonClick,
     324        connect(m_pSessionPanel, &UIGuestControlFileManagerSessionPanel::sigCloseSession,
    532325                this, &UIGuestControlFileManager::sltCloseSession);
    533326    }
    534327}
     328
     329void UIGuestControlFileManager::prepareToolBar()
     330{
     331    /* Create toolbar: */
     332    m_pToolBar = new UIToolBar(parentWidget());
     333    if (m_pToolBar)
     334    {
     335        /* Configure toolbar: */
     336        const int iIconMetric = (int)(QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize));
     337        m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
     338        m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
     339
     340        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Session));
     341        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Settings));
     342        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Log));
     343        m_pToolBar->addAction(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_FileOperations));
     344
     345        connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Settings), &QAction::toggled,
     346                this, &UIGuestControlFileManager::sltPanelActionToggled);
     347        connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Log), &QAction::toggled,
     348                this, &UIGuestControlFileManager::sltPanelActionToggled);
     349        connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Session), &QAction::toggled,
     350                this, &UIGuestControlFileManager::sltPanelActionToggled);
     351
     352#ifdef VBOX_WS_MAC
     353        /* Check whether we are embedded into a stack: */
     354        if (m_enmEmbedding == EmbedTo_Stack)
     355        {
     356            /* Add into layout: */
     357            m_pMainLayout->addWidget(m_pToolBar);
     358        }
     359#else
     360        /* Add into layout: */
     361        m_pMainLayout->addWidget(m_pToolBar);
     362#endif
     363    }
     364}
     365
    535366
    536367void UIGuestControlFileManager::sltGuestSessionUnregistered(CGuestSession guestSession)
     
    549380    if (!UIGuestControlInterface::isGuestAdditionsAvailable(m_comGuest))
    550381    {
    551         if (m_pLogOutput)
    552         {
    553             m_pLogOutput->append("Could not find Guest Additions");
    554             postSessionClosed();
    555             return;
    556         }
     382        appendLog("Could not find Guest Additions");
     383        postSessionClosed();
     384        return;
    557385    }
    558386    if (strUserName.isEmpty())
    559387    {
    560         if (m_pLogOutput)
    561             m_pLogOutput->append("No user name is given");
     388        appendLog("No user name is given");
    562389        return;
    563390    }
     
    569396    if (!m_comGuestSession.isOk())
    570397    {
    571         m_pLogOutput->append("Guest session is not valid");
     398        appendLog("Guest session is not valid");
    572399        postSessionClosed();
    573400        return;
     
    580407
    581408    m_comGuestSession.Close();
    582     m_pLogOutput->append("Guest session is closed");
     409    appendLog("Guest session is closed");
    583410    postSessionClosed();
    584411}
     
    590417        CVirtualBoxErrorInfo cErrorInfo = cEvent.GetError();
    591418        if (cErrorInfo.isOk())
    592         {
    593             m_pLogOutput->append(cErrorInfo.GetText());
    594         }
     419            appendLog(cErrorInfo.GetText());
    595420    }
    596421    if (m_comGuestSession.GetStatus() == KGuestSessionStatus_Started)
     
    601426    else
    602427    {
    603         m_pLogOutput->append("Session status has changed");
     428        appendLog("Session status has changed");
    604429    }
    605430}
     
    607432void UIGuestControlFileManager::sltReceieveLogOutput(QString strOutput)
    608433{
    609     if (m_pLogOutput)
    610         m_pLogOutput->append(strOutput);
     434    appendLog(strOutput);
    611435}
    612436
     
    629453}
    630454
     455void UIGuestControlFileManager::sltPanelActionToggled(bool fChecked)
     456{
     457    QAction *pSenderAction = qobject_cast<QAction*>(sender());
     458    if (!pSenderAction)
     459        return;
     460    UIGuestControlFileManagerPanel* pPanel = 0;
     461    /* Look for the sender() within the m_panelActionMap's values: */
     462    for (QMap<UIGuestControlFileManagerPanel*, QAction*>::const_iterator iterator = m_panelActionMap.begin();
     463        iterator != m_panelActionMap.end(); ++iterator)
     464    {
     465        if (iterator.value() == pSenderAction)
     466            pPanel = iterator.key();
     467    }
     468    if (!pPanel)
     469        return;
     470    if (fChecked)
     471        showPanel(pPanel);
     472    else
     473        hidePanel(pPanel);
     474}
     475
     476void UIGuestControlFileManager::sltListDirectoriesBeforeChanged()
     477{
     478    if (m_pGuestFileTable)
     479        m_pGuestFileTable->relist();
     480    if (m_pHostFileTable)
     481        m_pHostFileTable->relist();
     482}
     483
    631484void UIGuestControlFileManager::initFileTable()
    632485{
     
    640493void UIGuestControlFileManager::postSessionCreated()
    641494{
    642     if (m_pSessionCreateWidget)
    643         m_pSessionCreateWidget->switchSessionCloseMode();
     495    if (m_pSessionPanel)
     496        m_pSessionPanel->switchSessionCloseMode();
    644497    if (m_pGuestFileTable)
    645498        m_pGuestFileTable->setEnabled(true);
     
    650503void UIGuestControlFileManager::postSessionClosed()
    651504{
    652     if (m_pSessionCreateWidget)
    653         m_pSessionCreateWidget->switchSessionCreateMode();
     505    if (m_pSessionPanel)
     506        m_pSessionPanel->switchSessionCreateMode();
    654507    if (m_pGuestFileTable)
    655508        m_pGuestFileTable->setEnabled(false);
     
    670523    if (!m_comGuestSession.isOk())
    671524    {
    672         m_pLogOutput->append(UIErrorString::formatErrorInfo(m_comGuestSession));
     525        appendLog(UIErrorString::formatErrorInfo(m_comGuestSession));
    673526        return false;
    674527    }
    675 
    676     m_pLogOutput->append("Guest session has been created");
    677     if (m_pSessionCreateWidget)
    678         m_pSessionCreateWidget->switchSessionCloseMode();
     528    appendLog("Guest session has been created");
     529    if (m_pSessionPanel)
     530        m_pSessionPanel->switchSessionCloseMode();
    679531
    680532    /* Prepare session listener */
     
    693545     /* Wait session to start. For some reason we cannot get GuestSessionStatusChanged event
    694546        consistently. So we wait: */
    695     m_pLogOutput->append("Waiting the session to start");
     547    appendLog("Waiting the session to start");
    696548    const ULONG waitTimeout = 2000;
    697549    KGuestSessionWaitResult waitResult = m_comGuestSession.WaitFor(KGuestSessionWaitForFlag_Start, waitTimeout);
    698550    if (waitResult != KGuestSessionWaitResult_Start)
    699551    {
    700         m_pLogOutput->append("The session did not start");
     552        appendLog("The session did not start");
    701553        sltCloseSession();
    702554        return false;
     
    763615void UIGuestControlFileManager::saveSettings()
    764616{
    765     if (!m_pVerticalSplitter)
    766         return;
    767     gEDataManager->setGuestControlFileManagerSplitterHints(m_pVerticalSplitter->sizes());
    768617}
    769618
    770619void UIGuestControlFileManager::loadSettings()
    771620{
    772     if (!m_pVerticalSplitter)
    773         return;
    774     QList<int> splitterHints = gEDataManager->guestControlFileManagerSplitterHints();
    775     if (splitterHints.size() != 2)
    776         return;
    777     if (splitterHints[0] != 0 && splitterHints[1] != 0)
    778         m_pVerticalSplitter->setSizes(splitterHints);
     621}
     622
     623void UIGuestControlFileManager::hidePanel(UIGuestControlFileManagerPanel* panel)
     624{
     625    if (panel && panel->isVisible())
     626        panel->setVisible(false);
     627    QMap<UIGuestControlFileManagerPanel*, QAction*>::iterator iterator = m_panelActionMap.find(panel);
     628    if (iterator != m_panelActionMap.end())
     629    {
     630        if (iterator.value() && iterator.value()->isChecked())
     631            iterator.value()->setChecked(false);
     632    }
     633    m_visiblePanelsList.removeOne(panel);
     634    manageEscapeShortCut();
     635}
     636
     637void UIGuestControlFileManager::showPanel(UIGuestControlFileManagerPanel* panel)
     638{
     639    if (panel && panel->isHidden())
     640        panel->setVisible(true);
     641    QMap<UIGuestControlFileManagerPanel*, QAction*>::iterator iterator = m_panelActionMap.find(panel);
     642    if (iterator != m_panelActionMap.end())
     643    {
     644        if (!iterator.value()->isChecked())
     645            iterator.value()->setChecked(true);
     646    }
     647    m_visiblePanelsList.push_back(panel);
     648    manageEscapeShortCut();
     649}
     650
     651void UIGuestControlFileManager::manageEscapeShortCut()
     652{
     653    /* if there is no visible panels give the escape shortcut to parent dialog: */
     654    if (m_visiblePanelsList.isEmpty())
     655    {
     656        emit sigSetCloseButtonShortCut(QKeySequence(Qt::Key_Escape));
     657        return;
     658    }
     659    /* Take the escape shortcut from the dialog: */
     660    emit sigSetCloseButtonShortCut(QKeySequence());
     661    /* Just loop thru the visible panel list and set the esc key to the
     662       panel which made visible latest */
     663    for (int i = 0; i < m_visiblePanelsList.size() - 1; ++i)
     664    {
     665        m_visiblePanelsList[i]->setCloseButtonShortCut(QKeySequence());
     666    }
     667    m_visiblePanelsList.back()->setCloseButtonShortCut(QKeySequence(Qt::Key_Escape));
     668}
     669
     670void UIGuestControlFileManager::appendLog(const QString &strLog)
     671{
     672    if (!m_pLogPanel)
     673        return;
     674    m_pLogPanel->appendLog(strLog);
    779675}
    780676
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManager.h

    r75202 r75220  
    3838class QTextEdit;
    3939class QVBoxLayout;
    40 class QSplitter;
    4140class QITabWidget;
    4241class CGuestSessionStateChangedEvent;
     
    4544class UIGuestControlConsole;
    4645class UIGuestControlInterface;
     46class UIGuestControlFileManagerPanel;
     47class UIGuestControlFileManagerSessionPanel;
     48class UIGuestControlFileManagerLogPanel;
     49class UIGuestControlFileManagerSettingsPanel;
    4750class UIGuestFileTable;
    4851class UIHostFileTable;
     
    5053class UIToolBar;
    5154
     55/** A Utility class to manage file  manager settings. */
    5256class UIGuestControlFileManagerSettings
    5357{
     58
    5459public:
     60
    5561    static UIGuestControlFileManagerSettings* instance();
    5662    static void create();
     
    5965    bool bListDirectoriesOnTop;
    6066    bool bAskDeleteConfirmation;
     67
    6168private:
    6269    UIGuestControlFileManagerSettings();
     
    7683
    7784    UIGuestControlFileManager(EmbedTo enmEmbedding, UIActionPool *pActionPool,
    78                               const CGuest &comGuest, QWidget *pParent);
     85                              const CGuest &comGuest, QWidget *pParent, bool fShowToolbar = true);
    7986    ~UIGuestControlFileManager();
    8087    QMenu *menu() const;
    81     //const UIGuestControlFileManagerSettings& settings() const;
     88
     89signals:
     90
     91    void sigSetCloseButtonShortCut(QKeySequence);
    8292
    8393protected:
     
    94104    void sltCopyGuestToHost();
    95105    void sltCopyHostToGuest();
     106    void sltPanelActionToggled(bool fChecked);
     107    void sltListDirectoriesBeforeChanged();
    96108
    97109private:
     
    100112    void prepareGuestListener();
    101113    void prepareConnections();
     114    void prepareVerticalToolBar();
    102115    void prepareToolBar();
    103116    bool createSession(const QString& strUserName, const QString& strPassword,
     
    117130    void saveSettings();
    118131    void loadSettings();
     132    void hidePanel(UIGuestControlFileManagerPanel *panel);
     133    void showPanel(UIGuestControlFileManagerPanel *panel);
     134    /** Make sure escape key is assigned to only a single widget. This is done by checking
     135        several things in the following order:
     136        - when there are no more panels visible assign it to the parent dialog
     137        - grab it from the dialog as soon as a panel becomes visible again
     138        - assigned it to the most recently "unhidden" panel */
     139    void manageEscapeShortCut();
     140
    119141
    120142    template<typename T>
    121143    QStringList       getFsObjInfoStringList(const T &fsObjectInfo) const;
    122 
     144    void              appendLog(const QString &strLog);
    123145    const int                   m_iMaxRecursionDepth;
    124146    CGuest                      m_comGuest;
    125147    CGuestSession               m_comGuestSession;
    126148    QVBoxLayout                *m_pMainLayout;
    127     QSplitter                  *m_pVerticalSplitter;
    128     QTextEdit                  *m_pLogOutput;
     149
    129150    UIToolBar                  *m_pToolBar;
    130151    QWidget                    *m_pFileTableContainerWidget;
    131152    QHBoxLayout                *m_pFileTableContainerLayout;
    132     QITabWidget                *m_pTabWidget;
    133153
    134     UIFileOperationsList       *m_pFileOperationsList;
     154    //UIFileOperationsList       *m_pFileOperationsList;
    135155    UIGuestControlConsole      *m_pConsole;
    136156    UIGuestControlInterface    *m_pControlInterface;
    137     /* m_pSessionCreateWidget is a QWidget extension enabling user to start/stop
    138     * a Guest Control session with password/username fields etc.. */
    139     UIGuestSessionCreateWidget *m_pSessionCreateWidget;
     157    // /* m_pSessionCreateWidget is a QWidget extension enabling user to start/stop
     158    // * a Guest Control session with password/username fields etc.. */
     159    // UIGuestSessionCreateWidget *m_pSessionCreateWidget;
    140160    UIGuestFileTable           *m_pGuestFileTable;
    141161    UIHostFileTable            *m_pHostFileTable;
     
    147167    const EmbedTo  m_enmEmbedding;
    148168    UIActionPool  *m_pActionPool;
    149 
    150     //UIGuestControlFileManagerSettings m_settings;
     169    const bool     m_fShowToolbar;
     170    QMap<UIGuestControlFileManagerPanel*, QAction*> m_panelActionMap;
     171    QList<UIGuestControlFileManagerPanel*>          m_visiblePanelsList;
     172    UIGuestControlFileManagerSettingsPanel         *m_pSettingsPanel;
     173    UIGuestControlFileManagerLogPanel              *m_pLogPanel;
     174    UIGuestControlFileManagerSessionPanel          *m_pSessionPanel;
     175    friend class UIGuestControlFileManagerSettingsPanel;
     176    friend class UIGuestControlFileManagerPanel;
    151177};
    152178
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerLogPanel.cpp

    r75195 r75220  
    2121
    2222/* Qt includes: */
    23 # include <QComboBox>
    2423# include <QHBoxLayout>
    25 # include <QFontDatabase>
    26 # include <QFontDialog>
    27 # include <QCheckBox>
    28 # include <QLabel>
     24# include <QMenu>
    2925# include <QSpinBox>
     26# include <QTextEdit>
    3027
    3128/* GUI includes: */
    3229# include "QIToolButton.h"
    3330# include "UIIconPool.h"
    34 # include "UIVMLogViewerSettingsPanel.h"
    35 # include "UIVMLogViewerWidget.h"
     31# include "UIGuestControlFileManager.h"
     32# include "UIGuestControlFileManagerLogPanel.h"
    3633
    3734#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    3835
    3936
    40 UIVMLogViewerSettingsPanel::UIVMLogViewerSettingsPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer)
    41     : UIVMLogViewerPanel(pParent, pViewer)
    42     , m_pLineNumberCheckBox(0)
    43     , m_pWrapLinesCheckBox(0)
    44     , m_pFontSizeSpinBox(0)
    45     , m_pFontSizeLabel(0)
    46     , m_pOpenFontDialogButton(0)
    47     , m_pResetToDefaultsButton(0)
    48     , m_iDefaultFontSize(9)
     37/*********************************************************************************************************************************
     38*   UIFileManagerLogViewer definition.                                                                                   *
     39*********************************************************************************************************************************/
     40
     41class UIFileManagerLogViewer : public QTextEdit
     42{
     43
     44    Q_OBJECT;
     45
     46public:
     47
     48    UIFileManagerLogViewer(QWidget *pParent = 0);
     49
     50protected:
     51
     52    virtual void contextMenuEvent(QContextMenuEvent * event) /* override */;
     53
     54private slots:
     55
     56    void sltClear();
     57};
     58
     59/*********************************************************************************************************************************
     60*   UIFileManagerLogViewer implementation.                                                                                   *
     61*********************************************************************************************************************************/
     62
     63UIFileManagerLogViewer::UIFileManagerLogViewer(QWidget *pParent /* = 0 */)
     64    :QTextEdit(pParent)
     65{
     66}
     67
     68void UIFileManagerLogViewer::contextMenuEvent(QContextMenuEvent *event)
     69{
     70    QMenu *menu = createStandardContextMenu();
     71    void sltClear();
     72
     73    QAction *pClearAction = menu->addAction(tr("Clear"));
     74    connect(pClearAction, &QAction::triggered, this, &UIFileManagerLogViewer::sltClear);
     75    menu->exec(event->globalPos());
     76    delete menu;
     77}
     78
     79void UIFileManagerLogViewer::sltClear()
     80{
     81    clear();
     82}
     83
     84
     85/*********************************************************************************************************************************
     86*   UIGuestControlFileManagerLogPanel implementation.                                                                            *
     87*********************************************************************************************************************************/
     88
     89UIGuestControlFileManagerLogPanel::UIGuestControlFileManagerLogPanel(UIGuestControlFileManager *pManagerWidget, QWidget *pParent)
     90    : UIGuestControlFileManagerPanel(pManagerWidget, pParent)
     91    , m_pLogTextEdit(0)
    4992{
    5093    prepare();
    5194}
    5295
    53 void UIVMLogViewerSettingsPanel::setShowLineNumbers(bool bShowLineNumbers)
    54 {
    55     if (!m_pLineNumberCheckBox)
    56         return;
    57     if (m_pLineNumberCheckBox->isChecked() == bShowLineNumbers)
    58         return;
    59     m_pLineNumberCheckBox->setChecked(bShowLineNumbers);
    60 }
    61 
    62 void UIVMLogViewerSettingsPanel::setWrapLines(bool bWrapLines)
    63 {
    64     if (!m_pWrapLinesCheckBox)
    65         return;
    66     if (m_pWrapLinesCheckBox->isChecked() == bWrapLines)
    67         return;
    68     m_pWrapLinesCheckBox->setChecked(bWrapLines);
    69 }
    70 
    71 void UIVMLogViewerSettingsPanel::setFontSizeInPoints(int fontSizeInPoints)
    72 {
    73     if (!m_pFontSizeSpinBox)
    74         return;
    75     if (m_pFontSizeSpinBox->value() == fontSizeInPoints)
    76         return;
    77     m_pFontSizeSpinBox->setValue(fontSizeInPoints);
    78 }
    79 
    80 void UIVMLogViewerSettingsPanel::prepareWidgets()
     96void UIGuestControlFileManagerLogPanel::prepareWidgets()
    8197{
    8298    if (!mainLayout())
    8399        return;
    84 
    85     /* Create line-number check-box: */
    86     m_pLineNumberCheckBox = new QCheckBox;
    87     if (m_pLineNumberCheckBox)
     100    m_pLogTextEdit = new UIFileManagerLogViewer;
     101    if (m_pLogTextEdit)
    88102    {
    89         m_pLineNumberCheckBox->setChecked(true);
    90         mainLayout()->addWidget(m_pLineNumberCheckBox, 0, Qt::AlignLeft);
     103        mainLayout()->addWidget(m_pLogTextEdit);
    91104    }
    92105
    93     /* Create wrap-lines check-box: */
    94     m_pWrapLinesCheckBox = new QCheckBox;
    95     if (m_pWrapLinesCheckBox)
    96     {
    97         m_pWrapLinesCheckBox->setChecked(false);
    98         mainLayout()->addWidget(m_pWrapLinesCheckBox, 0, Qt::AlignLeft);
    99     }
    100 
    101     /* Create font-size spin-box: */
    102     m_pFontSizeSpinBox = new QSpinBox;
    103     if (m_pFontSizeSpinBox)
    104     {
    105         mainLayout()->addWidget(m_pFontSizeSpinBox, 0, Qt::AlignLeft);
    106         m_pFontSizeSpinBox->setValue(m_iDefaultFontSize);
    107         m_pFontSizeSpinBox->setMaximum(44);
    108         m_pFontSizeSpinBox->setMinimum(6);
    109     }
    110 
    111     /* Create font-size label: */
    112     m_pFontSizeLabel = new QLabel;
    113     if (m_pFontSizeLabel)
    114     {
    115         mainLayout()->addWidget(m_pFontSizeLabel, 0, Qt::AlignLeft);
    116     }
    117 
    118     /* Create combo/button layout: */
    119     QHBoxLayout *pButtonLayout = new QHBoxLayout;
    120     if (pButtonLayout)
    121     {
    122         pButtonLayout->setContentsMargins(0, 0, 0, 0);
    123         pButtonLayout->setSpacing(0);
    124 
    125         /* Create open font dialog button: */
    126         m_pOpenFontDialogButton = new QIToolButton;
    127         if (m_pOpenFontDialogButton)
    128         {
    129             pButtonLayout->addWidget(m_pOpenFontDialogButton, 0);
    130             m_pOpenFontDialogButton->setIcon(UIIconPool::iconSet(":/log_viewer_choose_font_16px.png"));
    131         }
    132 
    133         /* Create reset font to default button: */
    134         m_pResetToDefaultsButton = new QIToolButton;
    135         if (m_pResetToDefaultsButton)
    136         {
    137             pButtonLayout->addWidget(m_pResetToDefaultsButton, 0);
    138             m_pResetToDefaultsButton->setIcon(UIIconPool::iconSet(":/log_viewer_reset_font_16px.png"));
    139         }
    140 
    141         mainLayout()->addLayout(pButtonLayout);
    142     }
    143 
    144     mainLayout()->addStretch(2);
    145106}
    146107
    147 void UIVMLogViewerSettingsPanel::prepareConnections()
     108void UIGuestControlFileManagerLogPanel::prepareConnections()
    148109{
    149     if (m_pLineNumberCheckBox)
    150         connect(m_pLineNumberCheckBox, &QCheckBox::toggled, this, &UIVMLogViewerSettingsPanel::sigShowLineNumbers);
    151     if (m_pWrapLinesCheckBox)
    152         connect(m_pWrapLinesCheckBox, &QCheckBox::toggled, this, &UIVMLogViewerSettingsPanel::sigWrapLines);
    153     if (m_pFontSizeSpinBox)
    154         connect(m_pFontSizeSpinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged),
    155                 this, &UIVMLogViewerSettingsPanel::sigChangeFontSizeInPoints);
    156     if (m_pOpenFontDialogButton)
    157         connect(m_pOpenFontDialogButton, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sltOpenFontDialog);
    158     if (m_pResetToDefaultsButton)
    159         connect(m_pResetToDefaultsButton, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sigResetToDefaults);
    160110}
    161111
    162 void UIVMLogViewerSettingsPanel::retranslateUi()
     112void UIGuestControlFileManagerLogPanel::retranslateUi()
    163113{
    164     UIVMLogViewerPanel::retranslateUi();
     114    UIGuestControlFileManagerPanel::retranslateUi();
    165115
    166     m_pLineNumberCheckBox->setText(UIVMLogViewerWidget::tr("Show Line Numbers"));
    167     m_pLineNumberCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, show line numbers"));
    168 
    169     m_pWrapLinesCheckBox->setText(UIVMLogViewerWidget::tr("Wrap Lines"));
    170     m_pWrapLinesCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, wrap lines"));
    171 
    172     m_pFontSizeLabel->setText(UIVMLogViewerWidget::tr("Font Size"));
    173     m_pFontSizeSpinBox->setToolTip(UIVMLogViewerWidget::tr("Log viewer font size"));
    174 
    175     m_pOpenFontDialogButton->setToolTip(UIVMLogViewerWidget::tr("Open a font dialog to select font face for the logviewer"));
    176     m_pResetToDefaultsButton->setToolTip(UIVMLogViewerWidget::tr("Reset settings to application defaults"));
    177116}
    178117
    179 void UIVMLogViewerSettingsPanel::sltOpenFontDialog()
     118void UIGuestControlFileManagerLogPanel::appendLog(const QString &strLog)
    180119{
    181     QFont currentFont;
    182     UIVMLogViewerWidget* parentWidget = qobject_cast<UIVMLogViewerWidget*>(parent());
    183     if (!parentWidget)
     120    if (!m_pLogTextEdit)
    184121        return;
     122    m_pLogTextEdit->append(strLog);
     123}
    185124
    186     currentFont = parentWidget->currentFont();
    187     bool ok;
    188     QFont font =
    189         QFontDialog::getFont(&ok, currentFont, this, "Logviewer font");
    190 
    191     if (ok)
    192         emit sigChangeFont(font);
    193 }
     125#include "UIGuestControlFileManagerLogPanel.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerLogPanel.h

    r75195 r75220  
    1616 */
    1717
    18 #ifndef ___UIVMLogViewerSettingssPanel_h___
    19 #define ___UIVMLogViewerSettingssPanel_h___
     18#ifndef ___UIGuestControlFileManagerLogPanel_h___
     19#define ___UIGuestControlFileManagerLogPanel_h___
    2020
    2121/* GUI includes: */
    22 #include "UIVMLogViewerPanel.h"
     22#include "UIGuestControlFileManagerPanel.h"
    2323
    2424/* Forward declarations: */
    25 class QCheckBox;
    26 class QSpinBox;
    27 class QLabel;
    28 class QIToolButton;
    29 class UIVMLogViewerWidget;
     25class QTextEdit;
     26class UIGuestControlFileManager;
    3027
    3128/** UIVMLogViewerPanel extension providing GUI to manage logviewer settings. */
    32 class UIVMLogViewerSettingsPanel : public UIVMLogViewerPanel
     29class UIGuestControlFileManagerLogPanel : public UIGuestControlFileManagerPanel
    3330{
    3431    Q_OBJECT;
     32
     33public:
     34
     35    UIGuestControlFileManagerLogPanel(UIGuestControlFileManager *pManagerWidget, QWidget *pParent);
     36
     37    void appendLog(const QString &str);
    3538
    3639signals:
     
    4144    void sigChangeFont(QFont font);
    4245    void sigResetToDefaults();
    43 
    44 public:
    45 
    46     UIVMLogViewerSettingsPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer);
    47 
    48     void setShowLineNumbers(bool bShowLineNumbers);
    49     void setWrapLines(bool bWrapLines);
    50     void setFontSizeInPoints(int fontSizeInPoints);
    51 
    52 public slots:
    53 
    5446
    5547protected:
     
    6355private slots:
    6456
    65     void sltOpenFontDialog();
    6657
    6758private:
    6859
    69     QCheckBox    *m_pLineNumberCheckBox;
    70     QCheckBox    *m_pWrapLinesCheckBox;
    71     QSpinBox     *m_pFontSizeSpinBox;
    72     QLabel       *m_pFontSizeLabel;
    73     QIToolButton *m_pOpenFontDialogButton;
    74     QIToolButton *m_pResetToDefaultsButton;
    75 
    76     /** Default font size in points. */
    77     const int    m_iDefaultFontSize;
    78 
     60    QTextEdit *m_pLogTextEdit;
    7961};
    8062
    81 #endif /* !___UIVMLogViewerSettingsPanel_h___ */
     63#endif /* !___UIGuestControlFileManagerLogPanel_h___ */
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerPanel.cpp

    r75195 r75220  
    3131# include "QIToolButton.h"
    3232# include "UIIconPool.h"
    33 # include "UIVMLogPage.h"
    34 # include "UIVMLogViewerPanel.h"
    35 # include "UIVMLogViewerWidget.h"
     33# include "UIGuestControlFileManager.h"
     34# include "UIGuestControlFileManagerPanel.h"
    3635# ifdef VBOX_WS_MAC
    3736#  include "VBoxUtils-darwin.h"
     
    4039
    4140
    42 UIVMLogViewerPanel::UIVMLogViewerPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer)
     41UIGuestControlFileManagerPanel::UIGuestControlFileManagerPanel(UIGuestControlFileManager *pManagerWidget, QWidget *pParent)
    4342    : QIWithRetranslateUI<QWidget>(pParent)
    44     , m_pViewer(pViewer)
    4543    , m_pMainLayout(0)
    4644    , m_pCloseButton(0)
     45    , m_pFileManager(pManagerWidget)
    4746{
    4847    prepare();
    4948}
    5049
    51 void UIVMLogViewerPanel::setCloseButtonShortCut(QKeySequence shortCut)
     50void UIGuestControlFileManagerPanel::setCloseButtonShortCut(QKeySequence shortCut)
    5251{
    5352    if (!m_pCloseButton)
     
    5655}
    5756
    58 UIVMLogViewerWidget* UIVMLogViewerPanel::viewer()
    59 {
    60     return m_pViewer;
    61 }
    62 
    63 const UIVMLogViewerWidget* UIVMLogViewerPanel::viewer() const
    64 {
    65     return m_pViewer;
    66 }
    67 
    68 QHBoxLayout* UIVMLogViewerPanel::mainLayout()
     57QHBoxLayout* UIGuestControlFileManagerPanel::mainLayout()
    6958{
    7059    return m_pMainLayout;
    7160}
    7261
    73 void UIVMLogViewerPanel::prepare()
     62void UIGuestControlFileManagerPanel::prepare()
    7463{
    7564    prepareWidgets();
     
    7867}
    7968
    80 void UIVMLogViewerPanel::prepareWidgets()
     69void UIGuestControlFileManagerPanel::prepareWidgets()
    8170{
    8271    m_pMainLayout = new QHBoxLayout(this);
     
    10190}
    10291
    103 void UIVMLogViewerPanel::prepareConnections()
     92void UIGuestControlFileManagerPanel::prepareConnections()
    10493{
    10594    if (m_pCloseButton)
    106         connect(m_pCloseButton, &QIToolButton::clicked, this, &UIVMLogViewerPanel::hide);
     95        connect(m_pCloseButton, &QIToolButton::clicked, this, &UIGuestControlFileManagerPanel::hide);
    10796}
    10897
    109 void UIVMLogViewerPanel::retranslateUi()
     98void UIGuestControlFileManagerPanel::retranslateUi()
    11099{
    111100    if (m_pCloseButton)
    112         m_pCloseButton->setToolTip(UIVMLogViewerWidget::tr("Close the pane"));
     101        m_pCloseButton->setToolTip(UIGuestControlFileManager::tr("Close the pane"));
    113102}
    114103
    115 bool UIVMLogViewerPanel::eventFilter(QObject *pObject, QEvent *pEvent)
     104bool UIGuestControlFileManagerPanel::eventFilter(QObject *pObject, QEvent *pEvent)
    116105{
    117106    Q_UNUSED(pObject);
     
    121110}
    122111
    123 void UIVMLogViewerPanel::showEvent(QShowEvent *pEvent)
     112void UIGuestControlFileManagerPanel::showEvent(QShowEvent *pEvent)
    124113{
    125114    QWidget::showEvent(pEvent);
    126115}
    127116
    128 void UIVMLogViewerPanel::hideEvent(QHideEvent *pEvent)
     117void UIGuestControlFileManagerPanel::hideEvent(QHideEvent *pEvent)
    129118{
    130119    /* Get focused widget: */
     
    134123    if (pFocus && pFocus->parent() == this)
    135124        focusNextPrevChild(true);
    136     if (m_pViewer)
    137         m_pViewer->hidePanel(this);
     125    if (m_pFileManager)
     126        m_pFileManager->hidePanel(this);
    138127
    139128    QWidget::hideEvent(pEvent);
    140129}
    141 
    142 QTextDocument  *UIVMLogViewerPanel::textDocument()
    143 {
    144     QPlainTextEdit *pEdit = textEdit();
    145     if (!pEdit)
    146         return 0;
    147     return textEdit()->document();
    148 }
    149 
    150 QPlainTextEdit *UIVMLogViewerPanel::textEdit()
    151 {
    152     if (!viewer())
    153         return 0;
    154     UIVMLogPage *logPage = viewer()->currentLogPage();
    155     if (!logPage)
    156         return 0;
    157     return logPage->textEdit();
    158 }
    159 
    160 const QString* UIVMLogViewerPanel::logString() const
    161 {
    162     if (!viewer())
    163         return 0;
    164     const UIVMLogPage* const page = qobject_cast<const UIVMLogPage* const>(viewer()->currentLogPage());
    165     if (!page)
    166         return 0;
    167     return &(page->logString());
    168 }
    169 
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerPanel.h

    r75195 r75220  
    1616 */
    1717
    18 #ifndef ___UIVMLogViewerPanel_h___
    19 #define ___UIVMLogViewerPanel_h___
     18#ifndef ___UIGuestControlFileManagerPanel_h___
     19#define ___UIGuestControlFileManagerPanel_h___
    2020
    2121/* Qt includes: */
     
    3030class QTextDocument;
    3131class QIToolButton;
    32 class UIVMLogViewerWidget;
    33 
     32class UIGuestControlFileManager;
    3433
    3534/** QWidget extension acting as the base class for UIVMLogViewerXXXPanel widgets. */
    36 class UIVMLogViewerPanel : public QIWithRetranslateUI<QWidget>
     35class UIGuestControlFileManagerPanel : public QIWithRetranslateUI<QWidget>
    3736{
    3837    Q_OBJECT;
     
    4039public:
    4140
    42     UIVMLogViewerPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer);
     41    UIGuestControlFileManagerPanel(UIGuestControlFileManager *pManagerWidget, QWidget *pParent);
    4342    void setCloseButtonShortCut(QKeySequence shortCut);
    4443
     
    5049
    5150    /* Access functions for children classes. */
    52     UIVMLogViewerWidget*       viewer();
    53     const UIVMLogViewerWidget* viewer() const;
    5451    QHBoxLayout*               mainLayout();
    5552
     
    6461    void hideEvent(QHideEvent *pEvent);
    6562
    66     QTextDocument  *textDocument();
    67     QPlainTextEdit *textEdit();
    6863    /* Return the unmodified log. */
    6964    const QString* logString() const;
     
    7267
    7368    /** Holds the reference to VM Log-Viewer this panel belongs to. */
    74     UIVMLogViewerWidget *m_pViewer;
    7569    QHBoxLayout         *m_pMainLayout;
    7670    QIToolButton        *m_pCloseButton;
     71    UIGuestControlFileManager *m_pFileManager;
    7772};
    7873
    79 #endif /* !___UIVMLogViewerPanel!_h___ */
    80 
     74#endif /* !___UIGuestControlFileManagerPanel!_h___ */
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerSessionPanel.cpp

    r75195 r75220  
    2121
    2222/* Qt includes: */
    23 # include <QComboBox>
     23# include <QCheckBox>
    2424# include <QHBoxLayout>
    25 # include <QFontDatabase>
    26 # include <QFontDialog>
    27 # include <QCheckBox>
    28 # include <QLabel>
     25# include <QMenu>
     26# include <QPushButton>
    2927# include <QSpinBox>
     28# include <QTextEdit>
    3029
    3130/* GUI includes: */
     31# include "QILineEdit.h"
    3232# include "QIToolButton.h"
    3333# include "UIIconPool.h"
    34 # include "UIVMLogViewerSettingsPanel.h"
    35 # include "UIVMLogViewerWidget.h"
     34# include "UIGuestControlFileManager.h"
     35# include "UIGuestControlFileManagerSessionPanel.h"
    3636
    3737#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    3838
    3939
    40 UIVMLogViewerSettingsPanel::UIVMLogViewerSettingsPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer)
    41     : UIVMLogViewerPanel(pParent, pViewer)
    42     , m_pLineNumberCheckBox(0)
    43     , m_pWrapLinesCheckBox(0)
    44     , m_pFontSizeSpinBox(0)
    45     , m_pFontSizeLabel(0)
    46     , m_pOpenFontDialogButton(0)
    47     , m_pResetToDefaultsButton(0)
    48     , m_iDefaultFontSize(9)
     40/*********************************************************************************************************************************
     41*   UIGuestSessionCreateWidget definition.                                                                                   *
     42*********************************************************************************************************************************/
     43
     44class UIGuestSessionCreateWidget : public QIWithRetranslateUI<QWidget>
     45{
     46    Q_OBJECT;
     47
     48signals:
     49
     50    void sigCreateSession(QString strUserName, QString strPassword);
     51    void sigCloseSession();
     52
     53public:
     54
     55    UIGuestSessionCreateWidget(QWidget *pParent = 0);
     56    void switchSessionCreateMode();
     57    void switchSessionCloseMode();
     58
     59protected:
     60
     61    void retranslateUi();
     62    void keyPressEvent(QKeyEvent * pEvent);
     63
     64private slots:
     65
     66    void sltCreateButtonClick();
     67    void sltShowHidePassword(bool flag);
     68
     69private:
     70    void         prepareWidgets();
     71    QILineEdit   *m_pUserNameEdit;
     72    QILineEdit   *m_pPasswordEdit;
     73    QPushButton  *m_pCreateButton;
     74    QPushButton  *m_pCloseButton;
     75    QHBoxLayout  *m_pMainLayout;
     76    QCheckBox    *m_pShowPasswordCheckBox;
     77
     78};
     79
     80
     81/*********************************************************************************************************************************
     82*   UIGuestSessionCreateWidget implementation.                                                                                   *
     83*********************************************************************************************************************************/
     84
     85UIGuestSessionCreateWidget::UIGuestSessionCreateWidget(QWidget *pParent /* = 0 */)
     86    : QIWithRetranslateUI<QWidget>(pParent)
     87    , m_pUserNameEdit(0)
     88    , m_pPasswordEdit(0)
     89    , m_pCreateButton(0)
     90    , m_pCloseButton(0)
     91    , m_pMainLayout(0)
     92    , m_pShowPasswordCheckBox(0)
     93{
     94    prepareWidgets();
     95}
     96
     97void UIGuestSessionCreateWidget::prepareWidgets()
     98{
     99    m_pMainLayout = new QHBoxLayout(this);
     100    if (!m_pMainLayout)
     101        return;
     102
     103    m_pUserNameEdit = new QILineEdit;
     104    if (m_pUserNameEdit)
     105    {
     106        m_pMainLayout->addWidget(m_pUserNameEdit, 2);
     107        m_pUserNameEdit->setPlaceholderText("User Name");
     108    }
     109
     110    m_pPasswordEdit = new QILineEdit;
     111    if (m_pPasswordEdit)
     112    {
     113        m_pMainLayout->addWidget(m_pPasswordEdit, 2);
     114        m_pPasswordEdit->setPlaceholderText("Password");
     115        m_pPasswordEdit->setEchoMode(QLineEdit::Password);
     116    }
     117
     118    m_pShowPasswordCheckBox = new QCheckBox;
     119    if (m_pShowPasswordCheckBox)
     120    {
     121        m_pShowPasswordCheckBox->setText("Show Password");
     122        m_pMainLayout->addWidget(m_pShowPasswordCheckBox);
     123        connect(m_pShowPasswordCheckBox, &QCheckBox::toggled,
     124                this, &UIGuestSessionCreateWidget::sltShowHidePassword);
     125    }
     126
     127    m_pCreateButton = new QPushButton;
     128    if (m_pCreateButton)
     129    {
     130        m_pMainLayout->addWidget(m_pCreateButton);
     131        connect(m_pCreateButton, &QPushButton::clicked, this, &UIGuestSessionCreateWidget::sltCreateButtonClick);
     132    }
     133
     134    m_pCloseButton = new QPushButton;
     135    if (m_pCloseButton)
     136    {
     137        m_pMainLayout->addWidget(m_pCloseButton);
     138        connect(m_pCloseButton, &QPushButton::clicked, this, &UIGuestSessionCreateWidget::sigCloseSession);
     139    }
     140    m_pMainLayout->insertStretch(-1, 1);
     141    retranslateUi();
     142}
     143
     144void UIGuestSessionCreateWidget::sltCreateButtonClick()
     145{
     146    if (m_pUserNameEdit && m_pPasswordEdit)
     147        emit sigCreateSession(m_pUserNameEdit->text(), m_pPasswordEdit->text());
     148}
     149
     150void UIGuestSessionCreateWidget::sltShowHidePassword(bool flag)
     151{
     152    if (!m_pPasswordEdit)
     153        return;
     154    if (flag)
     155        m_pPasswordEdit->setEchoMode(QLineEdit::Normal);
     156    else
     157        m_pPasswordEdit->setEchoMode(QLineEdit::Password);
     158}
     159
     160void UIGuestSessionCreateWidget::retranslateUi()
     161{
     162    if (m_pUserNameEdit)
     163    {
     164        m_pUserNameEdit->setToolTip(QApplication::translate("UIGuestProcessControlWidget", "User name to authenticate session creation"));
     165        m_pUserNameEdit->setPlaceholderText(QApplication::translate("UIGuestProcessControlWidget", "User Name"));
     166
     167    }
     168    if (m_pPasswordEdit)
     169    {
     170        m_pPasswordEdit->setToolTip(QApplication::translate("UIGuestProcessControlWidget", "Password to authenticate session creation"));
     171        m_pPasswordEdit->setPlaceholderText(QApplication::translate("UIGuestProcessControlWidget", "Password"));
     172    }
     173
     174    if (m_pCreateButton)
     175        m_pCreateButton->setText(QApplication::translate("UIGuestProcessControlWidget", "Create Session"));
     176    if (m_pCloseButton)
     177        m_pCloseButton->setText(QApplication::translate("UIGuestProcessControlWidget", "Close Session"));
     178}
     179
     180void UIGuestSessionCreateWidget::keyPressEvent(QKeyEvent * pEvent)
     181{
     182    /* Emit sigCreateSession upon enter press: */
     183    if (pEvent->key() == Qt::Key_Enter || pEvent->key() == Qt::Key_Return)
     184    {
     185        if ((m_pUserNameEdit && m_pUserNameEdit->hasFocus()) ||
     186            (m_pPasswordEdit && m_pPasswordEdit->hasFocus()))
     187            sigCreateSession(m_pUserNameEdit->text(), m_pPasswordEdit->text());
     188    }
     189    QWidget::keyPressEvent(pEvent);
     190}
     191
     192void UIGuestSessionCreateWidget::switchSessionCreateMode()
     193{
     194    if (m_pUserNameEdit)
     195        m_pUserNameEdit->setEnabled(true);
     196    if (m_pPasswordEdit)
     197        m_pPasswordEdit->setEnabled(true);
     198    if (m_pCreateButton)
     199        m_pCreateButton->setEnabled(true);
     200    if (m_pCloseButton)
     201        m_pCloseButton->setEnabled(false);
     202}
     203
     204void UIGuestSessionCreateWidget::switchSessionCloseMode()
     205{
     206    if (m_pUserNameEdit)
     207        m_pUserNameEdit->setEnabled(false);
     208    if (m_pPasswordEdit)
     209        m_pPasswordEdit->setEnabled(false);
     210    if (m_pCreateButton)
     211        m_pCreateButton->setEnabled(false);
     212    if (m_pCloseButton)
     213        m_pCloseButton->setEnabled(true);
     214}
     215
     216
     217/*********************************************************************************************************************************
     218*   UIGuestControlFileManagerSessionPanel implementation.                                                                        *
     219*********************************************************************************************************************************/
     220
     221UIGuestControlFileManagerSessionPanel::UIGuestControlFileManagerSessionPanel(UIGuestControlFileManager *pManagerWidget, QWidget *pParent)
     222    : UIGuestControlFileManagerPanel(pManagerWidget, pParent)
     223    , m_pSessionCreateWidget(0)
    49224{
    50225    prepare();
    51226}
    52227
    53 void UIVMLogViewerSettingsPanel::setShowLineNumbers(bool bShowLineNumbers)
    54 {
    55     if (!m_pLineNumberCheckBox)
    56         return;
    57     if (m_pLineNumberCheckBox->isChecked() == bShowLineNumbers)
    58         return;
    59     m_pLineNumberCheckBox->setChecked(bShowLineNumbers);
    60 }
    61 
    62 void UIVMLogViewerSettingsPanel::setWrapLines(bool bWrapLines)
    63 {
    64     if (!m_pWrapLinesCheckBox)
    65         return;
    66     if (m_pWrapLinesCheckBox->isChecked() == bWrapLines)
    67         return;
    68     m_pWrapLinesCheckBox->setChecked(bWrapLines);
    69 }
    70 
    71 void UIVMLogViewerSettingsPanel::setFontSizeInPoints(int fontSizeInPoints)
    72 {
    73     if (!m_pFontSizeSpinBox)
    74         return;
    75     if (m_pFontSizeSpinBox->value() == fontSizeInPoints)
    76         return;
    77     m_pFontSizeSpinBox->setValue(fontSizeInPoints);
    78 }
    79 
    80 void UIVMLogViewerSettingsPanel::prepareWidgets()
     228void UIGuestControlFileManagerSessionPanel::switchSessionCloseMode()
     229{
     230    if (m_pSessionCreateWidget)
     231        m_pSessionCreateWidget->switchSessionCloseMode();
     232}
     233
     234void UIGuestControlFileManagerSessionPanel::switchSessionCreateMode()
     235{
     236    if (m_pSessionCreateWidget)
     237        m_pSessionCreateWidget->switchSessionCreateMode();
     238}
     239
     240void UIGuestControlFileManagerSessionPanel::prepareWidgets()
    81241{
    82242    if (!mainLayout())
    83243        return;
    84 
    85     /* Create line-number check-box: */
    86     m_pLineNumberCheckBox = new QCheckBox;
    87     if (m_pLineNumberCheckBox)
    88     {
    89         m_pLineNumberCheckBox->setChecked(true);
    90         mainLayout()->addWidget(m_pLineNumberCheckBox, 0, Qt::AlignLeft);
    91     }
    92 
    93     /* Create wrap-lines check-box: */
    94     m_pWrapLinesCheckBox = new QCheckBox;
    95     if (m_pWrapLinesCheckBox)
    96     {
    97         m_pWrapLinesCheckBox->setChecked(false);
    98         mainLayout()->addWidget(m_pWrapLinesCheckBox, 0, Qt::AlignLeft);
    99     }
    100 
    101     /* Create font-size spin-box: */
    102     m_pFontSizeSpinBox = new QSpinBox;
    103     if (m_pFontSizeSpinBox)
    104     {
    105         mainLayout()->addWidget(m_pFontSizeSpinBox, 0, Qt::AlignLeft);
    106         m_pFontSizeSpinBox->setValue(m_iDefaultFontSize);
    107         m_pFontSizeSpinBox->setMaximum(44);
    108         m_pFontSizeSpinBox->setMinimum(6);
    109     }
    110 
    111     /* Create font-size label: */
    112     m_pFontSizeLabel = new QLabel;
    113     if (m_pFontSizeLabel)
    114     {
    115         mainLayout()->addWidget(m_pFontSizeLabel, 0, Qt::AlignLeft);
    116     }
    117 
    118     /* Create combo/button layout: */
    119     QHBoxLayout *pButtonLayout = new QHBoxLayout;
    120     if (pButtonLayout)
    121     {
    122         pButtonLayout->setContentsMargins(0, 0, 0, 0);
    123         pButtonLayout->setSpacing(0);
    124 
    125         /* Create open font dialog button: */
    126         m_pOpenFontDialogButton = new QIToolButton;
    127         if (m_pOpenFontDialogButton)
    128         {
    129             pButtonLayout->addWidget(m_pOpenFontDialogButton, 0);
    130             m_pOpenFontDialogButton->setIcon(UIIconPool::iconSet(":/log_viewer_choose_font_16px.png"));
    131         }
    132 
    133         /* Create reset font to default button: */
    134         m_pResetToDefaultsButton = new QIToolButton;
    135         if (m_pResetToDefaultsButton)
    136         {
    137             pButtonLayout->addWidget(m_pResetToDefaultsButton, 0);
    138             m_pResetToDefaultsButton->setIcon(UIIconPool::iconSet(":/log_viewer_reset_font_16px.png"));
    139         }
    140 
    141         mainLayout()->addLayout(pButtonLayout);
    142     }
    143 
    144     mainLayout()->addStretch(2);
    145 }
    146 
    147 void UIVMLogViewerSettingsPanel::prepareConnections()
    148 {
    149     if (m_pLineNumberCheckBox)
    150         connect(m_pLineNumberCheckBox, &QCheckBox::toggled, this, &UIVMLogViewerSettingsPanel::sigShowLineNumbers);
    151     if (m_pWrapLinesCheckBox)
    152         connect(m_pWrapLinesCheckBox, &QCheckBox::toggled, this, &UIVMLogViewerSettingsPanel::sigWrapLines);
    153     if (m_pFontSizeSpinBox)
    154         connect(m_pFontSizeSpinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged),
    155                 this, &UIVMLogViewerSettingsPanel::sigChangeFontSizeInPoints);
    156     if (m_pOpenFontDialogButton)
    157         connect(m_pOpenFontDialogButton, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sltOpenFontDialog);
    158     if (m_pResetToDefaultsButton)
    159         connect(m_pResetToDefaultsButton, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sigResetToDefaults);
    160 }
    161 
    162 void UIVMLogViewerSettingsPanel::retranslateUi()
    163 {
    164     UIVMLogViewerPanel::retranslateUi();
    165 
    166     m_pLineNumberCheckBox->setText(UIVMLogViewerWidget::tr("Show Line Numbers"));
    167     m_pLineNumberCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, show line numbers"));
    168 
    169     m_pWrapLinesCheckBox->setText(UIVMLogViewerWidget::tr("Wrap Lines"));
    170     m_pWrapLinesCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, wrap lines"));
    171 
    172     m_pFontSizeLabel->setText(UIVMLogViewerWidget::tr("Font Size"));
    173     m_pFontSizeSpinBox->setToolTip(UIVMLogViewerWidget::tr("Log viewer font size"));
    174 
    175     m_pOpenFontDialogButton->setToolTip(UIVMLogViewerWidget::tr("Open a font dialog to select font face for the logviewer"));
    176     m_pResetToDefaultsButton->setToolTip(UIVMLogViewerWidget::tr("Reset settings to application defaults"));
    177 }
    178 
    179 void UIVMLogViewerSettingsPanel::sltOpenFontDialog()
    180 {
    181     QFont currentFont;
    182     UIVMLogViewerWidget* parentWidget = qobject_cast<UIVMLogViewerWidget*>(parent());
    183     if (!parentWidget)
    184         return;
    185 
    186     currentFont = parentWidget->currentFont();
    187     bool ok;
    188     QFont font =
    189         QFontDialog::getFont(&ok, currentFont, this, "Logviewer font");
    190 
    191     if (ok)
    192         emit sigChangeFont(font);
    193 }
     244    m_pSessionCreateWidget = new UIGuestSessionCreateWidget;
     245    if (m_pSessionCreateWidget)
     246        mainLayout()->addWidget(m_pSessionCreateWidget);
     247}
     248
     249void UIGuestControlFileManagerSessionPanel::prepareConnections()
     250{
     251    if (m_pSessionCreateWidget)
     252    {
     253        connect(m_pSessionCreateWidget, &UIGuestSessionCreateWidget::sigCreateSession,
     254                this, &UIGuestControlFileManagerSessionPanel::sigCreateSession);
     255        connect(m_pSessionCreateWidget, &UIGuestSessionCreateWidget::sigCloseSession,
     256                this, &UIGuestControlFileManagerSessionPanel::sigCloseSession);
     257    }
     258}
     259
     260void UIGuestControlFileManagerSessionPanel::retranslateUi()
     261{
     262    UIGuestControlFileManagerPanel::retranslateUi();
     263
     264}
     265
     266#include "UIGuestControlFileManagerSessionPanel.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerSessionPanel.h

    r75195 r75220  
    1616 */
    1717
    18 #ifndef ___UIVMLogViewerSettingssPanel_h___
    19 #define ___UIVMLogViewerSettingssPanel_h___
     18#ifndef ___UIGuestControlFileManagerSessionPanel_h___
     19#define ___UIGuestControlFileManagerSessionPanel_h___
    2020
    2121/* GUI includes: */
    22 #include "UIVMLogViewerPanel.h"
     22#include "UIGuestControlFileManagerPanel.h"
    2323
    2424/* Forward declarations: */
    25 class QCheckBox;
    26 class QSpinBox;
    27 class QLabel;
    28 class QIToolButton;
    29 class UIVMLogViewerWidget;
     25class QTextEdit;
     26class UIGuestControlFileManager;
     27class UIGuestSessionCreateWidget;
    3028
    3129/** UIVMLogViewerPanel extension providing GUI to manage logviewer settings. */
    32 class UIVMLogViewerSettingsPanel : public UIVMLogViewerPanel
     30class UIGuestControlFileManagerSessionPanel : public UIGuestControlFileManagerPanel
    3331{
    3432    Q_OBJECT;
    3533
     34public:
     35
     36    UIGuestControlFileManagerSessionPanel(UIGuestControlFileManager *pManagerWidget, QWidget *pParent);
     37    void switchSessionCloseMode();
     38    void switchSessionCreateMode();
     39
    3640signals:
    3741
    38     void sigShowLineNumbers(bool show);
    39     void sigWrapLines(bool show);
    40     void sigChangeFontSizeInPoints(int size);
    41     void sigChangeFont(QFont font);
    42     void sigResetToDefaults();
    43 
    44 public:
    45 
    46     UIVMLogViewerSettingsPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer);
    47 
    48     void setShowLineNumbers(bool bShowLineNumbers);
    49     void setWrapLines(bool bWrapLines);
    50     void setFontSizeInPoints(int fontSizeInPoints);
    51 
    52 public slots:
    53 
     42    void sigCreateSession(QString strUserName, QString strPassword);
     43    void sigCloseSession();
    5444
    5545protected:
     
    6353private slots:
    6454
    65     void sltOpenFontDialog();
    6655
    6756private:
    6857
    69     QCheckBox    *m_pLineNumberCheckBox;
    70     QCheckBox    *m_pWrapLinesCheckBox;
    71     QSpinBox     *m_pFontSizeSpinBox;
    72     QLabel       *m_pFontSizeLabel;
    73     QIToolButton *m_pOpenFontDialogButton;
    74     QIToolButton *m_pResetToDefaultsButton;
    75 
    76     /** Default font size in points. */
    77     const int    m_iDefaultFontSize;
    78 
     58    UIGuestSessionCreateWidget *m_pSessionCreateWidget;
    7959};
    8060
    81 #endif /* !___UIVMLogViewerSettingsPanel_h___ */
     61#endif /* !___UIGuestControlFileManagerSessionPanel_h___ */
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerSettingsPanel.cpp

    r75195 r75220  
    3232# include "QIToolButton.h"
    3333# include "UIIconPool.h"
    34 # include "UIVMLogViewerSettingsPanel.h"
    35 # include "UIVMLogViewerWidget.h"
     34# include "UIGuestControlFileManager.h"
     35# include "UIGuestControlFileManagerSettingsPanel.h"
    3636
    3737#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    3838
    3939
    40 UIVMLogViewerSettingsPanel::UIVMLogViewerSettingsPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer)
    41     : UIVMLogViewerPanel(pParent, pViewer)
    42     , m_pLineNumberCheckBox(0)
    43     , m_pWrapLinesCheckBox(0)
    44     , m_pFontSizeSpinBox(0)
    45     , m_pFontSizeLabel(0)
    46     , m_pOpenFontDialogButton(0)
    47     , m_pResetToDefaultsButton(0)
    48     , m_iDefaultFontSize(9)
     40UIGuestControlFileManagerSettingsPanel::UIGuestControlFileManagerSettingsPanel(UIGuestControlFileManager *pManagerWidget,
     41                                                                               QWidget *pParent, UIGuestControlFileManagerSettings *pFileManagerSettings)
     42    : UIGuestControlFileManagerPanel(pManagerWidget, pParent)
     43    , m_pListDirectoriesOnTopCheckBox(0)
     44    , m_pDeleteConfirmationCheckBox(0)
     45    , m_pFileManagerSettings(pFileManagerSettings)
    4946{
    5047    prepare();
    5148}
    5249
    53 void UIVMLogViewerSettingsPanel::setShowLineNumbers(bool bShowLineNumbers)
    54 {
    55     if (!m_pLineNumberCheckBox)
    56         return;
    57     if (m_pLineNumberCheckBox->isChecked() == bShowLineNumbers)
    58         return;
    59     m_pLineNumberCheckBox->setChecked(bShowLineNumbers);
    60 }
    61 
    62 void UIVMLogViewerSettingsPanel::setWrapLines(bool bWrapLines)
    63 {
    64     if (!m_pWrapLinesCheckBox)
    65         return;
    66     if (m_pWrapLinesCheckBox->isChecked() == bWrapLines)
    67         return;
    68     m_pWrapLinesCheckBox->setChecked(bWrapLines);
    69 }
    70 
    71 void UIVMLogViewerSettingsPanel::setFontSizeInPoints(int fontSizeInPoints)
    72 {
    73     if (!m_pFontSizeSpinBox)
    74         return;
    75     if (m_pFontSizeSpinBox->value() == fontSizeInPoints)
    76         return;
    77     m_pFontSizeSpinBox->setValue(fontSizeInPoints);
    78 }
    79 
    80 void UIVMLogViewerSettingsPanel::prepareWidgets()
     50void UIGuestControlFileManagerSettingsPanel::prepareWidgets()
    8151{
    8252    if (!mainLayout())
    8353        return;
    8454
    85     /* Create line-number check-box: */
    86     m_pLineNumberCheckBox = new QCheckBox;
    87     if (m_pLineNumberCheckBox)
     55    m_pListDirectoriesOnTopCheckBox = new QCheckBox;
     56    if (m_pListDirectoriesOnTopCheckBox)
    8857    {
    89         m_pLineNumberCheckBox->setChecked(true);
    90         mainLayout()->addWidget(m_pLineNumberCheckBox, 0, Qt::AlignLeft);
     58        m_pListDirectoriesOnTopCheckBox->setChecked(true);
     59        mainLayout()->addWidget(m_pListDirectoriesOnTopCheckBox, 0, Qt::AlignLeft);
    9160    }
    9261
    93     /* Create wrap-lines check-box: */
    94     m_pWrapLinesCheckBox = new QCheckBox;
    95     if (m_pWrapLinesCheckBox)
     62    m_pDeleteConfirmationCheckBox = new QCheckBox;
     63    if (m_pDeleteConfirmationCheckBox)
    9664    {
    97         m_pWrapLinesCheckBox->setChecked(false);
    98         mainLayout()->addWidget(m_pWrapLinesCheckBox, 0, Qt::AlignLeft);
     65        m_pDeleteConfirmationCheckBox->setChecked(false);
     66        mainLayout()->addWidget(m_pDeleteConfirmationCheckBox, 0, Qt::AlignLeft);
    9967    }
    10068
    101     /* Create font-size spin-box: */
    102     m_pFontSizeSpinBox = new QSpinBox;
    103     if (m_pFontSizeSpinBox)
    104     {
    105         mainLayout()->addWidget(m_pFontSizeSpinBox, 0, Qt::AlignLeft);
    106         m_pFontSizeSpinBox->setValue(m_iDefaultFontSize);
    107         m_pFontSizeSpinBox->setMaximum(44);
    108         m_pFontSizeSpinBox->setMinimum(6);
    109     }
    11069
    111     /* Create font-size label: */
    112     m_pFontSizeLabel = new QLabel;
    113     if (m_pFontSizeLabel)
    114     {
    115         mainLayout()->addWidget(m_pFontSizeLabel, 0, Qt::AlignLeft);
    116     }
    117 
    118     /* Create combo/button layout: */
    119     QHBoxLayout *pButtonLayout = new QHBoxLayout;
    120     if (pButtonLayout)
    121     {
    122         pButtonLayout->setContentsMargins(0, 0, 0, 0);
    123         pButtonLayout->setSpacing(0);
    124 
    125         /* Create open font dialog button: */
    126         m_pOpenFontDialogButton = new QIToolButton;
    127         if (m_pOpenFontDialogButton)
    128         {
    129             pButtonLayout->addWidget(m_pOpenFontDialogButton, 0);
    130             m_pOpenFontDialogButton->setIcon(UIIconPool::iconSet(":/log_viewer_choose_font_16px.png"));
    131         }
    132 
    133         /* Create reset font to default button: */
    134         m_pResetToDefaultsButton = new QIToolButton;
    135         if (m_pResetToDefaultsButton)
    136         {
    137             pButtonLayout->addWidget(m_pResetToDefaultsButton, 0);
    138             m_pResetToDefaultsButton->setIcon(UIIconPool::iconSet(":/log_viewer_reset_font_16px.png"));
    139         }
    140 
    141         mainLayout()->addLayout(pButtonLayout);
    142     }
    143 
     70    retranslateUi();
    14471    mainLayout()->addStretch(2);
    14572}
    14673
    147 void UIVMLogViewerSettingsPanel::prepareConnections()
     74void UIGuestControlFileManagerSettingsPanel::sltListDirectoryCheckBoxToogled(bool fChecked)
    14875{
    149     if (m_pLineNumberCheckBox)
    150         connect(m_pLineNumberCheckBox, &QCheckBox::toggled, this, &UIVMLogViewerSettingsPanel::sigShowLineNumbers);
    151     if (m_pWrapLinesCheckBox)
    152         connect(m_pWrapLinesCheckBox, &QCheckBox::toggled, this, &UIVMLogViewerSettingsPanel::sigWrapLines);
    153     if (m_pFontSizeSpinBox)
    154         connect(m_pFontSizeSpinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged),
    155                 this, &UIVMLogViewerSettingsPanel::sigChangeFontSizeInPoints);
    156     if (m_pOpenFontDialogButton)
    157         connect(m_pOpenFontDialogButton, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sltOpenFontDialog);
    158     if (m_pResetToDefaultsButton)
    159         connect(m_pResetToDefaultsButton, &QIToolButton::clicked, this, &UIVMLogViewerSettingsPanel::sigResetToDefaults);
     76    if (!m_pFileManagerSettings)
     77        return;
     78    m_pFileManagerSettings->bListDirectoriesOnTop = fChecked;
     79    emit sigListDirectoriesFirstChanged();
    16080}
    16181
    162 void UIVMLogViewerSettingsPanel::retranslateUi()
     82void UIGuestControlFileManagerSettingsPanel::prepareConnections()
    16383{
    164     UIVMLogViewerPanel::retranslateUi();
    165 
    166     m_pLineNumberCheckBox->setText(UIVMLogViewerWidget::tr("Show Line Numbers"));
    167     m_pLineNumberCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, show line numbers"));
    168 
    169     m_pWrapLinesCheckBox->setText(UIVMLogViewerWidget::tr("Wrap Lines"));
    170     m_pWrapLinesCheckBox->setToolTip(UIVMLogViewerWidget::tr("When checked, wrap lines"));
    171 
    172     m_pFontSizeLabel->setText(UIVMLogViewerWidget::tr("Font Size"));
    173     m_pFontSizeSpinBox->setToolTip(UIVMLogViewerWidget::tr("Log viewer font size"));
    174 
    175     m_pOpenFontDialogButton->setToolTip(UIVMLogViewerWidget::tr("Open a font dialog to select font face for the logviewer"));
    176     m_pResetToDefaultsButton->setToolTip(UIVMLogViewerWidget::tr("Reset settings to application defaults"));
     84    if (m_pListDirectoriesOnTopCheckBox)
     85        connect(m_pListDirectoriesOnTopCheckBox, &QCheckBox::toggled,
     86                this, &UIGuestControlFileManagerSettingsPanel::sltListDirectoryCheckBoxToogled);
     87    // if (m_pWrapLinesCheckBox)
     88    //     connect(m_pWrapLinesCheckBox, &QCheckBox::toggled, this, &UIGuestControlFileManagerSettingsPanel::sigWrapLines);
     89    // if (m_pFontSizeSpinBox)
     90    //     connect(m_pFontSizeSpinBox, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged),
     91    //             this, &UIGuestControlFileManagerSettingsPanel::sigChangeFontSizeInPoints);
     92    // if (m_pResetToDefaultsButton)
     93    //     connect(m_pResetToDefaultsButton, &QIToolButton::clicked, this, &UIGuestControlFileManagerSettingsPanel::sigResetToDefaults);
    17794}
    17895
    179 void UIVMLogViewerSettingsPanel::sltOpenFontDialog()
     96void UIGuestControlFileManagerSettingsPanel::retranslateUi()
    18097{
    181     QFont currentFont;
    182     UIVMLogViewerWidget* parentWidget = qobject_cast<UIVMLogViewerWidget*>(parent());
    183     if (!parentWidget)
    184         return;
     98    UIGuestControlFileManagerPanel::retranslateUi();
    18599
    186     currentFont = parentWidget->currentFont();
    187     bool ok;
    188     QFont font =
    189         QFontDialog::getFont(&ok, currentFont, this, "Logviewer font");
     100    m_pListDirectoriesOnTopCheckBox->setText(UIGuestControlFileManager::tr("List directories on top"));
     101    m_pListDirectoriesOnTopCheckBox->setToolTip(UIGuestControlFileManager::tr("List directories before files"));
    190102
    191     if (ok)
    192         emit sigChangeFont(font);
     103    m_pDeleteConfirmationCheckBox->setText(UIGuestControlFileManager::tr("Ask before delete"));
     104    m_pDeleteConfirmationCheckBox->setToolTip(UIGuestControlFileManager::tr("List directories before files"));
    193105}
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManagerSettingsPanel.h

    r75195 r75220  
    1616 */
    1717
    18 #ifndef ___UIVMLogViewerSettingssPanel_h___
    19 #define ___UIVMLogViewerSettingssPanel_h___
     18#ifndef ___UIGuestControlFileManagerSettingsPanel_h___
     19#define ___UIGuestControlFileManagerSettingsPanel_h___
    2020
    2121/* GUI includes: */
    22 #include "UIVMLogViewerPanel.h"
     22#include "UIGuestControlFileManagerPanel.h"
    2323
    2424/* Forward declarations: */
     
    2727class QLabel;
    2828class QIToolButton;
    29 class UIVMLogViewerWidget;
     29class UIGuestControlFileManagerSettings;
    3030
    3131/** UIVMLogViewerPanel extension providing GUI to manage logviewer settings. */
    32 class UIVMLogViewerSettingsPanel : public UIVMLogViewerPanel
     32class UIGuestControlFileManagerSettingsPanel : public UIGuestControlFileManagerPanel
    3333{
    3434    Q_OBJECT;
    3535
     36public:
     37
     38    UIGuestControlFileManagerSettingsPanel(UIGuestControlFileManager *pManagerWidget,
     39                                           QWidget *pParent, UIGuestControlFileManagerSettings *pFileManagerSettings);
     40
    3641signals:
    3742
    38     void sigShowLineNumbers(bool show);
    39     void sigWrapLines(bool show);
    40     void sigChangeFontSizeInPoints(int size);
    41     void sigChangeFont(QFont font);
    42     void sigResetToDefaults();
    43 
    44 public:
    45 
    46     UIVMLogViewerSettingsPanel(QWidget *pParent, UIVMLogViewerWidget *pViewer);
    47 
    48     void setShowLineNumbers(bool bShowLineNumbers);
    49     void setWrapLines(bool bWrapLines);
    50     void setFontSizeInPoints(int fontSizeInPoints);
    51 
    52 public slots:
    53 
     43    void sigListDirectoriesFirstChanged();
    5444
    5545protected:
     
    6353private slots:
    6454
    65     void sltOpenFontDialog();
     55    void sltListDirectoryCheckBoxToogled(bool fChecked);
    6656
    6757private:
    6858
    69     QCheckBox    *m_pLineNumberCheckBox;
    70     QCheckBox    *m_pWrapLinesCheckBox;
    71     QSpinBox     *m_pFontSizeSpinBox;
    72     QLabel       *m_pFontSizeLabel;
    73     QIToolButton *m_pOpenFontDialogButton;
    74     QIToolButton *m_pResetToDefaultsButton;
    75 
    76     /** Default font size in points. */
    77     const int    m_iDefaultFontSize;
    78 
     59    QCheckBox                         *m_pListDirectoriesOnTopCheckBox;
     60    QCheckBox                         *m_pDeleteConfirmationCheckBox;
     61    UIGuestControlFileManagerSettings *m_pFileManagerSettings;
    7962};
    8063
    81 #endif /* !___UIVMLogViewerSettingsPanel_h___ */
     64#endif /* !___UIGuestControlFileManagerSettingsPanel_h___ */
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileTable.cpp

    r75203 r75220  
    959959    m_pView->setRootIndex(m_pProxyModel->mapFromSource(currentIndex));
    960960    setSelectionDependentActionsEnabled(m_pView->hasSelection());
     961}
     962
     963void UIGuestControlFileTable::relist()
     964{
     965    if (!m_pProxyModel)
     966        return;
     967    m_pProxyModel->invalidate();
    961968}
    962969
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileTable.h

    r75202 r75220  
    251251    virtual ~UIGuestControlFileTable();
    252252    /** Deletes all the tree nodes */
    253     void reset();
    254     void emitLogOutput(const QString& strOutput);
     253    void        reset();
     254    void        emitLogOutput(const QString& strOutput);
    255255    /** Returns the path of the rootIndex */
    256256    QString     currentDirectoryPath() const;
     
    258258    QStringList selectedItemPathList();
    259259    virtual void refresh();
    260 
     260    void         relist();
    261261    static const unsigned    m_iKiloByte;
    262262    static QString humanReadableSize(ULONG64 size);
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.cpp

    r75087 r75220  
    2929/* GUI includes: */
    3030# include "QITreeWidget.h"
     31# include "UIActionPool.h"
    3132# include "UIExtraDataManager.h"
    3233# include "UIGuestControlConsole.h"
     
    3435# include "UIGuestControlTreeItem.h"
    3536# include "UIGuestProcessControlWidget.h"
     37# include "UIToolBar.h"
    3638# include "UIVMInformationDialog.h"
    3739# include "VBoxGlobal.h"
     
    166168
    167169UIGuestProcessControlWidget::UIGuestProcessControlWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool,
    168                                                          const CGuest &comGuest, QWidget *pParent)
     170                                                         const CGuest &comGuest, QWidget *pParent, bool fShowToolbar /* = false */)
    169171    :QIWithRetranslateUI<QWidget>(pParent)
    170172    , m_comGuest(comGuest)
     
    176178    , m_enmEmbedding(enmEmbedding)
    177179    , m_pActionPool(pActionPool)
     180    , m_pToolBar(0)
    178181    , m_pQtListener(0)
     182    , m_fShowToolbar(fShowToolbar)
    179183{
    180184    prepareListener();
    181185    prepareObjects();
    182186    prepareConnections();
     187    prepareToolBar();
    183188    initGuestSessionTree();
    184189    loadSettings();
     
    351356}
    352357
     358void UIGuestProcessControlWidget::prepareToolBar()
     359{
     360    /* Create toolbar: */
     361    m_pToolBar = new UIToolBar(parentWidget());
     362    if (m_pToolBar)
     363    {
     364        /* Configure toolbar: */
     365        const int iIconMetric = (int)(QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize));
     366        m_pToolBar->setIconSize(QSize(iIconMetric, iIconMetric));
     367        m_pToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
     368
     369        /* Add toolbar actions: */
     370        m_pToolBar->addSeparator();
     371        m_pToolBar->addSeparator();
     372
     373#ifdef VBOX_WS_MAC
     374        /* Check whether we are embedded into a stack: */
     375        if (m_enmEmbedding == EmbedTo_Stack)
     376        {
     377            /* Add into layout: */
     378            m_pMainLayout->addWidget(m_pToolBar);
     379        }
     380#else
     381        /* Add into layout: */
     382        m_pMainLayout->addWidget(m_pToolBar);
     383#endif
     384    }
     385}
     386
    353387void UIGuestProcessControlWidget::initGuestSessionTree()
    354388{
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestProcessControlWidget.h

    r75087 r75220  
    4141class UIGuestSessionsEventHandler;
    4242class UIGuestControlTreeWidget;
    43 
     43class UIToolBar;
    4444
    4545/** QWidget extension
     
    5252
    5353    UIGuestProcessControlWidget(EmbedTo enmEmbedding, UIActionPool *pActionPool,
    54                                 const CGuest &comGuest, QWidget *pParent);
     54                                const CGuest &comGuest, QWidget *pParent, bool fShowToolbar = false);
    5555    ~UIGuestProcessControlWidget();
    5656
     
    7676    void prepareObjects();
    7777    void prepareConnections();
     78    void prepareToolBar();
    7879    void prepareListener();
    7980    void initGuestSessionTree();
     
    9293    const EmbedTo             m_enmEmbedding;
    9394    UIActionPool             *m_pActionPool;
     95    UIToolBar                *m_pToolBar;
    9496
    9597    /** Holds the Qt event listener instance. */
     
    9799    /** Holds the COM event listener instance. */
    98100    CEventListener m_comEventListener;
     101    const bool     m_fShowToolbar;
    99102};
    100103
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