1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

ready for settings dialog work

This commit is contained in:
Leo Franchi
2011-12-11 22:57:14 -05:00
parent b6911525a4
commit 00adb66cf0
5 changed files with 101 additions and 88 deletions

View File

@@ -90,81 +90,81 @@ void DiagnosticsDialog::updateLogView()
log.append("\n\n"); log.append("\n\n");
// Peers // Peers / Accounts, TODO
log.append("SIP PLUGINS:\n"); log.append("ACCOUNTS:\n");
QList< Tomahawk::source_ptr > sources = SourceList::instance()->sources( true ); // QList< Tomahawk::source_ptr > sources = SourceList::instance()->sources( true );
Q_FOREACH(SipPlugin *sip, SipHandler::instance()->allPlugins()) // Q_FOREACH(SipPlugin *sip, SipHandler::instance()->allPlugins())
{ // {
Q_ASSERT(sip); // Q_ASSERT(sip);
QString stateString; // QString stateString;
switch( sip->connectionState() ) // switch( sip->connectionState() )
{ // {
case SipPlugin::Connecting: // case SipPlugin::Connecting:
stateString = "Connecting"; // stateString = "Connecting";
break; // 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: // Q_FOREACH( const QString &peerId, sip->peersOnline() )
stateString = "Connected"; // {
break; // /* enable this again, when we check the source has this peerId
// bool connected = false;
case SipPlugin::Disconnected: // Q_FOREACH( const Tomahawk::source_ptr &source, sources )
stateString = "Disconnected"; // {
break; // if( source->controlConnection() )
case SipPlugin::Disconnecting: // {
stateString = "Disconnecting"; // connected = true;
} // break;
log.append( // }
QString(" %2 (%1): %3 (%4)\n") // }*/
.arg(sip->account()->accountServiceName()) //
.arg(sip->friendlyName()) // QString versionString = SipHandler::instance()->versionString( peerId );
.arg(sip->account()->accountFriendlyName()) // SipInfo sipInfo = SipHandler::instance()->sipInfo( peerId );
.arg(stateString) // if( !sipInfo.isValid() )
); // log.append(
// QString(" %1: %2 %3" /*"(%4)"*/ "\n")
Q_FOREACH( const QString &peerId, sip->peersOnline() ) // .arg( peerId )
{ // .arg( "sipinfo invalid" )
/* enable this again, when we check the source has this peerId // .arg( versionString )
bool connected = false; // // .arg( connected ? "connected" : "not connected")
Q_FOREACH( const Tomahawk::source_ptr &source, sources ) // );
{ // else if( sipInfo.isVisible() )
if( source->controlConnection() ) // log.append(
{ // QString(" %1: %2:%3 %4" /*" (%5)"*/ "\n")
connected = true; // .arg( peerId )
break; // .arg( sipInfo.host().hostName() )
} // .arg( sipInfo.port() )
}*/ // .arg( versionString )
// // .arg( connected ? "connected" : "not connected")
QString versionString = SipHandler::instance()->versionString( peerId ); //
SipInfo sipInfo = SipHandler::instance()->sipInfo( peerId ); // );
if( !sipInfo.isValid() ) // else
log.append( // log.append(
QString(" %1: %2 %3" /*"(%4)"*/ "\n") // QString(" %1: visible: false %2" /*" (%3)"*/ "\n")
.arg( peerId ) // .arg( peerId )
.arg( "sipinfo invalid" ) // .arg( versionString )
.arg( versionString ) // // .arg( connected ? "connected" : "not connected")
// .arg( connected ? "connected" : "not connected") //
); // );
else if( sipInfo.isVisible() ) // }
log.append( // log.append("\n");
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); ui->logView->setPlainText(log);
} }

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === /* === 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 * Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -133,8 +133,10 @@ ResolverConfigDelegate::configRectForIndex( const QStyleOptionViewItem& option,
} }
QRect 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; QStyleOptionViewItemV4 opt = option;
initStyleOption( &opt, idx ); initStyleOption( &opt, idx );
QRect itemRect = opt.rect; QRect itemRect = opt.rect;

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === /* === 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 * Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@ public:
explicit ResolverConfigDelegate( QObject* parent = 0 ); explicit ResolverConfigDelegate( QObject* parent = 0 );
virtual void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const; 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; virtual QRect configRectForIndex( const QStyleOptionViewItem& option, const QModelIndex& idx ) const;
private slots: private slots:

View File

@@ -46,17 +46,20 @@
#include "resolversmodel.h" #include "resolversmodel.h"
#include "scanmanager.h" #include "scanmanager.h"
#include "settingslistdelegate.h" #include "settingslistdelegate.h"
#include "sipconfigdelegate.h" #include "AccountDelegate.h"
#include "database/database.h" #include "database/database.h"
#include "network/servent.h" #include "network/servent.h"
#include "playlist/dynamic/widgets/LoadingSpinner.h" #include "playlist/dynamic/widgets/LoadingSpinner.h"
#include "sip/SipHandler.h" #include "sip/SipHandler.h"
#include "sip/AccountModel.h" #include "accounts/AccountModel.h"
#include "utils/logger.h" #include "utils/logger.h"
#include "ui_proxydialog.h" #include "ui_proxydialog.h"
#include "ui_stackedsettingsdialog.h" #include "ui_stackedsettingsdialog.h"
using namespace Tomahawk;
using namespace Accounts;
static QString static QString
md5( const QByteArray& src ) md5( const QByteArray& src )
{ {
@@ -69,7 +72,7 @@ SettingsDialog::SettingsDialog( QWidget *parent )
, ui( new Ui_StackedSettingsDialog ) , ui( new Ui_StackedSettingsDialog )
, m_proxySettings( this ) , m_proxySettings( this )
, m_rejected( false ) , m_rejected( false )
, m_sipModel( 0 ) , m_accountModel( 0 )
, m_resolversModel( 0 ) , m_resolversModel( 0 )
, m_sipSpinner( 0 ) , m_sipSpinner( 0 )
{ {
@@ -107,7 +110,7 @@ SettingsDialog::SettingsDialog( QWidget *parent )
#endif #endif
// SIP PLUGINS // SIP PLUGINS
SipConfigDelegate* sipdel = new SipConfigDelegate( this ); AccountDelegate* sipdel = new AccountDelegate( this );
ui->accountsView->setItemDelegate( sipdel ); ui->accountsView->setItemDelegate( sipdel );
ui->accountsView->setContextMenuPolicy( Qt::CustomContextMenu ); ui->accountsView->setContextMenuPolicy( Qt::CustomContextMenu );
ui->accountsView->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel ); ui->accountsView->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
@@ -115,8 +118,8 @@ SettingsDialog::SettingsDialog( QWidget *parent )
connect( ui->accountsView, SIGNAL( clicked( QModelIndex ) ), this, SLOT( sipItemClicked( QModelIndex ) ) ); connect( ui->accountsView, SIGNAL( clicked( QModelIndex ) ), this, SLOT( sipItemClicked( QModelIndex ) ) );
connect( sipdel, SIGNAL( openConfig( SipPlugin* ) ), this, SLOT( openSipConfig( SipPlugin* ) ) ); connect( sipdel, SIGNAL( openConfig( SipPlugin* ) ), this, SLOT( openSipConfig( SipPlugin* ) ) );
connect( ui->accountsView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( sipContextMenuRequest( QPoint ) ) ); connect( ui->accountsView, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( sipContextMenuRequest( QPoint ) ) );
m_sipModel = new SipModel( this ); m_accountModel = new AccountModel( this );
ui->accountsView->setModel( m_sipModel ); ui->accountsView->setModel( m_accountModel );
if ( !Servent::instance()->isReady() ) if ( !Servent::instance()->isReady() )
{ {

View File

@@ -27,9 +27,7 @@
class LoadingSpinner; class LoadingSpinner;
class QListWidgetItem; class QListWidgetItem;
class Ui_StackedSettingsDialog; class Ui_StackedSettingsDialog;
class SipPluginFactory;
class SipPlugin; class SipPlugin;
class SipModel;
class ResolversModel; class ResolversModel;
class QNetworkReply; class QNetworkReply;
@@ -39,6 +37,14 @@ namespace Ui
class ProxyDialog; class ProxyDialog;
} }
namespace Tomahawk
{
namespace Accounts
{
class AccountModel;
}
}
class ProxyDialog : public QDialog class ProxyDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
@@ -105,7 +111,7 @@ private slots:
void sipCreateConfigClosed( int value ); void sipCreateConfigClosed( int value );
*/ */
void updateScanOptionsView(); void updateScanOptionsView();
void changePage( QListWidgetItem*, QListWidgetItem* ); void changePage( QListWidgetItem*, QListWidgetItem* );
void serventReady(); void serventReady();
@@ -118,9 +124,11 @@ private:
ProxyDialog m_proxySettings; ProxyDialog m_proxySettings;
bool m_rejected; bool m_rejected;
SipModel* m_sipModel; Tomahawk::Accounts::AccountModel* m_accountModel;
ResolversModel* m_resolversModel; ResolversModel* m_resolversModel;
LoadingSpinner* m_sipSpinner; LoadingSpinner* m_sipSpinner;
}; };
#endif // SETTINGSDIALOG_H #endif // SETTINGSDIALOG_H
struct A;