00001
00002
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "hugin/AboutDialog.h"
00029
00030 #include "base_wx/wxPlatform.h"
00031 #include "panoinc.h"
00032 #include "hugin/huginApp.h"
00033 #include <hugin_version.h>
00034 #include <wx/version.h>
00035 #include "pano13/version.h"
00036 #include "boost/version.hpp"
00037 #include "exiv2/version.hpp"
00038 #include "lensdb/LensDB.h"
00039
00040 BEGIN_EVENT_TABLE(AboutDialog, wxDialog)
00041 EVT_NOTEBOOK_PAGE_CHANGED(XRCID("about_notebook"), AboutDialog::OnChangedTab)
00042 END_EVENT_TABLE()
00043
00044
00045 AboutDialog::AboutDialog(wxWindow *parent)
00046 {
00047 wxString strFile;
00048 wxString langCode;
00049 wxTextCtrl *textCtrl;
00050 m_logoImgCtrl=NULL;
00051 m_mode=0;
00052
00053 wxXmlResource::Get()->LoadDialog(this, parent, wxT("about_dlg"));
00054
00055 #if 0
00056
00057 #if __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
00058
00059 strFile = MacGetPathToBundledResourceFile(CFSTR("about.htm"));
00060 if(strFile!=wxT("")) XRCCTRL(*this,"about_html",wxHtmlWindow)->LoadPage(strFile);
00061 #else
00062
00063 langCode = huginApp::Get()->GetLocale().GetName().Left(2).Lower();
00064 DEBUG_INFO("Lang Code: " << langCode.mb_str(wxConvLocal));
00065 if(langCode != wxString(wxT("en")))
00066 {
00067 strFile = huginApp::Get()->GetXRCPath() + wxT("data/about_") + langCode + wxT(".htm");
00068 if(wxFile::Exists(strFile))
00069 {
00070 DEBUG_TRACE("Using About: " << strFile.mb_str(wxConvLocal));
00071 XRCCTRL(*this,"about_html",wxHtmlWindow)->LoadPage(strFile);
00072 }
00073 }
00074 #endif
00075 #endif
00076
00077
00078
00079 XRCCTRL(*this,"about_version", wxTextCtrl)->ChangeValue(wxString(DISPLAY_VERSION, wxConvLocal));
00080
00081 #ifdef __WXMAC__
00082 wxFont font(10, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
00083 #else
00084 wxFont font(8, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
00085 #endif
00086
00087
00088 textCtrl = XRCCTRL(*this, "license_txt", wxTextCtrl);
00089 strFile = huginApp::Get()->GetXRCPath() + wxT("data/COPYING");
00090 #ifndef _WINDOWS
00091 textCtrl->SetFont(font);
00092 #endif
00093 textCtrl->LoadFile(strFile);
00094
00095
00096 textCtrl = XRCCTRL(*this, "upstream_txt", wxTextCtrl);
00097 strFile = huginApp::Get()->GetXRCPath() + wxT("data/upstream.txt");
00098 #ifndef _WINDOWS
00099 textCtrl->SetFont(font);
00100 #endif
00101 textCtrl->LoadFile(strFile);
00102 GetSystemInformation(&font);
00103
00104
00105 m_about_notebook = XRCCTRL(*this,"about_dlg",wxNotebook);
00106
00107 m_logoImgCtrl = XRCCTRL(*this, "about_logo", wxStaticBitmap);
00108
00109
00110 #ifdef __WXMSW__
00111 wxIcon myIcon(huginApp::Get()->GetXRCPath() + wxT("data/hugin.ico"),wxBITMAP_TYPE_ICO);
00112 #else
00113 wxIcon myIcon(huginApp::Get()->GetXRCPath() + wxT("data/hugin.png"),wxBITMAP_TYPE_PNG);
00114 #endif
00115
00116 SetIcon(myIcon);
00117
00118
00119 SetSize(1,1,560,560);
00120 CenterOnParent();
00121 }
00122
00123 void AboutDialog::GetSystemInformation(wxFont *font)
00124 {
00125 wxTextCtrl* infoText=XRCCTRL(*this,"system_txt",wxTextCtrl);
00126 #ifndef _WINDOWS
00127 infoText->SetFont(*font);
00128 #endif
00129 wxString text;
00130 text=wxString::Format(_("Operating System: %s"),wxGetOsDescription().c_str());
00131 wxString is64;
00132 if(wxIsPlatform64Bit())
00133 is64=_("64 bit");
00134 else
00135 is64=_("32 bit");
00136 text=text+wxT("\n")+wxString::Format(_("Architecture: %s"),is64.c_str());
00137
00138
00139 text=text+wxT("\n")+wxString::Format(_("Free memory: %ld kiB"),(long long) wxGetFreeMemory().GetValue()/1024);
00140 #ifdef _WINDOWS
00141 UINT cp=GetACP();
00142 text=text+wxT("\n")+wxString::Format(_("Active Codepage: %u"),cp);
00143 switch(cp)
00144 {
00145 case 1250:
00146 text=text+wxT(" (Central European Windows)");
00147 break;
00148 case 1251:
00149 text=text+wxT(" (Cyrillic Windows)");
00150 break;
00151 case 1252:
00152 text=text+wxT(" (Western European Windows)");
00153 break;
00154 case 1253:
00155 text=text+wxT(" (Greek Windows)");
00156 break;
00157 case 1254:
00158 text=text+wxT(" (Turkish Windows)");
00159 break;
00160 case 1255:
00161 text=text+wxT(" (Hebrew Windows)");
00162 break;
00163 case 1256:
00164 text=text+wxT(" (Arabic Windows)");
00165 break;
00166 case 1257:
00167 text=text+wxT(" (Baltic Windows)");
00168 break;
00169 case 1258:
00170 text=text+wxT(" (Vietnamese Windows)");
00171 break;
00172 };
00173 #endif
00174 text=text+wxT("\n\nHugin\n")+wxString::Format(_("Version: %s"),wxString(DISPLAY_VERSION,wxConvLocal).c_str());
00175 text=text+wxT("\n")+wxString::Format(_("Path to resources: %s"),huginApp::Get()->GetXRCPath().c_str());
00176 text=text+wxT("\n")+wxString::Format(_("Path to data: %s"),huginApp::Get()->GetDataPath().c_str());
00177 HuginBase::LensDB::LensDB& lensDB=HuginBase::LensDB::LensDB::GetSingleton();
00178 if(!lensDB.GetMainDBPath().empty())
00179 {
00180 text=text+wxT("\n")+wxString::Format(_("Path to public lensfun database: %s"),wxString(lensDB.GetMainDBPath().c_str(), wxConvLocal).c_str());
00181 };
00182 text=text+wxT("\n")+wxString::Format(_("Path to user lensfun database: %s"),wxString(lensDB.GetUserDBPath().c_str(), wxConvLocal).c_str());
00183 text=text+wxT("\n\n")+_("Libraries");
00184 text=text+wxT("\n")+wxString::Format(wxT("wxWidgets: %i.%i.%i.%i"),
00185 wxMAJOR_VERSION,
00186 wxMINOR_VERSION,
00187 wxRELEASE_NUMBER,
00188 wxSUBRELEASE_NUMBER
00189 );
00190 text=text+wxT("\nlibpano13: ")+wxT(VERSION);
00191 text=text+wxT("\n")+wxString::Format(wxT("Boost: %i.%i.%i"),BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
00192 text=text+wxT("\n")+wxString::Format(wxT("Exiv2: %i.%i.%i"),EXIV2_MAJOR_VERSION,EXIV2_MINOR_VERSION,EXIV2_PATCH_VERSION);
00193 #ifdef LF_VERSION_MAJOR
00194 text=text+wxT("\n")+wxString::Format(wxT("Lensfun: %i.%i.%i.%i"), LF_VERSION_MAJOR, LF_VERSION_MINOR, LF_VERSION_MICRO, LF_VERSION_BUGFIX);
00195 #endif
00196 infoText->SetValue(text);
00197 }
00198
00199 void AboutDialog::OnChangedTab(wxNotebookEvent &e)
00200 {
00201
00202 SetMode(e.GetSelection());
00203 };
00204
00205 void AboutDialog::SetMode(int newMode)
00206 {
00207 if(m_mode==newMode)
00208 {
00209 return;
00210 }
00211
00212 switch ( newMode )
00213 {
00214
00215 case 0 :
00216
00217 SetLogo(wxT("splash.png"));
00218 break;
00219
00220
00221
00222
00223
00224
00225
00226 default :
00227
00228 SetLogo(wxT("logo.png"));
00229 }
00230
00231 m_mode=newMode;
00232 return;
00233 };
00234
00235 void AboutDialog::SetLogo(wxString newLogoFile)
00236 {
00237 if(m_logo_file!=newLogoFile)
00238 {
00239 if(m_logo.LoadFile(huginApp::Get()->GetXRCPath() +
00240 wxT("data/") + newLogoFile,
00241 wxBITMAP_TYPE_PNG))
00242 {
00243 if(m_logoImgCtrl)
00244 {
00245 m_logoImgCtrl->SetBitmap(m_logo);
00246 m_logo_file=newLogoFile;
00247 };
00248 };
00249 };
00250 };
00251