-
-
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
Merged
Merged
Fix recent files #3872
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8eb1643
Fix templates and recent files on KDE.
BumblingCoder d72ac09
Fix the ability to build with qt4.
BumblingCoder 413ecd7
Fix & in recent files.
BumblingCoder 13214e0
Make the fix (probably) work on bsd.
BumblingCoder b39a908
Use QLibrary instead of calling dlopen
BumblingCoder b855413
Simplify name of loaded library.
BumblingCoder aed1920
Specify the version to make it work on ubuntu.
BumblingCoder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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", 5); | ||
| 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); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.