mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-22 11:37:56 -04:00
Better (with dependences version) --version
This commit is contained in:
parent
2875b52ae6
commit
cc5cef3b48
@ -1,7 +1,9 @@
|
||||
#include "kiwixapp.h"
|
||||
#include "static_content.h"
|
||||
#include "zim/error.h"
|
||||
#include "zim/version.h"
|
||||
#include "kiwix/tools.h"
|
||||
#include "kiwix/version.h"
|
||||
|
||||
#include <QLocale>
|
||||
#include <QLibraryInfo>
|
||||
@ -36,8 +38,6 @@ KiwixApp::KiwixApp(int& argc, char *argv[])
|
||||
QMessageBox::critical(nullptr, "Translation error", e.what());
|
||||
return;
|
||||
}
|
||||
qInfo() << "Compiled with Qt Version " << QT_VERSION_STR;
|
||||
qInfo() << "Runtime Qt Version " << qVersion();
|
||||
m_qtTranslator.load(QLocale(), "qt", "_",
|
||||
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
installTranslator(&m_qtTranslator);
|
||||
@ -444,3 +444,12 @@ void KiwixApp::updateNameMapper()
|
||||
{
|
||||
m_nameMapper.update();
|
||||
}
|
||||
|
||||
void KiwixApp::printVersions(std::ostream& out) {
|
||||
out << version.toStdString() << std::endl;
|
||||
out << "+ libqt (compile time) " << QT_VERSION_STR << std::endl;
|
||||
out << "+ libqt (run time) " << qVersion() << std::endl << std::endl;
|
||||
kiwix::printVersions(out);
|
||||
out << std::endl;
|
||||
zim::printVersions(out);
|
||||
}
|
||||
|
@ -101,6 +101,7 @@ public slots:
|
||||
void printPage();
|
||||
void disableItemsOnLibraryPage(bool displayed);
|
||||
void updateNameMapper();
|
||||
void printVersions(std::ostream& out = std::cout);
|
||||
|
||||
protected:
|
||||
void createAction();
|
||||
|
10
src/main.cpp
10
src/main.cpp
@ -15,12 +15,18 @@ int main(int argc, char *argv[])
|
||||
QWebEngineUrlScheme::registerScheme(scheme);
|
||||
#endif
|
||||
KiwixApp a(argc, argv);
|
||||
a.setApplicationVersion(version);
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(QStringLiteral("The Kiwix Desktop is a viewer/manager of ZIM files for GNU/Linux and Microsoft Windows OSes."));
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
parser.addPositionalArgument("zimfile", "The zim file");
|
||||
|
||||
// Set version string
|
||||
std::ostringstream versions;
|
||||
a.printVersions(versions);
|
||||
a.setApplicationVersion(QString::fromStdString(versions.str()));
|
||||
parser.addVersionOption();
|
||||
|
||||
parser.process(a);
|
||||
auto positionalArguments = parser.positionalArguments();
|
||||
if (a.isRunning()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user