2 * Copyright (C) 2006 Marc André Tanner <mat@brain-dump.org>
4 * qemu-gui is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * qemu-gui is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with qemu-gui; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 * QEMU is a trademark of Fabrice Bellard
22 #include <wx/config.h>
23 #include <wx/fileconf.h>
26 #include "mainframe.h"
29 IMPLEMENT_APP(QemuGUI
)
31 QemuMainFrame
*QemuGUI::frame
;
33 bool QemuGUI::OnInit()
35 // init all image handlers otherwhise the images referenced
36 // in welcome.html wouldn't be displayed correctly.
37 wxInitAllImageHandlers();
39 // set up a config object which will be used to store things
40 // like favorites or the filehistory
41 wxFileConfig
*config
= new wxFileConfig(wxT("qemu-ui"));
42 wxConfigBase::Set(config
);
44 frame
= new QemuMainFrame(_T("QEMU GUI"));
45 frame
->LoadFileHistory(wxConfigBase::Get());
52 QemuMainFrame
* QemuGUI::GetMainFrame(){
56 int QemuGUI::OnRun() {
57 // start the main loop
58 return wxApp::OnRun();
61 int QemuGUI::OnExit() {
62 frame
->SaveFileHistory(wxConfigBase::Get());
64 // Set() returns the active config object as Get() does, but unlike
65 // Get() it doesn't try to create one if there is none (definitely
66 // not what we want here!)
67 delete wxConfigBase::Set((wxConfigBase
*) NULL
);
69 // return the standard exit code
70 return wxApp::OnExit();