1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 05:37:29 +02:00

Show connection erros in JobStatusView as well

This commit is contained in:
Dominik Schmidt
2013-01-24 03:27:40 +01:00
parent d3bd359e1a
commit 61e83c8581
5 changed files with 25 additions and 24 deletions

View File

@@ -554,9 +554,6 @@ TomahawkWindow::setupSignals()
connect( ac->getAction( "toggleMenuBar" ), SIGNAL( triggered() ), SLOT( toggleMenuBar() ) ); connect( ac->getAction( "toggleMenuBar" ), SIGNAL( triggered() ), SLOT( toggleMenuBar() ) );
#endif #endif
// <AccountHandler>
connect( AccountManager::instance(), SIGNAL( authError( Tomahawk::Accounts::Account* ) ), SLOT( onAccountError() ) );
connect( ViewManager::instance(), SIGNAL( historyBackAvailable( bool ) ), SLOT( onHistoryBackAvailable( bool ) ) ); connect( ViewManager::instance(), SIGNAL( historyBackAvailable( bool ) ), SLOT( onHistoryBackAvailable( bool ) ) );
connect( ViewManager::instance(), SIGNAL( historyForwardAvailable( bool ) ), SLOT( onHistoryForwardAvailable( bool ) ) ); connect( ViewManager::instance(), SIGNAL( historyForwardAvailable( bool ) ), SLOT( onHistoryForwardAvailable( bool ) ) );
} }
@@ -1171,20 +1168,6 @@ TomahawkWindow::onPlaybackLoading( const Tomahawk::result_ptr& result )
} }
void
TomahawkWindow::onAccountError()
{
// TODO fix.
// onAccountDisconnected();
// TODO real error message from plugin kthxbbq
QMessageBox::warning( this,
tr( "Authentication Error" ),
tr( "Error connecting to SIP: Authentication failed!" ),
QMessageBox::Ok );
}
void void
TomahawkWindow::setWindowTitle( const QString& title ) TomahawkWindow::setWindowTitle( const QString& title )
{ {

View File

@@ -109,8 +109,6 @@ public slots:
void fullScreenExited(); void fullScreenExited();
private slots: private slots:
void onAccountError();
void onHistoryBackAvailable( bool avail ); void onHistoryBackAvailable( bool avail );
void onHistoryForwardAvailable( bool avail ); void onHistoryForwardAvailable( bool avail );

View File

@@ -23,6 +23,9 @@
#include "TomahawkSettings.h" #include "TomahawkSettings.h"
#include "ResolverAccount.h" #include "ResolverAccount.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "sip/SipStatusMessage.h"
#include "jobview/JobStatusView.h"
#include "jobview/JobStatusModel.h"
#include <QtCore/QLibrary> #include <QtCore/QLibrary>
#include <QtCore/QDir> #include <QtCore/QDir>
@@ -444,12 +447,16 @@ AccountManager::onError( int code, const QString& msg )
qWarning() << "Failed to connect to SIP:" << account->accountFriendlyName() << code << msg; qWarning() << "Failed to connect to SIP:" << account->accountFriendlyName() << code << msg;
SipStatusMessage* statusMessage;
if ( code == Account::AuthError ) if ( code == Account::AuthError )
{ {
emit authError( account ); statusMessage = new SipStatusMessage( SipStatusMessage::SipLoginFailure, account->accountFriendlyName() );
JobStatusView::instance()->model()->addJob( statusMessage );
} }
else else
{ {
statusMessage = new SipStatusMessage(SipStatusMessage::SipConnectionFailure, account->accountFriendlyName(), msg );
JobStatusView::instance()->model()->addJob( statusMessage );
QTimer::singleShot( 10000, account, SLOT( authenticate() ) ); QTimer::singleShot( 10000, account, SLOT( authenticate() ) );
} }
} }

View File

@@ -23,9 +23,10 @@
#include <QHash> #include <QHash>
#include <QTimer> #include <QTimer>
SipStatusMessage::SipStatusMessage( SipStatusMessageType statusMessageType, const QString& contactId ) SipStatusMessage::SipStatusMessage( SipStatusMessageType statusMessageType, const QString& contactId, const QString& message )
: m_statusMessageType( statusMessageType ) : m_statusMessageType( statusMessageType )
, m_contactId( contactId ) , m_contactId( contactId )
, m_message( message )
{ {
// make this temporary for now, as soon as i know how: add ack button // make this temporary for now, as soon as i know how: add ack button
m_timer = new QTimer( this ); m_timer = new QTimer( this );
@@ -40,6 +41,7 @@ SipStatusMessage::SipStatusMessage( SipStatusMessageType statusMessageType, cons
TomahawkUtils::ImageType imageType; TomahawkUtils::ImageType imageType;
switch( m_statusMessageType ) switch( m_statusMessageType )
{ {
case SipLoginFailure:
case SipInviteFailure: case SipInviteFailure:
imageType = TomahawkUtils::ProcessStop; imageType = TomahawkUtils::ProcessStop;
break; break;
@@ -79,11 +81,19 @@ SipStatusMessage::mainText() const
text = "Received authorization from %1"; text = "Received authorization from %1";
break; break;
case SipLoginFailure:
text = "Could not login to %1. Please check your user credentials!";
break;
case SipConnectionFailure:
text = "Could not connect to %1: %2";
break;
default: default:
tLog() << Q_FUNC_INFO << "Not all status types handled"; tLog() << Q_FUNC_INFO << "Not all status types handled";
Q_ASSERT(false); Q_ASSERT(false);
} }
return text.arg( m_contactId ); return text.arg( m_contactId ).arg( m_message );
} }

View File

@@ -35,10 +35,12 @@ public:
{ {
SipInviteSuccess, SipInviteSuccess,
SipInviteFailure, SipInviteFailure,
SipAuthReceived SipAuthReceived,
SipLoginFailure,
SipConnectionFailure
}; };
explicit SipStatusMessage( SipStatusMessageType statusMessageType, const QString& contactId ); explicit SipStatusMessage( SipStatusMessageType statusMessageType, const QString& contactId, const QString& message = QString() );
QString type() const { return "sipstatusmessage"; } QString type() const { return "sipstatusmessage"; }
@@ -49,6 +51,7 @@ public:
private: private:
QString m_contactId; QString m_contactId;
SipStatusMessageType m_statusMessageType; SipStatusMessageType m_statusMessageType;
QString m_message;
QHash< SipStatusMessageType, QPixmap > s_typesPixmaps; QHash< SipStatusMessageType, QPixmap > s_typesPixmaps;