VirtualBox

Changeset 34068 in vbox for trunk


Ignore:
Timestamp:
Nov 15, 2010 3:26:55 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67756
Message:

FE/Qt: 5356: Register/unregister VM in GUI: Initial implementation.

File:
1 edited

Legend:

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

    r33703 r34068  
    632632}
    633633
     634void VBoxProblemReporter::cannotOpenMachine(QWidget *pParent, const QString &strMachinePath, const CVirtualBox &vbox)
     635{
     636    message(pParent ? pParent : mainWindowShown(),
     637            Error,
     638            tr("Failed to open a virtual machine located in %1.")
     639               .arg(strMachinePath),
     640            formatErrorInfo(vbox));
     641}
     642
     643void VBoxProblemReporter::cannotReregisterMachine(QWidget *pParent, const QString &strMachinePath, const QString &strMachineName)
     644{
     645    message(pParent ? pParent : mainWindowShown(),
     646            Error,
     647            tr("Failed to add a virtual machine <b>%1</b> located in <i>%2</i> because its already present.")
     648               .arg(strMachineName).arg(strMachinePath));
     649}
     650
    634651void VBoxProblemReporter::
    635652cannotApplyMachineSettings (const CMachine &machine, const COMResult &res)
     
    10771094int VBoxProblemReporter::confirmMachineDeletion(const CMachine &machine)
    10781095{
    1079     QString msg;
    1080     QString button;
    1081     QString name;
    1082 
    10831096    if (machine.GetAccessible())
    10841097    {
    10851098        int cDisks = 0;
    1086         const QVector<CMediumAttachment> &mediums = machine.GetMediumAttachments();
    1087         for (int i=0; i < mediums.size(); ++i)
     1099        const CMediumAttachmentVector &attachments = machine.GetMediumAttachments();
     1100        for (int i = 0; i < attachments.size(); ++i)
    10881101        {
    1089             const CMediumAttachment &m = mediums.at(i);
    1090             /* Check if the medium is a harddisk */
    1091             if (m.GetType() == KDeviceType_HardDisk)
     1102            const CMediumAttachment &attachment = attachments.at(i);
     1103            /* Check if the medium is a harddisk: */
     1104            if (attachment.GetType() == KDeviceType_HardDisk)
    10921105            {
    1093                 /* Check if the disk isn't shared. If the disk is shared, it
    1094                  * will be *never* deleted. */
    1095                 QVector <QString> ids = m.GetMedium().GetMachineIds();
     1106                /* Check if the disk isn't shared.
     1107                 * If the disk is shared, it will be *never* deleted. */
     1108                QVector<QString> ids = attachment.GetMedium().GetMachineIds();
    10961109                if (ids.size() == 1)
    10971110                    ++cDisks;
    10981111            }
    10991112        }
    1100         const QString strDeleteBtn = tr("Delete", "machine");
    1101         const QString strDeleteAllBtn = tr("Delete All", "machine");
    1102         const QString strKeepHarddisksBtn = tr("Keep Harddisks", "machine");
    1103         const QString strText  = tr("<p>Are you sure you want to permanently delete the virtual "
    1104                                     "machine <b>%1</b>?</p>"
    1105                                     "<p>This operation <i>cannot</i> be undone.</p>")
     1113        const QString strBase = tr("<p>You are about to remove the virtual machine <b>%1</b> from the machine list.</p>"
     1114                                   "<p>Would you like to remove it from your hard disk as well?</p>")
    11061115                                   .arg(machine.GetName());
    1107         const QString strText1 = tr("<p>If you select <b>%1</b> both the machine itself and the "
    1108                                     "virtual disks attached to it will be removed. If you wish "
    1109                                     "to preserve the virtual disks for later use, select "
    1110                                     "<b>%2</b>.</p>")
    1111                                    .arg(strDeleteAllBtn)
    1112                                    .arg(strKeepHarddisksBtn);
    1113         if (cDisks == 0)
    1114             return message(&vboxGlobal().selectorWnd(), Question,
    1115                            strText,
    1116                            0, /* aAutoConfirmId */
    1117                            QIMessageBox::Yes,
    1118                            QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default,
    1119                            0,
    1120                            strDeleteBtn);
    1121         else if (cDisks == 1)
    1122             return message(&vboxGlobal().selectorWnd(), Question,
    1123                            strText + strText1,
    1124                            0, /* aAutoConfirmId */
    1125                            QIMessageBox::No,
    1126                            QIMessageBox::Yes,
    1127                            QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default,
    1128                            strKeepHarddisksBtn,
    1129                            strDeleteAllBtn);
    1130         else
    1131             return message(&vboxGlobal().selectorWnd(), Question,
    1132                            strText +
    1133                            tr("<p>You have more than one virtual disk attached. Please make sure "
    1134                               "that you do not need any of them before continuing.</p>") +
    1135                            strText1,
    1136                            0, /* aAutoConfirmId */
    1137                            QIMessageBox::No,
    1138                            QIMessageBox::Yes,
    1139                            QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default,
    1140                            strKeepHarddisksBtn,
    1141                            strDeleteAllBtn);
     1116        const QString strExtd = tr("<p>You are about to remove the virtual machine <b>%1</b> from the machine list.</p>"
     1117                                   "<p>Would you like to remove it from your hard disk as well? "
     1118                                   "Doing this will also remove the files containing the machine's virtual hard disks.</p>")
     1119                                   .arg(machine.GetName());
     1120        return message(&vboxGlobal().selectorWnd(),
     1121                       Question,
     1122                       cDisks == 0 ? strBase : strExtd,
     1123                       0, /* auto-confirm id */
     1124                       QIMessageBox::Yes,
     1125                       QIMessageBox::No,
     1126                       QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default);
    11421127    }
    11431128    else
    11441129    {
    1145         /* this should be in sync with UIVMListBoxItem::recache() */
    1146         QFileInfo fi (machine.GetSettingsFilePath());
    1147         name = fi.suffix().toLower() == "xml" ?
    1148                fi.completeBaseName() : fi.fileName();
    1149         msg = tr ("<p>Are you sure you want to unregister the inaccessible "
    1150                   "virtual machine <b>%1</b>?</p>"
    1151                   "<p>You will not be able to register it again from "
    1152                   "GUI.</p>")
    1153                   .arg (name);
    1154         button = tr ("Unregister", "machine");
    1155     }
    1156 
    1157     return messageOkCancel (&vboxGlobal().selectorWnd(), Question, msg,
    1158                             0 /* aAutoConfirmId */, button);
     1130        /* This should be in sync with UIVMListBoxItem::recache(): */
     1131        QFileInfo fi(machine.GetSettingsFilePath());
     1132        const QString strName = fi.suffix().toLower() == "xml" ? fi.completeBaseName() : fi.fileName();
     1133        const QString strBase = tr("You are about to remove the inaccessible virtual machine "
     1134                                   "<b>%1</b> from the machine list. Do you wish to proceed?")
     1135                                   .arg(strName);
     1136        return message(&vboxGlobal().selectorWnd(),
     1137                       Question,
     1138                       strBase,
     1139                       0, /* auto-confirm id */
     1140                       QIMessageBox::Ok,
     1141                       QIMessageBox::Cancel | QIMessageBox::Escape | QIMessageBox::Default);
     1142    }
    11591143}
    11601144
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette