亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? mountpointmanager.cpp

?? Amarok是一款在LINUX或其他類UNIX操作系統(tǒng)中運行的音頻播放器軟件。 經(jīng)過兩年開發(fā)后
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/* *  Copyright (c) 2006-2007 Maximilian Kossick <maximilian.kossick@googlemail.com> * *  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. */#define DEBUG_PREFIX "MountPointManager"#include "debug.h"#include "amarok.h"#include "amarokconfig.h"   //used in init()#include "collectiondb.h"#include "devicemanager.h"#include "mountpointmanager.h"#include "pluginmanager.h"#include "statusbar.h"#include <kglobal.h>        //used in init()#include <ktrader.h>#include <qfile.h>#include <qstringlist.h>#include <qtimer.h>#include <qvaluelist.h>typedef Medium::List MediumList;MountPointManager::MountPointManager()    : QObject( 0, "MountPointManager" )    , m_noDeviceManager( false ){    if ( !Amarok::config( "Collection" )->readBoolEntry( "DynamicCollection", true ) )    {        debug() << "Dynamic Collection deactivated in amarokrc, not loading plugins, not connecting signals" << endl;        return;    }    //we are only interested in the mounting or unmounting of mediums    //therefore it is enough to listen to DeviceManager's mediumChanged signal    if (DeviceManager::instance()->isValid() )    {        connect( DeviceManager::instance(), SIGNAL( mediumAdded( const Medium*, QString ) ), SLOT( mediumAdded( const Medium* ) ) );        connect( DeviceManager::instance(), SIGNAL( mediumChanged( const Medium*, QString ) ), SLOT( mediumChanged( const Medium* ) ) );        connect( DeviceManager::instance(), SIGNAL( mediumRemoved( const Medium*, QString ) ), SLOT( mediumRemoved( const Medium* ) ) );    }    else    {        handleMissingMediaManager();    }    m_mediumFactories.setAutoDelete( true );    m_remoteFactories.setAutoDelete( true );    init();    CollectionDB *collDB = CollectionDB::instance();    if ( collDB->adminValue( "Database Stats Version" ).toInt() >= 9 && /* make sure that deviceid actually exists*/         collDB->query( "SELECT COUNT(url) FROM statistics WHERE deviceid = -2;" ).first().toInt() != 0 )    {        connect( this, SIGNAL( mediumConnected( int ) ), SLOT( migrateStatistics() ) );        QTimer::singleShot( 0, this, SLOT( migrateStatistics() ) );    }    connect( this, SIGNAL( mediumConnected( int ) ), SLOT( updateStatisticsURLs() ) );    updateStatisticsURLs();}MountPointManager::~MountPointManager(){    m_handlerMapMutex.lock();    foreachType( HandlerMap, m_handlerMap )    {        delete it.data();    }    m_handlerMapMutex.unlock();}MountPointManager * MountPointManager::instance( ){    static MountPointManager instance;    return &instance;}voidMountPointManager::init(){    DEBUG_BLOCK    KTrader::OfferList plugins = PluginManager::query( "[X-KDE-Amarok-plugintype] == 'device'" );    debug() << "Received [" << QString::number( plugins.count() ) << "] device plugin offers" << endl;    foreachType( KTrader::OfferList, plugins )    {        Amarok::Plugin *plugin = PluginManager::createFromService( *it );        if( plugin )        {            DeviceHandlerFactory *factory = static_cast<DeviceHandlerFactory*>( plugin );            if ( factory->canCreateFromMedium() )                m_mediumFactories.append( factory );            else if (factory->canCreateFromConfig() )                m_remoteFactories.append( factory );            else                //FIXME max: better error message                debug() << "Unknown DeviceHandlerFactory" << endl;        }        else debug() << "Plugin could not be loaded" << endl;    }    //we need access to the unfiltered data    MediumList list = DeviceManager::instance()->getDeviceList();    foreachType ( MediumList, list )    {        mediumChanged( &(*it) );    }    if( !KGlobal::config()->hasGroup( "Collection Folders" ) )    {        QStringList folders = AmarokConfig::collectionFolders();        if( !folders.isEmpty() )            setCollectionFolders( folders );    }}intMountPointManager::getIdForUrl( KURL url ){    uint mountPointLength = 0;    int id = -1;    m_handlerMapMutex.lock();    foreachType( HandlerMap, m_handlerMap )    {        if ( url.path().startsWith( it.data()->getDevicePath() ) && mountPointLength < it.data()->getDevicePath().length() )        {            id = it.key();            mountPointLength = it.data()->getDevicePath().length();        }    }    m_handlerMapMutex.unlock();    if ( mountPointLength > 0 )    {        return id;    }    else    {        //default fallback if we could not identify the mount point.        //treat -1 as mount point / in al other methods        return -1;    }}intMountPointManager::getIdForUrl( const QString &url ){    return getIdForUrl( KURL::fromPathOrURL( url ) );}boolMountPointManager::isMounted ( const int deviceId ) const {    m_handlerMapMutex.lock();    bool result = m_handlerMap.contains( deviceId );    m_handlerMapMutex.unlock();    return result;}QStringMountPointManager::getMountPointForId( const int id ) const{    QString mountPoint;    if ( isMounted( id ) )    {        m_handlerMapMutex.lock();        mountPoint = m_handlerMap[id]->getDevicePath();        m_handlerMapMutex.unlock();    }    else        //TODO better error handling        mountPoint = "/";    return mountPoint;}voidMountPointManager::getAbsolutePath( const int deviceId, const KURL& relativePath, KURL& absolutePath) const{    //debug() << "id is " << deviceId << ", relative path is " << relativePath.path() << endl;    if ( deviceId == -1 )    {        absolutePath.setPath( "/" );        absolutePath.addPath( relativePath.path() );        absolutePath.cleanPath();        //debug() << "Deviceid is -1, using relative Path as absolute Path, returning " << absolutePath.path() << endl;        return;    }    m_handlerMapMutex.lock();    if ( m_handlerMap.contains( deviceId ) )    {        m_handlerMap[deviceId]->getURL( absolutePath, relativePath );        m_handlerMapMutex.unlock();    }    else    {        m_handlerMapMutex.unlock();        QStringList lastMountPoint = CollectionDB::instance()->query(                                                 QString( "SELECT lastmountpoint FROM devices WHERE id = %1" )                                                 .arg( deviceId ) );        if ( lastMountPoint.count() == 0 )        {            //hmm, no device with that id in the DB...serious problem            absolutePath.setPath( "/" );            absolutePath.addPath( relativePath.path() );            absolutePath.cleanPath();            warning() << "Device " << deviceId << " not in database, this should never happen! Returning " << absolutePath.path() << endl;        }        else        {            absolutePath.setPath( lastMountPoint.first() );            absolutePath.addPath( relativePath.path() );            absolutePath.cleanPath();//             debug() << "Device " << deviceId << " not mounted, using last mount point and returning " << absolutePath.path() << endl;        }    }}QStringMountPointManager::getAbsolutePath( const int deviceId, const QString& relativePath ) const{    KURL rpath;    rpath.setProtocol("file");    rpath.setPath( relativePath );    KURL url;    getAbsolutePath( deviceId, rpath, url );    return url.path();}voidMountPointManager::getRelativePath( const int deviceId, const KURL& absolutePath, KURL& relativePath ) const{    m_handlerMapMutex.lock();    if ( deviceId != -1 && m_handlerMap.contains( deviceId ) )    {        //FIXME max: returns garbage if the absolute path is actually not under the device's mount point        QString rpath = KURL::relativePath( m_handlerMap[deviceId]->getDevicePath(), absolutePath.path() );        m_handlerMapMutex.unlock();        relativePath.setPath( rpath );    }    else    {        m_handlerMapMutex.unlock();        //TODO: better error handling        QString rpath = KURL::relativePath( "/", absolutePath.path() );        relativePath.setPath( rpath );    }}QStringMountPointManager::getRelativePath( const int deviceId, const QString& absolutePath ) const{    KURL url;    getRelativePath( deviceId, KURL::fromPathOrURL( absolutePath ), url );    return url.path();}voidMountPointManager::mediumChanged( const Medium *m ){    DEBUG_BLOCK    if ( !m ) return;    if ( m->isMounted() )    {        foreachType( FactoryList, m_mediumFactories )        {            if ( (*it)->canHandle ( m ) )            {                debug() << "found handler for " << m->id() << endl;                DeviceHandler *handler = (*it)->createHandler( m );                if( !handler )                {                    debug() << "Factory " << (*it)->type() << "could not create device handler" << endl;                    break;                }                int key = handler->getDeviceID();                m_handlerMapMutex.lock();                if ( m_handlerMap.contains( key ) )                {                    debug() << "Key " << key << " already exists in handlerMap, replacing" << endl;                    delete m_handlerMap[key];                    m_handlerMap.erase( key );                }                m_handlerMap.insert( key, handler );                m_handlerMapMutex.unlock();                debug() << "added device " << key << " with mount point " << m->mountPoint() << endl;                emit mediumConnected( key );                break;  //we found the added medium and don't have to check the other device handlers            }        }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
首页国产丝袜综合| 精品国产1区2区3区| 日韩一区二区免费视频| 国产精品卡一卡二| 另类的小说在线视频另类成人小视频在线| 国产成人午夜精品影院观看视频 | 亚洲一本大道在线| 成人免费精品视频| 精品少妇一区二区三区在线播放 | 久久久777精品电影网影网 | 在线91免费看| 亚洲免费观看在线视频| 高清不卡在线观看| 欧美成人高清电影在线| 亚欧色一区w666天堂| 91丝袜高跟美女视频| 国产拍欧美日韩视频二区| 日韩精品五月天| 欧洲一区二区三区免费视频| 亚洲国产一区二区三区青草影视| 国产成人av在线影院| 精品国产精品一区二区夜夜嗨| 视频在线观看一区二区三区| 欧美色精品在线视频| 亚洲日本在线视频观看| eeuss影院一区二区三区| 久久久久久久久久久久久夜| 国产综合色精品一区二区三区| 欧美一级艳片视频免费观看| 日本sm残虐另类| 欧美一级免费大片| 久久精品国产77777蜜臀| 欧美一区二区三区在线观看| 青青草视频一区| 精品国产网站在线观看| 国产福利91精品一区二区三区| 久久久久久久久久久黄色| 国产福利精品一区二区| 中文字幕一区二区在线播放| 一本大道av伊人久久综合| 亚洲综合久久久| 欧美一区二区三区四区久久| 黄色成人免费在线| 成人免费在线视频| 欧美无砖砖区免费| 久久精品国产99国产| 国产欧美视频在线观看| 91麻豆国产在线观看| 亚洲午夜羞羞片| 久久亚洲一区二区三区明星换脸 | 国内成人精品2018免费看| 欧美精品一区二区三区很污很色的| 国产精品1区2区3区| 国产精品对白交换视频 | 午夜久久久久久久久久一区二区| 欧美精品一卡二卡| 国产剧情av麻豆香蕉精品| 亚洲天堂精品视频| 日韩视频免费观看高清在线视频| 国产精品资源站在线| 亚洲小说欧美激情另类| 久久一区二区视频| 欧美色综合网站| 国产成人在线视频网站| 一区二区三区日本| 久久在线观看免费| 欧美午夜不卡视频| 成人美女在线视频| 男人的天堂亚洲一区| 国产精品福利一区二区三区| 欧美一卡二卡三卡四卡| www.色综合.com| 精品中文字幕一区二区| 亚洲激情中文1区| 久久免费精品国产久精品久久久久| 91麻豆国产自产在线观看| 精品一区二区三区欧美| 性感美女极品91精品| 久久一区二区视频| 91精品国模一区二区三区| 成人激情免费电影网址| 国产资源精品在线观看| 亚洲一区在线电影| 国产精品免费观看视频| 精品国产网站在线观看| 91精品午夜视频| 91在线免费播放| 国产成人a级片| 久久se这里有精品| 偷拍自拍另类欧美| 亚洲激情自拍偷拍| 亚洲天堂免费在线观看视频| 久久久久久99精品| 欧美电影免费观看高清完整版在线| 在线观看一区不卡| 91理论电影在线观看| 丁香婷婷综合激情五月色| 九九**精品视频免费播放| 日韩国产成人精品| 日韩高清在线观看| 亚洲成人综合网站| 亚洲成a人片在线不卡一二三区| 日韩美女精品在线| 国产精品久久久久影院亚瑟| 亚洲国产高清在线| 中文字幕精品三区| 国产精品污网站| 国产精品久久夜| 中文字幕视频一区二区三区久| 久久精品视频免费观看| 欧美videos大乳护士334| 欧美一级免费大片| 日韩一区二区精品在线观看| 日韩欧美国产不卡| 欧美va在线播放| 久久综合国产精品| 中文欧美字幕免费| 欧美国产精品中文字幕| 国产精品免费丝袜| 亚洲婷婷综合色高清在线| 亚洲欧洲99久久| 亚洲一区二区三区四区五区中文 | 亚洲视频狠狠干| 亚洲综合激情另类小说区| 亚洲国产毛片aaaaa无费看| 亚洲观看高清完整版在线观看 | 亚洲一区二区在线视频| 亚洲与欧洲av电影| 视频一区在线播放| 国内精品在线播放| 国产不卡一区视频| 一本久道久久综合中文字幕| 欧美男人的天堂一二区| 日韩欧美中文字幕精品| 久久久精品免费网站| 日韩理论片在线| 午夜欧美电影在线观看| 久久精品国产澳门| eeuss鲁片一区二区三区在线看| 在线观看精品一区| 日韩精品一区二区三区在线观看 | 精品成人私密视频| 国产精品久久久爽爽爽麻豆色哟哟| 一区二区三区在线观看视频| 蜜臀av一区二区在线观看| 成人网页在线观看| 欧美日韩三级一区二区| 欧美成人国产一区二区| 亚洲三级在线播放| 男女视频一区二区| 99热这里都是精品| 日韩美女在线视频| 亚洲精品国产第一综合99久久| 日韩电影在线免费看| 岛国一区二区三区| 91精品国产一区二区三区| 中文字幕一区二区三区不卡 | 国产不卡视频一区二区三区| 欧美日韩一级黄| 国产拍欧美日韩视频二区| 日韩中文字幕一区二区三区| 成人免费视频播放| 欧美一级片免费看| 一区二区三区在线看| 国产成人99久久亚洲综合精品| 欧美一区二区性放荡片| 亚洲黄网站在线观看| 国产成人精品影视| 日韩欧美一二区| 亚洲国产成人av网| 91麻豆国产福利精品| 国产亚洲综合性久久久影院| 三级欧美在线一区| 在线这里只有精品| 亚洲日本中文字幕区| 国产99精品国产| 精品免费视频一区二区| 日韩中文字幕av电影| 91成人网在线| 亚洲日本乱码在线观看| 成人听书哪个软件好| 久久综合五月天婷婷伊人| 蜜臀av性久久久久蜜臀av麻豆| 欧美无乱码久久久免费午夜一区| 国产精品国产三级国产专播品爱网| 国产美女娇喘av呻吟久久| 日韩一区二区三区精品视频| 亚洲一区二区在线视频| 欧美怡红院视频| 亚洲香肠在线观看| 精品视频在线免费观看| 亚洲国产sm捆绑调教视频| 91国在线观看| 亚洲一区二区三区免费视频| 欧美中文字幕亚洲一区二区va在线| 亚洲欧美欧美一区二区三区| 99久久伊人久久99| 日韩美女精品在线| 欧洲一区在线观看| 天天影视网天天综合色在线播放|