aboutsummaryrefslogblamecommitdiff
path: root/src/plugins/Output/pulseaudio/outputpulseaudiofactory.cpp
blob: a000f03399241449b8bf75cb6f93c9d238f56939 (plain) (tree)
1
2
                                                                            
                                                                            














                                                                            
                                                                            


                                                                             
                      







                                                                  
                               
                                   
                                   


                      
                                         
 
                                  

 
                                               

             










                                                                    
                                                                              




                                                                       
                                              



                                                               
                                                     
/***************************************************************************
 *   Copyright (C) 2007-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 <QtGui>
#include <qmmp/qmmp.h>
#include "outputpulseaudio.h"
#include "outputpulseaudiofactory.h"


const OutputProperties OutputPulseAudioFactory::properties() const
{
    OutputProperties properties;
    properties.name = tr("PulseAudio Plugin");
    properties.hasAbout = true;
    properties.hasSettings = false;
    properties.shortName = "pulse";
    return properties;
}

Output* OutputPulseAudioFactory::create()
{
    return new OutputPulseAudio();
}

Volume *OutputPulseAudioFactory::createVolume()
{
    return 0;
}

void OutputPulseAudioFactory::showSettings(QWidget* parent)
{
   Q_UNUSED(parent);
}

void OutputPulseAudioFactory::showAbout(QWidget *parent)
{
   QMessageBox::about (parent, tr("About PulseAudio Output Plugin"),
                        tr("Qmmp PulseAudio Output Plugin")+"\n"+
                        tr("Written by: Ilya Kotov <forkotov02@hotmail.ru>"));
}

QTranslator *OutputPulseAudioFactory::createTranslator(QObject *parent)
{
    QTranslator *translator = new QTranslator(parent);
    QString locale = Qmmp::systemLanguageID();
    translator->load(QString(":/pulseaudio_plugin_") + locale);
    return translator;
}

Q_EXPORT_PLUGIN2(pulseaudio, OutputPulseAudioFactory)
b">static void setEnabled(FileDialogFactory *factory); /*! * Returns \b true if file dialog \b factory is used by default, otherwise returns \b false */ static bool isEnabled(FileDialogFactory *factory); signals: /*! * Emitted when the add button has pressed. Subclass should emit this signal. */ void filesAdded(const QStringList&); protected: /*! * Object constructor. */ FileDialog(); /*! * This is a function that will open modal file dialog and * return an existing directory selected by the user. * * @param parent Parent widget. * @param caption Dialog title. * @param dir Default directory. */ virtual QString existingDirectory(QWidget *parent, const QString &caption, const QString &dir); /*! * This is a function that will open modal file dialog and * return an existing file selected by the user. * Subclass should reimplement this function. * @param parent Parent widget. * @param caption Dialog title. * @param dir Default directory. * @param filter Filer used by file dialog * (example: "Audio (*.mp3 *.ogg);;Text files (*.txt);;XML files (*.xml)"). * @param selectedFilter Default selected filter */ virtual QString openFileName( QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter); /*! * This is a function that will open modal file dialog and * return an existing files selected by the user. * Subclass should reimplement this function. * @param parent Parent widget. * @param caption Dialog title. * @param dir Default directory. * @param filter Filer used by file dialog * (example: "Audio (*.mp3 *.ogg);;Text files (*.txt);;XML files (*.xml)"). * @param selectedFilter Default selected filter */ virtual QStringList openFileNames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedFilter); /*! * This is a function that will open modal file dialog and * return a file name selected by the user. The file does not have to exist. * Subclass should reimplement this function. * @param parent Parent widget. * @param caption Dialog title. * @param dir Default directory. * @param filter Filer used by file dialog * (example: "Audio (*.mp3 *.ogg);;Text files (*.txt);;XML files (*.xml)"). * @param selectedFilter Default selected filter. */ virtual QString saveFileName ( QWidget *parent , const QString &caption, const QString &dir, const QString &filter , QString *selectedFilter); /*! * Returns \b true if file dialog doesn't support nonmodal mode, otherwise returns \b false * Subclass should reimplement this function. */ virtual bool modal()const { return true; }; /*! * Object destructor */ virtual ~FileDialog() { ; }; /*! * Opens nonmodal file dialog. Selected file dialog should support nonmodal mode. * Otherwise this function does nothing. * Nonmodal dialog subclass should reimplement this function. * @param dir Default directory. * @param mode File dialog mode. * @param caption Dialog title. * @param mask Filer used by file dialog */ virtual void raise(const QString &dir = QString(), Mode mode = AddFiles, const QString &caption = QString(), const QStringList &mask = QStringList()) { Q_UNUSED(dir); Q_UNUSED(mode); Q_UNUSED(caption); Q_UNUSED(mask); } /*! * Returns a pointer to the selected file dialog instance. */ static FileDialog* instance(); /*! * Returns a pointer to the default file dialog instance. */ static FileDialog* defaultInstance(); /*! * Registers file dialog \b factory * Returns \b false if \b factory is already registered, otherwise returns \b true */ static bool registerFactory(FileDialogFactory *factory); private slots: void updateLastDir(const QStringList&); private: void init(QObject* receiver, const char* member, QString *dir); static void registerBuiltinFactories(); static void registerExternalFactories(); static QMap <QString,FileDialogFactory*> factories; static FileDialog* _instance; static QString m_current_factory; bool m_initialized; QString *m_lastDir; }; #endif