SlideShare a Scribd company logo
Ring Documentation, Release 1.10
77.9 Building the Cards Game for Mobile using RingQt
For a better example, consider building an Android package for the Cards game that comes with the
Ring language in this folder : ring/application/cards
The Cards game folder contains three files
cards.ring : The Game source code
cards.jpg : The image file used by the game
project.qrc : Resource file to be used with the Qt project
The resource file contains the next content
<RCC>
<qresource>
<file>cards.ringo</file>
<file>cards.jpg</file>
</qresource>
</RCC>
We have two files in the resource file
The first file is cards.ringo (The Ring Object File) and the second file is cards.jpg (The image file)
As a start, Ring2EXE will generate this resource file in target/mobile/qtproject/project.qrc
But this file will contains only cards.ringo (That Ring2EXE will generate by calling Ring compiler)
We need to update this resource file to add the image file : cards.jpg
After this update, we copy the resource file to the main application folder
So when we use Ring2EXE again, Our updated resource file will be used!
Now to build the cards game for Mobile
1. Run the next command
ring2exe cards.ring -dist -mobileqt
2. Open target/mobile/qtproject/project.pro using Qt creator
3. Build and Run using Qt Creator
How the Cards game will find the image file ?
RingQt comes with a simple function : AppFile() that we can use to determine the files that we may
access on Desktop or Mobile platforms
The next code from cards.ring
mypic = new QPixmap(AppFile("cards.jpg"))
So all what you need is using AppFile() function around your image files!
77.10 Building the Weight History Application for Mobile using
RingQt
Another example to distribute your application for Mobile Devices using Ring2EXE and Qt
77.9. Building the Cards Game for Mobile using RingQt 868
Ring Documentation, Release 1.10
consider building an Android package for the Weight History application that comes with the
Ring language in this folder : ring/application/weighthistory
The Weight History application folder contains four files
weighthistory.ring : The application source code
weighthistory.db : The SQLite database
project.qrc : The resource file for the Qt project
main.cpp : The main C++ source file for the Qt project
To build the Weight History application for Mobile
1. Run the next command
ring2exe weighthistory.ring -dist -mobileqt
2. Open target/mobile/qtproject/project.pro using Qt creator
3. Build and Run using Qt Creator
The resource file (project.qrc) contains two files
<RCC>
<qresource>
<file>weighthistory.ringo</file>
<file>weighthistory.db</file>
</qresource>
</RCC>
The first file is weighthistory.ringo (Ring Object File - Generated by Ring2EXE by calling Ring compiler)
The database file : weighthistory.db
The main.cpp contains the next little update, To copy the database file from resources to a writable location
on the mobile device
QString path3 ;
path3 = path+"/weighthistory.db";
QFile::copy(":/weighthistory.db",path3);
You will need to do this with database files only!
When we use Ring2EXE, the tool will check for project.qrc and main.cpp, if they exist then your updated
files will be used in target/mobile/qtproject instead of the default version generated by Ring2EXE
So Use Ring2EXE to generate these files, Then copy them to your application folder when you update them.
77.11 Building the Form Designer for Mobile using RingQt
To build the Form Designer application (ring/applications/formdesigner) for Mobile
1. Run the next command
ring2exe formdesigner.ring -dist -mobileqt
2. Open target/mobile/qtproject/project.pro using Qt creator
3. Build and Run using Qt Creator
77.11. Building the Form Designer for Mobile using RingQt 869
Ring Documentation, Release 1.10
in the folder ring/application/formdesigner You will find the resource file : project.qrc
It will be used automatically by Ring2EXE
<RCC>
<qresource>
<file>formdesigner.ringo</file>
<file>image/allevents.png</file>
<file>image/checkbox.png</file>
<file>image/close.png</file>
<file>image/combobox.bmp</file>
<file>image/datepicker.bmp</file>
<file>image/dial.png</file>
<file>image/formdesigner.png</file>
<file>image/frame.png</file>
<file>image/grid.bmp</file>
<file>image/hyperlink.png</file>
<file>image/image.png</file>
<file>image/label.png</file>
<file>image/layout.png</file>
<file>image/lcdnumber.png</file>
<file>image/listview.png</file>
<file>image/lock.png</file>
<file>image/new.png</file>
<file>image/open.png</file>
<file>image/progressbar.png</file>
<file>image/project.png</file>
<file>image/pushbutton.png</file>
<file>image/radiobutton.png</file>
<file>image/save.png</file>
<file>image/saveas.png</file>
<file>image/select.png</file>
<file>image/slider.png</file>
<file>image/spinner.bmp</file>
<file>image/statusbar.png</file>
<file>image/tab.png</file>
<file>image/textarea.png</file>
<file>image/textfield.png</file>
<file>image/timer.png</file>
<file>image/toolbar.png</file>
<file>image/tree.bmp</file>
<file>image/videowidget.png</file>
<file>image/webview.png</file>
</qresource>
</RCC>
As we did in the Cards game, The Form Designer will use the AppFile() function to determine the name of the Image
files.
The next code from ring/applications/formdesigner/mainwindow/formdesignerview.ring
func CreateToolBar
aBtns = [
new qtoolbutton(win) {
setbtnimage(self,AppFile("image/new.png"))
setclickevent(Method(:NewAction))
settooltip("New File")
} ,
new qtoolbutton(win) {
setbtnimage(self,AppFile("image/open.png"))
77.11. Building the Form Designer for Mobile using RingQt 870
Ring Documentation, Release 1.10
setclickevent(Method(:OpenAction))
settooltip("Open File")
} ,
new qtoolbutton(win) {
setbtnimage(self,AppFile("image/save.png"))
setclickevent(Method(:SaveAction))
settooltip("Save")
} ,
new qtoolbutton(win) {
setbtnimage(self,AppFile("image/saveas.png"))
setclickevent(Method(:SaveAsAction))
settooltip("Save As")
} ,
new qtoolbutton(win) {
setbtnimage(self,AppFile("image/close.png"))
setclickevent(Method(:ExitAction))
settooltip("Exit")
}
]
tool1 = win.addtoolbar("files") {
for x in aBtns { addwidget(x) addseparator() }
}
From this example, We know that we can use sub folders for images.
77.12 Creating the Qt resource file using Folder2qrc
When we have large RingQt project that contains a lot of images and files, We need to add these files to the resource
file ( *.qrc ) when distributing applications for Mobile devices.
Instead of adding these files one by one, Ring 1.6 comes with a simple tool that save our time, It’s called Folder2qrc.
Example:
folder2qrc formdesigner.ring
We determine the main source file while we are in the application folder, and Folder2qrc will check all of the files in
the current folder and sub folders, Then add them to the resource file after the mainfile.ringo (In our example this will
be formdesigner.ringo)
The output file will be : project.qrc
You can open it and remove the files that you don’t need in the resources!
77.13 Important Information about Ring2EXE
• Using Ring2EXE to prepare distribution will delete all of the files in the old distribution
for example, if you have target/windows folder then used
ring2exe test3.ring -dist -allruntime
The files in target/windows will be deleted before adding the files again
This is important when you prepare a distribution for Mobile devices
77.12. Creating the Qt resource file using Folder2qrc 871
Ring Documentation, Release 1.10
ring2exe test3.ring -dist -mobileqt
If you modified the resource file : project.qrc or the main file : main.cpp
Don’t forget to copy them to the application folder!
So Ring2EXE can use the updated version if you tried the previous command again!
• Ring2EXE is written in Ring, and you can read the source code from
https://github.com/ring-lang/ring/blob/master/ring2exe/ring2exe.ring
• The libraries information are stored in a separated files, So these files can be updated in the future
automatically to support new libraries
https://github.com/ring-lang/ring/blob/master/ring2exe/libs
77.13. Important Information about Ring2EXE 872
CHAPTER
SEVENTYEIGHT
THE RING PACKAGE MANAGER (RINGPM)
In this chapter we will learn about using the Ring Package Manager (RingPM)
RingPM is a tool for discovering, installing and updating Ring packages.
78.1 Features
The Package Manager uses Semantic Versioning to check compatibility between packages
The Package Manager comes with the next options
Usage : ringpm [command]
Command : search [keywords...]
Command : refresh : Update the Registry (Packages List)
Command : install [ <packagename> [from <UserName>] [branch <branchname>] ]
Command : list [-u : check updates]
Command : run [packagename]
Command : update <packagename>
Command : remove <packagename>
Command : format : Delete All Packages
Command : new <packagename>
Command : package : Create package in the current folder
78.2 Discovering Packages
We can discover new packages using the Search command
Using this command we can search in the RingPM Registry (Packages Index)
The RingPM Registry is a local copy of all registred packages.
ringpm search [keywords...]
Example:
ringpm search notepad
Output:
Package : ringnotepad (Ring Notepad)
Package : notepadppeditorextension (Notepad++ Editor Extension package)
873
Ring Documentation, Release 1.10
To print all packages in the RingPM Registry, use the search command without keywords.
Example:
ringpm search
78.3 Updating the RingPM Registry
The RingPM Registry is a local copy of all registred packages.
We can update the local copy using the Refresh command
Example:
ringpm refresh
Output:
No updates to the Registry, Nothing to do!
Or
The Registry is updated from revision 110 (2019/01/13) to revision 112 (2019/01/15)
78.4 Installing Packages
We can install new packages using the Install command
ringpm install [ <packagename> [from <UserName>] [branch <branchname>] ]
We can type only the package name to get the package information from the RingPM Registry or we can determine
the user name (GitHub) and the branch name of the github project (optional).
If the current folder is a package folder then we don’t need to write the package name.
Example (1) :
ringpm install ringnotepad
Example (2) :
ringpm install goldmagic800
Example (3) :
ringpm install gameoflife
If the package is not added to the RingPM Registry, We can install it directly from the GitHub user
Example (4) :
ringpm install firstpackage from mahmoudfayed
To run the package after installation
ringpm run firstpackage
78.3. Updating the RingPM Registry 874
Ring Documentation, Release 1.10
To install a package in the current folder
Example (5) :
ringpm install
78.5 Printing List of Installed Packages
We can know the installed packages using the List command
ringpm list [-u : check updates]
Example
ringpm list
Output
(analogclock) : The AnalogClock Package [master] -- (1.0.0)
(androidringlibsdl) : The AndroidRingLibSDL Package [master] -- (1.0.0)
(androidringqt) : The AndroidRingQt Package [master] -- (1.0.0)
(atomeditorextension) : The AtomEditorExtension Package [master] -- (1.0.0)
(bignumber) : The BigNumber Package [master] -- (1.0.0)
(calculator) : The Calculator Package [master] -- (1.0.0)
(cards) : The Cards Package [master] -- (1.0.0)
(checkers) : The Checkers Package [master] -- (1.0.0)
(chess) : The Chess Package [master] -- (1.0.0)
....
To check for new updates
ringpm list -u
78.6 Run Package
After installing a package, we can run it using the Run command.
ringpm run [packagename]
Example(1):
ringpm run ringnotepad
Example(2):
ringpm run goldmagic800
Example(3):
ringpm run gameoflife
To run a package in the current folder
Example(4):
ringpm run
78.5. Printing List of Installed Packages 875
Ring Documentation, Release 1.10
78.7 Update Package
We can update a package using the Update command
ringpm update <packagename>
Example:
ringpm update ringnotepad
78.8 Remove Package
We can remove a package using the Remove command
ringpm remove <packagename>
Example:
ringpm remove ringnotepad
78.9 Deleting All Packages
We can delete all packages using the Format command
Example:
ringpm format
78.10 Creating New Package
We can create new package using the New command
ringpm new <packagename>
Example:
ringpm new myapp
This will create new folder called my myapp
The new folder will contains the next file
• package.ring : The package description and files
• main.ring : main program (used by the Run command)
• lib.ring : library file for the package
File : main.ring
# The Main File
load "lib.ring"
78.7. Update Package 876
Ring Documentation, Release 1.10
func main
? "Hello, World!"
File : lib.ring
# The Library File
File : package.ring
aPackageInfo = [
:name = "The myapp Package",
:description = "Our myapp package using the Ring programming language",
:folder = "myapp",
:developer = "",
:email = "",
:license = "MIT License",
:version = "1.0.0",
:ringversion = "1.10",
:versions = [
[
:version = "1.0.0",
:branch = "master"
]
],
:libs = [
[
:name = "",
:version = "",
:providerusername = ""
]
],
:files = [
"lib.ring",
"main.ring"
],
:ringfolderfiles = [
],
:windowsfiles = [
],
:linuxfiles = [
],
:ubuntufiles = [
],
:fedorafiles = [
],
:macosfiles = [
],
:windowsringfolderfiles = [
],
:linuxringfolderfiles = [
78.10. Creating New Package 877

More Related Content

Similar to The Ring programming language version 1.10 book - Part 91 of 212

The Ring programming language version 1.10 book - Part 13 of 212
The Ring programming language version 1.10 book - Part 13 of 212The Ring programming language version 1.10 book - Part 13 of 212
The Ring programming language version 1.10 book - Part 13 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 83 of 212
The Ring programming language version 1.10 book - Part 83 of 212The Ring programming language version 1.10 book - Part 83 of 212
The Ring programming language version 1.10 book - Part 83 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 12 of 210
The Ring programming language version 1.9 book - Part 12 of 210The Ring programming language version 1.9 book - Part 12 of 210
The Ring programming language version 1.9 book - Part 12 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 14 of 180
The Ring programming language version 1.5.1 book - Part 14 of 180The Ring programming language version 1.5.1 book - Part 14 of 180
The Ring programming language version 1.5.1 book - Part 14 of 180
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 90 of 212
The Ring programming language version 1.10 book - Part 90 of 212The Ring programming language version 1.10 book - Part 90 of 212
The Ring programming language version 1.10 book - Part 90 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 10 of 202
The Ring programming language version 1.8 book - Part 10 of 202The Ring programming language version 1.8 book - Part 10 of 202
The Ring programming language version 1.8 book - Part 10 of 202
Mahmoud Samir Fayed
 
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
Alexandre Gouaillard
 
DevTools Package Development
 DevTools Package Development DevTools Package Development
DevTools Package Development
Sagar Deogirkar
 
The Ring programming language version 1.3 book - Part 8 of 88
The Ring programming language version 1.3 book - Part 8 of 88The Ring programming language version 1.3 book - Part 8 of 88
The Ring programming language version 1.3 book - Part 8 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.3 book - Part 10 of 88
The Ring programming language version 1.3 book - Part 10 of 88The Ring programming language version 1.3 book - Part 10 of 88
The Ring programming language version 1.3 book - Part 10 of 88
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 15 of 181
The Ring programming language version 1.5.2 book - Part 15 of 181The Ring programming language version 1.5.2 book - Part 15 of 181
The Ring programming language version 1.5.2 book - Part 15 of 181
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 21 of 212
The Ring programming language version 1.10 book - Part 21 of 212The Ring programming language version 1.10 book - Part 21 of 212
The Ring programming language version 1.10 book - Part 21 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 81 of 210
The Ring programming language version 1.9 book - Part 81 of 210The Ring programming language version 1.9 book - Part 81 of 210
The Ring programming language version 1.9 book - Part 81 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 14 of 185
The Ring programming language version 1.5.4 book - Part 14 of 185The Ring programming language version 1.5.4 book - Part 14 of 185
The Ring programming language version 1.5.4 book - Part 14 of 185
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 23 of 212
The Ring programming language version 1.10 book - Part 23 of 212The Ring programming language version 1.10 book - Part 23 of 212
The Ring programming language version 1.10 book - Part 23 of 212
Mahmoud Samir Fayed
 
Dgeni documentation generator
Dgeni   documentation generatorDgeni   documentation generator
Dgeni documentation generator
Peter Darwin
 
The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210
Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 17 of 189
The Ring programming language version 1.6 book - Part 17 of 189The Ring programming language version 1.6 book - Part 17 of 189
The Ring programming language version 1.6 book - Part 17 of 189
Mahmoud Samir Fayed
 

Similar to The Ring programming language version 1.10 book - Part 91 of 212 (20)

The Ring programming language version 1.10 book - Part 13 of 212
The Ring programming language version 1.10 book - Part 13 of 212The Ring programming language version 1.10 book - Part 13 of 212
The Ring programming language version 1.10 book - Part 13 of 212
 
The Ring programming language version 1.10 book - Part 83 of 212
The Ring programming language version 1.10 book - Part 83 of 212The Ring programming language version 1.10 book - Part 83 of 212
The Ring programming language version 1.10 book - Part 83 of 212
 
The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202The Ring programming language version 1.8 book - Part 77 of 202
The Ring programming language version 1.8 book - Part 77 of 202
 
The Ring programming language version 1.9 book - Part 12 of 210
The Ring programming language version 1.9 book - Part 12 of 210The Ring programming language version 1.9 book - Part 12 of 210
The Ring programming language version 1.9 book - Part 12 of 210
 
The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196The Ring programming language version 1.7 book - Part 75 of 196
The Ring programming language version 1.7 book - Part 75 of 196
 
The Ring programming language version 1.5.1 book - Part 14 of 180
The Ring programming language version 1.5.1 book - Part 14 of 180The Ring programming language version 1.5.1 book - Part 14 of 180
The Ring programming language version 1.5.1 book - Part 14 of 180
 
The Ring programming language version 1.10 book - Part 90 of 212
The Ring programming language version 1.10 book - Part 90 of 212The Ring programming language version 1.10 book - Part 90 of 212
The Ring programming language version 1.10 book - Part 90 of 212
 
The Ring programming language version 1.8 book - Part 10 of 202
The Ring programming language version 1.8 book - Part 10 of 202The Ring programming language version 1.8 book - Part 10 of 202
The Ring programming language version 1.8 book - Part 10 of 202
 
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
IIT-RTC 2017 Qt WebRTC Tutorial (Qt Janus Client)
 
DevTools Package Development
 DevTools Package Development DevTools Package Development
DevTools Package Development
 
The Ring programming language version 1.3 book - Part 8 of 88
The Ring programming language version 1.3 book - Part 8 of 88The Ring programming language version 1.3 book - Part 8 of 88
The Ring programming language version 1.3 book - Part 8 of 88
 
The Ring programming language version 1.3 book - Part 10 of 88
The Ring programming language version 1.3 book - Part 10 of 88The Ring programming language version 1.3 book - Part 10 of 88
The Ring programming language version 1.3 book - Part 10 of 88
 
The Ring programming language version 1.5.2 book - Part 15 of 181
The Ring programming language version 1.5.2 book - Part 15 of 181The Ring programming language version 1.5.2 book - Part 15 of 181
The Ring programming language version 1.5.2 book - Part 15 of 181
 
The Ring programming language version 1.10 book - Part 21 of 212
The Ring programming language version 1.10 book - Part 21 of 212The Ring programming language version 1.10 book - Part 21 of 212
The Ring programming language version 1.10 book - Part 21 of 212
 
The Ring programming language version 1.9 book - Part 81 of 210
The Ring programming language version 1.9 book - Part 81 of 210The Ring programming language version 1.9 book - Part 81 of 210
The Ring programming language version 1.9 book - Part 81 of 210
 
The Ring programming language version 1.5.4 book - Part 14 of 185
The Ring programming language version 1.5.4 book - Part 14 of 185The Ring programming language version 1.5.4 book - Part 14 of 185
The Ring programming language version 1.5.4 book - Part 14 of 185
 
The Ring programming language version 1.10 book - Part 23 of 212
The Ring programming language version 1.10 book - Part 23 of 212The Ring programming language version 1.10 book - Part 23 of 212
The Ring programming language version 1.10 book - Part 23 of 212
 
Dgeni documentation generator
Dgeni   documentation generatorDgeni   documentation generator
Dgeni documentation generator
 
The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210The Ring programming language version 1.9 book - Part 90 of 210
The Ring programming language version 1.9 book - Part 90 of 210
 
The Ring programming language version 1.6 book - Part 17 of 189
The Ring programming language version 1.6 book - Part 17 of 189The Ring programming language version 1.6 book - Part 17 of 189
The Ring programming language version 1.6 book - Part 17 of 189
 

More from Mahmoud Samir Fayed

The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212
Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 191 of 212
The Ring programming language version 1.10 book - Part 191 of 212The Ring programming language version 1.10 book - Part 191 of 212
The Ring programming language version 1.10 book - Part 191 of 212
Mahmoud Samir Fayed
 

More from Mahmoud Samir Fayed (20)

The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212
 
The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212
 
The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212
 
The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212
 
The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212
 
The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212
 
The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212
 
The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212
 
The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212
 
The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212
 
The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212
 
The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212
 
The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212
 
The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212
 
The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212
 
The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212
 
The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212
 
The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212
 
The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212
 
The Ring programming language version 1.10 book - Part 191 of 212
The Ring programming language version 1.10 book - Part 191 of 212The Ring programming language version 1.10 book - Part 191 of 212
The Ring programming language version 1.10 book - Part 191 of 212
 

Recently uploaded

Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 

Recently uploaded (20)

Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 

The Ring programming language version 1.10 book - Part 91 of 212

  • 1. Ring Documentation, Release 1.10 77.9 Building the Cards Game for Mobile using RingQt For a better example, consider building an Android package for the Cards game that comes with the Ring language in this folder : ring/application/cards The Cards game folder contains three files cards.ring : The Game source code cards.jpg : The image file used by the game project.qrc : Resource file to be used with the Qt project The resource file contains the next content <RCC> <qresource> <file>cards.ringo</file> <file>cards.jpg</file> </qresource> </RCC> We have two files in the resource file The first file is cards.ringo (The Ring Object File) and the second file is cards.jpg (The image file) As a start, Ring2EXE will generate this resource file in target/mobile/qtproject/project.qrc But this file will contains only cards.ringo (That Ring2EXE will generate by calling Ring compiler) We need to update this resource file to add the image file : cards.jpg After this update, we copy the resource file to the main application folder So when we use Ring2EXE again, Our updated resource file will be used! Now to build the cards game for Mobile 1. Run the next command ring2exe cards.ring -dist -mobileqt 2. Open target/mobile/qtproject/project.pro using Qt creator 3. Build and Run using Qt Creator How the Cards game will find the image file ? RingQt comes with a simple function : AppFile() that we can use to determine the files that we may access on Desktop or Mobile platforms The next code from cards.ring mypic = new QPixmap(AppFile("cards.jpg")) So all what you need is using AppFile() function around your image files! 77.10 Building the Weight History Application for Mobile using RingQt Another example to distribute your application for Mobile Devices using Ring2EXE and Qt 77.9. Building the Cards Game for Mobile using RingQt 868
  • 2. Ring Documentation, Release 1.10 consider building an Android package for the Weight History application that comes with the Ring language in this folder : ring/application/weighthistory The Weight History application folder contains four files weighthistory.ring : The application source code weighthistory.db : The SQLite database project.qrc : The resource file for the Qt project main.cpp : The main C++ source file for the Qt project To build the Weight History application for Mobile 1. Run the next command ring2exe weighthistory.ring -dist -mobileqt 2. Open target/mobile/qtproject/project.pro using Qt creator 3. Build and Run using Qt Creator The resource file (project.qrc) contains two files <RCC> <qresource> <file>weighthistory.ringo</file> <file>weighthistory.db</file> </qresource> </RCC> The first file is weighthistory.ringo (Ring Object File - Generated by Ring2EXE by calling Ring compiler) The database file : weighthistory.db The main.cpp contains the next little update, To copy the database file from resources to a writable location on the mobile device QString path3 ; path3 = path+"/weighthistory.db"; QFile::copy(":/weighthistory.db",path3); You will need to do this with database files only! When we use Ring2EXE, the tool will check for project.qrc and main.cpp, if they exist then your updated files will be used in target/mobile/qtproject instead of the default version generated by Ring2EXE So Use Ring2EXE to generate these files, Then copy them to your application folder when you update them. 77.11 Building the Form Designer for Mobile using RingQt To build the Form Designer application (ring/applications/formdesigner) for Mobile 1. Run the next command ring2exe formdesigner.ring -dist -mobileqt 2. Open target/mobile/qtproject/project.pro using Qt creator 3. Build and Run using Qt Creator 77.11. Building the Form Designer for Mobile using RingQt 869
  • 3. Ring Documentation, Release 1.10 in the folder ring/application/formdesigner You will find the resource file : project.qrc It will be used automatically by Ring2EXE <RCC> <qresource> <file>formdesigner.ringo</file> <file>image/allevents.png</file> <file>image/checkbox.png</file> <file>image/close.png</file> <file>image/combobox.bmp</file> <file>image/datepicker.bmp</file> <file>image/dial.png</file> <file>image/formdesigner.png</file> <file>image/frame.png</file> <file>image/grid.bmp</file> <file>image/hyperlink.png</file> <file>image/image.png</file> <file>image/label.png</file> <file>image/layout.png</file> <file>image/lcdnumber.png</file> <file>image/listview.png</file> <file>image/lock.png</file> <file>image/new.png</file> <file>image/open.png</file> <file>image/progressbar.png</file> <file>image/project.png</file> <file>image/pushbutton.png</file> <file>image/radiobutton.png</file> <file>image/save.png</file> <file>image/saveas.png</file> <file>image/select.png</file> <file>image/slider.png</file> <file>image/spinner.bmp</file> <file>image/statusbar.png</file> <file>image/tab.png</file> <file>image/textarea.png</file> <file>image/textfield.png</file> <file>image/timer.png</file> <file>image/toolbar.png</file> <file>image/tree.bmp</file> <file>image/videowidget.png</file> <file>image/webview.png</file> </qresource> </RCC> As we did in the Cards game, The Form Designer will use the AppFile() function to determine the name of the Image files. The next code from ring/applications/formdesigner/mainwindow/formdesignerview.ring func CreateToolBar aBtns = [ new qtoolbutton(win) { setbtnimage(self,AppFile("image/new.png")) setclickevent(Method(:NewAction)) settooltip("New File") } , new qtoolbutton(win) { setbtnimage(self,AppFile("image/open.png")) 77.11. Building the Form Designer for Mobile using RingQt 870
  • 4. Ring Documentation, Release 1.10 setclickevent(Method(:OpenAction)) settooltip("Open File") } , new qtoolbutton(win) { setbtnimage(self,AppFile("image/save.png")) setclickevent(Method(:SaveAction)) settooltip("Save") } , new qtoolbutton(win) { setbtnimage(self,AppFile("image/saveas.png")) setclickevent(Method(:SaveAsAction)) settooltip("Save As") } , new qtoolbutton(win) { setbtnimage(self,AppFile("image/close.png")) setclickevent(Method(:ExitAction)) settooltip("Exit") } ] tool1 = win.addtoolbar("files") { for x in aBtns { addwidget(x) addseparator() } } From this example, We know that we can use sub folders for images. 77.12 Creating the Qt resource file using Folder2qrc When we have large RingQt project that contains a lot of images and files, We need to add these files to the resource file ( *.qrc ) when distributing applications for Mobile devices. Instead of adding these files one by one, Ring 1.6 comes with a simple tool that save our time, It’s called Folder2qrc. Example: folder2qrc formdesigner.ring We determine the main source file while we are in the application folder, and Folder2qrc will check all of the files in the current folder and sub folders, Then add them to the resource file after the mainfile.ringo (In our example this will be formdesigner.ringo) The output file will be : project.qrc You can open it and remove the files that you don’t need in the resources! 77.13 Important Information about Ring2EXE • Using Ring2EXE to prepare distribution will delete all of the files in the old distribution for example, if you have target/windows folder then used ring2exe test3.ring -dist -allruntime The files in target/windows will be deleted before adding the files again This is important when you prepare a distribution for Mobile devices 77.12. Creating the Qt resource file using Folder2qrc 871
  • 5. Ring Documentation, Release 1.10 ring2exe test3.ring -dist -mobileqt If you modified the resource file : project.qrc or the main file : main.cpp Don’t forget to copy them to the application folder! So Ring2EXE can use the updated version if you tried the previous command again! • Ring2EXE is written in Ring, and you can read the source code from https://github.com/ring-lang/ring/blob/master/ring2exe/ring2exe.ring • The libraries information are stored in a separated files, So these files can be updated in the future automatically to support new libraries https://github.com/ring-lang/ring/blob/master/ring2exe/libs 77.13. Important Information about Ring2EXE 872
  • 6. CHAPTER SEVENTYEIGHT THE RING PACKAGE MANAGER (RINGPM) In this chapter we will learn about using the Ring Package Manager (RingPM) RingPM is a tool for discovering, installing and updating Ring packages. 78.1 Features The Package Manager uses Semantic Versioning to check compatibility between packages The Package Manager comes with the next options Usage : ringpm [command] Command : search [keywords...] Command : refresh : Update the Registry (Packages List) Command : install [ <packagename> [from <UserName>] [branch <branchname>] ] Command : list [-u : check updates] Command : run [packagename] Command : update <packagename> Command : remove <packagename> Command : format : Delete All Packages Command : new <packagename> Command : package : Create package in the current folder 78.2 Discovering Packages We can discover new packages using the Search command Using this command we can search in the RingPM Registry (Packages Index) The RingPM Registry is a local copy of all registred packages. ringpm search [keywords...] Example: ringpm search notepad Output: Package : ringnotepad (Ring Notepad) Package : notepadppeditorextension (Notepad++ Editor Extension package) 873
  • 7. Ring Documentation, Release 1.10 To print all packages in the RingPM Registry, use the search command without keywords. Example: ringpm search 78.3 Updating the RingPM Registry The RingPM Registry is a local copy of all registred packages. We can update the local copy using the Refresh command Example: ringpm refresh Output: No updates to the Registry, Nothing to do! Or The Registry is updated from revision 110 (2019/01/13) to revision 112 (2019/01/15) 78.4 Installing Packages We can install new packages using the Install command ringpm install [ <packagename> [from <UserName>] [branch <branchname>] ] We can type only the package name to get the package information from the RingPM Registry or we can determine the user name (GitHub) and the branch name of the github project (optional). If the current folder is a package folder then we don’t need to write the package name. Example (1) : ringpm install ringnotepad Example (2) : ringpm install goldmagic800 Example (3) : ringpm install gameoflife If the package is not added to the RingPM Registry, We can install it directly from the GitHub user Example (4) : ringpm install firstpackage from mahmoudfayed To run the package after installation ringpm run firstpackage 78.3. Updating the RingPM Registry 874
  • 8. Ring Documentation, Release 1.10 To install a package in the current folder Example (5) : ringpm install 78.5 Printing List of Installed Packages We can know the installed packages using the List command ringpm list [-u : check updates] Example ringpm list Output (analogclock) : The AnalogClock Package [master] -- (1.0.0) (androidringlibsdl) : The AndroidRingLibSDL Package [master] -- (1.0.0) (androidringqt) : The AndroidRingQt Package [master] -- (1.0.0) (atomeditorextension) : The AtomEditorExtension Package [master] -- (1.0.0) (bignumber) : The BigNumber Package [master] -- (1.0.0) (calculator) : The Calculator Package [master] -- (1.0.0) (cards) : The Cards Package [master] -- (1.0.0) (checkers) : The Checkers Package [master] -- (1.0.0) (chess) : The Chess Package [master] -- (1.0.0) .... To check for new updates ringpm list -u 78.6 Run Package After installing a package, we can run it using the Run command. ringpm run [packagename] Example(1): ringpm run ringnotepad Example(2): ringpm run goldmagic800 Example(3): ringpm run gameoflife To run a package in the current folder Example(4): ringpm run 78.5. Printing List of Installed Packages 875
  • 9. Ring Documentation, Release 1.10 78.7 Update Package We can update a package using the Update command ringpm update <packagename> Example: ringpm update ringnotepad 78.8 Remove Package We can remove a package using the Remove command ringpm remove <packagename> Example: ringpm remove ringnotepad 78.9 Deleting All Packages We can delete all packages using the Format command Example: ringpm format 78.10 Creating New Package We can create new package using the New command ringpm new <packagename> Example: ringpm new myapp This will create new folder called my myapp The new folder will contains the next file • package.ring : The package description and files • main.ring : main program (used by the Run command) • lib.ring : library file for the package File : main.ring # The Main File load "lib.ring" 78.7. Update Package 876
  • 10. Ring Documentation, Release 1.10 func main ? "Hello, World!" File : lib.ring # The Library File File : package.ring aPackageInfo = [ :name = "The myapp Package", :description = "Our myapp package using the Ring programming language", :folder = "myapp", :developer = "", :email = "", :license = "MIT License", :version = "1.0.0", :ringversion = "1.10", :versions = [ [ :version = "1.0.0", :branch = "master" ] ], :libs = [ [ :name = "", :version = "", :providerusername = "" ] ], :files = [ "lib.ring", "main.ring" ], :ringfolderfiles = [ ], :windowsfiles = [ ], :linuxfiles = [ ], :ubuntufiles = [ ], :fedorafiles = [ ], :macosfiles = [ ], :windowsringfolderfiles = [ ], :linuxringfolderfiles = [ 78.10. Creating New Package 877