From 37b2dd7246a7d930bbf8005c966f709293dbcd5b Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Tue, 30 May 2017 09:12:40 +0200 Subject: [PATCH] Added logo to settings. Small bugfixes. --- camp/campwizard.ui | 8 +++++++- core/exprevaluator.cpp | 14 ++++++++++++-- core/settings/globalsettingsform.cpp | 16 ++++++++++++++++ core/settings/globalsettingsform.h | 1 + core/settings/globalsettingsform.ui | 19 +++++++++++++++++-- 5 files changed, 53 insertions(+), 5 deletions(-) diff --git a/camp/campwizard.ui b/camp/campwizard.ui index 9e8e78f..422df1d 100644 --- a/camp/campwizard.ui +++ b/camp/campwizard.ui @@ -732,6 +732,9 @@ false + + true + QAbstractSpinBox::NoButtons @@ -754,6 +757,9 @@ false + + true + QAbstractSpinBox::NoButtons @@ -832,8 +838,8 @@ tableServices - + diff --git a/core/exprevaluator.cpp b/core/exprevaluator.cpp index 16c0686..3256ec3 100644 --- a/core/exprevaluator.cpp +++ b/core/exprevaluator.cpp @@ -63,7 +63,13 @@ bool ExprEvaluator::evaluate(QObject *object, const QString &exp) QString oper; QVariant cond; parseExpr(exp, value, oper, cond, object); - return m_operations[oper](value, cond); + + if (cond.isValid()) + { + return m_operations[oper](value, cond); + } + + return true; } } @@ -87,6 +93,10 @@ void ExprEvaluator::parseExpr(const QString &exp, QVariant &value, QString &oper QStringList expCat = exp.trimmed().split(" "); value = object->property(expCat[0].toStdString().c_str()); oper = expCat[1]; - condition = expCat[2].replace("%20", " "); + + if (expCat.size() > 2) + { + condition = expCat[2].replace("%20", " "); + } } diff --git a/core/settings/globalsettingsform.cpp b/core/settings/globalsettingsform.cpp index 06cf031..834ce6e 100644 --- a/core/settings/globalsettingsform.cpp +++ b/core/settings/globalsettingsform.cpp @@ -2,6 +2,7 @@ #include "ui_globalsettingsform.h" #include +#include #include "seasonnamedialog.h" #include "globalsettings.h" @@ -107,6 +108,11 @@ void GlobalSettingsForm::loadEntity() setEntity(settings); ui->grpVat->setEnabled(settings->vatPayer()); + if (!settings->logoPath().isEmpty()) + { + ui->lblLogo->setPixmap(QPixmap(settings->logoPath())); + } + loadSeasons(); loadNumSeries(); } @@ -155,3 +161,13 @@ void GlobalSettingsForm::on_btnNew_clicked() }); } } + +void GlobalSettingsForm::on_pushButton_clicked() +{ + QString logoPath = QFileDialog::getOpenFileName(this, tr("Select logo"), "", tr("Images (*.png *.xpm *.jpg)")); + if (!logoPath.isEmpty()) + { + entity()->setLogoPath(logoPath); + ui->lblLogo->setPixmap(QPixmap(logoPath)); + } +} diff --git a/core/settings/globalsettingsform.h b/core/settings/globalsettingsform.h index 8db5838..4c1ba7e 100644 --- a/core/settings/globalsettingsform.h +++ b/core/settings/globalsettingsform.h @@ -39,6 +39,7 @@ private slots: void on_season_currentIndexChanged(int index); void on_btnEditName_clicked(); void on_btnNew_clicked(); + void on_pushButton_clicked(); }; #endif // GLOBALSETTINGSFORM_H diff --git a/core/settings/globalsettingsform.ui b/core/settings/globalsettingsform.ui index 0907e4c..b73cfad 100644 --- a/core/settings/globalsettingsform.ui +++ b/core/settings/globalsettingsform.ui @@ -99,9 +99,24 @@ - + + + + 180 + 160 + + + + + 180 + 160 + + - Logo + + + + true