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"
|
2022-11-17 09:47:08 +00:00
|
|
|
#include <QPushButton>
|
2010-11-14 16:28:50 +00:00
|
|
|
#include <QtGui>
|
2013-05-30 18:54:15 +00:00
|
|
|
#include <QSysInfo>
|
2010-11-14 16:28:50 +00:00
|
|
|
|
2021-11-27 07:17:33 +00:00
|
|
|
#include "utils.hh"
|
2013-05-30 13:24:21 +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 );
|
|
|
|
|
|
|
|
QFile versionFile( ":/version.txt" );
|
|
|
|
|
|
|
|
QString version;
|
|
|
|
|
|
|
|
if ( !versionFile.open( QFile::ReadOnly ) )
|
|
|
|
version = tr( "[Unknown]" );
|
|
|
|
else
|
2013-02-03 20:19:55 +00:00
|
|
|
version = QString::fromLatin1( versionFile.readAll() ).trimmed();
|
2010-11-14 16:28:50 +00:00
|
|
|
|
|
|
|
ui.version->setText( version );
|
2013-08-04 19:19:57 +00:00
|
|
|
|
|
|
|
#if defined (_MSC_VER)
|
2022-05-26 12:30:50 +00:00
|
|
|
QString compilerVersion = QString( "Visual C++ Compiler: %1" )
|
|
|
|
.arg( _MSC_FULL_VER );
|
2014-05-11 15:41:54 +00:00
|
|
|
#elif defined (__clang__) && defined (__clang_version__)
|
|
|
|
QString compilerVersion = QLatin1String( "Clang " ) + QLatin1String( __clang_version__ );
|
2013-08-04 19:19:57 +00:00
|
|
|
#else
|
|
|
|
QString compilerVersion = QLatin1String( "GCC " ) + QLatin1String( __VERSION__ );
|
|
|
|
#endif
|
|
|
|
|
2013-05-30 18:54:15 +00:00
|
|
|
ui.qtVersion->setText( tr( "Based on Qt %1 (%2, %3 bit)" ).arg(
|
|
|
|
QLatin1String( qVersion() ),
|
2013-08-04 19:19:57 +00:00
|
|
|
compilerVersion,
|
2022-10-24 12:14:53 +00:00
|
|
|
QString::number( QSysInfo::WordSize ) )
|
|
|
|
#ifdef USE_XAPIAN
|
|
|
|
+" (Xapian inside)"
|
|
|
|
#endif
|
|
|
|
);
|
2010-11-14 16:28:50 +00:00
|
|
|
|
2022-11-17 09:47:08 +00:00
|
|
|
// copy basic debug info to clipboard
|
|
|
|
connect(ui.copyInfoBtn, &QPushButton::clicked, [=]{
|
|
|
|
QGuiApplication::clipboard()->setText(
|
|
|
|
"Goldendict " + version + "\n" +
|
|
|
|
QSysInfo::productType() + " " + QSysInfo::kernelType() + " " + QSysInfo::kernelVersion() + " " +
|
|
|
|
"Qt " + QLatin1String(qVersion()) + " " +
|
|
|
|
QSysInfo::buildAbi() + "\n" +
|
|
|
|
compilerVersion + "\n"
|
2022-11-19 10:06:30 +00:00
|
|
|
+ "Flags:"
|
|
|
|
#ifdef USE_XAPIAN
|
|
|
|
+" USE_XAPIAN "
|
|
|
|
#endif
|
2022-11-17 09:47:08 +00:00
|
|
|
|
2022-11-19 10:06:30 +00:00
|
|
|
#ifdef MAKE_ZIM_SUPPORT
|
|
|
|
+" MAKE_ZIM_SUPPORT"
|
|
|
|
#endif
|
2022-11-17 09:47:08 +00:00
|
|
|
|
2022-11-19 10:06:30 +00:00
|
|
|
#ifdef MAKE_EXTRA_TIFF_HANDLER
|
|
|
|
+" MAKE_EXTRA_TIFF_HANDLER"
|
|
|
|
#endif
|
2022-11-17 09:47:08 +00:00
|
|
|
|
2022-11-19 10:06:30 +00:00
|
|
|
#ifdef NO_EPWING_SUPPORT
|
|
|
|
+" NO_EPWING_SUPPORT"
|
2022-11-17 09:47:08 +00:00
|
|
|
#endif
|
|
|
|
|
2022-11-19 10:06:30 +00:00
|
|
|
#ifdef MAKE_CHINESE_CONVERSION_SUPPORT
|
|
|
|
+" MAKE_CHINESE_CONVERSION_SUPPORT"
|
|
|
|
#endif
|
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 ) )
|
|
|
|
{
|
|
|
|
QStringList creditsList =
|
|
|
|
QString::fromUtf8(
|
2021-12-29 14:29:06 +00:00
|
|
|
creditsFile.readAll() ).split( '\n', Qt::SkipEmptyParts );
|
2010-11-14 16:28:50 +00:00
|
|
|
|
|
|
|
QString html = "<html><body style='color: black; background: #f4f4f4;'>";
|
|
|
|
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
}
|