Skip to content

Commit 3e3624e

Browse files
author
carm
committed
handle presetSwitchFailedEvent in projectM-qt (then android later)
1 parent 04b7336 commit 3e3624e

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

src/projectM-qt/qprojectm.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class QProjectM : public QObject, public projectM {
3636
}
3737

3838
void presetSwitchFailedEvent(bool hardCut, unsigned int index, const std::string & message) const {
39-
presetSwitchFailedSignal(hardCut, index, message);
39+
presetSwitchFailedSignal(hardCut, index, QString(message.c_str()));
4040
}
4141

4242
void presetRatingChanged(unsigned int index, int rating,
@@ -46,7 +46,7 @@ class QProjectM : public QObject, public projectM {
4646

4747
signals:
4848
void presetSwitchedSignal(bool hardCut, unsigned int index) const;
49-
void presetSwitchFailedSignal(bool hardCut, unsigned int index, const std::string & message) const;
49+
void presetSwitchFailedSignal(bool hardCut, unsigned int index, const QString & message) const;
5050
void presetRatingChangedSignal(unsigned int index, int rating,
5151
PresetRatingType ratingType) const;
5252

src/projectM-qt/qprojectm_mainwindow.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ void QProjectM_MainWindow::postProjectM_Initialize()
310310

311311
connect ( m_QProjectMWidget->qprojectM(), SIGNAL ( presetSwitchedSignal ( bool,unsigned int ) ),
312312
this, SLOT ( updatePlaylistSelection ( bool,unsigned int ) ) );
313+
connect ( m_QProjectMWidget->qprojectM(), SIGNAL ( presetSwitchFailedSignal ( bool,unsigned int, const QString & ) ),
314+
this, SLOT ( handleFailedPresetSwitch( bool,unsigned int, const QString &) ) );
315+
313316

314317
connect ( m_QProjectMWidget->qprojectM(), SIGNAL ( presetRatingChangedSignal ( unsigned int,int, PresetRatingType) ),
315318
this, SLOT ( presetRatingChanged( unsigned int,int, PresetRatingType) ));
@@ -1299,3 +1302,13 @@ void QProjectM_MainWindow::presetRatingChanged( unsigned int index, int rating,
12991302
playlistModel->notifyDataChanged(index);
13001303
}
13011304

1305+
void QProjectM_MainWindow::handleFailedPresetSwitch(const bool isHardCut, const unsigned int index,
1306+
const QString & message) {
1307+
1308+
const QString status = QString("Error switch to preset index %1: %2")
1309+
.arg(index).arg(message);
1310+
1311+
statusBar()->showMessage ( tr (status.toStdString().c_str() ) );
1312+
1313+
}
1314+

src/projectM-qt/qprojectm_mainwindow.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ class QProjectM_MainWindow:public QMainWindow
116116
private slots:
117117
void dockLocationChanged(Qt::DockWidgetArea area);
118118
void presetRatingChanged(unsigned int, int, PresetRatingType);
119+
void handleFailedPresetSwitch(const bool isHardCut, const unsigned int index,
120+
const QString & message);
121+
119122
void presetHardCut();
120123
void presetSoftCut();
121124
void insertPresetsDialog() ;

0 commit comments

Comments
 (0)