mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-13 20:39:57 +01:00
Show visual message if IP auto-detect failed.
This commit is contained in:
parent
9d2bda1b93
commit
607caf4456
@ -976,6 +976,7 @@ Servent::ipDetected()
|
||||
{
|
||||
tLog() << Q_FUNC_INFO << "Failed parsing ip-autodetection response";
|
||||
d->externalPort = -1;
|
||||
emit ipDetectionFailed( QNetworkReply::NoError, tr( "Automatically detecting external IP failed: Could not parse JSON response." ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -988,6 +989,7 @@ Servent::ipDetected()
|
||||
{
|
||||
d->externalPort = -1;
|
||||
tLog() << Q_FUNC_INFO << "ip-autodetection returned an error:" << reply->errorString();
|
||||
emit ipDetectionFailed( reply->error(), tr( "Automatically detecting external IP failed: %1" ).arg( reply->errorString() ) );
|
||||
}
|
||||
|
||||
d->ready = true;
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QMap>
|
||||
#include <QNetworkReply>
|
||||
#include <QSharedPointer>
|
||||
#include <QTcpServer>
|
||||
|
||||
@ -83,10 +84,6 @@ public:
|
||||
void registerPeer( const Tomahawk::peerinfo_ptr& peerInfo );
|
||||
void handleSipInfo( const Tomahawk::peerinfo_ptr& peerInfo );
|
||||
|
||||
public slots:
|
||||
void onSipInfoChanged();
|
||||
|
||||
public:
|
||||
void initiateConnection( const SipInfo& sipInfo, Connection* conn );
|
||||
void reverseOfferRequest( ControlConnection* orig_conn, const QString &theirdbid, const QString& key, const QString& theirkey );
|
||||
|
||||
@ -139,6 +136,14 @@ public:
|
||||
void queueForAclResult( const QString& username, const QSet<Tomahawk::peerinfo_ptr>& peerInfos );
|
||||
signals:
|
||||
void dbSyncTriggered();
|
||||
|
||||
/**
|
||||
* @brief ipDetectionFailed Emitted when the automatic external IP detection failed.
|
||||
* @param error If the failure was caused by a network error, this is its error code.
|
||||
* If the error wasn't network related, QNetworkReply::NoError will be returned.
|
||||
* @param errorString A string explaining the error.
|
||||
*/
|
||||
void ipDetectionFailed( QNetworkReply::NetworkError error, QString errorString );
|
||||
void streamStarted( StreamConnection* );
|
||||
void streamFinished( StreamConnection* );
|
||||
void ready();
|
||||
@ -157,6 +162,8 @@ public slots:
|
||||
void socketConnected();
|
||||
void triggerDBSync();
|
||||
|
||||
void onSipInfoChanged();
|
||||
|
||||
private slots:
|
||||
void deleteLazyOffer( const QString& key );
|
||||
void readyRead();
|
||||
|
@ -31,13 +31,6 @@
|
||||
#include "collection/Collection.h"
|
||||
#include "infosystem/InfoSystem.h"
|
||||
#include "infosystem/InfoSystemCache.h"
|
||||
#include "accounts/AccountManager.h"
|
||||
#include "accounts/spotify/SpotifyAccount.h"
|
||||
#include "accounts/lastfm/LastFmAccount.h"
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseCollection.h"
|
||||
#include "database/DatabaseCommand_CollectionStats.h"
|
||||
#include "database/DatabaseResolver.h"
|
||||
#include "playlist/dynamic/GeneratorFactory.h"
|
||||
#include "playlist/dynamic/echonest/EchonestGenerator.h"
|
||||
#include "playlist/dynamic/database/DatabaseGenerator.h"
|
||||
@ -57,14 +50,22 @@
|
||||
#include "database/DatabaseImpl.h"
|
||||
#include "network/Msg.h"
|
||||
|
||||
#include "accounts/lastfm/LastFmAccount.h"
|
||||
#include "accounts/spotify/SpotifyAccount.h"
|
||||
#include "accounts/spotify/SpotifyPlaylistUpdater.h"
|
||||
#include "accounts/AccountManager.h"
|
||||
#include "database/Database.h"
|
||||
#include "database/DatabaseCollection.h"
|
||||
#include "database/DatabaseCommand_CollectionStats.h"
|
||||
#include "database/DatabaseResolver.h"
|
||||
#include "audio/AudioEngine.h"
|
||||
#include "jobview/ErrorStatusMessage.h"
|
||||
#include "jobview/JobStatusModel.h"
|
||||
#include "jobview/JobStatusView.h"
|
||||
#include "utils/XspfLoader.h"
|
||||
#include "utils/JspfLoader.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
#include "accounts/lastfm/LastFmAccount.h"
|
||||
#include "accounts/spotify/SpotifyAccount.h"
|
||||
#include "accounts/spotify/SpotifyPlaylistUpdater.h"
|
||||
#include "utils/TomahawkCache.h"
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
@ -542,6 +543,7 @@ TomahawkApp::initServent()
|
||||
|
||||
bool upnp = !arguments().contains( "--noupnp" );
|
||||
int port = TomahawkSettings::instance()->externalPort();
|
||||
connect( Servent::instance(), SIGNAL( ipDetectionFailed( QNetworkReply::NetworkError, QString ) ), this, SLOT( ipDetectionFailed( QNetworkReply::NetworkError, QString ) ) );
|
||||
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
||||
if ( !Servent::instance()->startListening( QHostAddress( QHostAddress::Any ), upnp, port ) )
|
||||
#else
|
||||
@ -691,6 +693,20 @@ TomahawkApp::onInfoSystemReady()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkApp::ipDetectionFailed( QNetworkReply::NetworkError error, QString errorString )
|
||||
{
|
||||
tLog() << Q_FUNC_INFO;
|
||||
Q_UNUSED( error );
|
||||
#ifdef QT_NO_DEBUG
|
||||
Q_UNUSED( errorString );
|
||||
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Automatically detecting external IP failed." ) ) );
|
||||
#else
|
||||
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( errorString ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkApp::spotifyApiCheckFinished()
|
||||
{
|
||||
|
@ -115,6 +115,8 @@ private slots:
|
||||
void spotifyApiCheckFinished();
|
||||
void onInfoSystemReady();
|
||||
|
||||
void ipDetectionFailed( QNetworkReply::NetworkError error, QString errorString );
|
||||
|
||||
private:
|
||||
void registerMetaTypes();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user