VirtualBox

Changeset 13601 in vbox for trunk/src


Ignore:
Timestamp:
Oct 27, 2008 8:22:25 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
38509
Message:

FE/Qt: More user-friendly settings auto-conversion message box.

Location:
trunk/src/VBox/Frontends
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h

    r13580 r13601  
    675675#endif
    676676
    677     void checkForAutoConvertedSettings();
     677    bool checkForAutoConvertedSettings();
    678678
    679679    CSession openSession (const QUuid &aId, bool aExisting = false);
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp

    r13580 r13601  
    24342434/**
    24352435 * Checks if any of the settings files were auto-converted and informs the user
    2436  * if so.
    2437  */
    2438 void VBoxGlobal::checkForAutoConvertedSettings()
     2436 * if so. Returns @c false if the user select to exit the application.
     2437 */
     2438bool VBoxGlobal::checkForAutoConvertedSettings()
    24392439{
    24402440    QString formatVersion = mVBox.GetSettingsFormatVersion();
     
    24562456        {
    24572457            machines.append (*m);
    2458             fileList += QString ("<nobr>%1&nbsp;&nbsp;&nbsp;(<i>%2</i>)</nobr><br>")
     2458            fileList += QString ("<tr><td><nobr>%1</nobr></td>"
     2459                                 "</td><td><nobr><i>%2</i></nobr></td></tr>")
    24592460                .arg (m->GetSettingsFilePath())
    24602461                .arg (version);
     
    24662467    {
    24672468        isGlobalConverted = true;
    2468         fileList += QString ("<nobr>%1&nbsp;&nbsp;&nbsp;(<i>%2</i>)</nobr><br>")
     2469        fileList += QString ("<tr><td><nobr>%1</nobr></td>"
     2470                             "</td><td><nobr><i>%2</i></nobr></td></tr>")
    24692471            .arg (mVBox.GetSettingsFilePath())
    24702472            .arg (version);
    24712473    }
    24722474
    2473 
    24742475    if (!fileList.isNull())
    24752476    {
     2477        fileList = QString ("<table cellspacing=0 cellpadding=0>%1</table>")
     2478                            .arg (fileList);
     2479
    24762480        int rc = vboxProblem()
    24772481            .warnAboutAutoConvertedSettings (formatVersion, fileList);
    24782482
    2479         if (rc == QIMessageBox::No || rc == QIMessageBox::Yes)
    2480         {
    2481             /* backup (optionally) and save all settings files
    2482              * (QIMessageBox::No = Backup, QIMessageBox::Yes = Save) */
    2483 
    2484             for (QValueList <CMachine>::Iterator m = machines.begin();
    2485                  m != machines.end(); ++ m)
     2483        if (rc == QIMessageBox::Cancel)
     2484            return false;
     2485
     2486        Assert (rc == QIMessageBox::No || rc == QIMessageBox::Yes);
     2487
     2488        /* backup (optionally) and save all settings files
     2489         * (QIMessageBox::No = Backup, QIMessageBox::Yes = Save) */
     2490
     2491        for (QValueList <CMachine>::Iterator m = machines.begin();
     2492             m != machines.end(); ++ m)
     2493        {
     2494            CSession session = openSession ((*m).GetId());
     2495            if (!session.isNull())
    24862496            {
    2487                 CSession session = openSession ((*m).GetId());
    2488                 if (!session.isNull())
    2489                 {
    2490                     CMachine sm = session.GetMachine();
    2491                     if (rc == QIMessageBox::No)
    2492                         sm.SaveSettingsWithBackup();
    2493                     else
    2494                         sm.SaveSettings();
    2495 
    2496                     if (!sm.isOk())
    2497                         vboxProblem().cannotSaveMachineSettings (sm);
    2498                     session.Close();
    2499                 }
     2497                CMachine sm = session.GetMachine();
     2498                if (rc == QIMessageBox::No)
     2499                    sm.SaveSettingsWithBackup();
     2500                else
     2501                    sm.SaveSettings();
     2502
     2503                if (!sm.isOk())
     2504                    vboxProblem().cannotSaveMachineSettings (sm);
     2505                session.Close();
    25002506            }
    2501 
    2502             if (isGlobalConverted)
    2503             {
    2504                 if (rc == QIMessageBox::No)
    2505                     mVBox.SaveSettingsWithBackup();
    2506                 else
    2507                     mVBox.SaveSettings();
    2508 
    2509                 if (!mVBox.isOk())
    2510                     vboxProblem().cannotSaveGlobalSettings (mVBox);
    2511             }
    2512         }
    2513     }
     2507        }
     2508
     2509        if (isGlobalConverted)
     2510        {
     2511            if (rc == QIMessageBox::No)
     2512                mVBox.SaveSettingsWithBackup();
     2513            else
     2514                mVBox.SaveSettings();
     2515
     2516            if (!mVBox.isOk())
     2517                vboxProblem().cannotSaveGlobalSettings (mVBox);
     2518        }
     2519    }
     2520
     2521    return true;
    25142522}
    25152523
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp

    r13580 r13601  
    17241724/**
    17251725 * Shows a list of auto-converted files and asks the user to either Save, Backup
    1726  * or Cancel to leave them as is.
     1726 * or Cancel to leave them as is and exit VirtualBox.
    17271727 *
    17281728 * @param aFormatVersion    Recent settings file format version.
     
    17301730 *
    17311731 * @return QIMessageBox::Yes (Save), QIMessageBox::No (Backup),
    1732  *         QIMessageBox::Cancel (Leave)
     1732 *         QIMessageBox::Cancel (Exit)
    17331733 */
    17341734int VBoxProblemReporter::warnAboutAutoConvertedSettings (const QString &aFormatVersion,
    17351735                                                         const QString &aFileList)
    17361736{
    1737     return message (mainWindowShown(), Warning,
     1737    int rc = message (mainWindowShown(), Info,
     1738        tr ("<p>Your existing VirtualBox settings files were automatically "
     1739            "converted from the old format to a new format necessary for the "
     1740            "new version of VirtualBox.</p>"
     1741            "<p>Press <b>OK</b> to start VirtualBox now or press <b>More</b> if "
     1742            "you want to get more information about what files were converted "
     1743            "and access additional actions.</p>"
     1744            "<p>Press <b>Exit</b> to terminate the VirtualBox "
     1745            "application without saving the results of the conversion to "
     1746            "disk.</p>"),
     1747        NULL /* aAutoConfirmId */,
     1748        QIMessageBox::Ok | QIMessageBox::Default,
     1749        QIMessageBox::No,
     1750        QIMessageBox::Cancel | QIMessageBox::Escape,
     1751        0,
     1752        tr ("&More", "warnAboutAutoConvertedSettings message box"),
     1753        tr ("E&xit", "warnAboutAutoConvertedSettings message box"));
     1754
     1755    /* in the simplest case we backup */
     1756    if (rc == QIMessageBox::Ok)
     1757        return QIMessageBox::No;
     1758
     1759    if (rc == QIMessageBox::Cancel)
     1760        return QIMessageBox::Cancel;
     1761
     1762    return message (mainWindowShown(), Info,
    17381763        tr ("<p>The following VirtualBox settings files have been "
    17391764            "automatically converted to the new settings file format "
     
    17421767            "to disk yet. Please press:</p>"
    17431768            "<ul>"
    1744             "<li><b>Save</b> to save all auto-converted files now (it will not "
    1745             "be possible to use these settings files with an older version of "
    1746             "VirtualBox in the future);</li>"
    17471769            "<li><b>Backup</b> to create backup copies of the settings files in "
    17481770            "the old format before saving them in the new format;</li>"
    1749             "<li><b>Cancel</b> to not save the auto-converted settings files "
    1750             "now.<li>"
     1771            "<li><b>Overwrite</b> to save all auto-converted files without "
     1772            "creating backup copies (it will not be possible to use these "
     1773            "settings files with an older version of VirtualBox "
     1774            "afterwards);</li>"
     1775            "<li><b>Exit</b> to terminate VirtualBox without saving the "
     1776            "results of the conversion to disk.</li>"
    17511777            "</ul>"
    1752             "<p>Note that if you select <b>Cancel</b>, the auto-converted "
    1753             "settings files will be implicitly saved in the new format anyway "
    1754             "once you change a setting or start a virtual machine, but "
    1755             "<b>no</b> backup copies will be created in this case.</p>")
     1778            "<p>It is recommended to always select <b>Backup</b> because in "
     1779            "this case it will be possible to go back to the previous "
     1780            "version of VirtualBox (if necessary) without losing your current "
     1781            "settings. See the VirtualBox Manual for more information about "
     1782            "downgrading.</p>")
    17561783            .arg (aFormatVersion),
    17571784        aFileList,
     
    17601787        QIMessageBox::No | QIMessageBox::Default,
    17611788        QIMessageBox::Cancel | QIMessageBox::Escape,
    1762         tr ("&Save", "warnAboutAutoConvertedSettings message box"),
     1789        tr ("O&verwrite", "warnAboutAutoConvertedSettings message box"),
    17631790        tr ("&Backup", "warnAboutAutoConvertedSettings message box"),
    1764         tr ("Cancel", "warnAboutAutoConvertedSettings message box"));
     1791        tr ("E&xit", "warnAboutAutoConvertedSettings message box"));
    17651792}
    17661793
  • trunk/src/VBox/Frontends/VirtualBox/src/main.cpp

    r13580 r13601  
    226226#endif
    227227
    228             vboxGlobal().checkForAutoConvertedSettings();
     228            if (!vboxGlobal().checkForAutoConvertedSettings())
     229                break;
    229230
    230231            VBoxGlobalSettings settings = vboxGlobal().settings();
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h

    r13580 r13601  
    741741#endif
    742742
    743     void checkForAutoConvertedSettings();
     743    bool checkForAutoConvertedSettings();
    744744
    745745    CSession openSession (const QUuid &aId, bool aExisting = false);
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp

    r13580 r13601  
    25532553/**
    25542554 * Checks if any of the settings files were auto-converted and informs the user
    2555  * if so.
    2556  */
    2557 void VBoxGlobal::checkForAutoConvertedSettings()
     2555 * if so. Returns @c false if the user select to exit the application.
     2556 */
     2557bool VBoxGlobal::checkForAutoConvertedSettings()
    25582558{
    25592559    QString formatVersion = mVBox.GetSettingsFormatVersion();
     
    25752575        {
    25762576            machines.append (*m);
    2577             fileList += QString ("<nobr>%1&nbsp;&nbsp;&nbsp;(<i>%2</i>)</nobr><br>")
     2577            fileList += QString ("<tr><td><nobr>%1</nobr></td><td>&nbsp;&nbsp;</td>"
     2578                                 "</td><td><nobr><i>%2</i></nobr></td></tr>")
    25782579                .arg (m->GetSettingsFilePath())
    25792580                .arg (version);
     
    25852586    {
    25862587        isGlobalConverted = true;
    2587         fileList += QString ("<nobr>%1&nbsp;&nbsp;&nbsp;(<i>%2</i>)</nobr><br>")
     2588        fileList += QString ("<tr><td><nobr>%1</nobr></td><td>&nbsp;&nbsp;</td>"
     2589                             "</td><td><nobr><i>%2</i></nobr></td></tr>")
    25882590            .arg (mVBox.GetSettingsFilePath())
    25892591            .arg (version);
    25902592    }
    25912593
    2592 
    25932594    if (!fileList.isNull())
    25942595    {
     2596        fileList = QString ("<table cellspacing=0 cellpadding=0>%1</table>")
     2597                            .arg (fileList);
     2598
    25952599        int rc = vboxProblem()
    25962600            .warnAboutAutoConvertedSettings (formatVersion, fileList);
    25972601
    2598         if (rc == QIMessageBox::No || rc == QIMessageBox::Yes)
    2599         {
    2600             /* backup (optionally) and save all settings files
    2601              * (QIMessageBox::No = Backup, QIMessageBox::Yes = Save) */
    2602 
    2603             foreach (CMachine m, machines)
     2602        if (rc == QIMessageBox::Cancel)
     2603            return false;
     2604
     2605        Assert (rc == QIMessageBox::No || rc == QIMessageBox::Yes);
     2606
     2607        /* backup (optionally) and save all settings files
     2608         * (QIMessageBox::No = Backup, QIMessageBox::Yes = Save) */
     2609
     2610        foreach (CMachine m, machines)
     2611        {
     2612            CSession session = openSession (m.GetId());
     2613            if (!session.isNull())
    26042614            {
    2605                 CSession session = openSession (m.GetId());
    2606                 if (!session.isNull())
    2607                 {
    2608                     CMachine sm = session.GetMachine();
    2609                     if (rc == QIMessageBox::No)
    2610                         sm.SaveSettingsWithBackup();
    2611                     else
    2612                         sm.SaveSettings();
    2613 
    2614                     if (!sm.isOk())
    2615                         vboxProblem().cannotSaveMachineSettings (sm);
    2616                     session.Close();
    2617                 }
     2615                CMachine sm = session.GetMachine();
     2616                if (rc == QIMessageBox::No)
     2617                    sm.SaveSettingsWithBackup();
     2618                else
     2619                    sm.SaveSettings();
     2620
     2621                if (!sm.isOk())
     2622                    vboxProblem().cannotSaveMachineSettings (sm);
     2623                session.Close();
    26182624            }
    2619 
    2620             if (isGlobalConverted)
    2621             {
    2622                 if (rc == QIMessageBox::No)
    2623                     mVBox.SaveSettingsWithBackup();
    2624                 else
    2625                     mVBox.SaveSettings();
    2626 
    2627                 if (!mVBox.isOk())
    2628                     vboxProblem().cannotSaveGlobalSettings (mVBox);
    2629             }
    2630         }
    2631     }
     2625        }
     2626
     2627        if (isGlobalConverted)
     2628        {
     2629            if (rc == QIMessageBox::No)
     2630                mVBox.SaveSettingsWithBackup();
     2631            else
     2632                mVBox.SaveSettings();
     2633
     2634            if (!mVBox.isOk())
     2635                vboxProblem().cannotSaveGlobalSettings (mVBox);
     2636        }
     2637    }
     2638
     2639    return true;
    26322640}
    26332641
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxProblemReporter.cpp

    r13580 r13601  
    18271827/**
    18281828 * Shows a list of auto-converted files and asks the user to either Save, Backup
    1829  * or Cancel to leave them as is.
     1829 * or Cancel to leave them as is and exit VirtualBox.
    18301830 *
    18311831 * @param aFormatVersion    Recent settings file format version.
     
    18331833 *
    18341834 * @return QIMessageBox::Yes (Save), QIMessageBox::No (Backup),
    1835  *         QIMessageBox::Cancel (Leave)
     1835 *         QIMessageBox::Cancel (Exit)
    18361836 */
    18371837int VBoxProblemReporter::warnAboutAutoConvertedSettings (const QString &aFormatVersion,
    18381838                                                         const QString &aFileList)
    18391839{
    1840     return message (mainWindowShown(), Warning,
     1840    int rc = message (mainWindowShown(), Info,
     1841        tr ("<p>Your existing VirtualBox settings files were automatically "
     1842            "converted from the old format to a new format necessary for the "
     1843            "new version of VirtualBox.</p>"
     1844            "<p>Press <b>OK</b> to start VirtualBox now or press <b>More</b> if "
     1845            "you want to get more information about what files were converted "
     1846            "and access additional actions.</p>"
     1847            "<p>Press <b>Exit</b> to terminate the VirtualBox "
     1848            "application without saving the results of the conversion to "
     1849            "disk.</p>"),
     1850        NULL /* aAutoConfirmId */,
     1851        QIMessageBox::Ok | QIMessageBox::Default,
     1852        QIMessageBox::No,
     1853        QIMessageBox::Cancel | QIMessageBox::Escape,
     1854        0,
     1855        tr ("&More", "warnAboutAutoConvertedSettings message box"),
     1856        tr ("E&xit", "warnAboutAutoConvertedSettings message box"));
     1857
     1858    /* in the simplest case we backup */
     1859    if (rc == QIMessageBox::Ok)
     1860        return QIMessageBox::No;
     1861
     1862    if (rc == QIMessageBox::Cancel)
     1863        return QIMessageBox::Cancel;
     1864
     1865    return message (mainWindowShown(), Info,
    18411866        tr ("<p>The following VirtualBox settings files have been "
    18421867            "automatically converted to the new settings file format "
     
    18451870            "to disk yet. Please press:</p>"
    18461871            "<ul>"
    1847             "<li><b>Save</b> to save all auto-converted files now (it will not "
    1848             "be possible to use these settings files with an older version of "
    1849             "VirtualBox in the future);</li>"
    18501872            "<li><b>Backup</b> to create backup copies of the settings files in "
    18511873            "the old format before saving them in the new format;</li>"
    1852             "<li><b>Cancel</b> to not save the auto-converted settings files "
    1853             "now.<li>"
     1874            "<li><b>Overwrite</b> to save all auto-converted files without "
     1875            "creating backup copies (it will not be possible to use these "
     1876            "settings files with an older version of VirtualBox "
     1877            "afterwards);</li>"
     1878            "<li><b>Exit</b> to terminate VirtualBox without saving the "
     1879            "results of the conversion to disk.</li>"
    18541880            "</ul>"
    1855             "<p>Note that if you select <b>Cancel</b>, the auto-converted "
    1856             "settings files will be implicitly saved in the new format anyway "
    1857             "once you change a setting or start a virtual machine, but "
    1858             "<b>no</b> backup copies will be created in this case.</p>")
     1881            "<p>It is recommended to always select <b>Backup</b> because in "
     1882            "this case it will be possible to go back to the previous "
     1883            "version of VirtualBox (if necessary) without losing your current "
     1884            "settings. See the VirtualBox Manual for more information about "
     1885            "downgrading.</p>")
    18591886            .arg (aFormatVersion),
    18601887        aFileList,
     
    18631890        QIMessageBox::No | QIMessageBox::Default,
    18641891        QIMessageBox::Cancel | QIMessageBox::Escape,
    1865         tr ("&Save", "warnAboutAutoConvertedSettings message box"),
     1892        tr ("O&verwrite", "warnAboutAutoConvertedSettings message box"),
    18661893        tr ("&Backup", "warnAboutAutoConvertedSettings message box"),
    1867         tr ("Cancel", "warnAboutAutoConvertedSettings message box"));
     1894        tr ("E&xit", "warnAboutAutoConvertedSettings message box"));
    18681895}
    18691896
  • trunk/src/VBox/Frontends/VirtualBox4/src/main.cpp

    r13580 r13601  
    341341#endif
    342342
    343             vboxGlobal().checkForAutoConvertedSettings();
     343            if (!vboxGlobal().checkForAutoConvertedSettings())
     344                break;
    344345
    345346            VBoxGlobalSettings settings = vboxGlobal().settings();
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