- Timestamp:
- Oct 27, 2008 8:22:25 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 38509
- Location:
- trunk/src/VBox/Frontends
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxGlobal.h
r13580 r13601 675 675 #endif 676 676 677 voidcheckForAutoConvertedSettings();677 bool checkForAutoConvertedSettings(); 678 678 679 679 CSession openSession (const QUuid &aId, bool aExisting = false); -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxGlobal.cpp
r13580 r13601 2434 2434 /** 2435 2435 * Checks if any of the settings files were auto-converted and informs the user 2436 * if so. 2437 */ 2438 voidVBoxGlobal::checkForAutoConvertedSettings()2436 * if so. Returns @c false if the user select to exit the application. 2437 */ 2438 bool VBoxGlobal::checkForAutoConvertedSettings() 2439 2439 { 2440 2440 QString formatVersion = mVBox.GetSettingsFormatVersion(); … … 2456 2456 { 2457 2457 machines.append (*m); 2458 fileList += QString ("<nobr>%1 (<i>%2</i>)</nobr><br>") 2458 fileList += QString ("<tr><td><nobr>%1</nobr></td>" 2459 "</td><td><nobr><i>%2</i></nobr></td></tr>") 2459 2460 .arg (m->GetSettingsFilePath()) 2460 2461 .arg (version); … … 2466 2467 { 2467 2468 isGlobalConverted = true; 2468 fileList += QString ("<nobr>%1 (<i>%2</i>)</nobr><br>") 2469 fileList += QString ("<tr><td><nobr>%1</nobr></td>" 2470 "</td><td><nobr><i>%2</i></nobr></td></tr>") 2469 2471 .arg (mVBox.GetSettingsFilePath()) 2470 2472 .arg (version); 2471 2473 } 2472 2474 2473 2474 2475 if (!fileList.isNull()) 2475 2476 { 2477 fileList = QString ("<table cellspacing=0 cellpadding=0>%1</table>") 2478 .arg (fileList); 2479 2476 2480 int rc = vboxProblem() 2477 2481 .warnAboutAutoConvertedSettings (formatVersion, fileList); 2478 2482 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()) 2486 2496 { 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(); 2500 2506 } 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; 2514 2522 } 2515 2523 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxProblemReporter.cpp
r13580 r13601 1724 1724 /** 1725 1725 * 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. 1727 1727 * 1728 1728 * @param aFormatVersion Recent settings file format version. … … 1730 1730 * 1731 1731 * @return QIMessageBox::Yes (Save), QIMessageBox::No (Backup), 1732 * QIMessageBox::Cancel ( Leave)1732 * QIMessageBox::Cancel (Exit) 1733 1733 */ 1734 1734 int VBoxProblemReporter::warnAboutAutoConvertedSettings (const QString &aFormatVersion, 1735 1735 const QString &aFileList) 1736 1736 { 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, 1738 1763 tr ("<p>The following VirtualBox settings files have been " 1739 1764 "automatically converted to the new settings file format " … … 1742 1767 "to disk yet. Please press:</p>" 1743 1768 "<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>"1747 1769 "<li><b>Backup</b> to create backup copies of the settings files in " 1748 1770 "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>" 1751 1777 "</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>") 1756 1783 .arg (aFormatVersion), 1757 1784 aFileList, … … 1760 1787 QIMessageBox::No | QIMessageBox::Default, 1761 1788 QIMessageBox::Cancel | QIMessageBox::Escape, 1762 tr (" &Save", "warnAboutAutoConvertedSettings message box"),1789 tr ("O&verwrite", "warnAboutAutoConvertedSettings message box"), 1763 1790 tr ("&Backup", "warnAboutAutoConvertedSettings message box"), 1764 tr (" Cancel", "warnAboutAutoConvertedSettings message box"));1791 tr ("E&xit", "warnAboutAutoConvertedSettings message box")); 1765 1792 } 1766 1793 -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r13580 r13601 226 226 #endif 227 227 228 vboxGlobal().checkForAutoConvertedSettings(); 228 if (!vboxGlobal().checkForAutoConvertedSettings()) 229 break; 229 230 230 231 VBoxGlobalSettings settings = vboxGlobal().settings(); -
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.