-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Use Qt's Resource System (2nd approach) #1891
Conversation
Support for generated .rc files was added in CMake v2.8.9 to the QT4_ADD_RESOURCES macro. In order to support older versions of CMake, this commit includes the source of the new macro from v2.8.9 and uses it if necessary.
I think this won't be a problem, since theme compatibility is broken anyways (you can't use 1.1 themes on 1.2). This is a very useful feature and should be documented though. So if I want to change the logo and/or the artwork of a plugin, I just add an png of the thing I want replaced? e.g. |
FTFY. |
Exactly.
Nope, that didn't work before. We didn't have any code capable of loading SVGs. It's now possible by using |
@softrabbit Nevertheless, I'd be interested to know what you're referring to. Maybe I'm just missing something. :) |
This: #887 (OK, the explicit looping through possible file names was horrible, but I've loaded SVGs in LMMS for ages with that code...) I'm guessing
|
Ah thanks for the clarification. :) I didn't know |
* Fix lmms maine executable resources
@lukas-w shall we shelve this for after the 1.2 release, or work to integrate it prior? |
Seeing that 1.2 already has a lot of changes, it'd probably be wiser to merge this PR after 1.2. |
8c45c1f
to
4da73f3
Compare
Why not to remove the embedding altogether? Advantages:
|
Yeah, why not. When this PR is merged it's just a matter of removing the QRC logic and installing the resources via CMake instead. No need to touch any code IIRC. |
For |
What do you mean? An external image can be loaded portably. |
It can, but it shouldn't. If a developer were to make a new LMMS plugin and distribute the binary, he should not need to write special instructions for users to extract images e.g. |
Are users not used to run installers or install packages? Anyway, if both methods are kept, official plug-ins still benefit from:
|
Generally, no. Commercial plugins do this, but it is not common for community plugins and just adds unnecessary burden to the distributor. Good installers are a lot of work to get right cross-platform.
Sure, but if unofficial plugins eventually use our code for building, we should have embedding be the default behavior. #3204. https://github.com/PaulBatchelor/lmms-reverbsc is a good use-case for our discussion.
👍 |
Then let us use ZIP files for distribution, like the JAR, XPI, and OpenDocument cases. We can package Perl and Python plug-ins for LMMS, even multiple plug-ins sharing the artwork; just do not make the artwork to be part of the compilation. LMMS would be able to handle these ZIP files. The plug-in developer would run
Why that default? Third-party developers would also benefit from avoiding recompilation and providing separated packages, acting as a minidistro. Of course, if we give both options, it does not matter what the default is. |
When LMMS starts supporting non-compiled, scripted plugins, we can revisit this topic (assuming then the scripted plugins will adopt some common GUI framework). A gigantic part of our user base (> 1M downloads / year) is Windows and Windows doesn't yet ship with Perl or Python (Windows 10 may eventually change this).
Sure, but how about we start with project files first. :) |
We would not remove the embedding method until a better alternative is developed.
What are the good points for embedding in official binaries? My suggestion is to keep both options, to embed or not to embed, which could be overridden per plug-in. If embedding is done, it should happen on install rather than on build. |
None. |
@lukas-w now that we have diverged |
Already at it right now 😉 |
# Conflicts: # cmake/modules/BuildPlugin.cmake # plugins/Amplifier/logo.png # plugins/BassBooster/logo.png # plugins/Delay/logo.png # plugins/Eq/CMakeLists.txt # plugins/Eq/EqEffect.cpp # plugins/Eq/logo.png # plugins/Flanger/CMakeLists.txt # plugins/Flanger/logo.png # plugins/LadspaEffect/CMakeLists.txt # plugins/LadspaEffect/logo.png # plugins/SpectrumAnalyzer/logo.png # plugins/VstEffect/CMakeLists.txt # plugins/VstEffect/logo.png # plugins/carlabase/CMakeLists.txt # plugins/dynamics_processor/logo.png # plugins/ladspa_browser/logo.png # plugins/lb303/CMakeLists.txt # plugins/lb303/lb303.cpp # plugins/opl2/CMakeLists.txt # plugins/papu/CMakeLists.txt # plugins/peak_controller_effect/logo.png # plugins/stereo_enhancer/logo.png # plugins/stereo_matrix/logo.png # plugins/vestige/CMakeLists.txt # plugins/waveshaper/logo.png # plugins/zynaddsubfx/CMakeLists.txt # src/CMakeLists.txt # src/gui/GuiApplication.cpp # src/gui/embed.cpp
Done. |
Thanks for testing.
That's just a mismatch between the directory names in So I guess this is good to merge? |
Thanks, that's good to know.
LGTM 👍 I can't comment on the code though, not quite versed in cmake. |
It's been two years and no one's complained about the code :) Merging |
* Remove bin2res, use Qt's resource system * Use QDir search paths and QImageReader in getIconPixmap * Don't include "embed.cpp" in plugins * getIconPixmap: Use QPixmapCache, use QPixmap::fromImageReader * Require CMake 2.8.9 * Fix ReverbSC embed usage
* Remove bin2res, use Qt's resource system * Use QDir search paths and QImageReader in getIconPixmap * Don't include "embed.cpp" in plugins * getIconPixmap: Use QPixmapCache, use QPixmap::fromImageReader * Require CMake 2.8.9 * Fix ReverbSC embed usage
* Remove bin2res, use Qt's resource system * Use QDir search paths and QImageReader in getIconPixmap * Don't include "embed.cpp" in plugins * getIconPixmap: Use QPixmapCache, use QPixmap::fromImageReader * Require CMake 2.8.9 * Fix ReverbSC embed usage
* Remove bin2res, use Qt's resource system * Use QDir search paths and QImageReader in getIconPixmap * Don't include "embed.cpp" in plugins * getIconPixmap: Use QPixmapCache, use QPixmap::fromImageReader * Require CMake 2.8.9 * Fix ReverbSC embed usage
* Remove bin2res, use Qt's resource system * Use QDir search paths and QImageReader in getIconPixmap * Don't include "embed.cpp" in plugins * getIconPixmap: Use QPixmapCache, use QPixmap::fromImageReader * Require CMake 2.8.9 * Fix ReverbSC embed usage
* Remove bin2res, use Qt's resource system * Use QDir search paths and QImageReader in getIconPixmap * Don't include "embed.cpp" in plugins * getIconPixmap: Use QPixmapCache, use QPixmap::fromImageReader * Require CMake 2.8.9 * Fix ReverbSC embed usage
* Remove bin2res, use Qt's resource system * Use QDir search paths and QImageReader in getIconPixmap * Don't include "embed.cpp" in plugins * getIconPixmap: Use QPixmapCache, use QPixmap::fromImageReader * Require CMake 2.8.9 * Fix ReverbSC embed usage
* Remove bin2res, use Qt's resource system * Use QDir search paths and QImageReader in getIconPixmap * Don't include "embed.cpp" in plugins * getIconPixmap: Use QPixmapCache, use QPixmap::fromImageReader * Require CMake 2.8.9 * Fix ReverbSC embed usage
* Remove bin2res, use Qt's resource system * Use QDir search paths and QImageReader in getIconPixmap * Don't include "embed.cpp" in plugins * getIconPixmap: Use QPixmapCache, use QPixmap::fromImageReader * Require CMake 2.8.9 * Fix ReverbSC embed usage
This PR does pretty much the same as #1742, but takes a less invasive approach, touching much less code. In contrast to my first approach,
embed::getIconPixmap
stays (I removed it and replaced all calls in #1742), but uses Qt's resource system andQDir
's search paths internally.Even though I didn't test it, it should now beIt's now possible to drop in SVGs instead of PNGs in themes without changing any code.It's already been possible to replace any plugin's artwork by adding a file called something like e.g.
monstro_logo.png
to the theme folder. LMMS will then use that one instead of the plugin's built-in file. This PR changes this tomonstro/logo.png
instead (subdirectory vs underscore), just for the sake of easy implementation. I could not find any theme that replaces a plugin's artwork, so I hope this will have no impact on existing themes. Please let me know if I'm wrong and if there are such themes out there (on the LSP).