mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-24 02:42:52 +00:00
kdeplasma-addons: audio player control runner review
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
47724012d2
commit
db4e43ae55
6 changed files with 247 additions and 310 deletions
|
@ -1,3 +0,0 @@
|
|||
Fix Bugs:
|
||||
226119
|
||||
225260
|
|
@ -20,7 +20,6 @@
|
|||
#ifndef AUDIOPLAYERCONTROLRUNNERCONFIGKEYS_H
|
||||
#define AUDIOPLAYERCONTROLRUNNERCONFIGKEYS_H
|
||||
|
||||
static const char * CONFIG_COMMANDS = "useCommands";
|
||||
static const char * CONFIG_PLAY = "com_play";
|
||||
static const char * CONFIG_APPEND = "com_append";
|
||||
static const char * CONFIG_PAUSE = "com_pause";
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <KRun>
|
||||
#include <KUrl>
|
||||
|
||||
// TODO: rewrite append feature to add URL to the tracks list via org.mpris.MediaPlayer2.TrackList.AddTrack
|
||||
/** The variable PLAY contains the action label for play */
|
||||
static const QString PLAY(QLatin1String("play"));
|
||||
/** The variable APPEND contains the action label for append */
|
||||
|
@ -102,7 +103,7 @@ void AudioPlayerControlRunner::match(Plasma::RunnerContext &context)
|
|||
|
||||
QList<Plasma::QueryMatch> matches;
|
||||
|
||||
if (m_useCommands && context.isValid() ) {
|
||||
if (context.isValid() ) {
|
||||
QVariantList playcontrol;
|
||||
playcontrol << QLatin1String("/org/mpris/MediaPlayer2") << QLatin1String("org.mpris.MediaPlayer2.Player");
|
||||
|
||||
|
@ -116,8 +117,8 @@ void AudioPlayerControlRunner::match(Plasma::RunnerContext &context)
|
|||
}
|
||||
|
||||
if (!m_running) {
|
||||
// The interface of the player is not availalbe, so the rest of the commands is not needed
|
||||
context.addMatches(term,matches);
|
||||
// The interface of the player is not availalbe, so the rest of the commands are not needed
|
||||
context.addMatches(term, matches);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -214,7 +215,7 @@ QList<QAction*> AudioPlayerControlRunner::actionsForMatch(const Plasma::QueryMat
|
|||
QList<QAction*> ret;
|
||||
QVariantList data = match.data().value<QVariantList>();
|
||||
|
||||
if (data.length() > 3 && data[3].toString().compare(NONE)) {
|
||||
if (data.length() > 3 && data[3].toString().compare(NONE) == 0) {
|
||||
if (!action(PLAY)) {
|
||||
addAction(PLAY, KIcon(QLatin1String("media-playback-start")), i18n("Play"));
|
||||
addAction(APPEND, KIcon(QLatin1String("media-track-add-amarok")), i18n("Append to playlist"));
|
||||
|
@ -233,7 +234,6 @@ void AudioPlayerControlRunner::reloadConfiguration()
|
|||
{
|
||||
KConfigGroup grp = config();
|
||||
m_player = grp.readEntry(CONFIG_PLAYER, "vlc");
|
||||
m_useCommands = grp.readEntry(CONFIG_COMMANDS, true);
|
||||
m_comPlay = grp.readEntry(CONFIG_PLAY, i18n("play"));
|
||||
m_comAppend = grp.readEntry(CONFIG_APPEND, i18n("append"));
|
||||
m_comPause = grp.readEntry(CONFIG_PAUSE, i18n("pause"));
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
#include <KIcon>
|
||||
#include <KUrl>
|
||||
|
||||
#include <QDBusPendingCallWatcher>
|
||||
|
||||
class AudioPlayerControlRunner : public Plasma::AbstractRunner
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -78,7 +76,6 @@ private:
|
|||
/** The player this runner controls */
|
||||
QString m_player;
|
||||
|
||||
//The commands
|
||||
/** Command for play a song */
|
||||
QString m_comPlay;
|
||||
/** Command for append a song */
|
||||
|
@ -96,9 +93,6 @@ private:
|
|||
/** Command for quit the player */
|
||||
QString m_comQuit;
|
||||
|
||||
/** Use the commands */
|
||||
bool m_useCommands;
|
||||
|
||||
/** The running state of the player */
|
||||
bool m_running;
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ AudioPlayerControlRunnerConfig::AudioPlayerControlRunnerConfig(QWidget* parent,
|
|||
QGridLayout* layout = new QGridLayout(this);
|
||||
layout->addWidget(m_ui, 0, 0);
|
||||
|
||||
connect(m_ui->commands, SIGNAL(clicked(bool)),this,SLOT(changed()));
|
||||
connect(m_ui->player_combo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
|
||||
connect(m_ui->player_combo, SIGNAL(editTextChanged(QString)), this, SLOT(changed()));
|
||||
connect(m_ui->play_edit, SIGNAL(textChanged(QString)), this, SLOT(changed()));
|
||||
|
@ -81,7 +80,6 @@ void AudioPlayerControlRunnerConfig::load()
|
|||
} else {
|
||||
m_ui->player_combo->setCurrentIndex(index);
|
||||
}
|
||||
m_ui->commands->setChecked(grp.readEntry(CONFIG_COMMANDS,true));
|
||||
m_ui->play_edit->setText(grp.readEntry(CONFIG_PLAY , i18n("play")));
|
||||
m_ui->append_edit->setText(grp.readEntry(CONFIG_APPEND, i18n("append")));
|
||||
m_ui->pause_edit->setText(grp.readEntry(CONFIG_PAUSE, i18n("pause")));
|
||||
|
@ -101,7 +99,6 @@ void AudioPlayerControlRunnerConfig::save()
|
|||
KSharedConfig::Ptr cfg = KSharedConfig::openConfig(QLatin1String("krunnerrc"));
|
||||
KConfigGroup grp = cfg->group("Runners");
|
||||
grp = KConfigGroup(&grp, "Audio Player Control Runner");
|
||||
grp.writeEntry(CONFIG_COMMANDS,m_ui->commands->isChecked());
|
||||
grp.writeEntry(CONFIG_PLAY, m_ui->play_edit->text());
|
||||
grp.writeEntry(CONFIG_APPEND, m_ui->append_edit->text());
|
||||
grp.writeEntry(CONFIG_PAUSE, m_ui->pause_edit->text());
|
||||
|
@ -127,7 +124,6 @@ void AudioPlayerControlRunnerConfig::defaults()
|
|||
KCModule::defaults();
|
||||
|
||||
m_ui->player_combo->setCurrentIndex(m_ui->player_combo->findData(QLatin1String("vlc")));
|
||||
m_ui->commands->setChecked(true);
|
||||
m_ui->play_edit->setText(i18n("Play"));
|
||||
m_ui->append_edit->setText(i18n("Append"));
|
||||
m_ui->pause_edit->setText(i18n("Pause")) ;
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>452</width>
|
||||
<height>354</height>
|
||||
<width>421</width>
|
||||
<height>318</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
|
@ -39,23 +39,83 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="commands">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="next_label">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Use Command&s</string>
|
||||
<property name="text">
|
||||
<string>&Next song:</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<property name="buddy">
|
||||
<cstring>next_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="stop_label">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>S&top:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>stop_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="prev_label">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Previ&ous song:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>prev_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="KLineEdit" name="append_edit">
|
||||
<property name="toolTip">
|
||||
<string>Use: append <term> (where <term> matches to artist, title or album)</string>
|
||||
</property>
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="urlDropsEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="quit_label">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="play_layout">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Quit player:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>quit_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="play_label">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
|
@ -68,7 +128,36 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="4" column="1">
|
||||
<widget class="KLineEdit" name="stop_edit">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="urlDropsEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="volume_label">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set &volume:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>volume_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="KLineEdit" name="play_edit">
|
||||
<property name="toolTip">
|
||||
<string>Can be used as "Play" for playing and "Play <song>" for playing a song that matches to <song> (in title, artist and album)</string>
|
||||
|
@ -87,44 +176,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="append_layout">
|
||||
<item>
|
||||
<widget class="QLabel" name="append_label">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ap&pend a song:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>append_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KLineEdit" name="append_edit">
|
||||
<property name="toolTip">
|
||||
<string>Use: append <term> (where <term> matches to artist, title or album)</string>
|
||||
</property>
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="urlDropsEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="pause_layout">
|
||||
<item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="pause_label">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
|
@ -137,139 +189,20 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KLineEdit" name="pause_edit">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="append_label">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="urlDropsEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="stop_layout">
|
||||
<item>
|
||||
<widget class="QLabel" name="stop_label">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>S&top:</string>
|
||||
<string>Ap&pend a song:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>stop_edit</cstring>
|
||||
<cstring>append_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KLineEdit" name="stop_edit">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="urlDropsEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="prev_layout">
|
||||
<item>
|
||||
<widget class="QLabel" name="prev_label">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Previ&ous song:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>prev_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KLineEdit" name="prev_edit">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="urlDropsEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="next_layout">
|
||||
<item>
|
||||
<widget class="QLabel" name="next_label">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Next song:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>next_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KLineEdit" name="next_edit">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="urlDropsEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="volume_layout">
|
||||
<item>
|
||||
<widget class="QLabel" name="volume_label">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set &volume:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>volume_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="7" column="1">
|
||||
<widget class="KLineEdit" name="volume_edit">
|
||||
<property name="toolTip">
|
||||
<string>The numbers are automatically added at the end:
|
||||
|
@ -292,24 +225,7 @@ Player:Volume=10</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="quit_layout">
|
||||
<item>
|
||||
<widget class="QLabel" name="quit_label">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Quit player:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>quit_edit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="8" column="1">
|
||||
<widget class="KLineEdit" name="quit_edit">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
|
@ -325,7 +241,53 @@ Player:Volume=10</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<item row="5" column="1">
|
||||
<widget class="KLineEdit" name="prev_edit">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="urlDropsEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="KLineEdit" name="pause_edit">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="urlDropsEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="KLineEdit" name="next_edit">
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="urlDropsEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="showClearButton" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -352,17 +314,6 @@ Player:Volume=10</string>
|
|||
<header>kcombobox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>commands</tabstop>
|
||||
<tabstop>play_edit</tabstop>
|
||||
<tabstop>append_edit</tabstop>
|
||||
<tabstop>pause_edit</tabstop>
|
||||
<tabstop>stop_edit</tabstop>
|
||||
<tabstop>prev_edit</tabstop>
|
||||
<tabstop>next_edit</tabstop>
|
||||
<tabstop>volume_edit</tabstop>
|
||||
<tabstop>quit_edit</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
Loading…
Add table
Reference in a new issue