Mercurial > hg > sonic-visualiser
comparison main/MainWindow.cpp @ 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 | 6e3ef3aa341e |
children | b96492b41c74 |
comparison
equal
deleted
inserted
replaced
2148:e0093740b194 | 2149:c476db6cf3eb |
---|---|
1941 MainWindow::setupRecentFilesMenu() | 1941 MainWindow::setupRecentFilesMenu() |
1942 { | 1942 { |
1943 m_recentFilesMenu->clear(); | 1943 m_recentFilesMenu->clear(); |
1944 vector<QString> files = m_recentFiles.getRecent(); | 1944 vector<QString> files = m_recentFiles.getRecent(); |
1945 for (size_t i = 0; i < files.size(); ++i) { | 1945 for (size_t i = 0; i < files.size(); ++i) { |
1946 /* F. Nicol patch 13 Aug. 2016 */ | 1946 QString path = files[i]; |
1947 const QString& path = files[i]; | |
1948 QAction *action = new QAction(path, this); | 1947 QAction *action = new QAction(path, this); |
1949 connect(action, &QAction::triggered, [this, path] { openRecentFile(path);}); | 1948 action->setObjectName(path); |
1950 /* end of patch */ | 1949 connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile())); |
1951 if (i == 0) { | 1950 if (i == 0) { |
1952 action->setShortcut(tr("Ctrl+R")); | 1951 action->setShortcut(tr("Ctrl+R")); |
1953 m_keyReference->registerShortcut | 1952 m_keyReference->registerShortcut |
1954 (tr("Re-open"), | 1953 (tr("Re-open"), |
1955 action->shortcut().toString(), | 1954 action->shortcut().toString(), |
3395 tr("<b>Audio required</b><p>Unable to load layer data from \"%1\" without an audio file.<br>Please load at least one audio file before importing annotations.").arg(text)); | 3394 tr("<b>Audio required</b><p>Unable to load layer data from \"%1\" without an audio file.<br>Please load at least one audio file before importing annotations.").arg(text)); |
3396 } | 3395 } |
3397 } | 3396 } |
3398 | 3397 |
3399 void | 3398 void |
3400 MainWindow::openRecentFile(const QString& path) | 3399 MainWindow::openRecentFile() |
3401 { | 3400 { |
3402 /* F. Nicol patch 13 Aug. 2016 */ | |
3403 #if 0 | |
3404 QObject *obj = sender(); | 3401 QObject *obj = sender(); |
3405 QAction *action = dynamic_cast<QAction *>(obj); | 3402 QAction *action = dynamic_cast<QAction *>(obj); |
3406 | 3403 |
3407 if (!action) { | 3404 if (!action) { |
3408 cerr << "WARNING: MainWindow::openRecentFile: sender is not an action" | 3405 cerr << "WARNING: MainWindow::openRecentFile: sender is not an action" |
3409 << endl; | 3406 << endl; |
3410 return; | 3407 return; |
3411 } | 3408 } |
3412 | 3409 |
3413 QString path = action->text(); | 3410 QString path = action->objectName(); |
3414 #endif | 3411 |
3415 /* End of F. Nicol patch 13 Aug. 2016 */ | 3412 if (path == "") { |
3416 | 3413 cerr << "WARNING: MainWindow::openRecentFile: action incorrectly named" |
3417 if (path == "") return; | 3414 << endl; |
3415 return; | |
3416 } | |
3418 | 3417 |
3419 FileOpenStatus status = openPath(path, ReplaceSession); | 3418 FileOpenStatus status = openPath(path, ReplaceSession); |
3420 | 3419 |
3421 if (status == FileOpenFailed) { | 3420 if (status == FileOpenFailed) { |
3422 emit hideSplash(); | 3421 emit hideSplash(); |