VirtualBox

Changeset 46582 in vbox for trunk


Ignore:
Timestamp:
Jun 17, 2013 10:47:06 AM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: Video Capture LED.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
2 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/VirtualBox1.qrc

    r46542 r46582  
    249249        <file alias="video_capture_16px.png">images/video_capture_16px.png</file>
    250250        <file alias="video_capture_disabled_16px.png">images/video_capture_disabled_16px.png</file>
     251        <file alias="video_capture_settings_16px.png">images/video_capture_settings_16px.png</file>
     252        <file alias="video_capture_write_16px.png">images/video_capture_write_16px.png</file>
    251253    </qresource>
    252254</RCC>
  • trunk/src/VBox/Frontends/VirtualBox/images/video_capture_16px.png

    • Property svn:keywords set to Date Revision Author Id
  • trunk/src/VBox/Frontends/VirtualBox/images/video_capture_disabled_16px.png

    • Property svn:keywords set to Date Revision Author Id
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.cpp

    r46542 r46582  
    882882};
    883883
     884class UIActionMenuVideoCapture : public UIActionMenu
     885{
     886    Q_OBJECT;
     887
     888public:
     889
     890    UIActionMenuVideoCapture(UIActionPool *pParent)
     891        : UIActionMenu(pParent)
     892    {
     893        retranslateUi();
     894    }
     895
     896protected:
     897
     898    void retranslateUi() {}
     899};
     900
    884901class UIActionToggleVideoCapture : public UIActionToggle
    885902{
     
    906923        setName(QApplication::translate("UIActionPool", "Enable &Video Capture"));
    907924        setStatusTip(QApplication::translate("UIActionPool", "Enable video capture"));
     925    }
     926};
     927
     928class UIActionSimpleShowVideoCaptureOptions : public UIActionSimple
     929{
     930    Q_OBJECT;
     931
     932public:
     933
     934    UIActionSimpleShowVideoCaptureOptions(UIActionPool *pParent)
     935        : UIActionSimple(pParent, ":/video_capture_settings_16px.png")
     936    {
     937        retranslateUi();
     938    }
     939
     940protected:
     941
     942    QString shortcutExtraDataID() const
     943    {
     944        return QString("VideoCaptureOptions");
     945    }
     946
     947    void retranslateUi()
     948    {
     949        setName(QApplication::translate("UIActionPool", "&Video Capture Options..."));
     950        setStatusTip(QApplication::translate("UIActionPool", "Configure video capture options"));
    908951    }
    909952};
     
    11731216    m_pool[UIActionIndexRuntime_Toggle_VRDEServer] = new UIActionToggleVRDEServer(this);
    11741217    m_pool[UIActionIndexRuntime_Toggle_VideoCapture] = new UIActionToggleVideoCapture(this);
     1218    m_pool[UIActionIndexRuntime_Simple_VideoCaptureOptions] = new UIActionSimpleShowVideoCaptureOptions(this);
    11751219    m_pool[UIActionIndexRuntime_Simple_InstallGuestTools] = new UIActionSimplePerformInstallGuestTools(this);
    11761220
     
    12421286        delete m_pool[UIActionIndexRuntime_Menu_SharedFolders];
    12431287    m_pool[UIActionIndexRuntime_Menu_SharedFolders] = new UIActionMenuSharedFolders(this);
     1288    if (m_pool[UIActionIndexRuntime_Menu_VideoCapture])
     1289        delete m_pool[UIActionIndexRuntime_Menu_VideoCapture];
     1290    m_pool[UIActionIndexRuntime_Menu_VideoCapture] = new UIActionMenuVideoCapture(this);
    12441291
    12451292#ifdef VBOX_WITH_DEBUGGER_GUI
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIActionPoolRuntime.h

    r46542 r46582  
    6565    UIActionIndexRuntime_Simple_SharedFoldersDialog,
    6666    UIActionIndexRuntime_Toggle_VRDEServer,
     67    UIActionIndexRuntime_Menu_VideoCapture,
    6768    UIActionIndexRuntime_Toggle_VideoCapture,
     69    UIActionIndexRuntime_Simple_VideoCaptureOptions,
    6870    UIActionIndexRuntime_Simple_InstallGuestTools,
    6971
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.cpp

    r46102 r46582  
    495495};
    496496
    497 class UIIndicatorVRDEDisks : public QIWithRetranslateUI<QIStateIndicator>
    498 {
    499     Q_OBJECT;
    500 
    501 public:
    502 
    503     UIIndicatorVRDEDisks(CSession &session)
    504       : QIWithRetranslateUI<QIStateIndicator>()
    505       , m_session(session)
    506     {
    507         setStateIcon(0, QPixmap (":/vrdp_disabled_16px.png"));
    508         setStateIcon(1, QPixmap (":/vrdp_16px.png"));
    509 
    510         retranslateUi();
    511     }
    512 
     497class UIIndicatorVideoCapture : public QIWithRetranslateUI<QIStateIndicator>
     498{
     499    Q_OBJECT;
     500
     501public:
     502
     503    /* State enumerator: */
     504    enum UIIndicatorStateVideoCapture
     505    {
     506        UIIndicatorStateVideoCapture_Disabled = 0,
     507        UIIndicatorStateVideoCapture_Enabled  = 1,
     508        UIIndicatorStateVideoCapture_Writing  = 2
     509    };
     510
     511    /* Constructor: */
     512    UIIndicatorVideoCapture(CSession &session)
     513        : QIWithRetranslateUI<QIStateIndicator>()
     514        , m_session(session)
     515        , m_pUpdateTimer(new QTimer(this))
     516    {
     517        /* Assign state icons: */
     518        setStateIcon(UIIndicatorStateVideoCapture_Disabled, QPixmap(":/video_capture_disabled_16px.png"));
     519        setStateIcon(UIIndicatorStateVideoCapture_Enabled,  QPixmap(":/video_capture_16px.png"));
     520        setStateIcon(UIIndicatorStateVideoCapture_Writing,  QPixmap(":/video_capture_write_16px.png"));
     521
     522        /* Connect timer to update active state: */
     523        connect(m_pUpdateTimer, SIGNAL(timeout()), SLOT(sltUpdateState()));
     524        m_pUpdateTimer->start(500);
     525
     526        /* Translate finally: */
     527        retranslateUi();
     528    }
     529
     530    /* API: Update stuff: */
     531    void updateAppearance()
     532    {
     533        /* Get machine: */
     534        CMachine machine = m_session.GetMachine();
     535
     536        /* Update LED state: */
     537        setState(machine.GetVideoCaptureEnabled());
     538
     539        /* Update LED tool-tip: */
     540        QString strToolTip = QApplication::translate("UIIndicatorsPool", "<nobr>Indicates the activity of the video capture:</nobr>");
     541        strToolTip += "<br>";
     542        switch (state())
     543        {
     544            case UIIndicatorStateVideoCapture_Disabled:
     545            {
     546                strToolTip += QApplication::translate("UIIndicatorsPool", "<b>Video capture disabled</b>");
     547                break;
     548            }
     549            case UIIndicatorStateVideoCapture_Enabled:
     550            case UIIndicatorStateVideoCapture_Writing:
     551            {
     552                strToolTip += QApplication::translate("UIIndicatorsPool", "<nobr><b>Video capture file:</b> %1</nobr>")
     553                                                                          .arg(machine.GetVideoCaptureFile());
     554                break;
     555            }
     556            default:
     557                break;
     558        }
     559        setToolTip(strToolTip);
     560    }
     561
     562protected slots:
     563
     564    /* Handler: Update stuff: */
     565    void sltUpdateState()
     566    {
     567        /* Toggle state from 'Enabled' to 'Writing': */
     568        if (state() == UIIndicatorStateVideoCapture_Enabled)
     569            setState(UIIndicatorStateVideoCapture_Writing);
     570        /* Toggle state from 'Writing' to 'Enabled': */
     571        else if (state() == UIIndicatorStateVideoCapture_Writing)
     572            setState(UIIndicatorStateVideoCapture_Enabled);
     573    }
     574
     575protected:
     576
     577    /* Handler: Translate stuff: */
    513578    void retranslateUi()
    514579    {
     
    516581    }
    517582
    518     void updateAppearance()
    519     {
    520         CVRDEServer srv = m_session.GetMachine().GetVRDEServer();
    521         if (!srv.isNull())
    522         {
    523             /* update menu&status icon state */
    524             bool fEnabled = srv.GetEnabled();
    525 
    526             setState(fEnabled ? KDeviceActivity_Idle : KDeviceActivity_Null);
    527 
    528             QString tip = QApplication::translate("UIIndicatorsPool", "Indicates whether the Remote Desktop Server "
    529                              "is enabled (<img src=:/vrdp_16px.png/>) or not "
    530                              "(<img src=:/vrdp_disabled_16px.png/>).");
    531             if (srv.GetEnabled())
    532                 tip += QApplication::translate("UIIndicatorsPool", "<hr>The Remote Desktop Server is listening on port %1").arg(srv.GetVRDEProperty("TCP/Ports"));
    533             setToolTip(tip);
    534         }
    535     }
    536 
    537 protected:
    538     /* For compatibility reason we do it here, later this should be moved to
    539      * QIStateIndicator. */
    540     CSession &m_session;
     583    /* For compatibility reason we do it here,
     584     * later this should be moved to QIStateIndicator. */
     585    CSession &m_session;
     586    QTimer *m_pUpdateTimer;
    541587};
    542588
     
    740786                m_IndicatorsPool[index] = new UIIndicatorSharedFolders(m_session);
    741787                break;
     788            case UIIndicatorIndex_VideoCapture:
     789                m_IndicatorsPool[index] = new UIIndicatorVideoCapture(m_session);
     790                break;
    742791            case UIIndicatorIndex_Virtualization:
    743792                m_IndicatorsPool[index] = new UIIndicatorVirtualization(m_session);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIIndicatorsPool.h

    r28800 r46582  
    3333    UIIndicatorIndex_USBDevices,
    3434    UIIndicatorIndex_SharedFolders,
    35     UIIndicatorIndex_VRDP,
     35    UIIndicatorIndex_VideoCapture,
    3636    UIIndicatorIndex_Virtualization,
    3737    UIIndicatorIndex_Mouse,
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineDefs.h

    r44529 r46582  
    4343    UIVisualElement_NetworkStuff          = RT_BIT(6),
    4444    UIVisualElement_USBStuff              = RT_BIT(7),
    45     UIVisualElement_VRDPStuff             = RT_BIT(8),
    46     UIVisualElement_SharedFolderStuff     = RT_BIT(9),
     45    UIVisualElement_SharedFolderStuff     = RT_BIT(8),
     46    UIVisualElement_VideoCapture          = RT_BIT(9),
    4747    UIVisualElement_VirtualizationStuff   = RT_BIT(10),
    4848    UIVisualElement_MiniToolBar           = RT_BIT(11),
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r46542 r46582  
    747747    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersDialog));
    748748    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer));
     749    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Menu_VideoCapture));
    749750    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture));
     751    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_VideoCaptureOptions));
    750752    m_pRunningOrPausedActions->addAction(gActionPool->action(UIActionIndexRuntime_Simple_InstallGuestTools));
    751753
     
    811813    connect(gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture), SIGNAL(toggled(bool)),
    812814            this, SLOT(sltToggleVideoCapture(bool)));
     815    connect(gActionPool->action(UIActionIndexRuntime_Simple_VideoCaptureOptions), SIGNAL(triggered()),
     816            this, SLOT(sltOpenVideoCaptureOptions()));
    813817    connect(gActionPool->action(UIActionIndexRuntime_Simple_InstallGuestTools), SIGNAL(triggered()),
    814818            this, SLOT(sltInstallGuestAdditions()));
     
    13121316}
    13131317
    1314 void UIMachineLogic::sltOpenVMSettingsDialog(const QString &strCategory /* = QString() */)
     1318void UIMachineLogic::sltOpenVMSettingsDialog(const QString &strCategory /* = QString() */,
     1319                                             const QString &strControl /*= QString()*/)
    13151320{
    13161321    /* Do not process if window(s) missed! */
     
    13221327    QPointer<UISettingsDialogMachine> pDialog = new UISettingsDialogMachine(activeMachineWindow(),
    13231328                                                                            session().GetMachine().GetId(),
    1324                                                                             strCategory, QString());
     1329                                                                            strCategory, strControl);
    13251330    /* Executing VM settings dialog.
    13261331     * This blocking function calls for the internal event-loop to process all further events,
     
    19011906    /* Make sure something had changed: */
    19021907    CMachine machine = session().GetMachine();
    1903     if (machine.GetVideoCaptureEnabled() == fEnabled)
     1908    if (machine.GetVideoCaptureEnabled() == static_cast<BOOL>(fEnabled))
    19041909        return;
    19051910
     
    19191924    if (!machine.isOk())
    19201925        msgCenter().cannotSaveMachineSettings(machine, activeMachineWindow());
     1926}
     1927
     1928void UIMachineLogic::sltOpenVideoCaptureOptions()
     1929{
     1930    /* Open VM settings : Display page : Video Capture tab: */
     1931    sltOpenVMSettingsDialog("#display", "m_pCheckboxVideoCapture");
    19211932}
    19221933
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r46542 r46582  
    193193
    194194    /* "Device" menu functionality: */
    195     void sltOpenVMSettingsDialog(const QString &strCategory = QString());
     195    void sltOpenVMSettingsDialog(const QString &strCategory = QString(), const QString &strControl = QString());
    196196    void sltOpenNetworkAdaptersDialog();
    197197    void sltOpenSharedFoldersDialog();
     
    207207    void sltSwitchVrde(bool fOn);
    208208    void sltToggleVideoCapture(bool fEnabled);
     209    void sltOpenVideoCaptureOptions();
    209210    void sltInstallGuestAdditions();
    210211
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineMenuBar.cpp

    r46542 r46582  
    244244    pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_NetworkAdaptersDialog));
    245245    pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersDialog));
     246    pMenu->addSeparator();
    246247    pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VRDEServer));
    247248    pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture));
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r46542 r46582  
    996996    gActionPool->action(UIActionIndexRuntime_Simple_SettingsDialog)->setEnabled(fAllowReconfiguration);
    997997    gActionPool->action(UIActionIndexRuntime_Simple_SharedFoldersDialog)->setEnabled(fAllowReconfiguration);
     998    gActionPool->action(UIActionIndexRuntime_Simple_VideoCaptureOptions)->setEnabled(fAllowReconfiguration);
    998999    gActionPool->action(UIActionIndexRuntime_Simple_NetworkAdaptersDialog)->setEnabled(fAllowReconfiguration);
    9991000}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp

    r45939 r46582  
    6262}
    6363
     64void UIMachineLogicNormal::sltPrepareVideoCaptureMenu()
     65{
     66    QMenu *pMenu = qobject_cast<QMenu*>(sender());
     67    AssertMsg(pMenu, ("This slot should be called only on Video Capture menu show!\n"));
     68    pMenu->clear();
     69    pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Toggle_VideoCapture));
     70    pMenu->addAction(gActionPool->action(UIActionIndexRuntime_Simple_VideoCaptureOptions));
     71}
     72
    6473void UIMachineLogicNormal::sltPrepareMouseIntegrationMenu()
    6574{
     
    8089    connect(gActionPool->action(UIActionIndexRuntime_Menu_SharedFolders)->menu(), SIGNAL(aboutToShow()),
    8190            this, SLOT(sltPrepareSharedFoldersMenu()));
     91    connect(gActionPool->action(UIActionIndexRuntime_Menu_VideoCapture)->menu(), SIGNAL(aboutToShow()),
     92            this, SLOT(sltPrepareVideoCaptureMenu()));
    8293    connect(gActionPool->action(UIActionIndexRuntime_Menu_MouseIntegration)->menu(), SIGNAL(aboutToShow()),
    8394            this, SLOT(sltPrepareMouseIntegrationMenu()));
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.h

    r41064 r46582  
    4141    void sltPrepareNetworkAdaptersMenu();
    4242    void sltPrepareSharedFoldersMenu();
     43    void sltPrepareVideoCaptureMenu();
    4344    void sltPrepareMouseIntegrationMenu();
    4445
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.cpp

    r44954 r46582  
    100100}
    101101
     102void UIMachineWindowNormal::sltVideoCaptureChange()
     103{
     104    /* Update video-capture stuff: */
     105    updateAppearanceOf(UIVisualElement_VideoCapture);
     106}
     107
    102108void UIMachineWindowNormal::sltCPUExecutionCapChange()
    103109{
     
    149155            gActionPool->action(UIActionIndexRuntime_Menu_SharedFolders)->menu()->exec(pEvent->globalPos());
    150156    }
     157    /* Show video-capture LED context menu: */
     158    else if (pIndicator == indicatorsPool()->indicator(UIIndicatorIndex_VideoCapture))
     159    {
     160        if (gActionPool->action(UIActionIndexRuntime_Menu_VideoCapture)->isEnabled())
     161            gActionPool->action(UIActionIndexRuntime_Menu_VideoCapture)->menu()->exec(pEvent->globalPos());
     162    }
    151163    /* Show mouse LED context menu: */
    152164    else if (pIndicator == indicatorsPool()->indicator(UIIndicatorIndex_Mouse))
     
    187199    connect(machineLogic()->uisession(), SIGNAL(sigSharedFolderChange()),
    188200            this, SLOT(sltSharedFolderChange()));
     201
     202    /* Video capture change updater: */
     203    connect(machineLogic()->uisession(), SIGNAL(sigVideoCaptureChange()),
     204            this, SLOT(sltVideoCaptureChange()));
    189205
    190206    /* CPU execution cap change updater: */
     
    247263    pIndicatorBoxHLayout->addWidget(pLedSharedFolders);
    248264    connect(pLedSharedFolders, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
     265            this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
     266
     267    /* Video Capture: */
     268    QIStateIndicator *pLedVideoCapture = indicatorsPool()->indicator(UIIndicatorIndex_VideoCapture);
     269    pIndicatorBoxHLayout->addWidget(pLedVideoCapture);
     270    connect(pLedVideoCapture, SIGNAL(contextMenuRequested(QIStateIndicator*, QContextMenuEvent*)),
    249271            this, SLOT(sltShowIndicatorsContextMenu(QIStateIndicator*, QContextMenuEvent*)));
    250272
     
    556578    if (iElement & UIVisualElement_SharedFolderStuff)
    557579        indicatorsPool()->indicator(UIIndicatorIndex_SharedFolders)->updateAppearance();
     580    if (iElement & UIVisualElement_VideoCapture)
     581        indicatorsPool()->indicator(UIIndicatorIndex_VideoCapture)->updateAppearance();
    558582    if (iElement & UIVisualElement_VirtualizationStuff)
    559583        indicatorsPool()->indicator(UIIndicatorIndex_Virtualization)->updateAppearance();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineWindowNormal.h

    r41114 r46582  
    5050    void sltNetworkAdapterChange();
    5151    void sltSharedFolderChange();
     52    void sltVideoCaptureChange();
    5253    void sltCPUExecutionCapChange();
    5354
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