aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2019-07-01 21:25:36 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2019-07-01 21:25:36 +0000
commitae9b41a535a0d86968d8ec68ba1be4bf203a2176 (patch)
treece9dbb838b4d2253ba8fcbfda0429b79e1acec9a
parent7e2066ba76299dbb8e51493740b6507fe949958a (diff)
downloadqmmp-ae9b41a535a0d86968d8ec68ba1be4bf203a2176.tar.gz
qmmp-ae9b41a535a0d86968d8ec68ba1be4bf203a2176.tar.bz2
qmmp-ae9b41a535a0d86968d8ec68ba1be4bf203a2176.zip
prepare for ListenBrainz plugin implementation
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@8980 90c681e8-e032-0410-971d-27865f9a5e38
-rw-r--r--src/plugins/General/General.pro3
-rw-r--r--src/plugins/General/listenbrainz/listenbrainzfactory.cpp59
-rw-r--r--src/plugins/General/listenbrainz/listenbrainzfactory.h44
-rw-r--r--src/plugins/General/listenbrainz/settingsdialog.cpp24
-rw-r--r--src/plugins/General/listenbrainz/settingsdialog.h24
-rw-r--r--src/plugins/General/listenbrainz/settingsdialog.ui96
6 files changed, 249 insertions, 1 deletions
diff --git a/src/plugins/General/General.pro b/src/plugins/General/General.pro
index cd07a3c37..630434dff 100644
--- a/src/plugins/General/General.pro
+++ b/src/plugins/General/General.pro
@@ -10,7 +10,8 @@ SUBDIRS += statusicon \
trackchange \
copypaste \
rgscan \
- hotkey
+ hotkey \
+ listenbrainz
unix:SUBDIRS += mpris \
kdenotify \
diff --git a/src/plugins/General/listenbrainz/listenbrainzfactory.cpp b/src/plugins/General/listenbrainz/listenbrainzfactory.cpp
new file mode 100644
index 000000000..70d4884e6
--- /dev/null
+++ b/src/plugins/General/listenbrainz/listenbrainzfactory.cpp
@@ -0,0 +1,59 @@
+/***************************************************************************
+ * Copyright (C) 2019 by Ilya Kotov *
+ * forkotov02@ya.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 <QMessageBox>
+#include <qmmp/qmmp.h>
+//#include "scrobblerhandler.h"
+#include "settingsdialog.h"
+#include "listenbrainzfactory.h"
+
+GeneralProperties ListenBrainzFactory::properties() const
+{
+ GeneralProperties properties;
+ properties.name = tr("ListenBrainz Plugin");
+ properties.shortName = "listenbrainz";
+ properties.hasAbout = true;
+ properties.hasSettings = true;
+ properties.visibilityControl = false;
+ return properties;
+}
+
+QObject *ListenBrainzFactory::create(QObject *parent)
+{
+ //return new ScrobblerHandler(parent);
+ return nullptr;
+}
+
+QDialog *ListenBrainzFactory::createConfigDialog(QWidget *parent)
+{
+ return new SettingsDialog(parent);
+}
+
+void ListenBrainzFactory::showAbout(QWidget *parent)
+{
+ QMessageBox::about (parent, tr("About ListenBrainz Plugin"),
+ tr("Qmmp ListenBrainz Plugin")+"\n"+
+ tr("Written by: Ilya Kotov <forkotov02@ya.ru>"));
+}
+
+QString ListenBrainzFactory::translation() const
+{
+ return QLatin1String(":/listenbrainz_plugin_");
+}
diff --git a/src/plugins/General/listenbrainz/listenbrainzfactory.h b/src/plugins/General/listenbrainz/listenbrainzfactory.h
new file mode 100644
index 000000000..c7b77d608
--- /dev/null
+++ b/src/plugins/General/listenbrainz/listenbrainzfactory.h
@@ -0,0 +1,44 @@
+/***************************************************************************
+ * Copyright (C) 2019 by Ilya Kotov *
+ * forkotov02@ya.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 LISTENBRAINZFACTORY_H
+#define LISTENBRAINZFACTORY_H
+
+/**
+ @author Ilya Kotov <forkotov02@ya.ru>
+*/
+#include <QObject>
+
+#include <qmmpui/general.h>
+#include <qmmpui/generalfactory.h>
+
+class ListenBrainzFactory : public QObject, public GeneralFactory
+{
+Q_OBJECT
+Q_PLUGIN_METADATA(IID "org.qmmp.qmmpui.GeneralFactoryInterface.1.0")
+Q_INTERFACES(GeneralFactory)
+public:
+ GeneralProperties properties() const override;
+ QObject *create(QObject *parent) override;
+ QDialog *createConfigDialog(QWidget *parent) override;
+ void showAbout(QWidget *parent) override;
+ QString translation() const override;
+};
+
+#endif
diff --git a/src/plugins/General/listenbrainz/settingsdialog.cpp b/src/plugins/General/listenbrainz/settingsdialog.cpp
new file mode 100644
index 000000000..fe6bbf964
--- /dev/null
+++ b/src/plugins/General/listenbrainz/settingsdialog.cpp
@@ -0,0 +1,24 @@
+#include <QSettings>
+#include <qmmp/qmmp.h>
+#include "settingsdialog.h"
+#include "ui_settingsdialog.h"
+
+SettingsDialog::SettingsDialog(QWidget *parent) :
+ QDialog(parent), m_ui(new Ui::SettingsDialog)
+{
+ m_ui->setupUi(this);
+ QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
+ m_ui->userTokenLineEdit->setText(settings.value("ListenBrainz/user_token").toString());
+}
+
+SettingsDialog::~SettingsDialog()
+{
+ delete m_ui;
+}
+
+void SettingsDialog::accept()
+{
+ QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
+ settings.setValue("ListenBrainz/user_token", m_ui->userTokenLineEdit->text());
+ QDialog::accept();
+}
diff --git a/src/plugins/General/listenbrainz/settingsdialog.h b/src/plugins/General/listenbrainz/settingsdialog.h
new file mode 100644
index 000000000..3ee8b0ac0
--- /dev/null
+++ b/src/plugins/General/listenbrainz/settingsdialog.h
@@ -0,0 +1,24 @@
+#ifndef SETTINGSDIALOG_H
+#define SETTINGSDIALOG_H
+
+#include <QDialog>
+
+namespace Ui {
+class SettingsDialog;
+}
+
+class SettingsDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ explicit SettingsDialog(QWidget *parent = 0);
+ ~SettingsDialog();
+
+public slots:
+ void accept() override;
+
+private:
+ Ui::SettingsDialog *m_ui;
+};
+
+#endif // SETTINGSDIALOG_H
diff --git a/src/plugins/General/listenbrainz/settingsdialog.ui b/src/plugins/General/listenbrainz/settingsdialog.ui
new file mode 100644
index 000000000..3197fec04
--- /dev/null
+++ b/src/plugins/General/listenbrainz/settingsdialog.ui
@@ -0,0 +1,96 @@
+<?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>400</width>
+ <height>107</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <property name="leftMargin">
+ <number>6</number>
+ </property>
+ <property name="rightMargin">
+ <number>6</number>
+ </property>
+ <property name="bottomMargin">
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>ListenBrainz user token:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="userTokenLineEdit"/>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </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>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>SettingsDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>