Changeset 72920 in vbox
- Timestamp:
- Jul 5, 2018 2:51:50 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 123469
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r72347 r72920 75 75 # include "CExtPackFile.h" 76 76 # include "CHostNetworkInterface.h" 77 # include "CVFSExplorer.h" 77 78 # ifdef VBOX_WITH_DRAG_AND_DROP 78 79 # include "CGuest.h" … … 1748 1749 } 1749 1750 1750 void UIMessageCenter::cannotCheckFiles(const CProgress &progress, QWidget *pParent /* = 0*/) const1751 bool UIMessageCenter::cannotCheckFiles(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const 1751 1752 { 1752 1753 error(pParent, MessageType_Error, 1753 1754 tr("Failed to check files."), 1754 UIErrorString::formatErrorInfo(progress)); 1755 } 1756 1757 void UIMessageCenter::cannotRemoveFiles(const CProgress &progress, QWidget *pParent /* = 0*/) const 1755 UIErrorString::formatErrorInfo(comAppliance)); 1756 return false; 1757 } 1758 1759 bool UIMessageCenter::cannotCheckFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent /* = 0 */) const 1760 { 1761 error(pParent, MessageType_Error, 1762 tr("Failed to check files."), 1763 UIErrorString::formatErrorInfo(comVFSExplorer)); 1764 return false; 1765 } 1766 1767 bool UIMessageCenter::cannotCheckFiles(const CProgress &comProgress, QWidget *pParent /* = 0 */) const 1768 { 1769 error(pParent, MessageType_Error, 1770 tr("Failed to check files."), 1771 UIErrorString::formatErrorInfo(comProgress)); 1772 return false; 1773 } 1774 1775 bool UIMessageCenter::cannotRemoveFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent /* = 0 */) const 1758 1776 { 1759 1777 error(pParent, MessageType_Error, 1760 1778 tr("Failed to remove file."), 1761 UIErrorString::formatErrorInfo(progress)); 1779 UIErrorString::formatErrorInfo(comVFSExplorer)); 1780 return false; 1781 } 1782 1783 bool UIMessageCenter::cannotRemoveFiles(const CProgress &comProgress, QWidget *pParent /* = 0 */) const 1784 { 1785 error(pParent, MessageType_Error, 1786 tr("Failed to remove file."), 1787 UIErrorString::formatErrorInfo(comProgress)); 1788 return false; 1762 1789 } 1763 1790 … … 1776 1803 } 1777 1804 1778 void UIMessageCenter::cannotExportAppliance(const CAppliance &appliance, QWidget *pParent /* = 0*/) const1805 bool UIMessageCenter::cannotExportAppliance(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) const 1779 1806 { 1780 1807 error(pParent, MessageType_Error, 1781 1808 tr("Failed to prepare the export of the appliance <b>%1</b>.") 1782 .arg(CAppliance(appliance).GetPath()), 1783 UIErrorString::formatErrorInfo(appliance)); 1784 } 1785 1786 void UIMessageCenter::cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent /* = 0*/) const 1809 .arg(CAppliance(comAppliance).GetPath()), 1810 UIErrorString::formatErrorInfo(comAppliance)); 1811 return false; 1812 } 1813 1814 void UIMessageCenter::cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent /* = 0 */) const 1787 1815 { 1788 1816 error(pParent, MessageType_Error, … … 1792 1820 } 1793 1821 1794 void UIMessageCenter::cannotExportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent /* = 0*/) const1822 bool UIMessageCenter::cannotExportAppliance(const CProgress &comProgress, const QString &strPath, QWidget *pParent /* = 0 */) const 1795 1823 { 1796 1824 error(pParent, MessageType_Error, 1797 1825 tr("Failed to export appliance <b>%1</b>.") 1798 1826 .arg(strPath), 1799 UIErrorString::formatErrorInfo(progress)); 1800 } 1801 1802 void UIMessageCenter::cannotAddDiskEncryptionPassword(const CAppliance &appliance, QWidget *pParent /* = 0 */) 1827 UIErrorString::formatErrorInfo(comProgress)); 1828 return false; 1829 } 1830 1831 bool UIMessageCenter::cannotAddDiskEncryptionPassword(const CAppliance &comAppliance, QWidget *pParent /* = 0 */) 1803 1832 { 1804 1833 error(pParent, MessageType_Error, 1805 1834 tr("Bad password or authentication failure."), 1806 UIErrorString::formatErrorInfo(appliance)); 1835 UIErrorString::formatErrorInfo(comAppliance)); 1836 return false; 1807 1837 } 1808 1838 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r72869 r72920 376 376 void cannotImportAppliance(CAppliance &appliance, QWidget *pParent = 0) const; 377 377 void cannotImportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent = 0) const; 378 void cannotCheckFiles(const CProgress &progress, QWidget *pParent = 0) const; 379 void cannotRemoveFiles(const CProgress &progress, QWidget *pParent = 0) const; 378 bool cannotCheckFiles(const CAppliance &comAppliance, QWidget *pParent = 0) const; 379 bool cannotCheckFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent = 0) const; 380 bool cannotCheckFiles(const CProgress &comProgress, QWidget *pParent = 0) const; 381 bool cannotRemoveFiles(const CVFSExplorer &comVFSExplorer, QWidget *pParent = 0) const; 382 bool cannotRemoveFiles(const CProgress &comProgress, QWidget *pParent = 0) const; 380 383 bool confirmExportMachinesInSaveState(const QStringList &machineNames, QWidget *pParent = 0) const; 381 void cannotExportAppliance(const CAppliance &appliance, QWidget *pParent = 0) const;384 bool cannotExportAppliance(const CAppliance &comAppliance, QWidget *pParent = 0) const; 382 385 void cannotExportAppliance(const CMachine &machine, const QString &strPath, QWidget *pParent = 0) const; 383 void cannotExportAppliance(const CProgress &progress, const QString &strPath, QWidget *pParent = 0) const;384 void cannotAddDiskEncryptionPassword(const CAppliance &appliance, QWidget *pParent = 0);386 bool cannotExportAppliance(const CProgress &comProgress, const QString &strPath, QWidget *pParent = 0) const; 387 bool cannotAddDiskEncryptionPassword(const CAppliance &comAppliance, QWidget *pParent = 0); 385 388 386 389 /* API: Runtime UI warnings: */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp
r72916 r72920 21 21 22 22 /* Qt includes: */ 23 # include <QFileInfo> 23 24 # include <QVariant> 24 # include <QFileInfo>25 25 26 26 /* GUI includes: */ 27 # include "UIAddDiskEncryptionPasswordDialog.h" 28 # include "UIMessageCenter.h" 27 29 # include "UIWizardExportApp.h" 28 30 # include "UIWizardExportAppDefs.h" … … 32 34 # include "UIWizardExportAppPageBasic4.h" 33 35 # include "UIWizardExportAppPageExpert.h" 34 # include "UIAddDiskEncryptionPasswordDialog.h"35 # include "UIMessageCenter.h"36 36 37 37 /* COM includes: */ … … 65 65 /* Get export appliance widget & fetch all settings from the appliance editor: */ 66 66 UIApplianceExportEditorWidget *pExportApplianceWidget = field("applianceWidget").value<ExportAppliancePointer>(); 67 AssertPtrReturn(pExportApplianceWidget, false); 67 68 pExportApplianceWidget->prepareExport(); 68 69 69 70 /* Get the appliance: */ 70 CAppliance *pAppliance = pExportApplianceWidget->appliance(); 71 CAppliance *pComAppliance = pExportApplianceWidget->appliance(); 72 AssertPtrReturn(pComAppliance, false); 71 73 72 74 /* Compose a list of all required files: */ … … 85 87 86 88 /* Add all hard disk images: */ 87 CVirtualSystemDescriptionVector vsds = p Appliance->GetVirtualSystemDescriptions();88 for (int i = 0; i < vsds.size(); ++ 89 CVirtualSystemDescriptionVector vsds = pComAppliance->GetVirtualSystemDescriptions(); 90 for (int i = 0; i < vsds.size(); ++i) 89 91 { 90 92 QVector<KVirtualSystemDescriptionType> types; … … 92 94 vsds[i].GetDescriptionByType(KVirtualSystemDescriptionType_HardDiskImage, types, 93 95 refs, origValues, configValues, extraConfigValues); 94 foreach (const QString &s , origValues)95 files << QString("%2").arg(s );96 foreach (const QString &strValue, origValues) 97 files << QString("%2").arg(strValue); 96 98 } 97 99 } 98 100 99 101 /* Initialize VFS explorer: */ 100 CVFSExplorer explorer = pAppliance->CreateVFSExplorer(uri(false /* fWithFile */)); 101 CProgress progress = explorer.Update(); 102 bool fResult = explorer.isOk(); 103 if (fResult) 104 { 105 msgCenter().showModalProgressDialog(progress, QApplication::translate("UIWizardExportApp", "Checking files ..."), 106 ":/progress_refresh_90px.png", this); 107 if (progress.GetCanceled()) 108 return false; 109 if (!progress.isOk() || progress.GetResultCode() != 0) 110 { 111 msgCenter().cannotCheckFiles(progress, this); 112 return false; 113 } 114 } 102 CVFSExplorer comExplorer = pComAppliance->CreateVFSExplorer(uri(false /* fWithFile */)); 103 if (comExplorer.isNotNull()) 104 { 105 CProgress comProgress = comExplorer.Update(); 106 if (comExplorer.isOk() && comProgress.isNotNull()) 107 { 108 msgCenter().showModalProgressDialog(comProgress, QApplication::translate("UIWizardExportApp", "Checking files ..."), 109 ":/progress_refresh_90px.png", this); 110 if (comProgress.GetCanceled()) 111 return false; 112 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 113 return msgCenter().cannotCheckFiles(comProgress, this); 114 } 115 else 116 return msgCenter().cannotCheckFiles(comExplorer, this); 117 } 118 else 119 return msgCenter().cannotCheckFiles(*pComAppliance, this); 115 120 116 121 /* Confirm overwriting for existing files: */ 117 QVector<QString> exists = explorer.Exists(files);122 QVector<QString> exists = comExplorer.Exists(files); 118 123 if (!msgCenter().confirmOverridingFiles(exists, this)) 119 124 return false; … … 122 127 if (!exists.isEmpty()) 123 128 { 124 CProgress progress1 = explorer.Remove(exists); 125 fResult = explorer.isOk(); 126 if (fResult) 127 { 128 msgCenter().showModalProgressDialog(progress1, QApplication::translate("UIWizardExportApp", "Removing files ..."), 129 CProgress comProgress = comExplorer.Remove(exists); 130 if (comExplorer.isOk() && comProgress.isNotNull()) 131 { 132 msgCenter().showModalProgressDialog(comProgress, QApplication::translate("UIWizardExportApp", "Removing files ..."), 129 133 ":/progress_delete_90px.png", this); 130 if ( progress1.GetCanceled())134 if (comProgress.GetCanceled()) 131 135 return false; 132 if (!progress1.isOk() || progress1.GetResultCode() != 0) 133 { 134 msgCenter().cannotRemoveFiles(progress1, this); 135 return false; 136 } 137 } 136 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 137 return msgCenter().cannotRemoveFiles(comProgress, this); 138 } 139 else 140 return msgCenter().cannotCheckFiles(comExplorer, this); 138 141 } 139 142 140 143 /* Export the VMs, on success we are finished: */ 141 return exportVMs(*pAppliance); 142 } 143 144 bool UIWizardExportApp::exportVMs(CAppliance &appliance) 144 return exportVMs(*pComAppliance); 145 } 146 147 QString UIWizardExportApp::uri(bool fWithFile) const 148 { 149 /* Prepare storage path: */ 150 QString strPath = field("path").toString(); 151 /* Append file name if requested: */ 152 if (!fWithFile) 153 { 154 QFileInfo fi(strPath); 155 strPath = fi.path(); 156 } 157 158 /* For known storage types: */ 159 StorageType enmType = field("storageType").value<StorageType>(); 160 switch (enmType) 161 { 162 case Filesystem: 163 { 164 return strPath; 165 } 166 case SunCloud: 167 { 168 QString strUri("SunCloud://"); 169 if (!field("username").toString().isEmpty()) 170 strUri = QString("%1%2").arg(strUri).arg(field("username").toString()); 171 if (!field("password").toString().isEmpty()) 172 strUri = QString("%1:%2").arg(strUri).arg(field("password").toString()); 173 if (!field("username").toString().isEmpty() || !field("password").toString().isEmpty()) 174 strUri = QString("%1@").arg(strUri); 175 strUri = QString("%1%2/%3/%4").arg(strUri).arg("object.storage.network.com").arg(field("bucket").toString()).arg(strPath); 176 return strUri; 177 } 178 case S3: 179 { 180 QString strUri("S3://"); 181 if (!field("username").toString().isEmpty()) 182 strUri = QString("%1%2").arg(strUri).arg(field("username").toString()); 183 if (!field("password").toString().isEmpty()) 184 strUri = QString("%1:%2").arg(strUri).arg(field("password").toString()); 185 if (!field("username").toString().isEmpty() || !field("password").toString().isEmpty()) 186 strUri = QString("%1@").arg(strUri); 187 strUri = QString("%1%2/%3/%4").arg(strUri).arg(field("hostname").toString()).arg(field("bucket").toString()).arg(strPath); 188 return strUri; 189 } 190 } 191 192 /* Nothing by default: */ 193 return QString(); 194 } 195 196 void UIWizardExportApp::sltCurrentIdChanged(int iId) 197 { 198 /* Call to base-class: */ 199 UIWizard::sltCurrentIdChanged(iId); 200 201 /* Enable 2nd button (Reset to Defaults) for 4th and Expert pages only! */ 202 setOption(QWizard::HaveCustomButton2, (mode() == WizardMode_Basic && iId == Page4) 203 || (mode() == WizardMode_Expert && iId == PageExpert)); 204 } 205 206 void UIWizardExportApp::sltCustomButtonClicked(int iId) 207 { 208 /* Call to base-class: */ 209 UIWizard::sltCustomButtonClicked(iId); 210 211 /* Handle 2nd button: */ 212 if (iId == CustomButton2) 213 { 214 /* Get appliance widget and make sure it's valid: */ 215 ExportAppliancePointer pApplianceWidget = field("applianceWidget").value<ExportAppliancePointer>(); 216 AssertMsg(!pApplianceWidget.isNull(), ("Appliance Widget is not set!\n")); 217 /* Reset it to default: */ 218 pApplianceWidget->restoreDefaults(); 219 } 220 } 221 222 void UIWizardExportApp::retranslateUi() 223 { 224 /* Call to base-class: */ 225 UIWizard::retranslateUi(); 226 227 /* Translate wizard: */ 228 setWindowTitle(tr("Export Virtual Appliance")); 229 setButtonText(QWizard::CustomButton2, tr("Restore Defaults")); 230 setButtonText(QWizard::FinishButton, tr("Export")); 231 } 232 233 void UIWizardExportApp::prepare() 234 { 235 /* Create corresponding pages: */ 236 switch (mode()) 237 { 238 case WizardMode_Basic: 239 { 240 setPage(Page1, new UIWizardExportAppPageBasic1(m_selectedVMNames)); 241 setPage(Page2, new UIWizardExportAppPageBasic2); 242 setPage(Page3, new UIWizardExportAppPageBasic3); 243 setPage(Page4, new UIWizardExportAppPageBasic4); 244 break; 245 } 246 case WizardMode_Expert: 247 { 248 setPage(PageExpert, new UIWizardExportAppPageExpert(m_selectedVMNames)); 249 break; 250 } 251 default: 252 { 253 AssertMsgFailed(("Invalid mode: %d", mode())); 254 break; 255 } 256 } 257 258 /* Call to base-class: */ 259 UIWizard::prepare(); 260 } 261 262 bool UIWizardExportApp::exportVMs(CAppliance &comAppliance) 145 263 { 146 264 /* Get the map of the password IDs: */ 147 265 EncryptedMediumMap encryptedMediums; 148 foreach (const QString &strPasswordId, appliance.GetPasswordIds())149 foreach (const QString &strMediumId, appliance.GetMediumIdsForPasswordId(strPasswordId))266 foreach (const QString &strPasswordId, comAppliance.GetPasswordIds()) 267 foreach (const QString &strMediumId, comAppliance.GetMediumIdsForPasswordId(strPasswordId)) 150 268 encryptedMediums.insert(strPasswordId, strMediumId); 151 269 … … 174 292 175 293 /* Provide appliance with passwords if possible: */ 176 appliance.AddPasswords(encryptionPasswords.keys().toVector(), 177 encryptionPasswords.values().toVector()); 178 if (!appliance.isOk()) 179 { 180 /* Warn the user about failure: */ 181 msgCenter().cannotAddDiskEncryptionPassword(appliance); 182 183 return false; 184 } 294 comAppliance.AddPasswords(encryptionPasswords.keys().toVector(), 295 encryptionPasswords.values().toVector()); 296 if (!comAppliance.isOk()) 297 return msgCenter().cannotAddDiskEncryptionPassword(comAppliance); 185 298 } 186 299 else 187 300 { 188 if (pDlg) 189 { 190 /* Delete the dialog: */ 191 delete pDlg; 192 } 193 301 /* Delete the dialog: */ 302 delete pDlg; 194 303 return false; 195 304 } … … 200 309 if (field("manifestSelected").toBool()) 201 310 options.append(KExportOptions_CreateManifest); 202 CProgress progress = appliance.Write(field("format").toString(), options, uri()); 203 bool fResult = appliance.isOk(); 204 if (fResult) 205 { 206 msgCenter().showModalProgressDialog(progress, QApplication::translate("UIWizardExportApp", "Exporting Appliance ..."), 311 CProgress comProgress = comAppliance.Write(field("format").toString(), options, uri()); 312 if (comAppliance.isOk() && comProgress.isNotNull()) 313 { 314 msgCenter().showModalProgressDialog(comProgress, QApplication::translate("UIWizardExportApp", "Exporting Appliance ..."), 207 315 ":/progress_export_90px.png", this); 208 if ( progress.GetCanceled())316 if (comProgress.GetCanceled()) 209 317 return false; 210 if (!progress.isOk() || progress.GetResultCode() != 0) 211 { 212 msgCenter().cannotExportAppliance(progress, appliance.GetPath(), this); 213 return false; 214 } 215 else 216 return true; 217 } 218 if (!fResult) 219 msgCenter().cannotExportAppliance(appliance, this); 220 return false; 221 } 222 223 QString UIWizardExportApp::uri(bool fWithFile) const 224 { 225 StorageType type = field("storageType").value<StorageType>(); 226 227 /* Prepare stirage path: */ 228 QString path = field("path").toString(); 229 if (!fWithFile) 230 { 231 QFileInfo fi(path); 232 path = fi.path(); 233 } 234 235 /* For known storage types: */ 236 switch (type) 237 { 238 case Filesystem: 239 { 240 return path; 241 } 242 case SunCloud: 243 { 244 QString uri("SunCloud://"); 245 if (!field("username").toString().isEmpty()) 246 uri = QString("%1%2").arg(uri).arg(field("username").toString()); 247 if (!field("password").toString().isEmpty()) 248 uri = QString("%1:%2").arg(uri).arg(field("password").toString()); 249 if (!field("username").toString().isEmpty() || !field("password").toString().isEmpty()) 250 uri = QString("%1@").arg(uri); 251 uri = QString("%1%2/%3/%4").arg(uri).arg("object.storage.network.com").arg(field("bucket").toString()).arg(path); 252 return uri; 253 } 254 case S3: 255 { 256 QString uri("S3://"); 257 if (!field("username").toString().isEmpty()) 258 uri = QString("%1%2").arg(uri).arg(field("username").toString()); 259 if (!field("password").toString().isEmpty()) 260 uri = QString("%1:%2").arg(uri).arg(field("password").toString()); 261 if (!field("username").toString().isEmpty() || !field("password").toString().isEmpty()) 262 uri = QString("%1@").arg(uri); 263 uri = QString("%1%2/%3/%4").arg(uri).arg(field("hostname").toString()).arg(field("bucket").toString()).arg(path); 264 return uri; 265 } 266 } 267 268 /* Return nothing by default: */ 269 return QString(); 270 } 271 272 void UIWizardExportApp::sltCurrentIdChanged(int iId) 273 { 274 /* Call to base-class: */ 275 UIWizard::sltCurrentIdChanged(iId); 276 277 /* Enable 2nd button (Reset to Defaults) for 4th and Expert pages only! */ 278 setOption(QWizard::HaveCustomButton2, (mode() == WizardMode_Basic && iId == Page4) || 279 (mode() == WizardMode_Expert && iId == PageExpert)); 280 } 281 282 void UIWizardExportApp::sltCustomButtonClicked(int iId) 283 { 284 /* Call to base-class: */ 285 UIWizard::sltCustomButtonClicked(iId); 286 287 /* Handle 2nd button: */ 288 if (iId == CustomButton2) 289 { 290 /* Get appliance widget and make sure it's valid: */ 291 ExportAppliancePointer pApplianceWidget = field("applianceWidget").value<ExportAppliancePointer>(); 292 AssertMsg(!pApplianceWidget.isNull(), ("Appliance Widget is not set!\n")); 293 /* Reset it to default: */ 294 pApplianceWidget->restoreDefaults(); 295 } 296 } 297 298 void UIWizardExportApp::retranslateUi() 299 { 300 /* Call to base-class: */ 301 UIWizard::retranslateUi(); 302 303 /* Translate wizard: */ 304 setWindowTitle(tr("Export Virtual Appliance")); 305 setButtonText(QWizard::CustomButton2, tr("Restore Defaults")); 306 setButtonText(QWizard::FinishButton, tr("Export")); 307 } 308 309 void UIWizardExportApp::prepare() 310 { 311 /* Create corresponding pages: */ 312 switch (mode()) 313 { 314 case WizardMode_Basic: 315 { 316 setPage(Page1, new UIWizardExportAppPageBasic1(m_selectedVMNames)); 317 setPage(Page2, new UIWizardExportAppPageBasic2); 318 setPage(Page3, new UIWizardExportAppPageBasic3); 319 setPage(Page4, new UIWizardExportAppPageBasic4); 320 break; 321 } 322 case WizardMode_Expert: 323 { 324 setPage(PageExpert, new UIWizardExportAppPageExpert(m_selectedVMNames)); 325 break; 326 } 327 default: 328 { 329 AssertMsgFailed(("Invalid mode: %d", mode())); 330 break; 331 } 332 } 333 /* Call to base-class: */ 334 UIWizard::prepare(); 335 } 318 if (!comProgress.isOk() || comProgress.GetResultCode() != 0) 319 return msgCenter().cannotExportAppliance(comProgress, comAppliance.GetPath(), this); 320 } 321 else 322 return msgCenter().cannotExportAppliance(comAppliance, this); 323 324 /* True finally: */ 325 return true; 326 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.h
r72916 r72920 51 51 UIWizardExportApp(QWidget *pParent, const QStringList &selectedVMNames = QStringList()); 52 52 53 protected:54 55 53 /** Exports full appliance. */ 56 54 bool exportAppliance(); 57 /** Exports @a appliance VMs. */ 58 bool exportVMs(CAppliance &appliance); 55 59 56 /** Composes universal resource identifier. 60 57 * @param fWithFile Brings whether uri should include file name as well. */ 61 58 QString uri(bool fWithFile = true) const; 62 59 63 /** @todo remove it */ 64 /* Who will be able to export appliance: */ 65 friend class UIWizardExportAppPage4; 66 friend class UIWizardExportAppPageBasic4; 67 friend class UIWizardExportAppPageExpert; 68 69 private slots: 60 protected slots: 70 61 71 62 /** Handles page change to @a iId. */ 72 void sltCurrentIdChanged(int iId); 63 virtual void sltCurrentIdChanged(int iId) /* override */; 64 73 65 /** Handles custom button @a iId click. */ 74 void sltCustomButtonClicked(int iId); 66 virtual void sltCustomButtonClicked(int iId) /* override */; 67 68 protected: 69 70 /** Handles translation event. */ 71 virtual void retranslateUi() /* override */; 72 73 /** Prepares all. */ 74 virtual void prepare() /* override */; 75 75 76 76 private: 77 77 78 /** Handles translation event. */ 79 void retranslateUi(); 80 81 /** Prepares all. */ 82 void prepare(); 78 /** Exports @a comAppliance VMs. */ 79 bool exportVMs(CAppliance &comAppliance); 83 80 84 81 /** Holds the names of VMs to be exported. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppDefs.h
r72916 r72920 36 36 37 37 /** QListWidgetItem subclass for Export Appliance wizard VM list. */ 38 class VMListWidgetItem : public QListWidgetItem38 class UIVMListWidgetItem : public QListWidgetItem 39 39 { 40 40 public: … … 43 43 * @param strUuid Brings the machine ID. 44 44 * @param fInSaveState Brings whether machine is in Saved state. */ 45 VMListWidgetItem(QPixmap &pixIcon, QString &strText, QString strUuid, bool fInSaveState, QListWidget *pParent)45 UIVMListWidgetItem(QPixmap &pixIcon, QString &strText, QString strUuid, bool fInSaveState, QListWidget *pParent) 46 46 : QListWidgetItem(pixIcon, strText, pParent) 47 47 , m_strUuid(strUuid) … … 56 56 57 57 /** Returns the machine ID. */ 58 QString uuid() { return m_strUuid; }58 QString uuid() const { return m_strUuid; } 59 59 /** Returns whether machine is in Saved state. */ 60 bool isInSaveState() { return m_fInSaveState; }60 bool isInSaveState() const { return m_fInSaveState; } 61 61 62 62 private: -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic1.cpp
r72916 r72920 24 24 25 25 /* GUI includes: */ 26 # include "UIWizardExportAppPageBasic1.h" 26 # include "QILabelSeparator.h" 27 # include "QIRichTextLabel.h" 28 # include "VBoxGlobal.h" 29 # include "UIMessageCenter.h" 27 30 # include "UIWizardExportApp.h" 28 31 # include "UIWizardExportAppDefs.h" 29 # include "VBoxGlobal.h" 30 # include "UIMessageCenter.h" 31 # include "QILabelSeparator.h" 32 # include "QIRichTextLabel.h" 32 # include "UIWizardExportAppPageBasic1.h" 33 33 34 34 /* COM includes: */ … … 75 75 pixIcon = QPixmap(":/os_other.png").scaled(iIconMetric, iIconMetric, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); 76 76 } 77 QListWidgetItem *pItem = new VMListWidgetItem(pixIcon, strName, strUuid, fInSaveState, m_pVMSelector);77 QListWidgetItem *pItem = new UIVMListWidgetItem(pixIcon, strName, strUuid, fInSaveState, m_pVMSelector); 78 78 if (!fEnabled) 79 79 pItem->setFlags(0); … … 113 113 /* Iterate over all the selected items: */ 114 114 foreach (QListWidgetItem *pItem, m_pVMSelector->selectedItems()) 115 machineIDs << static_cast< VMListWidgetItem*>(pItem)->uuid();115 machineIDs << static_cast<UIVMListWidgetItem*>(pItem)->uuid(); 116 116 /* Return result list: */ 117 117 return machineIDs; … … 127 127 /* Create main layout: */ 128 128 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 129 if (pMainLayout) 129 130 { 130 131 /* Create label: */ 131 m_pLabel = new QIRichTextLabel(this); 132 m_pLabel = new QIRichTextLabel; 133 if (m_pLabel) 134 { 135 /* Add into layout: */ 136 pMainLayout->addWidget(m_pLabel); 137 } 132 138 133 139 /* Create VM selector: */ 134 m_pVMSelector = new QListWidget(this); 140 m_pVMSelector = new QListWidget; 141 if (m_pVMSelector) 135 142 { 136 143 m_pVMSelector->setAlternatingRowColors(true); 137 144 m_pVMSelector->setSelectionMode(QAbstractItemView::ExtendedSelection); 138 } 139 140 /* Add into layout: */ 141 pMainLayout->addWidget(m_pLabel); 142 pMainLayout->addWidget(m_pVMSelector); 143 144 /* Populate VM selector items: */ 145 populateVMSelectorItems(selectedVMNames); 146 } 145 146 /* Add into layout: */ 147 pMainLayout->addWidget(m_pVMSelector); 148 } 149 } 150 151 /* Populate VM selector items: */ 152 populateVMSelectorItems(selectedVMNames); 147 153 148 154 /* Setup connections: */ … … 184 190 /* Ask user about machines which are in Saved state currently: */ 185 191 QStringList savedMachines; 186 QList<QListWidgetItem*> pItems = m_pVMSelector->selectedItems();187 for (int i=0; i < pItems.size(); ++i)188 { 189 if (static_cast< VMListWidgetItem*>(pItems.at(i))->isInSaveState())190 savedMachines << pItems.at(i)->text();192 QList<QListWidgetItem*> items = m_pVMSelector->selectedItems(); 193 for (int i=0; i < items.size(); ++i) 194 { 195 if (static_cast<UIVMListWidgetItem*>(items.at(i))->isInSaveState()) 196 savedMachines << items.at(i)->text(); 191 197 } 192 198 if (!savedMachines.isEmpty()) -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic1.h
r72916 r72920 40 40 /** Returns a list of selected machine names. */ 41 41 QStringList machineNames() const; 42 43 42 /** Returns a list of selected machine IDs. */ 44 43 QStringList machineIDs() const; … … 65 64 66 65 /** Handles translation event. */ 67 v oid retranslateUi();66 virtual void retranslateUi() /* override */; 68 67 69 68 /** Performs page initialization. */ 70 v oid initializePage();69 virtual void initializePage() /* override */; 71 70 72 71 /** Returns whether page is complete. */ 73 bool isComplete() const; 72 virtual bool isComplete() const /* override */; 73 74 74 /** Performs page validation. */ 75 bool validatePage();75 virtual bool validatePage() /* override */; 76 76 77 77 /** Returns next page ID. */ 78 int nextId() const; 78 virtual int nextId() const /* override */; 79 80 private: 79 81 80 82 /** Holds the label instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.cpp
r72916 r72920 21 21 22 22 /* Qt includes: */ 23 # include <QVBoxLayout>24 23 # include <QGroupBox> 25 24 # include <QRadioButton> 25 # include <QVBoxLayout> 26 26 27 27 /* GUI includes: */ 28 # include "QIRichTextLabel.h" 29 # include "UIWizardExportApp.h" 28 30 # include "UIWizardExportAppPageBasic2.h" 29 # include "UIWizardExportApp.h"30 # include "QIRichTextLabel.h"31 31 32 32 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 59 59 } 60 60 61 void UIWizardExportAppPage2::setStorageType(StorageType storageType)61 void UIWizardExportAppPage2::setStorageType(StorageType enmStorageType) 62 62 { 63 63 /* Check and focus the requested type: */ 64 switch ( storageType)64 switch (enmStorageType) 65 65 { 66 66 case Filesystem: … … 88 88 /* Create main layout: */ 89 89 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 90 if (pMainLayout) 90 91 { 91 92 /* Create label: */ 92 m_pLabel = new QIRichTextLabel(this); 93 m_pLabel = new QIRichTextLabel; 94 if (m_pLabel) 95 { 96 /* Add into layout: */ 97 pMainLayout->addWidget(m_pLabel); 98 } 93 99 94 100 /* Create storage type container: */ 95 m_pTypeCnt = new QGroupBox(this); 101 m_pTypeCnt = new QGroupBox; 102 if (m_pTypeCnt) 96 103 { 97 104 /* Create storage type container layout: */ 98 105 QVBoxLayout *pTypeCntLayout = new QVBoxLayout(m_pTypeCnt); 106 if (pTypeCntLayout) 99 107 { 100 108 /* Create Local Filesystem radio-button: */ 101 m_pTypeLocalFilesystem = new QRadioButton(m_pTypeCnt); 109 m_pTypeLocalFilesystem = new QRadioButton; 110 if (m_pTypeLocalFilesystem) 111 { 112 /* Add into layout: */ 113 pTypeCntLayout->addWidget(m_pTypeLocalFilesystem); 114 } 102 115 /* Create SunCloud radio-button: */ 103 m_pTypeSunCloud = new QRadioButton(m_pTypeCnt); 116 m_pTypeSunCloud = new QRadioButton; 117 if (m_pTypeSunCloud) 118 { 119 /* Add into layout: */ 120 pTypeCntLayout->addWidget(m_pTypeSunCloud); 121 } 104 122 /* Create Simple Storage System radio-button: */ 105 m_pTypeSimpleStorageSystem = new QRadioButton(m_pTypeCnt); 123 m_pTypeSimpleStorageSystem = new QRadioButton; 124 if (m_pTypeSimpleStorageSystem) 125 { 126 /* Add into layout: */ 127 pTypeCntLayout->addWidget(m_pTypeSimpleStorageSystem); 128 } 129 } 106 130 107 /* Add into layout: */ 108 pTypeCntLayout->addWidget(m_pTypeLocalFilesystem); 109 pTypeCntLayout->addWidget(m_pTypeSunCloud); 110 pTypeCntLayout->addWidget(m_pTypeSimpleStorageSystem); 111 } 131 /* Add into layout: */ 132 pMainLayout->addWidget(m_pTypeCnt); 112 133 } 113 134 114 /* Add into layout: */ 115 pMainLayout->addWidget(m_pLabel); 116 pMainLayout->addWidget(m_pTypeCnt); 135 /* Add vertical stretch: */ 117 136 pMainLayout->addStretch(); 137 } 118 138 119 /* Choose default storage type: */ 120 chooseDefaultStorageType(); 121 } 139 /* Choose default storage type: */ 140 chooseDefaultStorageType(); 122 141 123 142 /* Setup connections: */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic2.h
r72916 r72920 20 20 21 21 /* GUI includes: */ 22 #include "UIWizardExportAppDefs.h" 22 23 #include "UIWizardPage.h" 23 #include "UIWizardExportAppDefs.h"24 24 25 25 /* Forward declarations: */ … … 42 42 /** Returns current storage type. */ 43 43 StorageType storageType() const; 44 /** Defines current @a storageType. */45 void setStorageType(StorageType storageType);44 /** Defines current @a enmStorageType. */ 45 void setStorageType(StorageType enmStorageType); 46 46 47 47 /** Holds the storage type container instance. */ 48 QGroupBox *m_pTypeCnt;48 QGroupBox *m_pTypeCnt; 49 49 /** Holds the Local Filesystem radio-button. */ 50 50 QRadioButton *m_pTypeLocalFilesystem; … … 67 67 UIWizardExportAppPageBasic2(); 68 68 69 pr ivate:69 protected: 70 70 71 71 /** Handles translation event. */ 72 v oid retranslateUi();72 virtual void retranslateUi() /* override */; 73 73 74 74 /** Performs page initialization. */ 75 void initializePage(); 75 virtual void initializePage() /* override */; 76 77 private: 76 78 77 79 /** Holds the label instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.cpp
r72916 r72920 21 21 22 22 /* Qt includes: */ 23 # include <QCheckBox> 24 # include <QComboBox> 23 25 # include <QDir> 24 # include <QVBoxLayout>25 26 # include <QGridLayout> 26 27 # include <QLabel> 27 28 # include <QLineEdit> 28 # include <QComboBox> 29 # include <QCheckBox> 29 # include <QVBoxLayout> 30 30 31 31 /* GUI includes: */ 32 # include "UIWizardExportAppPageBasic3.h" 32 # include "QIRichTextLabel.h" 33 # include "VBoxGlobal.h" 34 # include "UIEmptyFilePathSelector.h" 33 35 # include "UIWizardExportApp.h" 34 36 # include "UIWizardExportAppDefs.h" 35 # include "VBoxGlobal.h" 36 # include "UIEmptyFilePathSelector.h" 37 # include "QIRichTextLabel.h" 37 # include "UIWizardExportAppPageBasic3.h" 38 38 39 39 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 57 57 { 58 58 /* Setup components for chosen storage-type: */ 59 StorageType storageType = fieldImp("storageType").value<StorageType>();60 switch ( storageType)59 const StorageType enmStorageType = fieldImp("storageType").value<StorageType>(); 60 switch (enmStorageType) 61 61 { 62 62 case Filesystem: … … 142 142 143 143 /* Copose file-path for 'Filesystem' storage case: */ 144 if ( storageType == Filesystem)144 if (enmStorageType == Filesystem) 145 145 strName = QDir::toNativeSeparators(QString("%1/%2").arg(vboxGlobal().documentsPath()).arg(strName)); 146 146 … … 151 151 void UIWizardExportAppPage3::updateFormatComboToolTip() 152 152 { 153 int iCurrentIndex = m_pFormatComboBox->currentIndex();154 QString strCurrentIndexToolTip = m_pFormatComboBox->itemData(iCurrentIndex, Qt::ToolTipRole).toString();153 const int iCurrentIndex = m_pFormatComboBox->currentIndex(); 154 const QString strCurrentIndexToolTip = m_pFormatComboBox->itemData(iCurrentIndex, Qt::ToolTipRole).toString(); 155 155 m_pFormatComboBox->setToolTip(strCurrentIndexToolTip); 156 156 } … … 158 158 QString UIWizardExportAppPage3::format() const 159 159 { 160 int iIndex = m_pFormatComboBox->currentIndex();160 const int iIndex = m_pFormatComboBox->currentIndex(); 161 161 return m_pFormatComboBox->itemData(iIndex).toString(); 162 162 } … … 164 164 void UIWizardExportAppPage3::setFormat(const QString &strFormat) 165 165 { 166 int iIndex = m_pFormatComboBox->findData(strFormat);166 const int iIndex = m_pFormatComboBox->findData(strFormat); 167 167 AssertMsg(iIndex != -1, ("Field not found!")); 168 168 m_pFormatComboBox->setCurrentIndex(iIndex); … … 238 238 /* Create main layout: */ 239 239 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 240 if (pMainLayout) 240 241 { 241 242 /* Create label: */ 242 m_pLabel = new QIRichTextLabel(this); 243 m_pLabel = new QIRichTextLabel; 244 if (m_pLabel) 245 { 246 /* Add into layout: */ 247 pMainLayout->addWidget(m_pLabel); 248 } 243 249 244 250 /* Create settings layout: */ 245 251 QGridLayout *pSettingsLayout = new QGridLayout; 252 if (pSettingsLayout) 246 253 { 247 254 /* Create username editor: */ 248 m_pUsernameEditor = new QLineEdit(this); 255 m_pUsernameEditor = new QLineEdit; 256 if (m_pUsernameEditor) 257 { 258 /* Add into layout: */ 259 pSettingsLayout->addWidget(m_pUsernameEditor, 0, 1); 260 } 249 261 /* Create username label: */ 250 m_pUsernameLabel = new QLabel(this); 262 m_pUsernameLabel = new QLabel; 263 if (m_pUsernameLabel) 251 264 { 252 265 m_pUsernameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 253 266 m_pUsernameLabel->setBuddy(m_pUsernameEditor); 267 268 /* Add into layout: */ 269 pSettingsLayout->addWidget(m_pUsernameLabel, 0, 0); 254 270 } 255 271 256 272 /* Create password editor: */ 257 m_pPasswordEditor = new QLineEdit(this); 273 m_pPasswordEditor = new QLineEdit; 274 if (m_pPasswordEditor) 258 275 { 259 276 m_pPasswordEditor->setEchoMode(QLineEdit::Password); 277 278 /* Add into layout: */ 279 pSettingsLayout->addWidget(m_pPasswordEditor, 1, 1); 260 280 } 261 281 /* Create password label: */ 262 m_pPasswordLabel = new QLabel(this); 282 m_pPasswordLabel = new QLabel; 283 if (m_pPasswordLabel) 263 284 { 264 285 m_pPasswordLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 265 286 m_pPasswordLabel->setBuddy(m_pPasswordEditor); 287 288 /* Add into layout: */ 289 pSettingsLayout->addWidget(m_pPasswordLabel, 1, 0); 266 290 } 267 291 268 292 /* Create hostname editor: */ 269 m_pHostnameEditor = new QLineEdit(this); 293 m_pHostnameEditor = new QLineEdit; 294 if (m_pHostnameEditor) 295 { 296 /* Add into layout: */ 297 pSettingsLayout->addWidget(m_pHostnameEditor, 2, 1); 298 } 270 299 /* Create hostname label: */ 271 m_pHostnameLabel = new QLabel(this); 300 m_pHostnameLabel = new QLabel; 301 if (m_pHostnameLabel) 272 302 { 273 303 m_pHostnameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 274 304 m_pHostnameLabel->setBuddy(m_pHostnameEditor); 305 306 /* Add into layout: */ 307 pSettingsLayout->addWidget(m_pHostnameLabel, 2, 0); 275 308 } 276 309 277 310 /* Create bucket editor: */ 278 m_pBucketEditor = new QLineEdit(this); 311 m_pBucketEditor = new QLineEdit; 312 if (m_pBucketEditor) 313 { 314 /* Add into layout: */ 315 pSettingsLayout->addWidget(m_pBucketEditor, 3, 1); 316 } 279 317 /* Create bucket label: */ 280 m_pBucketLabel = new QLabel(this); 318 m_pBucketLabel = new QLabel; 319 if (m_pBucketLabel) 281 320 { 282 321 m_pBucketLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 283 322 m_pBucketLabel->setBuddy(m_pBucketEditor); 323 324 /* Add into layout: */ 325 pSettingsLayout->addWidget(m_pBucketLabel, 3, 0); 284 326 } 285 327 286 328 /* Create file selector: */ 287 m_pFileSelector = new UIEmptyFilePathSelector(this); 329 m_pFileSelector = new UIEmptyFilePathSelector; 330 if (m_pFileSelector) 288 331 { 289 332 m_pFileSelector->setMode(UIEmptyFilePathSelector::Mode_File_Save); … … 291 334 m_pFileSelector->setButtonPosition(UIEmptyFilePathSelector::RightPosition); 292 335 m_pFileSelector->setDefaultSaveExt("ova"); 336 337 /* Add into layout: */ 338 pSettingsLayout->addWidget(m_pFileSelector, 4, 1); 293 339 } 294 340 /* Create file selector label: */ 295 m_pFileSelectorLabel = new QLabel(this); 341 m_pFileSelectorLabel = new QLabel; 342 if (m_pFileSelectorLabel) 296 343 { 297 344 m_pFileSelectorLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 298 345 m_pFileSelectorLabel->setBuddy(m_pFileSelector); 346 347 /* Add into layout: */ 348 pSettingsLayout->addWidget(m_pFileSelectorLabel, 4, 0); 299 349 } 300 350 301 351 /* Create format combo-box: */ 302 m_pFormatComboBox = new QComboBox(this); 352 m_pFormatComboBox = new QComboBox; 353 if (m_pFormatComboBox) 303 354 { 304 355 const QString strFormatOVF09("ovf-0.9"); … … 310 361 m_pFormatComboBox->addItem(strFormatOVF20, strFormatOVF20); 311 362 m_pFormatComboBox->addItem(strFormatOPC10, strFormatOPC10); 312 connect(m_pFormatComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 313 this, &UIWizardExportAppPageBasic3::sltHandleFormatComboChange); 363 364 /* Add into layout: */ 365 pSettingsLayout->addWidget(m_pFormatComboBox, 5, 1); 314 366 } 315 367 /* Create format combo-box label: */ 316 m_pFormatComboBoxLabel = new QLabel(this); 368 m_pFormatComboBoxLabel = new QLabel; 369 if (m_pFormatComboBoxLabel) 317 370 { 318 371 m_pFormatComboBoxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 319 372 m_pFormatComboBoxLabel->setBuddy(m_pFormatComboBox); 373 374 /* Add into layout: */ 375 pSettingsLayout->addWidget(m_pFormatComboBoxLabel, 5, 0); 320 376 } 321 377 322 378 /* Add into layout: */ 323 pSettingsLayout->addWidget(m_pUsernameLabel, 0, 0); 324 pSettingsLayout->addWidget(m_pUsernameEditor, 0, 1); 325 pSettingsLayout->addWidget(m_pPasswordLabel, 1, 0); 326 pSettingsLayout->addWidget(m_pPasswordEditor, 1, 1); 327 pSettingsLayout->addWidget(m_pHostnameLabel, 2, 0); 328 pSettingsLayout->addWidget(m_pHostnameEditor, 2, 1); 329 pSettingsLayout->addWidget(m_pBucketLabel, 3, 0); 330 pSettingsLayout->addWidget(m_pBucketEditor, 3, 1); 331 pSettingsLayout->addWidget(m_pFileSelectorLabel, 4, 0); 332 pSettingsLayout->addWidget(m_pFileSelector, 4, 1); 333 pSettingsLayout->addWidget(m_pFormatComboBoxLabel, 5, 0); 334 pSettingsLayout->addWidget(m_pFormatComboBox, 5, 1); 379 pMainLayout->addLayout(pSettingsLayout); 335 380 } 336 381 337 382 /* Create manifest check-box: */ 338 m_pManifestCheckbox = new QCheckBox(this); 339 340 /* Add into layout: */ 341 pMainLayout->addWidget(m_pLabel); 342 pMainLayout->addLayout(pSettingsLayout); 343 pMainLayout->addWidget(m_pManifestCheckbox); 383 m_pManifestCheckbox = new QCheckBox; 384 if (m_pManifestCheckbox) 385 { 386 /* Add into layout: */ 387 pMainLayout->addWidget(m_pManifestCheckbox); 388 } 389 390 /* Add vertical stretch: */ 344 391 pMainLayout->addStretch(); 345 346 /* Choose default settings: */347 chooseDefaultSettings();348 392 } 393 394 /* Choose default settings: */ 395 chooseDefaultSettings(); 349 396 350 397 /* Setup connections: */ … … 354 401 connect(m_pBucketEditor, &QLineEdit::textChanged, this, &UIWizardExportAppPageBasic3::completeChanged); 355 402 connect(m_pFileSelector, &UIEmptyFilePathSelector::pathChanged, this, &UIWizardExportAppPageBasic3::completeChanged); 403 connect(m_pFormatComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 404 this, &UIWizardExportAppPageBasic3::sltHandleFormatComboChange); 356 405 357 406 /* Register fields: */ … … 363 412 registerField("bucket", this, "bucket"); 364 413 registerField("path", this, "path"); 365 }366 367 void UIWizardExportAppPageBasic3::sltHandleFormatComboChange()368 {369 refreshCurrentSettings();370 updateFormatComboToolTip();371 414 } 372 415 … … 419 462 { 420 463 const QString &strFile = m_pFileSelector->path().toLower(); 421 bool fOVF = field("format").toString() == "ovf-0.9"422 || field("format").toString() == "ovf-1.0"423 || field("format").toString() == "ovf-2.0";424 bool fOPC = field("format").toString() == "opc-1.0";464 const bool fOVF = field("format").toString() == "ovf-0.9" 465 || field("format").toString() == "ovf-1.0" 466 || field("format").toString() == "ovf-2.0"; 467 const bool fOPC = field("format").toString() == "opc-1.0"; 425 468 fResult = ( fOVF 426 469 && VBoxGlobal::hasAllowedExtension(strFile, OVFFileExts)) … … 429 472 if (fResult) 430 473 { 431 StorageType storageType = field("storageType").value<StorageType>();432 switch ( storageType)474 const StorageType enmStorageType = field("storageType").value<StorageType>(); 475 switch (enmStorageType) 433 476 { 434 477 case Filesystem: … … 459 502 460 503 /* Setup components for chosen storage-type: */ 461 StorageType storageType = field("storageType").value<StorageType>();462 switch ( storageType)504 const StorageType enmStorageType = field("storageType").value<StorageType>(); 505 switch (enmStorageType) 463 506 { 464 507 case Filesystem: … … 492 535 } 493 536 } 537 538 void UIWizardExportAppPageBasic3::sltHandleFormatComboChange() 539 { 540 refreshCurrentSettings(); 541 updateFormatComboToolTip(); 542 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic3.h
r72916 r72920 26 26 27 27 /* Forward declarations: */ 28 class QCheckBox; 29 class QComboBox; 28 30 class QLabel; 29 31 class QLineEdit; 32 class QIRichTextLabel; 30 33 class UIEmptyFilePathSelector; 31 class QComboBox;32 class QCheckBox;33 class QIRichTextLabel;34 34 35 35 … … 44 44 /** Chooses default settings. */ 45 45 void chooseDefaultSettings(); 46 46 47 /** Refreshes current settings. */ 47 48 virtual void refreshCurrentSettings(); … … 85 86 86 87 /** Holds the default appliance name. */ 87 QString m_strDefaultApplianceName;88 QString m_strDefaultApplianceName; 88 89 89 90 /** Holds the username label instance. */ 90 QLabel *m_pUsernameLabel;91 QLabel *m_pUsernameLabel; 91 92 /** Holds the username editor instance. */ 92 93 QLineEdit *m_pUsernameEditor; 93 94 94 95 /** Holds the password label instance. */ 95 QLabel *m_pPasswordLabel;96 QLabel *m_pPasswordLabel; 96 97 /** Holds the password editor instance. */ 97 98 QLineEdit *m_pPasswordEditor; 98 99 99 100 /** Holds the hostname label instance. */ 100 QLabel *m_pHostnameLabel;101 QLabel *m_pHostnameLabel; 101 102 /** Holds the hostname editor instance. */ 102 103 QLineEdit *m_pHostnameEditor; 103 104 104 105 /** Holds the bucket label instance. */ 105 QLabel *m_pBucketLabel;106 QLabel *m_pBucketLabel; 106 107 /** Holds the bucket editor instance. */ 107 108 QLineEdit *m_pBucketEditor; 108 109 109 110 /** Holds the file selector label instance. */ 110 QLabel *m_pFileSelectorLabel;111 QLabel *m_pFileSelectorLabel; 111 112 /** Holds the file selector instance. */ 112 113 UIEmptyFilePathSelector *m_pFileSelector; 113 114 114 115 /** Holds the format combo-box label instance. */ 115 QLabel *m_pFormatComboBoxLabel;116 QLabel *m_pFormatComboBoxLabel; 116 117 /** Holds the format combo-box instance. */ 117 118 QComboBox *m_pFormatComboBox; … … 144 145 QVariant fieldImp(const QString &strFieldName) const { return UIWizardPage::field(strFieldName); } 145 146 147 /** Handles translation event. */ 148 virtual void retranslateUi() /* override */; 149 150 /** Performs page initialization. */ 151 virtual void initializePage() /* override */; 152 153 /** Returns whether page is complete. */ 154 virtual bool isComplete() const /* override */; 155 156 /** Refreshes current settings. */ 157 virtual void refreshCurrentSettings() /* override */; 158 146 159 private slots: 147 160 … … 151 164 private: 152 165 153 /** Handles translation event. */154 void retranslateUi();155 156 /** Performs page initialization. */157 void initializePage();158 159 /** Returns whether page is complete. */160 bool isComplete() const;161 162 /** Refreshes current settings. */163 void refreshCurrentSettings();164 165 166 /** Holds the label instance. */ 166 167 QIRichTextLabel *m_pLabel; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic4.cpp
r72916 r72920 24 24 25 25 /* GUI includes: */ 26 # include " UIWizardExportAppPageBasic4.h"27 # include " UIWizardExportApp.h"26 # include "QILabelSeparator.h" 27 # include "QIRichTextLabel.h" 28 28 # include "VBoxGlobal.h" 29 29 # include "UIMessageCenter.h" 30 # include " QILabelSeparator.h"31 # include " QIRichTextLabel.h"30 # include "UIWizardExportApp.h" 31 # include "UIWizardExportAppPageBasic4.h" 32 32 33 33 /* COM includes: */ … … 49 49 { 50 50 /* Refresh settings widget: */ 51 CVirtualBox vbox = vboxGlobal().virtualBox();51 CVirtualBox comVBox = vboxGlobal().virtualBox(); 52 52 CAppliance *pAppliance = m_pApplianceWidget->init(); 53 bool fResult = pAppliance->isOk(); 54 if (fResult) 53 if (pAppliance->isOk()) 55 54 { 56 55 /* Iterate over all the selected machine ids: */ … … 59 58 { 60 59 /* Get the machine with the uuid: */ 61 CMachine machine = vbox.FindMachine(uuid); 62 fResult = machine.isOk(); 63 if (fResult) 60 CMachine comMachine = comVBox.FindMachine(uuid); 61 if (comVBox.isOk() && comMachine.isNotNull()) 64 62 { 65 63 /* Add the export description to our appliance object: */ 66 CVirtualSystemDescription vsd = machine.ExportTo(*pAppliance, qobject_cast<UIWizardExportApp*>(wizardImp())->uri()); 67 fResult = machine.isOk(); 68 if (!fResult) 64 CVirtualSystemDescription comVsd = comMachine.ExportTo(*pAppliance, qobject_cast<UIWizardExportApp*>(wizardImp())->uri()); 65 if (comMachine.isOk() && comVsd.isNotNull()) 69 66 { 70 msgCenter().cannotExportAppliance(machine, pAppliance->GetPath(), thisImp()); 71 return; 67 /* Now add some new fields the user may change: */ 68 comVsd.AddDescription(KVirtualSystemDescriptionType_Product, "", ""); 69 comVsd.AddDescription(KVirtualSystemDescriptionType_ProductUrl, "", ""); 70 comVsd.AddDescription(KVirtualSystemDescriptionType_Vendor, "", ""); 71 comVsd.AddDescription(KVirtualSystemDescriptionType_VendorUrl, "", ""); 72 comVsd.AddDescription(KVirtualSystemDescriptionType_Version, "", ""); 73 comVsd.AddDescription(KVirtualSystemDescriptionType_License, "", ""); 72 74 } 73 /* Now add some new fields the user may change: */ 74 vsd.AddDescription(KVirtualSystemDescriptionType_Product, "", ""); 75 vsd.AddDescription(KVirtualSystemDescriptionType_ProductUrl, "", ""); 76 vsd.AddDescription(KVirtualSystemDescriptionType_Vendor, "", ""); 77 vsd.AddDescription(KVirtualSystemDescriptionType_VendorUrl, "", ""); 78 vsd.AddDescription(KVirtualSystemDescriptionType_Version, "", ""); 79 vsd.AddDescription(KVirtualSystemDescriptionType_License, "", ""); 75 else 76 return msgCenter().cannotExportAppliance(comMachine, pAppliance->GetPath(), thisImp()); 80 77 } 81 78 else 82 break;79 return msgCenter().cannotFindMachineById(comVBox, uuid); 83 80 } 84 81 /* Make sure the settings widget get the new descriptions: */ 85 82 m_pApplianceWidget->populate(); 86 83 } 87 if (!fResult)88 msgCenter().cannotExportAppliance(*pAppliance, thisImp());89 84 } 90 85 … … 98 93 /* Create main layout: */ 99 94 QVBoxLayout *pMainLayout = new QVBoxLayout(this); 95 if (pMainLayout) 100 96 { 101 97 /* Create label: */ 102 m_pLabel = new QIRichTextLabel(this); 98 m_pLabel = new QIRichTextLabel; 99 if (m_pLabel) 100 { 101 /* Add into layout: */ 102 pMainLayout->addWidget(m_pLabel); 103 } 103 104 104 105 /* Create appliance widget: */ 105 m_pApplianceWidget = new UIApplianceExportEditorWidget(this); 106 m_pApplianceWidget = new UIApplianceExportEditorWidget; 107 if (m_pApplianceWidget) 106 108 { 107 109 m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); 110 111 /* Add into layout: */ 112 pMainLayout->addWidget(m_pApplianceWidget); 108 113 } 109 110 /* Add into layout: */111 pMainLayout->addWidget(m_pLabel);112 pMainLayout->addWidget(m_pApplianceWidget);113 114 } 114 115 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageBasic4.h
r72916 r72920 23 23 24 24 /* GUI includes: */ 25 #include "UIWizardExportAppDefs.h" 25 26 #include "UIWizardPage.h" 26 #include "UIWizardExportAppDefs.h"27 27 28 28 /* Forward declarations: */ 29 class QIRichTextLabel; 29 30 class UIWizardExportApp; 30 class QIRichTextLabel;31 31 32 32 … … 70 70 QVariant fieldImp(const QString &strFieldName) const { return UIWizardPage::field(strFieldName); } 71 71 72 private:73 74 72 /** Handles translation event. */ 75 v oid retranslateUi();73 virtual void retranslateUi() /* override */; 76 74 77 75 /** Performs page initialization. */ 78 v oid initializePage();76 virtual void initializePage() /* override */; 79 77 80 78 /** Performs page validation. */ 81 bool validatePage(); 79 virtual bool validatePage() /* override */; 80 81 private: 82 82 83 83 /** Holds the label instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.cpp
r72916 r72920 21 21 22 22 /* Qt includes: */ 23 # include <QCheckBox> 24 # include <QGridLayout> 25 # include <QGroupBox> 26 # include <QLabel> 27 # include <QLineEdit> 28 # include <QListWidget> 29 # include <QRadioButton> 23 30 # include <QVBoxLayout> 24 # include <QGridLayout>25 # include <QListWidget>26 # include <QGroupBox>27 # include <QRadioButton>28 # include <QLineEdit>29 # include <QLabel>30 # include <QCheckBox>31 # include <QGroupBox>32 31 33 32 /* GUI includes: */ 34 # include "UIWizardExportAppPageExpert.h" 33 # include "VBoxGlobal.h" 34 # include "UIApplianceExportEditorWidget.h" 35 # include "UIEmptyFilePathSelector.h" 35 36 # include "UIWizardExportApp.h" 36 37 # include "UIWizardExportAppDefs.h" 37 # include "VBoxGlobal.h" 38 # include "UIEmptyFilePathSelector.h" 39 # include "UIApplianceExportEditorWidget.h" 38 # include "UIWizardExportAppPageExpert.h" 40 39 41 40 #endif /* !VBOX_WITH_PRECOMPILED_HEADERS */ … … 50 49 /* Create widgets: */ 51 50 QGridLayout *pMainLayout = new QGridLayout(this); 51 if (pMainLayout) 52 52 { 53 53 /* Create VM selector container: */ 54 m_pSelectorCnt = new QGroupBox(this); 54 m_pSelectorCnt = new QGroupBox; 55 if (m_pSelectorCnt) 55 56 { 56 57 /* Create VM selector container layout: */ 57 58 QVBoxLayout *pSelectorCntLayout = new QVBoxLayout(m_pSelectorCnt); 59 if (pSelectorCntLayout) 58 60 { 59 61 /* Create VM selector: */ 60 m_pVMSelector = new QListWidget(m_pSelectorCnt); 62 m_pVMSelector = new QListWidget; 63 if (m_pVMSelector) 61 64 { 62 65 m_pVMSelector->setAlternatingRowColors(true); 63 66 m_pVMSelector->setSelectionMode(QAbstractItemView::ExtendedSelection); 64 } 65 66 /* Add into layout: */67 pSelectorCntLayout->addWidget(m_pVMSelector);67 68 /* Add into layout: */ 69 pSelectorCntLayout->addWidget(m_pVMSelector); 70 } 68 71 } 72 73 /* Add into layout: */ 74 pMainLayout->addWidget(m_pSelectorCnt, 0, 0); 69 75 } 70 76 71 77 /* Create appliance widget container: */ 72 m_pApplianceCnt = new QGroupBox(this); 78 m_pApplianceCnt = new QGroupBox; 79 if (m_pApplianceCnt) 73 80 { 74 81 /* Create appliance widget container layout: */ 75 82 QVBoxLayout *pApplianceCntLayout = new QVBoxLayout(m_pApplianceCnt); 83 if (pApplianceCntLayout) 76 84 { 77 85 /* Create appliance widget: */ 78 m_pApplianceWidget = new UIApplianceExportEditorWidget(m_pApplianceCnt); 86 m_pApplianceWidget = new UIApplianceExportEditorWidget; 87 if (m_pApplianceWidget) 79 88 { 80 89 m_pApplianceWidget->setMinimumHeight(250); 81 90 m_pApplianceWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding); 82 } 83 84 /* Add into layout: */85 pApplianceCntLayout->addWidget(m_pApplianceWidget);91 92 /* Add into layout: */ 93 pApplianceCntLayout->addWidget(m_pApplianceWidget); 94 } 86 95 } 96 97 /* Add into layout: */ 98 pMainLayout->addWidget(m_pApplianceCnt, 0, 1); 87 99 } 88 100 89 101 /* Create storage type container: */ 90 m_pTypeCnt = new QGroupBox(this); 102 m_pTypeCnt = new QGroupBox; 103 if (m_pTypeCnt) 91 104 { 92 105 /* Hide it for now: */ … … 95 108 /* Create storage type container layout: */ 96 109 QVBoxLayout *pTypeCntLayout = new QVBoxLayout(m_pTypeCnt); 110 if (pTypeCntLayout) 97 111 { 98 112 /* Create Local Filesystem radio-button: */ 99 m_pTypeLocalFilesystem = new QRadioButton(m_pTypeCnt); 113 m_pTypeLocalFilesystem = new QRadioButton; 114 if (m_pTypeLocalFilesystem) 115 { 116 /* Add into layout: */ 117 pTypeCntLayout->addWidget(m_pTypeLocalFilesystem); 118 } 100 119 /* Create SunCloud radio-button: */ 101 m_pTypeSunCloud = new QRadioButton(m_pTypeCnt); 120 m_pTypeSunCloud = new QRadioButton; 121 if (m_pTypeSunCloud) 122 { 123 /* Add into layout: */ 124 pTypeCntLayout->addWidget(m_pTypeSunCloud); 125 } 102 126 /* Create Simple Storage System radio-button: */ 103 m_pTypeSimpleStorageSystem = new QRadioButton (m_pTypeCnt);104 105 /* Add into layout: */106 pTypeCntLayout->addWidget(m_pTypeLocalFilesystem);107 pTypeCntLayout->addWidget(m_pTypeSunCloud);108 pTypeCntLayout->addWidget(m_pTypeSimpleStorageSystem);127 m_pTypeSimpleStorageSystem = new QRadioButton; 128 if (m_pTypeSimpleStorageSystem) 129 { 130 /* Add into layout: */ 131 pTypeCntLayout->addWidget(m_pTypeSimpleStorageSystem); 132 } 109 133 } 134 135 /* Add into layout: */ 136 pMainLayout->addWidget(m_pTypeCnt, 1, 0, 1, 2); 110 137 } 111 138 112 139 /* Create settings widget container: */ 113 m_pSettingsCnt = new QGroupBox(this); 140 m_pSettingsCnt = new QGroupBox; 141 if (m_pSettingsCnt) 114 142 { 115 143 /* Create settings widget container layout: */ 116 144 QGridLayout *pSettingsLayout = new QGridLayout(m_pSettingsCnt); 145 if (pSettingsLayout) 117 146 { 118 147 /* Create username editor: */ 119 m_pUsernameEditor = new QLineEdit(m_pSettingsCnt); 148 m_pUsernameEditor = new QLineEdit; 149 if (m_pUsernameEditor) 150 { 151 /* Add into layout: */ 152 pSettingsLayout->addWidget(m_pUsernameEditor, 0, 1); 153 } 120 154 /* Create username label: */ 121 m_pUsernameLabel = new QLabel(m_pSettingsCnt); 155 m_pUsernameLabel = new QLabel; 156 if (m_pUsernameLabel) 122 157 { 123 158 m_pUsernameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 124 159 m_pUsernameLabel->setBuddy(m_pUsernameEditor); 160 161 /* Add into layout: */ 162 pSettingsLayout->addWidget(m_pUsernameLabel, 0, 0); 125 163 } 126 164 127 165 /* Create password editor: */ 128 m_pPasswordEditor = new QLineEdit(m_pSettingsCnt); 166 m_pPasswordEditor = new QLineEdit; 167 if (m_pPasswordEditor) 129 168 { 130 169 m_pPasswordEditor->setEchoMode(QLineEdit::Password); 170 171 /* Add into layout: */ 172 pSettingsLayout->addWidget(m_pPasswordEditor, 1, 1); 131 173 } 132 174 /* Create password label: */ 133 m_pPasswordLabel = new QLabel(m_pSettingsCnt); 175 m_pPasswordLabel = new QLabel; 176 if (m_pPasswordLabel) 134 177 { 135 178 m_pPasswordLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 136 179 m_pPasswordLabel->setBuddy(m_pPasswordEditor); 180 181 /* Add into layout: */ 182 pSettingsLayout->addWidget(m_pPasswordLabel, 1, 0); 137 183 } 138 184 139 185 /* Create hostname editor: */ 140 m_pHostnameEditor = new QLineEdit(m_pSettingsCnt); 186 m_pHostnameEditor = new QLineEdit; 187 if (m_pHostnameEditor) 188 { 189 /* Add into layout: */ 190 pSettingsLayout->addWidget(m_pHostnameEditor, 2, 1); 191 } 141 192 /* Create hostname label: */ 142 m_pHostnameLabel = new QLabel(m_pSettingsCnt); 193 m_pHostnameLabel = new QLabel; 194 if (m_pHostnameLabel) 143 195 { 144 196 m_pHostnameLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 145 197 m_pHostnameLabel->setBuddy(m_pHostnameEditor); 198 199 /* Add into layout: */ 200 pSettingsLayout->addWidget(m_pHostnameLabel, 2, 0); 146 201 } 147 202 148 203 /* Create bucket editor: */ 149 m_pBucketEditor = new QLineEdit(m_pSettingsCnt); 204 m_pBucketEditor = new QLineEdit; 205 if (m_pBucketEditor) 206 { 207 /* Add into layout: */ 208 pSettingsLayout->addWidget(m_pBucketEditor, 3, 1); 209 } 150 210 /* Create bucket label: */ 151 m_pBucketLabel = new QLabel(m_pSettingsCnt); 211 m_pBucketLabel = new QLabel; 212 if (m_pBucketLabel) 152 213 { 153 214 m_pBucketLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 154 215 m_pBucketLabel->setBuddy(m_pBucketEditor); 216 217 /* Add into layout: */ 218 pSettingsLayout->addWidget(m_pBucketLabel, 3, 0); 155 219 } 156 220 157 221 /* Create file selector: */ 158 m_pFileSelector = new UIEmptyFilePathSelector(m_pSettingsCnt); 222 m_pFileSelector = new UIEmptyFilePathSelector; 223 if (m_pFileSelector) 159 224 { 160 225 m_pFileSelector->setMode(UIEmptyFilePathSelector::Mode_File_Save); … … 162 227 m_pFileSelector->setButtonPosition(UIEmptyFilePathSelector::RightPosition); 163 228 m_pFileSelector->setDefaultSaveExt("ova"); 229 230 /* Add into layout: */ 231 pSettingsLayout->addWidget(m_pFileSelector, 4, 1); 164 232 } 165 233 /* Create file selector label: */ 166 m_pFileSelectorLabel = new QLabel(m_pSettingsCnt); 234 m_pFileSelectorLabel = new QLabel; 235 if (m_pFileSelectorLabel) 167 236 { 168 237 m_pFileSelectorLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 169 238 m_pFileSelectorLabel->setBuddy(m_pFileSelector); 239 240 /* Add into layout: */ 241 pSettingsLayout->addWidget(m_pFileSelectorLabel, 4, 0); 170 242 } 171 243 172 244 /* Create format combo-box editor: */ 173 m_pFormatComboBox = new QComboBox(m_pSettingsCnt); 245 m_pFormatComboBox = new QComboBox; 246 if (m_pFormatComboBox) 174 247 { 175 248 const QString strFormatOVF09("ovf-0.9"); … … 181 254 m_pFormatComboBox->addItem(strFormatOVF20, strFormatOVF20); 182 255 m_pFormatComboBox->addItem(strFormatOPC10, strFormatOPC10); 183 connect(m_pFormatComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 184 this, &UIWizardExportAppPageExpert::sltHandleFormatComboChange); 256 257 /* Add into layout: */ 258 pSettingsLayout->addWidget(m_pFormatComboBox, 5, 1); 185 259 } 186 260 /* Create format combo-box label: */ 187 m_pFormatComboBoxLabel = new QLabel(m_pSettingsCnt); 261 m_pFormatComboBoxLabel = new QLabel; 262 if (m_pFormatComboBoxLabel) 188 263 { 189 264 m_pFormatComboBoxLabel->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); 190 265 m_pFormatComboBoxLabel->setBuddy(m_pFormatComboBox); 266 267 /* Add into layout: */ 268 pSettingsLayout->addWidget(m_pFormatComboBoxLabel, 5, 0); 191 269 } 192 270 193 271 /* Create manifest check-box editor: */ 194 m_pManifestCheckbox = new QCheckBox(m_pSettingsCnt); 195 196 /* Add into layout: */ 197 pSettingsLayout->addWidget(m_pUsernameLabel, 0, 0); 198 pSettingsLayout->addWidget(m_pUsernameEditor, 0, 1); 199 pSettingsLayout->addWidget(m_pPasswordLabel, 1, 0); 200 pSettingsLayout->addWidget(m_pPasswordEditor, 1, 1); 201 pSettingsLayout->addWidget(m_pHostnameLabel, 2, 0); 202 pSettingsLayout->addWidget(m_pHostnameEditor, 2, 1); 203 pSettingsLayout->addWidget(m_pBucketLabel, 3, 0); 204 pSettingsLayout->addWidget(m_pBucketEditor, 3, 1); 205 pSettingsLayout->addWidget(m_pFileSelectorLabel, 4, 0); 206 pSettingsLayout->addWidget(m_pFileSelector, 4, 1); 207 pSettingsLayout->addWidget(m_pFormatComboBoxLabel, 5, 0); 208 pSettingsLayout->addWidget(m_pFormatComboBox, 5, 1); 209 pSettingsLayout->addWidget(m_pManifestCheckbox, 6, 0, 1, 2); 272 m_pManifestCheckbox = new QCheckBox; 273 if (m_pManifestCheckbox) 274 { 275 /* Add into layout: */ 276 pSettingsLayout->addWidget(m_pManifestCheckbox, 6, 0, 1, 2); 277 } 210 278 } 279 280 /* Add into layout: */ 281 pMainLayout->addWidget(m_pSettingsCnt, 2, 0, 1, 2); 211 282 } 212 213 /* Add into layout: */214 pMainLayout->addWidget(m_pSelectorCnt, 0, 0);215 pMainLayout->addWidget(m_pApplianceCnt, 0, 1);216 pMainLayout->addWidget(m_pTypeCnt, 1, 0, 1, 2);217 pMainLayout->addWidget(m_pSettingsCnt, 2, 0, 1, 2);218 219 /* Populate VM selector items: */220 populateVMSelectorItems(selectedVMNames);221 /* Choose default storage type: */222 chooseDefaultStorageType();223 /* Choose default settings: */224 chooseDefaultSettings();225 283 } 284 285 /* Populate VM selector items: */ 286 populateVMSelectorItems(selectedVMNames); 287 /* Choose default storage type: */ 288 chooseDefaultStorageType(); 289 /* Choose default settings: */ 290 chooseDefaultSettings(); 226 291 227 292 /* Setup connections: */ … … 235 300 connect(m_pBucketEditor, &QLineEdit::textChanged, this, &UIWizardExportAppPageExpert::completeChanged); 236 301 connect(m_pFileSelector, &UIEmptyFilePathSelector::pathChanged, this, &UIWizardExportAppPageExpert::completeChanged); 302 connect(m_pFormatComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), 303 this, &UIWizardExportAppPageExpert::sltHandleFormatComboChange); 237 304 238 305 /* Register classes: */ … … 252 319 registerField("path", this, "path"); 253 320 registerField("applianceWidget", this, "applianceWidget"); 254 }255 256 void UIWizardExportAppPageExpert::sltVMSelectionChangeHandler()257 {258 /* Call to base-class: */259 refreshCurrentSettings();260 refreshApplianceSettingsWidget();261 262 /* Broadcast complete-change: */263 emit completeChanged();264 }265 266 void UIWizardExportAppPageExpert::sltStorageTypeChangeHandler()267 {268 /* Call to base-class: */269 refreshCurrentSettings();270 271 /* Broadcast complete-change: */272 emit completeChanged();273 }274 275 void UIWizardExportAppPageExpert::sltHandleFormatComboChange()276 {277 refreshCurrentSettings();278 updateFormatComboToolTip();279 321 } 280 322 … … 322 364 retranslateUi(); 323 365 324 /* Call to base-class: */366 /* Refresh current settings: */ 325 367 refreshCurrentSettings(); 326 368 refreshApplianceSettingsWidget(); … … 340 382 { 341 383 const QString &strFile = m_pFileSelector->path().toLower(); 342 bool fOVF = field("format").toString() == "ovf-0.9"343 || field("format").toString() == "ovf-1.0"344 || field("format").toString() == "ovf-2.0";345 bool fOPC = field("format").toString() == "opc-1.0";384 const bool fOVF = field("format").toString() == "ovf-0.9" 385 || field("format").toString() == "ovf-1.0" 386 || field("format").toString() == "ovf-2.0"; 387 const bool fOPC = field("format").toString() == "opc-1.0"; 346 388 fResult = ( fOVF 347 389 && VBoxGlobal::hasAllowedExtension(strFile, OVFFileExts)) … … 350 392 if (fResult) 351 393 { 352 StorageType st= storageType();353 switch ( st)394 const StorageType enmStorageType = storageType(); 395 switch (enmStorageType) 354 396 { 355 397 case Filesystem: … … 391 433 return fResult; 392 434 } 435 436 void UIWizardExportAppPageExpert::sltVMSelectionChangeHandler() 437 { 438 /* Refresh current settings: */ 439 refreshCurrentSettings(); 440 refreshApplianceSettingsWidget(); 441 442 /* Broadcast complete-change: */ 443 emit completeChanged(); 444 } 445 446 void UIWizardExportAppPageExpert::sltStorageTypeChangeHandler() 447 { 448 /* Refresh current settings: */ 449 refreshCurrentSettings(); 450 451 /* Broadcast complete-change: */ 452 emit completeChanged(); 453 } 454 455 void UIWizardExportAppPageExpert::sltHandleFormatComboChange() 456 { 457 /* Refresh current settings: */ 458 refreshCurrentSettings(); 459 updateFormatComboToolTip(); 460 } -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportAppPageExpert.h
r72916 r72920 65 65 QVariant fieldImp(const QString &strFieldName) const { return UIWizardPage::field(strFieldName); } 66 66 67 /** Handles translation event. */ 68 virtual void retranslateUi() /* override */; 69 70 /** Performs page initialization. */ 71 virtual void initializePage() /* override */; 72 73 /** Returns whether page is complete. */ 74 virtual bool isComplete() const /* override */; 75 76 /** Performs page validation. */ 77 virtual bool validatePage() /* override */; 78 67 79 private slots: 68 80 … … 78 90 private: 79 91 80 /** Wraps wizard field API, calling it with certain @a strFieldName argument. */81 QVariant field(const QString &strFieldName) const { return UIWizardPage::field(strFieldName); }82 83 /** Handles translation event. */84 void retranslateUi();85 86 /** Performs page initialization. */87 void initializePage();88 89 /** Returns whether page is complete. */90 bool isComplete() const;91 /** Performs page validation. */92 bool validatePage();93 94 92 /** Holds the VM selector container instance. */ 95 93 QGroupBox *m_pSelectorCnt;
Note:
See TracChangeset
for help on using the changeset viewer.