Skip to content

Commit

Permalink
Merge pull request #811 from matty0ung/usability
Browse files Browse the repository at this point in the history
Fix inability to add ingredients to recipe
  • Loading branch information
matty0ung authored Aug 20, 2024
2 parents bb82aed + 2d22d12 commit 0b1b936
Show file tree
Hide file tree
Showing 52 changed files with 350 additions and 228 deletions.
17 changes: 16 additions & 1 deletion CHANGES.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,28 @@
This change log is for high-level user-visible changes to Brewtarget, intended for consumption by the typical end-user.
Note however that we also process it into a Debian-compliant text change log, so we need to keep the format consistent.
In particular, the Release Timestamp section is needed as part of this (and you need to be meticulous about the date
format therein, otherwise you'll get, eg, no-changelogname-tag error from rpmlint).
format therein, otherwise you'll get, eg, no-changelogname-tag error from rpmlint). You get problems if you set the
release timestamp to be a date in the future, and I'm guessing nobody cares about the exact time of day a release
happens, so I'm now setting it to a slightly arbitrary time early in the morning.

## Forthcoming in v4.1.0

### New Features
* We'll list new features here...


## v4.0.2
Minor bug fixes for the 4.0.1 release (ie bugs in 4.0.1 are fixed in this 4.0.2 release).

### New Features
* None

### Bug Fixes
* Unable to add ingredients to recipe (4.0.X) [810](https://github.com/Brewtarget/brewtarget/issues/810)

### Release Timestamp
Tue, 20 Aug 2024 04:00:02 +0100

## v4.0.1
Minor bug fixes for the 4.0.0 release (ie bugs in 4.0.0 are fixed in this 4.0.1 release).

Expand Down
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,15 @@ endif()
#=======================================================================================================================
# It's simplest to keep the project name all lower-case as it means we can use a lot more of the default settings for
# Linux packaging (where directory names etc are expected to be all lower-case).
project(brewtarget VERSION 4.0.1 LANGUAGES CXX)
project(brewtarget VERSION 4.0.2 LANGUAGES CXX)
message(STATUS "Building ${PROJECT_NAME} version ${PROJECT_VERSION}")
message(STATUS "PROJECT_SOURCE_DIR is ${PROJECT_SOURCE_DIR}")
# Sometimes we do need the capitalised version of the project name
set(capitalisedProjectName Brewtarget)
# We use this in the program, to tell users where to get support.
set(CONFIG_HOMEPAGE_URL "https://github.com/${capitalisedProjectName}/${projectName}")
set(CONFIG_ORGANIZATION_DOMAIN "brewtarget.com")
set(CONFIG_GITHUB_URL "https://github.com/${capitalisedProjectName}/${projectName}")
set(CONFIG_WEBSITE_URL "https://www.brewtarget.beer/")
set(CONFIG_ORGANIZATION_DOMAIN "brewken.com")

#=======================================================================================================================
#======================================================= Options =======================================================
Expand Down
7 changes: 4 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
#
#
project('brewtarget', 'cpp',
version: '4.0.1',
version: '4.0.2',
license: 'GPL-3.0-or-later',
meson_version: '>=0.60.0',
default_options : ['cpp_std=c++20',
Expand Down Expand Up @@ -1338,8 +1338,9 @@ exportedVariables = {
'CONFIG_ORGANIZATION_NAME' : 'The ' + capitalisedProjectName + ' Team',

# Similarly, installers often want a URL link. We also use this in the program, to tell users where to get support.
'CONFIG_HOMEPAGE_URL' : 'https://github.com/' + capitalisedProjectName + '/' + projectName,
'CONFIG_ORGANIZATION_DOMAIN' : 'brewtarget.com',
'CONFIG_GITHUB_URL' : 'https://github.com/' + capitalisedProjectName + '/' + projectName,
'CONFIG_WEBSITE_URL' : 'https://www.brewtarget.beer/',
'CONFIG_ORGANIZATION_DOMAIN' : 'brewken.com',

#
# On Windows and Mac, the external packaging step (managed by the `bt` build tool script) needs to know about all the
Expand Down
39 changes: 31 additions & 8 deletions packaging/darwin/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!--
#
# packaging/mac/Info.plist.in is part of Brewtarget, and is copyright the following authors 2023:
# packaging/darwin/Info.plist.in is part of Brewtarget, and is copyright the following authors 2023-2024:
# • Matt Young <[email protected]>
#
# Brewtarget is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
Expand All @@ -21,12 +21,19 @@
# See comments in meson.build for how this file gets processed into mbuild/Info.plist. Then see comments in the build
# tool for how it ends up in the Mac application bundle.
#
# https://developer.apple.com/documentation/bundleresources/information_property_list and related pages give info on the
# individual parameters
#
# The following bundle parameters used in oldver versions of this file are AFAICT deprecated, so I have removed them:
# CFBundleLongVersionString
# CFBundleSignature
#
-->
<plist version="1.0">
<dict>
<!--
Language the system if it can't locate a resource for the user’s preferred language. Value should be a language ID
(ideally the two-letter ISO 639-1 standard) that identifies a language, dialect, or script.
Default language for the system if it can't locate a resource for the user’s preferred language. Value should be a
language ID (ideally the two-letter ISO 639-1 standard) that identifies a language, dialect, or script.
-->
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
Expand All @@ -42,25 +49,41 @@
-->
<key>CFBundleIconFile</key>
<string>@CONFIG_INSTALLER_APPLICATION_ICON@</string>
<!--
A bundle ID uniquely identifies a single app throughout the system. The bundle ID string must contain only
alphanumeric characters (A–Z, a–z, and 0–9), hyphens (-), and periods (.). Typically, you use a reverse-DNS format
for bundle ID strings. Bundle IDs are case-insensitive.
-->
<key>CFBundleIdentifier</key>
<string>com.brewtarget.Brewtarget</string>
<string>beer.brewtarget.Brewtarget</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleLongVersionString</key>
<string></string>
<key>CFBundleName</key>
<string>@CONFIG_APPLICATION_NAME_UC@</string>
<!--
This key consists of a four-letter code for the bundle type. For apps, the code is APPL, for frameworks, it's FMWK,
and for bundles, it's BNDL. The default value is derived from the bundle extension or, if it can't be derived, the
default value is BNDL.
-->
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@CONFIG_VERSION_STRING@</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>@CONFIG_VERSION_STRING@</string>
<!--
A Boolean value indicating whether the app's resources files should be mapped into memory.
-->
<key>CSResourcesFileMapped</key>
<true/>
<key>NSHumanReadableCopyright</key>
<string>@CONFIG_COPYRIGHT_STRING@</string>
<!--
There isn't a great choice for us for application category from the list at
https://developer.apple.com/documentation/bundleresources/information_property_list/lsapplicationcategorytype
This value seemed as close as any.
-->
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions packaging/linux/control.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# packaging/linux/control.in is part of Brewtarget, and is copyright the following authors 2023:
# packaging/linux/control.in is part of Brewtarget, and is copyright the following authors 2023-2024:
# • Matt Young <[email protected]>
#
# Brewtarget is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -121,4 +121,4 @@ Description: GUI beer brewing software
#
# Homepage (Optional)
#
Homepage: @CONFIG_HOMEPAGE_URL@
Homepage: @CONFIG_WEBSITE_URL@
4 changes: 2 additions & 2 deletions packaging/linux/rpm.spec.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# packaging/linux/rpm.spec.in is part of Brewtarget, and is copyright the following authors 2023:
# packaging/linux/rpm.spec.in is part of Brewtarget, and is copyright the following authors 2023-2024:
# • Matt Young <[email protected]>
#
# Brewtarget is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -43,7 +43,7 @@ Group : Applications/Productivity
Summary : GUI beer brewing software

# URL supplying further information about the package, typically upstream website.
URL : @CONFIG_HOMEPAGE_URL@
URL : @CONFIG_WEBSITE_URL@
Vendor : @CONFIG_ORGANIZATION_NAME@

# Specifies the architecture which the resulting binary package will run on. Typically this is a CPU architecture.
Expand Down
8 changes: 4 additions & 4 deletions packaging/windows/NsisInstallerScript.nsi.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# packaging/windows/NsisInstallerScript.nsi.in is part of Brewtarget, and is copyright the following authors 2023:
# packaging/windows/NsisInstallerScript.nsi.in is part of Brewtarget, and is copyright the following authors 2023-2024:
# • Matt Young <[email protected]>
#
# Brewtarget is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -119,15 +119,15 @@ RequestExecutionLevel admin
#
# Other variables injected from Meson
#
# Similarly, although we could use other injected variables directly, we don't to avoid another gotcha. When Meson
# Similarly, although we could use other injected variables directly, we don't, to avoid another gotcha. When Meson
# is processing the file to do @BLAH@ substitutions, if it sees a backslash followed by an @, then it will think you're
# escaping the first @ symbol, so, eg "C:\Blah\@CONFIG_APPLICATION_NAME_UC@" will not get converted to
# "C:\Blah\Brewtarget" or "C:\Blah\Brewken". Instead, we take the injected variable into an NSIS compile-time constant
# (aka a 'define') via:
# !define INJECTED_APPLICATION_NAME_UC "@CONFIG_APPLICATION_NAME_UC@"
# and then we can write "C:\Blah\${INJECTED_APPLICATION_NAME_UC}" and the right substitutions will happen. (The
# alternative, of adding an extra slash, eg "C:\Blah\\@CONFIG_APPLICATION_NAME_UC@", would work but seems a bit less
# robust.
# robust.)
#
!define INJECTED_APPLICATION_NAME_UC "@CONFIG_APPLICATION_NAME_UC@"
!define INJECTED_APPLICATION_NAME_LC "@CONFIG_APPLICATION_NAME_LC@"
Expand All @@ -136,7 +136,7 @@ RequestExecutionLevel admin
!define INJECTED_DESCRIPTION_STRING "@CONFIG_DESCRIPTION_STRING@"
!define INJECTED_COPYRIGHT_STRING "@CONFIG_COPYRIGHT_STRING@"
!define INJECTED_ORGANIZATION_NAME "@CONFIG_ORGANIZATION_NAME@"
!define INJECTED_HOMEPAGE_URL "@CONFIG_HOMEPAGE_URL@"
!define INJECTED_HOMEPAGE_URL "@CONFIG_WEBSITE_URL@"

#=======================================================================================================================
#==================================================== Our Constants ====================================================
Expand Down
2 changes: 1 addition & 1 deletion src/AboutDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ AboutDialog::AboutDialog(QWidget * parent) :
" </p>"
"</html>"
)
.arg(CONFIG_APPLICATION_NAME_UC, CONFIG_VERSION_STRING, CONFIG_HOMEPAGE_URL)
.arg(CONFIG_APPLICATION_NAME_UC, CONFIG_VERSION_STRING, CONFIG_GITHUB_URL)
);
return;
}
Expand Down
43 changes: 27 additions & 16 deletions src/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include <QtNetwork/QNetworkReply>
#include <QtNetwork/QNetworkRequest>
#include <QUrl>
#include <QVersionNumber>

#include "Algorithms.h"
#include "BtSplashScreen.h"
Expand Down Expand Up @@ -237,33 +238,43 @@ namespace {

QJsonObject jsonObject = jsonDocument.object();

QString remoteVersion = jsonObject.value("name").toString();
qDebug() << Q_FUNC_INFO << "Latest release is" << remoteVersion << "; this release is" << CONFIG_VERSION_STRING;

QString remoteVersion = jsonObject.value("tag_name").toString();
// Version names are usually "v3.0.2" etc, so we want to strip the 'v' off the front
if (remoteVersion.startsWith("v", Qt::CaseInsensitive)) {
remoteVersion.remove(0, 1);
}

//
// We used to just compare if the remote version is the same as the current one, but it then gets annoying if you
// are running the nightly build and it keeps asking if you want to, eg, download 4.0.0 because you're "only"
// running 4.0.1. So now we do it properly, letting QVersionNumber do the heavy lifting for us.
//
QVersionNumber const currentlyRunning{QVersionNumber::fromString(CONFIG_VERSION_STRING)};
QVersionNumber const latestRelease {QVersionNumber::fromString(remoteVersion)};

qInfo() <<
Q_FUNC_INFO << "Latest release is" << remoteVersion << "(parsed as" << latestRelease << ") ; "
"currently running" << CONFIG_VERSION_STRING << "(parsed as" << currentlyRunning << ")";

// If the remote version is newer...
if (!remoteVersion.startsWith(CONFIG_VERSION_STRING)) {
if (latestRelease > currentlyRunning) {
// ...and the user wants to download the new version...
if( QMessageBox::information(&MainWindow::instance(),
QObject::tr("New Version"),
QObject::tr("Version %1 is now available. Download it?").arg(remoteVersion),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes) == QMessageBox::Yes ) {
if(QMessageBox::information(&MainWindow::instance(),
QObject::tr("New Version"),
QObject::tr("Version %1 is now available. Download it?").arg(remoteVersion),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes) == QMessageBox::Yes) {
// ...take them to the website.
static QString const releasesPage = QString{"%1/releases"}.arg(CONFIG_HOMEPAGE_URL);
static QString const releasesPage = QString{"%1/releases"}.arg(CONFIG_GITHUB_URL);
QDesktopServices::openUrl(QUrl(releasesPage));
} else {
// ... and the user does NOT want to download the new version...
// ... and they want us to stop bothering them...
if( QMessageBox::question(&MainWindow::instance(),
QObject::tr("New Version"),
QObject::tr("Stop bothering you about new versions?"),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes) == QMessageBox::Yes) {
if(QMessageBox::question(&MainWindow::instance(),
QObject::tr("New Version"),
QObject::tr("Stop bothering you about new versions?"),
QMessageBox::Yes | QMessageBox::No,
QMessageBox::Yes) == QMessageBox::Yes) {
// ... make a note to stop bothering the user about the new version.
setCheckVersion(false);
}
Expand Down Expand Up @@ -298,7 +309,7 @@ namespace {
// Since Qt5, you can connect signals to simple functions (see https://wiki.qt.io/New_Signal_Slot_Syntax)
QObject::connect(responseToCheckForNewVersion, &QNetworkReply::finished, mw, &finishCheckForNewVersion);
qDebug() <<
Q_FUNC_INFO << "Sending request to check for new version (request running =" <<
Q_FUNC_INFO << "Sending request to" << url << "to check for new version (request running =" <<
responseToCheckForNewVersion->isRunning() << ")";
return;
}
Expand Down
9 changes: 5 additions & 4 deletions src/HelpDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class HelpDialog::impl {
* Set the text. This is a separate function because we want to be able to redisplay in a different language.
*/
void setText(HelpDialog & helpDialog) {
static QString const wikiUrl = QString{"%1/wiki" }.arg(CONFIG_HOMEPAGE_URL);
static QString const issuesUrl = QString{"%1/issues"}.arg(CONFIG_HOMEPAGE_URL);
static QString const wikiUrl = QString{"%1/wiki" }.arg(CONFIG_GITHUB_URL);
static QString const issuesUrl = QString{"%1/issues"}.arg(CONFIG_GITHUB_URL);
QString mainText;
QTextStream mainTextAsStream{&mainText};
mainTextAsStream <<
Expand All @@ -70,8 +70,9 @@ class HelpDialog::impl {
"</style>"
"</head>"
""
"<h1>" << CONFIG_APPLICATION_NAME_UC << "</h1>"
"version " << CONFIG_VERSION_STRING << " " << HelpDialog::tr("for") << " " << QSysInfo::prettyProductName() <<
"<h1>" << CONFIG_APPLICATION_NAME_UC << "</h1>" <<
HelpDialog::tr("version %1 for %2").arg(CONFIG_VERSION_STRING).arg(QSysInfo::prettyProductName()) <<
"<p><a href=\"" << CONFIG_WEBSITE_URL << "\">" << CONFIG_ORGANIZATION_DOMAIN << " website</a></p>"
"<h2>" << HelpDialog::tr("Online Help") << "</h2>"
"<p>" <<
HelpDialog::tr("<p>The %1 wiki is at "
Expand Down
Loading

0 comments on commit 0b1b936

Please sign in to comment.