VirtualBox

Changeset 10439 in vbox


Ignore:
Timestamp:
Jul 9, 2008 4:56:58 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
33103
Message:

Fe/Qt4: VirtualBox New Version Notifier dialog implemented.

Location:
trunk/src/VBox/Frontends/VirtualBox4
Files:
13 edited

Legend:

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

    r10429 r10439  
    539539        include/VBoxVMFirstRunWzd.h \
    540540        include/VBoxRegistrationDlg.h \
     541        include/VBoxUpdateDlg.h \
    541542        include/VBoxSnapshotDetailsDlg.h \
    542543        include/VBoxVMInformationDlg.h \
     
    608609        src/VBoxVMFirstRunWzd.cpp \
    609610        src/VBoxRegistrationDlg.cpp \
     611        src/VBoxUpdateDlg.cpp \
    610612        src/VBoxSnapshotDetailsDlg.cpp \
    611613        src/VBoxVMInformationDlg.cpp \
  • trunk/src/VBox/Frontends/VirtualBox4/VBoxUI.pro

    r10168 r10439  
    3232    ui/VBoxNewVMWzd.ui \
    3333    ui/VBoxRegistrationDlg.ui \
     34    ui/VBoxUpdateDlg.ui \
    3435    ui/VBoxSnapshotDetailsDlg.ui \
    3536    ui/VBoxSnapshotsWgt.ui \
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxConsoleWnd.h

    r10112 r10439  
    240240    QAction *helpWebAction;
    241241    QAction *helpRegisterAction;
     242    QAction *helpUpdateAction;
    242243    QAction *helpAboutAction;
    243244    QAction *helpResetMessagesAction;
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxDefs.h

    r9214 r10439  
    136136        SnapshotEventType,
    137137        CanShowRegDlgEventType,
     138        CanShowUpdDlgEventType,
    138139        NetworkAdapterChangeEventType,
    139140        USBCtlStateChangeEventType,
     
    169170    static const char* GUI_RegistrationDlgWinID;
    170171    static const char* GUI_RegistrationData;
     172    static const char* GUI_UpdateDlgWinID;
     173    static const char* GUI_UpdateDate;
    171174    static const char* GUI_LastVMSelected;
    172175    static const char* GUI_InfoDlgState;
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h

    r10437 r10439  
    140140};
    141141
     142class VBoxCanShowUpdDlgEvent : public QEvent
     143{
     144public:
     145    VBoxCanShowUpdDlgEvent (bool aCanShow)
     146        : QEvent ((QEvent::Type) VBoxDefs::CanShowUpdDlgEventType)
     147        , mCanShow (aCanShow)
     148        {}
     149
     150    const bool mCanShow;
     151};
     152
    142153class VBoxChangeGUILanguageEvent : public QEvent
    143154{
     
    157168class VBoxConsoleWnd;
    158169class VBoxRegistrationDlg;
     170class VBoxUpdateDlg;
    159171
    160172class VBoxGlobal : public QObject
     
    618630
    619631    void canShowRegDlg (bool aCanShow);
     632    void canShowUpdDlg (bool aCanShow);
    620633
    621634public slots:
     
    624637
    625638    void showRegistrationDialog (bool aForce = true);
     639    void showUpdateDialog (bool aForce = true);
    626640
    627641protected:
     
    650664    VBoxRegistrationDlg *mRegDlg;
    651665#endif
     666    VBoxUpdateDlg *mUpdDlg;
    652667
    653668    QUuid vmUuid;
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxProblemReporter.h

    r9627 r10439  
    267267                             const QString &aResult);
    268268
     269    void showUpdateResult (QWidget *aParent,
     270                           const QString &aVersion,
     271                           const QString &aLink);
     272
    269273    bool confirmInputCapture (bool *aAutoConfirmed = NULL);
    270274    void remindAboutAutoCapture();
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxSelectorWnd.h

    r10149 r10439  
    128128    QAction *helpWebAction;
    129129    QAction *helpRegisterAction;
     130    QAction *helpUpdateAction;
    130131    QAction *helpAboutAction;
    131132    QAction *helpResetMessagesAction;
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleWnd.cpp

    r10437 r10439  
    282282    helpRegisterAction = new QAction (this);
    283283    helpRegisterAction->setIcon (VBoxGlobal::iconSet (":/register_16px.png",
    284                                                          ":/register_disabled_16px.png"));
     284                                                      ":/register_disabled_16px.png"));
     285    helpUpdateAction = new QAction (this);
     286    helpUpdateAction->setIcon (VBoxGlobal::iconSet (":/refresh_16px.png",
     287                                                    ":/refresh_disabled_16px.png"));
    285288    helpAboutAction = new QAction (this);
    286289    helpAboutAction->setIcon (VBoxGlobal::iconSet (":/about_16px.png"));
     
    390393        GetExtraData (VBoxDefs::GUI_RegistrationDlgWinID).isEmpty());
    391394#endif
     395    mHelpMenu->addAction (helpUpdateAction);
     396    helpUpdateAction->setEnabled (vboxGlobal().virtualBox().
     397        GetExtraData (VBoxDefs::GUI_UpdateDlgWinID).isEmpty());
    392398    mHelpMenu->addAction (helpAboutAction);
    393399    mHelpMenu->addSeparator();
     
    556562    connect (helpRegisterAction, SIGNAL (triggered()),
    557563             &vboxGlobal(), SLOT (showRegistrationDialog()));
     564    connect (helpUpdateAction, SIGNAL (activated()),
     565             &vboxGlobal(), SLOT (showUpdateDialog()));
    558566    connect (&vboxGlobal(), SIGNAL (canShowRegDlg (bool)),
    559567             helpRegisterAction, SLOT (setEnabled (bool)));
     568    connect (&vboxGlobal(), SIGNAL (canShowUpdDlg (bool)),
     569             helpUpdateAction, SLOT (setEnabled (bool)));
    560570    connect (helpAboutAction, SIGNAL (triggered()),
    561571             &vboxProblem(), SLOT (showHelpAboutDialog()));
     
    972982    vboxGlobal().showRegistrationDialog (false /* aForce */);
    973983#endif
     984    vboxGlobal().showUpdateDialog (false /* aForce */);
    974985}
    975986
     
    15781589        tr ("Open VirtualBox registration form"));
    15791590
     1591    helpUpdateAction->setText (tr ("&Update VirtualBox..."));
     1592    helpUpdateAction->setStatusTip (
     1593        tr ("Open VirtualBox New Version Notifier"));
     1594
    15801595    helpAboutAction->setText (tr ("&About VirtualBox..."));
    15811596    helpAboutAction->setStatusTip (tr ("Show a dialog with product information"));
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxDefs.cpp

    r8219 r10439  
    3838const char* VBoxDefs::GUI_RegistrationDlgWinID = "GUI/RegistrationDlgWinID";
    3939const char* VBoxDefs::GUI_RegistrationData = "GUI/RegistrationData";
     40const char* VBoxDefs::GUI_UpdateDlgWinID = "GUI/UpdateDlgWinID";
     41const char* VBoxDefs::GUI_UpdateDate = "GUI/UpdateDate";
    4042const char* VBoxDefs::GUI_LastVMSelected = "GUI/LastVMSelected";
    4143const char* VBoxDefs::GUI_InfoDlgState = "GUI/InfoDlgState";
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp

    r10437 r10439  
    3434#include "VBoxRegistrationDlg.h"
    3535#endif
     36#include "VBoxUpdateDlg.h"
    3637
    3738/* Qt includes */
     
    153154
    154155    VBoxCallback (VBoxGlobal &aGlobal)
    155         : mGlobal (aGlobal), mIsRegDlgOwner (false)
     156        : mGlobal (aGlobal)
     157        , mIsRegDlgOwner (false), mIsUpdDlgOwner (false)
    156158    {
    157159#if defined (Q_OS_WIN32)
     
    247249                }
    248250
     251                if (sKey == VBoxDefs::GUI_UpdateDlgWinID)
     252                {
     253                    if (mIsUpdDlgOwner)
     254                    {
     255                        if (sVal.isEmpty() ||
     256                            sVal == QString ("%1")
     257                                .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))
     258                            *allowChange = TRUE;
     259                        else
     260                            *allowChange = FALSE;
     261                    }
     262                    else
     263                        *allowChange = TRUE;
     264                    return S_OK;
     265                }
     266
    249267                /* try to set the global setting to check its syntax */
    250268                VBoxGlobalSettings gs (false /* non-null */);
     
    288306                    }
    289307                    else if (sVal == QString ("%1")
    290                                 .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))
     308                             .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))
    291309                    {
    292310                        mIsRegDlgOwner = true;
     
    296314                        QApplication::postEvent (&mGlobal, new VBoxCanShowRegDlgEvent (false));
    297315                }
     316                if (sKey == VBoxDefs::GUI_UpdateDlgWinID)
     317                {
     318                    if (sVal.isEmpty())
     319                    {
     320                        mIsUpdDlgOwner = false;
     321                        QApplication::postEvent (&mGlobal, new VBoxCanShowUpdDlgEvent (true));
     322                    }
     323                    else if (sVal == QString ("%1")
     324                             .arg ((qulonglong) vboxGlobal().mainWindow()->winId()))
     325                    {
     326                        mIsUpdDlgOwner = true;
     327                        QApplication::postEvent (&mGlobal, new VBoxCanShowUpdDlgEvent (true));
     328                    }
     329                    else
     330                        QApplication::postEvent (&mGlobal, new VBoxCanShowUpdDlgEvent (false));
     331                }
    298332                if (sKey == "GUI/LanguageID")
    299333                    QApplication::postEvent (&mGlobal, new VBoxChangeGUILanguageEvent (sVal));
     
    374408
    375409    bool mIsRegDlgOwner;
     410    bool mIsUpdDlgOwner;
    376411
    377412#if defined (Q_OS_WIN32)
     
    39003935}
    39013936
     3937void VBoxGlobal::showUpdateDialog (bool aForce)
     3938{
     3939    bool isNecessary = VBoxUpdateDlg::isNecessary();
     3940    bool isAutomatic = VBoxUpdateDlg::isAutomatic();
     3941
     3942    if (!aForce && !isNecessary)
     3943        return;
     3944
     3945    if (mUpdDlg)
     3946    {
     3947        if (!mUpdDlg->isHidden())
     3948        {
     3949            mUpdDlg->setWindowState (mUpdDlg->windowState() & ~Qt::WindowMinimized);
     3950            mUpdDlg->raise();
     3951            mUpdDlg->activateWindow();
     3952        }
     3953    }
     3954    else
     3955    {
     3956        /* Store the ID of the main window to ensure that only one
     3957         * update dialog is shown at a time. Due to manipulations with
     3958         * OnExtraDataCanChange() and OnExtraDataChange() signals, this extra
     3959         * data item acts like an inter-process mutex, so the first process
     3960         * that attempts to set it will win, the rest will get a failure from
     3961         * the SetExtraData() call. */
     3962        mVBox.SetExtraData (VBoxDefs::GUI_UpdateDlgWinID,
     3963                            QString ("%1").arg ((qulonglong) mMainWindow->winId()));
     3964
     3965        if (mVBox.isOk())
     3966        {
     3967            /* We've got the "mutex", create a new update dialog */
     3968            VBoxUpdateDlg *dlg = new VBoxUpdateDlg (&mUpdDlg, 0);
     3969            dlg->setAttribute (Qt::WA_DeleteOnClose);
     3970            Assert (dlg == mUpdDlg);
     3971
     3972            if (!aForce && isAutomatic)
     3973                mUpdDlg->search();
     3974            else
     3975                mUpdDlg->show();
     3976        }
     3977    }
     3978}
     3979
    39023980// Protected members
    39033981////////////////////////////////////////////////////////////////////////////////
     
    39814059        {
    39824060            emit canShowRegDlg (((VBoxCanShowRegDlgEvent *) e)->mCanShow);
     4061            return true;
     4062        }
     4063        case VBoxDefs::CanShowUpdDlgEventType:
     4064        {
     4065            emit canShowUpdDlg (((VBoxCanShowUpdDlgEvent *) e)->mCanShow);
    39834066            return true;
    39844067        }
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxProblemReporter.cpp

    r10149 r10439  
    15441544}
    15451545
     1546void VBoxProblemReporter::showUpdateResult (QWidget *aParent,
     1547                                            const QString &aVersion,
     1548                                            const QString &aLink)
     1549{
     1550    message (aParent, Info,
     1551             tr ("<p>VirtualBox New Version Notifier "
     1552                 "has found VirtualBox %1 version.</p>"
     1553                 "<p>If you would like to download and install it "
     1554                 "please proceed to the following link:</p>"
     1555                 "<p><a href=%2>%3</a></p>")
     1556                 .arg (aVersion, aLink, aLink));
     1557}
     1558
    15461559/**
    15471560 *  @return @c true if the user has confirmed input capture (this is always
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSelectorWnd.cpp

    r10416 r10439  
    449449    helpRegisterAction = new QAction (this);
    450450    helpRegisterAction->setIcon (VBoxGlobal::iconSet (":/register_16px.png",
    451                                                          ":/register_disabled_16px.png"));
     451                                                      ":/register_disabled_16px.png"));
     452    helpUpdateAction = new QAction (this);
     453    helpUpdateAction->setIcon (VBoxGlobal::iconSet (":/refresh_16px.png",
     454                                                    ":/refresh_disabled_16px.png"));
    452455    helpAboutAction = new QAction (this);
    453456    helpAboutAction->setIcon (VBoxGlobal::iconSet (":/about_16px.png"));
     
    583586        GetExtraData (VBoxDefs::GUI_RegistrationDlgWinID).isEmpty());
    584587#endif
     588    mHelpMenu->addAction (helpUpdateAction);
     589    helpUpdateAction->setEnabled (vboxGlobal().virtualBox().
     590        GetExtraData (VBoxDefs::GUI_UpdateDlgWinID).isEmpty());
    585591    mHelpMenu->addAction (helpAboutAction);
    586592    mHelpMenu->addSeparator();
     
    659665    connect (helpRegisterAction, SIGNAL (triggered()),
    660666             &vboxGlobal(), SLOT (showRegistrationDialog()));
     667    connect (helpUpdateAction, SIGNAL (activated()),
     668             &vboxGlobal(), SLOT (showUpdateDialog()));
    661669    connect (&vboxGlobal(), SIGNAL (canShowRegDlg (bool)),
    662670             helpRegisterAction, SLOT (setEnabled (bool)));
     671    connect (&vboxGlobal(), SIGNAL (canShowUpdDlg (bool)),
     672             helpUpdateAction, SLOT (setEnabled (bool)));
    663673    connect (helpAboutAction, SIGNAL (triggered()),
    664674             &vboxProblem(), SLOT (showHelpAboutDialog()));
     
    754764     * different to Qt3 where a *mainWidget* exists & if this going to close
    755765     * all other windows are closed automatically. We do the same below. */
    756     foreach (QWidget *widget, QApplication::topLevelWidgets()) 
    757     {
    758         if (widget->isVisible() && 
     766    foreach (QWidget *widget, QApplication::topLevelWidgets())
     767    {
     768        if (widget->isVisible() &&
    759769            widget != this)
    760770            widget->close();
     
    12091219        tr ("Open VirtualBox registration form"));
    12101220
     1221    helpUpdateAction->setText (tr ("&Update VirtualBox..."));
     1222    helpUpdateAction->setStatusTip (
     1223        tr ("Open VirtualBox New Version Notifier"));
     1224
    12111225    helpAboutAction->setText (tr ("&About VirtualBox..."));
    12121226    helpAboutAction->setStatusTip (tr ("Show a dialog with product information"));
  • trunk/src/VBox/Frontends/VirtualBox4/src/main.cpp

    r10112 r10439  
    274274                vboxGlobal().showRegistrationDialog (false /* aForce */);
    275275#endif
     276                vboxGlobal().showUpdateDialog (false /* aForce */);
    276277                vboxGlobal().startEnumeratingMedia();
    277278                rc = a.exec();
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