-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
add support for qt6 qml resources #50
Conversation
AIIX
commented
Feb 7, 2023
- Add support for qt6 qml resources for the migration phase, this adds a check on returning the resource file based on the qt version targeted:
- An image / setup based on newer distributions shipping Qt version 6 can add the qt_version: 6 flag to the GUI config which will force all qml resources to load from the "ui6" folder instead of the currently spec'd "ui" folder which is used by Qt5
Codecov Report
@@ Coverage Diff @@
## dev #50 +/- ##
=====================================
Coverage ? 0.00%
=====================================
Files ? 30
Lines ? 2735
Branches ? 0
=====================================
Hits ? 0
Misses ? 2735
Partials ? 0 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
# TODO: Remove this when we drop Qt5 support | ||
if qt_version_target == 6: | ||
if "ui/" in str(file_path): | ||
file_path = Path(str(file_path).replace("ui/", "ui6/")) |
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.
this will messup some file names and paths, the check needs to be for full words, maybe something like if "ui" in file_path.split("/")
is enough
words = [w for w in file_path.split("/") if w != "ui" else "ui6"]
file_path = "/".join(words)
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.
this can not be done, i've seen skills that load stuff such as pictures from the ui folder, this will also mess their paths. at minimum this should have a check if file exists before changing the path, but this may still mess things up if there are duplicate files
@@ -268,6 +268,10 @@ def _read(self) -> str: | |||
class QmlFile(ResourceFile): | |||
def _locate(self): | |||
""" QML files are special because we do not want to walk the directory """ | |||
config = Configuration() | |||
enclosure_config = config.get("gui") or {} | |||
qt_version_target = enclosure_config.get("qt_version", 5) |
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.
can this be auto detected? if missing from config instead of assuming 5 we could do something to get a default value
I'd prefer for skills to indicate qt versions some other way instead of renaming this folder, can we just stick to the regular ui folder and add some new mechanism? with remote instances I also see skills potentially serving qml to several clients each on a different qt version, it seems to me the QT version should be session data per request, I will give this a think and come up with an alternate suggestion |
QML files serving QT5 and QT6 cannot live in the same folder, QML does not work like that, unless you want to follow the Mycroft Mark-2 example. |
Whatever mechanism the UI folder uses is defined by the QT Framework, including the selection of file selectors, One can either replace the skill UI files to support QT6 or one can stick to QT5, QML files import locally from each other, they cannot be mixed and matched between the different versions. |
My idea is that after X core version we declare we moved to QT6, somewhere around same time mycroft-gui and ovos-shell move the main branch, then the regular folder would be assumed to be QT6 But we want to keep QT5 support around for clients in server like use cases, so this has a few layers:
all gui clients should be compatible with this with no changes, but will need to start sending info about what qt version they require, if missing we maybe should assume qt5 for compat (all exisinting clients), then make all clients start requesting QT6 once they implement it. this is just an extra field in every bus emit and should not be hard to do I think can send PRs for all this over the next weeks |
What you are failing to understand is QT5 and QT6 files cannot live in the same folder a very simple example is: A skill has 2 QML imports from local UI folder (Homescreen has 10's): A QML file Import and how they work: A UI Folder consist of 2 imports and one main page TopBarView.qml MainPage.qml
QT5 Implementation of BottomBarView.qml which is imported and used as a component BottomBarView { } in an another QML File BottomBarView.qml under QT5
Now lets look at the Qt6 Version of that with all the Qt6 changes: BottomBarView.qml under QT6
Now say you want to import BottomBarView.qml since BottomBarView.QT5.qml and BottomBarView.QT6.qml are not valid components and nor are components being named BottomBarView_QT5 and BottomBarView_QT6, and MainPage.qml is does not know what is difference between BottomBarView.qml qt6 and BottomBarView.qml qt5 implementation it will import the local component as it is, so a MainPage.qml based on QT5 importing BottomBarView.qml based on Qt6 will not work This also now causes a larger headache that every skill out there will need to reimplement and rename files, using a folder approach makes the easier one can simply copy all the files from QT5 "UI" folder to QT6 "UI6" folder and only have to deal with internal QML changes than having to implement QT5 and QT6 in every file name and local import. |
i said
what you said excludes the naming convention, but thats an implementation details and everything else i said stands, you missed the main points being that:
|
|
this still needs to be done and all points i raised addressed, if you don't want to do it i'll take over the PR, reopening and will work directly in this branch |
This will not be supported at the Mycroft GUI protocol level, mixing and matching QT files and forcing stuff into sub folders inside UI folder will break bigscreen and QT file selectors mechanism. |
GUI protocol does not support this because it not a common practice neither in QT nor in KDE frameworks, it is implied that the version that QT based application / library is compiled against is the version for which the QML files it is expecting and that is decided by distributions on what version they package and they ship. |
so remote gui is not supported? can i remove the remote server url param that serves QML pages? doesnt the android app run gui natively and connect to a server? how does the server know if it should send qml for 5 or 6? does the server only support qt6 clients and old qt5 clients will all suddenly break? Do we now need to run "legacy servers" so old clients keep working? client are either qt5 or 6, but for all that core/workshop care they need to be able to serve both qt5 and qt6 files, otherwise you brick every single install out there using the remote setup, the server has no clue what clients were compiled against simple, just like in this PR MycroftAI/mycroft-gui#100 , you add to context the keys |
once this PR is merged workshop should be bumped 1 minor version existing qt5 skills before migrating to qt6 should make a final release specifying <= X.X.X workshop, this marks the point where after this skills should start providing QT6 under over time skills will start being QT6 only, but by then hopefully nearly all existing clients will also have updated to latest |
What does this have to even do with remote server ? The end application running and consuming the QML files is specifically built and compiled against a QT version
The Android application is compiled against a specific QT Version it does not randomly accept Qt5 / Qt6 QML files.
The server is hosted by the user using a docker image or setting it up themselves, there is no global hosting of the server currently except the test server Blue Systems uses. The user setting up the server is expected to install the correct versions of the skills and use the correct version of the android application.
The clients could have easily accepted the above solution I proposed of using "UI" and "UI6" but you rejected that and want to force everything into a single UI folder which does not work on technical grounds, causing even more breakage.
This does not mean that UI files can live in the same folder, and also I think you have this backwards it is not GUI that is requesting QML files to be sent to it so there is no flow of that context message ever happening, the skills and GUI interface in core send the data to GUI, the GUI protocol sends no request on its own to a running core "That i want so and so page", the only time GUI sends anything to core on its own without a skill gui interface is connection and disconnection requests. |
why are you still stuck on "same folder"? it was a question, after you explained i never brought it up again and only requested we move qt5 files instead of qt6 to a subfolder, thats a implementation detail and the thing im less interested in discussing or getting across, dont want both inside I just want this done with clean versioning and without bricking every device out there, please focus on the other points and let's have an actual discussion instead killing dev talk and closing the PR we can do this in a way that the server can be updated without updating all clients, and by clients here I mean the compiled mycroft-gui or shell or whatever, to illustrate what i mean better:
while bumping mycroft-gui you just need to add qt_version: 6 to the gui announced message, it's simple, then the server knows what subfolder to server to the clients, the server is only sending full qml file paths and picking the correct one, clients migrated to QT6 cleanly |
because you mentioned and quoted it again, at least how i read it.
I don't disagree with this approach if its being put in the root folder and not forcing it into "ui"
As the GUI maintainer I too want this done cleanly and in a logical way that is expected to work for every platform including distribution packaging, no one is killing the dev talk but forcing points is not constructive to dev talk specifically when someone is trying to explain why something cannot be done the way the points have forced it.
It has been implemented, the GUI message where the GUID is sent will send the major version as context message on connect https://github.com/MycroftAI/mycroft-gui/blob/4ace3675833298a496b8bdc1c3ddd1f5a22723d2/import/mycroftcontroller.cpp#L74 Note without testing this on Android I cannot confirm if it works there yet ^ but it works for me on Linux when testing against machine running QT5 and QT6 (in docker) |
is this one valid? MycroftAI/mycroft-gui#123 would like 1 final release in qt5 branch adding it, i added this also in the utterance message, this was just to make the info available to skills in intents if needed for some reason |
There is a better method for version-detection that comes from QT, I will port the Qt6 branch method to Qt5 current master branch, which will then be released before QT6 is merged in master, will add that to utterance as well. |