2012-02-20 21:47:14 +00:00
|
|
|
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
|
2010-11-14 16:28:50 +00:00
|
|
|
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
|
|
|
|
|
|
|
|
#include "about.hh"
|
2023-05-30 06:31:07 +00:00
|
|
|
#include "utils.hh"
|
2023-06-17 06:20:22 +00:00
|
|
|
#include "version.hh"
|
2023-05-30 06:31:07 +00:00
|
|
|
|
|
|
|
#include <QClipboard>
|
|
|
|
#include <QFile>
|
2022-11-17 09:47:08 +00:00
|
|
|
#include <QPushButton>
|
2013-05-30 18:54:15 +00:00
|
|
|
#include <QSysInfo>
|
2010-11-14 16:28:50 +00:00
|
|
|
|
2022-11-19 10:06:30 +00:00
|
|
|
About::About( QWidget * parent, std::vector< sptr< Dictionary::Class > > * dictonaries ):
|
|
|
|
QDialog( parent )
|
2010-11-14 16:28:50 +00:00
|
|
|
{
|
|
|
|
ui.setupUi( this );
|
|
|
|
|
2023-06-17 06:20:22 +00:00
|
|
|
ui.version->setText( Version::version() );
|
2010-11-14 16:28:50 +00:00
|
|
|
|
2023-06-17 06:20:22 +00:00
|
|
|
ui.qtVersion->setText( tr( "Based on Qt %1 (%2, %3)" )
|
|
|
|
.arg( QLatin1String( qVersion() ), Version::compiler, QSysInfo::currentCpuArchitecture() )
|
|
|
|
+ " (Xapian inside)" );
|
2010-11-14 16:28:50 +00:00
|
|
|
|
2023-06-17 06:20:22 +00:00
|
|
|
connect( ui.copyInfoBtn, &QPushButton::clicked, [] {
|
|
|
|
QGuiApplication::clipboard()->setText( Version::everything() );
|
|
|
|
} );
|
2022-11-17 09:47:08 +00:00
|
|
|
|
|
|
|
connect( ui.copyDictListBtn, &QPushButton::clicked, [ = ] {
|
|
|
|
QString tempDictList{};
|
|
|
|
for ( auto dict : *dictonaries ) {
|
|
|
|
tempDictList.append( QString::fromStdString( dict->getName() + "\n" ) );
|
|
|
|
}
|
|
|
|
QGuiApplication::clipboard()->setText( tempDictList );
|
|
|
|
} );
|
|
|
|
|
2010-11-14 16:28:50 +00:00
|
|
|
QFile creditsFile( ":/CREDITS.txt" );
|
|
|
|
|
|
|
|
if ( creditsFile.open( QFile::ReadOnly ) ) {
|
2021-12-29 14:29:06 +00:00
|
|
|
QStringList creditsList = QString::fromUtf8( creditsFile.readAll() ).split( '\n', Qt::SkipEmptyParts );
|
2010-11-14 16:28:50 +00:00
|
|
|
|
2022-12-26 15:34:53 +00:00
|
|
|
QString html = "<html><body>";
|
2010-11-14 16:28:50 +00:00
|
|
|
|
|
|
|
for ( int x = 0; x < creditsList.size(); ++x ) {
|
|
|
|
QString str = creditsList[ x ];
|
|
|
|
|
|
|
|
str.replace( "\\", "@" );
|
|
|
|
|
2021-11-27 07:17:33 +00:00
|
|
|
str = Utils::escape( str );
|
2010-11-14 16:28:50 +00:00
|
|
|
|
|
|
|
int colon = str.indexOf( ":" );
|
|
|
|
|
|
|
|
if ( colon != -1 ) {
|
2010-11-14 19:46:38 +00:00
|
|
|
QString name( str.left( colon ) );
|
|
|
|
|
|
|
|
name.replace( ", ", "<br>" );
|
|
|
|
|
|
|
|
str = "<font color='blue'>" + name + "</font><br> " + str.mid( colon + 1 );
|
2010-11-14 16:28:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
html += str;
|
|
|
|
html += "<br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
html += "</body></html>";
|
|
|
|
|
|
|
|
ui.credits->setHtml( html );
|
|
|
|
}
|
|
|
|
}
|