Changeset 13601 in vbox for trunk/src/VBox/Frontends/VirtualBox4
- Timestamp:
- Oct 27, 2008 8:22:25 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 38509
- Location:
- trunk/src/VBox/Frontends/VirtualBox4
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox4/include/VBoxGlobal.h
r13580 r13601 741 741 #endif 742 742 743 voidcheckForAutoConvertedSettings();743 bool checkForAutoConvertedSettings(); 744 744 745 745 CSession openSession (const QUuid &aId, bool aExisting = false); -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxGlobal.cpp
r13580 r13601 2553 2553 /** 2554 2554 * Checks if any of the settings files were auto-converted and informs the user 2555 * if so. 2556 */ 2557 voidVBoxGlobal::checkForAutoConvertedSettings()2555 * if so. Returns @c false if the user select to exit the application. 2556 */ 2557 bool VBoxGlobal::checkForAutoConvertedSettings() 2558 2558 { 2559 2559 QString formatVersion = mVBox.GetSettingsFormatVersion(); … … 2575 2575 { 2576 2576 machines.append (*m); 2577 fileList += QString ("<nobr>%1 (<i>%2</i>)</nobr><br>") 2577 fileList += QString ("<tr><td><nobr>%1</nobr></td><td> </td>" 2578 "</td><td><nobr><i>%2</i></nobr></td></tr>") 2578 2579 .arg (m->GetSettingsFilePath()) 2579 2580 .arg (version); … … 2585 2586 { 2586 2587 isGlobalConverted = true; 2587 fileList += QString ("<nobr>%1 (<i>%2</i>)</nobr><br>") 2588 fileList += QString ("<tr><td><nobr>%1</nobr></td><td> </td>" 2589 "</td><td><nobr><i>%2</i></nobr></td></tr>") 2588 2590 .arg (mVBox.GetSettingsFilePath()) 2589 2591 .arg (version); 2590 2592 } 2591 2593 2592 2593 2594 if (!fileList.isNull()) 2594 2595 { 2596 fileList = QString ("<table cellspacing=0 cellpadding=0>%1</table>") 2597 .arg (fileList); 2598 2595 2599 int rc = vboxProblem() 2596 2600 .warnAboutAutoConvertedSettings (formatVersion, fileList); 2597 2601 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()) 2604 2614 { 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(); 2618 2624 } 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; 2632 2640 } 2633 2641 -
trunk/src/VBox/Frontends/VirtualBox4/src/VBoxProblemReporter.cpp
r13580 r13601 1827 1827 /** 1828 1828 * 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. 1830 1830 * 1831 1831 * @param aFormatVersion Recent settings file format version. … … 1833 1833 * 1834 1834 * @return QIMessageBox::Yes (Save), QIMessageBox::No (Backup), 1835 * QIMessageBox::Cancel ( Leave)1835 * QIMessageBox::Cancel (Exit) 1836 1836 */ 1837 1837 int VBoxProblemReporter::warnAboutAutoConvertedSettings (const QString &aFormatVersion, 1838 1838 const QString &aFileList) 1839 1839 { 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, 1841 1866 tr ("<p>The following VirtualBox settings files have been " 1842 1867 "automatically converted to the new settings file format " … … 1845 1870 "to disk yet. Please press:</p>" 1846 1871 "<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>"1850 1872 "<li><b>Backup</b> to create backup copies of the settings files in " 1851 1873 "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>" 1854 1880 "</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>") 1859 1886 .arg (aFormatVersion), 1860 1887 aFileList, … … 1863 1890 QIMessageBox::No | QIMessageBox::Default, 1864 1891 QIMessageBox::Cancel | QIMessageBox::Escape, 1865 tr (" &Save", "warnAboutAutoConvertedSettings message box"),1892 tr ("O&verwrite", "warnAboutAutoConvertedSettings message box"), 1866 1893 tr ("&Backup", "warnAboutAutoConvertedSettings message box"), 1867 tr (" Cancel", "warnAboutAutoConvertedSettings message box"));1894 tr ("E&xit", "warnAboutAutoConvertedSettings message box")); 1868 1895 } 1869 1896 -
trunk/src/VBox/Frontends/VirtualBox4/src/main.cpp
r13580 r13601 341 341 #endif 342 342 343 vboxGlobal().checkForAutoConvertedSettings(); 343 if (!vboxGlobal().checkForAutoConvertedSettings()) 344 break; 344 345 345 346 VBoxGlobalSettings settings = vboxGlobal().settings();
Note:
See TracChangeset
for help on using the changeset viewer.