You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
5.2 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2014 Rafael Sokolowski <Rafael.Sokolowski@web.de>
  5. * Copyright (C) 2014-2015 KiCad Developers, see CHANGELOG.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. #ifndef ABOUTAPPINFO_H
  25. #define ABOUTAPPINFO_H
  26. #include <wx/aboutdlg.h>
  27. #include <wx/bitmap.h>
  28. #include <wx/dynarray.h>
  29. class Contributor;
  30. WX_DECLARE_OBJARRAY( Contributor, Contributors );
  31. /**
  32. * An object of this class is meant to be used to store application specific information
  33. * like who has contributed in which area of the application, the license, copyright
  34. * and other descriptive information.
  35. */
  36. class AboutAppInfo
  37. {
  38. public:
  39. AboutAppInfo() {};
  40. virtual ~AboutAppInfo() {};
  41. void AddDeveloper( const Contributor* developer )
  42. {
  43. if( developer != NULL )
  44. developers.Add( developer );
  45. }
  46. void AddDocWriter( const Contributor* docwriter )
  47. {
  48. if( docwriter != NULL )
  49. docwriters.Add( docwriter );
  50. }
  51. void AddArtist( const Contributor* artist )
  52. {
  53. if( artist != NULL )
  54. artists.Add( artist );
  55. }
  56. void AddTranslator( const Contributor* translator )
  57. {
  58. if( translator != NULL )
  59. translators.Add( translator );
  60. }
  61. void AddPackager( const Contributor* packager )
  62. {
  63. if( packager != NULL )
  64. packagers.Add( packager );
  65. }
  66. Contributors GetDevelopers() { return developers; }
  67. Contributors GetDocWriters() { return docwriters; }
  68. Contributors GetArtists() { return artists; }
  69. Contributors GetTranslators() { return translators; }
  70. Contributors GetPackagers() { return packagers; }
  71. void SetDescription( const wxString& text ) { description = text; }
  72. wxString& GetDescription() { return description; }
  73. void SetLicense( const wxString& text ) { license = text; }
  74. wxString& GetLicense() { return license; }
  75. void SetCopyright( const wxString& text ) { copyright = text; }
  76. wxString GetCopyright()
  77. {
  78. wxString copyrightText = copyright;
  79. #if wxUSE_UNICODE
  80. const wxString utf8_copyrightSign = wxString::FromUTF8( "\xc2\xa9" );
  81. copyrightText.Replace( _T( "(c)" ), utf8_copyrightSign );
  82. copyrightText.Replace( _T( "(C)" ), utf8_copyrightSign );
  83. #endif // wxUSE_UNICODE
  84. return copyrightText;
  85. }
  86. void SetAppName( const wxString& name ) { appName = name; }
  87. wxString& GetAppName() { return appName; }
  88. void SetBuildVersion( const wxString& version ) { buildVersion = version; }
  89. wxString& GetBuildVersion() { return buildVersion; }
  90. void SetLibVersion( const wxString& version ) { libVersion = version; }
  91. wxString& GetLibVersion() { return libVersion; }
  92. void SetIcon( const wxIcon& icon ) { appIcon = icon; }
  93. wxIcon& GetIcon() { return appIcon; }
  94. private:
  95. Contributors developers;
  96. Contributors docwriters;
  97. Contributors artists;
  98. Contributors translators;
  99. Contributors packagers;
  100. wxString description;
  101. wxString license;
  102. wxString copyright; // Todo: copyright sign in unicode
  103. wxString appName;
  104. wxString buildVersion;
  105. wxString libVersion;
  106. wxIcon appIcon;
  107. };
  108. /**
  109. * A contributor, a person which was involved in the development of the application
  110. * or which has contributed in any kind somehow to the project.
  111. *
  112. * A contributor consists of the following mandatory information:
  113. * - Name
  114. * - EMail address
  115. *
  116. * Each contributor can have optional information assigned like:
  117. * - A category
  118. * - A category specific icon
  119. */
  120. class Contributor
  121. {
  122. public:
  123. Contributor( const wxString& name,
  124. const wxString& email,
  125. const wxString& category = wxEmptyString,
  126. wxBitmap* icon = NULL ) :
  127. m_checked( false )
  128. { m_name = name; m_email = email; m_category = category; m_icon = icon; }
  129. virtual ~Contributor() {}
  130. wxString& GetName() { return m_name; }
  131. wxString& GetEMail() { return m_email; }
  132. wxString& GetCategory() { return m_category; }
  133. wxBitmap* GetIcon() { return m_icon; }
  134. void SetChecked( bool status ) { m_checked = status; }
  135. bool IsChecked() { return m_checked; }
  136. private:
  137. wxString m_name;
  138. wxString m_email;
  139. wxString m_category;
  140. wxBitmap* m_icon;
  141. bool m_checked;
  142. };
  143. #endif // ABOUTAPPINFO_H