I Use This!
Activity Not Available

News

Analyzed 8 months ago. based on code collected almost 3 years ago.
Posted about 1 hour ago by Patrick Pereira (patrickelectric)
After working for some time collaborating with open source/free software projects, I started to help newcomers to contribute and push the development further with good practices. The following post will try to itemize some important tips that can be ... [More] used for software collaboration and personal projects. Code practices Encapsulate magic variables: ...// First version start_communication(0, 1, 232); // Reviewer: What is the meaning of 0 ? What is 1 ? Why 232 ? ...// Second version enum class Messages { ... RequestStatus = 232, } ... const uint8_t vid = 0; const uint8_t cid = 1; start_communication(vid, cid, Messages::RequestStatus); // Reviewer: What is vid ? What is cid ? ...//Final version ... const uint8_t vehicle_id = 0; const uint8_t component_id = 1; start_communication(vehicle_id, component_id, Messages::RequestStatus); As you can see, the final version makes everything more readable, we know that we are starting the communication with a vehicle that has an id of 0 and the vehicle probably contains a component with id 1, and while calling this function we are also requesting the status. Much better than 0, 1 and 232 right ? Doing this will help the reviewers and future developers to understand what is the meaning of such numbers. It's also necessary to avoid variables that contains only single letters or really short abbreviations, is much harder to understand this: $$C^2 = A^2 + B^2$$ over this: $$hypotenuse^2 = catheti_1^2 + catheti_2^2$$ Avoid multiple arguments: ...// First version auto vehicle = new Vehicle( VehicleType::Car, 4, {28, 31}, Fuel::Electric, 1.2, 613 ); // Reviewer: What is the meaning of all this values ? // How can we make it better ? ...// Second version auto vehicle = new Vehicle(VehicleType::Car) vehicle->setNumberOfTires(4); vehicle->setTirePressure({28, 31}); vehicle->setFuel(Fuel::Electric); vehicle->setWeightInTons(1.2); vehicle->setAutonomyInKm(613); ...// It's also possible to use aggregate initialization in C++20 // and user-defined literals from C++11 auto vehicle = new Vehicle({ .type = VehicleType::Car, .numberOfTires = 4, .tirePressure = {28_psi, 31_psi}, .fuel = Fuel::Electric, .weight = 1.2_tn, .autonomy = 613_km, }); Both second and C++20/C++11 alternatives are valid for a better readability of the code, to choose between both alternatives will depend of how are you going to design your API, probably if you are more familiar with the Qt API, the second version appears to be the most common, the C++20/C++11 alternative appears to be a bit more verbose but can be useful to avoid multiple function calls and helpful when dealing with a simpler code base. Encapsulate code when necessary, try to break functions in a more readable and explanatory way: ...// Original version void Serial::start_serial_communication() { // Check if we are open to talk if (!_port || _port->register() != 0xb0001) { log("Serial port is not open!"); return false; } // Send a 10ms serial break signal _port->set_break_enabled(true); msleep(10); _port->set_break_enabled(false); usleep(10); // Send intercalated binary for detection _port->write('U'); _port->flush(); // Send start AT command _port->write("AT+start"); } // Reviewer: Try to make it more readable encapsulating // some functionalities ...// Second version bool Serial::is_port_open() { return !_port || _port->register() != 0xb0001; } void Serial::force_baudrate_detection() { // Send a 10ms serial break signal _port->set_break_enabled(true); msleep(10); _port->set_break_enabled(false); usleep(10); // Send intercalated binary for detection _port->write('U'); _port->flush(); } void Serial::send_message(Message message_type) { _port->write(messageFromType(message_type)); } void Serial::start_serial_communication() { if (!is_port_open()) { log("Serial port is not open!"); return false; } force_baudrate_detection(); send_message(Message::Start) } As you can see, the reason behind each block of code is clear now, and with that, the comments are also not necessary anymore, the code is friendly and readable enough that's possible to understand it without any comments, the function name does the job for free. Avoid comments, that's a clickbait, comments are really necessary, but they may be unnecessary when you are doing something that's really obvious, and sometimes when something is not obvious, it's better to encapsulate it. ...// Original version void blink_routine() { // Use the LED builtin const int led_builtin = LED_BUILTIN; // Configure ping to output setPinAsOutput(led_builtin); // Loop forever while(true) { // Turn the LED on turnPinOn(led_builtin); // Wait for a second wait_seconds(1); // Turn the LED off turnPinOff(led_builtin); // Wait for a second wait_seconds(1); } } Before checking the final version, let me talk more about it: For each line of code you'll have a comment (like a parrot that repeat what we say), and the worst thing about these comments is that the content is exactly what you can read from the code! You can think that this kind of comment is dead code, something that has the same meaning as the code, but it does not run, resulting in a duplicated amount of lines to maintain. If you forget to update each comment for each line of code, you'll have a comment that does not match with the code, and this will be pretty confuse for someone that's reading it. One of the most important skills about writing comments, is to know when not to write it! A comment should bring a value to the code, if you can remove the comment and the code can be understandable by a newcomer, the comment is not important. ...// Final version void blink_routine() { const int led_builtin = LED_BUILTIN; setPinAsOutput(led_builtin); while(true) { turnPinOn(led_builtin); wait_seconds(1); turnPinOff(led_builtin); wait_seconds(1); } } There is a good video about this subject by Walter E. Brown in cppcon 2017, "Whitespace ≤ Comments << Code". And to finish, you should not avoid comments, you should understand when comments are necessary, like this: // From ArduPilot - GPIO_RPI void set_gpio_mode_alt(int pin, int alternative) { // **Moved content from cpp for this example** const uint8_t pins_per_register = 10; // Calculates the position of the 3 bit mask in the 32 bits register const uint8_t tree_bits_position_in_register = (pin%pins_per_register)*3; /** Creates a mask to enable the alternative function based in the following logic: * * | Alternative Function | 3 bits value | * |:--------------------:|:------------:| * | Function 0 | 0b100 | * | Function 1 | 0b101 | * | Function 2 | 0b110 | * | Function 3 | 0b111 | * | Function 4 | 0b011 | * | Function 5 | 0b010 | */ const uint8_t alternative_value = (alternative < 4 ? (alternative + 4) : (alternative == 4 ? 3 : 2)); // 0b00'000'000'000'000'000'000'ALT'000'000'000 enables alternative for the 4th pin const uint32_t mask_with_alt = static_cast(alternative_value) << tree_bits_position_in_register; const uint32_t mask = 0b111 << tree_bits_position_in_register; // Clear all bits in our position and apply our mask with alt values uint32_t register_value = _gpio[pin / pins_per_register]; register_value &= ~mask; _gpio[pin / pins_per_register] = register_value | mask_with_alt; } Mostly of the lines in this code can be impossible to understand without access or reading the datasheet directly, the comments are here to understand what is going on and why, otherwise anyone that'll touch this code will need to do a reverse engineer to understand it. Development flow Avoid creating multiple Pull Requests (PRs), update the ones that are still open. E.g: You created a Pull Request called "Add button feature", some modifications will be necessary after the review process, and for that you'll need to update the same branch over creating new ones. That's necessary to help the project maintainers to see previous comments and the development history. Creating multiple PRs will only make the maintainers confuse and unable to track old comments, suggestions and your code changes between PRs. Create atomic and self-contained commits, avoid doing multiple tasks in the same commit. E.g: You created a commit to fix the serial communication class, and inside the same commit you are doing 3 different tasks, removing trailing spaces, fixing a pointer validation check and a typo in the documentation of a different class. This appear to be silly and bureaucratic, but there are good reasons to break this simple commit and at least 3 different commits, one for the pointer check, a second one for the typo and a third one for the trailing space. Developers usually track lines history to understand the changes behind a functionality, it's common to search with grep history from commits or line changes in specific commits to understand the history of a library, function, class, or a small feature, if the commits start to be polluted with unnecessary changes, this development practice will be almost impossible to be done, since a bunch of unrelated lines will me changed between commits and this technic will be unable to help the dear developer. git blame will also be of little help. The example was also really simple, but you can imagine what happens if you change different parts of the code, for unrelated things, and a bug appears, technics such as git bisect will still work, but the result will be much harder to understand and to find which line is the one that created such bug. Create atomic and self-sustained PRs, avoid doing multiple things in the same PR, like different features. They may appear simple with small pieces of code/functionality but they can escalate quickly after a review process, and if both features are somehow related or dependently, it's recommended to break it in multiple PRs with code to maintain compatibility with current code base. E.g: You have applied a PR for software notifications, and somehow you also added a URL fetch functionality to grab new software versions from the server. After the first review, the maintainer asks to create a more abstracted way to fetch data from a REST API and to deal with network requirements, this will start to convolute the PR, moving the initial idea of the notification feature to an entire network REST API architecture. With that, it's better to break the PR in two, one that only provides the notification and a second PR that is used for the REST API related code. Do your own review, the final and probably most important tip of all, doing that will train your mind and eyes to detect poor code standards or bad practices, it'll also make your PR be merged easily and faster, since you'll be able to catch problems before the reviewer feedback. Some reviewers may think that reviewing your own PR is a must, since we are talking about open source projects and free software, you should understand that the people that are reviewing your code are not obligated to do so, the majority are collaborating and donating their own time to help the development and maintenance of such projects, doing your own review is a sign of empathy about the project and maintainer time. Final comment This is the first post of a series that I'm planning to do. Hope that some of these points may help you in your journey. References CppCon 2019: Kate Gregory “Naming is Hard: Let's Do Better” CppCon 2018: Kate Gregory “Simplicity: Not Just For Beginners” CppCon 2018: Kate Gregory “What Do We Mean When We Say Nothing At All?” CppCon 2017: Lars Knoll “Qt as a C++ Framework: History, Present State and Future” CppCon 2017: Kate Gregory “10 Core Guidelines You Need to Start Using Now” API Design Principles - TQtC Designing Qt-Style C++ APIs - Matthias Ettrich The Little Manual of API Design - Jasmin Blanchette [Less]
Posted about 4 hours ago by Nate Graham
This week we got tons and tons of stuff done, including window thumbnails on Wayland! This much-awaited feature brings our Wayland session ever closer to parity with the X11 session. But wait, there’s more: New Features Konsole now lets you ... [More] darken inactive terminals (Tomaz Canabrava, Konsole 20.12.0) Task Manager window thumbnails now work on Wayland! (Aleix Pol Gonzalez, Plasma 5.20) Discover can now be used to perform updates of content downloaded through the Get New Stuff dialogs (Dan Leinir Turthra Jensen, Plasma 5.20) Plasma applets now feature an “About” page in their settings windows (David Redondo, Plasma 5.20) Kate and other KTextEditor-based apps now show a zoom indicator in the status bar when the current zoom level is not 100% (Jan Paul Batrina, Frameworks 5.74) Bugfixes & Performance Improvements Opening an audio file from the filesystem in Elisa now works (Matthieu Gallien, Elisa 20.08.0) Switching screens while in Okular’s Presentation Mode now works (David Hurka, Okular 20.08.0) Fixed a case where KWin could crash when logging out of a Wayland session (Andrey Butirsky, Plasma 5.20) In a Plasma Wayland session, XWayland no longer brings down the whole session when it crashes; it just restarts normally (Vlad Zahorodniy, Plasma 5.20) Changing the list of active KRunner plugins now takes effect immediately rather than requiring KRunner to be restarted (Alexander Lohnau, Plasma 5.20) The Search widget now respects the current list of active KRunner plugins (Alexander Lohnau, Plasma 5.20) The mouse cursor no longer sometimes gets stuck when using screen rotation on Wayland (Aleix Pol Gonzalez, Plasma 5.20) Edge swipe gestures and showing a hidden panel by tapping the screen edge now work on Wayland (Xaver Hugl, Plasma 5.20) Adding a new network interface no longer messes up the display in the Networks system monitor (David Edmundson, Plasma 5.20) Changing the systemwide scale factor now invalidates the Plasma SVG cache, causing SVG-based user interface elements throughout Plasma to be re-drawn with the correct scale, which should fix a wide variety of minor graphical glitches seen after changing the scale factor (David Edmundson, Frameworks 5.74) The Baloo file indexer now skips files that repeatedly fail to index rather than repeatedly trying to re-index them anyway and failing in a loop that trashes your CPU (Stefan Brüns, Frameworks 5.74), User Interface Improvements When applying a tag to a file in Dolphin, if the tags menu only had one item in it, it now automatically closes after applying the tag (Ismael Asensio, Dolphin 20.08.0) The current date is now shown in the Digital Clock applet by default (Claudius Ellsel, Plasma 5.20) Animation speeds throughout the Breeze Widgets and Decoration themes now respect the global animation speed (Martin Sandsmark and Marco Martin, Plasma 5.20) It’s now possible to do multiplication in KRunner using “x” as the multiplication operator, not just “*” (Alexander Lohnau, Plasma 5.20) KRunner now shows tooltips for entries that don’t entirely fit, so you now have a way to read the dictionary text (Alexander Lohnau, Plasma 5.20) And yes, multi-line output is coming soon as well Minimizing a window no longer puts it at the very end of the Task Switcher; it now moves to the next position and there is no special handling (me: Nate Graham, Plasma 5.20) Made various fixes and improvements to the Breeze GTK theme: Sidebars in GTK Assistant are now readable, floating status bars are no longer transparent, the window shadow now matches that of KDE apps, and pop-up shadows now look nicer (Carson Black, Plasma 5.20) The Get New [Thing] Windows now display more appropriate icons for their Update and Uninstall actions (me: Nate Graham, Frameworks 5.74) How You Can Help Have a look at https://community.kde.org/Get_Involved to discover ways to be part of a project that really matters. Each contributor makes a huge difference in KDE; you are not a number or a cog in a machine! You don’t have to already be a programmer, either. I wasn’t when I got started. Try it, you’ll like it! We don’t bite! Finally, consider making a tax-deductible donation to the KDE e.V. foundation. [Less]
Posted 3 days ago by KDE Dot News
Once again, KDE and GNOME are teaming up to bring you THE conference for people interested in establishing Linux as a great end-user platform. At the Linux App Summit we work on making app creation for users easy and worthwhile. Since ... [More] travel is complicated nowadays, we decided to make LAS 2020 a virtual conference. The event will open Thursday, 12th November and we'll wrap up on Saturday, 14th November. Our goal is to engage people in multiple time zones and make the content available online after the conclusion. The Call for Talks is now open! Please take a look at the suggested topics and send in your ideas. We encourage new speakers, so don’t hesitate to submit a proposal! Save the date on your calendar and we look forward to seeing you at LAS 2020! Learn more about LAS 2020. Important Dates: Call for Papers opens: Today! Call for Papers closes: September 15th Speakers announced: October 1st Conference: November 12th to November 14th [Less]
Posted 3 days ago by Thomas Fischer
The release of KBibTeX 0.10 is approaching with the release of KBibTeX 0.10-alpha2 aka 0.9.81. Improvements and changes since 0.9.2 are less on the user interface, but on the code behind it: ( Read more... ) Many thanks go to contributors such as bug ... [More] reporters, translators, and everyone else who contributed to KBibTeX! Source code is available as tar ball, cryptographically signed using GnuPG key 1808CB466328F4380685A3B1A264FD738D861F41. comments [Less]
Posted 4 days ago by Nate Graham
KDE is a funny beast. In a lot of ways, it’s an anarchic society that actually works! Engineers and designers work on KDE software and websites, but none of them are paid by KDE itself. Most are volunteers but some (myself included) are paid by ... [More] 3rd-party companies. These people work on what they want or what they are sponsored by their company to work on, not what anyone in KDE tells them to work on. KDE has a board of directors, but they are elected by KDE’s membership rather than stockholders (there is no stock lol), and they do not control KDE’s strategic direction as in a corporation. Rather, they mostly take care of financial and legal matters, sort out copyright claims, help to organize the yearly Akademy conference, and so on. There is no formal “upper management” or even “middle management” layer. We have the “gardening team” whose members are in essence volunteer managers, but we mostly do things like triaging bugs, following up on stuck merge requests, performing QA on unreleased software, and so on. We support the people doing the work, rather than telling them what to do. So how does anything get done around here?! Well, just because KDE is an anarchy, does not mean that there is no organization and coordination! It’s just all done on a voluntary basis, with slightly unusual motivation techniques. Anarchy is not the absence of governance and decision-making, it’s just different from how it’s typically done. In a corporation, managers motivate their employees by offering them them money, benefits, bonuses, promotions, and internal social perks. Bad work or bad behavior is punished by reprimands, demotion, or being fired. But in KDE, most people are unpaid volunteers, so KDE has no financial leverage over them. Those who are paid are hired by 3rd-parties rather than KDE itself. Neither the carrot nor the stick will work! Instead, motivation within KDE uses the currency of excitement. When a project is cool and its contributors publicly demonstrate its coolness and their enthusiasm for it, other people want to join in and help out! This turns out to be a very effective way to motivate free people to work on something: you make them feel like they want to be a part of something big and special, and you organize the discussion in a way that makes them feel like they can be included. KDE’s design team (the VDG group) does a lot of this, constantly churning out astonishingly beautiful mockups and organizing discussions about important topics. People gravitate to the VDG’s proposals because they seem cool and there’s buzz and excitement surrounding it. The promo team works to generate that buzz and excitement. Other teams do similar things. You have to keep people excited and happy or else they will drift away. This leads to an important point: you have to minimize negativity! For most people, conflict destroys energy and motivation. Internal arguments and politics need to be minimized and driven towards a consensus rather than simmering forever. Even if you have to bend a bit and give up some of what you want, that’s a better option than getting nothing because everyone is burned out by endless arguing. And new contributors in particular must be treated with kindness, given the benefit of the doubt, and made to feel welcome. Similarly, if you’re a user who’s frustrated with the lack of progress on something you care about, insulting the developers or KDE itself in the bug report is the worst thing you could do: it will damage the motivation of the people in a position to do the work, reducing the chance that you will get what you want. Gently pinging people without negativity is the way to go–or even better, work on it yourself! Like all FOSS projects, KDE encourages self service. In essence, KDE’s little anarchic digital utopia works because we all voluntarily agree to treat each other with respect and kindness and become stakeholders in the project, and this greases the wheels of all the work we do. Somehow, it all manages to work! [Less]
Posted 4 days ago by Krita News
In 2018, we reintroducted scripting to Krita. Unlike our previous attempts to provide scripting, this time it took off! People are making all kinds of useful and fun extensions for Krita. Like a new color picker and mixer, a plugin to modify the way ... [More] Krita’s subwindows are handled, new toolboxes, integration with other applications like Autodesk Shotgun, But what was missing was a good overview of the various areas that could be scripted. Tutorials and example code on how to use the scripting API in bite-size chunks. The regular API documentation is generated automatically from the APIDOX comments. It is a good reference but can be difficult to understand since it is generated from the C++ code that provides the scripting bindings. Scott Petrovic, Krita’s UX designer and website maintainer, created a fresh new tutorial website: Scripting with Krita: Scripting with Krita And there are not just the lessons teaching you about creating scripts, running them, using the Krita scripting API and how to develop plugins, there are also really useful overviews of the actions your script can trigger and the icons you can use! The post Announcing Krita’s Scripting School! appeared first on Krita. [Less]
Posted 4 days ago by Kai Uwe Broulik
I’m pleased to announce the immediate availability of Plasma Browser Integration version 1.7.6 on the Chrome Web Store as well as Firefox Add-Ons page. This release comes with a few bug fixes, performance improvements, and translation updates. ... [More] Konqi surfing the world wide web Plasma Browser Integration bridges the gap between your browser and the Plasma desktop. It lets you share links, find browser tabs in KRunner, monitor download progress in the notification center, and control music and video playback anytime from within Plasma, or even from your phone using KDE Connect! What’s new? (also see the Changelog Page on our Community Wiki) Detecting camouflaged Chromium-based browsers Chromium-based browsers such as Vivaldi and Brave have recently changed their user agents to match that of regular Chrome to avoid being spuriously blocked. However, this also meant that media controls and other extension features were mapped to Chrome instead. This has been addressed by also checking our parent process – something a website can’t so, so you’ll still be impersonating a “proper” Chrome on the web. If there’s any other Chrome-based browser you want to see explicitly supported, let us know! Better video iframe handling The extension is loaded into every website as well as its iframes. When navigating away from the page that is currently playing, media controls will be rescinded. Due to a bug this did not work for iframes, leading to a popuplar bug where Plasma would show ghost videos playing on pages like Tweetdeck. Moreover, the website’s DOM is also monitored to notice when a player is dynamically added or removed, for instance when a video overlay opens or closes. Unfortunately, this monitoring can be quite expensive and became a bottleneck on pages with lots of dynamically loaded content like is the case when viewing a large merge request on KDE’s GitLab instance. This release significantly improves performance here. Improved media controls As usual, this release brings some improvements to media controls. Short sounds and videos are currently ignored to avoid trying to control e.g. a “new message” sound or short hover video previews. However, some live stream implementations don’t report the correct duration of Infinity but gradually fill up their time bucket every few seconds. Previously, the extension only checked duration once to determine whether to provide media controls. With this update duration is continuously checked and media controls would become available eventually. Furthermore, for websites that do not set album art through Media Session API, the video player’s poster is now used as album cover. This is the cover image that is often shown when the video isn’t playing. [Less]
Posted 5 days ago by Patrick Pereira (patrickelectric)
A new feature of QML Online is already available, allows it to run in any site/blog with minimal js/html code! Hopefully, our experience with QML examples, tutorials and documentation should change in the near future. Ff you don't know what QML ... [More] Online is, please take a look in my previous posts: QML Online - First version QML Online - QML Online - A new home! What are we talking about ? QML Online now can be used in any blog or website without much work, like this: import QtQuick 2.7 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.12 Rectangle { color: "#179AF3" anchors.fill: parent ColumnLayout{ anchors.bottom: parent.bottom anchors.right: parent.right CheckBox { checked: true text: "Check this!" } CheckBox { text: "Or this!" } } Text { text: "KDE" font.pixelSize: 80 font.bold: true color: "#82CB38" anchors.centerIn: parent RotationAnimator on rotation { running: true loops: Animation.Infinite from: 0 to: 360 duration: 1500 } } } And how can this new feature be used ? It's quite simple, check this minimal HTML example: <html> <head> <title>Qml Online minimal exampletitle> head> <body> <script type="text/javascript" src="https://qmlonline.kde.org/qtloader.js">script> <script type="text/javascript" src="https://qmlonline.kde.org/qml.js">script> <div id="qmlonline">div> <script type='text/javascript'> const qml = new QmlOnline("qmlonline") qml.registerCall({ qmlMessage: function(msg) { console.log(`qml message: ${msg}`) }, qmlError: function(data) { console.log(`qml error: ${JSON.stringify(data)}`) }, posInit: function() { qml.setCode(` import QtQuick 2.7 import QtQuick.Controls 2.3 Rectangle { color: "#179AF3" anchors.fill: parent Text { text: "KDE" font.pixelSize: 80 font.bold: true color: "#82CB38" anchors.centerIn: parent RotationAnimator on rotation { running: true loops: Animation.Infinite from: 0 to: 360 duration: 1500 } } } `) }, }) qml.init() script> body> html> As you can see, there is three steps, include both qtloader.js and qml.js, add a div DOM and create a QmlOnline object. Since I'm not a web expert, probably there is a better way to organize this approach for the user and bugs may exist. Be free to create Merge Requests, or get in touch with feature requests and issues. What is next ? From my planned objectives, sharing QML Online as library to be available for any website was one of the final points, the only one that's still missing is the Kirigami support, that's still in progress and hopefully will be finished until the end of the year (if everything goes fine). There is also a small bug, where it's not possible to use multiple QML Online instances on the same webpage. [Less]
Posted 5 days ago by Patrick Pereira (patrickelectric)
A new feature of QML Online is already available, allows it to run in any site/blog with minimal js/html code! Hopefully, our experience with QML examples, tutorials and documentation should change in the near future. Ff you don't know what QML ... [More] Online is, please take a look in my previous posts: QML Online - First version QML Online - QML Online - A new home! What are we talking about ? QML Online now can be used in any blog or website without much work, like this: import QtQuick 2.7 import QtQuick.Controls 2.3 import QtQuick.Layouts 1.12 Rectangle { color: "#179AF3" anchors.fill: parent ColumnLayout{ anchors.bottom: parent.bottom anchors.right: parent.right CheckBox { checked: true text: "Check this!" } CheckBox { text: "Or this!" } } Text { text: "KDE" font.pixelSize: 80 font.bold: true color: "#82CB38" anchors.centerIn: parent RotationAnimator on rotation { running: true loops: Animation.Infinite from: 0 to: 360 duration: 1500 } } } And how can this new feature be used ? It's quite simple, check this minimal HTML example: <html> <head> <title>Qml Online minimal exampletitle> head> <body> <script type="text/javascript" src="https://qmlonline.kde.org/qtloader.js">script> <script type="text/javascript" src="https://qmlonline.kde.org/qml.js">script> <div id="qmlonline">div> <script type='text/qml'> import QtQuick 2.7 import QtQuick.Controls 2.3 Rectangle { color: "#179AF3" anchors.fill: parent Text { text: "KDE" font.pixelSize: 80 font.bold: true color: "#82CB38" anchors.centerIn: parent RotationAnimator on rotation { running: true loops: Animation.Infinite from: 0 to: 360 duration: 1500 } } } script> <script type='text/javascript'> const qml = new QmlOnline("qmlonline") qml.registerCall({ qmlMessage: function(msg) { console.log(`qml message: ${msg}`) }, qmlError: function(data) { console.log(`qml error: ${JSON.stringify(data)}`) }, posInit: function() { qml.setCode(Array.prototype.slice.apply(document.getElementsByTagName('script')).find(e => e.type == 'text/qml').text) }, }) qml.init() script> body> html> As you can see, there is three steps, include both qtloader.js and qml.js, add a div DOM and create a QmlOnline object. Since I'm not a web expert, probably there is a better way to organize this approach for the user and bugs may exist. Be free to create Merge Requests, or get in touch with feature requests and issues. What is next ? From my planned objectives, sharing QML Online as library to be available for any website was one of the final points, the only one that's still missing is the Kirigami support, that's still in progress and hopefully will be finished until the end of the year (if everything goes fine). There is also a small bug, where it's not possible to use multiple QML Online instances on the same webpage. [Less]
Posted 5 days ago by Ashwin Dhakaita
We are in the final phase of GSoC. I don't even remember how quickly the last two months flew by. Coming to my project, it is almost complete apart from some finalisation related stuff that still is remaining. Perhaps, some review changes that my ... [More] mentors shall give me once my current patch has been reviewed are also remaining. This month, (20 days remaining before the final submissions start actually) I need to complete two items: Refactorizing the plugin for master branch: There were a lot of changes in master due to the complete resource-rewrite. Because of this, I need to change my way of handling mypaint brush files (.myb files) in master. This requires a bit of refactorization. I am afraid its been a while since I have seen the master and don't what changes I need to do to make this plugin work in master. I just hope it does not turn out to be something complex. User Documentation: Apart from refactorization, I need to start with writing user documentation ASAP. The advanced mypaint brush settings don't make much sense to me though, that might cause a bit trouble. I don't know what to write for those. Will require some help for this from my mentors I guess. I don't know why, but I always seem to have this feeling at the back of my head that something will come up that will be tough to handle and ruin my project. Though this has been happening even before GSoC started. That scares me a bit :( Anyways. Good bye :) [Less]