VirtualBox

Changeset 45316 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Apr 3, 2013 5:40:32 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Message-center cleanup (part 23): Wizards stuff.

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

Legend:

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

    r45315 r45316  
    11911191}
    11921192
    1193 void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent /* = 0 */)
    1194 {
    1195     message(
    1196         pParent ? pParent : mainWindowShown(),
    1197         MessageType_Error,
    1198         tr("Failed to create a new virtual machine."),
    1199         formatErrorInfo(vbox)
    1200     );
    1201 }
    1202 
    1203 void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox,
    1204                                           const CMachine &machine,
    1205                                           QWidget *pParent /* = 0 */)
    1206 {
    1207     message(
    1208         pParent ? pParent : mainWindowShown(),
    1209         MessageType_Error,
    1210         tr("Failed to create a new virtual machine <b>%1</b>.")
    1211             .arg(machine.GetName()),
    1212         formatErrorInfo(vbox)
    1213     );
    1214 }
    1215 
    1216 void UIMessageCenter::cannotRegisterMachine(const CVirtualBox &vbox,
    1217                                             const CMachine &machine,
    1218                                             QWidget *pParent)
    1219 {
    1220     message(pParent ? pParent : mainWindowShown(),
    1221             MessageType_Error,
     1193void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent /*= 0*/)
     1194{
     1195    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     1196            tr("Failed to create a new virtual machine."),
     1197            formatErrorInfo(vbox));
     1198}
     1199
     1200void UIMessageCenter::cannotRegisterMachine(const CVirtualBox &vbox, const QString &strMachineName, QWidget *pParent /*= 0*/)
     1201{
     1202    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
    12221203            tr("Failed to register the virtual machine <b>%1</b>.")
    1223             .arg(machine.GetName()),
     1204               .arg(strMachineName),
    12241205            formatErrorInfo(vbox));
    12251206}
    12261207
    1227 void UIMessageCenter::cannotCreateClone(const CMachine &machine,
    1228                                         QWidget *pParent /* = 0 */)
    1229 {
    1230     message(
    1231         pParent ? pParent : mainWindowShown(),
    1232         MessageType_Error,
    1233         tr("Failed to clone the virtual machine <b>%1</b>.")
    1234             .arg(machine.GetName()),
    1235         formatErrorInfo(machine)
    1236     );
    1237 }
    1238 
    1239 void UIMessageCenter::cannotCreateClone(const CMachine &machine,
    1240                                         const CProgress &progress,
    1241                                         QWidget *pParent /* = 0 */)
    1242 {
    1243     AssertWrapperOk(progress);
    1244 
    1245     message(pParent ? pParent : mainWindowShown(),
    1246         MessageType_Error,
    1247         tr("Failed to clone the virtual machine <b>%1</b>.")
    1248             .arg(machine.GetName()),
    1249         formatErrorInfo(progress.GetErrorInfo())
    1250     );
    1251 }
    1252 
    1253 void UIMessageCenter::cannotOverwriteHardDiskStorage(QWidget *pParent,
    1254                                                      const QString &strLocation)
    1255 {
    1256     message(pParent, MessageType_Info,
    1257         tr("<p>The hard disk storage unit at location <b>%1</b> already "
    1258            "exists. You cannot create a new virtual hard disk that uses this "
    1259            "location because it can be already used by another virtual hard "
    1260            "disk.</p>"
    1261            "<p>Please specify a different location.</p>")
    1262         .arg(strLocation));
    1263 }
    1264 
    1265 void UIMessageCenter::cannotCreateHardDiskStorage(QWidget *pParent,
    1266                                                   const CVirtualBox &vbox,
    1267                                                   const QString &strLocation,
    1268                                                   const CMedium &medium,
    1269                                                   const CProgress &progress)
    1270 {
    1271     message(pParent, MessageType_Error,
    1272         tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
    1273         .arg(strLocation),
    1274         !vbox.isOk() ? formatErrorInfo(vbox) :
    1275         !medium.isOk() ? formatErrorInfo(medium) :
    1276         !progress.isOk() ? formatErrorInfo(progress) :
    1277         formatErrorInfo(progress.GetErrorInfo()));
     1208void UIMessageCenter::cannotCreateClone(const CMachine &machine, QWidget *pParent /*= 0*/)
     1209{
     1210    /* Preserve error-info: */
     1211    QString strErrorInfo = formatErrorInfo(machine);
     1212    /* Show the message: */
     1213    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     1214            tr("Failed to clone the virtual machine <b>%1</b>.")
     1215               .arg(machine.GetName()),
     1216            strErrorInfo);
     1217}
     1218
     1219void UIMessageCenter::cannotCreateClone(const CProgress &progress, const QString &strMachineName, QWidget *pParent /* = 0 */)
     1220{
     1221    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     1222            tr("Failed to clone the virtual machine <b>%1</b>.")
     1223               .arg(strMachineName),
     1224            !progress.isOk() ? formatErrorInfo(progress) : formatErrorInfo(progress.GetErrorInfo()));
     1225}
     1226
     1227void UIMessageCenter::cannotOverwriteHardDiskStorage(const QString &strLocation, QWidget *pParent /*= 0*/)
     1228{
     1229    message(pParent ? pParent : mainWindowShown(), MessageType_Info,
     1230            tr("<p>The hard disk storage unit at location <b>%1</b> already exists. "
     1231               "You cannot create a new virtual hard disk that uses this location "
     1232               "because it can be already used by another virtual hard disk.</p>"
     1233               "<p>Please specify a different location.</p>")
     1234               .arg(strLocation));
     1235}
     1236
     1237void UIMessageCenter::cannotCreateHardDiskStorage(const CVirtualBox &vbox, const QString &strLocation, QWidget *pParent /*= 0*/)
     1238{
     1239    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     1240            tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
     1241               .arg(strLocation),
     1242            formatErrorInfo(vbox));
     1243}
     1244
     1245void UIMessageCenter::cannotCreateHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent /*= 0*/)
     1246{
     1247    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     1248            tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
     1249               .arg(strLocation),
     1250            formatErrorInfo(medium));
     1251}
     1252
     1253void UIMessageCenter::cannotCreateHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent /*= 0*/)
     1254{
     1255    message(pParent ? pParent : mainWindowShown(), MessageType_Error,
     1256            tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")
     1257               .arg(strLocation),
     1258            !progress.isOk() ? formatErrorInfo(progress) : formatErrorInfo(progress.GetErrorInfo()));
    12781259}
    12791260
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r45315 r45316  
    269269    /* API: Wizards warnings: */
    270270    void cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent = 0);
    271     void cannotCreateMachine(const CVirtualBox &vbox, const CMachine &machine, QWidget *pParent = 0);
    272     void cannotRegisterMachine(const CVirtualBox &vbox, const CMachine &machine, QWidget *pParent);
     271    void cannotRegisterMachine(const CVirtualBox &vbox, const QString &strMachineName, QWidget *pParent = 0);
    273272    void cannotCreateClone(const CMachine &machine, QWidget *pParent = 0);
    274     void cannotCreateClone(const CMachine &machine, const CProgress &progress, QWidget *pParent = 0);
    275     void cannotOverwriteHardDiskStorage(QWidget *pParent, const QString &strLocation);
    276     void cannotCreateHardDiskStorage(QWidget *pParent, const CVirtualBox &vbox, const QString &strLocation,
    277                                      const CMedium &medium, const CProgress &progress);
     273    void cannotCreateClone(const CProgress &progress, const QString &strMachineName, QWidget *pParent = 0);
     274    void cannotOverwriteHardDiskStorage(const QString &strLocation, QWidget *pParent = 0);
     275    void cannotCreateHardDiskStorage(const CVirtualBox &vbox, const QString &strLocation,QWidget *pParent = 0);
     276    void cannotCreateHardDiskStorage(const CMedium &medium, const QString &strLocation, QWidget *pParent = 0);
     277    void cannotCreateHardDiskStorage(const CProgress &progress, const QString &strLocation, QWidget *pParent = 0);
    278278    void warnAboutCannotRemoveMachineFolder(QWidget *pParent, const QString &strFolderName);
    279279    void warnAboutCannotRewriteMachineFolder(QWidget *pParent, const QString &strFolderName);
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVD.cpp

    r45193 r45316  
    6262    CVirtualBox vbox = vboxGlobal().virtualBox();
    6363
    64     /* Create new virtual-disk: */
     64    /* Create new virtual hard-disk: */
    6565    CMedium virtualDisk = vbox.CreateHardDisk(mediumFormat.GetName(), strMediumPath);
    66     CProgress progress;
    6766    if (!vbox.isOk())
    6867    {
    69         msgCenter().cannotCreateHardDiskStorage(this, vbox, strMediumPath, virtualDisk, progress);
     68        msgCenter().cannotCreateHardDiskStorage(vbox, strMediumPath, this);
    7069        return false;
    7170    }
    7271
    73     QVector<KMediumVariant> l_variants(sizeof(uVariant)*8);
    74 
    75     for (int i = 0; i < l_variants.size(); ++i)
     72    /* Compose medium-variant: */
     73    QVector<KMediumVariant> variants(sizeof(qulonglong)*8);
     74    for (int i = 0; i < variants.size(); ++i)
    7675    {
    7776        qulonglong temp = uVariant;
    7877        temp &= 1<<i;
    79         l_variants [i] = (KMediumVariant)temp;
     78        variants[i] = (KMediumVariant)temp;
    8079    }
    8180
    8281    /* Copy existing virtual-disk to the new virtual-disk: */
    83     progress = sourceVirtualDisk.CloneTo(virtualDisk, l_variants, CMedium());
    84     if (!virtualDisk.isOk())
     82    CProgress progress = sourceVirtualDisk.CloneTo(virtualDisk, variants, CMedium());
     83    if (!sourceVirtualDisk.isOk())
    8584    {
    86         msgCenter().cannotCreateHardDiskStorage(this, vbox, strMediumPath, virtualDisk, progress);
     85        msgCenter().cannotCreateHardDiskStorage(sourceVirtualDisk, strMediumPath, this);
    8786        return false;
    8887    }
     
    9493    if (!progress.isOk() || progress.GetResultCode() != 0)
    9594    {
    96         msgCenter().cannotCreateHardDiskStorage(this, vbox, strMediumPath, virtualDisk, progress);
     95        msgCenter().cannotCreateHardDiskStorage(progress, strMediumPath, this);
    9796        return false;
    9897    }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp

    r45233 r45316  
    234234    fResult = !QFileInfo(strMediumPath).exists();
    235235    if (!fResult)
    236         msgCenter().cannotOverwriteHardDiskStorage(this, strMediumPath);
     236        msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this);
    237237
    238238    if (fResult)
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp

    r45233 r45316  
    263263    fResult = !QFileInfo(strMediumPath).exists();
    264264    if (!fResult)
    265         msgCenter().cannotOverwriteHardDiskStorage(this, strMediumPath);
     265        msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this);
    266266
    267267    /* Try to copy virtual-disk: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevm/UIWizardCloneVM.cpp

    r45193 r45316  
    142142    if (!progress.isOk() || progress.GetResultCode() != 0)
    143143    {
    144         msgCenter().cannotCreateClone(srcMachine, progress, this);
     144        msgCenter().cannotCreateClone(progress, srcMachine.GetName(), this);
    145145        return false;
    146146    }
     
    150150    if (!vbox.isOk())
    151151    {
    152         msgCenter().cannotRegisterMachine(vbox, cloneMachine, this);
     152        msgCenter().cannotRegisterMachine(vbox, cloneMachine.GetName(), this);
    153153        return false;
    154154    }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVD.cpp

    r45193 r45316  
    6262    AssertReturn(uSize > 0, false);
    6363
    64     /* Get vbox object: */
     64    /* Get VBox object: */
    6565    CVirtualBox vbox = vboxGlobal().virtualBox();
    6666
    67     /* Create new virtual disk: */
     67    /* Create new virtual hard-disk: */
    6868    CMedium virtualDisk = vbox.CreateHardDisk(mediumFormat.GetName(), strMediumPath);
    69     CProgress progress;
    7069    if (!vbox.isOk())
    7170    {
    72         msgCenter().cannotCreateHardDiskStorage(this, vbox, strMediumPath, virtualDisk, progress);
     71        msgCenter().cannotCreateHardDiskStorage(vbox, strMediumPath, this);
    7372        return false;
    7473    }
    7574
    76     QVector<KMediumVariant> l_variants(sizeof(qulonglong)*8);
    77 
    78     for (int i = 0; i < l_variants.size(); ++i)
     75    /* Compose medium-variant: */
     76    QVector<KMediumVariant> variants(sizeof(qulonglong)*8);
     77    for (int i = 0; i < variants.size(); ++i)
    7978    {
    8079        qulonglong temp = uVariant;
    8180        temp &= 1<<i;
    82         l_variants [i] = (KMediumVariant)temp;
     81        variants[i] = (KMediumVariant)temp;
    8382    }
    8483
    85     /* Create base storage for the new hard disk: */
    86     progress = virtualDisk.CreateBaseStorage(uSize, l_variants);
    87 
     84    /* Create base storage for the new virtual-disk: */
     85    CProgress progress = virtualDisk.CreateBaseStorage(uSize, variants);
    8886    if (!virtualDisk.isOk())
    8987    {
    90         msgCenter().cannotCreateHardDiskStorage(this, vbox, strMediumPath, virtualDisk, progress);
     88        msgCenter().cannotCreateHardDiskStorage(virtualDisk, strMediumPath, this);
    9189        return false;
    9290    }
     
    9896    if (!progress.isOk() || progress.GetResultCode() != 0)
    9997    {
    100         msgCenter().cannotCreateHardDiskStorage(this, vbox, strMediumPath, virtualDisk, progress);
     98        msgCenter().cannotCreateHardDiskStorage(progress, strMediumPath, this);
    10199        return false;
    102100    }
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp

    r45233 r45316  
    398398    fResult = !QFileInfo(strMediumPath).exists();
    399399    if (!fResult)
    400         msgCenter().cannotOverwriteHardDiskStorage(this, strMediumPath);
     400        msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this);
    401401
    402402    if (fResult)
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp

    r45233 r45316  
    277277    fResult = !QFileInfo(strMediumPath).exists();
    278278    if (!fResult)
    279         msgCenter().cannotOverwriteHardDiskStorage(this, strMediumPath);
     279        msgCenter().cannotOverwriteHardDiskStorage(strMediumPath, this);
    280280
    281281    /* Try to create virtual-disk: */
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UIWizardNewVM.cpp

    r45068 r45316  
    190190    if (!vbox.isOk())
    191191    {
    192         msgCenter().cannotCreateMachine(vbox, m_machine, this);
     192        msgCenter().cannotRegisterMachine(vbox, m_machine.GetName(), this);
    193193        return false;
    194194    }
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