1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-12 00:54:20 +02:00

Remove obsolete QT_VERSION_CHECKs

This commit is contained in:
Andreas Sturmlechner
2018-07-07 21:40:23 +02:00
committed by Dominik Schmidt
parent 2b95da1a32
commit a6cb6a92e6
62 changed files with 34 additions and 496 deletions

View File

@@ -25,11 +25,6 @@
#include "utils/Logger.h"
#include "TomahawkSettings.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Source.h"
#endif
// remove now playing status after PAUSE_TIMEOUT seconds
static const int PAUSE_TIMEOUT = 10;

View File

@@ -66,29 +66,6 @@ using namespace Accounts;
#define TOMAHAWK_CAP_NODE_NAME QLatin1String( "http://tomahawk-player.org/" )
#if QT_VERSION <= QT_VERSION_CHECK( 5, 0, 0 )
void
JreenMessageHandler( QtMsgType type, const char *msg )
{
switch ( type )
{
case QtDebugMsg:
tDebug( LOGTHIRDPARTY ).nospace() << JREEN_LOG_INFIX << ":" << "Debug:" << msg;
break;
case QtWarningMsg:
tDebug( LOGTHIRDPARTY ).nospace() << JREEN_LOG_INFIX << ":" << "Warning:" << msg;
break;
case QtCriticalMsg:
tDebug( LOGTHIRDPARTY ).nospace() << JREEN_LOG_INFIX << ":" << "Critical:" << msg;
break;
case QtFatalMsg:
tDebug( LOGTHIRDPARTY ).nospace() << JREEN_LOG_INFIX << ":" << "Fatal:" << msg;
abort();
}
}
#endif
XmppSipPlugin::XmppSipPlugin( Account* account )
: SipPlugin( account )
, m_state( Account::Disconnected )
@@ -96,9 +73,6 @@ XmppSipPlugin::XmppSipPlugin( Account* account )
, m_xmlConsole( nullptr )
, m_pubSubManager( nullptr )
{
#if QT_VERSION <= QT_VERSION_CHECK( 5, 0, 0 )
Jreen::Logger::addHandler( JreenMessageHandler );
#endif
m_currentUsername = readUsername();
m_currentServer = readServer();

View File

@@ -23,11 +23,7 @@
#include "utils/Logger.h"
#include "utils/NetworkAccessManager.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/ArtistTypes.h>
#else
#include <echonest/ArtistTypes.h>
#endif
#include <QNetworkConfiguration>

View File

@@ -25,11 +25,7 @@
#include "infosystem/InfoSystem.h"
#include "infosystem/InfoSystemWorker.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/Artist.h>
#else
#include <echonest/Artist.h>
#endif
#include <QObject>

View File

@@ -55,11 +55,6 @@
#include <QDBusPendingCallWatcher>
#include <QImage>
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
// QTextDocument provides Qt::escape()
#include <QTextDocument>
#endif
namespace Tomahawk
{
@@ -67,11 +62,7 @@ namespace InfoSystem
{
QString escapeHtml( const QString& str ) {
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
return str.toHtmlEscaped();
#else
return Qt::escape( str );
#endif
}
FdoNotifyPlugin::FdoNotifyPlugin()

View File

@@ -27,12 +27,6 @@
#include "../../InfoPluginDllMacro.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "PlaylistInterface.h"
#endif
#include <QObject>
#include <QVariant>
#include <QtDBus/QtDBus>

View File

@@ -30,11 +30,6 @@
#include <QCoreApplication>
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Query.h"
#endif
ActionCollection* ActionCollection::s_instance = 0;
ActionCollection* ActionCollection::instance()

View File

@@ -25,11 +25,6 @@
#include <QPixmap>
#include <QFuture>
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "collection/Collection.h"
#endif
#include "infosystem/InfoSystem.h"
#include "DllMacro.h"
#include "Typedefs.h"

View File

@@ -34,13 +34,8 @@
#include "TomahawkSettings.h"
#include "Track.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/CatalogUpdateEntry.h>
#include <echonest5/Config.h>
#else
#include <echonest/CatalogUpdateEntry.h>
#include <echonest/Config.h>
#endif
using namespace Tomahawk;

View File

@@ -22,11 +22,7 @@
#include "DllMacro.h"
#include "Query.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/Catalog.h>
#else
#include <echonest/Catalog.h>
#endif
#include <QObject>
#include <QQueue>

View File

@@ -29,11 +29,6 @@
#include <QAction>
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Result.h"
#endif
using namespace Tomahawk;

View File

@@ -289,9 +289,4 @@ private:
Q_DECLARE_METATYPE( QSharedPointer< Tomahawk::Playlist > )
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
// Qt5 automatically generated this Metatype
Q_DECLARE_METATYPE( QList< QSharedPointer< Tomahawk::Query > > )
#endif
#endif // PLAYLIST_H

View File

@@ -1,13 +1,9 @@
#include <QtPlugin>
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
#if defined(Q_EXPORT_PLUGIN)
#undef Q_EXPORT_PLUGIN
#undef Q_EXPORT_PLUGIN2
#endif
#define Q_EXPORT_PLUGIN(a)
#define Q_EXPORT_PLUGIN2(a, b)
#else
# define Q_PLUGIN_METADATA(a)
#if defined(Q_EXPORT_PLUGIN)
#undef Q_EXPORT_PLUGIN
#undef Q_EXPORT_PLUGIN2
#endif
#define Q_EXPORT_PLUGIN(a)
#define Q_EXPORT_PLUGIN2(a, b)

View File

@@ -34,14 +34,8 @@
#include "PlaylistInterface.h"
#include "Source.h"
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
#include <qtkeychain/keychain.h>
#include <QDesktopServices>
#else
#include <qt5keychain/keychain.h>
#include <QStandardPaths>
#endif
#include <qt5keychain/keychain.h>
#include <QStandardPaths>
#include <QDir>
using namespace Tomahawk;
@@ -733,11 +727,7 @@ TomahawkSettings::genericCacheVersion() const
QString
TomahawkSettings::storageCacheLocation() const
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
return QStandardPaths::writableLocation( QStandardPaths::CacheLocation );
#else
return QDesktopServices::storageLocation( QDesktopServices::CacheLocation );
#endif
}
@@ -746,11 +736,7 @@ TomahawkSettings::scannerPaths() const
{
QString musicLocation;
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
musicLocation = QStandardPaths::writableLocation( QStandardPaths::MusicLocation );
#else
musicLocation = QDesktopServices::storageLocation( QDesktopServices::MusicLocation );
#endif
return value( "scanner/paths", musicLocation ).toStringList();
}

View File

@@ -213,19 +213,11 @@ Track::init()
Q_D( Track );
updateSortNames();
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QObject::connect( d->trackData.data(), &TrackData::attributesLoaded, this, &Track::attributesLoaded );
QObject::connect( d->trackData.data(), &TrackData::socialActionsLoaded, this, &Track::socialActionsLoaded );
QObject::connect( d->trackData.data(), &TrackData::statsLoaded, this, &Track::statsLoaded );
QObject::connect( d->trackData.data(), &TrackData::similarTracksLoaded, this, &Track::similarTracksLoaded );
QObject::connect( d->trackData.data(), &TrackData::lyricsLoaded, this, &Track::lyricsLoaded );
#else
connect( d->trackData.data(), SIGNAL( attributesLoaded() ), SIGNAL( attributesLoaded() ) );
connect( d->trackData.data(), SIGNAL( socialActionsLoaded() ), SIGNAL( socialActionsLoaded() ) );
connect( d->trackData.data(), SIGNAL( statsLoaded() ), SIGNAL( statsLoaded() ) );
connect( d->trackData.data(), SIGNAL( similarTracksLoaded() ), SIGNAL( similarTracksLoaded() ) );
connect( d->trackData.data(), SIGNAL( lyricsLoaded() ), SIGNAL( lyricsLoaded() ) );
#endif
}

View File

@@ -23,11 +23,7 @@
#ifdef Q_OS_MAC
#include "TomahawkSettings.h"
#else
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
#include <qtkeychain/keychain.h>
#else
#include <qt5keychain/keychain.h>
#endif
#include <qt5keychain/keychain.h>
#include "utils/Json.h"
#endif

View File

@@ -29,17 +29,10 @@
#include "utils/Closure.h"
#include "utils/NetworkAccessManager.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <lastfm5/ws.h>
#include <lastfm5/User.h>
#include <lastfm5/XmlQuery.h>
#include <lastfm5/Track.h>
#else
#include <lastfm/ws.h>
#include <lastfm/User.h>
#include <lastfm/XmlQuery.h>
#include <lastfm/Track.h>
#endif
using namespace Tomahawk::Accounts;

View File

@@ -34,13 +34,8 @@
#include "TomahawkSettings.h"
#include "utils/NetworkAccessManager.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <lastfm5/ws.h>
#include <lastfm5/XmlQuery.h>
#else
#include <lastfm/ws.h>
#include <lastfm/XmlQuery.h>
#endif
using namespace Tomahawk::Accounts;
using namespace Tomahawk::InfoSystem;

View File

@@ -24,15 +24,9 @@
#include "infosystem/InfoSystemWorker.h"
#include "DllMacro.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <lastfm5/Track.h>
#include <lastfm5/Audioscrobbler.h>
#include <lastfm5/ScrobblePoint.h>
#else
#include <lastfm/Track.h>
#include <lastfm/Audioscrobbler.h>
#include <lastfm/ScrobblePoint.h>
#endif
#include <QObject>

View File

@@ -164,7 +164,6 @@ AudioOutput::AudioOutput( QObject* parent )
setCurrentSource( new MediaStream( &m_silenceFile, true ) );
libvlc_media_player_play( m_vlcPlayer );
#if QT_VERSION >= QT_VERSION_CHECK(5,4,0)
// if the silence file did not play for 15 secs, we pretend the AudioOutput is initialized, to allow proper error reporting
QTimer::singleShot( 15000, [&]()
{
@@ -173,7 +172,6 @@ AudioOutput::AudioOutput( QObject* parent )
emit initialized();
}
} );
#endif
}

View File

@@ -43,11 +43,6 @@
#include "DatabaseCommand_SetCollectionAttributes.h"
#include "DatabaseCommand_SetTrackAttributes.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "collection/Collection.h"
#endif
#define DEFAULT_WORKER_THREADS 4
#define MAX_WORKER_THREADS 16

View File

@@ -25,11 +25,6 @@
#include "PlaylistEntry.h"
#include "SourceList.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "collection/Collection.h"
#endif
using namespace Tomahawk;

View File

@@ -24,10 +24,6 @@
#include <QSqlQuery>
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "collection/Collection.h"
#endif
using namespace Tomahawk;

View File

@@ -21,11 +21,6 @@
#include "Query.h"
#include "Track.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Source.h"
#endif
namespace Tomahawk
{

View File

@@ -87,9 +87,4 @@ private:
}
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
// Qt5 automatically generated this Metatype
Q_DECLARE_METATYPE(QList<QStringList>)
#endif
#endif // DATABASECOMMAND_GENERICSELECT_H

View File

@@ -21,11 +21,6 @@
#include "Query.h"
#include "Track.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Source.h"
#endif
namespace Tomahawk
{

View File

@@ -22,11 +22,6 @@
#include "DatabaseImpl.h"
#include "TomahawkSqlQuery.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Source.h"
#endif
namespace Tomahawk
{

View File

@@ -25,10 +25,6 @@
#include "PlaylistEntry.h"
#include "SourceList.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "collection/Collection.h"
#endif
using namespace Tomahawk;

View File

@@ -29,11 +29,6 @@
#include <QTimer>
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Source.h"
#endif
InboxJobItem::InboxJobItem( Side side,

View File

@@ -31,12 +31,6 @@
#include "Track.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "collection/Collection.h"
#endif
TransferStatusItem::TransferStatusItem( TransferStatusManager* p, StreamConnection* sc )
: m_parent( p )
, m_stream( QPointer< StreamConnection >( sc ) )

View File

@@ -23,10 +23,6 @@
#include "utils/Logger.h"
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Msg.h"
#endif
void
QTcpSocketExtra::connectToHost( const QHostAddress& host, quint16 port, OpenMode openMode )
{

View File

@@ -576,11 +576,7 @@ Servent::handleSipInfo( const Tomahawk::peerinfo_ptr& peerInfo )
void
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
Servent::incomingConnection( qintptr sd )
#else
Servent::incomingConnection( int sd )
#endif
{
Q_ASSERT( this->thread() == QThread::currentThread() );

View File

@@ -157,11 +157,7 @@ signals:
void ready();
protected:
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
void incomingConnection( qintptr sd ) Q_DECL_OVERRIDE;
#else
void incomingConnection( int sd ) Q_DECL_OVERRIDE;
#endif
public slots:
void setExternalAddress( QHostAddress ha, unsigned int port );

View File

@@ -40,11 +40,6 @@
#include "utils/TomahawkUtilsGui.h"
#include "utils/Logger.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "utils/PixmapDelegateFader.h"
#endif
using namespace Tomahawk;

View File

@@ -36,12 +36,6 @@
#include "utils/Logger.h"
#include "InboxModel.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "collection/Collection.h"
#include "utils/PixmapDelegateFader.h"
#endif
#include <QKeyEvent>
#include <QPainter>
#include <QScrollBar>

View File

@@ -35,13 +35,8 @@ ViewHeader::ViewHeader( QAbstractItemView* parent )
{
m_menu->setFont( TomahawkUtils::systemFont() );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
setSectionResizeMode( QHeaderView::Interactive );
setSectionsMovable( true );
#else
setResizeMode( QHeaderView::Interactive );
setMovable( true );
#endif
setMinimumSectionSize( 60 );
setDefaultAlignment( Qt::AlignLeft );
setStretchLastSection( true );

View File

@@ -24,11 +24,7 @@
#include <QTimer>
#include <QPointer>
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/Playlist.h>
#else
#include <echonest/Playlist.h>
#endif
namespace Tomahawk
{

View File

@@ -28,14 +28,8 @@
#include "DllMacro.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/Playlist.h>
#include <echonest5/Genre.h>
#else
#include <echonest/Playlist.h>
#include <echonest/Genre.h>
#endif
namespace Tomahawk
{

View File

@@ -24,11 +24,7 @@
#include "utils/TomahawkUtils.h"
#include "utils/Logger.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <echonest5/Playlist.h>
#else
#include <echonest/Playlist.h>
#endif
#include <QPaintEvent>
#include <QHBoxLayout>

View File

@@ -95,11 +95,9 @@ Tomahawk::ExternalResolverGui::setupClickHandlerOnUrlButtons( QObject* widget )
QPushButton* button = qobject_cast< QPushButton* >( widget );
Q_ASSERT( button );
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
connect( button, &QPushButton::clicked, [=]() {
QDesktopServices::openUrl( widget->property( "url" ).toUrl() );
});
#endif
}
// and recurse

View File

@@ -29,9 +29,7 @@ THE SOFTWARE.
#include <QVBoxLayout>
#include <QMacCocoaViewContainer>
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <qmacfunctions.h>
#endif
static inline NSString* fromQString(const QString &string)
{
@@ -49,11 +47,7 @@ static inline QString toQString(NSString *string)
static inline NSImage* fromQPixmap(const QPixmap &pixmap)
{
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
CGImageRef cgImage = pixmap.toMacCGImageRef();
#else
CGImageRef cgImage = QtMac::toCGImageRef(pixmap);
#endif
return [[[NSImage alloc] initWithCGImage:cgImage size:NSZeroSize] autorelease];
}

View File

@@ -192,11 +192,7 @@ void QSearchField::setMenu(QMenu *menu)
if (!pimpl)
return;
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
NSMenu *nsMenu = menu->macMenu();
#else
NSMenu *nsMenu = menu->toNSMenu();
#endif
[[pimpl->nsSearchField cell] setSearchMenuTemplate:nsMenu];
}

View File

@@ -36,11 +36,6 @@
#include <QNetworkAccessManager>
#include <QRegExp>
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Playlist.h"
#endif
using namespace Tomahawk;

View File

@@ -18,16 +18,9 @@
#include "Json.h"
// Qt version specific includes
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
#include <QJsonDocument>
#include <QMetaProperty>
#include <QVariantHash>
#else
#include <qjson/parser.h>
#include <qjson/qobjecthelper.h>
#include <qjson/serializer.h>
#endif
#include <QJsonDocument>
#include <QMetaProperty>
#include <QVariantHash>
namespace TomahawkUtils
{
@@ -35,7 +28,6 @@ namespace TomahawkUtils
QVariantMap
qobject2qvariant( const QObject* object )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QVariantMap map;
if ( object == NULL )
{
@@ -52,16 +44,12 @@ qobject2qvariant( const QObject* object )
}
}
return map;
#else
return QJson::QObjectHelper::qobject2qvariant( object );
#endif
}
void
qvariant2qobject( const QVariantMap& variant, QObject* object )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
for ( QVariantMap::const_iterator iter = variant.begin(); iter != variant.end(); ++iter )
{
QVariant property = object->property( iter.key().toLatin1() );
@@ -78,16 +66,12 @@ qvariant2qobject( const QVariantMap& variant, QObject* object )
}
}
}
#else
QJson::QObjectHelper::qvariant2qobject( variant, object );
#endif
}
QVariant
parseJson( const QByteArray& jsonData, bool* ok )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QJsonParseError error;
QJsonDocument doc = QJsonDocument::fromJson( jsonData, &error );
if ( ok != NULL )
@@ -95,17 +79,12 @@ parseJson( const QByteArray& jsonData, bool* ok )
*ok = ( error.error == QJsonParseError::NoError );
}
return doc.toVariant();
#else
QJson::Parser p;
return p.parse( jsonData, ok );
#endif
}
QByteArray
toJson( const QVariant &variant, bool* ok )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QVariant _variant = variant;
if ( variant.type() == QVariant::Hash )
{
@@ -127,10 +106,6 @@ toJson( const QVariant &variant, bool* ok )
*ok = !doc.isNull();
}
return doc.toJson( QJsonDocument::Compact );
#else
QJson::Serializer serializer;
return serializer.serialize( variant, ok );
#endif
}
}

View File

@@ -128,20 +128,12 @@ log( const char *msg, unsigned int debugLevel, bool toDisk = true )
void
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
TomahawkLogHandler( QtMsgType type, const QMessageLogContext& context, const QString& msg )
#else
TomahawkLogHandler( QtMsgType type, const char* msg )
#endif
{
static QMutex s_mutex;
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QByteArray ba = msg.toUtf8();
const char* message = ba.constData();
#else
const char* message = msg;
#endif
QMutexLocker locker( &s_mutex );
switch( type )
@@ -196,11 +188,7 @@ setupLogfile( QFile& f )
logStream.open( f.fileName().toStdString().c_str() );
#endif
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
qInstallMessageHandler( TomahawkLogHandler );
#else
qInstallMsgHandler( TomahawkLogHandler );
#endif
}
}

View File

@@ -69,8 +69,4 @@ private:
QUrl m_url;
};
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
Q_DECLARE_METATYPE( NetworkReply* )
#endif
#endif // NETWORKREPLY_H

View File

@@ -40,7 +40,6 @@ SharedTimeLine::SharedTimeLine()
void
SharedTimeLine::connectNotify( const QMetaMethod& signal )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
if ( signal == QMetaMethod::fromSignal( &SharedTimeLine::frameChanged ) )
{
m_refcount++;
@@ -49,10 +48,6 @@ SharedTimeLine::connectNotify( const QMetaMethod& signal )
m_timeline.start();
}
}
#else
Q_UNUSED( signal );
Q_ASSERT( false );
#endif
}
void
@@ -72,7 +67,6 @@ SharedTimeLine::connectNotify( const char* signal )
void
SharedTimeLine::disconnectNotify( const QMetaMethod& signal )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
if ( signal == QMetaMethod::fromSignal( &SharedTimeLine::frameChanged ) )
{
m_refcount--;
@@ -82,10 +76,6 @@ SharedTimeLine::disconnectNotify( const QMetaMethod& signal )
deleteLater();
}
}
#else
Q_UNUSED( signal );
Q_ASSERT( false );
#endif
}

View File

@@ -32,20 +32,11 @@
#include "Track.h"
#ifdef LIBLASTFM_FOUND
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <lastfm5/ws.h>
#else
#include <lastfm/ws.h>
#endif
#include <lastfm5/ws.h>
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <quazip5/quazip.h>
#include <quazip5/quazipfile.h>
#else
#include <quazip/quazip.h>
#include <quazip/quazipfile.h>
#endif
// We need this for the version info (if available)
#include <taglib/taglib.h>
@@ -62,10 +53,7 @@
#include <QStringList>
#include <QTranslator>
// Qt version specific includes
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
#include <QUrlQuery>
#endif
#include <QUrlQuery>
#ifdef Q_OS_WIN
#include <windows.h>
@@ -545,35 +533,7 @@ mergePlaylistChanges( const QList< Tomahawk::query_ptr >& orig, const QList< Tom
bool
removeDirectory( const QString& dir )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
return QDir( dir ).removeRecursively();
#else
const QDir aDir( dir );
tLog() << "Deleting DIR:" << dir;
bool has_err = false;
if ( aDir.exists() )
{
foreach ( const QFileInfo& entry, aDir.entryInfoList( QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::NoSymLinks ) )
{
QString path = entry.absoluteFilePath();
if ( entry.isDir() )
{
has_err = !removeDirectory( path ) || has_err;
}
else if ( !QFile::remove( path ) )
{
has_err = true;
}
}
if ( !aDir.rmdir( aDir.absolutePath() ) )
{
has_err = true;
}
}
return !has_err;
#endif
}
@@ -676,40 +636,32 @@ public:
{
};
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
QString translate( const char * context, const char * sourceText, const char * disambiguation = 0 ) const Q_DECL_OVERRIDE
QString translate( const char * context, const char * sourceText, const char * disambiguation = 0, int n = -1) const Q_DECL_OVERRIDE
{
QString translation = QTranslator::translate( context, sourceText, disambiguation );
#else
QString translate( const char * context, const char * sourceText, const char * disambiguation = 0, int n = -1) const Q_DECL_OVERRIDE
QString translation = QTranslator::translate( context, sourceText, disambiguation, n );
if( translation.isEmpty() )
{
QString translation = QTranslator::translate( context, sourceText, disambiguation, n );
#endif
if( translation.isEmpty() )
{
translation = QString::fromUtf8( sourceText );
}
// // lowercase all strings not on whats new page ...
// // TODO: rather scan disambiguation for nolowercase, but too lazy for that right now
// if( strcmp( context, "WhatsNewWidget_0_8" ) )
// {
// translation = translation.toLower();
// }
return translation.replace( "%applicationName", TOMAHAWK_APPLICATION_NAME, Qt::CaseInsensitive );
translation = QString::fromUtf8( sourceText );
}
// // lowercase all strings not on whats new page ...
// // TODO: rather scan disambiguation for nolowercase, but too lazy for that right now
// if( strcmp( context, "WhatsNewWidget_0_8" ) )
// {
// translation = translation.toLower();
// }
return translation.replace( "%applicationName", TOMAHAWK_APPLICATION_NAME, Qt::CaseInsensitive );
}
};
void
installTranslator( QObject* parent )
{
#if QT_VERSION >= 0x040800
QString locale = QLocale::system().uiLanguages().first().replace( "-", "_" );
#else
QString locale = QLocale::system().name();
#endif
if ( locale == "C" )
locale = "en";
@@ -970,57 +922,37 @@ compareVersionStrings( const QString& first, const QString& second )
void
urlAddQueryItem( QUrl& url, const QString& key, const QString& value )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QUrlQuery urlQuery( url );
urlQuery.addQueryItem( key, value );
url.setQuery( urlQuery );
#else
url.addQueryItem( key, value );
#endif
}
QString
urlQueryItemValue( const QUrl& url, const QString& key )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
return QUrlQuery( url ).queryItemValue( key ).replace( "+", " " );
#else
return url.queryItemValue( key ).replace( "+", " " );
#endif
}
bool
urlHasQueryItem( const QUrl& url, const QString& key )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
return QUrlQuery( url ).hasQueryItem( key );
#else
return url.hasQueryItem( key );
#endif
}
QList<QPair<QString, QString> >
urlQueryItems( const QUrl& url )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
return QUrlQuery( url ).queryItems();
#else
return url.queryItems();
#endif
}
void
urlSetQuery( QUrl& url, const QString& query )
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
url.setQuery( query );
#else
url.setEncodedQuery( query.toLocal8Bit() );
#endif
}
@@ -1046,11 +978,7 @@ QByteArray
encodedQuery( const QUrl& url )
{
QByteArray data;
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
data = url.query(QUrl::FullyEncoded).toUtf8();
#else
data = url.encodedQuery();
#endif
// QUrl doesn't encode : or ; which it should, as well as some other things, so be safer here in general.
data.replace( "'", "%27" );
data.replace( ".", "%2E" );

View File

@@ -40,16 +40,9 @@
#include <QStyleOption>
#include <QDesktopServices>
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
#include <QWindow>
#ifdef HAVE_X11
#include <QX11Info>
#endif
#else
#ifdef Q_WS_X11
#include <QX11Info>
#include <libqnetwm/netwm.h>
#endif
#include <QWindow>
#ifdef HAVE_X11
#include <QX11Info>
#endif
#ifdef Q_OS_WIN
@@ -324,34 +317,6 @@ bringToFront()
}
}
#else
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
{
QWidget* widget = tomahawkWindow();
if ( !widget )
return;
widget->show();
widget->activateWindow();
widget->raise();
WId wid = widget->winId();
NETWM::init();
XEvent e;
e.xclient.type = ClientMessage;
e.xclient.message_type = NETWM::NET_ACTIVE_WINDOW;
e.xclient.display = QX11Info::display();
e.xclient.window = wid;
e.xclient.format = 32;
e.xclient.data.l[0] = 2;
e.xclient.data.l[1] = QX11Info::appTime();
e.xclient.data.l[2] = 0;
e.xclient.data.l[3] = 0l;
e.xclient.data.l[4] = 0l;
XSendEvent( QX11Info::display(), RootWindow( QX11Info::display(), DefaultScreen( QX11Info::display() ) ), False, SubstructureRedirectMask | SubstructureNotifyMask, &e );
}
#else // Qt5
{
QWidget* widget = tomahawkWindow();
if ( !widget )
@@ -371,7 +336,6 @@ bringToFront()
#endif
}
#endif
#endif
}
#endif

View File

@@ -26,11 +26,6 @@
#include <QPainter>
#include <QPropertyAnimation>
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Source.h"
#endif
#define CORNER_ROUNDNESS 8.0
#define FADING_DURATION 500

View File

@@ -54,11 +54,7 @@ private:
*servent = new Servent();
QVERIFY( *servent != NULL );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
QHostAddress anyAddress = QHostAddress::Any;
#else
QHostAddress anyAddress = QHostAddress::AnyIPv6;
#endif
// TODO: Use a random free port for tests
// With (upnp == false) and (mode ==

View File

@@ -23,12 +23,7 @@
#include "Result.h"
#include "infosystem/InfoSystem.h"
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <lastfm5/ScrobblePoint.h>
#else
#include <lastfm/ScrobblePoint.h>
#endif
#include <QObject>
/**

View File

@@ -551,11 +551,7 @@ TomahawkApp::initServent()
const QString externalHostname = TomahawkSettings::instance()->externalHostname();
int externalPort = TomahawkSettings::instance()->externalPort();
bool autodetectIp = TomahawkSettings::instance()->autoDetectExternalIp();
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
if ( !Servent::instance()->startListening( QHostAddress::Any, upnp, port, mode, defaultPort, autodetectIp, externalHostname, externalPort ) )
#else
if ( !Servent::instance()->startListening( QHostAddress::AnyIPv6, upnp, port, mode, defaultPort, autodetectIp, externalHostname, externalPort ) )
#endif
{
tLog() << "Failed to start listening with servent";
exit( 1 );

View File

@@ -64,11 +64,7 @@ namespace Tomahawk
}
#ifdef LIBLASTFM_FOUND
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <lastfm5/NetworkAccessManager.h>
#else
#include <lastfm/NetworkAccessManager.h>
#endif
#include "Scrobbler.h"
#endif

View File

@@ -91,11 +91,7 @@
#if defined( Q_OS_WIN )
#if defined ( QTSPARKLE_FOUND )
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include <qtsparkle/Updater>
#else
#include <qtsparkle-qt5/Updater>
#endif
#include <qtsparkle-qt5/Updater>
#endif
#include <shellapi.h>
#endif

View File

@@ -45,10 +45,6 @@
#include "libcrashreporter-handler/Handler.h"
#endif
#if QT_VERSION < QT_VERSION_CHECK( 4, 8, 0 )
#include <X11/Xlib.h>
#endif
#include <exception>
#include <boost/filesystem/path.hpp>
@@ -178,11 +174,7 @@ main( int argc, char *argv[] )
#endif // Q_OS_MAC
#endif //Q_OS_WIN
#if QT_VERSION < QT_VERSION_CHECK( 4, 8, 0 )
XInitThreads();
#else
QCoreApplication::setAttribute( Qt::AA_X11InitThreads );
#endif
TomahawkApp a( argc, argv );

View File

@@ -138,11 +138,7 @@ SourceTreeView::SourceTreeView( QWidget* parent )
setModel( m_proxyModel );
header()->setStretchLastSection( false );
#if QT_VERSION >= QT_VERSION_CHECK( 5, 0, 0 )
header()->setSectionResizeMode( 0, QHeaderView::Stretch );
#else
header()->setResizeMode( 0, QHeaderView::Stretch );
#endif
connect( this, SIGNAL( expanded( QModelIndex ) ), SLOT( onItemExpanded( QModelIndex ) ) );
connect( selectionModel(), SIGNAL( selectionChanged( QItemSelection, QItemSelection ) ), SLOT( onSelectionChanged() ) );

View File

@@ -21,11 +21,6 @@
#include "audio/AudioEngine.h"
#include "utils/Logger.h"
// Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
#include "Query.h"
#endif
using namespace Tomahawk;

View File

@@ -97,8 +97,3 @@ int main( int argc, char* argv[] )
thread.wait();
}
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
Q_DECLARE_METATYPE( QList< Tomahawk::result_ptr > )
Q_DECLARE_METATYPE( Tomahawk::QID )
#endif

View File

@@ -76,7 +76,3 @@ int main( int argc, char* argv[] )
// Wait until the dbcmd was executed.
thread.wait();
}
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
Q_DECLARE_METATYPE( QList< Tomahawk::artist_ptr > )
#endif

View File

@@ -38,11 +38,7 @@
#include <QtDebug>
#include <qxtglobal.h>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
#define qxtcreate create
#else
#define qxtcreate construct
#endif
template <typename T>
class /*QXT_CORE_EXPORT*/ QxtMetaType

View File

@@ -52,9 +52,7 @@ QxtWeb uses QxtWebContent as an abstraction for streaming data.
#include <QCoreApplication>
#include <QThread>
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
#include <QUrlQuery>
#endif
#ifndef QXT_DOXYGEN_RUN
class QxtWebContentPrivate : public QxtPrivate<QxtWebContent>
@@ -273,11 +271,7 @@ typedef QPair<QString, QString> QxtQueryItem;
QHash<QString, QString> QxtWebContent::parseUrlEncodedQuery(const QString& data)
{
QHash<QString, QString> rv;
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
QUrl post("/?" + data);
#else
QUrlQuery post("/?" + data);
#endif
foreach(const QxtQueryItem& item, post.queryItems())
{
rv.insertMulti(item.first, item.second);