Skip to content

Commit

Permalink
Project cleanup, HTTP stream reader update
Browse files Browse the repository at this point in the history
  • Loading branch information
rigon committed Oct 7, 2016
1 parent f6bddfb commit 8252da1
Show file tree
Hide file tree
Showing 4 changed files with 206 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/streambrowser.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/***************************************************************************
* Copyright (C) 2012 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 <QApplication>
#include <qmmp/soundcore.h>
#include <qmmpui/uihelper.h>
#include <qmmpui/playlistmanager.h>
#include <qmmpui/playlistitem.h>
#include <qmmpui/mediaplayer.h>
#include <qmmp/inputsource.h>
#include <qmmp/inputsourcefactory.h>
#include <QMessageBox>
#include "streambrowser.h"

StreamBrowser::StreamBrowser(QObject *parent) : QObject(parent)
{
m_action = new QAction(tr("Youtube"), this);
m_action->setIcon(QIcon::fromTheme("applications-internet"));
m_action->setShortcut(tr("Ctrl+Y"));
UiHelper::instance()->addAction(m_action, UiHelper::TOOLS_MENU);
connect (m_action, SIGNAL(triggered ()), SLOT(showStreamWindow()));
}

StreamBrowser::~StreamBrowser()
{}

void StreamBrowser::showStreamWindow()
{
QMessageBox::about (NULL, tr("About Youtube Plugin"),
tr("Qmmp Youtube Plugin"));
}
49 changes: 49 additions & 0 deletions src/streambrowser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/***************************************************************************
* Copyright (C) 2012 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 STREAMBROWSER_H
#define STREAMBROWSER_H

#include <QPointer>
#include <qmmpui/general.h>
#include <qmmp/qmmp.h>

class QAction;
class StreamWindow;

/**
@author Ilya Kotov <forkotov02@hotmail.ru>
*/

class StreamBrowser : public QObject
{
Q_OBJECT
public:
StreamBrowser(QObject *parent = 0);

~StreamBrowser();

private slots:
void showStreamWindow();

private:
QAction *m_action;
};

#endif
62 changes: 62 additions & 0 deletions src/streambrowserfactory.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/***************************************************************************
* Copyright (C) 2012 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 <QMessageBox>
#include "streambrowser.h"
#include "streambrowserfactory.h"

const GeneralProperties StreamBrowserFactory::properties() const
{
GeneralProperties properties;
properties.name = tr("Youtube Plugin");
properties.shortName = "youtube";
properties.hasAbout = true;
properties.hasSettings = false;
properties.visibilityControl = false;
return properties;
}

QObject *StreamBrowserFactory::create(QObject *parent)
{
return new StreamBrowser(parent);
}

QDialog *StreamBrowserFactory::createConfigDialog(QWidget *parent)
{
Q_UNUSED(parent);
return 0;
}

void StreamBrowserFactory::showAbout(QWidget *parent)
{
QMessageBox::about (parent, tr("About Stream Browser Plugin"),
tr("Qmmp Stream Browser Plugin")+"\n"+
tr("This plugin allows one to add stream from IceCast stream directory")+"\n"+
tr("Written by: Ilya Kotov <forkotov02@hotmail.ru>"));
}

QTranslator *StreamBrowserFactory::createTranslator(QObject *parent)
{
QTranslator *translator = new QTranslator(parent);
QString locale = Qmmp::systemLanguageID();
translator->load(QString(":/streambrowser_plugin_") + locale);
return translator;
}
46 changes: 46 additions & 0 deletions src/streambrowserfactory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/***************************************************************************
* Copyright (C) 2012 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 STREAMBROWSERFACTORY_H
#define STREAMBROWSERFACTORY_H

/**
@author Ilya Kotov <forkotov02@hotmail.ru>
*/
#include <QObject>
#include <QTranslator>
#include <QDialog>

#include <qmmpui/general.h>
#include <qmmpui/generalfactory.h>

class StreamBrowserFactory : public QObject, public GeneralFactory
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qmmp.qmmpui.GeneralFactoryInterface.1.0")
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

0 comments on commit 8252da1

Please sign in to comment.