Skip to content

Commit

Permalink
Merge "Don't use deprecated Qt5 functions" (#5156)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukas-w committed Oct 31, 2019
2 parents 488c4ea + 400c8d8 commit b8e499d
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 44 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ matrix:
include:
- env: TYPE=style
- os: linux
- env: TARGET_OS=win32
- env: TARGET_OS=win64
- env: TARGET_OS=debian-sid TARGET_DEPLOY=True
git:
depth: false
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ CHECK_INCLUDE_FILES(locale.h LMMS_HAVE_LOCALE_H)

LIST(APPEND CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}")

FIND_PACKAGE(Qt5 COMPONENTS Core Gui Widgets Xml REQUIRED)
FIND_PACKAGE(Qt5 5.6.0 COMPONENTS Core Gui Widgets Xml REQUIRED)
FIND_PACKAGE(Qt5 COMPONENTS LinguistTools QUIET)

INCLUDE_DIRECTORIES(
Expand Down
1 change: 0 additions & 1 deletion include/PianoRoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ class QPixmap;
class QScrollBar;
class QString;
class QMenu;
class QSignalMapper;

class ComboBox;
class NotePlayHandle;
Expand Down
1 change: 0 additions & 1 deletion include/Track.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <QtCore/QVector>
#include <QtCore/QList>
#include <QWidget>
#include <QSignalMapper>
#include <QColor>
#include <QMimeData>

Expand Down
2 changes: 1 addition & 1 deletion src/gui/AutomationPatternView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ void AutomationPatternView::paintEvent( QPaintEvent * )
}

p.setRenderHints( QPainter::Antialiasing, false );
p.resetMatrix();
p.resetTransform();

// bar lines
const int lineSize = 3;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/dialogs/FileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ FileDialog::FileDialog( QWidget *parent, const QString &caption,
// Find downloads directory
QDir downloadDir( QDir::homePath() + "/Downloads" );
if ( ! downloadDir.exists() )
downloadDir = QStandardPaths::writableLocation( QStandardPaths::DownloadLocation );
downloadDir.setPath(QStandardPaths::writableLocation( QStandardPaths::DownloadLocation ));
if ( downloadDir.exists() )
urls << QUrl::fromLocalFile( downloadDir.absolutePath() );

Expand Down
29 changes: 7 additions & 22 deletions src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <QPointer>
#include <QScrollBar>
#include <QStyleOption>
#include <QSignalMapper>

#ifndef __USE_XOPEN
#define __USE_XOPEN
Expand Down Expand Up @@ -204,20 +203,15 @@ PianoRoll::PianoRoll() :
m_nemStr.push_back( tr( "Note Velocity" ) );
m_nemStr.push_back( tr( "Note Panning" ) );

QSignalMapper * signalMapper = new QSignalMapper( this );
m_noteEditMenu = new QMenu( this );
m_noteEditMenu->clear();
for( int i = 0; i < m_nemStr.size(); ++i )
{
QAction * act = new QAction( m_nemStr.at(i), this );
connect( act, SIGNAL(triggered()), signalMapper, SLOT(map()) );
signalMapper->setMapping( act, i );
connect( act, &QAction::triggered, [this, i](){ changeNoteEditMode(i); } );
m_noteEditMenu->addAction( act );
}
connect( signalMapper, SIGNAL(mapped(int)),
this, SLOT(changeNoteEditMode(int)) );

signalMapper = new QSignalMapper( this );
m_semiToneMarkerMenu = new QMenu( this );

QAction* markSemitoneAction = new QAction( tr("Mark/unmark current semitone"), this );
Expand All @@ -227,28 +221,19 @@ PianoRoll::PianoRoll() :
QAction* unmarkAllAction = new QAction( tr("Unmark all"), this );
QAction* copyAllNotesAction = new QAction( tr("Select all notes on this key"), this);

connect( markSemitoneAction, SIGNAL(triggered()), signalMapper, SLOT(map()) );
connect( markAllOctaveSemitonesAction, SIGNAL(triggered()), signalMapper, SLOT(map()) );
connect( markScaleAction, SIGNAL(triggered()), signalMapper, SLOT(map()) );
connect( markChordAction, SIGNAL(triggered()), signalMapper, SLOT(map()) );
connect( unmarkAllAction, SIGNAL(triggered()), signalMapper, SLOT(map()) );
connect( copyAllNotesAction, SIGNAL(triggered()), signalMapper, SLOT(map()) );

signalMapper->setMapping( markSemitoneAction, static_cast<int>( stmaMarkCurrentSemiTone ) );
signalMapper->setMapping( markAllOctaveSemitonesAction, static_cast<int>( stmaMarkAllOctaveSemiTones ) );
signalMapper->setMapping( markScaleAction, static_cast<int>( stmaMarkCurrentScale ) );
signalMapper->setMapping( markChordAction, static_cast<int>( stmaMarkCurrentChord ) );
signalMapper->setMapping( unmarkAllAction, static_cast<int>( stmaUnmarkAll ) );
signalMapper->setMapping( copyAllNotesAction, static_cast<int>( stmaCopyAllNotesOnKey ) );
connect( markSemitoneAction, &QAction::triggered, [this](){ markSemiTone(stmaMarkCurrentSemiTone); });
connect( markAllOctaveSemitonesAction, &QAction::triggered, [this](){ markSemiTone(stmaMarkAllOctaveSemiTones); });
connect( markScaleAction, &QAction::triggered, [this](){ markSemiTone(stmaMarkCurrentScale); });
connect( markChordAction, &QAction::triggered, [this](){ markSemiTone(stmaMarkCurrentChord); });
connect( unmarkAllAction, &QAction::triggered, [this](){ markSemiTone(stmaUnmarkAll); });
connect( copyAllNotesAction, &QAction::triggered, [this](){ markSemiTone(stmaCopyAllNotesOnKey); });

markScaleAction->setEnabled( false );
markChordAction->setEnabled( false );

connect( this, SIGNAL(semiToneMarkerMenuScaleSetEnabled(bool)), markScaleAction, SLOT(setEnabled(bool)) );
connect( this, SIGNAL(semiToneMarkerMenuChordSetEnabled(bool)), markChordAction, SLOT(setEnabled(bool)) );

connect( signalMapper, SIGNAL(mapped(int)), this, SLOT(markSemiTone(int)) );

m_semiToneMarkerMenu->addAction( markSemitoneAction );
m_semiToneMarkerMenu->addAction( markAllOctaveSemitonesAction );
m_semiToneMarkerMenu->addAction( markScaleAction );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/widgets/GroupBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void GroupBox::paintEvent( QPaintEvent * pe )
p.fillRect( 0, 0, width() - 1, height() - 1, p.background() );

// outer rect
p.setPen( p.background().color().dark( 150 ) );
p.setPen( p.background().color().darker( 150 ) );
p.drawRect( 0, 0, width() - 1, height() - 1 );

// draw line below titlebar
Expand Down
4 changes: 2 additions & 2 deletions src/tracks/BBTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ void BBTCOView::paintEvent( QPaintEvent * )
: ( m_bbTCO->m_useStyleColor ? painter.background().color()
: m_bbTCO->colorObj() ) );

lingrad.setColorAt( 0, c.light( 130 ) );
lingrad.setColorAt( 1, c.light( 70 ) );
lingrad.setColorAt( 0, c.lighter( 130 ) );
lingrad.setColorAt( 1, c.lighter( 70 ) );

// paint a black rectangle under the pattern to prevent glitches with transparent backgrounds
p.fillRect( rect(), QColor( 0, 0, 0 ) );
Expand Down
11 changes: 5 additions & 6 deletions src/tracks/InstrumentTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,7 @@ void InstrumentTrackView::muteChanged()



//FIXME: This is identical to SampleTrackView::createFxMenu
QMenu * InstrumentTrackView::createFxMenu(QString title, QString newFxLabel)
{
int channelIndex = model()->effectChannelModel()->value();
Expand All @@ -1253,8 +1254,6 @@ QMenu * InstrumentTrackView::createFxMenu(QString title, QString newFxLabel)

QMenu *fxMenu = new QMenu( title );

QSignalMapper * fxMenuSignalMapper = new QSignalMapper(fxMenu);

fxMenu->addAction( newFxLabel, this, SLOT( createFxLine() ) );
fxMenu->addSeparator();

Expand All @@ -1264,14 +1263,14 @@ QMenu * InstrumentTrackView::createFxMenu(QString title, QString newFxLabel)

if ( currentChannel != fxChannel )
{
auto index = currentChannel->m_channelIndex;
QString label = tr( "FX %1: %2" ).arg( currentChannel->m_channelIndex ).arg( currentChannel->m_name );
QAction * action = fxMenu->addAction( label, fxMenuSignalMapper, SLOT( map() ) );
fxMenuSignalMapper->setMapping(action, currentChannel->m_channelIndex);
fxMenu->addAction(label, [this, index](){
assignFxLine(index);
});
}
}

connect(fxMenuSignalMapper, SIGNAL(mapped(int)), this, SLOT(assignFxLine(int)));

return fxMenu;
}

Expand Down
11 changes: 5 additions & 6 deletions src/tracks/SampleTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -847,6 +847,7 @@ SampleTrackView::~SampleTrackView()



//FIXME: This is identical to InstrumentTrackView::createFxMenu
QMenu * SampleTrackView::createFxMenu(QString title, QString newFxLabel)
{
int channelIndex = model()->effectChannelModel()->value();
Expand All @@ -861,8 +862,6 @@ QMenu * SampleTrackView::createFxMenu(QString title, QString newFxLabel)

QMenu *fxMenu = new QMenu(title);

QSignalMapper * fxMenuSignalMapper = new QSignalMapper(fxMenu);

fxMenu->addAction(newFxLabel, this, SLOT(createFxLine()));
fxMenu->addSeparator();

Expand All @@ -872,14 +871,14 @@ QMenu * SampleTrackView::createFxMenu(QString title, QString newFxLabel)

if (currentChannel != fxChannel)
{
const auto index = currentChannel->m_channelIndex;
QString label = tr("FX %1: %2").arg(currentChannel->m_channelIndex).arg(currentChannel->m_name);
QAction * action = fxMenu->addAction(label, fxMenuSignalMapper, SLOT(map()));
fxMenuSignalMapper->setMapping(action, currentChannel->m_channelIndex);
fxMenu->addAction(label, [this, index](){
assignFxLine(index);
});
}
}

connect(fxMenuSignalMapper, SIGNAL(mapped(int)), this, SLOT(assignFxLine(int)));

return fxMenu;
}

Expand Down

0 comments on commit b8e499d

Please sign in to comment.