Power System Platform  2026w11a-beta
Loading...
Searching...
No Matches
AboutForm.cpp
1/*
2 * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br>
3 *
4 * This program 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 * any later version.
8 *
9 * This program 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.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#include "AboutForm.h"
19#include "../utils/Path.h"
20
21AboutForm::AboutForm(wxWindow* parent) : AboutFormBase(parent) { Init(); }
22AboutForm::~AboutForm() {}
23void AboutForm::Init()
24{
25 // Set program version. Format: (Alpha/Beta/Release) (YEAR)w(WEEK)(a/b/c/...)
26 m_staticTextVersion->SetLabel("2026w11b-beta");
27
28 // Create developers table
29 m_gridCredits->EnableGridLines(false);
30 wxFont headerFont = m_gridCredits->GetDefaultCellFont();
31 headerFont.SetWeight(wxFONTWEIGHT_BOLD);
32 headerFont.SetPointSize(headerFont.GetPointSize() + 1);
33 wxColour headerColour(200, 200, 200);
34 wxColour hyperlinkColour(6, 69, 173);
35
36 m_gridCredits->AppendCols(3);
37 m_gridCredits->AppendRows(6);
38 m_gridCredits->HideColLabels();
39 m_gridCredits->HideRowLabels();
40 m_gridCredits->SetCellSize(0, 0, 1, 3);
41 m_gridCredits->SetCellSize(3, 0, 1, 3);
42
43 m_gridCredits->SetCellValue(0, 0, _("Developers"));
44 m_gridCredits->SetCellAlignment(0, 0, wxALIGN_CENTRE, wxALIGN_CENTRE);
45 m_gridCredits->SetCellBackgroundColour(0, 0, headerColour);
46 m_gridCredits->SetCellFont(0, 0, headerFont);
47 m_gridCredits->SetCellValue(1, 0, wxT("Thales Lima Oliveira"));
48 m_gridCredits->SetCellValue(1, 1, _("Main developer and project admin"));
49 m_gridCredits->SetCellValue(1, 2, wxT("thales@ufu.br"));
50
51 m_gridCredits->SetRowMinimalHeight(2, 30);
52
53 m_gridCredits->SetCellValue(3, 0, _("Contributors / Special Thanks"));
54 m_gridCredits->SetCellAlignment(3, 0, wxALIGN_CENTRE, wxALIGN_CENTRE);
55 m_gridCredits->SetCellBackgroundColour(3, 0, headerColour);
56 m_gridCredits->SetCellFont(3, 0, headerFont);
57 // Caixeta
58 m_gridCredits->SetCellValue(4, 0, wxT("Geraldo Caixeta Guimar") + static_cast<wxString>(L'\u00E3') + wxT("es"));
59 m_gridCredits->SetCellValue(4, 1, _("Chief advisor"));
60 m_gridCredits->SetCellValue(4, 2, wxT("gcaixeta@ufu.br"));
61 // Marcio Tamashiro
62 //m_gridCredits->SetCellValue(5, 0, wxT("M") + static_cast<wxString>(L'\u00E1') + wxT("rcio Augusto Tamashiro"));
63 m_gridCredits->SetCellValue(5, 0, wxT("Márcio Augusto Tamashiro"));
64 m_gridCredits->SetCellValue(5, 1, "");
65 m_gridCredits->SetCellValue(5, 2, wxT("tamashiro@ifto.edu.br"));
66
67 for(int i = 0; i < m_gridCredits->GetNumberRows(); ++i) {
68 m_gridCredits->SetCellTextColour(i, 2, hyperlinkColour);
69 }
70
71 m_gridCredits->AutoSize();
72
73 // Last col size
74 int lastColSize = m_notebook->GetPage(1)->GetSize().GetWidth();
75 int lastColNumber = m_gridCredits->GetNumberCols() - 1;
76 for(int i = 0; i < lastColNumber; ++i) {
77 lastColSize -= m_gridCredits->GetColSize(i);
78 }
79 m_gridCredits->SetColSize(lastColNumber, lastColSize);
80 m_gridCredits->SetSize(m_notebook->GetPage(1)->GetSize());
81
82 // Load license file
83 wxString licenseStr = "";
84 wxTextFile file;
85 //wxFileName fn(wxStandardPaths::Get().GetExecutablePath());
86 wxString licensePath = Paths::GetDataPath() + "/LICENSE";
87 if(!file.Open(licensePath)) {
88 // Error message
89 } else {
90 licenseStr += file.GetFirstLine() + "\n";
91 while(!file.Eof()) {
92 licenseStr += file.GetNextLine() + "\n";
93 }
94 }
95 wxFont font = m_richTextCtrlLicense->GetFont();
96 font.SetFamily(wxFONTFAMILY_TELETYPE);
97 m_richTextCtrlLicense->SetFont(font);
98 m_richTextCtrlLicense->SetEditable(false);
99 m_richTextCtrlLicense->AppendText(licenseStr);
100}