aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/General/streambrowser/translations/streambrowser_plugin_cs.ts
blob: 7f0910d7f99c0b3a29b88bffd586bf51b918d0bf (plain) (blame)
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
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="cs">
<context>
    <name>StreamBrowser</name>
    <message>
        <location filename="../streambrowser.cpp" line="33"/>
        <source>Stream Browser</source>
        <translation>Prohlížeč proudů</translation>
    </message>
    <message>
        <location filename="../streambrowser.cpp" line="35"/>
        <source>Ctrl+U</source>
        <translation>Ctrl+U</translation>
    </message>
</context>
<context>
    <name>StreamBrowserFactory</name>
    <message>
        <location filename="../streambrowserfactory.cpp" line="30"/>
        <source>Stream Browser Plugin</source>
        <translation>Modul prohlížeče proudů</translation>
    </message>
    <message>
        <location filename="../streambrowserfactory.cpp" line="51"/>
        <source>About Stream Browser Plugin</source>
        <translation>O modulu prohlížeče proudů</translation>
    </message>
    <message>
        <location filename="../streambrowserfactory.cpp" line="52"/>
        <source>Qmmp Stream Browser Plugin</source>
        <translation>Modul Qmmp na prohlížení proudů</translation>
    </message>
    <message>
        <location filename="../streambrowserfactory.cpp" line="53"/>
        <source>This plugin allows one to add stream from IceCast stream directory</source>
        <translation>Tento modul umožňuje přidat proud z adresáře proudů IceCast</translation>
    </message>
    <message>
        <location filename="../streambrowserfactory.cpp" line="54"/>
        <source>Written by: Ilya Kotov &lt;forkotov02@ya.ru&gt;</source>
        <translation type="unfinished"></translation>
    </message>
</context>
<context>
    <name>StreamWindow</name>
    <message>
        <location filename="../streamwindow.ui" line="14"/>
        <source>Stream Browser</source>
        <translation>Prohlížeč proudů</translation>
    </message>
    <message>
        <location filename="../streamwindow.ui" line="31"/>
        <source>Filter:</source>
        <translation>Filtr:</translation>
    </message>
    <message>
        <location filename="../streamwindow.ui" line="47"/>
        <source>Favorites</source>
        <translation>Oblíbené</translation>
    </message>
    <message>
        <location filename="../streamwindow.ui" line="73"/>
        <source>IceCast</source>
        <translation>IceCast</translation>
    </message>
    <message>
        <location filename="../streamwindow.ui" line="102"/>
        <source>Add</source>
        <translation>Přidat</translation>
    </message>
    <message>
        <location filename="../streamwindow.ui" line="109"/>
        <source>Update</source>
        <translation>Aktualizovat</translation>
    </message>
    <message>
        <location filename="../streamwindow.cpp" line="51"/>
        <location filename="../streamwindow.cpp" line="69"/>
        <source>Name</source>
        <translation>Název</translation>
    </message>
    <message>
        <location filename="../streamwindow.cpp" line="52"/>
        <location filename="../streamwindow.cpp" line="70"/>
        <source>Genre</source>
        <translation>Žánr</translation>
    </message>
    <message>
        <location filename="../streamwindow.cpp" line="53"/>
        <location filename="../streamwindow.cpp" line="71"/>
        <source>Bitrate</source>
        <translation>Datový tok</translation>
    </message>
    <message>
        <location filename="../streamwindow.cpp" line="54"/>
        <location filename="../streamwindow.cpp" line="72"/>
        <source>Format</source>
        <translation>Formát</translation>
    </message>
    <message>
        <location filename="../streamwindow.cpp" line="125"/>
        <source>&amp;Add to favorites</source>
        <translation>Přidat k &amp;oblíbeným</translation>
    </message>
    <message>
        <location filename="../streamwindow.cpp" line="126"/>
        <source>&amp;Add to playlist</source>
        <translation>Přidat do &amp;seznamu</translation>
    </message>
    <message>
        <location filename="../streamwindow.cpp" line="131"/>
        <source>&amp;Remove</source>
        <translation>Odst&amp;ranit</translation>
    </message>
    <message>
        <location filename="../streamwindow.cpp" line="141"/>
        <source>Done</source>
        <translation>Hotovo</translation>
    </message>
    <message>
        <location filename="../streamwindow.cpp" line="144"/>
        <location filename="../streamwindow.cpp" line="145"/>
        <source>Error</source>
        <translation>Chyba</translation>
    </message>
    <message>
        <location filename="../streamwindow.cpp" line="164"/>
        <source>Receiving</source>
        <translation>Příjímám</translation>
    </message>
</context>
</TS>
865f9a5e38> 2020-01-20 20:36:47 +0000 qsui: fixed seeking' href='/qmmp/commit/src/plugins/Ui/qsui/qsuiwaveformseekbar.cpp?id=b4f07bac926f18240d8dc7ce8805e5882f2b2e46'>b4f07bac9
99369b584

f86d1fe9f

5e158baa2
f86d1fe9f








5e158baa2
f86d1fe9f


558e2e39d



f86d1fe9f



5e158baa2
f86d1fe9f
f74cd2553
f86d1fe9f


f74cd2553
f86d1fe9f

99369b584


f86d1fe9f

f74cd2553
5a3ed59f2
f74cd2553
f86d1fe9f


cfb167d38

f74cd2553

cfb167d38

bbe1ec2f3

99369b584
f74cd2553
bbe1ec2f3


f74cd2553
bbe1ec2f3
f74cd2553
bbe1ec2f3


f74cd2553
bbe1ec2f3

f74cd2553
bbe1ec2f3



cfb167d38








f74cd2553


99369b584





f86d1fe9f

f74cd2553
cfb167d38
f74cd2553

cfb167d38

bbe1ec2f3

99369b584
f74cd2553
bbe1ec2f3


f74cd2553
bbe1ec2f3
f74cd2553
bbe1ec2f3


f74cd2553
bbe1ec2f3

f74cd2553
bbe1ec2f3



cfb167d38








f74cd2553

f86d1fe9f
f74cd2553

5e158baa2
99369b584








5e158baa2
f86d1fe9f

5e158baa2
f74cd2553



5e158baa2
f74cd2553





















































5e158baa2
f74cd2553





















5e158baa2
f74cd2553
5a3ed59f2
f74cd2553


5e158baa2
f74cd2553



5e158baa2
f74cd2553








5a3ed59f2
f74cd2553

f17f85db5


f74cd2553
5a3ed59f2
f74cd2553









5a3ed59f2
f74cd2553




5a3ed59f2
f74cd2553
5a3ed59f2
7ef8d11ba
f74cd2553


5a3ed59f2
f74cd2553



5a3ed59f2


f74cd2553






f74cd2553




f17f85db5


f74cd2553

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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494





















                                                                             
                    
                   

                  
                       






                                
                                     

                                

                               
                                                                           

                                   

                                                                                          
                 
                   

 
                                           



                           
                                        






                                                                                                  





                                                                                                     




                        
                                                           




                       
                                                         
         
                                                      
                                                                           
                                                                             
         

                                            














                                
                       






              
                                          







                                                         
                   

 
                                         








                                                         
                                                          


                                    

                   

 
                                         








                                                                                      
                                                    

                            
















                                                                                      
                                                     



                   
                                                 
 
                                                                                                 

                                                     
 
                                                         

                                     
     
                                    

                 

                                           

 
                                                          








                                                              
                                                        


                         



                                                                                                  



                 
                                        
 
                        


                             
               

     


                                                                

                                          
 
                                                   
 


                                      

                                                            

                                      

                                                   

                                     
                                                            
         


                                               
         
                                                        
         


                                                         
         

                
         



                                                                        








                                           


         





                 

                                 
 
                                                            

                                      

                                                   

                                     
                                                            
         


                                               
         
                                                        
         


                                                         
         

                
         



                                                                        








                                           

         
             

 
                                      








                                                                                               
                                                                           

  
                                           



           
                                                   





















































                                                                                                        
                                





















                            
                                                   
 
                                  


                  
                                                                   



                
                               








                                                                      
                                                                      

                   


                                                    
                    
                                   









                                                                        
                                           




                                                       
                                              
                 
                                   
                                                    


                                                 
                                                                                   



                                       


                                                                                   






                                




                       


                  

                     
/***************************************************************************
 *   Copyright (C) 2020 by Ilya Kotov                                      *
 *   forkotov02@ya.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 <QPainter>
#include <QPaintEvent>
#include <QSettings>
#include <QToolTip>
#include <QMenu>
#include <QAction>
#include <QMutexLocker>
#include <cmath>
#include <qmmp/soundcore.h>
#include <qmmp/inputsource.h>
#include <qmmp/decoder.h>
#include <qmmp/decoderfactory.h>
#include <qmmp/audioconverter.h>
#include <qmmp/buffer.h>
#include <qmmpui/metadataformatter.h>
#include "qsuiwaveformseekbar.h"

#define NUMBER_OF_VALUES (4096)

QSUiWaveformSeekBar::QSUiWaveformSeekBar(QWidget *parent) : QWidget(parent)
{
    m_core = SoundCore::instance();
    connect(m_core, SIGNAL(stateChanged(Qmmp::State)), SLOT(onStateChanged(Qmmp::State)));
    connect(m_core, SIGNAL(elapsedChanged(qint64)), SLOT(onElapsedChanged(qint64)));
    createMenu();
    readSettings();
}

QSize QSUiWaveformSeekBar::sizeHint() const
{
    return QSize(200, 100);
}

void QSUiWaveformSeekBar::readSettings()
{
    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    settings.beginGroup("Simple");
    m_bgColor.setNamedColor(settings.value("wfsb_bg_color", "Black").toString());
    m_rmsColor.setNamedColor(settings.value("wfsb_rms_color", "#DDDDDD").toString());
    m_waveFormColor.setNamedColor(settings.value("wfsb_waveform_color", "#BECBFF").toString());
    m_progressBar.setNamedColor(settings.value("wfsb_progressbar_color", "#9633CA10").toString());
    if(!m_update)
    {
        m_update = true;
        m_showTwoChannelsAction->setChecked(settings.value("wfsb_show_two_channels", true).toBool());
        m_showRmsAction->setChecked(settings.value("wfsb_show_rms", true).toBool());
    }
    settings.endGroup();
    drawWaveform();
}


void QSUiWaveformSeekBar::onStateChanged(Qmmp::State state)
{
    switch (state)
    {
    case Qmmp::Playing:
    {
        if(!m_scanner && isVisible() && m_data.isEmpty())
        {
            m_scanner = new QSUiWaveformScanner(this);
            connect(m_scanner, SIGNAL(finished()), SLOT(onScanFinished()));
            connect(m_scanner, SIGNAL(dataChanged()), SLOT(onDataChanged()));
        }
        if(m_scanner)
            m_scanner->scan(m_core->path());
    }
        break;
    case Qmmp::Stopped:
    case Qmmp::FatalError:
    case Qmmp::NormalError:
    {
        if(m_scanner)
        {
            m_scanner->stop();
            delete m_scanner;
            m_scanner = nullptr;
        }
        m_data.clear();
        m_elapsed = 0;
        m_duration = 0;
        drawWaveform();
    }
        break;
    default:
        break;
    }
}

void QSUiWaveformSeekBar::onScanFinished()
{
    if(!m_scanner)
        return;

    m_data = m_scanner->data();
    m_channels = m_scanner->audioParameters().channels();
    delete m_scanner;
    m_scanner = nullptr;
    drawWaveform();
}

void QSUiWaveformSeekBar::onDataChanged()
{
    if(!m_scanner || !m_scanner->isRunning())
        return;

    m_data = m_scanner->data();
    m_channels = m_scanner->audioParameters().channels();
    drawWaveform();
}

void QSUiWaveformSeekBar::onElapsedChanged(qint64 elapsed)
{
    m_elapsed = elapsed;
    m_duration = m_core->duration();
    if(isVisible())
        update();
}

void QSUiWaveformSeekBar::writeSettings()
{
    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    settings.beginGroup("Simple");
    settings.setValue("wfsb_show_two_channels", m_showTwoChannelsAction->isChecked());
    settings.setValue("wfsb_show_rms", m_showRmsAction->isChecked());
    settings.endGroup();
    drawWaveform();
}

void QSUiWaveformSeekBar::paintEvent(QPaintEvent *e)
{
    QPainter painter (this);
    painter.fillRect(e->rect(), m_bgColor);

    if(!m_pixmap.isNull())
        painter.drawPixmap(0, 0, width(), height(), m_pixmap);

    if(m_duration > 0)
    {
        int x = m_pressedPos >= 0 ? m_pressedPos : (width() * m_elapsed / m_duration);
        QColor color = m_progressBar;
        QBrush brush(color);
        painter.fillRect(0, 0, x, height(), brush);
        color.setAlpha(255);
        painter.setPen(color);
        painter.drawLine(x, 0, x, height());
    }
}

void QSUiWaveformSeekBar::resizeEvent(QResizeEvent *)
{
    drawWaveform();
}

void QSUiWaveformSeekBar::showEvent(QShowEvent *)
{
    if(m_data.isEmpty() && (m_core->state() == Qmmp::Playing || m_core->state() == Qmmp::Paused))
        onStateChanged(Qmmp::Playing); //force redraw
}

void QSUiWaveformSeekBar::mousePressEvent(QMouseEvent *e)
{
    if(e->button() == Qt::LeftButton)
    {
        m_pressedPos = e->pos().x();
        update();
    }
    else if(e->button() == Qt::RightButton)
        m_menu->exec(e->globalPos());
}

void QSUiWaveformSeekBar::mouseReleaseEvent(QMouseEvent *)
{
    if(m_pressedPos >= 0)
    {
        if(m_duration > 0)
            m_core->seek(m_pressedPos * m_duration / width());
        m_pressedPos = -1;
    }
}

void QSUiWaveformSeekBar::mouseMoveEvent(QMouseEvent *e)
{
    if(m_pressedPos >= 0)
    {
        m_pressedPos = qBound(0, e->pos().x(), width());
        QToolTip::showText(mapToGlobal(e->pos()),
                           MetaDataFormatter::formatDuration(m_pressedPos * m_duration / width()),
                           this, QRect());
        update();
    }
}

void QSUiWaveformSeekBar::drawWaveform()
{
    if(m_data.isEmpty())
    {
        m_pixmap = QPixmap();
        update();
        return;
    }

    bool showTwoChannels = m_showTwoChannelsAction->isChecked();
    bool showRms = m_showRmsAction->isChecked();

    m_pixmap = QPixmap(width(), height());
    m_pixmap.fill(m_bgColor);

    float step = float(width()) / NUMBER_OF_VALUES;

    QPainter painter(&m_pixmap);
    painter.setPen(m_waveFormColor);
    painter.setBrush(m_waveFormColor);

    for(int i = 0; i < m_data.size() - m_channels * 3; i+=3)
    {
        int ch = (i / 3) % m_channels;
        float x1 = step * (i / m_channels / 3);
        float x2 = step * (i / m_channels / 3 + 1);
        bool draw = false;
        float zeroPos = 0, ratio = 0;
        if(ch == 0 && (m_channels == 1 || !showTwoChannels))
        {
            zeroPos = height() / 2;
            ratio = float(height() / 4) / 1000;
            draw = true;
        }
        else if(ch == 0 || (ch == 1 && showTwoChannels))
        {
            zeroPos = ((ch == 0) ? 1 : 3) * height() / 4;
            ratio = float(height() / 8) / 1000;
            draw = true;
        }

        if(draw)
        {
            float y1 = zeroPos - m_data[i] * ratio;
            float y2 = zeroPos - m_data[i + 1] * ratio;
            float y3 = zeroPos - m_data[i + m_channels * 3] * ratio;
            float y4 = zeroPos - m_data[i + m_channels * 3 + 1] * ratio;

            QPointF points[4] = {
                { x1, y1 },
                { x1, y2 },
                { x2, y4 },
                { x2, y3 }
            };

            painter.drawPolygon(points, 4);
        }
    }

    if(!showRms)
    {
        update();
        return;
    }

    painter.setPen(m_rmsColor);
    painter.setBrush(m_rmsColor);

    for(int i = 0; i < m_data.size() - m_channels * 3; i+=3)
    {
        int ch = (i / 3) % m_channels;
        float x1 = step * (i / m_channels / 3);
        float x2 = step * (i / m_channels / 3 + 1);
        bool draw = false;
        float zeroPos = 0, ratio = 0;
        if(ch == 0 && (m_channels == 1 || !showTwoChannels))
        {
            zeroPos = height() / 2;
            ratio = float(height() / 4) / 1000;
            draw = true;
        }
        else if(ch == 0 || (ch == 1 && showTwoChannels))
        {