mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-18 23:09:42 +01:00
ready for settings dialog work
This commit is contained in:
parent
b6911525a4
commit
00adb66cf0
@ -90,81 +90,81 @@ void DiagnosticsDialog::updateLogView()
|
||||
log.append("\n\n");
|
||||
|
||||
|
||||
// Peers
|
||||
log.append("SIP PLUGINS:\n");
|
||||
QList< Tomahawk::source_ptr > sources = SourceList::instance()->sources( true );
|
||||
Q_FOREACH(SipPlugin *sip, SipHandler::instance()->allPlugins())
|
||||
{
|
||||
Q_ASSERT(sip);
|
||||
QString stateString;
|
||||
switch( sip->connectionState() )
|
||||
{
|
||||
case SipPlugin::Connecting:
|
||||
stateString = "Connecting";
|
||||
break;
|
||||
// Peers / Accounts, TODO
|
||||
log.append("ACCOUNTS:\n");
|
||||
// QList< Tomahawk::source_ptr > sources = SourceList::instance()->sources( true );
|
||||
// Q_FOREACH(SipPlugin *sip, SipHandler::instance()->allPlugins())
|
||||
// {
|
||||
// Q_ASSERT(sip);
|
||||
// QString stateString;
|
||||
// switch( sip->connectionState() )
|
||||
// {
|
||||
// case SipPlugin::Connecting:
|
||||
// stateString = "Connecting";
|
||||
// break;
|
||||
//
|
||||
// case SipPlugin::Connected:
|
||||
// stateString = "Connected";
|
||||
// break;
|
||||
//
|
||||
// case SipPlugin::Disconnected:
|
||||
// stateString = "Disconnected";
|
||||
// break;
|
||||
// case SipPlugin::Disconnecting:
|
||||
// stateString = "Disconnecting";
|
||||
// }
|
||||
// log.append(
|
||||
// QString(" %2 (%1): %3 (%4)\n")
|
||||
// .arg(sip->account()->accountServiceName())
|
||||
// .arg(sip->friendlyName())
|
||||
// .arg(sip->account()->accountFriendlyName())
|
||||
// .arg(stateString)
|
||||
// );
|
||||
|
||||
case SipPlugin::Connected:
|
||||
stateString = "Connected";
|
||||
break;
|
||||
|
||||
case SipPlugin::Disconnected:
|
||||
stateString = "Disconnected";
|
||||
break;
|
||||
case SipPlugin::Disconnecting:
|
||||
stateString = "Disconnecting";
|
||||
}
|
||||
log.append(
|
||||
QString(" %2 (%1): %3 (%4)\n")
|
||||
.arg(sip->account()->accountServiceName())
|
||||
.arg(sip->friendlyName())
|
||||
.arg(sip->account()->accountFriendlyName())
|
||||
.arg(stateString)
|
||||
);
|
||||
|
||||
Q_FOREACH( const QString &peerId, sip->peersOnline() )
|
||||
{
|
||||
/* enable this again, when we check the source has this peerId
|
||||
bool connected = false;
|
||||
Q_FOREACH( const Tomahawk::source_ptr &source, sources )
|
||||
{
|
||||
if( source->controlConnection() )
|
||||
{
|
||||
connected = true;
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
QString versionString = SipHandler::instance()->versionString( peerId );
|
||||
SipInfo sipInfo = SipHandler::instance()->sipInfo( peerId );
|
||||
if( !sipInfo.isValid() )
|
||||
log.append(
|
||||
QString(" %1: %2 %3" /*"(%4)"*/ "\n")
|
||||
.arg( peerId )
|
||||
.arg( "sipinfo invalid" )
|
||||
.arg( versionString )
|
||||
// .arg( connected ? "connected" : "not connected")
|
||||
);
|
||||
else if( sipInfo.isVisible() )
|
||||
log.append(
|
||||
QString(" %1: %2:%3 %4" /*" (%5)"*/ "\n")
|
||||
.arg( peerId )
|
||||
.arg( sipInfo.host().hostName() )
|
||||
.arg( sipInfo.port() )
|
||||
.arg( versionString )
|
||||
// .arg( connected ? "connected" : "not connected")
|
||||
|
||||
);
|
||||
else
|
||||
log.append(
|
||||
QString(" %1: visible: false %2" /*" (%3)"*/ "\n")
|
||||
.arg( peerId )
|
||||
.arg( versionString )
|
||||
// .arg( connected ? "connected" : "not connected")
|
||||
|
||||
);
|
||||
}
|
||||
log.append("\n");
|
||||
}
|
||||
// Q_FOREACH( const QString &peerId, sip->peersOnline() )
|
||||
// {
|
||||
// /* enable this again, when we check the source has this peerId
|
||||
// bool connected = false;
|
||||
// Q_FOREACH( const Tomahawk::source_ptr &source, sources )
|
||||
// {
|
||||
// if( source->controlConnection() )
|
||||
// {
|
||||
// connected = true;
|
||||
// break;
|
||||
// }
|
||||
// }*/
|
||||
//
|
||||
// QString versionString = SipHandler::instance()->versionString( peerId );
|
||||
// SipInfo sipInfo = SipHandler::instance()->sipInfo( peerId );
|
||||
// if( !sipInfo.isValid() )
|
||||
// log.append(
|
||||
// QString(" %1: %2 %3" /*"(%4)"*/ "\n")
|
||||
// .arg( peerId )
|
||||
// .arg( "sipinfo invalid" )
|
||||
// .arg( versionString )
|
||||
// // .arg( connected ? "connected" : "not connected")
|
||||
// );
|
||||
// else if( sipInfo.isVisible() )
|
||||
// log.append(
|
||||
// QString(" %1: %2:%3 %4" /*" (%5)"*/ "\n")
|
||||
// .arg( peerId )
|
||||
// .arg( sipInfo.host().hostName() )
|
||||
// .arg( sipInfo.port() )
|
||||
// .arg( versionString )
|
||||
// // .arg( connected ? "connected" : "not connected")
|
||||
//
|
||||
// );
|
||||
// else
|
||||
// log.append(
|
||||
// QString(" %1: visible: false %2" /*" (%3)"*/ "\n")
|
||||
// .arg( peerId )
|
||||
// .arg( versionString )
|
||||
// // .arg( connected ? "connected" : "not connected")
|
||||
//
|
||||
// );
|
||||
// }
|
||||
// log.append("\n");
|
||||
// }
|
||||
|
||||
ui->logView->setPlainText(log);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -133,8 +133,10 @@ ResolverConfigDelegate::configRectForIndex( const QStyleOptionViewItem& option,
|
||||
}
|
||||
|
||||
QRect
|
||||
ResolverConfigDelegate::checkRectForIndex( const QStyleOptionViewItem &option, const QModelIndex &idx ) const
|
||||
ResolverConfigDelegate::checkRectForIndex( const QStyleOptionViewItem &option, const QModelIndex &idx, int role ) const
|
||||
{
|
||||
Q_UNUSED( role );
|
||||
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
initStyleOption( &opt, idx );
|
||||
QRect itemRect = opt.rect;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -29,7 +29,7 @@ public:
|
||||
explicit ResolverConfigDelegate( QObject* parent = 0 );
|
||||
virtual void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||
|
||||
virtual QRect checkRectForIndex( const QStyleOptionViewItem &option, const QModelIndex &idx ) const;
|
||||
virtual QRect checkRectForIndex( const QStyleOptionViewItem &option, const QModelIndex &idx, int role ) const;
|
||||
virtual QRect configRectForIndex( const QStyleOptionViewItem& option, const QModelIndex& idx ) const;
|
||||
|
||||
private slots:
|
||||
|
@ -46,17 +46,20 @@
|
||||
#include "resolversmodel.h"
|
||||
#include "scanmanager.h"
|
||||
#include "settingslistdelegate.h"
|
||||
#include "sipconfigdelegate.h"
|
||||
#include "AccountDelegate.h"
|
||||
#include "database/database.h"
|
||||
#include "network/servent.h"
|
||||
#include "playlist/dynamic/widgets/LoadingSpinner.h"
|
||||
#include "sip/SipHandler.h"
|
||||
#include "sip/AccountModel.h"
|
||||
#include "accounts/AccountModel.h"
|
||||
#include "utils/logger.h"
|
||||
|
||||
#include "ui_proxydialog.h"
|
||||
#include "ui_stackedsettingsdialog.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
using namespace Accounts;
|
||||
|
||||
static QString
|
||||
md5( const QByteArray& src )
|
||||
{
|
||||
@ -69,7 +72,7 @@ SettingsDialog::SettingsDialog( QWidget *parent )
|
||||
, ui( new Ui_StackedSettingsDialog )
|
||||
, m_proxySettings( this )
|
||||
, m_rejected( false )
|
||||
, m_sipModel( 0 )
|
||||
, m_accountModel( 0 )
|
||||
, m_resolversModel( 0 )
|
||||
, m_sipSpinner( 0 )
|
||||
{
|
||||
@ -107,7 +110,7 @@ SettingsDialog::SettingsDialog( QWidget *parent )
|
||||
#endif
|
||||
|
||||
// SIP PLUGINS
|
||||
SipConfigDelegate* sipdel = new SipConfigDelegate( this );
|
||||
AccountDelegate* sipdel = new AccountDelegate( this );
|
||||
ui->accountsView->setItemDelegate( sipdel );
|
||||
ui->accountsView->setContextMenuPolicy( Qt::CustomContextMenu );
|
||||
ui->accountsView->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
|
||||
@ -115,8 +118,8 @@ SettingsDialog::SettingsDialog( QWidget *parent )
|
||||
connect( ui->accountsView, SIGNAL( clicked( QModelIndex ) ), this, SLOT( sipItemClicked( QModelIndex ) ) );
|
||||
connect( sipdel, SIGNAL( openConfig( SipPlugin* ) ), this, SLOT( openSipConfig( SipPlugin* ) ) );
|
||||
connect( ui->accountsView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( sipContextMenuRequest( QPoint ) ) );
|
||||
m_sipModel = new SipModel( this );
|
||||
ui->accountsView->setModel( m_sipModel );
|
||||
m_accountModel = new AccountModel( this );
|
||||
ui->accountsView->setModel( m_accountModel );
|
||||
|
||||
if ( !Servent::instance()->isReady() )
|
||||
{
|
||||
|
@ -27,9 +27,7 @@
|
||||
class LoadingSpinner;
|
||||
class QListWidgetItem;
|
||||
class Ui_StackedSettingsDialog;
|
||||
class SipPluginFactory;
|
||||
class SipPlugin;
|
||||
class SipModel;
|
||||
class ResolversModel;
|
||||
class QNetworkReply;
|
||||
|
||||
@ -39,6 +37,14 @@ namespace Ui
|
||||
class ProxyDialog;
|
||||
}
|
||||
|
||||
namespace Tomahawk
|
||||
{
|
||||
namespace Accounts
|
||||
{
|
||||
class AccountModel;
|
||||
}
|
||||
}
|
||||
|
||||
class ProxyDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -105,7 +111,7 @@ private slots:
|
||||
void sipCreateConfigClosed( int value );
|
||||
*/
|
||||
void updateScanOptionsView();
|
||||
|
||||
|
||||
void changePage( QListWidgetItem*, QListWidgetItem* );
|
||||
void serventReady();
|
||||
|
||||
@ -118,9 +124,11 @@ private:
|
||||
|
||||
ProxyDialog m_proxySettings;
|
||||
bool m_rejected;
|
||||
SipModel* m_sipModel;
|
||||
Tomahawk::Accounts::AccountModel* m_accountModel;
|
||||
ResolversModel* m_resolversModel;
|
||||
LoadingSpinner* m_sipSpinner;
|
||||
};
|
||||
|
||||
#endif // SETTINGSDIALOG_H
|
||||
|
||||
struct A;
|
||||
|
Loading…
x
Reference in New Issue
Block a user