VirtualBox

Changeset 45342 in vbox


Ignore:
Timestamp:
Apr 4, 2013 5:21:13 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Message-center rework (part 28): Networking stuff.

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

Legend:

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

    r45334 r45342  
    18851885}
    18861886
    1887 bool UIMessageCenter::askAboutCancelAllNetworkRequest(QWidget *pParent)
    1888 {
    1889     return messageOkCancel(pParent, MessageType_Question, tr("Do you wish to cancel all current network operations?"));
     1887bool UIMessageCenter::confirmCancelingAllNetworkRequests()
     1888{
     1889    return messageOkCancel(networkManagerOrMainWindowShown(), MessageType_Question,
     1890                           tr("Do you wish to cancel all current network operations?"));
    18901891}
    18911892
     
    18931894{
    18941895    message(networkManagerOrMainWindowShown(), MessageType_Info,
    1895             tr("<p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href=\"http://www.virtualbox.org/\">virtualbox.org</a>.</p>"
     1896            tr("<p>A new version of VirtualBox has been released! Version <b>%1</b> is available "
     1897               "at <a href=\"http://www.virtualbox.org/\">virtualbox.org</a>.</p>"
    18961898               "<p>You can download this version using the link:</p>"
    18971899               "<p><a href=%2>%3</a></p>")
    1898             .arg(strVersion, strLink, strLink));
     1900               .arg(strVersion, strLink, strLink));
    18991901}
    19001902
     
    19051907}
    19061908
    1907 bool UIMessageCenter::cannotFindGuestAdditions()
    1908 {
    1909     return messageYesNo(mainMachineWindowShown(), MessageType_Question,
    1910                     tr("<p>Could not find the VirtualBox Guest Additions "
    1911                        "CD image file.</nobr></p><p>Do you wish to "
    1912                        "download this CD image from the Internet?</p>"));
    1913 }
    1914 
    1915 bool UIMessageCenter::confirmDownloadAdditions(const QString &strUrl, qulonglong uSize)
    1916 {
    1917     QLocale loc(VBoxGlobal::languageId());
    1918     return messageOkCancel(networkManagerOrMainMachineWindowShown(), MessageType_Question,
    1919                            tr("<p>Are you sure you want to download the VirtualBox "
    1920                               "Guest Additions CD image from "
    1921                               "<nobr><a href=\"%1\">%2</a></nobr> "
    1922                               "(size %3 bytes)?</p>").arg(strUrl).arg(strUrl).arg(loc.toString(uSize)),
    1923                            0 /* auto-confirm id */,
    1924                            tr("Download", "additions"));
    1925 }
    1926 
    1927 bool UIMessageCenter::confirmMountAdditions(const QString &strUrl, const QString &strSrc)
    1928 {
    1929     return messageOkCancel(networkManagerOrMainMachineWindowShown(), MessageType_Question,
    1930                            tr("<p>The VirtualBox Guest Additions CD image has been "
    1931                               "successfully downloaded from "
    1932                               "<nobr><a href=\"%1\">%2</a></nobr> "
    1933                               "and saved locally as <nobr><b>%3</b>.</nobr></p>"
    1934                               "<p>Do you wish to register this CD image and mount it "
    1935                               "on the virtual CD/DVD drive?</p>")
    1936                                .arg(strUrl).arg(strUrl).arg(strSrc),
    1937                            0 /* auto-confirm id */,
    1938                            tr("Mount", "additions"));
    1939 }
    1940 
    1941 void UIMessageCenter::cannotMountGuestAdditions(const QString &strMachineName)
    1942 {
    1943     message(mainMachineWindowShown(), MessageType_Error,
    1944              tr("<p>Could not insert the VirtualBox Guest Additions "
    1945                 "installer CD image into the virtual machine <b>%1</b>, as the machine "
    1946                 "has no CD/DVD-ROM drives. Please add a drive using the "
    1947                 "storage page of the virtual machine settings dialog.</p>")
    1948                  .arg(strMachineName));
    1949 }
    1950 
    1951 void UIMessageCenter::warnAboutAdditionsCantBeSaved(const QString &strTarget)
    1952 {
    1953     message(networkManagerOrMainMachineWindowShown(), MessageType_Error,
    1954             tr("<p>Failed to save the downloaded file as <nobr><b>%1</b>.</nobr></p>")
    1955                .arg(QDir::toNativeSeparators(strTarget)));
    1956 }
    1957 
    1958 bool UIMessageCenter::askAboutUserManualDownload(const QString &strMissedLocation)
    1959 {
    1960     return messageOkCancel(mainWindowShown(), MessageType_Question,
    1961                            tr("<p>Could not find the VirtualBox User Manual "
    1962                               "<nobr><b>%1</b>.</nobr></p><p>Do you wish to "
    1963                               "download this file from the Internet?</p>")
    1964                               .arg(strMissedLocation),
    1965                            0 /* auto-confirm id */,
    1966                            tr("Download", "additions"));
    1967 }
    1968 
    1969 bool UIMessageCenter::confirmUserManualDownload(const QString &strURL, qulonglong uSize)
    1970 {
    1971     QLocale loc(VBoxGlobal::languageId());
    1972     return messageOkCancel(networkManagerOrMainWindowShown(), MessageType_Question,
    1973                            tr("<p>Are you sure you want to download the VirtualBox "
    1974                               "User Manual from "
    1975                               "<nobr><a href=\"%1\">%2</a></nobr> "
    1976                               "(size %3 bytes)?</p>").arg(strURL).arg(strURL).arg(loc.toString(uSize)),
    1977                            0 /* auto-confirm id */,
    1978                            tr("Download", "additions"));
    1979 }
    1980 
    1981 void UIMessageCenter::warnAboutUserManualDownloaded(const QString &strURL, const QString &strTarget)
    1982 {
    1983     message(networkManagerOrMainWindowShown(), MessageType_Warning,
    1984             tr("<p>The VirtualBox User Manual has been "
    1985                "successfully downloaded from "
    1986                "<nobr><a href=\"%1\">%2</a></nobr> "
    1987                "and saved locally as <nobr><b>%3</b>.</nobr></p>")
    1988                .arg(strURL).arg(strURL).arg(strTarget));
    1989 }
    1990 
    1991 void UIMessageCenter::warnAboutUserManualCantBeSaved(const QString &strURL, const QString &strTarget)
    1992 {
    1993     message(networkManagerOrMainWindowShown(), MessageType_Error,
    1994             tr("<p>The VirtualBox User Manual has been "
    1995                "successfully downloaded from "
    1996                "<nobr><a href=\"%1\">%2</a></nobr> "
    1997                "but can't be saved locally as <nobr><b>%3</b>.</nobr></p>"
    1998                "<p>Please choose another location for that file.</p>")
    1999                .arg(strURL).arg(strURL).arg(strTarget));
    2000 }
    2001 
    2002 bool UIMessageCenter::proposeDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion)
    2003 {
    2004     return messageOkCancel(mainWindowShown(),
    2005                            MessageType_Question,
    2006                            tr("<p>You have an old version (%1) of the <b><nobr>%2</nobr></b> installed.</p>"
    2007                               "<p>Do you wish to download latest one from the Internet?</p>")
    2008                               .arg(strExtPackVersion).arg(strExtPackName),
    2009                            0 /* auto-confirm id */,
    2010                            tr("Download", "extension pack"));
    2011 }
    2012 
    2013 bool UIMessageCenter::requestUserDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion, const QString &strVBoxVersion)
     1909bool UIMessageCenter::askUserToDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion, const QString &strVBoxVersion)
    20141910{
    20151911    return message(mainWindowShown(), MessageType_Info,
     
    20241920}
    20251921
    2026 bool UIMessageCenter::confirmDownloadExtensionPack(const QString &strExtPackName, const QString &strURL, qulonglong uSize)
     1922bool UIMessageCenter::cannotFindGuestAdditions() const
     1923{
     1924    return messageYesNo(mainMachineWindowShown(), MessageType_Question,
     1925                        tr("<p>Could not find the <b>VirtualBox Guest Additions</b> CD image.</p>"
     1926                           "<p>Do you wish to download this CD image from the Internet?</p>"),
     1927                        0 /* auto-confirm id */,
     1928                        tr("Download"));
     1929}
     1930
     1931bool UIMessageCenter::confirmDownloadGuestAdditions(const QString &strUrl, qulonglong uSize) const
     1932{
     1933    QLocale loc(VBoxGlobal::languageId());
     1934    return messageOkCancel(networkManagerOrMainMachineWindowShown(), MessageType_Question,
     1935                           tr("<p>Are you sure you want to download the <b>VirtualBox Guest Additions</b> CD image "
     1936                              "from <nobr><a href=\"%1\">%1</a></nobr> (size %2 bytes)?</p>")
     1937                              .arg(strUrl, loc.toString(uSize)),
     1938                           0 /* auto-confirm id */,
     1939                           tr("Download"));
     1940}
     1941
     1942void UIMessageCenter::cannotSaveGuestAdditions(const QString &strURL, const QString &strTarget) const
     1943{
     1944    message(networkManagerOrMainMachineWindowShown(), MessageType_Error,
     1945            tr("<p>The <b>VirtualBox Guest Additions</b> CD image has been successfully downloaded "
     1946               "from <nobr><a href=\"%1\">%1</a></nobr> "
     1947               "but can't be saved locally as <nobr><b>%2</b>.</nobr></p>"
     1948               "<p>Please choose another location for that file.</p>")
     1949               .arg(strURL, strTarget));
     1950}
     1951
     1952bool UIMessageCenter::proposeMountGuestAdditions(const QString &strUrl, const QString &strSrc) const
     1953{
     1954    return messageOkCancel(networkManagerOrMainMachineWindowShown(), MessageType_Question,
     1955                           tr("<p>The <b>VirtualBox Guest Additions</b> CD image has been successfully downloaded "
     1956                              "from <nobr><a href=\"%1\">%1</a></nobr> "
     1957                              "and saved locally as <nobr><b>%2</b>.</nobr></p>"
     1958                              "<p>Do you wish to register this CD image and mount it on the virtual CD/DVD drive?</p>")
     1959                              .arg(strUrl, strSrc),
     1960                           0 /* auto-confirm id */,
     1961                           tr("Mount", "additions"));
     1962}
     1963
     1964void UIMessageCenter::cannotMountGuestAdditions(const QString &strMachineName) const
     1965{
     1966    message(mainMachineWindowShown(), MessageType_Error,
     1967            tr("<p>Could not insert the <b>VirtualBox Guest Additions</b> CD image into the virtual machine <b>%1</b>, "
     1968               "as the machine has no CD/DVD-ROM drives. Please add a drive using the storage page of the "
     1969               "virtual machine settings dialog.</p>")
     1970               .arg(strMachineName));
     1971}
     1972
     1973void UIMessageCenter::cannotUpdateGuestAdditions(const CProgress &progress) const
     1974{
     1975    message(mainMachineWindowShown(), MessageType_Error,
     1976            tr("Failed to update Guest Additions. "
     1977               "The Guest Additions installation image will be mounted to provide a manual installation."),
     1978            !progress.isOk() ? formatErrorInfo(progress) : formatErrorInfo(progress.GetErrorInfo()));
     1979}
     1980
     1981bool UIMessageCenter::cannotFindUserManual(const QString &strMissedLocation) const
     1982{
     1983    return messageYesNo(mainWindowShown(), MessageType_Question,
     1984                        tr("<p>Could not find the <b>VirtualBox User Manual</b> <nobr><b>%1</b>.</nobr></p>"
     1985                           "<p>Do you wish to download this file from the Internet?</p>")
     1986                           .arg(strMissedLocation),
     1987                        0 /* auto-confirm id */,
     1988                        tr("Download"));
     1989}
     1990
     1991bool UIMessageCenter::confirmDownloadUserManual(const QString &strURL, qulonglong uSize) const
     1992{
     1993    QLocale loc(VBoxGlobal::languageId());
     1994    return messageOkCancel(networkManagerOrMainWindowShown(), MessageType_Question,
     1995                           tr("<p>Are you sure you want to download the <b>VirtualBox User Manual</b> "
     1996                              "from <nobr><a href=\"%1\">%1</a></nobr> (size %2 bytes)?</p>")
     1997                              .arg(strURL, loc.toString(uSize)),
     1998                           0 /* auto-confirm id */,
     1999                           tr("Download"));
     2000}
     2001
     2002void UIMessageCenter::cannotSaveUserManual(const QString &strURL, const QString &strTarget) const
     2003{
     2004    message(networkManagerOrMainWindowShown(), MessageType_Error,
     2005            tr("<p>The VirtualBox User Manual has been successfully downloaded "
     2006               "from <nobr><a href=\"%1\">%1</a></nobr> "
     2007               "but can't be saved locally as <nobr><b>%2</b>.</nobr></p>"
     2008               "<p>Please choose another location for that file.</p>")
     2009               .arg(strURL, strTarget));
     2010}
     2011
     2012void UIMessageCenter::warnAboutUserManualDownloaded(const QString &strURL, const QString &strTarget) const
     2013{
     2014    message(networkManagerOrMainWindowShown(), MessageType_Warning,
     2015            tr("<p>The VirtualBox User Manual has been successfully downloaded "
     2016               "from <nobr><a href=\"%1\">%1</a></nobr> "
     2017               "and saved locally as <nobr><b>%2</b>.</nobr></p>")
     2018               .arg(strURL, strTarget));
     2019}
     2020
     2021bool UIMessageCenter::warAboutOutdatedExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion) const
     2022{
     2023    return messageYesNo(mainWindowShown(),
     2024                        MessageType_Question,
     2025                        tr("<p>You have an old version (%1) of the <b><nobr>%2</nobr></b> installed.</p>"
     2026                           "<p>Do you wish to download latest one from the Internet?</p>")
     2027                           .arg(strExtPackVersion).arg(strExtPackName),
     2028                        0 /* auto-confirm id */,
     2029                        tr("Download"));
     2030}
     2031
     2032bool UIMessageCenter::confirmDownloadExtensionPack(const QString &strExtPackName, const QString &strURL, qulonglong uSize) const
    20272033{
    20282034    QLocale loc(VBoxGlobal::languageId());
     
    20322038                              .arg(strExtPackName, strURL, loc.toString(uSize)),
    20332039                           0 /* auto-confirm id */,
    2034                            tr("Download", "extension pack"));
    2035 }
    2036 
    2037 bool UIMessageCenter::proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo)
     2040                           tr("Download"));
     2041}
     2042
     2043void UIMessageCenter::cannotSaveExtensionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const
     2044{
     2045    message(networkManagerOrMainWindowShown(), MessageType_Error,
     2046            tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded "
     2047               "from <nobr><a href=\"%2\">%2</a></nobr> "
     2048               "but can't be saved locally as <nobr><b>%3</b>.</nobr></p>"
     2049               "<p>Please choose another location for that file.</p>")
     2050               .arg(strExtPackName, strFrom, strTo));
     2051}
     2052
     2053bool UIMessageCenter::proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const
    20382054{
    20392055    return messageOkCancel(networkManagerOrMainWindowShown(), MessageType_Question,
    2040                            tr("<p>The <b><nobr>%1</nobr></b> has been "
    2041                               "successfully downloaded from <nobr><a href=\"%2\">%2</a></nobr> "
     2056                           tr("<p>The <b><nobr>%1</nobr></b> has been successfully downloaded "
     2057                              "from <nobr><a href=\"%2\">%2</a></nobr> "
    20422058                              "and saved locally as <nobr><b>%3</b>.</nobr></p>"
    20432059                              "<p>Do you wish to install this extension pack?</p>")
    20442060                              .arg(strExtPackName, strFrom, strTo),
    20452061                           0 /* auto-confirm id */,
    2046                            tr ("Install", "extension pack"));
    2047 }
    2048 
    2049 void UIMessageCenter::warnAboutExtentionPackCantBeSaved(const QString &strExtPackName, const QString &strFrom, const QString &strTo)
    2050 {
    2051     message(networkManagerOrMainWindowShown(), MessageType_Error,
    2052             tr("<p>The <b><nobr>%1</nobr></b> has been "
    2053                "successfully downloaded from <nobr><a href=\"%2\">%2</a></nobr> "
    2054                "but can't be saved locally as <nobr><b>%3</b>.</nobr></p>"
    2055                "<p>Please choose another location for that file.</p>")
    2056                .arg(strExtPackName, strFrom, strTo));
    2057 }
    2058 
    2059 void UIMessageCenter::cannotUpdateGuestAdditions(const CProgress &progress,
    2060                                                  QWidget *pParent /* = NULL */) const
    2061 {
    2062     AssertWrapperOk(progress);
    2063 
    2064     message(pParent ? pParent : mainWindowShown(),
    2065             MessageType_Error,
    2066             tr("Failed to update Guest Additions. The Guest Additions installation image will be mounted to provide a manual installation."),
    2067             formatErrorInfo(progress.GetErrorInfo()));
    2068 }
    2069 
    2070 void UIMessageCenter::cannotOpenExtPack(const QString &strFilename,
    2071                                         const CExtPackManager &extPackManager,
    2072                                         QWidget *pParent)
    2073 {
    2074     message(pParent ? pParent : mainWindowShown(),
    2075             MessageType_Error,
    2076             tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename),
    2077             formatErrorInfo(extPackManager));
    2078 }
    2079 
    2080 void UIMessageCenter::badExtPackFile(const QString &strFilename,
    2081                                      const CExtPackFile &extPackFile,
    2082                                      QWidget *pParent)
    2083 {
    2084     message(pParent ? pParent : mainWindowShown(),
    2085             MessageType_Error,
    2086             tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename),
    2087             "<!--EOM-->" + extPackFile.GetWhyUnusable());
    2088 }
    2089 
    2090 void UIMessageCenter::cannotInstallExtPack(const QString &strFilename,
    2091                                            const CExtPackFile &extPackFile,
    2092                                            const CProgress &progress,
    2093                                            QWidget *pParent)
    2094 {
    2095     if (!pParent)
    2096         pParent = mainWindowShown();
    2097     QString strErrInfo = !extPackFile.isOk() || progress.isNull()
    2098                        ? formatErrorInfo(extPackFile) : formatErrorInfo(progress.GetErrorInfo());
    2099     message(pParent,
    2100             MessageType_Error,
    2101             tr("Failed to install the Extension Pack <b>%1</b>.").arg(strFilename),
    2102             strErrInfo);
    2103 }
    2104 
    2105 void UIMessageCenter::cannotUninstallExtPack(const QString &strPackName, const CExtPackManager &extPackManager,
    2106                                              const CProgress &progress, QWidget *pParent)
    2107 {
    2108     if (!pParent)
    2109         pParent = mainWindowShown();
    2110     QString strErrInfo = !extPackManager.isOk() || progress.isNull()
    2111                        ? formatErrorInfo(extPackManager) : formatErrorInfo(progress.GetErrorInfo());
    2112     message(pParent,
    2113             MessageType_Error,
    2114             tr("Failed to uninstall the Extension Pack <b>%1</b>.").arg(strPackName),
    2115             strErrInfo);
    2116 }
    2117 
    2118 bool UIMessageCenter::confirmInstallingPackage(const QString &strPackName, const QString &strPackVersion,
    2119                                                const QString &strPackDescription, QWidget *pParent)
     2062                           tr("Install", "extension pack"));
     2063}
     2064
     2065bool UIMessageCenter::confirmInstallExtensionPack(const QString &strPackName, const QString &strPackVersion,
     2066                                                  const QString &strPackDescription, QWidget *pParent /*= 0*/) const
    21202067{
    21212068    return messageOkCancel(pParent ? pParent : mainWindowShown(),
     
    21302077                              "<tr><td><b>Description:&nbsp;&nbsp;</b></td><td>%3</td></tr>"
    21312078                              "</table></p>")
    2132                            .arg(strPackName).arg(strPackVersion).arg(strPackDescription),
     2079                              .arg(strPackName).arg(strPackVersion).arg(strPackDescription),
    21332080                           0,
    2134                            tr("&Install"));
    2135 }
    2136 
    2137 bool UIMessageCenter::confirmReplacePackage(const QString &strPackName, const QString &strPackVersionNew,
    2138                                             const QString &strPackVersionOld, const QString &strPackDescription,
    2139                                             QWidget *pParent)
    2140 {
    2141     if (!pParent)
    2142         pParent = pParent ? pParent : mainWindowShown(); /* this is boring stuff that messageOkCancel should do! */
    2143 
     2081                           tr("Install", "extension pack"));
     2082}
     2083
     2084bool UIMessageCenter::confirmReplaceExtensionPack(const QString &strPackName, const QString &strPackVersionNew,
     2085                                                  const QString &strPackVersionOld, const QString &strPackDescription,
     2086                                                  QWidget *pParent /*= 0*/) const
     2087{
     2088    /* Prepare initial message: */
    21442089    QString strBelehrung = tr("Extension packs complement the functionality of VirtualBox and can contain "
    21452090                              "system level software that could be potentially harmful to your system. "
     
    21472092                              "the extension pack from a trusted source.");
    21482093
     2094    /* Compare versions: */
    21492095    QByteArray  ba1     = strPackVersionNew.toUtf8();
    21502096    QByteArray  ba2     = strPackVersionOld.toUtf8();
    21512097    int         iVerCmp = RTStrVersionCompare(ba1.constData(), ba2.constData());
    21522098
     2099    /* Show the message: */
    21532100    bool fRc;
    21542101    if (iVerCmp > 0)
    2155         fRc = messageOkCancel(pParent,
     2102        fRc = messageOkCancel(pParent ? pParent : mainWindowShown(),
    21562103                              MessageType_Question,
    21572104                              tr("<p>An older version of the extension pack is already installed, would you like to upgrade? "
     
    21632110                                 "<tr><td><b>Description:&nbsp;&nbsp;</b></td><td>%5</td></tr>"
    21642111                                 "</table></p>")
    2165                               .arg(strBelehrung).arg(strPackName).arg(strPackVersionNew).arg(strPackVersionOld).arg(strPackDescription),
     2112                                 .arg(strBelehrung).arg(strPackName).arg(strPackVersionNew).arg(strPackVersionOld).arg(strPackDescription),
    21662113                              0,
    21672114                              tr("&Upgrade"));
    21682115    else if (iVerCmp < 0)
    2169         fRc = messageOkCancel(pParent,
     2116        fRc = messageOkCancel(pParent ? pParent : mainWindowShown(),
    21702117                              MessageType_Question,
    21712118                              tr("<p>An newer version of the extension pack is already installed, would you like to downgrade? "
     
    21772124                                 "<tr><td><b>Description:&nbsp;&nbsp;</b></td><td>%5</td></tr>"
    21782125                                 "</table></p>")
    2179                               .arg(strBelehrung).arg(strPackName).arg(strPackVersionNew).arg(strPackVersionOld).arg(strPackDescription),
     2126                                 .arg(strBelehrung).arg(strPackName).arg(strPackVersionNew).arg(strPackVersionOld).arg(strPackDescription),
    21802127                              0,
    21812128                              tr("&Downgrade"));
    21822129    else
    2183         fRc = messageOkCancel(pParent,
     2130        fRc = messageOkCancel(pParent ? pParent : mainWindowShown(),
    21842131                              MessageType_Question,
    21852132                              tr("<p>The extension pack is already installed with the same version, would you like reinstall it? "
     
    21902137                                 "<tr><td><b>Description:&nbsp;&nbsp;</b></td><td>%4</td></tr>"
    21912138                                 "</table></p>")
    2192                               .arg(strBelehrung).arg(strPackName).arg(strPackVersionOld).arg(strPackDescription),
     2139                                 .arg(strBelehrung).arg(strPackName).arg(strPackVersionOld).arg(strPackDescription),
    21932140                              0,
    21942141                              tr("&Reinstall"));
     
    21962143}
    21972144
    2198 bool UIMessageCenter::confirmRemovingPackage(const QString &strPackName, QWidget *pParent)
     2145bool UIMessageCenter::confirmRemoveExtensionPack(const QString &strPackName, QWidget *pParent /*= 0*/) const
    21992146{
    22002147    return messageOkCancel(pParent ? pParent : mainWindowShown(),
    2201                             MessageType_Question,
    2202                             tr("<p>You are about to remove the VirtualBox extension pack <b>%1</b>.</p>"
    2203                                "<p>Are you sure you want to proceed?</p>").arg(strPackName),
    2204                             0,
    2205                             tr("&Remove"));
    2206 }
    2207 
    2208 void UIMessageCenter::notifyAboutExtPackInstalled(const QString &strPackName, QWidget *pParent)
     2148                           MessageType_Question,
     2149                           tr("<p>You are about to remove the VirtualBox extension pack <b>%1</b>.</p>"
     2150                              "<p>Are you sure you want to proceed?</p>")
     2151                              .arg(strPackName),
     2152                           0,
     2153                           tr("&Remove"));
     2154}
     2155
     2156void UIMessageCenter::cannotOpenExtPack(const QString &strFilename, const CExtPackManager &extPackManager, QWidget *pParent /*= 0*/) const
     2157{
     2158    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     2159            tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename),
     2160            formatErrorInfo(extPackManager));
     2161}
     2162
     2163void UIMessageCenter::warnAboutBadExtPackFile(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent /*= 0*/) const
     2164{
     2165    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     2166            tr("Failed to open the Extension Pack <b>%1</b>.").arg(strFilename),
     2167            "<!--EOM-->" + extPackFile.GetWhyUnusable());
     2168}
     2169
     2170void UIMessageCenter::cannotInstallExtPack(const CExtPackFile &extPackFile, const QString &strFilename, QWidget *pParent /*= 0*/) const
     2171{
     2172    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     2173            tr("Failed to install the Extension Pack <b>%1</b>.")
     2174               .arg(strFilename),
     2175            formatErrorInfo(extPackFile));
     2176}
     2177
     2178void UIMessageCenter::cannotInstallExtPack(const CProgress &progress, const QString &strFilename, QWidget *pParent /*= 0*/) const
     2179{
     2180    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     2181            tr("Failed to install the Extension Pack <b>%1</b>.")
     2182               .arg(strFilename),
     2183            !progress.isOk() ? formatErrorInfo(progress) : formatErrorInfo(progress.GetErrorInfo()));
     2184}
     2185
     2186void UIMessageCenter::cannotUninstallExtPack(const CExtPackManager &extPackManager, const QString &strPackName, QWidget *pParent /*= 0*/) const
     2187{
     2188    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     2189            tr("Failed to uninstall the Extension Pack <b>%1</b>.")
     2190               .arg(strPackName),
     2191            formatErrorInfo(extPackManager));
     2192}
     2193
     2194void UIMessageCenter::cannotUninstallExtPack(const CProgress &progress, const QString &strPackName, QWidget *pParent /*= 0*/) const
     2195{
     2196    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     2197            tr("Failed to uninstall the Extension Pack <b>%1</b>.")
     2198               .arg(strPackName),
     2199            !progress.isOk() ? formatErrorInfo(progress) : formatErrorInfo(progress.GetErrorInfo()));
     2200}
     2201
     2202void UIMessageCenter::warnAboutExtPackInstalled(const QString &strPackName, QWidget *pParent /*= 0*/) const
    22092203{
    22102204    message(pParent ? pParent : mainWindowShown(),
    2211              MessageType_Info,
    2212              tr("The extension pack <br><nobr><b>%1</b><nobr><br> was installed successfully.").arg(strPackName));
     2205            MessageType_Info,
     2206            tr("The extension pack <br><nobr><b>%1</b><nobr><br> was installed successfully.")
     2207               .arg(strPackName));
    22132208}
    22142209
     
    25312526    }
    25322527    /* Else propose to download user manual: */
    2533     else if (askAboutUserManualDownload(strUserManualFileName1))
     2528    else if (cannotFindUserManual(strUserManualFileName1))
    25342529    {
    25352530        /* Create User Manual downloader: */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r45334 r45342  
    325325
    326326    /* API: Network management warnings: */
    327     bool askAboutCancelAllNetworkRequest(QWidget *pParent);
     327    bool confirmCancelingAllNetworkRequests();
    328328    void showUpdateSuccess(const QString &strVersion, const QString &strLink);
    329329    void showUpdateNotFound();
     330    bool askUserToDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion, const QString &strVBoxVersion);
    330331
    331332    /* API: Downloading warnings: */
    332     bool cannotFindGuestAdditions();
    333     bool confirmDownloadAdditions(const QString &strUrl, qulonglong uSize);
    334     bool confirmMountAdditions(const QString &strUrl, const QString &strSrc);
    335     void cannotMountGuestAdditions(const QString &strMachineName);
    336     void warnAboutAdditionsCantBeSaved(const QString &strTarget);
    337     bool askAboutUserManualDownload(const QString &strMissedLocation);
    338     bool confirmUserManualDownload(const QString &strURL, qulonglong uSize);
    339     void warnAboutUserManualDownloaded(const QString &strURL, const QString &strTarget);
    340     void warnAboutUserManualCantBeSaved(const QString &strURL, const QString &strTarget);
    341     bool proposeDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion);
    342     bool requestUserDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion, const QString &strVBoxVersion);
    343     bool confirmDownloadExtensionPack(const QString &strExtPackName, const QString &strURL, qulonglong uSize);
    344     bool proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo);
    345     void warnAboutExtentionPackCantBeSaved(const QString &strExtPackName, const QString &strFrom, const QString &strTo);
    346     void cannotUpdateGuestAdditions(const CProgress &progress, QWidget *pParent /* = NULL */) const;
    347     void cannotOpenExtPack(const QString &strFilename, const CExtPackManager &extPackManager, QWidget *pParent);
    348     void badExtPackFile(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent);
    349     void cannotInstallExtPack(const QString &strFilename, const CExtPackFile &extPackFile, const CProgress &progress, QWidget *pParent);
    350     void cannotUninstallExtPack(const QString &strPackName, const CExtPackManager &extPackManager, const CProgress &progress, QWidget *pParent);
    351     bool confirmInstallingPackage(const QString &strPackName, const QString &strPackVersion, const QString &strPackDescription, QWidget *pParent);
    352     bool confirmReplacePackage(const QString &strPackName, const QString &strPackVersionNew, const QString &strPackVersionOld,
    353                                const QString &strPackDescription, QWidget *pParent);
    354     bool confirmRemovingPackage(const QString &strPackName, QWidget *pParent);
    355     void notifyAboutExtPackInstalled(const QString &strPackName, QWidget *pParent);
     333    bool cannotFindGuestAdditions() const;
     334    bool confirmDownloadGuestAdditions(const QString &strUrl, qulonglong uSize) const;
     335    void cannotSaveGuestAdditions(const QString &strURL, const QString &strTarget) const;
     336    bool proposeMountGuestAdditions(const QString &strUrl, const QString &strSrc) const;
     337    void cannotMountGuestAdditions(const QString &strMachineName) const;
     338    void cannotUpdateGuestAdditions(const CProgress &progress) const;
     339    bool cannotFindUserManual(const QString &strMissedLocation) const;
     340    bool confirmDownloadUserManual(const QString &strURL, qulonglong uSize) const;
     341    void cannotSaveUserManual(const QString &strURL, const QString &strTarget) const;
     342    void warnAboutUserManualDownloaded(const QString &strURL, const QString &strTarget) const;
     343    bool warAboutOutdatedExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion) const;
     344    bool confirmDownloadExtensionPack(const QString &strExtPackName, const QString &strURL, qulonglong uSize) const;
     345    void cannotSaveExtensionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const;
     346    bool proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) const;
     347    bool confirmInstallExtensionPack(const QString &strPackName, const QString &strPackVersion, const QString &strPackDescription, QWidget *pParent = 0) const;
     348    bool confirmReplaceExtensionPack(const QString &strPackName, const QString &strPackVersionNew, const QString &strPackVersionOld,
     349                                     const QString &strPackDescription, QWidget *pParent = 0) const;
     350    bool confirmRemoveExtensionPack(const QString &strPackName, QWidget *pParent = 0) const;
     351    void cannotOpenExtPack(const QString &strFilename, const CExtPackManager &extPackManager, QWidget *pParent = 0) const;
     352    void warnAboutBadExtPackFile(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent = 0) const;
     353    void cannotInstallExtPack(const CExtPackFile &extPackFile, const QString &strFilename, QWidget *pParent = 0) const;
     354    void cannotInstallExtPack(const CProgress &progress, const QString &strFilename, QWidget *pParent = 0) const;
     355    void cannotUninstallExtPack(const CExtPackManager &extPackManager, const QString &strPackName, QWidget *pParent = 0) const;
     356    void cannotUninstallExtPack(const CProgress &progress, const QString &strPackName, QWidget *pParent = 0) const;
     357    void warnAboutExtPackInstalled(const QString &strPackName, QWidget *pParent = 0) const;
    356358
    357359    /* API: License-viewer warnings: */
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderAdditions.cpp

    r43707 r45342  
    7474bool UIDownloaderAdditions::askForDownloadingConfirmation(UINetworkReply *pReply)
    7575{
    76     return msgCenter().confirmDownloadAdditions(source().toString(), pReply->header(QNetworkRequest::ContentLengthHeader).toInt());
     76    return msgCenter().confirmDownloadGuestAdditions(source().toString(), pReply->header(QNetworkRequest::ContentLengthHeader).toInt());
    7777}
    7878
     
    9393
    9494            /* Warn the user about additions-image loaded and saved, propose to mount it: */
    95             if (msgCenter().confirmMountAdditions(source().toString(), QDir::toNativeSeparators(target())))
     95            if (msgCenter().proposeMountGuestAdditions(source().toString(), QDir::toNativeSeparators(target())))
    9696                emit sigDownloadFinished(target());
    9797            break;
     
    9999
    100100        /* Warn the user about additions-image was downloaded but was NOT saved: */
    101         msgCenter().warnAboutAdditionsCantBeSaved(target());
     101        msgCenter().cannotSaveGuestAdditions(source().toString(), QDir::toNativeSeparators(target()));
    102102
    103103        /* Ask the user for another location for the additions-image file: */
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderExtensionPack.cpp

    r43707 r45342  
    116116
    117117        /* Warn the user about extension-pack was downloaded but was NOT saved: */
    118         msgCenter().warnAboutExtentionPackCantBeSaved(GUI_ExtPackName, source().toString(), QDir::toNativeSeparators(target()));
     118        msgCenter().cannotSaveExtensionPack(GUI_ExtPackName, source().toString(), QDir::toNativeSeparators(target()));
    119119
    120120        /* Ask the user for another location for the extension-pack file: */
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIDownloaderUserManual.cpp

    r43707 r45342  
    7777bool UIDownloaderUserManual::askForDownloadingConfirmation(UINetworkReply *pReply)
    7878{
    79     return msgCenter().confirmUserManualDownload(source().toString(), pReply->header(QNetworkRequest::ContentLengthHeader).toInt());
     79    return msgCenter().confirmDownloadUserManual(source().toString(), pReply->header(QNetworkRequest::ContentLengthHeader).toInt());
    8080}
    8181
     
    103103
    104104        /* Warn user about user-manual was downloaded but was NOT saved: */
    105         msgCenter().warnAboutUserManualCantBeSaved(source().toString(), QDir::toNativeSeparators(target()));
     105        msgCenter().cannotSaveUserManual(source().toString(), QDir::toNativeSeparators(target()));
    106106
    107107        /* Ask the user for another location for the user-manual file: */
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkManagerDialog.cpp

    r42526 r45342  
    145145{
    146146    /* Ask if user wants to cancel all current network-requests: */
    147     if (msgCenter().askAboutCancelAllNetworkRequest(this))
     147    if (msgCenter().confirmCancelingAllNetworkRequests())
    148148        emit sigCancelNetworkRequests();
    149149}
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UIUpdateManager.cpp

    r43711 r45342  
    414414        {
    415415            /* Inform the user that he should update the extension pack: */
    416             msgCenter().requestUserDownloadExtensionPack(GUI_ExtPackName, strExtPackVersion, strVBoxVersion);
     416            msgCenter().askUserToDownloadExtensionPack(GUI_ExtPackName, strExtPackVersion, strVBoxVersion);
    417417            /* Never try to download for ENTERPRISE version: */
    418418            emit sigStepComplete();
     
    421421
    422422        /* Ask the user about extension pack downloading: */
    423         if (!msgCenter().proposeDownloadExtensionPack(GUI_ExtPackName, strExtPackVersion))
     423        if (!msgCenter().warAboutOutdatedExtensionPack(GUI_ExtPackName, strExtPackVersion))
    424424        {
    425425            emit sigStepComplete();
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp

    r45219 r45342  
    148148    if (!extPackFile.GetUsable())
    149149    {
    150         msgCenter().badExtPackFile(strFilePath, extPackFile, pParent);
     150        msgCenter().warnAboutBadExtPackFile(strFilePath, extPackFile, pParent);
    151151        return;
    152152    }
     
    166166    {
    167167        QString strPackVersionCur = QString("%1r%2%3").arg(extPackCur.GetVersion()).arg(extPackCur.GetRevision()).arg(extPackCur.GetEdition());
    168         if (!msgCenter().confirmReplacePackage(strPackName, strPackVersion, strPackVersionCur, strPackDescription, pParent))
     168        if (!msgCenter().confirmReplaceExtensionPack(strPackName, strPackVersion, strPackVersionCur, strPackDescription, pParent))
    169169            return;
    170170    }
     
    174174    else
    175175    {
    176         if (!msgCenter().confirmInstallingPackage(strPackName, strPackVersion, strPackDescription, pParent))
     176        if (!msgCenter().confirmInstallExtensionPack(strPackName, strPackVersion, strPackDescription, pParent))
    177177            return;
    178178    }
     
    196196     */
    197197    QString displayInfo;
    198 #ifdef RT_OS_WINDOWS
     198#ifdef Q_WS_WIN
    199199    if (pParent)
    200200        displayInfo.sprintf("hwnd=%#llx", (uint64_t)(uintptr_t)pParent->winId());
    201 #endif
     201#endif /* Q_WS_WIN */
     202    /* Prepare installation progress: */
    202203    CProgress progress = extPackFile.Install(fReplaceIt, displayInfo);
    203204    if (extPackFile.isOk())
    204205    {
    205         if (progress.isNull())
    206             msgCenter().notifyAboutExtPackInstalled(strPackName, pParent);
    207         else
     206        /* Show installation progress: */
     207        msgCenter().showModalProgressDialog(progress, tr("Extensions"), "", pParent);
     208        if (!progress.GetCanceled())
    208209        {
    209             msgCenter().showModalProgressDialog(progress, tr("Extensions"), "", pParent);
    210             if (!progress.GetCanceled())
    211             {
    212                 if (progress.isOk() && progress.GetResultCode() == 0)
    213                     msgCenter().notifyAboutExtPackInstalled(strPackName, pParent);
    214                 else
    215                     msgCenter().cannotInstallExtPack(strFilePath, extPackFile, progress, pParent);
    216             }
     210            if (progress.isOk() && progress.GetResultCode() == 0)
     211                msgCenter().warnAboutExtPackInstalled(strPackName, pParent);
     212            else
     213                msgCenter().cannotInstallExtPack(progress, strFilePath, pParent);
    217214        }
    218215    }
    219216    else
    220         msgCenter().cannotInstallExtPack(strFilePath, extPackFile, progress, pParent);
     217        msgCenter().cannotInstallExtPack(extPackFile, strFilePath, pParent);
    221218
    222219    if (pstrExtPackName)
     
    409406        QString strSelectedPackageName = pItem->name();
    410407        /* Ask the user about package removing: */
    411         if (msgCenter().confirmRemovingPackage(strSelectedPackageName, this))
     408        if (msgCenter().confirmRemoveExtensionPack(strSelectedPackageName, this))
    412409        {
    413410            /*
     
    417414            /** @todo Refuse this if any VMs are running. */
    418415            QString displayInfo;
    419 #ifdef RT_OS_WINDOWS
     416#ifdef Q_WS_WIN
    420417            displayInfo.sprintf("hwnd=%#llx", (uint64_t)(uintptr_t)this->winId());
    421 #endif
     418#endif /* Q_WS_WIN */
     419            /* Prepare uninstallation progress: */
    422420            CProgress progress = manager.Uninstall(strSelectedPackageName, false /* forced removal? */, displayInfo);
    423421            if (manager.isOk())
    424422            {
    425                 bool fOk = true;
    426                 if (!progress.isNull())
    427                 {
    428                     msgCenter().showModalProgressDialog(progress, tr("Extensions"), "", window());
    429                     fOk = progress.isOk() && progress.GetResultCode() == 0;
    430                 }
    431                 if (fOk)
     423                /* Show uninstallation progress: */
     424                msgCenter().showModalProgressDialog(progress, tr("Extensions"), "", this);
     425                if (progress.isOk() && progress.GetResultCode() == 0)
    432426                {
    433427                    /* Remove selected package from cache: */
     
    440434                        }
    441435                    }
    442 
    443436                    /* Remove selected package from tree: */
    444437                    delete pItem;
    445438                }
    446439                else
    447                     msgCenter().cannotUninstallExtPack(strSelectedPackageName, manager, progress, this);
     440                    msgCenter().cannotUninstallExtPack(progress, strSelectedPackageName, this);
    448441            }
    449442            else
    450                 msgCenter().cannotUninstallExtPack(strSelectedPackageName, manager, progress, this);
     443                msgCenter().cannotUninstallExtPack(manager, strSelectedPackageName, this);
    451444        }
    452445    }
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