From da1c78ce8639874f9749035e17999857c2157207 Mon Sep 17 00:00:00 2001 From: Lukas W Date: Sat, 28 Apr 2018 12:04:44 +0200 Subject: [PATCH] Remove Qt4 compatibility code --- cmake/toolchains/common/MSYS.cmake | 16 +------------- include/MainApplication.h | 6 +----- plugins/GigPlayer/PatchesDialog.cpp | 4 ---- plugins/VstEffect/VstEffectControlDialog.cpp | 2 +- plugins/lb302/lb302.cpp | 12 ----------- plugins/sf2_player/patches_dialog.cpp | 4 ---- plugins/vst_base/VstPlugin.cpp | 11 ++-------- plugins/zynaddsubfx/CMakeLists.txt | 5 ----- src/CMakeLists.txt | 5 ----- src/core/ConfigManager.cpp | 13 ------------ src/core/main.cpp | 22 ++++++-------------- src/gui/EffectSelectDialog.cpp | 12 +++-------- src/gui/FileBrowser.cpp | 2 -- src/gui/LmmsStyle.cpp | 4 ---- src/gui/MainApplication.cpp | 4 +--- src/gui/MainWindow.cpp | 8 +++---- src/gui/SetupDialog.cpp | 4 ---- src/gui/TimeLineWidget.cpp | 5 ----- src/gui/dialogs/FileDialog.cpp | 14 +------------ src/gui/editors/PianoRoll.cpp | 4 ---- 20 files changed, 20 insertions(+), 137 deletions(-) diff --git a/cmake/toolchains/common/MSYS.cmake b/cmake/toolchains/common/MSYS.cmake index dc295d670..3a58bf8ff 100644 --- a/cmake/toolchains/common/MSYS.cmake +++ b/cmake/toolchains/common/MSYS.cmake @@ -20,18 +20,4 @@ ENDIF() SET(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES OFF) SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES OFF) -# Variable to assist override Qt debug libraries with release versions -SET(QT_OVERRIDE_LIBRARIES - optimized;${MINGW_PREFIX}/bin/QtGui4.dll; - optimized;${MINGW_PREFIX}/bin/QtCore4.dll; - optimized;${MINGW_PREFIX}/bin/QtXml4.dll; - debug;${MINGW_PREFIX}/bin/QtGui4.dll; - debug;${MINGW_PREFIX}/bin/QtCore4.dll; - debug;${MINGW_PREFIX}/bin/QtXml4.dll; -) -IF(LMMS_BUILD_MSYS AND CMAKE_BUILD_TYPE STREQUAL "Debug") - # Override Qt debug libraries with release versions - SET(QT_LIBRARIES "${QT_OVERRIDE_LIBRARIES}") -ENDIF() - -SET(LMMS_BUILD_MSYS 1) \ No newline at end of file +SET(LMMS_BUILD_MSYS 1) diff --git a/include/MainApplication.h b/include/MainApplication.h index d3acb95ca..bd1974a3a 100644 --- a/include/MainApplication.h +++ b/include/MainApplication.h @@ -31,12 +31,10 @@ #ifdef LMMS_BUILD_WIN32 #include -#if QT_VERSION >= 0x050000 #include #endif -#endif -#if defined(LMMS_BUILD_WIN32) && QT_VERSION >= 0x050000 +#if defined(LMMS_BUILD_WIN32) class MainApplication : public QApplication, public QAbstractNativeEventFilter #else class MainApplication : public QApplication @@ -47,10 +45,8 @@ public: bool event(QEvent* event); #ifdef LMMS_BUILD_WIN32 bool winEventFilter(MSG* msg, long* result); -#if QT_VERSION >= 0x050000 bool nativeEventFilter(const QByteArray& eventType, void* message, long* result); -#endif #endif inline QString& queuedFile() { diff --git a/plugins/GigPlayer/PatchesDialog.cpp b/plugins/GigPlayer/PatchesDialog.cpp index ac7c4d330..7be3bfd98 100644 --- a/plugins/GigPlayer/PatchesDialog.cpp +++ b/plugins/GigPlayer/PatchesDialog.cpp @@ -74,11 +74,7 @@ PatchesDialog::PatchesDialog( QWidget * pParent, Qt::WindowFlags wflags ) // Soundfonts list view... QHeaderView * pHeader = m_progListView->header(); pHeader->setDefaultAlignment( Qt::AlignLeft ); -#if QT_VERSION >= 0x050000 pHeader->setSectionsMovable( false ); -#else - pHeader->setMovable( false ); -#endif pHeader->setStretchLastSection( true ); m_progListView->resizeColumnToContents( 0 ); // Prog. diff --git a/plugins/VstEffect/VstEffectControlDialog.cpp b/plugins/VstEffect/VstEffectControlDialog.cpp index 797818979..3435cefb3 100644 --- a/plugins/VstEffect/VstEffectControlDialog.cpp +++ b/plugins/VstEffect/VstEffectControlDialog.cpp @@ -272,7 +272,7 @@ void VstEffectControlDialog::showEvent(QShowEvent *_se) VstEffectControlDialog::~VstEffectControlDialog() { -#if !(QT_VERSION < 0x050000 && defined(LMMS_BUILD_LINUX)) +#ifndef LMMS_BUILD_LINUX if (m_pluginWidget && layout()) { layout()->removeWidget(m_pluginWidget); m_pluginWidget->setParent(nullptr); diff --git a/plugins/lb302/lb302.cpp b/plugins/lb302/lb302.cpp index 66b77ac35..b0ea91776 100644 --- a/plugins/lb302/lb302.cpp +++ b/plugins/lb302/lb302.cpp @@ -434,11 +434,7 @@ QString lb302Synth::nodeName() const // OBSOLETE. Break apart once we get Q_OBJECT to work. >:[ void lb302Synth::recalcFilter() { -#if QT_VERSION >= 0x050000 vcf.load()->recalc(); -#else - vcf->recalc(); -#endif // THIS IS OLD 3pole/24dB code, I may reintegrate it. Don't need it // right now. Should be toggled by LB_24_RES_TRICK at the moment. @@ -464,11 +460,7 @@ 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 ) { @@ -692,11 +684,7 @@ void lb302Synth::initNote( lb302Note *n) if(n->dead ==0){ // Swap next two blocks?? -#if QT_VERSION >= 0x050000 vcf.load()->playNote(); -#else - vcf->playNote(); -#endif // Ensure envelope is recalculated vcf_envpos = ENVINC; diff --git a/plugins/sf2_player/patches_dialog.cpp b/plugins/sf2_player/patches_dialog.cpp index 6ae791c15..bb8801f49 100644 --- a/plugins/sf2_player/patches_dialog.cpp +++ b/plugins/sf2_player/patches_dialog.cpp @@ -75,11 +75,7 @@ patchesDialog::patchesDialog( QWidget *pParent, Qt::WindowFlags wflags ) // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setDefaultAlignment(Qt::AlignLeft); // pHeader->setDefaultSectionSize(200); -#if QT_VERSION >= 0x050000 pHeader->setSectionsMovable(false); -#else - pHeader->setMovable(false); -#endif pHeader->setStretchLastSection(true); m_progListView->resizeColumnToContents(0); // Prog. diff --git a/plugins/vst_base/VstPlugin.cpp b/plugins/vst_base/VstPlugin.cpp index 26c789275..792feef76 100644 --- a/plugins/vst_base/VstPlugin.cpp +++ b/plugins/vst_base/VstPlugin.cpp @@ -35,17 +35,10 @@ #ifdef LMMS_BUILD_LINUX # include -# if QT_VERSION < 0x050000 -# include -# else -# include "X11EmbedContainer.h" -# include -# endif +# include "X11EmbedContainer.h" #endif -#if QT_VERSION >= 0x050000 -# include -#endif +#include #include diff --git a/plugins/zynaddsubfx/CMakeLists.txt b/plugins/zynaddsubfx/CMakeLists.txt index ff9d7219d..bdc10bf32 100644 --- a/plugins/zynaddsubfx/CMakeLists.txt +++ b/plugins/zynaddsubfx/CMakeLists.txt @@ -122,11 +122,6 @@ ELSE() ENDIF() TARGET_LINK_LIBRARIES(ZynAddSubFxCore zynaddsubfx_nio ${FFTW3F_LIBRARIES} ${QT_LIBRARIES} -lz -lpthread) -# required libs for debug msys builds -IF(LMMS_BUILD_MSYS AND CMAKE_BUILD_TYPE STREQUAL "Debug") - TARGET_LINK_LIBRARIES(ZynAddSubFxCore QtCore4 QtGui4 QtXml4) -ENDIF() - TARGET_LINK_LIBRARIES(ZynAddSubFxCore Qt5::Widgets Qt5::Xml) IF(LMMS_BUILD_WIN32) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ff0ca8a8e..ca6f57cd4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -161,11 +161,6 @@ FOREACH(LIB ${LMMS_REQUIRED_LIBS}) ENDFOREACH() -# Required libs for debug msys builds -IF(LMMS_BUILD_MSYS AND CMAKE_BUILD_TYPE STREQUAL "Debug") - TARGET_LINK_LIBRARIES(lmms QtCore4 QtGui4 QtXml4) -ENDIF() - # Install IF(LMMS_BUILD_WIN32) SET_TARGET_PROPERTIES(lmms PROPERTIES diff --git a/src/core/ConfigManager.cpp b/src/core/ConfigManager.cpp index f52e10ac7..9d6781f7c 100644 --- a/src/core/ConfigManager.cpp +++ b/src/core/ConfigManager.cpp @@ -26,11 +26,7 @@ #include #include #include -#if QT_VERSION >= 0x050000 #include -#else -#include -#endif #include #include "ConfigManager.h" @@ -55,11 +51,7 @@ ConfigManager * ConfigManager::s_instanceOfMe = NULL; ConfigManager::ConfigManager() : m_lmmsRcFile( QDir::home().absolutePath() +"/.lmmsrc.xml" ), - #if QT_VERSION >= 0x050000 m_workingDir( QStandardPaths::writableLocation( QStandardPaths::DocumentsLocation ) + "/lmms/"), - #else - m_workingDir( QDesktopServices::storageLocation( QDesktopServices::DocumentsLocation ) + "/lmms/"), - #endif m_dataDir( "data:/" ), m_artworkDir( defaultArtworkDir() ), m_vstDir( m_workingDir + "vst/" ), @@ -210,13 +202,8 @@ QStringList ConfigManager::availabeVstEmbedMethods() methods.append("win32"); #endif #ifdef LMMS_BUILD_LINUX -#if QT_VERSION >= 0x050000 if (static_cast(QApplication::instance())-> platformName() == "xcb") -#else - if (qgetenv("QT_QPA_PLATFORM").isNull() - || qgetenv("QT_QPA_PLATFORM") == "xcb") -#endif { methods.append("xembed"); } diff --git a/src/core/main.cpp b/src/core/main.cpp index 078e9f26d..71440654e 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -818,22 +818,12 @@ int main( int argc, char * * argv ) QPushButton * discard; QPushButton * exit; - #if QT_VERSION >= 0x050000 - // setting all buttons to the same roles allows us - // to have a custom layout - discard = mb.addButton( MainWindow::tr( "Discard" ), - QMessageBox::AcceptRole ); - recover = mb.addButton( MainWindow::tr( "Recover" ), - QMessageBox::AcceptRole ); - - # else - // in qt4 the button order is reversed - recover = mb.addButton( MainWindow::tr( "Recover" ), - QMessageBox::AcceptRole ); - discard = mb.addButton( MainWindow::tr( "Discard" ), - QMessageBox::AcceptRole ); - - #endif + // setting all buttons to the same roles allows us + // to have a custom layout + discard = mb.addButton( MainWindow::tr( "Discard" ), + QMessageBox::AcceptRole ); + recover = mb.addButton( MainWindow::tr( "Recover" ), + QMessageBox::AcceptRole ); // have a hidden exit button exit = mb.addButton( "", QMessageBox::RejectRole); diff --git a/src/gui/EffectSelectDialog.cpp b/src/gui/EffectSelectDialog.cpp index deb39d901..64b180d48 100644 --- a/src/gui/EffectSelectDialog.cpp +++ b/src/gui/EffectSelectDialog.cpp @@ -120,21 +120,15 @@ EffectSelectDialog::EffectSelectDialog( QWidget * _parent ) : connect( ui->buttonBox, SIGNAL( accepted() ), this, SLOT( acceptSelection() ) ); -#if QT_VERSION >= 0x050000 -#define setResizeMode setSectionResizeMode ui->filterEdit->setClearButtonEnabled( true ); -#endif - ui->pluginList->verticalHeader()->setResizeMode( + ui->pluginList->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents ); ui->pluginList->verticalHeader()->hide(); - ui->pluginList->horizontalHeader()->setResizeMode( 0, + ui->pluginList->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch ); - ui->pluginList->horizontalHeader()->setResizeMode( 1, + ui->pluginList->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::ResizeToContents ); ui->pluginList->sortByColumn( 0, Qt::AscendingOrder ); -#if QT_VERSION >= 0x050000 -#undef setResizeMode -#endif updateSelection(); show(); diff --git a/src/gui/FileBrowser.cpp b/src/gui/FileBrowser.cpp index 91804d136..24b8b89f1 100644 --- a/src/gui/FileBrowser.cpp +++ b/src/gui/FileBrowser.cpp @@ -83,9 +83,7 @@ FileBrowser::FileBrowser(const QString & directories, const QString & filter, m_filterEdit = new QLineEdit( searchWidget ); m_filterEdit->setPlaceholderText( tr("Search") ); -#if QT_VERSION >= 0x050000 m_filterEdit->setClearButtonEnabled( true ); -#endif connect( m_filterEdit, SIGNAL( textEdited( const QString & ) ), this, SLOT( filterItems( const QString & ) ) ); diff --git a/src/gui/LmmsStyle.cpp b/src/gui/LmmsStyle.cpp index e57e29e47..b6a139bbb 100644 --- a/src/gui/LmmsStyle.cpp +++ b/src/gui/LmmsStyle.cpp @@ -132,11 +132,7 @@ LmmsStyle::LmmsStyle() : if( s_palette != NULL ) { qApp->setPalette( *s_palette ); } -#if QT_VERSION >= 0x050000 setBaseStyle( QStyleFactory::create( "Fusion" ) ); -#else - setBaseStyle( QStyleFactory::create( "Plastique" ) ); -#endif } diff --git a/src/gui/MainApplication.cpp b/src/gui/MainApplication.cpp index 5210dd76c..c88949d32 100644 --- a/src/gui/MainApplication.cpp +++ b/src/gui/MainApplication.cpp @@ -35,7 +35,7 @@ MainApplication::MainApplication(int& argc, char** argv) : QApplication(argc, argv), m_queuedFile() { -#if defined(LMMS_BUILD_WIN32) && QT_VERSION >= 0x050000 +#if defined(LMMS_BUILD_WIN32) installNativeEventFilter(this); #endif } @@ -92,7 +92,6 @@ bool MainApplication::winEventFilter(MSG* msg, long* result) } } -#if QT_VERSION >= 0x050000 bool MainApplication::nativeEventFilter(const QByteArray& eventType, void* message, long* result) { @@ -103,4 +102,3 @@ bool MainApplication::nativeEventFilter(const QByteArray& eventType, return false; } #endif -#endif diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 8f2fd4bad..a48a50044 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -69,7 +69,7 @@ #include "lmmsversion.h" -#if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BUILD_APPLE) && !defined(LMMS_BUILD_HAIKU) && QT_VERSION >= 0x050000 +#if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BUILD_APPLE) && !defined(LMMS_BUILD_HAIKU) //Work around an issue on KDE5 as per https://bugs.kde.org/show_bug.cgi?id=337491#c21 void disableAutoKeyAccelerators(QWidget* mainWindow) { @@ -96,7 +96,7 @@ MainWindow::MainWindow() : m_metronomeToggle( 0 ), m_session( Normal ) { -#if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BUILD_APPLE) && !defined(LMMS_BUILD_HAIKU) && QT_VERSION >= 0x050000 +#if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BUILD_APPLE) && !defined(LMMS_BUILD_HAIKU) disableAutoKeyAccelerators(this); #endif setAttribute( Qt::WA_DeleteOnClose ); @@ -336,7 +336,7 @@ void MainWindow::finalize() Qt::CTRL + Qt::Key_M ); // Prevent dangling separator at end of menu per https://bugreports.qt.io/browse/QTBUG-40071 -#if !(defined(LMMS_BUILD_APPLE) && (QT_VERSION >= 0x050000) && (QT_VERSION < 0x050600)) +#if !(defined(LMMS_BUILD_APPLE) && (QT_VERSION < 0x050600)) project_menu->addSeparator(); #endif project_menu->addAction( embed::getIconPixmap( "exit" ), tr( "&Quit" ), @@ -411,7 +411,7 @@ void MainWindow::finalize() } // Prevent dangling separator at end of menu per https://bugreports.qt.io/browse/QTBUG-40071 -#if !(defined(LMMS_BUILD_APPLE) && (QT_VERSION >= 0x050000) && (QT_VERSION < 0x050600)) +#if !(defined(LMMS_BUILD_APPLE) && (QT_VERSION < 0x050600)) help_menu->addSeparator(); #endif help_menu->addAction( embed::getIconPixmap( "icon" ), tr( "About" ), diff --git a/src/gui/SetupDialog.cpp b/src/gui/SetupDialog.cpp index 2f567a869..ad2ac9fb5 100644 --- a/src/gui/SetupDialog.cpp +++ b/src/gui/SetupDialog.cpp @@ -1053,11 +1053,7 @@ void SetupDialog::accept() QString::number( m_disableAutoQuit ) ); ConfigManager::inst()->setValue( "app", "language", m_lang ); ConfigManager::inst()->setValue( "ui", "vstembedmethod", -#if QT_VERSION >= 0x050000 m_vstEmbedComboBox->currentData().toString() ); -#else - m_vstEmbedComboBox->itemData(m_vstEmbedComboBox->currentIndex()).toString() ); -#endif ConfigManager::inst()->setWorkingDir(QDir::fromNativeSeparators(m_workingDir)); diff --git a/src/gui/TimeLineWidget.cpp b/src/gui/TimeLineWidget.cpp index 5c91cfcf8..71b384dc8 100644 --- a/src/gui/TimeLineWidget.cpp +++ b/src/gui/TimeLineWidget.cpp @@ -40,11 +40,6 @@ #include "SongEditor.h" -#if QT_VERSION < 0x040800 -#define MiddleButton MidButton -#endif - - QPixmap * TimeLineWidget::s_posMarkerPixmap = NULL; TimeLineWidget::TimeLineWidget( const int xoff, const int yoff, const float ppt, diff --git a/src/gui/dialogs/FileDialog.cpp b/src/gui/dialogs/FileDialog.cpp index fb9c7faac..3ce10760a 100644 --- a/src/gui/dialogs/FileDialog.cpp +++ b/src/gui/dialogs/FileDialog.cpp @@ -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 && QT_VERSION < 0x050000) || QT_VERSION > 0x050200 +#if QT_VERSION > 0x050200 setOption( QFileDialog::DontUseCustomDirectoryIcons ); #endif @@ -43,27 +43,15 @@ FileDialog::FileDialog( QWidget *parent, const QString &caption, // Add additional locations to the sidebar QList urls = sidebarUrls(); -#if QT_VERSION >= 0x050000 urls << QUrl::fromLocalFile( QStandardPaths::writableLocation( QStandardPaths::DesktopLocation ) ); -#else - urls << QUrl::fromLocalFile( QDesktopServices::storageLocation( QDesktopServices::DesktopLocation ) ); -#endif // Find downloads directory QDir downloadDir( QDir::homePath() + "/Downloads" ); if ( ! downloadDir.exists() ) -#if QT_VERSION >= 0x050000 downloadDir = QStandardPaths::writableLocation( QStandardPaths::DownloadLocation ); -#else - downloadDir = QDesktopServices::storageLocation( QDesktopServices::DocumentsLocation ) + "/Downloads"; -#endif if ( downloadDir.exists() ) urls << QUrl::fromLocalFile( downloadDir.absolutePath() ); -#if QT_VERSION >= 0x050000 urls << QUrl::fromLocalFile( QStandardPaths::writableLocation( QStandardPaths::MusicLocation ) ); -#else - urls << QUrl::fromLocalFile( QDesktopServices::storageLocation( QDesktopServices::MusicLocation ) ); -#endif urls << QUrl::fromLocalFile( ConfigManager::inst()->workingDir() ); // Add `/Volumes` directory on OS X systems, this allows the user to browse diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index ffcc10c1a..2960a31a3 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -64,10 +64,6 @@ #include "TimeLineWidget.h" -#if QT_VERSION < 0x040800 -#define MiddleButton MidButton -#endif - using std::move; typedef AutomationPattern::timeMap timeMap;