mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 07:36:48 +02:00
Show visual message if IP auto-detect failed.
This commit is contained in:
@@ -976,6 +976,7 @@ Servent::ipDetected()
|
|||||||
{
|
{
|
||||||
tLog() << Q_FUNC_INFO << "Failed parsing ip-autodetection response";
|
tLog() << Q_FUNC_INFO << "Failed parsing ip-autodetection response";
|
||||||
d->externalPort = -1;
|
d->externalPort = -1;
|
||||||
|
emit ipDetectionFailed( QNetworkReply::NoError, tr( "Automatically detecting external IP failed: Could not parse JSON response." ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -988,6 +989,7 @@ Servent::ipDetected()
|
|||||||
{
|
{
|
||||||
d->externalPort = -1;
|
d->externalPort = -1;
|
||||||
tLog() << Q_FUNC_INFO << "ip-autodetection returned an error:" << reply->errorString();
|
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;
|
d->ready = true;
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
#include <QNetworkReply>
|
||||||
#include <QSharedPointer>
|
#include <QSharedPointer>
|
||||||
#include <QTcpServer>
|
#include <QTcpServer>
|
||||||
|
|
||||||
@@ -83,10 +84,6 @@ public:
|
|||||||
void registerPeer( const Tomahawk::peerinfo_ptr& peerInfo );
|
void registerPeer( const Tomahawk::peerinfo_ptr& peerInfo );
|
||||||
void handleSipInfo( 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 initiateConnection( const SipInfo& sipInfo, Connection* conn );
|
||||||
void reverseOfferRequest( ControlConnection* orig_conn, const QString &theirdbid, const QString& key, const QString& theirkey );
|
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 );
|
void queueForAclResult( const QString& username, const QSet<Tomahawk::peerinfo_ptr>& peerInfos );
|
||||||
signals:
|
signals:
|
||||||
void dbSyncTriggered();
|
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 streamStarted( StreamConnection* );
|
||||||
void streamFinished( StreamConnection* );
|
void streamFinished( StreamConnection* );
|
||||||
void ready();
|
void ready();
|
||||||
@@ -157,6 +162,8 @@ public slots:
|
|||||||
void socketConnected();
|
void socketConnected();
|
||||||
void triggerDBSync();
|
void triggerDBSync();
|
||||||
|
|
||||||
|
void onSipInfoChanged();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void deleteLazyOffer( const QString& key );
|
void deleteLazyOffer( const QString& key );
|
||||||
void readyRead();
|
void readyRead();
|
||||||
|
@@ -31,13 +31,6 @@
|
|||||||
#include "collection/Collection.h"
|
#include "collection/Collection.h"
|
||||||
#include "infosystem/InfoSystem.h"
|
#include "infosystem/InfoSystem.h"
|
||||||
#include "infosystem/InfoSystemCache.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/GeneratorFactory.h"
|
||||||
#include "playlist/dynamic/echonest/EchonestGenerator.h"
|
#include "playlist/dynamic/echonest/EchonestGenerator.h"
|
||||||
#include "playlist/dynamic/database/DatabaseGenerator.h"
|
#include "playlist/dynamic/database/DatabaseGenerator.h"
|
||||||
@@ -57,14 +50,22 @@
|
|||||||
#include "database/DatabaseImpl.h"
|
#include "database/DatabaseImpl.h"
|
||||||
#include "network/Msg.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 "audio/AudioEngine.h"
|
||||||
|
#include "jobview/ErrorStatusMessage.h"
|
||||||
|
#include "jobview/JobStatusModel.h"
|
||||||
|
#include "jobview/JobStatusView.h"
|
||||||
#include "utils/XspfLoader.h"
|
#include "utils/XspfLoader.h"
|
||||||
#include "utils/JspfLoader.h"
|
#include "utils/JspfLoader.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/TomahawkUtilsGui.h"
|
#include "utils/TomahawkUtilsGui.h"
|
||||||
#include "accounts/lastfm/LastFmAccount.h"
|
|
||||||
#include "accounts/spotify/SpotifyAccount.h"
|
|
||||||
#include "accounts/spotify/SpotifyPlaylistUpdater.h"
|
|
||||||
#include "utils/TomahawkCache.h"
|
#include "utils/TomahawkCache.h"
|
||||||
|
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
@@ -542,6 +543,7 @@ TomahawkApp::initServent()
|
|||||||
|
|
||||||
bool upnp = !arguments().contains( "--noupnp" );
|
bool upnp = !arguments().contains( "--noupnp" );
|
||||||
int port = TomahawkSettings::instance()->externalPort();
|
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 QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
|
||||||
if ( !Servent::instance()->startListening( QHostAddress( QHostAddress::Any ), upnp, port ) )
|
if ( !Servent::instance()->startListening( QHostAddress( QHostAddress::Any ), upnp, port ) )
|
||||||
#else
|
#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
|
void
|
||||||
TomahawkApp::spotifyApiCheckFinished()
|
TomahawkApp::spotifyApiCheckFinished()
|
||||||
{
|
{
|
||||||
|
@@ -115,6 +115,8 @@ private slots:
|
|||||||
void spotifyApiCheckFinished();
|
void spotifyApiCheckFinished();
|
||||||
void onInfoSystemReady();
|
void onInfoSystemReady();
|
||||||
|
|
||||||
|
void ipDetectionFailed( QNetworkReply::NetworkError error, QString errorString );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void registerMetaTypes();
|
void registerMetaTypes();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user