mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-14 10:05:32 +02:00
Merge from master
This commit is contained in:
@@ -14,6 +14,9 @@ ELSE()
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
FIND_PACKAGE( Taglib 1.6.0 REQUIRED )
|
FIND_PACKAGE( Taglib 1.6.0 REQUIRED )
|
||||||
|
include( CheckTagLibFileName )
|
||||||
|
check_taglib_filename( COMPLEX_TAGLIB_FILENAME )
|
||||||
|
|
||||||
FIND_PACKAGE( LibLastFm 0.3.3 REQUIRED )
|
FIND_PACKAGE( LibLastFm 0.3.3 REQUIRED )
|
||||||
FIND_PACKAGE( LibEchonest 1.1.1 REQUIRED )
|
FIND_PACKAGE( LibEchonest 1.1.1 REQUIRED )
|
||||||
FIND_PACKAGE( CLucene REQUIRED )
|
FIND_PACKAGE( CLucene REQUIRED )
|
||||||
@@ -29,4 +32,3 @@ ADD_SUBDIRECTORY( libportfwd )
|
|||||||
ADD_SUBDIRECTORY( qxt )
|
ADD_SUBDIRECTORY( qxt )
|
||||||
ADD_SUBDIRECTORY( src/libtomahawk )
|
ADD_SUBDIRECTORY( src/libtomahawk )
|
||||||
ADD_SUBDIRECTORY( src )
|
ADD_SUBDIRECTORY( src )
|
||||||
|
|
||||||
|
15
CMakeModules/CheckTagLibFileName.cmake
Normal file
15
CMakeModules/CheckTagLibFileName.cmake
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# taglib changed filenames to be a char/wchar struct on some platforms, need to check for it
|
||||||
|
macro (CHECK_TAGLIB_FILENAME TAGLIB_FILENAME_COMPLEX)
|
||||||
|
include (CheckCXXSourceCompiles)
|
||||||
|
set (CMAKE_REQUIRED_FLAGS ${TAGLIB_CFLAGS})
|
||||||
|
set (CMAKE_REQUIRED_INCLUDES ${TAGLIB_INCLUDES})
|
||||||
|
set (CMAKE_REQUIRED_LIBRARIES ${TAGLIB_LIBRARIES})
|
||||||
|
check_cxx_source_compiles(
|
||||||
|
"#include <tfile.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
TagLib::FileName fileName1(\"char\");
|
||||||
|
TagLib::FileName fileName2(L\"wchar\");
|
||||||
|
return 0;
|
||||||
|
}" ${TAGLIB_FILENAME_COMPLEX})
|
||||||
|
endmacro (CHECK_TAGLIB_FILENAME)
|
@@ -1 +1 @@
|
|||||||
61
|
63
|
@@ -301,6 +301,8 @@ Section "Tomahawk Player" SEC_TOMAHAWK_PLAYER
|
|||||||
File "${MING_DLL_PATH}\libechonest.dll"
|
File "${MING_DLL_PATH}\libechonest.dll"
|
||||||
File "${MING_DLL_PATH}\liblastfm.dll"
|
File "${MING_DLL_PATH}\liblastfm.dll"
|
||||||
|
|
||||||
|
File "${MING_LIB}\libclucene-core.dll"
|
||||||
|
|
||||||
File "${QXTWEB_DLL_PATH}\libqxtweb-standalone.dll"
|
File "${QXTWEB_DLL_PATH}\libqxtweb-standalone.dll"
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
|
@@ -364,7 +364,7 @@ target_link_libraries( tomahawklib
|
|||||||
ogg
|
ogg
|
||||||
FLAC++
|
FLAC++
|
||||||
tomahawk_jdns
|
tomahawk_jdns
|
||||||
clucene
|
${CLUCENE_LIBRARY}
|
||||||
)
|
)
|
||||||
|
|
||||||
install( TARGETS tomahawklib DESTINATION lib )
|
install( TARGETS tomahawklib DESTINATION lib )
|
||||||
|
@@ -8,6 +8,15 @@
|
|||||||
|
|
||||||
#include <CLucene.h>
|
#include <CLucene.h>
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
|
using namespace lucene::analysis;
|
||||||
|
using namespace lucene::document;
|
||||||
|
using namespace lucene::store;
|
||||||
|
using namespace lucene::index;
|
||||||
|
using namespace lucene::queryParser;
|
||||||
|
using namespace lucene::search;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
FuzzyIndex::FuzzyIndex( DatabaseImpl& db )
|
FuzzyIndex::FuzzyIndex( DatabaseImpl& db )
|
||||||
: QObject()
|
: QObject()
|
||||||
@@ -16,10 +25,10 @@ FuzzyIndex::FuzzyIndex( DatabaseImpl& db )
|
|||||||
, m_luceneSearcher( 0 )
|
, m_luceneSearcher( 0 )
|
||||||
{
|
{
|
||||||
QString lucenePath = TomahawkUtils::appDataDir().absoluteFilePath( "tomahawk.lucene" );
|
QString lucenePath = TomahawkUtils::appDataDir().absoluteFilePath( "tomahawk.lucene" );
|
||||||
bool create = !lucene::index::IndexReader::indexExists( lucenePath.toStdString().c_str() );
|
bool create = !IndexReader::indexExists( lucenePath.toStdString().c_str() );
|
||||||
m_luceneDir = lucene::store::FSDirectory::getDirectory( lucenePath.toStdString().c_str(), create );
|
m_luceneDir = FSDirectory::getDirectory( lucenePath.toStdString().c_str(), create );
|
||||||
|
|
||||||
m_analyzer = _CLNEW lucene::analysis::SimpleAnalyzer();
|
m_analyzer = _CLNEW SimpleAnalyzer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -36,7 +45,7 @@ void
|
|||||||
FuzzyIndex::beginIndexing()
|
FuzzyIndex::beginIndexing()
|
||||||
{
|
{
|
||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
lucene::index::IndexWriter luceneWriter = lucene::index::IndexWriter( m_luceneDir, m_analyzer, true );
|
IndexWriter luceneWriter = IndexWriter( m_luceneDir, m_analyzer, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -56,9 +65,9 @@ FuzzyIndex::appendFields( const QString& table, const QMap< unsigned int, QStrin
|
|||||||
m_luceneSearcher = 0;
|
m_luceneSearcher = 0;
|
||||||
m_luceneReader = 0;
|
m_luceneReader = 0;
|
||||||
|
|
||||||
bool create = !lucene::index::IndexReader::indexExists( TomahawkUtils::appDataDir().absoluteFilePath( "tomahawk.lucene" ).toStdString().c_str() );
|
bool create = !IndexReader::indexExists( TomahawkUtils::appDataDir().absoluteFilePath( "tomahawk.lucene" ).toStdString().c_str() );
|
||||||
lucene::index::IndexWriter luceneWriter = lucene::index::IndexWriter( m_luceneDir, m_analyzer, create );
|
IndexWriter luceneWriter = IndexWriter( m_luceneDir, m_analyzer, create );
|
||||||
lucene::document::Document doc;
|
Document doc;
|
||||||
|
|
||||||
QMapIterator< unsigned int, QString > it( fields );
|
QMapIterator< unsigned int, QString > it( fields );
|
||||||
while ( it.hasNext() )
|
while ( it.hasNext() )
|
||||||
@@ -68,14 +77,14 @@ FuzzyIndex::appendFields( const QString& table, const QMap< unsigned int, QStrin
|
|||||||
QString name = it.value();
|
QString name = it.value();
|
||||||
|
|
||||||
{
|
{
|
||||||
lucene::document::Field* field = _CLNEW lucene::document::Field( table.toStdWString().c_str(), name.toStdWString().c_str(),
|
Field* field = _CLNEW Field( table.toStdWString().c_str(), name.toStdWString().c_str(),
|
||||||
lucene::document::Field::STORE_YES | lucene::document::Field::INDEX_UNTOKENIZED );
|
Field::STORE_YES | Field::INDEX_UNTOKENIZED );
|
||||||
doc.add( *field );
|
doc.add( *field );
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
lucene::document::Field* field = _CLNEW lucene::document::Field( _T( "id" ), QString::number( id ).toStdWString().c_str(),
|
Field* field = _CLNEW Field( _T( "id" ), QString::number( id ).toStdWString().c_str(),
|
||||||
lucene::document::Field::STORE_YES | lucene::document::Field::INDEX_NO );
|
Field::STORE_YES | Field::INDEX_NO );
|
||||||
doc.add( *field );
|
doc.add( *field );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,29 +111,29 @@ FuzzyIndex::search( const QString& table, const QString& name )
|
|||||||
QMap< int, float > resultsmap;
|
QMap< int, float > resultsmap;
|
||||||
if ( !m_luceneReader )
|
if ( !m_luceneReader )
|
||||||
{
|
{
|
||||||
if ( !lucene::index::IndexReader::indexExists( TomahawkUtils::appDataDir().absoluteFilePath( "tomahawk.lucene" ).toStdString().c_str() ) )
|
if ( !IndexReader::indexExists( TomahawkUtils::appDataDir().absoluteFilePath( "tomahawk.lucene" ).toStdString().c_str() ) )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << "index didn't exist.";
|
qDebug() << Q_FUNC_INFO << "index didn't exist.";
|
||||||
return resultsmap;
|
return resultsmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_luceneReader = lucene::index::IndexReader::open( m_luceneDir );
|
m_luceneReader = IndexReader::open( m_luceneDir );
|
||||||
m_luceneSearcher = _CLNEW lucene::search::IndexSearcher( m_luceneReader );
|
m_luceneSearcher = _CLNEW IndexSearcher( m_luceneReader );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( name.isEmpty() )
|
if ( name.isEmpty() )
|
||||||
return resultsmap;
|
return resultsmap;
|
||||||
|
|
||||||
lucene::analysis::SimpleAnalyzer analyzer;
|
SimpleAnalyzer analyzer;
|
||||||
lucene::queryParser::QueryParser parser( table.toStdWString().c_str(), m_analyzer );
|
QueryParser parser( table.toStdWString().c_str(), m_analyzer );
|
||||||
lucene::search::Hits* hits = 0;
|
Hits* hits = 0;
|
||||||
|
|
||||||
lucene::search::FuzzyQuery* qry = _CLNEW lucene::search::FuzzyQuery( _CLNEW lucene::index::Term( table.toStdWString().c_str(), name.toStdWString().c_str() ) );
|
FuzzyQuery* qry = _CLNEW FuzzyQuery( _CLNEW Term( table.toStdWString().c_str(), name.toStdWString().c_str() ) );
|
||||||
hits = m_luceneSearcher->search( qry );
|
hits = m_luceneSearcher->search( qry );
|
||||||
|
|
||||||
for ( int i = 0; i < hits->length(); i++ )
|
for ( int i = 0; i < hits->length(); i++ )
|
||||||
{
|
{
|
||||||
lucene::document::Document* d = &hits->doc( i );
|
Document* d = &hits->doc( i );
|
||||||
|
|
||||||
float score = hits->score( i );
|
float score = hits->score( i );
|
||||||
int id = QString::fromWCharArray( d->get( _T( "id" ) ) ).toInt();
|
int id = QString::fromWCharArray( d->get( _T( "id" ) ) ).toInt();
|
||||||
|
@@ -7,26 +7,34 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
namespace lucene
|
namespace lucene
|
||||||
{
|
{
|
||||||
namespace analysis
|
namespace analysis
|
||||||
{
|
{
|
||||||
class SimpleAnalyzer;
|
class SimpleAnalyzer;
|
||||||
}
|
}
|
||||||
namespace store
|
namespace store
|
||||||
{
|
{
|
||||||
class Directory;
|
class Directory;
|
||||||
}
|
}
|
||||||
namespace index
|
namespace index
|
||||||
{
|
{
|
||||||
class IndexReader;
|
class IndexReader;
|
||||||
class IndexWriter;
|
class IndexWriter;
|
||||||
}
|
}
|
||||||
namespace search
|
namespace search
|
||||||
{
|
{
|
||||||
class IndexSearcher;
|
class IndexSearcher;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
class SimpleAnalyzer;
|
||||||
|
class Directory;
|
||||||
|
class IndexReader;
|
||||||
|
class IndexWriter;
|
||||||
|
class IndexSearcher;
|
||||||
|
#endif
|
||||||
|
|
||||||
class DatabaseImpl;
|
class DatabaseImpl;
|
||||||
|
|
||||||
@@ -54,10 +62,17 @@ private:
|
|||||||
DatabaseImpl& m_db;
|
DatabaseImpl& m_db;
|
||||||
QMutex m_mutex;
|
QMutex m_mutex;
|
||||||
|
|
||||||
|
#ifndef WIN32
|
||||||
lucene::analysis::SimpleAnalyzer* m_analyzer;
|
lucene::analysis::SimpleAnalyzer* m_analyzer;
|
||||||
lucene::store::Directory* m_luceneDir;
|
lucene::store::Directory* m_luceneDir;
|
||||||
lucene::index::IndexReader* m_luceneReader;
|
lucene::index::IndexReader* m_luceneReader;
|
||||||
lucene::search::IndexSearcher* m_luceneSearcher;
|
lucene::search::IndexSearcher* m_luceneSearcher;
|
||||||
|
#else
|
||||||
|
SimpleAnalyzer* m_analyzer;
|
||||||
|
Directory* m_luceneDir;
|
||||||
|
IndexReader* m_luceneReader;
|
||||||
|
IndexSearcher* m_luceneSearcher;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FUZZYINDEX_H
|
#endif // FUZZYINDEX_H
|
||||||
|
@@ -9,10 +9,12 @@
|
|||||||
#include "network/connection.h"
|
#include "network/connection.h"
|
||||||
#include "result.h"
|
#include "result.h"
|
||||||
|
|
||||||
|
#include "dllmacro.h"
|
||||||
|
|
||||||
class ControlConnection;
|
class ControlConnection;
|
||||||
class BufferIODevice;
|
class BufferIODevice;
|
||||||
|
|
||||||
class FileTransferConnection : public Connection
|
class DLLEXPORT FileTransferConnection : public Connection
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
#include "playlist/dynamic/DynamicControl.h"
|
#include "playlist/dynamic/DynamicControl.h"
|
||||||
|
|
||||||
|
#include "dllmacro.h"
|
||||||
|
|
||||||
class DatabaseCommand_LoadAllDynamicPlaylists;
|
class DatabaseCommand_LoadAllDynamicPlaylists;
|
||||||
class DatabaseCommand_SetDynamicPlaylistRevision;
|
class DatabaseCommand_SetDynamicPlaylistRevision;
|
||||||
class DatabaseCommand_CreateDynamicPlaylist;
|
class DatabaseCommand_CreateDynamicPlaylist;
|
||||||
@@ -37,7 +39,7 @@ namespace Tomahawk {
|
|||||||
* It uses normal PlaylistEntries but also has a mode, a generator, and a list of controls
|
* It uses normal PlaylistEntries but also has a mode, a generator, and a list of controls
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct DynamicPlaylistRevision : PlaylistRevision
|
struct DLLEXPORT DynamicPlaylistRevision : PlaylistRevision
|
||||||
{
|
{
|
||||||
QList< dyncontrol_ptr > controls;
|
QList< dyncontrol_ptr > controls;
|
||||||
Tomahawk::GeneratorMode mode;
|
Tomahawk::GeneratorMode mode;
|
||||||
@@ -56,7 +58,7 @@ struct DynamicPlaylistRevision : PlaylistRevision
|
|||||||
DynamicPlaylistRevision() {}
|
DynamicPlaylistRevision() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class DynamicPlaylist : public Playlist
|
class DLLEXPORT DynamicPlaylist : public Playlist
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@@ -7,12 +7,14 @@
|
|||||||
#include "playlist/dynamic/GeneratorInterface.h"
|
#include "playlist/dynamic/GeneratorInterface.h"
|
||||||
#include "typedefs.h"
|
#include "typedefs.h"
|
||||||
|
|
||||||
|
#include "dllmacro.h"
|
||||||
|
|
||||||
namespace Tomahawk {
|
namespace Tomahawk {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generators should subclass this and have it create the custom Generator
|
* Generators should subclass this and have it create the custom Generator
|
||||||
*/
|
*/
|
||||||
class GeneratorFactoryInterface
|
class DLLEXPORT GeneratorFactoryInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GeneratorFactoryInterface() {}
|
GeneratorFactoryInterface() {}
|
||||||
@@ -30,7 +32,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Simple factory that generates Generators from string type descriptors
|
* Simple factory that generates Generators from string type descriptors
|
||||||
*/
|
*/
|
||||||
class GeneratorFactory
|
class DLLEXPORT GeneratorFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static geninterface_ptr create( const QString& type );
|
static geninterface_ptr create( const QString& type );
|
||||||
|
@@ -25,6 +25,8 @@
|
|||||||
#include "query.h"
|
#include "query.h"
|
||||||
#include "playlist/dynamic/DynamicControl.h"
|
#include "playlist/dynamic/DynamicControl.h"
|
||||||
|
|
||||||
|
#include "dllmacro.h"
|
||||||
|
|
||||||
namespace Tomahawk {
|
namespace Tomahawk {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,7 +39,7 @@ namespace Tomahawk {
|
|||||||
* - Statically (ask for X tracks, get X tracks)
|
* - Statically (ask for X tracks, get X tracks)
|
||||||
* - On Demand (as for next track, ask for next track again, etc)
|
* - On Demand (as for next track, ask for next track again, etc)
|
||||||
*/
|
*/
|
||||||
class GeneratorInterface : public QObject
|
class DLLEXPORT GeneratorInterface : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY( QString type READ type )
|
Q_PROPERTY( QString type READ type )
|
||||||
|
@@ -24,12 +24,14 @@
|
|||||||
#include "playlist/dynamic/GeneratorFactory.h"
|
#include "playlist/dynamic/GeneratorFactory.h"
|
||||||
#include "playlist/dynamic/DynamicControl.h"
|
#include "playlist/dynamic/DynamicControl.h"
|
||||||
|
|
||||||
|
#include "dllmacro.h"
|
||||||
|
|
||||||
namespace Tomahawk
|
namespace Tomahawk
|
||||||
{
|
{
|
||||||
|
|
||||||
class EchonestSteerer;
|
class EchonestSteerer;
|
||||||
|
|
||||||
class EchonestFactory : public GeneratorFactoryInterface
|
class DLLEXPORT EchonestFactory : public GeneratorFactoryInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EchonestFactory();
|
EchonestFactory();
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
#ifndef RESULT_H
|
#ifndef RESULT_H
|
||||||
#define RESULT_H
|
#define RESULT_H
|
||||||
|
|
||||||
#include <qvariant.h>
|
#include <qvariant.h>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@@ -18,7 +18,7 @@ class DLLEXPORT Result : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Result();
|
Result();
|
||||||
explicit Result( const QVariant& v, const collection_ptr& collection );
|
explicit Result( const QVariant& v, const collection_ptr& collection );
|
||||||
virtual ~Result();
|
virtual ~Result();
|
||||||
|
|
||||||
|
@@ -160,7 +160,14 @@ MusicScanner::readFile( const QFileInfo& fi )
|
|||||||
if( m_scanned % 100 == 0 )
|
if( m_scanned % 100 == 0 )
|
||||||
qDebug() << "SCAN" << m_scanned << fi.absoluteFilePath();
|
qDebug() << "SCAN" << m_scanned << fi.absoluteFilePath();
|
||||||
|
|
||||||
TagLib::FileRef f( fi.absoluteFilePath().toUtf8().constData() );
|
#ifdef COMPLEX_TAGLIB_FILENAME
|
||||||
|
const wchar_t *encodedName = reinterpret_cast< const wchar_t *>(fi.absoluteFilePath().utf16());
|
||||||
|
#else
|
||||||
|
QByteArray fileName = QFile::encodeName( fi.absoluteFilePath() );
|
||||||
|
const char *encodedName = fileName.constData();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TagLib::FileRef f( encodedName );
|
||||||
if ( f.isNull() || !f.tag() )
|
if ( f.isNull() || !f.tag() )
|
||||||
{
|
{
|
||||||
// qDebug() << "Doesn't seem to be a valid audiofile:" << fi.absoluteFilePath();
|
// qDebug() << "Doesn't seem to be a valid audiofile:" << fi.absoluteFilePath();
|
||||||
|
@@ -15,7 +15,7 @@ SipHandler::SipHandler( QObject* parent )
|
|||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
{
|
{
|
||||||
m_connected = false;
|
m_connected = false;
|
||||||
loadPlugins();
|
loadPlugins( findPlugins() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -24,29 +24,61 @@ SipHandler::~SipHandler()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
QStringList
|
||||||
SipHandler::loadPlugins()
|
SipHandler::findPlugins()
|
||||||
{
|
{
|
||||||
QDir pluginsDir( qApp->applicationDirPath() );
|
QStringList paths;
|
||||||
|
QList< QDir > pluginDirs;
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
QDir appDir( qApp->applicationDirPath() );
|
||||||
if ( pluginsDir.dirName() == "MacOS" )
|
#ifdef Q_OS_MAC
|
||||||
|
if ( appDir.dirName() == "MacOS" )
|
||||||
{
|
{
|
||||||
pluginsDir.cdUp();
|
// Development convenience-hack
|
||||||
pluginsDir.cdUp();
|
appDir.cdUp();
|
||||||
pluginsDir.cdUp();
|
appDir.cdUp();
|
||||||
|
appDir.cdUp();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
// pluginsDir.cd( "plugins" );
|
|
||||||
|
|
||||||
foreach ( QString fileName, pluginsDir.entryList( QDir::Files ) )
|
QDir libDir( appDir );
|
||||||
|
libDir.cdUp();
|
||||||
|
libDir.cd( "lib" );
|
||||||
|
|
||||||
|
QDir lib64Dir( appDir );
|
||||||
|
lib64Dir.cdUp();
|
||||||
|
lib64Dir.cd( "lib64" );
|
||||||
|
|
||||||
|
pluginDirs << appDir << libDir << lib64Dir << QDir( qApp->applicationDirPath() );
|
||||||
|
foreach ( const QDir& pluginDir, pluginDirs )
|
||||||
|
{
|
||||||
|
qDebug() << "Checking directory for plugins:" << pluginDir;
|
||||||
|
foreach ( QString fileName, pluginDir.entryList( QDir::Files ) )
|
||||||
|
{
|
||||||
|
if ( fileName.startsWith( "libsip_" ) )
|
||||||
|
{
|
||||||
|
const QString path = pluginDir.absoluteFilePath( fileName );
|
||||||
|
if ( !paths.contains( path ) )
|
||||||
|
paths << path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
SipHandler::loadPlugins( const QStringList& paths )
|
||||||
|
{
|
||||||
|
foreach ( QString fileName, paths )
|
||||||
{
|
{
|
||||||
if ( !QLibrary::isLibrary( fileName ) )
|
if ( !QLibrary::isLibrary( fileName ) )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
qDebug() << "Trying to load plugin:" << pluginsDir.absoluteFilePath( fileName );
|
qDebug() << "Trying to load plugin:" << fileName;
|
||||||
|
|
||||||
QPluginLoader loader( pluginsDir.absoluteFilePath( fileName ) );
|
QPluginLoader loader( fileName );
|
||||||
QObject* plugin = loader.instance();
|
QObject* plugin = loader.instance();
|
||||||
if ( plugin )
|
if ( plugin )
|
||||||
{
|
{
|
||||||
|
@@ -35,7 +35,8 @@ private slots:
|
|||||||
void onError( int code, const QString& msg );
|
void onError( int code, const QString& msg );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadPlugins();
|
QStringList findPlugins();
|
||||||
|
void loadPlugins( const QStringList& paths );
|
||||||
void loadPlugin( QObject* plugin );
|
void loadPlugin( QObject* plugin );
|
||||||
|
|
||||||
QList< SipPlugin* > m_plugins;
|
QList< SipPlugin* > m_plugins;
|
||||||
|
Reference in New Issue
Block a user