aboutinfo.h 4.17 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
#ifndef ABOUTAPPINFO_H
#define ABOUTAPPINFO_H

#include <wx/aboutdlg.h>
#include <wx/bitmap.h>
#include <wx/dynarray.h>

class Contributor;

WX_DECLARE_OBJARRAY( Contributor, Contributors );


/**
 * An object of this class is meant to be used to store application specific information
 * like who has contributed in which area of the application, the license, copyright
 * and other descriptive information.
 */
class AboutAppInfo
{
public:
    AboutAppInfo() {};
    virtual ~AboutAppInfo() {};

    void AddDeveloper( const Contributor* developer )   { if( developer  != NULL )
                                                              developers.Add( developer );}
    void AddDocWriter( const Contributor* docwriter )   { if( docwriter  != NULL )
                                                              docwriters.Add( docwriter );}
    void AddArtist( const Contributor* artist )         { if( artist     != NULL )
                                                              artists.Add( artist );}
    void AddTranslator( const Contributor* translator ) { if( translator != NULL )
                                                              translators.Add( translator );}

    Contributors GetDevelopers()  { return developers; }
    Contributors GetDocWriters()  { return docwriters; }
    Contributors GetArtists()     { return artists; }
    Contributors GetTranslators() { return translators; }

    void SetDescription( const wxString& text ) { description = text; }
    wxString& GetDescription() { return description; }

    void SetLicense( const wxString& text ) { license = text; }
    wxString& GetLicense() { return license; }

    void SetCopyright( const wxString& text ) { copyright = text; }
    wxString GetCopyright()
    {
        wxString       copyrightText = copyright;

#if wxUSE_UNICODE
        const wxString utf8_copyrightSign = wxString::FromUTF8( "\xc2\xa9" );
        copyrightText.Replace( _T( "(c)" ), utf8_copyrightSign );
        copyrightText.Replace( _T( "(C)" ), utf8_copyrightSign );
#endif // wxUSE_UNICODE

        return copyrightText;
    }


    void SetAppName( const wxString& name ) { appName = name; }
    wxString& GetAppName() { return appName; }

    void SetBuildVersion( const wxString& version ) { buildVersion = version; }
    wxString& GetBuildVersion() { return buildVersion; }

    void SetLibVersion( const wxString& version ) { libVersion = version; }
    wxString& GetLibVersion() { return libVersion; }

    void SetIcon( const wxIcon& icon ) { appIcon = icon; }
    wxIcon& GetIcon() { return appIcon; }

protected:
private:
    Contributors developers;
    Contributors docwriters;
    Contributors artists;
    Contributors translators;

    wxString     description;
    wxString     license;

    wxString     copyright; // Todo: copyright sign in unicode
    wxString     appName;
    wxString     buildVersion;
    wxString     libVersion;

    wxIcon       appIcon;
};

/**
 * A contributor, a person which was involved in the development of the application
 * or which has contributed in any kind somehow to the project.
 *
 * A contributor consists of the following mandatory information:
 * - Name
 * - EMail address
 *
 * Each contributor can have optional information assigned like:
 * - A category
 * - A category specific icon
 */
class Contributor
{
public:
    Contributor( const wxString& name,
                 const wxString& email,
                 const wxString& category = wxEmptyString,
                 wxBitmap*       icon = NULL ) :
        m_checked( false )
    { m_name = name; m_email = email; m_category = category; m_icon = icon; }
    virtual ~Contributor() {}

    wxString& GetName()     { return m_name; }
    wxString& GetEMail()    { return m_email; }
    wxString& GetCategory() { return m_category; }
    wxBitmap* GetIcon()     { return m_icon; }
    void SetChecked( bool status ) { m_checked = status; }
    bool IsChecked() { return m_checked; }
protected:
private:
    wxString  m_name;
    wxString  m_email;
    wxString  m_category;
    wxBitmap* m_icon;
    bool      m_checked;
};

#endif // ABOUTAPPINFO_H