diff options
| -rw-r--r-- | src/plugins/General/General.pro | 3 | ||||
| -rw-r--r-- | src/plugins/General/songchange/settingsdialog.cpp | 102 | ||||
| -rw-r--r-- | src/plugins/General/songchange/settingsdialog.h | 49 | ||||
| -rw-r--r-- | src/plugins/General/songchange/settingsdialog.ui | 138 | ||||
| -rw-r--r-- | src/plugins/General/songchange/songchange.cpp | 42 | ||||
| -rw-r--r-- | src/plugins/General/songchange/songchange.h | 43 | ||||
| -rw-r--r-- | src/plugins/General/songchange/songchange.pro | 49 | ||||
| -rw-r--r-- | src/plugins/General/songchange/songchangefactory.cpp | 63 | ||||
| -rw-r--r-- | src/plugins/General/songchange/songchangefactory.h | 44 |
9 files changed, 532 insertions, 1 deletions
diff --git a/src/plugins/General/General.pro b/src/plugins/General/General.pro index 0a4ce59d1..b68c72da1 100644 --- a/src/plugins/General/General.pro +++ b/src/plugins/General/General.pro @@ -4,7 +4,8 @@ SUBDIRS += statusicon \ scrobbler \ fileops \ covermanager \ - streambrowser + streambrowser \ + songchange unix:SUBDIRS += mpris \ hal \ udisks \ diff --git a/src/plugins/General/songchange/settingsdialog.cpp b/src/plugins/General/songchange/settingsdialog.cpp new file mode 100644 index 000000000..156b09d77 --- /dev/null +++ b/src/plugins/General/songchange/settingsdialog.cpp @@ -0,0 +1,102 @@ +/*************************************************************************** + * Copyright (C) 2013 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 <QSettings> +#include <QMenu> +#include <qmmp/qmmp.h> +#include "songchange.h" +#include "settingsdialog.h" + +SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent) +{ + m_ui.setupUi(this); + addMenu(m_ui.newTrackButton); + addMenu(m_ui.endOfTrackButton); + addMenu(m_ui.endOfPlayListButton); + addMenu(m_ui.titleChangeButton); + + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + m_ui.newTrackLineEdit->setText(settings.value("SongChange/new_track_command").toString()); + m_ui.endOfTrackLineEdit->setText(settings.value("SongChange/end_of_track_command").toString()); + m_ui.endOfPlayListLineEdit->setText(settings.value("SongChange/end_of_pl_command").toString()); + m_ui.titleChangeLineEdit->setText(settings.value("SongChange/title_change_command").toString()); +} + + +SettingsDialog::~SettingsDialog() +{} + +void SettingsDialog::accept() +{ + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + settings.setValue("SongChange/new_track_command", m_ui.newTrackLineEdit->text()); + settings.setValue("SongChange/end_of_track_command", m_ui.endOfTrackLineEdit->text()); + settings.setValue("SongChange/end_of_pl_command", m_ui.endOfPlayListLineEdit->text()); + settings.setValue("SongChange/title_change_command", m_ui.titleChangeLineEdit->text()); + QDialog::accept(); +} + +void SettingsDialog::addMenu(QToolButton *button) +{ + QMenu *menu = new QMenu(this); + menu->addAction(tr("Artist"))->setData("%p"); + menu->addAction(tr("Album"))->setData("%a"); + menu->addAction(tr("Title"))->setData("%t"); + menu->addAction(tr("Track number"))->setData("%n"); + menu->addAction(tr("Two-digit track number"))->setData("%NN"); + menu->addAction(tr("Genre"))->setData("%g"); + menu->addAction(tr("Comment"))->setData("%c"); + menu->addAction(tr("Composer"))->setData("%C"); + menu->addAction(tr("Duration"))->setData("%l"); + menu->addAction(tr("Disc number"))->setData("%D"); + menu->addAction(tr("File name"))->setData("%f"); + menu->addAction(tr("File path"))->setData("%F"); + menu->addAction(tr("Year"))->setData("%y"); + menu->addAction(tr("Condition"))->setData("%if(%p&%t,%p - %t,%f)"); + button->setMenu(menu); + button->setPopupMode(QToolButton::InstantPopup); + connect(menu, SIGNAL(triggered (QAction *)), SLOT(addTitleString(QAction *))); +} + + + +/*void SettingsDialog::createMenus() +{ + QMenu *menu = new QMenu(this); + menu->addAction(tr("Artist"))->setData("%p"); + menu->addAction(tr("Album"))->setData("%a"); + menu->addAction(tr("Title"))->setData("%t"); + menu->addAction(tr("Track number"))->setData("%n"); + menu->addAction(tr("Two-digit track number"))->setData("%NN"); + menu->addAction(tr("Genre"))->setData("%g"); + menu->addAction(tr("Comment"))->setData("%c"); + menu->addAction(tr("Composer"))->setData("%C"); + menu->addAction(tr("Duration"))->setData("%l"); + menu->addAction(tr("Disc number"))->setData("%D"); + menu->addAction(tr("File name"))->setData("%f"); + menu->addAction(tr("File path"))->setData("%F"); + menu->addAction(tr("Year"))->setData("%y"); + menu->addAction(tr("Condition"))->setData("%if(%p&%t,%p - %t,%f)"); + ui.patternButton->setMenu(menu); + ui.patternButton->setPopupMode(QToolButton::InstantPopup); + connect(menu, SIGNAL(triggered (QAction *)), SLOT(addTitleString( QAction *))); +}*/ + + diff --git a/src/plugins/General/songchange/settingsdialog.h b/src/plugins/General/songchange/settingsdialog.h new file mode 100644 index 000000000..c6eb32292 --- /dev/null +++ b/src/plugins/General/songchange/settingsdialog.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (C) 2013 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. * + ***************************************************************************/ +#ifndef SETTINGSDIALOG_H +#define SETTINGSDIALOG_H + +#include <QDialog> +#include "ui_settingsdialog.h" + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +class SettingsDialog : public QDialog +{ + Q_OBJECT +public: + SettingsDialog(QWidget *parent = 0); + + ~SettingsDialog(); + +public slots: + void accept(); + +private: + void addMenu(QToolButton *button); + Ui::SettingsDialog m_ui; + +}; + + + + +#endif diff --git a/src/plugins/General/songchange/settingsdialog.ui b/src/plugins/General/songchange/settingsdialog.ui new file mode 100644 index 000000000..0fd6a84e2 --- /dev/null +++ b/src/plugins/General/songchange/settingsdialog.ui @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>SettingsDialog</class> + <widget class="QDialog" name="SettingsDialog"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>441</width> + <height>249</height> + </rect> + </property> + <property name="windowTitle"> + <string>File Operations Settings</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <property name="leftMargin"> + <number>6</number> + </property> + <property name="rightMargin"> + <number>6</number> + </property> + <property name="bottomMargin"> + <number>6</number> + </property> + <item row="1" column="0"> + <widget class="QLineEdit" name="newTrackLineEdit"/> + </item> + <item row="1" column="1"> + <widget class="QToolButton" name="newTrackButton"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLineEdit" name="endOfTrackLineEdit"/> + </item> + <item row="3" column="1"> + <widget class="QToolButton" name="endOfTrackButton"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <widget class="QLineEdit" name="endOfPlayListLineEdit"/> + </item> + <item row="5" column="1"> + <widget class="QToolButton" name="endOfPlayListButton"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="7" column="0"> + <widget class="QLineEdit" name="titleChangeLineEdit"/> + </item> + <item row="7" column="1"> + <widget class="QToolButton" name="titleChangeButton"> + <property name="text"> + <string>...</string> + </property> + </widget> + </item> + <item row="8" column="0" colspan="2"> + <widget class="QDialogButtonBox" name="buttonBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> + </property> + </widget> + </item> + <item row="0" column="0" colspan="2"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Command to run when Qmmp starts new track</string> + </property> + </widget> + </item> + <item row="2" column="0" colspan="2"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Command to run toward to end of a track</string> + </property> + </widget> + </item> + <item row="4" column="0" colspan="2"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Command to run when Qmmp reaches the end of the playlist</string> + </property> + </widget> + </item> + <item row="6" column="0" colspan="2"> + <widget class="QLabel" name="label_4"> + <property name="text"> + <string>Command to run when title changes (i.e. network streams title)</string> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>SettingsDialog</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel"> + <x>431</x> + <y>376</y> + </hint> + <hint type="destinationlabel"> + <x>155</x> + <y>378</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>SettingsDialog</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel"> + <x>433</x> + <y>381</y> + </hint> + <hint type="destinationlabel"> + <x>28</x> + <y>375</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/src/plugins/General/songchange/songchange.cpp b/src/plugins/General/songchange/songchange.cpp new file mode 100644 index 000000000..a367a412d --- /dev/null +++ b/src/plugins/General/songchange/songchange.cpp @@ -0,0 +1,42 @@ +/*************************************************************************** + * Copyright (C) 2013 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 <QAction> +#include <QSettings> +#include <QApplication> +#include <QSignalMapper> +#include <QProgressDialog> +#include <QMessageBox> +#include <QFile> +#include <QDir> +#include <qmmp/soundcore.h> +#include <qmmpui/uihelper.h> +#include <qmmpui/playlistmodel.h> +#include <qmmpui/playlistmanager.h> +#include <qmmpui/playlistitem.h> +#include <qmmpui/mediaplayer.h> +#include <qmmpui/metadataformatter.h> +#include "songchange.h" + +SongChange::SongChange(QObject *parent) : QObject(parent) +{} + +SongChange::~SongChange() +{} diff --git a/src/plugins/General/songchange/songchange.h b/src/plugins/General/songchange/songchange.h new file mode 100644 index 000000000..92ce4ef34 --- /dev/null +++ b/src/plugins/General/songchange/songchange.h @@ -0,0 +1,43 @@ +/*************************************************************************** + * Copyright (C) 2013 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. * + ***************************************************************************/ +#ifndef SONGCHANGE_H +#define SONGCHANGE_H + +#include <qmmpui/general.h> +#include <qmmp/qmmp.h> + +class QAction; +class SoundCore; +class PlayListItem; + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ + +class SongChange : public QObject +{ + Q_OBJECT +public: + SongChange(QObject *parent = 0); + + ~SongChange(); +}; + +#endif diff --git a/src/plugins/General/songchange/songchange.pro b/src/plugins/General/songchange/songchange.pro new file mode 100644 index 000000000..9318e9d48 --- /dev/null +++ b/src/plugins/General/songchange/songchange.pro @@ -0,0 +1,49 @@ +include(../../plugins.pri) + +INCLUDEPATH += ../../../../src +CONFIG += release \ +warn_on \ +plugin + +TARGET =$$PLUGINS_PREFIX/General/songchange +unix : QMAKE_CLEAN = $$PLUGINS_PREFIX/General/libsongchange.so + + +TEMPLATE = lib +unix : QMAKE_LIBDIR += ../../../../lib +unix : LIBS += -lqmmpui -lqmmp + +win32 : QMAKE_LIBDIR += ../../../../bin +win32 : LIBS += -lqmmpui0 -lqmmp0 + +#TRANSLATIONS = translations/songchange_plugin_cs.ts \ +# translations/songchange_plugin_de.ts \ +# translations/songchange_plugin_zh_CN.ts \ +# translations/songchange_plugin_zh_TW.ts \ +# translations/songchange_plugin_ru.ts \ +# translations/songchange_plugin_pl.ts \ +# translations/songchange_plugin_uk_UA.ts \ +# translations/songchange_plugin_it.ts \ +# translations/songchange_plugin_tr.ts \ +# translations/songchange_plugin_lt.ts \ +# translations/songchange_plugin_nl.ts \ +# translations/songchange_plugin_ja.ts \ +# translations/songchange_plugin_es.ts +#RESOURCES = translations/translations.qrc +unix { + isEmpty(LIB_DIR){ + LIB_DIR = /lib + } + target.path = $$LIB_DIR/qmmp/General + INSTALLS += target +} +HEADERS += songchangefactory.h \ + songchange.h \ + settingsdialog.h + +win32 : HEADERS += ../../../../src/qmmpui/general.h +SOURCES += songchangefactory.cpp \ + songchange.cpp \ + settingsdialog.cpp + +FORMS += settingsdialog.ui diff --git a/src/plugins/General/songchange/songchangefactory.cpp b/src/plugins/General/songchange/songchangefactory.cpp new file mode 100644 index 000000000..5f6a65c51 --- /dev/null +++ b/src/plugins/General/songchange/songchangefactory.cpp @@ -0,0 +1,63 @@ +/*************************************************************************** + * Copyright (C) 2013 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 <QtGui> + +#include "songchange.h" +#include "settingsdialog.h" +#include "songchangefactory.h" + +const GeneralProperties SongChangeFactory::properties() const +{ + GeneralProperties properties; + properties.name = tr("Song Change Plugin"); + properties.shortName = "songchange"; + properties.hasAbout = true; + properties.hasSettings = true; + properties.visibilityControl = false; + return properties; +} + +QObject *SongChangeFactory::create(QObject *parent) +{ + return new SongChange(parent); +} + +QDialog *SongChangeFactory::createConfigDialog(QWidget *parent) +{ + return new SettingsDialog(parent); +} + +void SongChangeFactory::showAbout(QWidget *parent) +{ + /*QMessageBox::about (parent, tr("About File Operations Plugin"), + tr("Qmmp File Operations Plugin")+"\n"+ + tr("Written by: Ilya Kotov <forkotov02@hotmail.ru>"));*/ +} + +QTranslator *SongChangeFactory::createTranslator(QObject *parent) +{ + QTranslator *translator = new QTranslator(parent); + QString locale = Qmmp::systemLanguageID(); + translator->load(QString(":/songchange_plugin_") + locale); + return translator; +} + +Q_EXPORT_PLUGIN2(songchange, SongChangeFactory) diff --git a/src/plugins/General/songchange/songchangefactory.h b/src/plugins/General/songchange/songchangefactory.h new file mode 100644 index 000000000..7e00519ac --- /dev/null +++ b/src/plugins/General/songchange/songchangefactory.h @@ -0,0 +1,44 @@ +/*************************************************************************** + * Copyright (C) 2013 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. * + ***************************************************************************/ +#ifndef SONGCHANGEFACTORY_H +#define SONGCHANGEFACTORY_H + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +#include <QObject> +#include <QTranslator> +#include <QDialog> +#include <qmmpui/general.h> +#include <qmmpui/generalfactory.h> + +class SongChangeFactory : public QObject, public GeneralFactory +{ +Q_OBJECT +Q_INTERFACES(GeneralFactory) +public: + const GeneralProperties properties() const; + QObject *create(QObject *parent); + QDialog *createConfigDialog(QWidget *parent); + void showAbout(QWidget *parent); + QTranslator *createTranslator(QObject *parent); +}; + +#endif |
