mirror of
https://github.com/fergalmoran/flameshot.git
synced 2025-12-22 09:51:06 +00:00
Merge pull request #3993 from flameshot-org/qt6_2025
Porting Flameshot to Qt6
This commit is contained in:
18
.github/workflows/Linux-arm-pack.yml
vendored
18
.github/workflows/Linux-arm-pack.yml
vendored
@@ -1,15 +1,15 @@
|
||||
name: Packaging(Linux - ARM)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- fix*
|
||||
- move-arm-ci-to-new-ci
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
- 'LICENSE'
|
||||
- 'docs/**'
|
||||
#push:
|
||||
# branches:
|
||||
# - master
|
||||
# - fix*
|
||||
# - move-arm-ci-to-new-ci
|
||||
# paths-ignore:
|
||||
# - 'README.md'
|
||||
# - 'LICENSE'
|
||||
# - 'docs/**'
|
||||
|
||||
workflow_dispatch:
|
||||
|
||||
|
||||
676
.github/workflows/Linux-pack.yml
vendored
676
.github/workflows/Linux-pack.yml
vendored
@@ -28,344 +28,344 @@ env:
|
||||
PACKPACK_REPO: flameshot-org/packpack
|
||||
|
||||
jobs:
|
||||
deb-pack:
|
||||
name: Build deb on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
dist:
|
||||
- {
|
||||
name: debian-11,
|
||||
os: debian,
|
||||
symbol: bullseye,
|
||||
arch: amd64
|
||||
}
|
||||
- {
|
||||
name: debian-12,
|
||||
os: debian,
|
||||
symbol: bookworm,
|
||||
arch: amd64
|
||||
}
|
||||
- {
|
||||
name: ubuntu-22.04,
|
||||
os: ubuntu,
|
||||
symbol: jammy,
|
||||
arch: amd64
|
||||
}
|
||||
- {
|
||||
name: ubuntu-24.04,
|
||||
os: ubuntu,
|
||||
symbol: noble,
|
||||
arch: amd64
|
||||
}
|
||||
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Checkout Source code
|
||||
if: github.event_name == 'push'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: master
|
||||
- name: Checkout Source code
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Set env & Print flameshot version
|
||||
shell: bash
|
||||
run: |
|
||||
last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
|
||||
git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
|
||||
git_hash=$(git rev-parse --short HEAD)
|
||||
ver_info=${last_committed_tag}+git${git_revno}.${git_hash}
|
||||
echo "=======FLAMESHOT VERSION========"
|
||||
echo ${last_committed_tag:1}
|
||||
echo "Details: ${ver_info}"
|
||||
echo "================================"
|
||||
echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
|
||||
echo "VER_INFO=${ver_info}" >> $GITHUB_ENV
|
||||
- name: Get packpack tool
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ env.PACKPACK_REPO }}
|
||||
path: tools
|
||||
ref: multiarch
|
||||
set-safe-directory: $GITHUB_WORKSPACE/tools
|
||||
- name: Packaging on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
|
||||
env:
|
||||
OS: ${{ matrix.dist.os }}
|
||||
DIST: ${{ matrix.dist.symbol }}
|
||||
#DOCKER_ARCH: ${{ matrix.dist.arch }}
|
||||
## I cannot see if ARCH is used anywhere. Should we remove it?
|
||||
#ARCH: ${{ matrix.dist.arch }}
|
||||
run: |
|
||||
cp -r $GITHUB_WORKSPACE/packaging/debian $GITHUB_WORKSPACE
|
||||
bash $GITHUB_WORKSPACE/tools/packpack
|
||||
mv $GITHUB_WORKSPACE/build/${PRODUCT}_${VERSION}-${RELEASE}_${{ matrix.dist.arch }}.deb $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb
|
||||
- name: SHA256Sum of ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package
|
||||
run: |
|
||||
cd "$GITHUB_WORKSPACE/build/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/build/'!"; exit 11 ; }
|
||||
sha256sum ${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb | tee ${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb.sha256sum
|
||||
- name: Artifact Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.PRODUCT }}-${{ env.VER_INFO }}-artifact-${{ matrix.dist.name }}-${{ matrix.dist.arch }}
|
||||
path: |
|
||||
${{ github.workspace }}/build/${{ env.PRODUCT }}-*-${{ env.RELEASE }}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb
|
||||
${{ github.workspace }}/build/${{ env.PRODUCT }}-*-${{ env.RELEASE }}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb.sha256sum
|
||||
overwrite: true
|
||||
|
||||
rpm-pack:
|
||||
name: Build rpm on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
dist:
|
||||
- {
|
||||
name: fedora-41,
|
||||
os: fedora,
|
||||
symbol: 41,
|
||||
arch: x86_64
|
||||
}
|
||||
- {
|
||||
name: fedora-42,
|
||||
os: fedora,
|
||||
symbol: 42,
|
||||
arch: x86_64
|
||||
}
|
||||
- {
|
||||
name: opensuse-leap-15.6,
|
||||
os: opensuse-leap,
|
||||
symbol: 15.6,
|
||||
arch: x86_64
|
||||
}
|
||||
steps:
|
||||
- name: Checkout Source code
|
||||
if: github.event_name == 'push'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: master
|
||||
- name: Checkout Source code
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Set env & Print flameshot version
|
||||
shell: bash
|
||||
run: |
|
||||
last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
|
||||
git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
|
||||
git_hash=$(git rev-parse --short HEAD)
|
||||
ver_info=${last_committed_tag}+git${git_revno}.${git_hash}
|
||||
echo "=======FLAMESHOT VERSION========"
|
||||
echo ${last_committed_tag:1}
|
||||
echo "Details: ${ver_info}"
|
||||
echo "================================"
|
||||
echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
|
||||
echo "VER_INFO=${ver_info}" >> $GITHUB_ENV
|
||||
- name: Get packpack tool
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ env.PACKPACK_REPO }}
|
||||
path: tools
|
||||
ref: master
|
||||
set-safe-directory: $GITHUB_WORKSPACE/tools
|
||||
- name: Packaging on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
|
||||
if: matrix.dist.os == 'fedora'
|
||||
run: |
|
||||
mkdir $GITHUB_WORKSPACE/rpm
|
||||
cp $GITHUB_WORKSPACE/packaging/rpm/fedora/flameshot.spec $GITHUB_WORKSPACE/rpm
|
||||
bash $GITHUB_WORKSPACE/tools/packpack
|
||||
env:
|
||||
OS: ${{ matrix.dist.os }}
|
||||
DIST: ${{ matrix.dist.symbol }}
|
||||
- name: Packaging on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
|
||||
if: matrix.dist.os == 'opensuse-leap'
|
||||
run: |
|
||||
mkdir $GITHUB_WORKSPACE/rpm
|
||||
cp $GITHUB_WORKSPACE/packaging/rpm/opensuse/flameshot.spec $GITHUB_WORKSPACE/rpm
|
||||
bash $GITHUB_WORKSPACE/tools/packpack
|
||||
env:
|
||||
OS: ${{ matrix.dist.os }}
|
||||
DIST: ${{ matrix.dist.symbol }}
|
||||
- name: Package Clean
|
||||
if: matrix.dist.os == 'fedora'
|
||||
run: |
|
||||
rm -f ${{ github.workspace }}/build/${{ env.PRODUCT }}-debuginfo-*.rpm
|
||||
rm -f ${{ github.workspace }}/build/${{ env.PRODUCT }}-debugsource-*.rpm
|
||||
rm -f ${{ github.workspace }}/build/${{ env.PRODUCT }}-*.src.rpm
|
||||
rm -f ${{ github.workspace }}/build/build.log
|
||||
- name: SHA256Sum of ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package
|
||||
if: matrix.dist.os == 'fedora'
|
||||
run: |
|
||||
cd "$GITHUB_WORKSPACE/build/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/build/'!"; exit 11 ; }
|
||||
sha256sum ${PRODUCT}-${VERSION}-${RELEASE}.fc*.${{ matrix.dist.arch }}.rpm | tee ${PRODUCT}-${VERSION}-${RELEASE}.fc${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum
|
||||
- name: SHA256Sum of ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package
|
||||
if: matrix.dist.os == 'opensuse-leap'
|
||||
run: |
|
||||
mv $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-lp*.${{ matrix.dist.arch }}.rpm $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm
|
||||
cd "$GITHUB_WORKSPACE/build/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/build/'!"; exit 11 ; }
|
||||
sha256sum ${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm | tee ${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum
|
||||
- name: Artifact Upload
|
||||
if: matrix.dist.os == 'fedora'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.PRODUCT }}-${{ env.VER_INFO }}-artifact-${{ matrix.dist.name }}-${{ matrix.dist.arch }}
|
||||
path: |
|
||||
${{ github.workspace }}/build/
|
||||
overwrite: true
|
||||
|
||||
- name: Artifact Upload
|
||||
if: matrix.dist.os == 'opensuse-leap'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.PRODUCT }}-${{ env.VER_INFO }}-artifact-${{ matrix.dist.name }}-${{ matrix.dist.arch }}
|
||||
path: |
|
||||
${{ github.workspace }}/build/${{ env.PRODUCT }}-*-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm
|
||||
${{ github.workspace }}/build/${{ env.PRODUCT }}-*-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum
|
||||
overwrite: true
|
||||
|
||||
appimage-pack:
|
||||
name: Build appimage on ${{ matrix.config.name }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- {
|
||||
name: ubuntu-22.04,
|
||||
os: ubuntu,
|
||||
symbol: jammy,
|
||||
arch: amd64,
|
||||
image_repo: quay.io/flameshot-org/ci-building
|
||||
}
|
||||
container:
|
||||
image: ${{ matrix.config.image_repo }}:${{ matrix.config.os }}-${{ matrix.config.symbol }}
|
||||
options: --cap-add SYS_ADMIN --device /dev/fuse --security-opt apparmor:unconfined
|
||||
steps:
|
||||
- name:
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
|
||||
- name: Checkout Source code
|
||||
if: github.event_name == 'push'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: master
|
||||
- name: Checkout Source code
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
- name: Set env & Print flameshot version
|
||||
shell: bash
|
||||
run: |
|
||||
last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
|
||||
git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
|
||||
git_hash=$(git rev-parse --short HEAD)
|
||||
ver_info=${last_committed_tag}+git${git_revno}.${git_hash}
|
||||
echo "=======FLAMESHOT VERSION========"
|
||||
echo ${last_committed_tag:1}
|
||||
echo "Details: ${ver_info}"
|
||||
echo "================================"
|
||||
echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
|
||||
echo "VER_INFO=${ver_info}" >> $GITHUB_ENV
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get -y -qq update
|
||||
sudo apt-get -y --no-install-recommends install \
|
||||
python3 \
|
||||
python3-pip \
|
||||
fuse \
|
||||
patchelf \
|
||||
cmake \
|
||||
extra-cmake-modules \
|
||||
build-essential \
|
||||
qt5-qmake \
|
||||
qtbase5-dev \
|
||||
qtbase5-dev-tools \
|
||||
qttools5-dev-tools \
|
||||
qttools5-dev \
|
||||
libqt5dbus5 \
|
||||
libqt5network5 \
|
||||
libqt5core5a \
|
||||
libqt5widgets5 \
|
||||
libqt5gui5 \
|
||||
libqt5svg5-dev \
|
||||
appstream \
|
||||
hicolor-icon-theme \
|
||||
fcitx-frontend-qt5 \
|
||||
openssl \
|
||||
ca-certificates \
|
||||
jq
|
||||
|
||||
- name: Get go-appimage tool
|
||||
# Will not use linuxdeployqt anymore, because it suopprts currently still-supported mainstream distribution,
|
||||
# which is glibc 2.23. For more information, please see https://github.com/probonopd/linuxdeployqt/issues/340.
|
||||
# Will try new tool https://github.com/probonopd/go-appimage written in golang by probonopd.
|
||||
run: |
|
||||
wget $(curl https://api.github.com/repos/probonopd/go-appimage/releases | jq -r '.[] | select(.tag_name == "continuous") | .assets[] | select((.name | endswith("x86_64.AppImage")) and (.name | contains("appimagetool"))) | .browser_download_url') -O appimagetool
|
||||
|
||||
chmod +x appimagetool
|
||||
env:
|
||||
APPIMAGETOOL_ARCH: x86_64
|
||||
- name: Packaging appimage
|
||||
run: |
|
||||
set -x
|
||||
APPIMAGE_DST_PATH=$GITHUB_WORKSPACE/${PRODUCT}.AppDir
|
||||
mkdir -p ${APPIMAGE_DST_PATH}
|
||||
|
||||
cd $GITHUB_WORKSPACE
|
||||
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DUSE_LAUNCHER_ABSOLUTE_PATH:BOOL=OFF
|
||||
make -j$(nproc) DESTDIR=${APPIMAGE_DST_PATH} install
|
||||
|
||||
$GITHUB_WORKSPACE/appimagetool -s deploy "${APPIMAGE_DST_PATH}/usr/share/applications/org.flameshot.Flameshot.desktop"
|
||||
|
||||
mkdir -p ${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts
|
||||
cp \
|
||||
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so \
|
||||
${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts/
|
||||
|
||||
cp \
|
||||
$GITHUB_WORKSPACE/data/img/app/org.flameshot.Flameshot.png \
|
||||
${APPIMAGE_DST_PATH}/
|
||||
|
||||
if [ -f "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0" ]; then
|
||||
rm ${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0
|
||||
fi
|
||||
|
||||
chmod +x ${APPIMAGE_DST_PATH}/usr/lib64/ld-*.so.*
|
||||
|
||||
|
||||
VERSION=${VERSION} $GITHUB_WORKSPACE/appimagetool "${APPIMAGE_DST_PATH}"
|
||||
mv $GITHUB_WORKSPACE/Flameshot-${VERSION}-x86_64.AppImage $GITHUB_WORKSPACE/Flameshot-${VERSION}.x86_64.AppImage
|
||||
|
||||
|
||||
- name: SHA256Sum of appimage package
|
||||
run: |
|
||||
cd "$GITHUB_WORKSPACE/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/'!"; exit 11 ; }
|
||||
sha256sum Flameshot-${VERSION}.x86_64.AppImage | tee Flameshot-${VERSION}.x86_64.AppImage.sha256sum
|
||||
- name: Artifact Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.PRODUCT }}-${{ env.VER_INFO }}-artifact-appimage-x86_64
|
||||
path: |
|
||||
${{ github.workspace }}/Flameshot-*.x86_64.AppImage
|
||||
${{ github.workspace }}/Flameshot-*.x86_64.AppImage.sha256sum
|
||||
overwrite: true
|
||||
|
||||
# deb-pack:
|
||||
# name: Build deb on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
|
||||
# runs-on: ubuntu-latest
|
||||
# strategy:
|
||||
# fail-fast: false
|
||||
# matrix:
|
||||
# dist:
|
||||
# - {
|
||||
# name: debian-11,
|
||||
# os: debian,
|
||||
# symbol: bullseye,
|
||||
# arch: amd64
|
||||
# }
|
||||
# - {
|
||||
# name: debian-12,
|
||||
# os: debian,
|
||||
# symbol: bookworm,
|
||||
# arch: amd64
|
||||
# }
|
||||
# - {
|
||||
# name: ubuntu-22.04,
|
||||
# os: ubuntu,
|
||||
# symbol: jammy,
|
||||
# arch: amd64
|
||||
# }
|
||||
# - {
|
||||
# name: ubuntu-24.04,
|
||||
# os: ubuntu,
|
||||
# symbol: noble,
|
||||
# arch: amd64
|
||||
# }
|
||||
#
|
||||
# steps:
|
||||
# - name: Set up Docker Buildx
|
||||
# uses: docker/setup-buildx-action@v3
|
||||
# - name: Set up QEMU
|
||||
# uses: docker/setup-qemu-action@v3
|
||||
# - name: Checkout Source code
|
||||
# if: github.event_name == 'push'
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# fetch-depth: 0
|
||||
# ref: master
|
||||
# - name: Checkout Source code
|
||||
# if: github.event_name == 'pull_request'
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# fetch-depth: 0
|
||||
# ref: ${{ github.event.pull_request.head.sha }}
|
||||
# - name: Set env & Print flameshot version
|
||||
# shell: bash
|
||||
# run: |
|
||||
# last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
|
||||
# git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
|
||||
# git_hash=$(git rev-parse --short HEAD)
|
||||
# ver_info=${last_committed_tag}+git${git_revno}.${git_hash}
|
||||
# echo "=======FLAMESHOT VERSION========"
|
||||
# echo ${last_committed_tag:1}
|
||||
# echo "Details: ${ver_info}"
|
||||
# echo "================================"
|
||||
# echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
|
||||
# echo "VER_INFO=${ver_info}" >> $GITHUB_ENV
|
||||
# - name: Get packpack tool
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# repository: ${{ env.PACKPACK_REPO }}
|
||||
# path: tools
|
||||
# ref: multiarch
|
||||
# set-safe-directory: $GITHUB_WORKSPACE/tools
|
||||
# - name: Packaging on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
|
||||
# env:
|
||||
# OS: ${{ matrix.dist.os }}
|
||||
# DIST: ${{ matrix.dist.symbol }}
|
||||
# #DOCKER_ARCH: ${{ matrix.dist.arch }}
|
||||
# ## I cannot see if ARCH is used anywhere. Should we remove it?
|
||||
# #ARCH: ${{ matrix.dist.arch }}
|
||||
# run: |
|
||||
# cp -r $GITHUB_WORKSPACE/packaging/debian $GITHUB_WORKSPACE
|
||||
# bash $GITHUB_WORKSPACE/tools/packpack
|
||||
# mv $GITHUB_WORKSPACE/build/${PRODUCT}_${VERSION}-${RELEASE}_${{ matrix.dist.arch }}.deb $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb
|
||||
# - name: SHA256Sum of ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package
|
||||
# run: |
|
||||
# cd "$GITHUB_WORKSPACE/build/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/build/'!"; exit 11 ; }
|
||||
# sha256sum ${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb | tee ${PRODUCT}-${VERSION}-${RELEASE}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb.sha256sum
|
||||
# - name: Artifact Upload
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: ${{ env.PRODUCT }}-${{ env.VER_INFO }}-artifact-${{ matrix.dist.name }}-${{ matrix.dist.arch }}
|
||||
# path: |
|
||||
# ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-${{ env.RELEASE }}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb
|
||||
# ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-${{ env.RELEASE }}.${{ matrix.dist.name }}.${{ matrix.dist.arch }}.deb.sha256sum
|
||||
# overwrite: true
|
||||
#
|
||||
# rpm-pack:
|
||||
# name: Build rpm on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
|
||||
# runs-on: ubuntu-latest
|
||||
# strategy:
|
||||
# fail-fast: false
|
||||
# matrix:
|
||||
# dist:
|
||||
# - {
|
||||
# name: fedora-41,
|
||||
# os: fedora,
|
||||
# symbol: 41,
|
||||
# arch: x86_64
|
||||
# }
|
||||
# - {
|
||||
# name: fedora-42,
|
||||
# os: fedora,
|
||||
# symbol: 42,
|
||||
# arch: x86_64
|
||||
# }
|
||||
# - {
|
||||
# name: opensuse-leap-15.6,
|
||||
# os: opensuse-leap,
|
||||
# symbol: 15.6,
|
||||
# arch: x86_64
|
||||
# }
|
||||
# steps:
|
||||
# - name: Checkout Source code
|
||||
# if: github.event_name == 'push'
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# fetch-depth: 0
|
||||
# ref: master
|
||||
# - name: Checkout Source code
|
||||
# if: github.event_name == 'pull_request'
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# fetch-depth: 0
|
||||
# ref: ${{ github.event.pull_request.head.sha }}
|
||||
# - name: Set env & Print flameshot version
|
||||
# shell: bash
|
||||
# run: |
|
||||
# last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
|
||||
# git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
|
||||
# git_hash=$(git rev-parse --short HEAD)
|
||||
# ver_info=${last_committed_tag}+git${git_revno}.${git_hash}
|
||||
# echo "=======FLAMESHOT VERSION========"
|
||||
# echo ${last_committed_tag:1}
|
||||
# echo "Details: ${ver_info}"
|
||||
# echo "================================"
|
||||
# echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
|
||||
# echo "VER_INFO=${ver_info}" >> $GITHUB_ENV
|
||||
# - name: Get packpack tool
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# repository: ${{ env.PACKPACK_REPO }}
|
||||
# path: tools
|
||||
# ref: master
|
||||
# set-safe-directory: $GITHUB_WORKSPACE/tools
|
||||
# - name: Packaging on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
|
||||
# if: matrix.dist.os == 'fedora'
|
||||
# run: |
|
||||
# mkdir $GITHUB_WORKSPACE/rpm
|
||||
# cp $GITHUB_WORKSPACE/packaging/rpm/fedora/flameshot.spec $GITHUB_WORKSPACE/rpm
|
||||
# bash $GITHUB_WORKSPACE/tools/packpack
|
||||
# env:
|
||||
# OS: ${{ matrix.dist.os }}
|
||||
# DIST: ${{ matrix.dist.symbol }}
|
||||
# - name: Packaging on ${{ matrix.dist.name }} ${{ matrix.dist.arch }}
|
||||
# if: matrix.dist.os == 'opensuse-leap'
|
||||
# run: |
|
||||
# mkdir $GITHUB_WORKSPACE/rpm
|
||||
# cp $GITHUB_WORKSPACE/packaging/rpm/opensuse/flameshot.spec $GITHUB_WORKSPACE/rpm
|
||||
# bash $GITHUB_WORKSPACE/tools/packpack
|
||||
# env:
|
||||
# OS: ${{ matrix.dist.os }}
|
||||
# DIST: ${{ matrix.dist.symbol }}
|
||||
# - name: Package Clean
|
||||
# if: matrix.dist.os == 'fedora'
|
||||
# run: |
|
||||
# rm -f ${{ github.workspace }}/build/${{ env.PRODUCT }}-debuginfo-*.rpm
|
||||
# rm -f ${{ github.workspace }}/build/${{ env.PRODUCT }}-debugsource-*.rpm
|
||||
# rm -f ${{ github.workspace }}/build/${{ env.PRODUCT }}-*.src.rpm
|
||||
# rm -f ${{ github.workspace }}/build/build.log
|
||||
# - name: SHA256Sum of ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package
|
||||
# if: matrix.dist.os == 'fedora'
|
||||
# run: |
|
||||
# cd "$GITHUB_WORKSPACE/build/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/build/'!"; exit 11 ; }
|
||||
# sha256sum ${PRODUCT}-${VERSION}-${RELEASE}.fc*.${{ matrix.dist.arch }}.rpm | tee ${PRODUCT}-${VERSION}-${RELEASE}.fc${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum
|
||||
# - name: SHA256Sum of ${{ matrix.dist.name }} ${{ matrix.dist.arch }} package
|
||||
# if: matrix.dist.os == 'opensuse-leap'
|
||||
# run: |
|
||||
# mv $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-lp*.${{ matrix.dist.arch }}.rpm $GITHUB_WORKSPACE/build/${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm
|
||||
# cd "$GITHUB_WORKSPACE/build/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/build/'!"; exit 11 ; }
|
||||
# sha256sum ${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm | tee ${PRODUCT}-${VERSION}-${RELEASE}-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum
|
||||
# - name: Artifact Upload
|
||||
# if: matrix.dist.os == 'fedora'
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: ${{ env.PRODUCT }}-${{ env.VER_INFO }}-artifact-${{ matrix.dist.name }}-${{ matrix.dist.arch }}
|
||||
# path: |
|
||||
# ${{ github.workspace }}/build/
|
||||
# overwrite: true
|
||||
#
|
||||
# - name: Artifact Upload
|
||||
# if: matrix.dist.os == 'opensuse-leap'
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: ${{ env.PRODUCT }}-${{ env.VER_INFO }}-artifact-${{ matrix.dist.name }}-${{ matrix.dist.arch }}
|
||||
# path: |
|
||||
# ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm
|
||||
# ${{ github.workspace }}/build/${{ env.PRODUCT }}-*-lp${{ matrix.dist.symbol }}.${{ matrix.dist.arch }}.rpm.sha256sum
|
||||
# overwrite: true
|
||||
#
|
||||
# appimage-pack:
|
||||
# name: Build appimage on ${{ matrix.config.name }}
|
||||
# runs-on: ubuntu-latest
|
||||
# strategy:
|
||||
# fail-fast: false
|
||||
# matrix:
|
||||
# config:
|
||||
# - {
|
||||
# name: ubuntu-22.04,
|
||||
# os: ubuntu,
|
||||
# symbol: jammy,
|
||||
# arch: amd64,
|
||||
# image_repo: quay.io/flameshot-org/ci-building
|
||||
# }
|
||||
# container:
|
||||
# image: ${{ matrix.config.image_repo }}:${{ matrix.config.os }}-${{ matrix.config.symbol }}
|
||||
# options: --cap-add SYS_ADMIN --device /dev/fuse --security-opt apparmor:unconfined
|
||||
# steps:
|
||||
# - name:
|
||||
# shell: bash
|
||||
# run: |
|
||||
# git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
#
|
||||
# - name: Checkout Source code
|
||||
# if: github.event_name == 'push'
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# fetch-depth: 0
|
||||
# ref: master
|
||||
# - name: Checkout Source code
|
||||
# if: github.event_name == 'pull_request'
|
||||
# uses: actions/checkout@v4
|
||||
# with:
|
||||
# fetch-depth: 0
|
||||
# ref: ${{ github.event.pull_request.head.sha }}
|
||||
# - name: Set env & Print flameshot version
|
||||
# shell: bash
|
||||
# run: |
|
||||
# last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
|
||||
# git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
|
||||
# git_hash=$(git rev-parse --short HEAD)
|
||||
# ver_info=${last_committed_tag}+git${git_revno}.${git_hash}
|
||||
# echo "=======FLAMESHOT VERSION========"
|
||||
# echo ${last_committed_tag:1}
|
||||
# echo "Details: ${ver_info}"
|
||||
# echo "================================"
|
||||
# echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
|
||||
# echo "VER_INFO=${ver_info}" >> $GITHUB_ENV
|
||||
# - name: Install Dependencies
|
||||
# run: |
|
||||
# sudo apt-get -y -qq update
|
||||
# sudo apt-get -y --no-install-recommends install \
|
||||
# python3 \
|
||||
# python3-pip \
|
||||
# fuse \
|
||||
# patchelf \
|
||||
# cmake \
|
||||
# extra-cmake-modules \
|
||||
# build-essential \
|
||||
# qt5-qmake \
|
||||
# qtbase5-dev \
|
||||
# qtbase5-dev-tools \
|
||||
# qttools5-dev-tools \
|
||||
# qttools5-dev \
|
||||
# libqt5dbus5 \
|
||||
# libqt5network5 \
|
||||
# libqt5core5a \
|
||||
# libqt5widgets5 \
|
||||
# libqt5gui5 \
|
||||
# libqt5svg5-dev \
|
||||
# appstream \
|
||||
# hicolor-icon-theme \
|
||||
# fcitx-frontend-qt5 \
|
||||
# openssl \
|
||||
# ca-certificates \
|
||||
# jq
|
||||
#
|
||||
# - name: Get go-appimage tool
|
||||
# # Will not use linuxdeployqt anymore, because it suopprts currently still-supported mainstream distribution,
|
||||
# # which is glibc 2.23. For more information, please see https://github.com/probonopd/linuxdeployqt/issues/340.
|
||||
# # Will try new tool https://github.com/probonopd/go-appimage written in golang by probonopd.
|
||||
# run: |
|
||||
# wget $(curl https://api.github.com/repos/probonopd/go-appimage/releases | jq -r '.[] | select(.tag_name == "continuous") | .assets[] | select((.name | endswith("x86_64.AppImage")) and (.name | contains("appimagetool"))) | .browser_download_url') -O appimagetool
|
||||
#
|
||||
# chmod +x appimagetool
|
||||
# env:
|
||||
# APPIMAGETOOL_ARCH: x86_64
|
||||
# - name: Packaging appimage
|
||||
# run: |
|
||||
# set -x
|
||||
# APPIMAGE_DST_PATH=$GITHUB_WORKSPACE/${PRODUCT}.AppDir
|
||||
# mkdir -p ${APPIMAGE_DST_PATH}
|
||||
#
|
||||
# cd $GITHUB_WORKSPACE
|
||||
# cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DUSE_LAUNCHER_ABSOLUTE_PATH:BOOL=OFF
|
||||
# make -j$(nproc) DESTDIR=${APPIMAGE_DST_PATH} install
|
||||
#
|
||||
# $GITHUB_WORKSPACE/appimagetool -s deploy "${APPIMAGE_DST_PATH}/usr/share/applications/org.flameshot.Flameshot.desktop"
|
||||
#
|
||||
# mkdir -p ${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts
|
||||
# cp \
|
||||
# /usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libfcitxplatforminputcontextplugin.so \
|
||||
# ${APPIMAGE_DST_PATH}/usr/plugins/platforminputcontexts/
|
||||
#
|
||||
# cp \
|
||||
# $GITHUB_WORKSPACE/data/img/app/org.flameshot.Flameshot.png \
|
||||
# ${APPIMAGE_DST_PATH}/
|
||||
#
|
||||
# if [ -f "${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0" ]; then
|
||||
# rm ${APPIMAGE_DST_PATH}/lib/x86_64-linux-gnu/libxcb-glx.so.0
|
||||
# fi
|
||||
#
|
||||
# chmod +x ${APPIMAGE_DST_PATH}/usr/lib64/ld-*.so.*
|
||||
#
|
||||
#
|
||||
# VERSION=${VERSION} $GITHUB_WORKSPACE/appimagetool "${APPIMAGE_DST_PATH}"
|
||||
# mv $GITHUB_WORKSPACE/Flameshot-${VERSION}-x86_64.AppImage $GITHUB_WORKSPACE/Flameshot-${VERSION}.x86_64.AppImage
|
||||
#
|
||||
#
|
||||
# - name: SHA256Sum of appimage package
|
||||
# run: |
|
||||
# cd "$GITHUB_WORKSPACE/" || { >&2 echo "Cannot cd to '$GITHUB_WORKSPACE/'!"; exit 11 ; }
|
||||
# sha256sum Flameshot-${VERSION}.x86_64.AppImage | tee Flameshot-${VERSION}.x86_64.AppImage.sha256sum
|
||||
# - name: Artifact Upload
|
||||
# uses: actions/upload-artifact@v4
|
||||
# with:
|
||||
# name: ${{ env.PRODUCT }}-${{ env.VER_INFO }}-artifact-appimage-x86_64
|
||||
# path: |
|
||||
# ${{ github.workspace }}/Flameshot-*.x86_64.AppImage
|
||||
# ${{ github.workspace }}/Flameshot-*.x86_64.AppImage.sha256sum
|
||||
# overwrite: true
|
||||
#
|
||||
flatpak-pack:
|
||||
name: Build flatpak on ubuntu 22.04
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
41
.github/workflows/MacOS-pack.yml
vendored
41
.github/workflows/MacOS-pack.yml
vendored
@@ -28,10 +28,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
dist:
|
||||
- {
|
||||
os: macos-13,
|
||||
arch: x86_64
|
||||
}
|
||||
- {
|
||||
os: macos-14,
|
||||
arch: arm64
|
||||
@@ -59,30 +55,21 @@ jobs:
|
||||
NOTARIZATION_CHECK: false
|
||||
|
||||
steps:
|
||||
- name: Check architecture
|
||||
if: matrix.dist.arch == 'x86_64'
|
||||
shell: bash
|
||||
run: |
|
||||
platform_arch=$(uname -m)
|
||||
if [[ $platform_arch != "x86_64" ]]; then
|
||||
echo "$platform_arch detected. This build must be run on x86_64."
|
||||
exit -1
|
||||
fi
|
||||
echo "$platform_arch detected."
|
||||
|
||||
- name: Check architecture
|
||||
if: matrix.dist.arch == 'arm64'
|
||||
shell: bash
|
||||
run: |
|
||||
platform_arch=$(uname -m)
|
||||
if [[ $platform_arch != "arm64" ]]; then
|
||||
echo "$platform_arch detected. This build must be run on arm64."
|
||||
exit -1
|
||||
fi
|
||||
echo "$platform_arch detected."
|
||||
- name: Checkout Source code
|
||||
if: github.event_name == 'push'
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout Source code
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Checkout Source code
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.sha }}
|
||||
|
||||
- name: Set env & Print flameshot version
|
||||
shell: bash
|
||||
@@ -98,12 +85,12 @@ jobs:
|
||||
echo "VER_INFO=${ver_info}" >> $GITHUB_ENV
|
||||
|
||||
- name: Install Qt
|
||||
run: brew install qt@5 cmake
|
||||
run: brew install qt@6 cmake
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
rm -rf "${DIR_BULD}"/src/flameshot.dmg "${DIR_BULD}"/src/flameshot.app/
|
||||
cmake -S . -B "${DIR_BULD}" -DQt5_DIR=$(brew --prefix qt5)/lib/cmake/Qt5 -DUSE_MONOCHROME_ICON=True
|
||||
cmake -S . -B "${DIR_BULD}" -DQt6_DIR=$(brew --prefix qt6)/lib/cmake/Qt6 -DUSE_MONOCHROME_ICON=True
|
||||
|
||||
- name: Compile
|
||||
run: |
|
||||
|
||||
36
.github/workflows/Windows-pack.yml
vendored
36
.github/workflows/Windows-pack.yml
vendored
@@ -24,11 +24,11 @@ env:
|
||||
|
||||
jobs:
|
||||
windows-pack:
|
||||
name: VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }}
|
||||
runs-on: windows-2019
|
||||
name: VS 2022 ${{ matrix.config.arch }}-${{ matrix.type }}
|
||||
runs-on: windows-2025
|
||||
env:
|
||||
VCINSTALLDIR: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/
|
||||
Qt5_DIR: ${{ github.workspace }}\build\Qt\${{ matrix.qt_ver }}\${{ matrix.config.qt_arch_install }}\lib\cmake\Qt5\
|
||||
VCINSTALLDIR: C:/Program Files (x86)/Microsoft Visual Studio/2022/Enterprise/VC/
|
||||
Qt6_DIR: ${{ github.workspace }}\build\Qt\${{ matrix.qt_ver }}\${{ matrix.config.qt_arch_install }}\lib\cmake\Qt6\
|
||||
QTDIR: ${{ github.workspace }}\build\Qt\${{ matrix.qt_ver }}\${{ matrix.config.qt_arch_install }}\
|
||||
# 2025.02.14
|
||||
VCPKG_VERSION: d5ec528843d29e3a52d745a64b469f810b2cedbf
|
||||
@@ -37,23 +37,15 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
qt_ver: [5.15.2]
|
||||
qt_ver: [6.9.1]
|
||||
qt_target: [desktop]
|
||||
config:
|
||||
- {
|
||||
arch: x86,
|
||||
generator: "-G'Visual Studio 16 2019' -A Win32",
|
||||
vcpkg_triplet: x86-windows,
|
||||
qt_arch: win32_msvc2019,
|
||||
qt_arch_install: msvc2019,
|
||||
pak_arch: win32
|
||||
}
|
||||
- {
|
||||
arch: x64,
|
||||
generator: "-G'Visual Studio 16 2019' -A x64",
|
||||
generator: "-G'Visual Studio 17 2022' -A x64",
|
||||
vcpkg_triplet: x64-windows,
|
||||
qt_arch: win64_msvc2019_64,
|
||||
qt_arch_install: msvc2019_64,
|
||||
qt_arch: win64_msvc2022_64,
|
||||
qt_arch_install: msvc2022_64,
|
||||
pak_arch: win64
|
||||
}
|
||||
type: [portable, installer]
|
||||
@@ -72,6 +64,17 @@ jobs:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Checkout Source code
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.sha }}
|
||||
|
||||
- name: Fix Python path
|
||||
shell: pwsh
|
||||
run: |
|
||||
Remove-Item "$env:LOCALAPPDATA\Microsoft\WindowsApps\python*.exe" -Force -ErrorAction SilentlyContinue
|
||||
|
||||
- name: Set env & Print flameshot version
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -111,7 +114,6 @@ jobs:
|
||||
target: ${{ matrix.qt_target }}
|
||||
arch: ${{ matrix.config.qt_arch }}
|
||||
dir: '${{ github.workspace }}/build/'
|
||||
modules: 'qtscript'
|
||||
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
||||
|
||||
- name: Configure
|
||||
|
||||
28
.github/workflows/build_cmake.yml
vendored
28
.github/workflows/build_cmake.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-22.04]
|
||||
os: [ubuntu-24.04]
|
||||
|
||||
steps:
|
||||
- name: Checkout Source code
|
||||
@@ -39,6 +39,12 @@ jobs:
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: Checkout Source code
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.sha }}
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
sudo apt-get -y -qq update
|
||||
@@ -46,15 +52,9 @@ jobs:
|
||||
cmake \
|
||||
extra-cmake-modules \
|
||||
build-essential \
|
||||
qtbase5-dev \
|
||||
qttools5-dev-tools \
|
||||
qttools5-dev \
|
||||
libqt5dbus5 \
|
||||
libqt5network5 \
|
||||
libqt5core5a \
|
||||
libqt5widgets5 \
|
||||
libqt5gui5 \
|
||||
libqt5svg5-dev
|
||||
qt6-base-dev \
|
||||
qt6-svg-dev \
|
||||
qt6-tools-dev \
|
||||
|
||||
- name: Create Build Environment
|
||||
# Some projects don't allow in-source building, so create a separate build directory
|
||||
@@ -93,11 +93,11 @@ jobs:
|
||||
matrix:
|
||||
config:
|
||||
- {
|
||||
name: "Windows 2019 MSVC",
|
||||
name: "Windows 2022 MSVC",
|
||||
artifact: "Windows-MSVC.tar.xz",
|
||||
os: windows-2019,
|
||||
os: windows-2025,
|
||||
cc: "cl", cxx: "cl",
|
||||
environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
|
||||
environment_script: "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
|
||||
}
|
||||
|
||||
steps:
|
||||
@@ -113,7 +113,7 @@ jobs:
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
version: 5.15.2
|
||||
version: 6.8.*
|
||||
target: desktop
|
||||
dir: '${{ github.workspace }}/build/'
|
||||
|
||||
|
||||
@@ -35,6 +35,14 @@ project(
|
||||
set(PROJECT_NAME_CAPITALIZED "Flameshot")
|
||||
|
||||
include(FetchContent)
|
||||
#Must be set before fetching external content
|
||||
#QT_DEFAULT_MAJOR_VERSION used by "SingleApplication"
|
||||
#QT_VERSION_MAJOR used by Flameshot and "QtColorWidgets"
|
||||
set(QT_DEFAULT_MAJOR_VERSION 6 CACHE STRING "")
|
||||
set(QT_VERSION_MAJOR 6 CACHE STRING "")
|
||||
|
||||
#Needed due to linker error with QtColorWidget
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
FetchContent_Declare(
|
||||
qtColorWidgets
|
||||
@@ -71,7 +79,7 @@ if(WIN32)
|
||||
add_definitions(-DFLAMESHOT_VERSION_BUILD=1)
|
||||
add_definitions(-DFLAMESHOT_VERSION_STRING="${PROJECT_VERSION}")
|
||||
elseif(APPLE)
|
||||
set(Qt5_DIR "$(brew --prefix qt5)/lib/cmake/Qt5/" CACHE PATH "directory where Qt5Config.cmake exists.")
|
||||
set(Qt6_DIR "$(brew --prefix qt6)/lib/cmake/Qt6/" CACHE PATH "directory where Qt6Config.cmake exists.")
|
||||
set(CMAKE_MACOSX_BUNDLE ON)
|
||||
set(CMAKE_MACOSX_RPATH ON)
|
||||
endif()
|
||||
@@ -94,7 +102,7 @@ endif ()
|
||||
include(cmake/StandardProjectSettings.cmake)
|
||||
|
||||
add_library(project_options INTERFACE)
|
||||
target_compile_features(project_options INTERFACE cxx_std_17)
|
||||
target_compile_features(project_options INTERFACE cxx_std_20)
|
||||
|
||||
add_library(project_warnings INTERFACE)
|
||||
|
||||
@@ -120,7 +128,7 @@ if(USE_EXTERNAL_SINGLEAPPLICATION)
|
||||
# package dev-qt/qtsingleapplication provides no symlink to current version
|
||||
set(qtsingleapplication_libs libQt5Solutions_SingleApplication-2.6 Qt5Solutions_SingleApplication-2.6)
|
||||
find_library(QTSINGLEAPPLICATION_LIBRARY NAMES ${qtsingleapplication_libs})
|
||||
message(STATUS "Using external SingleApplication library")
|
||||
message(STATUS "Using external QtSingleApplication library")
|
||||
else()
|
||||
FetchContent_Declare(
|
||||
singleApplication
|
||||
|
||||
12
PKGBUILD
12
PKGBUILD
@@ -1,18 +1,18 @@
|
||||
pkgname=flameshot-git
|
||||
_pkgname=flameshot
|
||||
pkgver=r1981.86a646c3
|
||||
pkgver=r2022.277eb2f4
|
||||
pkgrel=1
|
||||
pkgdesc="Powerful yet simple to use screenshot software"
|
||||
arch=('i686' 'x86_64' 'aarch64' 'armv7h')
|
||||
url="https://github.com/flameshot-org/flameshot"
|
||||
license=('GPL-3.0-or-later')
|
||||
depends=('qt5-svg' 'hicolor-icon-theme' 'kguiaddons5')
|
||||
makedepends=('qt5-tools' 'cmake')
|
||||
depends=('qt6-base' 'qt6-svg' 'hicolor-icon-theme' 'kguiaddons')
|
||||
makedepends=('qt6-tools' 'cmake' 'ninja')
|
||||
optdepends=(
|
||||
'gnome-shell-extension-appindicator: for system tray icon if you are using Gnome'
|
||||
'grim: for wlroots wayland support'
|
||||
'xdg-desktop-portal: for wayland support, you will need the implementation for your wayland desktop environment'
|
||||
'qt5-imageformats: for additional export image formats (e.g. tiff, webp, and more)'
|
||||
'qt6-imageformats: for additional export image formats (e.g. tiff, webp, and more)'
|
||||
)
|
||||
provides=(flameshot)
|
||||
conflicts=(flameshot)
|
||||
@@ -31,13 +31,11 @@ pkgver() {
|
||||
build() {
|
||||
cd "${srcdir}/${_pkgname}"
|
||||
|
||||
cmake -B build -S . \
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
|
||||
cmake -GNinja -B build -S . \
|
||||
-DCMAKE_BUILD_TYPE=None \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DUSE_WAYLAND_CLIPBOARD=1 \
|
||||
-DDISABLE_UPDATE_CHECKER=1 \
|
||||
-Wno-dev
|
||||
|
||||
cmake --build build
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
app-id: org.flameshot.Flameshot
|
||||
runtime: org.kde.Platform
|
||||
runtime-version: '5.15-21.08'
|
||||
runtime-version: '6.9'
|
||||
sdk: org.kde.Sdk
|
||||
command: flameshot
|
||||
finish-args:
|
||||
@@ -32,6 +32,10 @@ modules:
|
||||
- -DCMAKE_BUILD_TYPE=Release
|
||||
- -DUSE_WAYLAND_CLIPBOARD=1
|
||||
sources:
|
||||
# Keep this in until qt6 is merged to master branch. Makes it easy to test flatpak dev builds
|
||||
# Change the path to the location of the cloned flameshot repo
|
||||
#- type: dir
|
||||
# path: /path/to/repo
|
||||
- type: git
|
||||
url: https://github.com/flameshot-org/flameshot.git
|
||||
branch: master
|
||||
|
||||
@@ -14,7 +14,7 @@ if [[ "${APPLE_DEV_IDENTITY}" == "" ]]; then
|
||||
echo "WARNING: No credentials for signing found"
|
||||
echo "WARNING: dmg package won't be signed and notarized"
|
||||
echo "--> Start packaging process"
|
||||
"$(brew --prefix qt5)/bin/macdeployqt" "${APP_NAME}.app" -dmg
|
||||
"$(brew --prefix qt6)/bin/macdeployqt" "${APP_NAME}.app" -dmg
|
||||
echo "--> Update dmg package links"
|
||||
"./${HELPERS_SCRIPTS_PATH}/update_package.sh"
|
||||
exit 0
|
||||
@@ -24,7 +24,7 @@ echo "--> Start application signing process"
|
||||
codesign --sign "${APPLE_DEV_IDENTITY}" --verbose --deep "${APP_NAME}.app"
|
||||
|
||||
echo "--> Start packaging process"
|
||||
"$(brew --prefix qt5)/bin/macdeployqt" "${APP_NAME}.app" -dmg -sign-for-notarization="${APPLE_DEV_IDENTITY}"
|
||||
"$(brew --prefix qt6)/bin/macdeployqt" "${APP_NAME}.app" -dmg -sign-for-notarization="${APPLE_DEV_IDENTITY}"
|
||||
|
||||
echo "--> Update dmg package links"
|
||||
"./${HELPERS_SCRIPTS_PATH}/update_package.sh"
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
name: flameshot
|
||||
adopt-info: flameshot
|
||||
base: core22
|
||||
base: core24
|
||||
summary: Powerful yet simple to use screenshot software
|
||||
description: |
|
||||
A powerful open source screenshot and annotation tool for Linux, Flameshot
|
||||
@@ -13,34 +13,43 @@ description: |
|
||||
grade: stable
|
||||
confinement: strict
|
||||
compression: lzo
|
||||
architectures:
|
||||
- build-on: amd64
|
||||
platforms:
|
||||
amd64:
|
||||
build-on: amd64
|
||||
build-for: amd64
|
||||
|
||||
|
||||
apps:
|
||||
flameshot:
|
||||
command: usr/bin/flameshot
|
||||
desktop: usr/share/applications/org.flameshot.Flameshot.desktop
|
||||
extensions:
|
||||
- kde-neon
|
||||
- kde-neon-6
|
||||
environment:
|
||||
DISABLE_WAYLAND: 1
|
||||
XDG_DATA_DIRS: $SNAP/share:$XDG_DATA_DIRS
|
||||
QT_QPA_PLATFORM: wayland
|
||||
QT_QPA_PLATFORMTHEME: gtk3
|
||||
slots: [dbus-flameshot]
|
||||
plugs:
|
||||
- home
|
||||
- desktop
|
||||
- wayland
|
||||
- gsettings
|
||||
- removable-media
|
||||
- network
|
||||
- network-bind
|
||||
|
||||
parts:
|
||||
flameshot:
|
||||
#source: ./
|
||||
source: https://github.com/flameshot-org/flameshot.git
|
||||
plugin: cmake
|
||||
build-packages:
|
||||
- git
|
||||
cmake-parameters:
|
||||
- -DFLAMESHOT_ICON=/snap/flameshot/current/usr/share/icons/hicolor/scalable/apps/flameshot.svg
|
||||
- -DCMAKE_INSTALL_PREFIX=/usr
|
||||
- -DUSE_WAYLAND_CLIPBOARD=1
|
||||
- -DFLAMESHOT_ICON=/snap/flameshot/current/usr/share/icons/hicolor/scalable/apps/flameshot.svg
|
||||
- -DCMAKE_INSTALL_PREFIX=/usr
|
||||
- -DUSE_WAYLAND_CLIPBOARD=1
|
||||
source-type: git
|
||||
override-pull: |
|
||||
craftctl default
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
find_package(
|
||||
Qt5
|
||||
Qt${QT_VERSION_MAJOR}
|
||||
CONFIG
|
||||
REQUIRED
|
||||
Core
|
||||
@@ -8,10 +8,11 @@ find_package(
|
||||
Network
|
||||
Svg
|
||||
DBus
|
||||
LinguistTools)
|
||||
LinguistTools
|
||||
)
|
||||
|
||||
if (USE_WAYLAND_CLIPBOARD)
|
||||
find_package(KF5GuiAddons)
|
||||
find_package(KF6GuiAddons)
|
||||
endif()
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
@@ -81,9 +82,10 @@ if (WIN32)
|
||||
set_target_properties(flameshot-cli PROPERTIES OUTPUT_NAME "flameshot-cli")
|
||||
target_link_options(flameshot-cli PRIVATE /SUBSYSTEM:CONSOLE)
|
||||
set_property(TARGET flameshot PROPERTY WIN32_EXECUTABLE true)
|
||||
if (MSVC)
|
||||
target_compile_options(flameshot PRIVATE /source-charset:utf-8)
|
||||
endif ()
|
||||
# Getting error D8016 - /utf-8 automatically set by current cmake/msvc ?
|
||||
#if (MSVC)
|
||||
# target_compile_options(flameshot PRIVATE /source-charset:utf-8)
|
||||
#endif ()
|
||||
endif ()
|
||||
|
||||
if(MSVC)
|
||||
@@ -143,9 +145,9 @@ set(FLAMESHOT_TS_FILES
|
||||
)
|
||||
|
||||
if (GENERATE_TS)
|
||||
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${FLAMESHOT_TS_FILES})
|
||||
qt6_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${FLAMESHOT_TS_FILES})
|
||||
else ()
|
||||
qt5_add_translation(QM_FILES ${FLAMESHOT_TS_FILES})
|
||||
qt6_add_translation(QM_FILES ${FLAMESHOT_TS_FILES})
|
||||
endif ()
|
||||
|
||||
target_sources(
|
||||
@@ -217,18 +219,17 @@ target_link_libraries(
|
||||
flameshot
|
||||
project_warnings
|
||||
project_options
|
||||
Qt5::Svg
|
||||
Qt5::DBus
|
||||
Qt5::Network
|
||||
Qt5::Widgets
|
||||
Qt${QT_VERSION_MAJOR}::Svg
|
||||
Qt${QT_VERSION_MAJOR}::DBus
|
||||
Qt${QT_VERSION_MAJOR}::Network
|
||||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
${QTSINGLEAPPLICATION_LIBRARY}
|
||||
QtColorWidgets
|
||||
|
||||
)
|
||||
|
||||
if (USE_WAYLAND_CLIPBOARD)
|
||||
target_compile_definitions(flameshot PRIVATE USE_WAYLAND_CLIPBOARD=1)
|
||||
target_link_libraries(flameshot KF5::GuiAddons)
|
||||
target_link_libraries(flameshot KF6::GuiAddons)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
@@ -403,7 +404,7 @@ if (WIN32)
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/windeployqt_stuff
|
||||
COMMAND
|
||||
$ENV{QTDIR}/bin/windeployqt.exe ${BINARIES_TYPE} --no-translations --compiler-runtime --no-system-d3d-compiler
|
||||
--no-angle --no-webkit2 --no-quick-import --dir ${CMAKE_BINARY_DIR}/windeployqt_stuff $<TARGET_FILE:flameshot>
|
||||
--no-quick-import --dir ${CMAKE_BINARY_DIR}/windeployqt_stuff $<TARGET_FILE:flameshot>
|
||||
# copy translations manually QM_FILES
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/windeployqt_stuff/translations
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_BINARY_DIR}/src/translations
|
||||
|
||||
@@ -97,7 +97,7 @@ ColorPickerEditor::ColorPickerEditor(QWidget* parent)
|
||||
connect(m_colorWheel,
|
||||
&color_widgets::ColorWheel::colorSelected,
|
||||
this,
|
||||
[=](QColor c) {
|
||||
[=, this](QColor c) {
|
||||
m_color = c;
|
||||
m_colorInput->setText(m_color.name(QColor::HexRgb));
|
||||
});
|
||||
@@ -170,7 +170,11 @@ void ColorPickerEditor::updatePreset()
|
||||
|
||||
void ColorPickerEditor::onAddPreset()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||
if (QColor::isValidColor(m_colorInput->text())) {
|
||||
#else
|
||||
if (QColor::isValidColorName(m_colorInput->text())) {
|
||||
#endif
|
||||
m_color = QColor(m_colorInput->text());
|
||||
m_colorInput->setText(m_color.name(QColor::HexRgb));
|
||||
} else {
|
||||
@@ -196,7 +200,11 @@ void ColorPickerEditor::onDeletePreset()
|
||||
|
||||
void ColorPickerEditor::onUpdatePreset()
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||
if (QColor::isValidColor(m_colorEdit->text())) {
|
||||
#else
|
||||
if (QColor::isValidColorName(m_colorEdit->text())) {
|
||||
#endif
|
||||
QColor c = QColor(m_colorEdit->text());
|
||||
m_colorEdit->setText(c.name(QColor::HexRgb));
|
||||
} else {
|
||||
@@ -206,4 +214,4 @@ void ColorPickerEditor::onUpdatePreset()
|
||||
|
||||
updatePreset();
|
||||
m_colorpicker->updateWidget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ void ConfigResolver::populate()
|
||||
auto* resolveAll = new QPushButton(tr("Resolve all"));
|
||||
resolveAll->setToolTip(tr("Resolve all listed errors."));
|
||||
buttons->addButton(resolveAll, BBox::ResetRole);
|
||||
connect(resolveAll, &QPushButton::clicked, this, [=]() {
|
||||
connect(resolveAll, &QPushButton::clicked, this, [=, this]() {
|
||||
for (const auto& key : semanticallyWrong) {
|
||||
ConfigHandler().resetValue(key);
|
||||
}
|
||||
|
||||
@@ -145,11 +145,12 @@ void ConfigWindow::initErrorIndicator(QWidget* tab, QWidget* widget)
|
||||
}
|
||||
|
||||
// Sigslots
|
||||
connect(ConfigHandler::getInstance(), &ConfigHandler::error, widget, [=]() {
|
||||
widget->setEnabled(false);
|
||||
label->show();
|
||||
btnResolve->show();
|
||||
});
|
||||
connect(
|
||||
ConfigHandler::getInstance(), &ConfigHandler::error, widget, [=, this]() {
|
||||
widget->setEnabled(false);
|
||||
label->show();
|
||||
btnResolve->show();
|
||||
});
|
||||
connect(ConfigHandler::getInstance(),
|
||||
&ConfigHandler::errorResolved,
|
||||
widget,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <QSizePolicy>
|
||||
#include <QSpinBox>
|
||||
#include <QStandardPaths>
|
||||
#include <QTextCodec>
|
||||
#include <QStringDecoder>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
GeneralConf::GeneralConf(QWidget* parent)
|
||||
@@ -188,12 +188,12 @@ void GeneralConf::importConfiguration()
|
||||
return;
|
||||
}
|
||||
QFile file(fileName);
|
||||
QTextCodec* codec = QTextCodec::codecForLocale();
|
||||
if (!file.open(QFile::ReadOnly)) {
|
||||
QMessageBox::about(this, tr("Error"), tr("Unable to read file."));
|
||||
return;
|
||||
}
|
||||
QString text = codec->toUnicode(file.readAll());
|
||||
QStringDecoder decoder(QStringDecoder::System);
|
||||
QString text = decoder(file.readAll());
|
||||
file.close();
|
||||
|
||||
QFile config(ConfigHandler().configFilePath());
|
||||
@@ -201,7 +201,8 @@ void GeneralConf::importConfiguration()
|
||||
QMessageBox::about(this, tr("Error"), tr("Unable to write file."));
|
||||
return;
|
||||
}
|
||||
config.write(codec->fromUnicode(text));
|
||||
QStringEncoder encoder(QStringEncoder::System);
|
||||
config.write(encoder(text));
|
||||
config.close();
|
||||
}
|
||||
|
||||
@@ -566,7 +567,7 @@ void GeneralConf::initSaveAfterCopy()
|
||||
m_setSaveAsFileExtension = new QComboBox(this);
|
||||
|
||||
QStringList imageFormatList;
|
||||
foreach (auto mimeType, QImageWriter::supportedImageFormats())
|
||||
for (const auto& mimeType : QImageWriter::supportedImageFormats())
|
||||
imageFormatList.append(mimeType);
|
||||
|
||||
m_setSaveAsFileExtension->addItems(imageFormatList);
|
||||
|
||||
@@ -7,21 +7,18 @@
|
||||
#include "src/core/qguiappcurrentscreen.h"
|
||||
#include "src/utils/globalvalues.h"
|
||||
#include "toolfactory.h"
|
||||
#include <QCursor>
|
||||
#include <QHeaderView>
|
||||
#include <QIcon>
|
||||
#include <QKeyEvent>
|
||||
#include <QLabel>
|
||||
#include <QRect>
|
||||
#include <QScreen>
|
||||
#include <QStringList>
|
||||
#include <QTableWidget>
|
||||
#include <QVBoxLayout>
|
||||
#include <QVector>
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
#include <QCursor>
|
||||
#include <QRect>
|
||||
#include <QScreen>
|
||||
#endif
|
||||
|
||||
ShortcutsWidget::ShortcutsWidget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
@@ -29,12 +26,10 @@ ShortcutsWidget::ShortcutsWidget(QWidget* parent)
|
||||
setWindowIcon(QIcon(GlobalValues::iconPath()));
|
||||
setWindowTitle(tr("Hot Keys"));
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
QRect position = frameGeometry();
|
||||
QScreen* screen = QGuiAppCurrentScreen().currentScreen();
|
||||
position.moveCenter(screen->availableGeometry().center());
|
||||
move(position.topLeft());
|
||||
#endif
|
||||
|
||||
m_layout = new QVBoxLayout(this);
|
||||
m_layout->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
|
||||
|
||||
@@ -21,8 +21,7 @@ public:
|
||||
|
||||
private:
|
||||
void initInfoTable();
|
||||
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
|
||||
defined(Q_OS_MACX))
|
||||
#if (defined(Q_OS_MAC) || defined(Q_OS_MACOS))
|
||||
const QString& nativeOSHotKeyText(const QString& text);
|
||||
#endif
|
||||
|
||||
@@ -31,8 +30,7 @@ private slots:
|
||||
void onShortcutCellClicked(int, int);
|
||||
|
||||
private:
|
||||
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
|
||||
defined(Q_OS_MACX))
|
||||
#if (defined(Q_OS_MAC) || defined(Q_OS_MACOS))
|
||||
QString m_res;
|
||||
#endif
|
||||
ConfigHandler m_config;
|
||||
|
||||
@@ -19,7 +19,7 @@ UIcolorEditor::UIcolorEditor(QWidget* parent)
|
||||
m_hLayout = new QHBoxLayout;
|
||||
m_vLayout = new QVBoxLayout;
|
||||
|
||||
const int space = QApplication::fontMetrics().lineSpacing();
|
||||
const int space = QFontMetrics(qApp->font()).lineSpacing();
|
||||
m_hLayout->addItem(new QSpacerItem(space, space, QSizePolicy::Expanding));
|
||||
m_vLayout->setAlignment(Qt::AlignVCenter);
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <QBuffer>
|
||||
#include <QDebug>
|
||||
#include <QDesktopServices>
|
||||
#include <QDesktopWidget>
|
||||
#include <QFile>
|
||||
#include <QMessageBox>
|
||||
#include <QThread>
|
||||
@@ -53,7 +52,7 @@ Flameshot::Flameshot()
|
||||
// permissions on the first run. Otherwise it will be hidden under the
|
||||
// CaptureWidget
|
||||
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
|
||||
currentScreen->grabWindow(QApplication::desktop()->winId(), 0, 0, 1, 1);
|
||||
currentScreen->grabWindow(0, 0, 0, 1, 1);
|
||||
|
||||
// set global shortcuts for MacOS
|
||||
m_HotkeyScreenshotCapture = new QHotkey(
|
||||
@@ -403,7 +402,7 @@ void Flameshot::exportCapture(const QPixmap& capture,
|
||||
// NOTE: lambda can't capture 'this' because it might be destroyed later
|
||||
CR::ExportTask tasks = tasks;
|
||||
QObject::connect(
|
||||
widget, &ImgUploaderBase::uploadOk, [=](const QUrl& url) {
|
||||
widget, &ImgUploaderBase::uploadOk, [=, this](const QUrl& url) {
|
||||
if (ConfigHandler().copyURLAfterUpload()) {
|
||||
if (!(tasks & CR::COPY)) {
|
||||
FlameshotDaemon::copyToClipboard(
|
||||
|
||||
@@ -13,8 +13,7 @@ class ConfigWindow;
|
||||
class InfoWindow;
|
||||
class CaptureLauncher;
|
||||
class UploadHistory;
|
||||
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
|
||||
defined(Q_OS_MACX))
|
||||
#if (defined(Q_OS_MAC) || defined(Q_OS_MACOS))
|
||||
class QHotkey;
|
||||
#endif
|
||||
|
||||
@@ -75,8 +74,7 @@ private:
|
||||
QPointer<CaptureLauncher> m_launcherWindow;
|
||||
QPointer<ConfigWindow> m_configWindow;
|
||||
|
||||
#if (defined(Q_OS_MAC) || defined(Q_OS_MAC64) || defined(Q_OS_MACOS) || \
|
||||
defined(Q_OS_MACX))
|
||||
#if (defined(Q_OS_MAC) || defined(Q_OS_MACOS))
|
||||
QHotkey* m_HotkeyScreenshotCapture;
|
||||
QHotkey* m_HotkeyScreenshotHistory;
|
||||
#endif
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <QClipboard>
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusMessage>
|
||||
#include <QIODevice>
|
||||
#include <QPixmap>
|
||||
#include <QRect>
|
||||
|
||||
@@ -260,7 +261,7 @@ void FlameshotDaemon::attachPin(const QPixmap& pixmap, QRect geometry)
|
||||
{
|
||||
auto* pinWidget = new PinWidget(pixmap, geometry);
|
||||
m_widgets.append(pinWidget);
|
||||
connect(pinWidget, &QObject::destroyed, this, [=]() {
|
||||
connect(pinWidget, &QObject::destroyed, this, [=, this]() {
|
||||
m_widgets.removeOne(pinWidget);
|
||||
quitIfIdle();
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ GlobalShortcutFilter::GlobalShortcutFilter(QObject* parent)
|
||||
|
||||
bool GlobalShortcutFilter::nativeEventFilter(const QByteArray& eventType,
|
||||
void* message,
|
||||
long* result)
|
||||
qintptr* result)
|
||||
{
|
||||
Q_UNUSED(eventType)
|
||||
Q_UNUSED(result)
|
||||
|
||||
@@ -16,7 +16,7 @@ public:
|
||||
|
||||
bool nativeEventFilter(const QByteArray& eventType,
|
||||
void* message,
|
||||
long* result);
|
||||
qintptr* result);
|
||||
|
||||
signals:
|
||||
void printPressed();
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "qguiappcurrentscreen.h"
|
||||
#include <QCursor>
|
||||
#include <QDesktopWidget>
|
||||
#include <QGuiApplication>
|
||||
#include <QPoint>
|
||||
#include <QScreen>
|
||||
@@ -49,15 +48,6 @@ QScreen* QGuiAppCurrentScreen::currentScreen(const QPoint& pos)
|
||||
|
||||
QScreen* QGuiAppCurrentScreen::screenAt(const QPoint& pos)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
m_currentScreen = qGuiApp->screenAt(pos);
|
||||
#else
|
||||
for (QScreen* const screen : QGuiApplication::screens()) {
|
||||
m_currentScreen = screen;
|
||||
if (screen->geometry().contains(pos)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return m_currentScreen;
|
||||
}
|
||||
|
||||
54
src/main.cpp
54
src/main.cpp
@@ -33,36 +33,6 @@
|
||||
#include <desktopinfo.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
// source: https://github.com/ksnip/ksnip/issues/416
|
||||
void wayland_hacks()
|
||||
{
|
||||
int suffixIndex;
|
||||
DesktopInfo info;
|
||||
|
||||
const char* qt_version = qVersion();
|
||||
|
||||
QVersionNumber targetVersion(5, 15, 2);
|
||||
QString string(qt_version);
|
||||
QVersionNumber currentVersion =
|
||||
QVersionNumber::fromString(string, &suffixIndex);
|
||||
|
||||
if (currentVersion < targetVersion) {
|
||||
if (info.windowManager() == DesktopInfo::GNOME) {
|
||||
qWarning()
|
||||
<< "Qt versions lower than" << targetVersion.toString()
|
||||
<< "on GNOME using Wayland have a bug when accessing the "
|
||||
"clipboard."
|
||||
<< "Your version is" << currentVersion.toString()
|
||||
<< "so we're forcing QT_QPA_PLATFORM to 'xcb'."
|
||||
<< "To use native Wayland, please upgrade your Qt version to"
|
||||
<< targetVersion.toString() << "or higher";
|
||||
qputenv("QT_QPA_PLATFORM", "xcb");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int requestCaptureAndWait(const CaptureRequest& req)
|
||||
{
|
||||
Flameshot* flameshot = Flameshot::instance();
|
||||
@@ -113,7 +83,11 @@ QTranslator translator, qtTranslator;
|
||||
void configureApp(bool gui)
|
||||
{
|
||||
if (gui) {
|
||||
#if defined(Q_OS_WIN) && QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
|
||||
QApplication::setStyle("Fusion"); // Supports dark scheme on Win 10/11
|
||||
#else
|
||||
QApplication::setStyle(new StyleOverride);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Configure translations
|
||||
@@ -130,7 +104,7 @@ void configureApp(bool gui)
|
||||
qtTranslator.load(QLocale::system(),
|
||||
"qt",
|
||||
"_",
|
||||
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
QLibraryInfo::path(QLibraryInfo::TranslationsPath));
|
||||
|
||||
auto app = QCoreApplication::instance();
|
||||
app->installTranslator(&translator);
|
||||
@@ -149,24 +123,18 @@ void reinitializeAsQApplication(int& argc, char* argv[])
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#ifdef Q_OS_LINUX
|
||||
wayland_hacks();
|
||||
#endif
|
||||
|
||||
// required for the button serialization
|
||||
// TODO: change to QVector in v1.0
|
||||
qRegisterMetaTypeStreamOperators<QList<int>>("QList<int>");
|
||||
QCoreApplication::setApplicationVersion(APP_VERSION);
|
||||
QCoreApplication::setApplicationName(QStringLiteral("flameshot"));
|
||||
QCoreApplication::setOrganizationName(QStringLiteral("flameshot"));
|
||||
|
||||
// no arguments, just launch Flameshot
|
||||
if (argc == 1) {
|
||||
#ifndef USE_EXTERNAL_SINGLEAPPLICATION
|
||||
SingleApplication app(argc, argv);
|
||||
#else
|
||||
QtSingleApplication app(argc, argv);
|
||||
#endif
|
||||
// #ifndef USE_EXTERNAL_SINGLEAPPLICATION
|
||||
// SingleApplication app(argc, argv);
|
||||
// #else
|
||||
// QtSingleApplication app(argc, argv);
|
||||
// #endif
|
||||
QApplication app(argc, argv);
|
||||
configureApp(true);
|
||||
auto c = Flameshot::instance();
|
||||
FlameshotDaemon::start();
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "src/widgets/notificationwidget.h"
|
||||
#include <QBuffer>
|
||||
#include <QDesktopServices>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QNetworkAccessManager>
|
||||
@@ -31,9 +32,9 @@ void ImgurUploader::handleReply(QNetworkReply* reply)
|
||||
{
|
||||
spinner()->deleteLater();
|
||||
m_currentImageName.clear();
|
||||
QJsonDocument response = QJsonDocument::fromJson(reply->readAll());
|
||||
QJsonObject json = response.object();
|
||||
if (reply->error() == QNetworkReply::NoError) {
|
||||
QJsonDocument response = QJsonDocument::fromJson(reply->readAll());
|
||||
QJsonObject json = response.object();
|
||||
QJsonObject data = json[QStringLiteral("data")].toObject();
|
||||
setImageURL(data[QStringLiteral("link")].toString());
|
||||
|
||||
@@ -54,7 +55,20 @@ void ImgurUploader::handleReply(QNetworkReply* reply)
|
||||
|
||||
emit uploadOk(imageURL());
|
||||
} else {
|
||||
setInfoLabelText(reply->errorString());
|
||||
QString status;
|
||||
if (json.contains(QStringLiteral("errors")) &&
|
||||
json.value(QStringLiteral("errors")).isArray()) {
|
||||
QJsonArray errorsArray =
|
||||
json.value(QStringLiteral("errors")).toArray();
|
||||
if (!errorsArray.isEmpty() && errorsArray.at(0).isObject()) {
|
||||
QJsonObject errorObj = errorsArray.at(0).toObject();
|
||||
status = errorObj.value(QStringLiteral("code")).toString() +
|
||||
" - " +
|
||||
errorObj.value(QStringLiteral("status")).toString();
|
||||
}
|
||||
}
|
||||
|
||||
setInfoLabelText(reply->errorString() + "\n" + status);
|
||||
}
|
||||
new QShortcut(Qt::Key_Escape, this, SLOT(close()));
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QPixmap>
|
||||
#include <QProcess>
|
||||
#include <QRegularExpression>
|
||||
#include <QStandardPaths>
|
||||
#include <QTabWidget>
|
||||
|
||||
@@ -128,11 +129,12 @@ void AppLauncherWidget::launch(const QModelIndex& index)
|
||||
QStringList prog_args = command.split(" ");
|
||||
#endif
|
||||
// no quotes because it is going in an array!
|
||||
static const QRegularExpression regexp("(\\%.)");
|
||||
if (command.contains("%")) {
|
||||
// but that means we need to substitute IN the array not the string!
|
||||
for (auto& i : prog_args) {
|
||||
if (i.contains("%"))
|
||||
i.replace(QRegExp("(\\%.)"), m_tempFile);
|
||||
i.replace(regexp, m_tempFile);
|
||||
}
|
||||
} else {
|
||||
// we really should append the file name if there
|
||||
@@ -174,7 +176,9 @@ void AppLauncherWidget::searchChanged(const QString& text)
|
||||
m_tabWidget->hide();
|
||||
m_filterList->show();
|
||||
m_filterList->clear();
|
||||
QRegExp regexp(text, Qt::CaseInsensitive, QRegExp::Wildcard);
|
||||
const QRegularExpression regexp(
|
||||
QRegularExpression::wildcardToRegularExpression("*" + text + "*"),
|
||||
QRegularExpression::CaseInsensitiveOption);
|
||||
QVector<DesktopAppData> apps;
|
||||
|
||||
for (auto const& i : catIconNames.toStdMap()) {
|
||||
@@ -253,7 +257,7 @@ void AppLauncherWidget::initAppMap()
|
||||
QStringList multimediaNames;
|
||||
multimediaNames << QStringLiteral("AudioVideo") << QStringLiteral("Audio")
|
||||
<< QStringLiteral("Video");
|
||||
for (const QString& name : qAsConst(multimediaNames)) {
|
||||
for (const QString& name : std::as_const(multimediaNames)) {
|
||||
if (!m_appsMap.contains(name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ PinWidget::PinWidget(const QPixmap& pixmap,
|
||||
m_label->setPixmap(m_pixmap);
|
||||
m_layout->addWidget(m_label);
|
||||
|
||||
new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this, SLOT(close()));
|
||||
new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this, SLOT(close()));
|
||||
new QShortcut(Qt::Key_Escape, this, SLOT(close()));
|
||||
|
||||
qreal devicePixelRatio = 1;
|
||||
@@ -135,7 +135,7 @@ bool PinWidget::scrollEvent(QWheelEvent* event)
|
||||
return true;
|
||||
}
|
||||
|
||||
void PinWidget::enterEvent(QEvent*)
|
||||
void PinWidget::enterEvent(QEnterEvent*)
|
||||
{
|
||||
m_shadowEffect->setColor(m_hoverColor);
|
||||
}
|
||||
@@ -152,14 +152,14 @@ void PinWidget::mouseDoubleClickEvent(QMouseEvent*)
|
||||
|
||||
void PinWidget::mousePressEvent(QMouseEvent* e)
|
||||
{
|
||||
m_dragStart = e->globalPos();
|
||||
m_offsetX = e->localPos().x() / width();
|
||||
m_offsetY = e->localPos().y() / height();
|
||||
m_dragStart = e->globalPosition();
|
||||
m_offsetX = e->position().x() / width();
|
||||
m_offsetY = e->position().y() / height();
|
||||
}
|
||||
|
||||
void PinWidget::mouseMoveEvent(QMouseEvent* e)
|
||||
{
|
||||
const QPoint delta = e->globalPos() - m_dragStart;
|
||||
const QPointF delta = e->globalPosition() - m_dragStart;
|
||||
const int offsetW = width() * m_offsetX;
|
||||
const int offsetH = height() * m_offsetY;
|
||||
move(m_dragStart.x() + delta.x() - offsetW,
|
||||
|
||||
@@ -24,7 +24,7 @@ protected:
|
||||
void mousePressEvent(QMouseEvent*) override;
|
||||
void mouseMoveEvent(QMouseEvent*) override;
|
||||
void keyPressEvent(QKeyEvent*) override;
|
||||
void enterEvent(QEvent*) override;
|
||||
void enterEvent(QEnterEvent*) override;
|
||||
void leaveEvent(QEvent*) override;
|
||||
|
||||
bool event(QEvent* event) override;
|
||||
@@ -45,7 +45,7 @@ private:
|
||||
QPixmap m_pixmap;
|
||||
QVBoxLayout* m_layout;
|
||||
QLabel* m_label;
|
||||
QPoint m_dragStart;
|
||||
QPointF m_dragStart;
|
||||
qreal m_offsetX{}, m_offsetY{};
|
||||
QGraphicsDropShadowEffect* m_shadowEffect;
|
||||
QColor m_baseColor, m_hoverColor;
|
||||
|
||||
@@ -23,13 +23,11 @@ TextConfig::TextConfig(QWidget* parent)
|
||||
, m_rightAlignButton(nullptr)
|
||||
{
|
||||
|
||||
QFontDatabase fontDB;
|
||||
|
||||
connect(m_fontsCB,
|
||||
&QComboBox::currentTextChanged,
|
||||
this,
|
||||
&TextConfig::fontFamilyChanged);
|
||||
m_fontsCB->addItems(fontDB.families());
|
||||
m_fontsCB->addItems(QFontDatabase::families());
|
||||
setFontFamily(ConfigHandler().fontFamily());
|
||||
|
||||
QString iconPrefix = ColorUtils::colorIsDark(palette().windowText().color())
|
||||
|
||||
@@ -52,7 +52,7 @@ AbstractLogger& AbstractLogger::sendMessage(const QString& msg, Channel channel)
|
||||
msg, messageHeader(channel, Notification), m_notificationPath);
|
||||
}
|
||||
if (!m_textStreams.isEmpty()) {
|
||||
foreach (auto* stream, m_textStreams) {
|
||||
for (auto* stream : m_textStreams) {
|
||||
*stream << messageHeader(channel, String) << msg << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QTextStream>
|
||||
|
||||
|
||||
@@ -359,7 +359,7 @@ QString ConfigHandler::filenamePatternDefault()
|
||||
|
||||
void ConfigHandler::setDefaultSettings()
|
||||
{
|
||||
foreach (const QString& key, m_settings.allKeys()) {
|
||||
for (const auto& key : m_settings.allKeys()) {
|
||||
if (isShortcut(key)) {
|
||||
// Do not reset Shortcuts
|
||||
continue;
|
||||
@@ -486,25 +486,15 @@ void ConfigHandler::resetValue(const QString& key)
|
||||
|
||||
QSet<QString>& ConfigHandler::recognizedGeneralOptions()
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
auto keys = ::recognizedGeneralOptions.keys();
|
||||
static QSet<QString> options = QSet<QString>(keys.begin(), keys.end());
|
||||
#else
|
||||
static QSet<QString> options =
|
||||
QSet<QString>::fromList(::recognizedGeneralOptions.keys());
|
||||
#endif
|
||||
return options;
|
||||
}
|
||||
|
||||
QSet<QString>& ConfigHandler::recognizedShortcutNames()
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||
auto keys = recognizedShortcuts.keys();
|
||||
static QSet<QString> names = QSet<QString>(keys.begin(), keys.end());
|
||||
#else
|
||||
static QSet<QString> names =
|
||||
QSet<QString>::fromList(recognizedShortcuts.keys());
|
||||
#endif
|
||||
return names;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ QVector<DesktopAppData> DesktopFileParser::getAppsByCategory(
|
||||
const QString& category)
|
||||
{
|
||||
QVector<DesktopAppData> res;
|
||||
for (const DesktopAppData& app : qAsConst(m_appList)) {
|
||||
for (const DesktopAppData& app : std::as_const(m_appList)) {
|
||||
if (app.categories.contains(category)) {
|
||||
res.append(app);
|
||||
}
|
||||
@@ -139,7 +139,7 @@ QMap<QString, QVector<DesktopAppData>> DesktopFileParser::getAppsByCategory(
|
||||
const QStringList& categories)
|
||||
{
|
||||
QMap<QString, QVector<DesktopAppData>> res;
|
||||
for (const DesktopAppData& app : qAsConst(m_appList)) {
|
||||
for (const DesktopAppData& app : std::as_const(m_appList)) {
|
||||
for (const QString& category : categories) {
|
||||
if (app.categories.contains(category)) {
|
||||
res[category].append(app);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
int GlobalValues::buttonBaseSize()
|
||||
{
|
||||
return QApplication::fontMetrics().lineSpacing() * 2.2;
|
||||
return QFontMetrics(qApp->font()).lineSpacing() * 2.2;
|
||||
}
|
||||
|
||||
QString GlobalValues::versionInfo()
|
||||
@@ -32,4 +32,4 @@ QString GlobalValues::iconPathPNG()
|
||||
#else
|
||||
return { ":img/app/flameshot.png" };
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ const QList<QString>& History::history()
|
||||
int cnt = 0;
|
||||
int max = ConfigHandler().uploadHistoryMax();
|
||||
m_thumbs.clear();
|
||||
foreach (QString fileName, images) {
|
||||
for (const auto& fileName : images) {
|
||||
if (++cnt <= max) {
|
||||
m_thumbs.append(fileName);
|
||||
} else {
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "src/utils/filenamehandler.h"
|
||||
#include "src/utils/systemnotification.h"
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QGuiApplication>
|
||||
#include <QPixmap>
|
||||
#include <QProcess>
|
||||
@@ -141,10 +140,12 @@ void ScreenGrabber::freeDesktopPortal(bool& ok, QPixmap& res)
|
||||
QPixmap ScreenGrabber::grabEntireDesktop(bool& ok)
|
||||
{
|
||||
ok = true;
|
||||
int wid = 0;
|
||||
|
||||
#if defined(Q_OS_MACOS)
|
||||
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
|
||||
QPixmap screenPixmap(
|
||||
currentScreen->grabWindow(QApplication::desktop()->winId(),
|
||||
currentScreen->grabWindow(wid,
|
||||
currentScreen->geometry().x(),
|
||||
currentScreen->geometry().y(),
|
||||
currentScreen->geometry().width(),
|
||||
@@ -205,13 +206,8 @@ QPixmap ScreenGrabber::grabEntireDesktop(bool& ok)
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) || defined(Q_OS_WIN)
|
||||
QRect geometry = desktopGeometry();
|
||||
QPixmap p(QApplication::primaryScreen()->grabWindow(
|
||||
QApplication::desktop()->winId(),
|
||||
geometry.x(),
|
||||
geometry.y(),
|
||||
geometry.width(),
|
||||
geometry.height()));
|
||||
auto screenNumber = QApplication::desktop()->screenNumber();
|
||||
QScreen* screen = QApplication::screens()[screenNumber];
|
||||
wid, geometry.x(), geometry.y(), geometry.width(), geometry.height()));
|
||||
QScreen* screen = qApp->screenAt(QCursor::pos());
|
||||
p.setDevicePixelRatio(screen->devicePixelRatio());
|
||||
return p;
|
||||
#endif
|
||||
@@ -251,11 +247,8 @@ QPixmap ScreenGrabber::grabScreen(QScreen* screen, bool& ok)
|
||||
}
|
||||
} else {
|
||||
ok = true;
|
||||
return screen->grabWindow(QApplication::desktop()->winId(),
|
||||
geometry.x(),
|
||||
geometry.y(),
|
||||
geometry.width(),
|
||||
geometry.height());
|
||||
return screen->grabWindow(
|
||||
0, geometry.x(), geometry.y(), geometry.width(), geometry.height());
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ QString ShowSaveFileDialog(const QString& title, const QString& directory)
|
||||
|
||||
// Build string list of supported image formats
|
||||
QStringList mimeTypeList;
|
||||
foreach (auto mimeType, QImageWriter::supportedMimeTypes()) {
|
||||
for (const auto& mimeType : QImageWriter::supportedMimeTypes()) {
|
||||
// image/heif has several aliases and they cause glitch in save dialog
|
||||
// It is necessary to keep the image/heif (otherwise HEIF plug-in from
|
||||
// kimageformats will not work) but the aliases could be filtered out.
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <QFileInfo>
|
||||
#include <QImageWriter>
|
||||
#include <QKeySequence>
|
||||
#include <QRegularExpression>
|
||||
#include <QStandardPaths>
|
||||
#include <QVariant>
|
||||
|
||||
@@ -96,8 +97,13 @@ Color::Color(QColor def)
|
||||
bool Color::check(const QVariant& val)
|
||||
{
|
||||
QString str = val.toString();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||
bool validColor = QColor::isValidColor(str);
|
||||
#else
|
||||
bool validColor = QColor::isValidColorName(str);
|
||||
#endif
|
||||
// Disable #RGB, #RRRGGGBBB and #RRRRGGGGBBBB formats that QColor supports
|
||||
return QColor::isValidColor(str) &&
|
||||
return validColor &&
|
||||
(str[0] != '#' ||
|
||||
(str.length() != 4 && str.length() != 10 && str.length() != 13));
|
||||
}
|
||||
@@ -235,8 +241,7 @@ QVariant KeySequence::process(const QVariant& val)
|
||||
}
|
||||
if (str.length() > 0) {
|
||||
// Make the "main" key in sequence (last one) lower-case.
|
||||
const QCharRef& lastChar = str[str.length() - 1];
|
||||
str.replace(str.length() - 1, 1, lastChar.toLower());
|
||||
str[str.length() - 1] = str[str.length() - 1].toLower();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
@@ -245,7 +250,7 @@ QVariant KeySequence::process(const QVariant& val)
|
||||
|
||||
bool ExistingDir::check(const QVariant& val)
|
||||
{
|
||||
if (!val.canConvert(QVariant::String) || val.toString().isEmpty()) {
|
||||
if (!val.canConvert<QString>() || val.toString().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
QFileInfo info(val.toString());
|
||||
@@ -396,11 +401,15 @@ bool UserColors::check(const QVariant& val)
|
||||
if (!val.isValid()) {
|
||||
return false;
|
||||
}
|
||||
if (!val.canConvert(QVariant::StringList)) {
|
||||
if (!val.canConvert<QStringList>()) {
|
||||
return false;
|
||||
}
|
||||
for (const QString& str : val.toStringList()) {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||
if (!QColor::isValidColor(str) && str != "picker") {
|
||||
#else
|
||||
if (!QColor::isValidColorName(str) && str != "picker") {
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -470,7 +479,7 @@ QVariant UserColors::representation(const QVariant& val)
|
||||
|
||||
bool SaveFileExtension::check(const QVariant& val)
|
||||
{
|
||||
if (!val.canConvert(QVariant::String) || val.toString().isEmpty()) {
|
||||
if (!val.canConvert<QString>() || val.toString().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -481,7 +490,7 @@ bool SaveFileExtension::check(const QVariant& val)
|
||||
}
|
||||
|
||||
QStringList imageFormatList;
|
||||
foreach (auto imageFormat, QImageWriter::supportedImageFormats())
|
||||
for (const auto& imageFormat : QImageWriter::supportedImageFormats())
|
||||
imageFormatList.append(imageFormat);
|
||||
|
||||
if (!imageFormatList.contains(extension)) {
|
||||
@@ -533,32 +542,33 @@ QVariant Region::process(const QVariant& val)
|
||||
return ScreenGrabber().desktopGeometry();
|
||||
} else if (str.startsWith("screen")) {
|
||||
bool ok;
|
||||
int number = str.midRef(6).toInt(&ok);
|
||||
int number = str.mid(6).toInt(&ok);
|
||||
if (!ok || number < 0) {
|
||||
return {};
|
||||
}
|
||||
return ScreenGrabber().screenGeometry(qApp->screens()[number]);
|
||||
}
|
||||
|
||||
QRegExp regex("(-{,1}\\d+)" // number (any sign)
|
||||
"[x,\\.\\s]" // separator ('x', ',', '.', or whitespace)
|
||||
"(-{,1}\\d+)" // number (any sign)
|
||||
"[\\+,\\.\\s]*" // separator ('+',',', '.', or whitespace)
|
||||
"(-{,1}\\d+)" // number (non-negative)
|
||||
"[\\+,\\.\\s]*" // separator ('+', ',', '.', or whitespace)
|
||||
"(-{,1}\\d+)" // number (non-negative)
|
||||
static const QRegularExpression regex(
|
||||
"(-{,1}\\d+)" // number (any sign)
|
||||
"[x,\\.\\s]" // separator ('x', ',', '.', or whitespace)
|
||||
"(-{,1}\\d+)" // number (any sign)
|
||||
"[\\+,\\.\\s]*" // separator ('+',',', '.', or whitespace)
|
||||
"(-{,1}\\d+)" // number (non-negative)
|
||||
"[\\+,\\.\\s]*" // separator ('+', ',', '.', or whitespace)
|
||||
"(-{,1}\\d+)" // number (non-negative)
|
||||
);
|
||||
|
||||
if (!regex.exactMatch(str)) {
|
||||
if (!regex.match(str).hasMatch()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
int w, h, x, y;
|
||||
bool w_ok, h_ok, x_ok, y_ok;
|
||||
w = regex.cap(1).toInt(&w_ok);
|
||||
h = regex.cap(2).toInt(&h_ok);
|
||||
x = regex.cap(3).toInt(&x_ok);
|
||||
y = regex.cap(4).toInt(&y_ok);
|
||||
w = regex.match(str).captured(1).toInt(&w_ok);
|
||||
h = regex.match(str).captured(2).toInt(&h_ok);
|
||||
x = regex.match(str).captured(3).toInt(&x_ok);
|
||||
y = regex.match(str).captured(4).toInt(&y_ok);
|
||||
|
||||
if (!(w_ok && h_ok && x_ok && y_ok)) {
|
||||
return {};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "winlnkfileparse.h"
|
||||
#include <QDir>
|
||||
#include <QDirIterator>
|
||||
#include <QFileSystemModel>
|
||||
#include <QFileIconProvider>
|
||||
#include <QImageWriter>
|
||||
#include <QRegularExpression>
|
||||
#include <QSettings>
|
||||
@@ -36,11 +36,8 @@ DesktopAppData WinLnkFileParser::parseLnkFile(const QFileInfo& fiLnk,
|
||||
|
||||
res.name = fiLnk.baseName();
|
||||
res.exec = fiSymlink.absoluteFilePath();
|
||||
|
||||
// Get icon from exe
|
||||
QFileSystemModel* model = new QFileSystemModel;
|
||||
model->setRootPath(fiSymlink.path());
|
||||
res.icon = model->fileIcon(model->index(fiSymlink.filePath()));
|
||||
static QFileIconProvider provider;
|
||||
res.icon = provider.icon(QFileInfo(fiSymlink.filePath()));
|
||||
|
||||
if (m_GraphicAppsList.contains(fiSymlink.fileName())) {
|
||||
res.categories = QStringList() << "Graphics";
|
||||
@@ -73,7 +70,7 @@ int WinLnkFileParser::processDirectory(const QDir& dir)
|
||||
<< "Updater"
|
||||
<< "Windows PowerShell";
|
||||
const QString sMenuFilter("\\b(" + sListMenuFilter.join('|') + ")\\b");
|
||||
QRegularExpression regexfilter(sMenuFilter);
|
||||
static const QRegularExpression regexfilter(sMenuFilter);
|
||||
|
||||
bool ok;
|
||||
int length = m_appList.length();
|
||||
@@ -99,7 +96,7 @@ QVector<DesktopAppData> WinLnkFileParser::getAppsByCategory(
|
||||
const QString& category)
|
||||
{
|
||||
QVector<DesktopAppData> res;
|
||||
for (const DesktopAppData& app : qAsConst(m_appList)) {
|
||||
for (const DesktopAppData& app : std::as_const(m_appList)) {
|
||||
if (app.categories.contains(category)) {
|
||||
res.append(app);
|
||||
}
|
||||
@@ -118,7 +115,7 @@ QMap<QString, QVector<DesktopAppData>> WinLnkFileParser::getAppsByCategory(
|
||||
QVector<DesktopAppData> tmpAppList;
|
||||
for (const QString& category : categories) {
|
||||
tmpAppList = getAppsByCategory(category);
|
||||
for (const DesktopAppData& app : qAsConst(tmpAppList)) {
|
||||
for (const DesktopAppData& app : std::as_const(tmpAppList)) {
|
||||
res[category].append(app);
|
||||
}
|
||||
}
|
||||
@@ -144,7 +141,7 @@ void WinLnkFileParser::getImageFileExtAssociates(const QStringList& sListImgExt)
|
||||
const QString sReg("HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\"
|
||||
"CurrentVersion\\Explorer\\FileExts\\.%1\\OpenWithList");
|
||||
|
||||
for (const auto& sExt : qAsConst(sListImgExt)) {
|
||||
for (const auto& sExt : std::as_const(sListImgExt)) {
|
||||
QString sPath(sReg.arg(sExt));
|
||||
QSettings registry(sPath, QSettings::NativeFormat);
|
||||
for (const auto& key : registry.allKeys()) {
|
||||
|
||||
@@ -25,7 +25,7 @@ struct WinLnkFileParser
|
||||
WinLnkFileParser();
|
||||
DesktopAppData parseLnkFile(const QFileInfo& fiLnk, bool& ok) const;
|
||||
int processDirectory(const QDir& dir);
|
||||
QString getAllUsersStartMenuPath();
|
||||
static QString getAllUsersStartMenuPath();
|
||||
|
||||
QVector<DesktopAppData> getAppsByCategory(const QString& category);
|
||||
QMap<QString, QVector<DesktopAppData>> getAppsByCategory(
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <QCheckBox>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
#include <QDesktopWidget>
|
||||
#include <QFontMetrics>
|
||||
#include <QLabel>
|
||||
#include <QMessageBox>
|
||||
@@ -206,6 +205,13 @@ CaptureWidget::CaptureWidget(const CaptureRequest& req,
|
||||
|
||||
// Init color picker
|
||||
m_colorPicker = new ColorPicker(this);
|
||||
// Init notification widget
|
||||
m_notifierBox = new NotifierBox(this);
|
||||
initPanel();
|
||||
|
||||
// TODO: Make it more clear why this has moved. In Qt6 some timing related
|
||||
// to constructors / connect signals has changed so if initPanel is called
|
||||
// after the connect a SEGFAULT occurs
|
||||
connect(m_colorPicker,
|
||||
&ColorPicker::colorSelected,
|
||||
this,
|
||||
@@ -221,8 +227,6 @@ CaptureWidget::CaptureWidget(const CaptureRequest& req,
|
||||
this,
|
||||
&CaptureWidget::onToolSizeChanged);
|
||||
|
||||
// Init notification widget
|
||||
m_notifierBox = new NotifierBox(this);
|
||||
m_notifierBox->hide();
|
||||
connect(m_notifierBox, &NotifierBox::hidden, this, [this]() {
|
||||
// Show cursor if it was hidden while adjusting tool size
|
||||
@@ -232,23 +236,24 @@ CaptureWidget::CaptureWidget(const CaptureRequest& req,
|
||||
onToolSizeSettled(m_context.toolSize);
|
||||
});
|
||||
|
||||
initPanel();
|
||||
|
||||
m_config.checkAndHandleError();
|
||||
if (m_config.hasError()) {
|
||||
m_configError = true;
|
||||
}
|
||||
connect(ConfigHandler::getInstance(), &ConfigHandler::error, this, [=]() {
|
||||
m_configError = true;
|
||||
m_configErrorResolved = false;
|
||||
OverlayMessage::instance()->update();
|
||||
});
|
||||
connect(
|
||||
ConfigHandler::getInstance(), &ConfigHandler::errorResolved, this, [=]() {
|
||||
m_configError = false;
|
||||
m_configErrorResolved = true;
|
||||
ConfigHandler::getInstance(), &ConfigHandler::error, this, [=, this]() {
|
||||
m_configError = true;
|
||||
m_configErrorResolved = false;
|
||||
OverlayMessage::instance()->update();
|
||||
});
|
||||
connect(ConfigHandler::getInstance(),
|
||||
&ConfigHandler::errorResolved,
|
||||
this,
|
||||
[=, this]() {
|
||||
m_configError = false;
|
||||
m_configErrorResolved = true;
|
||||
OverlayMessage::instance()->update();
|
||||
});
|
||||
|
||||
OverlayMessage::init(this,
|
||||
QGuiAppCurrentScreen().currentScreen()->geometry());
|
||||
@@ -331,7 +336,7 @@ void CaptureWidget::initButtons()
|
||||
if (!shortcut.isNull()) {
|
||||
auto shortcuts = newShortcut(shortcut, this, nullptr);
|
||||
for (auto* sc : shortcuts) {
|
||||
connect(sc, &QShortcut::activated, this, [=]() {
|
||||
connect(sc, &QShortcut::activated, this, [=, this]() {
|
||||
setState(b);
|
||||
});
|
||||
}
|
||||
@@ -419,7 +424,7 @@ void CaptureWidget::showxywh()
|
||||
void CaptureWidget::initHelpMessage()
|
||||
{
|
||||
QList<QPair<QString, QString>> keyMap;
|
||||
keyMap << QPair(tr("Mouse"), tr("Select screenshot area"));
|
||||
keyMap << std::pair(tr("Mouse"), tr("Select screenshot area"));
|
||||
using CT = CaptureTool;
|
||||
for (auto toolType : { CT::TYPE_ACCEPT, CT::TYPE_SAVE, CT::TYPE_COPY }) {
|
||||
if (!m_tools.contains(toolType)) {
|
||||
@@ -430,14 +435,14 @@ void CaptureWidget::initHelpMessage()
|
||||
ConfigHandler().shortcut(QVariant::fromValue(toolType).toString());
|
||||
shortcut.replace("Return", "Enter");
|
||||
if (!shortcut.isEmpty()) {
|
||||
keyMap << QPair(shortcut, tool->description());
|
||||
keyMap << std::pair(shortcut, tool->description());
|
||||
}
|
||||
}
|
||||
keyMap << QPair(tr("Mouse Wheel"), tr("Change tool size"));
|
||||
keyMap << QPair(tr("Right Click"), tr("Show color picker"));
|
||||
keyMap << QPair(ConfigHandler().shortcut("TYPE_TOGGLE_PANEL"),
|
||||
tr("Open side panel"));
|
||||
keyMap << QPair(tr("Esc"), tr("Exit"));
|
||||
keyMap << std::pair(tr("Mouse Wheel"), tr("Change tool size"));
|
||||
keyMap << std::pair(tr("Right Click"), tr("Show color picker"));
|
||||
keyMap << std::pair(ConfigHandler().shortcut("TYPE_TOGGLE_PANEL"),
|
||||
tr("Open side panel"));
|
||||
keyMap << std::pair(tr("Esc"), tr("Exit"));
|
||||
|
||||
m_helpMessage = OverlayMessage::compileFromKeyMap(keyMap);
|
||||
}
|
||||
@@ -1221,10 +1226,6 @@ void CaptureWidget::showAppUpdateNotification(const QString& appLatestVersion,
|
||||
}
|
||||
#if defined(Q_OS_MACOS)
|
||||
int ax = (width() - m_updateNotificationWidget->width()) / 2;
|
||||
#elif (defined(Q_OS_LINUX) && QT_VERSION < QT_VERSION_CHECK(5, 10, 0))
|
||||
QRect helpRect = QGuiApplication::primaryScreen()->geometry();
|
||||
int ax = helpRect.left() +
|
||||
((helpRect.width() - m_updateNotificationWidget->width()) / 2);
|
||||
#else
|
||||
QRect helpRect;
|
||||
QScreen* currentScreen = QGuiAppCurrentScreen().currentScreen();
|
||||
@@ -1279,7 +1280,7 @@ void CaptureWidget::initSelection()
|
||||
if (!initialSelection.isNull()) {
|
||||
const qreal scale = m_context.screenshot.devicePixelRatio();
|
||||
initialSelection.moveTopLeft(initialSelection.topLeft() -
|
||||
mapToGlobal({}));
|
||||
mapToGlobal(QPoint(0, 0)));
|
||||
initialSelection.setTop(initialSelection.top() / scale);
|
||||
initialSelection.setBottom(initialSelection.bottom() / scale);
|
||||
initialSelection.setLeft(initialSelection.left() / scale);
|
||||
|
||||
@@ -26,7 +26,7 @@ NotifierBox::NotifierBox(QWidget* parent)
|
||||
setFixedSize(QSize(size, size));
|
||||
}
|
||||
|
||||
void NotifierBox::enterEvent(QEvent*)
|
||||
void NotifierBox::enterEvent(QEnterEvent*)
|
||||
{
|
||||
hide();
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
explicit NotifierBox(QWidget* parent = nullptr);
|
||||
|
||||
protected:
|
||||
virtual void enterEvent(QEvent*) override;
|
||||
void enterEvent(QEnterEvent*) override;
|
||||
virtual void paintEvent(QPaintEvent*) override;
|
||||
|
||||
signals:
|
||||
|
||||
@@ -31,7 +31,7 @@ OverlayMessage::OverlayMessage(QWidget* parent, const QRect& targetArea)
|
||||
setStyleSheet(
|
||||
QStringLiteral("QLabel { color: %1; }").arg(m_textColor.name()));
|
||||
|
||||
setMargin(QApplication::fontMetrics().height() / 2);
|
||||
setMargin(QFontMetrics(qApp->font()).height() / 2);
|
||||
QWidget::hide();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ bool DraggableWidgetMaker::eventFilter(QObject* obj, QEvent* event)
|
||||
m_isDragging = false;
|
||||
if (mouseEvent->button() == Qt::LeftButton) {
|
||||
m_isPressing = true;
|
||||
m_mousePressPos = mouseEvent->globalPos();
|
||||
m_mousePressPos = mouseEvent->globalPosition();
|
||||
m_mouseMovePos = m_mousePressPos;
|
||||
}
|
||||
} break;
|
||||
@@ -34,15 +34,15 @@ bool DraggableWidgetMaker::eventFilter(QObject* obj, QEvent* event)
|
||||
auto* mouseEvent = static_cast<QMouseEvent*>(event);
|
||||
|
||||
if (m_isPressing) {
|
||||
QPoint widgetPos = widget->mapToGlobal(widget->pos());
|
||||
QPoint eventPos = mouseEvent->globalPos();
|
||||
QPoint diff = eventPos - m_mouseMovePos;
|
||||
QPoint newPos = widgetPos + diff;
|
||||
QPointF widgetPos = widget->mapToGlobal(widget->pos());
|
||||
QPointF eventPos = mouseEvent->globalPosition();
|
||||
QPointF diff = eventPos - m_mouseMovePos;
|
||||
QPointF newPos = widgetPos + diff;
|
||||
|
||||
widget->move(widget->mapFromGlobal(newPos));
|
||||
widget->move(widget->mapFromGlobal(newPos.toPoint()));
|
||||
|
||||
if (!m_isDragging) {
|
||||
QPoint totalMovedDiff = eventPos - m_mousePressPos;
|
||||
QPointF totalMovedDiff = eventPos - m_mousePressPos;
|
||||
if (totalMovedDiff.manhattanLength() > 3) {
|
||||
m_isDragging = true;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,6 @@ protected:
|
||||
private:
|
||||
bool m_isPressing = false;
|
||||
bool m_isDragging = false;
|
||||
QPoint m_mouseMovePos;
|
||||
QPoint m_mousePressPos;
|
||||
QPointF m_mouseMovePos;
|
||||
QPointF m_mousePressPos;
|
||||
};
|
||||
|
||||
@@ -23,12 +23,10 @@ InfoWindow::InfoWindow(QWidget* parent)
|
||||
connect(
|
||||
ui->CopyInfoButton, &QPushButton::clicked, this, &InfoWindow::copyInfo);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
QRect position = frameGeometry();
|
||||
QScreen* screen = QGuiAppCurrentScreen().currentScreen();
|
||||
position.moveCenter(screen->availableGeometry().center());
|
||||
move(position.topLeft());
|
||||
#endif
|
||||
|
||||
show();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ LoadSpinner::LoadSpinner(QWidget* parent)
|
||||
, m_growing(true)
|
||||
{
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
const int size = QApplication::fontMetrics().height() * 8;
|
||||
const int size = QFontMetrics(qApp->font()).height() * 8;
|
||||
setFixedSize(size, size);
|
||||
updateFrame();
|
||||
// init timer
|
||||
|
||||
@@ -107,8 +107,12 @@ SidePanelWidget::SidePanelWidget(QPixmap* p, QWidget* parent)
|
||||
this,
|
||||
&SidePanelWidget::onToolSizeChanged);
|
||||
// color hex editor sigslots
|
||||
connect(m_colorHex, &QLineEdit::editingFinished, this, [=]() {
|
||||
connect(m_colorHex, &QLineEdit::editingFinished, this, [=, this]() {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
|
||||
if (!QColor::isValidColor(m_colorHex->text())) {
|
||||
#else
|
||||
if (!QColor::isValidColorName(m_colorHex->text())) {
|
||||
#endif
|
||||
m_colorHex->setText(m_color.name(QColor::HexRgb));
|
||||
} else {
|
||||
emit colorChanged(m_colorHex->text());
|
||||
@@ -126,7 +130,7 @@ SidePanelWidget::SidePanelWidget(QPixmap* p, QWidget* parent)
|
||||
this,
|
||||
&SidePanelWidget::colorChanged);
|
||||
// Grid feature
|
||||
connect(m_gridCheck, &QCheckBox::clicked, this, [=](bool b) {
|
||||
connect(m_gridCheck, &QCheckBox::clicked, this, [=, this](bool b) {
|
||||
this->m_gridSizeSpin->setEnabled(b);
|
||||
emit this->displayGridChanged(b);
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@ TrayIcon::TrayIcon(QObject* parent)
|
||||
// https://bugreports.qt.io/browse/QTBUG-86393
|
||||
// https://developer.apple.com/forums/thread/126072
|
||||
auto currentMacOsVersion = QOperatingSystemVersion::current();
|
||||
if (currentMacOsVersion >= currentMacOsVersion.MacOSBigSur) {
|
||||
if (currentMacOsVersion >= QOperatingSystemVersion::MacOSBigSur) {
|
||||
setContextMenu(m_menu);
|
||||
}
|
||||
#else
|
||||
@@ -37,7 +37,7 @@ TrayIcon::TrayIcon(QObject* parent)
|
||||
setIcon(icon);
|
||||
|
||||
#if defined(Q_OS_MACOS)
|
||||
if (currentMacOsVersion < currentMacOsVersion.MacOSBigSur) {
|
||||
if (currentMacOsVersion < QOperatingSystemVersion::MacOSBigSur) {
|
||||
// Because of the following issues on MacOS "Catalina":
|
||||
// https://bugreports.qt.io/browse/QTBUG-86393
|
||||
// https://developer.apple.com/forums/thread/126072
|
||||
@@ -101,7 +101,7 @@ void TrayIcon::initMenu()
|
||||
connect(captureAction, &QAction::triggered, this, [this]() {
|
||||
#if defined(Q_OS_MACOS)
|
||||
auto currentMacOsVersion = QOperatingSystemVersion::current();
|
||||
if (currentMacOsVersion >= currentMacOsVersion.MacOSBigSur) {
|
||||
if (currentMacOsVersion >= QOperatingSystemVersion::MacOSBigSur) {
|
||||
startGuiCapture();
|
||||
} else {
|
||||
// It seems it is not relevant for MacOS BigSur (Wait 400 ms to hide
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "uploadlineitem.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QDesktopWidget>
|
||||
#include <QFileInfo>
|
||||
#include <QPixmap>
|
||||
|
||||
@@ -37,7 +36,6 @@ UploadHistory::UploadHistory(QWidget* parent)
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
resize(QDesktopWidget().availableGeometry(this).size() * 0.5);
|
||||
}
|
||||
|
||||
void UploadHistory::loadHistory()
|
||||
@@ -50,7 +48,7 @@ void UploadHistory::loadHistory()
|
||||
if (historyFiles.isEmpty()) {
|
||||
setEmptyMessage();
|
||||
} else {
|
||||
foreach (QString fileName, historyFiles) {
|
||||
for (const auto& fileName : historyFiles) {
|
||||
addLine(history.path(), fileName);
|
||||
}
|
||||
}
|
||||
@@ -61,7 +59,8 @@ void UploadHistory::setEmptyMessage()
|
||||
auto* buttonEmpty = new QPushButton;
|
||||
buttonEmpty->setText(tr("Screenshots history is empty"));
|
||||
buttonEmpty->setMinimumSize(1, HISTORYPIXMAP_MAX_PREVIEW_HEIGHT);
|
||||
connect(buttonEmpty, &QPushButton::clicked, this, [=]() { this->close(); });
|
||||
connect(
|
||||
buttonEmpty, &QPushButton::clicked, this, [=, this]() { this->close(); });
|
||||
ui->historyContainer->addWidget(buttonEmpty);
|
||||
}
|
||||
|
||||
@@ -87,7 +86,7 @@ void UploadHistory::addLine(const QString& path, const QString& fileName)
|
||||
auto* line = new UploadLineItem(
|
||||
this, pixmap, lastModified, url, fullFileName, unpackFileName);
|
||||
|
||||
connect(line, &UploadLineItem::requestedDeletion, this, [=]() {
|
||||
connect(line, &UploadLineItem::requestedDeletion, this, [=, this]() {
|
||||
if (ui->historyContainer->count() <= 1) {
|
||||
setEmptyMessage();
|
||||
}
|
||||
|
||||
@@ -34,15 +34,15 @@ UploadLineItem::UploadLineItem(QWidget* parent,
|
||||
ui->imagePreview->setPixmap(preview);
|
||||
ui->uploadTimestamp->setText(timestamp);
|
||||
|
||||
connect(ui->copyUrl, &QPushButton::clicked, this, [=]() {
|
||||
connect(ui->copyUrl, &QPushButton::clicked, this, [=, this]() {
|
||||
FlameshotDaemon::copyToClipboard(url);
|
||||
});
|
||||
|
||||
connect(ui->openBrowser, &QPushButton::clicked, this, [=]() {
|
||||
connect(ui->openBrowser, &QPushButton::clicked, this, [=, this]() {
|
||||
QDesktopServices::openUrl(QUrl(url));
|
||||
});
|
||||
|
||||
connect(ui->deleteImage, &QPushButton::clicked, this, [=]() {
|
||||
connect(ui->deleteImage, &QPushButton::clicked, this, [=, this]() {
|
||||
if (ConfigHandler().historyConfirmationToDelete() &&
|
||||
QMessageBox::No ==
|
||||
QMessageBox::question(
|
||||
|
||||
Reference in New Issue
Block a user