1 /*
2  Copyright (C) 2010-2014 Kristian Duske
3 
4  This file is part of TrenchBroom.
5 
6  TrenchBroom is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  TrenchBroom is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #include "AppInfoPanel.h"
21 
22 #include "IO/Path.h"
23 #include "IO/ResourceUtils.h"
24 #include "View/GetVersion.h"
25 
26 #include <wx/bitmap.h>
27 #include <wx/sizer.h>
28 #include <wx/statbmp.h>
29 #include <wx/statline.h>
30 #include <wx/stattext.h>
31 
32 namespace TrenchBroom {
33     namespace View {
AppInfoPanel(wxWindow * parent)34         AppInfoPanel::AppInfoPanel(wxWindow* parent) :
35         wxPanel(parent) {
36             createGui();
37         }
38 
createGui()39         void AppInfoPanel::createGui() {
40             const wxBitmap appIconImage = IO::loadImageResource("AppIcon.png");
41             wxStaticBitmap* appIcon = new wxStaticBitmap(this, wxID_ANY, appIconImage);
42             wxStaticText* appName = new wxStaticText(this, wxID_ANY, "TrenchBroom");
43             appName->SetFont(appName->GetFont().Larger().Larger().Larger().Larger().Bold());
44             wxStaticLine* appLine = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL);
45             wxStaticText* appClaim = new wxStaticText(this, wxID_ANY, "Level Editor");
46 
47             wxString versionStr("Version ");
48             versionStr << getBuildVersion() << " " << getBuildChannel();
49 
50             wxString buildStr("Build Type: ");
51             buildStr << getBuildId() << " " << getBuildType();
52 
53             wxStaticText* version = new wxStaticText(this, wxID_ANY, versionStr);
54             wxStaticText* build = new wxStaticText(this, wxID_ANY, buildStr);
55 #if !defined(_WIN32)
56             version->SetFont(version->GetFont().Smaller());
57             build->SetFont(build->GetFont().Smaller());
58 #endif
59             version->SetForegroundColour(wxColor(128, 128, 128));
60             build->SetForegroundColour(wxColor(128, 128, 128));
61 
62             SetBackgroundColour(*wxWHITE);
63 
64             wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
65             sizer->Add(appIcon, 0, wxALIGN_CENTER_HORIZONTAL);
66             sizer->Add(appName, 0, wxALIGN_CENTER_HORIZONTAL);
67             sizer->Add(appLine, 0, wxEXPAND);
68             sizer->Add(appClaim, 0, wxALIGN_CENTER_HORIZONTAL);
69             sizer->Add(version, 0, wxALIGN_CENTER_HORIZONTAL);
70             sizer->Add(build, 0, wxALIGN_CENTER_HORIZONTAL);
71             sizer->AddStretchSpacer();
72             SetSizerAndFit(sizer);
73         }
74     }
75 }
76