patches
aboutsummaryrefslogblamecommitdiff
path: root/src/plugins/General/hal/halplugin.cpp
blob: 90f59bf6506fba3457e5c39ca283f0cb8c290884 (plain) (tree)
1
2
                                                                            
                                                                            














                                                                            
                                                                            



                                                                             

                       
                            
                               
                                   

                                



                       
                                                       





                                                                                                   


                                                                 

                                                                   

                                                        


                                                                   
                   
                             



                                                                     
                        

 


























                                                                        









                                                                                           
     







                                                                                 

               










                                                                                           
                                                                       


                                                                      

                                                                        
     









                                                                                            

               




                               
                                                

                                         









                                                                                                          
         




                                                                                                           
             



                                                                           
             
                                        
                                      










                                                                                          
                                         
                                                                          
                              

         
                                                   

                                                   
                                

                                            
                                                       
                                                  







                                                                                     
                                             
                                                                              































                                                                                               
 


                                            


                                                                           
     


                                                                        




                                                  
                                                                   


                                                       
                                                                   







                                                                               
                                                                           



                                                    

                                                                         



                
/***************************************************************************
 *   Copyright (C) 2009-2014 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 <QtDBus>
#include <QActionGroup>
#include <QApplication>
#include <QStyle>
#include <qmmpui/uihelper.h>
#include <qmmpui/mediaplayer.h>
#include <qmmpui/playlistmanager.h>
#include <qmmpui/playlistitem.h>
#include <qmmp/qmmp.h>
#include "haldevice.h"
#include "halmanager.h"
#include "halplugin.h"

HalPlugin::HalPlugin(QObject *parent) : QObject(parent)
{
    m_manager = new HalManager(this);
    m_actions = new QActionGroup(this);
    connect(m_manager,SIGNAL(deviceAdded(const QString &)), SLOT(addDevice(const QString &)));
    connect(m_manager,SIGNAL(deviceRemoved(const QString &)), SLOT(removeDevice(const QString &)));
    connect(m_actions,SIGNAL(triggered (QAction *)), SLOT(processAction(QAction *)));
    //load settings
    QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
    settings.beginGroup("HAL");
    m_detectCDA = settings.value("cda", true).toBool();
    m_detectRemovable = settings.value("removable", true).toBool();
    m_addTracks = false; //do not load tracks on startup
    m_addFiles = false;
    //find existing devices
    QStringList udis = m_manager->findDeviceByCapability("volume");
    foreach(QString udi, udis)
    addDevice(udi);
    //load remaining settings
    m_addTracks = settings.value("add_tracks", false).toBool();
    m_removeTracks = settings.value("remove_tracks", false).toBool();
    m_addFiles = settings.value("add_files", false).toBool();
    m_removeFiles = settings.value("remove_files", false).toBool();
    settings.endGroup();
}

HalPlugin::~HalPlugin()
{
}