diff --git a/oscar/SleepLib/common.cpp b/oscar/SleepLib/common.cpp index d197eccc..64660915 100644 --- a/oscar/SleepLib/common.cpp +++ b/oscar/SleepLib/common.cpp @@ -556,7 +556,7 @@ QString STR_TR_PrRelief; // Pressure Relief QString STR_TR_Bookmarks; QString STR_TR_OSCAR; -QString STR_TR_AppVersion; +//QString STR_TR_AppVersion; QString STR_TR_Default; @@ -761,7 +761,7 @@ void initializeStrings() STR_TR_Bookmarks = QObject::tr("Bookmarks"); STR_TR_OSCAR = QObject::tr("OSCAR"); - STR_TR_AppVersion = QObject::tr("v%1").arg(getVersion()); + //STR_TR_AppVersion = QObject::tr("v%1").arg(getVersion()); STR_TR_Mode = QObject::tr("Mode"); STR_TR_Model = QObject::tr("Model"); diff --git a/oscar/SleepLib/profiles.cpp b/oscar/SleepLib/profiles.cpp index 740839a2..ee2fa3c9 100644 --- a/oscar/SleepLib/profiles.cpp +++ b/oscar/SleepLib/profiles.cpp @@ -505,8 +505,8 @@ void Profile::DataFormatError(Machine *m) { QString msg; - msg = "<font size=+1>"+QObject::tr("OSCAR (%1) needs to upgrade its database for %2 %3 %4"). - arg(getVersion()). + msg = "<font size=+1>"+QObject::tr("OSCAR %1 needs to upgrade its database for %2 %3 %4"). + arg(getVersion().displayString()). arg(m->brand()).arg(m->model()).arg(m->serial()) + "</font><br/><br/>"; diff --git a/oscar/aboutdialog.cpp b/oscar/aboutdialog.cpp index 55da52c3..2458562c 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(getVersion()); + ui->versionLabel->setText(""); // QString gitrev = gitRevision(); // @@ -44,7 +44,7 @@ AboutDialog::AboutDialog(QWidget *parent) : ui->infoLabel->setText(text); - setWindowTitle(tr("About OSCAR")); + setWindowTitle(tr("About OSCAR %1").arg(getVersion().displayString())); setMinimumSize(QSize(400,400)); this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint); connect(ui->closeButton, SIGNAL(clicked(bool)), this, SLOT(accept())); @@ -123,7 +123,7 @@ QString AboutDialog::getRelnotes() QString text = "<html>" "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head>" "<body><span style=\" font-size:20pt;\">"+tr("Release Notes")+"</span><br/>" - "<span style=\" font-size:14pt;\">"+tr("OSCAR v%1").arg(getVersion())+"</span>" + "<span style=\" font-size:14pt;\">"+tr("OSCAR %1").arg(getVersion())+"</span>" "<hr/>"; if (getVersion().IsReleaseVersion() == false) { text += "<p><font color='red' size=+1><b>"+tr("Important:")+"</b></font> " diff --git a/oscar/main.cpp b/oscar/main.cpp index 0f71a773..d3f98090 100644 --- a/oscar/main.cpp +++ b/oscar/main.cpp @@ -246,7 +246,7 @@ bool migrateFromSH(QString destDir) { int main(int argc, char* argv[]) { initializeStrings(); - qDebug() << STR_TR_OSCAR + " " + getBranchVersion(); + qDebug() << STR_TR_OSCAR + " " + getVersion(); AutoTest::run(argc, argv); } @@ -554,8 +554,10 @@ int main(int argc, char *argv[]) { // check_updates = false; } else if (currentVersion < settingsVersion) { if (QMessageBox::warning(nullptr, STR_MessageBox_Error, - QObject::tr("The version of OSCAR you just ran is OLDER than the one used to create this data (%1)."). - arg(AppSetting->versionString()) +"\n\n"+ + QObject::tr("The version of OSCAR you are running (%1) is OLDER than the one used to create this data (%2).") + .arg(currentVersion.displayString()) + .arg(settingsVersion.displayString()) + +"\n\n"+ QObject::tr("It is likely that doing this will cause data corruption, are you sure you want to do this?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No) { diff --git a/oscar/mainwindow.cpp b/oscar/mainwindow.cpp index c9d46c27..db1c7f94 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" + getVersion()); + QAction *a = systraymenu->addAction(STR_TR_OSCAR + " " + getVersion().displayString()); a->setEnabled(false); systraymenu->addSeparator(); systraymenu->addAction(tr("&About"), this, SLOT(on_action_About_triggered())); @@ -113,11 +113,19 @@ MainWindow::MainWindow(QWidget *parent) : bool setupRunning = false; +QString MainWindow::getMainWindowTitle() +{ + QString title = STR_TR_OSCAR + " " + getVersion().displayString(); +#ifdef BROKEN_OPENGL_BUILD + title += " ["+CSTR_GFX_BrokenGL+"]"; +#endif + return title; +} + void MainWindow::SetupGUI() { setupRunning = true; - QString version = getBranchVersion(); - setWindowTitle(STR_TR_OSCAR + QString(" %1").arg(version)); + setWindowTitle(getMainWindowTitle()); #ifdef Q_OS_MAC ui->action_About->setMenuRole(QAction::ApplicationSpecificRole); @@ -317,7 +325,7 @@ void MainWindow::EnableTabs(bool b) void MainWindow::Notify(QString s, QString title, int ms) { if (title.isEmpty()) { - title = tr("%1 %2").arg(STR_TR_OSCAR).arg(STR_TR_AppVersion); + title = STR_TR_OSCAR + " " + getVersion().displayString(); } if (systray) { QString msg = s; @@ -527,7 +535,7 @@ bool MainWindow::OpenProfile(QString profileName, bool skippassword) PopulatePurgeMenu(); AppSetting->setProfileName(p_profile->user->userName()); - setWindowTitle(STR_TR_OSCAR + QString(" %1 (" + tr("Profile") + ": %2)").arg(getBranchVersion()).arg(AppSetting->profileName())); + setWindowTitle(tr("%1 (Profile: %2)").arg(getMainWindowTitle()).arg(AppSetting->profileName())); QList<Machine *> oximachines = p_profile->GetMachines(MT_OXIMETER); // Machines of any type except Journal QList<Machine *> posmachines = p_profile->GetMachines(MT_POSITION); diff --git a/oscar/mainwindow.h b/oscar/mainwindow.h index c3171827..b9e6a4a1 100644 --- a/oscar/mainwindow.h +++ b/oscar/mainwindow.h @@ -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"+getVersion()); + /*! \fn Notify(QString s, QString title="OSCAR (version)", int ms=5000); \brief Pops up a message box near the system tray \param QString string \param title @@ -348,6 +348,7 @@ class MainWindow : public QMainWindow private: + QString getMainWindowTitle(); void importCPAPBackups(); void finishCPAPImport(); QList<ImportPath> detectCPAPCards(); diff --git a/oscar/newprofile.cpp b/oscar/newprofile.cpp index 9c21bff9..df2ddbff 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(getVersion()); + ui->versionLabel->setText(""); ui->textBrowser->setHtml(getIntroHTML()); } diff --git a/oscar/profileselect.cpp b/oscar/profileselect.cpp index ae7cd0c4..fa62f99c 100644 --- a/oscar/profileselect.cpp +++ b/oscar/profileselect.cpp @@ -95,7 +95,7 @@ ProfileSelect::ProfileSelect(QWidget *parent) : popupMenu->addAction(tr("Delete Profile"), this, SLOT(deleteProfile())); ui->labelAppName->setText(STR_TR_OSCAR); - ui->labelVersion->setText(STR_TR_AppVersion); + ui->labelVersion->setText(""); // if (GIT_BRANCH!="master") // ui->labelBuild->setText(GIT_BRANCH); // else ui->labelBuild->setText(QString()); diff --git a/oscar/profileselector.cpp b/oscar/profileselector.cpp index 34c7397c..8db6f013 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(getVersion()); + ui->versionLabel->setText(""); ui->diskSpaceInfo->setVisible(false); QItemSelectionModel * sm = ui->profileView->selectionModel(); diff --git a/oscar/reports.cpp b/oscar/reports.cpp index c4b3011c..484ea1b1 100644 --- a/oscar/reports.cpp +++ b/oscar/reports.cpp @@ -558,8 +558,9 @@ 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(getVersion()+" (" + gitRevision() + ")"); + QString footer = QObject::tr("%1 %2 %3").arg(timestamp.toString(MedDateFormat+" hh:mm")) + .arg(STR_TR_OSCAR) + .arg(getVersion()); QRectF bounds = painter.boundingRect(QRectF(0, virt_height, virt_width, normal_height), footer, diff --git a/oscar/statistics.cpp b/oscar/statistics.cpp index d4cb8d98..19b47534 100644 --- a/oscar/statistics.cpp +++ b/oscar/statistics.cpp @@ -719,8 +719,8 @@ QString Statistics::generateFooter(bool showinfo) if (showinfo) { html += "<hr><div align=center><font size='-1'><i>"; QDateTime timestamp = QDateTime::currentDateTime(); - html += tr("This report was prepared on %1 by OSCAR v%2").arg(timestamp.toString(MedDateFormat + " hh:mm")) - .arg(getVersion() + " (" + gitRevision() + ")") + html += tr("This report was prepared on %1 by OSCAR %2").arg(timestamp.toString(MedDateFormat + " hh:mm")) + .arg(getVersion()) + "<br/>" + tr("OSCAR is free open-source CPAP report software"); html += "</i></font></div>"; diff --git a/oscar/version.cpp b/oscar/version.cpp index 9636c29c..faf97a04 100644 --- a/oscar/version.cpp +++ b/oscar/version.cpp @@ -35,24 +35,6 @@ const QString & gitBranch() return GIT_BRANCH; } -QString getBranchVersion() -{ - QString version = STR_TR_AppVersion; - - if (getVersion().IsReleaseVersion() == false) - version += " ("+GIT_REVISION + ")"; - - if (GIT_BRANCH != "master") { - version += " [Branch: " + GIT_BRANCH + "]"; - } - -#ifdef BROKEN_OPENGL_BUILD - version += " ["+CSTR_GFX_BrokenGL+"]"; -#endif - return version; -} - - QString getPrereleaseSuffix() { QString suffix; @@ -100,7 +82,7 @@ const QString & Version::toString() const // Alternate formatting of the version string for display or logging const QString Version::minimalString() const { - return toString().section("+", 0); + return toString().section("+", 0, 0); } const QString & Version::getBuildMetadata() const @@ -120,10 +102,10 @@ const QString Version::displayString() const const QString Version::PrereleaseType() const { // Extract the first identifier - QString type = mPrerelease.section(".", 0); + QString type = mPrerelease.section(".", 0, 0); // Remove any "-2", etc. that's included in the first identifier rather than as a dot-separated identifier - type = type.section("-", 0); + type = type.section("-", 0, 0); return type.toLower(); } diff --git a/oscar/version.h b/oscar/version.h index b518ef17..b037193b 100644 --- a/oscar/version.h +++ b/oscar/version.h @@ -51,7 +51,6 @@ protected: //!brief Get the current version of the application. const Version & getVersion(); -QString getBranchVersion(); QString getPrereleaseSuffix(); const QString & gitRevision(); const QString & gitBranch();