Compare commits
320 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e35fbe532 | ||
|
|
b1fdccde6e | ||
|
|
6741f100a1 | ||
|
|
e05e9ea1b2 | ||
|
|
197341de5e | ||
|
|
2933482be3 | ||
|
|
c7ce23239f | ||
|
|
79115f7439 | ||
|
|
4457103672 | ||
|
|
d204875f72 | ||
|
|
c690e73b1a | ||
|
|
b5d39c5f21 | ||
|
|
7f8834cb04 | ||
|
|
0dab7e293c | ||
|
|
8f016880af | ||
|
|
f471462a84 | ||
|
|
58eec8df1e | ||
|
|
2655b8b43a | ||
|
|
ea86c043a4 | ||
|
|
c1faa616bc | ||
|
|
a68bf5a30d | ||
|
|
9568b8e0e5 | ||
|
|
b34321ef87 | ||
|
|
4971f1c5bf | ||
|
|
962b52bd5b | ||
|
|
9449bfa414 | ||
|
|
5b8e9066c6 | ||
|
|
8690be7fd2 | ||
|
|
497267016b | ||
|
|
0468f850c2 | ||
|
|
b9e7d4e30c | ||
|
|
0e7734b555 | ||
|
|
e81dcce5b3 | ||
|
|
38bd1f7e1c | ||
|
|
36ad9704a2 | ||
|
|
a6c05df362 | ||
|
|
f6b70fda71 | ||
|
|
8cb4e75f70 | ||
|
|
da1815ac2b | ||
|
|
f7357f2d10 | ||
|
|
d9c92c5ddd | ||
|
|
c82bdb6405 | ||
|
|
eec8ee5830 | ||
|
|
e67eb3c0d8 | ||
|
|
9c101759f6 | ||
|
|
a55ee92590 | ||
|
|
5ccfc97dab | ||
|
|
d6dd88ec3d | ||
|
|
8557d83599 | ||
|
|
94cf1f8698 | ||
|
|
9ada35c3a3 | ||
|
|
79b0c906fa | ||
|
|
a0688f1dba | ||
|
|
f91e8fecee | ||
|
|
1b363babe2 | ||
|
|
73843cb54d | ||
|
|
a2ccfc2116 | ||
|
|
fe104e2bad | ||
|
|
35e3e9f4ff | ||
|
|
b2a1cd9716 | ||
|
|
14f58eae4b | ||
|
|
5cec000618 | ||
|
|
4805a5287d | ||
|
|
4789dc5b30 | ||
|
|
5a35099043 | ||
|
|
4cd0128919 | ||
|
|
61e9b80f67 | ||
|
|
dcd881ba6c | ||
|
|
d40a67ce68 | ||
|
|
1c1e7ca62a | ||
|
|
d3831d511b | ||
|
|
0942e93144 | ||
|
|
98d3eba8e8 | ||
|
|
ff3db03696 | ||
|
|
3608c31d22 | ||
|
|
8d504d9cee | ||
|
|
782921f6e0 | ||
|
|
0694aabb45 | ||
|
|
604b35dfde | ||
|
|
4c308bf5d0 | ||
|
|
7a53ca7f8e | ||
|
|
7c51f04140 | ||
|
|
488b326e0f | ||
|
|
1e0c0a35ba | ||
|
|
bf044c1ccc | ||
|
|
c9caa7f034 | ||
|
|
1b8966b3a4 | ||
|
|
01d4d404c0 | ||
|
|
354bbf820f | ||
|
|
7620f9ebbe | ||
|
|
9c2c668a04 | ||
|
|
b6f5a5712b | ||
|
|
9e9df6eb16 | ||
|
|
f510c993a6 | ||
|
|
8ddcbaac27 | ||
|
|
3fcab72900 | ||
|
|
70aa2233e2 | ||
|
|
8123a2924d | ||
|
|
dd3c308b09 | ||
|
|
e56ca2ffd6 | ||
|
|
57c98c363c | ||
|
|
2211508061 | ||
|
|
848e41919d | ||
|
|
dac613a8bb | ||
|
|
a1735278df | ||
|
|
3730bd04a4 | ||
|
|
eee3445d2f | ||
|
|
8bf473dc3a | ||
|
|
e106dda794 | ||
|
|
fc35d2a35c | ||
|
|
aef9ff0d38 | ||
|
|
192fb46d1d | ||
|
|
1dd4eb05f2 | ||
|
|
79f0c494fa | ||
|
|
7caeb47637 | ||
|
|
ffef339ebd | ||
|
|
817153b20b | ||
|
|
686eb2e786 | ||
|
|
53d5192477 | ||
|
|
a172f5fe85 | ||
|
|
288408795b | ||
|
|
4b5a811b08 | ||
|
|
c1259d8b6e | ||
|
|
3acbe431f7 | ||
|
|
40f381257d | ||
|
|
beec983f21 | ||
|
|
d20750012e | ||
|
|
e31c9d74fa | ||
|
|
78adc388df | ||
|
|
609413cda4 | ||
|
|
63e5d6a94a | ||
|
|
fd5970b647 | ||
|
|
af38b8f92b | ||
|
|
e676e65f9e | ||
|
|
4c479301ff | ||
|
|
98178947ae | ||
|
|
0dbf3b462b | ||
|
|
cd9f8b569b | ||
|
|
6b23728efa | ||
|
|
ff0f7ee483 | ||
|
|
74498c3ac9 | ||
|
|
7a61e740e8 | ||
|
|
81e6b55c39 | ||
|
|
e439ac0e0e | ||
|
|
7b9d784a64 | ||
|
|
56b2630a1c | ||
|
|
6d5597a732 | ||
|
|
c0a9345358 | ||
|
|
2e4ad81fff | ||
|
|
1aad85a4f9 | ||
|
|
fbd2993239 | ||
|
|
203228bd05 | ||
|
|
da7edebe90 | ||
|
|
c7444a189e | ||
|
|
29235c5fa6 | ||
|
|
bf8374ff9f | ||
|
|
ba05e85e48 | ||
|
|
a9aab0702c | ||
|
|
b5cf83d501 | ||
|
|
1cc2e6303a | ||
|
|
4509a07fff | ||
|
|
ea419f6d40 | ||
|
|
c9b6707468 | ||
|
|
cf512a35a7 | ||
|
|
bdd3e5343d | ||
|
|
80fd8cd338 | ||
|
|
eb48592083 | ||
|
|
a45cb25002 | ||
|
|
21ec116769 | ||
|
|
1d4775a94b | ||
|
|
4cde9a7e9e | ||
|
|
709ba72777 | ||
|
|
0e56b8c575 | ||
|
|
558a087e37 | ||
|
|
7d96fe8b65 | ||
|
|
2f3e8986ab | ||
|
|
df359ba0fa | ||
|
|
31fa60884f | ||
|
|
15be227920 | ||
|
|
fdedfd54c7 | ||
|
|
7d55eb4b44 | ||
|
|
61ac7ae31e | ||
|
|
353e141036 | ||
|
|
cb4332842f | ||
|
|
004d219c97 | ||
|
|
94561e6815 | ||
|
|
ce3af4961b | ||
|
|
bbd81e7d9c | ||
|
|
8b1d198efd | ||
|
|
7a3bafc961 | ||
|
|
512eed9b04 | ||
|
|
38adf640e9 | ||
|
|
f4d8d73970 | ||
|
|
5a50285dee | ||
|
|
ca4ea0719f | ||
|
|
4c6251bf28 | ||
|
|
22c12c7366 | ||
|
|
8f49d1591f | ||
|
|
a97dbab2ae | ||
|
|
4cb8261d3b | ||
|
|
059e2d740f | ||
|
|
587d1c9d74 | ||
|
|
ab56c96170 | ||
|
|
efa4270429 | ||
|
|
0fbe5d888a | ||
|
|
b68f81179e | ||
|
|
6a8c1af5f9 | ||
|
|
98f287559b | ||
|
|
1a53d85f6a | ||
|
|
05b168aa04 | ||
|
|
a68d856074 | ||
|
|
d5dac9c6cc | ||
|
|
e9f7f42c03 | ||
|
|
7b8265d4a3 | ||
|
|
5715f4c2cb | ||
|
|
350debb66c | ||
|
|
267cd3660b | ||
|
|
bc1c0c3c6d | ||
|
|
c420f69da8 | ||
|
|
2151d96303 | ||
|
|
c48c65d0ce | ||
|
|
1c0b706b94 | ||
|
|
2dca3d6f5a | ||
|
|
0992636f8c | ||
|
|
86d3f2b4ed | ||
|
|
b78b4038f6 | ||
|
|
84c14349dc | ||
|
|
9916e34006 | ||
|
|
a729b42e5d | ||
|
|
01f8129ed0 | ||
|
|
fd85763fb4 | ||
|
|
c278ffe2cb | ||
|
|
902c76a781 | ||
|
|
4daed0070a | ||
|
|
a4d055b3ac | ||
|
|
e6ae6c6f04 | ||
|
|
de54ceeb40 | ||
|
|
77fe00df30 | ||
|
|
4ae3e63dea | ||
|
|
3329839dbe | ||
|
|
ca10920bb5 | ||
|
|
b41957ce5c | ||
|
|
3db6699018 | ||
|
|
5284ca90ef | ||
|
|
628cdff4fa | ||
|
|
af0c6f9233 | ||
|
|
7697bbfa4e | ||
|
|
642a455a9c | ||
|
|
6abfa2859b | ||
|
|
20c2225d8f | ||
|
|
5e7759b697 | ||
|
|
1ce8d2b31d | ||
|
|
9fbecb5af6 | ||
|
|
1223469be9 | ||
|
|
5eae3ddd8a | ||
|
|
3d0b6e6ea1 | ||
|
|
c6c53548ac | ||
|
|
3efe2d1e05 | ||
|
|
7c87b53517 | ||
|
|
a461c97bcf | ||
|
|
67a6d6c1e3 | ||
|
|
8b8e427a2b | ||
|
|
7d5c263ab2 | ||
|
|
79ac53b2d9 | ||
|
|
a704412dee | ||
|
|
24e2338769 | ||
|
|
bc240f82ef | ||
|
|
a2ad68406d | ||
|
|
3d807d2331 | ||
|
|
e6a7b484ba | ||
|
|
a62371829f | ||
|
|
fb98336713 | ||
|
|
ebadb4db0a | ||
|
|
9a480eb710 | ||
|
|
03ecde8b83 | ||
|
|
0291b78bfa | ||
|
|
377e6fad25 | ||
|
|
e75c955a68 | ||
|
|
6df356327d | ||
|
|
7a57586f90 | ||
|
|
1e2bad270d | ||
|
|
688d983b25 | ||
|
|
fa834a76ef | ||
|
|
5cb88efc38 | ||
|
|
6b64c43851 | ||
|
|
704e6c5448 | ||
|
|
072d7379df | ||
|
|
df1b756a43 | ||
|
|
30269d9d95 | ||
|
|
d29a1de980 | ||
|
|
57f5ccff81 | ||
|
|
69374bfa11 | ||
|
|
d9fd330216 | ||
|
|
312f62d98f | ||
|
|
0d408055b2 | ||
|
|
496ae42d72 | ||
|
|
3ab86543ad | ||
|
|
ce7926cfa4 | ||
|
|
48c81b188c | ||
|
|
21b241bbbe | ||
|
|
934d6fc267 | ||
|
|
a0ce2daa2e | ||
|
|
006d77239b | ||
|
|
303d31bde7 | ||
|
|
737fbeccde | ||
|
|
ec17dc9830 | ||
|
|
0f710ea3be | ||
|
|
bd4eec4527 | ||
|
|
c78252e0d5 | ||
|
|
b1f70982bf | ||
|
|
6128fb4f19 | ||
|
|
ee915254e7 | ||
|
|
d835d4aae6 | ||
|
|
5945d0ebee | ||
|
|
3d3aacdcb1 | ||
|
|
c3ce6cff72 | ||
|
|
6d7a01fb4e | ||
|
|
8582e09e73 | ||
|
|
90744f2965 | ||
|
|
03d0776fdc |
3
.github/ISSUE_TEMPLATE.md
vendored
@@ -7,7 +7,8 @@ assignees: ''
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
For technical issues, questions and feature suggestions/requests please use the forum on https://forum.strawberrymusicplayer.org/
|
For technical issues, questions and discussion please use the forum on https://forum.strawberrymusicplayer.org/
|
||||||
|
Any issues related to feature requests will be closed. See the README for more details.
|
||||||
|
|
||||||
Check the Changelog to see if the issue is already fixed:
|
Check the Changelog to see if the issue is already fixed:
|
||||||
https://github.com/strawberrymusicplayer/strawberry/blob/master/Changelog
|
https://github.com/strawberrymusicplayer/strawberry/blob/master/Changelog
|
||||||
|
|||||||
1779
.github/workflows/ccpp.yml
vendored
5
.gitignore
vendored
@@ -119,3 +119,8 @@ stage/
|
|||||||
*.snap
|
*.snap
|
||||||
/snap/.snapcraft/
|
/snap/.snapcraft/
|
||||||
/*_source.tar.bz2
|
/*_source.tar.bz2
|
||||||
|
|
||||||
|
# MSVC
|
||||||
|
CMakeSettings.json
|
||||||
|
/.vs/
|
||||||
|
/out/
|
||||||
|
|||||||
5
3rdparty/README.md
vendored
@@ -23,3 +23,8 @@ macdeployqt
|
|||||||
A modified version of Qt's official macdeployqt utility that fixes some issues,
|
A modified version of Qt's official macdeployqt utility that fixes some issues,
|
||||||
this version also deploys gstreamer plugins.
|
this version also deploys gstreamer plugins.
|
||||||
Can safely be deleted on other platforms.
|
Can safely be deleted on other platforms.
|
||||||
|
|
||||||
|
|
||||||
|
getopt
|
||||||
|
------
|
||||||
|
getopt included only when compiling with MSVC on Windows.
|
||||||
|
|||||||
2
3rdparty/getopt/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
add_library(getopt STATIC getopt.c)
|
||||||
|
target_include_directories(getopt PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
562
3rdparty/getopt/getopt.c
vendored
Normal file
@@ -0,0 +1,562 @@
|
|||||||
|
/* $OpenBSD: getopt_long.c,v 1.23 2007/10/31 12:34:57 chl Exp $ */
|
||||||
|
/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
|
* Sponsored in part by the Defense Advanced Research Projects
|
||||||
|
* Agency (DARPA) and Air Force Research Laboratory, Air Force
|
||||||
|
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
|
||||||
|
*/
|
||||||
|
/*-
|
||||||
|
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This code is derived from software contributed to The NetBSD Foundation
|
||||||
|
* by Dieter Baron and Thomas Klausner.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||||
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||||
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <getopt.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
#define REPLACE_GETOPT /* use this getopt as the system getopt(3) */
|
||||||
|
|
||||||
|
#ifdef REPLACE_GETOPT
|
||||||
|
int opterr = 1; /* if error message should be printed */
|
||||||
|
int optind = 1; /* index into parent argv vector */
|
||||||
|
int optopt = '?'; /* character checked for validity */
|
||||||
|
#undef optreset /* see getopt.h */
|
||||||
|
#define optreset __mingw_optreset
|
||||||
|
int optreset; /* reset getopt */
|
||||||
|
char *optarg; /* argument associated with option */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PRINT_ERROR ((opterr) && (*options != ':'))
|
||||||
|
|
||||||
|
#define FLAG_PERMUTE 0x01 /* permute non-options to the end of argv */
|
||||||
|
#define FLAG_ALLARGS 0x02 /* treat non-options as args to option "-1" */
|
||||||
|
#define FLAG_LONGONLY 0x04 /* operate as getopt_long_only */
|
||||||
|
|
||||||
|
/* return values */
|
||||||
|
#define BADCH (int)'?'
|
||||||
|
#define BADARG ((*options == ':') ? (int)':' : (int)'?')
|
||||||
|
#define INORDER (int)1
|
||||||
|
|
||||||
|
#ifndef __CYGWIN__
|
||||||
|
#define __progname __argv[0]
|
||||||
|
#else
|
||||||
|
extern char __declspec(dllimport) *__progname;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
static char EMSG[] = "";
|
||||||
|
#else
|
||||||
|
#define EMSG ""
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int getopt_internal(int, char * const *, const char *,
|
||||||
|
const struct option *, int *, int);
|
||||||
|
static int parse_long_options(char * const *, const char *,
|
||||||
|
const struct option *, int *, int);
|
||||||
|
static int gcd(int, int);
|
||||||
|
static void permute_args(int, int, int, char * const *);
|
||||||
|
|
||||||
|
static char *place = EMSG; /* option letter processing */
|
||||||
|
|
||||||
|
/* XXX: set optreset to 1 rather than these two */
|
||||||
|
static int nonopt_start = -1; /* first non option argument (for permute) */
|
||||||
|
static int nonopt_end = -1; /* first option after non options (for permute) */
|
||||||
|
|
||||||
|
/* Error messages */
|
||||||
|
static const char recargchar[] = "option requires an argument -- %c";
|
||||||
|
static const char recargstring[] = "option requires an argument -- %s";
|
||||||
|
static const char ambig[] = "ambiguous option -- %.*s";
|
||||||
|
static const char noarg[] = "option doesn't take an argument -- %.*s";
|
||||||
|
static const char illoptchar[] = "unknown option -- %c";
|
||||||
|
static const char illoptstring[] = "unknown option -- %s";
|
||||||
|
|
||||||
|
static void
|
||||||
|
_vwarnx(const char *fmt,va_list ap)
|
||||||
|
{
|
||||||
|
(void)fprintf(stderr,"%s: ",__progname);
|
||||||
|
if (fmt != NULL)
|
||||||
|
(void)vfprintf(stderr,fmt,ap);
|
||||||
|
(void)fprintf(stderr,"\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
warnx(const char *fmt,...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap,fmt);
|
||||||
|
_vwarnx(fmt,ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compute the greatest common divisor of a and b.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
gcd(int a, int b)
|
||||||
|
{
|
||||||
|
int c;
|
||||||
|
|
||||||
|
c = a % b;
|
||||||
|
while (c != 0) {
|
||||||
|
a = b;
|
||||||
|
b = c;
|
||||||
|
c = a % b;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Exchange the block from nonopt_start to nonopt_end with the block
|
||||||
|
* from nonopt_end to opt_end (keeping the same order of arguments
|
||||||
|
* in each block).
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
permute_args(int panonopt_start, int panonopt_end, int opt_end,
|
||||||
|
char * const *nargv)
|
||||||
|
{
|
||||||
|
int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;
|
||||||
|
char *swap;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* compute lengths of blocks and number and size of cycles
|
||||||
|
*/
|
||||||
|
nnonopts = panonopt_end - panonopt_start;
|
||||||
|
nopts = opt_end - panonopt_end;
|
||||||
|
ncycle = gcd(nnonopts, nopts);
|
||||||
|
cyclelen = (opt_end - panonopt_start) / ncycle;
|
||||||
|
|
||||||
|
for (i = 0; i < ncycle; i++) {
|
||||||
|
cstart = panonopt_end+i;
|
||||||
|
pos = cstart;
|
||||||
|
for (j = 0; j < cyclelen; j++) {
|
||||||
|
if (pos >= panonopt_end)
|
||||||
|
pos -= nnonopts;
|
||||||
|
else
|
||||||
|
pos += nopts;
|
||||||
|
swap = nargv[pos];
|
||||||
|
/* LINTED const cast */
|
||||||
|
((char **) nargv)[pos] = nargv[cstart];
|
||||||
|
/* LINTED const cast */
|
||||||
|
((char **)nargv)[cstart] = swap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* parse_long_options --
|
||||||
|
* Parse long options in argc/argv argument vector.
|
||||||
|
* Returns -1 if short_too is set and the option does not match long_options.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
parse_long_options(char * const *nargv, const char *options,
|
||||||
|
const struct option *long_options, int *idx, int short_too)
|
||||||
|
{
|
||||||
|
char *current_argv, *has_equal;
|
||||||
|
size_t current_argv_len;
|
||||||
|
int i, ambiguous, match;
|
||||||
|
|
||||||
|
#define IDENTICAL_INTERPRETATION(_x, _y) \
|
||||||
|
(long_options[(_x)].has_arg == long_options[(_y)].has_arg && \
|
||||||
|
long_options[(_x)].flag == long_options[(_y)].flag && \
|
||||||
|
long_options[(_x)].val == long_options[(_y)].val)
|
||||||
|
|
||||||
|
current_argv = place;
|
||||||
|
match = -1;
|
||||||
|
ambiguous = 0;
|
||||||
|
|
||||||
|
optind++;
|
||||||
|
|
||||||
|
if ((has_equal = strchr(current_argv, '=')) != NULL) {
|
||||||
|
/* argument found (--option=arg) */
|
||||||
|
current_argv_len = has_equal - current_argv;
|
||||||
|
has_equal++;
|
||||||
|
} else
|
||||||
|
current_argv_len = strlen(current_argv);
|
||||||
|
|
||||||
|
for (i = 0; long_options[i].name; i++) {
|
||||||
|
/* find matching long option */
|
||||||
|
if (strncmp(current_argv, long_options[i].name,
|
||||||
|
current_argv_len))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (strlen(long_options[i].name) == current_argv_len) {
|
||||||
|
/* exact match */
|
||||||
|
match = i;
|
||||||
|
ambiguous = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* If this is a known short option, don't allow
|
||||||
|
* a partial match of a single character.
|
||||||
|
*/
|
||||||
|
if (short_too && current_argv_len == 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (match == -1) /* partial match */
|
||||||
|
match = i;
|
||||||
|
else if (!IDENTICAL_INTERPRETATION(i, match))
|
||||||
|
ambiguous = 1;
|
||||||
|
}
|
||||||
|
if (ambiguous) {
|
||||||
|
/* ambiguous abbreviation */
|
||||||
|
if (PRINT_ERROR)
|
||||||
|
warnx(ambig, (int)current_argv_len,
|
||||||
|
current_argv);
|
||||||
|
optopt = 0;
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
if (match != -1) { /* option found */
|
||||||
|
if (long_options[match].has_arg == no_argument
|
||||||
|
&& has_equal) {
|
||||||
|
if (PRINT_ERROR)
|
||||||
|
warnx(noarg, (int)current_argv_len,
|
||||||
|
current_argv);
|
||||||
|
/*
|
||||||
|
* XXX: GNU sets optopt to val regardless of flag
|
||||||
|
*/
|
||||||
|
if (long_options[match].flag == NULL)
|
||||||
|
optopt = long_options[match].val;
|
||||||
|
else
|
||||||
|
optopt = 0;
|
||||||
|
return (BADARG);
|
||||||
|
}
|
||||||
|
if (long_options[match].has_arg == required_argument ||
|
||||||
|
long_options[match].has_arg == optional_argument) {
|
||||||
|
if (has_equal)
|
||||||
|
optarg = has_equal;
|
||||||
|
else if (long_options[match].has_arg ==
|
||||||
|
required_argument) {
|
||||||
|
/*
|
||||||
|
* optional argument doesn't use next nargv
|
||||||
|
*/
|
||||||
|
optarg = nargv[optind++];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((long_options[match].has_arg == required_argument)
|
||||||
|
&& (optarg == NULL)) {
|
||||||
|
/*
|
||||||
|
* Missing argument; leading ':' indicates no error
|
||||||
|
* should be generated.
|
||||||
|
*/
|
||||||
|
if (PRINT_ERROR)
|
||||||
|
warnx(recargstring,
|
||||||
|
current_argv);
|
||||||
|
/*
|
||||||
|
* XXX: GNU sets optopt to val regardless of flag
|
||||||
|
*/
|
||||||
|
if (long_options[match].flag == NULL)
|
||||||
|
optopt = long_options[match].val;
|
||||||
|
else
|
||||||
|
optopt = 0;
|
||||||
|
--optind;
|
||||||
|
return (BADARG);
|
||||||
|
}
|
||||||
|
} else { /* unknown option */
|
||||||
|
if (short_too) {
|
||||||
|
--optind;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (PRINT_ERROR)
|
||||||
|
warnx(illoptstring, current_argv);
|
||||||
|
optopt = 0;
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
if (idx)
|
||||||
|
*idx = match;
|
||||||
|
if (long_options[match].flag) {
|
||||||
|
*long_options[match].flag = long_options[match].val;
|
||||||
|
return (0);
|
||||||
|
} else
|
||||||
|
return (long_options[match].val);
|
||||||
|
#undef IDENTICAL_INTERPRETATION
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* getopt_internal --
|
||||||
|
* Parse argc/argv argument vector. Called by user level routines.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
getopt_internal(int nargc, char * const *nargv, const char *options,
|
||||||
|
const struct option *long_options, int *idx, int flags)
|
||||||
|
{
|
||||||
|
char *oli; /* option letter list index */
|
||||||
|
int optchar, short_too;
|
||||||
|
static int posixly_correct = -1;
|
||||||
|
|
||||||
|
if (options == NULL)
|
||||||
|
return (-1);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXX Some GNU programs (like cvs) set optind to 0 instead of
|
||||||
|
* XXX using optreset. Work around this braindamage.
|
||||||
|
*/
|
||||||
|
if (optind == 0)
|
||||||
|
optind = optreset = 1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Disable GNU extensions if POSIXLY_CORRECT is set or options
|
||||||
|
* string begins with a '+'.
|
||||||
|
*
|
||||||
|
* CV, 2009-12-14: Check POSIXLY_CORRECT anew if optind == 0 or
|
||||||
|
* optreset != 0 for GNU compatibility.
|
||||||
|
*/
|
||||||
|
if (posixly_correct == -1 || optreset != 0)
|
||||||
|
posixly_correct = (GetEnvironmentVariableW(L"POSIXLY_CORRECT", NULL, 0) != 0);
|
||||||
|
if (*options == '-')
|
||||||
|
flags |= FLAG_ALLARGS;
|
||||||
|
else if (posixly_correct || *options == '+')
|
||||||
|
flags &= ~FLAG_PERMUTE;
|
||||||
|
if (*options == '+' || *options == '-')
|
||||||
|
options++;
|
||||||
|
|
||||||
|
optarg = NULL;
|
||||||
|
if (optreset)
|
||||||
|
nonopt_start = nonopt_end = -1;
|
||||||
|
start:
|
||||||
|
if (optreset || !*place) { /* update scanning pointer */
|
||||||
|
optreset = 0;
|
||||||
|
if (optind >= nargc) { /* end of argument vector */
|
||||||
|
place = EMSG;
|
||||||
|
if (nonopt_end != -1) {
|
||||||
|
/* do permutation, if we have to */
|
||||||
|
permute_args(nonopt_start, nonopt_end,
|
||||||
|
optind, nargv);
|
||||||
|
optind -= nonopt_end - nonopt_start;
|
||||||
|
}
|
||||||
|
else if (nonopt_start != -1) {
|
||||||
|
/*
|
||||||
|
* If we skipped non-options, set optind
|
||||||
|
* to the first of them.
|
||||||
|
*/
|
||||||
|
optind = nonopt_start;
|
||||||
|
}
|
||||||
|
nonopt_start = nonopt_end = -1;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
if (*(place = nargv[optind]) != '-' ||
|
||||||
|
(place[1] == '\0' && strchr(options, '-') == NULL)) {
|
||||||
|
place = EMSG; /* found non-option */
|
||||||
|
if (flags & FLAG_ALLARGS) {
|
||||||
|
/*
|
||||||
|
* GNU extension:
|
||||||
|
* return non-option as argument to option 1
|
||||||
|
*/
|
||||||
|
optarg = nargv[optind++];
|
||||||
|
return (INORDER);
|
||||||
|
}
|
||||||
|
if (!(flags & FLAG_PERMUTE)) {
|
||||||
|
/*
|
||||||
|
* If no permutation wanted, stop parsing
|
||||||
|
* at first non-option.
|
||||||
|
*/
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
/* do permutation */
|
||||||
|
if (nonopt_start == -1)
|
||||||
|
nonopt_start = optind;
|
||||||
|
else if (nonopt_end != -1) {
|
||||||
|
permute_args(nonopt_start, nonopt_end,
|
||||||
|
optind, nargv);
|
||||||
|
nonopt_start = optind -
|
||||||
|
(nonopt_end - nonopt_start);
|
||||||
|
nonopt_end = -1;
|
||||||
|
}
|
||||||
|
optind++;
|
||||||
|
/* process next argument */
|
||||||
|
goto start;
|
||||||
|
}
|
||||||
|
if (nonopt_start != -1 && nonopt_end == -1)
|
||||||
|
nonopt_end = optind;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we have "-" do nothing, if "--" we are done.
|
||||||
|
*/
|
||||||
|
if (place[1] != '\0' && *++place == '-' && place[1] == '\0') {
|
||||||
|
optind++;
|
||||||
|
place = EMSG;
|
||||||
|
/*
|
||||||
|
* We found an option (--), so if we skipped
|
||||||
|
* non-options, we have to permute.
|
||||||
|
*/
|
||||||
|
if (nonopt_end != -1) {
|
||||||
|
permute_args(nonopt_start, nonopt_end,
|
||||||
|
optind, nargv);
|
||||||
|
optind -= nonopt_end - nonopt_start;
|
||||||
|
}
|
||||||
|
nonopt_start = nonopt_end = -1;
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check long options if:
|
||||||
|
* 1) we were passed some
|
||||||
|
* 2) the arg is not just "-"
|
||||||
|
* 3) either the arg starts with -- we are getopt_long_only()
|
||||||
|
*/
|
||||||
|
if (long_options != NULL && place != nargv[optind] &&
|
||||||
|
(*place == '-' || (flags & FLAG_LONGONLY))) {
|
||||||
|
short_too = 0;
|
||||||
|
if (*place == '-')
|
||||||
|
place++; /* --foo long option */
|
||||||
|
else if (*place != ':' && strchr(options, *place) != NULL)
|
||||||
|
short_too = 1; /* could be short option too */
|
||||||
|
|
||||||
|
optchar = parse_long_options(nargv, options, long_options,
|
||||||
|
idx, short_too);
|
||||||
|
if (optchar != -1) {
|
||||||
|
place = EMSG;
|
||||||
|
return (optchar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((optchar = (int)*place++) == (int)':' ||
|
||||||
|
(optchar == (int)'-' && *place != '\0') ||
|
||||||
|
(oli = strchr(options, optchar)) == NULL) {
|
||||||
|
/*
|
||||||
|
* If the user specified "-" and '-' isn't listed in
|
||||||
|
* options, return -1 (non-option) as per POSIX.
|
||||||
|
* Otherwise, it is an unknown option character (or ':').
|
||||||
|
*/
|
||||||
|
if (optchar == (int)'-' && *place == '\0')
|
||||||
|
return (-1);
|
||||||
|
if (!*place)
|
||||||
|
++optind;
|
||||||
|
if (PRINT_ERROR)
|
||||||
|
warnx(illoptchar, optchar);
|
||||||
|
optopt = optchar;
|
||||||
|
return (BADCH);
|
||||||
|
}
|
||||||
|
if (long_options != NULL && optchar == 'W' && oli[1] == ';') {
|
||||||
|
/* -W long-option */
|
||||||
|
if (*place) /* no space */
|
||||||
|
/* NOTHING */;
|
||||||
|
else if (++optind >= nargc) { /* no arg */
|
||||||
|
place = EMSG;
|
||||||
|
if (PRINT_ERROR)
|
||||||
|
warnx(recargchar, optchar);
|
||||||
|
optopt = optchar;
|
||||||
|
return (BADARG);
|
||||||
|
} else /* white space */
|
||||||
|
place = nargv[optind];
|
||||||
|
optchar = parse_long_options(nargv, options, long_options,
|
||||||
|
idx, 0);
|
||||||
|
place = EMSG;
|
||||||
|
return (optchar);
|
||||||
|
}
|
||||||
|
if (*++oli != ':') { /* doesn't take argument */
|
||||||
|
if (!*place)
|
||||||
|
++optind;
|
||||||
|
} else { /* takes (optional) argument */
|
||||||
|
optarg = NULL;
|
||||||
|
if (*place) /* no white space */
|
||||||
|
optarg = place;
|
||||||
|
else if (oli[1] != ':') { /* arg not optional */
|
||||||
|
if (++optind >= nargc) { /* no arg */
|
||||||
|
place = EMSG;
|
||||||
|
if (PRINT_ERROR)
|
||||||
|
warnx(recargchar, optchar);
|
||||||
|
optopt = optchar;
|
||||||
|
return (BADARG);
|
||||||
|
} else
|
||||||
|
optarg = nargv[optind];
|
||||||
|
}
|
||||||
|
place = EMSG;
|
||||||
|
++optind;
|
||||||
|
}
|
||||||
|
/* dump back option letter */
|
||||||
|
return (optchar);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef REPLACE_GETOPT
|
||||||
|
/*
|
||||||
|
* getopt --
|
||||||
|
* Parse argc/argv argument vector.
|
||||||
|
*
|
||||||
|
* [eventually this will replace the BSD getopt]
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
getopt(int nargc, char * const *nargv, const char *options)
|
||||||
|
{
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We don't pass FLAG_PERMUTE to getopt_internal() since
|
||||||
|
* the BSD getopt(3) (unlike GNU) has never done this.
|
||||||
|
*
|
||||||
|
* Furthermore, since many privileged programs call getopt()
|
||||||
|
* before dropping privileges it makes sense to keep things
|
||||||
|
* as simple (and bug-free) as possible.
|
||||||
|
*/
|
||||||
|
return (getopt_internal(nargc, nargv, options, NULL, NULL, 0));
|
||||||
|
}
|
||||||
|
#endif /* REPLACE_GETOPT */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* getopt_long --
|
||||||
|
* Parse argc/argv argument vector.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
getopt_long(int nargc, char * const *nargv, const char *options,
|
||||||
|
const struct option *long_options, int *idx)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (getopt_internal(nargc, nargv, options, long_options, idx,
|
||||||
|
FLAG_PERMUTE));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* getopt_long_only --
|
||||||
|
* Parse argc/argv argument vector.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
getopt_long_only(int nargc, char * const *nargv, const char *options,
|
||||||
|
const struct option *long_options, int *idx)
|
||||||
|
{
|
||||||
|
|
||||||
|
return (getopt_internal(nargc, nargv, options, long_options, idx,
|
||||||
|
FLAG_PERMUTE|FLAG_LONGONLY));
|
||||||
|
}
|
||||||
95
3rdparty/getopt/getopt.h
vendored
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
#ifndef __GETOPT_H__
|
||||||
|
/**
|
||||||
|
* DISCLAIMER
|
||||||
|
* This file has no copyright assigned and is placed in the Public Domain.
|
||||||
|
* This file is part of the mingw-w64 runtime package.
|
||||||
|
*
|
||||||
|
* The mingw-w64 runtime package and its code is distributed in the hope that it
|
||||||
|
* will be useful but WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESSED OR
|
||||||
|
* IMPLIED ARE HEREBY DISCLAIMED. This includes but is not limited to
|
||||||
|
* warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define __GETOPT_H__
|
||||||
|
|
||||||
|
/* All the headers include this file. */
|
||||||
|
#include <crtdefs.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern int optind; /* index of first non-option in argv */
|
||||||
|
extern int optopt; /* single option character, as parsed */
|
||||||
|
extern int opterr; /* flag to enable built-in diagnostics... */
|
||||||
|
/* (user may set to zero, to suppress) */
|
||||||
|
|
||||||
|
extern char *optarg; /* pointer to argument of current option */
|
||||||
|
|
||||||
|
extern int getopt(int nargc, char * const *nargv, const char *options);
|
||||||
|
|
||||||
|
#ifdef _BSD_SOURCE
|
||||||
|
/*
|
||||||
|
* BSD adds the non-standard `optreset' feature, for reinitialisation
|
||||||
|
* of `getopt' parsing. We support this feature, for applications which
|
||||||
|
* proclaim their BSD heritage, before including this header; however,
|
||||||
|
* to maintain portability, developers are advised to avoid it.
|
||||||
|
*/
|
||||||
|
# define optreset __mingw_optreset
|
||||||
|
extern int optreset;
|
||||||
|
#endif
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
* POSIX requires the `getopt' API to be specified in `unistd.h';
|
||||||
|
* thus, `unistd.h' includes this header. However, we do not want
|
||||||
|
* to expose the `getopt_long' or `getopt_long_only' APIs, when
|
||||||
|
* included in this manner. Thus, close the standard __GETOPT_H__
|
||||||
|
* declarations block, and open an additional __GETOPT_LONG_H__
|
||||||
|
* specific block, only when *not* __UNISTD_H_SOURCED__, in which
|
||||||
|
* to declare the extended API.
|
||||||
|
*/
|
||||||
|
#endif /* !defined(__GETOPT_H__) */
|
||||||
|
|
||||||
|
#if !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__)
|
||||||
|
#define __GETOPT_LONG_H__
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct option /* specification for a long form option... */
|
||||||
|
{
|
||||||
|
const char *name; /* option name, without leading hyphens */
|
||||||
|
int has_arg; /* does it take an argument? */
|
||||||
|
int *flag; /* where to save its status, or NULL */
|
||||||
|
int val; /* its associated status value */
|
||||||
|
};
|
||||||
|
|
||||||
|
enum /* permitted values for its `has_arg' field... */
|
||||||
|
{
|
||||||
|
no_argument = 0, /* option never takes an argument */
|
||||||
|
required_argument, /* option always requires an argument */
|
||||||
|
optional_argument /* option may take an argument */
|
||||||
|
};
|
||||||
|
|
||||||
|
extern int getopt_long(int nargc, char * const *nargv, const char *options,
|
||||||
|
const struct option *long_options, int *idx);
|
||||||
|
extern int getopt_long_only(int nargc, char * const *nargv, const char *options,
|
||||||
|
const struct option *long_options, int *idx);
|
||||||
|
/*
|
||||||
|
* Previous MinGW implementation had...
|
||||||
|
*/
|
||||||
|
#ifndef HAVE_DECL_GETOPT
|
||||||
|
/*
|
||||||
|
* ...for the long form API only; keep this for compatibility.
|
||||||
|
*/
|
||||||
|
# define HAVE_DECL_GETOPT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* !defined(__UNISTD_H_SOURCED__) && !defined(__GETOPT_LONG_H__) */
|
||||||
2
3rdparty/macdeployqt/main.cpp
vendored
@@ -87,7 +87,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
appBundlePath = QDir::cleanPath(appBundlePath);
|
appBundlePath = QDir::cleanPath(appBundlePath);
|
||||||
|
|
||||||
if (QDir().exists(appBundlePath) == false) {
|
if (!QDir(appBundlePath).exists()) {
|
||||||
qDebug() << "Error: Could not find app bundle" << appBundlePath;
|
qDebug() << "Error: Could not find app bundle" << appBundlePath;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
129
3rdparty/macdeployqt/shared.cpp
vendored
@@ -104,7 +104,7 @@ inline QDebug operator<<(QDebug debug, const ApplicationBundleInfo &info)
|
|||||||
|
|
||||||
bool copyFilePrintStatus(const QString &from, const QString &to)
|
bool copyFilePrintStatus(const QString &from, const QString &to)
|
||||||
{
|
{
|
||||||
if (QFile(to).exists()) {
|
if (QFile::exists(to)) {
|
||||||
if (alwaysOwerwriteEnabled) {
|
if (alwaysOwerwriteEnabled) {
|
||||||
QFile(to).remove();
|
QFile(to).remove();
|
||||||
} else {
|
} else {
|
||||||
@@ -141,7 +141,7 @@ bool copyFilePrintStatus(const QString &from, const QString &to)
|
|||||||
|
|
||||||
bool linkFilePrintStatus(const QString &file, const QString &link)
|
bool linkFilePrintStatus(const QString &file, const QString &link)
|
||||||
{
|
{
|
||||||
if (QFile(link).exists()) {
|
if (QFile::exists(link)) {
|
||||||
if (QFile(link).symLinkTarget().isEmpty())
|
if (QFile(link).symLinkTarget().isEmpty())
|
||||||
LogError() << link << "exists but it's a file.";
|
LogError() << link << "exists but it's a file.";
|
||||||
else
|
else
|
||||||
@@ -754,7 +754,7 @@ QString copyDylib(const FrameworkInfo &framework, const QString path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return if the dylib has already been deployed
|
// Return if the dylib has already been deployed
|
||||||
if (QFileInfo(dylibDestinationBinaryPath).exists() && !alwaysOwerwriteEnabled)
|
if (QFileInfo::exists(dylibDestinationBinaryPath) && !alwaysOwerwriteEnabled)
|
||||||
return dylibDestinationBinaryPath;
|
return dylibDestinationBinaryPath;
|
||||||
|
|
||||||
// Copy dylib binary
|
// Copy dylib binary
|
||||||
@@ -821,7 +821,7 @@ QString copyFramework(const FrameworkInfo &framework, const QString path)
|
|||||||
// Contents/Info.plist should be Versions/5/Resources/Info.plist
|
// Contents/Info.plist should be Versions/5/Resources/Info.plist
|
||||||
const QString legacyInfoPlistPath = framework.frameworkPath + "/Contents/Info.plist";
|
const QString legacyInfoPlistPath = framework.frameworkPath + "/Contents/Info.plist";
|
||||||
const QString correctInfoPlistPath = frameworkDestinationDirectory + "/Resources/Info.plist";
|
const QString correctInfoPlistPath = frameworkDestinationDirectory + "/Resources/Info.plist";
|
||||||
if (QFile(legacyInfoPlistPath).exists()) {
|
if (QFile::exists(legacyInfoPlistPath)) {
|
||||||
copyFilePrintStatus(legacyInfoPlistPath, correctInfoPlistPath);
|
copyFilePrintStatus(legacyInfoPlistPath, correctInfoPlistPath);
|
||||||
patch_debugInInfoPlist(correctInfoPlistPath);
|
patch_debugInInfoPlist(correctInfoPlistPath);
|
||||||
}
|
}
|
||||||
@@ -1214,27 +1214,34 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl
|
|||||||
|
|
||||||
// GIO modules
|
// GIO modules
|
||||||
{
|
{
|
||||||
QString sourcePath = qgetenv("GIO_EXTRA_MODULES");
|
QString giomodule_path = qgetenv("GIO_EXTRA_MODULES");
|
||||||
if (sourcePath.isEmpty()) {
|
if (giomodule_path.isEmpty()) {
|
||||||
if (QFileInfo::exists("/usr/local/lib/gio/modules/libgiognutls.so")) {
|
if (QDir().exists("/usr/local/lib/gio/modules")) {
|
||||||
sourcePath = "/usr/local/lib/gio/modules/libgiognutls.so";
|
giomodule_path = "/usr/local/lib/gio/modules";
|
||||||
}
|
}
|
||||||
else if (QFileInfo::exists("/opt/local/lib/gio/modules/libgiognutls.so")) {
|
else if (QDir().exists("/opt/local/lib/gio/modules")) {
|
||||||
sourcePath = "/opt/local/lib/gio/modules/libgiognutls.so";
|
giomodule_path = "/opt/local/lib/gio/modules";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qFatal("Missing GIO_EXTRA_MODULES");
|
qFatal("Missing GIO_EXTRA_MODULES");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
sourcePath = sourcePath + "/libgiognutls.so";
|
const QStringList giomodules = QStringList() << "libgiognutls.so" << "libgioopenssl.so";
|
||||||
}
|
for (const QString &giomodule : giomodules) {
|
||||||
const QString destinationPath = appBundleInfo.path + "/Contents/PlugIns/gio-modules/libgiognutls.so";
|
const QString sourcePath = giomodule_path + "/" + giomodule;
|
||||||
QDir dir;
|
QFileInfo fileinfo(sourcePath);
|
||||||
if (dir.mkpath(QFileInfo(destinationPath).path()) && copyFilePrintStatus(sourcePath, destinationPath)) {
|
if (!fileinfo.exists()) {
|
||||||
runStrip(destinationPath);
|
LogError() << "Missing GIO module" << fileinfo.baseName();
|
||||||
QList<FrameworkInfo> frameworks = getQtFrameworks(destinationPath, appBundleInfo.path, deploymentInfo.rpathsUsed, useDebugLibs);
|
qFatal("Missing GIO modules.");
|
||||||
deployQtFrameworks(frameworks, appBundleInfo.path, QStringList() << destinationPath, useDebugLibs, deploymentInfo.useLoaderPath);
|
}
|
||||||
|
const QString destinationPath = appBundleInfo.path + "/Contents/PlugIns/gio-modules/" + giomodule;
|
||||||
|
QDir dir;
|
||||||
|
if (dir.mkpath(QFileInfo(destinationPath).path()) && copyFilePrintStatus(sourcePath, destinationPath)) {
|
||||||
|
runStrip(destinationPath);
|
||||||
|
QList<FrameworkInfo> frameworks = getQtFrameworks(destinationPath, appBundleInfo.path, deploymentInfo.rpathsUsed, useDebugLibs);
|
||||||
|
deployQtFrameworks(frameworks, appBundleInfo.path, QStringList() << destinationPath, useDebugLibs, deploymentInfo.useLoaderPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1262,8 +1269,12 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GStreamer plugins.
|
// GStreamer plugins.
|
||||||
QStringList gstreamer_plugins = QStringList() << "libgstapetag.dylib"
|
QStringList gstreamer_plugins = QStringList()
|
||||||
|
<< "libgstaiff.dylib"
|
||||||
|
<< "libgstapetag.dylib"
|
||||||
<< "libgstapp.dylib"
|
<< "libgstapp.dylib"
|
||||||
|
<< "libgstasf.dylib"
|
||||||
|
<< "libgstasfmux.dylib"
|
||||||
<< "libgstaudioconvert.dylib"
|
<< "libgstaudioconvert.dylib"
|
||||||
<< "libgstaudiofx.dylib"
|
<< "libgstaudiofx.dylib"
|
||||||
<< "libgstaudiomixer.dylib"
|
<< "libgstaudiomixer.dylib"
|
||||||
@@ -1271,48 +1282,46 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl
|
|||||||
<< "libgstaudiorate.dylib"
|
<< "libgstaudiorate.dylib"
|
||||||
<< "libgstaudioresample.dylib"
|
<< "libgstaudioresample.dylib"
|
||||||
<< "libgstaudiotestsrc.dylib"
|
<< "libgstaudiotestsrc.dylib"
|
||||||
<< "libgstaudiovisualizers.dylib"
|
|
||||||
<< "libgstauparse.dylib"
|
|
||||||
<< "libgstautoconvert.dylib"
|
|
||||||
<< "libgstautodetect.dylib"
|
<< "libgstautodetect.dylib"
|
||||||
|
<< "libgstbs2b.dylib"
|
||||||
|
<< "libgstcdio.dylib"
|
||||||
<< "libgstcoreelements.dylib"
|
<< "libgstcoreelements.dylib"
|
||||||
|
<< "libgstdash.dylib"
|
||||||
<< "libgstequalizer.dylib"
|
<< "libgstequalizer.dylib"
|
||||||
|
<< "libgstflac.dylib"
|
||||||
|
<< "libgstfaac.dylib"
|
||||||
|
<< "libgstfaad.dylib"
|
||||||
|
<< "libgstfdkaac.dylib"
|
||||||
<< "libgstgio.dylib"
|
<< "libgstgio.dylib"
|
||||||
<< "libgsticydemux.dylib"
|
<< "libgsticydemux.dylib"
|
||||||
<< "libgstid3demux.dylib"
|
<< "libgstid3demux.dylib"
|
||||||
<< "libgstlevel.dylib"
|
<< "libgstisomp4.dylib"
|
||||||
|
<< "libgstlame.dylib"
|
||||||
|
<< "libgstlibav.dylib"
|
||||||
|
<< "libgstmpg123.dylib"
|
||||||
|
<< "libgstmusepack.dylib"
|
||||||
|
<< "libgstogg.dylib"
|
||||||
|
<< "libgstopenmpt.dylib"
|
||||||
|
<< "libgstopus.dylib"
|
||||||
|
<< "libgstopusparse.dylib"
|
||||||
<< "libgstosxaudio.dylib"
|
<< "libgstosxaudio.dylib"
|
||||||
<< "libgstplayback.dylib"
|
|
||||||
<< "libgstrawparse.dylib"
|
|
||||||
<< "libgstreplaygain.dylib"
|
|
||||||
<< "libgstsoup.dylib"
|
|
||||||
<< "libgstspectrum.dylib"
|
|
||||||
<< "libgsttypefindfunctions.dylib"
|
|
||||||
<< "libgstvolume.dylib"
|
|
||||||
<< "libgstxingmux.dylib"
|
|
||||||
<< "libgsttcp.dylib"
|
|
||||||
<< "libgstudp.dylib"
|
|
||||||
<< "libgstpbtypes.dylib"
|
<< "libgstpbtypes.dylib"
|
||||||
|
<< "libgstplayback.dylib"
|
||||||
|
<< "libgstreplaygain.dylib"
|
||||||
<< "libgstrtp.dylib"
|
<< "libgstrtp.dylib"
|
||||||
<< "libgstrtsp.dylib"
|
<< "libgstrtsp.dylib"
|
||||||
<< "libgstflac.dylib"
|
<< "libgstsoup.dylib"
|
||||||
<< "libgstwavparse.dylib"
|
<< "libgstspectrum.dylib"
|
||||||
<< "libgstfaad.dylib"
|
|
||||||
<< "libgstogg.dylib"
|
|
||||||
<< "libgstopus.dylib"
|
|
||||||
<< "libgstasf.dylib"
|
|
||||||
<< "libgstspeex.dylib"
|
<< "libgstspeex.dylib"
|
||||||
<< "libgsttaglib.dylib"
|
<< "libgsttaglib.dylib"
|
||||||
|
<< "libgsttcp.dylib"
|
||||||
|
<< "libgsttypefindfunctions.dylib"
|
||||||
|
<< "libgstudp.dylib"
|
||||||
|
<< "libgstvolume.dylib"
|
||||||
<< "libgstvorbis.dylib"
|
<< "libgstvorbis.dylib"
|
||||||
<< "libgstisomp4.dylib"
|
<< "libgstwavpack.dylib"
|
||||||
<< "libgstlibav.dylib"
|
<< "libgstwavparse.dylib"
|
||||||
<< "libgstaiff.dylib"
|
<< "libgstxingmux.dylib";
|
||||||
<< "libgstlame.dylib";
|
|
||||||
|
|
||||||
// macports does not have these.
|
|
||||||
QStringList gstreamer_plugins_optional = QStringList() << "libgstopusparse.dylib"
|
|
||||||
<< "libgstfaac.dylib"
|
|
||||||
<< "libgstmusepack.dylib";
|
|
||||||
|
|
||||||
QString gstreamer_plugins_dir = qgetenv("GST_PLUGIN_PATH");
|
QString gstreamer_plugins_dir = qgetenv("GST_PLUGIN_PATH");
|
||||||
if (gstreamer_plugins_dir.isEmpty()) {
|
if (gstreamer_plugins_dir.isEmpty()) {
|
||||||
@@ -1345,24 +1354,6 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const QString &plugin : gstreamer_plugins_optional) {
|
|
||||||
QFileInfo info(gstreamer_plugins_dir + "/" + plugin);
|
|
||||||
if (!info.exists()) {
|
|
||||||
info.setFile(gstreamer_plugins_dir + "/" + info.baseName() + QString(".so"));
|
|
||||||
if (!info.exists()) {
|
|
||||||
LogWarning() << "Skip missing gstreamer plugin" << info.baseName();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const QString &sourcePath = info.filePath();
|
|
||||||
const QString destinationPath = appBundleInfo.path + "/Contents/PlugIns/gstreamer/" + info.fileName();
|
|
||||||
if (QDir().mkpath(QFileInfo(destinationPath).path()) && copyFilePrintStatus(sourcePath, destinationPath)) {
|
|
||||||
runStrip(destinationPath);
|
|
||||||
QList<FrameworkInfo> frameworks = getQtFrameworks(destinationPath, appBundleInfo.path, deploymentInfo.rpathsUsed, useDebugLibs);
|
|
||||||
deployQtFrameworks(frameworks, appBundleInfo.path, QStringList() << destinationPath, useDebugLibs, deploymentInfo.useLoaderPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void createQtConf(const QString &appBundlePath)
|
void createQtConf(const QString &appBundlePath)
|
||||||
@@ -1443,11 +1434,11 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Fallback: Look relative to the macdeployqt binary
|
// Fallback: Look relative to the macdeployqt binary
|
||||||
if (!QFile(qmlImportScannerPath).exists())
|
if (!QFile::exists(qmlImportScannerPath))
|
||||||
qmlImportScannerPath = QCoreApplication::applicationDirPath() + "/qmlimportscanner";
|
qmlImportScannerPath = QCoreApplication::applicationDirPath() + "/qmlimportscanner";
|
||||||
|
|
||||||
// Verify that we found a qmlimportscanner binary
|
// Verify that we found a qmlimportscanner binary
|
||||||
if (!QFile(qmlImportScannerPath).exists()) {
|
if (!QFile::exists(qmlImportScannerPath)) {
|
||||||
LogError() << "qmlimportscanner not found at" << qmlImportScannerPath;
|
LogError() << "qmlimportscanner not found at" << qmlImportScannerPath;
|
||||||
LogError() << "Rebuild qtdeclarative/tools/qmlimportscanner";
|
LogError() << "Rebuild qtdeclarative/tools/qmlimportscanner";
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
6
3rdparty/singleapplication/CMakeLists.txt
vendored
@@ -3,10 +3,8 @@ cmake_minimum_required(VERSION 3.0)
|
|||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_GREATER 3.0)
|
check_function_exists(geteuid HAVE_GETEUID)
|
||||||
check_function_exists(geteuid HAVE_GETEUID)
|
check_function_exists(getpwuid HAVE_GETPWUID)
|
||||||
check_function_exists(getpwuid HAVE_GETPWUID)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(SINGLEAPP-SOURCES singleapplication.cpp singleapplication_p.cpp)
|
set(SINGLEAPP-SOURCES singleapplication.cpp singleapplication_p.cpp)
|
||||||
set(SINGLEAPP-MOC-HEADERS singleapplication.h singleapplication_p.h)
|
set(SINGLEAPP-MOC-HEADERS singleapplication.h singleapplication_p.h)
|
||||||
|
|||||||
2
3rdparty/singleapplication/LICENSE
vendored
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) Itay Grudev 2015 - 2016
|
Copyright (c) Itay Grudev 2015 - 2020
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
86
3rdparty/singleapplication/README.md
vendored
@@ -1,7 +1,8 @@
|
|||||||
SingleApplication
|
SingleApplication
|
||||||
=================
|
=================
|
||||||
|
[](https://github.com/itay-grudev/SingleApplication/actions)
|
||||||
|
|
||||||
This is a replacement of the QtSingleApplication for `Qt5`.
|
This is a replacement of the QtSingleApplication for `Qt5` and `Qt6`.
|
||||||
|
|
||||||
Keeps the Primary Instance of your Application and kills each subsequent
|
Keeps the Primary Instance of your Application and kills each subsequent
|
||||||
instances. It can (if enabled) spawn secondary (non-related to the primary)
|
instances. It can (if enabled) spawn secondary (non-related to the primary)
|
||||||
@@ -15,18 +16,6 @@ class you specify via the `QAPPLICATION_CLASS` macro (`QCoreApplication` is the
|
|||||||
default). Further usage is similar to the use of the `Q[Core|Gui]Application`
|
default). Further usage is similar to the use of the `Q[Core|Gui]Application`
|
||||||
classes.
|
classes.
|
||||||
|
|
||||||
The library sets up a `QLocalServer` and a `QSharedMemory` block. The first
|
|
||||||
instance of your Application is your Primary Instance. It would check if the
|
|
||||||
shared memory block exists and if not it will start a `QLocalServer` and listen
|
|
||||||
for connections. Each subsequent instance of your application would check if the
|
|
||||||
shared memory block exists and if it does, it will connect to the QLocalServer
|
|
||||||
to notify the primary instance that a new instance had been started, after which
|
|
||||||
it would terminate with status code `0`. In the Primary Instance
|
|
||||||
`SingleApplication` would emit the `instanceStarted()` signal upon detecting
|
|
||||||
that a new instance had been started.
|
|
||||||
|
|
||||||
The library uses `stdlib` to terminate the program with the `exit()` function.
|
|
||||||
|
|
||||||
You can use the library as if you use any other `QCoreApplication` derived
|
You can use the library as if you use any other `QCoreApplication` derived
|
||||||
class:
|
class:
|
||||||
|
|
||||||
@@ -43,24 +32,49 @@ int main( int argc, char* argv[] )
|
|||||||
```
|
```
|
||||||
|
|
||||||
To include the library files I would recommend that you add it as a git
|
To include the library files I would recommend that you add it as a git
|
||||||
submodule to your project and include it's contents with a `.pri` file. Here is
|
submodule to your project. Here is how:
|
||||||
how:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git submodule add git@github.com:itay-grudev/SingleApplication.git singleapplication
|
git submodule add https://github.com/itay-grudev/SingleApplication.git singleapplication
|
||||||
```
|
```
|
||||||
|
|
||||||
Then include the `singleapplication.pri` file in your `.pro` project file. Also
|
**Qmake:**
|
||||||
don't forget to specify which `QCoreApplication` class your app is using if it
|
|
||||||
is not `QCoreApplication`.
|
Then include the `singleapplication.pri` file in your `.pro` project file.
|
||||||
|
|
||||||
```qmake
|
```qmake
|
||||||
include(singleapplication/singleapplication.pri)
|
include(singleapplication/singleapplication.pri)
|
||||||
DEFINES += QAPPLICATION_CLASS=QApplication
|
DEFINES += QAPPLICATION_CLASS=QApplication
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**CMake:**
|
||||||
|
|
||||||
|
Then include the subdirectory in your `CMakeLists.txt` project file.
|
||||||
|
|
||||||
|
```cmake
|
||||||
|
set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
|
||||||
|
add_subdirectory(src/third-party/singleapplication)
|
||||||
|
target_link_libraries(${PROJECT_NAME} SingleApplication::SingleApplication)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
The library sets up a `QLocalServer` and a `QSharedMemory` block. The first
|
||||||
|
instance of your Application is your Primary Instance. It would check if the
|
||||||
|
shared memory block exists and if not it will start a `QLocalServer` and listen
|
||||||
|
for connections. Each subsequent instance of your application would check if the
|
||||||
|
shared memory block exists and if it does, it will connect to the QLocalServer
|
||||||
|
to notify the primary instance that a new instance had been started, after which
|
||||||
|
it would terminate with status code `0`. In the Primary Instance
|
||||||
|
`SingleApplication` would emit the `instanceStarted()` signal upon detecting
|
||||||
|
that a new instance had been started.
|
||||||
|
|
||||||
|
The library uses `stdlib` to terminate the program with the `exit()` function.
|
||||||
|
|
||||||
|
Also don't forget to specify which `QCoreApplication` class your app is using if it
|
||||||
|
is not `QCoreApplication` as in examples above.
|
||||||
|
|
||||||
The `Instance Started` signal
|
The `Instance Started` signal
|
||||||
------------------------
|
-----------------------------
|
||||||
|
|
||||||
The SingleApplication class implements a `instanceStarted()` signal. You can
|
The SingleApplication class implements a `instanceStarted()` signal. You can
|
||||||
bind to that signal to raise your application's window when a new instance had
|
bind to that signal to raise your application's window when a new instance had
|
||||||
@@ -125,13 +139,22 @@ app.isSecondary();
|
|||||||
*__Note:__ If your Primary Instance is terminated a newly launched instance
|
*__Note:__ If your Primary Instance is terminated a newly launched instance
|
||||||
will replace the Primary one even if the Secondary flag has been set.*
|
will replace the Primary one even if the Secondary flag has been set.*
|
||||||
|
|
||||||
|
Examples
|
||||||
|
--------
|
||||||
|
|
||||||
|
There are three examples provided in this repository:
|
||||||
|
|
||||||
|
* Basic example that prevents a secondary instance from starting [`examples/basic`](https://github.com/itay-grudev/SingleApplication/tree/master/examples/basic)
|
||||||
|
* An example of a graphical application raising it's parent window [`examples/calculator`](https://github.com/itay-grudev/SingleApplication/tree/master/examples/calculator)
|
||||||
|
* A console application sending the primary instance it's command line parameters [`examples/sending_arguments`](https://github.com/itay-grudev/SingleApplication/tree/master/examples/sending_arguments)
|
||||||
|
|
||||||
API
|
API
|
||||||
---
|
---
|
||||||
|
|
||||||
### Members
|
### Members
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSecondary = false, Options options = Mode::User, int timeout = 100 )
|
SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSecondary = false, Options options = Mode::User, int timeout = 100, QString userData = QString() )
|
||||||
```
|
```
|
||||||
|
|
||||||
Depending on whether `allowSecondary` is set, this constructor may terminate
|
Depending on whether `allowSecondary` is set, this constructor may terminate
|
||||||
@@ -140,7 +163,7 @@ can be specified to set whether the SingleApplication block should work
|
|||||||
user-wide or system-wide. Additionally the `Mode::SecondaryNotification` may be
|
user-wide or system-wide. Additionally the `Mode::SecondaryNotification` may be
|
||||||
used to notify the primary instance whenever a secondary instance had been
|
used to notify the primary instance whenever a secondary instance had been
|
||||||
started (disabled by default). `timeout` specifies the maximum time in
|
started (disabled by default). `timeout` specifies the maximum time in
|
||||||
milliseconds to wait for blocking operations.
|
milliseconds to wait for blocking operations. Setting `userData` provides additional data that will isolate this instance from other instances that do not have the same (or any) user data set.
|
||||||
|
|
||||||
*__Note:__ `argc` and `argv` may be changed as Qt removes arguments that it
|
*__Note:__ `argc` and `argv` may be changed as Qt removes arguments that it
|
||||||
recognizes.*
|
recognizes.*
|
||||||
@@ -159,7 +182,8 @@ bool SingleApplication::sendMessage( QByteArray message, int timeout = 100 )
|
|||||||
```
|
```
|
||||||
|
|
||||||
Sends `message` to the Primary Instance. Uses `timeout` as a the maximum timeout
|
Sends `message` to the Primary Instance. Uses `timeout` as a the maximum timeout
|
||||||
in milliseconds for blocking functions
|
in milliseconds for blocking functions. Returns `true` if the message has been sent
|
||||||
|
successfully. If the message can't be sent or the function timeouts - returns `false`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -192,6 +216,22 @@ qint64 SingleApplication::primaryPid()
|
|||||||
|
|
||||||
Returns the process ID (PID) of the primary instance.
|
Returns the process ID (PID) of the primary instance.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
QString SingleApplication::primaryUser()
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns the username the primary instance is running as.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
QString SingleApplication::currentUser()
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns the username the current instance is running as.
|
||||||
|
|
||||||
### Signals
|
### Signals
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
|
|||||||
44
3rdparty/singleapplication/singleapplication.cpp
vendored
@@ -54,7 +54,7 @@
|
|||||||
* @param options Optional flags to toggle specific behaviour
|
* @param options Optional flags to toggle specific behaviour
|
||||||
* @param timeout Maximum time blocking functions are allowed during app load
|
* @param timeout Maximum time blocking functions are allowed during app load
|
||||||
*/
|
*/
|
||||||
SingleApplication::SingleApplication(int &argc, char *argv[], bool allowSecondary, Options options, int timeout)
|
SingleApplication::SingleApplication(int &argc, char *argv[], const bool allowSecondary, const Options options, const int timeout)
|
||||||
: app_t(argc, argv),
|
: app_t(argc, argv),
|
||||||
d_ptr(new SingleApplicationPrivate(this)) {
|
d_ptr(new SingleApplicationPrivate(this)) {
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ SingleApplication::SingleApplication(int &argc, char *argv[], bool allowSecondar
|
|||||||
d->genBlockServerName();
|
d->genBlockServerName();
|
||||||
|
|
||||||
// To mitigate QSharedMemory issues with large amount of processes attempting to attach at the same time
|
// To mitigate QSharedMemory issues with large amount of processes attempting to attach at the same time
|
||||||
d->randomSleep();
|
SingleApplicationPrivate::randomSleep();
|
||||||
|
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
// By explicitly attaching it and then deleting it we make sure that the memory is deleted even after the process has crashed on Unix.
|
// By explicitly attaching it and then deleting it we make sure that the memory is deleted even after the process has crashed on Unix.
|
||||||
@@ -106,14 +106,14 @@ SingleApplication::SingleApplication(int &argc, char *argv[], bool allowSecondar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InstancesInfo *inst = static_cast<InstancesInfo*>(d->memory_->data());
|
InstancesInfo *instance = static_cast<InstancesInfo*>(d->memory_->data());
|
||||||
QElapsedTimer time;
|
QElapsedTimer time;
|
||||||
time.start();
|
time.start();
|
||||||
|
|
||||||
// Make sure the shared memory block is initialised and in consistent state
|
// Make sure the shared memory block is initialised and in consistent state
|
||||||
forever {
|
forever {
|
||||||
// If the shared memory block's checksum is valid continue
|
// If the shared memory block's checksum is valid continue
|
||||||
if (d->blockChecksum() == inst->checksum) break;
|
if (d->blockChecksum() == instance->checksum) break;
|
||||||
|
|
||||||
// If more than 5s have elapsed, assume the primary instance crashed and assume it's position
|
// If more than 5s have elapsed, assume the primary instance crashed and assume it's position
|
||||||
if (time.elapsed() > 5000) {
|
if (time.elapsed() > 5000) {
|
||||||
@@ -127,14 +127,14 @@ SingleApplication::SingleApplication(int &argc, char *argv[], bool allowSecondar
|
|||||||
qDebug() << "SingleApplication: Unable to unlock memory for random wait.";
|
qDebug() << "SingleApplication: Unable to unlock memory for random wait.";
|
||||||
qDebug() << d->memory_->errorString();
|
qDebug() << d->memory_->errorString();
|
||||||
}
|
}
|
||||||
d->randomSleep();
|
SingleApplicationPrivate::randomSleep();
|
||||||
if (!d->memory_->lock()) {
|
if (!d->memory_->lock()) {
|
||||||
qCritical() << "SingleApplication: Unable to lock memory after random wait.";
|
qCritical() << "SingleApplication: Unable to lock memory after random wait.";
|
||||||
abortSafely();
|
abortSafely();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inst->primary) {
|
if (!instance->primary) {
|
||||||
d->startPrimary();
|
d->startPrimary();
|
||||||
if (!d->memory_->unlock()) {
|
if (!d->memory_->unlock()) {
|
||||||
qDebug() << "SingleApplication: Unable to unlock memory after primary start.";
|
qDebug() << "SingleApplication: Unable to unlock memory after primary start.";
|
||||||
@@ -178,8 +178,8 @@ SingleApplication::~SingleApplication() {
|
|||||||
* Checks if the current application instance is primary.
|
* Checks if the current application instance is primary.
|
||||||
* @return Returns true if the instance is primary, false otherwise.
|
* @return Returns true if the instance is primary, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool SingleApplication::isPrimary() {
|
bool SingleApplication::isPrimary() const {
|
||||||
Q_D(SingleApplication);
|
Q_D(const SingleApplication);
|
||||||
return d->server_ != nullptr;
|
return d->server_ != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,8 +187,8 @@ bool SingleApplication::isPrimary() {
|
|||||||
* Checks if the current application instance is secondary.
|
* Checks if the current application instance is secondary.
|
||||||
* @return Returns true if the instance is secondary, false otherwise.
|
* @return Returns true if the instance is secondary, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool SingleApplication::isSecondary() {
|
bool SingleApplication::isSecondary() const {
|
||||||
Q_D(SingleApplication);
|
Q_D(const SingleApplication);
|
||||||
return d->server_ == nullptr;
|
return d->server_ == nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,8 +197,8 @@ bool SingleApplication::isSecondary() {
|
|||||||
* It is reset when the first (primary) instance of your app starts and only incremented afterwards.
|
* It is reset when the first (primary) instance of your app starts and only incremented afterwards.
|
||||||
* @return Returns a unique instance id.
|
* @return Returns a unique instance id.
|
||||||
*/
|
*/
|
||||||
quint32 SingleApplication::instanceId() {
|
quint32 SingleApplication::instanceId() const {
|
||||||
Q_D(SingleApplication);
|
Q_D(const SingleApplication);
|
||||||
return d->instanceNumber_;
|
return d->instanceNumber_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,8 +207,8 @@ quint32 SingleApplication::instanceId() {
|
|||||||
* Especially useful when SingleApplication is coupled with OS. specific APIs.
|
* Especially useful when SingleApplication is coupled with OS. specific APIs.
|
||||||
* @return Returns the primary instance PID.
|
* @return Returns the primary instance PID.
|
||||||
*/
|
*/
|
||||||
qint64 SingleApplication::primaryPid() {
|
qint64 SingleApplication::primaryPid() const {
|
||||||
Q_D(SingleApplication);
|
Q_D(const SingleApplication);
|
||||||
return d->primaryPid();
|
return d->primaryPid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,8 +216,8 @@ qint64 SingleApplication::primaryPid() {
|
|||||||
* Returns the username the primary instance is running as.
|
* Returns the username the primary instance is running as.
|
||||||
* @return Returns the username the primary instance is running as.
|
* @return Returns the username the primary instance is running as.
|
||||||
*/
|
*/
|
||||||
QString SingleApplication::primaryUser() {
|
QString SingleApplication::primaryUser() const {
|
||||||
Q_D(SingleApplication);
|
Q_D(const SingleApplication);
|
||||||
return d->primaryUser();
|
return d->primaryUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,9 +225,8 @@ QString SingleApplication::primaryUser() {
|
|||||||
* Returns the username the current instance is running as.
|
* Returns the username the current instance is running as.
|
||||||
* @return Returns the username the current instance is running as.
|
* @return Returns the username the current instance is running as.
|
||||||
*/
|
*/
|
||||||
QString SingleApplication::currentUser() {
|
QString SingleApplication::currentUser() const {
|
||||||
Q_D(SingleApplication);
|
return SingleApplicationPrivate::getUsername();
|
||||||
return d->getUsername();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -248,11 +247,7 @@ bool SingleApplication::sendMessage(const QByteArray &message, const int timeout
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->socket_->write(message);
|
return d->writeConfirmedMessage(timeout, message);
|
||||||
const bool dataWritten = d->socket_->waitForBytesWritten(timeout);
|
|
||||||
d->socket_->flush();
|
|
||||||
return dataWritten;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -265,6 +260,7 @@ void SingleApplication::abortSafely() {
|
|||||||
|
|
||||||
qCritical() << "SingleApplication: " << d->memory_->error() << d->memory_->errorString();
|
qCritical() << "SingleApplication: " << d->memory_->error() << d->memory_->errorString();
|
||||||
delete d;
|
delete d;
|
||||||
|
|
||||||
::exit(EXIT_FAILURE);
|
::exit(EXIT_FAILURE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
17
3rdparty/singleapplication/singleapplication.h
vendored
@@ -48,7 +48,7 @@ class SingleApplicationPrivate;
|
|||||||
class SingleApplication : public QApplication { // clazy:exclude=ctor-missing-parent-argument
|
class SingleApplication : public QApplication { // clazy:exclude=ctor-missing-parent-argument
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
typedef QApplication app_t;
|
using app_t = QApplication;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@@ -88,46 +88,45 @@ class SingleApplication : public QApplication { // clazy:exclude=ctor-missing-p
|
|||||||
* operations. It does not guarantee that the SingleApplication
|
* operations. It does not guarantee that the SingleApplication
|
||||||
* initialisation will be completed in given time, though is a good hint.
|
* initialisation will be completed in given time, though is a good hint.
|
||||||
* Usually 4*timeout would be the worst case (fail) scenario.
|
* Usually 4*timeout would be the worst case (fail) scenario.
|
||||||
* @see See the corresponding QAPPLICATION_CLASS constructor for reference
|
|
||||||
*/
|
*/
|
||||||
explicit SingleApplication(int &argc, char *argv[], bool allowSecondary = false, Options options = Mode::User, int timeout = 1000);
|
explicit SingleApplication(int &argc, char *argv[], const bool allowSecondary = false, const Options options = Mode::User, const int timeout = 1000);
|
||||||
~SingleApplication() override;
|
~SingleApplication() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns if the instance is the primary instance
|
* @brief Returns if the instance is the primary instance
|
||||||
* @returns {bool}
|
* @returns {bool}
|
||||||
*/
|
*/
|
||||||
bool isPrimary();
|
bool isPrimary() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns if the instance is a secondary instance
|
* @brief Returns if the instance is a secondary instance
|
||||||
* @returns {bool}
|
* @returns {bool}
|
||||||
*/
|
*/
|
||||||
bool isSecondary();
|
bool isSecondary() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns a unique identifier for the current instance
|
* @brief Returns a unique identifier for the current instance
|
||||||
* @returns {qint32}
|
* @returns {qint32}
|
||||||
*/
|
*/
|
||||||
quint32 instanceId();
|
quint32 instanceId() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the process ID (PID) of the primary instance
|
* @brief Returns the process ID (PID) of the primary instance
|
||||||
* @returns {qint64}
|
* @returns {qint64}
|
||||||
*/
|
*/
|
||||||
qint64 primaryPid();
|
qint64 primaryPid() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the username of the user running the primary instance
|
* @brief Returns the username of the user running the primary instance
|
||||||
* @returns {QString}
|
* @returns {QString}
|
||||||
*/
|
*/
|
||||||
QString primaryUser();
|
QString primaryUser() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the username of the current user
|
* @brief Returns the username of the current user
|
||||||
* @returns {QString}
|
* @returns {QString}
|
||||||
*/
|
*/
|
||||||
QString currentUser();
|
QString currentUser() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sends a message to the primary instance. Returns true on success.
|
* @brief Sends a message to the primary instance. Returns true on success.
|
||||||
|
|||||||
191
3rdparty/singleapplication/singleapplication_p.cpp
vendored
@@ -44,6 +44,14 @@
|
|||||||
# include <pwd.h>
|
# include <pwd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
# ifndef NOMINMAX
|
||||||
|
# define NOMINMAX 1
|
||||||
|
# endif
|
||||||
|
# include <windows.h>
|
||||||
|
# include <lmcons.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QIODevice>
|
#include <QIODevice>
|
||||||
@@ -53,7 +61,6 @@
|
|||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QLocalServer>
|
#include <QLocalServer>
|
||||||
#include <QLocalSocket>
|
#include <QLocalSocket>
|
||||||
#include <QDir>
|
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||||
# include <QRandomGenerator>
|
# include <QRandomGenerator>
|
||||||
@@ -64,11 +71,6 @@
|
|||||||
#include "singleapplication.h"
|
#include "singleapplication.h"
|
||||||
#include "singleapplication_p.h"
|
#include "singleapplication_p.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
# include <windows.h>
|
|
||||||
# include <lmcons.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SingleApplicationPrivate::SingleApplicationPrivate(SingleApplication *ptr)
|
SingleApplicationPrivate::SingleApplicationPrivate(SingleApplication *ptr)
|
||||||
: q_ptr(ptr),
|
: q_ptr(ptr),
|
||||||
memory_(nullptr),
|
memory_(nullptr),
|
||||||
@@ -86,14 +88,14 @@ SingleApplicationPrivate::~SingleApplicationPrivate() {
|
|||||||
|
|
||||||
if (memory_ != nullptr) {
|
if (memory_ != nullptr) {
|
||||||
memory_->lock();
|
memory_->lock();
|
||||||
InstancesInfo *inst = static_cast<InstancesInfo*>(memory_->data());
|
InstancesInfo *instance = static_cast<InstancesInfo*>(memory_->data());
|
||||||
if (server_ != nullptr) {
|
if (server_ != nullptr) {
|
||||||
server_->close();
|
server_->close();
|
||||||
delete server_;
|
delete server_;
|
||||||
inst->primary = false;
|
instance->primary = false;
|
||||||
inst->primaryPid = -1;
|
instance->primaryPid = -1;
|
||||||
inst->primaryUser[0] = '\0';
|
instance->primaryUser[0] = '\0';
|
||||||
inst->checksum = blockChecksum();
|
instance->checksum = blockChecksum();
|
||||||
}
|
}
|
||||||
memory_->unlock();
|
memory_->unlock();
|
||||||
|
|
||||||
@@ -142,7 +144,7 @@ QString SingleApplicationPrivate::getUsername() {
|
|||||||
void SingleApplicationPrivate::genBlockServerName() {
|
void SingleApplicationPrivate::genBlockServerName() {
|
||||||
|
|
||||||
QCryptographicHash appData(QCryptographicHash::Sha256);
|
QCryptographicHash appData(QCryptographicHash::Sha256);
|
||||||
appData.addData("SingleApplication", 17);
|
appData.addData("SingleApplication");
|
||||||
appData.addData(SingleApplication::app_t::applicationName().toUtf8());
|
appData.addData(SingleApplication::app_t::applicationName().toUtf8());
|
||||||
appData.addData(SingleApplication::app_t::organizationName().toUtf8());
|
appData.addData(SingleApplication::app_t::organizationName().toUtf8());
|
||||||
appData.addData(SingleApplication::app_t::organizationDomain().toUtf8());
|
appData.addData(SingleApplication::app_t::organizationDomain().toUtf8());
|
||||||
@@ -152,7 +154,15 @@ void SingleApplicationPrivate::genBlockServerName() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(options_ & SingleApplication::Mode::ExcludeAppPath)) {
|
if (!(options_ & SingleApplication::Mode::ExcludeAppPath)) {
|
||||||
#ifdef Q_OS_WIN
|
#if defined(Q_OS_UNIX)
|
||||||
|
const QByteArray appImagePath = qgetenv("APPIMAGE");
|
||||||
|
if (appImagePath.isEmpty()) {
|
||||||
|
appData.addData(SingleApplication::app_t::applicationFilePath().toUtf8());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
appData.addData(appImagePath);
|
||||||
|
};
|
||||||
|
#elif defined(Q_OS_WIN)
|
||||||
appData.addData(SingleApplication::app_t::applicationFilePath().toLower().toUtf8());
|
appData.addData(SingleApplication::app_t::applicationFilePath().toLower().toUtf8());
|
||||||
#else
|
#else
|
||||||
appData.addData(SingleApplication::app_t::applicationFilePath().toUtf8());
|
appData.addData(SingleApplication::app_t::applicationFilePath().toUtf8());
|
||||||
@@ -171,26 +181,24 @@ void SingleApplicationPrivate::genBlockServerName() {
|
|||||||
|
|
||||||
void SingleApplicationPrivate::initializeMemoryBlock() const {
|
void SingleApplicationPrivate::initializeMemoryBlock() const {
|
||||||
|
|
||||||
InstancesInfo *inst = static_cast<InstancesInfo*>(memory_->data());
|
InstancesInfo *instance = static_cast<InstancesInfo*>(memory_->data());
|
||||||
inst->primary = false;
|
instance->primary = false;
|
||||||
inst->secondary = 0;
|
instance->secondary = 0;
|
||||||
inst->primaryPid = -1;
|
instance->primaryPid = -1;
|
||||||
inst->primaryUser[0] = '\0';
|
instance->primaryUser[0] = '\0';
|
||||||
inst->checksum = blockChecksum();
|
instance->checksum = blockChecksum();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleApplicationPrivate::startPrimary() {
|
void SingleApplicationPrivate::startPrimary() {
|
||||||
|
|
||||||
Q_Q(SingleApplication);
|
|
||||||
|
|
||||||
// Reset the number of connections
|
// Reset the number of connections
|
||||||
InstancesInfo *inst = static_cast<InstancesInfo*>(memory_->data());
|
InstancesInfo *instance = static_cast<InstancesInfo*>(memory_->data());
|
||||||
|
|
||||||
inst->primary = true;
|
instance->primary = true;
|
||||||
inst->primaryPid = q->applicationPid();
|
instance->primaryPid = QCoreApplication::applicationPid();
|
||||||
qstrncpy(inst->primaryUser, getUsername().toUtf8().data(), sizeof(inst->primaryUser));
|
qstrncpy(instance->primaryUser, getUsername().toUtf8().data(), sizeof(instance->primaryUser));
|
||||||
inst->checksum = blockChecksum();
|
instance->checksum = blockChecksum();
|
||||||
instanceNumber_ = 0;
|
instanceNumber_ = 0;
|
||||||
// Successful creation means that no main process exists
|
// Successful creation means that no main process exists
|
||||||
// So we start a QLocalServer to listen for connections
|
// So we start a QLocalServer to listen for connections
|
||||||
@@ -212,11 +220,11 @@ void SingleApplicationPrivate::startPrimary() {
|
|||||||
|
|
||||||
void SingleApplicationPrivate::startSecondary() {
|
void SingleApplicationPrivate::startSecondary() {
|
||||||
|
|
||||||
InstancesInfo *inst = static_cast<InstancesInfo*>(memory_->data());
|
InstancesInfo *instance = static_cast<InstancesInfo*>(memory_->data());
|
||||||
|
|
||||||
inst->secondary += 1;
|
instance->secondary += 1;
|
||||||
inst->checksum = blockChecksum();
|
instance->checksum = blockChecksum();
|
||||||
instanceNumber_ = inst->secondary;
|
instanceNumber_ = instance->secondary;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,25 +271,53 @@ bool SingleApplicationPrivate::connectToPrimary(const int timeout, const Connect
|
|||||||
writeStream << instanceNumber_;
|
writeStream << instanceNumber_;
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
quint16 checksum = qChecksum(QByteArray(initMsg, static_cast<quint32>(initMsg.length())));
|
quint16 checksum = qChecksum(QByteArray(initMsg, static_cast<quint32>(initMsg.length())));
|
||||||
#else
|
#else
|
||||||
quint16 checksum = qChecksum(initMsg.constData(), static_cast<quint32>(initMsg.length()));
|
quint16 checksum = qChecksum(initMsg.constData(), static_cast<quint32>(initMsg.length()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
writeStream << checksum;
|
writeStream << checksum;
|
||||||
|
|
||||||
// The header indicates the message length that follows
|
return writeConfirmedMessage(static_cast<int>(timeout - time.elapsed()), initMsg);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SingleApplicationPrivate::writeAck(QLocalSocket *sock) {
|
||||||
|
sock->putChar('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SingleApplicationPrivate::writeConfirmedMessage(const int timeout, const QByteArray &msg) const {
|
||||||
|
|
||||||
|
QElapsedTimer time;
|
||||||
|
time.start();
|
||||||
|
|
||||||
|
// Frame 1: The header indicates the message length that follows
|
||||||
QByteArray header;
|
QByteArray header;
|
||||||
QDataStream headerStream(&header, QIODevice::WriteOnly);
|
QDataStream headerStream(&header, QIODevice::WriteOnly);
|
||||||
headerStream.setVersion(QDataStream::Qt_5_8);
|
headerStream.setVersion(QDataStream::Qt_5_8);
|
||||||
headerStream << static_cast<quint64>(initMsg.length());
|
headerStream << static_cast<quint64>(msg.length());
|
||||||
|
|
||||||
socket_->write(header);
|
if (!writeConfirmedFrame(static_cast<int>(timeout - time.elapsed()), header)) {
|
||||||
socket_->write(initMsg);
|
return false;
|
||||||
bool result = socket_->waitForBytesWritten(static_cast<int>(timeout - time.elapsed()));
|
}
|
||||||
|
|
||||||
|
// Frame 2: The message
|
||||||
|
return writeConfirmedFrame(static_cast<int>(timeout - time.elapsed()), msg);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SingleApplicationPrivate::writeConfirmedFrame(const int timeout, const QByteArray &msg) const {
|
||||||
|
|
||||||
|
socket_->write(msg);
|
||||||
socket_->flush();
|
socket_->flush();
|
||||||
|
|
||||||
return result;
|
bool result = socket_->waitForReadyRead(timeout);
|
||||||
|
if (result) {
|
||||||
|
socket_->read(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,8 +336,8 @@ quint16 SingleApplicationPrivate::blockChecksum() const {
|
|||||||
qint64 SingleApplicationPrivate::primaryPid() const {
|
qint64 SingleApplicationPrivate::primaryPid() const {
|
||||||
|
|
||||||
memory_->lock();
|
memory_->lock();
|
||||||
InstancesInfo *inst = static_cast<InstancesInfo*>(memory_->data());
|
InstancesInfo *instance = static_cast<InstancesInfo*>(memory_->data());
|
||||||
qint64 pid = inst->primaryPid;
|
qint64 pid = instance->primaryPid;
|
||||||
memory_->unlock();
|
memory_->unlock();
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
@@ -311,8 +347,8 @@ qint64 SingleApplicationPrivate::primaryPid() const {
|
|||||||
QString SingleApplicationPrivate::primaryUser() const {
|
QString SingleApplicationPrivate::primaryUser() const {
|
||||||
|
|
||||||
memory_->lock();
|
memory_->lock();
|
||||||
InstancesInfo *inst = static_cast<InstancesInfo*>(memory_->data());
|
InstancesInfo *instance = static_cast<InstancesInfo*>(memory_->data());
|
||||||
QByteArray username = inst->primaryUser;
|
QByteArray username = instance->primaryUser;
|
||||||
memory_->unlock();
|
memory_->unlock();
|
||||||
|
|
||||||
return QString::fromUtf8(username);
|
return QString::fromUtf8(username);
|
||||||
@@ -328,26 +364,30 @@ void SingleApplicationPrivate::slotConnectionEstablished() {
|
|||||||
connectionMap_.insert(nextConnSocket, ConnectionInfo());
|
connectionMap_.insert(nextConnSocket, ConnectionInfo());
|
||||||
|
|
||||||
QObject::connect(nextConnSocket, &QLocalSocket::aboutToClose, this, [nextConnSocket, this]() {
|
QObject::connect(nextConnSocket, &QLocalSocket::aboutToClose, this, [nextConnSocket, this]() {
|
||||||
const ConnectionInfo info = connectionMap_[nextConnSocket];
|
const ConnectionInfo &info = connectionMap_[nextConnSocket];
|
||||||
slotClientConnectionClosed(nextConnSocket, info.instanceId);
|
slotClientConnectionClosed(nextConnSocket, info.instanceId);
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(nextConnSocket, &QLocalSocket::disconnected, this, [nextConnSocket, this]() {
|
QObject::connect(nextConnSocket, &QLocalSocket::disconnected, nextConnSocket, &QLocalSocket::deleteLater);
|
||||||
|
|
||||||
|
QObject::connect(nextConnSocket, &QLocalSocket::destroyed, this, [nextConnSocket, this]() {
|
||||||
connectionMap_.remove(nextConnSocket);
|
connectionMap_.remove(nextConnSocket);
|
||||||
nextConnSocket->deleteLater();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(nextConnSocket, &QLocalSocket::readyRead, this, [nextConnSocket, this]() {
|
QObject::connect(nextConnSocket, &QLocalSocket::readyRead, this, [nextConnSocket, this]() {
|
||||||
const ConnectionInfo info = connectionMap_[nextConnSocket];
|
const ConnectionInfo &info = connectionMap_[nextConnSocket];
|
||||||
switch (info.stage) {
|
switch (info.stage) {
|
||||||
case StageHeader:
|
case StageInitHeader:
|
||||||
readInitMessageHeader(nextConnSocket);
|
readMessageHeader(nextConnSocket, StageInitBody);
|
||||||
break;
|
break;
|
||||||
case StageBody:
|
case StageInitBody:
|
||||||
readInitMessageBody(nextConnSocket);
|
readInitMessageBody(nextConnSocket);
|
||||||
break;
|
break;
|
||||||
case StageConnected:
|
case StageConnectedHeader:
|
||||||
slotDataAvailable(nextConnSocket, info.instanceId);
|
readMessageHeader(nextConnSocket, StageConnectedBody);
|
||||||
|
break;
|
||||||
|
case StageConnectedBody:
|
||||||
|
this->slotDataAvailable(nextConnSocket, info.instanceId);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -356,7 +396,7 @@ void SingleApplicationPrivate::slotConnectionEstablished() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleApplicationPrivate::readInitMessageHeader(QLocalSocket *sock) {
|
void SingleApplicationPrivate::readMessageHeader(QLocalSocket *sock, const SingleApplicationPrivate::ConnectionStage nextStage) {
|
||||||
|
|
||||||
if (!connectionMap_.contains(sock)) {
|
if (!connectionMap_.contains(sock)) {
|
||||||
return;
|
return;
|
||||||
@@ -373,30 +413,34 @@ void SingleApplicationPrivate::readInitMessageHeader(QLocalSocket *sock) {
|
|||||||
quint64 msgLen = 0;
|
quint64 msgLen = 0;
|
||||||
headerStream >> msgLen;
|
headerStream >> msgLen;
|
||||||
ConnectionInfo &info = connectionMap_[sock];
|
ConnectionInfo &info = connectionMap_[sock];
|
||||||
info.stage = StageBody;
|
info.stage = nextStage;
|
||||||
info.msgLen = msgLen;
|
info.msgLen = msgLen;
|
||||||
|
|
||||||
if (sock->bytesAvailable() >= static_cast<qint64>(msgLen)) {
|
writeAck(sock);
|
||||||
readInitMessageBody(sock);
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SingleApplicationPrivate::isFrameComplete(QLocalSocket *sock) {
|
||||||
|
|
||||||
|
if (!connectionMap_.contains(sock)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ConnectionInfo &info = connectionMap_[sock];
|
||||||
|
return (sock->bytesAvailable() >= static_cast<qint64>(info.msgLen));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleApplicationPrivate::readInitMessageBody(QLocalSocket *sock) {
|
void SingleApplicationPrivate::readInitMessageBody(QLocalSocket *sock) {
|
||||||
|
|
||||||
Q_Q(SingleApplication);
|
Q_Q(SingleApplication);
|
||||||
|
|
||||||
if (!connectionMap_.contains(sock)) {
|
if (!isFrameComplete(sock)) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConnectionInfo &info = connectionMap_[sock];
|
|
||||||
if (sock->bytesAvailable() < static_cast<qint64>(info.msgLen)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the message body
|
// Read the message body
|
||||||
QByteArray msgBytes = sock->read(info.msgLen);
|
QByteArray msgBytes = sock->readAll();
|
||||||
QDataStream readStream(msgBytes);
|
QDataStream readStream(msgBytes);
|
||||||
readStream.setVersion(QDataStream::Qt_5_8);
|
readStream.setVersion(QDataStream::Qt_5_8);
|
||||||
|
|
||||||
@@ -431,23 +475,34 @@ void SingleApplicationPrivate::readInitMessageBody(QLocalSocket *sock) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConnectionInfo &info = connectionMap_[sock];
|
||||||
info.instanceId = instanceId;
|
info.instanceId = instanceId;
|
||||||
info.stage = StageConnected;
|
info.stage = StageConnectedHeader;
|
||||||
|
|
||||||
if (connectionType == NewInstance || (connectionType == SecondaryInstance && options_ & SingleApplication::Mode::SecondaryNotification)) {
|
if (connectionType == NewInstance || (connectionType == SecondaryInstance && options_ & SingleApplication::Mode::SecondaryNotification)) {
|
||||||
Q_EMIT q->instanceStarted();
|
emit q->instanceStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sock->bytesAvailable() > 0) {
|
writeAck(sock);
|
||||||
slotDataAvailable(sock, instanceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleApplicationPrivate::slotDataAvailable(QLocalSocket *dataSocket, const quint32 instanceId) {
|
void SingleApplicationPrivate::slotDataAvailable(QLocalSocket *dataSocket, const quint32 instanceId) {
|
||||||
|
|
||||||
Q_Q(SingleApplication);
|
Q_Q(SingleApplication);
|
||||||
Q_EMIT q->receivedMessage(instanceId, dataSocket->readAll());
|
|
||||||
|
if (!isFrameComplete(dataSocket)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QByteArray message = dataSocket->readAll();
|
||||||
|
|
||||||
|
writeAck(dataSocket);
|
||||||
|
|
||||||
|
ConnectionInfo &info = connectionMap_[dataSocket];
|
||||||
|
info.stage = StageConnectedHeader;
|
||||||
|
|
||||||
|
emit q->receivedMessage(instanceId, message);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,7 +520,7 @@ void SingleApplicationPrivate::randomSleep() {
|
|||||||
QThread::msleep(QRandomGenerator::global()->bounded(8U, 18U));
|
QThread::msleep(QRandomGenerator::global()->bounded(8U, 18U));
|
||||||
#else
|
#else
|
||||||
qsrand(QDateTime::currentMSecsSinceEpoch() % std::numeric_limits<uint>::max());
|
qsrand(QDateTime::currentMSecsSinceEpoch() % std::numeric_limits<uint>::max());
|
||||||
QThread::msleep(8 + static_cast<unsigned long>(static_cast<float>(qrand()) / RAND_MAX * 10));
|
QThread::msleep(qrand() % 11 + 8);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
13
3rdparty/singleapplication/singleapplication_p.h
vendored
@@ -71,9 +71,10 @@ class SingleApplicationPrivate : public QObject {
|
|||||||
Reconnect = 3
|
Reconnect = 3
|
||||||
};
|
};
|
||||||
enum ConnectionStage : quint8 {
|
enum ConnectionStage : quint8 {
|
||||||
StageHeader = 0,
|
StageInitHeader = 0,
|
||||||
StageBody = 1,
|
StageInitBody = 1,
|
||||||
StageConnected = 2,
|
StageConnectedHeader = 2,
|
||||||
|
StageConnectedBody = 3,
|
||||||
};
|
};
|
||||||
Q_DECLARE_PUBLIC(SingleApplication)
|
Q_DECLARE_PUBLIC(SingleApplication)
|
||||||
|
|
||||||
@@ -89,8 +90,12 @@ class SingleApplicationPrivate : public QObject {
|
|||||||
quint16 blockChecksum() const;
|
quint16 blockChecksum() const;
|
||||||
qint64 primaryPid() const;
|
qint64 primaryPid() const;
|
||||||
QString primaryUser() const;
|
QString primaryUser() const;
|
||||||
void readInitMessageHeader(QLocalSocket *socket);
|
bool isFrameComplete(QLocalSocket *sock);
|
||||||
|
void readMessageHeader(QLocalSocket *socket, const ConnectionStage nextStage);
|
||||||
void readInitMessageBody(QLocalSocket *socket);
|
void readInitMessageBody(QLocalSocket *socket);
|
||||||
|
void writeAck(QLocalSocket *sock);
|
||||||
|
bool writeConfirmedFrame(const int timeout, const QByteArray &msg) const;
|
||||||
|
bool writeConfirmedMessage(const int timeout, const QByteArray &msg) const;
|
||||||
static void randomSleep();
|
static void randomSleep();
|
||||||
|
|
||||||
SingleApplication *q_ptr;
|
SingleApplication *q_ptr;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
* @param options Optional flags to toggle specific behaviour
|
* @param options Optional flags to toggle specific behaviour
|
||||||
* @param timeout Maximum time blocking functions are allowed during app load
|
* @param timeout Maximum time blocking functions are allowed during app load
|
||||||
*/
|
*/
|
||||||
SingleCoreApplication::SingleCoreApplication(int &argc, char *argv[], bool allowSecondary, Options options, int timeout)
|
SingleCoreApplication::SingleCoreApplication(int &argc, char *argv[], const bool allowSecondary, const Options options, const int timeout)
|
||||||
: app_t(argc, argv),
|
: app_t(argc, argv),
|
||||||
d_ptr(new SingleCoreApplicationPrivate(this)) {
|
d_ptr(new SingleCoreApplicationPrivate(this)) {
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ SingleCoreApplication::SingleCoreApplication(int &argc, char *argv[], bool allow
|
|||||||
d->genBlockServerName();
|
d->genBlockServerName();
|
||||||
|
|
||||||
// To mitigate QSharedMemory issues with large amount of processes attempting to attach at the same time
|
// To mitigate QSharedMemory issues with large amount of processes attempting to attach at the same time
|
||||||
d->randomSleep();
|
SingleCoreApplicationPrivate::randomSleep();
|
||||||
|
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
// By explicitly attaching it and then deleting it we make sure that the memory is deleted even after the process has crashed on Unix.
|
// By explicitly attaching it and then deleting it we make sure that the memory is deleted even after the process has crashed on Unix.
|
||||||
@@ -106,14 +106,14 @@ SingleCoreApplication::SingleCoreApplication(int &argc, char *argv[], bool allow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InstancesInfo *inst = static_cast<InstancesInfo*>(d->memory_->data());
|
InstancesInfo *instance = static_cast<InstancesInfo*>(d->memory_->data());
|
||||||
QElapsedTimer time;
|
QElapsedTimer time;
|
||||||
time.start();
|
time.start();
|
||||||
|
|
||||||
// Make sure the shared memory block is initialised and in consistent state
|
// Make sure the shared memory block is initialised and in consistent state
|
||||||
forever {
|
forever {
|
||||||
// If the shared memory block's checksum is valid continue
|
// If the shared memory block's checksum is valid continue
|
||||||
if (d->blockChecksum() == inst->checksum) break;
|
if (d->blockChecksum() == instance->checksum) break;
|
||||||
|
|
||||||
// If more than 5s have elapsed, assume the primary instance crashed and assume it's position
|
// If more than 5s have elapsed, assume the primary instance crashed and assume it's position
|
||||||
if (time.elapsed() > 5000) {
|
if (time.elapsed() > 5000) {
|
||||||
@@ -127,14 +127,14 @@ SingleCoreApplication::SingleCoreApplication(int &argc, char *argv[], bool allow
|
|||||||
qDebug() << "SingleCoreApplication: Unable to unlock memory for random wait.";
|
qDebug() << "SingleCoreApplication: Unable to unlock memory for random wait.";
|
||||||
qDebug() << d->memory_->errorString();
|
qDebug() << d->memory_->errorString();
|
||||||
}
|
}
|
||||||
d->randomSleep();
|
SingleCoreApplicationPrivate::randomSleep();
|
||||||
if (!d->memory_->lock()) {
|
if (!d->memory_->lock()) {
|
||||||
qCritical() << "SingleCoreApplication: Unable to lock memory after random wait.";
|
qCritical() << "SingleCoreApplication: Unable to lock memory after random wait.";
|
||||||
abortSafely();
|
abortSafely();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!inst->primary) {
|
if (!instance->primary) {
|
||||||
d->startPrimary();
|
d->startPrimary();
|
||||||
if (!d->memory_->unlock()) {
|
if (!d->memory_->unlock()) {
|
||||||
qDebug() << "SingleCoreApplication: Unable to unlock memory after primary start.";
|
qDebug() << "SingleCoreApplication: Unable to unlock memory after primary start.";
|
||||||
@@ -178,8 +178,8 @@ SingleCoreApplication::~SingleCoreApplication() {
|
|||||||
* Checks if the current application instance is primary.
|
* Checks if the current application instance is primary.
|
||||||
* @return Returns true if the instance is primary, false otherwise.
|
* @return Returns true if the instance is primary, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool SingleCoreApplication::isPrimary() {
|
bool SingleCoreApplication::isPrimary() const {
|
||||||
Q_D(SingleCoreApplication);
|
Q_D(const SingleCoreApplication);
|
||||||
return d->server_ != nullptr;
|
return d->server_ != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,8 +187,8 @@ bool SingleCoreApplication::isPrimary() {
|
|||||||
* Checks if the current application instance is secondary.
|
* Checks if the current application instance is secondary.
|
||||||
* @return Returns true if the instance is secondary, false otherwise.
|
* @return Returns true if the instance is secondary, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool SingleCoreApplication::isSecondary() {
|
bool SingleCoreApplication::isSecondary() const {
|
||||||
Q_D(SingleCoreApplication);
|
Q_D(const SingleCoreApplication);
|
||||||
return d->server_ == nullptr;
|
return d->server_ == nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -197,8 +197,8 @@ bool SingleCoreApplication::isSecondary() {
|
|||||||
* It is reset when the first (primary) instance of your app starts and only incremented afterwards.
|
* It is reset when the first (primary) instance of your app starts and only incremented afterwards.
|
||||||
* @return Returns a unique instance id.
|
* @return Returns a unique instance id.
|
||||||
*/
|
*/
|
||||||
quint32 SingleCoreApplication::instanceId() {
|
quint32 SingleCoreApplication::instanceId() const {
|
||||||
Q_D(SingleCoreApplication);
|
Q_D(const SingleCoreApplication);
|
||||||
return d->instanceNumber_;
|
return d->instanceNumber_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,8 +207,8 @@ quint32 SingleCoreApplication::instanceId() {
|
|||||||
* Especially useful when SingleCoreApplication is coupled with OS. specific APIs.
|
* Especially useful when SingleCoreApplication is coupled with OS. specific APIs.
|
||||||
* @return Returns the primary instance PID.
|
* @return Returns the primary instance PID.
|
||||||
*/
|
*/
|
||||||
qint64 SingleCoreApplication::primaryPid() {
|
qint64 SingleCoreApplication::primaryPid() const {
|
||||||
Q_D(SingleCoreApplication);
|
Q_D(const SingleCoreApplication);
|
||||||
return d->primaryPid();
|
return d->primaryPid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,8 +216,8 @@ qint64 SingleCoreApplication::primaryPid() {
|
|||||||
* Returns the username the primary instance is running as.
|
* Returns the username the primary instance is running as.
|
||||||
* @return Returns the username the primary instance is running as.
|
* @return Returns the username the primary instance is running as.
|
||||||
*/
|
*/
|
||||||
QString SingleCoreApplication::primaryUser() {
|
QString SingleCoreApplication::primaryUser() const {
|
||||||
Q_D(SingleCoreApplication);
|
Q_D(const SingleCoreApplication);
|
||||||
return d->primaryUser();
|
return d->primaryUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,9 +225,8 @@ QString SingleCoreApplication::primaryUser() {
|
|||||||
* Returns the username the current instance is running as.
|
* Returns the username the current instance is running as.
|
||||||
* @return Returns the username the current instance is running as.
|
* @return Returns the username the current instance is running as.
|
||||||
*/
|
*/
|
||||||
QString SingleCoreApplication::currentUser() {
|
QString SingleCoreApplication::currentUser() const {
|
||||||
Q_D(SingleCoreApplication);
|
return SingleCoreApplicationPrivate::getUsername();
|
||||||
return d->getUsername();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -248,11 +247,7 @@ bool SingleCoreApplication::sendMessage(const QByteArray &message, const int tim
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->socket_->write(message);
|
return d->writeConfirmedMessage(timeout, message);
|
||||||
const bool dataWritten = d->socket_->waitForBytesWritten(timeout);
|
|
||||||
d->socket_->flush();
|
|
||||||
return dataWritten;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -265,6 +260,7 @@ void SingleCoreApplication::abortSafely() {
|
|||||||
|
|
||||||
qCritical() << "SingleCoreApplication: " << d->memory_->error() << d->memory_->errorString();
|
qCritical() << "SingleCoreApplication: " << d->memory_->error() << d->memory_->errorString();
|
||||||
delete d;
|
delete d;
|
||||||
|
|
||||||
::exit(EXIT_FAILURE);
|
::exit(EXIT_FAILURE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ class SingleCoreApplicationPrivate;
|
|||||||
* @brief The SingleCoreApplication class handles multiple instances of the same Application
|
* @brief The SingleCoreApplication class handles multiple instances of the same Application
|
||||||
* @see QCoreApplication
|
* @see QCoreApplication
|
||||||
*/
|
*/
|
||||||
class SingleCoreApplication : public QCoreApplication {
|
class SingleCoreApplication : public QCoreApplication { // clazy:exclude=ctor-missing-parent-argument
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
typedef QCoreApplication app_t;
|
using app_t = QCoreApplication;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@@ -96,37 +96,37 @@ class SingleCoreApplication : public QCoreApplication {
|
|||||||
* @brief Returns if the instance is the primary instance
|
* @brief Returns if the instance is the primary instance
|
||||||
* @returns {bool}
|
* @returns {bool}
|
||||||
*/
|
*/
|
||||||
bool isPrimary();
|
bool isPrimary() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns if the instance is a secondary instance
|
* @brief Returns if the instance is a secondary instance
|
||||||
* @returns {bool}
|
* @returns {bool}
|
||||||
*/
|
*/
|
||||||
bool isSecondary();
|
bool isSecondary() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns a unique identifier for the current instance
|
* @brief Returns a unique identifier for the current instance
|
||||||
* @returns {qint32}
|
* @returns {qint32}
|
||||||
*/
|
*/
|
||||||
quint32 instanceId();
|
quint32 instanceId() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the process ID (PID) of the primary instance
|
* @brief Returns the process ID (PID) of the primary instance
|
||||||
* @returns {qint64}
|
* @returns {qint64}
|
||||||
*/
|
*/
|
||||||
qint64 primaryPid();
|
qint64 primaryPid() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the username of the user running the primary instance
|
* @brief Returns the username of the user running the primary instance
|
||||||
* @returns {QString}
|
* @returns {QString}
|
||||||
*/
|
*/
|
||||||
QString primaryUser();
|
QString primaryUser() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the username of the current user
|
* @brief Returns the username of the current user
|
||||||
* @returns {QString}
|
* @returns {QString}
|
||||||
*/
|
*/
|
||||||
QString currentUser();
|
QString currentUser() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sends a message to the primary instance. Returns true on success.
|
* @brief Sends a message to the primary instance. Returns true on success.
|
||||||
|
|||||||
@@ -44,6 +44,14 @@
|
|||||||
# include <pwd.h>
|
# include <pwd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
# ifndef NOMINMAX
|
||||||
|
# define NOMINMAX 1
|
||||||
|
# endif
|
||||||
|
# include <windows.h>
|
||||||
|
# include <lmcons.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QIODevice>
|
#include <QIODevice>
|
||||||
@@ -53,7 +61,6 @@
|
|||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
#include <QLocalServer>
|
#include <QLocalServer>
|
||||||
#include <QLocalSocket>
|
#include <QLocalSocket>
|
||||||
#include <QDir>
|
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||||
# include <QRandomGenerator>
|
# include <QRandomGenerator>
|
||||||
@@ -64,11 +71,6 @@
|
|||||||
#include "singlecoreapplication.h"
|
#include "singlecoreapplication.h"
|
||||||
#include "singlecoreapplication_p.h"
|
#include "singlecoreapplication_p.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
# include <windows.h>
|
|
||||||
# include <lmcons.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SingleCoreApplicationPrivate::SingleCoreApplicationPrivate(SingleCoreApplication *ptr)
|
SingleCoreApplicationPrivate::SingleCoreApplicationPrivate(SingleCoreApplication *ptr)
|
||||||
: q_ptr(ptr),
|
: q_ptr(ptr),
|
||||||
memory_(nullptr),
|
memory_(nullptr),
|
||||||
@@ -86,14 +88,14 @@ SingleCoreApplicationPrivate::~SingleCoreApplicationPrivate() {
|
|||||||
|
|
||||||
if (memory_ != nullptr) {
|
if (memory_ != nullptr) {
|
||||||
memory_->lock();
|
memory_->lock();
|
||||||
InstancesInfo *inst = static_cast<InstancesInfo*>(memory_->data());
|
InstancesInfo *instance = static_cast<InstancesInfo*>(memory_->data());
|
||||||
if (server_ != nullptr) {
|
if (server_ != nullptr) {
|
||||||
server_->close();
|
server_->close();
|
||||||
delete server_;
|
delete server_;
|
||||||
inst->primary = false;
|
instance->primary = false;
|
||||||
inst->primaryPid = -1;
|
instance->primaryPid = -1;
|
||||||
inst->primaryUser[0] = '\0';
|
instance->primaryUser[0] = '\0';
|
||||||
inst->checksum = blockChecksum();
|
instance->checksum = blockChecksum();
|
||||||
}
|
}
|
||||||
memory_->unlock();
|
memory_->unlock();
|
||||||
|
|
||||||
@@ -142,7 +144,7 @@ QString SingleCoreApplicationPrivate::getUsername() {
|
|||||||
void SingleCoreApplicationPrivate::genBlockServerName() {
|
void SingleCoreApplicationPrivate::genBlockServerName() {
|
||||||
|
|
||||||
QCryptographicHash appData(QCryptographicHash::Sha256);
|
QCryptographicHash appData(QCryptographicHash::Sha256);
|
||||||
appData.addData("SingleApplication", 17);
|
appData.addData("SingleApplication");
|
||||||
appData.addData(SingleCoreApplication::app_t::applicationName().toUtf8());
|
appData.addData(SingleCoreApplication::app_t::applicationName().toUtf8());
|
||||||
appData.addData(SingleCoreApplication::app_t::organizationName().toUtf8());
|
appData.addData(SingleCoreApplication::app_t::organizationName().toUtf8());
|
||||||
appData.addData(SingleCoreApplication::app_t::organizationDomain().toUtf8());
|
appData.addData(SingleCoreApplication::app_t::organizationDomain().toUtf8());
|
||||||
@@ -152,7 +154,15 @@ void SingleCoreApplicationPrivate::genBlockServerName() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(options_ & SingleCoreApplication::Mode::ExcludeAppPath)) {
|
if (!(options_ & SingleCoreApplication::Mode::ExcludeAppPath)) {
|
||||||
#ifdef Q_OS_WIN
|
#if defined(Q_OS_UNIX)
|
||||||
|
const QByteArray appImagePath = qgetenv("APPIMAGE");
|
||||||
|
if (appImagePath.isEmpty()) {
|
||||||
|
appData.addData(SingleCoreApplication::app_t::applicationFilePath().toUtf8());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
appData.addData(appImagePath);
|
||||||
|
};
|
||||||
|
#elif defined(Q_OS_WIN)
|
||||||
appData.addData(SingleCoreApplication::app_t::applicationFilePath().toLower().toUtf8());
|
appData.addData(SingleCoreApplication::app_t::applicationFilePath().toLower().toUtf8());
|
||||||
#else
|
#else
|
||||||
appData.addData(SingleCoreApplication::app_t::applicationFilePath().toUtf8());
|
appData.addData(SingleCoreApplication::app_t::applicationFilePath().toUtf8());
|
||||||
@@ -171,26 +181,24 @@ void SingleCoreApplicationPrivate::genBlockServerName() {
|
|||||||
|
|
||||||
void SingleCoreApplicationPrivate::initializeMemoryBlock() const {
|
void SingleCoreApplicationPrivate::initializeMemoryBlock() const {
|
||||||
|
|
||||||
InstancesInfo *inst = static_cast<InstancesInfo*>(memory_->data());
|
InstancesInfo *instance = static_cast<InstancesInfo*>(memory_->data());
|
||||||
inst->primary = false;
|
instance->primary = false;
|
||||||
inst->secondary = 0;
|
instance->secondary = 0;
|
||||||
inst->primaryPid = -1;
|
instance->primaryPid = -1;
|
||||||
inst->primaryUser[0] = '\0';
|
instance->primaryUser[0] = '\0';
|
||||||
inst->checksum = blockChecksum();
|
instance->checksum = blockChecksum();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleCoreApplicationPrivate::startPrimary() {
|
void SingleCoreApplicationPrivate::startPrimary() {
|
||||||
|
|
||||||
Q_Q(SingleCoreApplication);
|
|
||||||
|
|
||||||
// Reset the number of connections
|
// Reset the number of connections
|
||||||
InstancesInfo *inst = static_cast<InstancesInfo*>(memory_->data());
|
InstancesInfo *instance = static_cast<InstancesInfo*>(memory_->data());
|
||||||
|
|
||||||
inst->primary = true;
|
instance->primary = true;
|
||||||
inst->primaryPid = q->applicationPid();
|
instance->primaryPid = QCoreApplication::applicationPid();
|
||||||
qstrncpy(inst->primaryUser, getUsername().toUtf8().data(), sizeof(inst->primaryUser));
|
qstrncpy(instance->primaryUser, getUsername().toUtf8().data(), sizeof(instance->primaryUser));
|
||||||
inst->checksum = blockChecksum();
|
instance->checksum = blockChecksum();
|
||||||
instanceNumber_ = 0;
|
instanceNumber_ = 0;
|
||||||
// Successful creation means that no main process exists
|
// Successful creation means that no main process exists
|
||||||
// So we start a QLocalServer to listen for connections
|
// So we start a QLocalServer to listen for connections
|
||||||
@@ -212,11 +220,11 @@ void SingleCoreApplicationPrivate::startPrimary() {
|
|||||||
|
|
||||||
void SingleCoreApplicationPrivate::startSecondary() {
|
void SingleCoreApplicationPrivate::startSecondary() {
|
||||||
|
|
||||||
InstancesInfo *inst = static_cast<InstancesInfo*>(memory_->data());
|
InstancesInfo *instance = static_cast<InstancesInfo*>(memory_->data());
|
||||||
|
|
||||||
inst->secondary += 1;
|
instance->secondary += 1;
|
||||||
inst->checksum = blockChecksum();
|
instance->checksum = blockChecksum();
|
||||||
instanceNumber_ = inst->secondary;
|
instanceNumber_ = instance->secondary;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,25 +271,53 @@ bool SingleCoreApplicationPrivate::connectToPrimary(const int timeout, const Con
|
|||||||
writeStream << instanceNumber_;
|
writeStream << instanceNumber_;
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
quint16 checksum = qChecksum(QByteArray(initMsg, static_cast<quint32>(initMsg.length())));
|
quint16 checksum = qChecksum(QByteArray(initMsg, static_cast<quint32>(initMsg.length())));
|
||||||
#else
|
#else
|
||||||
quint16 checksum = qChecksum(initMsg.constData(), static_cast<quint32>(initMsg.length()));
|
quint16 checksum = qChecksum(initMsg.constData(), static_cast<quint32>(initMsg.length()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
writeStream << checksum;
|
writeStream << checksum;
|
||||||
|
|
||||||
// The header indicates the message length that follows
|
return writeConfirmedMessage(static_cast<int>(timeout - time.elapsed()), initMsg);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SingleCoreApplicationPrivate::writeAck(QLocalSocket *sock) {
|
||||||
|
sock->putChar('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SingleCoreApplicationPrivate::writeConfirmedMessage(const int timeout, const QByteArray &msg) const {
|
||||||
|
|
||||||
|
QElapsedTimer time;
|
||||||
|
time.start();
|
||||||
|
|
||||||
|
// Frame 1: The header indicates the message length that follows
|
||||||
QByteArray header;
|
QByteArray header;
|
||||||
QDataStream headerStream(&header, QIODevice::WriteOnly);
|
QDataStream headerStream(&header, QIODevice::WriteOnly);
|
||||||
headerStream.setVersion(QDataStream::Qt_5_8);
|
headerStream.setVersion(QDataStream::Qt_5_8);
|
||||||
headerStream << static_cast<quint64>(initMsg.length());
|
headerStream << static_cast<quint64>(msg.length());
|
||||||
|
|
||||||
socket_->write(header);
|
if (!writeConfirmedFrame(static_cast<int>(timeout - time.elapsed()), header)) {
|
||||||
socket_->write(initMsg);
|
return false;
|
||||||
bool result = socket_->waitForBytesWritten(timeout - static_cast<int>(time.elapsed()));
|
}
|
||||||
|
|
||||||
|
// Frame 2: The message
|
||||||
|
return writeConfirmedFrame(static_cast<int>(timeout - time.elapsed()), msg);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SingleCoreApplicationPrivate::writeConfirmedFrame(const int timeout, const QByteArray &msg) const {
|
||||||
|
|
||||||
|
socket_->write(msg);
|
||||||
socket_->flush();
|
socket_->flush();
|
||||||
|
|
||||||
return result;
|
bool result = socket_->waitForReadyRead(timeout);
|
||||||
|
if (result) {
|
||||||
|
socket_->read(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,8 +336,8 @@ quint16 SingleCoreApplicationPrivate::blockChecksum() const {
|
|||||||
qint64 SingleCoreApplicationPrivate::primaryPid() const {
|
qint64 SingleCoreApplicationPrivate::primaryPid() const {
|
||||||
|
|
||||||
memory_->lock();
|
memory_->lock();
|
||||||
InstancesInfo *inst = static_cast<InstancesInfo*>(memory_->data());
|
InstancesInfo *instance = static_cast<InstancesInfo*>(memory_->data());
|
||||||
qint64 pid = inst->primaryPid;
|
qint64 pid = instance->primaryPid;
|
||||||
memory_->unlock();
|
memory_->unlock();
|
||||||
|
|
||||||
return pid;
|
return pid;
|
||||||
@@ -311,8 +347,8 @@ qint64 SingleCoreApplicationPrivate::primaryPid() const {
|
|||||||
QString SingleCoreApplicationPrivate::primaryUser() const {
|
QString SingleCoreApplicationPrivate::primaryUser() const {
|
||||||
|
|
||||||
memory_->lock();
|
memory_->lock();
|
||||||
InstancesInfo *inst = static_cast<InstancesInfo*>(memory_->data());
|
InstancesInfo *instance = static_cast<InstancesInfo*>(memory_->data());
|
||||||
QByteArray username = inst->primaryUser;
|
QByteArray username = instance->primaryUser;
|
||||||
memory_->unlock();
|
memory_->unlock();
|
||||||
|
|
||||||
return QString::fromUtf8(username);
|
return QString::fromUtf8(username);
|
||||||
@@ -328,26 +364,30 @@ void SingleCoreApplicationPrivate::slotConnectionEstablished() {
|
|||||||
connectionMap_.insert(nextConnSocket, ConnectionInfo());
|
connectionMap_.insert(nextConnSocket, ConnectionInfo());
|
||||||
|
|
||||||
QObject::connect(nextConnSocket, &QLocalSocket::aboutToClose, this, [nextConnSocket, this]() {
|
QObject::connect(nextConnSocket, &QLocalSocket::aboutToClose, this, [nextConnSocket, this]() {
|
||||||
const ConnectionInfo info = connectionMap_[nextConnSocket];
|
const ConnectionInfo &info = connectionMap_[nextConnSocket];
|
||||||
slotClientConnectionClosed(nextConnSocket, info.instanceId);
|
slotClientConnectionClosed(nextConnSocket, info.instanceId);
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(nextConnSocket, &QLocalSocket::disconnected, this, [nextConnSocket, this]() {
|
QObject::connect(nextConnSocket, &QLocalSocket::disconnected, nextConnSocket, &QLocalSocket::deleteLater);
|
||||||
|
|
||||||
|
QObject::connect(nextConnSocket, &QLocalSocket::destroyed, this, [nextConnSocket, this]() {
|
||||||
connectionMap_.remove(nextConnSocket);
|
connectionMap_.remove(nextConnSocket);
|
||||||
nextConnSocket->deleteLater();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(nextConnSocket, &QLocalSocket::readyRead, this, [nextConnSocket, this]() {
|
QObject::connect(nextConnSocket, &QLocalSocket::readyRead, this, [nextConnSocket, this]() {
|
||||||
const ConnectionInfo info = connectionMap_[nextConnSocket];
|
const ConnectionInfo &info = connectionMap_[nextConnSocket];
|
||||||
switch (info.stage) {
|
switch (info.stage) {
|
||||||
case StageHeader:
|
case StageInitHeader:
|
||||||
readInitMessageHeader(nextConnSocket);
|
readMessageHeader(nextConnSocket, StageInitBody);
|
||||||
break;
|
break;
|
||||||
case StageBody:
|
case StageInitBody:
|
||||||
readInitMessageBody(nextConnSocket);
|
readInitMessageBody(nextConnSocket);
|
||||||
break;
|
break;
|
||||||
case StageConnected:
|
case StageConnectedHeader:
|
||||||
slotDataAvailable(nextConnSocket, info.instanceId);
|
readMessageHeader(nextConnSocket, StageConnectedBody);
|
||||||
|
break;
|
||||||
|
case StageConnectedBody:
|
||||||
|
this->slotDataAvailable(nextConnSocket, info.instanceId);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -356,7 +396,7 @@ void SingleCoreApplicationPrivate::slotConnectionEstablished() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleCoreApplicationPrivate::readInitMessageHeader(QLocalSocket *sock) {
|
void SingleCoreApplicationPrivate::readMessageHeader(QLocalSocket *sock, SingleCoreApplicationPrivate::ConnectionStage nextStage) {
|
||||||
|
|
||||||
if (!connectionMap_.contains(sock)) {
|
if (!connectionMap_.contains(sock)) {
|
||||||
return;
|
return;
|
||||||
@@ -373,30 +413,34 @@ void SingleCoreApplicationPrivate::readInitMessageHeader(QLocalSocket *sock) {
|
|||||||
quint64 msgLen = 0;
|
quint64 msgLen = 0;
|
||||||
headerStream >> msgLen;
|
headerStream >> msgLen;
|
||||||
ConnectionInfo &info = connectionMap_[sock];
|
ConnectionInfo &info = connectionMap_[sock];
|
||||||
info.stage = StageBody;
|
info.stage = nextStage;
|
||||||
info.msgLen = msgLen;
|
info.msgLen = msgLen;
|
||||||
|
|
||||||
if (sock->bytesAvailable() >= static_cast<qint64>(msgLen)) {
|
writeAck(sock);
|
||||||
readInitMessageBody(sock);
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SingleCoreApplicationPrivate::isFrameComplete(QLocalSocket *sock) {
|
||||||
|
|
||||||
|
if (!connectionMap_.contains(sock)) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConnectionInfo &info = connectionMap_[sock];
|
||||||
|
return (sock->bytesAvailable() >= static_cast<qint64>(info.msgLen));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleCoreApplicationPrivate::readInitMessageBody(QLocalSocket *sock) {
|
void SingleCoreApplicationPrivate::readInitMessageBody(QLocalSocket *sock) {
|
||||||
|
|
||||||
Q_Q(SingleCoreApplication);
|
Q_Q(SingleCoreApplication);
|
||||||
|
|
||||||
if (!connectionMap_.contains(sock)) {
|
if (!isFrameComplete(sock)) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConnectionInfo &info = connectionMap_[sock];
|
|
||||||
if (sock->bytesAvailable() < static_cast<qint64>(info.msgLen)) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read the message body
|
// Read the message body
|
||||||
QByteArray msgBytes = sock->read(info.msgLen);
|
QByteArray msgBytes = sock->readAll();
|
||||||
QDataStream readStream(msgBytes);
|
QDataStream readStream(msgBytes);
|
||||||
readStream.setVersion(QDataStream::Qt_5_8);
|
readStream.setVersion(QDataStream::Qt_5_8);
|
||||||
|
|
||||||
@@ -431,23 +475,34 @@ void SingleCoreApplicationPrivate::readInitMessageBody(QLocalSocket *sock) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ConnectionInfo &info = connectionMap_[sock];
|
||||||
info.instanceId = instanceId;
|
info.instanceId = instanceId;
|
||||||
info.stage = StageConnected;
|
info.stage = StageConnectedHeader;
|
||||||
|
|
||||||
if (connectionType == NewInstance || (connectionType == SecondaryInstance && options_ & SingleCoreApplication::Mode::SecondaryNotification)) {
|
if (connectionType == NewInstance || (connectionType == SecondaryInstance && options_ & SingleCoreApplication::Mode::SecondaryNotification)) {
|
||||||
Q_EMIT q->instanceStarted();
|
emit q->instanceStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sock->bytesAvailable() > 0) {
|
writeAck(sock);
|
||||||
slotDataAvailable(sock, instanceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleCoreApplicationPrivate::slotDataAvailable(QLocalSocket *dataSocket, const quint32 instanceId) {
|
void SingleCoreApplicationPrivate::slotDataAvailable(QLocalSocket *dataSocket, const quint32 instanceId) {
|
||||||
|
|
||||||
Q_Q(SingleCoreApplication);
|
Q_Q(SingleCoreApplication);
|
||||||
Q_EMIT q->receivedMessage(instanceId, dataSocket->readAll());
|
|
||||||
|
if (!isFrameComplete(dataSocket)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QByteArray message = dataSocket->readAll();
|
||||||
|
|
||||||
|
writeAck(dataSocket);
|
||||||
|
|
||||||
|
ConnectionInfo &info = connectionMap_[dataSocket];
|
||||||
|
info.stage = StageConnectedHeader;
|
||||||
|
|
||||||
|
emit q->receivedMessage(instanceId, message);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,7 +520,7 @@ void SingleCoreApplicationPrivate::randomSleep() {
|
|||||||
QThread::msleep(QRandomGenerator::global()->bounded(8U, 18U));
|
QThread::msleep(QRandomGenerator::global()->bounded(8U, 18U));
|
||||||
#else
|
#else
|
||||||
qsrand(QDateTime::currentMSecsSinceEpoch() % std::numeric_limits<uint>::max());
|
qsrand(QDateTime::currentMSecsSinceEpoch() % std::numeric_limits<uint>::max());
|
||||||
QThread::msleep(8 + static_cast<unsigned long>(static_cast<float>(qrand()) / RAND_MAX * 10));
|
QThread::msleep(qrand() % 11 + 8);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ struct InstancesInfo {
|
|||||||
|
|
||||||
struct ConnectionInfo {
|
struct ConnectionInfo {
|
||||||
explicit ConnectionInfo() : msgLen(0), instanceId(0), stage(0) {}
|
explicit ConnectionInfo() : msgLen(0), instanceId(0), stage(0) {}
|
||||||
qint64 msgLen;
|
quint64 msgLen;
|
||||||
quint32 instanceId;
|
quint32 instanceId;
|
||||||
quint8 stage;
|
quint8 stage;
|
||||||
};
|
};
|
||||||
@@ -71,9 +71,10 @@ class SingleCoreApplicationPrivate : public QObject {
|
|||||||
Reconnect = 3
|
Reconnect = 3
|
||||||
};
|
};
|
||||||
enum ConnectionStage : quint8 {
|
enum ConnectionStage : quint8 {
|
||||||
StageHeader = 0,
|
StageInitHeader = 0,
|
||||||
StageBody = 1,
|
StageInitBody = 1,
|
||||||
StageConnected = 2,
|
StageConnectedHeader = 2,
|
||||||
|
StageConnectedBody = 3,
|
||||||
};
|
};
|
||||||
Q_DECLARE_PUBLIC(SingleCoreApplication)
|
Q_DECLARE_PUBLIC(SingleCoreApplication)
|
||||||
|
|
||||||
@@ -89,8 +90,12 @@ class SingleCoreApplicationPrivate : public QObject {
|
|||||||
quint16 blockChecksum() const;
|
quint16 blockChecksum() const;
|
||||||
qint64 primaryPid() const;
|
qint64 primaryPid() const;
|
||||||
QString primaryUser() const;
|
QString primaryUser() const;
|
||||||
void readInitMessageHeader(QLocalSocket *socket);
|
bool isFrameComplete(QLocalSocket *sock);
|
||||||
|
void readMessageHeader(QLocalSocket *socket, const ConnectionStage nextStage);
|
||||||
void readInitMessageBody(QLocalSocket *socket);
|
void readInitMessageBody(QLocalSocket *socket);
|
||||||
|
void writeAck(QLocalSocket *sock);
|
||||||
|
bool writeConfirmedFrame(const int timeout, const QByteArray &msg) const;
|
||||||
|
bool writeConfirmedMessage(const int timeout, const QByteArray &msg) const;
|
||||||
static void randomSleep();
|
static void randomSleep();
|
||||||
|
|
||||||
SingleCoreApplication *q_ptr;
|
SingleCoreApplication *q_ptr;
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ endif()
|
|||||||
pkg_check_modules(GLIB REQUIRED glib-2.0)
|
pkg_check_modules(GLIB REQUIRED glib-2.0)
|
||||||
pkg_check_modules(GOBJECT REQUIRED gobject-2.0)
|
pkg_check_modules(GOBJECT REQUIRED gobject-2.0)
|
||||||
pkg_check_modules(GIO REQUIRED gio-2.0)
|
pkg_check_modules(GIO REQUIRED gio-2.0)
|
||||||
|
if(UNIX)
|
||||||
|
pkg_check_modules(GIO_UNIX gio-unix-2.0)
|
||||||
|
endif()
|
||||||
pkg_check_modules(LIBCDIO libcdio)
|
pkg_check_modules(LIBCDIO libcdio)
|
||||||
pkg_check_modules(GSTREAMER gstreamer-1.0)
|
pkg_check_modules(GSTREAMER gstreamer-1.0)
|
||||||
pkg_check_modules(GSTREAMER_BASE gstreamer-base-1.0)
|
pkg_check_modules(GSTREAMER_BASE gstreamer-base-1.0)
|
||||||
@@ -155,7 +158,7 @@ if(DBUS_FOUND AND NOT WIN32)
|
|||||||
list(APPEND QT_COMPONENTS DBus)
|
list(APPEND QT_COMPONENTS DBus)
|
||||||
endif()
|
endif()
|
||||||
set(QT_OPTIONAL_COMPONENTS Test)
|
set(QT_OPTIONAL_COMPONENTS Test)
|
||||||
set(QT_MIN_VERSION 5.8)
|
set(QT_MIN_VERSION 5.9)
|
||||||
|
|
||||||
if(BUILD_WITH_QT6 OR QT_VERSION_MAJOR EQUAL 6)
|
if(BUILD_WITH_QT6 OR QT_VERSION_MAJOR EQUAL 6)
|
||||||
set(QT_VERSION_MAJOR 6 CACHE STRING "" FORCE)
|
set(QT_VERSION_MAJOR 6 CACHE STRING "" FORCE)
|
||||||
@@ -292,7 +295,6 @@ set(SINGLEAPPLICATION_LIBRARIES singleapplication)
|
|||||||
set(SINGLECOREAPPLICATION_LIBRARIES singlecoreapplication)
|
set(SINGLECOREAPPLICATION_LIBRARIES singlecoreapplication)
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
find_library(SPARKLE Sparkle PATHS "/usr/local/opt/sparkle")
|
|
||||||
add_subdirectory(3rdparty/SPMediaKeyTap)
|
add_subdirectory(3rdparty/SPMediaKeyTap)
|
||||||
set(SPMEDIAKEYTAP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/SPMediaKeyTap)
|
set(SPMEDIAKEYTAP_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/SPMediaKeyTap)
|
||||||
set(SPMEDIAKEYTAP_LIBRARIES SPMediaKeyTap)
|
set(SPMEDIAKEYTAP_LIBRARIES SPMediaKeyTap)
|
||||||
@@ -300,7 +302,7 @@ if(APPLE)
|
|||||||
add_subdirectory(ext/macdeploycheck)
|
add_subdirectory(ext/macdeploycheck)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT SPARKLE AND (APPLE OR WIN32))
|
if(WIN32)
|
||||||
if(BUILD_WITH_QT6)
|
if(BUILD_WITH_QT6)
|
||||||
pkg_check_modules(QTSPARKLE qtsparkle-qt6)
|
pkg_check_modules(QTSPARKLE qtsparkle-qt6)
|
||||||
else()
|
else()
|
||||||
@@ -311,6 +313,12 @@ if(NOT SPARKLE AND (APPLE OR WIN32))
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WIN32 AND MSVC)
|
||||||
|
add_subdirectory(3rdparty/getopt)
|
||||||
|
set(GETOPT_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/getopt)
|
||||||
|
set(GETOPT_LIBRARIES getopt)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WIN32 AND NOT MSVC)
|
if(WIN32 AND NOT MSVC)
|
||||||
# RC compiler
|
# RC compiler
|
||||||
string(REPLACE "gcc" "windres" CMAKE_RC_COMPILER_INIT ${CMAKE_C_COMPILER})
|
string(REPLACE "gcc" "windres" CMAKE_RC_COMPILER_INIT ${CMAKE_C_COMPILER})
|
||||||
@@ -391,6 +399,11 @@ optional_component(GIO ON "Devices: GIO device backend"
|
|||||||
DEPENDS "Unix or Windows" "NOT APPLE"
|
DEPENDS "Unix or Windows" "NOT APPLE"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
optional_component(GIO_UNIX ON "Devices: GIO device backend (Unix support)"
|
||||||
|
DEPENDS "libgio-unix" GIO_UNIX_FOUND
|
||||||
|
DEPENDS "Unix" "UNIX"
|
||||||
|
)
|
||||||
|
|
||||||
optional_component(LIBGPOD ON "Devices: iPod classic support"
|
optional_component(LIBGPOD ON "Devices: iPod classic support"
|
||||||
DEPENDS "libgpod" LIBGPOD_FOUND
|
DEPENDS "libgpod" LIBGPOD_FOUND
|
||||||
DEPENDS "gdk-pixbuf" GDK_PIXBUF_FOUND
|
DEPENDS "gdk-pixbuf" GDK_PIXBUF_FOUND
|
||||||
@@ -400,11 +413,6 @@ optional_component(LIBMTP ON "Devices: MTP support"
|
|||||||
DEPENDS "libmtp" LIBMTP_FOUND
|
DEPENDS "libmtp" LIBMTP_FOUND
|
||||||
)
|
)
|
||||||
|
|
||||||
optional_component(SPARKLE ON "Sparkle integration"
|
|
||||||
DEPENDS "macOS" APPLE
|
|
||||||
DEPENDS "Sparkle" SPARKLE
|
|
||||||
)
|
|
||||||
|
|
||||||
if(BUILD_WITH_QT6)
|
if(BUILD_WITH_QT6)
|
||||||
optional_component(TRANSLATIONS ON "Translations"
|
optional_component(TRANSLATIONS ON "Translations"
|
||||||
DEPENDS "gettext" GETTEXT_FOUND
|
DEPENDS "gettext" GETTEXT_FOUND
|
||||||
@@ -523,6 +531,10 @@ elseif(NOT HAVE_GSTREAMER)
|
|||||||
message(WARNING "GStreamer is the only engine that is fully implemented. Using other engines is possible but not recommended.")
|
message(WARNING "GStreamer is the only engine that is fully implemented. Using other engines is possible but not recommended.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(QT_VERSION_MAJOR EQUAL 5)
|
||||||
|
message(WARNING "It is detected that Strawberry is being built with Qt 5. There are no bugfix releases for the latest minor LTS version of Qt 5 available to open-source users, only commercial users. Therefore Strawberry should be built with Qt 6 when possible. Building with Qt 6 will also take advantage of improvements and new features not available in Qt 5. To build with Qt 6 specify -DBUILD_WITH_QT6=ON to automatically detect Qt 6, or for example -DCMAKE_PREFIX_PATH=/usr/local/lib64/cmake to manually specify the Qt 6 directory.")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(NOT CMAKE_CROSSCOMPILING)
|
if(NOT CMAKE_CROSSCOMPILING)
|
||||||
if(QT_SQLITE_TEST)
|
if(QT_SQLITE_TEST)
|
||||||
if(NOT SQLITE_FTS5_TEST)
|
if(NOT SQLITE_FTS5_TEST)
|
||||||
|
|||||||
217
Changelog
@@ -2,7 +2,103 @@ Strawberry Music Player
|
|||||||
=======================
|
=======================
|
||||||
ChangeLog
|
ChangeLog
|
||||||
|
|
||||||
1.0.0:
|
Version 1.0.4 (2022.04.10)
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fixed use-after-free memory in ALSA PCM device finder.
|
||||||
|
* Translate global shortcuts.
|
||||||
|
* (Windows) Fixed registering 0-9 numpad keys in global shortcuts.
|
||||||
|
|
||||||
|
Enhancements
|
||||||
|
* Added save all playlists action.
|
||||||
|
* (Windows) Made updater support both MSVC and MinGW.
|
||||||
|
* (Windows) Added HLS support.
|
||||||
|
|
||||||
|
Other:
|
||||||
|
* Removed use of custom font in context.
|
||||||
|
|
||||||
|
Version 1.0.3 (2022.03.24)
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Remove slash and backslash from filenames when saving album covers using album directory cover filenames (#903).
|
||||||
|
* Remove playlist file-extensions from accepted audio file extensions (#909).
|
||||||
|
* Fixed Qobuz requests only receiving the first 50 albums (#922).
|
||||||
|
* (Windows|MinGW) Fixed streaming stopping at the end of each track. libsoup downgraded from 3.0 to 2.74.
|
||||||
|
* (Windows|MSVC) Fixed initial database schema failure caused by CRLF line-endings in schema files.
|
||||||
|
|
||||||
|
New features
|
||||||
|
* Added support for bs2b (Improved headphone listening of stereo audio records using Bauer stereophonic-to-binaural DSP) (#249).
|
||||||
|
|
||||||
|
Version 1.0.2 (2022.02.20)
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fixed showing menu when clicking icon for collection and internet search tool buttons
|
||||||
|
* Fixed ignoring devices with system mounts as defined by GIO (#410).
|
||||||
|
* Fixed updating database when deleting songs from filesystem devices.
|
||||||
|
* Fixed unregistered metatype when listing songs from MTP devices with Qt 6.
|
||||||
|
* Fixed using entered password when testing Subsonic settings before pressing save (#879).
|
||||||
|
* Fixed downloading Subsonic album covers.
|
||||||
|
* Fixed subsonic album covers downloaded several times for each album when MD5 authentication was enabled (#885).
|
||||||
|
* Fixed volume going to 100% when pressing volume down with MRPIS2 and global shortcuts (#884).
|
||||||
|
* Fixed incorrect rounding when setting volume through MPRIS2 (#894).
|
||||||
|
* Fixed delete from disk not showing up in the menu when one or more CUE songs were selected.
|
||||||
|
* Fixed possible crashes when switching songs when fading is enabled (#890).
|
||||||
|
* Fixed X11 global shortcuts not working unless window was in focus with Qt 6.2 and higher (#893).
|
||||||
|
* Fixed scrobbler re-sending scrobbles to fast on error (#898).
|
||||||
|
|
||||||
|
Enhancements
|
||||||
|
* Log Qt version on startup.
|
||||||
|
* Added button for deleting existing Subsonic songs (#883).
|
||||||
|
* Make collection watcher ignore files with "qt_temp" filename and tmp extension.
|
||||||
|
* Require Qt 5.9 or higher.
|
||||||
|
* Added scrollbars to edit tag dialog (#888).
|
||||||
|
* Added advanced settings for configuring collection watcher.
|
||||||
|
* Disable open audio CD menu when compiled without audio CD support.
|
||||||
|
* Replaced use of deprecated QMouseEvent constructor as of Qt 6.4.
|
||||||
|
* Replaced use of deprecated QCryptographicHash::addData overload as of Qt 6.4.
|
||||||
|
|
||||||
|
Removed features:
|
||||||
|
* Removed broken "nomedia" / "nomusic" file handling.
|
||||||
|
|
||||||
|
Version 1.0.1 (2022.01.08)
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fixed collection and internet search filter tool button menu arrow overlap (#796).
|
||||||
|
* Fixed stop after this track button with Qt 6 (#795).
|
||||||
|
* Fixed not updating the URL when songs were moved on disk when the fingerprinting feature is enabled.
|
||||||
|
* Fixed SQL query error for songs with an invalid modification time (#815).
|
||||||
|
* Fixed blocky rendering of the currently playing track with high resolution screens (#794).
|
||||||
|
* Fixed incorrect playlist column filesize for radio streams.
|
||||||
|
* Fixed deleting embedded album cover from Ogg songs.
|
||||||
|
* Fixed parsing of Cue tracks with 1-digit minutes (#836).
|
||||||
|
* Fixed updating of playlist summary after reloading items when adding songs from files outside of the collection (#848).
|
||||||
|
* Fixed always saving metadata when saving playlists for Tidal, Qobuz and Subsonic songs independent of playlist setting (#851).
|
||||||
|
* Fixed setting media shortcuts when using kglobalaccel (#849).
|
||||||
|
* Fixed parsing of Genius lyrics when they are sometimes received in a different HTML format.
|
||||||
|
* Fixed saving MP4 specific tags as UTF-8 (#830).
|
||||||
|
* Fixed clearing "manually set" cover when saving album covers embedded from outside of the tag editor (#858).
|
||||||
|
* Fixed aborting collection scan when Strawberry exists to avoid hang on exit.
|
||||||
|
* Fixed resuming collection scan when adding a new directory after collection scan was aborted.
|
||||||
|
* Fixed excluding hidden songs from the collection.
|
||||||
|
* Disabled moodbar for CUE songs since they can not be supported properly (#865).
|
||||||
|
* (Windows) Added gstreamer gstxingmux plugin to fix transcoding to MP3 (#856).
|
||||||
|
|
||||||
|
Enhancements:
|
||||||
|
* Made playlist header column text elided (#801).
|
||||||
|
* Added support for reading and writing playcounts and ratings from/to tags.
|
||||||
|
* Added support for setting rating using the edit tag dialog.
|
||||||
|
* Added setting to enable/disable playlist toolbar (#809).
|
||||||
|
* Added component type, content_rating type and releases to AppStream data file (#806).
|
||||||
|
* Removed unused "mark as listened" option in organize dialog.
|
||||||
|
* Fixed some clazy warnings and narrowing conversions in the source code.
|
||||||
|
* Replaced uses of macros in the source code.
|
||||||
|
* Added a more user-friendly error message when receiving encrypted streams from Tidal (#824).
|
||||||
|
* Added support for port-pattern entered in the device textbox when using Jack as output (#828).
|
||||||
|
* Added Spanish (Spain) translation.
|
||||||
|
* Added support for more CUE filenames (#835).
|
||||||
|
* (Windows) Add gstreamer dash plugin.
|
||||||
|
|
||||||
|
Version 1.0.0 (2021.10.14)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fix updating temporary metadata when reloading songs outside of the collection.
|
* Fix updating temporary metadata when reloading songs outside of the collection.
|
||||||
@@ -56,7 +152,8 @@ ChangeLog
|
|||||||
* Add support for native global shortcuts on MATE.
|
* Add support for native global shortcuts on MATE.
|
||||||
* Add radios view with channels from Radio Paradise and SomaFM.
|
* Add radios view with channels from Radio Paradise and SomaFM.
|
||||||
|
|
||||||
0.9.3:
|
|
||||||
|
Version 0.9.3 (2021.04.18)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fix "Show in file browser" to work with thunar.
|
* Fix "Show in file browser" to work with thunar.
|
||||||
@@ -79,7 +176,8 @@ ChangeLog
|
|||||||
* (macOS) Make macdeployqt work with Qt 5 too.
|
* (macOS) Make macdeployqt work with Qt 5 too.
|
||||||
* (macOS) Show keep running option in behaviour settings.
|
* (macOS) Show keep running option in behaviour settings.
|
||||||
|
|
||||||
0.9.2:
|
|
||||||
|
Version 0.9.2 (2021.03.25)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fix marking songs available.
|
* Fix marking songs available.
|
||||||
@@ -90,7 +188,8 @@ ChangeLog
|
|||||||
* (macOS) Fix crash when opening cover manager.
|
* (macOS) Fix crash when opening cover manager.
|
||||||
* (macOS) Fix broken Qt plugins resulting in album covers not showing.
|
* (macOS) Fix broken Qt plugins resulting in album covers not showing.
|
||||||
|
|
||||||
0.9.1:
|
|
||||||
|
Version 0.9.1 (2021.03.13)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fix duplicating songs in the DB when organizing songs between 2 different collection directories.
|
* Fix duplicating songs in the DB when organizing songs between 2 different collection directories.
|
||||||
@@ -125,7 +224,8 @@ ChangeLog
|
|||||||
New features:
|
New features:
|
||||||
* Add option and support for saving embedded covers for FLAC, Ogg Vorbis, MP3 and MP4/AAC.
|
* Add option and support for saving embedded covers for FLAC, Ogg Vorbis, MP3 and MP4/AAC.
|
||||||
|
|
||||||
0.8.5:
|
|
||||||
|
Version 0.8.5 (2020.12.19)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fix return type of SmartPlaylistQueryWizardPlugin::type().
|
* Fix return type of SmartPlaylistQueryWizardPlugin::type().
|
||||||
@@ -144,7 +244,8 @@ ChangeLog
|
|||||||
* Add command line option to play a playlist based on name.
|
* Add command line option to play a playlist based on name.
|
||||||
* Change double-click behaviour in cover manager to open fullsize cover.
|
* Change double-click behaviour in cover manager to open fullsize cover.
|
||||||
|
|
||||||
0.8.4:
|
|
||||||
|
Version 0.8.4 (2020.11.15)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fix preventing session logout when window is maxmimized.
|
* Fix preventing session logout when window is maxmimized.
|
||||||
@@ -170,7 +271,8 @@ ChangeLog
|
|||||||
* Remove remaining uses of QTextCodec.
|
* Remove remaining uses of QTextCodec.
|
||||||
* Remove Core5Compat dependency.
|
* Remove Core5Compat dependency.
|
||||||
|
|
||||||
0.8.3:
|
|
||||||
|
Version 0.8.3 (2020.10.24)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fixed updating playing widget song details in small cover mode.
|
* Fixed updating playing widget song details in small cover mode.
|
||||||
@@ -185,7 +287,8 @@ ChangeLog
|
|||||||
Enhancements:
|
Enhancements:
|
||||||
* (Windows) Added WASAPI plugin.
|
* (Windows) Added WASAPI plugin.
|
||||||
|
|
||||||
0.8.2:
|
|
||||||
|
Version 0.8.2 (2020.10.13)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fixed broken transition to next song for CUE files with certain audio formats (regression since version 0.6.13).
|
* Fixed broken transition to next song for CUE files with certain audio formats (regression since version 0.6.13).
|
||||||
@@ -197,7 +300,8 @@ ChangeLog
|
|||||||
* Removed use of HTML in system tray icon tooltip for all desktop environments instead of just KDE and Cinnamon.
|
* Removed use of HTML in system tray icon tooltip for all desktop environments instead of just KDE and Cinnamon.
|
||||||
* (Windows) Ignore "IDirectSoundBuffer_GetStatus The operation completed successfully" false error when switching device while playing.
|
* (Windows) Ignore "IDirectSoundBuffer_GetStatus The operation completed successfully" false error when switching device while playing.
|
||||||
|
|
||||||
0.8.1:
|
|
||||||
|
Version 0.8.1 (2020.10.09)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fixed engine selection in backend settings with Qt 6.
|
* Fixed engine selection in backend settings with Qt 6.
|
||||||
@@ -244,14 +348,15 @@ ChangeLog
|
|||||||
* Added Subsonic server side scrobbling support.
|
* Added Subsonic server side scrobbling support.
|
||||||
* Load thumbnails from iPods to show under device collection.
|
* Load thumbnails from iPods to show under device collection.
|
||||||
|
|
||||||
0.7.2:
|
Version 0.7.2 (2020.08.15)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fixed installation directory for translations.
|
* Fixed installation directory for translations.
|
||||||
* Fixed collection sorting for non-ASCII characters.
|
* Fixed collection sorting for non-ASCII characters.
|
||||||
* Fixed closing connected devices on exit.
|
* Fixed closing connected devices on exit.
|
||||||
|
|
||||||
0.7.1:
|
|
||||||
|
Version 0.7.1 (2020.08.15)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fixed incorrectly mapped global shortcuts keys "2" and "3".
|
* Fixed incorrectly mapped global shortcuts keys "2" and "3".
|
||||||
@@ -290,7 +395,8 @@ ChangeLog
|
|||||||
* Removed Xine engine support.
|
* Removed Xine engine support.
|
||||||
* Removed broken imobiledevice (iPhone) support.
|
* Removed broken imobiledevice (iPhone) support.
|
||||||
|
|
||||||
0.6.13:
|
|
||||||
|
Version 0.6.13 (2020.07.13)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fixed cut-off text in about dialog.
|
* Fixed cut-off text in about dialog.
|
||||||
@@ -316,7 +422,8 @@ ChangeLog
|
|||||||
* Fixed unit test for testing playlist model.
|
* Fixed unit test for testing playlist model.
|
||||||
* Added new unit tests for tagreader.
|
* Added new unit tests for tagreader.
|
||||||
|
|
||||||
0.6.12:
|
|
||||||
|
Version 0.6.12 (2020.06.07)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fixed height of about dialog.
|
* Fixed height of about dialog.
|
||||||
@@ -329,7 +436,8 @@ ChangeLog
|
|||||||
* Sort folders added from file view.
|
* Sort folders added from file view.
|
||||||
* Changed default collection grouping to album - disc.
|
* Changed default collection grouping to album - disc.
|
||||||
|
|
||||||
0.6.11:
|
|
||||||
|
Version 0.6.11 (2020.05.16)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fixed MPRIS missing art url when playing albums with embedded cover.
|
* Fixed MPRIS missing art url when playing albums with embedded cover.
|
||||||
@@ -355,7 +463,8 @@ ChangeLog
|
|||||||
* Added album covers from Musixmatch and Spotify.
|
* Added album covers from Musixmatch and Spotify.
|
||||||
* Added lyrics from Genius, Musixmatch and ChartLyrics.
|
* Added lyrics from Genius, Musixmatch and ChartLyrics.
|
||||||
|
|
||||||
0.6.10:
|
|
||||||
|
Version 0.6.10 (2020.05.01)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Fixed Subsonic album covers not working for albums with non ASCII characters.
|
* Fixed Subsonic album covers not working for albums with non ASCII characters.
|
||||||
@@ -395,7 +504,8 @@ ChangeLog
|
|||||||
Removed features:
|
Removed features:
|
||||||
* Removed Phonon engine support.
|
* Removed Phonon engine support.
|
||||||
|
|
||||||
Version 0.6.9:
|
|
||||||
|
Version 0.6.9 (2020.03.09)
|
||||||
|
|
||||||
BugFixes:
|
BugFixes:
|
||||||
* Fixed playlist metadata updating interfering with manual tag editing.
|
* Fixed playlist metadata updating interfering with manual tag editing.
|
||||||
@@ -427,7 +537,8 @@ Version 0.6.9:
|
|||||||
* Tidal support (No agreement).
|
* Tidal support (No agreement).
|
||||||
* QObuz support (No agreement).
|
* QObuz support (No agreement).
|
||||||
|
|
||||||
Version 0.6.8:
|
|
||||||
|
Version 0.6.8 (2020.01.05)
|
||||||
|
|
||||||
* Fixed stuck tabbar and collection GUI with some themes.
|
* Fixed stuck tabbar and collection GUI with some themes.
|
||||||
* Fixed possible crashes related to QProxyStyle.
|
* Fixed possible crashes related to QProxyStyle.
|
||||||
@@ -444,7 +555,8 @@ Version 0.6.8:
|
|||||||
* (macOS) Fixed filesystem watcher to correctly pick up changed collection directories.
|
* (macOS) Fixed filesystem watcher to correctly pick up changed collection directories.
|
||||||
* (Windows) Fixed translations not being included.
|
* (Windows) Fixed translations not being included.
|
||||||
|
|
||||||
Version 0.6.7:
|
|
||||||
|
Version 0.6.7 (2019.11.27)
|
||||||
|
|
||||||
* Fixed crash when cancelling scrobbler authentication
|
* Fixed crash when cancelling scrobbler authentication
|
||||||
* Fixed "Double clicking a song in the playlist" behaviour setting
|
* Fixed "Double clicking a song in the playlist" behaviour setting
|
||||||
@@ -461,7 +573,8 @@ Version 0.6.7:
|
|||||||
* Removed left click on analyzer to popup menu
|
* Removed left click on analyzer to popup menu
|
||||||
* (Windows) Added killproc executable to terminate running process before uninstalling
|
* (Windows) Added killproc executable to terminate running process before uninstalling
|
||||||
|
|
||||||
Version 0.6.6:
|
|
||||||
|
Version 0.6.6 (2019.11.09)
|
||||||
|
|
||||||
* Fixed lowercased album artist in playlist column
|
* Fixed lowercased album artist in playlist column
|
||||||
* Fixed compiling with different optional features turned off
|
* Fixed compiling with different optional features turned off
|
||||||
@@ -479,7 +592,8 @@ Version 0.6.6:
|
|||||||
* Added option to automatically select current playing track
|
* Added option to automatically select current playing track
|
||||||
* (Windows) Added support for WASAPI
|
* (Windows) Added support for WASAPI
|
||||||
|
|
||||||
Version 0.6.5:
|
|
||||||
|
Version 0.6.5 (2019.09.30)
|
||||||
|
|
||||||
* Fixed scrobbler not to send scrobbles multiple times when metadata is updated
|
* Fixed scrobbler not to send scrobbles multiple times when metadata is updated
|
||||||
* Fixed Listenbrainz scrobbler not don't send "various artists" as album artist
|
* Fixed Listenbrainz scrobbler not don't send "various artists" as album artist
|
||||||
@@ -488,7 +602,8 @@ Version 0.6.5:
|
|||||||
* Fixed OSD pretty positioning on Windows on screens with negative geometry
|
* Fixed OSD pretty positioning on Windows on screens with negative geometry
|
||||||
* Fixed appdata file to pass full validation
|
* Fixed appdata file to pass full validation
|
||||||
|
|
||||||
Version 0.6.4:
|
|
||||||
|
Version 0.6.4 (2019.09.25)
|
||||||
|
|
||||||
* Added setting for fancy tabbar background color
|
* Added setting for fancy tabbar background color
|
||||||
* Added setting to make marking songs unavailable optional
|
* Added setting to make marking songs unavailable optional
|
||||||
@@ -515,18 +630,21 @@ Version 0.6.4:
|
|||||||
* Fixed restoring to original window size when restoring from system tray
|
* Fixed restoring to original window size when restoring from system tray
|
||||||
* Updated 3rdparty taglib
|
* Updated 3rdparty taglib
|
||||||
|
|
||||||
Version 0.6.3:
|
|
||||||
|
Version 0.6.3 (2019.08.05)
|
||||||
|
|
||||||
* Fixed crash when using internet services.
|
* Fixed crash when using internet services.
|
||||||
* Fixed musicbrainz tagfetcher only showing 1 result per song.
|
* Fixed musicbrainz tagfetcher only showing 1 result per song.
|
||||||
* Fixed collection watcher to unwatch deleted directories.
|
* Fixed collection watcher to unwatch deleted directories.
|
||||||
* Added "album - disc" grouping.
|
* Added "album - disc" grouping.
|
||||||
|
|
||||||
Version 0.6.2:
|
|
||||||
|
Version 0.6.2 (2019.08.03)
|
||||||
|
|
||||||
* Disabled fatal error for FTS5 cmake test.
|
* Disabled fatal error for FTS5 cmake test.
|
||||||
|
|
||||||
Version 0.6.1:
|
|
||||||
|
Version 0.6.1 (2019.08.03)
|
||||||
|
|
||||||
* Compare artist and album case-insensitive when generating score for album covers.
|
* Compare artist and album case-insensitive when generating score for album covers.
|
||||||
* Fixed broken return value of sendMessage() in SingleApplication causing application to be started twice.
|
* Fixed broken return value of sendMessage() in SingleApplication causing application to be started twice.
|
||||||
@@ -572,11 +690,13 @@ Version 0.6.1:
|
|||||||
* Fixed certain cases where the playing widget gets stuck when switching fast between context and other widgets.
|
* Fixed certain cases where the playing widget gets stuck when switching fast between context and other widgets.
|
||||||
* Removed ChartLyrics provider (service have been down for a long time).
|
* Removed ChartLyrics provider (service have been down for a long time).
|
||||||
|
|
||||||
Version 0.5.5:
|
|
||||||
|
Version 0.5.5 (2019.05.05)
|
||||||
|
|
||||||
* Fixed Tidal API url
|
* Fixed Tidal API url
|
||||||
|
|
||||||
Version 0.5.4:
|
|
||||||
|
Version 0.5.4 (2019.05.05)
|
||||||
|
|
||||||
* Changed description for offline mode scrobbling for less confusion
|
* Changed description for offline mode scrobbling for less confusion
|
||||||
* Fixed scrobbler to not send "playing now" when in offline mode
|
* Fixed scrobbler to not send "playing now" when in offline mode
|
||||||
@@ -607,7 +727,8 @@ Version 0.5.4:
|
|||||||
* Fixed and improved snap including upgrading to core18 and adding proper alsa support
|
* Fixed and improved snap including upgrading to core18 and adding proper alsa support
|
||||||
* Fixed resume playback on startup not working for other than the first playlist
|
* Fixed resume playback on startup not working for other than the first playlist
|
||||||
|
|
||||||
Version 0.5.3:
|
|
||||||
|
Version 0.5.3 (2019.03.02)
|
||||||
|
|
||||||
* Changed default tagging to albumartist in organise dialog
|
* Changed default tagging to albumartist in organise dialog
|
||||||
* Removed support for older taglib in tagreader
|
* Removed support for older taglib in tagreader
|
||||||
@@ -647,7 +768,8 @@ Version 0.5.3:
|
|||||||
* Added group by format
|
* Added group by format
|
||||||
* Fixed gstreamer leaks
|
* Fixed gstreamer leaks
|
||||||
|
|
||||||
Version 0.5.2:
|
|
||||||
|
Version 0.5.2 (2019.01.26)
|
||||||
|
|
||||||
* Added error handling and message for URL handler
|
* Added error handling and message for URL handler
|
||||||
* Added SingleCoreApplication secondary check
|
* Added SingleCoreApplication secondary check
|
||||||
@@ -664,7 +786,8 @@ Version 0.5.2:
|
|||||||
* Added option to copy album cover in organise dialog (filesystem and libgpod devices)
|
* Added option to copy album cover in organise dialog (filesystem and libgpod devices)
|
||||||
* Added raise() to make sure window is on top when strawberry is started twice
|
* Added raise() to make sure window is on top when strawberry is started twice
|
||||||
|
|
||||||
Version 0.5.1:
|
|
||||||
|
Version 0.5.1 (2019.01.12)
|
||||||
|
|
||||||
* Added scrobbler with support for Last.fm, Libre.fm and ListenBrainz
|
* Added scrobbler with support for Last.fm, Libre.fm and ListenBrainz
|
||||||
* Fixed key up causing playback to reset
|
* Fixed key up causing playback to reset
|
||||||
@@ -695,7 +818,8 @@ Version 0.5.1:
|
|||||||
* Added debian copyright file
|
* Added debian copyright file
|
||||||
* Fixed some compile errors
|
* Fixed some compile errors
|
||||||
|
|
||||||
Version 0.4.2:
|
|
||||||
|
Version 0.4.2 (2018.11.28)
|
||||||
|
|
||||||
* Updated AppStream data file to newer specifications
|
* Updated AppStream data file to newer specifications
|
||||||
* Fixed Deezer engine to use quality setting
|
* Fixed Deezer engine to use quality setting
|
||||||
@@ -709,7 +833,8 @@ Version 0.4.2:
|
|||||||
* (Windows) Corrected uninstalled files on x64 installer
|
* (Windows) Corrected uninstalled files on x64 installer
|
||||||
* (macOS) Fixed poor performance
|
* (macOS) Fixed poor performance
|
||||||
|
|
||||||
Version 0.4.1:
|
|
||||||
|
Version 0.4.1 (2018.11.01)
|
||||||
|
|
||||||
* Fixed crash in analyzer
|
* Fixed crash in analyzer
|
||||||
* Fixed trying to use systray even if the desktop had no systray
|
* Fixed trying to use systray even if the desktop had no systray
|
||||||
@@ -727,11 +852,13 @@ Version 0.4.1:
|
|||||||
* Added AppStream data file
|
* Added AppStream data file
|
||||||
* Fixed compiling with Qt 5 versions of system QtSingleApplication and Qxt library
|
* Fixed compiling with Qt 5 versions of system QtSingleApplication and Qxt library
|
||||||
|
|
||||||
Version 0.3.3:
|
|
||||||
|
Version 0.3.3 (2018.09.24)
|
||||||
|
|
||||||
* Fixed Tidal login
|
* Fixed Tidal login
|
||||||
|
|
||||||
Version 0.3.2:
|
|
||||||
|
Version 0.3.2 (2018.09.24)
|
||||||
|
|
||||||
* Fixed search error not shown in Tidal search
|
* Fixed search error not shown in Tidal search
|
||||||
* Added URL handler for Tidal, now retrieving URL's when playing instead of when searching
|
* Added URL handler for Tidal, now retrieving URL's when playing instead of when searching
|
||||||
@@ -743,7 +870,8 @@ Version 0.3.2:
|
|||||||
* Added encoding of Tidal token in the source code
|
* Added encoding of Tidal token in the source code
|
||||||
* Added encoding of Tidal password in the configuration
|
* Added encoding of Tidal password in the configuration
|
||||||
|
|
||||||
Version 0.3.1:
|
|
||||||
|
Version 0.3.1 (2018.09.15)
|
||||||
|
|
||||||
* Added new lyrics provider with lyrics from AudD and API Seeds
|
* Added new lyrics provider with lyrics from AudD and API Seeds
|
||||||
* New improved context widget with albums and lyrics
|
* New improved context widget with albums and lyrics
|
||||||
@@ -765,7 +893,8 @@ Version 0.3.1:
|
|||||||
* Added support for reading/writing lyrics to tags
|
* Added support for reading/writing lyrics to tags
|
||||||
* Fixed saving tags (APE) for WavPack files
|
* Fixed saving tags (APE) for WavPack files
|
||||||
|
|
||||||
Version 0.2.1:
|
|
||||||
|
Version 0.2.1 (2018.07.05)
|
||||||
|
|
||||||
* Fixed crash with newer Qt
|
* Fixed crash with newer Qt
|
||||||
* Fixed setting output/device for Xine and VLC backend
|
* Fixed setting output/device for Xine and VLC backend
|
||||||
@@ -775,19 +904,23 @@ Version 0.2.1:
|
|||||||
* Fixed device selection on macOS
|
* Fixed device selection on macOS
|
||||||
* Added xine on to windows build
|
* Added xine on to windows build
|
||||||
|
|
||||||
Version 0.1.6:
|
|
||||||
|
Version 0.1.6 (2018.06.07)
|
||||||
* Fixed crash on exit caused by NVIDIA driver
|
* Fixed crash on exit caused by NVIDIA driver
|
||||||
* Fixed PulseAudio device selection
|
* Fixed PulseAudio device selection
|
||||||
* Improvements to device selection
|
* Improvements to device selection
|
||||||
|
|
||||||
Version 0.1.5:
|
|
||||||
|
Version 0.1.5 (2018.05.16)
|
||||||
* Makefile fixes for building
|
* Makefile fixes for building
|
||||||
|
|
||||||
Version 0.1.4:
|
|
||||||
|
Version 0.1.4 (2018.05.14)
|
||||||
* Fixed compliation with clang compiler
|
* Fixed compliation with clang compiler
|
||||||
* This release is mainly to get it working on openbsd and freebsd.
|
* This release is mainly to get it working on openbsd and freebsd.
|
||||||
|
|
||||||
Version 0.1.3:
|
|
||||||
|
Version 0.1.3 (2018.05.12)
|
||||||
* Audio file detection by content
|
* Audio file detection by content
|
||||||
* Added builtin taglib to 3rdparty to support detecting audio by content instead of just file extension
|
* Added builtin taglib to 3rdparty to support detecting audio by content instead of just file extension
|
||||||
* Removed unneeded qsqlite from 3rdparty
|
* Removed unneeded qsqlite from 3rdparty
|
||||||
@@ -795,7 +928,8 @@ Version 0.1.3:
|
|||||||
* Replaced incorrect DLL libgstdirectsoundsink.dll (from gst 1.12.4) instead of libgstdirectsound.dll (from gst 1.14.0) for windows build
|
* Replaced incorrect DLL libgstdirectsoundsink.dll (from gst 1.12.4) instead of libgstdirectsound.dll (from gst 1.14.0) for windows build
|
||||||
* Fixed git versioning
|
* Fixed git versioning
|
||||||
|
|
||||||
Version 0.1.2:
|
|
||||||
|
Version 0.1.2 (2018.05.02)
|
||||||
* Fixed playback of WavPack files
|
* Fixed playback of WavPack files
|
||||||
* Fixed musicbrainz tagfetcher
|
* Fixed musicbrainz tagfetcher
|
||||||
* Use common regex (Song::kCoverRemoveDisc) for removing Disc/CD from album
|
* Use common regex (Song::kCoverRemoveDisc) for removing Disc/CD from album
|
||||||
@@ -805,5 +939,6 @@ Version 0.1.2:
|
|||||||
* Fixed problems with windows build missing some DLL's, only supplying required gstreamer-plugins now
|
* Fixed problems with windows build missing some DLL's, only supplying required gstreamer-plugins now
|
||||||
* Removed redundant code
|
* Removed redundant code
|
||||||
|
|
||||||
Version 0.1.1:
|
|
||||||
|
Version 0.1.1 (2018.04.07)
|
||||||
* Initial release
|
* Initial release
|
||||||
|
|||||||
25
README.md
@@ -23,7 +23,8 @@ Resources:
|
|||||||
### :bangbang: Opening an issue:
|
### :bangbang: Opening an issue:
|
||||||
|
|
||||||
* 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.
|
* 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, questions and feature requests please use our forum on https://forum.strawberrymusicplayer.org/ that is better suited for discussion. It also better allows answers from the community instead of just the developers on GitHub.
|
* 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/).
|
||||||
|
|
||||||
### :moneybag: Sponsoring:
|
### :moneybag: Sponsoring:
|
||||||
|
|
||||||
@@ -66,15 +67,14 @@ It has so far been tested to work on Linux, OpenBSD, FreeBSD, macOS and Windows.
|
|||||||
To build Strawberry from source you need the following installed on your system with the additional development packages/headers:
|
To build Strawberry from source you need the following installed on your system with the additional development packages/headers:
|
||||||
|
|
||||||
* [CMake](https://cmake.org/)
|
* [CMake](https://cmake.org/)
|
||||||
* [GNU Make](https://www.gnu.org/software/make/)
|
* [GCC](https://gcc.gnu.org/), [Clang](https://clang.llvm.org/) or [MSVC](https://visualstudio.microsoft.com/vs/features/cplusplus/) compiler
|
||||||
* [GCC](https://gcc.gnu.org/) or [clang](https://clang.llvm.org/) compiler
|
|
||||||
* [Boost](https://www.boost.org/)
|
* [Boost](https://www.boost.org/)
|
||||||
* [GLib](https://developer.gnome.org/glib/)
|
* [GLib](https://developer.gnome.org/glib/)
|
||||||
* [Protobuf](https://developers.google.com/protocol-buffers/)
|
* [Qt 5.9 or higher (or Qt 6) with components Core, Gui, Widgets, Concurrent, Network and Sql](https://www.qt.io/)
|
||||||
* [Qt 5.8 or higher (or Qt 6) with components Core, Gui, Widgets, Concurrent, Network and Sql](https://www.qt.io/)
|
|
||||||
* [SQLite 3.9 or newer with FTS5](https://www.sqlite.org)
|
* [SQLite 3.9 or newer with FTS5](https://www.sqlite.org)
|
||||||
* [ALSA (Linux required)](https://www.alsa-project.org/)
|
* [Protobuf](https://developers.google.com/protocol-buffers/)
|
||||||
* [D-Bus (Linux required)](https://www.freedesktop.org/wiki/Software/dbus/)
|
* [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)
|
* [GStreamer](https://gstreamer.freedesktop.org/) or [VLC](https://www.videolan.org)
|
||||||
* [GnuTLS](https://www.gnutls.org/)
|
* [GnuTLS](https://www.gnutls.org/)
|
||||||
* [TagLib 1.11.1 or higher](https://www.taglib.org/) or [TagParser](https://github.com/Martchus/tagparser)
|
* [TagLib 1.11.1 or higher](https://www.taglib.org/) or [TagParser](https://github.com/Martchus/tagparser)
|
||||||
@@ -88,8 +88,7 @@ Optional dependencies:
|
|||||||
* MTP devices: [libmtp](http://libmtp.sourceforge.net/)
|
* MTP devices: [libmtp](http://libmtp.sourceforge.net/)
|
||||||
* iPod Classic devices: [libgpod](http://www.gtkpod.org/libgpod/)
|
* iPod Classic devices: [libgpod](http://www.gtkpod.org/libgpod/)
|
||||||
|
|
||||||
Either GStreamer or VLC engine is required, but only GStreamer is fully implemented, and works best, it is therefore recommended to use GStreamer.
|
You should also install the gstreamer plugins base and good, and optionally bad, ugly and libav to support all audio formats.
|
||||||
You should also install the gstreamer plugins base and good, and optionally bad, ugly and libav.
|
|
||||||
|
|
||||||
### :wrench: Compiling from source
|
### :wrench: Compiling from source
|
||||||
|
|
||||||
@@ -101,13 +100,13 @@ You should also install the gstreamer plugins base and good, and optionally bad,
|
|||||||
|
|
||||||
cd strawberry
|
cd strawberry
|
||||||
mkdir build && cd build
|
mkdir build && cd build
|
||||||
cmake ..
|
cmake .. -DBUILD_WITH_QT6=ON
|
||||||
make -j$(nproc)
|
make -j$(nproc)
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
To compile with Qt 6 use:
|
|
||||||
|
|
||||||
cmake .. -DBUILD_WITH_QT6=ON
|
Strawberry is backwards compatible with Qt 5, to compile with Qt 5 use:
|
||||||
|
|
||||||
|
cmake .. -DBUILD_WITH_QT5=ON
|
||||||
|
|
||||||
### :penguin: Packaging status
|
### :penguin: Packaging status
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,7 @@ if(MACDEPLOYQT_EXECUTABLE)
|
|||||||
COMMAND mkdir -p ${CMAKE_BINARY_DIR}/strawberry.app/Contents/{Frameworks,Resources}
|
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/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 cp -v ${CMAKE_SOURCE_DIR}/dist/macos/strawberry.icns ${CMAKE_BINARY_DIR}/strawberry.app/Contents/Resources/
|
||||||
COMMAND ${MACDEPLOYQT_EXECUTABLE} strawberry.app -verbose=3
|
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/strawberry-tagreader
|
|
||||||
-executable=${CMAKE_BINARY_DIR}/strawberry.app/Contents/PlugIns/gio-modules/libgiognutls.so
|
|
||||||
#-executable=${CMAKE_BINARY_DIR}/strawberry.app/Contents/PlugIns/gst-plugin-scanner
|
|
||||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||||
DEPENDS strawberry strawberry-tagreader copy_gstreamer_plugins macdeployqt
|
DEPENDS strawberry strawberry-tagreader copy_gstreamer_plugins macdeployqt
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -12,10 +12,17 @@ if (LSB_RELEASE_EXEC AND RPMBUILD_EXEC)
|
|||||||
OUTPUT_VARIABLE DIST_RELEASE
|
OUTPUT_VARIABLE DIST_RELEASE
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
execute_process(COMMAND /bin/sh "-c" "${LSB_RELEASE_EXEC} -ds | tr '[:upper:]' '[:lower:]' | sed 's/\"//g' | sed 's/\\.//g' | cut -d' ' -f3"
|
if (${DIST_NAME} STREQUAL "openmandrivalinux")
|
||||||
OUTPUT_VARIABLE DIST_VERSION
|
execute_process(COMMAND /bin/sh "-c" "${LSB_RELEASE_EXEC} -ds | tr '[:upper:]' '[:lower:]' | sed 's/\"//g' | sed 's/\\./0/g' | cut -d' ' -f3"
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_VARIABLE DIST_VERSION
|
||||||
)
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
execute_process(COMMAND /bin/sh "-c" "${LSB_RELEASE_EXEC} -ds | tr '[:upper:]' '[:lower:]' | sed 's/\"//g' | sed 's/\\.//g' | cut -d' ' -f3"
|
||||||
|
OUTPUT_VARIABLE DIST_VERSION
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
endif()
|
||||||
if (DIST_NAME)
|
if (DIST_NAME)
|
||||||
|
|
||||||
message(STATUS "Distro Name: ${DIST_NAME}")
|
message(STATUS "Distro Name: ${DIST_NAME}")
|
||||||
@@ -44,6 +51,8 @@ if (LSB_RELEASE_EXEC AND RPMBUILD_EXEC)
|
|||||||
set(RPM_DISTRO "el${DIST_VERSION}")
|
set(RPM_DISTRO "el${DIST_VERSION}")
|
||||||
elseif (${DIST_NAME} STREQUAL "mageia" AND DIST_RELEASE)
|
elseif (${DIST_NAME} STREQUAL "mageia" AND DIST_RELEASE)
|
||||||
set(RPM_DISTRO "mga${DIST_RELEASE}")
|
set(RPM_DISTRO "mga${DIST_RELEASE}")
|
||||||
|
elseif (${DIST_NAME} STREQUAL "openmandrivalinux" AND DIST_VERSION)
|
||||||
|
set(RPM_DISTRO "omv${DIST_VERSION}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT RPM_DISTRO)
|
if(NOT RPM_DISTRO)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ macro(summary_show)
|
|||||||
list(SORT summary_willbuild)
|
list(SORT summary_willbuild)
|
||||||
list(SORT summary_willnotbuild)
|
list(SORT summary_willnotbuild)
|
||||||
message("")
|
message("")
|
||||||
message("Building strawberry version: ${STRAWBERRY_VERSION_DISPLAY}")
|
message("Building strawberry version: ${STRAWBERRY_VERSION_DISPLAY}, Qt version ${Qt${QT_VERSION_MAJOR}Core_VERSION}")
|
||||||
summary_show_part(summary_willbuild "The following components will be built:")
|
summary_show_part(summary_willbuild "The following components will be built:")
|
||||||
summary_show_part(summary_willnotbuild "The following components WILL NOT be built:")
|
summary_show_part(summary_willnotbuild "The following components WILL NOT be built:")
|
||||||
message("")
|
message("")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
set(STRAWBERRY_VERSION_MAJOR 1)
|
set(STRAWBERRY_VERSION_MAJOR 1)
|
||||||
set(STRAWBERRY_VERSION_MINOR 0)
|
set(STRAWBERRY_VERSION_MINOR 0)
|
||||||
set(STRAWBERRY_VERSION_PATCH 0)
|
set(STRAWBERRY_VERSION_PATCH 4)
|
||||||
#set(STRAWBERRY_VERSION_PRERELEASE rc1)
|
#set(STRAWBERRY_VERSION_PRERELEASE rc1)
|
||||||
|
|
||||||
set(INCLUDE_GIT_REVISION OFF)
|
set(INCLUDE_GIT_REVISION OFF)
|
||||||
|
|||||||
@@ -46,7 +46,6 @@
|
|||||||
<file>pictures/rainbowdash.png</file>
|
<file>pictures/rainbowdash.png</file>
|
||||||
<file>pictures/star-on.png</file>
|
<file>pictures/star-on.png</file>
|
||||||
<file>pictures/star-off.png</file>
|
<file>pictures/star-off.png</file>
|
||||||
<file>fonts/HumongousofEternitySt.ttf</file>
|
|
||||||
<file>mood/sample.mood</file>
|
<file>mood/sample.mood</file>
|
||||||
<file>text/ghosts.txt</file>
|
<file>text/ghosts.txt</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
<file>icons/128x128/document-open-folder.png</file>
|
<file>icons/128x128/document-open-folder.png</file>
|
||||||
<file>icons/128x128/document-open.png</file>
|
<file>icons/128x128/document-open.png</file>
|
||||||
<file>icons/128x128/document-save.png</file>
|
<file>icons/128x128/document-save.png</file>
|
||||||
|
<file>icons/128x128/document-save-all.png</file>
|
||||||
<file>icons/128x128/document-search.png</file>
|
<file>icons/128x128/document-search.png</file>
|
||||||
<file>icons/128x128/download.png</file>
|
<file>icons/128x128/download.png</file>
|
||||||
<file>icons/128x128/edit-clear-list.png</file>
|
<file>icons/128x128/edit-clear-list.png</file>
|
||||||
@@ -95,6 +96,7 @@
|
|||||||
<file>icons/128x128/radio.png</file>
|
<file>icons/128x128/radio.png</file>
|
||||||
<file>icons/128x128/somafm.png</file>
|
<file>icons/128x128/somafm.png</file>
|
||||||
<file>icons/128x128/radioparadise.png</file>
|
<file>icons/128x128/radioparadise.png</file>
|
||||||
|
<file>icons/128x128/musicbrainz.png</file>
|
||||||
<file>icons/64x64/albums.png</file>
|
<file>icons/64x64/albums.png</file>
|
||||||
<file>icons/64x64/alsa.png</file>
|
<file>icons/64x64/alsa.png</file>
|
||||||
<file>icons/64x64/application-exit.png</file>
|
<file>icons/64x64/application-exit.png</file>
|
||||||
@@ -119,6 +121,7 @@
|
|||||||
<file>icons/64x64/document-open-folder.png</file>
|
<file>icons/64x64/document-open-folder.png</file>
|
||||||
<file>icons/64x64/document-open.png</file>
|
<file>icons/64x64/document-open.png</file>
|
||||||
<file>icons/64x64/document-save.png</file>
|
<file>icons/64x64/document-save.png</file>
|
||||||
|
<file>icons/64x64/document-save-all.png</file>
|
||||||
<file>icons/64x64/document-search.png</file>
|
<file>icons/64x64/document-search.png</file>
|
||||||
<file>icons/64x64/download.png</file>
|
<file>icons/64x64/download.png</file>
|
||||||
<file>icons/64x64/edit-clear-list.png</file>
|
<file>icons/64x64/edit-clear-list.png</file>
|
||||||
@@ -191,6 +194,7 @@
|
|||||||
<file>icons/64x64/radio.png</file>
|
<file>icons/64x64/radio.png</file>
|
||||||
<file>icons/64x64/somafm.png</file>
|
<file>icons/64x64/somafm.png</file>
|
||||||
<file>icons/64x64/radioparadise.png</file>
|
<file>icons/64x64/radioparadise.png</file>
|
||||||
|
<file>icons/64x64/musicbrainz.png</file>
|
||||||
<file>icons/48x48/albums.png</file>
|
<file>icons/48x48/albums.png</file>
|
||||||
<file>icons/48x48/alsa.png</file>
|
<file>icons/48x48/alsa.png</file>
|
||||||
<file>icons/48x48/application-exit.png</file>
|
<file>icons/48x48/application-exit.png</file>
|
||||||
@@ -216,6 +220,7 @@
|
|||||||
<file>icons/48x48/document-open-remote.png</file>
|
<file>icons/48x48/document-open-remote.png</file>
|
||||||
<file>icons/48x48/document-open.png</file>
|
<file>icons/48x48/document-open.png</file>
|
||||||
<file>icons/48x48/document-save.png</file>
|
<file>icons/48x48/document-save.png</file>
|
||||||
|
<file>icons/48x48/document-save-all.png</file>
|
||||||
<file>icons/48x48/document-search.png</file>
|
<file>icons/48x48/document-search.png</file>
|
||||||
<file>icons/48x48/download.png</file>
|
<file>icons/48x48/download.png</file>
|
||||||
<file>icons/48x48/edit-clear-list.png</file>
|
<file>icons/48x48/edit-clear-list.png</file>
|
||||||
@@ -291,6 +296,7 @@
|
|||||||
<file>icons/48x48/radio.png</file>
|
<file>icons/48x48/radio.png</file>
|
||||||
<file>icons/48x48/somafm.png</file>
|
<file>icons/48x48/somafm.png</file>
|
||||||
<file>icons/48x48/radioparadise.png</file>
|
<file>icons/48x48/radioparadise.png</file>
|
||||||
|
<file>icons/48x48/musicbrainz.png</file>
|
||||||
<file>icons/32x32/albums.png</file>
|
<file>icons/32x32/albums.png</file>
|
||||||
<file>icons/32x32/alsa.png</file>
|
<file>icons/32x32/alsa.png</file>
|
||||||
<file>icons/32x32/application-exit.png</file>
|
<file>icons/32x32/application-exit.png</file>
|
||||||
@@ -316,6 +322,7 @@
|
|||||||
<file>icons/32x32/document-open-remote.png</file>
|
<file>icons/32x32/document-open-remote.png</file>
|
||||||
<file>icons/32x32/document-open.png</file>
|
<file>icons/32x32/document-open.png</file>
|
||||||
<file>icons/32x32/document-save.png</file>
|
<file>icons/32x32/document-save.png</file>
|
||||||
|
<file>icons/32x32/document-save-all.png</file>
|
||||||
<file>icons/32x32/document-search.png</file>
|
<file>icons/32x32/document-search.png</file>
|
||||||
<file>icons/32x32/download.png</file>
|
<file>icons/32x32/download.png</file>
|
||||||
<file>icons/32x32/edit-clear-list.png</file>
|
<file>icons/32x32/edit-clear-list.png</file>
|
||||||
@@ -391,6 +398,7 @@
|
|||||||
<file>icons/32x32/radio.png</file>
|
<file>icons/32x32/radio.png</file>
|
||||||
<file>icons/32x32/somafm.png</file>
|
<file>icons/32x32/somafm.png</file>
|
||||||
<file>icons/32x32/radioparadise.png</file>
|
<file>icons/32x32/radioparadise.png</file>
|
||||||
|
<file>icons/32x32/musicbrainz.png</file>
|
||||||
<file>icons/22x22/albums.png</file>
|
<file>icons/22x22/albums.png</file>
|
||||||
<file>icons/22x22/alsa.png</file>
|
<file>icons/22x22/alsa.png</file>
|
||||||
<file>icons/22x22/application-exit.png</file>
|
<file>icons/22x22/application-exit.png</file>
|
||||||
@@ -416,6 +424,7 @@
|
|||||||
<file>icons/22x22/document-open-remote.png</file>
|
<file>icons/22x22/document-open-remote.png</file>
|
||||||
<file>icons/22x22/document-open.png</file>
|
<file>icons/22x22/document-open.png</file>
|
||||||
<file>icons/22x22/document-save.png</file>
|
<file>icons/22x22/document-save.png</file>
|
||||||
|
<file>icons/22x22/document-save-all.png</file>
|
||||||
<file>icons/22x22/document-search.png</file>
|
<file>icons/22x22/document-search.png</file>
|
||||||
<file>icons/22x22/download.png</file>
|
<file>icons/22x22/download.png</file>
|
||||||
<file>icons/22x22/edit-clear-list.png</file>
|
<file>icons/22x22/edit-clear-list.png</file>
|
||||||
@@ -491,5 +500,6 @@
|
|||||||
<file>icons/22x22/radio.png</file>
|
<file>icons/22x22/radio.png</file>
|
||||||
<file>icons/22x22/somafm.png</file>
|
<file>icons/22x22/somafm.png</file>
|
||||||
<file>icons/22x22/radioparadise.png</file>
|
<file>icons/22x22/radioparadise.png</file>
|
||||||
|
<file>icons/22x22/musicbrainz.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
BIN
data/icons/128x128/document-save-all.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
data/icons/128x128/musicbrainz.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
data/icons/22x22/document-save-all.png
Normal file
|
After Width: | Height: | Size: 921 B |
BIN
data/icons/22x22/musicbrainz.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
data/icons/32x32/document-save-all.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
data/icons/32x32/musicbrainz.png
Normal file
|
After Width: | Height: | Size: 947 B |
BIN
data/icons/48x48/document-save-all.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
data/icons/48x48/musicbrainz.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
data/icons/64x64/document-save-all.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
data/icons/64x64/musicbrainz.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
data/icons/full/document-save-all.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
data/icons/full/musicbrainz.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
@@ -19,47 +19,6 @@
|
|||||||
background-clip: content;
|
background-clip: content;
|
||||||
}
|
}
|
||||||
|
|
||||||
QToolButton {
|
|
||||||
border: 2px solid transparent;
|
|
||||||
border-radius: 3px;
|
|
||||||
padding: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QToolButton::menu-button {
|
|
||||||
width: 16px;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
QToolButton[popupMode="1"] {
|
|
||||||
padding-right: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QToolButton:hover {
|
|
||||||
border: 2px solid %palette-highlight;
|
|
||||||
background-color: %palette-highlight-lighter;
|
|
||||||
}
|
|
||||||
|
|
||||||
QToolButton:hover[popupMode="1"] {
|
|
||||||
padding-right: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
QToolButton:pressed {
|
|
||||||
border: 2px solid %palette-highlight-darker;
|
|
||||||
background-color: %palette-highlight-lighter;
|
|
||||||
}
|
|
||||||
|
|
||||||
QToolButton:pressed[popupMode="1"] {
|
|
||||||
padding-right: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
macos {
|
|
||||||
font-size: 11pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
macos QMenu {
|
|
||||||
font-size: 13pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
#context-layout-container {
|
#context-layout-container {
|
||||||
background-color: %palette-base;
|
background-color: %palette-base;
|
||||||
}
|
}
|
||||||
@@ -71,3 +30,41 @@ macos QMenu {
|
|||||||
#context-layout-scrollarea {
|
#context-layout-scrollarea {
|
||||||
background-color: %palette-base;
|
background-color: %palette-base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QToolButton {
|
||||||
|
border: 2px solid transparent;
|
||||||
|
border-radius: 3px;
|
||||||
|
padding: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton:hover {
|
||||||
|
border: 2px solid %palette-highlight;
|
||||||
|
background-color: %palette-highlight-lighter;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton:pressed {
|
||||||
|
border: 2px solid %palette-highlight-darker;
|
||||||
|
background-color: %palette-highlight-lighter;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton[popupMode="MenuButtonPopup"], QToolButton:hover[popupMode="MenuButtonPopup"], QToolButton:pressed[popupMode="MenuButtonPopup"] {
|
||||||
|
padding-right: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* For backwards compatibility with Qt 5 as it does not support property name */
|
||||||
|
QToolButton[popupMode="1"], QToolButton:hover[popupMode="1"], QToolButton:pressed[popupMode="1"] {
|
||||||
|
padding-right: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton::menu-button {
|
||||||
|
width: 16px;
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
macos {
|
||||||
|
font-size: 11pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
macos QMenu {
|
||||||
|
font-size: 13pt;
|
||||||
|
}
|
||||||
|
|||||||
145
debian/copyright
vendored
@@ -1,10 +1,11 @@
|
|||||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
Upstream-Name: strawberry
|
Upstream-Name: strawberry
|
||||||
Upstream-Contact: Jonas Kvinge <jonas@jkvinge.net>
|
Upstream-Contact: Jonas Kvinge <jonas@jkvinge.net>
|
||||||
Source: https://www.strawberrymusicplayer.org/
|
Source: https://github.com/strawberrymusicplayer/strawberry
|
||||||
|
|
||||||
Files: *
|
Files: *
|
||||||
Copyright: 2010-2015, David Sansome <me@davidsansome.com>
|
Copyright: 2010-2015, David Sansome <me@davidsansome.com>
|
||||||
|
2012-2014, 2017-2022 Jonas Kvinge <jonas@jkvinge.net>
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: src/core/timeconstants.h
|
Files: src/core/timeconstants.h
|
||||||
@@ -13,14 +14,13 @@ Files: src/core/timeconstants.h
|
|||||||
ext/libstrawberry-common/core/messagehandler.cpp
|
ext/libstrawberry-common/core/messagehandler.cpp
|
||||||
ext/libstrawberry-common/core/messagehandler.h
|
ext/libstrawberry-common/core/messagehandler.h
|
||||||
Copyright: 2011, 2012, David Sansome <me@davidsansome.com>
|
Copyright: 2011, 2012, David Sansome <me@davidsansome.com>
|
||||||
|
2018-2022, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
License: Apache-2.0
|
License: Apache-2.0
|
||||||
|
|
||||||
Files: src/core/main.h
|
Files: src/core/main.h
|
||||||
src/core/iconloader.cpp
|
src/core/iconloader.cpp
|
||||||
src/core/iconloader.h
|
src/core/iconloader.h
|
||||||
src/core/iconmapper.h
|
src/core/iconmapper.h
|
||||||
src/config.h.in
|
|
||||||
src/version.h.in
|
|
||||||
src/context/contextview.cpp
|
src/context/contextview.cpp
|
||||||
src/context/contextview.h
|
src/context/contextview.h
|
||||||
src/context/contextalbum.cpp
|
src/context/contextalbum.cpp
|
||||||
@@ -29,6 +29,8 @@ Files: src/core/main.h
|
|||||||
src/engine/enginetype.h
|
src/engine/enginetype.h
|
||||||
src/engine/alsadevicefinder.cpp
|
src/engine/alsadevicefinder.cpp
|
||||||
src/engine/alsadevicefinder.h
|
src/engine/alsadevicefinder.h
|
||||||
|
src/engine/alsapcmdevicefinder.cpp
|
||||||
|
src/engine/alsapcmdevicefinder.h
|
||||||
src/engine/mmdevicefinder.cpp
|
src/engine/mmdevicefinder.cpp
|
||||||
src/engine/mmdevicefinder.h
|
src/engine/mmdevicefinder.h
|
||||||
src/engine/devicefinder.cpp
|
src/engine/devicefinder.cpp
|
||||||
@@ -69,8 +71,14 @@ Files: src/core/main.h
|
|||||||
src/covermanager/spotifycoverprovider.h
|
src/covermanager/spotifycoverprovider.h
|
||||||
src/covermanager/musixmatchcoverprovider.cpp
|
src/covermanager/musixmatchcoverprovider.cpp
|
||||||
src/covermanager/musixmatchcoverprovider.h
|
src/covermanager/musixmatchcoverprovider.h
|
||||||
src/globalshortcuts/globalshortcutsbackend-system.cpp
|
src/globalshortcuts/globalshortcutsbackend-kde.cpp
|
||||||
src/globalshortcuts/globalshortcutsbackend-system.h
|
src/globalshortcuts/globalshortcutsbackend-kde.h
|
||||||
|
src/globalshortcuts/globalshortcutsbackend-mate.cpp
|
||||||
|
src/globalshortcuts/globalshortcutsbackend-mate.h
|
||||||
|
src/globalshortcuts/globalshortcutsbackend-x11.cpp
|
||||||
|
src/globalshortcuts/globalshortcutsbackend-x11.h
|
||||||
|
src/globalshortcuts/globalshortcutsbackend-win.cpp
|
||||||
|
src/globalshortcuts/globalshortcutsbackend-win.h
|
||||||
src/globalshortcuts/globalshortcut.cpp
|
src/globalshortcuts/globalshortcut.cpp
|
||||||
src/globalshortcuts/globalshortcut.h
|
src/globalshortcuts/globalshortcut.h
|
||||||
src/globalshortcuts/globalshortcut-X11.cpp
|
src/globalshortcuts/globalshortcut-X11.cpp
|
||||||
@@ -81,127 +89,14 @@ Files: src/core/main.h
|
|||||||
src/scrobbler/*
|
src/scrobbler/*
|
||||||
src/subsonic/*
|
src/subsonic/*
|
||||||
src/tidal/*
|
src/tidal/*
|
||||||
|
src/qobuz/*
|
||||||
|
src/radios/*
|
||||||
src/transcoder/transcoderoptionswavpack.cpp
|
src/transcoder/transcoderoptionswavpack.cpp
|
||||||
src/transcoder/transcoderoptionswavpack.h
|
src/transcoder/transcoderoptionswavpack.h
|
||||||
Copyright: 2012-2014, 2017-2020, Jonas Kvinge <jonas@jkvinge.net>
|
ext/libstrawberry-tagreader/tagreadertagparser.cpp
|
||||||
License: GPL-3+
|
ext/libstrawberry-tagreader/tagreadertagparser.h
|
||||||
|
ext/macdeploycheck/*
|
||||||
Files: src/core/main.cpp
|
Copyright: 2012-2014, 2017-2022, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
src/core/mainwindow.cpp
|
|
||||||
src/core/mainwindow.h
|
|
||||||
src/core/player.cpp
|
|
||||||
src/core/player.h
|
|
||||||
src/core/song.cpp
|
|
||||||
src/core/song.h
|
|
||||||
src/core/songloader.cpp
|
|
||||||
src/core/songloader.h
|
|
||||||
src/core/urlhandler.cpp
|
|
||||||
src/core/urlhandler.h
|
|
||||||
src/core/utilities.cpp
|
|
||||||
src/core/utilities.h
|
|
||||||
src/core/networkaccessmanager.cpp
|
|
||||||
src/core/networkaccessmanager.h
|
|
||||||
src/core/threadsafenetworkdiskcache.cpp
|
|
||||||
src/core/threadsafenetworkdiskcache.h
|
|
||||||
src/core/filesystemmusicstorage.cpp
|
|
||||||
src/core/filesystemmusicstorage.h
|
|
||||||
src/core/stylesheetloader.cpp
|
|
||||||
src/core/stylesheetloader.h
|
|
||||||
src/engine/gstenginepipeline.cpp
|
|
||||||
src/engine/gstenginepipeline.h
|
|
||||||
src/engine/vlcengine.cpp
|
|
||||||
src/engine/vlcengine.h
|
|
||||||
src/collection/collectionwatcher.cpp
|
|
||||||
src/collection/collectionwatcher.h
|
|
||||||
src/collection/collectionbackend.cpp
|
|
||||||
src/collection/collectionbackend.h
|
|
||||||
src/collection/collectionmodel.cpp
|
|
||||||
src/collection/collectionmodel.h
|
|
||||||
src/context/contextalbumsmodel.cpp
|
|
||||||
src/context/contextalbumsview.cpp
|
|
||||||
src/context/contextalbumsmodel.h
|
|
||||||
src/context/contextalbumsview.h
|
|
||||||
src/widgets/playingwidget.cpp
|
|
||||||
src/widgets/playingwidget.h
|
|
||||||
src/osd/osdbase.cpp
|
|
||||||
src/osd/osdbase.h
|
|
||||||
src/osd/osdpretty.cpp
|
|
||||||
src/osd/osdpretty.h
|
|
||||||
src/osd/osddbus.cpp
|
|
||||||
src/osd/osddbus.h
|
|
||||||
src/osd/osdmac.cpp
|
|
||||||
src/osd/osdmac.h
|
|
||||||
src/dialogs/about.cpp
|
|
||||||
src/dialogs/about.h
|
|
||||||
src/playlist/playlist.cpp
|
|
||||||
src/playlist/playlist.h
|
|
||||||
src/playlist/playlistitem.cpp
|
|
||||||
src/playlist/playlistitem.h
|
|
||||||
src/playlist/playlistdelegates.cpp
|
|
||||||
src/playlist/playlistdelegates.h
|
|
||||||
src/playlist/playlistbackend.cpp
|
|
||||||
src/playlist/playlistbackend.h
|
|
||||||
src/playlist/playlistview.cpp
|
|
||||||
src/playlist/playlistview.h
|
|
||||||
src/playlist/songplaylistitem.cpp
|
|
||||||
src/playlist/songplaylistitem.h
|
|
||||||
src/internet/internetplaylistitem.cpp
|
|
||||||
src/internet/internetsearch.cpp
|
|
||||||
src/internet/internetsearch.h
|
|
||||||
src/internet/internetsearchview.cpp
|
|
||||||
src/internet/internetsearchview.h
|
|
||||||
src/internet/internetservices.cpp
|
|
||||||
src/internet/internetservices.h
|
|
||||||
src/internet/internetsongsview.cpp
|
|
||||||
src/internet/internetsongsview.h
|
|
||||||
src/internet/internetcollectionview.cpp
|
|
||||||
src/internet/internetcollectionview.h
|
|
||||||
ext/libstrawberry-tagreader/tagreader.cpp
|
|
||||||
ext/libstrawberry-tagreader/tagreader.h
|
|
||||||
src/device/devicemanager.cpp
|
|
||||||
src/device/devicemanager.h
|
|
||||||
src/device/deviceinfo.cpp
|
|
||||||
src/device/deviceinfo.h
|
|
||||||
src/device/deviceproperties.cpp
|
|
||||||
src/device/deviceproperties.h
|
|
||||||
src/device/deviceview.cpp
|
|
||||||
src/device/deviceview.h
|
|
||||||
src/device/connecteddevice.cpp
|
|
||||||
src/device/connecteddevice.h
|
|
||||||
src/device/mtpconnection.cpp
|
|
||||||
src/device/mtpconnection.h
|
|
||||||
src/device/mtpdevice.cpp
|
|
||||||
src/device/mtpdevice.h
|
|
||||||
src/globalshortcuts/globalshortcutsmanager.cpp
|
|
||||||
src/globalshortcuts/globalshortcutsmanager.h
|
|
||||||
src/settings/shortcutssettingspage.cpp
|
|
||||||
src/settings/shortcutssettingspage.h
|
|
||||||
src/settings/appearancesettingspage.cpp
|
|
||||||
src/settings/appearancesettingspage.h
|
|
||||||
src/organize/organize.cpp
|
|
||||||
src/organize/organize.h
|
|
||||||
src/organize/organizedialog.cpp
|
|
||||||
src/organize/organizedialog.h
|
|
||||||
src/organize/organizeerrordialog.cpp
|
|
||||||
src/organize/organizeerrordialog.h
|
|
||||||
src/transcoder/transcoder.cpp
|
|
||||||
src/transcoder/transcoder.h
|
|
||||||
src/musicbrainz/musicbrainzclient.cpp
|
|
||||||
src/musicbrainz/musicbrainzclient.h
|
|
||||||
src/covermanager/albumcoverloader.cpp
|
|
||||||
src/covermanager/albumcoverloader.h
|
|
||||||
src/covermanager/currentalbumcoverloader.cpp
|
|
||||||
src/covermanager/currentalbumcoverloader.h
|
|
||||||
src/covermanager/albumcoverchoicecontroller.cpp
|
|
||||||
src/covermanager/albumcoverchoicecontroller.h
|
|
||||||
src/covermanager/albumcoverfetchersearch.cpp
|
|
||||||
src/covermanager/albumcoverfetchersearch.h
|
|
||||||
src/covermanager/coverproviders.cpp
|
|
||||||
src/covermanager/coverproviders.h
|
|
||||||
src/covermanager/coverprovider.cpp
|
|
||||||
src/covermanager/coverprovider.h
|
|
||||||
Copyright: 2010, 2012-2014 David Sansome <me@davidsansome.com>
|
|
||||||
2012-2014, 2017-2020 Jonas Kvinge <jonas@jkvinge.net>
|
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: src/engine/enginebase.cpp
|
Files: src/engine/enginebase.cpp
|
||||||
@@ -367,7 +262,7 @@ Copyright: 2010, Spotify AB
|
|||||||
License: BSD-3-clause
|
License: BSD-3-clause
|
||||||
|
|
||||||
Files: 3rdparty/singleapplication/*
|
Files: 3rdparty/singleapplication/*
|
||||||
Copyright: 2015-2018, Itay Grudev
|
Copyright: 2015-2022, Itay Grudev
|
||||||
License: MIT
|
License: MIT
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
6
debian/copyright-scan-patterns.yml
vendored
@@ -4,14 +4,14 @@ ignore:
|
|||||||
- Changelog
|
- Changelog
|
||||||
- COPYING
|
- COPYING
|
||||||
- CMakeLists.txt
|
- CMakeLists.txt
|
||||||
- Dockerfile
|
- cmake_uninstall.cmake.in
|
||||||
|
- .clang-format
|
||||||
- .gitignore
|
- .gitignore
|
||||||
- .travis.yml
|
- .github
|
||||||
- /debian/
|
- /debian/
|
||||||
- /cmake/
|
- /cmake/
|
||||||
- /data/
|
- /data/
|
||||||
- /dist/
|
- /dist/
|
||||||
- /snap/
|
|
||||||
|
|
||||||
suffixes:
|
suffixes:
|
||||||
- jpg
|
- jpg
|
||||||
|
|||||||
58
dist/macos/macgstcopy.sh
vendored
@@ -39,8 +39,12 @@ fi
|
|||||||
cp -v -f "${GST_PLUGIN_SCANNER}" "${bundledir}/Contents/PlugIns/" || exit 1
|
cp -v -f "${GST_PLUGIN_SCANNER}" "${bundledir}/Contents/PlugIns/" || exit 1
|
||||||
|
|
||||||
gst_plugins="
|
gst_plugins="
|
||||||
|
libgstaes.dylib
|
||||||
|
libgstaiff.dylib
|
||||||
libgstapetag.dylib
|
libgstapetag.dylib
|
||||||
libgstapp.dylib
|
libgstapp.dylib
|
||||||
|
libgstasf.dylib
|
||||||
|
libgstasfmux.dylib
|
||||||
libgstaudioconvert.dylib
|
libgstaudioconvert.dylib
|
||||||
libgstaudiofx.dylib
|
libgstaudiofx.dylib
|
||||||
libgstaudiomixer.dylib
|
libgstaudiomixer.dylib
|
||||||
@@ -48,46 +52,46 @@ libgstaudioparsers.dylib
|
|||||||
libgstaudiorate.dylib
|
libgstaudiorate.dylib
|
||||||
libgstaudioresample.dylib
|
libgstaudioresample.dylib
|
||||||
libgstaudiotestsrc.dylib
|
libgstaudiotestsrc.dylib
|
||||||
libgstaudiovisualizers.dylib
|
|
||||||
libgstauparse.dylib
|
|
||||||
libgstautoconvert.dylib
|
|
||||||
libgstautodetect.dylib
|
libgstautodetect.dylib
|
||||||
|
libgstbs2b.dylib
|
||||||
|
libgstcdio.dylib
|
||||||
libgstcoreelements.dylib
|
libgstcoreelements.dylib
|
||||||
|
libgstdash.dylib
|
||||||
libgstequalizer.dylib
|
libgstequalizer.dylib
|
||||||
|
libgstflac.dylib
|
||||||
|
libgstfaac.dylib
|
||||||
|
libgstfaad.dylib
|
||||||
|
libgstfdkaac.dylib
|
||||||
libgstgio.dylib
|
libgstgio.dylib
|
||||||
libgsticydemux.dylib
|
libgsticydemux.dylib
|
||||||
libgstid3demux.dylib
|
libgstid3demux.dylib
|
||||||
libgstlevel.dylib
|
libgstisomp4.dylib
|
||||||
|
libgstlame.dylib
|
||||||
|
libgstlibav.dylib
|
||||||
|
libgstmpg123.dylib
|
||||||
|
libgstmusepack.dylib
|
||||||
|
libgstogg.dylib
|
||||||
|
libgstopenmpt.dylib
|
||||||
|
libgstopus.dylib
|
||||||
|
libgstopusparse.dylib
|
||||||
libgstosxaudio.dylib
|
libgstosxaudio.dylib
|
||||||
libgstplayback.dylib
|
|
||||||
libgstrawparse.dylib
|
|
||||||
libgstreplaygain.dylib
|
|
||||||
libgstsoup.dylib
|
|
||||||
libgstspectrum.dylib
|
|
||||||
libgsttypefindfunctions.dylib
|
|
||||||
libgstvolume.dylib
|
|
||||||
libgstxingmux.dylib
|
|
||||||
libgsttcp.dylib
|
|
||||||
libgstudp.dylib
|
|
||||||
libgstpbtypes.dylib
|
libgstpbtypes.dylib
|
||||||
|
libgstplayback.dylib
|
||||||
|
libgstreplaygain.dylib
|
||||||
libgstrtp.dylib
|
libgstrtp.dylib
|
||||||
libgstrtsp.dylib
|
libgstrtsp.dylib
|
||||||
libgstflac.dylib
|
libgstsoup.dylib
|
||||||
libgstwavparse.dylib
|
libgstspectrum.dylib
|
||||||
libgstfaad.dylib
|
|
||||||
libgstogg.dylib
|
|
||||||
libgstopus.dylib
|
|
||||||
libgstasf.dylib
|
|
||||||
libgstspeex.dylib
|
libgstspeex.dylib
|
||||||
libgsttaglib.dylib
|
libgsttaglib.dylib
|
||||||
|
libgsttcp.dylib
|
||||||
|
libgsttypefindfunctions.dylib
|
||||||
|
libgstudp.dylib
|
||||||
|
libgstvolume.dylib
|
||||||
libgstvorbis.dylib
|
libgstvorbis.dylib
|
||||||
libgstisomp4.dylib
|
libgstwavpack.dylib
|
||||||
libgstlibav.dylib
|
libgstwavparse.dylib
|
||||||
libgstaiff.dylib
|
libgstxingmux.dylib;
|
||||||
libgstlame.dylib
|
|
||||||
libgstopusparse.dylib
|
|
||||||
libgstfaac.dylib
|
|
||||||
libgstmusepack.dylib
|
|
||||||
"
|
"
|
||||||
|
|
||||||
gst_plugins=$(echo "$gst_plugins" | tr '\n' ' ' | sed -e 's/^ //g' | sed -e 's/ / /g')
|
gst_plugins=$(echo "$gst_plugins" | tr '\n' ' ' | sed -e 's/^ //g' | sed -e 's/ / /g')
|
||||||
|
|||||||
179
dist/scripts/import-from-clementine.sh
vendored
Executable file
@@ -0,0 +1,179 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Strawberry Music Player
|
||||||
|
# Copyright 2020, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
|
# 2021 Alexey Vazhnov
|
||||||
|
#
|
||||||
|
# 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/>.
|
||||||
|
# SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
|
||||||
|
# Based on https://github.com/strawberrymusicplayer/strawberry/wiki/Import-collection-library-and-playlists-data-from-Clementine
|
||||||
|
|
||||||
|
set -o nounset
|
||||||
|
set -o errexit
|
||||||
|
set -o pipefail
|
||||||
|
shopt -s dotglob
|
||||||
|
|
||||||
|
# Use hardcoded path if no parameters. No need in quotes here! See `man bash`, "Parameter Expansion":
|
||||||
|
FILE_SRC=${1:-~/.config/Clementine/clementine.db}
|
||||||
|
FILE_DST=${2:-~/.local/share/strawberry/strawberry/strawberry.db}
|
||||||
|
|
||||||
|
test -f "$FILE_SRC" || { echo "No such file: $FILE_SRC"; exit 1; }
|
||||||
|
test -f "$FILE_DST" || { echo "No such file: $FILE_DST"; exit 1; }
|
||||||
|
|
||||||
|
echo "Will try to copy information from $FILE_SRC to $FILE_DST."
|
||||||
|
echo
|
||||||
|
echo 'This script will **delete all information** from Strawberry database!'
|
||||||
|
read -r -p 'Do you want to continue? (the only YES is accepted) ' answer
|
||||||
|
if [ "$answer" != "YES" ]; then exit 1; fi
|
||||||
|
|
||||||
|
# 'heredoc' with substitution of variables, see `man bash`, "Here Documents":
|
||||||
|
sqlite3 -batch << EOF
|
||||||
|
.echo on
|
||||||
|
ATTACH '$FILE_DST' AS strawberry;
|
||||||
|
ATTACH '$FILE_SRC' AS clementine;
|
||||||
|
.bail on
|
||||||
|
.databases
|
||||||
|
|
||||||
|
/* This must be done when importing all data from Clementine because playlists are based on ROWIDs */
|
||||||
|
|
||||||
|
DELETE FROM strawberry.directories;
|
||||||
|
DELETE FROM strawberry.subdirectories;
|
||||||
|
DELETE FROM strawberry.songs;
|
||||||
|
DELETE FROM strawberry.playlists;
|
||||||
|
DELETE FROM strawberry.playlist_items;
|
||||||
|
|
||||||
|
/* Import all data from the collection library songs */
|
||||||
|
|
||||||
|
INSERT INTO strawberry.directories (path, subdirs) SELECT path, subdirs FROM clementine.directories;
|
||||||
|
INSERT INTO strawberry.subdirectories (directory_id, path, mtime) SELECT directory, path, mtime FROM clementine.subdirectories;
|
||||||
|
INSERT INTO strawberry.songs (ROWID, title, album, artist, albumartist, track, disc, year, originalyear, genre, compilation, composer, performer, grouping, comment, lyrics, beginning, length, bitrate, samplerate, directory_id, url, filetype, filesize, mtime, ctime, unavailable, playcount, skipcount, lastplayed, compilation_detected, compilation_on, compilation_off, compilation_effective, art_automatic, art_manual, effective_albumartist, effective_originalyear, cue_path, rating)
|
||||||
|
SELECT ROWID, title, album, artist, albumartist, track, disc, year, originalyear, genre, compilation, composer, performer, grouping, comment, lyrics, beginning, length, bitrate, samplerate, directory, filename, filetype, filesize, mtime, ctime, unavailable, playcount, skipcount, lastplayed, sampler, forced_compilation_on, forced_compilation_off, effective_compilation, art_automatic, art_manual, effective_albumartist, effective_originalyear, cue_path, rating FROM clementine.songs WHERE unavailable = 0;
|
||||||
|
UPDATE strawberry.songs SET source = 2;
|
||||||
|
UPDATE strawberry.songs SET artist_id = "";
|
||||||
|
UPDATE strawberry.songs SET album_id = "";
|
||||||
|
UPDATE strawberry.songs SET song_id = "";
|
||||||
|
|
||||||
|
/* Import playlists */
|
||||||
|
|
||||||
|
INSERT INTO strawberry.playlists (ROWID, name, last_played, special_type, ui_path, is_favorite, dynamic_playlist_type, dynamic_playlist_data, dynamic_playlist_backend)
|
||||||
|
SELECT ROWID, name, last_played, special_type, ui_path, is_favorite, dynamic_playlist_type, dynamic_playlist_data, dynamic_playlist_backend FROM clementine.playlists WHERE dynamic_playlist_type ISNULL;
|
||||||
|
|
||||||
|
/* Import playlist items */
|
||||||
|
|
||||||
|
INSERT INTO strawberry.playlist_items
|
||||||
|
(ROWID,
|
||||||
|
playlist,
|
||||||
|
collection_id,
|
||||||
|
title,
|
||||||
|
album,
|
||||||
|
artist,
|
||||||
|
albumartist,
|
||||||
|
track,
|
||||||
|
disc,
|
||||||
|
year,
|
||||||
|
originalyear,
|
||||||
|
genre,
|
||||||
|
compilation,
|
||||||
|
composer,
|
||||||
|
performer,
|
||||||
|
grouping,
|
||||||
|
comment,
|
||||||
|
lyrics,
|
||||||
|
beginning,
|
||||||
|
length,
|
||||||
|
bitrate,
|
||||||
|
samplerate,
|
||||||
|
directory_id,
|
||||||
|
url,
|
||||||
|
filetype,
|
||||||
|
filesize,
|
||||||
|
mtime,
|
||||||
|
ctime,
|
||||||
|
unavailable,
|
||||||
|
playcount,
|
||||||
|
skipcount,
|
||||||
|
lastplayed,
|
||||||
|
compilation_detected,
|
||||||
|
compilation_on,
|
||||||
|
compilation_off,
|
||||||
|
compilation_effective,
|
||||||
|
art_automatic,
|
||||||
|
art_manual,
|
||||||
|
effective_albumartist,
|
||||||
|
effective_originalyear,
|
||||||
|
cue_path,
|
||||||
|
rating
|
||||||
|
)
|
||||||
|
SELECT ROWID,
|
||||||
|
playlist,
|
||||||
|
library_id,
|
||||||
|
title,
|
||||||
|
album,
|
||||||
|
artist,
|
||||||
|
albumartist,
|
||||||
|
track,
|
||||||
|
disc,
|
||||||
|
year,
|
||||||
|
originalyear,
|
||||||
|
genre,
|
||||||
|
compilation,
|
||||||
|
composer,
|
||||||
|
performer,
|
||||||
|
grouping,
|
||||||
|
comment,
|
||||||
|
lyrics,
|
||||||
|
beginning,
|
||||||
|
length,
|
||||||
|
bitrate,
|
||||||
|
samplerate,
|
||||||
|
directory,
|
||||||
|
filename,
|
||||||
|
filetype,
|
||||||
|
filesize,
|
||||||
|
mtime,
|
||||||
|
ctime,
|
||||||
|
unavailable,
|
||||||
|
playcount,
|
||||||
|
skipcount,
|
||||||
|
lastplayed,
|
||||||
|
sampler,
|
||||||
|
forced_compilation_on,
|
||||||
|
forced_compilation_off,
|
||||||
|
effective_compilation,
|
||||||
|
art_automatic,
|
||||||
|
art_manual,
|
||||||
|
effective_albumartist,
|
||||||
|
effective_originalyear,
|
||||||
|
cue_path,
|
||||||
|
rating FROM clementine.playlist_items WHERE type = 'Library';
|
||||||
|
|
||||||
|
UPDATE strawberry.playlist_items SET source = 2;
|
||||||
|
UPDATE strawberry.playlist_items SET type = 2;
|
||||||
|
UPDATE strawberry.playlist_items SET artist_id = "";
|
||||||
|
UPDATE strawberry.playlist_items SET album_id = "";
|
||||||
|
UPDATE strawberry.playlist_items SET song_id = "";
|
||||||
|
|
||||||
|
/* Recreate the FTS tables */
|
||||||
|
|
||||||
|
DELETE FROM strawberry.songs_fts;
|
||||||
|
INSERT INTO strawberry.songs_fts (ROWID, ftstitle, ftsalbum, ftsartist, ftsalbumartist, ftscomposer, ftsperformer, ftsgrouping, ftsgenre, ftscomment)
|
||||||
|
SELECT ROWID, title, album, artist, albumartist, composer, performer, grouping, genre, comment
|
||||||
|
FROM strawberry.songs;
|
||||||
|
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# To be sure script didn't exit because of any error (because we use `set -o errexit`):
|
||||||
|
echo "Script finished"
|
||||||
25
dist/scripts/maketarball.sh.in
vendored
@@ -11,10 +11,33 @@ if ! [ "$gitrev" = "ON" ]; then
|
|||||||
exclude_vcs="--exclude-vcs"
|
exclude_vcs="--exclude-vcs"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cmds="gtar tar"
|
||||||
|
for cmd in $cmds
|
||||||
|
do
|
||||||
|
which $cmd >/dev/null 2>&1
|
||||||
|
if [ ! $? -eq 0 ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
result=$($cmd --version 2>&1 | head -n1)
|
||||||
|
if [ ! $? -eq 0 ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo "$result" | grep "^.* (GNU tar) .*$" >/dev/null 2>&1
|
||||||
|
if [ ! $? -eq 0 ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
TAR=$cmd
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$TAR" = "" ]; then
|
||||||
|
echo "ERROR: Missing GNU Tar"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Creating $name-$version.tar.xz..."
|
echo "Creating $name-$version.tar.xz..."
|
||||||
|
|
||||||
rm -f "$name-$version.tar.xz"
|
rm -f "$name-$version.tar.xz"
|
||||||
tar -cJf $name-$version.tar.xz \
|
${TAR} -cJf $name-$version.tar.xz \
|
||||||
--transform "s,^$rootnoslash,$name-$version," $exclude_vcs \
|
--transform "s,^$rootnoslash,$name-$version," $exclude_vcs \
|
||||||
--exclude=".directory" \
|
--exclude=".directory" \
|
||||||
--exclude="*.tar" \
|
--exclude="*.tar" \
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<component>
|
<component type="desktop-application">
|
||||||
<id>org.strawberrymusicplayer.strawberry</id>
|
<id>org.strawberrymusicplayer.strawberry</id>
|
||||||
<launchable type="desktop-id">org.strawberrymusicplayer.strawberry.desktop</launchable>
|
<launchable type="desktop-id">org.strawberrymusicplayer.strawberry.desktop</launchable>
|
||||||
<metadata_license>CC0-1.0</metadata_license>
|
<metadata_license>CC0-1.0</metadata_license>
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
<url type="homepage">https://www.strawberrymusicplayer.org/</url>
|
<url type="homepage">https://www.strawberrymusicplayer.org/</url>
|
||||||
<url type="bugtracker">https://github.com/strawberrymusicplayer/strawberry/</url>
|
<url type="bugtracker">https://github.com/strawberrymusicplayer/strawberry/</url>
|
||||||
<translation type="qt">strawberry</translation>
|
<translation type="qt">strawberry</translation>
|
||||||
|
<content_rating type="oars-1.1" />
|
||||||
<description>
|
<description>
|
||||||
<p>
|
<p>
|
||||||
Strawberry is a music player and music collection organizer. It is aimed at music collectors and audiophiles. With Strawberry you can play and manage your digital music collection, or stream your favorite radios. It also has unofficial streaming support for Tidal and Qobuz. Strawberry is free software released under GPL. The source code is available on GitHub. It's written in C++ using the Qt toolkit and GStreamer. Strawberry is compatible with both Qt version 5 and 6.
|
Strawberry is a music player and music collection organizer. It is aimed at music collectors and audiophiles. With Strawberry you can play and manage your digital music collection, or stream your favorite radios. It also has unofficial streaming support for Tidal and Qobuz. Strawberry is free software released under GPL. The source code is available on GitHub. It's written in C++ using the Qt toolkit and GStreamer. Strawberry is compatible with both Qt version 5 and 6.
|
||||||
@@ -48,4 +49,7 @@
|
|||||||
</screenshot>
|
</screenshot>
|
||||||
</screenshots>
|
</screenshots>
|
||||||
<update_contact>eclipseo@fedoraproject.org</update_contact>
|
<update_contact>eclipseo@fedoraproject.org</update_contact>
|
||||||
|
<releases>
|
||||||
|
<release version="1.0.0" date="2021-10-16"/>
|
||||||
|
</releases>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
8
dist/unix/strawberry.spec.in
vendored
@@ -1,6 +1,6 @@
|
|||||||
Name: strawberry
|
Name: strawberry
|
||||||
Version: @STRAWBERRY_VERSION_RPM_V@
|
Version: @STRAWBERRY_VERSION_RPM_V@
|
||||||
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos}
|
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos} || "%{?_vendor}" == "openmandriva"
|
||||||
Release: @STRAWBERRY_VERSION_RPM_R@%{?dist}
|
Release: @STRAWBERRY_VERSION_RPM_R@%{?dist}
|
||||||
%else
|
%else
|
||||||
Release: @STRAWBERRY_VERSION_RPM_R@.@RPM_DISTRO@
|
Release: @STRAWBERRY_VERSION_RPM_R@.@RPM_DISTRO@
|
||||||
@@ -137,8 +137,8 @@ Features:
|
|||||||
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos}
|
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos}
|
||||||
export CXXFLAGS="-fPIC $RPM_OPT_FLAGS"
|
export CXXFLAGS="-fPIC $RPM_OPT_FLAGS"
|
||||||
%endif
|
%endif
|
||||||
%{cmake} -DCMAKE_BUILD_TYPE:STRING=Release -DQT_VERSION_MAJOR=@QT_VERSION_MAJOR@
|
%{cmake} -DQT_VERSION_MAJOR=@QT_VERSION_MAJOR@
|
||||||
%if 0%{?centos} || (0%{?mageia} && 0%{?mageia} <= 7)
|
%if 0%{?centos} || (0%{?mageia} && 0%{?mageia} <= 7) || "%{?_vendor}" == "openmandriva"
|
||||||
%make_build
|
%make_build
|
||||||
%else
|
%else
|
||||||
%cmake_build
|
%cmake_build
|
||||||
@@ -148,7 +148,7 @@ Features:
|
|||||||
%if 0%{?centos}
|
%if 0%{?centos}
|
||||||
%make_install
|
%make_install
|
||||||
%else
|
%else
|
||||||
%if 0%{?mageia}
|
%if 0%{?mageia} || "%{?_vendor}" == "openmandriva"
|
||||||
%make_install -C build
|
%make_install -C build
|
||||||
%else
|
%else
|
||||||
%cmake_install
|
%cmake_install
|
||||||
|
|||||||
186
dist/windows/Registry.nsh
vendored
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
!define registry::Open `!insertmacro registry::Open`
|
||||||
|
|
||||||
|
!macro registry::Open _PATH _OPTIONS _HANDLE
|
||||||
|
registry::_Open /NOUNLOAD `${_PATH}` `${_OPTIONS}`
|
||||||
|
Pop ${_HANDLE}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::Find `!insertmacro registry::Find`
|
||||||
|
|
||||||
|
!macro registry::Find _HANDLE _PATH _VALUEORKEY _STRING _TYPE
|
||||||
|
registry::_Find /NOUNLOAD `${_HANDLE}`
|
||||||
|
Pop ${_PATH}
|
||||||
|
Pop ${_VALUEORKEY}
|
||||||
|
Pop ${_STRING}
|
||||||
|
Pop ${_TYPE}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::Close `!insertmacro registry::Close`
|
||||||
|
|
||||||
|
!macro registry::Close _HANDLE
|
||||||
|
registry::_Close /NOUNLOAD `${_HANDLE}`
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::KeyExists `!insertmacro registry::KeyExists`
|
||||||
|
|
||||||
|
!macro registry::KeyExists _PATH _ERR
|
||||||
|
registry::_KeyExists /NOUNLOAD `${_PATH}`
|
||||||
|
Pop ${_ERR}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::Read `!insertmacro registry::Read`
|
||||||
|
|
||||||
|
!macro registry::Read _PATH _VALUE _STRING _TYPE
|
||||||
|
registry::_Read /NOUNLOAD `${_PATH}` `${_VALUE}`
|
||||||
|
Pop ${_STRING}
|
||||||
|
Pop ${_TYPE}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::Write `!insertmacro registry::Write`
|
||||||
|
|
||||||
|
!macro registry::Write _PATH _VALUE _STRING _TYPE _ERR
|
||||||
|
registry::_Write /NOUNLOAD `${_PATH}` `${_VALUE}` `${_STRING}` `${_TYPE}`
|
||||||
|
Pop ${_ERR}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::ReadExtra `!insertmacro registry::ReadExtra`
|
||||||
|
|
||||||
|
!macro registry::ReadExtra _PATH _VALUE _NUMBER _STRING _TYPE
|
||||||
|
registry::_ReadExtra /NOUNLOAD `${_PATH}` `${_VALUE}` `${_NUMBER}`
|
||||||
|
Pop ${_STRING}
|
||||||
|
Pop ${_TYPE}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::WriteExtra `!insertmacro registry::WriteExtra`
|
||||||
|
|
||||||
|
!macro registry::WriteExtra _PATH _VALUE _STRING _ERR
|
||||||
|
registry::_WriteExtra /NOUNLOAD `${_PATH}` `${_VALUE}` `${_STRING}`
|
||||||
|
Pop ${_ERR}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::CreateKey `!insertmacro registry::CreateKey`
|
||||||
|
|
||||||
|
!macro registry::CreateKey _PATH _ERR
|
||||||
|
registry::_CreateKey /NOUNLOAD `${_PATH}`
|
||||||
|
Pop ${_ERR}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::DeleteValue `!insertmacro registry::DeleteValue`
|
||||||
|
|
||||||
|
!macro registry::DeleteValue _PATH _VALUE _ERR
|
||||||
|
registry::_DeleteValue /NOUNLOAD `${_PATH}` `${_VALUE}`
|
||||||
|
Pop ${_ERR}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::DeleteKey `!insertmacro registry::DeleteKey`
|
||||||
|
|
||||||
|
!macro registry::DeleteKey _PATH _ERR
|
||||||
|
registry::_DeleteKey /NOUNLOAD `${_PATH}`
|
||||||
|
Pop ${_ERR}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::DeleteKeyEmpty `!insertmacro registry::DeleteKeyEmpty`
|
||||||
|
|
||||||
|
!macro registry::DeleteKeyEmpty _PATH _ERR
|
||||||
|
registry::_DeleteKeyEmpty /NOUNLOAD `${_PATH}`
|
||||||
|
Pop ${_ERR}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::CopyValue `!insertmacro registry::CopyValue`
|
||||||
|
|
||||||
|
!macro registry::CopyValue _PATH_SOURCE _VALUE_SOURCE _PATH_TARGET _VALUE_TARGET _ERR
|
||||||
|
registry::_CopyValue /NOUNLOAD `${_PATH_SOURCE}` `${_VALUE_SOURCE}` `${_PATH_TARGET}` `${_VALUE_TARGET}`
|
||||||
|
Pop ${_ERR}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::MoveValue `!insertmacro registry::MoveValue`
|
||||||
|
|
||||||
|
!macro registry::MoveValue _PATH_SOURCE _VALUE_SOURCE _PATH_TARGET _VALUE_TARGET _ERR
|
||||||
|
registry::_MoveValue /NOUNLOAD `${_PATH_SOURCE}` `${_VALUE_SOURCE}` `${_PATH_TARGET}` `${_VALUE_TARGET}`
|
||||||
|
Pop ${_ERR}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::CopyKey `!insertmacro registry::CopyKey`
|
||||||
|
|
||||||
|
!macro registry::CopyKey _PATH_SOURCE _PATH_TARGET _ERR
|
||||||
|
registry::_CopyKey /NOUNLOAD `${_PATH_SOURCE}` `${_PATH_TARGET}`
|
||||||
|
Pop ${_ERR}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::MoveKey `!insertmacro registry::MoveKey`
|
||||||
|
|
||||||
|
!macro registry::MoveKey _PATH_SOURCE _PATH_TARGET _ERR
|
||||||
|
registry::_MoveKey /NOUNLOAD `${_PATH_SOURCE}` `${_PATH_TARGET}`
|
||||||
|
Pop ${_ERR}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::SaveKey `!insertmacro registry::SaveKey`
|
||||||
|
|
||||||
|
!macro registry::SaveKey _PATH _FILE _OPTIONS _ERR
|
||||||
|
registry::_SaveKey /NOUNLOAD `${_PATH}` `${_FILE}` `${_OPTIONS}`
|
||||||
|
Pop ${_ERR}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::RestoreKey `!insertmacro registry::RestoreKey`
|
||||||
|
|
||||||
|
!macro registry::RestoreKey _FILE _ERR
|
||||||
|
registry::_RestoreKey /NOUNLOAD `${_FILE}`
|
||||||
|
Pop ${_ERR}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::StrToHex `!insertmacro registry::StrToHexA`
|
||||||
|
!define registry::StrToHexA `!insertmacro registry::StrToHexA`
|
||||||
|
|
||||||
|
!macro registry::StrToHexA _STRING _HEX_STRING
|
||||||
|
registry::_StrToHexA /NOUNLOAD `${_STRING}`
|
||||||
|
Pop ${_HEX_STRING}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::StrToHexW `!insertmacro registry::StrToHexW`
|
||||||
|
|
||||||
|
!macro registry::StrToHexW _STRING _HEX_STRING
|
||||||
|
registry::_StrToHexW /NOUNLOAD `${_STRING}`
|
||||||
|
Pop ${_HEX_STRING}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::HexToStr `!insertmacro registry::HexToStrA`
|
||||||
|
!define registry::HexToStrA `!insertmacro registry::HexToStrA`
|
||||||
|
|
||||||
|
!macro registry::HexToStrA _HEX_STRING _STRING
|
||||||
|
registry::_HexToStrA /NOUNLOAD `${_HEX_STRING}`
|
||||||
|
Pop ${_STRING}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
!define registry::HexToStrW `!insertmacro registry::HexToStrW`
|
||||||
|
|
||||||
|
!macro registry::HexToStrW _HEX_STRING _STRING
|
||||||
|
registry::_HexToStrW /NOUNLOAD `${_HEX_STRING}`
|
||||||
|
Pop ${_STRING}
|
||||||
|
!macroend
|
||||||
|
|
||||||
|
|
||||||
|
!define registry::Unload `!insertmacro registry::Unload`
|
||||||
|
|
||||||
|
!macro registry::Unload
|
||||||
|
registry::_Unload
|
||||||
|
!macroend
|
||||||
734
dist/windows/strawberry.nsi.in
vendored
@@ -1,25 +1,51 @@
|
|||||||
!if "@ARCH@" == x86
|
!define build_type ""
|
||||||
|
!define compiler "unknown"
|
||||||
|
!define arch "unknown"
|
||||||
|
|
||||||
|
!if "@ARCH@" == "x86"
|
||||||
!define arch_x86
|
!define arch_x86
|
||||||
|
!undef arch
|
||||||
|
!define arch "x86"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!if "@ARCH@" == i686-w64-mingw32.shared
|
!if "@ARCH@" == "i686-w64-mingw32.shared"
|
||||||
!define arch_x86
|
!define arch_x86
|
||||||
|
!undef arch
|
||||||
|
!define arch "x86"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!if "@ARCH@" == x86_64
|
!if "@ARCH@" == "x86_64"
|
||||||
!define arch_x64
|
!define arch_x64
|
||||||
|
!undef arch
|
||||||
|
!define arch "x64"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!if "@ARCH@" == x86_64-w64-mingw32.shared
|
!if "@ARCH@" == "x86_64-w64-mingw32.shared"
|
||||||
!define arch_x64
|
!define arch_x64
|
||||||
|
!undef arch
|
||||||
|
!define arch "x64"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!if "@CMAKE_BUILD_TYPE@" == Debug
|
!if "@MINGW@" == "1"
|
||||||
|
!define mingw
|
||||||
|
!undef compiler
|
||||||
|
!define compiler "mingw"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "@MSVC@" == "1"
|
||||||
|
!define msvc
|
||||||
|
!undef compiler
|
||||||
|
!define compiler "msvc"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "@CMAKE_BUILD_TYPE@" == "Release"
|
||||||
|
!define release
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!if "@CMAKE_BUILD_TYPE@" == "Debug"
|
||||||
!define debug
|
!define debug
|
||||||
!endif
|
!undef build_type
|
||||||
|
!define build_type "-Debug"
|
||||||
!if "@BUILD_WITH_QT6@" == "ON"
|
|
||||||
!define with_qt6
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!ifdef debug
|
!ifdef debug
|
||||||
@@ -74,14 +100,27 @@ SetCompressor /SOLID lzma
|
|||||||
!include "FileAssociation.nsh"
|
!include "FileAssociation.nsh"
|
||||||
!include "Capabilities.nsh"
|
!include "Capabilities.nsh"
|
||||||
!include LogicLib.nsh
|
!include LogicLib.nsh
|
||||||
|
!include Registry.nsh
|
||||||
!include x64.nsh
|
!include x64.nsh
|
||||||
|
|
||||||
!define MUI_ICON "strawberry.ico"
|
!define MUI_ICON "strawberry.ico"
|
||||||
|
|
||||||
!define MUI_COMPONENTSPAGE_SMALLDESC
|
!define MUI_COMPONENTSPAGE_SMALLDESC
|
||||||
|
|
||||||
ReserveFile "${NSISDIR}/Plugins/x86-unicode/LockedList.dll"
|
!ifdef mingw
|
||||||
ReserveFile "${NSISDIR}/Plugins/LockedList64.dll"
|
ReserveFile "${NSISDIR}/Plugins/x86-unicode/LockedList.dll"
|
||||||
|
ReserveFile "${NSISDIR}/Plugins/LockedList64.dll"
|
||||||
|
ReserveFile "${NSISDIR}/Plugins/registry.dll"
|
||||||
|
ReserveFile "${NSISDIR}/Plugins/x86-unicode/INetC.dll"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!ifdef msvc
|
||||||
|
ReserveFile "${NSISDIR}\Plugins\x86-unicode\LockedList.dll"
|
||||||
|
ReserveFile "${NSISDIR}\Plugins\LockedList64.dll"
|
||||||
|
ReserveFile "${NSISDIR}\Plugins\registry.dll"
|
||||||
|
ReserveFile "${NSISDIR}\Plugins\x86-unicode\INetC.dll"
|
||||||
|
!endif
|
||||||
|
|
||||||
!define LockedListPATH $InstallDir
|
!define LockedListPATH $InstallDir
|
||||||
|
|
||||||
; Installer pages
|
; Installer pages
|
||||||
@@ -101,37 +140,8 @@ UninstPage custom un.LockedListPageShow
|
|||||||
!insertmacro MUI_LANGUAGE "English" ;first language is the default language
|
!insertmacro MUI_LANGUAGE "English" ;first language is the default language
|
||||||
|
|
||||||
Name "${PRODUCT_NAME}"
|
Name "${PRODUCT_NAME}"
|
||||||
!ifdef arch_x86
|
|
||||||
!ifdef debug
|
|
||||||
!ifdef with_qt6
|
|
||||||
OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-Qt6-Debug-x86.exe"
|
|
||||||
!else
|
|
||||||
OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-Qt5-Debug-x86.exe"
|
|
||||||
!endif
|
|
||||||
!else
|
|
||||||
!ifdef with_qt6
|
|
||||||
OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-Qt6-x86.exe"
|
|
||||||
!else
|
|
||||||
OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-Qt5-x86.exe"
|
|
||||||
!endif
|
|
||||||
!endif
|
|
||||||
!endif
|
|
||||||
|
|
||||||
!ifdef arch_x64
|
OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}${build_type}-${compiler}-${arch}.exe"
|
||||||
!ifdef debug
|
|
||||||
!ifdef with_qt6
|
|
||||||
OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-Qt6-Debug-x64.exe"
|
|
||||||
!else
|
|
||||||
OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-Qt5-Debug-x64.exe"
|
|
||||||
!endif
|
|
||||||
!else
|
|
||||||
!ifdef with_qt6
|
|
||||||
OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-Qt6-x64.exe"
|
|
||||||
!else
|
|
||||||
OutFile "${PRODUCT_NAME_SHORT}Setup-${PRODUCT_DISPLAY_VERSION}-Qt5-x64.exe"
|
|
||||||
!endif
|
|
||||||
!endif
|
|
||||||
!endif
|
|
||||||
|
|
||||||
InstallDir "${PRODUCT_INSTALL_DIR}"
|
InstallDir "${PRODUCT_INSTALL_DIR}"
|
||||||
|
|
||||||
@@ -186,6 +196,8 @@ SectionEnd
|
|||||||
Section "Strawberry" Strawberry
|
Section "Strawberry" Strawberry
|
||||||
SetOutPath "$INSTDIR"
|
SetOutPath "$INSTDIR"
|
||||||
|
|
||||||
|
; Common executables
|
||||||
|
|
||||||
File "strawberry.exe"
|
File "strawberry.exe"
|
||||||
File "strawberry-tagreader.exe"
|
File "strawberry-tagreader.exe"
|
||||||
File "strawberry.ico"
|
File "strawberry.ico"
|
||||||
@@ -193,45 +205,53 @@ Section "Strawberry" Strawberry
|
|||||||
File "gst-launch-1.0.exe"
|
File "gst-launch-1.0.exe"
|
||||||
File "gst-discoverer-1.0.exe"
|
File "gst-discoverer-1.0.exe"
|
||||||
|
|
||||||
|
; MinGW specific files
|
||||||
|
|
||||||
|
!ifdef mingw
|
||||||
|
|
||||||
!ifdef arch_x86
|
!ifdef arch_x86
|
||||||
File "libgcc_s_sjlj-1.dll"
|
File "libgcc_s_sjlj-1.dll"
|
||||||
File "libcrypto-3.dll"
|
File "libcrypto-3.dll"
|
||||||
File "libssl-3.dll"
|
File "libssl-3.dll"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
!ifdef arch_x64
|
!ifdef arch_x64
|
||||||
File "libgcc_s_seh-1.dll"
|
File "libgcc_s_seh-1.dll"
|
||||||
File "libcrypto-3-x64.dll"
|
File "libcrypto-3-x64.dll"
|
||||||
File "libssl-3-x64.dll"
|
File "libssl-3-x64.dll"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
File "avcodec-58.dll"
|
File "avcodec-59.dll"
|
||||||
File "avfilter-7.dll"
|
File "avfilter-8.dll"
|
||||||
File "avformat-58.dll"
|
File "avformat-59.dll"
|
||||||
File "avutil-56.dll"
|
File "avutil-57.dll"
|
||||||
File "libbrotlicommon.dll"
|
File "libbrotlicommon.dll"
|
||||||
File "libbrotlidec.dll"
|
File "libbrotlidec.dll"
|
||||||
|
File "libbrotlienc.dll"
|
||||||
|
File "libbs2b-0.dll"
|
||||||
File "libbz2.dll"
|
File "libbz2.dll"
|
||||||
File "libcdio-19.dll"
|
File "libcdio-19.dll"
|
||||||
File "libchromaprint.dll"
|
File "libchromaprint.dll"
|
||||||
File "libdl.dll"
|
File "libdl.dll"
|
||||||
File "libfaac-0.dll"
|
File "libfdk-aac-2.dll"
|
||||||
File "libfaad-2.dll"
|
File "libffi-8.dll"
|
||||||
File "libffi-7.dll"
|
|
||||||
File "libfftw3-3.dll"
|
|
||||||
File "libFLAC-8.dll"
|
File "libFLAC-8.dll"
|
||||||
File "libfreetype-6.dll"
|
File "libfreetype-6.dll"
|
||||||
|
File "libfaac-0.dll"
|
||||||
|
File "libfaad-2.dll"
|
||||||
|
File "libfftw3-3.dll"
|
||||||
File "libgio-2.0-0.dll"
|
File "libgio-2.0-0.dll"
|
||||||
File "libglib-2.0-0.dll"
|
File "libglib-2.0-0.dll"
|
||||||
File "libgmodule-2.0-0.dll"
|
File "libgmodule-2.0-0.dll"
|
||||||
File "libgmp-10.dll"
|
File "libgmp-10.dll"
|
||||||
File "libgnutls-30.dll"
|
File "libgnutls-30.dll"
|
||||||
File "libgobject-2.0-0.dll"
|
File "libgobject-2.0-0.dll"
|
||||||
|
File "libgstadaptivedemux-1.0-0.dll"
|
||||||
File "libgstapp-1.0-0.dll"
|
File "libgstapp-1.0-0.dll"
|
||||||
File "libgstaudio-1.0-0.dll"
|
File "libgstaudio-1.0-0.dll"
|
||||||
File "libgstbadaudio-1.0-0.dll"
|
File "libgstbadaudio-1.0-0.dll"
|
||||||
File "libgstbase-1.0-0.dll"
|
File "libgstbase-1.0-0.dll"
|
||||||
File "libgstfft-1.0-0.dll"
|
File "libgstfft-1.0-0.dll"
|
||||||
|
File "libgstisoff-1.0-0.dll"
|
||||||
File "libgstnet-1.0-0.dll"
|
File "libgstnet-1.0-0.dll"
|
||||||
File "libgstpbutils-1.0-0.dll"
|
File "libgstpbutils-1.0-0.dll"
|
||||||
File "libgstreamer-1.0-0.dll"
|
File "libgstreamer-1.0-0.dll"
|
||||||
@@ -240,6 +260,7 @@ Section "Strawberry" Strawberry
|
|||||||
File "libgstrtsp-1.0-0.dll"
|
File "libgstrtsp-1.0-0.dll"
|
||||||
File "libgstsdp-1.0-0.dll"
|
File "libgstsdp-1.0-0.dll"
|
||||||
File "libgsttag-1.0-0.dll"
|
File "libgsttag-1.0-0.dll"
|
||||||
|
File "libgsturidownloader-1.0-0.dll"
|
||||||
File "libgstvideo-1.0-0.dll"
|
File "libgstvideo-1.0-0.dll"
|
||||||
File "libharfbuzz-0.dll"
|
File "libharfbuzz-0.dll"
|
||||||
File "libhogweed-6.dll"
|
File "libhogweed-6.dll"
|
||||||
@@ -249,7 +270,10 @@ Section "Strawberry" Strawberry
|
|||||||
File "libjpeg-9.dll"
|
File "libjpeg-9.dll"
|
||||||
File "liblzma-5.dll"
|
File "liblzma-5.dll"
|
||||||
File "libmp3lame-0.dll"
|
File "libmp3lame-0.dll"
|
||||||
|
File "libmpcdec.dll"
|
||||||
|
File "libmpg123-0.dll"
|
||||||
File "libnettle-8.dll"
|
File "libnettle-8.dll"
|
||||||
|
File "libnghttp2.dll"
|
||||||
File "libogg-0.dll"
|
File "libogg-0.dll"
|
||||||
File "libopenmpt-0.dll"
|
File "libopenmpt-0.dll"
|
||||||
File "libopus-0.dll"
|
File "libopus-0.dll"
|
||||||
@@ -257,8 +281,9 @@ Section "Strawberry" Strawberry
|
|||||||
File "libpcre-1.dll"
|
File "libpcre-1.dll"
|
||||||
File "libpcre2-16-0.dll"
|
File "libpcre2-16-0.dll"
|
||||||
File "libpng16-16.dll"
|
File "libpng16-16.dll"
|
||||||
File "libprotobuf-29.dll"
|
File "libprotobuf-31.dll"
|
||||||
File "libpsl-5.dll"
|
File "libpsl-5.dll"
|
||||||
|
File "libqtsparkle-qt6.dll"
|
||||||
File "libsoup-2.4-1.dll"
|
File "libsoup-2.4-1.dll"
|
||||||
File "libspeex-1.dll"
|
File "libspeex-1.dll"
|
||||||
File "libsqlite3-0.dll"
|
File "libsqlite3-0.dll"
|
||||||
@@ -274,29 +299,11 @@ Section "Strawberry" Strawberry
|
|||||||
File "libwinpthread-1.dll"
|
File "libwinpthread-1.dll"
|
||||||
File "libxml2-2.dll"
|
File "libxml2-2.dll"
|
||||||
File "libzstd.dll"
|
File "libzstd.dll"
|
||||||
File "postproc-55.dll"
|
File "postproc-56.dll"
|
||||||
File "swresample-3.dll"
|
File "swresample-4.dll"
|
||||||
File "swscale-5.dll"
|
File "swscale-6.dll"
|
||||||
File "zlib1.dll"
|
File "zlib1.dll"
|
||||||
|
|
||||||
!ifdef with_qt6
|
|
||||||
File "Qt6Concurrent.dll"
|
|
||||||
File "Qt6Core.dll"
|
|
||||||
File "Qt6Gui.dll"
|
|
||||||
File "Qt6Network.dll"
|
|
||||||
File "Qt6Sql.dll"
|
|
||||||
File "Qt6Widgets.dll"
|
|
||||||
File "libqtsparkle-qt6.dll"
|
|
||||||
!else
|
|
||||||
File "Qt5Concurrent.dll"
|
|
||||||
File "Qt5Core.dll"
|
|
||||||
File "Qt5Gui.dll"
|
|
||||||
File "Qt5Network.dll"
|
|
||||||
File "Qt5Sql.dll"
|
|
||||||
File "Qt5Widgets.dll"
|
|
||||||
File "libqtsparkle-qt5.dll"
|
|
||||||
!endif
|
|
||||||
|
|
||||||
!ifdef debug
|
!ifdef debug
|
||||||
File "gdb.exe"
|
File "gdb.exe"
|
||||||
File "libexpat-1.dll"
|
File "libexpat-1.dll"
|
||||||
@@ -306,6 +313,109 @@ Section "Strawberry" Strawberry
|
|||||||
File "libtermcap.dll"
|
File "libtermcap.dll"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
!endif ; MinGW
|
||||||
|
|
||||||
|
; MSVC specific files
|
||||||
|
|
||||||
|
!ifdef msvc
|
||||||
|
|
||||||
|
!ifdef arch_x86
|
||||||
|
File "libcrypto-3.dll"
|
||||||
|
File "libssl-3.dll"
|
||||||
|
!endif
|
||||||
|
!ifdef arch_x64
|
||||||
|
File "libcrypto-3-x64.dll"
|
||||||
|
File "libssl-3-x64.dll"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
File "brotlicommon.dll"
|
||||||
|
File "brotlidec.dll"
|
||||||
|
File "chromaprint.dll"
|
||||||
|
File "faad.dll"
|
||||||
|
File "fdk-aac.dll"
|
||||||
|
File "ffi-7.dll"
|
||||||
|
File "FLAC.dll"
|
||||||
|
File "gio-2.0-0.dll"
|
||||||
|
File "glib-2.0-0.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"
|
||||||
|
File "gstaudio-1.0-0.dll"
|
||||||
|
File "gstbadaudio-1.0-0.dll"
|
||||||
|
File "gstbase-1.0-0.dll"
|
||||||
|
File "gstfft-1.0-0.dll"
|
||||||
|
File "gstisoff-1.0-0.dll"
|
||||||
|
File "gstnet-1.0-0.dll"
|
||||||
|
File "gstpbutils-1.0-0.dll"
|
||||||
|
File "gstreamer-1.0-0.dll"
|
||||||
|
File "gstriff-1.0-0.dll"
|
||||||
|
File "gstrtp-1.0-0.dll"
|
||||||
|
File "gstrtsp-1.0-0.dll"
|
||||||
|
File "gstsdp-1.0-0.dll"
|
||||||
|
File "gsttag-1.0-0.dll"
|
||||||
|
File "gsturidownloader-1.0-0.dll"
|
||||||
|
File "gstvideo-1.0-0.dll"
|
||||||
|
File "gstwinrt-1.0-0.dll"
|
||||||
|
File "fftw3.dll"
|
||||||
|
File "intl-8.dll"
|
||||||
|
File "libbs2b.dll"
|
||||||
|
File "libfaac_dll.dll"
|
||||||
|
File "libiconv.dll"
|
||||||
|
File "liblzma.dll"
|
||||||
|
File "libmp3lame.dll"
|
||||||
|
File "libopenmpt.dll"
|
||||||
|
File "libspeex.dll"
|
||||||
|
File "mpcdec.dll"
|
||||||
|
File "mpg123.dll"
|
||||||
|
File "ogg.dll"
|
||||||
|
File "opus.dll"
|
||||||
|
File "orc-0.4-0.dll"
|
||||||
|
File "psl-5.dll"
|
||||||
|
File "qtsparkle-qt6.dll"
|
||||||
|
File "soup-2.4-1.dll"
|
||||||
|
File "sqlite3.dll"
|
||||||
|
File "tag.dll"
|
||||||
|
File "vorbis.dll"
|
||||||
|
File "vorbisfile.dll"
|
||||||
|
File "wavpackdll.dll"
|
||||||
|
|
||||||
|
!ifdef release
|
||||||
|
File "libpng16.dll"
|
||||||
|
File "libprotobuf.dll"
|
||||||
|
File "libxml2.dll"
|
||||||
|
File "pcre2-16.dll"
|
||||||
|
File "zlib.dll"
|
||||||
|
!endif
|
||||||
|
!ifdef debug
|
||||||
|
File "libpng16d.dll"
|
||||||
|
File "libprotobufd.dll"
|
||||||
|
File "libxml2d.dll"
|
||||||
|
File "pcre2-16d.dll"
|
||||||
|
File "zlibd.dll"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!endif ; MSVC
|
||||||
|
|
||||||
|
; Common files
|
||||||
|
|
||||||
|
!ifdef msvc && debug
|
||||||
|
File "Qt6Concurrentd.dll"
|
||||||
|
File "Qt6Cored.dll"
|
||||||
|
File "Qt6Guid.dll"
|
||||||
|
File "Qt6Networkd.dll"
|
||||||
|
File "Qt6Sqld.dll"
|
||||||
|
File "Qt6Widgetsd.dll"
|
||||||
|
!else
|
||||||
|
File "Qt6Concurrent.dll"
|
||||||
|
File "Qt6Core.dll"
|
||||||
|
File "Qt6Gui.dll"
|
||||||
|
File "Qt6Network.dll"
|
||||||
|
File "Qt6Sql.dll"
|
||||||
|
File "Qt6Widgets.dll"
|
||||||
|
!endif
|
||||||
|
|
||||||
; Register Strawberry with Default Programs
|
; Register Strawberry with Default Programs
|
||||||
Var /GLOBAL AppIcon
|
Var /GLOBAL AppIcon
|
||||||
Var /GLOBAL AppExe
|
Var /GLOBAL AppExe
|
||||||
@@ -340,43 +450,75 @@ SectionEnd
|
|||||||
|
|
||||||
Section "GIO modules" gio-modules
|
Section "GIO modules" gio-modules
|
||||||
SetOutPath "$INSTDIR\gio-modules"
|
SetOutPath "$INSTDIR\gio-modules"
|
||||||
|
!ifdef mingw
|
||||||
File "/oname=libgiognutls.dll" "gio-modules\libgiognutls.dll"
|
File "/oname=libgiognutls.dll" "gio-modules\libgiognutls.dll"
|
||||||
|
File "/oname=libgioopenssl.dll" "gio-modules\libgioopenssl.dll"
|
||||||
|
!endif
|
||||||
|
!ifdef msvc
|
||||||
|
File "/oname=giognutls.dll" "gio-modules\giognutls.dll"
|
||||||
|
File "/oname=gioopenssl.dll" "gio-modules\gioopenssl.dll"
|
||||||
|
!endif
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "Qt Platform plugins" platforms
|
Section "Qt Platform plugins" platforms
|
||||||
SetOutPath "$INSTDIR\platforms"
|
SetOutPath "$INSTDIR\platforms"
|
||||||
|
!ifdef msvc && debug
|
||||||
|
File "/oname=qwindowsd.dll" "platforms\qwindowsd.dll"
|
||||||
|
!else
|
||||||
File "/oname=qwindows.dll" "platforms\qwindows.dll"
|
File "/oname=qwindows.dll" "platforms\qwindows.dll"
|
||||||
|
!endif
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "Qt styles" styles
|
Section "Qt styles" styles
|
||||||
SetOutPath "$INSTDIR\styles"
|
SetOutPath "$INSTDIR\styles"
|
||||||
|
!ifdef msvc && debug
|
||||||
|
File "/oname=qwindowsvistastyled.dll" "styles\qwindowsvistastyled.dll"
|
||||||
|
!else
|
||||||
File "/oname=qwindowsvistastyle.dll" "styles\qwindowsvistastyle.dll"
|
File "/oname=qwindowsvistastyle.dll" "styles\qwindowsvistastyle.dll"
|
||||||
|
!endif
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Section "Qt TLS plugins" tls
|
||||||
|
SetOutPath "$INSTDIR\tls"
|
||||||
|
!ifdef msvc && debug
|
||||||
|
File "/oname=qopensslbackendd.dll" "tls\qopensslbackendd.dll"
|
||||||
|
!else
|
||||||
|
File "/oname=qopensslbackend.dll" "tls\qopensslbackend.dll"
|
||||||
|
!endif
|
||||||
|
SectionEnd
|
||||||
|
|
||||||
|
Section "Qt SQL Drivers" sqldrivers
|
||||||
|
SetOutPath "$INSTDIR\sqldrivers"
|
||||||
|
!ifdef msvc && debug
|
||||||
|
File "/oname=qsqlited.dll" "sqldrivers\qsqlited.dll"
|
||||||
|
!else
|
||||||
|
File "/oname=qsqlite.dll" "sqldrivers\qsqlite.dll"
|
||||||
|
!endif
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "Qt imageformats" imageformats
|
Section "Qt imageformats" imageformats
|
||||||
SetOutPath "$INSTDIR\imageformats"
|
SetOutPath "$INSTDIR\imageformats"
|
||||||
|
!ifdef msvc && debug
|
||||||
|
File "/oname=qgifd.dll" "imageformats\qgifd.dll"
|
||||||
|
File "/oname=qicod.dll" "imageformats\qicod.dll"
|
||||||
|
File "/oname=qjpegd.dll" "imageformats\qjpegd.dll"
|
||||||
|
!else
|
||||||
File "/oname=qgif.dll" "imageformats\qgif.dll"
|
File "/oname=qgif.dll" "imageformats\qgif.dll"
|
||||||
File "/oname=qico.dll" "imageformats\qico.dll"
|
File "/oname=qico.dll" "imageformats\qico.dll"
|
||||||
File "/oname=qjpeg.dll" "imageformats\qjpeg.dll"
|
File "/oname=qjpeg.dll" "imageformats\qjpeg.dll"
|
||||||
SectionEnd
|
|
||||||
|
|
||||||
!ifdef with_qt6
|
|
||||||
Section "Qt TLS plugins" tls
|
|
||||||
SetOutPath "$INSTDIR\tls"
|
|
||||||
File "/oname=qopensslbackend.dll" "tls\qopensslbackend.dll"
|
|
||||||
SectionEnd
|
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
Section "Qt SQL Drivers" sqldrivers
|
|
||||||
SetOutPath "$INSTDIR\sqldrivers"
|
|
||||||
File "/oname=qsqlite.dll" "sqldrivers\qsqlite.dll"
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
Section "Gstreamer plugins" gstreamer-plugins
|
Section "Gstreamer plugins" gstreamer-plugins
|
||||||
SetOutPath "$INSTDIR\gstreamer-plugins"
|
SetOutPath "$INSTDIR\gstreamer-plugins"
|
||||||
|
|
||||||
|
!ifdef mingw
|
||||||
|
File "/oname=libgstaes.dll" "gstreamer-plugins\libgstaes.dll"
|
||||||
|
File "/oname=libgstaiff.dll" "gstreamer-plugins\libgstaiff.dll"
|
||||||
|
File "/oname=libgstapetag.dll" "gstreamer-plugins\libgstapetag.dll"
|
||||||
File "/oname=libgstapp.dll" "gstreamer-plugins\libgstapp.dll"
|
File "/oname=libgstapp.dll" "gstreamer-plugins\libgstapp.dll"
|
||||||
File "/oname=libgstcoreelements.dll" "gstreamer-plugins\libgstcoreelements.dll"
|
File "/oname=libgstasf.dll" "gstreamer-plugins\libgstasf.dll"
|
||||||
|
File "/oname=libgstasfmux.dll" "gstreamer-plugins\libgstasfmux.dll"
|
||||||
File "/oname=libgstaudioconvert.dll" "gstreamer-plugins\libgstaudioconvert.dll"
|
File "/oname=libgstaudioconvert.dll" "gstreamer-plugins\libgstaudioconvert.dll"
|
||||||
File "/oname=libgstaudiofx.dll" "gstreamer-plugins\libgstaudiofx.dll"
|
File "/oname=libgstaudiofx.dll" "gstreamer-plugins\libgstaudiofx.dll"
|
||||||
File "/oname=libgstaudiomixer.dll" "gstreamer-plugins\libgstaudiomixer.dll"
|
File "/oname=libgstaudiomixer.dll" "gstreamer-plugins\libgstaudiomixer.dll"
|
||||||
@@ -385,43 +527,102 @@ Section "Gstreamer plugins" gstreamer-plugins
|
|||||||
File "/oname=libgstaudioresample.dll" "gstreamer-plugins\libgstaudioresample.dll"
|
File "/oname=libgstaudioresample.dll" "gstreamer-plugins\libgstaudioresample.dll"
|
||||||
File "/oname=libgstaudiotestsrc.dll" "gstreamer-plugins\libgstaudiotestsrc.dll"
|
File "/oname=libgstaudiotestsrc.dll" "gstreamer-plugins\libgstaudiotestsrc.dll"
|
||||||
File "/oname=libgstautodetect.dll" "gstreamer-plugins\libgstautodetect.dll"
|
File "/oname=libgstautodetect.dll" "gstreamer-plugins\libgstautodetect.dll"
|
||||||
File "/oname=libgstplayback.dll" "gstreamer-plugins\libgstplayback.dll"
|
File "/oname=libgstbs2b.dll" "gstreamer-plugins\libgstbs2b.dll"
|
||||||
File "/oname=libgstvolume.dll" "gstreamer-plugins\libgstvolume.dll"
|
|
||||||
File "/oname=libgstspectrum.dll" "gstreamer-plugins\libgstspectrum.dll"
|
|
||||||
File "/oname=libgstequalizer.dll" "gstreamer-plugins\libgstequalizer.dll"
|
|
||||||
File "/oname=libgstreplaygain.dll" "gstreamer-plugins\libgstreplaygain.dll"
|
|
||||||
File "/oname=libgsttypefindfunctions.dll" "gstreamer-plugins\libgsttypefindfunctions.dll"
|
|
||||||
File "/oname=libgstgio.dll" "gstreamer-plugins\libgstgio.dll"
|
|
||||||
File "/oname=libgstdirectsound.dll" "gstreamer-plugins\libgstdirectsound.dll"
|
|
||||||
File "/oname=libgstwasapi.dll" "gstreamer-plugins\libgstwasapi.dll"
|
|
||||||
File "/oname=libgstapetag.dll" "gstreamer-plugins\libgstapetag.dll"
|
|
||||||
File "/oname=libgsticydemux.dll" "gstreamer-plugins\libgsticydemux.dll"
|
|
||||||
File "/oname=libgstid3demux.dll" "gstreamer-plugins\libgstid3demux.dll"
|
|
||||||
File "/oname=libgsttaglib.dll" "gstreamer-plugins\libgsttaglib.dll"
|
|
||||||
File "/oname=libgsttcp.dll" "gstreamer-plugins\libgsttcp.dll"
|
|
||||||
File "/oname=libgstudp.dll" "gstreamer-plugins\libgstudp.dll"
|
|
||||||
File "/oname=libgstsoup.dll" "gstreamer-plugins\libgstsoup.dll"
|
|
||||||
File "/oname=libgstcdio.dll" "gstreamer-plugins\libgstcdio.dll"
|
File "/oname=libgstcdio.dll" "gstreamer-plugins\libgstcdio.dll"
|
||||||
File "/oname=libgstflac.dll" "gstreamer-plugins\libgstflac.dll"
|
File "/oname=libgstcoreelements.dll" "gstreamer-plugins\libgstcoreelements.dll"
|
||||||
File "/oname=libgstwavparse.dll" "gstreamer-plugins\libgstwavparse.dll"
|
File "/oname=libgstdash.dll" "gstreamer-plugins\libgstdash.dll"
|
||||||
File "/oname=libgstwavpack.dll" "gstreamer-plugins\libgstwavpack.dll"
|
File "/oname=libgstdirectsound.dll" "gstreamer-plugins\libgstdirectsound.dll"
|
||||||
File "/oname=libgstogg.dll" "gstreamer-plugins\libgstogg.dll"
|
File "/oname=libgstequalizer.dll" "gstreamer-plugins\libgstequalizer.dll"
|
||||||
File "/oname=libgstvorbis.dll" "gstreamer-plugins\libgstvorbis.dll"
|
|
||||||
File "/oname=libgstopus.dll" "gstreamer-plugins\libgstopus.dll"
|
|
||||||
File "/oname=libgstopusparse.dll" "gstreamer-plugins\libgstopusparse.dll"
|
|
||||||
File "/oname=libgstspeex.dll" "gstreamer-plugins\libgstspeex.dll"
|
|
||||||
File "/oname=libgstlame.dll" "gstreamer-plugins\libgstlame.dll"
|
|
||||||
File "/oname=libgstaiff.dll" "gstreamer-plugins\libgstaiff.dll"
|
|
||||||
File "/oname=libgstfaac.dll" "gstreamer-plugins\libgstfaac.dll"
|
File "/oname=libgstfaac.dll" "gstreamer-plugins\libgstfaac.dll"
|
||||||
File "/oname=libgstfaad.dll" "gstreamer-plugins\libgstfaad.dll"
|
File "/oname=libgstfaad.dll" "gstreamer-plugins\libgstfaad.dll"
|
||||||
|
File "/oname=libgstfdkaac.dll" "gstreamer-plugins\libgstfdkaac.dll"
|
||||||
|
File "/oname=libgstflac.dll" "gstreamer-plugins\libgstflac.dll"
|
||||||
|
File "/oname=libgstgio.dll" "gstreamer-plugins\libgstgio.dll"
|
||||||
|
File "/oname=libgsthls.dll" "gstreamer-plugins\libgsthls.dll"
|
||||||
|
File "/oname=libgsticydemux.dll" "gstreamer-plugins\libgsticydemux.dll"
|
||||||
|
File "/oname=libgstid3demux.dll" "gstreamer-plugins\libgstid3demux.dll"
|
||||||
File "/oname=libgstisomp4.dll" "gstreamer-plugins\libgstisomp4.dll"
|
File "/oname=libgstisomp4.dll" "gstreamer-plugins\libgstisomp4.dll"
|
||||||
File "/oname=libgstasf.dll" "gstreamer-plugins\libgstasf.dll"
|
File "/oname=libgstlame.dll" "gstreamer-plugins\libgstlame.dll"
|
||||||
File "/oname=libgstasfmux.dll" "gstreamer-plugins\libgstasfmux.dll"
|
|
||||||
File "/oname=libgstlibav.dll" "gstreamer-plugins\libgstlibav.dll"
|
File "/oname=libgstlibav.dll" "gstreamer-plugins\libgstlibav.dll"
|
||||||
|
File "/oname=libgstmpg123.dll" "gstreamer-plugins\libgstmpg123.dll"
|
||||||
|
File "/oname=libgstmusepack.dll" "gstreamer-plugins\libgstmusepack.dll"
|
||||||
|
File "/oname=libgstogg.dll" "gstreamer-plugins\libgstogg.dll"
|
||||||
|
File "/oname=libgstopenmpt.dll" "gstreamer-plugins\libgstopenmpt.dll"
|
||||||
|
File "/oname=libgstopus.dll" "gstreamer-plugins\libgstopus.dll"
|
||||||
|
File "/oname=libgstopusparse.dll" "gstreamer-plugins\libgstopusparse.dll"
|
||||||
File "/oname=libgstpbtypes.dll" "gstreamer-plugins\libgstpbtypes.dll"
|
File "/oname=libgstpbtypes.dll" "gstreamer-plugins\libgstpbtypes.dll"
|
||||||
|
File "/oname=libgstplayback.dll" "gstreamer-plugins\libgstplayback.dll"
|
||||||
|
File "/oname=libgstreplaygain.dll" "gstreamer-plugins\libgstreplaygain.dll"
|
||||||
File "/oname=libgstrtp.dll" "gstreamer-plugins\libgstrtp.dll"
|
File "/oname=libgstrtp.dll" "gstreamer-plugins\libgstrtp.dll"
|
||||||
File "/oname=libgstrtsp.dll" "gstreamer-plugins\libgstrtsp.dll"
|
File "/oname=libgstrtsp.dll" "gstreamer-plugins\libgstrtsp.dll"
|
||||||
File "/oname=libgstopenmpt.dll" "gstreamer-plugins\libgstopenmpt.dll"
|
File "/oname=libgstsoup.dll" "gstreamer-plugins\libgstsoup.dll"
|
||||||
|
File "/oname=libgstspectrum.dll" "gstreamer-plugins\libgstspectrum.dll"
|
||||||
|
File "/oname=libgstspeex.dll" "gstreamer-plugins\libgstspeex.dll"
|
||||||
|
File "/oname=libgsttaglib.dll" "gstreamer-plugins\libgsttaglib.dll"
|
||||||
|
File "/oname=libgsttcp.dll" "gstreamer-plugins\libgsttcp.dll"
|
||||||
|
File "/oname=libgsttypefindfunctions.dll" "gstreamer-plugins\libgsttypefindfunctions.dll"
|
||||||
|
File "/oname=libgstudp.dll" "gstreamer-plugins\libgstudp.dll"
|
||||||
|
File "/oname=libgstvolume.dll" "gstreamer-plugins\libgstvolume.dll"
|
||||||
|
File "/oname=libgstvorbis.dll" "gstreamer-plugins\libgstvorbis.dll"
|
||||||
|
File "/oname=libgstwasapi.dll" "gstreamer-plugins\libgstwasapi.dll"
|
||||||
|
File "/oname=libgstwavpack.dll" "gstreamer-plugins\libgstwavpack.dll"
|
||||||
|
File "/oname=libgstwavparse.dll" "gstreamer-plugins\libgstwavparse.dll"
|
||||||
|
File "/oname=libgstxingmux.dll" "gstreamer-plugins\libgstxingmux.dll"
|
||||||
|
!endif ; MinGW
|
||||||
|
|
||||||
|
!ifdef msvc
|
||||||
|
File "/oname=gstaiff.dll" "gstreamer-plugins\gstaiff.dll"
|
||||||
|
File "/oname=gstapetag.dll" "gstreamer-plugins\gstapetag.dll"
|
||||||
|
File "/oname=gstapp.dll" "gstreamer-plugins\gstapp.dll"
|
||||||
|
File "/oname=gstasf.dll" "gstreamer-plugins\gstasf.dll"
|
||||||
|
File "/oname=gstasfmux.dll" "gstreamer-plugins\gstasfmux.dll"
|
||||||
|
File "/oname=gstaudioconvert.dll" "gstreamer-plugins\gstaudioconvert.dll"
|
||||||
|
File "/oname=gstaudiofx.dll" "gstreamer-plugins\gstaudiofx.dll"
|
||||||
|
File "/oname=gstaudiomixer.dll" "gstreamer-plugins\gstaudiomixer.dll"
|
||||||
|
File "/oname=gstaudioparsers.dll" "gstreamer-plugins\gstaudioparsers.dll"
|
||||||
|
File "/oname=gstaudiorate.dll" "gstreamer-plugins\gstaudiorate.dll"
|
||||||
|
File "/oname=gstaudioresample.dll" "gstreamer-plugins\gstaudioresample.dll"
|
||||||
|
File "/oname=gstaudiotestsrc.dll" "gstreamer-plugins\gstaudiotestsrc.dll"
|
||||||
|
File "/oname=gstautodetect.dll" "gstreamer-plugins\gstautodetect.dll"
|
||||||
|
File "/oname=gstbs2b.dll" "gstreamer-plugins\gstbs2b.dll"
|
||||||
|
File "/oname=gstcoreelements.dll" "gstreamer-plugins\gstcoreelements.dll"
|
||||||
|
File "/oname=gstdash.dll" "gstreamer-plugins\gstdash.dll"
|
||||||
|
File "/oname=gstdirectsound.dll" "gstreamer-plugins\gstdirectsound.dll"
|
||||||
|
File "/oname=gstequalizer.dll" "gstreamer-plugins\gstequalizer.dll"
|
||||||
|
File "/oname=gstfaac.dll" "gstreamer-plugins\gstfaac.dll"
|
||||||
|
File "/oname=gstfaad.dll" "gstreamer-plugins\gstfaad.dll"
|
||||||
|
File "/oname=gstfdkaac.dll" "gstreamer-plugins\gstfdkaac.dll"
|
||||||
|
File "/oname=gstflac.dll" "gstreamer-plugins\gstflac.dll"
|
||||||
|
File "/oname=gstgio.dll" "gstreamer-plugins\gstgio.dll"
|
||||||
|
File "/oname=gsthls.dll" "gstreamer-plugins\gsthls.dll"
|
||||||
|
File "/oname=gsticydemux.dll" "gstreamer-plugins\gsticydemux.dll"
|
||||||
|
File "/oname=gstid3demux.dll" "gstreamer-plugins\gstid3demux.dll"
|
||||||
|
File "/oname=gstisomp4.dll" "gstreamer-plugins\gstisomp4.dll"
|
||||||
|
File "/oname=gstlame.dll" "gstreamer-plugins\gstlame.dll"
|
||||||
|
File "/oname=gstmpg123.dll" "gstreamer-plugins\gstmpg123.dll"
|
||||||
|
File "/oname=gstmusepack.dll" "gstreamer-plugins\gstmusepack.dll"
|
||||||
|
File "/oname=gstogg.dll" "gstreamer-plugins\gstogg.dll"
|
||||||
|
File "/oname=gstopenmpt.dll" "gstreamer-plugins\gstopenmpt.dll"
|
||||||
|
File "/oname=gstopus.dll" "gstreamer-plugins\gstopus.dll"
|
||||||
|
File "/oname=gstopusparse.dll" "gstreamer-plugins\gstopusparse.dll"
|
||||||
|
File "/oname=gstplayback.dll" "gstreamer-plugins\gstplayback.dll"
|
||||||
|
File "/oname=gstreplaygain.dll" "gstreamer-plugins\gstreplaygain.dll"
|
||||||
|
File "/oname=gstrtp.dll" "gstreamer-plugins\gstrtp.dll"
|
||||||
|
File "/oname=gstrtsp.dll" "gstreamer-plugins\gstrtsp.dll"
|
||||||
|
File "/oname=gstspeex.dll" "gstreamer-plugins\gstspeex.dll"
|
||||||
|
File "/oname=gstsoup.dll" "gstreamer-plugins\gstsoup.dll"
|
||||||
|
File "/oname=gstspectrum.dll" "gstreamer-plugins\gstspectrum.dll"
|
||||||
|
File "/oname=gsttcp.dll" "gstreamer-plugins\gsttcp.dll"
|
||||||
|
File "/oname=gsttypefindfunctions.dll" "gstreamer-plugins\gsttypefindfunctions.dll"
|
||||||
|
File "/oname=gstudp.dll" "gstreamer-plugins\gstudp.dll"
|
||||||
|
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"
|
||||||
|
File "/oname=gstwavpack.dll" "gstreamer-plugins\gstwavpack.dll"
|
||||||
|
File "/oname=gstwavparse.dll" "gstreamer-plugins\gstwavparse.dll"
|
||||||
|
File "/oname=gstxingmux.dll" "gstreamer-plugins\gstxingmux.dll"
|
||||||
|
!endif ; MSVC
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
@@ -460,13 +661,17 @@ Section "Uninstall"
|
|||||||
|
|
||||||
; Delete all the files
|
; Delete all the files
|
||||||
|
|
||||||
Delete "$INSTDIR\strawberry.ico"
|
|
||||||
Delete "$INSTDIR\strawberry.exe"
|
Delete "$INSTDIR\strawberry.exe"
|
||||||
Delete "$INSTDIR\strawberry-tagreader.exe"
|
Delete "$INSTDIR\strawberry-tagreader.exe"
|
||||||
|
Delete "$INSTDIR\strawberry.ico"
|
||||||
Delete "$INSTDIR\sqlite3.exe"
|
Delete "$INSTDIR\sqlite3.exe"
|
||||||
Delete "$INSTDIR\gst-launch-1.0.exe"
|
Delete "$INSTDIR\gst-launch-1.0.exe"
|
||||||
Delete "$INSTDIR\gst-discoverer-1.0.exe"
|
Delete "$INSTDIR\gst-discoverer-1.0.exe"
|
||||||
|
|
||||||
|
; MinGW specific files
|
||||||
|
|
||||||
|
!ifdef mingw
|
||||||
|
|
||||||
!ifdef arch_x86
|
!ifdef arch_x86
|
||||||
Delete "$INSTDIR\libgcc_s_sjlj-1.dll"
|
Delete "$INSTDIR\libgcc_s_sjlj-1.dll"
|
||||||
Delete "$INSTDIR\libcrypto-3.dll"
|
Delete "$INSTDIR\libcrypto-3.dll"
|
||||||
@@ -479,33 +684,38 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\libssl-3-x64.dll"
|
Delete "$INSTDIR\libssl-3-x64.dll"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
Delete "$INSTDIR\avcodec-58.dll"
|
Delete "$INSTDIR\avcodec-59.dll"
|
||||||
Delete "$INSTDIR\avfilter-7.dll"
|
Delete "$INSTDIR\avfilter-8.dll"
|
||||||
Delete "$INSTDIR\avformat-58.dll"
|
Delete "$INSTDIR\avformat-59.dll"
|
||||||
Delete "$INSTDIR\avutil-56.dll"
|
Delete "$INSTDIR\avutil-57.dll"
|
||||||
Delete "$INSTDIR\libbrotlicommon.dll"
|
Delete "$INSTDIR\libbrotlicommon.dll"
|
||||||
Delete "$INSTDIR\libbrotlidec.dll"
|
Delete "$INSTDIR\libbrotlidec.dll"
|
||||||
|
Delete "$INSTDIR\libbrotlienc.dll"
|
||||||
|
Delete "$INSTDIR\libbs2b-0.dll"
|
||||||
Delete "$INSTDIR\libbz2.dll"
|
Delete "$INSTDIR\libbz2.dll"
|
||||||
Delete "$INSTDIR\libcdio-19.dll"
|
Delete "$INSTDIR\libcdio-19.dll"
|
||||||
Delete "$INSTDIR\libchromaprint.dll"
|
Delete "$INSTDIR\libchromaprint.dll"
|
||||||
Delete "$INSTDIR\libdl.dll"
|
Delete "$INSTDIR\libdl.dll"
|
||||||
Delete "$INSTDIR\libfaac-0.dll"
|
Delete "$INSTDIR\libfdk-aac-2.dll"
|
||||||
Delete "$INSTDIR\libfaad-2.dll"
|
Delete "$INSTDIR\libffi-8.dll"
|
||||||
Delete "$INSTDIR\libffi-7.dll"
|
|
||||||
Delete "$INSTDIR\libfftw3-3.dll"
|
|
||||||
Delete "$INSTDIR\libFLAC-8.dll"
|
Delete "$INSTDIR\libFLAC-8.dll"
|
||||||
Delete "$INSTDIR\libfreetype-6.dll"
|
Delete "$INSTDIR\libfreetype-6.dll"
|
||||||
|
Delete "$INSTDIR\libfaac-0.dll"
|
||||||
|
Delete "$INSTDIR\libfaad-2.dll"
|
||||||
|
Delete "$INSTDIR\libfftw3-3.dll"
|
||||||
Delete "$INSTDIR\libgio-2.0-0.dll"
|
Delete "$INSTDIR\libgio-2.0-0.dll"
|
||||||
Delete "$INSTDIR\libglib-2.0-0.dll"
|
Delete "$INSTDIR\libglib-2.0-0.dll"
|
||||||
Delete "$INSTDIR\libgmodule-2.0-0.dll"
|
Delete "$INSTDIR\libgmodule-2.0-0.dll"
|
||||||
Delete "$INSTDIR\libgmp-10.dll"
|
Delete "$INSTDIR\libgmp-10.dll"
|
||||||
Delete "$INSTDIR\libgnutls-30.dll"
|
Delete "$INSTDIR\libgnutls-30.dll"
|
||||||
Delete "$INSTDIR\libgobject-2.0-0.dll"
|
Delete "$INSTDIR\libgobject-2.0-0.dll"
|
||||||
|
Delete "$INSTDIR\libgstadaptivedemux-1.0-0.dll"
|
||||||
Delete "$INSTDIR\libgstapp-1.0-0.dll"
|
Delete "$INSTDIR\libgstapp-1.0-0.dll"
|
||||||
Delete "$INSTDIR\libgstaudio-1.0-0.dll"
|
Delete "$INSTDIR\libgstaudio-1.0-0.dll"
|
||||||
Delete "$INSTDIR\libgstbadaudio-1.0-0.dll"
|
Delete "$INSTDIR\libgstbadaudio-1.0-0.dll"
|
||||||
Delete "$INSTDIR\libgstbase-1.0-0.dll"
|
Delete "$INSTDIR\libgstbase-1.0-0.dll"
|
||||||
Delete "$INSTDIR\libgstfft-1.0-0.dll"
|
Delete "$INSTDIR\libgstfft-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\libgstisoff-1.0-0.dll"
|
||||||
Delete "$INSTDIR\libgstnet-1.0-0.dll"
|
Delete "$INSTDIR\libgstnet-1.0-0.dll"
|
||||||
Delete "$INSTDIR\libgstpbutils-1.0-0.dll"
|
Delete "$INSTDIR\libgstpbutils-1.0-0.dll"
|
||||||
Delete "$INSTDIR\libgstreamer-1.0-0.dll"
|
Delete "$INSTDIR\libgstreamer-1.0-0.dll"
|
||||||
@@ -514,6 +724,7 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\libgstrtsp-1.0-0.dll"
|
Delete "$INSTDIR\libgstrtsp-1.0-0.dll"
|
||||||
Delete "$INSTDIR\libgstsdp-1.0-0.dll"
|
Delete "$INSTDIR\libgstsdp-1.0-0.dll"
|
||||||
Delete "$INSTDIR\libgsttag-1.0-0.dll"
|
Delete "$INSTDIR\libgsttag-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\libgsturidownloader-1.0-0.dll"
|
||||||
Delete "$INSTDIR\libgstvideo-1.0-0.dll"
|
Delete "$INSTDIR\libgstvideo-1.0-0.dll"
|
||||||
Delete "$INSTDIR\libharfbuzz-0.dll"
|
Delete "$INSTDIR\libharfbuzz-0.dll"
|
||||||
Delete "$INSTDIR\libhogweed-6.dll"
|
Delete "$INSTDIR\libhogweed-6.dll"
|
||||||
@@ -523,7 +734,10 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\libjpeg-9.dll"
|
Delete "$INSTDIR\libjpeg-9.dll"
|
||||||
Delete "$INSTDIR\liblzma-5.dll"
|
Delete "$INSTDIR\liblzma-5.dll"
|
||||||
Delete "$INSTDIR\libmp3lame-0.dll"
|
Delete "$INSTDIR\libmp3lame-0.dll"
|
||||||
|
Delete "$INSTDIR\libmpcdec.dll"
|
||||||
|
Delete "$INSTDIR\libmpg123-0.dll"
|
||||||
Delete "$INSTDIR\libnettle-8.dll"
|
Delete "$INSTDIR\libnettle-8.dll"
|
||||||
|
Delete "$INSTDIR\libnghttp2.dll"
|
||||||
Delete "$INSTDIR\libogg-0.dll"
|
Delete "$INSTDIR\libogg-0.dll"
|
||||||
Delete "$INSTDIR\libopenmpt-0.dll"
|
Delete "$INSTDIR\libopenmpt-0.dll"
|
||||||
Delete "$INSTDIR\libopus-0.dll"
|
Delete "$INSTDIR\libopus-0.dll"
|
||||||
@@ -531,9 +745,8 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\libpcre-1.dll"
|
Delete "$INSTDIR\libpcre-1.dll"
|
||||||
Delete "$INSTDIR\libpcre2-16-0.dll"
|
Delete "$INSTDIR\libpcre2-16-0.dll"
|
||||||
Delete "$INSTDIR\libpng16-16.dll"
|
Delete "$INSTDIR\libpng16-16.dll"
|
||||||
Delete "$INSTDIR\libprotobuf-29.dll"
|
Delete "$INSTDIR\libprotobuf-31.dll"
|
||||||
Delete "$INSTDIR\libpsl-5.dll"
|
Delete "$INSTDIR\libpsl-5.dll"
|
||||||
Delete "$INSTDIR\libqtsparkle-qt5.dll"
|
|
||||||
Delete "$INSTDIR\libqtsparkle-qt6.dll"
|
Delete "$INSTDIR\libqtsparkle-qt6.dll"
|
||||||
Delete "$INSTDIR\libsoup-2.4-1.dll"
|
Delete "$INSTDIR\libsoup-2.4-1.dll"
|
||||||
Delete "$INSTDIR\libspeex-1.dll"
|
Delete "$INSTDIR\libspeex-1.dll"
|
||||||
@@ -550,23 +763,12 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\libwinpthread-1.dll"
|
Delete "$INSTDIR\libwinpthread-1.dll"
|
||||||
Delete "$INSTDIR\libxml2-2.dll"
|
Delete "$INSTDIR\libxml2-2.dll"
|
||||||
Delete "$INSTDIR\libzstd.dll"
|
Delete "$INSTDIR\libzstd.dll"
|
||||||
Delete "$INSTDIR\postproc-55.dll"
|
Delete "$INSTDIR\postproc-56.dll"
|
||||||
Delete "$INSTDIR\Qt5Concurrent.dll"
|
Delete "$INSTDIR\swresample-4.dll"
|
||||||
Delete "$INSTDIR\Qt5Core.dll"
|
Delete "$INSTDIR\swscale-6.dll"
|
||||||
Delete "$INSTDIR\Qt5Gui.dll"
|
|
||||||
Delete "$INSTDIR\Qt5Network.dll"
|
|
||||||
Delete "$INSTDIR\Qt5Sql.dll"
|
|
||||||
Delete "$INSTDIR\Qt5Widgets.dll"
|
|
||||||
Delete "$INSTDIR\Qt6Concurrent.dll"
|
|
||||||
Delete "$INSTDIR\Qt6Core.dll"
|
|
||||||
Delete "$INSTDIR\Qt6Gui.dll"
|
|
||||||
Delete "$INSTDIR\Qt6Network.dll"
|
|
||||||
Delete "$INSTDIR\Qt6Sql.dll"
|
|
||||||
Delete "$INSTDIR\Qt6Widgets.dll"
|
|
||||||
Delete "$INSTDIR\swresample-3.dll"
|
|
||||||
Delete "$INSTDIR\swscale-5.dll"
|
|
||||||
Delete "$INSTDIR\zlib1.dll"
|
Delete "$INSTDIR\zlib1.dll"
|
||||||
|
|
||||||
|
|
||||||
!ifdef debug
|
!ifdef debug
|
||||||
Delete "$INSTDIR\gdb.exe"
|
Delete "$INSTDIR\gdb.exe"
|
||||||
Delete "$INSTDIR\libexpat-1.dll"
|
Delete "$INSTDIR\libexpat-1.dll"
|
||||||
@@ -576,20 +778,145 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\libtermcap.dll"
|
Delete "$INSTDIR\libtermcap.dll"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
!endif ; MinGW
|
||||||
|
|
||||||
|
; MSVC specific files
|
||||||
|
|
||||||
|
!ifdef msvc
|
||||||
|
|
||||||
|
!ifdef arch_x86
|
||||||
|
Delete "$INSTDIR\libcrypto-3.dll"
|
||||||
|
Delete "$INSTDIR\libssl-3.dll"
|
||||||
|
!endif
|
||||||
|
!ifdef arch_x64
|
||||||
|
Delete "$INSTDIR\libcrypto-3-x64.dll"
|
||||||
|
Delete "$INSTDIR\libssl-3-x64.dll"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
Delete "$INSTDIR\brotlicommon.dll"
|
||||||
|
Delete "$INSTDIR\brotlidec.dll"
|
||||||
|
Delete "$INSTDIR\chromaprint.dll"
|
||||||
|
Delete "$INSTDIR\faad.dll"
|
||||||
|
Delete "$INSTDIR\fdk-aac.dll"
|
||||||
|
Delete "$INSTDIR\ffi-7.dll"
|
||||||
|
Delete "$INSTDIR\FLAC.dll"
|
||||||
|
Delete "$INSTDIR\gio-2.0-0.dll"
|
||||||
|
Delete "$INSTDIR\glib-2.0-0.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"
|
||||||
|
Delete "$INSTDIR\gstaudio-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gstbadaudio-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gstbase-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gstfft-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gstisoff-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gstnet-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gstpbutils-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gstriff-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gstrtp-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gstrtsp-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gstsdp-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gsttag-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gsturidownloader-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gstvideo-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gstwinrt-1.0-0.dll"
|
||||||
|
Delete "$INSTDIR\fftw3.dll"
|
||||||
|
Delete "$INSTDIR\intl-8.dll"
|
||||||
|
Delete "$INSTDIR\libbs2b.dll"
|
||||||
|
Delete "$INSTDIR\libfaac_dll.dll"
|
||||||
|
Delete "$INSTDIR\libiconv.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\ogg.dll"
|
||||||
|
Delete "$INSTDIR\opus.dll"
|
||||||
|
Delete "$INSTDIR\orc-0.4-0.dll"
|
||||||
|
Delete "$INSTDIR\psl-5.dll"
|
||||||
|
Delete "$INSTDIR\qtsparkle-qt6.dll"
|
||||||
|
Delete "$INSTDIR\soup-2.4-1.dll"
|
||||||
|
Delete "$INSTDIR\sqlite3.dll"
|
||||||
|
Delete "$INSTDIR\tag.dll"
|
||||||
|
Delete "$INSTDIR\vorbis.dll"
|
||||||
|
Delete "$INSTDIR\vorbisfile.dll"
|
||||||
|
Delete "$INSTDIR\wavpackdll.dll"
|
||||||
|
|
||||||
|
!ifdef release
|
||||||
|
Delete "$INSTDIR\libpng16.dll"
|
||||||
|
Delete "$INSTDIR\libprotobuf.dll"
|
||||||
|
Delete "$INSTDIR\libxml2.dll"
|
||||||
|
Delete "$INSTDIR\pcre2-16.dll"
|
||||||
|
Delete "$INSTDIR\zlib.dll"
|
||||||
|
!endif
|
||||||
|
!ifdef debug
|
||||||
|
Delete "$INSTDIR\libpng16d.dll"
|
||||||
|
Delete "$INSTDIR\libprotobufd.dll"
|
||||||
|
Delete "$INSTDIR\libxml2d.dll"
|
||||||
|
Delete "$INSTDIR\pcre2-16d.dll"
|
||||||
|
Delete "$INSTDIR\zlibd.dll"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!endif ; MSVC
|
||||||
|
|
||||||
|
; Common files
|
||||||
|
|
||||||
|
!ifdef msvc && debug
|
||||||
|
Delete "$INSTDIR\Qt6Concurrentd.dll"
|
||||||
|
Delete "$INSTDIR\Qt6Cored.dll"
|
||||||
|
Delete "$INSTDIR\Qt6Guid.dll"
|
||||||
|
Delete "$INSTDIR\Qt6Networkd.dll"
|
||||||
|
Delete "$INSTDIR\Qt6Sqld.dll"
|
||||||
|
Delete "$INSTDIR\Qt6Widgetsd.dll"
|
||||||
|
!else
|
||||||
|
Delete "$INSTDIR\Qt6Concurrent.dll"
|
||||||
|
Delete "$INSTDIR\Qt6Core.dll"
|
||||||
|
Delete "$INSTDIR\Qt6Gui.dll"
|
||||||
|
Delete "$INSTDIR\Qt6Network.dll"
|
||||||
|
Delete "$INSTDIR\Qt6Sql.dll"
|
||||||
|
Delete "$INSTDIR\Qt6Widgets.dll"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!ifdef mingw
|
||||||
Delete "$INSTDIR\gio-modules\libgiognutls.dll"
|
Delete "$INSTDIR\gio-modules\libgiognutls.dll"
|
||||||
|
Delete "$INSTDIR\gio-modules\libgioopenssl.dll"
|
||||||
|
!endif
|
||||||
|
!ifdef msvc
|
||||||
|
Delete "$INSTDIR\gio-modules\giognutls.dll"
|
||||||
|
Delete "$INSTDIR\gio-modules\gioopenssl.dll"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
!ifdef msvc && debug
|
||||||
|
Delete "$INSTDIR\platforms\qwindowsd.dll"
|
||||||
|
Delete "$INSTDIR\styles\qwindowsvistastyled.dll"
|
||||||
|
Delete "$INSTDIR\tls\qopensslbackendd.dll"
|
||||||
|
Delete "$INSTDIR\sqldrivers\qsqlited.dll"
|
||||||
|
Delete "$INSTDIR\imageformats\qgifd.dll"
|
||||||
|
Delete "$INSTDIR\imageformats\qicod.dll"
|
||||||
|
Delete "$INSTDIR\imageformats\qjpegd.dll"
|
||||||
|
!else
|
||||||
Delete "$INSTDIR\platforms\qwindows.dll"
|
Delete "$INSTDIR\platforms\qwindows.dll"
|
||||||
Delete "$INSTDIR\styles\qwindowsvistastyle.dll"
|
Delete "$INSTDIR\styles\qwindowsvistastyle.dll"
|
||||||
!ifdef with_qt6
|
|
||||||
Delete "$INSTDIR\tls\qopensslbackend.dll"
|
Delete "$INSTDIR\tls\qopensslbackend.dll"
|
||||||
!endif
|
|
||||||
Delete "$INSTDIR\sqldrivers\qsqlite.dll"
|
Delete "$INSTDIR\sqldrivers\qsqlite.dll"
|
||||||
|
|
||||||
Delete "$INSTDIR\imageformats\qgif.dll"
|
Delete "$INSTDIR\imageformats\qgif.dll"
|
||||||
Delete "$INSTDIR\imageformats\qico.dll"
|
Delete "$INSTDIR\imageformats\qico.dll"
|
||||||
Delete "$INSTDIR\imageformats\qjpeg.dll"
|
Delete "$INSTDIR\imageformats\qjpeg.dll"
|
||||||
|
!endif
|
||||||
|
|
||||||
|
; MinGW GStreamer plugins
|
||||||
|
|
||||||
|
!ifdef mingw
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstaes.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstaiff.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstapetag.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstapp.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstapp.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstcoreelements.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstasf.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstasfmux.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstaudioconvert.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstaudioconvert.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstaudiofx.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstaudiofx.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstaudiomixer.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstaudiomixer.dll"
|
||||||
@@ -598,45 +925,106 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\gstreamer-plugins\libgstaudioresample.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstaudioresample.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstaudiotestsrc.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstaudiotestsrc.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstautodetect.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstautodetect.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstplayback.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstbs2b.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstvolume.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstspectrum.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstequalizer.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstreplaygain.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgsttypefindfunctions.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstgio.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstdirectsound.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstwasapi.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstapetag.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgsticydemux.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstid3demux.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgsttaglib.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgsttcp.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstudp.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstsoup.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstcdio.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstcdio.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstflac.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstcoreelements.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstwavparse.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstdash.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstwavpack.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstdirectsound.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstogg.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstequalizer.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstvorbis.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstopus.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstopusparse.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstspeex.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstlame.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstaiff.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstfaac.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstfaac.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstfaad.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstfaad.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstfdkaac.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstflac.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstgio.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgsthls.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgsticydemux.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstid3demux.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstisomp4.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstisomp4.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstasf.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstlame.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstasfmux.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstlibav.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstlibav.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstmpg123.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstmusepack.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstogg.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstopenmpt.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstopus.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstopusparse.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstpbtypes.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstpbtypes.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstplayback.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstreplaygain.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstrtp.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstrtp.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstrtsp.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstrtsp.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstopenmpt.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstsoup.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstspectrum.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstspeex.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgsttaglib.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgsttcp.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgsttypefindfunctions.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstudp.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstvolume.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstvorbis.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstwasapi.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstwavpack.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstwavparse.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstxingmux.dll"
|
||||||
|
!endif ; mingw
|
||||||
|
|
||||||
Delete "$INSTDIR\Uninstall.exe"
|
; MSVC GStreamer plugins
|
||||||
|
|
||||||
|
!ifdef msvc
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstaiff.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstapetag.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstapp.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstasf.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstasfmux.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstaudioconvert.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstaudiofx.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstaudiomixer.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstaudioparsers.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstaudiorate.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstaudioresample.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstaudiotestsrc.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstautodetect.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstbs2b.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstcoreelements.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstdash.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstdirectsound.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstequalizer.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstfaac.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstfaad.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstfdkaac.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstflac.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstgio.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gsthls.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gsticydemux.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstid3demux.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstisomp4.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstlame.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstmpg123.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstmusepack.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstogg.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstopenmpt.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstopus.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstopusparse.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstplayback.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstreplaygain.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstrtp.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstrtsp.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstspeex.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstsoup.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstspectrum.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gsttcp.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gsttypefindfunctions.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstudp.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstvolume.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstvorbis.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstwasapi.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstwasapi2.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstwavpack.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstwavparse.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstxingmux.dll"
|
||||||
|
!endif ; msvc
|
||||||
|
|
||||||
|
Delete $INSTDIR\Uninstall.exe"
|
||||||
|
|
||||||
; Remove the installation folders.
|
; Remove the installation folders.
|
||||||
RMDir "$INSTDIR\platforms"
|
RMDir "$INSTDIR\platforms"
|
||||||
|
|||||||
@@ -33,24 +33,13 @@
|
|||||||
|
|
||||||
#include "gstfastspectrum.h"
|
#include "gstfastspectrum.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (gst_fastspectrum_debug);
|
GST_DEBUG_CATEGORY_STATIC(gst_fastspectrum_debug);
|
||||||
#define GST_CAT_DEFAULT gst_fastspectrum_debug
|
|
||||||
|
|
||||||
/* elementfactory information */
|
namespace {
|
||||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
|
||||||
# define FORMATS "{ S16LE, S24LE, S32LE, F32LE, F64LE }"
|
|
||||||
#else
|
|
||||||
# define FORMATS "{ S16BE, S24BE, S32BE, F32BE, F64BE }"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ALLOWED_CAPS \
|
// Spectrum properties
|
||||||
GST_AUDIO_CAPS_MAKE (FORMATS) ", " \
|
constexpr auto DEFAULT_INTERVAL = (GST_SECOND / 10);
|
||||||
"layout = (string) interleaved, " \
|
constexpr auto DEFAULT_BANDS = 128;
|
||||||
"channels = 1"
|
|
||||||
|
|
||||||
/* Spectrum properties */
|
|
||||||
#define DEFAULT_INTERVAL (GST_SECOND / 10)
|
|
||||||
#define DEFAULT_BANDS 128
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
@@ -58,93 +47,97 @@ enum {
|
|||||||
PROP_BANDS
|
PROP_BANDS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
#define gst_fastspectrum_parent_class parent_class
|
#define gst_fastspectrum_parent_class parent_class
|
||||||
G_DEFINE_TYPE (GstFastSpectrum, gst_fastspectrum, GST_TYPE_AUDIO_FILTER)
|
G_DEFINE_TYPE(GstFastSpectrum, gst_fastspectrum, GST_TYPE_AUDIO_FILTER)
|
||||||
|
|
||||||
static void gst_fastspectrum_finalize (GObject * object);
|
static void gst_fastspectrum_finalize(GObject *object);
|
||||||
static void gst_fastspectrum_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec);
|
static void gst_fastspectrum_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
|
||||||
static void gst_fastspectrum_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec);
|
static void gst_fastspectrum_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
|
||||||
static gboolean gst_fastspectrum_start (GstBaseTransform * trans);
|
static gboolean gst_fastspectrum_start(GstBaseTransform *trans);
|
||||||
static gboolean gst_fastspectrum_stop (GstBaseTransform * trans);
|
static gboolean gst_fastspectrum_stop(GstBaseTransform *trans);
|
||||||
static GstFlowReturn gst_fastspectrum_transform_ip (GstBaseTransform *trans, GstBuffer *buffer);
|
static GstFlowReturn gst_fastspectrum_transform_ip(GstBaseTransform *trans, GstBuffer *buffer);
|
||||||
static gboolean gst_fastspectrum_setup (GstAudioFilter * base, const GstAudioInfo * info);
|
static gboolean gst_fastspectrum_setup(GstAudioFilter *base, const GstAudioInfo *info);
|
||||||
|
|
||||||
static void gst_fastspectrum_class_init (GstFastSpectrumClass * klass) {
|
static void gst_fastspectrum_class_init(GstFastSpectrumClass *klass) {
|
||||||
|
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *element_class = GST_ELEMENT_CLASS(klass);
|
||||||
GstBaseTransformClass *trans_class = GST_BASE_TRANSFORM_CLASS (klass);
|
GstBaseTransformClass *trans_class = GST_BASE_TRANSFORM_CLASS(klass);
|
||||||
GstAudioFilterClass *filter_class = GST_AUDIO_FILTER_CLASS (klass);
|
GstAudioFilterClass *filter_class = GST_AUDIO_FILTER_CLASS(klass);
|
||||||
GstCaps *caps = nullptr;
|
GstCaps *caps = nullptr;
|
||||||
|
|
||||||
gobject_class->set_property = gst_fastspectrum_set_property;
|
gobject_class->set_property = gst_fastspectrum_set_property;
|
||||||
gobject_class->get_property = gst_fastspectrum_get_property;
|
gobject_class->get_property = gst_fastspectrum_get_property;
|
||||||
gobject_class->finalize = gst_fastspectrum_finalize;
|
gobject_class->finalize = gst_fastspectrum_finalize;
|
||||||
|
|
||||||
trans_class->start = GST_DEBUG_FUNCPTR (gst_fastspectrum_start);
|
trans_class->start = GST_DEBUG_FUNCPTR(gst_fastspectrum_start);
|
||||||
trans_class->stop = GST_DEBUG_FUNCPTR (gst_fastspectrum_stop);
|
trans_class->stop = GST_DEBUG_FUNCPTR(gst_fastspectrum_stop);
|
||||||
trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_fastspectrum_transform_ip);
|
trans_class->transform_ip = GST_DEBUG_FUNCPTR(gst_fastspectrum_transform_ip);
|
||||||
trans_class->passthrough_on_same_caps = TRUE;
|
trans_class->passthrough_on_same_caps = TRUE;
|
||||||
|
|
||||||
filter_class->setup = GST_DEBUG_FUNCPTR (gst_fastspectrum_setup);
|
filter_class->setup = GST_DEBUG_FUNCPTR(gst_fastspectrum_setup);
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_INTERVAL,
|
g_object_class_install_property(gobject_class, PROP_INTERVAL, g_param_spec_uint64("interval", "Interval", "Interval of time between message posts (in nanoseconds)", 1, G_MAXUINT64, DEFAULT_INTERVAL, GParamFlags(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
||||||
g_param_spec_uint64 ("interval", "Interval", "Interval of time between message posts (in nanoseconds)", 1, G_MAXUINT64, DEFAULT_INTERVAL, GParamFlags(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
|
||||||
|
|
||||||
g_object_class_install_property (gobject_class, PROP_BANDS, g_param_spec_uint ("bands", "Bands", "Number of frequency bands", 0, G_MAXUINT, DEFAULT_BANDS, GParamFlags(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
g_object_class_install_property(gobject_class, PROP_BANDS, g_param_spec_uint("bands", "Bands", "Number of frequency bands", 0, G_MAXUINT, DEFAULT_BANDS, GParamFlags(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_fastspectrum_debug, "spectrum", 0,
|
GST_DEBUG_CATEGORY_INIT(gst_fastspectrum_debug, "spectrum", 0, "audio spectrum analyser element");
|
||||||
"audio spectrum analyser element");
|
|
||||||
|
|
||||||
gst_element_class_set_static_metadata (element_class, "Spectrum analyzer",
|
gst_element_class_set_static_metadata(element_class, "Spectrum analyzer",
|
||||||
"Filter/Analyzer/Audio",
|
"Filter/Analyzer/Audio",
|
||||||
"Run an FFT on the audio signal, output spectrum data",
|
"Run an FFT on the audio signal, output spectrum data",
|
||||||
"Erik Walthinsen <omega@cse.ogi.edu>, "
|
"Erik Walthinsen <omega@cse.ogi.edu>, "
|
||||||
"Stefan Kost <ensonic@users.sf.net>, "
|
"Stefan Kost <ensonic@users.sf.net>, "
|
||||||
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
|
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
|
||||||
|
|
||||||
caps = gst_caps_from_string (ALLOWED_CAPS);
|
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||||
gst_audio_filter_class_add_pad_templates (filter_class, caps);
|
caps = gst_caps_from_string(GST_AUDIO_CAPS_MAKE("{ S16LE, S24LE, S32LE, F32LE, F64LE }") ", layout = (string) interleaved, channels = 1");
|
||||||
gst_caps_unref (caps);
|
#else
|
||||||
|
caps = gst_caps_from_string(GST_AUDIO_CAPS_MAKE("{ S16BE, S24BE, S32BE, F32BE, F64BE }") ", layout = (string) interleaved, channels = 1");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
gst_audio_filter_class_add_pad_templates(filter_class, caps);
|
||||||
|
gst_caps_unref(caps);
|
||||||
|
|
||||||
klass->fftw_lock = new QMutex;
|
klass->fftw_lock = new QMutex;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_fastspectrum_init (GstFastSpectrum * spectrum) {
|
static void gst_fastspectrum_init(GstFastSpectrum *spectrum) {
|
||||||
|
|
||||||
spectrum->interval = DEFAULT_INTERVAL;
|
spectrum->interval = DEFAULT_INTERVAL;
|
||||||
spectrum->bands = DEFAULT_BANDS;
|
spectrum->bands = DEFAULT_BANDS;
|
||||||
|
|
||||||
spectrum->channel_data_initialized = false;
|
spectrum->channel_data_initialized = false;
|
||||||
|
|
||||||
g_mutex_init (&spectrum->lock);
|
g_mutex_init(&spectrum->lock);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_fastspectrum_alloc_channel_data (GstFastSpectrum * spectrum) {
|
static void gst_fastspectrum_alloc_channel_data(GstFastSpectrum *spectrum) {
|
||||||
|
|
||||||
guint bands = spectrum->bands;
|
guint bands = spectrum->bands;
|
||||||
guint nfft = 2 * bands - 2;
|
guint nfft = 2 * bands - 2;
|
||||||
|
|
||||||
spectrum->input_ring_buffer = new double[nfft];
|
spectrum->input_ring_buffer = new double[nfft];
|
||||||
spectrum->fft_input = reinterpret_cast<double*>( fftw_malloc(sizeof(double) * nfft));
|
spectrum->fft_input = reinterpret_cast<double*>(fftw_malloc(sizeof(double) * nfft));
|
||||||
spectrum->fft_output =reinterpret_cast<fftw_complex*>( fftw_malloc(sizeof(fftw_complex) * (nfft/2+1)));
|
spectrum->fft_output = reinterpret_cast<fftw_complex*>(fftw_malloc(sizeof(fftw_complex) * (nfft / 2 + 1)));
|
||||||
|
|
||||||
spectrum->spect_magnitude = new double[bands]{};
|
spectrum->spect_magnitude = new double[bands] {};
|
||||||
|
|
||||||
GstFastSpectrumClass* klass = reinterpret_cast<GstFastSpectrumClass*>(G_OBJECT_GET_CLASS(spectrum));
|
GstFastSpectrumClass *klass = reinterpret_cast<GstFastSpectrumClass*>(G_OBJECT_GET_CLASS(spectrum));
|
||||||
{
|
{
|
||||||
QMutexLocker l(klass->fftw_lock);
|
QMutexLocker l(klass->fftw_lock);
|
||||||
spectrum->plan = fftw_plan_dft_r2c_1d(nfft, spectrum->fft_input, spectrum->fft_output, FFTW_ESTIMATE);
|
spectrum->plan = fftw_plan_dft_r2c_1d(static_cast<int>(nfft), spectrum->fft_input, spectrum->fft_output, FFTW_ESTIMATE);
|
||||||
}
|
}
|
||||||
spectrum->channel_data_initialized = true;
|
spectrum->channel_data_initialized = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_fastspectrum_free_channel_data (GstFastSpectrum * spectrum) {
|
static void gst_fastspectrum_free_channel_data(GstFastSpectrum *spectrum) {
|
||||||
|
|
||||||
GstFastSpectrumClass* klass = reinterpret_cast<GstFastSpectrumClass*>(G_OBJECT_GET_CLASS(spectrum));
|
GstFastSpectrumClass *klass = reinterpret_cast<GstFastSpectrumClass*>(G_OBJECT_GET_CLASS(spectrum));
|
||||||
if (spectrum->channel_data_initialized) {
|
if (spectrum->channel_data_initialized) {
|
||||||
{
|
{
|
||||||
QMutexLocker l(klass->fftw_lock);
|
QMutexLocker l(klass->fftw_lock);
|
||||||
@@ -160,7 +153,7 @@ static void gst_fastspectrum_free_channel_data (GstFastSpectrum * spectrum) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_fastspectrum_flush (GstFastSpectrum * spectrum) {
|
static void gst_fastspectrum_flush(GstFastSpectrum *spectrum) {
|
||||||
|
|
||||||
spectrum->num_frames = 0;
|
spectrum->num_frames = 0;
|
||||||
spectrum->num_fft = 0;
|
spectrum->num_fft = 0;
|
||||||
@@ -169,147 +162,145 @@ static void gst_fastspectrum_flush (GstFastSpectrum * spectrum) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_fastspectrum_reset_state (GstFastSpectrum * spectrum) {
|
static void gst_fastspectrum_reset_state(GstFastSpectrum *spectrum) {
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (spectrum, "resetting state");
|
GST_DEBUG_OBJECT(spectrum, "resetting state");
|
||||||
|
|
||||||
gst_fastspectrum_free_channel_data (spectrum);
|
gst_fastspectrum_free_channel_data(spectrum);
|
||||||
gst_fastspectrum_flush (spectrum);
|
gst_fastspectrum_flush(spectrum);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_fastspectrum_finalize (GObject * object) {
|
static void gst_fastspectrum_finalize(GObject *object) {
|
||||||
|
|
||||||
GstFastSpectrum *spectrum = reinterpret_cast<GstFastSpectrum*>(object);
|
GstFastSpectrum *spectrum = reinterpret_cast<GstFastSpectrum*>(object);
|
||||||
|
|
||||||
gst_fastspectrum_reset_state (spectrum);
|
gst_fastspectrum_reset_state(spectrum);
|
||||||
g_mutex_clear (&spectrum->lock);
|
g_mutex_clear(&spectrum->lock);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS(parent_class)->finalize(object);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_fastspectrum_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) {
|
static void gst_fastspectrum_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) {
|
||||||
|
|
||||||
GstFastSpectrum *filter = reinterpret_cast<GstFastSpectrum*>(object);
|
GstFastSpectrum *filter = reinterpret_cast<GstFastSpectrum*>(object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_INTERVAL:{
|
case PROP_INTERVAL: {
|
||||||
guint64 interval = g_value_get_uint64 (value);
|
guint64 interval = g_value_get_uint64(value);
|
||||||
g_mutex_lock (&filter->lock);
|
g_mutex_lock(&filter->lock);
|
||||||
if (filter->interval != interval) {
|
if (filter->interval != interval) {
|
||||||
filter->interval = interval;
|
filter->interval = interval;
|
||||||
gst_fastspectrum_reset_state (filter);
|
gst_fastspectrum_reset_state(filter);
|
||||||
}
|
}
|
||||||
g_mutex_unlock (&filter->lock);
|
g_mutex_unlock(&filter->lock);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PROP_BANDS:{
|
case PROP_BANDS: {
|
||||||
guint bands = g_value_get_uint (value);
|
guint bands = g_value_get_uint(value);
|
||||||
g_mutex_lock (&filter->lock);
|
g_mutex_lock(&filter->lock);
|
||||||
if (filter->bands != bands) {
|
if (filter->bands != bands) {
|
||||||
filter->bands = bands;
|
filter->bands = bands;
|
||||||
gst_fastspectrum_reset_state (filter);
|
gst_fastspectrum_reset_state(filter);
|
||||||
}
|
}
|
||||||
g_mutex_unlock (&filter->lock);
|
g_mutex_unlock(&filter->lock);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_fastspectrum_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) {
|
static void gst_fastspectrum_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) {
|
||||||
|
|
||||||
GstFastSpectrum *filter = reinterpret_cast<GstFastSpectrum*>(object);
|
GstFastSpectrum *filter = reinterpret_cast<GstFastSpectrum*>(object);
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_INTERVAL:
|
case PROP_INTERVAL:
|
||||||
g_value_set_uint64 (value, filter->interval);
|
g_value_set_uint64(value, filter->interval);
|
||||||
break;
|
break;
|
||||||
case PROP_BANDS:
|
case PROP_BANDS:
|
||||||
g_value_set_uint (value, filter->bands);
|
g_value_set_uint(value, filter->bands);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean gst_fastspectrum_start (GstBaseTransform * trans) {
|
static gboolean gst_fastspectrum_start(GstBaseTransform *trans) {
|
||||||
|
|
||||||
GstFastSpectrum *spectrum = reinterpret_cast<GstFastSpectrum*>(trans);
|
GstFastSpectrum *spectrum = reinterpret_cast<GstFastSpectrum*>(trans);
|
||||||
|
|
||||||
gst_fastspectrum_reset_state (spectrum);
|
gst_fastspectrum_reset_state(spectrum);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean gst_fastspectrum_stop (GstBaseTransform * trans) {
|
static gboolean gst_fastspectrum_stop(GstBaseTransform *trans) {
|
||||||
|
|
||||||
GstFastSpectrum *spectrum = reinterpret_cast<GstFastSpectrum*>(trans);
|
GstFastSpectrum *spectrum = reinterpret_cast<GstFastSpectrum*>(trans);
|
||||||
|
|
||||||
gst_fastspectrum_reset_state (spectrum);
|
gst_fastspectrum_reset_state(spectrum);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mixing data readers */
|
// Mixing data readers
|
||||||
|
|
||||||
static void input_data_mixed_float(const guint8* _in, double* out, guint len, double max_value, guint op, guint nfft) {
|
static void input_data_mixed_float(const guint8 *_in, double *out, guint len, double max_value, guint op, guint nfft) {
|
||||||
|
|
||||||
Q_UNUSED(max_value);
|
Q_UNUSED(max_value);
|
||||||
|
|
||||||
guint j = 0, ip = 0;
|
|
||||||
const gfloat *in = reinterpret_cast<const gfloat*>(_in);
|
const gfloat *in = reinterpret_cast<const gfloat*>(_in);
|
||||||
|
guint ip = 0;
|
||||||
|
|
||||||
for (j = 0; j < len; j++) {
|
for (guint j = 0; j < len; j++) {
|
||||||
out[op] = in[ip++];
|
out[op] = in[ip++];
|
||||||
op = (op + 1) % nfft;
|
op = (op + 1) % nfft;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void input_data_mixed_double (const guint8 * _in, double* out, guint len, double max_value, guint op, guint nfft) {
|
static void input_data_mixed_double(const guint8 *_in, double *out, guint len, double max_value, guint op, guint nfft) {
|
||||||
|
|
||||||
Q_UNUSED(max_value);
|
Q_UNUSED(max_value);
|
||||||
|
|
||||||
guint j = 0, ip = 0;
|
|
||||||
const gdouble *in = reinterpret_cast<const gdouble*>(_in);
|
const gdouble *in = reinterpret_cast<const gdouble*>(_in);
|
||||||
|
guint ip = 0;
|
||||||
|
|
||||||
for (j = 0; j < len; j++) {
|
for (guint j = 0; j < len; j++) {
|
||||||
out[op] = in[ip++];
|
out[op] = in[ip++];
|
||||||
op = (op + 1) % nfft;
|
op = (op + 1) % nfft;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void input_data_mixed_int32_max (const guint8 * _in, double* out, guint len, double max_value, guint op, guint nfft) {
|
static void input_data_mixed_int32_max(const guint8 *_in, double *out, guint len, double max_value, guint op, guint nfft) {
|
||||||
|
|
||||||
guint j = 0, ip = 0;
|
|
||||||
const gint32 *in = reinterpret_cast<const gint32*>(_in);
|
const gint32 *in = reinterpret_cast<const gint32*>(_in);
|
||||||
|
guint ip = 0;
|
||||||
|
|
||||||
for (j = 0; j < len; j++) {
|
for (guint j = 0; j < len; j++) {
|
||||||
out[op] = in[ip++] / max_value;
|
out[op] = in[ip++] / max_value;
|
||||||
op = (op + 1) % nfft;
|
op = (op + 1) % nfft;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void input_data_mixed_int24_max (const guint8 * _in, double* out, guint len, double max_value, guint op, guint nfft) {
|
static void input_data_mixed_int24_max(const guint8 *_in, double *out, guint len, double max_value, guint op, guint nfft) {
|
||||||
|
|
||||||
guint j = 0;
|
for (guint j = 0; j < len; j++) {
|
||||||
|
|
||||||
for (j = 0; j < len; j++) {
|
|
||||||
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
#if G_BYTE_ORDER == G_BIG_ENDIAN
|
||||||
gint32 value = GST_READ_UINT24_BE (_in);
|
guint32 value = GST_READ_UINT24_BE(_in);
|
||||||
#else
|
#else
|
||||||
gint32 value = GST_READ_UINT24_LE (_in);
|
guint32 value = GST_READ_UINT24_LE(_in);
|
||||||
#endif
|
#endif
|
||||||
if (value & 0x00800000) {
|
if (value & 0x00800000) {
|
||||||
value |= 0xff000000;
|
value |= 0xff000000;
|
||||||
@@ -322,25 +313,25 @@ static void input_data_mixed_int24_max (const guint8 * _in, double* out, guint l
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void input_data_mixed_int16_max (const guint8 * _in, double * out, guint len, double max_value, guint op, guint nfft) {
|
static void input_data_mixed_int16_max(const guint8 *_in, double *out, guint len, double max_value, guint op, guint nfft) {
|
||||||
|
|
||||||
guint j = 0, ip = 0;
|
|
||||||
const gint16 *in = reinterpret_cast<const gint16*>(_in);
|
const gint16 *in = reinterpret_cast<const gint16*>(_in);
|
||||||
|
guint ip = 0;
|
||||||
|
|
||||||
for (j = 0; j < len; j++) {
|
for (guint j = 0; j < len; j++) {
|
||||||
out[op] = in[ip++] / max_value;
|
out[op] = in[ip++] / max_value;
|
||||||
op = (op + 1) % nfft;
|
op = (op + 1) % nfft;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean gst_fastspectrum_setup (GstAudioFilter * base, const GstAudioInfo * info) {
|
static gboolean gst_fastspectrum_setup(GstAudioFilter *base, const GstAudioInfo *info) {
|
||||||
|
|
||||||
GstFastSpectrum *spectrum = reinterpret_cast<GstFastSpectrum*>(base);
|
GstFastSpectrum *spectrum = reinterpret_cast<GstFastSpectrum*>(base);
|
||||||
GstFastSpectrumInputData input_data = nullptr;
|
GstFastSpectrumInputData input_data = nullptr;
|
||||||
|
|
||||||
g_mutex_lock (&spectrum->lock);
|
g_mutex_lock(&spectrum->lock);
|
||||||
switch (GST_AUDIO_INFO_FORMAT (info)) {
|
switch (GST_AUDIO_INFO_FORMAT(info)) {
|
||||||
case GST_AUDIO_FORMAT_S16:
|
case GST_AUDIO_FORMAT_S16:
|
||||||
input_data = input_data_mixed_int16_max;
|
input_data = input_data_mixed_int16_max;
|
||||||
break;
|
break;
|
||||||
@@ -357,35 +348,33 @@ static gboolean gst_fastspectrum_setup (GstAudioFilter * base, const GstAudioInf
|
|||||||
input_data = input_data_mixed_double;
|
input_data = input_data_mixed_double;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_assert_not_reached ();
|
g_assert_not_reached();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
spectrum->input_data = input_data;
|
spectrum->input_data = input_data;
|
||||||
|
|
||||||
gst_fastspectrum_reset_state (spectrum);
|
gst_fastspectrum_reset_state(spectrum);
|
||||||
g_mutex_unlock (&spectrum->lock);
|
g_mutex_unlock(&spectrum->lock);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_fastspectrum_run_fft (GstFastSpectrum * spectrum, guint input_pos) {
|
static void gst_fastspectrum_run_fft(GstFastSpectrum *spectrum, guint input_pos) {
|
||||||
|
|
||||||
guint i = 0;
|
|
||||||
guint bands = spectrum->bands;
|
guint bands = spectrum->bands;
|
||||||
guint nfft = 2 * bands - 2;
|
guint nfft = 2 * bands - 2;
|
||||||
|
|
||||||
for (i = 0; i < nfft; i++) {
|
for (guint i = 0; i < nfft; i++) {
|
||||||
spectrum->fft_input[i] = spectrum->input_ring_buffer[(input_pos + i) % nfft];
|
spectrum->fft_input[i] = spectrum->input_ring_buffer[(input_pos + i) % nfft];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should be safe to execute the same plan multiple times in parallel.
|
// Should be safe to execute the same plan multiple times in parallel.
|
||||||
fftw_execute(spectrum->plan);
|
fftw_execute(spectrum->plan);
|
||||||
|
|
||||||
gdouble val = 0.0;
|
// Calculate magnitude in db
|
||||||
/* Calculate magnitude in db */
|
for (guint i = 0; i < bands; i++) {
|
||||||
for (i = 0; i < bands; i++) {
|
gdouble val = spectrum->fft_output[i][0] * spectrum->fft_output[i][0];
|
||||||
val = spectrum->fft_output[i][0] * spectrum->fft_output[i][0];
|
|
||||||
val += spectrum->fft_output[i][1] * spectrum->fft_output[i][1];
|
val += spectrum->fft_output[i][1] * spectrum->fft_output[i][1];
|
||||||
val /= nfft * nfft;
|
val /= nfft * nfft;
|
||||||
spectrum->spect_magnitude[i] += val;
|
spectrum->spect_magnitude[i] += val;
|
||||||
@@ -393,79 +382,68 @@ static void gst_fastspectrum_run_fft (GstFastSpectrum * spectrum, guint input_po
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn gst_fastspectrum_transform_ip (GstBaseTransform *trans, GstBuffer *buffer) {
|
static GstFlowReturn gst_fastspectrum_transform_ip(GstBaseTransform *trans, GstBuffer *buffer) {
|
||||||
|
|
||||||
GstFastSpectrum *spectrum = reinterpret_cast<GstFastSpectrum*>(trans);
|
GstFastSpectrum *spectrum = reinterpret_cast<GstFastSpectrum*>(trans);
|
||||||
guint rate = GST_AUDIO_FILTER_RATE (spectrum);
|
guint rate = GST_AUDIO_FILTER_RATE(spectrum);
|
||||||
guint bps = GST_AUDIO_FILTER_BPS (spectrum);
|
guint bps = GST_AUDIO_FILTER_BPS(spectrum);
|
||||||
guint bpf = GST_AUDIO_FILTER_BPF (spectrum);
|
guint bpf = GST_AUDIO_FILTER_BPF(spectrum);
|
||||||
double max_value = (1UL << ((bps << 3) - 1)) - 1;
|
double max_value = static_cast<double>((1UL << ((bps << 3) - 1)) - 1);
|
||||||
guint bands = spectrum->bands;
|
guint bands = spectrum->bands;
|
||||||
guint nfft = 2 * bands - 2;
|
guint nfft = 2 * bands - 2;
|
||||||
guint input_pos = 0;
|
guint input_pos = 0;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
const guint8 *data = nullptr;
|
const guint8 *data = nullptr;
|
||||||
gsize size = 0;
|
gsize size = 0;
|
||||||
guint fft_todo = 0, msg_todo = 0, block_size = 0;
|
|
||||||
gboolean have_full_interval = false;
|
|
||||||
GstFastSpectrumInputData input_data = nullptr;
|
GstFastSpectrumInputData input_data = nullptr;
|
||||||
|
|
||||||
g_mutex_lock (&spectrum->lock);
|
g_mutex_lock(&spectrum->lock);
|
||||||
gst_buffer_map (buffer, &map, GST_MAP_READ);
|
gst_buffer_map(buffer, &map, GST_MAP_READ);
|
||||||
data = map.data;
|
data = map.data;
|
||||||
size = map.size;
|
size = map.size;
|
||||||
|
|
||||||
GST_LOG_OBJECT (spectrum, "input size: %" G_GSIZE_FORMAT " bytes", size);
|
GST_LOG_OBJECT(spectrum, "input size: %" G_GSIZE_FORMAT " bytes", size);
|
||||||
|
|
||||||
if (GST_BUFFER_IS_DISCONT (buffer)) {
|
if (GST_BUFFER_IS_DISCONT(buffer)) {
|
||||||
GST_DEBUG_OBJECT (spectrum, "Discontinuity detected -- flushing");
|
GST_DEBUG_OBJECT(spectrum, "Discontinuity detected -- flushing");
|
||||||
gst_fastspectrum_flush (spectrum);
|
gst_fastspectrum_flush(spectrum);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we don't have a FFT context yet (or it was reset due to parameter
|
// If we don't have a FFT context yet (or it was reset due to parameter changes) get one and allocate memory for everything
|
||||||
* changes) get one and allocate memory for everything
|
|
||||||
*/
|
|
||||||
if (!spectrum->channel_data_initialized) {
|
if (!spectrum->channel_data_initialized) {
|
||||||
GST_DEBUG_OBJECT (spectrum, "allocating for bands %u", bands);
|
GST_DEBUG_OBJECT(spectrum, "allocating for bands %u", bands);
|
||||||
|
|
||||||
gst_fastspectrum_alloc_channel_data (spectrum);
|
gst_fastspectrum_alloc_channel_data(spectrum);
|
||||||
|
|
||||||
/* number of sample frames we process before posting a message
|
// Number of sample frames we process before posting a message interval is in ns
|
||||||
* interval is in ns */
|
spectrum->frames_per_interval = gst_util_uint64_scale(spectrum->interval, rate, GST_SECOND);
|
||||||
spectrum->frames_per_interval = gst_util_uint64_scale (spectrum->interval, rate, GST_SECOND);
|
|
||||||
spectrum->frames_todo = spectrum->frames_per_interval;
|
spectrum->frames_todo = spectrum->frames_per_interval;
|
||||||
/* rounding error for frames_per_interval in ns,
|
// Rounding error for frames_per_interval in ns, aggregated it in accumulated_error
|
||||||
* aggregated it in accumulated_error */
|
|
||||||
spectrum->error_per_interval = (spectrum->interval * rate) % GST_SECOND;
|
spectrum->error_per_interval = (spectrum->interval * rate) % GST_SECOND;
|
||||||
if (spectrum->frames_per_interval == 0) {
|
if (spectrum->frames_per_interval == 0) {
|
||||||
spectrum->frames_per_interval = 1;
|
spectrum->frames_per_interval = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_INFO_OBJECT (spectrum, "interval %" GST_TIME_FORMAT ", fpi %"
|
GST_INFO_OBJECT(spectrum, "interval %" GST_TIME_FORMAT ", fpi %" G_GUINT64_FORMAT ", error %" GST_TIME_FORMAT, GST_TIME_ARGS(spectrum->interval), spectrum->frames_per_interval, GST_TIME_ARGS(spectrum->error_per_interval));
|
||||||
G_GUINT64_FORMAT ", error %" GST_TIME_FORMAT,
|
|
||||||
GST_TIME_ARGS (spectrum->interval), spectrum->frames_per_interval,
|
|
||||||
GST_TIME_ARGS (spectrum->error_per_interval));
|
|
||||||
|
|
||||||
spectrum->input_pos = 0;
|
spectrum->input_pos = 0;
|
||||||
|
|
||||||
gst_fastspectrum_flush (spectrum);
|
gst_fastspectrum_flush(spectrum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spectrum->num_frames == 0) {
|
if (spectrum->num_frames == 0) {
|
||||||
spectrum->message_ts = GST_BUFFER_TIMESTAMP (buffer);
|
spectrum->message_ts = GST_BUFFER_TIMESTAMP(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
input_pos = spectrum->input_pos;
|
input_pos = spectrum->input_pos;
|
||||||
input_data = spectrum->input_data;
|
input_data = spectrum->input_data;
|
||||||
|
|
||||||
while (size >= bpf) {
|
while (size >= bpf) {
|
||||||
/* run input_data for a chunk of data */
|
// Run input_data for a chunk of data
|
||||||
fft_todo = nfft - (spectrum->num_frames % nfft);
|
guint fft_todo = nfft - (spectrum->num_frames % nfft);
|
||||||
msg_todo = spectrum->frames_todo - spectrum->num_frames;
|
guint msg_todo = spectrum->frames_todo - spectrum->num_frames;
|
||||||
GST_LOG_OBJECT (spectrum,
|
GST_LOG_OBJECT(spectrum, "message frames todo: %u, fft frames todo: %u, input frames %" G_GSIZE_FORMAT, msg_todo, fft_todo, (size / bpf));
|
||||||
"message frames todo: %u, fft frames todo: %u, input frames %"
|
guint block_size = msg_todo;
|
||||||
G_GSIZE_FORMAT, msg_todo, fft_todo, (size / bpf));
|
|
||||||
block_size = msg_todo;
|
|
||||||
if (block_size > (size / bpf)) {
|
if (block_size > (size / bpf)) {
|
||||||
block_size = (size / bpf);
|
block_size = (size / bpf);
|
||||||
}
|
}
|
||||||
@@ -473,7 +451,7 @@ static GstFlowReturn gst_fastspectrum_transform_ip (GstBaseTransform *trans, Gst
|
|||||||
block_size = fft_todo;
|
block_size = fft_todo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move the current frames into our ringbuffers */
|
// Move the current frames into our ringbuffers
|
||||||
input_data(data, spectrum->input_ring_buffer, block_size, max_value, input_pos, nfft);
|
input_data(data, spectrum->input_ring_buffer, block_size, max_value, input_pos, nfft);
|
||||||
|
|
||||||
data += block_size * bpf;
|
data += block_size * bpf;
|
||||||
@@ -481,25 +459,19 @@ static GstFlowReturn gst_fastspectrum_transform_ip (GstBaseTransform *trans, Gst
|
|||||||
input_pos = (input_pos + block_size) % nfft;
|
input_pos = (input_pos + block_size) % nfft;
|
||||||
spectrum->num_frames += block_size;
|
spectrum->num_frames += block_size;
|
||||||
|
|
||||||
have_full_interval = (spectrum->num_frames == spectrum->frames_todo);
|
gboolean have_full_interval = (spectrum->num_frames == spectrum->frames_todo);
|
||||||
|
|
||||||
GST_LOG_OBJECT (spectrum,
|
GST_LOG_OBJECT(spectrum, "size: %" G_GSIZE_FORMAT ", do-fft = %d, do-message = %d", size, (spectrum->num_frames % nfft == 0), have_full_interval);
|
||||||
"size: %" G_GSIZE_FORMAT ", do-fft = %d, do-message = %d", size,
|
|
||||||
(spectrum->num_frames % nfft == 0), have_full_interval);
|
|
||||||
|
|
||||||
/* If we have enough frames for an FFT or we have all frames required for
|
// If we have enough frames for an FFT or we have all frames required for the interval and we haven't run a FFT, then run an FFT
|
||||||
* the interval and we haven't run a FFT, then run an FFT */
|
|
||||||
if ((spectrum->num_frames % nfft == 0) || (have_full_interval && !spectrum->num_fft)) {
|
if ((spectrum->num_frames % nfft == 0) || (have_full_interval && !spectrum->num_fft)) {
|
||||||
gst_fastspectrum_run_fft (spectrum, input_pos);
|
gst_fastspectrum_run_fft(spectrum, input_pos);
|
||||||
spectrum->num_fft++;
|
spectrum->num_fft++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do we have the FFTs for one interval? */
|
// Do we have the FFTs for one interval?
|
||||||
if (have_full_interval) {
|
if (have_full_interval) {
|
||||||
GST_DEBUG_OBJECT (spectrum, "nfft: %u frames: %" G_GUINT64_FORMAT
|
GST_DEBUG_OBJECT(spectrum, "nfft: %u frames: %" G_GUINT64_FORMAT " fpi: %" G_GUINT64_FORMAT " error: %" GST_TIME_FORMAT, nfft, spectrum->num_frames, spectrum->frames_per_interval, GST_TIME_ARGS(spectrum->accumulated_error));
|
||||||
" fpi: %" G_GUINT64_FORMAT " error: %" GST_TIME_FORMAT, nfft,
|
|
||||||
spectrum->num_frames, spectrum->frames_per_interval,
|
|
||||||
GST_TIME_ARGS (spectrum->accumulated_error));
|
|
||||||
|
|
||||||
spectrum->frames_todo = spectrum->frames_per_interval;
|
spectrum->frames_todo = spectrum->frames_per_interval;
|
||||||
if (spectrum->accumulated_error >= GST_SECOND) {
|
if (spectrum->accumulated_error >= GST_SECOND) {
|
||||||
@@ -511,17 +483,17 @@ static GstFlowReturn gst_fastspectrum_transform_ip (GstBaseTransform *trans, Gst
|
|||||||
if (spectrum->output_callback) {
|
if (spectrum->output_callback) {
|
||||||
// Calculate average
|
// Calculate average
|
||||||
for (guint i = 0; i < spectrum->bands; i++) {
|
for (guint i = 0; i < spectrum->bands; i++) {
|
||||||
spectrum->spect_magnitude[i] /= spectrum->num_fft;
|
spectrum->spect_magnitude[i] /= static_cast<double>(spectrum->num_fft);
|
||||||
}
|
}
|
||||||
|
|
||||||
spectrum->output_callback(spectrum->spect_magnitude, spectrum->bands);
|
spectrum->output_callback(spectrum->spect_magnitude, static_cast<int>(spectrum->bands));
|
||||||
|
|
||||||
// Reset spectrum accumulators
|
// Reset spectrum accumulators
|
||||||
memset(spectrum->spect_magnitude, 0, spectrum->bands * sizeof(double));
|
memset(spectrum->spect_magnitude, 0, spectrum->bands * sizeof(double));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GST_CLOCK_TIME_IS_VALID (spectrum->message_ts)) {
|
if (GST_CLOCK_TIME_IS_VALID(spectrum->message_ts)) {
|
||||||
spectrum->message_ts += gst_util_uint64_scale (spectrum->num_frames, GST_SECOND, rate);
|
spectrum->message_ts += gst_util_uint64_scale(spectrum->num_frames, GST_SECOND, rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
spectrum->num_frames = 0;
|
spectrum->num_frames = 0;
|
||||||
@@ -531,10 +503,10 @@ static GstFlowReturn gst_fastspectrum_transform_ip (GstBaseTransform *trans, Gst
|
|||||||
|
|
||||||
spectrum->input_pos = input_pos;
|
spectrum->input_pos = input_pos;
|
||||||
|
|
||||||
gst_buffer_unmap (buffer, &map);
|
gst_buffer_unmap(buffer, &map);
|
||||||
g_mutex_unlock (&spectrum->lock);
|
g_mutex_unlock(&spectrum->lock);
|
||||||
|
|
||||||
g_assert (size == 0);
|
g_assert(size == 0);
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
|
||||||
|
|||||||
@@ -38,38 +38,37 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GST_TYPE_FASTSPECTRUM (gst_fastspectrum_get_type())
|
#define GST_TYPE_FASTSPECTRUM (gst_fastspectrum_get_type())
|
||||||
#define GST_FASTSPECTRUM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_FASTSPECTRUM,GstFastSpectrum))
|
#define GST_FASTSPECTRUM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_FASTSPECTRUM, GstFastSpectrum))
|
||||||
#define GST_IS_FASTSPECTRUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_FASTSPECTRUM))
|
#define GST_IS_FASTSPECTRUM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_FASTSPECTRUM))
|
||||||
#define GST_FASTSPECTRUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_FASTSPECTRUM,GstFastSpectrumClass))
|
#define GST_FASTSPECTRUM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_FASTSPECTRUM, GstFastSpectrumClass))
|
||||||
#define GST_IS_FASTSPECTRUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_FASTSPECTRUM))
|
#define GST_IS_FASTSPECTRUM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_FASTSPECTRUM))
|
||||||
|
|
||||||
class QMutex;
|
class QMutex;
|
||||||
|
|
||||||
typedef void (*GstFastSpectrumInputData)(const guint8* in, double* out, guint len, double max_value, guint op, guint nfft);
|
typedef void (*GstFastSpectrumInputData)(const guint8 *in, double *out, guint len, double max_value, guint op, guint nfft);
|
||||||
|
|
||||||
typedef std::function<void(double* magnitudes, int size)> OutputCallback;
|
typedef std::function<void(double *magnitudes, int size)> OutputCallback;
|
||||||
|
|
||||||
struct GstFastSpectrum {
|
struct GstFastSpectrum {
|
||||||
GstAudioFilter parent;
|
GstAudioFilter parent;
|
||||||
|
|
||||||
/* properties */
|
// Properties
|
||||||
guint64 interval; /* how many nanoseconds between emits */
|
guint64 interval; // How many nanoseconds between emits
|
||||||
guint64 frames_per_interval; /* how many frames per interval */
|
guint64 frames_per_interval; // How many frames per interval
|
||||||
guint64 frames_todo;
|
guint64 frames_todo;
|
||||||
guint bands; /* number of spectrum bands */
|
guint bands; // Number of spectrum bands
|
||||||
gboolean multi_channel; /* send separate channel results */
|
gboolean multi_channel; // Send separate channel results
|
||||||
|
|
||||||
guint64 num_frames; /* frame count (1 sample per channel)
|
guint64 num_frames; // Frame count (1 sample per channel) since last emit
|
||||||
* since last emit */
|
guint64 num_fft; // Number of FFTs since last emit
|
||||||
guint64 num_fft; /* number of FFTs since last emit */
|
GstClockTime message_ts; // Starttime for next message
|
||||||
GstClockTime message_ts; /* starttime for next message */
|
|
||||||
|
|
||||||
/* <private> */
|
// <private>
|
||||||
bool channel_data_initialized;
|
bool channel_data_initialized;
|
||||||
double* input_ring_buffer;
|
double *input_ring_buffer;
|
||||||
double* fft_input;
|
double *fft_input;
|
||||||
fftw_complex* fft_output;
|
fftw_complex *fft_output;
|
||||||
double* spect_magnitude;
|
double *spect_magnitude;
|
||||||
fftw_plan plan;
|
fftw_plan plan;
|
||||||
|
|
||||||
guint input_pos;
|
guint input_pos;
|
||||||
@@ -87,11 +86,11 @@ struct GstFastSpectrumClass {
|
|||||||
GstAudioFilterClass parent_class;
|
GstAudioFilterClass parent_class;
|
||||||
|
|
||||||
// Static lock for creating & destroying FFTW plans.
|
// Static lock for creating & destroying FFTW plans.
|
||||||
QMutex* fftw_lock;
|
QMutex *fftw_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_fastspectrum_get_type (void);
|
GType gst_fastspectrum_get_type(void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif // GST_MOODBAR_FASTSPECTRUM_H
|
#endif // GST_MOODBAR_FASTSPECTRUM_H
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ static gboolean gst_moodbar_plugin_init(GstPlugin *plugin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
#define GST_MOODBAR_PLUGIN_H
|
#define GST_MOODBAR_PLUGIN_H
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
int gstfastspectrum_register_static();
|
int gstfastspectrum_register_static();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GST_MOODBAR_PLUGIN_H
|
#endif // GST_MOODBAR_PLUGIN_H
|
||||||
|
|||||||
@@ -52,18 +52,17 @@
|
|||||||
namespace logging {
|
namespace logging {
|
||||||
|
|
||||||
static Level sDefaultLevel = Level_Debug;
|
static Level sDefaultLevel = Level_Debug;
|
||||||
static QMap<QString, Level>* sClassLevels = nullptr;
|
static QMap<QString, Level> *sClassLevels = nullptr;
|
||||||
static QIODevice *sNullDevice = nullptr;
|
static QIODevice *sNullDevice = nullptr;
|
||||||
|
|
||||||
//const char* kDefaultLogLevels = "*:3";
|
const char *kDefaultLogLevels = "*:3";
|
||||||
const char *kDefaultLogLevels = "GstEnginePipeline:2,*:3";
|
|
||||||
|
|
||||||
static const char *kMessageHandlerMagic = "__logging_message__";
|
static const char *kMessageHandlerMagic = "__logging_message__";
|
||||||
static const size_t kMessageHandlerMagicLength = strlen(kMessageHandlerMagic);
|
static const size_t kMessageHandlerMagicLength = strlen(kMessageHandlerMagic);
|
||||||
static QtMessageHandler sOriginalMessageHandler = nullptr;
|
static QtMessageHandler sOriginalMessageHandler = nullptr;
|
||||||
|
|
||||||
template <class T>
|
template<class T>
|
||||||
static T CreateLogger(Level level, const QString& class_name, int line, const char* category);
|
static T CreateLogger(Level level, const QString &class_name, int line, const char *category);
|
||||||
|
|
||||||
void GLog(const char *domain, int level, const char *message, void*) {
|
void GLog(const char *domain, int level, const char *message, void*) {
|
||||||
|
|
||||||
@@ -89,13 +88,13 @@ void GLog(const char *domain, int level, const char *message, void*) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template<class T>
|
||||||
class DebugBase : public QDebug {
|
class DebugBase : public QDebug {
|
||||||
public:
|
public:
|
||||||
DebugBase() : QDebug(sNullDevice) {}
|
DebugBase() : QDebug(sNullDevice) {}
|
||||||
explicit DebugBase(QtMsgType t) : QDebug(t) {}
|
explicit DebugBase(QtMsgType t) : QDebug(t) {}
|
||||||
T& space() { return static_cast<T&>(QDebug::space()); }
|
T &space() { return static_cast<T&>(QDebug::space()); }
|
||||||
T& noSpace() { return static_cast<T&>(QDebug::nospace()); }
|
T &nospace() { return static_cast<T&>(QDebug::nospace()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// Debug message will be stored in a buffer.
|
// Debug message will be stored in a buffer.
|
||||||
@@ -112,7 +111,7 @@ class BufferedDebug : public DebugBase<BufferedDebug> {
|
|||||||
|
|
||||||
// Delete function for the buffer. Since a base class is holding a reference to the raw pointer,
|
// Delete function for the buffer. Since a base class is holding a reference to the raw pointer,
|
||||||
// it shouldn't be deleted until after the deletion of this object is complete.
|
// it shouldn't be deleted until after the deletion of this object is complete.
|
||||||
static void later_deleter(QBuffer* b) { b->deleteLater(); }
|
static void later_deleter(QBuffer *b) { b->deleteLater(); }
|
||||||
|
|
||||||
std::shared_ptr<QBuffer> buf_;
|
std::shared_ptr<QBuffer> buf_;
|
||||||
};
|
};
|
||||||
@@ -126,8 +125,9 @@ class LoggedDebug : public DebugBase<LoggedDebug> {
|
|||||||
|
|
||||||
static void MessageHandler(QtMsgType type, const QMessageLogContext&, const QString &message) {
|
static void MessageHandler(QtMsgType type, const QMessageLogContext&, const QString &message) {
|
||||||
|
|
||||||
if (strncmp(kMessageHandlerMagic, message.toLocal8Bit().data(), kMessageHandlerMagicLength) == 0) {
|
if (message.startsWith(kMessageHandlerMagic)) {
|
||||||
fprintf(stderr, "%s\n", message.toLocal8Bit().data() + kMessageHandlerMagicLength);
|
fprintf(type == QtCriticalMsg || type == QtFatalMsg ? stderr : stdout, "%s\n", message.toUtf8().data() + kMessageHandlerMagicLength);
|
||||||
|
fflush(type == QtCriticalMsg || type == QtFatalMsg ? stderr : stdout);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,12 +146,13 @@ static void MessageHandler(QtMsgType type, const QMessageLogContext&, const QStr
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const QString& line : message.split('\n')) {
|
for (const QString &line : message.split('\n')) {
|
||||||
BufferedDebug d = CreateLogger<BufferedDebug>(level, "unknown", -1, nullptr);
|
BufferedDebug d = CreateLogger<BufferedDebug>(level, "unknown", -1, nullptr);
|
||||||
d << line.toLocal8Bit().constData();
|
d << line.toLocal8Bit().constData();
|
||||||
if (d.buf_) {
|
if (d.buf_) {
|
||||||
d.buf_->close();
|
d.buf_->close();
|
||||||
fprintf(stderr, "%s\n", d.buf_->buffer().data());
|
fprintf(type == QtCriticalMsg || type == QtFatalMsg ? stderr : stdout, "%s\n", d.buf_->buffer().data());
|
||||||
|
fflush(type == QtCriticalMsg || type == QtFatalMsg ? stderr : stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,6 +175,7 @@ void Init() {
|
|||||||
if (!sOriginalMessageHandler) {
|
if (!sOriginalMessageHandler) {
|
||||||
sOriginalMessageHandler = qInstallMessageHandler(MessageHandler);
|
sOriginalMessageHandler = qInstallMessageHandler(MessageHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetLevels(const QString &levels) {
|
void SetLevels(const QString &levels) {
|
||||||
@@ -213,9 +215,9 @@ static QString ParsePrettyFunction(const char *pretty_function) {
|
|||||||
|
|
||||||
// Get the class name out of the function name.
|
// Get the class name out of the function name.
|
||||||
QString class_name = pretty_function;
|
QString class_name = pretty_function;
|
||||||
const int paren = class_name.indexOf('(');
|
const qint64 paren = class_name.indexOf('(');
|
||||||
if (paren != -1) {
|
if (paren != -1) {
|
||||||
const int colons = class_name.lastIndexOf("::", paren);
|
const qint64 colons = class_name.lastIndexOf("::", paren);
|
||||||
if (colons != -1) {
|
if (colons != -1) {
|
||||||
class_name = class_name.left(colons);
|
class_name = class_name.left(colons);
|
||||||
}
|
}
|
||||||
@@ -224,16 +226,17 @@ static QString ParsePrettyFunction(const char *pretty_function) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const int space = class_name.lastIndexOf(' ');
|
const qint64 space = class_name.lastIndexOf(' ');
|
||||||
if (space != -1) {
|
if (space != -1) {
|
||||||
class_name = class_name.mid(space + 1);
|
class_name = class_name.mid(space + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return class_name;
|
return class_name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static T CreateLogger(Level level, const QString &class_name, int line, const char* category) {
|
static T CreateLogger(Level level, const QString &class_name, int line, const char *category) {
|
||||||
|
|
||||||
// Map the level to a string
|
// Map the level to a string
|
||||||
const char *level_name = nullptr;
|
const char *level_name = nullptr;
|
||||||
@@ -270,11 +273,10 @@ static T CreateLogger(Level level, const QString &class_name, int line, const ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
T ret(type);
|
T ret(type);
|
||||||
ret.nospace() << QDateTime::currentDateTime().toString("hh:mm:ss.zzz").toLatin1().constData()
|
ret.nospace() << QDateTime::currentDateTime().toString("hh:mm:ss.zzz").toLatin1().constData() << level_name << function_line.leftJustified(32).toLatin1().constData();
|
||||||
<< level_name
|
|
||||||
<< function_line.leftJustified(32).toLatin1().constData();
|
|
||||||
|
|
||||||
return ret.space();
|
return ret.space();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_UNIX
|
#ifdef Q_OS_UNIX
|
||||||
@@ -304,6 +306,7 @@ QString LinuxDemangle(const QString &symbol) {
|
|||||||
}
|
}
|
||||||
QString mangled_function = match.captured(1);
|
QString mangled_function = match.captured(1);
|
||||||
return CXXDemangle(mangled_function);
|
return CXXDemangle(mangled_function);
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif // Q_OS_LINUX
|
#endif // Q_OS_LINUX
|
||||||
|
|
||||||
@@ -311,11 +314,11 @@ QString LinuxDemangle(const QString &symbol) {
|
|||||||
QString DarwinDemangle(const QString &symbol);
|
QString DarwinDemangle(const QString &symbol);
|
||||||
QString DarwinDemangle(const QString &symbol) {
|
QString DarwinDemangle(const QString &symbol) {
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
# if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||||
QStringList split = symbol.split(' ', Qt::SkipEmptyParts);
|
QStringList split = symbol.split(' ', Qt::SkipEmptyParts);
|
||||||
#else
|
# else
|
||||||
QStringList split = symbol.split(' ', QString::SkipEmptyParts);
|
QStringList split = symbol.split(' ', QString::SkipEmptyParts);
|
||||||
#endif
|
# endif
|
||||||
QString mangled_function = split[3];
|
QString mangled_function = split[3];
|
||||||
return CXXDemangle(mangled_function);
|
return CXXDemangle(mangled_function);
|
||||||
|
|
||||||
@@ -324,6 +327,7 @@ QString DarwinDemangle(const QString &symbol) {
|
|||||||
|
|
||||||
QString DemangleSymbol(const QString &symbol);
|
QString DemangleSymbol(const QString &symbol);
|
||||||
QString DemangleSymbol(const QString &symbol) {
|
QString DemangleSymbol(const QString &symbol) {
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
return DarwinDemangle(symbol);
|
return DarwinDemangle(symbol);
|
||||||
#elif defined(Q_OS_LINUX)
|
#elif defined(Q_OS_LINUX)
|
||||||
@@ -331,9 +335,11 @@ QString DemangleSymbol(const QString &symbol) {
|
|||||||
#else
|
#else
|
||||||
return symbol;
|
return symbol;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DumpStackTrace() {
|
void DumpStackTrace() {
|
||||||
|
|
||||||
#ifdef HAVE_BACKTRACE
|
#ifdef HAVE_BACKTRACE
|
||||||
void *callstack[128];
|
void *callstack[128];
|
||||||
int callstack_size = backtrace(reinterpret_cast<void**>(&callstack), sizeof(callstack));
|
int callstack_size = backtrace(reinterpret_cast<void**>(&callstack), sizeof(callstack));
|
||||||
@@ -346,11 +352,11 @@ void DumpStackTrace() {
|
|||||||
#else
|
#else
|
||||||
qLog(Debug) << "FIXME: Implement printing stack traces on this platform";
|
qLog(Debug) << "FIXME: Implement printing stack traces on this platform";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// These are the functions that create loggers for the rest of Clementine.
|
// These are the functions that create loggers for the rest of Strawberry.
|
||||||
// It's okay that the LoggedDebug instance is copied to a QDebug in these. It
|
// It's okay that the LoggedDebug instance is copied to a QDebug in these. It doesn't override any behavior that should be needed after return.
|
||||||
// doesn't override any behavior that should be needed after return.
|
|
||||||
#define qCreateLogger(line, pretty_function, category, level) logging::CreateLogger<LoggedDebug>(logging::Level_##level, logging::ParsePrettyFunction(pretty_function), line, category)
|
#define qCreateLogger(line, pretty_function, category, level) logging::CreateLogger<LoggedDebug>(logging::Level_##level, logging::ParsePrettyFunction(pretty_function), line, category)
|
||||||
|
|
||||||
QDebug CreateLoggerInfo(int line, const char *pretty_function, const char *category) { return qCreateLogger(line, pretty_function, category, Info); }
|
QDebug CreateLoggerInfo(int line, const char *pretty_function, const char *category) { return qCreateLogger(line, pretty_function, category, Info); }
|
||||||
@@ -360,20 +366,20 @@ QDebug CreateLoggerError(int line, const char *pretty_function, const char *cate
|
|||||||
#ifdef QT_NO_WARNING_OUTPUT
|
#ifdef QT_NO_WARNING_OUTPUT
|
||||||
QNoDebug CreateLoggerWarning(int, const char*, const char*) { return QNoDebug(); }
|
QNoDebug CreateLoggerWarning(int, const char*, const char*) { return QNoDebug(); }
|
||||||
#else
|
#else
|
||||||
QDebug CreateLoggerWarning(int line, const char *pretty_function, const char* category) { return qCreateLogger(line, pretty_function, category, Warning); }
|
QDebug CreateLoggerWarning(int line, const char *pretty_function, const char *category) { return qCreateLogger(line, pretty_function, category, Warning); }
|
||||||
#endif // QT_NO_WARNING_OUTPUT
|
#endif // QT_NO_WARNING_OUTPUT
|
||||||
|
|
||||||
#ifdef QT_NO_DEBUG_OUTPUT
|
#ifdef QT_NO_DEBUG_OUTPUT
|
||||||
QNoDebug CreateLoggerDebug(int, const char*, const char*) { return QNoDebug(); }
|
QNoDebug CreateLoggerDebug(int, const char*, const char*) { return QNoDebug(); }
|
||||||
#else
|
#else
|
||||||
QDebug CreateLoggerDebug(int line, const char *pretty_function, const char* category) { return qCreateLogger(line, pretty_function, category, Debug); }
|
QDebug CreateLoggerDebug(int line, const char *pretty_function, const char *category) { return qCreateLogger(line, pretty_function, category, Debug); }
|
||||||
#endif // QT_NO_DEBUG_OUTPUT
|
#endif // QT_NO_DEBUG_OUTPUT
|
||||||
|
|
||||||
} // namespace logging
|
} // namespace logging
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
template <typename T>
|
template<typename T>
|
||||||
QString print_duration(T duration, const std::string &unit) {
|
QString print_duration(T duration, const std::string &unit) {
|
||||||
return QString("%1%2").arg(duration.count()).arg(unit.c_str());
|
return QString("%1%2").arg(duration.count()).arg(unit.c_str());
|
||||||
}
|
}
|
||||||
@@ -384,4 +390,3 @@ QDebug operator<<(QDebug dbg, std::chrono::seconds secs) {
|
|||||||
dbg.nospace() << print_duration(secs, "s");
|
dbg.nospace() << print_duration(secs, "s");
|
||||||
return dbg.space();
|
return dbg.space();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,28 +68,27 @@ enum Level {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void SetLevels(const QString& levels);
|
void SetLevels(const QString &levels);
|
||||||
|
|
||||||
void DumpStackTrace();
|
void DumpStackTrace();
|
||||||
|
|
||||||
QDebug CreateLoggerInfo(int line, const char *pretty_function, const char* category);
|
QDebug CreateLoggerInfo(int line, const char *pretty_function, const char *category);
|
||||||
QDebug CreateLoggerFatal(int line, const char *pretty_function, const char* category);
|
QDebug CreateLoggerFatal(int line, const char *pretty_function, const char *category);
|
||||||
QDebug CreateLoggerError(int line, const char *pretty_function, const char* category);
|
QDebug CreateLoggerError(int line, const char *pretty_function, const char *category);
|
||||||
|
|
||||||
#ifdef QT_NO_WARNING_OUTPUT
|
#ifdef QT_NO_WARNING_OUTPUT
|
||||||
QNoDebug CreateLoggerWarning(int, const char*, const char*);
|
QNoDebug CreateLoggerWarning(int, const char*, const char*);
|
||||||
#else
|
#else
|
||||||
QDebug CreateLoggerWarning(int line, const char *pretty_function, const char* category);
|
QDebug CreateLoggerWarning(int line, const char *pretty_function, const char *category);
|
||||||
#endif // QT_NO_WARNING_OUTPUT
|
#endif // QT_NO_WARNING_OUTPUT
|
||||||
|
|
||||||
#ifdef QT_NO_DEBUG_OUTPUT
|
#ifdef QT_NO_DEBUG_OUTPUT
|
||||||
QNoDebug CreateLoggerDebug(int, const char*, const char*);
|
QNoDebug CreateLoggerDebug(int, const char*, const char*);
|
||||||
#else
|
#else
|
||||||
QDebug CreateLoggerDebug(int line, const char *pretty_function, const char* category);
|
QDebug CreateLoggerDebug(int line, const char *pretty_function, const char *category);
|
||||||
#endif // QT_NO_DEBUG_OUTPUT
|
#endif // QT_NO_DEBUG_OUTPUT
|
||||||
|
|
||||||
|
void GLog(const char *domain, int level, const char *message, void *user_data);
|
||||||
void GLog(const char* domain, int level, const char* message, void* user_data);
|
|
||||||
|
|
||||||
extern const char *kDefaultLogLevels;
|
extern const char *kDefaultLogLevels;
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ void _MessageHandlerBase::WriteMessage(const QByteArray &data) {
|
|||||||
|
|
||||||
QDataStream s(device_);
|
QDataStream s(device_);
|
||||||
s << quint32(data.length());
|
s << quint32(data.length());
|
||||||
s.writeRawData(data.data(), data.length());
|
s.writeRawData(data.data(), static_cast<int>(data.length()));
|
||||||
|
|
||||||
// Sorry.
|
// Sorry.
|
||||||
if (flush_abstract_socket_) {
|
if (flush_abstract_socket_) {
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class _MessageHandlerBase : public QObject {
|
|||||||
|
|
||||||
// Reads and writes uint32 length encoded MessageType messages to a socket.
|
// Reads and writes uint32 length encoded MessageType messages to a socket.
|
||||||
// You should subclass this and implement the MessageArrived(MessageType) method.
|
// You should subclass this and implement the MessageArrived(MessageType) method.
|
||||||
template <typename MT>
|
template<typename MT>
|
||||||
class AbstractMessageHandler : public _MessageHandlerBase {
|
class AbstractMessageHandler : public _MessageHandlerBase {
|
||||||
public:
|
public:
|
||||||
AbstractMessageHandler(QIODevice *device, QObject *parent);
|
AbstractMessageHandler(QIODevice *device, QObject *parent);
|
||||||
@@ -115,11 +115,11 @@ class AbstractMessageHandler : public _MessageHandlerBase {
|
|||||||
QMap<int, ReplyType*> pending_replies_;
|
QMap<int, ReplyType*> pending_replies_;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename MT>
|
template<typename MT>
|
||||||
AbstractMessageHandler<MT>::AbstractMessageHandler(QIODevice *device, QObject *parent)
|
AbstractMessageHandler<MT>::AbstractMessageHandler(QIODevice *device, QObject *parent)
|
||||||
: _MessageHandlerBase(device, parent) {}
|
: _MessageHandlerBase(device, parent) {}
|
||||||
|
|
||||||
template <typename MT>
|
template<typename MT>
|
||||||
void AbstractMessageHandler<MT>::SendMessage(const MessageType &message) {
|
void AbstractMessageHandler<MT>::SendMessage(const MessageType &message) {
|
||||||
Q_ASSERT(QThread::currentThread() == thread());
|
Q_ASSERT(QThread::currentThread() == thread());
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ void AbstractMessageHandler<MT>::SendMessage(const MessageType &message) {
|
|||||||
WriteMessage(QByteArray(data.data(), data.size()));
|
WriteMessage(QByteArray(data.data(), data.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename MT>
|
template<typename MT>
|
||||||
void AbstractMessageHandler<MT>::SendMessageAsync(const MessageType &message) {
|
void AbstractMessageHandler<MT>::SendMessageAsync(const MessageType &message) {
|
||||||
std::string data = message.SerializeAsString();
|
std::string data = message.SerializeAsString();
|
||||||
QMetaObject::invokeMethod(this, "WriteMessage", Qt::QueuedConnection, Q_ARG(QByteArray, QByteArray(data.data(), data.size())));
|
QMetaObject::invokeMethod(this, "WriteMessage", Qt::QueuedConnection, Q_ARG(QByteArray, QByteArray(data.data(), data.size())));
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class _MessageReplyBase : public QObject {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// A reply future class that is returned immediately for requests that will occur in the background. Similar to QNetworkReply.
|
// A reply future class that is returned immediately for requests that will occur in the background. Similar to QNetworkReply.
|
||||||
template <typename MessageType>
|
template<typename MessageType>
|
||||||
class MessageReply : public _MessageReplyBase {
|
class MessageReply : public _MessageReplyBase {
|
||||||
public:
|
public:
|
||||||
explicit MessageReply(const MessageType &request_message, QObject *parent = nullptr);
|
explicit MessageReply(const MessageType &request_message, QObject *parent = nullptr);
|
||||||
|
|||||||
@@ -19,6 +19,9 @@
|
|||||||
#ifndef WORKERPOOL_H
|
#ifndef WORKERPOOL_H
|
||||||
#define WORKERPOOL_H
|
#define WORKERPOOL_H
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <cstdio>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
@@ -56,6 +59,8 @@ class _WorkerPoolBase : public QObject {
|
|||||||
protected slots:
|
protected slots:
|
||||||
virtual void DoStart() {}
|
virtual void DoStart() {}
|
||||||
virtual void NewConnection() {}
|
virtual void NewConnection() {}
|
||||||
|
virtual void ProcessReadyReadStandardOutput() {}
|
||||||
|
virtual void ProcessReadyReadStandardError() {}
|
||||||
virtual void ProcessError(QProcess::ProcessError) {}
|
virtual void ProcessError(QProcess::ProcessError) {}
|
||||||
virtual void SendQueuedMessages() {}
|
virtual void SendQueuedMessages() {}
|
||||||
};
|
};
|
||||||
@@ -65,7 +70,7 @@ class _WorkerPoolBase : public QObject {
|
|||||||
// A local socket server is started for each process, and the address is passed to the process as argv[1].
|
// A local socket server is started for each process, and the address is passed to the process as argv[1].
|
||||||
// The process is expected to connect back to the socket server, and when it does a HandlerType is created for it.
|
// The process is expected to connect back to the socket server, and when it does a HandlerType is created for it.
|
||||||
// Instances of HandlerType are created in the WorkerPool's thread.
|
// Instances of HandlerType are created in the WorkerPool's thread.
|
||||||
template <typename HandlerType>
|
template<typename HandlerType>
|
||||||
class WorkerPool : public _WorkerPoolBase {
|
class WorkerPool : public _WorkerPoolBase {
|
||||||
public:
|
public:
|
||||||
explicit WorkerPool(QObject *parent = nullptr);
|
explicit WorkerPool(QObject *parent = nullptr);
|
||||||
@@ -98,6 +103,8 @@ class WorkerPool : public _WorkerPoolBase {
|
|||||||
// These are all reimplemented slots, they are called on the WorkerPool's thread.
|
// These are all reimplemented slots, they are called on the WorkerPool's thread.
|
||||||
void DoStart() override;
|
void DoStart() override;
|
||||||
void NewConnection() override;
|
void NewConnection() override;
|
||||||
|
void ProcessReadyReadStandardOutput() override;
|
||||||
|
void ProcessReadyReadStandardError() override;
|
||||||
void ProcessError(QProcess::ProcessError error) override;
|
void ProcessError(QProcess::ProcessError error) override;
|
||||||
void SendQueuedMessages() override;
|
void SendQueuedMessages() override;
|
||||||
|
|
||||||
@@ -114,9 +121,9 @@ class WorkerPool : public _WorkerPoolBase {
|
|||||||
// Must only ever be called on my thread.
|
// Must only ever be called on my thread.
|
||||||
void StartOneWorker(Worker *worker);
|
void StartOneWorker(Worker *worker);
|
||||||
|
|
||||||
template <typename T>
|
template<typename T>
|
||||||
Worker *FindWorker(T Worker::*member, T value) {
|
Worker *FindWorker(T Worker::*member, T value) {
|
||||||
for (typename QList<Worker>::iterator it = workers_.begin() ; it != workers_.end() ; ++it) {
|
for (typename QList<Worker>::iterator it = workers_.begin(); it != workers_.end(); ++it) {
|
||||||
if ((*it).*member == value) {
|
if ((*it).*member == value) {
|
||||||
return &(*it);
|
return &(*it);
|
||||||
}
|
}
|
||||||
@@ -124,7 +131,7 @@ class WorkerPool : public _WorkerPoolBase {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template<typename T>
|
||||||
void DeleteQObjectPointerLater(T **p) {
|
void DeleteQObjectPointerLater(T **p) {
|
||||||
if (*p) {
|
if (*p) {
|
||||||
(*p)->deleteLater();
|
(*p)->deleteLater();
|
||||||
@@ -151,15 +158,15 @@ class WorkerPool : public _WorkerPoolBase {
|
|||||||
QAtomicInt next_id_;
|
QAtomicInt next_id_;
|
||||||
|
|
||||||
QMutex message_queue_mutex_;
|
QMutex message_queue_mutex_;
|
||||||
QQueue<ReplyType*> message_queue_;
|
QQueue<ReplyType *> message_queue_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <typename HandlerType>
|
template<typename HandlerType>
|
||||||
WorkerPool<HandlerType>::WorkerPool(QObject *parent)
|
WorkerPool<HandlerType>::WorkerPool(QObject *parent)
|
||||||
: _WorkerPoolBase(parent),
|
: _WorkerPoolBase(parent),
|
||||||
next_worker_(0),
|
next_worker_(0),
|
||||||
next_id_(0) {
|
next_id_(0) {
|
||||||
|
|
||||||
worker_count_ = qBound(1, QThread::idealThreadCount() / 2, 4);
|
worker_count_ = qBound(1, QThread::idealThreadCount() / 2, 4);
|
||||||
local_server_name_ = qApp->applicationName().toLower();
|
local_server_name_ = qApp->applicationName().toLower();
|
||||||
@@ -170,12 +177,14 @@ WorkerPool<HandlerType>::WorkerPool(QObject *parent)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename HandlerType>
|
template<typename HandlerType>
|
||||||
WorkerPool<HandlerType>::~WorkerPool() {
|
WorkerPool<HandlerType>::~WorkerPool() {
|
||||||
|
|
||||||
for (const Worker &worker : workers_) {
|
for (const Worker &worker : workers_) {
|
||||||
if (worker.local_socket_ && worker.process_) {
|
if (worker.local_socket_ && worker.process_) {
|
||||||
QObject::disconnect(worker.process_, &QProcess::errorOccurred, this, &WorkerPool::ProcessError);
|
QObject::disconnect(worker.process_, &QProcess::errorOccurred, this, &WorkerPool::ProcessError);
|
||||||
|
QObject::disconnect(worker.process_, &QProcess::readyReadStandardOutput, this, &WorkerPool::ProcessReadyReadStandardOutput);
|
||||||
|
QObject::disconnect(worker.process_, &QProcess::readyReadStandardError, this, &WorkerPool::ProcessReadyReadStandardError);
|
||||||
|
|
||||||
// The worker is connected. Close his socket and wait for him to exit.
|
// The worker is connected. Close his socket and wait for him to exit.
|
||||||
qLog(Debug) << "Closing worker socket";
|
qLog(Debug) << "Closing worker socket";
|
||||||
@@ -199,30 +208,30 @@ WorkerPool<HandlerType>::~WorkerPool() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename HandlerType>
|
template<typename HandlerType>
|
||||||
void WorkerPool<HandlerType>::SetWorkerCount(const int count) {
|
void WorkerPool<HandlerType>::SetWorkerCount(const int count) {
|
||||||
Q_ASSERT(workers_.isEmpty());
|
Q_ASSERT(workers_.isEmpty());
|
||||||
worker_count_ = count;
|
worker_count_ = count;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename HandlerType>
|
template<typename HandlerType>
|
||||||
void WorkerPool<HandlerType>::SetLocalServerName(const QString &local_server_name) {
|
void WorkerPool<HandlerType>::SetLocalServerName(const QString &local_server_name) {
|
||||||
Q_ASSERT(workers_.isEmpty());
|
Q_ASSERT(workers_.isEmpty());
|
||||||
local_server_name_ = local_server_name;
|
local_server_name_ = local_server_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename HandlerType>
|
template<typename HandlerType>
|
||||||
void WorkerPool<HandlerType>::SetExecutableName(const QString &executable_name) {
|
void WorkerPool<HandlerType>::SetExecutableName(const QString &executable_name) {
|
||||||
Q_ASSERT(workers_.isEmpty());
|
Q_ASSERT(workers_.isEmpty());
|
||||||
executable_name_ = executable_name;
|
executable_name_ = executable_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename HandlerType>
|
template<typename HandlerType>
|
||||||
void WorkerPool<HandlerType>::Start() {
|
void WorkerPool<HandlerType>::Start() {
|
||||||
QMetaObject::invokeMethod(this, "DoStart");
|
QMetaObject::invokeMethod(this, "DoStart");
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename HandlerType>
|
template<typename HandlerType>
|
||||||
void WorkerPool<HandlerType>::DoStart() {
|
void WorkerPool<HandlerType>::DoStart() {
|
||||||
|
|
||||||
Q_ASSERT(workers_.isEmpty());
|
Q_ASSERT(workers_.isEmpty());
|
||||||
@@ -261,7 +270,7 @@ void WorkerPool<HandlerType>::DoStart() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename HandlerType>
|
template<typename HandlerType>
|
||||||
void WorkerPool<HandlerType>::StartOneWorker(Worker *worker) {
|
void WorkerPool<HandlerType>::StartOneWorker(Worker *worker) {
|
||||||
|
|
||||||
Q_ASSERT(QThread::currentThread() == thread());
|
Q_ASSERT(QThread::currentThread() == thread());
|
||||||
@@ -276,6 +285,8 @@ void WorkerPool<HandlerType>::StartOneWorker(Worker *worker) {
|
|||||||
|
|
||||||
QObject::connect(worker->local_server_, &QLocalServer::newConnection, this, &WorkerPool::NewConnection);
|
QObject::connect(worker->local_server_, &QLocalServer::newConnection, this, &WorkerPool::NewConnection);
|
||||||
QObject::connect(worker->process_, &QProcess::errorOccurred, this, &WorkerPool::ProcessError);
|
QObject::connect(worker->process_, &QProcess::errorOccurred, this, &WorkerPool::ProcessError);
|
||||||
|
QObject::connect(worker->process_, &QProcess::readyReadStandardOutput, this, &WorkerPool::ProcessReadyReadStandardOutput);
|
||||||
|
QObject::connect(worker->process_, &QProcess::readyReadStandardError, this, &WorkerPool::ProcessReadyReadStandardError);
|
||||||
|
|
||||||
// Create a server, find an unused name and start listening
|
// Create a server, find an unused name and start listening
|
||||||
forever {
|
forever {
|
||||||
@@ -293,17 +304,16 @@ void WorkerPool<HandlerType>::StartOneWorker(Worker *worker) {
|
|||||||
|
|
||||||
qLog(Debug) << "Starting worker" << worker << executable_path_ << worker->local_server_->fullServerName();
|
qLog(Debug) << "Starting worker" << worker << executable_path_ << worker->local_server_->fullServerName();
|
||||||
|
|
||||||
// Start the process
|
#ifdef Q_OS_WIN32
|
||||||
#if defined(Q_OS_WIN32) && defined(QT_NO_DEBUG_OUTPUT) && !defined(ENABLE_WIN32_CONSOLE)
|
|
||||||
worker->process_->setProcessChannelMode(QProcess::SeparateChannels);
|
worker->process_->setProcessChannelMode(QProcess::SeparateChannels);
|
||||||
#else
|
#else
|
||||||
worker->process_->setProcessChannelMode(QProcess::ForwardedChannels);
|
worker->process_->setProcessChannelMode(QProcess::ForwardedChannels);
|
||||||
#endif
|
#endif
|
||||||
worker->process_->start(executable_path_, QStringList() << worker->local_server_->fullServerName());
|
|
||||||
|
|
||||||
|
worker->process_->start(executable_path_, QStringList() << worker->local_server_->fullServerName());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename HandlerType>
|
template<typename HandlerType>
|
||||||
void WorkerPool<HandlerType>::NewConnection() {
|
void WorkerPool<HandlerType>::NewConnection() {
|
||||||
|
|
||||||
Q_ASSERT(QThread::currentThread() == thread());
|
Q_ASSERT(QThread::currentThread() == thread());
|
||||||
@@ -328,9 +338,10 @@ void WorkerPool<HandlerType>::NewConnection() {
|
|||||||
worker->handler_ = new HandlerType(worker->local_socket_, this);
|
worker->handler_ = new HandlerType(worker->local_socket_, this);
|
||||||
|
|
||||||
SendQueuedMessages();
|
SendQueuedMessages();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename HandlerType>
|
template<typename HandlerType>
|
||||||
void WorkerPool<HandlerType>::ProcessError(QProcess::ProcessError error) {
|
void WorkerPool<HandlerType>::ProcessError(QProcess::ProcessError error) {
|
||||||
|
|
||||||
Q_ASSERT(QThread::currentThread() == thread());
|
Q_ASSERT(QThread::currentThread() == thread());
|
||||||
@@ -358,6 +369,32 @@ void WorkerPool<HandlerType>::ProcessError(QProcess::ProcessError error) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename HandlerType>
|
||||||
|
void WorkerPool<HandlerType>::ProcessReadyReadStandardOutput() {
|
||||||
|
|
||||||
|
Q_ASSERT(QThread::currentThread() == thread());
|
||||||
|
|
||||||
|
QProcess *process = qobject_cast<QProcess*>(sender());
|
||||||
|
QByteArray data = process->readAllStandardOutput();
|
||||||
|
|
||||||
|
fprintf(stdout, "%s", data.data());
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename HandlerType>
|
||||||
|
void WorkerPool<HandlerType>::ProcessReadyReadStandardError() {
|
||||||
|
|
||||||
|
Q_ASSERT(QThread::currentThread() == thread());
|
||||||
|
|
||||||
|
QProcess *process = qobject_cast<QProcess*>(sender());
|
||||||
|
QByteArray data = process->readAllStandardError();
|
||||||
|
|
||||||
|
fprintf(stderr, "%s", data.data());
|
||||||
|
fflush(stderr);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
template <typename HandlerType>
|
template <typename HandlerType>
|
||||||
typename WorkerPool<HandlerType>::ReplyType*
|
typename WorkerPool<HandlerType>::ReplyType*
|
||||||
WorkerPool<HandlerType>::NewReply(MessageType *message) {
|
WorkerPool<HandlerType>::NewReply(MessageType *message) {
|
||||||
@@ -388,7 +425,7 @@ WorkerPool<HandlerType>::SendMessageWithReply(MessageType *message) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename HandlerType>
|
template<typename HandlerType>
|
||||||
void WorkerPool<HandlerType>::SendQueuedMessages() {
|
void WorkerPool<HandlerType>::SendQueuedMessages() {
|
||||||
|
|
||||||
QMutexLocker l(&message_queue_mutex_);
|
QMutexLocker l(&message_queue_mutex_);
|
||||||
@@ -410,7 +447,7 @@ void WorkerPool<HandlerType>::SendQueuedMessages() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename HandlerType>
|
template<typename HandlerType>
|
||||||
HandlerType *WorkerPool<HandlerType>::NextHandler() const {
|
HandlerType *WorkerPool<HandlerType>::NextHandler() const {
|
||||||
|
|
||||||
for (int i = 0; i < workers_.count(); ++i) {
|
for (int i = 0; i < workers_.count(); ++i) {
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ class TagReaderBase {
|
|||||||
virtual QByteArray LoadEmbeddedArt(const QString &filename) const = 0;
|
virtual QByteArray LoadEmbeddedArt(const QString &filename) const = 0;
|
||||||
virtual bool SaveEmbeddedArt(const QString &filename, const QByteArray &data) = 0;
|
virtual bool SaveEmbeddedArt(const QString &filename, const QByteArray &data) = 0;
|
||||||
|
|
||||||
|
virtual bool SaveSongPlaycountToFile(const QString &filename, const spb::tagreader::SongMetadata &song) const = 0;
|
||||||
|
virtual bool SaveSongRatingToFile(const QString &filename, const spb::tagreader::SongMetadata &song) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const std::string kEmbeddedCover;
|
static const std::string kEmbeddedCover;
|
||||||
|
|
||||||
|
|||||||
@@ -58,17 +58,20 @@ message SongMetadata {
|
|||||||
optional string url = 21;
|
optional string url = 21;
|
||||||
optional string basefilename = 22;
|
optional string basefilename = 22;
|
||||||
optional FileType filetype = 23;
|
optional FileType filetype = 23;
|
||||||
optional int32 filesize = 24;
|
optional int64 filesize = 24;
|
||||||
optional int64 mtime = 25;
|
optional int64 mtime = 25;
|
||||||
optional int64 ctime = 26;
|
optional int64 ctime = 26;
|
||||||
|
|
||||||
optional int32 playcount = 27;
|
optional uint32 playcount = 27;
|
||||||
optional int32 skipcount = 28;
|
optional uint32 skipcount = 28;
|
||||||
optional int64 lastplayed = 29;
|
optional int64 lastplayed = 29;
|
||||||
optional int64 lastseen = 30;
|
optional int64 lastseen = 30;
|
||||||
|
|
||||||
optional bool suspicious_tags = 31;
|
optional string art_automatic = 31;
|
||||||
optional string art_automatic = 32;
|
|
||||||
|
optional float rating = 32;
|
||||||
|
|
||||||
|
optional bool suspicious_tags = 40;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,6 +117,24 @@ message SaveEmbeddedArtResponse {
|
|||||||
optional bool success = 1;
|
optional bool success = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message SaveSongPlaycountToFileRequest {
|
||||||
|
optional string filename = 1;
|
||||||
|
optional SongMetadata metadata = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SaveSongPlaycountToFileResponse {
|
||||||
|
optional bool success = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SaveSongRatingToFileRequest {
|
||||||
|
optional string filename = 1;
|
||||||
|
optional SongMetadata metadata = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message SaveSongRatingToFileResponse {
|
||||||
|
optional bool success = 1;
|
||||||
|
}
|
||||||
|
|
||||||
message Message {
|
message Message {
|
||||||
optional int32 id = 1;
|
optional int32 id = 1;
|
||||||
|
|
||||||
@@ -132,4 +153,10 @@ message Message {
|
|||||||
optional SaveEmbeddedArtRequest save_embedded_art_request = 10;
|
optional SaveEmbeddedArtRequest save_embedded_art_request = 10;
|
||||||
optional SaveEmbeddedArtResponse save_embedded_art_response = 11;
|
optional SaveEmbeddedArtResponse save_embedded_art_response = 11;
|
||||||
|
|
||||||
|
optional SaveSongPlaycountToFileRequest save_song_playcount_to_file_request = 12;
|
||||||
|
optional SaveSongPlaycountToFileResponse save_song_playcount_to_file_response = 13;
|
||||||
|
|
||||||
|
optional SaveSongRatingToFileRequest save_song_rating_to_file_request = 14;
|
||||||
|
optional SaveSongRatingToFileResponse save_song_rating_to_file_response = 15;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include <taglib/attachedpictureframe.h>
|
#include <taglib/attachedpictureframe.h>
|
||||||
#include <taglib/textidentificationframe.h>
|
#include <taglib/textidentificationframe.h>
|
||||||
#include <taglib/unsynchronizedlyricsframe.h>
|
#include <taglib/unsynchronizedlyricsframe.h>
|
||||||
|
#include <taglib/popularimeterframe.h>
|
||||||
#include <taglib/xiphcomment.h>
|
#include <taglib/xiphcomment.h>
|
||||||
#include <taglib/commentsframe.h>
|
#include <taglib/commentsframe.h>
|
||||||
#include <taglib/tag.h>
|
#include <taglib/tag.h>
|
||||||
@@ -112,6 +113,7 @@ class TagLibFileRefFactory : public FileRefFactory {
|
|||||||
return new TagLib::FileRef(QFile::encodeName(filename).constData());
|
return new TagLib::FileRef(QFile::encodeName(filename).constData());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(TagLibFileRefFactory)
|
Q_DISABLE_COPY(TagLibFileRefFactory)
|
||||||
};
|
};
|
||||||
@@ -129,8 +131,9 @@ TagLib::String QStringToTaglibString(const QString &s) {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
// Tags containing the year the album was originally released (in contrast to other tags that contain the release year of the current edition)
|
|
||||||
const char *kMP4_OriginalYear_ID = "----:com.apple.iTunes:ORIGINAL YEAR";
|
const char *kMP4_OriginalYear_ID = "----:com.apple.iTunes:ORIGINAL YEAR";
|
||||||
|
const char *kMP4_FMPS_Playcount_ID = "----:com.apple.iTunes:FMPS_Playcount";
|
||||||
|
const char *kMP4_FMPS_Rating_ID = "----:com.apple.iTunes:FMPS_Rating";
|
||||||
const char *kASF_OriginalDate_ID = "WM/OriginalReleaseTime";
|
const char *kASF_OriginalDate_ID = "WM/OriginalReleaseTime";
|
||||||
const char *kASF_OriginalYear_ID = "WM/OriginalReleaseYear";
|
const char *kASF_OriginalYear_ID = "WM/OriginalReleaseYear";
|
||||||
} // namespace
|
} // namespace
|
||||||
@@ -185,18 +188,18 @@ spb::tagreader::SongMetadata_FileType TagReaderTagLib::GuessFileType(TagLib::Fil
|
|||||||
void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMetadata *song) const {
|
void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMetadata *song) const {
|
||||||
|
|
||||||
const QByteArray url(QUrl::fromLocalFile(filename).toEncoded());
|
const QByteArray url(QUrl::fromLocalFile(filename).toEncoded());
|
||||||
const QFileInfo info(filename);
|
const QFileInfo fileinfo(filename);
|
||||||
|
|
||||||
qLog(Debug) << "Reading tags from" << filename;
|
qLog(Debug) << "Reading tags from" << filename;
|
||||||
|
|
||||||
song->set_basefilename(DataCommaSizeFromQString(info.fileName()));
|
song->set_basefilename(DataCommaSizeFromQString(fileinfo.fileName()));
|
||||||
song->set_url(url.constData(), url.size());
|
song->set_url(url.constData(), url.size());
|
||||||
song->set_filesize(info.size());
|
song->set_filesize(fileinfo.size());
|
||||||
song->set_mtime(info.lastModified().toSecsSinceEpoch());
|
song->set_mtime(fileinfo.lastModified().isValid() ? fileinfo.lastModified().toSecsSinceEpoch() : 0);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||||
song->set_ctime(info.birthTime().isValid() ? info.birthTime().toSecsSinceEpoch() : info.lastModified().toSecsSinceEpoch());
|
song->set_ctime(fileinfo.birthTime().isValid() ? fileinfo.birthTime().toSecsSinceEpoch() : fileinfo.lastModified().isValid() ? fileinfo.lastModified().toSecsSinceEpoch() : 0);
|
||||||
#else
|
#else
|
||||||
song->set_ctime(info.created().toSecsSinceEpoch());
|
song->set_ctime(fileinfo.created().isValid() ? fileinfo.created().toSecsSinceEpoch() : fileinfo.lastModified().isValid() ? fileinfo.lastModified().toSecsSinceEpoch() : 0);
|
||||||
#endif
|
#endif
|
||||||
song->set_lastseen(QDateTime::currentDateTime().toSecsSinceEpoch());
|
song->set_lastseen(QDateTime::currentDateTime().toSecsSinceEpoch());
|
||||||
|
|
||||||
@@ -220,8 +223,8 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
|||||||
Decode(tag->artist(), song->mutable_artist()); // TPE1
|
Decode(tag->artist(), song->mutable_artist()); // TPE1
|
||||||
Decode(tag->album(), song->mutable_album());
|
Decode(tag->album(), song->mutable_album());
|
||||||
Decode(tag->genre(), song->mutable_genre());
|
Decode(tag->genre(), song->mutable_genre());
|
||||||
song->set_year(tag->year());
|
song->set_year(static_cast<int>(tag->year()));
|
||||||
song->set_track(tag->track());
|
song->set_track(static_cast<int>(tag->track()));
|
||||||
song->set_valid(true);
|
song->set_valid(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,10 +234,16 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
|||||||
|
|
||||||
// Handle all the files which have VorbisComments (Ogg, OPUS, ...) in the same way;
|
// Handle all the files which have VorbisComments (Ogg, OPUS, ...) in the same way;
|
||||||
// apart, so we keep specific behavior for some formats by adding another "else if" block below.
|
// apart, so we keep specific behavior for some formats by adding another "else if" block below.
|
||||||
if (TagLib::Ogg::XiphComment *tag_ogg = dynamic_cast<TagLib::Ogg::XiphComment*>(fileref->file()->tag())) {
|
if (TagLib::Ogg::XiphComment *xiph_comment = dynamic_cast<TagLib::Ogg::XiphComment*>(fileref->file()->tag())) {
|
||||||
ParseOggTag(tag_ogg->fieldListMap(), &disc, &compilation, song);
|
ParseOggTag(xiph_comment->fieldListMap(), &disc, &compilation, song);
|
||||||
if (!tag_ogg->pictureList().isEmpty()) {
|
TagLib::List<TagLib::FLAC::Picture*> pictures = xiph_comment->pictureList();
|
||||||
song->set_art_automatic(kEmbeddedCover);
|
if (!pictures.isEmpty()) {
|
||||||
|
for (TagLib::FLAC::Picture *picture : pictures) {
|
||||||
|
if (picture->type() == TagLib::FLAC::Picture::FrontCover && picture->data().size() > 0) {
|
||||||
|
song->set_art_automatic(kEmbeddedCover);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,14 +253,20 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
|||||||
|
|
||||||
if (file_flac->xiphComment()) {
|
if (file_flac->xiphComment()) {
|
||||||
ParseOggTag(file_flac->xiphComment()->fieldListMap(), &disc, &compilation, song);
|
ParseOggTag(file_flac->xiphComment()->fieldListMap(), &disc, &compilation, song);
|
||||||
if (!file_flac->pictureList().isEmpty()) {
|
TagLib::List<TagLib::FLAC::Picture*> pictures = file_flac->pictureList();
|
||||||
song->set_art_automatic(kEmbeddedCover);
|
if (!pictures.isEmpty()) {
|
||||||
|
for (TagLib::FLAC::Picture *picture : pictures) {
|
||||||
|
if (picture->type() == TagLib::FLAC::Picture::FrontCover && picture->data().size() > 0) {
|
||||||
|
song->set_art_automatic(kEmbeddedCover);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (tag) Decode(tag->comment(), song->mutable_comment());
|
if (tag) Decode(tag->comment(), song->mutable_comment());
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (TagLib::WavPack::File *file_wavpack = dynamic_cast<TagLib::WavPack::File *>(fileref->file())) {
|
else if (TagLib::WavPack::File *file_wavpack = dynamic_cast<TagLib::WavPack::File*>(fileref->file())) {
|
||||||
song->set_bitdepth(file_wavpack->audioProperties()->bitsPerSample());
|
song->set_bitdepth(file_wavpack->audioProperties()->bitsPerSample());
|
||||||
if (file_wavpack->APETag()) {
|
if (file_wavpack->APETag()) {
|
||||||
ParseAPETag(file_wavpack->APETag()->itemListMap(), &disc, &compilation, song);
|
ParseAPETag(file_wavpack->APETag()->itemListMap(), &disc, &compilation, song);
|
||||||
@@ -292,7 +307,9 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
|||||||
|
|
||||||
if (!map["TCMP"].isEmpty()) compilation = TStringToQString(map["TCMP"].front()->toString()).trimmed();
|
if (!map["TCMP"].isEmpty()) compilation = TStringToQString(map["TCMP"].front()->toString()).trimmed();
|
||||||
|
|
||||||
if (!map["TDOR"].isEmpty()) { song->set_originalyear(map["TDOR"].front()->toString().substr(0, 4).toInt()); }
|
if (!map["TDOR"].isEmpty()) {
|
||||||
|
song->set_originalyear(map["TDOR"].front()->toString().substr(0, 4).toInt());
|
||||||
|
}
|
||||||
else if (!map["TORY"].isEmpty()) {
|
else if (!map["TORY"].isEmpty()) {
|
||||||
song->set_originalyear(map["TORY"].front()->toString().substr(0, 4).toInt());
|
song->set_originalyear(map["TORY"].front()->toString().substr(0, 4).toInt());
|
||||||
}
|
}
|
||||||
@@ -307,7 +324,7 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
|||||||
if (!map["APIC"].isEmpty()) song->set_art_automatic(kEmbeddedCover);
|
if (!map["APIC"].isEmpty()) song->set_art_automatic(kEmbeddedCover);
|
||||||
|
|
||||||
// Find a suitable comment tag. For now we ignore iTunNORM comments.
|
// Find a suitable comment tag. For now we ignore iTunNORM comments.
|
||||||
for (uint i = 0 ; i < map["COMM"].size() ; ++i) {
|
for (uint i = 0; i < map["COMM"].size(); ++i) {
|
||||||
const TagLib::ID3v2::CommentsFrame *frame = dynamic_cast<const TagLib::ID3v2::CommentsFrame*>(map["COMM"][i]);
|
const TagLib::ID3v2::CommentsFrame *frame = dynamic_cast<const TagLib::ID3v2::CommentsFrame*>(map["COMM"][i]);
|
||||||
|
|
||||||
if (frame && TStringToQString(frame->description()) != "iTunNORM") {
|
if (frame && TStringToQString(frame->description()) != "iTunNORM") {
|
||||||
@@ -316,6 +333,28 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
float rating = TStringToQString(frame_field_list[1]).toFloat();
|
||||||
|
if (song->rating() <= 0 && rating > 0 && rating <= 1.0) {
|
||||||
|
song->set_rating(rating);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!map["POPM"].isEmpty()) {
|
||||||
|
const TagLib::ID3v2::PopularimeterFrame *frame = dynamic_cast<const TagLib::ID3v2::PopularimeterFrame*>(map["POPM"].front());
|
||||||
|
if (frame) {
|
||||||
|
if (song->playcount() <= 0 && frame->counter() > 0) {
|
||||||
|
song->set_playcount(frame->counter());
|
||||||
|
}
|
||||||
|
if (song->rating() <= 0 && frame->rating() > 0) {
|
||||||
|
song->set_rating(ConvertPOPMRating(frame->rating()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,6 +396,26 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
|||||||
song->set_originalyear(TStringToQString(mp4_tag->item(kMP4_OriginalYear_ID).toStringList().toString('\n')).left(4).toInt());
|
song->set_originalyear(TStringToQString(mp4_tag->item(kMP4_OriginalYear_ID).toStringList().toString('\n')).left(4).toInt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
TagLib::MP4::Item item = mp4_tag->item(kMP4_FMPS_Playcount_ID);
|
||||||
|
if (item.isValid()) {
|
||||||
|
const int playcount = TStringToQString(item.toStringList().toString('\n')).toInt();
|
||||||
|
if (song->playcount() <= 0 && playcount > 0) {
|
||||||
|
song->set_playcount(static_cast<uint>(playcount));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
TagLib::MP4::Item item = mp4_tag->item(kMP4_FMPS_Rating_ID);
|
||||||
|
if (item.isValid()) {
|
||||||
|
const float rating = TStringToQString(item.toStringList().toString('\n')).toFloat();
|
||||||
|
if (song->rating() <= 0 && rating > 0) {
|
||||||
|
song->set_rating(rating);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Decode(mp4_tag->comment(), song->mutable_comment());
|
Decode(mp4_tag->comment(), song->mutable_comment());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -367,22 +426,44 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
|||||||
|
|
||||||
if (file_asf->tag()) {
|
if (file_asf->tag()) {
|
||||||
Decode(file_asf->tag()->comment(), song->mutable_comment());
|
Decode(file_asf->tag()->comment(), song->mutable_comment());
|
||||||
|
|
||||||
|
const TagLib::ASF::AttributeListMap &attributes_map = file_asf->tag()->attributeListMap();
|
||||||
|
|
||||||
|
if (attributes_map.contains(kASF_OriginalDate_ID)) {
|
||||||
|
const TagLib::ASF::AttributeList &attributes = attributes_map[kASF_OriginalDate_ID];
|
||||||
|
if (!attributes.isEmpty()) {
|
||||||
|
song->set_originalyear(TStringToQString(attributes.front().toString()).left(4).toInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (attributes_map.contains(kASF_OriginalYear_ID)) {
|
||||||
|
const TagLib::ASF::AttributeList &attributes = attributes_map[kASF_OriginalYear_ID];
|
||||||
|
if (!attributes.isEmpty()) {
|
||||||
|
song->set_originalyear(TStringToQString(attributes.front().toString()).left(4).toInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attributes_map.contains("FMPS/Playcount")) {
|
||||||
|
const TagLib::ASF::AttributeList &attributes = attributes_map["FMPS/Playcount"];
|
||||||
|
if (!attributes.isEmpty()) {
|
||||||
|
int playcount = TStringToQString(attributes.front().toString()).toInt();
|
||||||
|
if (song->playcount() <= 0 && playcount > 0) {
|
||||||
|
song->set_playcount(static_cast<uint>(playcount));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attributes_map.contains("FMPS/Rating")) {
|
||||||
|
const TagLib::ASF::AttributeList &attributes = attributes_map["FMPS/Rating"];
|
||||||
|
if (!attributes.isEmpty()) {
|
||||||
|
float rating = TStringToQString(attributes.front().toString()).toFloat();
|
||||||
|
if (song->rating() <= 0 && rating > 0) {
|
||||||
|
song->set_rating(rating);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const TagLib::ASF::AttributeListMap &attributes_map = file_asf->tag()->attributeListMap();
|
|
||||||
|
|
||||||
if (attributes_map.contains(kASF_OriginalDate_ID)) {
|
|
||||||
const TagLib::ASF::AttributeList &attributes = attributes_map[kASF_OriginalDate_ID];
|
|
||||||
if (!attributes.isEmpty()) {
|
|
||||||
song->set_originalyear(TStringToQString(attributes.front().toString()).left(4).toInt());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (attributes_map.contains(kASF_OriginalYear_ID)) {
|
|
||||||
const TagLib::ASF::AttributeList &attributes = attributes_map[kASF_OriginalYear_ID];
|
|
||||||
if (!attributes.isEmpty()) {
|
|
||||||
song->set_originalyear(TStringToQString(attributes.front().toString()).left(4).toInt());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (TagLib::MPC::File *file_mpc = dynamic_cast<TagLib::MPC::File*>(fileref->file())) {
|
else if (TagLib::MPC::File *file_mpc = dynamic_cast<TagLib::MPC::File*>(fileref->file())) {
|
||||||
@@ -397,7 +478,7 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!disc.isEmpty()) {
|
if (!disc.isEmpty()) {
|
||||||
const int i = disc.indexOf('/');
|
const qint64 i = disc.indexOf('/');
|
||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
// disc.right( i ).toInt() is total number of discs, we don't use this at the moment
|
// disc.right( i ).toInt() is total number of discs, we don't use this at the moment
|
||||||
song->set_disc(disc.left(i).toInt());
|
song->set_disc(disc.left(i).toInt());
|
||||||
@@ -420,16 +501,15 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
|||||||
if (!lyrics.isEmpty()) song->set_lyrics(lyrics.toStdString());
|
if (!lyrics.isEmpty()) song->set_lyrics(lyrics.toStdString());
|
||||||
|
|
||||||
// Set integer fields to -1 if they're not valid
|
// Set integer fields to -1 if they're not valid
|
||||||
#define SetDefault(field) if (song->field() <= 0) { song->set_##field(-1); }
|
|
||||||
SetDefault(track);
|
if (song->track() <= 0) { song->set_track(-1); }
|
||||||
SetDefault(disc);
|
if (song->disc() <= 0) { song->set_disc(-1); }
|
||||||
SetDefault(year);
|
if (song->year() <= 0) { song->set_year(-1); }
|
||||||
SetDefault(originalyear);
|
if (song->originalyear() <= 0) { song->set_originalyear(-1); }
|
||||||
SetDefault(bitrate);
|
if (song->samplerate() <= 0) { song->set_samplerate(-1); }
|
||||||
SetDefault(samplerate);
|
if (song->bitdepth() <= 0) { song->set_bitdepth(-1); }
|
||||||
SetDefault(bitdepth);
|
if (song->bitrate() <= 0) { song->set_bitrate(-1); }
|
||||||
SetDefault(lastplayed);
|
if (song->lastplayed() <= 0) { song->set_lastplayed(-1); }
|
||||||
#undef SetDefault
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,7 +544,11 @@ void TagReaderTagLib::ParseOggTag(const TagLib::Ogg::FieldListMap &map, QString
|
|||||||
if (!map["COVERART"].isEmpty()) song->set_art_automatic(kEmbeddedCover);
|
if (!map["COVERART"].isEmpty()) song->set_art_automatic(kEmbeddedCover);
|
||||||
if (!map["METADATA_BLOCK_PICTURE"].isEmpty()) song->set_art_automatic(kEmbeddedCover);
|
if (!map["METADATA_BLOCK_PICTURE"].isEmpty()) song->set_art_automatic(kEmbeddedCover);
|
||||||
|
|
||||||
if (!map["FMPS_PLAYCOUNT"].isEmpty() && song->playcount() <= 0) song->set_playcount(TStringToQString( map["FMPS_PLAYCOUNT"].front() ).trimmed().toFloat());
|
if (!map["FMPS_PLAYCOUNT"].isEmpty() && song->playcount() <= 0) {
|
||||||
|
const int playcount = TStringToQString(map["FMPS_PLAYCOUNT"].front()).trimmed().toInt();
|
||||||
|
song->set_playcount(static_cast<uint>(playcount));
|
||||||
|
}
|
||||||
|
if (!map["FMPS_RATING"].isEmpty() && song->rating() <= 0) song->set_rating(TStringToQString(map["FMPS_RATING"].front()).trimmed().toFloat());
|
||||||
|
|
||||||
if (!map["LYRICS"].isEmpty()) Decode(map["LYRICS"].front(), song->mutable_lyrics());
|
if (!map["LYRICS"].isEmpty()) Decode(map["LYRICS"].front(), song->mutable_lyrics());
|
||||||
else if (!map["UNSYNCEDLYRICS"].isEmpty()) Decode(map["UNSYNCEDLYRICS"].front(), song->mutable_lyrics());
|
else if (!map["UNSYNCEDLYRICS"].isEmpty()) Decode(map["UNSYNCEDLYRICS"].front(), song->mutable_lyrics());
|
||||||
@@ -507,9 +591,16 @@ void TagReaderTagLib::ParseAPETag(const TagLib::APE::ItemListMap &map, QString *
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (map.contains("FMPS_PLAYCOUNT")) {
|
if (map.contains("FMPS_PLAYCOUNT")) {
|
||||||
int playcount = TStringToQString(map["FMPS_PLAYCOUNT"].toString()).toFloat();
|
const int playcount = TStringToQString(map["FMPS_PLAYCOUNT"].toString()).toInt();
|
||||||
if (song->playcount() <= 0 && playcount > 0) {
|
if (song->playcount() <= 0 && playcount > 0) {
|
||||||
song->set_playcount(playcount);
|
song->set_playcount(static_cast<uint>(playcount));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (map.contains("FMPS_RATING")) {
|
||||||
|
const float rating = TStringToQString(map["FMPS_RATING"].toString()).toFloat();
|
||||||
|
if (song->rating() <= 0 && rating > 0) {
|
||||||
|
song->set_rating(rating);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,7 +643,8 @@ bool TagReaderTagLib::SaveFile(const QString &filename, const spb::tagreader::So
|
|||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
if (TagLib::FLAC::File *file_flac = dynamic_cast<TagLib::FLAC::File*>(fileref->file())) {
|
if (TagLib::FLAC::File *file_flac = dynamic_cast<TagLib::FLAC::File*>(fileref->file())) {
|
||||||
TagLib::Ogg::XiphComment *tag = file_flac->xiphComment();
|
TagLib::Ogg::XiphComment *tag = file_flac->xiphComment(true);
|
||||||
|
if (!tag) return false;
|
||||||
SetVorbisComments(tag, song);
|
SetVorbisComments(tag, song);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -589,18 +681,19 @@ bool TagReaderTagLib::SaveFile(const QString &filename, const spb::tagreader::So
|
|||||||
|
|
||||||
else if (TagLib::MP4::File *file_mp4 = dynamic_cast<TagLib::MP4::File*>(fileref->file())) {
|
else if (TagLib::MP4::File *file_mp4 = dynamic_cast<TagLib::MP4::File*>(fileref->file())) {
|
||||||
TagLib::MP4::Tag *tag = file_mp4->tag();
|
TagLib::MP4::Tag *tag = file_mp4->tag();
|
||||||
tag->setItem("disk", TagLib::MP4::Item(song.disc() <= 0 -1 ? 0 : song.disc(), 0));
|
if (!tag) return false;
|
||||||
tag->setItem("\251wrt", TagLib::StringList(song.composer().c_str()));
|
tag->setItem("disk", TagLib::MP4::Item(song.disc() <= 0 - 1 ? 0 : song.disc(), 0));
|
||||||
tag->setItem("\251grp", TagLib::StringList(song.grouping().c_str()));
|
tag->setItem("\251wrt", TagLib::StringList(TagLib::String(song.composer(), TagLib::String::UTF8)));
|
||||||
tag->setItem("\251lyr", TagLib::StringList(song.lyrics().c_str()));
|
tag->setItem("\251grp", TagLib::StringList(TagLib::String(song.grouping(), TagLib::String::UTF8)));
|
||||||
tag->setItem("aART", TagLib::StringList(song.albumartist().c_str()));
|
tag->setItem("\251lyr", TagLib::StringList(TagLib::String(song.lyrics(), TagLib::String::UTF8)));
|
||||||
|
tag->setItem("aART", TagLib::StringList(TagLib::String(song.albumartist(), TagLib::String::UTF8)));
|
||||||
tag->setItem("cpil", TagLib::StringList(song.compilation() ? "1" : "0"));
|
tag->setItem("cpil", TagLib::StringList(song.compilation() ? "1" : "0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle all the files which have VorbisComments (Ogg, OPUS, ...) in the same way;
|
// Handle all the files which have VorbisComments (Ogg, OPUS, ...) in the same way;
|
||||||
// apart, so we keep specific behavior for some formats by adding another "else if" block above.
|
// apart, so we keep specific behavior for some formats by adding another "else if" block above.
|
||||||
if (TagLib::Ogg::XiphComment *tag = dynamic_cast<TagLib::Ogg::XiphComment*>(fileref->file()->tag())) {
|
if (TagLib::Ogg::XiphComment *xiph_comment = dynamic_cast<TagLib::Ogg::XiphComment*>(fileref->file()->tag())) {
|
||||||
SetVorbisComments(tag, song);
|
SetVorbisComments(xiph_comment, song);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = fileref->save();
|
result = fileref->save();
|
||||||
@@ -653,7 +746,7 @@ void TagReaderTagLib::SetTextFrame(const char *id, const std::string &value, Tag
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update and add the frames
|
// Update and add the frames
|
||||||
for (int i = 0 ; i < frames_buffer.size() ; ++i) {
|
for (int i = 0; i < frames_buffer.size(); ++i) {
|
||||||
TagLib::ID3v2::TextIdentificationFrame *frame = new TagLib::ID3v2::TextIdentificationFrame(frames_buffer.at(i));
|
TagLib::ID3v2::TextIdentificationFrame *frame = new TagLib::ID3v2::TextIdentificationFrame(frames_buffer.at(i));
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
frame->setText(StdStringToTaglibString(value));
|
frame->setText(StdStringToTaglibString(value));
|
||||||
@@ -664,6 +757,30 @@ void TagReaderTagLib::SetTextFrame(const char *id, const std::string &value, Tag
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TagReaderTagLib::SetUserTextFrame(const QString &description, const QString &value, TagLib::ID3v2::Tag *tag) const {
|
||||||
|
|
||||||
|
const QByteArray descr_utf8(description.toUtf8());
|
||||||
|
const QByteArray value_utf8(value.toUtf8());
|
||||||
|
SetUserTextFrame(std::string(descr_utf8.constData(), descr_utf8.length()), std::string(value_utf8.constData(), value_utf8.length()), tag);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TagReaderTagLib::SetUserTextFrame(const std::string &description, const std::string &value, TagLib::ID3v2::Tag *tag) const {
|
||||||
|
|
||||||
|
const TagLib::String t_description = StdStringToTaglibString(description);
|
||||||
|
TagLib::ID3v2::UserTextIdentificationFrame *frame = TagLib::ID3v2::UserTextIdentificationFrame::find(tag, t_description);
|
||||||
|
if (frame) {
|
||||||
|
tag->removeFrame(frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create and add a new frame
|
||||||
|
frame = new TagLib::ID3v2::UserTextIdentificationFrame(TagLib::String::UTF8);
|
||||||
|
frame->setDescription(t_description);
|
||||||
|
frame->setText(StdStringToTaglibString(value));
|
||||||
|
tag->addFrame(frame);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void TagReaderTagLib::SetUnsyncLyricsFrame(const std::string &value, TagLib::ID3v2::Tag *tag) const {
|
void TagReaderTagLib::SetUnsyncLyricsFrame(const std::string &value, TagLib::ID3v2::Tag *tag) const {
|
||||||
|
|
||||||
TagLib::ByteVector id_vector("USLT");
|
TagLib::ByteVector id_vector("USLT");
|
||||||
@@ -685,7 +802,7 @@ void TagReaderTagLib::SetUnsyncLyricsFrame(const std::string &value, TagLib::ID3
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update and add the frames
|
// Update and add the frames
|
||||||
for (int i = 0 ; i < frames_buffer.size() ; ++i) {
|
for (int i = 0; i < frames_buffer.size(); ++i) {
|
||||||
TagLib::ID3v2::UnsynchronizedLyricsFrame *frame = new TagLib::ID3v2::UnsynchronizedLyricsFrame(frames_buffer.at(i));
|
TagLib::ID3v2::UnsynchronizedLyricsFrame *frame = new TagLib::ID3v2::UnsynchronizedLyricsFrame(frames_buffer.at(i));
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
frame->setText(StdStringToTaglibString(value));
|
frame->setText(StdStringToTaglibString(value));
|
||||||
@@ -703,86 +820,93 @@ QByteArray TagReaderTagLib::LoadEmbeddedArt(const QString &filename) const {
|
|||||||
qLog(Debug) << "Loading art from" << filename;
|
qLog(Debug) << "Loading art from" << filename;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
TagLib::FileRef ref(filename.toStdWString().c_str());
|
TagLib::FileRef fileref(filename.toStdWString().c_str());
|
||||||
#else
|
#else
|
||||||
TagLib::FileRef ref(QFile::encodeName(filename).constData());
|
TagLib::FileRef fileref(QFile::encodeName(filename).constData());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ref.isNull() || !ref.file()) return QByteArray();
|
if (fileref.isNull() || !fileref.file()) return QByteArray();
|
||||||
|
|
||||||
// FLAC
|
// FLAC
|
||||||
if (TagLib::FLAC::File *flac_file = dynamic_cast<TagLib::FLAC::File*>(ref.file())) {
|
if (TagLib::FLAC::File *flac_file = dynamic_cast<TagLib::FLAC::File*>(fileref.file())) {
|
||||||
if (flac_file->xiphComment()) {
|
if (flac_file->xiphComment()) {
|
||||||
TagLib::List<TagLib::FLAC::Picture*> pics = flac_file->pictureList();
|
TagLib::List<TagLib::FLAC::Picture*> pictures = flac_file->pictureList();
|
||||||
if (!pics.isEmpty()) {
|
if (!pictures.isEmpty()) {
|
||||||
TagLib::FLAC::Picture *picture = nullptr;
|
for (TagLib::FLAC::Picture *picture : pictures) {
|
||||||
for (std::list<TagLib::FLAC::Picture*>::iterator it = pics.begin() ; it != pics.end() ; ++it) {
|
if (picture->type() == TagLib::FLAC::Picture::FrontCover && picture->data().size() > 0) {
|
||||||
picture = *it;
|
QByteArray data(picture->data().data(), picture->data().size());
|
||||||
if (picture->type() == TagLib::FLAC::Picture::FrontCover) {
|
if (!data.isEmpty()) {
|
||||||
break;
|
return data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (picture) return QByteArray(picture->data().data(), picture->data().size());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WavPack
|
// WavPack
|
||||||
if (TagLib::WavPack::File *wavpack_file = dynamic_cast<TagLib::WavPack::File*>(ref.file())) {
|
if (TagLib::WavPack::File *wavpack_file = dynamic_cast<TagLib::WavPack::File*>(fileref.file())) {
|
||||||
return LoadEmbeddedAPEArt(wavpack_file->APETag()->itemListMap());
|
if (wavpack_file->APETag()) {
|
||||||
|
return LoadEmbeddedAPEArt(wavpack_file->APETag()->itemListMap());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// APE
|
// APE
|
||||||
if (TagLib::APE::File *ape_file = dynamic_cast<TagLib::APE::File*>(ref.file())) {
|
if (TagLib::APE::File *ape_file = dynamic_cast<TagLib::APE::File*>(fileref.file())) {
|
||||||
return LoadEmbeddedAPEArt(ape_file->APETag()->itemListMap());
|
if (ape_file->APETag()) {
|
||||||
|
return LoadEmbeddedAPEArt(ape_file->APETag()->itemListMap());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MPC
|
// MPC
|
||||||
if (TagLib::MPC::File *mpc_file = dynamic_cast<TagLib::MPC::File*>(ref.file())) {
|
if (TagLib::MPC::File *mpc_file = dynamic_cast<TagLib::MPC::File*>(fileref.file())) {
|
||||||
return LoadEmbeddedAPEArt(mpc_file->APETag()->itemListMap());
|
if (mpc_file->APETag()) {
|
||||||
|
return LoadEmbeddedAPEArt(mpc_file->APETag()->itemListMap());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ogg Vorbis / Speex
|
// Ogg Vorbis / Opus / Speex
|
||||||
if (TagLib::Ogg::XiphComment *xiph_comment = dynamic_cast<TagLib::Ogg::XiphComment*>(ref.file()->tag())) {
|
if (TagLib::Ogg::XiphComment *xiph_comment = dynamic_cast<TagLib::Ogg::XiphComment*>(fileref.file()->tag())) {
|
||||||
TagLib::Ogg::FieldListMap map = xiph_comment->fieldListMap();
|
TagLib::Ogg::FieldListMap map = xiph_comment->fieldListMap();
|
||||||
|
|
||||||
TagLib::List<TagLib::FLAC::Picture*> pics = xiph_comment->pictureList();
|
TagLib::List<TagLib::FLAC::Picture*> pictures = xiph_comment->pictureList();
|
||||||
if (!pics.isEmpty()) {
|
if (!pictures.isEmpty()) {
|
||||||
for (auto p : pics) {
|
for (TagLib::FLAC::Picture *picture : pictures) {
|
||||||
if (p->type() == TagLib::FLAC::Picture::FrontCover)
|
if (picture->type() == TagLib::FLAC::Picture::FrontCover && picture->data().size() > 0) {
|
||||||
return QByteArray(p->data().data(), p->data().size());
|
QByteArray data(picture->data().data(), picture->data().size());
|
||||||
|
if (!data.isEmpty()) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// If there was no specific front cover, just take the first picture
|
|
||||||
std::list<TagLib::FLAC::Picture*>::iterator it = pics.begin();
|
|
||||||
TagLib::FLAC::Picture *picture = *it;
|
|
||||||
|
|
||||||
return QByteArray(picture->data().data(), picture->data().size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ogg lacks a definitive standard for embedding cover art, but it seems b64 encoding a field called COVERART is the general convention
|
// Ogg lacks a definitive standard for embedding cover art, but it seems b64 encoding a field called COVERART is the general convention
|
||||||
if (map.contains("COVERART"))
|
if (map.contains("COVERART")) {
|
||||||
return QByteArray::fromBase64(map["COVERART"].toString().toCString());
|
return QByteArray::fromBase64(map["COVERART"].toString().toCString());
|
||||||
|
}
|
||||||
|
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
// MP3
|
// MP3
|
||||||
if (TagLib::MPEG::File *file_mp3 = dynamic_cast<TagLib::MPEG::File*>(ref.file())) {
|
if (TagLib::MPEG::File *file_mp3 = dynamic_cast<TagLib::MPEG::File*>(fileref.file())) {
|
||||||
if (file_mp3->ID3v2Tag()) {
|
if (file_mp3->ID3v2Tag()) {
|
||||||
TagLib::ID3v2::FrameList apic_frames = file_mp3->ID3v2Tag()->frameListMap()["APIC"];
|
TagLib::ID3v2::FrameList apic_frames = file_mp3->ID3v2Tag()->frameListMap()["APIC"];
|
||||||
if (apic_frames.isEmpty())
|
if (apic_frames.isEmpty()) {
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
TagLib::ID3v2::AttachedPictureFrame *pic = static_cast<TagLib::ID3v2::AttachedPictureFrame*>(apic_frames.front());
|
TagLib::ID3v2::AttachedPictureFrame *picture = static_cast<TagLib::ID3v2::AttachedPictureFrame*>(apic_frames.front());
|
||||||
|
|
||||||
return QByteArray(reinterpret_cast<const char*>(pic->picture().data()), pic->picture().size());
|
return QByteArray(reinterpret_cast<const char*>(picture->picture().data()), picture->picture().size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MP4/AAC
|
// MP4/AAC
|
||||||
if (TagLib::MP4::File *aac_file = dynamic_cast<TagLib::MP4::File*>(ref.file())) {
|
if (TagLib::MP4::File *aac_file = dynamic_cast<TagLib::MP4::File*>(fileref.file())) {
|
||||||
TagLib::MP4::Tag *tag = aac_file->tag();
|
TagLib::MP4::Tag *tag = aac_file->tag();
|
||||||
if (tag->item("covr").isValid()) {
|
if (tag && tag->item("covr").isValid()) {
|
||||||
const TagLib::MP4::CoverArtList &art_list = tag->item("covr").toCoverArtList();
|
const TagLib::MP4::CoverArtList &art_list = tag->item("covr").toCoverArtList();
|
||||||
|
|
||||||
if (!art_list.isEmpty()) {
|
if (!art_list.isEmpty()) {
|
||||||
@@ -822,78 +946,292 @@ bool TagReaderTagLib::SaveEmbeddedArt(const QString &filename, const QByteArray
|
|||||||
qLog(Debug) << "Saving art to" << filename;
|
qLog(Debug) << "Saving art to" << filename;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN32
|
#ifdef Q_OS_WIN32
|
||||||
TagLib::FileRef ref(filename.toStdWString().c_str());
|
TagLib::FileRef fileref(filename.toStdWString().c_str());
|
||||||
#else
|
#else
|
||||||
TagLib::FileRef ref(QFile::encodeName(filename).constData());
|
TagLib::FileRef fileref(QFile::encodeName(filename).constData());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ref.isNull() || !ref.file()) return false;
|
if (fileref.isNull() || !fileref.file()) return false;
|
||||||
|
|
||||||
// FLAC
|
// FLAC
|
||||||
if (TagLib::FLAC::File *flac_file = dynamic_cast<TagLib::FLAC::File*>(ref.file())) {
|
if (TagLib::FLAC::File *flac_file = dynamic_cast<TagLib::FLAC::File*>(fileref.file())) {
|
||||||
if (flac_file->xiphComment()) {
|
TagLib::Ogg::XiphComment *vorbis_comments = flac_file->xiphComment(true);
|
||||||
flac_file->removePictures();
|
if (!vorbis_comments) return false;
|
||||||
if (!data.isEmpty()) {
|
flac_file->removePictures();
|
||||||
TagLib::FLAC::Picture *picture = new TagLib::FLAC::Picture();
|
if (!data.isEmpty()) {
|
||||||
picture->setType(TagLib::FLAC::Picture::FrontCover);
|
TagLib::FLAC::Picture *picture = new TagLib::FLAC::Picture();
|
||||||
picture->setMimeType("image/jpeg");
|
picture->setType(TagLib::FLAC::Picture::FrontCover);
|
||||||
picture->setData(TagLib::ByteVector(data.constData(), data.size()));
|
picture->setMimeType("image/jpeg");
|
||||||
flac_file->addPicture(picture);
|
picture->setData(TagLib::ByteVector(data.constData(), data.size()));
|
||||||
}
|
flac_file->addPicture(picture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ogg Vorbis / Speex
|
// Ogg Vorbis / Opus / Speex
|
||||||
else if (TagLib::Ogg::XiphComment *xiph_comment = dynamic_cast<TagLib::Ogg::XiphComment*>(ref.file()->tag())) {
|
else if (TagLib::Ogg::XiphComment *xiph_comment = dynamic_cast<TagLib::Ogg::XiphComment*>(fileref.file()->tag())) {
|
||||||
TagLib::FLAC::Picture *picture = new TagLib::FLAC::Picture();
|
xiph_comment->removeAllPictures();
|
||||||
picture->setType(TagLib::FLAC::Picture::FrontCover);
|
if (!data.isEmpty()) {
|
||||||
picture->setMimeType("image/jpeg");
|
TagLib::FLAC::Picture *picture = new TagLib::FLAC::Picture();
|
||||||
picture->setData(TagLib::ByteVector(data.constData(), data.size()));
|
picture->setType(TagLib::FLAC::Picture::FrontCover);
|
||||||
xiph_comment->addPicture(picture);
|
picture->setMimeType("image/jpeg");
|
||||||
|
picture->setData(TagLib::ByteVector(data.constData(), data.size()));
|
||||||
|
xiph_comment->addPicture(picture);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MP3
|
// MP3
|
||||||
else if (TagLib::MPEG::File *file_mp3 = dynamic_cast<TagLib::MPEG::File*>(ref.file())) {
|
else if (TagLib::MPEG::File *file_mp3 = dynamic_cast<TagLib::MPEG::File*>(fileref.file())) {
|
||||||
if (file_mp3->ID3v2Tag()) {
|
TagLib::ID3v2::Tag *tag = file_mp3->ID3v2Tag();
|
||||||
TagLib::ID3v2::Tag *tag = file_mp3->ID3v2Tag();
|
if (!tag) return false;
|
||||||
|
|
||||||
// Remove existing covers
|
// Remove existing covers
|
||||||
TagLib::ID3v2::FrameList apiclist = tag->frameListMap()["APIC"];
|
TagLib::ID3v2::FrameList apiclist = tag->frameListMap()["APIC"];
|
||||||
for (TagLib::ID3v2::FrameList::ConstIterator it = apiclist.begin() ; it != apiclist.end() ; ++it ) {
|
for (TagLib::ID3v2::FrameList::ConstIterator it = apiclist.begin(); it != apiclist.end(); ++it) {
|
||||||
TagLib::ID3v2::AttachedPictureFrame *frame = dynamic_cast<TagLib::ID3v2::AttachedPictureFrame*>(*it);
|
TagLib::ID3v2::AttachedPictureFrame *frame = dynamic_cast<TagLib::ID3v2::AttachedPictureFrame*>(*it);
|
||||||
tag->removeFrame(frame, false);
|
tag->removeFrame(frame, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!data.isEmpty()) {
|
if (!data.isEmpty()) {
|
||||||
// Add new cover
|
// Add new cover
|
||||||
TagLib::ID3v2::AttachedPictureFrame *frontcover = nullptr;
|
TagLib::ID3v2::AttachedPictureFrame *frontcover = nullptr;
|
||||||
frontcover = new TagLib::ID3v2::AttachedPictureFrame("APIC");
|
frontcover = new TagLib::ID3v2::AttachedPictureFrame("APIC");
|
||||||
frontcover->setType(TagLib::ID3v2::AttachedPictureFrame::FrontCover);
|
frontcover->setType(TagLib::ID3v2::AttachedPictureFrame::FrontCover);
|
||||||
frontcover->setMimeType("image/jpeg");
|
frontcover->setMimeType("image/jpeg");
|
||||||
frontcover->setPicture(TagLib::ByteVector(data.constData(), data.count()));
|
frontcover->setPicture(TagLib::ByteVector(data.constData(), data.size()));
|
||||||
tag->addFrame(frontcover);
|
tag->addFrame(frontcover);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MP4/AAC
|
// MP4/AAC
|
||||||
else if (TagLib::MP4::File *aac_file = dynamic_cast<TagLib::MP4::File*>(ref.file())) {
|
else if (TagLib::MP4::File *aac_file = dynamic_cast<TagLib::MP4::File*>(fileref.file())) {
|
||||||
TagLib::MP4::Tag *tag = aac_file->tag();
|
TagLib::MP4::Tag *tag = aac_file->tag();
|
||||||
|
if (!tag) return false;
|
||||||
TagLib::MP4::CoverArtList covers;
|
TagLib::MP4::CoverArtList covers;
|
||||||
if (tag) {
|
if (data.isEmpty()) {
|
||||||
if (data.isEmpty()) {
|
if (tag->contains("covr")) tag->removeItem("covr");
|
||||||
if (tag->contains("covr")) tag->removeItem("covr");
|
}
|
||||||
}
|
else {
|
||||||
else {
|
covers.append(TagLib::MP4::CoverArt(TagLib::MP4::CoverArt::JPEG, TagLib::ByteVector(data.constData(), data.size())));
|
||||||
covers.append(TagLib::MP4::CoverArt(TagLib::MP4::CoverArt::JPEG, TagLib::ByteVector(data.constData(), data.count())));
|
tag->setItem("covr", covers);
|
||||||
tag->setItem("covr", covers);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not supported.
|
// Not supported.
|
||||||
else return false;
|
else return false;
|
||||||
|
|
||||||
return ref.file()->save();
|
return fileref.file()->save();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TagLib::ID3v2::PopularimeterFrame *TagReaderTagLib::GetPOPMFrameFromTag(TagLib::ID3v2::Tag *tag) {
|
||||||
|
|
||||||
|
TagLib::ID3v2::PopularimeterFrame *frame = nullptr;
|
||||||
|
|
||||||
|
const TagLib::ID3v2::FrameListMap &map = tag->frameListMap();
|
||||||
|
if (!map["POPM"].isEmpty()) {
|
||||||
|
frame = dynamic_cast<TagLib::ID3v2::PopularimeterFrame*>(map["POPM"].front());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!frame) {
|
||||||
|
frame = new TagLib::ID3v2::PopularimeterFrame();
|
||||||
|
tag->addFrame(frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
return frame;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
float TagReaderTagLib::ConvertPOPMRating(const int POPM_rating) {
|
||||||
|
|
||||||
|
if (POPM_rating < 0x01) return 0.0F;
|
||||||
|
else if (POPM_rating < 0x40) return 0.20F;
|
||||||
|
else if (POPM_rating < 0x80) return 0.40F;
|
||||||
|
else if (POPM_rating < 0xC0) return 0.60F;
|
||||||
|
else if (POPM_rating < 0xFC) return 0.80F;
|
||||||
|
|
||||||
|
return 1.0F;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int TagReaderTagLib::ConvertToPOPMRating(const float rating) {
|
||||||
|
|
||||||
|
if (rating < 0.20) return 0x00;
|
||||||
|
else if (rating < 0.40) return 0x01;
|
||||||
|
else if (rating < 0.60) return 0x40;
|
||||||
|
else if (rating < 0.80) return 0x80;
|
||||||
|
else if (rating < 1.0) return 0xC0;
|
||||||
|
|
||||||
|
return 0xFF;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TagReaderTagLib::SaveSongPlaycountToFile(const QString &filename, const spb::tagreader::SongMetadata &song) const {
|
||||||
|
|
||||||
|
if (filename.isEmpty()) return false;
|
||||||
|
|
||||||
|
qLog(Debug) << "Saving song playcount to" << filename;
|
||||||
|
|
||||||
|
std::unique_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename));
|
||||||
|
if (!fileref || fileref->isNull()) return false;
|
||||||
|
|
||||||
|
if (TagLib::FLAC::File *flac_file = dynamic_cast<TagLib::FLAC::File*>(fileref->file())) {
|
||||||
|
TagLib::Ogg::XiphComment *vorbis_comments = flac_file->xiphComment(true);
|
||||||
|
if (!vorbis_comments) return false;
|
||||||
|
if (song.playcount() > 0) {
|
||||||
|
vorbis_comments->addField("FMPS_PLAYCOUNT", TagLib::String::number(static_cast<int>(song.playcount())), true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vorbis_comments->removeFields("FMPS_PLAYCOUNT");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TagLib::WavPack::File *wavpack_file = dynamic_cast<TagLib::WavPack::File*>(fileref->file())) {
|
||||||
|
TagLib::APE::Tag *tag = wavpack_file->APETag(true);
|
||||||
|
if (!tag) return false;
|
||||||
|
if (song.playcount() > 0) {
|
||||||
|
tag->setItem("FMPS_PlayCount", TagLib::APE::Item("FMPS_PlayCount", TagLib::String::number(static_cast<int>(song.playcount()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TagLib::APE::File *ape_file = dynamic_cast<TagLib::APE::File*>(fileref->file())) {
|
||||||
|
TagLib::APE::Tag *tag = ape_file->APETag(true);
|
||||||
|
if (!tag) return false;
|
||||||
|
if (song.playcount() > 0) {
|
||||||
|
tag->setItem("FMPS_PlayCount", TagLib::APE::Item("FMPS_PlayCount", TagLib::String::number(static_cast<int>(song.playcount()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TagLib::Ogg::XiphComment *xiph_comment = dynamic_cast<TagLib::Ogg::XiphComment*>(fileref->file()->tag())) {
|
||||||
|
if (song.playcount() > 0) {
|
||||||
|
xiph_comment->addField("FMPS_PLAYCOUNT", TagLib::String::number(static_cast<int>(song.playcount())), true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
xiph_comment->removeFields("FMPS_PLAYCOUNT");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TagLib::MPEG::File *mpeg_file = dynamic_cast<TagLib::MPEG::File*>(fileref->file())) {
|
||||||
|
TagLib::ID3v2::Tag *tag = mpeg_file->ID3v2Tag(true);
|
||||||
|
if (!tag) return false;
|
||||||
|
if (song.playcount() > 0) {
|
||||||
|
SetUserTextFrame("FMPS_PlayCount", QString::number(song.playcount()), tag);
|
||||||
|
TagLib::ID3v2::PopularimeterFrame *frame = GetPOPMFrameFromTag(tag);
|
||||||
|
if (frame) {
|
||||||
|
frame->setCounter(song.playcount());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (TagLib::MP4::File *mp4_file = dynamic_cast<TagLib::MP4::File*>(fileref->file())) {
|
||||||
|
TagLib::MP4::Tag *tag = mp4_file->tag();
|
||||||
|
if (!tag) return false;
|
||||||
|
if (song.playcount() > 0) {
|
||||||
|
tag->setItem(kMP4_FMPS_Playcount_ID, TagLib::MP4::Item(TagLib::String::number(static_cast<int>(song.playcount()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TagLib::MPC::File *mpc_file = dynamic_cast<TagLib::MPC::File*>(fileref->file())) {
|
||||||
|
TagLib::APE::Tag *tag = mpc_file->APETag(true);
|
||||||
|
if (!tag) return false;
|
||||||
|
if (song.playcount() > 0) {
|
||||||
|
tag->setItem("FMPS_PlayCount", TagLib::APE::Item("FMPS_PlayCount", TagLib::String::number(static_cast<int>(song.playcount()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TagLib::ASF::File *asf_file = dynamic_cast<TagLib::ASF::File*>(fileref->file())) {
|
||||||
|
TagLib::ASF::Tag *tag = asf_file->tag();
|
||||||
|
if (!tag) return false;
|
||||||
|
if (song.playcount() > 0) {
|
||||||
|
tag->addAttribute("FMPS/Playcount", TagLib::ASF::Attribute(QStringToTaglibString(QString::number(song.playcount()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ret = fileref->save();
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
|
if (ret) {
|
||||||
|
// Linux: inotify doesn't seem to notice the change to the file unless we change the timestamps as well. (this is what touch does)
|
||||||
|
utimensat(0, QFile::encodeName(filename).constData(), nullptr, 0);
|
||||||
|
}
|
||||||
|
#endif // Q_OS_LINUX
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TagReaderTagLib::SaveSongRatingToFile(const QString &filename, const spb::tagreader::SongMetadata &song) const {
|
||||||
|
|
||||||
|
if (filename.isNull()) return false;
|
||||||
|
|
||||||
|
qLog(Debug) << "Saving song rating to" << filename;
|
||||||
|
|
||||||
|
if (song.rating() < 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename));
|
||||||
|
|
||||||
|
if (!fileref || fileref->isNull()) return false;
|
||||||
|
|
||||||
|
if (TagLib::FLAC::File *flac_file = dynamic_cast<TagLib::FLAC::File*>(fileref->file())) {
|
||||||
|
TagLib::Ogg::XiphComment *vorbis_comments = flac_file->xiphComment(true);
|
||||||
|
if (!vorbis_comments) return false;
|
||||||
|
if (song.rating() > 0) {
|
||||||
|
vorbis_comments->addField("FMPS_RATING", QStringToTaglibString(QString::number(song.rating())), true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
vorbis_comments->removeFields("FMPS_RATING");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TagLib::WavPack::File *wavpack_file = dynamic_cast<TagLib::WavPack::File*>(fileref->file())) {
|
||||||
|
TagLib::APE::Tag *tag = wavpack_file->APETag(true);
|
||||||
|
if (!tag) return false;
|
||||||
|
tag->setItem("FMPS_Rating", TagLib::APE::Item("FMPS_Rating", TagLib::StringList(QStringToTaglibString(QString::number(song.rating())))));
|
||||||
|
}
|
||||||
|
else if (TagLib::APE::File *ape_file = dynamic_cast<TagLib::APE::File*>(fileref->file())) {
|
||||||
|
TagLib::APE::Tag *tag = ape_file->APETag(true);
|
||||||
|
if (!tag) return false;
|
||||||
|
tag->setItem("FMPS_Rating", TagLib::APE::Item("FMPS_Rating", TagLib::StringList(QStringToTaglibString(QString::number(song.rating())))));
|
||||||
|
}
|
||||||
|
else if (TagLib::Ogg::XiphComment *xiph_comment = dynamic_cast<TagLib::Ogg::XiphComment*>(fileref->file()->tag())) {
|
||||||
|
if (song.rating() > 0) {
|
||||||
|
xiph_comment->addField("FMPS_RATING", QStringToTaglibString(QString::number(song.rating())), true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
xiph_comment->removeFields("FMPS_RATING");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TagLib::MPEG::File *mpeg_file = dynamic_cast<TagLib::MPEG::File*>(fileref->file())) {
|
||||||
|
TagLib::ID3v2::Tag *tag = mpeg_file->ID3v2Tag(true);
|
||||||
|
if (!tag) return false;
|
||||||
|
SetUserTextFrame("FMPS_Rating", QString::number(song.rating()), tag);
|
||||||
|
TagLib::ID3v2::PopularimeterFrame *frame = GetPOPMFrameFromTag(tag);
|
||||||
|
if (frame) {
|
||||||
|
frame->setRating(ConvertToPOPMRating(song.rating()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (TagLib::MP4::File *mp4_file = dynamic_cast<TagLib::MP4::File*>(fileref->file())) {
|
||||||
|
TagLib::MP4::Tag *tag = mp4_file->tag();
|
||||||
|
if (!tag) return false;
|
||||||
|
tag->setItem(kMP4_FMPS_Rating_ID, TagLib::StringList(QStringToTaglibString(QString::number(song.rating()))));
|
||||||
|
}
|
||||||
|
else if (TagLib::ASF::File *asf_file = dynamic_cast<TagLib::ASF::File*>(fileref->file())) {
|
||||||
|
TagLib::ASF::Tag *tag = asf_file->tag();
|
||||||
|
if (!tag) return false;
|
||||||
|
tag->addAttribute("FMPS/Rating", TagLib::ASF::Attribute(QStringToTaglibString(QString::number(song.rating()))));
|
||||||
|
}
|
||||||
|
else if (TagLib::MPC::File *mpc_file = dynamic_cast<TagLib::MPC::File*>(fileref->file())) {
|
||||||
|
TagLib::APE::Tag *tag = mpc_file->APETag(true);
|
||||||
|
if (!tag) return false;
|
||||||
|
tag->setItem("FMPS_Rating", TagLib::APE::Item("FMPS_Rating", TagLib::StringList(QStringToTaglibString(QString::number(song.rating())))));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ret = fileref->save();
|
||||||
|
#ifdef Q_OS_LINUX
|
||||||
|
if (ret) {
|
||||||
|
// Linux: inotify doesn't seem to notice the change to the file unless we change the timestamps as well. (this is what touch does)
|
||||||
|
utimensat(0, QFile::encodeName(filename).constData(), nullptr, 0);
|
||||||
|
}
|
||||||
|
#endif // Q_OS_LINUX
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include <taglib/apetag.h>
|
#include <taglib/apetag.h>
|
||||||
#include <taglib/apefile.h>
|
#include <taglib/apefile.h>
|
||||||
#include <taglib/id3v2tag.h>
|
#include <taglib/id3v2tag.h>
|
||||||
|
#include <taglib/popularimeterframe.h>
|
||||||
|
|
||||||
#include "tagreaderbase.h"
|
#include "tagreaderbase.h"
|
||||||
#include "tagreadermessages.pb.h"
|
#include "tagreadermessages.pb.h"
|
||||||
@@ -55,6 +56,9 @@ class TagReaderTagLib : public TagReaderBase {
|
|||||||
QByteArray LoadEmbeddedArt(const QString &filename) const override;
|
QByteArray LoadEmbeddedArt(const QString &filename) const override;
|
||||||
bool SaveEmbeddedArt(const QString &filename, const QByteArray &data) override;
|
bool SaveEmbeddedArt(const QString &filename, const QByteArray &data) override;
|
||||||
|
|
||||||
|
bool SaveSongPlaycountToFile(const QString &filename, const spb::tagreader::SongMetadata &song) const override;
|
||||||
|
bool SaveSongRatingToFile(const QString &filename, const spb::tagreader::SongMetadata &song) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
spb::tagreader::SongMetadata_FileType GuessFileType(TagLib::FileRef *fileref) const;
|
spb::tagreader::SongMetadata_FileType GuessFileType(TagLib::FileRef *fileref) const;
|
||||||
|
|
||||||
@@ -69,10 +73,16 @@ class TagReaderTagLib : public TagReaderBase {
|
|||||||
|
|
||||||
void SetTextFrame(const char *id, const QString &value, TagLib::ID3v2::Tag *tag) const;
|
void SetTextFrame(const char *id, const QString &value, TagLib::ID3v2::Tag *tag) const;
|
||||||
void SetTextFrame(const char *id, const std::string &value, TagLib::ID3v2::Tag *tag) const;
|
void SetTextFrame(const char *id, const std::string &value, TagLib::ID3v2::Tag *tag) const;
|
||||||
void SetUnsyncLyricsFrame(const std::string& value, TagLib::ID3v2::Tag* tag) const;
|
void SetUserTextFrame(const QString &description, const QString &value, TagLib::ID3v2::Tag *tag) const;
|
||||||
|
void SetUserTextFrame(const std::string &description, const std::string &value, TagLib::ID3v2::Tag *tag) const;
|
||||||
|
void SetUnsyncLyricsFrame(const std::string &value, TagLib::ID3v2::Tag *tag) const;
|
||||||
|
|
||||||
QByteArray LoadEmbeddedAPEArt(const TagLib::APE::ItemListMap &map) const;
|
QByteArray LoadEmbeddedAPEArt(const TagLib::APE::ItemListMap &map) const;
|
||||||
|
|
||||||
|
static float ConvertPOPMRating(const int POPM_rating);
|
||||||
|
static int ConvertToPOPMRating(const float rating);
|
||||||
|
static TagLib::ID3v2::PopularimeterFrame *GetPOPMFrameFromTag(TagLib::ID3v2::Tag *tag);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FileRefFactory *factory_;
|
FileRefFactory *factory_;
|
||||||
|
|
||||||
|
|||||||
@@ -106,11 +106,11 @@ void TagReaderTagParser::ReadFile(const QString &filename, spb::tagreader::SongM
|
|||||||
song->set_basefilename(DataCommaSizeFromQString(fileinfo.fileName()));
|
song->set_basefilename(DataCommaSizeFromQString(fileinfo.fileName()));
|
||||||
song->set_url(url.constData(), url.size());
|
song->set_url(url.constData(), url.size());
|
||||||
song->set_filesize(fileinfo.size());
|
song->set_filesize(fileinfo.size());
|
||||||
song->set_mtime(fileinfo.lastModified().toSecsSinceEpoch());
|
song->set_mtime(fileinfo.lastModified().isValid() ? fileinfo.lastModified().toSecsSinceEpoch() : 0);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||||
song->set_ctime(fileinfo.birthTime().isValid() ? fileinfo.birthTime().toSecsSinceEpoch() : fileinfo.lastModified().toSecsSinceEpoch());
|
song->set_ctime(fileinfo.birthTime().isValid() ? fileinfo.birthTime().toSecsSinceEpoch() : fileinfo.lastModified().isValid() ? fileinfo.lastModified().toSecsSinceEpoch() : 0);
|
||||||
#else
|
#else
|
||||||
song->set_ctime(fileinfo.created().toSecsSinceEpoch());
|
song->set_ctime(fileinfo.created().isValid() ? fileinfo.created().toSecsSinceEpoch() : fileinfo.lastModified().isValid() ? fileinfo.lastModified().toSecsSinceEpoch() : 0);
|
||||||
#endif
|
#endif
|
||||||
song->set_lastseen(QDateTime::currentDateTime().toSecsSinceEpoch());
|
song->set_lastseen(QDateTime::currentDateTime().toSecsSinceEpoch());
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ void TagReaderTagParser::ReadFile(const QString &filename, spb::tagreader::SongM
|
|||||||
|
|
||||||
const auto tracks = taginfo.tracks();
|
const auto tracks = taginfo.tracks();
|
||||||
for (const auto track : tracks) {
|
for (const auto track : tracks) {
|
||||||
switch(track->format().general) {
|
switch (track->format().general) {
|
||||||
case TagParser::GeneralMediaFormat::Flac:
|
case TagParser::GeneralMediaFormat::Flac:
|
||||||
song->set_filetype(spb::tagreader::SongMetadata_FileType::SongMetadata_FileType_FLAC);
|
song->set_filetype(spb::tagreader::SongMetadata_FileType::SongMetadata_FileType_FLAC);
|
||||||
break;
|
break;
|
||||||
@@ -174,7 +174,7 @@ void TagReaderTagParser::ReadFile(const QString &filename, spb::tagreader::SongM
|
|||||||
song->set_filetype(spb::tagreader::SongMetadata_FileType::SongMetadata_FileType_OGGSPEEX);
|
song->set_filetype(spb::tagreader::SongMetadata_FileType::SongMetadata_FileType_OGGSPEEX);
|
||||||
break;
|
break;
|
||||||
case TagParser::GeneralMediaFormat::Mpeg1Audio:
|
case TagParser::GeneralMediaFormat::Mpeg1Audio:
|
||||||
switch(track->format().sub) {
|
switch (track->format().sub) {
|
||||||
case TagParser::SubFormats::Mpeg1Layer3:
|
case TagParser::SubFormats::Mpeg1Layer3:
|
||||||
song->set_filetype(spb::tagreader::SongMetadata_FileType::SongMetadata_FileType_MPEG);
|
song->set_filetype(spb::tagreader::SongMetadata_FileType::SongMetadata_FileType_MPEG);
|
||||||
break;
|
break;
|
||||||
@@ -225,20 +225,19 @@ void TagReaderTagParser::ReadFile(const QString &filename, spb::tagreader::SongM
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set integer fields to -1 if they're not valid
|
// Set integer fields to -1 if they're not valid
|
||||||
#define SetDefault(field) if (song->field() <= 0) { song->set_##field(-1); }
|
if (song->track() <= 0) { song->set_track(-1); }
|
||||||
SetDefault(track);
|
if (song->disc() <= 0) { song->set_disc(-1); }
|
||||||
SetDefault(disc);
|
if (song->year() <= 0) { song->set_year(-1); }
|
||||||
SetDefault(year);
|
if (song->originalyear() <= 0) { song->set_originalyear(-1); }
|
||||||
SetDefault(originalyear);
|
if (song->samplerate() <= 0) { song->set_samplerate(-1); }
|
||||||
SetDefault(bitrate);
|
if (song->bitdepth() <= 0) { song->set_bitdepth(-1); }
|
||||||
SetDefault(samplerate);
|
if (song->bitrate() <= 0) { song->set_bitrate(-1); }
|
||||||
SetDefault(bitdepth);
|
if (song->lastplayed() <= 0) { song->set_lastplayed(-1); }
|
||||||
SetDefault(lastplayed);
|
|
||||||
#undef SetDefault
|
|
||||||
|
|
||||||
song->set_valid(true);
|
song->set_valid(true);
|
||||||
|
|
||||||
taginfo.close();
|
taginfo.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(...) {}
|
catch(...) {}
|
||||||
|
|
||||||
@@ -422,3 +421,62 @@ bool TagReaderTagParser::SaveEmbeddedArt(const QString &filename, const QByteArr
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TagReaderTagParser::SaveSongPlaycountToFile(const QString&, const spb::tagreader::SongMetadata&) const { return false; }
|
||||||
|
|
||||||
|
bool TagReaderTagParser::SaveSongRatingToFile(const QString &filename, const spb::tagreader::SongMetadata &song) const {
|
||||||
|
|
||||||
|
if (filename.isEmpty()) return false;
|
||||||
|
|
||||||
|
qLog(Debug) << "Saving song rating to" << filename;
|
||||||
|
|
||||||
|
try {
|
||||||
|
TagParser::MediaFileInfo taginfo;
|
||||||
|
TagParser::Diagnostics diag;
|
||||||
|
TagParser::AbortableProgressFeedback progress;
|
||||||
|
#ifdef Q_OS_WIN32
|
||||||
|
taginfo.setPath(filename.toStdWString().toStdString());
|
||||||
|
#else
|
||||||
|
taginfo.setPath(QFile::encodeName(filename).toStdString());
|
||||||
|
#endif
|
||||||
|
taginfo.open(false);
|
||||||
|
|
||||||
|
taginfo.parseContainerFormat(diag, progress);
|
||||||
|
if (progress.isAborted()) {
|
||||||
|
taginfo.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
taginfo.parseTracks(diag, progress);
|
||||||
|
if (progress.isAborted()) {
|
||||||
|
taginfo.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
taginfo.parseTags(diag, progress);
|
||||||
|
if (progress.isAborted()) {
|
||||||
|
taginfo.close();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (taginfo.tags().size() <= 0) {
|
||||||
|
taginfo.createAppropriateTags();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto tag : taginfo.tags()) {
|
||||||
|
tag->setValue(TagParser::KnownField::Rating, TagParser::TagValue(song.rating()));
|
||||||
|
}
|
||||||
|
taginfo.applyChanges(diag, progress);
|
||||||
|
taginfo.close();
|
||||||
|
|
||||||
|
for (const TagParser::DiagMessage &msg : diag) {
|
||||||
|
qLog(Debug) << QString::fromStdString(msg.message());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch(...) {}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -45,6 +45,9 @@ class TagReaderTagParser : public TagReaderBase {
|
|||||||
QByteArray LoadEmbeddedArt(const QString &filename) const override;
|
QByteArray LoadEmbeddedArt(const QString &filename) const override;
|
||||||
bool SaveEmbeddedArt(const QString &filename, const QByteArray &data) override;
|
bool SaveEmbeddedArt(const QString &filename, const QByteArray &data) override;
|
||||||
|
|
||||||
|
bool SaveSongPlaycountToFile(const QString &filename, const spb::tagreader::SongMetadata &song) const override;
|
||||||
|
bool SaveSongRatingToFile(const QString &filename, const spb::tagreader::SongMetadata &song) const override;
|
||||||
|
|
||||||
Q_DISABLE_COPY(TagReaderTagParser)
|
Q_DISABLE_COPY(TagReaderTagParser)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ int main(int argc, char **argv) {
|
|||||||
QRegularExpressionMatch match = regexp.match(output_line);
|
QRegularExpressionMatch match = regexp.match(output_line);
|
||||||
if (match.hasMatch()) {
|
if (match.hasMatch()) {
|
||||||
QString library = match.captured(1);
|
QString library = match.captured(1);
|
||||||
if (QFileInfo(library).fileName() == QFileInfo(filepath).fileName()) { // It's this.
|
if (QFileInfo(library).fileName() == QFileInfo(filepath).fileName()) { // It's this.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (library.startsWith("@executable_path")) {
|
else if (library.startsWith("@executable_path")) {
|
||||||
@@ -113,7 +113,7 @@ int main(int argc, char **argv) {
|
|||||||
else if (library.startsWith("@rpath")) {
|
else if (library.startsWith("@rpath")) {
|
||||||
QString real_path = library;
|
QString real_path = library;
|
||||||
real_path = real_path.replace("@rpath", bundle_path + "/Contents/Frameworks");
|
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(real_path).exists() && !real_path.endsWith("QtSvg")) { // FIXME: Ignore broken svg image plugin.
|
||||||
qLog(Error) << real_path << "does not exist for" << filepath;
|
qLog(Error) << real_path << "does not exist for" << filepath;
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ int main(int argc, char **argv) {
|
|||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (library.startsWith("/System/Library/") || library.startsWith("/usr/lib/")) { // System library
|
else if (library.startsWith("/System/Library/") || library.startsWith("/usr/lib/")) { // System library
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (library.endsWith("libgcc_s.1.dylib")) { // fftw points to it for some reason.
|
else if (library.endsWith("libgcc_s.1.dylib")) { // fftw points to it for some reason.
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
||||||
#include <sys/time.h>
|
# include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|||||||
@@ -28,28 +28,34 @@
|
|||||||
#include "tagreaderworker.h"
|
#include "tagreaderworker.h"
|
||||||
|
|
||||||
TagReaderWorker::TagReaderWorker(QIODevice *socket, QObject *parent)
|
TagReaderWorker::TagReaderWorker(QIODevice *socket, QObject *parent)
|
||||||
: AbstractMessageHandler<spb::tagreader::Message>(socket, parent) {}
|
: AbstractMessageHandler<spb::tagreader::Message>(socket, parent) {}
|
||||||
|
|
||||||
void TagReaderWorker::MessageArrived(const spb::tagreader::Message &message) {
|
void TagReaderWorker::MessageArrived(const spb::tagreader::Message &message) {
|
||||||
|
|
||||||
spb::tagreader::Message reply;
|
spb::tagreader::Message reply;
|
||||||
|
|
||||||
if (message.has_read_file_request()) {
|
if (message.has_is_media_file_request()) {
|
||||||
|
reply.mutable_is_media_file_response()->set_success(tag_reader_.IsMediaFile(QStringFromStdString(message.is_media_file_request().filename())));
|
||||||
|
}
|
||||||
|
else if (message.has_read_file_request()) {
|
||||||
tag_reader_.ReadFile(QStringFromStdString(message.read_file_request().filename()), reply.mutable_read_file_response()->mutable_metadata());
|
tag_reader_.ReadFile(QStringFromStdString(message.read_file_request().filename()), reply.mutable_read_file_response()->mutable_metadata());
|
||||||
}
|
}
|
||||||
else if (message.has_save_file_request()) {
|
else if (message.has_save_file_request()) {
|
||||||
reply.mutable_save_file_response()->set_success(tag_reader_.SaveFile(QStringFromStdString(message.save_file_request().filename()), message.save_file_request().metadata()));
|
reply.mutable_save_file_response()->set_success(tag_reader_.SaveFile(QStringFromStdString(message.save_file_request().filename()), message.save_file_request().metadata()));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (message.has_is_media_file_request()) {
|
|
||||||
reply.mutable_is_media_file_response()->set_success(tag_reader_.IsMediaFile(QStringFromStdString(message.is_media_file_request().filename())));
|
|
||||||
}
|
|
||||||
else if (message.has_load_embedded_art_request()) {
|
else if (message.has_load_embedded_art_request()) {
|
||||||
QByteArray data = tag_reader_.LoadEmbeddedArt(QStringFromStdString(message.load_embedded_art_request().filename()));
|
QByteArray data = tag_reader_.LoadEmbeddedArt(QStringFromStdString(message.load_embedded_art_request().filename()));
|
||||||
reply.mutable_load_embedded_art_response()->set_data(data.constData(), data.size());
|
reply.mutable_load_embedded_art_response()->set_data(data.constData(), data.size());
|
||||||
}
|
}
|
||||||
else if (message.has_save_embedded_art_request()) {
|
else if (message.has_save_embedded_art_request()) {
|
||||||
reply.mutable_save_embedded_art_response()->set_success(tag_reader_.SaveEmbeddedArt(QStringFromStdString(message.save_embedded_art_request().filename()), QByteArray(message.save_embedded_art_request().data().data(), message.save_embedded_art_request().data().size())));
|
reply.mutable_save_embedded_art_response()->set_success(tag_reader_.SaveEmbeddedArt(QStringFromStdString(message.save_embedded_art_request().filename()), QByteArray(message.save_embedded_art_request().data().data(), static_cast<qint64>(message.save_embedded_art_request().data().size()))));
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (message.has_save_song_playcount_to_file_request()) {
|
||||||
|
reply.mutable_save_song_playcount_to_file_response()->set_success(tag_reader_.SaveSongPlaycountToFile(QStringFromStdString(message.save_song_playcount_to_file_request().filename()), message.save_song_playcount_to_file_request().metadata()));
|
||||||
|
}
|
||||||
|
else if (message.has_save_song_rating_to_file_request()) {
|
||||||
|
reply.mutable_save_song_rating_to_file_response()->set_success(tag_reader_.SaveSongRatingToFile(QStringFromStdString(message.save_song_rating_to_file_request().filename()), message.save_song_rating_to_file_request().metadata()));
|
||||||
}
|
}
|
||||||
|
|
||||||
SendReply(message, &reply);
|
SendReply(message, &reply);
|
||||||
|
|||||||
@@ -635,34 +635,6 @@ if(UNIX AND HAVE_DBUS)
|
|||||||
qt_add_dbus_interface(SOURCES dbus/org.kde.KGlobalAccel.xml dbus/kglobalaccel)
|
qt_add_dbus_interface(SOURCES dbus/org.kde.KGlobalAccel.xml dbus/kglobalaccel)
|
||||||
qt_add_dbus_interface(SOURCES dbus/org.kde.KGlobalAccel.Component.xml dbus/kglobalaccelcomponent)
|
qt_add_dbus_interface(SOURCES dbus/org.kde.KGlobalAccel.Component.xml dbus/kglobalaccelcomponent)
|
||||||
|
|
||||||
# org.freedesktop.Avahi.Server interface
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/dbus/avahiserver.cpp
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/dbus/avahiserver.h
|
|
||||||
COMMAND ${QT_DBUSXML2CPP_EXECUTABLE}
|
|
||||||
dbus/org.freedesktop.Avahi.Server.xml
|
|
||||||
-p ${CMAKE_CURRENT_BINARY_DIR}/dbus/avahiserver
|
|
||||||
-i dbus/metatypes.h
|
|
||||||
DEPENDS dbus/org.freedesktop.Avahi.Server.xml
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
list(APPEND HEADERS ${CMAKE_CURRENT_BINARY_DIR}/dbus/avahiserver.h)
|
|
||||||
list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/dbus/avahiserver.cpp)
|
|
||||||
|
|
||||||
# org.freedesktop.Avahi.EntryGroup interface
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/dbus/avahientrygroup.cpp
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/dbus/avahientrygroup.h
|
|
||||||
COMMAND ${QT_DBUSXML2CPP_EXECUTABLE}
|
|
||||||
dbus/org.freedesktop.Avahi.EntryGroup.xml
|
|
||||||
-p ${CMAKE_CURRENT_BINARY_DIR}/dbus/avahientrygroup
|
|
||||||
-i dbus/metatypes.h
|
|
||||||
DEPENDS dbus/org.freedesktop.Avahi.EntryGroup.xml
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
list(APPEND HEADERS ${CMAKE_CURRENT_BINARY_DIR}/dbus/avahientrygroup.h)
|
|
||||||
list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/dbus/avahientrygroup.cpp)
|
|
||||||
|
|
||||||
if(HAVE_UDISKS2)
|
if(HAVE_UDISKS2)
|
||||||
set_source_files_properties(dbus/org.freedesktop.DBus.ObjectManager.xml PROPERTIES NO_NAMESPACE dbus/objectmanager INCLUDE dbus/metatypes.h)
|
set_source_files_properties(dbus/org.freedesktop.DBus.ObjectManager.xml PROPERTIES NO_NAMESPACE dbus/objectmanager INCLUDE dbus/metatypes.h)
|
||||||
set_source_files_properties(dbus/org.freedesktop.UDisks2.Filesystem.xml PROPERTIES NO_NAMESPACE dbus/udisks2filesystem INCLUDE dbus/metatypes.h)
|
set_source_files_properties(dbus/org.freedesktop.UDisks2.Filesystem.xml PROPERTIES NO_NAMESPACE dbus/udisks2filesystem INCLUDE dbus/metatypes.h)
|
||||||
@@ -971,7 +943,6 @@ link_directories(
|
|||||||
${SQLITE_LIBRARY_DIRS}
|
${SQLITE_LIBRARY_DIRS}
|
||||||
${SINGLEAPPLICATION_LIBRARY_DIRS}
|
${SINGLEAPPLICATION_LIBRARY_DIRS}
|
||||||
${SINGLECOREAPPLICATION_LIBRARY_DIRS}
|
${SINGLECOREAPPLICATION_LIBRARY_DIRS}
|
||||||
${QTSPARKLE_LIBRARY_DIRS}
|
|
||||||
${Iconv_LIBRARY_DIRS}
|
${Iconv_LIBRARY_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1014,6 +985,10 @@ if(HAVE_GIO)
|
|||||||
link_directories(${GIO_LIBRARY_DIRS})
|
link_directories(${GIO_LIBRARY_DIRS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(HAVE_GIO_UNIX)
|
||||||
|
link_directories(${GIO_UNIX_LIBRARY_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(HAVE_AUDIOCD)
|
if(HAVE_AUDIOCD)
|
||||||
link_directories(${LIBCDIO_LIBRARY_DIRS})
|
link_directories(${LIBCDIO_LIBRARY_DIRS})
|
||||||
endif()
|
endif()
|
||||||
@@ -1034,6 +1009,10 @@ if(USE_TAGPARSER AND TAGPARSER_FOUND)
|
|||||||
link_directories(${TAGPARSER_LIBRARY_DIRS})
|
link_directories(${TAGPARSER_LIBRARY_DIRS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(HAVE_QTSPARKLE)
|
||||||
|
link_directories(${QTSPARKLE_LIBRARY_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(strawberry_lib STATIC
|
add_library(strawberry_lib STATIC
|
||||||
${SOURCES}
|
${SOURCES}
|
||||||
${MOC}
|
${MOC}
|
||||||
@@ -1050,6 +1029,7 @@ target_include_directories(strawberry_lib SYSTEM PUBLIC
|
|||||||
${GOBJECT_INCLUDE_DIRS}
|
${GOBJECT_INCLUDE_DIRS}
|
||||||
${GNUTLS_INCLUDE_DIRS}
|
${GNUTLS_INCLUDE_DIRS}
|
||||||
${SQLITE_INCLUDE_DIRS}
|
${SQLITE_INCLUDE_DIRS}
|
||||||
|
${PROTOBUF_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
|
if(HAVE_QPA_QPLATFORMNATIVEINTERFACE_H)
|
||||||
@@ -1077,7 +1057,6 @@ target_link_libraries(strawberry_lib PUBLIC
|
|||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
${SINGLEAPPLICATION_LIBRARIES}
|
${SINGLEAPPLICATION_LIBRARIES}
|
||||||
${SINGLECOREAPPLICATION_LIBRARIES}
|
${SINGLECOREAPPLICATION_LIBRARIES}
|
||||||
${QTSPARKLE_LIBRARIES}
|
|
||||||
${Iconv_LIBRARIES}
|
${Iconv_LIBRARIES}
|
||||||
libstrawberry-common
|
libstrawberry-common
|
||||||
libstrawberry-tagreader
|
libstrawberry-tagreader
|
||||||
@@ -1141,6 +1120,11 @@ if(HAVE_GIO)
|
|||||||
target_link_libraries(strawberry_lib PRIVATE ${GIO_LIBRARIES})
|
target_link_libraries(strawberry_lib PRIVATE ${GIO_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(HAVE_GIO_UNIX)
|
||||||
|
target_include_directories(strawberry_lib SYSTEM PRIVATE ${GIO_UNIX_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(strawberry_lib PRIVATE ${GIO_UNIX_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(HAVE_AUDIOCD)
|
if(HAVE_AUDIOCD)
|
||||||
target_include_directories(strawberry_lib SYSTEM PRIVATE ${LIBCDIO_INCLUDE_DIRS})
|
target_include_directories(strawberry_lib SYSTEM PRIVATE ${LIBCDIO_INCLUDE_DIRS})
|
||||||
target_link_libraries(strawberry_lib PRIVATE ${LIBCDIO_LIBRARIES})
|
target_link_libraries(strawberry_lib PRIVATE ${LIBCDIO_LIBRARIES})
|
||||||
@@ -1171,19 +1155,25 @@ if(APPLE)
|
|||||||
"-framework ScriptingBridge"
|
"-framework ScriptingBridge"
|
||||||
)
|
)
|
||||||
target_link_libraries(strawberry_lib PRIVATE ${SPMEDIAKEYTAP_LIBRARIES})
|
target_link_libraries(strawberry_lib PRIVATE ${SPMEDIAKEYTAP_LIBRARIES})
|
||||||
if(HAVE_SPARKLE)
|
|
||||||
target_include_directories(strawberry_lib SYSTEM PRIVATE ${SPARKLE}/Headers)
|
|
||||||
target_link_libraries(strawberry_lib PRIVATE ${SPARKLE})
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(strawberry_lib PRIVATE dsound dwmapi)
|
target_link_libraries(strawberry_lib PRIVATE dsound dwmapi)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_link_libraries(strawberry_lib PRIVATE sqlite3)
|
target_link_libraries(strawberry_lib PRIVATE sqlite3)
|
||||||
|
if (GETOPT_INCLUDE_DIRS)
|
||||||
|
target_include_directories(strawberry_lib SYSTEM PRIVATE ${GETOPT_INCLUDE_DIRS})
|
||||||
|
endif()
|
||||||
|
if(GETOPT_LIBRARIES)
|
||||||
|
target_link_libraries(strawberry_lib PRIVATE ${GETOPT_LIBRARIES})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(HAVE_QTSPARKLE)
|
||||||
|
target_include_directories(strawberry_lib SYSTEM PRIVATE ${QTSPARKLE_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(strawberry_lib PRIVATE ${QTSPARKLE_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|||||||
@@ -32,10 +32,11 @@
|
|||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
|
#include <QBasicTimer>
|
||||||
|
#include <QShowEvent>
|
||||||
|
#include <QHideEvent>
|
||||||
#include <QTimerEvent>
|
#include <QTimerEvent>
|
||||||
#include <QtEvents>
|
|
||||||
|
|
||||||
#include "core/logging.h"
|
|
||||||
#include "engine/enginebase.h"
|
#include "engine/enginebase.h"
|
||||||
|
|
||||||
// INSTRUCTIONS Base2D
|
// INSTRUCTIONS Base2D
|
||||||
@@ -47,27 +48,38 @@
|
|||||||
//
|
//
|
||||||
// TODO:
|
// TODO:
|
||||||
// Make an INSTRUCTIONS file
|
// Make an INSTRUCTIONS file
|
||||||
// can't mod scope in analyze you have to use transform
|
// can't mod scope in analyze you have to use transform for 2D use setErasePixmap Qt function insetead of m_background
|
||||||
// for 2D use setErasePixmap Qt function insetead of m_background
|
|
||||||
|
|
||||||
// make the linker happy only for gcc < 4.0
|
|
||||||
#if !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 0)) && \
|
|
||||||
!defined(Q_OS_WIN32)
|
|
||||||
template class Analyzer::Base<QWidget>;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Analyzer::Base::Base(QWidget *parent, const uint scopeSize)
|
Analyzer::Base::Base(QWidget *parent, const uint scopeSize)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
timeout_(40),
|
|
||||||
fht_(new FHT(scopeSize)),
|
fht_(new FHT(scopeSize)),
|
||||||
engine_(nullptr),
|
engine_(nullptr),
|
||||||
lastscope_(512),
|
lastscope_(512),
|
||||||
new_frame_(false),
|
new_frame_(false),
|
||||||
is_playing_(false) {}
|
is_playing_(false),
|
||||||
|
timeout_(40) {}
|
||||||
|
|
||||||
void Analyzer::Base::hideEvent(QHideEvent*) { timer_.stop(); }
|
Analyzer::Base::~Base() {
|
||||||
|
delete fht_;
|
||||||
|
}
|
||||||
|
|
||||||
void Analyzer::Base::showEvent(QShowEvent*) { timer_.start(timeout(), this); }
|
void Analyzer::Base::showEvent(QShowEvent*) {
|
||||||
|
timer_.start(timeout(), this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Analyzer::Base::hideEvent(QHideEvent*) {
|
||||||
|
timer_.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Analyzer::Base::ChangeTimeout(const int timeout) {
|
||||||
|
|
||||||
|
timeout_ = timeout;
|
||||||
|
if (timer_.isActive()) {
|
||||||
|
timer_.stop();
|
||||||
|
timer_.start(timeout_, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Analyzer::Base::transform(Scope &scope) {
|
void Analyzer::Base::transform(Scope &scope) {
|
||||||
|
|
||||||
@@ -80,7 +92,7 @@ void Analyzer::Base::transform(Scope &scope) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fht_->logSpectrum(scope.data(), aux.data());
|
fht_->logSpectrum(scope.data(), aux.data());
|
||||||
fht_->scale(scope.data(), 1.0 / 20);
|
fht_->scale(scope.data(), 1.0F / 20);
|
||||||
|
|
||||||
scope.resize(fht_->size() / 2); // second half of values are rubbish
|
scope.resize(fht_->size() / 2); // second half of values are rubbish
|
||||||
|
|
||||||
@@ -161,7 +173,7 @@ int Analyzer::Base::resizeForBands(const int bands) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
exp = 9;
|
exp = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeExponent(exp);
|
resizeExponent(exp);
|
||||||
return fht_->size() / 2;
|
return fht_->size() / 2;
|
||||||
@@ -180,7 +192,7 @@ void Analyzer::Base::demo(QPainter &p) {
|
|||||||
|
|
||||||
const double dt = static_cast<double>(t) / 200;
|
const double dt = static_cast<double>(t) / 200;
|
||||||
for (uint i = 0; i < s.size(); ++i) {
|
for (uint i = 0; i < s.size(); ++i) {
|
||||||
s[i] = dt * (sin(M_PI + (i * M_PI) / s.size()) + 1.0);
|
s[i] = static_cast<float>(dt * (sin(M_PI + (i * M_PI) / static_cast<double>(s.size())) + 1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
analyze(p, s, new_frame_);
|
analyze(p, s, new_frame_);
|
||||||
@@ -193,14 +205,10 @@ void Analyzer::Base::demo(QPainter &p) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Analyzer::Base::polishEvent() {
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Analyzer::interpolate(const Scope &inVec, Scope &outVec) {
|
void Analyzer::interpolate(const Scope &inVec, Scope &outVec) {
|
||||||
|
|
||||||
double pos = 0.0;
|
double pos = 0.0;
|
||||||
const double step = static_cast<double>(inVec.size()) / outVec.size();
|
const double step = static_cast<double>(inVec.size()) / static_cast<double>(outVec.size());
|
||||||
|
|
||||||
for (uint i = 0; i < outVec.size(); ++i, pos += step) {
|
for (uint i = 0; i < outVec.size(); ++i, pos += step) {
|
||||||
const double error = pos - std::floor(pos);
|
const double error = pos - std::floor(pos);
|
||||||
@@ -218,7 +226,7 @@ void Analyzer::interpolate(const Scope &inVec, Scope &outVec) {
|
|||||||
indexRight = inVec.size() - 1;
|
indexRight = inVec.size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
outVec[i] = inVec[indexLeft] * (1.0 - error) + inVec[indexRight] * error;
|
outVec[i] = inVec[indexLeft] * (1.0F - static_cast<float>(error)) + inVec[indexRight] * static_cast<float>(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -229,7 +237,7 @@ void Analyzer::initSin(Scope &v, const uint size) {
|
|||||||
double radian = 0;
|
double radian = 0;
|
||||||
|
|
||||||
for (uint i = 0; i < size; i++) {
|
for (uint i = 0; i < size; i++) {
|
||||||
v.push_back(sin(radian));
|
v.push_back(static_cast<float>(sin(radian)));
|
||||||
radian += step;
|
radian += step;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,8 @@
|
|||||||
|
|
||||||
class QHideEvent;
|
class QHideEvent;
|
||||||
class QShowEvent;
|
class QShowEvent;
|
||||||
class QTimerEvent;
|
|
||||||
class QPaintEvent;
|
class QPaintEvent;
|
||||||
|
class QTimerEvent;
|
||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
@@ -55,19 +55,13 @@ class Base : public QWidget {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~Base() override { delete fht_; }
|
~Base() override;
|
||||||
|
|
||||||
int timeout() const { return timeout_; }
|
int timeout() const { return timeout_; }
|
||||||
|
|
||||||
void set_engine(EngineBase *engine) { engine_ = engine; }
|
void set_engine(EngineBase *engine) { engine_ = engine; }
|
||||||
|
|
||||||
void changeTimeout(int newTimeout) {
|
void ChangeTimeout(const int timeout);
|
||||||
timeout_ = newTimeout;
|
|
||||||
if (timer_.isActive()) {
|
|
||||||
timer_.stop();
|
|
||||||
timer_.start(timeout_, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual void framerateChanged() {}
|
virtual void framerateChanged() {}
|
||||||
|
|
||||||
@@ -76,10 +70,8 @@ class Base : public QWidget {
|
|||||||
|
|
||||||
void hideEvent(QHideEvent*) override;
|
void hideEvent(QHideEvent*) override;
|
||||||
void showEvent(QShowEvent*) override;
|
void showEvent(QShowEvent*) override;
|
||||||
void paintEvent(QPaintEvent*) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void timerEvent(QTimerEvent*) override;
|
void timerEvent(QTimerEvent *e) override;
|
||||||
|
|
||||||
void polishEvent();
|
|
||||||
|
|
||||||
int resizeExponent(int);
|
int resizeExponent(int);
|
||||||
int resizeForBands(const int);
|
int resizeForBands(const int);
|
||||||
@@ -90,13 +82,13 @@ class Base : public QWidget {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
QBasicTimer timer_;
|
QBasicTimer timer_;
|
||||||
int timeout_;
|
|
||||||
FHT *fht_;
|
FHT *fht_;
|
||||||
EngineBase *engine_;
|
EngineBase *engine_;
|
||||||
Scope lastscope_;
|
Scope lastscope_;
|
||||||
|
|
||||||
bool new_frame_;
|
bool new_frame_;
|
||||||
bool is_playing_;
|
bool is_playing_;
|
||||||
|
int timeout_;
|
||||||
};
|
};
|
||||||
|
|
||||||
void interpolate(const Scope&, Scope&);
|
void interpolate(const Scope&, Scope&);
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ void AnalyzerContainer::ChangeAnalyzer(const int id) {
|
|||||||
current_analyzer_->set_engine(engine_);
|
current_analyzer_->set_engine(engine_);
|
||||||
// Even if it is not supposed to happen, I don't want to get a dbz error
|
// Even if it is not supposed to happen, I don't want to get a dbz error
|
||||||
current_framerate_ = current_framerate_ == 0 ? kMediumFramerate : current_framerate_;
|
current_framerate_ = current_framerate_ == 0 ? kMediumFramerate : current_framerate_;
|
||||||
current_analyzer_->changeTimeout(1000 / current_framerate_);
|
current_analyzer_->ChangeTimeout(1000 / current_framerate_);
|
||||||
|
|
||||||
layout()->addWidget(current_analyzer_);
|
layout()->addWidget(current_analyzer_);
|
||||||
|
|
||||||
@@ -166,7 +166,7 @@ void AnalyzerContainer::ChangeFramerate(int new_framerate) {
|
|||||||
if (current_analyzer_) {
|
if (current_analyzer_) {
|
||||||
// Even if it is not supposed to happen, I don't want to get a dbz error
|
// Even if it is not supposed to happen, I don't want to get a dbz error
|
||||||
new_framerate = new_framerate == 0 ? kMediumFramerate : new_framerate;
|
new_framerate = new_framerate == 0 ? kMediumFramerate : new_framerate;
|
||||||
current_analyzer_->changeTimeout(1000 / new_framerate);
|
current_analyzer_->ChangeTimeout(1000 / new_framerate);
|
||||||
|
|
||||||
// notify the current analyzer that the framerate has changed
|
// notify the current analyzer that the framerate has changed
|
||||||
current_analyzer_->framerateChanged();
|
current_analyzer_->framerateChanged();
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class AnalyzerContainer : public QWidget {
|
|||||||
void Load();
|
void Load();
|
||||||
void Save();
|
void Save();
|
||||||
void SaveFramerate(const int framerate);
|
void SaveFramerate(const int framerate);
|
||||||
template <typename T>
|
template<typename T>
|
||||||
void AddAnalyzerType();
|
void AddAnalyzerType();
|
||||||
void AddFramerate(const QString &name, const int framerate);
|
void AddFramerate(const QString &name, const int framerate);
|
||||||
|
|
||||||
@@ -96,10 +96,9 @@ class AnalyzerContainer : public QWidget {
|
|||||||
|
|
||||||
Analyzer::Base *current_analyzer_;
|
Analyzer::Base *current_analyzer_;
|
||||||
EngineBase *engine_;
|
EngineBase *engine_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template<typename T>
|
||||||
void AnalyzerContainer::AddAnalyzerType() {
|
void AnalyzerContainer::AddAnalyzerType() {
|
||||||
|
|
||||||
int id = analyzer_types_.count();
|
int id = analyzer_types_.count();
|
||||||
|
|||||||
@@ -63,8 +63,7 @@ BlockAnalyzer::BlockAnalyzer(QWidget *parent)
|
|||||||
setMaximumWidth(kMaxColumns * (kWidth + 1) - 1);
|
setMaximumWidth(kMaxColumns * (kWidth + 1) - 1);
|
||||||
|
|
||||||
// mxcl says null pixmaps cause crashes, so let's play it safe
|
// mxcl says null pixmaps cause crashes, so let's play it safe
|
||||||
std::fill(fade_bars_.begin(), fade_bars_.end(), QPixmap(1, 1));
|
std::fill(fade_bars_.begin(), fade_bars_.end(), QPixmap(1, 1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlockAnalyzer::resizeEvent(QResizeEvent *e) {
|
void BlockAnalyzer::resizeEvent(QResizeEvent *e) {
|
||||||
@@ -89,7 +88,7 @@ void BlockAnalyzer::resizeEvent(QResizeEvent *e) {
|
|||||||
if (rows_ != oldRows) {
|
if (rows_ != oldRows) {
|
||||||
barpixmap_ = QPixmap(kWidth, rows_ * (kHeight + 1));
|
barpixmap_ = QPixmap(kWidth, rows_ * (kHeight + 1));
|
||||||
|
|
||||||
std::fill(fade_bars_.begin(), fade_bars_.end(), QPixmap(kWidth, rows_ * (kHeight + 1)));
|
std::fill(fade_bars_.begin(), fade_bars_.end(), QPixmap(kWidth, rows_ * (kHeight + 1)));
|
||||||
|
|
||||||
yscale_.resize(rows_ + 1);
|
yscale_.resize(rows_ + 1);
|
||||||
|
|
||||||
@@ -130,7 +129,7 @@ void BlockAnalyzer::transform(Analyzer::Scope &s) {
|
|||||||
for (uint x = 0; x < s.size(); ++x) s[x] *= 2;
|
for (uint x = 0; x < s.size(); ++x) s[x] *= 2;
|
||||||
|
|
||||||
fht_->spectrum(s.data());
|
fht_->spectrum(s.data());
|
||||||
fht_->scale(s.data(), 1.0 / 20);
|
fht_->scale(s.data(), 1.0F / 20);
|
||||||
|
|
||||||
// the second half is pretty dull, so only show it if the user has a large analyzer by setting to scope_.size() if large we prevent interpolation of large analyzers, this is good!
|
// the second half is pretty dull, so only show it if the user has a large analyzer by setting to scope_.size() if large we prevent interpolation of large analyzers, this is good!
|
||||||
s.resize(scope_.size() <= kMaxColumns / 2 ? kMaxColumns / 2 : scope_.size());
|
s.resize(scope_.size() <= kMaxColumns / 2 ? kMaxColumns / 2 : scope_.size());
|
||||||
|
|||||||
@@ -65,14 +65,14 @@ class BlockAnalyzer : public Analyzer::Base {
|
|||||||
private:
|
private:
|
||||||
QPixmap *bar() { return &barpixmap_; }
|
QPixmap *bar() { return &barpixmap_; }
|
||||||
|
|
||||||
int columns_, rows_; // number of rows and columns of blocks
|
int columns_, rows_; // number of rows and columns of blocks
|
||||||
int y_; // y-offset from top of widget
|
int y_; // y-offset from top of widget
|
||||||
QPixmap barpixmap_;
|
QPixmap barpixmap_;
|
||||||
QPixmap topbarpixmap_;
|
QPixmap topbarpixmap_;
|
||||||
QPixmap background_;
|
QPixmap background_;
|
||||||
QPixmap canvas_;
|
QPixmap canvas_;
|
||||||
Analyzer::Scope scope_; // so we don't create a vector every frame
|
Analyzer::Scope scope_; // so we don't create a vector every frame
|
||||||
QVector<double> store_; // current bar heights
|
QVector<double> store_; // current bar heights
|
||||||
QVector<double> yscale_;
|
QVector<double> yscale_;
|
||||||
|
|
||||||
QVector<QPixmap> fade_bars_;
|
QVector<QPixmap> fade_bars_;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ void BoomAnalyzer::resizeEvent(QResizeEvent *e) {
|
|||||||
|
|
||||||
QWidget::resizeEvent(e);
|
QWidget::resizeEvent(e);
|
||||||
|
|
||||||
const uint HEIGHT = height() - 2;
|
const int HEIGHT = height() - 2;
|
||||||
const double h = 1.2 / HEIGHT;
|
const double h = 1.2 / HEIGHT;
|
||||||
|
|
||||||
bands_ = qMin(static_cast<int>(static_cast<double>(width() + 1) / (kColumnWidth + 1)) + 1, kMaxBandCount);
|
bands_ = qMin(static_cast<int>(static_cast<double>(width() + 1) / (kColumnWidth + 1)) + 1, kMaxBandCount);
|
||||||
@@ -88,7 +88,7 @@ void BoomAnalyzer::resizeEvent(QResizeEvent *e) {
|
|||||||
canvas_.fill(palette().color(QPalette::Window));
|
canvas_.fill(palette().color(QPalette::Window));
|
||||||
|
|
||||||
QPainter p(&barPixmap_);
|
QPainter p(&barPixmap_);
|
||||||
for (uint y = 0; y < HEIGHT; ++y) {
|
for (int y = 0; y < HEIGHT; ++y) {
|
||||||
const double F = static_cast<double>(y) * h;
|
const double F = static_cast<double>(y) * h;
|
||||||
|
|
||||||
p.setPen(QColor(qMax(0, 255 - static_cast<int>(229.0 * F)),
|
p.setPen(QColor(qMax(0, 255 - static_cast<int>(229.0 * F)),
|
||||||
@@ -102,7 +102,7 @@ void BoomAnalyzer::resizeEvent(QResizeEvent *e) {
|
|||||||
void BoomAnalyzer::transform(Scope &s) {
|
void BoomAnalyzer::transform(Scope &s) {
|
||||||
|
|
||||||
fht_->spectrum(s.data());
|
fht_->spectrum(s.data());
|
||||||
fht_->scale(s.data(), 1.0 / 50);
|
fht_->scale(s.data(), 1.0F / 50);
|
||||||
|
|
||||||
s.resize(scope_.size() <= static_cast<quint64>(kMaxBandCount) / 2 ? kMaxBandCount / 2 : scope_.size());
|
s.resize(scope_.size() <= static_cast<quint64>(kMaxBandCount) / 2 ? kMaxBandCount / 2 : scope_.size());
|
||||||
|
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ void FHT::makeCasTable(void) {
|
|||||||
float *sintab = tab_() + num_ / 2 + 1;
|
float *sintab = tab_() + num_ / 2 + 1;
|
||||||
|
|
||||||
for (int ul = 0; ul < num_; ul++) {
|
for (int ul = 0; ul < num_; ul++) {
|
||||||
float d = M_PI * ul / (num_ / 2); // NOLINT(bugprone-integer-division)
|
double d = M_PI * static_cast<double>(ul) / (static_cast<double>(num_) / 2.0);
|
||||||
*costab = *sintab = cos(d);
|
*costab = *sintab = static_cast<float>(cos(d));
|
||||||
|
|
||||||
costab += 2;
|
costab += 2;
|
||||||
sintab += 2;
|
sintab += 2;
|
||||||
@@ -73,25 +73,25 @@ void FHT::ewma(float *d, float *s, float w) const {
|
|||||||
|
|
||||||
void FHT::logSpectrum(float *out, float *p) {
|
void FHT::logSpectrum(float *out, float *p) {
|
||||||
|
|
||||||
int n = num_ / 2, i = 0, j = 0, k = 0, *r = nullptr;
|
int n = num_ / 2, i = 0, k = 0, *r = nullptr;
|
||||||
if (log_vector_.size() < n) {
|
if (log_vector_.size() < n) {
|
||||||
log_vector_.resize(n);
|
log_vector_.resize(n);
|
||||||
float f = n / log10(static_cast<double>(n));
|
float f = static_cast<float>(n) / static_cast<float>(log10(static_cast<double>(n)));
|
||||||
for (i = 0, r = log_(); i < n; i++, r++) {
|
for (i = 0, r = log_(); i < n; i++, r++) {
|
||||||
j = static_cast<int>(rint(log10(i + 1.0) * f));
|
int j = static_cast<int>(rint(log10(i + 1.0) * f));
|
||||||
*r = j >= n ? n - 1 : j;
|
*r = j >= n ? n - 1 : j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
semiLogSpectrum(p);
|
semiLogSpectrum(p);
|
||||||
*out++ = *p = *p / 100;
|
*out++ = *p = *p / 100;
|
||||||
for (k = i = 1, r = log_(); i < n; i++) {
|
for (k = i = 1, r = log_(); i < n; i++) {
|
||||||
j = *r++;
|
int j = *r++;
|
||||||
if (i == j) {
|
if (i == j) {
|
||||||
*out++ = p[i];
|
*out++ = p[i];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float base = p[k - 1];
|
float base = p[k - 1];
|
||||||
float step = (p[j] - base) / (j - (k - 1));
|
float step = (p[j] - base) / static_cast<float>(j - (k - 1));
|
||||||
for (float corr = 0; k <= j; k++, corr += step) *out++ = base + corr;
|
for (float corr = 0; k <= j; k++, corr += step) *out++ = base + corr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ void FHT::semiLogSpectrum(float *p) {
|
|||||||
|
|
||||||
power2(p);
|
power2(p);
|
||||||
for (int i = 0; i < (num_ / 2); i++, p++) {
|
for (int i = 0; i < (num_ / 2); i++, p++) {
|
||||||
float e = 10.0 * log10(sqrt(*p / 2));
|
float e = 10.0F * static_cast<float>(log10(sqrt(*p / static_cast<float>(2))));
|
||||||
*p = e < 0 ? 0 : e;
|
*p = e < 0 ? 0 : e;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,8 +158,8 @@ void FHT::transform8(float *p) {
|
|||||||
|
|
||||||
a = *p++, b = *p++, c = *p++, d = *p++;
|
a = *p++, b = *p++, c = *p++, d = *p++;
|
||||||
e = *p++, f = *p++, g = *p++, h = *p;
|
e = *p++, f = *p++, g = *p++, h = *p;
|
||||||
b_f2 = (b - f) * M_SQRT2;
|
b_f2 = (b - f) * static_cast<float>(M_SQRT2);
|
||||||
d_h2 = (d - h) * M_SQRT2;
|
d_h2 = (d - h) * static_cast<float>(M_SQRT2);
|
||||||
|
|
||||||
a_c_eg = a - c - e + g;
|
a_c_eg = a - c - e + g;
|
||||||
a_ce_g = a - c + e - g;
|
a_ce_g = a - c + e - g;
|
||||||
|
|||||||
@@ -43,12 +43,12 @@
|
|||||||
|
|
||||||
using Analyzer::Scope;
|
using Analyzer::Scope;
|
||||||
|
|
||||||
const int Rainbow::RainbowAnalyzer::kHeight[] = {21, 33};
|
const int Rainbow::RainbowAnalyzer::kHeight[] = { 21, 33 };
|
||||||
const int Rainbow::RainbowAnalyzer::kWidth[] = {34, 53};
|
const int Rainbow::RainbowAnalyzer::kWidth[] = { 34, 53 };
|
||||||
const int Rainbow::RainbowAnalyzer::kFrameCount[] = {6, 16};
|
const int Rainbow::RainbowAnalyzer::kFrameCount[] = { 6, 16 };
|
||||||
const int Rainbow::RainbowAnalyzer::kRainbowHeight[] = {21, 16};
|
const int Rainbow::RainbowAnalyzer::kRainbowHeight[] = { 21, 16 };
|
||||||
const int Rainbow::RainbowAnalyzer::kRainbowOverlap[] = {13, 15};
|
const int Rainbow::RainbowAnalyzer::kRainbowOverlap[] = { 13, 15 };
|
||||||
const int Rainbow::RainbowAnalyzer::kSleepingHeight[] = {24, 33};
|
const int Rainbow::RainbowAnalyzer::kSleepingHeight[] = { 24, 33 };
|
||||||
|
|
||||||
const char *Rainbow::NyanCatAnalyzer::kName = "Nyanalyzer Cat";
|
const char *Rainbow::NyanCatAnalyzer::kName = "Nyanalyzer Cat";
|
||||||
const char *Rainbow::RainbowDashAnalyzer::kName = "Rainbow Dash";
|
const char *Rainbow::RainbowDashAnalyzer::kName = "Rainbow Dash";
|
||||||
@@ -76,7 +76,7 @@ Rainbow::RainbowAnalyzer::RainbowAnalyzer(const RainbowType rbtype, QWidget *par
|
|||||||
|
|
||||||
// pow constants computed so that
|
// pow constants computed so that
|
||||||
// | band_scale(0) | ~= .5 and | band_scale(5) | ~= 32
|
// | band_scale(0) | ~= .5 and | band_scale(5) | ~= 32
|
||||||
band_scale_[i] = -std::cos(M_PI * i / (kRainbowBands - 1)) * 0.5 * std::pow(2.3, i);
|
band_scale_[i] = -static_cast<float>(std::cos(M_PI * i / (kRainbowBands - 1))) * 0.5F * static_cast<float>(std::pow(2.3, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@ void Rainbow::RainbowAnalyzer::resizeEvent(QResizeEvent *e) {
|
|||||||
buffer_[1] = QPixmap();
|
buffer_[1] = QPixmap();
|
||||||
|
|
||||||
available_rainbow_width_ = width() - kWidth[rainbowtype] + kRainbowOverlap[rainbowtype];
|
available_rainbow_width_ = width() - kWidth[rainbowtype] + kRainbowOverlap[rainbowtype];
|
||||||
px_per_frame_ = static_cast<float>(available_rainbow_width_) / (kHistorySize - 1) + 1;
|
px_per_frame_ = available_rainbow_width_ / (kHistorySize - 1) + 1;
|
||||||
x_offset_ = px_per_frame_ * (kHistorySize - 1) - available_rainbow_width_;
|
x_offset_ = px_per_frame_ * (kHistorySize - 1) - available_rainbow_width_;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ void Rainbow::RainbowAnalyzer::analyze(QPainter &p, const Analyzer::Scope &s, bo
|
|||||||
const float top_of = static_cast<float>(height()) / 2 - static_cast<float>(kRainbowHeight[rainbowtype]) / 2;
|
const float top_of = static_cast<float>(height()) / 2 - static_cast<float>(kRainbowHeight[rainbowtype]) / 2;
|
||||||
for (int band = 0; band < kRainbowBands; ++band) {
|
for (int band = 0; band < kRainbowBands; ++band) {
|
||||||
// Calculate the Y position of this band.
|
// Calculate the Y position of this band.
|
||||||
const float y = static_cast<float>(kRainbowHeight[rainbowtype]) / (kRainbowBands + 1) * (band + 0.5) + top_of;
|
const float y = static_cast<float>(kRainbowHeight[rainbowtype]) / static_cast<float>(kRainbowBands + 1) * (static_cast<float>(band) + 0.5F) + top_of;
|
||||||
|
|
||||||
// Add each point in the line.
|
// Add each point in the line.
|
||||||
for (int x = 0; x < kHistorySize; ++x) {
|
for (int x = 0; x < kHistorySize; ++x) {
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class RainbowAnalyzer : public Analyzer::Base {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// "constants" that get initialized in the constructor
|
// "constants" that get initialized in the constructor
|
||||||
float band_scale_[kRainbowBands]{};
|
float band_scale_[kRainbowBands] {};
|
||||||
QPen colors_[kRainbowBands];
|
QPen colors_[kRainbowBands];
|
||||||
|
|
||||||
// Rainbow Nyancat & Dash
|
// Rainbow Nyancat & Dash
|
||||||
@@ -104,7 +104,7 @@ class RainbowAnalyzer : public Analyzer::Base {
|
|||||||
int frame_;
|
int frame_;
|
||||||
|
|
||||||
// The y positions of each point on the rainbow.
|
// The y positions of each point on the rainbow.
|
||||||
float history_[kHistorySize * kRainbowBands]{};
|
float history_[kHistorySize * kRainbowBands] {};
|
||||||
|
|
||||||
// A cache of the last frame's rainbow,
|
// A cache of the last frame's rainbow,
|
||||||
// so it can be used in the next frame.
|
// so it can be used in the next frame.
|
||||||
@@ -142,6 +142,6 @@ class RainbowDashAnalyzer : public RainbowAnalyzer {
|
|||||||
|
|
||||||
static const char *kName;
|
static const char *kName;
|
||||||
};
|
};
|
||||||
}
|
} // namespace Rainbow
|
||||||
|
|
||||||
#endif // RAINBOWANALYZER_H
|
#endif // RAINBOWANALYZER_H
|
||||||
|
|||||||
@@ -25,9 +25,12 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QtConcurrentRun>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
|
#include "core/taskmanager.h"
|
||||||
#include "core/database.h"
|
#include "core/database.h"
|
||||||
#include "core/player.h"
|
#include "core/player.h"
|
||||||
#include "core/tagreaderclient.h"
|
#include "core/tagreaderclient.h"
|
||||||
@@ -41,6 +44,7 @@
|
|||||||
#include "collectionmodel.h"
|
#include "collectionmodel.h"
|
||||||
#include "playlist/playlistmanager.h"
|
#include "playlist/playlistmanager.h"
|
||||||
#include "scrobbler/lastfmimport.h"
|
#include "scrobbler/lastfmimport.h"
|
||||||
|
#include "settings/collectionsettingspage.h"
|
||||||
|
|
||||||
const char *SCollection::kSongsTable = "songs";
|
const char *SCollection::kSongsTable = "songs";
|
||||||
const char *SCollection::kFtsTable = "songs_fts";
|
const char *SCollection::kFtsTable = "songs_fts";
|
||||||
@@ -54,7 +58,11 @@ SCollection::SCollection(Application *app, QObject *parent)
|
|||||||
model_(nullptr),
|
model_(nullptr),
|
||||||
watcher_(nullptr),
|
watcher_(nullptr),
|
||||||
watcher_thread_(nullptr),
|
watcher_thread_(nullptr),
|
||||||
original_thread_(nullptr) {
|
original_thread_(nullptr),
|
||||||
|
io_priority_(Utilities::IoPriority::IOPRIO_CLASS_IDLE),
|
||||||
|
thread_priority_(QThread::Priority::IdlePriority),
|
||||||
|
save_playcounts_to_files_(false),
|
||||||
|
save_ratings_to_files_(false) {
|
||||||
|
|
||||||
original_thread_ = thread();
|
original_thread_ = thread();
|
||||||
|
|
||||||
@@ -88,11 +96,18 @@ void SCollection::Init() {
|
|||||||
|
|
||||||
watcher_ = new CollectionWatcher(Song::Source_Collection);
|
watcher_ = new CollectionWatcher(Song::Source_Collection);
|
||||||
watcher_thread_ = new Thread(this);
|
watcher_thread_ = new Thread(this);
|
||||||
watcher_thread_->SetIoPriority(Utilities::IOPRIO_CLASS_IDLE);
|
|
||||||
|
#ifndef Q_OS_WIN32
|
||||||
|
if (io_priority_ != Utilities::IoPriority::IOPRIO_CLASS_NONE) {
|
||||||
|
watcher_thread_->SetIoPriority(io_priority_);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
watcher_->moveToThread(watcher_thread_);
|
watcher_->moveToThread(watcher_thread_);
|
||||||
watcher_thread_->start(QThread::IdlePriority);
|
|
||||||
qLog(Debug) << watcher_ << "moved to thread" << watcher_thread_;
|
qLog(Debug) << watcher_ << "moved to thread" << watcher_thread_ << "with I/O priority" << io_priority_ << "and thread priority" << thread_priority_;
|
||||||
|
|
||||||
|
watcher_thread_->start(thread_priority_);
|
||||||
|
|
||||||
watcher_->set_backend(backend_);
|
watcher_->set_backend(backend_);
|
||||||
watcher_->set_task_manager(app_->task_manager());
|
watcher_->set_task_manager(app_->task_manager());
|
||||||
@@ -100,6 +115,9 @@ void SCollection::Init() {
|
|||||||
QObject::connect(backend_, &CollectionBackend::Error, this, &SCollection::Error);
|
QObject::connect(backend_, &CollectionBackend::Error, this, &SCollection::Error);
|
||||||
QObject::connect(backend_, &CollectionBackend::DirectoryDiscovered, watcher_, &CollectionWatcher::AddDirectory);
|
QObject::connect(backend_, &CollectionBackend::DirectoryDiscovered, watcher_, &CollectionWatcher::AddDirectory);
|
||||||
QObject::connect(backend_, &CollectionBackend::DirectoryDeleted, watcher_, &CollectionWatcher::RemoveDirectory);
|
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::NewOrUpdatedSongs, backend_, &CollectionBackend::AddOrUpdateSongs);
|
||||||
QObject::connect(watcher_, &CollectionWatcher::SongsMTimeUpdated, backend_, &CollectionBackend::UpdateMTimesOnly);
|
QObject::connect(watcher_, &CollectionWatcher::SongsMTimeUpdated, backend_, &CollectionBackend::UpdateMTimesOnly);
|
||||||
QObject::connect(watcher_, &CollectionWatcher::SongsDeleted, backend_, &CollectionBackend::DeleteSongs);
|
QObject::connect(watcher_, &CollectionWatcher::SongsDeleted, backend_, &CollectionBackend::DeleteSongs);
|
||||||
@@ -128,6 +146,7 @@ void SCollection::Exit() {
|
|||||||
QObject::connect(backend_, &CollectionBackend::ExitFinished, this, &SCollection::ExitReceived);
|
QObject::connect(backend_, &CollectionBackend::ExitFinished, this, &SCollection::ExitReceived);
|
||||||
QObject::connect(watcher_, &CollectionWatcher::ExitFinished, this, &SCollection::ExitReceived);
|
QObject::connect(watcher_, &CollectionWatcher::ExitFinished, this, &SCollection::ExitReceived);
|
||||||
backend_->ExitAsync();
|
backend_->ExitAsync();
|
||||||
|
watcher_->Abort();
|
||||||
watcher_->ExitAsync();
|
watcher_->ExitAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -164,4 +183,55 @@ void SCollection::ReloadSettings() {
|
|||||||
watcher_->ReloadSettingsAsync();
|
watcher_->ReloadSettingsAsync();
|
||||||
model_->ReloadSettings();
|
model_->ReloadSettings();
|
||||||
|
|
||||||
|
QSettings s;
|
||||||
|
s.beginGroup(CollectionSettingsPage::kSettingsGroup);
|
||||||
|
io_priority_ = static_cast<Utilities::IoPriority>(s.value("io_priority", Utilities::IOPRIO_CLASS_IDLE).toInt());
|
||||||
|
thread_priority_ = static_cast<QThread::Priority>(s.value("thread_priority", QThread::Priority::IdlePriority).toInt());
|
||||||
|
save_playcounts_to_files_ = s.value("save_playcounts", false).toBool();
|
||||||
|
save_ratings_to_files_ = s.value("save_ratings", false).toBool();
|
||||||
|
s.endGroup();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SCollection::SyncPlaycountAndRatingToFilesAsync() {
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
(void)QtConcurrent::run(&SCollection::SyncPlaycountAndRatingToFiles, this);
|
||||||
|
#else
|
||||||
|
(void)QtConcurrent::run(this, &SCollection::SyncPlaycountAndRatingToFiles);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SCollection::SyncPlaycountAndRatingToFiles() {
|
||||||
|
|
||||||
|
const int task_id = app_->task_manager()->StartTask(tr("Saving playcounts and ratings"));
|
||||||
|
app_->task_manager()->SetTaskBlocksCollectionScans(task_id);
|
||||||
|
|
||||||
|
const SongList songs = backend_->GetAllSongs();
|
||||||
|
const qint64 nb_songs = songs.size();
|
||||||
|
int i = 0;
|
||||||
|
for (const Song &song : songs) {
|
||||||
|
TagReaderClient::Instance()->UpdateSongPlaycountBlocking(song);
|
||||||
|
TagReaderClient::Instance()->UpdateSongRatingBlocking(song);
|
||||||
|
app_->task_manager()->SetTaskProgress(task_id, ++i, nb_songs);
|
||||||
|
}
|
||||||
|
app_->task_manager()->SetTaskFinished(task_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SCollection::SongsPlaycountChanged(const SongList &songs) {
|
||||||
|
|
||||||
|
if (save_playcounts_to_files_) {
|
||||||
|
app_->tag_reader_client()->UpdateSongsPlaycount(songs);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void SCollection::SongsRatingChanged(const SongList &songs, const bool save_tags) {
|
||||||
|
|
||||||
|
if (save_tags || save_ratings_to_files_) {
|
||||||
|
app_->tag_reader_client()->UpdateSongsRating(songs);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,10 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
#include "core/song.h"
|
#include "core/song.h"
|
||||||
|
#include "core/utilities.h"
|
||||||
class QThread;
|
|
||||||
|
|
||||||
class Application;
|
class Application;
|
||||||
class Thread;
|
class Thread;
|
||||||
@@ -59,9 +59,10 @@ class SCollection : public QObject {
|
|||||||
|
|
||||||
QString full_rescan_reason(int schema_version) const { return full_rescan_revisions_.value(schema_version, QString()); }
|
QString full_rescan_reason(int schema_version) const { return full_rescan_revisions_.value(schema_version, QString()); }
|
||||||
|
|
||||||
int Total_Albums = 0;
|
void SyncPlaycountAndRatingToFilesAsync();
|
||||||
int total_songs_ = 0;
|
|
||||||
int Total_Artists = 0;
|
private:
|
||||||
|
void SyncPlaycountAndRatingToFiles();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ReloadSettings();
|
void ReloadSettings();
|
||||||
@@ -77,6 +78,8 @@ class SCollection : public QObject {
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void ExitReceived();
|
void ExitReceived();
|
||||||
|
void SongsPlaycountChanged(const SongList &songs);
|
||||||
|
void SongsRatingChanged(const SongList &songs, const bool save_tags = false);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Error(QString);
|
void Error(QString);
|
||||||
@@ -95,6 +98,11 @@ class SCollection : public QObject {
|
|||||||
QHash<int, QString> full_rescan_revisions_;
|
QHash<int, QString> full_rescan_revisions_;
|
||||||
|
|
||||||
QList<QObject*> wait_for_exit_;
|
QList<QObject*> wait_for_exit_;
|
||||||
|
|
||||||
|
Utilities::IoPriority io_priority_;
|
||||||
|
QThread::Priority thread_priority_;
|
||||||
|
bool save_playcounts_to_files_;
|
||||||
|
bool save_ratings_to_files_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ void CollectionBackend::ChangeDirPath(const int id, const QString &old_path, con
|
|||||||
const QByteArray old_url = QUrl::fromLocalFile(old_path).toEncoded();
|
const QByteArray old_url = QUrl::fromLocalFile(old_path).toEncoded();
|
||||||
const QByteArray new_url = QUrl::fromLocalFile(new_path).toEncoded();
|
const QByteArray new_url = QUrl::fromLocalFile(new_path).toEncoded();
|
||||||
|
|
||||||
const int path_len = old_url.length();
|
const qint64 path_len = old_url.length();
|
||||||
|
|
||||||
// Do the subdirs table
|
// Do the subdirs table
|
||||||
{
|
{
|
||||||
@@ -335,8 +335,8 @@ void CollectionBackend::AddDirectory(const QString &path) {
|
|||||||
q.prepare(QString("INSERT INTO %1 (path, subdirs) VALUES (:path, 1)").arg(dirs_table_));
|
q.prepare(QString("INSERT INTO %1 (path, subdirs) VALUES (:path, 1)").arg(dirs_table_));
|
||||||
q.BindValue(":path", db_path);
|
q.BindValue(":path", db_path);
|
||||||
if (!q.Exec()) {
|
if (!q.Exec()) {
|
||||||
db_->ReportErrors(q);
|
db_->ReportErrors(q);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Directory dir;
|
Directory dir;
|
||||||
@@ -509,6 +509,28 @@ void CollectionBackend::AddOrUpdateSubdirs(const SubdirectoryList &subdirs) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SongList CollectionBackend::GetAllSongs() {
|
||||||
|
|
||||||
|
QMutexLocker l(db_->Mutex());
|
||||||
|
QSqlDatabase db(db_->Connect());
|
||||||
|
|
||||||
|
SqlQuery q(db);
|
||||||
|
q.prepare(QString("SELECT ROWID, " + Song::kColumnSpec + " FROM %1").arg(songs_table_));
|
||||||
|
if (!q.Exec()) {
|
||||||
|
db_->ReportErrors(q);
|
||||||
|
return SongList();
|
||||||
|
}
|
||||||
|
|
||||||
|
SongList songs;
|
||||||
|
while (q.next()) {
|
||||||
|
Song song;
|
||||||
|
song.InitFromQuery(q, true);
|
||||||
|
songs << song;
|
||||||
|
}
|
||||||
|
return songs;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void CollectionBackend::AddOrUpdateSongsAsync(const SongList &songs) {
|
void CollectionBackend::AddOrUpdateSongsAsync(const SongList &songs) {
|
||||||
QMetaObject::invokeMethod(this, "AddOrUpdateSongs", Qt::QueuedConnection, Q_ARG(SongList, songs));
|
QMetaObject::invokeMethod(this, "AddOrUpdateSongs", Qt::QueuedConnection, Q_ARG(SongList, songs));
|
||||||
}
|
}
|
||||||
@@ -612,15 +634,13 @@ void CollectionBackend::AddOrUpdateSongs(const SongList &songs) {
|
|||||||
added_songs << new_song;
|
added_songs << new_song;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create new song
|
// Create new song
|
||||||
|
|
||||||
int id = -1;
|
int id = -1;
|
||||||
{ // Insert the row and create a new ID
|
{ // Insert the row and create a new ID
|
||||||
SqlQuery q(db);
|
SqlQuery q(db);
|
||||||
q.prepare(QString("INSERT INTO %1 (" + Song::kColumnSpec + ") VALUES (" + Song::kBindSpec + ")").arg(songs_table_));
|
q.prepare(QString("INSERT INTO %1 (" + Song::kColumnSpec + ") VALUES (" + Song::kBindSpec + ")").arg(songs_table_));
|
||||||
song.BindToQuery(&q);
|
song.BindToQuery(&q);
|
||||||
@@ -634,7 +654,7 @@ void CollectionBackend::AddOrUpdateSongs(const SongList &songs) {
|
|||||||
|
|
||||||
if (id == -1) return;
|
if (id == -1) return;
|
||||||
|
|
||||||
{ // Add to the FTS index
|
{ // Add to the FTS index
|
||||||
SqlQuery q(db);
|
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, " + Song::kFtsColumnSpec + ") VALUES (:id, " + Song::kFtsBindSpec + ")").arg(fts_table_));
|
||||||
q.BindValue(":id", id);
|
q.BindValue(":id", id);
|
||||||
@@ -687,7 +707,8 @@ void CollectionBackend::UpdateSongsBySongID(const SongMap &new_songs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add or update songs.
|
// Add or update songs.
|
||||||
for (const Song &new_song : new_songs) {
|
QList new_songs_list = new_songs.values();
|
||||||
|
for (const Song &new_song : new_songs_list) {
|
||||||
if (old_songs.contains(new_song.song_id())) {
|
if (old_songs.contains(new_song.song_id())) {
|
||||||
|
|
||||||
Song old_song = old_songs[new_song.song_id()];
|
Song old_song = old_songs[new_song.song_id()];
|
||||||
@@ -757,7 +778,8 @@ void CollectionBackend::UpdateSongsBySongID(const SongMap &new_songs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete songs
|
// Delete songs
|
||||||
for (const Song &old_song : old_songs) {
|
QList old_songs_list = old_songs.values();
|
||||||
|
for (const Song &old_song : old_songs_list) {
|
||||||
if (!new_songs.contains(old_song.song_id())) {
|
if (!new_songs.contains(old_song.song_id())) {
|
||||||
{
|
{
|
||||||
SqlQuery q(db);
|
SqlQuery q(db);
|
||||||
@@ -1087,7 +1109,7 @@ SongList CollectionBackend::GetSongsByForeignId(const QStringList &ids, const QS
|
|||||||
QVector<Song> ret(ids.count());
|
QVector<Song> ret(ids.count());
|
||||||
while (q.next()) {
|
while (q.next()) {
|
||||||
const QString foreign_id = q.value(static_cast<int>(Song::kColumns.count()) + 1).toString();
|
const QString foreign_id = q.value(static_cast<int>(Song::kColumns.count()) + 1).toString();
|
||||||
const int index = ids.indexOf(foreign_id);
|
const qint64 index = ids.indexOf(foreign_id);
|
||||||
if (index == -1) continue;
|
if (index == -1) continue;
|
||||||
|
|
||||||
ret[index].InitFromQuery(q, true);
|
ret[index].InitFromQuery(q, true);
|
||||||
@@ -1321,7 +1343,7 @@ void CollectionBackend::CompilationsNeedUpdating() {
|
|||||||
if (album.isEmpty()) continue;
|
if (album.isEmpty()) continue;
|
||||||
|
|
||||||
// Find the directory the song is in
|
// Find the directory the song is in
|
||||||
QString directory = url.toString(QUrl::PreferLocalFile|QUrl::RemoveFilename);
|
QString directory = url.toString(QUrl::PreferLocalFile | QUrl::RemoveFilename);
|
||||||
|
|
||||||
CompilationInfo &info = compilation_info[directory + album];
|
CompilationInfo &info = compilation_info[directory + album];
|
||||||
info.urls << url;
|
info.urls << url;
|
||||||
@@ -1550,7 +1572,7 @@ void CollectionBackend::UpdateManualAlbumArt(const QString &effective_albumartis
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the songs
|
// Update the songs
|
||||||
QString sql(QString("UPDATE %1 SET art_manual = :cover").arg(songs_table_));
|
QString sql = QString("UPDATE %1 SET art_manual = :cover").arg(songs_table_);
|
||||||
if (clear_art_automatic) {
|
if (clear_art_automatic) {
|
||||||
sql += ", art_automatic = ''";
|
sql += ", art_automatic = ''";
|
||||||
}
|
}
|
||||||
@@ -1587,13 +1609,13 @@ void CollectionBackend::UpdateManualAlbumArt(const QString &effective_albumartis
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionBackend::UpdateAutomaticAlbumArtAsync(const QString &effective_albumartist, const QString &album, const QUrl &cover_url) {
|
void CollectionBackend::UpdateAutomaticAlbumArtAsync(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_manual) {
|
||||||
|
|
||||||
QMetaObject::invokeMethod(this, "UpdateAutomaticAlbumArt", Qt::QueuedConnection, Q_ARG(QString, effective_albumartist), Q_ARG(QString, album), Q_ARG(QUrl, cover_url));
|
QMetaObject::invokeMethod(this, "UpdateAutomaticAlbumArt", Qt::QueuedConnection, Q_ARG(QString, effective_albumartist), Q_ARG(QString, album), Q_ARG(QUrl, cover_url), Q_ARG(bool, clear_art_manual));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionBackend::UpdateAutomaticAlbumArt(const QString &effective_albumartist, const QString &album, const QUrl &cover_url) {
|
void CollectionBackend::UpdateAutomaticAlbumArt(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_manual) {
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
@@ -1617,7 +1639,11 @@ void CollectionBackend::UpdateAutomaticAlbumArt(const QString &effective_albumar
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the songs
|
// Update the songs
|
||||||
QString sql(QString("UPDATE %1 SET art_automatic = :cover WHERE effective_albumartist = :effective_albumartist AND album = :album AND unavailable = 0").arg(songs_table_));
|
QString sql = QString("UPDATE %1 SET art_automatic = :cover").arg(songs_table_);
|
||||||
|
if (clear_art_manual) {
|
||||||
|
sql += ", art_manual = ''";
|
||||||
|
}
|
||||||
|
sql += " WHERE effective_albumartist = :effective_albumartist AND album = :album AND unavailable = 0";
|
||||||
|
|
||||||
SqlQuery q(db);
|
SqlQuery q(db);
|
||||||
q.prepare(sql);
|
q.prepare(sql);
|
||||||
@@ -1773,6 +1799,12 @@ void CollectionBackend::ResetStatistics(const int id) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CollectionBackend::DeleteAllAsync() {
|
||||||
|
|
||||||
|
QMetaObject::invokeMethod(this, "DeleteAll", Qt::QueuedConnection);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void CollectionBackend::DeleteAll() {
|
void CollectionBackend::DeleteAll() {
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -1924,17 +1956,15 @@ void CollectionBackend::UpdatePlayCount(const QString &artist, const QString &ti
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionBackend::UpdateSongRating(const int id, const double rating) {
|
void CollectionBackend::UpdateSongRating(const int id, const float rating, const bool save_tags) {
|
||||||
|
|
||||||
if (id == -1) return;
|
if (id == -1) return;
|
||||||
|
|
||||||
QList<int> id_list;
|
UpdateSongsRating(QList<int>() << id, rating, save_tags);
|
||||||
id_list << id;
|
|
||||||
UpdateSongsRating(id_list, rating);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionBackend::UpdateSongsRating(const QList<int> &id_list, const double rating) {
|
void CollectionBackend::UpdateSongsRating(const QList<int> &id_list, const float rating, const bool save_tags) {
|
||||||
|
|
||||||
if (id_list.isEmpty()) return;
|
if (id_list.isEmpty()) return;
|
||||||
|
|
||||||
@@ -1957,16 +1987,16 @@ void CollectionBackend::UpdateSongsRating(const QList<int> &id_list, const doubl
|
|||||||
|
|
||||||
SongList new_song_list = GetSongsById(id_str_list, db);
|
SongList new_song_list = GetSongsById(id_str_list, db);
|
||||||
|
|
||||||
emit SongsRatingChanged(new_song_list);
|
emit SongsRatingChanged(new_song_list, save_tags);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionBackend::UpdateSongRatingAsync(const int id, const double rating) {
|
void CollectionBackend::UpdateSongRatingAsync(const int id, const float rating, const bool save_tags) {
|
||||||
QMetaObject::invokeMethod(this, "UpdateSongRating", Qt::QueuedConnection, Q_ARG(int, id), Q_ARG(double, rating));
|
QMetaObject::invokeMethod(this, "UpdateSongRating", Qt::QueuedConnection, Q_ARG(int, id), Q_ARG(float, rating), Q_ARG(bool, save_tags));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionBackend::UpdateSongsRatingAsync(const QList<int> &ids, const double rating) {
|
void CollectionBackend::UpdateSongsRatingAsync(const QList<int> &ids, const float rating, const bool save_tags) {
|
||||||
QMetaObject::invokeMethod(this, "UpdateSongsRating", Qt::QueuedConnection, Q_ARG(QList<int>, ids), Q_ARG(double, rating));
|
QMetaObject::invokeMethod(this, "UpdateSongsRating", Qt::QueuedConnection, Q_ARG(QList<int>, ids), Q_ARG(float, rating), Q_ARG(bool, save_tags));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionBackend::UpdateLastSeen(const int directory_id, const int expire_unavailable_songs_days) {
|
void CollectionBackend::UpdateLastSeen(const int directory_id, const int expire_unavailable_songs_days) {
|
||||||
@@ -2014,3 +2044,4 @@ void CollectionBackend::ExpireSongs(const int directory_id, const int expire_una
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ class CollectionBackendInterface : public QObject {
|
|||||||
virtual DirectoryList GetAllDirectories() = 0;
|
virtual DirectoryList GetAllDirectories() = 0;
|
||||||
virtual void ChangeDirPath(const int id, const QString &old_path, const QString &new_path) = 0;
|
virtual void ChangeDirPath(const int id, const QString &old_path, const QString &new_path) = 0;
|
||||||
|
|
||||||
|
virtual SongList GetAllSongs() = 0;
|
||||||
|
|
||||||
virtual QStringList GetAllArtists(const QueryOptions &opt = QueryOptions()) = 0;
|
virtual QStringList GetAllArtists(const QueryOptions &opt = QueryOptions()) = 0;
|
||||||
virtual QStringList GetAllArtistsWithAlbums(const QueryOptions &opt = QueryOptions()) = 0;
|
virtual QStringList GetAllArtistsWithAlbums(const QueryOptions &opt = QueryOptions()) = 0;
|
||||||
virtual SongList GetArtistSongs(const QString &effective_albumartist, const QueryOptions &opt = QueryOptions()) = 0;
|
virtual SongList GetArtistSongs(const QString &effective_albumartist, const QueryOptions &opt = QueryOptions()) = 0;
|
||||||
@@ -105,7 +107,7 @@ class CollectionBackendInterface : public QObject {
|
|||||||
virtual AlbumList GetCompilationAlbums(const QueryOptions &opt = QueryOptions()) = 0;
|
virtual AlbumList GetCompilationAlbums(const QueryOptions &opt = QueryOptions()) = 0;
|
||||||
|
|
||||||
virtual void UpdateManualAlbumArtAsync(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_automatic = false) = 0;
|
virtual void UpdateManualAlbumArtAsync(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_automatic = false) = 0;
|
||||||
virtual void UpdateAutomaticAlbumArtAsync(const QString &effective_albumartist, const QString &album, const QUrl &cover_url) = 0;
|
virtual void UpdateAutomaticAlbumArtAsync(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_manual = false) = 0;
|
||||||
|
|
||||||
virtual Album GetAlbumArt(const QString &effective_albumartist, const QString &album) = 0;
|
virtual Album GetAlbumArt(const QString &effective_albumartist, const QString &album) = 0;
|
||||||
|
|
||||||
@@ -157,6 +159,8 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
DirectoryList GetAllDirectories() override;
|
DirectoryList GetAllDirectories() override;
|
||||||
void ChangeDirPath(const int id, const QString &old_path, const QString &new_path) override;
|
void ChangeDirPath(const int id, const QString &old_path, const QString &new_path) override;
|
||||||
|
|
||||||
|
SongList GetAllSongs() override;
|
||||||
|
|
||||||
QStringList GetAll(const QString &column, const QueryOptions &opt = QueryOptions());
|
QStringList GetAll(const QString &column, const QueryOptions &opt = QueryOptions());
|
||||||
QStringList GetAllArtists(const QueryOptions &opt = QueryOptions()) override;
|
QStringList GetAllArtists(const QueryOptions &opt = QueryOptions()) override;
|
||||||
QStringList GetAllArtistsWithAlbums(const QueryOptions &opt = QueryOptions()) override;
|
QStringList GetAllArtistsWithAlbums(const QueryOptions &opt = QueryOptions()) override;
|
||||||
@@ -171,7 +175,7 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
AlbumList GetAlbumsByArtist(const QString &artist, const QueryOptions &opt = QueryOptions()) override;
|
AlbumList GetAlbumsByArtist(const QString &artist, const QueryOptions &opt = QueryOptions()) override;
|
||||||
|
|
||||||
void UpdateManualAlbumArtAsync(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_automatic = false) override;
|
void UpdateManualAlbumArtAsync(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_automatic = false) override;
|
||||||
void UpdateAutomaticAlbumArtAsync(const QString &effective_albumartist, const QString &album, const QUrl &cover_url) override;
|
void UpdateAutomaticAlbumArtAsync(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_manual = false) override;
|
||||||
|
|
||||||
Album GetAlbumArt(const QString &effective_albumartist, const QString &album) override;
|
Album GetAlbumArt(const QString &effective_albumartist, const QString &album) override;
|
||||||
|
|
||||||
@@ -193,7 +197,7 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
void IncrementSkipCountAsync(const int id, const float progress);
|
void IncrementSkipCountAsync(const int id, const float progress);
|
||||||
void ResetStatisticsAsync(const int id);
|
void ResetStatisticsAsync(const int id);
|
||||||
|
|
||||||
void DeleteAll();
|
void DeleteAllAsync();
|
||||||
|
|
||||||
Song GetSongBySongId(const QString &song_id);
|
Song GetSongBySongId(const QString &song_id);
|
||||||
SongList GetSongsBySongId(const QStringList &song_ids);
|
SongList GetSongsBySongId(const QStringList &song_ids);
|
||||||
@@ -208,8 +212,8 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
void AddOrUpdateSongsAsync(const SongList &songs);
|
void AddOrUpdateSongsAsync(const SongList &songs);
|
||||||
void UpdateSongsBySongIDAsync(const SongMap &new_songs);
|
void UpdateSongsBySongIDAsync(const SongMap &new_songs);
|
||||||
|
|
||||||
void UpdateSongRatingAsync(const int id, const double rating);
|
void UpdateSongRatingAsync(const int id, const float rating, const bool save_tags = false);
|
||||||
void UpdateSongsRatingAsync(const QList<int> &ids, const double rating);
|
void UpdateSongsRatingAsync(const QList<int> &ids, const float rating, const bool save_tags = false);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void Exit();
|
void Exit();
|
||||||
@@ -225,19 +229,20 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
void AddOrUpdateSubdirs(const SubdirectoryList &subdirs);
|
void AddOrUpdateSubdirs(const SubdirectoryList &subdirs);
|
||||||
void CompilationsNeedUpdating();
|
void CompilationsNeedUpdating();
|
||||||
void UpdateManualAlbumArt(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_automatic = false);
|
void UpdateManualAlbumArt(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_automatic = false);
|
||||||
void UpdateAutomaticAlbumArt(const QString &effective_albumartist, const QString &album, const QUrl &cover_url);
|
void UpdateAutomaticAlbumArt(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_manual = false);
|
||||||
void ForceCompilation(const QString &album, const QList<QString> &artists, const bool on);
|
void ForceCompilation(const QString &album, const QList<QString> &artists, const bool on);
|
||||||
void IncrementPlayCount(const int id);
|
void IncrementPlayCount(const int id);
|
||||||
void IncrementSkipCount(const int id, const float progress);
|
void IncrementSkipCount(const int id, const float progress);
|
||||||
void ResetStatistics(const int id);
|
void ResetStatistics(const int id);
|
||||||
|
void DeleteAll();
|
||||||
void SongPathChanged(const Song &song, const QFileInfo &new_file, const std::optional<int> new_collection_directory_id);
|
void SongPathChanged(const Song &song, const QFileInfo &new_file, const std::optional<int> new_collection_directory_id);
|
||||||
|
|
||||||
SongList GetSongsBy(const QString &artist, const QString &album, const QString &title);
|
SongList GetSongsBy(const QString &artist, const QString &album, const QString &title);
|
||||||
void UpdateLastPlayed(const QString &artist, const QString &album, const QString &title, const qint64 lastplayed);
|
void UpdateLastPlayed(const QString &artist, const QString &album, const QString &title, const qint64 lastplayed);
|
||||||
void UpdatePlayCount(const QString &artist, const QString &title, const int playcount);
|
void UpdatePlayCount(const QString &artist, const QString &title, const int playcount);
|
||||||
|
|
||||||
void UpdateSongRating(const int id, const double rating);
|
void UpdateSongRating(const int id, const float rating, const bool save_tags = false);
|
||||||
void UpdateSongsRating(const QList<int> &id_list, const double rating);
|
void UpdateSongsRating(const QList<int> &id_list, const float rating, const bool save_tags = false);
|
||||||
|
|
||||||
void UpdateLastSeen(const int directory_id, const int expire_unavailable_songs_days);
|
void UpdateLastSeen(const int directory_id, const int expire_unavailable_songs_days);
|
||||||
void ExpireSongs(const int directory_id, const int expire_unavailable_songs_days);
|
void ExpireSongs(const int directory_id, const int expire_unavailable_songs_days);
|
||||||
@@ -255,7 +260,7 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
void TotalSongCountUpdated(int);
|
void TotalSongCountUpdated(int);
|
||||||
void TotalArtistCountUpdated(int);
|
void TotalArtistCountUpdated(int);
|
||||||
void TotalAlbumCountUpdated(int);
|
void TotalAlbumCountUpdated(int);
|
||||||
void SongsRatingChanged(SongList);
|
void SongsRatingChanged(SongList, bool);
|
||||||
|
|
||||||
void ExitFinished();
|
void ExitFinished();
|
||||||
|
|
||||||
|
|||||||
@@ -68,24 +68,23 @@ CollectionFilterWidget::CollectionFilterWidget(QWidget *parent)
|
|||||||
QString available_fields = Song::kFtsColumns.join(", ").replace(QRegularExpression("\\bfts"), "");
|
QString available_fields = Song::kFtsColumns.join(", ").replace(QRegularExpression("\\bfts"), "");
|
||||||
|
|
||||||
ui_->search_field->setToolTip(
|
ui_->search_field->setToolTip(
|
||||||
QString("<html><head/><body><p>") +
|
QString("<html><head/><body><p>") +
|
||||||
tr("Prefix a word with a field name to limit the search to that field, e.g.:") +
|
tr("Prefix a word with a field name to limit the search to that field, e.g.:") +
|
||||||
QString(" ") +
|
QString(" ") +
|
||||||
QString("<span style=\"font-weight:600;\">") +
|
QString("<span style=\"font-weight:600;\">") +
|
||||||
tr("artist") +
|
tr("artist") +
|
||||||
QString(":") +
|
QString(":") +
|
||||||
QString("</span><span style=\"font-style:italic;\">Strawbs</span>") +
|
QString("</span><span style=\"font-style:italic;\">Strawbs</span>") +
|
||||||
QString(" ") +
|
QString(" ") +
|
||||||
tr("searches the collection for all artists that contain the word") +
|
tr("searches the collection for all artists that contain the word") +
|
||||||
QString(" Strawbs.") +
|
QString(" Strawbs.") +
|
||||||
QString("</p><p><span style=\"font-weight:600;\">") +
|
QString("</p><p><span style=\"font-weight:600;\">") +
|
||||||
tr("Available fields") +
|
tr("Available fields") +
|
||||||
QString(": ") +
|
QString(": ") +
|
||||||
"</span><span style=\"font-style:italic;\">" +
|
"</span><span style=\"font-style:italic;\">" +
|
||||||
available_fields +
|
available_fields +
|
||||||
QString("</span>.") +
|
QString("</span>.") +
|
||||||
QString("</p></body></html>")
|
QString("</p></body></html>"));
|
||||||
);
|
|
||||||
|
|
||||||
QObject::connect(ui_->search_field, &QSearchField::returnPressed, this, &CollectionFilterWidget::ReturnPressed);
|
QObject::connect(ui_->search_field, &QSearchField::returnPressed, this, &CollectionFilterWidget::ReturnPressed);
|
||||||
QObject::connect(filter_delay_, &QTimer::timeout, this, &CollectionFilterWidget::FilterDelayTimeout);
|
QObject::connect(filter_delay_, &QTimer::timeout, this, &CollectionFilterWidget::FilterDelayTimeout);
|
||||||
@@ -136,6 +135,7 @@ CollectionFilterWidget::CollectionFilterWidget(QWidget *parent)
|
|||||||
ui_->options->setMenu(collection_menu_);
|
ui_->options->setMenu(collection_menu_);
|
||||||
|
|
||||||
QObject::connect(ui_->search_field, &QSearchField::textChanged, this, &CollectionFilterWidget::FilterTextChanged);
|
QObject::connect(ui_->search_field, &QSearchField::textChanged, this, &CollectionFilterWidget::FilterTextChanged);
|
||||||
|
QObject::connect(ui_->options, &QToolButton::clicked, ui_->options, &QToolButton::showMenu);
|
||||||
|
|
||||||
ReloadSettings();
|
ReloadSettings();
|
||||||
|
|
||||||
@@ -176,16 +176,15 @@ void CollectionFilterWidget::Init(CollectionModel *model) {
|
|||||||
if (s.contains(group_by_version())) version = s.value(group_by_version(), 0).toInt();
|
if (s.contains(group_by_version())) version = s.value(group_by_version(), 0).toInt();
|
||||||
if (version == 1) {
|
if (version == 1) {
|
||||||
model_->SetGroupBy(CollectionModel::Grouping(
|
model_->SetGroupBy(CollectionModel::Grouping(
|
||||||
CollectionModel::GroupBy(s.value(group_by(1), static_cast<int>(CollectionModel::GroupBy_AlbumArtist)).toInt()),
|
CollectionModel::GroupBy(s.value(group_by(1), static_cast<int>(CollectionModel::GroupBy_AlbumArtist)).toInt()),
|
||||||
CollectionModel::GroupBy(s.value(group_by(2), static_cast<int>(CollectionModel::GroupBy_AlbumDisc)).toInt()),
|
CollectionModel::GroupBy(s.value(group_by(2), static_cast<int>(CollectionModel::GroupBy_AlbumDisc)).toInt()),
|
||||||
CollectionModel::GroupBy(s.value(group_by(3), static_cast<int>(CollectionModel::GroupBy_None)).toInt())));
|
CollectionModel::GroupBy(s.value(group_by(3), static_cast<int>(CollectionModel::GroupBy_None)).toInt())));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
model_->SetGroupBy(CollectionModel::Grouping(CollectionModel::GroupBy_AlbumArtist, CollectionModel::GroupBy_AlbumDisc, CollectionModel::GroupBy_None));
|
model_->SetGroupBy(CollectionModel::Grouping(CollectionModel::GroupBy_AlbumArtist, CollectionModel::GroupBy_AlbumDisc, CollectionModel::GroupBy_None));
|
||||||
}
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionFilterWidget::ReloadSettings() {
|
void CollectionFilterWidget::ReloadSettings() {
|
||||||
|
|||||||
@@ -45,7 +45,10 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="popupMode">
|
<property name="popupMode">
|
||||||
<enum>QToolButton::InstantPopup</enum>
|
<enum>QToolButton::MenuButtonPopup</enum>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ void CollectionItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
|
|||||||
// Draw the line under the item
|
// Draw the line under the item
|
||||||
QColor line_color = opt.palette.color(QPalette::Text);
|
QColor line_color = opt.palette.color(QPalette::Text);
|
||||||
QLinearGradient grad_color(opt.rect.bottomLeft(), opt.rect.bottomRight());
|
QLinearGradient grad_color(opt.rect.bottomLeft(), opt.rect.bottomRight());
|
||||||
const double fade_start_end = (opt.rect.width()/3.0)/opt.rect.width();
|
const double fade_start_end = (opt.rect.width() / 3.0) / opt.rect.width();
|
||||||
line_color.setAlphaF(0.0);
|
line_color.setAlphaF(0.0);
|
||||||
grad_color.setColorAt(0, line_color);
|
grad_color.setColorAt(0, line_color);
|
||||||
line_color.setAlphaF(0.5);
|
line_color.setAlphaF(0.5);
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ CollectionItem *CollectionModel::CreateCompilationArtistNode(const bool signal,
|
|||||||
|
|
||||||
Q_ASSERT(parent->compilation_artist_node_ == nullptr);
|
Q_ASSERT(parent->compilation_artist_node_ == nullptr);
|
||||||
|
|
||||||
if (signal) beginInsertRows(ItemToIndex(parent), parent->children.count(), parent->children.count());
|
if (signal) beginInsertRows(ItemToIndex(parent), static_cast<int>(parent->children.count()), static_cast<int>(parent->children.count()));
|
||||||
|
|
||||||
parent->compilation_artist_node_ = new CollectionItem(CollectionItem::Type_Container, parent);
|
parent->compilation_artist_node_ = new CollectionItem(CollectionItem::Type_Container, parent);
|
||||||
parent->compilation_artist_node_->compilation_artist_node_ = nullptr;
|
parent->compilation_artist_node_->compilation_artist_node_ = nullptr;
|
||||||
@@ -476,7 +476,7 @@ QString CollectionModel::DividerDisplayText(const GroupBy type, const QString &k
|
|||||||
case GroupBy_Genre:
|
case GroupBy_Genre:
|
||||||
case GroupBy_FileType:
|
case GroupBy_FileType:
|
||||||
case GroupBy_Format:
|
case GroupBy_Format:
|
||||||
if (key == "0") return "0-9";
|
if (key == "0") return "0-9";
|
||||||
return key.toUpper();
|
return key.toUpper();
|
||||||
|
|
||||||
case GroupBy_YearAlbum:
|
case GroupBy_YearAlbum:
|
||||||
@@ -808,7 +808,10 @@ QVariant CollectionModel::data(const CollectionItem *item, const int role) const
|
|||||||
|
|
||||||
case Role_SortText:
|
case Role_SortText:
|
||||||
return item->SortText();
|
return item->SortText();
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1176,7 +1179,7 @@ CollectionItem *CollectionModel::InitItem(const GroupBy type, const bool signal,
|
|||||||
|
|
||||||
CollectionItem::Type item_type = type == GroupBy_None ? CollectionItem::Type_Song : CollectionItem::Type_Container;
|
CollectionItem::Type item_type = type == GroupBy_None ? CollectionItem::Type_Song : CollectionItem::Type_Container;
|
||||||
|
|
||||||
if (signal) beginInsertRows(ItemToIndex(parent), parent->children.count(), parent->children.count());
|
if (signal) beginInsertRows(ItemToIndex(parent), static_cast<int>(parent->children.count()), static_cast<int>(parent->children.count()));
|
||||||
|
|
||||||
// Initialize the item depending on what type it's meant to be
|
// Initialize the item depending on what type it's meant to be
|
||||||
CollectionItem *item = new CollectionItem(item_type, parent);
|
CollectionItem *item = new CollectionItem(item_type, parent);
|
||||||
@@ -1597,7 +1600,7 @@ void CollectionModel::FinishItem(const GroupBy type, const bool signal, const bo
|
|||||||
|
|
||||||
if (!divider_key.isEmpty() && !divider_nodes_.contains(divider_key)) {
|
if (!divider_key.isEmpty() && !divider_nodes_.contains(divider_key)) {
|
||||||
if (signal) {
|
if (signal) {
|
||||||
beginInsertRows(ItemToIndex(parent), parent->children.count(), parent->children.count());
|
beginInsertRows(ItemToIndex(parent), static_cast<int>(parent->children.count()), static_cast<int>(parent->children.count()));
|
||||||
}
|
}
|
||||||
|
|
||||||
CollectionItem *divider = new CollectionItem(CollectionItem::Type_Divider, root_);
|
CollectionItem *divider = new CollectionItem(CollectionItem::Type_Divider, root_);
|
||||||
@@ -1676,7 +1679,7 @@ QString CollectionModel::SortTextForArtist(QString artist) {
|
|||||||
|
|
||||||
for (const auto &i : Song::kArticles) {
|
for (const auto &i : Song::kArticles) {
|
||||||
if (artist.startsWith(i)) {
|
if (artist.startsWith(i)) {
|
||||||
int ilen = i.length();
|
qint64 ilen = i.length();
|
||||||
artist = artist.right(artist.length() - ilen) + ", " + i.left(ilen - 1);
|
artist = artist.right(artist.length() - ilen) + ", " + i.left(ilen - 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1871,6 +1874,7 @@ const CollectionModel::GroupBy &CollectionModel::Grouping::operator[](const int
|
|||||||
case 0: return first;
|
case 0: return first;
|
||||||
case 1: return second;
|
case 1: return second;
|
||||||
case 2: return third;
|
case 2: return third;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
qLog(Error) << "CollectionModel::Grouping[] index out of range" << i;
|
qLog(Error) << "CollectionModel::Grouping[] index out of range" << i;
|
||||||
return first;
|
return first;
|
||||||
@@ -1883,6 +1887,7 @@ CollectionModel::GroupBy &CollectionModel::Grouping::operator[](const int i) {
|
|||||||
case 0: return first;
|
case 0: return first;
|
||||||
case 1: return second;
|
case 1: return second;
|
||||||
case 2: return third;
|
case 2: return third;
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
qLog(Error) << "CollectionModel::Grouping[] index out of range" << i;
|
qLog(Error) << "CollectionModel::Grouping[] index out of range" << i;
|
||||||
|
|
||||||
|
|||||||
@@ -155,11 +155,11 @@ void CollectionQuery::AddWhere(const QString &column, const QVariant &value, con
|
|||||||
}
|
}
|
||||||
else if (
|
else if (
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
value.metaType().id() == QMetaType::QString
|
value.metaType().id() == QMetaType::QString
|
||||||
#else
|
#else
|
||||||
value.type() == QVariant::String
|
value.type() == QVariant::String
|
||||||
#endif
|
#endif
|
||||||
&& value.toString().isNull()) {
|
&& value.toString().isNull()) {
|
||||||
where_clauses_ << QString("%1 %2 ?").arg(column, op);
|
where_clauses_ << QString("%1 %2 ?").arg(column, op);
|
||||||
bound_values_ << QString("");
|
bound_values_ << QString("");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,4 +125,4 @@ class CollectionQuery : public QSqlQuery {
|
|||||||
int limit_;
|
int limit_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COLLECTIONQUERY_H
|
#endif // COLLECTIONQUERY_H
|
||||||
|
|||||||
@@ -425,7 +425,7 @@ void CollectionView::contextMenuEvent(QContextMenuEvent *e) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
action_delete_files_->setVisible(regular_elements == regular_editable && delete_files_);
|
action_delete_files_->setVisible(delete_files_);
|
||||||
#else
|
#else
|
||||||
action_delete_files_->setVisible(false);
|
action_delete_files_->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
@@ -440,7 +440,7 @@ void CollectionView::contextMenuEvent(QContextMenuEvent *e) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
action_delete_files_->setEnabled(regular_elements == regular_editable && delete_files_);
|
action_delete_files_->setEnabled(delete_files_);
|
||||||
#else
|
#else
|
||||||
action_delete_files_->setEnabled(false);
|
action_delete_files_->setEnabled(false);
|
||||||
#endif
|
#endif
|
||||||
@@ -671,10 +671,17 @@ void CollectionView::Delete() {
|
|||||||
if (!delete_files_) return;
|
if (!delete_files_) return;
|
||||||
|
|
||||||
SongList selected_songs = GetSelectedSongs();
|
SongList selected_songs = GetSelectedSongs();
|
||||||
|
|
||||||
|
SongList songs;
|
||||||
QStringList files;
|
QStringList files;
|
||||||
|
songs.reserve(selected_songs.count());
|
||||||
files.reserve(selected_songs.count());
|
files.reserve(selected_songs.count());
|
||||||
for (const Song &song : selected_songs) {
|
for (const Song &song : selected_songs) {
|
||||||
files << song.url().toString();
|
QString filename = song.url().toLocalFile();
|
||||||
|
if (!files.contains(filename)) {
|
||||||
|
songs << song;
|
||||||
|
files << filename;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (DeleteConfirmationDialog::warning(files) != QDialogButtonBox::Yes) return;
|
if (DeleteConfirmationDialog::warning(files) != QDialogButtonBox::Yes) return;
|
||||||
|
|
||||||
@@ -683,7 +690,7 @@ void CollectionView::Delete() {
|
|||||||
|
|
||||||
DeleteFiles *delete_files = new DeleteFiles(app_->task_manager(), storage, true);
|
DeleteFiles *delete_files = new DeleteFiles(app_->task_manager(), storage, true);
|
||||||
QObject::connect(delete_files, &DeleteFiles::Finished, this, &CollectionView::DeleteFilesFinished);
|
QObject::connect(delete_files, &DeleteFiles::Finished, this, &CollectionView::DeleteFilesFinished);
|
||||||
delete_files->Start(selected_songs);
|
delete_files->Start(songs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,11 +68,6 @@
|
|||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
namespace {
|
|
||||||
static const char *kNoMediaFile = ".nomedia";
|
|
||||||
static const char *kNoMusicFile = ".nomusic";
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
QStringList CollectionWatcher::sValidImages = QStringList() << "jpg" << "png" << "gif" << "jpeg";
|
QStringList CollectionWatcher::sValidImages = QStringList() << "jpg" << "png" << "gif" << "jpeg";
|
||||||
|
|
||||||
CollectionWatcher::CollectionWatcher(Song::Source source, QObject *parent)
|
CollectionWatcher::CollectionWatcher(Song::Source source, QObject *parent)
|
||||||
@@ -84,10 +79,12 @@ CollectionWatcher::CollectionWatcher(Song::Source source, QObject *parent)
|
|||||||
original_thread_(nullptr),
|
original_thread_(nullptr),
|
||||||
scan_on_startup_(true),
|
scan_on_startup_(true),
|
||||||
monitor_(true),
|
monitor_(true),
|
||||||
song_tracking_(true),
|
song_tracking_(false),
|
||||||
mark_songs_unavailable_(true),
|
mark_songs_unavailable_(source_ == Song::Source_Collection),
|
||||||
expire_unavailable_songs_days_(60),
|
expire_unavailable_songs_days_(60),
|
||||||
|
overwrite_rating_(false),
|
||||||
stop_requested_(false),
|
stop_requested_(false),
|
||||||
|
abort_requested_(false),
|
||||||
rescan_in_progress_(false),
|
rescan_in_progress_(false),
|
||||||
rescan_timer_(new QTimer(this)),
|
rescan_timer_(new QTimer(this)),
|
||||||
periodic_scan_timer_(new QTimer(this)),
|
periodic_scan_timer_(new QTimer(this)),
|
||||||
@@ -147,9 +144,16 @@ void CollectionWatcher::ReloadSettings() {
|
|||||||
scan_on_startup_ = s.value("startup_scan", true).toBool();
|
scan_on_startup_ = s.value("startup_scan", true).toBool();
|
||||||
monitor_ = s.value("monitor", true).toBool();
|
monitor_ = s.value("monitor", true).toBool();
|
||||||
QStringList filters = s.value("cover_art_patterns", QStringList() << "front" << "cover").toStringList();
|
QStringList filters = s.value("cover_art_patterns", QStringList() << "front" << "cover").toStringList();
|
||||||
song_tracking_ = s.value("song_tracking", false).toBool();
|
if (source_ == Song::Source_Collection) {
|
||||||
mark_songs_unavailable_ = song_tracking_ ? true : s.value("mark_songs_unavailable", true).toBool();
|
song_tracking_ = s.value("song_tracking", false).toBool();
|
||||||
|
mark_songs_unavailable_ = song_tracking_ ? true : s.value("mark_songs_unavailable", true).toBool();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
song_tracking_ = false;
|
||||||
|
mark_songs_unavailable_ = false;
|
||||||
|
}
|
||||||
expire_unavailable_songs_days_ = s.value("expire_unavailable_songs", 60).toInt();
|
expire_unavailable_songs_days_ = s.value("expire_unavailable_songs", 60).toInt();
|
||||||
|
overwrite_rating_ = s.value("overwrite_rating", false).toBool();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
best_image_filters_.clear();
|
best_image_filters_.clear();
|
||||||
@@ -210,7 +214,7 @@ CollectionWatcher::ScanTransaction::ScanTransaction(CollectionWatcher *watcher,
|
|||||||
CollectionWatcher::ScanTransaction::~ScanTransaction() {
|
CollectionWatcher::ScanTransaction::~ScanTransaction() {
|
||||||
|
|
||||||
// If we're stopping then don't commit the transaction
|
// If we're stopping then don't commit the transaction
|
||||||
if (!watcher_->stop_requested_) {
|
if (!watcher_->stop_requested_ && !watcher_->abort_requested_) {
|
||||||
CommitNewOrUpdatedSongs();
|
CommitNewOrUpdatedSongs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,7 +239,7 @@ void CollectionWatcher::ScanTransaction::AddToProgressMax(const quint64 n) {
|
|||||||
void CollectionWatcher::ScanTransaction::CommitNewOrUpdatedSongs() {
|
void CollectionWatcher::ScanTransaction::CommitNewOrUpdatedSongs() {
|
||||||
|
|
||||||
if (!deleted_songs.isEmpty()) {
|
if (!deleted_songs.isEmpty()) {
|
||||||
if (mark_songs_unavailable_) {
|
if (mark_songs_unavailable_ && watcher_->source() == Song::Source_Collection) {
|
||||||
emit watcher_->SongsUnavailable(deleted_songs);
|
emit watcher_->SongsUnavailable(deleted_songs);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -371,6 +375,8 @@ SubdirectoryList CollectionWatcher::ScanTransaction::GetAllSubdirs() {
|
|||||||
|
|
||||||
void CollectionWatcher::AddDirectory(const Directory &dir, const SubdirectoryList &subdirs) {
|
void CollectionWatcher::AddDirectory(const Directory &dir, const SubdirectoryList &subdirs) {
|
||||||
|
|
||||||
|
stop_requested_ = false;
|
||||||
|
|
||||||
watched_dirs_[dir.id] = dir;
|
watched_dirs_[dir.id] = dir;
|
||||||
|
|
||||||
if (subdirs.isEmpty()) {
|
if (subdirs.isEmpty()) {
|
||||||
@@ -390,7 +396,7 @@ void CollectionWatcher::AddDirectory(const Directory &dir, const SubdirectoryLis
|
|||||||
transaction.SetKnownSubdirs(subdirs);
|
transaction.SetKnownSubdirs(subdirs);
|
||||||
transaction.AddToProgressMax(files_count);
|
transaction.AddToProgressMax(files_count);
|
||||||
for (const Subdirectory &subdir : subdirs) {
|
for (const Subdirectory &subdir : subdirs) {
|
||||||
if (stop_requested_) break;
|
if (stop_requested_ || abort_requested_) break;
|
||||||
|
|
||||||
if (scan_on_startup_) ScanSubdirectory(subdir.path, subdir, subdir_files_count[subdir.path], &transaction);
|
if (scan_on_startup_) ScanSubdirectory(subdir.path, subdir, subdir_files_count[subdir.path], &transaction);
|
||||||
|
|
||||||
@@ -408,7 +414,6 @@ void CollectionWatcher::AddDirectory(const Directory &dir, const SubdirectoryLis
|
|||||||
void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory &subdir, const quint64 files_count, ScanTransaction *t, const bool force_noincremental) {
|
void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory &subdir, const quint64 files_count, ScanTransaction *t, const bool force_noincremental) {
|
||||||
|
|
||||||
QFileInfo path_info(path);
|
QFileInfo path_info(path);
|
||||||
QDir path_dir(path);
|
|
||||||
|
|
||||||
// Do not scan symlinked dirs that are already in collection
|
// Do not scan symlinked dirs that are already in collection
|
||||||
if (path_info.isSymLink()) {
|
if (path_info.isSymLink()) {
|
||||||
@@ -420,11 +425,6 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not scan directories containing a .nomedia or .nomusic file
|
|
||||||
if (path_dir.exists(kNoMediaFile) || path_dir.exists(kNoMusicFile)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool songs_missing_fingerprint = false;
|
bool songs_missing_fingerprint = false;
|
||||||
#ifdef HAVE_SONGFINGERPRINTING
|
#ifdef HAVE_SONGFINGERPRINTING
|
||||||
if (song_tracking_) {
|
if (song_tracking_) {
|
||||||
@@ -452,16 +452,16 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
}
|
}
|
||||||
|
|
||||||
// First we "quickly" get a list of the files in the directory that we think might be music. While we're here, we also look for new subdirectories and possible album artwork.
|
// First we "quickly" get a list of the files in the directory that we think might be music. While we're here, we also look for new subdirectories and possible album artwork.
|
||||||
QDirIterator it(path, QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot);
|
QDirIterator it(path, QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
|
||||||
if (stop_requested_) return;
|
if (stop_requested_ || abort_requested_) return;
|
||||||
|
|
||||||
QString child(it.next());
|
QString child(it.next());
|
||||||
QFileInfo child_info(child);
|
QFileInfo child_info(child);
|
||||||
|
|
||||||
if (child_info.isDir()) {
|
if (child_info.isDir()) {
|
||||||
if (!child_info.isHidden() && !t->HasSeenSubdir(child)) {
|
if (!t->HasSeenSubdir(child)) {
|
||||||
// We haven't seen this subdirectory before - add it to a list and later we'll tell the backend about it and scan it.
|
// We haven't seen this subdirectory before - add it to a list and later we'll tell the backend about it and scan it.
|
||||||
Subdirectory new_subdir;
|
Subdirectory new_subdir;
|
||||||
new_subdir.directory_id = -1;
|
new_subdir.directory_id = -1;
|
||||||
@@ -474,7 +474,10 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
else {
|
else {
|
||||||
QString ext_part(ExtensionPart(child));
|
QString ext_part(ExtensionPart(child));
|
||||||
QString dir_part(DirectoryPart(child));
|
QString dir_part(DirectoryPart(child));
|
||||||
if (sValidImages.contains(ext_part)) {
|
if (child_info.suffix() == "tmp" || child_info.baseName() == "qt_temp") {
|
||||||
|
t->AddToProgress(1);
|
||||||
|
}
|
||||||
|
else if (sValidImages.contains(ext_part)) {
|
||||||
album_art[dir_part] << child;
|
album_art[dir_part] << child;
|
||||||
t->AddToProgress(1);
|
t->AddToProgress(1);
|
||||||
}
|
}
|
||||||
@@ -487,7 +490,7 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stop_requested_) return;
|
if (stop_requested_ || abort_requested_) return;
|
||||||
|
|
||||||
// Ask the database for a list of files in this directory
|
// Ask the database for a list of files in this directory
|
||||||
SongList songs_in_db = t->FindSongsInSubdirectory(path);
|
SongList songs_in_db = t->FindSongsInSubdirectory(path);
|
||||||
@@ -498,10 +501,10 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
QStringList files_on_disk_copy = files_on_disk;
|
QStringList files_on_disk_copy = files_on_disk;
|
||||||
for (const QString &file : files_on_disk_copy) {
|
for (const QString &file : files_on_disk_copy) {
|
||||||
|
|
||||||
if (stop_requested_) return;
|
if (stop_requested_ || abort_requested_) return;
|
||||||
|
|
||||||
// Associated CUE
|
// Associated CUE
|
||||||
QString new_cue = NoExtensionPart(file) + ".cue";
|
QString new_cue = CueParser::FindCueFilename(file);
|
||||||
|
|
||||||
SongList matching_songs;
|
SongList matching_songs;
|
||||||
if (FindSongsByPath(songs_in_db, file, &matching_songs)) { // Found matching song in DB by path.
|
if (FindSongsByPath(songs_in_db, file, &matching_songs)) { // Found matching song in DB by path.
|
||||||
@@ -510,9 +513,9 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
|
|
||||||
// The song is in the database and still on disk.
|
// The song is in the database and still on disk.
|
||||||
// Check the mtime to see if it's been changed since it was added.
|
// Check the mtime to see if it's been changed since it was added.
|
||||||
QFileInfo file_info(file);
|
QFileInfo fileinfo(file);
|
||||||
|
|
||||||
if (!file_info.exists()) {
|
if (!fileinfo.exists()) {
|
||||||
// Partially fixes race condition - if file was removed between being added to the list and now.
|
// Partially fixes race condition - if file was removed between being added to the list and now.
|
||||||
files_on_disk.removeAll(file);
|
files_on_disk.removeAll(file);
|
||||||
t->AddToProgress(1);
|
t->AddToProgress(1);
|
||||||
@@ -520,16 +523,20 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CUE sheet's path from collection (if any).
|
// CUE sheet's path from collection (if any).
|
||||||
qint64 matching_song_cue_mtime = GetMtimeForCue(matching_song.cue_path());
|
qint64 matching_song_cue_mtime = static_cast<qint64>(GetMtimeForCue(matching_song.cue_path()));
|
||||||
|
|
||||||
// CUE sheet's path from this file (if any).
|
// CUE sheet's path from this file (if any).
|
||||||
qint64 new_cue_mtime = GetMtimeForCue(new_cue);
|
qint64 new_cue_mtime = 0;
|
||||||
|
if (!new_cue.isEmpty()) {
|
||||||
|
new_cue_mtime = static_cast<qint64>(GetMtimeForCue(new_cue));
|
||||||
|
}
|
||||||
|
|
||||||
bool cue_added = new_cue_mtime != 0 && !matching_song.has_cue();
|
const bool cue_added = new_cue_mtime != 0 && !matching_song.has_cue();
|
||||||
bool cue_deleted = matching_song_cue_mtime == 0 && matching_song.has_cue();
|
const bool cue_changed = new_cue_mtime != 0 && matching_song.has_cue() && new_cue != matching_song.cue_path();
|
||||||
|
const bool cue_deleted = matching_song.has_cue() && new_cue_mtime == 0;
|
||||||
|
|
||||||
// Watch out for CUE songs which have their mtime equal to qMax(media_file_mtime, cue_sheet_mtime)
|
// Watch out for CUE songs which have their mtime equal to qMax(media_file_mtime, cue_sheet_mtime)
|
||||||
bool changed = (matching_song.mtime() != qMax(file_info.lastModified().toSecsSinceEpoch(), matching_song_cue_mtime)) || cue_deleted || cue_added;
|
bool changed = (matching_song.mtime() != qMax(fileinfo.lastModified().toSecsSinceEpoch(), matching_song_cue_mtime)) || cue_deleted || cue_added || cue_changed;
|
||||||
|
|
||||||
// Also want to look to see whether the album art has changed
|
// Also want to look to see whether the album art has changed
|
||||||
QUrl image = ImageForSong(file, album_art);
|
QUrl image = ImageForSong(file, album_art);
|
||||||
@@ -565,12 +572,13 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!cue_deleted && (matching_song.has_cue() || cue_added)) { // If CUE associated.
|
if (new_cue.isEmpty() || new_cue_mtime == 0) { // If no CUE or it's about to lose it.
|
||||||
UpdateCueAssociatedSongs(file, path, fingerprint, new_cue, image, matching_songs, t);
|
|
||||||
}
|
|
||||||
else { // If no CUE or it's about to lose it.
|
|
||||||
UpdateNonCueAssociatedSong(file, fingerprint, matching_songs, image, cue_deleted, t);
|
UpdateNonCueAssociatedSong(file, fingerprint, matching_songs, image, cue_deleted, t);
|
||||||
}
|
}
|
||||||
|
else { // If CUE associated.
|
||||||
|
UpdateCueAssociatedSongs(file, path, fingerprint, new_cue, image, matching_songs, t);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nothing has changed - mark the song available without re-scanning
|
// Nothing has changed - mark the song available without re-scanning
|
||||||
@@ -594,15 +602,15 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
|
|
||||||
// The song is in the database and still on disk.
|
// The song is in the database and still on disk.
|
||||||
// Check the mtime to see if it's been changed since it was added.
|
// Check the mtime to see if it's been changed since it was added.
|
||||||
QFileInfo file_info(file);
|
QFileInfo fileinfo(file);
|
||||||
if (!file_info.exists()) {
|
if (!fileinfo.exists()) {
|
||||||
// Partially fixes race condition - if file was removed between being added to the list and now.
|
// Partially fixes race condition - if file was removed between being added to the list and now.
|
||||||
files_on_disk.removeAll(file);
|
files_on_disk.removeAll(file);
|
||||||
t->AddToProgress(1);
|
t->AddToProgress(1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the songs aren't deleted, as they still exist elsewhere with a different fingerprint.
|
// Make sure the songs aren't deleted, as they still exist elsewhere with a different file path.
|
||||||
bool matching_songs_has_cue = false;
|
bool matching_songs_has_cue = false;
|
||||||
for (const Song &matching_song : matching_songs) {
|
for (const Song &matching_song : matching_songs) {
|
||||||
QString matching_filename = matching_song.url().toLocalFile();
|
QString matching_filename = matching_song.url().toLocalFile();
|
||||||
@@ -619,19 +627,19 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CUE sheet's path from this file (if any).
|
// CUE sheet's path from this file (if any).
|
||||||
const qint64 new_cue_mtime = GetMtimeForCue(new_cue);
|
qint64 new_cue_mtime = 0;
|
||||||
|
if (!new_cue.isEmpty()) {
|
||||||
const bool cue_deleted = new_cue_mtime == 0 && matching_songs_has_cue;
|
new_cue_mtime = static_cast<qint64>(GetMtimeForCue(new_cue));
|
||||||
const bool cue_added = new_cue_mtime != 0 && !matching_songs_has_cue;
|
}
|
||||||
|
|
||||||
// Get new album art
|
// Get new album art
|
||||||
QUrl image = ImageForSong(file, album_art);
|
QUrl image = ImageForSong(file, album_art);
|
||||||
|
|
||||||
if (!cue_deleted && (matching_songs_has_cue || cue_added)) { // CUE associated.
|
if (new_cue.isEmpty() || new_cue_mtime == 0) { // If no CUE or it's about to lose it.
|
||||||
UpdateCueAssociatedSongs(file, path, fingerprint, new_cue, image, matching_songs, t);
|
UpdateNonCueAssociatedSong(file, fingerprint, matching_songs, image, matching_songs_has_cue && new_cue_mtime == 0, t);
|
||||||
}
|
}
|
||||||
else { // If no CUE or it's about to lose it.
|
else { // If CUE associated.
|
||||||
UpdateNonCueAssociatedSong(file, fingerprint, matching_songs, image, cue_deleted, t);
|
UpdateCueAssociatedSongs(file, path, fingerprint, new_cue, image, matching_songs, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -686,7 +694,7 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
|
|
||||||
// Recurse into the new subdirs that we found
|
// Recurse into the new subdirs that we found
|
||||||
for (const Subdirectory &my_new_subdir : my_new_subdirs) {
|
for (const Subdirectory &my_new_subdir : my_new_subdirs) {
|
||||||
if (stop_requested_) return;
|
if (stop_requested_ || abort_requested_) return;
|
||||||
ScanSubdirectory(my_new_subdir.path, my_new_subdir, 0, t, true);
|
ScanSubdirectory(my_new_subdir.path, my_new_subdir, 0, t, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -726,7 +734,7 @@ void CollectionWatcher::UpdateCueAssociatedSongs(const QString &file,
|
|||||||
const Song matching_cue_song = sections_map[new_cue_song.beginning_nanosec()];
|
const Song matching_cue_song = sections_map[new_cue_song.beginning_nanosec()];
|
||||||
new_cue_song.set_id(matching_cue_song.id());
|
new_cue_song.set_id(matching_cue_song.id());
|
||||||
if (!new_cue_song.has_embedded_cover()) new_cue_song.set_art_automatic(image);
|
if (!new_cue_song.has_embedded_cover()) new_cue_song.set_art_automatic(image);
|
||||||
new_cue_song.MergeUserSetData(matching_cue_song);
|
new_cue_song.MergeUserSetData(matching_cue_song, true);
|
||||||
AddChangedSong(file, matching_cue_song, new_cue_song, t);
|
AddChangedSong(file, matching_cue_song, new_cue_song, t);
|
||||||
used_ids.insert(matching_cue_song.id());
|
used_ids.insert(matching_cue_song.id());
|
||||||
}
|
}
|
||||||
@@ -769,7 +777,7 @@ void CollectionWatcher::UpdateNonCueAssociatedSong(const QString &file,
|
|||||||
song_on_disk.set_id(matching_song.id());
|
song_on_disk.set_id(matching_song.id());
|
||||||
song_on_disk.set_fingerprint(fingerprint);
|
song_on_disk.set_fingerprint(fingerprint);
|
||||||
if (!song_on_disk.has_embedded_cover()) song_on_disk.set_art_automatic(image);
|
if (!song_on_disk.has_embedded_cover()) song_on_disk.set_art_automatic(image);
|
||||||
song_on_disk.MergeUserSetData(matching_song);
|
song_on_disk.MergeUserSetData(matching_song, !overwrite_rating_);
|
||||||
AddChangedSong(file, matching_song, song_on_disk, t);
|
AddChangedSong(file, matching_song, song_on_disk, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,28 +835,47 @@ SongList CollectionWatcher::ScanNewFile(const QString &file, const QString &path
|
|||||||
|
|
||||||
void CollectionWatcher::AddChangedSong(const QString &file, const Song &matching_song, const Song &new_song, ScanTransaction *t) {
|
void CollectionWatcher::AddChangedSong(const QString &file, const Song &matching_song, const Song &new_song, ScanTransaction *t) {
|
||||||
|
|
||||||
|
bool notify_new = false;
|
||||||
|
QStringList changes;
|
||||||
|
|
||||||
if (matching_song.is_unavailable()) {
|
if (matching_song.is_unavailable()) {
|
||||||
qLog(Debug) << file << "unavailable song restored.";
|
qLog(Debug) << "unavailable song" << file << "restored.";
|
||||||
t->new_songs << new_song;
|
notify_new = true;
|
||||||
}
|
}
|
||||||
else if (!matching_song.IsMetadataEqual(new_song)) {
|
else {
|
||||||
qLog(Debug) << file << "metadata changed.";
|
if (matching_song.url() != new_song.url()) {
|
||||||
t->new_songs << new_song;
|
changes << "file path";
|
||||||
}
|
notify_new = true;
|
||||||
else if (matching_song.fingerprint() != new_song.fingerprint()) {
|
}
|
||||||
qLog(Debug) << file << "fingerprint changed.";
|
if (matching_song.fingerprint() != new_song.fingerprint()) {
|
||||||
t->new_songs << new_song;
|
changes << "fingerprint";
|
||||||
}
|
notify_new = true;
|
||||||
else if (matching_song.art_automatic() != new_song.art_automatic() || matching_song.art_manual() != new_song.art_manual()) {
|
}
|
||||||
qLog(Debug) << file << "art changed.";
|
if (!matching_song.IsMetadataEqual(new_song)) {
|
||||||
t->new_songs << new_song;
|
changes << "metadata";
|
||||||
}
|
notify_new = true;
|
||||||
else if (matching_song.mtime() != new_song.mtime()) {
|
}
|
||||||
qLog(Debug) << file << "mtime changed.";
|
if (matching_song.art_automatic() != new_song.art_automatic() || matching_song.art_manual() != new_song.art_manual()) {
|
||||||
t->touched_songs << new_song;
|
changes << "album art";
|
||||||
|
notify_new = true;
|
||||||
|
}
|
||||||
|
if (matching_song.mtime() != new_song.mtime()) {
|
||||||
|
changes << "mtime";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changes.isEmpty()) {
|
||||||
|
qLog(Debug) << "Song" << file << "unchanged.";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qLog(Debug) << "Song" << file << changes.join(", ") << "changed.";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notify_new) {
|
||||||
|
t->new_songs << new_song;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qLog(Debug) << file << "unchanged.";
|
|
||||||
t->touched_songs << new_song;
|
t->touched_songs << new_song;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -860,12 +887,12 @@ quint64 CollectionWatcher::GetMtimeForCue(const QString &cue_path) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QFileInfo file_info(cue_path);
|
const QFileInfo fileinfo(cue_path);
|
||||||
if (!file_info.exists()) {
|
if (!fileinfo.exists()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QDateTime cue_last_modified = file_info.lastModified();
|
const QDateTime cue_last_modified = fileinfo.lastModified();
|
||||||
|
|
||||||
return cue_last_modified.isValid() ? cue_last_modified.toSecsSinceEpoch() : 0;
|
return cue_last_modified.isValid() ? cue_last_modified.toSecsSinceEpoch() : 0;
|
||||||
}
|
}
|
||||||
@@ -971,7 +998,7 @@ void CollectionWatcher::RescanPathsNow() {
|
|||||||
|
|
||||||
QList<int> dirs = rescan_queue_.keys();
|
QList<int> dirs = rescan_queue_.keys();
|
||||||
for (const int dir : dirs) {
|
for (const int dir : dirs) {
|
||||||
if (stop_requested_) break;
|
if (stop_requested_ || abort_requested_) break;
|
||||||
ScanTransaction transaction(this, dir, false, false, mark_songs_unavailable_);
|
ScanTransaction transaction(this, dir, false, false, mark_songs_unavailable_);
|
||||||
|
|
||||||
QMap<QString, quint64> subdir_files_count;
|
QMap<QString, quint64> subdir_files_count;
|
||||||
@@ -982,7 +1009,7 @@ void CollectionWatcher::RescanPathsNow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const QString &path : rescan_queue_[dir]) {
|
for (const QString &path : rescan_queue_[dir]) {
|
||||||
if (stop_requested_) break;
|
if (stop_requested_ || abort_requested_) break;
|
||||||
Subdirectory subdir;
|
Subdirectory subdir;
|
||||||
subdir.directory_id = dir;
|
subdir.directory_id = dir;
|
||||||
subdir.mtime = 0;
|
subdir.mtime = 0;
|
||||||
@@ -1007,8 +1034,8 @@ QString CollectionWatcher::PickBestImage(const QStringList &images) {
|
|||||||
for (const QString &filter_text : best_image_filters_) {
|
for (const QString &filter_text : best_image_filters_) {
|
||||||
// The images in the images list are represented by a full path, so we need to isolate just the filename
|
// The images in the images list are represented by a full path, so we need to isolate just the filename
|
||||||
for (const QString &image : images) {
|
for (const QString &image : images) {
|
||||||
QFileInfo file_info(image);
|
QFileInfo fileinfo(image);
|
||||||
QString filename(file_info.fileName());
|
QString filename(fileinfo.fileName());
|
||||||
if (filename.contains(filter_text, Qt::CaseInsensitive))
|
if (filename.contains(filter_text, Qt::CaseInsensitive))
|
||||||
filtered << image;
|
filtered << image;
|
||||||
}
|
}
|
||||||
@@ -1027,7 +1054,7 @@ QString CollectionWatcher::PickBestImage(const QStringList &images) {
|
|||||||
QString biggest_path;
|
QString biggest_path;
|
||||||
|
|
||||||
for (const QString &path : filtered) {
|
for (const QString &path : filtered) {
|
||||||
if (stop_requested_) break;
|
if (stop_requested_ || abort_requested_) break;
|
||||||
|
|
||||||
QImage image(path);
|
QImage image(path);
|
||||||
if (image.isNull()) continue;
|
if (image.isNull()) continue;
|
||||||
@@ -1120,7 +1147,7 @@ void CollectionWatcher::RescanTracksNow() {
|
|||||||
// Currently we are too stupid to rescan one file at a time, so we'll just scan the full directories
|
// Currently we are too stupid to rescan one file at a time, so we'll just scan the full directories
|
||||||
QStringList scanned_dirs; // To avoid double scans
|
QStringList scanned_dirs; // To avoid double scans
|
||||||
while (!song_rescan_queue_.isEmpty()) {
|
while (!song_rescan_queue_.isEmpty()) {
|
||||||
if (stop_requested_) break;
|
if (stop_requested_ || abort_requested_) break;
|
||||||
Song song = song_rescan_queue_.takeFirst();
|
Song song = song_rescan_queue_.takeFirst();
|
||||||
QString songdir = song.url().toLocalFile().section('/', 0, -2);
|
QString songdir = song.url().toLocalFile().section('/', 0, -2);
|
||||||
if (!scanned_dirs.contains(songdir)) {
|
if (!scanned_dirs.contains(songdir)) {
|
||||||
@@ -1146,7 +1173,7 @@ void CollectionWatcher::PerformScan(const bool incremental, const bool ignore_mt
|
|||||||
|
|
||||||
for (const Directory &dir : std::as_const(watched_dirs_)) {
|
for (const Directory &dir : std::as_const(watched_dirs_)) {
|
||||||
|
|
||||||
if (stop_requested_) break;
|
if (stop_requested_ || abort_requested_) break;
|
||||||
|
|
||||||
ScanTransaction transaction(this, dir.id, incremental, ignore_mtimes, mark_songs_unavailable_);
|
ScanTransaction transaction(this, dir.id, incremental, ignore_mtimes, mark_songs_unavailable_);
|
||||||
SubdirectoryList subdirs(transaction.GetAllSubdirs());
|
SubdirectoryList subdirs(transaction.GetAllSubdirs());
|
||||||
@@ -1164,7 +1191,7 @@ void CollectionWatcher::PerformScan(const bool incremental, const bool ignore_mt
|
|||||||
transaction.AddToProgressMax(files_count);
|
transaction.AddToProgressMax(files_count);
|
||||||
|
|
||||||
for (const Subdirectory &subdir : subdirs) {
|
for (const Subdirectory &subdir : subdirs) {
|
||||||
if (stop_requested_) break;
|
if (stop_requested_ || abort_requested_) break;
|
||||||
ScanSubdirectory(subdir.path, subdir, subdir_files_count[subdir.path], &transaction);
|
ScanSubdirectory(subdir.path, subdir, subdir_files_count[subdir.path], &transaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1179,18 +1206,15 @@ void CollectionWatcher::PerformScan(const bool incremental, const bool ignore_mt
|
|||||||
quint64 CollectionWatcher::FilesCountForPath(ScanTransaction *t, const QString &path) {
|
quint64 CollectionWatcher::FilesCountForPath(ScanTransaction *t, const QString &path) {
|
||||||
|
|
||||||
quint64 i = 0;
|
quint64 i = 0;
|
||||||
QDirIterator it(path, QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot);
|
QDirIterator it(path, QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
|
||||||
if (stop_requested_) break;
|
if (stop_requested_ || abort_requested_) break;
|
||||||
|
|
||||||
QString child = it.next();
|
QString child = it.next();
|
||||||
QFileInfo path_info(child);
|
QFileInfo path_info(child);
|
||||||
|
|
||||||
if (path_info.isDir()) {
|
if (path_info.isDir()) {
|
||||||
if (path_info.exists(kNoMediaFile) || path_info.exists(kNoMusicFile)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (path_info.isSymLink()) {
|
if (path_info.isSymLink()) {
|
||||||
QString real_path = path_info.symLinkTarget();
|
QString real_path = path_info.symLinkTarget();
|
||||||
for (const Directory &dir : std::as_const(watched_dirs_)) {
|
for (const Directory &dir : std::as_const(watched_dirs_)) {
|
||||||
@@ -1219,7 +1243,7 @@ quint64 CollectionWatcher::FilesCountForSubdirs(ScanTransaction *t, const Subdir
|
|||||||
|
|
||||||
quint64 i = 0;
|
quint64 i = 0;
|
||||||
for (const Subdirectory &subdir : subdirs) {
|
for (const Subdirectory &subdir : subdirs) {
|
||||||
if (stop_requested_) break;
|
if (stop_requested_ || abort_requested_) break;
|
||||||
const quint64 files_count = FilesCountForPath(t, subdir.path);
|
const quint64 files_count = FilesCountForPath(t, subdir.path);
|
||||||
subdir_files_count[subdir.path] = files_count;
|
subdir_files_count[subdir.path] = files_count;
|
||||||
i += files_count;
|
i += files_count;
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ class CollectionWatcher : public QObject {
|
|||||||
public:
|
public:
|
||||||
explicit CollectionWatcher(Song::Source source, QObject *parent = nullptr);
|
explicit CollectionWatcher(Song::Source source, QObject *parent = nullptr);
|
||||||
|
|
||||||
|
Song::Source source() { return source_; }
|
||||||
|
|
||||||
void set_backend(CollectionBackend *backend) { backend_ = backend; }
|
void set_backend(CollectionBackend *backend) { backend_ = backend; }
|
||||||
void set_task_manager(TaskManager *task_manager) { task_manager_ = task_manager; }
|
void set_task_manager(TaskManager *task_manager) { task_manager_ = task_manager; }
|
||||||
void set_device_name(const QString &device_name) { device_name_ = device_name; }
|
void set_device_name(const QString &device_name) { device_name_ = device_name; }
|
||||||
@@ -62,6 +64,7 @@ class CollectionWatcher : public QObject {
|
|||||||
void ReloadSettingsAsync();
|
void ReloadSettingsAsync();
|
||||||
|
|
||||||
void Stop() { stop_requested_ = true; }
|
void Stop() { stop_requested_ = true; }
|
||||||
|
void Abort() { abort_requested_ = true; }
|
||||||
|
|
||||||
void ExitAsync();
|
void ExitAsync();
|
||||||
|
|
||||||
@@ -194,6 +197,8 @@ class CollectionWatcher : public QObject {
|
|||||||
quint64 FilesCountForPath(ScanTransaction *t, const QString &path);
|
quint64 FilesCountForPath(ScanTransaction *t, const QString &path);
|
||||||
quint64 FilesCountForSubdirs(ScanTransaction *t, const SubdirectoryList &subdirs, QMap<QString, quint64> &subdir_files_count);
|
quint64 FilesCountForSubdirs(ScanTransaction *t, const SubdirectoryList &subdirs, QMap<QString, quint64> &subdir_files_count);
|
||||||
|
|
||||||
|
QString FindCueFilename(const QString &filename);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Song::Source source_;
|
Song::Source source_;
|
||||||
CollectionBackend *backend_;
|
CollectionBackend *backend_;
|
||||||
@@ -213,8 +218,10 @@ class CollectionWatcher : public QObject {
|
|||||||
bool song_tracking_;
|
bool song_tracking_;
|
||||||
bool mark_songs_unavailable_;
|
bool mark_songs_unavailable_;
|
||||||
int expire_unavailable_songs_days_;
|
int expire_unavailable_songs_days_;
|
||||||
|
bool overwrite_rating_;
|
||||||
|
|
||||||
bool stop_requested_;
|
bool stop_requested_;
|
||||||
|
bool abort_requested_;
|
||||||
bool rescan_in_progress_; // True if RescanTracksNow() has been called and is working.
|
bool rescan_in_progress_; // True if RescanTracksNow() has been called and is working.
|
||||||
|
|
||||||
QMap<int, Directory> watched_dirs_;
|
QMap<int, Directory> watched_dirs_;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Strawberry Music Player
|
* Strawberry Music Player
|
||||||
* This file was part of Clementine.
|
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
|
||||||
*
|
*
|
||||||
* Strawberry is free software: you can redistribute it and/or modify
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -21,20 +20,74 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
#include <QString>
|
||||||
|
#include <QUrl>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QSqlRecord>
|
#include <QSqlRecord>
|
||||||
|
|
||||||
#include "sqlrow.h"
|
#include "sqlrow.h"
|
||||||
|
|
||||||
#include "collectionquery.h"
|
|
||||||
|
|
||||||
SqlRow::SqlRow(const QSqlQuery &query) { Init(query); }
|
SqlRow::SqlRow(const QSqlQuery &query) { Init(query); }
|
||||||
|
|
||||||
void SqlRow::Init(const QSqlQuery &query) {
|
void SqlRow::Init(const QSqlQuery &query) {
|
||||||
|
|
||||||
int rows = query.record().count();
|
const QSqlRecord r = query.record();
|
||||||
for (int i = 0; i < rows; ++i) {
|
for (int i = 0; i < r.count(); ++i) {
|
||||||
columns_ << query.value(i);
|
columns_by_number_.insert(i, query.value(i));
|
||||||
|
const QString field_name = r.fieldName(i);
|
||||||
|
if (!columns_by_name_.contains(field_name) || columns_by_name_[field_name].isNull()) {
|
||||||
|
columns_by_name_.insert(field_name, query.value(i));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QVariant SqlRow::value(const int number) const {
|
||||||
|
|
||||||
|
if (columns_by_number_.contains(number)) {
|
||||||
|
return columns_by_number_[number];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const QVariant SqlRow::value(const QString &name) const {
|
||||||
|
|
||||||
|
if (columns_by_name_.contains(name)) {
|
||||||
|
return columns_by_name_[name];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString SqlRow::ValueToString(const QString &n) const {
|
||||||
|
return value(n).isNull() ? QString() : value(n).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QUrl SqlRow::ValueToUrl(const QString &n) const {
|
||||||
|
return value(n).isNull() ? QUrl() : QUrl(value(n).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
int SqlRow::ValueToInt(const QString &n) const {
|
||||||
|
return value(n).isNull() ? -1 : value(n).toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint SqlRow::ValueToUInt(const QString &n) const {
|
||||||
|
return value(n).isNull() || value(n).toInt() < 0 ? 0 : value(n).toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 SqlRow::ValueToLongLong(const QString &n) const {
|
||||||
|
return value(n).isNull() ? -1 : value(n).toLongLong();
|
||||||
|
}
|
||||||
|
|
||||||
|
float SqlRow::ValueToFloat(const QString &n) const {
|
||||||
|
return value(n).isNull() ? -1.0F : value(n).toFloat();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SqlRow::ValueToBool(const QString &n) const {
|
||||||
|
return !value(n).isNull() && value(n).toInt() == 1;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Strawberry Music Player
|
* Strawberry Music Player
|
||||||
* This file was part of Clementine.
|
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
|
||||||
*
|
*
|
||||||
* Strawberry is free software: you can redistribute it and/or modify
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -25,24 +24,33 @@
|
|||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
#include <QUrl>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
|
|
||||||
class CollectionQuery;
|
|
||||||
|
|
||||||
class SqlRow {
|
class SqlRow {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SqlRow(const QSqlQuery &query);
|
SqlRow(const QSqlQuery &query);
|
||||||
|
|
||||||
const QVariant &value(int i) const { return columns_[i]; }
|
const QVariant value(const int number) const;
|
||||||
|
const QVariant value(const QString &name) const;
|
||||||
|
|
||||||
QList<QVariant> columns_;
|
QString ValueToString(const QString &n) const;
|
||||||
|
QUrl ValueToUrl(const QString &n) const;
|
||||||
|
int ValueToInt(const QString &n) const;
|
||||||
|
uint ValueToUInt(const QString &n) const;
|
||||||
|
qint64 ValueToLongLong(const QString &n) const;
|
||||||
|
float ValueToFloat(const QString &n) const;
|
||||||
|
bool ValueToBool(const QString& n) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SqlRow();
|
SqlRow();
|
||||||
|
|
||||||
void Init(const QSqlQuery &query);
|
void Init(const QSqlQuery &query);
|
||||||
|
|
||||||
|
QMap<int, QVariant> columns_by_number_;
|
||||||
|
QMap<QString, QVariant> columns_by_name_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QList<SqlRow> SqlRowList;
|
typedef QList<SqlRow> SqlRowList;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#cmakedefine HAVE_BACKTRACE
|
#cmakedefine HAVE_BACKTRACE
|
||||||
#cmakedefine HAVE_GIO
|
#cmakedefine HAVE_GIO
|
||||||
|
#cmakedefine HAVE_GIO_UNIX
|
||||||
#cmakedefine HAVE_DBUS
|
#cmakedefine HAVE_DBUS
|
||||||
#cmakedefine HAVE_X11
|
#cmakedefine HAVE_X11
|
||||||
#cmakedefine HAVE_UDISKS2
|
#cmakedefine HAVE_UDISKS2
|
||||||
@@ -15,7 +16,6 @@
|
|||||||
#cmakedefine HAVE_LIBGPOD
|
#cmakedefine HAVE_LIBGPOD
|
||||||
#cmakedefine HAVE_LIBMTP
|
#cmakedefine HAVE_LIBMTP
|
||||||
#cmakedefine HAVE_LIBPULSE
|
#cmakedefine HAVE_LIBPULSE
|
||||||
#cmakedefine HAVE_SPARKLE
|
|
||||||
#cmakedefine HAVE_QTSPARKLE
|
#cmakedefine HAVE_QTSPARKLE
|
||||||
#cmakedefine HAVE_SONGFINGERPRINTING
|
#cmakedefine HAVE_SONGFINGERPRINTING
|
||||||
#cmakedefine HAVE_MUSICBRAINZ
|
#cmakedefine HAVE_MUSICBRAINZ
|
||||||
|
|||||||
@@ -46,7 +46,6 @@
|
|||||||
#include "collection/collectionbackend.h"
|
#include "collection/collectionbackend.h"
|
||||||
#include "collection/collectionmodel.h"
|
#include "collection/collectionmodel.h"
|
||||||
#include "collection/collectionitem.h"
|
#include "collection/collectionitem.h"
|
||||||
#include "collection/sqlrow.h"
|
|
||||||
#include "playlist/playlistmanager.h"
|
#include "playlist/playlistmanager.h"
|
||||||
#include "playlist/songmimedata.h"
|
#include "playlist/songmimedata.h"
|
||||||
#include "covermanager/albumcoverloader.h"
|
#include "covermanager/albumcoverloader.h"
|
||||||
@@ -236,14 +235,18 @@ QVariant ContextAlbumsModel::data(const CollectionItem *item, int role) const {
|
|||||||
|
|
||||||
case Role_SortText:
|
case Role_SortText:
|
||||||
return item->SortText();
|
return item->SortText();
|
||||||
|
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextAlbumsModel::Reset() {
|
void ContextAlbumsModel::Reset() {
|
||||||
|
|
||||||
for (QMap<QString, CollectionItem*>::iterator it = container_nodes_.begin(); it != container_nodes_.end(); ++it) {
|
for (QMap<QString, CollectionItem*>::const_iterator it = container_nodes_.constBegin(); it != container_nodes_.constEnd(); ++it) {
|
||||||
const QString cache_key = AlbumIconPixmapCacheKey(ItemToIndex(it.value()));
|
const QString cache_key = AlbumIconPixmapCacheKey(ItemToIndex(it.value()));
|
||||||
QPixmapCache::remove(cache_key);
|
QPixmapCache::remove(cache_key);
|
||||||
}
|
}
|
||||||
@@ -263,7 +266,7 @@ void ContextAlbumsModel::Reset() {
|
|||||||
|
|
||||||
CollectionItem *ContextAlbumsModel::ItemFromSong(CollectionItem::Type item_type, const bool signal, CollectionItem *parent, const Song &s, const int container_level) {
|
CollectionItem *ContextAlbumsModel::ItemFromSong(CollectionItem::Type item_type, const bool signal, CollectionItem *parent, const Song &s, const int container_level) {
|
||||||
|
|
||||||
if (signal) beginInsertRows(ItemToIndex(parent), parent->children.count(), parent->children.count());
|
if (signal) beginInsertRows(ItemToIndex(parent), static_cast<int>(parent->children.count()), static_cast<int>(parent->children.count()));
|
||||||
|
|
||||||
CollectionItem *item = new CollectionItem(item_type, parent);
|
CollectionItem *item = new CollectionItem(item_type, parent);
|
||||||
item->container_level = container_level;
|
item->container_level = container_level;
|
||||||
|
|||||||
@@ -43,7 +43,6 @@
|
|||||||
#include "core/song.h"
|
#include "core/song.h"
|
||||||
#include "collection/collectionquery.h"
|
#include "collection/collectionquery.h"
|
||||||
#include "collection/collectionitem.h"
|
#include "collection/collectionitem.h"
|
||||||
#include "collection/sqlrow.h"
|
|
||||||
#include "covermanager/albumcoverloaderoptions.h"
|
#include "covermanager/albumcoverloaderoptions.h"
|
||||||
#include "covermanager/albumcoverloaderresult.h"
|
#include "covermanager/albumcoverloaderresult.h"
|
||||||
|
|
||||||
@@ -72,11 +71,6 @@ class ContextAlbumsModel : public SimpleTreeModel<CollectionItem> {
|
|||||||
LastRole
|
LastRole
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QueryResult {
|
|
||||||
QueryResult() {}
|
|
||||||
SqlRowList rows;
|
|
||||||
};
|
|
||||||
|
|
||||||
void GetChildSongs(CollectionItem *item, QList<QUrl> *urls, SongList *songs, QSet<int> *song_ids) const;
|
void GetChildSongs(CollectionItem *item, QList<QUrl> *urls, SongList *songs, QSet<int> *song_ids) const;
|
||||||
SongList GetChildSongs(const QModelIndex &idx) const;
|
SongList GetChildSongs(const QModelIndex &idx) const;
|
||||||
SongList GetChildSongs(const QModelIndexList &indexes) const;
|
SongList GetChildSongs(const QModelIndexList &indexes) const;
|
||||||
|
|||||||