[vbox-dev] VirtualBox Coding questions

Frank Mehnert frank.mehnert at oracle.com
Sun Jan 8 09:14:42 GMT 2012


On Sunday 08 January 2012 02:17:49 Alexey Eromenko wrote:
> I'm trying to modify VirtualBox GUI to include my new feature
> (vbox-unattended).
> 
> In file "src/VBox/Frontends/VirtualBox/src/wizards/newvm/UINewVMWzd.cpp"
> (vbox SVN) I see:
> UINewVMWzdPage5::constructMachine()
> {
>   ...
>   m.AttachDevice(ctrDvdName, 1, 0, KDeviceType_DVD, CMedium());
> }
> 
> I try to change the code to open DVD medium:
> 
>               QString isopath = "/tmp/cd1.iso";
>               CMedium mymedium = vboxGlobal().openMedium(isopath,
> KDeviceType_DVD, KAccessMode_ReadOnly, 0);
>               m.AttachDevice(ctrDvdName, 1, 0, KDeviceType_DVD, mymedium);
> 
> I get compiling error:
> 
> /home/user/Linstall/vbox/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UI
> NewVMWzd.cpp: In member function ‘bool
> UINewVMWzdPage5::constructMachine()’:
> /home/user/Linstall/vbox/src/VBox/Frontends/VirtualBox/src/wizards/newvm/UI
> NewVMWzd.cpp:901: error: no matching function for call to
> ‘VBoxGlobal::openMedium(QString&, KDeviceType, KAccessMode, int)’
> /home/user/Linstall/vbox/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlob
> al.h:631: note: candidates are: QString
> VBoxGlobal::openMedium(VBoxDefs::MediumType, QString, QWidget*)
> ...
> 
> What would be the correct way ?

The correct way is to pass the correct parameters in the correct order as
it was told you in the error message. The first parameter is the MediumType
(KDeviceType_DVD), the second parameter is the path (isopath), the third
parameter is a Widget and can be NULL. See the prototype of that function
in src/globals/VBoxGlobal.h and other usages of vboxGlobal().openMedium()
in the code.

Kind regards,

Frank
-- 
Dr.-Ing. Frank Mehnert
Senior Manager Software Development Desktop Virtualization, VirtualBox
ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt, Germany

Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20120108/e66d944b/attachment.sig>


More information about the vbox-dev mailing list