www.pudn.com > kceasy-0.19-rc1-src.rar > Brand.cpp


/* 
This file is part of KCeasy (http://www.kceasy.com) 
Copyright (C) 2002-2004 Markus Kern  
 
This program is free software; you can redistribute it and/or 
modify it under the terms of the GNU General Public License 
as published by the Free Software Foundation; either version 2 
of the License, or (at your option) any later version. 
 
This program is distributed in the hope that it will be useful, 
but WITHOUT ANY WARRANTY; without even the implied warranty of 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
GNU General Public License for more details. 
*/ 
//--------------------------------------------------------------------------- 
#pragma hdrstop 
#include "Brand.h" 
//--------------------------------------------------------------------------- 
#pragma package(smart_init) 
 
TBrand* TBrand::Create() 
{ 
    return new TBrand(); 
} 
 
// protected constructor 
TBrand::TBrand() 
{ 
} 
 
TBrand::~TBrand() 
{ 
} 
 
unsigned int TBrand::GetMajorVersion() 
{ 
    return BRAND_MAJOR_VERSION; 
} 
 
unsigned int TBrand::GetMinorVersion() 
{ 
    return BRAND_MINOR_VERSION; 
} 
 
AnsiString TBrand::GetExtraVersion() 
{ 
    return AnsiString(BRAND_EXTRA_VERSION); 
} 
 
AnsiString TBrand::GetVersionString() 
{ 
/* 
    AnsiString res; 
 
    res += AnsiString(GetMajorVersion()) + "."; 
    res += AnsiString(GetMinorVersion()); 
    if(GetExtraVersion().Length() > 0) 
        res += AnsiString("-") + GetExtraVersion(); 
 
    return res; 
*/ 
    return AnsiString(BRAND_VERSION_STRING); 
} 
 
AnsiString TBrand::GetBuildDate() 
{ 
    return AnsiString(BRAND_BUILD_DATE); 
} 
 
// returns "app={AppName}&version=x.y-z" 
string TBrand::GetUrlSignature() 
{ 
    string Signature("app="); 
 
    Signature += GetAppName().c_str(); 
    Signature += "&version="; 
    Signature += int_to_string(GetMajorVersion()) + "."; 
    Signature += int_to_string(GetMinorVersion()); 
 
    if(GetExtraVersion().Length() > 0) 
        Signature += string("-") + GetExtraVersion().c_str(); 
 
    return Signature; 
} 
 
string TBrand::GetAutoUpdateUrl() 
{ 
    return BRAND_AUTO_UPDATE_URL; 
} 
 
string TBrand::GetBanlistUpdateUrl() 
{ 
    return BRAND_BANLIST_UPDATE_URL; 
} 
 
// returns application name, eg.g "KCeasy" 
AnsiString TBrand::GetAppName() 
{ 
    return AnsiString(BRAND_APP_NAME); 
} 
 
// returns string with all instances of "{AppName}" replaced by application name 
AnsiString TBrand::ReplaceAppName(const AnsiString& Str) 
{ 
    AnsiString res = Str; 
    int pos; 
 
    while((pos = res.AnsiPos("{AppName}")) != 0) { 
        res.Delete(pos,strlen("{AppName}")); 
        res.Insert(BRAND_APP_NAME,pos); 
    } 
    return res; 
} 
 
WideString TBrand::ReplaceAppName(const WideString& Str) 
{ 
    WideString res = Str; 
    int pos; 
 
    while((pos = res.Pos("{AppName}")) != 0) { 
        res.Delete(pos,strlen("{AppName}")); 
        res.Insert(BRAND_APP_NAME,pos); 
    } 
    return res; 
} 
 
// returns application website and contact email 
AnsiString TBrand::GetAppWebsite() 
{ 
    return BRAND_APP_WEBSITE; 
} 
 
AnsiString TBrand::GetSupportEmail() 
{ 
    return BRAND_SUPPORT_EMAIL; 
} 
 
AnsiString TBrand::GetOnlineHelpUrl() 
{ 
    return BRAND_ONLINE_HELP_URL; 
} 
 
// returns 48x53 pixel logo with gray background 
// used in AboutForm, AutoUpdateForm 
TPicture* TBrand::GetLogo48Gray() 
{ 
    TPicture* Picture = new TPicture(); 
    Picture->Bitmap->LoadFromResourceID(NULL, BRAND_LOGO48_GRAY); 
    return Picture; 
} 
 
// returns 48x53 pixel logo with white background 
// used in ConfigWizardForm 
TPicture* TBrand::GetLogo48White() 
{ 
    TPicture* Picture = new TPicture(); 
    Picture->Bitmap->LoadFromResourceID(NULL, BRAND_LOGO48_WHITE); 
    return Picture; 
}