- Timestamp:
- Feb 24, 2009 10:44:37 AM (16 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/include/VBoxImportApplianceWgt.h
r17049 r17053 43 43 bool isValid() const { return mAppliance != NULL; } 44 44 45 static int minGuestRAM() { return mMinGuestRAM; } 46 static int maxGuestRAM() { return mMaxGuestRAM; } 47 static int minGuestCPUCount() { return mMinGuestCPUCount; } 48 static int maxGuestCPUCount() { return mMaxGuestCPUCount; } 49 45 50 public slots: 46 51 void restoreDefaults(); … … 50 55 51 56 private: 57 static void initSystemSettings(); 58 52 59 /* Private member vars */ 53 60 CAppliance *mAppliance; 54 61 VirtualSystemModel *mModel; 62 63 static int mMinGuestRAM; 64 static int mMaxGuestRAM; 65 static int mMinGuestCPUCount; 66 static int mMaxGuestCPUCount; 55 67 }; 56 68 -
trunk/src/VBox/Frontends/VirtualBox/include/VBoxImportApplianceWzd.h
r17049 r17053 30 30 class QIWidgetValidator; 31 31 32 class VBoxImportAppliance33 {34 public:35 static void import (QWidget *aParent = NULL);36 37 static int minGuestRAM() { return mMinGuestRAM; }38 static int maxGuestRAM() { return mMaxGuestRAM; }39 static int minGuestCPUCount() { return mMinGuestCPUCount; }40 static int maxGuestCPUCount() { return mMaxGuestCPUCount; }41 42 private:43 /* Private member vars */44 static void initSystemSettings();45 46 static int mMinGuestRAM;47 static int mMaxGuestRAM;48 static int mMinGuestCPUCount;49 static int mMaxGuestCPUCount;50 };51 52 32 class VBoxImportApplianceWzd : public QIWithRetranslateUI<QIAbstractWizard>, 53 33 public Ui::VBoxImportApplianceWzd … … 71 51 72 52 private: 53 /* Private member vars */ 73 54 QIWidgetValidator *mWValFileSelector; 74 55 }; -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxImportApplianceWgt.cpp
r17049 r17053 408 408 { 409 409 QSpinBox *e = new QSpinBox (aParent); 410 e->setRange (VBoxImportAppliance ::minGuestCPUCount(), VBoxImportAppliance::maxGuestCPUCount());410 e->setRange (VBoxImportApplianceWgt::minGuestCPUCount(), VBoxImportApplianceWgt::maxGuestCPUCount()); 411 411 editor = e; 412 412 break; … … 415 415 { 416 416 QSpinBox *e = new QSpinBox (aParent); 417 e->setRange (VBoxImportAppliance ::minGuestRAM(), VBoxImportAppliance::maxGuestRAM());417 e->setRange (VBoxImportApplianceWgt::minGuestRAM(), VBoxImportApplianceWgt::maxGuestRAM()); 418 418 e->setSuffix (" " + VBoxImportApplianceWgt::tr ("MB")); 419 419 editor = e; … … 961 961 // VBoxImportApplianceWgt 962 962 963 int VBoxImportApplianceWgt::mMinGuestRAM = -1; 964 int VBoxImportApplianceWgt::mMaxGuestRAM = -1; 965 int VBoxImportApplianceWgt::mMinGuestCPUCount = -1; 966 int VBoxImportApplianceWgt::mMaxGuestCPUCount = -1; 967 963 968 VBoxImportApplianceWgt::VBoxImportApplianceWgt (QWidget *aParent) 964 969 : QIWithRetranslateUI<QWidget> (aParent) … … 966 971 , mModel (NULL) 967 972 { 973 /* Make sure all static content is properly initialized */ 974 initSystemSettings(); 975 968 976 /* Apply UI decorations */ 969 977 Ui::VBoxImportApplianceWgt::setupUi (this); … … 1088 1096 } 1089 1097 1098 /* static */ 1099 void VBoxImportApplianceWgt::initSystemSettings() 1100 { 1101 if (mMinGuestRAM == -1) 1102 { 1103 /* We need some global defaults from the current VirtualBox 1104 installation */ 1105 CSystemProperties sp = vboxGlobal().virtualBox().GetSystemProperties(); 1106 mMinGuestRAM = sp.GetMinGuestRAM(); 1107 mMaxGuestRAM = sp.GetMaxGuestRAM(); 1108 mMinGuestCPUCount = sp.GetMinGuestCPUCount(); 1109 mMaxGuestCPUCount = sp.GetMaxGuestCPUCount(); 1110 } 1111 } 1112 -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxImportApplianceWzd.cpp
r17049 r17053 29 29 30 30 //////////////////////////////////////////////////////////////////////////////// 31 // VBoxImportAppliance32 33 int VBoxImportAppliance::mMinGuestRAM = -1;34 int VBoxImportAppliance::mMaxGuestRAM = -1;35 int VBoxImportAppliance::mMinGuestCPUCount = -1;36 int VBoxImportAppliance::mMaxGuestCPUCount = -1;37 38 /* static */39 void VBoxImportAppliance::import (QWidget *aParent /* = NULL */)40 {41 initSystemSettings();42 43 VBoxImportApplianceWzd importWzd (aParent);44 if (importWzd.exec() == QDialog::Accepted)45 {46 }47 return;48 49 #if 050 /* We need a file to import; request one from the user */51 QString file = VBoxGlobal::getOpenFileName ("",52 VBoxGlobal::tr ("Open Virtualization Format (%1)").arg ("*.ovf"),53 aParent,54 VBoxGlobal::tr ("Select an appliance to import"));55 // QString file = "/home/poetzsch/projects/innotek/plan9.ovf";56 // QString file = "/Users/poetzsch/projects/innotek/plan9.ovf";57 if (!file.isEmpty())58 {59 CVirtualBox vbox = vboxGlobal().virtualBox();60 /* Create a appliance object */61 CAppliance appliance = vbox.CreateAppliance();62 bool fResult = appliance.isOk();63 if (fResult)64 {65 /* Read the appliance */66 appliance.Read (file);67 fResult = appliance.isOk();68 if (fResult)69 {70 /* Now we have to interpret that stuff */71 appliance.Interpret();72 fResult = appliance.isOk();73 if (fResult)74 {75 /* Let the user do some tuning */76 VBoxImportApplianceWgt settingsDlg (&appliance, aParent);77 if (settingsDlg.exec() == QDialog::Accepted)78 {79 /* Start the import asynchronously */80 CProgress progress;81 progress = appliance.ImportMachines();82 fResult = appliance.isOk();83 if (fResult)84 {85 /* Show some progress, so the user know whats going on */86 vboxProblem().showModalProgressDialog (progress, VBoxImportApplianceWgt::tr ("Importing Appliance ..."), aParent);87 if (!progress.isOk() || progress.GetResultCode() != 0)88 {89 vboxProblem().cannotImportAppliance (progress, appliance);90 return;91 }92 }93 }94 }95 }96 }97 if (!fResult)98 vboxProblem().cannotImportAppliance (appliance);99 }100 #endif101 }102 103 /* static */104 void VBoxImportAppliance::initSystemSettings()105 {106 if (mMinGuestRAM == -1)107 {108 /* We need some global defaults from the current VirtualBox109 installation */110 CSystemProperties sp = vboxGlobal().virtualBox().GetSystemProperties();111 mMinGuestRAM = sp.GetMinGuestRAM();112 mMaxGuestRAM = sp.GetMaxGuestRAM();113 mMinGuestCPUCount = sp.GetMinGuestCPUCount();114 mMaxGuestCPUCount = sp.GetMaxGuestCPUCount();115 }116 }117 118 ////////////////////////////////////////////////////////////////////////////////119 31 // VBoxImportApplianceWzd 120 32 … … 133 45 mFileSelector->setFileDialogTitle (tr ("Select an appliance to import")); 134 46 mFileSelector->setFileFilters (tr ("Open Virtualization Format (%1)").arg ("*.ovf")); 135 // mFileSelector->setPath ("/home/poetzsch/downloads/Appliances/Plan9.ovf");136 47 #ifdef Q_WS_MAC 137 48 /* Editable boxes are uncommon on the Mac */ -
trunk/src/VBox/Frontends/VirtualBox/src/VBoxSelectorWnd.cpp
r17051 r17053 746 746 void VBoxSelectorWnd::fileImportAppliance() 747 747 { 748 VBoxImportAppliance::import (this); 748 VBoxImportApplianceWzd wzd (this); 749 750 wzd.exec(); 749 751 } 750 752
Note:
See TracChangeset
for help on using the changeset viewer.