Difference between revisions of "QOrbiter"

From LinuxMCE
Jump to: navigation, search
(manager)
(Where To Find It)
 
(33 intermediate revisions by 5 users not shown)
Line 2: Line 2:
 
[[category:QML]]
 
[[category:QML]]
 
[[category:QOrbiter]]
 
[[category:QOrbiter]]
 +
[[Category: Programmer's Guide]]
 
qOrbiter is a new LinuxMCE orbiter designed to run on a multitude of devices as well as provide flexible skinning options to make it truly one's own. The purpose of this document is for documenting the existing skin api of the application moving forward.
 
qOrbiter is a new LinuxMCE orbiter designed to run on a multitude of devices as well as provide flexible skinning options to make it truly one's own. The purpose of this document is for documenting the existing skin api of the application moving forward.
 +
 +
=Where To Find It=
 +
The latest version of qOrbiter can always be found on the developers  [http://langstonball.com/downloads/category/1-qorbiter-downloads site].
 +
== Installation Instructions ==
 +
qOrbiter for Android should be installed from [http://192.168.80.1/lmce-admin/index.php?section=orbitersWin the local core].
  
 
=Concept=
 
=Concept=
Line 8: Line 14:
  
 
So, for example lets take the context property "deviceid". This property is added to the QML engine at runtime so that it can be used to provide the current device id of the orbiter. So in effect, this is a macro or keyword if you will that enables access to the underlying LinuxMCE data. As is one of the goals, no programming is required. One of the goals of this document is to outline all of these properties for easy reference in making a new skin.
 
So, for example lets take the context property "deviceid". This property is added to the QML engine at runtime so that it can be used to provide the current device id of the orbiter. So in effect, this is a macro or keyword if you will that enables access to the underlying LinuxMCE data. As is one of the goals, no programming is required. One of the goals of this document is to outline all of these properties for easy reference in making a new skin.
 
=Context Objects=
 
Context objects are basically specialized variables that hold functions and information. The are seperated from other context properties for various reasons outside the scope of this document. Here you will find a major list of the properties and what they provide.
 
 
==dcerouter==
 
This object represents things that are immediately sent to the router. These normally consist of simple quick commands that will not slow down the user interface in any fashion. You can use these variables and functions knowing that.
 
 
 
==manager==
 
This represents the central management, or 'core' of qorbiter. It is responsible for dealing with skins and controlling important parts of the interaction between other components and the ui.
 
*manager.setActiveSkin(name) -sets the active skin to the name passed to it. if the name is invalid, it will return the default skin for the platform
 
ex: onClicked: manager.setActiveSkin(ponies)
 
 
==nowplayingbutton==
 
 
==filedetailsclass==
 
 
=Context Properties=
 
Context properties are things that allow the skin designer access to underlying information and functions. This can be anything from the current user you want to show up in the box, to complex lists with multiple fields of information.
 
 
The format is PropertyName: the type of data it provides.
 
==General==
 
*'''srouterip'''  : string of the router ip. Default is "dcerouter"
 
 
*'''deviceid'''  : string representation of device number
 
*'''style'''      : reference the the current style that is set
 
 
==User==
 
*'''currentUser''': the current orbiter user - Initially set from the configuration file 'config.xml' but changes as the user is changed.
 
*'''userList''': listmodel of all users. Can be dropped into a component to use to select rooms. There is also a component: UserListComponent.qml
 
This component is totally skinnable and at its core contains a listmodel of all the users. In addition, it sets the current user whenever clicked.
 
 
==Location==
 
*'''currentroom''': the current room / ea
 
*'''roomList''': list of ea's rooms
 
*'''component''': RoomSelector.qml
 
Selects and set the current room and changes listmodels accordingly
 
 
=Home Screen=
 
This specific section covers the home screen. It is unique in that it contains most of the ui elements used to access the rest of the home automation system. for that reason, the concept has not been abandoned and instead made more dynamic. This section will attempt to explain the underlying models and functions for UI designers.
 
 
==List Models==
 
These are prepared in c++ and provided to the QML. If you are creating a skin, you will use these variables to call certain arrays
 
of objects like  scenarios, or userlists. This makes it easier for the designer, as they information will be populated and they only need to fill in the variable.
 
 
===currentRoomLights===
 
This provides by room scenario list for lights. you will need to use your own delegate. a default is provided. <br>
 
 
'''Populated Data Roles''' - Please note: These names are subject to change to fall in line with their specific component names <br>
 
*names[NameRole] = "username";
 
*names[LabelRole] = "label";
 
*names[ParamRole] = "params";
 
*names[CommandRole] = "command";
 
*names[GotoRole] = "gotoscreen";
 
*names[ImageRole] = "image";
 
 
 
===currentRoomMedia===
 
This provides by room scenario list for media. you will need to use your own delegate <br>
 
'''Populated Data Roles''' - Please note: These names are subject to change to fall in line with their specific component names<br>
 
*names[NameRole] = "username";
 
*names[LabelRole] = "label";
 
*names[ParamRole] = "params";
 
*names[CommandRole] = "command";
 
*names[GotoRole] = "gotoscreen";
 
*names[ImageRole] = "image";
 
 
===currentRoomClimate===
 
provides by room scenario list for climate. you will need to use your own delegate
 
 
===currentRoomTelecom===
 
provides by room scenario list for telecom. you will need to use your own delegate
 
 
===currentRoomSecurity===
 
provides by room scenario list for security. you will need to use your own delegate
 
 
=Data Grids=
 
Datagrids will encompass these specific views and more to come. Currently, they are very basic and dont accept any styling but this will change over time.
 
 
*File List
 
*Device Arrays
 
*Lists
 
 
==Media Grids==
 
*'''gmediatype'''      : current grid mediatype (to show context based images or who knows )
 
*'''fileformatmodel'''  : fileformat listmodel connected to grid filtering mechanism
 
*'''mediatypefilter'''  : mediatype list model connected to grid filtering mechanims
 
  
 
=Colors & Styling=
 
=Colors & Styling=
Line 111: Line 30:
 
One should always check the official doc's to see what methods are supported for setting properties.
 
One should always check the official doc's to see what methods are supported for setting properties.
  
==Images==
 
Images can be loaded in multiple ways and will be discussed here in the future. All that is required is to use the indicated format for local vs remote loading of images
 
*Local:  '''source: "../../../img/icons/kmix.png"'''
 
*Datagrid:  '''source:"image://datagridimg/"+id'''
 
*File Details Screen Shot or Album cover: '''source: "image://filedetailsprovider/"+filedetailsclass.screenshot'''
 
Please note more will become available as they are connected to QML.
 
  
  
 
=Developing a qOrbiter skin=
 
=Developing a qOrbiter skin=
 +
QOrbiter utilizes QML's ease of creating themes. The current engine used for themes supports the following
 +
*Screen Size based themes:
 +
** "small"  4" diagonal size and up
 +
** "medium" 7" diagonal size and up
 +
** "large"  10" diagonal size and up
 +
** "xlarge" 13" diagonal size and up
 +
*DPI based themes
 +
** "ldpi"    120
 +
** "mdpi"    160
 +
** "tvdpi"  213
 +
** "hdpi"    240
 +
** "xhdpi"  320
 +
** "xxhdpi"  480
 +
** "xxxhdpi" 640
 +
*Platform based themes
 +
** "linux"
 +
** "ios"
 +
** "android"
 +
** "windows"
 +
** "raspbian"
 +
  
 
==File Structure==
 
==File Structure==
Files should be arranged in the following manner
+
With the use of the QQmlFileselector we have a file structure that allows for a very flexible approach to themes. If you note the various keys above, such as "medium" or "android", they correlate to different folders that can exist in a skin. For example: In the default skin, there are special folders for small screens that will only show up and be used in the case of small devices. There is nothing the user needs to do to enable this as the specific variant is selected automatically at runtime, if it is available.
:<folder>name of the skin
+
 
::Main.qml
+
In the linuxMCE source tree, the qml skins can be found at
::Style.qml
+
<path-to-source>/qOrbiter/qOrbiter_src/qml/skins
::qmldir
+
It is important to note that this is the base folder for all skins and if you view this folder, you will see the 'default' skins folder inside.
::Splash.qml
+
* If you provide your own path to the skins folder, please ensure that you have at least the 'default' folder.
 +
** The default qOrbiter installation does not ship with the skins folder, so you should obtain it from http://git.linuxmce.org
 +
 
 +
==== Providing a path to your own skins. ====
 +
The default qOrbiter does not ship with skins. With non mobile devices, you can provide a custom path to skins. This allows you to develop the UI without needing to re-compile the application (or needing a full development setup)
 +
* To set your own path, you need to pass a special command line option: -x <path/to/your/skins>
 +
 
 +
 
 +
Files should be arranged in the following manner. Please note that you are not required to design your skin according to the default skin. This will be a description of how the default skin works and is organized.
 +
:<folder>name of the skin, in this case 'default'
 +
::Main.qml   The main entry file
 +
::Style.qml Contains default properties for the skin
 +
::qmldir     a file required by Qt for internal purposes.
 
:::<folder>images
 
:::<folder>images
 
:::<folder>screens
 
:::<folder>screens
 
:::<folder>components
 
:::<folder>components
 
:::<folder>js (if used)
 
:::<folder>js (if used)
 +
 +
You will notice the presence of other folders with the special character "+" i.e "+large". These are the variant folders. When the QML directories are parsed, if a selector matches one of the specially designated folders denoted with the "+", it will select the content from that folder.
 +
 +
For example, in the 'screens' folder, there are also two additional directories. "+small" and "+large"  Content from these folders are used to serve up specific versions of screens for small and large screen devices, which will automatically be detected and the file selector internally.
 +
 +
'''Order of selectors'''
 +
With many different selectors it is important to keep in mind how they affect each other. They have a cascading effect meaning you can combine them, but the file structure must respect that order.
 +
# Screen Size
 +
# DPI
 +
# Resolution
 +
# Language
 +
# In case of linux based systems, UNIX or POSIX (?)
 +
# OS
 +
# Distribution (ubuntu, opensuse, etc)
 +
 +
==Images==
 +
Images can be loaded in multiple ways and will be discussed here in the future. All that is required is to use the indicated format for local vs remote loading of images
 +
*Local:  '''source: "../../../img/icons/kmix.png"'''
 +
** Note that the file selector will load images as if they are from the base directory
 +
** Make sure to put platform specific images in the correctly denoted folders
 +
*Datagrid:  '''source:"image://datagridimg/"+id'''
 +
*File Details Screen Shot or Album cover: '''source: "image://filedetailsprovider/"+filedetailsclass.screenshot'''
 +
  
 
==Adding to the filestructure==
 
==Adding to the filestructure==
Line 150: Line 119:
 
Or another pair of main.qml and Style.qml set.
 
Or another pair of main.qml and Style.qml set.
 
After this is done you can alter the Style.qml to you likings and your skin can be selected from the styles-menu inside qOrbiter
 
After this is done you can alter the Style.qml to you likings and your skin can be selected from the styles-menu inside qOrbiter
+
 
 +
NOTE: You only see the QML files of the target you selected under project. i.e. if you select for_desktop, you will see the desktop QML files. If you choose for_android, you will see the QML files for Android. What is shown for a target, is defined in the .pro file of qOrbiter.
 +
 
 
==Special Qml Pages==
 
==Special Qml Pages==
 
The following pages are 'special' in that they serve critical function for the qml application.
 
The following pages are 'special' in that they serve critical function for the qml application.
Line 171: Line 142:
 
:located, and anything else relating to the visual style of the application as relating to your skin
 
:located, and anything else relating to the visual style of the application as relating to your skin
  
==Variables==
+
==Example==
*'''ref dcerouter''' -                  used as a reference object to call functions
+
This is a small example on how to get started, using the existing skins.
*'''QString dcemessage''' -            orbiter messaging output for display in string format
+
 
*'''srouterip''' -                      string of the routerip
+
First, you need to checkout the skin from out git repository
*'''ref manager''' -                    reference object for qorbitermanager
+
git clone https://git.linuxmce.org/linuxmce/linuxmce.git /usr/src/linuxmce-src
*'''QObject filedetailsclass''' -      QObject used for holding file information from the router for use in the UI
+
 
*'''bool connectedState''' -            represents the current connected state of the device
+
Next, you try to start qOrbiter with the commandline switch to point to your downloaded stuff
*'''int iPK_Device''' -                the orbiter device number
+
  qOrbiter -x /usr/src/linuxmce-src/src/qOrbiter/qOrbiter_src/qml/skins
*'''QTime screen1time''' -              clock. will display in
+
 
*'''QTime currentDateTime''' -          current date and time
+
This should show the same qOrbiter layout as before. Quit qOrbiter, and we make a small change to verify that we are indeed using the QML code in /usr/src directory structure. For example, change line 82 in MainLayout.qml from
*---need to outline 'role' data for member data-----
+
buttonText: qsTr("Sleeping Menu")
*'''DataModel currentRoomLights''' -    list model of the current room lighting scenarios.
+
to
*'''DataModel currentRoomMedia''' -     list model of the current room media scenarios
+
buttonText: qsTr("Alarm Menu")
*'''DataModel currentRoomClimate''' -  list model of current room climate scenarios
+
 
*'''DataModel currentRoomTelecom''' -  list model of the current room telecom scenarios
+
followed by a start of qOrbiter with the -x command line switch as specified above, ie.
*'''DataModel currentRoomSecurity''' - list model of the current room security scenarios
+
qOrbiter -x /usr/src/linuxmce-src/src/qOrbiter/qOrbiter_src/qml/skins
*'''DataModel userList''' -             list of the users in the linuxmce system
+
 
*'''DataModel roomList''' -             list of the rooms in this home.
+
Once you have verified that your changes indeed end up in your qOrbiter, you no longer need to exit and restart qOrbiter, but press <F5> to refresh the QML inside of qOrbiter.
*'''DataModel mediaplaylist''' -        the current playlist in list model form
+
*'''DataModel simpleepg''' -            simple epg model, can sometimes cause router crash.
+
*'''DataModel playlistModel''' -        list model of the playlist??
+
*'''DataModel skinsList''' -            list model containing the list of availible and ready skins
+
*'''ListModel screenshotAttributes''' -    listmodel of attributes correlating to thumbnail/screenshot selection
+
*--------------------------------------------------------------------------------
+
*'''QObject dcenowplaying''' -          QObject containing the properties of the now playing object for this ea
+
*'''QColor nowPlayingColor''' -         color of now playing button
+
*'''int currentcommandgrp''' -          int of the current command group being executed
+
*'''int gmediaType''' -                int correlating to the mediatype the grid is navigating.
+
*'''int currentroom''' -               int representing the current EA of the orbiter
+
*'''QString currentuser''' -           string of the current user
+
+
==Functions==
+
This will be broken down by section with certain parts relating directly to the screens where they are used
+
+
==HomeScreen==
+
Special Screen that doesnt have to be implemented, but since it can be considered the start page, certain
+
data is provided to make life easier for everyone.
+

Latest revision as of 05:38, 30 June 2016

Version Status Date Updated Updated By
710 Unknown N/A N/A
810 Unknown N/A N/A
1004 Unknown N/A N/A
1204 Unknown N/A N/A
1404 Unknown N/A N/A
Usage Information

qOrbiter is a new LinuxMCE orbiter designed to run on a multitude of devices as well as provide flexible skinning options to make it truly one's own. The purpose of this document is for documenting the existing skin api of the application moving forward.

Where To Find It

The latest version of qOrbiter can always be found on the developers site.

Installation Instructions

qOrbiter for Android should be installed from the local core.

Concept

The concept of this document is to provide those wishing to create new skins the needed access to LinuxMCE data through properties and context objects. While I will not be discussing what they are here, they are discussed in the scope of QML documentation which is a pre-requisite to skinning and working with Qorbiter.

So, for example lets take the context property "deviceid". This property is added to the QML engine at runtime so that it can be used to provide the current device id of the orbiter. So in effect, this is a macro or keyword if you will that enables access to the underlying LinuxMCE data. As is one of the goals, no programming is required. One of the goals of this document is to outline all of these properties for easy reference in making a new skin.

Colors & Styling

Colors such as background and button colors should be set in the style file of the qml skin. See 'Style.qml' for reference on setting up property aliases.

Examples include:

property color stageBG: "slategray"

Qualified color references include:

  • SVG named colors Reference
  • Web color notation #112233

Skins

skinsList: listmodel of skins found for the build One should always check the official doc's to see what methods are supported for setting properties.


Developing a qOrbiter skin

QOrbiter utilizes QML's ease of creating themes. The current engine used for themes supports the following

  • Screen Size based themes:
    • "small" 4" diagonal size and up
    • "medium" 7" diagonal size and up
    • "large" 10" diagonal size and up
    • "xlarge" 13" diagonal size and up
  • DPI based themes
    • "ldpi" 120
    • "mdpi" 160
    • "tvdpi" 213
    • "hdpi" 240
    • "xhdpi" 320
    • "xxhdpi" 480
    • "xxxhdpi" 640
  • Platform based themes
    • "linux"
    • "ios"
    • "android"
    • "windows"
    • "raspbian"


File Structure

With the use of the QQmlFileselector we have a file structure that allows for a very flexible approach to themes. If you note the various keys above, such as "medium" or "android", they correlate to different folders that can exist in a skin. For example: In the default skin, there are special folders for small screens that will only show up and be used in the case of small devices. There is nothing the user needs to do to enable this as the specific variant is selected automatically at runtime, if it is available.

In the linuxMCE source tree, the qml skins can be found at

<path-to-source>/qOrbiter/qOrbiter_src/qml/skins

It is important to note that this is the base folder for all skins and if you view this folder, you will see the 'default' skins folder inside.

  • If you provide your own path to the skins folder, please ensure that you have at least the 'default' folder.
    • The default qOrbiter installation does not ship with the skins folder, so you should obtain it from http://git.linuxmce.org

Providing a path to your own skins.

The default qOrbiter does not ship with skins. With non mobile devices, you can provide a custom path to skins. This allows you to develop the UI without needing to re-compile the application (or needing a full development setup)

  • To set your own path, you need to pass a special command line option: -x <path/to/your/skins>


Files should be arranged in the following manner. Please note that you are not required to design your skin according to the default skin. This will be a description of how the default skin works and is organized.

<folder>name of the skin, in this case 'default'
Main.qml The main entry file
Style.qml Contains default properties for the skin
qmldir a file required by Qt for internal purposes.
<folder>images
<folder>screens
<folder>components
<folder>js (if used)

You will notice the presence of other folders with the special character "+" i.e "+large". These are the variant folders. When the QML directories are parsed, if a selector matches one of the specially designated folders denoted with the "+", it will select the content from that folder.

For example, in the 'screens' folder, there are also two additional directories. "+small" and "+large" Content from these folders are used to serve up specific versions of screens for small and large screen devices, which will automatically be detected and the file selector internally.

Order of selectors With many different selectors it is important to keep in mind how they affect each other. They have a cascading effect meaning you can combine them, but the file structure must respect that order.

  1. Screen Size
  2. DPI
  3. Resolution
  4. Language
  5. In case of linux based systems, UNIX or POSIX (?)
  6. OS
  7. Distribution (ubuntu, opensuse, etc)

Images

Images can be loaded in multiple ways and will be discussed here in the future. All that is required is to use the indicated format for local vs remote loading of images

  • Local: source: "../../../img/icons/kmix.png"
    • Note that the file selector will load images as if they are from the base directory
    • Make sure to put platform specific images in the correctly denoted folders
  • Datagrid: source:"image://datagridimg/"+id
  • File Details Screen Shot or Album cover: source: "image://filedetailsprovider/"+filedetailsclass.screenshot


Adding to the filestructure

  1. in Qt Creator, in the source-tree, right-click on 'QML'
  2. In the contextmenu select add new
  3. choose the template 'QML' -> QML File
  4. name it 'main'
  5. for Path, click on choose, in the new window select 'new folder' give it the name of your new skin (in lower case letters, otherwise it wont work!) and click on 'choose'
  6. click continue and then done
  7. in Qt Creator, in the source-tree, right-click on 'QML'
  8. In the contextmenu select add new
  9. choose the template 'QML' -> QML File
  10. name it 'Style'
  11. for Path, click on choose, in the new window select the folder you created in step 5.
  12. click continue and then done
  13. in sources -> qorbitermanager.cpp find tskinModel->addSkin and add a new entry for your skin using the directory name.

You can now fill main and style files with the content of the same files found in the QML/desktop/default directory. Or another pair of main.qml and Style.qml set. After this is done you can alter the Style.qml to you likings and your skin can be selected from the styles-menu inside qOrbiter

NOTE: You only see the QML files of the target you selected under project. i.e. if you select for_desktop, you will see the desktop QML files. If you choose for_android, you will see the QML files for Android. What is shown for a target, is defined in the .pro file of qOrbiter.

Special Qml Pages

The following pages are 'special' in that they serve critical function for the qml application. These should be located in the main directory of your skin. i.e. - <mySkin>/Main.qml

  • Main.qml
The entire purpose of this qml page is to be the logic behind the runtime of the application. What this means
is that this is the highest level page and signals and slots should be added here. Also, the page loading
functions need to be implemented here for hiccup free operation. For example, the main.qml file thats is
part of the default skin serves as the loader for Screens, emits signals, and provides a constant object for
other logic.
  • Splash.qml
This is the loading page that is initially shown when the application starts. It is not intended to be used by skin designers as the logic is very specific. However, acceptable replacements will be included.
  • Style.qml
This qml file is unique because it does nothing more than serve as a static obeject that contains the description of
your skin, both for users and the actual application. its where screen sizes are defined, scaling functions can be
located, and anything else relating to the visual style of the application as relating to your skin

Example

This is a small example on how to get started, using the existing skins.

First, you need to checkout the skin from out git repository

git clone https://git.linuxmce.org/linuxmce/linuxmce.git /usr/src/linuxmce-src

Next, you try to start qOrbiter with the commandline switch to point to your downloaded stuff

qOrbiter -x /usr/src/linuxmce-src/src/qOrbiter/qOrbiter_src/qml/skins

This should show the same qOrbiter layout as before. Quit qOrbiter, and we make a small change to verify that we are indeed using the QML code in /usr/src directory structure. For example, change line 82 in MainLayout.qml from

buttonText: qsTr("Sleeping Menu")

to

buttonText: qsTr("Alarm Menu")

followed by a start of qOrbiter with the -x command line switch as specified above, ie.

qOrbiter -x /usr/src/linuxmce-src/src/qOrbiter/qOrbiter_src/qml/skins

Once you have verified that your changes indeed end up in your qOrbiter, you no longer need to exit and restart qOrbiter, but press <F5> to refresh the QML inside of qOrbiter.