aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Output/null/translations/null_plugin_nl.ts
Commit message (Expand)AuthorAgeFilesLines
* updated Dutch translation (Ronald Uitermark)trialuser022012-04-061-1/+1
* fixed typostrialuser022011-03-031-1/+1
* added Dutch translation (author: Ronald ronald645 AT gmail.com)trialuser022010-05-281-0/+27
ter trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> 2011-10-20 18:31:52 +0000 added playlits access from command line' href='/qmmp/commit/src/plugins/CommandLineOptions/PlayListOption/playlistoption.cpp?h=main&id=bcdb3b5623afff2bddd3f5de9f9e6be37dbfc3f7'>bcdb3b562
d2fee6f43
bcdb3b562



d2fee6f43


06552c3c1
d2fee6f43



bcdb3b562



d2fee6f43
06552c3c1
d2fee6f43
bcdb3b562






d2fee6f43
bcdb3b562
d2fee6f43

06552c3c1






d2fee6f43

bcdb3b562



















3a965fcd4
bcdb3b562



06552c3c1


















bcdb3b562




d2fee6f43
bcdb3b562

d2fee6f43














bcdb3b562















d2fee6f43




bcdb3b562
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
















                                                                            
                                                                            







                                                                             
                               



                                                        


                                          
                                          



                                                    



                                                
                   
                                                                                            
                  






                                                                                       
                                                  
 

                              






                                                                                            

                                   



















                                                                                              
                                          



                              


















                                                                                                      




                                                                                              
                                                    

                       














                                                                                           















                                                              




                                                
                                                
/***************************************************************************
 *   Copyright (C) 2011 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 <QtPlugin>
#include <QTranslator>
#include <QLocale>
#include <qmmp/soundcore.h>
#include <qmmpui/playlistmanager.h>
#include <qmmpui/metadataformatter.h>
#include <qmmpui/mediaplayer.h>
#include "playlistoption.h"

bool PlayListOption::identify(const QString & str) const
{
    return  str == QString("--pl-help") ||
            str == QString("--pl-list") ||
            str == QString("--pl-dump") ||
            str == QString("--pl-play") ||
            str == QString("--pl-clear") ||
            str == QString("--pl-repeat-toggle") ||
            str == QString("--pl-shuffle-toggle") ||
            str == QString("--pl-state");
}

const QString PlayListOption::helpString() const
{
    return QString(
                "--pl-help                " + tr("Show playlist manipulation commands")+"\n"
                );
}

QString PlayListOption::executeCommand(const QString& opt_str, const QStringList &args)
{
    Q_UNUSED(args);
    QString out;
    PlayListManager *pl_manager = PlayListManager::instance();
    MediaPlayer *player = MediaPlayer::instance();

    if(opt_str == "--pl-help")
    {
        out = "--pl-list                " + tr("List all available playlists")+"\n"+
              "--pl-dump <id>           " + tr("Show playlist content")+"\n" +
              "--pl-play <id> <track>   " + tr("Play track <track> in playlist <id>")+"\n" +
              "--pl-clear <id>          " + tr("Clear playlist")+"\n"+
              "--pl-repeat-toggle       " + tr("Toggle playlist repeat")+"\n"+
              "--pl-shuffle-toggle      " + tr("Toggle playlist shuffle")+"\n"+
              "--pl-state               " + tr("Show playlist options")+"\n";
    }
    else if(opt_str == "--pl-list")
    {
        QStringList names = pl_manager->playListNames();
        for(int i = 0; i <  names.count(); ++i)
        {
            if(i == pl_manager->currentPlayListIndex())
                out += QString("%1. %2 [*]\n").arg(i+1).arg(names.at(i));
            else
                out += QString("%1. %2\n").arg(i+1).arg(names.at(i));
        }
    }
    else if(opt_str == "--pl-dump")
    {
        MetaDataFormatter formatter("%p%if(%p&%t, - ,)%t%if(%p,,%if(%t,,%f))%if(%l, - %l,)");
        int id = args.isEmpty() ? pl_manager->currentPlayListIndex() : args.at(0).toInt() - 1;
        PlayListModel *model = pl_manager->playListAt(id);
        if(!model)
            return tr("Invalid playlist ID") + "\n";
        for(int i = 0; i < model->count(); ++i)
        {
            out += QString("%1. %2").arg(i+1).arg(formatter.parse(model->item(i)));
            if(i == model->currentIndex())
                out += " [*]";
            out += "\n";
        }
    }
    else if(opt_str == "--pl-play")
    {
        if(args.count() > 2 || args.isEmpty())
            return tr("Invalid number of arguments") + "\n";

        int pl_id = (args.count() == 1) ? pl_manager->currentPlayListIndex() : args.at(0).toInt() - 1;
        int track_id = (args.count() == 1) ? args.at(0).toInt() - 1 : args.at(1).toInt() - 1;
        PlayListModel *model = pl_manager->playListAt(pl_id);
        if(!model)
            return tr("Invalid playlist ID") + "\n";
        PlayListItem *item = model->item(track_id);
        if(!item)
            return tr("Invalid track ID") + "\n";
        player->stop();
        pl_manager->activatePlayList(model);
        pl_manager->selectPlayList(model);
        model->setCurrent(item);
        player->play();
    }
    else if(opt_str == "--pl-clear")
    {
        int id = args.isEmpty() ? pl_manager->currentPlayListIndex() : args.at(0).toInt() - 1;
        PlayListModel *model = pl_manager->playListAt(id);
        if(!model)
            return tr("Invalid playlist ID") + "\n";
        model->clear();
    }
    else if(opt_str == "--pl-repeat-toggle")
    {
        player->setRepeatable(!player->isRepeatable());
    }
    else if(opt_str == "--pl-shuffle-toggle")
    {
        pl_manager->setShuffle(!pl_manager->isShuffle());
    }
    else if(opt_str == "--pl-state")
    {
        out += "SHUFFLE:             " + boolToText(pl_manager->isShuffle()) + "\n";
        out += "REPEAT PLAYLIST:     " + boolToText(pl_manager->isRepeatableList()) + "\n";
        out += "REPEAT TRACK:        " + boolToText(player->isRepeatable()) + "\n";
        out += "NO PLAYLIST ADVANCE: " + boolToText(player->isNoPlaylistAdvance()) + "\n";
    }
    return out;
}

const QString PlayListOption::name() const
{
    return "PlayListOption";
}

QTranslator *PlayListOption::createTranslator(QObject *parent)
{
    QTranslator *translator = new QTranslator(parent);
    QString locale = Qmmp::systemLanguageID();
    translator->load(QString(":/playlist_plugin_") + locale);
    return translator;
}

QString PlayListOption::boolToText(bool enabled)
{
    return QString(enabled ? "[+]" : "[-]");
}

Q_EXPORT_PLUGIN2(playlistoption, PlayListOption)