# HG changeset patch # User Matti Hamalainen # Date 1493026566 -10800 # Node ID 83044206479e5399366fba2e11175e8b9ac4ecd8 # Parent d65e053209ea91e01f9296a5b4a09dc6df61de72 Add some comments. diff -r d65e053209ea -r 83044206479e src/main.cpp --- a/src/main.cpp Mon Apr 24 12:26:28 2017 +0300 +++ b/src/main.cpp Mon Apr 24 12:36:06 2017 +0300 @@ -16,6 +16,9 @@ double setScale; +// +// Display an error dialog with given title and message +// int errorMsg(QString title, QString msg) { QMessageBox dlg; @@ -31,6 +34,9 @@ } +// +// Convert QString to a double value, replacing comma +// double moneyStrToValue(const QString &str) { QString str2 = str; @@ -38,12 +44,18 @@ } +// +// Convert double value to formatted QString +// QString moneyValueToStr(double val) { return QStringLiteral("%1").arg(val, 1, 'f', 2); } +// +// Trim and cleanup given QString (removing double whitespace etc.) +// QString cleanupStr(const QString &str) { return str.simplified().trimmed(); @@ -58,6 +70,11 @@ } +// +// Check if an SQL error has occured (for given QSqlError) and +// report it to stdout if so. Return "false" if error has occured, +// true otherwise. +// bool checkAndReportSQLError(const QString where, const QSqlError &err) { if (err.isValid())