-
Notifications
You must be signed in to change notification settings - Fork 225
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
Code: Add Qt6 compatibility #2299
Conversation
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.
Looking good so far. One small point. Maybe the conditional:
#if QT_VERSION >= 0x060000
should be changed to:
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
for consistency with the existing version checks?
@@ -62,19 +62,19 @@ CReaperItem::CReaperItem ( const QString& name, const STrackItem& trackItem, con | |||
|
|||
QTextStream sOut ( &out ); | |||
|
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.
All of the recorder files want to flush eash line.
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.
Hm, why would that be needed? Wouldn't it be just partial data anyway? I assumed it would be enough to ensure flushing after each "block". Such sOut.flush();
calls had been there anyway, see line 81, 107, 131 in this file.
If you really see a need to flush each individual line, what would be your preferred solution?
The ENDL
define I've mentioned? After discussion with @softins I've included the simpler approach (\n
) as it is more readable and does not seem to have any downsides in those specific cases.
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.
Actually, in that case, could we drop the ; sOut
from most of the lines and just have one big statement...
sOut << " <ITEM " << '\n'
<< " FADEIN 0 0 0 0 0 0" << '\n'
...
<< " >" << endl;
sOut.flush();
(I'd still prefer the double flush.)
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.
Actually, in that case, could we drop the ; sOut from most of the lines and just have one big statement...
Done (here and in line 118; the other places with 3 lines or less did not make sense, especially since clang-format
would start putting those into a single line then).
(I'd still prefer the double flush.)
Do you mean endl
? If so, why, is it any safer that way?
What should I do -- add a #define
as initially thought? It sounded overkill and looked not that readable to me.
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 was probably something I read on StackOverflow and may have been about Qt4 (as that's what we were targetting when this code was written). So it may not apply now. I think the concern was that sometimes there would be an intermediate buffer, so the first flush (endl) flushed to the file (which was buffered) and the second flush said "Oh, the first buffer is clean, I better flush the file buffer to disk". Or something.
It's fairly important to avoid missing the opportunity to save what's being written here -- the audio has been saved but the track timings relative to each other aren't easy to recover (but I've a script which helps).
@@ -70,7 +70,7 @@ void CServerLogging::operator<< ( const QString& sNewStr ) | |||
{ | |||
// append new line in logging file | |||
QTextStream out ( &File ); |
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.
The log file wants to flush on each write.
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.
I agree, I mis-interpreted File.flush()
which (probably?) only affects the underlying file, but not the QTextStream
. I've updated this part to call out.flush()
(but dropped the File.flush
as I understand it is redundant in that case).
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.
As noted above, I'd understood at some point that both were needed - the text stream was buffer and then the underlying file was separately buffered. The text stream flush gets to into the file but not necessarily to disk, which is why I think it was like this.
Again, as above, that might have been a Qt4 idiom that no longer applies - but it's worth checking if it's applicable in Qt5, at least, as we won't be moving to Qt6 for a long time, I expect.
This PR appears to mix up a number of different changes. Please split out those changes to the build scripts from changes to the source code. Note that most of the changes to the source for Qt6 that are wanted have been done -- most of those included here do not appear to be wanted. |
Thanks for your comments, @softins and @pljones.
That's certainly more readable and consistent. Updated, thanks!
What do you mean by split out exactly? I've already invested lots of time to split those changes by their intention and did make them separate commits with explanations why they are needed. Do you mean to split those commits even further? So yes, this PR does contain both changes to source code and build logic because its intention is to provide Qt6 compatibility. It tries hard not to change existing behavior though. That's what #2300 is about. It's also correct that this PR includes seemingly unrelated changes (refactorings), but I consider them a necessity. For example, the build script re-organization (especially on Windows) is necessary in order to allow building with two different Qt versions (while still keeping those two the same in this PR).
Not sure I follow. Do you suggest to drop specific changes from the PR, if so, which? In what way would they not be wanted? Edit: Maybe you are referring to small changes such as |
If these changes are all related to the same objective (which I think they are), I don't see any point in splitting them into separate PRs for the sake of it. That just makes unnecessary work, which would have the same end result once they had all been merged. It's not as if the changes in this PR are huge and very many. |
The point is to keep the opportunity for introducing problems as discrete as possible. If you're changing the build, then you know - by definition - any problems introduced into Jamulus's behaviour are because of changes to the build process, not the code. If you change both at the same time, you have more possible places a single problem could be introduced, making it harder to diagnose.
None of the recorder changes are "missing" because they're either in another PR already or not wanted, as far as I know.
|
I fully agree there, that's why I've split everything into manageable pieces.
Could you be more specific, please? Are you referring to #1999 (which was not ready for merge and was closed)? This PR is based on @dcorson-ticino-com's work in #1999. Are you referring to other PRs? If so, which? Or had you been planning to open those? |
What I could do is: Move the refactoring parts in a single refactoring PR (along with other autobuild refactorings I'm currently doing). Would that be better? |
That's what I'm suggesting, yes. Do not try to do everything at once. That's why I have a stack of PRs waiting. |
bd64b2a
to
16d8779
Compare
68ebd5f
to
4292008
Compare
Qt5 had a special qtmain library which took care of forwarding the MSVC default WinMain() entrypoint to the platform-agnostic main(). Qt6 is still supposed to have that lib under the new name QtEntryPoint. As it does not seem to be effective when building with qmake, we are rather instructing MSVC to use the platform-agnostic main() entrypoint directly. Without this change, building fails.
Jamulus uses the Qt5-internal enum values of Country codes within its protocol. Qt6 changed those assignments. This would lead to different behavior for users based on their Qt version. To avoid that, this commit adds a compatibility layer to translate Qt6 Country codes to their Qt5 equivalent and vice-versa. This affects the protocol traffic and any ini-stored country values for clients and servers. https://doc.qt.io/qt-5/qlocale.html#Country-enum https://doc.qt.io/qt-6/qlocale.html#Country-enum Co-authored-by: Tony Mountifield <[email protected]> Co-authored-by: Peter L Jones <[email protected]> Co-authored-by: DonC <[email protected]>
Required for Qt6 compatibility as they are no longer there.
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.
I've read through the diffs and checked the CI, so happy to approve.
I haven't been able to do any tests myself though.
Hmm. I'd be more happy if every platform is checked again before this is merged. @hoffie what would you think? |
The number of platform-specific changes is low, the most invasive one (Mac badge handling) has been tested. I'd say that the general nightly/beta phase is sufficient. |
@pljones I'm going to do some final tests here (Linux + Windows) and then merge this PR. You can of course do another after-merge review. |
Windows ASIO didn't show anything going obviously wrong. I just noticed - again - that the meter style is now round LEDs by default, I think. |
Ok. Did the merge now since no real end user visible changes came up. |
Compiled via Qt6.3 on Windows and the images look a bit lo-res. |
Do you want me to build it on ArchLinux with Qt 6.3? |
Not yet – unless you can verify that Qt6 doesn't introduce visible changes/bugs. |
Previously, country codes in --serverinfo were interpreted natively. This worked for Qt5, but caused unintended changes on Qt6 builds as the codes differ. Not doing a conversion for --serverinfo was an oversight from the initial Qt6 compatibility work, which is now fixed with this change. Related: jamulussoftware#2299 Fixes: jamulussoftware#2809
Previously, country codes in --serverinfo were interpreted natively. This worked for Qt5, but caused unintended changes on Qt6 builds as the codes differ. Not doing a conversion for --serverinfo was an oversight from the initial Qt6 compatibility work, which is now fixed with this change. Related: jamulussoftware#2299 Fixes: jamulussoftware#2809
Previously, country codes in --serverinfo were interpreted natively. This worked for Qt5, but caused unintended changes on Qt6 builds as the codes differ. Not doing a conversion for --serverinfo was an oversight from the initial Qt6 compatibility work, which is now fixed with this change. Related: jamulussoftware#2299 Fixes: jamulussoftware#2809
Previously, country codes in --serverinfo were interpreted natively. This worked for Qt5, but caused unintended changes on Qt6 builds as the codes differ. Not doing a conversion for --serverinfo was an oversight from the initial Qt6 compatibility work, which is now fixed with this change. Related: jamulussoftware#2299 Fixes: jamulussoftware#2809
Short description of changes
This PR adds the necessary changes to allow building with both Qt5 and Qt6 (Qt6 compatibility). It does not switch the autobuild targets (although it does contain changes/refactorings to make that switch simple).
The vast amount of development was done by @dcorson-ticino-com.
@softins had already helped with rebasing and his branch was of huge help to validate the changes in my branch.
I've tried to reflect those authorships in the commits, either as commit author or as Co-authored-by. If you're unhappy with any of this, please ping me and I'll adjust accordingly.
Two larger parts by @dcorson-ticino-com's tree are not part of mine, because I haven't found a reason to include that:
enum class ESvrRegStatus
change. For me, the existing code compiled properly for both Qt5 and Qt6, but maybe I'm missing something?Other than that, this PR differs in the following ways:
master
Context: Fixes an issue?
Does this change need documentation? What needs to be documented and how?
CHANGELOG: Build: Initial support for building with Qt6 has been implemented (@dcorson-ticino-com, @softins)
Status of this Pull Request
Ready, I'm not planning further changes right now.
What is missing until this pull request can be merged?
Testing. Most of the changes are build-related and either work (compile) or don't (CI failure). I'm pretty confident that this PR is pretty safe for Qt5 and is a huge improvement for Qt6 (from "doesn't compile" to "compiles and runs"). There might be some bugs in Qt6 builds for sure.
There's one thing that should get explicit testing: The commit
Mac: Use native Dock Badge handling
drops Qt's macextras usage in favor of a small native ObjC wrapper. Therefore:All in all, the full diff is delightfully small and I hope to get this merged soon after 3.8.2 is done.
Checklist