Skip to content

Commit 84e97a9

Browse files
Qt5
1 parent 6b37a0b commit 84e97a9

File tree

11 files changed

+48
-62
lines changed

11 files changed

+48
-62
lines changed

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.DS_Store
2+
CMakeCache.txt
3+
CMakeFiles/
4+
CMakeScripts/
5+
Debug/
6+
cmake_install.cmake
7+
pianobooster.build/
8+
pianobooster.xcodeproj/
9+
pianobooster_autogen/
10+
install_manifest.txt
Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
===============================================================================================
2-
TO COMPILE THE SOURCE CODE IN LINUX
3-
===============================================================================================
1+
# Linux
42

53
Ensure that the following packages 'cmake', 'libqt4-dev', 'libasound2-dev' and
64
'build-essential" are installed.
@@ -15,15 +13,21 @@
1513

1614
If you make changes to the source code then please post details on the forum.
1715

18-
===============================================================================================
19-
TO COMPILE THE SOURCE CODE IN MacOSX
20-
===============================================================================================
16+
# macOS
2117

22-
Install latest XCode (from Apple Developer Connection, free registration required)
18+
Install latest Xcode (from Apple Developer Connection, free registration required)
2319

24-
Install CMake and QT libraries (either from source or via Fink or MacPorts)
20+
Install CMake and QT libraries via Homebrew:
21+
22+
```
23+
$ brew install cmake qt5
24+
```
2525

26-
Generate XCode project file, via 'cmake -G Xcode ../src'
26+
Generate XCode project file via CMake:
27+
28+
```
29+
$ cmake -G Xcode . -DCMAKE_PREFIX_PATH=$(brew --prefix qt)`
30+
```
2731

2832
Open the project file in XCode, set whatever options you like (universal or single architecture,
2933
debug or release etc.) and compile
@@ -32,9 +36,7 @@
3236

3337
If you make changes to the source code then please post details on the forum.
3438

35-
===============================================================================================
36-
TO COMPILE THE SOURCE CODE IN WINDOWS
37-
===============================================================================================
39+
# Windows
3840

3941
To compile in Windows install the Open Source version of Qt and CMake and optionally Geany.
4042
When installing Qt select the option to download and install the MinGW compiler. Open the
@@ -49,16 +51,8 @@
4951

5052
If you make changes to the source code then please post details on the forum.
5153

52-
===============================================================================================
53-
LICENSE
54-
===============================================================================================
55-
56-
57-
In the PianoBooster directory type "cd release" to change to the "release" directory
5854

59-
===============================================================================================
60-
LICENSE
61-
===============================================================================================
55+
# License
6256

6357
Piano Booster is fully copyrighted by the author and all rights are reserved.
6458

PianoBooster/src/CMakeLists.txt

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,18 @@ PROJECT( pianobooster )
2828
# enable warnings
2929
ADD_DEFINITIONS(-Wall)
3030

31-
# by default only QtCore and QtGui modules are enabled
32-
# other modules must be enabled like this:
33-
SET(QT_USE_QTOPENGL TRUE)
34-
SET(QT_USE_QTXML TRUE)
35-
36-
3731
FIND_PACKAGE( OpenGL REQUIRED )
3832

39-
# this command finds Qt4 libraries and sets all required variables
40-
# note that it's Qt4, not QT4 or qt4
41-
FIND_PACKAGE( Qt4 REQUIRED )
42-
43-
# add some useful macros and variables
44-
# (QT_USE_FILE is a variable defined by FIND_PACKAGE( Qt4 ) that contains a path to CMake script)
45-
INCLUDE( ${QT_USE_FILE} )
33+
# Find the QtWidgets library
34+
find_package(Qt5Widgets)
35+
find_package(Qt5Xml)
36+
find_package(Qt5OpenGL)
4637

4738
IF (USE_PCH)
4839
INCLUDE(precompile/PCHSupport_26.cmake)
4940
INCLUDE_DIRECTORIES( precompile .)
5041
ENDIF(USE_PCH)
5142

52-
5343
# Add in the link libraries for each operating system
5444
IF(${CMAKE_SYSTEM} MATCHES "Linux")
5545
#FIND_PACKAGE(PkgConfig REQUIRED)
@@ -100,12 +90,6 @@ ENDIF(USE_FLUIDSYNTH)
10090
# (CMAKE_BINARY_DIR holds a path to the build directory, while INCLUDE_DIRECTORIES() works just like INCLUDEPATH from qmake)
10191
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ${OPENGL_INCLUDE_DIR} )
10292

103-
# tell CMake what libraries our executable needs,
104-
# luckily FIND_PACKAGE prepared QT_LIBRARIES variable for us:
105-
LINK_LIBRARIES( ${QT_LIBRARIES} )
106-
107-
108-
10993
SET(PB_BASE_SRCS MidiFile.cpp MidiTrack.cpp Song.cpp Conductor.cpp Util.cpp
11094
Chord.cpp Tempo.cpp MidiDevice.cpp MidiDeviceRt.cpp rtmidi/RtMidi.cpp ${PB_BASE_SRCS})
11195
SET(PB_BASE_HDR MidiFile.h MidiTrack.h Song.h Conductor.h Rating.h Util.h
@@ -175,16 +159,10 @@ SET( PIANOBOOSTER_RCS
175159
./application.qrc
176160
)
177161

178-
# this command will generate rules that will run rcc on all files from PIANOBOOSTER_RCS
179-
# in result PIANOBOOSTER_RC_SRCS variable will contain paths to files produced by rcc
180-
QT4_ADD_RESOURCES( PIANOBOOSTER_RC_SRCS ${PIANOBOOSTER_RCS} )
181-
182-
# this will run uic on .ui files:
183-
QT4_WRAP_UI( PIANOBOOSTER_UI_HDRS ${PIANOBOOSTER_UIS} )
184-
185-
# and finally this will run moc:
186-
QT4_WRAP_CPP( PIANOBOOSTER_MOC_SRCS ${PIANOBOOSTER_MOC_HDRS} )
187-
162+
set(CMAKE_AUTOMOC ON)
163+
set(CMAKE_AUTOUIC ON)
164+
set(CMAKE_AUTORCC ON)
165+
set(CMAKE_INCLUDE_CURRENT_DIR ON)
188166

189167
# here we instruct CMake to build "pianobooster" executable from all of the source files
190168
IF(APPLE)
@@ -211,6 +189,7 @@ IF (USE_PCH)
211189
ADD_PRECOMPILED_HEADER( pianobooster ${CMAKE_CURRENT_SOURCE_DIR}/precompile/precompile.h )
212190
ENDIF (USE_PCH)
213191

192+
target_link_libraries (pianobooster Qt5::Widgets Qt5::Xml Qt5::OpenGL)
214193

215194
INSTALL( FILES pianobooster.desktop DESTINATION share/applications )
216195
INSTALL(TARGETS pianobooster RUNTIME DESTINATION bin)

PianoBooster/src/GlView.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
/*********************************************************************************/
2828

2929
#include <QtGui>
30-
#include <QtOpenGL>
30+
#include <QtWidgets>
3131

3232
#include <math.h>
3333

PianoBooster/src/GlView.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
#define __GLVIEW_H__
3030
#include <QTime>
3131
#include <QBasicTimer>
32-
#include <QGLWidget>
32+
#include <QtWidgets>
33+
#include <QtOpenGL>
3334
#include "Song.h"
3435
#include "Score.h"
3536
#include "Settings.h"

PianoBooster/src/GuiKeyboardSetupDialog.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void GuiKeyboardSetupDialog::keyPressEvent ( QKeyEvent * event )
117117
if (event->isAutoRepeat() == true)
118118
return;
119119

120-
int c = event->text().toAscii().at(0);
120+
int c = event->text().toLatin1().at(0);
121121
m_song->pcKeyPress( c, true);
122122
}
123123

@@ -129,7 +129,7 @@ void GuiKeyboardSetupDialog::keyReleaseEvent ( QKeyEvent * event )
129129
if (event->text().length() == 0)
130130
return;
131131

132-
int c = event->text().toAscii().at(0);
132+
int c = event->text().toLatin1().at(0);
133133
m_song->pcKeyPress( c, false);
134134
}
135135

PianoBooster/src/GuiLoopingPopup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
2525
*/
2626

27-
#include <QtGui>
27+
#include <QtWidgets>
2828

2929
#include "GuiLoopingPopup.h"
3030
#include "GlView.h"

PianoBooster/src/GuiMidiSetupDialog.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ void GuiMidiSetupDialog::on_midiOutputCombo_activated (int index)
124124
void GuiMidiSetupDialog::on_latencyFixButton_clicked ( bool checked )
125125
{
126126
bool ok;
127-
int latencyFix = QInputDialog::getInteger(this, tr("Enter a value for the latency fix in milliseconds"),
127+
128+
int latencyFix = QInputDialog::getInt(this, tr("Enter a value for the latency fix in milliseconds"),
128129
tr(
129130
"The latency fix works by running the music ahead of what you<br>"
130131
"are playing to counteract the delay within the sound generator.<br><br>"

PianoBooster/src/QtWindow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ void QtWindow::keyPressEvent ( QKeyEvent * event )
694694
if (event->key() == Qt::Key_F1)
695695
return;
696696

697-
int c = event->text().toAscii().at(0);
697+
int c = event->text().toLatin1().at(0);
698698
m_song->pcKeyPress( c, true);
699699
}
700700

@@ -706,7 +706,7 @@ void QtWindow::keyReleaseEvent ( QKeyEvent * event )
706706
if (event->text().length() == 0)
707707
return;
708708

709-
int c = event->text().toAscii().at(0);
709+
int c = event->text().toLatin1().at(0);
710710
m_song->pcKeyPress( c, false);
711711
}
712712

PianoBooster/src/Settings.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
#define __SETTINGS_H__
2929

3030
#include <QSettings>
31-
#include <QDomDocument>
31+
#include <QtWidgets>
32+
#include <QtXml>
3233
#include "Song.h"
3334
#include "Notation.h"
3435

0 commit comments

Comments
 (0)