Compare commits

...

296 Commits

Author SHA1 Message Date
Jonas Kvinge
b6c9ef4a15 Release 1.0.23 2024-01-11 20:44:55 +01:00
Jonas Kvinge
20e550bc7d Update Changelog 2024-01-11 17:40:09 +01:00
Jonas Kvinge
a4b7766947 DeviceManager: Add nullptr check for connected device
Possible fix for #1313
2024-01-11 17:03:00 +01:00
Jonas Kvinge
8d1a0071b6 Playlist: Use effective original year for sorting
Fixes #1349
2024-01-11 16:40:12 +01:00
Jonas Kvinge
a3c00e607b README: Update sponsoring info 2024-01-09 18:08:40 +01:00
Jonas Kvinge
de7ca8b736 CI: Enable OpenMandriva 2024-01-04 03:05:44 +01:00
Jonas Kvinge
04e593dc62 CollectionWatcher: Add unavailable song restored logging 2024-01-03 00:45:30 +01:00
Jonas Kvinge
2294c38aa9 CollectionBackend: Rename SqlQuery variable 2024-01-03 00:44:54 +01:00
Jonas Kvinge
6f41d39a9c CI: Remove Mageia from upload release 2024-01-02 23:47:15 +01:00
Jonas Kvinge
7c4e33b676 GstEngine: Treat all stream errors as non-fatal
Fixes #1347
2024-01-02 19:54:19 +01:00
Jonas Kvinge
4cc66bccad CI: Disable Mageia and OpenMandriva
OpenMandriva Cooker has package conflict issues. Mageia 8 is end of life and there is no docker image for Mageia 9 yet.
2024-01-02 19:49:10 +01:00
Jonas Kvinge
55b1d34f48 CI: Use unique artifact names 2024-01-01 06:56:53 +01:00
dependabot[bot]
4da0e8d8ad Bump actions/download-artifact from 3 to 4
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-01 04:48:34 +01:00
dependabot[bot]
b95bfba676 Bump actions/upload-artifact from 3 to 4
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-01 04:48:19 +01:00
Jonas Kvinge
1ff2bfd390 Organize: Only update song path for collection songs
Possible fix for #1341
2023-12-28 23:30:07 +01:00
Jonas Kvinge
a35fa5b158 Require KDSingleApplication 1.1.0 2023-12-26 23:30:25 +01:00
Strawbs Bot
22169bda0d Update translations 2023-12-13 23:59:26 +01:00
Jonas Kvinge
faf5f6c69d CI: Remove Fedora 37 and add 40 2023-12-09 23:51:07 +01:00
Jonas Kvinge
1ae01d4078 Turn on git revision 2023-12-09 23:50:14 +01:00
Jonas Kvinge
eb6289dd1c Release 1.0.22 2023-12-09 23:21:35 +01:00
Jonas Kvinge
671df6eafb Update Changelog 2023-12-09 23:17:19 +01:00
Jonas Kvinge
579563b32c README: Fix emojis 2023-12-09 21:02:18 +01:00
Jonas Kvinge
135b93a5af StretchHeaderView: Set default section size
As of Qt 6.6.1, style changes are resetting the column sizes. To prevent this, we set a default section size.

Fixes #1328
2023-12-09 01:47:37 +01:00
BetterCallMolly
84c6e09c42 Player: Fix crossfade crash when decoding fails
When the decoding of a track fails, `current_item_` is set to an invalid address, if the Crossfade option is enabled, the `Player::TrackAboutToEnd` method does not check whether `current_item_` is a valid pointer or not, causing a segmentation fault.

Player: Removed extra space
2023-12-03 22:07:09 +01:00
Strawbs Bot
b4f9808d11 Update translations 2023-12-02 04:30:54 +01:00
Jonas Kvinge
d96d4224a2 Collection: Use normal pointer for watcher
Fixes #1316
2023-11-29 22:26:40 +01:00
Jonas Kvinge
f65927e308 metatypes: Register QAbstractSocket::SocketState 2023-11-29 22:25:03 +01:00
Jonas Kvinge
eeeea8566e nsi: Handle silent uninstall
Fixes #1323
2023-11-26 21:35:48 +01:00
Jonas Kvinge
54c42b276f GstEnginePipeline: Increase thread priority 2023-11-26 13:12:03 +01:00
Jonas Kvinge
8e4b4d6e41 nsi: Fix faad dll filename 2023-11-15 16:42:02 +01:00
Jonas Kvinge
ac9fd9070f GstEnginePipeline: Only set max size buffer if > 0
Fixes #1302
2023-11-12 22:04:31 +01:00
Jonas Kvinge
6348649bc6 GstEnginePipeline: Run QTimer::singleShot in main thread
Partial fix for #1302
2023-11-12 21:57:59 +01:00
Strawbs Bot
c95886d8db Update translations 2023-11-05 22:10:17 +01:00
Michał Walenciak
117b965a7b Translate number of tracks with nice plural forms 2023-11-05 19:37:56 +01:00
Michał Walenciak
1b6b5f9afa Use plurals 2023-11-05 19:37:56 +01:00
Michał Walenciak
83bc8d9e86 Select target language 2023-11-05 19:37:56 +01:00
Michał Walenciak
33f0421d3f Use 'n' for proper plurar form 2023-11-05 19:37:56 +01:00
Sergei B
661615e546 Allow drag and drop of songs to favorite playlists
- allows adding songs from active playlist
to any favorite by drag & drop
- after 500msec hovering with the songs over
desired playlist it becomes current
- drag & drop multiple songs is supported
2023-11-04 21:06:04 +01:00
Jonas Kvinge
c52fc90306 CI: Don't run SSH upload or macOS codesign on forks 2023-11-03 22:47:25 +01:00
Jonas Kvinge
eeb55fbc42 nsi: Update icu to 74 2023-11-01 23:07:47 +01:00
Jonas Kvinge
5d77eb1901 Change URL for KDSingleApplication submodule to https 2023-10-28 19:26:11 +02:00
Jonas Kvinge
654a94fe3d nsi: Add libabsl_kernel_timeout_internal.dll 2023-10-28 15:32:49 +02:00
Jonas Kvinge
4238708226 README: Update build instructions 2023-10-28 00:56:08 +02:00
Jonas Kvinge
5f02072bf3 CMake: Fix KDSingleApplication version check
Fixes #1300
2023-10-23 23:56:59 +02:00
Jonas Kvinge
eec5b448b6 CI: Add fftw3-devel for openSUSE 2023-10-23 19:45:50 +02:00
Jonas Kvinge
5cda756f92 CI: Remove get release version for macOS private 2023-10-23 19:37:40 +02:00
Jonas Kvinge
e9588dd85b CI: Remove SSH key setup from macOS private 2023-10-22 21:34:12 +02:00
Jonas Kvinge
dda0e4aa06 CI: Use MACOS_KEYCHAIN_PASSWORD 2023-10-22 21:13:28 +02:00
Jonas Kvinge
2282406166 CI: Build on self-hosted runner only on private repo 2023-10-22 18:51:23 +02:00
Jonas Kvinge
b3f0dee8e9 CI: Add "if: true" to easily disable steps 2023-10-22 17:20:28 +02:00
Jonas Kvinge
f9f7381247 CI: Fix APPLE_DEVELOPER_ID echo 2023-10-22 17:15:49 +02:00
Jonas Kvinge
48685325e6 Use KDSingleApplication as a submodule 2023-10-22 16:32:55 +02:00
Jonas Kvinge
e8bcaf415c CI: Only run SSH upload on this repo 2023-10-22 15:26:23 +02:00
Ondrej Mosnáček
c9197e8df7 CMake: Fix KDSingleApplication package name for Qt5
The name of the Qt5 KDSingleApplication CMake package is just
"KDSingleApplication", not "KDSingleApplication-qt".

Signed-off-by: Ondrej Mosnáček <omosnacek@gmail.com>
2023-10-22 14:24:52 +02:00
Jonas Kvinge
2bb09cf575 Song: Handle MP2 in Song::FiletypeByDescription 2023-10-21 05:07:25 +02:00
Jonas Kvinge
7bf4ad3884 Song: Handle MP2 in Song::FiletypeByExtension 2023-10-21 04:59:50 +02:00
Jonas Kvinge
5154d7ac84 Song: Rename MP3 to MPEG 2023-10-21 04:59:33 +02:00
Jonas Kvinge
9299653722 Turn on git revision 2023-10-21 04:57:53 +02:00
Jonas Kvinge
b0f0133d29 Release 1.0.21 2023-10-21 03:53:40 +02:00
Jonas Kvinge
9211b6f0c0 GstStartup: Remove macOS libsoup workarounds 2023-10-21 03:05:04 +02:00
Strawbs Bot
ab6a0ed6dd Update translations 2023-10-21 01:33:19 +02:00
Jonas Kvinge
c975c1e4aa CI: Remove unused homebrew and macports build 2023-10-20 00:53:49 +02:00
Jonas Kvinge
f9a593dc74 CI: Remove conflicting files for MSVC 2023-10-19 23:25:06 +02:00
Jonas Kvinge
9151520d50 CI: Remove uninstalling mingw 2023-10-18 23:19:50 +02:00
Jonas Kvinge
8f72d877bd CI: Manually sign libraries missing signature 2023-10-18 20:47:17 +02:00
Jonas Kvinge
e1990c9315 macgstcopy: Add rpath to gst plugin scanner 2023-10-18 20:46:24 +02:00
Jonas Kvinge
4cd5dcbfcf Update Changelog 2023-10-15 20:21:41 +02:00
Jonas Kvinge
3ee2125e8f CI: Verify code-signing 2023-10-15 16:51:13 +02:00
Jonas Kvinge
4652f3b449 CI: Manually codesign libsoup dependencies 2023-10-15 16:51:04 +02:00
Jonas Kvinge
697717eb1e CI: Use apple-actions/import-codesign-certs 2023-10-15 16:09:25 +02:00
Jonas Kvinge
cbde71f5f1 CI: Remove macOS lconvert and jenkins workaround 2023-10-15 07:48:20 +02:00
Jonas Kvinge
bf52afa21d GstStartup: Add back LIBSOUP3_LIBRARY_PATH 2023-10-15 07:46:49 +02:00
Jonas Kvinge
2083e008ab CI: Add macOS code-signing 2023-10-15 06:28:38 +02:00
Jonas Kvinge
2be0d23b1b macgstcopy: Change ID with install_name_tool 2023-10-14 23:24:56 +02:00
Jonas Kvinge
fda56dda25 main: Use Utilities::SetEnv 2023-10-14 23:18:16 +02:00
Jonas Kvinge
ed259781e9 CI: Remove rsync install and -DBUILD_WERROR 2023-10-14 23:17:58 +02:00
Jonas Kvinge
0c7fcd5a7a CMake: Fix USE_BUNDLE default 2023-10-14 22:09:14 +02:00
Jonas Kvinge
310b7b9065 CollectionQuery: Add F for float 2023-10-14 22:08:50 +02:00
Jonas Kvinge
cd534bbda7 CMake: Remove USE_BUNDLE_DIR 2023-10-14 03:30:09 +02:00
Jonas Kvinge
1a66eaf7bf GstStartup: Refactor environment code 2023-10-14 03:29:54 +02:00
Jonas Kvinge
a94d6e3dd8 CI: macgstcopy.sh copies libsoup now 2023-10-14 03:29:14 +02:00
Jonas Kvinge
54cfb2bbc4 main: Don't override library paths 2023-10-14 03:28:28 +02:00
Jonas Kvinge
00bc3f76cf macgstcopy: Copy libsoup 2023-10-14 03:27:57 +02:00
Jonas Kvinge
71a6d378d9 workerpool: Always search plugin path for tagreader on macOS 2023-10-14 03:27:32 +02:00
Jonas Kvinge
99a5aee8b3 GstEnginePipeline: Change debug logging for active/inactive 2023-10-13 23:38:19 +02:00
Jonas Kvinge
89d2a23dac CollectionBackend: Use QString::arg() 2023-10-13 23:06:29 +02:00
Jonas Kvinge
ee1bf47f5c DeviceInfo: Simplify hint 2023-10-13 22:58:53 +02:00
Jonas Kvinge
13ac20f8b3 Add/remove reference for parameters 2023-10-13 22:58:18 +02:00
Jonas Kvinge
adef05bbdf Use QString::arg() 2023-10-13 22:55:20 +02:00
Jonas Kvinge
f03ff452b8 SavePlaylistsDialog: Add parent to ctor 2023-10-13 22:53:27 +02:00
Jonas Kvinge
c39489060b Mpris2: Add static_cast 2023-10-13 22:52:36 +02:00
Jonas Kvinge
002fa8f4aa Fix mismatched definition 2023-10-13 22:49:20 +02:00
Jonas Kvinge
d2c747258c Song: Add MPC to FiletypeByMimetype and FiletypeByDescription 2023-10-12 01:16:40 +02:00
Jonas Kvinge
53e3664726 CI: Install hub in upload release step 2023-10-11 17:37:47 +02:00
Jonas Kvinge
26ff9f6b53 Update Changelog 2023-10-10 23:44:34 +02:00
Jonas Kvinge
f542f1c854 GstEnginePipeline: Remove volume sync for Auto
Workaround crash in #1123
2023-10-10 23:17:03 +02:00
Jonas Kvinge
33041ffa75 GstEnginePipeline: Delay seek when when resetting next URI
When seeking after the next URI is set, we set the state to READY to switch the URI back. The seek in after going to ready sometimes does not work, delay the seek to workaround this.

Fixes #1258
2023-10-10 23:00:11 +02:00
Jonas Kvinge
1493164df9 CollectionQuery: Strip off whitespaces after colon and simplify code
Fixes #1290
2023-10-10 19:15:20 +02:00
Strawbs Bot
8ffef558ff Update translations 2023-10-10 01:37:19 +02:00
Jonas Kvinge
8b3f44ffca Update Changelog 2023-10-10 01:32:33 +02:00
Jonas Kvinge
2706529006 DeviceDatabaseBackend: Add missing ebur128 fields 2023-10-10 01:27:39 +02:00
Jonas Kvinge
7e331a2055 DeviceManager: Fix creating connected device 2023-10-10 01:26:47 +02:00
Jonas Kvinge
505329730c Improve lyrics match 2023-10-08 23:55:05 +02:00
Jonas Kvinge
1a07404c10 Simplify RPM spec file 2023-10-08 16:15:59 +02:00
Jonas Kvinge
b02adc7758 Simplify RPM spec file 2023-10-08 13:54:36 +02:00
Jonas Kvinge
952252ebcd Simplify RPM spec file 2023-10-08 02:55:22 +02:00
Jonas Kvinge
eee0c40132 Playlist: Use InternetServicePtr 2023-10-07 17:05:51 +02:00
Jonas Kvinge
567bad33e1 Playlist: Use PlaylistItemPtr 2023-10-07 17:05:36 +02:00
Jonas Kvinge
b5c0e93989 FancyTabWidget: Use QApplication::style(), not style() 2023-10-07 15:36:49 +02:00
Jonas Kvinge
ac17df2a86 PlaylistContainer: Remove unused signals 2023-10-07 15:34:37 +02:00
Jonas Kvinge
a9a5899252 FancyTabWidgetProxyStyle: Create proxy style from application style 2023-10-07 15:23:41 +02:00
Jonas Kvinge
395d85c1b4 Move PlaylistProxyStyle to it's own file 2023-10-07 15:16:39 +02:00
Jonas Kvinge
52ba1ce17f PlaylistView: Fix build with Qt 5 2023-10-07 15:04:00 +02:00
Jonas Kvinge
604a246fe8 PlaylistProxyStyle: Use CE_HeaderLabel instead of CE_Header 2023-10-07 14:50:46 +02:00
Jonas Kvinge
e172c4871c PlaylistView: Create proxy style based on application style
Fixes #1275
2023-10-07 14:48:40 +02:00
Jonas Kvinge
2a9b32690d Update Changelog 2023-10-07 02:52:47 +02:00
Jonas Kvinge
76fa4745d0 GstEnginePipeline: Only update last known position when possible
Fixes flaky seeking where gst_element_query_position() returns -1 when seeking.
2023-10-07 02:47:12 +02:00
Strawbs Bot
6f4d26e9d3 Update translations 2023-10-04 00:33:42 +02:00
Jonas Kvinge
f40f43861d EngineBase: Use enum class for TrackChangeType 2023-10-03 20:18:52 +02:00
Jonas Kvinge
717ebbbb24 CI: Install openssh-clients for openSUSE 2023-10-02 21:32:46 +02:00
Jonas Kvinge
79c69e1b1e CollectionWatcher: Match extension case-insensitive 2023-10-02 17:39:10 +02:00
Jonas Kvinge
8fc95e08dc CollectionWatcher: Ignore compressed files
Fixes #1274
2023-10-02 17:23:47 +02:00
Jonas Kvinge
3f06528ba3 Fix version without git tags 2023-10-02 17:04:15 +02:00
Jonas Kvinge
0e44b10eec Add Ko-fi to funding options 2023-09-28 16:55:25 +02:00
Jonas Kvinge
d74fe92ce8 Use system KDSingleApplication when available 2023-09-27 20:19:43 +02:00
Jonas Kvinge
8037948f7f Dmg: Remove extra macdeployqt executable parameters
macdeployqt is patched and should handle .so libraries too now.
2023-09-26 23:46:11 +02:00
Jonas Kvinge
ab29170972 CI: Disable macOS homebrew build 2023-09-26 23:45:11 +02:00
Jonas Kvinge
6f843e2499 CI: Disable macports build
Issue #1278
2023-09-26 18:22:43 +02:00
Jonas Kvinge
6b8a816ce6 macgstcopy: Check for both .dylib and .so extensions for plugins
Require at least coreelements to be found in plugins directory
2023-09-26 17:04:20 +02:00
Jonas Kvinge
2c0541fb79 CI: Delete conflicting ICU case-insensitive 2023-09-26 00:34:13 +02:00
Jonas Kvinge
cb22890d79 CI: Simplify setting CMAKE_BUILD_TYPE and ENABLE_WIN32_CONSOLE 2023-09-26 00:34:13 +02:00
Jonas Kvinge
5a9346cc80 Add libebur128 to strawberry.spec 2023-09-25 20:50:43 +02:00
Jonas Kvinge
1c85220ffa Add libebur128-dev to debian control 2023-09-25 20:50:43 +02:00
Jonas Kvinge
39d4818def CI: Fix PPA upload 2023-09-25 20:16:26 +02:00
Jonas Kvinge
db0cc66ba0 CI: Fix Mageia rpm upload 2023-09-25 20:15:56 +02:00
Strawbs Bot
c10a64f08a Update translations 2023-09-25 02:37:58 +02:00
Jonas Kvinge
5a3d60b203 Turn on git revision 2023-09-25 00:10:41 +02:00
Jonas Kvinge
28b9bf1f76 Release 1.0.20 2023-09-25 00:03:45 +02:00
Jonas Kvinge
27dbb2dd9e Release 1.0.19 2023-09-24 23:19:15 +02:00
Jonas Kvinge
9b7b790f21 CI: Fix upload 2023-09-24 23:18:24 +02:00
Jonas Kvinge
e3666e5bf3 Remove OTHER_SOURCES 2023-09-24 19:53:49 +02:00
Jonas Kvinge
9e38cd8dc2 CI: Remove fixed path 2023-09-24 18:16:01 +02:00
Jonas Kvinge
b105b9fd8f CI: Use CREATEDMG_SKIP_JENKINS on macOS arm64 2023-09-24 17:45:18 +02:00
Jonas Kvinge
6a018f3e25 MainWindow: Add sponsorship mesage 2023-09-24 15:09:20 +02:00
Jonas Kvinge
ab26d422e9 MainWindow: Update rosetta message 2023-09-24 15:08:57 +02:00
Jonas Kvinge
f4e18fb87c MessageDialog: Set minimum width 2023-09-24 15:08:35 +02:00
Jonas Kvinge
2b20ff4e67 Update README.md 2023-09-24 13:19:05 +02:00
Jonas Kvinge
28d5cd481b Add macOS code-signing 2023-09-24 03:03:52 +02:00
Jonas Kvinge
42f3340190 Update Changelog 2023-09-23 23:56:36 +02:00
Jonas Kvinge
0ef50e1b6d Remove unused variables 2023-09-23 23:55:49 +02:00
Jonas Kvinge
01ddded603 CI: Use create-dmg with --skip-jenkins only for macOS arm64 2023-09-23 21:58:35 +02:00
Jonas Kvinge
fe7e0ffbba CI: Add macOS arm64 build and upload path 2023-09-23 03:08:51 +02:00
Jonas Kvinge
5df6066150 Update Changelog 2023-09-20 20:54:28 +02:00
Jonas Kvinge
8393cdb2de Add lyrics from elyrics.net and lyricsmode.com 2023-09-20 19:02:28 +02:00
Jonas Kvinge
da19272eb6 HtmlLyricsProvider: Rename GetUrl to Url 2023-09-20 17:39:44 +02:00
Jonas Kvinge
60fb83d770 HtmlLyricsProvider: Remove <script> tags and content between 2023-09-20 17:38:45 +02:00
Jonas Kvinge
1c90b03476 Add HTML lyrics provider 2023-09-20 01:09:08 +02:00
Jonas Kvinge
50502ce720 Add azlyrics.com lyrics provider 2023-09-19 22:47:07 +02:00
Jonas Kvinge
39f9d02454 Add songlyrics.com lyrics provider 2023-09-19 16:56:10 +02:00
Jonas Kvinge
ce627b0e18 Update Changelog 2023-09-19 00:30:56 +02:00
Jonas Kvinge
cdb4980337 CollectionBackend: Don't expire unavailable songs part of playlists 2023-09-17 21:54:27 +02:00
Jonas Kvinge
878148ac32 Use system macdeployqt 2023-09-17 01:23:53 +02:00
Jonas Kvinge
0bc29f0563 nsi: Disable wasapi2 2023-09-17 00:31:42 +02:00
Jonas Kvinge
e201f71a74 CMake: Simplify Qt detection 2023-09-16 14:55:42 +02:00
buckmelanoma
7e684885cf Capitalize column names
Capitalize column names for consistency with OS
2023-09-15 15:33:07 +02:00
dependabot[bot]
e600c1b50c Bump crazy-max/ghaction-import-gpg from 5 to 6
Bumps [crazy-max/ghaction-import-gpg](https://github.com/crazy-max/ghaction-import-gpg) from 5 to 6.
- [Release notes](https://github.com/crazy-max/ghaction-import-gpg/releases)
- [Commits](https://github.com/crazy-max/ghaction-import-gpg/compare/v5...v6)

---
updated-dependencies:
- dependency-name: crazy-max/ghaction-import-gpg
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-14 21:13:53 +02:00
Jonas Kvinge
5da2faa400 CI: Replace actions-download-file with curl 2023-09-07 23:03:49 +02:00
Jonas Kvinge
05cd134a24 CI: Remove macOS homebrew upload 2023-09-07 21:19:34 +02:00
Jonas Kvinge
2f27a7d00b CI: Add new macOS build 2023-09-07 19:48:41 +02:00
Jonas Kvinge
d61d4d0a74 macdeploycheck: Use static QFile::exists 2023-09-06 22:59:16 +02:00
Jonas Kvinge
4033cd61c2 logging: Ignore -Wold-style-cast for glib.h 2023-09-05 23:42:56 +02:00
Jonas Kvinge
7cd6f372e6 MacOsDeviceLister: Move kind variable inside #ifdef HAVE_AUDIOCD 2023-09-05 23:42:32 +02:00
Jonas Kvinge
ffe6eb3de7 KDSingleApplicationLocalSocket: Ignore -Wgnu-zero-variadic-macro-arguments 2023-09-05 23:34:43 +02:00
Jonas Kvinge
e2b0b1b1fb CI: Use latest MSVC dependencies download URL 2023-09-05 18:29:59 +02:00
Jonas Kvinge
1f15ca70a3 CI: Remove install_name_tool step from macports 2023-09-05 18:15:54 +02:00
dependabot[bot]
904ee6a9b3 Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-09-04 20:24:34 +02:00
Jonas Kvinge
0461e98a4c nsi: Add libspeexd.dll for MSVC debug 2023-09-04 19:06:07 +02:00
Jonas Kvinge
dc01a18b87 Remove lyrics.com lyrics provider
Does not provider full lyrics in API. The URL we used only points to a page with "Get the lyrics for <song> at Lyrics.com" now.
2023-08-31 23:22:22 +02:00
Strawbs Bot
7be0e284c2 Update translations 2023-08-31 22:52:37 +02:00
Jonas Kvinge
6dd79d5b8f MainWindow: Bound volume between 0 and 100
Fixes #1262
2023-08-30 21:43:52 +02:00
Jonas Kvinge
f81b725d42 CI: Uninstall all homebrew packages 2023-08-30 19:37:10 +02:00
Jonas Kvinge
cfeecd98f6 Dmg: Remove DEPENDS deploy deploycheck 2023-08-30 16:22:33 +02:00
Jonas Kvinge
d054dd33e2 CI: Replace relative library @loader_path paths, macdeployqt does not understand these 2023-08-30 15:22:33 +02:00
Jonas Kvinge
45ad84a9bc Fix build with macOS < 12.0 2023-08-27 13:54:23 +02:00
Jonas Kvinge
a333662f56 CI: Add macOS brew tap step 2023-08-27 01:33:01 +02:00
Jonas Kvinge
59f716563f QSearchField: Use static_cast 2023-08-27 01:15:01 +02:00
Jonas Kvinge
6815f8c9b7 MacOsDeviceFinder: Rename kAudioObjectPropertyElementMaster to kAudioObjectPropertyElementMain 2023-08-27 01:14:42 +02:00
Jonas Kvinge
8e5360ac38 MacOsDeviceLister: Rename kIOMasterPortDefault to kIOMainPortDefault 2023-08-27 01:14:24 +02:00
Jonas Kvinge
aa6809ad5f DeviceManager: Use pointer directly 2023-08-27 01:14:00 +02:00
Jonas Kvinge
d8a7d427c3 BehaviourSettingsPage: Simplify Load 2023-08-27 01:12:38 +02:00
Jonas Kvinge
bc1b45d912 MainWindow: Fix build on macOS 2023-08-27 00:09:49 +02:00
Jonas Kvinge
50c5283599 BehaviourSettingsPage: Use QSystemTrayIcon::isSystemTrayAvailable directly 2023-08-26 21:21:31 +02:00
Jonas Kvinge
02ef65bcfd MainWindow: Only keep running when system tray icon is enabled 2023-08-26 21:20:50 +02:00
Jonas Kvinge
904245bb21 keymapper_x11: Qt::Key_mu renamed Qt::Key_micro from Qt 6.7 2023-08-26 21:15:26 +02:00
Jonas Kvinge
57e29b2be9 CI: Fix macOS rpaths 2023-08-13 12:19:14 +02:00
Jonas Kvinge
53a5603f64 CI: Fix dnf 2023-08-11 17:03:39 +02:00
Jonas Kvinge
8805a21567 CI: Remove Fedora workarounds 2023-08-11 00:17:45 +02:00
Jonas Kvinge
c6fee92450 CI: Fix macOS build 2023-08-10 01:40:51 +02:00
Jonas Kvinge
46c90f3712 CI: Check for missing Delete entries in NSI 2023-08-09 19:53:31 +02:00
Jonas Kvinge
e3c1c6ee9a nsi: Add missing double-quote 2023-08-09 19:52:01 +02:00
Jonas Kvinge
8bfbd69a2c nsi: Add libabsl_log_internal_conditions.dll 2023-08-09 19:41:06 +02:00
Jonas Kvinge
6a6649823e CI: List copied MinGW dependencies 2023-08-09 19:40:51 +02:00
Jonas Kvinge
bfb95d503a ErrorDialog: Clear messages on close instead of hide
Fixes an issue where the error dialog is cleared because the hide event gets triggered.
2023-08-07 19:38:48 +02:00
Jonas Kvinge
d1b4736ef9 ErrorDialog: Give name to layouts 2023-08-07 19:36:20 +02:00
Jonas Kvinge
e56e58b634 GstEnginePipeline: Always set use-buffering 2023-08-06 13:44:57 +02:00
Jonas Kvinge
fed5b6b695 GstEnginePipeline: Rename ebur128 volume variable 2023-08-06 13:36:25 +02:00
Jonas Kvinge
e96870cfbd nsi: Update to ffmpeg 6.0 for MSVC 2023-08-04 19:40:00 +02:00
Jonas Kvinge
acda7c13b2 GlobalShortcutsBackendMacOSPrivate: Replace boost::noncopyable with Q_DISABLE_COPY 2023-08-04 03:36:01 +02:00
Jonas Kvinge
7d5c7f8493 MacOsDeviceLister: Replace BOOST_SCOPE_EXIT with QScopeGuard 2023-08-04 03:36:01 +02:00
Jonas Kvinge
4ef3f3568d CI: Remove Ubuntu Kinetic 2023-08-03 20:14:54 +02:00
Jonas Kvinge
f81bd26649 MergedProxyModelPrivate: Formatting 2023-08-03 20:03:48 +02:00
Jonas Kvinge
2a407bfe47 ScopedTransaction: Replace boost::noncopyable with Q_DISABLE_COPY 2023-08-03 19:58:16 +02:00
Jonas Kvinge
f70f126f76 AlsaDeviceFinder: Replace BOOST_SCOPE_EXIT with QScopeGuard 2023-08-03 17:29:42 +02:00
Jonas Kvinge
f06591fde8 Database: Replace BOOST_SCOPE_EXIT with QScopeGuard 2023-08-03 17:29:11 +02:00
Strawbs Bot
e0c9a9dc17 Update translations 2023-08-03 01:03:54 +02:00
Jonas Kvinge
0f16fc2776 CI: Remove FreeBSD 2023-08-02 17:21:14 +02:00
Dakes
7aa7cdf6f3 Add filtering of numerical cols to collection
CollectionFilterWidget: Updated the tooltip, to reflect the changes.
CollectionQuery: Add parsing for SQL operators and insert right SQL
"where" searches.
Song: Add list of numerical columns
playlistfilterparser.cpp/FilterParser: move time and rating parsing
functions to new file:
searchparserutils.cpp: Contains common code used to parse search terms
in playlist and collection filters.
2023-08-02 16:52:27 +02:00
Dakes
82a8a890de PlaylistContainer: Add tooltip to search field 2023-08-02 16:52:27 +02:00
Dakes
f8df901963 PlaylistFilter: Add playcount and skipcount 2023-08-02 16:52:27 +02:00
Jonas Kvinge
8b08d1d599 Mpris2: Always use QGuiApplication::desktopFileName 2023-08-02 15:27:24 +02:00
Jonas Kvinge
f3ddba3edc main: Set desktop filename
Fixes #1254
2023-08-02 14:37:24 +02:00
Jonas Kvinge
acbec6db7e main: Set application display name 2023-08-02 14:25:40 +02:00
Jonas Kvinge
d2390473bc Update Changelog 2023-08-01 19:29:38 +02:00
Jonas Kvinge
e273d64be3 Player: Always stop after 100 errors
Fixes #1199
2023-08-01 16:59:43 +02:00
Jonas Kvinge
2a90256d32 GstEnginePipeline: Disable volume sync on Windows
Fixes #1220
2023-08-01 16:39:57 +02:00
Jonas Kvinge
560712db21 ebur128analysis: Check for valid channel-mask 2023-07-30 03:18:48 +02:00
Jonas Kvinge
483b42d2b8 GstStartup: Use directsoundsink as primary sink 2023-07-29 22:54:49 +02:00
Jonas Kvinge
d1a6e53f5c TagReaderTagLib: Read FMPS_Playcount
Fixes #1248
2023-07-29 18:33:50 +02:00
Dakes
f5a55abf58 Mpris2: Add new property to read/write the rating 2023-07-27 11:24:19 +02:00
Jonas Kvinge
0bc94b90d7 SmartPlaylistSearchTerm: Handle unrated (-1) as zero
Fixes #1244
2023-07-26 01:45:28 +02:00
Strawbs Bot
9ed4bd9366 Update translations 2023-07-24 09:46:20 +02:00
Jonas Kvinge
d3352e476f Remove < 0 check on unsigned 2023-07-21 07:17:58 +02:00
Jonas Kvinge
4b4c5fc0ab Use const reference for AlbumCoverLoaderOptions::Types 2023-07-21 07:17:26 +02:00
Jonas Kvinge
38b9c7c38a MusixmatchCoverProvider: Add const 2023-07-21 07:16:32 +02:00
Jonas Kvinge
c71ce41c83 LastFMImport: Move variable declaration 2023-07-21 07:16:23 +02:00
Jonas Kvinge
4cd030215d Transcoder: Remove useless empty check 2023-07-21 07:16:08 +02:00
Jonas Kvinge
2ce5d6f727 Database: Add missing const 2023-07-21 07:15:55 +02:00
Jonas Kvinge
b55a0df8e1 CollectionView: Remove useless variable 2023-07-21 07:15:42 +02:00
Jonas Kvinge
ee5fa23a7a LocalRedirectServer: Remove unused https variable 2023-07-21 07:15:08 +02:00
Jonas Kvinge
75ab6f25f4 Check return of QSqlQuery::prepare 2023-07-21 07:12:20 +02:00
Jonas Kvinge
eaed82c9b2 CollectionItemDelegate: Remove check for nullptr, already done 2023-07-21 07:11:21 +02:00
Jonas Kvinge
2a4be6fcd7 BoomAnalyzer: Move variable declaration 2023-07-21 07:10:31 +02:00
Jonas Kvinge
e6198500f7 BlockAnalyzer: Remove useless continue 2023-07-21 07:10:17 +02:00
Jonas Kvinge
7db36c83c1 MainWindow: Don't use our network manager for Qt Sparkle 2023-07-21 06:20:46 +02:00
Jonas Kvinge
0e1921698c TidalUrlHandler: service is already a pointer 2023-07-21 06:11:16 +02:00
Jonas Kvinge
95eed1ecec Fix QtConcurrent::run build with Qt 5 2023-07-21 06:10:44 +02:00
Jonas Kvinge
2e61235403 Application: Use shared pointers
Fixes #1239
2023-07-21 05:55:24 +02:00
Jonas Kvinge
d6b53f78ab Cleanup includes 2023-07-21 05:25:57 +02:00
Jonas Kvinge
a2c7ff63df Formatting 2023-07-21 05:11:27 +02:00
Roman Lebedev
9fb15545bd GstEnginePipeline: Perform EBU R 128 Loudness Normalization in floating-point 2023-07-19 03:07:22 +02:00
Jonas Kvinge
277e08b94a README: Add libebur128 to optional dependencies 2023-07-19 02:40:31 +02:00
Jonas Kvinge
46224fe9b8 nsi: Add gst-play-1.0.exe 2023-07-18 21:28:39 +02:00
Jonas Kvinge
56180ca419 LocalRedirectServer: Remove https option and gnutls dependency 2023-07-18 19:44:45 +02:00
Jonas Kvinge
dc65753a0b ebur128analysis: Remove extra semicolon 2023-07-16 23:26:17 +02:00
Jonas Kvinge
d8857d8e72 Add missing QMetaType include 2023-07-12 18:13:02 +02:00
Jonas Kvinge
fdc3e0a5f5 LyricsSearchResult: Add missing QList include 2023-07-12 18:12:48 +02:00
Jonas Kvinge
8f7180eb6c Song: Pass double by value 2023-07-12 18:12:08 +02:00
Jonas Kvinge
8945602eae Song: Add missing newlines between functions 2023-07-12 18:11:43 +02:00
Jonas Kvinge
7826f77425 Formatting 2023-07-12 16:27:59 +02:00
Jonas Kvinge
00372e85c5 FilterParser: Silence double / float warning 2023-07-12 16:27:28 +02:00
Jonas Kvinge
a1ffc5c33b ebur128analysis: Rename dsc variable 2023-07-12 16:26:39 +02:00
Jonas Kvinge
8a44a41abb ebur128analysis: Initialize variables to silence warnings 2023-07-12 16:26:17 +02:00
Jonas Kvinge
23f0c56eba Song: Move ebur128 functions 2023-07-12 16:23:27 +02:00
Jonas Kvinge
3d25863ccb CollectionWatcher: Make PerformEBUR128Analysis const 2023-07-12 16:22:17 +02:00
Jonas Kvinge
bb6daca735 GME: Add static_cast to silence warnings 2023-07-12 16:22:02 +02:00
Roman Lebedev
4bd993b1e3 GstEngine/GstEnginePipeline: support gap-less playback w/ loudness-normalizing gain
Ok, it does appear that it is that simple.

In principle this (even the non-update case) results in volume jumps,
so maybe we'll want gradual gain change...

Notably, i thought we'd always seek if the pipeline
was already operating on the same URL as the new one,
but apparently only for adjacent songs?
2023-07-12 14:34:04 +02:00
Roman Lebedev
f81816b0cd EBUR128Analysis: handle channel map
Loudness measurement is channel-dependent.
This perhaps matters most for mono audio.
2023-07-12 14:34:04 +02:00
Roman Lebedev
7ac605c038 EBU R 128: update ChangeLog/README 2023-07-12 14:34:04 +02:00
Roman Lebedev
2a8b67d11e Handle libebur to windows installers 2023-07-12 14:34:04 +02:00
Roman Lebedev
16893cca24 CI: install libebur128 package 2023-07-12 14:34:04 +02:00
Roman Lebedev
94ab788032 GstEnginePipeline: actually perform (EBU R 128) loudness normalization
The magic: if EBU R 128 loudness normalization is enabled,
just insert `volume` GST element into the pipeline
(where ReplayGain would be inserted) and configure it.

We currently don't support changing said gain after the pipeline
was created. We might need to, though, for a number of reasons.
2023-07-12 14:34:04 +02:00
Roman Lebedev
e3a333564a GstEngine::Load(): different loudness-normalizing gain means new pipeline
This is a bit of a gotcha, there should be a point (where we seek?)
where we'd be able to change said gain, but for now this is a simple[r]
stop-gap fix.
2023-07-12 14:34:04 +02:00
Roman Lebedev
13d6cf201f Engine: pipe-in the EBU R 128 loudness normalization gain stuff
The idea is that Integrated Loudness is an integral part
of the song, much like knowing it's beginning / ending
in the file, and we must handle it the exact same way,
and pipe it through all the way.

At the same time, `EngineBase` knows Target Level (from settings),
and these two combined tell us the Gain needed to normalize the
Loudness of the particular Song (`EngineBase::Load()` does that).
So the actual backend only needs to handle the Volume.

We don't currently support changing Target Level on the fly.
We don't currently support changing Loudness-normalizing Gain on the fly.

This does not handle the case when the song is loaded from URL
and thus the EBU R 128 measures, that exist, are not nessesairly correct.
2023-07-12 14:34:04 +02:00
Roman Lebedev
40ef3191fc EBUR128Analysis: place a queue before appsink
This improves the performance of the analysis (by 2x!),
by offloading non-`libebur128`-computations (i.e. decode-convert)
to a separate thread, thus reducing walltime.
2023-07-12 14:34:04 +02:00
Roman Lebedev
bda2b91c92 Collectionwatcher: sink PerformEBUR128Analysis() into ScanNewFile & friends 2023-07-12 14:34:04 +02:00
Roman Lebedev
1462bfa297 CollectionWatcher: support EBU R 128 analysis
Again, somewhat pretty similar to the existing fingerprint analysis,
we must support performing it both for the new files,
and re-performing it on (some of) already-existing songs,
because it might have been disabled before.

Admittedly, i quite don't like some of this code,
maybe this can be done in a more concise way.

NOTE: this only supports scanning each separate songs.
Should we ever want to support per-album loudness normalization,
this will need massive changes...
2023-07-12 14:34:04 +02:00
Roman Lebedev
bafcb97fa1 Implement EBUR128Analysis
The most juicy bit!

This is based on Song Fingerprint Analysis,
but here we must know the actual song, and not just the file.

The library supports only interleaved S16/S32/F32/F64,
so we must be sure we insert `audioconvert` into pipeline.

One point of contention here for me, is whether we should
feed the frames to the library the moment we get them
in `NewBufferCallback`, or collect them in a buffer
and pass them all at once. I've gone with the former,
because it seems like that is not the worst choice:
https://github.com/strawberrymusicplayer/strawberry/pull/1216#issuecomment-1610075876

In principle, the analysis *could* fail,
so we want to handle that gracefully.
2023-07-12 14:34:04 +02:00
Roman Lebedev
f905676b1c CollectionBackend/CollectionWatcher: add HasSongsWithMissingLoudnessCharacteristics logic
Exactly identical to the "missing fingerprint" logic,
just for the two new fields being added.
2023-07-12 14:34:04 +02:00
Roman Lebedev
0ea81b13b9 BackendSettingsPage: add "EBU R 128 loudness normalization"-related settings
Change `Use Replay Gain metadata if it is available` checkbox
into a radio button and add button to disable any loudness normalization.

Add second group(+radio button), for EBU R 128 loudness normalization.

There is only one tunable: Target Level,
defaulting to EBU R 128-recommended `-23 LUFS`.

Care should be taken when changing Target Level!
You probably don't want to go outside of `-30..-16` range!

At least as implemented, there is only support for per-song normalization,
i.e. no per-album normalization.

We do not do anything with loudness range,
although i have some further thoughts about compression.

We do not do anything about clipping / peak level.

NOTE: we do not need `libebur128` to *perform* the audio normalization,
      only for the initial analysis.


Co-authored-by: Jonas Kvinge <jonas@jkvinge.net>
2023-07-12 14:34:04 +02:00
Roman Lebedev
9a7949297e CollectionSettingsPage: add option to toggle libebur128-based song analysis
Much like song fingerprinting, performing EBU R 128 analysis is optional.

If you will want to enable EBU R 128 loudness normalization
(which does not depend on the presence of `libebur128`!)
you will probably want to enable it, but it is not enabled by default.

There will be support for rescanning songs for which it is missing.
2023-07-12 14:34:04 +02:00
Roman Lebedev
29342fa9ac CMake: when optional component EBUR128 is detected, link to libebur128 2023-07-12 14:34:04 +02:00
Roman Lebedev
bd4438d99b CMake: define new optional component EBUR128 (libebur128+gstreamer)
To perform the analysis using said library, we need to first somehow
get the PCM of the song, and it makes sense to use GStreamer for that.
2023-07-12 14:34:04 +02:00
Roman Lebedev
f8e14e8fd5 CMake: look for libebur128
We are going to use said library to calculate the two measures in question
from decoded audio.

I am adding this in default-on state, since this library
should be well-packaged everywhere, and this is something that,
i presume, we want.
2023-07-12 14:34:04 +02:00
Roman Lebedev
b2c66c9cda Playlist: add newly-added columns
Still mostly boilter-plate-y. It is somewhat interesting to see that info
in playlist view, so add the two fileds as columns.

At least for Integrated loudness, since it's normally negative,
we need to add a specialized Delegate.
2023-07-12 14:34:04 +02:00
Roman Lebedev
44e5c32bcb ContextView: show newly-added fields
And still very boilerplate-y, same as in previous change,
just show the two new Song fields in `Context` view.
2023-07-12 14:34:04 +02:00
Roman Lebedev
e7fc4e7f89 EditTagDialog: show newly-added fields (read-only)
Still very boilerplate-y. Add two placeholders to the UI
(in the middle of the existing table, so the diff is a mess),
and populate them with data.
2023-07-12 14:34:04 +02:00
Roman Lebedev
e589486907 Song: add pretty-printers for EBU R 128 Integrated Loudness and Loudness Range fields
They end up being used in a quite a number of places later on,
it makes sense to have them in a common place.

Integrated Loudness (LUFS) is *usually* negative, so we really want to
always print a sign. But Loudness Range is non-negative.

I think it makes sense to print one or at most two decimal places for these.
2023-07-12 14:34:04 +02:00
Roman Lebedev
459c4c5d86 Song: add EBU R 128 Integrated Loudness and Loudness Range fields, DB [de]serialization
Again, pretty boring boilerplate, rather identical to the handling of
other fields. We do need to be careful when [de]serializing it, though,
we don't want to accidentally loose the `NULL` (i.e. unknown) state!
2023-07-12 14:34:04 +02:00
Roman Lebedev
73c56f038e SqlQuery: add BindDoubleOrNullValue() method
To facilitate serializing of the two DB fields added by the previous change.
2023-07-12 14:34:04 +02:00
Roman Lebedev
0a4888f861 Database scheme: add EBU R 128 Integrated Loudness and Loudness Range columns
Nothing really ground-breaking, just add those two fields
to each table that already has `bitrate`/`samplerate`/`bitdepth` fields.

Those new fields do need to be able to represent an invalid state
which is their default state, thus they are non-`NOT NULL`.
In principle, the actual field type could be `INTEGER`
(i.e. fixed point w/ 2 fractional digits), but unless we really want to
save a few bytes, it doesn't seem worthwhile.

FIXME: i'm not sure if `device-schema` should be changed too.
2023-07-12 14:34:04 +02:00
Jonas Kvinge
da27ca98b3 CI: Only upload release when INCLUDE_GIT_REVISION is OFF 2023-07-12 14:25:59 +02:00
Jonas Kvinge
f1e1ccad28 CI: Fix stable PPA upload 2023-07-12 14:22:15 +02:00
Jonas Kvinge
7616c06ff9 Use find_package(Protobuf CONFIG) for macOS too 2023-07-12 01:25:41 +02:00
Jonas Kvinge
0c1f4750ea KDSingleApplication: Add LICENSES
Fixes #1219
2023-07-02 22:17:36 +02:00
Strawbs Bot
0a26c295a0 Update translations 2023-07-02 14:10:05 +02:00
Jonas Kvinge
32d23e0484 Turn on git revision 2023-07-02 04:00:38 +02:00
511 changed files with 29986 additions and 27414 deletions

1
.github/FUNDING.yml vendored
View File

@@ -1,3 +1,4 @@
github: jonaski
patreon: jonaskvinge
ko_fi: jonaskvinge
custom: https://paypal.me/jonaskvinge

File diff suppressed because it is too large Load Diff

4
.gitmodules vendored Normal file
View File

@@ -0,0 +1,4 @@
[submodule "3rdparty/kdsingleapplication/KDSingleApplication"]
path = 3rdparty/kdsingleapplication/KDSingleApplication
url = https://github.com/KDAB/KDSingleApplication.git
branch = master

7
3rdparty/README.md vendored
View File

@@ -16,13 +16,6 @@ Used on macOS to exclusively enable strawberry to grab global media shortcuts.
Can safely be deleted on other platforms.
macdeployqt
-----------
A modified version of Qt's official macdeployqt utility that fixes some issues,
this version also deploys gstreamer plugins.
Can safely be deleted on other platforms.
getopt
------
getopt included only when compiling on Windows.

View File

@@ -1,8 +1,8 @@
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)
target_include_directories(kdsingleapplication PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(kdsingleapplication PUBLIC ${QtCore_LIBRARIES} ${QtNetwork_LIBRARIES} )
target_link_libraries(kdsingleapplication PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network)

View File

@@ -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.

View File

@@ -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)

View File

@@ -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;

View File

@@ -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

View File

@@ -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

View File

@@ -1,315 +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
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);
}

View File

@@ -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

View File

@@ -1,7 +0,0 @@
add_executable(macdeployqt main.cpp shared.cpp)
target_link_libraries(macdeployqt PRIVATE
"-framework AppKit"
${QtCore_LIBRARIES}
)
#execute_process(COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/macdeployqt ${CMAKE_BINARY_DIR})

View File

@@ -1,286 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#undef QT_NO_DEBUG_OUTPUT
#undef QT_NO_WARNING_OUTPUT
#undef QT_NO_INFO_OUTPUT
#include <QCoreApplication>
#include <QDir>
#include <QLibraryInfo>
#include "shared.h"
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
QString appBundlePath;
if (argc > 1)
appBundlePath = QString::fromLocal8Bit(argv[1]);
if (argc < 2 || appBundlePath.startsWith("-")) {
qDebug() << "Usage: macdeployqt app-bundle [options]";
qDebug() << "";
qDebug() << "Options:";
qDebug() << " -verbose=<0-3> : 0 = no output, 1 = error/warning (default), 2 = normal, 3 = debug";
qDebug() << " -no-plugins : Skip plugin deployment";
qDebug() << " -dmg : Create a .dmg disk image";
qDebug() << " -no-strip : Don't run 'strip' on the binaries";
qDebug() << " -use-debug-libs : Deploy with debug versions of frameworks and plugins (implies -no-strip)";
qDebug() << " -executable=<path> : Let the given executable use the deployed frameworks too";
qDebug() << " -qmldir=<path> : Scan for QML imports in the given path";
qDebug() << " -qmlimport=<path> : Add the given path to the QML module search locations";
qDebug() << " -always-overwrite : Copy files even if the target file exists";
qDebug() << " -codesign=<ident> : Run codesign with the given identity on all executables";
qDebug() << " -hardened-runtime : Enable Hardened Runtime when code signing";
qDebug() << " -timestamp : Include a secure timestamp when code signing (requires internet connection)";
qDebug() << " -sign-for-notarization=<ident>: Activate the necessary options for notarization (requires internet connection)";
qDebug() << " -appstore-compliant : Skip deployment of components that use private API";
qDebug() << " -libpath=<path> : Add the given path to the library search path";
qDebug() << " -fs=<filesystem> : Set the filesystem used for the .dmg disk image (defaults to HFS+)";
qDebug() << "";
qDebug() << "macdeployqt takes an application bundle as input and makes it";
qDebug() << "self-contained by copying in the Qt frameworks and plugins that";
qDebug() << "the application uses.";
qDebug() << "";
qDebug() << "Plugins related to a framework are copied in with the";
qDebug() << "framework. The accessibility, image formats, and text codec";
qDebug() << "plugins are always copied, unless \"-no-plugins\" is specified.";
qDebug() << "";
qDebug() << "Qt plugins may use private API and will cause the app to be";
qDebug() << "rejected from the Mac App store. MacDeployQt will print a warning";
qDebug() << "when known incompatible plugins are deployed. Use -appstore-compliant ";
qDebug() << "to skip these plugins. Currently two SQL plugins are known to";
qDebug() << "be incompatible: qsqlodbc and qsqlpsql.";
qDebug() << "";
qDebug() << "See the \"Deploying Applications on OS X\" topic in the";
qDebug() << "documentation for more information about deployment on OS X.";
return 1;
}
appBundlePath = QDir::cleanPath(appBundlePath);
if (!QDir(appBundlePath).exists()) {
qDebug() << "Error: Could not find app bundle" << appBundlePath;
return 1;
}
bool plugins = true;
bool dmg = false;
QByteArray filesystem("HFS+");
bool useDebugLibs = false;
extern bool runStripEnabled;
extern bool alwaysOwerwriteEnabled;
extern QStringList librarySearchPath;
QStringList additionalExecutables;
bool qmldirArgumentUsed = false;
QStringList qmlDirs;
QStringList qmlImportPaths;
extern bool runCodesign;
extern QString codesignIdentiy;
extern bool hardenedRuntime;
extern bool appstoreCompliant;
extern bool deployFramework;
extern bool secureTimestamp;
for (int i = 2; i < argc; ++i) {
QByteArray argument = QByteArray(argv[i]);
if (argument == QByteArray("-no-plugins")) {
LogDebug() << "Argument found:" << argument;
plugins = false;
} else if (argument == QByteArray("-dmg")) {
LogDebug() << "Argument found:" << argument;
dmg = true;
} else if (argument == QByteArray("-no-strip")) {
LogDebug() << "Argument found:" << argument;
runStripEnabled = false;
} else if (argument == QByteArray("-use-debug-libs")) {
LogDebug() << "Argument found:" << argument;
useDebugLibs = true;
runStripEnabled = false;
} else if (argument.startsWith(QByteArray("-verbose"))) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf("=");
bool ok = false;
int number = argument.mid(index+1).toInt(&ok);
if (!ok)
LogError() << "Could not parse verbose level";
else
logLevel = number;
} else if (argument.startsWith(QByteArray("-executable"))) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf('=');
if (index == -1)
LogError() << "Missing executable path";
else
additionalExecutables << argument.mid(index+1);
} else if (argument.startsWith(QByteArray("-qmldir"))) {
LogDebug() << "Argument found:" << argument;
qmldirArgumentUsed = true;
int index = argument.indexOf('=');
if (index == -1)
LogError() << "Missing qml directory path";
else
qmlDirs << argument.mid(index+1);
} else if (argument.startsWith(QByteArray("-qmlimport"))) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf('=');
if (index == -1)
LogError() << "Missing qml import path";
else
qmlImportPaths << argument.mid(index+1);
} else if (argument.startsWith(QByteArray("-libpath"))) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf('=');
if (index == -1)
LogError() << "Missing library search path";
else
librarySearchPath << argument.mid(index+1);
} else if (argument == QByteArray("-always-overwrite")) {
LogDebug() << "Argument found:" << argument;
alwaysOwerwriteEnabled = true;
} else if (argument.startsWith(QByteArray("-codesign"))) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf("=");
if (index < 0 || index >= argument.size()) {
LogError() << "Missing code signing identity";
} else {
runCodesign = true;
codesignIdentiy = argument.mid(index+1);
}
} else if (argument.startsWith(QByteArray("-sign-for-notarization"))) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf("=");
if (index < 0 || index >= argument.size()) {
LogError() << "Missing code signing identity";
} else {
runCodesign = true;
hardenedRuntime = true;
secureTimestamp = true;
codesignIdentiy = argument.mid(index+1);
}
} else if (argument.startsWith(QByteArray("-hardened-runtime"))) {
LogDebug() << "Argument found:" << argument;
hardenedRuntime = true;
} else if (argument.startsWith(QByteArray("-timestamp"))) {
LogDebug() << "Argument found:" << argument;
secureTimestamp = true;
} else if (argument == QByteArray("-appstore-compliant")) {
LogDebug() << "Argument found:" << argument;
appstoreCompliant = true;
// Undocumented option, may not work as intended
} else if (argument == QByteArray("-deploy-framework")) {
LogDebug() << "Argument found:" << argument;
deployFramework = true;
} else if (argument.startsWith(QByteArray("-fs"))) {
LogDebug() << "Argument found:" << argument;
int index = argument.indexOf('=');
if (index == -1)
LogError() << "Missing filesystem type";
else
filesystem = argument.mid(index+1);
} else if (argument.startsWith("-")) {
LogError() << "Unknown argument" << argument << "\n";
return 1;
}
}
DeploymentInfo deploymentInfo = deployQtFrameworks(appBundlePath, additionalExecutables, useDebugLibs);
if (deploymentInfo.isDebug)
useDebugLibs = true;
if (deployFramework && deploymentInfo.isFramework)
fixupFramework(appBundlePath);
// Convenience: Look for .qml files in the current directory if no -qmldir specified.
if (qmlDirs.isEmpty()) {
QDir dir;
if (!dir.entryList(QStringList() << QStringLiteral("*.qml")).isEmpty()) {
qmlDirs += QStringLiteral(".");
}
}
if (!qmlDirs.isEmpty()) {
bool ok = deployQmlImports(appBundlePath, deploymentInfo, qmlDirs, qmlImportPaths);
if (!ok && qmldirArgumentUsed)
return 1; // exit if the user explicitly asked for qml import deployment
// Update deploymentInfo.deployedFrameworks - the QML imports
// may have brought in extra frameworks as dependencies.
deploymentInfo.deployedFrameworks += findAppFrameworkNames(appBundlePath);
deploymentInfo.deployedFrameworks =
QSet<QString>(deploymentInfo.deployedFrameworks.begin(),
deploymentInfo.deployedFrameworks.end()).values();
}
// Handle plugins
if (plugins) {
// Set the plugins search directory
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
deploymentInfo.pluginPath = QLibraryInfo::path(QLibraryInfo::PluginsPath);
#else
deploymentInfo.pluginPath = QLibraryInfo::location(QLibraryInfo::PluginsPath);
#endif
// Sanity checks
if (deploymentInfo.pluginPath.isEmpty()) {
LogError() << "Missing Qt plugins path\n";
return 1;
}
if (!QDir(deploymentInfo.pluginPath).exists()) {
LogError() << "Plugins path does not exist" << deploymentInfo.pluginPath << "\n";
return 1;
}
// Deploy plugins
Q_ASSERT(!deploymentInfo.pluginPath.isEmpty());
if (!deploymentInfo.pluginPath.isEmpty()) {
LogNormal();
deployPlugins(appBundlePath, deploymentInfo, useDebugLibs);
createQtConf(appBundlePath);
}
}
if (runStripEnabled)
stripAppBinary(appBundlePath);
if (runCodesign)
codesign(codesignIdentiy, appBundlePath);
if (dmg) {
LogNormal();
createDiskImage(appBundlePath, filesystem);
}
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,141 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the tools applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef MAC_DEPLOMYMENT_SHARED_H
#define MAC_DEPLOMYMENT_SHARED_H
#include <QString>
#include <QStringList>
#include <QDebug>
#include <QSet>
#include <QVersionNumber>
extern int logLevel;
#define LogError() if (logLevel < 0) {} else qDebug() << "ERROR:"
#define LogWarning() if (logLevel < 1) {} else qDebug() << "WARNING:"
#define LogNormal() if (logLevel < 2) {} else qDebug() << "Log:"
#define LogDebug() if (logLevel < 3) {} else qDebug() << "Log:"
extern bool runStripEnabled;
class FrameworkInfo
{
public:
bool isDylib;
QString frameworkDirectory;
QString frameworkName;
QString frameworkPath;
QString binaryDirectory;
QString binaryName;
QString binaryPath;
QString rpathUsed;
QString version;
QString installName;
QString deployedInstallName;
QString sourceFilePath;
QString frameworkDestinationDirectory;
QString binaryDestinationDirectory;
bool isDebugLibrary() const
{
return binaryName.endsWith(QStringLiteral("_debug"));
}
};
class DylibInfo
{
public:
QString binaryPath;
QVersionNumber currentVersion;
QVersionNumber compatibilityVersion;
};
class OtoolInfo
{
public:
QString installName;
QString binaryPath;
QVersionNumber currentVersion;
QVersionNumber compatibilityVersion;
QList<DylibInfo> dependencies;
};
bool operator==(const FrameworkInfo &a, const FrameworkInfo &b);
QDebug operator<<(QDebug debug, const FrameworkInfo &info);
class ApplicationBundleInfo
{
public:
QString path;
QString binaryPath;
QStringList libraryPaths;
};
class DeploymentInfo
{
public:
QString qtPath;
QString pluginPath;
QStringList deployedFrameworks;
QList<QString> rpathsUsed;
bool useLoaderPath;
bool isFramework;
bool isDebug;
bool containsModule(const QString &module, const QString &libInFix) const;
};
inline QDebug operator<<(QDebug debug, const ApplicationBundleInfo &info);
OtoolInfo findDependencyInfo(const QString &binaryPath);
FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundlePath, const QList<QString> &rpaths, bool useDebugLibs);
QString findAppBinary(const QString &appBundlePath);
QList<FrameworkInfo> getQtFrameworks(const QString &path, const QString &appBundlePath, const QList<QString> &rpaths, bool useDebugLibs);
QList<FrameworkInfo> getQtFrameworks(const QStringList &otoolLines, const QString &appBundlePath, const QList<QString> &rpaths, bool useDebugLibs);
QString copyFramework(const FrameworkInfo &framework, const QString path);
DeploymentInfo deployQtFrameworks(const QString &appBundlePath, const QStringList &additionalExecutables, bool useDebugLibs);
DeploymentInfo deployQtFrameworks(QList<FrameworkInfo> frameworks,const QString &bundlePath, const QStringList &binaryPaths, bool useDebugLibs, bool useLoaderPath);
void createQtConf(const QString &appBundlePath);
void deployPlugins(const QString &appBundlePath, DeploymentInfo deploymentInfo, bool useDebugLibs);
bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInfo, QStringList &qmlDirs, QStringList &qmlImportPaths);
void changeIdentification(const QString &id, const QString &binaryPath);
void changeInstallName(const QString &oldName, const QString &newName, const QString &binaryPath);
void runStrip(const QString &binaryPath);
void stripAppBinary(const QString &bundlePath);
QString findAppBinary(const QString &appBundlePath);
QStringList findAppFrameworkNames(const QString &appBundlePath);
QStringList findAppFrameworkPaths(const QString &appBundlePath);
void codesignFile(const QString &identity, const QString &filePath);
QSet<QString> codesignBundle(const QString &identity,
const QString &appBundlePath,
QList<QString> additionalBinariesContainingRpaths);
void codesign(const QString &identity, const QString &appBundlePath);
void createDiskImage(const QString &appBundlePath, const QString &filesystemType);
void fixupFramework(const QString &appBundlePath);
#endif

View File

@@ -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)
@@ -116,10 +116,7 @@ if(USE_ICU)
else()
find_package(Iconv)
endif()
find_package(GnuTLS REQUIRED)
if(NOT APPLE)
find_package(Protobuf CONFIG)
endif()
find_package(Protobuf CONFIG)
if(NOT Protobuf_FOUND)
find_package(Protobuf REQUIRED)
endif()
@@ -165,84 +162,52 @@ find_package(FFTW3)
find_package(GTest)
find_library(GMOCK_LIBRARY gmock)
option(QT_VERSION_MAJOR "Qt version to use (5 or 6)")
option(BUILD_WITH_QT5 "Build with Qt 5" OFF)
option(BUILD_WITH_QT6 "Build with Qt 6" OFF)
if(WITH_QT6)
set(BUILD_WITH_QT6 ON)
endif()
if(QT_MAJOR_VERSION)
set(QT_VERSION_MAJOR ${QT_MAJOR_VERSION})
if(BUILD_WITH_QT6)
set(QT_VERSION_MAJOR 6)
elseif(BUILD_WITH_QT5)
set(QT_VERSION_MAJOR 5)
endif()
if(QT_VERSION_MAJOR)
set(QT_DEFAULT_MAJOR_VERSION ${QT_VERSION_MAJOR})
if(NOT QT_VERSION_MAJOR)
message(STATUS "QT_VERSION_MAJOR, BUILD_WITH_QT5 or BUILD_WITH_QT6 not set, detecting Qt version...")
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
endif()
if(QT_VERSION_MAJOR EQUAL 6)
set(QT_MIN_VERSION 6.0)
elseif(QT_VERSION_MAJOR EQUAL 5)
set(QT_MIN_VERSION 5.12)
else()
message(FATAL_ERROR "Invalid QT_VERSION_MAJOR.")
endif()
set(QT_DEFAULT_MAJOR_VERSION ${QT_VERSION_MAJOR})
set(QT_COMPONENTS Core Concurrent Gui Widgets Network Sql)
set(QT_OPTIONAL_COMPONENTS LinguistTools Test)
if(DBUS_FOUND AND NOT WIN32)
list(APPEND QT_COMPONENTS DBus)
endif()
set(QT_OPTIONAL_COMPONENTS Test)
set(QT_MIN_VERSION 5.12)
if(BUILD_WITH_QT6 OR QT_VERSION_MAJOR EQUAL 6)
set(QT_VERSION_MAJOR 6 CACHE STRING "" FORCE)
set(BUILD_WITH_QT6 ON CACHE BOOL "" FORCE)
elseif(BUILD_WITH_QT5 OR QT_VERSION_MAJOR EQUAL 5)
set(QT_VERSION_MAJOR 5 CACHE STRING "" FORCE)
set(BUILD_WITH_QT5 ON CACHE BOOL "" FORCE)
else()
# Automatically detect Qt version.
find_package(QT NAMES Qt6 Qt5 COMPONENTS ${QT_COMPONENTS} REQUIRED)
if(QT_FOUND AND QT_VERSION_MAJOR EQUAL 6)
set(BUILD_WITH_QT6 ON CACHE BOOL "" FORCE)
set(QT_VERSION_MAJOR 6 CACHE STRING "" FORCE)
elseif(QT_FOUND AND QT_VERSION_MAJOR EQUAL 5)
set(BUILD_WITH_QT5 ON CACHE BOOL "" FORCE)
set(QT_VERSION_MAJOR 5 CACHE STRING "" FORCE)
else()
message(FATAL_ERROR "Missing Qt.")
endif()
if(X11_FOUND AND QT_VERSION_MAJOR EQUAL 5)
list(APPEND QT_COMPONENTS X11Extras)
endif()
if(QT_VERSION_MAJOR)
set(QT_DEFAULT_MAJOR_VERSION ${QT_VERSION_MAJOR})
endif()
find_package(Qt${QT_VERSION_MAJOR} ${QT_MIN_VERSION} COMPONENTS ${QT_COMPONENTS} REQUIRED OPTIONAL_COMPONENTS ${QT_OPTIONAL_COMPONENTS})
if(X11_FOUND AND BUILD_WITH_QT5)
list(APPEND QT_OPTIONAL_COMPONENTS X11Extras)
endif()
find_package(Qt${QT_VERSION_MAJOR} ${QT_MIN_VERSION} REQUIRED COMPONENTS ${QT_COMPONENTS} OPTIONAL_COMPONENTS ${QT_OPTIONAL_COMPONENTS})
set(QtCore_LIBRARIES Qt${QT_VERSION_MAJOR}::Core)
set(QtConcurrent_LIBRARIES Qt${QT_VERSION_MAJOR}::Concurrent)
set(QtGui_LIBRARIES Qt${QT_VERSION_MAJOR}::Gui)
set(QtWidgets_LIBRARIES Qt${QT_VERSION_MAJOR}::Widgets)
set(QtNetwork_LIBRARIES Qt${QT_VERSION_MAJOR}::Network)
set(QtSql_LIBRARIES Qt${QT_VERSION_MAJOR}::Sql)
set(QT_LIBRARIES Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Concurrent Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Sql)
if(Qt${QT_VERSION_MAJOR}DBus_FOUND)
set(QtDBus_LIBRARIES Qt${QT_VERSION_MAJOR}::DBus)
list(APPEND QT_LIBRARIES Qt${QT_VERSION_MAJOR}::DBus)
get_target_property(QT_DBUSXML2CPP_EXECUTABLE Qt${QT_VERSION_MAJOR}::qdbusxml2cpp LOCATION)
endif()
if(BUILD_WITH_QT5 AND Qt5X11Extras_FOUND)
set(HAVE_X11EXTRAS ON)
set(QtX11Extras_LIBRARIES Qt5::X11Extras)
list(APPEND QT_LIBRARIES Qt5::X11Extras)
endif()
if(Qt${QT_VERSION_MAJOR}Test_FOUND)
set(QtTest_LIBRARIES Qt${QT_VERSION_MAJOR}::Test)
endif()
find_package(Qt${QT_VERSION_MAJOR} QUIET COMPONENTS LinguistTools CONFIG)
if(Qt${QT_VERSION_MAJOR}LinguistTools_FOUND)
set(QT_LCONVERT_EXECUTABLE Qt${QT_VERSION_MAJOR}::lconvert)
get_target_property(QT_LCONVERT_EXECUTABLE Qt${QT_VERSION_MAJOR}::lconvert LOCATION)
endif()
if(Qt${QT_VERSION_MAJOR}X11Extras_FOUND)
set(HAVE_X11EXTRAS ON)
endif()
if(BUILD_WITH_QT5 AND Qt5Core_VERSION VERSION_LESS 5.15.0)
if(QT_VERSION_MAJOR EQUAL 5 AND Qt5Core_VERSION VERSION_LESS 5.15.0)
macro(qt_add_resources)
qt5_add_resources(${ARGN})
endmacro()
@@ -283,9 +248,9 @@ if(X11_FOUND)
endif()
# Check for QX11Application (Qt 6 compiled with XCB).
if(BUILD_WITH_QT6 AND Qt6Gui_VERSION VERSION_GREATER_EQUAL 6.2.0)
if(QT_VERSION_MAJOR EQUAL 6 AND Qt6Gui_VERSION VERSION_GREATER_EQUAL 6.2.0)
set(CMAKE_REQUIRED_FLAGS "-std=c++17")
set(CMAKE_REQUIRED_LIBRARIES ${QtCore_LIBRARIES} ${QtGui_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui)
check_cxx_source_compiles("
#include <QGuiApplication>
int main() {
@@ -328,30 +293,45 @@ if(USE_TAGPARSER)
pkg_check_modules(TAGPARSER REQUIRED tagparser)
endif()
pkg_check_modules(LIBEBUR128 IMPORTED_TARGET libebur128)
if(NOT TAGLIB_FOUND AND NOT TAGPARSER_FOUND)
message(FATAL_ERROR "You need either TagLib or TagParser!")
endif()
# SingleApplication
add_subdirectory(3rdparty/kdsingleapplication)
set(SINGLEAPPLICATION_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/kdsingleapplication)
set(SINGLEAPPLICATION_LIBRARIES kdsingleapplication)
add_definitions(-DKDSINGLEAPPLICATION_STATIC_BUILD)
if(QT_VERSION_MAJOR EQUAL 5)
set(KDSINGLEAPPLICATION_NAME "KDSingleApplication")
else()
set(KDSINGLEAPPLICATION_NAME "KDSingleApplication-qt${QT_VERSION_MAJOR}")
endif()
find_package(${KDSINGLEAPPLICATION_NAME} 1.1.0)
if(TARGET KDAB::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/KDSingleApplication/src)
set(SINGLEAPPLICATION_LIBRARIES kdsingleapplication)
add_definitions(-DKDSINGLEAPPLICATION_STATIC_BUILD)
endif()
if(APPLE)
add_subdirectory(3rdparty/SPMediaKeyTap)
set(SPMEDIAKEYTAP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/SPMediaKeyTap)
set(SPMEDIAKEYTAP_LIBRARIES SPMediaKeyTap)
add_subdirectory(3rdparty/macdeployqt)
add_subdirectory(ext/macdeploycheck)
endif()
if(WIN32)
if(BUILD_WITH_QT6)
pkg_check_modules(QTSPARKLE qtsparkle-qt6)
else()
pkg_check_modules(QTSPARKLE qtsparkle-qt5)
endif()
pkg_check_modules(QTSPARKLE qtsparkle-qt${QT_VERSION_MAJOR})
if(QTSPARKLE_FOUND)
set(HAVE_QTSPARKLE ON)
endif()
@@ -385,6 +365,7 @@ optional_component(LIBPULSE ON "PulseAudio integration"
optional_component(DBUS ON "D-Bus support"
DEPENDS "D-Bus" DBUS_FOUND
DEPENDS "Qt D-Bus" Qt${QT_VERSION_MAJOR}DBus_FOUND
)
optional_component(GSTREAMER ON "Engine: GStreamer backend"
@@ -410,7 +391,7 @@ optional_component(MUSICBRAINZ ON "MusicBrainz integration"
DEPENDS "gstreamer" HAVE_GSTREAMER
)
if(X11_FOUND OR HAVE_DBUS OR APPLE OR WIN32)
if(X11_FOUND OR (HAVE_DBUS AND Qt${QT_VERSION_MAJOR}DBus_FOUND) OR APPLE OR WIN32)
set(HAVE_GLOBALSHORTCUTS_SUPPORT ON)
endif()
@@ -432,7 +413,8 @@ optional_component(AUDIOCD ON "Devices: Audio CD support"
)
optional_component(UDISKS2 ON "Devices: UDisks2 backend"
DEPENDS "D-Bus support" DBUS_FOUND
DEPENDS "D-Bus" DBUS_FOUND
DEPENDS "Qt D-Bus" Qt${QT_VERSION_MAJOR}DBus_FOUND
)
optional_component(GIO ON "Devices: GIO device backend"
@@ -442,7 +424,7 @@ optional_component(GIO ON "Devices: GIO device backend"
optional_component(GIO_UNIX ON "Devices: GIO device backend (Unix support)"
DEPENDS "libgio-unix" GIO_UNIX_FOUND
DEPENDS "Unix" "UNIX"
DEPENDS "Unix or Windows" "NOT APPLE"
)
optional_component(LIBGPOD ON "Devices: iPod classic support"
@@ -454,17 +436,10 @@ optional_component(LIBMTP ON "Devices: MTP support"
DEPENDS "libmtp" LIBMTP_FOUND
)
if(BUILD_WITH_QT6)
optional_component(TRANSLATIONS ON "Translations"
DEPENDS "gettext" GETTEXT_FOUND
DEPENDS "Qt6LinguistTools" Qt6LinguistTools_FOUND
)
else()
optional_component(TRANSLATIONS ON "Translations"
DEPENDS "gettext" GETTEXT_FOUND
DEPENDS "Qt5LinguistTools" Qt5LinguistTools_FOUND
)
endif()
optional_component(TRANSLATIONS ON "Translations"
DEPENDS "gettext" GETTEXT_FOUND
DEPENDS "Qt LinguistTools" Qt${QT_VERSION_MAJOR}LinguistTools_FOUND
)
option(INSTALL_TRANSLATIONS "Install translations" OFF)
@@ -477,25 +452,22 @@ optional_component(MOODBAR ON "Moodbar"
DEPENDS "gstreamer" HAVE_GSTREAMER
)
if(APPLE OR WIN32)
option(USE_BUNDLE "Bundle dependencies" ON)
else()
option(USE_BUNDLE "Bundle dependencies" OFF)
endif()
optional_component(EBUR128 ON "EBU R 128 loudness normalization"
DEPENDS "libebur128" LIBEBUR128_FOUND
DEPENDS "gstreamer" HAVE_GSTREAMER
)
if(USE_BUNDLE AND NOT USE_BUNDLE_DIR)
if(LINUX)
set(USE_BUNDLE_DIR "../plugins")
endif()
if(APPLE)
set(USE_BUNDLE_DIR "../PlugIns")
endif()
if(APPLE OR WIN32)
set(USE_BUNDLE_DEFAULT ON)
else()
set(USE_BUNDLE_DEFAULT OFF)
endif()
option(USE_BUNDLE "Bundle dependencies" ${USE_BUNDLE_DEFAULT})
if(NOT CMAKE_CROSSCOMPILING)
# Check that we have Qt with sqlite driver
set(CMAKE_REQUIRED_FLAGS "-std=c++17")
set(CMAKE_REQUIRED_LIBRARIES ${QtCore_LIBRARIES} ${QtSql_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Sql)
check_cxx_source_runs("
#include <QSqlDatabase>
#include <QSqlQuery>
@@ -561,7 +533,7 @@ if(HAVE_MOODBAR)
add_subdirectory(ext/gstmoodbar)
endif()
if(GTest_FOUND AND GMOCK_LIBRARY AND QtTest_LIBRARIES)
if(GTest_FOUND AND GMOCK_LIBRARY AND Qt${QT_VERSION_MAJOR}Test_FOUND)
add_subdirectory(tests)
endif()

View File

@@ -2,6 +2,86 @@ 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:
* Fixed seekbar position resetting to zero before showing actual position when seeking.
* Fixed compressed files showing up in collection (#1274).
* Fixed connecting devices (#1288).
* Fixed device schema missing ebur128 fields.
* Fixed collection search by tag not working with space between colon and search term (#1290).
* Fixed seeking when 5 seconds is remaining of the song resetting position to beginning (#1258).
* Fixed intermittent crash when seeking with Auto as output (#1123).
* (Windows) Fixed playlist header colors in dark mode (#1275).
Enhancements:
* Support using system KDSingleApplication when available.
* Improved lyrics matching.
* (macOS) Fully codesign binaries and DMG.
Version 1.0.20 (2023.09.24):
Bugfixes:
* Fixed appdata validation.
Version 1.0.19 (2023.09.24):
Bugfixes:
* Use shared pointers for objects to fix potential crashes on exit (#1239).
* Fixed smart playlist search not matching unrated songs (#1244).
* Fixed reading FMPS_Playcount for MP3 ID3v2 tags (#1248).
* Always stop playing after 100 errors to prevent flooding the error dialog (#1220).
* Fixed volume going to 100% when decreasing volume beyond zero (#1262).
* Fixed error dialog sometimes showing empty.
* (Windows) Removed broken volume sync (#1220).
* (Windows) Fixed shuttering / choppy audio (#1227).
* (macOS) Fixed missing search bars (#1221).
Enhancements:
* Add Mpris2 property to read/write rating (#1246).
* Capitalize playlist column names (#1264).
* Added lyrics from songlyrics.com, azlyrics.com, elyrics.net and lyricsmode.com.
* (Windows) Add gst-play-1.0.exe for debugging purposes.
New features
* Support performing song loudness analysis using `libebur128` (#1216).
* Support song playback loudness normalization, as per EBU R 128 (#1216).
Other:
* Removed last.fm HTTPS workaround and GnuTLS dependency
* Removed broken lyrics.com lyrics provider.
* (Windows) Use DirectSound as default sink.
* (Windows) Remove WASPI2 plugin because of GStreamer bug.
Version 1.0.18 (2023.07.02):
Bugfixes:

View File

@@ -21,25 +21,27 @@ 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.
* For technical problems, discussion, questions and feature suggestions use the forum (https://forum.strawberrymusicplayer.org/) instead. The forum is better suited for discussion.
* 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. [PayPal](https://paypal.me/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.
@@ -48,10 +50,11 @@ Funding developers is a way to contribute to open source projects you appreciate
* Playlist management
* Smart and dynamic playlists
* Advanced audio output and device configuration for bit-perfect playback on Linux
* In-player song loudness analysis and song playback loudness normalization, as per EBU R 128
* Edit tags on audio files
* Fetch tags from MusicBrainz
* Album cover art from [Last.fm](https://www.last.fm/), [Musicbrainz](https://musicbrainz.org/), [Discogs](https://www.discogs.com/), [Musixmatch](https://www.musixmatch.com/), [Deezer](https://www.deezer.com/), [Tidal](https://www.tidal.com/), [Qobuz](https://www.qobuz.com/) and [Spotify](https://www.spotify.com/)
* Song lyrics from [Lyrics.com](https://www.lyrics.com/), [Genius](https://genius.com/), [Musixmatch](https://www.musixmatch.com/), [ChartLyrics](http://www.chartlyrics.com/), [lyrics.ovh](https://lyrics.ovh/) and [lololyrics.com](https://www.lololyrics.com/)
* Song lyrics from [Genius](https://genius.com/), [Musixmatch](https://www.musixmatch.com/), [ChartLyrics](http://www.chartlyrics.com/), [lyrics.ovh](https://lyrics.ovh/), [lololyrics.com](https://www.lololyrics.com/), [songlyrics.com](https://www.songlyrics.com/), [azlyrics.com](https://www.azlyrics.com/), [elyrics.net](https://www.elyrics.net/) and [lyricsmode.com](https://www.lyricsmode.com/)
* Support for multiple backends
* Audio analyzer
* Audio equalizer
@@ -62,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.
**There currently isn't any macOS developers actively working on this project, so we might not be able to help you with issues related to macOS.**
**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
@@ -79,7 +82,6 @@ To build Strawberry from source you need the following installed on your system
* [ALSA (Required on Linux)](https://www.alsa-project.org/)
* [D-Bus (Required on Linux)](https://www.freedesktop.org/wiki/Software/dbus/)
* [GStreamer](https://gstreamer.freedesktop.org/) or [VLC](https://www.videolan.org)
* [GnuTLS](https://www.gnutls.org/)
* [TagLib 1.11.1 or higher](https://www.taglib.org/) or [TagParser](https://github.com/Martchus/tagparser)
* [ICU](https://unicode-org.github.io/icu/)
@@ -91,6 +93,7 @@ Optional dependencies:
* Audio CD: [libcdio](https://www.gnu.org/software/libcdio/)
* MTP devices: [libmtp](http://libmtp.sourceforge.net/)
* iPod Classic devices: [libgpod](http://www.gtkpod.org/libgpod/)
* EBU R 128 loudness normalization [libebur128](https://github.com/jiixyj/libebur128)
You should also install the gstreamer plugins base and good, and optionally bad, ugly and libav to support all audio formats.
@@ -98,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:

View File

@@ -1,5 +1,4 @@
#find_program(MACDEPLOYQT_EXECUTABLE NAMES macdeployqt PATHS /usr/local/opt/qt6/bin /usr/local/opt/qt5/bin /usr/local/bin REQUIRED)
set(MACDEPLOYQT_EXECUTABLE "${CMAKE_BINARY_DIR}/3rdparty/macdeployqt/macdeployqt")
find_program(MACDEPLOYQT_EXECUTABLE NAMES macdeployqt PATHS /usr/bin /usr/local/bin /opt/local/bin /usr/local/opt/qt6/bin /usr/local/opt/qt5/bin REQUIRED)
if(MACDEPLOYQT_EXECUTABLE)
message(STATUS "Found macdeployqt: ${MACDEPLOYQT_EXECUTABLE}")
else()
@@ -14,16 +13,23 @@ else()
endif()
if(MACDEPLOYQT_EXECUTABLE)
add_custom_target(copy_gstreamer_plugins
#COMMAND ${CMAKE_SOURCE_DIR}/dist/macos/macgstcopy.sh strawberry.app
)
if(APPLE_DEVELOPER_ID)
set(MACDEPLOYQT_CODESIGN -codesign=${APPLE_DEVELOPER_ID})
set(CREATEDMG_CODESIGN --codesign ${APPLE_DEVELOPER_ID})
endif()
if(CREATEDMG_SKIP_JENKINS)
set(CREATEDMG_SKIP_JENKINS_ARG "--skip-jenkins")
endif()
add_custom_target(deploy
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/strawberry.app/Contents/{Frameworks,Resources}
COMMAND cp -v ${CMAKE_SOURCE_DIR}/dist/macos/Info.plist ${CMAKE_BINARY_DIR}/strawberry.app/Contents/
COMMAND cp -v ${CMAKE_SOURCE_DIR}/dist/macos/strawberry.icns ${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources/
COMMAND ${MACDEPLOYQT_EXECUTABLE} strawberry.app -verbose=3 -executable=${CMAKE_BINARY_DIR}/strawberry.app/Contents/PlugIns/strawberry-tagreader
COMMAND ${CMAKE_SOURCE_DIR}/dist/macos/macgstcopy.sh ${CMAKE_BINARY_DIR}/strawberry.app
COMMAND ${MACDEPLOYQT_EXECUTABLE} strawberry.app -verbose=3 -executable=${CMAKE_BINARY_DIR}/strawberry.app/Contents/PlugIns/strawberry-tagreader -executable=${CMAKE_BINARY_DIR}/strawberry.app/Contents/PlugIns/gst-plugin-scanner ${MACDEPLOYQT_CODESIGN}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS strawberry strawberry-tagreader copy_gstreamer_plugins macdeployqt
DEPENDS strawberry strawberry-tagreader
)
add_custom_target(deploycheck
COMMAND ${CMAKE_BINARY_DIR}/ext/macdeploycheck/macdeploycheck strawberry.app
@@ -31,9 +37,8 @@ if(MACDEPLOYQT_EXECUTABLE)
)
if(CREATEDMG_EXECUTABLE)
add_custom_target(dmg
COMMAND ${CREATEDMG_EXECUTABLE} --volname strawberry --background "${CMAKE_SOURCE_DIR}/dist/macos/dmg_background.png" --app-drop-link 450 218 --icon strawberry.app 150 218 --window-size 600 450 strawberry-${STRAWBERRY_VERSION_PACKAGE}-${CMAKE_HOST_SYSTEM_PROCESSOR}.dmg strawberry.app
COMMAND ${CREATEDMG_EXECUTABLE} --volname strawberry --background "${CMAKE_SOURCE_DIR}/dist/macos/dmg_background.png" --app-drop-link 450 218 --icon strawberry.app 150 218 --window-size 600 450 ${CREATEDMG_CODESIGN} ${CREATEDMG_SKIP_JENKINS_ARG} strawberry-${STRAWBERRY_VERSION_PACKAGE}-${CMAKE_HOST_SYSTEM_PROCESSOR}.dmg strawberry.app
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS deploy deploycheck
)
endif()
endif()

View File

@@ -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}
)

View File

@@ -1,6 +1,6 @@
set(STRAWBERRY_VERSION_MAJOR 1)
set(STRAWBERRY_VERSION_MINOR 0)
set(STRAWBERRY_VERSION_PATCH 18)
set(STRAWBERRY_VERSION_PATCH 23)
#set(STRAWBERRY_VERSION_PRERELEASE rc1)
set(INCLUDE_GIT_REVISION OFF)
@@ -25,7 +25,7 @@ if(INCLUDE_GIT_REVISION AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
find_program(GIT_EXECUTABLE git)
if(NOT GIT_EXECUTABLE OR GIT_EXECUTABLE-NOTFOUND)
message(FATAL_ERROR "Missing GIT executable." )
message(FATAL_ERROR "Missing Git executable." )
endif()
# Get the current working branch
@@ -48,7 +48,7 @@ if(INCLUDE_GIT_REVISION AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
)
if(NOT ${GIT_CMD_RESULT_REVISION} EQUAL 0)
message(FATAL_ERROR "GIT command failed to get revision string '${GIT_REVISION}'")
message(FATAL_ERROR "Git command failed to get revision string '${GIT_REVISION}'")
endif()
endif()
@@ -67,7 +67,7 @@ if(GIT_REVISION)
list(LENGTH GIT_PARTS GIT_PARTS_LENGTH)
if(NOT GIT_PARTS_LENGTH EQUAL 3)
message(FATAL_ERROR "Failed to parse git revision string '${GIT_REVISION}'")
set(GIT_PARTS "${majorminorpatch};0;${GIT_REVISION}")
endif()
list(GET GIT_PARTS 0 GIT_TAGNAME)

View File

@@ -9,6 +9,7 @@
<file>schema/schema-15.sql</file>
<file>schema/schema-16.sql</file>
<file>schema/schema-17.sql</file>
<file>schema/schema-18.sql</file>
<file>schema/device-schema.sql</file>
<file>style/strawberry.css</file>
<file>style/smartplaylistsearchterm.css</file>

View File

@@ -18,7 +18,7 @@ CREATE TABLE device_%deviceid_songs (
track INTEGER NOT NULL DEFAULT -1,
disc INTEGER NOT NULL DEFAULT -1,
year INTEGER NOT NULL DEFAULT -1,
originalyear INTEGER NOT NULL DEFAULT 0,
originalyear INTEGER NOT NULL DEFAULT -1,
genre TEXT,
compilation INTEGER NOT NULL DEFAULT 0,
composer TEXT,
@@ -83,7 +83,10 @@ CREATE TABLE device_%deviceid_songs (
musicbrainz_track_id TEXT,
musicbrainz_disc_id TEXT,
musicbrainz_release_group_id TEXT,
musicbrainz_work_id TEXT
musicbrainz_work_id TEXT,
ebur128_integrated_loudness_lufs REAL,
ebur128_loudness_range_lu REAL
);
@@ -96,4 +99,4 @@ CREATE VIRTUAL TABLE device_%deviceid_fts USING fts5(
tokenize = "unicode61 remove_diacritics 1"
);
UPDATE devices SET schema_version=4 WHERE ROWID=%deviceid;
UPDATE devices SET schema_version=5 WHERE ROWID=%deviceid;

37
data/schema/schema-18.sql Normal file
View File

@@ -0,0 +1,37 @@
ALTER TABLE songs ADD COLUMN ebur128_integrated_loudness_lufs REAL;
ALTER TABLE songs ADD COLUMN ebur128_loudness_range_lu REAL;
ALTER TABLE subsonic_songs ADD COLUMN ebur128_integrated_loudness_lufs REAL;
ALTER TABLE subsonic_songs ADD COLUMN ebur128_loudness_range_lu REAL;
ALTER TABLE tidal_artists_songs ADD COLUMN ebur128_integrated_loudness_lufs REAL;
ALTER TABLE tidal_artists_songs ADD COLUMN ebur128_loudness_range_lu REAL;
ALTER TABLE tidal_albums_songs ADD COLUMN ebur128_integrated_loudness_lufs REAL;
ALTER TABLE tidal_albums_songs ADD COLUMN ebur128_loudness_range_lu REAL;
ALTER TABLE tidal_songs ADD COLUMN ebur128_integrated_loudness_lufs REAL;
ALTER TABLE tidal_songs ADD COLUMN ebur128_loudness_range_lu REAL;
ALTER TABLE qobuz_artists_songs ADD COLUMN ebur128_integrated_loudness_lufs REAL;
ALTER TABLE qobuz_artists_songs ADD COLUMN ebur128_loudness_range_lu REAL;
ALTER TABLE qobuz_albums_songs ADD COLUMN ebur128_integrated_loudness_lufs REAL;
ALTER TABLE qobuz_albums_songs ADD COLUMN ebur128_loudness_range_lu REAL;
ALTER TABLE qobuz_songs ADD COLUMN ebur128_integrated_loudness_lufs REAL;
ALTER TABLE qobuz_songs ADD COLUMN ebur128_loudness_range_lu REAL;
ALTER TABLE playlist_items ADD COLUMN ebur128_integrated_loudness_lufs REAL;
ALTER TABLE playlist_items ADD COLUMN ebur128_loudness_range_lu REAL;
UPDATE schema_version SET version=18;

View File

@@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS schema_version (
DELETE FROM schema_version;
INSERT INTO schema_version (version) VALUES (17);
INSERT INTO schema_version (version) VALUES (18);
CREATE TABLE IF NOT EXISTS directories (
path TEXT NOT NULL,
@@ -91,7 +91,10 @@ CREATE TABLE IF NOT EXISTS songs (
musicbrainz_track_id TEXT,
musicbrainz_disc_id TEXT,
musicbrainz_release_group_id TEXT,
musicbrainz_work_id TEXT
musicbrainz_work_id TEXT,
ebur128_integrated_loudness_lufs REAL,
ebur128_loudness_range_lu REAL
);
@@ -169,7 +172,10 @@ CREATE TABLE IF NOT EXISTS subsonic_songs (
musicbrainz_track_id TEXT,
musicbrainz_disc_id TEXT,
musicbrainz_release_group_id TEXT,
musicbrainz_work_id TEXT
musicbrainz_work_id TEXT,
ebur128_integrated_loudness_lufs REAL,
ebur128_loudness_range_lu REAL
);
@@ -247,7 +253,10 @@ CREATE TABLE IF NOT EXISTS tidal_artists_songs (
musicbrainz_track_id TEXT,
musicbrainz_disc_id TEXT,
musicbrainz_release_group_id TEXT,
musicbrainz_work_id TEXT
musicbrainz_work_id TEXT,
ebur128_integrated_loudness_lufs REAL,
ebur128_loudness_range_lu REAL
);
@@ -325,7 +334,10 @@ CREATE TABLE IF NOT EXISTS tidal_albums_songs (
musicbrainz_track_id TEXT,
musicbrainz_disc_id TEXT,
musicbrainz_release_group_id TEXT,
musicbrainz_work_id TEXT
musicbrainz_work_id TEXT,
ebur128_integrated_loudness_lufs REAL,
ebur128_loudness_range_lu REAL
);
@@ -403,7 +415,10 @@ CREATE TABLE IF NOT EXISTS tidal_songs (
musicbrainz_track_id TEXT,
musicbrainz_disc_id TEXT,
musicbrainz_release_group_id TEXT,
musicbrainz_work_id TEXT
musicbrainz_work_id TEXT,
ebur128_integrated_loudness_lufs REAL,
ebur128_loudness_range_lu REAL
);
@@ -481,7 +496,10 @@ CREATE TABLE IF NOT EXISTS qobuz_artists_songs (
musicbrainz_track_id TEXT,
musicbrainz_disc_id TEXT,
musicbrainz_release_group_id TEXT,
musicbrainz_work_id TEXT
musicbrainz_work_id TEXT,
ebur128_integrated_loudness_lufs REAL,
ebur128_loudness_range_lu REAL
);
@@ -559,7 +577,10 @@ CREATE TABLE IF NOT EXISTS qobuz_albums_songs (
musicbrainz_track_id TEXT,
musicbrainz_disc_id TEXT,
musicbrainz_release_group_id TEXT,
musicbrainz_work_id TEXT
musicbrainz_work_id TEXT,
ebur128_integrated_loudness_lufs REAL,
ebur128_loudness_range_lu REAL
);
@@ -637,7 +658,10 @@ CREATE TABLE IF NOT EXISTS qobuz_songs (
musicbrainz_track_id TEXT,
musicbrainz_disc_id TEXT,
musicbrainz_release_group_id TEXT,
musicbrainz_work_id TEXT
musicbrainz_work_id TEXT,
ebur128_integrated_loudness_lufs REAL,
ebur128_loudness_range_lu REAL
);
@@ -735,7 +759,10 @@ CREATE TABLE IF NOT EXISTS playlist_items (
musicbrainz_track_id TEXT,
musicbrainz_disc_id TEXT,
musicbrainz_release_group_id TEXT,
musicbrainz_work_id TEXT
musicbrainz_work_id TEXT,
ebur128_integrated_loudness_lufs REAL,
ebur128_loudness_range_lu REAL
);

View File

@@ -5,11 +5,11 @@ if(LSB_RELEASE_EXEC AND DPKG_BUILDPACKAGE)
if(DEB_CODENAME AND DEB_DATE)
if(BUILD_WITH_QT5)
if(QT_VERSION_MAJOR EQUAL 5)
set(DEBIAN_BUILD_DEPENDS_QT_PACKAGES qtbase5-dev,qtbase5-dev-tools,qttools5-dev,qttools5-dev-tools,libqt5x11extras5-dev)
set(DEBIAN_DEPENDS_QT_PACKAGES libqt5sql5-sqlite)
endif()
if(BUILD_WITH_QT6)
if(QT_VERSION_MAJOR EQUAL 6)
set(DEBIAN_BUILD_DEPENDS_QT_PACKAGES qt6-base-dev,qt6-base-dev-tools,qt6-tools-dev,qt6-tools-dev-tools,qt6-l10n-tools)
set(DEBIAN_DEPENDS_QT_PACKAGES libqt6sql6-sqlite,qt6-qpa-plugins)
endif()

6
debian/control.in vendored
View File

@@ -11,7 +11,6 @@ Build-Depends: debhelper (>= 11),
protobuf-compiler,
libglib2.0-dev,
libdbus-1-dev,
libgnutls28-dev,
libprotobuf-dev,
libboost-dev,
libsqlite3-dev,
@@ -26,7 +25,8 @@ Build-Depends: debhelper (>= 11),
libgpod-dev,
libmtp-dev,
libchromaprint-dev,
libfftw3-dev
libfftw3-dev,
libebur128-dev
Standards-Version: 4.6.1
Package: strawberry
@@ -53,7 +53,7 @@ Description: music player and music collection organizer
- Edit tags on audio files
- Automatically retrieve tags from MusicBrainz
- Album cover art from Last.fm, Musicbrainz, Discogs, Musixmatch, Deezer, Tidal, Qobuz and Spotify
- Song lyrics from Lyrics.com, Genius, Musixmatch, ChartLyrics, lyrics.ovh and lololyrics.com
- Song lyrics from Genius, Musixmatch, ChartLyrics, lyrics.ovh, lololyrics.com, songlyrics.com, azlyrics.com, elyrics.net and lyricsmode.com
- Audio analyzer
- Audio equalizer
- Transfer music to mass-storage USB players, MTP compatible devices and iPod Nano/Classic

View File

@@ -1,6 +1,6 @@
#!/bin/sh
# Script to copy gstreamer plugins before macdeployqt is run.
# Script to copy gio modules and gstreamer plugins before macdeployqt is run.
if [ "$1" = "" ]; then
echo "Usage: $0 <bundledir>"
@@ -8,104 +8,141 @@ if [ "$1" = "" ]; then
fi
bundledir=$1
if [ "$GIO_EXTRA_MODULES" = "" ]; then
echo "Error: Set the GIO_EXTRA_MODULES environment variable to the path containing libgiognutls.so."
if [ "${GIO_EXTRA_MODULES}" = "" ]; then
echo "Error: Set the GIO_EXTRA_MODULES environment variable to the path containing gio modules."
exit 1
fi
if [ "$GST_PLUGIN_SCANNER" = "" ]; then
if [ "${GST_PLUGIN_SCANNER}" = "" ]; then
echo "Error: Set the GST_PLUGIN_SCANNER environment variable to the gst-plugin-scanner."
exit 1
fi
if [ "$GST_PLUGIN_PATH" = "" ]; then
if [ "${GST_PLUGIN_PATH}" = "" ]; then
echo "Error: Set the GST_PLUGIN_PATH environment variable to the path containing gstreamer plugins."
exit 1
fi
if ! [ -e "${GIO_EXTRA_MODULES}/libgiognutls.so" ] && ! [ -e "${GIO_EXTRA_MODULES}/libgioopenssl.so" ]; then
echo "Error: Missing ${GIO_EXTRA_MODULES}/libgiognutls.so or ${GIO_EXTRA_MODULES}/libgioopenssl.so."
exit 1
fi
if ! [ -e "${GST_PLUGIN_SCANNER}" ]; then
echo "Error: Missing ${GST_PLUGIN_SCANNER}"
exit 1
fi
if ! [ -d "${GST_PLUGIN_PATH}" ]; then
echo "Error: GStreamer plugins path ${GST_PLUGIN_PATH} does not exist."
exit 1
fi
if ! [ -e "${GST_PLUGIN_PATH}/libgstcoreelements.so" ] && ! [ -e "${GST_PLUGIN_PATH}/libgstcoreelements.dylib" ]; then
echo "Error: Missing libgstcoreelements.{so,dylib} in GStreamer plugins path ${GST_PLUGIN_PATH}."
exit 1
fi
mkdir -p "${bundledir}/Contents/PlugIns/gio-modules" || exit 1
mkdir -p "${bundledir}/Contents/PlugIns/gstreamer" || exit 1
if ! [ -f "${GIO_EXTRA_MODULES}/libgiognutls.so" ]; then
echo "Error: Missing ${GIO_EXTRA_MODULES}/libgiognutls.so."
exit 1
if [ -e "${GIO_EXTRA_MODULES}/libgiognutls.so" ]; then
cp -v -f "${GIO_EXTRA_MODULES}/libgiognutls.so" "${bundledir}/Contents/PlugIns/gio-modules/" || exit 1
else
echo "Warning: Missing ${GIO_EXTRA_MODULES}/libgiognutls.so."
fi
cp -v -f "${GIO_EXTRA_MODULES}/libgiognutls.so" "${bundledir}/Contents/PlugIns/gio-modules/" || exit 1
if ! [ -f "${GST_PLUGIN_SCANNER}" ]; then
echo "Error: Missing ${GST_PLUGIN_SCANNER}"
exit 1
if [ -e "${GIO_EXTRA_MODULES}/libgioopenssl.so" ]; then
cp -v -f "${GIO_EXTRA_MODULES}/libgioopenssl.so" "${bundledir}/Contents/PlugIns/gio-modules/" || exit 1
else
echo "Warning: Missing ${GIO_EXTRA_MODULES}/libgioopenssl.so"
fi
cp -v -f "${GST_PLUGIN_SCANNER}" "${bundledir}/Contents/PlugIns/" || exit 1
install_name_tool -add_rpath "@loader_path/../Frameworks" "${bundledir}/Contents/PlugIns/$(basename ${GST_PLUGIN_SCANNER})" || exit 1
gst_plugins="
libgstaes.dylib
libgstaiff.dylib
libgstapetag.dylib
libgstapp.dylib
libgstasf.dylib
libgstasfmux.dylib
libgstaudioconvert.dylib
libgstaudiofx.dylib
libgstaudiomixer.dylib
libgstaudioparsers.dylib
libgstaudiorate.dylib
libgstaudioresample.dylib
libgstaudiotestsrc.dylib
libgstautodetect.dylib
libgstbs2b.dylib
libgstcdio.dylib
libgstcoreelements.dylib
libgstdash.dylib
libgstequalizer.dylib
libgstflac.dylib
libgstfaac.dylib
libgstfaad.dylib
libgstfdkaac.dylib
libgstgio.dylib
libgsticydemux.dylib
libgstid3demux.dylib
libgstisomp4.dylib
libgstlame.dylib
libgstlibav.dylib
libgstmpg123.dylib
libgstmusepack.dylib
libgstogg.dylib
libgstopenmpt.dylib
libgstopus.dylib
libgstopusparse.dylib
libgstosxaudio.dylib
libgstpbtypes.dylib
libgstplayback.dylib
libgstreplaygain.dylib
libgstrtp.dylib
libgstrtsp.dylib
libgstsoup.dylib
libgstspectrum.dylib
libgstspeex.dylib
libgsttaglib.dylib
libgsttcp.dylib
libgsttypefindfunctions.dylib
libgstudp.dylib
libgstvolume.dylib
libgstvorbis.dylib
libgstwavpack.dylib
libgstwavparse.dylib
libgstxingmux.dylib;
libgstaes
libgstaiff
libgstapetag
libgstapp
libgstasf
libgstasfmux
libgstaudioconvert
libgstaudiofx
libgstaudiomixer
libgstaudioparsers
libgstaudiorate
libgstaudioresample
libgstaudiotestsrc
libgstautodetect
libgstbs2b
libgstcdio
libgstcoreelements
libgstdash
libgstequalizer
libgstfaac
libgstfaad
libgstfdkaac
libgstflac
libgstgio
libgsthls
libgsticydemux
libgstid3demux
libgstid3tag
libgstisomp4
libgstlame
libgstlibav
libgstmpg123
libgstmusepack
libgstogg
libgstopenmpt
libgstopus
libgstopusparse
libgstosxaudio
libgstpbtypes
libgstplayback
libgstreplaygain
libgstrtp
libgstrtsp
libgstsoup
libgstspectrum
libgstspeex
libgsttaglib
libgsttcp
libgsttwolame
libgsttypefindfunctions
libgstudp
libgstvolume
libgstvorbis
libgstwavenc
libgstwavpack
libgstwavparse
libgstxingmux
"
gst_plugins=$(echo "$gst_plugins" | tr '\n' ' ' | sed -e 's/^ //g' | sed -e 's/ / /g')
for gst_plugin in $gst_plugins
do
if [ -f "${GST_PLUGIN_PATH}/${gst_plugin}" ]; then
cp -v -f "${GST_PLUGIN_PATH}/${gst_plugin}" "${bundledir}/Contents/PlugIns/gstreamer/" || exit 1
for gst_plugin in $gst_plugins; do
if [ -e "${GST_PLUGIN_PATH}/${gst_plugin}.dylib" ]; then
cp -v -f "${GST_PLUGIN_PATH}/${gst_plugin}.dylib" "${bundledir}/Contents/PlugIns/gstreamer/" || exit 1
install_name_tool -id "@rpath/${gst_plugin}.dylib" "${bundledir}/Contents/PlugIns/gstreamer/${gst_plugin}.dylib"
elif [ -e "${GST_PLUGIN_PATH}/${gst_plugin}.so" ]; then
cp -v -f "${GST_PLUGIN_PATH}/${gst_plugin}.so" "${bundledir}/Contents/PlugIns/gstreamer/" || exit 1
install_name_tool -id "@rpath/${gst_plugin}.so" "${bundledir}/Contents/PlugIns/gstreamer/${gst_plugin}.so"
else
echo "Warning: Missing gstreamer plugin ${GST_PLUGIN_PATH}/${gst_plugin}"
echo "Warning: Missing gstreamer plugin ${gst_plugin}."
fi
done
if [ -f "/usr/local/lib/libbrotlicommon.1.dylib" ]; then
mkdir -p ${bundledir}/Contents/Frameworks
cp -v -f "/usr/local/lib/libbrotlicommon.1.dylib" "${bundledir}/Contents/Frameworks/"
# libsoup is dynamically loaded by gstreamer, so it needs to be copied.
if [ "${LIBSOUP_LIBRARY_PATH}" = "" ]; then
echo "Warning: Set the LIBSOUP_LIBRARY_PATH environment variable for copying libsoup."
else
if [ -e "${LIBSOUP_LIBRARY_PATH}" ]; then
mkdir -p "${bundledir}/Contents/Frameworks" || exit 1
cp -v -f "${LIBSOUP_LIBRARY_PATH}" "${bundledir}/Contents/Frameworks/" || exit 1
install_name_tool -id "@rpath/$(basename ${LIBSOUP_LIBRARY_PATH})" "${bundledir}/Contents/Frameworks/$(basename ${LIBSOUP_LIBRARY_PATH})"
else
echo "Warning: Missing libsoup ${LIBSOUP_LIBRARY_PATH}."
fi
fi

View File

@@ -29,7 +29,7 @@
<li>Edit tags on audio files</li>
<li>Automatically retrieve tags from MusicBrainz</li>
<li>Album cover art from Last.fm, Musicbrainz, Discogs, Musixmatch, Deezer, Tidal, Qobuz and Spotify</li>
<li>Song lyrics from Lyrics.com, Genius, Musixmatch, ChartLyrics, lyrics.ovh and lololyrics.com</li>
<li>Song lyrics from Genius, Musixmatch, ChartLyrics, lyrics.ovh, lololyrics.com, songlyrics.com, azlyrics.com, elyrics.net and lyricsmode.com</li>
<li>Support for multiple backends</li>
<li>Audio analyzer and equalizer</li>
<li>Transfer music to mass-storage USB players, MTP compatible devices and iPod Nano/Classic</li>
@@ -50,6 +50,11 @@
</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"/>
<release version="1.0.18" date="2023-07-02"/>
</releases>
</component>

View File

@@ -1,9 +1,9 @@
Name: strawberry
Version: @STRAWBERRY_VERSION_RPM_V@
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos} || "%{?_vendor}" == "openmandriva"
Release: @STRAWBERRY_VERSION_RPM_R@%{?dist}
%else
%if 0%{?suse_version}
Release: @STRAWBERRY_VERSION_RPM_R@.@RPM_DISTRO@
%else
Release: @STRAWBERRY_VERSION_RPM_R@%{?dist}
%endif
Summary: A music player and music collection organizer
Group: Productivity/Multimedia/Sound/Players
@@ -11,7 +11,7 @@ License: GPL-3.0+
URL: https://www.strawberrymusicplayer.org/
Source0: %{name}-@STRAWBERRY_VERSION_PACKAGE@.tar.xz
%if 0%{?suse_version} && 0%{?suse_version} > 1325
%if 0%{?suse_version}
BuildRequires: libboost_headers-devel
%else
BuildRequires: boost-devel
@@ -25,15 +25,13 @@ BuildRequires: gettext
BuildRequires: desktop-file-utils
%if 0%{?suse_version}
BuildRequires: update-desktop-files
%endif
%if 0%{?suse_version}
BuildRequires: appstream-glib
%else
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos}
%endif
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos}
BuildRequires: libappstream-glib
%else
%endif
%if 0%{?mageia} || "%{?_vendor}" == "openmandriva"
BuildRequires: appstream-util
%endif
%endif
BuildRequires: pkgconfig
BuildRequires: pkgconfig(glib-2.0)
@@ -41,52 +39,34 @@ BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(gio-unix-2.0)
BuildRequires: pkgconfig(gthread-2.0)
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(gnutls)
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(protobuf)
BuildRequires: pkgconfig(sqlite3) >= 3.9
%if ! 0%{?centos} && ! 0%{?mageia}
BuildRequires: pkgconfig(taglib)
%endif
BuildRequires: pkgconfig(fftw3)
BuildRequires: pkgconfig(icu-uc)
BuildRequires: pkgconfig(icu-i18n)
%if "@QT_VERSION_MAJOR@" == "5" && ( 0%{?fedora} || 0%{?rhel_version} || 0%{?centos} )
BuildRequires: pkgconfig(Qt@QT_VERSION_MAJOR@Core)
BuildRequires: pkgconfig(Qt@QT_VERSION_MAJOR@Gui)
BuildRequires: pkgconfig(Qt@QT_VERSION_MAJOR@Widgets)
BuildRequires: pkgconfig(Qt@QT_VERSION_MAJOR@Concurrent)
BuildRequires: pkgconfig(Qt@QT_VERSION_MAJOR@Network)
BuildRequires: pkgconfig(Qt@QT_VERSION_MAJOR@Sql)
BuildRequires: pkgconfig(Qt@QT_VERSION_MAJOR@DBus)
BuildRequires: pkgconfig(Qt@QT_VERSION_MAJOR@Test)
BuildRequires: pkgconfig(Qt@QT_VERSION_MAJOR@X11Extras)
%else
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Core)
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Gui)
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Widgets)
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Concurrent)
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Network)
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Sql)
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@DBus)
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Gui)
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Widgets)
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@Test)
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@LinguistTools)
%if "@QT_VERSION_MAJOR@" == "5"
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@X11Extras)
%endif
%endif
%if 0%{?suse_version} || 0%{?fedora_version} || 0%{?mageia}
BuildRequires: cmake(Qt@QT_VERSION_MAJOR@LinguistTools)
%endif
BuildRequires: pkgconfig(gstreamer-1.0)
BuildRequires: pkgconfig(gstreamer-app-1.0)
BuildRequires: pkgconfig(gstreamer-audio-1.0)
BuildRequires: pkgconfig(gstreamer-base-1.0)
BuildRequires: pkgconfig(gstreamer-tag-1.0)
%if ! 0%{?centos}
BuildRequires: pkgconfig(libchromaprint)
%endif
BuildRequires: pkgconfig(libpulse)
BuildRequires: pkgconfig(libcdio)
BuildRequires: pkgconfig(libebur128)
BuildRequires: pkgconfig(libgpod-1.0)
BuildRequires: pkgconfig(libmtp)
%if 0%{?suse_version} || 0%{?fedora_version}
@@ -119,7 +99,7 @@ Features:
- Edit tags on audio files
- Automatically retrieve tags from MusicBrainz
- Album cover art from Last.fm, Musicbrainz, Discogs, Musixmatch, Deezer, Tidal, Qobuz and Spotify
- Song lyrics from Lyrics.com, Genius, Musixmatch, ChartLyrics, lyrics.ovh and lololyrics.com
- Song lyrics from Genius, Musixmatch, ChartLyrics, lyrics.ovh, lololyrics.com, songlyrics.com, azlyrics.com, elyrics.net and lyricsmode.com
- Support for multiple backends
- Audio analyzer
- Audio equalizer
@@ -139,22 +119,19 @@ Features:
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos}
export CXXFLAGS="-fPIC $RPM_OPT_FLAGS"
%endif
%{cmake} -DQT_VERSION_MAJOR=@QT_VERSION_MAJOR@
%if 0%{?centos} || (0%{?mageia} && 0%{?mageia} <= 7) || "%{?_vendor}" == "openmandriva"
%make_build
%if "%{?_vendor}" == "openmandriva"
%{cmake} -DQT_VERSION_MAJOR=@QT_VERSION_MAJOR@ -DENABLE_TRANSLATIONS=OFF
%make_build
%else
%cmake_build
%{cmake} -DQT_VERSION_MAJOR=@QT_VERSION_MAJOR@
%cmake_build
%endif
%install
%if 0%{?centos}
%make_install
%if "%{?_vendor}" == "openmandriva"
%make_install -C build
%else
%if 0%{?mageia} || "%{?_vendor}" == "openmandriva"
%make_install -C build
%else
%cmake_install
%endif
%cmake_install
%endif
%if 0%{?suse_version}
@@ -163,10 +140,10 @@ Features:
%check
desktop-file-validate %{buildroot}%{_datadir}/applications/org.strawberrymusicplayer.strawberry.desktop
%if 0%{?fedora_version}
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/org.strawberrymusicplayer.strawberry.appdata.xml
%else
%if 0%{?suse_version}
appstream-util validate-relax --nonet %{buildroot}%{_datadir}/metainfo/org.strawberrymusicplayer.strawberry.appdata.xml
%else
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/org.strawberrymusicplayer.strawberry.appdata.xml
%endif
%files
@@ -177,13 +154,13 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.strawberrymusicpl
%{_bindir}/strawberry-tagreader
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*/apps/strawberry.*
%if 0%{?fedora_version}
%{_metainfodir}/*.appdata.xml
%else
%{_datadir}/metainfo/*.appdata.xml
%endif
%{_mandir}/man1/%{name}.1.*
%{_mandir}/man1/%{name}-tagreader.1.*
%if 0%{?suse_version}
%{_datadir}/metainfo/*.appdata.xml
%else
%{_metainfodir}/*.appdata.xml
%endif
%changelog
* @RPM_DATE@ Jonas Kvinge <jonas@jkvinge.net> - @STRAWBERRY_VERSION_RPM_V@

View File

@@ -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
@@ -235,6 +236,7 @@ Section "Strawberry" Strawberry
File "strawberry.ico"
File "sqlite3.exe"
File "gst-launch-1.0.exe"
File "gst-play-1.0.exe"
File "gst-discoverer-1.0.exe"
; MinGW specific files
@@ -252,10 +254,6 @@ Section "Strawberry" Strawberry
File "libssl-3-x64.dll"
!endif
File "avcodec-60.dll"
File "avfilter-9.dll"
File "avformat-60.dll"
File "avutil-58.dll"
File "libFLAC-12.dll"
File "libbrotlicommon.dll"
File "libbrotlidec.dll"
@@ -264,6 +262,7 @@ Section "Strawberry" Strawberry
File "libbz2.dll"
File "libchromaprint.dll"
File "libdl.dll"
File "libebur128.dll"
File "libfaac-0.dll"
File "libfaad-2.dll"
File "libfdk-aac-2.dll"
@@ -301,6 +300,7 @@ Section "Strawberry" Strawberry
File "libidn2-0.dll"
File "libintl-8.dll"
File "libjpeg-9.dll"
File "libkdsingleapplication-qt6.dll"
File "liblzma-5.dll"
File "libmp3lame-0.dll"
File "libmpcdec.dll"
@@ -330,9 +330,6 @@ Section "Strawberry" Strawberry
File "libwinpthread-1.dll"
File "libxml2-2.dll"
File "libzstd.dll"
File "postproc-57.dll"
File "swresample-4.dll"
File "swscale-7.dll"
File "zlib1.dll"
File "libabsl_base.dll"
@@ -348,8 +345,10 @@ 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"
File "libabsl_log_internal_format.dll"
File "libabsl_log_internal_globals.dll"
File "libabsl_log_internal_log_sink_set.dll"
@@ -406,21 +405,17 @@ Section "Strawberry" Strawberry
!endif
File "FLAC.dll"
File "avcodec-58.dll"
File "avfilter-7.dll"
File "avformat-58.dll"
File "avutil-56.dll"
File "brotlicommon.dll"
File "brotlidec.dll"
File "chromaprint.dll"
File "faad.dll"
File "ebur128.dll"
File "faad-2.dll"
File "fdk-aac.dll"
File "ffi-7.dll"
File "gio-2.0-0.dll"
File "glib-2.0-0.dll"
File "gme.dll"
File "gmodule-2.0-0.dll"
File "gnutls.dll"
File "gobject-2.0-0.dll"
File "gstadaptivedemux-1.0-0.dll"
File "gstapp-1.0-0.dll"
@@ -443,25 +438,22 @@ Section "Strawberry" Strawberry
File "harfbuzz.dll"
File "intl-8.dll"
File "jpeg62.dll"
File "kdsingleapplication-qt6.dll"
File "libbs2b.dll"
File "libfaac_dll.dll"
File "liblzma.dll"
File "libmp3lame.dll"
File "libopenmpt.dll"
File "libspeex.dll"
File "mpcdec.dll"
File "mpg123.dll"
File "nghttp2.dll"
File "ogg.dll"
File "opus.dll"
File "orc-0.4-0.dll"
File "postproc-55.dll"
File "psl-5.dll"
File "qtsparkle-qt6.dll"
File "soup-3.0-0.dll"
File "sqlite3.dll"
File "swresample-3.dll"
File "swscale-5.dll"
File "tag.dll"
File "vorbis.dll"
File "vorbisfile.dll"
@@ -472,6 +464,7 @@ Section "Strawberry" Strawberry
File "freetype.dll"
File "libiconv.dll"
File "libpng16.dll"
File "libspeex.dll"
File "libxml2.dll"
File "pcre2-8.dll"
File "pcre2-16.dll"
@@ -482,6 +475,7 @@ Section "Strawberry" Strawberry
File "freetyped.dll"
File "libiconvd.dll"
File "libpng16d.dll"
File "libspeexd.dll"
File "libxml2d.dll"
File "pcre2-8d.dll"
File "pcre2-16d.dll"
@@ -499,7 +493,7 @@ Section "Strawberry" Strawberry
; Common files
File "icudt73.dll"
File "icudt74.dll"
File "libfftw3-3.dll"
!ifdef debug
File "libprotobufd.dll"
@@ -507,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"
@@ -516,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"
@@ -526,6 +520,14 @@ Section "Strawberry" Strawberry
File "Qt6Widgets.dll"
!endif
File "avcodec-60.dll"
File "avfilter-9.dll"
File "avformat-60.dll"
File "avutil-58.dll"
File "postproc-57.dll"
File "swresample-4.dll"
File "swscale-7.dll"
; Register Strawberry with Default Programs
Var /GLOBAL AppIcon
Var /GLOBAL AppExe
@@ -740,7 +742,8 @@ Section "Gstreamer plugins" gstreamer-plugins
File "/oname=gstvolume.dll" "gstreamer-plugins\gstvolume.dll"
File "/oname=gstvorbis.dll" "gstreamer-plugins\gstvorbis.dll"
File "/oname=gstwasapi.dll" "gstreamer-plugins\gstwasapi.dll"
File "/oname=gstwasapi2.dll" "gstreamer-plugins\gstwasapi2.dll"
; Disable wasapi2 until issue (https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2870) is fixed.
;File "/oname=gstwasapi2.dll" "gstreamer-plugins\gstwasapi2.dll"
File "/oname=gstwavenc.dll" "gstreamer-plugins\gstwavenc.dll"
File "/oname=gstwavpack.dll" "gstreamer-plugins\gstwavpack.dll"
File "/oname=gstwavparse.dll" "gstreamer-plugins\gstwavparse.dll"
@@ -789,6 +792,7 @@ Section "Uninstall"
Delete "$INSTDIR\strawberry.ico"
Delete "$INSTDIR\sqlite3.exe"
Delete "$INSTDIR\gst-launch-1.0.exe"
Delete "$INSTDIR\gst-play-1.0.exe"
Delete "$INSTDIR\gst-discoverer-1.0.exe"
; MinGW specific files
@@ -807,10 +811,6 @@ Section "Uninstall"
Delete "$INSTDIR\libssl-3-x64.dll"
!endif
Delete "$INSTDIR\avcodec-60.dll"
Delete "$INSTDIR\avfilter-9.dll"
Delete "$INSTDIR\avformat-60.dll"
Delete "$INSTDIR\avutil-58.dll"
Delete "$INSTDIR\libFLAC-12.dll"
Delete "$INSTDIR\libbrotlicommon.dll"
Delete "$INSTDIR\libbrotlidec.dll"
@@ -819,6 +819,7 @@ Section "Uninstall"
Delete "$INSTDIR\libbz2.dll"
Delete "$INSTDIR\libchromaprint.dll"
Delete "$INSTDIR\libdl.dll"
Delete "$INSTDIR\libebur128.dll"
Delete "$INSTDIR\libfaac-0.dll"
Delete "$INSTDIR\libfaad-2.dll"
Delete "$INSTDIR\libfdk-aac-2.dll"
@@ -856,6 +857,7 @@ Section "Uninstall"
Delete "$INSTDIR\libidn2-0.dll"
Delete "$INSTDIR\libintl-8.dll"
Delete "$INSTDIR\libjpeg-9.dll"
Delete "$INSTDIR\libkdsingleapplication-qt6.dll"
Delete "$INSTDIR\liblzma-5.dll"
Delete "$INSTDIR\libmp3lame-0.dll"
Delete "$INSTDIR\libmpcdec.dll"
@@ -885,9 +887,6 @@ Section "Uninstall"
Delete "$INSTDIR\libwinpthread-1.dll"
Delete "$INSTDIR\libxml2-2.dll"
Delete "$INSTDIR\libzstd.dll"
Delete "$INSTDIR\postproc-57.dll"
Delete "$INSTDIR\swresample-4.dll"
Delete "$INSTDIR\swscale-7.dll"
Delete "$INSTDIR\zlib1.dll"
Delete "$INSTDIR\libabsl_base.dll"
@@ -903,8 +902,10 @@ 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"
Delete "$INSTDIR\libabsl_log_internal_format.dll"
Delete "$INSTDIR\libabsl_log_internal_globals.dll"
Delete "$INSTDIR\libabsl_log_internal_log_sink_set.dll"
@@ -961,21 +962,17 @@ Section "Uninstall"
!endif
Delete "$INSTDIR\FLAC.dll"
Delete "$INSTDIR\avcodec-58.dll"
Delete "$INSTDIR\avfilter-7.dll"
Delete "$INSTDIR\avformat-58.dll"
Delete "$INSTDIR\avutil-56.dll"
Delete "$INSTDIR\brotlicommon.dll"
Delete "$INSTDIR\brotlidec.dll"
Delete "$INSTDIR\chromaprint.dll"
Delete "$INSTDIR\faad.dll"
Delete "$INSTDIR\ebur128.dll"
Delete "$INSTDIR\faad-2.dll"
Delete "$INSTDIR\fdk-aac.dll"
Delete "$INSTDIR\ffi-7.dll"
Delete "$INSTDIR\gio-2.0-0.dll"
Delete "$INSTDIR\glib-2.0-0.dll"
Delete "$INSTDIR\gme.dll"
Delete "$INSTDIR\gmodule-2.0-0.dll"
Delete "$INSTDIR\gnutls.dll"
Delete "$INSTDIR\gobject-2.0-0.dll"
Delete "$INSTDIR\gstadaptivedemux-1.0-0.dll"
Delete "$INSTDIR\gstapp-1.0-0.dll"
@@ -998,25 +995,22 @@ Section "Uninstall"
Delete "$INSTDIR\harfbuzz.dll"
Delete "$INSTDIR\intl-8.dll"
Delete "$INSTDIR\jpeg62.dll"
Delete "$INSTDIR\kdsingleapplication-qt6.dll"
Delete "$INSTDIR\libbs2b.dll"
Delete "$INSTDIR\libfaac_dll.dll"
Delete "$INSTDIR\liblzma.dll"
Delete "$INSTDIR\libmp3lame.dll"
Delete "$INSTDIR\libopenmpt.dll"
Delete "$INSTDIR\libspeex.dll"
Delete "$INSTDIR\mpcdec.dll"
Delete "$INSTDIR\mpg123.dll"
Delete "$INSTDIR\nghttp2.dll"
Delete "$INSTDIR\ogg.dll"
Delete "$INSTDIR\opus.dll"
Delete "$INSTDIR\orc-0.4-0.dll"
Delete "$INSTDIR\postproc-55.dll"
Delete "$INSTDIR\psl-5.dll"
Delete "$INSTDIR\qtsparkle-qt6.dll"
Delete "$INSTDIR\soup-3.0-0.dll"
Delete "$INSTDIR\sqlite3.dll"
Delete "$INSTDIR\swresample-3.dll"
Delete "$INSTDIR\swscale-5.dll"
Delete "$INSTDIR\tag.dll"
Delete "$INSTDIR\vorbis.dll"
Delete "$INSTDIR\vorbisfile.dll"
@@ -1027,6 +1021,7 @@ Section "Uninstall"
Delete "$INSTDIR\freetype.dll"
Delete "$INSTDIR\libiconv.dll"
Delete "$INSTDIR\libpng16.dll"
Delete "$INSTDIR\libspeex.dll"
Delete "$INSTDIR\libxml2.dll"
Delete "$INSTDIR\pcre2-8.dll"
Delete "$INSTDIR\pcre2-16.dll"
@@ -1037,6 +1032,7 @@ Section "Uninstall"
Delete "$INSTDIR\freetyped.dll"
Delete "$INSTDIR\libiconvd.dll"
Delete "$INSTDIR\libpng16d.dll"
Delete "$INSTDIR\libspeexd.dll"
Delete "$INSTDIR\libxml2d.dll"
Delete "$INSTDIR\pcre2-8d.dll"
Delete "$INSTDIR\pcre2-16d.dll"
@@ -1053,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"
@@ -1061,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"
@@ -1070,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"
@@ -1080,6 +1076,14 @@ Section "Uninstall"
Delete "$INSTDIR\Qt6Widgets.dll"
!endif
Delete "$INSTDIR\avcodec-60.dll"
Delete "$INSTDIR\avfilter-9.dll"
Delete "$INSTDIR\avformat-60.dll"
Delete "$INSTDIR\avutil-58.dll"
Delete "$INSTDIR\postproc-57.dll"
Delete "$INSTDIR\swresample-4.dll"
Delete "$INSTDIR\swscale-7.dll"
!ifdef mingw
Delete "$INSTDIR\gio-modules\libgiognutls.dll"
Delete "$INSTDIR\gio-modules\libgioopenssl.dll"
@@ -1236,7 +1240,7 @@ Section "Uninstall"
Delete "$INSTDIR\gstreamer-plugins\gstxingmux.dll"
!endif ; msvc
Delete $INSTDIR\Uninstall.exe"
Delete "$INSTDIR\Uninstall.exe"
; Remove the installation folders.
RMDir "$INSTDIR\platforms"

View File

@@ -31,5 +31,5 @@ target_link_libraries(gstmoodbar PRIVATE
${GSTREAMER_BASE_LIBRARIES}
${GSTREAMER_AUDIO_LIBRARIES}
${FFTW3_FFTW_LIBRARY}
${QtCore_LIBRARIES}
Qt${QT_VERSION_MAJOR}::Core
)

View File

@@ -34,8 +34,8 @@ endif()
target_link_libraries(libstrawberry-common PRIVATE
${CMAKE_THREAD_LIBS_INIT}
${GLIB_LIBRARIES}
${QtCore_LIBRARIES}
${QtNetwork_LIBRARIES}
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Network
)
if(Backtrace_FOUND)

View File

@@ -22,12 +22,22 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <memory>
#ifndef _MSC_VER
# include <cxxabi.h>
#endif
#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wold-style-cast"
#endif
#include <glib.h>
#ifdef __clang__
# pragma clang diagnostic pop
#endif
#ifdef HAVE_BACKTRACE
# include <execinfo.h>

View File

@@ -31,6 +31,7 @@
#include <QMutex>
#include <QLocalServer>
#include <QProcess>
#include <QDir>
#include <QFile>
#include <QList>
#include <QQueue>
@@ -245,8 +246,8 @@ void WorkerPool<HandlerType>::DoStart() {
search_path << "/usr/libexec";
search_path << "/usr/local/libexec";
#endif
#if defined(Q_OS_MACOS) && defined(USE_BUNDLE)
search_path << QCoreApplication::applicationDirPath() + "/" + USE_BUNDLE_DIR;
#if defined(Q_OS_MACOS)
search_path << QDir::cleanPath(QCoreApplication::applicationDirPath() + "/../PlugIns");
#endif
for (const QString &path_prefix : search_path) {

View File

@@ -6,7 +6,7 @@ if(NOT protobuf_PROTOC_EXE)
endif()
if(NOT Protobuf_LIBRARIES)
set(Protobuf_LIBRARIES protobuf::libprotobuf protobuf::libprotoc)
set(Protobuf_LIBRARIES protobuf::libprotobuf)
endif()
set(SOURCES tagreaderbase.cpp tagreadermessages.proto)
@@ -50,9 +50,9 @@ target_include_directories(libstrawberry-tagreader PRIVATE
target_link_libraries(libstrawberry-tagreader PRIVATE
${GLIB_LIBRARIES}
${Protobuf_LIBRARIES}
${QtCore_LIBRARIES}
${QtNetwork_LIBRARIES}
${QtGui_LIBRARIES}
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Gui
libstrawberry-common
)

View File

@@ -98,9 +98,8 @@ void GME::SPC::Read(const QFileInfo &file_info, spb::tagreader::SongMetadata *so
file.seek(INTRO_LENGTH_OFFSET);
QByteArray length_bytes = file.read(INTRO_LENGTH_SIZE);
quint64 length_in_sec = 0;
if (length_bytes.size() >= INTRO_LENGTH_SIZE) {
length_in_sec = ConvertSPCStringToNum(length_bytes);
quint64 length_in_sec = ConvertSPCStringToNum(length_bytes);
if (!length_in_sec || length_in_sec >= 0x1FFF) {
// This means that parsing the length as a string failed, so get value LE.
@@ -120,6 +119,7 @@ void GME::SPC::Read(const QFileInfo &file_info, spb::tagreader::SongMetadata *so
if (fade_length_in_ms > 0x7FFF) {
fade_length_in_ms = fade_bytes[0] | (fade_bytes[1] << 8) | (fade_bytes[2] << 16) | (fade_bytes[3] << 24);
}
Q_UNUSED(fade_length_in_ms)
}
// Check for XID6 data -- this is infrequently used, but being able to fill in data from this is ideal before trying to rely on APETAG values.
@@ -141,7 +141,7 @@ void GME::SPC::Read(const QFileInfo &file_info, spb::tagreader::SongMetadata *so
qint8 type = arr[1];
Q_UNUSED(id);
Q_UNUSED(type);
qint16 length = arr[2] | (arr[3] << 8);
qint16 length = static_cast<qint16>(arr[2] | (arr[3] << 8));
file.read(GetNextMemAddressAlign32bit(length));
}
@@ -161,8 +161,8 @@ void GME::SPC::Read(const QFileInfo &file_info, spb::tagreader::SongMetadata *so
TagReaderTagLib::TStringToStdString(tag->album(), song_info->mutable_album());
TagReaderTagLib::TStringToStdString(tag->title(), song_info->mutable_title());
TagReaderTagLib::TStringToStdString(tag->genre(), song_info->mutable_genre());
song_info->set_track(tag->track());
song_info->set_year(tag->year());
song_info->set_track(static_cast<std::int32_t>(tag->track()));
song_info->set_year(static_cast<std::int32_t>(tag->year()));
}
song_info->set_valid(true);
@@ -171,7 +171,7 @@ void GME::SPC::Read(const QFileInfo &file_info, spb::tagreader::SongMetadata *so
}
qint16 GME::SPC::GetNextMemAddressAlign32bit(qint16 input) {
return ((input + 0x3) & ~0x3);
return static_cast<qint16>((input + 0x3) & ~0x3);
// Plus 0x3 for rounding up (not down), AND NOT to flatten out on a 32 bit level.
}
@@ -211,7 +211,7 @@ void GME::VGM::Read(const QFileInfo &file_info, spb::tagreader::SongMetadata *so
if (!GetPlaybackLength(sample_count_bytes, loop_count_bytes, length)) return;
file.seek(GD3_TAG_PTR + pt);
file.seek(static_cast<qint64>(GD3_TAG_PTR + pt));
QByteArray gd3_version = file.read(4);
file.seek(file.pos() + 4);
@@ -249,11 +249,11 @@ bool GME::VGM::GetPlaybackLength(const QByteArray &sample_count_bytes, const QBy
quint64 sample_count = GME::UnpackBytes32(sample_count_bytes.constData(), sample_count_bytes.size());
if (sample_count <= 0) return false;
if (sample_count == 0) return false;
quint64 loop_sample_count = GME::UnpackBytes32(loop_count_bytes.constData(), loop_count_bytes.size());
if (loop_sample_count <= 0) {
if (loop_sample_count == 0) {
out_length = sample_count * 1000 / SAMPLE_TIMEBASE;
return true;
}

View File

@@ -34,7 +34,7 @@ namespace GME {
bool IsSupportedFormat(const QFileInfo &file_info);
bool ReadFile(const QFileInfo &file_info, spb::tagreader::SongMetadata *song_info);
uint32_t UnpackBytes32(const char *const arr, size_t length);
uint32_t UnpackBytes32(const char *const bytes, size_t length);
namespace SPC {
// SPC SPEC: http://vspcplay.raphnet.net/spc_file_format.txt

View File

@@ -374,6 +374,16 @@ bool TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
}
}
if (TagLib::ID3v2::UserTextIdentificationFrame *frame_fmps_playcount = TagLib::ID3v2::UserTextIdentificationFrame::find(file_mpeg->ID3v2Tag(), "FMPS_Playcount")) {
TagLib::StringList frame_field_list = frame_fmps_playcount->fieldList();
if (frame_field_list.size() > 1) {
int playcount = TStringToQString(frame_field_list[1]).toInt();
if (song->playcount() <= 0 && playcount > 0) {
song->set_playcount(playcount);
}
}
}
if (TagLib::ID3v2::UserTextIdentificationFrame *frame_fmps_rating = TagLib::ID3v2::UserTextIdentificationFrame::find(file_mpeg->ID3v2Tag(), "FMPS_Rating")) {
TagLib::StringList frame_field_list = frame_fmps_rating->fieldList();
if (frame_field_list.size() > 1) {

View File

@@ -11,5 +11,5 @@ target_include_directories(macdeploycheck PUBLIC
target_link_libraries(macdeploycheck PUBLIC
"-framework AppKit"
${GLIB_LIBRARIES}
${QtCore_LIBRARIES}
Qt${QT_VERSION_MAJOR}::Core
)

View File

@@ -105,7 +105,7 @@ int main(int argc, char **argv) {
else if (library.startsWith("@executable_path")) {
QString real_path = library;
real_path = real_path.replace("@executable_path", bundle_path + "/Contents/MacOS");
if (!QFile(real_path).exists()) {
if (!QFile::exists(real_path)) {
qLog(Error) << real_path << "does not exist for" << filepath;
success = false;
}
@@ -113,7 +113,7 @@ int main(int argc, char **argv) {
else if (library.startsWith("@rpath")) {
QString real_path = library;
real_path = real_path.replace("@rpath", bundle_path + "/Contents/Frameworks");
if (!QFile(real_path).exists() && !real_path.endsWith("QtSvg")) { // FIXME: Ignore broken svg image plugin.
if (!QFile::exists(real_path) && !real_path.endsWith("QtSvg")) { // FIXME: Ignore broken svg image plugin.
qLog(Error) << real_path << "does not exist for" << filepath;
success = false;
}
@@ -122,7 +122,7 @@ int main(int argc, char **argv) {
QString loader_path = QFileInfo(filepath).path();
QString real_path = library;
real_path = real_path.replace("@loader_path", loader_path);
if (!QFile(real_path).exists()) {
if (!QFile::exists(real_path)) {
qLog(Error) << real_path << "does not exist for" << filepath;
success = false;
}

View File

@@ -33,8 +33,8 @@ target_include_directories(strawberry-tagreader PRIVATE
target_link_libraries(strawberry-tagreader PRIVATE
${GLIB_LIBRARIES}
${QtCore_LIBRARIES}
${QtNetwork_LIBRARIES}
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Network
libstrawberry-common
libstrawberry-tagreader
)

View File

@@ -57,6 +57,7 @@ set(SOURCES
utilities/filemanagerutils.cpp
utilities/coverutils.cpp
utilities/screenutils.cpp
utilities/searchparserutils.cpp
engine/enginebase.cpp
engine/enginedevice.cpp
@@ -112,6 +113,7 @@ set(SOURCES
playlist/playlisttabbar.cpp
playlist/playlistundocommands.cpp
playlist/playlistview.cpp
playlist/playlistproxystyle.cpp
playlist/songloaderinserter.cpp
playlist/songplaylistitem.cpp
playlist/dynamicplaylistcontrols.cpp
@@ -177,12 +179,16 @@ set(SOURCES
lyrics/lyricsfetcher.cpp
lyrics/lyricsfetchersearch.cpp
lyrics/jsonlyricsprovider.cpp
lyrics/htmllyricsprovider.cpp
lyrics/ovhlyricsprovider.cpp
lyrics/lololyricsprovider.cpp
lyrics/geniuslyricsprovider.cpp
lyrics/musixmatchlyricsprovider.cpp
lyrics/chartlyricsprovider.cpp
lyrics/lyricscomlyricsprovider.cpp
lyrics/songlyricscomlyricsprovider.cpp
lyrics/azlyricscomlyricsprovider.cpp
lyrics/elyricsnetlyricsprovider.cpp
lyrics/lyricsmodecomlyricsprovider.cpp
providers/musixmatchprovider.cpp
@@ -269,6 +275,7 @@ set(SOURCES
radios/radioparadiseservice.cpp
scrobbler/audioscrobbler.cpp
scrobbler/scrobblersettings.cpp
scrobbler/scrobblerservice.cpp
scrobbler/scrobblercache.cpp
scrobbler/scrobblercacheitem.cpp
@@ -353,6 +360,7 @@ set(HEADERS
playlist/playlistsequence.h
playlist/playlisttabbar.h
playlist/playlistview.h
playlist/playlistproxystyle.h
playlist/playlistitemmimedata.h
playlist/songloaderinserter.h
playlist/songmimedata.h
@@ -414,12 +422,16 @@ set(HEADERS
lyrics/lyricsfetcher.h
lyrics/lyricsfetchersearch.h
lyrics/jsonlyricsprovider.h
lyrics/htmllyricsprovider.h
lyrics/ovhlyricsprovider.h
lyrics/lololyricsprovider.h
lyrics/geniuslyricsprovider.h
lyrics/musixmatchlyricsprovider.h
lyrics/chartlyricsprovider.h
lyrics/lyricscomlyricsprovider.h
lyrics/songlyricscomlyricsprovider.h
lyrics/azlyricscomlyricsprovider.h
lyrics/elyricsnetlyricsprovider.h
lyrics/lyricsmodecomlyricsprovider.h
settings/settingsdialog.h
settings/settingspage.h
@@ -502,6 +514,7 @@ set(HEADERS
radios/radioparadiseservice.h
scrobbler/audioscrobbler.h
scrobbler/scrobblersettings.h
scrobbler/scrobblerservice.h
scrobbler/scrobblercache.h
scrobbler/scrobblingapi20.h
@@ -591,7 +604,6 @@ set(UI
)
set(RESOURCES ../data/data.qrc ../data/icons.qrc)
set(OTHER_SOURCES)
option(USE_INSTALL_PREFIX "Look for data in CMAKE_INSTALL_PREFIX" ON)
@@ -927,6 +939,11 @@ optional_source(HAVE_MOODBAR
settings/moodbarsettingspage.ui
)
# EBU R 128
optional_source(HAVE_EBUR128
SOURCES engine/ebur128analysis.cpp
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
@@ -958,8 +975,7 @@ if(HAVE_TRANSLATIONS)
${SOURCES}
${MOC}
${UIC}
${OTHER_SOURCES}
../data/html/oauthsuccess.html
${CMAKE_SOURCE_DIR}/data/html/oauthsuccess.html
)
add_po(PO strawberry_ LANGUAGES ${LANGUAGES} DIRECTORY translations)
@@ -969,7 +985,6 @@ link_directories(
${Boost_LIBRARY_DIRS}
${GLIB_LIBRARY_DIRS}
${GOBJECT_LIBRARY_DIRS}
${GNUTLS_LIBRARY_DIRS}
${SQLITE_LIBRARY_DIRS}
${PROTOBUF_LIBRARY_DIRS}
${SINGLEAPPLICATION_LIBRARY_DIRS}
@@ -1062,7 +1077,6 @@ target_include_directories(strawberry_lib SYSTEM PUBLIC
${Boost_INCLUDE_DIRS}
${GLIB_INCLUDE_DIRS}
${GOBJECT_INCLUDE_DIRS}
${GNUTLS_INCLUDE_DIRS}
${SQLITE_INCLUDE_DIRS}
${PROTOBUF_INCLUDE_DIRS}
)
@@ -1086,15 +1100,27 @@ target_link_libraries(strawberry_lib PUBLIC
${CMAKE_THREAD_LIBS_INIT}
${GLIB_LIBRARIES}
${GOBJECT_LIBRARIES}
${GNUTLS_LIBRARIES}
${SQLITE_LIBRARIES}
${QT_LIBRARIES}
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Concurrent
Qt${QT_VERSION_MAJOR}::Gui
Qt${QT_VERSION_MAJOR}::Widgets
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Sql
${Protobuf_LIBRARIES}
${SINGLEAPPLICATION_LIBRARIES}
libstrawberry-common
libstrawberry-tagreader
)
if(HAVE_DBUS)
target_link_libraries(strawberry_lib PUBLIC Qt${QT_VERSION_MAJOR}::DBus)
endif()
if(HAVE_X11_GLOBALSHORTCUTS AND HAVE_X11EXTRAS)
target_link_libraries(strawberry_lib PUBLIC Qt${QT_VERSION_MAJOR}::X11Extras)
endif()
if(HAVE_ICU)
target_include_directories(strawberry_lib SYSTEM PRIVATE ${ICU_INCLUDE_DIRS})
target_link_libraries(strawberry_lib PRIVATE ${ICU_LIBRARIES})
@@ -1149,6 +1175,10 @@ if(HAVE_SONGFINGERPRINTING OR HAVE_MUSICBRAINZ)
target_link_libraries(strawberry_lib PRIVATE ${CHROMAPRINT_LIBRARIES})
endif()
if(HAVE_EBUR128)
target_link_libraries(strawberry_lib PRIVATE PkgConfig::LIBEBUR128)
endif()
if(X11_FOUND)
target_include_directories(strawberry_lib SYSTEM PRIVATE ${X11_INCLUDE_DIR})
target_link_libraries(strawberry_lib PRIVATE ${X11_LIBRARIES})

View File

@@ -24,9 +24,9 @@
#include "analyzerbase.h"
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <QWidget>
#include <QVector>

View File

@@ -38,6 +38,7 @@
#include <QString>
#include <QPainter>
#include "core/shared_ptr.h"
#include "analyzer/fht.h"
#include "engine/enginebase.h"
@@ -54,7 +55,7 @@ class AnalyzerBase : public QWidget {
int timeout() const { return timeout_; }
void set_engine(EngineBase *engine) { engine_ = engine; }
void set_engine(SharedPtr<EngineBase> engine) { engine_ = engine; }
void ChangeTimeout(const int timeout);
@@ -82,7 +83,7 @@ class AnalyzerBase : public QWidget {
protected:
QBasicTimer timer_;
FHT *fht_;
EngineBase *engine_;
SharedPtr<EngineBase> engine_;
Scope lastscope_;
bool new_frame_;

View File

@@ -43,6 +43,7 @@
#include "sonogram.h"
#include "core/logging.h"
#include "core/shared_ptr.h"
#include "engine/enginebase.h"
using namespace std::chrono_literals;
@@ -125,7 +126,7 @@ void AnalyzerContainer::wheelEvent(QWheelEvent *e) {
emit WheelEvent(e->angleDelta().y());
}
void AnalyzerContainer::SetEngine(EngineBase *engine) {
void AnalyzerContainer::SetEngine(SharedPtr<EngineBase> engine) {
if (current_analyzer_) current_analyzer_->set_engine(engine);
engine_ = engine;

View File

@@ -30,6 +30,7 @@
#include <QAction>
#include <QActionGroup>
#include "core/shared_ptr.h"
#include "engine/enginebase.h"
class QTimer;
@@ -44,7 +45,7 @@ class AnalyzerContainer : public QWidget {
public:
explicit AnalyzerContainer(QWidget *parent);
void SetEngine(EngineBase *engine);
void SetEngine(SharedPtr<EngineBase> engine);
void SetActions(QAction *visualisation);
static const char *kSettingsGroup;
@@ -93,7 +94,7 @@ class AnalyzerContainer : public QWidget {
bool ignore_next_click_;
AnalyzerBase *current_analyzer_;
EngineBase *engine_;
SharedPtr<EngineBase> engine_;
};
template<typename T>

View File

@@ -165,7 +165,7 @@ void BlockAnalyzer::analyze(QPainter &p, const Scope &s, bool new_frame) {
for (int x = 0, y = 0; x < static_cast<int>(scope_.size()); ++x) {
// determine y
for (y = 0; scope_[x] < yscale_[y]; ++y) continue;
for (y = 0; scope_[x] < yscale_[y]; ++y);
// This is opposite to what you'd think, higher than y means the bar is lower than y (physically)
if (static_cast<double>(y) > store_[x]) {

View File

@@ -111,7 +111,7 @@ void BoomAnalyzer::analyze(QPainter &p, const Scope &scope, const bool new_frame
p.drawPixmap(0, 0, canvas_);
return;
}
double h = 0.0;
const uint MAX_HEIGHT = height() - 1;
QPainter canvas_painter(&canvas_);
@@ -120,7 +120,7 @@ void BoomAnalyzer::analyze(QPainter &p, const Scope &scope, const bool new_frame
interpolate(scope, scope_);
for (int i = 0, x = 0, y = 0; i < bands_; ++i, x += kColumnWidth + 1) {
h = log10(scope_[i] * 256.0) * F_;
double h = log10(scope_[i] * 256.0) * F_;
if (h > MAX_HEIGHT) h = MAX_HEIGHT;

View File

@@ -21,6 +21,8 @@
#include "config.h"
#include <memory>
#include <QtGlobal>
#include <QObject>
#include <QThread>
@@ -31,7 +33,6 @@
#include "core/application.h"
#include "core/taskmanager.h"
#include "core/database.h"
#include "core/player.h"
#include "core/tagreaderclient.h"
#include "core/thread.h"
#include "core/song.h"
@@ -41,10 +42,11 @@
#include "collectionwatcher.h"
#include "collectionbackend.h"
#include "collectionmodel.h"
#include "playlist/playlistmanager.h"
#include "scrobbler/lastfmimport.h"
#include "settings/collectionsettingspage.h"
using std::make_shared;
const char *SCollection::kSongsTable = "songs";
const char *SCollection::kFtsTable = "songs_fts";
const char *SCollection::kDirsTable = "directories";
@@ -63,9 +65,9 @@ SCollection::SCollection(Application *app, QObject *parent)
original_thread_ = thread();
backend_ = new CollectionBackend();
backend_ = make_shared<CollectionBackend>();
backend()->moveToThread(app->database()->thread());
qLog(Debug) << backend_ << "moved to thread" << app->database()->thread();
qLog(Debug) << &*backend_ << "moved to thread" << app->database()->thread();
backend_->Init(app->database(), app->task_manager(), Song::Source::Collection, kSongsTable, kFtsTable, kDirsTable, kSubdirsTable);
@@ -85,7 +87,6 @@ SCollection::~SCollection() {
watcher_thread_->exit();
watcher_thread_->wait(5000);
}
backend_->deleteLater();
}
@@ -105,24 +106,24 @@ void SCollection::Init() {
watcher_->set_backend(backend_);
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::SongsRatingChanged, this, &SCollection::SongsRatingChanged);
QObject::connect(backend_, &CollectionBackend::SongsStatisticsChanged, this, &SCollection::SongsPlaycountChanged);
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::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);
QObject::connect(&*app_->lastfm_import(), &LastFMImport::UpdateLastPlayed, &*backend_, &CollectionBackend::UpdateLastPlayed);
QObject::connect(&*app_->lastfm_import(), &LastFMImport::UpdatePlayCount, &*backend_, &CollectionBackend::UpdatePlayCount);
// This will start the watcher checking for updates
backend_->LoadDirectoriesAsync();
@@ -131,12 +132,12 @@ 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(&*backend_, &CollectionBackend::ExitFinished, this, &SCollection::ExitReceived);
QObject::connect(watcher_, &CollectionWatcher::ExitFinished, this, &SCollection::ExitReceived);
backend_->ExitAsync();
watcher_->Abort();

View File

@@ -29,6 +29,7 @@
#include <QHash>
#include <QString>
#include "core/shared_ptr.h"
#include "core/song.h"
class QThread;
@@ -42,7 +43,7 @@ class SCollection : public QObject {
Q_OBJECT
public:
explicit SCollection(Application *app, QObject *parent);
explicit SCollection(Application *app, QObject *parent = nullptr);
~SCollection() override;
static const char *kSongsTable;
@@ -53,7 +54,7 @@ class SCollection : public QObject {
void Init();
void Exit();
CollectionBackend *backend() const { return backend_; }
SharedPtr<CollectionBackend> backend() const { return backend_; }
CollectionModel *model() const { return model_; }
QString full_rescan_reason(int schema_version) const { return full_rescan_revisions_.value(schema_version, QString()); }
@@ -86,7 +87,7 @@ class SCollection : public QObject {
private:
Application *app_;
CollectionBackend *backend_;
SharedPtr<CollectionBackend> backend_;
CollectionModel *model_;
CollectionWatcher *watcher_;

View File

@@ -43,6 +43,7 @@
#include <QSqlQuery>
#include <QSqlError>
#include "core/shared_ptr.h"
#include "core/logging.h"
#include "core/database.h"
#include "core/scopedtransaction.h"
@@ -67,7 +68,13 @@ CollectionBackend::CollectionBackend(QObject *parent)
}
void CollectionBackend::Init(Database *db, TaskManager *task_manager, const Song::Source source, const QString &songs_table, const QString &fts_table, const QString &dirs_table, const QString &subdirs_table) {
CollectionBackend::~CollectionBackend() {
qLog(Debug) << "Collection backend" << this << "for" << Song::TextForSource(source_) << "deleted";
}
void CollectionBackend::Init(SharedPtr<Database> db, SharedPtr<TaskManager> task_manager, const Song::Source source, const QString &songs_table, const QString &fts_table, const QString &dirs_table, const QString &subdirs_table) {
db_ = db;
task_manager_ = task_manager;
@@ -394,7 +401,7 @@ SongList CollectionBackend::FindSongsInDirectory(const int id) {
QSqlDatabase db(db_->Connect());
SqlQuery q(db);
q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + " FROM %1 WHERE directory_id = :directory_id").arg(songs_table_));
q.prepare(QString("SELECT ROWID, %1 FROM %2 WHERE directory_id = :directory_id").arg(Song::kColumnSpec, songs_table_));
q.BindValue(":directory_id", id);
if (!q.Exec()) {
db_->ReportErrors(q);
@@ -417,7 +424,30 @@ SongList CollectionBackend::SongsWithMissingFingerprint(const int id) {
QSqlDatabase db(db_->Connect());
SqlQuery q(db);
q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + " FROM %1 WHERE directory_id = :directory_id AND unavailable = 0 AND (fingerprint IS NULL OR fingerprint = '')").arg(songs_table_));
q.prepare(QString("SELECT ROWID, %1 FROM %2 WHERE directory_id = :directory_id AND unavailable = 0 AND (fingerprint IS NULL OR fingerprint = '')").arg(Song::kColumnSpec, songs_table_));
q.BindValue(":directory_id", id);
if (!q.Exec()) {
db_->ReportErrors(q);
return SongList();
}
SongList ret;
while (q.next()) {
Song song(source_);
song.InitFromQuery(q, true);
ret << song;
}
return ret;
}
SongList CollectionBackend::SongsWithMissingLoudnessCharacteristics(const int id) {
QMutexLocker l(db_->Mutex());
QSqlDatabase db(db_->Connect());
SqlQuery q(db);
q.prepare(QString("SELECT ROWID, %1 FROM %2 WHERE directory_id = :directory_id AND unavailable = 0 AND (ebur128_integrated_loudness_lufs IS NULL OR ebur128_loudness_range_lu IS NULL)").arg(Song::kColumnSpec, songs_table_));
q.BindValue(":directory_id", id);
if (!q.Exec()) {
db_->ReportErrors(q);
@@ -518,7 +548,7 @@ SongList CollectionBackend::GetAllSongs() {
QSqlDatabase db(db_->Connect());
SqlQuery q(db);
q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + " FROM %1").arg(songs_table_));
q.prepare(QString("SELECT ROWID, %1 FROM %2").arg(Song::kColumnSpec, songs_table_));
if (!q.Exec()) {
db_->ReportErrors(q);
return SongList();
@@ -574,7 +604,7 @@ void CollectionBackend::AddOrUpdateSongs(const SongList &songs) {
// Update
{
SqlQuery q(db);
q.prepare(QString("UPDATE %1 SET " + Song::kUpdateSpec + " WHERE ROWID = :id").arg(songs_table_));
q.prepare(QString("UPDATE %1 SET %2 WHERE ROWID = :id").arg(songs_table_, Song::kUpdateSpec));
song.BindToQuery(&q);
q.BindValue(":id", song.id());
if (!q.Exec()) {
@@ -585,7 +615,7 @@ void CollectionBackend::AddOrUpdateSongs(const SongList &songs) {
{
SqlQuery q(db);
q.prepare(QString("UPDATE %1 SET " + Song::kFtsUpdateSpec + " WHERE ROWID = :id").arg(fts_table_));
q.prepare(QString("UPDATE %1 SET %2 WHERE ROWID = :id").arg(fts_table_, Song::kFtsUpdateSpec));
song.BindToFtsQuery(&q);
q.BindValue(":id", song.id());
if (!q.Exec()) {
@@ -613,7 +643,7 @@ void CollectionBackend::AddOrUpdateSongs(const SongList &songs) {
// Update
{
SqlQuery q(db);
q.prepare(QString("UPDATE %1 SET " + Song::kUpdateSpec + " WHERE ROWID = :id").arg(songs_table_));
q.prepare(QString("UPDATE %1 SET %2 WHERE ROWID = :id").arg(songs_table_, Song::kUpdateSpec));
new_song.BindToQuery(&q);
q.BindValue(":id", new_song.id());
if (!q.Exec()) {
@@ -624,7 +654,7 @@ void CollectionBackend::AddOrUpdateSongs(const SongList &songs) {
{
SqlQuery q(db);
q.prepare(QString("UPDATE %1 SET " + Song::kFtsUpdateSpec + " WHERE ROWID = :id").arg(fts_table_));
q.prepare(QString("UPDATE %1 SET %2 WHERE ROWID = :id").arg(fts_table_, Song::kFtsUpdateSpec));
new_song.BindToFtsQuery(&q);
q.BindValue(":id", new_song.id());
if (!q.Exec()) {
@@ -645,7 +675,7 @@ void CollectionBackend::AddOrUpdateSongs(const SongList &songs) {
int id = -1;
{ // Insert the row and create a new ID
SqlQuery q(db);
q.prepare(QString("INSERT INTO %1 (" + Song::kColumnSpec + ") VALUES (" + Song::kBindSpec + ")").arg(songs_table_));
q.prepare(QString("INSERT INTO %1 (%2) VALUES (%3)").arg(songs_table_, Song::kColumnSpec, Song::kBindSpec));
song.BindToQuery(&q);
if (!q.Exec()) {
db_->ReportErrors(q);
@@ -659,7 +689,7 @@ void CollectionBackend::AddOrUpdateSongs(const SongList &songs) {
{ // Add to the FTS index
SqlQuery q(db);
q.prepare(QString("INSERT INTO %1 (ROWID, " + Song::kFtsColumnSpec + ") VALUES (:id, " + Song::kFtsBindSpec + ")").arg(fts_table_));
q.prepare(QString("INSERT INTO %1 (ROWID, %2) VALUES (:id, %3)").arg(fts_table_, Song::kFtsColumnSpec, Song::kFtsBindSpec));
q.BindValue(":id", id);
song.BindToFtsQuery(&q);
if (!q.Exec()) {
@@ -720,7 +750,7 @@ void CollectionBackend::UpdateSongsBySongID(const SongMap &new_songs) {
{
SqlQuery q(db);
q.prepare(QString("UPDATE %1 SET " + Song::kUpdateSpec + " WHERE ROWID = :id").arg(songs_table_));
q.prepare(QString("UPDATE %1 SET %2 WHERE ROWID = :id").arg(songs_table_, Song::kUpdateSpec));
new_song.BindToQuery(&q);
q.BindValue(":id", old_song.id());
if (!q.Exec()) {
@@ -730,7 +760,7 @@ void CollectionBackend::UpdateSongsBySongID(const SongMap &new_songs) {
}
{
SqlQuery q(db);
q.prepare(QString("UPDATE %1 SET " + Song::kFtsUpdateSpec + " WHERE ROWID = :id").arg(fts_table_));
q.prepare(QString("UPDATE %1 SET %2 WHERE ROWID = :id").arg(fts_table_, Song::kFtsUpdateSpec));
new_song.BindToFtsQuery(&q);
q.BindValue(":id", old_song.id());
if (!q.Exec()) {
@@ -751,7 +781,7 @@ void CollectionBackend::UpdateSongsBySongID(const SongMap &new_songs) {
int id = -1;
{
SqlQuery q(db);
q.prepare(QString("INSERT INTO %1 (" + Song::kColumnSpec + ") VALUES (" + Song::kBindSpec + ")").arg(songs_table_));
q.prepare(QString("INSERT INTO %1 (%2) VALUES (%3)").arg(songs_table_, Song::kColumnSpec, Song::kBindSpec));
new_song.BindToQuery(&q);
if (!q.Exec()) {
db_->ReportErrors(q);
@@ -765,7 +795,7 @@ void CollectionBackend::UpdateSongsBySongID(const SongMap &new_songs) {
{ // Add to the FTS index
SqlQuery q(db);
q.prepare(QString("INSERT INTO %1 (ROWID, " + Song::kFtsColumnSpec + ") VALUES (:id, " + Song::kFtsBindSpec + ")").arg(fts_table_));
q.prepare(QString("INSERT INTO %1 (ROWID, %2) VALUES (:id, %3)").arg(fts_table_, Song::kFtsColumnSpec, Song::kFtsBindSpec));
q.BindValue(":id", id);
new_song.BindToFtsQuery(&q);
if (!q.Exec()) {
@@ -877,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;
}
}
@@ -1103,7 +1133,7 @@ SongList CollectionBackend::GetSongsByForeignId(const QStringList &ids, const QS
QString in = ids.join(",");
SqlQuery q(db);
q.prepare(QString("SELECT %2.ROWID, " + Song::kColumnSpec + ", %2.%3 FROM %2, %1 WHERE %2.%3 IN (%4) AND %1.ROWID = %2.ROWID AND unavailable = 0").arg(songs_table_, table, column, in));
q.prepare(QString("SELECT %3.ROWID, %2, %3.%4 FROM %3, %1 WHERE %3.%4 IN (in) AND %1.ROWID = %3.ROWID AND unavailable = 0").arg(songs_table_, Song::kColumnSpec, table, column, in));
if (!q.Exec()) {
db_->ReportErrors(q);
return SongList();
@@ -1134,7 +1164,7 @@ SongList CollectionBackend::GetSongsById(const QStringList &ids, QSqlDatabase &d
QString in = ids.join(",");
SqlQuery q(db);
q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + " FROM %1 WHERE ROWID IN (%2)").arg(songs_table_, in));
q.prepare(QString("SELECT ROWID, %1 FROM %2 WHERE ROWID IN (%3)").arg(Song::kColumnSpec, songs_table_, in));
if (!q.Exec()) {
db_->ReportErrors(q);
return SongList();
@@ -1156,7 +1186,7 @@ Song CollectionBackend::GetSongByUrl(const QUrl &url, const qint64 beginning) {
QSqlDatabase db(db_->Connect());
SqlQuery q(db);
q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + " FROM %1 WHERE (url = :url1 OR url = :url2 OR url = :url3 OR url = :url4) AND beginning = :beginning AND unavailable = 0").arg(songs_table_));
q.prepare(QString("SELECT ROWID, %1 FROM %2 WHERE (url = :url1 OR url = :url2 OR url = :url3 OR url = :url4) AND beginning = :beginning AND unavailable = 0").arg(Song::kColumnSpec, songs_table_));
q.BindValue(":url1", url);
q.BindValue(":url2", url.toString());
@@ -1186,7 +1216,7 @@ SongList CollectionBackend::GetSongsByUrl(const QUrl &url, const bool unavailabl
QSqlDatabase db(db_->Connect());
SqlQuery q(db);
q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + " FROM %1 WHERE (url = :url1 OR url = :url2 OR url = :url3 OR url = :url4) AND unavailable = :unavailable").arg(songs_table_));
q.prepare(QString("SELECT ROWID, %1 FROM %2 WHERE (url = :url1 OR url = :url2 OR url = :url3 OR url = :url4) AND unavailable = :unavailable").arg(Song::kColumnSpec, songs_table_));
q.BindValue(":url1", url);
q.BindValue(":url2", url.toString());
@@ -1246,7 +1276,7 @@ SongList CollectionBackend::GetSongsBySongId(const QStringList &song_ids, QSqlDa
QString in = song_ids2.join(",");
SqlQuery q(db);
q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + " FROM %1 WHERE SONG_ID IN (%2)").arg(songs_table_, in));
q.prepare(QString("SELECT ROWID, %1 FROM %2 WHERE SONG_ID IN (%3)").arg(Song::kColumnSpec, songs_table_, in));
if (!q.Exec()) {
db_->ReportErrors(q);
return SongList();
@@ -1269,7 +1299,7 @@ SongList CollectionBackend::GetSongsByFingerprint(const QString &fingerprint) {
QSqlDatabase db(db_->Connect());
SqlQuery q(db);
q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + " FROM %1 WHERE fingerprint = :fingerprint").arg(songs_table_));
q.prepare(QString("SELECT ROWID, %1 FROM %2 WHERE fingerprint = :fingerprint").arg(Song::kColumnSpec, songs_table_));
q.BindValue(":fingerprint", fingerprint);
if (!q.Exec()) {
db_->ReportErrors(q);
@@ -1392,7 +1422,7 @@ bool CollectionBackend::UpdateCompilations(const QSqlDatabase &db, SongList &del
{ // Get song, so we can tell the model its updated
SqlQuery q(db);
q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + " FROM %1 WHERE (url = :url1 OR url = :url2 OR url = :url3 OR url = :url4) AND unavailable = 0").arg(songs_table_));
q.prepare(QString("SELECT ROWID, %1 FROM %2 WHERE (url = :url1 OR url = :url2 OR url = :url3 OR url = :url4) AND unavailable = 0").arg(Song::kColumnSpec, songs_table_));
q.BindValue(":url1", url);
q.BindValue(":url2", url.toString());
q.BindValue(":url3", url.toString(QUrl::FullyEncoded));
@@ -2013,10 +2043,10 @@ SongList CollectionBackend::GetSongsBy(const QString &artist, const QString &alb
SongList songs;
SqlQuery q(db);
if (album.isEmpty()) {
q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + " FROM %1 WHERE artist = :artist COLLATE NOCASE AND title = :title COLLATE NOCASE").arg(songs_table_));
q.prepare(QString("SELECT ROWID, %1 FROM %2 WHERE artist = :artist COLLATE NOCASE AND title = :title COLLATE NOCASE").arg(Song::kColumnSpec, songs_table_));
}
else {
q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + " FROM %1 WHERE artist = :artist COLLATE NOCASE AND album = :album COLLATE NOCASE AND title = :title COLLATE NOCASE").arg(songs_table_));
q.prepare(QString("SELECT ROWID, %1 FROM %2 WHERE artist = :artist COLLATE NOCASE AND album = :album COLLATE NOCASE AND title = :title COLLATE NOCASE").arg(Song::kColumnSpec, songs_table_));
}
q.BindValue(":artist", artist);
if (!album.isEmpty()) q.BindValue(":album", album);
@@ -2160,7 +2190,7 @@ void CollectionBackend::ExpireSongs(const int directory_id, const int expire_una
QMutexLocker l(db_->Mutex());
QSqlDatabase db(db_->Connect());
SqlQuery q(db);
q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + " FROM %1 WHERE directory_id = :directory_id AND unavailable = 1 AND lastseen > 0 AND lastseen < :time").arg(songs_table_));
q.prepare(QString("SELECT %1.ROWID, " + Song::JoinSpec("%1") + " FROM %1 LEFT JOIN playlist_items ON %1.ROWID = playlist_items.collection_id WHERE %1.directory_id = :directory_id AND %1.unavailable = 1 AND %1.lastseen > 0 AND %1.lastseen < :time AND playlist_items.collection_id IS NULL").arg(songs_table_));
q.BindValue(":directory_id", directory_id);
q.BindValue(":time", QDateTime::currentDateTime().toSecsSinceEpoch() - (expire_unavailable_songs_days * 86400));
if (!q.Exec()) {

View File

@@ -25,6 +25,7 @@
#include "config.h"
#include <optional>
#include <memory>
#include <QtGlobal>
#include <QObject>
@@ -34,10 +35,9 @@
#include <QStringList>
#include <QUrl>
#include <QSqlDatabase>
#include <QSqlQuery>
#include "core/shared_ptr.h"
#include "core/song.h"
#include "core/sqlquery.h"
#include "collectionfilteroptions.h"
#include "collectionquery.h"
#include "collectiondirectory.h"
@@ -84,7 +84,7 @@ class CollectionBackendInterface : public QObject {
virtual Song::Source source() const = 0;
virtual Database *db() const = 0;
virtual SharedPtr<Database> db() const = 0;
// Get a list of directories in the collection. Emits DirectoriesDiscovered.
virtual void LoadDirectoriesAsync() = 0;
@@ -95,6 +95,7 @@ class CollectionBackendInterface : public QObject {
virtual SongList FindSongsInDirectory(const int id) = 0;
virtual SongList SongsWithMissingFingerprint(const int id) = 0;
virtual SongList SongsWithMissingLoudnessCharacteristics(const int id) = 0;
virtual CollectionSubdirectoryList SubdirsInDirectory(const int id) = 0;
virtual CollectionDirectoryList GetAllDirectories() = 0;
virtual void ChangeDirPath(const int id, const QString &old_path, const QString &new_path) = 0;
@@ -141,7 +142,9 @@ class CollectionBackend : public CollectionBackendInterface {
Q_INVOKABLE explicit CollectionBackend(QObject *parent = nullptr);
void Init(Database *db, TaskManager *task_manager, const Song::Source source, const QString &songs_table, const QString &fts_table, const QString &dirs_table = QString(), const QString &subdirs_table = QString());
~CollectionBackend();
void Init(SharedPtr<Database> db, SharedPtr<TaskManager> task_manager, const Song::Source source, const QString &songs_table, const QString &fts_table, const QString &dirs_table = QString(), const QString &subdirs_table = QString());
void Close();
void ExitAsync();
@@ -150,7 +153,7 @@ class CollectionBackend : public CollectionBackendInterface {
Song::Source source() const override { return source_; }
Database *db() const override { return db_; }
SharedPtr<Database> db() const override { return db_; }
QString songs_table() const override { return songs_table_; }
QString fts_table() const override { return fts_table_; }
@@ -166,6 +169,7 @@ class CollectionBackend : public CollectionBackendInterface {
SongList FindSongsInDirectory(const int id) override;
SongList SongsWithMissingFingerprint(const int id) override;
SongList SongsWithMissingLoudnessCharacteristics(const int id) override;
CollectionSubdirectoryList SubdirsInDirectory(const int id) override;
CollectionDirectoryList GetAllDirectories() override;
void ChangeDirPath(const int id, const QString &old_path, const QString &new_path) override;
@@ -305,8 +309,8 @@ class CollectionBackend : public CollectionBackendInterface {
SongList GetSongsBySongId(const QStringList &song_ids, QSqlDatabase &db);
private:
Database *db_;
TaskManager *task_manager_;
SharedPtr<Database> db_;
SharedPtr<TaskManager> task_manager_;
Song::Source source_;
QString songs_table_;
QString dirs_table_;

View File

@@ -20,12 +20,15 @@
#include "config.h"
#include <memory>
#include <QObject>
#include <QStandardItemModel>
#include <QAbstractItemModel>
#include <QVariant>
#include <QString>
#include "core/shared_ptr.h"
#include "core/filesystemmusicstorage.h"
#include "core/iconloader.h"
#include "core/musicstorage.h"
@@ -34,24 +37,24 @@
#include "collectionbackend.h"
#include "collectiondirectorymodel.h"
CollectionDirectoryModel::CollectionDirectoryModel(CollectionBackend *backend, QObject *parent)
using std::make_shared;
CollectionDirectoryModel::CollectionDirectoryModel(SharedPtr<CollectionBackend> backend, QObject *parent)
: QStandardItemModel(parent),
dir_icon_(IconLoader::Load("document-open-folder")),
backend_(backend) {
QObject::connect(backend_, &CollectionBackend::DirectoryDiscovered, this, &CollectionDirectoryModel::DirectoryDiscovered);
QObject::connect(backend_, &CollectionBackend::DirectoryDeleted, this, &CollectionDirectoryModel::DirectoryDeleted);
QObject::connect(&*backend_, &CollectionBackend::DirectoryDiscovered, this, &CollectionDirectoryModel::DirectoryDiscovered);
QObject::connect(&*backend_, &CollectionBackend::DirectoryDeleted, this, &CollectionDirectoryModel::DirectoryDeleted);
}
CollectionDirectoryModel::~CollectionDirectoryModel() = default;
void CollectionDirectoryModel::DirectoryDiscovered(const CollectionDirectory &dir) {
QStandardItem *item = new QStandardItem(dir.path);
item->setData(dir.id, kIdRole);
item->setIcon(dir_icon_);
storage_ << std::make_shared<FilesystemMusicStorage>(backend_->source(), dir.path, dir.id);
storage_ << make_shared<FilesystemMusicStorage>(backend_->source(), dir.path, dir.id);
appendRow(item);
}

View File

@@ -23,8 +23,6 @@
#include "config.h"
#include <memory>
#include <QObject>
#include <QStandardItemModel>
#include <QList>
@@ -32,6 +30,8 @@
#include <QString>
#include <QIcon>
#include "core/shared_ptr.h"
class QModelIndex;
struct CollectionDirectory;
@@ -42,8 +42,7 @@ class CollectionDirectoryModel : public QStandardItemModel {
Q_OBJECT
public:
explicit CollectionDirectoryModel(CollectionBackend *backend, QObject *parent = nullptr);
~CollectionDirectoryModel() override;
explicit CollectionDirectoryModel(SharedPtr<CollectionBackend> collection_backend, QObject *parent = nullptr);
// To be called by GUIs
void AddDirectory(const QString &path);
@@ -60,8 +59,8 @@ class CollectionDirectoryModel : public QStandardItemModel {
static const int kIdRole = Qt::UserRole + 1;
QIcon dir_icon_;
CollectionBackend *backend_;
QList<std::shared_ptr<MusicStorage>> storage_;
SharedPtr<CollectionBackend> backend_;
QList<SharedPtr<MusicStorage>> storage_;
};
#endif // COLLECTIONDIRECTORYMODEL_H

View File

@@ -48,7 +48,6 @@
#include "core/logging.h"
#include "collectionfilteroptions.h"
#include "collectionmodel.h"
#include "collectionquery.h"
#include "savedgroupingmanager.h"
#include "collectionfilterwidget.h"
#include "groupbydialog.h"
@@ -74,6 +73,7 @@ CollectionFilterWidget::CollectionFilterWidget(QWidget *parent)
ui_->setupUi(this);
QString available_fields = Song::kFtsColumns.join(", ").replace(QRegularExpression("\\bfts"), "");
available_fields += QString(", ") + Song::kNumericalColumns.join(", ");
ui_->search_field->setToolTip(
QString("<html><head/><body><p>") +
@@ -81,18 +81,26 @@ CollectionFilterWidget::CollectionFilterWidget(QWidget *parent)
QString(" ") +
QString("<span style=\"font-weight:600;\">") +
tr("artist") +
QString(":") +
QString("</span><span style=\"font-style:italic;\">Strawbs</span>") +
QString(" ") +
tr("searches the collection for all artists that contain the word") +
QString(" Strawbs.") +
QString(":</span><span style=\"font-style:italic;\">Strawbs</span> ") +
tr("searches the collection for all artists that contain the word %1. ").arg("Strawbs") +
QString("</p><p>") +
tr("Search terms for numerical fields can be prefixed with %1 or %2 to refine the search, e.g.: ")
.arg(" =, !=, &lt;, &gt;, &lt;=", "&gt;=") +
QString("<span style=\"font-weight:600;\">") +
tr("rating") +
QString("</span>") +
QString(":>=") +
QString("<span style=\"font-weight:italic;\">4</span>") +
QString("</p><p><span style=\"font-weight:600;\">") +
tr("Available fields") +
QString(": ") +
"</span><span style=\"font-style:italic;\">" +
QString("</span>") +
QString("<span style=\"font-style:italic;\">") +
available_fields +
QString("</span>.") +
QString("</p></body></html>"));
QString("</p></body></html>")
);
QObject::connect(ui_->search_field, &QSearchField::returnPressed, this, &CollectionFilterWidget::ReturnPressed);
QObject::connect(filter_delay_, &QTimer::timeout, this, &CollectionFilterWidget::FilterDelayTimeout);

View File

@@ -31,8 +31,6 @@
#include <QHash>
#include <QString>
#include "collectionquery.h"
#include "collectionqueryoptions.h"
#include "collectionmodel.h"
class QTimer;
@@ -135,7 +133,6 @@ class CollectionFilterWidget : public QWidget {
QString settings_group_;
QString saved_groupings_settings_group_;
QString settings_prefix_;
};
#endif // COLLECTIONFILTERWIDGET_H

View File

@@ -127,7 +127,7 @@ bool CollectionItemDelegate::helpEvent(QHelpEvent *event, QAbstractItemView *vie
QString text = displayText(idx.data(), QLocale::system());
if (text.isEmpty() || !event) return false;
if (text.isEmpty()) return false;
switch (event->type()) {
case QEvent::ToolTip: {

View File

@@ -53,6 +53,8 @@
#include <QSettings>
#include <QStandardPaths>
#include "core/scoped_ptr.h"
#include "core/shared_ptr.h"
#include "core/application.h"
#include "core/database.h"
#include "core/iconloader.h"
@@ -68,17 +70,17 @@
#include "collectionmodel.h"
#include "playlist/playlistmanager.h"
#include "playlist/songmimedata.h"
#include "covermanager/albumcoverloader.h"
#include "covermanager/albumcoverloaderoptions.h"
#include "covermanager/albumcoverloaderresult.h"
#include "covermanager/albumcoverloader.h"
#include "settings/collectionsettingspage.h"
#include "settings/coverssettingspage.h"
const int CollectionModel::kPrettyCoverSize = 32;
const char *CollectionModel::kPixmapDiskCacheDir = "pixmapcache";
QNetworkDiskCache *CollectionModel::sIconCache = nullptr;
CollectionModel::CollectionModel(CollectionBackend *backend, Application *app, QObject *parent)
CollectionModel::CollectionModel(SharedPtr<CollectionBackend> backend, Application *app, QObject *parent)
: SimpleTreeModel<CollectionItem>(new CollectionItem(this), parent),
backend_(backend),
app_(app),
@@ -103,7 +105,7 @@ CollectionModel::CollectionModel(CollectionBackend *backend, Application *app, Q
group_by_[2] = GroupBy::None;
if (app_) {
QObject::connect(app_->album_cover_loader(), &AlbumCoverLoader::AlbumCoverLoaded, this, &CollectionModel::AlbumCoverLoaded);
QObject::connect(&*app_->album_cover_loader(), &AlbumCoverLoader::AlbumCoverLoaded, this, &CollectionModel::AlbumCoverLoaded);
}
QIcon nocover = IconLoader::Load("cdcase");
@@ -118,14 +120,14 @@ CollectionModel::CollectionModel(CollectionBackend *backend, Application *app, Q
QObject::connect(app_, &Application::ClearPixmapDiskCache, this, &CollectionModel::ClearDiskCache);
}
QObject::connect(backend_, &CollectionBackend::SongsDiscovered, this, &CollectionModel::SongsDiscovered);
QObject::connect(backend_, &CollectionBackend::SongsDeleted, this, &CollectionModel::SongsDeleted);
QObject::connect(backend_, &CollectionBackend::DatabaseReset, this, &CollectionModel::Reset);
QObject::connect(backend_, &CollectionBackend::TotalSongCountUpdated, this, &CollectionModel::TotalSongCountUpdatedSlot);
QObject::connect(backend_, &CollectionBackend::TotalArtistCountUpdated, this, &CollectionModel::TotalArtistCountUpdatedSlot);
QObject::connect(backend_, &CollectionBackend::TotalAlbumCountUpdated, this, &CollectionModel::TotalAlbumCountUpdatedSlot);
QObject::connect(backend_, &CollectionBackend::SongsStatisticsChanged, this, &CollectionModel::SongsSlightlyChanged);
QObject::connect(backend_, &CollectionBackend::SongsRatingChanged, this, &CollectionModel::SongsSlightlyChanged);
QObject::connect(&*backend_, &CollectionBackend::SongsDiscovered, this, &CollectionModel::SongsDiscovered);
QObject::connect(&*backend_, &CollectionBackend::SongsDeleted, this, &CollectionModel::SongsDeleted);
QObject::connect(&*backend_, &CollectionBackend::DatabaseReset, this, &CollectionModel::Reset);
QObject::connect(&*backend_, &CollectionBackend::TotalSongCountUpdated, this, &CollectionModel::TotalSongCountUpdatedSlot);
QObject::connect(&*backend_, &CollectionBackend::TotalArtistCountUpdated, this, &CollectionModel::TotalArtistCountUpdatedSlot);
QObject::connect(&*backend_, &CollectionBackend::TotalAlbumCountUpdated, this, &CollectionModel::TotalAlbumCountUpdatedSlot);
QObject::connect(&*backend_, &CollectionBackend::SongsStatisticsChanged, this, &CollectionModel::SongsSlightlyChanged);
QObject::connect(&*backend_, &CollectionBackend::SongsRatingChanged, this, &CollectionModel::SongsSlightlyChanged);
backend_->UpdateTotalSongCountAsync();
backend_->UpdateTotalArtistCountAsync();
@@ -136,7 +138,11 @@ CollectionModel::CollectionModel(CollectionBackend *backend, Application *app, Q
}
CollectionModel::~CollectionModel() {
qLog(Debug) << "Collection model" << this << "for" << Song::TextForSource(backend_->source()) << "deleted";
delete root_;
}
void CollectionModel::set_pretty_covers(const bool use_pretty_covers) {
@@ -632,10 +638,10 @@ QVariant CollectionModel::AlbumIcon(const QModelIndex &idx) {
// Try to load it from the disk cache
if (use_disk_cache_ && sIconCache) {
std::unique_ptr<QIODevice> disk_cache_img(sIconCache->data(AlbumIconPixmapDiskCacheKey(cache_key)));
ScopedPtr<QIODevice> disk_cache_img(sIconCache->data(AlbumIconPixmapDiskCacheKey(cache_key)));
if (disk_cache_img) {
QImage cached_image;
if (cached_image.load(disk_cache_img.get(), "XPM")) {
if (cached_image.load(&*disk_cache_img, "XPM")) {
QPixmapCache::insert(cache_key, QPixmap::fromImage(cached_image));
return QPixmap::fromImage(cached_image);
}
@@ -688,7 +694,7 @@ void CollectionModel::AlbumCoverLoaded(const quint64 id, const AlbumCoverLoaderR
// If we have a valid cover not already in the disk cache
if (use_disk_cache_ && sIconCache && result.success && !result.image_scaled.isNull()) {
const QUrl disk_cache_key = AlbumIconPixmapDiskCacheKey(cache_key);
std::unique_ptr<QIODevice> disk_cache_img(sIconCache->data(disk_cache_key));
ScopedPtr<QIODevice> disk_cache_img(sIconCache->data(disk_cache_key));
if (!disk_cache_img) {
QNetworkCacheMetaData disk_cache_metadata;
disk_cache_metadata.setSaveToDisk(true);

View File

@@ -45,13 +45,13 @@
#include <QPixmap>
#include <QNetworkDiskCache>
#include "core/shared_ptr.h"
#include "core/simpletreemodel.h"
#include "core/song.h"
#include "core/sqlrow.h"
#include "covermanager/albumcoverloader.h"
#include "covermanager/albumcoverloaderoptions.h"
#include "covermanager/albumcoverloaderresult.h"
#include "collectionfilteroptions.h"
#include "collectionquery.h"
#include "collectionqueryoptions.h"
#include "collectionitem.h"
@@ -65,7 +65,7 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
Q_OBJECT
public:
explicit CollectionModel(CollectionBackend *backend, Application *app, QObject *parent = nullptr);
explicit CollectionModel(SharedPtr<CollectionBackend> backend, Application *app, QObject *parent = nullptr);
~CollectionModel() override;
static const int kPrettyCoverSize;
@@ -132,7 +132,7 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
bool create_va;
};
CollectionBackend *backend() const { return backend_; }
SharedPtr<CollectionBackend> backend() const { return backend_; }
CollectionDirectoryModel *directory_model() const { return dir_model_; }
// Call before Init()
@@ -274,7 +274,7 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
static qint64 MaximumCacheSize(QSettings *s, const char *size_id, const char *size_unit_id, const qint64 cache_size_default);
private:
CollectionBackend *backend_;
SharedPtr<CollectionBackend> backend_;
Application *app_;
CollectionDirectoryModel *dir_model_;
bool show_various_artists_;

View File

@@ -32,13 +32,11 @@
#include <QSqlDatabase>
#include <QSqlQuery>
#include "core/logging.h"
#include "core/sqlquery.h"
#include "core/song.h"
#include "collectionquery.h"
#include "collectionfilteroptions.h"
#include "collectionqueryoptions.h"
#include "utilities/searchparserutils.h"
CollectionQuery::CollectionQuery(const QSqlDatabase &db, const QString &songs_table, const QString &fts_table, const CollectionFilterOptions &filter_options)
: QSqlQuery(db),
@@ -56,36 +54,48 @@ CollectionQuery::CollectionQuery(const QSqlDatabase &db, const QString &songs_ta
// 3) Remove colons which don't correspond to column names.
// Split on whitespace
QString filter_text = filter_options.filter_text().replace(QRegularExpression(":\\s+"), ":");
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QStringList tokens(filter_options.filter_text().split(QRegularExpression("\\s+"), Qt::SkipEmptyParts));
QStringList tokens(filter_text.split(QRegularExpression("\\s+"), Qt::SkipEmptyParts));
#else
QStringList tokens(filter_options.filter_text().split(QRegularExpression("\\s+"), QString::SkipEmptyParts));
QStringList tokens(filter_text.split(QRegularExpression("\\s+"), QString::SkipEmptyParts));
#endif
QString query;
for (QString token : tokens) {
token.remove('(');
token.remove(')');
token.remove('"');
token.replace('-', ' ');
token.remove('(')
.remove(')')
.remove('"')
.replace('-', ' ');
if (token.contains(':')) {
// Only prefix fts if the token is a valid column name.
if (Song::kFtsColumns.contains("fts" + token.section(':', 0, 0), Qt::CaseInsensitive)) {
// Account for multiple colons.
QString columntoken = token.section(':', 0, 0, QString::SectionIncludeTrailingSep);
QString subtoken = token.section(':', 1, -1);
subtoken.replace(":", " ");
subtoken = subtoken.trimmed();
if (!subtoken.isEmpty()) {
if (!query.isEmpty()) query.append(" ");
query += "fts" + columntoken + "\"" + subtoken + "\"*";
const QString columntoken = token.section(':', 0, 0);
QString subtoken = token.section(':', 1, -1).replace(":", " ").trimmed();
if (subtoken.isEmpty()) continue;
if (Song::kFtsColumns.contains("fts" + columntoken, Qt::CaseInsensitive)) {
if (!query.isEmpty()) query.append(" ");
query += "fts" + columntoken + ":\"" + subtoken + "\"*";
}
else if (Song::kNumericalColumns.contains(columntoken, Qt::CaseInsensitive)) {
QString comparator = RemoveSqlOperator(subtoken);
if (columntoken.compare("rating", Qt::CaseInsensitive) == 0) {
AddWhereRating(subtoken, comparator);
}
else if (columntoken.compare("length", Qt::CaseInsensitive) == 0) {
// Time is saved in nanoseconds, so add 9 0's
QString parsedTime = QString::number(Utilities::ParseSearchTime(subtoken)) + "000000000";
AddWhere(columntoken, parsedTime, comparator);
}
else {
AddWhere(columntoken, subtoken, comparator);
}
}
// Not a valid filter, remove
else {
token.replace(":", " ");
token = token.trimmed();
if (!query.isEmpty()) query.append(" ");
query += "\"" + token + "\"*";
token = token.replace(":", " ").trimmed();
if (!token.isEmpty()) {
if (!query.isEmpty()) query.append(" ");
query += "\"" + token + "\"*";
}
}
}
else {
@@ -121,6 +131,24 @@ CollectionQuery::CollectionQuery(const QSqlDatabase &db, const QString &songs_ta
}
QString CollectionQuery::RemoveSqlOperator(QString &token) {
QString op = "=";
static QRegularExpression rxOp("^(=|<[>=]?|>=?|!=)");
QRegularExpressionMatch match = rxOp.match(token);
if (match.hasMatch()) {
op = match.captured(0);
}
token.remove(rxOp);
if (op == "!=") {
op = "<>";
}
return op;
}
void CollectionQuery::AddWhere(const QString &column, const QVariant &value, const QString &op) {
// Ignore 'literal' for IN
@@ -170,6 +198,37 @@ void CollectionQuery::AddWhereArtist(const QVariant &value) {
}
void CollectionQuery::AddWhereRating(const QVariant &value, const QString &op) {
float parsed_rating = Utilities::ParseSearchRating(value.toString());
// You can't query the database for a float, due to float precision errors,
// So we have to use a certain tolerance, so that the searched value is definetly included.
const float tolerance = 0.001F;
if (op == "<") {
AddWhere("rating", parsed_rating-tolerance, "<");
}
else if (op == ">") {
AddWhere("rating", parsed_rating+tolerance, ">");
}
else if (op == "<=") {
AddWhere("rating", parsed_rating+tolerance, "<=");
}
else if (op == ">=") {
AddWhere("rating", parsed_rating-tolerance, ">=");
}
else if (op == "<>") {
where_clauses_ << QString("(rating<? OR rating>?)");
bound_values_ << parsed_rating - tolerance;
bound_values_ << parsed_rating + tolerance;
}
else /* (op == "=") */ {
AddWhere("rating", parsed_rating+tolerance, "<");
AddWhere("rating", parsed_rating-tolerance, ">");
}
}
void CollectionQuery::AddCompilationRequirement(const bool compilation) {
// The unary + is added to prevent sqlite from using the index idx_comp_artist.
// When joining with fts, sqlite 3.8 has a tendency to use this index and thereby nesting the tables in an order which gives very poor performance
@@ -213,7 +272,7 @@ bool CollectionQuery::Exec() {
sql.replace("%fts_table_noprefix", fts_table_.section('.', -1, -1));
sql.replace("%fts_table", fts_table_);
QSqlQuery::prepare(sql);
if (!QSqlQuery::prepare(sql)) return false;
// Bind values
for (const QVariant &value : bound_values_) {

View File

@@ -32,7 +32,6 @@
#include <QSqlQuery>
#include "collectionfilteroptions.h"
#include "collectionqueryoptions.h"
class CollectionQuery : public QSqlQuery {
public:
@@ -62,10 +61,15 @@ class CollectionQuery : public QSqlQuery {
void SetOrderBy(const QString &order_by) { order_by_ = order_by; }
void SetWhereClauses(const QStringList &where_clauses) { where_clauses_ = where_clauses; }
// Removes = < > <= >= <> from the beginning of the input string and returns the operator
// If the input String has no operator, returns "="
QString RemoveSqlOperator(QString &token);
// Adds a fragment of WHERE clause. When executed, this Query will connect all the fragments with AND operator.
// Please note that IN operator expects a QStringList as value.
void AddWhere(const QString &column, const QVariant &value, const QString &op = "=");
void AddWhereArtist(const QVariant &value);
void AddWhereRating(const QVariant &value, const QString &op = "=");
void SetBoundValues(const QVariantList &bound_values) { bound_values_ = bound_values; }
void SetDuplicatesOnly(const bool duplicates_only) { duplicates_only_ = duplicates_only; }

View File

@@ -21,7 +21,6 @@
#include <QString>
#include "collectionqueryoptions.h"
#include "collectionfilteroptions.h"
CollectionQueryOptions::CollectionQueryOptions()
: compilation_requirement_(CollectionQueryOptions::CompilationRequirement::None),

View File

@@ -30,7 +30,7 @@ class CollectionQueryOptions {
explicit CollectionQueryOptions();
struct Where {
explicit Where(const QString _column = QString(), const QVariant _value = QString(), const QString _op = QString()) : column(_column), value(_value), op(_op) {}
explicit Where(const QString &_column = QString(), const QVariant &_value = QString(), const QString &_op = QString()) : column(_column), value(_value), op(_op) {}
QString column;
QVariant value;
QString op;

View File

@@ -19,10 +19,11 @@
#include <QString>
#include "core/shared_ptr.h"
#include "core/taskmanager.h"
#include "collectiontask.h"
CollectionTask::CollectionTask(TaskManager *task_manager, const QString &message) : task_manager_(task_manager), task_id_(-1) {
CollectionTask::CollectionTask(SharedPtr<TaskManager> task_manager, const QString &message) : task_manager_(task_manager), task_id_(-1) {
if (task_manager_) task_id_ = task_manager_->StartTask(message);

View File

@@ -23,15 +23,17 @@
#include <QtGlobal>
#include <QString>
#include "core/shared_ptr.h"
class TaskManager;
class CollectionTask {
public:
explicit CollectionTask(TaskManager *task_manager, const QString &message);
explicit CollectionTask(SharedPtr<TaskManager> task_manager, const QString &message);
~CollectionTask();
private:
TaskManager *task_manager_;
SharedPtr<TaskManager> task_manager_;
int task_id_;
Q_DISABLE_COPY(CollectionTask)

View File

@@ -71,6 +71,8 @@
#include "organize/organizeerrordialog.h"
#include "settings/collectionsettingspage.h"
using std::make_unique;
CollectionView::CollectionView(QWidget *parent)
: AutoExpandingTreeView(parent),
app_(nullptr),
@@ -402,7 +404,6 @@ void CollectionView::contextMenuEvent(QContextMenuEvent *e) {
}
const int songs_selected = regular_elements;
const bool regular_elements_only = songs_selected == regular_elements && regular_elements > 0;
// in all modes
action_load_->setEnabled(songs_selected > 0);
@@ -430,8 +431,8 @@ void CollectionView::contextMenuEvent(QContextMenuEvent *e) {
action_delete_files_->setVisible(false);
#endif
action_show_in_various_->setVisible(regular_elements_only);
action_no_show_in_various_->setVisible(regular_elements_only);
action_show_in_various_->setVisible(songs_selected > 0);
action_no_show_in_various_->setVisible(songs_selected > 0);
// only when all selected items are editable
action_organize_->setEnabled(regular_elements == regular_editable);
@@ -573,7 +574,7 @@ SongList CollectionView::GetSelectedSongs() const {
void CollectionView::Organize() {
if (!organize_dialog_) {
organize_dialog_ = std::make_unique<OrganizeDialog>(app_->task_manager(), app_->collection_backend(), this);
organize_dialog_ = make_unique<OrganizeDialog>(app_->task_manager(), app_->collection_backend(), this);
}
organize_dialog_->SetDestinationModel(app_->collection_model()->directory_model());
@@ -591,8 +592,8 @@ void CollectionView::Organize() {
void CollectionView::EditTracks() {
if (!edit_tag_dialog_) {
edit_tag_dialog_ = std::make_unique<EditTagDialog>(app_, this);
QObject::connect(edit_tag_dialog_.get(), &EditTagDialog::Error, this, &CollectionView::EditTagError);
edit_tag_dialog_ = make_unique<EditTagDialog>(app_, this);
QObject::connect(&*edit_tag_dialog_, &EditTagDialog::Error, this, &CollectionView::EditTagError);
}
const SongList songs = GetSelectedSongs();
edit_tag_dialog_->SetSongs(songs);
@@ -614,7 +615,7 @@ void CollectionView::CopyToDevice() {
#ifndef Q_OS_WIN
if (!organize_dialog_) {
organize_dialog_ = std::make_unique<OrganizeDialog>(app_->task_manager(), nullptr, this);
organize_dialog_ = make_unique<OrganizeDialog>(app_->task_manager(), nullptr, this);
}
organize_dialog_->SetDestinationModel(app_->device_manager()->connected_devices_model(), true);
@@ -686,7 +687,7 @@ void CollectionView::Delete() {
if (DeleteConfirmationDialog::warning(files) != QDialogButtonBox::Yes) return;
// We can cheat and always take the storage of the first directory, since they'll all be FilesystemMusicStorage in a collection and deleting doesn't check the actual directory.
std::shared_ptr<MusicStorage> storage = app_->collection_model()->directory_model()->index(0, 0).data(MusicStorage::Role_Storage).value<std::shared_ptr<MusicStorage>>();
SharedPtr<MusicStorage> storage = app_->collection_model()->directory_model()->index(0, 0).data(MusicStorage::Role_Storage).value<SharedPtr<MusicStorage>>();
DeleteFiles *delete_files = new DeleteFiles(app_->task_manager(), storage, true);
QObject::connect(delete_files, &DeleteFiles::Finished, this, &CollectionView::DeleteFilesFinished);

View File

@@ -24,8 +24,6 @@
#include "config.h"
#include <memory>
#include <QObject>
#include <QAbstractItemModel>
#include <QAbstractItemView>
@@ -33,6 +31,7 @@
#include <QPixmap>
#include <QSet>
#include "core/scoped_ptr.h"
#include "core/song.h"
#include "widgets/autoexpandingtreeview.h"
@@ -148,8 +147,8 @@ class CollectionView : public AutoExpandingTreeView {
QAction *action_no_show_in_various_;
QAction *action_delete_files_;
std::unique_ptr<OrganizeDialog> organize_dialog_;
std::unique_ptr<EditTagDialog> edit_tag_dialog_;
ScopedPtr<OrganizeDialog> organize_dialog_;
ScopedPtr<EditTagDialog> edit_tag_dialog_;
bool is_in_keyboard_search_;
bool delete_files_;

View File

@@ -44,8 +44,11 @@ CollectionViewContainer::CollectionViewContainer(QWidget *parent) : QWidget(pare
}
CollectionViewContainer::~CollectionViewContainer() { delete ui_; }
CollectionView *CollectionViewContainer::view() const { return ui_->view; }
CollectionFilterWidget *CollectionViewContainer::filter_widget() const { return ui_->filter; }
void CollectionViewContainer::ReloadSettings() const {
filter_widget()->ReloadSettings();
view()->ReloadSettings();

View File

@@ -48,4 +48,3 @@ class CollectionViewContainer : public QWidget {
};
#endif // COLLECTIONVIEWCONTAINER_H

View File

@@ -55,9 +55,13 @@
#include "collectionwatcher.h"
#include "playlistparsers/cueparser.h"
#include "settings/collectionsettingspage.h"
#include "engine/ebur128measures.h"
#ifdef HAVE_SONGFINGERPRINTING
# include "engine/chromaprinter.h"
#endif
#ifdef HAVE_EBUR128
# include "engine/ebur128analysis.h"
#endif
// This is defined by one of the windows headers that is included by taglib.
#ifdef RemoveDirectory
@@ -67,6 +71,7 @@
using namespace std::chrono_literals;
QStringList CollectionWatcher::sValidImages = QStringList() << "jpg" << "png" << "gif" << "jpeg";
QStringList CollectionWatcher::kIgnoredExtensions = QStringList() << "tmp" << "tar" << "gz" << "bz2" << "xz" << "tbz" << "tgz" << "z" << "zip" << "rar";
CollectionWatcher::CollectionWatcher(Song::Source source, QObject *parent)
: QObject(parent),
@@ -78,6 +83,7 @@ CollectionWatcher::CollectionWatcher(Song::Source source, QObject *parent)
scan_on_startup_(true),
monitor_(true),
song_tracking_(false),
song_ebur128_loudness_analysis_(false),
mark_songs_unavailable_(source_ == Song::Source::Collection),
expire_unavailable_songs_days_(60),
overwrite_playcount_(false),
@@ -114,6 +120,12 @@ CollectionWatcher::CollectionWatcher(Song::Source source, QObject *parent)
}
CollectionWatcher::~CollectionWatcher() {
qLog(Debug) << "Collection watcher" << this << "for" << Song::TextForSource(source_) << "deleted.";
}
void CollectionWatcher::ExitAsync() {
QMetaObject::invokeMethod(this, &CollectionWatcher::Exit, Qt::QueuedConnection);
}
@@ -145,10 +157,12 @@ void CollectionWatcher::ReloadSettings() {
QStringList filters = s.value("cover_art_patterns", QStringList() << "front" << "cover").toStringList();
if (source_ == Song::Source::Collection) {
song_tracking_ = s.value("song_tracking", false).toBool();
song_ebur128_loudness_analysis_ = s.value("song_ebur128_loudness_analysis", false).toBool();
mark_songs_unavailable_ = song_tracking_ ? true : s.value("mark_songs_unavailable", true).toBool();
}
else {
song_tracking_ = false;
song_ebur128_loudness_analysis_ = false;
mark_songs_unavailable_ = false;
}
expire_unavailable_songs_days_ = s.value("expire_unavailable_songs", 60).toInt();
@@ -195,6 +209,7 @@ CollectionWatcher::ScanTransaction::ScanTransaction(CollectionWatcher *watcher,
watcher_(watcher),
cached_songs_dirty_(true),
cached_songs_missing_fingerprint_dirty_(true),
cached_songs_missing_loudness_characteristics_dirty_(true),
known_subdirs_dirty_(true) {
QString description;
@@ -329,6 +344,21 @@ bool CollectionWatcher::ScanTransaction::HasSongsWithMissingFingerprint(const QS
}
bool CollectionWatcher::ScanTransaction::HasSongsWithMissingLoudnessCharacteristics(const QString &path) {
if (cached_songs_missing_loudness_characteristics_dirty_) {
const SongList songs = watcher_->backend_->SongsWithMissingLoudnessCharacteristics(dir_);
for (const Song &song : songs) {
const QString p = song.url().toLocalFile().section('/', 0, -2);
cached_songs_missing_loudness_characteristics_.insert(p, song);
}
cached_songs_missing_loudness_characteristics_dirty_ = false;
}
return cached_songs_missing_loudness_characteristics_.contains(path);
}
void CollectionWatcher::ScanTransaction::SetKnownSubdirs(const CollectionSubdirectoryList &subdirs) {
known_subdirs_ = subdirs;
@@ -426,13 +456,19 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const CollectionSu
}
bool songs_missing_fingerprint = false;
bool songs_missing_loudness_characteristics = false;
#ifdef HAVE_SONGFINGERPRINTING
if (song_tracking_) {
songs_missing_fingerprint = t->HasSongsWithMissingFingerprint(path);
}
#endif
#ifdef HAVE_EBUR128
if (song_ebur128_loudness_analysis_) {
songs_missing_loudness_characteristics = t->HasSongsWithMissingLoudnessCharacteristics(path);
}
#endif
if (!t->ignores_mtime() && !force_noincremental && t->is_incremental() && subdir.mtime == path_info.lastModified().toSecsSinceEpoch() && !songs_missing_fingerprint) {
if (!t->ignores_mtime() && !force_noincremental && t->is_incremental() && subdir.mtime == path_info.lastModified().toSecsSinceEpoch() && !songs_missing_fingerprint && !songs_missing_loudness_characteristics) {
// The directory hasn't changed since last time
t->AddToProgress(files_count);
return;
@@ -474,7 +510,7 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const CollectionSu
else {
QString ext_part(ExtensionPart(child));
QString dir_part(DirectoryPart(child));
if (child_info.suffix() == "tmp" || child_info.baseName() == "qt_temp") {
if (kIgnoredExtensions.contains(child_info.suffix(), Qt::CaseInsensitive) || child_info.baseName() == "qt_temp") {
t->AddToProgress(1);
}
else if (sValidImages.contains(ext_part)) {
@@ -545,11 +581,17 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const CollectionSu
}
bool missing_fingerprint = false;
bool missing_loudness_characteristics = false;
#ifdef HAVE_SONGFINGERPRINTING
if (song_tracking_ && matching_song.fingerprint().isEmpty()) {
missing_fingerprint = true;
}
#endif
#ifdef HAVE_EBUR128
if (song_ebur128_loudness_analysis_ && (!matching_song.ebur128_integrated_loudness_lufs() || !matching_song.ebur128_loudness_range_lu())) {
missing_loudness_characteristics = true;
}
#endif
if (changed) {
qLog(Debug) << file << "has changed.";
@@ -557,9 +599,12 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const CollectionSu
else if (missing_fingerprint) {
qLog(Debug) << file << "is missing fingerprint.";
}
else if (missing_loudness_characteristics) {
qLog(Debug) << file << "is missing EBU R 128 loudness characteristics.";
}
// The song's changed or missing fingerprint - create fingerprint and reread the metadata from file.
if (t->ignores_mtime() || changed || missing_fingerprint) {
if (t->ignores_mtime() || changed || missing_fingerprint || missing_loudness_characteristics) {
QString fingerprint;
#ifdef HAVE_SONGFINGERPRINTING
@@ -578,11 +623,11 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const CollectionSu
else { // If CUE associated.
UpdateCueAssociatedSongs(file, path, fingerprint, new_cue, art_automatic, matching_songs, t);
}
}
// 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;
}
@@ -728,6 +773,7 @@ void CollectionWatcher::UpdateCueAssociatedSongs(const QString &file,
for (Song new_cue_song : songs) {
new_cue_song.set_source(source_);
new_cue_song.set_directory_id(t->dir());
PerformEBUR128Analysis(new_cue_song);
new_cue_song.set_fingerprint(fingerprint);
if (sections_map.contains(new_cue_song.beginning_nanosec())) { // Changed section
@@ -749,7 +795,6 @@ void CollectionWatcher::UpdateCueAssociatedSongs(const QString &file,
t->deleted_songs << old_cue;
}
}
}
void CollectionWatcher::UpdateNonCueAssociatedSong(const QString &file,
@@ -775,6 +820,7 @@ void CollectionWatcher::UpdateNonCueAssociatedSong(const QString &file,
song_on_disk.set_source(source_);
song_on_disk.set_directory_id(t->dir());
song_on_disk.set_id(matching_song.id());
PerformEBUR128Analysis(song_on_disk);
song_on_disk.set_fingerprint(fingerprint);
song_on_disk.set_art_automatic(art_automatic);
song_on_disk.MergeUserSetData(matching_song, !overwrite_playcount_, !overwrite_rating_);
@@ -810,6 +856,7 @@ SongList CollectionWatcher::ScanNewFile(const QString &file, const QString &path
songs.reserve(cue_congs.count());
for (Song &cue_song : cue_congs) {
cue_song.set_source(source_);
PerformEBUR128Analysis(cue_song);
cue_song.set_fingerprint(fingerprint);
if (cue_song.url().toLocalFile().normalized(QString::NormalizationForm_D) == file_nfd) {
songs << cue_song;
@@ -824,6 +871,7 @@ SongList CollectionWatcher::ScanNewFile(const QString &file, const QString &path
TagReaderClient::Instance()->ReadFileBlocking(file, &song);
if (song.is_valid()) {
song.set_source(source_);
PerformEBUR128Analysis(song);
song.set_fingerprint(fingerprint);
songs << song;
}
@@ -839,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 {
@@ -875,6 +923,10 @@ void CollectionWatcher::AddChangedSong(const QString &file, const Song &matching
changes << "musicbrainz";
notify_new = true;
}
if (!matching_song.IsEBUR128Equal(new_song)) {
changes << "ebur128 loudness characteristics";
notify_new = true;
}
if (matching_song.mtime() != new_song.mtime()) {
changes << "mtime";
}
@@ -897,6 +949,20 @@ void CollectionWatcher::AddChangedSong(const QString &file, const Song &matching
}
void CollectionWatcher::PerformEBUR128Analysis(Song &song) const {
if (!song_ebur128_loudness_analysis_) return;
#ifdef HAVE_EBUR128
std::optional<EBUR128Measures> loudness_characteristics = EBUR128Analysis::Compute(song);
if (loudness_characteristics) {
song.set_ebur128_integrated_loudness_lufs(loudness_characteristics->loudness_lufs);
song.set_ebur128_loudness_range_lu(loudness_characteristics->range_lu);
}
#endif
}
quint64 CollectionWatcher::GetMtimeForCue(const QString &cue_path) {
if (cue_path.isEmpty()) {

View File

@@ -35,6 +35,7 @@
#include <QUrl>
#include "collectiondirectory.h"
#include "core/shared_ptr.h"
#include "core/song.h"
class QThread;
@@ -50,11 +51,12 @@ class CollectionWatcher : public QObject {
public:
explicit CollectionWatcher(Song::Source source, QObject *parent = nullptr);
~CollectionWatcher();
Song::Source source() { return source_; }
void set_backend(CollectionBackend *backend) { backend_ = backend; }
void set_task_manager(TaskManager *task_manager) { task_manager_ = task_manager; }
void set_backend(SharedPtr<CollectionBackend> backend) { backend_ = backend; }
void set_task_manager(SharedPtr<TaskManager> task_manager) { task_manager_ = task_manager; }
void set_device_name(const QString &device_name) { device_name_ = device_name; }
void IncrementalScanAsync();
@@ -102,6 +104,7 @@ class CollectionWatcher : public QObject {
SongList FindSongsInSubdirectory(const QString &path);
bool HasSongsWithMissingFingerprint(const QString &path);
bool HasSongsWithMissingLoudnessCharacteristics(const QString &path);
bool HasSeenSubdir(const QString &path);
void SetKnownSubdirs(const CollectionSubdirectoryList &subdirs);
CollectionSubdirectoryList GetImmediateSubdirs(const QString &path);
@@ -156,6 +159,9 @@ class CollectionWatcher : public QObject {
QMultiMap<QString, Song> cached_songs_missing_fingerprint_;
bool cached_songs_missing_fingerprint_dirty_;
QMultiMap<QString, Song> cached_songs_missing_loudness_characteristics_;
bool cached_songs_missing_loudness_characteristics_dirty_;
CollectionSubdirectoryList known_subdirs_;
bool known_subdirs_dirty_;
};
@@ -195,6 +201,8 @@ class CollectionWatcher : public QObject {
static void AddChangedSong(const QString &file, const Song &matching_song, const Song &new_song, ScanTransaction *t);
void PerformEBUR128Analysis(Song &song) const;
quint64 FilesCountForPath(ScanTransaction *t, const QString &path);
quint64 FilesCountForSubdirs(ScanTransaction *t, const CollectionSubdirectoryList &subdirs, QMap<QString, quint64> &subdir_files_count);
@@ -202,8 +210,8 @@ class CollectionWatcher : public QObject {
private:
Song::Source source_;
CollectionBackend *backend_;
TaskManager *task_manager_;
SharedPtr<CollectionBackend> backend_;
SharedPtr<TaskManager> task_manager_;
QString device_name_;
FileSystemWatcherInterface *fs_watcher_;
@@ -217,6 +225,7 @@ class CollectionWatcher : public QObject {
bool scan_on_startup_;
bool monitor_;
bool song_tracking_;
bool song_ebur128_loudness_analysis_;
bool mark_songs_unavailable_;
int expire_unavailable_songs_days_;
bool overwrite_playcount_;
@@ -236,6 +245,7 @@ class CollectionWatcher : public QObject {
CueParser *cue_parser_;
static QStringList sValidImages;
static QStringList kIgnoredExtensions;
qint64 last_scan_time_;

View File

@@ -21,7 +21,7 @@
#include "config.h"
#include <functional>
#include <memory>
#include <QDialog>
#include <QWidget>
@@ -41,6 +41,8 @@
#include <boost/multi_index_container_fwd.hpp>
#include <boost/operators.hpp>
using std::make_unique;
using boost::multi_index_container;
using boost::multi_index::indexed_by;
using boost::multi_index::ordered_unique;
@@ -69,7 +71,7 @@ class GroupByDialogPrivate {
MappingContainer mapping_;
};
GroupByDialog::GroupByDialog(QWidget *parent) : QDialog(parent), ui_(new Ui_GroupByDialog), p_(new GroupByDialogPrivate) {
GroupByDialog::GroupByDialog(QWidget *parent) : QDialog(parent), ui_(make_unique<Ui_GroupByDialog>()), p_(make_unique<GroupByDialogPrivate>()) {
ui_->setupUi(this);
Reset();

View File

@@ -24,12 +24,11 @@
#include "config.h"
#include <memory>
#include <QDialog>
#include <QObject>
#include <QString>
#include "core/scoped_ptr.h"
#include "collectionmodel.h"
#include "ui_groupbydialog.h"
@@ -55,8 +54,8 @@ class GroupByDialog : public QDialog {
void Reset();
private:
std::unique_ptr<Ui_GroupByDialog> ui_;
std::unique_ptr<GroupByDialogPrivate> p_;
ScopedPtr<Ui_GroupByDialog> ui_;
ScopedPtr<GroupByDialogPrivate> p_;
};
#endif // GROUPBYDIALOG_H

View File

@@ -41,7 +41,6 @@
#cmakedefine HAVE_TAGLIB_DSDIFFFILE
#cmakedefine USE_BUNDLE
#define USE_BUNDLE_DIR "${USE_BUNDLE_DIR}"
#cmakedefine HAVE_TRANSLATIONS
#cmakedefine INSTALL_TRANSLATIONS
@@ -57,4 +56,6 @@
#cmakedefine HAVE_QX11APPLICATION
#cmakedefine HAVE_EBUR128
#endif // CONFIG_H_IN

View File

@@ -37,12 +37,16 @@
#include <QContextMenuEvent>
#include <QPaintEvent>
#include "core/shared_ptr.h"
#include "utilities/imageutils.h"
#include "covermanager/albumcoverchoicecontroller.h"
#include "contextview.h"
#include "contextalbum.h"
using std::make_unique;
using std::make_shared;
const int ContextAlbum::kFadeTimeLineMs = 1000;
ContextAlbum::ContextAlbum(QWidget *parent)
@@ -155,15 +159,15 @@ void ContextAlbum::SetImage(QImage image) {
ScaleCover();
if (!pixmap_previous.isNull()) {
std::shared_ptr<PreviousCover> previous_cover = std::make_shared<PreviousCover>();
SharedPtr<PreviousCover> previous_cover = make_shared<PreviousCover>();
previous_cover->image = image_previous;
previous_cover->pixmap = pixmap_previous;
previous_cover->opacity = opacity_previous;
previous_cover->timeline.reset(new QTimeLine(kFadeTimeLineMs), [](QTimeLine *timeline) { timeline->deleteLater(); });
previous_cover->timeline->setDirection(QTimeLine::Backward);
previous_cover->timeline->setCurrentTime(timeline_fade_->state() == QTimeLine::Running ? timeline_fade_->currentTime() : kFadeTimeLineMs);
QObject::connect(previous_cover->timeline.get(), &QTimeLine::valueChanged, this, [this, previous_cover]() { FadePreviousCover(previous_cover); });
QObject::connect(previous_cover->timeline.get(), &QTimeLine::finished, this, [this, previous_cover]() { FadePreviousCoverFinished(previous_cover); });
QObject::connect(&*previous_cover->timeline, &QTimeLine::valueChanged, this, [this, previous_cover]() { FadePreviousCover(previous_cover); });
QObject::connect(&*previous_cover->timeline, &QTimeLine::finished, this, [this, previous_cover]() { FadePreviousCoverFinished(previous_cover); });
previous_covers_ << previous_cover;
previous_cover->timeline->start();
}
@@ -194,7 +198,7 @@ void ContextAlbum::DrawSpinner(QPainter *p) {
void ContextAlbum::DrawPreviousCovers(QPainter *p) {
for (std::shared_ptr<PreviousCover> previous_cover : previous_covers_) {
for (SharedPtr<PreviousCover> previous_cover : previous_covers_) {
DrawImage(p, previous_cover->pixmap, previous_cover->opacity);
}
@@ -217,7 +221,7 @@ void ContextAlbum::FadeCurrentCoverFinished() {
}
void ContextAlbum::FadePreviousCover(std::shared_ptr<PreviousCover> previous_cover) {
void ContextAlbum::FadePreviousCover(SharedPtr<PreviousCover> previous_cover) {
if (previous_cover->timeline->currentValue() >= previous_cover->opacity) return;
@@ -225,7 +229,7 @@ void ContextAlbum::FadePreviousCover(std::shared_ptr<PreviousCover> previous_cov
}
void ContextAlbum::FadePreviousCoverFinished(std::shared_ptr<PreviousCover> previous_cover) {
void ContextAlbum::FadePreviousCoverFinished(SharedPtr<PreviousCover> previous_cover) {
previous_covers_.removeAll(previous_cover);
@@ -245,7 +249,7 @@ void ContextAlbum::ScaleCover() {
void ContextAlbum::ScalePreviousCovers() {
for (std::shared_ptr<PreviousCover> previous_cover : previous_covers_) {
for (SharedPtr<PreviousCover> previous_cover : previous_covers_) {
QImage image = ImageUtils::ScaleImage(previous_cover->image, QSize(desired_height_, desired_height_), devicePixelRatioF(), true);
if (image.isNull()) {
previous_cover->pixmap = QPixmap();
@@ -262,8 +266,8 @@ void ContextAlbum::SearchCoverInProgress() {
downloading_covers_ = true;
// Show a spinner animation
spinner_animation_ = std::make_unique<QMovie>(":/pictures/spinner.gif", QByteArray(), this);
QObject::connect(spinner_animation_.get(), &QMovie::updated, this, &ContextAlbum::Update);
spinner_animation_ = make_unique<QMovie>(":/pictures/spinner.gif", QByteArray(), this);
QObject::connect(&*spinner_animation_, &QMovie::updated, this, &ContextAlbum::Update);
spinner_animation_->start();
update();

View File

@@ -33,6 +33,9 @@
#include <QPixmap>
#include <QMovie>
#include "core/scoped_ptr.h"
#include "core/shared_ptr.h"
class QMenu;
class QTimeLine;
class QPainter;
@@ -64,10 +67,10 @@ class ContextAlbum : public QWidget {
QImage image;
QPixmap pixmap;
qreal opacity;
std::shared_ptr<QTimeLine> timeline;
SharedPtr<QTimeLine> timeline;
};
QList<std::shared_ptr<PreviousCover>> previous_covers_;
QList<SharedPtr<PreviousCover>> previous_covers_;
void DrawImage(QPainter *p, const QPixmap &pixmap, const qreal opacity);
void DrawSpinner(QPainter *p);
@@ -84,8 +87,8 @@ class ContextAlbum : public QWidget {
void AutomaticCoverSearchDone();
void FadeCurrentCover(const qreal value);
void FadeCurrentCoverFinished();
void FadePreviousCover(std::shared_ptr<PreviousCover> previouscover);
void FadePreviousCoverFinished(std::shared_ptr<PreviousCover> previouscover);
void FadePreviousCover(SharedPtr<PreviousCover> previous_cover);
void FadePreviousCoverFinished(SharedPtr<PreviousCover> previous_cover);
public slots:
void SearchCoverInProgress();
@@ -103,7 +106,7 @@ class ContextAlbum : public QWidget {
QImage image_original_;
QPixmap pixmap_current_;
qreal pixmap_current_opacity_;
std::unique_ptr<QMovie> spinner_animation_;
ScopedPtr<QMovie> spinner_animation_;
int desired_height_;
};

View File

@@ -98,11 +98,15 @@ ContextView::ContextView(QWidget *parent)
label_samplerate_title_(new QLabel(this)),
label_bitdepth_title_(new QLabel(this)),
label_bitrate_title_(new QLabel(this)),
label_ebur128_integrated_loudness_title_(new QLabel(this)),
label_ebur128_loudness_range_title_(new QLabel(this)),
label_filetype_(new QLabel(this)),
label_length_(new QLabel(this)),
label_samplerate_(new QLabel(this)),
label_bitdepth_(new QLabel(this)),
label_bitrate_(new QLabel(this)),
label_ebur128_integrated_loudness_(new QLabel(this)),
label_ebur128_loudness_range_(new QLabel(this)),
lyrics_tried_(false),
lyrics_id_(-1) {
@@ -160,18 +164,24 @@ ContextView::ContextView(QWidget *parent)
label_samplerate_title_->setText(tr("Samplerate"));
label_bitdepth_title_->setText(tr("Bit depth"));
label_bitrate_title_->setText(tr("Bitrate"));
label_ebur128_integrated_loudness_title_->setText(tr("EBU R 128 Integrated Loudness"));
label_ebur128_loudness_range_title_->setText(tr("EBU R 128 Loudness Range"));
label_filetype_title_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
label_length_title_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
label_samplerate_title_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
label_bitdepth_title_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
label_bitrate_title_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
label_ebur128_integrated_loudness_title_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
label_ebur128_loudness_range_title_->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
label_filetype_->setWordWrap(true);
label_length_->setWordWrap(true);
label_samplerate_->setWordWrap(true);
label_bitdepth_->setWordWrap(true);
label_bitrate_->setWordWrap(true);
label_ebur128_integrated_loudness_->setWordWrap(true);
label_ebur128_loudness_range_->setWordWrap(true);
layout_play_data_->setContentsMargins(0, 0, 0, 0);
layout_play_data_->addWidget(label_filetype_title_, 0, 0);
@@ -185,6 +195,11 @@ ContextView::ContextView(QWidget *parent)
layout_play_data_->addWidget(label_bitrate_title_, 4, 0);
layout_play_data_->addWidget(label_bitrate_, 4, 1);
layout_play_data_->addWidget(label_ebur128_integrated_loudness_title_, 5, 0);
layout_play_data_->addWidget(label_ebur128_integrated_loudness_, 5, 1);
layout_play_data_->addWidget(label_ebur128_loudness_range_title_, 6, 0);
layout_play_data_->addWidget(label_ebur128_loudness_range_, 6, 1);
widget_play_data_->setLayout(layout_play_data_);
textedit_play_lyrics_->setReadOnly(true);
@@ -197,17 +212,21 @@ ContextView::ContextView(QWidget *parent)
layout_play_->addWidget(textedit_play_lyrics_);
layout_play_->addSpacerItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding));
labels_play_ << label_filetype_title_
labels_play_ << label_filetype_title_
<< label_length_title_
<< label_samplerate_title_
<< label_bitdepth_title_
<< label_bitrate_title_;
<< label_bitrate_title_
<< label_ebur128_integrated_loudness_title_
<< label_ebur128_loudness_range_title_;
labels_play_data_ << label_filetype_
<< label_length_
<< label_samplerate_
<< label_bitdepth_
<< label_bitrate_;
<< label_bitrate_
<< label_ebur128_integrated_loudness_
<< label_ebur128_loudness_range_;
labels_play_all_ = labels_play_ << labels_play_data_;
@@ -477,6 +496,26 @@ void ContextView::SetSong() {
label_bitrate_->show();
SetLabelText(label_bitrate_, song_playing_.bitrate(), tr("kbps"));
}
if (!song_playing_.ebur128_integrated_loudness_lufs()) {
label_ebur128_integrated_loudness_title_->hide();
label_ebur128_integrated_loudness_->hide();
label_ebur128_integrated_loudness_->clear();
}
else {
label_ebur128_integrated_loudness_title_->show();
label_ebur128_integrated_loudness_->show();
label_ebur128_integrated_loudness_->setText(song_playing_.Ebur128LoudnessLUFSToText());
}
if (!song_playing_.ebur128_loudness_range_lu()) {
label_ebur128_loudness_range_title_->hide();
label_ebur128_loudness_range_->hide();
label_ebur128_loudness_range_->clear();
}
else {
label_ebur128_loudness_range_title_->show();
label_ebur128_loudness_range_->show();
label_ebur128_loudness_range_->setText(song_playing_.Ebur128LoudnessRangeLUToText());
}
spacer_play_data_->changeSize(20, 20, QSizePolicy::Fixed);
}
else {
@@ -486,6 +525,8 @@ void ContextView::SetSong() {
label_samplerate_->clear();
label_bitdepth_->clear();
label_bitrate_->clear();
label_ebur128_integrated_loudness_->clear();
label_ebur128_loudness_range_->clear();
spacer_play_data_->changeSize(0, 0, QSizePolicy::Fixed);
}
@@ -557,6 +598,12 @@ void ContextView::UpdateSong(const Song &song) {
SetLabelText(label_bitrate_, song.bitrate(), tr("kbps"));
}
}
if (song.ebur128_integrated_loudness_lufs() != song_playing_.ebur128_integrated_loudness_lufs()) {
label_ebur128_integrated_loudness_->setText(song_playing_.Ebur128LoudnessLUFSToText());
}
if (song.ebur128_loudness_range_lu() != song_playing_.ebur128_loudness_range_lu()) {
label_ebur128_loudness_range_->setText(song_playing_.Ebur128LoudnessRangeLUToText());
}
}
song_playing_ = song;

View File

@@ -138,12 +138,18 @@ class ContextView : public QWidget {
QLabel *label_bitdepth_title_;
QLabel *label_bitrate_title_;
QLabel *label_ebur128_integrated_loudness_title_;
QLabel *label_ebur128_loudness_range_title_;
QLabel *label_filetype_;
QLabel *label_length_;
QLabel *label_samplerate_;
QLabel *label_bitdepth_;
QLabel *label_bitrate_;
QLabel *label_ebur128_integrated_loudness_;
QLabel *label_ebur128_loudness_range_;
Song song_playing_;
Song song_prev_;
QImage image_original_;
@@ -160,7 +166,6 @@ class ContextView : public QWidget {
QList<ResizableTextEdit*> textedit_play_;
QList<QLabel*> labels_play_data_;
QList<QLabel*> labels_play_all_;
};
#endif // CONTEXTVIEW_H

View File

@@ -31,10 +31,11 @@
#include <QThread>
#include <QString>
#include "core/lazy.h"
#include "core/tagreaderclient.h"
#include "core/logging.h"
#include "shared_ptr.h"
#include "lazy.h"
#include "tagreaderclient.h"
#include "database.h"
#include "taskmanager.h"
#include "player.h"
@@ -63,7 +64,10 @@
#include "lyrics/lololyricsprovider.h"
#include "lyrics/musixmatchlyricsprovider.h"
#include "lyrics/chartlyricsprovider.h"
#include "lyrics/lyricscomlyricsprovider.h"
#include "lyrics/songlyricscomlyricsprovider.h"
#include "lyrics/azlyricscomlyricsprovider.h"
#include "lyrics/elyricsnetlyricsprovider.h"
#include "lyrics/lyricsmodecomlyricsprovider.h"
#include "scrobbler/audioscrobbler.h"
#include "scrobbler/lastfmscrobbler.h"
@@ -98,99 +102,106 @@
#include "radios/radioservices.h"
#include "radios/radiobackend.h"
using std::make_shared;
using namespace std::chrono_literals;
class ApplicationImpl {
public:
explicit ApplicationImpl(Application *app) :
tag_reader_client_([app]() {
TagReaderClient *client = new TagReaderClient(app);
tag_reader_client_([app](){
TagReaderClient *client = new TagReaderClient();
app->MoveToNewThread(client);
client->Start();
return client;
}),
database_([app]() {
Database *db = new Database(app, app);
Database *db = new Database(app);
app->MoveToNewThread(db);
QTimer::singleShot(30s, db, &Database::DoBackup);
return db;
}),
task_manager_([app]() { return new TaskManager(app); }),
player_([app]() { return new Player(app, app); }),
network_([app]() { return new NetworkAccessManager(app); }),
device_finders_([app]() { return new DeviceFinders(app); }),
task_manager_([]() { return new TaskManager(); }),
player_([app]() { return new Player(app); }),
network_([]() { return new NetworkAccessManager(); }),
device_finders_([]() { return new DeviceFinders(); }),
#ifndef Q_OS_WIN
device_manager_([app]() { return new DeviceManager(app, app); }),
device_manager_([app]() { return new DeviceManager(app); }),
#endif
collection_([app]() { return new SCollection(app, app); }),
collection_([app]() { return new SCollection(app); }),
playlist_backend_([this, app]() {
PlaylistBackend *backend = new PlaylistBackend(app, app);
PlaylistBackend *backend = new PlaylistBackend(app);
app->MoveToThread(backend, database_->thread());
return backend;
}),
playlist_manager_([app]() { return new PlaylistManager(app); }),
cover_providers_([app]() {
CoverProviders *cover_providers = new CoverProviders(app);
CoverProviders *cover_providers = new CoverProviders();
// Initialize the repository of cover providers.
cover_providers->AddProvider(new LastFmCoverProvider(app, app->network(), app));
cover_providers->AddProvider(new MusicbrainzCoverProvider(app, app->network(), app));
cover_providers->AddProvider(new DiscogsCoverProvider(app, app->network(), app));
cover_providers->AddProvider(new DeezerCoverProvider(app, app->network(), app));
cover_providers->AddProvider(new MusixmatchCoverProvider(app, app->network(), app));
cover_providers->AddProvider(new SpotifyCoverProvider(app, app->network(), app));
cover_providers->AddProvider(new LastFmCoverProvider(app, app->network()));
cover_providers->AddProvider(new MusicbrainzCoverProvider(app, app->network()));
cover_providers->AddProvider(new DiscogsCoverProvider(app, app->network()));
cover_providers->AddProvider(new DeezerCoverProvider(app, app->network()));
cover_providers->AddProvider(new MusixmatchCoverProvider(app, app->network()));
cover_providers->AddProvider(new SpotifyCoverProvider(app, app->network()));
#ifdef HAVE_TIDAL
cover_providers->AddProvider(new TidalCoverProvider(app, app->network(), app));
cover_providers->AddProvider(new TidalCoverProvider(app, app->network()));
#endif
#ifdef HAVE_QOBUZ
cover_providers->AddProvider(new QobuzCoverProvider(app, app->network(), app));
cover_providers->AddProvider(new QobuzCoverProvider(app, app->network()));
#endif
cover_providers->ReloadSettings();
return cover_providers;
}),
album_cover_loader_([app]() {
AlbumCoverLoader *loader = new AlbumCoverLoader(app);
AlbumCoverLoader *loader = new AlbumCoverLoader();
app->MoveToNewThread(loader);
return loader;
}),
current_albumcover_loader_([app]() { return new CurrentAlbumCoverLoader(app, app); }),
current_albumcover_loader_([app]() { return new CurrentAlbumCoverLoader(app); }),
lyrics_providers_([app]() {
LyricsProviders *lyrics_providers = new LyricsProviders(app);
// Initialize the repository of lyrics providers.
lyrics_providers->AddProvider(new GeniusLyricsProvider(app->network(), app));
lyrics_providers->AddProvider(new OVHLyricsProvider(app->network(), app));
lyrics_providers->AddProvider(new LoloLyricsProvider(app->network(), app));
lyrics_providers->AddProvider(new MusixmatchLyricsProvider(app->network(), app));
lyrics_providers->AddProvider(new ChartLyricsProvider(app->network(), app));
lyrics_providers->AddProvider(new LyricsComLyricsProvider(app->network(), app));
lyrics_providers->AddProvider(new GeniusLyricsProvider(app->network()));
lyrics_providers->AddProvider(new OVHLyricsProvider(app->network()));
lyrics_providers->AddProvider(new LoloLyricsProvider(app->network()));
lyrics_providers->AddProvider(new MusixmatchLyricsProvider(app->network()));
lyrics_providers->AddProvider(new ChartLyricsProvider(app->network()));
lyrics_providers->AddProvider(new SongLyricsComLyricsProvider(app->network()));
lyrics_providers->AddProvider(new AzLyricsComLyricsProvider(app->network()));
lyrics_providers->AddProvider(new ElyricsNetLyricsProvider(app->network()));
lyrics_providers->AddProvider(new LyricsModeComLyricsProvider(app->network()));
lyrics_providers->ReloadSettings();
return lyrics_providers;
}),
internet_services_([app]() {
InternetServices *internet_services = new InternetServices(app);
InternetServices *internet_services = new InternetServices();
#ifdef HAVE_SUBSONIC
internet_services->AddService(new SubsonicService(app, internet_services));
internet_services->AddService(make_shared<SubsonicService>(app));
#endif
#ifdef HAVE_TIDAL
internet_services->AddService(new TidalService(app, internet_services));
internet_services->AddService(make_shared<TidalService>(app));
#endif
#ifdef HAVE_QOBUZ
internet_services->AddService(new QobuzService(app, internet_services));
internet_services->AddService(make_shared<QobuzService>(app));
#endif
return internet_services;
}),
radio_services_([app]() { return new RadioServices(app, app); }),
radio_services_([app]() { return new RadioServices(app); }),
scrobbler_([app]() {
AudioScrobbler *scrobbler = new AudioScrobbler(app);
scrobbler->AddService(new LastFMScrobbler(scrobbler, app->network(), app));
scrobbler->AddService(new LibreFMScrobbler(scrobbler, app->network(), app));
scrobbler->AddService(new ListenBrainzScrobbler(scrobbler, app->network(), app));
scrobbler->AddService(make_shared<LastFMScrobbler>(scrobbler->settings(), app->network()));
scrobbler->AddService(make_shared<LibreFMScrobbler>(scrobbler->settings(), app->network()));
scrobbler->AddService(make_shared<ListenBrainzScrobbler>(scrobbler->settings(), app->network()));
#ifdef HAVE_SUBSONIC
scrobbler->AddService(make_shared<SubsonicScrobbler>(scrobbler->settings(), app));
#endif
return scrobbler;
}),
#ifdef HAVE_MOODBAR
moodbar_loader_([app]() { return new MoodbarLoader(app, app); }),
moodbar_controller_([app]() { return new MoodbarController(app, app); }),
moodbar_loader_([app]() { return new MoodbarLoader(app); }),
moodbar_controller_([app]() { return new MoodbarController(app); }),
#endif
lastfm_import_([app]() { return new LastFMImport(app->network(), app); })
lastfm_import_([app]() { return new LastFMImport(app->network()); })
{}
Lazy<TagReaderClient> tag_reader_client_;
@@ -227,17 +238,13 @@ Application::Application(QObject *parent)
collection()->Init();
tag_reader_client();
QObject::connect(database(), &Database::Error, this, &Application::ErrorAdded);
QObject::connect(&*database(), &Database::Error, this, &Application::ErrorAdded);
}
Application::~Application() {
// It's important that the device manager is deleted before the database.
// Deleting the database deletes all objects that have been created in its thread, including some device collection backends.
#ifndef Q_OS_WIN
p_->device_manager_.reset();
#endif
qLog(Debug) << "Terminating application";
for (QThread *thread : threads_) {
thread->quit();
@@ -271,37 +278,37 @@ void Application::MoveToThread(QObject *object, QThread *thread) {
void Application::Exit() {
wait_for_exit_ << tag_reader_client()
<< collection()
<< playlist_backend()
<< album_cover_loader()
wait_for_exit_ << &*tag_reader_client()
<< &*collection()
<< &*playlist_backend()
<< &*album_cover_loader()
#ifndef Q_OS_WIN
<< device_manager()
<< &*device_manager()
#endif
<< internet_services()
<< radio_services()->radio_backend();
<< &*internet_services()
<< &*radio_services()->radio_backend();
QObject::connect(tag_reader_client(), &TagReaderClient::ExitFinished, this, &Application::ExitReceived);
QObject::connect(&*tag_reader_client(), &TagReaderClient::ExitFinished, this, &Application::ExitReceived);
tag_reader_client()->ExitAsync();
QObject::connect(collection(), &SCollection::ExitFinished, this, &Application::ExitReceived);
QObject::connect(&*collection(), &SCollection::ExitFinished, this, &Application::ExitReceived);
collection()->Exit();
QObject::connect(playlist_backend(), &PlaylistBackend::ExitFinished, this, &Application::ExitReceived);
QObject::connect(&*playlist_backend(), &PlaylistBackend::ExitFinished, this, &Application::ExitReceived);
playlist_backend()->ExitAsync();
QObject::connect(album_cover_loader(), &AlbumCoverLoader::ExitFinished, this, &Application::ExitReceived);
QObject::connect(&*album_cover_loader(), &AlbumCoverLoader::ExitFinished, this, &Application::ExitReceived);
album_cover_loader()->ExitAsync();
#ifndef Q_OS_WIN
QObject::connect(device_manager(), &DeviceManager::ExitFinished, this, &Application::ExitReceived);
QObject::connect(&*device_manager(), &DeviceManager::ExitFinished, this, &Application::ExitReceived);
device_manager()->Exit();
#endif
QObject::connect(internet_services(), &InternetServices::ExitFinished, this, &Application::ExitReceived);
QObject::connect(&*internet_services(), &InternetServices::ExitFinished, this, &Application::ExitReceived);
internet_services()->Exit();
QObject::connect(radio_services()->radio_backend(), &RadioBackend::ExitFinished, this, &Application::ExitReceived);
QObject::connect(&*radio_services()->radio_backend(), &RadioBackend::ExitFinished, this, &Application::ExitReceived);
radio_services()->radio_backend()->ExitAsync();
}
@@ -316,7 +323,7 @@ void Application::ExitReceived() {
wait_for_exit_.removeAll(obj);
if (wait_for_exit_.isEmpty()) {
database()->Close();
QObject::connect(database(), &Database::ExitFinished, this, &Application::ExitFinished);
QObject::connect(&*database(), &Database::ExitFinished, this, &Application::ExitFinished);
database()->ExitAsync();
}
@@ -326,29 +333,29 @@ void Application::AddError(const QString &message) { emit ErrorAdded(message); }
void Application::ReloadSettings() { emit SettingsChanged(); }
void Application::OpenSettingsDialogAtPage(SettingsDialog::Page page) { emit SettingsDialogRequested(page); }
TagReaderClient *Application::tag_reader_client() const { return p_->tag_reader_client_.get(); }
Database *Application::database() const { return p_->database_.get(); }
TaskManager *Application::task_manager() const { return p_->task_manager_.get(); }
Player *Application::player() const { return p_->player_.get(); }
NetworkAccessManager *Application::network() const { return p_->network_.get(); }
DeviceFinders *Application::device_finders() const { return p_->device_finders_.get(); }
SharedPtr<TagReaderClient> Application::tag_reader_client() const { return p_->tag_reader_client_.ptr(); }
SharedPtr<Database> Application::database() const { return p_->database_.ptr(); }
SharedPtr<TaskManager> Application::task_manager() const { return p_->task_manager_.ptr(); }
SharedPtr<Player> Application::player() const { return p_->player_.ptr(); }
SharedPtr<NetworkAccessManager> Application::network() const { return p_->network_.ptr(); }
SharedPtr<DeviceFinders> Application::device_finders() const { return p_->device_finders_.ptr(); }
#ifndef Q_OS_WIN
DeviceManager *Application::device_manager() const { return p_->device_manager_.get(); }
SharedPtr<DeviceManager> Application::device_manager() const { return p_->device_manager_.ptr(); }
#endif
SCollection *Application::collection() const { return p_->collection_.get(); }
CollectionBackend *Application::collection_backend() const { return collection()->backend(); }
SharedPtr<SCollection> Application::collection() const { return p_->collection_.ptr(); }
SharedPtr<CollectionBackend> Application::collection_backend() const { return collection()->backend(); }
CollectionModel *Application::collection_model() const { return collection()->model(); }
AlbumCoverLoader *Application::album_cover_loader() const { return p_->album_cover_loader_.get(); }
CoverProviders *Application::cover_providers() const { return p_->cover_providers_.get(); }
CurrentAlbumCoverLoader *Application::current_albumcover_loader() const { return p_->current_albumcover_loader_.get(); }
LyricsProviders *Application::lyrics_providers() const { return p_->lyrics_providers_.get(); }
PlaylistBackend *Application::playlist_backend() const { return p_->playlist_backend_.get(); }
PlaylistManager *Application::playlist_manager() const { return p_->playlist_manager_.get(); }
InternetServices *Application::internet_services() const { return p_->internet_services_.get(); }
RadioServices *Application::radio_services() const { return p_->radio_services_.get(); }
AudioScrobbler *Application::scrobbler() const { return p_->scrobbler_.get(); }
LastFMImport *Application::lastfm_import() const { return p_->lastfm_import_.get(); }
SharedPtr<AlbumCoverLoader> Application::album_cover_loader() const { return p_->album_cover_loader_.ptr(); }
SharedPtr<CoverProviders> Application::cover_providers() const { return p_->cover_providers_.ptr(); }
SharedPtr<CurrentAlbumCoverLoader> Application::current_albumcover_loader() const { return p_->current_albumcover_loader_.ptr(); }
SharedPtr<LyricsProviders> Application::lyrics_providers() const { return p_->lyrics_providers_.ptr(); }
SharedPtr<PlaylistBackend> Application::playlist_backend() const { return p_->playlist_backend_.ptr(); }
SharedPtr<PlaylistManager> Application::playlist_manager() const { return p_->playlist_manager_.ptr(); }
SharedPtr<InternetServices> Application::internet_services() const { return p_->internet_services_.ptr(); }
SharedPtr<RadioServices> Application::radio_services() const { return p_->radio_services_.ptr(); }
SharedPtr<AudioScrobbler> Application::scrobbler() const { return p_->scrobbler_.ptr(); }
SharedPtr<LastFMImport> Application::lastfm_import() const { return p_->lastfm_import_.ptr(); }
#ifdef HAVE_MOODBAR
MoodbarController *Application::moodbar_controller() const { return p_->moodbar_controller_.get(); }
MoodbarLoader *Application::moodbar_loader() const { return p_->moodbar_loader_.get(); }
SharedPtr<MoodbarController> Application::moodbar_controller() const { return p_->moodbar_controller_.ptr(); }
SharedPtr<MoodbarLoader> Application::moodbar_loader() const { return p_->moodbar_loader_.ptr(); }
#endif

View File

@@ -25,12 +25,13 @@
#include "config.h"
#include <memory>
#include <QObject>
#include <QList>
#include <QString>
#include "scoped_ptr.h"
#include "shared_ptr.h"
#include "settings/settingsdialog.h"
class QThread;
@@ -71,40 +72,40 @@ class Application : public QObject {
explicit Application(QObject *parent = nullptr);
~Application() override;
TagReaderClient *tag_reader_client() const;
Database *database() const;
TaskManager *task_manager() const;
Player *player() const;
NetworkAccessManager *network() const;
DeviceFinders *device_finders() const;
SharedPtr<TagReaderClient> tag_reader_client() const;
SharedPtr<Database> database() const;
SharedPtr<TaskManager> task_manager() const;
SharedPtr<Player> player() const;
SharedPtr<NetworkAccessManager> network() const;
SharedPtr<DeviceFinders> device_finders() const;
#ifndef Q_OS_WIN
DeviceManager *device_manager() const;
SharedPtr<DeviceManager> device_manager() const;
#endif
SCollection *collection() const;
CollectionBackend *collection_backend() const;
SharedPtr<SCollection> collection() const;
SharedPtr<CollectionBackend> collection_backend() const;
CollectionModel *collection_model() const;
PlaylistBackend *playlist_backend() const;
PlaylistManager *playlist_manager() const;
SharedPtr<PlaylistBackend> playlist_backend() const;
SharedPtr<PlaylistManager> playlist_manager() const;
CoverProviders *cover_providers() const;
AlbumCoverLoader *album_cover_loader() const;
CurrentAlbumCoverLoader *current_albumcover_loader() const;
SharedPtr<CoverProviders> cover_providers() const;
SharedPtr<AlbumCoverLoader> album_cover_loader() const;
SharedPtr<CurrentAlbumCoverLoader> current_albumcover_loader() const;
LyricsProviders *lyrics_providers() const;
SharedPtr<LyricsProviders> lyrics_providers() const;
AudioScrobbler *scrobbler() const;
SharedPtr<AudioScrobbler> scrobbler() const;
InternetServices *internet_services() const;
RadioServices *radio_services() const;
SharedPtr<InternetServices> internet_services() const;
SharedPtr<RadioServices> radio_services() const;
#ifdef HAVE_MOODBAR
MoodbarController *moodbar_controller() const;
MoodbarLoader *moodbar_loader() const;
SharedPtr<MoodbarController> moodbar_controller() const;
SharedPtr<MoodbarLoader> moodbar_loader() const;
#endif
LastFMImport *lastfm_import() const;
SharedPtr<LastFMImport> lastfm_import() const;
void Exit();
@@ -127,7 +128,7 @@ class Application : public QObject {
void ClearPixmapDiskCache();
private:
std::unique_ptr<ApplicationImpl> p_;
ScopedPtr<ApplicationImpl> p_;
QList<QThread*> threads_;
QList<QObject*> wait_for_exit_;

View File

@@ -22,7 +22,6 @@
#include "config.h"
#include <sqlite3.h>
#include <boost/scope_exit.hpp>
#include <QObject>
#include <QThread>
@@ -39,6 +38,7 @@
#include <QSqlDatabase>
#include <QSqlError>
#include <QStandardPaths>
#include <QScopeGuard>
#include "core/logging.h"
#include "taskmanager.h"
@@ -48,7 +48,7 @@
#include "scopedtransaction.h"
const char *Database::kDatabaseFilename = "strawberry.db";
const int Database::kSchemaVersion = 17;
const int Database::kSchemaVersion = 18;
const int Database::kMinSupportedSchemaVersion = 10;
const char *Database::kMagicAllSongsTables = "%allsongstables";
@@ -84,7 +84,7 @@ Database::~Database() {
QMutexLocker l(&connect_mutex_);
for (QString &connection_id : QSqlDatabase::connectionNames()) {
for (const QString &connection_id : QSqlDatabase::connectionNames()) {
qLog(Error) << "Connection" << connection_id << "is still open!";
}
@@ -559,13 +559,15 @@ void Database::BackupFile(const QString &filename) {
sqlite3 *source_connection = nullptr;
sqlite3 *dest_connection = nullptr;
BOOST_SCOPE_EXIT((&source_connection)(&dest_connection)(task_id)(app_)) { // clazy:exclude=rule-of-three NOLINT(google-explicit-constructor)
// Harmless to call sqlite3_close() with a nullptr pointer.
sqlite3_close(source_connection);
sqlite3_close(dest_connection);
const QScopeGuard db_backup_finish = qScopeGuard([this, task_id, &source_connection, &dest_connection]() {
if (source_connection) {
sqlite3_close(source_connection);
}
if (dest_connection) {
sqlite3_close(dest_connection);
}
app_->task_manager()->SetTaskFinished(task_id);
}
BOOST_SCOPE_EXIT_END
});
bool success = OpenDatabase(filename, &source_connection);
if (!success) {

View File

@@ -28,6 +28,7 @@
#include <QUrl>
#include <QMetaObject>
#include "shared_ptr.h"
#include "taskmanager.h"
#include "song.h"
#include "deletefiles.h"
@@ -35,7 +36,7 @@
const int DeleteFiles::kBatchSize = 50;
DeleteFiles::DeleteFiles(TaskManager *task_manager, std::shared_ptr<MusicStorage> storage, const bool use_trash, QObject *parent)
DeleteFiles::DeleteFiles(SharedPtr<TaskManager> task_manager, SharedPtr<MusicStorage> storage, const bool use_trash, QObject *parent)
: QObject(parent),
thread_(nullptr),
task_manager_(task_manager),

View File

@@ -24,11 +24,10 @@
#include "config.h"
#include <memory>
#include <QObject>
#include <QStringList>
#include "shared_ptr.h"
#include "song.h"
class QThread;
@@ -39,7 +38,7 @@ class DeleteFiles : public QObject {
Q_OBJECT
public:
explicit DeleteFiles(TaskManager *task_manager, std::shared_ptr<MusicStorage> storage, const bool use_trash, QObject *parent = nullptr);
explicit DeleteFiles(SharedPtr<TaskManager> task_manager, SharedPtr<MusicStorage> storage, const bool use_trash, QObject *parent = nullptr);
~DeleteFiles() override;
static const int kBatchSize;
@@ -56,8 +55,8 @@ class DeleteFiles : public QObject {
private:
QThread *thread_;
QThread *original_thread_;
TaskManager *task_manager_;
std::shared_ptr<MusicStorage> storage_;
SharedPtr<TaskManager> task_manager_;
SharedPtr<MusicStorage> storage_;
SongList songs_;
bool use_trash_;

View File

@@ -19,7 +19,11 @@
#define LAZY_H
#include <functional>
#include <memory>
#include <type_traits>
#include "core/logging.h"
#include "shared_ptr.h"
// Helper for lazy initialization of objects.
// Usage:
@@ -38,6 +42,11 @@ class Lazy {
return ptr_.get();
}
SharedPtr<T> ptr() const {
CheckInitialized();
return ptr_;
}
typename std::add_lvalue_reference<T>::type operator*() const {
CheckInitialized();
return *ptr_;
@@ -54,12 +63,13 @@ class Lazy {
private:
void CheckInitialized() const {
if (!ptr_) {
ptr_.reset(init_(), [](T*obj) { obj->deleteLater(); });
ptr_ = SharedPtr<T>(init_(), [](T*obj) { qLog(Debug) << obj << "deleted"; delete obj; });
qLog(Debug) << &*ptr_ << "created";
}
}
const std::function<T*()> init_;
mutable std::shared_ptr<T> ptr_;
mutable SharedPtr<T> ptr_;
};
#endif // LAZY_H

View File

@@ -24,13 +24,12 @@
#include "config.h"
#include <memory>
#include <QObject>
#include <QUrl>
#include <QPixmap>
#include <QAction>
#include "scoped_ptr.h"
#include "song.h"
class MacSystemTrayIconPrivate;
@@ -85,7 +84,7 @@ class SystemTrayIcon : public QObject {
void PlayPause();
private:
std::unique_ptr<MacSystemTrayIconPrivate> p_;
ScopedPtr<MacSystemTrayIconPrivate> p_;
QPixmap normal_icon_;
QPixmap grey_icon_;

View File

@@ -22,11 +22,11 @@
#include "config.h"
#include "version.h"
#include <memory>
#include <cmath>
#include <functional>
#include <algorithm>
#include <chrono>
#include <cmath>
#include <memory>
#include <QMainWindow>
#include <QApplication>
@@ -79,6 +79,7 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "shared_ptr.h"
#include "commandlineoptions.h"
#include "mimedata.h"
#include "iconloader.h"
@@ -127,7 +128,6 @@
#include "collection/collectiondirectorymodel.h"
#include "collection/collectionfilterwidget.h"
#include "collection/collectionmodel.h"
#include "collection/collectionquery.h"
#include "collection/collectionview.h"
#include "collection/collectionviewcontainer.h"
#include "playlist/playlist.h"
@@ -163,10 +163,10 @@
#include "settings/settingsdialog.h"
#include "settings/behavioursettingspage.h"
#include "settings/backendsettingspage.h"
#include "settings/collectionsettingspage.h"
#include "settings/playlistsettingspage.h"
#ifdef HAVE_SUBSONIC
# include "settings/subsonicsettingspage.h"
# include "scrobbler/subsonicscrobbler.h"
#endif
#ifdef HAVE_TIDAL
# include "tidal/tidalservice.h"
@@ -199,7 +199,6 @@
#endif
#include "smartplaylists/smartplaylistsviewcontainer.h"
#include "smartplaylists/smartplaylistsview.h"
#ifdef Q_OS_WIN
# include "windows7thumbbar.h"
@@ -213,6 +212,8 @@
# endif
#endif // HAVE_QTSPARKLE
using std::make_unique;
using std::make_shared;
using namespace std::chrono_literals;
const char *MainWindow::kSettingsGroup = "MainWindow";
@@ -239,7 +240,7 @@ constexpr char QTSPARKLE_URL[] = "https://www.strawberrymusicplayer.org/sparkle-
# endif
#endif
MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_icon, OSDBase *osd, const CommandlineOptions &options, QWidget *parent)
MainWindow::MainWindow(Application *app, SharedPtr<SystemTrayIcon> tray_icon, OSDBase *osd, const CommandlineOptions &options, QWidget *parent)
: QMainWindow(parent),
ui_(new Ui_MainWindow),
#ifdef Q_OS_WIN
@@ -398,7 +399,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
// Start initializing the player
qLog(Debug) << "Initializing player";
app_->player()->SetAnalyzer(ui_->analyzer);
app_->player()->SetEqualizer(equalizer_.get());
app_->player()->SetEqualizer(equalizer_);
app_->player()->Init();
EngineChanged(app_->player()->engine()->type());
const uint volume = app_->player()->GetVolume();
@@ -505,17 +506,17 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
file_view_->SetTaskManager(app_->task_manager());
// Action connections
QObject::connect(ui_->action_next_track, &QAction::triggered, app_->player(), &Player::Next);
QObject::connect(ui_->action_previous_track, &QAction::triggered, app_->player(), &Player::Previous);
QObject::connect(ui_->action_play_pause, &QAction::triggered, app_->player(), &Player::PlayPauseHelper);
QObject::connect(ui_->action_stop, &QAction::triggered, app_->player(), &Player::Stop);
QObject::connect(ui_->action_next_track, &QAction::triggered, &*app_->player(), &Player::Next);
QObject::connect(ui_->action_previous_track, &QAction::triggered, &*app_->player(), &Player::Previous);
QObject::connect(ui_->action_play_pause, &QAction::triggered, &*app_->player(), &Player::PlayPauseHelper);
QObject::connect(ui_->action_stop, &QAction::triggered, &*app_->player(), &Player::Stop);
QObject::connect(ui_->action_quit, &QAction::triggered, this, &MainWindow::Exit);
QObject::connect(ui_->action_stop_after_this_track, &QAction::triggered, this, &MainWindow::StopAfterCurrent);
QObject::connect(ui_->action_mute, &QAction::triggered, app_->player(), &Player::Mute);
QObject::connect(ui_->action_mute, &QAction::triggered, &*app_->player(), &Player::Mute);
QObject::connect(ui_->action_clear_playlist, &QAction::triggered, this, &MainWindow::PlaylistClearCurrent);
QObject::connect(ui_->action_remove_duplicates, &QAction::triggered, app_->playlist_manager(), &PlaylistManager::RemoveDuplicatesCurrent);
QObject::connect(ui_->action_remove_unavailable, &QAction::triggered, app_->playlist_manager(), &PlaylistManager::RemoveUnavailableCurrent);
QObject::connect(ui_->action_remove_duplicates, &QAction::triggered, &*app_->playlist_manager(), &PlaylistManager::RemoveDuplicatesCurrent);
QObject::connect(ui_->action_remove_unavailable, &QAction::triggered, &*app_->playlist_manager(), &PlaylistManager::RemoveUnavailableCurrent);
QObject::connect(ui_->action_remove_from_playlist, &QAction::triggered, this, &MainWindow::PlaylistRemoveCurrent);
QObject::connect(ui_->action_edit_track, &QAction::triggered, this, &MainWindow::EditTracks);
QObject::connect(ui_->action_renumber_tracks, &QAction::triggered, this, &MainWindow::RenumberTracks);
@@ -529,7 +530,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
QObject::connect(ui_->action_toggle_show_sidebar, &QAction::toggled, this, &MainWindow::ToggleSidebar);
QObject::connect(ui_->action_about_strawberry, &QAction::triggered, this, &MainWindow::ShowAboutDialog);
QObject::connect(ui_->action_about_qt, &QAction::triggered, qApp, &QApplication::aboutQt);
QObject::connect(ui_->action_shuffle, &QAction::triggered, app_->playlist_manager(), &PlaylistManager::ShuffleCurrent);
QObject::connect(ui_->action_shuffle, &QAction::triggered, &*app_->playlist_manager(), &PlaylistManager::ShuffleCurrent);
QObject::connect(ui_->action_open_file, &QAction::triggered, this, &MainWindow::AddFile);
QObject::connect(ui_->action_open_cd, &QAction::triggered, this, &MainWindow::AddCDTracks);
QObject::connect(ui_->action_add_file, &QAction::triggered, this, &MainWindow::AddFile);
@@ -543,9 +544,9 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
ui_->action_transcoder->setDisabled(true);
#endif
QObject::connect(ui_->action_jump, &QAction::triggered, ui_->playlist->view(), &PlaylistView::JumpToCurrentlyPlayingTrack);
QObject::connect(ui_->action_update_collection, &QAction::triggered, app_->collection(), &SCollection::IncrementalScan);
QObject::connect(ui_->action_full_collection_scan, &QAction::triggered, app_->collection(), &SCollection::FullScan);
QObject::connect(ui_->action_abort_collection_scan, &QAction::triggered, app_->collection(), &SCollection::AbortScan);
QObject::connect(ui_->action_update_collection, &QAction::triggered, &*app_->collection(), &SCollection::IncrementalScan);
QObject::connect(ui_->action_full_collection_scan, &QAction::triggered, &*app_->collection(), &SCollection::FullScan);
QObject::connect(ui_->action_abort_collection_scan, &QAction::triggered, &*app_->collection(), &SCollection::AbortScan);
#if defined(HAVE_GSTREAMER)
QObject::connect(ui_->action_add_files_to_transcoder, &QAction::triggered, this, &MainWindow::AddFilesToTranscoder);
ui_->action_add_files_to_transcoder->setIcon(IconLoader::Load("tools-wizard"));
@@ -553,9 +554,9 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
ui_->action_add_files_to_transcoder->setDisabled(true);
#endif
QObject::connect(ui_->action_toggle_scrobbling, &QAction::triggered, app_->scrobbler(), &AudioScrobbler::ToggleScrobbling);
QObject::connect(ui_->action_toggle_scrobbling, &QAction::triggered, &*app_->scrobbler(), &AudioScrobbler::ToggleScrobbling);
QObject::connect(ui_->action_love, &QAction::triggered, this, &MainWindow::Love);
QObject::connect(app_->scrobbler(), &AudioScrobbler::ErrorMessage, this, &MainWindow::ShowErrorDialog);
QObject::connect(&*app_->scrobbler(), &AudioScrobbler::ErrorMessage, this, &MainWindow::ShowErrorDialog);
// Playlist view actions
ui_->action_next_playlist->setShortcuts(QList<QKeySequence>() << QKeySequence::fromString("Ctrl+Tab") << QKeySequence::fromString("Ctrl+PgDown"));
@@ -585,55 +586,55 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
ui_->stop_button->setMenu(stop_menu);
// Player connections
QObject::connect(ui_->volume, &VolumeSlider::valueChanged, app_->player(), &Player::SetVolumeFromSlider);
QObject::connect(ui_->volume, &VolumeSlider::valueChanged, &*app_->player(), &Player::SetVolumeFromSlider);
QObject::connect(app_->player(), &Player::EngineChanged, this, &MainWindow::EngineChanged);
QObject::connect(app_->player(), &Player::Error, this, &MainWindow::ShowErrorDialog);
QObject::connect(app_->player(), &Player::SongChangeRequestProcessed, app_->playlist_manager(), &PlaylistManager::SongChangeRequestProcessed);
QObject::connect(&*app_->player(), &Player::EngineChanged, this, &MainWindow::EngineChanged);
QObject::connect(&*app_->player(), &Player::Error, this, &MainWindow::ShowErrorDialog);
QObject::connect(&*app_->player(), &Player::SongChangeRequestProcessed, &*app_->playlist_manager(), &PlaylistManager::SongChangeRequestProcessed);
QObject::connect(app_->player(), &Player::Paused, this, &MainWindow::MediaPaused);
QObject::connect(app_->player(), &Player::Playing, this, &MainWindow::MediaPlaying);
QObject::connect(app_->player(), &Player::Stopped, this, &MainWindow::MediaStopped);
QObject::connect(app_->player(), &Player::Seeked, this, &MainWindow::Seeked);
QObject::connect(app_->player(), &Player::TrackSkipped, this, &MainWindow::TrackSkipped);
QObject::connect(app_->player(), &Player::VolumeChanged, this, &MainWindow::VolumeChanged);
QObject::connect(&*app_->player(), &Player::Paused, this, &MainWindow::MediaPaused);
QObject::connect(&*app_->player(), &Player::Playing, this, &MainWindow::MediaPlaying);
QObject::connect(&*app_->player(), &Player::Stopped, this, &MainWindow::MediaStopped);
QObject::connect(&*app_->player(), &Player::Seeked, this, &MainWindow::Seeked);
QObject::connect(&*app_->player(), &Player::TrackSkipped, this, &MainWindow::TrackSkipped);
QObject::connect(&*app_->player(), &Player::VolumeChanged, this, &MainWindow::VolumeChanged);
QObject::connect(app_->player(), &Player::Paused, ui_->playlist, &PlaylistContainer::ActivePaused);
QObject::connect(app_->player(), &Player::Playing, ui_->playlist, &PlaylistContainer::ActivePlaying);
QObject::connect(app_->player(), &Player::Stopped, ui_->playlist, &PlaylistContainer::ActiveStopped);
QObject::connect(&*app_->player(), &Player::Paused, ui_->playlist, &PlaylistContainer::ActivePaused);
QObject::connect(&*app_->player(), &Player::Playing, ui_->playlist, &PlaylistContainer::ActivePlaying);
QObject::connect(&*app_->player(), &Player::Stopped, ui_->playlist, &PlaylistContainer::ActiveStopped);
QObject::connect(app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, osd_, &OSDBase::SongChanged);
QObject::connect(app_->player(), &Player::Paused, osd_, &OSDBase::Paused);
QObject::connect(app_->player(), &Player::Resumed, osd_, &OSDBase::Resumed);
QObject::connect(app_->player(), &Player::Stopped, osd_, &OSDBase::Stopped);
QObject::connect(app_->player(), &Player::PlaylistFinished, osd_, &OSDBase::PlaylistFinished);
QObject::connect(app_->player(), &Player::VolumeChanged, osd_, &OSDBase::VolumeChanged);
QObject::connect(app_->player(), &Player::VolumeChanged, ui_->volume, &VolumeSlider::SetValue);
QObject::connect(app_->player(), &Player::ForceShowOSD, this, &MainWindow::ForceShowOSD);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, osd_, &OSDBase::SongChanged);
QObject::connect(&*app_->player(), &Player::Paused, osd_, &OSDBase::Paused);
QObject::connect(&*app_->player(), &Player::Resumed, osd_, &OSDBase::Resumed);
QObject::connect(&*app_->player(), &Player::Stopped, osd_, &OSDBase::Stopped);
QObject::connect(&*app_->player(), &Player::PlaylistFinished, osd_, &OSDBase::PlaylistFinished);
QObject::connect(&*app_->player(), &Player::VolumeChanged, osd_, &OSDBase::VolumeChanged);
QObject::connect(&*app_->player(), &Player::VolumeChanged, ui_->volume, &VolumeSlider::SetValue);
QObject::connect(&*app_->player(), &Player::ForceShowOSD, this, &MainWindow::ForceShowOSD);
QObject::connect(app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, this, &MainWindow::SongChanged);
QObject::connect(app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, app_->player(), &Player::CurrentMetadataChanged);
QObject::connect(app_->playlist_manager(), &PlaylistManager::EditingFinished, this, &MainWindow::PlaylistEditFinished);
QObject::connect(app_->playlist_manager(), &PlaylistManager::Error, this, &MainWindow::ShowErrorDialog);
QObject::connect(app_->playlist_manager(), &PlaylistManager::SummaryTextChanged, ui_->playlist_summary, &QLabel::setText);
QObject::connect(app_->playlist_manager(), &PlaylistManager::PlayRequested, this, &MainWindow::PlayIndex);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, this, &MainWindow::SongChanged);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, &*app_->player(), &Player::CurrentMetadataChanged);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::EditingFinished, this, &MainWindow::PlaylistEditFinished);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::Error, this, &MainWindow::ShowErrorDialog);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::SummaryTextChanged, ui_->playlist_summary, &QLabel::setText);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::PlayRequested, this, &MainWindow::PlayIndex);
QObject::connect(ui_->playlist->view(), &PlaylistView::doubleClicked, this, &MainWindow::PlaylistDoubleClick);
QObject::connect(ui_->playlist->view(), &PlaylistView::PlayItem, this, &MainWindow::PlayIndex);
QObject::connect(ui_->playlist->view(), &PlaylistView::PlayPause, app_->player(), &Player::PlayPause);
QObject::connect(ui_->playlist->view(), &PlaylistView::PlayPause, &*app_->player(), &Player::PlayPause);
QObject::connect(ui_->playlist->view(), &PlaylistView::RightClicked, this, &MainWindow::PlaylistRightClick);
QObject::connect(ui_->playlist->view(), &PlaylistView::SeekForward, app_->player(), &Player::SeekForward);
QObject::connect(ui_->playlist->view(), &PlaylistView::SeekBackward, app_->player(), &Player::SeekBackward);
QObject::connect(ui_->playlist->view(), &PlaylistView::SeekForward, &*app_->player(), &Player::SeekForward);
QObject::connect(ui_->playlist->view(), &PlaylistView::SeekBackward, &*app_->player(), &Player::SeekBackward);
QObject::connect(ui_->playlist->view(), &PlaylistView::BackgroundPropertyChanged, this, &MainWindow::RefreshStyleSheet);
QObject::connect(ui_->track_slider, &TrackSlider::ValueChangedSeconds, app_->player(), &Player::SeekTo);
QObject::connect(ui_->track_slider, &TrackSlider::SeekForward, app_->player(), &Player::SeekForward);
QObject::connect(ui_->track_slider, &TrackSlider::SeekBackward, app_->player(), &Player::SeekBackward);
QObject::connect(ui_->track_slider, &TrackSlider::Previous, app_->player(), &Player::Previous);
QObject::connect(ui_->track_slider, &TrackSlider::Next, app_->player(), &Player::Next);
QObject::connect(ui_->track_slider, &TrackSlider::ValueChangedSeconds, &*app_->player(), &Player::SeekTo);
QObject::connect(ui_->track_slider, &TrackSlider::SeekForward, &*app_->player(), &Player::SeekForward);
QObject::connect(ui_->track_slider, &TrackSlider::SeekBackward, &*app_->player(), &Player::SeekBackward);
QObject::connect(ui_->track_slider, &TrackSlider::Previous, &*app_->player(), &Player::Previous);
QObject::connect(ui_->track_slider, &TrackSlider::Next, &*app_->player(), &Player::Next);
// Collection connections
QObject::connect(app_->collection(), &SCollection::Error, this, &MainWindow::ShowErrorDialog);
QObject::connect(&*app_->collection(), &SCollection::Error, this, &MainWindow::ShowErrorDialog);
QObject::connect(collection_view_->view(), &CollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist);
QObject::connect(collection_view_->view(), &CollectionView::ShowConfigDialog, this, &MainWindow::ShowCollectionConfig);
QObject::connect(collection_view_->view(), &CollectionView::Error, this, &MainWindow::ShowErrorDialog);
@@ -643,10 +644,10 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
QObject::connect(app_->collection_model(), &CollectionModel::modelAboutToBeReset, collection_view_->view(), &CollectionView::SaveFocus);
QObject::connect(app_->collection_model(), &CollectionModel::modelReset, collection_view_->view(), &CollectionView::RestoreFocus);
QObject::connect(app_->task_manager(), &TaskManager::PauseCollectionWatchers, app_->collection(), &SCollection::PauseWatcher);
QObject::connect(app_->task_manager(), &TaskManager::ResumeCollectionWatchers, app_->collection(), &SCollection::ResumeWatcher);
QObject::connect(&*app_->task_manager(), &TaskManager::PauseCollectionWatchers, &*app_->collection(), &SCollection::PauseWatcher);
QObject::connect(&*app_->task_manager(), &TaskManager::ResumeCollectionWatchers, &*app_->collection(), &SCollection::ResumeWatcher);
QObject::connect(app_->current_albumcover_loader(), &CurrentAlbumCoverLoader::AlbumCoverLoaded, this, &MainWindow::AlbumCoverLoaded);
QObject::connect(&*app_->current_albumcover_loader(), &CurrentAlbumCoverLoader::AlbumCoverLoaded, this, &MainWindow::AlbumCoverLoaded);
QObject::connect(album_cover_choice_controller_, &AlbumCoverChoiceController::Error, this, &MainWindow::ShowErrorDialog);
QObject::connect(album_cover_choice_controller_->cover_from_file_action(), &QAction::triggered, this, &MainWindow::LoadCoverFromFile);
QObject::connect(album_cover_choice_controller_->cover_to_file_action(), &QAction::triggered, this, &MainWindow::SaveCoverToFile);
@@ -701,8 +702,8 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
QObject::connect(tidal_view_->albums_collection_view(), &InternetCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist);
QObject::connect(tidal_view_->songs_collection_view(), &InternetCollectionView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist);
QObject::connect(tidal_view_->search_view(), &InternetSearchView::AddToPlaylist, this, &MainWindow::AddToPlaylist);
if (TidalService *tidalservice = qobject_cast<TidalService*>(app_->internet_services()->ServiceBySource(Song::Source::Tidal))) {
QObject::connect(this, &MainWindow::AuthorizationUrlReceived, tidalservice, &TidalService::AuthorizationUrlReceived);
if (TidalServicePtr tidalservice = app_->internet_services()->Service<TidalService>()) {
QObject::connect(this, &MainWindow::AuthorizationUrlReceived, &*tidalservice, &TidalService::AuthorizationUrlReceived);
}
#endif
@@ -713,8 +714,8 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
QObject::connect(qobuz_view_->search_view(), &InternetSearchView::AddToPlaylist, this, &MainWindow::AddToPlaylist);
#endif
QObject::connect(radio_view_, &RadioViewContainer::Refresh, app_->radio_services(), &RadioServices::RefreshChannels);
QObject::connect(radio_view_->view(), &RadioView::GetChannels, app_->radio_services(), &RadioServices::GetChannels);
QObject::connect(radio_view_, &RadioViewContainer::Refresh, &*app_->radio_services(), &RadioServices::RefreshChannels);
QObject::connect(radio_view_->view(), &RadioView::GetChannels, &*app_->radio_services(), &RadioServices::GetChannels);
QObject::connect(radio_view_->view(), &RadioView::AddToPlaylistSignal, this, &MainWindow::AddToPlaylist);
// Playlist menu
@@ -778,22 +779,22 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
QObject::connect(app_->device_manager()->connected_devices_model(), &DeviceStateFilterModel::IsEmptyChanged, playlist_copy_to_device_, &QAction::setDisabled);
#endif
QObject::connect(app_->scrobbler(), &AudioScrobbler::ScrobblingEnabledChanged, this, &MainWindow::ScrobblingEnabledChanged);
QObject::connect(app_->scrobbler(), &AudioScrobbler::ScrobbleButtonVisibilityChanged, this, &MainWindow::ScrobbleButtonVisibilityChanged);
QObject::connect(app_->scrobbler(), &AudioScrobbler::LoveButtonVisibilityChanged, this, &MainWindow::LoveButtonVisibilityChanged);
QObject::connect(&*app_->scrobbler()->settings(), &ScrobblerSettings::ScrobblingEnabledChanged, this, &MainWindow::ScrobblingEnabledChanged);
QObject::connect(&*app_->scrobbler()->settings(), &ScrobblerSettings::ScrobbleButtonVisibilityChanged, this, &MainWindow::ScrobbleButtonVisibilityChanged);
QObject::connect(&*app_->scrobbler()->settings(), &ScrobblerSettings::LoveButtonVisibilityChanged, this, &MainWindow::LoveButtonVisibilityChanged);
#ifdef Q_OS_MACOS
mac::SetApplicationHandler(this);
#endif
// Tray icon
tray_icon_->SetupMenu(ui_->action_previous_track, ui_->action_play_pause, ui_->action_stop, ui_->action_stop_after_this_track, ui_->action_next_track, ui_->action_mute, ui_->action_love, ui_->action_quit);
QObject::connect(tray_icon_.get(), &SystemTrayIcon::PlayPause, app_->player(), &Player::PlayPauseHelper);
QObject::connect(tray_icon_.get(), &SystemTrayIcon::SeekForward, app_->player(), &Player::SeekForward);
QObject::connect(tray_icon_.get(), &SystemTrayIcon::SeekBackward, app_->player(), &Player::SeekBackward);
QObject::connect(tray_icon_.get(), &SystemTrayIcon::NextTrack, app_->player(), &Player::Next);
QObject::connect(tray_icon_.get(), &SystemTrayIcon::PreviousTrack, app_->player(), &Player::Previous);
QObject::connect(tray_icon_.get(), &SystemTrayIcon::ShowHide, this, &MainWindow::ToggleShowHide);
QObject::connect(tray_icon_.get(), &SystemTrayIcon::ChangeVolume, this, &MainWindow::VolumeWheelEvent);
QObject::connect(&*tray_icon_, &SystemTrayIcon::PlayPause, &*app_->player(), &Player::PlayPauseHelper);
QObject::connect(&*tray_icon_, &SystemTrayIcon::SeekForward, &*app_->player(), &Player::SeekForward);
QObject::connect(&*tray_icon_, &SystemTrayIcon::SeekBackward, &*app_->player(), &Player::SeekBackward);
QObject::connect(&*tray_icon_, &SystemTrayIcon::NextTrack, &*app_->player(), &Player::Next);
QObject::connect(&*tray_icon_, &SystemTrayIcon::PreviousTrack, &*app_->player(), &Player::Previous);
QObject::connect(&*tray_icon_, &SystemTrayIcon::ShowHide, this, &MainWindow::ToggleShowHide);
QObject::connect(&*tray_icon_, &SystemTrayIcon::ChangeVolume, this, &MainWindow::VolumeWheelEvent);
// Windows 7 thumbbar buttons
#ifdef Q_OS_WIN
@@ -807,35 +808,35 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
#ifdef HAVE_GLOBALSHORTCUTS
// Global shortcuts
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::Play, app_->player(), &Player::PlayHelper);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::Pause, app_->player(), &Player::Pause);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::Play, &*app_->player(), &Player::PlayHelper);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::Pause, &*app_->player(), &Player::Pause);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::PlayPause, ui_->action_play_pause, &QAction::trigger);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::Stop, ui_->action_stop, &QAction::trigger);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::StopAfter, ui_->action_stop_after_this_track, &QAction::trigger);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::Next, ui_->action_next_track, &QAction::trigger);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::Previous, ui_->action_previous_track, &QAction::trigger);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::IncVolume, app_->player(), &Player::VolumeUp);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::DecVolume, app_->player(), &Player::VolumeDown);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::Mute, app_->player(), &Player::Mute);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::SeekForward, app_->player(), &Player::SeekForward);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::SeekBackward, app_->player(), &Player::SeekBackward);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::IncVolume, &*app_->player(), &Player::VolumeUp);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::DecVolume, &*app_->player(), &Player::VolumeDown);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::Mute, &*app_->player(), &Player::Mute);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::SeekForward, &*app_->player(), &Player::SeekForward);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::SeekBackward, &*app_->player(), &Player::SeekBackward);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::ShowHide, this, &MainWindow::ToggleShowHide);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::ShowOSD, app_->player(), &Player::ShowOSD);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::TogglePrettyOSD, app_->player(), &Player::TogglePrettyOSD);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::ToggleScrobbling, app_->scrobbler(), &AudioScrobbler::ToggleScrobbling);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::Love, app_->scrobbler(), &AudioScrobbler::Love);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::ShowOSD, &*app_->player(), &Player::ShowOSD);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::TogglePrettyOSD, &*app_->player(), &Player::TogglePrettyOSD);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::ToggleScrobbling, &*app_->scrobbler(), &AudioScrobbler::ToggleScrobbling);
QObject::connect(globalshortcuts_manager_, &GlobalShortcutsManager::Love, &*app_->scrobbler(), &AudioScrobbler::Love);
#endif
// Fancy tabs
QObject::connect(ui_->tabs, &FancyTabWidget::CurrentChanged, this, &MainWindow::TabSwitched);
// Context
QObject::connect(app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, context_view_, &ContextView::SongChanged);
QObject::connect(app_->playlist_manager(), &PlaylistManager::SongMetadataChanged, context_view_, &ContextView::SongChanged);
QObject::connect(app_->player(), &Player::PlaylistFinished, context_view_, &ContextView::Stopped);
QObject::connect(app_->player(), &Player::Playing, context_view_, &ContextView::Playing);
QObject::connect(app_->player(), &Player::Stopped, context_view_, &ContextView::Stopped);
QObject::connect(app_->player(), &Player::Error, context_view_, &ContextView::Error);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, context_view_, &ContextView::SongChanged);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::SongMetadataChanged, context_view_, &ContextView::SongChanged);
QObject::connect(&*app_->player(), &Player::PlaylistFinished, context_view_, &ContextView::Stopped);
QObject::connect(&*app_->player(), &Player::Playing, context_view_, &ContextView::Playing);
QObject::connect(&*app_->player(), &Player::Stopped, context_view_, &ContextView::Stopped);
QObject::connect(&*app_->player(), &Player::Error, context_view_, &ContextView::Error);
QObject::connect(this, &MainWindow::AlbumCoverReady, context_view_, &ContextView::AlbumCoverLoaded);
QObject::connect(this, &MainWindow::SearchCoverInProgress, context_view_->album_widget(), &ContextAlbum::SearchCoverInProgress);
QObject::connect(context_view_, &ContextView::AlbumEnabledChanged, this, &MainWindow::TabSwitched);
@@ -852,17 +853,17 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
#ifdef HAVE_MOODBAR
// Moodbar connections
QObject::connect(app_->moodbar_controller(), &MoodbarController::CurrentMoodbarDataChanged, ui_->track_slider->moodbar_style(), &MoodbarProxyStyle::SetMoodbarData);
QObject::connect(&*app_->moodbar_controller(), &MoodbarController::CurrentMoodbarDataChanged, ui_->track_slider->moodbar_style(), &MoodbarProxyStyle::SetMoodbarData);
#endif
// Playing widget
qLog(Debug) << "Creating playing widget";
ui_->widget_playing->set_ideal_height(ui_->status_bar->sizeHint().height() + ui_->player_controls->sizeHint().height());
QObject::connect(app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, ui_->widget_playing, &PlayingWidget::SongChanged);
QObject::connect(app_->player(), &Player::PlaylistFinished, ui_->widget_playing, &PlayingWidget::Stopped);
QObject::connect(app_->player(), &Player::Playing, ui_->widget_playing, &PlayingWidget::Playing);
QObject::connect(app_->player(), &Player::Stopped, ui_->widget_playing, &PlayingWidget::Stopped);
QObject::connect(app_->player(), &Player::Error, ui_->widget_playing, &PlayingWidget::Error);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, ui_->widget_playing, &PlayingWidget::SongChanged);
QObject::connect(&*app_->player(), &Player::PlaylistFinished, ui_->widget_playing, &PlayingWidget::Stopped);
QObject::connect(&*app_->player(), &Player::Playing, ui_->widget_playing, &PlayingWidget::Playing);
QObject::connect(&*app_->player(), &Player::Stopped, ui_->widget_playing, &PlayingWidget::Stopped);
QObject::connect(&*app_->player(), &Player::Error, ui_->widget_playing, &PlayingWidget::Error);
QObject::connect(ui_->widget_playing, &PlayingWidget::ShowAboveStatusBarChanged, this, &MainWindow::PlayingWidgetPositionChanged);
QObject::connect(this, &MainWindow::AlbumCoverReady, ui_->widget_playing, &PlayingWidget::AlbumCoverLoaded);
QObject::connect(this, &MainWindow::SearchCoverInProgress, ui_->widget_playing, &PlayingWidget::SearchCoverInProgress);
@@ -892,15 +893,15 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
// Smart playlists
QObject::connect(smartplaylists_view_, &SmartPlaylistsViewContainer::AddToPlaylist, this, &MainWindow::AddToPlaylist);
ScrobbleButtonVisibilityChanged(app_->scrobbler()->ScrobbleButton());
LoveButtonVisibilityChanged(app_->scrobbler()->LoveButton());
ScrobblingEnabledChanged(app_->scrobbler()->IsEnabled());
ScrobbleButtonVisibilityChanged(app_->scrobbler()->scrobble_button());
LoveButtonVisibilityChanged(app_->scrobbler()->love_button());
ScrobblingEnabledChanged(app_->scrobbler()->enabled());
// Last.fm ImportData
QObject::connect(app_->lastfm_import(), &LastFMImport::Finished, lastfm_import_dialog_, &LastFMImportDialog::Finished);
QObject::connect(app_->lastfm_import(), &LastFMImport::FinishedWithError, lastfm_import_dialog_, &LastFMImportDialog::FinishedWithError);
QObject::connect(app_->lastfm_import(), &LastFMImport::UpdateTotal, lastfm_import_dialog_, &LastFMImportDialog::UpdateTotal);
QObject::connect(app_->lastfm_import(), &LastFMImport::UpdateProgress, lastfm_import_dialog_, &LastFMImportDialog::UpdateProgress);
QObject::connect(&*app_->lastfm_import(), &LastFMImport::Finished, lastfm_import_dialog_, &LastFMImportDialog::Finished);
QObject::connect(&*app_->lastfm_import(), &LastFMImport::FinishedWithError, lastfm_import_dialog_, &LastFMImportDialog::FinishedWithError);
QObject::connect(&*app_->lastfm_import(), &LastFMImport::UpdateTotal, lastfm_import_dialog_, &LastFMImportDialog::UpdateTotal);
QObject::connect(&*app_->lastfm_import(), &LastFMImport::UpdateProgress, lastfm_import_dialog_, &LastFMImportDialog::UpdateProgress);
// Load settings
qLog(Debug) << "Loading settings";
@@ -1009,7 +1010,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
if (!options.contains_play_options()) {
LoadPlaybackStatus();
}
if (app_->scrobbler()->IsEnabled() && !app_->scrobbler()->IsOffline()) {
if (app_->scrobbler()->enabled() && !app_->scrobbler()->offline()) {
app_->scrobbler()->Submit();
}
@@ -1018,7 +1019,6 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
if (!sparkle_url.isEmpty()) {
qLog(Debug) << "Creating Qt Sparkle updater";
qtsparkle::Updater *updater = new qtsparkle::Updater(sparkle_url, this);
updater->SetNetworkAccessManager(app->network());
updater->SetVersion(STRAWBERRY_VERSION_PACKAGE);
QObject::connect(check_updates, &QAction::triggered, updater, &qtsparkle::Updater::CheckNow);
}
@@ -1049,11 +1049,26 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
rosetta_message->set_settings_group(kSettingsGroup);
rosetta_message->set_do_not_show_message_again("ignore_rosetta");
rosetta_message->setAttribute(Qt::WA_DeleteOnClose);
rosetta_message->ShowMessage(tr("Strawberry running under Rosetta"), tr("It seems that Strawberry is running under Rosetta. Strawberry currently has limited macOS support, and running Strawberry under Rosetta is unsupported and known to have issues. If you want to use Strawberry on the current CPU, you should build Strawberry from source. For instructions see.: https://wiki.strawberrymusicplayer.org/wiki/Compile"), IconLoader::Load("dialog-warning"));
rosetta_message->ShowMessage(tr("Strawberry running under Rosetta"), tr("You are running Strawberry under Rosetta. Running Strawberry under Rosetta is unsupported and known to have issues. You should download Strawberry for the correct CPU architecture from %1").arg("<a href=\"https://downloads.strawberrymusicplayer.org/\">downloads.strawberrymusicplayer.org</a>"), IconLoader::Load("dialog-warning"));
}
}
#endif
{
QSettings s;
s.beginGroup(kSettingsGroup);
const QString do_not_show_sponsor_message_key = QString("do_not_show_sponsor_message");
const bool do_not_show_sponsor_message = s.value(do_not_show_sponsor_message_key, false).toBool();
s.endGroup();
if (!do_not_show_sponsor_message) {
MessageDialog *sponsor_message = new MessageDialog(this);
sponsor_message->set_settings_group(kSettingsGroup);
sponsor_message->set_do_not_show_message_again(do_not_show_sponsor_message_key);
sponsor_message->setAttribute(Qt::WA_DeleteOnClose);
sponsor_message->ShowMessage(tr("Sponsoring Strawberry"), tr("Strawberry is free and open source software. If you like Strawberry, please consider sponsoring the project. For more information about sponsorship see our website %1").arg("<a href= \"https://www.strawberrymusicplayer.org/\">www.strawberrymusicplayer.org</a>"), IconLoader::Load("dialog-information"));
}
}
qLog(Debug) << "Started" << QThread::currentThread();
initialized_ = true;
@@ -1067,20 +1082,24 @@ void MainWindow::ReloadSettings() {
QSettings s;
#ifndef Q_OS_MACOS
#ifdef Q_OS_MACOS
constexpr bool keeprunning_available = true;
#else
const bool systemtray_available = tray_icon_->IsSystemTrayAvailable();
const bool keeprunning_available = systemtray_available;
s.beginGroup(BehaviourSettingsPage::kSettingsGroup);
bool showtrayicon = s.value("showtrayicon", tray_icon_->IsSystemTrayAvailable()).toBool();
const bool showtrayicon = s.value("showtrayicon", systemtray_available).toBool();
s.endGroup();
if (tray_icon_->IsSystemTrayAvailable()) {
if (systemtray_available) {
tray_icon_->setVisible(showtrayicon);
}
if ((!showtrayicon || !tray_icon_->IsSystemTrayAvailable()) && !isVisible()) {
if ((!showtrayicon || !systemtray_available) && !isVisible()) {
show();
}
#endif
s.beginGroup(BehaviourSettingsPage::kSettingsGroup);
keep_running_ = s.value("keeprunning", false).toBool();
keep_running_ = keeprunning_available && s.value("keeprunning", false).toBool();
playing_widget_ = s.value("playing_widget", true).toBool();
bool trayicon_progress = s.value("trayicon_progress", false).toBool();
if (playing_widget_ != ui_->widget_playing->IsEnabled()) TabSwitched();
@@ -1135,7 +1154,6 @@ void MainWindow::ReloadSettings() {
else {
ui_->tabs->DisableTab(subsonic_view_);
}
app_->scrobbler()->Service<SubsonicScrobbler>()->ReloadSettings();
#endif
#ifdef HAVE_TIDAL
@@ -1240,7 +1258,7 @@ void MainWindow::Exit() {
else {
if (app_->player()->engine()->is_fadeout_enabled()) {
// To shut down the application when fadeout will be finished
QObject::connect(app_->player()->engine(), &EngineBase::FadeoutFinishedSignal, this, &MainWindow::DoExit);
QObject::connect(&*app_->player()->engine(), &EngineBase::FadeoutFinishedSignal, this, &MainWindow::DoExit);
if (app_->player()->GetState() == EngineBase::State::Playing) {
app_->player()->Stop();
ignore_close_ = true;
@@ -1356,7 +1374,7 @@ void MainWindow::SendNowPlaying() {
// Send now playing to scrobble services
Playlist *playlist = app_->playlist_manager()->active();
if (app_->scrobbler()->IsEnabled() && playlist && playlist->current_item() && playlist->current_item()->Metadata().is_metadata_good()) {
if (app_->scrobbler()->enabled() && playlist && playlist->current_item() && playlist->current_item()->Metadata().is_metadata_good()) {
app_->scrobbler()->UpdateNowPlaying(playlist->current_item()->Metadata());
ui_->action_love->setEnabled(true);
ui_->button_love->setEnabled(true);
@@ -1481,8 +1499,8 @@ void MainWindow::LoadPlaybackStatus() {
s.endGroup();
if (resume_playback && playback_state != EngineBase::State::Empty && playback_state != EngineBase::State::Idle) {
std::shared_ptr<QMetaObject::Connection> connection = std::make_shared<QMetaObject::Connection>();
*connection = QObject::connect(app_->playlist_manager(), &PlaylistManager::AllPlaylistsLoaded, this, [this, connection]() {
SharedPtr<QMetaObject::Connection> connection = make_shared<QMetaObject::Connection>();
*connection = QObject::connect(&*app_->playlist_manager(), &PlaylistManager::AllPlaylistsLoaded, this, [this, connection]() {
QObject::disconnect(*connection);
QTimer::singleShot(400ms, this, &MainWindow::ResumePlayback);
});
@@ -1505,10 +1523,10 @@ void MainWindow::ResumePlayback() {
// Set active to current to resume playback on correct playlist.
app_->playlist_manager()->SetActiveToCurrent();
if (playback_state == EngineBase::State::Paused) {
std::shared_ptr<QMetaObject::Connection> connection = std::make_shared<QMetaObject::Connection>();
*connection = QObject::connect(app_->player(), &Player::Playing, app_->player(), [this, connection]() {
SharedPtr<QMetaObject::Connection> connection = make_shared<QMetaObject::Connection>();
*connection = QObject::connect(&*app_->player(), &Player::Playing, &*app_->player(), [this, connection]() {
QObject::disconnect(*connection);
QTimer::singleShot(300, app_->player(), &Player::PlayPauseHelper);
QTimer::singleShot(300, &*app_->player(), &Player::PlayPauseHelper);
});
}
app_->player()->Play(playback_position * kNsecPerSec);
@@ -1683,7 +1701,7 @@ void MainWindow::UpdateTrackPosition() {
if (position % 10 == 0) tray_icon_->SetProgress(static_cast<int>(static_cast<double>(position) / static_cast<double>(length) * 100.0));
// Send Scrobble
if (app_->scrobbler()->IsEnabled() && item->Metadata().is_metadata_good()) {
if (app_->scrobbler()->enabled() && item->Metadata().is_metadata_good()) {
Playlist *playlist = app_->playlist_manager()->active();
if (playlist && !playlist->scrobbled()) {
const qint64 scrobble_point = (playlist->scrobble_point_nanosec() / kNsecPerSec);
@@ -1859,7 +1877,6 @@ void MainWindow::PlaylistRightClick(const QPoint global_pos, const QModelIndex &
int in_skipped = 0;
int not_in_skipped = 0;
int local_songs = 0;
int collection_songs = 0;
for (const QModelIndex &idx : selection) {
@@ -1870,7 +1887,6 @@ void MainWindow::PlaylistRightClick(const QPoint global_pos, const QModelIndex &
if (!item) continue;
if (item->Metadata().url().isLocalFile()) ++local_songs;
if (item->Metadata().source() == Song::Source::Collection) ++collection_songs;
if (item->Metadata().has_cue()) {
cue_selected = true;
@@ -2461,10 +2477,10 @@ void MainWindow::CommandlineOptionsReceived(const CommandlineOptions &options) {
AddToPlaylist(mimedata);
}
if (options.set_volume() != -1) app_->player()->SetVolume(options.set_volume());
if (options.set_volume() != -1) app_->player()->SetVolume(static_cast<uint>(qBound(0, options.set_volume(), 100)));
if (options.volume_modifier() != 0) {
app_->player()->SetVolume(app_->player()->GetVolume() + options.volume_modifier());
app_->player()->SetVolume(static_cast<uint>(qBound(0, static_cast<int>(app_->player()->GetVolume()) + options.volume_modifier(), 100)));
}
if (options.seek_to() != -1) {
@@ -2927,15 +2943,15 @@ void MainWindow::AutoCompleteTags() {
// Create the tag fetching stuff if it hasn't been already
if (!tag_fetcher_) {
tag_fetcher_ = std::make_unique<TagFetcher>(app_->network());
track_selection_dialog_ = std::make_unique<TrackSelectionDialog>();
tag_fetcher_ = make_unique<TagFetcher>(app_->network());
track_selection_dialog_ = make_unique<TrackSelectionDialog>();
track_selection_dialog_->set_save_on_close(true);
QObject::connect(tag_fetcher_.get(), &TagFetcher::ResultAvailable, track_selection_dialog_.get(), &TrackSelectionDialog::FetchTagFinished, Qt::QueuedConnection);
QObject::connect(tag_fetcher_.get(), &TagFetcher::Progress, track_selection_dialog_.get(), &TrackSelectionDialog::FetchTagProgress);
QObject::connect(track_selection_dialog_.get(), &TrackSelectionDialog::accepted, this, &MainWindow::AutoCompleteTagsAccepted);
QObject::connect(track_selection_dialog_.get(), &TrackSelectionDialog::finished, tag_fetcher_.get(), &TagFetcher::Cancel);
QObject::connect(track_selection_dialog_.get(), &TrackSelectionDialog::Error, this, &MainWindow::ShowErrorDialog);
QObject::connect(&*tag_fetcher_, &TagFetcher::ResultAvailable, &*track_selection_dialog_, &TrackSelectionDialog::FetchTagFinished, Qt::QueuedConnection);
QObject::connect(&*tag_fetcher_, &TagFetcher::Progress, &*track_selection_dialog_, &TrackSelectionDialog::FetchTagProgress);
QObject::connect(&*track_selection_dialog_, &TrackSelectionDialog::accepted, this, &MainWindow::AutoCompleteTagsAccepted);
QObject::connect(&*track_selection_dialog_, &TrackSelectionDialog::finished, &*tag_fetcher_, &TagFetcher::Cancel);
QObject::connect(&*track_selection_dialog_, &TrackSelectionDialog::Error, this, &MainWindow::ShowErrorDialog);
}
// Get the selected songs and start fetching tags for them
@@ -3105,14 +3121,14 @@ void MainWindow::GetCoverAutomatically() {
}
void MainWindow::ScrobblingEnabledChanged(const bool value) {
if (app_->scrobbler()->ScrobbleButton()) SetToggleScrobblingIcon(value);
if (app_->scrobbler()->scrobble_button()) SetToggleScrobblingIcon(value);
}
void MainWindow::ScrobbleButtonVisibilityChanged(const bool value) {
ui_->button_scrobble->setVisible(value);
ui_->action_toggle_scrobbling->setVisible(value);
if (value) SetToggleScrobblingIcon(app_->scrobbler()->IsEnabled());
if (value) SetToggleScrobblingIcon(app_->scrobbler()->enabled());
}
@@ -3181,7 +3197,7 @@ void MainWindow::PlaylistDelete() {
app_->player()->Next();
}
std::shared_ptr<MusicStorage> storage = std::make_shared<FilesystemMusicStorage>(Song::Source::LocalFile, "/");
SharedPtr<MusicStorage> storage = make_shared<FilesystemMusicStorage>(Song::Source::LocalFile, "/");
DeleteFiles *delete_files = new DeleteFiles(app_->task_manager(), storage, true);
//QObject::connect(delete_files, &DeleteFiles::Finished, this, &MainWindow::DeleteFinished);
delete_files->Start(selected_songs);

View File

@@ -24,8 +24,6 @@
#include "config.h"
#include <memory>
#include <QtGlobal>
#include <QObject>
#include <QWidget>
@@ -48,13 +46,14 @@
#include <QSettings>
#include <QtEvents>
#include "scoped_ptr.h"
#include "shared_ptr.h"
#include "lazy.h"
#include "platforminterface.h"
#include "song.h"
#include "tagreaderclient.h"
#include "engine/enginebase.h"
#include "osd/osdbase.h"
#include "collection/collectionmodel.h"
#include "playlist/playlist.h"
#include "playlist/playlistitem.h"
#include "settings/settingsdialog.h"
@@ -105,7 +104,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
Q_OBJECT
public:
explicit MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_icon, OSDBase *osd, const CommandlineOptions &options, QWidget *parent = nullptr);
explicit MainWindow(Application *app, SharedPtr<SystemTrayIcon> tray_icon, OSDBase *osd, const CommandlineOptions &options, QWidget *parent = nullptr);
~MainWindow() override;
static const char *kSettingsGroup;
@@ -298,7 +297,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
#endif
Application *app_;
std::shared_ptr<SystemTrayIcon> tray_icon_;
SharedPtr<SystemTrayIcon> tray_icon_;
OSDBase *osd_;
Lazy<About> about_dialog_;
Lazy<Console> console_;
@@ -319,7 +318,7 @@ class MainWindow : public QMainWindow, public PlatformInterface {
Lazy<ErrorDialog> error_dialog_;
Lazy<SettingsDialog> settings_dialog_;
Lazy<AlbumCoverManager> cover_manager_;
std::unique_ptr<Equalizer> equalizer_;
SharedPtr<Equalizer> equalizer_;
Lazy<OrganizeDialog> organize_dialog_;
#ifdef HAVE_GSTREAMER
Lazy<TranscodeDialog> transcode_dialog_;
@@ -327,9 +326,9 @@ class MainWindow : public QMainWindow, public PlatformInterface {
Lazy<AddStreamDialog> add_stream_dialog_;
#ifdef HAVE_MUSICBRAINZ
std::unique_ptr<TagFetcher> tag_fetcher_;
ScopedPtr<TagFetcher> tag_fetcher_;
#endif
std::unique_ptr<TrackSelectionDialog> track_selection_dialog_;
ScopedPtr<TrackSelectionDialog> track_selection_dialog_;
PlaylistItemPtrList autocomplete_tag_items_;
SmartPlaylistsViewContainer *smartplaylists_view_;

View File

@@ -71,7 +71,7 @@ struct tag_by_pointer {};
class MergedProxyModelPrivate {
private:
using MappingContainer = multi_index_container<Mapping *, indexed_by<hashed_unique<tag<tag_by_source>, member<Mapping, QModelIndex, &Mapping::source_index>>, ordered_unique<tag<tag_by_pointer>, identity<Mapping *>>>>;
using MappingContainer = multi_index_container<Mapping*, indexed_by<hashed_unique<tag<tag_by_source>, member<Mapping, QModelIndex, &Mapping::source_index>>, ordered_unique<tag<tag_by_pointer>, identity<Mapping*>>>>;
public:
MappingContainer mappings_;

View File

@@ -24,7 +24,6 @@
#include "config.h"
#include <memory>
#include <cstddef>
#include <QObject>
@@ -36,6 +35,8 @@
#include <QString>
#include <QStringList>
#include "core/scoped_ptr.h"
class QMimeData;
std::size_t hash_value(const QModelIndex &idx);
@@ -112,7 +113,7 @@ class MergedProxyModel : public QAbstractProxyModel {
QHash<QAbstractItemModel*, QModelIndex> old_merge_points_;
std::unique_ptr<MergedProxyModelPrivate> p_;
ScopedPtr<MergedProxyModelPrivate> p_;
};
#endif // MERGEDPROXYMODEL_H

View File

@@ -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");

View File

@@ -118,42 +118,41 @@ Mpris2::Mpris2(Application *app, QObject *parent)
return;
}
QObject::connect(app_->current_albumcover_loader(), &CurrentAlbumCoverLoader::AlbumCoverLoaded, this, &Mpris2::AlbumCoverLoaded);
QObject::connect(&*app_->current_albumcover_loader(), &CurrentAlbumCoverLoader::AlbumCoverLoaded, this, &Mpris2::AlbumCoverLoaded);
QObject::connect(app_->player()->engine(), &EngineBase::StateChanged, this, &Mpris2::EngineStateChanged);
QObject::connect(app_->player(), &Player::VolumeChanged, this, &Mpris2::VolumeChanged);
QObject::connect(app_->player(), &Player::Seeked, this, &Mpris2::Seeked);
QObject::connect(&*app_->player()->engine(), &EngineBase::StateChanged, this, &Mpris2::EngineStateChanged);
QObject::connect(&*app_->player(), &Player::VolumeChanged, this, &Mpris2::VolumeChanged);
QObject::connect(&*app_->player(), &Player::Seeked, this, &Mpris2::Seeked);
QObject::connect(app_->playlist_manager(), &PlaylistManager::PlaylistManagerInitialized, this, &Mpris2::PlaylistManagerInitialized);
QObject::connect(app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, this, &Mpris2::CurrentSongChanged);
QObject::connect(app_->playlist_manager(), &PlaylistManager::PlaylistChanged, this, &Mpris2::PlaylistChangedSlot);
QObject::connect(app_->playlist_manager(), &PlaylistManager::CurrentChanged, this, &Mpris2::PlaylistCollectionChanged);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::PlaylistManagerInitialized, this, &Mpris2::PlaylistManagerInitialized);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, this, &Mpris2::CurrentSongChanged);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::PlaylistChanged, this, &Mpris2::PlaylistChangedSlot);
QObject::connect(&*app_->playlist_manager(), &PlaylistManager::CurrentChanged, this, &Mpris2::PlaylistCollectionChanged);
app_name_[0] = app_name_[0].toUpper();
if (!QGuiApplication::desktopFileName().isEmpty()) {
desktop_files_ << QGuiApplication::desktopFileName();
QStringList data_dirs = QString(qgetenv("XDG_DATA_DIRS")).split(":");
if (!data_dirs.contains("/usr/local/share")) {
data_dirs.append("/usr/local/share");
}
QStringList domain_split = QCoreApplication::organizationDomain().split(".");
std::reverse(domain_split.begin(), domain_split.end());
desktop_files_ << QStringList() << domain_split.join(".") + "." + QCoreApplication::applicationName().toLower();
desktop_files_ << QCoreApplication::applicationName().toLower();
desktop_file_ = desktop_files_.first();
if (!data_dirs.contains("/usr/share")) {
data_dirs.append("/usr/share");
}
data_dirs_ = QString(qgetenv("XDG_DATA_DIRS")).split(":");
data_dirs_.append("/usr/local/share");
data_dirs_.append("/usr/share");
for (const QString &directory : data_dirs_) {
for (const QString &desktop_file : desktop_files_) {
QString path = QString("%1/applications/%2.desktop").arg(directory, desktop_file);
if (QFile::exists(path)) {
desktop_file_ = desktop_file;
}
for (const QString &data_dir : data_dirs) {
const QString desktopfilepath = QString("%1/applications/%2.desktop").arg(data_dir, QGuiApplication::desktopFileName());
if (QFile::exists(desktopfilepath)) {
desktopfilepath_ = desktopfilepath;
break;
}
}
if (desktopfilepath_.isEmpty()) {
desktopfilepath_ = QGuiApplication::desktopFileName() + ".desktop";
}
}
// when PlaylistManager gets it ready, we connect PlaylistSequence with this
@@ -212,6 +211,7 @@ void Mpris2::EmitNotification(const QString &name) {
else if (name == "LoopStatus") value = LoopStatus();
else if (name == "Shuffle") value = Shuffle();
else if (name == "Metadata") value = Metadata();
else if (name == "Rating") value = Rating();
else if (name == "Volume") value = Volume();
else if (name == "Position") value = Position();
else if (name == "CanPlay") value = CanPlay();
@@ -236,19 +236,11 @@ QString Mpris2::Identity() const { return app_name_; }
QString Mpris2::DesktopEntryAbsolutePath() const {
for (const QString &directory : data_dirs_) {
for (const QString &desktop_file : desktop_files_) {
QString path = QString("%1/applications/%2.desktop").arg(directory, desktop_file);
if (QFile::exists(path)) {
return path;
}
}
}
return QString();
return desktopfilepath_;
}
QString Mpris2::DesktopEntry() const { return desktop_file_; }
QString Mpris2::DesktopEntry() const { return QGuiApplication::desktopFileName() + ".desktop"; }
QStringList Mpris2::SupportedUriSchemes() const {
@@ -369,6 +361,24 @@ void Mpris2::SetShuffle(bool enable) {
QVariantMap Mpris2::Metadata() const { return last_metadata_; }
double Mpris2::Rating() const {
float rating = app_->playlist_manager()->active()->current_item_metadata().rating();
return (rating <= 0) ? 0 : rating;
}
void Mpris2::SetRating(double rating) {
if (rating > 1.0) {
rating = 1.0;
}
else if (rating <= 0.0) {
rating = -1.0;
}
app_->playlist_manager()->RateCurrentSong(static_cast<float>(rating));
}
QString Mpris2::current_track_id() const {
return QString("/org/strawberrymusicplayer/strawberry/Track/%1").arg(QString::number(app_->playlist_manager()->active()->current_row()));
}

View File

@@ -117,6 +117,9 @@ class Mpris2 : public QObject {
Q_PROPERTY(QStringList Orderings READ Orderings)
Q_PROPERTY(MaybePlaylist ActivePlaylist READ ActivePlaylist)
// strawberry specific additional property to extend MPRIS Player interface
Q_PROPERTY(double Rating READ Rating WRITE SetRating)
// Root Properties
bool CanQuit() const;
bool CanRaise() const;
@@ -144,6 +147,8 @@ class Mpris2 : public QObject {
bool Shuffle() const;
void SetShuffle(bool enable);
QVariantMap Metadata() const;
double Rating() const;
void SetRating(double rating);
double Volume() const;
void SetVolume(const double volume);
qint64 Position() const;
@@ -234,9 +239,7 @@ class Mpris2 : public QObject {
Application *app_;
QString app_name_;
QStringList data_dirs_;
QStringList desktop_files_;
QString desktop_file_;
QString desktopfilepath_;
QVariantMap last_metadata_;
};

View File

@@ -35,6 +35,7 @@
#include <QList>
#include <QImage>
#include "shared_ptr.h"
#include "song.h"
class MusicStorage {
@@ -102,6 +103,6 @@ class MusicStorage {
};
Q_DECLARE_METATYPE(MusicStorage*)
Q_DECLARE_METATYPE(std::shared_ptr<MusicStorage>)
Q_DECLARE_METATYPE(SharedPtr<MusicStorage>)
#endif // MUSICSTORAGE_H

View File

@@ -38,6 +38,8 @@
#include "core/logging.h"
#include "utilities/timeconstants.h"
#include "scoped_ptr.h"
#include "shared_ptr.h"
#include "song.h"
#include "urlhandler.h"
#include "application.h"
@@ -64,9 +66,8 @@
#include "settings/backendsettingspage.h"
#include "settings/behavioursettingspage.h"
#include "settings/playlistsettingspage.h"
#include "internet/internetservices.h"
#include "internet/internetservice.h"
#include "scrobbler/audioscrobbler.h"
using std::make_shared;
const char *Player::kSettingsGroup = "Player";
@@ -111,7 +112,7 @@ EngineBase::Type Player::CreateEngine(EngineBase::Type enginetype) {
#ifdef HAVE_GSTREAMER
case EngineBase::Type::GStreamer:{
use_enginetype=EngineBase::Type::GStreamer;
std::unique_ptr<GstEngine> gst_engine(new GstEngine(app_->task_manager()));
ScopedPtr<GstEngine> gst_engine(new GstEngine(app_->task_manager()));
gst_engine->SetStartup(gst_startup_);
engine_.reset(gst_engine.release());
break;
@@ -120,7 +121,7 @@ EngineBase::Type Player::CreateEngine(EngineBase::Type enginetype) {
#ifdef HAVE_VLC
case EngineBase::Type::VLC:
use_enginetype = EngineBase::Type::VLC;
engine_ = std::make_shared<VLCEngine>(app_->task_manager());
engine_ = make_shared<VLCEngine>(app_->task_manager());
break;
#endif
default:
@@ -166,23 +167,23 @@ void Player::Init() {
qFatal("Error initializing audio engine");
}
analyzer_->SetEngine(engine_.get());
analyzer_->SetEngine(engine_);
QObject::connect(engine_.get(), &EngineBase::Error, this, &Player::Error);
QObject::connect(engine_.get(), &EngineBase::FatalError, this, &Player::FatalError);
QObject::connect(engine_.get(), &EngineBase::ValidSongRequested, this, &Player::ValidSongRequested);
QObject::connect(engine_.get(), &EngineBase::InvalidSongRequested, this, &Player::InvalidSongRequested);
QObject::connect(engine_.get(), &EngineBase::StateChanged, this, &Player::EngineStateChanged);
QObject::connect(engine_.get(), &EngineBase::TrackAboutToEnd, this, &Player::TrackAboutToEnd);
QObject::connect(engine_.get(), &EngineBase::TrackEnded, this, &Player::TrackEnded);
QObject::connect(engine_.get(), &EngineBase::MetaData, this, &Player::EngineMetadataReceived);
QObject::connect(engine_.get(), &EngineBase::VolumeChanged, this, &Player::SetVolumeFromEngine);
QObject::connect(&*engine_, &EngineBase::Error, this, &Player::Error);
QObject::connect(&*engine_, &EngineBase::FatalError, this, &Player::FatalError);
QObject::connect(&*engine_, &EngineBase::ValidSongRequested, this, &Player::ValidSongRequested);
QObject::connect(&*engine_, &EngineBase::InvalidSongRequested, this, &Player::InvalidSongRequested);
QObject::connect(&*engine_, &EngineBase::StateChanged, this, &Player::EngineStateChanged);
QObject::connect(&*engine_, &EngineBase::TrackAboutToEnd, this, &Player::TrackAboutToEnd);
QObject::connect(&*engine_, &EngineBase::TrackEnded, this, &Player::TrackEnded);
QObject::connect(&*engine_, &EngineBase::MetaData, this, &Player::EngineMetadataReceived);
QObject::connect(&*engine_, &EngineBase::VolumeChanged, this, &Player::SetVolumeFromEngine);
// Equalizer
QObject::connect(equalizer_, &Equalizer::StereoBalancerEnabledChanged, app_->player()->engine(), &EngineBase::SetStereoBalancerEnabled);
QObject::connect(equalizer_, &Equalizer::StereoBalanceChanged, app_->player()->engine(), &EngineBase::SetStereoBalance);
QObject::connect(equalizer_, &Equalizer::EqualizerEnabledChanged, app_->player()->engine(), &EngineBase::SetEqualizerEnabled);
QObject::connect(equalizer_, &Equalizer::EqualizerParametersChanged, app_->player()->engine(), &EngineBase::SetEqualizerParameters);
QObject::connect(&*equalizer_, &Equalizer::StereoBalancerEnabledChanged, &*app_->player()->engine(), &EngineBase::SetStereoBalancerEnabled);
QObject::connect(&*equalizer_, &Equalizer::StereoBalanceChanged, &*app_->player()->engine(), &EngineBase::SetStereoBalance);
QObject::connect(&*equalizer_, &Equalizer::EqualizerEnabledChanged, &*app_->player()->engine(), &EngineBase::SetEqualizerEnabled);
QObject::connect(&*equalizer_, &Equalizer::EqualizerParametersChanged, &*app_->player()->engine(), &EngineBase::SetEqualizerParameters);
engine_->SetStereoBalancerEnabled(equalizer_->is_stereo_balancer_enabled());
engine_->SetStereoBalance(equalizer_->stereo_balance());
@@ -341,7 +342,7 @@ void Player::HandleLoadResult(const UrlHandler::LoadResult &result) {
if (is_current) {
qLog(Debug) << "Playing song" << item->Metadata().title() << result.stream_url_ << "position" << play_offset_nanosec_;
engine_->Play(result.media_url_, result.stream_url_, stream_change_type_, song.has_cue(), song.beginning_nanosec(), song.end_nanosec(), play_offset_nanosec_);
engine_->Play(result.media_url_, result.stream_url_, stream_change_type_, song.has_cue(), song.beginning_nanosec(), song.end_nanosec(), play_offset_nanosec_, song.ebur128_integrated_loudness_lufs());
current_item_ = item;
play_offset_nanosec_ = 0;
}
@@ -384,7 +385,7 @@ void Player::NextItem(const EngineBase::TrackChangeFlags change, const Playlist:
Playlist *active_playlist = app_->playlist_manager()->active();
// If we received too many errors in auto change, with repeat enabled, we stop
if (change == EngineBase::TrackChangeType::Auto) {
if (change & EngineBase::TrackChangeType::Auto) {
const PlaylistSequence::RepeatMode repeat_mode = active_playlist->sequence()->repeat_mode();
if (repeat_mode != PlaylistSequence::RepeatMode::Off) {
if ((repeat_mode == PlaylistSequence::RepeatMode::Track && nb_errors_received_ >= 3) || (nb_errors_received_ >= app_->playlist_manager()->active()->filter()->rowCount())) {
@@ -396,6 +397,11 @@ void Player::NextItem(const EngineBase::TrackChangeFlags change, const Playlist:
}
}
if (nb_errors_received_ >= 100) {
Stop();
return;
}
// Manual track changes override "Repeat track"
const bool ignore_repeat_track = change & EngineBase::TrackChangeType::Manual;
@@ -700,7 +706,7 @@ void Player::PlayAt(const int index, const quint64 offset_nanosec, EngineBase::T
pause_time_ = QDateTime();
play_offset_nanosec_ = offset_nanosec;
if (current_item_ && change == EngineBase::TrackChangeType::Manual && engine_->position_nanosec() != engine_->length_nanosec()) {
if (current_item_ && change & EngineBase::TrackChangeType::Manual && engine_->position_nanosec() != engine_->length_nanosec()) {
emit TrackSkipped(current_item_);
}
@@ -731,7 +737,7 @@ void Player::PlayAt(const int index, const quint64 offset_nanosec, EngineBase::T
}
else {
qLog(Debug) << "Playing song" << current_item_->Metadata().title() << url << "position" << offset_nanosec;
engine_->Play(current_item_->Url(), url, change, current_item_->Metadata().has_cue(), current_item_->effective_beginning_nanosec(), current_item_->effective_end_nanosec(), offset_nanosec);
engine_->Play(current_item_->Url(), url, change, current_item_->Metadata().has_cue(), current_item_->effective_beginning_nanosec(), current_item_->effective_end_nanosec(), offset_nanosec, current_item_->effective_ebur128_integrated_loudness_lufs());
}
}
@@ -861,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;

View File

@@ -24,8 +24,6 @@
#include "config.h"
#include <memory>
#include <QtGlobal>
#include <QObject>
#include <QMap>
@@ -33,6 +31,7 @@
#include <QString>
#include <QUrl>
#include "shared_ptr.h"
#include "urlhandler.h"
#include "engine/enginebase.h"
#include "engine/enginemetadata.h"
@@ -54,7 +53,7 @@ class PlayerInterface : public QObject {
public:
explicit PlayerInterface(QObject *parent = nullptr) : QObject(parent) {}
virtual EngineBase *engine() const = 0;
virtual SharedPtr<EngineBase> engine() const = 0;
virtual EngineBase::State GetState() const = 0;
virtual uint GetVolume() const = 0;
@@ -130,14 +129,14 @@ class Player : public PlayerInterface {
Q_OBJECT
public:
explicit Player(Application *app, QObject *parent);
explicit Player(Application *app, QObject *parent = nullptr);
static const char *kSettingsGroup;
EngineBase::Type CreateEngine(EngineBase::Type Type);
void Init();
EngineBase *engine() const override { return engine_.get(); }
SharedPtr<EngineBase> engine() const override { return engine_; }
EngineBase::State GetState() const override { return last_state_; }
uint GetVolume() const override;
@@ -152,7 +151,7 @@ class Player : public PlayerInterface {
bool PreviousWouldRestartTrack() const;
void SetAnalyzer(AnalyzerContainer *analyzer) { analyzer_ = analyzer; }
void SetEqualizer(Equalizer *equalizer) { equalizer_ = equalizer; }
void SetEqualizer(SharedPtr<Equalizer> equalizer) { equalizer_ = equalizer; }
public slots:
void ReloadSettings() override;
@@ -218,12 +217,12 @@ class Player : public PlayerInterface {
private:
Application *app_;
std::shared_ptr<EngineBase> engine_;
SharedPtr<EngineBase> engine_;
#ifdef HAVE_GSTREAMER
GstStartup *gst_startup_;
#endif
AnalyzerContainer *analyzer_;
Equalizer *equalizer_;
SharedPtr<Equalizer> equalizer_;
PlaylistItemPtr current_item_;

View File

@@ -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);
}
};

28
src/core/scoped_ptr.h Normal file
View File

@@ -0,0 +1,28 @@
/*
* Strawberry Music Player
* Copyright 2023, Jonas Kvinge <jonas@jkvinge.net>
*
* Strawberry is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Strawberry is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef SCOPED_PTR_H
#define SCOPED_PTR_H
#include <memory>
template <typename T, typename D = std::default_delete<T>>
using ScopedPtr = std::unique_ptr<T, D>;
#endif // SCOPED_PTR_H

Some files were not shown because too many files have changed in this diff Show More