PureBasic 5.70 LTS beta 1 est disponible
Avec un nouveau sous-système pour Linux basé sur Qt

Le , par comtois, Responsable Purebasic
Hello everybody,

After a long delay (currently due to lack of time in my personal life, which I hope will get better soon), here is the first beta of the 5.70 LTS version which brings a bunch of new things ! First, a big thanks to Timo (Fr34k) who did a brand new subsystem for Linux: QT . Thanks to Guillot and Comtois for the new 3D functions ! Other cool stuffs are available, for example DPI support for Windows (the IDE is compiled with this switch on so you can test). Here is the full list of changes:

Code:
- Added: Brand new QT subsystem for Linux
- Added: DPI aware support for Windows app (/DPIAWARE compiler switch and DPI Aware check in IDE)
- Added: #PS, #NPS, #PS$ and #NPS$ constants (Path seperator character depending of the OS)
- Added: #PB_JSON_NoClear support to ExtractJSONStructure
- Added: #PB_Path_Winding filling mode for VectorDrawing
- Added: DesktopResolutionX(), DesktopResolutionY(), DesktopScaleX(), DesktopScaleY(), DesktopUnscaleX(), DesktopUnscaleY()
- Added: an optional 'Mode' parameter for OpenConsole() to specify the string format to use
- Added: #PB_Vehicle_IsInContact, #PB_Vehicle_ContactPointX/Y/Z, #PB_Vehicle_ContactPointY/Z for GetVehicleAttribute()
- Added: #PB_Vehicle_ContactPointNormalX/Y/Z, #PB_Vehicle_ContactPointNormalY/Z, #PB_Vehicle_CurrentSpeedKmHour, #PB_Vehicle_ForwardVectorX/Y/Z
- Added: #PB_Material_ProjectiveTexturing for SetMaterialAttribute()
- Added: ParticleScaleRate(), ParticleAngle(), CameraReflection()
- Added: BuildMeshManualLod(), BuildMeshLod(), MeshVertex(), CreateDataMesh()
- Added: EntityDirection(), EntityDirectionX(), EntityDirectionY(), EntityDirectionZ()
- Added: #PB_Local/#PB_Parent/#PB_World support for ApplyEntityForce(), ApplyEntityImpulse(), ApplyEntityTorque() and ApplyEntityTorqueImpulse()

Have fun and don't hesitate to reports any found issues !

The Fantaisie Software Team
Information complémentaire

About the DPI aware feature, it's currently Windows only and works automatically: all GUI elements are scaled automatically depending of the monitor DPI settings. That means than you can still create your GUI using absolute values, it will scale correctly. That said, some gadget (like CanvasGadget(), ImageGadget() etc.) won't scale their content automatically, so you will need to use the new Desktop DPI functions to allow proper support. The IDE has been adapted for DPI support in a very short time, with only canvas based gadget which needed some adjustment. Dialog library is also fully DPI compliant !
Concernant les fonctions 3D de cette version, c'est surtout le travail de Guillot, je me suis contenté d'ajouter de nouvelles constantes à la bibliothèque Vehicle.


Vous avez aimé cette actualité ? Alors partagez-la avec vos amis en cliquant sur les boutons ci-dessous :


 Poster une réponse Signaler un problème

Avatar de comtois comtois - Responsable Purebasic https://www.developpez.com
le 02/06/2018 à 3:46
Timo (Freak) l'auteur du nouveau sous système Qt pour la version linux de PureBasic nous fournit un peu plus d'informations (je ne traduis pas, votre anglais est bien meilleur que le mien) :

Here is some more info regarding the Qt subsystem:

We have introduced this subsystem because there are a number of problems with the Gtk3 subsystem which are rooted in deep differences between the PB and Gtk philosophy and therefore cannot be fixed easily. Qt is much more "PB friendly" as it turns out. Since Qt is also available under the LGPL since some time, there is also no license issue in the way anymore. We are hoping that this new subsystem becomes stable enough to be the new default on Linux at some point in the future. Don't worry if you still want to use Gtk: We do not plan to remove support for it, it just might stop being the default sometime.

License:
The license is LGPL and we are not statically linking (the binaries provided with the Linux distribution are used). So the license situation is the same as with Gtk. Commercial use should be no problem.

Dependencies:
The minimum Qt version is 5.5.
The following should install everything you need to compile (Ubuntu). The runtime dependencies should be available on any recent Linux distribution already:

Code : Sélectionner tout
apt-get install qtbase5-dev qttools5-dev qtmultimedia5-dev qtdeclarative5-dev libqt5svg5-dev libqt5webkit5-dev libqt5multimedia5-plugins
Usage:
Just set "qt" as the used subsystem and all related libraries will switch to Qt (there should be no Gtk dependency anymore then). Of course this also means you cannot use any Gtk functions anymore to manipulate the GUI.

Scripting:
Since Qt is a C++ framework we cannot provide simple library imports to allow manipulating PB objects directly via API like it is possible with Gtk (or the Windows API). To allow at least some measure of API access, there is a new QtScript() command available which allows executing JavaScript code in the Qt QML engine and allows access to the PB GUI objects that inherit from QObject. It also allows interaction with the PB runtime library.

The command is simple:

Code : Sélectionner tout
Result$ = QtScript(Script$)
If you have the PB debugger enabled, then errors in the JavaScript code will be reported through the PB debugger.

The following functions are available inside the script:

Code : Sélectionner tout
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
PB object access. Returns the JS object representing the given PB object id.
  gadget(id)
  menu(id)
  statusbar(id)
  systray(id)
  toolbar(id)
  window(id)
 
Misc functions:
  debug(message)          - send a message to the PB debugger. Does nothing if debugger is off
  dump(object)            - dump a Qt object to a string. Useful for debugging or to discover what members are available in an object
 
PB Runtime integration:
  runtime.get(key)        - read a PB runtime value (variable, constant)
  runtime.set(key, value) - set a PB runtime variable
  runtime.call(key)       - call a PB runtime procedure. The procedure must have 0 arguments! If you want to pass a value, use runtime.set() on a global variable
More functions may be added later.

An example:

Code : Sélectionner tout
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Runtime Procedure QtSignalHandler()
    MessageRequester("", "Signal received!")
  EndProcedure 
 
  If OpenWindow(0, 0, 0, 320, 250, "FrameGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ButtonGadget(0, 10,  10, 300, 50, "Original Text")
 
    ; show the ButtonGadget object's content
    Debug QtScript("dump(gadget(0))")
 
    ; modify the gadget text   
    QtScript(~"gadget(0).text = \"Modified Text\"")
 
    ; Connect a function to the "clicked" signal and call back into PB code
    ; Now if you click the gadget, the procedure is called
    QtScript(~"gadget(0).clicked.connect(function() { runtime.call(\"QtSignalHandler()\"); })")   
 
    Repeat
    Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf
Other OS:
I know some of you are hoping for Qt on all OS, but I don't think this will be happening for various reasons:

  • Even though Qt is cross-platform, there are still a number of OS-specifics that are visible, especially in the details. So we would have to support and bugfix a "different" Qt subsystem for each OS. This is more work than you probably think, even if most of the code is shared.
  • On the other OS we already have a quite good integration with the native API, so we want to focus on that and not spend work on an "alternative" GUI subsystem that most people will not have any use for.
  • To me, having the same underlying framework on all OS only brings a benefit if you have full access to the framework in a cross-platform way as well. If you are limited to only what PB offers through its libraries, then what does it matter if it is Qt or Windows API below? (except that Qt would bring a ton of Dll dependencies on Windows)
  • As I said above, we developed this subsystem to solve a specific problem on Linux. The benefit of having it available on all OS simply do not justify the cost in my opinion.
Avatar de comtois comtois - Responsable Purebasic https://www.developpez.com
le 22/08/2018 à 21:58
Quelques commentaires des utilisateurs

Citation Envoyé par srod
Just thought I'd share how impressed I am with the QT subsystem, even if it is only in its infancy.

Never really got on with GTK, and most especially not GTK3. Biggest problem is that I really don't have the time to learn the various APIs to anywhere near the same extent that I am familiar with Win32 etc. and so, under Linux especially, have always had to rely on native Purebasic code only without mixing API calls. Indeed, I try not to explicitly invoke any API calls these days even under Windows. Just enjoy PB far more this way.

Anyhow, been working on what should be a cross-platform propertybox control; one which uses embedded controls to edit cells and, since it is at the point where I can actually edit cells now, thought I'd give it a whirl on Ubuntu with the new QT subsystem. GTK3 was always a no-go because of the layout manager and the fact that I am embedding precisely sized controls in a canvas gadget.

Very very impressed that it ran straight out of the box. Absolutely flawless under Ubuntu with QT. Ubuntu 18.04x64, PB 5.70 beta 1. This is a complex control with custom scrollbars and the like... and it just worked! Tried GTK3 just for the hell of it and, well, the least said about that the better!

Great job guys. QT looks a great call from where I am standing and looking forward to it evolving.

Thanks.
Citation Envoyé par wombats
I agree with srod. The Qt subsystem is so much better than GTK. My project crashed in so many places with GTK and I had given up on it working on Linux. With Qt, I just have to make some ‘tweaks’ here and there to get it working.

I do hope we’ll be able to work with Qt more in-depth, but what we have right now is an excellent start. Thank you for it.
Avatar de comtois comtois - Responsable Purebasic https://www.developpez.com
le 23/09/2018 à 18:21
La beta 2 est disponible sur votre compte, avec des corrections de bogues et quelques nouvelles commandes dont le support de MySQL and MariaDB.

- beta 2 is out ! It tooks some time but we come back with the usual bug fixes and some new commands:

- HTTPRequest() and HTTPRequestMemory() to call REST api easily (sponsored by c-wayne)
- UseMySQLDatabase() which use the opensource libmariadb.dll (found in purebasic\compilers\ dir) and brings MySQL and MariaDB support natively to PureBasic ! (sponsored by Paul)
- MaterialTextureAliases() which allow to bind a PureBasic texture to an alias for use in a script.

Example for new HTTPRequest() command:

Code : Sélectionner tout
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
InitNetwork()
 
; Specify the header you want for the request
;
NewMap Header$()
Header$("ContentType") = "octectstream"
Header$("UserAgent") = "Firefox 54.0"
Header$("NoParamHeader") = ""  ; When putting no string value, it will an empty parameter
 
; Various http request type
; #PB_HTTP_Get - post data will be ignored
; #PB_HTTP_Post - post data will be used if specified
; #PB_HTTP_Put - post data will be used if specified
; #PB_HTTP_Patch - post data will be used if specified
; #PB_HTTP_Delete - post data will be used if specified
 
; Example for a POST request with string post data (will return page not found)
;
HttpRequest = HTTPRequest(#PB_HTTP_Post, "https://purebasic.com/action.php", "{ JSON: [Hello] }", 0, Header$())
If HttpRequest
  Debug "ErrorCode = "+ HTTPInfo(HTTPRequest, #PB_HTTP_ErrorCode)
  Debug "Response = " + HTTPInfo(HTTPRequest, #PB_HTTP_Response)
 
  ; Even in NoAsynchronous mode, FinishHTTP() must be called
  FinishHTTP(HttpRequest)
Else
  Debug "Failed"
EndIf
For UseMySQLDatabase(), the OpenDatabase() command must be used like that:

Code : Sélectionner tout
db = OpenDatabase(#PB_Any, "host=localhost port=3306 dbname=yourdb", User$, Pass$)
Avatar de comtois comtois - Responsable Purebasic https://www.developpez.com
le 20/11/2018 à 12:34
Nouvelle beta avec la doc à jour pour les nouvelles commandes.

beta 3 is out ! The doc for the new commands is now finished feel free to check it, and the usual bugs fixes.
Avatar de comtois comtois - Responsable Purebasic https://www.developpez.com
le 10/12/2018 à 20:19
Merci à Mesa pour la traduction française.

Beta 4 is out, with use usual bug fixes and the completed doc (translated). Thanks to Andre and Mesa for it !
Responsable bénévole de la rubrique Qt : Thibaut Cuvelier -