1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-07 12:40:45 +02:00

Compare commits

...

38 Commits

Author SHA1 Message Date
Dominik Schmidt
512153dca3 Fix RTMP streams 2016-04-13 17:23:40 +02:00
Dominik Schmidt
ec88cf27f3 Fix getResponseHeader to correctly return values for case-insensitive headers 2016-04-13 13:59:35 +02:00
Dominik Schmidt
931562fbe5 Fix getResponseHeader for native requests. Needs discussion what's the cross platform way forward 2016-04-13 13:17:38 +02:00
Christian Muehlhaeuser
77593e32a7 Don't refresh collection every single time we're about to show the page. 2016-04-12 20:05:13 +02:00
Christian Muehlhaeuser
bac38e4555 Coding style in SeekSlider.cpp. 2016-04-12 15:55:33 +02:00
Christian Muehlhaeuser
980ee97c97 Merge pull request #332 from tmwoz/master
Fix for next track not getting triggered when seeking to/past the end with a mouse
2016-04-12 15:45:07 +02:00
Christian Muehlhaeuser
26ad51f4b8 Removed Qt5 warning. It's our default now. 2016-04-12 14:31:08 +02:00
Christian Muehlhaeuser
21bdb0bc89 Show up to 50 top tracks per artist. 2016-04-12 14:23:18 +02:00
Christian Muehlhaeuser
0a560f2f27 Fixed compiler warnings for QMetaType comparison. 2016-04-12 14:11:41 +02:00
Christian Muehlhaeuser
9c9f5e4dae Added Anton Romanov and Stefan Ahlers to our about-dialog. Well deserved guys, thanks for all the amazing work. 2016-04-05 11:37:44 +02:00
Christian Muehlhaeuser
fb38735936 Style fix in Pipeline. 2016-04-05 11:34:45 +02:00
Dominik Schmidt
c62ae52bfe Fix Zeroconf with recent Qt5 2016-04-02 13:45:08 +02:00
Dominik Schmidt
0341492069 Fix #458: Completely disable BUY buttons in GridItemDelegate instead of only making them invisible 2016-04-02 13:28:56 +02:00
Dominik Schmidt
879df894c3 Merge pull request #465 from mrmaffen/master
Fixed a bug in fake xhr's getResponseHeader function. Plus some compat fixes for th android
2016-04-02 11:59:35 +02:00
Dominik Schmidt
0c9f1be2c8 Prevent users from compiling Tomahawk with Qt4 2016-03-27 12:07:08 +02:00
Teo Mrnjavac
f7a3d441a1 Update libcrashreporter-qt submodule for build fix. 2016-03-25 11:46:19 +01:00
Teo Mrnjavac
e9a1135525 Update libcrashreporter-qt submodule. 2016-03-25 10:08:45 +01:00
Teo Mrnjavac
bdce4f7636 Probably shouldn't be inline. 2016-03-21 11:29:23 +01:00
Teo Mrnjavac
de65e19cb7 Use a sans serif antialiased font in the artist bio view. 2016-03-09 14:34:20 +01:00
Teo Mrnjavac
ce3647a4a6 Scale up artist bio font size with DpiScaler to make it always readable 2016-03-09 13:44:45 +01:00
Enno Gottschalk
f498570a0e Fixed a bug in fake xhr's getResponseHeader function. Plus some compat fixes for th android 2016-03-04 19:34:03 +01:00
Enno Gottschalk
9a741cd2db Czeched, polished and finnished 2016-03-02 17:11:01 +01:00
Enno Gottschalk
102c9c6846 Make testConfig great again! 2016-03-02 16:14:27 +01:00
Dominik Schmidt
1fa35ae827 Go back to former VLC build as the new build is crashy 2016-02-25 23:10:07 +01:00
Dominik Schmidt
26c0f35d21 Wrap error message in account config 2016-02-25 03:46:44 +01:00
Dominik Schmidt
9acbb48659 If sign_step.sh exists, require it to succeed 2016-02-25 02:52:25 +01:00
Dominik Schmidt
cc9f287b41 Don't rely on target names for export macros 2016-02-23 17:20:31 +01:00
Dominik Schmidt
99abd7434b Don't hardcode app id for vlc 2016-02-23 16:14:10 +01:00
Dominik Schmidt
f38f3ca367 Linux: Fix icon installation 2016-02-23 16:14:10 +01:00
Christian Muehlhaeuser
773ecea0da Be less verbose in SourceTreeView. 2016-02-23 02:24:10 +01:00
Christian Muehlhaeuser
620d3fe3fc Style fixes in SourceTreeView. 2016-02-23 02:23:47 +01:00
Christian Muehlhaeuser
8679fd5055 Style fix in CollectionViewPage. 2016-02-23 02:23:19 +01:00
Christian Muehlhaeuser
d7eccea4c0 Remove obsolete method in SourceTreeView. 2016-02-23 02:22:53 +01:00
Christian Muehlhaeuser
2ab9418a9e Don't paint a hover background during drag & drop, when you can't drop something on a sidebar item, e.g. groups, labels etc. 2016-02-23 02:15:45 +01:00
Christian Muehlhaeuser
285333d43b Blur the collection header background, so the labels stand out a bit more. 2016-02-23 01:20:35 +01:00
Tomasz Woźniak
1b0517efc5 moved the fix to include seeking via position 2015-10-05 22:01:50 +02:00
Tomasz Woźniak
e6a8a41c31 added quick fix for libvlc not seeking correctly to an end for some tracks 2015-10-05 20:04:17 +02:00
Tomasz Woźniak
193beda2bc handle case when user seeks past the slider's end 2015-10-05 00:47:26 +02:00
33 changed files with 195 additions and 162 deletions

View File

@@ -179,7 +179,7 @@ if( NOT BUILD_WITH_QT4 )
set(HAVE_X11 FALSE)
endif()
message(STATUS "Found Qt5! Be aware that Qt5-support is still experimental and not officially supported!")
message(STATUS "Found Qt5!")
if( UNIX AND NOT APPLE )
# We need this to find the paths to qdbusxml2cpp and co
@@ -228,6 +228,10 @@ endif()
if( NOT Qt5Core_DIR )
message(STATUS "Could not find Qt5, searching for Qt4 instead...")
if(NOT FORCE_QT4)
message(FATAL_ERROR "Qt4 support is broken, if you plan to fix it, add -DFORCE_QT4=ON to your cmake arguments otherwise you should compile Tomahawk with Qt5")
endif()
set(NEEDED_QT4_COMPONENTS "QtCore" "QtXml" "QtNetwork")
if( BUILD_GUI )
list(APPEND NEEDED_QT4_COMPONENTS "QtGui" "QtWebkit" "QtUiTools" "QtSvg")

View File

@@ -3,8 +3,6 @@
set( TOMAHAWK_QT5 @TOMAHAWK_QT5@ )
if(TOMAHAWK_QT5)
message(STATUS "Found Qt5! Be aware that Qt5-support is still experimental and not officially supported!")
# CMAKE 2.8.13+/3.0.0+ requires these for IMPORTed targets
find_package(Qt5Core REQUIRED)
find_package(Qt5Concurrent REQUIRED)

View File

@@ -46,7 +46,7 @@ CERT_SIGNER=$2
cd ..
if [ -f ~/sign_step.sh ];
then
~/sign_step.sh "$CERT_SIGNER" "${TARGET_NAME}.app" || true
~/sign_step.sh "$CERT_SIGNER" "${TARGET_NAME}.app"
fi
header "Creating DMG"

View File

@@ -9,7 +9,7 @@ fi
rm -rvf vlc/
VLC_TARBALL="vlc-2.2.3.tar.bz2"
VLC_TARBALL="vlc.tar.bz2"
echo "Download phonon archive..."
# wget -c "http://downloads.sourceforge.net/project/vlc/1.1.9/win32/vlc-1.1.9-win32.7z?r=http%3A%2F%2Fwww.videolan.org%2Fvlc%2Fdownload-windows.html&ts=1306272584&use_mirror=leaseweb"

View File

@@ -42,6 +42,8 @@ Tomahawk.apiVersion = "0.2.2";
//Statuses considered a success for HTTP request
var httpSuccessStatuses = [200, 201];
Tomahawk.error = console.error;
// install RSVP error handler for uncaught(!) errors
RSVP.on('error', function (reason) {
var resolverName = "";
@@ -49,9 +51,9 @@ RSVP.on('error', function (reason) {
resolverName = Tomahawk.resolver.instance.settings.name + " - ";
}
if (reason) {
console.error(resolverName + 'Uncaught error:', reason);
Tomahawk.error(resolverName + 'Uncaught error:', reason);
} else {
console.error(resolverName + 'Uncaught error: error thrown from RSVP but it was empty');
Tomahawk.error(resolverName + 'Uncaught error: error thrown from RSVP but it was empty');
}
});
@@ -300,13 +302,15 @@ Tomahawk.Resolver = {
},
_adapter_testConfig: function (config) {
return RSVP.Promise.resolve(this.testConfig(config)).then(function () {
return {result: Tomahawk.ConfigTestResultType.Success};
return RSVP.Promise.resolve(this.testConfig(config)).then(function (results) {
results = results || Tomahawk.ConfigTestResultType.Success;
return results;
}, function (error) {
return error;
});
}
};
// help functions
Tomahawk.valueForSubNode = function (node, tag) {
@@ -377,48 +381,6 @@ Tomahawk.retrievedMetadata = function (metadataId, metadata, error) {
delete Tomahawk.retrieveMetadataCallbacks[metadataId];
};
/**
* Internal counter used to identify asyncRequest callback from native code.
*/
Tomahawk.asyncRequestIdCounter = 0;
/**
* Internal map used to map asyncRequestIds to the respective javascript
* callback functions.
*/
Tomahawk.asyncRequestCallbacks = {};
/**
* Pass the natively retrieved reply back to the javascript callback
* and augment the fake XMLHttpRequest object.
*
* Internal use only!
*/
Tomahawk.nativeAsyncRequestDone = function (reqId, xhr) {
// Check that we have a matching callback stored.
if (!Tomahawk.asyncRequestCallbacks.hasOwnProperty(reqId)) {
return;
}
// Call the real callback
if (xhr.readyState == 4 && httpSuccessStatuses.indexOf(xhr.status) != -1) {
// Call the real callback
if (Tomahawk.asyncRequestCallbacks[reqId].callback) {
Tomahawk.asyncRequestCallbacks[reqId].callback(xhr);
}
} else if (xhr.readyState === 4) {
Tomahawk.log("Failed to do nativeAsyncRequest");
Tomahawk.log("Status Code was: " + xhr.status);
if (Tomahawk.asyncRequestCallbacks[reqId].errorHandler) {
Tomahawk.asyncRequestCallbacks[reqId].errorHandler(xhr);
}
}
// Callbacks are only used once.
delete Tomahawk.asyncRequestCallbacks[reqId];
};
/**
* This method is externalized from Tomahawk.asyncRequest, so that other clients
* (like tomahawk-android) can inject their own logic that determines whether or not to do a request
@@ -433,9 +395,9 @@ var shouldDoNativeRequest = function (options) {
|| extraHeaders.hasOwnProperty("User-Agent")));
};
/**
* Possible options:
* - url: The URL to call
* - method: The HTTP request method (default: GET)
* - username: The username for HTTP Basic Auth
* - password: The password for HTTP Basic Auth
@@ -453,7 +415,12 @@ var doRequest = function(options) {
return this.responseHeaders;
};
xhr.getResponseHeader = function (header) {
return this.responseHeaders[header];
for(key in xhr.responseHeaders) {
if(key.toLowerCase() === header.toLowerCase()) {
return xhr.responseHeaders[key];
}
}
return null;
};
return xhr;
@@ -745,7 +712,6 @@ Tomahawk.base64Encode = function (b) {
return window.btoa(b);
};
Tomahawk.PluginManager = {
wrapperPrefix: '_adapter_',
objects: {},
@@ -776,8 +742,6 @@ Tomahawk.PluginManager = {
methodName = this.wrapperPrefix + methodName;
}
var pluginManager = this;
if (!this.objects[objectId]) {
Tomahawk.log("Object not found! objectId: " + objectId + " methodName: " + methodName);
} else {
@@ -798,20 +762,21 @@ Tomahawk.PluginManager = {
invoke: function (requestId, objectId, methodName, params) {
RSVP.Promise.resolve(this.invokeSync(requestId, objectId, methodName, params))
.then(function (result) {
Tomahawk.reportScriptJobResults({
var params = {
requestId: requestId,
data: result
});
};
Tomahawk.reportScriptJobResults(encodeParamsToNativeFunctions(params));
}, function (error) {
Tomahawk.reportScriptJobResults({
var params = {
requestId: requestId,
error: error
});
};
Tomahawk.reportScriptJobResults(encodeParamsToNativeFunctions(params));
});
}
};
var encodeParamsToNativeFunctions = function(param) {
return param;
};
@@ -825,7 +790,7 @@ Tomahawk.NativeScriptJobManager = {
var requestId = this.idCounter++;
var deferred = RSVP.defer();
this.deferreds[requestId] = deferred;
Tomahawk.invokeNativeScriptJob(requestId, methodName, encodeParamsToNativeFunctions(params));;
Tomahawk.invokeNativeScriptJob(requestId, methodName, encodeParamsToNativeFunctions(params));
return deferred.promise;
},
reportNativeScriptJobResult: function(requestId, result) {
@@ -1494,9 +1459,7 @@ Tomahawk.Collection = {
return new RSVP.Promise(function (resolve, reject) {
that.cachedDbs[id].changeVersion(that.cachedDbs[id].version, "", null,
function (err) {
if (console.error) {
console.error("Error!: %o", err);
}
Tomahawk.error("Error trying to change db version!", err);
reject();
}, function () {
delete that.cachedDbs[id];

View File

@@ -24,6 +24,7 @@ tomahawk_add_library(${TOMAHAWK_PLAYDARAPI_LIBRARY_TARGET}
qtcertificateaddon
${GNUTLS_LIBRARIES}
EXPORT TomahawkLibraryDepends
EXPORT_MACRO TOMAHAWK_WIDGETS_EXPORT_PRO
VERSION ${TOMAHAWK_VERSION_SHORT}
)

View File

@@ -23,7 +23,7 @@
#include <QtCore/qglobal.h>
#ifndef TOMAHAWK_PLAYDARAPI_EXPORT
# if defined (tomahawk_playdarapi_EXPORTS)
# if defined (TOMAHAWK_WIDGETS_EXPORT_PRO)
# define TOMAHAWK_PLAYDARAPI_EXPORT Q_DECL_EXPORT
# else
# define TOMAHAWK_PLAYDARAPI_EXPORT Q_DECL_IMPORT

View File

@@ -13,5 +13,6 @@ tomahawk_add_library(${TOMAHAWK_WIDGETS_LIBRARY_TARGET}
SOURCES ${${TOMAHAWK_WIDGETS_LIBRARY_TARGET}_SOURCES}
UI ${${TOMAHAWK_WIDGETS_LIBRARY_TARGET}_UI}
EXPORT TomahawkLibraryDepends
EXPORT_MACRO TOMAHAWK_WIDGETS_EXPORT_PRO
VERSION ${TOMAHAWK_VERSION_SHORT}
)

View File

@@ -23,7 +23,7 @@
#include <QtCore/qglobal.h>
#ifndef TOMAHAWK_WIDGETS_EXPORT
# if defined (tomahawk_widgets_EXPORTS)
# if defined (TOMAHAWK_WIDGETS_EXPORT_PRO)
# define TOMAHAWK_WIDGETS_EXPORT Q_DECL_EXPORT
# else
# define TOMAHAWK_WIDGETS_EXPORT Q_DECL_IMPORT

View File

@@ -36,7 +36,7 @@
#define MAX_CONCURRENT_QUERIES 16
#define CLEANUP_TIMEOUT 5 * 60 * 1000
#define MINSCORE 0.5
#define DEFAULT_RESOLVER_TIMEOUT 5000 //5 seconds
#define DEFAULT_RESOLVER_TIMEOUT 5000 // 5 seconds
using namespace Tomahawk;
@@ -542,12 +542,12 @@ Pipeline::shuntNext()
q->setCurrentResolver( 0 );
}
//Zero-patient, a stub so that query is not resolved until we go through
//all resolvers
//As query considered as 'finished trying to resolve' when there are no
//more qid entries in qidsState we'll put one as sort of 'keep this until
//we kick off all our resolvers' entry
//once we kick off all resolvers we'll remove this entry
// Zero-patient, a stub so that query is not resolved until we go through
// all resolvers
// As query considered as 'finished trying to resolve' when there are no
// more qid entries in qidsState we'll put one as sort of 'keep this until
// we kick off all our resolvers' entry
// once we kick off all resolvers we'll remove this entry
incQIDState( q, nullptr );
checkQIDState( q );
}
@@ -673,7 +673,7 @@ Pipeline::decQIDState( const Tomahawk::query_ptr& query, Tomahawk::Resolver* r )
{
{
QMutexLocker lock( &d->mut );
d->qidsState.remove( query->id(), r );//Removes all matching pairs
d->qidsState.remove( query->id(), r ); // Removes all matching pairs
}
checkQIDState( query );

View File

@@ -167,7 +167,7 @@ signals:
void connectionStateChanged( Tomahawk::Accounts::Account::ConnectionState state );
void configurationChanged();
void configTestResult( Tomahawk::Accounts::ConfigTestResultType );
void configTestResult( int, const QString& = QString() );
protected:
virtual void loadFromConfig( const QString &accountId );

View File

@@ -68,6 +68,7 @@ DelegateConfigWrapper::DelegateConfigWrapper( Tomahawk::Accounts::Account* accou
h->setContentsMargins( m_widget->contentsMargins() );
m_errorLabel->setAlignment( Qt::AlignCenter );
m_errorLabel->setWordWrap( true );
v->addWidget( m_errorLabel );
v->addLayout( h );
@@ -81,7 +82,7 @@ DelegateConfigWrapper::DelegateConfigWrapper( Tomahawk::Accounts::Account* accou
if ( m_widget->metaObject()->indexOfSignal( "sizeHintChanged()" ) > -1 )
connect( m_widget, SIGNAL( sizeHintChanged() ), this, SLOT( updateSizeHint() ) );
connect( m_account, SIGNAL( configTestResult( Tomahawk::Accounts::ConfigTestResultType ) ), SLOT( onConfigTestResult( Tomahawk::Accounts::ConfigTestResultType ) ) );
connect( m_account, SIGNAL( configTestResult( int, const QString& ) ), SLOT( onConfigTestResult( int, const QString& ) ) );
}
@@ -192,11 +193,11 @@ DelegateConfigWrapper::aboutClicked( bool )
void
DelegateConfigWrapper::onConfigTestResult( Tomahawk::Accounts::ConfigTestResultType result )
DelegateConfigWrapper::onConfigTestResult( int code, const QString& message )
{
tLog() << Q_FUNC_INFO << result;
tLog() << Q_FUNC_INFO << code << ": " << message;
if( result == Tomahawk::Accounts::ConfigTestResultSuccess )
if( code == Tomahawk::Accounts::ConfigTestResultSuccess )
{
m_invalidData = QVariantMap();
closeDialog( QDialog::Accepted );
@@ -226,8 +227,25 @@ DelegateConfigWrapper::onConfigTestResult( Tomahawk::Accounts::ConfigTestResultT
m_invalidData = m_widget->readData();
// TODO: generate message based on status code
m_errorLabel->setText( QString( "<font color='red'>%1</font>" ).arg( tr( "Your config is invalid." ) ) );
QString msg = !message.isEmpty() ? message : getTestConfigMessage( code );
m_errorLabel->setText( QString( "<font color='red'>%1</font>" ).arg( msg ) );
}
}
QString
DelegateConfigWrapper::getTestConfigMessage( int code )
{
switch(code) {
case Tomahawk::Accounts::ConfigTestResultCommunicationError:
return tr( "Unable to authenticate. Please check your connection." );
case Tomahawk::Accounts::ConfigTestResultInvalidCredentials:
return tr( "Username or password incorrect." );
case Tomahawk::Accounts::ConfigTestResultInvalidAccount:
return tr( "Account rejected by server." );
case Tomahawk::Accounts::ConfigTestResultPlayingElsewhere:
return tr( "Action not allowed, account is in use elsewhere." );
case Tomahawk::Accounts::ConfigTestResultAccountExpired:
return tr( "Your account has expired." );
}
}

View File

@@ -60,10 +60,11 @@ protected:
private slots:
void aboutClicked( bool );
void onConfigTestResult( Tomahawk::Accounts::ConfigTestResultType );
void onConfigTestResult( int, const QString& );
private:
void closeDialog( QDialog::DialogCode code );
QString getTestConfigMessage( int code );
Tomahawk::Accounts::Account* m_account;
AccountConfigWidget* m_widget;

View File

@@ -542,7 +542,7 @@ ResolverAccount::testConfig()
{
QVariantMap data = resolver->loadDataFromWidgets();
ScriptJob* job = resolver->scriptObject()->invoke( "testConfig", data );
connect( job, SIGNAL( done( QVariantMap ) ), SLOT( onTestConfig( QVariantMap ) ) );
connect( job, SIGNAL( done( QVariant ) ), SLOT( onTestConfig( QVariant ) ) );
job->start();
}
else
@@ -560,18 +560,17 @@ ResolverAccount::resolver() const
void
ResolverAccount::onTestConfig( const QVariantMap& result )
ResolverAccount::onTestConfig( const QVariant& result )
{
tLog() << Q_FUNC_INFO << result;
int resultCode = result[ "result" ].toInt();
if ( resultCode == 1 )
if ( result.type() == QVariant::String )
{
emit configTestResult( Accounts::ConfigTestResultSuccess );
emit configTestResult( Accounts::ConfigTestResultOther, result.toString() );
}
else
{
emit configTestResult( Accounts::ConfigTestResultOther );
emit configTestResult( result.toInt() );
}
sender()->deleteLater();
@@ -590,6 +589,7 @@ AtticaResolverAccount::AtticaResolverAccount( const QString& accountId )
}
AtticaResolverAccount::AtticaResolverAccount( const QString& accountId, const QString& path, const QString& atticaId, const QVariantHash& initialConfiguration )
: ResolverAccount( accountId, path, initialConfiguration )
, m_atticaId( atticaId )
@@ -619,8 +619,6 @@ AtticaResolverAccount::init()
loadIcon();
else
connect( AtticaManager::instance(), SIGNAL( resolversLoaded( Attica::Content::List ) ), this, SLOT( loadIcon() ) );
}

View File

@@ -110,7 +110,7 @@ public:
private slots:
void resolverChanged();
void onTestConfig( const QVariantMap& result );
void onTestConfig( const QVariant& result );
protected:
// Created by factory, when user installs a new resolver

View File

@@ -611,7 +611,7 @@ AudioEngine::gotStreamUrl( const QVariantMap& data )
QVariantMap headers = data[ "headers" ].toMap();
Tomahawk::result_ptr result = sender()->property( "result" ).value<result_ptr>();
if ( streamUrl.isEmpty() || !( TomahawkUtils::isHttpResult( streamUrl ) || TomahawkUtils::isHttpsResult( streamUrl ) || TomahawkUtils::isRtmpResult( streamUrl ) ) )
if ( streamUrl.isEmpty() || !( TomahawkUtils::isHttpResult( streamUrl ) || TomahawkUtils::isHttpsResult( streamUrl ) ) )
{
// Not an http(s) or RTMP URL, get IO device
QSharedPointer< QIODevice > sp;

View File

@@ -98,8 +98,8 @@ AudioOutput::AudioOutput( QObject* parent )
TOMAHAWK_APPLICATION_NAME "/" TOMAHAWK_VERSION );
// FIXME: icon is named tomahawk, so we need the lowercase application name
#if (LIBVLC_VERSION_INT >= LIBVLC_VERSION(2, 1, 0, 0))
libvlc_set_app_id( m_vlcInstance, "org.tomahawk-player.desktop",
TOMAHAWK_VERSION, "tomahawk" );
libvlc_set_app_id( m_vlcInstance, TOMAHAWK_APPLICATION_PACKAGE_NAME,
TOMAHAWK_VERSION, TOMAHAWK_TARGET_NAME );
#endif
m_vlcPlayer = libvlc_media_player_new( m_vlcInstance );
@@ -481,16 +481,19 @@ AudioOutput::seek( qint64 milliseconds )
return;
}
qint64 duration = AudioEngine::instance()->currentTrackTotalTime();
// for some tracks, seeking to an end seems not to work correctly with libvlc
// (tracks enter a random and infinite loop) - this is a temporary fix for that
if (duration == milliseconds)
milliseconds -= 1;
if ( m_seekable )
{
// tDebug() << Q_FUNC_INFO << "AudioOutput:: seeking" << milliseconds << "msec";
libvlc_media_player_set_time( m_vlcPlayer, milliseconds );
setCurrentTime( milliseconds );
}
else
{
qint64 duration = AudioEngine::instance()->currentTrackTotalTime();
float position = float(float(milliseconds) / duration);
libvlc_media_player_set_position(m_vlcPlayer, position);
tDebug() << Q_FUNC_INFO << "AudioOutput:: seeking via position" << position << "pos";

View File

@@ -1371,8 +1371,7 @@ Servent::isIPWhitelisted( QHostAddress ip )
}
}
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
// Qt4 cannot cope correctly with IPv4 addresses mapped into the IPv6
// Qt cannot cope correctly with IPv4 addresses mapped into the IPv6
// address space
if ( ip.protocol() == QAbstractSocket::IPv6Protocol )
{
@@ -1397,7 +1396,6 @@ Servent::isIPWhitelisted( QHostAddress ip )
return isIPWhitelisted( addr );
}
}
#endif
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "failure";
return false;

View File

@@ -347,6 +347,8 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
{
if ( !text.isEmpty() )
DropDownButton::drawPrimitive( painter, r, text, m_hoveringOverBuyButton == index, false );
else
m_buyButtonRects.remove( index );
}
else
{

View File

@@ -155,11 +155,17 @@ ScriptAccount::reportScriptJobResult( const QVariantMap& result )
Q_ASSERT( job );
// got a successful job result
if ( result[ "error"].isNull() )
if ( result[ "error" ].isNull() )
{
const QVariantMap data = result[ "data" ].toMap();
job->reportResults( data );
if ( result[ "data" ].type() == QVariant::Map )
{
const QVariantMap data = result[ "data" ].toMap();
job->reportResultsMap( data );
}
else
{
job->reportResults( result[ "data" ] );
}
}
else
{

View File

@@ -82,7 +82,15 @@ ScriptJob::arguments() const
void
ScriptJob::reportResults( const QVariantMap& data )
ScriptJob::reportResultsMap( const QVariantMap& data )
{
m_data = data;
emit done( data );
}
void
ScriptJob::reportResults( const QVariant& data )
{
m_data = data;
emit done( data );
@@ -94,5 +102,6 @@ ScriptJob::reportFailure( const QString& errorMessage )
{
emit error( errorMessage );
reportResults( QVariantMap() );
reportResults();
reportResultsMap();
}

View File

@@ -49,11 +49,13 @@ public:
QVariantMap arguments() const;
public slots:
void reportResults( const QVariantMap& data = QVariantMap() );
void reportResultsMap( const QVariantMap& data = QVariantMap() );
void reportResults( const QVariant& data = QVariant() );
void reportFailure( const QString& errorMessage );
signals:
void done( const QVariantMap& result );
void done( const QVariant& result );
void error( const QString& errorMessage );
void destroyed( const QString& id );
@@ -63,7 +65,7 @@ protected:
bool m_error;
QString m_id;
scriptobject_ptr m_scriptObject;
QVariantMap m_data;
QVariant m_data;
QString m_methodName;
QVariantMap m_arguments;
};

View File

@@ -30,5 +30,5 @@ Tomahawk::SyncScriptJob::SyncScriptJob( const QVariantMap& resultData )
void
Tomahawk::SyncScriptJob::start()
{
QMetaObject::invokeMethod( this, "reportResults", Qt::QueuedConnection, Q_ARG( QVariantMap, m_data ) );
QMetaObject::invokeMethod( this, "reportResultsMap", Qt::QueuedConnection, Q_ARG( QVariantMap, m_data.toMap() ) );
}

View File

@@ -53,11 +53,11 @@ public:
static QMargins scaled( const QPaintDevice* pd, const QMargins& margins );
static int scaledX( const QPaintDevice* pd, int x );
static int scaledY( const QPaintDevice* pd, int y );
static qreal ratioFromFontHeight();
private:
inline static qreal ratioX( const QPaintDevice* pd );
inline static qreal ratioY( const QPaintDevice* pd );
inline static qreal ratioFromFontHeight();
qreal m_ratioX;
qreal m_ratioY;

View File

@@ -124,6 +124,15 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
ui->biography->page()->mainFrame()->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
ui->biography->page()->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAsNeeded );
ui->biography->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
ui->biography->setTextSizeMultiplier( DpiScaler::ratioFromFontHeight() );
ui->biography->settings()->setFontFamily( QWebSettings::StandardFont,
ui->biography->settings()->
fontFamily( QWebSettings::SansSerifFont ) );
ui->biography->setRenderHints( QPainter::Antialiasing |
QPainter::TextAntialiasing |
QPainter::HighQualityAntialiasing |
QPainter::SmoothPixmapTransform |
QPainter::NonCosmeticDefaultPen );
ui->biography->installEventFilter( this );
TomahawkStyle::stylePageWidget( ui->biography );
@@ -358,7 +367,7 @@ ArtistInfoWidget::onTracksFound( const QList<Tomahawk::query_ptr>& queries, Mode
Q_UNUSED( mode );
m_topHitsModel->finishLoading();
m_topHitsModel->appendQueries( queries.mid( 0, 20 ) );
m_topHitsModel->appendQueries( queries.mid( 0, 50 ) );
m_topHitsModel->ensureResolved();
}

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2013-2015, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2013-2016, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2014, Teo Mrnjavac <teo@kde.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@@ -57,13 +57,12 @@ CollectionViewPage::CollectionViewPage( const Tomahawk::collection_ptr& collecti
{
qRegisterMetaType< CollectionViewPageMode >( "CollectionViewPageMode" );
m_header->setBackground( ImageRegistry::instance()->pixmap( RESPATH "images/collection_background.png", QSize( 0, 0 ) ), false );
m_header->setBackground( ImageRegistry::instance()->pixmap( RESPATH "images/collection_background.png", QSize( 0, 0 ) ), true );
setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultCollection, TomahawkUtils::Original, QSize( 256, 256 ) ) );
m_columnView->proxyModel()->setStyle( PlayableProxyModel::SingleColumn );
PlayableProxyModel* trackViewProxyModel = m_trackView->proxyModel();
if ( collection->backendType() == Collection::ScriptCollectionType )
{
@@ -383,17 +382,22 @@ CollectionViewPage::restoreViewMode()
setCurrentMode( CollectionViewPage::Flat );
else
setCurrentMode( CollectionViewPage::Columns );
} else if ( mode == CollectionViewPage::Flat && !m_collection->browseCapabilities().contains( Collection::CapabilityBrowseTracks ) )
}
else if ( mode == CollectionViewPage::Flat && !m_collection->browseCapabilities().contains( Collection::CapabilityBrowseTracks ) )
{
if ( m_collection->browseCapabilities().contains( Collection::CapabilityBrowseArtists ) )
setCurrentMode( CollectionViewPage::Columns );
else if ( m_collection->browseCapabilities().contains( Collection::CapabilityBrowseAlbums ) )
setCurrentMode( CollectionViewPage::Albums );
} else {
}
else
{
setCurrentMode( mode );
}
onCollectionChanged();
// We should think about auto-refreshing only locker collections here. Disabled for now,
// as we don't want the local collection to reload every single time you show it.
// onCollectionChanged();
}

View File

@@ -1,6 +1,6 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2016, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
*
@@ -33,6 +33,7 @@ SeekSlider::SeekSlider( QWidget* parent )
, TomahawkUtils::DpiScaler( this )
, m_timeLine( 0 )
, m_acceptWheelEvents( true )
, m_isScrubbing( false )
{
setStyleSheet( QString(
"QSlider::groove:horizontal {"
@@ -72,6 +73,8 @@ SeekSlider::mousePressEvent( QMouseEvent* event )
{
if ( event->button() == Qt::LeftButton )
{
m_isScrubbing = true;
QMouseEvent eventSwap( QEvent::MouseButtonRelease, event->pos(), event->globalPos(), Qt::MidButton, Qt::MidButton, event->modifiers() );
QSlider::mousePressEvent( &eventSwap );
}
@@ -102,8 +105,25 @@ SeekSlider::wheelEvent( QWheelEvent* event )
{
if ( m_acceptWheelEvents )
{
QAbstractSlider::wheelEvent(event);
QAbstractSlider::wheelEvent( event );
return;
}
event->ignore();
}
void
SeekSlider::mouseMoveEvent( QMouseEvent* event )
{
if ( !m_isScrubbing )
return;
// disable further scrubbing when we're past the slider's right margin
if ( event->pos().x() > width() )
{
m_isScrubbing = false;
return;
}
QSlider::mouseMoveEvent( event );
}

View File

@@ -44,11 +44,13 @@ public slots:
protected:
void mousePressEvent( QMouseEvent* event );
void mouseMoveEvent( QMouseEvent* event );
void wheelEvent( QWheelEvent* event );
private:
QTimeLine* m_timeLine;
bool m_acceptWheelEvents;
bool m_isScrubbing;
};
#endif // SEEKSLIDER_H

View File

@@ -1,8 +1,8 @@
FILE( GLOB _icons "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-*.png" )
FILE( GLOB _icons "${CMAKE_SOURCE_DIR}/data/icons/*-tomahawk-icon.png" )
FOREACH( _file ${_icons} )
STRING( REPLACE "${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon-" "" _res ${_file} )
STRING( REPLACE ".png" "" _res ${_res} )
INSTALL( FILES ${_file} RENAME tomahawk.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${_res}/apps )
STRING( REPLACE "${CMAKE_SOURCE_DIR}/data/icons/" "" _res ${_file} )
STRING( REPLACE "-tomahawk-icon.png" "" _res ${_res} )
INSTALL( FILES ${_file} RENAME ${TOMAHAWK_TARGET_NAME}.png DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${_res}/apps )
ENDFOREACH( _file )
IF( WITH_UPOWER )
@@ -15,6 +15,7 @@ IF( WITH_GNOMESHORTCUTHANDLER )
SET( tomahawkSources ${tomahawkSources} linux/GnomeShortcutHandler.cpp )
ENDIF( WITH_GNOMESHORTCUTHANDLER )
INSTALL( FILES ${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon.svg RENAME tomahawk.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps )
INSTALL( FILES ${CMAKE_SOURCE_DIR}/data/icons/tomahawk-icon.svg RENAME ${TOMAHAWK_TARGET_NAME}.svg DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps )
INSTALL( FILES ${CMAKE_SOURCE_DIR}/admin/unix/tomahawk.desktop RENAME ${TOMAHAWK_TARGET_NAME}.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications )
INSTALL( FILES ${CMAKE_SOURCE_DIR}/admin/unix/tomahawk.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications )

View File

@@ -1283,7 +1283,7 @@ TomahawkWindow::showAboutTomahawk()
const QString thanksto( tr( "Thanks to:" ) );
desc = QString( "https://tomahawk-player.org<br/><br/>%1<br/><br/>Christian Muehlhaeuser &lt;muesli@tomahawk-player.org&gt;<br/><br/>"
"%2 Leo Franchi, Jeff Mitchell, Dominik Schmidt, Jason Herskowitz, Alejandro Wainzinger, Hugo Lindstr&ouml;m, Michael Zanetti, Teo Mrnjavac, Christopher Reichert, Uwe L. Korn, Patrick von Reth, Harald Sitter, Syd Lawrence, Jordi Verd&uacute; Orts" )
"%2 Leo Franchi, Jeff Mitchell, Dominik Schmidt, Jason Herskowitz, Alejandro Wainzinger, Hugo Lindstr&ouml;m, Michael Zanetti, Teo Mrnjavac, Christopher Reichert, Uwe L. Korn, Patrick von Reth, Harald Sitter, Syd Lawrence, Jordi Verd&uacute; Orts, Anton Romanov, Stefan Ahlers" )
.arg( copyright )
.arg( thanksto );

View File

@@ -570,7 +570,7 @@ SourceTreeView::addToLocal()
// copy to a link and then generate a new playlist from that
// this way we cheaply regenerate the needed controls
ScriptJob* job = Utils::LinkGenerator::instance()->openLink( playlist );
if( !job )
if ( !job )
{
// No supported generator
return;
@@ -585,7 +585,7 @@ SourceTreeView::addToLocal()
// just create the new playlist with the same values
QList< query_ptr > queries;
foreach( const plentry_ptr& e, playlist->entries() )
foreach ( const plentry_ptr& e, playlist->entries() )
queries << e->query();
playlist_ptr newpl = Playlist::create( SourceList::instance()->getLocal(), uuid(), playlist->title(), playlist->info(), playlist->creator(), playlist->shared(), queries );
@@ -658,7 +658,6 @@ SourceTreeView::latchOff( const Tomahawk::source_ptr& source )
void
SourceTreeView::latchModeToggled( bool checked )
{
tDebug() << Q_FUNC_INFO << checked;
disconnect( this, SLOT( latchOff() ) );
if ( !m_contextMenuIndex.isValid() )
return;
@@ -755,7 +754,7 @@ SourceTreeView::onCustomContextMenu( const QPoint& pos )
customMenu.addActions( customActions );
customMenu.exec( mapToGlobal( pos ) );
}
m_contextMenuIndex = QModelIndex(); //we invalidate it because there's no active context menu
m_contextMenuIndex = QModelIndex(); // we invalidate it because there's no active context menu
}
@@ -827,7 +826,7 @@ SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
{
case SourcesModel::StaticPlaylist:
case SourcesModel::CategoryAdd:
case SourcesModel::Source: //drop to send tracks to peers
case SourcesModel::Source: // drop to send tracks to peers
m_delegate->hovered( index, event->mimeData() );
if ( index != m_dropIndex )
dataChanged( index, index );
@@ -851,8 +850,10 @@ SourceTreeView::dragMoveEvent( QDragMoveEvent* event )
// Playlists are accepted always since they can be dropped anywhere
//tDebug() << Q_FUNC_INFO << "Accepting";
event->setDropAction( Qt::CopyAction );
m_dropIndex = QPersistentModelIndex( index );
}
m_dropIndex = QPersistentModelIndex( index );
else
m_dropIndex = QPersistentModelIndex();
}
else if ( DropJob::acceptsMimeData( event->mimeData(), DropJob::Playlist | DropJob::Artist | DropJob::Album, DropJob::Create ) )
{
@@ -891,26 +892,25 @@ SourceTreeView::dropEvent( QDropEvent* event )
}*/
QTreeView::dropEvent( event );
if ( event->isAccepted() )
if ( !event->isAccepted() )
{
tDebug() << Q_FUNC_INFO << "Ignoring accepted event!";
}
// if it's a playlist drop, accept it anywhere in the sourcetree by manually parsing it.
else if ( DropJob::isDropType( DropJob::Playlist, event->mimeData() ) )
{
DropJob* dropThis = new DropJob;
dropThis->setDropTypes( DropJob::Playlist );
dropThis->setDropAction( DropJob::Create );
dropThis->parseMimeData( event->mimeData() );
// if it's a playlist drop, accept it anywhere in the sourcetree by manually parsing it.
if ( DropJob::isDropType( DropJob::Playlist, event->mimeData() ) )
{
DropJob* dropThis = new DropJob;
dropThis->setDropTypes( DropJob::Playlist );
dropThis->setDropAction( DropJob::Create );
dropThis->parseMimeData( event->mimeData() );
// Don't add it to the playlist under drop, it's a new playlist now
event->acceptProposedAction();
event->accept();
}
else if ( model()->dropMimeData( event->mimeData(), event->proposedAction(), index.row(), 0, index.parent() ) )
{
event->acceptProposedAction();
event->accept();
// Don't add it to the playlist under drop, it's a new playlist now
event->acceptProposedAction();
event->accept();
}
else if ( model()->dropMimeData( event->mimeData(), event->proposedAction(), index.row(), 0, index.parent() ) )
{
event->acceptProposedAction();
event->accept();
}
}
m_dragging = false;
@@ -949,7 +949,8 @@ SourceTreeView::keyPressEvent( QKeyEvent* event )
void
SourceTreeView::paintEvent( QPaintEvent* event )
{
if ( m_dragging && !m_dropRect.isEmpty() )
/* Draw drag & drop hover background */
if ( m_dragging && !m_dropRect.isEmpty() && m_dropIndex.isValid() )
{
QPainter painter( viewport() );
const QRect itemRect = visualRect( m_dropIndex );
@@ -966,13 +967,6 @@ SourceTreeView::paintEvent( QPaintEvent* event )
}
void
SourceTreeView::drawRow( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{
QTreeView::drawRow( painter, option, index );
}
void
SourceTreeView::drawBranches( QPainter* /* painter */, const QRect& /* rect */, const QModelIndex& /* index */ ) const
{

View File

@@ -92,7 +92,6 @@ private slots:
void onPlaylistLinkReady( const QVariantMap& data );
protected:
void drawRow( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
void drawBranches( QPainter *painter, const QRect &rect, const QModelIndex &index ) const;
virtual void paintEvent( QPaintEvent* event );