VirtualBox

Changeset 45292 in vbox for trunk/src


Ignore:
Timestamp:
Apr 2, 2013 4:39:35 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Message-center cleanup (part 19): Medium related stuff.

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

Legend:

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

    r44529 r45292  
    9292    {
    9393        /* Show error message: */
    94         msgCenter().cannotChangeMediumType(this, m_medium, m_oldMediumType, m_newMediumType);
     94        msgCenter().cannotChangeMediumType(m_medium, m_oldMediumType, m_newMediumType, this);
    9595        return;
    9696    }
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r45289 r45292  
    927927}
    928928
    929 void UIMessageCenter::cannotChangeMediumType(QWidget *pParent,
    930                                              const CMedium &medium,
    931                                              KMediumType oldMediumType,
    932                                              KMediumType newMediumType)
     929void UIMessageCenter::cannotChangeMediumType(const CMedium &medium, KMediumType oldMediumType, KMediumType newMediumType,
     930                                             QWidget *pParent /*= 0*/)
    933931{
    934932    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
    935933            tr("<p>Error changing medium type from <b>%1</b> to <b>%2</b>.</p>")
    936                 .arg(gpConverter->toString(oldMediumType)).arg(gpConverter->toString(newMediumType)),
     934               .arg(gpConverter->toString(oldMediumType)).arg(gpConverter->toString(newMediumType)),
    937935            formatErrorInfo(medium));
    938936}
    939937
    940 bool UIMessageCenter::confirmReleaseMedium(QWidget *pParent,
    941                                            const UIMedium &aMedium,
    942                                            const QString &strUsage)
    943 {
    944     /** @todo (translation-related): the gender of "the" in translations
    945      * will depend on the gender of aMedium.type(). */
    946     return messageOkCancel(pParent, MessageType_Question,
    947         tr("<p>Are you sure you want to release the %1 "
    948             "<nobr><b>%2</b></nobr>?</p>"
    949             "<p>This will detach it from the "
    950             "following virtual machine(s): <b>%3</b>.</p>")
    951             .arg(mediumToAccusative(aMedium.type()))
    952             .arg(aMedium.location())
    953             .arg(strUsage),
    954         0 /* auto-confirm id */,
    955         tr("Release", "detach medium"));
    956 }
    957 
    958 bool UIMessageCenter::confirmRemoveMedium(QWidget *pParent,
    959                                           const UIMedium &aMedium)
    960 {
    961     /** @todo (translation-related): the gender of "the" in translations
    962      * will depend on the gender of aMedium.type(). */
    963     QString msg =
    964         tr("<p>Are you sure you want to remove the %1 "
    965            "<nobr><b>%2</b></nobr> from the list of known media?</p>")
    966             .arg(mediumToAccusative(aMedium.type()))
    967             .arg(aMedium.location());
    968 
    969     qulonglong caps = 0;
    970     QVector<KMediumFormatCapabilities> capabilities;
    971     capabilities = aMedium.medium().GetMediumFormat().GetCapabilities();
    972     for (int i = 0; i < capabilities.size(); i++)
    973         caps |= capabilities[i];
    974 
    975     if (aMedium.type() == UIMediumType_HardDisk &&
    976         caps & MediumFormatCapabilities_File)
    977     {
    978         if (aMedium.state() == KMediumState_Inaccessible)
    979             msg +=
    980                 tr("Note that as this hard disk is inaccessible its "
    981                    "storage unit cannot be deleted right now.");
    982         else
    983             msg +=
    984                 tr("The next dialog will let you choose whether you also "
    985                    "want to delete the storage unit of this hard disk or "
    986                    "keep it for later usage.");
    987     }
    988     else
    989         msg +=
    990             tr("<p>Note that the storage unit of this medium will not be "
    991                "deleted and that it will be possible to use it later again.</p>");
    992 
    993     return messageOkCancel(pParent, MessageType_Question, msg,
    994         "confirmRemoveMedium" /* auto-confirm id */,
    995         tr("Remove", "medium"));
    996 }
    997 
    998 int UIMessageCenter::confirmDeleteHardDiskStorage(QWidget *pParent, const QString &strLocation)
    999 {
    1000     return message(pParent, MessageType_Question,
    1001         tr("<p>Do you want to delete the storage unit of the hard disk "
    1002            "<nobr><b>%1</b></nobr>?</p>"
    1003            "<p>If you select <b>Delete</b> then the specified storage unit "
    1004            "will be permanently deleted. This operation <b>cannot be "
    1005            "undone</b>.</p>"
    1006            "<p>If you select <b>Keep</b> then the hard disk will be only "
    1007            "removed from the list of known hard disks, but the storage unit "
    1008            "will be left untouched which makes it possible to add this hard "
    1009            "disk to the list later again.</p>")
    1010         .arg(strLocation),
    1011         0 /* auto-confirm id */,
    1012         QIMessageBox::Yes,
    1013         QIMessageBox::No | QIMessageBox::Default,
    1014         QIMessageBox::Cancel | QIMessageBox::Escape,
    1015         tr("Delete", "hard disk storage"),
    1016         tr("Keep", "hard disk storage"));
    1017 }
    1018 
    1019 void UIMessageCenter::cannotDeleteHardDiskStorage(QWidget *pParent,
    1020                                                   const CMedium &medium,
    1021                                                   const CProgress &progress)
    1022 {
    1023     /* below, we use CMedium (medium) to preserve current error info
    1024      * for formatErrorInfo() */
    1025 
    1026     message(pParent, MessageType_Error,
    1027         tr("Failed to delete the storage unit of the hard disk <b>%1</b>.")
    1028         .arg(CMedium(medium).GetLocation()),
    1029         !medium.isOk() ? formatErrorInfo(medium) :
    1030         !progress.isOk() ? formatErrorInfo(progress) :
    1031         formatErrorInfo(progress.GetErrorInfo()));
    1032 }
    1033 
    1034 void UIMessageCenter::cannotDetachDevice(QWidget *pParent,
    1035                                          const CMachine &machine,
    1036                                          UIMediumType type,
    1037                                          const QString &strLocation,
    1038                                          const StorageSlot &storageSlot)
    1039 {
     938bool UIMessageCenter::confirmMediumRelease(const UIMedium &medium, const QString &strUsage, QWidget *pParent /*= 0*/)
     939{
     940    /* Prepare the message: */
     941    QString strMessage;
     942    switch (medium.type())
     943    {
     944        case UIMediumType_HardDisk:
     945        {
     946            strMessage = tr("<p>Are you sure you want to release the virtual hard disk <nobr><b>%1</b></nobr>?</p>"
     947                            "<p>This will detach it from the following virtual machine(s): <b>%2</b>.</p>");
     948            break;
     949        }
     950        case UIMediumType_DVD:
     951        {
     952            strMessage = tr("<p>Are you sure you want to release the virtual optical disk <nobr><b>%1</b></nobr>?</p>"
     953                            "<p>This will detach it from the following virtual machine(s): <b>%2</b>.</p>");
     954            break;
     955        }
     956        case UIMediumType_Floppy:
     957        {
     958            strMessage = tr("<p>Are you sure you want to release the virtual floppy disk <nobr><b>%1</b></nobr>?</p>"
     959                            "<p>This will detach it from the following virtual machine(s): <b>%2</b>.</p>");
     960            break;
     961        }
     962        default:
     963            break;
     964    }
     965    /* Show the message: */
     966    return messageOkCancel(pParent ? pParent : mainWindowShown(), MessageType_Question,
     967                           strMessage.arg(medium.location(), strUsage),
     968                           0 /* auto-confirm id */, tr("Release", "detach medium"));
     969}
     970
     971bool UIMessageCenter::confirmMediumRemoval(const UIMedium &medium, QWidget *pParent /*= 0*/)
     972{
     973    /* Prepare the message: */
     974    QString strMessage;
     975    switch (medium.type())
     976    {
     977        case UIMediumType_HardDisk:
     978        {
     979            strMessage = tr("<p>Are you sure you want to remove the virtual hard disk "
     980                            "<nobr><b>%1</b></nobr> from the list of known media?</p>");
     981            /* Compose capabilities flag: */
     982            qulonglong caps = 0;
     983            QVector<KMediumFormatCapabilities> capabilities;
     984            capabilities = medium.medium().GetMediumFormat().GetCapabilities();
     985            for (int i = 0; i < capabilities.size(); ++i)
     986                caps |= capabilities[i];
     987            /* Check capabilities for additional options: */
     988            if (caps & MediumFormatCapabilities_File)
     989            {
     990                if (medium.state() == KMediumState_Inaccessible)
     991                    strMessage += tr("<p>Note that as this hard disk is inaccessible its "
     992                                     "storage unit cannot be deleted right now.</p>");
     993            }
     994            break;
     995        }
     996        case UIMediumType_DVD:
     997        {
     998            strMessage = tr("<p>Are you sure you want to remove the virtual optical disk "
     999                            "<nobr><b>%1</b></nobr> from the list of known media?</p>");
     1000            strMessage += tr("<p>Note that the storage unit of this medium will not be "
     1001                             "deleted and that it will be possible to use it later again.</p>");
     1002            break;
     1003        }
     1004        case UIMediumType_Floppy:
     1005        {
     1006            strMessage = tr("<p>Are you sure you want to remove the virtual floppy disk "
     1007                            "<nobr><b>%1</b></nobr> from the list of known media?</p>");
     1008            strMessage += tr("<p>Note that the storage unit of this medium will not be "
     1009                             "deleted and that it will be possible to use it later again.</p>");
     1010            break;
     1011        }
     1012        default:
     1013            break;
     1014    }
     1015    /* Show the message: */
     1016    return messageOkCancel(pParent ? pParent : mainWindowShown(), MessageType_Question,
     1017                           strMessage.arg(medium.location()),
     1018                           "confirmMediumRemoval" /* auto-confirm id */, tr("Remove", "medium"));
     1019}
     1020
     1021int UIMessageCenter::confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent /*= 0*/)
     1022{
     1023    return message(pParent ? pParent : mainWindowShown(), MessageType_Question,
     1024                   tr("<p>Do you want to delete the storage unit of the hard disk "
     1025                      "<nobr><b>%1</b></nobr>?</p>"
     1026                      "<p>If you select <b>Delete</b> then the specified storage unit "
     1027                      "will be permanently deleted. This operation <b>cannot be "
     1028                      "undone</b>.</p>"
     1029                      "<p>If you select <b>Keep</b> then the hard disk will be only "
     1030                      "removed from the list of known hard disks, but the storage unit "
     1031                      "will be left untouched which makes it possible to add this hard "
     1032                      "disk to the list later again.</p>")
     1033                      .arg(strLocation),
     1034                   0 /* auto-confirm id */,
     1035                   QIMessageBox::Yes,
     1036                   QIMessageBox::No | QIMessageBox::Default,
     1037                   QIMessageBox::Cancel | QIMessageBox::Escape,
     1038                   tr("Delete", "hard disk storage"),
     1039                   tr("Keep", "hard disk storage"));
     1040}
     1041
     1042void UIMessageCenter::cannotDeleteHardDiskStorage(const CMedium &medium, const CProgress &progress, QWidget *pParent /*= 0*/)
     1043{
     1044    /* Preserve error-info: */
     1045    QString strErrorInfo = !medium.isOk() ? formatErrorInfo(medium) :
     1046                           !progress.isOk() ? formatErrorInfo(progress) :
     1047                           formatErrorInfo(progress.GetErrorInfo());
     1048    /* Show the message: */
     1049    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     1050            tr("Failed to delete the storage unit of the hard disk <b>%1</b>.")
     1051               .arg(medium.GetLocation()),
     1052            strErrorInfo);
     1053}
     1054
     1055void UIMessageCenter::cannotDetachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent /*= 0*/)
     1056{
     1057    /* Preserve error-info: */
     1058    QString strErrorInfo = formatErrorInfo(machine);
     1059    /* Prepare the message: */
    10401060    QString strMessage;
    10411061    switch (type)
     
    10441064        {
    10451065            strMessage = tr("Failed to detach the hard disk (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
    1046                            .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
     1066                            .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(machine.GetName());
    10471067            break;
    10481068        }
     
    10501070        {
    10511071            strMessage = tr("Failed to detach the CD/DVD device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
    1052                            .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
     1072                            .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(machine.GetName());
    10531073            break;
    10541074        }
     
    10561076        {
    10571077            strMessage = tr("Failed to detach the floppy device (<nobr><b>%1</b></nobr>) from the slot <i>%2</i> of the machine <b>%3</b>.")
    1058                            .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());
     1078                            .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(machine.GetName());
    10591079            break;
    10601080        }
     
    10621082            break;
    10631083    }
    1064     message(pParent ? pParent : mainWindowShown(), MessageType_Error, strMessage, formatErrorInfo(machine));
    1065 }
    1066 
    1067 int UIMessageCenter::cannotRemountMedium(QWidget *pParent,
    1068                                          const CMachine &machine,
    1069                                          const UIMedium &aMedium,
    1070                                          bool fMount,
    1071                                          bool fRetry)
    1072 {
    1073     /** @todo (translation-related): the gender of "the" in translations
    1074      * will depend on the gender of aMedium.type(). */
    1075     QString text;
    1076     if (fMount)
    1077     {
    1078         text = tr("Unable to mount the %1 <nobr><b>%2</b></nobr> on the machine <b>%3</b>.");
    1079         if (fRetry) text += tr(" Would you like to force mounting of this medium?");
    1080     }
    1081     else
    1082     {
    1083         text = tr("Unable to unmount the %1 <nobr><b>%2</b></nobr> from the machine <b>%3</b>.");
    1084         if (fRetry) text += tr(" Would you like to force unmounting of this medium?");
    1085     }
     1084    /* Show the message: */
     1085    message(pParent ? pParent : mainWindowShown(), MessageType_Error, strMessage, strErrorInfo);
     1086}
     1087
     1088int UIMessageCenter::cannotRemountMedium(const CMachine &machine, const UIMedium &medium, bool fMount, bool fRetry, QWidget *pParent /*= 0*/)
     1089{
     1090    /* Preserve error-info: */
     1091    QString strErrorInfo = formatErrorInfo(machine);
     1092    /* Compose the message: */
     1093    QString strMessage;
     1094    switch (medium.type())
     1095    {
     1096        case UIMediumType_DVD:
     1097        {
     1098            if (fMount)
     1099            {
     1100                strMessage = tr("<p>Unable to mount the virtual optical disk <nobr><b>%1</b></nobr> on the machine <b>%2</b>.</p>");
     1101                if (fRetry)
     1102                    strMessage += tr("<p>Would you like to try force mounting of this medium?</p>");
     1103            }
     1104            else
     1105            {
     1106                strMessage = tr("<p>Unable to unmount the virtual optical disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p>");
     1107                if (fRetry)
     1108                    strMessage += tr("<p>Would you like to try force unmounting of this medium?</p>");
     1109            }
     1110            break;
     1111        }
     1112        case UIMediumType_Floppy:
     1113        {
     1114            if (fMount)
     1115            {
     1116                strMessage = tr("<p>Unable to mount the virtual floppy disk <nobr><b>%1</b></nobr> on the machine <b>%2</b>.</p>");
     1117                if (fRetry)
     1118                    strMessage += tr("<p>Would you like to try force mounting of this medium?</p>");
     1119            }
     1120            else
     1121            {
     1122                strMessage = tr("<p>Unable to unmount the virtual floppy disk <nobr><b>%1</b></nobr> from the machine <b>%2</b>.</p>");
     1123                if (fRetry)
     1124                    strMessage += tr("<p>Would you like to try force unmounting of this medium?</p>");
     1125            }
     1126            break;
     1127        }
     1128        default:
     1129            break;
     1130    }
     1131    /* Show the messsage: */
    10861132    if (fRetry)
    1087     {
    1088         return messageOkCancel(pParent ? pParent : mainWindowShown(), MessageType_Question, text
    1089             .arg(mediumToAccusative(aMedium.type(), aMedium.isHostDrive()))
    1090             .arg(aMedium.isHostDrive() ? aMedium.name() : aMedium.location())
    1091             .arg(CMachine(machine).GetName()),
    1092             formatErrorInfo(machine),
    1093             0 /* Auto Confirm ID */,
    1094             tr("Force Unmount"));
    1095     }
    1096     else
    1097     {
    1098         return message(pParent ? pParent : mainWindowShown(), MessageType_Error, text
    1099             .arg(mediumToAccusative(aMedium.type(), aMedium.isHostDrive()))
    1100             .arg(aMedium.isHostDrive() ? aMedium.name() : aMedium.location())
    1101             .arg(CMachine(machine).GetName()),
    1102             formatErrorInfo(machine));
    1103     }
    1104 }
    1105 
    1106 void UIMessageCenter::cannotOpenMedium(QWidget *pParent,
    1107                                        const CVirtualBox &vbox,
    1108                                        UIMediumType type,
    1109                                        const QString &strLocation)
    1110 {
    1111     /** @todo (translation-related): the gender of "the" in translations
    1112      * will depend on the gender of aMedium.type(). */
     1133        return messageOkCancel(pParent ? pParent : mainWindowShown(), MessageType_Question,
     1134                               strMessage.arg(medium.isHostDrive() ? medium.name() : medium.location()).arg(machine.GetName()),
     1135                               strErrorInfo,
     1136                               0 /* Auto Confirm ID */,
     1137                               tr("Force Unmount"));
     1138    return message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     1139                   strMessage.arg(medium.isHostDrive() ? medium.name() : medium.location()).arg(machine.GetName()),
     1140                   strErrorInfo);
     1141}
     1142
     1143void UIMessageCenter::cannotOpenMedium(const CVirtualBox &vbox, UIMediumType type, const QString &strLocation, QWidget *pParent /*= 0*/)
     1144{
     1145    /* Prepare the message: */
     1146    QString strMessage;
     1147    switch (type)
     1148    {
     1149        case UIMediumType_HardDisk:
     1150        {
     1151            strMessage = tr("Failed to open the hard disk file <nobr><b>%1</b></nobr>.");
     1152            break;
     1153        }
     1154        case UIMediumType_DVD:
     1155        {
     1156            strMessage = tr("Failed to open the optical disk file <nobr><b>%1</b></nobr>.");
     1157            break;
     1158        }
     1159        case UIMediumType_Floppy:
     1160        {
     1161            strMessage = tr("Failed to open the floppy disk file <nobr><b>%1</b></nobr>.");
     1162            break;
     1163        }
     1164        default:
     1165            break;
     1166    }
     1167    /* Show the message: */
    11131168    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
    1114         tr("Failed to open the %1 <nobr><b>%2</b></nobr>.")
    1115             .arg(mediumToAccusative(type))
    1116             .arg(strLocation),
    1117         formatErrorInfo(vbox));
    1118 }
    1119 
    1120 void UIMessageCenter::cannotCloseMedium(QWidget *pParent,
    1121                                         const UIMedium &aMedium,
    1122                                         const COMResult &rc)
    1123 {
    1124     /** @todo (translation-related): the gender of "the" in translations
    1125      * will depend on the gender of aMedium.type(). */
    1126     message(pParent, MessageType_Error,
    1127         tr("Failed to close the %1 <nobr><b>%2</b></nobr>.")
    1128             .arg(mediumToAccusative(aMedium.type()))
    1129             .arg(aMedium.location()),
    1130         formatErrorInfo(rc));
     1169            strMessage.arg(strLocation), formatErrorInfo(vbox));
     1170}
     1171
     1172void UIMessageCenter::cannotCloseMedium(const UIMedium &medium, const COMResult &rc, QWidget *pParent /*= 0*/)
     1173{
     1174    /* Prepare the message: */
     1175    QString strMessage;
     1176    switch (medium.type())
     1177    {
     1178        case UIMediumType_HardDisk:
     1179        {
     1180            strMessage = tr("Failed to close the hard disk file <nobr><b>%2</b></nobr>.");
     1181            break;
     1182        }
     1183        case UIMediumType_DVD:
     1184        {
     1185            strMessage = tr("Failed to close the optical disk file <nobr><b>%2</b></nobr>.");
     1186            break;
     1187        }
     1188        case UIMediumType_Floppy:
     1189        {
     1190            strMessage = tr("Failed to close the floppy disk file <nobr><b>%2</b></nobr>.");
     1191            break;
     1192        }
     1193        default:
     1194            break;
     1195    }
     1196    /* Show the message: */
     1197    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     1198            strMessage.arg(medium.location()), formatErrorInfo(rc));
    11311199}
    11321200
     
    23972465
    23982466/* static */
    2399 QString UIMessageCenter::mediumToAccusative(UIMediumType type, bool fIsHostDrive /* = false */)
    2400 {
    2401     QString strType =
    2402         type == UIMediumType_HardDisk ?
    2403             tr("hard disk", "failed to mount ...") :
    2404         type == UIMediumType_DVD && fIsHostDrive ?
    2405             tr("CD/DVD", "failed to mount ... host-drive") :
    2406         type == UIMediumType_DVD && !fIsHostDrive ?
    2407             tr("CD/DVD image", "failed to mount ...") :
    2408         type == UIMediumType_Floppy && fIsHostDrive ?
    2409             tr("floppy", "failed to mount ... host-drive") :
    2410         type == UIMediumType_Floppy && !fIsHostDrive ?
    2411             tr("floppy image", "failed to mount ...") :
    2412         QString();
    2413 
    2414     Assert(!strType.isNull());
    2415     return strType;
    2416 }
    2417 
    2418 /* static */
    24192467QString UIMessageCenter::formatRC(HRESULT rc)
    24202468{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r45289 r45292  
    255255
    256256    /* API: Virtual Medium Manager warnings: */
    257     void cannotChangeMediumType(QWidget *pParent, const CMedium &medium, KMediumType oldMediumType, KMediumType newMediumType);
    258     bool confirmReleaseMedium(QWidget *pParent, const UIMedium &aMedium,
    259                               const QString &strUsage);
    260     bool confirmRemoveMedium(QWidget *pParent, const UIMedium &aMedium);
    261     int confirmDeleteHardDiskStorage(QWidget *pParent,
    262                                      const QString &strLocation);
    263     void cannotDeleteHardDiskStorage(QWidget *pParent, const CMedium &medium,
    264                                      const CProgress &progress);
    265     void cannotDetachDevice(QWidget *pParent, const CMachine &machine,
    266                             UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot);
    267     int cannotRemountMedium(QWidget *pParent, const CMachine &machine, const UIMedium &aMedium, bool fMount, bool fRetry);
    268     void cannotOpenMedium(QWidget *pParent, const CVirtualBox &vbox,
    269                           UIMediumType type, const QString &strLocation);
    270     void cannotCloseMedium(QWidget *pParent, const UIMedium &aMedium,
    271                            const COMResult &rc);
     257    void cannotChangeMediumType(const CMedium &medium, KMediumType oldMediumType, KMediumType newMediumType, QWidget *pParent = 0);
     258    bool confirmMediumRelease(const UIMedium &medium, const QString &strUsage, QWidget *pParent = 0);
     259    bool confirmMediumRemoval(const UIMedium &medium, QWidget *pParent = 0);
     260    int confirmDeleteHardDiskStorage(const QString &strLocation, QWidget *pParent = 0);
     261    void cannotDeleteHardDiskStorage(const CMedium &medium, const CProgress &progress, QWidget *pParent = 0);
     262    void cannotDetachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0);
     263    int cannotRemountMedium(const CMachine &machine, const UIMedium &medium, bool fMount, bool fRetry, QWidget *pParent = 0);
     264    void cannotOpenMedium(const CVirtualBox &vbox, UIMediumType type, const QString &strLocation, QWidget *pParent = 0);
     265    void cannotCloseMedium(const UIMedium &medium, const COMResult &rc, QWidget *pParent = 0);
    272266
    273267    /* API: Wizards warnings: */
     
    374368    bool askForOverridingFilesIfExists(const QVector<QString> &strPaths, QWidget *pParent = 0);
    375369
    376     /* Helpers: */
    377     static QString mediumToAccusative(UIMediumType type, bool fIsHostDrive = false);
    378 
    379370    static QString formatRC(HRESULT rc);
    380371    static QString formatErrorInfo(const COMErrorInfo &info, HRESULT wrapperRC = S_OK);
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r45275 r45292  
    22862286    }
    22872287    else
    2288         msgCenter().cannotOpenMedium(pParent, vbox, mediumType, strMediumLocation);
     2288        msgCenter().cannotOpenMedium(vbox, mediumType, strMediumLocation, pParent);
    22892289
    22902290    return QString();
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumManager.cpp

    r45290 r45292  
    11321132    UIMediumType type = item->type();
    11331133
    1134     if (!msgCenter().confirmRemoveMedium (this, item->medium()))
     1134    /* Confirm medium removal: */
     1135    if (!msgCenter().confirmMediumRemoval(item->medium(), this))
    11351136        return;
    11361137
     
    11431144            bool deleteStorage = false;
    11441145
    1145             /* We don't want to try to delete inaccessible storage as it will
    1146              * most likely fail. Note that
    1147              * UIMessageCenter::confirmRemoveMedium() is aware of that and
    1148              * will give a corresponding hint. Therefore, once the code is
    1149              * changed below, the hint should be re-checked for validity. */
     1146            /* We don't want to try to delete inaccessible storage as it will most likely fail.
     1147             * Note that UIMessageCenter::confirmMediumRemoval() is aware of that and
     1148             * will give a corresponding hint. Therefore, once the code is changed below,
     1149             * the hint should be re-checked for validity. */
    11501150
    11511151            qulonglong caps = 0;
     
    11581158                caps & MediumFormatCapabilities_File)
    11591159            {
    1160                 int rc = msgCenter().
    1161                     confirmDeleteHardDiskStorage (this, item->location());
     1160                int rc = msgCenter().confirmDeleteHardDiskStorage(item->location(), this);
    11621161                if (rc == QIMessageBox::Cancel)
    11631162                    return;
     
    11751174                    if (!(progress.isOk() && progress.GetResultCode() == S_OK))
    11761175                    {
    1177                         msgCenter().cannotDeleteHardDiskStorage(this, hardDisk, progress);
     1176                        msgCenter().cannotDeleteHardDiskStorage(hardDisk, progress, this);
    11781177                        return;
    11791178                    }
     
    12041203
    12051204    if (result.isOk())
    1206         vboxGlobal().removeMedium (type, id);
     1205        vboxGlobal().removeMedium(type, id);
    12071206    else
    1208         msgCenter().cannotCloseMedium (this, item->medium(), result);
     1207        msgCenter().cannotCloseMedium(item->medium(), result, this);
    12091208}
    12101209
     
    12471246    AssertReturnVoid (machines.size() > 0);
    12481247
    1249     if (!msgCenter().confirmReleaseMedium (this, item->medium(), usage))
     1248    if (!msgCenter().confirmMediumRelease(item->medium(), usage, this))
    12501249        return;
    12511250
     
    13001299                    {
    13011300                        CStorageController controller = machine.GetStorageControllerByName (attachment.GetController());
    1302                         msgCenter().cannotDetachDevice (this, machine, UIMediumType_HardDisk, aMedium.location(),
    1303                                                           StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice()));
     1301                        msgCenter().cannotDetachDevice(machine, UIMediumType_HardDisk, aMedium.location(),
     1302                                                       StorageSlot(controller.GetBus(), attachment.GetPort(), attachment.GetDevice()), this);
    13041303                        success = false;
    13051304                        break;
     
    13221321                    if (!machine.isOk())
    13231322                    {
    1324                         msgCenter().cannotRemountMedium (this, machine, aMedium, false /* mount? */, false /* retry? */);
     1323                        msgCenter().cannotRemountMedium(machine, aMedium, false /* mount? */, false /* retry? */, this);
    13251324                        success = false;
    13261325                        break;
     
    13431342                    if (!machine.isOk())
    13441343                    {
    1345                         msgCenter().cannotRemountMedium (this, machine, aMedium, false /* mount? */, false /* retry? */);
     1344                        msgCenter().cannotRemountMedium(machine, aMedium, false /* mount? */, false /* retry? */, this);
    13461345                        success = false;
    13471346                        break;
     
    16451644
    16461645    if (!mVBox.isOk())
    1647         msgCenter().cannotOpenMedium(this, mVBox, aType, aLocation);
     1646        msgCenter().cannotOpenMedium(mVBox, aType, aLocation, this);
    16481647    else
    16491648        vboxGlobal().addMedium(medium);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r45274 r45292  
    14921492    {
    14931493        /* Ask for force remounting: */
    1494         if (msgCenter().cannotRemountMedium(0, machine, vboxGlobal().findMedium (fMount ? newId : currentId), fMount, true /* retry? */) == QIMessageBox::Ok)
     1494        if (msgCenter().cannotRemountMedium(machine, vboxGlobal().findMedium(fMount ? newId : currentId),
     1495                                            fMount, true /* retry? */, activeMachineWindow()) == QIMessageBox::Ok)
    14951496        {
    14961497            /* Force remount medium to the predefined port/device: */
     
    14991500                fWasMounted = true;
    15001501            else
    1501                 msgCenter().cannotRemountMedium(0, machine, vboxGlobal().findMedium (fMount ? newId : currentId), fMount, false /* retry? */);
     1502                msgCenter().cannotRemountMedium(machine, vboxGlobal().findMedium(fMount ? newId : currentId),
     1503                                                fMount, false /* retry? */, activeMachineWindow());
    15021504        }
    15031505    }
     
    15511553        {
    15521554            /* Ask for force remounting: */
    1553             if (msgCenter().cannotRemountMedium(0, machine, vboxGlobal().findMedium(fMount ? strNewId : strCurrentId), fMount, true /* retry? */) == QIMessageBox::Ok)
     1555            if (msgCenter().cannotRemountMedium(machine, vboxGlobal().findMedium(fMount ? strNewId : strCurrentId),
     1556                                                fMount, true /* retry? */, activeMachineWindow()) == QIMessageBox::Ok)
    15541557            {
    15551558                /* Force remount medium to the predefined port/device: */
     
    15581561                    fWasMounted = true;
    15591562                else
    1560                     msgCenter().cannotRemountMedium(0, machine, vboxGlobal().findMedium(fMount ? strNewId : strCurrentId), fMount, false /* retry? */);
     1563                    msgCenter().cannotRemountMedium(machine, vboxGlobal().findMedium(fMount ? strNewId : strCurrentId),
     1564                                                    fMount, false /* retry? */, activeMachineWindow());
    15611565            }
    15621566        }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r45224 r45292  
    547547        if (!vbox.isOk())
    548548        {
    549             msgCenter().cannotOpenMedium(0, vbox, UIMediumType_DVD, strSource);
     549            msgCenter().cannotOpenMedium(vbox, UIMediumType_DVD, strSource, mainMachineWindow());
    550550            return;
    551551        }
     
    591591            {
    592592                /* Ask for force mounting: */
    593                 if (msgCenter().cannotRemountMedium(0, machine, vboxMedium, true /* mount? */, true /* retry? */) == QIMessageBox::Ok)
     593                if (msgCenter().cannotRemountMedium(machine, vboxMedium, true /* mount? */,
     594                                                    true /* retry? */, mainMachineWindow()) == QIMessageBox::Ok)
    594595                {
    595596                    /* Force mount medium to the predefined port/device: */
    596597                    machine.MountMedium(strCntName, iCntPort, iCntDevice, vboxMedium.medium(), true /* force */);
    597598                    if (!machine.isOk())
    598                         msgCenter().cannotRemountMedium(0, machine, vboxMedium, true /* mount? */, false /* retry? */);
     599                        msgCenter().cannotRemountMedium(machine, vboxMedium, true /* mount? */,
     600                                                        false /* retry? */, mainMachineWindow());
    599601                }
    600602            }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/firstrun/UIWizardFirstRun.cpp

    r42551 r45292  
    8282    else
    8383    {
    84         msgCenter().cannotRemountMedium(this, m_machine, vmedium, true /* mount? */, false /* retry? */);
     84        msgCenter().cannotRemountMedium(m_machine, vmedium, true /* mount? */, false /* retry? */, this);
    8585        return false;
    8686    }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVMPageBasic3.cpp

    r45193 r45292  
    121121        vboxGlobal().removeMedium(UIMediumType_HardDisk, strId);
    122122    else
    123         msgCenter().cannotDeleteHardDiskStorage(thisImp(), m_virtualDisk, progress);
     123        msgCenter().cannotDeleteHardDiskStorage(m_virtualDisk, progress, thisImp());
    124124
    125125    /* Detach virtual-disk finally: */
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