goldendict-ng/src/version.cc
shenleban tongying 67f5b1333b
fix: cmake version.txt generation in non-git environments
This was not well defined.
2023-07-30 01:42:41 -04:00

25 lines
629 B
C++

#include "version.hh"
#include <QFile>
namespace Version {
QString version()
{
QFile versionFile( ":/version.txt" );
if ( !versionFile.open( QFile::ReadOnly ) ) {
return QStringLiteral( "[Unknown Version]" );
}
else {
return versionFile.readAll().trimmed();
}
}
QString everything()
{
return QStringLiteral( "Goldendict-ng " ) + Version::version() + "\n" + "Qt " + QLatin1String( qVersion() ) + " "
+ Version::compiler + " " + QSysInfo::productType() + " " + QSysInfo::kernelType() + " " + QSysInfo::kernelVersion()
+ " " + QSysInfo::buildAbi() + "\n" + "Flags:" + flags;
}
} // namespace Version