VirtualBox

Changeset 68190 in vbox


Ignore:
Timestamp:
Jul 31, 2017 10:25:22 AM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: Using Qt5 signal-slot connection notation for VBox Qt globals.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/globals
Files:
11 edited

Legend:

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

    r67837 r68190  
    111111#ifdef VBOX_WS_MAC
    112112    /* Make sure each action notifies it's parent about hovering: */
    113     connect(this, SIGNAL(hovered()), parent(), SLOT(sltActionHovered()));
    114 #endif /* VBOX_WS_MAC */
     113    connect(this, &UIAction::hovered,
     114            static_cast<UIActionPool*>(parent()), &UIActionPool::sltActionHovered);
     115#endif
    115116}
    116117
     
    230231    {
    231232        /* Prepare menu: */
    232         connect(menu(), SIGNAL(aboutToShow()),
    233                 parent(), SLOT(sltHandleMenuPrepare()));
     233        connect(menu(), &UIMenu::aboutToShow,
     234                actionPool(), &UIActionPool::sltHandleMenuPrepare);
    234235    }
    235236}
     
    395396    {
    396397        /* Prepare menu: */
    397         connect(m_pMenu, SIGNAL(aboutToShow()),
    398                 parent(), SLOT(sltHandleMenuPrepare()));
     398        connect(m_pMenu, &UIMenu::aboutToShow,
     399                actionPool(), &UIActionPool::sltHandleMenuPrepare);
    399400        /* Show menu: */
    400401        showMenu();
     
    11561157    /* 'Application' menu connections: */
    11571158#ifdef RT_OS_DARWIN
    1158     connect(action(UIActionIndex_M_Application_S_About), SIGNAL(triggered()),
    1159             &msgCenter(), SLOT(sltShowHelpAboutDialog()), Qt::UniqueConnection);
     1159    connect(action(UIActionIndex_M_Application_S_About), &UIAction::triggered,
     1160            &msgCenter(), &UIMessageCenter::sltShowHelpAboutDialog, Qt::UniqueConnection);
    11601161#endif /* RT_OS_DARWIN */
    11611162#ifdef VBOX_GUI_WITH_NETWORK_MANAGER
    1162     connect(action(UIActionIndex_M_Application_S_NetworkAccessManager), SIGNAL(triggered()),
    1163             gNetworkManager, SLOT(show()), Qt::UniqueConnection);
    1164     connect(action(UIActionIndex_M_Application_S_CheckForUpdates), SIGNAL(triggered()),
    1165             gUpdateManager, SLOT(sltForceCheck()), Qt::UniqueConnection);
     1163    connect(action(UIActionIndex_M_Application_S_NetworkAccessManager), &UIAction::triggered,
     1164            gNetworkManager, &UINetworkManager::show, Qt::UniqueConnection);
     1165    connect(action(UIActionIndex_M_Application_S_CheckForUpdates), &UIAction::triggered,
     1166            gUpdateManager, &UIUpdateManager::sltForceCheck, Qt::UniqueConnection);
    11661167#endif /* VBOX_GUI_WITH_NETWORK_MANAGER */
    1167     connect(action(UIActionIndex_M_Application_S_ResetWarnings), SIGNAL(triggered()),
    1168             &msgCenter(), SLOT(sltResetSuppressedMessages()), Qt::UniqueConnection);
     1168    connect(action(UIActionIndex_M_Application_S_ResetWarnings), &UIAction::triggered,
     1169            &msgCenter(), &UIMessageCenter::sltResetSuppressedMessages, Qt::UniqueConnection);
    11691170
    11701171    /* 'Help' menu connections: */
    1171     connect(action(UIActionIndex_Simple_Contents), SIGNAL(triggered()),
    1172             &msgCenter(), SLOT(sltShowHelpHelpDialog()), Qt::UniqueConnection);
    1173     connect(action(UIActionIndex_Simple_WebSite), SIGNAL(triggered()),
    1174             &msgCenter(), SLOT(sltShowHelpWebDialog()), Qt::UniqueConnection);
    1175     connect(action(UIActionIndex_Simple_BugTracker), SIGNAL(triggered()),
    1176             &msgCenter(), SLOT(sltShowBugTracker()), Qt::UniqueConnection);
    1177     connect(action(UIActionIndex_Simple_Forums), SIGNAL(triggered()),
    1178             &msgCenter(), SLOT(sltShowForums()), Qt::UniqueConnection);
    1179     connect(action(UIActionIndex_Simple_Oracle), SIGNAL(triggered()),
    1180             &msgCenter(), SLOT(sltShowOracle()), Qt::UniqueConnection);
     1172    connect(action(UIActionIndex_Simple_Contents), &UIAction::triggered,
     1173            &msgCenter(), &UIMessageCenter::sltShowHelpHelpDialog, Qt::UniqueConnection);
     1174    connect(action(UIActionIndex_Simple_WebSite), &UIAction::triggered,
     1175            &msgCenter(), &UIMessageCenter::sltShowHelpWebDialog, Qt::UniqueConnection);
     1176    connect(action(UIActionIndex_Simple_BugTracker), &UIAction::triggered,
     1177            &msgCenter(), &UIMessageCenter::sltShowBugTracker, Qt::UniqueConnection);
     1178    connect(action(UIActionIndex_Simple_Forums), &UIAction::triggered,
     1179            &msgCenter(), &UIMessageCenter::sltShowForums, Qt::UniqueConnection);
     1180    connect(action(UIActionIndex_Simple_Oracle), &UIAction::triggered,
     1181            &msgCenter(), &UIMessageCenter::sltShowOracle, Qt::UniqueConnection);
    11811182#ifndef RT_OS_DARWIN
    1182     connect(action(UIActionIndex_Simple_About), SIGNAL(triggered()),
    1183             &msgCenter(), SLOT(sltShowHelpAboutDialog()), Qt::UniqueConnection);
     1183    connect(action(UIActionIndex_Simple_About), &UIAction::triggered,
     1184            &msgCenter(), &UIMessageCenter::sltShowHelpAboutDialog, Qt::UniqueConnection);
    11841185#endif /* !RT_OS_DARWIN */
    11851186}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPool.h

    r64715 r68190  
    460460    virtual QList<QMenu*> menus() const = 0;
    461461
    462 protected slots:
     462public slots:
    463463
    464464    /** Handles menu prepare. */
    465465    void sltHandleMenuPrepare();
    466 
    467     /** Loads keyboard shortcuts of action-pool into shortcuts-pool. */
    468     void sltApplyShortcuts() { updateShortcuts(); }
    469466
    470467#ifdef VBOX_WS_MAC
    471468    /** Handles action hovered signal. */
    472469    void sltActionHovered();
    473 #endif /* VBOX_WS_MAC */
     470#endif
     471
     472protected slots:
     473
     474    /** Loads keyboard shortcuts of action-pool into shortcuts-pool. */
     475    void sltApplyShortcuts() { updateShortcuts(); }
    474476
    475477protected:
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIAnimationFramework.cpp

    r68165 r68190  
    8585    m_pStateStart = new QState(m_pAnimationMachine);
    8686    m_pStateStart->assignProperty(parent(), "AnimationState", QString("Start"));
    87     connect(m_pStateStart, SIGNAL(propertiesAssigned()), this, SIGNAL(sigStateEnteredStart()));
     87    connect(m_pStateStart, &QState::propertiesAssigned, this, &UIAnimation::sigStateEnteredStart);
    8888    /* Create 'final' state: */
    8989    m_pStateFinal = new QState(m_pAnimationMachine);
    9090    m_pStateFinal->assignProperty(parent(), "AnimationState", QString("Final"));
    91     connect(m_pStateFinal, SIGNAL(propertiesAssigned()), this, SIGNAL(sigStateEnteredFinal()));
     91    connect(m_pStateFinal, &QState::propertiesAssigned, this, &UIAnimation::sigStateEnteredFinal);
    9292
    9393    /* Prepare 'forward' animation: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.cpp

    r64651 r68190  
    405405
    406406    /* Listen for screen signals: */
    407     connect(pHostScreen, SIGNAL(geometryChanged(const QRect &)),
    408             this, SLOT(sltHandleHostScreenResized(const QRect &)));
    409     connect(pHostScreen, SIGNAL(availableGeometryChanged(const QRect &)),
    410             this, SLOT(sltHandleHostScreenWorkAreaResized(const QRect &)));
     407    connect(pHostScreen, &QScreen::geometryChanged,
     408            this, &UIDesktopWidgetWatchdog::sltHandleHostScreenResized);
     409    connect(pHostScreen, &QScreen::availableGeometryChanged,
     410            this, &UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized);
    411411
    412412# ifdef VBOX_WS_X11
     
    424424
    425425    /* Forget about screen signals: */
    426     disconnect(pHostScreen, SIGNAL(geometryChanged(const QRect &)),
    427                this, SLOT(sltHandleHostScreenResized(const QRect &)));
    428     disconnect(pHostScreen, SIGNAL(availableGeometryChanged(const QRect &)),
    429                this, SLOT(sltHandleHostScreenWorkAreaResized(const QRect &)));
     426    disconnect(pHostScreen, &QScreen::geometryChanged,
     427               this, &UIDesktopWidgetWatchdog::sltHandleHostScreenResized);
     428    disconnect(pHostScreen, &QScreen::availableGeometryChanged,
     429               this, &UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized);
    430430
    431431# ifdef VBOX_WS_X11
     
    513513    /* Prepare connections: */
    514514#if QT_VERSION < 0x050000
    515     connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(sltHandleHostScreenCountChanged(int)));
    516     connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(sltHandleHostScreenResized(int)));
    517     connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(sltHandleHostScreenWorkAreaResized(int)));
     515    connect(QApplication::desktop(), &QDesktopWidget::screenCountChanged,
     516            this, &UIDesktopWidgetWatchdog::sltHandleHostScreenCountChanged);
     517    connect(QApplication::desktop(), &QDesktopWidget::resized,
     518            this, &UIDesktopWidgetWatchdog::sltHandleHostScreenResized);
     519    connect(QApplication::desktop(), &QDesktopWidget::workAreaResized,
     520            this, &UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized);
    518521#else /* QT_VERSION >= 0x050000 */
    519     connect(qApp, SIGNAL(screenAdded(QScreen *)), this, SLOT(sltHostScreenAdded(QScreen *)));
    520     connect(qApp, SIGNAL(screenRemoved(QScreen *)), this, SLOT(sltHostScreenRemoved(QScreen *)));
     522    connect(qApp, &QGuiApplication::screenAdded,
     523            this, &UIDesktopWidgetWatchdog::sltHostScreenAdded);
     524    connect(qApp, &QGuiApplication::screenRemoved,
     525            this, &UIDesktopWidgetWatchdog::sltHostScreenRemoved);
    521526    foreach (QScreen *pHostScreen, qApp->screens())
    522527    {
    523         connect(pHostScreen, SIGNAL(geometryChanged(const QRect &)),
    524                 this, SLOT(sltHandleHostScreenResized(const QRect &)));
    525         connect(pHostScreen, SIGNAL(availableGeometryChanged(const QRect &)),
    526                 this, SLOT(sltHandleHostScreenWorkAreaResized(const QRect &)));
     528        connect(pHostScreen, &QScreen::geometryChanged,
     529                this, &UIDesktopWidgetWatchdog::sltHandleHostScreenResized);
     530        connect(pHostScreen, &QScreen::availableGeometryChanged,
     531                this, &UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized);
    527532    }
    528533#endif /* QT_VERSION >= 0x050000 */
     
    538543    /* Cleanup connections: */
    539544#if QT_VERSION < 0x050000
    540     disconnect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), this, SLOT(sltHandleHostScreenCountChanged(int)));
    541     disconnect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(sltHandleHostScreenResized(int)));
    542     disconnect(QApplication::desktop(), SIGNAL(workAreaResized(int)), this, SLOT(sltHandleHostScreenWorkAreaResized(int)));
     545    disconnect(QApplication::desktop(), &QDesktopWidget::screenCountChanged,
     546               this, &UIDesktopWidgetWatchdog::sltHandleHostScreenCountChanged);
     547    disconnect(QApplication::desktop(), &QDesktopWidget::resized,
     548               this, &UIDesktopWidgetWatchdog::sltHandleHostScreenResized);
     549    disconnect(QApplication::desktop(), &QDesktopWidget::workAreaResized,
     550               this, &UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized);
    543551#else /* QT_VERSION >= 0x050000 */
    544     disconnect(qApp, SIGNAL(screenAdded(QScreen *)), this, SLOT(sltHostScreenAdded(QScreen *)));
    545     disconnect(qApp, SIGNAL(screenRemoved(QScreen *)), this, SLOT(sltHostScreenRemoved(QScreen *)));
     552    disconnect(qApp, &QGuiApplication::screenAdded,
     553               this, &UIDesktopWidgetWatchdog::sltHostScreenAdded);
     554    disconnect(qApp, &QGuiApplication::screenRemoved,
     555               this, &UIDesktopWidgetWatchdog::sltHostScreenRemoved);
    546556    foreach (QScreen *pHostScreen, qApp->screens())
    547557    {
    548         disconnect(pHostScreen, SIGNAL(geometryChanged(const QRect &)),
    549                    this, SLOT(sltHandleHostScreenResized(const QRect &)));
    550         disconnect(pHostScreen, SIGNAL(availableGeometryChanged(const QRect &)),
    551                    this, SLOT(sltHandleHostScreenWorkAreaResized(const QRect &)));
     558        disconnect(pHostScreen, &QScreen::geometryChanged,
     559                   this, &UIDesktopWidgetWatchdog::sltHandleHostScreenResized);
     560        disconnect(pHostScreen, &QScreen::availableGeometryChanged,
     561                   this, &UIDesktopWidgetWatchdog::sltHandleHostScreenWorkAreaResized);
    552562    }
    553563#endif /* QT_VERSION >= 0x050000 */
     
    598608
    599609        /* Connect worker listener: */
    600         connect(pWorker, SIGNAL(sigHostScreenAvailableGeometryCalculated(int, QRect)),
    601                 this, SLOT(sltHandleHostScreenAvailableGeometryCalculated(int, QRect)));
     610        connect(pWorker, &UIInvisibleWindow::sigHostScreenAvailableGeometryCalculated,
     611                this, &UIDesktopWidgetWatchdog::sltHandleHostScreenAvailableGeometryCalculated);
    602612
    603613        /* Place worker to corresponding host-screen: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r67969 r68190  
    28042804        UIDownloaderUserManual *pDl = UIDownloaderUserManual::create();
    28052805        /* After downloading finished => show User Manual: */
    2806         connect(pDl, SIGNAL(sigDownloadFinished(const QString&)), this, SLOT(sltShowUserManual(const QString&)));
     2806        connect(pDl, &UIDownloaderUserManual::sigDownloadFinished, this, &UIMessageCenter::sltShowUserManual);
    28072807        /* Start downloading: */
    28082808        pDl->start();
     
    28752875    /* Prepare interthread connection: */
    28762876    qRegisterMetaType<MessageType>();
     2877    // Won't go until we are supporting C++11 or at least variadic templates everywhere.
     2878    // connect(this, &UIMessageCenter::sigToShowMessageBox,
     2879    //         this, &UIMessageCenter::sltShowMessageBox,
    28772880    connect(this, SIGNAL(sigToShowMessageBox(QWidget*, MessageType,
    28782881                                             const QString&, const QString&,
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIModalWindowManager.cpp

    r62493 r68190  
    211211                    /* Register passed-window as the new 'top' in iterated-window-stack: */
    212212                    iteratedWindowStack << pWindow;
    213                     connect(pWindow, SIGNAL(destroyed(QObject*)), this, SLOT(sltRemoveFromStack(QObject*)));
     213                    connect(pWindow, &QWidget::destroyed, this, &UIModalWindowManager::sltRemoveFromStack);
    214214                    return;
    215215                }
     
    226226        QList<QWidget*> newWindowStack(QList<QWidget*>() << pWindow);
    227227        m_windows << newWindowStack;
    228         connect(pWindow, SIGNAL(destroyed(QObject*)), this, SLOT(sltRemoveFromStack(QObject*)));
     228        connect(pWindow, &QWidget::destroyed, this, &UIModalWindowManager::sltRemoveFromStack);
    229229    }
    230230}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIPopupCenter.cpp

    r66569 r68190  
    282282        pPopupStack = m_stacks[strPopupStackID] = new UIPopupStack(strPopupStackID, m_stackOrientations[strPopupStackID]);
    283283        /* Attach popup-stack connections: */
    284         connect(pPopupStack, SIGNAL(sigPopupPaneDone(QString, int)), this, SLOT(sltPopupPaneDone(QString, int)));
    285         connect(pPopupStack, SIGNAL(sigRemove(QString)), this, SLOT(sltRemovePopupStack(QString)));
     284        connect(pPopupStack, &UIPopupStack::sigPopupPaneDone, this, &UIPopupCenter::sltPopupPaneDone);
     285        connect(pPopupStack, &UIPopupStack::sigRemove,        this, &UIPopupCenter::sltRemovePopupStack);
    286286    }
    287287
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIShortcutPool.cpp

    r62493 r68190  
    241241{
    242242    /* Connect to extra-data signals: */
    243     connect(gEDataManager, SIGNAL(sigSelectorUIShortcutChange()), this, SLOT(sltReloadSelectorShortcuts()));
    244     connect(gEDataManager, SIGNAL(sigRuntimeUIShortcutChange()), this, SLOT(sltReloadMachineShortcuts()));
     243    connect(gEDataManager, &UIExtraDataManager::sigSelectorUIShortcutChange,
     244            this, &UIShortcutPool::sltReloadSelectorShortcuts);
     245    connect(gEDataManager, &UIExtraDataManager::sigRuntimeUIShortcutChange,
     246            this, &UIShortcutPool::sltReloadMachineShortcuts);
    245247}
    246248
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIThreadPool.cpp

    r62493 r68190  
    166166
    167167    /* Prepare task: */
    168     connect(pTask, SIGNAL(sigComplete(UITask*)),
    169             this, SLOT(sltHandleTaskComplete(UITask*)), Qt::QueuedConnection);
     168    connect(pTask, &UITask::sigComplete,
     169            this, &UIThreadPool::sltHandleTaskComplete, Qt::QueuedConnection);
    170170
    171171    /* Lock initially: */
     
    190190                /* Prepare the new worker: */
    191191                UIThreadWorker *pWorker = new UIThreadWorker(this, idxFirstUnused);
    192                 connect(pWorker, SIGNAL(sigFinished(UIThreadWorker*)),
    193                         this, SLOT(sltHandleWorkerFinished(UIThreadWorker*)), Qt::QueuedConnection);
     192                connect(pWorker, &UIThreadWorker::sigFinished,
     193                        this, &UIThreadPool::sltHandleWorkerFinished, Qt::QueuedConnection);
    194194                m_workers[idxFirstUnused] = pWorker;
    195195                ++m_cWorkers;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r67854 r68190  
    35273527{
    35283528    /* Make sure QApplication cleanup us on exit: */
    3529     connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(cleanup()));
     3529    connect(qApp, &QGuiApplication::aboutToQuit, this, &VBoxGlobal::cleanup);
    35303530    /* Make sure we handle host OS session shutdown as well: */
    3531     connect(qApp, SIGNAL(commitDataRequest(QSessionManager &)),
    3532             this, SLOT(sltHandleCommitDataRequest(QSessionManager &)));
     3531    connect(qApp, &QGuiApplication::commitDataRequest,
     3532            this, &VBoxGlobal::sltHandleCommitDataRequest);
    35333533
    35343534#ifdef VBOX_WS_MAC
     
    36083608
    36093609    /* Watch for the VBoxSVC availability changes: */
    3610     connect(gVBoxEvents, SIGNAL(sigVBoxSVCAvailabilityChange(bool)),
    3611             this, SLOT(sltHandleVBoxSVCAvailabilityChange(bool)));
     3610    connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigVBoxSVCAvailabilityChange,
     3611            this, &VBoxGlobal::sltHandleVBoxSVCAvailabilityChange);
    36123612
    36133613    /* Prepare thread-pool instance: */
     
    36213621    retranslateUi();
    36223622
    3623     connect(gEDataManager, SIGNAL(sigLanguageChange(QString)),
    3624             this, SLOT(sltGUILanguageChange(QString)));
     3623    connect(gEDataManager, &UIExtraDataManager::sigLanguageChange,
     3624            this, &VBoxGlobal::sltGUILanguageChange);
    36253625
    36263626    qApp->installEventFilter (this);
     
    39303930    {
    39313931        /* Prepare medium-enumerator: */
    3932         connect(m_pMediumEnumerator, SIGNAL(sigMediumCreated(const QString&)),
    3933                 this, SIGNAL(sigMediumCreated(const QString&)));
    3934         connect(m_pMediumEnumerator, SIGNAL(sigMediumDeleted(const QString&)),
    3935                 this, SIGNAL(sigMediumDeleted(const QString&)));
    3936         connect(m_pMediumEnumerator, SIGNAL(sigMediumEnumerationStarted()),
    3937                 this, SIGNAL(sigMediumEnumerationStarted()));
    3938         connect(m_pMediumEnumerator, SIGNAL(sigMediumEnumerated(const QString&)),
    3939                 this, SIGNAL(sigMediumEnumerated(const QString&)));
    3940         connect(m_pMediumEnumerator, SIGNAL(sigMediumEnumerationFinished()),
    3941                 this, SIGNAL(sigMediumEnumerationFinished()));
     3932        connect(m_pMediumEnumerator, &UIMediumEnumerator::sigMediumCreated,
     3933                this, &VBoxGlobal::sigMediumCreated);
     3934        connect(m_pMediumEnumerator, &UIMediumEnumerator::sigMediumDeleted,
     3935                this, &VBoxGlobal::sigMediumDeleted);
     3936        connect(m_pMediumEnumerator, &UIMediumEnumerator::sigMediumEnumerationStarted,
     3937                this, &VBoxGlobal::sigMediumEnumerationStarted);
     3938        connect(m_pMediumEnumerator, &UIMediumEnumerator::sigMediumEnumerated,
     3939                this, &VBoxGlobal::sigMediumEnumerated);
     3940        connect(m_pMediumEnumerator, &UIMediumEnumerator::sigMediumEnumerationFinished,
     3941                this, &VBoxGlobal::sigMediumEnumerationFinished);
    39423942    }
    39433943
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxUtils.h

    r67535 r68190  
    3838        : QObject(pParent), m_strName(strName) {}
    3939
    40 private slots:
     40public slots:
    4141
    4242    /** Assigns property value. */
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