Mercurial > hg > sonic-visualiser
changeset 2149:c476db6cf3eb
Seems to be some trouble with the function-pointer-based version of the connection here - recent-files menu isn't working on old systems with backward-compatible build - replace with an alternative mechanism again
author | Chris Cannam |
---|---|
date | Wed, 05 Dec 2018 11:35:20 +0000 |
parents | e0093740b194 |
children | acb68847a683 |
files | main/MainWindow.cpp main/MainWindow.h |
diffstat | 2 files changed, 13 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/main/MainWindow.cpp Wed Dec 05 11:34:35 2018 +0000 +++ b/main/MainWindow.cpp Wed Dec 05 11:35:20 2018 +0000 @@ -1943,11 +1943,10 @@ m_recentFilesMenu->clear(); vector<QString> files = m_recentFiles.getRecent(); for (size_t i = 0; i < files.size(); ++i) { - /* F. Nicol patch 13 Aug. 2016 */ - const QString& path = files[i]; + QString path = files[i]; QAction *action = new QAction(path, this); - connect(action, &QAction::triggered, [this, path] { openRecentFile(path);}); - /* end of patch */ + action->setObjectName(path); + connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile())); if (i == 0) { action->setShortcut(tr("Ctrl+R")); m_keyReference->registerShortcut @@ -3397,24 +3396,24 @@ } void -MainWindow::openRecentFile(const QString& path) +MainWindow::openRecentFile() { - /* F. Nicol patch 13 Aug. 2016 */ -#if 0 QObject *obj = sender(); QAction *action = dynamic_cast<QAction *>(obj); if (!action) { cerr << "WARNING: MainWindow::openRecentFile: sender is not an action" - << endl; + << endl; return; } - QString path = action->text(); -#endif - /* End of F. Nicol patch 13 Aug. 2016 */ - - if (path == "") return; + QString path = action->objectName(); + + if (path == "") { + cerr << "WARNING: MainWindow::openRecentFile: action incorrectly named" + << endl; + return; + } FileOpenStatus status = openPath(path, ReplaceSession);
--- a/main/MainWindow.h Wed Dec 05 11:34:35 2018 +0000 +++ b/main/MainWindow.h Wed Dec 05 11:35:20 2018 +0000 @@ -54,9 +54,7 @@ virtual void replaceMainAudio(); virtual void openSomething(); virtual void openLocation(); - /* F. Nicol patch 13 Aug. 2016 */ - virtual void openRecentFile(const QString& ); - /* End of F. Nicol patch 13 Aug. 2016 */ + virtual void openRecentFile(); virtual void applyTemplate(); virtual void exportAudio(); virtual void exportAudioData();