mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
Show spinner on initial load while loading sip plugins in preferences. Disable Settings action till servent is loaded
This commit is contained in:
@@ -60,6 +60,7 @@ Servent::Servent( QObject* parent )
|
|||||||
: QTcpServer( parent )
|
: QTcpServer( parent )
|
||||||
, m_port( 0 )
|
, m_port( 0 )
|
||||||
, m_externalPort( 0 )
|
, m_externalPort( 0 )
|
||||||
|
, m_ready( false )
|
||||||
, m_portfwd( 0 )
|
, m_portfwd( 0 )
|
||||||
{
|
{
|
||||||
s_instance = this;
|
s_instance = this;
|
||||||
@@ -133,6 +134,7 @@ Servent::startListening( QHostAddress ha, bool upnp, int port )
|
|||||||
tLog() << "Forcing static preferred host and port";
|
tLog() << "Forcing static preferred host and port";
|
||||||
m_externalHostname = TomahawkSettings::instance()->externalHostname();
|
m_externalHostname = TomahawkSettings::instance()->externalHostname();
|
||||||
m_externalPort = TomahawkSettings::instance()->externalPort();
|
m_externalPort = TomahawkSettings::instance()->externalPort();
|
||||||
|
m_ready = true;
|
||||||
emit ready();
|
emit ready();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -155,7 +157,10 @@ Servent::startListening( QHostAddress ha, bool upnp, int port )
|
|||||||
QMetaObject::invokeMethod( this, "setExternalAddress", Qt::QueuedConnection, Q_ARG( QHostAddress, ha ), Q_ARG( unsigned int, m_port ) );
|
QMetaObject::invokeMethod( this, "setExternalAddress", Qt::QueuedConnection, Q_ARG( QHostAddress, ha ), Q_ARG( unsigned int, m_port ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
m_ready = true;
|
||||||
emit ready();
|
emit ready();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -227,6 +232,7 @@ Servent::setExternalAddress( QHostAddress ha, unsigned int port )
|
|||||||
qDebug() << "No external access, LAN and outbound connections only!";
|
qDebug() << "No external access, LAN and outbound connections only!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_ready = true;
|
||||||
emit ready();
|
emit ready();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -123,6 +123,8 @@ public:
|
|||||||
QSharedPointer<QIODevice> localFileIODeviceFactory( const Tomahawk::result_ptr& result );
|
QSharedPointer<QIODevice> localFileIODeviceFactory( const Tomahawk::result_ptr& result );
|
||||||
QSharedPointer<QIODevice> httpIODeviceFactory( const Tomahawk::result_ptr& result );
|
QSharedPointer<QIODevice> httpIODeviceFactory( const Tomahawk::result_ptr& result );
|
||||||
|
|
||||||
|
bool isReady() const { return m_ready; };
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void streamStarted( StreamConnection* );
|
void streamStarted( StreamConnection* );
|
||||||
void streamFinished( StreamConnection* );
|
void streamFinished( StreamConnection* );
|
||||||
@@ -159,6 +161,7 @@ private:
|
|||||||
int m_port, m_externalPort;
|
int m_port, m_externalPort;
|
||||||
QHostAddress m_externalAddress;
|
QHostAddress m_externalAddress;
|
||||||
QString m_externalHostname;
|
QString m_externalHostname;
|
||||||
|
bool m_ready;
|
||||||
|
|
||||||
// currently active file transfers:
|
// currently active file transfers:
|
||||||
QList< StreamConnection* > m_scsessions;
|
QList< StreamConnection* > m_scsessions;
|
||||||
|
@@ -21,12 +21,14 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include "dllmacro.h"
|
||||||
|
|
||||||
class QMovie;
|
class QMovie;
|
||||||
class QTimeLine;
|
class QTimeLine;
|
||||||
/**
|
/**
|
||||||
* A small widget that displays an animated loading spinner
|
* A small widget that displays an animated loading spinner
|
||||||
*/
|
*/
|
||||||
class LoadingSpinner : public QWidget {
|
class DLLEXPORT LoadingSpinner : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
LoadingSpinner( QWidget* parent );
|
LoadingSpinner( QWidget* parent );
|
||||||
|
@@ -51,6 +51,7 @@
|
|||||||
|
|
||||||
#include "ui_proxydialog.h"
|
#include "ui_proxydialog.h"
|
||||||
#include "ui_stackedsettingsdialog.h"
|
#include "ui_stackedsettingsdialog.h"
|
||||||
|
#include <playlist/dynamic/widgets/LoadingSpinner.h>
|
||||||
|
|
||||||
static QString
|
static QString
|
||||||
md5( const QByteArray& src )
|
md5( const QByteArray& src )
|
||||||
@@ -66,6 +67,7 @@ SettingsDialog::SettingsDialog( QWidget *parent )
|
|||||||
, m_rejected( false )
|
, m_rejected( false )
|
||||||
, m_sipModel( 0 )
|
, m_sipModel( 0 )
|
||||||
, m_resolversModel( 0 )
|
, m_resolversModel( 0 )
|
||||||
|
, m_sipSpinner( 0 )
|
||||||
{
|
{
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
TomahawkSettings* s = TomahawkSettings::instance();
|
TomahawkSettings* s = TomahawkSettings::instance();
|
||||||
@@ -107,6 +109,13 @@ SettingsDialog::SettingsDialog( QWidget *parent )
|
|||||||
m_sipModel = new SipModel( this );
|
m_sipModel = new SipModel( this );
|
||||||
ui->accountsView->setModel( m_sipModel );
|
ui->accountsView->setModel( m_sipModel );
|
||||||
|
|
||||||
|
if ( !Servent::instance()->isReady() )
|
||||||
|
{
|
||||||
|
m_sipSpinner = new LoadingSpinner( ui->accountsView );
|
||||||
|
m_sipSpinner->fadeIn();
|
||||||
|
connect( Servent::instance(), SIGNAL( ready() ),m_sipSpinner, SLOT( fadeOut() ) );
|
||||||
|
}
|
||||||
|
|
||||||
setupSipButtons();
|
setupSipButtons();
|
||||||
|
|
||||||
ui->staticHostName->setText( s->externalHostname() );
|
ui->staticHostName->setText( s->externalHostname() );
|
||||||
|
@@ -22,6 +22,7 @@
|
|||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
|
|
||||||
|
class LoadingSpinner;
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
class Ui_StackedSettingsDialog;
|
class Ui_StackedSettingsDialog;
|
||||||
class SipPluginFactory;
|
class SipPluginFactory;
|
||||||
@@ -112,6 +113,7 @@ private:
|
|||||||
bool m_rejected;
|
bool m_rejected;
|
||||||
SipModel* m_sipModel;
|
SipModel* m_sipModel;
|
||||||
ResolversModel* m_resolversModel;
|
ResolversModel* m_resolversModel;
|
||||||
|
LoadingSpinner* m_sipSpinner;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGSDIALOG_H
|
#endif // SETTINGSDIALOG_H
|
||||||
|
@@ -347,6 +347,12 @@ TomahawkWindow::setupSignals()
|
|||||||
ui->menuWindow->menuAction()->setVisible( false );
|
ui->menuWindow->menuAction()->setVisible( false );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if ( !Servent::instance()->isReady() )
|
||||||
|
{
|
||||||
|
ui->actionPreferences->setEnabled( false );
|
||||||
|
connect( Servent::instance(), SIGNAL( ready() ), this, SLOT( enablePreferences() ) );
|
||||||
|
}
|
||||||
|
|
||||||
// <SipHandler>
|
// <SipHandler>
|
||||||
connect( SipHandler::instance(), SIGNAL( connected( SipPlugin* ) ), SLOT( onSipConnected() ) );
|
connect( SipHandler::instance(), SIGNAL( connected( SipPlugin* ) ), SLOT( onSipConnected() ) );
|
||||||
connect( SipHandler::instance(), SIGNAL( disconnected( SipPlugin* ) ), SLOT( onSipDisconnected() ) );
|
connect( SipHandler::instance(), SIGNAL( disconnected( SipPlugin* ) ), SLOT( onSipDisconnected() ) );
|
||||||
@@ -705,6 +711,12 @@ TomahawkWindow::checkForUpdates()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkWindow::enablePreferences()
|
||||||
|
{
|
||||||
|
ui->actionPreferences->setEnabled( true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TomahawkWindow::onSearch( const QString& search )
|
TomahawkWindow::onSearch( const QString& search )
|
||||||
|
@@ -89,6 +89,7 @@ private slots:
|
|||||||
|
|
||||||
void showAboutTomahawk();
|
void showAboutTomahawk();
|
||||||
void checkForUpdates();
|
void checkForUpdates();
|
||||||
|
void enablePreferences();
|
||||||
|
|
||||||
void onSipPluginAdded( SipPlugin* p );
|
void onSipPluginAdded( SipPlugin* p );
|
||||||
void onSipPluginRemoved( SipPlugin* p );
|
void onSipPluginRemoved( SipPlugin* p );
|
||||||
|
Reference in New Issue
Block a user