Compare commits
281 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d8c7e8b7b | ||
|
|
9ff1f4d7b4 | ||
|
|
3a60dfe025 | ||
|
|
d358854e16 | ||
|
|
129587e94a | ||
|
|
0f575f4639 | ||
|
|
7aac741571 | ||
|
|
b8a9da8a4e | ||
|
|
be6b974334 | ||
|
|
194e81205b | ||
|
|
d711dcc99d | ||
|
|
3b72a12540 | ||
|
|
38a1b7765a | ||
|
|
02f2b8b6f0 | ||
|
|
7bfa75102c | ||
|
|
b0f3e7351c | ||
|
|
b5fa401db9 | ||
|
|
41f2710dea | ||
|
|
f19dda57f0 | ||
|
|
cc4a99ad80 | ||
|
|
1c1a3fc417 | ||
|
|
e97be5850b | ||
|
|
2c302654b7 | ||
|
|
3ee4dc77b2 | ||
|
|
db55f314c9 | ||
|
|
0b536b287f | ||
|
|
6f298a9917 | ||
|
|
70f829a2e5 | ||
|
|
1dfe07003f | ||
|
|
286b908062 | ||
|
|
4ec028e736 | ||
|
|
35a6d1437a | ||
|
|
7e3cb3de89 | ||
|
|
bd945039f1 | ||
|
|
46743c8f15 | ||
|
|
9b75284447 | ||
|
|
dca3b0052a | ||
|
|
6d05bb2de5 | ||
|
|
8b2e8d3804 | ||
|
|
1a2ab19ab4 | ||
|
|
04f010aa7b | ||
|
|
25323b4a3a | ||
|
|
f353c022f6 | ||
|
|
9d8b3d3428 | ||
|
|
e4b06772c0 | ||
|
|
a2b5c3ea08 | ||
|
|
f632e95600 | ||
|
|
4b5da8c6d4 | ||
|
|
77d7ffd10a | ||
|
|
d2f720011a | ||
|
|
6329a7711d | ||
|
|
fd14d044e3 | ||
|
|
6368d507e1 | ||
|
|
205b7f2401 | ||
|
|
f7d10f9530 | ||
|
|
66154bb51e | ||
|
|
fac4ad5313 | ||
|
|
fee63891ac | ||
|
|
efa979ee03 | ||
|
|
c756346357 | ||
|
|
cc95db25cc | ||
|
|
44970c3321 | ||
|
|
43c7934af7 | ||
|
|
3e7b51163c | ||
|
|
4d5f8a53f0 | ||
|
|
0b73ca8318 | ||
|
|
754cfc3bfd | ||
|
|
2ed1a5c06a | ||
|
|
b2073df3c3 | ||
|
|
6267edaa81 | ||
|
|
292f2de3e6 | ||
|
|
7803dc8be3 | ||
|
|
2a1260b79e | ||
|
|
f9ec438b7f | ||
|
|
de544c4856 | ||
|
|
55e04dd520 | ||
|
|
b2d06f900b | ||
|
|
b92ec71810 | ||
|
|
3a4199240e | ||
|
|
157de12bdf | ||
|
|
7c0c9fccdb | ||
|
|
2cb29d06b3 | ||
|
|
1fdeb50d93 | ||
|
|
f59632ae59 | ||
|
|
67b503da44 | ||
|
|
a351de6904 | ||
|
|
f94742abd5 | ||
|
|
891182637e | ||
|
|
086681c915 | ||
|
|
3970d2d02b | ||
|
|
2b3fddd015 | ||
|
|
30fa0480a3 | ||
|
|
320a81ce69 | ||
|
|
950411ef56 | ||
|
|
cb9cf084c0 | ||
|
|
bb18af09ae | ||
|
|
049bf0c7f9 | ||
|
|
ebc73ef775 | ||
|
|
1bd6f59355 | ||
|
|
c16396a690 | ||
|
|
32a9fe3e9c | ||
|
|
f48d133bc6 | ||
|
|
0678526d7d | ||
|
|
26d3e8371f | ||
|
|
6768f614c7 | ||
|
|
171dc84df1 | ||
|
|
5ca6513c04 | ||
|
|
41aeb0ac80 | ||
|
|
f871c4adef | ||
|
|
ad4d0e89b1 | ||
|
|
0d0c49caa1 | ||
|
|
7cbc7bdcfb | ||
|
|
6b46c8ed4a | ||
|
|
e33ffd1c8a | ||
|
|
8dce9cc938 | ||
|
|
f06218f8e3 | ||
|
|
5711eef2be | ||
|
|
db6aac603c | ||
|
|
f10e928106 | ||
|
|
99d963b99c | ||
|
|
5d35c22238 | ||
|
|
54fc11a235 | ||
|
|
ec99df3144 | ||
|
|
d722035883 | ||
|
|
52139fbaa0 | ||
|
|
88854eb558 | ||
|
|
c82bba01ee | ||
|
|
eaa33a03d7 | ||
|
|
89e8518f31 | ||
|
|
c7bf2e1da8 | ||
|
|
bf904a6afa | ||
|
|
43c14ae71b | ||
|
|
4abb8ef3c9 | ||
|
|
e46b92dd7d | ||
|
|
1a25faa5b9 | ||
|
|
3f4bf5f512 | ||
|
|
ae7dbf15ed | ||
|
|
b22320c48f | ||
|
|
61204e8d35 | ||
|
|
b0704c654c | ||
|
|
f40f8a8873 | ||
|
|
560a7db506 | ||
|
|
15baa8f70e | ||
|
|
97a7637294 | ||
|
|
3454656207 | ||
|
|
7dff6f26bc | ||
|
|
9e835a23fd | ||
|
|
c0259fb6ce | ||
|
|
acf106220b | ||
|
|
5d4dc9c907 | ||
|
|
2b9a56af7f | ||
|
|
f1e3ac65ac | ||
|
|
143f72cf6b | ||
|
|
5c8e49296c | ||
|
|
b2558b703c | ||
|
|
bf9d87106e | ||
|
|
5b7f507d9b | ||
|
|
59a7835ace | ||
|
|
2495838fe3 | ||
|
|
bab687bedf | ||
|
|
6467c3c8ee | ||
|
|
66c2b7aaa6 | ||
|
|
ab72c52661 | ||
|
|
f0bf1b8a54 | ||
|
|
119251719f | ||
|
|
0348400132 | ||
|
|
813473805b | ||
|
|
fe6368561b | ||
|
|
7ff06f424d | ||
|
|
31958592c7 | ||
|
|
adc21f4f75 | ||
|
|
9cecd89d6f | ||
|
|
d866b9b4d4 | ||
|
|
93f12baf51 | ||
|
|
78d6fd634b | ||
|
|
b5fc19f08a | ||
|
|
2dae6a6546 | ||
|
|
b6bba46391 | ||
|
|
b791d97116 | ||
|
|
6aa8255f34 | ||
|
|
98e2140761 | ||
|
|
a59e064778 | ||
|
|
655c4c66a7 | ||
|
|
407c128f65 | ||
|
|
59a261a5be | ||
|
|
ba4e1afefe | ||
|
|
98b53b81d8 | ||
|
|
8270cc0aa2 | ||
|
|
74207b1a87 | ||
|
|
77983445ce | ||
|
|
162190bcb8 | ||
|
|
86b92b20b7 | ||
|
|
2f5b60d548 | ||
|
|
c19661c977 | ||
|
|
82d101ca27 | ||
|
|
32f9c4e670 | ||
|
|
34c7225ab7 | ||
|
|
b02eb502e4 | ||
|
|
7d6b3dfd20 | ||
|
|
3ac39968d2 | ||
|
|
2b24ac54a0 | ||
|
|
6da6b794c7 | ||
|
|
ed689e27c9 | ||
|
|
186f9c3f18 | ||
|
|
42cdde3203 | ||
|
|
b9091702e9 | ||
|
|
d42ecbe74e | ||
|
|
e6c5446d63 | ||
|
|
cc277211b3 | ||
|
|
6703c15c52 | ||
|
|
4ecdaf573e | ||
|
|
71ec3e61be | ||
|
|
216fdb2393 | ||
|
|
c39acc6e3c | ||
|
|
d97b0478a7 | ||
|
|
d15d64eb67 | ||
|
|
3acd2656ee | ||
|
|
a4b003534a | ||
|
|
8752538a02 | ||
|
|
bde435753a | ||
|
|
d347e6fc5f | ||
|
|
27b01d3642 | ||
|
|
b78677e285 | ||
|
|
f8f6c74bcb | ||
|
|
7ce123939b | ||
|
|
e7b02cfb15 | ||
|
|
5931077b08 | ||
|
|
a521bdc0e3 | ||
|
|
80da565609 | ||
|
|
6bc46e4598 | ||
|
|
6562258db5 | ||
|
|
c219995218 | ||
|
|
62035431ed | ||
|
|
fa1fbca7dc | ||
|
|
391b7476b3 | ||
|
|
9c04ce665f | ||
|
|
dd87268197 | ||
|
|
8d9af59db2 | ||
|
|
1b754a35ff | ||
|
|
7230f91f61 | ||
|
|
93edfc315c | ||
|
|
74c8269531 | ||
|
|
acb6c0fc83 | ||
|
|
553d4cce93 | ||
|
|
ca81f144e6 | ||
|
|
ec84960347 | ||
|
|
38db0764af | ||
|
|
a647f63bb0 | ||
|
|
5b7087cc9e | ||
|
|
1a6fcd5da6 | ||
|
|
e31dd9f553 | ||
|
|
22844716d1 | ||
|
|
6abed76f70 | ||
|
|
72ff502e0f | ||
|
|
2b781df32b | ||
|
|
bf601c3906 | ||
|
|
b753e0ebb0 | ||
|
|
564211aceb | ||
|
|
538c759fef | ||
|
|
95edc34100 | ||
|
|
98682a2da9 | ||
|
|
33581fa61d | ||
|
|
b02e0aae98 | ||
|
|
6fa4e1cb6d | ||
|
|
9f2ec22e95 | ||
|
|
65b2e506b1 | ||
|
|
8bc07b5286 | ||
|
|
fe0af63795 | ||
|
|
44ce7f4c67 | ||
|
|
252936134b | ||
|
|
e255b06945 | ||
|
|
d726568a23 | ||
|
|
66880a6de7 | ||
|
|
fda622a0c0 | ||
|
|
efa7d10f40 | ||
|
|
348a3fabab | ||
|
|
1bbaee605c | ||
|
|
22edf7a2b3 | ||
|
|
3ffcc29249 | ||
|
|
21f1fe52c0 | ||
|
|
99840c9e4f |
213
.clang-format
213
.clang-format
@@ -1,105 +1,216 @@
|
|||||||
BasedOnStyle: Chromium
|
---
|
||||||
Language: Cpp
|
Language: Cpp
|
||||||
Standard: Cpp11
|
# BasedOnStyle: LLVM
|
||||||
AccessModifierOffset: -1
|
AccessModifierOffset: -1
|
||||||
AlignAfterOpenBracket: false
|
AlignAfterOpenBracket: Align
|
||||||
AlignConsecutiveAssignments: false
|
AlignArrayOfStructures: None
|
||||||
AlignConsecutiveDeclarations: false
|
AlignConsecutiveAssignments:
|
||||||
AlignConsecutiveMacros: true
|
Enabled: false
|
||||||
AlignEscapedNewlines: true
|
AcrossEmptyLines: false
|
||||||
AlignOperands: false
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: true
|
||||||
|
AlignConsecutiveBitFields:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveDeclarations:
|
||||||
|
Enabled: false
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignConsecutiveMacros:
|
||||||
|
Enabled: true
|
||||||
|
AcrossEmptyLines: false
|
||||||
|
AcrossComments: false
|
||||||
|
AlignCompound: false
|
||||||
|
PadOperators: false
|
||||||
|
AlignEscapedNewlines: Left
|
||||||
|
AlignOperands: DontAlign
|
||||||
AlignTrailingComments: true
|
AlignTrailingComments: true
|
||||||
AllowAllArgumentsOnNextLine: false
|
AllowAllArgumentsOnNextLine: false
|
||||||
AllowAllConstructorInitializersOnNextLine: true
|
|
||||||
AllowAllParametersOfDeclarationOnNextLine: false
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
AllowShortBlocksOnASingleLine: false
|
AllowShortEnumsOnASingleLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: Never
|
||||||
AllowShortCaseLabelsOnASingleLine: true
|
AllowShortCaseLabelsOnASingleLine: true
|
||||||
AllowShortFunctionsOnASingleLine: true
|
AllowShortFunctionsOnASingleLine: All
|
||||||
AllowShortIfStatementsOnASingleLine: true
|
AllowShortLambdasOnASingleLine: All
|
||||||
AllowShortLambdasOnASingleLine: true
|
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
|
||||||
AllowShortLoopsOnASingleLine: true
|
AllowShortLoopsOnASingleLine: true
|
||||||
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
AlwaysBreakAfterReturnType: None
|
AlwaysBreakAfterReturnType: None
|
||||||
AlwaysBreakBeforeMultilineStrings: false
|
AlwaysBreakBeforeMultilineStrings: false
|
||||||
AlwaysBreakTemplateDeclarations: No
|
AlwaysBreakTemplateDeclarations: No
|
||||||
|
AttributeMacros:
|
||||||
|
- __capability
|
||||||
BinPackArguments: true
|
BinPackArguments: true
|
||||||
BinPackParameters: true
|
BinPackParameters: true
|
||||||
BreakBeforeBraces: false
|
BraceWrapping:
|
||||||
BreakBeforeBinaryOperators: false
|
AfterCaseLabel: false
|
||||||
BreakBeforeBraces: Stroustrup
|
AfterClass: false
|
||||||
BreakBeforeTernaryOperators: false
|
AfterControlStatement: Never
|
||||||
BreakConstructorInitializers: BeforeColon
|
AfterEnum: false
|
||||||
|
AfterFunction: false
|
||||||
|
AfterNamespace: false
|
||||||
|
AfterObjCDeclaration: false
|
||||||
|
AfterStruct: false
|
||||||
|
AfterUnion: false
|
||||||
|
AfterExternBlock: false
|
||||||
|
BeforeCatch: false
|
||||||
|
BeforeElse: true
|
||||||
|
BeforeLambdaBody: false
|
||||||
|
BeforeWhile: false
|
||||||
|
IndentBraces: false
|
||||||
|
SplitEmptyFunction: false
|
||||||
|
SplitEmptyRecord: false
|
||||||
|
SplitEmptyNamespace: false
|
||||||
|
BreakBeforeBinaryOperators: None
|
||||||
|
BreakBeforeConceptDeclarations: Always
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BreakBeforeInheritanceComma: false
|
||||||
BreakInheritanceList: BeforeColon
|
BreakInheritanceList: BeforeColon
|
||||||
|
BreakBeforeTernaryOperators: false
|
||||||
|
BreakConstructorInitializersBeforeComma: false
|
||||||
|
BreakConstructorInitializers: BeforeColon
|
||||||
|
BreakAfterJavaFieldAnnotations: false
|
||||||
BreakStringLiterals: false
|
BreakStringLiterals: false
|
||||||
ColumnLimit: 0
|
ColumnLimit: 0
|
||||||
|
CommentPragmas: '^ IWYU pragma:'
|
||||||
|
QualifierAlignment: Leave
|
||||||
CompactNamespaces: false
|
CompactNamespaces: false
|
||||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
|
||||||
ConstructorInitializerIndentWidth: 4
|
ConstructorInitializerIndentWidth: 4
|
||||||
ContinuationIndentWidth: 2
|
ContinuationIndentWidth: 2
|
||||||
Cpp11BracedListStyle: false
|
Cpp11BracedListStyle: false
|
||||||
DeriveLineEnding: true
|
DeriveLineEnding: true
|
||||||
DerivePointerAlignment: true
|
DerivePointerAlignment: false
|
||||||
DisableFormat: false
|
DisableFormat: false
|
||||||
ExperimentalAutoDetectBinPacking: true
|
EmptyLineAfterAccessModifier: Never
|
||||||
|
EmptyLineBeforeAccessModifier: LogicalBlock
|
||||||
|
ExperimentalAutoDetectBinPacking: false
|
||||||
|
PackConstructorInitializers: BinPack
|
||||||
|
BasedOnStyle: ''
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
||||||
|
AllowAllConstructorInitializersOnNextLine: true
|
||||||
FixNamespaceComments: true
|
FixNamespaceComments: true
|
||||||
IncludeBlocks: Preserve
|
ForEachMacros:
|
||||||
|
- foreach
|
||||||
|
- Q_FOREACH
|
||||||
|
- BOOST_FOREACH
|
||||||
|
IfMacros:
|
||||||
|
- KJ_IF_MAYBE
|
||||||
|
IncludeBlocks: Preserve
|
||||||
|
IncludeCategories:
|
||||||
|
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
||||||
|
Priority: 2
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||||
|
Priority: 3
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
- Regex: '.*'
|
||||||
|
Priority: 1
|
||||||
|
SortPriority: 0
|
||||||
|
CaseSensitive: false
|
||||||
|
IncludeIsMainRegex: '(Test)?$'
|
||||||
|
IncludeIsMainSourceRegex: ''
|
||||||
|
IndentAccessModifiers: false
|
||||||
IndentCaseLabels: true
|
IndentCaseLabels: true
|
||||||
|
IndentCaseBlocks: false
|
||||||
IndentGotoLabels: true
|
IndentGotoLabels: true
|
||||||
IndentPPDirectives: AfterHash
|
IndentPPDirectives: AfterHash
|
||||||
IndentWidth: 2
|
IndentExternBlock: AfterExternBlock
|
||||||
|
IndentRequiresClause: true
|
||||||
|
IndentWidth: 2
|
||||||
IndentWrappedFunctionNames: false
|
IndentWrappedFunctionNames: false
|
||||||
|
InsertBraces: false
|
||||||
|
InsertTrailingCommas: None
|
||||||
|
JavaScriptQuotes: Leave
|
||||||
|
JavaScriptWrapImports: true
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
LambdaBodyIndentation: Signature
|
||||||
|
MacroBlockBegin: ''
|
||||||
|
MacroBlockEnd: ''
|
||||||
MaxEmptyLinesToKeep: 100
|
MaxEmptyLinesToKeep: 100
|
||||||
NamespaceIndentation: None
|
NamespaceIndentation: None
|
||||||
|
ObjCBinPackProtocolList: Auto
|
||||||
ObjCBlockIndentWidth: 2
|
ObjCBlockIndentWidth: 2
|
||||||
|
ObjCBreakBeforeNestedBlockParam: true
|
||||||
ObjCSpaceAfterProperty: false
|
ObjCSpaceAfterProperty: false
|
||||||
ObjCSpaceBeforeProtocolList: false
|
ObjCSpaceBeforeProtocolList: true
|
||||||
PenaltyBreakAssignment: 0
|
PenaltyBreakAssignment: 0
|
||||||
PenaltyBreakBeforeFirstCallParameter: 0
|
PenaltyBreakBeforeFirstCallParameter: 0
|
||||||
PenaltyBreakComment: 0
|
PenaltyBreakComment: 0
|
||||||
PenaltyBreakFirstLessLess: 0
|
PenaltyBreakFirstLessLess: 0
|
||||||
|
PenaltyBreakOpenParenthesis: 0
|
||||||
PenaltyBreakString: 0
|
PenaltyBreakString: 0
|
||||||
PenaltyBreakTemplateDeclaration: 0
|
PenaltyBreakTemplateDeclaration: 0
|
||||||
PenaltyExcessCharacter: 0
|
PenaltyExcessCharacter: 0
|
||||||
PenaltyReturnTypeOnItsOwnLine: 0
|
PenaltyReturnTypeOnItsOwnLine: 0
|
||||||
|
PenaltyIndentedWhitespace: 0
|
||||||
PointerAlignment: Right
|
PointerAlignment: Right
|
||||||
ReflowComments: false
|
PPIndentWidth: -1
|
||||||
SortIncludes: false
|
ReferenceAlignment: Pointer
|
||||||
|
ReflowComments: false
|
||||||
|
RemoveBracesLLVM: false
|
||||||
|
RequiresClausePosition: OwnLine
|
||||||
|
SeparateDefinitionBlocks: Leave
|
||||||
|
ShortNamespaceLines: 1
|
||||||
|
SortIncludes: false
|
||||||
|
SortJavaStaticImport: Before
|
||||||
SortUsingDeclarations: false
|
SortUsingDeclarations: false
|
||||||
SpaceAfterCStyleCast: false
|
SpaceAfterCStyleCast: false
|
||||||
SpaceAfterLogicalNot: false
|
SpaceAfterLogicalNot: false
|
||||||
SpaceAfterTemplateKeyword: false
|
SpaceAfterTemplateKeyword: false
|
||||||
SpaceBeforeAssignmentOperators: true
|
SpaceBeforeAssignmentOperators: true
|
||||||
|
SpaceBeforeCaseColon: false
|
||||||
SpaceBeforeCpp11BracedList: true
|
SpaceBeforeCpp11BracedList: true
|
||||||
SpaceBeforeCtorInitializerColon: true
|
SpaceBeforeCtorInitializerColon: true
|
||||||
SpaceBeforeInheritanceColon: true
|
SpaceBeforeInheritanceColon: true
|
||||||
SpaceBeforeParens: ControlStatements
|
SpaceBeforeParens: ControlStatements
|
||||||
|
SpaceBeforeParensOptions:
|
||||||
|
AfterControlStatements: true
|
||||||
|
AfterForeachMacros: true
|
||||||
|
AfterFunctionDefinitionName: false
|
||||||
|
AfterFunctionDeclarationName: false
|
||||||
|
AfterIfMacros: true
|
||||||
|
AfterOverloadedOperator: false
|
||||||
|
AfterRequiresInClause: false
|
||||||
|
AfterRequiresInExpression: false
|
||||||
|
BeforeNonEmptyParentheses: false
|
||||||
|
SpaceAroundPointerQualifiers: Default
|
||||||
SpaceBeforeRangeBasedForLoopColon: true
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
SpaceBeforeSquareBrackets: false
|
|
||||||
SpaceInEmptyBlock: false
|
SpaceInEmptyBlock: false
|
||||||
SpaceInEmptyParentheses: false
|
SpaceInEmptyParentheses: false
|
||||||
SpacesBeforeTrailingComments: 2
|
SpacesBeforeTrailingComments: 2
|
||||||
SpacesInAngles: false
|
SpacesInAngles: Never
|
||||||
SpacesInCStyleCastParentheses: false
|
|
||||||
SpacesInConditionalStatement: false
|
SpacesInConditionalStatement: false
|
||||||
SpacesInContainerLiterals: true
|
SpacesInContainerLiterals: true
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
|
SpacesInLineCommentPrefix:
|
||||||
|
Minimum: 1
|
||||||
|
Maximum: -1
|
||||||
SpacesInParentheses: false
|
SpacesInParentheses: false
|
||||||
SpacesInSquareBrackets: false
|
SpacesInSquareBrackets: false
|
||||||
UseCRLF: false
|
SpaceBeforeSquareBrackets: false
|
||||||
UseTab: Never
|
BitFieldColonSpacing: Both
|
||||||
BreakBeforeBraces: Custom
|
Standard: Latest
|
||||||
BraceWrapping:
|
StatementAttributeLikeMacros:
|
||||||
AfterFunction: false
|
- Q_EMIT
|
||||||
AfterCaseLabel: false
|
StatementMacros:
|
||||||
AfterStruct: false
|
- Q_UNUSED
|
||||||
AfterClass: false
|
- QT_REQUIRE_VERSION
|
||||||
AfterEnum: false
|
TabWidth: 8
|
||||||
AfterUnion: false
|
UseCRLF: false
|
||||||
AfterControlStatement: Never
|
UseTab: Never
|
||||||
AfterNamespace: false
|
WhitespaceSensitiveMacros:
|
||||||
AfterObjCDeclaration: false
|
- STRINGIZE
|
||||||
AfterExternBlock: false
|
- PP_STRINGIZE
|
||||||
BeforeCatch: false
|
- BOOST_PP_STRINGIZE
|
||||||
BeforeElse: true
|
- NS_SWIFT_NAME
|
||||||
SplitEmptyFunction: false
|
- CF_SWIFT_NAME
|
||||||
SplitEmptyRecord: false
|
...
|
||||||
SplitEmptyNamespace: false
|
|
||||||
|
|||||||
10
.github/ISSUE_TEMPLATE.md
vendored
10
.github/ISSUE_TEMPLATE.md
vendored
@@ -7,13 +7,9 @@ assignees: ''
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
For technical issues, questions and discussion please use the forum on https://forum.strawberrymusicplayer.org/
|
- [ ] I have checked the [FAQ](https://wiki.strawberrymusicplayer.org/wiki/FAQ) for answers.
|
||||||
Any issues related to feature requests will be closed. See the README for more details.
|
- [ ] I have checked the [Changelog](https://github.com/strawberrymusicplayer/strawberry/blob/master/Changelog) that the issue is not already fixed.
|
||||||
|
- [ ] I believe this issue is a bug, and not a general technical issue, question or feature requests that can be discussed on the [forum](https://forum.strawberrymusicplayer.org/).
|
||||||
Check the Changelog to see if the issue is already fixed:
|
|
||||||
https://github.com/strawberrymusicplayer/strawberry/blob/master/Changelog
|
|
||||||
|
|
||||||
If it's fixed, try the latest development build from: https://builds.strawberrymusicplayer.org/
|
|
||||||
|
|
||||||
**Describe the bug**
|
**Describe the bug**
|
||||||
A clear and concise description of what the bug is.
|
A clear and concise description of what the bug is.
|
||||||
|
|||||||
1054
.github/workflows/build.yml
vendored
Normal file
1054
.github/workflows/build.yml
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2237
.github/workflows/ccpp.yml
vendored
2237
.github/workflows/ccpp.yml
vendored
File diff suppressed because it is too large
Load Diff
39
.gitignore
vendored
39
.gitignore
vendored
@@ -65,19 +65,6 @@ ui_*.h
|
|||||||
*.moc
|
*.moc
|
||||||
*.qm
|
*.qm
|
||||||
|
|
||||||
# QtCreator
|
|
||||||
CMakeLists.txt.user*
|
|
||||||
*.pro.user
|
|
||||||
*.pro.user.*
|
|
||||||
*creator.user*
|
|
||||||
target_wrapper.*
|
|
||||||
compile_commands.json
|
|
||||||
|
|
||||||
*.kdev4
|
|
||||||
*.vscode
|
|
||||||
*.code-workspace
|
|
||||||
*.sublime-workspace
|
|
||||||
|
|
||||||
# Temporary files
|
# Temporary files
|
||||||
*~
|
*~
|
||||||
*.autosave
|
*.autosave
|
||||||
@@ -111,15 +98,23 @@ translations.pot
|
|||||||
zanata.xml
|
zanata.xml
|
||||||
.zanata-cache/
|
.zanata-cache/
|
||||||
|
|
||||||
# Snap
|
# QtCreator
|
||||||
parts/
|
CMakeLists.txt.user*
|
||||||
prime/
|
*.pro.user
|
||||||
stage/
|
*.pro.user.*
|
||||||
*.snap
|
*creator.user*
|
||||||
/snap/.snapcraft/
|
target_wrapper.*
|
||||||
/*_source.tar.bz2
|
compile_commands.json
|
||||||
|
|
||||||
|
*.kdev4
|
||||||
|
*.vscode
|
||||||
|
*.code-workspace
|
||||||
|
*.sublime-workspace
|
||||||
|
|
||||||
# MSVC
|
# MSVC
|
||||||
CMakeSettings.json
|
CMakeSettings.json
|
||||||
/.vs/
|
/.vs
|
||||||
/out/
|
/out
|
||||||
|
|
||||||
|
# CLion
|
||||||
|
/.idea
|
||||||
|
|||||||
43
3rdparty/macdeployqt/shared.cpp
vendored
43
3rdparty/macdeployqt/shared.cpp
vendored
@@ -40,6 +40,8 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QVariant>
|
||||||
|
#include <QVariantMap>
|
||||||
#include <QStack>
|
#include <QStack>
|
||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
@@ -187,9 +189,7 @@ OtoolInfo findDependencyInfo(const QString &binaryPath)
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const QRegularExpression regexp(QStringLiteral(
|
static const QRegularExpression regexp(QStringLiteral("^\\t(.+) \\(compatibility version (\\d+\\.\\d+\\.\\d+), current version (\\d+\\.\\d+\\.\\d+)(, weak|, reexport)?\\)$"));
|
||||||
"^\\t(.+) \\(compatibility version (\\d+\\.\\d+\\.\\d+), "
|
|
||||||
"current version (\\d+\\.\\d+\\.\\d+)(, weak)?\\)$"));
|
|
||||||
|
|
||||||
QString output = otool.readAllStandardOutput();
|
QString output = otool.readAllStandardOutput();
|
||||||
QStringList outputLines = output.split("\n", Qt::SkipEmptyParts);
|
QStringList outputLines = output.split("\n", Qt::SkipEmptyParts);
|
||||||
@@ -220,6 +220,8 @@ OtoolInfo findDependencyInfo(const QString &binaryPath)
|
|||||||
for (const QString &outputLine : outputLines) {
|
for (const QString &outputLine : outputLines) {
|
||||||
const auto match = regexp.match(outputLine);
|
const auto match = regexp.match(outputLine);
|
||||||
if (match.hasMatch()) {
|
if (match.hasMatch()) {
|
||||||
|
if (match.captured(1) == info.installName)
|
||||||
|
continue; // Another arch reference to the same binary
|
||||||
DylibInfo dylib;
|
DylibInfo dylib;
|
||||||
dylib.binaryPath = match.captured(1);
|
dylib.binaryPath = match.captured(1);
|
||||||
dylib.compatibilityVersion = QVersionNumber::fromString(match.captured(2));
|
dylib.compatibilityVersion = QVersionNumber::fromString(match.captured(2));
|
||||||
@@ -300,11 +302,11 @@ FrameworkInfo parseOtoolLibraryLine(const QString &line, const QString &appBundl
|
|||||||
if (state == QtPath) {
|
if (state == QtPath) {
|
||||||
// Check for library name part
|
// Check for library name part
|
||||||
if (part < parts.count() && parts.at(part).contains(".dylib")) {
|
if (part < parts.count() && parts.at(part).contains(".dylib")) {
|
||||||
info.frameworkDirectory += "/" + (qtPath + currentPart + "/").simplified();
|
info.frameworkDirectory += "/" + QString(qtPath + currentPart + "/").simplified();
|
||||||
state = DylibName;
|
state = DylibName;
|
||||||
continue;
|
continue;
|
||||||
} else if (part < parts.count() && parts.at(part).endsWith(".framework")) {
|
} else if (part < parts.count() && parts.at(part).endsWith(".framework")) {
|
||||||
info.frameworkDirectory += "/" + (qtPath + "lib/").simplified();
|
info.frameworkDirectory += "/" + QString(qtPath + "lib/").simplified();
|
||||||
state = FrameworkName;
|
state = FrameworkName;
|
||||||
continue;
|
continue;
|
||||||
} else if (trimmed.startsWith("/") == false) { // If the line does not contain a full path, the app is using a binary Qt package.
|
} else if (trimmed.startsWith("/") == false) { // If the line does not contain a full path, the app is using a binary Qt package.
|
||||||
@@ -865,6 +867,18 @@ void changeInstallName(const QString &bundlePath, const FrameworkInfo &framework
|
|||||||
if (!framework.installName.isEmpty() && framework.installName != framework.sourceFilePath) {
|
if (!framework.installName.isEmpty() && framework.installName != framework.sourceFilePath) {
|
||||||
changeInstallName(framework.installName, deployedInstallName, binary);
|
changeInstallName(framework.installName, deployedInstallName, binary);
|
||||||
}
|
}
|
||||||
|
// Workaround for the case when the library ID name is a symlink, while the dependencies
|
||||||
|
// specified using the canonical path to the library (QTBUG-56814)
|
||||||
|
QFileInfo fileInfo= QFileInfo(framework.installName);
|
||||||
|
QString canonicalInstallName = fileInfo.canonicalFilePath();
|
||||||
|
if (!canonicalInstallName.isEmpty() && canonicalInstallName != framework.installName) {
|
||||||
|
changeInstallName(canonicalInstallName, deployedInstallName, binary);
|
||||||
|
// some libraries' inner dependencies (such as ffmpeg, nettle) use symbol link (QTBUG-100093)
|
||||||
|
QString innerDependency = fileInfo.canonicalPath() + "/" + fileInfo.fileName();
|
||||||
|
if (innerDependency != canonicalInstallName && innerDependency != framework.installName) {
|
||||||
|
changeInstallName(innerDependency, deployedInstallName, binary);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1078,7 +1092,7 @@ QString getLibInfix(const QStringList &deployedFrameworks)
|
|||||||
{
|
{
|
||||||
QString libInfix;
|
QString libInfix;
|
||||||
for (const QString &framework : deployedFrameworks) {
|
for (const QString &framework : deployedFrameworks) {
|
||||||
if (framework.startsWith(QStringLiteral("QtCore")) && framework.endsWith(QStringLiteral(".framework"))) {
|
if (framework.startsWith(QStringLiteral("QtCore")) && framework.endsWith(QStringLiteral(".framework")) && !framework.contains(QStringLiteral("5Compat"))) {
|
||||||
Q_ASSERT(framework.length() >= 16);
|
Q_ASSERT(framework.length() >= 16);
|
||||||
// 16 == "QtCore" + ".framework"
|
// 16 == "QtCore" + ".framework"
|
||||||
const int lengthOfLibInfix = framework.length() - 16;
|
const int lengthOfLibInfix = framework.length() - 16;
|
||||||
@@ -1277,6 +1291,7 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl
|
|||||||
|
|
||||||
// GStreamer plugins.
|
// GStreamer plugins.
|
||||||
QStringList gstreamer_plugins = QStringList()
|
QStringList gstreamer_plugins = QStringList()
|
||||||
|
<< "libgstaes.dylib"
|
||||||
<< "libgstaiff.dylib"
|
<< "libgstaiff.dylib"
|
||||||
<< "libgstapetag.dylib"
|
<< "libgstapetag.dylib"
|
||||||
<< "libgstapp.dylib"
|
<< "libgstapp.dylib"
|
||||||
@@ -1295,13 +1310,16 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl
|
|||||||
<< "libgstcoreelements.dylib"
|
<< "libgstcoreelements.dylib"
|
||||||
<< "libgstdash.dylib"
|
<< "libgstdash.dylib"
|
||||||
<< "libgstequalizer.dylib"
|
<< "libgstequalizer.dylib"
|
||||||
<< "libgstflac.dylib"
|
|
||||||
<< "libgstfaac.dylib"
|
<< "libgstfaac.dylib"
|
||||||
<< "libgstfaad.dylib"
|
<< "libgstfaad.dylib"
|
||||||
<< "libgstfdkaac.dylib"
|
<< "libgstfdkaac.dylib"
|
||||||
|
<< "libgstflac.dylib"
|
||||||
<< "libgstgio.dylib"
|
<< "libgstgio.dylib"
|
||||||
|
//<< "libgstgme.dylib"
|
||||||
|
<< "libgsthls.dylib"
|
||||||
<< "libgsticydemux.dylib"
|
<< "libgsticydemux.dylib"
|
||||||
<< "libgstid3demux.dylib"
|
<< "libgstid3demux.dylib"
|
||||||
|
<< "libgstid3tag.dylib"
|
||||||
<< "libgstisomp4.dylib"
|
<< "libgstisomp4.dylib"
|
||||||
<< "libgstlame.dylib"
|
<< "libgstlame.dylib"
|
||||||
<< "libgstlibav.dylib"
|
<< "libgstlibav.dylib"
|
||||||
@@ -1322,14 +1340,15 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl
|
|||||||
<< "libgstspeex.dylib"
|
<< "libgstspeex.dylib"
|
||||||
<< "libgsttaglib.dylib"
|
<< "libgsttaglib.dylib"
|
||||||
<< "libgsttcp.dylib"
|
<< "libgsttcp.dylib"
|
||||||
|
<< "libgsttwolame.dylib"
|
||||||
<< "libgsttypefindfunctions.dylib"
|
<< "libgsttypefindfunctions.dylib"
|
||||||
<< "libgstudp.dylib"
|
<< "libgstudp.dylib"
|
||||||
<< "libgstvolume.dylib"
|
<< "libgstvolume.dylib"
|
||||||
<< "libgstvorbis.dylib"
|
<< "libgstvorbis.dylib"
|
||||||
|
<< "libgstwavenc.dylib"
|
||||||
<< "libgstwavpack.dylib"
|
<< "libgstwavpack.dylib"
|
||||||
<< "libgstwavparse.dylib"
|
<< "libgstwavparse.dylib"
|
||||||
<< "libgstxingmux.dylib"
|
<< "libgstxingmux.dylib";
|
||||||
<< "libgsthls.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()) {
|
||||||
@@ -1469,9 +1488,9 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf
|
|||||||
for (const QString &importPath : qmlImportPaths)
|
for (const QString &importPath : qmlImportPaths)
|
||||||
argumentList << "-importPath" << importPath;
|
argumentList << "-importPath" << importPath;
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
QString qmlImportsPath = QLibraryInfo::path(QLibraryInfo::Qml2ImportsPath);
|
QString qmlImportsPath = QLibraryInfo::path(QLibraryInfo::QmlImportsPath);
|
||||||
#else
|
#else
|
||||||
QString qmlImportsPath = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
|
QString qmlImportsPath = QLibraryInfo::location(QLibraryInfo::QmlImportsPath);
|
||||||
#endif
|
#endif
|
||||||
argumentList.append( "-importPath");
|
argumentList.append( "-importPath");
|
||||||
argumentList.append(qmlImportsPath);
|
argumentList.append(qmlImportsPath);
|
||||||
@@ -1483,7 +1502,7 @@ bool deployQmlImports(const QString &appBundlePath, DeploymentInfo deploymentInf
|
|||||||
LogError() << "Could not start qmlimpoortscanner. Process error is" << qmlImportScanner.errorString();
|
LogError() << "Could not start qmlimpoortscanner. Process error is" << qmlImportScanner.errorString();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
qmlImportScanner.waitForFinished();
|
qmlImportScanner.waitForFinished(-1);
|
||||||
|
|
||||||
// log qmlimportscanner errors
|
// log qmlimportscanner errors
|
||||||
qmlImportScanner.setReadChannel(QProcess::StandardError);
|
qmlImportScanner.setReadChannel(QProcess::StandardError);
|
||||||
|
|||||||
2
3rdparty/singleapplication/CMakeLists.txt
vendored
2
3rdparty/singleapplication/CMakeLists.txt
vendored
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
|
|
||||||
include(CheckIncludeFiles)
|
include(CheckIncludeFiles)
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.7)
|
||||||
|
|
||||||
project(strawberry)
|
project(strawberry)
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.0)
|
|
||||||
cmake_policy(SET CMP0054 NEW)
|
cmake_policy(SET CMP0054 NEW)
|
||||||
|
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12)
|
||||||
|
cmake_policy(SET CMP0074 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
include(CheckCXXCompilerFlag)
|
include(CheckCXXCompilerFlag)
|
||||||
include(CheckCXXSourceRuns)
|
include(CheckCXXSourceRuns)
|
||||||
@@ -12,13 +16,13 @@ include(cmake/Summary.cmake)
|
|||||||
include(cmake/OptionalSource.cmake)
|
include(cmake/OptionalSource.cmake)
|
||||||
include(cmake/ParseArguments.cmake)
|
include(cmake/ParseArguments.cmake)
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
set(LINUX ON)
|
set(LINUX ON)
|
||||||
endif()
|
endif()
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
||||||
set(FREEBSD ON)
|
set(FREEBSD ON)
|
||||||
endif()
|
endif()
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
|
if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
||||||
set(OPENBSD ON)
|
set(OPENBSD ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -68,23 +72,22 @@ else()
|
|||||||
$<$<COMPILE_LANGUAGE:CXX>:-Woverloaded-virtual>
|
$<$<COMPILE_LANGUAGE:CXX>:-Woverloaded-virtual>
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast>
|
$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast>
|
||||||
)
|
)
|
||||||
endif()
|
option(BUILD_WERROR "Build with -Werror" OFF)
|
||||||
|
if(BUILD_WERROR)
|
||||||
option(BUILD_WERROR "Build with -Werror" OFF)
|
list(APPEND COMPILE_OPTIONS -Werror)
|
||||||
if(BUILD_WERROR)
|
endif()
|
||||||
list(APPEND COMPILE_OPTIONS -Werror)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_compile_options(${COMPILE_OPTIONS})
|
add_compile_options(${COMPILE_OPTIONS})
|
||||||
|
|
||||||
if(${CMAKE_BUILD_TYPE} MATCHES "Release")
|
if(CMAKE_BUILD_TYPE MATCHES "Release")
|
||||||
add_definitions(-DNDEBUG)
|
add_definitions(-DNDEBUG)
|
||||||
add_definitions(-DQT_NO_DEBUG_OUTPUT)
|
add_definitions(-DQT_NO_DEBUG_OUTPUT)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
option(USE_RPATH "Use RPATH" APPLE)
|
||||||
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
if(USE_RPATH)
|
||||||
set(CMAKE_INSTALL_RPATH "@loader_path/../Frameworks")
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_program(CCACHE_EXECUTABLE NAMES ccache)
|
find_program(CCACHE_EXECUTABLE NAMES ccache)
|
||||||
@@ -94,6 +97,8 @@ if(CCACHE_EXECUTABLE)
|
|||||||
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_EXECUTABLE})
|
SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_EXECUTABLE})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
option(USE_ICU "Use ICU" ON)
|
||||||
|
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
find_package(Boost REQUIRED)
|
find_package(Boost REQUIRED)
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
@@ -101,7 +106,14 @@ find_package(Backtrace)
|
|||||||
if(Backtrace_FOUND)
|
if(Backtrace_FOUND)
|
||||||
set(HAVE_BACKTRACE ON)
|
set(HAVE_BACKTRACE ON)
|
||||||
endif()
|
endif()
|
||||||
find_package(Iconv)
|
if(USE_ICU)
|
||||||
|
find_package(ICU COMPONENTS uc i18n REQUIRED)
|
||||||
|
if(ICU_FOUND)
|
||||||
|
set(HAVE_ICU ON)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
find_package(Iconv)
|
||||||
|
endif()
|
||||||
find_package(GnuTLS REQUIRED)
|
find_package(GnuTLS REQUIRED)
|
||||||
find_package(Protobuf REQUIRED)
|
find_package(Protobuf REQUIRED)
|
||||||
if(NOT Protobuf_PROTOC_EXECUTABLE)
|
if(NOT Protobuf_PROTOC_EXECUTABLE)
|
||||||
@@ -500,9 +512,12 @@ endif()
|
|||||||
add_definitions(
|
add_definitions(
|
||||||
-DBOOST_BIND_NO_PLACEHOLDERS
|
-DBOOST_BIND_NO_PLACEHOLDERS
|
||||||
-DQT_STRICT_ITERATORS
|
-DQT_STRICT_ITERATORS
|
||||||
|
-DQT_NO_CAST_FROM_BYTEARRAY
|
||||||
-DQT_USE_QSTRINGBUILDER
|
-DQT_USE_QSTRINGBUILDER
|
||||||
-DQT_NO_URL_CAST_FROM_STRING
|
-DQT_NO_URL_CAST_FROM_STRING
|
||||||
-DQT_NO_CAST_TO_ASCII
|
-DQT_NO_CAST_TO_ASCII
|
||||||
|
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
|
||||||
|
-DQT_NO_FOREACH
|
||||||
)
|
)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|||||||
116
Changelog
116
Changelog
@@ -2,10 +2,114 @@ Strawberry Music Player
|
|||||||
=======================
|
=======================
|
||||||
ChangeLog
|
ChangeLog
|
||||||
|
|
||||||
|
Version 1.0.14 (2023.01.13):
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fix initial volume not set when using Auto as output (#1104).
|
||||||
|
* Fix saving moodbar if the URL contains host, ie.: UNC paths for SMB (#1101).
|
||||||
|
* Fix CollectionBackendTest compile error (#1100).
|
||||||
|
* Remove explicitly enabling debug messages (#1106).
|
||||||
|
|
||||||
|
Version 1.0.13 (2023.01.09):
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fixed volume synchronization leading to infinite loop resulting in crash when adjusting volume while playing (#1089).
|
||||||
|
* Fixed incorrect volume.
|
||||||
|
* Fixed collection organizing incorrectly handling slashes inside {} brackets for variables (#1091).
|
||||||
|
* Fixed saving relative playlists to non-existing playlist files (#1092).
|
||||||
|
* Fixed intermittent crash on collection model query (#1095).
|
||||||
|
* Require system icons for fancy tabbar and settings sidebar to be larger than 22x22 (#1084).
|
||||||
|
|
||||||
|
Version 1.0.12 (2023.01.02):
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fixed crash when adjusting volume with mouse wheel (#1089).
|
||||||
|
* Fixed playback stopping in certain cases where the next track was unavailable (#958).
|
||||||
|
* (Windows) Apply patch for fonts too large on High DPI screen (QTBUG-108593).
|
||||||
|
|
||||||
|
Removed features:
|
||||||
|
* Removed appearance settings for changing palette colors, it was never properly implemented.
|
||||||
|
|
||||||
|
Version 1.0.11 (2022.12.30):
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Capitalize GLib application name so it appears nicely in GNOME and PulseAudio Volume Control (#1066).
|
||||||
|
* Fixed missing application icon for PulseAudio Volume Control (#1066).
|
||||||
|
* Ignore errors for missing albums when updating Tidal collection if there are results (#1061).
|
||||||
|
* Only run periodic collection scan when moitoring collection setting is on.
|
||||||
|
* Fixed an edge case where the context headline text was being cut short (#1067).
|
||||||
|
* Made "Show in file browser" support SpaceFM filemanager (#1073).
|
||||||
|
* Fixed incorrect tab order in edit tag dialog (#1075).
|
||||||
|
* Changed "FMPS_PlayCount" to "FMPS_Playcount" when saving tag (#1074).
|
||||||
|
* Fixed compilation tag read and write for MP4 (#1076).
|
||||||
|
* Removed incorrect use of "TPE1" for performer when reading ID3 tags (#1076).
|
||||||
|
* Disable tag fields for unsupported tags in tag editor.
|
||||||
|
* Don't allow organizing files without unique tags (track or title) for filename (#1077).
|
||||||
|
* Don't remove disc from album title when creating cover hash to allow different covers for each disc on an album (#1069).
|
||||||
|
* Fixed incorrect relative paths for song filenames when saving playlists if the saved playlist location is a symablic link to the song filename (#1071).
|
||||||
|
* Scrobble "Various Artists" as album artist (#1082).
|
||||||
|
|
||||||
|
Enhancements:
|
||||||
|
* Use system volume instead of own software volume when available (#1037).
|
||||||
|
* Improved Tidal and Qobuz support with timed requests.
|
||||||
|
* Support MPRIS2 xesam:userRating.
|
||||||
|
|
||||||
|
Version 1.0.10 (2022.10.21):
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fixed "Could not open settings file for writing: No such file or directory" error before settings file is created.
|
||||||
|
* Fixed visual glitch on currently playing track (#1051).
|
||||||
|
* Fixed "Unknown error" on Tidal search (#1047).
|
||||||
|
* Fixed incomplete lyrics from Genius.
|
||||||
|
* Fixed icons not showing in the file view on some systems (#1024).
|
||||||
|
* Fixed issues with context and playing widget stopping when using VLC (#1054).
|
||||||
|
* (macOS) Fixed search field related crash when playlist toolbar is turned off.
|
||||||
|
|
||||||
|
Enhancements:
|
||||||
|
* Fixed narrowing conversions in connects.
|
||||||
|
* Fixed casts from QByteArray.
|
||||||
|
* Removed subdir for generated dbus files
|
||||||
|
* Removed use of fixed font in context (#1040).
|
||||||
|
* Improve Musixmatch lyrics search.
|
||||||
|
|
||||||
|
Version 1.0.9 (2022.09.03):
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fixed parsing album title from radio stream metadata (#1023).
|
||||||
|
* (macOS) Fixed Strawberry not starting, incorrect rpath for libgcc_s.1.1.dylib (#1025).
|
||||||
|
* (macOS) Fixed HTTP streaming.
|
||||||
|
|
||||||
|
Version 1.0.8 (2022.08.29):
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fixed backslash being appended to filter text when switching playlist (#1005).
|
||||||
|
* Fixed OSD notifications service registering taking too long to timeout when not available.
|
||||||
|
* Fixed radio stream added twice when double-clicked (#1015).
|
||||||
|
* Fixed translating undo and redo buttons (#1017).
|
||||||
|
|
||||||
|
Enhancements:
|
||||||
|
* Use ICU instead of iconv to transliterate characters for filenames.
|
||||||
|
* Make separating albums by grouping tag optional in collection group by album.
|
||||||
|
* Added support for video game music formats VGM and SPC.
|
||||||
|
* Added setting for explicitly turning on HTTP/2 for streaming. Strawberry will set the
|
||||||
|
libsoup SOUP_FORCE_HTTP1 environment variable when the HTTP/2 is not checked (#1016).
|
||||||
|
* (Windows|MSVC) Install Visual C++ runtime redistributable automatically in installer.
|
||||||
|
|
||||||
|
Version 1.0.7 (2022.07.25)
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Fixed checking file extension case-insensitive when loading and saving playlists.
|
||||||
|
* Fixed reading and saving rating with TagParser.
|
||||||
|
* (macOS/Windows) Fixed playlist column alignment. Applied patch for Qt bug QTBUG-103576 (#999).
|
||||||
|
* (Windows|MinGW) Fixed HLS streaming.
|
||||||
|
* (Windows|MSVC) Fixed MP3 encoding.
|
||||||
|
|
||||||
|
Enhancements
|
||||||
|
* Added option for selecting file extension when saving all playlists.
|
||||||
|
|
||||||
Version 1.0.6 (2022.07.17)
|
Version 1.0.6 (2022.07.17)
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
|
||||||
* Fixed certain albums not added to playlist in correct track order from search for Tidal and QObuz.
|
* Fixed certain albums not added to playlist in correct track order from search for Tidal and QObuz.
|
||||||
* Fixed songs not added to playlist in numeric order when added from file view with right click (#977).
|
* Fixed songs not added to playlist in numeric order when added from file view with right click (#977).
|
||||||
* Fixed "Stop after this track" graying out next track in dynamic mode (#912).
|
* Fixed "Stop after this track" graying out next track in dynamic mode (#912).
|
||||||
@@ -198,7 +302,7 @@ 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.
|
||||||
* Check that the clicked rating position is to the right or left of the rectangle.
|
* Check that the clicked rating position is to the right or left of the rectangle.
|
||||||
* Fix rescan when collection directory is removed and readded.
|
* Fix rescan when collection directory is removed and re-added.
|
||||||
* Create GLib main event loop on non-glib systems to fix stream discoverer.
|
* Create GLib main event loop on non-glib systems to fix stream discoverer.
|
||||||
* (macOS) Fix intermittent abort on startup.
|
* (macOS) Fix intermittent abort on startup.
|
||||||
* (macOS) Fix Tidal and Qobuz search field not showing.
|
* (macOS) Fix Tidal and Qobuz search field not showing.
|
||||||
@@ -535,7 +639,7 @@ Version 0.6.10 (2020.05.01)
|
|||||||
* Made font and font sizes in context configurable.
|
* Made font and font sizes in context configurable.
|
||||||
* Splitting artist and song title to the relevant metadata when artist and song title is sent as title separated by a dash in streams.
|
* Splitting artist and song title to the relevant metadata when artist and song title is sent as title separated by a dash in streams.
|
||||||
* Added label to show collection pixmap disk cache used in settings.
|
* Added label to show collection pixmap disk cache used in settings.
|
||||||
* Icreased default collection pixmap disk cache to 360.
|
* Increased default collection pixmap disk cache to 360.
|
||||||
|
|
||||||
New features:
|
New features:
|
||||||
* Added back Tidal streaming support.
|
* Added back Tidal streaming support.
|
||||||
@@ -603,7 +707,7 @@ Version 0.6.7 (2019.11.27)
|
|||||||
* Fixed "Pressing Previous in player" behaviour setting
|
* Fixed "Pressing Previous in player" behaviour setting
|
||||||
* Fixed updating compilations where there are spaces or special characters in filenames
|
* Fixed updating compilations where there are spaces or special characters in filenames
|
||||||
* Fixed cases where songs were stuck in "Various Artists" because not all songs in
|
* Fixed cases where songs were stuck in "Various Artists" because not all songs in
|
||||||
the same compilation was removed from the model before readded with actual artist.
|
the same compilation was removed from the model before re-added with actual artist.
|
||||||
* Fixed a bug when importing playlists where metadata was reset
|
* Fixed a bug when importing playlists where metadata was reset
|
||||||
* Fixed scrobbler to also scrobble songs without album title
|
* Fixed scrobbler to also scrobble songs without album title
|
||||||
* Fixed text for replay gain setting not loading in backend setting
|
* Fixed text for replay gain setting not loading in backend setting
|
||||||
@@ -956,7 +1060,7 @@ Version 0.1.5 (2018.05.16)
|
|||||||
|
|
||||||
|
|
||||||
Version 0.1.4 (2018.05.14)
|
Version 0.1.4 (2018.05.14)
|
||||||
* Fixed compliation with clang compiler
|
* Fixed compilation 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.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
16
README.md
16
README.md
@@ -1,4 +1,4 @@
|
|||||||
:strawberry: Strawberry Music Player [](https://github.com/strawberrymusicplayer/strawberry/actions)
|
:strawberry: Strawberry Music Player [](https://github.com/strawberrymusicplayer/strawberry/actions)
|
||||||
=======================
|
=======================
|
||||||
[](https://github.com/sponsors/jonaski)
|
[](https://github.com/sponsors/jonaski)
|
||||||
[](https://patreon.com/jonaskvinge)
|
[](https://patreon.com/jonaskvinge)
|
||||||
@@ -23,6 +23,7 @@ Resources:
|
|||||||
|
|
||||||
### :bangbang: Opening an issue:
|
### :bangbang: Opening an issue:
|
||||||
|
|
||||||
|
* Read the FAQ: https://wiki.strawberrymusicplayer.org/wiki/FAQ
|
||||||
* Search for the issue to see if it is already solved, or if there is an open issue for it already. If there is an open issue already, you can comment on it if you have additional information that could be useful to us.
|
* Search for the issue to see if it is already solved, or if there is an open issue for it already. If there is an open issue already, you can comment on it if you have additional information that could be useful to us.
|
||||||
* For technical problems, discussion, questions and feature suggestions use the forum (https://forum.strawberrymusicplayer.org/) instead. The forum is better suited for discussion.
|
* For technical problems, discussion, questions and feature suggestions use the forum (https://forum.strawberrymusicplayer.org/) instead. The forum is better suited for discussion.
|
||||||
* We do not take feature requests from users on GitHub. Any issues related to feature requests will be closed. This does not necessarily mean that we won't add new features, but we don't have time to take feature requests or answer questions about new features from users. It is still possible to suggest or discuss new features on the forum (https://forum.strawberrymusicplayer.org/).
|
* We do not 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/).
|
||||||
@@ -68,10 +69,11 @@ 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/)
|
||||||
* [GCC](https://gcc.gnu.org/), [Clang](https://clang.llvm.org/) or [MSVC](https://visualstudio.microsoft.com/vs/features/cplusplus/) compiler
|
* C/C++ compiler ([GCC](https://gcc.gnu.org/), [Clang](https://clang.llvm.org/) or [MSVC](https://visualstudio.microsoft.com/vs/features/cplusplus/))
|
||||||
|
* [pkg-config](https://www.freedesktop.org/wiki/Software/pkg-config/) or [pkgconf](https://github.com/pkgconf/pkgconf)
|
||||||
* [Boost](https://www.boost.org/)
|
* [Boost](https://www.boost.org/)
|
||||||
* [GLib](https://developer.gnome.org/glib/)
|
* [GLib](https://developer.gnome.org/glib/)
|
||||||
* [Qt 5.9 or higher (or Qt 6) with components Core, Gui, Widgets, Concurrent, Network and Sql](https://www.qt.io/)
|
* [Qt 6 or Qt 5.9 or higher 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)
|
||||||
* [Protobuf](https://developers.google.com/protocol-buffers/)
|
* [Protobuf](https://developers.google.com/protocol-buffers/)
|
||||||
* [ALSA (Required on Linux)](https://www.alsa-project.org/)
|
* [ALSA (Required on Linux)](https://www.alsa-project.org/)
|
||||||
@@ -79,6 +81,7 @@ To build Strawberry from source you need the following installed on your system
|
|||||||
* [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)
|
||||||
|
* [ICU](https://unicode-org.github.io/icu/)
|
||||||
|
|
||||||
Optional dependencies:
|
Optional dependencies:
|
||||||
|
|
||||||
@@ -100,15 +103,18 @@ You should also install the gstreamer plugins base and good, and optionally bad,
|
|||||||
### Compile and install:
|
### Compile and install:
|
||||||
|
|
||||||
cd strawberry
|
cd strawberry
|
||||||
mkdir build && cd build
|
mkdir build
|
||||||
|
cd build
|
||||||
cmake .. -DBUILD_WITH_QT6=ON
|
cmake .. -DBUILD_WITH_QT6=ON
|
||||||
make -j$(nproc)
|
make -j $(nproc)
|
||||||
sudo make install
|
sudo make install
|
||||||
|
|
||||||
Strawberry is backwards compatible with Qt 5, to compile with Qt 5 use:
|
Strawberry is backwards compatible with Qt 5, to compile with Qt 5 use:
|
||||||
|
|
||||||
cmake .. -DBUILD_WITH_QT5=ON
|
cmake .. -DBUILD_WITH_QT5=ON
|
||||||
|
|
||||||
|
To compile on Windows with Visual Studio 2019 or 2022, see https://github.com/strawberrymusicplayer/strawberry-msvc
|
||||||
|
|
||||||
### :penguin: Packaging status
|
### :penguin: Packaging status
|
||||||
|
|
||||||
[](https://repology.org/metapackage/strawberry/versions)
|
[](https://repology.org/metapackage/strawberry/versions)
|
||||||
|
|||||||
@@ -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 6)
|
set(STRAWBERRY_VERSION_PATCH 14)
|
||||||
#set(STRAWBERRY_VERSION_PRERELEASE rc1)
|
#set(STRAWBERRY_VERSION_PRERELEASE rc1)
|
||||||
|
|
||||||
set(INCLUDE_GIT_REVISION OFF)
|
set(INCLUDE_GIT_REVISION OFF)
|
||||||
@@ -14,10 +14,6 @@ set(STRAWBERRY_VERSION_RPM_R "1")
|
|||||||
set(STRAWBERRY_VERSION_PAC_V "${majorminorpatch}")
|
set(STRAWBERRY_VERSION_PAC_V "${majorminorpatch}")
|
||||||
set(STRAWBERRY_VERSION_PAC_R "1")
|
set(STRAWBERRY_VERSION_PAC_R "1")
|
||||||
|
|
||||||
if(${STRAWBERRY_VERSION_PATCH} EQUAL "0")
|
|
||||||
set(STRAWBERRY_VERSION_DISPLAY "${STRAWBERRY_VERSION_MAJOR}.${STRAWBERRY_VERSION_MINOR}")
|
|
||||||
endif(${STRAWBERRY_VERSION_PATCH} EQUAL "0")
|
|
||||||
|
|
||||||
if(STRAWBERRY_VERSION_PRERELEASE)
|
if(STRAWBERRY_VERSION_PRERELEASE)
|
||||||
set(STRAWBERRY_VERSION_DISPLAY "${STRAWBERRY_VERSION_DISPLAY} ${STRAWBERRY_VERSION_PRERELEASE}")
|
set(STRAWBERRY_VERSION_DISPLAY "${STRAWBERRY_VERSION_DISPLAY} ${STRAWBERRY_VERSION_PRERELEASE}")
|
||||||
set(STRAWBERRY_VERSION_RPM_R "0.${STRAWBERRY_VERSION_PRERELEASE}")
|
set(STRAWBERRY_VERSION_RPM_R "0.${STRAWBERRY_VERSION_PRERELEASE}")
|
||||||
|
|||||||
1
debian/control.in
vendored
1
debian/control.in
vendored
@@ -17,6 +17,7 @@ Build-Depends: debhelper (>= 11),
|
|||||||
libasound2-dev,
|
libasound2-dev,
|
||||||
libpulse-dev,
|
libpulse-dev,
|
||||||
libtag1-dev,
|
libtag1-dev,
|
||||||
|
libicu-dev,
|
||||||
@DEBIAN_BUILD_DEPENDS_QT_PACKAGES@,
|
@DEBIAN_BUILD_DEPENDS_QT_PACKAGES@,
|
||||||
libgstreamer1.0-dev,
|
libgstreamer1.0-dev,
|
||||||
libgstreamer-plugins-base1.0-dev,
|
libgstreamer-plugins-base1.0-dev,
|
||||||
|
|||||||
20
debian/copyright
vendored
20
debian/copyright
vendored
@@ -5,10 +5,10 @@ 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>
|
2012-2014, 2017-2023 Jonas Kvinge <jonas@jkvinge.net>
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: src/core/timeconstants.h
|
Files: src/utilities/timeconstants.h
|
||||||
ext/libstrawberry-common/core/logging.cpp
|
ext/libstrawberry-common/core/logging.cpp
|
||||||
ext/libstrawberry-common/core/logging.h
|
ext/libstrawberry-common/core/logging.h
|
||||||
ext/libstrawberry-common/core/messagehandler.cpp
|
ext/libstrawberry-common/core/messagehandler.cpp
|
||||||
@@ -98,7 +98,7 @@ Files: src/core/main.h
|
|||||||
ext/macdeploycheck/*
|
ext/macdeploycheck/*
|
||||||
src/widgets/resizabletextedit.cpp
|
src/widgets/resizabletextedit.cpp
|
||||||
src/widgets/resizabletextedit.h
|
src/widgets/resizabletextedit.h
|
||||||
Copyright: 2012-2014, 2017-2022, Jonas Kvinge <jonas@jkvinge.net>
|
Copyright: 2012-2014, 2017-2023, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: src/engine/enginebase.cpp
|
Files: src/engine/enginebase.cpp
|
||||||
@@ -130,11 +130,6 @@ Copyright: 2012, David Sansome <me@davidsansome.com>
|
|||||||
2018-2021, Jonas Kvinge <jonas@jkvinge.net>
|
2018-2021, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: src/core/appearance.cpp
|
|
||||||
src/core/appearance.h
|
|
||||||
Copyright: 2012, Arnaud Bienner <arnaud.bienner@gmail.com>
|
|
||||||
License: GPL-3+
|
|
||||||
|
|
||||||
Files: src/covermanager/discogscoverprovider.cpp
|
Files: src/covermanager/discogscoverprovider.cpp
|
||||||
src/covermanager/discogscoverprovider.h
|
src/covermanager/discogscoverprovider.h
|
||||||
Copyright: 2012, Martin Björklund <mbj4668@gmail.com>
|
Copyright: 2012, Martin Björklund <mbj4668@gmail.com>
|
||||||
@@ -232,9 +227,14 @@ Files: src/widgets/clickablelabel.cpp
|
|||||||
Copyright: 2010, 2011, Andrea Decorte <adecorte@gmail.com>
|
Copyright: 2010, 2011, Andrea Decorte <adecorte@gmail.com>
|
||||||
License: GPL-3+
|
License: GPL-3+
|
||||||
|
|
||||||
Files: src/widgets/volumeslider.cpp
|
Files: src/widgets/sliderslider.cpp
|
||||||
|
src/widgets/sliderslider.h
|
||||||
|
src/widgets/prettyslider.cpp
|
||||||
|
src/widgets/prettyslider.h
|
||||||
|
src/widgets/volumeslider.cpp
|
||||||
src/widgets/volumeslider.h
|
src/widgets/volumeslider.h
|
||||||
Copyright: 2005, Gábor Lehel
|
Copyright: 2018-2023, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
|
2005, Gábor Lehel
|
||||||
2003, Mark Kretschmann <markey@web.de>
|
2003, Mark Kretschmann <markey@web.de>
|
||||||
License: GPL-2+
|
License: GPL-2+
|
||||||
|
|
||||||
|
|||||||
2
dist/scripts/maketarball.sh.in
vendored
2
dist/scripts/maketarball.sh.in
vendored
@@ -49,6 +49,7 @@ ${TAR} -cJf $name-$version.tar.xz \
|
|||||||
--exclude="*.nsi" \
|
--exclude="*.nsi" \
|
||||||
--exclude="*.kdev4" \
|
--exclude="*.kdev4" \
|
||||||
--exclude=".vscode" \
|
--exclude=".vscode" \
|
||||||
|
--exclude=".idea" \
|
||||||
--exclude="$root/.github" \
|
--exclude="$root/.github" \
|
||||||
--exclude="$root/.travis.yml" \
|
--exclude="$root/.travis.yml" \
|
||||||
--exclude="$root/.circleci" \
|
--exclude="$root/.circleci" \
|
||||||
@@ -56,6 +57,7 @@ ${TAR} -cJf $name-$version.tar.xz \
|
|||||||
--exclude="$root/CMakeLists.txt.user" \
|
--exclude="$root/CMakeLists.txt.user" \
|
||||||
--exclude="$root/.clang-format" \
|
--exclude="$root/.clang-format" \
|
||||||
--exclude="$root/build" \
|
--exclude="$root/build" \
|
||||||
|
--exclude="$root/cmake-build-debug" \
|
||||||
--exclude="$root/zanata.xml" \
|
--exclude="$root/zanata.xml" \
|
||||||
--exclude="$root/.zanata-cache" \
|
--exclude="$root/.zanata-cache" \
|
||||||
--exclude="$root/debian/changelog" \
|
--exclude="$root/debian/changelog" \
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ TryExec=strawberry
|
|||||||
Icon=strawberry
|
Icon=strawberry
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Categories=AudioVideo;Player;Qt;Audio;
|
Categories=AudioVideo;Player;Qt;Audio;
|
||||||
|
Keywords=Audio;Player;
|
||||||
StartupNotify=false
|
StartupNotify=false
|
||||||
MimeType=x-content/audio-player;application/ogg;application/x-ogg;application/x-ogm-audio;audio/flac;audio/ogg;audio/vorbis;audio/aac;audio/mp4;audio/mpeg;audio/mpegurl;audio/vnd.rn-realaudio;audio/x-flac;audio/x-oggflac;audio/x-vorbis;audio/x-vorbis+ogg;audio/x-speex;audio/x-wav;audio/x-wavpack;audio/x-ape;audio/x-mp3;audio/x-mpeg;audio/x-mpegurl;audio/x-ms-wma;audio/x-musepack;audio/x-pn-realaudio;audio/x-scpls;video/x-ms-asf;x-scheme-handler/tidal;
|
MimeType=x-content/audio-player;application/ogg;application/x-ogg;application/x-ogm-audio;audio/flac;audio/ogg;audio/vorbis;audio/aac;audio/mp4;audio/mpeg;audio/mpegurl;audio/vnd.rn-realaudio;audio/x-flac;audio/x-oggflac;audio/x-vorbis;audio/x-vorbis+ogg;audio/x-speex;audio/x-wav;audio/x-wavpack;audio/x-ape;audio/x-mp3;audio/x-mpeg;audio/x-mpegurl;audio/x-ms-wma;audio/x-musepack;audio/x-pn-realaudio;audio/x-scpls;video/x-ms-asf;x-scheme-handler/tidal;
|
||||||
StartupWMClass=strawberry
|
StartupWMClass=strawberry
|
||||||
|
|||||||
2
dist/unix/strawberry.spec.in
vendored
2
dist/unix/strawberry.spec.in
vendored
@@ -49,6 +49,8 @@ BuildRequires: pkgconfig(sqlite3) >= 3.9
|
|||||||
BuildRequires: pkgconfig(taglib)
|
BuildRequires: pkgconfig(taglib)
|
||||||
%endif
|
%endif
|
||||||
BuildRequires: pkgconfig(fftw3)
|
BuildRequires: pkgconfig(fftw3)
|
||||||
|
BuildRequires: pkgconfig(icu-uc)
|
||||||
|
BuildRequires: pkgconfig(icu-i18n)
|
||||||
%if "@QT_VERSION_MAJOR@" == "5" && ( 0%{?fedora} || 0%{?rhel_version} || 0%{?centos} )
|
%if "@QT_VERSION_MAJOR@" == "5" && ( 0%{?fedora} || 0%{?rhel_version} || 0%{?centos} )
|
||||||
BuildRequires: pkgconfig(Qt@QT_VERSION_MAJOR@Core)
|
BuildRequires: pkgconfig(Qt@QT_VERSION_MAJOR@Core)
|
||||||
BuildRequires: pkgconfig(Qt@QT_VERSION_MAJOR@Gui)
|
BuildRequires: pkgconfig(Qt@QT_VERSION_MAJOR@Gui)
|
||||||
|
|||||||
119
dist/windows/strawberry.nsi.in
vendored
119
dist/windows/strawberry.nsi.in
vendored
@@ -42,6 +42,10 @@
|
|||||||
!define release
|
!define release
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
!if "@CMAKE_BUILD_TYPE@" == "RelWithDebInfo"
|
||||||
|
!define release
|
||||||
|
!endif
|
||||||
|
|
||||||
!if "@CMAKE_BUILD_TYPE@" == "Debug"
|
!if "@CMAKE_BUILD_TYPE@" == "Debug"
|
||||||
!define debug
|
!define debug
|
||||||
!undef build_type
|
!undef build_type
|
||||||
@@ -128,6 +132,9 @@ SetCompressor /SOLID lzma
|
|||||||
!insertmacro MUI_PAGE_LICENSE COPYING
|
!insertmacro MUI_PAGE_LICENSE COPYING
|
||||||
Page Custom LockedListPageShow
|
Page Custom LockedListPageShow
|
||||||
!insertmacro MUI_PAGE_DIRECTORY
|
!insertmacro MUI_PAGE_DIRECTORY
|
||||||
|
!ifdef msvc
|
||||||
|
Page Custom InstallMSVCRuntime
|
||||||
|
!endif
|
||||||
!insertmacro MUI_PAGE_INSTFILES
|
!insertmacro MUI_PAGE_INSTFILES
|
||||||
!insertmacro MUI_PAGE_FINISH
|
!insertmacro MUI_PAGE_FINISH
|
||||||
|
|
||||||
@@ -182,6 +189,20 @@ done:
|
|||||||
|
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
!ifdef msvc
|
||||||
|
!define vc_redist_file "vc_redist.${arch}.exe"
|
||||||
|
Function InstallMSVCRuntime
|
||||||
|
${registry::Read} "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\${arch}" "Version" $R0 $R1
|
||||||
|
${If} $R0 == ""
|
||||||
|
SetDetailsView hide
|
||||||
|
inetc::get /caption "Downloading..." "https://aka.ms/vs/17/release/${vc_redist_file}" "$TEMP\${vc_redist_file}" /end
|
||||||
|
ExecWait '"$TEMP\${vc_redist_file}" /install /passive'
|
||||||
|
Delete "$TEMP\${vc_redist_file}"
|
||||||
|
SetDetailsView show
|
||||||
|
${EndIf}
|
||||||
|
FunctionEnd
|
||||||
|
!endif
|
||||||
|
|
||||||
Function .onInit
|
Function .onInit
|
||||||
|
|
||||||
!insertmacro MUI_LANGDLL_DISPLAY
|
!insertmacro MUI_LANGDLL_DISPLAY
|
||||||
@@ -224,26 +245,28 @@ Section "Strawberry" Strawberry
|
|||||||
File "avfilter-8.dll"
|
File "avfilter-8.dll"
|
||||||
File "avformat-59.dll"
|
File "avformat-59.dll"
|
||||||
File "avutil-57.dll"
|
File "avutil-57.dll"
|
||||||
|
File "libFLAC-12.dll"
|
||||||
File "libbrotlicommon.dll"
|
File "libbrotlicommon.dll"
|
||||||
File "libbrotlidec.dll"
|
File "libbrotlidec.dll"
|
||||||
File "libbrotlienc.dll"
|
File "libbrotlienc.dll"
|
||||||
File "libbs2b-0.dll"
|
File "libbs2b-0.dll"
|
||||||
File "libbz2.dll"
|
File "libbz2.dll"
|
||||||
File "libcdio-19.dll"
|
|
||||||
File "libchromaprint.dll"
|
File "libchromaprint.dll"
|
||||||
File "libdl.dll"
|
File "libdl.dll"
|
||||||
File "libfdk-aac-2.dll"
|
|
||||||
File "libffi-8.dll"
|
|
||||||
File "libFLAC-8.dll"
|
|
||||||
File "libfreetype-6.dll"
|
|
||||||
File "libfaac-0.dll"
|
File "libfaac-0.dll"
|
||||||
File "libfaad-2.dll"
|
File "libfaad-2.dll"
|
||||||
|
File "libfdk-aac-2.dll"
|
||||||
|
File "libffi-8.dll"
|
||||||
|
File "libfreetype-6.dll"
|
||||||
|
File "libgcrypt-20.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 "libgme.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 "libgpg-error-0.dll"
|
||||||
File "libgstadaptivedemux-1.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"
|
||||||
@@ -288,7 +311,8 @@ Section "Strawberry" Strawberry
|
|||||||
File "libstdc++-6.dll"
|
File "libstdc++-6.dll"
|
||||||
File "libtag.dll"
|
File "libtag.dll"
|
||||||
File "libtasn1-6.dll"
|
File "libtasn1-6.dll"
|
||||||
File "libunistring-2.dll"
|
File "libtwolame-0.dll"
|
||||||
|
File "libunistring-5.dll"
|
||||||
File "libvorbis-0.dll"
|
File "libvorbis-0.dll"
|
||||||
File "libvorbisenc-2.dll"
|
File "libvorbisenc-2.dll"
|
||||||
File "libvorbisfile-3.dll"
|
File "libvorbisfile-3.dll"
|
||||||
@@ -330,10 +354,10 @@ Section "Strawberry" Strawberry
|
|||||||
File "libssl-3-x64.dll"
|
File "libssl-3-x64.dll"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
File "FLAC.dll"
|
||||||
File "avcodec-58.dll"
|
File "avcodec-58.dll"
|
||||||
File "avfilter-7.dll"
|
File "avfilter-7.dll"
|
||||||
File "avformat-58.dll"
|
File "avformat-58.dll"
|
||||||
File "avresample-4.dll"
|
|
||||||
File "avutil-56.dll"
|
File "avutil-56.dll"
|
||||||
File "brotlicommon.dll"
|
File "brotlicommon.dll"
|
||||||
File "brotlidec.dll"
|
File "brotlidec.dll"
|
||||||
@@ -341,9 +365,9 @@ Section "Strawberry" Strawberry
|
|||||||
File "faad.dll"
|
File "faad.dll"
|
||||||
File "fdk-aac.dll"
|
File "fdk-aac.dll"
|
||||||
File "ffi-7.dll"
|
File "ffi-7.dll"
|
||||||
File "FLAC.dll"
|
|
||||||
File "gio-2.0-0.dll"
|
File "gio-2.0-0.dll"
|
||||||
File "glib-2.0-0.dll"
|
File "glib-2.0-0.dll"
|
||||||
|
File "gme.dll"
|
||||||
File "gmodule-2.0-0.dll"
|
File "gmodule-2.0-0.dll"
|
||||||
File "gnutls.dll"
|
File "gnutls.dll"
|
||||||
File "gobject-2.0-0.dll"
|
File "gobject-2.0-0.dll"
|
||||||
@@ -364,8 +388,9 @@ Section "Strawberry" Strawberry
|
|||||||
File "gsttag-1.0-0.dll"
|
File "gsttag-1.0-0.dll"
|
||||||
File "gsturidownloader-1.0-0.dll"
|
File "gsturidownloader-1.0-0.dll"
|
||||||
File "gstvideo-1.0-0.dll"
|
File "gstvideo-1.0-0.dll"
|
||||||
File "gstwinrt-1.0-0.dll"
|
File "harfbuzz.dll"
|
||||||
File "intl-8.dll"
|
File "intl-8.dll"
|
||||||
|
File "jpeg62.dll"
|
||||||
File "libbs2b.dll"
|
File "libbs2b.dll"
|
||||||
File "libfaac_dll.dll"
|
File "libfaac_dll.dll"
|
||||||
File "libiconv.dll"
|
File "libiconv.dll"
|
||||||
@@ -375,13 +400,14 @@ Section "Strawberry" Strawberry
|
|||||||
File "libspeex.dll"
|
File "libspeex.dll"
|
||||||
File "mpcdec.dll"
|
File "mpcdec.dll"
|
||||||
File "mpg123.dll"
|
File "mpg123.dll"
|
||||||
|
File "nghttp2.dll"
|
||||||
File "ogg.dll"
|
File "ogg.dll"
|
||||||
File "opus.dll"
|
File "opus.dll"
|
||||||
File "orc-0.4-0.dll"
|
File "orc-0.4-0.dll"
|
||||||
File "postproc-55.dll"
|
File "postproc-55.dll"
|
||||||
File "psl-5.dll"
|
File "psl-5.dll"
|
||||||
File "qtsparkle-qt6.dll"
|
File "qtsparkle-qt6.dll"
|
||||||
File "soup-2.4-1.dll"
|
File "soup-3.0-0.dll"
|
||||||
File "sqlite3.dll"
|
File "sqlite3.dll"
|
||||||
File "swresample-3.dll"
|
File "swresample-3.dll"
|
||||||
File "swscale-5.dll"
|
File "swscale-5.dll"
|
||||||
@@ -391,19 +417,23 @@ Section "Strawberry" Strawberry
|
|||||||
File "wavpackdll.dll"
|
File "wavpackdll.dll"
|
||||||
|
|
||||||
!ifdef release
|
!ifdef release
|
||||||
|
File "freetype.dll"
|
||||||
File "libpng16.dll"
|
File "libpng16.dll"
|
||||||
File "libprotobuf.dll"
|
File "libprotobuf.dll"
|
||||||
File "libxml2.dll"
|
File "libxml2.dll"
|
||||||
File "pcre2-8.dll"
|
File "pcre2-8.dll"
|
||||||
File "pcre2-16.dll"
|
File "pcre2-16.dll"
|
||||||
|
File "twolame.dll"
|
||||||
File "zlib.dll"
|
File "zlib.dll"
|
||||||
!endif
|
!endif
|
||||||
!ifdef debug
|
!ifdef debug
|
||||||
|
File "freetyped.dll"
|
||||||
File "libpng16d.dll"
|
File "libpng16d.dll"
|
||||||
File "libprotobufd.dll"
|
File "libprotobufd.dll"
|
||||||
File "libxml2d.dll"
|
File "libxml2d.dll"
|
||||||
File "pcre2-8d.dll"
|
File "pcre2-8d.dll"
|
||||||
File "pcre2-16d.dll"
|
File "pcre2-16d.dll"
|
||||||
|
File "twolamed.dll"
|
||||||
File "zlibd.dll"
|
File "zlibd.dll"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
@@ -411,8 +441,11 @@ Section "Strawberry" Strawberry
|
|||||||
|
|
||||||
; Common files
|
; Common files
|
||||||
|
|
||||||
|
File "icudt72.dll"
|
||||||
File "libfftw3-3.dll"
|
File "libfftw3-3.dll"
|
||||||
!ifdef msvc && debug
|
!ifdef msvc && debug
|
||||||
|
File "icuin72d.dll"
|
||||||
|
File "icuuc72d.dll"
|
||||||
File "Qt6Concurrentd.dll"
|
File "Qt6Concurrentd.dll"
|
||||||
File "Qt6Cored.dll"
|
File "Qt6Cored.dll"
|
||||||
File "Qt6Guid.dll"
|
File "Qt6Guid.dll"
|
||||||
@@ -420,6 +453,8 @@ Section "Strawberry" Strawberry
|
|||||||
File "Qt6Sqld.dll"
|
File "Qt6Sqld.dll"
|
||||||
File "Qt6Widgetsd.dll"
|
File "Qt6Widgetsd.dll"
|
||||||
!else
|
!else
|
||||||
|
File "icuin72.dll"
|
||||||
|
File "icuuc72.dll"
|
||||||
File "Qt6Concurrent.dll"
|
File "Qt6Concurrent.dll"
|
||||||
File "Qt6Core.dll"
|
File "Qt6Core.dll"
|
||||||
File "Qt6Gui.dll"
|
File "Qt6Gui.dll"
|
||||||
@@ -542,7 +577,6 @@ Section "Gstreamer plugins" gstreamer-plugins
|
|||||||
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=libgstbs2b.dll" "gstreamer-plugins\libgstbs2b.dll"
|
File "/oname=libgstbs2b.dll" "gstreamer-plugins\libgstbs2b.dll"
|
||||||
File "/oname=libgstcdio.dll" "gstreamer-plugins\libgstcdio.dll"
|
|
||||||
File "/oname=libgstcoreelements.dll" "gstreamer-plugins\libgstcoreelements.dll"
|
File "/oname=libgstcoreelements.dll" "gstreamer-plugins\libgstcoreelements.dll"
|
||||||
File "/oname=libgstdash.dll" "gstreamer-plugins\libgstdash.dll"
|
File "/oname=libgstdash.dll" "gstreamer-plugins\libgstdash.dll"
|
||||||
File "/oname=libgstdirectsound.dll" "gstreamer-plugins\libgstdirectsound.dll"
|
File "/oname=libgstdirectsound.dll" "gstreamer-plugins\libgstdirectsound.dll"
|
||||||
@@ -552,9 +586,11 @@ Section "Gstreamer plugins" gstreamer-plugins
|
|||||||
File "/oname=libgstfdkaac.dll" "gstreamer-plugins\libgstfdkaac.dll"
|
File "/oname=libgstfdkaac.dll" "gstreamer-plugins\libgstfdkaac.dll"
|
||||||
File "/oname=libgstflac.dll" "gstreamer-plugins\libgstflac.dll"
|
File "/oname=libgstflac.dll" "gstreamer-plugins\libgstflac.dll"
|
||||||
File "/oname=libgstgio.dll" "gstreamer-plugins\libgstgio.dll"
|
File "/oname=libgstgio.dll" "gstreamer-plugins\libgstgio.dll"
|
||||||
|
File "/oname=libgstgme.dll" "gstreamer-plugins\libgstgme.dll"
|
||||||
File "/oname=libgsthls.dll" "gstreamer-plugins\libgsthls.dll"
|
File "/oname=libgsthls.dll" "gstreamer-plugins\libgsthls.dll"
|
||||||
File "/oname=libgsticydemux.dll" "gstreamer-plugins\libgsticydemux.dll"
|
File "/oname=libgsticydemux.dll" "gstreamer-plugins\libgsticydemux.dll"
|
||||||
File "/oname=libgstid3demux.dll" "gstreamer-plugins\libgstid3demux.dll"
|
File "/oname=libgstid3demux.dll" "gstreamer-plugins\libgstid3demux.dll"
|
||||||
|
File "/oname=libgstid3tag.dll" "gstreamer-plugins\libgstid3tag.dll"
|
||||||
File "/oname=libgstisomp4.dll" "gstreamer-plugins\libgstisomp4.dll"
|
File "/oname=libgstisomp4.dll" "gstreamer-plugins\libgstisomp4.dll"
|
||||||
File "/oname=libgstlame.dll" "gstreamer-plugins\libgstlame.dll"
|
File "/oname=libgstlame.dll" "gstreamer-plugins\libgstlame.dll"
|
||||||
File "/oname=libgstlibav.dll" "gstreamer-plugins\libgstlibav.dll"
|
File "/oname=libgstlibav.dll" "gstreamer-plugins\libgstlibav.dll"
|
||||||
@@ -574,17 +610,20 @@ Section "Gstreamer plugins" gstreamer-plugins
|
|||||||
File "/oname=libgstspeex.dll" "gstreamer-plugins\libgstspeex.dll"
|
File "/oname=libgstspeex.dll" "gstreamer-plugins\libgstspeex.dll"
|
||||||
File "/oname=libgsttaglib.dll" "gstreamer-plugins\libgsttaglib.dll"
|
File "/oname=libgsttaglib.dll" "gstreamer-plugins\libgsttaglib.dll"
|
||||||
File "/oname=libgsttcp.dll" "gstreamer-plugins\libgsttcp.dll"
|
File "/oname=libgsttcp.dll" "gstreamer-plugins\libgsttcp.dll"
|
||||||
|
File "/oname=libgsttwolame.dll" "gstreamer-plugins\libgsttwolame.dll"
|
||||||
File "/oname=libgsttypefindfunctions.dll" "gstreamer-plugins\libgsttypefindfunctions.dll"
|
File "/oname=libgsttypefindfunctions.dll" "gstreamer-plugins\libgsttypefindfunctions.dll"
|
||||||
File "/oname=libgstudp.dll" "gstreamer-plugins\libgstudp.dll"
|
File "/oname=libgstudp.dll" "gstreamer-plugins\libgstudp.dll"
|
||||||
File "/oname=libgstvolume.dll" "gstreamer-plugins\libgstvolume.dll"
|
File "/oname=libgstvolume.dll" "gstreamer-plugins\libgstvolume.dll"
|
||||||
File "/oname=libgstvorbis.dll" "gstreamer-plugins\libgstvorbis.dll"
|
File "/oname=libgstvorbis.dll" "gstreamer-plugins\libgstvorbis.dll"
|
||||||
File "/oname=libgstwasapi.dll" "gstreamer-plugins\libgstwasapi.dll"
|
File "/oname=libgstwasapi.dll" "gstreamer-plugins\libgstwasapi.dll"
|
||||||
|
File "/oname=libgstwavenc.dll" "gstreamer-plugins\libgstwavenc.dll"
|
||||||
File "/oname=libgstwavpack.dll" "gstreamer-plugins\libgstwavpack.dll"
|
File "/oname=libgstwavpack.dll" "gstreamer-plugins\libgstwavpack.dll"
|
||||||
File "/oname=libgstwavparse.dll" "gstreamer-plugins\libgstwavparse.dll"
|
File "/oname=libgstwavparse.dll" "gstreamer-plugins\libgstwavparse.dll"
|
||||||
File "/oname=libgstxingmux.dll" "gstreamer-plugins\libgstxingmux.dll"
|
File "/oname=libgstxingmux.dll" "gstreamer-plugins\libgstxingmux.dll"
|
||||||
!endif ; MinGW
|
!endif ; MinGW
|
||||||
|
|
||||||
!ifdef msvc
|
!ifdef msvc
|
||||||
|
File "/oname=gstaes.dll" "gstreamer-plugins\gstaes.dll"
|
||||||
File "/oname=gstaiff.dll" "gstreamer-plugins\gstaiff.dll"
|
File "/oname=gstaiff.dll" "gstreamer-plugins\gstaiff.dll"
|
||||||
File "/oname=gstapetag.dll" "gstreamer-plugins\gstapetag.dll"
|
File "/oname=gstapetag.dll" "gstreamer-plugins\gstapetag.dll"
|
||||||
File "/oname=gstapp.dll" "gstreamer-plugins\gstapp.dll"
|
File "/oname=gstapp.dll" "gstreamer-plugins\gstapp.dll"
|
||||||
@@ -608,9 +647,11 @@ Section "Gstreamer plugins" gstreamer-plugins
|
|||||||
File "/oname=gstfdkaac.dll" "gstreamer-plugins\gstfdkaac.dll"
|
File "/oname=gstfdkaac.dll" "gstreamer-plugins\gstfdkaac.dll"
|
||||||
File "/oname=gstflac.dll" "gstreamer-plugins\gstflac.dll"
|
File "/oname=gstflac.dll" "gstreamer-plugins\gstflac.dll"
|
||||||
File "/oname=gstgio.dll" "gstreamer-plugins\gstgio.dll"
|
File "/oname=gstgio.dll" "gstreamer-plugins\gstgio.dll"
|
||||||
|
File "/oname=gstgme.dll" "gstreamer-plugins\gstgme.dll"
|
||||||
File "/oname=gsthls.dll" "gstreamer-plugins\gsthls.dll"
|
File "/oname=gsthls.dll" "gstreamer-plugins\gsthls.dll"
|
||||||
File "/oname=gsticydemux.dll" "gstreamer-plugins\gsticydemux.dll"
|
File "/oname=gsticydemux.dll" "gstreamer-plugins\gsticydemux.dll"
|
||||||
File "/oname=gstid3demux.dll" "gstreamer-plugins\gstid3demux.dll"
|
File "/oname=gstid3demux.dll" "gstreamer-plugins\gstid3demux.dll"
|
||||||
|
File "/oname=gstid3tag.dll" "gstreamer-plugins\gstid3tag.dll"
|
||||||
File "/oname=gstisomp4.dll" "gstreamer-plugins\gstisomp4.dll"
|
File "/oname=gstisomp4.dll" "gstreamer-plugins\gstisomp4.dll"
|
||||||
File "/oname=gstlame.dll" "gstreamer-plugins\gstlame.dll"
|
File "/oname=gstlame.dll" "gstreamer-plugins\gstlame.dll"
|
||||||
File "/oname=gstlibav.dll" "gstreamer-plugins\gstlibav.dll"
|
File "/oname=gstlibav.dll" "gstreamer-plugins\gstlibav.dll"
|
||||||
@@ -620,20 +661,23 @@ Section "Gstreamer plugins" gstreamer-plugins
|
|||||||
File "/oname=gstopenmpt.dll" "gstreamer-plugins\gstopenmpt.dll"
|
File "/oname=gstopenmpt.dll" "gstreamer-plugins\gstopenmpt.dll"
|
||||||
File "/oname=gstopus.dll" "gstreamer-plugins\gstopus.dll"
|
File "/oname=gstopus.dll" "gstreamer-plugins\gstopus.dll"
|
||||||
File "/oname=gstopusparse.dll" "gstreamer-plugins\gstopusparse.dll"
|
File "/oname=gstopusparse.dll" "gstreamer-plugins\gstopusparse.dll"
|
||||||
|
File "/oname=gstpbtypes.dll" "gstreamer-plugins\gstpbtypes.dll"
|
||||||
File "/oname=gstplayback.dll" "gstreamer-plugins\gstplayback.dll"
|
File "/oname=gstplayback.dll" "gstreamer-plugins\gstplayback.dll"
|
||||||
File "/oname=gstreplaygain.dll" "gstreamer-plugins\gstreplaygain.dll"
|
File "/oname=gstreplaygain.dll" "gstreamer-plugins\gstreplaygain.dll"
|
||||||
File "/oname=gstrtp.dll" "gstreamer-plugins\gstrtp.dll"
|
File "/oname=gstrtp.dll" "gstreamer-plugins\gstrtp.dll"
|
||||||
File "/oname=gstrtsp.dll" "gstreamer-plugins\gstrtsp.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=gstsoup.dll" "gstreamer-plugins\gstsoup.dll"
|
||||||
File "/oname=gstspectrum.dll" "gstreamer-plugins\gstspectrum.dll"
|
File "/oname=gstspectrum.dll" "gstreamer-plugins\gstspectrum.dll"
|
||||||
|
File "/oname=gstspeex.dll" "gstreamer-plugins\gstspeex.dll"
|
||||||
|
File "/oname=gsttaglib.dll" "gstreamer-plugins\gsttaglib.dll"
|
||||||
File "/oname=gsttcp.dll" "gstreamer-plugins\gsttcp.dll"
|
File "/oname=gsttcp.dll" "gstreamer-plugins\gsttcp.dll"
|
||||||
|
File "/oname=gsttwolame.dll" "gstreamer-plugins\gsttwolame.dll"
|
||||||
File "/oname=gsttypefindfunctions.dll" "gstreamer-plugins\gsttypefindfunctions.dll"
|
File "/oname=gsttypefindfunctions.dll" "gstreamer-plugins\gsttypefindfunctions.dll"
|
||||||
File "/oname=gstudp.dll" "gstreamer-plugins\gstudp.dll"
|
File "/oname=gstudp.dll" "gstreamer-plugins\gstudp.dll"
|
||||||
File "/oname=gstvolume.dll" "gstreamer-plugins\gstvolume.dll"
|
File "/oname=gstvolume.dll" "gstreamer-plugins\gstvolume.dll"
|
||||||
File "/oname=gstvorbis.dll" "gstreamer-plugins\gstvorbis.dll"
|
File "/oname=gstvorbis.dll" "gstreamer-plugins\gstvorbis.dll"
|
||||||
File "/oname=gstwasapi.dll" "gstreamer-plugins\gstwasapi.dll"
|
File "/oname=gstwasapi.dll" "gstreamer-plugins\gstwasapi.dll"
|
||||||
;File "/oname=gstwasapi2.dll" "gstreamer-plugins\gstwasapi2.dll"
|
File "/oname=gstwavenc.dll" "gstreamer-plugins\gstwavenc.dll"
|
||||||
File "/oname=gstwavpack.dll" "gstreamer-plugins\gstwavpack.dll"
|
File "/oname=gstwavpack.dll" "gstreamer-plugins\gstwavpack.dll"
|
||||||
File "/oname=gstwavparse.dll" "gstreamer-plugins\gstwavparse.dll"
|
File "/oname=gstwavparse.dll" "gstreamer-plugins\gstwavparse.dll"
|
||||||
File "/oname=gstxingmux.dll" "gstreamer-plugins\gstxingmux.dll"
|
File "/oname=gstxingmux.dll" "gstreamer-plugins\gstxingmux.dll"
|
||||||
@@ -703,26 +747,28 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\avfilter-8.dll"
|
Delete "$INSTDIR\avfilter-8.dll"
|
||||||
Delete "$INSTDIR\avformat-59.dll"
|
Delete "$INSTDIR\avformat-59.dll"
|
||||||
Delete "$INSTDIR\avutil-57.dll"
|
Delete "$INSTDIR\avutil-57.dll"
|
||||||
|
Delete "$INSTDIR\libFLAC-12.dll"
|
||||||
Delete "$INSTDIR\libbrotlicommon.dll"
|
Delete "$INSTDIR\libbrotlicommon.dll"
|
||||||
Delete "$INSTDIR\libbrotlidec.dll"
|
Delete "$INSTDIR\libbrotlidec.dll"
|
||||||
Delete "$INSTDIR\libbrotlienc.dll"
|
Delete "$INSTDIR\libbrotlienc.dll"
|
||||||
Delete "$INSTDIR\libbs2b-0.dll"
|
Delete "$INSTDIR\libbs2b-0.dll"
|
||||||
Delete "$INSTDIR\libbz2.dll"
|
Delete "$INSTDIR\libbz2.dll"
|
||||||
Delete "$INSTDIR\libcdio-19.dll"
|
|
||||||
Delete "$INSTDIR\libchromaprint.dll"
|
Delete "$INSTDIR\libchromaprint.dll"
|
||||||
Delete "$INSTDIR\libdl.dll"
|
Delete "$INSTDIR\libdl.dll"
|
||||||
Delete "$INSTDIR\libfdk-aac-2.dll"
|
|
||||||
Delete "$INSTDIR\libffi-8.dll"
|
|
||||||
Delete "$INSTDIR\libFLAC-8.dll"
|
|
||||||
Delete "$INSTDIR\libfreetype-6.dll"
|
|
||||||
Delete "$INSTDIR\libfaac-0.dll"
|
Delete "$INSTDIR\libfaac-0.dll"
|
||||||
Delete "$INSTDIR\libfaad-2.dll"
|
Delete "$INSTDIR\libfaad-2.dll"
|
||||||
|
Delete "$INSTDIR\libfdk-aac-2.dll"
|
||||||
|
Delete "$INSTDIR\libffi-8.dll"
|
||||||
|
Delete "$INSTDIR\libfreetype-6.dll"
|
||||||
|
Delete "$INSTDIR\libgcrypt-20.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\libgme.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\libgpg-error-0.dll"
|
||||||
Delete "$INSTDIR\libgstadaptivedemux-1.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"
|
||||||
@@ -767,7 +813,8 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\libstdc++-6.dll"
|
Delete "$INSTDIR\libstdc++-6.dll"
|
||||||
Delete "$INSTDIR\libtag.dll"
|
Delete "$INSTDIR\libtag.dll"
|
||||||
Delete "$INSTDIR\libtasn1-6.dll"
|
Delete "$INSTDIR\libtasn1-6.dll"
|
||||||
Delete "$INSTDIR\libunistring-2.dll"
|
Delete "$INSTDIR\libtwolame-0.dll"
|
||||||
|
Delete "$INSTDIR\libunistring-5.dll"
|
||||||
Delete "$INSTDIR\libvorbis-0.dll"
|
Delete "$INSTDIR\libvorbis-0.dll"
|
||||||
Delete "$INSTDIR\libvorbisenc-2.dll"
|
Delete "$INSTDIR\libvorbisenc-2.dll"
|
||||||
Delete "$INSTDIR\libvorbisfile-3.dll"
|
Delete "$INSTDIR\libvorbisfile-3.dll"
|
||||||
@@ -809,10 +856,10 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\libssl-3-x64.dll"
|
Delete "$INSTDIR\libssl-3-x64.dll"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
|
Delete "$INSTDIR\FLAC.dll"
|
||||||
Delete "$INSTDIR\avcodec-58.dll"
|
Delete "$INSTDIR\avcodec-58.dll"
|
||||||
Delete "$INSTDIR\avfilter-7.dll"
|
Delete "$INSTDIR\avfilter-7.dll"
|
||||||
Delete "$INSTDIR\avformat-58.dll"
|
Delete "$INSTDIR\avformat-58.dll"
|
||||||
Delete "$INSTDIR\avresample-4.dll"
|
|
||||||
Delete "$INSTDIR\avutil-56.dll"
|
Delete "$INSTDIR\avutil-56.dll"
|
||||||
Delete "$INSTDIR\brotlicommon.dll"
|
Delete "$INSTDIR\brotlicommon.dll"
|
||||||
Delete "$INSTDIR\brotlidec.dll"
|
Delete "$INSTDIR\brotlidec.dll"
|
||||||
@@ -820,9 +867,9 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\faad.dll"
|
Delete "$INSTDIR\faad.dll"
|
||||||
Delete "$INSTDIR\fdk-aac.dll"
|
Delete "$INSTDIR\fdk-aac.dll"
|
||||||
Delete "$INSTDIR\ffi-7.dll"
|
Delete "$INSTDIR\ffi-7.dll"
|
||||||
Delete "$INSTDIR\FLAC.dll"
|
|
||||||
Delete "$INSTDIR\gio-2.0-0.dll"
|
Delete "$INSTDIR\gio-2.0-0.dll"
|
||||||
Delete "$INSTDIR\glib-2.0-0.dll"
|
Delete "$INSTDIR\glib-2.0-0.dll"
|
||||||
|
Delete "$INSTDIR\gme.dll"
|
||||||
Delete "$INSTDIR\gmodule-2.0-0.dll"
|
Delete "$INSTDIR\gmodule-2.0-0.dll"
|
||||||
Delete "$INSTDIR\gnutls.dll"
|
Delete "$INSTDIR\gnutls.dll"
|
||||||
Delete "$INSTDIR\gobject-2.0-0.dll"
|
Delete "$INSTDIR\gobject-2.0-0.dll"
|
||||||
@@ -843,8 +890,9 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\gsttag-1.0-0.dll"
|
Delete "$INSTDIR\gsttag-1.0-0.dll"
|
||||||
Delete "$INSTDIR\gsturidownloader-1.0-0.dll"
|
Delete "$INSTDIR\gsturidownloader-1.0-0.dll"
|
||||||
Delete "$INSTDIR\gstvideo-1.0-0.dll"
|
Delete "$INSTDIR\gstvideo-1.0-0.dll"
|
||||||
Delete "$INSTDIR\gstwinrt-1.0-0.dll"
|
Delete "$INSTDIR\harfbuzz.dll"
|
||||||
Delete "$INSTDIR\intl-8.dll"
|
Delete "$INSTDIR\intl-8.dll"
|
||||||
|
Delete "$INSTDIR\jpeg62.dll"
|
||||||
Delete "$INSTDIR\libbs2b.dll"
|
Delete "$INSTDIR\libbs2b.dll"
|
||||||
Delete "$INSTDIR\libfaac_dll.dll"
|
Delete "$INSTDIR\libfaac_dll.dll"
|
||||||
Delete "$INSTDIR\libiconv.dll"
|
Delete "$INSTDIR\libiconv.dll"
|
||||||
@@ -854,13 +902,14 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\libspeex.dll"
|
Delete "$INSTDIR\libspeex.dll"
|
||||||
Delete "$INSTDIR\mpcdec.dll"
|
Delete "$INSTDIR\mpcdec.dll"
|
||||||
Delete "$INSTDIR\mpg123.dll"
|
Delete "$INSTDIR\mpg123.dll"
|
||||||
|
Delete "$INSTDIR\nghttp2.dll"
|
||||||
Delete "$INSTDIR\ogg.dll"
|
Delete "$INSTDIR\ogg.dll"
|
||||||
Delete "$INSTDIR\opus.dll"
|
Delete "$INSTDIR\opus.dll"
|
||||||
Delete "$INSTDIR\orc-0.4-0.dll"
|
Delete "$INSTDIR\orc-0.4-0.dll"
|
||||||
Delete "$INSTDIR\postproc-55.dll"
|
Delete "$INSTDIR\postproc-55.dll"
|
||||||
Delete "$INSTDIR\psl-5.dll"
|
Delete "$INSTDIR\psl-5.dll"
|
||||||
Delete "$INSTDIR\qtsparkle-qt6.dll"
|
Delete "$INSTDIR\qtsparkle-qt6.dll"
|
||||||
Delete "$INSTDIR\soup-2.4-1.dll"
|
Delete "$INSTDIR\soup-3.0-0.dll"
|
||||||
Delete "$INSTDIR\sqlite3.dll"
|
Delete "$INSTDIR\sqlite3.dll"
|
||||||
Delete "$INSTDIR\swresample-3.dll"
|
Delete "$INSTDIR\swresample-3.dll"
|
||||||
Delete "$INSTDIR\swscale-5.dll"
|
Delete "$INSTDIR\swscale-5.dll"
|
||||||
@@ -870,19 +919,23 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\wavpackdll.dll"
|
Delete "$INSTDIR\wavpackdll.dll"
|
||||||
|
|
||||||
!ifdef release
|
!ifdef release
|
||||||
|
Delete "$INSTDIR\freetype.dll"
|
||||||
Delete "$INSTDIR\libpng16.dll"
|
Delete "$INSTDIR\libpng16.dll"
|
||||||
Delete "$INSTDIR\libprotobuf.dll"
|
Delete "$INSTDIR\libprotobuf.dll"
|
||||||
Delete "$INSTDIR\libxml2.dll"
|
Delete "$INSTDIR\libxml2.dll"
|
||||||
Delete "$INSTDIR\pcre2-8.dll"
|
Delete "$INSTDIR\pcre2-8.dll"
|
||||||
Delete "$INSTDIR\pcre2-16.dll"
|
Delete "$INSTDIR\pcre2-16.dll"
|
||||||
|
Delete "$INSTDIR\twolame.dll"
|
||||||
Delete "$INSTDIR\zlib.dll"
|
Delete "$INSTDIR\zlib.dll"
|
||||||
!endif
|
!endif
|
||||||
!ifdef debug
|
!ifdef debug
|
||||||
|
Delete "$INSTDIR\freetyped.dll"
|
||||||
Delete "$INSTDIR\libpng16d.dll"
|
Delete "$INSTDIR\libpng16d.dll"
|
||||||
Delete "$INSTDIR\libprotobufd.dll"
|
Delete "$INSTDIR\libprotobufd.dll"
|
||||||
Delete "$INSTDIR\libxml2d.dll"
|
Delete "$INSTDIR\libxml2d.dll"
|
||||||
Delete "$INSTDIR\pcre2-8d.dll"
|
Delete "$INSTDIR\pcre2-8d.dll"
|
||||||
Delete "$INSTDIR\pcre2-16d.dll"
|
Delete "$INSTDIR\pcre2-16d.dll"
|
||||||
|
Delete "$INSTDIR\twolamed.dll"
|
||||||
Delete "$INSTDIR\zlibd.dll"
|
Delete "$INSTDIR\zlibd.dll"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
@@ -890,8 +943,11 @@ Section "Uninstall"
|
|||||||
|
|
||||||
; Common files
|
; Common files
|
||||||
|
|
||||||
|
Delete "$INSTDIR\icudt72.dll"
|
||||||
Delete "$INSTDIR\libfftw3-3.dll"
|
Delete "$INSTDIR\libfftw3-3.dll"
|
||||||
!ifdef msvc && debug
|
!ifdef msvc && debug
|
||||||
|
Delete "$INSTDIR\icuin72d.dll"
|
||||||
|
Delete "$INSTDIR\icuuc72d.dll"
|
||||||
Delete "$INSTDIR\Qt6Concurrentd.dll"
|
Delete "$INSTDIR\Qt6Concurrentd.dll"
|
||||||
Delete "$INSTDIR\Qt6Cored.dll"
|
Delete "$INSTDIR\Qt6Cored.dll"
|
||||||
Delete "$INSTDIR\Qt6Guid.dll"
|
Delete "$INSTDIR\Qt6Guid.dll"
|
||||||
@@ -899,6 +955,8 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\Qt6Sqld.dll"
|
Delete "$INSTDIR\Qt6Sqld.dll"
|
||||||
Delete "$INSTDIR\Qt6Widgetsd.dll"
|
Delete "$INSTDIR\Qt6Widgetsd.dll"
|
||||||
!else
|
!else
|
||||||
|
Delete "$INSTDIR\icuin72.dll"
|
||||||
|
Delete "$INSTDIR\icuuc72.dll"
|
||||||
Delete "$INSTDIR\Qt6Concurrent.dll"
|
Delete "$INSTDIR\Qt6Concurrent.dll"
|
||||||
Delete "$INSTDIR\Qt6Core.dll"
|
Delete "$INSTDIR\Qt6Core.dll"
|
||||||
Delete "$INSTDIR\Qt6Gui.dll"
|
Delete "$INSTDIR\Qt6Gui.dll"
|
||||||
@@ -954,7 +1012,6 @@ Section "Uninstall"
|
|||||||
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\libgstbs2b.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstbs2b.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstcdio.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstcoreelements.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstcoreelements.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstdash.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstdash.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstdirectsound.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstdirectsound.dll"
|
||||||
@@ -964,9 +1021,11 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\gstreamer-plugins\libgstfdkaac.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstfdkaac.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstflac.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstflac.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstgio.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstgio.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstgme.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgsthls.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgsthls.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgsticydemux.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgsticydemux.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstid3demux.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstid3demux.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstid3tag.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstisomp4.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstisomp4.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstlame.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstlame.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstlibav.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstlibav.dll"
|
||||||
@@ -986,11 +1045,13 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\gstreamer-plugins\libgstspeex.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstspeex.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgsttaglib.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgsttaglib.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgsttcp.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgsttcp.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgsttwolame.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgsttypefindfunctions.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgsttypefindfunctions.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstudp.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstudp.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstvolume.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstvolume.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstvorbis.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstvorbis.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstwasapi.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstwasapi.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\libgstwavenc.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstwavpack.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstwavpack.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstwavparse.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstwavparse.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\libgstxingmux.dll"
|
Delete "$INSTDIR\gstreamer-plugins\libgstxingmux.dll"
|
||||||
@@ -999,6 +1060,7 @@ Section "Uninstall"
|
|||||||
; MSVC GStreamer plugins
|
; MSVC GStreamer plugins
|
||||||
|
|
||||||
!ifdef msvc
|
!ifdef msvc
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstaes.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstaiff.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstaiff.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstapetag.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstapetag.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstapp.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstapp.dll"
|
||||||
@@ -1022,9 +1084,11 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\gstreamer-plugins\gstfdkaac.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstfdkaac.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstflac.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstflac.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstgio.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstgio.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstgme.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gsthls.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gsthls.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gsticydemux.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gsticydemux.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstid3demux.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstid3demux.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstid3tag.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstisomp4.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstisomp4.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstlame.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstlame.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstlibav.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstlibav.dll"
|
||||||
@@ -1034,20 +1098,23 @@ Section "Uninstall"
|
|||||||
Delete "$INSTDIR\gstreamer-plugins\gstopenmpt.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstopenmpt.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstopus.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstopus.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstopusparse.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstopusparse.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstpbtypes.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstplayback.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstplayback.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstreplaygain.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstreplaygain.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstrtp.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstrtp.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstrtsp.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstrtsp.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstspeex.dll"
|
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstsoup.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstsoup.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstspectrum.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstspectrum.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gstspeex.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gsttaglib.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gsttcp.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gsttcp.dll"
|
||||||
|
Delete "$INSTDIR\gstreamer-plugins\gsttwolame.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gsttypefindfunctions.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gsttypefindfunctions.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstudp.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstudp.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstvolume.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstvolume.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstvorbis.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstvorbis.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstwasapi.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstwasapi.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstwasapi2.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstwavenc.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstwavpack.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstwavpack.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstwavparse.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstwavparse.dll"
|
||||||
Delete "$INSTDIR\gstreamer-plugins\gstxingmux.dll"
|
Delete "$INSTDIR\gstreamer-plugins\gstxingmux.dll"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
|
|
||||||
set(SOURCES gstfastspectrum.cpp gstmoodbarplugin.cpp)
|
set(SOURCES gstfastspectrum.cpp gstmoodbarplugin.cpp)
|
||||||
|
|
||||||
|
|||||||
@@ -82,9 +82,9 @@ static void gst_fastspectrum_class_init(GstFastSpectrumClass *klass) {
|
|||||||
|
|
||||||
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_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_INTERVAL, g_param_spec_uint64("interval", "Interval", "Interval of time between message posts (in nanoseconds)", 1, G_MAXUINT64, DEFAULT_INTERVAL, static_cast<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, static_cast<GParamFlags>(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT(gst_fastspectrum_debug, "spectrum", 0, "audio spectrum analyser element");
|
GST_DEBUG_CATEGORY_INIT(gst_fastspectrum_debug, "spectrum", 0, "audio spectrum analyser element");
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ 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;
|
using OutputCallback = std::function<void(double *magnitudes, int size)>;
|
||||||
|
|
||||||
struct GstFastSpectrum {
|
struct GstFastSpectrum {
|
||||||
GstAudioFilter parent;
|
GstAudioFilter parent;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
core/logging.cpp
|
core/logging.cpp
|
||||||
|
|||||||
@@ -126,7 +126,8 @@ 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 (message.startsWith(kMessageHandlerMagic)) {
|
if (message.startsWith(kMessageHandlerMagic)) {
|
||||||
fprintf(type == QtCriticalMsg || type == QtFatalMsg ? stderr : stdout, "%s\n", message.toUtf8().data() + kMessageHandlerMagicLength);
|
QByteArray message_data = message.toUtf8();
|
||||||
|
fprintf(type == QtCriticalMsg || type == QtFatalMsg ? stderr : stdout, "%s\n", message_data.constData() + kMessageHandlerMagicLength);
|
||||||
fflush(type == QtCriticalMsg || type == QtFatalMsg ? stderr : stdout);
|
fflush(type == QtCriticalMsg || type == QtFatalMsg ? stderr : stdout);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,9 +35,6 @@
|
|||||||
|
|
||||||
class QIODevice;
|
class QIODevice;
|
||||||
|
|
||||||
#define QStringFromStdString(x) QString::fromUtf8((x).data(), (x).size())
|
|
||||||
#define DataCommaSizeFromQString(x) (x).toUtf8().constData(), (x).toUtf8().length()
|
|
||||||
|
|
||||||
// Reads and writes uint32 length encoded protobufs to a socket.
|
// Reads and writes uint32 length encoded protobufs to a socket.
|
||||||
// This base QObject is separate from AbstractMessageHandler because moc can't handle templated classes.
|
// This base QObject is separate from AbstractMessageHandler because moc can't handle templated classes.
|
||||||
// Use AbstractMessageHandler instead.
|
// Use AbstractMessageHandler instead.
|
||||||
@@ -85,8 +82,8 @@ class AbstractMessageHandler : public _MessageHandlerBase {
|
|||||||
AbstractMessageHandler(QIODevice *device, QObject *parent);
|
AbstractMessageHandler(QIODevice *device, QObject *parent);
|
||||||
~AbstractMessageHandler() override { AbstractMessageHandler::AbortAll(); }
|
~AbstractMessageHandler() override { AbstractMessageHandler::AbortAll(); }
|
||||||
|
|
||||||
typedef MT MessageType;
|
using MessageType = MT;
|
||||||
typedef MessageReply<MT> ReplyType;
|
using ReplyType = MessageReply<MT>;
|
||||||
|
|
||||||
// Serialises the message and writes it to the socket.
|
// Serialises the message and writes it to the socket.
|
||||||
// This version MUST be called from the thread in which the AbstractMessageHandler was created.
|
// This version MUST be called from the thread in which the AbstractMessageHandler was created.
|
||||||
|
|||||||
@@ -76,8 +76,8 @@ class WorkerPool : public _WorkerPoolBase {
|
|||||||
explicit WorkerPool(QObject *parent = nullptr);
|
explicit WorkerPool(QObject *parent = nullptr);
|
||||||
~WorkerPool() override;
|
~WorkerPool() override;
|
||||||
|
|
||||||
typedef typename HandlerType::MessageType MessageType;
|
using MessageType = typename HandlerType::MessageType;
|
||||||
typedef typename HandlerType::ReplyType ReplyType;
|
using ReplyType = typename HandlerType::ReplyType;
|
||||||
|
|
||||||
// Sets the name of the worker executable. This is looked for first in the current directory, and then in $PATH.
|
// Sets the name of the worker executable. This is looked for first in the current directory, and then in $PATH.
|
||||||
// You must call this before calling Start().
|
// You must call this before calling Start().
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
|
|
||||||
set(MESSAGES tagreadermessages.proto)
|
set(MESSAGES tagreadermessages.proto)
|
||||||
set(SOURCES tagreaderbase.cpp)
|
set(SOURCES tagreaderbase.cpp)
|
||||||
|
|
||||||
if(USE_TAGLIB AND TAGLIB_FOUND)
|
if(USE_TAGLIB AND TAGLIB_FOUND)
|
||||||
list(APPEND SOURCES tagreadertaglib.cpp)
|
list(APPEND SOURCES tagreadertaglib.cpp tagreadergme.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(USE_TAGPARSER AND TAGPARSER_FOUND)
|
if(USE_TAGPARSER AND TAGPARSER_FOUND)
|
||||||
|
|||||||
@@ -25,3 +25,33 @@ const std::string TagReaderBase::kEmbeddedCover = "(embedded)";
|
|||||||
|
|
||||||
TagReaderBase::TagReaderBase() = default;
|
TagReaderBase::TagReaderBase() = default;
|
||||||
TagReaderBase::~TagReaderBase() = default;
|
TagReaderBase::~TagReaderBase() = default;
|
||||||
|
|
||||||
|
void TagReaderBase::Decode(const QString &tag, std::string *output) {
|
||||||
|
|
||||||
|
output->assign(DataCommaSizeFromQString(tag));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
float TagReaderBase::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 TagReaderBase::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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,6 +27,9 @@
|
|||||||
|
|
||||||
#include "tagreadermessages.pb.h"
|
#include "tagreadermessages.pb.h"
|
||||||
|
|
||||||
|
#define QStringFromStdString(x) QString::fromUtf8((x).data(), (x).size())
|
||||||
|
#define DataCommaSizeFromQString(x) (x).toUtf8().constData(), (x).toUtf8().length()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class holds all useful methods to read and write tags from/to files.
|
* This class holds all useful methods to read and write tags from/to files.
|
||||||
* You should not use it directly in the main process but rather use a TagReaderWorker process (using TagReaderClient)
|
* You should not use it directly in the main process but rather use a TagReaderWorker process (using TagReaderClient)
|
||||||
@@ -38,7 +41,7 @@ class TagReaderBase {
|
|||||||
|
|
||||||
virtual bool IsMediaFile(const QString &filename) const = 0;
|
virtual bool IsMediaFile(const QString &filename) const = 0;
|
||||||
|
|
||||||
virtual void ReadFile(const QString &filename, spb::tagreader::SongMetadata *song) const = 0;
|
virtual bool ReadFile(const QString &filename, spb::tagreader::SongMetadata *song) const = 0;
|
||||||
virtual bool SaveFile(const QString &filename, const spb::tagreader::SongMetadata &song) const = 0;
|
virtual bool SaveFile(const QString &filename, const spb::tagreader::SongMetadata &song) const = 0;
|
||||||
|
|
||||||
virtual QByteArray LoadEmbeddedArt(const QString &filename) const = 0;
|
virtual QByteArray LoadEmbeddedArt(const QString &filename) const = 0;
|
||||||
@@ -47,6 +50,11 @@ class TagReaderBase {
|
|||||||
virtual bool SaveSongPlaycountToFile(const QString &filename, const spb::tagreader::SongMetadata &song) const = 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;
|
virtual bool SaveSongRatingToFile(const QString &filename, const spb::tagreader::SongMetadata &song) const = 0;
|
||||||
|
|
||||||
|
static void Decode(const QString &tag, std::string *output);
|
||||||
|
|
||||||
|
static float ConvertPOPMRating(const int POPM_rating);
|
||||||
|
static int ConvertToPOPMRating(const float rating);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static const std::string kEmbeddedCover;
|
static const std::string kEmbeddedCover;
|
||||||
|
|
||||||
|
|||||||
299
ext/libstrawberry-tagreader/tagreadergme.cpp
Normal file
299
ext/libstrawberry-tagreader/tagreadergme.cpp
Normal file
@@ -0,0 +1,299 @@
|
|||||||
|
/*
|
||||||
|
* Strawberry Music Player
|
||||||
|
* Copyright 2022, Eoin O'Neill <eoinoneill1991@gmail.com>
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "tagreadergme.h"
|
||||||
|
|
||||||
|
#include <tag.h>
|
||||||
|
#include <apefile.h>
|
||||||
|
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QString>
|
||||||
|
#include <QChar>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QTextStream>
|
||||||
|
|
||||||
|
#include "utilities/timeconstants.h"
|
||||||
|
#include "core/logging.h"
|
||||||
|
#include "core/messagehandler.h"
|
||||||
|
#include "tagreaderbase.h"
|
||||||
|
#include "tagreadertaglib.h"
|
||||||
|
|
||||||
|
bool GME::IsSupportedFormat(const QFileInfo &file_info) {
|
||||||
|
return file_info.exists() && (file_info.completeSuffix().endsWith("spc", Qt::CaseInsensitive) || file_info.completeSuffix().endsWith("vgm"), Qt::CaseInsensitive);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GME::ReadFile(const QFileInfo &file_info, spb::tagreader::SongMetadata *song_info) {
|
||||||
|
|
||||||
|
if (file_info.completeSuffix().endsWith("spc"), Qt::CaseInsensitive) {
|
||||||
|
SPC::Read(file_info, song_info);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (file_info.completeSuffix().endsWith("vgm", Qt::CaseInsensitive)) {
|
||||||
|
VGM::Read(file_info, song_info);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
quint32 GME::UnpackBytes32(const char *const bytes, size_t length) {
|
||||||
|
|
||||||
|
Q_ASSERT(length <= 4 && length > 0);
|
||||||
|
|
||||||
|
quint32 value = 0;
|
||||||
|
for (size_t i = 0; i < length; i++) {
|
||||||
|
value |= static_cast<unsigned char>(bytes[i]) << (8 * i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GME::SPC::Read(const QFileInfo &file_info, spb::tagreader::SongMetadata *song_info) {
|
||||||
|
|
||||||
|
QFile file(file_info.filePath());
|
||||||
|
if (!file.open(QIODevice::ReadOnly)) return;
|
||||||
|
|
||||||
|
qLog(Debug) << "Reading tags from SPC file" << file_info.fileName();
|
||||||
|
|
||||||
|
// Check for header -- more reliable than file name alone.
|
||||||
|
if (!file.read(33).startsWith(QString("SNES-SPC700").toLatin1())) return;
|
||||||
|
|
||||||
|
// First order of business -- get any tag values that exist within the core file information.
|
||||||
|
// These only allow for a certain number of bytes per field,
|
||||||
|
// so they will likely be overwritten either by the id666 standard or the APETAG format (as used by other players, such as foobar and winamp)
|
||||||
|
//
|
||||||
|
// Make sure to check id6 documentation before changing the read values!
|
||||||
|
|
||||||
|
file.seek(HAS_ID6_OFFSET);
|
||||||
|
bool has_id6 = (file.read(1)[0] == static_cast<char>(xID6_STATUS::ON));
|
||||||
|
|
||||||
|
file.seek(SONG_TITLE_OFFSET);
|
||||||
|
song_info->set_title(QString::fromLatin1(file.read(32)).toStdString());
|
||||||
|
|
||||||
|
file.seek(GAME_TITLE_OFFSET);
|
||||||
|
song_info->set_album(QString::fromLatin1(file.read(32)).toStdString());
|
||||||
|
|
||||||
|
file.seek(ARTIST_OFFSET);
|
||||||
|
song_info->set_artist(QString::fromLatin1(file.read(32)).toStdString());
|
||||||
|
|
||||||
|
file.seek(INTRO_LENGTH_OFFSET);
|
||||||
|
QByteArray length_bytes = file.read(INTRO_LENGTH_SIZE);
|
||||||
|
quint64 length_in_sec = 0;
|
||||||
|
if (length_bytes.size() >= INTRO_LENGTH_SIZE) {
|
||||||
|
length_in_sec = ConvertSPCStringToNum(length_bytes);
|
||||||
|
|
||||||
|
if (!length_in_sec || length_in_sec >= 0x1FFF) {
|
||||||
|
// This means that parsing the length as a string failed, so get value LE.
|
||||||
|
length_in_sec = length_bytes[0] | (length_bytes[1] << 8) | (length_bytes[2] << 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (length_in_sec < 0x1FFF) {
|
||||||
|
song_info->set_length_nanosec(length_in_sec * kNsecPerSec);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
file.seek(FADE_LENGTH_OFFSET);
|
||||||
|
QByteArray fade_bytes = file.read(FADE_LENGTH_SIZE);
|
||||||
|
if (fade_bytes.size() >= FADE_LENGTH_SIZE) {
|
||||||
|
quint64 fade_length_in_ms = ConvertSPCStringToNum(fade_bytes);
|
||||||
|
|
||||||
|
if (fade_length_in_ms > 0x7FFF) {
|
||||||
|
fade_length_in_ms = fade_bytes[0] | (fade_bytes[1] << 8) | (fade_bytes[2] << 16) | (fade_bytes[3] << 24);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for XID6 data -- this is infrequently used, but being able to fill in data from this is ideal before trying to rely on APETAG values.
|
||||||
|
// XID6 format follows EA's binary file format standard named "IFF"
|
||||||
|
file.seek(XID6_OFFSET);
|
||||||
|
if (has_id6 && file.read(4) == QString("xid6").toLatin1()) {
|
||||||
|
QByteArray xid6_head_data = file.read(4);
|
||||||
|
if (xid6_head_data.size() >= 4) {
|
||||||
|
qint64 xid6_size = xid6_head_data[0] | (xid6_head_data[1] << 8) | (xid6_head_data[2] << 16) | xid6_head_data[3];
|
||||||
|
// This should be the size remaining for entire ID6 block, but it seems that most files treat this as the size of the remaining header space...
|
||||||
|
|
||||||
|
qLog(Debug) << file_info.fileName() << "has ID6 tag.";
|
||||||
|
|
||||||
|
while ((file.pos()) + 4 < XID6_OFFSET + xid6_size) {
|
||||||
|
QByteArray arr = file.read(4);
|
||||||
|
if (arr.size() < 4) break;
|
||||||
|
|
||||||
|
qint8 id = arr[0];
|
||||||
|
qint8 type = arr[1];
|
||||||
|
Q_UNUSED(id);
|
||||||
|
Q_UNUSED(type);
|
||||||
|
qint16 length = arr[2] | (arr[3] << 8);
|
||||||
|
|
||||||
|
file.read(GetNextMemAddressAlign32bit(length));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Music Players that support SPC tend to support additional tagging data as
|
||||||
|
// an APETAG entry at the bottom of the file instead of writing into the xid6 tagging space.
|
||||||
|
// This is where a lot of the extra data for a file is stored, such as genre or replaygain data.
|
||||||
|
// This data is currently supported by TagLib, so we will simply use that for the remaining values.
|
||||||
|
TagLib::APE::File ape(file_info.filePath().toStdString().data());
|
||||||
|
if (ape.hasAPETag()) {
|
||||||
|
TagLib::Tag *tag = ape.tag();
|
||||||
|
if (!tag) return;
|
||||||
|
|
||||||
|
TagReaderTagLib::Decode(tag->artist(), song_info->mutable_artist());
|
||||||
|
TagReaderTagLib::Decode(tag->album(), song_info->mutable_album());
|
||||||
|
TagReaderTagLib::Decode(tag->title(), song_info->mutable_title());
|
||||||
|
TagReaderTagLib::Decode(tag->genre(), song_info->mutable_genre());
|
||||||
|
song_info->set_track(tag->track());
|
||||||
|
song_info->set_year(tag->year());
|
||||||
|
}
|
||||||
|
|
||||||
|
song_info->set_valid(true);
|
||||||
|
song_info->set_filetype(spb::tagreader::SongMetadata_FileType_SPC);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
qint16 GME::SPC::GetNextMemAddressAlign32bit(qint16 input) {
|
||||||
|
return ((input + 0x3) & ~0x3);
|
||||||
|
// Plus 0x3 for rounding up (not down), AND NOT to flatten out on a 32 bit level.
|
||||||
|
}
|
||||||
|
|
||||||
|
quint64 GME::SPC::ConvertSPCStringToNum(const QByteArray &arr) {
|
||||||
|
|
||||||
|
quint64 result = 0;
|
||||||
|
for (auto it = arr.begin(); it != arr.end(); it++) {
|
||||||
|
unsigned int num = *it - '0';
|
||||||
|
if (num > 9) break;
|
||||||
|
result = (result * 10) + num; // Shift Left and add.
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GME::VGM::Read(const QFileInfo &file_info, spb::tagreader::SongMetadata *song_info) {
|
||||||
|
|
||||||
|
QFile file(file_info.filePath());
|
||||||
|
if (!file.open(QIODevice::ReadOnly)) return;
|
||||||
|
|
||||||
|
qLog(Debug) << "Reading tags from VGM file" << file_info.fileName();
|
||||||
|
|
||||||
|
if (!file.read(4).startsWith(QString("Vgm ").toLatin1())) return;
|
||||||
|
|
||||||
|
file.seek(GD3_TAG_PTR);
|
||||||
|
QByteArray gd3_head = file.read(4);
|
||||||
|
if (gd3_head.size() < 4) return;
|
||||||
|
|
||||||
|
quint64 pt = GME::UnpackBytes32(gd3_head.constData(), gd3_head.size());
|
||||||
|
|
||||||
|
file.seek(SAMPLE_COUNT);
|
||||||
|
QByteArray sample_count_bytes = file.read(4);
|
||||||
|
file.seek(LOOP_SAMPLE_COUNT);
|
||||||
|
QByteArray loop_count_bytes = file.read(4);
|
||||||
|
quint64 length = 0;
|
||||||
|
|
||||||
|
if (!GetPlaybackLength(sample_count_bytes, loop_count_bytes, length)) return;
|
||||||
|
|
||||||
|
file.seek(GD3_TAG_PTR + pt);
|
||||||
|
QByteArray gd3_version = file.read(4);
|
||||||
|
|
||||||
|
file.seek(file.pos() + 4);
|
||||||
|
QByteArray gd3_length_bytes = file.read(4);
|
||||||
|
quint32 gd3_length = GME::UnpackBytes32(gd3_length_bytes.constData(), gd3_length_bytes.size());
|
||||||
|
|
||||||
|
QByteArray gd3Data = file.read(gd3_length);
|
||||||
|
QTextStream fileTagStream(gd3Data, QIODevice::ReadOnly);
|
||||||
|
// Stored as 16 bit UTF string, two bytes per letter.
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
fileTagStream.setEncoding(QStringConverter::Utf16);
|
||||||
|
#else
|
||||||
|
fileTagStream.setCodec("UTF-16");
|
||||||
|
#endif
|
||||||
|
QStringList strings = fileTagStream.readLine(0).split(QChar('\0'));
|
||||||
|
if (strings.count() < 10) return;
|
||||||
|
|
||||||
|
// VGM standard dictates string tag data exist in specific order.
|
||||||
|
// Order alternates between English and Japanese version of data.
|
||||||
|
// Read GD3 tag standard for more details.
|
||||||
|
song_info->set_title(strings[0].toStdString());
|
||||||
|
song_info->set_album(strings[2].toStdString());
|
||||||
|
song_info->set_artist(strings[6].toStdString());
|
||||||
|
song_info->set_year(strings[8].left(4).toInt());
|
||||||
|
song_info->set_length_nanosec(length * kNsecPerMsec);
|
||||||
|
song_info->set_valid(true);
|
||||||
|
song_info->set_filetype(spb::tagreader::SongMetadata_FileType_VGM);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GME::VGM::GetPlaybackLength(const QByteArray &sample_count_bytes, const QByteArray &loop_count_bytes, quint64 &out_length) {
|
||||||
|
|
||||||
|
if (sample_count_bytes.size() != 4) return false;
|
||||||
|
if (loop_count_bytes.size() != 4) return false;
|
||||||
|
|
||||||
|
quint64 sample_count = GME::UnpackBytes32(sample_count_bytes.constData(), sample_count_bytes.size());
|
||||||
|
|
||||||
|
if (sample_count <= 0) return false;
|
||||||
|
|
||||||
|
quint64 loop_sample_count = GME::UnpackBytes32(loop_count_bytes.constData(), loop_count_bytes.size());
|
||||||
|
|
||||||
|
if (loop_sample_count <= 0) {
|
||||||
|
out_length = sample_count * 1000 / SAMPLE_TIMEBASE;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
quint64 intro_length_ms = (sample_count - loop_sample_count) * 1000 / SAMPLE_TIMEBASE;
|
||||||
|
quint64 loop_length_ms = (loop_sample_count) * 1000 / SAMPLE_TIMEBASE;
|
||||||
|
out_length = intro_length_ms + (loop_length_ms * 2) + GST_GME_LOOP_TIME_MS;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
TagReaderGME::TagReaderGME() = default;
|
||||||
|
TagReaderGME::~TagReaderGME() = default;
|
||||||
|
|
||||||
|
bool TagReaderGME::IsMediaFile(const QString &filename) const {
|
||||||
|
QFileInfo fileinfo(filename);
|
||||||
|
return GME::IsSupportedFormat(fileinfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TagReaderGME::ReadFile(const QString &filename, spb::tagreader::SongMetadata *song) const {
|
||||||
|
QFileInfo fileinfo(filename);
|
||||||
|
return GME::ReadFile(fileinfo, song);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TagReaderGME::SaveFile(const QString&, const spb::tagreader::SongMetadata&) const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray TagReaderGME::LoadEmbeddedArt(const QString&) const {
|
||||||
|
return QByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TagReaderGME::SaveEmbeddedArt(const QString&, const QByteArray&) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TagReaderGME::SaveSongPlaycountToFile(const QString&, const spb::tagreader::SongMetadata&) const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TagReaderGME::SaveSongRatingToFile(const QString&, const spb::tagreader::SongMetadata&) const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
111
ext/libstrawberry-tagreader/tagreadergme.h
Normal file
111
ext/libstrawberry-tagreader/tagreadergme.h
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
/*
|
||||||
|
* Strawberry Music Player
|
||||||
|
* Copyright 2022, Eoin O'Neill <eoinoneill1991@gmail.com>
|
||||||
|
*
|
||||||
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TAGREADERGME_H
|
||||||
|
#define TAGREADERGME_H
|
||||||
|
|
||||||
|
#include <taglib/tstring.h>
|
||||||
|
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QString>
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
|
#include "tagreaderbase.h"
|
||||||
|
#include "tagreadermessages.pb.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace GME {
|
||||||
|
bool IsSupportedFormat(const QFileInfo &file_info);
|
||||||
|
bool ReadFile(const QFileInfo &file_info, spb::tagreader::SongMetadata *song_info);
|
||||||
|
|
||||||
|
uint32_t UnpackBytes32(const char *const arr, size_t length);
|
||||||
|
|
||||||
|
namespace SPC {
|
||||||
|
// SPC SPEC: http://vspcplay.raphnet.net/spc_file_format.txt
|
||||||
|
|
||||||
|
constexpr int HAS_ID6_OFFSET = 0x23;
|
||||||
|
constexpr int SONG_TITLE_OFFSET = 0x2E;
|
||||||
|
constexpr int GAME_TITLE_OFFSET = 0x4E;
|
||||||
|
constexpr int DUMPER_OFFSET = 0x6E;
|
||||||
|
constexpr int COMMENTS_OFFSET = 0x7E;
|
||||||
|
// It seems that intro length and fade length are inconsistent from file to file.
|
||||||
|
// It should be looked into within the GME source code to see how GStreamer gets its values for playback length.
|
||||||
|
constexpr int INTRO_LENGTH_OFFSET = 0xA9;
|
||||||
|
constexpr int INTRO_LENGTH_SIZE = 3;
|
||||||
|
constexpr int FADE_LENGTH_OFFSET = 0xAC;
|
||||||
|
constexpr int FADE_LENGTH_SIZE = 4;
|
||||||
|
constexpr int ARTIST_OFFSET = 0xB1;
|
||||||
|
constexpr int XID6_OFFSET = (0x101C0 + 64);
|
||||||
|
|
||||||
|
constexpr int NANO_PER_MS = 1000000;
|
||||||
|
|
||||||
|
enum xID6_STATUS {
|
||||||
|
ON = 0x26,
|
||||||
|
OFF = 0x27,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum xID6_ID { SongName = 0x01, GameName = 0x02, ArtistName = 0x03 };
|
||||||
|
|
||||||
|
enum xID6_TYPE { Length = 0x0, String = 0x1, Integer = 0x4 };
|
||||||
|
|
||||||
|
void Read(const QFileInfo &file_info, spb::tagreader::SongMetadata *song_info);
|
||||||
|
qint16 GetNextMemAddressAlign32bit(qint16 input);
|
||||||
|
quint64 ConvertSPCStringToNum(const QByteArray &arr);
|
||||||
|
} // namespace SPC
|
||||||
|
|
||||||
|
namespace VGM {
|
||||||
|
// VGM SPEC:
|
||||||
|
// http://www.smspower.org/uploads/Music/vgmspec170.txt?sid=17c810c54633b6dd4982f92f718361c1
|
||||||
|
// GD3 TAG SPEC:
|
||||||
|
// http://www.smspower.org/uploads/Music/gd3spec100.txt
|
||||||
|
constexpr int GD3_TAG_PTR = 0x14;
|
||||||
|
constexpr int SAMPLE_COUNT = 0x18;
|
||||||
|
constexpr int LOOP_SAMPLE_COUNT = 0x20;
|
||||||
|
constexpr int SAMPLE_TIMEBASE = 44100;
|
||||||
|
constexpr int GST_GME_LOOP_TIME_MS = 8000;
|
||||||
|
|
||||||
|
void Read(const QFileInfo &file_info, spb::tagreader::SongMetadata *song_info);
|
||||||
|
// Takes in two QByteArrays, expected to be 4 bytes long. Desired length is returned via output parameter out_length. Returns false on error.
|
||||||
|
bool GetPlaybackLength(const QByteArray &sample_count_bytes, const QByteArray &loop_count_bytes, quint64 &out_length);
|
||||||
|
|
||||||
|
} // namespace VGM
|
||||||
|
|
||||||
|
} // namespace GME
|
||||||
|
|
||||||
|
// TagReaderGME
|
||||||
|
// Fulfills Strawberry's Intended interface for tag reading.
|
||||||
|
class TagReaderGME : public TagReaderBase {
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit TagReaderGME();
|
||||||
|
~TagReaderGME();
|
||||||
|
|
||||||
|
bool IsMediaFile(const QString &filename) const override;
|
||||||
|
|
||||||
|
bool ReadFile(const QString &filename, spb::tagreader::SongMetadata *song) const override;
|
||||||
|
bool SaveFile(const QString &filename, const spb::tagreader::SongMetadata &song) const override;
|
||||||
|
|
||||||
|
QByteArray LoadEmbeddedArt(const QString &filename) const 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;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -27,6 +27,8 @@ message SongMetadata {
|
|||||||
S3M = 19;
|
S3M = 19;
|
||||||
XM = 20;
|
XM = 20;
|
||||||
IT = 21;
|
IT = 21;
|
||||||
|
SPC = 22;
|
||||||
|
VGM = 23;
|
||||||
CDDA = 90;
|
CDDA = 90;
|
||||||
STREAM = 91;
|
STREAM = 91;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "core/messagehandler.h"
|
#include "core/messagehandler.h"
|
||||||
#include "core/timeconstants.h"
|
#include "utilities/timeconstants.h"
|
||||||
|
|
||||||
class FileRefFactory {
|
class FileRefFactory {
|
||||||
public:
|
public:
|
||||||
@@ -186,7 +186,7 @@ spb::tagreader::SongMetadata_FileType TagReaderTagLib::GuessFileType(TagLib::Fil
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMetadata *song) const {
|
bool 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 fileinfo(filename);
|
const QFileInfo fileinfo(filename);
|
||||||
@@ -212,7 +212,7 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
|||||||
std::unique_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename));
|
std::unique_ptr<TagLib::FileRef> fileref(factory_->GetFileRef(filename));
|
||||||
if (fileref->isNull()) {
|
if (fileref->isNull()) {
|
||||||
qLog(Info) << "TagLib hasn't been able to read" << filename << "file";
|
qLog(Info) << "TagLib hasn't been able to read" << filename << "file";
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
song->set_filetype(GuessFileType(fileref.get()));
|
song->set_filetype(GuessFileType(fileref.get()));
|
||||||
@@ -254,9 +254,7 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
|||||||
}
|
}
|
||||||
|
|
||||||
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())) {
|
||||||
|
|
||||||
song->set_bitdepth(file_flac->audioProperties()->bitsPerSample());
|
song->set_bitdepth(file_flac->audioProperties()->bitsPerSample());
|
||||||
|
|
||||||
if (file_flac->xiphComment()) {
|
if (file_flac->xiphComment()) {
|
||||||
ParseOggTag(file_flac->xiphComment()->fieldListMap(), &disc, &compilation, song);
|
ParseOggTag(file_flac->xiphComment()->fieldListMap(), &disc, &compilation, song);
|
||||||
TagLib::List<TagLib::FLAC::Picture*> pictures = file_flac->pictureList();
|
TagLib::List<TagLib::FLAC::Picture*> pictures = file_flac->pictureList();
|
||||||
@@ -299,15 +297,11 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
|||||||
// content group
|
// content group
|
||||||
if (!map["TIT1"].isEmpty()) Decode(map["TIT1"].front()->toString(), song->mutable_grouping());
|
if (!map["TIT1"].isEmpty()) Decode(map["TIT1"].front()->toString(), song->mutable_grouping());
|
||||||
|
|
||||||
// ID3v2: lead performer/soloist
|
|
||||||
if (!map["TPE1"].isEmpty()) Decode(map["TPE1"].front()->toString(), song->mutable_performer());
|
|
||||||
|
|
||||||
// original artist/performer
|
// original artist/performer
|
||||||
if (!map["TOPE"].isEmpty()) Decode(map["TOPE"].front()->toString(), song->mutable_performer());
|
if (!map["TOPE"].isEmpty()) Decode(map["TOPE"].front()->toString(), song->mutable_performer());
|
||||||
|
|
||||||
// Skip TPE1 (which is the artist) here because we already fetched it
|
// Skip TPE1 (which is the artist) here because we already fetched it
|
||||||
|
|
||||||
|
|
||||||
// non-standard: Apple, Microsoft
|
// non-standard: Apple, Microsoft
|
||||||
if (!map["TPE2"].isEmpty()) Decode(map["TPE2"].front()->toString(), song->mutable_albumartist());
|
if (!map["TPE2"].isEmpty()) Decode(map["TPE2"].front()->toString(), song->mutable_albumartist());
|
||||||
|
|
||||||
@@ -402,6 +396,10 @@ 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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mp4_tag->item("cpil").isValid()) {
|
||||||
|
song->set_compilation(mp4_tag->item("cpil").toBool());
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
TagLib::MP4::Item item = mp4_tag->item(kMP4_FMPS_Playcount_ID);
|
TagLib::MP4::Item item = mp4_tag->item(kMP4_FMPS_Playcount_ID);
|
||||||
if (item.isValid()) {
|
if (item.isValid()) {
|
||||||
@@ -517,6 +515,8 @@ void TagReaderTagLib::ReadFile(const QString &filename, spb::tagreader::SongMeta
|
|||||||
if (song->bitrate() <= 0) { song->set_bitrate(-1); }
|
if (song->bitrate() <= 0) { song->set_bitrate(-1); }
|
||||||
if (song->lastplayed() <= 0) { song->set_lastplayed(-1); }
|
if (song->lastplayed() <= 0) { song->set_lastplayed(-1); }
|
||||||
|
|
||||||
|
return song->filetype() != spb::tagreader::SongMetadata_FileType_UNKNOWN;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TagReaderTagLib::Decode(const TagLib::String &tag, std::string *output) {
|
void TagReaderTagLib::Decode(const TagLib::String &tag, std::string *output) {
|
||||||
@@ -526,12 +526,6 @@ void TagReaderTagLib::Decode(const TagLib::String &tag, std::string *output) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TagReaderTagLib::Decode(const QString &tag, std::string *output) {
|
|
||||||
|
|
||||||
output->assign(DataCommaSizeFromQString(tag));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void TagReaderTagLib::ParseOggTag(const TagLib::Ogg::FieldListMap &map, QString *disc, QString *compilation, spb::tagreader::SongMetadata *song) const {
|
void TagReaderTagLib::ParseOggTag(const TagLib::Ogg::FieldListMap &map, QString *disc, QString *compilation, spb::tagreader::SongMetadata *song) const {
|
||||||
|
|
||||||
if (!map["COMPOSER"].isEmpty()) Decode(map["COMPOSER"].front(), song->mutable_composer());
|
if (!map["COMPOSER"].isEmpty()) Decode(map["COMPOSER"].front(), song->mutable_composer());
|
||||||
@@ -693,7 +687,7 @@ bool TagReaderTagLib::SaveFile(const QString &filename, const spb::tagreader::So
|
|||||||
tag->setItem("\251grp", TagLib::StringList(TagLib::String(song.grouping(), TagLib::String::UTF8)));
|
tag->setItem("\251grp", TagLib::StringList(TagLib::String(song.grouping(), TagLib::String::UTF8)));
|
||||||
tag->setItem("\251lyr", TagLib::StringList(TagLib::String(song.lyrics(), TagLib::String::UTF8)));
|
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("aART", TagLib::StringList(TagLib::String(song.albumartist(), TagLib::String::UTF8)));
|
||||||
tag->setItem("cpil", TagLib::StringList(song.compilation() ? "1" : "0"));
|
tag->setItem("cpil", TagLib::MP4::Item(song.compilation()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
@@ -1047,30 +1041,6 @@ TagLib::ID3v2::PopularimeterFrame *TagReaderTagLib::GetPOPMFrameFromTag(TagLib::
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
bool TagReaderTagLib::SaveSongPlaycountToFile(const QString &filename, const spb::tagreader::SongMetadata &song) const {
|
||||||
|
|
||||||
if (filename.isEmpty()) return false;
|
if (filename.isEmpty()) return false;
|
||||||
@@ -1094,14 +1064,14 @@ bool TagReaderTagLib::SaveSongPlaycountToFile(const QString &filename, const spb
|
|||||||
TagLib::APE::Tag *tag = wavpack_file->APETag(true);
|
TagLib::APE::Tag *tag = wavpack_file->APETag(true);
|
||||||
if (!tag) return false;
|
if (!tag) return false;
|
||||||
if (song.playcount() > 0) {
|
if (song.playcount() > 0) {
|
||||||
tag->setItem("FMPS_PlayCount", TagLib::APE::Item("FMPS_PlayCount", TagLib::String::number(static_cast<int>(song.playcount()))));
|
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())) {
|
else if (TagLib::APE::File *ape_file = dynamic_cast<TagLib::APE::File*>(fileref->file())) {
|
||||||
TagLib::APE::Tag *tag = ape_file->APETag(true);
|
TagLib::APE::Tag *tag = ape_file->APETag(true);
|
||||||
if (!tag) return false;
|
if (!tag) return false;
|
||||||
if (song.playcount() > 0) {
|
if (song.playcount() > 0) {
|
||||||
tag->setItem("FMPS_PlayCount", TagLib::APE::Item("FMPS_PlayCount", TagLib::String::number(static_cast<int>(song.playcount()))));
|
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())) {
|
else if (TagLib::Ogg::XiphComment *xiph_comment = dynamic_cast<TagLib::Ogg::XiphComment*>(fileref->file()->tag())) {
|
||||||
@@ -1116,7 +1086,7 @@ bool TagReaderTagLib::SaveSongPlaycountToFile(const QString &filename, const spb
|
|||||||
TagLib::ID3v2::Tag *tag = mpeg_file->ID3v2Tag(true);
|
TagLib::ID3v2::Tag *tag = mpeg_file->ID3v2Tag(true);
|
||||||
if (!tag) return false;
|
if (!tag) return false;
|
||||||
if (song.playcount() > 0) {
|
if (song.playcount() > 0) {
|
||||||
SetUserTextFrame("FMPS_PlayCount", QString::number(song.playcount()), tag);
|
SetUserTextFrame("FMPS_Playcount", QString::number(song.playcount()), tag);
|
||||||
TagLib::ID3v2::PopularimeterFrame *frame = GetPOPMFrameFromTag(tag);
|
TagLib::ID3v2::PopularimeterFrame *frame = GetPOPMFrameFromTag(tag);
|
||||||
if (frame) {
|
if (frame) {
|
||||||
frame->setCounter(song.playcount());
|
frame->setCounter(song.playcount());
|
||||||
@@ -1135,7 +1105,7 @@ bool TagReaderTagLib::SaveSongPlaycountToFile(const QString &filename, const spb
|
|||||||
TagLib::APE::Tag *tag = mpc_file->APETag(true);
|
TagLib::APE::Tag *tag = mpc_file->APETag(true);
|
||||||
if (!tag) return false;
|
if (!tag) return false;
|
||||||
if (song.playcount() > 0) {
|
if (song.playcount() > 0) {
|
||||||
tag->setItem("FMPS_PlayCount", TagLib::APE::Item("FMPS_PlayCount", TagLib::String::number(static_cast<int>(song.playcount()))));
|
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())) {
|
else if (TagLib::ASF::File *asf_file = dynamic_cast<TagLib::ASF::File*>(fileref->file())) {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class TagReaderTagLib : public TagReaderBase {
|
|||||||
|
|
||||||
bool IsMediaFile(const QString &filename) const override;
|
bool IsMediaFile(const QString &filename) const override;
|
||||||
|
|
||||||
void ReadFile(const QString &filename, spb::tagreader::SongMetadata *song) const override;
|
bool ReadFile(const QString &filename, spb::tagreader::SongMetadata *song) const override;
|
||||||
bool SaveFile(const QString &filename, const spb::tagreader::SongMetadata &song) const override;
|
bool SaveFile(const QString &filename, const spb::tagreader::SongMetadata &song) const override;
|
||||||
|
|
||||||
QByteArray LoadEmbeddedArt(const QString &filename) const override;
|
QByteArray LoadEmbeddedArt(const QString &filename) const override;
|
||||||
@@ -59,12 +59,11 @@ class TagReaderTagLib : public TagReaderBase {
|
|||||||
bool SaveSongPlaycountToFile(const QString &filename, const spb::tagreader::SongMetadata &song) const 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;
|
bool SaveSongRatingToFile(const QString &filename, const spb::tagreader::SongMetadata &song) const override;
|
||||||
|
|
||||||
|
static void Decode(const TagLib::String &tag, std::string *output);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
spb::tagreader::SongMetadata_FileType GuessFileType(TagLib::FileRef *fileref) const;
|
spb::tagreader::SongMetadata_FileType GuessFileType(TagLib::FileRef *fileref) const;
|
||||||
|
|
||||||
static void Decode(const TagLib::String &tag, std::string *output);
|
|
||||||
static void Decode(const QString &tag, std::string *output);
|
|
||||||
|
|
||||||
void ParseOggTag(const TagLib::Ogg::FieldListMap &map, QString *disc, QString *compilation, spb::tagreader::SongMetadata *song) const;
|
void ParseOggTag(const TagLib::Ogg::FieldListMap &map, QString *disc, QString *compilation, spb::tagreader::SongMetadata *song) const;
|
||||||
void ParseAPETag(const TagLib::APE::ItemListMap &map, QString *disc, QString *compilation, spb::tagreader::SongMetadata *song) const;
|
void ParseAPETag(const TagLib::APE::ItemListMap &map, QString *disc, QString *compilation, spb::tagreader::SongMetadata *song) const;
|
||||||
|
|
||||||
@@ -79,8 +78,6 @@ class TagReaderTagLib : public TagReaderBase {
|
|||||||
|
|
||||||
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);
|
static TagLib::ID3v2::PopularimeterFrame *GetPOPMFrameFromTag(TagLib::ID3v2::Tag *tag);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -93,13 +93,13 @@ bool TagReaderTagParser::IsMediaFile(const QString &filename) const {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TagReaderTagParser::ReadFile(const QString &filename, spb::tagreader::SongMetadata *song) const {
|
bool TagReaderTagParser::ReadFile(const QString &filename, spb::tagreader::SongMetadata *song) const {
|
||||||
|
|
||||||
qLog(Debug) << "Reading tags from" << filename;
|
qLog(Debug) << "Reading tags from" << filename;
|
||||||
|
|
||||||
const QFileInfo fileinfo(filename);
|
const QFileInfo fileinfo(filename);
|
||||||
|
|
||||||
if (!fileinfo.exists() || fileinfo.suffix().compare("bak", Qt::CaseInsensitive) == 0) return;
|
if (!fileinfo.exists() || fileinfo.suffix().compare("bak", Qt::CaseInsensitive) == 0) return false;
|
||||||
|
|
||||||
const QByteArray url(QUrl::fromLocalFile(filename).toEncoded());
|
const QByteArray url(QUrl::fromLocalFile(filename).toEncoded());
|
||||||
|
|
||||||
@@ -135,19 +135,19 @@ void TagReaderTagParser::ReadFile(const QString &filename, spb::tagreader::SongM
|
|||||||
taginfo.parseContainerFormat(diag, progress);
|
taginfo.parseContainerFormat(diag, progress);
|
||||||
if (progress.isAborted()) {
|
if (progress.isAborted()) {
|
||||||
taginfo.close();
|
taginfo.close();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
taginfo.parseTracks(diag, progress);
|
taginfo.parseTracks(diag, progress);
|
||||||
if (progress.isAborted()) {
|
if (progress.isAborted()) {
|
||||||
taginfo.close();
|
taginfo.close();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
taginfo.parseTags(diag, progress);
|
taginfo.parseTags(diag, progress);
|
||||||
if (progress.isAborted()) {
|
if (progress.isAborted()) {
|
||||||
taginfo.close();
|
taginfo.close();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const TagParser::DiagMessage &msg : diag) {
|
for (const TagParser::DiagMessage &msg : diag) {
|
||||||
@@ -206,7 +206,7 @@ void TagReaderTagParser::ReadFile(const QString &filename, spb::tagreader::SongM
|
|||||||
|
|
||||||
if (song->filetype() == spb::tagreader::SongMetadata_FileType::SongMetadata_FileType_UNKNOWN) {
|
if (song->filetype() == spb::tagreader::SongMetadata_FileType::SongMetadata_FileType_UNKNOWN) {
|
||||||
taginfo.close();
|
taginfo.close();
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto tag : taginfo.tags()) {
|
for (const auto tag : taginfo.tags()) {
|
||||||
@@ -227,6 +227,10 @@ void TagReaderTagParser::ReadFile(const QString &filename, spb::tagreader::SongM
|
|||||||
if (!tag->value(TagParser::KnownField::Cover).empty() && tag->value(TagParser::KnownField::Cover).dataSize() > 0) {
|
if (!tag->value(TagParser::KnownField::Cover).empty() && tag->value(TagParser::KnownField::Cover).dataSize() > 0) {
|
||||||
song->set_art_automatic(kEmbeddedCover);
|
song->set_art_automatic(kEmbeddedCover);
|
||||||
}
|
}
|
||||||
|
const float rating = ConvertPOPMRating(tag->value(TagParser::KnownField::Rating));
|
||||||
|
if (song->rating() <= 0 && rating > 0.0 && rating <= 1.0) {
|
||||||
|
song->set_rating(rating);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set integer fields to -1 if they're not valid
|
// Set integer fields to -1 if they're not valid
|
||||||
@@ -243,8 +247,12 @@ void TagReaderTagParser::ReadFile(const QString &filename, spb::tagreader::SongM
|
|||||||
|
|
||||||
taginfo.close();
|
taginfo.close();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(...) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
catch(...) {}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,7 +477,7 @@ bool TagReaderTagParser::SaveSongRatingToFile(const QString &filename, const spb
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const auto tag : taginfo.tags()) {
|
for (const auto tag : taginfo.tags()) {
|
||||||
tag->setValue(TagParser::KnownField::Rating, TagParser::TagValue(song.rating()));
|
tag->setValue(TagParser::KnownField::Rating, TagParser::TagValue(ConvertToPOPMRating(song.rating())));
|
||||||
}
|
}
|
||||||
taginfo.applyChanges(diag, progress);
|
taginfo.applyChanges(diag, progress);
|
||||||
taginfo.close();
|
taginfo.close();
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class TagReaderTagParser : public TagReaderBase {
|
|||||||
|
|
||||||
bool IsMediaFile(const QString &filename) const override;
|
bool IsMediaFile(const QString &filename) const override;
|
||||||
|
|
||||||
void ReadFile(const QString &filename, spb::tagreader::SongMetadata *song) const override;
|
bool ReadFile(const QString &filename, spb::tagreader::SongMetadata *song) const override;
|
||||||
bool SaveFile(const QString &filename, const spb::tagreader::SongMetadata &song) const override;
|
bool SaveFile(const QString &filename, const spb::tagreader::SongMetadata &song) const override;
|
||||||
|
|
||||||
QByteArray LoadEmbeddedArt(const QString &filename) const override;
|
QByteArray LoadEmbeddedArt(const QString &filename) const override;
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ int main(int argc, char **argv) {
|
|||||||
qLog(Error) << "First line" << first_line << "does not match" << filepath;
|
qLog(Error) << "First line" << first_line << "does not match" << filepath;
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
QRegularExpression regexp(QStringLiteral("^\\t(.+) \\(compatibility version (\\d+\\.\\d+\\.\\d+), current version (\\d+\\.\\d+\\.\\d+)(, weak)?\\)$"));
|
QRegularExpression regexp(QStringLiteral("^\\t(.+) \\(compatibility version (\\d+\\.\\d+\\.\\d+), current version (\\d+\\.\\d+\\.\\d+)(, weak|, reexport)?\\)$"));
|
||||||
for (const QString &output_line : output_lines) {
|
for (const QString &output_line : output_lines) {
|
||||||
|
|
||||||
//qDebug() << "Final check on" << filepath << output_line;
|
//qDebug() << "Final check on" << filepath << output_line;
|
||||||
@@ -130,9 +130,6 @@ int main(int argc, char **argv) {
|
|||||||
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.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
qLog(Error) << "File" << filepath << "points to" << library;
|
qLog(Error) << "File" << filepath << "points to" << library;
|
||||||
success = false;
|
success = false;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
|
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
|
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
|
|||||||
@@ -34,28 +34,11 @@ void TagReaderWorker::MessageArrived(const spb::tagreader::Message &message) {
|
|||||||
|
|
||||||
spb::tagreader::Message reply;
|
spb::tagreader::Message reply;
|
||||||
|
|
||||||
if (message.has_is_media_file_request()) {
|
bool success = HandleMessage(message, reply, &tag_reader_);
|
||||||
reply.mutable_is_media_file_response()->set_success(tag_reader_.IsMediaFile(QStringFromStdString(message.is_media_file_request().filename())));
|
if (!success) {
|
||||||
}
|
#if defined(USE_TAGLIB)
|
||||||
else if (message.has_read_file_request()) {
|
HandleMessage(message, reply, &tag_reader_gme_);
|
||||||
tag_reader_.ReadFile(QStringFromStdString(message.read_file_request().filename()), reply.mutable_read_file_response()->mutable_metadata());
|
#endif
|
||||||
}
|
|
||||||
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()));
|
|
||||||
}
|
|
||||||
else if (message.has_load_embedded_art_request()) {
|
|
||||||
QByteArray data = tag_reader_.LoadEmbeddedArt(QStringFromStdString(message.load_embedded_art_request().filename()));
|
|
||||||
reply.mutable_load_embedded_art_response()->set_data(data.constData(), data.size());
|
|
||||||
}
|
|
||||||
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(), 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);
|
||||||
@@ -63,7 +46,50 @@ void TagReaderWorker::MessageArrived(const spb::tagreader::Message &message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TagReaderWorker::DeviceClosed() {
|
void TagReaderWorker::DeviceClosed() {
|
||||||
|
|
||||||
AbstractMessageHandler<spb::tagreader::Message>::DeviceClosed();
|
AbstractMessageHandler<spb::tagreader::Message>::DeviceClosed();
|
||||||
|
|
||||||
QCoreApplication::exit();
|
QCoreApplication::exit();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TagReaderWorker::HandleMessage(const spb::tagreader::Message &message, spb::tagreader::Message &reply, TagReaderBase *reader) {
|
||||||
|
|
||||||
|
if (message.has_is_media_file_request()) {
|
||||||
|
bool success = reader->IsMediaFile(QStringFromStdString(message.is_media_file_request().filename()));
|
||||||
|
reply.mutable_is_media_file_response()->set_success(success);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
else if (message.has_read_file_request()) {
|
||||||
|
bool success = reader->ReadFile(QStringFromStdString(message.read_file_request().filename()), reply.mutable_read_file_response()->mutable_metadata());
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
else if (message.has_save_file_request()) {
|
||||||
|
bool success = reader->SaveFile(QStringFromStdString(message.save_file_request().filename()), message.save_file_request().metadata());
|
||||||
|
reply.mutable_save_file_response()->set_success(success);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
else if (message.has_load_embedded_art_request()) {
|
||||||
|
QByteArray data = reader->LoadEmbeddedArt(QStringFromStdString(message.load_embedded_art_request().filename()));
|
||||||
|
reply.mutable_load_embedded_art_response()->set_data(data.constData(), data.size());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (message.has_save_embedded_art_request()) {
|
||||||
|
bool success = 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())));
|
||||||
|
reply.mutable_save_embedded_art_response()->set_success(success);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
else if (message.has_save_song_playcount_to_file_request()) {
|
||||||
|
bool success = reader->SaveSongPlaycountToFile(QStringFromStdString(message.save_song_playcount_to_file_request().filename()), message.save_song_playcount_to_file_request().metadata());
|
||||||
|
reply.mutable_save_song_playcount_to_file_response()->set_success(success);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
else if (message.has_save_song_rating_to_file_request()) {
|
||||||
|
bool success = reader->SaveSongRatingToFile(QStringFromStdString(message.save_song_rating_to_file_request().filename()), message.save_song_rating_to_file_request().metadata());
|
||||||
|
reply.mutable_save_song_rating_to_file_response()->set_success(success);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,11 @@
|
|||||||
#include "core/messagehandler.h"
|
#include "core/messagehandler.h"
|
||||||
#if defined(USE_TAGLIB)
|
#if defined(USE_TAGLIB)
|
||||||
# include "tagreadertaglib.h"
|
# include "tagreadertaglib.h"
|
||||||
|
# include "tagreadergme.h"
|
||||||
#elif defined(USE_TAGPARSER)
|
#elif defined(USE_TAGPARSER)
|
||||||
# include "tagreadertagparser.h"
|
# include "tagreadertagparser.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "tagreadermessages.pb.h"
|
#include "tagreadermessages.pb.h"
|
||||||
|
|
||||||
class QIODevice;
|
class QIODevice;
|
||||||
@@ -44,8 +46,12 @@ class TagReaderWorker : public AbstractMessageHandler<spb::tagreader::Message> {
|
|||||||
void DeviceClosed() override;
|
void DeviceClosed() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// Handle message using specific TagReaderBase implementation. Returns true on successful message handle.
|
||||||
|
bool HandleMessage(const spb::tagreader::Message &message, spb::tagreader::Message &reply, TagReaderBase* reader);
|
||||||
|
|
||||||
#if defined(USE_TAGLIB)
|
#if defined(USE_TAGLIB)
|
||||||
TagReaderTagLib tag_reader_;
|
TagReaderTagLib tag_reader_;
|
||||||
|
TagReaderGME tag_reader_gme_;
|
||||||
#elif defined(USE_TAGPARSER)
|
#elif defined(USE_TAGPARSER)
|
||||||
TagReaderTagParser tag_reader_;
|
TagReaderTagParser tag_reader_;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
|
|
||||||
if(HAVE_TRANSLATIONS)
|
if(HAVE_TRANSLATIONS)
|
||||||
include(../cmake/Translations.cmake)
|
include(../cmake/Translations.cmake)
|
||||||
@@ -7,7 +7,6 @@ endif()
|
|||||||
set(SOURCES
|
set(SOURCES
|
||||||
core/mainwindow.cpp
|
core/mainwindow.cpp
|
||||||
core/application.cpp
|
core/application.cpp
|
||||||
core/appearance.cpp
|
|
||||||
core/player.cpp
|
core/player.cpp
|
||||||
core/commandlineoptions.cpp
|
core/commandlineoptions.cpp
|
||||||
core/database.cpp
|
core/database.cpp
|
||||||
@@ -35,14 +34,28 @@ set(SOURCES
|
|||||||
core/taskmanager.cpp
|
core/taskmanager.cpp
|
||||||
core/thread.cpp
|
core/thread.cpp
|
||||||
core/urlhandler.cpp
|
core/urlhandler.cpp
|
||||||
core/utilities.cpp
|
|
||||||
core/imageutils.cpp
|
|
||||||
core/iconloader.cpp
|
core/iconloader.cpp
|
||||||
core/standarditemiconloader.cpp
|
core/standarditemiconloader.cpp
|
||||||
core/scopedtransaction.cpp
|
core/scopedtransaction.cpp
|
||||||
core/translations.cpp
|
core/translations.cpp
|
||||||
core/systemtrayicon.cpp
|
core/systemtrayicon.cpp
|
||||||
|
|
||||||
|
utilities/strutils.cpp
|
||||||
|
utilities/envutils.cpp
|
||||||
|
utilities/colorutils.cpp
|
||||||
|
utilities/cryptutils.cpp
|
||||||
|
utilities/fileutils.cpp
|
||||||
|
utilities/diskutils.cpp
|
||||||
|
utilities/imageutils.cpp
|
||||||
|
utilities/macaddrutils.cpp
|
||||||
|
utilities/mimeutils.cpp
|
||||||
|
utilities/randutils.cpp
|
||||||
|
utilities/threadutils.cpp
|
||||||
|
utilities/timeutils.cpp
|
||||||
|
utilities/transliterate.cpp
|
||||||
|
utilities/xmlutils.cpp
|
||||||
|
utilities/filemanagerutils.cpp
|
||||||
|
|
||||||
engine/enginetype.cpp
|
engine/enginetype.cpp
|
||||||
engine/enginebase.cpp
|
engine/enginebase.cpp
|
||||||
engine/devicefinders.cpp
|
engine/devicefinders.cpp
|
||||||
@@ -69,9 +82,11 @@ set(SOURCES
|
|||||||
collection/collectionitemdelegate.cpp
|
collection/collectionitemdelegate.cpp
|
||||||
collection/collectionviewcontainer.cpp
|
collection/collectionviewcontainer.cpp
|
||||||
collection/collectiondirectorymodel.cpp
|
collection/collectiondirectorymodel.cpp
|
||||||
|
collection/collectionfilteroptions.cpp
|
||||||
collection/collectionfilterwidget.cpp
|
collection/collectionfilterwidget.cpp
|
||||||
collection/collectionplaylistitem.cpp
|
collection/collectionplaylistitem.cpp
|
||||||
collection/collectionquery.cpp
|
collection/collectionquery.cpp
|
||||||
|
collection/collectionqueryoptions.cpp
|
||||||
collection/savedgroupingmanager.cpp
|
collection/savedgroupingmanager.cpp
|
||||||
collection/groupbydialog.cpp
|
collection/groupbydialog.cpp
|
||||||
collection/collectiontask.cpp
|
collection/collectiontask.cpp
|
||||||
@@ -162,6 +177,8 @@ set(SOURCES
|
|||||||
lyrics/musixmatchlyricsprovider.cpp
|
lyrics/musixmatchlyricsprovider.cpp
|
||||||
lyrics/chartlyricsprovider.cpp
|
lyrics/chartlyricsprovider.cpp
|
||||||
|
|
||||||
|
providers/musixmatchprovider.cpp
|
||||||
|
|
||||||
settings/settingsdialog.cpp
|
settings/settingsdialog.cpp
|
||||||
settings/settingspage.cpp
|
settings/settingspage.cpp
|
||||||
settings/behavioursettingspage.cpp
|
settings/behavioursettingspage.cpp
|
||||||
@@ -186,6 +203,7 @@ set(SOURCES
|
|||||||
dialogs/deleteconfirmationdialog.cpp
|
dialogs/deleteconfirmationdialog.cpp
|
||||||
dialogs/lastfmimportdialog.cpp
|
dialogs/lastfmimportdialog.cpp
|
||||||
dialogs/snapdialog.cpp
|
dialogs/snapdialog.cpp
|
||||||
|
dialogs/saveplaylistsdialog.cpp
|
||||||
|
|
||||||
widgets/autoexpandingtreeview.cpp
|
widgets/autoexpandingtreeview.cpp
|
||||||
widgets/busyindicator.cpp
|
widgets/busyindicator.cpp
|
||||||
@@ -202,6 +220,8 @@ set(SOURCES
|
|||||||
widgets/multiloadingindicator.cpp
|
widgets/multiloadingindicator.cpp
|
||||||
widgets/playingwidget.cpp
|
widgets/playingwidget.cpp
|
||||||
widgets/renametablineedit.cpp
|
widgets/renametablineedit.cpp
|
||||||
|
widgets/sliderslider.cpp
|
||||||
|
widgets/prettyslider.cpp
|
||||||
widgets/volumeslider.cpp
|
widgets/volumeslider.cpp
|
||||||
widgets/stickyslider.cpp
|
widgets/stickyslider.cpp
|
||||||
widgets/stretchheaderview.cpp
|
widgets/stretchheaderview.cpp
|
||||||
@@ -261,7 +281,6 @@ set(SOURCES
|
|||||||
set(HEADERS
|
set(HEADERS
|
||||||
core/mainwindow.h
|
core/mainwindow.h
|
||||||
core/application.h
|
core/application.h
|
||||||
core/appearance.h
|
|
||||||
core/player.h
|
core/player.h
|
||||||
core/database.h
|
core/database.h
|
||||||
core/deletefiles.h
|
core/deletefiles.h
|
||||||
@@ -417,6 +436,7 @@ set(HEADERS
|
|||||||
dialogs/deleteconfirmationdialog.h
|
dialogs/deleteconfirmationdialog.h
|
||||||
dialogs/lastfmimportdialog.h
|
dialogs/lastfmimportdialog.h
|
||||||
dialogs/snapdialog.h
|
dialogs/snapdialog.h
|
||||||
|
dialogs/saveplaylistsdialog.h
|
||||||
|
|
||||||
widgets/autoexpandingtreeview.h
|
widgets/autoexpandingtreeview.h
|
||||||
widgets/busyindicator.h
|
widgets/busyindicator.h
|
||||||
@@ -432,6 +452,8 @@ set(HEADERS
|
|||||||
widgets/multiloadingindicator.h
|
widgets/multiloadingindicator.h
|
||||||
widgets/playingwidget.h
|
widgets/playingwidget.h
|
||||||
widgets/renametablineedit.h
|
widgets/renametablineedit.h
|
||||||
|
widgets/sliderslider.h
|
||||||
|
widgets/prettyslider.h
|
||||||
widgets/volumeslider.h
|
widgets/volumeslider.h
|
||||||
widgets/stickyslider.h
|
widgets/stickyslider.h
|
||||||
widgets/stretchheaderview.h
|
widgets/stretchheaderview.h
|
||||||
@@ -442,7 +464,6 @@ set(HEADERS
|
|||||||
widgets/qsearchfield.h
|
widgets/qsearchfield.h
|
||||||
widgets/ratingwidget.h
|
widgets/ratingwidget.h
|
||||||
widgets/forcescrollperpixel.h
|
widgets/forcescrollperpixel.h
|
||||||
widgets/resizabletextedit.h
|
|
||||||
|
|
||||||
osd/osdbase.h
|
osd/osdbase.h
|
||||||
osd/osdpretty.h
|
osd/osdpretty.h
|
||||||
@@ -542,6 +563,7 @@ set(UI
|
|||||||
dialogs/userpassdialog.ui
|
dialogs/userpassdialog.ui
|
||||||
dialogs/lastfmimportdialog.ui
|
dialogs/lastfmimportdialog.ui
|
||||||
dialogs/snapdialog.ui
|
dialogs/snapdialog.ui
|
||||||
|
dialogs/saveplaylistsdialog.ui
|
||||||
|
|
||||||
widgets/trackslider.ui
|
widgets/trackslider.ui
|
||||||
widgets/fileview.ui
|
widgets/fileview.ui
|
||||||
@@ -567,7 +589,7 @@ option(USE_INSTALL_PREFIX "Look for data in CMAKE_INSTALL_PREFIX" ON)
|
|||||||
|
|
||||||
if(NOT APPLE)
|
if(NOT APPLE)
|
||||||
set(NOT_APPLE ON)
|
set(NOT_APPLE ON)
|
||||||
optional_source(NOT_APPLE SOURCES widgets/qsearchfield_nonmac.cpp core/qtsystemtrayicon.cpp HEADERS core/qtsystemtrayicon.h)
|
optional_source(NOT_APPLE SOURCES widgets/qsearchfield_qt.cpp core/qtsystemtrayicon.cpp HEADERS core/qtsystemtrayicon.h)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(HAVE_GLOBALSHORTCUTS)
|
if(HAVE_GLOBALSHORTCUTS)
|
||||||
@@ -607,43 +629,42 @@ optional_source(HAVE_VLC SOURCES engine/vlcengine.cpp HEADERS engine/vlcengine.h
|
|||||||
|
|
||||||
# DBUS and MPRIS - Unix specific
|
# DBUS and MPRIS - Unix specific
|
||||||
if(UNIX AND HAVE_DBUS)
|
if(UNIX AND HAVE_DBUS)
|
||||||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/dbus)
|
|
||||||
|
|
||||||
optional_source(HAVE_DBUS SOURCES core/mpris2.cpp HEADERS core/mpris2.h)
|
optional_source(HAVE_DBUS SOURCES core/mpris2.cpp HEADERS core/mpris2.h)
|
||||||
optional_source(HAVE_UDISKS2 SOURCES device/udisks2lister.cpp HEADERS device/udisks2lister.h)
|
optional_source(HAVE_UDISKS2 SOURCES device/udisks2lister.cpp HEADERS device/udisks2lister.h)
|
||||||
|
|
||||||
# MPRIS 2.0 DBUS interfaces
|
# MPRIS 2.0 DBUS interfaces
|
||||||
qt_add_dbus_adaptor(SOURCES dbus/org.mpris.MediaPlayer2.Player.xml core/mpris2.h mpris::Mpris2 core/mpris2_player Mpris2Player)
|
qt_add_dbus_adaptor(SOURCES dbus/org.mpris.MediaPlayer2.Player.xml core/mpris2.h mpris::Mpris2 mpris2_player Mpris2Player)
|
||||||
qt_add_dbus_adaptor(SOURCES dbus/org.mpris.MediaPlayer2.xml core/mpris2.h mpris::Mpris2 core/mpris2_root Mpris2Root)
|
qt_add_dbus_adaptor(SOURCES dbus/org.mpris.MediaPlayer2.xml core/mpris2.h mpris::Mpris2 mpris2_root Mpris2Root)
|
||||||
qt_add_dbus_adaptor(SOURCES dbus/org.mpris.MediaPlayer2.TrackList.xml core/mpris2.h mpris::Mpris2 core/mpris2_tracklist Mpris2TrackList)
|
qt_add_dbus_adaptor(SOURCES dbus/org.mpris.MediaPlayer2.TrackList.xml core/mpris2.h mpris::Mpris2 mpris2_tracklist Mpris2TrackList)
|
||||||
|
|
||||||
# MPRIS 2.1 DBUS interfaces
|
# MPRIS 2.1 DBUS interfaces
|
||||||
qt_add_dbus_adaptor(SOURCES dbus/org.mpris.MediaPlayer2.Playlists.xml core/mpris2.h mpris::Mpris2 core/mpris2_playlists Mpris2Playlists)
|
qt_add_dbus_adaptor(SOURCES dbus/org.mpris.MediaPlayer2.Playlists.xml core/mpris2.h mpris::Mpris2 mpris2_playlists Mpris2Playlists)
|
||||||
|
|
||||||
# org.freedesktop.Notifications DBUS interface
|
# org.freedesktop.Notifications DBUS interface
|
||||||
qt_add_dbus_interface(SOURCES dbus/org.freedesktop.Notifications.xml dbus/notification)
|
qt_add_dbus_interface(SOURCES dbus/org.freedesktop.Notifications.xml notification)
|
||||||
|
|
||||||
# org.gnome.SettingsDaemon interface
|
# org.gnome.SettingsDaemon interface
|
||||||
qt_add_dbus_interface(SOURCES dbus/org.gnome.SettingsDaemon.MediaKeys.xml dbus/gnomesettingsdaemon)
|
qt_add_dbus_interface(SOURCES dbus/org.gnome.SettingsDaemon.MediaKeys.xml gnomesettingsdaemon)
|
||||||
|
|
||||||
# org.mate.SettingsDaemon interface
|
# org.mate.SettingsDaemon interface
|
||||||
qt_add_dbus_interface(SOURCES dbus/org.mate.SettingsDaemon.MediaKeys.xml dbus/matesettingsdaemon)
|
qt_add_dbus_interface(SOURCES dbus/org.mate.SettingsDaemon.MediaKeys.xml matesettingsdaemon)
|
||||||
|
|
||||||
# org.kde.KGlobalAccel interface
|
# org.kde.KGlobalAccel interface
|
||||||
qt_add_dbus_interface(SOURCES dbus/org.kde.KGlobalAccel.xml dbus/kglobalaccel)
|
qt_add_dbus_interface(SOURCES dbus/org.kde.KGlobalAccel.xml 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 kglobalaccelcomponent)
|
||||||
|
|
||||||
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 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 udisks2filesystem INCLUDE dbus/metatypes.h)
|
||||||
set_source_files_properties(dbus/org.freedesktop.UDisks2.Block.xml PROPERTIES NO_NAMESPACE dbus/udisks2block INCLUDE dbus/metatypes.h)
|
set_source_files_properties(dbus/org.freedesktop.UDisks2.Block.xml PROPERTIES NO_NAMESPACE udisks2block INCLUDE dbus/metatypes.h)
|
||||||
set_source_files_properties(dbus/org.freedesktop.UDisks2.Drive.xml PROPERTIES NO_NAMESPACE dbus/udisks2drive INCLUDE dbus/metatypes.h)
|
set_source_files_properties(dbus/org.freedesktop.UDisks2.Drive.xml PROPERTIES NO_NAMESPACE udisks2drive INCLUDE dbus/metatypes.h)
|
||||||
set_source_files_properties(dbus/org.freedesktop.UDisks2.Job.xml PROPERTIES NO_NAMESPACE dbus/udisks2job INCLUDE dbus/metatypes.h)
|
set_source_files_properties(dbus/org.freedesktop.UDisks2.Job.xml PROPERTIES NO_NAMESPACE udisks2job INCLUDE dbus/metatypes.h)
|
||||||
qt_add_dbus_interface(SOURCES dbus/org.freedesktop.DBus.ObjectManager.xml dbus/objectmanager)
|
qt_add_dbus_interface(SOURCES dbus/org.freedesktop.DBus.ObjectManager.xml objectmanager)
|
||||||
qt_add_dbus_interface(SOURCES dbus/org.freedesktop.UDisks2.Filesystem.xml dbus/udisks2filesystem)
|
qt_add_dbus_interface(SOURCES dbus/org.freedesktop.UDisks2.Filesystem.xml udisks2filesystem)
|
||||||
qt_add_dbus_interface(SOURCES dbus/org.freedesktop.UDisks2.Block.xml dbus/udisks2block)
|
qt_add_dbus_interface(SOURCES dbus/org.freedesktop.UDisks2.Block.xml udisks2block)
|
||||||
qt_add_dbus_interface(SOURCES dbus/org.freedesktop.UDisks2.Drive.xml dbus/udisks2drive)
|
qt_add_dbus_interface(SOURCES dbus/org.freedesktop.UDisks2.Drive.xml udisks2drive)
|
||||||
qt_add_dbus_interface(SOURCES dbus/org.freedesktop.UDisks2.Job.xml dbus/udisks2job)
|
qt_add_dbus_interface(SOURCES dbus/org.freedesktop.UDisks2.Job.xml udisks2job)
|
||||||
endif(HAVE_UDISKS2)
|
endif(HAVE_UDISKS2)
|
||||||
|
|
||||||
endif(UNIX AND HAVE_DBUS)
|
endif(UNIX AND HAVE_DBUS)
|
||||||
@@ -779,8 +800,8 @@ optional_source(HAVE_AUDIOCD
|
|||||||
# Platform specific - macOS
|
# Platform specific - macOS
|
||||||
optional_source(APPLE
|
optional_source(APPLE
|
||||||
SOURCES
|
SOURCES
|
||||||
|
utilities/macosutils.mm
|
||||||
core/scoped_nsautorelease_pool.mm
|
core/scoped_nsautorelease_pool.mm
|
||||||
core/mac_utilities.mm
|
|
||||||
core/mac_startup.mm
|
core/mac_startup.mm
|
||||||
core/macsystemtrayicon.mm
|
core/macsystemtrayicon.mm
|
||||||
core/macfslistener.mm
|
core/macfslistener.mm
|
||||||
@@ -801,8 +822,10 @@ optional_source(APPLE
|
|||||||
# Platform specific - Windows
|
# Platform specific - Windows
|
||||||
optional_source(WIN32
|
optional_source(WIN32
|
||||||
SOURCES
|
SOURCES
|
||||||
|
utilities/winutils.cpp
|
||||||
engine/directsounddevicefinder.cpp
|
engine/directsounddevicefinder.cpp
|
||||||
engine/mmdevicefinder.cpp
|
engine/mmdevicefinder.cpp
|
||||||
|
core/scopedwchararray.cpp
|
||||||
core/windows7thumbbar.cpp
|
core/windows7thumbbar.cpp
|
||||||
HEADERS
|
HEADERS
|
||||||
core/windows7thumbbar.h
|
core/windows7thumbbar.h
|
||||||
@@ -941,9 +964,14 @@ link_directories(
|
|||||||
${SQLITE_LIBRARY_DIRS}
|
${SQLITE_LIBRARY_DIRS}
|
||||||
${SINGLEAPPLICATION_LIBRARY_DIRS}
|
${SINGLEAPPLICATION_LIBRARY_DIRS}
|
||||||
${SINGLECOREAPPLICATION_LIBRARY_DIRS}
|
${SINGLECOREAPPLICATION_LIBRARY_DIRS}
|
||||||
${Iconv_LIBRARY_DIRS}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(HAVE_ICU)
|
||||||
|
link_directories(${ICU_LIBRARY_DIRS})
|
||||||
|
else()
|
||||||
|
link_directories(${Iconv_LIBRARY_DIRS})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(HAVE_ALSA)
|
if(HAVE_ALSA)
|
||||||
link_directories(${ALSA_LIBRARY_DIRS})
|
link_directories(${ALSA_LIBRARY_DIRS})
|
||||||
endif()
|
endif()
|
||||||
@@ -1055,11 +1083,21 @@ target_link_libraries(strawberry_lib PUBLIC
|
|||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
${SINGLEAPPLICATION_LIBRARIES}
|
${SINGLEAPPLICATION_LIBRARIES}
|
||||||
${SINGLECOREAPPLICATION_LIBRARIES}
|
${SINGLECOREAPPLICATION_LIBRARIES}
|
||||||
${Iconv_LIBRARIES}
|
|
||||||
libstrawberry-common
|
libstrawberry-common
|
||||||
libstrawberry-tagreader
|
libstrawberry-tagreader
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(HAVE_ICU)
|
||||||
|
target_include_directories(strawberry_lib SYSTEM PRIVATE ${ICU_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(strawberry_lib PRIVATE ${ICU_LIBRARIES})
|
||||||
|
else()
|
||||||
|
if(FREEBSD AND NOT Iconv_LIBRARIES)
|
||||||
|
set(Iconv_LIBRARIES iconv)
|
||||||
|
endif()
|
||||||
|
target_include_directories(strawberry_lib SYSTEM PRIVATE ${Iconv_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(strawberry_lib PRIVATE ${Iconv_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
if(HAVE_ALSA)
|
if(HAVE_ALSA)
|
||||||
target_include_directories(strawberry_lib SYSTEM PRIVATE ${ALSA_INCLUDE_DIRS})
|
target_include_directories(strawberry_lib SYSTEM PRIVATE ${ALSA_INCLUDE_DIRS})
|
||||||
target_link_libraries(strawberry_lib PRIVATE ${ALSA_LIBRARIES})
|
target_link_libraries(strawberry_lib PRIVATE ${ALSA_LIBRARIES})
|
||||||
@@ -1138,10 +1176,6 @@ if(HAVE_LIBMTP)
|
|||||||
target_link_libraries(strawberry_lib PRIVATE ${LIBMTP_LIBRARIES})
|
target_link_libraries(strawberry_lib PRIVATE ${LIBMTP_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FREEBSD)
|
|
||||||
target_link_libraries(strawberry_lib PRIVATE iconv)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
target_link_libraries(strawberry_lib PRIVATE
|
target_link_libraries(strawberry_lib PRIVATE
|
||||||
"-framework AppKit"
|
"-framework AppKit"
|
||||||
|
|||||||
@@ -57,7 +57,11 @@ Analyzer::Base::Base(QWidget *parent, const uint scopeSize)
|
|||||||
lastscope_(512),
|
lastscope_(512),
|
||||||
new_frame_(false),
|
new_frame_(false),
|
||||||
is_playing_(false),
|
is_playing_(false),
|
||||||
timeout_(40) {}
|
timeout_(40) {
|
||||||
|
|
||||||
|
setAttribute(Qt::WA_OpaquePaintEvent, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Analyzer::Base::~Base() {
|
Analyzer::Base::~Base() {
|
||||||
delete fht_;
|
delete fht_;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class QTimerEvent;
|
|||||||
|
|
||||||
namespace Analyzer {
|
namespace Analyzer {
|
||||||
|
|
||||||
typedef std::vector<float> Scope;
|
using Scope = std::vector<float>;
|
||||||
|
|
||||||
class Base : public QWidget {
|
class Base : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|||||||
@@ -33,7 +33,6 @@
|
|||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QtEvents>
|
#include <QtEvents>
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
#include "analyzercontainer.h"
|
#include "analyzercontainer.h"
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QtConcurrentRun>
|
#include <QtConcurrentRun>
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "core/taskmanager.h"
|
#include "core/taskmanager.h"
|
||||||
@@ -35,9 +34,9 @@
|
|||||||
#include "core/player.h"
|
#include "core/player.h"
|
||||||
#include "core/tagreaderclient.h"
|
#include "core/tagreaderclient.h"
|
||||||
#include "core/thread.h"
|
#include "core/thread.h"
|
||||||
#include "core/utilities.h"
|
|
||||||
#include "core/song.h"
|
#include "core/song.h"
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
|
#include "utilities/threadutils.h"
|
||||||
#include "collection.h"
|
#include "collection.h"
|
||||||
#include "collectionwatcher.h"
|
#include "collectionwatcher.h"
|
||||||
#include "collectionbackend.h"
|
#include "collectionbackend.h"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
#include "core/song.h"
|
#include "core/song.h"
|
||||||
#include "core/utilities.h"
|
#include "utilities/threadutils.h"
|
||||||
|
|
||||||
class Application;
|
class Application;
|
||||||
class Thread;
|
class Thread;
|
||||||
|
|||||||
@@ -50,8 +50,9 @@
|
|||||||
#include "core/sqlrow.h"
|
#include "core/sqlrow.h"
|
||||||
#include "smartplaylists/smartplaylistsearch.h"
|
#include "smartplaylists/smartplaylistsearch.h"
|
||||||
|
|
||||||
#include "directory.h"
|
#include "collectiondirectory.h"
|
||||||
#include "collectionbackend.h"
|
#include "collectionbackend.h"
|
||||||
|
#include "collectionfilteroptions.h"
|
||||||
#include "collectionquery.h"
|
#include "collectionquery.h"
|
||||||
#include "collectiontask.h"
|
#include "collectiontask.h"
|
||||||
|
|
||||||
@@ -145,12 +146,12 @@ void CollectionBackend::ResetStatisticsAsync(const int id) {
|
|||||||
|
|
||||||
void CollectionBackend::LoadDirectories() {
|
void CollectionBackend::LoadDirectories() {
|
||||||
|
|
||||||
DirectoryList dirs = GetAllDirectories();
|
CollectionDirectoryList dirs = GetAllDirectories();
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
|
|
||||||
for (const Directory &dir : dirs) {
|
for (const CollectionDirectory &dir : dirs) {
|
||||||
emit DirectoryDiscovered(dir, SubdirsInDirectory(dir.id, db));
|
emit DirectoryDiscovered(dir, SubdirsInDirectory(dir.id, db));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,12 +208,12 @@ void CollectionBackend::ChangeDirPath(const int id, const QString &old_path, con
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectoryList CollectionBackend::GetAllDirectories() {
|
CollectionDirectoryList CollectionBackend::GetAllDirectories() {
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
|
|
||||||
DirectoryList ret;
|
CollectionDirectoryList ret;
|
||||||
|
|
||||||
SqlQuery q(db);
|
SqlQuery q(db);
|
||||||
q.prepare(QString("SELECT ROWID, path FROM %1").arg(dirs_table_));
|
q.prepare(QString("SELECT ROWID, path FROM %1").arg(dirs_table_));
|
||||||
@@ -222,7 +223,7 @@ DirectoryList CollectionBackend::GetAllDirectories() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (q.next()) {
|
while (q.next()) {
|
||||||
Directory dir;
|
CollectionDirectory dir;
|
||||||
dir.id = q.value(0).toInt();
|
dir.id = q.value(0).toInt();
|
||||||
dir.path = q.value(1).toString();
|
dir.path = q.value(1).toString();
|
||||||
|
|
||||||
@@ -232,7 +233,7 @@ DirectoryList CollectionBackend::GetAllDirectories() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SubdirectoryList CollectionBackend::SubdirsInDirectory(const int id) {
|
CollectionSubdirectoryList CollectionBackend::SubdirsInDirectory(const int id) {
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
QSqlDatabase db = db_->Connect();
|
QSqlDatabase db = db_->Connect();
|
||||||
@@ -240,19 +241,19 @@ SubdirectoryList CollectionBackend::SubdirsInDirectory(const int id) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SubdirectoryList CollectionBackend::SubdirsInDirectory(const int id, QSqlDatabase &db) {
|
CollectionSubdirectoryList CollectionBackend::SubdirsInDirectory(const int id, QSqlDatabase &db) {
|
||||||
|
|
||||||
SqlQuery q(db);
|
SqlQuery q(db);
|
||||||
q.prepare(QString("SELECT path, mtime FROM %1 WHERE directory_id = :dir").arg(subdirs_table_));
|
q.prepare(QString("SELECT path, mtime FROM %1 WHERE directory_id = :dir").arg(subdirs_table_));
|
||||||
q.BindValue(":dir", id);
|
q.BindValue(":dir", id);
|
||||||
if (!q.Exec()) {
|
if (!q.Exec()) {
|
||||||
db_->ReportErrors(q);
|
db_->ReportErrors(q);
|
||||||
return SubdirectoryList();
|
return CollectionSubdirectoryList();
|
||||||
}
|
}
|
||||||
|
|
||||||
SubdirectoryList subdirs;
|
CollectionSubdirectoryList subdirs;
|
||||||
while (q.next()) {
|
while (q.next()) {
|
||||||
Subdirectory subdir;
|
CollectionSubdirectory subdir;
|
||||||
subdir.directory_id = id;
|
subdir.directory_id = id;
|
||||||
subdir.path = q.value(0).toString();
|
subdir.path = q.value(0).toString();
|
||||||
subdir.mtime = q.value(1).toLongLong();
|
subdir.mtime = q.value(1).toLongLong();
|
||||||
@@ -339,15 +340,15 @@ void CollectionBackend::AddDirectory(const QString &path) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Directory dir;
|
CollectionDirectory dir;
|
||||||
dir.path = canonical_path;
|
dir.path = canonical_path;
|
||||||
dir.id = q.lastInsertId().toInt();
|
dir.id = q.lastInsertId().toInt();
|
||||||
|
|
||||||
emit DirectoryDiscovered(dir, SubdirectoryList());
|
emit DirectoryDiscovered(dir, CollectionSubdirectoryList());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionBackend::RemoveDirectory(const Directory &dir) {
|
void CollectionBackend::RemoveDirectory(const CollectionDirectory &dir) {
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
@@ -447,13 +448,13 @@ void CollectionBackend::SongPathChanged(const Song &song, const QFileInfo &new_f
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionBackend::AddOrUpdateSubdirs(const SubdirectoryList &subdirs) {
|
void CollectionBackend::AddOrUpdateSubdirs(const CollectionSubdirectoryList &subdirs) {
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
|
|
||||||
ScopedTransaction transaction(&db);
|
ScopedTransaction transaction(&db);
|
||||||
for (const Subdirectory &subdir : subdirs) {
|
for (const CollectionSubdirectory &subdir : subdirs) {
|
||||||
if (subdir.mtime == 0) {
|
if (subdir.mtime == 0) {
|
||||||
// Delete the subdirectory
|
// Delete the subdirectory
|
||||||
SqlQuery q(db);
|
SqlQuery q(db);
|
||||||
@@ -900,12 +901,12 @@ void CollectionBackend::MarkSongsUnavailable(const SongList &songs, const bool u
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CollectionBackend::GetAll(const QString &column, const QueryOptions &opt) {
|
QStringList CollectionBackend::GetAll(const QString &column, const CollectionFilterOptions &filter_options) {
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
|
|
||||||
CollectionQuery query(db, songs_table_, fts_table_, opt);
|
CollectionQuery query(db, songs_table_, fts_table_, filter_options);
|
||||||
query.SetColumnSpec("DISTINCT " + column);
|
query.SetColumnSpec("DISTINCT " + column);
|
||||||
query.AddCompilationRequirement(false);
|
query.AddCompilationRequirement(false);
|
||||||
|
|
||||||
@@ -922,12 +923,12 @@ QStringList CollectionBackend::GetAll(const QString &column, const QueryOptions
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CollectionBackend::GetAllArtists(const QueryOptions &opt) {
|
QStringList CollectionBackend::GetAllArtists(const CollectionFilterOptions &opt) {
|
||||||
|
|
||||||
return GetAll("artist", opt);
|
return GetAll("artist", opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList CollectionBackend::GetAllArtistsWithAlbums(const QueryOptions &opt) {
|
QStringList CollectionBackend::GetAllArtistsWithAlbums(const CollectionFilterOptions &opt) {
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
@@ -967,15 +968,15 @@ QStringList CollectionBackend::GetAllArtistsWithAlbums(const QueryOptions &opt)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CollectionBackend::AlbumList CollectionBackend::GetAllAlbums(const QueryOptions &opt) {
|
CollectionBackend::AlbumList CollectionBackend::GetAllAlbums(const CollectionFilterOptions &opt) {
|
||||||
return GetAlbums(QString(), false, opt);
|
return GetAlbums(QString(), false, opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
CollectionBackend::AlbumList CollectionBackend::GetAlbumsByArtist(const QString &artist, const QueryOptions &opt) {
|
CollectionBackend::AlbumList CollectionBackend::GetAlbumsByArtist(const QString &artist, const CollectionFilterOptions &opt) {
|
||||||
return GetAlbums(artist, false, opt);
|
return GetAlbums(artist, false, opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
SongList CollectionBackend::GetArtistSongs(const QString &effective_albumartist, const QueryOptions &opt) {
|
SongList CollectionBackend::GetArtistSongs(const QString &effective_albumartist, const CollectionFilterOptions &opt) {
|
||||||
|
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
@@ -993,7 +994,7 @@ SongList CollectionBackend::GetArtistSongs(const QString &effective_albumartist,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SongList CollectionBackend::GetAlbumSongs(const QString &effective_albumartist, const QString &album, const QueryOptions &opt) {
|
SongList CollectionBackend::GetAlbumSongs(const QString &effective_albumartist, const QString &album, const CollectionFilterOptions &opt) {
|
||||||
|
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
@@ -1012,7 +1013,7 @@ SongList CollectionBackend::GetAlbumSongs(const QString &effective_albumartist,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SongList CollectionBackend::GetSongsByAlbum(const QString &album, const QueryOptions &opt) {
|
SongList CollectionBackend::GetSongsByAlbum(const QString &album, const CollectionFilterOptions &opt) {
|
||||||
|
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
@@ -1285,11 +1286,11 @@ SongList CollectionBackend::GetSongsByFingerprint(const QString &fingerprint) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CollectionBackend::AlbumList CollectionBackend::GetCompilationAlbums(const QueryOptions &opt) {
|
CollectionBackend::AlbumList CollectionBackend::GetCompilationAlbums(const CollectionFilterOptions &opt) {
|
||||||
return GetAlbums(QString(), true, opt);
|
return GetAlbums(QString(), true, opt);
|
||||||
}
|
}
|
||||||
|
|
||||||
SongList CollectionBackend::GetCompilationSongs(const QString &album, const QueryOptions &opt) {
|
SongList CollectionBackend::GetCompilationSongs(const QString &album, const CollectionFilterOptions &opt) {
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
@@ -1314,10 +1315,6 @@ SongList CollectionBackend::GetCompilationSongs(const QString &album, const Quer
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Song::Source CollectionBackend::Source() const {
|
|
||||||
return source_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CollectionBackend::CompilationsNeedUpdating() {
|
void CollectionBackend::CompilationsNeedUpdating() {
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
@@ -1430,7 +1427,7 @@ bool CollectionBackend::UpdateCompilations(const QSqlDatabase &db, SongList &del
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CollectionBackend::AlbumList CollectionBackend::GetAlbums(const QString &artist, const bool compilation_required, const QueryOptions &opt) {
|
CollectionBackend::AlbumList CollectionBackend::GetAlbums(const QString &artist, const bool compilation_required, const CollectionFilterOptions &opt) {
|
||||||
|
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
@@ -1520,7 +1517,7 @@ CollectionBackend::Album CollectionBackend::GetAlbumArt(const QString &effective
|
|||||||
ret.album = album;
|
ret.album = album;
|
||||||
ret.album_artist = effective_albumartist;
|
ret.album_artist = effective_albumartist;
|
||||||
|
|
||||||
CollectionQuery query(db, songs_table_, fts_table_, QueryOptions());
|
CollectionQuery query(db, songs_table_, fts_table_);
|
||||||
query.SetColumnSpec("art_automatic, art_manual, url");
|
query.SetColumnSpec("art_automatic, art_manual, url");
|
||||||
if (!effective_albumartist.isEmpty()) {
|
if (!effective_albumartist.isEmpty()) {
|
||||||
query.AddWhere("effective_albumartist", effective_albumartist);
|
query.AddWhere("effective_albumartist", effective_albumartist);
|
||||||
|
|||||||
@@ -38,8 +38,9 @@
|
|||||||
|
|
||||||
#include "core/song.h"
|
#include "core/song.h"
|
||||||
#include "core/sqlquery.h"
|
#include "core/sqlquery.h"
|
||||||
|
#include "collectionfilteroptions.h"
|
||||||
#include "collectionquery.h"
|
#include "collectionquery.h"
|
||||||
#include "directory.h"
|
#include "collectiondirectory.h"
|
||||||
|
|
||||||
class QThread;
|
class QThread;
|
||||||
class TaskManager;
|
class TaskManager;
|
||||||
@@ -53,7 +54,7 @@ class CollectionBackendInterface : public QObject {
|
|||||||
explicit CollectionBackendInterface(QObject *parent = nullptr) : QObject(parent) {}
|
explicit CollectionBackendInterface(QObject *parent = nullptr) : QObject(parent) {}
|
||||||
|
|
||||||
struct Album {
|
struct Album {
|
||||||
Album() {}
|
Album() : filetype(Song::FileType_Unknown) {}
|
||||||
Album(const QString &_album_artist, const QString &_album, const QUrl &_art_automatic, const QUrl &_art_manual, const QList<QUrl> &_urls, const Song::FileType _filetype, const QString &_cue_path)
|
Album(const QString &_album_artist, const QString &_album, const QUrl &_art_automatic, const QUrl &_art_manual, const QList<QUrl> &_urls, const Song::FileType _filetype, const QString &_cue_path)
|
||||||
: album_artist(_album_artist),
|
: album_artist(_album_artist),
|
||||||
album(_album),
|
album(_album),
|
||||||
@@ -72,11 +73,13 @@ class CollectionBackendInterface : public QObject {
|
|||||||
Song::FileType filetype;
|
Song::FileType filetype;
|
||||||
QString cue_path;
|
QString cue_path;
|
||||||
};
|
};
|
||||||
typedef QList<Album> AlbumList;
|
using AlbumList = QList<Album>;
|
||||||
|
|
||||||
virtual QString songs_table() const = 0;
|
virtual QString songs_table() const = 0;
|
||||||
virtual QString fts_table() const = 0;
|
virtual QString fts_table() const = 0;
|
||||||
|
|
||||||
|
virtual Song::Source source() const = 0;
|
||||||
|
|
||||||
virtual Database *db() const = 0;
|
virtual Database *db() const = 0;
|
||||||
|
|
||||||
// Get a list of directories in the collection. Emits DirectoriesDiscovered.
|
// Get a list of directories in the collection. Emits DirectoriesDiscovered.
|
||||||
@@ -88,23 +91,23 @@ class CollectionBackendInterface : public QObject {
|
|||||||
|
|
||||||
virtual SongList FindSongsInDirectory(const int id) = 0;
|
virtual SongList FindSongsInDirectory(const int id) = 0;
|
||||||
virtual SongList SongsWithMissingFingerprint(const int id) = 0;
|
virtual SongList SongsWithMissingFingerprint(const int id) = 0;
|
||||||
virtual SubdirectoryList SubdirsInDirectory(const int id) = 0;
|
virtual CollectionSubdirectoryList SubdirsInDirectory(const int id) = 0;
|
||||||
virtual DirectoryList GetAllDirectories() = 0;
|
virtual CollectionDirectoryList 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 SongList GetAllSongs() = 0;
|
||||||
|
|
||||||
virtual QStringList GetAllArtists(const QueryOptions &opt = QueryOptions()) = 0;
|
virtual QStringList GetAllArtists(const CollectionFilterOptions &opt = CollectionFilterOptions()) = 0;
|
||||||
virtual QStringList GetAllArtistsWithAlbums(const QueryOptions &opt = QueryOptions()) = 0;
|
virtual QStringList GetAllArtistsWithAlbums(const CollectionFilterOptions &opt = CollectionFilterOptions()) = 0;
|
||||||
virtual SongList GetArtistSongs(const QString &effective_albumartist, const QueryOptions &opt = QueryOptions()) = 0;
|
virtual SongList GetArtistSongs(const QString &effective_albumartist, const CollectionFilterOptions &opt = CollectionFilterOptions()) = 0;
|
||||||
virtual SongList GetAlbumSongs(const QString &effective_albumartist, const QString &album, const QueryOptions &opt = QueryOptions()) = 0;
|
virtual SongList GetAlbumSongs(const QString &effective_albumartist, const QString &album, const CollectionFilterOptions &opt = CollectionFilterOptions()) = 0;
|
||||||
virtual SongList GetSongsByAlbum(const QString &album, const QueryOptions &opt = QueryOptions()) = 0;
|
virtual SongList GetSongsByAlbum(const QString &album, const CollectionFilterOptions &opt = CollectionFilterOptions()) = 0;
|
||||||
|
|
||||||
virtual SongList GetCompilationSongs(const QString &album, const QueryOptions &opt = QueryOptions()) = 0;
|
virtual SongList GetCompilationSongs(const QString &album, const CollectionFilterOptions &opt = CollectionFilterOptions()) = 0;
|
||||||
|
|
||||||
virtual AlbumList GetAllAlbums(const QueryOptions &opt = QueryOptions()) = 0;
|
virtual AlbumList GetAllAlbums(const CollectionFilterOptions &opt = CollectionFilterOptions()) = 0;
|
||||||
virtual AlbumList GetAlbumsByArtist(const QString &artist, const QueryOptions &opt = QueryOptions()) = 0;
|
virtual AlbumList GetAlbumsByArtist(const QString &artist, const CollectionFilterOptions &opt = CollectionFilterOptions()) = 0;
|
||||||
virtual AlbumList GetCompilationAlbums(const QueryOptions &opt = QueryOptions()) = 0;
|
virtual AlbumList GetCompilationAlbums(const CollectionFilterOptions &opt = CollectionFilterOptions()) = 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, const bool clear_art_manual = false) = 0;
|
virtual void UpdateAutomaticAlbumArtAsync(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_manual = false) = 0;
|
||||||
@@ -122,7 +125,7 @@ class CollectionBackendInterface : public QObject {
|
|||||||
virtual Song GetSongByUrl(const QUrl &url, const qint64 beginning = 0) = 0;
|
virtual Song GetSongByUrl(const QUrl &url, const qint64 beginning = 0) = 0;
|
||||||
|
|
||||||
virtual void AddDirectory(const QString &path) = 0;
|
virtual void AddDirectory(const QString &path) = 0;
|
||||||
virtual void RemoveDirectory(const Directory &dir) = 0;
|
virtual void RemoveDirectory(const CollectionDirectory &dir) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CollectionBackend : public CollectionBackendInterface {
|
class CollectionBackend : public CollectionBackendInterface {
|
||||||
@@ -139,6 +142,8 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
|
|
||||||
void ReportErrors(const CollectionQuery &query);
|
void ReportErrors(const CollectionQuery &query);
|
||||||
|
|
||||||
|
Song::Source source() const override { return source_; }
|
||||||
|
|
||||||
Database *db() const override { return db_; }
|
Database *db() const override { return db_; }
|
||||||
|
|
||||||
QString songs_table() const override { return songs_table_; }
|
QString songs_table() const override { return songs_table_; }
|
||||||
@@ -155,24 +160,24 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
|
|
||||||
SongList FindSongsInDirectory(const int id) override;
|
SongList FindSongsInDirectory(const int id) override;
|
||||||
SongList SongsWithMissingFingerprint(const int id) override;
|
SongList SongsWithMissingFingerprint(const int id) override;
|
||||||
SubdirectoryList SubdirsInDirectory(const int id) override;
|
CollectionSubdirectoryList SubdirsInDirectory(const int id) override;
|
||||||
DirectoryList GetAllDirectories() override;
|
CollectionDirectoryList 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;
|
SongList GetAllSongs() override;
|
||||||
|
|
||||||
QStringList GetAll(const QString &column, const QueryOptions &opt = QueryOptions());
|
QStringList GetAll(const QString &column, const CollectionFilterOptions &filter_options = CollectionFilterOptions());
|
||||||
QStringList GetAllArtists(const QueryOptions &opt = QueryOptions()) override;
|
QStringList GetAllArtists(const CollectionFilterOptions &opt = CollectionFilterOptions()) override;
|
||||||
QStringList GetAllArtistsWithAlbums(const QueryOptions &opt = QueryOptions()) override;
|
QStringList GetAllArtistsWithAlbums(const CollectionFilterOptions &opt = CollectionFilterOptions()) override;
|
||||||
SongList GetArtistSongs(const QString &effective_albumartist, const QueryOptions &opt = QueryOptions()) override;
|
SongList GetArtistSongs(const QString &effective_albumartist, const CollectionFilterOptions &opt = CollectionFilterOptions()) override;
|
||||||
SongList GetAlbumSongs(const QString &effective_albumartist, const QString &album, const QueryOptions &opt = QueryOptions()) override;
|
SongList GetAlbumSongs(const QString &effective_albumartist, const QString &album, const CollectionFilterOptions &opt = CollectionFilterOptions()) override;
|
||||||
SongList GetSongsByAlbum(const QString &album, const QueryOptions &opt = QueryOptions()) override;
|
SongList GetSongsByAlbum(const QString &album, const CollectionFilterOptions &opt = CollectionFilterOptions()) override;
|
||||||
|
|
||||||
SongList GetCompilationSongs(const QString &album, const QueryOptions &opt = QueryOptions()) override;
|
SongList GetCompilationSongs(const QString &album, const CollectionFilterOptions &opt = CollectionFilterOptions()) override;
|
||||||
|
|
||||||
AlbumList GetAllAlbums(const QueryOptions &opt = QueryOptions()) override;
|
AlbumList GetAllAlbums(const CollectionFilterOptions &opt = CollectionFilterOptions()) override;
|
||||||
AlbumList GetCompilationAlbums(const QueryOptions &opt = QueryOptions()) override;
|
AlbumList GetCompilationAlbums(const CollectionFilterOptions &opt = CollectionFilterOptions()) override;
|
||||||
AlbumList GetAlbumsByArtist(const QString &artist, const QueryOptions &opt = QueryOptions()) override;
|
AlbumList GetAlbumsByArtist(const QString &artist, const CollectionFilterOptions &opt = CollectionFilterOptions()) 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, const bool clear_art_manual = false) override;
|
void UpdateAutomaticAlbumArtAsync(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_manual = false) override;
|
||||||
@@ -188,7 +193,7 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
Song GetSongByUrl(const QUrl &url, qint64 beginning = 0) override;
|
Song GetSongByUrl(const QUrl &url, qint64 beginning = 0) override;
|
||||||
|
|
||||||
void AddDirectory(const QString &path) override;
|
void AddDirectory(const QString &path) override;
|
||||||
void RemoveDirectory(const Directory &dir) override;
|
void RemoveDirectory(const CollectionDirectory &dir) override;
|
||||||
|
|
||||||
bool ExecCollectionQuery(CollectionQuery *query, SongList &songs);
|
bool ExecCollectionQuery(CollectionQuery *query, SongList &songs);
|
||||||
bool ExecCollectionQuery(CollectionQuery *query, SongMap &songs);
|
bool ExecCollectionQuery(CollectionQuery *query, SongMap &songs);
|
||||||
@@ -207,8 +212,6 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
SongList SmartPlaylistsGetAllSongs();
|
SongList SmartPlaylistsGetAllSongs();
|
||||||
SongList SmartPlaylistsFindSongs(const SmartPlaylistSearch &search);
|
SongList SmartPlaylistsFindSongs(const SmartPlaylistSearch &search);
|
||||||
|
|
||||||
Song::Source Source() const;
|
|
||||||
|
|
||||||
void AddOrUpdateSongsAsync(const SongList &songs);
|
void AddOrUpdateSongsAsync(const SongList &songs);
|
||||||
void UpdateSongsBySongIDAsync(const SongMap &new_songs);
|
void UpdateSongsBySongIDAsync(const SongMap &new_songs);
|
||||||
|
|
||||||
@@ -226,7 +229,7 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
void UpdateMTimesOnly(const SongList &songs);
|
void UpdateMTimesOnly(const SongList &songs);
|
||||||
void DeleteSongs(const SongList &songs);
|
void DeleteSongs(const SongList &songs);
|
||||||
void MarkSongsUnavailable(const SongList &songs, const bool unavailable = true);
|
void MarkSongsUnavailable(const SongList &songs, const bool unavailable = true);
|
||||||
void AddOrUpdateSubdirs(const SubdirectoryList &subdirs);
|
void AddOrUpdateSubdirs(const CollectionSubdirectoryList &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, const bool clear_art_manual = false);
|
void UpdateAutomaticAlbumArt(const QString &effective_albumartist, const QString &album, const QUrl &cover_url, const bool clear_art_manual = false);
|
||||||
@@ -248,8 +251,8 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
void ExpireSongs(const int directory_id, const int expire_unavailable_songs_days);
|
void ExpireSongs(const int directory_id, const int expire_unavailable_songs_days);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void DirectoryDiscovered(Directory, SubdirectoryList);
|
void DirectoryDiscovered(CollectionDirectory, CollectionSubdirectoryList);
|
||||||
void DirectoryDeleted(Directory);
|
void DirectoryDeleted(CollectionDirectory);
|
||||||
|
|
||||||
void SongsDiscovered(SongList);
|
void SongsDiscovered(SongList);
|
||||||
void SongsDeleted(SongList);
|
void SongsDeleted(SongList);
|
||||||
@@ -278,9 +281,9 @@ class CollectionBackend : public CollectionBackendInterface {
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool UpdateCompilations(const QSqlDatabase &db, SongList &deleted_songs, SongList &added_songs, const QUrl &url, const bool compilation_detected);
|
bool UpdateCompilations(const QSqlDatabase &db, SongList &deleted_songs, SongList &added_songs, const QUrl &url, const bool compilation_detected);
|
||||||
AlbumList GetAlbums(const QString &artist, const QString &album_artist, const bool compilation_required = false, const QueryOptions &opt = QueryOptions());
|
AlbumList GetAlbums(const QString &artist, const QString &album_artist, const bool compilation_required = false, const CollectionFilterOptions &opt = CollectionFilterOptions());
|
||||||
AlbumList GetAlbums(const QString &artist, const bool compilation_required, const QueryOptions &opt = QueryOptions());
|
AlbumList GetAlbums(const QString &artist, const bool compilation_required, const CollectionFilterOptions &opt = CollectionFilterOptions());
|
||||||
SubdirectoryList SubdirsInDirectory(const int id, QSqlDatabase &db);
|
CollectionSubdirectoryList SubdirsInDirectory(const int id, QSqlDatabase &db);
|
||||||
|
|
||||||
Song GetSongById(const int id, QSqlDatabase &db);
|
Song GetSongById(const int id, QSqlDatabase &db);
|
||||||
SongList GetSongsById(const QStringList &ids, QSqlDatabase &db);
|
SongList GetSongsById(const QStringList &ids, QSqlDatabase &db);
|
||||||
|
|||||||
57
src/collection/collectiondirectory.h
Normal file
57
src/collection/collectiondirectory.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
|
* Copyright 2010, David Sansome <me@davidsansome.com>
|
||||||
|
*
|
||||||
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef COLLECTIONDIRECTORY_H
|
||||||
|
#define COLLECTIONDIRECTORY_H
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <QMetaType>
|
||||||
|
#include <QList>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
struct CollectionDirectory {
|
||||||
|
CollectionDirectory() : id(-1) {}
|
||||||
|
|
||||||
|
bool operator==(const CollectionDirectory &other) const {
|
||||||
|
return path == other.path && id == other.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString path;
|
||||||
|
int id;
|
||||||
|
};
|
||||||
|
Q_DECLARE_METATYPE(CollectionDirectory)
|
||||||
|
|
||||||
|
using CollectionDirectoryList = QList<CollectionDirectory>;
|
||||||
|
Q_DECLARE_METATYPE(CollectionDirectoryList)
|
||||||
|
|
||||||
|
struct CollectionSubdirectory {
|
||||||
|
CollectionSubdirectory() : directory_id(-1), mtime(0) {}
|
||||||
|
|
||||||
|
int directory_id;
|
||||||
|
QString path;
|
||||||
|
qint64 mtime;
|
||||||
|
};
|
||||||
|
Q_DECLARE_METATYPE(CollectionSubdirectory)
|
||||||
|
|
||||||
|
using CollectionSubdirectoryList = QList<CollectionSubdirectory>;
|
||||||
|
Q_DECLARE_METATYPE(CollectionSubdirectoryList)
|
||||||
|
|
||||||
|
#endif // COLLECTIONDIRECTORY_H
|
||||||
@@ -29,8 +29,8 @@
|
|||||||
#include "core/filesystemmusicstorage.h"
|
#include "core/filesystemmusicstorage.h"
|
||||||
#include "core/iconloader.h"
|
#include "core/iconloader.h"
|
||||||
#include "core/musicstorage.h"
|
#include "core/musicstorage.h"
|
||||||
#include "core/utilities.h"
|
#include "utilities/diskutils.h"
|
||||||
#include "directory.h"
|
#include "collectiondirectory.h"
|
||||||
#include "collectionbackend.h"
|
#include "collectionbackend.h"
|
||||||
#include "collectiondirectorymodel.h"
|
#include "collectiondirectorymodel.h"
|
||||||
|
|
||||||
@@ -46,17 +46,17 @@ CollectionDirectoryModel::CollectionDirectoryModel(CollectionBackend *backend, Q
|
|||||||
|
|
||||||
CollectionDirectoryModel::~CollectionDirectoryModel() = default;
|
CollectionDirectoryModel::~CollectionDirectoryModel() = default;
|
||||||
|
|
||||||
void CollectionDirectoryModel::DirectoryDiscovered(const Directory &dir) {
|
void CollectionDirectoryModel::DirectoryDiscovered(const CollectionDirectory &dir) {
|
||||||
|
|
||||||
QStandardItem *item = new QStandardItem(dir.path);
|
QStandardItem *item = new QStandardItem(dir.path);
|
||||||
item->setData(dir.id, kIdRole);
|
item->setData(dir.id, kIdRole);
|
||||||
item->setIcon(dir_icon_);
|
item->setIcon(dir_icon_);
|
||||||
storage_ << std::make_shared<FilesystemMusicStorage>(dir.path, dir.id);
|
storage_ << std::make_shared<FilesystemMusicStorage>(backend_->source(), dir.path, dir.id);
|
||||||
appendRow(item);
|
appendRow(item);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionDirectoryModel::DirectoryDeleted(const Directory &dir) {
|
void CollectionDirectoryModel::DirectoryDeleted(const CollectionDirectory &dir) {
|
||||||
|
|
||||||
for (int i = 0; i < rowCount(); ++i) {
|
for (int i = 0; i < rowCount(); ++i) {
|
||||||
if (item(i, 0)->data(kIdRole).toInt() == dir.id) {
|
if (item(i, 0)->data(kIdRole).toInt() == dir.id) {
|
||||||
@@ -80,7 +80,7 @@ void CollectionDirectoryModel::RemoveDirectory(const QModelIndex &idx) {
|
|||||||
|
|
||||||
if (!backend_ || !idx.isValid()) return;
|
if (!backend_ || !idx.isValid()) return;
|
||||||
|
|
||||||
Directory dir;
|
CollectionDirectory dir;
|
||||||
dir.path = idx.data().toString();
|
dir.path = idx.data().toString();
|
||||||
dir.id = idx.data(kIdRole).toInt();
|
dir.id = idx.data(kIdRole).toInt();
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
class QModelIndex;
|
class QModelIndex;
|
||||||
|
|
||||||
struct Directory;
|
struct CollectionDirectory;
|
||||||
class CollectionBackend;
|
class CollectionBackend;
|
||||||
class MusicStorage;
|
class MusicStorage;
|
||||||
|
|
||||||
@@ -53,8 +53,8 @@ class CollectionDirectoryModel : public QStandardItemModel {
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// To be called by the backend
|
// To be called by the backend
|
||||||
void DirectoryDiscovered(const Directory &directories);
|
void DirectoryDiscovered(const CollectionDirectory &directories);
|
||||||
void DirectoryDeleted(const Directory &directories);
|
void DirectoryDeleted(const CollectionDirectory &directories);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const int kIdRole = Qt::UserRole + 1;
|
static const int kIdRole = Qt::UserRole + 1;
|
||||||
|
|||||||
42
src/collection/collectionfilteroptions.cpp
Normal file
42
src/collection/collectionfilteroptions.cpp
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Strawberry Music Player
|
||||||
|
* Copyright 2023, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
|
*
|
||||||
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QtGlobal>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
|
#include "core/song.h"
|
||||||
|
|
||||||
|
#include "collectionfilteroptions.h"
|
||||||
|
|
||||||
|
CollectionFilterOptions::CollectionFilterOptions() : filter_mode_(FilterMode_All), max_age_(-1) {}
|
||||||
|
|
||||||
|
bool CollectionFilterOptions::Matches(const Song &song) const {
|
||||||
|
|
||||||
|
if (max_age_ != -1) {
|
||||||
|
const qint64 cutoff = QDateTime::currentDateTime().toSecsSinceEpoch() - max_age_;
|
||||||
|
if (song.ctime() <= cutoff) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!filter_text_.isNull()) {
|
||||||
|
return song.artist().contains(filter_text_, Qt::CaseInsensitive) || song.album().contains(filter_text_, Qt::CaseInsensitive) || song.title().contains(filter_text_, Qt::CaseInsensitive);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
65
src/collection/collectionfilteroptions.h
Normal file
65
src/collection/collectionfilteroptions.h
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Strawberry Music Player
|
||||||
|
* Copyright 2023, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
|
*
|
||||||
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef COLLECTIONFILTEROPTIONS_H
|
||||||
|
#define COLLECTIONFILTEROPTIONS_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
#include "core/song.h"
|
||||||
|
|
||||||
|
class CollectionFilterOptions {
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit CollectionFilterOptions();
|
||||||
|
|
||||||
|
// Filter mode:
|
||||||
|
// - use the all songs table
|
||||||
|
// - use the duplicated songs view; by duplicated we mean those songs for which the (artist, album, title) tuple is found more than once in the songs table
|
||||||
|
// - use the untagged songs view; by untagged we mean those for which at least one of the (artist, album, title) tags is empty
|
||||||
|
// Please note that additional filtering based on FTS table (the filter attribute) won't work in Duplicates and Untagged modes.
|
||||||
|
enum FilterMode {
|
||||||
|
FilterMode_All,
|
||||||
|
FilterMode_Duplicates,
|
||||||
|
FilterMode_Untagged
|
||||||
|
};
|
||||||
|
|
||||||
|
FilterMode filter_mode() const { return filter_mode_; }
|
||||||
|
int max_age() const { return max_age_; }
|
||||||
|
QString filter_text() const { return filter_text_; }
|
||||||
|
|
||||||
|
void set_filter_mode(const FilterMode filter_mode) {
|
||||||
|
filter_mode_ = filter_mode;
|
||||||
|
filter_text_.clear();
|
||||||
|
}
|
||||||
|
void set_max_age(const int max_age) { max_age_ = max_age; }
|
||||||
|
void set_filter_text(const QString &filter_text) {
|
||||||
|
filter_mode_ = FilterMode_All;
|
||||||
|
filter_text_ = filter_text;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Matches(const Song &song) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
FilterMode filter_mode_;
|
||||||
|
int max_age_;
|
||||||
|
QString filter_text_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COLLECTIONFILTEROPTIONS_H
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
* Strawberry Music Player
|
* Strawberry Music Player
|
||||||
* This file was part of Clementine.
|
* This file was part of Clementine.
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
* Copyright 2010, David Sansome <me@davidsansome.com>
|
||||||
|
* Copyright 2019-2022, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -45,6 +46,7 @@
|
|||||||
#include "core/iconloader.h"
|
#include "core/iconloader.h"
|
||||||
#include "core/song.h"
|
#include "core/song.h"
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
|
#include "collectionfilteroptions.h"
|
||||||
#include "collectionmodel.h"
|
#include "collectionmodel.h"
|
||||||
#include "collectionquery.h"
|
#include "collectionquery.h"
|
||||||
#include "savedgroupingmanager.h"
|
#include "savedgroupingmanager.h"
|
||||||
@@ -58,7 +60,12 @@ CollectionFilterWidget::CollectionFilterWidget(QWidget *parent)
|
|||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
ui_(new Ui_CollectionFilterWidget),
|
ui_(new Ui_CollectionFilterWidget),
|
||||||
model_(nullptr),
|
model_(nullptr),
|
||||||
group_by_dialog_(new GroupByDialog),
|
group_by_dialog_(new GroupByDialog(this)),
|
||||||
|
groupings_manager_(nullptr),
|
||||||
|
filter_age_menu_(nullptr),
|
||||||
|
group_by_menu_(nullptr),
|
||||||
|
collection_menu_(nullptr),
|
||||||
|
group_by_group_(nullptr),
|
||||||
filter_delay_(new QTimer(this)),
|
filter_delay_(new QTimer(this)),
|
||||||
filter_applies_to_model_(true),
|
filter_applies_to_model_(true),
|
||||||
delay_behaviour_(DelayedOnLargeLibraries) {
|
delay_behaviour_(DelayedOnLargeLibraries) {
|
||||||
@@ -114,13 +121,8 @@ CollectionFilterWidget::CollectionFilterWidget(QWidget *parent)
|
|||||||
filter_ages_[ui_->filter_age_three_months] = 60 * 60 * 24 * 30 * 3;
|
filter_ages_[ui_->filter_age_three_months] = 60 * 60 * 24 * 30 * 3;
|
||||||
filter_ages_[ui_->filter_age_year] = 60 * 60 * 24 * 365;
|
filter_ages_[ui_->filter_age_year] = 60 * 60 * 24 * 365;
|
||||||
|
|
||||||
// "Group by ..."
|
|
||||||
group_by_group_ = CreateGroupByActions(this);
|
|
||||||
|
|
||||||
group_by_menu_ = new QMenu(tr("Group by"), this);
|
group_by_menu_ = new QMenu(tr("Group by"), this);
|
||||||
group_by_menu_->addActions(group_by_group_->actions());
|
|
||||||
|
|
||||||
QObject::connect(group_by_group_, &QActionGroup::triggered, this, &CollectionFilterWidget::GroupByClicked);
|
|
||||||
QObject::connect(ui_->save_grouping, &QAction::triggered, this, &CollectionFilterWidget::SaveGroupBy);
|
QObject::connect(ui_->save_grouping, &QAction::triggered, this, &CollectionFilterWidget::SaveGroupBy);
|
||||||
QObject::connect(ui_->manage_groupings, &QAction::triggered, this, &CollectionFilterWidget::ShowGroupingManager);
|
QObject::connect(ui_->manage_groupings, &QAction::triggered, this, &CollectionFilterWidget::ShowGroupingManager);
|
||||||
|
|
||||||
@@ -147,8 +149,8 @@ void CollectionFilterWidget::Init(CollectionModel *model) {
|
|||||||
|
|
||||||
if (model_) {
|
if (model_) {
|
||||||
QObject::disconnect(model_, nullptr, this, nullptr);
|
QObject::disconnect(model_, nullptr, this, nullptr);
|
||||||
QObject::disconnect(model_, nullptr, group_by_dialog_.get(), nullptr);
|
QObject::disconnect(model_, nullptr, group_by_dialog_, nullptr);
|
||||||
QObject::disconnect(group_by_dialog_.get(), nullptr, model_, nullptr);
|
QObject::disconnect(group_by_dialog_, nullptr, model_, nullptr);
|
||||||
QList<QAction*> filter_ages = filter_ages_.keys();
|
QList<QAction*> filter_ages = filter_ages_.keys();
|
||||||
for (QAction *action : filter_ages) {
|
for (QAction *action : filter_ages) {
|
||||||
QObject::disconnect(action, &QAction::triggered, model_, nullptr);
|
QObject::disconnect(action, &QAction::triggered, model_, nullptr);
|
||||||
@@ -158,9 +160,9 @@ void CollectionFilterWidget::Init(CollectionModel *model) {
|
|||||||
model_ = model;
|
model_ = model;
|
||||||
|
|
||||||
// Connect signals
|
// Connect signals
|
||||||
QObject::connect(model_, &CollectionModel::GroupingChanged, group_by_dialog_.get(), &GroupByDialog::CollectionGroupingChanged);
|
QObject::connect(model_, &CollectionModel::GroupingChanged, group_by_dialog_, &GroupByDialog::CollectionGroupingChanged);
|
||||||
QObject::connect(model_, &CollectionModel::GroupingChanged, this, &CollectionFilterWidget::GroupingChanged);
|
QObject::connect(model_, &CollectionModel::GroupingChanged, this, &CollectionFilterWidget::GroupingChanged);
|
||||||
QObject::connect(group_by_dialog_.get(), &GroupByDialog::Accepted, model_, &CollectionModel::SetGroupBy);
|
QObject::connect(group_by_dialog_, &GroupByDialog::Accepted, model_, &CollectionModel::SetGroupBy);
|
||||||
|
|
||||||
QList<QAction*> filter_ages = filter_ages_.keys();
|
QList<QAction*> filter_ages = filter_ages_.keys();
|
||||||
for (QAction *action : filter_ages) {
|
for (QAction *action : filter_ages) {
|
||||||
@@ -176,15 +178,31 @@ 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_key(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_key(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_key(3), static_cast<int>(CollectionModel::GroupBy_None)).toInt())), s.value(separate_albums_by_grouping_key(), false).toBool());
|
||||||
}
|
}
|
||||||
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), false);
|
||||||
}
|
}
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CollectionFilterWidget::SetSettingsGroup(const QString &settings_group) {
|
||||||
|
|
||||||
|
settings_group_ = settings_group;
|
||||||
|
saved_groupings_settings_group_ = SavedGroupingManager::GetSavedGroupingsSettingsGroup(settings_group);
|
||||||
|
|
||||||
|
UpdateGroupByActions();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CollectionFilterWidget::SetSettingsPrefix(const QString &prefix) {
|
||||||
|
|
||||||
|
settings_prefix_ = prefix;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionFilterWidget::ReloadSettings() {
|
void CollectionFilterWidget::ReloadSettings() {
|
||||||
@@ -198,21 +216,10 @@ void CollectionFilterWidget::ReloadSettings() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CollectionFilterWidget::group_by() {
|
QString CollectionFilterWidget::group_by_version() const {
|
||||||
|
|
||||||
if (settings_prefix_.isEmpty()) {
|
if (settings_prefix_.isEmpty()) {
|
||||||
return QString("group_by");
|
return "group_by_version";
|
||||||
}
|
|
||||||
else {
|
|
||||||
return QString("%1_group_by").arg(settings_prefix_);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CollectionFilterWidget::group_by_version() {
|
|
||||||
|
|
||||||
if (settings_prefix_.isEmpty()) {
|
|
||||||
return QString("group_by_version");
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return QString("%1_group_by_version").arg(settings_prefix_);
|
return QString("%1_group_by_version").arg(settings_prefix_);
|
||||||
@@ -220,7 +227,29 @@ QString CollectionFilterWidget::group_by_version() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CollectionFilterWidget::group_by(const int number) { return group_by() + QString::number(number); }
|
QString CollectionFilterWidget::group_by_key() const {
|
||||||
|
|
||||||
|
if (settings_prefix_.isEmpty()) {
|
||||||
|
return "group_by";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return QString("%1_group_by").arg(settings_prefix_);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CollectionFilterWidget::group_by_key(const int number) const { return group_by_key() + QString::number(number); }
|
||||||
|
|
||||||
|
QString CollectionFilterWidget::separate_albums_by_grouping_key() const {
|
||||||
|
|
||||||
|
if (settings_prefix_.isEmpty()) {
|
||||||
|
return "separate_albums_by_grouping";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return QString("%1_separate_albums_by_grouping").arg(settings_prefix_);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void CollectionFilterWidget::UpdateGroupByActions() {
|
void CollectionFilterWidget::UpdateGroupByActions() {
|
||||||
|
|
||||||
@@ -229,7 +258,7 @@ void CollectionFilterWidget::UpdateGroupByActions() {
|
|||||||
delete group_by_group_;
|
delete group_by_group_;
|
||||||
}
|
}
|
||||||
|
|
||||||
group_by_group_ = CreateGroupByActions(this);
|
group_by_group_ = CreateGroupByActions(saved_groupings_settings_group_, this);
|
||||||
group_by_menu_->clear();
|
group_by_menu_->clear();
|
||||||
group_by_menu_->addActions(group_by_group_->actions());
|
group_by_menu_->addActions(group_by_group_->actions());
|
||||||
QObject::connect(group_by_group_, &QActionGroup::triggered, this, &CollectionFilterWidget::GroupByClicked);
|
QObject::connect(group_by_group_, &QActionGroup::triggered, this, &CollectionFilterWidget::GroupByClicked);
|
||||||
@@ -239,8 +268,7 @@ void CollectionFilterWidget::UpdateGroupByActions() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QActionGroup *CollectionFilterWidget::CreateGroupByActions(const QString &saved_groupings_settings_group, QObject *parent) {
|
||||||
QActionGroup *CollectionFilterWidget::CreateGroupByActions(QObject *parent) {
|
|
||||||
|
|
||||||
QActionGroup *ret = new QActionGroup(parent);
|
QActionGroup *ret = new QActionGroup(parent);
|
||||||
|
|
||||||
@@ -267,9 +295,9 @@ QActionGroup *CollectionFilterWidget::CreateGroupByActions(QObject *parent) {
|
|||||||
sep1->setSeparator(true);
|
sep1->setSeparator(true);
|
||||||
ret->addAction(sep1);
|
ret->addAction(sep1);
|
||||||
|
|
||||||
// read saved groupings
|
// Read saved groupings
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(CollectionModel::kSavedGroupingsSettingsGroup);
|
s.beginGroup(saved_groupings_settings_group);
|
||||||
int version = s.value("version").toInt();
|
int version = s.value("version").toInt();
|
||||||
if (version == 1) {
|
if (version == 1) {
|
||||||
QStringList saved = s.childKeys();
|
QStringList saved = s.childKeys();
|
||||||
@@ -316,20 +344,38 @@ QAction *CollectionFilterWidget::CreateGroupByAction(const QString &text, QObjec
|
|||||||
|
|
||||||
void CollectionFilterWidget::SaveGroupBy() {
|
void CollectionFilterWidget::SaveGroupBy() {
|
||||||
|
|
||||||
QString text = QInputDialog::getText(this, tr("Grouping Name"), tr("Grouping name:"));
|
if (!model_) return;
|
||||||
if (!text.isEmpty() && model_) {
|
|
||||||
model_->SaveGrouping(text);
|
QString name = QInputDialog::getText(this, tr("Grouping Name"), tr("Grouping name:"));
|
||||||
UpdateGroupByActions();
|
if (name.isEmpty()) return;
|
||||||
|
|
||||||
|
qLog(Debug) << "Saving current grouping to" << name;
|
||||||
|
|
||||||
|
QSettings s;
|
||||||
|
if (settings_group_.isEmpty() || settings_group_ == CollectionSettingsPage::kSettingsGroup) {
|
||||||
|
s.beginGroup(SavedGroupingManager::kSavedGroupingsSettingsGroup);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
s.beginGroup(QString(SavedGroupingManager::kSavedGroupingsSettingsGroup) + "_" + settings_group_);
|
||||||
|
}
|
||||||
|
QByteArray buffer;
|
||||||
|
QDataStream datastream(&buffer, QIODevice::WriteOnly);
|
||||||
|
datastream << model_->GetGroupBy();
|
||||||
|
s.setValue("version", "1");
|
||||||
|
s.setValue(name, buffer);
|
||||||
|
s.endGroup();
|
||||||
|
|
||||||
|
UpdateGroupByActions();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionFilterWidget::ShowGroupingManager() {
|
void CollectionFilterWidget::ShowGroupingManager() {
|
||||||
|
|
||||||
if (!groupings_manager_) {
|
if (!groupings_manager_) {
|
||||||
groupings_manager_ = std::make_unique<SavedGroupingManager>();
|
groupings_manager_ = new SavedGroupingManager(saved_groupings_settings_group_, this);
|
||||||
|
QObject::connect(groupings_manager_, &SavedGroupingManager::UpdateGroupByActions, this, &CollectionFilterWidget::UpdateGroupByActions);
|
||||||
}
|
}
|
||||||
groupings_manager_->SetFilter(this);
|
|
||||||
groupings_manager_->UpdateModel();
|
groupings_manager_->UpdateModel();
|
||||||
groupings_manager_->show();
|
groupings_manager_->show();
|
||||||
|
|
||||||
@@ -366,16 +412,16 @@ void CollectionFilterWidget::GroupByClicked(QAction *action) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionFilterWidget::GroupingChanged(const CollectionModel::Grouping g) {
|
void CollectionFilterWidget::GroupingChanged(const CollectionModel::Grouping g, const bool separate_albums_by_grouping) {
|
||||||
|
|
||||||
if (!settings_group_.isEmpty()) {
|
if (!settings_group_.isEmpty()) {
|
||||||
// Save the settings
|
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(settings_group_);
|
s.beginGroup(settings_group_);
|
||||||
s.setValue(group_by_version(), 1);
|
s.setValue(group_by_version(), 1);
|
||||||
s.setValue(group_by(1), static_cast<int>(g[0]));
|
s.setValue(group_by_key(1), static_cast<int>(g[0]));
|
||||||
s.setValue(group_by(2), static_cast<int>(g[1]));
|
s.setValue(group_by_key(2), static_cast<int>(g[1]));
|
||||||
s.setValue(group_by(3), static_cast<int>(g[2]));
|
s.setValue(group_by_key(3), static_cast<int>(g[2]));
|
||||||
|
s.setValue(separate_albums_by_grouping_key(), separate_albums_by_grouping);
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,6 +432,10 @@ void CollectionFilterWidget::GroupingChanged(const CollectionModel::Grouping g)
|
|||||||
|
|
||||||
void CollectionFilterWidget::CheckCurrentGrouping(const CollectionModel::Grouping g) {
|
void CollectionFilterWidget::CheckCurrentGrouping(const CollectionModel::Grouping g) {
|
||||||
|
|
||||||
|
if (!group_by_group_) {
|
||||||
|
UpdateGroupByActions();
|
||||||
|
}
|
||||||
|
|
||||||
for (QAction *action : group_by_group_->actions()) {
|
for (QAction *action : group_by_group_->actions()) {
|
||||||
if (action->property("group_by").isNull()) continue;
|
if (action->property("group_by").isNull()) continue;
|
||||||
|
|
||||||
@@ -406,12 +456,12 @@ void CollectionFilterWidget::SetFilterHint(const QString &hint) {
|
|||||||
ui_->search_field->setPlaceholderText(hint);
|
ui_->search_field->setPlaceholderText(hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionFilterWidget::SetQueryMode(QueryOptions::QueryMode query_mode) {
|
void CollectionFilterWidget::SetFilterMode(CollectionFilterOptions::FilterMode filter_mode) {
|
||||||
|
|
||||||
ui_->search_field->clear();
|
ui_->search_field->clear();
|
||||||
ui_->search_field->setEnabled(query_mode == QueryOptions::QueryMode_All);
|
ui_->search_field->setEnabled(filter_mode == CollectionFilterOptions::FilterMode_All);
|
||||||
|
|
||||||
model_->SetFilterQueryMode(query_mode);
|
model_->SetFilterMode(filter_mode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
* Strawberry Music Player
|
* Strawberry Music Player
|
||||||
* This file was part of Clementine.
|
* This file was part of Clementine.
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
* Copyright 2010, David Sansome <me@davidsansome.com>
|
||||||
|
* Copyright 2019-2022, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include "collectionquery.h"
|
#include "collectionquery.h"
|
||||||
|
#include "collectionqueryoptions.h"
|
||||||
#include "collectionmodel.h"
|
#include "collectionmodel.h"
|
||||||
|
|
||||||
class QTimer;
|
class QTimer;
|
||||||
@@ -60,9 +62,8 @@ class CollectionFilterWidget : public QWidget {
|
|||||||
|
|
||||||
void Init(CollectionModel *model);
|
void Init(CollectionModel *model);
|
||||||
|
|
||||||
static QActionGroup *CreateGroupByActions(QObject *parent);
|
static QActionGroup *CreateGroupByActions(const QString &saved_groupings_settings_group, QObject *parent);
|
||||||
|
|
||||||
void UpdateGroupByActions();
|
|
||||||
void SetFilterHint(const QString &hint);
|
void SetFilterHint(const QString &hint);
|
||||||
void SetApplyFilterToCollection(bool filter_applies_to_model) { filter_applies_to_model_ = filter_applies_to_model; }
|
void SetApplyFilterToCollection(bool filter_applies_to_model) { filter_applies_to_model_ = filter_applies_to_model; }
|
||||||
void SetDelayBehaviour(DelayBehaviour behaviour) { delay_behaviour_ = behaviour; }
|
void SetDelayBehaviour(DelayBehaviour behaviour) { delay_behaviour_ = behaviour; }
|
||||||
@@ -73,12 +74,13 @@ class CollectionFilterWidget : public QWidget {
|
|||||||
QMenu *menu() const { return collection_menu_; }
|
QMenu *menu() const { return collection_menu_; }
|
||||||
void AddMenuAction(QAction *action);
|
void AddMenuAction(QAction *action);
|
||||||
|
|
||||||
void SetSettingsGroup(const QString &group) { settings_group_ = group; }
|
void SetSettingsGroup(const QString &group);
|
||||||
void SetSettingsPrefix(const QString &prefix) { settings_prefix_ = prefix; }
|
void SetSettingsPrefix(const QString &prefix);
|
||||||
|
|
||||||
QString group_by();
|
QString group_by_version() const;
|
||||||
QString group_by_version();
|
QString group_by_key() const;
|
||||||
QString group_by(const int number);
|
QString group_by_key(const int number) const;
|
||||||
|
QString separate_albums_by_grouping_key() const;
|
||||||
|
|
||||||
void ReloadSettings();
|
void ReloadSettings();
|
||||||
|
|
||||||
@@ -86,7 +88,8 @@ class CollectionFilterWidget : public QWidget {
|
|||||||
void FocusSearchField();
|
void FocusSearchField();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void SetQueryMode(QueryOptions::QueryMode query_mode);
|
void UpdateGroupByActions();
|
||||||
|
void SetFilterMode(CollectionFilterOptions::FilterMode filter_mode);
|
||||||
void FocusOnFilter(QKeyEvent *e);
|
void FocusOnFilter(QKeyEvent *e);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -99,7 +102,7 @@ class CollectionFilterWidget : public QWidget {
|
|||||||
void keyReleaseEvent(QKeyEvent *e) override;
|
void keyReleaseEvent(QKeyEvent *e) override;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void GroupingChanged(const CollectionModel::Grouping g);
|
void GroupingChanged(const CollectionModel::Grouping g, const bool separate_albums_by_grouping);
|
||||||
void GroupByClicked(QAction *action);
|
void GroupByClicked(QAction *action);
|
||||||
void SaveGroupBy();
|
void SaveGroupBy();
|
||||||
void ShowGroupingManager();
|
void ShowGroupingManager();
|
||||||
@@ -115,8 +118,8 @@ class CollectionFilterWidget : public QWidget {
|
|||||||
Ui_CollectionFilterWidget *ui_;
|
Ui_CollectionFilterWidget *ui_;
|
||||||
CollectionModel *model_;
|
CollectionModel *model_;
|
||||||
|
|
||||||
std::unique_ptr<GroupByDialog> group_by_dialog_;
|
GroupByDialog *group_by_dialog_;
|
||||||
std::unique_ptr<SavedGroupingManager> groupings_manager_;
|
SavedGroupingManager *groupings_manager_;
|
||||||
|
|
||||||
QMenu *filter_age_menu_;
|
QMenu *filter_age_menu_;
|
||||||
QMenu *group_by_menu_;
|
QMenu *group_by_menu_;
|
||||||
@@ -130,6 +133,7 @@ class CollectionFilterWidget : public QWidget {
|
|||||||
DelayBehaviour delay_behaviour_;
|
DelayBehaviour delay_behaviour_;
|
||||||
|
|
||||||
QString settings_group_;
|
QString settings_group_;
|
||||||
|
QString saved_groupings_settings_group_;
|
||||||
QString settings_prefix_;
|
QString settings_prefix_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
@@ -47,7 +49,9 @@
|
|||||||
#include "core/song.h"
|
#include "core/song.h"
|
||||||
#include "core/sqlrow.h"
|
#include "core/sqlrow.h"
|
||||||
#include "covermanager/albumcoverloader.h"
|
#include "covermanager/albumcoverloader.h"
|
||||||
|
#include "collectionfilteroptions.h"
|
||||||
#include "collectionquery.h"
|
#include "collectionquery.h"
|
||||||
|
#include "collectionqueryoptions.h"
|
||||||
#include "collectionitem.h"
|
#include "collectionitem.h"
|
||||||
#include "covermanager/albumcoverloaderoptions.h"
|
#include "covermanager/albumcoverloaderoptions.h"
|
||||||
|
|
||||||
@@ -64,8 +68,6 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
|
|||||||
explicit CollectionModel(CollectionBackend *backend, Application *app, QObject *parent = nullptr);
|
explicit CollectionModel(CollectionBackend *backend, Application *app, QObject *parent = nullptr);
|
||||||
~CollectionModel() override;
|
~CollectionModel() override;
|
||||||
|
|
||||||
static const char *kSavedGroupingsSettingsGroup;
|
|
||||||
|
|
||||||
static const int kPrettyCoverSize;
|
static const int kPrettyCoverSize;
|
||||||
static const char *kPixmapDiskCacheDir;
|
static const char *kPixmapDiskCacheDir;
|
||||||
|
|
||||||
@@ -160,9 +162,6 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
|
|||||||
// Whether or not to show letters heading in the collection view
|
// Whether or not to show letters heading in the collection view
|
||||||
void set_show_dividers(const bool show_dividers);
|
void set_show_dividers(const bool show_dividers);
|
||||||
|
|
||||||
// Save the current grouping
|
|
||||||
void SaveGrouping(const QString &name);
|
|
||||||
|
|
||||||
// Reload settings.
|
// Reload settings.
|
||||||
void ReloadSettings();
|
void ReloadSettings();
|
||||||
|
|
||||||
@@ -195,20 +194,20 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
|
|||||||
void ExpandAll(CollectionItem *item = nullptr) const;
|
void ExpandAll(CollectionItem *item = nullptr) const;
|
||||||
|
|
||||||
const CollectionModel::Grouping GetGroupBy() const { return group_by_; }
|
const CollectionModel::Grouping GetGroupBy() const { return group_by_; }
|
||||||
void SetGroupBy(const CollectionModel::Grouping g);
|
void SetGroupBy(const CollectionModel::Grouping g, const std::optional<bool> separate_albums_by_grouping = std::optional<bool>());
|
||||||
|
|
||||||
static QString ContainerKey(const GroupBy type, const Song &song);
|
static QString ContainerKey(const GroupBy group_by, const bool separate_albums_by_grouping, const Song &song);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void TotalSongCountUpdated(int count);
|
void TotalSongCountUpdated(int count);
|
||||||
void TotalArtistCountUpdated(int count);
|
void TotalArtistCountUpdated(int count);
|
||||||
void TotalAlbumCountUpdated(int count);
|
void TotalAlbumCountUpdated(int count);
|
||||||
void GroupingChanged(CollectionModel::Grouping g);
|
void GroupingChanged(CollectionModel::Grouping g, bool separate_albums_by_grouping);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void SetFilterAge(const int age);
|
void SetFilterMode(CollectionFilterOptions::FilterMode filter_mode);
|
||||||
void SetFilterText(const QString &text);
|
void SetFilterAge(const int filter_age);
|
||||||
void SetFilterQueryMode(QueryOptions::QueryMode query_mode);
|
void SetFilterText(const QString &filter_text);
|
||||||
|
|
||||||
void Init(const bool async = true);
|
void Init(const bool async = true);
|
||||||
void Reset();
|
void Reset();
|
||||||
@@ -235,34 +234,35 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
|
|||||||
void AlbumCoverLoaded(const quint64 id, const AlbumCoverLoaderResult &result);
|
void AlbumCoverLoaded(const quint64 id, const AlbumCoverLoaderResult &result);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Provides some optimisations for loading the list of items in the root.
|
// Provides some optimizations for loading the list of items in the root.
|
||||||
// This gets called a lot when filtering the playlist, so it's nice to be able to do it in a background thread.
|
// This gets called a lot when filtering the playlist, so it's nice to be able to do it in a background thread.
|
||||||
QueryResult RunQuery(CollectionItem *parent);
|
CollectionQueryOptions PrepareQuery(CollectionItem *parent);
|
||||||
|
QueryResult RunQuery(const CollectionFilterOptions &filter_options = CollectionFilterOptions(), const CollectionQueryOptions &query_options = CollectionQueryOptions());
|
||||||
void PostQuery(CollectionItem *parent, const QueryResult &result, const bool signal);
|
void PostQuery(CollectionItem *parent, const QueryResult &result, const bool signal);
|
||||||
|
|
||||||
bool HasCompilations(const QSqlDatabase &db, const CollectionQuery &query);
|
bool HasCompilations(const QSqlDatabase &db, const CollectionFilterOptions &filter_options, const CollectionQueryOptions &query_options);
|
||||||
|
|
||||||
void BeginReset();
|
void BeginReset();
|
||||||
|
|
||||||
// Functions for working with queries and creating items.
|
// Functions for working with queries and creating items.
|
||||||
// When the model is reset or when a node is lazy-loaded the Collection constructs a database query to populate the items.
|
// When the model is reset or when a node is lazy-loaded the Collection constructs a database query to populate the items.
|
||||||
// Filters are added for each parent item, restricting the songs returned to a particular album or artist for example.
|
// Filters are added for each parent item, restricting the songs returned to a particular album or artist for example.
|
||||||
static void InitQuery(const GroupBy type, CollectionQuery *q);
|
static void SetQueryColumnSpec(const GroupBy group_by, const bool separate_albums_by_grouping, CollectionQueryOptions *query_options);
|
||||||
static void FilterQuery(const GroupBy type, CollectionItem *item, CollectionQuery *q);
|
static void AddQueryWhere(const GroupBy group_by, const bool separate_albums_by_grouping, CollectionItem *item, CollectionQueryOptions *query_options);
|
||||||
|
|
||||||
// Items can be created either from a query that's been run to populate a node, or by a spontaneous SongsDiscovered emission from the backend.
|
// Items can be created either from a query that's been run to populate a node, or by a spontaneous SongsDiscovered emission from the backend.
|
||||||
CollectionItem *ItemFromQuery(const GroupBy type, const bool signal, const bool create_divider, CollectionItem *parent, const SqlRow &row, const int container_level);
|
CollectionItem *ItemFromQuery(const GroupBy group_by, const bool separate_albums_by_grouping, const bool signal, const bool create_divider, CollectionItem *parent, const SqlRow &row, const int container_level);
|
||||||
CollectionItem *ItemFromSong(const GroupBy type, const bool signal, const bool create_divider, CollectionItem *parent, const Song &s, const int container_level);
|
CollectionItem *ItemFromSong(const GroupBy group_by, const bool separate_albums_by_grouping, const bool signal, const bool create_divider, CollectionItem *parent, const Song &s, const int container_level);
|
||||||
|
|
||||||
// The "Various Artists" node is an annoying special case.
|
// The "Various Artists" node is an annoying special case.
|
||||||
CollectionItem *CreateCompilationArtistNode(const bool signal, CollectionItem *parent);
|
CollectionItem *CreateCompilationArtistNode(const bool signal, CollectionItem *parent);
|
||||||
|
|
||||||
// Helpers for ItemFromQuery and ItemFromSong
|
// Helpers for ItemFromQuery and ItemFromSong
|
||||||
CollectionItem *InitItem(const GroupBy type, const bool signal, CollectionItem *parent, const int container_level);
|
CollectionItem *InitItem(const GroupBy group_by, const bool signal, CollectionItem *parent, const int container_level);
|
||||||
void FinishItem(const GroupBy type, const bool signal, const bool create_divider, CollectionItem *parent, CollectionItem *item);
|
void FinishItem(const GroupBy group_by, const bool signal, const bool create_divider, CollectionItem *parent, CollectionItem *item);
|
||||||
|
|
||||||
static QString DividerKey(const GroupBy type, CollectionItem *item);
|
static QString DividerKey(const GroupBy group_by, CollectionItem *item);
|
||||||
static QString DividerDisplayText(const GroupBy type, const QString &key);
|
static QString DividerDisplayText(const GroupBy group_by, const QString &key);
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
static bool IsCompilationArtistNode(const CollectionItem *node) { return node == node->parent->compilation_artist_node_; }
|
static bool IsCompilationArtistNode(const CollectionItem *node) { return node == node->parent->compilation_artist_node_; }
|
||||||
@@ -282,8 +282,9 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
|
|||||||
int total_artist_count_;
|
int total_artist_count_;
|
||||||
int total_album_count_;
|
int total_album_count_;
|
||||||
|
|
||||||
QueryOptions query_options_;
|
CollectionFilterOptions filter_options_;
|
||||||
Grouping group_by_;
|
Grouping group_by_;
|
||||||
|
bool separate_albums_by_grouping_;
|
||||||
|
|
||||||
// Keyed on database ID
|
// Keyed on database ID
|
||||||
QMap<int, CollectionItem*> song_nodes_;
|
QMap<int, CollectionItem*> song_nodes_;
|
||||||
@@ -310,7 +311,7 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
|
|||||||
|
|
||||||
AlbumCoverLoaderOptions cover_loader_options_;
|
AlbumCoverLoaderOptions cover_loader_options_;
|
||||||
|
|
||||||
typedef QPair<CollectionItem*, QString> ItemAndCacheKey;
|
using ItemAndCacheKey = QPair<CollectionItem*, QString>;
|
||||||
QMap<quint64, ItemAndCacheKey> pending_art_;
|
QMap<quint64, ItemAndCacheKey> pending_art_;
|
||||||
QSet<QString> pending_cache_keys_;
|
QSet<QString> pending_cache_keys_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -31,16 +31,16 @@
|
|||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
#include <QSqlError>
|
|
||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
|
#include "core/sqlquery.h"
|
||||||
#include "core/song.h"
|
#include "core/song.h"
|
||||||
|
|
||||||
#include "collectionquery.h"
|
#include "collectionquery.h"
|
||||||
|
#include "collectionfilteroptions.h"
|
||||||
|
#include "collectionqueryoptions.h"
|
||||||
|
|
||||||
QueryOptions::QueryOptions() : max_age_(-1), query_mode_(QueryMode_All) {}
|
CollectionQuery::CollectionQuery(const QSqlDatabase &db, const QString &songs_table, const QString &fts_table, const CollectionFilterOptions &filter_options)
|
||||||
|
|
||||||
CollectionQuery::CollectionQuery(const QSqlDatabase &db, const QString &songs_table, const QString &fts_table, const QueryOptions &options)
|
|
||||||
: QSqlQuery(db),
|
: QSqlQuery(db),
|
||||||
songs_table_(songs_table),
|
songs_table_(songs_table),
|
||||||
fts_table_(fts_table),
|
fts_table_(fts_table),
|
||||||
@@ -49,7 +49,7 @@ CollectionQuery::CollectionQuery(const QSqlDatabase &db, const QString &songs_ta
|
|||||||
duplicates_only_(false),
|
duplicates_only_(false),
|
||||||
limit_(-1) {
|
limit_(-1) {
|
||||||
|
|
||||||
if (!options.filter().isEmpty()) {
|
if (!filter_options.filter_text().isEmpty()) {
|
||||||
// We need to munge the filter text a little bit to get it to work as expected with sqlite's FTS5:
|
// We need to munge the filter text a little bit to get it to work as expected with sqlite's FTS5:
|
||||||
// 1) Append * to all tokens.
|
// 1) Append * to all tokens.
|
||||||
// 2) Prefix "fts" to column names.
|
// 2) Prefix "fts" to column names.
|
||||||
@@ -57,9 +57,9 @@ CollectionQuery::CollectionQuery(const QSqlDatabase &db, const QString &songs_ta
|
|||||||
|
|
||||||
// Split on whitespace
|
// Split on whitespace
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
|
||||||
QStringList tokens(options.filter().split(QRegularExpression("\\s+"), Qt::SkipEmptyParts));
|
QStringList tokens(filter_options.filter_text().split(QRegularExpression("\\s+"), Qt::SkipEmptyParts));
|
||||||
#else
|
#else
|
||||||
QStringList tokens(options.filter().split(QRegularExpression("\\s+"), QString::SkipEmptyParts));
|
QStringList tokens(filter_options.filter_text().split(QRegularExpression("\\s+"), QString::SkipEmptyParts));
|
||||||
#endif
|
#endif
|
||||||
QString query;
|
QString query;
|
||||||
for (QString token : tokens) {
|
for (QString token : tokens) {
|
||||||
@@ -100,49 +100,40 @@ CollectionQuery::CollectionQuery(const QSqlDatabase &db, const QString &songs_ta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.max_age() != -1) {
|
if (filter_options.max_age() != -1) {
|
||||||
qint64 cutoff = QDateTime::currentDateTime().toSecsSinceEpoch() - options.max_age();
|
qint64 cutoff = QDateTime::currentDateTime().toSecsSinceEpoch() - filter_options.max_age();
|
||||||
|
|
||||||
where_clauses_ << "ctime > ?";
|
where_clauses_ << "ctime > ?";
|
||||||
bound_values_ << cutoff;
|
bound_values_ << cutoff;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Currently you cannot use any QueryMode other than All and FTS at the same time.
|
// TODO: Currently you cannot use any FilterMode other than All and FTS at the same time.
|
||||||
// Joining songs, duplicated_songs and songs_fts all together takes a huge amount of time.
|
// Joining songs, duplicated_songs and songs_fts all together takes a huge amount of time.
|
||||||
// The query takes about 20 seconds on my machine then. Why?
|
// The query takes about 20 seconds on my machine then. Why?
|
||||||
// Untagged mode could work with additional filtering but I'm disabling it just to be consistent
|
// Untagged mode could work with additional filtering but I'm disabling it just to be consistent
|
||||||
// this way filtering is available only in the All mode.
|
// this way filtering is available only in the All mode.
|
||||||
// Remember though that when you fix the Duplicates + FTS cooperation, enable the filtering in both Duplicates and Untagged modes.
|
// Remember though that when you fix the Duplicates + FTS cooperation, enable the filtering in both Duplicates and Untagged modes.
|
||||||
duplicates_only_ = options.query_mode() == QueryOptions::QueryMode_Duplicates;
|
duplicates_only_ = filter_options.filter_mode() == CollectionFilterOptions::FilterMode_Duplicates;
|
||||||
|
|
||||||
if (options.query_mode() == QueryOptions::QueryMode_Untagged) {
|
if (filter_options.filter_mode() == CollectionFilterOptions::FilterMode_Untagged) {
|
||||||
where_clauses_ << "(artist = '' OR album = '' OR title ='')";
|
where_clauses_ << "(artist = '' OR album = '' OR title ='')";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CollectionQuery::GetInnerQuery() const {
|
|
||||||
return duplicates_only_
|
|
||||||
? QString(" INNER JOIN (select * from duplicated_songs) dsongs "
|
|
||||||
"ON (%songs_table.artist = dsongs.dup_artist "
|
|
||||||
"AND %songs_table.album = dsongs.dup_album "
|
|
||||||
"AND %songs_table.title = dsongs.dup_title) ")
|
|
||||||
: QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CollectionQuery::AddWhere(const QString &column, const QVariant &value, const QString &op) {
|
void CollectionQuery::AddWhere(const QString &column, const QVariant &value, const QString &op) {
|
||||||
|
|
||||||
// Ignore 'literal' for IN
|
// Ignore 'literal' for IN
|
||||||
if (op.compare("IN", Qt::CaseInsensitive) == 0) {
|
if (op.compare("IN", Qt::CaseInsensitive) == 0) {
|
||||||
QStringList values = value.toStringList();
|
QStringList values = value.toStringList();
|
||||||
QStringList final;
|
QStringList final_values;
|
||||||
final.reserve(values.count());
|
final_values.reserve(values.count());
|
||||||
for (const QString &single_value : values) {
|
for (const QString &single_value : values) {
|
||||||
final.append("?");
|
final_values.append("?");
|
||||||
bound_values_ << single_value;
|
bound_values_ << single_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
where_clauses_ << QString("%1 IN (" + final.join(",") + ")").arg(column);
|
where_clauses_ << QString("%1 IN (" + final_values.join(",") + ")").arg(column);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Do integers inline - sqlite seems to get confused when you pass integers to bound parameters
|
// Do integers inline - sqlite seems to get confused when you pass integers to bound parameters
|
||||||
@@ -187,6 +178,15 @@ void CollectionQuery::AddCompilationRequirement(const bool compilation) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CollectionQuery::GetInnerQuery() const {
|
||||||
|
return duplicates_only_
|
||||||
|
? QString(" INNER JOIN (select * from duplicated_songs) dsongs "
|
||||||
|
"ON (%songs_table.artist = dsongs.dup_artist "
|
||||||
|
"AND %songs_table.album = dsongs.dup_album "
|
||||||
|
"AND %songs_table.title = dsongs.dup_title) ")
|
||||||
|
: QString();
|
||||||
|
}
|
||||||
|
|
||||||
bool CollectionQuery::Exec() {
|
bool CollectionQuery::Exec() {
|
||||||
|
|
||||||
QString sql;
|
QString sql;
|
||||||
@@ -213,32 +213,17 @@ bool CollectionQuery::Exec() {
|
|||||||
sql.replace("%fts_table_noprefix", fts_table_.section('.', -1, -1));
|
sql.replace("%fts_table_noprefix", fts_table_.section('.', -1, -1));
|
||||||
sql.replace("%fts_table", fts_table_);
|
sql.replace("%fts_table", fts_table_);
|
||||||
|
|
||||||
prepare(sql);
|
QSqlQuery::prepare(sql);
|
||||||
|
|
||||||
// Bind values
|
// Bind values
|
||||||
for (const QVariant &value : bound_values_) {
|
for (const QVariant &value : bound_values_) {
|
||||||
addBindValue(value);
|
QSqlQuery::addBindValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return exec();
|
return QSqlQuery::exec();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CollectionQuery::Next() { return next(); }
|
bool CollectionQuery::Next() { return QSqlQuery::next(); }
|
||||||
|
|
||||||
QVariant CollectionQuery::Value(const int column) const { return value(column); }
|
QVariant CollectionQuery::Value(const int column) const { return QSqlQuery::value(column); }
|
||||||
|
|
||||||
bool QueryOptions::Matches(const Song &song) const {
|
|
||||||
|
|
||||||
if (max_age_ != -1) {
|
|
||||||
const qint64 cutoff = QDateTime::currentDateTime().toSecsSinceEpoch() - max_age_;
|
|
||||||
if (song.ctime() <= cutoff) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!filter_.isNull()) {
|
|
||||||
return song.artist().contains(filter_, Qt::CaseInsensitive) || song.album().contains(filter_, Qt::CaseInsensitive) || song.title().contains(filter_, Qt::CaseInsensitive);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -28,75 +28,23 @@
|
|||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QMap>
|
|
||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
#include <QSqlQuery>
|
#include <QSqlQuery>
|
||||||
|
|
||||||
class Song;
|
#include "collectionfilteroptions.h"
|
||||||
|
#include "collectionqueryoptions.h"
|
||||||
// This structure let's you customize behaviour of any CollectionQuery.
|
|
||||||
struct QueryOptions {
|
|
||||||
// Modes of CollectionQuery:
|
|
||||||
// - use the all songs table
|
|
||||||
// - use the duplicated songs view; by duplicated we mean those songs for which the (artist, album, title) tuple is found more than once in the songs table
|
|
||||||
// - use the untagged songs view; by untagged we mean those for which at least one of the (artist, album, title) tags is empty
|
|
||||||
// Please note that additional filtering based on FTS table (the filter attribute) won't work in Duplicates and Untagged modes.
|
|
||||||
enum QueryMode {
|
|
||||||
QueryMode_All,
|
|
||||||
QueryMode_Duplicates,
|
|
||||||
QueryMode_Untagged
|
|
||||||
};
|
|
||||||
|
|
||||||
QueryOptions();
|
|
||||||
|
|
||||||
bool Matches(const Song &song) const;
|
|
||||||
|
|
||||||
QString filter() const { return filter_; }
|
|
||||||
void set_filter(const QString &filter) {
|
|
||||||
filter_ = filter;
|
|
||||||
query_mode_ = QueryMode_All;
|
|
||||||
}
|
|
||||||
|
|
||||||
int max_age() const { return max_age_; }
|
|
||||||
void set_max_age(int max_age) { max_age_ = max_age; }
|
|
||||||
|
|
||||||
QueryMode query_mode() const { return query_mode_; }
|
|
||||||
void set_query_mode(QueryMode query_mode) {
|
|
||||||
query_mode_ = query_mode;
|
|
||||||
filter_ = QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
QString filter_;
|
|
||||||
int max_age_;
|
|
||||||
QueryMode query_mode_;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CollectionQuery : public QSqlQuery {
|
class CollectionQuery : public QSqlQuery {
|
||||||
public:
|
public:
|
||||||
explicit CollectionQuery(const QSqlDatabase &db, const QString &songs_table, const QString &fts_table, const QueryOptions &options = QueryOptions());
|
explicit CollectionQuery(const QSqlDatabase &db, const QString &songs_table, const QString &fts_table, const CollectionFilterOptions &filter_options = CollectionFilterOptions());
|
||||||
|
|
||||||
// Sets contents of SELECT clause on the query (list of columns to get).
|
QVariant Value(const int column) const;
|
||||||
void SetColumnSpec(const QString &spec) { column_spec_ = spec; }
|
QVariant value(const int column) const { return Value(column); }
|
||||||
|
|
||||||
// Sets an ORDER BY clause on the query.
|
|
||||||
void SetOrderBy(const QString &order_by) { order_by_ = order_by; }
|
|
||||||
|
|
||||||
// Adds a fragment of WHERE clause. When executed, this Query will connect all the fragments with AND operator.
|
|
||||||
// Please note that IN operator expects a QStringList as value.
|
|
||||||
void AddWhere(const QString &column, const QVariant &value, const QString &op = "=");
|
|
||||||
void AddWhereArtist(const QVariant &value);
|
|
||||||
|
|
||||||
void SetWhereClauses(const QStringList &where_clauses) { where_clauses_ = where_clauses; }
|
|
||||||
void SetBoundValues(const QVariantList &bound_values) { bound_values_ = bound_values; }
|
|
||||||
void SetDuplicatesOnly(const bool duplicates_only) { duplicates_only_ = duplicates_only; }
|
|
||||||
void SetIncludeUnavailable(const bool include_unavailable) { include_unavailable_ = include_unavailable; }
|
|
||||||
void SetLimit(const int limit) { limit_ = limit; }
|
|
||||||
void AddCompilationRequirement(const bool compilation);
|
|
||||||
|
|
||||||
bool Exec();
|
bool Exec();
|
||||||
|
bool exec() { return QSqlQuery::exec(); }
|
||||||
|
|
||||||
bool Next();
|
bool Next();
|
||||||
QVariant Value(const int column) const;
|
|
||||||
|
|
||||||
QString column_spec() const { return column_spec_; }
|
QString column_spec() const { return column_spec_; }
|
||||||
QString order_by() const { return order_by_; }
|
QString order_by() const { return order_by_; }
|
||||||
@@ -107,6 +55,24 @@ class CollectionQuery : public QSqlQuery {
|
|||||||
bool duplicates_only() const { return duplicates_only_; }
|
bool duplicates_only() const { return duplicates_only_; }
|
||||||
int limit() const { return limit_; }
|
int limit() const { return limit_; }
|
||||||
|
|
||||||
|
// Sets contents of SELECT clause on the query (list of columns to get).
|
||||||
|
void SetColumnSpec(const QString &column_spec) { column_spec_ = column_spec; }
|
||||||
|
|
||||||
|
// Sets an ORDER BY clause on the query.
|
||||||
|
void SetOrderBy(const QString &order_by) { order_by_ = order_by; }
|
||||||
|
|
||||||
|
void SetWhereClauses(const QStringList &where_clauses) { where_clauses_ = where_clauses; }
|
||||||
|
// Adds a fragment of WHERE clause. When executed, this Query will connect all the fragments with AND operator.
|
||||||
|
// Please note that IN operator expects a QStringList as value.
|
||||||
|
void AddWhere(const QString &column, const QVariant &value, const QString &op = "=");
|
||||||
|
void AddWhereArtist(const QVariant &value);
|
||||||
|
|
||||||
|
void SetBoundValues(const QVariantList &bound_values) { bound_values_ = bound_values; }
|
||||||
|
void SetDuplicatesOnly(const bool duplicates_only) { duplicates_only_ = duplicates_only; }
|
||||||
|
void SetIncludeUnavailable(const bool include_unavailable) { include_unavailable_ = include_unavailable; }
|
||||||
|
void SetLimit(const int limit) { limit_ = limit; }
|
||||||
|
void AddCompilationRequirement(const bool compilation);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString GetInnerQuery() const;
|
QString GetInnerQuery() const;
|
||||||
|
|
||||||
|
|||||||
34
src/collection/collectionqueryoptions.cpp
Normal file
34
src/collection/collectionqueryoptions.cpp
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Strawberry Music Player
|
||||||
|
* Copyright 2023, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
|
*
|
||||||
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QVariant>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
#include "collectionqueryoptions.h"
|
||||||
|
#include "collectionfilteroptions.h"
|
||||||
|
|
||||||
|
CollectionQueryOptions::CollectionQueryOptions()
|
||||||
|
: compilation_requirement_(false),
|
||||||
|
query_have_compilations_(false) {}
|
||||||
|
|
||||||
|
void CollectionQueryOptions::AddWhere(const QString &column, const QVariant &value, const QString &op) {
|
||||||
|
|
||||||
|
where_clauses_ << Where(column, value, op);
|
||||||
|
|
||||||
|
}
|
||||||
57
src/collection/collectionqueryoptions.h
Normal file
57
src/collection/collectionqueryoptions.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* Strawberry Music Player
|
||||||
|
* Copyright 2023, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
|
*
|
||||||
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef COLLECTIONQUERYOPTIONS_H
|
||||||
|
#define COLLECTIONQUERYOPTIONS_H
|
||||||
|
|
||||||
|
#include <QList>
|
||||||
|
#include <QVariant>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class CollectionQueryOptions {
|
||||||
|
public:
|
||||||
|
|
||||||
|
explicit CollectionQueryOptions();
|
||||||
|
|
||||||
|
struct Where {
|
||||||
|
explicit Where(const QString _column = QString(), const QVariant _value = QString(), const QString _op = QString()) : column(_column), value(_value), op(_op) {}
|
||||||
|
QString column;
|
||||||
|
QVariant value;
|
||||||
|
QString op;
|
||||||
|
};
|
||||||
|
|
||||||
|
QString column_spec() const { return column_spec_; }
|
||||||
|
bool compilation_requirement() const { return compilation_requirement_; }
|
||||||
|
bool query_have_compilations() const { return query_have_compilations_; }
|
||||||
|
|
||||||
|
void set_column_spec(const QString &column_spec) { column_spec_ = column_spec; }
|
||||||
|
void set_compilation_requirement(const bool compilation_requirement) { compilation_requirement_ = compilation_requirement; }
|
||||||
|
void set_query_have_compilations(const bool query_have_compilations) { query_have_compilations_ = query_have_compilations; }
|
||||||
|
|
||||||
|
QList<Where> where_clauses() const { return where_clauses_; }
|
||||||
|
void AddWhere(const QString &column, const QVariant &value, const QString &op = "=");
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString column_spec_;
|
||||||
|
bool compilation_requirement_;
|
||||||
|
bool query_have_compilations_;
|
||||||
|
QList<Where> where_clauses_;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COLLECTIONQUERYOPTIONS_H
|
||||||
@@ -50,9 +50,9 @@
|
|||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "core/iconloader.h"
|
#include "core/iconloader.h"
|
||||||
#include "core/mimedata.h"
|
#include "core/mimedata.h"
|
||||||
#include "core/utilities.h"
|
|
||||||
#include "core/musicstorage.h"
|
#include "core/musicstorage.h"
|
||||||
#include "core/deletefiles.h"
|
#include "core/deletefiles.h"
|
||||||
|
#include "utilities/filemanagerutils.h"
|
||||||
#include "collection.h"
|
#include "collection.h"
|
||||||
#include "collectionbackend.h"
|
#include "collectionbackend.h"
|
||||||
#include "collectiondirectorymodel.h"
|
#include "collectiondirectorymodel.h"
|
||||||
|
|||||||
@@ -38,21 +38,19 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QVariant>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
#include "core/filesystemwatcherinterface.h"
|
#include "core/filesystemwatcherinterface.h"
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "core/timeconstants.h"
|
|
||||||
#include "core/tagreaderclient.h"
|
#include "core/tagreaderclient.h"
|
||||||
#include "core/taskmanager.h"
|
#include "core/taskmanager.h"
|
||||||
#include "core/imageutils.h"
|
#include "utilities/imageutils.h"
|
||||||
#include "directory.h"
|
#include "utilities/timeconstants.h"
|
||||||
|
#include "collectiondirectory.h"
|
||||||
#include "collectionbackend.h"
|
#include "collectionbackend.h"
|
||||||
#include "collectionwatcher.h"
|
#include "collectionwatcher.h"
|
||||||
#include "playlistparsers/cueparser.h"
|
#include "playlistparsers/cueparser.h"
|
||||||
@@ -169,15 +167,15 @@ void CollectionWatcher::ReloadSettings() {
|
|||||||
}
|
}
|
||||||
else if (monitor_ && !was_monitoring_before) {
|
else if (monitor_ && !was_monitoring_before) {
|
||||||
// Add all directories to all QFileSystemWatchers again
|
// Add all directories to all QFileSystemWatchers again
|
||||||
for (const Directory &dir : std::as_const(watched_dirs_)) {
|
for (const CollectionDirectory &dir : std::as_const(watched_dirs_)) {
|
||||||
SubdirectoryList subdirs = backend_->SubdirsInDirectory(dir.id);
|
CollectionSubdirectoryList subdirs = backend_->SubdirsInDirectory(dir.id);
|
||||||
for (const Subdirectory &subdir : subdirs) {
|
for (const CollectionSubdirectory &subdir : subdirs) {
|
||||||
AddWatch(dir, subdir.path);
|
AddWatch(dir, subdir.path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mark_songs_unavailable_ && !periodic_scan_timer_->isActive()) {
|
if (monitor_ && scan_on_startup_ && mark_songs_unavailable_ && !periodic_scan_timer_->isActive()) {
|
||||||
periodic_scan_timer_->start();
|
periodic_scan_timer_->start();
|
||||||
}
|
}
|
||||||
else if (!mark_songs_unavailable_ && periodic_scan_timer_->isActive()) {
|
else if (!mark_songs_unavailable_ && periodic_scan_timer_->isActive()) {
|
||||||
@@ -274,7 +272,7 @@ void CollectionWatcher::ScanTransaction::CommitNewOrUpdatedSongs() {
|
|||||||
touched_subdirs.clear();
|
touched_subdirs.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const Subdirectory &subdir : deleted_subdirs) {
|
for (const CollectionSubdirectory &subdir : deleted_subdirs) {
|
||||||
if (watcher_->watched_dirs_.contains(dir_)) {
|
if (watcher_->watched_dirs_.contains(dir_)) {
|
||||||
watcher_->RemoveWatch(watcher_->watched_dirs_[dir_], subdir);
|
watcher_->RemoveWatch(watcher_->watched_dirs_[dir_], subdir);
|
||||||
}
|
}
|
||||||
@@ -283,7 +281,7 @@ void CollectionWatcher::ScanTransaction::CommitNewOrUpdatedSongs() {
|
|||||||
|
|
||||||
if (watcher_->monitor_) {
|
if (watcher_->monitor_) {
|
||||||
// Watch the new subdirectories
|
// Watch the new subdirectories
|
||||||
for (const Subdirectory &subdir : new_subdirs) {
|
for (const CollectionSubdirectory &subdir : new_subdirs) {
|
||||||
if (watcher_->watched_dirs_.contains(dir_)) {
|
if (watcher_->watched_dirs_.contains(dir_)) {
|
||||||
watcher_->AddWatch(watcher_->watched_dirs_[dir_], subdir.path);
|
watcher_->AddWatch(watcher_->watched_dirs_[dir_], subdir.path);
|
||||||
}
|
}
|
||||||
@@ -331,7 +329,7 @@ bool CollectionWatcher::ScanTransaction::HasSongsWithMissingFingerprint(const QS
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionWatcher::ScanTransaction::SetKnownSubdirs(const SubdirectoryList &subdirs) {
|
void CollectionWatcher::ScanTransaction::SetKnownSubdirs(const CollectionSubdirectoryList &subdirs) {
|
||||||
|
|
||||||
known_subdirs_ = subdirs;
|
known_subdirs_ = subdirs;
|
||||||
known_subdirs_dirty_ = false;
|
known_subdirs_dirty_ = false;
|
||||||
@@ -344,18 +342,18 @@ bool CollectionWatcher::ScanTransaction::HasSeenSubdir(const QString &path) {
|
|||||||
SetKnownSubdirs(watcher_->backend_->SubdirsInDirectory(dir_));
|
SetKnownSubdirs(watcher_->backend_->SubdirsInDirectory(dir_));
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::any_of(known_subdirs_.begin(), known_subdirs_.end(), [path](const Subdirectory &subdir) { return subdir.path == path && subdir.mtime != 0; });
|
return std::any_of(known_subdirs_.begin(), known_subdirs_.end(), [path](const CollectionSubdirectory &subdir) { return subdir.path == path && subdir.mtime != 0; });
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SubdirectoryList CollectionWatcher::ScanTransaction::GetImmediateSubdirs(const QString &path) {
|
CollectionSubdirectoryList CollectionWatcher::ScanTransaction::GetImmediateSubdirs(const QString &path) {
|
||||||
|
|
||||||
if (known_subdirs_dirty_) {
|
if (known_subdirs_dirty_) {
|
||||||
SetKnownSubdirs(watcher_->backend_->SubdirsInDirectory(dir_));
|
SetKnownSubdirs(watcher_->backend_->SubdirsInDirectory(dir_));
|
||||||
}
|
}
|
||||||
|
|
||||||
SubdirectoryList ret;
|
CollectionSubdirectoryList ret;
|
||||||
for (const Subdirectory &subdir : known_subdirs_) {
|
for (const CollectionSubdirectory &subdir : known_subdirs_) {
|
||||||
if (subdir.path.left(subdir.path.lastIndexOf(QDir::separator())) == path && subdir.mtime != 0) {
|
if (subdir.path.left(subdir.path.lastIndexOf(QDir::separator())) == path && subdir.mtime != 0) {
|
||||||
ret << subdir;
|
ret << subdir;
|
||||||
}
|
}
|
||||||
@@ -365,7 +363,7 @@ SubdirectoryList CollectionWatcher::ScanTransaction::GetImmediateSubdirs(const Q
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SubdirectoryList CollectionWatcher::ScanTransaction::GetAllSubdirs() {
|
CollectionSubdirectoryList CollectionWatcher::ScanTransaction::GetAllSubdirs() {
|
||||||
|
|
||||||
if (known_subdirs_dirty_) {
|
if (known_subdirs_dirty_) {
|
||||||
SetKnownSubdirs(watcher_->backend_->SubdirsInDirectory(dir_));
|
SetKnownSubdirs(watcher_->backend_->SubdirsInDirectory(dir_));
|
||||||
@@ -375,7 +373,7 @@ SubdirectoryList CollectionWatcher::ScanTransaction::GetAllSubdirs() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionWatcher::AddDirectory(const Directory &dir, const SubdirectoryList &subdirs) {
|
void CollectionWatcher::AddDirectory(const CollectionDirectory &dir, const CollectionSubdirectoryList &subdirs) {
|
||||||
|
|
||||||
stop_requested_ = false;
|
stop_requested_ = false;
|
||||||
|
|
||||||
@@ -387,7 +385,7 @@ void CollectionWatcher::AddDirectory(const Directory &dir, const SubdirectoryLis
|
|||||||
const quint64 files_count = FilesCountForPath(&transaction, dir.path);
|
const quint64 files_count = FilesCountForPath(&transaction, dir.path);
|
||||||
transaction.SetKnownSubdirs(subdirs);
|
transaction.SetKnownSubdirs(subdirs);
|
||||||
transaction.AddToProgressMax(files_count);
|
transaction.AddToProgressMax(files_count);
|
||||||
ScanSubdirectory(dir.path, Subdirectory(), files_count, &transaction);
|
ScanSubdirectory(dir.path, CollectionSubdirectory(), files_count, &transaction);
|
||||||
last_scan_time_ = QDateTime::currentDateTime().toSecsSinceEpoch();
|
last_scan_time_ = QDateTime::currentDateTime().toSecsSinceEpoch();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -397,7 +395,7 @@ void CollectionWatcher::AddDirectory(const Directory &dir, const SubdirectoryLis
|
|||||||
const quint64 files_count = FilesCountForSubdirs(&transaction, subdirs, subdir_files_count);
|
const quint64 files_count = FilesCountForSubdirs(&transaction, subdirs, subdir_files_count);
|
||||||
transaction.SetKnownSubdirs(subdirs);
|
transaction.SetKnownSubdirs(subdirs);
|
||||||
transaction.AddToProgressMax(files_count);
|
transaction.AddToProgressMax(files_count);
|
||||||
for (const Subdirectory &subdir : subdirs) {
|
for (const CollectionSubdirectory &subdir : subdirs) {
|
||||||
if (stop_requested_ || abort_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);
|
||||||
@@ -413,14 +411,14 @@ 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 CollectionSubdirectory &subdir, const quint64 files_count, ScanTransaction *t, const bool force_noincremental) {
|
||||||
|
|
||||||
QFileInfo path_info(path);
|
QFileInfo path_info(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()) {
|
||||||
QString real_path = path_info.symLinkTarget();
|
QString real_path = path_info.symLinkTarget();
|
||||||
for (const Directory &dir : std::as_const(watched_dirs_)) {
|
for (const CollectionDirectory &dir : std::as_const(watched_dirs_)) {
|
||||||
if (real_path.startsWith(dir.path)) {
|
if (real_path.startsWith(dir.path)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -442,12 +440,12 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
|
|
||||||
QMap<QString, QStringList> album_art;
|
QMap<QString, QStringList> album_art;
|
||||||
QStringList files_on_disk;
|
QStringList files_on_disk;
|
||||||
SubdirectoryList my_new_subdirs;
|
CollectionSubdirectoryList my_new_subdirs;
|
||||||
|
|
||||||
// If a directory is moved then only its parent gets a changed notification, so we need to look and see if any of our children don't exist any more.
|
// If a directory is moved then only its parent gets a changed notification, so we need to look and see if any of our children don't exist anymore.
|
||||||
// If one has been removed, "rescan" it to get the deleted songs
|
// If one has been removed, "rescan" it to get the deleted songs
|
||||||
SubdirectoryList previous_subdirs = t->GetImmediateSubdirs(path);
|
CollectionSubdirectoryList previous_subdirs = t->GetImmediateSubdirs(path);
|
||||||
for (const Subdirectory &prev_subdir : previous_subdirs) {
|
for (const CollectionSubdirectory &prev_subdir : previous_subdirs) {
|
||||||
if (!QFile::exists(prev_subdir.path) && prev_subdir.path != path) {
|
if (!QFile::exists(prev_subdir.path) && prev_subdir.path != path) {
|
||||||
ScanSubdirectory(prev_subdir.path, prev_subdir, 0, t, true);
|
ScanSubdirectory(prev_subdir.path, prev_subdir, 0, t, true);
|
||||||
}
|
}
|
||||||
@@ -464,8 +462,8 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
|
|
||||||
if (child_info.isDir()) {
|
if (child_info.isDir()) {
|
||||||
if (!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;
|
CollectionSubdirectory new_subdir;
|
||||||
new_subdir.directory_id = -1;
|
new_subdir.directory_id = -1;
|
||||||
new_subdir.path = child;
|
new_subdir.path = child;
|
||||||
new_subdir.mtime = child_info.lastModified().toSecsSinceEpoch();
|
new_subdir.mtime = child_info.lastModified().toSecsSinceEpoch();
|
||||||
@@ -678,7 +676,7 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add this subdir to the new or touched list
|
// Add this subdir to the new or touched list
|
||||||
Subdirectory updated_subdir;
|
CollectionSubdirectory updated_subdir;
|
||||||
updated_subdir.directory_id = t->dir();
|
updated_subdir.directory_id = t->dir();
|
||||||
updated_subdir.mtime = path_info.exists() ? path_info.lastModified().toSecsSinceEpoch() : 0;
|
updated_subdir.mtime = path_info.exists() ? path_info.lastModified().toSecsSinceEpoch() : 0;
|
||||||
updated_subdir.path = path;
|
updated_subdir.path = path;
|
||||||
@@ -690,12 +688,12 @@ void CollectionWatcher::ScanSubdirectory(const QString &path, const Subdirectory
|
|||||||
t->touched_subdirs << updated_subdir;
|
t->touched_subdirs << updated_subdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updated_subdir.mtime == 0) { // Subdirectory deleted, mark it for removal from the watcher.
|
if (updated_subdir.mtime == 0) { // CollectionSubdirectory deleted, mark it for removal from the watcher.
|
||||||
t->deleted_subdirs << updated_subdir;
|
t->deleted_subdirs << updated_subdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 CollectionSubdirectory &my_new_subdir : my_new_subdirs) {
|
||||||
if (stop_requested_ || abort_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);
|
||||||
}
|
}
|
||||||
@@ -761,7 +759,7 @@ void CollectionWatcher::UpdateNonCueAssociatedSong(const QString &file,
|
|||||||
const bool cue_deleted,
|
const bool cue_deleted,
|
||||||
ScanTransaction *t) {
|
ScanTransaction *t) {
|
||||||
|
|
||||||
// If a CUE got deleted, we turn it's first section into the new 'raw' (cueless) song and we just remove the rest of the sections from the collection
|
// If a CUE got deleted, we turn it's first section into the new 'raw' (cueless) song, and we just remove the rest of the sections from the collection
|
||||||
const Song &matching_song = matching_songs.first();
|
const Song &matching_song = matching_songs.first();
|
||||||
if (cue_deleted) {
|
if (cue_deleted) {
|
||||||
for (const Song &song : matching_songs) {
|
for (const Song &song : matching_songs) {
|
||||||
@@ -805,7 +803,7 @@ SongList CollectionWatcher::ScanNewFile(const QString &file, const QString &path
|
|||||||
|
|
||||||
// Ignore FILEs pointing to other media files.
|
// Ignore FILEs pointing to other media files.
|
||||||
// Also, watch out for incorrect media files.
|
// Also, watch out for incorrect media files.
|
||||||
// Playlist parser for CUEs considers every entry in sheet valid and we don't want invalid media getting into collection!
|
// Playlist parser for CUEs considers every entry in sheet valid, and we don't want invalid media getting into collection!
|
||||||
QString file_nfd = file.normalized(QString::NormalizationForm_D);
|
QString file_nfd = file.normalized(QString::NormalizationForm_D);
|
||||||
SongList cue_congs = cue_parser_->Load(&cue_file, matching_cue, path, false);
|
SongList cue_congs = cue_parser_->Load(&cue_file, matching_cue, path, false);
|
||||||
cue_file.close();
|
cue_file.close();
|
||||||
@@ -899,7 +897,7 @@ quint64 CollectionWatcher::GetMtimeForCue(const QString &cue_path) {
|
|||||||
return cue_last_modified.isValid() ? cue_last_modified.toSecsSinceEpoch() : 0;
|
return cue_last_modified.isValid() ? cue_last_modified.toSecsSinceEpoch() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionWatcher::AddWatch(const Directory &dir, const QString &path) {
|
void CollectionWatcher::AddWatch(const CollectionDirectory &dir, const QString &path) {
|
||||||
|
|
||||||
if (!QFile::exists(path)) return;
|
if (!QFile::exists(path)) return;
|
||||||
|
|
||||||
@@ -909,7 +907,7 @@ void CollectionWatcher::AddWatch(const Directory &dir, const QString &path) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionWatcher::RemoveWatch(const Directory &dir, const Subdirectory &subdir) {
|
void CollectionWatcher::RemoveWatch(const CollectionDirectory &dir, const CollectionSubdirectory &subdir) {
|
||||||
|
|
||||||
QStringList subdir_paths = subdir_mapping_.keys(dir);
|
QStringList subdir_paths = subdir_mapping_.keys(dir);
|
||||||
for (const QString &subdir_path : subdir_paths) {
|
for (const QString &subdir_path : subdir_paths) {
|
||||||
@@ -921,7 +919,7 @@ void CollectionWatcher::RemoveWatch(const Directory &dir, const Subdirectory &su
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CollectionWatcher::RemoveDirectory(const Directory &dir) {
|
void CollectionWatcher::RemoveDirectory(const CollectionDirectory &dir) {
|
||||||
|
|
||||||
rescan_queue_.remove(dir.id);
|
rescan_queue_.remove(dir.id);
|
||||||
watched_dirs_.remove(dir.id);
|
watched_dirs_.remove(dir.id);
|
||||||
@@ -981,11 +979,11 @@ bool CollectionWatcher::FindSongsByFingerprint(const QString &file, const SongLi
|
|||||||
void CollectionWatcher::DirectoryChanged(const QString &subdir) {
|
void CollectionWatcher::DirectoryChanged(const QString &subdir) {
|
||||||
|
|
||||||
// Find what dir it was in
|
// Find what dir it was in
|
||||||
QHash<QString, Directory>::const_iterator it = subdir_mapping_.constFind(subdir);
|
QHash<QString, CollectionDirectory>::const_iterator it = subdir_mapping_.constFind(subdir);
|
||||||
if (it == subdir_mapping_.constEnd()) {
|
if (it == subdir_mapping_.constEnd()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Directory dir = *it;
|
CollectionDirectory dir = *it;
|
||||||
|
|
||||||
qLog(Debug) << "Subdir" << subdir << "changed under directory" << dir.path << "id" << dir.id;
|
qLog(Debug) << "Subdir" << subdir << "changed under directory" << dir.path << "id" << dir.id;
|
||||||
|
|
||||||
@@ -1012,7 +1010,7 @@ void CollectionWatcher::RescanPathsNow() {
|
|||||||
|
|
||||||
for (const QString &path : rescan_queue_[dir]) {
|
for (const QString &path : rescan_queue_[dir]) {
|
||||||
if (stop_requested_ || abort_requested_) break;
|
if (stop_requested_ || abort_requested_) break;
|
||||||
Subdirectory subdir;
|
CollectionSubdirectory subdir;
|
||||||
subdir.directory_id = dir;
|
subdir.directory_id = dir;
|
||||||
subdir.mtime = 0;
|
subdir.mtime = 0;
|
||||||
subdir.path = path;
|
subdir.path = path;
|
||||||
@@ -1156,7 +1154,7 @@ void CollectionWatcher::RescanTracksNow() {
|
|||||||
qLog(Debug) << "Song" << song.title() << "dir id" << song.directory_id() << "dir" << songdir;
|
qLog(Debug) << "Song" << song.title() << "dir id" << song.directory_id() << "dir" << songdir;
|
||||||
ScanTransaction transaction(this, song.directory_id(), false, false, mark_songs_unavailable_);
|
ScanTransaction transaction(this, song.directory_id(), false, false, mark_songs_unavailable_);
|
||||||
quint64 files_count = FilesCountForPath(&transaction, songdir);
|
quint64 files_count = FilesCountForPath(&transaction, songdir);
|
||||||
ScanSubdirectory(songdir, Subdirectory(), files_count, &transaction);
|
ScanSubdirectory(songdir, CollectionSubdirectory(), files_count, &transaction);
|
||||||
scanned_dirs << songdir;
|
scanned_dirs << songdir;
|
||||||
emit CompilationsNeedUpdating();
|
emit CompilationsNeedUpdating();
|
||||||
}
|
}
|
||||||
@@ -1173,16 +1171,16 @@ void CollectionWatcher::PerformScan(const bool incremental, const bool ignore_mt
|
|||||||
|
|
||||||
stop_requested_ = false;
|
stop_requested_ = false;
|
||||||
|
|
||||||
for (const Directory &dir : std::as_const(watched_dirs_)) {
|
for (const CollectionDirectory &dir : std::as_const(watched_dirs_)) {
|
||||||
|
|
||||||
if (stop_requested_ || abort_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());
|
CollectionSubdirectoryList subdirs(transaction.GetAllSubdirs());
|
||||||
|
|
||||||
if (subdirs.isEmpty()) {
|
if (subdirs.isEmpty()) {
|
||||||
qLog(Debug) << "Collection directory wasn't in subdir list.";
|
qLog(Debug) << "Collection directory wasn't in subdir list.";
|
||||||
Subdirectory subdir;
|
CollectionSubdirectory subdir;
|
||||||
subdir.path = dir.path;
|
subdir.path = dir.path;
|
||||||
subdir.directory_id = dir.id;
|
subdir.directory_id = dir.id;
|
||||||
subdirs << subdir;
|
subdirs << subdir;
|
||||||
@@ -1192,7 +1190,7 @@ void CollectionWatcher::PerformScan(const bool incremental, const bool ignore_mt
|
|||||||
quint64 files_count = FilesCountForSubdirs(&transaction, subdirs, subdir_files_count);
|
quint64 files_count = FilesCountForSubdirs(&transaction, subdirs, subdir_files_count);
|
||||||
transaction.AddToProgressMax(files_count);
|
transaction.AddToProgressMax(files_count);
|
||||||
|
|
||||||
for (const Subdirectory &subdir : subdirs) {
|
for (const CollectionSubdirectory &subdir : subdirs) {
|
||||||
if (stop_requested_ || abort_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);
|
||||||
}
|
}
|
||||||
@@ -1219,7 +1217,7 @@ quint64 CollectionWatcher::FilesCountForPath(ScanTransaction *t, const QString &
|
|||||||
if (path_info.isDir()) {
|
if (path_info.isDir()) {
|
||||||
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 CollectionDirectory &dir : std::as_const(watched_dirs_)) {
|
||||||
if (real_path.startsWith(dir.path)) {
|
if (real_path.startsWith(dir.path)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1241,10 +1239,10 @@ quint64 CollectionWatcher::FilesCountForPath(ScanTransaction *t, const QString &
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 CollectionWatcher::FilesCountForSubdirs(ScanTransaction *t, const SubdirectoryList &subdirs, QMap<QString, quint64> &subdir_files_count) {
|
quint64 CollectionWatcher::FilesCountForSubdirs(ScanTransaction *t, const CollectionSubdirectoryList &subdirs, QMap<QString, quint64> &subdir_files_count) {
|
||||||
|
|
||||||
quint64 i = 0;
|
quint64 i = 0;
|
||||||
for (const Subdirectory &subdir : subdirs) {
|
for (const CollectionSubdirectory &subdir : subdirs) {
|
||||||
if (stop_requested_ || abort_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;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#include "directory.h"
|
#include "collectiondirectory.h"
|
||||||
#include "core/song.h"
|
#include "core/song.h"
|
||||||
|
|
||||||
class QThread;
|
class QThread;
|
||||||
@@ -74,8 +74,8 @@ class CollectionWatcher : public QObject {
|
|||||||
void SongsDeleted(SongList);
|
void SongsDeleted(SongList);
|
||||||
void SongsUnavailable(SongList songs, bool unavailable = true);
|
void SongsUnavailable(SongList songs, bool unavailable = true);
|
||||||
void SongsReadded(SongList songs, bool unavailable = false);
|
void SongsReadded(SongList songs, bool unavailable = false);
|
||||||
void SubdirsDiscovered(SubdirectoryList subdirs);
|
void SubdirsDiscovered(CollectionSubdirectoryList subdirs);
|
||||||
void SubdirsMTimeUpdated(SubdirectoryList subdirs);
|
void SubdirsMTimeUpdated(CollectionSubdirectoryList subdirs);
|
||||||
void CompilationsNeedUpdating();
|
void CompilationsNeedUpdating();
|
||||||
void UpdateLastSeen(int directory_id, int expire_unavailable_songs_days);
|
void UpdateLastSeen(int directory_id, int expire_unavailable_songs_days);
|
||||||
void ExitFinished();
|
void ExitFinished();
|
||||||
@@ -83,8 +83,8 @@ class CollectionWatcher : public QObject {
|
|||||||
void ScanStarted(int task_id);
|
void ScanStarted(int task_id);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void AddDirectory(const Directory &dir, const SubdirectoryList &subdirs);
|
void AddDirectory(const CollectionDirectory &dir, const CollectionSubdirectoryList &subdirs);
|
||||||
void RemoveDirectory(const Directory &dir);
|
void RemoveDirectory(const CollectionDirectory &dir);
|
||||||
void SetRescanPaused(bool pause);
|
void SetRescanPaused(bool pause);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -102,9 +102,9 @@ class CollectionWatcher : public QObject {
|
|||||||
SongList FindSongsInSubdirectory(const QString &path);
|
SongList FindSongsInSubdirectory(const QString &path);
|
||||||
bool HasSongsWithMissingFingerprint(const QString &path);
|
bool HasSongsWithMissingFingerprint(const QString &path);
|
||||||
bool HasSeenSubdir(const QString &path);
|
bool HasSeenSubdir(const QString &path);
|
||||||
void SetKnownSubdirs(const SubdirectoryList &subdirs);
|
void SetKnownSubdirs(const CollectionSubdirectoryList &subdirs);
|
||||||
SubdirectoryList GetImmediateSubdirs(const QString &path);
|
CollectionSubdirectoryList GetImmediateSubdirs(const QString &path);
|
||||||
SubdirectoryList GetAllSubdirs();
|
CollectionSubdirectoryList GetAllSubdirs();
|
||||||
|
|
||||||
void AddToProgress(const quint64 n = 1);
|
void AddToProgress(const quint64 n = 1);
|
||||||
void AddToProgressMax(const quint64 n);
|
void AddToProgressMax(const quint64 n);
|
||||||
@@ -120,9 +120,9 @@ class CollectionWatcher : public QObject {
|
|||||||
SongList readded_songs;
|
SongList readded_songs;
|
||||||
SongList new_songs;
|
SongList new_songs;
|
||||||
SongList touched_songs;
|
SongList touched_songs;
|
||||||
SubdirectoryList new_subdirs;
|
CollectionSubdirectoryList new_subdirs;
|
||||||
SubdirectoryList touched_subdirs;
|
CollectionSubdirectoryList touched_subdirs;
|
||||||
SubdirectoryList deleted_subdirs;
|
CollectionSubdirectoryList deleted_subdirs;
|
||||||
|
|
||||||
QStringList files_changed_path_;
|
QStringList files_changed_path_;
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ class CollectionWatcher : public QObject {
|
|||||||
QMultiMap<QString, Song> cached_songs_missing_fingerprint_;
|
QMultiMap<QString, Song> cached_songs_missing_fingerprint_;
|
||||||
bool cached_songs_missing_fingerprint_dirty_;
|
bool cached_songs_missing_fingerprint_dirty_;
|
||||||
|
|
||||||
SubdirectoryList known_subdirs_;
|
CollectionSubdirectoryList known_subdirs_;
|
||||||
bool known_subdirs_dirty_;
|
bool known_subdirs_dirty_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -168,7 +168,7 @@ class CollectionWatcher : public QObject {
|
|||||||
void FullScanNow();
|
void FullScanNow();
|
||||||
void RescanTracksNow();
|
void RescanTracksNow();
|
||||||
void RescanPathsNow();
|
void RescanPathsNow();
|
||||||
void ScanSubdirectory(const QString &path, const Subdirectory &subdir, const quint64 files_count, CollectionWatcher::ScanTransaction *t, const bool force_noincremental = false);
|
void ScanSubdirectory(const QString &path, const CollectionSubdirectory &subdir, const quint64 files_count, CollectionWatcher::ScanTransaction *t, const bool force_noincremental = false);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool FindSongsByPath(const SongList &songs, const QString &path, SongList *out);
|
static bool FindSongsByPath(const SongList &songs, const QString &path, SongList *out);
|
||||||
@@ -179,8 +179,8 @@ class CollectionWatcher : public QObject {
|
|||||||
inline static QString DirectoryPart(const QString &fileName);
|
inline static QString DirectoryPart(const QString &fileName);
|
||||||
QString PickBestImage(const QStringList &images);
|
QString PickBestImage(const QStringList &images);
|
||||||
QUrl ImageForSong(const QString &path, QMap<QString, QStringList> &album_art);
|
QUrl ImageForSong(const QString &path, QMap<QString, QStringList> &album_art);
|
||||||
void AddWatch(const Directory &dir, const QString &path);
|
void AddWatch(const CollectionDirectory &dir, const QString &path);
|
||||||
void RemoveWatch(const Directory &dir, const Subdirectory &subdir);
|
void RemoveWatch(const CollectionDirectory &dir, const CollectionSubdirectory &subdir);
|
||||||
static quint64 GetMtimeForCue(const QString &cue_path);
|
static quint64 GetMtimeForCue(const QString &cue_path);
|
||||||
void PerformScan(const bool incremental, const bool ignore_mtimes);
|
void PerformScan(const bool incremental, const bool ignore_mtimes);
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ class CollectionWatcher : public QObject {
|
|||||||
static void AddChangedSong(const QString &file, const Song &matching_song, const Song &new_song, ScanTransaction *t);
|
static void AddChangedSong(const QString &file, const Song &matching_song, const Song &new_song, ScanTransaction *t);
|
||||||
|
|
||||||
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 CollectionSubdirectoryList &subdirs, QMap<QString, quint64> &subdir_files_count);
|
||||||
|
|
||||||
QString FindCueFilename(const QString &filename);
|
QString FindCueFilename(const QString &filename);
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ class CollectionWatcher : public QObject {
|
|||||||
|
|
||||||
FileSystemWatcherInterface *fs_watcher_;
|
FileSystemWatcherInterface *fs_watcher_;
|
||||||
QThread *original_thread_;
|
QThread *original_thread_;
|
||||||
QHash<QString, Directory> subdir_mapping_;
|
QHash<QString, CollectionDirectory> subdir_mapping_;
|
||||||
|
|
||||||
// A list of words use to try to identify the (likely) best image found in an directory to use as cover artwork.
|
// A list of words use to try to identify the (likely) best image found in an directory to use as cover artwork.
|
||||||
// e.g. using ["front", "cover"] would identify front.jpg and exclude back.jpg.
|
// e.g. using ["front", "cover"] would identify front.jpg and exclude back.jpg.
|
||||||
@@ -225,7 +225,7 @@ class CollectionWatcher : public QObject {
|
|||||||
bool abort_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, CollectionDirectory> watched_dirs_;
|
||||||
QTimer *rescan_timer_;
|
QTimer *rescan_timer_;
|
||||||
QTimer *periodic_scan_timer_;
|
QTimer *periodic_scan_timer_;
|
||||||
QMap<int, QStringList> rescan_queue_; // dir id -> list of subdirs to be scanned
|
QMap<int, QStringList> rescan_queue_; // dir id -> list of subdirs to be scanned
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
* Strawberry Music Player
|
|
||||||
* This file was part of Clementine.
|
|
||||||
* Copyright 2010, David Sansome <me@davidsansome.com>
|
|
||||||
*
|
|
||||||
* Strawberry is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Strawberry is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef DIRECTORY_H
|
|
||||||
#define DIRECTORY_H
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <QMetaType>
|
|
||||||
#include <QList>
|
|
||||||
#include <QString>
|
|
||||||
#include <QSqlQuery>
|
|
||||||
|
|
||||||
struct Directory {
|
|
||||||
Directory() : id(-1) {}
|
|
||||||
|
|
||||||
bool operator==(const Directory &other) const {
|
|
||||||
return path == other.path && id == other.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString path;
|
|
||||||
int id;
|
|
||||||
};
|
|
||||||
Q_DECLARE_METATYPE(Directory)
|
|
||||||
|
|
||||||
typedef QList<Directory> DirectoryList;
|
|
||||||
Q_DECLARE_METATYPE(DirectoryList)
|
|
||||||
|
|
||||||
|
|
||||||
struct Subdirectory {
|
|
||||||
Subdirectory() : directory_id(-1), mtime(0) {}
|
|
||||||
|
|
||||||
int directory_id;
|
|
||||||
QString path;
|
|
||||||
qint64 mtime;
|
|
||||||
};
|
|
||||||
Q_DECLARE_METATYPE(Subdirectory)
|
|
||||||
|
|
||||||
typedef QList<Subdirectory> SubdirectoryList;
|
|
||||||
Q_DECLARE_METATYPE(SubdirectoryList)
|
|
||||||
|
|
||||||
#endif // DIRECTORY_H
|
|
||||||
|
|
||||||
|
|||||||
@@ -63,11 +63,7 @@ struct tag_group_by {};
|
|||||||
|
|
||||||
class GroupByDialogPrivate {
|
class GroupByDialogPrivate {
|
||||||
private:
|
private:
|
||||||
typedef multi_index_container<
|
using MappingContainer = multi_index_container<Mapping, indexed_by<ordered_unique<tag<tag_index>, member<Mapping, int, &Mapping::combo_box_index>>, ordered_unique<tag<tag_group_by>, member<Mapping, CollectionModel::GroupBy, &Mapping::group_by>>>>;
|
||||||
Mapping,
|
|
||||||
indexed_by<
|
|
||||||
ordered_unique<tag<tag_index>, member<Mapping, int, &Mapping::combo_box_index> >,
|
|
||||||
ordered_unique<tag<tag_group_by>, member<Mapping, CollectionModel::GroupBy, &Mapping::group_by> > > > MappingContainer;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MappingContainer mapping_;
|
MappingContainer mapping_;
|
||||||
@@ -108,22 +104,31 @@ GroupByDialog::GroupByDialog(QWidget *parent) : QDialog(parent), ui_(new Ui_Grou
|
|||||||
GroupByDialog::~GroupByDialog() = default;
|
GroupByDialog::~GroupByDialog() = default;
|
||||||
|
|
||||||
void GroupByDialog::Reset() {
|
void GroupByDialog::Reset() {
|
||||||
|
|
||||||
ui_->combobox_first->setCurrentIndex(2); // Album Artist
|
ui_->combobox_first->setCurrentIndex(2); // Album Artist
|
||||||
ui_->combobox_second->setCurrentIndex(3); // Album
|
ui_->combobox_second->setCurrentIndex(4); // Album Disc
|
||||||
ui_->combobox_third->setCurrentIndex(0); // None
|
ui_->combobox_third->setCurrentIndex(0); // None
|
||||||
|
ui_->checkbox_separate_albums_by_grouping->setChecked(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupByDialog::accept() {
|
void GroupByDialog::accept() {
|
||||||
|
|
||||||
emit Accepted(CollectionModel::Grouping(
|
emit Accepted(CollectionModel::Grouping(
|
||||||
p_->mapping_.get<tag_index>().find(ui_->combobox_first->currentIndex())->group_by,
|
p_->mapping_.get<tag_index>().find(ui_->combobox_first->currentIndex())->group_by,
|
||||||
p_->mapping_.get<tag_index>().find(ui_->combobox_second->currentIndex())->group_by,
|
p_->mapping_.get<tag_index>().find(ui_->combobox_second->currentIndex())->group_by,
|
||||||
p_->mapping_.get<tag_index>().find(ui_->combobox_third->currentIndex())->group_by)
|
p_->mapping_.get<tag_index>().find(ui_->combobox_third->currentIndex())->group_by),
|
||||||
|
ui_->checkbox_separate_albums_by_grouping->isChecked()
|
||||||
);
|
);
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupByDialog::CollectionGroupingChanged(const CollectionModel::Grouping g) {
|
void GroupByDialog::CollectionGroupingChanged(const CollectionModel::Grouping g, const bool separate_albums_by_grouping) {
|
||||||
|
|
||||||
ui_->combobox_first->setCurrentIndex(p_->mapping_.get<tag_group_by>().find(g[0])->combo_box_index);
|
ui_->combobox_first->setCurrentIndex(p_->mapping_.get<tag_group_by>().find(g[0])->combo_box_index);
|
||||||
ui_->combobox_second->setCurrentIndex(p_->mapping_.get<tag_group_by>().find(g[1])->combo_box_index);
|
ui_->combobox_second->setCurrentIndex(p_->mapping_.get<tag_group_by>().find(g[1])->combo_box_index);
|
||||||
ui_->combobox_third->setCurrentIndex(p_->mapping_.get<tag_group_by>().find(g[2])->combo_box_index);
|
ui_->combobox_third->setCurrentIndex(p_->mapping_.get<tag_group_by>().find(g[2])->combo_box_index);
|
||||||
|
ui_->checkbox_separate_albums_by_grouping->setChecked(separate_albums_by_grouping);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,11 +45,11 @@ class GroupByDialog : public QDialog {
|
|||||||
~GroupByDialog() override;
|
~GroupByDialog() override;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void CollectionGroupingChanged(const CollectionModel::Grouping g);
|
void CollectionGroupingChanged(const CollectionModel::Grouping g, const bool separate_albums_by_grouping);
|
||||||
void accept() override;
|
void accept() override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void Accepted(CollectionModel::Grouping g);
|
void Accepted(CollectionModel::Grouping g, bool separate_albums_by_grouping);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void Reset();
|
void Reset();
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>354</width>
|
<width>394</width>
|
||||||
<height>246</height>
|
<height>273</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -370,6 +370,13 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkbox_separate_albums_by_grouping">
|
||||||
|
<property name="text">
|
||||||
|
<string>Separate albums by grouping tag</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="spacer_bottom">
|
<spacer name="spacer_bottom">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* Strawberry Music Player
|
* Strawberry Music Player
|
||||||
* This file was part of Clementine.
|
* This file was part of Clementine.
|
||||||
* Copyright 2015, Nick Lanham <nick@afternight.org>
|
* Copyright 2015, Nick Lanham <nick@afternight.org>
|
||||||
* Copyright 2019-2021, Jonas Kvinge <jonas@jkvinge.net>
|
* Copyright 2019-2022, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -22,35 +22,31 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QWidget>
|
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QItemSelectionModel>
|
#include <QItemSelectionModel>
|
||||||
#include <QAbstractItemModel>
|
|
||||||
#include <QIODevice>
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QByteArray>
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QVariant>
|
#include <QByteArray>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
#include <QIODevice>
|
||||||
|
#include <QDataStream>
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QTreeView>
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "core/iconloader.h"
|
#include "core/iconloader.h"
|
||||||
#include "collectionfilterwidget.h"
|
|
||||||
#include "collectionmodel.h"
|
#include "collectionmodel.h"
|
||||||
#include "savedgroupingmanager.h"
|
#include "savedgroupingmanager.h"
|
||||||
#include "ui_savedgroupingmanager.h"
|
#include "ui_savedgroupingmanager.h"
|
||||||
|
|
||||||
SavedGroupingManager::SavedGroupingManager(QWidget *parent)
|
const char *SavedGroupingManager::kSavedGroupingsSettingsGroup = "SavedGroupings";
|
||||||
|
|
||||||
|
SavedGroupingManager::SavedGroupingManager(const QString &saved_groupings_settings_group, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
ui_(new Ui_SavedGroupingManager),
|
ui_(new Ui_SavedGroupingManager),
|
||||||
model_(new QStandardItemModel(0, 4, this)),
|
model_(new QStandardItemModel(0, 4, this)),
|
||||||
filter_(nullptr) {
|
saved_groupings_settings_group_(saved_groupings_settings_group) {
|
||||||
|
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
|
|
||||||
@@ -71,7 +67,17 @@ SavedGroupingManager::SavedGroupingManager(QWidget *parent)
|
|||||||
|
|
||||||
SavedGroupingManager::~SavedGroupingManager() {
|
SavedGroupingManager::~SavedGroupingManager() {
|
||||||
delete ui_;
|
delete ui_;
|
||||||
delete model_;
|
}
|
||||||
|
|
||||||
|
QString SavedGroupingManager::GetSavedGroupingsSettingsGroup(const QString &settings_group) {
|
||||||
|
|
||||||
|
if (settings_group.isEmpty() || settings_group == CollectionSettingsPage::kSettingsGroup) {
|
||||||
|
return kSavedGroupingsSettingsGroup;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return QString(kSavedGroupingsSettingsGroup) + "_" + settings_group;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SavedGroupingManager::GroupByToString(const CollectionModel::GroupBy g) {
|
QString SavedGroupingManager::GroupByToString(const CollectionModel::GroupBy g) {
|
||||||
@@ -151,7 +157,7 @@ void SavedGroupingManager::UpdateModel() {
|
|||||||
|
|
||||||
model_->setRowCount(0); // don't use clear, it deletes headers
|
model_->setRowCount(0); // don't use clear, it deletes headers
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(CollectionModel::kSavedGroupingsSettingsGroup);
|
s.beginGroup(saved_groupings_settings_group_);
|
||||||
int version = s.value("version").toInt();
|
int version = s.value("version").toInt();
|
||||||
if (version == 1) {
|
if (version == 1) {
|
||||||
QStringList saved = s.childKeys();
|
QStringList saved = s.childKeys();
|
||||||
@@ -186,7 +192,7 @@ void SavedGroupingManager::Remove() {
|
|||||||
|
|
||||||
if (ui_->list->selectionModel()->hasSelection()) {
|
if (ui_->list->selectionModel()->hasSelection()) {
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(CollectionModel::kSavedGroupingsSettingsGroup);
|
s.beginGroup(saved_groupings_settings_group_);
|
||||||
for (const QModelIndex &idx : ui_->list->selectionModel()->selectedRows()) {
|
for (const QModelIndex &idx : ui_->list->selectionModel()->selectedRows()) {
|
||||||
if (idx.isValid()) {
|
if (idx.isValid()) {
|
||||||
qLog(Debug) << "Remove saved grouping: " << model_->item(idx.row(), 0)->text();
|
qLog(Debug) << "Remove saved grouping: " << model_->item(idx.row(), 0)->text();
|
||||||
@@ -196,7 +202,8 @@ void SavedGroupingManager::Remove() {
|
|||||||
s.endGroup();
|
s.endGroup();
|
||||||
}
|
}
|
||||||
UpdateModel();
|
UpdateModel();
|
||||||
filter_->UpdateGroupByActions();
|
|
||||||
|
emit UpdateGroupByActions();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
* Strawberry Music Player
|
* Strawberry Music Player
|
||||||
* This file was part of Clementine.
|
* This file was part of Clementine.
|
||||||
* Copyright 2015, Nick Lanham <nick@afternight.org>
|
* Copyright 2015, Nick Lanham <nick@afternight.org>
|
||||||
* Copyright 2019-2021, Jonas Kvinge <jonas@jkvinge.net>
|
* Copyright 2019-2022, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -40,14 +40,20 @@ class SavedGroupingManager : public QDialog {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SavedGroupingManager(QWidget *parent = nullptr);
|
explicit SavedGroupingManager(const QString &saved_groupings_settings_group, QWidget *parent = nullptr);
|
||||||
~SavedGroupingManager() override;
|
~SavedGroupingManager() override;
|
||||||
|
|
||||||
|
static const char *kSavedGroupingsSettingsGroup;
|
||||||
|
|
||||||
|
static QString GetSavedGroupingsSettingsGroup(const QString &settings_group);
|
||||||
|
|
||||||
void UpdateModel();
|
void UpdateModel();
|
||||||
void SetFilter(CollectionFilterWidget *filter) { filter_ = filter; }
|
|
||||||
|
|
||||||
static QString GroupByToString(const CollectionModel::GroupBy g);
|
static QString GroupByToString(const CollectionModel::GroupBy g);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void UpdateGroupByActions();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void UpdateButtonState();
|
void UpdateButtonState();
|
||||||
void Remove();
|
void Remove();
|
||||||
@@ -55,7 +61,7 @@ class SavedGroupingManager : public QDialog {
|
|||||||
private:
|
private:
|
||||||
Ui_SavedGroupingManager *ui_;
|
Ui_SavedGroupingManager *ui_;
|
||||||
QStandardItemModel *model_;
|
QStandardItemModel *model_;
|
||||||
CollectionFilterWidget *filter_;
|
QString saved_groupings_settings_group_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SAVEDGROUPINGMANAGER_H
|
#endif // SAVEDGROUPINGMANAGER_H
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
#cmakedefine HAVE_MUSICBRAINZ
|
#cmakedefine HAVE_MUSICBRAINZ
|
||||||
#cmakedefine HAVE_GLOBALSHORTCUTS
|
#cmakedefine HAVE_GLOBALSHORTCUTS
|
||||||
#cmakedefine HAVE_X11_GLOBALSHORTCUTS
|
#cmakedefine HAVE_X11_GLOBALSHORTCUTS
|
||||||
|
#cmakedefine HAVE_ICU
|
||||||
|
|
||||||
#cmakedefine USE_INSTALL_PREFIX
|
#cmakedefine USE_INSTALL_PREFIX
|
||||||
|
|
||||||
#cmakedefine HAVE_GSTREAMER
|
#cmakedefine HAVE_GSTREAMER
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
|
|
||||||
#include "core/imageutils.h"
|
#include "utilities/imageutils.h"
|
||||||
#include "covermanager/albumcoverchoicecontroller.h"
|
#include "covermanager/albumcoverchoicecontroller.h"
|
||||||
|
|
||||||
#include "contextview.h"
|
#include "contextview.h"
|
||||||
|
|||||||
@@ -51,8 +51,9 @@
|
|||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "core/player.h"
|
#include "core/player.h"
|
||||||
#include "core/song.h"
|
#include "core/song.h"
|
||||||
#include "core/utilities.h"
|
|
||||||
#include "core/iconloader.h"
|
#include "core/iconloader.h"
|
||||||
|
#include "utilities/strutils.h"
|
||||||
|
#include "utilities/timeutils.h"
|
||||||
#include "widgets/resizabletextedit.h"
|
#include "widgets/resizabletextedit.h"
|
||||||
#include "engine/engine_fwd.h"
|
#include "engine/engine_fwd.h"
|
||||||
#include "engine/enginebase.h"
|
#include "engine/enginebase.h"
|
||||||
@@ -434,8 +435,8 @@ void ContextView::NoSong() {
|
|||||||
widget_album_->show();
|
widget_album_->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
textedit_top_->setStyleSheet("font: 20pt 'Open Sans', 'FreeSans', 'FreeSerif', 'Liberation Serif'; font-weight: Regular;");
|
textedit_top_->setFont(QFont(font_headline_, font_size_headline_ * 1.6));
|
||||||
textedit_top_->setText(tr("No song playing"));
|
textedit_top_->SetText(tr("No song playing"));
|
||||||
|
|
||||||
QString html;
|
QString html;
|
||||||
if (collectionview_->TotalSongs() == 1) html += tr("%1 song").arg(collectionview_->TotalSongs());
|
if (collectionview_->TotalSongs() == 1) html += tr("%1 song").arg(collectionview_->TotalSongs());
|
||||||
@@ -450,27 +451,28 @@ void ContextView::NoSong() {
|
|||||||
else html += tr("%1 albums").arg(collectionview_->TotalAlbums());
|
else html += tr("%1 albums").arg(collectionview_->TotalAlbums());
|
||||||
html += "<br />";
|
html += "<br />";
|
||||||
|
|
||||||
label_stop_summary_->setStyleSheet(QString("font: %1pt \"%2\"; font-weight: regular;").arg(font_size_normal_).arg(font_normal_));
|
label_stop_summary_->setFont(QFont(font_normal_, font_size_normal_));
|
||||||
label_stop_summary_->setText(html);
|
label_stop_summary_->setText(html);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextView::UpdateFonts() {
|
void ContextView::UpdateFonts() {
|
||||||
|
|
||||||
QString font_style = QString("font: %2pt \"%1\"; font-weight: regular;").arg(font_normal_).arg(font_size_normal_);
|
QFont font(font_normal_, font_size_normal_);
|
||||||
|
font.setBold(false);
|
||||||
for (QLabel *l : labels_play_all_) {
|
for (QLabel *l : labels_play_all_) {
|
||||||
l->setStyleSheet(font_style);
|
l->setFont(font);
|
||||||
}
|
}
|
||||||
for (QTextEdit *e : textedit_play_) {
|
for (QTextEdit *e : textedit_play_) {
|
||||||
e->setStyleSheet(font_style);
|
e->setFont(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextView::SetSong() {
|
void ContextView::SetSong() {
|
||||||
|
|
||||||
textedit_top_->setStyleSheet(QString("font: %2pt \"%1\"; font-weight: regular;").arg(font_headline_).arg(font_size_headline_));
|
textedit_top_->setFont(QFont(font_headline_, font_size_headline_));
|
||||||
textedit_top_->setText(QString("<b>%1</b><br />%2").arg(Utilities::ReplaceMessage(title_fmt_, song_playing_, "<br />", true), Utilities::ReplaceMessage(summary_fmt_, song_playing_, "<br />", true)));
|
textedit_top_->SetText(QString("<b>%1</b><br />%2").arg(Utilities::ReplaceMessage(title_fmt_, song_playing_, "<br />", true), Utilities::ReplaceMessage(summary_fmt_, song_playing_, "<br />", true)));
|
||||||
|
|
||||||
label_stop_summary_->clear();
|
label_stop_summary_->clear();
|
||||||
|
|
||||||
@@ -544,7 +546,7 @@ void ContextView::SetSong() {
|
|||||||
widget_play_output_->show();
|
widget_play_output_->show();
|
||||||
Engine::EngineType enginetype(Engine::None);
|
Engine::EngineType enginetype(Engine::None);
|
||||||
if (app_->player()->engine()) enginetype = app_->player()->engine()->type();
|
if (app_->player()->engine()) enginetype = app_->player()->engine()->type();
|
||||||
QIcon icon_engine = IconLoader::Load(EngineName(enginetype), 32);
|
QIcon icon_engine = IconLoader::Load(EngineName(enginetype), true, 32);
|
||||||
|
|
||||||
label_engine_icon_->setPixmap(icon_engine.pixmap(QSize(32, 32)));
|
label_engine_icon_->setPixmap(icon_engine.pixmap(QSize(32, 32)));
|
||||||
label_engine_->setText(EngineDescription(enginetype));
|
label_engine_->setText(EngineDescription(enginetype));
|
||||||
@@ -562,7 +564,7 @@ void ContextView::SetSong() {
|
|||||||
label_device_title_->show();
|
label_device_title_->show();
|
||||||
label_device_icon_->show();
|
label_device_icon_->show();
|
||||||
label_device_->show();
|
label_device_->show();
|
||||||
QIcon icon_device = IconLoader::Load(device.iconname, 32);
|
QIcon icon_device = IconLoader::Load(device.iconname, true, 32);
|
||||||
label_device_icon_->setPixmap(icon_device.pixmap(QSize(32, 32)));
|
label_device_icon_->setPixmap(icon_device.pixmap(QSize(32, 32)));
|
||||||
label_device_->setText(device.description);
|
label_device_->setText(device.description);
|
||||||
}
|
}
|
||||||
@@ -584,7 +586,7 @@ void ContextView::SetSong() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (action_show_lyrics_->isChecked() && !lyrics_.isEmpty()) {
|
if (action_show_lyrics_->isChecked() && !lyrics_.isEmpty()) {
|
||||||
textedit_play_lyrics_->setText(lyrics_);
|
textedit_play_lyrics_->SetText(lyrics_);
|
||||||
textedit_play_lyrics_->show();
|
textedit_play_lyrics_->show();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -599,7 +601,7 @@ void ContextView::SetSong() {
|
|||||||
|
|
||||||
void ContextView::UpdateSong(const Song &song) {
|
void ContextView::UpdateSong(const Song &song) {
|
||||||
|
|
||||||
textedit_top_->setText(QString("<b>%1</b><br />%2").arg(Utilities::ReplaceMessage(title_fmt_, song, "<br />", true), Utilities::ReplaceMessage(summary_fmt_, song, "<br />", true)));
|
textedit_top_->SetText(QString("<b>%1</b><br />%2").arg(Utilities::ReplaceMessage(title_fmt_, song, "<br />", true), Utilities::ReplaceMessage(summary_fmt_, song, "<br />", true)));
|
||||||
|
|
||||||
if (action_show_data_->isChecked()) {
|
if (action_show_data_->isChecked()) {
|
||||||
if (song.filetype() != song_playing_.filetype()) label_filetype_->setText(song.TextForFiletype());
|
if (song.filetype() != song_playing_.filetype()) label_filetype_->setText(song.TextForFiletype());
|
||||||
@@ -655,6 +657,8 @@ void ContextView::UpdateSong(const Song &song) {
|
|||||||
|
|
||||||
song_playing_ = song;
|
song_playing_ = song;
|
||||||
|
|
||||||
|
widget_stacked_->updateGeometry();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextView::ResetSong() {
|
void ContextView::ResetSong() {
|
||||||
@@ -681,7 +685,7 @@ void ContextView::UpdateLyrics(const quint64 id, const QString &provider, const
|
|||||||
lyrics_id_ = -1;
|
lyrics_id_ = -1;
|
||||||
|
|
||||||
if (action_show_lyrics_->isChecked() && !lyrics_.isEmpty()) {
|
if (action_show_lyrics_->isChecked() && !lyrics_.isEmpty()) {
|
||||||
textedit_play_lyrics_->setText(lyrics_);
|
textedit_play_lyrics_->SetText(lyrics_);
|
||||||
textedit_play_lyrics_->show();
|
textedit_play_lyrics_->show();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
/*
|
|
||||||
* Strawberry Music Player
|
|
||||||
* This file was part of Clementine.
|
|
||||||
* Copyright 2012, Arnaud Bienner <arnaud.bienner@gmail.com>
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QObject>
|
|
||||||
#include <QVariant>
|
|
||||||
#include <QPalette>
|
|
||||||
#include <QColor>
|
|
||||||
#include <QSettings>
|
|
||||||
|
|
||||||
#include "appearance.h"
|
|
||||||
#include "settings/appearancesettingspage.h"
|
|
||||||
|
|
||||||
const QPalette Appearance::kDefaultPalette = QPalette();
|
|
||||||
|
|
||||||
Appearance::Appearance(QObject *parent) : QObject(parent) {
|
|
||||||
|
|
||||||
QPalette p = QApplication::palette();
|
|
||||||
|
|
||||||
QSettings s;
|
|
||||||
s.beginGroup(AppearanceSettingsPage::kSettingsGroup);
|
|
||||||
background_color_ = s.value(AppearanceSettingsPage::kBackgroundColor, p.color(QPalette::WindowText)).value<QColor>();
|
|
||||||
foreground_color_ = s.value(AppearanceSettingsPage::kForegroundColor, p.color(QPalette::Window)).value<QColor>();
|
|
||||||
s.endGroup();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Appearance::LoadUserTheme() {
|
|
||||||
|
|
||||||
QSettings s;
|
|
||||||
s.beginGroup(AppearanceSettingsPage::kSettingsGroup);
|
|
||||||
bool use_a_custom_color_set = s.value(AppearanceSettingsPage::kUseCustomColorSet).toBool();
|
|
||||||
s.endGroup();
|
|
||||||
|
|
||||||
if (use_a_custom_color_set) {
|
|
||||||
ChangeForegroundColor(foreground_color_);
|
|
||||||
ChangeBackgroundColor(background_color_);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Appearance::ResetToSystemDefaultTheme() {
|
|
||||||
QApplication::setPalette(kDefaultPalette);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Appearance::ChangeForegroundColor(const QColor &color) {
|
|
||||||
|
|
||||||
// Get the application palette
|
|
||||||
QPalette p = QApplication::palette();
|
|
||||||
|
|
||||||
// Modify the palette
|
|
||||||
p.setColor(QPalette::WindowText, color);
|
|
||||||
p.setColor(QPalette::Text, color);
|
|
||||||
|
|
||||||
// Make the modified palette the new application's palette
|
|
||||||
QApplication::setPalette(p);
|
|
||||||
foreground_color_ = color;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void Appearance::ChangeBackgroundColor(const QColor &color) {
|
|
||||||
|
|
||||||
// Get the application palette
|
|
||||||
QPalette p = QApplication::palette();
|
|
||||||
|
|
||||||
// Modify the palette
|
|
||||||
p.setColor(QPalette::Window, color);
|
|
||||||
p.setColor(QPalette::Base, color);
|
|
||||||
|
|
||||||
// Make the modified palette the new application's palette
|
|
||||||
QApplication::setPalette(p);
|
|
||||||
background_color_ = color;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -29,18 +29,15 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QVariant>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include "core/lazy.h"
|
#include "core/lazy.h"
|
||||||
#include "core/tagreaderclient.h"
|
#include "core/tagreaderclient.h"
|
||||||
#include "core/song.h"
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
|
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include "taskmanager.h"
|
#include "taskmanager.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "appearance.h"
|
|
||||||
|
|
||||||
#include "engine/devicefinders.h"
|
#include "engine/devicefinders.h"
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
@@ -111,7 +108,6 @@ class ApplicationImpl {
|
|||||||
QTimer::singleShot(30s, db, &Database::DoBackup);
|
QTimer::singleShot(30s, db, &Database::DoBackup);
|
||||||
return db;
|
return db;
|
||||||
}),
|
}),
|
||||||
appearance_([app]() { return new Appearance(app); }),
|
|
||||||
task_manager_([app]() { return new TaskManager(app); }),
|
task_manager_([app]() { return new TaskManager(app); }),
|
||||||
player_([app]() { return new Player(app, app); }),
|
player_([app]() { return new Player(app, app); }),
|
||||||
device_finders_([app]() { return new DeviceFinders(app); }),
|
device_finders_([app]() { return new DeviceFinders(app); }),
|
||||||
@@ -185,7 +181,6 @@ class ApplicationImpl {
|
|||||||
|
|
||||||
Lazy<TagReaderClient> tag_reader_client_;
|
Lazy<TagReaderClient> tag_reader_client_;
|
||||||
Lazy<Database> database_;
|
Lazy<Database> database_;
|
||||||
Lazy<Appearance> appearance_;
|
|
||||||
Lazy<TaskManager> task_manager_;
|
Lazy<TaskManager> task_manager_;
|
||||||
Lazy<Player> player_;
|
Lazy<Player> player_;
|
||||||
Lazy<DeviceFinders> device_finders_;
|
Lazy<DeviceFinders> device_finders_;
|
||||||
@@ -317,7 +312,6 @@ void Application::ReloadSettings() { emit SettingsChanged(); }
|
|||||||
void Application::OpenSettingsDialogAtPage(SettingsDialog::Page page) { emit SettingsDialogRequested(page); }
|
void Application::OpenSettingsDialogAtPage(SettingsDialog::Page page) { emit SettingsDialogRequested(page); }
|
||||||
|
|
||||||
TagReaderClient *Application::tag_reader_client() const { return p_->tag_reader_client_.get(); }
|
TagReaderClient *Application::tag_reader_client() const { return p_->tag_reader_client_.get(); }
|
||||||
Appearance *Application::appearance() const { return p_->appearance_.get(); }
|
|
||||||
Database *Application::database() const { return p_->database_.get(); }
|
Database *Application::database() const { return p_->database_.get(); }
|
||||||
TaskManager *Application::task_manager() const { return p_->task_manager_.get(); }
|
TaskManager *Application::task_manager() const { return p_->task_manager_.get(); }
|
||||||
Player *Application::player() const { return p_->player_.get(); }
|
Player *Application::player() const { return p_->player_.get(); }
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ class TagReaderClient;
|
|||||||
class Database;
|
class Database;
|
||||||
class DeviceFinders;
|
class DeviceFinders;
|
||||||
class Player;
|
class Player;
|
||||||
class Appearance;
|
|
||||||
class SCollection;
|
class SCollection;
|
||||||
class CollectionBackend;
|
class CollectionBackend;
|
||||||
class CollectionModel;
|
class CollectionModel;
|
||||||
@@ -73,7 +72,6 @@ class Application : public QObject {
|
|||||||
|
|
||||||
TagReaderClient *tag_reader_client() const;
|
TagReaderClient *tag_reader_client() const;
|
||||||
Database *database() const;
|
Database *database() const;
|
||||||
Appearance *appearance() const;
|
|
||||||
TaskManager *task_manager() const;
|
TaskManager *task_manager() const;
|
||||||
Player *player() const;
|
Player *player() const;
|
||||||
DeviceFinders *device_finders() const;
|
DeviceFinders *device_finders() const;
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|||||||
@@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
#include <boost/scope_exit.hpp>
|
#include <boost/scope_exit.hpp>
|
||||||
|
|
||||||
@@ -31,20 +30,15 @@
|
|||||||
#include <QIODevice>
|
#include <QIODevice>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QList>
|
|
||||||
#include <QByteArray>
|
#include <QByteArray>
|
||||||
#include <QVariant>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringBuilder>
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QSqlDriver>
|
#include <QSqlDriver>
|
||||||
#include <QSqlDatabase>
|
#include <QSqlDatabase>
|
||||||
#include <QSqlQuery>
|
|
||||||
#include <QSqlError>
|
#include <QSqlError>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "taskmanager.h"
|
#include "taskmanager.h"
|
||||||
@@ -373,7 +367,6 @@ void Database::ExecSchemaCommandsFromFile(QSqlDatabase &db, const QString &filen
|
|||||||
QFile schema_file(filename);
|
QFile schema_file(filename);
|
||||||
if (!schema_file.open(QIODevice::ReadOnly)) {
|
if (!schema_file.open(QIODevice::ReadOnly)) {
|
||||||
qFatal("Couldn't open schema file %s for reading: %s", filename.toUtf8().constData(), schema_file.errorString().toUtf8().constData());
|
qFatal("Couldn't open schema file %s for reading: %s", filename.toUtf8().constData(), schema_file.errorString().toUtf8().constData());
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
QByteArray data = schema_file.readAll();
|
QByteArray data = schema_file.readAll();
|
||||||
QString schema = QString::fromUtf8(data);
|
QString schema = QString::fromUtf8(data);
|
||||||
@@ -391,9 +384,9 @@ void Database::ExecSchemaCommands(QSqlDatabase &db, const QString &schema, int s
|
|||||||
QStringList commands;
|
QStringList commands;
|
||||||
commands = schema.split(QRegularExpression("; *\n\n"));
|
commands = schema.split(QRegularExpression("; *\n\n"));
|
||||||
|
|
||||||
// We don't want this list to reflect possible DB schema changes so we initialize it before executing any statements.
|
// We don't want this list to reflect possible DB schema changes, so we initialize it before executing any statements.
|
||||||
// If no outer transaction is provided the song tables need to be queried before beginning an inner transaction! Otherwise
|
// If no outer transaction is provided the song tables need to be queried before beginning an inner transaction!
|
||||||
// DROP TABLE commands on song tables may fail due to database locks.
|
// Otherwise DROP TABLE commands on song tables may fail due to database locks.
|
||||||
const QStringList song_tables(SongsTables(db, schema_version));
|
const QStringList song_tables(SongsTables(db, schema_version));
|
||||||
|
|
||||||
if (!in_transaction) {
|
if (!in_transaction) {
|
||||||
@@ -543,7 +536,8 @@ void Database::DoBackup() {
|
|||||||
|
|
||||||
bool Database::OpenDatabase(const QString &filename, sqlite3 **connection) {
|
bool Database::OpenDatabase(const QString &filename, sqlite3 **connection) {
|
||||||
|
|
||||||
int ret = sqlite3_open(filename.toUtf8(), connection);
|
const QByteArray filename_data = filename.toUtf8();
|
||||||
|
int ret = sqlite3_open(filename_data.constData(), connection);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
if (*connection) {
|
if (*connection) {
|
||||||
const char *error_message = sqlite3_errmsg(*connection);
|
const char *error_message = sqlite3_errmsg(*connection);
|
||||||
|
|||||||
@@ -27,17 +27,14 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "utilities.h"
|
#include "utilities/fileutils.h"
|
||||||
#include "song.h"
|
|
||||||
#include "musicstorage.h"
|
#include "musicstorage.h"
|
||||||
|
|
||||||
#include "filesystemmusicstorage.h"
|
#include "filesystemmusicstorage.h"
|
||||||
|
|
||||||
FilesystemMusicStorage::FilesystemMusicStorage(const QString &root, const std::optional<int> collection_directory_id) : root_(root), collection_directory_id_(collection_directory_id) {}
|
FilesystemMusicStorage::FilesystemMusicStorage(const Song::Source source, const QString &root, const std::optional<int> collection_directory_id) : source_(source), root_(root), collection_directory_id_(collection_directory_id) {}
|
||||||
|
|
||||||
bool FilesystemMusicStorage::CopyToStorage(const CopyJob &job) {
|
bool FilesystemMusicStorage::CopyToStorage(const CopyJob &job) {
|
||||||
|
|
||||||
@@ -61,7 +58,7 @@ bool FilesystemMusicStorage::CopyToStorage(const CopyJob &job) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the destination file if it exists and we want to overwrite
|
// Remove the destination file if it exists, and we want to overwrite
|
||||||
if (job.overwrite_) {
|
if (job.overwrite_) {
|
||||||
if (dest.exists()) QFile::remove(dest.absoluteFilePath());
|
if (dest.exists()) QFile::remove(dest.absoluteFilePath());
|
||||||
if (!cover_dest.filePath().isEmpty() && cover_dest.exists()) QFile::remove(cover_dest.absoluteFilePath());
|
if (!cover_dest.filePath().isEmpty() && cover_dest.exists()) QFile::remove(cover_dest.absoluteFilePath());
|
||||||
@@ -109,12 +106,7 @@ bool FilesystemMusicStorage::DeleteFromStorage(const DeleteJob &job) {
|
|||||||
|
|
||||||
if (job.use_trash_) {
|
if (job.use_trash_) {
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
if (fileInfo.isDir()) {
|
return QFile::moveToTrash(path);
|
||||||
return Utilities::MoveToTrashRecursive(path);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return QFile::moveToTrash(path);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -28,12 +28,14 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
#include "song.h"
|
||||||
#include "musicstorage.h"
|
#include "musicstorage.h"
|
||||||
|
|
||||||
class FilesystemMusicStorage : public virtual MusicStorage {
|
class FilesystemMusicStorage : public virtual MusicStorage {
|
||||||
public:
|
public:
|
||||||
explicit FilesystemMusicStorage(const QString &root, const std::optional<int> collection_directory_id = std::optional<int>());
|
explicit FilesystemMusicStorage(const Song::Source source, const QString &root, const std::optional<int> collection_directory_id = std::optional<int>());
|
||||||
|
|
||||||
|
Song::Source source() const override { return source_; }
|
||||||
QString LocalPath() const override { return root_; }
|
QString LocalPath() const override { return root_; }
|
||||||
std::optional<int> collection_directory_id() const override { return collection_directory_id_; }
|
std::optional<int> collection_directory_id() const override { return collection_directory_id_; }
|
||||||
|
|
||||||
@@ -41,6 +43,7 @@ class FilesystemMusicStorage : public virtual MusicStorage {
|
|||||||
bool DeleteFromStorage(const DeleteJob &job) override;
|
bool DeleteFromStorage(const DeleteJob &job) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Song::Source source_;
|
||||||
QString root_;
|
QString root_;
|
||||||
std::optional<int> collection_directory_id_;
|
std::optional<int> collection_directory_id_;
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class FileSystemWatcherInterface : public QObject {
|
|||||||
static FileSystemWatcherInterface *Create(QObject *parent = nullptr);
|
static FileSystemWatcherInterface *Create(QObject *parent = nullptr);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void PathChanged(const QString &path);
|
void PathChanged(QString path);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ void IconLoader::Init() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon IconLoader::Load(const QString &name, const int fixed_size, const int min_size, const int max_size) {
|
QIcon IconLoader::Load(const QString &name, const bool system_icon, const int fixed_size, const int min_size, const int max_size) {
|
||||||
|
|
||||||
QIcon ret;
|
QIcon ret;
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ QIcon IconLoader::Load(const QString &name, const int fixed_size, const int min_
|
|||||||
sizes << fixed_size;
|
sizes << fixed_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (system_icons_) {
|
if (system_icon && system_icons_) {
|
||||||
IconMapper::IconProperties icon_prop;
|
IconMapper::IconProperties icon_prop;
|
||||||
if (IconMapper::iconmapper_.contains(name)) {
|
if (IconMapper::iconmapper_.contains(name)) {
|
||||||
icon_prop = IconMapper::iconmapper_[name];
|
icon_prop = IconMapper::iconmapper_[name];
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
class IconLoader {
|
class IconLoader {
|
||||||
public:
|
public:
|
||||||
static void Init();
|
static void Init();
|
||||||
static QIcon Load(const QString &name, const int fixed_size = 0, const int min_size = 0, const int max_size = 0);
|
static QIcon Load(const QString &name, const bool system_icon = true, const int fixed_size = 0, const int min_size = 0, const int max_size = 0);
|
||||||
private:
|
private:
|
||||||
explicit IconLoader() {}
|
explicit IconLoader() {}
|
||||||
static bool system_icons_;
|
static bool system_icons_;
|
||||||
|
|||||||
@@ -17,7 +17,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#ifndef ICONMAPPER_H
|
||||||
|
#define ICONMAPPER_H
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
@@ -135,3 +136,6 @@ static const QMap<QString, IconProperties> iconmapper_ = { // clazy:exclude=non
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace IconMapper
|
} // namespace IconMapper
|
||||||
|
|
||||||
|
#endif // ICONMAPPER_H
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Strawberry Music Player
|
||||||
|
* This file was part of Clementine.
|
||||||
|
* Copyright 2010, David Sansome <me@davidsansome.com>
|
||||||
|
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
|
*
|
||||||
|
* Strawberry is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Strawberry is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Strawberry. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef MAC_STARTUP_H
|
#ifndef MAC_STARTUP_H
|
||||||
#define MAC_STARTUP_H
|
#define MAC_STARTUP_H
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <CoreFoundation/CFDictionary.h>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QWidget>
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
|
|
||||||
class QObject;
|
#ifdef __OBJC__
|
||||||
class QWidget;
|
@class NSEvent;
|
||||||
|
#else
|
||||||
|
class NSEvent;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class PlatformInterface;
|
||||||
class GlobalShortcutsBackendMacOS;
|
class GlobalShortcutsBackendMacOS;
|
||||||
|
|
||||||
class PlatformInterface {
|
|
||||||
public:
|
|
||||||
PlatformInterface() = default;
|
|
||||||
virtual ~PlatformInterface() {}
|
|
||||||
|
|
||||||
// Called when the application should show itself.
|
|
||||||
virtual void Activate() = 0;
|
|
||||||
virtual bool LoadUrl(const QString &url) = 0;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(PlatformInterface)
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace mac {
|
namespace mac {
|
||||||
|
|
||||||
void MacMain();
|
void MacMain();
|
||||||
@@ -32,6 +47,9 @@ void SetApplicationHandler(PlatformInterface *handler);
|
|||||||
|
|
||||||
void EnableFullScreen(const QWidget &main_window);
|
void EnableFullScreen(const QWidget &main_window);
|
||||||
|
|
||||||
|
QKeySequence KeySequenceFromNSEvent(NSEvent *event);
|
||||||
|
void DumpDictionary(CFDictionaryRef dict);
|
||||||
|
|
||||||
} // namespace mac
|
} // namespace mac
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -45,13 +45,12 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "platforminterface.h"
|
||||||
#include "mac_delegate.h"
|
#include "mac_delegate.h"
|
||||||
#include "mac_startup.h"
|
#include "mac_startup.h"
|
||||||
#include "mac_utilities.h"
|
|
||||||
#include "utilities.h"
|
|
||||||
#include "scoped_cftyperef.h"
|
#include "scoped_cftyperef.h"
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "core/scoped_nsautorelease_pool.h"
|
#include "scoped_nsautorelease_pool.h"
|
||||||
#include "globalshortcuts/globalshortcutsmanager.h"
|
#include "globalshortcuts/globalshortcutsmanager.h"
|
||||||
#include "globalshortcuts/globalshortcutsbackend-macos.h"
|
#include "globalshortcuts/globalshortcutsbackend-macos.h"
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class MacSystemTrayIconPrivate {
|
|||||||
|
|
||||||
// Don't look now.
|
// Don't look now.
|
||||||
// This must be called after our custom NSApplicationDelegate has been set.
|
// This must be called after our custom NSApplicationDelegate has been set.
|
||||||
[(AppDelegate*)([NSApp delegate]) setDockMenu:dock_menu_];
|
[reinterpret_cast<AppDelegate*>([NSApp delegate]) setDockMenu:dock_menu_];
|
||||||
|
|
||||||
ClearNowPlaying();
|
ClearNowPlaying();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,13 +74,10 @@
|
|||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "core/networkaccessmanager.h"
|
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
|
||||||
#include "utilities.h"
|
|
||||||
#include "timeconstants.h"
|
|
||||||
#include "commandlineoptions.h"
|
#include "commandlineoptions.h"
|
||||||
#include "mimedata.h"
|
#include "mimedata.h"
|
||||||
#include "iconloader.h"
|
#include "iconloader.h"
|
||||||
@@ -91,14 +88,18 @@
|
|||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
#include "appearance.h"
|
|
||||||
#include "filesystemmusicstorage.h"
|
#include "filesystemmusicstorage.h"
|
||||||
#include "deletefiles.h"
|
#include "deletefiles.h"
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
|
# include "mac_startup.h"
|
||||||
# include "macsystemtrayicon.h"
|
# include "macsystemtrayicon.h"
|
||||||
#else
|
#else
|
||||||
# include "qtsystemtrayicon.h"
|
# include "qtsystemtrayicon.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "networkaccessmanager.h"
|
||||||
|
#include "utilities/envutils.h"
|
||||||
|
#include "utilities/filemanagerutils.h"
|
||||||
|
#include "utilities/timeconstants.h"
|
||||||
#include "engine/enginetype.h"
|
#include "engine/enginetype.h"
|
||||||
#include "engine/enginebase.h"
|
#include "engine/enginebase.h"
|
||||||
#include "engine/engine_fwd.h"
|
#include "engine/engine_fwd.h"
|
||||||
@@ -135,6 +136,7 @@
|
|||||||
#include "playlist/playlistmanager.h"
|
#include "playlist/playlistmanager.h"
|
||||||
#include "playlist/playlistsequence.h"
|
#include "playlist/playlistsequence.h"
|
||||||
#include "playlist/playlistview.h"
|
#include "playlist/playlistview.h"
|
||||||
|
#include "playlist/playlistfilter.h"
|
||||||
#include "queue/queue.h"
|
#include "queue/queue.h"
|
||||||
#include "queue/queueview.h"
|
#include "queue/queueview.h"
|
||||||
#include "playlistparsers/playlistparser.h"
|
#include "playlistparsers/playlistparser.h"
|
||||||
@@ -222,7 +224,11 @@ const int kTrackPositionUpdateTimeMs = 1000;
|
|||||||
|
|
||||||
#ifdef HAVE_QTSPARKLE
|
#ifdef HAVE_QTSPARKLE
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
|
# ifdef _M_X64
|
||||||
constexpr char QTSPARKLE_URL[] = "https://www.strawberrymusicplayer.org/sparkle-windows-msvc-x64";
|
constexpr char QTSPARKLE_URL[] = "https://www.strawberrymusicplayer.org/sparkle-windows-msvc-x64";
|
||||||
|
# else
|
||||||
|
constexpr char QTSPARKLE_URL[] = "https://www.strawberrymusicplayer.org/sparkle-windows-msvc-x86";
|
||||||
|
# endif
|
||||||
# else
|
# else
|
||||||
# ifdef __x86_64__
|
# ifdef __x86_64__
|
||||||
constexpr char QTSPARKLE_URL[] = "https://www.strawberrymusicplayer.org/sparkle-windows-mingw-x64";
|
constexpr char QTSPARKLE_URL[] = "https://www.strawberrymusicplayer.org/sparkle-windows-mingw-x64";
|
||||||
@@ -358,24 +364,24 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
|
|||||||
StyleHelper::setBaseColor(palette().color(QPalette::Highlight).darker());
|
StyleHelper::setBaseColor(palette().color(QPalette::Highlight).darker());
|
||||||
|
|
||||||
// Add tabs to the fancy tab widget
|
// Add tabs to the fancy tab widget
|
||||||
ui_->tabs->AddTab(context_view_, "context", IconLoader::Load("strawberry"), tr("Context"));
|
ui_->tabs->AddTab(context_view_, "context", IconLoader::Load("strawberry", true, 0, 32), tr("Context"));
|
||||||
ui_->tabs->AddTab(collection_view_, "collection", IconLoader::Load("library-music"), tr("Collection"));
|
ui_->tabs->AddTab(collection_view_, "collection", IconLoader::Load("library-music", true, 0, 32), tr("Collection"));
|
||||||
ui_->tabs->AddTab(queue_view_, "queue", IconLoader::Load("footsteps"), tr("Queue"));
|
ui_->tabs->AddTab(queue_view_, "queue", IconLoader::Load("footsteps", true, 0, 32), tr("Queue"));
|
||||||
ui_->tabs->AddTab(playlist_list_, "playlists", IconLoader::Load("view-media-playlist"), tr("Playlists"));
|
ui_->tabs->AddTab(playlist_list_, "playlists", IconLoader::Load("view-media-playlist", true, 0, 32), tr("Playlists"));
|
||||||
ui_->tabs->AddTab(smartplaylists_view_, "smartplaylists", IconLoader::Load("view-media-playlist"), tr("Smart playlists"));
|
ui_->tabs->AddTab(smartplaylists_view_, "smartplaylists", IconLoader::Load("view-media-playlist", true, 0, 32), tr("Smart playlists"));
|
||||||
ui_->tabs->AddTab(file_view_, "files", IconLoader::Load("document-open"), tr("Files"));
|
ui_->tabs->AddTab(file_view_, "files", IconLoader::Load("document-open", true, 0, 32), tr("Files"));
|
||||||
ui_->tabs->AddTab(radio_view_, "radios", IconLoader::Load("radio"), tr("Radios"));
|
ui_->tabs->AddTab(radio_view_, "radios", IconLoader::Load("radio", true, 0, 32), tr("Radios"));
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
ui_->tabs->AddTab(device_view_, "devices", IconLoader::Load("device"), tr("Devices"));
|
ui_->tabs->AddTab(device_view_, "devices", IconLoader::Load("device", true, 0, 32), tr("Devices"));
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SUBSONIC
|
#ifdef HAVE_SUBSONIC
|
||||||
ui_->tabs->AddTab(subsonic_view_, "subsonic", IconLoader::Load("subsonic"), tr("Subsonic"));
|
ui_->tabs->AddTab(subsonic_view_, "subsonic", IconLoader::Load("subsonic", true, 0, 32), tr("Subsonic"));
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_TIDAL
|
#ifdef HAVE_TIDAL
|
||||||
ui_->tabs->AddTab(tidal_view_, "tidal", IconLoader::Load("tidal"), tr("Tidal"));
|
ui_->tabs->AddTab(tidal_view_, "tidal", IconLoader::Load("tidal", true, 0, 32), tr("Tidal"));
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_QOBUZ
|
#ifdef HAVE_QOBUZ
|
||||||
ui_->tabs->AddTab(qobuz_view_, "qobuz", IconLoader::Load("qobuz"), tr("Qobuz"));
|
ui_->tabs->AddTab(qobuz_view_, "qobuz", IconLoader::Load("qobuz", true, 0, 32), tr("Qobuz"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Add the playing widget to the fancy tab widget
|
// Add the playing widget to the fancy tab widget
|
||||||
@@ -394,8 +400,8 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
|
|||||||
app_->player()->SetEqualizer(equalizer_.get());
|
app_->player()->SetEqualizer(equalizer_.get());
|
||||||
app_->player()->Init();
|
app_->player()->Init();
|
||||||
EngineChanged(app_->player()->engine()->type());
|
EngineChanged(app_->player()->engine()->type());
|
||||||
int volume = static_cast<int>(app_->player()->GetVolume());
|
const uint volume = app_->player()->GetVolume();
|
||||||
ui_->volume->setValue(volume);
|
ui_->volume->SetValue(volume);
|
||||||
VolumeChanged(volume);
|
VolumeChanged(volume);
|
||||||
|
|
||||||
// Models
|
// Models
|
||||||
@@ -578,7 +584,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
|
|||||||
ui_->stop_button->setMenu(stop_menu);
|
ui_->stop_button->setMenu(stop_menu);
|
||||||
|
|
||||||
// Player connections
|
// Player connections
|
||||||
QObject::connect(ui_->volume, &VolumeSlider::valueChanged, app_->player(), &Player::SetVolume);
|
QObject::connect(ui_->volume, &VolumeSlider::valueChanged, app_->player(), &Player::SetVolumeFromSlider);
|
||||||
|
|
||||||
QObject::connect(app_->player(), &Player::EngineChanged, this, &MainWindow::EngineChanged);
|
QObject::connect(app_->player(), &Player::EngineChanged, this, &MainWindow::EngineChanged);
|
||||||
QObject::connect(app_->player(), &Player::Error, this, &MainWindow::ShowErrorDialog);
|
QObject::connect(app_->player(), &Player::Error, this, &MainWindow::ShowErrorDialog);
|
||||||
@@ -601,7 +607,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
|
|||||||
QObject::connect(app_->player(), &Player::Stopped, osd_, &OSDBase::Stopped);
|
QObject::connect(app_->player(), &Player::Stopped, osd_, &OSDBase::Stopped);
|
||||||
QObject::connect(app_->player(), &Player::PlaylistFinished, osd_, &OSDBase::PlaylistFinished);
|
QObject::connect(app_->player(), &Player::PlaylistFinished, osd_, &OSDBase::PlaylistFinished);
|
||||||
QObject::connect(app_->player(), &Player::VolumeChanged, osd_, &OSDBase::VolumeChanged);
|
QObject::connect(app_->player(), &Player::VolumeChanged, osd_, &OSDBase::VolumeChanged);
|
||||||
QObject::connect(app_->player(), &Player::VolumeChanged, ui_->volume, &VolumeSlider::setValue);
|
QObject::connect(app_->player(), &Player::VolumeChanged, ui_->volume, &VolumeSlider::SetValue);
|
||||||
QObject::connect(app_->player(), &Player::ForceShowOSD, this, &MainWindow::ForceShowOSD);
|
QObject::connect(app_->player(), &Player::ForceShowOSD, this, &MainWindow::ForceShowOSD);
|
||||||
|
|
||||||
QObject::connect(app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, this, &MainWindow::SongChanged);
|
QObject::connect(app_->playlist_manager(), &PlaylistManager::CurrentSongChanged, this, &MainWindow::SongChanged);
|
||||||
@@ -669,7 +675,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
|
|||||||
collection_show_untagged_->setCheckable(true);
|
collection_show_untagged_->setCheckable(true);
|
||||||
collection_show_all_->setChecked(true);
|
collection_show_all_->setChecked(true);
|
||||||
|
|
||||||
QObject::connect(collection_view_group, &QActionGroup::triggered, this, &MainWindow::ChangeCollectionQueryMode);
|
QObject::connect(collection_view_group, &QActionGroup::triggered, this, &MainWindow::ChangeCollectionFilterMode);
|
||||||
|
|
||||||
QAction *collection_config_action = new QAction(IconLoader::Load("configure"), tr("Configure collection..."), this);
|
QAction *collection_config_action = new QAction(IconLoader::Load("configure"), tr("Configure collection..."), this);
|
||||||
QObject::connect(collection_config_action, &QAction::triggered, this, &MainWindow::ShowCollectionConfig);
|
QObject::connect(collection_config_action, &QAction::triggered, this, &MainWindow::ShowCollectionConfig);
|
||||||
@@ -867,11 +873,6 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
|
|||||||
QObject::connect(ui_->action_console, &QAction::triggered, this, &MainWindow::ShowConsole);
|
QObject::connect(ui_->action_console, &QAction::triggered, this, &MainWindow::ShowConsole);
|
||||||
PlayingWidgetPositionChanged(ui_->widget_playing->show_above_status_bar());
|
PlayingWidgetPositionChanged(ui_->widget_playing->show_above_status_bar());
|
||||||
|
|
||||||
// Load theme
|
|
||||||
// This is tricky: we need to save the default/system palette now,
|
|
||||||
// before loading user preferred theme (which will override it), to be able to restore it later
|
|
||||||
const_cast<QPalette&>(Appearance::kDefaultPalette) = QApplication::palette();
|
|
||||||
app_->appearance()->LoadUserTheme();
|
|
||||||
StyleSheetLoader *css_loader = new StyleSheetLoader(this);
|
StyleSheetLoader *css_loader = new StyleSheetLoader(this);
|
||||||
css_loader->SetStyleSheet(this, ":/style/strawberry.css");
|
css_loader->SetStyleSheet(this, ":/style/strawberry.css");
|
||||||
|
|
||||||
@@ -963,7 +964,7 @@ MainWindow::MainWindow(Application *app, std::shared_ptr<SystemTrayIcon> tray_ic
|
|||||||
if (tray_icon_->IsSystemTrayAvailable() && tray_icon_->isVisible()) {
|
if (tray_icon_->IsSystemTrayAvailable() && tray_icon_->isVisible()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// fallthrough
|
[[fallthrough]];
|
||||||
case BehaviourSettingsPage::Startup_Remember:
|
case BehaviourSettingsPage::Startup_Remember:
|
||||||
default: {
|
default: {
|
||||||
|
|
||||||
@@ -1196,6 +1197,7 @@ void MainWindow::SaveSettings() {
|
|||||||
|
|
||||||
SaveGeometry();
|
SaveGeometry();
|
||||||
SavePlaybackStatus();
|
SavePlaybackStatus();
|
||||||
|
app_->player()->SaveVolume();
|
||||||
ui_->tabs->SaveSettings(kSettingsGroup);
|
ui_->tabs->SaveSettings(kSettingsGroup);
|
||||||
ui_->playlist->view()->SaveSettings();
|
ui_->playlist->view()->SaveSettings();
|
||||||
app_->scrobbler()->WriteCache();
|
app_->scrobbler()->WriteCache();
|
||||||
@@ -1346,7 +1348,7 @@ void MainWindow::SendNowPlaying() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::VolumeChanged(const int volume) {
|
void MainWindow::VolumeChanged(const uint volume) {
|
||||||
ui_->action_mute->setChecked(volume == 0);
|
ui_->action_mute->setChecked(volume == 0);
|
||||||
tray_icon_->MuteButtonStateChanged(volume == 0);
|
tray_icon_->MuteButtonStateChanged(volume == 0);
|
||||||
}
|
}
|
||||||
@@ -1509,9 +1511,9 @@ void MainWindow::PlayIndex(const QModelIndex &idx, Playlist::AutoScroll autoscro
|
|||||||
if (!idx.isValid()) return;
|
if (!idx.isValid()) return;
|
||||||
|
|
||||||
int row = idx.row();
|
int row = idx.row();
|
||||||
if (idx.model() == app_->playlist_manager()->current()->proxy()) {
|
if (idx.model() == app_->playlist_manager()->current()->filter()) {
|
||||||
// The index was in the proxy model (might've been filtered), so we need to get the actual row in the source model.
|
// The index was in the proxy model (might've been filtered), so we need to get the actual row in the source model.
|
||||||
row = app_->playlist_manager()->current()->proxy()->mapToSource(idx).row();
|
row = app_->playlist_manager()->current()->filter()->mapToSource(idx).row();
|
||||||
}
|
}
|
||||||
|
|
||||||
app_->playlist_manager()->SetActiveToCurrent();
|
app_->playlist_manager()->SetActiveToCurrent();
|
||||||
@@ -1524,9 +1526,9 @@ void MainWindow::PlaylistDoubleClick(const QModelIndex &idx) {
|
|||||||
if (!idx.isValid()) return;
|
if (!idx.isValid()) return;
|
||||||
|
|
||||||
QModelIndex source_idx = idx;
|
QModelIndex source_idx = idx;
|
||||||
if (idx.model() == app_->playlist_manager()->current()->proxy()) {
|
if (idx.model() == app_->playlist_manager()->current()->filter()) {
|
||||||
// The index was in the proxy model (might've been filtered), so we need to get the actual row in the source model.
|
// The index was in the proxy model (might've been filtered), so we need to get the actual row in the source model.
|
||||||
source_idx = app_->playlist_manager()->current()->proxy()->mapToSource(idx);
|
source_idx = app_->playlist_manager()->current()->filter()->mapToSource(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (doubleclick_playlist_addmode_) {
|
switch (doubleclick_playlist_addmode_) {
|
||||||
@@ -1765,7 +1767,7 @@ void MainWindow::AddToPlaylistFromAction(QAction *action) {
|
|||||||
|
|
||||||
// Get the selected playlist items
|
// Get the selected playlist items
|
||||||
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
const QModelIndex source_index = app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
if (!source_index.isValid()) continue;
|
if (!source_index.isValid()) continue;
|
||||||
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
@@ -1804,8 +1806,8 @@ void MainWindow::PlaylistMenuHidden() {
|
|||||||
void MainWindow::PlaylistRightClick(const QPoint global_pos, const QModelIndex &index) {
|
void MainWindow::PlaylistRightClick(const QPoint global_pos, const QModelIndex &index) {
|
||||||
|
|
||||||
QModelIndex source_index = index;
|
QModelIndex source_index = index;
|
||||||
if (index.model() == app_->playlist_manager()->current()->proxy()) {
|
if (index.model() == app_->playlist_manager()->current()->filter()) {
|
||||||
source_index = app_->playlist_manager()->current()->proxy()->mapToSource(index);
|
source_index = app_->playlist_manager()->current()->filter()->mapToSource(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
playlist_menu_index_ = source_index;
|
playlist_menu_index_ = source_index;
|
||||||
@@ -1844,7 +1846,7 @@ void MainWindow::PlaylistRightClick(const QPoint global_pos, const QModelIndex &
|
|||||||
|
|
||||||
for (const QModelIndex &idx : selection) {
|
for (const QModelIndex &idx : selection) {
|
||||||
|
|
||||||
const QModelIndex src_idx = app_->playlist_manager()->current()->proxy()->mapToSource(idx);
|
const QModelIndex src_idx = app_->playlist_manager()->current()->filter()->mapToSource(idx);
|
||||||
if (!src_idx.isValid()) continue;
|
if (!src_idx.isValid()) continue;
|
||||||
|
|
||||||
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(src_idx.row());
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(src_idx.row());
|
||||||
@@ -2048,7 +2050,7 @@ void MainWindow::RescanSongs() {
|
|||||||
SongList songs;
|
SongList songs;
|
||||||
|
|
||||||
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
const QModelIndex source_index = app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
if (!source_index.isValid()) continue;
|
if (!source_index.isValid()) continue;
|
||||||
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(source_index.row()));
|
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(source_index.row()));
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
@@ -2073,7 +2075,7 @@ void MainWindow::EditTracks() {
|
|||||||
PlaylistItemList items;
|
PlaylistItemList items;
|
||||||
|
|
||||||
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
const QModelIndex source_index = app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
if (!source_index.isValid()) continue;
|
if (!source_index.isValid()) continue;
|
||||||
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(source_index.row()));
|
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(source_index.row()));
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
@@ -2120,7 +2122,7 @@ void MainWindow::RenumberTracks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const QModelIndex &proxy_index : indexes) {
|
for (const QModelIndex &proxy_index : indexes) {
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
const QModelIndex source_index = app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
if (!source_index.isValid()) continue;
|
if (!source_index.isValid()) continue;
|
||||||
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
@@ -2151,7 +2153,7 @@ void MainWindow::SelectionSetValue() {
|
|||||||
QVariant column_value = app_->playlist_manager()->current()->data(playlist_menu_index_);
|
QVariant column_value = app_->playlist_manager()->current()->data(playlist_menu_index_);
|
||||||
|
|
||||||
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
const QModelIndex source_index = app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
if (!source_index.isValid()) continue;
|
if (!source_index.isValid()) continue;
|
||||||
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
@@ -2265,7 +2267,7 @@ void MainWindow::ShowInCollection() {
|
|||||||
|
|
||||||
SongList songs;
|
SongList songs;
|
||||||
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
const QModelIndex source_index = app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
if (!source_index.isValid()) continue;
|
if (!source_index.isValid()) continue;
|
||||||
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||||
if (item && item->IsLocalCollectionItem()) {
|
if (item && item->IsLocalCollectionItem()) {
|
||||||
@@ -2518,7 +2520,7 @@ void MainWindow::AddFilesToTranscoder() {
|
|||||||
QStringList filenames;
|
QStringList filenames;
|
||||||
|
|
||||||
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
const QModelIndex source_index = app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
if (!source_index.isValid()) continue;
|
if (!source_index.isValid()) continue;
|
||||||
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(source_index.row()));
|
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(source_index.row()));
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
@@ -2630,7 +2632,7 @@ void MainWindow::PlaylistOrganizeSelected(const bool copy) {
|
|||||||
|
|
||||||
SongList songs;
|
SongList songs;
|
||||||
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
const QModelIndex source_index = app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
if (!source_index.isValid()) continue;
|
if (!source_index.isValid()) continue;
|
||||||
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
@@ -2652,7 +2654,7 @@ void MainWindow::PlaylistOpenInBrowser() {
|
|||||||
|
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
const QModelIndex source_index = app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
if (!source_index.isValid()) continue;
|
if (!source_index.isValid()) continue;
|
||||||
urls << QUrl(source_index.sibling(source_index.row(), Playlist::Column_Filename).data().toString());
|
urls << QUrl(source_index.sibling(source_index.row(), Playlist::Column_Filename).data().toString());
|
||||||
}
|
}
|
||||||
@@ -2665,7 +2667,7 @@ void MainWindow::PlaylistCopyUrl() {
|
|||||||
|
|
||||||
QList<QUrl> urls;
|
QList<QUrl> urls;
|
||||||
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
const QModelIndex source_index = app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
if (!source_index.isValid()) continue;
|
if (!source_index.isValid()) continue;
|
||||||
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
@@ -2686,7 +2688,7 @@ void MainWindow::PlaylistQueue() {
|
|||||||
QModelIndexList indexes;
|
QModelIndexList indexes;
|
||||||
indexes.reserve(selected_rows.count());
|
indexes.reserve(selected_rows.count());
|
||||||
for (const QModelIndex &proxy_index : selected_rows) {
|
for (const QModelIndex &proxy_index : selected_rows) {
|
||||||
indexes << app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
indexes << app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
app_->playlist_manager()->current()->queue()->ToggleTracks(indexes);
|
app_->playlist_manager()->current()->queue()->ToggleTracks(indexes);
|
||||||
@@ -2699,7 +2701,7 @@ void MainWindow::PlaylistQueuePlayNext() {
|
|||||||
QModelIndexList indexes;
|
QModelIndexList indexes;
|
||||||
indexes.reserve(selected_rows.count());
|
indexes.reserve(selected_rows.count());
|
||||||
for (const QModelIndex &proxy_index : selected_rows) {
|
for (const QModelIndex &proxy_index : selected_rows) {
|
||||||
indexes << app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
indexes << app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
app_->playlist_manager()->current()->queue()->InsertFirst(indexes);
|
app_->playlist_manager()->current()->queue()->InsertFirst(indexes);
|
||||||
@@ -2712,7 +2714,7 @@ void MainWindow::PlaylistSkip() {
|
|||||||
QModelIndexList indexes;
|
QModelIndexList indexes;
|
||||||
indexes.reserve(selected_rows.count());
|
indexes.reserve(selected_rows.count());
|
||||||
for (const QModelIndex &proxy_index : selected_rows) {
|
for (const QModelIndex &proxy_index : selected_rows) {
|
||||||
indexes << app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
indexes << app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
app_->playlist_manager()->current()->SkipTracks(indexes);
|
app_->playlist_manager()->current()->SkipTracks(indexes);
|
||||||
@@ -2726,7 +2728,7 @@ void MainWindow::PlaylistCopyToDevice() {
|
|||||||
SongList songs;
|
SongList songs;
|
||||||
|
|
||||||
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
const QModelIndex source_index = app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
if (!source_index.isValid()) continue;
|
if (!source_index.isValid()) continue;
|
||||||
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_index.row());
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
@@ -2750,16 +2752,16 @@ void MainWindow::PlaylistCopyToDevice() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::ChangeCollectionQueryMode(QAction *action) {
|
void MainWindow::ChangeCollectionFilterMode(QAction *action) {
|
||||||
|
|
||||||
if (action == collection_show_duplicates_) {
|
if (action == collection_show_duplicates_) {
|
||||||
collection_view_->filter_widget()->SetQueryMode(QueryOptions::QueryMode_Duplicates);
|
collection_view_->filter_widget()->SetFilterMode(CollectionFilterOptions::FilterMode_Duplicates);
|
||||||
}
|
}
|
||||||
else if (action == collection_show_untagged_) {
|
else if (action == collection_show_untagged_) {
|
||||||
collection_view_->filter_widget()->SetQueryMode(QueryOptions::QueryMode_Untagged);
|
collection_view_->filter_widget()->SetFilterMode(CollectionFilterOptions::FilterMode_Untagged);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
collection_view_->filter_widget()->SetQueryMode(QueryOptions::QueryMode_All);
|
collection_view_->filter_widget()->SetFilterMode(CollectionFilterOptions::FilterMode_All);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2875,7 +2877,7 @@ void MainWindow::PlaylistViewSelectionModelChanged() {
|
|||||||
|
|
||||||
void MainWindow::PlaylistCurrentChanged(const QModelIndex &proxy_current) {
|
void MainWindow::PlaylistCurrentChanged(const QModelIndex &proxy_current) {
|
||||||
|
|
||||||
const QModelIndex source_current = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_current);
|
const QModelIndex source_current = app_->playlist_manager()->current()->filter()->mapToSource(proxy_current);
|
||||||
|
|
||||||
// If the user moves the current index using the keyboard and then presses
|
// If the user moves the current index using the keyboard and then presses
|
||||||
// F2, we don't want that editing the last column that was right clicked on.
|
// F2, we don't want that editing the last column that was right clicked on.
|
||||||
@@ -2927,7 +2929,7 @@ void MainWindow::AutoCompleteTags() {
|
|||||||
// Get the selected songs and start fetching tags for them
|
// Get the selected songs and start fetching tags for them
|
||||||
SongList songs;
|
SongList songs;
|
||||||
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
for (const QModelIndex &proxy_index : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
const QModelIndex source_index = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_index);
|
const QModelIndex source_index = app_->playlist_manager()->current()->filter()->mapToSource(proxy_index);
|
||||||
if (!source_index.isValid()) continue;
|
if (!source_index.isValid()) continue;
|
||||||
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(source_index.row()));
|
PlaylistItemPtr item(app_->playlist_manager()->current()->item_at(source_index.row()));
|
||||||
if (!item) continue;
|
if (!item) continue;
|
||||||
@@ -3117,12 +3119,12 @@ void MainWindow::SetToggleScrobblingIcon(const bool value) {
|
|||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
if (app_->playlist_manager()->active() && app_->playlist_manager()->active()->scrobbled())
|
if (app_->playlist_manager()->active() && app_->playlist_manager()->active()->scrobbled())
|
||||||
ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("scrobble", 22));
|
ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("scrobble", true, 22));
|
||||||
else
|
else
|
||||||
ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("scrobble", 22)); // TODO: Create a faint version of the icon
|
ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("scrobble", true, 22)); // TODO: Create a faint version of the icon
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("scrobble-disabled", 22));
|
ui_->action_toggle_scrobbling->setIcon(IconLoader::Load("scrobble-disabled", true, 22));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3144,7 +3146,7 @@ void MainWindow::PlaylistDelete() {
|
|||||||
QStringList files;
|
QStringList files;
|
||||||
bool is_current_item = false;
|
bool is_current_item = false;
|
||||||
for (const QModelIndex &proxy_idx : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
for (const QModelIndex &proxy_idx : ui_->playlist->view()->selectionModel()->selectedRows()) {
|
||||||
QModelIndex source_idx = app_->playlist_manager()->current()->proxy()->mapToSource(proxy_idx);
|
QModelIndex source_idx = app_->playlist_manager()->current()->filter()->mapToSource(proxy_idx);
|
||||||
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_idx.row());
|
PlaylistItemPtr item = app_->playlist_manager()->current()->item_at(source_idx.row());
|
||||||
if (!item || !item->Metadata().url().isLocalFile()) continue;
|
if (!item || !item->Metadata().url().isLocalFile()) continue;
|
||||||
QString filename = item->Metadata().url().toLocalFile();
|
QString filename = item->Metadata().url().toLocalFile();
|
||||||
@@ -3167,7 +3169,7 @@ void MainWindow::PlaylistDelete() {
|
|||||||
app_->player()->Next();
|
app_->player()->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<MusicStorage> storage = std::make_shared<FilesystemMusicStorage>("/");
|
std::shared_ptr<MusicStorage> storage = std::make_shared<FilesystemMusicStorage>(Song::Source_LocalFile, "/");
|
||||||
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, &MainWindow::DeleteFinished);
|
//QObject::connect(delete_files, &DeleteFiles::Finished, this, &MainWindow::DeleteFinished);
|
||||||
delete_files->Start(selected_songs);
|
delete_files->Start(selected_songs);
|
||||||
|
|||||||
@@ -48,12 +48,12 @@
|
|||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QtEvents>
|
#include <QtEvents>
|
||||||
|
|
||||||
#include "core/lazy.h"
|
#include "lazy.h"
|
||||||
#include "core/tagreaderclient.h"
|
#include "platforminterface.h"
|
||||||
#include "core/song.h"
|
#include "song.h"
|
||||||
|
#include "tagreaderclient.h"
|
||||||
#include "engine/enginetype.h"
|
#include "engine/enginetype.h"
|
||||||
#include "engine/engine_fwd.h"
|
#include "engine/engine_fwd.h"
|
||||||
#include "mac_startup.h"
|
|
||||||
#include "osd/osdbase.h"
|
#include "osd/osdbase.h"
|
||||||
#include "collection/collectionmodel.h"
|
#include "collection/collectionmodel.h"
|
||||||
#include "playlist/playlist.h"
|
#include "playlist/playlist.h"
|
||||||
@@ -180,14 +180,14 @@ class MainWindow : public QMainWindow, public PlatformInterface {
|
|||||||
void PlaylistCopyUrl();
|
void PlaylistCopyUrl();
|
||||||
void ShowInCollection();
|
void ShowInCollection();
|
||||||
|
|
||||||
void ChangeCollectionQueryMode(QAction *action);
|
void ChangeCollectionFilterMode(QAction *action);
|
||||||
|
|
||||||
void PlayIndex(const QModelIndex &idx, Playlist::AutoScroll autoscroll);
|
void PlayIndex(const QModelIndex &idx, Playlist::AutoScroll autoscroll);
|
||||||
void PlaylistDoubleClick(const QModelIndex &idx);
|
void PlaylistDoubleClick(const QModelIndex &idx);
|
||||||
void StopAfterCurrent();
|
void StopAfterCurrent();
|
||||||
|
|
||||||
void SongChanged(const Song &song);
|
void SongChanged(const Song &song);
|
||||||
void VolumeChanged(const int volume);
|
void VolumeChanged(const uint volume);
|
||||||
|
|
||||||
void CopyFilesToCollection(const QList<QUrl> &urls);
|
void CopyFilesToCollection(const QList<QUrl> &urls);
|
||||||
void MoveFilesToCollection(const QList<QUrl> &urls);
|
void MoveFilesToCollection(const QList<QUrl> &urls);
|
||||||
|
|||||||
@@ -448,7 +448,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1131</width>
|
<width>1131</width>
|
||||||
<height>26</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menu_music">
|
<widget class="QMenu" name="menu_music">
|
||||||
@@ -750,7 +750,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="action_save_all_playlists">
|
<action name="action_save_all_playlists">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Save all playlists</string>
|
<string>&Save all playlists...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="action_next_playlist">
|
<action name="action_next_playlist">
|
||||||
@@ -903,7 +903,6 @@
|
|||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../data/data.qrc"/>
|
|
||||||
<include location="../../data/icons.qrc"/>
|
<include location="../../data/icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|||||||
@@ -71,13 +71,7 @@ struct tag_by_pointer {};
|
|||||||
|
|
||||||
class MergedProxyModelPrivate {
|
class MergedProxyModelPrivate {
|
||||||
private:
|
private:
|
||||||
typedef multi_index_container<
|
using MappingContainer = multi_index_container<Mapping *, indexed_by<hashed_unique<tag<tag_by_source>, member<Mapping, QModelIndex, &Mapping::source_index>>, ordered_unique<tag<tag_by_pointer>, identity<Mapping *>>>>;
|
||||||
Mapping*,
|
|
||||||
indexed_by<
|
|
||||||
hashed_unique<tag<tag_by_source>,
|
|
||||||
member<Mapping, QModelIndex, &Mapping::source_index> >,
|
|
||||||
ordered_unique<tag<tag_by_pointer>, identity<Mapping*> > > >
|
|
||||||
MappingContainer;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MappingContainer mappings_;
|
MappingContainer mappings_;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
#ifdef HAVE_GSTREAMER
|
#ifdef HAVE_GSTREAMER
|
||||||
# include "engine/gstenginepipeline.h"
|
# include "engine/gstenginepipeline.h"
|
||||||
#endif
|
#endif
|
||||||
#include "collection/directory.h"
|
#include "collection/collectiondirectory.h"
|
||||||
#include "playlist/playlistitem.h"
|
#include "playlist/playlistitem.h"
|
||||||
#include "playlist/playlistsequence.h"
|
#include "playlist/playlistsequence.h"
|
||||||
#include "covermanager/albumcoverloaderresult.h"
|
#include "covermanager/albumcoverloaderresult.h"
|
||||||
@@ -98,10 +98,10 @@ void RegisterMetaTypes() {
|
|||||||
qRegisterMetaTypeStreamOperators<QMap<int, Qt::Alignment>>("ColumnAlignmentMap");
|
qRegisterMetaTypeStreamOperators<QMap<int, Qt::Alignment>>("ColumnAlignmentMap");
|
||||||
qRegisterMetaTypeStreamOperators<QMap<int, int>>("ColumnAlignmentIntMap");
|
qRegisterMetaTypeStreamOperators<QMap<int, int>>("ColumnAlignmentIntMap");
|
||||||
#endif
|
#endif
|
||||||
qRegisterMetaType<Directory>("Directory");
|
qRegisterMetaType<CollectionDirectory>("Directory");
|
||||||
qRegisterMetaType<DirectoryList>("DirectoryList");
|
qRegisterMetaType<CollectionDirectoryList>("DirectoryList");
|
||||||
qRegisterMetaType<Subdirectory>("Subdirectory");
|
qRegisterMetaType<CollectionSubdirectory>("Subdirectory");
|
||||||
qRegisterMetaType<SubdirectoryList>("SubdirectoryList");
|
qRegisterMetaType<CollectionSubdirectoryList>("SubdirectoryList");
|
||||||
qRegisterMetaType<Song>("Song");
|
qRegisterMetaType<Song>("Song");
|
||||||
qRegisterMetaType<SongList>("SongList");
|
qRegisterMetaType<SongList>("SongList");
|
||||||
qRegisterMetaType<SongMap>("SongMap");
|
qRegisterMetaType<SongMap>("SongMap");
|
||||||
|
|||||||
@@ -21,9 +21,8 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <memory>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -41,17 +40,16 @@
|
|||||||
#include <QDBusMessage>
|
#include <QDBusMessage>
|
||||||
#include <QDBusArgument>
|
#include <QDBusArgument>
|
||||||
#include <QDBusObjectPath>
|
#include <QDBusObjectPath>
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
|
|
||||||
#include "mpris_common.h"
|
#include "mpris_common.h"
|
||||||
#include "mpris2.h"
|
#include "mpris2.h"
|
||||||
|
|
||||||
#include "timeconstants.h"
|
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
#include "player.h"
|
#include "player.h"
|
||||||
|
#include "utilities/timeconstants.h"
|
||||||
#include "engine/enginebase.h"
|
#include "engine/enginebase.h"
|
||||||
#include "playlist/playlist.h"
|
#include "playlist/playlist.h"
|
||||||
#include "playlist/playlistitem.h"
|
#include "playlist/playlistitem.h"
|
||||||
@@ -60,10 +58,10 @@
|
|||||||
#include "covermanager/currentalbumcoverloader.h"
|
#include "covermanager/currentalbumcoverloader.h"
|
||||||
#include "covermanager/albumcoverloaderresult.h"
|
#include "covermanager/albumcoverloaderresult.h"
|
||||||
|
|
||||||
#include <core/mpris2_player.h>
|
#include "mpris2_player.h"
|
||||||
#include <core/mpris2_playlists.h>
|
#include "mpris2_playlists.h"
|
||||||
#include <core/mpris2_root.h>
|
#include "mpris2_root.h"
|
||||||
#include <core/mpris2_tracklist.h>
|
#include "mpris2_tracklist.h"
|
||||||
|
|
||||||
QDBusArgument &operator<<(QDBusArgument &arg, const MprisPlaylist &playlist) {
|
QDBusArgument &operator<<(QDBusArgument &arg, const MprisPlaylist &playlist) {
|
||||||
arg.beginStructure();
|
arg.beginStructure();
|
||||||
@@ -178,7 +176,9 @@ void Mpris2::EngineStateChanged(Engine::State newState) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mpris2::VolumeChanged() { EmitNotification("Volume"); }
|
void Mpris2::VolumeChanged() {
|
||||||
|
EmitNotification("Volume");
|
||||||
|
}
|
||||||
|
|
||||||
void Mpris2::ShuffleModeChanged() { EmitNotification("Shuffle"); }
|
void Mpris2::ShuffleModeChanged() { EmitNotification("Shuffle"); }
|
||||||
|
|
||||||
@@ -190,15 +190,15 @@ void Mpris2::RepeatModeChanged() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mpris2::EmitNotification(const QString &name, const QVariant &val) {
|
void Mpris2::EmitNotification(const QString &name, const QVariant &value) {
|
||||||
EmitNotification(name, val, "org.mpris.MediaPlayer2.Player");
|
EmitNotification(name, value, "org.mpris.MediaPlayer2.Player");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mpris2::EmitNotification(const QString &name, const QVariant &val, const QString &mprisEntity) {
|
void Mpris2::EmitNotification(const QString &name, const QVariant &value, const QString &mprisEntity) {
|
||||||
|
|
||||||
QDBusMessage msg = QDBusMessage::createSignal(kMprisObjectPath, kFreedesktopPath, "PropertiesChanged");
|
QDBusMessage msg = QDBusMessage::createSignal(kMprisObjectPath, kFreedesktopPath, "PropertiesChanged");
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
map.insert(name, val);
|
map.insert(name, value);
|
||||||
QVariantList args = QVariantList() << mprisEntity << map << QStringList();
|
QVariantList args = QVariantList() << mprisEntity << map << QStringList();
|
||||||
msg.setArguments(args);
|
msg.setArguments(args);
|
||||||
QDBusConnection::sessionBus().send(msg);
|
QDBusConnection::sessionBus().send(msg);
|
||||||
@@ -401,6 +401,13 @@ void Mpris2::AlbumCoverLoaded(const Song &song, const AlbumCoverLoaderResult &re
|
|||||||
else if (result.temp_cover_url.isValid() && result.temp_cover_url.isLocalFile()) {
|
else if (result.temp_cover_url.isValid() && result.temp_cover_url.isLocalFile()) {
|
||||||
cover_url = result.temp_cover_url;
|
cover_url = result.temp_cover_url;
|
||||||
}
|
}
|
||||||
|
else if (song.art_manual().isValid() && song.art_manual().isLocalFile() && song.art_manual().path() != Song::kManuallyUnsetCover && song.art_manual().path() != Song::kEmbeddedCover) {
|
||||||
|
cover_url = song.art_manual();
|
||||||
|
}
|
||||||
|
else if (song.art_automatic().isValid() && song.art_automatic().isLocalFile() && song.art_automatic().path() != Song::kManuallyUnsetCover && song.art_automatic().path() != Song::kEmbeddedCover) {
|
||||||
|
cover_url = song.art_automatic();
|
||||||
|
}
|
||||||
|
|
||||||
if (cover_url.isValid()) AddMetadata("mpris:artUrl", cover_url.toString(), &last_metadata_);
|
if (cover_url.isValid()) AddMetadata("mpris:artUrl", cover_url.toString(), &last_metadata_);
|
||||||
|
|
||||||
AddMetadata("year", song.year(), &last_metadata_);
|
AddMetadata("year", song.year(), &last_metadata_);
|
||||||
@@ -414,8 +421,8 @@ double Mpris2::Volume() const {
|
|||||||
return app_->player()->GetVolume() / 100.0;
|
return app_->player()->GetVolume() / 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mpris2::SetVolume(const double value) {
|
void Mpris2::SetVolume(const double volume) {
|
||||||
app_->player()->SetVolume(static_cast<uint>(std::max(std::min(lround(value * 100.0), 100L), 0L)));
|
app_->player()->SetVolume(static_cast<uint>(qBound(0L, lround(volume * 100.0), 100L)));
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 Mpris2::Position() const {
|
qint64 Mpris2::Position() const {
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ class Application;
|
|||||||
class Song;
|
class Song;
|
||||||
class Playlist;
|
class Playlist;
|
||||||
|
|
||||||
typedef QList<QVariantMap> TrackMetadata;
|
using TrackMetadata = QList<QVariantMap>;
|
||||||
typedef QList<QDBusObjectPath> Track_Ids;
|
using Track_Ids = QList<QDBusObjectPath>;
|
||||||
Q_DECLARE_METATYPE(TrackMetadata)
|
Q_DECLARE_METATYPE(TrackMetadata)
|
||||||
|
|
||||||
struct MprisPlaylist {
|
struct MprisPlaylist {
|
||||||
@@ -54,7 +54,7 @@ struct MprisPlaylist {
|
|||||||
QString name;
|
QString name;
|
||||||
QString icon; // Uri
|
QString icon; // Uri
|
||||||
};
|
};
|
||||||
typedef QList<MprisPlaylist> MprisPlaylistList;
|
using MprisPlaylistList = QList<MprisPlaylist>;
|
||||||
Q_DECLARE_METATYPE(MprisPlaylist)
|
Q_DECLARE_METATYPE(MprisPlaylist)
|
||||||
Q_DECLARE_METATYPE(MprisPlaylistList)
|
Q_DECLARE_METATYPE(MprisPlaylistList)
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ class Mpris2 : public QObject {
|
|||||||
void SetShuffle(bool enable);
|
void SetShuffle(bool enable);
|
||||||
QVariantMap Metadata() const;
|
QVariantMap Metadata() const;
|
||||||
double Volume() const;
|
double Volume() const;
|
||||||
void SetVolume(const double value);
|
void SetVolume(const double volume);
|
||||||
qint64 Position() const;
|
qint64 Position() const;
|
||||||
double MaximumRate() const;
|
double MaximumRate() const;
|
||||||
double MinimumRate() const;
|
double MinimumRate() const;
|
||||||
@@ -215,8 +215,8 @@ class Mpris2 : public QObject {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void EmitNotification(const QString &name);
|
void EmitNotification(const QString &name);
|
||||||
void EmitNotification(const QString &name, const QVariant &val);
|
void EmitNotification(const QString &name, const QVariant &value);
|
||||||
void EmitNotification(const QString &name, const QVariant &val, const QString &mprisEntity);
|
void EmitNotification(const QString &name, const QVariant &value, const QString &mprisEntity);
|
||||||
|
|
||||||
QString PlaybackStatus(Engine::State state) const;
|
QString PlaybackStatus(Engine::State state) const;
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class MultiSortFilterProxy : public QSortFilterProxyModel {
|
|||||||
private:
|
private:
|
||||||
int Compare(const QVariant &left, const QVariant &right) const;
|
int Compare(const QVariant &left, const QVariant &right) const;
|
||||||
|
|
||||||
typedef QPair<int, Qt::SortOrder> SortSpec;
|
using SortSpec = QPair<int, Qt::SortOrder>;
|
||||||
QList<SortSpec> sorting_;
|
QList<SortSpec> sorting_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QImage>
|
||||||
|
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ class MusicStorage {
|
|||||||
Transcode_Unsupported = 3,
|
Transcode_Unsupported = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::function<void(float progress)> ProgressFunction;
|
using ProgressFunction = std::function<void(float progress)>;
|
||||||
|
|
||||||
struct CopyJob {
|
struct CopyJob {
|
||||||
CopyJob() : overwrite_(false), remove_original_(false), albumcover_(false) {}
|
CopyJob() : overwrite_(false), remove_original_(false), albumcover_(false) {}
|
||||||
@@ -67,6 +68,7 @@ class MusicStorage {
|
|||||||
bool albumcover_;
|
bool albumcover_;
|
||||||
QString cover_source_;
|
QString cover_source_;
|
||||||
QString cover_dest_;
|
QString cover_dest_;
|
||||||
|
QImage cover_image_;
|
||||||
ProgressFunction progress_;
|
ProgressFunction progress_;
|
||||||
QString playlist_;
|
QString playlist_;
|
||||||
};
|
};
|
||||||
@@ -77,6 +79,7 @@ class MusicStorage {
|
|||||||
bool use_trash_;
|
bool use_trash_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual Song::Source source() const = 0;
|
||||||
virtual QString LocalPath() const { return QString(); }
|
virtual QString LocalPath() const { return QString(); }
|
||||||
virtual std::optional<int> collection_directory_id() const { return std::optional<int>(); }
|
virtual std::optional<int> collection_directory_id() const { return std::optional<int>(); }
|
||||||
|
|
||||||
|
|||||||
@@ -22,12 +22,10 @@
|
|||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
#include <QVariant>
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QNetworkProxy>
|
#include <QNetworkProxy>
|
||||||
#include <QtDebug>
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QTimerEvent>
|
#include <QTimerEvent>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Strawberry Music Player
|
* Strawberry Music Player
|
||||||
* This file was part of Clementine.
|
* Copyright 2010, David Sansome <me@davidsansome.com>
|
||||||
* Copyright 2012, Arnaud Bienner <arnaud.bienner@gmail.com>
|
* Copyright 2018-2021, Jonas Kvinge <jonas@jkvinge.net>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -18,31 +18,23 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef APPEARANCE_H
|
#ifndef PLATFORMINTERFACE_H
|
||||||
#define APPEARANCE_H
|
#define PLATFORMINTERFACE_H
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QColor>
|
#include <QString>
|
||||||
#include <QPalette>
|
|
||||||
|
|
||||||
class Appearance : public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
|
class PlatformInterface {
|
||||||
public:
|
public:
|
||||||
explicit Appearance(QObject *parent = nullptr);
|
PlatformInterface() = default;
|
||||||
|
virtual ~PlatformInterface() {}
|
||||||
|
|
||||||
static const QPalette kDefaultPalette;
|
// Called when the application should show itself.
|
||||||
|
virtual void Activate() = 0;
|
||||||
void LoadUserTheme();
|
virtual bool LoadUrl(const QString &url) = 0;
|
||||||
static void ResetToSystemDefaultTheme();
|
|
||||||
void ChangeForegroundColor(const QColor &color);
|
|
||||||
void ChangeBackgroundColor(const QColor &color);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QColor foreground_color_;
|
Q_DISABLE_COPY(PlatformInterface)
|
||||||
QColor background_color_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // APPEARANCE_H
|
#endif // PLATFORMINTERFACE_H
|
||||||
@@ -28,20 +28,17 @@
|
|||||||
|
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSortFilterProxyModel>
|
|
||||||
#include <QList>
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
|
#include "utilities/timeconstants.h"
|
||||||
|
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
#include "timeconstants.h"
|
|
||||||
#include "urlhandler.h"
|
#include "urlhandler.h"
|
||||||
#include "application.h"
|
#include "application.h"
|
||||||
|
|
||||||
@@ -58,6 +55,7 @@
|
|||||||
|
|
||||||
#include "collection/collectionbackend.h"
|
#include "collection/collectionbackend.h"
|
||||||
#include "playlist/playlist.h"
|
#include "playlist/playlist.h"
|
||||||
|
#include "playlist/playlistfilter.h"
|
||||||
#include "playlist/playlistitem.h"
|
#include "playlist/playlistitem.h"
|
||||||
#include "playlist/playlistmanager.h"
|
#include "playlist/playlistmanager.h"
|
||||||
#include "playlist/playlistsequence.h"
|
#include "playlist/playlistsequence.h"
|
||||||
@@ -85,29 +83,24 @@ Player::Player(Application *app, QObject *parent)
|
|||||||
autoscroll_(Playlist::AutoScroll_Maybe),
|
autoscroll_(Playlist::AutoScroll_Maybe),
|
||||||
last_state_(Engine::Empty),
|
last_state_(Engine::Empty),
|
||||||
nb_errors_received_(0),
|
nb_errors_received_(0),
|
||||||
|
volume_(100),
|
||||||
volume_before_mute_(100),
|
volume_before_mute_(100),
|
||||||
last_pressed_previous_(QDateTime::currentDateTime()),
|
last_pressed_previous_(QDateTime::currentDateTime()),
|
||||||
continue_on_error_(false),
|
continue_on_error_(false),
|
||||||
greyout_(true),
|
greyout_(true),
|
||||||
menu_previousmode_(BehaviourSettingsPage::PreviousBehaviour_DontRestart),
|
menu_previousmode_(BehaviourSettingsPage::PreviousBehaviour_DontRestart),
|
||||||
seek_step_sec_(10),
|
seek_step_sec_(10),
|
||||||
volume_control_(true),
|
|
||||||
play_offset_nanosec_(0) {
|
play_offset_nanosec_(0) {
|
||||||
|
|
||||||
settings_.beginGroup(kSettingsGroup);
|
|
||||||
|
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(BackendSettingsPage::kSettingsGroup);
|
s.beginGroup(BackendSettingsPage::kSettingsGroup);
|
||||||
Engine::EngineType enginetype = Engine::EngineTypeFromName(s.value("engine", EngineName(Engine::GStreamer)).toString().toLower());
|
Engine::EngineType enginetype = Engine::EngineTypeFromName(s.value("engine", EngineName(Engine::GStreamer)).toString().toLower());
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
CreateEngine(enginetype);
|
CreateEngine(enginetype);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Player::~Player() {
|
|
||||||
settings_.endGroup();
|
|
||||||
}
|
|
||||||
|
|
||||||
Engine::EngineType Player::CreateEngine(Engine::EngineType enginetype) {
|
Engine::EngineType Player::CreateEngine(Engine::EngineType enginetype) {
|
||||||
|
|
||||||
Engine::EngineType use_enginetype(Engine::None);
|
Engine::EngineType use_enginetype(Engine::None);
|
||||||
@@ -183,6 +176,7 @@ void Player::Init() {
|
|||||||
QObject::connect(engine_.get(), &EngineBase::TrackAboutToEnd, this, &Player::TrackAboutToEnd);
|
QObject::connect(engine_.get(), &EngineBase::TrackAboutToEnd, this, &Player::TrackAboutToEnd);
|
||||||
QObject::connect(engine_.get(), &EngineBase::TrackEnded, this, &Player::TrackEnded);
|
QObject::connect(engine_.get(), &EngineBase::TrackEnded, this, &Player::TrackEnded);
|
||||||
QObject::connect(engine_.get(), &EngineBase::MetaData, this, &Player::EngineMetadataReceived);
|
QObject::connect(engine_.get(), &EngineBase::MetaData, this, &Player::EngineMetadataReceived);
|
||||||
|
QObject::connect(engine_.get(), &EngineBase::VolumeChanged, this, &Player::SetVolumeFromEngine);
|
||||||
|
|
||||||
// Equalizer
|
// Equalizer
|
||||||
QObject::connect(equalizer_, &Equalizer::StereoBalancerEnabledChanged, app_->player()->engine(), &EngineBase::SetStereoBalancerEnabled);
|
QObject::connect(equalizer_, &Equalizer::StereoBalancerEnabledChanged, app_->player()->engine(), &EngineBase::SetStereoBalancerEnabled);
|
||||||
@@ -195,17 +189,10 @@ void Player::Init() {
|
|||||||
engine_->SetEqualizerEnabled(equalizer_->is_equalizer_enabled());
|
engine_->SetEqualizerEnabled(equalizer_->is_equalizer_enabled());
|
||||||
engine_->SetEqualizerParameters(equalizer_->preamp_value(), equalizer_->gain_values());
|
engine_->SetEqualizerParameters(equalizer_->preamp_value(), equalizer_->gain_values());
|
||||||
|
|
||||||
s.beginGroup(BackendSettingsPage::kSettingsGroup);
|
|
||||||
volume_control_ = s.value("volume_control", true).toBool();
|
|
||||||
s.endGroup();
|
|
||||||
|
|
||||||
if (volume_control_) {
|
|
||||||
int volume = settings_.value("volume", 100).toInt();
|
|
||||||
SetVolume(volume);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReloadSettings();
|
ReloadSettings();
|
||||||
|
|
||||||
|
LoadVolume();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::ReloadSettings() {
|
void Player::ReloadSettings() {
|
||||||
@@ -222,12 +209,27 @@ void Player::ReloadSettings() {
|
|||||||
seek_step_sec_ = s.value("seek_step_sec", 10).toInt();
|
seek_step_sec_ = s.value("seek_step_sec", 10).toInt();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
s.beginGroup(BackendSettingsPage::kSettingsGroup);
|
engine_->ReloadSettings();
|
||||||
bool volume_control = s.value("volume_control", true).toBool();
|
|
||||||
if (!volume_control && GetVolume() != 100) SetVolume(100);
|
}
|
||||||
|
|
||||||
|
void Player::LoadVolume() {
|
||||||
|
|
||||||
|
QSettings s;
|
||||||
|
s.beginGroup(kSettingsGroup);
|
||||||
|
const uint volume = s.value("volume", 100).toInt();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
engine_->ReloadSettings();
|
SetVolume(volume);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::SaveVolume() {
|
||||||
|
|
||||||
|
QSettings s;
|
||||||
|
s.beginGroup(kSettingsGroup);
|
||||||
|
s.setValue("volume", volume_);
|
||||||
|
s.endGroup();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,7 +387,7 @@ void Player::NextItem(const Engine::TrackChangeFlags change, const Playlist::Aut
|
|||||||
if (change == Engine::Auto) {
|
if (change == Engine::Auto) {
|
||||||
const PlaylistSequence::RepeatMode repeat_mode = active_playlist->sequence()->repeat_mode();
|
const PlaylistSequence::RepeatMode repeat_mode = active_playlist->sequence()->repeat_mode();
|
||||||
if (repeat_mode != PlaylistSequence::Repeat_Off) {
|
if (repeat_mode != PlaylistSequence::Repeat_Off) {
|
||||||
if ((repeat_mode == PlaylistSequence::Repeat_Track && nb_errors_received_ >= 3) || (nb_errors_received_ >= app_->playlist_manager()->active()->proxy()->rowCount())) {
|
if ((repeat_mode == PlaylistSequence::Repeat_Track && nb_errors_received_ >= 3) || (nb_errors_received_ >= app_->playlist_manager()->active()->filter()->rowCount())) {
|
||||||
// We received too many "Error" state changes: probably looping over a playlist which contains only unavailable elements: stop now.
|
// We received too many "Error" state changes: probably looping over a playlist which contains only unavailable elements: stop now.
|
||||||
nb_errors_received_ = 0;
|
nb_errors_received_ = 0;
|
||||||
Stop();
|
Stop();
|
||||||
@@ -448,7 +450,7 @@ void Player::PlayPlaylistInternal(const Engine::TrackChangeFlags change, const P
|
|||||||
bool Player::HandleStopAfter(const Playlist::AutoScroll autoscroll) {
|
bool Player::HandleStopAfter(const Playlist::AutoScroll autoscroll) {
|
||||||
|
|
||||||
if (app_->playlist_manager()->active()->stop_after_current()) {
|
if (app_->playlist_manager()->active()->stop_after_current()) {
|
||||||
// Find what the next track would've been, and mark that one as current so it plays next time the user presses Play.
|
// Find what the next track would've been, and mark that one as current, so it plays next time the user presses Play.
|
||||||
const int next_row = app_->playlist_manager()->active()->next_row();
|
const int next_row = app_->playlist_manager()->active()->next_row();
|
||||||
if (next_row != -1) {
|
if (next_row != -1) {
|
||||||
app_->playlist_manager()->active()->set_current_row(next_row, autoscroll, true);
|
app_->playlist_manager()->active()->set_current_row(next_row, autoscroll, true);
|
||||||
@@ -604,7 +606,7 @@ void Player::PreviousItem(const Engine::TrackChangeFlags change) {
|
|||||||
|
|
||||||
void Player::EngineStateChanged(const Engine::State state) {
|
void Player::EngineStateChanged(const Engine::State state) {
|
||||||
|
|
||||||
if (Engine::Error == state) {
|
if (state == Engine::Error) {
|
||||||
nb_errors_received_++;
|
nb_errors_received_++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -624,7 +626,7 @@ void Player::EngineStateChanged(const Engine::State state) {
|
|||||||
break;
|
break;
|
||||||
case Engine::Error:
|
case Engine::Error:
|
||||||
emit Error();
|
emit Error();
|
||||||
// fallthrough
|
[[fallthrough]];
|
||||||
case Engine::Empty:
|
case Engine::Empty:
|
||||||
case Engine::Idle:
|
case Engine::Idle:
|
||||||
pause_time_ = QDateTime();
|
pause_time_ = QDateTime();
|
||||||
@@ -643,20 +645,38 @@ uint Player::GetVolume() const {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::SetVolume(const uint value) {
|
void Player::SetVolumeFromSlider(const int value) {
|
||||||
|
|
||||||
uint old_volume = engine_->volume();
|
const uint volume = static_cast<uint>(qBound(0, value, 100));
|
||||||
|
if (volume != volume_) {
|
||||||
uint volume = qBound(0U, value, 100U);
|
volume_ = volume;
|
||||||
settings_.setValue("volume", volume);
|
engine_->SetVolume(volume);
|
||||||
engine_->SetVolume(volume);
|
|
||||||
|
|
||||||
if (volume != old_volume) {
|
|
||||||
emit VolumeChanged(volume);
|
emit VolumeChanged(volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::SetVolumeFromEngine(const uint volume) {
|
||||||
|
|
||||||
|
const uint new_volume = qBound(0U, volume, 100U);
|
||||||
|
if (new_volume != volume_) {
|
||||||
|
volume_ = new_volume;
|
||||||
|
emit VolumeChanged(new_volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Player::SetVolume(const uint volume) {
|
||||||
|
|
||||||
|
const uint new_volume = qBound(0U, volume, 100U);
|
||||||
|
if (new_volume != volume_) {
|
||||||
|
volume_ = new_volume;
|
||||||
|
engine_->SetVolume(new_volume);
|
||||||
|
emit VolumeChanged(new_volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Player::VolumeUp() {
|
void Player::VolumeUp() {
|
||||||
|
|
||||||
uint old_volume = GetVolume();
|
uint old_volume = GetVolume();
|
||||||
@@ -791,8 +811,6 @@ PlaylistItemPtr Player::GetItemAt(const int pos) const {
|
|||||||
|
|
||||||
void Player::Mute() {
|
void Player::Mute() {
|
||||||
|
|
||||||
if (!volume_control_) return;
|
|
||||||
|
|
||||||
const uint current_volume = engine_->volume();
|
const uint current_volume = engine_->volume();
|
||||||
|
|
||||||
if (current_volume == 0) {
|
if (current_volume == 0) {
|
||||||
@@ -843,7 +861,7 @@ void Player::TrackAboutToEnd() {
|
|||||||
if (engine_->is_autocrossfade_enabled()) {
|
if (engine_->is_autocrossfade_enabled()) {
|
||||||
// Crossfade is on, so just start playing the next track. The current one will fade out, and the new one will fade in
|
// Crossfade is on, so just start playing the next track. The current one will fade out, and the new one will fade in
|
||||||
|
|
||||||
// But, if there's no next track and we don't want to fade out, then do nothing and just let the track finish to completion.
|
// But, if there's no next track, and we don't want to fade out, then do nothing and just let the track finish to completion.
|
||||||
if (!engine_->is_fadeout_enabled() && !has_next_row) return;
|
if (!engine_->is_fadeout_enabled() && !has_next_row) return;
|
||||||
|
|
||||||
// If the next track is on the same album (or same cue file),
|
// If the next track is on the same album (or same cue file),
|
||||||
@@ -854,7 +872,7 @@ void Player::TrackAboutToEnd() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Crossfade is off, so start preloading the next track so we don't get a gap between songs.
|
// Crossfade is off, so start preloading the next track, so we don't get a gap between songs.
|
||||||
if (!has_next_row || !next_item) return;
|
if (!has_next_row || !next_item) return;
|
||||||
|
|
||||||
QUrl url = next_item->StreamUrl();
|
QUrl url = next_item->StreamUrl();
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QSettings>
|
|
||||||
|
|
||||||
#include "urlhandler.h"
|
#include "urlhandler.h"
|
||||||
#include "engine/engine_fwd.h"
|
#include "engine/engine_fwd.h"
|
||||||
@@ -71,6 +70,8 @@ class PlayerInterface : public QObject {
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void ReloadSettings() = 0;
|
virtual void ReloadSettings() = 0;
|
||||||
|
virtual void LoadVolume() = 0;
|
||||||
|
virtual void SaveVolume() = 0;
|
||||||
|
|
||||||
// Manual track change to the specified track
|
// Manual track change to the specified track
|
||||||
virtual void PlayAt(const int index, const quint64 offset_nanosec, Engine::TrackChangeFlags change, const Playlist::AutoScroll autoscroll, const bool reshuffle, const bool force_inform = false) = 0;
|
virtual void PlayAt(const int index, const quint64 offset_nanosec, Engine::TrackChangeFlags change, const Playlist::AutoScroll autoscroll, const bool reshuffle, const bool force_inform = false) = 0;
|
||||||
@@ -84,7 +85,9 @@ class PlayerInterface : public QObject {
|
|||||||
virtual void Next() = 0;
|
virtual void Next() = 0;
|
||||||
virtual void Previous() = 0;
|
virtual void Previous() = 0;
|
||||||
virtual void PlayPlaylist(const QString &playlist_name) = 0;
|
virtual void PlayPlaylist(const QString &playlist_name) = 0;
|
||||||
virtual void SetVolume(const uint value) = 0;
|
virtual void SetVolumeFromEngine(const uint volume) = 0;
|
||||||
|
virtual void SetVolumeFromSlider(const int value) = 0;
|
||||||
|
virtual void SetVolume(const uint volume) = 0;
|
||||||
virtual void VolumeUp() = 0;
|
virtual void VolumeUp() = 0;
|
||||||
virtual void VolumeDown() = 0;
|
virtual void VolumeDown() = 0;
|
||||||
virtual void SeekTo(const quint64 seconds) = 0;
|
virtual void SeekTo(const quint64 seconds) = 0;
|
||||||
@@ -132,7 +135,6 @@ class Player : public PlayerInterface {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Player(Application *app, QObject *parent);
|
explicit Player(Application *app, QObject *parent);
|
||||||
~Player() override;
|
|
||||||
|
|
||||||
static const char *kSettingsGroup;
|
static const char *kSettingsGroup;
|
||||||
|
|
||||||
@@ -158,6 +160,8 @@ class Player : public PlayerInterface {
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ReloadSettings() override;
|
void ReloadSettings() override;
|
||||||
|
void LoadVolume() override;
|
||||||
|
void SaveVolume() override;
|
||||||
|
|
||||||
void PlayAt(const int index, const quint64 offset_nanosec, Engine::TrackChangeFlags change, const Playlist::AutoScroll autoscroll, const bool reshuffle, const bool force_inform = false) override;
|
void PlayAt(const int index, const quint64 offset_nanosec, Engine::TrackChangeFlags change, const Playlist::AutoScroll autoscroll, const bool reshuffle, const bool force_inform = false) override;
|
||||||
void PlayPause(const quint64 offset_nanosec = 0, const Playlist::AutoScroll autoscroll = Playlist::AutoScroll_Always) override;
|
void PlayPause(const quint64 offset_nanosec = 0, const Playlist::AutoScroll autoscroll = Playlist::AutoScroll_Always) override;
|
||||||
@@ -166,7 +170,9 @@ class Player : public PlayerInterface {
|
|||||||
void Next() override;
|
void Next() override;
|
||||||
void Previous() override;
|
void Previous() override;
|
||||||
void PlayPlaylist(const QString &playlist_name) override;
|
void PlayPlaylist(const QString &playlist_name) override;
|
||||||
void SetVolume(const uint value) override;
|
void SetVolumeFromSlider(const int value) override;
|
||||||
|
void SetVolumeFromEngine(const uint volume) override;
|
||||||
|
void SetVolume(const uint volume) override;
|
||||||
void VolumeUp() override;
|
void VolumeUp() override;
|
||||||
void VolumeDown() override;
|
void VolumeDown() override;
|
||||||
void SeekTo(const quint64 seconds) override;
|
void SeekTo(const quint64 seconds) override;
|
||||||
@@ -223,8 +229,6 @@ class Player : public PlayerInterface {
|
|||||||
AnalyzerContainer *analyzer_;
|
AnalyzerContainer *analyzer_;
|
||||||
Equalizer *equalizer_;
|
Equalizer *equalizer_;
|
||||||
|
|
||||||
QSettings settings_;
|
|
||||||
|
|
||||||
PlaylistItemPtr current_item_;
|
PlaylistItemPtr current_item_;
|
||||||
|
|
||||||
Engine::TrackChangeFlags stream_change_type_;
|
Engine::TrackChangeFlags stream_change_type_;
|
||||||
@@ -235,6 +239,7 @@ class Player : public PlayerInterface {
|
|||||||
QMap<QString, UrlHandler*> url_handlers_;
|
QMap<QString, UrlHandler*> url_handlers_;
|
||||||
|
|
||||||
QList<QUrl> loading_async_;
|
QList<QUrl> loading_async_;
|
||||||
|
uint volume_;
|
||||||
uint volume_before_mute_;
|
uint volume_before_mute_;
|
||||||
QDateTime last_pressed_previous_;
|
QDateTime last_pressed_previous_;
|
||||||
|
|
||||||
@@ -243,8 +248,6 @@ class Player : public PlayerInterface {
|
|||||||
BehaviourSettingsPage::PreviousBehaviour menu_previousmode_;
|
BehaviourSettingsPage::PreviousBehaviour menu_previousmode_;
|
||||||
int seek_step_sec_;
|
int seek_step_sec_;
|
||||||
|
|
||||||
bool volume_control_;
|
|
||||||
|
|
||||||
QDateTime pause_time_;
|
QDateTime pause_time_;
|
||||||
quint64 play_offset_nanosec_;
|
quint64 play_offset_nanosec_;
|
||||||
|
|
||||||
|
|||||||
@@ -29,12 +29,10 @@
|
|||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QSettings>
|
|
||||||
|
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
#include "iconloader.h"
|
#include "iconloader.h"
|
||||||
#include "qtsystemtrayicon.h"
|
#include "qtsystemtrayicon.h"
|
||||||
#include "settings/behavioursettingspage.h"
|
|
||||||
|
|
||||||
SystemTrayIcon::SystemTrayIcon(QObject *parent)
|
SystemTrayIcon::SystemTrayIcon(QObject *parent)
|
||||||
: QSystemTrayIcon(parent),
|
: QSystemTrayIcon(parent),
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user