-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix recent files #3872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix recent files #3872
Changes from 6 commits
8eb1643
d72ac09
413ecd7
13214e0
b39a908
b855413
aed1920
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,6 +33,7 @@ | |
| #include <QMenuBar> | ||
| #include <QMessageBox> | ||
| #include <QShortcut> | ||
| #include <QLibrary> | ||
| #include <QSplitter> | ||
| #include <QUrl> | ||
| #include <QWhatsThis> | ||
|
|
@@ -64,6 +65,21 @@ | |
|
|
||
| #include "lmmsversion.h" | ||
|
|
||
| #if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BULID_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) | ||
| { | ||
| using DisablerFunc = void(*)(QWidget*); | ||
| QLibrary kf5WidgetsAddon("KF5WidgetsAddons"); | ||
|
||
| DisablerFunc setNoAccelerators = | ||
| reinterpret_cast<DisablerFunc>(kf5WidgetsAddon.resolve("_ZN19KAcceleratorManager10setNoAccelEP7QWidget")); | ||
| if(setNoAccelerators) | ||
| { | ||
| setNoAccelerators(mainWindow); | ||
| } | ||
| kf5WidgetsAddon.unload(); | ||
| } | ||
| #endif | ||
|
|
||
|
|
||
| MainWindow::MainWindow() : | ||
|
|
@@ -76,6 +92,9 @@ MainWindow::MainWindow() : | |
| m_metronomeToggle( 0 ), | ||
| m_session( Normal ) | ||
| { | ||
| #if !defined(LMMS_BUILD_WIN32) && !defined(LMMS_BULID_APPLE) && !defined(LMMS_BUILD_HAIKU) | ||
| disableAutoKeyAccelerators(this); | ||
| #endif | ||
| setAttribute( Qt::WA_DeleteOnClose ); | ||
|
|
||
| QWidget * main_widget = new QWidget( this ); | ||
|
|
@@ -836,8 +855,8 @@ void MainWindow::createNewProjectFromTemplate( QAction * _idx ) | |
| ConfigManager::inst()->factoryTemplatesDir() : | ||
| ConfigManager::inst()->userTemplateDir(); | ||
|
|
||
| Engine::getSong()->createNewProjectFromTemplate( | ||
| dirBase + _idx->text() + ".mpt" ); | ||
| const QString f = dirBase + _idx->text().replace("&&", "&") + ".mpt"; | ||
| Engine::getSong()->createNewProjectFromTemplate(f); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -888,7 +907,7 @@ void MainWindow::updateRecentlyOpenedProjectsMenu() | |
| } | ||
|
|
||
| m_recentlyOpenedProjectsMenu->addAction( | ||
| embed::getIconPixmap( "project_file" ), *it ); | ||
| embed::getIconPixmap( "project_file" ), it->replace("&", "&&") ); | ||
| #ifdef LMMS_BUILD_APPLE | ||
| m_recentlyOpenedProjectsMenu->actions().last()->setIconVisibleInMenu(false); // QTBUG-44565 workaround | ||
| m_recentlyOpenedProjectsMenu->actions().last()->setIconVisibleInMenu(true); | ||
|
|
@@ -904,12 +923,11 @@ void MainWindow::updateRecentlyOpenedProjectsMenu() | |
|
|
||
|
|
||
|
|
||
|
|
||
| void MainWindow::openRecentlyOpenedProject( QAction * _action ) | ||
| { | ||
| if ( mayChangeProject(true) ) | ||
| { | ||
| const QString & f = _action->text(); | ||
| const QString f = _action->text().replace("&&", "&"); | ||
| setCursor( Qt::WaitCursor ); | ||
| Engine::getSong()->loadProject( f ); | ||
| setCursor( Qt::ArrowCursor ); | ||
|
|
@@ -1500,7 +1518,7 @@ void MainWindow::fillTemplatesMenu() | |
| { | ||
| m_templatesMenu->addAction( | ||
| embed::getIconPixmap( "project_file" ), | ||
| ( *it ).left( ( *it ).length() - 4 ) ); | ||
| ( *it ).left( ( *it ).length() - 4 ).replace("&", "&&") ); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should line |
||
| #ifdef LMMS_BUILD_APPLE | ||
| m_templatesMenu->actions().last()->setIconVisibleInMenu(false); // QTBUG-44565 workaround | ||
| m_templatesMenu->actions().last()->setIconVisibleInMenu(true); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this check still needed? Since @BumblingCoder switched the loader to
QLibrary, it can be removed safely. If there are some reason to keep this, however, leaving is okay, too.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be safe to run the code on all platforms. Pointless on the ones it is disabled on, but safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It saves a few cpu cycles to preprocess it out. I agree with the logic, especially when loading libraries. Why add an unnecessary step to MainWindow for systems which can't experience the bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay then. Keep it if leaving makes sense.