Skip to content

Commit

Permalink
Update Qt to 6.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpurcell committed Dec 3, 2024
1 parent adabeab commit 2864737
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 61 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,22 @@ jobs:
qtVersion: '5.15.2'
buildArch: 'X64'
- runner: 'macos-14'
qtVersion: '6.7.3'
qtVersion: '6.8.1'
qtModules: 'qtimageformats'
buildArch: 'Universal'
- runner: 'macos-13'
qtVersion: '5.15.2'
osSuffix: '_legacy'
buildArch: 'X64'
- runner: 'windows-2022'
qtVersion: '6.7.3'
qtArch: 'win64_msvc2019_64'
qtVersion: '6.8.1'
qtArch: 'win64_msvc2022_64'
osSuffix: '_64'
qtModules: 'qtimageformats'
buildArch: 'X64'
- runner: 'windows-2022'
qtVersion: '6.7.3'
qtArch: 'win64_msvc2019_arm64'
qtVersion: '6.8.1'
qtArch: 'win64_msvc2022_arm64_cross_compiled'
osSuffix: '_arm64'
qtModules: 'qtimageformats'
buildArch: 'Arm64'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Option to ignore certain file extensions when navigating through a folder.
* Show image loading errors inside viewport instead of as modal dialog.
* Improved performance during rapid image navigation when holding down the previous/next file shortcut keys, and configurable speed no longer linked to key repeat rate.
* Windows: Dark mode supported in Windows 11 by default. Windows 10 users get a "non-native theme" option which supports dark mode.
* Windows: New style which supports dark mode.
* macOS: Option to reuse existing window when launching with image.
* Configurable window positioning behavior after matching image size.
* More accurate zoom-to-fit plus customizable overscan setting.
Expand All @@ -27,7 +27,7 @@
![screenshot](docs/screenshot.png)
## Supported platforms
* Windows 10+ (x64 or ARM64 binaries). You may need to install the [Visual C++ runtime](https://aka.ms/vs/17/release/vc_redist.x64.exe) if you don't have it already.
* macOS 11+ (Universal binary).
* macOS 12+ (Universal binary).
* Legacy Windows (7+, x86), Legacy macOS (10.13+, x64), and Linux AppImage binaries are built via GitHub Actions, but not well tested nor published as releases.
## About releases
There's nothing particularly special about the builds uploaded under "Releases". Every once in a while, typically after enough noteworthy changes, I simply download the binaries from a GitHub Actions run and upload them as a "Release". I do this to make them more easily accessible since the Actions artifacts are only available to users logged into GitHub, and to preserve them since the Actions artifacts expire after 90 days. But in general, I avoid committing unfinished/untested work to the `master` branch. So if you see a commit you're interested in there, no need to wait for a release; simply download the artifact from Actions.
6 changes: 5 additions & 1 deletion dist/scripts/download-plugins.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ if ($pluginNames -contains 'KImageFormats') {
CopyFrameworkDlls "heif.dll" @("libde265.dll")
CopyFrameworkDlls "raw.dll" @("lcms2.dll", "zlib1.dll")
CopyFrameworkDlls "jxl.dll" @("brotlicommon.dll", "brotlidec.dll", "brotlienc.dll", "hwy.dll", "jxl_cms.dll", "jxl_threads.dll", "lcms2.dll")
CopyFrameworkDlls "OpenEXR-3_2.dll" @("deflate.dll", "Iex-3_2.dll", "IlmThread-3_2.dll", "Imath-3_1.dll", "OpenEXRCore-3_2.dll")
if ($kfMajorVer -ge 6) {
CopyFrameworkDlls "OpenEXR-3_3.dll" @("deflate.dll", "Iex-3_3.dll", "IlmThread-3_3.dll", "Imath-3_1.dll", "OpenEXRCore-3_3.dll")
} else {
CopyFrameworkDlls "OpenEXR-3_2.dll" @("deflate.dll", "Iex-3_2.dll", "IlmThread-3_2.dll", "Imath-3_1.dll", "OpenEXRCore-3_2.dll")
}
} elseif ($IsMacOS) {
cp KImageFormats/KImageFormats/output/kimg_*.* "$out_imf/"
cp KImageFormats/KImageFormats/output/libKF?Archive.?.dylib "$out_frm/"
Expand Down
4 changes: 2 additions & 2 deletions dist/scripts/macdeploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ fi
echo "Running codesign"
if [[ "$APPLE_NOTARIZE_REQUESTED" == "true" ]]; then
APP_IDENTIFIER=$(/usr/libexec/PlistBuddy -c "Print CFBundleIdentifier" "qView.app/Contents/Info.plist")
codesign --sign "$CODESIGN_CERT_NAME" --deep --options runtime --timestamp "qView.app"
codesign --sign "$CODESIGN_CERT_NAME" --deep --force --options runtime --timestamp "qView.app"
else
codesign --sign "$CODESIGN_CERT_NAME" --deep "qView.app"
codesign --sign "$CODESIGN_CERT_NAME" --deep --force "qView.app"
fi

echo "Creating disk image"
Expand Down
6 changes: 6 additions & 0 deletions dist/scripts/windeployqt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ if ($env:buildArch -eq 'Arm64') {
windeployqt --no-compiler-runtime bin\qView.exe
}

if ($qtVersion -ge [version]'6.8.1') {
# Copy font so windows11 style can work on Windows 10
New-Item -ItemType Directory -Path "bin\fonts" -Force
Copy-Item -Path "dist\win\fonts\Segoe Fluent Icons.ttf" -Destination "bin\fonts"
}

if ($NightlyVersion -eq '') {
# Call innomake if we are not building a nightly version (no version passed)
& "dist/scripts/innomake.ps1"
Expand Down
Binary file added dist/win/fonts/Segoe Fluent Icons.ttf
Binary file not shown.
49 changes: 32 additions & 17 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "qvwin32functions.h"

#include <QCommandLineParser>
#include <QFontDatabase>

int main(int argc, char *argv[])
{
Expand All @@ -16,30 +17,44 @@ int main(int argc, char *argv[])

SettingsManager::migrateOldSettings();

QString defaultStyleName;
QStringList fontsToInstall;

#ifdef Q_OS_WIN
bool useNonNativeTheme = QSettings().value("options/nonnativetheme").toBool();
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
useNonNativeTheme = false;
#elif QT_VERSION >= QT_VERSION_CHECK(6, 7, 3)
if (useNonNativeTheme && QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows11)
useNonNativeTheme = false; // Disable if we can use windows11 style instead
#endif
QString styleName = useNonNativeTheme ? "fusion" : QString();
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) && QT_VERSION <= QT_VERSION_CHECK(6, 7, 2)
if (styleName.isEmpty())
styleName = "windowsvista"; // windows11 style was buggy for a while after it was introduced
defaultStyleName = "windowsvista"; // windows11 style was buggy for a while after it was introduced
#elif QT_VERSION >= QT_VERSION_CHECK(6, 8, 1)
if (QOperatingSystemVersion::current() < QOperatingSystemVersion::Windows11)
{
// Qt's windows11 style can work on Windows 10, but it isn't enabled by default because the required
// font isn't included with Windows 10. If we can locate and install the font, use windows11 style.
const QString windows11StyleFontPath = QDir(QApplication::applicationDirPath()).filePath("fonts/Segoe Fluent Icons.ttf");
if (QFile::exists(windows11StyleFontPath))
{
defaultStyleName = "windows11";
fontsToInstall.append(windows11StyleFontPath);
}
}
#endif
// The docs recommend calling QApplication's static setStyle before its constructor, one reason
// being that this allows styles to be set via command line arguments. Unfortunately it seems
// that after running windeployqt, some styles such as windowsvista and windows11 aren't yet
// loaded/available until the constructor runs. So we'll use this environment variable instead,
// which Qt uses as a fallback override mechanism if a style wasn't specified via command line.
if (!styleName.isEmpty())
qputenv("QT_STYLE_OVERRIDE", styleName.toLocal8Bit());
#endif

if (!defaultStyleName.isEmpty() && qEnvironmentVariableIsEmpty("QT_STYLE_OVERRIDE"))
{
// The docs recommend calling QApplication's static setStyle before its constructor, one reason
// being that this allows styles to be set via command line arguments. Unfortunately it seems
// that after running windeployqt, some styles such as windowsvista and windows11 aren't yet
// loaded/available until the constructor runs. So we'll use this environment variable instead,
// which Qt uses as a fallback override mechanism if a style wasn't specified via command line.
qputenv("QT_STYLE_OVERRIDE", defaultStyleName.toLocal8Bit());
}

QVApplication app(argc, argv);

for (const QString &font : fontsToInstall)
{
QFontDatabase::addApplicationFont(font);
}

QCommandLineParser parser;
parser.addHelpOption();
parser.addVersionOption();
Expand Down
22 changes: 3 additions & 19 deletions src/qvoptionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ QVOptionsDialog::QVOptionsDialog(QWidget *parent) :
setAttribute(Qt::WA_DeleteOnClose);
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint | Qt::CustomizeWindowHint));

resize(640, 530);
resize(640, 540);

qvApp->ensureFontLoaded(":/fonts/MaterialIconsOutlined-Regular.otf");

connect(ui->categoryList, &QListWidget::currentRowChanged, this, [this](int currentRow) { ui->stackedWidget->setCurrentIndex(currentRow); });
connect(ui->buttonBox, &QDialogButtonBox::clicked, this, &QVOptionsDialog::buttonBoxClicked);
connect(ui->shortcutsTable, &QTableWidget::cellDoubleClicked, this, &QVOptionsDialog::shortcutCellDoubleClicked);
connect(ui->bgColorCheckbox, &QCheckBox::stateChanged, this, &QVOptionsDialog::bgColorCheckboxStateChanged);
connect(ui->nonNativeThemeCheckbox, &QCheckBox::stateChanged, this, [this](int state) { restartNotifyForCheckbox("nonnativetheme", state); });
connect(ui->submenuIconsCheckbox, &QCheckBox::stateChanged, this, [this](int state) { restartNotifyForCheckbox("submenuicons", state); });
connect(ui->slideshowKeepsWindowOnTopCheckbox, &QCheckBox::stateChanged, this, [this](int state) { restartNotifyForCheckbox("slideshowkeepswindowontop", state); });
connect(ui->smoothScalingLimitCheckbox, &QCheckBox::stateChanged, this, &QVOptionsDialog::smoothScalingLimitCheckboxStateChanged);
Expand Down Expand Up @@ -64,16 +63,6 @@ QVOptionsDialog::QVOptionsDialog(QWidget *parent) :
setWindowTitle(tr("Preferences"));

// Platform specific settings
#ifdef Q_OS_WIN
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
ui->nonNativeThemeCheckbox->hide();
#elif QT_VERSION >= QT_VERSION_CHECK(6, 7, 3)
if (QOperatingSystemVersion::current() >= QOperatingSystemVersion::Windows11)
ui->nonNativeThemeCheckbox->hide();
#endif
#else
ui->nonNativeThemeCheckbox->hide();
#endif
#ifdef Q_OS_MACOS
ui->menubarCheckbox->hide();
#else
Expand Down Expand Up @@ -188,8 +177,6 @@ void QVOptionsDialog::syncSettings(bool defaults, bool makeConnections)
syncSpinBox(ui->minWindowResizeSpinBox, "minwindowresizedpercentage", defaults, makeConnections);
// maxwindowresizedperecentage
syncSpinBox(ui->maxWindowResizeSpinBox, "maxwindowresizedpercentage", defaults, makeConnections);
// nonnativetheme
syncCheckbox(ui->nonNativeThemeCheckbox, "nonnativetheme", defaults, makeConnections);
// titlebaralwaysdark
syncCheckbox(ui->darkTitlebarCheckbox, "titlebaralwaysdark", defaults, makeConnections);
// quitonlastwindow
Expand Down Expand Up @@ -617,13 +604,10 @@ void QVOptionsDialog::customizePalette()
palette.setColor(QPalette::Highlight, Qv::getPerceivedBrightness(textColor) > 0.5 ? QColor(0, 65, 127) : QColor(75, 166, 255));
ui->categoryList->setPalette(palette);
}
#if defined(Q_OS_WIN) && QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
#if defined(Q_OS_WIN) && QT_VERSION >= QT_VERSION_CHECK(6, 7, 0) && QT_VERSION < QT_VERSION_CHECK(6, 8, 1)
if (currentStyle.compare("windows11", Qt::CaseInsensitive) == 0)
{
// This is to work around styling issues with radio buttons and checkboxes. Not sure if it's because of
// the type of container they're in (stacked widget + scroll area) but they seem to inherit incorrect
// colors. Setting the widgets' palettes to the application's palette isn't enough because Qt keeps
// track of which colors were explicitly set, so we need to set the specific colors we need.
// Workaround for QTBUG-130828
const auto specifyWindowAndAccentColors = [&](QWidget *widget) {
QPalette palette = widget->palette();
palette.setColor(QPalette::Active, QPalette::Window, appPalette.color(QPalette::Active, QPalette::Window));
Expand Down
21 changes: 7 additions & 14 deletions src/qvoptionsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -298,20 +298,13 @@
</spacer>
</item>
<item row="11" column="1">
<widget class="QCheckBox" name="nonNativeThemeCheckbox">
<property name="text">
<string>Non-native theme (supports dark mode)</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QCheckBox" name="menubarCheckbox">
<property name="text">
<string>Show menubar</string>
</property>
</widget>
</item>
<item row="13" column="1">
<item row="12" column="1">
<widget class="QCheckBox" name="detailsInFullscreen">
<property name="toolTip">
<string>Choose whether or not to display the titlebar text while in fullscreen</string>
Expand All @@ -321,7 +314,7 @@
</property>
</widget>
</item>
<item row="14" column="1">
<item row="13" column="1">
<widget class="QCheckBox" name="submenuIconsCheckbox">
<property name="toolTip">
<string>Show icons in &quot;Open Recent&quot; and &quot;Open With&quot; submenus</string>
Expand All @@ -334,21 +327,21 @@
</property>
</widget>
</item>
<item row="15" column="1">
<item row="14" column="1">
<widget class="QCheckBox" name="slideshowKeepsWindowOnTopCheckbox">
<property name="text">
<string>Keep window on top during slideshow</string>
</property>
</widget>
</item>
<item row="16" column="1">
<item row="15" column="1">
<widget class="QCheckBox" name="reuseWindowCheckbox">
<property name="text">
<string>Reuse window when launching with image</string>
</property>
</widget>
</item>
<item row="17" column="1">
<item row="16" column="1">
<widget class="QCheckBox" name="darkTitlebarCheckbox">
<property name="toolTip">
<string>Choose whether or not the titlebar should always be dark regardless of your chosen macOS appearance</string>
Expand All @@ -361,14 +354,14 @@
</property>
</widget>
</item>
<item row="18" column="1">
<item row="17" column="1">
<widget class="QCheckBox" name="quitOnLastWindowCheckbox">
<property name="text">
<string>&amp;Quit on last window closed</string>
</property>
</widget>
</item>
<item row="19" column="1">
<item row="18" column="1">
<widget class="QCheckBox" name="persistSessionCheckbox">
<property name="text">
<string>Persist session across app restarts</string>
Expand Down
1 change: 0 additions & 1 deletion src/settingsmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ void SettingsManager::initializeSettingsLibrary()
settingsLibrary.insert("aftermatchingsizemode", {static_cast<int>(Qv::AfterMatchingSize::CenterOnPrevious), {}});
settingsLibrary.insert("minwindowresizedpercentage", {20, {}});
settingsLibrary.insert("maxwindowresizedpercentage", {70, {}});
settingsLibrary.insert("nonnativetheme", {false, {}});
settingsLibrary.insert("titlebaralwaysdark", {false, {}});
settingsLibrary.insert("quitonlastwindow", {false, {}});
settingsLibrary.insert("menubarenabled", {false, {}});
Expand Down

0 comments on commit 2864737

Please sign in to comment.