GCompris-qt
#include <ApplicationInfo.h>
Inherits QObject.
Public Types | |
enum | Platform { Linux, Windows, MacOSX, Android, Ios, Blackberry, SailfishOS } |
Signals | |
void | applicationSettingsChanged () |
void | applicationWidthChanged () |
void | fontRatioChanged () |
void | fullscreenChanged () |
void | portraitModeChanged () |
void | ratioChanged () |
Public Member Functions | |
Q_INVOKABLE void | abandonAudioFocus () const |
Q_INVOKABLE QString | getVoicesLocale (const QString &locale) |
Q_INVOKABLE bool | requestAudioFocus () const |
Static Public Member Functions | |
static QString | getFilePath (const QString &file) |
static void | init () |
static QString | localeShort (const QString &locale) |
Protected Slots | |
Q_INVOKABLE QString | getAudioFilePath (const QString &file) |
Q_INVOKABLE QStringList | getFontsFromRcc () |
Q_INVOKABLE QString | getLocaleFilePath (const QString &file) |
QString | getResourceDataPath () |
Q_INVOKABLE QStringList | getSystemExcludedFonts () |
Q_INVOKABLE void | notifyFullscreenChanged () |
void | notifyPortraitMode () |
Q_INVOKABLE void | screenshot (const QString &file) |
Protected Member Functions | |
qreal | getSizeWithRatio (const qreal height) |
Properties | |
int | applicationWidth |
QString | CompressedAudio |
qreal | fontRatio |
QString | GCVersion |
bool | hasShader |
bool | isDownloadAllowed |
bool | isMobile |
bool | isPortraitMode |
QString | localeShort |
Platform | platform |
QString | QTVersion |
qreal | ratio |
Detailed Description
A general purpose singleton that exposes miscellaneous native functions to the QML layer.
Definition at line 43 of file ApplicationInfo.h.
Member Enumeration Documentation
Known host platforms.
Enumerator | |
---|---|
Linux |
Linux (except Android) |
Windows |
Windows. |
MacOSX |
MacOSX. |
Android |
Android. |
Ios |
IOS (not supported) |
Blackberry |
Blackberry (not supported) |
SailfishOS |
SailfishOS. |
Definition at line 144 of file ApplicationInfo.h.
Member Function Documentation
void ApplicationInfo::abandonAudioFocus | ( | ) | const |
Abandon the Audio Focus.
On systems that support it, it will let an audio player start again.
Definition at line 62 of file ApplicationAndroid.cpp.
|
protectedslot |
Returns an absolute path to a language specific sound/voices file.
If the file is already absolute only the token replacement is applied.
- Parameters
-
file A templated relative path to a language specific file. Any occurence of the '$LOCALE' placeholder will be replaced by the currently active locale string. Any occurence of '$CA' placeholder will be replaced by the current compressed audio format ('ogg' or 'aac). Example: 'voices-$CA/$LOCALE/misc/click_on_letter.$CA'
- Returns
- An absolute path to the corresponding resource file.
Definition at line 127 of file ApplicationInfo.cpp.
|
static |
Returns an absolute and platform independent path to the passed file
.
- Parameters
-
file A relative filename.
- Returns
- Absolute path to the file.
Definition at line 116 of file ApplicationInfo.cpp.
|
protectedslot |
- Returns
- A list of fonts contained in the fonts resources.
Definition at line 155 of file ApplicationInfo.cpp.
|
protectedslot |
Returns an absolute path to a langauge specific resource file.
Generalization of getAudioFilePath().
- See also
- getAudioFilePath
Definition at line 141 of file ApplicationInfo.cpp.
|
protectedslot |
Returns the resource root-path used for GCompris resources.
Definition at line 111 of file ApplicationInfo.cpp.
|
protectedslot |
- Returns
- A list of systems-fonts that should be excluded from font selection.
Definition at line 150 of file ApplicationInfo.cpp.
QString ApplicationInfo::getVoicesLocale | ( | const QString & | locale | ) |
Returns a locale string that can be used in voices filenames.
- Parameters
-
locale A locale string of the form <language>_<country>
- Returns
- A locale string as used in voices filenames.
Definition at line 196 of file ApplicationInfo.cpp.
|
static |
Registers singleton in the QML engine.
It is not recommended to create a singleton of Qml Singleton registered object but we could not found a better way to let us access ApplicationInfo on the C++ side. All our test shows that it works.
Definition at line 224 of file ApplicationInfo.cpp.
|
inlinestatic |
Returns the short locale name for the passed locale
.
Handles also 'system' (GC_DEFAULT_LOCALE) correctly which resolves to QLocale::system().name().
- Parameters
-
locale A locale string of the form <language>_<country>
- Returns
- A short locale string of the form <language>
Definition at line 180 of file ApplicationInfo.h.
bool ApplicationInfo::requestAudioFocus | ( | ) | const |
Request GCompris to take the Audio Focus at the system level.
On systems that support it, it will mute a running audio player.
Definition at line 55 of file ApplicationAndroid.cpp.
|
protectedslot |
Stores a screenshot in the passed file
.
- Parameters
-
file Absolute destination filename.
Definition at line 180 of file ApplicationInfo.cpp.
Property Documentation
|
readwrite |
Width of the application viewport.
Definition at line 52 of file ApplicationInfo.h.
|
read |
Audio codec used for voices resources.
This is determined at compile time (ogg for free platforms, aac on MacOSX and IOS).
Definition at line 129 of file ApplicationInfo.h.
|
read |
Ratio factor used for font scaling.
On some low-dpi Android devices with high res (e.g. Galaxy Tab 4) the fonts in Text-like elements appear too small with respect to the other graphics – also if we are using font.pointSize.
For these cases we calculate a fontRatio in ApplicationInfo that takes dpi information into account, as proposed on http://doc.qt.io/qt-5/scalability.html#calculating-scaling-ratio
GCText applies this factor automatically on its new fontSize property.
Definition at line 106 of file ApplicationInfo.h.
|
read |
GCompris version string (compile time).
Definition at line 116 of file ApplicationInfo.h.
|
read |
Whether the current platform supports fragment shaders.
This flag is used in some core modules to selectively deactivate particle effects which cause crashes on some Android devices.
cf. https://bugreports.qt.io/browse/QTBUG-44194
For now always set to false, to prevent crashes.
Definition at line 77 of file ApplicationInfo.h.
|
read |
Download allowed.
This is determined at compile time. If set to NO GCompris will never download anything.
Definition at line 137 of file ApplicationInfo.h.
|
read |
Whether the application is currently running on a mobile platform.
Mobile platforms are Android, Ios (not supported yet), Blackberry (not supported)
Definition at line 65 of file ApplicationInfo.h.
|
readwrite |
Whether currently in portrait mode, on mobile platforms.
Based on viewport geometry.
Definition at line 84 of file ApplicationInfo.h.
|
read |
Short (2-letter) locale string of the currently active language.
Definition at line 111 of file ApplicationInfo.h.
|
read |
Platform the application is currently running on.
Definition at line 57 of file ApplicationInfo.h.
|
read |
Qt version string (runtime).
Definition at line 121 of file ApplicationInfo.h.
|
read |
Ratio factor used for scaling of sizes on high-dpi devices.
Must be used by activities as a scaling factor to all pixel values.
Definition at line 91 of file ApplicationInfo.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2015 The KDE developers.
Generated on Tue Jun 2 2015 21:47:48 by doxygen 1.8.9.1 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.