Use new vnc syntax (with a colon).
[qemu-gui.git] / vm.h
blob947b52e985e50e80f92287a3388de710f6a4162a
1 #ifndef QEMU_GUI_VM
2 #define QEMU_GUI_VM
4 #include <wx/wfstream.h>
5 #include <wx/fileconf.h>
6 #include "pipedprocess.h"
8 class MonitorSocket;
10 class QemuVM : public wxEvtHandler {
11 public:
12 QemuVM(const wxString& configfile);
13 ~QemuVM();
14 wxString GetTitle();
15 void SetTitle(const wxString&);
16 wxString GetCmdline();
17 wxString GetCmdlineArguments();
18 void SetCmdlineArguments(const wxString&);
20 /**
21 * returns the associated config file of this vm
23 wxString GetConfigFile();
24 wxString GetPath();
25 void SaveConfig(const wxString& configfile);
26 void SaveConfig();
28 long PowerOn();
29 void Suspend();
30 void Pause();
31 void Continue();
32 void Reset();
33 void PowerOff();
34 void Kill();
35 bool IsRunning();
36 bool IsPaused();
37 bool IsPoweredOff();
38 void Snapshot();
39 void Revert();
40 bool HasSnapshot();
42 /**
43 * 0=>hda,1=>hdb ...
45 wxString GetHd(const int hd);
46 void SetHd(const int hd,const wxString& image);
47 wxString GetCdRom();
48 void SetCdRom(const wxString& image);
49 wxString GetFd(const int fd);
50 void SetFd(const int fd,const wxString& image);
51 int GetMemory();
52 void SetMemory(const int memory);
53 int GetSmp();
54 void SetSmp(const int);
55 wxString GetSMB();
56 void SetSMB(const wxString&);
57 wxString GetTFTP();
58 void SetTFTP(const wxString&);
59 wxString GetBoot();
60 void SetBoot(const wxString& boot);
61 bool GetWin2kHack();
62 void SetWin2kHack(bool);
63 bool GetLocalTime();
64 void SetLocalTime(bool);
65 bool GetStdVga();
66 void SetStdVga(bool);
67 bool GetNoACPI();
68 void SetNoACPI(bool);
69 bool GetSnapshotMode();
70 void SetSnapshotMode(bool);
71 wxString GetKeyboardLayout();
72 void SetKeyboardLayout(const wxString&);
73 int GetCurrentMonitorPort();
74 int GetMonitorPort();
75 void SetMonitorPort(const int port);
76 /* get the vncdisplay which is currently used by the vm */
77 int GetCurrentVNCDisplay();
78 /* get the vncdisplay as stored in the config file */
79 int GetVNCDisplay();
80 void SetVNCDisplay(const int display);
82 void ConnectCdRom(bool state);
83 bool IsCdRomConnected();
85 long GetPID();
86 /**
87 * Returns the asociated qemu process or creates it
89 PipedProcess *GetProcess();
90 MonitorSocket *GetSocket();
91 /**
92 * Adds an eventhandler to the underling PipedProcess
93 * the passed eventhandler will therefore receive
94 * process termination events and so on.
96 void AddEventHandler(wxEvtHandler *handler);
97 wxString SendCommand(const wxString& cmd,bool block = false);
98 void SendKey(const wxString& key);
99 private:
101 * Is connected to the termination event of the associated process
103 void OnProcessTermination(wxCommandEvent& WXUNUSED(event));
105 wxString configfile;
106 wxFileConfig *config;
107 PipedProcess *process;
108 long pid;
109 MonitorSocket *socket;
110 int vncdisplay;
111 static int vncdisplays;
112 int monitorport;
113 static int monitorports;
115 enum vmstates {
116 VM_STATE_RUNNING,
117 VM_STATE_PAUSED,
118 VM_STATE_POWERED_OFF,
119 VM_STATE_SUSPENDED
122 vmstates state;
124 DECLARE_EVENT_TABLE()
127 #endif