Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travis QT5 #2108

Merged
merged 2 commits into from
Jun 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ matrix:
include:
- env: TARGET_OS=win32
- env: TARGET_OS=win64
- env: QT5=True
- os: osx
before_install:
- sh ${TRAVIS_BUILD_DIR}/.travis/${TRAVIS_OS_NAME}.${TARGET_OS}.before_install.sh
Expand Down
4 changes: 4 additions & 0 deletions .travis/linux..before_install.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
sudo add-apt-repository ppa:kalakris/cmake -y;
if [ $QT5 ]
then
sudo add-apt-repository ppa:ubuntu-sdk-team/ppa -y
fi
sudo apt-get update -qq
17 changes: 13 additions & 4 deletions .travis/linux..install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
sudo apt-get install -y cmake libqt4-dev libsndfile-dev fftw3-dev libvorbis-dev \
libogg-dev libasound2-dev libjack-dev libsdl-dev libsamplerate0-dev \
libstk0-dev libfluidsynth-dev portaudio19-dev wine-dev g++-multilib \
libfltk1.3-dev libgig-dev
PACKAGES="cmake libsndfile-dev fftw3-dev libvorbis-dev libogg-dev
libasound2-dev libjack-dev libsdl-dev libsamplerate0-dev libstk0-dev
libfluidsynth-dev portaudio19-dev wine-dev g++-multilib libfltk1.3-dev
libgig-dev"

if [ $QT5 ]
then
PACKAGES="$PACKAGES qtbase5-dev"
else
PACKAGES="$PACKAGES libqt4-dev"
fi

sudo apt-get install -y $PACKAGES
2 changes: 1 addition & 1 deletion .travis/linux..script.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_WERROR=ON ..
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_WERROR=ON -DWANT_QT5=$QT5 ..
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ IF(WANT_QT5)
${Qt5Xml_INCLUDE_DIRS}
)

SET(QT_LIBRARIES
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::Xml
)

FIND_PACKAGE(Qt5Test)
SET(QT_QTTEST_LIBRARY Qt5::Test)
ELSE()
SET(QT5 FALSE)

Expand Down
25 changes: 25 additions & 0 deletions include/AtomicInt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/// \file AtomicInt.h
/// \brief Compatibility subclass of QAtomicInt for supporting both Qt4 and Qt5

#ifndef LMMS_ATOMIC_H
#define LMMS_ATOMIC_H

#include <QtCore/QAtomicInt>

#if QT_VERSION >= 0x050000 && QT_VERSION <= 0x050300

class AtomicInt : public QAtomicInt
{
public:
AtomicInt(int value=0) : QAtomicInt(value) {};

operator int() const {return loadAcquire();}
};

#else

typedef QAtomicInt AtomicInt;

#endif // QT_VERSION >= 0x050000 && QT_VERSION <= 0x050300

#endif
5 changes: 3 additions & 2 deletions include/BufferManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#ifndef BUFFER_MANAGER_H
#define BUFFER_MANAGER_H

#include "AtomicInt.h"
#include "export.h"
#include "lmms_basics.h"

Expand All @@ -45,10 +46,10 @@ class EXPORT BufferManager

private:
static sampleFrame ** s_available;
static QAtomicInt s_availableIndex;
static AtomicInt s_availableIndex;

static sampleFrame ** s_released;
static QAtomicInt s_releasedIndex;
static AtomicInt s_releasedIndex;
// static QReadWriteLock s_mutex;
static int s_size;
};
Expand Down
5 changes: 3 additions & 2 deletions include/MixerWorkerThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#ifndef MIXER_WORKER_THREAD_H
#define MIXER_WORKER_THREAD_H

#include <AtomicInt.h>
#include <QtCore/QAtomicPointer>
#include <QtCore/QThread>

Expand Down Expand Up @@ -63,8 +64,8 @@ class MixerWorkerThread : public QThread
private:
#define JOB_QUEUE_SIZE 1024
QAtomicPointer<ThreadableJob> m_items[JOB_QUEUE_SIZE];
QAtomicInt m_queueSize;
QAtomicInt m_itemsDone;
AtomicInt m_queueSize;
AtomicInt m_itemsDone;
OperationMode m_opMode;

} ;
Expand Down
3 changes: 2 additions & 1 deletion include/NotePlayHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#ifndef NOTE_PLAY_HANDLE_H
#define NOTE_PLAY_HANDLE_H

#include "AtomicInt.h"
#include "Note.h"
#include "PlayHandle.h"
#include "Track.h"
Expand Down Expand Up @@ -335,7 +336,7 @@ class NotePlayHandleManager
private:
static NotePlayHandle ** s_available;
static QReadWriteLock s_mutex;
static QAtomicInt s_availableIndex;
static AtomicInt s_availableIndex;
static int s_size;
};

Expand Down
4 changes: 2 additions & 2 deletions include/ThreadableJob.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#ifndef THREADABLE_JOB_H
#define THREADABLE_JOB_H

#include <QtCore/QAtomicInt>
#include "AtomicInt.h"

#include "lmms_basics.h"

Expand Down Expand Up @@ -82,7 +82,7 @@ class ThreadableJob
protected:
virtual void doProcessing() = 0;

QAtomicInt m_state;
AtomicInt m_state;

} ;

Expand Down
2 changes: 1 addition & 1 deletion plugins/GigPlayer/GigPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ void GigInstrumentView::showFileDialog()

QStringList types;
types << tr( "GIG Files (*.gig)" );
ofd.setFilters( types );
ofd.setNameFilters( types );

QString dir;
if( k->m_filename != "" )
Expand Down
4 changes: 4 additions & 0 deletions plugins/lb302/lb302.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,11 @@ int lb302Synth::process(sampleFrame *outbuf, const int size)
float samp;

// Hold on to the current VCF, and use it throughout this period
#if QT_VERSION >= 0x050000
lb302Filter *filter = vcf.loadAcquire();
#else
lb302Filter *filter = vcf;
#endif

if( release_frame == 0 || ! m_playingNote )
{
Expand Down
8 changes: 0 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,6 @@ TARGET_LINK_LIBRARIES(lmms
${LMMS_REQUIRED_LIBS}
)

IF(QT5)
TARGET_LINK_LIBRARIES(lmms
Qt5::Widgets
Qt5::Xml
)
ENDIF()


#
# rules for building localizations
#
Expand Down
4 changes: 2 additions & 2 deletions src/core/BufferManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
#include "MemoryManager.h"

sampleFrame ** BufferManager::s_available;
QAtomicInt BufferManager::s_availableIndex = 0;
AtomicInt BufferManager::s_availableIndex = 0;
sampleFrame ** BufferManager::s_released;
QAtomicInt BufferManager::s_releasedIndex = 0;
AtomicInt BufferManager::s_releasedIndex = 0;
//QReadWriteLock BufferManager::s_mutex;
int BufferManager::s_size;

Expand Down
6 changes: 3 additions & 3 deletions src/core/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "ConfigManager.h"
#include "MainWindow.h"
#include "ProjectVersion.h"
#include "GuiApplication.h"


static inline QString ensureTrailingSlash( const QString & _s )
Expand Down Expand Up @@ -340,7 +341,7 @@ void ConfigManager::loadConfigFile()
#endif
setBackgroundArtwork( value( "paths", "backgroundartwork" ) );
}
else if( QApplication::type() == QApplication::GuiClient )
else if( gui )
{
QMessageBox::warning( NULL, MainWindow::tr( "Configuration file" ),
MainWindow::tr( "Error while parsing configuration file at line %1:%2: %3" ).
Expand Down Expand Up @@ -401,8 +402,7 @@ void ConfigManager::loadConfigFile()
searchPaths << artworkDir() << defaultArtworkDir();
QDir::setSearchPaths( "resources", searchPaths);

if( !QDir( m_workingDir ).exists() &&
QApplication::type() == QApplication::GuiClient &&
if( !QDir( m_workingDir ).exists() && gui &&
QMessageBox::question( 0,
MainWindow::tr( "Working directory" ),
MainWindow::tr( "The LMMS working directory %1 does not "
Expand Down
2 changes: 1 addition & 1 deletion src/core/NotePlayHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ void NotePlayHandle::resize( const bpm_t _new_tempo )

NotePlayHandle ** NotePlayHandleManager::s_available;
QReadWriteLock NotePlayHandleManager::s_mutex;
QAtomicInt NotePlayHandleManager::s_availableIndex;
AtomicInt NotePlayHandleManager::s_availableIndex;
int NotePlayHandleManager::s_size;


Expand Down
2 changes: 1 addition & 1 deletion src/core/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QLibrary>
#include <QtGui/QMessageBox>
#include <QMessageBox>

#include "Plugin.h"
#include "embed.h"
Expand Down
1 change: 1 addition & 0 deletions src/core/base64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "base64.h"

#include <QBuffer>
#include <QDataStream>
#include <QVariant>

namespace base64
Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/FileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ FileDialog::FileDialog( QWidget *parent, const QString &caption,
const QString &directory, const QString &filter ) :
QFileDialog( parent, caption, directory, filter )
{
#if QT_VERSION >= 0x040806
#if (QT_VERSION >= 0x040806 && QT_VERSION < 0x050000) || QT_VERSION > 0x050200
setOption( QFileDialog::DontUseCustomDirectoryIcons );
#endif

Expand Down