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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mountpointmanager.cpp

?? Amarok是一款在LINUX或其他類UNIX操作系統中運行的音頻播放器軟件。 經過兩年開發后
?? 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            }        }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99视频精品免费视频| 久久婷婷一区二区三区| 一区二区三区视频在线看| 99久久精品免费看| 一区二区三区成人在线视频| 欧美日韩国产综合视频在线观看 | av资源网一区| 亚洲人成影院在线观看| 欧美吞精做爰啪啪高潮| 日本女人一区二区三区| 欧美精品一区视频| 成熟亚洲日本毛茸茸凸凹| 自拍视频在线观看一区二区| 欧美亚洲综合久久| 黑人精品欧美一区二区蜜桃| 欧美激情一区二区三区四区 | 欧美在线视频全部完| 午夜久久久久久久久久一区二区| 欧美一区二区三区在线看| 国产激情视频一区二区三区欧美| 国产精品全国免费观看高清| 91在线免费播放| 天堂一区二区在线免费观看| 久久嫩草精品久久久久| 色88888久久久久久影院野外| 日韩—二三区免费观看av| 国产欧美综合在线| 欧美日韩一级视频| 日韩精品一二三| 亚洲电影在线免费观看| 日韩一区二区三区免费观看| 国产成人欧美日韩在线电影| 亚洲综合色自拍一区| 精品国产亚洲一区二区三区在线观看| 成人激情av网| 麻豆91免费观看| 亚洲一区二区三区激情| 久久久99精品免费观看不卡| 欧美色视频一区| 国产.欧美.日韩| 日本欧美在线观看| 亚洲视频一区二区免费在线观看| 日韩欧美在线综合网| 色综合天天视频在线观看| 久久99国产精品免费| 亚洲一区二区欧美日韩| 欧美国产成人精品| 精品精品国产高清一毛片一天堂| 色94色欧美sute亚洲线路一ni | 久久久www成人免费无遮挡大片| 日韩中文字幕1| 国产精品午夜久久| 日韩欧美你懂的| 欧美视频你懂的| www.66久久| 国产精品一区一区| 精品中文字幕一区二区小辣椒| 亚洲一线二线三线视频| 中文字幕一区二区三区四区不卡| 久久综合久久鬼色| 日韩一级在线观看| 欧美日韩国产综合一区二区| 色狠狠一区二区| 91免费视频网址| 成人avav影音| 国产福利一区在线| 国产在线国偷精品免费看| 青青草原综合久久大伊人精品| 一区二区三区电影在线播| 亚洲欧美国产77777| 国产精品视频看| 国产欧美精品一区aⅴ影院| 精品免费99久久| 精品久久国产老人久久综合| 国产精品毛片a∨一区二区三区| 欧美图片一区二区三区| 国产精品99久久久久久久vr| 久久草av在线| 久久国产夜色精品鲁鲁99| 免费观看日韩av| 日韩**一区毛片| 美女爽到高潮91| 免费欧美日韩国产三级电影| 喷水一区二区三区| 久久97超碰国产精品超碰| 欧美aaaaaa午夜精品| 伦理电影国产精品| 久久99精品久久久久久国产越南| 久久se这里有精品| 国产成人免费视| 成人美女在线观看| 91女厕偷拍女厕偷拍高清| 2023国产精品| 国产日韩欧美a| 中文字幕一区二区不卡| 亚洲裸体xxx| 亚洲成av人综合在线观看| 亚洲国产精品人人做人人爽| 日日夜夜精品免费视频| 激情久久五月天| 成人黄色小视频| 在线观看欧美精品| 欧美一级免费观看| 欧美极品xxx| 亚洲综合偷拍欧美一区色| 日本不卡视频在线观看| 国产综合色视频| 91一区一区三区| 在线成人小视频| 日本一区二区免费在线观看视频 | 欧美日韩中文字幕一区| 欧美一级理论片| 欧美韩国日本一区| 亚洲1区2区3区4区| 国产资源精品在线观看| 一本久久精品一区二区| 日韩你懂的在线观看| 国产精品久久久久久久裸模| 亚洲高清免费观看高清完整版在线观看 | 91在线观看免费视频| 欧美视频在线不卡| 日韩午夜av一区| 亚洲欧美日韩中文字幕一区二区三区 | 日本二三区不卡| 精品电影一区二区三区| 一区二区三区精品在线| 国内成人免费视频| 91福利视频在线| www激情久久| 亚洲国产欧美在线| 成人黄页在线观看| 欧美r级在线观看| 亚洲成精国产精品女| 波多野结衣一区二区三区| 欧美电视剧在线看免费| 亚洲综合小说图片| 成人av电影免费观看| 久久综合精品国产一区二区三区| 亚洲国产精品久久人人爱| 成人综合在线视频| 在线这里只有精品| 亚洲成人资源网| 欧美日韩国产区一| 欧美电影免费观看高清完整版在| 亚洲日本在线a| 国内精品国产成人| 国内成+人亚洲+欧美+综合在线 | 高清国产一区二区| 色一区在线观看| 久久精品欧美一区二区三区不卡 | 国产99久久久久久免费看农村| 欧洲人成人精品| 中文字幕亚洲欧美在线不卡| 国内精品第一页| 精品久久人人做人人爱| 99re8在线精品视频免费播放| 亚洲精品免费在线播放| 在线免费观看日韩欧美| 99精品国产热久久91蜜凸| 久久久亚洲精品一区二区三区| 日韩影院免费视频| 欧美日韩一本到| 亚洲精选一二三| 色综合一区二区三区| 国产精品久久久久久久午夜片| 国内精品写真在线观看| 91精品国产综合久久久久久久久久 | 日韩精品每日更新| www久久精品| 欧美性色综合网| 日本韩国欧美国产| 国产一区二区91| 夜夜嗨av一区二区三区| 欧美一区中文字幕| 极品美女销魂一区二区三区免费| 综合婷婷亚洲小说| 日韩一区二区三区在线观看| 国产成人精品网址| 国产欧美日韩综合| 国产精品中文欧美| 中文字幕 久热精品 视频在线| 成人免费精品视频| 亚洲乱码国产乱码精品精98午夜| 色综合天天综合色综合av| 亚洲综合色区另类av| 天堂蜜桃91精品| 日韩专区中文字幕一区二区| 午夜在线电影亚洲一区| 高清久久久久久| 日韩一区二区三区视频在线| 久久99深爱久久99精品| 久久久久久日产精品| 成人av在线资源网站| 一区二区激情小说| 91精品国产一区二区| 国产乱码精品一品二品| 亚洲免费资源在线播放| 在线不卡一区二区| 国产成人亚洲综合色影视| 亚洲精品国产成人久久av盗摄 |