VirtualBox

Changeset 26581 in vbox


Ignore:
Timestamp:
Feb 16, 2010 2:21:00 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: Moved the realtime dock preview settings to the VM settings (no global
option anymore). Use the dock menu to configure it. Added the VM menu to the
dock menu.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
5 edited

Legend:

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

    r26568 r26581  
    678678#endif
    679679
     680#ifdef Q_WS_MAC
     681    m_pDockMenu = new QMenu(this);
     682    /* Add all VM menu entries to the dock menu. Leave out close and stuff like
     683     * this. */
     684    QList<QAction*> actions = mVMMenu->actions();
     685    for (int i=0; i < actions.size(); ++i)
     686        if (actions.at(i)->menuRole() == QAction::TextHeuristicRole)
     687            m_pDockMenu->addAction(actions.at(i));
     688    m_pDockMenu->addSeparator();
     689
     690    m_pDockSettingsMenu = new QMenu(this);
     691    QActionGroup *pDockPreviewModeGroup = new QActionGroup(this);
     692    m_pDockEnablePreviewMonitor = new QAction(pDockPreviewModeGroup);
     693    m_pDockEnablePreviewMonitor->setCheckable(true);
     694    m_pDockDisablePreview = new QAction(pDockPreviewModeGroup);
     695    m_pDockDisablePreview->setCheckable(true);
     696    m_pDockSettingsMenu->addActions(pDockPreviewModeGroup->actions());
     697
     698    m_pDockMenu->addMenu(m_pDockSettingsMenu);
     699
     700    /* Add it to the dock. */
     701    extern void qt_mac_set_dock_menu(QMenu *);
     702    qt_mac_set_dock_menu(m_pDockMenu);
     703#endif /* Q_WS_MAC */
     704
    680705    /* add to statusbar */
    681706    statusBar()->addPermanentWidget (indicatorBox, 0);
     
    739764             this, SLOT (processGlobalSettingChange (const char *, const char *)));
    740765#ifdef Q_WS_MAC
     766    connect(pDockPreviewModeGroup, SIGNAL(triggered(QAction*)),
     767            this, SLOT(sltDockPreviewModeChanged(QAction*)));
    741768    connect (&vboxGlobal(), SIGNAL (dockIconUpdateChanged (const VBoxChangeDockIconUpdateEvent &)),
    742769             this, SLOT (changeDockIconUpdate (const VBoxChangeDockIconUpdateEvent &)));
     
    777804#endif
    778805}
     806
     807#ifdef Q_WS_MAC
     808void VBoxConsoleWnd::sltDockPreviewModeChanged(QAction *pAction)
     809{
     810    if (mConsole)
     811    {
     812        CMachine machine = mSession.GetMachine();
     813        if (!machine.isNull())
     814        {
     815            if (pAction == m_pDockDisablePreview)
     816                machine.SetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled, "false");
     817            else if (pAction == m_pDockEnablePreviewMonitor)
     818                machine.SetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled, "true");
     819            mConsole->updateDockOverlay();
     820        }
     821    }
     822}
     823#endif /* Q_WS_MAC */
    779824
    780825/**
     
    10021047
    10031048#ifdef Q_WS_MAC
    1004     QString testStr = vboxGlobal().virtualBox().GetExtraData (VBoxDefs::GUI_RealtimeDockIconUpdateEnabled).toLower();
     1049    QString strTest = machine.GetExtraData(VBoxDefs::GUI_RealtimeDockIconUpdateEnabled).toLower();
    10051050    /* Default to true if it is an empty value */
    1006     bool f = (testStr.isEmpty() || testStr == "true");
     1051    bool f = (strTest.isEmpty() || strTest == "true");
     1052    if (f)
     1053        m_pDockEnablePreviewMonitor->setChecked(true);
     1054    else
     1055        m_pDockDisablePreview->setChecked(true);
    10071056    mConsole->setDockIconEnabled (f);
    10081057    mConsole->updateDockOverlay();
     
    17591808    mHelpMenu->setTitle (tr ("&Help"));
    17601809    // mHelpMenu->setIcon (VBoxGlobal::iconSet (":/help_16px.png"));
     1810
     1811#ifdef Q_WS_MAC
     1812    m_pDockSettingsMenu->setTitle(tr("Dock Icon"));
     1813    m_pDockDisablePreview->setText(tr("Show Application Icon"));
     1814    m_pDockEnablePreviewMonitor->setText(tr("Show Monitor Preview"));
     1815#endif /* Q_WS_MAC */
    17611816
    17621817    /* Status bar widgets */
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.h

    r26567 r26581  
    115115    void onDisplayResize (ulong aWidth, ulong aHeight);
    116116
    117 #ifdef VBOX_WITH_VIDEOHWACCEL
    118117    /* used for obtaining the extradata settings */
    119118    CSession &session() { return mSession; }
    120 #endif
    121119signals:
    122120
     
    188186    void changePresentationMode (const VBoxChangePresentationModeEvent &aEvent);
    189187    void processGlobalSettingChange (const char *aPublicName, const char *aName);
     188
     189#ifdef RT_OS_DARWIN /* Stupid moc doesn't recognize Q_WS_MAC */
     190    void sltDockPreviewModeChanged(QAction *pAction);
     191#endif /* RT_OS_DARWIN */
    190192
    191193#ifdef VBOX_WITH_DEBUGGER_GUI
     
    308310#endif
    309311
     312#ifdef Q_WS_MAC
     313    QMenu *m_pDockMenu;
     314    QMenu *m_pDockSettingsMenu;
     315    QAction *m_pDockDisablePreview;
     316    QAction *m_pDockEnablePreviewMonitor;
     317#endif /* Q_WS_MAC */
     318
    310319    /* Timer to update LEDs */
    311320    QTimer *mIdleTimer;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r26553 r26581  
    373373#endif
    374374#ifdef Q_WS_MAC
    375                 if (sKey == VBoxDefs::GUI_RealtimeDockIconUpdateEnabled)
    376                 {
    377                     /* Default to true if it is an empty value */
    378                     QString testStr = sVal.toLower();
    379                     bool f = (testStr.isEmpty() || testStr == "true");
    380                     QApplication::postEvent (&mGlobal, new VBoxChangeDockIconUpdateEvent (f));
    381                 }
    382                 else if (sKey == VBoxDefs::GUI_PresentationModeEnabled)
     375                if (sKey == VBoxDefs::GUI_PresentationModeEnabled)
    383376                {
    384377                    /* Default to true if it is an empty value */
     
    395388            }
    396389        }
     390#ifdef Q_WS_MAC
     391        else if (mGlobal.isVMConsoleProcess())
     392        {
     393            /* Check for the currently running machine */
     394            CMachine machine = mGlobal.consoleWnd().session().GetMachine();
     395            if (QString::fromUtf16(id) == machine.GetId())
     396            {
     397                QString strKey = QString::fromUtf16(key);
     398                QString strVal = QString::fromUtf16(value);
     399                if (strKey == VBoxDefs::GUI_RealtimeDockIconUpdateEnabled)
     400                {
     401                    /* Default to true if it is an empty value */
     402                    QString strTest = strVal.toLower();
     403                    bool f = (strTest.isEmpty() || strTest == "true");
     404                    QApplication::postEvent(&mGlobal, new VBoxChangeDockIconUpdateEvent(f));
     405                }
     406            }
     407        }
     408#endif /* Q_WS_MAC */
    397409        return S_OK;
    398410    }
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/VBoxGLSettingsGeneral.cpp

    r25319 r26581  
    3434    mCbCheckTrayIcon->hide();
    3535#endif /* VBOX_GUI_WITH_SYSTRAY */
    36 #ifndef Q_WS_MAC
    37     mCbCheckDockPreview->hide();
    38 #endif /* Q_WS_MAC */
    3936#ifndef QT_MAC_USE_COCOA
    4037    mCbCheckPresentationMode->hide();
    4138#endif /* QT_MAC_USE_COCOA */
    4239    if (   mCbCheckTrayIcon->isHidden()
    43         && mCbCheckDockPreview->isHidden()
    4440        && mCbCheckPresentationMode->isHidden())
    4541        mLnSeparator2->hide();
     
    6258    mCbCheckTrayIcon->setChecked (aGs.trayIconEnabled());
    6359#ifdef Q_WS_MAC
    64     mCbCheckDockPreview->setChecked (aGs.dockPreviewEnabled());
    6560    mCbCheckPresentationMode->setChecked (aGs.presentationModeEnabled());
    6661#endif /* Q_WS_MAC */
     
    7873    aGs.setTrayIconEnabled (mCbCheckTrayIcon->isChecked());
    7974#ifdef Q_WS_MAC
    80     aGs.setDockPreviewEnabled (mCbCheckDockPreview->isChecked());
    8175    aGs.setPresentationModeEnabled (mCbCheckPresentationMode->isChecked());
    8276#endif /* Q_WS_MAC */
     
    8983    setTabOrder (mPsMach, mPsVRDP);
    9084    setTabOrder (mPsVRDP, mCbCheckTrayIcon);
    91 #ifdef Q_WS_MAC
    92     setTabOrder (mCbCheckTrayIcon, mCbCheckDockPreview);
    93 #endif /* Q_WS_MAC */
    9485}
    9586
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/VBoxGLSettingsGeneral.ui

    r25318 r26581  
    2424    <x>0</x>
    2525    <y>0</y>
    26     <width>402</width>
    27     <height>212</height>
     26    <width>379</width>
     27    <height>173</height>
    2828   </rect>
    2929  </property>
     
    128128    </widget>
    129129   </item>
    130    <item row="6" column="1" colspan="2">
    131     <widget class="QCheckBox" name="mCbCheckDockPreview">
    132      <property name="whatsThis">
    133       <string>When checked, the Dock Icon will reflect the VM window content in realtime.</string>
    134      </property>
    135      <property name="text">
    136       <string>&amp;Dock Icon Realtime Preview</string>
    137      </property>
    138      <property name="checked">
    139       <bool>true</bool>
    140      </property>
    141     </widget>
    142    </item>
    143    <item row="11" column="0" colspan="3">
     130   <item row="10" column="0" colspan="3">
    144131    <spacer>
    145132     <property name="orientation">
     
    154141    </spacer>
    155142   </item>
    156    <item row="7" column="1" colspan="2">
     143   <item row="6" column="1" colspan="2">
    157144    <widget class="QCheckBox" name="mCbCheckPresentationMode">
    158145     <property name="text">
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