WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. | Zuble QML Types | Zuble C++ Classes | Zuble Overview |
Zuble
0.1
Zuble Framework C++/QML extension API
|
Zuble's Singleton Application Object. More...
#include <ZApplication.h>
Public Types | |
enum | zAppDataTag { appDirPath, appFilePath, appName, appPid, appVersion, appArguments, appLibraryPath } |
typedef enum Zbl::ZApplication::zAppDataTag | appDataTag |
Signals | |
void | settingsBundleAvailable (QString bundleId) |
This signal is sent by the settings bundle manager when an application settings bundle is added to the settings bundle map. More... | |
Public Member Functions | |
ZApplication (QObject *parent=nullptr) | |
Don't construct this. Use zInit and zInstance instead. More... | |
bool | zInit () |
Initializes the application settings from information in the Zuble application's settings metadata file. More... | |
void | addThreadApp (ZblApp *appObject) |
Adds the specified ZblApp object to the list of running thread applications. More... | |
void | removeThreadApp (ZblApp *appObject) |
Removes the specified ZblApp object from the list of running thread applications. More... | |
ZTextFeed & | zStatus () |
Obtains Zuble's main status text feed. Output text sent to this feed is broadcast to all Zuble status subscribers. Connect to the ZTextFeed::dataReady signal to subscribe to the status stream. More... | |
Q_INVOKABLE QVariant | getAppData (int tag) |
Obtains application object data for background threads. More... | |
Static Public Member Functions | |
static QString | resolvePath (const QString &path, bool includeUrlScheme=true) |
Converts relative file paths into canonical file paths. Paths prefixed with prefix are mapped relative to the root path. More... | |
static QString | resolvePath (const QString &prefix, const QString &root, const QString &path, bool includeUrlScheme=true) |
Converts relative file paths into canonical file paths. Paths prefixed with prefix are mapped relative to the root path. More... | |
static QString | getPathScheme (const QString &path) |
Obtains the scheme part of a URL path. More... | |
static QString | removePathScheme (const QString &path) |
Removes the scheme part from a URL path. More... | |
static bool | hasPathScheme (const QString &path) |
Determines if a URL contains a scheme. More... | |
static QString | getRootPath () |
Obtains the canonical path to the Zuble application's root directory. More... | |
static QString | getMainQmlPath () |
Obtains the canonical path to the Zuble application's main QML file. More... | |
static QString | getDataPath () |
Obtains the canonical path to the Zuble application's data directory. More... | |
static QString | getAppName () |
Obtains the name of the Zuble application. More... | |
static QString | getOrganization () |
Obtains the organization of the Zuble application. More... | |
static QString | getCurrentThreadAddress () |
Returns the human-readable memory address of the current thread. More... | |
static QString | getObjectThreadAddress (QObject *object) |
Returns the human-readable memory address of the specified object's thread. More... | |
static void | debugObjectThreadAddress (const char *label, QObject *obj) |
Sends object's thread address to qDebug. More... | |
static void | debugCompareThreadAddress (const char *label, QObject *obj) |
Sends both current thread address and object's thread address to qDebug. More... | |
static void | debugCurrentThreadAddress (const char *label) |
Sends current thread address to qDebug. More... | |
static void | debugGuiThreadAddress (const char *label) |
Sends QApplication's thread address to qDebug. More... | |
Static Public Attributes | |
static const QString | m_appPathPrefix = "zbl://" |
URL scheme used to specify Zuble app directory location: "zbl://". More... | |
static const QString | m_homePathPrefix = "home://" |
URL scheme used to specify user's home directory location: "home://". More... | |
static const QString | m_dataPathPrefix = "data://" |
URL scheme used to specify user's Zuble data directory location: "data://". More... | |
static const QString | m_fileUrlPrefix = "file://" |
URL scheme used to specify local file location: "file://". More... | |
static const QString | m_resourcePathPrefix = "qrc://" |
URL scheme used to specify Qt binary resource location: "qrc://". More... | |
Protected Member Functions | |
bool | initDefaultApplicationSettings () |
Checks the Zuble application directory for a settings metafile and uses it if found. Otherwise checks for a default settings metafile, creates a default metafile if that doesn't exist, and uses the default metafile instead. More... | |
Static Private Attributes | |
static QList< ZblApp * > | m_zappObjects |
static ZTextFeed | m_status |
The main application status text feed. More... | |
static const QString | m_defaultOrganization = "zubleapp" |
The Zuble application default organization name, "zuble". More... | |
static const QString | m_defaultApplication = ZApplication::getAppName() |
The Zuble application default application name. More... | |
static const QString | m_defaultSettingsID = "default" |
The Zuble application settings application name. More... | |
static const QString | m_defaultZubleAppSettings |
Settings metadata to use when no other settings data can be found. More... | |
static const QString | m_settingMetadataFileName = "zblsettings.xml" |
Name of default settings metadata file in Zuble application directory. More... | |
static const QString | m_settingMetadataInitName = "zblinitset.xml" |
Name of default settings metadata file in user's home directory, created if no metadata file found in application directory. More... | |
Zuble's Singleton Application Object.
This is an application process-wide singleton object that runs in the foreground Qt thread. It acts as an interface to the QApplication object for Zuble applications and provides cross-thread services.
TBD: add setDefaultLocale method to call QLocale::setDefault()
Definition at line 54 of file ZApplication.h.
These integer keys are used by Zuble background threads to request information from the Zuble applicaiton object running in the main thread.
see the getAppData method for more informaiton
These integer keys are used by Zuble background threads to request information from the Zuble applicaiton object running in the main thread.
see the getAppData method for more informaiton
Enumerator | |
---|---|
appDirPath | |
appFilePath | |
appName | |
appPid | |
appVersion | |
appArguments | |
appLibraryPath |
Definition at line 68 of file ZApplication.h.
Zbl::ZApplication::ZApplication | ( | QObject * | parent = nullptr | ) |
Don't construct this. Use zInit and zInstance instead.
Definition at line 124 of file ZApplication.cpp.
void Zbl::ZApplication::addThreadApp | ( | ZblApp * | appObject | ) |
Adds the specified ZblApp object to the list of running thread applications.
appObject | The ZblApp object to add |
Definition at line 538 of file ZApplication.cpp.
|
static |
Sends both current thread address and object's thread address to qDebug.
Definition at line 529 of file ZApplication.cpp.
Referenced by Zbl::Zblcore::registerTypes().
|
static |
Sends current thread address to qDebug.
Definition at line 519 of file ZApplication.cpp.
Referenced by debugCompareThreadAddress().
|
static |
Sends QApplication's thread address to qDebug.
Definition at line 524 of file ZApplication.cpp.
Referenced by debugCompareThreadAddress().
|
static |
Sends object's thread address to qDebug.
Definition at line 514 of file ZApplication.cpp.
Referenced by debugCompareThreadAddress().
QVariant Zbl::ZApplication::getAppData | ( | int | tag | ) |
Obtains application object data for background threads.
Objects running in the main thread should call QApplication methods directly instead of calling this method.
Use QMetaObject::invokeMethod with a connection type of Qt::BlockingQueuedConnection to call this method from a background thread. The background thread will block until foreground thread obtains the requested data. (WARNING: don't use Qt::BlockingQueuedConnection for code running in the main thread!)
tag | A value that determines what kind of data is returned from the data request. It must be one of the appDataTag enumeration values. |
Definition at line 450 of file ZApplication.cpp.
|
static |
Obtains the name of the Zuble application.
Definition at line 430 of file ZApplication.cpp.
Referenced by Zbl::ZSettings::getBundleSettings(), getDataPath(), and Zbl::ZSettings::insertBundle().
|
static |
Returns the human-readable memory address of the current thread.
Definition at line 504 of file ZApplication.cpp.
Referenced by debugCurrentThreadAddress(), Zbl::ZblApp::getCurrentThreadAddress(), and Zbl::ZblLogManager::zInit().
|
static |
Obtains the canonical path to the Zuble application's data directory.
Definition at line 384 of file ZApplication.cpp.
Referenced by Zbl::ZSettings::getBundleSettings(), initDefaultApplicationSettings(), and resolvePath().
|
static |
Obtains the canonical path to the Zuble application's main QML file.
Definition at line 419 of file ZApplication.cpp.
Referenced by Zbl::ZblApp::getMainQmlPath().
|
static |
Returns the human-readable memory address of the specified object's thread.
Definition at line 487 of file ZApplication.cpp.
Referenced by debugGuiThreadAddress(), debugObjectThreadAddress(), getCurrentThreadAddress(), Zbl::ZblApp::getObjectThreadAddress(), Zbl::Zblcore::registerTypes(), and Zbl::ZblLogManager::zInit().
|
static |
Obtains the organization of the Zuble application.
Definition at line 440 of file ZApplication.cpp.
Referenced by getDataPath(), and Zbl::ZSettings::insertBundle().
|
static |
Obtains the scheme part of a URL path.
path | The URL from which to extract the scheme. |
Definition at line 327 of file ZApplication.cpp.
Referenced by Zbl::ZblApp::isResourcePath(), Zbl::ZxQuery::setFocusUrl(), and Zbl::ZxQuery::setQueryUrl().
|
static |
Obtains the canonical path to the Zuble application's root directory.
Definition at line 409 of file ZApplication.cpp.
Referenced by getMainQmlPath(), Zbl::ZblApp::getRootPath(), initDefaultApplicationSettings(), Zbl::ZblApp::resolveAppPath(), and resolvePath().
|
static |
Determines if a URL contains a scheme.
A URL is determined to contain a scheme if the first forward slash character is immediately followed by a colon, ie: ":/"
Examples:
"file://home/bob/hello" hasPathScheme() == true
"/home/bob/hello" hasPathScheme() == false
"/file:home/bob/hello" hasPathScheme() == false
path | The URL to test for a scheme |
Definition at line 368 of file ZApplication.cpp.
Referenced by resolvePath().
|
protected |
Checks the Zuble application directory for a settings metafile and uses it if found. Otherwise checks for a default settings metafile, creates a default metafile if that doesn't exist, and uses the default metafile instead.
Definition at line 148 of file ZApplication.cpp.
Referenced by zInit().
|
static |
Removes the scheme part from a URL path.
path | The URL from which to remove the scheme. |
Definition at line 346 of file ZApplication.cpp.
void Zbl::ZApplication::removeThreadApp | ( | ZblApp * | appObject | ) |
Removes the specified ZblApp object from the list of running thread applications.
appObject | The ZblApp object to add |
Definition at line 560 of file ZApplication.cpp.
|
static |
Converts relative file paths into canonical file paths. Paths prefixed with prefix are mapped relative to the root path.
example: zbl://myfile.js for prefix "zbl" and root path /zuble/apps and app "myapp" is converted to "file:///zuble/apps/myapp/myfile.js"
path | File path to be converted |
includeUrlScheme | returned path will be prefixed with "file://" if true (default), set false to remove "file://" prefix from returned path |
Definition at line 280 of file ZApplication.cpp.
Referenced by Zbl::ZblLogAgent::createLogFile(), Zbl::ZblLogWorker::createLogFile(), Zbl::ZblLogManager::createTemporaryLogProfile(), initDefaultApplicationSettings(), Zbl::ZSettings::insertBundle(), Zbl::ZblLogManager::loadCurrentLogProfile(), Zbl::ZSettings::open(), Zbl::ZxQuery::ResourceUrlFile::open(), Zbl::ZblLogReader::openFile(), Zbl::ZSettings::rectifySettingsDataPath(), Zbl::ZblApp::resolveAppPath(), Zbl::ZblApp::resolveHomePath(), Zbl::ZblApp::resolvePath(), and Zbl::ZFile::setFileName().
|
static |
Converts relative file paths into canonical file paths. Paths prefixed with prefix are mapped relative to the root path.
example: zbl://myfile.js for prefix "zbl" and root path /zuble/apps and app "myapp" is converted to "file:///zuble/apps/myapp/myfile.js"
prefix | |
root | Root path to be prepended in place of "zbl://" prefix |
path | File path to be converted |
includeUrlScheme | returned path will be prefixed with "file://" if true (default), set false to remove "file://" prefix from returned path |
Definition at line 250 of file ZApplication.cpp.
|
signal |
This signal is sent by the settings bundle manager when an application settings bundle is added to the settings bundle map.
bundleId |
Referenced by Zbl::ZblLogManager::setApplicationObject().
bool Zbl::ZApplication::zInit | ( | ) |
Initializes the application settings from information in the Zuble application's settings metadata file.
If a metadata file is not found default settings from the zuble core plugin resource file are used.
Definition at line 134 of file ZApplication.cpp.
ZTextFeed & Zbl::ZApplication::zStatus | ( | ) |
Obtains Zuble's main status text feed. Output text sent to this feed is broadcast to all Zuble status subscribers. Connect to the ZTextFeed::dataReady signal to subscribe to the status stream.
Definition at line 244 of file ZApplication.cpp.
|
static |
URL scheme used to specify Zuble app directory location: "zbl://".
Definition at line 340 of file ZApplication.h.
Referenced by Zbl::ZblApp::resolveAppPath(), and resolvePath().
|
static |
URL scheme used to specify user's Zuble data directory location: "data://".
Definition at line 352 of file ZApplication.h.
Referenced by initDefaultApplicationSettings(), and resolvePath().
|
staticprivate |
The Zuble application default application name.
Definition at line 397 of file ZApplication.h.
|
staticprivate |
The Zuble application default organization name, "zuble".
Definition at line 391 of file ZApplication.h.
Referenced by getDataPath(), and getOrganization().
|
staticprivate |
The Zuble application settings application name.
Definition at line 403 of file ZApplication.h.
Referenced by initDefaultApplicationSettings().
|
staticprivate |
Settings metadata to use when no other settings data can be found.
Definition at line 409 of file ZApplication.h.
Referenced by initDefaultApplicationSettings().
|
static |
URL scheme used to specify local file location: "file://".
Definition at line 358 of file ZApplication.h.
Referenced by resolvePath().
|
static |
URL scheme used to specify user's home directory location: "home://".
Definition at line 346 of file ZApplication.h.
Referenced by Zbl::ZblApp::resolveHomePath(), and resolvePath().
|
static |
URL scheme used to specify Qt binary resource location: "qrc://".
Definition at line 364 of file ZApplication.h.
Referenced by resolvePath().
|
staticprivate |
Name of default settings metadata file in Zuble application directory.
Definition at line 416 of file ZApplication.h.
Referenced by initDefaultApplicationSettings().
|
staticprivate |
Name of default settings metadata file in user's home directory, created if no metadata file found in application directory.
Definition at line 423 of file ZApplication.h.
Referenced by initDefaultApplicationSettings().
|
staticprivate |
The main application status text feed.
This feed accumulates status text messages from all parts of Zuble and broadcasts them to subscribers.
A Qt message handler may be set to redirect Qt messages to this text feed. TBD: is this true?
Definition at line 383 of file ZApplication.h.
Referenced by zStatus().
|
staticprivate |
Definition at line 369 of file ZApplication.h.
Referenced by addThreadApp(), and removeThreadApp().
Zuble documentation copyright © 2019 Bob Dinitto. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Zuble is a derivative work of Qt version 5. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.