diff --git a/README.md b/README.md index 689c092..b960fd2 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ A mvvm oriented library for Qt, to create Projects for Widgets and Quick Control ![Demo Animation Widgets](./doc/images/sample_basic_widgets.gif) ![Demo Animation Quick](./doc/images/sample_basic_quick.gif) -For more images, check the [Images page](https://skycoder42.github.io/QtMvvm/TODO) +For more images, check the [Images page](https://skycoder42.github.io/QtMvvm/images_page.html) ## Features The main feature of QtMvvm is the seperation between ui and logic. With this library, you can create a core library, containing your application logic, as well as ui controllers (called "ViewModels"), and create multiple ui projects on top of it. This way you can for example provide both, a widgets and a qt quick based application, or create different uis for different devices, without having to code anything twice. @@ -104,7 +104,6 @@ The following chapters will explain how to create a QtMvvm Project and how to co - ViewModel - ServiceRegistry - IPresenter -- TODO add more The easiest way to create a QtMvvm Project is to use the provided project template. If you did not install via a package manager or the repository, follow the steps below to add the wizard. diff --git a/doc/images.dox b/doc/images.dox new file mode 100644 index 0000000..7ccd08d --- /dev/null +++ b/doc/images.dox @@ -0,0 +1,42 @@ +/*! +@page images_page Images page +@brief A collection of images to show off different UIs + +@tableofcontents + +This page shows of a bunch of images to show off how the mvvm applications can look. It is +presented in the form of tables, always comparing how a view looks on widgets next to a ui with +quick controls 2. All UIs in the same table row have been creating using the same core app and +thus use the same viewmodel. + +@section images_page_main Primary QtMvvm modules +These are the images of the sample application build with the main QtMvvm modules. On the left +is the widgets variant, on the right the quick controls 2 + + Widgets UI | Quick UI +----------------------------------------------------|---------- + @image html widgets_main.png "Main View" | @image html quick_main.png "Main View" + @image html widgets_result.png "Result View" | @image html quick_result.png "Result View" + @image html widgets_tabs.png "Tabs View" | @image html quick_tabs.png "Tabs View" + @image html widgets_input.png "Input Dialog" | @image html quick_input.png "Input Dialog" + @image html widgets_file.png "File Dialog" | @image html quick_file.png "File Dialog" + @image html widgets_message.png "Message Box" | @image html quick_message.png "Message Box" + @image html widgets_about.png "About Dialog" | @image html quick_about.png "About Dialog" + @image html widgets_settings.png "Settings View" | @image html quick_settings_1.png "Settings View Page 1" @image html quick_settings_2.png "Settings View Page 2" + +@section images_page_datasync Datasync QtMvvm modules +These are the images of the sample application using the datasync mvvm module. On the left +is the widgets variant, on the right the quick controls 2 + + Widgets UI | Quick UI +--------------------------------------------------------------------|---------- + @image html widgets_ds_main.png "Main View" | @image html quick_ds_main_1.png "Main View" @image html quick_ds_main_2.png "Main View" + @image html widgets_ds_edit.png "Edit Identity Dialog" | @image html quick_ds_edit.png "Edit Identity Dialog" + @image html widgets_ds_remote.png "Edit Remote Dialog" | @image html quick_ds_remote.png "Edit Remote View" + @image html widgets_ds_reset.png "Reset Identity Dialog" | @image html quick_ds_reset.png "Reset Identity Dialog" + @image html widgets_ds_exchange.png "Exchange View" | @image html quick_ds_exchange.png "Exchange View" + @image html widgets_ds_import.png "Import Dialog" | @image html widgets_ds_import.png "Import Dialog" + @image html widgets_ds_import_trust.png "Import Trusted Dialog" | @image html quick_ds_import_trust.png "Import Trusted Dialog" + @image html widgets_ds_export.png "Export Dialog" | @image html quick_ds_export.png "Export Dialog" + @image html widgets_ds_grant.png "Grant Dialog" | @image html quick_ds_grant.png "Grant Dialog" +*/ diff --git a/doc/images/quick/quick_about.png b/doc/images/quick/quick_about.png new file mode 100644 index 0000000..cf85cda Binary files /dev/null and b/doc/images/quick/quick_about.png differ diff --git a/doc/images/quick/quick_drawer.png b/doc/images/quick/quick_drawer.png new file mode 100644 index 0000000..ae50243 Binary files /dev/null and b/doc/images/quick/quick_drawer.png differ diff --git a/doc/images/quick/quick_ds_edit.png b/doc/images/quick/quick_ds_edit.png new file mode 100644 index 0000000..31089bb Binary files /dev/null and b/doc/images/quick/quick_ds_edit.png differ diff --git a/doc/images/quick/quick_ds_exchange.png b/doc/images/quick/quick_ds_exchange.png new file mode 100644 index 0000000..523758d Binary files /dev/null and b/doc/images/quick/quick_ds_exchange.png differ diff --git a/doc/images/quick/quick_ds_export.png b/doc/images/quick/quick_ds_export.png new file mode 100644 index 0000000..54b4dec Binary files /dev/null and b/doc/images/quick/quick_ds_export.png differ diff --git a/doc/images/quick/quick_ds_grant.png b/doc/images/quick/quick_ds_grant.png new file mode 100644 index 0000000..019a70a Binary files /dev/null and b/doc/images/quick/quick_ds_grant.png differ diff --git a/doc/images/quick/quick_ds_import.png b/doc/images/quick/quick_ds_import.png new file mode 100644 index 0000000..7882694 Binary files /dev/null and b/doc/images/quick/quick_ds_import.png differ diff --git a/doc/images/quick/quick_ds_import_trust.png b/doc/images/quick/quick_ds_import_trust.png new file mode 100644 index 0000000..beb2f8a Binary files /dev/null and b/doc/images/quick/quick_ds_import_trust.png differ diff --git a/doc/images/quick/quick_ds_main_1.png b/doc/images/quick/quick_ds_main_1.png new file mode 100644 index 0000000..61da395 Binary files /dev/null and b/doc/images/quick/quick_ds_main_1.png differ diff --git a/doc/images/quick/quick_ds_main_2.png b/doc/images/quick/quick_ds_main_2.png new file mode 100644 index 0000000..1ecb86b Binary files /dev/null and b/doc/images/quick/quick_ds_main_2.png differ diff --git a/doc/images/quick/quick_ds_remote.png b/doc/images/quick/quick_ds_remote.png new file mode 100644 index 0000000..2bdb9d5 Binary files /dev/null and b/doc/images/quick/quick_ds_remote.png differ diff --git a/doc/images/quick/quick_ds_reset.png b/doc/images/quick/quick_ds_reset.png new file mode 100644 index 0000000..04087a4 Binary files /dev/null and b/doc/images/quick/quick_ds_reset.png differ diff --git a/doc/images/quick/quick_file.png b/doc/images/quick/quick_file.png new file mode 100644 index 0000000..03ddcd7 Binary files /dev/null and b/doc/images/quick/quick_file.png differ diff --git a/doc/images/quick/quick_input.png b/doc/images/quick/quick_input.png new file mode 100644 index 0000000..727677d Binary files /dev/null and b/doc/images/quick/quick_input.png differ diff --git a/doc/images/quick/quick_main.png b/doc/images/quick/quick_main.png new file mode 100644 index 0000000..9aaaece Binary files /dev/null and b/doc/images/quick/quick_main.png differ diff --git a/doc/images/quick/quick_message.png b/doc/images/quick/quick_message.png new file mode 100644 index 0000000..baf34e6 Binary files /dev/null and b/doc/images/quick/quick_message.png differ diff --git a/doc/images/quick/quick_result.png b/doc/images/quick/quick_result.png new file mode 100644 index 0000000..7e3f8ee Binary files /dev/null and b/doc/images/quick/quick_result.png differ diff --git a/doc/images/quick/quick_settings_1.png b/doc/images/quick/quick_settings_1.png new file mode 100644 index 0000000..648ef6b Binary files /dev/null and b/doc/images/quick/quick_settings_1.png differ diff --git a/doc/images/quick/quick_settings_2.png b/doc/images/quick/quick_settings_2.png new file mode 100644 index 0000000..10a6f3e Binary files /dev/null and b/doc/images/quick/quick_settings_2.png differ diff --git a/doc/images/quick/quick_tabs.png b/doc/images/quick/quick_tabs.png new file mode 100644 index 0000000..25ca389 Binary files /dev/null and b/doc/images/quick/quick_tabs.png differ diff --git a/doc/images/widgets/widgets_about.png b/doc/images/widgets/widgets_about.png new file mode 100644 index 0000000..9e3f1d5 Binary files /dev/null and b/doc/images/widgets/widgets_about.png differ diff --git a/doc/images/widgets/widgets_ds_edit.png b/doc/images/widgets/widgets_ds_edit.png new file mode 100644 index 0000000..5ea3b12 Binary files /dev/null and b/doc/images/widgets/widgets_ds_edit.png differ diff --git a/doc/images/widgets/widgets_ds_exchange.png b/doc/images/widgets/widgets_ds_exchange.png new file mode 100644 index 0000000..66b47ab Binary files /dev/null and b/doc/images/widgets/widgets_ds_exchange.png differ diff --git a/doc/images/widgets/widgets_ds_export.png b/doc/images/widgets/widgets_ds_export.png new file mode 100644 index 0000000..7940f4e Binary files /dev/null and b/doc/images/widgets/widgets_ds_export.png differ diff --git a/doc/images/widgets/widgets_ds_grant.png b/doc/images/widgets/widgets_ds_grant.png new file mode 100644 index 0000000..aaa1aa9 Binary files /dev/null and b/doc/images/widgets/widgets_ds_grant.png differ diff --git a/doc/images/widgets/widgets_ds_import.png b/doc/images/widgets/widgets_ds_import.png new file mode 100644 index 0000000..8d0ba63 Binary files /dev/null and b/doc/images/widgets/widgets_ds_import.png differ diff --git a/doc/images/widgets/widgets_ds_import_trust.png b/doc/images/widgets/widgets_ds_import_trust.png new file mode 100644 index 0000000..937fbef Binary files /dev/null and b/doc/images/widgets/widgets_ds_import_trust.png differ diff --git a/doc/images/widgets/widgets_ds_main.png b/doc/images/widgets/widgets_ds_main.png new file mode 100644 index 0000000..99a085a Binary files /dev/null and b/doc/images/widgets/widgets_ds_main.png differ diff --git a/doc/images/widgets/widgets_ds_remote.png b/doc/images/widgets/widgets_ds_remote.png new file mode 100644 index 0000000..06f8a5e Binary files /dev/null and b/doc/images/widgets/widgets_ds_remote.png differ diff --git a/doc/images/widgets/widgets_ds_reset.png b/doc/images/widgets/widgets_ds_reset.png new file mode 100644 index 0000000..4309c9f Binary files /dev/null and b/doc/images/widgets/widgets_ds_reset.png differ diff --git a/doc/images/widgets/widgets_file.png b/doc/images/widgets/widgets_file.png new file mode 100644 index 0000000..57afb64 Binary files /dev/null and b/doc/images/widgets/widgets_file.png differ diff --git a/doc/images/widgets/widgets_input.png b/doc/images/widgets/widgets_input.png new file mode 100644 index 0000000..ad9d233 Binary files /dev/null and b/doc/images/widgets/widgets_input.png differ diff --git a/doc/images/widgets/widgets_main.png b/doc/images/widgets/widgets_main.png new file mode 100644 index 0000000..7d28026 Binary files /dev/null and b/doc/images/widgets/widgets_main.png differ diff --git a/doc/images/widgets/widgets_message.png b/doc/images/widgets/widgets_message.png new file mode 100644 index 0000000..afed3dc Binary files /dev/null and b/doc/images/widgets/widgets_message.png differ diff --git a/doc/images/widgets/widgets_result.png b/doc/images/widgets/widgets_result.png new file mode 100644 index 0000000..9886a5c Binary files /dev/null and b/doc/images/widgets/widgets_result.png differ diff --git a/doc/images/widgets/widgets_settings.png b/doc/images/widgets/widgets_settings.png new file mode 100644 index 0000000..03e7939 Binary files /dev/null and b/doc/images/widgets/widgets_settings.png differ diff --git a/doc/images/widgets/widgets_tabs.png b/doc/images/widgets/widgets_tabs.png new file mode 100644 index 0000000..504bc6f Binary files /dev/null and b/doc/images/widgets/widgets_tabs.png differ diff --git a/doc/message.dox b/doc/message.dox index 7073c3f..b6084ab 100644 --- a/doc/message.dox +++ b/doc/message.dox @@ -212,6 +212,13 @@ message to show: Critical Error | MessageConfig::SubTypeQuestion About Dialog | MessageConfig::SubTypeAbout +The widgets implementation does support a few extra properties for this type: +- modal (bool = true), configure application modality +- windowTitle (QString), the window title +- details (QString), the message box details box +- checkable (bool = false), gives the messagebox a small checkbox +- checkString (QString), the string to display for that checkbox + @sa MessageConfig::type, MessageConfig::subType, MessageConfig::TypeInputDialog, MessageConfig::TypeFileDialog */ @@ -484,6 +491,8 @@ MessageConfig::NoButton when beeing discarded this way. /*! @fn QtMvvm::MessageResult::dialogDone +@privsig + @param button The button that was pressed by the user to complete the dialog Is emitted as soon as the dialog was closed with the button that was pressed, or @@ -638,3 +647,180 @@ mode that is used. @sa QtMvvm::information, MessageConfig, CoreApp::showDialog */ + + +/*! +@fn QtMvvm::getInput(const QString &, const QString &, const char *, const QVariant &, const QVariantMap &, const QString &, const QString &) + +@param title The input dialog title (MessageConfig::title) +@param text A label to describe what to input (MessageConfig::text) +@param inputType The data type of the edit to be used (MessageConfig::subType) +@param defaultValue A default value to initialize the edit with (MessageConfig::defaultValue) +@param viewProperties Additional properties to be passed to the edit (MessageConfig::viewProperties) +@param okText An optional text overwrite for the OK button (MessageConfig::buttonTexts) +@param cancelText An optional text overwrite for the CANCEL button (MessageConfig::buttonTexts) + +Shows an input dialog. The kind of edit to use is determined by using the `inputType`. The +view properties will be applied to both, the dialog and the edit. + +@sa MessageConfig, CoreApp::showDialog +*/ + +/*! +@fn QtMvvm::getInput(const QString &, const QString &, const char *, const std::function &, const QVariant &, const QVariantMap &, const QString &, const QString &) + +@param onResult A handler to be called when the input dialog has been closed. Reports the +result or an invalid variant in case the input has been canceled. +@copydetails QtMvvm::getInput(const QString &, const QString &, const char *, const QVariant &, const QVariantMap &, const QString &, const QString &) +*/ + +/*! +@fn QtMvvm::getInput(const QString &, const QString &, const char *, QObject *, const std::function &, const QVariant &, const QVariantMap &, const QString &, const QString &) + +@param scope A scope to limit to. `onResult` is only called as long as scope has not been deleted +@copydetails QtMvvm::getInput(const QString &, const QString &, const char *, const std::function &, const QVariant &, const QVariantMap &, const QString &, const QString &) +*/ + +/*! +@fn QtMvvm::getInput(const QString &, const QString &, const TEdit &, const QVariantMap &, const QString &, const QString &) + +@param title The input dialog title (MessageConfig::title) +@param text A label to describe what to input (MessageConfig::text) +@param defaultValue A default value to initialize the edit with (MessageConfig::defaultValue) +@param viewProperties Additional properties to be passed to the edit (MessageConfig::viewProperties) +@param okText An optional text overwrite for the OK button (MessageConfig::buttonTexts) +@param cancelText An optional text overwrite for the CANCEL button (MessageConfig::buttonTexts) +@tparam TEdit The input to type to create an edit for and to get a value of + +Shows an input dialog. The kind of edit to use is determined by using the `TEdit` type name. +The view properties will be applied to both, the dialog and the edit. + +@sa MessageConfig, CoreApp::showDialog +*/ + +/*! +@fn QtMvvm::getInput(const QString &, const QString &, const std::function &, const TEdit &, const QVariantMap &, const QString &, const QString &) + +@param onResult A handler to be called when the input dialog has been closed. Reports the +result and `true` as second parameter, or a default constructed value and `false` in case the +input has been canceled +@copydetails QtMvvm::getInput(const QString &, const QString &, const TEdit &, const QVariantMap &, const QString &, const QString &) +*/ + +/*! +@fn QtMvvm::getInput(const QString &, const QString &, QObject *, const std::function &, const TEdit &, const QVariantMap &, const QString &, const QString &) + +@param scope A scope to limit to. `onResult` is only called as long as scope has not been deleted +@copydetails QtMvvm::getInput(const QString &, const QString &, const std::function &, const TEdit &, const QVariantMap &, const QString &, const QString &) +*/ + + +/*! +@fn QtMvvm::getExistingDirectory(const QString &, const QUrl &) + +@param title The input dialog title (MessageConfig::title) +@param dir The directory URL to start the file dialog from (MessageConfig::defaultValue) + +Shows a folder dialog to let the user select an existing directory. + +@sa MessageConfig, CoreApp::showDialog +*/ + +/*! +@fn QtMvvm::getExistingDirectory(const std::function &, const QString &, const QUrl &) + +@param onResult A handler to be called when the folder dialog has been closed. Reports the +selected directory URL or an invalid URL in case the input has been canceled. +@copydetails QtMvvm::getExistingDirectory(const QString &, const QUrl &) +*/ + +/*! +@fn QtMvvm::getExistingDirectory(QObject *, const std::function &, const QString &, const QUrl &) + +@param scope A scope to limit to. `onResult` is only called as long as scope has not been deleted +@copydetails QtMvvm::getExistingDirectory(const std::function &, const QString &, const QUrl &) +*/ + +/*! +@fn QtMvvm::getOpenFile(const QString &, const QStringList &, const QUrl &) + +@param title The input dialog title (MessageConfig::title) +@param supportedMimeTypes A list of all allowed mimetypes (MessageConfig::viewProperties, extra property named `mimeTypes`) +@param dir The directory URL to start the file dialog from (MessageConfig::defaultValue) + +Shows a file dialog to let the user select an existing file. The selectable files are limited +to the mime types allowed. + +@sa MessageConfig, CoreApp::showDialog +*/ + +/*! +@fn QtMvvm::getOpenFile(const std::function &, const QString &, const QStringList &, const QUrl &) + +@param onResult A handler to be called when the file dialog has been closed. Reports the +selected file URL or an invalid URL in case the input has been canceled. +@copydetails QtMvvm::getOpenFile(const QString &, const QStringList &, const QUrl &) +*/ + +/*! +@fn QtMvvm::getOpenFile(QObject *, const std::function &, const QString &, const QStringList &, const QUrl &) + +@param scope A scope to limit to. `onResult` is only called as long as scope has not been deleted +@copydetails QtMvvm::getOpenFile(const std::function &, const QString &, const QStringList &, const QUrl &) +*/ + +/*! +@fn QtMvvm::getOpenFiles(const QString &, const QStringList &, const QUrl &) + +@param title The input dialog title (MessageConfig::title) +@param supportedMimeTypes A list of all allowed mimetypes (MessageConfig::viewProperties, extra property named `mimeTypes`) +@param dir The directory URL to start the file dialog from (MessageConfig::defaultValue) + +Shows a file dialog to let the user select multiple existing files. The selectable files are +limited to the mime types allowed. + +@sa MessageConfig, CoreApp::showDialog +*/ + +/*! +@fn QtMvvm::getOpenFiles(const std::function)> &, const QString &, const QStringList &, const QUrl &) + +@param onResult A handler to be called when the file dialog has been closed. Reports the +selected file URLs in a list or an empty list in case the input has been canceled. +@copydetails QtMvvm::getOpenFiles(const QString &, const QStringList &, const QUrl &) +*/ + +/*! +@fn QtMvvm::getOpenFiles(QObject *, const std::function)> &, const QString &, const QStringList &, const QUrl &) + +@param scope A scope to limit to. `onResult` is only called as long as scope has not been deleted +@copydetails QtMvvm::getOpenFiles(const std::function)> &, const QString &, const QStringList &, const QUrl &) +*/ + +/*! +@fn QtMvvm::getSaveFile(const QString &, const QStringList &, const QUrl &) + +@param title The input dialog title (MessageConfig::title) +@param supportedMimeTypes A list of all allowed mimetypes (MessageConfig::viewProperties, extra property named `mimeTypes`) +@param dir The directory URL to start the file dialog from (MessageConfig::defaultValue) + +Shows a file dialog to let the user select an (non existing) file name for saving. The +selectable files are limited to the mime types allowed. + +@sa MessageConfig, CoreApp::showDialog +*/ + +/*! +@fn QtMvvm::getSaveFile(const std::function &, const QString &, const QStringList &, const QUrl &) + +@param onResult A handler to be called when the file dialog has been closed. Reports the +selected file URL or an invalid URL in case the input has been canceled. +@copydetails QtMvvm::getSaveFile(const QString &, const QStringList &, const QUrl &) +*/ + +/*! +@fn QtMvvm::getSaveFile(QObject *, const std::function &, const QString &, const QStringList &, const QUrl &) + +@param scope A scope to limit to. `onResult` is only called as long as scope has not been deleted +@copydetails QtMvvm::getSaveFile(const std::function &, const QString &, const QStringList &, const QUrl &) +*/ diff --git a/doc/serviceregistry.dox b/doc/serviceregistry.dox index 1667977..9726dd3 100644 --- a/doc/serviceregistry.dox +++ b/doc/serviceregistry.dox @@ -6,6 +6,9 @@ with the registry are available for DI. When using lazy initialization, services can also have dependencies to be injected. When the registry creates them it will automatically inject them. Automatic DI is also done for ViewModel created by the CoreApp. +@note If a service has a slot named `qtmvvm_init()` it is called automatically by the registry +right after all dependant services have been injected. + The following example shows how to use DI. The first shows how to use it with a simple, interface-less service for an already created object: @@ -20,6 +23,7 @@ public: public Q_SLOTS: void baum(); + void qtmvvm_init(); //is called by the registry }; // myclass.h @@ -76,6 +80,7 @@ public: public Q_SLOTS: void baum() override; + void qtmvvm_init(); //is called by the registry }; // myclass.h diff --git a/doc/settingsviewmodel.dox b/doc/settingsviewmodel.dox index 0d0faed..2426267 100644 --- a/doc/settingsviewmodel.dox +++ b/doc/settingsviewmodel.dox @@ -8,7 +8,7 @@ dialog, call show from another ViewModel or the CoreApp: show(); @endcode -TODO link to image page +@sa @ref images_page */ /*! diff --git a/doc/settingsxml.dox b/doc/settingsxml.dox index 6c46a87..10d2147 100644 --- a/doc/settingsxml.dox +++ b/doc/settingsxml.dox @@ -2,11 +2,25 @@ @page settings_xml The XML settings format @brief Documentation of the XML format used to create settings uis +@tableofcontents + This format is used to create settings.xml files to be read by the default XML QtMvvm::ISettingsSetupLoader. The files are read via that service and mapped to QtMvvm::SettingsElements::Setup. -@tableofcontents +@section settings_xml_translator Translations +All the settings files you have can be easily translated via a standard ts/qm file. In order for +this to work, all you have to do is add the following lines to your pro file: + +@code{.pro} +QTMVVM_TS_SETTINGS += settings.xml +_never_true_condition: SOURCES += $$files($$PWD/.ts-dummy/*) +PRE_TARGETDEPS += qtmvvm-tsgen #optional +@endcode + +This will automatically generate a dummy cpp file in the `.ts-dummy` folder for each file +added to the `QTMVVM_TS_SETTINGS` variable. These files contain dummy code that will then be +read by lupdate automatically and added to all your ts files. @section settings_xml_elements Elements The possible elements of such a file @@ -18,10 +32,10 @@ The `` element must be the root Element of the XML document and QtMvvm::SettingsElements::Setup. @subsubsection settings_xml_elements_config_attribs Attributes - Name | Type | Default | Description -----------------|-------|-----------|------------- - allowSearch | bool | `true` | @copybrief QtMvvm::SettingsElements::Setup::allowSearch - allowRestore | bool | `true` | @copybrief QtMvvm::SettingsElements::Setup::allowRestore + Name | Type | Default | Translated | Description +----------------|-------|-----------|---------------|------------- + allowSearch | bool | `true` | no | @copybrief QtMvvm::SettingsElements::Setup::allowSearch + allowRestore | bool | `true` | no | @copybrief QtMvvm::SettingsElements::Setup::allowRestore @subsubsection settings_xml_elements_config_elements Content Can be an arbitrary number of Elements from the following list. However, only one type of @@ -40,13 +54,13 @@ be of the same type as well: The `` element is mapped to the QtMvvm::SettingsElements::Category. @subsubsection settings_xml_elements_category_attribs Attributes - Name | Type | Default | Description -------------|---------------------------------------|---------------------------------------------------|------------- - title | string | `"General Settings"` | @copybrief QtMvvm::SettingsElements::Category::title - icon | url | `"qrc:/de/skycoder42/qtmvvm/icons/settings.svg"` | @copybrief QtMvvm::SettingsElements::Category::icon - tooltip | string | Empty | @copybrief QtMvvm::SettingsElements::Category::tooltip - frontends | @ref settings_xml_types_descriptor | Empty | @copybrief QtMvvm::SettingsElements::Category::frontends - selectors | @ref settings_xml_types_descriptor | Empty | @copybrief QtMvvm::SettingsElements::Category::selectors + Name | Type | Default | Translated | Description +------------|---------------------------------------|---------------------------------------------------|---------------|------------- + title | string | `"General Settings"` | yes | @copybrief QtMvvm::SettingsElements::Category::title + icon | url | `"qrc:/de/skycoder42/qtmvvm/icons/settings.svg"` | no | @copybrief QtMvvm::SettingsElements::Category::icon + tooltip | string | Empty | yes | @copybrief QtMvvm::SettingsElements::Category::tooltip + frontends | @ref settings_xml_types_descriptor | Empty | no | @copybrief QtMvvm::SettingsElements::Category::frontends + selectors | @ref settings_xml_types_descriptor | Empty | no | @copybrief QtMvvm::SettingsElements::Category::selectors @subsubsection settings_xml_elements_category_elements Content Can be an arbitrary number of Elements from the following list. However, only one type of @@ -64,13 +78,13 @@ be of the same type as well: The `
` element is mapped to the QtMvvm::SettingsElements::Section. @subsubsection settings_xml_elements_section_attribs Attributes - Name | Type | Default | Description -------------|---------------------------------------|---------------|------------- - title | string | `"General"` | @copybrief QtMvvm::SettingsElements::Section::title - icon | url | Empty | @copybrief QtMvvm::SettingsElements::Section::icon - tooltip | string | Empty | @copybrief QtMvvm::SettingsElements::Section::tooltip - frontends | @ref settings_xml_types_descriptor | Empty | @copybrief QtMvvm::SettingsElements::Section::frontends - selectors | @ref settings_xml_types_descriptor | Empty | @copybrief QtMvvm::SettingsElements::Section::selectors + Name | Type | Default | Translated | Description +------------|---------------------------------------|---------------|---------------|------------- + title | string | `"General"` | yes | @copybrief QtMvvm::SettingsElements::Section::title + icon | url | Empty | no | @copybrief QtMvvm::SettingsElements::Section::icon + tooltip | string | Empty | yes | @copybrief QtMvvm::SettingsElements::Section::tooltip + frontends | @ref settings_xml_types_descriptor | Empty | no | @copybrief QtMvvm::SettingsElements::Section::frontends + selectors | @ref settings_xml_types_descriptor | Empty | no | @copybrief QtMvvm::SettingsElements::Section::selectors @subsubsection settings_xml_elements_section_elements Content Can be an arbitrary number of Elements from the following list. However, only one type of @@ -91,12 +105,12 @@ of organizing them into subgroups. If the title is empty, the tooltip is ignored The descriptors however still apply. @subsubsection settings_xml_elements_group_attribs Attributes - Name | Type | Default | Description -------------|---------------------------------------|---------------|------------- - title | string | Empty | @copybrief QtMvvm::SettingsElements::Group::title - tooltip | string | Empty | @copybrief QtMvvm::SettingsElements::Group::tooltip - frontends | @ref settings_xml_types_descriptor | Empty | @copybrief QtMvvm::SettingsElements::Group::frontends - selectors | @ref settings_xml_types_descriptor | Empty | @copybrief QtMvvm::SettingsElements::Group::selectors + Name | Type | Default | Translated | Description +------------|---------------------------------------|---------------|---------------|------------- + title | string | Empty | yes | @copybrief QtMvvm::SettingsElements::Group::title + tooltip | string | Empty | yes | @copybrief QtMvvm::SettingsElements::Group::tooltip + frontends | @ref settings_xml_types_descriptor | Empty | no | @copybrief QtMvvm::SettingsElements::Group::frontends + selectors | @ref settings_xml_types_descriptor | Empty | no | @copybrief QtMvvm::SettingsElements::Group::selectors @subsubsection settings_xml_elements_group_elements Content Can be an arbitrary number of Elements from the following list. However, only one type of @@ -112,15 +126,15 @@ be of the same type as well: The `` element is mapped to the QtMvvm::SettingsElements::Entry. @subsubsection settings_xml_elements_entry_attribs Attributes - Name | Type | Default | Description -----------------|---------------------------------------|-------------------|------------- - key | string | Empty | @copybrief QtMvvm::SettingsElements::Entry::key - type | @ref settings_xml_types_type | `"QString"` | @copybrief QtMvvm::SettingsElements::Entry::type - title | string | Empty | @copybrief QtMvvm::SettingsElements::Entry::title - tooltip | string | Empty | @copybrief QtMvvm::SettingsElements::Entry::tooltip - defaultValue | variant | Invalid | @copybrief QtMvvm::SettingsElements::Entry::defaultValue - frontends | @ref settings_xml_types_descriptor | Empty | @copybrief QtMvvm::SettingsElements::Entry::frontends - selectors | @ref settings_xml_types_descriptor | Empty | @copybrief QtMvvm::SettingsElements::Entry::selectors + Name | Type | Default | Translated | Description +----------------|---------------------------------------|-------------------|---------------|------------- + key | string | Empty | no | @copybrief QtMvvm::SettingsElements::Entry::key + type | @ref settings_xml_types_type | `"QString"` | no | @copybrief QtMvvm::SettingsElements::Entry::type + title | string | Empty | yes | @copybrief QtMvvm::SettingsElements::Entry::title + tooltip | string | Empty | yes | @copybrief QtMvvm::SettingsElements::Entry::tooltip + defaultValue | variant | Invalid | yes | @copybrief QtMvvm::SettingsElements::Entry::defaultValue + frontends | @ref settings_xml_types_descriptor | Empty | no | @copybrief QtMvvm::SettingsElements::Entry::frontends + selectors | @ref settings_xml_types_descriptor | Empty | no | @copybrief QtMvvm::SettingsElements::Entry::selectors @subsubsection settings_xml_elements_entry_elements Content Can be an arbitrary number of Elements from the following list. They can be mixed and in any @@ -133,7 +147,7 @@ order The `` Element is converted to a string added to the QtMvvm::SettingsElements::Entry::searchKeys property. A searchkey can only be a child of an Entry, and all the keys are merged to a list. It's a leaf element and must contain the string -that becomes the search key +that becomes the search key. The contens of the search key will be translated. @subsection settings_xml_elements_property Property The `` Element is an XML description of a generic QVariant property. Each property @@ -142,11 +156,12 @@ parent element. Properties can be children of entries, as well as properties and long as for the last two their type is `object` @subsubsection settings_xml_elements_property_attribs Attributes - Name | Type | Default | Description ---------|-------------------------------|-------------------|------------- - key | string | Required | The key of the property - type | @ref settings_xml_types_type | Required | The type of the properties value - ts | bool | `false` | Specify whether the properties value should be translated. Does not apply to `list` or `object` types + Name | Type | Default | Translated | Description +--------|-------------------------------|-------------------|---------------|------------- + key | string | Required | no | The key of the property + type | @ref settings_xml_types_type | Required | no | The type of the properties value + ts | bool | `false` | no | Specify whether the properties value (content) should be translated. Does not apply to `list` or `object` types + @subsubsection settings_xml_elements_property_elements Content The content depend on the `type` attribute. The following tables shows which type leads @@ -165,10 +180,10 @@ QVariant values. Each element can be of a different type, but typically they all same. @subsubsection settings_xml_elements_element_attribs Attributes - Name | Type | Default | Description ---------|-------------------------------|-------------------|------------- - type | @ref settings_xml_types_type | Required | The type of the list element - ts | bool | `false` | Specify whether the element value should be translated. Does not apply to `list` or `object` types + Name | Type | Default | Translated | Description +--------|-------------------------------|-------------------|---------------|------------- + type | @ref settings_xml_types_type | Required | no | The type of the list element + ts | bool | `false` | no | Specify whether the element value (content) should be translated. Does not apply to `list` or `object` types @subsubsection settings_xml_elements_element_elements Content The content depend on the `type` attribute. The following tables shows which type leads @@ -190,9 +205,9 @@ element must be a `` element (Each element that support includes as one c marked as primary). It is possible to specify an include element in another included document. @subsubsection settings_xml_elements_include_attribs Attributes - Name | Type | Default | Description -------------|-------|-----------|------------- - optional | bool | `false` | An optional include. If the file cannot be found it is skipped instead of aborting with an error + Name | Type | Default | Translated | Description +------------|-------|-----------|---------------|------------- + optional | bool | `false` | no | An optional include. If the file cannot be found it is skipped instead of aborting with an error @subsubsection settings_xml_elements_include_elements Content The content of the include element must be a path to an XML file to be read as include. If the @@ -278,6 +293,10 @@ will trigger QtMvvm::SettingsViewModel::callAction. The Entries `key` attribute the first parameter to the method. The parameters can be specified by adding a `` to the entry with the key `args` and the type `object`. The property of this object are the elements of the map passed as the second parameter. -*/ -//! TODO add small sample code snippits? +@section settings_xml_sample Sample settings XML file +The following code block is a sample settings XML file. It is the same that is beeing used in +the example application. + +@include settings.xml +*/ diff --git a/examples/mvvmcore/SampleCore/SampleCore.pro b/examples/mvvmcore/SampleCore/SampleCore.pro index 90e2948..96991ab 100644 --- a/examples/mvvmcore/SampleCore/SampleCore.pro +++ b/examples/mvvmcore/SampleCore/SampleCore.pro @@ -26,7 +26,7 @@ RESOURCES += \ sample_core.qrc QTMVVM_TS_SETTINGS += settings.xml -_never_true_condition: SOURCES += $$files($$PWD/.ts-dummy/*) #TODO document +_never_true_condition: SOURCES += $$files($$PWD/.ts-dummy/*) PRE_TARGETDEPS += qtmvvm-tsgen TRANSLATIONS += samplecore_de.ts diff --git a/src/imports/mvvmquick/PresentingStackView.qml b/src/imports/mvvmquick/PresentingStackView.qml index e05016f..94ac8f1 100644 --- a/src/imports/mvvmquick/PresentingStackView.qml +++ b/src/imports/mvvmquick/PresentingStackView.qml @@ -78,10 +78,13 @@ StackView { * * Use this method in your main presenter to present items via this sub presenter. * + * If the presented item has a boolean property named `presentAsRoot`, the item will + * replace all contents on the stack instead of beeing pushed on it. + * * @sa QtMvvmApp::presentItem, @ref QtQuick.Item "Item" */ function presentItem(item) { - if(item.presentAsRoot) { //TODO document + if(typeof item.presentAsRoot == "boolean" && item.presentAsRoot) { if(safeReplace(null, item)) return true; else diff --git a/src/mvvmcore/coreapp.cpp b/src/mvvmcore/coreapp.cpp index 9b7f06c..3a211c8 100644 --- a/src/mvvmcore/coreapp.cpp +++ b/src/mvvmcore/coreapp.cpp @@ -90,7 +90,7 @@ void CoreApp::bootApp() if(res == EXIT_SUCCESS) { connect(qApp, &QCoreApplication::aboutToQuit, this, &CoreApp::closeApp); - emit appStarted(); + emit appStarted({}); } else qApp->exit(res); } diff --git a/src/mvvmcore/coreapp.h b/src/mvvmcore/coreapp.h index 83fee3b..65870e5 100644 --- a/src/mvvmcore/coreapp.h +++ b/src/mvvmcore/coreapp.h @@ -51,7 +51,7 @@ public Q_SLOTS: Q_SIGNALS: //! Is emitted once the app has successfully started - void appStarted(); + void appStarted(QPrivateSignal); protected: //! Is called as part of the app registration, before any view setups diff --git a/src/mvvmcore/injection.h b/src/mvvmcore/injection.h index 14f9b95..8787e6a 100644 --- a/src/mvvmcore/injection.h +++ b/src/mvvmcore/injection.h @@ -6,7 +6,6 @@ //! The primary namespace of the QtMvvm library namespace QtMvvm { -//TODO sa in service registry //! Registers QVariant converters from QObject to an interface type registered with Q_DECLARE_INTERFACE template inline void registerInterfaceConverter() { diff --git a/src/mvvmcore/message.cpp b/src/mvvmcore/message.cpp index e0129d3..bd5e341 100644 --- a/src/mvvmcore/message.cpp +++ b/src/mvvmcore/message.cpp @@ -265,7 +265,7 @@ void MessageResult::setAutoDelete(bool autoDelete) return; d->autoDelete = autoDelete; - emit autoDeleteChanged(autoDelete); + emit autoDeleteChanged(autoDelete, {}); } // ------------- Private Implementation ------------- diff --git a/src/mvvmcore/message.h b/src/mvvmcore/message.h index 5607066..a82ed57 100644 --- a/src/mvvmcore/message.h +++ b/src/mvvmcore/message.h @@ -218,10 +218,10 @@ public Q_SLOTS: Q_SIGNALS: //! Is emitted as soon as the dialog was completed - void dialogDone(QtMvvm::MessageConfig::StandardButton button); + void dialogDone(QtMvvm::MessageConfig::StandardButton button, QPrivateSignal); //! @notifyAcFn{MessageResult::autoDelete} - void autoDeleteChanged(bool autoDelete); + void autoDeleteChanged(bool autoDelete, QPrivateSignal); private: QScopedPointer d; @@ -321,7 +321,7 @@ Q_MVVMCORE_EXPORT MessageResult *getInput(const QString &title, const QVariantMap &viewProperties = {}, const QString &okText = {}, const QString &cancelText = {}); -//! @copydoc QtMvvm::getInput(const QString &, const QString &, const char *, const std::function &, const QVariant &, const QVariantMap &, const QString &, const QString &) +//! @copybrief QtMvvm::getInput(const QString &, const QString &, const char *, const std::function &, const QVariant &, const QVariantMap &, const QString &, const QString &) Q_MVVMCORE_EXPORT void getInput(const QString &title, const QString &text, const char *inputType, @@ -331,7 +331,7 @@ Q_MVVMCORE_EXPORT void getInput(const QString &title, const QVariantMap &viewProperties = {}, const QString &okText = {}, const QString &cancelText = {}); -//! @copydoc QtMvvm::getInput(const QString &, const QString &, const char *, const QVariant &, const QVariantMap &, const QString &, const QString &) +//! @copybrief QtMvvm::getInput(const QString &, const QString &, const char *, const QVariant &, const QVariantMap &, const QString &, const QString &) Q_MVVMCORE_EXPORT void getInput(const QString &title, const QString &text, const char *inputType, @@ -351,7 +351,7 @@ inline MessageResult *getInput(const QString &title, const QString &cancelText = {}) { return getInput(title, text, QMetaType::typeName(qMetaTypeId()), QVariant::fromValue(defaultValue), viewProperties, okText, cancelText); } -//! @copydoc QtMvvm::getInput(const QString &, const QString &, const std::function &, const TEdit &, const QVariantMap &, const QString &, const QString &) +//! @copybrief QtMvvm::getInput(const QString &, const QString &, const std::function &, const TEdit &, const QVariantMap &, const QString &, const QString &) template inline void getInput(const QString &title, const QString &text, @@ -365,7 +365,7 @@ inline void getInput(const QString &title, onResult(v.template value(), v.isValid()); }, QVariant::fromValue(defaultValue), viewProperties, okText, cancelText); } -//! @copydoc QtMvvm::getInput(const QString &, const QString &, const TEdit &, const QVariantMap &, const QString &, const QString &) +//! @copybrief QtMvvm::getInput(const QString &, const QString &, const TEdit &, const QVariantMap &, const QString &, const QString &) template inline void getInput(const QString &title, const QString &text, @@ -387,59 +387,59 @@ inline void getInput(const QString &title, //! @brief A shortcut to show a file dialog to select an existing directory Q_MVVMCORE_EXPORT MessageResult *getExistingDirectory(const QString &title = {}, const QUrl &dir = {}); -//! @copydoc QtMvvm::getExistingDirectory(const std::function &, const QString &, const QUrl &) +//! @copybrief QtMvvm::getExistingDirectory(const std::function &, const QString &, const QUrl &) Q_MVVMCORE_EXPORT void getExistingDirectory(QObject *scope, const std::function &onResult, const QString &title = {}, const QUrl &dir = {}); -//! @copydoc QtMvvm::getExistingDirectory(const QString &, const QUrl &) +//! @copybrief QtMvvm::getExistingDirectory(const QString &, const QUrl &) Q_MVVMCORE_EXPORT void getExistingDirectory(const std::function &onResult, const QString &title = {}, const QUrl &dir = {}); -//! @brief A shortcut to show a file dialog to select an existing file +//! A shortcut to show a file dialog to select an existing file Q_MVVMCORE_EXPORT MessageResult *getOpenFile(const QString &title = {}, const QStringList &supportedMimeTypes = {}, const QUrl &dir = {}); -//! @copydoc QtMvvm::getOpenFile(const std::function &, const QString &, const QStringList &, const QUrl &) +//! @copybrief QtMvvm::getOpenFile(const std::function &, const QString &, const QStringList &, const QUrl &) Q_MVVMCORE_EXPORT void getOpenFile(QObject *scope, const std::function &onResult, const QString &title = {}, const QStringList &supportedMimeTypes = {}, const QUrl &dir = {}); -//! @copydoc QtMvvm::getOpenFile(const QString &, const QStringList &, const QUrl &) +//! @copybrief QtMvvm::getOpenFile(const QString &, const QStringList &, const QUrl &) Q_MVVMCORE_EXPORT void getOpenFile(const std::function &onResult, const QString &title = {}, const QStringList &supportedMimeTypes = {}, const QUrl &dir = {}); -//! @brief A shortcut to show a file dialog to select multiple existing files +//! A shortcut to show a file dialog to select multiple existing files Q_MVVMCORE_EXPORT MessageResult *getOpenFiles(const QString &title = {}, const QStringList &supportedMimeTypes = {}, const QUrl &dir = {}); -//! @copydoc QtMvvm::getOpenFiles(const std::function)> &, const QString &, const QStringList &, const QUrl &) +//! @copybrief QtMvvm::getOpenFiles(const std::function)> &, const QString &, const QStringList &, const QUrl &) Q_MVVMCORE_EXPORT void getOpenFiles(QObject *scope, const std::function)> &onResult, const QString &title = {}, const QStringList &supportedMimeTypes = {}, const QUrl &dir = {}); -//! @copydoc QtMvvm::getOpenFiles(const QString &, const QStringList &, const QUrl &) +//! @copybrief QtMvvm::getOpenFiles(const QString &, const QStringList &, const QUrl &) Q_MVVMCORE_EXPORT void getOpenFiles(const std::function)> &onResult, const QString &title = {}, const QStringList &supportedMimeTypes = {}, const QUrl &dir = {}); -//! @brief A shortcut to show a file dialog to select a new file for saving +//! A shortcut to show a file dialog to select a new file for saving Q_MVVMCORE_EXPORT MessageResult *getSaveFile(const QString &title = {}, const QStringList &supportedMimeTypes = {}, const QUrl &dir = {}); -//! @copydoc QtMvvm::getSaveFile(const std::function &, const QString &, const QStringList &, const QUrl &) +//! @copybrief QtMvvm::getSaveFile(const std::function &, const QString &, const QStringList &, const QUrl &) Q_MVVMCORE_EXPORT void getSaveFile(QObject *scope, const std::function &onResult, const QString &title = {}, const QStringList &supportedMimeTypes = {}, const QUrl &dir = {}); -//! @copydoc QtMvvm::getSaveFile(const QString &, const QStringList &, const QUrl &) +//! @copybrief QtMvvm::getSaveFile(const QString &, const QStringList &, const QUrl &) Q_MVVMCORE_EXPORT void getSaveFile(const std::function &onResult, const QString &title = {}, const QStringList &supportedMimeTypes = {}, diff --git a/src/mvvmcore/serviceregistry.cpp b/src/mvvmcore/serviceregistry.cpp index b4c5089..2871576 100644 --- a/src/mvvmcore/serviceregistry.cpp +++ b/src/mvvmcore/serviceregistry.cpp @@ -202,7 +202,7 @@ ServiceRegistryPrivate::MetaServiceInfo::MetaServiceInfo(const QMetaObject *meta QObject *ServiceRegistryPrivate::MetaServiceInfo::construct(ServiceRegistryPrivate *d) const { auto instance = d->constructInjectedLocked(metaObject, nullptr); //services are created without a parent - auto initMethod = metaObject->indexOfMethod("qtmvvm_init()"); //TODO document + auto initMethod = metaObject->indexOfMethod("qtmvvm_init()"); if(initMethod != -1) { auto method = metaObject->method(initMethod); method.invoke(instance); diff --git a/src/mvvmcore/settingsviewmodel.cpp b/src/mvvmcore/settingsviewmodel.cpp index 2547842..eb666dc 100644 --- a/src/mvvmcore/settingsviewmodel.cpp +++ b/src/mvvmcore/settingsviewmodel.cpp @@ -87,7 +87,7 @@ void SettingsViewModel::setSettingsSetupLoader(ISettingsSetupLoader *settingsSet return; d->setupLoader = settingsSetupLoader; - emit settingsSetupLoaderChanged(d->setupLoader); + emit settingsSetupLoaderChanged(d->setupLoader, {}); } void SettingsViewModel::onInit(const QVariantHash ¶ms) diff --git a/src/mvvmcore/settingsviewmodel.h b/src/mvvmcore/settingsviewmodel.h index f19fc36..28f9925 100644 --- a/src/mvvmcore/settingsviewmodel.h +++ b/src/mvvmcore/settingsviewmodel.h @@ -69,7 +69,7 @@ public Q_SLOTS: Q_SIGNALS: //! @notifyAcFn{SettingsViewModel::settingsSetupLoader} - void settingsSetupLoaderChanged(QtMvvm::ISettingsSetupLoader* settingsSetupLoader); + void settingsSetupLoaderChanged(QtMvvm::ISettingsSetupLoader* settingsSetupLoader, QPrivateSignal); //! Is emitted when the initialization has been completed and the viewmodel is ready for loading settings void beginLoadSetup(); diff --git a/src/mvvmdatasynccore/datasyncviewmodel.cpp b/src/mvvmdatasynccore/datasyncviewmodel.cpp index a21f3dd..51f5025 100644 --- a/src/mvvmdatasynccore/datasyncviewmodel.cpp +++ b/src/mvvmdatasynccore/datasyncviewmodel.cpp @@ -25,6 +25,11 @@ #undef logCritical #include +#define PSIG(x) [this]() { \ + (this->*(x))(QPrivateSignal{}); \ +} + + using namespace QtMvvm; using namespace QtDataSync; @@ -271,7 +276,7 @@ void DataSyncViewModel::setColorMap(DataSyncViewModel::ColorMap colorMap) return; d->colorMap = colorMap; - emit colorMapChanged(d->colorMap); + emit colorMapChanged(d->colorMap, {}); } void DataSyncViewModel::resetColorMap() @@ -283,7 +288,7 @@ void DataSyncViewModel::resetColorMap() d->colorMap.insert(SyncManager::Synchronized, Qt::darkGreen); d->colorMap.insert(SyncManager::Error, Qt::darkRed); d->colorMap.insert(SyncManager::Disconnected, Qt::darkYellow); - emit colorMapChanged(d->colorMap); + emit colorMapChanged(d->colorMap, {}); } void DataSyncViewModel::showImportDialog(LoginRequest request) @@ -353,9 +358,9 @@ void DataSyncViewModel::onInit(const QVariantHash ¶ms) //sync manager connect(d->syncManager, &SyncManager::syncStateChanged, - this, &DataSyncViewModel::statusStringChanged); + this, PSIG(&DataSyncViewModel::statusStringChanged)); connect(d->syncManager, &SyncManager::lastErrorChanged, - this, &DataSyncViewModel::statusStringChanged); + this, PSIG(&DataSyncViewModel::statusStringChanged)); //account manager connect(d->accountManager, &AccountManager::loginRequested, @@ -371,9 +376,9 @@ void DataSyncViewModel::onInit(const QVariantHash ¶ms) d->accountModel->setup(d->accountManager, d->syncManager); d->sortedModel->sort(0); - emit syncManagerChanged(d->syncManager); - emit accountManagerChanged(d->accountManager); - emit ready(); + emit syncManagerChanged(d->syncManager, {}); + emit accountManagerChanged(d->accountManager, {}); + emit ready({}); } catch(SetupDoesNotExistException &e) { logCritical() << "Failed to init DataSyncViewModel with error:" << e.what(); diff --git a/src/mvvmdatasynccore/datasyncviewmodel.h b/src/mvvmdatasynccore/datasyncviewmodel.h index 4703396..5d53b48 100644 --- a/src/mvvmdatasynccore/datasyncviewmodel.h +++ b/src/mvvmdatasynccore/datasyncviewmodel.h @@ -98,16 +98,16 @@ public Q_SLOTS: Q_SIGNALS: //! @notifyAcFn{DataSyncViewModel::syncManager} - void syncManagerChanged(QtDataSync::SyncManager* syncManager); + void syncManagerChanged(QtDataSync::SyncManager* syncManager, QPrivateSignal); //! @notifyAcFn{DataSyncViewModel::accountManager} - void accountManagerChanged(QtDataSync::AccountManager* accountManager); + void accountManagerChanged(QtDataSync::AccountManager* accountManager, QPrivateSignal); //! @notifyAcFn{DataSyncViewModel::colorMap} - void colorMapChanged(ColorMap colorMap); + void colorMapChanged(ColorMap colorMap, QPrivateSignal); //! @notifyAcFn{DataSyncViewModel::statusString} - void statusStringChanged(); + void statusStringChanged(QPrivateSignal); //! Is emitted as soon as all the datasync managers have been initialized - void ready(); + void ready(QPrivateSignal); protected: void onInit(const QVariantHash ¶ms) override; diff --git a/src/mvvmdatasynccore/networkexchangeviewmodel.cpp b/src/mvvmdatasynccore/networkexchangeviewmodel.cpp index 0358fd0..d874245 100644 --- a/src/mvvmdatasynccore/networkexchangeviewmodel.cpp +++ b/src/mvvmdatasynccore/networkexchangeviewmodel.cpp @@ -14,6 +14,10 @@ #undef logCritical #include +#define PSIGARG(x, argt) [this](argt arg) { \ + (this->*(x))(arg, QPrivateSignal{}); \ +} + using namespace QtMvvm; using namespace QtDataSync; @@ -98,7 +102,7 @@ void NetworkExchangeViewModel::setPort(quint16 port) return; d->port = port; - emit portChanged(d->port); + emit portChanged(d->port, {}); } void NetworkExchangeViewModel::setDeviceName(QString deviceName) @@ -132,20 +136,20 @@ void NetworkExchangeViewModel::onInit(const QVariantHash ¶ms) } connect(d->exchangeManager->accountManager(), &AccountManager::deviceNameChanged, - this, &NetworkExchangeViewModel::deviceNameChanged); + this, PSIGARG(&NetworkExchangeViewModel::deviceNameChanged, QString)); connect(d->exchangeManager, &UserExchangeManager::userDataReceived, this, &NetworkExchangeViewModel::newUserData); connect(d->exchangeManager, &UserExchangeManager::exchangeError, this, &NetworkExchangeViewModel::exchangeError); connect(d->exchangeManager, &UserExchangeManager::activeChanged, - this, &NetworkExchangeViewModel::activeChanged); + this, PSIGARG(&NetworkExchangeViewModel::activeChanged, bool)); - emit userExchangeManagerChanged(d->exchangeManager); - emit deviceNameChanged(deviceName()); + emit userExchangeManagerChanged(d->exchangeManager, {}); + emit deviceNameChanged(deviceName(), {}); d->deviceModel->setup(d->exchangeManager); d->sortedModel->sort(0); - emit ready(); + emit ready({}); } catch(SetupDoesNotExistException &e) { logCritical() << "Failed to init DataSyncViewModel with error:" << e.what(); diff --git a/src/mvvmdatasynccore/networkexchangeviewmodel.h b/src/mvvmdatasynccore/networkexchangeviewmodel.h index e6a9531..7b2c95d 100644 --- a/src/mvvmdatasynccore/networkexchangeviewmodel.h +++ b/src/mvvmdatasynccore/networkexchangeviewmodel.h @@ -74,16 +74,16 @@ public Q_SLOTS: Q_SIGNALS: //! Is emitted as soon as all the user exchange manager has been initialized - void ready(); + void ready(QPrivateSignal); //! @notifyAcFn{NetworkExchangeViewModel::userExchangeManager} - void userExchangeManagerChanged(QtDataSync::UserExchangeManager* userExchangeManager); + void userExchangeManagerChanged(QtDataSync::UserExchangeManager* userExchangeManager, QPrivateSignal); //! @notifyAcFn{NetworkExchangeViewModel::port} - void portChanged(quint16 port); + void portChanged(quint16 port, QPrivateSignal); //! @notifyAcFn{NetworkExchangeViewModel::deviceName} - void deviceNameChanged(QString deviceName); + void deviceNameChanged(QString deviceName, QPrivateSignal); //! @notifyAcFn{NetworkExchangeViewModel::active} - void activeChanged(bool active); + void activeChanged(bool active, QPrivateSignal); protected: void onInit(const QVariantHash ¶ms) override; diff --git a/src/mvvmquick/quickpresenter.cpp b/src/mvvmquick/quickpresenter.cpp index 6490537..19c830a 100644 --- a/src/mvvmquick/quickpresenter.cpp +++ b/src/mvvmquick/quickpresenter.cpp @@ -100,7 +100,7 @@ InputViewFactory *QuickPresenter::inputViewFactory() const void QuickPresenter::setInputViewFactory(InputViewFactory *inputViewFactory) { d->inputViewFactory = inputViewFactory; - emit inputViewFactoryChanged(inputViewFactory); + emit inputViewFactoryChanged(inputViewFactory, {}); } QUrl QuickPresenter::findViewUrl(const QMetaObject *viewModelType) diff --git a/src/mvvmquick/quickpresenter.h b/src/mvvmquick/quickpresenter.h index db05ca3..c5ea44d 100644 --- a/src/mvvmquick/quickpresenter.h +++ b/src/mvvmquick/quickpresenter.h @@ -57,7 +57,7 @@ public Q_SLOTS: Q_SIGNALS: //! @notifyAcFn{QuickPresenter::inputViewFactory} - void inputViewFactoryChanged(InputViewFactory* inputViewFactory); + void inputViewFactoryChanged(InputViewFactory* inputViewFactory, QPrivateSignal); protected: //! Is called to find the URL of the view to be used for the given viewmodel diff --git a/src/mvvmwidgets/widgetspresenter.cpp b/src/mvvmwidgets/widgetspresenter.cpp index 1d92b63..f823670 100644 --- a/src/mvvmwidgets/widgetspresenter.cpp +++ b/src/mvvmwidgets/widgetspresenter.cpp @@ -124,7 +124,7 @@ InputWidgetFactory *WidgetsPresenter::inputWidgetFactory() const void WidgetsPresenter::setInputWidgetFactory(InputWidgetFactory *inputWidgetFactory) { d->inputViewFactory = inputWidgetFactory; - emit inputWidgetFactoryChanged(inputWidgetFactory); + emit inputWidgetFactoryChanged(inputWidgetFactory, {}); } const QMetaObject *WidgetsPresenter::findWidgetMetaObject(const QMetaObject *viewModelMetaObject) @@ -254,7 +254,7 @@ void WidgetsPresenter::presentMessageBox(const MessageConfig &config, QPointer checked; - auto props = config.viewProperties(); //TODO document all these + auto props = config.viewProperties(); if(!props.value(QStringLiteral("modal"), false).toBool()) info.parent = QApplication::activeWindow(); if(props.contains(QStringLiteral("windowTitle"))) diff --git a/src/mvvmwidgets/widgetspresenter.h b/src/mvvmwidgets/widgetspresenter.h index f60f1dd..4245805 100644 --- a/src/mvvmwidgets/widgetspresenter.h +++ b/src/mvvmwidgets/widgetspresenter.h @@ -58,7 +58,7 @@ public Q_SLOTS: Q_SIGNALS: //! @notifyAcFn{WidgetsPresenter::inputWidgetFactory} - void inputWidgetFactoryChanged(InputWidgetFactory* inputWidgetFactory); + void inputWidgetFactoryChanged(InputWidgetFactory* inputWidgetFactory, QPrivateSignal); protected: //! Is called to find the meta object of the view to be used for the given viewmodel