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