aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/CommandLineOptions/StatusOption/translations/status_plugin_ja.ts
blob: c37c7cbba8dcd19e14fda7bf567bcb7e7fac31f4 (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
134
135
136
137
138
139
140
141
142
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ja_JP">
<context>
    <name>StatusOption</name>
    <message>
        <location filename="../statusoption.cpp" line="30"/>
        <source>Print playback status</source>
        <translation>再生の状況を表示</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="31"/>
        <source>Print formatted track name (example: qmmp --nowplaying &quot;%t - %a&quot;)</source>
        <translation>トラック名を整形して表示 (: qmmp --nowplaying &quot;%t - %a&quot;)</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="33"/>
        <source>Print --nowplaying syntax</source>
        <translation>--nowplaying の構文規則を表示</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="94"/>
        <source>Syntax:</source>
        <translation>構文規則:</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="95"/>
        <source>%p - artist</source>
        <translation>%p - アーティスト名</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="96"/>
        <source>%a - album</source>
        <translation>%a - アルバム名</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="97"/>
        <source>%aa - album artist</source>
        <translation>%aa - アルバムアーティスト名</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="98"/>
        <source>%t - title</source>
        <translation>%t - 題名</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="99"/>
        <source>%n - track</source>
        <translation>%n - トラック番号</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="100"/>
        <source>%NN - 2-digit track</source>
        <translation>%NN - トラック番号 数字2</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="101"/>
        <source>%g - genre</source>
        <translation>%g - ジャンル名</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="102"/>
        <source>%c - comment</source>
        <translation>%c - コメント</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="103"/>
        <source>%C - composer</source>
        <translation>%C - 作曲者名</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="104"/>
        <source>%D - disc number</source>
        <translation>%D - ディスク番号</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="105"/>
        <source>%f - file name</source>
        <translation>%f - ファイル名</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="106"/>
        <source>%F - full path</source>
        <translation>%F - 完全なファイルパス</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="107"/>
        <source>%y - year</source>
        <translation>%y -</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="108"/>
        <source>%l - duration</source>
        <translation>%l - 演奏時間</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="109"/>
        <source>%{bitrate} - bitrate</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="110"/>
        <source>%{samplerate} - sample rate</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="111"/>
        <source>%{channels} - number of channels</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="112"/>
        <source>%{samplesize} - bits per sample</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="113"/>
        <source>%{format} - format name</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="114"/>
        <source>%{decoder} - decoder name</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="115"/>
        <source>%{filesize} - file size</source>
        <translation type="unfinished"></translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="116"/>
        <source>%if(A&amp;B&amp;C,D,E) - condition</source>
        <translation>%if(A&amp;B&amp;C,D,E) - 状態</translation>
    </message>
    <message>
        <location filename="../statusoption.cpp" line="117"/>
        <source>%dir(n) - directory name located on n levels above</source>
        <translation>%dir(n) - n 層上のディレクトリ名</translation>
    </message>
</context>
</TS>
rialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> 2010-03-20 07:22:50 +0000 improved kde4 notification (added embedded covers support and templates)' href='/qmmp/commit/src/plugins/General/kdenotify/kdenotify.cpp?id=2eff41971d3776c7c4ac1ea9fa9a6f5a4f1513ab'>2eff41971
6f72ae7e3
2eff41971
1f53a3647
6f72ae7e3
1f53a3647
2eff41971

75281f98f
1f53a3647
2eff41971
6f72ae7e3
2eff41971
75281f98f
6f72ae7e3
b6de71b1b









1f53a3647
6f72ae7e3
1f53a3647




6f72ae7e3
6623dcc7c






1f53a3647











1f53a3647

6f72ae7e3
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
                                                                            
                                                                            

















                                                                             


                                   


                    
                 

                 
                       

                   
                                     

                                 
 
                      
 
                                                                                   
 


                                                                                            
                                                             
     
                           


                                                                                                   
                                                                 
         
                                                                   

                   
                                    
     
                                                                    






                                                                                                
 

                                                                

                                                                      

                                                                         
                                                                   
                        
                          
 












                                                                                                           



                       
                           
                            



                                    
                                                       
 
                    
     

                                                                                                   
     
                                                                                      

 
                                                

                                            

                                                                             
                                 
     
                         
                                   

                                                  
                                   
                                                                                 
                                                                        
 

                                                                     
 
                      
                    
     
                                                                                         

                           
                                    
                                                                                               
         
     
                           
                                                     
 









                                                                                                                       
 
                                         




                                            
 






                                              











                                                                                           

                               
 
/***************************************************************************
 *   Copyright (C) 2009-2010 by Artur Guzik                                *
 *   a.guzik88@gmail.com                                                   *
 *                                                                         *
 *   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.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#include <QDBusConnection>
#include <QDBusConnectionInterface>
#include <QDBusInterface>
#include <QFileInfo>
#include <QDir>
#include <QSettings>
#include <QDebug>
#include <QTimer>
#include <QImage>
#include <QApplication>
#include <QVariant>

#include <qmmpui/metadataformatter.h>
#include <qmmp/soundcore.h>
#include <qmmp/metadatamanager.h>

#include "kdenotify.h"

KdeNotify::KdeNotify(QObject *parent) : General(parent),m_useFreedesktopSpec(false)
{
    m_notifier = new QDBusInterface("org.kde.VisualNotifications",
                                      "/VisualNotifications", "org.kde.VisualNotifications",
                                      QDBusConnection::sessionBus(), this);
    if(m_notifier->lastError().type() != QDBusError::NoError)
    {
        delete(m_notifier);
	m_notifier = new QDBusInterface("org.freedesktop.Notifications",
                                  "/org/freedesktop/Notifications","org.freedesktop.Notifications",
                                  QDBusConnection::sessionBus(), this);
        if(m_notifier->lastError().type() != QDBusError::NoError)
        {
            qWarning() << "KdeNotify: Unable to create interface.";
            return;
        }
        m_useFreedesktopSpec = true;
    }
    qWarning() << "KdeNotify: DBus interfece created successfully.";
    QString path = QFileInfo(Qmmp::configFile()).absoluteDir().path();
    QDir dir(path);
    if(!dir.exists("kdenotifycache"))
        dir.mkdir("kdenotifycache");
    dir.cd("kdenotifycache");
    m_coverPath = dir.absolutePath() + "/cover.jpg";
    m_imagesDir = QDir(qApp->applicationFilePath () +"/../../share/qmmp/images").absolutePath();

    QSettings settings(Qmmp::configFile(),QSettings::IniFormat);
    settings.beginGroup("Kde_Notifier");
    m_notifyDuration = settings.value("notify_duration",5000).toInt();
    m_showCovers = settings.value("show_covers",true).toBool();
    m_template = settings.value("template", DEFAULT_TEMPLATE).toString();
    m_template.remove("\n");
    m_updateNotify = settings.value("update_notify",true).toBool();
    settings.endGroup();
    m_currentNotifyId = 0;

    if(m_updateNotify)
    {
        connect(SoundCore::instance(),SIGNAL(metaDataChanged()),SLOT(showMetaData()));
        connect(m_notifier,SIGNAL(NotificationClosed(uint,uint)),this,SLOT(notificationClosed(uint,uint)));
    }
    else
    {
        QTimer *timer = new QTimer(this);
        timer->setSingleShot(true);
        timer->setInterval(NOTIFY_DELAY); //after that notification will be showed.
        connect(timer,SIGNAL(timeout()),SLOT(showMetaData()));
        connect(SoundCore::instance(),SIGNAL(metaDataChanged()),timer, SLOT(start()));
    }
}

KdeNotify::~KdeNotify()
{
    QDir dir(QDir::home());
    dir.remove(m_coverPath);
}

QString KdeNotify::totalTimeString()
{
    int time = SoundCore::instance()->totalTime()/1000;

    if(time >= 3600)
    {
        return QString("%1:%2:%3").arg(time/3600,2,10,QChar('0')).arg(time%3600/60,2,10,QChar('0'))
                .arg(time%60,2,10,QChar('0'));
    }
    return QString("%1:%2").arg(time/60,2,10,QChar('0')).arg(time%60,2,10,QChar('0'));
}

QList<QVariant> KdeNotify::prepareNotification()
{
    SoundCore *core = SoundCore::instance();
    if(core->metaData(Qmmp::URL).isEmpty()) //prevent show empty notification
    {
        return QList<QVariant>();
    }
    QList<QVariant> args;
    args.append("Qmmp"); //app-name
    args.append(m_currentNotifyId); //replaces-id;
    if(!m_useFreedesktopSpec)
        args.append(""); //event-id
    args.append(m_imagesDir + "/app-icon.png");  //app-icon(path to icon on disk)
    args.append(tr("Qmmp now playing:")); //summary (notification title)

    MetaDataFormatter f(m_template);
    QString body = f.parse(core->metaData(), core->totalTime()/1000);

    QString coverPath;
    if(m_showCovers)
    {
        QPixmap cover = MetaDataManager::instance()->getCover(core->metaData(Qmmp::URL));
        if(!cover.isNull())
        {
            coverPath = m_coverPath;
            cover.scaled(90,90,Qt::IgnoreAspectRatio,Qt::SmoothTransformation).save(coverPath);
        }
    }
    if(coverPath.isEmpty())
        coverPath = m_imagesDir + "/empty_cover.png";

    if(m_useFreedesktopSpec)
        args.append(body); //body
    else
    {
        QString nBody;
        nBody.append("<table padding=\"3px\"><tr><td width=\"80px\" height=\"80px\" padding=\"3px\">");
        nBody.append("<img height=\"80\" width=\"80\" src=\"%1\"></td><td width=\"10\"></td><td>%2</td></tr></table>");
        nBody = nBody.arg(coverPath,body);
        args.append(nBody);
    }

    args.append(QStringList()); //actions
    QVariantMap hints;
    hints.insert("image_path",coverPath);
    args.append(hints); //hints

    args.append(m_notifyDuration); //timeout

    return args;
}

void KdeNotify::showMetaData()
{
    QList<QVariant> n = prepareNotification();
    if(!n.isEmpty())
    {
        QDBusReply<uint> reply = m_notifier->callWithArgumentList(QDBus::Block,"Notify",n);
        if(reply.isValid() && m_updateNotify)
        {
            m_currentNotifyId = reply.value();
        }
    }
}

void KdeNotify::notificationClosed(uint id, uint reason)
{
    Q_UNUSED(reason);
    if(m_currentNotifyId == id)
        m_currentNotifyId = 0;
}