VirtualBox

Changeset 45374 in vbox


Ignore:
Timestamp:
Apr 5, 2013 2:22:14 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
84799
Message:

FE/Qt: Cleanup obsolete stuff.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
2 deleted
10 edited

Legend:

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

    r45222 r45374  
    713713endif
    714714
    715 ifdef VBOX_GUI_WITH_SYSTRAY
    716  VirtualBox_DEFS += VBOX_GUI_WITH_SYSTRAY
    717  VirtualBox_QT_MOCHDRS += \
    718         src/selector/VBoxTrayIcon.h
    719  VirtualBox_SOURCES += \
    720         src/selector/VBoxTrayIcon.cpp
    721 endif
    722 
    723715if defined(VBOX_WITH_VIDEOHWACCEL) || defined(VBOX_GUI_USE_QGL)
    724716 VirtualBox_SOURCES += \
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.cpp

    r45054 r45374  
    124124#endif /* VBOX_WITH_VIDEOHWACCEL */
    125125
    126 #ifdef VBOX_GUI_WITH_SYSTRAY
    127 /* Tray icon declarations: */
    128 const char* UIDefs::GUI_TrayIconWinID = "GUI/TrayIcon/WinID";
    129 const char* UIDefs::GUI_TrayIconEnabled = "GUI/TrayIcon/Enabled";
    130 const char* UIDefs::GUI_MainWindowCount = "GUI/MainWindowCount";
    131 #endif /* VBOX_GUI_WITH_SYSTRAY */
    132 
    133126/* File extensions definitions: */
    134127QStringList UIDefs::VBoxFileExts = QStringList() << "xml" << "vbox";
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDefs.h

    r45054 r45374  
    201201#endif /* VBOX_WITH_VIDEOHWACCEL */
    202202
    203 #ifdef VBOX_GUI_WITH_SYSTRAY
    204     /* Tray icon declarations: */
    205     extern const char* GUI_TrayIconWinID;
    206     extern const char* GUI_TrayIconEnabled;
    207     extern const char* GUI_MainWindowCount;
    208 #endif /* VBOX_GUI_WITH_SYSTRAY */
    209 
    210203    /* File extensions declarations: */
    211204    extern QStringList VBoxFileExts;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIExtraDataEventHandler.cpp

    r44453 r45374  
    4040    UIExtraDataEventHandlerPrivate(QObject *pParent = 0)
    4141        : QObject(pParent)
    42 #ifdef VBOX_GUI_WITH_SYSTRAY
    43         , m_fIsTrayIconOwner(false)
    44 #endif /* VBOX_GUI_WITH_SYSTRAY */
    4542    {}
    4643
     
    5451            if (strKey.startsWith("GUI/"))
    5552            {
    56 #ifdef VBOX_GUI_WITH_SYSTRAY
    57                 if (strKey == GUI_TrayIconWinID)
    58                 {
    59                     if (m_fIsTrayIconOwner)
    60                     {
    61                         if (!(strValue.isEmpty() ||
    62                               strValue == QString("%1")
    63                               .arg((qulonglong)vboxGlobal().mainWindow()->winId())))
    64                             fVeto = true;
    65                     }
    66                     return;
    67                 }
    68 #endif /* VBOX_GUI_WITH_SYSTRAY */
    6953                /* Try to set the global setting to check its syntax */
    7054                VBoxGlobalSettings gs(false /* non-null */);
     
    9680                if (strKey == GUI_Input_MachineShortcuts && gActionPool->type() == UIActionPoolType_Runtime)
    9781                    emit sigMachineShortcutsChanged();
    98 #ifdef VBOX_GUI_WITH_SYSTRAY
    99                 if (strKey == GUI_MainWindowCount)
    100                     emit sigMainWindowCountChange(strValue.toInt());
    101                 if (strKey == GUI_TrayIconWinID)
    102                 {
    103                     if (strValue.isEmpty())
    104                     {
    105                         m_fIsTrayIconOwner = false;
    106                         emit sigCanShowTrayIcon(true);
    107                     }
    108                     else if (strValue == QString("%1")
    109                              .arg((qulonglong)vboxGlobal().mainWindow()->winId()))
    110                     {
    111                         m_fIsTrayIconOwner = true;
    112                         emit sigCanShowTrayIcon(true);
    113                     }
    114                     else
    115                         emit sigCanShowTrayIcon(false);
    116                 }
    117                 if (strKey == GUI_TrayIconEnabled)
    118                     emit sigTrayIconChange((strValue.toLower() == "true") ? true : false);
    119 #endif /* VBOX_GUI_WITH_SYSTRAY */
    12082#ifdef Q_WS_MAC
    12183                if (strKey == GUI_PresentationModeEnabled)
     
    156118    void sigSelectorShortcutsChanged();
    157119    void sigMachineShortcutsChanged();
    158 #ifdef VBOX_GUI_WITH_SYSTRAY
    159     void sigMainWindowCountChange(int count);
    160     void sigCanShowTrayIcon(bool fEnabled);
    161     void sigTrayIconChange(bool fEnabled);
    162 #endif /* VBOX_GUI_WITH_SYSTRAY */
    163120#ifdef RT_OS_DARWIN
    164121    void sigPresentationModeChange(bool fEnabled);
     
    170127    /** protects #OnExtraDataChange() */
    171128    QMutex m_mutex;
    172 
    173     /* Private member vars */
    174 #ifdef VBOX_GUI_WITH_SYSTRAY
    175     bool m_fIsTrayIconOwner;
    176 #endif /* VBOX_GUI_WITH_SYSTRAY */
    177129};
    178130
     
    239191            Qt::QueuedConnection);
    240192
    241 #ifdef VBOX_GUI_WITH_SYSTRAY
    242     connect(m_pHandler, SIGNAL(sigMainWindowCountChange(int)),
    243             this, SIGNAL(sigMainWindowCountChange(int)),
    244             Qt::QueuedConnection);
    245 
    246     connect(m_pHandler, SIGNAL(sigCanShowTrayIcon(bool)),
    247             this, SIGNAL(sigCanShowTrayIcon(bool)),
    248             Qt::QueuedConnection);
    249 
    250     connect(m_pHandler, SIGNAL(sigTrayIconChange(bool)),
    251             this, SIGNAL(sigTrayIconChange(bool)),
    252             Qt::QueuedConnection);
    253 #endif /* VBOX_GUI_WITH_SYSTRAY */
    254 
    255193#ifdef Q_WS_MAC
    256194    connect(m_pHandler, SIGNAL(sigPresentationModeChange(bool)),
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIExtraDataEventHandler.h

    r44453 r45374  
    3939    void sigSelectorShortcutsChanged();
    4040    void sigMachineShortcutsChanged();
    41 #ifdef VBOX_GUI_WITH_SYSTRAY
    42     void sigMainWindowCountChange(int count);
    43     void sigCanShowTrayIcon(bool fEnabled);
    44     void sigTrayIconChange(bool fEnabled);
    45 #endif /* VBOX_GUI_WITH_SYSTRAY */
    4641#ifdef RT_OS_DARWIN
    4742    void sigPresentationModeChange(bool fEnabled);
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r45371 r45374  
    8585# include "VBoxFBOverlay.h"
    8686#endif /* VBOX_WITH_VIDEOHWACCEL */
    87 
    88 #ifdef VBOX_GUI_WITH_SYSTRAY
    89 #include <iprt/process.h>
    90 #if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
    91 #define HOSTSUFF_EXE ".exe"
    92 #else /* !RT_OS_WINDOWS */
    93 #define HOSTSUFF_EXE ""
    94 #endif /* !RT_OS_WINDOWS */
    95 #endif /* VBOX_GUI_WITH_SYSTRAY */
    9687
    9788/* COM includes: */
     
    280271    , m_pVirtualMachine(0)
    281272    , mMainWindow (NULL)
    282 #ifdef VBOX_GUI_WITH_SYSTRAY
    283     , mIsTrayMenu (false)
    284     , mIncreasedWindowCounter (false)
    285 #endif
    286273    , mMediaEnumThread (NULL)
    287274    , mIsKWinManaged (false)
     
    525512    return s.value(QString("%1").arg(aKey)).toString();
    526513}
    527 
    528 #ifdef VBOX_GUI_WITH_SYSTRAY
    529 
    530 /**
    531  *  Returns true if the current instance a systray menu only (started with
    532  *  "-systray" parameter).
    533  */
    534 bool VBoxGlobal::isTrayMenu() const
    535 {
    536     return mIsTrayMenu;
    537 }
    538 
    539 void VBoxGlobal::setTrayMenu(bool aIsTrayMenu)
    540 {
    541     mIsTrayMenu = aIsTrayMenu;
    542 }
    543 
    544 /**
    545  *  Spawns a new selector window (process).
    546  */
    547 void VBoxGlobal::trayIconShowSelector()
    548 {
    549     /* Get the path to the executable. */
    550     char path[RTPATH_MAX];
    551     RTPathAppPrivateArch(path, RTPATH_MAX);
    552     size_t sz = strlen(path);
    553     path[sz++] = RTPATH_DELIMITER;
    554     path[sz] = 0;
    555     char *cmd = path + sz;
    556     sz = RTPATH_MAX - sz;
    557 
    558     int rc = 0;
    559     const char VirtualBox_exe[] = "VirtualBox" HOSTSUFF_EXE;
    560     Assert(sz >= sizeof(VirtualBox_exe));
    561     strcpy(cmd, VirtualBox_exe);
    562     const char * args[] = {path, 0 };
    563     rc = RTProcCreate(path, args, RTENV_DEFAULT, RTPROC_FLAGS_DETACHED, NULL);
    564     if (RT_FAILURE(rc))
    565         LogRel(("Systray: Failed to start new selector window! Path=%s, rc=%Rrc\n", path, rc));
    566 }
    567 
    568 /**
    569  *  Tries to install the tray icon using the current instance (singleton).
    570  *  Returns true if this instance is the tray icon, false if not.
    571  */
    572 bool VBoxGlobal::trayIconInstall()
    573 {
    574     int rc = 0;
    575     QString strTrayWinID = mVBox.GetExtraData(GUI_TrayIconWinID);
    576     if (false == strTrayWinID.isEmpty())
    577     {
    578         /* Check if current tray icon is alive by writing some bogus value. */
    579         mVBox.SetExtraData(GUI_TrayIconWinID, "0");
    580         if (mVBox.isOk())
    581         {
    582             /* Current tray icon died - clean up. */
    583             mVBox.SetExtraData(GUI_TrayIconWinID, NULL);
    584             strTrayWinID.clear();
    585         }
    586     }
    587 
    588     /* Is there already a tray icon or is tray icon not active? */
    589     if (   (mIsTrayMenu == false)
    590         && (vboxGlobal().settings().trayIconEnabled())
    591         && (QSystemTrayIcon::isSystemTrayAvailable())
    592         && (strTrayWinID.isEmpty()))
    593     {
    594         /* Get the path to the executable. */
    595         char path[RTPATH_MAX];
    596         RTPathAppPrivateArch(path, RTPATH_MAX);
    597         size_t sz = strlen(path);
    598         path[sz++] = RTPATH_DELIMITER;
    599         path[sz] = 0;
    600         char *cmd = path + sz;
    601         sz = RTPATH_MAX - sz;
    602 
    603         const char VirtualBox_exe[] = "VirtualBox" HOSTSUFF_EXE;
    604         Assert(sz >= sizeof(VirtualBox_exe));
    605         strcpy(cmd, VirtualBox_exe);
    606         const char * args[] = {path, "-systray", 0 };
    607         rc = RTProcCreate(path, args, RTENV_DEFAULT, RTPROC_FLAGS_DETACHED, NULL);
    608         if (RT_FAILURE(rc))
    609         {
    610             LogRel(("Systray: Failed to start systray window! Path=%s, rc=%Rrc\n", path, rc));
    611             return false;
    612         }
    613     }
    614 
    615     if (mIsTrayMenu)
    616     {
    617         // Use this selector for displaying the tray icon
    618         mVBox.SetExtraData(GUI_TrayIconWinID,
    619                            QString("%1").arg((qulonglong)vboxGlobal().mainWindow()->winId()));
    620 
    621         /* The first process which can grab this "mutex" will win ->
    622          * It will be the tray icon menu then. */
    623         if (mVBox.isOk())
    624         {
    625             emit sigTrayIconShow(true);
    626             return true;
    627         }
    628     }
    629 
    630     return false;
    631 }
    632 
    633 #endif
    634514
    635515#ifdef Q_WS_X11
     
    23032183    return QString();
    23042184}
    2305 
    2306 #ifdef VBOX_GUI_WITH_SYSTRAY
    2307 /**
    2308  *  Returns the number of current running Fe/Qt4 main windows.
    2309  *
    2310  *  @return Number of running main windows.
    2311  */
    2312 int VBoxGlobal::mainWindowCount ()
    2313 {
    2314     return mVBox.GetExtraData (GUI_MainWindowCount).toInt();
    2315 }
    2316 #endif
    23172185
    23182186/**
     
    41864054    connect(gEDataEvents, SIGNAL(sigGUILanguageChange(QString)),
    41874055            this, SLOT(sltGUILanguageChange(QString)));
    4188 
    4189 #ifdef VBOX_GUI_WITH_SYSTRAY
    4190     {
    4191         /* Increase open Fe/Qt4 windows reference count. */
    4192         int c = mVBox.GetExtraData (GUI_MainWindowCount).toInt() + 1;
    4193         AssertMsgReturnVoid ((c >= 0) || (mVBox.isOk()),
    4194             ("Something went wrong with the window reference count!"));
    4195         mVBox.SetExtraData (GUI_MainWindowCount, QString ("%1").arg (c));
    4196         mIncreasedWindowCounter = mVBox.isOk();
    4197         AssertReturnVoid (mIncreasedWindowCounter);
    4198     }
    4199 #endif
    42004056
    42014057    /* Initialize guest OS Type list. */
     
    43804236            bForceFullscreen = true;
    43814237        }
    4382 #ifdef VBOX_GUI_WITH_SYSTRAY
    4383         else if (!::strcmp (arg, "-systray") || !::strcmp (arg, "--systray"))
    4384         {
    4385             mIsTrayMenu = true;
    4386         }
    4387 #endif
    43884238        else if (!::strcmp (arg, "-comment") || !::strcmp (arg, "--comment"))
    43894239        {
     
    46134463    }
    46144464
    4615 #ifdef VBOX_GUI_WITH_SYSTRAY
    4616     if (mIncreasedWindowCounter)
    4617     {
    4618         /* Decrease open Fe/Qt4 windows reference count. */
    4619         int c = mVBox.GetExtraData (GUI_MainWindowCount).toInt() - 1;
    4620         AssertMsg ((c >= 0) || (mVBox.isOk()),
    4621             ("Something went wrong with the window reference count!"));
    4622         if (c < 0)
    4623             c = 0;   /* Clean up the mess. */
    4624         mVBox.SetExtraData (GUI_MainWindowCount,
    4625                             (c > 0) ? QString ("%1").arg (c) : NULL);
    4626         AssertWrapperOk (mVBox);
    4627         if (c == 0)
    4628         {
    4629             mVBox.SetExtraData (GUI_TrayIconWinID, NULL);
    4630             AssertWrapperOk (mVBox);
    4631         }
    4632     }
    4633 #endif
    4634 
    46354465#ifdef VBOX_GUI_WITH_PIDFILE
    46364466    deletePidfile();
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r45325 r45374  
    114114    bool isVMConsoleProcess() const { return !vmUuid.isNull(); }
    115115    bool showStartVMErrors() const { return mShowStartVMErrors; }
    116 #ifdef VBOX_GUI_WITH_SYSTRAY
    117     bool isTrayMenu() const;
    118     void setTrayMenu(bool aIsTrayMenu);
    119     void trayIconShowSelector();
    120     bool trayIconInstall();
    121 #endif
    122116    QString managedVMUuid() const { return vmUuid; }
    123117    QList<QUrl> &argUrlList() { return m_ArgUrlList; }
     
    424418    void mediumRemoved (UIMediumType, const QString &);
    425419
    426 #ifdef VBOX_GUI_WITH_SYSTRAY
    427     void sigTrayIconShow(bool fEnabled);
    428 #endif
    429 
    430420public slots:
    431421
     
    465455    QString vmUuid;
    466456    QList<QUrl> m_ArgUrlList;
    467 
    468 #ifdef VBOX_GUI_WITH_SYSTRAY
    469     bool mIsTrayMenu : 1; /*< Tray icon active/desired? */
    470     bool mIncreasedWindowCounter : 1;
    471 #endif
    472457
    473458    /** Whether to show error message boxes for VM start errors. */
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r45268 r45374  
    483483            if (vboxGlobal().isVMConsoleProcess())
    484484            {
    485 #ifdef VBOX_GUI_WITH_SYSTRAY
    486                 if (vboxGlobal().trayIconInstall())
    487                 {
    488                     /* Nothing to do here yet. */
    489                 }
    490 #endif
    491485                if (vboxGlobal().startMachine (vboxGlobal().managedVMUuid()))
    492486                {
     
    519513
    520514                vboxGlobal().setMainWindow (&vboxGlobal().selectorWnd());
    521 #ifdef VBOX_GUI_WITH_SYSTRAY
    522                 if (vboxGlobal().trayIconInstall())
    523                 {
    524                     /* Nothing to do here yet. */
    525                 }
    526 
    527                 if (false == vboxGlobal().isTrayMenu())
    528                 {
    529 #endif
    530515                    vboxGlobal().selectorWnd().show();
    531 #ifdef VBOX_GUI_WITH_SYSTRAY
    532                 }
    533 
    534                 do
    535                 {
    536 #endif
    537516                    rc = a.exec();
    538 #ifdef VBOX_GUI_WITH_SYSTRAY
    539                 } while (vboxGlobal().isTrayMenu());
    540 #endif
    541517            }
    542518        }
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp

    r45371 r45374  
    941941    sltCurrentVMItemChanged();
    942942
    943 #ifdef VBOX_GUI_WITH_SYSTRAY
    944     if (vboxGlobal().isTrayMenu())
    945     {
    946         m_pTrayIcon->retranslateUi();
    947         m_pTrayIcon->refresh();
    948     }
    949 #endif /* VBOX_GUI_WITH_SYSTRAY */
    950 
    951943#ifdef QT_MAC_USE_COCOA
    952944    /* There is a bug in Qt Cocoa which result in showing a "more arrow" when
     
    14861478            this, SLOT(sltShowMachineSettingsDialog(const QString&, const QString&, const QString&)));
    14871479
    1488 #ifdef VBOX_GUI_WITH_SYSTRAY
    1489     /* Tray icon connections: */
    1490     connect(m_pTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
    1491             this, SLOT(sltTrayIconActivated(QSystemTrayIcon::ActivationReason)));
    1492     connect(gEDataEvents, SIGNAL(sigMainWindowCountChange(int)), this, SLOT(sltMainWindowCountChanged(int)));
    1493     connect(gEDataEvents, SIGNAL(sigCanShowTrayIcon(bool)), this, SLOT(sltTrayIconCanShow(bool)));
    1494     connect(gEDataEvents, SIGNAL(sigTrayIconChange(bool)), this, SLOT(sltTrayIconChanged(bool)));
    1495     connect(&vboxGlobal(), SIGNAL(sigTrayIconShow(bool)), this, SLOT(sltTrayIconShow(bool)));
    1496 #endif /* VBOX_GUI_WITH_SYSTRAY */
    1497 
    14981480    /* Global event handlers: */
    14991481    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltStateChanged(QString)));
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsGeneral.cpp

    r44528 r45374  
    3131    Ui::UIGlobalSettingsGeneral::setupUi(this);
    3232
    33 #ifndef VBOX_GUI_WITH_SYSTRAY
    34     m_pEnableTrayIconCheckbox->hide();
    35     m_pSpacerWidget1->hide();
    36 #endif /* !VBOX_GUI_WITH_SYSTRAY */
    3733#ifndef Q_WS_MAC
    3834    m_pEnablePresentationModeCheckbox->hide();
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