1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-01 03:40:16 +02:00

Merge remote-tracking branch 'origin/master' into spotifyplaylists

Conflicts:
	resources.qrc
This commit is contained in:
Leo Franchi
2012-04-01 12:56:24 -04:00
11 changed files with 119 additions and 17 deletions

View File

@@ -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")

2
README
View File

@@ -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:

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

View File

@@ -136,6 +136,7 @@
<file>data/images/grooveshark.png</file>
<file>data/images/lastfm-icon.png</file>
<file>data/images/spotifycore-logo.png</file>
<file>data/images/playlist-header-tiled.png</file>
<file>data/sql/dbmigrate-27_to_28.sql</file>
<file>data/images/process-stop.png</file>
<file>data/icons/tomahawk-icon-128x128-grayscale.png</file>

View File

@@ -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);

View File

@@ -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 );

View File

@@ -303,6 +303,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="xmppEnforceSecureCheckbox">
<property name="text">
<string>Enforce secure connection</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -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 )

View File

@@ -100,6 +100,7 @@ private:
qint64 m_seekMsecs;
qint64 m_lastSliderCheck;
bool m_noTimeChange;
qint64 m_lastTextSecondShown;
};
#endif // AUDIOCONTROLS_H

View File

@@ -27,6 +27,8 @@
#include "utils/tomahawkutils.h"
#include "utils/logger.h"
#include <QCheckBox>
#include <QPaintEvent>
#include <QPainter>
#include <widgets/querylabel.h>
#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 )
{

View File

@@ -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;