这是indexloc提供的服务,不要输入任何密码
Skip to content
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
4 changes: 4 additions & 0 deletions .github/actions/create-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ inputs:
arch:
description: Architecture
required: true
qt:
description: Qt Version
required: true
outputs:
output-basename:
description: Output basename
Expand All @@ -17,4 +20,5 @@ runs:
env:
RUNNER_OS: ${{runner.os}}
INPUT_ARCH: ${{inputs.arch}}
INPUT_QT: ${{inputs.qt}}
IS_RELEASE: ${{ github.ref == 'refs/heads/release' }}
18 changes: 11 additions & 7 deletions .github/actions/create-package/create-package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ platforms/libqwayland-xcomposite-egl.so,platforms/libqwayland-xcomposite-glx.so,
wayland-decoration-client,wayland-graphics-integration-client,wayland-shell-integration \
${update_info} \
-appimage
local output_name="pencil2d-linux-$1-$(date +%F)"
local qtsuffix="-qt${INPUT_QT}"
local output_name="pencil2d${qtsuffix/-qt5/}-linux-$1-$(date +%F)"
mv Pencil2D*.AppImage "$output_name.AppImage"
mv Pencil2D*.AppImage.zsync "$output_name.AppImage.zsync" \
&& sed -i '1,/^$/s/^\(Filename\|URL\): .*$/\1: '"$output_name.AppImage/" "$output_name.AppImage.zsync" \
|| true
echo "::set-output name=output-basename::$output_name"
echo "output-basename=$output_name" >> "${GITHUB_OUTPUT}"
echo "::endgroup::"
}

Expand All @@ -67,8 +68,9 @@ create_package_macos() {
rm ffmpeg.7z ffmpeg.7z.sig
echo "::endgroup::"

echo "Deploy Qt libraries"
echo "::group::Deploy Qt libraries"
macdeployqt Pencil2D.app
echo "::endgroup::"
echo "::group::Apply macdeployqt fix"
curl -fsSLO https://github.com/aurelien-rainone/macdeployqtfix/archive/master.zip
bsdtar xf master.zip
Expand All @@ -80,8 +82,9 @@ create_package_macos() {
rm -rf macdeployqtfix-master master.zip
popd >/dev/null
echo "Create ZIP"
bsdtar caf "pencil2d-mac-$1-$(date +%F).zip" Pencil2D
echo "::set-output name=output-basename::pencil2d-mac-$1-$(date +%F)"
local qtsuffix="-qt${INPUT_QT}"
bsdtar caf "pencil2d${qtsuffix/-qt5/}-mac-$1-$(date +%F).zip" Pencil2D
echo "output-basename=pencil2d${qtsuffix/-qt5/}-mac-$1-$(date +%F)" > "${GITHUB_OUTPUT}"
}

create_package_windows() {
Expand All @@ -105,8 +108,9 @@ create_package_windows() {
local _xbits="_x${platform#win}"
cp "${IQTA_TOOLS}\\OpenSSL\\Win${_xbits/32/86}\\bin\\lib"{ssl,crypto}"-1_1${xbits/-x32/}.dll" Pencil2D/
echo "Create ZIP"
"${WINDIR}\\System32\\tar" caf "pencil2d-${platform}-$1-$(date +%F).zip" Pencil2D
echo "::set-output name=output-basename::pencil2d-${platform}-$1-$(date +%F)"
local qtsuffix="-qt${INPUT_QT}"
"${WINDIR}\\System32\\tar" caf "pencil2d${qtsuffix/-qt5/}-${platform}-$1-$(date +%F).zip" Pencil2D
echo "output-basename=pencil2d${qtsuffix/-qt5/}-${platform}-$1-$(date +%F)" > "${GITHUB_OUTPUT}"
}

"create_package_$(echo $RUNNER_OS | tr '[A-Z]' '[a-z]')" "${GITHUB_RUN_NUMBER}"
6 changes: 6 additions & 0 deletions .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ inputs:
arch:
description: Architecture
required: true
qt:
description: Qt Version
required: true
runs:
using: composite
steps:
Expand All @@ -11,8 +14,11 @@ runs:
env:
RUNNER_OS: ${{runner.os}}
INPUT_ARCH: ${{inputs.arch}}
INPUT_QT: ${{inputs.qt}}
- if: runner.os == 'Windows'
uses: jurplel/install-qt-action@v3
with:
arch: ${{inputs.arch}}
tools: tools_openssl_x${{endsWith(inputs.arch, '_64') && '64' || '86'}}
version: ${{matrix.qt == 6 && '6.4.2' || '5.15.2'}}
modules: ${{matrix.qt == 6 && 'qtmultimedia' || ''}}
30 changes: 21 additions & 9 deletions .github/actions/install-dependencies/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,34 @@ setup_linux() {

echo "::group::Add APT sources"
for ppa in ppa:ubuntu-toolchain-r/test ppa:ubuntu-sdk-team/ppa \
ppa:git-core/ppa ppa:beineri/opt-qt-5.15.2-xenial; do
ppa:git-core/ppa; do
apt-add-repository -y "${ppa}"
done
if [ "${INPUT_QT}" -eq 5 ]; then
apt-add-repository -y ppa:beineri/opt-qt-5.15.2-xenial
fi
echo "::endgroup::"

echo "::group::Fetch APT updates"
apt-get update -yq
echo "::endgroup::"

echo "::group::Install APT packages"
apt-get install -yq --no-install-suggests --no-install-recommends \
build-essential qt515tools qt515base qt515multimedia qt515svg \
qt515xmlpatterns qt515wayland libgl1-mesa-dev bsdtar ffmpeg \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-alsa \
gstreamer1.0-pulseaudio git curl libfuse2
if [ "${INPUT_QT}" -eq 5 ]; then
apt-get install -yq --no-install-suggests --no-install-recommends \
build-essential qt515tools qt515base qt515multimedia qt515svg \
qt515wayland libgl1-mesa-dev bsdtar ffmpeg gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly gstreamer1.0-alsa gstreamer1.0-pulseaudio git \
curl libfuse2
else
apt-get install -yq --no-install-suggests --no-install-recommends \
build-essential qt6-l10n-tools qt6-base-dev qt6-multimedia-dev \
libqt6svg6-dev qt6-wayland-dev libgl1-mesa-dev libarchive-tools ffmpeg \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-alsa \
gstreamer1.0-pulseaudio git curl libfuse2
fi
echo "::endgroup::"
}

Expand All @@ -32,8 +44,8 @@ setup_macos() {
brew update
echo "::endgroup::"
echo "::group::Install Homebrew packages"
brew install libarchive qt@5
brew link qt@5 --force
brew install libarchive qt@${INPUT_QT}
brew link qt@${INPUT_QT} --force
echo "/usr/local/opt/libarchive/bin" >> "${GITHUB_PATH}"
echo "::endgroup::"
}
Expand Down
4 changes: 3 additions & 1 deletion .github/actions/setup-environment/setup-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ setup_linux() {
# Our container image uses the non-Unicode C locale by default
echo "LANG=C.UTF-8" >> "${GITHUB_ENV}"
# Set up Qt environment variables and export them to the GitHub Actions workflow
(printenv; (. /opt/qt515/bin/qt515-env.sh; printenv)) | sort -st= -k1,1 | uniq -u >> "${GITHUB_ENV}"
if [ -f /opt/qt515/bin/qt515-env.sh ]; then
(printenv; (. /opt/qt515/bin/qt515-env.sh; printenv)) | sort -st= -k1,1 | uniq -u >> "${GITHUB_ENV}"
fi
}

setup_macos() {
Expand Down
36 changes: 31 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,43 @@ jobs:
fail-fast: false
matrix:
include:
- name: Linux x86_64
- name: Qt 5 / Linux x86_64
os: ubuntu-latest
# XXX: --privileged is sort of a brute-force solution to get FUSE
# working inside Docker, however so far I haven’t been able to
# figure out precisely *which* privileges are needed.
container: { image: "ubuntu:16.04", options: --privileged }
- name: macOS x86_64
qt: 5
- name: Qt 5 / macOS x86_64
os: macos-latest
container:
- name: Windows x86
qt: 5
- name: Qt 5 / Windows x86
os: windows-2019
arch: win32_msvc2019
container:
- name: Windows x86_64
qt: 5
- name: Qt 5 / Windows x86_64
os: windows-2019
arch: win64_msvc2019_64
container:
qt: 5
- name: Qt 6 / Linux x86_64
os: ubuntu-latest
# XXX: --privileged is sort of a brute-force solution to get FUSE
# working inside Docker, however so far I haven’t been able to
# figure out precisely *which* privileges are needed.
container: { image: "ubuntu:22.04", options: --privileged }
qt: 6
- name: Qt 6 / macOS x86_64
os: macos-latest
container:
qt: 6
- name: Qt 6 / Windows x86_64
os: windows-2019
arch: win64_msvc2019_64
container:
qt: 6

name: ${{matrix.name}}
runs-on: ${{matrix.os}}
Expand All @@ -63,15 +83,18 @@ jobs:
uses: ./.github/actions/install-dependencies
with:
arch: ${{matrix.arch}}
qt: ${{matrix.qt}}

- name: Set up environment
uses: ./.github/actions/setup-environment
with:
arch: ${{matrix.arch}}

- name: Configure build
run: mkdir build; qmake -o build PREFIX=/usr CONFIG+=release CONFIG+=GIT
run: mkdir build; ${{runner.os == 'Linux' && matrix.qt == 6 && 'qmake6' || 'qmake'}}
-o build PREFIX=/usr CONFIG+=release CONFIG+=GIT
CONFIG+=PENCIL2D_${{github.ref == 'refs/heads/release' && 'RELEASE' || 'NIGHTLY'}}
${{matrix.qt == 6 && 'CONFIG+=c++17 QMAKE_CXX_FLAGS+=-std=c++17' || ''}}

- name: Build Pencil2D
working-directory: build
Expand All @@ -83,11 +106,14 @@ jobs:

- name: Create package
id: package
if: runner.os != 'Linux' || matrix.qt == 5
uses: ./.github/actions/create-package
with:
arch: ${{matrix.arch}}
qt: ${{matrix.qt}}

- name: Upload package
if: runner.os != 'Linux' || matrix.qt == 5
uses: actions/upload-artifact@v3
with:
name: ${{steps.package.outputs.output-basename}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Retrieve Qt tagfiles
working-directory: util/docs
run: |
for i in core gui network svg testlib widgets xml xmlpatterns; do
for i in core gui network svg testlib widgets xml; do
curl -fsSLO "https://doc.qt.io/qt-5/qt${i}.tags"
done

Expand Down
3 changes: 0 additions & 3 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2373,23 +2373,20 @@ TAGFILES = util/docs/qtcore.tags=https://doc.qt.io/qt-5/ \
util/docs/qttestlib.tags=https://doc.qt.io/qt-5/ \
util/docs/qtwidgets.tags=https://doc.qt.io/qt-5/ \
util/docs/qtxml.tags=https://doc.qt.io/qt-5/ \
util/docs/qtxmlpatterns.tags=https://doc.qt.io/qt-5/ \
/usr/share/qt5/doc/qtcore/qtcore.tags=/usr/share/qt5/doc/qtcore/ \
/usr/share/qt5/doc/qtgui/qtgui.tags=/usr/share/qt5/doc/qtgui/ \
/usr/share/qt5/doc/qtnetwork/qtnetwork.tags=/usr/share/qt5/doc/qtnetwork/ \
/usr/share/qt5/doc/qtsvg/qtsvg.tags=/usr/share/qt5/doc/qtsvg/ \
/usr/share/qt5/doc/qttestlib/qttestlib.tags=/usr/share/qt5/doc/qttestlib/ \
/usr/share/qt5/doc/qtwidgets/qtwidgets.tags=/usr/share/qt5/doc/qtwidgets/ \
/usr/share/qt5/doc/qtxml/qtxml.tags=/usr/share/qt5/doc/qtxml/ \
/usr/share/qt5/doc/qtxmlpatterns/qtxmlpatterns.tags=/usr/share/qt5/doc/qtxmlpatterns/ \
/usr/share/doc/qt/qtcore/qtcore.tags=/usr/share/doc/qt/qtcore/ \
/usr/share/doc/qt/qtgui/qtgui.tags=/usr/share/doc/qt/qtgui/ \
/usr/share/doc/qt/qtnetwork/qtnetwork.tags=/usr/share/doc/qt/qtnetwork/ \
/usr/share/doc/qt/qtsvg/qtsvg.tags=/usr/share/doc/qt/qtsvg/ \
/usr/share/doc/qt/qttestlib/qttestlib.tags=/usr/share/doc/qt/qttestlib/ \
/usr/share/doc/qt/qtwidgets/qtwidgets.tags=/usr/share/doc/qt/qtwidgets/ \
/usr/share/doc/qt/qtxml/qtxml.tags=/usr/share/doc/qt/qtxml/ \
/usr/share/doc/qt/qtxmlpatterns/qtxmlpatterns.tags=/usr/share/doc/qt/qtxmlpatterns/
# Currently Qt Multimedia isn't configured to generate a tagfile, see
# https://github.com/qt/qtmultimedia/blob/5.9/src/multimedia/doc/qtmultimedia.qdocconf

Expand Down
2 changes: 1 addition & 1 deletion app/app.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ TEMPLATE = app
TARGET = pencil2d
QMAKE_APPLICATION_BUNDLE_NAME = Pencil2D

CONFIG += qt precompile_header lrelease embed_translations
CONFIG += precompile_header lrelease embed_translations

DESTDIR = ../bin
MOC_DIR = .moc
Expand Down
4 changes: 3 additions & 1 deletion app/src/basedockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ void BaseDockWidget::resizeEvent(QResizeEvent *event)
#ifdef __APPLE__
// For some reason the behavior of minimumSize and the margin changes on mac when floating, so we need to do this
#else
minHeight += layout()->margin()*2;
int top, bottom;
layout()->getContentsMargins(nullptr, &top, nullptr, &bottom);
minHeight += top + bottom;
#endif
setMinimumSize(QSize(layout()->minimumSize().width(), minHeight));
}
Expand Down
7 changes: 4 additions & 3 deletions app/src/checkupdatesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ GNU General Public License for more details.
#include <QProgressBar>
#include <QPushButton>
#include <QDesktopServices>
#include <QRegularExpression>
#include <QVersionNumber>
#include <QXmlStreamReader>

Expand Down Expand Up @@ -204,15 +205,15 @@ QString CheckUpdatesDialog::getVersionNumberFromXml(QString xml)
while (!xmlReader.atEnd() && !xmlReader.hasError())
{
QXmlStreamReader::TokenType tokenType = xmlReader.readNext();
if (tokenType == QXmlStreamReader::StartElement && xmlReader.name() == "entry")
if (tokenType == QXmlStreamReader::StartElement && xmlReader.name() == QLatin1String("entry"))
{
while (!xmlReader.atEnd() && !xmlReader.hasError())
{
xmlReader.readNext();
if (xmlReader.name() == "title")
if (xmlReader.name() == QLatin1String("title"))
{
QString titleTag = xmlReader.readElementText();
return titleTag.remove(QRegExp("^v")); // remove the leading 'v'
return titleTag.remove(QRegularExpression("^v")); // remove the leading 'v'
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/colorinspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ void ColorInspector::initUI()
ui->hsvAlphaSlider->init(ColorSlider::ColorSpecType::HSV, ColorSlider::ColorType::ALPHA, mCurrentColor, 0.0, 255.0);

QPalette p1 = ui->colorWrapper->palette();
p1.setBrush(QPalette::Background, QBrush(QImage(":/background/checkerboard.png")));
p1.setBrush(QPalette::Window, QBrush(QImage(":/background/checkerboard.png")));
ui->colorWrapper->setPalette(p1);

QPalette p2 = ui->color->palette();
p2.setColor(QPalette::Background, mCurrentColor);
p2.setColor(QPalette::Window, mCurrentColor);
ui->color->setPalette(p2);

connect(ui->colorSpecTabWidget, &QTabWidget::currentChanged, this, &ColorInspector::onColorSpecChanged);
Expand Down Expand Up @@ -180,7 +180,7 @@ void ColorInspector::updateControls()
ui->hsvAlphaSpinBox->setValue(qRound(mCurrentColor.alpha() / 2.55));

QPalette p = ui->color->palette();
p.setColor(QPalette::Background, mCurrentColor);
p.setColor(QPalette::Window, mCurrentColor);
ui->color->setPalette(p);

update();
Expand Down
Loading