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

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