-
-
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
Remove some Qt from core #6426
Remove some Qt from core #6426
Conversation
* Move include/MemoryHelper.h and include/MemoryManager.h to include/core/ folder * change related #include's * Create include/core/common.h * defines UNUSED_ARG and LMMS_ASSERT which are copies of how Q_UNUSED and QT_ASSERT_X work * add lmms::lmms_warning() to replace qWarning()
🤖 Hey, I'm @LmmsBot from github.com/lmms/bot and I made downloads for this pull request, click me to make them magically appear! 🎩
Windows
🤖{"platform_name_to_artifacts": {"Windows": [{"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/j0u34c8h0nm8p2t4/artifacts/build/lmms-1.3.0-alpha-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/43842203"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/7lwf1urhdcoa07jn/artifacts/build/lmms-1.3.0-alpha-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/43842203"}]}, "commit_sha": "1a61bb9a471d143cb7a6b4180954616ea7b6ae75"} |
I personally think with the sheer number of changes to be made, the commits can be done in chunks, with each chunk signifying the part of the core where Qt was removed/reduced. This is subjective, ultimately. If you feel like having a commit for the removal of Qt per component in the core would be easier, then by all means.
I feel like if we are removing Qt from the core, there should be a full removal. It just makes more sense that way I suppose. Assume we wanted to work towards using a new frontend. A This is a developing topic after all, so I expect there to be solid decisons made in the future about this 😆.
In my opinion, yes. I see many benefits in the future for removing Qt from the core:
(I might've misunderstood that last point of yours. You were asking how this PR will be a beneficial route correct?) |
Yep, seeing if we agree this would be a good step forward.
Keep in mind a sweeping change like that would be a large PR, which would be difficult to test all facets of what changed. Smaller increments are easier to test and review. |
With that commit signifying the removal of Qt from
Scratch that. A more incremental approach can be done like this:
What I suppose I meant was that there would ultimately be a complete removal of Qt from the entire core at the final stage of this PR, with incremental changes along the way. |
In general:I am in favor for removing Qt from the core, especially because many Qt things are not realtime-safe, so it's a good preparation. E.g., due to the copy-on-write operations, even "One commit per removal/replacement/addition?"Here I'm for the usual approach that I apply for arbitrary commits: Try to make commits atomic, but don't force/overdo it. For example, if you do a bugfix and see 1 or 2 spelling errors in comments, you will usually put them into the bugfix. If you see 100 spelling errors (maybe always the same word?), put it in an extra commit (because otherwise, no one will see the bugfix among all the spelling fixes). In your example, at least one of the changes seems minor (moving files isn't that crucial), so I'm fine with combining it (as long as both is in the commit message, like in your case). "Are partial replacements okay?"Like usual, not perfect, some reviewers will ask about it, but acceptable. We usually want to reduce the number of commits on master. "Do we think this PR shows a route we actually want to go?"If we will finally have LMMS realtime safe or split into GUI/core, then warnings from core and from GUI have to call different functions. So it's reasonable to use different headers for this. Whether this should go into different subfolders below "include/" or not is IMO a more general question than removing Qt from the core. It's more a discussion like #6374. But as long as there is no discussion about whether splitting "include/"-files in general, I would (personally) not start creating a subfolder for one file, but rather use "core-common.h". |
To me our current "every header file in existence under |
Because much of Qt dates back to the time before good standard c++ functions, I think these kind of replacements could be done pretty easily and as a first step. QVector to std::vector etc... It would be great to be able to dive down in one single file and clean it of Qt, because it gives you an opportunity to wrap your head around that piece of code. But that file may be a dependency of 20 others, so that's virtually impossible without creating our own monkey patched drop in replacement for Qt... I think we might need to replace Qt one aspect at a time. The PRs will be more monotonic to review - for the better or worse. You'll get the hang of it quickly, but some things may slip through the cracks. Problem with this is we'll end up in a re-org situation again where any useful work is hindered by a thousand merge conflicts. For this reason please don't create too many commits if the change is the same. E.g. don't "remove QVector from Note.cpp"; "remove QVector from Track.cpp".... Because that makes rebasing terrible. (Well for your own sake maybe because when the PR is merged the commits may be squashed...) But I may be totally wrong on this point. And then at some point in time we'll need to replace the signal/slot system and event loop and that can't be down gradually. But that's for a late time. TL;DR I don't know what's best but let's do this. |
Replace QT function with standard C++ function across entire codebase "one by one" if C++ function is avalaible? I see Allejok write basically the same proposition. |
I agree, QVector might be a good first target.
Yeah, this PR I sort of went the route of a "single" (double in this case, plus one new) file. I wanted to find a very simple and small file that I could remove Qt from entirely or almost entirely. I saw MemoryManager and figured it would be a good case study.
We'd probably squash those into a single commit though. ;) And working on the core is a reorg but not part of the main reorg. It's unfortunately impossible to prevent rebases as we replace Qt with the STL. I want to do what's best for progress forward, and it's going to inevitably step on some toes along the way.
I don't even want to think about the signal slot system at this time. 😂 |
I don't worry much that this would be another reorg, because I wouldn't expect too many merge conflicts with existing PRs (but maybe I'm wrong). E.g. there are not that many |
This is main fear that I think is just inevitable at some point. The core as of right now is a mix of cables with Qt binding it together. The act of detangling specific cables, I believe, adheres to the expectation that other cables have to be moved around as well. Given this, my curiosity is how the new implementations will look like and how to rethink current functionality such as the signal & slot system and Simple aspects such as The only other route I can think of is, like allejok has already stated, removing Qt from the core by starting with the simplest aspects first, like |
There's the silliness of |
I have removed more The I think there needs to be more preliminary steps like a reformat and file reorg of the core though. This will make the task a lot easier and more efficient. |
fixup: QVector in RenderManager Remove QVector from AudioJack Remove QVector from AutomatableModel Remove QVector from ControllerConnection Remove QVector in EffectChain Remove QVector from EnvelopeAndLfoParameters Remove QVector from MidiClient Remove QVector from Mixer Remove QVector in Note Remove QVector in PeakController Remove QVector from PluginFactory Remove QVector from Track Remove QVector from TrackContainer Remove QVector from AutomationClip Remove QVector from Song Adapt non-core to QVector removal changes Adjust panning to use std::abs Without this, the code will not compile due to the QVector changes. Include <vector> for MidiClient Adapt QVector changes to PeakControllerEffect Fix std::vector insert in Song::automatedValuesAt Remove QVector from InstrumentFunctionNoteStacking::ChordTable * Use std::vector and do not inherit it * Make necessary adjustments to other parts of the codebase Apply formatting Use using instead of typedef where applicable Remove QVector from ConfigManager * Return empty QString instead of empty static QString& instead Include <vector> where applicable
Update: the extra part of this PR which is here but not in other qt removal PRs seems to be the qWarning s, which i believe too is simple. Not closing this PR for now, till we get that replaced too in another PR. Well, for discussion, we do have #6472 |
Closing. The PR was a valuable discussion about how we want to remove Qt from the core, however its conflicting with everything and most likely won't be merged. Any ideas here that we haven't yet applied should be done in a new PR. |
I am opening this to start conversation on what we want to do for our path to remove Qt from the core files (and if we agree, to merge it of course 😁).
So, I have a few questions for the group:
qWarnings
for instance, since my quick and dirtylmms_warning
function isn't a 1:1 drop-in replacement; and I only targeted files insrc/core
)include/core
folder similar to thesrc
folder nowcore/common.h
for common core functions, macros, etcOh, and to note: I did not update areas that are Mac or Windows in this.