VirtualBox

Changeset 75246 in vbox


Ignore:
Timestamp:
Nov 5, 2018 9:36:29 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:6699. Add a splitter to file manager widget so that log panel size can be adjusted

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

Legend:

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

    r75224 r75246  
    2727# include <QTextEdit>
    2828# include <QPushButton>
     29# include <QSplitter>
    2930# include <QGridLayout>
    3031
     
    133134    , m_comGuest(comGuest)
    134135    , m_pMainLayout(0)
     136    , m_pVerticalSplitter(0)
    135137    , m_pToolBar(0)
    136     , m_pFileTableContainerWidget(0)
    137     , m_pFileTableContainerLayout(0)
    138138    , m_pGuestFileTable(0)
    139139    , m_pHostFileTable(0)
     
    188188void UIGuestControlFileManager::prepareObjects()
    189189{
    190     /* Create layout: */
     190    /* m_pMainLayout is the outer most layout containing the main toolbar and splitter widget: */
    191191    m_pMainLayout = new QVBoxLayout(this);
    192192    if (!m_pMainLayout)
     
    195195    /* Configure layout: */
    196196    m_pMainLayout->setSpacing(0);
     197    m_pMainLayout->setContentsMargins(0, 0, 0, 0);
    197198
    198199    if (m_fShowToolbar)
    199200        prepareToolBar();
    200 
    201     // m_pSessionCreateWidget = new UIGuestSessionCreateWidget();
    202     // if (m_pSessionCreateWidget)
    203     // {
    204     //     m_pMainLayout->addWidget(m_pSessionCreateWidget);
    205     // }
    206 
    207     m_pFileTableContainerWidget = new QWidget;
    208     m_pFileTableContainerLayout = new QHBoxLayout;
    209 
    210     if (m_pFileTableContainerWidget)
    211     {
    212         if (m_pFileTableContainerLayout)
     201    /* Two widgets are inserted into this splitter. Upper pWidget widget is a container with file tables and all the panels
     202       except the log panel and lower widget is the log panel: */
     203    m_pVerticalSplitter = new QSplitter;
     204    if (!m_pVerticalSplitter)
     205        return;
     206
     207    m_pMainLayout->addWidget(m_pVerticalSplitter);
     208    m_pVerticalSplitter->setOrientation(Qt::Vertical);
     209    m_pVerticalSplitter->setHandleWidth(4);
     210
     211    QHBoxLayout *pFileTableContainerLayout = new QHBoxLayout;
     212    pFileTableContainerLayout->setSpacing(0);
     213    pFileTableContainerLayout->setContentsMargins(0, 0, 0, 0);
     214
     215    QWidget *pTopWidget = new QWidget;
     216    QVBoxLayout *pTopLayout = new QVBoxLayout;
     217    pTopLayout->setSpacing(0);
     218    pTopLayout->setContentsMargins(0, 0, 0, 0);
     219
     220    pTopWidget->setLayout(pTopLayout);
     221
     222    if (pFileTableContainerLayout)
     223    {
     224        pFileTableContainerLayout->setSpacing(0);
     225        pFileTableContainerLayout->setContentsMargins(0, 0, 0, 0);
     226        m_pGuestFileTable = new UIGuestFileTable(m_pActionPool);
     227        m_pGuestFileTable->setEnabled(false);
     228
     229        m_pHostFileTable = new UIHostFileTable(m_pActionPool);
     230        if (m_pHostFileTable)
    213231        {
    214             m_pFileTableContainerWidget->setLayout(m_pFileTableContainerLayout);
    215             m_pFileTableContainerLayout->setSpacing(0);
    216             m_pFileTableContainerLayout->setContentsMargins(0, 0, 0, 0);
    217             m_pGuestFileTable = new UIGuestFileTable(m_pActionPool);
    218             m_pGuestFileTable->setEnabled(false);
    219 
    220             m_pHostFileTable = new UIHostFileTable(m_pActionPool);
    221             if (m_pHostFileTable)
    222             {
    223                 connect(m_pHostFileTable, &UIHostFileTable::sigLogOutput,
    224                         this, &UIGuestControlFileManager::sltReceieveLogOutput);
    225                 m_pFileTableContainerLayout->addWidget(m_pHostFileTable);
    226             }
    227             prepareVerticalToolBar();
    228              if (m_pGuestFileTable)
    229             {
    230                 connect(m_pGuestFileTable, &UIGuestFileTable::sigLogOutput,
    231                         this, &UIGuestControlFileManager::sltReceieveLogOutput);
    232                 m_pFileTableContainerLayout->addWidget(m_pGuestFileTable);
    233             }
    234 
     232            connect(m_pHostFileTable, &UIHostFileTable::sigLogOutput,
     233                    this, &UIGuestControlFileManager::sltReceieveLogOutput);
     234            pFileTableContainerLayout->addWidget(m_pHostFileTable);
    235235        }
    236         m_pMainLayout->addWidget(m_pFileTableContainerWidget);
     236        prepareVerticalToolBar(pFileTableContainerLayout);
     237        if (m_pGuestFileTable)
     238        {
     239            connect(m_pGuestFileTable, &UIGuestFileTable::sigLogOutput,
     240                    this, &UIGuestControlFileManager::sltReceieveLogOutput);
     241            pFileTableContainerLayout->addWidget(m_pGuestFileTable);
     242        }
    237243    }
    238244
     
    243249    //     m_pFileOperationsList->header()->hide();
    244250    // }
    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     }
     251    pTopLayout->addLayout(pFileTableContainerLayout);
    256252    m_pSessionPanel = new UIGuestControlFileManagerSessionPanel(this /* manager dialog */, 0 /*parent */);
    257253    if (m_pSessionPanel)
    258254    {
    259         /* Configure panel: */
    260255        m_pSessionPanel->hide();
    261256        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: */
     257        pTopLayout->addWidget(m_pSessionPanel);
     258    }
     259
    267260    m_pSettingsPanel =
    268261        new UIGuestControlFileManagerSettingsPanel(this /* manager dialog */,
     
    270263    if (m_pSettingsPanel)
    271264    {
    272         /* Configure panel: */
    273265        m_pSettingsPanel->hide();
    274266        m_panelActionMap.insert(m_pSettingsPanel, m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Settings));
    275267        connect(m_pSettingsPanel, &UIGuestControlFileManagerSettingsPanel::sigListDirectoriesFirstChanged,
    276268                this, &UIGuestControlFileManager::sltListDirectoriesBeforeChanged);
    277         /* Add into layout: */
    278         m_pMainLayout->addWidget(m_pSettingsPanel);
    279     }
    280 
    281 }
    282 
    283 void UIGuestControlFileManager::prepareVerticalToolBar()
     269        pTopLayout->addWidget(m_pSettingsPanel);
     270    }
     271    m_pVerticalSplitter->addWidget(pTopWidget);
     272
     273    m_pLogPanel = new UIGuestControlFileManagerLogPanel(this /* manager dialog */, 0 /*parent */);
     274    if (m_pLogPanel)
     275    {
     276        m_pLogPanel->hide();
     277        m_panelActionMap.insert(m_pLogPanel, m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_T_Log));
     278    }
     279    m_pVerticalSplitter->addWidget(pTopWidget);
     280    m_pVerticalSplitter->addWidget(m_pLogPanel);
     281    m_pVerticalSplitter->setCollapsible(m_pVerticalSplitter->indexOf(pTopWidget), false);
     282    m_pVerticalSplitter->setCollapsible(m_pVerticalSplitter->indexOf(m_pLogPanel), false);
     283}
     284
     285void UIGuestControlFileManager::prepareVerticalToolBar(QHBoxLayout *layout)
    284286{
    285287    m_pToolBar = new UIToolBar;
     
    306308            this, &UIGuestControlFileManager::sltCopyHostToGuest);
    307309    connect(m_pActionPool->action(UIActionIndex_M_GuestControlFileManager_S_CopyToGuest), &QAction::triggered,
    308             this, &UIGuestControlFileManager::sltCopyGuestToHost);
    309 
    310     m_pFileTableContainerLayout->addWidget(m_pToolBar);
     310             this, &UIGuestControlFileManager::sltCopyGuestToHost);
     311
     312    layout ->addWidget(m_pToolBar);
    311313}
    312314
  • trunk/src/VBox/Frontends/VirtualBox/src/guestctrl/UIGuestControlFileManager.h

    r75224 r75246  
    3636/* Forward declarations: */
    3737class QHBoxLayout;
     38class QSplitter;
    3839class QTextEdit;
    3940class QVBoxLayout;
     
    112113    void prepareGuestListener();
    113114    void prepareConnections();
    114     void prepareVerticalToolBar();
     115    void prepareVerticalToolBar(QHBoxLayout *layout);
    115116    void prepareToolBar();
    116117    bool createSession(const QString& strUserName, const QString& strPassword,
     
    139140    void manageEscapeShortCut();
    140141
    141 
    142142    template<typename T>
    143143    QStringList       getFsObjInfoStringList(const T &fsObjectInfo) const;
     
    147147    CGuestSession               m_comGuestSession;
    148148    QVBoxLayout                *m_pMainLayout;
    149 
     149    QSplitter                  *m_pVerticalSplitter;
    150150    UIToolBar                  *m_pToolBar;
    151     QWidget                    *m_pFileTableContainerWidget;
    152     QHBoxLayout                *m_pFileTableContainerLayout;
    153151
    154152    //UIFileOperationsList       *m_pFileOperationsList;
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