updateList;
diff --git a/oscar/aboutdialog.cpp b/oscar/aboutdialog.cpp
index 3b189821..55da52c3 100644
--- a/oscar/aboutdialog.cpp
+++ b/oscar/aboutdialog.cpp
@@ -28,7 +28,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
ui->creditsText->setHtml(getCredits());
ui->licenseText->setHtml(getLicense());
ui->relnotesText->setHtml(getRelnotes());
- ui->versionLabel->setText(VersionString);
+ ui->versionLabel->setText(getVersion());
// QString gitrev = gitRevision();
//
@@ -123,9 +123,9 @@ QString AboutDialog::getRelnotes()
QString text = ""
""
""+tr("Release Notes")+"
"
- ""+tr("OSCAR v%1").arg(VersionString)+""
+ ""+tr("OSCAR v%1").arg(getVersion())+""
"
";
- if (isReleaseVersion() == false) {
+ if (getVersion().IsReleaseVersion() == false) {
text += ""+tr("Important:")+" "
""+tr("As this is a pre-release version, it is recommended that you back up your data folder manually before proceeding, because attempting to roll back later may break things.")+"
";
}
diff --git a/oscar/main.cpp b/oscar/main.cpp
index 9b5041bc..4119302a 100644
--- a/oscar/main.cpp
+++ b/oscar/main.cpp
@@ -347,7 +347,7 @@ int main(int argc, char *argv[]) {
#endif
relinfo = "("+QSysInfo::kernelType()+" "+QSysInfo::currentCpuArchitecture()+relinfo+")";
qDebug() << "OSCAR starting" << QDateTime::currentDateTime();
- qDebug().noquote() << STR_AppName << VersionString << relinfo << "Built with Qt" << QT_VERSION_STR << __DATE__ << __TIME__;
+ qDebug().noquote() << STR_AppName << getVersion() << relinfo << "Built with Qt" << QT_VERSION_STR << __DATE__ << __TIME__;
SetDateFormat();
@@ -557,7 +557,7 @@ int main(int argc, char *argv[]) {
}
}
- AppSetting->setVersionString(VersionString);
+ AppSetting->setVersionString(getVersion());
////////////////////////////////////////////////////////////////////////////////////////////
// Register Importer Modules for autoscanner
diff --git a/oscar/mainwindow.cpp b/oscar/mainwindow.cpp
index 1534ea47..c9d46c27 100644
--- a/oscar/mainwindow.cpp
+++ b/oscar/mainwindow.cpp
@@ -94,7 +94,7 @@ MainWindow::MainWindow(QWidget *parent) :
// seems to need the systray menu for notifications to work
systraymenu = new QMenu(this);
systray->setContextMenu(systraymenu);
- QAction *a = systraymenu->addAction(STR_TR_OSCAR + " v" + VersionString);
+ QAction *a = systraymenu->addAction(STR_TR_OSCAR + " v" + getVersion());
a->setEnabled(false);
systraymenu->addSeparator();
systraymenu->addAction(tr("&About"), this, SLOT(on_action_About_triggered()));
@@ -2560,7 +2560,7 @@ void MainWindow::on_actionReport_a_Bug_triggered()
// QSettings settings;
// QString language = settings.value(LangSetting).toString();
//
-// QDesktopServices::openUrl(QUrl(QString("https://sleepyhead.jedimark.net/report_bugs.php?lang=%1&version=%2&platform=%3").arg(language).arg(VersionString).arg(PlatformString)));
+// QDesktopServices::openUrl(QUrl(QString("https://sleepyhead.jedimark.net/report_bugs.php?lang=%1&version=%2&platform=%3").arg(language).arg(getVersion()).arg(PlatformString)));
QMessageBox::information(nullptr, STR_MessageBox_Error, tr("Reporting issues is not yet implemented"));
}
diff --git a/oscar/mainwindow.h b/oscar/mainwindow.h
index bcf60e20..c3171827 100644
--- a/oscar/mainwindow.h
+++ b/oscar/mainwindow.h
@@ -1,4 +1,4 @@
-/* OSCAR MainWindow Headers
+/* OSCAR MainWindow Headers
*
* Copyright (C) 2011-2018 Mark Watkins
*
@@ -113,7 +113,7 @@ class MainWindow : public QMainWindow
void CloseProfile();
bool OpenProfile(QString name, bool skippassword = false);
- /*! \fn Notify(QString s,int ms=5000, QString title="OSCAR v"+VersionString());
+ /*! \fn Notify(QString s,int ms=5000, QString title="OSCAR v"+getVersion());
\brief Pops up a message box near the system tray
\param QString string
\param title
diff --git a/oscar/newprofile.cpp b/oscar/newprofile.cpp
index 39b14b23..9c21bff9 100644
--- a/oscar/newprofile.cpp
+++ b/oscar/newprofile.cpp
@@ -93,7 +93,7 @@ NewProfile::NewProfile(QWidget *parent, const QString *user) :
f.close();
}
- ui->versionLabel->setText(VersionString);
+ ui->versionLabel->setText(getVersion());
ui->textBrowser->setHtml(getIntroHTML());
}
diff --git a/oscar/profileselector.cpp b/oscar/profileselector.cpp
index ab9f68ec..34c7397c 100644
--- a/oscar/profileselector.cpp
+++ b/oscar/profileselector.cpp
@@ -56,7 +56,7 @@ ProfileSelector::ProfileSelector(QWidget *parent) :
showDiskUsage = false; // in case I want to preference it later
on_diskSpaceInfo_linkActivated(showDiskUsage ? "show" : "hide");
- ui->versionLabel->setText(VersionString);
+ ui->versionLabel->setText(getVersion());
ui->diskSpaceInfo->setVisible(false);
QItemSelectionModel * sm = ui->profileView->selectionModel();
diff --git a/oscar/reports.cpp b/oscar/reports.cpp
index 1c685b06..c4b3011c 100644
--- a/oscar/reports.cpp
+++ b/oscar/reports.cpp
@@ -559,7 +559,7 @@ void Report::PrintReport(gGraphView *gv, QString name, QDate date)
if (first) {
QDateTime timestamp = QDateTime::currentDateTime();
QString footer = QObject::tr("%1 OSCAR v%2").arg(timestamp.toString(MedDateFormat+" hh:mm"))
- .arg(VersionString+" (" + gitRevision() + ")");
+ .arg(getVersion()+" (" + gitRevision() + ")");
QRectF bounds = painter.boundingRect(QRectF(0, virt_height, virt_width, normal_height), footer,
diff --git a/oscar/statistics.cpp b/oscar/statistics.cpp
index ba575195..d4cb8d98 100644
--- a/oscar/statistics.cpp
+++ b/oscar/statistics.cpp
@@ -720,7 +720,7 @@ QString Statistics::generateFooter(bool showinfo)
html += "
";
QDateTime timestamp = QDateTime::currentDateTime();
html += tr("This report was prepared on %1 by OSCAR v%2").arg(timestamp.toString(MedDateFormat + " hh:mm"))
- .arg(VersionString + " (" + gitRevision() + ")")
+ .arg(getVersion() + " (" + gitRevision() + ")")
+ "
"
+ tr("OSCAR is free open-source CPAP report software");
html += "
";
diff --git a/oscar/version.cpp b/oscar/version.cpp
index 6e6456f6..2a27a7f8 100644
--- a/oscar/version.cpp
+++ b/oscar/version.cpp
@@ -74,12 +74,6 @@ QString getPrereleaseSuffix()
}
-bool isReleaseVersion()
-{
- return getVersion().IsReleaseVersion();
-}
-
-
static const Version s_Version(VERSION);
const Version & getVersion()
{
@@ -93,6 +87,11 @@ Version::Version(const QString & version_string) : mString(version_string), mIsV
}
Version::operator const QString &() const
+{
+ return toString();
+}
+
+const QString & Version::toString() const
{
return mString;
}
diff --git a/oscar/version.h b/oscar/version.h
index 3edfc7cd..f787cfce 100644
--- a/oscar/version.h
+++ b/oscar/version.h
@@ -10,7 +10,7 @@
#ifndef VERSION_H
#define VERSION_H
-#include
+#include
class Version
{
@@ -18,10 +18,12 @@ class Version
public:
Version(const QString & version_string);
operator const QString &() const;
+ const QString & toString() const;
const QString PrereleaseType() const;
bool IsReleaseVersion() const { return mPrerelease.isEmpty(); }
bool IsValid() const { return mIsValid; }
bool operator==(const Version & b) const { return Compare(*this, b) == 0; }
+ bool operator!=(const Version & b) const { return Compare(*this, b) != 0; }
bool operator<(const Version & b) const { return Compare(*this, b) < 0; }
bool operator>(const Version & b) const { return Compare(*this, b) > 0; }
@@ -37,17 +39,12 @@ protected:
static int Compare(const Version & a, const Version & b);
};
-//!brief Get the current version of the application
+//!brief Get the current version of the application.
const Version & getVersion();
-
-extern const QString VersionString;
-
QString getBranchVersion();
QString getPrereleaseSuffix();
const QString & gitRevision();
const QString & gitBranch();
-bool isReleaseVersion();
-
#endif // VERSION_H