KiCad PCB EDA Suite
aboutinfo.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2014 Rafael Sokolowski <[email protected]>
5 * Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.TXT for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, you may find one here:
19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20 * or you may search the http://www.gnu.org website for the version 2 license,
21 * or you may write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23 */
24
25#ifndef ABOUTAPPINFO_H
26#define ABOUTAPPINFO_H
27
28#include <wx/aboutdlg.h>
29#include <wx/bitmap.h>
30#include <wx/dynarray.h>
31
33
34class CONTRIBUTOR;
35
37
38
45{
46public:
48 virtual ~ABOUT_APP_INFO() {};
49
50 void AddDeveloper( const CONTRIBUTOR* developer )
51 {
52 if( developer != NULL )
53 mDevelopers.Add( developer );
54 }
55
56 void AddDocWriter( const CONTRIBUTOR* docwriter )
57 {
58 if( docwriter != NULL )
59 mDocWriters.Add( docwriter );
60 }
61
62 void AddLibrarian( const CONTRIBUTOR* aLibrarian )
63 {
64 if( aLibrarian )
65 mLibrarians.Add( aLibrarian );
66 }
67
68 void AddArtist( const CONTRIBUTOR* artist )
69 {
70 if( artist != NULL )
71 mArtists.Add( artist );
72 }
73
74 void AddTranslator( const CONTRIBUTOR* translator )
75 {
76 if( translator != NULL )
77 mTranslators.Add( translator );
78 }
79
80 void AddPackager( const CONTRIBUTOR* packager )
81 {
82 if( packager != NULL )
83 mPackagers.Add( packager );
84 }
85
86 CONTRIBUTORS GetDevelopers() { return mDevelopers; }
87 CONTRIBUTORS GetDocWriters() { return mDocWriters; }
88 CONTRIBUTORS GetLibrarians() { return mLibrarians; }
89 CONTRIBUTORS GetArtists() { return mArtists; }
90 CONTRIBUTORS GetTranslators() { return mTranslators; }
91 CONTRIBUTORS GetPackagers() { return mPackagers; }
92
93 void SetDescription( const wxString& text ) { description = text; }
94 wxString& GetDescription() { return description; }
95
96 void SetLicense( const wxString& text ) { license = text; }
97 wxString& GetLicense() { return license; }
98
99 void SetCopyright( const wxString& text ) { copyright = text; }
100 wxString GetCopyright() { return copyright; }
101
102 void SetAppName( const wxString& name ) { appName = name; }
103 wxString& GetAppName() { return appName; }
104
105 void SetBuildVersion( const wxString& version ) { buildVersion = version; }
106 wxString& GetBuildVersion() { return buildVersion; }
107
108 void SetBuildDate( const wxString& date ) { buildDate = date; }
109 wxString& GetBuildDate() { return buildDate; }
110
111 void SetLibVersion( const wxString& version ) { libVersion = version; }
112 wxString& GetLibVersion() { return libVersion; }
113
114 void SetAppIcon( const wxIcon& aIcon ) { m_appIcon = aIcon; }
115 wxIcon& GetAppIcon() { return m_appIcon; }
116
118 wxBitmap* CreateKiBitmap( BITMAPS aBitmap )
119 {
120 m_bitmaps.emplace_back( KiBitmapNew( aBitmap ) );
121 return m_bitmaps.back().get();
122 }
123
124private:
125 CONTRIBUTORS mDevelopers;
126 CONTRIBUTORS mDocWriters;
127 CONTRIBUTORS mLibrarians;
128 CONTRIBUTORS mArtists;
129 CONTRIBUTORS mTranslators;
130 CONTRIBUTORS mPackagers;
131
132 wxString description;
133 wxString license;
134
135 wxString copyright;
136 wxString appName;
137 wxString buildVersion;
138 wxString buildDate;
139 wxString libVersion;
140
141 wxIcon m_appIcon;
142
144 std::vector<std::unique_ptr<wxBitmap>> m_bitmaps;
145};
146
147
161{
162public:
163 CONTRIBUTOR( const wxString& aName,
164 const wxString& aExtra = wxEmptyString,
165 const wxString& aUrl = wxEmptyString,
166 const wxString& aCategory = wxEmptyString,
167 wxBitmap* aIcon = NULL )
168 {
169 m_checked = false;
170 m_name = aName;
171 m_url = aUrl,
172 m_extra = aExtra;
173 m_category = aCategory;
174 m_icon = aIcon;
175 }
176
177 CONTRIBUTOR( const wxString& aName,
178 const wxString& aCategory,
179 wxBitmap* aIcon )
180 {
181 m_checked = false;
182 m_name = aName;
183 m_url = wxEmptyString,
184 m_extra = wxEmptyString;
185 m_category = aCategory;
186 m_icon = aIcon;
187 }
188
189 virtual ~CONTRIBUTOR() {}
190
191 wxString& GetName() { return m_name; }
192 wxString& GetExtra() { return m_extra; }
193 wxString& GetUrl() { return m_url; }
194 wxString& GetCategory() { return m_category; }
195 wxBitmap* GetIcon() { return m_icon; }
196 void SetChecked( bool status ) { m_checked = status; }
197 bool IsChecked() { return m_checked; }
198
199private:
200 wxString m_name;
201 wxString m_extra;
202 wxString m_url;
203 wxString m_category;
204 wxBitmap* m_icon;
206};
207
208#endif // ABOUTAPPINFO_H
const char * name
Definition: DXF_plotter.cpp:56
WX_DECLARE_OBJARRAY(CONTRIBUTOR, CONTRIBUTORS)
wxBitmap * KiBitmapNew(BITMAPS aBitmap)
Allocate a wxBitmap on heap from a memory record, held in a BITMAPS.
Definition: bitmap.cpp:207
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:33
An object of this class is meant to be used to store application specific information like who has co...
Definition: aboutinfo.h:45
void AddDocWriter(const CONTRIBUTOR *docwriter)
Definition: aboutinfo.h:56
CONTRIBUTORS GetPackagers()
Definition: aboutinfo.h:91
wxString buildDate
Definition: aboutinfo.h:138
CONTRIBUTORS GetLibrarians()
Definition: aboutinfo.h:88
wxString description
Definition: aboutinfo.h:132
std::vector< std::unique_ptr< wxBitmap > > m_bitmaps
Definition: aboutinfo.h:144
wxString GetCopyright()
Definition: aboutinfo.h:100
CONTRIBUTORS mArtists
Definition: aboutinfo.h:128
wxString & GetLibVersion()
Definition: aboutinfo.h:112
wxString & GetAppName()
Definition: aboutinfo.h:103
CONTRIBUTORS GetDevelopers()
Definition: aboutinfo.h:86
void SetBuildDate(const wxString &date)
Definition: aboutinfo.h:108
void AddTranslator(const CONTRIBUTOR *translator)
Definition: aboutinfo.h:74
CONTRIBUTORS GetDocWriters()
Definition: aboutinfo.h:87
wxString & GetBuildVersion()
Definition: aboutinfo.h:106
wxString copyright
Definition: aboutinfo.h:135
wxString & GetBuildDate()
Definition: aboutinfo.h:109
CONTRIBUTORS mDevelopers
Definition: aboutinfo.h:125
CONTRIBUTORS mTranslators
Definition: aboutinfo.h:129
void AddDeveloper(const CONTRIBUTOR *developer)
Definition: aboutinfo.h:50
void SetAppName(const wxString &name)
Definition: aboutinfo.h:102
void SetDescription(const wxString &text)
Definition: aboutinfo.h:93
wxString appName
Definition: aboutinfo.h:136
CONTRIBUTORS mLibrarians
Definition: aboutinfo.h:127
void SetLibVersion(const wxString &version)
Definition: aboutinfo.h:111
CONTRIBUTORS mPackagers
Definition: aboutinfo.h:130
wxString libVersion
Definition: aboutinfo.h:139
wxString & GetDescription()
Definition: aboutinfo.h:94
wxBitmap * CreateKiBitmap(BITMAPS aBitmap)
Definition: aboutinfo.h:118
void AddArtist(const CONTRIBUTOR *artist)
Definition: aboutinfo.h:68
void SetBuildVersion(const wxString &version)
Definition: aboutinfo.h:105
CONTRIBUTORS GetTranslators()
Definition: aboutinfo.h:90
virtual ~ABOUT_APP_INFO()
Definition: aboutinfo.h:48
wxString license
Definition: aboutinfo.h:133
wxIcon m_appIcon
Bitmaps to be freed when the dialog is closed.
Definition: aboutinfo.h:141
void SetAppIcon(const wxIcon &aIcon)
Definition: aboutinfo.h:114
CONTRIBUTORS GetArtists()
Definition: aboutinfo.h:89
wxIcon & GetAppIcon()
Wrapper to manage memory allocation for bitmaps.
Definition: aboutinfo.h:115
wxString & GetLicense()
Definition: aboutinfo.h:97
void SetLicense(const wxString &text)
Definition: aboutinfo.h:96
CONTRIBUTORS mDocWriters
Definition: aboutinfo.h:126
void SetCopyright(const wxString &text)
Definition: aboutinfo.h:99
void AddLibrarian(const CONTRIBUTOR *aLibrarian)
Definition: aboutinfo.h:62
wxString buildVersion
Definition: aboutinfo.h:137
void AddPackager(const CONTRIBUTOR *packager)
Definition: aboutinfo.h:80
A contributor, a person which was involved in the development of the application or which has contrib...
Definition: aboutinfo.h:161
wxString m_category
Definition: aboutinfo.h:203
CONTRIBUTOR(const wxString &aName, const wxString &aCategory, wxBitmap *aIcon)
Definition: aboutinfo.h:177
wxString & GetName()
Definition: aboutinfo.h:191
bool m_checked
Definition: aboutinfo.h:205
CONTRIBUTOR(const wxString &aName, const wxString &aExtra=wxEmptyString, const wxString &aUrl=wxEmptyString, const wxString &aCategory=wxEmptyString, wxBitmap *aIcon=NULL)
Definition: aboutinfo.h:163
wxString & GetUrl()
Definition: aboutinfo.h:193
wxString & GetExtra()
Definition: aboutinfo.h:192
wxString & GetCategory()
Definition: aboutinfo.h:194
wxString m_url
Definition: aboutinfo.h:202
wxString m_extra
Definition: aboutinfo.h:201
wxBitmap * GetIcon()
Definition: aboutinfo.h:195
virtual ~CONTRIBUTOR()
Definition: aboutinfo.h:189
bool IsChecked()
Definition: aboutinfo.h:197
wxString m_name
Definition: aboutinfo.h:200
wxBitmap * m_icon
Definition: aboutinfo.h:204
void SetChecked(bool status)
Definition: aboutinfo.h:196