mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-24 09:49:42 +01:00
Show connection erros in JobStatusView as well
This commit is contained in:
parent
d3bd359e1a
commit
61e83c8581
src
@ -554,9 +554,6 @@ TomahawkWindow::setupSignals()
|
||||
connect( ac->getAction( "toggleMenuBar" ), SIGNAL( triggered() ), SLOT( toggleMenuBar() ) );
|
||||
#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( 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
|
||||
TomahawkWindow::setWindowTitle( const QString& title )
|
||||
{
|
||||
|
@ -109,8 +109,6 @@ public slots:
|
||||
void fullScreenExited();
|
||||
|
||||
private slots:
|
||||
void onAccountError();
|
||||
|
||||
void onHistoryBackAvailable( bool avail );
|
||||
void onHistoryForwardAvailable( bool avail );
|
||||
|
||||
|
@ -23,6 +23,9 @@
|
||||
#include "TomahawkSettings.h"
|
||||
#include "ResolverAccount.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "sip/SipStatusMessage.h"
|
||||
#include "jobview/JobStatusView.h"
|
||||
#include "jobview/JobStatusModel.h"
|
||||
|
||||
#include <QtCore/QLibrary>
|
||||
#include <QtCore/QDir>
|
||||
@ -444,12 +447,16 @@ AccountManager::onError( int code, const QString& msg )
|
||||
|
||||
qWarning() << "Failed to connect to SIP:" << account->accountFriendlyName() << code << msg;
|
||||
|
||||
SipStatusMessage* statusMessage;
|
||||
if ( code == Account::AuthError )
|
||||
{
|
||||
emit authError( account );
|
||||
statusMessage = new SipStatusMessage( SipStatusMessage::SipLoginFailure, account->accountFriendlyName() );
|
||||
JobStatusView::instance()->model()->addJob( statusMessage );
|
||||
}
|
||||
else
|
||||
{
|
||||
statusMessage = new SipStatusMessage(SipStatusMessage::SipConnectionFailure, account->accountFriendlyName(), msg );
|
||||
JobStatusView::instance()->model()->addJob( statusMessage );
|
||||
QTimer::singleShot( 10000, account, SLOT( authenticate() ) );
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,10 @@
|
||||
#include <QHash>
|
||||
#include <QTimer>
|
||||
|
||||
SipStatusMessage::SipStatusMessage( SipStatusMessageType statusMessageType, const QString& contactId )
|
||||
SipStatusMessage::SipStatusMessage( SipStatusMessageType statusMessageType, const QString& contactId, const QString& message )
|
||||
: m_statusMessageType( statusMessageType )
|
||||
, m_contactId( contactId )
|
||||
, m_message( message )
|
||||
{
|
||||
// make this temporary for now, as soon as i know how: add ack button
|
||||
m_timer = new QTimer( this );
|
||||
@ -40,6 +41,7 @@ SipStatusMessage::SipStatusMessage( SipStatusMessageType statusMessageType, cons
|
||||
TomahawkUtils::ImageType imageType;
|
||||
switch( m_statusMessageType )
|
||||
{
|
||||
case SipLoginFailure:
|
||||
case SipInviteFailure:
|
||||
imageType = TomahawkUtils::ProcessStop;
|
||||
break;
|
||||
@ -79,11 +81,19 @@ SipStatusMessage::mainText() const
|
||||
text = "Received authorization from %1";
|
||||
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:
|
||||
tLog() << Q_FUNC_INFO << "Not all status types handled";
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
|
||||
return text.arg( m_contactId );
|
||||
return text.arg( m_contactId ).arg( m_message );
|
||||
}
|
||||
|
||||
|
@ -35,10 +35,12 @@ public:
|
||||
{
|
||||
SipInviteSuccess,
|
||||
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"; }
|
||||
|
||||
@ -49,6 +51,7 @@ public:
|
||||
private:
|
||||
QString m_contactId;
|
||||
SipStatusMessageType m_statusMessageType;
|
||||
QString m_message;
|
||||
|
||||
QHash< SipStatusMessageType, QPixmap > s_typesPixmaps;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user