VirtualBox

Ignore:
Timestamp:
Feb 27, 2018 10:13:17 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
121019
Message:

FEQt bugref:6699 Add file tree classes

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

Legend:

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

    r71105 r71133  
    378378        src/runtime/information/guestctrl/UIGuestControlConsole.h \
    379379        src/runtime/information/guestctrl/UIGuestControlFileManager.h \
     380        src/runtime/information/guestctrl/UIGuestControlFileTree.h \
    380381        src/runtime/information/guestctrl/UIGuestControlInterface.h \
    381382        src/runtime/information/guestctrl/UIGuestControlTreeItem.h \
     
    567568        src/runtime/UIStatusBarEditorWindow.cpp \
    568569        src/runtime/information/guestctrl/UIGuestControlFileManager.cpp \
     570        src/runtime/information/guestctrl/UIGuestControlFileTree.cpp \
    569571        src/runtime/information/guestctrl/UIGuestControlWidget.cpp \
    570572        src/selector/UIActionPoolSelector.cpp \
     
    710712        src/runtime/information/guestctrl/UIGuestControlConsole.cpp \
    711713        src/runtime/information/guestctrl/UIGuestControlFileManager.cpp \
     714        src/runtime/information/guestctrl/UIGuestControlFileTree.cpp \
    712715        src/runtime/information/guestctrl/UIGuestControlInterface.cpp \
    713716        src/runtime/information/guestctrl/UIGuestControlTreeItem.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileManager.cpp

    r71105 r71133  
    2121
    2222/* Qt includes: */
     23# include <QAbstractItemModel>
     24# include <QHBoxLayout>
     25# include <QPlainTextEdit>
     26# include <QPushButton>
    2327# include <QSplitter>
    24 # include <QHBoxLayout>
    2528# include <QVBoxLayout>
    2629
     
    2831# include "QILabel.h"
    2932# include "QILineEdit.h"
    30 # include "QIToolButton.h"
    3133# include "QIWithRetranslateUI.h"
     34# include "UIExtraDataManager.h"
    3235# include "UIGuestControlFileManager.h"
     36# include "UIGuestControlFileTree.h"
    3337# include "UIVMInformationDialog.h"
    3438# include "VBoxGlobal.h"
     
    3640/* COM includes: */
    3741# include "CGuest.h"
     42# include "CGuestDirectory.h"
     43# include "CGuestSessionStateChangedEvent.h"
    3844
    3945#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    4046
     47
    4148class UIGuestSessionCreateWidget : public QIWithRetranslateUI<QWidget>
    4249{
    4350    Q_OBJECT;
    4451
     52signals:
     53
     54    void sigCreateSession(QString strUserName, QString strPassword);
     55    void sigCloseButtonClick();
     56
    4557public:
    4658
    4759    UIGuestSessionCreateWidget(QWidget *pParent = 0);
     60    void switchSessionCreateMode();
     61    void switchSessionCloseMode();
    4862
    4963protected:
    5064
    5165    void retranslateUi();
     66
     67private slots:
     68
     69    void sltCreateButtonClick();
    5270
    5371private:
     
    5876    QILabel      *m_pUserNameLabel;
    5977    QILabel      *m_pPasswordLabel;
    60     QIToolButton *m_pCreateButton;
     78    QPushButton  *m_pCreateButton;
     79    QPushButton  *m_pCloseButton;
    6180
    6281    QHBoxLayout *m_pMainLayout;
    6382
    6483};
     84
     85
     86
     87/*********************************************************************************************************************************
     88*   UIGuestSessionCreateWidget implementation.                                                                                   *
     89*********************************************************************************************************************************/
    6590
    6691UIGuestSessionCreateWidget::UIGuestSessionCreateWidget(QWidget *pParent /* = 0 */)
     
    7196    , m_pPasswordLabel(0)
    7297    , m_pCreateButton(0)
     98    , m_pCloseButton(0)
    7399    , m_pMainLayout(0)
    74100{
     
    103129    }
    104130
    105     m_pCreateButton = new QIToolButton;
     131    m_pCreateButton = new QPushButton;
    106132    if (m_pCreateButton)
    107133    {
    108134        m_pMainLayout->addWidget(m_pCreateButton);
    109     }
     135        connect(m_pCreateButton, &QPushButton::clicked, this, &UIGuestSessionCreateWidget::sltCreateButtonClick);
     136    }
     137
     138    m_pCloseButton = new QPushButton;
     139    if (m_pCloseButton)
     140    {
     141        m_pMainLayout->addWidget(m_pCloseButton);
     142        connect(m_pCloseButton, &QPushButton::clicked, this, &UIGuestSessionCreateWidget::sigCloseButtonClick);
     143    }
     144
    110145    retranslateUi();
     146}
     147
     148void UIGuestSessionCreateWidget::sltCreateButtonClick()
     149{
     150    if(m_pUserNameEdit && m_pPasswordEdit)
     151        emit sigCreateSession(m_pUserNameEdit->text(), m_pPasswordEdit->text());
    111152}
    112153
     
    132173    }
    133174    if(m_pCreateButton)
    134     {
    135175        m_pCreateButton->setText(UIVMInformationDialog::tr("Create Session"));
    136     }
    137 }
     176    if(m_pCloseButton)
     177        m_pCloseButton->setText(UIVMInformationDialog::tr("Close Session"));
     178
     179}
     180
     181void UIGuestSessionCreateWidget::switchSessionCreateMode()
     182{
     183    m_pUserNameEdit->setEnabled(true);
     184    m_pPasswordEdit->setEnabled(true);
     185    m_pUserNameLabel->setEnabled(true);
     186    m_pPasswordLabel->setEnabled(true);
     187    m_pCreateButton->setEnabled(true);
     188    m_pCloseButton->setEnabled(false);
     189}
     190
     191void UIGuestSessionCreateWidget::switchSessionCloseMode()
     192{
     193    m_pUserNameEdit->setEnabled(false);
     194    m_pPasswordEdit->setEnabled(false);
     195    m_pUserNameLabel->setEnabled(false);
     196    m_pPasswordLabel->setEnabled(false);
     197    m_pCreateButton->setEnabled(false);
     198    m_pCloseButton->setEnabled(true);
     199}
     200
     201
     202/*********************************************************************************************************************************
     203*   UIGuestControlFileManager implementation.                                                                                    *
     204*********************************************************************************************************************************/
    138205
    139206UIGuestControlFileManager::UIGuestControlFileManager(QWidget *pParent, const CGuest &comGuest)
     
    143210    , m_pSplitter(0)
    144211    , m_pSessionCreateWidget(0)
    145 {
     212    , m_pLogOutput(0)
     213    , m_pGuestFileTree(0)
     214{
     215    prepareGuestListener();
    146216    prepareObjects();
    147217    prepareConnections();
     218}
     219
     220UIGuestControlFileManager::~UIGuestControlFileManager()
     221{
     222    if(m_comGuest.isOk() && m_pQtGuestListener && m_comGuestListener.isOk())
     223        cleanupListener(m_pQtGuestListener, m_comGuestListener, m_comGuest.GetEventSource());
     224    if(m_comGuestSession.isOk() && m_pQtSessionListener && m_comSessionListener.isOk())
     225        cleanupListener(m_pQtSessionListener, m_comSessionListener, m_comGuestSession.GetEventSource());
     226}
     227
     228void UIGuestControlFileManager::prepareGuestListener()
     229{
     230    if(m_comGuest.isOk())
     231    {
     232        QVector<KVBoxEventType> eventTypes;
     233        eventTypes << KVBoxEventType_OnGuestSessionRegistered;
     234
     235        prepareListener(m_pQtGuestListener, m_comGuestListener,
     236                        m_comGuest.GetEventSource(), eventTypes);
     237    }
    148238}
    149239
     
    158248    m_pMainLayout->setSpacing(0);
    159249
    160     m_pSplitter = new QSplitter;
    161 
    162     if (!m_pSplitter)
    163         return;
    164250
    165251    m_pSessionCreateWidget = new UIGuestSessionCreateWidget();
    166252    if (m_pSessionCreateWidget)
    167253    {
    168         m_pSplitter->addWidget(m_pSessionCreateWidget);
    169     }
    170 
    171     m_pSplitter->setOrientation(Qt::Vertical);
    172     m_pMainLayout->addWidget(m_pSplitter);
    173 
     254        m_pMainLayout->addWidget(m_pSessionCreateWidget, 0, Qt::AlignTop);
     255    }
     256
     257    m_pSplitter = new QSplitter;
     258    if (m_pSplitter)
     259    {
     260        m_pMainLayout->addWidget(m_pSplitter);
     261        m_pSplitter->setOrientation(Qt::Vertical);
     262    }
     263
     264    m_pGuestFileTree = new UIGuestControlFileTree;
     265    if (m_pGuestFileTree)
     266    {
     267        m_pSplitter->addWidget(m_pGuestFileTree);
     268    }
     269
     270    m_pLogOutput = new QPlainTextEdit;
     271    if (m_pLogOutput)
     272    {
     273        m_pLogOutput->setReadOnly(true);
     274        m_pMainLayout->addWidget(m_pLogOutput, 0, Qt::AlignBottom);
     275    }
    174276
    175277    // m_pSplitter->setStretchFactor(0, 9);
     
    179281void UIGuestControlFileManager::prepareConnections()
    180282{
    181 
     283    if (m_pQtGuestListener)
     284    {
     285        connect(m_pQtGuestListener->getWrapped(), &UIMainEventListener::sigGuestSessionUnregistered,
     286                this, &UIGuestControlFileManager::sltGuestSessionUnregistered, Qt::DirectConnection);
     287    }
     288    if(m_pSessionCreateWidget)
     289    {
     290        connect(m_pSessionCreateWidget, &UIGuestSessionCreateWidget::sigCreateSession,
     291                this, &UIGuestControlFileManager::sltCreateSession);
     292        connect(m_pSessionCreateWidget, &UIGuestSessionCreateWidget::sigCloseButtonClick,
     293                this, &UIGuestControlFileManager::sltCloseSession);
     294    }
     295}
     296
     297void UIGuestControlFileManager::sltGuestSessionUnregistered(CGuestSession guestSession)
     298{
     299    if (!guestSession.isOk())
     300        return;
     301    if(guestSession == m_comGuestSession && m_comGuestSession.isOk())
     302        m_comGuestSession.detach();
     303    if (m_pSessionCreateWidget)
     304        m_pSessionCreateWidget->switchSessionCreateMode();
     305}
     306
     307void UIGuestControlFileManager::sltCreateSession(QString strUserName, QString strPassword)
     308{
     309    if(strUserName.isEmpty())
     310    {
     311        m_pLogOutput->appendPlainText("No user name is given");
     312        return;
     313    }
     314    createSession(strUserName, strPassword);
     315}
     316
     317void UIGuestControlFileManager::sltCloseSession()
     318{
     319    // if (!m_comGuestSession.isOk())
     320    // {
     321    //     m_pLogOutput->appendPlainText("Guest session is not valid");
     322    //     return;
     323    // }
     324    // m_pLogOutput->appendPlainText("Guest session is closed");
     325
     326    if(m_comGuestSession.isOk() && m_pQtSessionListener && m_comSessionListener.isOk())
     327        cleanupListener(m_pQtSessionListener, m_comSessionListener, m_comGuestSession.GetEventSource());
     328
     329    m_comGuestSession.Close();
     330    if(m_pSessionCreateWidget)
     331        m_pSessionCreateWidget->switchSessionCreateMode();
     332}
     333
     334void UIGuestControlFileManager::sltGuestSessionStateChanged(const CGuestSessionStateChangedEvent &cEvent)
     335{
     336    //if (cEvent.isOk() && m_comGuestSession.isOk())// && m_comGuestProcess.GetStatus() == KProcessStatus_Error)
     337    {
     338        CVirtualBoxErrorInfo cErrorInfo = cEvent.GetError();
     339        if (cErrorInfo.isOk())// && cErrorInfo.GetResultCode() != S_OK)
     340        {
     341    //         /* For some reason I am yet to find this emit is not working.
     342    //            Thus we are calling the parent's function directly: */
     343    //         //emit sigGuestProcessErrorText(cErrorInfo.GetText());
     344    //         UIGuestSessionTreeItem *sessionParent = dynamic_cast<UIGuestSessionTreeItem*>(QTreeWidgetItem::parent());
     345    //         if (sessionParent)
     346    //         {
     347    //             sessionParent->errorString(cErrorInfo.GetText().toStdString().c_str());
     348    //         }
     349            m_pLogOutput->appendPlainText(cErrorInfo.GetText());
     350        }
     351    }
     352
     353    if (m_comGuestSession.GetStatus() == KGuestSessionStatus_Started)
     354    {
     355
     356        // printf("/lk %d c:/users %d\n", m_comGuestSession.DirectoryExists("/lk", true),
     357        //        m_comGuestSession.DirectoryExists("c:/users", true));
     358        QVector<KDirectoryOpenFlag> flag;
     359        flag.push_back(KDirectoryOpenFlag_None);
     360        CGuestDirectory directory = m_comGuestSession.DirectoryOpen("c:/", "*", flag);
     361        if(directory.isOk())
     362        {
     363            m_pLogOutput->appendPlainText("Current Directory");
     364            m_pLogOutput->appendPlainText(directory.GetDirectoryName());
     365        }
     366    }
     367
     368}
     369
     370
     371bool UIGuestControlFileManager::createSession(const QString& strUserName, const QString& strPassword,
     372                                              const QString& strDomain /* not used currently */)
     373{
     374    if (!m_comGuest.isOk())
     375        return false;
     376    m_comGuestSession = m_comGuest.CreateSession(strUserName, strPassword,
     377                                                               strDomain, "File Manager Session");
     378
     379    if (!m_comGuestSession.isOk())
     380    {
     381        m_pLogOutput->appendPlainText("Guest session could not be created");
     382        return false;
     383    }
     384
     385    m_pLogOutput->appendPlainText("Guest session has been created");
     386    if(m_pSessionCreateWidget)
     387        m_pSessionCreateWidget->switchSessionCloseMode();
     388
     389    /* Prepare session listener */
     390    QVector<KVBoxEventType> eventTypes;
     391    eventTypes << KVBoxEventType_OnGuestSessionStateChanged;
     392    //<< KVBoxEventType_OnGuestProcessRegistered;
     393    prepareListener(m_pQtSessionListener, m_comSessionListener,
     394                    m_comGuestSession.GetEventSource(), eventTypes);
     395
     396    /* Connect to session listener */
     397    qRegisterMetaType<CGuestSessionStateChangedEvent>();
     398
     399
     400    connect(m_pQtSessionListener->getWrapped(), &UIMainEventListener::sigGuestSessionStatedChanged,
     401            this, &UIGuestControlFileManager::sltGuestSessionStateChanged);
     402    // /* Wait session to start: */
     403    // const ULONG waitTimeout = 2000;
     404    // KGuestSessionWaitResult waitResult = guestSession.WaitFor(KGuestSessionWaitForFlag_Start, waitTimeout);
     405    // if (waitResult != KGuestSessionWaitResult_Start)
     406    //     return false;
     407
     408    // outSession = guestSession;
     409
     410    return true;
     411}
     412
     413void UIGuestControlFileManager::prepareListener(ComObjPtr<UIMainEventListenerImpl> &QtListener,
     414                                                CEventListener &comEventListener,
     415                                                CEventSource comEventSource, QVector<KVBoxEventType>& eventTypes)
     416{
     417    if (!comEventSource.isOk())
     418        return;
     419    /* Create event listener instance: */
     420    QtListener.createObject();
     421    QtListener->init(new UIMainEventListener, this);
     422    comEventListener = CEventListener(QtListener);
     423
     424    /* Register event listener for CProgress event source: */
     425    comEventSource.RegisterListener(comEventListener, eventTypes,
     426        gEDataManager->eventHandlingType() == EventHandlingType_Active ? TRUE : FALSE);
     427
     428    /* If event listener registered as passive one: */
     429    if (gEDataManager->eventHandlingType() == EventHandlingType_Passive)
     430    {
     431        /* Register event sources in their listeners as well: */
     432        QtListener->getWrapped()->registerSource(comEventSource, comEventListener);
     433    }
     434}
     435
     436void UIGuestControlFileManager::cleanupListener(ComObjPtr<UIMainEventListenerImpl> &QtListener,
     437                                                CEventListener &comEventListener,
     438                                                CEventSource comEventSource)
     439{
     440    if (!comEventSource.isOk())
     441        return;
     442    /* If event listener registered as passive one: */
     443    if (gEDataManager->eventHandlingType() == EventHandlingType_Passive)
     444    {
     445        /* Unregister everything: */
     446        QtListener->getWrapped()->unregisterSources();
     447    }
     448
     449    /* Make sure VBoxSVC is available: */
     450    if (!vboxGlobal().isVBoxSVCAvailable())
     451        return;
     452
     453    /* Unregister event listener for CProgress event source: */
     454    comEventSource.UnregisterListener(comEventListener);
    182455}
    183456
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileManager.h

    r71105 r71133  
    2424/* COM includes: */
    2525#include "COMEnums.h"
     26#include "CEventListener.h"
     27#include "CEventSource.h"
    2628#include "CGuest.h"
     29#include "CGuestSession.h"
     30
     31/* GUI includes: */
     32#include "UIMainEventListener.h"
    2733
    2834/* Forward declarations: */
     35class CGuestSessionStateChangedEvent;
     36class QITreeView;
     37class QPlainTextEdit;
    2938class QVBoxLayout;
    3039class QSplitter;
    31 
     40class UIFileListModel;
     41class UIGuestControlFileTree;
     42class UIGuestSessionCreateWidget;
    3243
    3344/** QWidget extension
     
    4051
    4152    UIGuestControlFileManager(QWidget *pParent, const CGuest &comGuest);
     53    ~UIGuestControlFileManager();
     54
     55private slots:
     56
     57    void sltGuestSessionUnregistered(CGuestSession guestSession);
     58    void sltCreateSession(QString strUserName, QString strPassword);
     59    void sltCloseSession();
     60    void sltGuestSessionStateChanged(const CGuestSessionStateChangedEvent &cEvent);
    4261
    4362private:
    4463
    4564    void prepareObjects();
     65    void prepareGuestListener();
    4666    void prepareConnections();
     67    bool createSession(const QString& strUserName, const QString& strPassword,
     68                       const QString& strDomain = QString() /* not used currently */);
    4769
    48     CGuest         m_comGuest;
    49     QVBoxLayout   *m_pMainLayout;
    50     QSplitter     *m_pSplitter;
    51     QWidget       *m_pSessionCreateWidget;
     70    void prepareListener(ComObjPtr<UIMainEventListenerImpl> &Qtistener,
     71                         CEventListener &comEventListener,
     72                         CEventSource comEventSource, QVector<KVBoxEventType>& eventTypes);
     73
     74    void cleanupListener(ComObjPtr<UIMainEventListenerImpl> &QtListener,
     75                         CEventListener &comEventListener,
     76                         CEventSource comEventSource);
     77
     78    CGuest            m_comGuest;
     79    CGuestSession     m_comGuestSession;
     80
     81    QVBoxLayout      *m_pMainLayout;
     82    QSplitter        *m_pSplitter;
     83    UIGuestSessionCreateWidget        *m_pSessionCreateWidget;
     84    QPlainTextEdit   *m_pLogOutput;
     85    UIGuestControlFileTree* m_pGuestFileTree;
     86
     87    ComObjPtr<UIMainEventListenerImpl> m_pQtGuestListener;
     88    CEventListener m_comGuestListener;
     89
     90    ComObjPtr<UIMainEventListenerImpl> m_pQtSessionListener;
     91    CEventListener m_comSessionListener;
     92
    5293};
    5394
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileTree.cpp

    r71105 r71133  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIGuestControlFileManager class implementation.
     3 * VBox Qt GUI - UIGuestControlFileTree class implementation.
    44 */
    55
     
    2121
    2222/* Qt includes: */
    23 # include <QSplitter>
    24 # include <QHBoxLayout>
    25 # include <QVBoxLayout>
     23// # include <QAbstractItemModel>
     24// # include <QHBoxLayout>
     25// # include <QPlainTextEdit>
     26// # include <QPushButton>
     27// # include <QSplitter>
     28// # include <QVBoxLayout>
    2629
    2730/* GUI includes: */
    28 # include "QILabel.h"
    29 # include "QILineEdit.h"
    30 # include "QIToolButton.h"
    31 # include "QIWithRetranslateUI.h"
    32 # include "UIGuestControlFileManager.h"
    33 # include "UIVMInformationDialog.h"
    34 # include "VBoxGlobal.h"
     31// # include "QILabel.h"
     32// # include "QILineEdit.h"
     33// # include "QIWithRetranslateUI.h"
     34// # include "UIExtraDataManager.h"
     35# include "UIGuestControlFileTree.h"
     36// # include "UIVMInformationDialog.h"
     37// # include "VBoxGlobal.h"
    3538
    3639/* COM includes: */
    37 # include "CGuest.h"
     40// # include "CGuest.h"
     41// # include "CGuestSessionStateChangedEvent.h"
    3842
    3943#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
    4044
    41 class UIGuestSessionCreateWidget : public QIWithRetranslateUI<QWidget>
     45class UIGuestControlFileTreeItem : public QITreeWidgetItem
    4246{
    4347    Q_OBJECT;
    4448
    4549public:
    46 
    47     UIGuestSessionCreateWidget(QWidget *pParent = 0);
    48 
    49 protected:
    50 
    51     void retranslateUi();
    52 
    53 private:
    54     void         prepareWidgets();
    55     QILineEdit   *m_pUserNameEdit;
    56     QILineEdit   *m_pPasswordEdit;
    57 
    58     QILabel      *m_pUserNameLabel;
    59     QILabel      *m_pPasswordLabel;
    60     QIToolButton *m_pCreateButton;
    61 
    62     QHBoxLayout *m_pMainLayout;
     50    UIGuestControlFileTreeItem(UIGuestControlFileTree *pTreeWidget, const QStringList &strings = QStringList());
     51    UIGuestControlFileTreeItem(UIGuestControlFileTreeItem *pTreeWidgetItem, const QStringList &strings = QStringList());
     52    virtual ~UIGuestControlFileTreeItem();
    6353
    6454};
    6555
    66 UIGuestSessionCreateWidget::UIGuestSessionCreateWidget(QWidget *pParent /* = 0 */)
    67     : QIWithRetranslateUI<QWidget>(pParent)
    68     , m_pUserNameEdit(0)
    69     , m_pPasswordEdit(0)
    70     , m_pUserNameLabel(0)
    71     , m_pPasswordLabel(0)
    72     , m_pCreateButton(0)
    73     , m_pMainLayout(0)
     56UIGuestControlFileTreeItem::UIGuestControlFileTreeItem(UIGuestControlFileTree *pTreeWidget, const QStringList &strings /* = QStringList() */)
     57    :QITreeWidgetItem(pTreeWidget, strings)
     58
    7459{
    75     prepareWidgets();
     60}
     61UIGuestControlFileTreeItem::UIGuestControlFileTreeItem(UIGuestControlFileTreeItem *pTreeWidgetItem, const QStringList &strings /*= QStringList() */)
     62    :QITreeWidgetItem(pTreeWidgetItem, strings)
     63{
    7664}
    7765
    78 void UIGuestSessionCreateWidget::prepareWidgets()
    79 {
    80     m_pMainLayout = new QHBoxLayout(this);
    81     if (!m_pMainLayout)
    82         return;
    83     m_pUserNameEdit = new QILineEdit;
    84     if (m_pUserNameEdit)
    85     {
    86         m_pMainLayout->addWidget(m_pUserNameEdit);
    87     }
    88     m_pUserNameLabel = new QILabel;
    89     if (m_pUserNameLabel)
    90     {
    91         m_pMainLayout->addWidget(m_pUserNameLabel);
    92     }
    93     m_pPasswordEdit = new QILineEdit;
    94     if (m_pPasswordEdit)
    95     {
    96         m_pMainLayout->addWidget(m_pPasswordEdit);
    97     }
     66UIGuestControlFileTreeItem::~UIGuestControlFileTreeItem(){}
    9867
    99     m_pPasswordLabel = new QILabel;
    100     if (m_pPasswordLabel)
    101     {
    102         m_pMainLayout->addWidget(m_pPasswordLabel);
    103     }
    104 
    105     m_pCreateButton = new QIToolButton;
    106     if (m_pCreateButton)
    107     {
    108         m_pMainLayout->addWidget(m_pCreateButton);
    109     }
    110     retranslateUi();
    111 }
    112 
    113 void UIGuestSessionCreateWidget::retranslateUi()
    114 {
    115     if (m_pUserNameEdit)
    116     {
    117         m_pUserNameEdit->setToolTip(UIVMInformationDialog::tr("User name to authenticate session creation"));
    118     }
    119     if (m_pPasswordEdit)
    120     {
    121         m_pPasswordEdit->setToolTip(UIVMInformationDialog::tr("Password to authenticate session creation"));
    122     }
    123     if (m_pUserNameLabel)
    124     {
    125         m_pUserNameLabel->setToolTip(UIVMInformationDialog::tr("User name to authenticate session creation"));
    126         m_pUserNameLabel->setText(UIVMInformationDialog::tr("User name"));
    127     }
    128     if (m_pPasswordLabel)
    129     {
    130         m_pPasswordLabel->setToolTip(UIVMInformationDialog::tr("Password to authenticate session creation"));
    131         m_pPasswordLabel->setText(UIVMInformationDialog::tr("Password"));
    132     }
    133     if(m_pCreateButton)
    134     {
    135         m_pCreateButton->setText(UIVMInformationDialog::tr("Create Session"));
    136     }
    137 }
    138 
    139 UIGuestControlFileManager::UIGuestControlFileManager(QWidget *pParent, const CGuest &comGuest)
    140     : QWidget(pParent)
    141     , m_comGuest(comGuest)
    142     , m_pMainLayout(0)
    143     , m_pSplitter(0)
    144     , m_pSessionCreateWidget(0)
    145 {
    146     prepareObjects();
    147     prepareConnections();
    148 }
    149 
    150 void UIGuestControlFileManager::prepareObjects()
    151 {
    152     /* Create layout: */
    153     m_pMainLayout = new QVBoxLayout(this);
    154     if (!m_pMainLayout)
    155         return;
    156 
    157     /* Configure layout: */
    158     m_pMainLayout->setSpacing(0);
    159 
    160     m_pSplitter = new QSplitter;
    161 
    162     if (!m_pSplitter)
    163         return;
    164 
    165     m_pSessionCreateWidget = new UIGuestSessionCreateWidget();
    166     if (m_pSessionCreateWidget)
    167     {
    168         m_pSplitter->addWidget(m_pSessionCreateWidget);
    169     }
    170 
    171     m_pSplitter->setOrientation(Qt::Vertical);
    172     m_pMainLayout->addWidget(m_pSplitter);
    173 
    174 
    175     // m_pSplitter->setStretchFactor(0, 9);
    176     // m_pSplitter->setStretchFactor(1, 4);
    177 }
    178 
    179 void UIGuestControlFileManager::prepareConnections()
    180 {
    181 
    182 }
    183 
    184 #include "UIGuestControlFileManager.moc"
     68#include "UIGuestControlFileTree.moc"
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/information/guestctrl/UIGuestControlFileTree.h

    r71105 r71133  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIGuestControlFileManager class declaration.
     3 * VBox Qt GUI - UIGuestControlFileTree class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef ___UIGuestControlFileManager_h___
    19 #define ___UIGuestControlFileManager_h___
     18#ifndef ___UIGuestControlFileTree_h___
     19#define ___UIGuestControlFileTree_h___
    2020
    2121/* Qt includes: */
     
    2424/* COM includes: */
    2525#include "COMEnums.h"
     26#include "CEventListener.h"
     27#include "CEventSource.h"
    2628#include "CGuest.h"
     29#include "CGuestSession.h"
     30
     31/* GUI includes: */
     32#include "QITreeWidget.h"
    2733
    2834/* Forward declarations: */
    29 class QVBoxLayout;
    30 class QSplitter;
    3135
    3236
    33 /** QWidget extension
    34   * providing GUI with guest session information and control tab in session-information window. */
    35 class UIGuestControlFileManager : public QWidget
     37class UIGuestControlFileTree : public QITreeWidget
    3638{
    3739    Q_OBJECT;
     
    3941public:
    4042
    41     UIGuestControlFileManager(QWidget *pParent, const CGuest &comGuest);
    4243
    4344private:
    4445
    45     void prepareObjects();
    46     void prepareConnections();
    4746
    48     CGuest         m_comGuest;
    49     QVBoxLayout   *m_pMainLayout;
    50     QSplitter     *m_pSplitter;
    51     QWidget       *m_pSessionCreateWidget;
    5247};
    5348
    54 #endif /* !___UIGuestControlFileManager_h___ */
     49#endif /* !___UIGuestControlFileTree_h___ */
Note: See TracChangeset for help on using the changeset viewer.

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