Compare commits
58 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6c9ef4a15 | ||
|
|
20e550bc7d | ||
|
|
a4b7766947 | ||
|
|
8d1a0071b6 | ||
|
|
a3c00e607b | ||
|
|
de7ca8b736 | ||
|
|
04e593dc62 | ||
|
|
2294c38aa9 | ||
|
|
6f41d39a9c | ||
|
|
7c4e33b676 | ||
|
|
4cc66bccad | ||
|
|
55b1d34f48 | ||
|
|
4da0e8d8ad | ||
|
|
b95bfba676 | ||
|
|
1ff2bfd390 | ||
|
|
a35fa5b158 | ||
|
|
22169bda0d | ||
|
|
faf5f6c69d | ||
|
|
1ae01d4078 | ||
|
|
eb6289dd1c | ||
|
|
671df6eafb | ||
|
|
579563b32c | ||
|
|
135b93a5af | ||
|
|
84c6e09c42 | ||
|
|
b4f9808d11 | ||
|
|
d96d4224a2 | ||
|
|
f65927e308 | ||
|
|
eeeea8566e | ||
|
|
54c42b276f | ||
|
|
8e4b4d6e41 | ||
|
|
ac9fd9070f | ||
|
|
6348649bc6 | ||
|
|
c95886d8db | ||
|
|
117b965a7b | ||
|
|
1b6b5f9afa | ||
|
|
83bc8d9e86 | ||
|
|
33f0421d3f | ||
|
|
661615e546 | ||
|
|
c52fc90306 | ||
|
|
eeb55fbc42 | ||
|
|
5d77eb1901 | ||
|
|
654a94fe3d | ||
|
|
4238708226 | ||
|
|
5f02072bf3 | ||
|
|
eec5b448b6 | ||
|
|
5cda756f92 | ||
|
|
e9588dd85b | ||
|
|
dda0e4aa06 | ||
|
|
2282406166 | ||
|
|
b3f0dee8e9 | ||
|
|
f9f7381247 | ||
|
|
48685325e6 | ||
|
|
e8bcaf415c | ||
|
|
c9197e8df7 | ||
|
|
2bb09cf575 | ||
|
|
7bf4ad3884 | ||
|
|
5154d7ac84 | ||
|
|
9299653722 |
287
.github/workflows/build.yml
vendored
287
.github/workflows/build.yml
vendored
@@ -5,6 +5,7 @@ jobs:
|
||||
|
||||
build-opensuse:
|
||||
name: Build openSUSE
|
||||
if: github.repository != 'strawberrymusicplayer/strawberry-private'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -60,6 +61,7 @@ jobs:
|
||||
libgpod-devel
|
||||
libmtp-devel
|
||||
libchromaprint-devel
|
||||
fftw3-devel
|
||||
libebur128-devel
|
||||
desktop-file-utils
|
||||
update-desktop-files
|
||||
@@ -99,10 +101,17 @@ jobs:
|
||||
- name: Install tagparser
|
||||
if: matrix.opensuse_version == 'tumbleweed'
|
||||
run: zypper -n --gpg-auto-import-keys in tagparser-devel
|
||||
- name: Install kdsingleapplication-devel
|
||||
if: matrix.opensuse_version == 'tumbleweed' && matrix.qt_version == '5'
|
||||
run: zypper -n --gpg-auto-import-keys in kdsingleapplication-devel
|
||||
- name: Install kdsingleapplication-qt6-devel
|
||||
if: matrix.opensuse_version == 'tumbleweed' && matrix.qt_version == '6'
|
||||
run: zypper -n --gpg-auto-import-keys in kdsingleapplication-qt6-devel
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- name: Add safe git directory
|
||||
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
- name: Create Build Environment
|
||||
@@ -132,47 +141,43 @@ jobs:
|
||||
run: echo "opensuse_subdir=$(echo ${{matrix.opensuse_version}} | sed 's/leap:/lp/g' | sed 's/\.//g')" > $GITHUB_ENV
|
||||
- name: Upload artifacts
|
||||
if: matrix.opensuse_version != 'tumbleweed'
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: opensuse-${{env.opensuse_subdir}}
|
||||
name: opensuse-${{env.opensuse_subdir}}-qt${{matrix.qt_version}}
|
||||
path: |
|
||||
/usr/src/packages/SOURCES/*.xz
|
||||
/usr/src/packages/SRPMS/*.rpm
|
||||
/usr/src/packages/RPMS/x86_64/*.rpm
|
||||
- name: SSH key setup
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
- name: Create server path
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/source ${{secrets.BUILDS_PATH}}/opensuse/${{env.opensuse_subdir}}
|
||||
- name: rsync source
|
||||
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci') && matrix.opensuse_version == 'tumbleweed' && matrix.qt_version == '6'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci') && matrix.opensuse_version == 'tumbleweed' && matrix.qt_version == '6'
|
||||
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var /usr/src/packages/SOURCES/*.xz ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/source/
|
||||
- name: rsync rpms
|
||||
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci') && matrix.opensuse_version != 'tumbleweed'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci') && matrix.opensuse_version != 'tumbleweed'
|
||||
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var /usr/src/packages/SRPMS/*.rpm /usr/src/packages/RPMS/x86_64/*.rpm ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/opensuse/${{env.opensuse_subdir}}/
|
||||
|
||||
|
||||
build-fedora:
|
||||
name: Build Fedora
|
||||
if: github.repository != 'strawberrymusicplayer/strawberry-private'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
fedora_version: [ '37', '38', '39' ]
|
||||
fedora_version: [ '38', '39', '40' ]
|
||||
container:
|
||||
image: fedora:${{matrix.fedora_version}}
|
||||
steps:
|
||||
- name: Update repositories
|
||||
run: dnf -y update
|
||||
- name: Fix dnf
|
||||
run: |
|
||||
if [ -f "/usr/bin/dnf5" ] && ! [ -f "/usr/bin/dnf" ]; then
|
||||
ln -s /usr/bin/dnf5 /usr/bin/dnf
|
||||
fi
|
||||
- name: Upgrade packages
|
||||
run: dnf -y upgrade
|
||||
- name: Install dependencies
|
||||
@@ -218,10 +223,12 @@ jobs:
|
||||
desktop-file-utils
|
||||
libappstream-glib
|
||||
hicolor-icon-theme
|
||||
kdsingleapplication-qt6-devel
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- name: Add safe git directory
|
||||
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
- name: Create Build Environment
|
||||
@@ -243,28 +250,29 @@ jobs:
|
||||
working-directory: build
|
||||
run: rpmbuild -ba ../dist/unix/strawberry.spec
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fedora-${{matrix.fedora_version}}
|
||||
path: |
|
||||
/github/home/rpmbuild/SRPMS/*.rpm
|
||||
/github/home/rpmbuild/RPMS/x86_64/*.rpm
|
||||
- name: SSH key setup
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
- name: Create server path
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/fedora/${{matrix.fedora_version}}
|
||||
- name: rsync
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var /github/home/rpmbuild/SRPMS/*.rpm /github/home/rpmbuild/RPMS/x86_64/*.rpm ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/fedora/${{matrix.fedora_version}}/
|
||||
|
||||
|
||||
build-openmandriva:
|
||||
name: Build OpenMandriva
|
||||
if: github.repository != 'strawberrymusicplayer/strawberry-private'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -273,13 +281,12 @@ jobs:
|
||||
container:
|
||||
image: openmandriva/${{matrix.openmandriva_version}}
|
||||
steps:
|
||||
- name: Update repositories
|
||||
run: dnf update -y
|
||||
- name: Upgrade packages
|
||||
run: dnf upgrade -y
|
||||
- name: Update distro
|
||||
run: dnf distro-sync --assumeyes
|
||||
- name: Install dependencies
|
||||
run: >
|
||||
dnf install -y
|
||||
which
|
||||
glibc
|
||||
gcc-c++
|
||||
git
|
||||
@@ -300,7 +307,7 @@ jobs:
|
||||
sqlite-devel
|
||||
libasound-devel
|
||||
pulseaudio-devel
|
||||
lib64GL-devel
|
||||
libGL-devel
|
||||
libgst-plugins-base1.0-devel
|
||||
taglib-devel
|
||||
chromaprint-devel
|
||||
@@ -325,10 +332,13 @@ jobs:
|
||||
appstream
|
||||
appstream-util
|
||||
hicolor-icon-theme
|
||||
- name: Remove files
|
||||
run: rm -rf /usr/lib64/qt6/lib/cmake/Qt6Sql/{Qt6QMYSQL*,Qt6QODBCD*,Qt6QPSQL*,Qt6QIBase*}
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- name: Add safe git directory
|
||||
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
- name: Create Build Environment
|
||||
@@ -350,33 +360,34 @@ jobs:
|
||||
working-directory: build
|
||||
run: rpmbuild -ba ../dist/unix/strawberry.spec
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: openmandriva-${{matrix.openmandriva_version}}
|
||||
path: |
|
||||
/github/home/rpmbuild/SRPMS/*.rpm
|
||||
/github/home/rpmbuild/RPMS/x86_64/*.rpm
|
||||
- name: SSH key setup
|
||||
if: matrix.openmandriva_version != 'cooker' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && matrix.openmandriva_version != 'cooker' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
- name: Create server path
|
||||
if: matrix.openmandriva_version != 'cooker' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && matrix.openmandriva_version != 'cooker' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/openmandriva/${{matrix.openmandriva_version}}
|
||||
- name: rsync
|
||||
if: matrix.openmandriva_version != 'cooker' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && matrix.openmandriva_version != 'cooker' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var /github/home/rpmbuild/SRPMS/*.rpm /github/home/rpmbuild/RPMS/x86_64/*.rpm ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/openmandriva/${{matrix.openmandriva_version}}/
|
||||
|
||||
|
||||
build-mageia:
|
||||
name: Build Mageia
|
||||
if: github.repository != 'strawberrymusicplayer/strawberry-private' && false
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
mageia_version: [ '8' ]
|
||||
mageia_version: [ '9' ]
|
||||
container:
|
||||
image: mageia:${{matrix.mageia_version}}
|
||||
steps:
|
||||
@@ -429,6 +440,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- name: Add safe git directory
|
||||
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
- name: Create Build Environment
|
||||
@@ -450,28 +462,29 @@ jobs:
|
||||
working-directory: build
|
||||
run: rpmbuild -ba ../dist/unix/strawberry.spec
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: mageia-${{matrix.mageia_version}}
|
||||
path: |
|
||||
/github/home/rpmbuild/SRPMS/*.rpm
|
||||
/github/home/rpmbuild/RPMS/x86_64/*.rpm
|
||||
- name: SSH key setup
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
- name: Create server path
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/mageia/${{matrix.mageia_version}}
|
||||
- name: rsync
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var /github/home/rpmbuild/SRPMS/*.rpm /github/home/rpmbuild/RPMS/x86_64/*.rpm ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/mageia/${{matrix.mageia_version}}/
|
||||
|
||||
|
||||
build-debian:
|
||||
name: Build Debian
|
||||
if: github.repository != 'strawberrymusicplayer/strawberry-private'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -535,6 +548,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- name: Add safe git directory
|
||||
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
- name: Create Build Environment
|
||||
@@ -546,26 +560,27 @@ jobs:
|
||||
- name: Copy deb
|
||||
run: cp ../*.deb .
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: debian-${{matrix.debian_version}}
|
||||
path: "*.deb"
|
||||
- name: SSH key setup
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
- name: Create server path
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/debian/${{matrix.debian_version}}
|
||||
- name: rsync
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var *.deb ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/debian/${{matrix.debian_version}}/
|
||||
|
||||
|
||||
build-ubuntu:
|
||||
name: Build Ubuntu
|
||||
if: github.repository != 'strawberrymusicplayer/strawberry-private'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -632,6 +647,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- name: Add safe git directory
|
||||
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
- name: Create Build Environment
|
||||
@@ -643,29 +659,29 @@ jobs:
|
||||
- name: Copy deb
|
||||
run: cp ../*.deb ../*.ddeb .
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ubuntu-${{matrix.ubuntu_version}}
|
||||
path: |
|
||||
*.deb
|
||||
*.ddeb
|
||||
- name: SSH key setup
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
- name: Create server path
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/ubuntu/${{matrix.ubuntu_version}}
|
||||
- name: rsync
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var *.deb *.ddeb ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/ubuntu/${{matrix.ubuntu_version}}/
|
||||
|
||||
|
||||
upload-ubuntu-ppa:
|
||||
name: Upload Ubuntu PPA
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -731,6 +747,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- name: Add safe git directory
|
||||
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
- name: Create Build Environment
|
||||
@@ -757,13 +774,14 @@ jobs:
|
||||
run: dput ppa:jonaski/strawberry ../*_source.changes
|
||||
|
||||
|
||||
build-macos:
|
||||
name: Build macOS
|
||||
build-macos-public:
|
||||
name: Build macOS Public
|
||||
if: github.repository != 'strawberrymusicplayer/strawberry-private'
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
runner: [ 'macos-11', 'macos-arm64' ]
|
||||
runner: [ 'macos-11' ]
|
||||
buildtype: [ 'release' ]
|
||||
|
||||
runs-on: ${{ matrix.runner }}
|
||||
@@ -781,7 +799,6 @@ jobs:
|
||||
run: echo "cmake_buildtype=$(echo ${{env.buildtype}} | awk '{print toupper(substr($0,0,1))tolower(substr($0,2))}')" >> $GITHUB_ENV
|
||||
|
||||
- name: Uninstall homebrew
|
||||
if: matrix.runner == 'macos-11'
|
||||
run: |
|
||||
curl -sfLO https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh
|
||||
chmod +x ./uninstall.sh
|
||||
@@ -792,18 +809,15 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Import certificate file
|
||||
if: matrix.runner == 'macos-11'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false
|
||||
uses: apple-actions/import-codesign-certs@v2
|
||||
with:
|
||||
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_ID_CERTIFICATE }}
|
||||
p12-password: ${{ secrets.APPLE_DEVELOPER_ID_CERTIFICATE_PASSWORD }}
|
||||
|
||||
- name: Unlock keychain
|
||||
if: matrix.runner == 'macos-arm64'
|
||||
run: security unlock-keychain -p ${{ secrets.APPLE_DEVELOPER_ID_CERTIFICATE_PASSWORD2 }}
|
||||
|
||||
- name: Download macOS dependencies
|
||||
run: curl -f -O -L https://github.com/strawberrymusicplayer/strawberry-macos-dependencies/releases/latest/download/strawberry-macos-${{env.arch}}-${{env.buildtype}}.tar.xz
|
||||
|
||||
@@ -819,6 +833,133 @@ jobs:
|
||||
- name: Create Build Environment
|
||||
run: cmake -E make_directory build
|
||||
|
||||
- name: Configure CMake
|
||||
env:
|
||||
MACOSX_DEPLOYMENT_TARGET: 11.0
|
||||
PKG_CONFIG_PATH: ${{env.prefix_path}}/lib/pkgconfig
|
||||
LDFLAGS: -L${{env.prefix_path}}/lib -Wl,-rpath,${{env.prefix_path}}/lib
|
||||
run: >
|
||||
cmake
|
||||
--log-level="DEBUG"
|
||||
-S .
|
||||
-B build
|
||||
-DCMAKE_BUILD_TYPE="${{env.cmake_buildtype}}"
|
||||
-DCMAKE_PREFIX_PATH="${{env.prefix_path}}/lib/cmake"
|
||||
-DBUILD_WITH_QT6=ON
|
||||
-DBUILD_WERROR=OFF
|
||||
-DUSE_BUNDLE=ON
|
||||
-DENABLE_DBUS=OFF
|
||||
-DICU_ROOT="${{env.prefix_path}}"
|
||||
-DFFTW3_DIR="${{env.prefix_path}}"
|
||||
-DAPPLE_DEVELOPER_ID=$(test '${{github.repository}}' = 'strawberrymusicplayer/strawberry' && test '${{github.event.pull_request.base.repo.full_name}}' = '${{github.event.pull_request.head.repo.full_name}}' && echo "383J84DVB6" || echo "")
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build --config Release --parallel 4
|
||||
|
||||
- name: Install
|
||||
working-directory: build
|
||||
run: make install
|
||||
|
||||
- name: Deploy
|
||||
env:
|
||||
GIO_EXTRA_MODULES: ${{env.prefix_path}}/lib/gio/modules
|
||||
GST_PLUGIN_SCANNER: ${{env.prefix_path}}/libexec/gstreamer-1.0/gst-plugin-scanner
|
||||
GST_PLUGIN_PATH: ${{env.prefix_path}}/lib/gstreamer-1.0
|
||||
LIBSOUP_LIBRARY_PATH: ${{env.prefix_path}}/lib/libsoup-3.0.0.dylib
|
||||
working-directory: build
|
||||
run: make deploy
|
||||
|
||||
- name: Codesign libsoup
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false
|
||||
working-directory: build
|
||||
run: codesign -s 383J84DVB6 -f strawberry.app/Contents/Frameworks/{libsoup-3.0.0.dylib,libnghttp2.14.dylib,libpsl.5.dylib,libpcre2-16.0.dylib,libpng16.16.dylib,libzstd.1.dylib} strawberry.app
|
||||
|
||||
- name: Deploy check
|
||||
working-directory: build
|
||||
run: make deploycheck
|
||||
|
||||
- name: Verify code-signing
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false
|
||||
working-directory: build
|
||||
run: codesign --deep -v strawberry.app
|
||||
|
||||
- name: Create DMG
|
||||
working-directory: build
|
||||
run: make dmg
|
||||
|
||||
- name: SSH key setup
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos')
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
|
||||
- name: Set is release
|
||||
run: echo "is_release=$(grep '^\s*set\s*(\s*INCLUDE_GIT_REVISION\s\+OFF\s*)\s*$' cmake/Version.cmake >/dev/null 2>&1 && echo 1 || echo 0)" >> $GITHUB_ENV
|
||||
|
||||
- name: Get release version
|
||||
run: echo "release_version=$(git describe --tags --exact-match ${GITHUB_SHA} 2>/dev/null | head -1)" >> $GITHUB_ENV
|
||||
|
||||
- name: Set Upload path
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos')
|
||||
run: |
|
||||
if [ "${{env.is_release}}" = "1" ] && ! [ "${{env.release_version}}" = "" ]; then
|
||||
echo "upload_path=${{secrets.DOWNLOADS_PATH}}/stable_releases/macos" >> $GITHUB_ENV
|
||||
else
|
||||
echo "upload_path=${{secrets.DOWNLOADS_PATH}}/development_releases/macos" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Create server path
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos')
|
||||
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{env.upload_path}}
|
||||
|
||||
- name: rsync
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos')
|
||||
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var build/*.dmg ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{env.upload_path}}/
|
||||
|
||||
|
||||
build-macos-private:
|
||||
name: Build macOS Private
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry-private'
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
runner: [ 'macos-arm64' ]
|
||||
buildtype: [ 'release' ]
|
||||
|
||||
runs-on: ${{ matrix.runner }}
|
||||
|
||||
steps:
|
||||
|
||||
- name: Set arch
|
||||
shell: bash
|
||||
run: echo "arch=$(uname -m)" >> $GITHUB_ENV
|
||||
|
||||
- name: Set buildtype
|
||||
run: echo "buildtype=$(echo ${{matrix.buildtype}} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
|
||||
|
||||
- name: Set cmake buildtype
|
||||
run: echo "cmake_buildtype=$(echo ${{env.buildtype}} | awk '{print toupper(substr($0,0,1))tolower(substr($0,2))}')" >> $GITHUB_ENV
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Unlock keychain
|
||||
run: security unlock-keychain -p ${{ secrets.MACOS_KEYCHAIN_PASSWORD }}
|
||||
|
||||
- name: Set prefix path
|
||||
run: echo "prefix_path=/opt/strawberry_macos_${{env.arch}}_${{env.buildtype}}" >> $GITHUB_ENV
|
||||
|
||||
- name: Update PATH
|
||||
run: echo "${{env.prefix_path}}/bin" >> $GITHUB_PATH
|
||||
|
||||
- name: Create Build Environment
|
||||
run: cmake -E make_directory build
|
||||
|
||||
- name: Configure CMake
|
||||
env:
|
||||
MACOSX_DEPLOYMENT_TARGET: 11.0
|
||||
@@ -855,11 +996,6 @@ jobs:
|
||||
working-directory: build
|
||||
run: make deploy
|
||||
|
||||
- name: Codesign libsoup
|
||||
if: matrix.runner == 'macos-11'
|
||||
working-directory: build
|
||||
run: codesign -s 383J84DVB6 -f strawberry.app/Contents/Frameworks/{libsoup-3.0.0.dylib,libnghttp2.14.dylib,libpsl.5.dylib,libpcre2-16.0.dylib,libpng16.16.dylib,libzstd.1.dylib} strawberry.app
|
||||
|
||||
- name: Deploy check
|
||||
working-directory: build
|
||||
run: make deploycheck
|
||||
@@ -872,38 +1008,27 @@ jobs:
|
||||
working-directory: build
|
||||
run: make dmg
|
||||
|
||||
- name: SSH key setup
|
||||
if: matrix.runner == 'macos-11' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos')
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
|
||||
- name: Set is release
|
||||
run: echo "is_release=$(grep '^\s*set\s*(\s*INCLUDE_GIT_REVISION\s\+OFF\s*)\s*$' cmake/Version.cmake >/dev/null 2>&1 && echo 1 || echo 0)" >> $GITHUB_ENV
|
||||
|
||||
- name: Get release version
|
||||
run: echo "release_version=$(git describe --tags --exact-match ${GITHUB_SHA} 2>/dev/null | head -1)" >> $GITHUB_ENV
|
||||
|
||||
- name: Set Upload path
|
||||
run: |
|
||||
if [ "${{env.is_release}}" = "1" ] && ! [ "${{env.release_version}}" = "" ]; then
|
||||
if [ "${{env.is_release}}" = "1" ]; then
|
||||
echo "upload_path=${{secrets.DOWNLOADS_PATH}}/stable_releases/macos" >> $GITHUB_ENV
|
||||
else
|
||||
echo "upload_path=${{secrets.DOWNLOADS_PATH}}/development_releases/macos" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Create server path
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos'
|
||||
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{env.upload_path}}
|
||||
|
||||
- name: rsync
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci' || github.ref == 'refs/heads/macos'
|
||||
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var build/*.dmg ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{env.upload_path}}/
|
||||
|
||||
|
||||
build-windows-mingw:
|
||||
name: Build Windows MinGW
|
||||
if: github.repository != 'strawberrymusicplayer/strawberry-private'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -922,6 +1047,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Add safe git directory
|
||||
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
||||
@@ -1065,29 +1191,30 @@ jobs:
|
||||
run: makensis strawberry.nsi
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows-mingw
|
||||
name: windows-mingw-${{matrix.arch}}-${{matrix.buildtype}}
|
||||
path: build/StrawberrySetup*.exe
|
||||
|
||||
- name: SSH key setup
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
uses: shimataro/ssh-key-action@v2
|
||||
with:
|
||||
known_hosts: ${{secrets.SSH_KNOWN_HOSTS}}
|
||||
key: ${{ secrets.SSH_KEY }}
|
||||
|
||||
- name: Create server path
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
run: ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} mkdir -p ${{secrets.BUILDS_PATH}}/windows/mingw
|
||||
|
||||
- name: rsync
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var build/StrawberrySetup*.exe ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/windows/mingw/
|
||||
|
||||
|
||||
build-windows-msvc:
|
||||
name: Build Windows MSVC
|
||||
if: github.repository != 'strawberrymusicplayer/strawberry-private'
|
||||
runs-on: windows-2022
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -1190,6 +1317,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Add safe git directory
|
||||
shell: bash
|
||||
@@ -1423,24 +1551,24 @@ jobs:
|
||||
run: makensis strawberry.nsi
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: windows-msvc
|
||||
name: windows-msvc-${{matrix.arch}}-${{matrix.buildtype}}
|
||||
path: build/StrawberrySetup*.exe
|
||||
|
||||
|
||||
rsync-windows-msvc-builds:
|
||||
name: Rsync Windows MSVC builds
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
needs:
|
||||
- build-windows-msvc
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: windows-msvc
|
||||
path: builds
|
||||
pattern: windows-msvc-*
|
||||
- name: View files
|
||||
run: find builds
|
||||
- name: SSH key setup
|
||||
@@ -1455,17 +1583,16 @@ jobs:
|
||||
- name: rsync
|
||||
shell: bash
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var builds/StrawberrySetup-*-msvc-*.exe ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/windows/msvc/
|
||||
run: rsync -e "ssh -p ${{secrets.SSH_PORT}} -o StrictHostKeyChecking=no" -var builds/*/StrawberrySetup-*-msvc-*.exe ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}}:${{secrets.BUILDS_PATH}}/windows/msvc/
|
||||
|
||||
|
||||
upload-release:
|
||||
name: Upload release
|
||||
if: github.repository == 'strawberrymusicplayer/strawberry' && github.event.pull_request.head.repo.fork == false && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci')
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/ci'
|
||||
needs:
|
||||
- build-opensuse
|
||||
- build-fedora
|
||||
- build-mageia
|
||||
- build-debian
|
||||
- build-ubuntu
|
||||
- build-windows-mingw
|
||||
@@ -1500,7 +1627,7 @@ jobs:
|
||||
|
||||
- name: Download artifacts
|
||||
if: env.release_version != ''
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
|
||||
|
||||
4
.gitmodules
vendored
Normal file
4
.gitmodules
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
[submodule "3rdparty/kdsingleapplication/KDSingleApplication"]
|
||||
path = 3rdparty/kdsingleapplication/KDSingleApplication
|
||||
url = https://github.com/KDAB/KDSingleApplication.git
|
||||
branch = master
|
||||
4
3rdparty/kdsingleapplication/CMakeLists.txt
vendored
4
3rdparty/kdsingleapplication/CMakeLists.txt
vendored
@@ -1,6 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
set(SOURCES kdsingleapplication.cpp kdsingleapplication_localsocket.cpp)
|
||||
set(HEADERS kdsingleapplication.h kdsingleapplication_localsocket_p.h)
|
||||
set(SOURCES KDSingleApplication/src/kdsingleapplication.cpp KDSingleApplication/src/kdsingleapplication_localsocket.cpp)
|
||||
set(HEADERS KDSingleApplication/src/kdsingleapplication.h KDSingleApplication/src/kdsingleapplication_localsocket_p.h)
|
||||
qt_wrap_cpp(MOC ${HEADERS})
|
||||
add_library(kdsingleapplication STATIC ${SOURCES} ${MOC})
|
||||
target_compile_definitions(kdsingleapplication PRIVATE -DKDSINGLEAPPLICATION_STATIC_BUILD)
|
||||
|
||||
1
3rdparty/kdsingleapplication/KDSingleApplication
vendored
Submodule
1
3rdparty/kdsingleapplication/KDSingleApplication
vendored
Submodule
Submodule 3rdparty/kdsingleapplication/KDSingleApplication added at cb0c664b40
6
3rdparty/kdsingleapplication/LICENSE
vendored
6
3rdparty/kdsingleapplication/LICENSE
vendored
@@ -1,6 +0,0 @@
|
||||
KDSingleApplication is (C) 2019-2023, Klarälvdalens Datakonsult AB,
|
||||
and is available under the terms of the MIT license.
|
||||
|
||||
See the full license text in the LICENSES folder.
|
||||
|
||||
Contact KDAB at <info@kdab.com> to inquire about commercial licensing.
|
||||
@@ -1,11 +0,0 @@
|
||||
Copyright (c) <year> <owner>.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,9 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) <year> <copyright holders>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
53
3rdparty/kdsingleapplication/README.md
vendored
53
3rdparty/kdsingleapplication/README.md
vendored
@@ -1,53 +0,0 @@
|
||||
# KDSingleApplication
|
||||
|
||||
`KDSingleApplication` is a helper class for single-instance policy applications
|
||||
written by [KDAB](https://www.kdab.com).
|
||||
|
||||
## Usage
|
||||
|
||||
Currently the documentation is woefully lacking, but see the examples or tests
|
||||
for inspiration. Basically it involves:
|
||||
|
||||
1. Create a `Q(Core|Gui)Application` object.
|
||||
2. Create a `KDSingleApplication` object.
|
||||
3. Check if the current instance is *primary* (or "master") or
|
||||
*secondary* (or "slave") by calling `isPrimaryInstance`:
|
||||
* the *primary* instance needs to listen from messages coming from the
|
||||
secondary instances, by connecting a slot to the `messageReceived` signal;
|
||||
* the *secondary* instances can send messages to the primary instance
|
||||
by calling `sendMessage`.
|
||||
|
||||
## Licensing
|
||||
|
||||
KDSingleApplication is (C) 2019-2023, Klarälvdalens Datakonsult AB, and is available
|
||||
under the terms of the [MIT license](LICENSES/MIT.txt).
|
||||
|
||||
Contact KDAB at <info@kdab.com> if you need different licensing options.
|
||||
|
||||
## Get Involved
|
||||
|
||||
KDAB will happily accept external contributions.
|
||||
|
||||
Please submit your contributions or issue reports from our GitHub space at
|
||||
<https://github.com/KDAB/KDSingleApplication>.
|
||||
|
||||
## About KDAB
|
||||
|
||||
KDSingleApplication is supported and maintained by Klarälvdalens Datakonsult AB (KDAB).
|
||||
|
||||
The KDAB Group is the global No.1 software consultancy for Qt, C++ and
|
||||
OpenGL applications across desktop, embedded and mobile platforms.
|
||||
|
||||
The KDAB Group provides consulting and mentoring for developing Qt applications
|
||||
from scratch and in porting from all popular and legacy frameworks to Qt.
|
||||
We continue to help develop parts of Qt and are one of the major contributors
|
||||
to the Qt Project. We can give advanced or standard trainings anywhere
|
||||
around the globe on Qt as well as C++, OpenGL, 3D and more.
|
||||
|
||||
Please visit <https://www.kdab.com> to meet the people who write code like this.
|
||||
|
||||
Stay up-to-date with KDAB product announcements:
|
||||
|
||||
* [KDAB Newsletter](https://news.kdab.com)
|
||||
* [KDAB Blogs](https://www.kdab.com/category/blogs)
|
||||
* [KDAB on Twitter](https://twitter.com/KDABQt)
|
||||
106
3rdparty/kdsingleapplication/kdsingleapplication.cpp
vendored
106
3rdparty/kdsingleapplication/kdsingleapplication.cpp
vendored
@@ -1,106 +0,0 @@
|
||||
/*
|
||||
This file is part of KDSingleApplication.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
*/
|
||||
|
||||
#include "kdsingleapplication.h"
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QFileInfo>
|
||||
|
||||
// TODO: make this pluggable.
|
||||
#include "kdsingleapplication_localsocket_p.h"
|
||||
|
||||
// Avoiding dragging in Qt private APIs for now, so this does not inherit
|
||||
// from QObjectPrivate.
|
||||
class KDSingleApplicationPrivate
|
||||
{
|
||||
public:
|
||||
explicit KDSingleApplicationPrivate(const QString &name, KDSingleApplication *q);
|
||||
|
||||
QString name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
bool isPrimaryInstance() const
|
||||
{
|
||||
return m_impl.isPrimaryInstance();
|
||||
}
|
||||
|
||||
bool sendMessage(const QByteArray &message, int timeout)
|
||||
{
|
||||
return m_impl.sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
private:
|
||||
Q_DECLARE_PUBLIC(KDSingleApplication)
|
||||
|
||||
KDSingleApplication *q_ptr;
|
||||
QString m_name;
|
||||
|
||||
KDSingleApplicationLocalSocket m_impl;
|
||||
};
|
||||
|
||||
KDSingleApplicationPrivate::KDSingleApplicationPrivate(const QString &name, KDSingleApplication *q)
|
||||
: q_ptr(q)
|
||||
, m_name(name)
|
||||
, m_impl(name)
|
||||
{
|
||||
if (Q_UNLIKELY(name.isEmpty()))
|
||||
qFatal("KDSingleApplication requires a non-empty application name");
|
||||
|
||||
if (isPrimaryInstance()) {
|
||||
QObject::connect(&m_impl, &KDSingleApplicationLocalSocket::messageReceived,
|
||||
q, &KDSingleApplication::messageReceived);
|
||||
}
|
||||
}
|
||||
|
||||
static QString extractExecutableName(const QString &applicationFilePath)
|
||||
{
|
||||
return QFileInfo(applicationFilePath).fileName();
|
||||
}
|
||||
|
||||
KDSingleApplication::KDSingleApplication(QObject *parent)
|
||||
: KDSingleApplication(extractExecutableName(QCoreApplication::applicationFilePath()), parent)
|
||||
{
|
||||
}
|
||||
|
||||
KDSingleApplication::KDSingleApplication(const QString &name, QObject *parent)
|
||||
: QObject(parent)
|
||||
, d_ptr(new KDSingleApplicationPrivate(name, this))
|
||||
{
|
||||
}
|
||||
|
||||
QString KDSingleApplication::name() const
|
||||
{
|
||||
Q_D(const KDSingleApplication);
|
||||
return d->name();
|
||||
}
|
||||
|
||||
bool KDSingleApplication::isPrimaryInstance() const
|
||||
{
|
||||
Q_D(const KDSingleApplication);
|
||||
return d->isPrimaryInstance();
|
||||
}
|
||||
|
||||
bool KDSingleApplication::sendMessage(const QByteArray &message)
|
||||
{
|
||||
return sendMessageWithTimeout(message, 5000);
|
||||
}
|
||||
|
||||
bool KDSingleApplication::sendMessageWithTimeout(const QByteArray &message, int timeout)
|
||||
{
|
||||
Q_ASSERT(!isPrimaryInstance());
|
||||
|
||||
Q_D(KDSingleApplication);
|
||||
return d->sendMessage(message, timeout);
|
||||
}
|
||||
|
||||
|
||||
KDSingleApplication::~KDSingleApplication() = default;
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
This file is part of KDSingleApplication.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
*/
|
||||
#ifndef KDSINGLEAPPLICATION_H
|
||||
#define KDSINGLEAPPLICATION_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "kdsingleapplication_lib.h"
|
||||
|
||||
class KDSingleApplicationPrivate;
|
||||
|
||||
class KDSINGLEAPPLICATION_EXPORT KDSingleApplication : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString name READ name CONSTANT)
|
||||
Q_PROPERTY(bool isPrimaryInstance READ isPrimaryInstance CONSTANT)
|
||||
|
||||
public:
|
||||
explicit KDSingleApplication(QObject *parent = nullptr);
|
||||
explicit KDSingleApplication(const QString &name, QObject *parent = nullptr);
|
||||
~KDSingleApplication();
|
||||
|
||||
QString name() const;
|
||||
bool isPrimaryInstance() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
// avoid default arguments and overloads, as they don't mix with connections
|
||||
bool sendMessage(const QByteArray &message);
|
||||
bool sendMessageWithTimeout(const QByteArray &message, int timeout);
|
||||
|
||||
Q_SIGNALS:
|
||||
void messageReceived(const QByteArray &message);
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(KDSingleApplication)
|
||||
std::unique_ptr<KDSingleApplicationPrivate> d_ptr;
|
||||
};
|
||||
|
||||
#endif // KDSINGLEAPPLICATION_H
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
This file is part of KDSingleApplication.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
*/
|
||||
#ifndef KDSINGLEAPPLICATION_LIB_H
|
||||
#define KDSINGLEAPPLICATION_LIB_H
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
#if defined(KDSINGLEAPPLICATION_STATIC_BUILD)
|
||||
#define KDSINGLEAPPLICATION_EXPORT
|
||||
#elif defined(KDSINGLEAPPLICATION_SHARED_BUILD)
|
||||
#define KDSINGLEAPPLICATION_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
#define KDSINGLEAPPLICATION_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif // KDSINGLEAPPLICATION_LIB_H
|
||||
@@ -1,324 +0,0 @@
|
||||
/*
|
||||
This file is part of KDSingleApplication.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
*/
|
||||
|
||||
#include "kdsingleapplication_localsocket_p.h"
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QDeadlineTimer>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QLockFile>
|
||||
#include <QtCore/QDataStream>
|
||||
|
||||
#include <QtCore/QtDebug>
|
||||
#include <QtCore/QLoggingCategory>
|
||||
|
||||
#include <QtNetwork/QLocalServer>
|
||||
#include <QtNetwork/QLocalSocket>
|
||||
|
||||
#include <chrono>
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
// for ::getuid()
|
||||
# include <sys/types.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
# include <qt_windows.h>
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
static constexpr auto LOCALSOCKET_CONNECTION_TIMEOUT = std::chrono::seconds(5);
|
||||
static constexpr char LOCALSOCKET_PROTOCOL_VERSION = 2;
|
||||
} // namespace
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmissing-declarations"
|
||||
#endif
|
||||
Q_LOGGING_CATEGORY(kdsaLocalSocket, "kdsingleapplication.localsocket", QtWarningMsg)
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
|
||||
#endif
|
||||
|
||||
KDSingleApplicationLocalSocket::KDSingleApplicationLocalSocket(const QString &name, QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
#if defined(Q_OS_UNIX)
|
||||
/* cppcheck-suppress useInitializationList */
|
||||
m_socketName = QStringLiteral("kdsingleapp-%1-%2")
|
||||
.arg(::getuid())
|
||||
.arg(name);
|
||||
#elif defined(Q_OS_WIN)
|
||||
// I'm not sure of a "global session identifier" on Windows; are
|
||||
// multiple logins from the same user a possibility? For now, following this:
|
||||
// https://docs.microsoft.com/en-us/windows/desktop/devnotes/getting-the-session-id-of-the-current-process
|
||||
|
||||
DWORD sessionId;
|
||||
BOOL haveSessionId = ProcessIdToSessionId(GetCurrentProcessId(), &sessionId);
|
||||
|
||||
m_socketName = QString::fromUtf8("kdsingleapp-%1-%2")
|
||||
.arg(haveSessionId ? sessionId : 0)
|
||||
.arg(name);
|
||||
#else
|
||||
#error "KDSingleApplication has not been ported to this platform"
|
||||
#endif
|
||||
|
||||
const QString lockFilePath =
|
||||
QDir::tempPath() + QLatin1Char('/') + m_socketName + QLatin1String(".lock");
|
||||
|
||||
qCDebug(kdsaLocalSocket) << "Socket name is" << m_socketName;
|
||||
qCDebug(kdsaLocalSocket) << "Lock file path is" << lockFilePath;
|
||||
|
||||
std::unique_ptr<QLockFile> lockFile(new QLockFile(lockFilePath));
|
||||
lockFile->setStaleLockTime(0);
|
||||
|
||||
if (!lockFile->tryLock()) {
|
||||
// someone else has the lock => we're secondary
|
||||
qCDebug(kdsaLocalSocket) << "Secondary instance";
|
||||
return;
|
||||
}
|
||||
|
||||
qCDebug(kdsaLocalSocket) << "Primary instance";
|
||||
|
||||
std::unique_ptr<QLocalServer> server = std::make_unique<QLocalServer>();
|
||||
if (!server->listen(m_socketName)) {
|
||||
// maybe the primary crashed, leaving a stale socket; delete it and try again
|
||||
QLocalServer::removeServer(m_socketName);
|
||||
if (!server->listen(m_socketName)) {
|
||||
// TODO: better error handling.
|
||||
qWarning("KDSingleApplication: unable to make the primary instance listen on %ls: %ls",
|
||||
qUtf16Printable(m_socketName),
|
||||
qUtf16Printable(server->errorString()));
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
connect(server.get(), &QLocalServer::newConnection,
|
||||
this, &KDSingleApplicationLocalSocket::handleNewConnection);
|
||||
|
||||
m_lockFile = std::move(lockFile);
|
||||
m_localServer = std::move(server);
|
||||
}
|
||||
|
||||
KDSingleApplicationLocalSocket::~KDSingleApplicationLocalSocket() = default;
|
||||
|
||||
bool KDSingleApplicationLocalSocket::isPrimaryInstance() const
|
||||
{
|
||||
return m_localServer != nullptr;
|
||||
}
|
||||
|
||||
bool KDSingleApplicationLocalSocket::sendMessage(const QByteArray &message, int timeout)
|
||||
{
|
||||
Q_ASSERT(!isPrimaryInstance());
|
||||
QLocalSocket socket;
|
||||
|
||||
qCDebug(kdsaLocalSocket) << "Preparing to send message" << message << "with timeout" << timeout;
|
||||
|
||||
QDeadlineTimer deadline(timeout);
|
||||
|
||||
// There is an inherent race here with the setup of the server side.
|
||||
// Even if the socket lock is held by the server, the server may not
|
||||
// be listening yet. So this connection may fail; keep retrying
|
||||
// until we hit the timeout.
|
||||
do {
|
||||
socket.connectToServer(m_socketName);
|
||||
if (socket.waitForConnected(static_cast<int>(deadline.remainingTime())))
|
||||
break;
|
||||
} while (!deadline.hasExpired());
|
||||
|
||||
qCDebug(kdsaLocalSocket) << "Socket state:" << socket.state() << "Timer remaining" << deadline.remainingTime() << "Expired?" << deadline.hasExpired();
|
||||
|
||||
if (deadline.hasExpired()) {
|
||||
qCWarning(kdsaLocalSocket) << "Connection timed out";
|
||||
return false;
|
||||
}
|
||||
|
||||
socket.write(&LOCALSOCKET_PROTOCOL_VERSION, 1);
|
||||
|
||||
{
|
||||
QByteArray encodedMessage;
|
||||
QDataStream ds(&encodedMessage, QIODevice::WriteOnly);
|
||||
ds << message;
|
||||
socket.write(encodedMessage);
|
||||
}
|
||||
|
||||
qCDebug(kdsaLocalSocket) << "Wrote message in the socket"
|
||||
<< "Timer remaining" << deadline.remainingTime() << "Expired?" << deadline.hasExpired();
|
||||
|
||||
// There is no acknowledgement mechanism here.
|
||||
// Should there be one?
|
||||
|
||||
while (socket.bytesToWrite() > 0) {
|
||||
if (!socket.waitForBytesWritten(static_cast<int>(deadline.remainingTime()))) {
|
||||
qCWarning(kdsaLocalSocket) << "Message to primary timed out";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
qCDebug(kdsaLocalSocket) << "Bytes written, now disconnecting"
|
||||
<< "Timer remaining" << deadline.remainingTime() << "Expired?" << deadline.hasExpired();
|
||||
|
||||
socket.disconnectFromServer();
|
||||
|
||||
if (socket.state() == QLocalSocket::UnconnectedState) {
|
||||
qCDebug(kdsaLocalSocket) << "Disconnected -- success!";
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!socket.waitForDisconnected(static_cast<int>(deadline.remainingTime()))) {
|
||||
qCWarning(kdsaLocalSocket) << "Disconnection from primary timed out";
|
||||
return false;
|
||||
}
|
||||
|
||||
qCDebug(kdsaLocalSocket) << "Disconnected -- success!";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void KDSingleApplicationLocalSocket::handleNewConnection()
|
||||
{
|
||||
Q_ASSERT(m_localServer);
|
||||
|
||||
QLocalSocket *socket = nullptr;
|
||||
while ((socket = m_localServer->nextPendingConnection())) {
|
||||
qCDebug(kdsaLocalSocket) << "Got new connection on" << m_socketName << "state" << socket->state();
|
||||
|
||||
Connection c(socket);
|
||||
socket = c.socket.get();
|
||||
|
||||
c.readDataConnection = QObjectConnectionHolder(
|
||||
connect(socket, &QLocalSocket::readyRead,
|
||||
this, &KDSingleApplicationLocalSocket::readDataFromSecondary));
|
||||
|
||||
c.secondaryDisconnectedConnection = QObjectConnectionHolder(
|
||||
connect(socket, &QLocalSocket::disconnected,
|
||||
this, &KDSingleApplicationLocalSocket::secondaryDisconnected));
|
||||
|
||||
c.abortConnection = QObjectConnectionHolder(
|
||||
connect(c.timeoutTimer.get(), &QTimer::timeout,
|
||||
this, &KDSingleApplicationLocalSocket::abortConnectionToSecondary));
|
||||
|
||||
m_clients.push_back(std::move(c));
|
||||
|
||||
// Note that by the time we get here, the socket could've already been closed,
|
||||
// and no signals emitted (hello, Windows!). Read what's already in the socket.
|
||||
if (readDataFromSecondarySocket(socket))
|
||||
return;
|
||||
|
||||
if (socket->state() == QLocalSocket::UnconnectedState)
|
||||
secondarySocketDisconnected(socket);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Container>
|
||||
static auto findConnectionBySocket(Container &container, QLocalSocket *socket)
|
||||
{
|
||||
auto i = std::find_if(container.begin(),
|
||||
container.end(),
|
||||
[socket](const auto &c) { return c.socket.get() == socket; });
|
||||
Q_ASSERT(i != container.end());
|
||||
return i;
|
||||
}
|
||||
|
||||
template<typename Container>
|
||||
static auto findConnectionByTimer(Container &container, QTimer *timer)
|
||||
{
|
||||
auto i = std::find_if(container.begin(),
|
||||
container.end(),
|
||||
[timer](const auto &c) { return c.timeoutTimer.get() == timer; });
|
||||
Q_ASSERT(i != container.end());
|
||||
return i;
|
||||
}
|
||||
|
||||
void KDSingleApplicationLocalSocket::readDataFromSecondary()
|
||||
{
|
||||
QLocalSocket *socket = static_cast<QLocalSocket *>(sender());
|
||||
readDataFromSecondarySocket(socket);
|
||||
}
|
||||
|
||||
bool KDSingleApplicationLocalSocket::readDataFromSecondarySocket(QLocalSocket *socket)
|
||||
{
|
||||
auto i = findConnectionBySocket(m_clients, socket);
|
||||
Connection &c = *i;
|
||||
c.readData.append(socket->readAll());
|
||||
|
||||
qCDebug(kdsaLocalSocket) << "Got more data from a secondary. Data read so far:" << c.readData;
|
||||
|
||||
const QByteArray &data = c.readData;
|
||||
|
||||
if (data.size() >= 1) {
|
||||
if (data[0] != LOCALSOCKET_PROTOCOL_VERSION) {
|
||||
qCDebug(kdsaLocalSocket) << "Got an invalid protocol version";
|
||||
m_clients.erase(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
QDataStream ds(data);
|
||||
ds.skipRawData(1);
|
||||
|
||||
ds.startTransaction();
|
||||
QByteArray message;
|
||||
ds >> message;
|
||||
|
||||
if (ds.commitTransaction()) {
|
||||
qCDebug(kdsaLocalSocket) << "Got a complete message:" << message;
|
||||
Q_EMIT messageReceived(message);
|
||||
m_clients.erase(i);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void KDSingleApplicationLocalSocket::secondaryDisconnected()
|
||||
{
|
||||
QLocalSocket *socket = static_cast<QLocalSocket *>(sender());
|
||||
secondarySocketDisconnected(socket);
|
||||
}
|
||||
|
||||
void KDSingleApplicationLocalSocket::secondarySocketDisconnected(QLocalSocket *socket)
|
||||
{
|
||||
auto i = findConnectionBySocket(m_clients, socket);
|
||||
Connection c = std::move(*i);
|
||||
m_clients.erase(i);
|
||||
|
||||
qCDebug(kdsaLocalSocket) << "Secondary disconnected. Data read:" << c.readData;
|
||||
}
|
||||
|
||||
void KDSingleApplicationLocalSocket::abortConnectionToSecondary()
|
||||
{
|
||||
QTimer *timer = static_cast<QTimer *>(sender());
|
||||
|
||||
auto i = findConnectionByTimer(m_clients, timer);
|
||||
Connection c = std::move(*i);
|
||||
m_clients.erase(i);
|
||||
|
||||
qCDebug(kdsaLocalSocket) << "Secondary timed out. Data read:" << c.readData;
|
||||
}
|
||||
|
||||
KDSingleApplicationLocalSocket::Connection::Connection(QLocalSocket *_socket)
|
||||
: socket(_socket)
|
||||
, timeoutTimer(new QTimer)
|
||||
{
|
||||
timeoutTimer->start(LOCALSOCKET_CONNECTION_TIMEOUT);
|
||||
}
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
@@ -1,126 +0,0 @@
|
||||
/*
|
||||
This file is part of KDSingleApplication.
|
||||
|
||||
SPDX-FileCopyrightText: 2019-2023 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
*/
|
||||
|
||||
#ifndef KDSINGLEAPPLICATION_LOCALSOCKET_P_H
|
||||
#define KDSINGLEAPPLICATION_LOCALSOCKET_P_H
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QString>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLockFile;
|
||||
class QLocalServer;
|
||||
class QLocalSocket;
|
||||
class QTimer;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
struct QObjectDeleteLater
|
||||
{
|
||||
void operator()(QObject *o)
|
||||
{
|
||||
o->deleteLater();
|
||||
}
|
||||
};
|
||||
|
||||
class QObjectConnectionHolder
|
||||
{
|
||||
Q_DISABLE_COPY(QObjectConnectionHolder)
|
||||
QMetaObject::Connection c;
|
||||
|
||||
public:
|
||||
QObjectConnectionHolder()
|
||||
{
|
||||
}
|
||||
|
||||
explicit QObjectConnectionHolder(QMetaObject::Connection _c)
|
||||
: c(std::move(_c))
|
||||
{
|
||||
}
|
||||
|
||||
~QObjectConnectionHolder()
|
||||
{
|
||||
QObject::disconnect(c);
|
||||
}
|
||||
|
||||
QObjectConnectionHolder(QObjectConnectionHolder &&other) noexcept
|
||||
: c(std::exchange(other.c, {}))
|
||||
{
|
||||
}
|
||||
|
||||
QObjectConnectionHolder &operator=(QObjectConnectionHolder &&other) noexcept
|
||||
{
|
||||
QObjectConnectionHolder moved(std::move(other));
|
||||
swap(moved);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void swap(QObjectConnectionHolder &other) noexcept
|
||||
{
|
||||
using std::swap;
|
||||
swap(c, other.c);
|
||||
}
|
||||
};
|
||||
|
||||
class KDSingleApplicationLocalSocket : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit KDSingleApplicationLocalSocket(const QString &name,
|
||||
QObject *parent = nullptr);
|
||||
~KDSingleApplicationLocalSocket();
|
||||
|
||||
bool isPrimaryInstance() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
bool sendMessage(const QByteArray &message, int timeout);
|
||||
|
||||
Q_SIGNALS:
|
||||
void messageReceived(const QByteArray &message);
|
||||
|
||||
private:
|
||||
void handleNewConnection();
|
||||
void readDataFromSecondary();
|
||||
bool readDataFromSecondarySocket(QLocalSocket *socket);
|
||||
void secondaryDisconnected();
|
||||
void secondarySocketDisconnected(QLocalSocket *socket);
|
||||
void abortConnectionToSecondary();
|
||||
|
||||
QString m_socketName;
|
||||
|
||||
std::unique_ptr<QLockFile> m_lockFile; // protects m_localServer
|
||||
std::unique_ptr<QLocalServer> m_localServer;
|
||||
|
||||
struct Connection
|
||||
{
|
||||
explicit Connection(QLocalSocket *s);
|
||||
|
||||
std::unique_ptr<QLocalSocket, QObjectDeleteLater> socket;
|
||||
std::unique_ptr<QTimer, QObjectDeleteLater> timeoutTimer;
|
||||
QByteArray readData;
|
||||
|
||||
// socket/timeoutTimer are deleted via deleteLater (as we delete them
|
||||
// in slots connected to their signals). Before the deleteLater is acted upon,
|
||||
// they may emit further signals, triggering logic that it's not supposed
|
||||
// to be triggered (as the Connection has already been destroyed).
|
||||
// Use this Holder to break the connections.
|
||||
QObjectConnectionHolder readDataConnection;
|
||||
QObjectConnectionHolder secondaryDisconnectedConnection;
|
||||
QObjectConnectionHolder abortConnection;
|
||||
};
|
||||
|
||||
std::vector<Connection> m_clients;
|
||||
};
|
||||
|
||||
#endif // KDSINGLEAPPLICATION_LOCALSOCKET_P_H
|
||||
@@ -102,12 +102,12 @@ endif()
|
||||
option(USE_ICU "Use ICU" ON)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(Boost REQUIRED)
|
||||
find_package(Threads)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(Backtrace)
|
||||
if(Backtrace_FOUND)
|
||||
set(HAVE_BACKTRACE ON)
|
||||
endif()
|
||||
find_package(Boost REQUIRED)
|
||||
if(USE_ICU)
|
||||
find_package(ICU COMPONENTS uc i18n REQUIRED)
|
||||
if(ICU_FOUND)
|
||||
@@ -301,18 +301,24 @@ endif()
|
||||
|
||||
# SingleApplication
|
||||
if(QT_VERSION_MAJOR EQUAL 5)
|
||||
set(KDSINGLEAPPLICATION_NAME "KDSingleApplication-qt")
|
||||
set(KDSINGLEAPPLICATION_NAME "KDSingleApplication")
|
||||
else()
|
||||
set(KDSINGLEAPPLICATION_NAME "KDSingleApplication-qt${QT_VERSION_MAJOR}")
|
||||
endif()
|
||||
find_package(${KDSINGLEAPPLICATION_NAME})
|
||||
find_package(${KDSINGLEAPPLICATION_NAME} 1.1.0)
|
||||
if(TARGET KDAB::kdsingleapplication)
|
||||
message(STATUS "Using system KDSingleApplication")
|
||||
if(QT_VERSION_MAJOR EQUAL 5)
|
||||
set(KDSINGLEAPPLICATION_VERSION "${KDSingleApplication_VERSION}")
|
||||
elseif(QT_VERSION_MAJOR EQUAL 6)
|
||||
set(KDSINGLEAPPLICATION_VERSION "${KDSingleApplication-qt6_VERSION}")
|
||||
endif()
|
||||
message(STATUS "Using system KDSingleApplication (Version ${KDSINGLEAPPLICATION_VERSION})")
|
||||
set(SINGLEAPPLICATION_LIBRARIES KDAB::kdsingleapplication)
|
||||
else()
|
||||
message(STATUS "Using 3rdparty KDSingleApplication")
|
||||
set(HAVE_KDSINGLEAPPLICATION_OPTIONS ON)
|
||||
add_subdirectory(3rdparty/kdsingleapplication)
|
||||
set(SINGLEAPPLICATION_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/kdsingleapplication)
|
||||
set(SINGLEAPPLICATION_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/kdsingleapplication/KDSingleApplication/src)
|
||||
set(SINGLEAPPLICATION_LIBRARIES kdsingleapplication)
|
||||
add_definitions(-DKDSINGLEAPPLICATION_STATIC_BUILD)
|
||||
endif()
|
||||
|
||||
29
Changelog
29
Changelog
@@ -2,6 +2,35 @@ Strawberry Music Player
|
||||
=======================
|
||||
ChangeLog
|
||||
|
||||
Version 1.0.23 (2024.01.11):
|
||||
|
||||
Bugfixes:
|
||||
* Fixed possible duplication of song entries after organizing (#1341).
|
||||
* Fixed possible crash when connecting devices (#1313).
|
||||
* Fixed playlist sorting of original year (#1349).
|
||||
* (macOS) Fixed crash when adding collection directory (QTBUG-120469) (#1350).
|
||||
|
||||
Enhancements:
|
||||
* Treat all stream errors as non-fatal (#1347).
|
||||
* Require KDSingleApplication 1.1.0.
|
||||
* Fix logging of restored unavailable songs.
|
||||
|
||||
Version 1.0.22 (2023.12.09):
|
||||
|
||||
Bugfixes:
|
||||
* Fixed KDSingleApplication cmake version check.
|
||||
* Fixed KDSingleApplication Qt 5 detection (#1299).
|
||||
* Fixed timer started in wrong thread (#1302).
|
||||
* Fixed erratic seeking behaviour if buffer duration is set to zero (#1302).
|
||||
* Fixed SCollection related crash on exit with Qt 5 (#1316).
|
||||
* Fixed track about to end related crash on playback failure (#1332).
|
||||
* Fixed playlist column widths not remembered if stretch mode is off with Qt 6.6.1 and higher (#1328).
|
||||
* (Windows) Properly handle silent uninstall (#1323).
|
||||
|
||||
Enhancements:
|
||||
* Increase thread priority for playback threads.
|
||||
* Allow drag and drop of songs to favorite playlists.
|
||||
|
||||
Version 1.0.21 (2023.10.21):
|
||||
|
||||
Bugfixes:
|
||||
|
||||
14
README.md
14
README.md
@@ -21,7 +21,7 @@ Resources:
|
||||
* Ubuntu Unstable PPA: https://launchpad.net/~jonaski/+archive/ubuntu/strawberry-unstable
|
||||
* Translations: https://translate.zanata.org/iteration/view/strawberry/master
|
||||
|
||||
### :bangbang: Opening an issue:
|
||||
### :bangbang: Opening an issue
|
||||
|
||||
* Read the FAQ: https://wiki.strawberrymusicplayer.org/wiki/FAQ
|
||||
* Search for the issue to see if it is already solved, or if there is an open issue for it already. If there is an open issue already, you can comment on it if you have additional information that could be useful to us.
|
||||
@@ -29,19 +29,19 @@ Resources:
|
||||
* We do not take feature requests from users on GitHub. Any issues related to feature requests will be closed. This does not necessarily mean that we won't add new features, but we don't have time to take feature requests or answer questions about new features from users. It is still possible to suggest or discuss new features on the forum (https://forum.strawberrymusicplayer.org/).
|
||||
* We do not maintain the Flatpak package. Do not report issues related to Flatpak unless the issue can be reproduced with a native package, use Flatpak support instead https://flatpak.org/about/
|
||||
|
||||
### :moneybag: Sponsoring:
|
||||
### :moneybag: Sponsoring
|
||||
|
||||
The program is free software, released under GPL. If you like this program and can make use of it, consider sponsoring or donating to help fund the project.
|
||||
There are currently 3 options for sponsoring:
|
||||
There are currently 4 options for sponsoring:
|
||||
|
||||
1. [GitHub Sponsors](https://github.com/sponsors/jonaski)
|
||||
1. [GitHub](https://github.com/sponsors/jonaski)
|
||||
2. [Patreon](https://www.patreon.com/jonaskvinge)
|
||||
3. [Ko-fi](https://ko-fi.com/jonaskvinge)
|
||||
4. [PayPal](https://paypal.me/jonaskvinge)
|
||||
|
||||
Funding developers is a way to contribute to open source projects you appreciate, it helps developers get the resources they need, and recognize contributors working behind the scenes to make open source better for everyone.
|
||||
|
||||
### :heavy_check_mark: Features:
|
||||
### :heavy_check_mark: Features
|
||||
|
||||
* Play and organize music
|
||||
* Supports WAV, FLAC, WavPack, Ogg FLAC, Ogg Vorbis, Ogg Opus, Ogg Speex, MPC, TrueAudio, AIFF, MP4, MP3, ASF and Monkey's Audio.
|
||||
@@ -65,7 +65,7 @@ Funding developers is a way to contribute to open source projects you appreciate
|
||||
|
||||
It has so far been tested to work on Linux, OpenBSD, FreeBSD, macOS and Windows.
|
||||
|
||||
**macOS releases are currently limited to sponsors. This is because macOS releases require a developer account, Apple hardware and maintaining all libraries strawberry depends on. If you are sponsoring strawberry, e-mail support@strawberrymusicplayer.org for access to downloads.**
|
||||
**macOS releases are currently limited to sponsors. This is because Strawberry mainly has one contributor/developer and supporting macOS requires Apple hardware, building libraries Strawberry depends and a Apple developer account for signing releases. If you are sponsoring strawberry through Patreon, releases are available directly on Patreon, if you are sponsoring through GitHub, Ko-fi or Paypal, please e-mail support@strawberrymusicplayer.org for access to downloads.**
|
||||
|
||||
### :heavy_exclamation_mark: Requirements
|
||||
|
||||
@@ -101,7 +101,7 @@ You should also install the gstreamer plugins base and good, and optionally bad,
|
||||
|
||||
### Get the code:
|
||||
|
||||
git clone https://github.com/strawberrymusicplayer/strawberry
|
||||
git clone --recursive https://github.com/strawberrymusicplayer/strawberry
|
||||
|
||||
### Compile and install:
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ macro(add_po outfiles po_prefix)
|
||||
# Convert the .po files to .qm files
|
||||
add_custom_command(
|
||||
OUTPUT ${_qm_filepath}
|
||||
COMMAND ${QT_LCONVERT_EXECUTABLE} ARGS ${_po_filepath} -o ${_qm_filepath} -of qm
|
||||
COMMAND ${QT_LCONVERT_EXECUTABLE} ARGS ${_po_filepath} -o ${_qm_filepath} -of qm -target-language ${_lang}
|
||||
DEPENDS ${_po_filepath} ${_po_filepath}
|
||||
)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
set(STRAWBERRY_VERSION_MAJOR 1)
|
||||
set(STRAWBERRY_VERSION_MINOR 0)
|
||||
set(STRAWBERRY_VERSION_PATCH 21)
|
||||
set(STRAWBERRY_VERSION_PATCH 23)
|
||||
#set(STRAWBERRY_VERSION_PRERELEASE rc1)
|
||||
|
||||
set(INCLUDE_GIT_REVISION OFF)
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
</screenshots>
|
||||
<update_contact>eclipseo@fedoraproject.org</update_contact>
|
||||
<releases>
|
||||
<release version="1.0.23" date="2024-01-11"/>
|
||||
<release version="1.0.22" date="2023-12-09"/>
|
||||
<release version="1.0.21" date="2023-10-21"/>
|
||||
<release version="1.0.20" date="2023-09-24"/>
|
||||
<release version="1.0.19" date="2023-09-24"/>
|
||||
|
||||
51
dist/windows/strawberry.nsi.in
vendored
51
dist/windows/strawberry.nsi.in
vendored
@@ -136,8 +136,6 @@ SetCompressor /SOLID lzma
|
||||
ReserveFile "${NSISDIR}\Plugins\x86-unicode\INetC.dll"
|
||||
!endif
|
||||
|
||||
!define LockedListPATH $InstallDir
|
||||
|
||||
; Installer pages
|
||||
!insertmacro MUI_PAGE_WELCOME
|
||||
!insertmacro MUI_PAGE_LICENSE COPYING
|
||||
@@ -184,19 +182,22 @@ FunctionEnd
|
||||
Function CheckPreviousInstall
|
||||
|
||||
ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} ${PRODUCT_UNINST_KEY} "UninstallString"
|
||||
StrCmp $R0 "" done
|
||||
StrCmp $R0 "" Done
|
||||
|
||||
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
|
||||
"${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the \
|
||||
previous version or `Cancel` to cancel this upgrade." \
|
||||
IDOK uninst
|
||||
${IfNot} ${Silent}
|
||||
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "${PRODUCT_NAME} is already installed. $\n$\nClick `OK` to remove the previous version or `Cancel` to cancel this upgrade." IDOK Uninstall
|
||||
Abort
|
||||
; Run the uninstaller
|
||||
uninst:
|
||||
ClearErrors
|
||||
ExecWait '$R0' ; Do not copy the uninstaller to a temp file
|
||||
${EndIf}
|
||||
|
||||
done:
|
||||
Uninstall:
|
||||
ClearErrors
|
||||
${If} ${Silent}
|
||||
ExecWait '$R0 /S'
|
||||
${Else}
|
||||
ExecWait '$R0'
|
||||
${EndIf}
|
||||
|
||||
Done:
|
||||
|
||||
FunctionEnd
|
||||
|
||||
@@ -344,6 +345,7 @@ Section "Strawberry" Strawberry
|
||||
File "libabsl_examine_stack.dll"
|
||||
File "libabsl_hash.dll"
|
||||
File "libabsl_int128.dll"
|
||||
File "libabsl_kernel_timeout_internal.dll"
|
||||
File "libabsl_log_globals.dll"
|
||||
File "libabsl_log_internal_check_op.dll"
|
||||
File "libabsl_log_internal_conditions.dll"
|
||||
@@ -407,7 +409,7 @@ Section "Strawberry" Strawberry
|
||||
File "brotlidec.dll"
|
||||
File "chromaprint.dll"
|
||||
File "ebur128.dll"
|
||||
File "faad.dll"
|
||||
File "faad-2.dll"
|
||||
File "fdk-aac.dll"
|
||||
File "ffi-7.dll"
|
||||
File "gio-2.0-0.dll"
|
||||
@@ -491,7 +493,7 @@ Section "Strawberry" Strawberry
|
||||
|
||||
; Common files
|
||||
|
||||
File "icudt73.dll"
|
||||
File "icudt74.dll"
|
||||
File "libfftw3-3.dll"
|
||||
!ifdef debug
|
||||
File "libprotobufd.dll"
|
||||
@@ -499,8 +501,8 @@ Section "Strawberry" Strawberry
|
||||
File "libprotobuf.dll"
|
||||
!endif
|
||||
!ifdef msvc && debug
|
||||
File "icuin73d.dll"
|
||||
File "icuuc73d.dll"
|
||||
File "icuin74d.dll"
|
||||
File "icuuc74d.dll"
|
||||
File "Qt6Concurrentd.dll"
|
||||
File "Qt6Cored.dll"
|
||||
File "Qt6Guid.dll"
|
||||
@@ -508,8 +510,8 @@ Section "Strawberry" Strawberry
|
||||
File "Qt6Sqld.dll"
|
||||
File "Qt6Widgetsd.dll"
|
||||
!else
|
||||
File "icuin73.dll"
|
||||
File "icuuc73.dll"
|
||||
File "icuin74.dll"
|
||||
File "icuuc74.dll"
|
||||
File "Qt6Concurrent.dll"
|
||||
File "Qt6Core.dll"
|
||||
File "Qt6Gui.dll"
|
||||
@@ -900,6 +902,7 @@ Section "Uninstall"
|
||||
Delete "$INSTDIR\libabsl_examine_stack.dll"
|
||||
Delete "$INSTDIR\libabsl_hash.dll"
|
||||
Delete "$INSTDIR\libabsl_int128.dll"
|
||||
Delete "$INSTDIR\libabsl_kernel_timeout_internal.dll"
|
||||
Delete "$INSTDIR\libabsl_log_globals.dll"
|
||||
Delete "$INSTDIR\libabsl_log_internal_check_op.dll"
|
||||
Delete "$INSTDIR\libabsl_log_internal_conditions.dll"
|
||||
@@ -963,7 +966,7 @@ Section "Uninstall"
|
||||
Delete "$INSTDIR\brotlidec.dll"
|
||||
Delete "$INSTDIR\chromaprint.dll"
|
||||
Delete "$INSTDIR\ebur128.dll"
|
||||
Delete "$INSTDIR\faad.dll"
|
||||
Delete "$INSTDIR\faad-2.dll"
|
||||
Delete "$INSTDIR\fdk-aac.dll"
|
||||
Delete "$INSTDIR\ffi-7.dll"
|
||||
Delete "$INSTDIR\gio-2.0-0.dll"
|
||||
@@ -1046,7 +1049,7 @@ Section "Uninstall"
|
||||
|
||||
; Common files
|
||||
|
||||
Delete "$INSTDIR\icudt73.dll"
|
||||
Delete "$INSTDIR\icudt74.dll"
|
||||
Delete "$INSTDIR\libfftw3-3.dll"
|
||||
!ifdef debug
|
||||
Delete "$INSTDIR\libprotobufd.dll"
|
||||
@@ -1054,8 +1057,8 @@ Section "Uninstall"
|
||||
Delete "$INSTDIR\libprotobuf.dll"
|
||||
!endif
|
||||
!ifdef msvc && debug
|
||||
Delete "$INSTDIR\icuin73d.dll"
|
||||
Delete "$INSTDIR\icuuc73d.dll"
|
||||
Delete "$INSTDIR\icuin74d.dll"
|
||||
Delete "$INSTDIR\icuuc74d.dll"
|
||||
Delete "$INSTDIR\Qt6Concurrentd.dll"
|
||||
Delete "$INSTDIR\Qt6Cored.dll"
|
||||
Delete "$INSTDIR\Qt6Guid.dll"
|
||||
@@ -1063,8 +1066,8 @@ Section "Uninstall"
|
||||
Delete "$INSTDIR\Qt6Sqld.dll"
|
||||
Delete "$INSTDIR\Qt6Widgetsd.dll"
|
||||
!else
|
||||
Delete "$INSTDIR\icuin73.dll"
|
||||
Delete "$INSTDIR\icuuc73.dll"
|
||||
Delete "$INSTDIR\icuin74.dll"
|
||||
Delete "$INSTDIR\icuuc74.dll"
|
||||
Delete "$INSTDIR\Qt6Concurrent.dll"
|
||||
Delete "$INSTDIR\Qt6Core.dll"
|
||||
Delete "$INSTDIR\Qt6Gui.dll"
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "scrobbler/lastfmimport.h"
|
||||
#include "settings/collectionsettingspage.h"
|
||||
|
||||
using std::make_unique;
|
||||
using std::make_shared;
|
||||
|
||||
const char *SCollection::kSongsTable = "songs";
|
||||
@@ -93,14 +92,14 @@ SCollection::~SCollection() {
|
||||
|
||||
void SCollection::Init() {
|
||||
|
||||
watcher_ = make_unique<CollectionWatcher>(Song::Source::Collection);
|
||||
watcher_ = new CollectionWatcher(Song::Source::Collection);
|
||||
watcher_thread_ = new Thread(this);
|
||||
|
||||
watcher_thread_->SetIoPriority(Utilities::IoPriority::IOPRIO_CLASS_IDLE);
|
||||
|
||||
watcher_->moveToThread(watcher_thread_);
|
||||
|
||||
qLog(Debug) << &*watcher_ << "moved to thread" << watcher_thread_;
|
||||
qLog(Debug) << watcher_ << "moved to thread" << watcher_thread_;
|
||||
|
||||
watcher_thread_->start(QThread::IdlePriority);
|
||||
|
||||
@@ -108,20 +107,20 @@ void SCollection::Init() {
|
||||
watcher_->set_task_manager(app_->task_manager());
|
||||
|
||||
QObject::connect(&*backend_, &CollectionBackend::Error, this, &SCollection::Error);
|
||||
QObject::connect(&*backend_, &CollectionBackend::DirectoryDiscovered, &*watcher_, &CollectionWatcher::AddDirectory);
|
||||
QObject::connect(&*backend_, &CollectionBackend::DirectoryDeleted, &*watcher_, &CollectionWatcher::RemoveDirectory);
|
||||
QObject::connect(&*backend_, &CollectionBackend::DirectoryDiscovered, watcher_, &CollectionWatcher::AddDirectory);
|
||||
QObject::connect(&*backend_, &CollectionBackend::DirectoryDeleted, watcher_, &CollectionWatcher::RemoveDirectory);
|
||||
QObject::connect(&*backend_, &CollectionBackend::SongsRatingChanged, this, &SCollection::SongsRatingChanged);
|
||||
QObject::connect(&*backend_, &CollectionBackend::SongsStatisticsChanged, this, &SCollection::SongsPlaycountChanged);
|
||||
|
||||
QObject::connect(&*watcher_, &CollectionWatcher::NewOrUpdatedSongs, &*backend_, &CollectionBackend::AddOrUpdateSongs);
|
||||
QObject::connect(&*watcher_, &CollectionWatcher::SongsMTimeUpdated, &*backend_, &CollectionBackend::UpdateMTimesOnly);
|
||||
QObject::connect(&*watcher_, &CollectionWatcher::SongsDeleted, &*backend_, &CollectionBackend::DeleteSongs);
|
||||
QObject::connect(&*watcher_, &CollectionWatcher::SongsUnavailable, &*backend_, &CollectionBackend::MarkSongsUnavailable);
|
||||
QObject::connect(&*watcher_, &CollectionWatcher::SongsReadded, &*backend_, &CollectionBackend::MarkSongsUnavailable);
|
||||
QObject::connect(&*watcher_, &CollectionWatcher::SubdirsDiscovered, &*backend_, &CollectionBackend::AddOrUpdateSubdirs);
|
||||
QObject::connect(&*watcher_, &CollectionWatcher::SubdirsMTimeUpdated, &*backend_, &CollectionBackend::AddOrUpdateSubdirs);
|
||||
QObject::connect(&*watcher_, &CollectionWatcher::CompilationsNeedUpdating, &*backend_, &CollectionBackend::CompilationsNeedUpdating);
|
||||
QObject::connect(&*watcher_, &CollectionWatcher::UpdateLastSeen, &*backend_, &CollectionBackend::UpdateLastSeen);
|
||||
QObject::connect(watcher_, &CollectionWatcher::NewOrUpdatedSongs, &*backend_, &CollectionBackend::AddOrUpdateSongs);
|
||||
QObject::connect(watcher_, &CollectionWatcher::SongsMTimeUpdated, &*backend_, &CollectionBackend::UpdateMTimesOnly);
|
||||
QObject::connect(watcher_, &CollectionWatcher::SongsDeleted, &*backend_, &CollectionBackend::DeleteSongs);
|
||||
QObject::connect(watcher_, &CollectionWatcher::SongsUnavailable, &*backend_, &CollectionBackend::MarkSongsUnavailable);
|
||||
QObject::connect(watcher_, &CollectionWatcher::SongsReadded, &*backend_, &CollectionBackend::MarkSongsUnavailable);
|
||||
QObject::connect(watcher_, &CollectionWatcher::SubdirsDiscovered, &*backend_, &CollectionBackend::AddOrUpdateSubdirs);
|
||||
QObject::connect(watcher_, &CollectionWatcher::SubdirsMTimeUpdated, &*backend_, &CollectionBackend::AddOrUpdateSubdirs);
|
||||
QObject::connect(watcher_, &CollectionWatcher::CompilationsNeedUpdating, &*backend_, &CollectionBackend::CompilationsNeedUpdating);
|
||||
QObject::connect(watcher_, &CollectionWatcher::UpdateLastSeen, &*backend_, &CollectionBackend::UpdateLastSeen);
|
||||
|
||||
QObject::connect(&*app_->lastfm_import(), &LastFMImport::UpdateLastPlayed, &*backend_, &CollectionBackend::UpdateLastPlayed);
|
||||
QObject::connect(&*app_->lastfm_import(), &LastFMImport::UpdatePlayCount, &*backend_, &CollectionBackend::UpdatePlayCount);
|
||||
@@ -133,13 +132,13 @@ void SCollection::Init() {
|
||||
|
||||
void SCollection::Exit() {
|
||||
|
||||
wait_for_exit_ << &*backend_ << &*watcher_;
|
||||
wait_for_exit_ << &*backend_ << watcher_;
|
||||
|
||||
QObject::disconnect(&*backend_, nullptr, &*watcher_, nullptr);
|
||||
QObject::disconnect(&*watcher_, nullptr, &*backend_, nullptr);
|
||||
QObject::disconnect(&*backend_, nullptr, watcher_, nullptr);
|
||||
QObject::disconnect(watcher_, nullptr, &*backend_, nullptr);
|
||||
|
||||
QObject::connect(&*backend_, &CollectionBackend::ExitFinished, this, &SCollection::ExitReceived);
|
||||
QObject::connect(&*watcher_, &CollectionWatcher::ExitFinished, this, &SCollection::ExitReceived);
|
||||
QObject::connect(watcher_, &CollectionWatcher::ExitFinished, this, &SCollection::ExitReceived);
|
||||
backend_->ExitAsync();
|
||||
watcher_->Abort();
|
||||
watcher_->ExitAsync();
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <QHash>
|
||||
#include <QString>
|
||||
|
||||
#include "core/scoped_ptr.h"
|
||||
#include "core/shared_ptr.h"
|
||||
#include "core/song.h"
|
||||
|
||||
@@ -91,7 +90,7 @@ class SCollection : public QObject {
|
||||
SharedPtr<CollectionBackend> backend_;
|
||||
CollectionModel *model_;
|
||||
|
||||
ScopedPtr<CollectionWatcher> watcher_;
|
||||
CollectionWatcher *watcher_;
|
||||
Thread *watcher_thread_;
|
||||
QThread *original_thread_;
|
||||
|
||||
|
||||
@@ -907,14 +907,14 @@ void CollectionBackend::MarkSongsUnavailable(const SongList &songs, const bool u
|
||||
QMutexLocker l(db_->Mutex());
|
||||
QSqlDatabase db(db_->Connect());
|
||||
|
||||
SqlQuery remove(db);
|
||||
remove.prepare(QString("UPDATE %1 SET unavailable = %2 WHERE ROWID = :id").arg(songs_table_).arg(static_cast<int>(unavailable)));
|
||||
SqlQuery query(db);
|
||||
query.prepare(QString("UPDATE %1 SET unavailable = %2 WHERE ROWID = :id").arg(songs_table_).arg(static_cast<int>(unavailable)));
|
||||
|
||||
ScopedTransaction transaction(&db);
|
||||
for (const Song &song : songs) {
|
||||
remove.BindValue(":id", song.id());
|
||||
if (!remove.Exec()) {
|
||||
db_->ReportErrors(remove);
|
||||
query.BindValue(":id", song.id());
|
||||
if (!query.Exec()) {
|
||||
db_->ReportErrors(query);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -627,6 +627,7 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const CollectionSu
|
||||
|
||||
// Nothing has changed - mark the song available without re-scanning
|
||||
else if (matching_song.unavailable()) {
|
||||
qLog(Debug) << "Unavailable song" << file << "restored.";
|
||||
t->readded_songs << matching_songs;
|
||||
}
|
||||
|
||||
@@ -886,7 +887,7 @@ void CollectionWatcher::AddChangedSong(const QString &file, const Song &matching
|
||||
QStringList changes;
|
||||
|
||||
if (matching_song.unavailable()) {
|
||||
qLog(Debug) << "unavailable song" << file << "restored.";
|
||||
qLog(Debug) << "Unavailable song" << file << "restored.";
|
||||
notify_new = true;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -88,6 +88,7 @@ void RegisterMetaTypes() {
|
||||
qRegisterMetaType<QVector<int>>("QVector<int>");
|
||||
qRegisterMetaType<QList<QUrl>>("QList<QUrl>");
|
||||
qRegisterMetaType<QFileInfo>("QFileInfo");
|
||||
qRegisterMetaType<QAbstractSocket::SocketState>("QAbstractSocket::SocketState");
|
||||
qRegisterMetaType<QNetworkReply*>("QNetworkReply*");
|
||||
qRegisterMetaType<QNetworkReply**>("QNetworkReply**");
|
||||
qRegisterMetaType<QItemSelection>("QItemSelection");
|
||||
@@ -110,6 +111,7 @@ void RegisterMetaTypes() {
|
||||
#ifdef HAVE_GSTREAMER
|
||||
qRegisterMetaType<GstBuffer*>("GstBuffer*");
|
||||
qRegisterMetaType<GstElement*>("GstElement*");
|
||||
qRegisterMetaType<GstState>("GstState");
|
||||
qRegisterMetaType<GstEnginePipeline*>("GstEnginePipeline*");
|
||||
#endif
|
||||
qRegisterMetaType<CollectionDirectory>("CollectionDirectory");
|
||||
|
||||
@@ -867,6 +867,9 @@ void Player::TrackAboutToEnd() {
|
||||
if (engine_->is_autocrossfade_enabled()) {
|
||||
// Crossfade is on, so just start playing the next track. The current one will fade out, and the new one will fade in
|
||||
|
||||
// If the decoding failed, current_item_ will be null
|
||||
if (!current_item_) return;
|
||||
|
||||
// But, if there's no next track, and we don't want to fade out, then do nothing and just let the track finish to completion.
|
||||
if (!engine_->is_fadeout_enabled() && !has_next_row) return;
|
||||
|
||||
|
||||
@@ -32,10 +32,9 @@ class PoTranslator : public QTranslator {
|
||||
public:
|
||||
PoTranslator(QObject *parent = nullptr) : QTranslator(parent) {}
|
||||
QString translate(const char *context, const char *source_text, const char *disambiguation = nullptr, int n = -1) const override {
|
||||
Q_UNUSED(n);
|
||||
QString ret = QTranslator::translate(context, source_text, disambiguation);
|
||||
QString ret = QTranslator::translate(context, source_text, disambiguation, n);
|
||||
if (!ret.isEmpty()) return ret;
|
||||
return QTranslator::translate(nullptr, source_text, disambiguation);
|
||||
return QTranslator::translate(nullptr, source_text, disambiguation, n);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -952,7 +952,7 @@ QString Song::TextForFiletype(const FileType filetype) {
|
||||
case FileType::OggVorbis: return "Ogg Vorbis";
|
||||
case FileType::OggOpus: return "Ogg Opus";
|
||||
case FileType::OggSpeex: return "Ogg Speex";
|
||||
case FileType::MPEG: return "MP3";
|
||||
case FileType::MPEG: return "MPEG";
|
||||
case FileType::MP4: return "MP4 AAC";
|
||||
case FileType::ASF: return "Windows Media audio";
|
||||
case FileType::AIFF: return "AIFF";
|
||||
@@ -1095,6 +1095,7 @@ Song::FileType Song::FiletypeByDescription(const QString &text) {
|
||||
else if (text.compare("Vorbis", Qt::CaseInsensitive) == 0) return FileType::OggVorbis;
|
||||
else if (text.compare("Opus", Qt::CaseInsensitive) == 0) return FileType::OggOpus;
|
||||
else if (text.compare("Speex", Qt::CaseInsensitive) == 0) return FileType::OggSpeex;
|
||||
else if (text.compare("MPEG-1 Layer 2 (MP2)", Qt::CaseInsensitive) == 0) return FileType::MPEG;
|
||||
else if (text.compare("MPEG-1 Layer 3 (MP3)", Qt::CaseInsensitive) == 0) return FileType::MPEG;
|
||||
else if (text.compare("MPEG-4 AAC", Qt::CaseInsensitive) == 0) return FileType::MP4;
|
||||
else if (text.compare("WMA", Qt::CaseInsensitive) == 0) return FileType::ASF;
|
||||
@@ -1120,6 +1121,7 @@ Song::FileType Song::FiletypeByExtension(const QString &ext) {
|
||||
else if (ext.compare("ogg", Qt::CaseInsensitive) == 0 || ext.compare("oga", Qt::CaseInsensitive) == 0) return FileType::OggVorbis;
|
||||
else if (ext.compare("opus", Qt::CaseInsensitive) == 0) return FileType::OggOpus;
|
||||
else if (ext.compare("speex", Qt::CaseInsensitive) == 0 || ext.compare("spx", Qt::CaseInsensitive) == 0) return FileType::OggSpeex;
|
||||
else if (ext.compare("mp2", Qt::CaseInsensitive) == 0) return FileType::MPEG;
|
||||
else if (ext.compare("mp3", Qt::CaseInsensitive) == 0) return FileType::MPEG;
|
||||
else if (ext.compare("mp4", Qt::CaseInsensitive) == 0 || ext.compare("m4a", Qt::CaseInsensitive) == 0 || ext.compare("aac", Qt::CaseInsensitive) == 0) return FileType::MP4;
|
||||
else if (ext.compare("asf", Qt::CaseInsensitive) == 0 || ext.compare("wma", Qt::CaseInsensitive) == 0) return FileType::ASF;
|
||||
|
||||
@@ -830,7 +830,7 @@ void DeviceManager::DeviceTaskStarted(const int id) {
|
||||
|
||||
for (int i = 0; i < devices_.count(); ++i) {
|
||||
DeviceInfo *info = devices_[i];
|
||||
if (&*info->device_ == device) {
|
||||
if (info->device_ && &*info->device_ == device) {
|
||||
QModelIndex index = ItemToIndex(info);
|
||||
if (!index.isValid()) continue;
|
||||
active_tasks_[id] = index;
|
||||
|
||||
@@ -569,7 +569,7 @@ void GstEngine::HandlePipelineError(const int pipeline_id, const int domain, con
|
||||
error_code == static_cast<int>(GST_RESOURCE_ERROR_OPEN_READ) ||
|
||||
error_code == static_cast<int>(GST_RESOURCE_ERROR_NOT_AUTHORIZED)
|
||||
))
|
||||
|| (domain == static_cast<int>(GST_STREAM_ERROR) && error_code == static_cast<int>(GST_STREAM_ERROR_TYPE_NOT_FOUND))
|
||||
|| (domain == static_cast<int>(GST_STREAM_ERROR))
|
||||
) {
|
||||
emit InvalidSongRequested(stream_url_);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
@@ -30,7 +32,13 @@
|
||||
#include <gst/gst.h>
|
||||
#include <gst/audio/audio.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#ifdef Q_OS_UNIX
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
#ifdef Q_OS_WIN32
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <QObject>
|
||||
#include <QCoreApplication>
|
||||
#include <QtConcurrent>
|
||||
@@ -650,11 +658,18 @@ bool GstEnginePipeline::InitAudioBin(QString &error) {
|
||||
// We set this on this queue instead of the playbin because setting it on the playbin only affects network sources.
|
||||
// Disable the default buffer and byte limits, so we only buffer based on time.
|
||||
|
||||
qLog(Debug) << "Setting buffer duration:" << buffer_duration_nanosec_ << "low watermark:" << buffer_low_watermark_ << "high watermark:" << buffer_high_watermark_;
|
||||
g_object_set(G_OBJECT(audioqueue_), "use-buffering", true, nullptr);
|
||||
g_object_set(G_OBJECT(audioqueue_), "max-size-buffers", 0, nullptr);
|
||||
g_object_set(G_OBJECT(audioqueue_), "max-size-bytes", 0, nullptr);
|
||||
g_object_set(G_OBJECT(audioqueue_), "max-size-time", buffer_duration_nanosec_, nullptr);
|
||||
|
||||
if (buffer_duration_nanosec_ > 0) {
|
||||
qLog(Debug) << "Setting buffer duration:" << buffer_duration_nanosec_ << "low watermark:" << buffer_low_watermark_ << "high watermark:" << buffer_high_watermark_;
|
||||
g_object_set(G_OBJECT(audioqueue_), "max-size-buffers", 0, nullptr);
|
||||
g_object_set(G_OBJECT(audioqueue_), "max-size-bytes", 0, nullptr);
|
||||
g_object_set(G_OBJECT(audioqueue_), "max-size-time", buffer_duration_nanosec_, nullptr);
|
||||
}
|
||||
else {
|
||||
qLog(Debug) << "Setting low watermark:" << buffer_low_watermark_ << "high watermark:" << buffer_high_watermark_;
|
||||
}
|
||||
|
||||
g_object_set(G_OBJECT(audioqueue_), "low-watermark", buffer_low_watermark_, nullptr);
|
||||
g_object_set(G_OBJECT(audioqueue_), "high-watermark", buffer_high_watermark_, nullptr);
|
||||
|
||||
@@ -1281,16 +1296,17 @@ void GstEnginePipeline::TaskEnterCallback(GstTask *task, GThread *thread, gpoint
|
||||
Q_UNUSED(thread)
|
||||
Q_UNUSED(self)
|
||||
|
||||
// Bump the priority of the thread only on macOS
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
sched_param param;
|
||||
#ifdef Q_OS_UNIX
|
||||
sched_param param{};
|
||||
memset(¶m, 0, sizeof(param));
|
||||
|
||||
param.sched_priority = 99;
|
||||
param.sched_priority = 40;
|
||||
pthread_setschedparam(pthread_self(), SCHED_RR, ¶m);
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WIN32
|
||||
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void GstEnginePipeline::ElementMessageReceived(GstMessage *msg) {
|
||||
@@ -1552,7 +1568,9 @@ QFuture<GstStateChangeReturn> GstEnginePipeline::SetState(const GstState state)
|
||||
|
||||
void GstEnginePipeline::SetStateDelayed(const GstState state) {
|
||||
|
||||
QTimer::singleShot(300, this, [this, state]() { SetState(state); });
|
||||
QMetaObject::invokeMethod(this, [this, state]() {
|
||||
QTimer::singleShot(300, this, [this, state]() { SetState(state); });
|
||||
}, Qt::QueuedConnection);
|
||||
|
||||
}
|
||||
|
||||
@@ -1591,7 +1609,9 @@ void GstEnginePipeline::SeekQueued(const qint64 nanosec) {
|
||||
|
||||
void GstEnginePipeline::SeekDelayed(const qint64 nanosec) {
|
||||
|
||||
QTimer::singleShot(100, this, [this, nanosec]() { SeekQueued(nanosec); });
|
||||
QMetaObject::invokeMethod(this, [this, nanosec]() {
|
||||
QTimer::singleShot(100, this, [this, nanosec]() { Seek(nanosec); });
|
||||
}, Qt::QueuedConnection);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ int main(int argc, char *argv[]) {
|
||||
// Only start a core application now, so we can check if there's another instance without requiring an X server.
|
||||
// This MUST be done before parsing the commandline options so QTextCodec gets the right system locale for filenames.
|
||||
QCoreApplication core_app(argc, argv);
|
||||
KDSingleApplication single_app(QCoreApplication::applicationName());
|
||||
KDSingleApplication single_app(QCoreApplication::applicationName(), KDSingleApplication::Option::IncludeUsernameInSocketName);
|
||||
// Parse commandline options - need to do this before starting the full QApplication, so it works without an X server
|
||||
if (!options.Parse()) return 1;
|
||||
logging::SetLevels(options.log_levels());
|
||||
@@ -193,7 +193,7 @@ int main(int argc, char *argv[]) {
|
||||
QGuiApplication::setQuitOnLastWindowClosed(false);
|
||||
|
||||
QApplication a(argc, argv);
|
||||
KDSingleApplication single_app(QCoreApplication::applicationName());
|
||||
KDSingleApplication single_app(QCoreApplication::applicationName(), KDSingleApplication::Option::IncludeUsernameInSocketName);
|
||||
if (!single_app.isPrimaryInstance()) {
|
||||
if (options.is_empty()) {
|
||||
qLog(Info) << "Strawberry is already running - activating existing window (2)";
|
||||
|
||||
@@ -251,7 +251,7 @@ void Organize::ProcessSomeFiles() {
|
||||
job.progress_ = std::bind(&Organize::SetSongProgress, this, std::placeholders::_1, !task.transcoded_filename_.isEmpty());
|
||||
|
||||
if (destination_->CopyToStorage(job)) {
|
||||
if (job.remove_original_ && (destination_->source() == Song::Source::Collection || destination_->source() == Song::Source::Device)) {
|
||||
if (job.remove_original_ && song.is_collection_song() && destination_->source() == Song::Source::Collection) {
|
||||
// Notify other aspects of system that song has been invalidated
|
||||
QString root = destination_->LocalPath();
|
||||
QFileInfo new_file = QFileInfo(root + "/" + task.song_info_.new_filename_);
|
||||
|
||||
@@ -1303,7 +1303,7 @@ bool Playlist::CompareItems(const int column, const Qt::SortOrder order, Playlis
|
||||
case Column_Track: cmp(track);
|
||||
case Column_Disc: cmp(disc);
|
||||
case Column_Year: cmp(year);
|
||||
case Column_OriginalYear: cmp(originalyear);
|
||||
case Column_OriginalYear: cmp(effective_originalyear);
|
||||
case Column_Genre: strcmp(genre);
|
||||
case Column_AlbumArtist: strcmp(playlist_albumartist_sortable);
|
||||
case Column_Composer: strcmp(composer);
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <QToolButton>
|
||||
#include <QShowEvent>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMimeData>
|
||||
|
||||
#include "core/application.h"
|
||||
#include "core/iconloader.h"
|
||||
@@ -110,6 +111,7 @@ PlaylistListContainer::PlaylistListContainer(QWidget *parent)
|
||||
|
||||
QObject::connect(ui_->tree, &PlaylistListView::ItemsSelectedChanged, this, &PlaylistListContainer::ItemsSelectedChanged);
|
||||
QObject::connect(ui_->tree, &PlaylistListView::doubleClicked, this, &PlaylistListContainer::ItemDoubleClicked);
|
||||
QObject::connect(ui_->tree, &PlaylistListView::ItemMimeDataDroppedSignal, this, &PlaylistListContainer::ItemMimeDataDropped);
|
||||
|
||||
model_->invisibleRootItem()->setData(PlaylistListModel::Type_Folder, PlaylistListModel::Role_Type);
|
||||
|
||||
@@ -348,6 +350,19 @@ void PlaylistListContainer::ItemDoubleClicked(const QModelIndex &proxy_idx) {
|
||||
|
||||
}
|
||||
|
||||
void PlaylistListContainer::ItemMimeDataDropped(const QModelIndex &proxy_idx, const QMimeData *q_mimedata) {
|
||||
|
||||
const QModelIndex idx = proxy_->mapToSource(proxy_idx);
|
||||
if (!idx.isValid()) return;
|
||||
|
||||
// Drop playlist rows if type is playlist and it's not active, to prevent selfcopy
|
||||
int playlis_id = idx.data(PlaylistListModel::Role_PlaylistId).toInt();
|
||||
if (idx.data(PlaylistListModel::Role_Type).toInt() == PlaylistListModel::Type_Playlist && playlis_id != app_->playlist_manager()->active_id()) {
|
||||
app_->playlist_manager()->playlist(playlis_id)->dropMimeData(q_mimedata, Qt::CopyAction, -1, 0, QModelIndex());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PlaylistListContainer::CopyToDevice() {
|
||||
|
||||
#ifndef Q_OS_WIN
|
||||
|
||||
@@ -63,6 +63,7 @@ class PlaylistListContainer : public QWidget {
|
||||
// From the UI
|
||||
void NewFolderClicked();
|
||||
void ItemDoubleClicked(const QModelIndex &proxy_idx);
|
||||
void ItemMimeDataDropped(const QModelIndex &proxy_idx, const QMimeData *q_mimedata);
|
||||
|
||||
// From the model
|
||||
void PlaylistPathChanged(const int id, const QString &new_path);
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include <QFont>
|
||||
#include <QMimeData>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QRect>
|
||||
@@ -30,6 +31,7 @@
|
||||
|
||||
#include "widgets/autoexpandingtreeview.h"
|
||||
#include "playlistlistview.h"
|
||||
#include "playlist.h"
|
||||
|
||||
PlaylistListView::PlaylistListView(QWidget *parent) : AutoExpandingTreeView(parent) {}
|
||||
|
||||
@@ -64,3 +66,72 @@ bool PlaylistListView::ItemsSelected() const {
|
||||
void PlaylistListView::selectionChanged(const QItemSelection&, const QItemSelection&) {
|
||||
emit ItemsSelectedChanged(selectionModel()->selectedRows().count() > 0);
|
||||
}
|
||||
|
||||
void PlaylistListView::dragEnterEvent(QDragEnterEvent *e) {
|
||||
|
||||
if (e->mimeData()->hasFormat(Playlist::kRowsMimetype)) {
|
||||
e->acceptProposedAction();
|
||||
}
|
||||
else {
|
||||
AutoExpandingTreeView::dragEnterEvent(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PlaylistListView::dragMoveEvent(QDragMoveEvent *e) {
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QModelIndex drag_hover_tab_ = indexAt(e->position().toPoint());
|
||||
#else
|
||||
QModelIndex drag_hover_tab_ = indexAt(e->pos());
|
||||
#endif
|
||||
|
||||
if (e->mimeData()->hasFormat(Playlist::kRowsMimetype)) {
|
||||
if (drag_hover_tab_ != currentIndex()) {
|
||||
e->setDropAction(Qt::CopyAction);
|
||||
e->accept(visualRect(drag_hover_tab_));
|
||||
setCurrentIndex(drag_hover_tab_);
|
||||
if (drag_hover_timer_.isActive()) {
|
||||
drag_hover_timer_.stop();
|
||||
}
|
||||
drag_hover_timer_.start(kDragHoverTimeout, this);
|
||||
}
|
||||
}
|
||||
else {
|
||||
AutoExpandingTreeView::dragMoveEvent(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PlaylistListView::dragLeaveEvent(QDragLeaveEvent *e) {
|
||||
|
||||
if (drag_hover_timer_.isActive()) {
|
||||
drag_hover_timer_.stop();
|
||||
}
|
||||
AutoExpandingTreeView::dragLeaveEvent(e);
|
||||
|
||||
}
|
||||
|
||||
void PlaylistListView::timerEvent(QTimerEvent *e) {
|
||||
|
||||
QTreeView::timerEvent(e);
|
||||
if (e->timerId() == drag_hover_timer_.timerId()) {
|
||||
drag_hover_timer_.stop();
|
||||
emit doubleClicked(currentIndex());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PlaylistListView::dropEvent(QDropEvent *e) {
|
||||
|
||||
if (e->mimeData()->hasFormat(Playlist::kRowsMimetype)) {
|
||||
if (drag_hover_timer_.isActive()) {
|
||||
drag_hover_timer_.stop();
|
||||
}
|
||||
emit ItemMimeDataDroppedSignal(currentIndex(), e->mimeData());
|
||||
}
|
||||
else {
|
||||
AutoExpandingTreeView::dropEvent(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QBasicTimer>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
@@ -31,6 +32,11 @@
|
||||
#include "widgets/autoexpandingtreeview.h"
|
||||
|
||||
class QPaintEvent;
|
||||
class QDragEnterEvent;
|
||||
class QDragLeaveEvent;
|
||||
class QDragMoveEvent;
|
||||
class QDropEvent;
|
||||
class QTimerEvent;
|
||||
|
||||
class PlaylistListView : public AutoExpandingTreeView {
|
||||
Q_OBJECT
|
||||
@@ -42,11 +48,23 @@ class PlaylistListView : public AutoExpandingTreeView {
|
||||
|
||||
signals:
|
||||
void ItemsSelectedChanged(const bool);
|
||||
void ItemMimeDataDroppedSignal(const QModelIndex &proxy_idx, const QMimeData *q_mimedata);
|
||||
|
||||
protected:
|
||||
// QWidget
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void selectionChanged(const QItemSelection&, const QItemSelection&) override;
|
||||
|
||||
void dragEnterEvent(QDragEnterEvent *e) override;
|
||||
void dragMoveEvent(QDragMoveEvent *e) override;
|
||||
void dragLeaveEvent(QDragLeaveEvent *e) override;
|
||||
void dropEvent(QDropEvent *e) override;
|
||||
void timerEvent(QTimerEvent *e) override;
|
||||
|
||||
private:
|
||||
static const int kDragHoverTimeout = 500;
|
||||
|
||||
QBasicTimer drag_hover_timer_;
|
||||
};
|
||||
|
||||
#endif // PLAYLISTVIEW_H
|
||||
|
||||
@@ -449,8 +449,7 @@ void PlaylistManager::UpdateSummaryText() {
|
||||
nanoseconds = current()->GetTotalLength();
|
||||
}
|
||||
|
||||
// TODO: Make the plurals translatable
|
||||
summary += tracks == 1 ? tr("1 track") : tr("%1 tracks").arg(tracks);
|
||||
summary += tr("%n track(s)", "", tracks);
|
||||
|
||||
if (nanoseconds > 0) {
|
||||
summary += " - [ " + Utilities::WordyTimeNanosec(nanoseconds) + " ]";
|
||||
|
||||
@@ -249,7 +249,7 @@ void Queue::UpdateSummaryText() {
|
||||
int tracks = ItemCount();
|
||||
quint64 nanoseconds = GetTotalLength();
|
||||
|
||||
summary += tracks == 1 ? tr("1 track") : tr("%1 tracks").arg(tracks);
|
||||
summary += tr("%n track(s)", "", tracks);
|
||||
|
||||
if (nanoseconds > 0) {
|
||||
summary += " - [ " + Utilities::WordyTimeNanosec(nanoseconds) + " ]";
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -46,6 +46,7 @@ StretchHeaderView::StretchHeaderView(const Qt::Orientation orientation, QWidget
|
||||
QObject::connect(this, &StretchHeaderView::sectionResized, this, &StretchHeaderView::SectionResized);
|
||||
setMinimumSectionSize(kMinimumColumnWidth);
|
||||
setTextElideMode(Qt::ElideRight);
|
||||
setDefaultSectionSize(100);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user