Skip to content

Commit

Permalink
Added initial Qt5 support
Browse files Browse the repository at this point in the history
LMMS now properly builds and runs with Qt5. Various deprecated functions
had to be replaced like QString::toAscii()/fromAscii(). Also occurences
of FALSE/TRUE have been replaced with false/true.

LmmsStyle now derives from QProxyStyle and sets a style instance as base
style (Plastique for Qt4, Fusion for Qt5).

MOC files are not included anymore but added as regular source files.

What's missing is support for embedding VST plugins into a subwindow
inside LMMS on Linux/X11 due to missing QX11EmbedContainer class in Qt5.

Build instructions can be found in INSTALL.Qt5

Minimum version requirement for Qt4 has been raised to 4.6.0 for best
API compatibility between Qt4 and Qt5.
  • Loading branch information
tobydox committed Aug 14, 2014
1 parent dea2631 commit 4cee046
Show file tree
Hide file tree
Showing 284 changed files with 1,042 additions and 965 deletions.
30 changes: 26 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ OPTION(WANT_TAP "Include Tom's Audio Processing LADSPA plugins" ON)
OPTION(WANT_VST "Include VST support" ON)
OPTION(WANT_VST_NOWINE "Include partial VST support (without wine)" OFF)
OPTION(WANT_WINMM "Include WinMM MIDI support" OFF)
OPTION(WANT_QT5 "Build with Qt5" OFF)


IF(LMMS_BUILD_APPLE)
Expand Down Expand Up @@ -97,8 +98,20 @@ CHECK_INCLUDE_FILES(locale.h LMMS_HAVE_LOCALE_H)

LIST(APPEND CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}")

IF(WANT_QT5)
SET(QT5 TRUE)

FIND_PACKAGE(Qt5Core REQUIRED)
FIND_PACKAGE(Qt5Gui REQUIRED)
FIND_PACKAGE(Qt5Widgets REQUIRED)
FIND_PACKAGE(Qt5Xml REQUIRED)


ELSE()
SET(QT5 FALSE)

# check for Qt4
SET(QT_MIN_VERSION "4.3.0" COMPONENTS QtCore QtGui QtXml)
SET(QT_MIN_VERSION "4.6.0" COMPONENTS QtCore QtGui QtXml)
FIND_PACKAGE(Qt4 REQUIRED)
SET(QT_USE_QTXML 1)
EXEC_PROGRAM(${QT_QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_TRANSLATIONS" OUTPUT_VARIABLE QT_TRANSLATIONS_DIR)
Expand All @@ -113,6 +126,7 @@ IF(NOT WIN32)
STRING(REPLACE "-DQT_DLL" "" QT_DEFINITIONS "${QT_DEFINITIONS}")
ENDIF(NOT WIN32)
INCLUDE("${QT_USE_FILE}")
ENDIF()

# check for libsndfile
PKG_CHECK_MODULES(SNDFILE REQUIRED sndfile>=1.0.11)
Expand Down Expand Up @@ -357,9 +371,13 @@ ENDIF(GIT_FOUND)

SET(lmms_EMBEDDED_RESOURCES "${CMAKE_SOURCE_DIR}/AUTHORS" "${CMAKE_SOURCE_DIR}/COPYING" "${CONTRIBUTORS}")

IF(QT5)
QT5_WRAP_CPP(lmms_MOC_out ${lmms_MOC} OPTIONS -nw)
QT5_WRAP_UI(lmms_UI_out ${lmms_UI})
ELSE()
QT4_WRAP_CPP(lmms_MOC_out ${lmms_MOC} OPTIONS -nw)
QT4_WRAP_UI(lmms_UI_out ${lmms_UI})

ENDIF()

# embedded resources stuff
IF(WIN32 OR WIN64)
Expand All @@ -375,7 +393,7 @@ ENDIF(WIN32 OR WIN64)
SET(LMMS_ER_H "${CMAKE_CURRENT_BINARY_DIR}/embedded_resources.h")

# we somehow have to make LMMS-binary depend on MOC-files
ADD_FILE_DEPENDENCIES("${CMAKE_BINARY_DIR}/lmmsconfig.h" ${lmms_MOC_out})
ADD_FILE_DEPENDENCIES("${CMAKE_BINARY_DIR}/lmmsconfig.h")

ADD_CUSTOM_COMMAND(OUTPUT "${LMMS_ER_H}" COMMAND "${BIN2RES}" ARGS ${lmms_EMBEDDED_RESOURCES} > "\"${LMMS_ER_H}\"" DEPENDS "${BIN2RES}")

Expand Down Expand Up @@ -448,10 +466,14 @@ IF(NOT ("${OGGVORBIS_INCLUDE_DIR}" STREQUAL ""))
ENDIF()

ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_BINARY_DIR}/lmms.1.gz" COMMAND gzip -c "\"${CMAKE_SOURCE_DIR}/lmms.1\"" > "\"${CMAKE_BINARY_DIR}/lmms.1.gz\"" DEPENDS "${CMAKE_SOURCE_DIR}/lmms.1" COMMENT "Generating lmms.1.gz")
ADD_EXECUTABLE(lmms ${lmms_SOURCES} ${lmms_INCLUDES} "${LMMS_ER_H}" ${lmms_UI_out} lmmsconfig.h lmmsversion.h "${WINRC}" "${CMAKE_BINARY_DIR}/lmms.1.gz")
ADD_EXECUTABLE(lmms ${lmms_SOURCES} ${lmms_INCLUDES} ${lmms_MOC_out} "${LMMS_ER_H}" ${lmms_UI_out} lmmsconfig.h lmmsversion.h "${WINRC}" "${CMAKE_BINARY_DIR}/lmms.1.gz")

TARGET_LINK_LIBRARIES(lmms ${CMAKE_THREAD_LIBS_INIT} ${QT_LIBRARIES} ${ASOUND_LIBRARY} ${SDL_LIBRARY} ${PORTAUDIO_LIBRARIES} ${PULSEAUDIO_LIBRARIES} ${JACK_LIBRARIES} ${OGGVORBIS_LIBRARIES} ${SAMPLERATE_LIBRARIES} ${SNDFILE_LIBRARIES} ${EXTRA_LIBRARIES})

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

IF(LMMS_BUILD_WIN32)

SET_TARGET_PROPERTIES(lmms PROPERTIES LINK_FLAGS "${LINK_FLAGS} -mwindows")
Expand Down
12 changes: 12 additions & 0 deletions INSTALL.Qt5
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
First of all please note that CMake >= 2.8.11 is required for building with
Qt5 support. In order to build LMMS with Qt5, add the following flag when
invoking cmake:

-DWANT_QT5=ON

If your Qt5 installation does not reside in standard installation paths,
additionally pass e.g.

-DCMAKE_PREFIX_PATH=/opt/qt53/


14 changes: 12 additions & 2 deletions cmake/modules/BuildPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,16 @@ MACRO(BUILD_PLUGIN)
DEPENDS ${BIN2RES})
ENDIF(ER_LEN)

IF(QT5)
QT5_WRAP_CPP(plugin_MOC_out ${PLUGIN_MOCFILES})
QT5_WRAP_UI(plugin_UIC_out ${PLUGIN_UICFILES})
ELSE()
QT4_WRAP_CPP(plugin_MOC_out ${PLUGIN_MOCFILES})
QT4_WRAP_UI(plugin_UIC_out ${PLUGIN_UICFILES})
ENDIF()

FOREACH(f ${PLUGIN_SOURCES})
ADD_FILE_DEPENDENCIES(${f} ${ER_H} ${plugin_MOC_out} ${plugin_UIC_out})
ADD_FILE_DEPENDENCIES(${f} ${ER_H} ${plugin_UIC_out})
ENDFOREACH(f)

IF(LMMS_BUILD_APPLE)
Expand All @@ -82,7 +88,11 @@ MACRO(BUILD_PLUGIN)
LINK_LIBRARIES(-llmms ${QT_LIBRARIES})
ENDIF(LMMS_BUILD_WIN32)

ADD_LIBRARY(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES})
ADD_LIBRARY(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES} ${plugin_MOC_out})
IF(QT5)
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} Qt5::Widgets Qt5::Xml)
ENDIF()

INSTALL(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION "${PLUGIN_DIR}")

IF(LMMS_BUILD_APPLE)
Expand Down
2 changes: 1 addition & 1 deletion include/AudioDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class AudioDevice
public:
setupWidget( const QString & _caption, QWidget * _parent ) :
tabWidget( tabWidget::tr( "Settings for %1" ).arg(
tabWidget::tr( _caption.toAscii() ) ).
tabWidget::tr( _caption.toLatin1() ) ).
toUpper(), _parent )
{
}
Expand Down
2 changes: 1 addition & 1 deletion include/AutomatableModelView.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "AutomatableModel.h"

class QMenu;

class QMouseEvent;

class EXPORT AutomatableModelView : public ModelView
{
Expand Down
2 changes: 1 addition & 1 deletion include/AutomationEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define AUTOMATION_EDITOR_H

#include <QtCore/QMutex>
#include <QtGui/QWidget>
#include <QWidget>

#include "lmms_basics.h"
#include "JournallingObject.h"
Expand Down
2 changes: 1 addition & 1 deletion include/Clipboard.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define _CLIPBOARD_H

#include <QtCore/QMap>
#include <QtXml/QDomElement>
#include <QDomElement>


class JournallingObject;
Expand Down
6 changes: 3 additions & 3 deletions include/ControllerConnectionDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
#ifndef _CONTROLLER_CONNECTION_DIALOG_H
#define _CONTROLLER_CONNECTION_DIALOG_H

#include <QtGui/QDialog>
#include <QtGui/QSortFilterProxyModel>
#include <QtGui/QStandardItemModel>
#include <QDialog>
#include <QSortFilterProxyModel>
#include <QStandardItemModel>

#include "Controller.h"
#include "AutomatableModel.h"
Expand Down
2 changes: 1 addition & 1 deletion include/ControllerDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#ifndef _CONTROLLER_DIALOG_H
#define _CONTROLLER_DIALOG_H

#include <QtGui/QWidget>
#include <QWidget>

#include "ModelView.h"

Expand Down
2 changes: 1 addition & 1 deletion include/ControllerRackView.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#ifndef _CONTROLLER_RACK_VIEW_H
#define _CONTROLLER_RACK_VIEW_H

#include <QtGui/QWidget>
#include <QWidget>

#include "SerializingObject.h"
#include "lmms_basics.h"
Expand Down
2 changes: 1 addition & 1 deletion include/ControllerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#ifndef _CONTROLLER_VIEW_H
#define _CONTROLLER_VIEW_H

#include <QtGui/QWidget>
#include <QWidget>

#include "AutomatableModel.h"
#include "Controller.h"
Expand Down
2 changes: 1 addition & 1 deletion include/DataFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#ifndef DATA_FILE_H
#define DATA_FILE_H

#include <QtXml/QDomDocument>
#include <QDomDocument>
#include <QTextStream>

#include "export.h"
Expand Down
2 changes: 1 addition & 1 deletion include/EffectControlDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#ifndef _EFFECT_CONTROL_DIALOG_H
#define _EFFECT_CONTROL_DIALOG_H

#include <QtGui/QWidget>
#include <QWidget>

#include "ModelView.h"

Expand Down
2 changes: 1 addition & 1 deletion include/EffectRackView.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#ifndef _EFFECT_RACK_VIEW_H
#define _EFFECT_RACK_VIEW_H

#include <QtGui/QWidget>
#include <QWidget>

#include "EffectChain.h"
#include "ModelView.h"
Expand Down
6 changes: 3 additions & 3 deletions include/EffectSelectDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#ifndef _EFFECT_SELECT_DIALOG_H
#define _EFFECT_SELECT_DIALOG_H

#include <QtGui/QDialog>
#include <QtGui/QSortFilterProxyModel>
#include <QtGui/QStandardItemModel>
#include <QDialog>
#include <QSortFilterProxyModel>
#include <QStandardItemModel>

#include "EffectChain.h"
#include "Effect.h"
Expand Down
2 changes: 1 addition & 1 deletion include/EnvelopeAndLfoView.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#ifndef ENVELOPE_AND_LFO_VIEW_H
#define ENVELOPE_AND_LFO_VIEW_H

#include <QtGui/QWidget>
#include <QWidget>

#include "ModelView.h"

Expand Down
2 changes: 1 addition & 1 deletion include/FileDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#ifndef FILEDIALOG_H
#define FILEDIALOG_H

#include <QtGui/QFileDialog>
#include <QFileDialog>

#include "export.h"

Expand Down
8 changes: 4 additions & 4 deletions include/FxMixerView.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
#ifndef FX_MIXER_VIEW_H
#define FX_MIXER_VIEW_H

#include <QtGui/QWidget>
#include <QtGui/QHBoxLayout>
#include <QtGui/QStackedLayout>
#include <QtGui/QScrollArea>
#include <QWidget>
#include <QHBoxLayout>
#include <QStackedLayout>
#include <QScrollArea>

#include "FxLine.h"
#include "FxMixer.h"
Expand Down
2 changes: 1 addition & 1 deletion include/Instrument.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#ifndef INSTRUMENT_H
#define INSTRUMENT_H

#include <QtGui/QWidget>
#include <QWidget>

#include "Plugin.h"
#include "Mixer.h"
Expand Down
2 changes: 1 addition & 1 deletion include/InstrumentFunctionViews.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#include "ModelView.h"

#include <QtGui/QWidget>
#include <QWidget>

class QLabel;
class comboBox;
Expand Down
2 changes: 1 addition & 1 deletion include/InstrumentMidiIOView.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#ifndef INSTRUMENT_MIDI_IO_VIEW_H
#define INSTRUMENT_MIDI_IO_VIEW_H

#include <QtGui/QWidget>
#include <QWidget>

#include "ModelView.h"

Expand Down
2 changes: 1 addition & 1 deletion include/InstrumentSoundShapingView.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#ifndef _INSTRUMENT_SOUND_SHAPING_VIEW_H
#define _INSTRUMENT_SOUND_SHAPING_VIEW_H

#include <QtGui/QWidget>
#include <QWidget>

#include "InstrumentSoundShaping.h"
#include "ModelView.h"
Expand Down
2 changes: 1 addition & 1 deletion include/InstrumentView.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class EXPORT InstrumentView : public PluginView
return( castModel<Instrument>() );
}

virtual void setModel( Model * _model, bool = FALSE );
virtual void setModel( Model * _model, bool = false );

InstrumentTrackWindow * instrumentTrackWindow();

Expand Down
2 changes: 1 addition & 1 deletion include/LadspaControlView.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#ifndef _LADSPA_CONTROL_VIEW_H
#define _LADSPA_CONTROL_VIEW_H

#include <QtGui/QWidget>
#include <QWidget>

#include "ModelView.h"

Expand Down
2 changes: 1 addition & 1 deletion include/LcdWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#define _LCD_WIDGET_H

#include <QtCore/QMap>
#include <QtGui/QWidget>
#include <QWidget>

#include "export.h"

Expand Down
2 changes: 1 addition & 1 deletion include/LfoController.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#ifndef LFO_CONTROLLER_H
#define LFO_CONTROLLER_H

#include <QtGui/QWidget>
#include <QWidget>

#include "Model.h"
#include "AutomatableModel.h"
Expand Down
2 changes: 1 addition & 1 deletion include/LmmsPalette.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
*/

#include <QtGui/QWidget>
#include <QWidget>
#include "export.h"

#ifndef LMMSPALETTE_H
Expand Down
4 changes: 2 additions & 2 deletions include/LmmsStyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
#ifndef LMMS_STYLE_H
#define LMMS_STYLE_H

#include <QtGui/QPlastiqueStyle>
#include <QProxyStyle>



class LmmsStyle : public QPlastiqueStyle
class LmmsStyle : public QProxyStyle
{
public:
enum ColorRole
Expand Down
2 changes: 1 addition & 1 deletion include/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <QtCore/QBasicTimer>
#include <QtCore/QTimer>
#include <QtCore/QList>
#include <QtGui/QMainWindow>
#include <QMainWindow>

class QAction;
class QDomElement;
Expand Down
2 changes: 1 addition & 1 deletion include/MeterDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#ifndef _METER_DIALOG_H
#define _METER_DIALOG_H

#include <QtGui/QWidget>
#include <QWidget>

#include "ModelView.h"

Expand Down
2 changes: 1 addition & 1 deletion include/MidiClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class MidiClient
public:
setupWidget( const QString & _caption, QWidget * _parent ) :
tabWidget( tabWidget::tr( "Settings for %1" ).arg(
tr( _caption.toAscii() ) ).toUpper(),
tr( _caption.toLatin1() ) ).toUpper(),
_parent )
{
}
Expand Down
Loading

0 comments on commit 4cee046

Please sign in to comment.