1 /******************************************************************************
3 * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/) *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License *
7 * as published by the Free Software Foundation; either version 2 *
8 * of the License, or (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software Foundation *
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ******************************************************************************/
20 #include "icinga-studio/connectform.hpp"
21 #include "icinga-studio/mainform.hpp"
22 #include "base/application.hpp"
25 #include <wx/config.h>
27 using namespace icinga;
29 class IcingaStudio : public wxApp
32 virtual bool OnInit(void) override
34 Application::InitializeBase();
39 wxConfig config("IcingaStudio");
42 if (!config.Read("url", &wUrl))
43 wUrl = "https://localhost:5665/";
45 std::string url = wUrl.ToStdString();
47 ConnectForm f(NULL, new Url(url));
48 if (f.ShowModal() != wxID_OK)
52 url = pUrl->Format(true);
54 config.Write("url", wUrl);
56 pUrl = new Url(argv[1].ToStdString());
59 MainForm *m = new MainForm(NULL, pUrl);
66 wxIMPLEMENT_APP(IcingaStudio);