From d2028612bdb51b9dbe82a4550c456b30f404d1d1 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sun, 13 Jan 2013 16:00:40 +0000 Subject: refactoring git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@3157 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/General.pro | 2 +- src/plugins/General/trackchange/songchange.cpp | 118 ------------------ src/plugins/General/trackchange/songchange.h | 59 --------- src/plugins/General/trackchange/songchange.pro | 36 ------ .../General/trackchange/songchangefactory.cpp | 63 ---------- .../General/trackchange/songchangefactory.h | 44 ------- src/plugins/General/trackchange/trackchange.cpp | 118 ++++++++++++++++++ src/plugins/General/trackchange/trackchange.h | 59 +++++++++ src/plugins/General/trackchange/trackchange.pro | 36 ++++++ .../General/trackchange/trackchangefactory.cpp | 63 ++++++++++ .../General/trackchange/trackchangefactory.h | 44 +++++++ .../translations/songchange_plugin_cs.ts | 133 --------------------- .../translations/songchange_plugin_de.ts | 133 --------------------- .../translations/songchange_plugin_es.ts | 133 --------------------- .../translations/songchange_plugin_fr.ts | 133 --------------------- .../translations/songchange_plugin_he.ts | 133 --------------------- .../translations/songchange_plugin_hu.ts | 133 --------------------- .../translations/songchange_plugin_it.ts | 133 --------------------- .../translations/songchange_plugin_ja.ts | 133 --------------------- .../translations/songchange_plugin_kk.ts | 133 --------------------- .../translations/songchange_plugin_lt.ts | 133 --------------------- .../translations/songchange_plugin_nl.ts | 133 --------------------- .../translations/songchange_plugin_pl_PL.ts | 133 --------------------- .../translations/songchange_plugin_pt_BR.ts | 133 --------------------- .../translations/songchange_plugin_ru.ts | 133 --------------------- .../translations/songchange_plugin_sk.ts | 133 --------------------- .../translations/songchange_plugin_tr.ts | 133 --------------------- .../translations/songchange_plugin_uk_UA.ts | 133 --------------------- .../translations/songchange_plugin_zh_CN.ts | 133 --------------------- .../translations/songchange_plugin_zh_TW.ts | 133 --------------------- 30 files changed, 321 insertions(+), 2848 deletions(-) delete mode 100644 src/plugins/General/trackchange/songchange.cpp delete mode 100644 src/plugins/General/trackchange/songchange.h delete mode 100644 src/plugins/General/trackchange/songchange.pro delete mode 100644 src/plugins/General/trackchange/songchangefactory.cpp delete mode 100644 src/plugins/General/trackchange/songchangefactory.h create mode 100644 src/plugins/General/trackchange/trackchange.cpp create mode 100644 src/plugins/General/trackchange/trackchange.h create mode 100644 src/plugins/General/trackchange/trackchange.pro create mode 100644 src/plugins/General/trackchange/trackchangefactory.cpp create mode 100644 src/plugins/General/trackchange/trackchangefactory.h delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_cs.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_de.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_es.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_fr.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_he.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_hu.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_it.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_ja.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_kk.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_lt.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_nl.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_pl_PL.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_pt_BR.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_ru.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_sk.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_tr.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_uk_UA.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_zh_CN.ts delete mode 100644 src/plugins/General/trackchange/translations/songchange_plugin_zh_TW.ts (limited to 'src/plugins/General') diff --git a/src/plugins/General/General.pro b/src/plugins/General/General.pro index b68c72da1..a44e6c947 100644 --- a/src/plugins/General/General.pro +++ b/src/plugins/General/General.pro @@ -5,7 +5,7 @@ SUBDIRS += statusicon \ fileops \ covermanager \ streambrowser \ - songchange + trackchange unix:SUBDIRS += mpris \ hal \ udisks \ diff --git a/src/plugins/General/trackchange/songchange.cpp b/src/plugins/General/trackchange/songchange.cpp deleted file mode 100644 index 0e79766de..000000000 --- a/src/plugins/General/trackchange/songchange.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/*************************************************************************** - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "songchange.h" - -SongChange::SongChange(QObject *parent) : QObject(parent) -{ - m_core = SoundCore::instance(); - m_plManager = PlayListManager::instance(); - connect(m_core, SIGNAL(stateChanged(Qmmp::State)), SLOT(onStateChanged(Qmmp::State))); - connect(m_core, SIGNAL(metaDataChanged()), SLOT(onMetaDataChanged())); - connect(m_core, SIGNAL(finished()), SLOT(onFinised())); - QSettings settings(Qmmp::configFile(), QSettings::IniFormat); - m_newTrackCommand = settings.value("SongChange/new_track_command").toString(); - m_endOfTrackCommand = settings.value("SongChange/end_of_track_command").toString(); - m_endOfPlCommand = settings.value("SongChange/end_of_pl_command").toString(); - m_titleChangeCommand = settings.value("SongChange/title_change_command").toString(); -} - -SongChange::~SongChange() -{} - -void SongChange::onStateChanged(Qmmp::State state) -{ - switch (state) - { - case Qmmp::Playing: - break; - default: - m_prevMetaData.clear(); - } -} - -void SongChange::onMetaDataChanged() -{ - QMap metaData = m_core->metaData(); - if(m_prevMetaData != metaData) - { - if(m_prevMetaData[Qmmp::URL] == metaData[Qmmp::URL]) - { - if(!m_titleChangeCommand.isEmpty()) - { - qDebug("SongChange: startig title change command.."); - executeCommand(metaData, m_titleChangeCommand); - } - } - else - { - if(!m_newTrackCommand.isEmpty()) - { - qDebug("SongChange: startig new track command.."); - executeCommand(metaData, m_newTrackCommand); - } - } - } - m_prevMetaData = metaData; -} - -void SongChange::onFinised() -{ - if(!m_endOfTrackCommand.isEmpty()) - { - qDebug("SongChange: startig end of track command.."); - executeCommand(m_prevMetaData, m_endOfTrackCommand); - } - if(!m_endOfPlCommand.isEmpty() && !m_plManager->currentPlayList()->nextItem()) - { - qDebug("SongChange: startig end of playlist command.."); - executeCommand(m_prevMetaData, m_endOfPlCommand); - } -} - -bool SongChange::executeCommand(const QMap &metaData, const QString &format) -{ - MetaDataFormatter formatter(format); - QString command = formatter.parse(metaData); -#ifdef Q_OS_WIN - bool ok = QProcess::startDetached(QString("cmd.exe \"%1\"").arg(command)); -#else - bool ok = QProcess::startDetached(QString("sh -c \"%1\"").arg(command)); -#endif - if(!ok) - qWarning("SongChange: unable to start command '%s'", qPrintable(command)); - return ok; -} diff --git a/src/plugins/General/trackchange/songchange.h b/src/plugins/General/trackchange/songchange.h deleted file mode 100644 index ae026b3eb..000000000 --- a/src/plugins/General/trackchange/songchange.h +++ /dev/null @@ -1,59 +0,0 @@ -/*************************************************************************** - * 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 -#include -#include - -class QAction; -class SoundCore; -class PlayListItem; -class PlayListManager; - -/** - @author Ilya Kotov -*/ -class SongChange : public QObject -{ - Q_OBJECT -public: - SongChange(QObject *parent = 0); - - ~SongChange(); - -private slots: - void onStateChanged(Qmmp::State state); - void onMetaDataChanged(); - void onFinised(); - -private: - bool executeCommand(const QMap &metaData, const QString &format); - QString m_newTrackCommand; - QString m_endOfTrackCommand; - QString m_endOfPlCommand; - QString m_titleChangeCommand; - SoundCore *m_core; - PlayListManager *m_plManager; - QMap m_prevMetaData; -}; - -#endif diff --git a/src/plugins/General/trackchange/songchange.pro b/src/plugins/General/trackchange/songchange.pro deleted file mode 100644 index 7bf1c046b..000000000 --- a/src/plugins/General/trackchange/songchange.pro +++ /dev/null @@ -1,36 +0,0 @@ -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 - -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/trackchange/songchangefactory.cpp b/src/plugins/General/trackchange/songchangefactory.cpp deleted file mode 100644 index e85e665d2..000000000 --- a/src/plugins/General/trackchange/songchangefactory.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/*************************************************************************** - * 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 - -#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 Song Change Plugin"), - tr("Qmmp Song Change Plugin")+"\n"+ - tr("Written by: Ilya Kotov ")); -} - -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/trackchange/songchangefactory.h b/src/plugins/General/trackchange/songchangefactory.h deleted file mode 100644 index 7e00519ac..000000000 --- a/src/plugins/General/trackchange/songchangefactory.h +++ /dev/null @@ -1,44 +0,0 @@ -/*************************************************************************** - * 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 -*/ -#include -#include -#include -#include -#include - -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 diff --git a/src/plugins/General/trackchange/trackchange.cpp b/src/plugins/General/trackchange/trackchange.cpp new file mode 100644 index 000000000..0e79766de --- /dev/null +++ b/src/plugins/General/trackchange/trackchange.cpp @@ -0,0 +1,118 @@ +/*************************************************************************** + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "songchange.h" + +SongChange::SongChange(QObject *parent) : QObject(parent) +{ + m_core = SoundCore::instance(); + m_plManager = PlayListManager::instance(); + connect(m_core, SIGNAL(stateChanged(Qmmp::State)), SLOT(onStateChanged(Qmmp::State))); + connect(m_core, SIGNAL(metaDataChanged()), SLOT(onMetaDataChanged())); + connect(m_core, SIGNAL(finished()), SLOT(onFinised())); + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + m_newTrackCommand = settings.value("SongChange/new_track_command").toString(); + m_endOfTrackCommand = settings.value("SongChange/end_of_track_command").toString(); + m_endOfPlCommand = settings.value("SongChange/end_of_pl_command").toString(); + m_titleChangeCommand = settings.value("SongChange/title_change_command").toString(); +} + +SongChange::~SongChange() +{} + +void SongChange::onStateChanged(Qmmp::State state) +{ + switch (state) + { + case Qmmp::Playing: + break; + default: + m_prevMetaData.clear(); + } +} + +void SongChange::onMetaDataChanged() +{ + QMap metaData = m_core->metaData(); + if(m_prevMetaData != metaData) + { + if(m_prevMetaData[Qmmp::URL] == metaData[Qmmp::URL]) + { + if(!m_titleChangeCommand.isEmpty()) + { + qDebug("SongChange: startig title change command.."); + executeCommand(metaData, m_titleChangeCommand); + } + } + else + { + if(!m_newTrackCommand.isEmpty()) + { + qDebug("SongChange: startig new track command.."); + executeCommand(metaData, m_newTrackCommand); + } + } + } + m_prevMetaData = metaData; +} + +void SongChange::onFinised() +{ + if(!m_endOfTrackCommand.isEmpty()) + { + qDebug("SongChange: startig end of track command.."); + executeCommand(m_prevMetaData, m_endOfTrackCommand); + } + if(!m_endOfPlCommand.isEmpty() && !m_plManager->currentPlayList()->nextItem()) + { + qDebug("SongChange: startig end of playlist command.."); + executeCommand(m_prevMetaData, m_endOfPlCommand); + } +} + +bool SongChange::executeCommand(const QMap &metaData, const QString &format) +{ + MetaDataFormatter formatter(format); + QString command = formatter.parse(metaData); +#ifdef Q_OS_WIN + bool ok = QProcess::startDetached(QString("cmd.exe \"%1\"").arg(command)); +#else + bool ok = QProcess::startDetached(QString("sh -c \"%1\"").arg(command)); +#endif + if(!ok) + qWarning("SongChange: unable to start command '%s'", qPrintable(command)); + return ok; +} diff --git a/src/plugins/General/trackchange/trackchange.h b/src/plugins/General/trackchange/trackchange.h new file mode 100644 index 000000000..ae026b3eb --- /dev/null +++ b/src/plugins/General/trackchange/trackchange.h @@ -0,0 +1,59 @@ +/*************************************************************************** + * 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 +#include +#include + +class QAction; +class SoundCore; +class PlayListItem; +class PlayListManager; + +/** + @author Ilya Kotov +*/ +class SongChange : public QObject +{ + Q_OBJECT +public: + SongChange(QObject *parent = 0); + + ~SongChange(); + +private slots: + void onStateChanged(Qmmp::State state); + void onMetaDataChanged(); + void onFinised(); + +private: + bool executeCommand(const QMap &metaData, const QString &format); + QString m_newTrackCommand; + QString m_endOfTrackCommand; + QString m_endOfPlCommand; + QString m_titleChangeCommand; + SoundCore *m_core; + PlayListManager *m_plManager; + QMap m_prevMetaData; +}; + +#endif diff --git a/src/plugins/General/trackchange/trackchange.pro b/src/plugins/General/trackchange/trackchange.pro new file mode 100644 index 000000000..d5295da23 --- /dev/null +++ b/src/plugins/General/trackchange/trackchange.pro @@ -0,0 +1,36 @@ +include(../../plugins.pri) + +INCLUDEPATH += ../../../../src +CONFIG += release \ +warn_on \ +plugin + +TARGET =$$PLUGINS_PREFIX/General/trackchange +unix : QMAKE_CLEAN = $$PLUGINS_PREFIX/General/libtrackchange.so + + +TEMPLATE = lib +unix : QMAKE_LIBDIR += ../../../../lib +unix : LIBS += -lqmmpui -lqmmp + +win32 : QMAKE_LIBDIR += ../../../../bin +win32 : LIBS += -lqmmpui0 -lqmmp0 + +RESOURCES = translations/translations.qrc +unix { + isEmpty(LIB_DIR){ + LIB_DIR = /lib + } + target.path = $$LIB_DIR/qmmp/General + INSTALLS += target +} +HEADERS += trackchangefactory.h \ + trackchange.h \ + settingsdialog.h + +win32 : HEADERS += ../../../../src/qmmpui/general.h +SOURCES += trackchangefactory.cpp \ + trackchange.cpp \ + settingsdialog.cpp + +FORMS += settingsdialog.ui diff --git a/src/plugins/General/trackchange/trackchangefactory.cpp b/src/plugins/General/trackchange/trackchangefactory.cpp new file mode 100644 index 000000000..e85e665d2 --- /dev/null +++ b/src/plugins/General/trackchange/trackchangefactory.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 + +#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 Song Change Plugin"), + tr("Qmmp Song Change Plugin")+"\n"+ + tr("Written by: Ilya Kotov ")); +} + +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/trackchange/trackchangefactory.h b/src/plugins/General/trackchange/trackchangefactory.h new file mode 100644 index 000000000..7e00519ac --- /dev/null +++ b/src/plugins/General/trackchange/trackchangefactory.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 +*/ +#include +#include +#include +#include +#include + +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 diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_cs.ts b/src/plugins/General/trackchange/translations/songchange_plugin_cs.ts deleted file mode 100644 index cfea184e4..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_cs.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_de.ts b/src/plugins/General/trackchange/translations/songchange_plugin_de.ts deleted file mode 100644 index 0af286050..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_de.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_es.ts b/src/plugins/General/trackchange/translations/songchange_plugin_es.ts deleted file mode 100644 index 731def568..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_es.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_fr.ts b/src/plugins/General/trackchange/translations/songchange_plugin_fr.ts deleted file mode 100644 index 4958161d4..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_fr.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_he.ts b/src/plugins/General/trackchange/translations/songchange_plugin_he.ts deleted file mode 100644 index b5c768c0c..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_he.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_hu.ts b/src/plugins/General/trackchange/translations/songchange_plugin_hu.ts deleted file mode 100644 index 890b3c6e3..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_hu.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_it.ts b/src/plugins/General/trackchange/translations/songchange_plugin_it.ts deleted file mode 100644 index 65bc2540e..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_it.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_ja.ts b/src/plugins/General/trackchange/translations/songchange_plugin_ja.ts deleted file mode 100644 index 96510a0ee..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_ja.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_kk.ts b/src/plugins/General/trackchange/translations/songchange_plugin_kk.ts deleted file mode 100644 index 35a4c4493..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_kk.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_lt.ts b/src/plugins/General/trackchange/translations/songchange_plugin_lt.ts deleted file mode 100644 index e9d285a62..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_lt.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_nl.ts b/src/plugins/General/trackchange/translations/songchange_plugin_nl.ts deleted file mode 100644 index cbe6da2ca..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_nl.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_pl_PL.ts b/src/plugins/General/trackchange/translations/songchange_plugin_pl_PL.ts deleted file mode 100644 index 99b36c5d0..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_pl_PL.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_pt_BR.ts b/src/plugins/General/trackchange/translations/songchange_plugin_pt_BR.ts deleted file mode 100644 index a2d53283d..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_pt_BR.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_ru.ts b/src/plugins/General/trackchange/translations/songchange_plugin_ru.ts deleted file mode 100644 index 54b8d6001..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_ru.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_sk.ts b/src/plugins/General/trackchange/translations/songchange_plugin_sk.ts deleted file mode 100644 index 8f3f48c88..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_sk.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_tr.ts b/src/plugins/General/trackchange/translations/songchange_plugin_tr.ts deleted file mode 100644 index efccc402a..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_tr.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_uk_UA.ts b/src/plugins/General/trackchange/translations/songchange_plugin_uk_UA.ts deleted file mode 100644 index 34728e398..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_uk_UA.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_zh_CN.ts b/src/plugins/General/trackchange/translations/songchange_plugin_zh_CN.ts deleted file mode 100644 index 7d1465121..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_zh_CN.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - diff --git a/src/plugins/General/trackchange/translations/songchange_plugin_zh_TW.ts b/src/plugins/General/trackchange/translations/songchange_plugin_zh_TW.ts deleted file mode 100644 index 602085554..000000000 --- a/src/plugins/General/trackchange/translations/songchange_plugin_zh_TW.ts +++ /dev/null @@ -1,133 +0,0 @@ - - - - - SettingsDialog - - - File Operations Settings - - - - - - - - ... - - - - - Command to run when Qmmp starts new track - - - - - Command to run toward to end of a track - - - - - Command to run when Qmmp reaches the end of the playlist - - - - - Command to run when title changes (i.e. network streams title) - - - - - Artist - - - - - Album - - - - - Title - - - - - Track number - - - - - Two-digit track number - - - - - Genre - - - - - Comment - - - - - Composer - - - - - Duration - - - - - Disc number - - - - - File name - - - - - File path - - - - - Year - - - - - Condition - - - - - SongChangeFactory - - - Song Change Plugin - - - - - About Song Change Plugin - - - - - Qmmp Song Change Plugin - - - - - Written by: Ilya Kotov <forkotov02@hotmail.ru> - - - - -- cgit v1.2.3-13-gbd6f