From 2ee3c2bf3a3ce71bd9dd6ece7ae1a06aa8d1efdd Mon Sep 17 00:00:00 2001 From: Ernie Pasveer Date: Sun, 3 Oct 2021 10:34:50 -0500 Subject: [PATCH] Add a global version number. So the main() and About dialog can use it. --- notes/README.git | 14 ++++++++++++++ src/SeerAboutDialog.cpp | 13 +++++++++++-- src/SeerUtl.cpp | 6 ++++++ src/SeerUtl.h | 2 ++ src/seer.cpp | 4 ++-- 5 files changed, 35 insertions(+), 4 deletions(-) diff --git a/notes/README.git b/notes/README.git index 9960e53..0cce99c 100644 --- a/notes/README.git +++ b/notes/README.git @@ -7,3 +7,17 @@ % git merge better_refresh # Merge a branch back with the mainline. +Git token refreshing. + + erniep@gracie:/peak/src/seer$ gh auth login + ? What account do you want to log into? GitHub.com + ? What is your preferred protocol for Git operations? HTTPS + ? How would you like to authenticate GitHub CLI? Paste an authentication token + Tip: you can generate a Personal Access Token here https://github.com/settings/tokens + The minimum required scopes are 'repo', 'read:org', 'workflow'. + ? Paste your authentication token: **************************************** + - gh config set -h github.com git_protocol https + ✓ Configured git protocol + ✓ Logged in as epasveer + erniep@gracie:/peak/src/seer$ + diff --git a/src/SeerAboutDialog.cpp b/src/SeerAboutDialog.cpp index ec4d565..aeb8ce9 100644 --- a/src/SeerAboutDialog.cpp +++ b/src/SeerAboutDialog.cpp @@ -1,4 +1,5 @@ #include "SeerAboutDialog.h" +#include "SeerUtl.h" #include #include @@ -8,14 +9,22 @@ SeerAboutDialog::SeerAboutDialog (QWidget* parent) : QDialog(parent) { setupUi(this); // Setup the widgets + + // Add the Version number to the end of the About text. + // Scroll back to the top. + textEdit->moveCursor (QTextCursor::End); + textEdit->insertPlainText ("\n"); + textEdit->insertPlainText ("\n"); + textEdit->insertPlainText ("Version: " + Seer::version()); + textEdit->insertPlainText ("\n"); + textEdit->moveCursor (QTextCursor::Start); + // Set the TextEdit's background to the same as the window's. QColor windowColor = palette().color(QWidget::backgroundRole()); QPalette p = textEdit->palette(); p.setColor(QPalette::Base, windowColor); textEdit->setPalette(p); - - // Connect things. } SeerAboutDialog::~SeerAboutDialog () { diff --git a/src/SeerUtl.cpp b/src/SeerUtl.cpp index 6c2a82f..031d98b 100644 --- a/src/SeerUtl.cpp +++ b/src/SeerUtl.cpp @@ -3,6 +3,12 @@ namespace Seer { + QString version () { + + // Increment this with every release on GitHub. + return "1.0.5"; + } + QString filterEscapes (const QString& str) { QString tmp = str; diff --git a/src/SeerUtl.h b/src/SeerUtl.h index d4ee3e9..45f71e3 100644 --- a/src/SeerUtl.h +++ b/src/SeerUtl.h @@ -4,6 +4,8 @@ namespace Seer { + QString version (); + QString filterEscapes (const QString& str); QStringList parse (const QString& str, const QString& search, QChar startBracket, QChar endBracket, bool includeSearch); QString parseFirst (const QString& str, const QString& search, QChar startBracket, QChar endBracket, bool includeSearch); diff --git a/src/seer.cpp b/src/seer.cpp index c6fba68..92de7b5 100644 --- a/src/seer.cpp +++ b/src/seer.cpp @@ -1,4 +1,5 @@ #include "SeerMainWindow.h" +#include "SeerUtl.h" #include #include #include @@ -11,9 +12,8 @@ int main (int argc, char* argv[]) { QApplication app(argc, argv); QCoreApplication::setApplicationName("Seer"); - QCoreApplication::setOrganizationName("Pasvix"); QCoreApplication::setOrganizationName("pasvix.com"); - QCoreApplication::setApplicationVersion("1.0.5 - Ernie Pasveer (c)2021"); + QCoreApplication::setApplicationVersion(Seer::version() + " - Ernie Pasveer (c)2021"); // // Parse arguments.