mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 09:04:33 +02:00
Further work towards compilation
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QVariantMap>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QUuid>
|
||||
|
||||
|
@@ -174,7 +174,7 @@ void
|
||||
SipHandler::loadFromAccountManager()
|
||||
{
|
||||
QList< Tomahawk::Accounts::Account* > accountList = Tomahawk::Accounts::AccountManager::instance()->getAccounts( Tomahawk::Accounts::SipType );
|
||||
foreach( const Tomahawk::Accounts::Account* account, accountList )
|
||||
foreach( Tomahawk::Accounts::Account* account, accountList )
|
||||
{
|
||||
SipPlugin* p = account->sipPlugin();
|
||||
addSipPlugin( p );
|
||||
@@ -240,7 +240,7 @@ SipHandler::disconnectPlugin( const QString &pluginName )
|
||||
{
|
||||
foreach( SipPlugin* sip, m_connectedPlugins )
|
||||
{
|
||||
if ( sip->name() == pluginName )
|
||||
if ( sip->account()->accountId() == pluginName )
|
||||
sip->disconnectPlugin();
|
||||
}
|
||||
}
|
||||
@@ -387,7 +387,7 @@ SipHandler::onError( int code, const QString& msg )
|
||||
SipPlugin* sip = qobject_cast< SipPlugin* >( sender() );
|
||||
Q_ASSERT( sip );
|
||||
|
||||
qWarning() << "Failed to connect to SIP:" << sip->accountName() << code << msg;
|
||||
qWarning() << "Failed to connect to SIP:" << sip->account()->accountFriendlyName() << code << msg;
|
||||
|
||||
if ( code == SipPlugin::AuthError )
|
||||
{
|
||||
|
@@ -37,16 +37,14 @@ public:
|
||||
SipHandler( QObject* parent );
|
||||
~SipHandler();
|
||||
|
||||
QList< SipPluginFactory* > pluginFactories() const;
|
||||
QList< SipPlugin* > allPlugins() const;
|
||||
QList< SipPlugin* > connectedPlugins() const;
|
||||
void loadFromAccountManager();
|
||||
|
||||
void addSipPlugin( SipPlugin* p, bool enable = true );
|
||||
void addSipPlugin( SipPlugin* p );
|
||||
void removeSipPlugin( SipPlugin* p );
|
||||
|
||||
bool hasPluginType( const QString& factoryId ) const;
|
||||
SipPluginFactory* factoryFromPlugin( SipPlugin* p ) const;
|
||||
|
||||
const QPixmap avatar( const QString& name ) const;
|
||||
//TODO: implement a proper SipInfo class and maybe attach it to the source
|
||||
@@ -56,9 +54,6 @@ public:
|
||||
public slots:
|
||||
void checkSettings();
|
||||
|
||||
void enablePlugin( SipPlugin* p );
|
||||
void disablePlugin( SipPlugin* p );
|
||||
|
||||
void connectPlugin( const QString &pluginId = QString() );
|
||||
void disconnectPlugin( const QString &pluginId = QString() );
|
||||
void connectAll();
|
||||
@@ -68,13 +63,6 @@ public slots:
|
||||
|
||||
void refreshProxy();
|
||||
|
||||
// create a new plugin of the given name. the name is the value returned in SipPluginFactory::pluginName
|
||||
// be default sip plugins are NOt connected when created
|
||||
SipPlugin* createPlugin( const QString& factoryName );
|
||||
// load a plugin with the given id
|
||||
SipPlugin* loadPlugin( const QString& pluginId );
|
||||
void removePlugin( SipPlugin* p );
|
||||
|
||||
signals:
|
||||
void connected( SipPlugin* );
|
||||
void disconnected( SipPlugin* );
|
||||
@@ -113,7 +101,6 @@ private:
|
||||
void loadPluginFactory( const QString& path );
|
||||
QString factoryFromId( const QString& pluginId ) const;
|
||||
|
||||
QHash< QString, SipPluginFactory* > m_pluginFactories;
|
||||
QList< SipPlugin* > m_allPlugins;
|
||||
QList< SipPlugin* > m_enabledPlugins;
|
||||
QList< SipPlugin* > m_connectedPlugins;
|
||||
|
@@ -70,11 +70,11 @@ SipModel::data( const QModelIndex& index, int role ) const
|
||||
{
|
||||
case Qt::DisplayRole:
|
||||
case SipModel::PluginName:
|
||||
return p->accountName();
|
||||
return p->account()->accountServiceName();
|
||||
case SipModel::ConnectionStateRole:
|
||||
return p->connectionState();
|
||||
case SipModel::HasConfig:
|
||||
return ( p->configWidget() != 0 );
|
||||
return ( p->account()->configurationWidget() != 0 );
|
||||
case SipModel::FactoryRole:
|
||||
return false;
|
||||
case Qt::DecorationRole:
|
||||
@@ -82,12 +82,14 @@ SipModel::data( const QModelIndex& index, int role ) const
|
||||
case SipModel::SipPluginData:
|
||||
return QVariant::fromValue< QObject* >( p );
|
||||
case Qt::CheckStateRole:
|
||||
return SipHandler::instance()->enabledPlugins().contains( p ) ? Qt::Checked : Qt::Unchecked;
|
||||
return p->account()->enabled() ? Qt::Checked : Qt::Unchecked;
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* m_factories never actually populated yet, so just disable
|
||||
if( index.parent().isValid() ) { // this is a factory type
|
||||
SipPluginFactory* p = m_factories.at( index.row() );
|
||||
switch( role )
|
||||
@@ -104,7 +106,7 @@ SipModel::data( const QModelIndex& index, int role ) const
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
@@ -119,10 +121,10 @@ SipModel::setData( const QModelIndex& index, const QVariant& value, int role )
|
||||
QList< SipPlugin* > plugins = SipHandler::instance()->allPlugins();
|
||||
SipPlugin* p = plugins[ index.row() ];
|
||||
|
||||
if( state == Qt::Checked && !SipHandler::instance()->enabledPlugins().contains( p ) ) {
|
||||
SipHandler::instance()->enablePlugin( p );
|
||||
if( state == Qt::Checked && !p->account()->enabled() ) {
|
||||
p->account()->setEnabled( true );
|
||||
} else if( state == Qt::Unchecked ) {
|
||||
SipHandler::instance()->disablePlugin( p );
|
||||
p->account()->setEnabled( false );
|
||||
}
|
||||
dataChanged( index, index );
|
||||
|
||||
@@ -169,7 +171,7 @@ SipModel::rowCount( const QModelIndex& parent ) const
|
||||
return SipHandler::instance()->allPlugins().size() /* TODO inline factories disabled + 1*/;
|
||||
if( parent.isValid() && !parent.parent().isValid() ) { // top level item
|
||||
if( parent.row() == SipHandler::instance()->allPlugins().count() ) {// last row, this is the factory
|
||||
return m_factories.count();
|
||||
//return m_factories.count();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include <QModelIndex>
|
||||
#include <QStringList>
|
||||
|
||||
class SipPluginFactory;
|
||||
class SipPlugin;
|
||||
|
||||
class DLLEXPORT SipModel : public QAbstractItemModel
|
||||
@@ -59,9 +58,6 @@ private slots:
|
||||
void pluginAdded( SipPlugin* p );
|
||||
void pluginRemoved( SipPlugin* p );
|
||||
void pluginStateChanged( SipPlugin* p );
|
||||
|
||||
private:
|
||||
QList< SipPluginFactory* > m_factories;
|
||||
};
|
||||
|
||||
#endif // SIPMODEL_H
|
||||
|
Reference in New Issue
Block a user