Remove Qt4 compatibility code

This commit is contained in:
Lukas W
2018-04-28 12:04:44 +02:00
parent a87aa7e356
commit da1c78ce86
20 changed files with 20 additions and 137 deletions

View File

@@ -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)
SET(LMMS_BUILD_MSYS 1)

View File

@@ -31,12 +31,10 @@
#ifdef LMMS_BUILD_WIN32
#include <windows.h>
#if QT_VERSION >= 0x050000
#include <QAbstractNativeEventFilter>
#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()
{

View File

@@ -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.

View File

@@ -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);

View File

@@ -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;

View File

@@ -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.

View File

@@ -35,17 +35,10 @@
#ifdef LMMS_BUILD_LINUX
# include <QX11Info>
# if QT_VERSION < 0x050000
# include <QX11EmbedContainer>
# else
# include "X11EmbedContainer.h"
# include <QWindow>
# endif
# include "X11EmbedContainer.h"
#endif
#if QT_VERSION >= 0x050000
# include <QWindow>
#endif
#include <QWindow>
#include <QDomDocument>

View File

@@ -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)

View File

@@ -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

View File

@@ -26,11 +26,7 @@
#include <QDir>
#include <QMessageBox>
#include <QApplication>
#if QT_VERSION >= 0x050000
#include <QStandardPaths>
#else
#include <QDesktopServices>
#endif
#include <QtCore/QTextStream>
#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<QGuiApplication*>(QApplication::instance())->
platformName() == "xcb")
#else
if (qgetenv("QT_QPA_PLATFORM").isNull()
|| qgetenv("QT_QPA_PLATFORM") == "xcb")
#endif
{
methods.append("xembed");
}

View File

@@ -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);

View File

@@ -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();

View File

@@ -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 & ) ) );

View File

@@ -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
}

View File

@@ -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

View File

@@ -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" ),

View File

@@ -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));

View File

@@ -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,

View File

@@ -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<QUrl> 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

View File

@@ -64,10 +64,6 @@
#include "TimeLineWidget.h"
#if QT_VERSION < 0x040800
#define MiddleButton MidButton
#endif
using std::move;
typedef AutomationPattern::timeMap timeMap;