| 1 | /* |
| 2 | Copyright (C) 2005-2014 Mario Stephan <[email protected]> |
| 3 | |
| 4 | This library is free software; you can redistribute it and/or modify |
| 5 | it under the terms of the GNU Lesser General Public License as published |
| 6 | by the Free Software Foundation; either version 2.1 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public License |
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #include "filter.h"cxx . . $ `<file>/src/filter.h`/ |
| 19 | #include <QtCore> |
| 20 | |
| 21 | |
| 22 | |
| 23 | struct Filtercxx . . $ Filter#::Privatecxx . . $ Filter#Private# |
| 24 | { |
| 25 | int maxUsagecxx . . $ Filter#Private#maxUsage.; |
| 26 | int usagecxx . . $ Filter#Private#usage.; |
| 27 | bool isActivecxx . . $ Filter#Private#isActive.; |
| 28 | QStringcxx . . $ QString# pathcxx . . $ Filter#Private#path.; |
| 29 | QStringcxx . . $ QString# genrecxx . . $ Filter#Private#genre.; |
| 30 | QStringcxx . . $ QString# artistcxx . . $ Filter#Private#artist.; |
| 31 | int countcxx . . $ Filter#Private#count.; |
| 32 | long lengthcxx . . $ Filter#Private#length.; |
| 33 | }; |
| 34 | |
| 35 | /* |
| 36 | * |
| 37 | *ToDo: - replace path with a string from Tag (if we have a good tagger tool inside) |
| 38 | **/ |
| 39 | |
| 40 | Filtercxx . . $ Filter#::Filtercxx . . $ Filter#Filter(49f6e7a06ebc5aa8).() |
| 41 | :pcxx . . $ Filter#p.(new Privatecxx . . $ Filter#Private#) |
| 42 | { |
| 43 | pcxx . . $ Filter#p.->usagecxx . . $ Filter#Private#usage. = 0; |
| 44 | pcxx . . $ Filter#p.->maxUsagecxx . . $ Filter#Private#maxUsage. = 0; |
| 45 | pcxx . . $ Filter#p.->countcxx . . $ Filter#Private#count. = 0; |
| 46 | pcxx . . $ Filter#p.->lengthcxx . . $ Filter#Private#length. = 0; |
| 47 | pcxx . . $ Filter#p.->pathcxx . . $ Filter#Private#path. =cxx . . $ QString#`operator=`(d02845eef0c33901). "", |
| 48 | pcxx . . $ Filter#p.->genrecxx . . $ Filter#Private#genre. =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 49 | pcxx . . $ Filter#p.->artistcxx . . $ Filter#Private#artist. =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 50 | pcxx . . $ Filter#p.->isActivecxx . . $ Filter#Private#isActive. = false; |
| 51 | } |
| 52 | |
| 53 | Filtercxx . . $ Filter#::Filtercxx . . $ Filter#Filter(f2e9810b37c242c3).(QStringcxx . . $ QString# genre, int maxUsage) |
| 54 | :pcxx . . $ Filter#p.(new Privatecxx . . $ Filter#Private#) |
| 55 | { |
| 56 | pcxx . . $ Filter#p.->maxUsagecxx . . $ Filter#Private#maxUsage. = maxUsage; |
| 57 | pcxx . . $ Filter#p.->genrecxx . . $ Filter#Private#genre. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). genre; |
| 58 | } |
| 59 | |
| 60 | Filtercxx . . $ Filter#::~cxx . . $ Filter#`~Filter`(ced63f7c635d850d).Filtercxx . . $ Filter#() |
| 61 | { |
| 62 | delete pcxx . . $ Filter#p.; |
| 63 | } |
| 64 | |
| 65 | |
| 66 | int Filtercxx . . $ Filter#::maxUsagecxx . . $ Filter#maxUsage(b126dc7c1de90089).() |
| 67 | { |
| 68 | return pcxx . . $ Filter#p.->maxUsagecxx . . $ Filter#Private#maxUsage.; |
| 69 | } |
| 70 | |
| 71 | void Filtercxx . . $ Filter#::setMaxUsagecxx . . $ Filter#setMaxUsage(d4f767463ce0a6b3).(int value) |
| 72 | { |
| 73 | pcxx . . $ Filter#p.->maxUsagecxx . . $ Filter#Private#maxUsage. = value; |
| 74 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! maxUsageChangedcxx . . $ Filter#maxUsageChanged(49f6e7a06ebc5aa8).(); |
| 75 | } |
| 76 | |
| 77 | bool Filtercxx . . $ Filter#::activecxx . . $ Filter#active(c9857a73d68e59ba).() |
| 78 | { |
| 79 | return pcxx . . $ Filter#p.->isActivecxx . . $ Filter#Private#isActive.; |
| 80 | } |
| 81 | |
| 82 | void Filtercxx . . $ Filter#::setActivecxx . . $ Filter#setActive(b45ddcbc8423892c).(bool b) |
| 83 | { |
| 84 | pcxx . . $ Filter#p.->isActivecxx . . $ Filter#Private#isActive. = b; |
| 85 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! statusChangedcxx . . $ Filter#statusChanged(b45ddcbc8423892c).(b); |
| 86 | if ( b == true ) |
| 87 | { |
| 88 | setUsagecxx . . $ Filter#setUsage(d4f767463ce0a6b3).(0); |
| 89 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! activatedcxx . . $ Filter#activated(49f6e7a06ebc5aa8).(); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | void Filtercxx . . $ Filter#::updatecxx . . $ Filter#update(49f6e7a06ebc5aa8).() |
| 94 | { |
| 95 | //qDebug() << Q_FUNC_INFO ; |
| 96 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! filterChangedcxx . . $ Filter#filterChanged(49f6e7a06ebc5aa8).(); |
| 97 | } |
| 98 | |
| 99 | QStringcxx . . $ QString# Filtercxx . . $ Filter#::pathcxx . . $ Filter#path(4365c3963150523e).() |
| 100 | { |
| 101 | return pcxx . . $ QString#QString(132dd6869045752b).->pathcxx . . $ Filter#Private#path.; |
| 102 | } |
| 103 | |
| 104 | void Filtercxx . . $ Filter#::setPathcxx . . $ Filter#setPath(7df51288a9ebd664).(QStringcxx . . $ QString# path) |
| 105 | { |
| 106 | pcxx . . $ Filter#p.->pathcxx . . $ Filter#Private#path. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). path; |
| 107 | } |
| 108 | |
| 109 | QStringcxx . . $ QString# Filtercxx . . $ Filter#::genrecxx . . $ Filter#genre(4365c3963150523e).() |
| 110 | { |
| 111 | return pcxx . . $ QString#QString(132dd6869045752b).->genrecxx . . $ Filter#Private#genre.; |
| 112 | } |
| 113 | |
| 114 | void Filtercxx . . $ Filter#::setGenrecxx . . $ Filter#setGenre(7df51288a9ebd664).(QStringcxx . . $ QString# genre) |
| 115 | { |
| 116 | pcxx . . $ Filter#p.->genrecxx . . $ Filter#Private#genre. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). genre; |
| 117 | } |
| 118 | |
| 119 | QStringcxx . . $ QString# Filtercxx . . $ Filter#::artistcxx . . $ Filter#artist(4365c3963150523e).() |
| 120 | { |
| 121 | return pcxx . . $ QString#QString(132dd6869045752b).->artistcxx . . $ Filter#Private#artist.; |
| 122 | } |
| 123 | |
| 124 | void Filtercxx . . $ Filter#::setArtistcxx . . $ Filter#setArtist(7df51288a9ebd664).(QStringcxx . . $ QString# artist) |
| 125 | { |
| 126 | pcxx . . $ Filter#p.->artistcxx . . $ Filter#Private#artist. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). artist; |
| 127 | } |
| 128 | |
| 129 | int Filtercxx . . $ Filter#::usagecxx . . $ Filter#usage(b126dc7c1de90089).() |
| 130 | { |
| 131 | return pcxx . . $ Filter#p.->usagecxx . . $ Filter#Private#usage.; |
| 132 | } |
| 133 | |
| 134 | void Filtercxx . . $ Filter#::setUsagecxx . . $ Filter#setUsage(d4f767463ce0a6b3).(int value) |
| 135 | { |
| 136 | pcxx . . $ Filter#p.->usagecxx . . $ Filter#Private#usage. = value; |
| 137 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! usageChangedcxx . . $ Filter#usageChanged(49f6e7a06ebc5aa8).(); |
| 138 | } |
| 139 | |
| 140 | int Filtercxx . . $ Filter#::countcxx . . $ Filter#count(b126dc7c1de90089).() |
| 141 | { |
| 142 | return pcxx . . $ Filter#p.->countcxx . . $ Filter#Private#count.; |
| 143 | } |
| 144 | |
| 145 | void Filtercxx . . $ Filter#::setCountcxx . . $ Filter#setCount(d4f767463ce0a6b3).(int value) |
| 146 | { |
| 147 | pcxx . . $ Filter#p.->countcxx . . $ Filter#Private#count. = value; |
| 148 | emitcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:97:10`! countChangedcxx . . $ Filter#countChanged(49f6e7a06ebc5aa8).(); |
| 149 | } |
| 150 | |
| 151 | long Filtercxx . . $ Filter#::lengthcxx . . $ Filter#length(da6335ded91d79c2).() |
| 152 | { |
| 153 | return pcxx . . $ Filter#p.->lengthcxx . . $ Filter#Private#length.; |
| 154 | } |
| 155 | |
| 156 | void Filtercxx . . $ Filter#::setLengthcxx . . $ Filter#setLength(1624ee8275b10bda).(long value) |
| 157 | { |
| 158 | pcxx . . $ Filter#p.->lengthcxx . . $ Filter#Private#length. = value; |
| 159 | } |
| 160 | |
| 161 | QStringcxx . . $ QString# Filtercxx . . $ Filter#::descriptioncxx . . $ Filter#description(4365c3963150523e).() |
| 162 | { |
| 163 | QStringcxx . . $ QString# retcxx . . $ QString#QString(ced63f7c635d850d).; |
| 164 | if ( !pcxx . . $ Filter#p.->artistcxx . . $ Filter#Private#artist..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 165 | ret+=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c).pcxx . . $ Filter#p.->artistcxx . . $ Filter#Private#artist. +cxx . . $ operator+(3d22f08efddf8107)." "; |
| 166 | if ( !pcxx . . $ Filter#p.->genrecxx . . $ Filter#Private#genre..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 167 | ret+=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c).pcxx . . $ Filter#p.->genrecxx . . $ Filter#Private#genre. +cxx . . $ operator+(3d22f08efddf8107)." "; |
| 168 | if ( !pcxx . . $ Filter#p.->pathcxx . . $ Filter#Private#path..isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 169 | { |
| 170 | QStringListcxx . . $ QStringList# token = pcxx . . $ Filter#p.->pathcxx . . $ Filter#Private#path..splitcxx . . $ QString#split(c8b44a97dcb6200d).("/"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 171 | ret+=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c).token.lastcxx . . $ QList#last(19b2b6f17af048b).() +cxx . . $ operator+(3d22f08efddf8107)." "; |
| 172 | |
| 173 | } |
| 174 | return retcxx . . $ QString#QString(28715ad661ad3cec).; |
| 175 | } |