aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Transports/mms/settingsdialog.h
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2011-09-10 15:02:37 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2011-09-10 15:02:37 +0000
commit2972e874245b9aa192c89885d67253aeb3c1eede (patch)
treeafe8b9b6ecde28076d9b1e72729cbfe7b1bbe7ee /src/plugins/Transports/mms/settingsdialog.h
parent9f7ce1d53402aaf94398983b89dce5aba5c6f799 (diff)
downloadqmmp-2972e874245b9aa192c89885d67253aeb3c1eede.tar.gz
qmmp-2972e874245b9aa192c89885d67253aeb3c1eede.tar.bz2
qmmp-2972e874245b9aa192c89885d67253aeb3c1eede.zip
improved "hide on close" feature
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@2344 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Transports/mms/settingsdialog.h')
0 files changed, 0 insertions, 0 deletions
er trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> 2015-01-09 12:01:22 +0000 renaming experimental branch' href='/qmmp/commit/src/qmmpui/playlisttrack.cpp?id=ebd7f9bc697973366de8a6bf7265051e825e0680'>ebd7f9bc6
245d0ac0c
bcf7e323d
3423cc362
195d573df
245d0ac0c
ebd7f9bc6

245d0ac0c


ebd7f9bc6
245d0ac0c
bcf7e323d
3423cc362
195d573df
ebd7f9bc6


9a26d9b1c
e7dd6e5af
3423cc362
9a26d9b1c
e7dd6e5af
245d0ac0c
245d0ac0c




ebd7f9bc6
245d0ac0c
bcf7e323d
3423cc362
195d573df
245d0ac0c
3423cc362
ebd7f9bc6

245d0ac0c


ebd7f9bc6



245d0ac0c



9a26d9b1c
97cc9509c
245d0ac0c

91bec81b8
245d0ac0c
245d0ac0c


3423cc362



9a26d9b1c
97cc9509c
245d0ac0c
f54c4c2c6
245d0ac0c

e7dd6e5af
245d0ac0c
e7dd6e5af





245d0ac0c






bcf7e323d









ebd7f9bc6
























9a26d9b1c
245d0ac0c
195d573df
3423cc362
195d573df
9a26d9b1c

195d573df
9a26d9b1c

195d573df
9a26d9b1c

195d573df
9a26d9b1c








195d573df
9a26d9b1c
195d573df
9a26d9b1c
3423cc362
9a26d9b1c
245d0ac0c

9b20171e5

195d573df
9b20171e5
195d573df
9b20171e5

195d573df
9b20171e5

195d573df
9b20171e5

195d573df
9b20171e5


195d573df
9b20171e5
33317ad58


9b20171e5
195d573df
9b20171e5






91bec81b8
245d0ac0c
ccad369e8
3423cc362
a7b25b950
3423cc362


245d0ac0c


245d0ac0c







3423cc362
245d0ac0c






9a26d9b1c
245d0ac0c
195d573df
aad25a609






3423cc362
9a26d9b1c
3423cc362
9a26d9b1c
245d0ac0c
e7dd6e5af


78015dd4f




195d573df
e7dd6e5af
ed298a00c
e7dd6e5af




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
                                                                            
                                                                            
















                                                                             
 
                       
                                 
                           
                             

                          
                                                                                
 
                       
                                            
                                          
                 

                                  


                                                                                                
                  
 
                       
                                            
                                          


                                  
                                                
                            
                                                
                                          
                                        
                                    




                                                                                                
                  
 
                       
                                            
                                          
                                         
                                    

                                  


                               



                                                       



                                                                                  
                              
                  

 
                                    
 


                                                                                             



                                                                     
                                  
                      
     
                     

 
                                        
 





                                                                       






                                   









                                                  
























                                                 
                                                       
 
                                                            
     
                                                                  

                                         
                                                                  

                                                
                                                               

                                      
                                                               








                                                                 
                                                                                                                    
     
                                                                             
                            
     
                                     

 

                                                  
                                                            
     
                                                                  

                                         
                                                                  

                                                
                                                               

                                      
                                                               


                                             
                                                                   
     


                                                                                        
         
                                                                                 






                                
                                              
 
                                                   
     
                                                                      


                                  


                             







                                            
                              






                                        
                                           
 
                                                                               






                                                                         
                                        
                                                    
                                    
                                                      
 


                                 




                                                              
                                                       
                          
                                                                  




                                        
/***************************************************************************
 *   Copyright (C) 2008-2015 by Ilya Kotov                                 *
 *   forkotov02@hotmail.ru                                                 *
 *                                                                         *
 *   This program 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 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program 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 this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 ***************************************************************************/

#include <QApplication>
#include <qmmp/metadatamanager.h>
#include "qmmpuisettings.h"
#include "metadatahelper_p.h"
#include "playlisttrack.h"

PlayListTrack::PlayListTrack() : QMap<Qmmp::MetaData, QString>(), PlayListItem()
{
    m_track_index = -1;
    m_settings = QmmpUiSettings::instance();
    m_helper = MetaDataHelper::instance();
    m_length = 0;
    m_refCount = 0;
    m_sheduledForDeletion = false;
}

PlayListTrack::PlayListTrack(const PlayListTrack &other) : QMap<Qmmp::MetaData, QString>(other),
    PlayListItem()
{
    m_track_index = -1;
    m_settings = QmmpUiSettings::instance();
    m_helper = MetaDataHelper::instance();
    m_refCount = 0;
    m_sheduledForDeletion = false;

    m_formattedTitles = other.m_formattedTitles;
    m_group = other.m_group;
    m_formattedLength = other.m_formattedLength;
    m_titleFormats = other.m_titleFormats;
    m_groupFormat = other.m_groupFormat;
    setSelected(other.isSelected());
    m_length = other.m_length;
    m_formattedLength = other.m_formattedLength;
}

PlayListTrack::PlayListTrack(FileInfo *info) :  QMap<Qmmp::MetaData, QString>(info->metaData()),
    PlayListItem()
{
    m_track_index = -1;
    m_settings = QmmpUiSettings::instance();
    m_helper = MetaDataHelper::instance();
    setLength(m_length = info->length());
    insert(Qmmp::URL, info->path());
    m_refCount = 0;
    m_sheduledForDeletion = false;
}

PlayListTrack::~PlayListTrack()
{
    if(m_refCount != 0)
        qWarning("PlayListTrack: deleting busy track");
}

void PlayListTrack::updateMetaData(const QMap <Qmmp::MetaData, QString> &metaData)
{
    QMap <Qmmp::MetaData, QString>::operator =(metaData);
    m_formattedTitles.clear();
    formatGroup();
}

void PlayListTrack::updateMetaData()
{
    QList <FileInfo *> list =  MetaDataManager::instance()->createPlayList(value(Qmmp::URL));
    if(!list.isEmpty() && !list.at(0)->path().contains("://"))
    {
        FileInfo *info = list.at(0);
        m_length = info->length();
        QMap <Qmmp::MetaData, QString>::operator =(info->metaData());
        insert(Qmmp::URL, info->path());
        m_formattedTitles.clear();
        formatGroup();
    }
    qDeleteAll(list);
}

const QString PlayListTrack::groupName()
{
    if(m_group.isEmpty() || m_groupFormat != m_settings->groupFormat())
    {
        m_groupFormat = m_settings->groupFormat();
        formatGroup();
    }
    return m_group;
}

bool PlayListTrack::isGroup() const
{
    return false;
}

void PlayListTrack::setTrackIndex(int track_index)
{
    m_track_index = track_index;
}

int PlayListTrack::trackIndex() const
{
    return m_track_index;
}

void PlayListTrack::beginUsage()
{
    m_refCount++;
}

void PlayListTrack::endUsage()
{
    m_refCount--;
}

void PlayListTrack::deleteLater()
{
    m_sheduledForDeletion = true;
}

bool PlayListTrack::isSheduledForDeletion() const
{
    return m_sheduledForDeletion;
}

bool PlayListTrack::isUsed() const
{
    return (m_refCount != 0);
}

const QString PlayListTrack::formattedTitle(int column)
{
    if(m_formattedTitles.count() != m_helper->columnCount())
    {
        while(m_formattedTitles.count() > m_helper->columnCount())
            m_formattedTitles.takeLast();

        while(m_formattedTitles.count() < m_helper->columnCount())
            m_formattedTitles.append(QString());

        while(m_titleFormats.count() > m_helper->columnCount())
            m_titleFormats.takeLast();

        while(m_titleFormats.count() < m_helper->columnCount())
            m_titleFormats.append(QString());
    }

    if(column < 0 || column >= m_formattedTitles.size())
    {
        qWarning("PlayListTrack: column number is out of range");
        return QString();
    }

    if(m_formattedTitles[column].isEmpty() || m_titleFormats[column] != m_helper->titleFormatter(column)->pattern())
    {
        m_titleFormats[column] = m_helper->titleFormatter(column)->pattern();
        formatTitle(column);
    }
    return m_formattedTitles[column];
}

const QStringList PlayListTrack::formattedTitles()
{
    if(m_formattedTitles.count() != m_helper->columnCount())
    {
        while(m_formattedTitles.count() > m_helper->columnCount())
            m_formattedTitles.takeLast();

        while(m_formattedTitles.count() < m_helper->columnCount())
            m_formattedTitles.append(QString());

        while(m_titleFormats.count() > m_helper->columnCount())
            m_titleFormats.takeLast();

        while(m_titleFormats.count() < m_helper->columnCount())
            m_titleFormats.append(QString());
    }

    for(int column = 0; column < m_helper->columnCount(); column++)
    {
        if(m_formattedTitles[column].isEmpty() ||
                m_titleFormats[column] != m_helper->titleFormatter(column)->pattern() ||
                m_titleFormats[column].contains("%I"))
        {
            m_titleFormats[column] = m_helper->titleFormatter(column)->pattern();
            formatTitle(column);
        }
    }

    return m_formattedTitles;
}

const QString PlayListTrack::formattedLength()
{
    if(m_length > 0 && m_formattedLength.isEmpty())
    {
        m_formattedLength = MetaDataFormatter::formatLength(m_length);
    }
    else if(m_length == 0)
        m_formattedLength.clear();
    return m_formattedLength;
}

qint64 PlayListTrack::length() const
{
    return m_length;
}

void PlayListTrack::setLength(qint64 length)
{
    m_length = length;
    m_formattedLength.clear();
}

const QString PlayListTrack::url() const
{
    return value(Qmmp::URL);
}

void PlayListTrack::formatTitle(int column)
{
    m_formattedTitles[column] = m_helper->titleFormatter(column)->format(this);
    if(m_formattedTitles.count() == 1)
    {
        if (m_formattedTitles[column].isEmpty())