aboutbox: linux compiler version

This commit is contained in:
Aurelie Delhaie
2023-02-12 19:22:06 +01:00
parent 3af0771b55
commit d0186d0759
3 changed files with 23 additions and 4 deletions

View File

@@ -1,15 +1,18 @@
#include "aboutdialog.h" #include "aboutdialog.h"
#include "ui_aboutdialog.h" #include "ui_aboutdialog.h"
#ifdef unix
#include <gnu/libc-version.h>
#endif
AboutDialog::AboutDialog(QWidget *parent) : AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::AboutDialog) ui(new Ui::AboutDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->appName->setText(QString("%1 (%2)").arg(APP_NAME, APP_ARCH)); ui->appName->setText(QString("%1 (%2)").arg(APP_NAME, APP_ARCH));
QString os_version = APP_OS_VERSION; QString compiler = getCompilerInfo();
os_version = os_version.replace("-D", ""); ui->version->setText(QString("v%1-%3 (qt %4)").arg(APP_VERSION, compiler, QT_VERSION_STR));
ui->version->setText(QString("v%1 %2/%3 (qt %4)").arg(APP_VERSION, APP_OS, os_version, QT_VERSION_STR));
ui->textEdit_2->append(QString("Qt Open Source %1").arg(QT_VERSION_STR)); ui->textEdit_2->append(QString("Qt Open Source %1").arg(QT_VERSION_STR));
} }
@@ -17,3 +20,17 @@ AboutDialog::~AboutDialog()
{ {
delete ui; delete ui;
} }
QString AboutDialog::getCompilerInfo()
{
#ifdef __GNUC__
#ifdef __MINGW32__
return QString("MinGW_%1.%2.%3").arg(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#else
return QString("GLIBC_%1").arg(gnu_get_libc_version());
#endif
#else
return "unknown";
#endif
}

View File

@@ -2,6 +2,7 @@
#define ABOUTDIALOG_H #define ABOUTDIALOG_H
#include <QDialog> #include <QDialog>
#include <QString>
namespace Ui { namespace Ui {
class AboutDialog; class AboutDialog;
@@ -17,6 +18,7 @@ public:
private: private:
Ui::AboutDialog *ui; Ui::AboutDialog *ui;
QString getCompilerInfo();
}; };
#endif // ABOUTDIALOG_H #endif // ABOUTDIALOG_H

View File

@@ -137,7 +137,7 @@ const Filter FilterDialog::getFilter()
void FilterDialog::validateAndAccept() void FilterDialog::validateAndAccept()
{ {
if (ui->nameEdit->text().count() == 0) if (ui->nameEdit->text().length() == 0)
{ {
QMessageBox::critical(this, "This filter needs a name", "You need to enter a name to save this filter"); QMessageBox::critical(this, "This filter needs a name", "You need to enter a name to save this filter");
return; return;