diff --git a/CMakeLists.txt b/CMakeLists.txt index a9cb28650..1ffcf6069 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,8 +129,8 @@ macro_log_feature(LIBATTICA_FOUND "libattica" "Provides support for automatic fe macro_optional_find_package(QuaZip) macro_log_feature(QuaZip_FOUND "QuaZip" "Provides support for extracting downloaded resolvers automatically." "http://quazip.sourceforge.net/" TRUE "" "") -macro_optional_find_package(Jreen 1.0.3) -macro_log_feature(JREEN_FOUND "Jreen" "Qt XMPP Library" "https://github.com/euroelessar/jreen" FALSE "" "Jreen is needed for the Jabber SIP plugin.\n") +macro_optional_find_package(Jreen 1.0.5) +macro_log_feature(JREEN_FOUND "Jreen" "Qt XMPP Library" "http://qutim.org/jreen / https://github.com/euroelessar/jreen" FALSE "" "Jreen is needed for the Jabber SIP plugin.\n") macro_optional_find_package(QTweetLib) macro_log_feature(QTWEETLIB_FOUND "QTweetLib" "Qt Twitter Library" "https://github.com/minimoog/QTweetLib" FALSE "" "QTweetLib is needed for the Twitter SIP plugin.\n") diff --git a/README b/README index 348c08d84..339701959 100644 --- a/README +++ b/README @@ -40,7 +40,7 @@ Dependencies Attica 0.3.0 - ftp://ftp.kde.org/pub/kde/stable/attica/ QuaZip 0.4.3 - http://quazip.sourceforge.net/ - Jreen 1.0.3 - https://github.com/euroelessar/jreen + Jreen 1.0.5 - http://qutim.org/jreen / https://github.com/euroelessar/jreen QTweetLib 0.5.0 - https://github.com/minimoog/QTweetLib Third party libraries that we ship with our source: diff --git a/data/images/playlist-header-tiled.png b/data/images/playlist-header-tiled.png new file mode 100644 index 000000000..7de5940e8 Binary files /dev/null and b/data/images/playlist-header-tiled.png differ diff --git a/resources.qrc b/resources.qrc index c5a771a28..9ea770807 100644 --- a/resources.qrc +++ b/resources.qrc @@ -136,6 +136,7 @@ data/images/grooveshark.png data/images/lastfm-icon.png data/images/spotifycore-logo.png + data/images/playlist-header-tiled.png data/sql/dbmigrate-27_to_28.sql data/images/process-stop.png data/icons/tomahawk-icon-128x128-grayscale.png diff --git a/src/accounts/xmpp/sip/xmppsip.cpp b/src/accounts/xmpp/sip/xmppsip.cpp index 6ff55b7c7..56981e75e 100644 --- a/src/accounts/xmpp/sip/xmppsip.cpp +++ b/src/accounts/xmpp/sip/xmppsip.cpp @@ -198,10 +198,16 @@ XmppSipPlugin::connectPlugin() if( m_client->isConnected() ) { qDebug() << Q_FUNC_INFO << "Already connected to server, not connecting again..."; - return; //FIXME: should i return false here?! + return; } - qDebug() << "Connecting to the Xmpp server..." << m_client->jid().full(); + if( m_account->configuration().contains("enforcesecure") && m_account->configuration().value("enforcesecure").toBool() ) + { + tLog() << Q_FUNC_INFO << "Enforcing secure connection..."; + m_client->setFeatureConfig(Jreen::Client::Encryption, Jreen::Client::Force); + } + + tDebug() << "Connecting to the Xmpp server..." << m_client->jid().full(); //FIXME: we're badly workarounding some missing reconnection api here, to be fixed soon QTimer::singleShot( 1000, m_client, SLOT( connectToServer() ) ); @@ -313,6 +319,10 @@ XmppSipPlugin::onDisconnect( Jreen::Client::DisconnectReason reason ) case Jreen::Client::SystemShutdown: case Jreen::Client::Conflict: case Jreen::Client::Unknown: + case Jreen::Client::NoCompressionSupport: + case Jreen::Client::NoEncryptionSupport: + case Jreen::Client::NoAuthorizationSupport: + case Jreen::Client::NoSupportedFeature: emit error( Account::ConnectionError, errorMessage( reason ) ); break; @@ -377,6 +387,22 @@ XmppSipPlugin::errorMessage( Jreen::Client::DisconnectReason reason ) return tr("Unknown"); break; + case Jreen::Client::NoCompressionSupport: + return tr("No Compression Support"); + break; + + case Jreen::Client::NoEncryptionSupport: + return tr("No Encryption Support"); + break; + + case Jreen::Client::NoAuthorizationSupport: + return tr("No Authorization Support"); + break; + + case Jreen::Client::NoSupportedFeature: + return tr("No Supported Feature"); + break; + default: qDebug() << "Not all Client::DisconnectReasons checked"; Q_ASSERT(false); diff --git a/src/accounts/xmpp/xmppconfigwidget.cpp b/src/accounts/xmpp/xmppconfigwidget.cpp index bc7c138da..c03fe2287 100644 --- a/src/accounts/xmpp/xmppconfigwidget.cpp +++ b/src/accounts/xmpp/xmppconfigwidget.cpp @@ -44,6 +44,7 @@ XmppConfigWidget::XmppConfigWidget( XmppAccount* account, QWidget *parent ) : m_ui->xmppServer->setText( account->configuration().contains( "server" ) ? account->configuration()[ "server" ].toString() : QString() ); m_ui->xmppPort->setValue( account->configuration().contains( "port" ) ? account->configuration()[ "port" ].toInt() : 5222 ); m_ui->xmppPublishTracksCheckbox->setChecked( account->configuration().contains( "publishtracks" ) ? account->configuration()[ "publishtracks" ].toBool() : true); + m_ui->xmppEnforceSecureCheckbox->setChecked( account->configuration().contains( "enforcesecure" ) ? account->configuration()[ "enforcesecure" ].toBool() : false); m_ui->jidExistsLabel->hide(); connect( m_ui->xmppUsername, SIGNAL( textChanged( QString ) ), SLOT( onCheckJidExists( QString ) ) ); @@ -65,7 +66,8 @@ XmppConfigWidget::saveConfig() QVariantHash configuration = m_account->configuration(); configuration[ "server" ] = m_ui->xmppServer->text().trimmed(); configuration[ "port" ] = m_ui->xmppPort->text().trimmed(); - configuration[ "publishtracks"] = m_ui->xmppPublishTracksCheckbox->checkState() == Qt::Checked; + configuration[ "publishtracks"] = m_ui->xmppPublishTracksCheckbox->isChecked(); + configuration[ "enforcesecure"] = m_ui->xmppEnforceSecureCheckbox->isChecked(); m_account->setAccountFriendlyName( m_ui->xmppUsername->text() ); m_account->setCredentials( credentials ); diff --git a/src/accounts/xmpp/xmppconfigwidget.ui b/src/accounts/xmpp/xmppconfigwidget.ui index 07a585604..bc083aa44 100644 --- a/src/accounts/xmpp/xmppconfigwidget.ui +++ b/src/accounts/xmpp/xmppconfigwidget.ui @@ -303,6 +303,13 @@ + + + + Enforce secure connection + + + diff --git a/src/audiocontrols.cpp b/src/audiocontrols.cpp index 9b3807a0a..f680ba9b4 100644 --- a/src/audiocontrols.cpp +++ b/src/audiocontrols.cpp @@ -238,6 +238,7 @@ AudioControls::onPlaybackLoading( const Tomahawk::result_ptr& result ) ui->timeLabel->setText( TomahawkUtils::timeToString( 0 ) ); ui->timeLeftLabel->setFixedWidth( ui->timeLeftLabel->fontMetrics().width( QString( duration.length() + 1, QChar( '0' ) ) ) ); ui->timeLeftLabel->setText( "-" + duration ); + m_lastTextSecondShown = 0; ui->stackedLayout->setCurrentWidget( ui->pauseButton ); @@ -356,6 +357,14 @@ AudioControls::onPlaybackStopped() void AudioControls::onPlaybackTimer( qint64 msElapsed ) { + const int seconds = msElapsed / 1000; + if ( seconds != m_lastTextSecondShown ) + { + ui->timeLabel->setText( TomahawkUtils::timeToString( seconds ) ); + ui->timeLeftLabel->setText( "-" + TomahawkUtils::timeToString( m_currentTrack->duration() - seconds ) ); + m_lastTextSecondShown = seconds; + } + //tDebug( LOGEXTRA ) << Q_FUNC_INFO << "msElapsed =" << msElapsed << "and timer current time =" << m_sliderTimeLine.currentTime() << "and m_seekMsecs =" << m_seekMsecs; if ( msElapsed > 0 && msElapsed != m_lastSliderCheck && m_seekMsecs == -1 && msElapsed - 500 < m_lastSliderCheck ) return; @@ -372,10 +381,6 @@ AudioControls::onPlaybackTimer( qint64 msElapsed ) if ( sender() != &m_phononTickCheckTimer ) m_phononTickCheckTimer.start( 1000 ); - const int seconds = msElapsed / 1000; - ui->timeLabel->setText( TomahawkUtils::timeToString( seconds ) ); - ui->timeLeftLabel->setText( "-" + TomahawkUtils::timeToString( m_currentTrack->duration() - seconds ) ); - if ( m_noTimeChange ) { if ( m_sliderTimeLine.currentTime() != msElapsed ) diff --git a/src/audiocontrols.h b/src/audiocontrols.h index 4ec9f585a..b7adf31b8 100644 --- a/src/audiocontrols.h +++ b/src/audiocontrols.h @@ -100,6 +100,7 @@ private: qint64 m_seekMsecs; qint64 m_lastSliderCheck; bool m_noTimeChange; + qint64 m_lastTextSecondShown; }; #endif // AUDIOCONTROLS_H diff --git a/src/libtomahawk/infobar/infobar.cpp b/src/libtomahawk/infobar/infobar.cpp index 0a5425f50..9e0145290 100644 --- a/src/libtomahawk/infobar/infobar.cpp +++ b/src/libtomahawk/infobar/infobar.cpp @@ -27,6 +27,8 @@ #include "utils/tomahawkutils.h" #include "utils/logger.h" #include +#include +#include #include #define ANIMATION_TIME 400 @@ -96,17 +98,13 @@ InfoBar::InfoBar( QWidget* parent ) ui->horizontalLayout->addWidget( m_searchWidget ); - QLinearGradient gradient = QLinearGradient( QPoint( 0, 0 ), QPoint( 500, 200 ) ); //HACK - gradient.setColorAt( 0.0, QColor( 100, 100, 100 ) ); - gradient.setColorAt( 0.8, QColor( 63, 63, 63 ) ); - - QPalette p = palette(); - p.setBrush( QPalette::Window, QBrush( gradient ) ); - setPalette( p ); setAutoFillBackground( true ); setMinimumHeight( geometry().height() ); setMaximumHeight( geometry().height() ); + + createTile(); + connect( ViewManager::instance(), SIGNAL( filterAvailable( bool ) ), SLOT( setFilterAvailable( bool ) ) ); connect( ViewManager::instance(), SIGNAL( autoUpdateAvailable( bool ) ), SLOT( setAutoUpdateAvailable( bool ) ) ); } @@ -225,6 +223,63 @@ InfoBar::onFilterEdited() emit filterTextChanged( m_searchWidget->text() ); } + +void +InfoBar::createTile( int w ) +{ + QImage tile = QImage( RESPATH "images/playlist-header-tiled.png" ); + + if ( tile.isNull() ) + return; + + if ( tile.height() < height() ) + { + // image must be at least as tall as we are + QImage taller( tile.width(), height(), QImage::Format_ARGB32_Premultiplied ); + QPainter p( &taller ); + int curY = 0; + while ( curY < taller.height() ) + { + const int thisHeight = (curY + tile.height() > height()) ? height() - curY : tile.height(); + p.drawImage( QRect( 0, curY, tile.width(), thisHeight ), tile, QRect( 0, 0, tile.width(), thisHeight ) ); + curY += tile.height(); + } + tile = taller; + } + + m_bgTile = QPixmap( w, height() ); + m_bgTile.fill( Qt::transparent ); + + int curWidth = 0; + QPainter p( &m_bgTile ); + while ( curWidth < w ) + { + const int thisWidth = (curWidth + tile.width() > w) ? w - curWidth : tile.width(); + + const QRect source( 0, 0, thisWidth, m_bgTile.height() ); + const QRect dest( curWidth, 0, thisWidth, m_bgTile.height() ); + p.drawImage( dest, tile, source ); + curWidth += thisWidth; + } +} + + +void +InfoBar::paintEvent( QPaintEvent* e ) +{ + if ( m_bgTile.isNull() || width() > m_bgTile.width() ) + createTile( width() ); + + if ( m_bgTile.isNull() ) + return; + + QPainter p( this ); + + // Truncate bg pixmap and paint into bg + p.drawPixmap( rect(), m_bgTile, rect() ); +} + + void InfoBar::changeEvent( QEvent* e ) { diff --git a/src/libtomahawk/infobar/infobar.h b/src/libtomahawk/infobar/infobar.h index 7f1f9d8ee..a5f418819 100644 --- a/src/libtomahawk/infobar/infobar.h +++ b/src/libtomahawk/infobar/infobar.h @@ -64,14 +64,19 @@ signals: protected: void changeEvent( QEvent* e ); + void paintEvent( QPaintEvent* e ); private slots: void onFilterEdited(); void artistClicked(); private: + void createTile( int width = 2000 ); + Ui::InfoBar* ui; + QPixmap m_bgTile; + QSearchField* m_searchWidget; QCheckBox* m_autoUpdate; QueryLabel* m_queryLabel;