Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparation for upgrade to Qt 6 #846

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,6 @@ jobs:
# (which is not yet generated) uses a real certificate that will be supplied by Signpath and will be suitable
# for signing released versions of the application.
#
# For the moment, everything uses "test-signing". Once that's working, we'll use the logic below.
#
# -=-=-=-=-=-=-=-=-=-=-
#
# Select "release-signing" policy for things we're going to release and "test-signing" otherwise.
#
# Currently our main branch for releasing is called "develop", but we'll probably change it to "main" in the
Expand All @@ -301,11 +297,10 @@ jobs:
# We don't do release branches per se, but, before we do a lot of commits for a major release, we'll usually
# cut a "stable/" branch for the prior one.
#
SIGNPATH_SIGNING_POLICY_SLUG: 'test-signing'
# SIGNPATH_SIGNING_POLICY_SLUG: |
# ${{ (github.ref == 'refs/heads/develop' ||
# github.ref == 'refs/heads/main' ||
# startsWith(github.ref, 'refs/heads/stable/')) && 'release-signing' || 'test-signing' }}
SIGNPATH_SIGNING_POLICY_SLUG: |
${{ (github.ref == 'refs/heads/develop' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/stable/')) && 'release-signing' || 'test-signing' }}
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: '${{ vars.SIGNPATH_ORGANIZATION_ID }}'
Expand Down
3 changes: 2 additions & 1 deletion CHANGES.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ Bug fixes for the 4.0.5 release (ie bugs in 4.0.5 are fixed in this 4.0.6 releas
* Ingredient inventory edits not saved [832](https://github.com/Brewtarget/brewtarget/issues/832)
* Unsatisfied dependency for Brewtarget update in ubuntu 24.01 [840](https://github.com/Brewtarget/brewtarget/issues/840)
* Cmake error on Linux Mint 22 Wilma [843](https://github.com/Brewtarget/brewtarget/issues/843)
* Binaries are not signed on Windows [827](https://github.com/Brewtarget/brewtarget/issues/827)

### Release Timestamp
Tue, 1 Oct 2024 04:00:06 +0100
Wed, 2 Oct 2024 04:00:06 +0100

## v4.0.5
Bug fixes for the 4.0.4 release (ie bugs in 4.0.4 are fixed in this 4.0.5 release).
Expand Down
60 changes: 31 additions & 29 deletions scripts/buildTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,35 +660,37 @@ def installDependencies():
)
)

#
# Ubuntu 20.04 packages only have Meson 0.53.2, and we need 0.60.0 or later. In this case it means we have to
# install Meson via pip, which is not ideal on Linux.
#
# Specifically, as explained at https://mesonbuild.com/Getting-meson.html#installing-meson-with-pip, although
# using the pip3 install gets a newer version, we have to do the pip install as root (which is normally not
# recommended). If we don't do this, then running `meson install` (or even `sudo meson install`) will barf on
# Linux (because we need to be able to install files into system directories).
#
# So, where a sufficiently recent version of Meson is available in the distro packages (eg
# `sudo apt install meson` on Ubuntu etc) it is much better to install this. Installing via pip is a last
# resort.
#
# The distro ID we get from 'lsb_release -is' will be 'Ubuntu' for all the variants of Ubuntu (eg including
# Kubuntu). Not sure what happens on derivatives such as Linux Mint though.
#
distroName = str(
btUtils.abortOnRunFail(subprocess.run(['lsb_release', '-is'], encoding = "utf-8", capture_output = True)).stdout
).rstrip()
log.debug('Linux distro: ' + distroName)
if ('Ubuntu' == distroName):
ubuntuRelease = str(
btUtils.abortOnRunFail(subprocess.run(['lsb_release', '-rs'], encoding = "utf-8", capture_output = True)).stdout
).rstrip()
log.debug('Ubuntu release: ' + ubuntuRelease)
if (Decimal(ubuntuRelease) < Decimal('22.04')):
log.info('Installing newer version of Meson the hard way')
btUtils.abortOnRunFail(subprocess.run(['sudo', 'apt', 'remove', '-y', 'meson']))
btUtils.abortOnRunFail(subprocess.run(['sudo', 'pip3', 'install', 'meson']))
### #
### # Commented this out as, as of 2024, we don't support Ubuntu 20.04 any more.
### #
### # Ubuntu 20.04 packages only have Meson 0.53.2, and we need 0.60.0 or later. In this case it means we have to
### # install Meson via pip, which is not ideal on Linux.
### #
### # Specifically, as explained at https://mesonbuild.com/Getting-meson.html#installing-meson-with-pip, although
### # using the pip3 install gets a newer version, we have to do the pip install as root (which is normally not
### # recommended). If we don't do this, then running `meson install` (or even `sudo meson install`) will barf on
### # Linux (because we need to be able to install files into system directories).
### #
### # So, where a sufficiently recent version of Meson is available in the distro packages (eg
### # `sudo apt install meson` on Ubuntu etc) it is much better to install this. Installing via pip is a last
### # resort.
### #
### # The distro ID we get from 'lsb_release -is' will be 'Ubuntu' for all the variants of Ubuntu (eg including
### # Kubuntu). Not sure what happens on derivatives such as Linux Mint though.
### #
### distroName = str(
### btUtils.abortOnRunFail(subprocess.run(['lsb_release', '-is'], encoding = "utf-8", capture_output = True)).stdout
### ).rstrip()
### log.debug('Linux distro: ' + distroName)
### if ('Ubuntu' == distroName):
### ubuntuRelease = str(
### btUtils.abortOnRunFail(subprocess.run(['lsb_release', '-rs'], encoding = "utf-8", capture_output = True)).stdout
### ).rstrip()
### log.debug('Ubuntu release: ' + ubuntuRelease)
### if (Decimal(ubuntuRelease) < Decimal('22.04')):
### log.info('Installing newer version of Meson the hard way')
### btUtils.abortOnRunFail(subprocess.run(['sudo', 'apt', 'remove', '-y', 'meson']))
### btUtils.abortOnRunFail(subprocess.run(['sudo', 'pip3', 'install', 'meson']))

#-----------------------------------------------------------------------------------------------------------------
#--------------------------------------------- Windows Dependencies ----------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/AncestorDialog.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
* AncestorDialog.cpp is part of Brewtarget, and is copyright the following authors 2021-2023:
* AncestorDialog.cpp is part of Brewtarget, and is copyright the following authors 2021-2024:
* • Matt Young <[email protected]>
* • Mik Firestone <[email protected]>
*
Expand All @@ -18,9 +18,9 @@

#include <algorithm>

#include <QAction>
#include <QDebug>
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QComboBox>
Expand Down
3 changes: 1 addition & 2 deletions src/AncestorDialog.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
* AncestorDialog.h is part of Brewtarget, and is copyright the following authors 2021-2023:
* AncestorDialog.h is part of Brewtarget, and is copyright the following authors 2021-2024:
* • Matt Young <[email protected]>
* • Mik Firestone <[email protected]>
*
Expand All @@ -19,7 +19,6 @@
#pragma once

#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QComboBox>
Expand Down
4 changes: 0 additions & 4 deletions src/BtTabWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@
#include "trees/TreeNode.h"
#include "database/ObjectStoreWrapper.h"
#include "model/Equipment.h"
#include "model/Fermentable.h"
#include "model/Hop.h"
#include "model/Misc.h"
#include "model/Recipe.h"
#include "model/Style.h"
#include "model/Yeast.h"


//! \brief set up the popup window.
Expand Down
11 changes: 6 additions & 5 deletions src/BtTabWidget.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
* BtTabWidget.h is part of Brewtarget, and is copyright the following authors 2009-2022:
* BtTabWidget.h is part of Brewtarget, and is copyright the following authors 2009-2024:
* • Matt Young <[email protected]>
* • Mik Firestone <[email protected]>
* • Philip Greggory Lee <[email protected]>
Expand All @@ -21,13 +21,14 @@

#include <QTabWidget>

#include "model/Fermentable.h"
#include "model/Hop.h"
#include "model/Misc.h"
#include "model/Yeast.h"

class Equipment;
class Fermentable;
class Hop;
class Misc;
class Recipe;
class Style;
class Yeast;

/*!
* \class BtTabWdiget
Expand Down
18 changes: 10 additions & 8 deletions src/Localization.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
* Localization.cpp is part of Brewtarget, and is copyright the following authors 2011-2023:
* Localization.cpp is part of Brewtarget, and is copyright the following authors 2011-2024:
* • Greg Meess <[email protected]>
* • Matt Young <[email protected]>
* • Mik Firestone <[email protected]>
Expand All @@ -25,6 +25,7 @@
#include <QDir>
#include <QLibraryInfo>
#include <QLocale>
#include <QRegularExpression>
#include <QTranslator>

#include "Application.h"
Expand Down Expand Up @@ -150,15 +151,16 @@ QString const & Localization::getSystemLanguage() {
}

bool Localization::hasUnits(QString qstr) {
QString decimal = QRegExp::escape(Localization::getLocale().decimalPoint());
QString grouping = QRegExp::escape(Localization::getLocale().groupSeparator());
QString decimal = QRegularExpression::escape(Localization::getLocale().decimalPoint());
QString grouping = QRegularExpression::escape(Localization::getLocale().groupSeparator());

QRegExp amtUnit("((?:\\d+" + grouping + ")?\\d+(?:" + decimal + "\\d+)?|" + decimal + "\\d+)\\s*(\\w+)?");
amtUnit.indexIn(qstr);
QRegularExpression amtUnit("((?:\\d+" + grouping + ")?\\d+(?:" + decimal + "\\d+)?|" + decimal + "\\d+)\\s*(\\w+)?");
QRegularExpressionMatch match = amtUnit.match(qstr);

bool result = amtUnit.cap(2).size() > 0;

qDebug() << Q_FUNC_INFO << qstr << (result ? "has" : "does not have") << "units";
// We could use hasCaptured here, but for debugging it's helpful to be able to show what we matched.
QString const units = match.captured(2);
bool const result = units.size() > 0;
qDebug() << Q_FUNC_INFO << qstr << (result ? "has" : "does not have") << "units:" << units;

return result;
}
Expand Down
11 changes: 6 additions & 5 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

#include <QAction>
#include <QBrush>
#include <QDesktopWidget>
#include <QFile>
#include <QFileDialog>
#include <QIcon>
Expand All @@ -57,6 +56,7 @@
#include <QMessageBox>
#include <QPen>
#include <QPixmap>
#include <QScreen>
#include <QSize>
#include <QString>
#include <QTextStream>
Expand Down Expand Up @@ -1276,13 +1276,14 @@ void MainWindow::restoreSavedState() {
restoreState(PersistentSettings::value(PersistentSettings::Names::windowState).toByteArray());
} else {
// otherwise, guess a reasonable size at 1/4 of the screen.
QDesktopWidget *desktop = QApplication::desktop();
int width = desktop->width();
int height = desktop->height();
QScreen * screen = this->screen();
QRect const desktop = screen->availableGeometry();
int const width = desktop.width();
int const height = desktop.height();
this->resize(width/2,height/2);

// Or we could do the same in one line:
// this->resize(QDesktopWidget().availableGeometry(this).size() * 0.5);
// this->resize(this->screen().availableGeometry().size() * 0.5);
}

// If we saved the selected recipe name the last time we ran, select it and show it.
Expand Down
24 changes: 20 additions & 4 deletions src/RadarChart.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
* RadarChart.cpp is part of Brewtarget, and is copyright the following authors 2021-2023:
* RadarChart.cpp is part of Brewtarget, and is copyright the following authors 2021-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 @@ -46,7 +46,7 @@ namespace std {
namespace {
struct ColorAndObject{
QColor color;
QObject const * object;
NamedEntity const * object;
};

// Qt measures angles either in degrees or sixteenths of a degree, measured clockwise starting from 12 o'clock as 0°
Expand Down Expand Up @@ -98,6 +98,9 @@ class RadarChart::impl {
void updateMaxAxisValue() {
double maxInAllSeries = 0.0;
for (auto currSeries : qAsConst(this->allSeries)) {
// It's a coding error if we have a series with a null pointer. (If the object has gone away, we should remove
// the series.)
Q_ASSERT(currSeries.object);
auto maxVariableInThisSeries = std::max_element(
this->variableNames.begin(),
this->variableNames.end(),
Expand Down Expand Up @@ -183,15 +186,28 @@ void RadarChart::init(QString const unitsName,
return;
}

void RadarChart::addSeries(QString name, QColor color, QObject const & object) {
void RadarChart::addSeries(QString name, QColor color, NamedEntity const & object) {

// Can't store an object or a reference in a hash, but we can store a pointer
// (Still good to have the object passed in by reference as it saves having to check/assert for null pointers.)
this->pimpl->allSeries.insert(name, {color, &object});
this->replot();
qDebug() <<
Q_FUNC_INFO << "Added" << name << object.metaObject()->className() << "#" << object.key() << ":" << object.name();
// We deliberately don't replot here because the caller might need to make further calls before it is OK to redraw
// the graph.
return;
}

void RadarChart::removeSeries(QString name) {
// It doesn't matter if the series is not present - QHash remove will just return false, but nothing bad happens
this->pimpl->allSeries.remove(name);
qDebug() << Q_FUNC_INFO << "Removed" << name;
// We deliberately don't replot here because the caller might need to make further calls before it is OK to redraw
// the graph.
return;
}


void RadarChart::replot() {
this->pimpl->updateMaxAxisValue();

Expand Down
8 changes: 6 additions & 2 deletions src/RadarChart.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌
* RadarChart.h is part of Brewtarget, and is copyright the following authors 2021-2023:
* RadarChart.h is part of Brewtarget, and is copyright the following authors 2021-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 @@ -23,6 +23,7 @@
#include <QString>
#include <QVector>

#include "model/NamedEntity.h"
#include "utils/BtStringConst.h"

/**
Expand Down Expand Up @@ -67,7 +68,10 @@ class RadarChart: public QWidget {
* @param color Color in which to plot the series
* @param values The object whose properties are to be plotted for this series
*/
void addSeries(QString name, QColor color, QObject const & object);
void addSeries(QString name, QColor color, NamedEntity const & object);

//! \brief Remove the named series if present
void removeSeries(QString name);

/**
* @brief (Re)plot the graph. Call this when there's a change to a property on an object being plotted, so that the
Expand Down
Loading
Loading