/*! * Loads html content for current language. */ void AboutDialog::loadingHtmlContent() { LOG_CALL; QString fileName = QString(":/about/about_%1.html").arg(Config::getLanguage()); QFileInfo fileInfo(fileName); if (!fileInfo.exists()) fileName = ":/about/about_en.html"; QFile about_file(fileName); if (about_file.open(QFile::ReadOnly|QFile::Text)) { QTextStream istream(&about_file); istream.setCodec("UTF-8"); ui->tBrowser_about->setHtml(istream.readAll()); about_file.close(); } QFile license_file(":/LICENSE"); if (license_file.open(QFile::ReadOnly|QFile::Text)) { QTextStream istream(&license_file); istream.setCodec("UTF-8"); ui->tBrowser_license->setText(istream.readAll()); license_file.close(); } }
void about::Update() { pAboutTextCtl->Clear(); wxString *pAboutString = new wxString( AboutText, wxConvUTF8 ); pAboutString->Append( OpenCPNVersion ); pAboutString->Append( wxString( OpenCPNInfo, wxConvUTF8 ) ); pAboutTextCtl->WriteText( *pAboutString ); delete pAboutString; // Show the user where the log file is going to be wxString log = _T(" Logfile location: "); log.Append( glog_file ); pAboutTextCtl->WriteText( log ); // Show the user where the config file is going to be wxString conf = _T("\n Config file location: "); conf.Append( g_Platform->GetConfigFileName() ); pAboutTextCtl->WriteText( conf ); pAboutTextCtl->SetInsertionPoint( 0 ); pAuthorTextCtl->Clear(); wxString *pAuthorsString = new wxString( AuthorText, wxConvUTF8 ); pAuthorTextCtl->WriteText( *pAuthorsString ); pAuthorTextCtl->SetInsertionPoint( 0 ); delete pAuthorsString; pLicenseTextCtl->Clear(); wxString license_loc(m_DataLocn ); license_loc.Append( _T("license.txt") ); wxTextFile license_file( license_loc ); if( license_file.Open() ) { wxString str; str = license_file.GetFirstLine(); pLicenseTextCtl->WriteText( str ); while( !license_file.Eof() ) { str = license_file.GetNextLine(); str.Append( _T("\n") ); pLicenseTextCtl->AppendText( str ); } license_file.Close(); } else { wxString msg( _T("Could not open License file: ") ); msg.Append( license_loc ); wxLogMessage( msg ); } pLicenseTextCtl->SetInsertionPoint( 0 ); DimeControl( this ); }
QString TelegramGui::license() const { QString res; QFile license_file( QCoreApplication::applicationDirPath() + "/license.txt" ); if( !license_file.open(QFile::ReadOnly) ) return res; res = license_file.readAll(); return res; }
void about::Update() { wxColour cb = GetGlobalColor( _T("DILG1") ); SetBackgroundColour(cb); wxColour cf = GetGlobalColor( _T( "UINFD" ) ); // or UINFF SetForegroundColour( cf ); itemPanelAbout->SetBackgroundColour(cb); itemPanelAuthors->SetBackgroundColour(cb); itemPanelLicense->SetBackgroundColour(cb); itemPanelTips->SetBackgroundColour(cb); pAboutTextCtl->SetBackgroundColour(cb); pAuthorTextCtl->SetBackgroundColour(cb); pLicenseTextCtl->SetBackgroundColour(cb); itemPanelAbout->SetForegroundColour(cf); itemPanelAuthors->SetForegroundColour(cf); itemPanelLicense->SetForegroundColour(cf); itemPanelTips->SetForegroundColour(cf); pAboutTextCtl->SetForegroundColour(cf); pAuthorTextCtl->SetForegroundColour(cf); pLicenseTextCtl->SetForegroundColour(cf); wxTextAttr ta(cf, cb); pAboutTextCtl->SetDefaultStyle(ta); pAboutTextCtl->Clear(); wxString *pAboutString = new wxString(AboutText, wxConvUTF8); pAboutString->Append(OpenCPNVersion); //Gunther pAboutString->Append(wxString(OpenCPNInfo, wxConvUTF8)); pAboutTextCtl->WriteText(*pAboutString); delete pAboutString; // Show the user where the log file is going to be wxString log = _T("\n Logfile location: "); log.Append(*pHome_Locn); log.Append(_T("opencpn.log")); pAboutTextCtl->WriteText(log); pAuthorTextCtl->SetDefaultStyle(ta); pAuthorTextCtl->Clear(); wxString *pAuthorsString = new wxString(AuthorText, wxConvUTF8); pAuthorTextCtl->WriteText(*pAuthorsString); delete pAuthorsString; pLicenseTextCtl->SetDefaultStyle(ta); pLicenseTextCtl->Clear(); wxString license_loc(*m_pDataLocn); license_loc.Append(_T("license.txt")); wxTextFile license_file(license_loc); if(license_file.Open()) { wxString str; str = license_file.GetFirstLine(); pLicenseTextCtl->WriteText(str); while (!license_file.Eof()) { str = license_file.GetNextLine(); str.Append(_T("\n")); pLicenseTextCtl->AppendText(str); } license_file.Close(); } else { wxString msg(_T("Could not open License file: ")); msg.Append(license_loc); wxLogMessage(msg); } pLicenseTextCtl->SetInsertionPoint(0); }
void about::Update() { wxColor bg = GetBackgroundColour(); wxColor fg = wxColour(0,0,0); //FontMgr::Get().GetFontColor( _("Dialog") ); wxString aboutText; aboutText.Printf( _T("<html><body bgcolor=#%02x%02x%02x><font color=#%02x%02x%02x>"), bg.Red(), bg.Blue(), bg.Green(), fg.Red(), fg.Blue(), fg.Green() ); wxFont *dFont = FontMgr::Get().GetFont( _("Dialog") ); wxString face = dFont->GetFaceName(); #ifdef __WXOSX__ int points = dFont->GetPointSize(); #else int points = dFont->GetPointSize() + 1; #endif int sizes[7]; for ( int i=-2; i<5; i++ ) { sizes[i+2] = points + i + (i>0?i:0); } pAboutHTMLCtl->SetFonts(face, face, sizes); if(wxFONTSTYLE_ITALIC == dFont->GetStyle()) aboutText += _T("<i>"); wxString *pAboutString = new wxString( AboutText, wxConvUTF8 ); pAboutString->Append( OpenCPNVersion ); pAboutString->Append( wxString( OpenCPNInfo, wxConvUTF8 ) ); // Show the user where the log file is going to be wxString log = _T(" Logfile location: "); log.Append( g_Platform->GetLogFileName() ); pAboutString->Append(log); // Show the user where the config file is going to be wxString conf = _T("<br><br> Config file location: "); conf.Append( g_Platform->GetConfigFileName() ); pAboutString->Append(conf); aboutText << *pAboutString; delete pAboutString; aboutText << _T("</font>"); if(wxFONTSTYLE_ITALIC == dFont->GetStyle()) aboutText << _T("</i>"); aboutText << _T("</body></html>"); pAboutHTMLCtl->SetPage( aboutText ); pAuthorTextCtl->Clear(); wxString *pAuthorsString = new wxString( AuthorText, wxConvUTF8 ); pAuthorTextCtl->WriteText( *pAuthorsString ); pAuthorTextCtl->SetInsertionPoint( 0 ); delete pAuthorsString; pLicenseTextCtl->Clear(); wxString license_loc(m_DataLocn ); license_loc.Append( _T("license.txt") ); wxTextFile license_file( license_loc ); if( license_file.Open() ) { wxString str; str = license_file.GetFirstLine(); pLicenseTextCtl->WriteText( str ); while( !license_file.Eof() ) { str = license_file.GetNextLine(); str.Append( _T("\n") ); pLicenseTextCtl->AppendText( str ); } license_file.Close(); } else { wxString msg( _T("Could not open License file: ") ); msg.Append( license_loc ); wxLogMessage( msg ); } pLicenseTextCtl->SetInsertionPoint( 0 ); SetColorScheme(); }
void about::Populate( void ) { wxColor bg = GetBackgroundColour(); wxColor fg = wxColour( 0, 0, 0 ); // The HTML Header wxString aboutText = wxString::Format( _T( "<html><body bgcolor=#%02x%02x%02x><font color=#%02x%02x%02x>" ), bg.Red(), bg.Blue(), bg.Green(), fg.Red(), fg.Blue(), fg.Green() ); wxFont *dFont = FontMgr::Get().GetFont( _("Dialog") ); // Do weird font size calculation int points = dFont->GetPointSize(); #ifndef __WXOSX__ ++points; #endif int sizes[7]; for ( int i = -2; i < 5; i++ ) { sizes[i+2] = points + i + ( i > 0 ? i : 0 ); } wxString face = dFont->GetFaceName(); pAboutHTMLCtl->SetFonts( face, face, sizes ); if( wxFONTSTYLE_ITALIC == dFont->GetStyle() ) aboutText.Append( _T("<i>") ); #ifdef __OCPN__ANDROID__ aboutText.Append( AboutText + Komodo Exercise 2016VersionAndroid + Komodo Exercise 2016InfoAlt ); #else aboutText.Append( AboutText + OpenCPNVersion + OpenCPNInfo ); #endif // Show where the log file is going to be placed wxString log_string = _T("Logfile location: ") + g_Platform->GetLogFileName(); log_string.Replace(_T("/"), _T("/ ")); // allow line breaks, in a cheap way... aboutText.Append( log_string ); // Show where the config file is going to be placed wxString config_string = _T("<br><br>Config file location: ") + g_Platform->GetConfigFileName(); config_string.Replace(_T("/"), _T("/ ")); // allow line breaks, in a cheap way... aboutText.Append( config_string ); if(wxFONTSTYLE_ITALIC == dFont->GetStyle()) aboutText.Append( _T("</i>") ); // The HTML Footer aboutText.Append( _T("</font></body></html>") ); pAboutHTMLCtl->SetPage( aboutText ); ///Authors page // The HTML Header wxString authorText = wxString::Format( _T( "<html><body bgcolor=#%02x%02x%02x><font color=#%02x%02x%02x>" ), bg.Red(), bg.Blue(), bg.Green(), fg.Red(), fg.Blue(), fg.Green() ); pAuthorHTMLCtl->SetFonts( face, face, sizes ); wxString authorFixText = AuthorText; authorFixText.Replace(_T("\n"), _T("<br>")); authorText.Append( authorFixText ); // The HTML Footer authorText.Append( _T("</font></body></html>") ); pAuthorHTMLCtl->SetPage( authorFixText ); ///License page // The HTML Header wxString licenseText = wxString::Format( _T( "<html><body bgcolor=#%02x%02x%02x><font color=#%02x%02x%02x>" ), bg.Red(), bg.Blue(), bg.Green(), fg.Red(), fg.Blue(), fg.Green() ); pLicenseHTMLCtl->SetFonts( face, face, sizes ); wxTextFile license_filea( m_DataLocn + _T("license.txt") ); if ( license_filea.Open() ) { for ( wxString str = license_filea.GetFirstLine(); !license_filea.Eof() ; str = license_filea.GetNextLine() ) licenseText.Append( str + _T("<br>") ); license_filea.Close(); } else { wxLogMessage( _T("Could not open License file: ") + m_DataLocn ); } wxString suppLicense = g_Platform->GetSupplementalLicenseString(); wxStringTokenizer st(suppLicense, _T("\n"), wxTOKEN_DEFAULT); while( st.HasMoreTokens() ) { wxString s1 = st.GetNextToken(); licenseText.Append( s1 + _T("<br>") ); } // The HTML Footer licenseText.Append( _T("</font></body></html>") ); pLicenseHTMLCtl->SetPage( licenseText ); #if 0 wxTextFile license_file( m_DataLocn + _T("license.txt") ); if ( license_file.Open() ) { for ( wxString str = license_file.GetFirstLine(); !license_file.Eof() ; str = license_file.GetNextLine() ) pLicenseTextCtl->AppendText( str + '\n' ); license_file.Close(); } else { wxLogMessage( _T("Could not open License file: ") + m_DataLocn ); } wxString suppLicense = g_Platform->GetSupplementalLicenseString(); pLicenseTextCtl->AppendText( suppLicense ); pLicenseTextCtl->SetInsertionPoint( 0 ); #endif SetColorScheme(); }