├── .gitignore
├── .qmake.conf
├── .travis.yml
├── LICENSE
├── ProjectTemplate
├── App.qml
├── app.cpp
├── app.h
├── core.pro
├── core.qrc
├── git.ignore
├── icon.png
├── icon@2x.png
├── project.pro
├── quick.pro
├── quick.qrc
├── quick_main.cpp
├── settings.xml
├── view.qml
├── viewmodel.cpp
├── viewmodel.h
├── widgets.pro
├── widgets_main.cpp
├── window.cpp
├── window.h
├── window.ui
└── wizard.json
├── README.md
├── appveyor.yml
├── deploy.json
├── doc
├── Doxyfile
├── binding.dox
├── coreapp.dox
├── datasyncsettingsentry.dox
├── datasyncsettingsviewmodel.dox
├── datasyncviewmodel.dox
├── doc.pro
├── doxme.py
├── gh_header.html
├── images.dox
├── images
│ ├── GitHub_Logo.png
│ ├── quick
│ │ ├── quick_about.png
│ │ ├── quick_drawer.png
│ │ ├── quick_ds_edit.png
│ │ ├── quick_ds_exchange.png
│ │ ├── quick_ds_export.png
│ │ ├── quick_ds_grant.png
│ │ ├── quick_ds_import.png
│ │ ├── quick_ds_import_trust.png
│ │ ├── quick_ds_main_1.png
│ │ ├── quick_ds_main_2.png
│ │ ├── quick_ds_remote.png
│ │ ├── quick_ds_reset.png
│ │ ├── quick_file.png
│ │ ├── quick_input.png
│ │ ├── quick_main.png
│ │ ├── quick_message.png
│ │ ├── quick_result.png
│ │ ├── quick_settings_1.png
│ │ ├── quick_settings_2.png
│ │ └── quick_tabs.png
│ ├── sample_basic_quick.gif
│ ├── sample_basic_widgets.gif
│ └── widgets
│ │ ├── widgets_about.png
│ │ ├── widgets_ds_edit.png
│ │ ├── widgets_ds_exchange.png
│ │ ├── widgets_ds_export.png
│ │ ├── widgets_ds_grant.png
│ │ ├── widgets_ds_import.png
│ │ ├── widgets_ds_import_trust.png
│ │ ├── widgets_ds_main.png
│ │ ├── widgets_ds_remote.png
│ │ ├── widgets_ds_reset.png
│ │ ├── widgets_file.png
│ │ ├── widgets_input.png
│ │ ├── widgets_main.png
│ │ ├── widgets_message.png
│ │ ├── widgets_result.png
│ │ ├── widgets_settings.png
│ │ └── widgets_tabs.png
├── injection.dox
├── inputviewfactory.dox
├── inputwidgetfactory.dox
├── ipresenter.dox
├── ipresentingview.dox
├── isettingsaccessor.dox
├── makedoc.sh
├── message.dox
├── networkexchangeviewmodel.dox
├── qsettingsgenerator.dox
├── qtmvvm.dox
├── quickpresenter.dox
├── serviceregistry.dox
├── settingssetup.dox
├── settingsviewmodel.dox
├── settingsxml.dox
├── snippets
│ └── generatortest.xml
├── viewmodel.dox
└── widgetspresenter.dox
├── examples
├── examples.pro
├── mvvmcore
│ ├── DroidSettings
│ │ ├── DroidSettings.pro
│ │ ├── main.cpp
│ │ ├── main.qml
│ │ ├── qml.qrc
│ │ ├── settings.cpp
│ │ └── settings.h
│ ├── SampleCore
│ │ ├── SampleCore.pro
│ │ ├── containerviewmodel.cpp
│ │ ├── containerviewmodel.h
│ │ ├── drawerviewmodel.cpp
│ │ ├── drawerviewmodel.h
│ │ ├── echoservice.cpp
│ │ ├── echoservice.h
│ │ ├── ieventservice.h
│ │ ├── resultviewmodel.cpp
│ │ ├── resultviewmodel.h
│ │ ├── sample_core.qrc
│ │ ├── samplecore_de.ts
│ │ ├── samplecoreapp.cpp
│ │ ├── samplecoreapp.h
│ │ ├── sampleviewmodel.cpp
│ │ ├── sampleviewmodel.h
│ │ ├── settings.xml
│ │ ├── tabviewmodel.cpp
│ │ └── tabviewmodel.h
│ └── mvvmcore.pro
├── mvvmdatasynccore
│ ├── DataSyncSampleCore
│ │ ├── DataSyncSampleCore.pro
│ │ ├── docker-compose.yaml
│ │ ├── samplecoreapp.cpp
│ │ ├── samplecoreapp.h
│ │ ├── sampledata.cpp
│ │ ├── sampledata.h
│ │ ├── sampleviewmodel.cpp
│ │ └── sampleviewmodel.h
│ └── mvvmdatasynccore.pro
├── mvvmdatasyncquick
│ ├── DataSyncSampleQuick
│ │ ├── DataSyncSampleQuick.pro
│ │ ├── SampleView.qml
│ │ ├── main.cpp
│ │ ├── main.qml
│ │ └── qml.qrc
│ └── mvvmdatasyncquick.pro
├── mvvmdatasyncwidgets
│ ├── DataSyncSampleWidgets
│ │ ├── DataSyncSampleWidgets.pro
│ │ ├── main.cpp
│ │ ├── samplewindow.cpp
│ │ ├── samplewindow.h
│ │ └── samplewindow.ui
│ └── mvvmdatasyncwidgets.pro
├── mvvmquick
│ ├── SampleQuick
│ │ ├── ChildView.qml
│ │ ├── ContainerView.qml
│ │ ├── DrawerView.qml
│ │ ├── ResultView.qml
│ │ ├── SampleQuick.pro
│ │ ├── SampleView.qml
│ │ ├── TabItemView.qml
│ │ ├── TabView.qml
│ │ ├── main.cpp
│ │ ├── main.qml
│ │ ├── qml.qrc
│ │ ├── quickeventservice.cpp
│ │ └── quickeventservice.h
│ └── mvvmquick.pro
└── mvvmwidgets
│ ├── SampleWidgets
│ ├── SampleWidgets.pro
│ ├── main.cpp
│ ├── resultdialog.cpp
│ ├── resultdialog.h
│ ├── resultdialog.ui
│ ├── sampleview.cpp
│ ├── sampleview.h
│ ├── sampleview.ui
│ ├── tabitemview.cpp
│ ├── tabitemview.h
│ ├── tabitemview.ui
│ ├── tabview.cpp
│ ├── tabview.h
│ ├── tabview.ui
│ ├── widgetseventservice.cpp
│ └── widgetseventservice.h
│ └── mvvmwidgets.pro
├── mkspecs
└── features
│ ├── qsettingsgenerator.prf
│ └── qsettingstranslator.prf
├── qbs
└── Qt
│ └── settingsgenerator
│ └── module.qbs
├── qtmvvm.pro
├── src
├── 3rdparty
│ ├── optional-lite
│ │ ├── LICENSE.txt
│ │ └── optional.hpp
│ └── variant-lite
│ │ ├── LICENSE.txt
│ │ └── variant.hpp
├── imports
│ ├── imports.pro
│ ├── mvvmcore
│ │ ├── mvvmcore.pro
│ │ ├── plugins.qmltypes
│ │ ├── qmldir
│ │ ├── qqmlcoreapp.cpp
│ │ ├── qqmlcoreapp.h
│ │ ├── qqmlmvvmbinding.cpp
│ │ ├── qqmlmvvmbinding.h
│ │ ├── qqmlmvvmmessage.cpp
│ │ ├── qqmlmvvmmessage.h
│ │ ├── qqmlserviceregistry.cpp
│ │ ├── qqmlserviceregistry.h
│ │ ├── qtmvvmcore_plugin.cpp
│ │ └── qtmvvmcore_plugin.h
│ ├── mvvmdatasynccore
│ │ ├── mvvmdatasynccore.pro
│ │ ├── plugins.qmltypes
│ │ ├── qmldir
│ │ ├── qtmvvmdatasynccore_plugin.cpp
│ │ └── qtmvvmdatasynccore_plugin.h
│ ├── mvvmdatasyncquick
│ │ ├── ChangeRemoteView.qml
│ │ ├── DataSyncView.qml
│ │ ├── ExportSetupView.qml
│ │ ├── IdentityEditView.qml
│ │ ├── NetworkExchangeView.qml
│ │ ├── icons
│ │ │ ├── ic_add_white_24px.svg
│ │ │ ├── ic_call_made_white_24px.svg
│ │ │ ├── ic_call_received_white_24px.svg
│ │ │ ├── ic_check_white_24px.svg
│ │ │ ├── ic_delete_forever_white_24px.svg
│ │ │ ├── ic_fingerprint_white_24px.svg
│ │ │ ├── ic_import_export_white_24px.svg
│ │ │ └── ic_sync_white_24px.svg
│ │ ├── mvvmdatasyncquick.json
│ │ ├── mvvmdatasyncquick.pro
│ │ ├── plugins.qmltypes
│ │ ├── qmldir
│ │ ├── qtmvvmdatasyncquick_plugin.cpp
│ │ ├── qtmvvmdatasyncquick_plugin.h
│ │ └── qtmvvmdatasyncquick_plugin.qrc
│ └── mvvmquick
│ │ ├── .gitignore
│ │ ├── ActionButton.qml
│ │ ├── AlertDialog.qml
│ │ ├── AndroidFileDialog.qml
│ │ ├── AndroidFolderDialog.qml
│ │ ├── ColorEdit.qml
│ │ ├── ColorHelper.qml
│ │ ├── ContrastToolBar.qml
│ │ ├── DateEdit.qml
│ │ ├── DecorLabel.qml
│ │ ├── DialogPresenter.qml
│ │ ├── DialogPresenter10.qml
│ │ ├── FileDialog.qml
│ │ ├── FolderDialog.qml
│ │ ├── InputDialog.qml
│ │ ├── ListSection.qml
│ │ ├── MenuButton.qml
│ │ ├── MsgBox.qml
│ │ ├── MsgBoxBase.qml
│ │ ├── MsgDelegate.qml
│ │ ├── OverviewListView.qml
│ │ ├── PopupPresenter.qml
│ │ ├── PopupPresenter10.qml
│ │ ├── PresenterProgress.qml
│ │ ├── PresentingDrawer.qml
│ │ ├── PresentingStackView.qml
│ │ ├── PresentingStackView10.qml
│ │ ├── ProgressDialog.qml
│ │ ├── QtMvvmApp.qml
│ │ ├── QtMvvmApp10.qml
│ │ ├── RoundActionButton.qml
│ │ ├── RoundMenuButton.qml
│ │ ├── SearchBar.qml
│ │ ├── SectionListView.qml
│ │ ├── SettingsView.qml
│ │ ├── TimeEdit.qml
│ │ ├── TimeTumbler.qml
│ │ ├── TintIcon.qml
│ │ ├── ToolBarLabel.qml
│ │ ├── androidfilechooser.cpp
│ │ ├── androidfilechooser.h
│ │ ├── icons
│ │ ├── ic_chevron_right_white_24px.svg
│ │ ├── ic_close_white_24px.svg
│ │ ├── ic_error_white_24px.svg
│ │ ├── ic_help_white_24px.svg
│ │ ├── ic_info_white_24px.svg
│ │ ├── ic_more_vert_white_24px.svg
│ │ ├── ic_navigate_before_white_24px.svg
│ │ ├── ic_navigate_next_white_24px.svg
│ │ ├── ic_search_white_24px.svg
│ │ ├── ic_settings_backup_restore_white_24px.svg
│ │ ├── ic_settings_white_24px.svg
│ │ └── ic_warning_white_24px.svg
│ │ ├── multifilterproxymodel.cpp
│ │ ├── multifilterproxymodel.h
│ │ ├── mvvmquick.pro
│ │ ├── plugins.qmltypes
│ │ ├── qmldir
│ │ ├── qqmlquickpresenter.cpp
│ │ ├── qqmlquickpresenter.h
│ │ ├── qqmlviewplaceholder.cpp
│ │ ├── qqmlviewplaceholder.h
│ │ ├── qtmvvmquick_plugin.cpp
│ │ ├── qtmvvmquick_plugin.h
│ │ ├── qtmvvmquick_plugin.qrc
│ │ ├── settingsentrymodel.cpp
│ │ ├── settingsentrymodel.h
│ │ ├── settingssectionmodel.cpp
│ │ ├── settingssectionmodel.h
│ │ ├── settingsuibuilder.cpp
│ │ └── settingsuibuilder.h
├── jar
│ ├── jar.pro
│ └── src
│ │ └── de
│ │ └── skycoder42
│ │ └── qtmvvm
│ │ └── core
│ │ └── AndroidSettingsAccessor.java
├── mvvmcore
│ ├── androidsettingsaccessor.cpp
│ ├── androidsettingsaccessor.h
│ ├── androidsettingsaccessor_p.h
│ ├── binding.cpp
│ ├── binding.h
│ ├── binding_p.h
│ ├── coreapp.cpp
│ ├── coreapp.h
│ ├── coreapp_p.h
│ ├── exception.h
│ ├── injection.h
│ ├── ipresenter.cpp
│ ├── ipresenter.h
│ ├── isettingsaccessor.cpp
│ ├── isettingsaccessor.h
│ ├── message.cpp
│ ├── message.h
│ ├── message_p.h
│ ├── mvvmcore.pro
│ ├── qsettingsaccessor.cpp
│ ├── qsettingsaccessor.h
│ ├── qtmvvm_logging_p.h
│ ├── qtmvvmcore_global.cpp
│ ├── qtmvvmcore_global.h
│ ├── qtmvvmcore_helpertypes.h
│ ├── serviceregistry.cpp
│ ├── serviceregistry.h
│ ├── serviceregistry_p.h
│ ├── settingsconfigloader.cpp
│ ├── settingsconfigloader_p.h
│ ├── settingsentry.cpp
│ ├── settingsentry.h
│ ├── settingssetup.h
│ ├── settingsviewmodel.cpp
│ ├── settingsviewmodel.h
│ ├── settingsviewmodel_p.h
│ ├── translations
│ │ ├── qtmvvmcore_de.ts
│ │ └── qtmvvmcore_template.ts
│ ├── viewmodel.cpp
│ ├── viewmodel.h
│ └── viewmodel_p.h
├── mvvmdatasynccore
│ ├── accountmodel.cpp
│ ├── accountmodel.h
│ ├── accountmodel_p.h
│ ├── application-x-datasync-account-data.xml
│ ├── changeremoteviewmodel.cpp
│ ├── changeremoteviewmodel_p.h
│ ├── datasyncsettingsaccessor.cpp
│ ├── datasyncsettingsaccessor.h
│ ├── datasyncsettingsaccessor_p.h
│ ├── datasyncsettingsentry.cpp
│ ├── datasyncsettingsentry.h
│ ├── datasyncsettingsviewmodel.cpp
│ ├── datasyncsettingsviewmodel.h
│ ├── datasyncviewmodel.cpp
│ ├── datasyncviewmodel.h
│ ├── datasyncviewmodel_p.h
│ ├── exchangedevicesmodel.cpp
│ ├── exchangedevicesmodel.h
│ ├── exchangedevicesmodel_p.h
│ ├── exportsetupviewmodel.cpp
│ ├── exportsetupviewmodel_p.h
│ ├── identityeditviewmodel.cpp
│ ├── identityeditviewmodel_p.h
│ ├── mvvmdatasynccore.pro
│ ├── networkexchangeviewmodel.cpp
│ ├── networkexchangeviewmodel.h
│ ├── networkexchangeviewmodel_p.h
│ ├── qtmvvmdatasynccore_global.h
│ └── translations
│ │ ├── qtmvvmdatasynccore_de.ts
│ │ └── qtmvvmdatasynccore_template.ts
├── mvvmdatasyncquick
│ ├── ChangeRemoteView.qml
│ ├── DataSyncView.qml
│ ├── ExportSetupView.qml
│ ├── IdentityEditView.qml
│ ├── NetworkExchangeView.qml
│ ├── mvvmdatasyncquick.pro
│ ├── qtmvvmdatasyncquick_global.cpp
│ ├── qtmvvmdatasyncquick_global.h
│ ├── qtmvvmdatasyncquick_module.qrc
│ └── translations
│ │ ├── qtmvvmdatasyncquick_de.ts
│ │ └── qtmvvmdatasyncquick_template.ts
├── mvvmdatasyncwidgets
│ ├── changeremotedialog.cpp
│ ├── changeremotedialog.ui
│ ├── changeremotedialog_p.h
│ ├── datasyncwindow.cpp
│ ├── datasyncwindow.h
│ ├── datasyncwindow.ui
│ ├── datasyncwindow_p.h
│ ├── exportsetupdialog.cpp
│ ├── exportsetupdialog.ui
│ ├── exportsetupdialog_p.h
│ ├── icons
│ │ ├── add.ico
│ │ ├── arrow_refresh.ico
│ │ ├── card_export.ico
│ │ ├── card_import.ico
│ │ ├── delete.ico
│ │ ├── fingerprint.ico
│ │ ├── key_go.ico
│ │ ├── server_edit.ico
│ │ ├── user.ico
│ │ ├── user_delete.ico
│ │ └── world_go.ico
│ ├── identityeditdialog.cpp
│ ├── identityeditdialog.ui
│ ├── identityeditdialog_p.h
│ ├── mvvmdatasyncwidgets.pro
│ ├── networkexchangewindow.cpp
│ ├── networkexchangewindow.h
│ ├── networkexchangewindow.ui
│ ├── networkexchangewindow_p.h
│ ├── qtmvvmdatasyncwidgets_global.cpp
│ ├── qtmvvmdatasyncwidgets_global.h
│ ├── qtmvvmdatasyncwidgets_module.qrc
│ └── translations
│ │ ├── qtmvvmdatasyncwidgets_de.ts
│ │ └── qtmvvmdatasyncwidgets_template.ts
├── mvvmquick
│ ├── BoolDelegate.qml
│ ├── CheckBox.qml
│ ├── ColorDelegate.qml
│ ├── ColorEdit.qml
│ ├── DateEdit.qml
│ ├── DateTimeEdit.qml
│ ├── DoubleSpinBox.qml
│ ├── FontEdit.qml
│ ├── ListDelegate.qml
│ ├── ListEdit.qml
│ ├── MsgDelegate.qml
│ ├── RadioListEdit.qml
│ ├── RangeDelegate.qml
│ ├── SettingsView.qml
│ ├── Slider.qml
│ ├── SpinBox.qml
│ ├── Switch.qml
│ ├── SwitchDelegate.qml
│ ├── TextField.qml
│ ├── TimeEdit.qml
│ ├── UrlField.qml
│ ├── formatters_p.h
│ ├── inputviewfactory.cpp
│ ├── inputviewfactory.h
│ ├── inputviewfactory_p.h
│ ├── mvvmquick.pro
│ ├── qtmvvmquick_global.h
│ ├── qtmvvmquick_module.qrc
│ ├── quickpresenter.cpp
│ ├── quickpresenter.h
│ ├── quickpresenter_p.h
│ └── translations
│ │ ├── qtmvvmquick_de.ts
│ │ └── qtmvvmquick_template.ts
├── mvvmwidgets
│ ├── coloredit.cpp
│ ├── coloredit_p.h
│ ├── fontcombobox.cpp
│ ├── fontcombobox_p.h
│ ├── inputwidgetfactory.cpp
│ ├── inputwidgetfactory.h
│ ├── inputwidgetfactory_p.h
│ ├── ipresentingview.h
│ ├── mvvmwidgets.pro
│ ├── progressdialog.cpp
│ ├── progressdialog_p.h
│ ├── qtmvvmwidgets_global.h
│ ├── qtmvvmwidgets_module.qrc
│ ├── selectcombobox.cpp
│ ├── selectcombobox_p.h
│ ├── setting_tools.ico
│ ├── settingsdialog.cpp
│ ├── settingsdialog.h
│ ├── settingsdialog.ui
│ ├── settingsdialog_p.h
│ ├── tooltipslider.cpp
│ ├── tooltipslider_p.h
│ ├── translations
│ │ ├── qtmvvmwidgets_de.ts
│ │ └── qtmvvmwidgets_template.ts
│ ├── widgetspresenter.cpp
│ ├── widgetspresenter.h
│ └── widgetspresenter_p.h
├── settingsconfig
│ ├── prefix_p.h
│ ├── settingsconfig.pri
│ ├── settingsconfig.qrc
│ ├── settingsconfig.xsd
│ ├── settingsconfigimpl.cpp
│ └── settingsconfigimpl_p.h
└── src.pro
├── sync.profile
├── tests
├── auto
│ ├── auto.pro
│ ├── cmake
│ │ ├── CMakeLists.txt
│ │ └── cmake.pro
│ ├── mvvmcore
│ │ ├── binding
│ │ │ ├── binding.pro
│ │ │ └── tst_binding.cpp
│ │ ├── coreapp
│ │ │ ├── coreapp.pro
│ │ │ ├── testapp.cpp
│ │ │ ├── testapp.h
│ │ │ ├── testpresenter.cpp
│ │ │ ├── testpresenter.h
│ │ │ ├── testviewmodel.cpp
│ │ │ ├── testviewmodel.h
│ │ │ └── tst_coreapp.cpp
│ │ ├── mvvmcore.pro
│ │ ├── qsettingsaccessor
│ │ │ ├── qsettingsaccessor.pro
│ │ │ └── tst_qsettingsaccessor.cpp
│ │ ├── serviceregistry
│ │ │ ├── plugintestinterface.h
│ │ │ ├── serviceregistry.pro
│ │ │ ├── testinterface.h
│ │ │ ├── testobject.cpp
│ │ │ ├── testobject.h
│ │ │ ├── testservice.cpp
│ │ │ ├── testservice.h
│ │ │ └── tst_serviceregistry.cpp
│ │ ├── serviceregistrytestplugin
│ │ │ ├── serviceregistrytestplugin.json
│ │ │ ├── serviceregistrytestplugin.pro
│ │ │ ├── testplugin.cpp
│ │ │ └── testplugin.h
│ │ ├── settingsconfigloader
│ │ │ ├── categoryDocument.xml
│ │ │ ├── entryDocument.xml
│ │ │ ├── groupDocument.xml
│ │ │ ├── includeDocument.xml
│ │ │ ├── includeDocument_category.xml
│ │ │ ├── includeDocument_entry.xml
│ │ │ ├── includeDocument_filtered.xml
│ │ │ ├── includeDocument_group.xml
│ │ │ ├── includeDocument_section.xml
│ │ │ ├── invalidDocument.xml
│ │ │ ├── sectionDocument.xml
│ │ │ ├── selectorDocument.xml
│ │ │ ├── settingsconfigloader.pro
│ │ │ └── tst_settingsconfigloader.cpp
│ │ └── settingsgenerator
│ │ │ ├── generatortest.xml
│ │ │ ├── import_config.xml
│ │ │ ├── import_normal.xml
│ │ │ ├── importtest.xml
│ │ │ ├── settingsgenerator.pro
│ │ │ ├── test_de.ts
│ │ │ ├── testbackend.cpp
│ │ │ ├── testbackend.h
│ │ │ ├── translatortest.xml
│ │ │ └── tst_settingsgenerator.cpp
│ ├── mvvmdatasynccore
│ │ ├── datasyncsettingsaccessor
│ │ │ ├── datasyncsettingsaccessor.pro
│ │ │ └── tst_datasyncsettingsaccessor.cpp
│ │ └── mvvmdatasynccore.pro
│ ├── qml
│ │ ├── qml.pro
│ │ ├── qmlmvvmcore
│ │ │ ├── qmlmvvmcore.pro
│ │ │ ├── tst_qmlmvvmcore.cpp
│ │ │ └── tst_qmlmvvmcore.qml
│ │ └── qmlsettingsgenerator
│ │ │ ├── .gitignore
│ │ │ ├── generatortest.xml
│ │ │ ├── qmlsettingsgenerator.pro
│ │ │ ├── testbackend.cpp
│ │ │ ├── testbackend.h
│ │ │ ├── tst_qmlsettingsgenerator.cpp
│ │ │ ├── tst_qmlsettingsgenerator.qml
│ │ │ └── tst_qmlsettingsgenerator.qmlc
│ └── testrun.pri
├── global
│ └── global.cfg
├── shared
│ └── tst_isettingsaccessor.h
└── tests.pro
└── tools
├── settingsgenerator
├── cppsettingsgenerator.cpp
├── cppsettingsgenerator.h
├── main.cpp
├── qmlsettingsgenerator.cpp
├── qmlsettingsgenerator.h
├── qsettingsgenerator.qrc
├── qsettingsgenerator.xsd
├── settingsgenerator.pro
├── settingsgeneratorimpl.cpp
├── settingsgeneratorimpl.h
├── settingstranslator.cpp
└── settingstranslator.h
└── tools.pro
/.gitignore:
--------------------------------------------------------------------------------
1 | # This file is used to ignore files which are generated
2 | # ----------------------------------------------------------------------------
3 |
4 | *~
5 | *.autosave
6 | *.a
7 | *.core
8 | *.moc
9 | *.o
10 | *.obj
11 | *.orig
12 | *.rej
13 | *.so
14 | *.so.*
15 | *_pch.h.cpp
16 | *_resource.rc
17 | *.qm
18 | .#*
19 | *.*#
20 | core
21 | !core/
22 | tags
23 | .DS_Store
24 | .directory
25 | *.debug
26 | Makefile*
27 | *.prl
28 | *.app
29 | moc_*.cpp
30 | ui_*.h
31 | qrc_*.cpp
32 | Thumbs.db
33 | *.res
34 | *.rc
35 | /.qmake.cache
36 | /.qmake.stash
37 |
38 | # qtcreator generated files
39 | *.pro.user*
40 |
41 | # xemacs temporary files
42 | *.flc
43 |
44 | # Vim temporary files
45 | .*.swp
46 |
47 | # Visual Studio generated files
48 | *.ib_pdb_index
49 | *.idb
50 | *.ilk
51 | *.pdb
52 | *.sln
53 | *.suo
54 | *.vcproj
55 | *vcproj.*.*.user
56 | *.ncb
57 | *.sdf
58 | *.opensdf
59 | *.vcxproj
60 | *vcxproj.*
61 |
62 | # MinGW generated files
63 | *.Debug
64 | *.Release
65 |
66 | # Python byte code
67 | *.pyc
68 |
69 | # Binaries
70 | # --------
71 | *.dll
72 | *.exe
73 |
74 | # qpmx
75 | qpmx.user.json
76 |
77 | # ts dummy dirs
78 | .ts-dummy
79 | .qpmx-dev-cache
80 | qpmx.json.user
81 | *.pro.dummy
82 | *.qmlc
83 |
--------------------------------------------------------------------------------
/.qmake.conf:
--------------------------------------------------------------------------------
1 | load(qt_build_config)
2 |
3 | CONFIG += warning_clean exceptions c++17
4 | !win32: CONFIG += samples_in_build #TODO fix on win
5 | DEFINES += QT_DEPRECATED_WARNINGS QT_ASCII_CAST_WARNINGS
6 |
7 | QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14
8 | QMAKE_IOS_DEPLOYMENT_TARGET = 12.0
9 |
10 | !no_qtquickcompiler: CONFIG += qtquickcompiler
11 |
12 | MODULE_VERSION_MAJOR = 1
13 | MODULE_VERSION_MINOR = 1
14 | MODULE_VERSION_PATCH = 5
15 | MODULE_VERSION_IMPORT = $${MODULE_VERSION_MAJOR}.$${MODULE_VERSION_MINOR}
16 | MODULE_VERSION = $${MODULE_VERSION_MAJOR}.$${MODULE_VERSION_MINOR}.$${MODULE_VERSION_PATCH}
17 |
--------------------------------------------------------------------------------
/ProjectTemplate/App.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import de.skycoder42.QtMvvm.Quick 1.0
3 |
4 | QtMvvmApp {
5 | title: qsTr("%{ProjectName}")
6 | }
7 |
--------------------------------------------------------------------------------
/ProjectTemplate/app.cpp:
--------------------------------------------------------------------------------
1 | #include "%{AppHdrName}"
2 | #include "%{VmHdrName}"
3 |
4 | #include
5 |
6 | %{AppCn}::%{AppCn}(QObject *parent) :
7 | CoreApp(parent)
8 | {
9 | QCoreApplication::setApplicationName(QStringLiteral("%{ProjectName}"));
10 | QCoreApplication::setApplicationVersion(QStringLiteral("1.0.0"));
11 | QCoreApplication::setOrganizationName(QStringLiteral("Example Organization"));
12 | }
13 |
14 | void %{AppCn}::performRegistrations()
15 | {
16 | //if you are using a qt resource (e.g. "%{AppQrcFile}"), initialize it here
17 | @if '%{UseSettings}'
18 | Q_INIT_RESOURCE(%{AppQrcName});
19 | @else
20 | //Q_INIT_RESOURCE(%{AppQrcName});
21 | @endif
22 | }
23 |
24 | int %{AppCn}::startApp(const QStringList &arguments)
25 | {
26 | QCommandLineParser parser;
27 | parser.addVersionOption();
28 | parser.addHelpOption();
29 |
30 | //add more options
31 |
32 | //shows help or version automatically
33 | if(!autoParse(parser, arguments))
34 | return EXIT_SUCCESS;
35 |
36 | //show a viewmodel to complete the startup
37 | show<%{VmCn}>();
38 | return EXIT_SUCCESS;
39 | }
40 |
--------------------------------------------------------------------------------
/ProjectTemplate/app.h:
--------------------------------------------------------------------------------
1 | #ifndef %{AppGuard}
2 | #define %{AppGuard}
3 |
4 | #include
5 |
6 | class %{AppCn} : public QtMvvm::CoreApp
7 | {
8 | Q_OBJECT
9 |
10 | public:
11 | explicit %{AppCn}(QObject *parent = nullptr);
12 |
13 | protected:
14 | void performRegistrations() override;
15 | int startApp(const QStringList &arguments) override;
16 | };
17 |
18 | #undef coreApp
19 | #define coreApp static_cast<%{AppCn}*>(CoreApp::instance())
20 |
21 | #endif // %{AppGuard}
22 |
--------------------------------------------------------------------------------
/ProjectTemplate/core.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = lib
2 |
3 | QT += mvvmcore
4 | # Creating a static library is typically more efficient. You can still create a shared library if you want to
5 | CONFIG += c++14 static
6 |
7 | TARGET = %{CoreName}
8 |
9 | DEFINES += QT_DEPRECATED_WARNINGS
10 |
11 | HEADERS += \\
12 | %{AppHdrName} \\
13 | %{VmHdrName}
14 |
15 | SOURCES += \\
16 | %{AppSrcName} \\
17 | %{VmSrcName}
18 |
19 | @if '%{UseSettings}'
20 | RESOURCES += \\
21 | %{AppQrcFile}
22 |
23 | @endif
24 | TRANSLATIONS += %{ProjectLowerName}_core_de.ts \\
25 | %{ProjectLowerName}_core_template.ts
26 |
27 | DISTFILES += $$TRANSLATIONS
28 | @if '%{UseSettings}'
29 | QTMVVM_TS_SETTINGS = settings.xml
30 | _never_true_condition: SOURCES += $$files($$PWD/.ts-dummy/*)
31 | # Uncomment the following line to automatically generated and update settings translations when building
32 | #PRE_TARGETDEPS += qtmvvm-tsgen
33 | @endif
34 |
--------------------------------------------------------------------------------
/ProjectTemplate/core.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | settings.xml
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ProjectTemplate/git.ignore:
--------------------------------------------------------------------------------
1 | # This file is used to ignore files which are generated
2 | # ----------------------------------------------------------------------------
3 |
4 | *~
5 | *.autosave
6 | *.a
7 | *.core
8 | *.moc
9 | *.o
10 | *.obj
11 | *.orig
12 | *.rej
13 | *.so
14 | *.so.*
15 | *_pch.h.cpp
16 | *_resource.rc
17 | *.qm
18 | .#*
19 | *.*#
20 | core
21 | !core/
22 | tags
23 | .DS_Store
24 | .directory
25 | *.debug
26 | Makefile*
27 | *.prl
28 | *.app
29 | moc_*.cpp
30 | ui_*.h
31 | qrc_*.cpp
32 | Thumbs.db
33 | *.res
34 | *.rc
35 | /.qmake.cache
36 | /.qmake.stash
37 |
38 | # qtcreator generated files
39 | *.pro.user*
40 |
41 | # xemacs temporary files
42 | *.flc
43 |
44 | # Vim temporary files
45 | .*.swp
46 |
47 | # Visual Studio generated files
48 | *.ib_pdb_index
49 | *.idb
50 | *.ilk
51 | *.pdb
52 | *.sln
53 | *.suo
54 | *.vcproj
55 | *vcproj.*.*.user
56 | *.ncb
57 | *.sdf
58 | *.opensdf
59 | *.vcxproj
60 | *vcxproj.*
61 |
62 | # MinGW generated files
63 | *.Debug
64 | *.Release
65 |
66 | # Python byte code
67 | *.pyc
68 |
69 | # Binaries
70 | # --------
71 | *.dll
72 | *.exe
73 |
74 | # qpmx
75 | .qpmx-dev-cache
76 | *.cppdummy
77 |
--------------------------------------------------------------------------------
/ProjectTemplate/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/ProjectTemplate/icon.png
--------------------------------------------------------------------------------
/ProjectTemplate/icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/ProjectTemplate/icon@2x.png
--------------------------------------------------------------------------------
/ProjectTemplate/project.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | SUBDIRS += \\
4 | @if '%{CreateWidgets}'
5 | %{WidgetsName} \\
6 | @endif
7 | @if '%{CreateQuick}'
8 | %{QuickName} \\
9 | @endif
10 | %{CoreName}
11 |
12 | @if '%{CreateWidgets}'
13 | %{WidgetsName}.depends += %{CoreName}
14 | @endif
15 | @if '%{CreateQuick}'
16 | %{QuickName}.depends += %{CoreName}
17 | @endif
18 |
--------------------------------------------------------------------------------
/ProjectTemplate/quick.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | App.qml
4 |
5 |
6 | %{QuickQmlName}
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ProjectTemplate/quick_main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include <%{AppHdrName}>
4 | #include <%{VmHdrName}>
5 |
6 | QTMVVM_REGISTER_CORE_APP(%{AppCn})
7 |
8 | int main(int argc, char *argv[])
9 | {
10 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
11 | // If you want to support file dialogs on platforms other then android, use a QApplication instead (and add QT += widgets to the pro file)
12 | QGuiApplication app(argc, argv);
13 |
14 | QtMvvm::QuickPresenter::getInputViewFactory(); //Workaround for QTBUG-69963
15 | qmlRegisterUncreatableType<%{VmCn}>("com.example.%{ProjectLowerName}", 1, 0, "%{VmCn}", "ViewModels cannot be created!");
16 |
17 | QQmlApplicationEngine engine;
18 | engine.load(QUrl(QStringLiteral("qrc:/App.qml")));
19 | if (engine.rootObjects().isEmpty())
20 | return -1;
21 |
22 | return app.exec();
23 | }
24 |
--------------------------------------------------------------------------------
/ProjectTemplate/settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/ProjectTemplate/viewmodel.cpp:
--------------------------------------------------------------------------------
1 | #include "%{VmHdrName}"
2 | @if '%{UseSettings}'
3 |
4 | #include
5 | @endif
6 |
7 | %{VmCn}::%{VmCn}(QObject *parent) :
8 | ViewModel(parent),
9 | _text(QStringLiteral("hello world"))
10 | {}
11 |
12 | QString %{VmCn}::text() const
13 | {
14 | return _text;
15 | }
16 |
17 | @if '%{UseSettings}'
18 | void %{VmCn}::showSettings()
19 | {
20 | show();
21 | }
22 |
23 | @endif
24 | void %{VmCn}::setText(const QString &text)
25 | {
26 | if (_text == text)
27 | return;
28 |
29 | _text = text;
30 | emit textChanged(_text);
31 | }
32 |
--------------------------------------------------------------------------------
/ProjectTemplate/viewmodel.h:
--------------------------------------------------------------------------------
1 | #ifndef %{VmGuard}
2 | #define %{VmGuard}
3 |
4 | #include
5 |
6 | class %{VmCn} : public QtMvvm::ViewModel
7 | {
8 | Q_OBJECT
9 |
10 | Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
11 |
12 | public:
13 | Q_INVOKABLE explicit %{VmCn}(QObject *parent = nullptr);
14 |
15 | QString text() const;
16 |
17 | public Q_SLOTS:
18 | @if '%{UseSettings}'
19 | void showSettings();
20 |
21 | @endif
22 | void setText(const QString &text);
23 |
24 | Q_SIGNALS:
25 | void textChanged(const QString &text);
26 |
27 | private:
28 | QString _text;
29 | };
30 |
31 | #endif // %{VmGuard}
32 |
--------------------------------------------------------------------------------
/ProjectTemplate/widgets.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 |
3 | QT += widgets mvvmwidgets
4 | CONFIG += c++14
5 |
6 | TARGET = %{WidgetsName}
7 |
8 | DEFINES += QT_DEPRECATED_WARNINGS
9 |
10 | HEADERS += %{WindowHdrName}
11 |
12 | SOURCES += main.cpp \\
13 | %{WindowSrcName}
14 |
15 | FORMS += %{WindowFormName}
16 |
17 | TRANSLATIONS += %{ProjectLowerName}_widgets_de.ts \\
18 | %{ProjectLowerName}_widgets_template.ts
19 |
20 | # Link with core project
21 | win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../%{CoreName}/release/ -l%{CoreName}
22 | else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../%{CoreName}/debug/ -l%{CoreName}
23 | else:unix: LIBS += -L$$OUT_PWD/../%{CoreName}/ -l%{CoreName}
24 |
25 | INCLUDEPATH += $$PWD/../%{CoreName}
26 | DEPENDPATH += $$PWD/../%{CoreName}
27 |
28 | win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../%{CoreName}/release/lib%{CoreName}.a
29 | else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../%{CoreName}/debug/lib%{CoreName}.a
30 | else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../%{CoreName}/release/%{CoreName}.lib
31 | else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$OUT_PWD/../%{CoreName}/debug/%{CoreName}.lib
32 | else:unix: PRE_TARGETDEPS += $$OUT_PWD/../%{CoreName}/lib%{CoreName}.a
33 |
--------------------------------------------------------------------------------
/ProjectTemplate/widgets_main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include <%{AppHdrName}>
4 |
5 | #include "%{WindowHdrName}"
6 |
7 | // Register the core app
8 | QTMVVM_REGISTER_CORE_APP(%{AppCn})
9 |
10 | int main(int argc, char *argv[])
11 | {
12 | QApplication a(argc, argv);
13 |
14 | // Automatically sets "WidgetPresenter" as presenter and registers the %{WindowName} class as a widget
15 | // The viewmodel this widget belongs to is detected automatically via naming conventions
16 | QtMvvm::WidgetsPresenter::registerView<%{WindowCn}>();
17 |
18 | return a.exec();
19 | }
20 |
--------------------------------------------------------------------------------
/ProjectTemplate/window.cpp:
--------------------------------------------------------------------------------
1 | #include "%{WindowHdrName}"
2 | #include "ui_%{WindowHdrName}"
3 |
4 | #include
5 |
6 | %{WindowCn}::%{WindowCn}(QtMvvm::ViewModel *viewModel, QWidget *parent) :
7 | QMainWindow(parent),
8 | _viewModel(static_cast<%{VmCn}*>(viewModel)),
9 | _ui(new Ui::%{WindowCn})
10 | {
11 | _ui->setupUi(this);
12 | @if '%{UseSettings}'
13 |
14 | connect(_ui->actionSettings, &QAction::triggered,
15 | _viewModel, &%{VmCn}::showSettings);
16 | @endif
17 |
18 | QtMvvm::bind(_viewModel, "text",
19 | _ui->lineEdit, "text");
20 | QtMvvm::bind(_viewModel, "text",
21 | _ui->label, "text",
22 | QtMvvm::Binding::OneWayToView);
23 | }
24 |
25 | %{WindowCn}::~%{WindowCn}()
26 | {
27 | delete _ui;
28 | }
29 |
--------------------------------------------------------------------------------
/ProjectTemplate/window.h:
--------------------------------------------------------------------------------
1 | #ifndef %{WindowGuard}
2 | #define %{WindowGuard}
3 |
4 | #include
5 |
6 | #include <%{VmHdrName}>
7 |
8 | namespace Ui {
9 | class %{WindowCn};
10 | }
11 |
12 | class %{WindowCn} : public QMainWindow
13 | {
14 | Q_OBJECT
15 |
16 | public:
17 | Q_INVOKABLE %{WindowCn}(QtMvvm::ViewModel *viewModel, QWidget *parent = nullptr);
18 | ~%{WindowCn}();
19 |
20 | private:
21 | %{VmCn} *_viewModel;
22 | Ui::%{WindowCn} *_ui;
23 | };
24 |
25 | #endif // %{WindowGuard}
26 |
--------------------------------------------------------------------------------
/deploy.json:
--------------------------------------------------------------------------------
1 | {
2 | "title": "QtMvvm",
3 | "description": "A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel.",
4 | "modules": [
5 | "QtMvvmCore",
6 | "QtMvvmWidgets",
7 | "QtMvvmQuick",
8 | "QtMvvmDataSyncCore",
9 | "QtMvvmDataSyncWidgets",
10 | "QtMvvmDataSyncQuick"
11 | ],
12 | "dependencies": [
13 | ".skycoder42.datasync"
14 | ],
15 | "excludes": [],
16 | "license": {
17 | "name": "BSD-3-Clause",
18 | "path": "LICENSE"
19 | },
20 | "installs": {
21 | "ProjectTemplate": "Tools/QtCreator/share/qtcreator/templates/wizards/projects/qtmvvm",
22 | "qbs/Qt/settingsgenerator": "Tools/QtCreator/share/qtcreator/qbs/share/qbs/modules/Qt/settingsgenerator"
23 | },
24 | "hostbuilds": [
25 | "bin/qsettingsgenerator*"
26 | ]
27 | }
28 |
--------------------------------------------------------------------------------
/doc/doc.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = aux
2 |
3 | OTHER_FILES += Doxyfile \
4 | makedoc.sh \
5 | doxme.py \
6 | ../README.md \
7 | *.dox \
8 | snippets/*.cpp \
9 | images/* \
10 | gh_header.html
11 |
12 | system($$QMAKE_MKDIR $$shell_quote($$shell_path($$OUT_PWD/qtmvvm)))
13 |
14 | docTarget.target = doxygen
15 | docTarget.commands = $$PWD/makedoc.sh "$$PWD" "$$MODULE_VERSION" "$$[QT_INSTALL_BINS]" "$$[QT_INSTALL_HEADERS]" "$$[QT_INSTALL_DOCS]"
16 | QMAKE_EXTRA_TARGETS += docTarget
17 |
18 | docInst1.path = $$[QT_INSTALL_DOCS]
19 | docInst1.files = $$OUT_PWD/qtmvvm.qch
20 | docInst1.CONFIG += no_check_exist
21 | docInst2.path = $$[QT_INSTALL_DOCS]
22 | docInst2.files = $$OUT_PWD/qtmvvm
23 | INSTALLS += docInst1 docInst2
24 |
--------------------------------------------------------------------------------
/doc/doxme.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | # $1 The readme to be transformed
3 | # $pwd: dest dir
4 |
5 | import sys
6 |
7 | def readFirst(line, out):
8 | if line[0:2] != "# ":
9 | raise ValueError("Expected first line to start with '# '")
10 | # skip the first line
11 | out.write("[TOC]\n\n")
12 |
13 | readCounter = 0
14 | def readMore(line, out):
15 | global readCounter
16 | if line[0:2] == "##":
17 | out.write(line[1:] + " {{#qtmvvm_readme_label_{}}}\n".format(readCounter))
18 | readCounter += 1
19 | else:
20 | out.write(line + "\n")
21 |
22 | #read args
23 | readme = sys.argv[1]
24 | doxme = "./README.md"
25 |
26 | inFile = open(readme, "r")
27 | outFile = open(doxme, "w")
28 |
29 | isFirst = True
30 | for line in inFile:
31 | if isFirst:
32 | readFirst(line[:-1], outFile)
33 | isFirst = False
34 | else:
35 | readMore(line[:-1], outFile)
36 |
37 | inFile.close();
38 | outFile.close();
39 |
--------------------------------------------------------------------------------
/doc/images/GitHub_Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/GitHub_Logo.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_about.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_about.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_drawer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_drawer.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_ds_edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_ds_edit.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_ds_exchange.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_ds_exchange.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_ds_export.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_ds_export.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_ds_grant.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_ds_grant.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_ds_import.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_ds_import.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_ds_import_trust.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_ds_import_trust.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_ds_main_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_ds_main_1.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_ds_main_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_ds_main_2.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_ds_remote.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_ds_remote.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_ds_reset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_ds_reset.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_file.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_input.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_input.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_main.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_message.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_result.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_settings_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_settings_1.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_settings_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_settings_2.png
--------------------------------------------------------------------------------
/doc/images/quick/quick_tabs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/quick/quick_tabs.png
--------------------------------------------------------------------------------
/doc/images/sample_basic_quick.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/sample_basic_quick.gif
--------------------------------------------------------------------------------
/doc/images/sample_basic_widgets.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/sample_basic_widgets.gif
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_about.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_about.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_ds_edit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_ds_edit.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_ds_exchange.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_ds_exchange.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_ds_export.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_ds_export.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_ds_grant.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_ds_grant.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_ds_import.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_ds_import.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_ds_import_trust.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_ds_import_trust.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_ds_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_ds_main.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_ds_remote.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_ds_remote.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_ds_reset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_ds_reset.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_file.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_input.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_input.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_main.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_main.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_message.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_message.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_result.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_result.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_settings.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_settings.png
--------------------------------------------------------------------------------
/doc/images/widgets/widgets_tabs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/doc/images/widgets/widgets_tabs.png
--------------------------------------------------------------------------------
/doc/ipresentingview.dox:
--------------------------------------------------------------------------------
1 | /*!
2 | @class QtMvvm::IPresentingView
3 |
4 | If a the viewmodel of a view that was presented by the WidgetsPresenter as used as the parent
5 | view of another viewmodel, the parent view can implement this interface in order to be used
6 | as presenter for the view of the child viewmodel. In such a case, if the parent view implements
7 | this interface, the tryPresent() method is called to try the presentation of the child view
8 |
9 | @sa #QtMvvm_IPresentingViewIid, WidgetsPresenter
10 | */
11 |
12 | /*!
13 | @fn QtMvvm::IPresentingView::tryPresent
14 |
15 | @param view The view that is tryed to be presented
16 | @returns `true` if successfully presented, `false` if not
17 |
18 | If true is returned, the presenter assumes presentation was successful and thus completes. If
19 | false is returned, it resumes presenting the view normally, just as if that interface was never
20 | implemented
21 | */
22 |
--------------------------------------------------------------------------------
/examples/examples.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | SUBDIRS = mvvmcore \
4 | mvvmwidgets \
5 | mvvmquick
6 |
7 | mvvmwidgets.depends += mvvmcore
8 | mvvmquick.depends += mvvmcore
9 |
10 | qtHaveModule(datasync) {
11 | SUBDIRS += mvvmdatasynccore \
12 | mvvmdatasyncwidgets \
13 | mvvmdatasyncquick
14 |
15 | mvvmdatasyncwidgets.depends += mvvmdatasynccore
16 | mvvmdatasyncquick.depends += mvvmdatasynccore
17 | }
18 |
--------------------------------------------------------------------------------
/examples/mvvmcore/DroidSettings/DroidSettings.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 |
3 | QT += quick mvvmcore
4 |
5 | TARGET = DroidSettings
6 |
7 | SOURCES += \
8 | main.cpp \
9 | settings.cpp
10 |
11 | RESOURCES += qml.qrc
12 |
13 | target.path = $$[QT_INSTALL_EXAMPLES]/mvvmcore/$$TARGET
14 | INSTALLS += target
15 |
16 | HEADERS += \
17 | settings.h
18 |
--------------------------------------------------------------------------------
/examples/mvvmcore/DroidSettings/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "settings.h"
5 |
6 | int main(int argc, char *argv[])
7 | {
8 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
9 |
10 | QGuiApplication app(argc, argv);
11 |
12 | Settings settings;
13 |
14 | QQmlApplicationEngine engine;
15 | engine.rootContext()->setContextProperty(QStringLiteral("settings"), &settings);
16 | engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
17 | if (engine.rootObjects().isEmpty())
18 | return -1;
19 |
20 | return app.exec();
21 | }
22 |
--------------------------------------------------------------------------------
/examples/mvvmcore/DroidSettings/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 |
5 |
6 |
--------------------------------------------------------------------------------
/examples/mvvmcore/DroidSettings/settings.cpp:
--------------------------------------------------------------------------------
1 | #include "settings.h"
2 |
3 | Settings::Settings(QObject *parent) :
4 | QObject{parent},
5 | _accessor{new QtMvvm::AndroidSettingsAccessor{}}
6 | {
7 | connect(_accessor, &QtMvvm::AndroidSettingsAccessor::entryChanged,
8 | this, &Settings::entryChanged);
9 | connect(_accessor, &QtMvvm::AndroidSettingsAccessor::entryRemoved,
10 | this, &Settings::entryRemoved);
11 | }
12 |
13 | QString Settings::load(const QString &key)
14 | {
15 | return _accessor->load(key, tr("")).toString();
16 | }
17 |
18 | void Settings::save(const QString &key, const QString &value)
19 | {
20 | _accessor->save(key, value);
21 | }
22 |
23 | void Settings::remove(const QString &key)
24 | {
25 | _accessor->remove(key);
26 | }
27 |
28 | void Settings::entryChanged(const QString &key, const QVariant &value)
29 | {
30 | emit changeEvent(tr("Data for key <%1> changed to: %2")
31 | .arg(key, value.toString()));
32 | }
33 |
34 | void Settings::entryRemoved(const QString &key)
35 | {
36 | emit changeEvent(tr("Data for key <%1> removed").arg(key));
37 | }
38 |
--------------------------------------------------------------------------------
/examples/mvvmcore/DroidSettings/settings.h:
--------------------------------------------------------------------------------
1 | #ifndef SETTINGS_H
2 | #define SETTINGS_H
3 |
4 | #include
5 | #include
6 |
7 | class Settings : public QObject
8 | {
9 | Q_OBJECT
10 |
11 | public:
12 | explicit Settings(QObject *parent = nullptr);
13 |
14 | Q_INVOKABLE QString load(const QString &key);
15 |
16 | public Q_SLOTS:
17 | void save(const QString &key, const QString &value);
18 | void remove(const QString &key);
19 |
20 | Q_SIGNALS:
21 | void changeEvent(const QString &text);
22 |
23 | private Q_SLOTS:
24 | void entryChanged(const QString &key, const QVariant &value);
25 | void entryRemoved(const QString &key);
26 |
27 | private:
28 | QtMvvm::AndroidSettingsAccessor *_accessor;
29 | };
30 |
31 | #endif // SETTINGS_H
32 |
--------------------------------------------------------------------------------
/examples/mvvmcore/SampleCore/SampleCore.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = lib
2 |
3 | QT = core gui mvvmcore
4 | CONFIG += static
5 |
6 | TARGET = SampleCore
7 |
8 | HEADERS += \
9 | samplecoreapp.h \
10 | sampleviewmodel.h \
11 | ieventservice.h \
12 | echoservice.h \
13 | resultviewmodel.h \
14 | drawerviewmodel.h \
15 | tabviewmodel.h \
16 | containerviewmodel.h
17 |
18 | SOURCES += \
19 | samplecoreapp.cpp \
20 | sampleviewmodel.cpp \
21 | echoservice.cpp \
22 | resultviewmodel.cpp \
23 | drawerviewmodel.cpp \
24 | tabviewmodel.cpp \
25 | containerviewmodel.cpp
26 |
27 | RESOURCES += \
28 | sample_core.qrc
29 |
30 | SETTINGS_TRANSLATIONS += settings.xml
31 |
32 | TRANSLATIONS += samplecore_de.ts
33 | DISTFILES += $$TRANSLATIONS
34 |
35 | target.path = $$[QT_INSTALL_EXAMPLES]/mvvmcore/$$TARGET
36 | INSTALLS += target
37 |
--------------------------------------------------------------------------------
/examples/mvvmcore/SampleCore/containerviewmodel.cpp:
--------------------------------------------------------------------------------
1 | #include "containerviewmodel.h"
2 |
3 | ContainerViewModel::ContainerViewModel(QObject *parent) :
4 | ViewModel(parent)
5 | {}
6 |
7 | ContainerViewModel::~ContainerViewModel()
8 | {
9 | qInfo(Q_FUNC_INFO);
10 | }
11 |
12 | QString ContainerViewModel::vmType() const
13 | {
14 | return QString::fromUtf8(QMetaType::typeName(qMetaTypeId()));
15 | }
16 |
17 | void ContainerViewModel::loadChild()
18 | {
19 | show();
20 | }
21 |
22 |
23 |
24 | ChildViewModel::ChildViewModel(QObject *parent) :
25 | ViewModel(parent)
26 | {}
27 |
28 | ChildViewModel::~ChildViewModel()
29 | {
30 | qInfo(Q_FUNC_INFO);
31 | }
32 |
--------------------------------------------------------------------------------
/examples/mvvmcore/SampleCore/containerviewmodel.h:
--------------------------------------------------------------------------------
1 | #ifndef CONTAINERVIEWMODEL_H
2 | #define CONTAINERVIEWMODEL_H
3 |
4 | #include
5 |
6 | class ChildViewModel : public QtMvvm::ViewModel
7 | {
8 | Q_OBJECT
9 |
10 | public:
11 | Q_INVOKABLE explicit ChildViewModel(QObject *parent = nullptr);
12 | ~ChildViewModel();
13 | };
14 |
15 | class ContainerViewModel : public QtMvvm::ViewModel
16 | {
17 | Q_OBJECT
18 |
19 | Q_PROPERTY(QString vmType READ vmType CONSTANT)
20 |
21 | public:
22 | Q_INVOKABLE explicit ContainerViewModel(QObject *parent = nullptr);
23 | ~ContainerViewModel();
24 |
25 | QString vmType() const;
26 |
27 | public Q_SLOTS:
28 | void loadChild();
29 | };
30 |
31 | Q_DECLARE_METATYPE(ChildViewModel*)
32 | Q_DECLARE_METATYPE(ContainerViewModel*)
33 |
34 | #endif // CONTAINERVIEWMODEL_H
35 |
--------------------------------------------------------------------------------
/examples/mvvmcore/SampleCore/drawerviewmodel.cpp:
--------------------------------------------------------------------------------
1 | #include "drawerviewmodel.h"
2 | #include
3 |
4 | #include "sampleviewmodel.h"
5 | #include "tabviewmodel.h"
6 | #include "containerviewmodel.h"
7 |
8 | DrawerViewModel::DrawerViewModel(QObject *parent) :
9 | ViewModel(parent),
10 | _navModel(new QStandardItemModel(0, 1, this))
11 | {
12 | _navModel->appendRow(new QStandardItem(tr("Main Sample")));
13 | _navModel->appendRow(new QStandardItem(tr("Tab Sample")));
14 | _navModel->appendRow(new QStandardItem(tr("View Container Sample")));
15 | _navModel->appendRow(new QStandardItem(tr("Settings")));
16 | }
17 |
18 | DrawerViewModel::~DrawerViewModel()
19 | {
20 | qInfo(Q_FUNC_INFO);
21 | }
22 |
23 | QStandardItemModel *DrawerViewModel::navModel() const
24 | {
25 | return _navModel;
26 | }
27 |
28 | void DrawerViewModel::open(int index)
29 | {
30 | switch (index) {
31 | case 0:
32 | show();
33 | break;
34 | case 1:
35 | show({
36 | {QStringLiteral("title"), QStringLiteral("Root Tab")}
37 | });
38 | break;
39 | case 2:
40 | show();
41 | break;
42 | case 3:
43 | show();
44 | break;
45 | default:
46 | break;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/examples/mvvmcore/SampleCore/drawerviewmodel.h:
--------------------------------------------------------------------------------
1 | #ifndef DRAWERVIEWMODEL_H
2 | #define DRAWERVIEWMODEL_H
3 |
4 | #include
5 | #include
6 |
7 | class DrawerViewModel : public QtMvvm::ViewModel
8 | {
9 | Q_OBJECT
10 |
11 | Q_PROPERTY(QStandardItemModel* navModel READ navModel CONSTANT)
12 |
13 | public:
14 | Q_INVOKABLE explicit DrawerViewModel(QObject *parent = nullptr);
15 | ~DrawerViewModel();
16 |
17 | QStandardItemModel* navModel() const;
18 |
19 | public Q_SLOTS:
20 | void open(int index);
21 |
22 | private:
23 | QStandardItemModel* _navModel;
24 | };
25 |
26 | #endif // DRAWERVIEWMODEL_H
27 |
--------------------------------------------------------------------------------
/examples/mvvmcore/SampleCore/echoservice.cpp:
--------------------------------------------------------------------------------
1 | #include "echoservice.h"
2 |
3 | EchoService::EchoService(QObject *parent) :
4 | QObject(parent)
5 | {}
6 |
7 | void EchoService::ping(const QString &message)
8 | {
9 | emit pong(message);
10 | }
11 |
--------------------------------------------------------------------------------
/examples/mvvmcore/SampleCore/echoservice.h:
--------------------------------------------------------------------------------
1 | #ifndef ECHOSERVICE_H
2 | #define ECHOSERVICE_H
3 |
4 | #include
5 |
6 | class EchoService : public QObject
7 | {
8 | Q_OBJECT
9 |
10 | public:
11 | Q_INVOKABLE explicit EchoService(QObject *parent = nullptr);
12 |
13 | public Q_SLOTS:
14 | void ping(const QString &message);
15 |
16 | Q_SIGNALS:
17 | void pong(const QString &message);
18 | };
19 |
20 | #endif // ECHOSERVICE_H
21 |
--------------------------------------------------------------------------------
/examples/mvvmcore/SampleCore/ieventservice.h:
--------------------------------------------------------------------------------
1 | #ifndef IEVENTSERVICE_H
2 | #define IEVENTSERVICE_H
3 |
4 | #include
5 |
6 | class IEventService
7 | {
8 | public:
9 | virtual int addEvent(const QString &name) = 0;
10 | virtual void removeEvent(int eventId) = 0;
11 |
12 | Q_SIGNALS:
13 | virtual void eventTriggered(const QString &event) = 0;
14 | };
15 |
16 | #define IEventServiceIid "de.skycoder42.qtmvvm.sample.IEventService"
17 | Q_DECLARE_INTERFACE(IEventService, IEventServiceIid)
18 | Q_DECLARE_METATYPE(IEventService*)
19 |
20 | #endif // IEVENTSERVICE_H
21 |
--------------------------------------------------------------------------------
/examples/mvvmcore/SampleCore/resultviewmodel.cpp:
--------------------------------------------------------------------------------
1 | #include "resultviewmodel.h"
2 |
3 | ResultViewModel::ResultViewModel(QObject *parent) :
4 | ViewModel(parent),
5 | _result()
6 | {}
7 |
8 | ResultViewModel::~ResultViewModel()
9 | {
10 | qInfo(Q_FUNC_INFO);
11 | }
12 |
13 | QString ResultViewModel::result() const
14 | {
15 | return _result;
16 | }
17 |
18 | void ResultViewModel::done()
19 | {
20 | emit resultReady(_result);
21 | }
22 |
23 | void ResultViewModel::setResult(QString result)
24 | {
25 | if (_result == result)
26 | return;
27 |
28 | _result = std::move(result);
29 | emit resultChanged(_result);
30 | }
31 |
32 | void ResultViewModel::onInit(const QVariantHash ¶ms)
33 | {
34 | setResult(params.value(QStringLiteral("default")).toString());
35 | }
36 |
--------------------------------------------------------------------------------
/examples/mvvmcore/SampleCore/resultviewmodel.h:
--------------------------------------------------------------------------------
1 | #ifndef RESULTVIEWMODEL_H
2 | #define RESULTVIEWMODEL_H
3 |
4 | #include
5 |
6 | class ResultViewModel : public QtMvvm::ViewModel
7 | {
8 | Q_OBJECT
9 |
10 | Q_PROPERTY(QString result READ result WRITE setResult NOTIFY resultChanged)
11 |
12 | public:
13 | Q_INVOKABLE explicit ResultViewModel(QObject *parent = nullptr);
14 | ~ResultViewModel();
15 |
16 | QString result() const;
17 |
18 | public Q_SLOTS:
19 | void done();
20 |
21 | void setResult(QString result);
22 |
23 | Q_SIGNALS:
24 | void resultChanged(QString result);
25 |
26 | protected:
27 | void onInit(const QVariantHash ¶ms) override;
28 |
29 | private:
30 | QString _result;
31 | };
32 |
33 | #endif // RESULTVIEWMODEL_H
34 |
--------------------------------------------------------------------------------
/examples/mvvmcore/SampleCore/sample_core.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | settings.xml
4 |
5 |
6 |
--------------------------------------------------------------------------------
/examples/mvvmcore/SampleCore/samplecoreapp.h:
--------------------------------------------------------------------------------
1 | #ifndef SAMPLECOREAPP_H
2 | #define SAMPLECOREAPP_H
3 |
4 | #include
5 |
6 | class SampleCoreApp : public QtMvvm::CoreApp
7 | {
8 | Q_OBJECT
9 |
10 | Q_PROPERTY(bool showDrawer READ showDrawer WRITE setShowDrawer NOTIFY showDrawerChanged)
11 |
12 | public:
13 | SampleCoreApp(QObject *parent = nullptr);
14 |
15 | bool showDrawer() const;
16 |
17 | public Q_SLOTS:
18 | void setShowDrawer(bool showDrawer);
19 |
20 | Q_SIGNALS:
21 | void showDrawerChanged(bool showDrawer);
22 |
23 | protected:
24 | void performRegistrations() override;
25 | int startApp(const QStringList &arguments) override;
26 |
27 | private:
28 | bool _showDrawer;
29 | };
30 |
31 | #undef coreApp
32 | #define coreApp static_cast(QtMvvm::CoreApp::instance())
33 |
34 | #endif // SAMPLECOREAPP_H
35 |
--------------------------------------------------------------------------------
/examples/mvvmcore/SampleCore/tabviewmodel.cpp:
--------------------------------------------------------------------------------
1 | #include "tabviewmodel.h"
2 | #include
3 |
4 | TabViewModel::TabViewModel(QObject *parent) :
5 | ViewModel(parent)
6 | {}
7 |
8 | TabViewModel::~TabViewModel()
9 | {
10 | qInfo(Q_FUNC_INFO);
11 | }
12 |
13 | void TabViewModel::addTab()
14 | {
15 | QtMvvm::getInput(tr("New Tab"), tr("Enter a tab title:"), this, [this](QString res, bool ok) {
16 | if(ok) {
17 | show({
18 | {QStringLiteral("title"), res}
19 | });
20 | }
21 | });
22 | }
23 |
24 |
25 |
26 | TabItemViewModel::TabItemViewModel(QObject *parent) :
27 | ViewModel(parent),
28 | _title(tr("No Title"))
29 | {}
30 |
31 | TabItemViewModel::~TabItemViewModel()
32 | {
33 | qInfo(Q_FUNC_INFO);
34 | }
35 |
36 | QString TabItemViewModel::title() const
37 | {
38 | return _title;
39 | }
40 |
41 | void TabItemViewModel::onInit(const QVariantHash ¶ms)
42 | {
43 | _title = params.value(QStringLiteral("title"), _title).toString();
44 | emit titleChanged(_title);
45 | }
46 |
--------------------------------------------------------------------------------
/examples/mvvmcore/SampleCore/tabviewmodel.h:
--------------------------------------------------------------------------------
1 | #ifndef TABVIEWMODEL_H
2 | #define TABVIEWMODEL_H
3 |
4 | #include
5 |
6 | class TabViewModel : public QtMvvm::ViewModel
7 | {
8 | Q_OBJECT
9 |
10 | QTMVVM_SINGLETON
11 |
12 | public:
13 | Q_INVOKABLE explicit TabViewModel(QObject *parent = nullptr);
14 | ~TabViewModel();
15 |
16 | public Q_SLOTS:
17 | void addTab();
18 | };
19 |
20 | class TabItemViewModel : public QtMvvm::ViewModel
21 | {
22 | Q_OBJECT
23 |
24 | Q_PROPERTY(QString title READ title NOTIFY titleChanged)
25 |
26 | QTMVVM_CONTAINER_VM(TabViewModel)
27 |
28 | public:
29 | Q_INVOKABLE explicit TabItemViewModel(QObject *parent = nullptr);
30 | ~TabItemViewModel();
31 |
32 | QString title() const;
33 |
34 | Q_SIGNALS:
35 | void titleChanged(QString title);
36 |
37 | protected:
38 | void onInit(const QVariantHash ¶ms) override;
39 |
40 | private:
41 | QString _title;
42 | };
43 |
44 | Q_DECLARE_METATYPE(TabViewModel*)
45 |
46 | #endif // TABVIEWMODEL_H
47 |
--------------------------------------------------------------------------------
/examples/mvvmcore/mvvmcore.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 | QT_FOR_CONFIG += core
3 |
4 | SUBDIRS += \
5 | SampleCore
6 |
7 | android: SUBDIRS += DroidSettings
8 |
--------------------------------------------------------------------------------
/examples/mvvmdatasynccore/DataSyncSampleCore/DataSyncSampleCore.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = lib
2 |
3 | QT = core gui mvvmcore mvvmdatasynccore
4 | CONFIG += static
5 |
6 | TARGET = DataSyncSampleCore
7 |
8 | HEADERS += \
9 | samplecoreapp.h \
10 | sampleviewmodel.h \
11 | sampledata.h
12 |
13 | SOURCES += \
14 | samplecoreapp.cpp \
15 | sampleviewmodel.cpp \
16 | sampledata.cpp
17 |
18 | OTHER_FILES += docker-compose.yaml
19 |
20 | target.path = $$[QT_INSTALL_EXAMPLES]/mvvmdatasynccore/$$TARGET
21 | INSTALLS += target
22 |
--------------------------------------------------------------------------------
/examples/mvvmdatasynccore/DataSyncSampleCore/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | version: '2.2'
2 | services:
3 | datasync_postgres:
4 | container_name: datasync_postgres
5 | image: postgres:latest
6 | environment:
7 | POSTGRES_PASSWORD: baum42
8 | PGDATA: /var/lib/postgresql/data/pgdata
9 | volumes:
10 | - datasync_postgres_data:/var/lib/postgresql/data/pgdata
11 | datasync_qdsapp:
12 | container_name: datasync_qdsapp
13 | image: skycoder42/qdsapp:latest
14 | depends_on:
15 | - datasync_postgres
16 | ports:
17 | - "4242:4242/tcp"
18 | environment:
19 | QDSAPP_DATABASE_HOST: datasync_postgres
20 | QDSAPP_DATABASE_PASSWORD: baum42
21 | volumes:
22 | datasync_postgres_data:
23 |
--------------------------------------------------------------------------------
/examples/mvvmdatasynccore/DataSyncSampleCore/samplecoreapp.cpp:
--------------------------------------------------------------------------------
1 | #include "samplecoreapp.h"
2 | #include "sampleviewmodel.h"
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | SampleCoreApp::SampleCoreApp(QObject *parent) :
9 | CoreApp(parent)
10 | {
11 | QCoreApplication::setApplicationName(QStringLiteral("QtMvvmDataSyncSample"));
12 | QCoreApplication::setApplicationVersion(QStringLiteral(QTMVVMCORE_VERSION_STR));
13 | QCoreApplication::setOrganizationName(QStringLiteral("Skycoder42"));
14 | }
15 |
16 | void SampleCoreApp::performRegistrations()
17 | {
18 | qRegisterMetaType();
19 | QLoggingCategory::setFilterRules(QStringLiteral("qtmvvm.debug=true"));
20 | }
21 |
22 | int SampleCoreApp::startApp(const QStringList &arguments)
23 | {
24 | try {
25 | QtDataSync::Setup setup;
26 | if(arguments.size() > 1)
27 | setup.setLocalDir(arguments.value(1));
28 | setup.setRemoteConfiguration(QUrl(QStringLiteral("ws://localhost:4242")))
29 | .create();
30 | show();
31 | return EXIT_SUCCESS;
32 | } catch (std::exception &e) {
33 | qCritical() << e.what();
34 | return EXIT_FAILURE;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/examples/mvvmdatasynccore/DataSyncSampleCore/samplecoreapp.h:
--------------------------------------------------------------------------------
1 | #ifndef SAMPLECOREAPP_H
2 | #define SAMPLECOREAPP_H
3 |
4 | #include
5 |
6 | class SampleCoreApp : public QtMvvm::CoreApp
7 | {
8 | Q_OBJECT
9 |
10 | public:
11 | SampleCoreApp(QObject *parent = nullptr);
12 |
13 | protected:
14 | void performRegistrations() override;
15 | int startApp(const QStringList &arguments) override;
16 | };
17 |
18 | #undef coreApp
19 | #define coreApp static_cast(QtMvvm::CoreApp::instance())
20 |
21 | #endif // SAMPLECOREAPP_H
22 |
--------------------------------------------------------------------------------
/examples/mvvmdatasynccore/DataSyncSampleCore/sampledata.cpp:
--------------------------------------------------------------------------------
1 | #include "sampledata.h"
2 |
--------------------------------------------------------------------------------
/examples/mvvmdatasynccore/DataSyncSampleCore/sampledata.h:
--------------------------------------------------------------------------------
1 | #ifndef SAMPLEDATA_H
2 | #define SAMPLEDATA_H
3 |
4 | #include
5 |
6 | class SampleData
7 | {
8 | Q_GADGET
9 |
10 | Q_PROPERTY(QString key MEMBER key USER true)
11 |
12 | public:
13 | QString key;
14 | };
15 |
16 | Q_DECLARE_METATYPE(SampleData)
17 |
18 | #endif // SAMPLEDATA_H
19 |
--------------------------------------------------------------------------------
/examples/mvvmdatasynccore/DataSyncSampleCore/sampleviewmodel.cpp:
--------------------------------------------------------------------------------
1 | #include "sampleviewmodel.h"
2 | #include
3 | #include
4 |
5 | SampleViewModel::SampleViewModel(QObject *parent) :
6 | ViewModel(parent),
7 | _model(new QtDataSync::DataStoreModel(this))
8 | {
9 | _model->setTypeId();
10 | }
11 |
12 | QtDataSync::DataStoreModel *SampleViewModel::model() const
13 | {
14 | return _model;
15 | }
16 |
17 | void SampleViewModel::addData(const QString &key)
18 | {
19 | _model->store()->save({key});
20 | }
21 |
22 | void SampleViewModel::removeAt(int index)
23 | {
24 | auto mIndex = _model->index(index);
25 | if(mIndex.isValid())
26 | _model->store()->remove(_model->object(mIndex).key);
27 | }
28 |
29 | void SampleViewModel::showSyncInfo()
30 | {
31 | show();
32 | }
33 |
--------------------------------------------------------------------------------
/examples/mvvmdatasynccore/DataSyncSampleCore/sampleviewmodel.h:
--------------------------------------------------------------------------------
1 | #ifndef SAMPLEVIEWMODEL_H
2 | #define SAMPLEVIEWMODEL_H
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include
9 |
10 | #include "sampledata.h"
11 |
12 | class SampleViewModel : public QtMvvm::ViewModel
13 | {
14 | Q_OBJECT
15 |
16 | Q_PROPERTY(QtDataSync::DataStoreModel* model READ model CONSTANT)
17 |
18 | public:
19 | Q_INVOKABLE explicit SampleViewModel(QObject *parent = nullptr);
20 |
21 | QtDataSync::DataStoreModel* model() const;
22 |
23 | public Q_SLOTS:
24 | void addData(const QString &key);
25 | void removeAt(int index);
26 |
27 | void showSyncInfo();
28 |
29 | private:
30 | QtDataSync::DataStoreModel *_model;
31 | };
32 |
33 | #endif // SAMPLEVIEWMODEL_H
34 |
--------------------------------------------------------------------------------
/examples/mvvmdatasynccore/mvvmdatasynccore.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 | QT_FOR_CONFIG += core
3 |
4 | SUBDIRS += \
5 | DataSyncSampleCore
6 |
--------------------------------------------------------------------------------
/examples/mvvmdatasyncquick/DataSyncSampleQuick/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include
6 | #include
7 |
8 | QTMVVM_REGISTER_CORE_APP(SampleCoreApp)
9 |
10 | int main(int argc, char *argv[])
11 | {
12 | #ifdef QML_PATH
13 | qputenv("QML2_IMPORT_PATH", QML_PATH);
14 | #endif
15 |
16 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
17 | QApplication app(argc, argv);
18 |
19 | QtMvvm::registerDataSyncQuick();
20 | qmlRegisterUncreatableType("de.skycoder42.QtMvvm.Sample", 1, 1, "SampleViewModel", QStringLiteral("ViewModels cannot be created"));
21 |
22 | QQmlApplicationEngine engine;
23 | engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
24 | if (engine.rootObjects().isEmpty())
25 | return -1;
26 |
27 | return app.exec();
28 | }
29 |
--------------------------------------------------------------------------------
/examples/mvvmdatasyncquick/DataSyncSampleQuick/main.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls.Material 2.3
3 | import de.skycoder42.QtMvvm.Quick 1.1
4 |
5 | QtMvvmApp {
6 | Material.accent: Material.DeepPurple
7 | Material.primary: Material.Lime
8 | Material.theme: Material.Dark
9 |
10 | title: qsTr("QtMvvm Quick Sample")
11 | }
12 |
--------------------------------------------------------------------------------
/examples/mvvmdatasyncquick/DataSyncSampleQuick/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 |
5 |
6 | SampleView.qml
7 |
8 |
9 |
--------------------------------------------------------------------------------
/examples/mvvmdatasyncquick/mvvmdatasyncquick.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 | QT_FOR_CONFIG += quick
3 |
4 | SUBDIRS += \
5 | DataSyncSampleQuick
6 |
--------------------------------------------------------------------------------
/examples/mvvmdatasyncwidgets/DataSyncSampleWidgets/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 |
6 | #include "samplewindow.h"
7 |
8 | QTMVVM_REGISTER_CORE_APP(SampleCoreApp)
9 |
10 | int main(int argc, char *argv[])
11 | {
12 | QApplication a(argc, argv);
13 |
14 | QtMvvm::registerDataSyncWidgets();
15 | QtMvvm::WidgetsPresenter::registerView();
16 |
17 | return a.exec();
18 | }
19 |
--------------------------------------------------------------------------------
/examples/mvvmdatasyncwidgets/DataSyncSampleWidgets/samplewindow.cpp:
--------------------------------------------------------------------------------
1 | #include "samplewindow.h"
2 | #include "ui_samplewindow.h"
3 |
4 | SampleWindow::SampleWindow(QtMvvm::ViewModel *viewModel, QWidget *parent) :
5 | QMainWindow(parent),
6 | _viewModel(static_cast(viewModel)),
7 | ui(new Ui::SampleWindow)
8 | {
9 | ui->setupUi(this);
10 |
11 | ui->listView->setModel(_viewModel->model());
12 | connect(ui->syncButton, &QPushButton::clicked,
13 | _viewModel, &SampleViewModel::showSyncInfo);
14 | }
15 |
16 | SampleWindow::~SampleWindow()
17 | {
18 | delete ui;
19 | }
20 |
21 | void SampleWindow::on_addButton_clicked()
22 | {
23 | _viewModel->addData(ui->keyEdit->text());
24 | }
25 |
26 | void SampleWindow::on_removeButton_clicked()
27 | {
28 | _viewModel->removeAt(ui->listView->currentIndex().row());
29 | }
30 |
--------------------------------------------------------------------------------
/examples/mvvmdatasyncwidgets/DataSyncSampleWidgets/samplewindow.h:
--------------------------------------------------------------------------------
1 | #ifndef SAMPLEWINDOW_H
2 | #define SAMPLEWINDOW_H
3 |
4 | #include
5 | #include
6 |
7 | namespace Ui {
8 | class SampleWindow;
9 | }
10 |
11 | class SampleWindow : public QMainWindow
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | Q_INVOKABLE explicit SampleWindow(QtMvvm::ViewModel *viewModel, QWidget *parent = nullptr);
17 | ~SampleWindow();
18 |
19 | private Q_SLOTS:
20 | void on_addButton_clicked();
21 | void on_removeButton_clicked();
22 |
23 | private:
24 | SampleViewModel *_viewModel;
25 | Ui::SampleWindow *ui;
26 | };
27 |
28 | #endif // SAMPLEWINDOW_H
29 |
--------------------------------------------------------------------------------
/examples/mvvmdatasyncwidgets/mvvmdatasyncwidgets.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 | QT_FOR_CONFIG += widgets
3 |
4 | SUBDIRS += \
5 | DataSyncSampleWidgets
6 |
--------------------------------------------------------------------------------
/examples/mvvmquick/SampleQuick/ChildView.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import de.skycoder42.QtMvvm.Core 1.1
4 | import de.skycoder42.QtMvvm.Quick 1.1
5 | import de.skycoder42.QtMvvm.Sample 1.1
6 |
7 | Rectangle {
8 | property ChildViewModel viewModel: null
9 |
10 | color: "red"
11 |
12 | property bool dummyClosed: false
13 |
14 | function closeAction() {
15 | if(dummyClosed)
16 | return false;
17 | else {
18 | dummyClosed = true;
19 | label.text = qsTr("I was closed!")
20 | return true;
21 | }
22 | }
23 |
24 | Label {
25 | id: label
26 | anchors.centerIn: parent
27 | text: qsTr("I am the child!")
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/examples/mvvmquick/SampleQuick/ContainerView.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import QtQuick.Layouts 1.3
4 | import de.skycoder42.QtMvvm.Core 1.1
5 | import de.skycoder42.QtMvvm.Quick 1.1
6 | import de.skycoder42.QtMvvm.Sample 1.1
7 |
8 | Page {
9 | id: containerView
10 | property ContainerViewModel viewModel: null
11 |
12 | function presentItem(item) {
13 | return viewPlaceholder.presentItem(item);
14 | }
15 |
16 | function closeAction() {
17 | return viewPlaceholder.closeAction();
18 | }
19 |
20 | header: ContrastToolBar {
21 | ToolBarLabel {
22 | text: qsTr("View Container")
23 | anchors.fill: parent
24 | }
25 | }
26 |
27 | PresenterProgress {}
28 |
29 | Pane {
30 | anchors.fill: parent
31 |
32 | ColumnLayout {
33 | anchors.fill: parent
34 |
35 | ViewPlaceholder {
36 | id: viewPlaceholder
37 |
38 | Layout.fillWidth: true
39 | Layout.fillHeight: true
40 |
41 | BusyIndicator {
42 | anchors.centerIn: parent
43 | running: !viewPlaceholder.loadedView
44 | }
45 | }
46 |
47 | Button {
48 | Layout.fillWidth: true
49 | text: viewPlaceholder.loadedView ? qsTr("Discard child") : qsTr("Show Child")
50 | onClicked: viewPlaceholder.loadedView ? viewPlaceholder.discardView() : viewModel.loadChild();
51 | }
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/examples/mvvmquick/SampleQuick/DrawerView.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import de.skycoder42.QtMvvm.Sample 1.1
4 |
5 | ListView {
6 | id: drawerView
7 |
8 | property DrawerViewModel viewModel: null
9 | property Drawer drawer: null
10 |
11 | model: viewModel.navModel
12 | anchors.fill: parent
13 | clip: true
14 |
15 | ScrollBar.vertical: ScrollBar {}
16 |
17 | delegate: ItemDelegate {
18 | width: parent.width
19 | text: viewModel.navModel.data(viewModel.navModel.index(index, 0)) //because "display" is not accessible
20 |
21 | onClicked: {
22 | viewModel.open(index);
23 | drawer.close();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/examples/mvvmquick/SampleQuick/ResultView.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import QtQuick.Layouts 1.3
4 | import de.skycoder42.QtMvvm.Core 1.1
5 | import de.skycoder42.QtMvvm.Quick 1.1
6 | import de.skycoder42.QtMvvm.Sample 1.1
7 |
8 | AlertDialog {
9 | id: resultDialog
10 |
11 | property ResultViewModel viewModel: null
12 |
13 | title: qsTr("Enter something")
14 |
15 | ColumnLayout {
16 | anchors.fill: parent
17 |
18 | Label {
19 | text: qsTr("Enter a result to be reported as event to the main view:")
20 | wrapMode: Text.WordWrap
21 | Layout.fillWidth: true
22 | }
23 |
24 | TextField {
25 | id: resultEdit
26 | Layout.fillWidth: true
27 | selectByMouse: true
28 |
29 | MvvmBinding {
30 | viewModel: resultDialog.viewModel
31 | viewModelProperty: "result"
32 | view: resultEdit
33 | viewProperty: "text"
34 | }
35 | }
36 | }
37 |
38 | standardButtons: Dialog.Ok | Dialog.Cancel
39 |
40 | onAccepted: viewModel.done()
41 | }
42 |
--------------------------------------------------------------------------------
/examples/mvvmquick/SampleQuick/TabItemView.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import de.skycoder42.QtMvvm.Core 1.1
4 | import de.skycoder42.QtMvvm.Quick 1.1
5 | import de.skycoder42.QtMvvm.Sample 1.1
6 |
7 | Pane {
8 | property TabItemViewModel viewModel: null
9 |
10 | Switch {
11 | anchors.centerIn: parent
12 | text: viewModel.title
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/examples/mvvmquick/SampleQuick/main.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import de.skycoder42.QtMvvm.Quick 1.1
3 |
4 | QtMvvmApp {
5 | title: qsTr("QtMvvm Quick Sample")
6 | }
7 |
--------------------------------------------------------------------------------
/examples/mvvmquick/SampleQuick/qml.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | main.qml
4 |
5 |
6 | SampleView.qml
7 | ResultView.qml
8 | DrawerView.qml
9 | TabView.qml
10 | TabItemView.qml
11 | ContainerView.qml
12 | ChildView.qml
13 |
14 |
15 |
--------------------------------------------------------------------------------
/examples/mvvmquick/SampleQuick/quickeventservice.cpp:
--------------------------------------------------------------------------------
1 | #include "quickeventservice.h"
2 |
3 | QuickEventService::QuickEventService(QObject *parent) :
4 | QObject(parent),
5 | IEventService(),
6 | _cnt(0),
7 | _events(),
8 | _echoService(nullptr)
9 | {}
10 |
11 | QuickEventService::QuickEventService(EchoService *svc, QObject *parent) :
12 | QObject(parent),
13 | IEventService(),
14 | _cnt(0),
15 | _events(),
16 | _echoService(svc)
17 | {
18 | qtmvvm_init();
19 | }
20 |
21 | int QuickEventService::addEvent(const QString &name)
22 | {
23 | QSharedPointer timer {
24 | new QTimer(this),
25 | &QTimer::deleteLater
26 | };
27 |
28 | _events.insert(_cnt, timer);
29 | connect(timer.data(), &QTimer::timeout, this, [this, name]() {
30 | _echoService->ping(name);
31 | });
32 | timer->start(1000);
33 |
34 | return _cnt++;
35 | }
36 |
37 | void QuickEventService::removeEvent(int eventId)
38 | {
39 | _events.remove(eventId);
40 | }
41 |
42 | void QuickEventService::qtmvvm_init()
43 | {
44 | qDebug(Q_FUNC_INFO);
45 | Q_ASSERT(_echoService);
46 | connect(_echoService, &EchoService::pong,
47 | this, &QuickEventService::eventTriggered);
48 | }
49 |
--------------------------------------------------------------------------------
/examples/mvvmquick/SampleQuick/quickeventservice.h:
--------------------------------------------------------------------------------
1 | #ifndef QUICKEVENTSERVICE_H
2 | #define QUICKEVENTSERVICE_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | class QuickEventService : public QObject, public IEventService
14 | {
15 | Q_OBJECT
16 | Q_INTERFACES(IEventService)
17 |
18 | QTMVVM_INJECT_PROP(EchoService*, echoService, _echoService)
19 |
20 | public:
21 | Q_INVOKABLE explicit QuickEventService(QObject *parent = nullptr);
22 | explicit QuickEventService(EchoService* svc, QObject *parent = nullptr);
23 |
24 | int addEvent(const QString &name) override;
25 | void removeEvent(int eventId) override;
26 |
27 | Q_SIGNALS:
28 | void eventTriggered(const QString &event) final;
29 |
30 | private:
31 | int _cnt;
32 | QHash> _events;
33 | EchoService* _echoService;
34 |
35 | Q_INVOKABLE void qtmvvm_init();
36 | };
37 |
38 | #endif // QUICKEVENTSERVICE_H
39 |
--------------------------------------------------------------------------------
/examples/mvvmquick/mvvmquick.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 | QT_FOR_CONFIG += quick
3 |
4 | SUBDIRS += \
5 | SampleQuick
6 |
--------------------------------------------------------------------------------
/examples/mvvmwidgets/SampleWidgets/resultdialog.cpp:
--------------------------------------------------------------------------------
1 | #include "resultdialog.h"
2 | #include "ui_resultdialog.h"
3 | #include
4 |
5 | ResultDialog::ResultDialog(QtMvvm::ViewModel *viewModel, QWidget *parent) :
6 | QDialog(parent),
7 | _viewModel(static_cast(viewModel)),
8 | ui(new Ui::ResultDialog)
9 | {
10 | ui->setupUi(this);
11 |
12 | QtMvvm::bind(_viewModel, "result",
13 | ui->lineEdit, "text",
14 | QtMvvm::Binding::TwoWay,
15 | nullptr,
16 | "editingFinished()");
17 | connect(this, &ResultDialog::accepted,
18 | _viewModel, &ResultViewModel::done);
19 | }
20 |
21 | ResultDialog::~ResultDialog()
22 | {
23 | delete ui;
24 | }
25 |
--------------------------------------------------------------------------------
/examples/mvvmwidgets/SampleWidgets/resultdialog.h:
--------------------------------------------------------------------------------
1 | #ifndef RESULTDIALOG_H
2 | #define RESULTDIALOG_H
3 |
4 | #include
5 | #include
6 |
7 | namespace Ui {
8 | class ResultDialog;
9 | }
10 |
11 | class ResultDialog : public QDialog
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | Q_INVOKABLE explicit ResultDialog(QtMvvm::ViewModel *viewModel, QWidget *parent = nullptr);
17 | ~ResultDialog();
18 |
19 | private:
20 | ResultViewModel *_viewModel;
21 | Ui::ResultDialog *ui;
22 | };
23 |
24 | #endif // RESULTDIALOG_H
25 |
--------------------------------------------------------------------------------
/examples/mvvmwidgets/SampleWidgets/sampleview.h:
--------------------------------------------------------------------------------
1 | #ifndef SAMPLEVIEW_H
2 | #define SAMPLEVIEW_H
3 |
4 | #include
5 | #include
6 |
7 | namespace Ui {
8 | class SampleView;
9 | }
10 |
11 | class SampleView : public QMainWindow
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | Q_INVOKABLE explicit SampleView(QtMvvm::ViewModel *viewModel, QWidget *parent = nullptr);
17 | ~SampleView();
18 |
19 | private:
20 | SampleViewModel *_viewModel;
21 | Ui::SampleView *ui;
22 | };
23 |
24 | #endif // SAMPLEVIEW_H
25 |
--------------------------------------------------------------------------------
/examples/mvvmwidgets/SampleWidgets/tabitemview.cpp:
--------------------------------------------------------------------------------
1 | #include "tabitemview.h"
2 | #include "ui_tabitemview.h"
3 | #include
4 |
5 | TabItemView::TabItemView(QtMvvm::ViewModel *viewModel, QWidget *parent) :
6 | QWidget(parent),
7 | _viewModel(static_cast(viewModel)),
8 | ui(new Ui::TabItemView)
9 | {
10 | ui->setupUi(this);
11 |
12 | QtMvvm::bind(_viewModel, "title",
13 | ui->checkBox, "text",
14 | QtMvvm::Binding::OneWayToView);
15 | }
16 |
17 | TabItemView::~TabItemView()
18 | {
19 | delete ui;
20 | }
21 |
22 | TabItemViewModel *TabItemView::viewModel() const
23 | {
24 | return _viewModel;
25 | }
26 |
--------------------------------------------------------------------------------
/examples/mvvmwidgets/SampleWidgets/tabitemview.h:
--------------------------------------------------------------------------------
1 | #ifndef TABITEMVIEW_H
2 | #define TABITEMVIEW_H
3 |
4 | #include
5 | #include
6 |
7 | namespace Ui {
8 | class TabItemView;
9 | }
10 |
11 | class TabItemView : public QWidget
12 | {
13 | Q_OBJECT
14 |
15 | public:
16 | Q_INVOKABLE explicit TabItemView(QtMvvm::ViewModel *viewModel, QWidget *parent = nullptr);
17 | ~TabItemView();
18 |
19 | TabItemViewModel *viewModel() const;
20 |
21 | private:
22 | TabItemViewModel *_viewModel;
23 | Ui::TabItemView *ui;
24 | };
25 |
26 | #endif // TABITEMVIEW_H
27 |
--------------------------------------------------------------------------------
/examples/mvvmwidgets/SampleWidgets/tabview.cpp:
--------------------------------------------------------------------------------
1 | #include "tabview.h"
2 | #include "ui_tabview.h"
3 | #include "tabitemview.h"
4 | #include
5 |
6 | TabView::TabView(QtMvvm::ViewModel *viewModel, QWidget *parent) :
7 | QTabWidget(parent),
8 | IPresentingView(),
9 | _viewModel(static_cast(viewModel)),
10 | ui(new Ui::TabView)
11 | {
12 | setWindowFlags(windowFlags() | Qt::Window);
13 | ui->setupUi(this);
14 |
15 | tabBar()->addTab(QStringLiteral("+"));
16 |
17 | connect(tabBar(), &QTabBar::tabBarClicked,
18 | this, &TabView::trigger);
19 | }
20 |
21 | TabView::~TabView()
22 | {
23 | delete ui;
24 | }
25 |
26 | bool TabView::tryPresent(QWidget *view)
27 | {
28 | auto itemView = qobject_cast(view);
29 | if(itemView) {
30 | insertTab(count() - 1, itemView, itemView->viewModel()->title());
31 | tabBar()->setCurrentIndex(tabBar()->count() - 2);
32 | return true;
33 | } else
34 | return true;
35 | }
36 |
37 | void TabView::trigger(int index)
38 | {
39 | tabBar()->setCurrentIndex(tabBar()->count() - 1);
40 | if(index == tabBar()->count() - 1)
41 | _viewModel->addTab();
42 | }
43 |
--------------------------------------------------------------------------------
/examples/mvvmwidgets/SampleWidgets/tabview.h:
--------------------------------------------------------------------------------
1 | #ifndef TABVIEW_H
2 | #define TABVIEW_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | namespace Ui {
9 | class TabView;
10 | }
11 |
12 | class TabView : public QTabWidget, public QtMvvm::IPresentingView
13 | {
14 | Q_OBJECT
15 | Q_INTERFACES(QtMvvm::IPresentingView)
16 |
17 | public:
18 | Q_INVOKABLE explicit TabView(QtMvvm::ViewModel *viewModel, QWidget *parent = nullptr);
19 | ~TabView();
20 |
21 | bool tryPresent(QWidget *view) override;
22 |
23 | private Q_SLOTS:
24 | void trigger(int index);
25 |
26 | private:
27 | TabViewModel *_viewModel;
28 | Ui::TabView *ui;
29 | };
30 |
31 | #endif // TABVIEW_H
32 |
--------------------------------------------------------------------------------
/examples/mvvmwidgets/SampleWidgets/tabview.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | TabView
4 |
5 |
6 |
7 | 0
8 | 0
9 | 400
10 | 300
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/examples/mvvmwidgets/SampleWidgets/widgetseventservice.cpp:
--------------------------------------------------------------------------------
1 | #include "widgetseventservice.h"
2 |
3 | WidgetsEventService::WidgetsEventService(QObject *parent) :
4 | QObject(parent),
5 | IEventService(),
6 | _cnt(0),
7 | _events(),
8 | _echoService(nullptr)
9 | {}
10 |
11 | WidgetsEventService::WidgetsEventService(EchoService *svc, QObject *parent) :
12 | QObject(parent),
13 | IEventService(),
14 | _cnt(0),
15 | _events(),
16 | _echoService(svc)
17 | {
18 | qtmvvm_init();
19 | }
20 |
21 | int WidgetsEventService::addEvent(const QString &name)
22 | {
23 | QSharedPointer timer {
24 | new QTimer(this),
25 | &QTimer::deleteLater
26 | };
27 |
28 | _events.insert(_cnt, timer);
29 | connect(timer.data(), &QTimer::timeout, this, [this, name]() {
30 | _echoService->ping(name);
31 | });
32 | timer->start(1000);
33 |
34 | return _cnt++;
35 | }
36 |
37 | void WidgetsEventService::removeEvent(int eventId)
38 | {
39 | _events.remove(eventId);
40 | }
41 |
42 | void WidgetsEventService::qtmvvm_init()
43 | {
44 | qDebug(Q_FUNC_INFO);
45 | Q_ASSERT(_echoService);
46 | connect(_echoService, &EchoService::pong,
47 | this, &WidgetsEventService::eventTriggered);
48 | }
49 |
--------------------------------------------------------------------------------
/examples/mvvmwidgets/SampleWidgets/widgetseventservice.h:
--------------------------------------------------------------------------------
1 | #ifndef WIDGETSEVENTSERVICE_H
2 | #define WIDGETSEVENTSERVICE_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | #include
10 | #include
11 | #include
12 |
13 | class WidgetsEventService : public QObject, public IEventService
14 | {
15 | Q_OBJECT
16 | Q_INTERFACES(IEventService)
17 |
18 | QTMVVM_INJECT_PROP(EchoService*, echoService, _echoService)
19 |
20 | public:
21 | Q_INVOKABLE explicit WidgetsEventService(QObject *parent = nullptr);
22 | explicit WidgetsEventService(EchoService* svc, QObject *parent = nullptr);
23 |
24 | int addEvent(const QString &name) override;
25 | void removeEvent(int eventId) override;
26 |
27 | Q_SIGNALS:
28 | void eventTriggered(const QString &event) final;
29 |
30 | private:
31 | int _cnt;
32 | QHash> _events;
33 | EchoService* _echoService;
34 |
35 | Q_INVOKABLE void qtmvvm_init();
36 | };
37 |
38 | #endif // WIDGETSEVENTSERVICE_H
39 |
--------------------------------------------------------------------------------
/examples/mvvmwidgets/mvvmwidgets.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 | QT_FOR_CONFIG += widgets
3 |
4 | SUBDIRS += \
5 | SampleWidgets
6 |
--------------------------------------------------------------------------------
/qbs/Qt/settingsgenerator/module.qbs:
--------------------------------------------------------------------------------
1 | import qbs
2 | import qbs.FileInfo
3 |
4 | Module {
5 | Depends { name: "Qt.mvvmcore" }
6 |
7 | property string qsettingsgeneratorName: "qsettingsgenerator"
8 |
9 | version: Qt.mvvmcore.version
10 |
11 | FileTagger {
12 | fileTags: ["settings-xml"]
13 | patterns: ["*.settings.xml"]
14 | }
15 |
16 | Rule {
17 | inputs: ["settings-xml"]
18 |
19 | Artifact {
20 | filePath: input.baseName + ".h"
21 | fileTags: ["hpp"]
22 | }
23 | Artifact {
24 | filePath: input.baseName + ".cpp"
25 | fileTags: ["cpp"]
26 | }
27 |
28 | prepare: {
29 | var cmd = new Command();
30 | cmd.description = "generating settings class" + input.fileName;
31 | cmd.highlight = "codegen";
32 | cmd.program = FileInfo.joinPaths(product.moduleProperty("Qt.core", "binPath"),
33 | product.moduleProperty("Qt.restbuilder", "qsettingsgeneratorName"));
34 | cmd.arguments = [
35 | "--in", input.filePath,
36 | "--header", outputs["hpp"][0].filePath,
37 | "--impl", outputs["cpp"][0].filePath
38 | ];
39 | return cmd;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/qtmvvm.pro:
--------------------------------------------------------------------------------
1 | load(qt_parts)
2 |
3 | SUBDIRS += doc
4 |
5 | doxygen.target = doxygen
6 | doxygen.CONFIG = recursive
7 | doxygen.recurse_target = doxygen
8 | doxygen.recurse += doc
9 | QMAKE_EXTRA_TARGETS += doxygen
10 |
11 | lrelease.target = lrelease
12 | lrelease.CONFIG = recursive
13 | lrelease.recurse_target = lrelease
14 | lrelease.recurse += sub_src
15 | QMAKE_EXTRA_TARGETS += lrelease
16 |
17 | runtests.target = run-tests
18 | runtests.CONFIG = recursive
19 | runtests.recurse_target = run-tests
20 | runtests.recurse += sub_tests sub_src sub_tools
21 | sub_runtest.target = sub-tests-runtests
22 | sub_runtest.depends += sub-tests
23 | QMAKE_EXTRA_TARGETS += sub_runtest runtests
24 |
25 | DISTFILES += .qmake.conf \
26 | sync.profile \
27 | qbs/Qt/settingsgenerator/*
28 |
--------------------------------------------------------------------------------
/src/3rdparty/optional-lite/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Boost Software License - Version 1.0 - August 17th, 2003
2 |
3 | Permission is hereby granted, free of charge, to any person or organization
4 | obtaining a copy of the software and accompanying documentation covered by
5 | this license (the "Software") to use, reproduce, display, distribute,
6 | execute, and transmit the Software, and to prepare derivative works of the
7 | Software, and to permit third-parties to whom the Software is furnished to
8 | do so, all subject to the following:
9 |
10 | The copyright notices in the Software and this entire statement, including
11 | the above license grant, this restriction and the following disclaimer,
12 | must be included in all copies of the Software, in whole or in part, and
13 | all derivative works of the Software, unless such copies or derivative
14 | works are solely in the form of machine-executable object code generated by
15 | a source language processor.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 | DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/src/3rdparty/variant-lite/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Boost Software License - Version 1.0 - August 17th, 2003
2 |
3 | Permission is hereby granted, free of charge, to any person or organization
4 | obtaining a copy of the software and accompanying documentation covered by
5 | this license (the "Software") to use, reproduce, display, distribute,
6 | execute, and transmit the Software, and to prepare derivative works of the
7 | Software, and to permit third-parties to whom the Software is furnished to
8 | do so, all subject to the following:
9 |
10 | The copyright notices in the Software and this entire statement, including
11 | the above license grant, this restriction and the following disclaimer,
12 | must be included in all copies of the Software, in whole or in part, and
13 | all derivative works of the Software, unless such copies or derivative
14 | works are solely in the form of machine-executable object code generated by
15 | a source language processor.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 | FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
20 | SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
21 | FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
22 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23 | DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/src/imports/imports.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | SUBDIRS += \
4 | mvvmcore \
5 | mvvmquick
6 |
7 | mvvmquick.depends += mvvmcore
8 |
9 | qtHaveModule(datasync) {
10 | SUBDIRS += mvvmdatasynccore \
11 | mvvmdatasyncquick
12 |
13 | mvvmdatasynccore.depends += mvvmcore
14 | mvvmdatasyncquick.depends += mvvmdatasynccore mvvmquick
15 | }
16 |
--------------------------------------------------------------------------------
/src/imports/mvvmcore/qmldir:
--------------------------------------------------------------------------------
1 | module de.skycoder42.QtMvvm.Core
2 | plugin declarative_mvvmcore
3 | classname QtMvvmCoreDeclarativeModule
4 | typeinfo plugins.qmltypes
5 | depends QtQml 2.2
6 |
--------------------------------------------------------------------------------
/src/imports/mvvmcore/qqmlcoreapp.cpp:
--------------------------------------------------------------------------------
1 | #include "qqmlcoreapp.h"
2 | using namespace QtMvvm;
3 |
4 | QQmlCoreApp::QQmlCoreApp(QObject *parent) :
5 | QObject(parent)
6 | {
7 | connect(coreApp, &CoreApp::appStarted,
8 | this, &QQmlCoreApp::appStarted);
9 | }
10 |
11 | MessageResult *QQmlCoreApp::showDialog(const MessageConfig &config)
12 | {
13 | return CoreApp::showDialog(config);
14 | }
15 |
16 | QVariant QQmlCoreApp::safeCastInputType(const QString &type, const QVariant &value)
17 | {
18 | return CoreApp::safeCastInputType(type.toUtf8(), value);
19 | }
20 |
21 | void QQmlCoreApp::show(const QString &viewModelName, const QVariantHash ¶ms, ViewModel *parentViewModel)
22 | {
23 | CoreApp::show(qUtf8Printable(viewModelName), params, parentViewModel);
24 | }
25 |
--------------------------------------------------------------------------------
/src/imports/mvvmcore/qqmlcoreapp.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_QQMLCOREAPP_H
2 | #define QTMVVM_QQMLCOREAPP_H
3 |
4 | #include
5 |
6 | #include
7 |
8 | #ifdef DOXYGEN_RUN
9 | namespace de::skycoder42::QtMvvm::Core {
10 |
11 | /*! @brief A QML singleton to access some QtMvvm::CoreApp functionality
12 | *
13 | * @extends QtQml.QtObject
14 | * @since 1.1
15 | *
16 | * @sa QtMvvm::CoreApp
17 | */
18 | class CoreApp
19 | #else
20 | namespace QtMvvm {
21 |
22 | class QQmlCoreApp : public QObject
23 | #endif
24 | {
25 | Q_OBJECT
26 |
27 | public:
28 | //! @private
29 | explicit QQmlCoreApp(QObject *parent = nullptr);
30 |
31 | //! @copydoc QtMvvm::CoreApp::showDialog
32 | Q_INVOKABLE QtMvvm::MessageResult *showDialog(const QtMvvm::MessageConfig &config);
33 | //! @copydoc QtMvvm::CoreApp::safeCastInputType
34 | Q_INVOKABLE QVariant safeCastInputType(const QString &type, const QVariant &value);
35 |
36 | public Q_SLOTS:
37 | //! @copydoc QtMvvm::CoreApp::show(const char *, const QVariantHash &, QPointer);
38 | void show(const QString &viewModelName, const QVariantHash ¶ms = {}, QtMvvm::ViewModel *parentViewModel = nullptr);
39 |
40 | Q_SIGNALS:
41 | //! @copydoc QtMvvm::CoreApp::appStarted
42 | void appStarted();
43 | };
44 |
45 | }
46 |
47 | #endif // QTMVVM_QQMLCOREAPP_H
48 |
--------------------------------------------------------------------------------
/src/imports/mvvmcore/qtmvvmcore_plugin.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVMCORE_PLUGIN_H
2 | #define QTMVVMCORE_PLUGIN_H
3 |
4 | #include
5 |
6 | class QtMvvmCoreDeclarativeModule : public QQmlExtensionPlugin
7 | {
8 | Q_OBJECT
9 | Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
10 |
11 | public:
12 | QtMvvmCoreDeclarativeModule(QObject *parent = nullptr);
13 | void registerTypes(const char *uri) override;
14 | };
15 |
16 | #endif // QTMVVMCORE_PLUGIN_H
17 |
--------------------------------------------------------------------------------
/src/imports/mvvmdatasynccore/qmldir:
--------------------------------------------------------------------------------
1 | module de.skycoder42.QtMvvm.DataSync.Core
2 | plugin declarative_mvvmdatasynccore
3 | classname QtMvvmDataSyncCoreDeclarativeModule
4 | typeinfo plugins.qmltypes
5 | depends QtQml.Models 2.3
6 | depends de.skycoder42.QtMvvm.Core 1.0
7 |
--------------------------------------------------------------------------------
/src/imports/mvvmdatasynccore/qtmvvmdatasynccore_plugin.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVMDATASYNCCORE_PLUGIN_H
2 | #define QTMVVMDATASYNCCORE_PLUGIN_H
3 |
4 | #include
5 |
6 | class QtMvvmDataSyncCoreDeclarativeModule : public QQmlExtensionPlugin
7 | {
8 | Q_OBJECT
9 | Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
10 |
11 | public:
12 | QtMvvmDataSyncCoreDeclarativeModule(QObject *parent = nullptr);
13 | void registerTypes(const char *uri) override;
14 | };
15 |
16 | #endif // QTMVVMDATASYNCCORE_PLUGIN_H
17 |
--------------------------------------------------------------------------------
/src/imports/mvvmdatasyncquick/icons/ic_add_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmdatasyncquick/icons/ic_call_made_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmdatasyncquick/icons/ic_call_received_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmdatasyncquick/icons/ic_check_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmdatasyncquick/icons/ic_delete_forever_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmdatasyncquick/icons/ic_import_export_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmdatasyncquick/icons/ic_sync_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmdatasyncquick/mvvmdatasyncquick.json:
--------------------------------------------------------------------------------
1 | {
2 | "Keys" : [ ]
3 | }
4 |
--------------------------------------------------------------------------------
/src/imports/mvvmdatasyncquick/qmldir:
--------------------------------------------------------------------------------
1 | module de.skycoder42.QtMvvm.DataSync.Quick
2 | plugin declarative_mvvmdatasyncquick
3 | classname QtMvvmDataSyncQuickDeclarativeModule
4 | typeinfo plugins.qmltypes
5 | depends de.skycoder42.QtMvvm.DataSync.Core 1.0
6 | depends de.skycoder42.QtMvvm.Quick 1.0
7 |
8 | IdentityEditView 1.0 IdentityEditView.qml
9 | ExportSetupView 1.0 ExportSetupView.qml
10 | ChangeRemoteView 1.0 ChangeRemoteView.qml
11 |
12 | DataSyncView 1.0 DataSyncView.qml
13 |
14 | NetworkExchangeView 1.0 NetworkExchangeView.qml
15 |
--------------------------------------------------------------------------------
/src/imports/mvvmdatasyncquick/qtmvvmdatasyncquick_plugin.cpp:
--------------------------------------------------------------------------------
1 | #include "qtmvvmdatasyncquick_plugin.h"
2 |
3 | #include
4 |
5 | static void initResources()
6 | {
7 | #ifdef QT_STATIC
8 | Q_INIT_RESOURCE(qtmvvmdatasyncquick_plugin);
9 | #endif
10 | }
11 |
12 | QtMvvmDataSyncQuickDeclarativeModule::QtMvvmDataSyncQuickDeclarativeModule(QObject *parent) :
13 | QQmlExtensionPlugin(parent)
14 | {
15 | initResources();
16 | }
17 |
18 | void QtMvvmDataSyncQuickDeclarativeModule::registerTypes(const char *uri)
19 | {
20 | Q_ASSERT(qstrcmp(uri, "de.skycoder42.QtMvvm.DataSync.Quick") == 0);
21 |
22 | //Version 1.0
23 | //no c++ types. plugin is only needed for the resources
24 | qmlRegisterModule(uri, 1, 0);
25 |
26 | //Version 1.1
27 | qmlRegisterModule(uri, 1, 1);
28 |
29 | // Check to make sure no module update is forgotten
30 | static_assert(VERSION_MAJOR == 1 && VERSION_MINOR == 1, "QML module version needs to be updated");
31 | }
32 |
--------------------------------------------------------------------------------
/src/imports/mvvmdatasyncquick/qtmvvmdatasyncquick_plugin.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVMDATASYNCQUICK_PLUGIN_H
2 | #define QTMVVMDATASYNCQUICK_PLUGIN_H
3 |
4 | #include
5 |
6 | class QtMvvmDataSyncQuickDeclarativeModule : public QQmlExtensionPlugin
7 | {
8 | Q_OBJECT
9 | Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
10 |
11 | public:
12 | QtMvvmDataSyncQuickDeclarativeModule(QObject *parent = nullptr);
13 | void registerTypes(const char *uri) override;
14 | };
15 |
16 | #endif // QTMVVMDATASYNCQUICK_PLUGIN_H
17 |
--------------------------------------------------------------------------------
/src/imports/mvvmdatasyncquick/qtmvvmdatasyncquick_plugin.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | icons/ic_sync_white_24px.svg
4 | icons/ic_fingerprint_white_24px.svg
5 | icons/ic_delete_forever_white_24px.svg
6 | icons/ic_add_white_24px.svg
7 | icons/ic_call_made_white_24px.svg
8 | icons/ic_call_received_white_24px.svg
9 | icons/ic_import_export_white_24px.svg
10 | icons/ic_check_white_24px.svg
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/.gitignore:
--------------------------------------------------------------------------------
1 | /qtmvvmquick_plugin_qmlcache.qrc
2 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/ActionButton.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import de.skycoder42.QtMvvm.Quick 1.1
4 |
5 | /*! @brief An extension of the @ref QtQuick.Controls.ToolButton "ToolButton" for better appearance
6 | *
7 | * @extends QtQuick.Controls.ToolButton
8 | *
9 | * @details This version basically adjusts size, icon size and text display to look better and
10 | * fit the Material guidelines. It also adds a tooltip that can be shown via a long press
11 | *
12 | * @sa ContrastToolBar, MenuButton
13 | */
14 | ToolButton {
15 | id: _toolButton
16 |
17 | /*! @brief A toolTip to be shown when the button is long pressed
18 | *
19 | * @default{`ToolButton.text` (binding)}
20 | *
21 | * @accessors{
22 | * @memberAc{toolTip}
23 | * @notifyAc{toolTipChanged()}
24 | * }
25 | */
26 | property string toolTip: _toolButton.text
27 |
28 | display: AbstractButton.IconOnly
29 |
30 | implicitHeight: 48
31 | //implicitWidth: 48
32 |
33 | icon.width: 24
34 | icon.height: 24
35 |
36 | ColorHelper {
37 | id: helper
38 | }
39 | icon.color: helper.text
40 |
41 | ToolTip.visible: pressed && _toolButton.toolTip != ""
42 | ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
43 | ToolTip.text: _toolButton.toolTip
44 |
45 | onPressAndHold: {
46 | if(_toolButton.toolTip !== "")
47 | QuickPresenter.hapticLongPress();
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/AndroidFileDialog.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import de.skycoder42.QtMvvm.Core 1.1
3 | import de.skycoder42.QtMvvm.Quick 1.1
4 |
5 | FileChooser {
6 | id: _fileChooser
7 |
8 | property var msgConfig
9 | property MessageResult msgResult
10 |
11 | signal closed()
12 |
13 | title: msgConfig.title
14 | folderUrl: msgConfig.defaultValue
15 | type: {
16 | if(msgConfig.subType == "open")
17 | return FileChooser.OpenDocument;
18 | else if(msgConfig.subType == "files")
19 | return FileChooser.OpenMultipleDocuments;
20 | else if(msgConfig.subType == "save")
21 | return FileChooser.CreateDocument;
22 | else if(msgConfig.subType == "get") //special value for android only
23 | return FileChooser.GetContent;
24 | else {
25 | return FileChooser.OpenDocument;
26 | }
27 | }
28 |
29 | onAccepted: {
30 | if(msgResult) {
31 | msgResult.complete(MessageConfig.Ok, result);
32 | msgResult = null;
33 | }
34 | closed();
35 | }
36 |
37 | onRejected: {
38 | if(msgResult) {
39 | msgResult.complete(MessageConfig.Cancel);
40 | msgResult = null;
41 | }
42 | closed();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/AndroidFolderDialog.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import de.skycoder42.QtMvvm.Core 1.1
3 | import de.skycoder42.QtMvvm.Quick 1.1
4 |
5 | FileChooser {
6 | id: _folderChooser
7 |
8 | property var msgConfig
9 | property MessageResult msgResult
10 |
11 | signal closed()
12 |
13 | title: msgConfig.title
14 | folderUrl: msgConfig.defaultValue
15 | type: FileChooser.OpenDocumentTree
16 |
17 | onAccepted: {
18 | if(msgResult) {
19 | msgResult.complete(MessageConfig.Ok, result);
20 | msgResult = null;
21 | }
22 | closed();
23 | }
24 |
25 | onRejected: {
26 | if(msgResult) {
27 | msgResult.complete(MessageConfig.Cancel);
28 | msgResult = null;
29 | }
30 | closed();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/ContrastToolBar.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import QtQuick.Controls.Material 2.3
4 | import de.skycoder42.QtMvvm.Quick 1.1
5 |
6 | /*! @brief An extension of the @ref QtQuick.Controls.ToolBar "ToolBar" for better appearance
7 | *
8 | * @extends QtQuick.Controls.ToolBar
9 | *
10 | * @details This version basically adjusts size and text color of the toolbar itself and
11 | * controls within the toolbar to look better and improve contrast
12 | *
13 | * @sa ActionButton, ToolBarLabel, MenuButton
14 | */
15 | ToolBar {
16 | id: _contrastToolBar
17 |
18 | height: 56
19 |
20 | //! @copydoc QuickPresenter::accentTextColor
21 | function accentTextColor(accentColor, baseColor) {
22 | return QuickPresenter.accentTextColor(accentColor, baseColor);
23 | }
24 |
25 | Material.foreground: QuickPresenter.accentTextColor(Material.primary, Material.foreground)
26 | }
27 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/DecorLabel.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import de.skycoder42.QtMvvm.Quick 1.1
4 |
5 | /*! @brief An extension of the @ref QtQuick.Controls.Label "Label" for better appearance when
6 | * used in FormLayouts
7 | *
8 | * @extends QtQuick.Controls.Label
9 | *
10 | * This label will automatically change it's color to the highlight color if the the edit
11 | * it is connected to has input focus. This serves as a visual cue to the selected input
12 | *
13 | * @sa DecorLabel::edit
14 | */
15 | Label {
16 | id: _decorLabel
17 |
18 | ColorHelper {
19 | id: helper
20 | }
21 |
22 | /*! @brief The edit this label is connected to
23 | *
24 | * @default{`nextItemInFocusChain()`}
25 | *
26 | * If the edit gets the input focus, this label gets highlighted
27 | *
28 | * @accessors{
29 | * @memberAc{edit}
30 | * @notifyAc{editChanged()}
31 | * }
32 | */
33 | property Item edit: _decorLabel.nextItemInFocusChain()
34 |
35 | /*! @brief Checks if the connected edit currently has input focus
36 | *
37 | * @default{`false`}
38 | *
39 | * @accessors{
40 | * @memberAc{editHasFocus}
41 | * @notifyAc{editHasFocusChanged()}
42 | * @readonlyAc
43 | * }
44 | */
45 | readonly property bool editHasFocus: edit && edit.focus
46 |
47 | color: editHasFocus ? helper.highlight : helper.text
48 | opacity: editHasFocus ? 1 : 0.5
49 | }
50 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/ListSection.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import de.skycoder42.QtMvvm.Quick 1.1
4 |
5 | Label {
6 | property string title
7 |
8 | width: parent.width
9 | font.bold: true
10 | font.capitalization: Font.SmallCaps
11 | padding: 16
12 | bottomPadding: 4
13 | text: title + qsTr(":")
14 |
15 | ColorHelper {
16 | id: helper
17 | }
18 |
19 | background: Rectangle {
20 | anchors.fill: parent
21 | color: "transparent"
22 |
23 | Rectangle {
24 | anchors.left: parent.left
25 | anchors.bottom: parent.bottom
26 | anchors.right: parent.right
27 | height: 2
28 | color: helper.highlight
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/MsgBox.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 |
4 | MsgBoxBase {
5 | id: _msgBox
6 |
7 | iconVisible: msgConfig.subType != "about"
8 | iconSource: {
9 | var base = "qrc:/de/skycoder42/qtmvvm/quick/icons/ic_%1.svg";
10 | switch(String(msgConfig.subType)) {
11 | case "information":
12 | base = base.arg("info");
13 | break;
14 | case "question":
15 | base = base.arg("help");
16 | break;
17 | case "warning":
18 | base = base.arg("warning");
19 | break;
20 | case "critical":
21 | base = base.arg("error");
22 | break;
23 | case "about":
24 | default:
25 | return "";
26 | }
27 | return base;
28 | }
29 |
30 | Label {
31 | id: _contentLabel
32 | text: msgConfig.text.replace(/<\/p>/g, "
") //needed because qml does not put space between paragraphs...
33 | visible: text != ""
34 | anchors.fill: parent
35 | wrapMode: Text.Wrap
36 | onLinkActivated: Qt.openUrlExternally(link)
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/PresenterProgress.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import de.skycoder42.QtMvvm.Quick 1.1
4 |
5 | /*! @brief A @ref QtQuick.Controls.ProgressBar "ProgressBar" with automatic bindings to the
6 | * presenters view loading progress
7 | *
8 | * @extends QtQuick.Controls.ProgressBar
9 | *
10 | * @details You can use this bar in your views to display the load progress of new views to the
11 | * user. The bar automatically anchors itself to the top of the view and hides itself when no
12 | * views are beeing loaded. You can use it as is:
13 | *
14 | * @code{.qml}
15 | * PresenterProgress {}
16 | * @endcode
17 | */
18 | ProgressBar {
19 | visible: QuickPresenter.viewLoading
20 | value: QuickPresenter.loadingProgress
21 |
22 | anchors.left: parent.left
23 | anchors.right: parent.right
24 | anchors.top: parent.top
25 | z: 10
26 | }
27 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/RoundActionButton.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import de.skycoder42.QtMvvm.Quick 1.1
4 |
5 | /*! @brief An extension of the @ref QtQuick.Controls.RoundButton "RoundButton" for better appearance
6 | *
7 | * @extends QtQuick.Controls.RoundButton
8 | *
9 | * @details This version basically adjusts size, icon size and text display to look better and
10 | * fit the Material guidelines. It also adds a tooltip that can be shown via a long press
11 | *
12 | * @sa ContrastToolBar, MenuButton
13 | */
14 | RoundButton {
15 | id: _roundButton
16 |
17 | //! @copydoc ActionButton
18 | property string toolTip: _roundButton.text
19 |
20 | display: AbstractButton.IconOnly
21 | highlighted: true
22 |
23 | implicitHeight: 56 + padding
24 | implicitWidth: 56 + padding
25 |
26 | icon.width: 24
27 | icon.height: 24
28 |
29 | ToolTip.visible: pressed && _roundButton.toolTip != ""
30 | ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
31 | ToolTip.text: _roundButton.toolTip
32 |
33 | onPressAndHold: {
34 | if(_roundButton.toolTip !== "")
35 | QuickPresenter.hapticLongPress();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/SectionListView.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import QtQuick.Layouts 1.3
4 | import de.skycoder42.QtMvvm.Quick 1.1
5 |
6 | ListView {
7 | id: _listView
8 |
9 | property SettingsUiBuilder builder
10 |
11 | section.property: "group"
12 | section.labelPositioning: ViewSection.InlineLabels
13 | section.delegate: ListSection {
14 | title: section
15 | }
16 |
17 | delegate: Loader {
18 | id: loaderDelegate
19 | width: parent.width
20 | height: item ? item.implicitHeight : 0
21 |
22 | onLoaded: {
23 | if(loaderDelegate.item && typeof loaderDelegate.item.showInput !== "undefined") {
24 | loaderDelegate.item.showInput.connect(function(key, title, type, defaultValue, props){
25 | builder.showDialog(key, title, type, defaultValue, props);
26 | });
27 | }
28 | }
29 |
30 | Component.onCompleted: loaderDelegate.setSource(delegateUrl, properties);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/TimeTumbler.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import de.skycoder42.QtMvvm.Quick 1.1
4 |
5 | Tumbler {
6 | id: _timeTumbler
7 |
8 | ColorHelper {
9 | id: helper
10 | }
11 |
12 | Rectangle {
13 | anchors.centerIn: parent
14 | anchors.verticalCenterOffset: -0.5 * currentItem.height
15 | width: currentItem.width * 0.8
16 | height: 1
17 | color: parent.enabled ? helper.highlight : helper.text
18 | }
19 |
20 | Rectangle {
21 | anchors.centerIn: parent
22 | anchors.verticalCenterOffset: 0.5 * currentItem.height
23 | width: currentItem.width * 0.8
24 | height: 1
25 | color: parent.enabled ? helper.highlight : helper.text
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/TintIcon.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import QtGraphicalEffects 1.0
4 | import de.skycoder42.QtMvvm.Quick 1.1
5 |
6 | /*! @brief A simply tinted icon, exactly like you find in i.e. the ActionButton
7 | *
8 | * @extends QtQuick.Item
9 | *
10 | * If you want to use an icon, just like in a ActionButton, you can use this class. It behaves
11 | * exactly the same, but is of course not clickable.
12 | *
13 | * @sa ContrastToolBar, MenuButton
14 | */
15 | Item {
16 | id: _tintIcon
17 |
18 | /*! @brief type:Icon The icon itself
19 | *
20 | * @default{empty icon}
21 | *
22 | * @accessors{
23 | * @memberAc{icon}
24 | * @notifyAc{iconChanged()}
25 | * }
26 | *
27 | * @sa @ref QtQuick.Controls.AbstractButton "AbstractButton.icon"
28 | */
29 | property alias icon: _imgBtn.icon
30 |
31 | implicitWidth: _imgBtn.icon.width
32 | implicitHeight: _imgBtn.icon.height
33 |
34 | Displace {
35 | source: _imgBtn
36 | z: 10
37 | anchors.fill: parent
38 | }
39 |
40 | ActionButton {
41 | id: _imgBtn
42 | visible: false
43 | z: -10
44 | padding: 0
45 | anchors.fill: parent
46 |
47 | ColorHelper {
48 | id: helper
49 | }
50 | icon.color: helper.text
51 |
52 | background: Item {}
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/ToolBarLabel.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 |
4 | /*! @brief An extension of the @ref QtQuick.Controls.Label "Label" for better appearance when
5 | * used in a toolbar
6 | *
7 | * @extends QtQuick.Controls.Label
8 | *
9 | * @details This special label is bigger in size and correctly aligned for use in a toolbar.
10 | * You can either let it fill the whole toolbar or use it in a layout with
11 | * `Layout.fillWidth: true` and it will perfectly fill up the bar like a normal toolbar label
12 | * for mobile activity titles.
13 | *
14 | * @sa ContrastToolBar
15 | */
16 | Label {
17 | id: _toolLabel
18 | font.pointSize: 14
19 | font.bold: true
20 | elide: Label.ElideRight
21 | horizontalAlignment: Qt.AlignLeft
22 | verticalAlignment: Qt.AlignVCenter
23 | leftPadding: 16
24 | }
25 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/icons/ic_chevron_right_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/icons/ic_close_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/icons/ic_error_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/icons/ic_help_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/icons/ic_info_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/icons/ic_more_vert_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/icons/ic_navigate_before_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/icons/ic_navigate_next_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/icons/ic_search_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/icons/ic_settings_backup_restore_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/icons/ic_settings_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/icons/ic_warning_white_24px.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/multifilterproxymodel.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_MULTIFILTERPROXYMODEL_H
2 | #define QTMVVM_MULTIFILTERPROXYMODEL_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | namespace QtMvvm {
9 |
10 | class MultiFilterProxyModel : public QSortFilterProxyModel
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit MultiFilterProxyModel(QObject *parent = nullptr);
16 |
17 | void addFilterRole(int role);
18 | void addFilterRoles(const QList &roles);
19 | void clearFilterRoles();
20 |
21 | void setFilter(const QRegularExpression ®ex);
22 |
23 | protected:
24 | bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override;
25 |
26 | private:
27 | QSet _filterRoles;
28 | QRegularExpression _filterRegex;
29 | };
30 |
31 | }
32 |
33 | #endif // QTMVVM_MULTIFILTERPROXYMODEL_H
34 |
--------------------------------------------------------------------------------
/src/imports/mvvmquick/qtmvvmquick_plugin.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVMQUICK_PLUGIN_H
2 | #define QTMVVMQUICK_PLUGIN_H
3 |
4 | #include
5 |
6 | class QtMvvmQuickDeclarativeModule : public QQmlExtensionPlugin
7 | {
8 | Q_OBJECT
9 | Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
10 |
11 | public:
12 | QtMvvmQuickDeclarativeModule(QObject *parent = nullptr);
13 | void registerTypes(const char *uri) override;
14 | };
15 |
16 | #endif // QTMVVMQUICK_PLUGIN_H
17 |
--------------------------------------------------------------------------------
/src/jar/jar.pro:
--------------------------------------------------------------------------------
1 | TARGET = QtMvvmCore
2 |
3 | load(qt_build_paths)
4 | CONFIG += java
5 |
6 | DESTDIR = $$MODULE_BASE_OUTDIR/jar
7 |
8 | JAVACLASSPATH += $$PWD/src
9 | JAVASOURCES += $$PWD/src/de/skycoder42/qtmvvm/core/AndroidSettingsAccessor.java
10 |
11 | # install
12 | target.path = $$[QT_INSTALL_PREFIX]/jar
13 | INSTALLS += target
14 |
--------------------------------------------------------------------------------
/src/mvvmcore/androidsettingsaccessor_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_ANDROIDSETTINGSACCESSOR_P_H
2 | #define QTMVVM_ANDROIDSETTINGSACCESSOR_P_H
3 |
4 | #include
5 | #include
6 |
7 | #include "androidsettingsaccessor.h"
8 |
9 | namespace QtMvvm {
10 |
11 | class AndroidSettingsAccessorPrivate
12 | {
13 | Q_DISABLE_COPY(AndroidSettingsAccessorPrivate)
14 |
15 | public:
16 | AndroidSettingsAccessor *q;
17 | QAndroidJniObject settings;
18 |
19 | QRegularExpression varRegex;
20 |
21 | AndroidSettingsAccessorPrivate(AndroidSettingsAccessor *q_ptr);
22 | AndroidSettingsAccessorPrivate(AndroidSettingsAccessor *q_ptr, const QString &file, AndroidSettingsAccessor::Mode mode);
23 |
24 | void setup();
25 | QVariant convertFromJava(const QAndroidJniObject &object);
26 |
27 | void dataChangedCallback(const QString &key);
28 | };
29 |
30 | }
31 |
32 | #endif // QTMVVM_ANDROIDSETTINGSACCESSOR_P_H
33 |
--------------------------------------------------------------------------------
/src/mvvmcore/coreapp_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_COREAPP_P_H
2 | #define QTMVVM_COREAPP_P_H
3 |
4 | #include
5 |
6 | #include "qtmvvmcore_global.h"
7 | #include "coreapp.h"
8 |
9 | namespace QtMvvm {
10 |
11 | class Q_MVVMCORE_EXPORT CoreAppPrivate : public QObject
12 | {
13 | Q_OBJECT
14 | friend class QtMvvm::CoreApp;
15 |
16 | public:
17 | CoreAppPrivate();
18 |
19 | static QScopedPointer &dInstance();
20 |
21 | public Q_SLOTS:
22 | void showViewModel(const QMetaObject *metaObject,
23 | const QVariantHash ¶ms,
24 | QPointer parent,
25 | quint32 requestCode);
26 | void showDialog(const QtMvvm::MessageConfig &config, QtMvvm::MessageResult *result);
27 |
28 | private:
29 | static bool bootEnabled;
30 | static QPointer instance;
31 |
32 | IPresenter *presenter = nullptr;
33 | QHash inputTypeMapping;
34 | QHash> singleInstances;
35 |
36 | bool isSingleton(const QMetaObject *metaObject) const;
37 | const QMetaObject * getContainer(const QMetaObject *metaObject) const;
38 |
39 | QPointer showViewModelWithReturn(const QMetaObject *metaObject,
40 | const QVariantHash ¶ms,
41 | QPointer parent,
42 | quint32 requestCode);
43 | };
44 |
45 | }
46 |
47 | #endif // QTMVVM_COREAPP_P_H
48 |
--------------------------------------------------------------------------------
/src/mvvmcore/exception.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_EXCEPTION_H
2 | #define QTMVVM_EXCEPTION_H
3 |
4 | #include "QtMvvmCore/qtmvvmcore_global.h"
5 |
6 | #if !defined(QT_NO_EXCEPTIONS) && QT_CONFIG(future)
7 | #include
8 | #define QTMVVM_EXCEPTION_BASE QException
9 | #define QTMVVM_EXCEPTION_OR override
10 | #else
11 | #include
12 | #define QTMVVM_EXCEPTION_BASE std::exception
13 | #define QTMVVM_EXCEPTION_OR
14 | #endif
15 |
16 | #endif // QTMVVM_EXCEPTION_H
17 |
--------------------------------------------------------------------------------
/src/mvvmcore/injection.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_INJECTION_H
2 | #define QTMVVM_INJECTION_H
3 |
4 | #include "qtmvvmcore_global.h"
5 |
6 | //! The primary namespace of the QtMvvm library
7 | namespace QtMvvm {
8 |
9 | //! Registers QVariant converters from QObject to an interface type registered with Q_DECLARE_INTERFACE
10 | template
11 | inline void registerInterfaceConverter() {
12 | QMetaType::registerConverter([](QObject *o) {
13 | return qobject_cast(o);
14 | });
15 | }
16 |
17 | }
18 |
19 | //! Mark a property for injection
20 | #define QTMVVM_INJECT(classType, name) \
21 | static inline QByteArray __qtmvvm_inject_##name() { \
22 | return QtMvvm::__helpertypes::inject_iid(); \
23 | } \
24 | Q_PROPERTY(QByteArray __qtmvvm_inject_##name READ __qtmvvm_inject_##name STORED false SCRIPTABLE false DESIGNABLE false CONSTANT FINAL)
25 |
26 | //! Create a for injection marked property based on a member
27 | #define QTMVVM_INJECT_PROP(type, name, member) \
28 | Q_PROPERTY(type name MEMBER member) \
29 | QTMVVM_INJECT(type, name)
30 |
31 | //! @file injection.h A header with injection related code
32 | #endif // INJECTION_H
33 |
--------------------------------------------------------------------------------
/src/mvvmcore/ipresenter.cpp:
--------------------------------------------------------------------------------
1 | #include "ipresenter.h"
2 | using namespace QtMvvm;
3 |
4 | PresenterException::PresenterException(const QByteArray &what) :
5 | _what(what)
6 | {}
7 |
8 | PresenterException::PresenterException(const PresenterException * const other) :
9 | _what(other->_what)
10 | {}
11 |
12 | const char *PresenterException::what() const noexcept
13 | {
14 | return _what.constData();
15 | }
16 |
17 | void PresenterException::raise() const
18 | {
19 | throw (*this);
20 | }
21 |
22 | QTMVVM_EXCEPTION_BASE *PresenterException::clone() const
23 | {
24 | return new PresenterException(this);
25 | }
26 |
--------------------------------------------------------------------------------
/src/mvvmcore/isettingsaccessor.cpp:
--------------------------------------------------------------------------------
1 | #include "isettingsaccessor.h"
2 | #include "qsettingsaccessor.h"
3 | using namespace QtMvvm;
4 |
5 | int ISettingsAccessor::_DefaultAccessorType = qMetaTypeId();
6 |
7 | void ISettingsAccessor::setDefaultAccessor(int typeId)
8 | {
9 | auto metaObject = QMetaType::metaObjectForType(typeId);
10 | Q_ASSERT_X(metaObject && metaObject->inherits(&ISettingsAccessor::staticMetaObject),
11 | Q_FUNC_INFO,
12 | "Invalid type ID. Must be a pointer to a class that implements QtMvvm::ISettingsAccessor");
13 | _DefaultAccessorType = typeId;
14 | }
15 |
16 | ISettingsAccessor *ISettingsAccessor::createDefaultAccessor(QObject *parent)
17 | {
18 | auto metaObject = QMetaType::metaObjectForType(_DefaultAccessorType);
19 | if(metaObject)
20 | return qobject_cast(metaObject->newInstance(Q_ARG(QObject*, parent)));
21 | else
22 | return nullptr;
23 | }
24 |
25 | ISettingsAccessor::ISettingsAccessor(QObject *parent) :
26 | QObject{parent}
27 | {}
28 |
--------------------------------------------------------------------------------
/src/mvvmcore/qtmvvm_logging_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_LOGGING_P_H
2 | #define QTMVVM_LOGGING_P_H
3 |
4 | #include
5 |
6 | #include "qtmvvmcore_global.h"
7 |
8 | namespace QtMvvm {
9 |
10 | Q_MVVMCORE_EXPORT Q_DECLARE_LOGGING_CATEGORY(mvvmLoggingCat)
11 |
12 | }
13 |
14 | #define logDebug(...) qCDebug(mvvmLoggingCat, __VA_ARGS__)
15 | #define logInfo(...) qCInfo(mvvmLoggingCat, __VA_ARGS__)
16 | #define logWarning(...) qCWarning(mvvmLoggingCat, __VA_ARGS__)
17 | #define logCritical(...) qCCritical(mvvmLoggingCat, __VA_ARGS__)
18 |
19 | #endif // QTMVVM_LOGGING_P_H
20 |
--------------------------------------------------------------------------------
/src/mvvmcore/qtmvvmcore_global.cpp:
--------------------------------------------------------------------------------
1 | #include "qtmvvmcore_global.h"
2 | #include "qtmvvm_logging_p.h"
3 | #include "serviceregistry.h"
4 | #include "settingsconfigloader_p.h"
5 |
6 | #include
7 |
8 | namespace {
9 |
10 | void qtMvvmCoreStartup()
11 | {
12 | using namespace QtMvvm;
13 | registerInterfaceConverter();
14 | try {
15 | ServiceRegistry::instance()->registerInterface(ServiceRegistry::DestroyOnAppDestroy, true);
16 | } catch(ServiceExistsException &e) {
17 | logDebug() << "Unable to register default ISettingsSetupLoader with error:" << e.what();
18 | }
19 | }
20 |
21 | }
22 | Q_COREAPP_STARTUP_FUNCTION(qtMvvmCoreStartup)
23 |
24 |
25 |
26 | namespace QtMvvm {
27 |
28 | Q_LOGGING_CATEGORY(mvvmLoggingCat, "qtmvvm", QtInfoMsg)
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/src/mvvmcore/qtmvvmcore_global.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVMCORE_GLOBAL_H
2 | #define QTMVVMCORE_GLOBAL_H
3 |
4 | #include
5 |
6 | #include "qtmvvmcore_helpertypes.h"
7 |
8 | #ifndef QT_STATIC
9 | # if defined(QT_BUILD_MVVMCORE_LIB)
10 | # define Q_MVVMCORE_EXPORT Q_DECL_EXPORT
11 | # else
12 | # define Q_MVVMCORE_EXPORT Q_DECL_IMPORT
13 | # endif
14 | #else
15 | # define Q_MVVMCORE_EXPORT
16 | #endif
17 |
18 | #ifndef QTMVVM_REVISION_1
19 | #define QTMVVM_REVISION_1 Q_REVISION(1)
20 | #endif
21 |
22 | #endif // QTMVVMCORE_GLOBAL_H
23 |
--------------------------------------------------------------------------------
/src/mvvmcore/settingsentry.cpp:
--------------------------------------------------------------------------------
1 | #include "settingsentry.h"
2 | using namespace QtMvvm;
3 |
4 | template<>
5 | void QtMvvm::SettingsEntry::set(const QVariant &value)
6 | {
7 | _accessor->save(_key, value);
8 | }
9 |
10 | template<>
11 | QVariant QtMvvm::SettingsEntry::get() const
12 | {
13 | return _accessor->load(_key, _default);
14 | }
15 |
16 | template<>
17 | void QtMvvm::SettingsEntry::addChangeCallback(QObject *scope, const std::function &callback)
18 | {
19 | auto mKey = _key;
20 | auto mDefault = _default;
21 | QObject::connect(_accessor, &ISettingsAccessor::entryChanged,
22 | scope, [mKey, callback](const QString &key, const QVariant &value) {
23 | if(key == mKey)
24 | callback(value);
25 | });
26 | QObject::connect(_accessor, &ISettingsAccessor::entryRemoved,
27 | scope, [mKey, mDefault, callback](const QString &key) {
28 | if(key == mKey)
29 | callback(mDefault);
30 | });
31 | }
32 |
--------------------------------------------------------------------------------
/src/mvvmcore/settingsviewmodel_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_SETTINGSVIEWMODEL_P_H
2 | #define QTMVVM_SETTINGSVIEWMODEL_P_H
3 |
4 | #include "qtmvvmcore_global.h"
5 | #include "settingsviewmodel.h"
6 |
7 | namespace QtMvvm {
8 |
9 | class SettingsViewModelPrivate
10 | {
11 | Q_DISABLE_COPY(SettingsViewModelPrivate)
12 |
13 | public:
14 | SettingsViewModelPrivate() = default;
15 |
16 | ISettingsSetupLoader *setupLoader = nullptr;
17 | ISettingsAccessor *accessor = nullptr;
18 |
19 | QString setupFile;
20 |
21 | SettingsElements::Setup currentSetup;
22 | };
23 |
24 | }
25 |
26 | #endif // QTMVVM_SETTINGSVIEWMODEL_P_H
27 |
--------------------------------------------------------------------------------
/src/mvvmcore/viewmodel_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_VIEWMODEL_P_H
2 | #define QTMVVM_VIEWMODEL_P_H
3 |
4 | #include "qtmvvmcore_global.h"
5 | #include "viewmodel.h"
6 |
7 | namespace QtMvvm {
8 |
9 | class ViewModelPrivate {};
10 |
11 | }
12 |
13 | #endif // QTMVVM_VIEWMODEL_P_H
14 |
--------------------------------------------------------------------------------
/src/mvvmdatasynccore/accountmodel_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_ACCOUNTMODEL_P_H
2 | #define QTMVVM_ACCOUNTMODEL_P_H
3 |
4 | #include "qtmvvmdatasynccore_global.h"
5 | #include "accountmodel.h"
6 |
7 | namespace QtMvvm {
8 |
9 | class AccountModelPrivate
10 | {
11 | Q_DISABLE_COPY(AccountModelPrivate)
12 |
13 | public:
14 | AccountModelPrivate() = default;
15 |
16 | QtDataSync::AccountManager *accountManager = nullptr;
17 | QtDataSync::SyncManager *syncManager = nullptr;
18 | QList devices;
19 | bool reloaded = true;
20 | };
21 |
22 | }
23 |
24 | #endif // QTMVVM_ACCOUNTMODEL_P_H
25 |
--------------------------------------------------------------------------------
/src/mvvmdatasynccore/application-x-datasync-account-data.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Account data of a datasync account as file export
5 | Account data of a datasync account as file export
6 | Account-Daten eines Datasync-Accounts als Dateiexport
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/mvvmdatasynccore/datasyncsettingsaccessor_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_DATASYNCSETTINGSACCESSOR_P_H
2 | #define QTMVVM_DATASYNCSETTINGSACCESSOR_P_H
3 |
4 | #include "qtmvvmdatasynccore_global.h"
5 | #include "datasyncsettingsaccessor.h"
6 |
7 | namespace QtMvvm {
8 |
9 | class DataSyncSettingsAccessorPrivate
10 | {
11 | Q_DISABLE_COPY(DataSyncSettingsAccessorPrivate)
12 |
13 | public:
14 | DataSyncSettingsAccessorPrivate(QtDataSync::DataTypeStore *store);
15 |
16 | QtDataSync::DataTypeStore *store;
17 | };
18 |
19 | }
20 |
21 | #endif // QTMVVM_DATASYNCSETTINGSACCESSOR_P_H
22 |
--------------------------------------------------------------------------------
/src/mvvmdatasynccore/datasyncviewmodel_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_DATASYNCVIEWMODEL_P_H
2 | #define QTMVVM_DATASYNCVIEWMODEL_P_H
3 |
4 | #include
5 |
6 | #include "qtmvvmdatasynccore_global.h"
7 | #include "datasyncviewmodel.h"
8 |
9 | namespace QtMvvm {
10 |
11 | class DataSyncViewModelPrivate
12 | {
13 | Q_DISABLE_COPY(DataSyncViewModelPrivate)
14 |
15 | public:
16 | static const quint32 ExportRequestCode = 0xb201;
17 | static const quint32 ChangeRemoteRequestCode = 0xb202;
18 |
19 | DataSyncViewModelPrivate(DataSyncViewModel *q_ptr);
20 |
21 | DataSyncViewModel *q;
22 | QtDataSync::SyncManager *syncManager = nullptr;
23 | QtDataSync::AccountManager *accountManager = nullptr;
24 | DataSyncViewModel::ColorMap colorMap;
25 | AccountModel *accountModel;
26 | QSortFilterProxyModel *sortedModel;
27 |
28 | QSet pendingGrants;
29 |
30 | void performExport(bool trusted, bool includeServer, const QString &password);
31 | void performImport(bool trusted, const QString &password, const QByteArray &data, bool keepData);
32 | };
33 |
34 | }
35 |
36 | #endif // QTMVVM_DATASYNCVIEWMODEL_P_H
37 |
--------------------------------------------------------------------------------
/src/mvvmdatasynccore/exchangedevicesmodel_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_EXCHANGEDEVICESMODEL_P_H
2 | #define QTMVVM_EXCHANGEDEVICESMODEL_P_H
3 |
4 | #include
5 | #include
6 |
7 | #include "qtmvvmdatasynccore_global.h"
8 | #include "exchangedevicesmodel.h"
9 |
10 | namespace QtMvvm {
11 |
12 | class ExchangeDevicesModelPrivate
13 | {
14 | Q_DISABLE_COPY(ExchangeDevicesModelPrivate)
15 |
16 | public:
17 | ExchangeDevicesModelPrivate() = default;
18 |
19 | struct LimitedUserInfo : public QtDataSync::UserInfo
20 | {
21 | LimitedUserInfo(const QtDataSync::UserInfo &info = {});
22 |
23 | QDeadlineTimer deadline;
24 | };
25 |
26 | QtDataSync::UserExchangeManager *exchangeManager = nullptr;
27 | QList devices;
28 | };
29 |
30 | }
31 |
32 | #endif // QTMVVM_EXCHANGEDEVICESMODEL_P_H
33 |
--------------------------------------------------------------------------------
/src/mvvmdatasynccore/identityeditviewmodel_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_IDENTITYEDITVIEWMODEL_P_H
2 | #define QTMVVM_IDENTITYEDITVIEWMODEL_P_H
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include "qtmvvmdatasynccore_global.h"
9 |
10 | namespace QtMvvm {
11 |
12 | class Q_MVVMDATASYNCCORE_EXPORT IdentityEditViewModel : public ViewModel
13 | {
14 | Q_OBJECT
15 |
16 | Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
17 | Q_PROPERTY(QString fingerPrint READ fingerPrint NOTIFY fingerPrintChanged)
18 | Q_PROPERTY(bool valid READ isValid NOTIFY validChanged)
19 |
20 | public:
21 | Q_INVOKABLE explicit IdentityEditViewModel(QObject *parent = nullptr);
22 |
23 | static QVariantHash showParams(QtDataSync::AccountManager *manager);
24 |
25 | QString name() const;
26 | QString fingerPrint() const;
27 | bool isValid() const;
28 |
29 | public Q_SLOTS:
30 | void save();
31 |
32 | void setName(QString name);
33 |
34 | Q_SIGNALS:
35 | void nameChanged(const QString &name);
36 | void fingerPrintChanged();
37 | void validChanged();
38 |
39 | protected:
40 | void onInit(const QVariantHash &showParams) override;
41 |
42 | private:
43 | QtDataSync::AccountManager *_manager = nullptr;
44 | QString _nameBuffer;
45 | };
46 |
47 | }
48 |
49 | #endif // QTMVVM_IDENTITYEDITVIEWMODEL_P_H
50 |
--------------------------------------------------------------------------------
/src/mvvmdatasynccore/networkexchangeviewmodel_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_NETWORKEXCHANGEVIEWMODEL_P_H
2 | #define QTMVVM_NETWORKEXCHANGEVIEWMODEL_P_H
3 |
4 | #include
5 |
6 | #include "qtmvvmdatasynccore_global.h"
7 | #include "networkexchangeviewmodel.h"
8 |
9 | namespace QtMvvm {
10 |
11 | class NetworkExchangeViewModelPrivate
12 | {
13 | Q_DISABLE_COPY(NetworkExchangeViewModelPrivate)
14 |
15 | public:
16 | static const quint32 ExportRequestCode = 0xb300;
17 |
18 | NetworkExchangeViewModelPrivate(NetworkExchangeViewModel *q_ptr);
19 |
20 | QtDataSync::UserExchangeManager *exchangeManager = nullptr;
21 | ExchangeDevicesModel *deviceModel;
22 | QSortFilterProxyModel *sortedModel;
23 | quint16 port = QtDataSync::UserExchangeManager::DataExchangePort;
24 | QHash activeExports;
25 |
26 | bool active = false; //TODO remove once fixed in datasync
27 | };
28 |
29 | }
30 |
31 | #endif // QTMVVM_NETWORKEXCHANGEVIEWMODEL_P_H
32 |
--------------------------------------------------------------------------------
/src/mvvmdatasynccore/qtmvvmdatasynccore_global.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVMDATASYNCCORE_GLOBAL_H
2 | #define QTMVVMDATASYNCCORE_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifndef QT_STATIC
7 | # if defined(QT_BUILD_MVVMDATASYNCCORE_LIB)
8 | # define Q_MVVMDATASYNCCORE_EXPORT Q_DECL_EXPORT
9 | # else
10 | # define Q_MVVMDATASYNCCORE_EXPORT Q_DECL_IMPORT
11 | # endif
12 | #else
13 | # define Q_MVVMDATASYNCCORE_EXPORT
14 | #endif
15 |
16 | #endif // QTMVVMDATASYNCCORE_GLOBAL_H
17 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncquick/ChangeRemoteView.qml:
--------------------------------------------------------------------------------
1 | import de.skycoder42.QtMvvm.DataSync.Quick 1.1 as QtMvvm
2 |
3 | QtMvvm.ChangeRemoteView {}
4 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncquick/DataSyncView.qml:
--------------------------------------------------------------------------------
1 | import de.skycoder42.QtMvvm.DataSync.Quick 1.1 as QtMvvm
2 |
3 | QtMvvm.DataSyncView {}
4 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncquick/ExportSetupView.qml:
--------------------------------------------------------------------------------
1 | import de.skycoder42.QtMvvm.DataSync.Quick 1.1 as QtMvvm
2 |
3 | QtMvvm.ExportSetupView {}
4 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncquick/IdentityEditView.qml:
--------------------------------------------------------------------------------
1 | import de.skycoder42.QtMvvm.DataSync.Quick 1.1 as QtMvvm
2 |
3 | QtMvvm.IdentityEditView {}
4 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncquick/NetworkExchangeView.qml:
--------------------------------------------------------------------------------
1 | import de.skycoder42.QtMvvm.DataSync.Quick 1.1 as QtMvvm
2 |
3 | QtMvvm.NetworkExchangeView {}
4 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncquick/mvvmdatasyncquick.pro:
--------------------------------------------------------------------------------
1 | TARGET = QtMvvmDataSyncQuick
2 |
3 | QT = core gui quick mvvmdatasynccore mvvmquick mvvmdatasynccore-private
4 |
5 | HEADERS += \
6 | qtmvvmdatasyncquick_global.h
7 |
8 | SOURCES += \
9 | qtmvvmdatasyncquick_global.cpp
10 |
11 | RESOURCES += \
12 | qtmvvmdatasyncquick_module.qrc
13 |
14 | TRANSLATIONS += \
15 | translations/qtmvvmdatasyncquick_de.ts \
16 | translations/qtmvvmdatasyncquick_template.ts
17 |
18 | load(qt_module)
19 |
20 | CONFIG += lrelease
21 | QM_FILES_INSTALL_PATH = $$[QT_INSTALL_TRANSLATIONS]
22 |
23 | win32 {
24 | QMAKE_TARGET_PRODUCT = "$$TARGET"
25 | QMAKE_TARGET_COMPANY = "Skycoder42"
26 | QMAKE_TARGET_COPYRIGHT = "Felix Barz"
27 | } else:mac {
28 | QMAKE_TARGET_BUNDLE_PREFIX = "com.skycoder42."
29 | }
30 |
31 | # source include for lupdate
32 | never_true_for_lupdate {
33 | SOURCES += $$files(../imports/mvvmdatasyncquick/*.cpp) \
34 | $$files(../imports/mvvmdatasyncquick/*.qml)
35 | }
36 |
37 | !load(qdep):error("Failed to load qdep feature! Run 'qdep prfgen --qmake $$QMAKE_QMAKE' to create it.")
38 |
39 | #replace template qm by ts
40 | QM_FILES -= $$__qdep_lrelease_real_dir/qtmvvmdatasyncquick_template.qm
41 | QM_FILES += translations/qtmvvmdatasyncquick_template.ts
42 |
43 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncquick/qtmvvmdatasyncquick_global.cpp:
--------------------------------------------------------------------------------
1 | #include "qtmvvmdatasyncquick_global.h"
2 |
3 | static void initResources()
4 | {
5 | #ifdef QT_STATIC
6 | Q_INIT_RESOURCE(qtmvvmdatasyncquick_module);
7 | #endif
8 | }
9 |
10 | void QtMvvm::registerDataSyncQuick()
11 | {
12 | initResources();
13 | }
14 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncquick/qtmvvmdatasyncquick_global.h:
--------------------------------------------------------------------------------
1 | #ifndef MVVMDATASYNCQUICK_GLOBAL_H
2 | #define MVVMDATASYNCQUICK_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifndef QT_STATIC
7 | # if defined(QT_BUILD_MVVMDATASYNCQUICK_LIB)
8 | # define Q_MVVMDATASYNCQUICK_EXPORT Q_DECL_EXPORT
9 | # else
10 | # define Q_MVVMDATASYNCQUICK_EXPORT Q_DECL_IMPORT
11 | # endif
12 | #else
13 | # define Q_MVVMDATASYNCQUICK_EXPORT
14 | #endif
15 |
16 | namespace QtMvvm {
17 |
18 | //! A method to initialize the datasync quick mvvm module
19 | Q_MVVMDATASYNCQUICK_EXPORT void registerDataSyncQuick();
20 |
21 | }
22 |
23 | #endif // MVVMDATASYNCQUICK_GLOBAL_H
24 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncquick/qtmvvmdatasyncquick_module.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | DataSyncView.qml
4 | IdentityEditView.qml
5 | ExportSetupView.qml
6 | ChangeRemoteView.qml
7 | NetworkExchangeView.qml
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/changeremotedialog_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_CHANGEREMOTEDIALOG_P_H
2 | #define QTMVVM_CHANGEREMOTEDIALOG_P_H
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include
9 |
10 | #include "qtmvvmdatasyncwidgets_global.h"
11 |
12 | namespace Ui {
13 | class ChangeRemoteDialog;
14 | }
15 |
16 | namespace QtMvvm {
17 |
18 | class Q_MVVMDATASYNCWIDGETS_EXPORT ChangeRemoteDialog : public QDialog
19 | {
20 | Q_OBJECT
21 |
22 | public:
23 | Q_INVOKABLE explicit ChangeRemoteDialog(QtMvvm::ViewModel *viewModel, QWidget *parent = nullptr);
24 | ~ChangeRemoteDialog() override;
25 |
26 | public Q_SLOTS:
27 | void accept() override;
28 |
29 | private Q_SLOTS:
30 | void addHeader();
31 | void removeHeader();
32 |
33 | private:
34 | ChangeRemoteViewModel *_viewModel;
35 | QScopedPointer ui;
36 | };
37 |
38 | }
39 |
40 | #endif // QTMVVM_CHANGEREMOTEDIALOG_P_H
41 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/datasyncwindow_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_DATASYNCWINDOW_P_H
2 | #define QTMVVM_DATASYNCWINDOW_P_H
3 |
4 | #include "qtmvvmdatasyncwidgets_global.h"
5 | #include "datasyncwindow.h"
6 |
7 | namespace Ui {
8 | class DataSyncWindow;
9 | }
10 |
11 | namespace QtMvvm {
12 |
13 | class DataSyncWindowPrivate
14 | {
15 | Q_DISABLE_COPY(DataSyncWindowPrivate)
16 |
17 | public:
18 | DataSyncWindowPrivate(ViewModel *viewModel);
19 |
20 | DataSyncViewModel *viewModel;
21 | QScopedPointer ui;
22 | };
23 |
24 | }
25 |
26 | #endif // QTMVVM_DATASYNCWINDOW_P_H
27 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/exportsetupdialog_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_EXPORTSETUPDIALOG_P_H
2 | #define QTMVVM_EXPORTSETUPDIALOG_P_H
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include
9 |
10 | #include "qtmvvmdatasyncwidgets_global.h"
11 |
12 | namespace Ui {
13 | class ExportSetupDialog;
14 | }
15 |
16 | namespace QtMvvm {
17 |
18 | class Q_MVVMDATASYNCWIDGETS_EXPORT ExportSetupDialog : public QDialog
19 | {
20 | Q_OBJECT
21 |
22 | public:
23 | Q_INVOKABLE explicit ExportSetupDialog(QtMvvm::ViewModel *viewModel, QWidget *parent = nullptr);
24 | ~ExportSetupDialog() override;
25 |
26 | public Q_SLOTS:
27 | void accept() override;
28 |
29 | private:
30 | ExportSetupViewModel *_viewModel;
31 | QScopedPointer ui;
32 | };
33 |
34 | }
35 |
36 | #endif // EXPORTSETUPDIALOG_P_H
37 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/icons/add.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/src/mvvmdatasyncwidgets/icons/add.ico
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/icons/arrow_refresh.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/src/mvvmdatasyncwidgets/icons/arrow_refresh.ico
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/icons/card_export.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/src/mvvmdatasyncwidgets/icons/card_export.ico
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/icons/card_import.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/src/mvvmdatasyncwidgets/icons/card_import.ico
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/icons/delete.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/src/mvvmdatasyncwidgets/icons/delete.ico
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/icons/fingerprint.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/src/mvvmdatasyncwidgets/icons/fingerprint.ico
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/icons/key_go.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/src/mvvmdatasyncwidgets/icons/key_go.ico
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/icons/server_edit.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/src/mvvmdatasyncwidgets/icons/server_edit.ico
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/icons/user.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/src/mvvmdatasyncwidgets/icons/user.ico
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/icons/user_delete.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/src/mvvmdatasyncwidgets/icons/user_delete.ico
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/icons/world_go.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/src/mvvmdatasyncwidgets/icons/world_go.ico
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/identityeditdialog.cpp:
--------------------------------------------------------------------------------
1 | #include "identityeditdialog_p.h"
2 | #include "ui_identityeditdialog.h"
3 | #include
4 | #include
5 | using namespace QtMvvm;
6 |
7 | IdentityEditDialog::IdentityEditDialog(ViewModel *viewModel, QWidget *parent) :
8 | QDialog(parent),
9 | _viewModel(static_cast(viewModel)),
10 | ui(new Ui::IdentityEditDialog)
11 | {
12 | ui->setupUi(this);
13 | if(parentWidget()) {
14 | setWindowModality(Qt::WindowModal);
15 | setWindowFlags(Qt::Sheet | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);
16 | } else {
17 | setWindowModality(Qt::ApplicationModal);
18 | setWindowFlags(Qt::Dialog | Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint);
19 | }
20 |
21 | bind(_viewModel, "name",
22 | ui->deviceNameLineEdit, "text",
23 | Binding::TwoWay,
24 | nullptr, "editingFinished()");
25 | bind(_viewModel, "fingerPrint",
26 | ui->fingerPrintDisplayLabel, "text",
27 | Binding::OneWayToView);
28 | bind(_viewModel, "valid",
29 | ui->buttonBox->button(QDialogButtonBox::Save), "enabled",
30 | Binding::OneWayToView);
31 | }
32 |
33 | IdentityEditDialog::~IdentityEditDialog() = default;
34 |
35 | void IdentityEditDialog::accept()
36 | {
37 | _viewModel->save();
38 | QDialog::accept();
39 | }
40 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/identityeditdialog_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_IDENTITYEDITDIALOG_P_H
2 | #define QTMVVM_IDENTITYEDITDIALOG_P_H
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include
9 |
10 | #include "qtmvvmdatasyncwidgets_global.h"
11 |
12 | namespace Ui {
13 | class IdentityEditDialog;
14 | }
15 |
16 | namespace QtMvvm {
17 |
18 | class Q_MVVMDATASYNCWIDGETS_EXPORT IdentityEditDialog : public QDialog
19 | {
20 | Q_OBJECT
21 |
22 | public:
23 | Q_INVOKABLE explicit IdentityEditDialog(QtMvvm::ViewModel *viewModel, QWidget *parent = nullptr);
24 | ~IdentityEditDialog() override;
25 |
26 | public Q_SLOTS:
27 | void accept() override;
28 |
29 | private:
30 | IdentityEditViewModel *_viewModel;
31 | QScopedPointer ui;
32 | };
33 |
34 | }
35 |
36 | #endif // QTMVVM_IDENTITYEDITDIALOG_P_H
37 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/networkexchangewindow.cpp:
--------------------------------------------------------------------------------
1 | #include "networkexchangewindow.h"
2 | #include "networkexchangewindow_p.h"
3 | #include "ui_networkexchangewindow.h"
4 | #include
5 | using namespace QtMvvm;
6 |
7 | NetworkExchangeWindow::NetworkExchangeWindow(ViewModel *viewModel, QWidget *parent) :
8 | QWidget(parent, Qt::Window),
9 | d(new NetworkExchangeWindowPrivate(viewModel))
10 | {
11 | d->ui->setupUi(this);
12 |
13 | connect(d->ui->treeView, &QTreeView::activated,
14 | this, &NetworkExchangeWindow::activated);
15 |
16 | bind(d->viewModel, "port",
17 | d->ui->exchangePortSpinBox, "value");
18 | bind(d->viewModel, "deviceName",
19 | d->ui->deviceNameLineEdit, "text",
20 | Binding::TwoWay,
21 | nullptr, "editingFinished()");
22 | bind(d->viewModel, "active",
23 | d->ui->exchangeCheckBox, "checked");
24 |
25 | d->ui->treeView->setModel(d->viewModel->sortedModel());
26 | }
27 |
28 | NetworkExchangeWindow::~NetworkExchangeWindow() = default;
29 |
30 | void NetworkExchangeWindow::activated(const QModelIndex &index)
31 | {
32 | if(index.isValid())
33 | d->viewModel->exportTo(index.row());
34 | }
35 |
36 | // ------------- Private Implementation -------------
37 |
38 | NetworkExchangeWindowPrivate::NetworkExchangeWindowPrivate(ViewModel *viewModel) :
39 | viewModel(static_cast(viewModel)),
40 | ui(new Ui::NetworkExchangeWindow())
41 | {}
42 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/networkexchangewindow.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_NETWORKEXCHANGEWINDOW_H
2 | #define QTMVVM_NETWORKEXCHANGEWINDOW_H
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include
9 |
10 | #include "QtMvvmDataSyncWidgets/qtmvvmdatasyncwidgets_global.h"
11 |
12 | namespace QtMvvm {
13 |
14 | class NetworkExchangeWindowPrivate;
15 | //! The widgets view implementation for the NetworkExchangeViewModel
16 | class Q_MVVMDATASYNCWIDGETS_EXPORT NetworkExchangeWindow : public QWidget
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 | //! View constructor
22 | Q_INVOKABLE explicit NetworkExchangeWindow(QtMvvm::ViewModel *viewModel, QWidget *parent = nullptr);
23 | ~NetworkExchangeWindow() override;
24 |
25 | private Q_SLOTS:
26 | void activated(const QModelIndex &index);
27 |
28 | private:
29 | QScopedPointer d;
30 | };
31 |
32 | }
33 |
34 | #endif // QTMVVM_NETWORKEXCHANGEWINDOW_H
35 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/networkexchangewindow_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_NETWORKEXCHANGEWINDOW_P_H
2 | #define QTMVVM_NETWORKEXCHANGEWINDOW_P_H
3 |
4 | #include "qtmvvmdatasyncwidgets_global.h"
5 | #include "networkexchangewindow.h"
6 |
7 | namespace Ui {
8 | class NetworkExchangeWindow;
9 | }
10 |
11 | namespace QtMvvm {
12 |
13 | class NetworkExchangeWindowPrivate
14 | {
15 | Q_DISABLE_COPY(NetworkExchangeWindowPrivate)
16 |
17 | public:
18 | NetworkExchangeWindowPrivate(ViewModel *viewModel);
19 |
20 | NetworkExchangeViewModel *viewModel;
21 | QScopedPointer ui;
22 | };
23 |
24 | }
25 |
26 | #endif // QTMVVM_NETWORKEXCHANGEWINDOW_P_H
27 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/qtmvvmdatasyncwidgets_global.cpp:
--------------------------------------------------------------------------------
1 | #include "qtmvvmdatasyncwidgets_global.h"
2 | #include
3 |
4 | #include "datasyncwindow.h"
5 | #include "networkexchangewindow.h"
6 | #include "exportsetupdialog_p.h"
7 | #include "changeremotedialog_p.h"
8 | #include "identityeditdialog_p.h"
9 |
10 | static void initResources()
11 | {
12 | #ifdef QT_STATIC
13 | Q_INIT_RESOURCE(qtmvvmdatasyncwidgets_module);
14 | #endif
15 | }
16 |
17 | void QtMvvm::registerDataSyncWidgets()
18 | {
19 | initResources();
20 | QtMvvm::WidgetsPresenter::registerView();
21 | QtMvvm::WidgetsPresenter::registerView();
22 | QtMvvm::WidgetsPresenter::registerView();
23 | QtMvvm::WidgetsPresenter::registerView();
24 | QtMvvm::WidgetsPresenter::registerView();
25 | }
26 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/qtmvvmdatasyncwidgets_global.h:
--------------------------------------------------------------------------------
1 | #ifndef MVVMDATASYNCWIDGETS_GLOBAL_H
2 | #define MVVMDATASYNCWIDGETS_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifndef QT_STATIC
7 | # if defined(QT_BUILD_MVVMDATASYNCWIDGETS_LIB)
8 | # define Q_MVVMDATASYNCWIDGETS_EXPORT Q_DECL_EXPORT
9 | # else
10 | # define Q_MVVMDATASYNCWIDGETS_EXPORT Q_DECL_IMPORT
11 | # endif
12 | #else
13 | # define Q_MVVMDATASYNCWIDGETS_EXPORT
14 | #endif
15 |
16 | namespace QtMvvm {
17 |
18 | //! A method to initialize the datasync widgets mvvm module
19 | Q_MVVMDATASYNCWIDGETS_EXPORT void registerDataSyncWidgets();
20 |
21 | }
22 |
23 | #endif // MVVMDATASYNCWIDGETS_GLOBAL_H
24 |
--------------------------------------------------------------------------------
/src/mvvmdatasyncwidgets/qtmvvmdatasyncwidgets_module.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | icons/add.ico
4 | icons/arrow_refresh.ico
5 | icons/card_export.ico
6 | icons/card_import.ico
7 | icons/delete.ico
8 | icons/fingerprint.ico
9 | icons/key_go.ico
10 | icons/server_edit.ico
11 | icons/user_delete.ico
12 | icons/user.ico
13 | icons/world_go.ico
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/mvvmquick/BoolDelegate.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import QtQuick.Layouts 1.3
4 | import de.skycoder42.QtMvvm.Quick 1.1
5 |
6 | CheckDelegate {
7 | id: _boolDelegate
8 |
9 | text: title
10 |
11 | checked: inputValue
12 | onCheckedChanged: {
13 | if(inputValue !== checked)
14 | inputValue = checked;
15 | }
16 |
17 | ToolTip.visible: pressed && tooltip != ""
18 | ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
19 | ToolTip.text: tooltip
20 | onPressAndHold: QuickPresenter.hapticLongPress()
21 |
22 | contentItem: GridLayout {
23 | columns: 2
24 | rows: 2
25 |
26 | Label {
27 | id: _titleLabel
28 | text: _boolDelegate.text
29 | Layout.row: 0
30 | Layout.column: 0
31 | font.bold: true
32 | elide: Label.ElideRight
33 | Layout.fillWidth: true
34 | }
35 |
36 | Label {
37 | id: _peviewLabel
38 | visible: preview
39 | Layout.row: 1
40 | Layout.column: 0
41 | text: preview
42 | wrapMode: Text.WordWrap
43 | Layout.fillWidth: true
44 | }
45 |
46 | Item {
47 | Layout.row: 0
48 | Layout.column: 1
49 | Layout.rowSpan: 2
50 | Layout.minimumWidth: implicitWidth
51 | Layout.maximumWidth: implicitWidth
52 | implicitWidth: _boolDelegate.indicator.width + 14
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/mvvmquick/CheckBox.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 |
4 | CheckBox {
5 | id: _edit
6 | property alias inputValue: _edit.checked
7 | }
8 |
--------------------------------------------------------------------------------
/src/mvvmquick/ColorDelegate.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import de.skycoder42.QtMvvm.Quick 1.1 as QtMvvm
3 |
4 | QtMvvm.MsgDelegate {
5 | id: _colorDelegate
6 |
7 | editDialogType: "QColor"
8 | indicatorComponent: Rectangle {
9 | id: colorCircle
10 | width: 24
11 | height: 24
12 | radius: height / 2
13 | color: inputValue
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/mvvmquick/ColorEdit.qml:
--------------------------------------------------------------------------------
1 | import de.skycoder42.QtMvvm.Quick 1.1 as QtMvvm
2 |
3 | QtMvvm.ColorEdit {
4 | id: _edit
5 | property alias inputValue: _edit.color
6 | }
7 |
--------------------------------------------------------------------------------
/src/mvvmquick/DateEdit.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import de.skycoder42.QtMvvm.Quick 1.1 as QtMvvm
3 |
4 | QtMvvm.DateEdit {
5 | id: _edit
6 | property alias inputValue: _edit.date
7 | }
8 |
--------------------------------------------------------------------------------
/src/mvvmquick/DoubleSpinBox.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 |
4 | SpinBox {
5 | id: _edit
6 | property alias inputValue: _edit.dValue
7 | property alias minimum: _edit.dFrom
8 | property alias maximum: _edit.dTo
9 | editable: true
10 |
11 | //double spinbox code
12 | property int decimals: 2
13 | property double dFrom: 0.0
14 | property double dTo: 100.0
15 | property double dValue: 0.0
16 | property double dStepSize: 0.1
17 |
18 | readonly property int factor: Math.pow(10, _edit.decimals)
19 |
20 | stepSize: _edit.dStepSize * _edit.factor
21 | from: _edit.dFrom * _edit.factor
22 | to: _edit.dTo * _edit.factor
23 | value: _edit.dValue * _edit.factor
24 |
25 | validator: DoubleValidator {
26 | bottom: _edit.dFrom
27 | top: _edit.dTo
28 | }
29 |
30 | textFromValue: function(value, locale) {
31 | return Number(value / _edit.factor).toLocaleString(locale, 'f', _edit.decimals);
32 | }
33 |
34 | valueFromText: function(text, locale) {
35 | return Number.fromLocaleString(locale, text) * _edit.factor;
36 | }
37 |
38 | onDValueChanged: _edit.value = _edit.dValue * _edit.factor
39 | onValueChanged: _edit.dValue = _edit.value / _edit.factor
40 | }
41 |
--------------------------------------------------------------------------------
/src/mvvmquick/FontEdit.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 |
4 | Item {
5 | id: _edit
6 | implicitWidth: _listEdit.implicitWidth
7 | implicitHeight: _listEdit.implicitHeight
8 |
9 | property font inputValue: _listEdit.font
10 |
11 | ListEdit {
12 | id: _listEdit
13 | anchors.fill: parent
14 |
15 | inputValue: _edit.inputValue.family
16 | onInputValueChanged: _edit.inputValue = Qt.font({family: inputValue})
17 |
18 | model: Qt.fontFamilies()
19 | editable: false
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/mvvmquick/ListDelegate.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import QtQuick.Layouts 1.3
4 | import de.skycoder42.QtMvvm.Quick 1.1
5 |
6 | MsgDelegate {
7 | id: _listDelegate
8 | editDialogType: "radiolist"
9 | }
10 |
--------------------------------------------------------------------------------
/src/mvvmquick/ListEdit.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 |
4 | ComboBox {
5 | id: _edit
6 | property var inputValue
7 | property alias listElements: _edit.model
8 | readonly property bool isExtended: Boolean(model[0] && model[0].name)
9 |
10 | property bool _skipNext: false
11 |
12 | textRole: isExtended ? "name" : ""
13 |
14 | onInputValueChanged: {
15 | if(_skipNext) {
16 | _skipNext = false;
17 | return;
18 | } else
19 | _skipNext = true;
20 |
21 | var found = false;
22 | var i;
23 | if(isExtended) {
24 | for(i = 0; i < model.length; i++) {
25 | if(model[i].value == inputValue) {
26 | currentIndex = i;
27 | found = true;
28 | break;
29 | }
30 | }
31 | } else {
32 | for(i = 0; i < model.length; i++) {
33 | if(model[i] == inputValue) {
34 | currentIndex = i;
35 | found = true;
36 | break;
37 | }
38 | }
39 | }
40 | if(!found)
41 | editText = inputValue;
42 | }
43 |
44 | onEditTextChanged: {
45 | if(_skipNext) {
46 | _skipNext = false;
47 | return;
48 | } else
49 | _skipNext = true;
50 |
51 | if(isExtended) {
52 | var value = model[currentIndex].value;
53 | if(typeof value !== "undefined")
54 | inputValue = value;
55 | else
56 | inputValue = editText;
57 | } else
58 | inputValue = editText
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/mvvmquick/MsgDelegate.qml:
--------------------------------------------------------------------------------
1 | import de.skycoder42.QtMvvm.Quick 1.1 as QtMvvm
2 |
3 | QtMvvm.MsgDelegate {}
4 |
--------------------------------------------------------------------------------
/src/mvvmquick/RadioListEdit.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 |
4 | ListView {
5 | id: _edit
6 | property var inputValue
7 | property alias listElements: _edit.model
8 | readonly property bool isExtended: Boolean(model[0] && model[0].name)
9 |
10 | implicitHeight: dummyDelegate.height * model.length
11 |
12 | ScrollBar.vertical: ScrollBar {}
13 |
14 | delegate: RadioDelegate {
15 | width: parent.width
16 | text: isExtended ? _edit.model[index].name : modelData
17 |
18 | checked: (isExtended ? _edit.model[index].value : modelData) == inputValue
19 | onClicked: inputValue = (isExtended ? _edit.model[index].value : modelData)
20 | }
21 |
22 | RadioDelegate {
23 | id:dummyDelegate
24 | visible: false
25 | text: "dummy"
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/mvvmquick/RangeDelegate.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import QtQuick.Layouts 1.3
4 | import de.skycoder42.QtMvvm.Quick 1.1
5 |
6 | ItemDelegate {
7 | id: _sliderDelegate
8 |
9 | property alias minimum: _slider.from
10 | property alias maximum: _slider.to
11 | property string valueFormat: "%L1"
12 |
13 | text: title
14 |
15 | ToolTip.visible: pressed && tooltip != ""
16 | ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
17 | ToolTip.text: tooltip
18 | onPressAndHold: QuickPresenter.hapticLongPress()
19 |
20 | contentItem: ColumnLayout {
21 | Label {
22 | id: _titleLabel
23 | text: _sliderDelegate.text
24 | font.bold: true
25 | elide: Label.ElideRight
26 | Layout.fillWidth: true
27 | }
28 |
29 | Slider {
30 | id: _slider
31 | Layout.fillWidth: true
32 |
33 | stepSize: 1
34 | snapMode: Slider.SnapAlways
35 | live: false
36 | value: inputValue
37 | onValueChanged: {
38 | var nValue = Math.round(_slider.value)
39 | if(nValue != inputValue)
40 | inputValue = nValue
41 | }
42 |
43 | ToolTip {
44 | parent: _slider.handle
45 | visible: _slider.pressed
46 | text: valueFormat.arg(Math.round(_slider.from + _slider.visualPosition * (_slider.to - _slider.from)))
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/mvvmquick/SettingsView.qml:
--------------------------------------------------------------------------------
1 | import de.skycoder42.QtMvvm.Quick 1.1 as QtMvvm
2 |
3 | QtMvvm.SettingsView {}
4 |
--------------------------------------------------------------------------------
/src/mvvmquick/Slider.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 |
4 | Slider {
5 | id: _edit
6 |
7 | property int inputValue
8 | property alias minimum: _edit.from
9 | property alias maximum: _edit.to
10 | property string valueFormat: "%L1"
11 |
12 | stepSize: 1
13 | snapMode: Slider.SnapAlways
14 | live: false
15 | value: inputValue
16 | onValueChanged: {
17 | var nValue = Math.round(_edit.value)
18 | if(nValue != inputValue)
19 | inputValue = nValue
20 | }
21 |
22 | ToolTip {
23 | parent: _slider.handle
24 | visible: _slider.pressed
25 | text: valueFormat.arg(Math.round(_slider.from + _slider.visualPosition * (_slider.to - _slider.from)))
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/mvvmquick/SpinBox.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 |
4 | SpinBox {
5 | id: _edit
6 | property alias inputValue: _edit.value
7 | property alias minimum: _edit.from
8 | property alias maximum: _edit.to
9 | editable: true
10 | }
11 |
--------------------------------------------------------------------------------
/src/mvvmquick/Switch.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 |
4 | Switch {
5 | id: _edit
6 | property alias inputValue: _edit.checked
7 | }
8 |
--------------------------------------------------------------------------------
/src/mvvmquick/SwitchDelegate.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3 as Controls
3 | import QtQuick.Layouts 1.3
4 | import de.skycoder42.QtMvvm.Quick 1.1
5 |
6 | Controls.SwitchDelegate {
7 | id: _boolDelegate
8 |
9 | text: title
10 |
11 | checked: inputValue
12 | onCheckedChanged: {
13 | if(inputValue !== checked)
14 | inputValue = checked;
15 | }
16 |
17 | Controls.ToolTip.visible: pressed && tooltip != ""
18 | Controls.ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
19 | Controls.ToolTip.text: tooltip
20 | onPressAndHold: QuickPresenter.hapticLongPress()
21 |
22 | contentItem: GridLayout {
23 | columns: 2
24 | rows: 2
25 |
26 | Controls.Label {
27 | id: _titleLabel
28 | text: _boolDelegate.text
29 | Layout.row: 0
30 | Layout.column: 0
31 | font.bold: true
32 | elide: Label.ElideRight
33 | Layout.fillWidth: true
34 | }
35 |
36 | Controls.Label {
37 | id: _previewLabel
38 | visible: preview
39 | Layout.row: 1
40 | Layout.column: 0
41 | text: preview
42 | wrapMode: Text.WordWrap
43 | Layout.fillWidth: true
44 | }
45 |
46 | Item {
47 | Layout.row: 0
48 | Layout.column: 1
49 | Layout.rowSpan: 2
50 | Layout.minimumWidth: implicitWidth
51 | Layout.maximumWidth: implicitWidth
52 | implicitWidth: _boolDelegate.indicator.width + 14
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/mvvmquick/TextField.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 |
4 | TextField {
5 | id: _edit
6 | property alias inputValue: _edit.text
7 | property string regexp: ""
8 | property string patternOptions
9 |
10 | selectByMouse: true
11 | validator: regexp != "" ? _validator.createObject(_edit) : null
12 |
13 | Component {
14 | id: _validator
15 | RegExpValidator {
16 | regExp: new RegExp(_edit.regexp, optionsAsString(_edit.patternOptions))
17 |
18 | function optionsAsString(options) {
19 | var resStr;
20 | if((options & 0x0001) != 0) //QRegularExpression::CaseInsensitiveOption
21 | resStr += "i";
22 | if((options & 0x0004) != 0) //QRegularExpression::MultilineOption
23 | resStr += "m";
24 | if((options & 0x0040) != 0) //QRegularExpression::UseUnicodePropertiesOption
25 | resStr += "u";
26 | return resStr;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/mvvmquick/TimeEdit.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import de.skycoder42.QtMvvm.Quick 1.1 as QtMvvm
3 |
4 | QtMvvm.TimeEdit {
5 | id: _edit
6 | property alias inputValue: _edit.time
7 | }
8 |
--------------------------------------------------------------------------------
/src/mvvmquick/UrlField.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import QtQuick.Controls 2.3
3 | import de.skycoder42.QtMvvm.Quick.Private 1.0
4 |
5 | TextField {
6 | id: _edit
7 | property alias inputValue: _edit.text
8 | property alias allowedSchemes: _validator.allowedSchemes
9 |
10 | selectByMouse: true
11 | validator: UrlValidator {
12 | id: _validator
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/mvvmquick/inputviewfactory_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_INPUTVIEWFACTORY_P_H
2 | #define QTMVVM_INPUTVIEWFACTORY_P_H
3 |
4 | #include "qtmvvmquick_global.h"
5 | #include "inputviewfactory.h"
6 |
7 | namespace QtMvvm {
8 |
9 | class InputViewFactoryPrivate
10 | {
11 | Q_DISABLE_COPY(InputViewFactoryPrivate)
12 |
13 | public:
14 | InputViewFactoryPrivate();
15 |
16 | QHash simpleInputs;
17 | QHash simpleDelegates;
18 | QHash> formatters;
19 | QHash inputAliases;
20 | QHash delegateAliases;
21 | QHash formatterAliases;
22 | };
23 |
24 | }
25 |
26 | #endif // QTMVVM_INPUTVIEWFACTORY_P_H
27 |
--------------------------------------------------------------------------------
/src/mvvmquick/mvvmquick.pro:
--------------------------------------------------------------------------------
1 | TARGET = QtMvvmQuick
2 |
3 | QT = core gui qml quick svg mvvmcore mvvmcore-private
4 |
5 | HEADERS += \
6 | qtmvvmquick_global.h \
7 | quickpresenter.h \
8 | quickpresenter_p.h \
9 | inputviewfactory.h \
10 | inputviewfactory_p.h \
11 | formatters_p.h
12 |
13 | SOURCES += \
14 | quickpresenter.cpp \
15 | inputviewfactory.cpp
16 |
17 | RESOURCES += \
18 | qtmvvmquick_module.qrc
19 |
20 | TRANSLATIONS += \
21 | translations/qtmvvmquick_de.ts \
22 | translations/qtmvvmquick_template.ts
23 |
24 | load(qt_module)
25 |
26 | CONFIG += lrelease
27 | QM_FILES_INSTALL_PATH = $$[QT_INSTALL_TRANSLATIONS]
28 |
29 | win32 {
30 | QMAKE_TARGET_PRODUCT = "$$TARGET"
31 | QMAKE_TARGET_COMPANY = "Skycoder42"
32 | QMAKE_TARGET_COPYRIGHT = "Felix Barz"
33 | } else:mac {
34 | QMAKE_TARGET_BUNDLE_PREFIX = "com.skycoder42."
35 | }
36 |
37 | QDEP_DEPENDS += \
38 | Skycoder42/QUrlValidator@1.2.0
39 |
40 | # source include for lupdate
41 | never_true_for_lupdate {
42 | SOURCES += $$files(../imports/mvvmquick/*.cpp) \
43 | $$files(../imports/mvvmquick/*.qml)
44 | }
45 |
46 | !load(qdep):error("Failed to load qdep feature! Run 'qdep prfgen --qmake $$QMAKE_QMAKE' to create it.")
47 |
48 | #replace template qm by ts
49 | QM_FILES -= $$__qdep_lrelease_real_dir/qtmvvmquick_template.qm
50 | QM_FILES += translations/qtmvvmquick_template.ts
51 |
--------------------------------------------------------------------------------
/src/mvvmquick/qtmvvmquick_global.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVMQUICK_GLOBAL_H
2 | #define QTMVVMQUICK_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifndef QT_STATIC
7 | # if defined(QT_BUILD_MVVMQUICK_LIB)
8 | # define Q_MVVMQUICK_EXPORT Q_DECL_EXPORT
9 | # else
10 | # define Q_MVVMQUICK_EXPORT Q_DECL_IMPORT
11 | # endif
12 | #else
13 | # define Q_MVVMQUICK_EXPORT
14 | #endif
15 |
16 | #endif // QTMVVMQUICK_GLOBAL_H
17 |
--------------------------------------------------------------------------------
/src/mvvmquick/qtmvvmquick_module.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | ListEdit.qml
4 | TextField.qml
5 | SpinBox.qml
6 | CheckBox.qml
7 | DoubleSpinBox.qml
8 | FontEdit.qml
9 | UrlField.qml
10 | Switch.qml
11 | RadioListEdit.qml
12 | Slider.qml
13 | TimeEdit.qml
14 | DateEdit.qml
15 | DateTimeEdit.qml
16 | ColorEdit.qml
17 |
18 |
19 | BoolDelegate.qml
20 | MsgDelegate.qml
21 | SwitchDelegate.qml
22 | ListDelegate.qml
23 | RangeDelegate.qml
24 | ColorDelegate.qml
25 |
26 |
27 | SettingsView.qml
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/mvvmquick/quickpresenter_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_QUICKPRESENTER_P_H
2 | #define QTMVVM_QUICKPRESENTER_P_H
3 |
4 | #include
5 | #include
6 |
7 | #include "qtmvvmquick_global.h"
8 | #include "quickpresenter.h"
9 |
10 | namespace QtMvvm {
11 |
12 | class Q_MVVMQUICK_EXPORT QuickPresenterPrivate
13 | {
14 | Q_DISABLE_COPY(QuickPresenterPrivate)
15 | friend class QtMvvm::QuickPresenter;
16 |
17 | public:
18 | QuickPresenterPrivate() = default;
19 |
20 | static QuickPresenter *currentPresenter();
21 | static void setQmlPresenter(QObject *presenter);
22 |
23 | private:
24 | QPointer qmlPresenter;
25 | InputViewFactory *inputViewFactory = nullptr;
26 |
27 | QHash explicitMappings;
28 | QStringList searchDirs{QStringLiteral(":/qtmvvm/views")};
29 | };
30 |
31 | }
32 |
33 | #endif // QTMVVM_QUICKPRESENTER_P_H
34 |
--------------------------------------------------------------------------------
/src/mvvmwidgets/fontcombobox.cpp:
--------------------------------------------------------------------------------
1 | #include "fontcombobox_p.h"
2 | using namespace QtMvvm;
3 |
4 | FontComboBox::FontComboBox(QWidget *parent) :
5 | QFontComboBox(parent)
6 | {
7 | connect(this, &FontComboBox::currentFontChanged,
8 | this, &FontComboBox::currentFontChangedImp);
9 | setCurrentFont(font());
10 | }
11 |
--------------------------------------------------------------------------------
/src/mvvmwidgets/fontcombobox_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_FONTCOMBOBOX_P_H
2 | #define QTMVVM_FONTCOMBOBOX_P_H
3 |
4 | #include
5 |
6 | #include "qtmvvmwidgets_global.h"
7 |
8 | namespace QtMvvm {
9 |
10 | class FontComboBox : public QFontComboBox
11 | {
12 | Q_OBJECT
13 |
14 | Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChangedImp USER true)
15 |
16 | public:
17 | explicit FontComboBox(QWidget *parent = nullptr);
18 |
19 | Q_SIGNALS:
20 | void currentFontChangedImp(const QFont &font);
21 | };
22 |
23 | }
24 |
25 | #endif // QTMVVM_FONTCOMBOBOX_P_H
26 |
--------------------------------------------------------------------------------
/src/mvvmwidgets/inputwidgetfactory_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_INPUTWIDGETFACTORY_P_H
2 | #define QTMVVM_INPUTWIDGETFACTORY_P_H
3 |
4 | #include "qtmvvmwidgets_global.h"
5 | #include "inputwidgetfactory.h"
6 |
7 | namespace QtMvvm {
8 |
9 | class InputWidgetFactoryPrivate
10 | {
11 | Q_DISABLE_COPY(InputWidgetFactoryPrivate)
12 |
13 | public:
14 | InputWidgetFactoryPrivate() = default;
15 |
16 | QHash> simpleWidgets;
17 | QHash aliases;
18 | };
19 |
20 | }
21 |
22 | #endif // QTMVVM_INPUTWIDGETFACTORY_P_H
23 |
--------------------------------------------------------------------------------
/src/mvvmwidgets/ipresentingview.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_IPRESENTINGVIEW_H
2 | #define QTMVVM_IPRESENTINGVIEW_H
3 |
4 | #include
5 |
6 | #include "QtMvvmWidgets/qtmvvmwidgets_global.h"
7 |
8 | namespace QtMvvm {
9 |
10 | //! A simple interface to make it possible for any view to present subviews
11 | class Q_MVVMWIDGETS_EXPORT IPresentingView
12 | {
13 | Q_DISABLE_COPY(IPresentingView)
14 | public:
15 | inline IPresentingView() = default;
16 | inline virtual ~IPresentingView() = default;
17 |
18 | //! Is called to try to present a view
19 | virtual bool tryPresent(QWidget *view) = 0;
20 | };
21 |
22 | }
23 |
24 | //! The IID of the QtMvvm::IPresentingView class
25 | #define QtMvvm_IPresentingViewIid "de.skycoder42.qtmvvm.widgets.IPresentingView"
26 | Q_DECLARE_INTERFACE(QtMvvm::IPresentingView, QtMvvm_IPresentingViewIid)
27 |
28 | //! @file ipresentingview.h The header of the IPresentingView interface
29 | #endif // QTMVVM_IPRESENTINGVIEW_H
30 |
--------------------------------------------------------------------------------
/src/mvvmwidgets/progressdialog_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_PROGRESSDIALOG_P_H
2 | #define QTMVVM_PROGRESSDIALOG_P_H
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 | #include "qtmvvmwidgets_global.h"
14 |
15 | namespace QtMvvm {
16 |
17 | class ProgressDialog : public QDialog
18 | {
19 | Q_OBJECT
20 |
21 | public:
22 | explicit ProgressDialog(const MessageConfig &config,
23 | QPointer result,
24 | QPointer control,
25 | QWidget *parent = nullptr);
26 |
27 | public Q_SLOTS:
28 | void done(int code) override;
29 |
30 | protected:
31 | void closeEvent(QCloseEvent *event) override;
32 |
33 | private Q_SLOTS:
34 | void tryCancel(QDialogButtonBox::StandardButton btn);
35 |
36 | void updateLabel(const QString &text);
37 | void setIndetem(bool indetem);
38 | void setMin(int min);
39 | void setMax(int max);
40 | void setProg(int prog);
41 |
42 | private:
43 | QPointer _result;
44 | QPointer _control;
45 |
46 | QLabel *_label;
47 | QProgressBar *_progress;
48 | QDialogButtonBox *_btnBox = nullptr;
49 | MessageConfig::StandardButton _cancelAction = MessageConfig::NoButton;
50 | };
51 |
52 | }
53 |
54 | #endif // QTMVVM_PROGRESSDIALOG_P_H
55 |
--------------------------------------------------------------------------------
/src/mvvmwidgets/qtmvvmwidgets_global.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVMWIDGETS_GLOBAL_H
2 | #define QTMVVMWIDGETS_GLOBAL_H
3 |
4 | #include
5 |
6 | #ifndef QT_STATIC
7 | # if defined(QT_BUILD_MVVMWIDGETS_LIB)
8 | # define Q_MVVMWIDGETS_EXPORT Q_DECL_EXPORT
9 | # else
10 | # define Q_MVVMWIDGETS_EXPORT Q_DECL_IMPORT
11 | # endif
12 | #else
13 | # define Q_MVVMWIDGETS_EXPORT
14 | #endif
15 |
16 | #endif // QTMVVMWIDGETS_GLOBAL_H
17 |
--------------------------------------------------------------------------------
/src/mvvmwidgets/qtmvvmwidgets_module.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | setting_tools.ico
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/mvvmwidgets/selectcombobox_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_SELECTCOMBOBOX_P_H
2 | #define QTMVVM_SELECTCOMBOBOX_P_H
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include "qtmvvmwidgets_global.h"
9 |
10 | namespace QtMvvm {
11 |
12 | class SelectComboBox : public QComboBox
13 | {
14 | Q_OBJECT
15 |
16 | Q_PROPERTY(QVariant currentValue READ currentValue WRITE setCurrentValue NOTIFY currentValueChanged USER true)
17 | Q_PROPERTY(QVariantList listElements READ listElements WRITE setListElements NOTIFY listElementsChanged)
18 |
19 | public:
20 | explicit SelectComboBox(QWidget *parent = nullptr);
21 |
22 | QVariant currentValue() const;
23 | QVariantList listElements() const;
24 |
25 | public Q_SLOTS:
26 | void setCurrentValue(const QVariant &data);
27 | void setListElements(const QVariantList &listElements);
28 |
29 | Q_SIGNALS:
30 | void currentValueChanged();
31 | void listElementsChanged(const QVariantList &listElements);
32 | };
33 |
34 | }
35 |
36 | #endif // QTMVVM_SELECTCOMBOBOX_P_H
37 |
--------------------------------------------------------------------------------
/src/mvvmwidgets/setting_tools.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/src/mvvmwidgets/setting_tools.ico
--------------------------------------------------------------------------------
/src/mvvmwidgets/settingsdialog.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_SETTINGSDIALOG_H
2 | #define QTMVVM_SETTINGSDIALOG_H
3 |
4 | #include
5 |
6 | #include
7 |
8 | #include
9 |
10 | #include "QtMvvmWidgets/qtmvvmwidgets_global.h"
11 |
12 | namespace QtMvvm {
13 |
14 | class SettingsDialogPrivate;
15 | //! The widgets view implementation for the SettingsViewModel
16 | class Q_MVVMWIDGETS_EXPORT SettingsDialog : public QDialog
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 | //! View constructor
22 | Q_INVOKABLE explicit SettingsDialog(QtMvvm::ViewModel *viewModel, QWidget *parent = nullptr);
23 | ~SettingsDialog() override;
24 |
25 | protected:
26 | //! Returns the stylesheet used highlight labels found when searching
27 | virtual QString labelFilterStyleSheet() const;
28 | //! Return a url to overwrite the default settings icon
29 | virtual QUrl iconOverwrite() const;
30 |
31 | private:
32 | friend class QtMvvm::SettingsDialogPrivate;
33 | SettingsDialogPrivate *d;
34 | };
35 |
36 | }
37 |
38 | #endif // QTMVVM_SETTINGSDIALOG_H
39 |
--------------------------------------------------------------------------------
/src/mvvmwidgets/tooltipslider.cpp:
--------------------------------------------------------------------------------
1 | #include "tooltipslider_p.h"
2 | #include
3 | #include
4 | using namespace QtMvvm;
5 |
6 | ToolTipSlider::ToolTipSlider(QWidget *parent) :
7 | QSlider{Qt::Horizontal, parent}
8 | {
9 | setTracking(false);
10 | connect(this, &ToolTipSlider::sliderMoved,
11 | this, &ToolTipSlider::onMoved);
12 | }
13 |
14 | void ToolTipSlider::onMoved(int position)
15 | {
16 | auto format = property("valueFormat").toString();
17 | if(format.isEmpty())
18 | format = QStringLiteral("%L1");
19 | auto mPos = mapToGlobal({0,0});
20 | mPos.setX(QCursor::pos().x());
21 | QToolTip::showText(mPos, format.arg(position), this);
22 | }
23 |
--------------------------------------------------------------------------------
/src/mvvmwidgets/tooltipslider_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_TOOLTIPSLIDER_P_H
2 | #define QTMVVM_TOOLTIPSLIDER_P_H
3 |
4 | #include
5 |
6 | #include "qtmvvmwidgets_global.h"
7 |
8 | namespace QtMvvm {
9 |
10 | class ToolTipSlider : public QSlider
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | explicit ToolTipSlider(QWidget *parent = nullptr);
16 |
17 | private Q_SLOTS:
18 | void onMoved(int position);
19 | };
20 |
21 | }
22 |
23 | #endif // QTMVVM_TOOLTIPSLIDER_P_H
24 |
--------------------------------------------------------------------------------
/src/mvvmwidgets/widgetspresenter_p.h:
--------------------------------------------------------------------------------
1 | #ifndef QTMVVM_WIDGETSPRESENTER_P_H
2 | #define QTMVVM_WIDGETSPRESENTER_P_H
3 |
4 | #include
5 | #include
6 | #include
7 |
8 | #include "qtmvvmwidgets_global.h"
9 | #include "widgetspresenter.h"
10 |
11 | namespace QtMvvm {
12 |
13 | class WidgetsPresenterPrivate
14 | {
15 | Q_DISABLE_COPY(WidgetsPresenterPrivate)
16 |
17 | public:
18 | WidgetsPresenterPrivate();
19 |
20 | static WidgetsPresenter *currentPresenter();
21 |
22 | InputWidgetFactory* inputViewFactory = nullptr;
23 | QSet implicitMappings;
24 | QHash explicitMappings;
25 |
26 | static QWidget *parent(const QVariantMap &properties);
27 | };
28 |
29 | Q_MVVMWIDGETS_EXPORT QValidator *createUrlValidator(QStringList schemes, QObject* parent = nullptr);
30 |
31 | }
32 |
33 | #endif // QTMVVM_WIDGETSPRESENTER_P_H
34 |
--------------------------------------------------------------------------------
/src/settingsconfig/prefix_p.h:
--------------------------------------------------------------------------------
1 | #ifndef PREFIX_P_H
2 | #define PREFIX_P_H
3 |
4 | #if defined(BUILD_QSETTINGSGENERATOR)
5 | #define Q_MVVMCORE_EXPORT
6 | #else
7 | #include "qtmvvmcore_global.h"
8 | #endif
9 |
10 | #endif // PREFIX_P_H
11 |
--------------------------------------------------------------------------------
/src/settingsconfig/settingsconfig.pri:
--------------------------------------------------------------------------------
1 | HEADERS += \
2 | $$PWD/../3rdparty/optional-lite/optional.hpp \
3 | $$PWD/../3rdparty/variant-lite/variant.hpp \
4 | $$PWD/prefix_p.h \
5 | $$PWD/settingsconfigimpl_p.h
6 |
7 | SOURCES += $$PWD/settingsconfigimpl.cpp
8 |
9 | XML_SCHEMA_DEFINITIONS += $$PWD/settingsconfig.xsd
10 |
11 | INCLUDEPATH += $$PWD $$PWD/../3rdparty/optional-lite $$PWD/../3rdparty/variant-lite
12 |
13 | contains(QT, xmlpatterns): RESOURCES += \
14 | $$PWD/settingsconfig.qrc
15 |
16 | QDEP_DEPENDS += \
17 | Skycoder42/QXmlCodeGen@1.4.1
18 |
--------------------------------------------------------------------------------
/src/settingsconfig/settingsconfig.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | settingsconfig.xsd
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/src.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | SUBDIRS += mvvmcore \
4 | mvvmwidgets \
5 | mvvmquick \
6 | imports
7 |
8 | mvvmwidgets.depends += mvvmcore
9 | mvvmquick.depends += mvvmcore
10 | imports.depends += mvvmcore mvvmquick
11 |
12 | android {
13 | SUBDIRS += jar
14 | jar.CONFIG += no_lrelease_target
15 | }
16 |
17 | qtHaveModule(datasync) {
18 | SUBDIRS += mvvmdatasynccore \
19 | mvvmdatasyncwidgets \
20 | mvvmdatasyncquick
21 |
22 | mvvmdatasynccore.depends += mvvmcore
23 | mvvmdatasyncwidgets.depends += mvvmdatasynccore mvvmwidgets
24 | mvvmdatasyncquick.depends += mvvmdatasynccore mvvmquick
25 | imports.depends += mvvmdatasynccore mvvmdatasyncquick
26 | }
27 |
28 | imports.CONFIG += no_lrelease_target
29 |
30 | prepareRecursiveTarget(lrelease)
31 | QMAKE_EXTRA_TARGETS += lrelease
32 | QMAKE_EXTRA_TARGETS += run-tests
33 |
--------------------------------------------------------------------------------
/sync.profile:
--------------------------------------------------------------------------------
1 | %modules = (
2 | "QtMvvmCore" => "$basedir/src/mvvmcore",
3 | "QtMvvmWidgets" => "$basedir/src/mvvmwidgets",
4 | "QtMvvmQuick" => "$basedir/src/mvvmquick",
5 | "QtMvvmDataSyncCore" => "$basedir/src/mvvmdatasynccore",
6 | "QtMvvmDataSyncWidgets" => "$basedir/src/mvvmdatasyncwidgets",
7 | "QtMvvmDataSyncQuick" => "$basedir/src/mvvmdatasyncquick"
8 | );
9 |
10 | # Force generation of camel case headers for classes inside QtDataSync namespaces
11 | $publicclassregexp = "QtMvvm::(?!__helpertypes|SettingsElements).+";
12 |
13 | %classnames = (
14 | "message.h" => "Messages,MessageConfig,MessageResult,ProgressControl",
15 | "settingssetup.h" => "SettingsElements",
16 | "injection.h" => "Injection",
17 | );
18 |
--------------------------------------------------------------------------------
/tests/auto/auto.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | SUBDIRS += cmake \
4 | mvvmcore \
5 | qml
6 |
7 | qtHaveModule(datasync) {
8 | SUBDIRS += \
9 | mvvmdatasynccore
10 | }
11 |
12 | cmake.CONFIG += no_run-tests_target
13 | prepareRecursiveTarget(run-tests)
14 | QMAKE_EXTRA_TARGETS += run-tests
15 |
--------------------------------------------------------------------------------
/tests/auto/cmake/CMakeLists.txt:
--------------------------------------------------------------------------------
1 |
2 | cmake_minimum_required(VERSION 2.8)
3 |
4 | project(qmake_cmake_files)
5 |
6 | enable_testing()
7 |
8 | find_package(Qt5Core REQUIRED)
9 |
10 | include("${_Qt5CTestMacros}")
11 |
12 | test_module_includes(
13 | Mvvm QMvvm
14 | )
15 |
--------------------------------------------------------------------------------
/tests/auto/cmake/cmake.pro:
--------------------------------------------------------------------------------
1 |
2 | # Cause make to do nothing.
3 | TEMPLATE = subdirs
4 |
5 | CMAKE_QT_MODULES_UNDER_TEST = mvvm
6 |
7 | CONFIG += ctest_testcase
8 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/binding/binding.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 |
3 | QT += testlib mvvmcore
4 | QT -= gui
5 | CONFIG += console
6 | CONFIG -= app_bundle
7 |
8 | TARGET = tst_binding
9 |
10 | SOURCES += \
11 | tst_binding.cpp
12 |
13 | include(../../testrun.pri)
14 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/coreapp/coreapp.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 |
3 | QT += testlib mvvmcore
4 | QT -= gui
5 | CONFIG += console
6 | CONFIG -= app_bundle
7 |
8 | TARGET = tst_coreapp
9 |
10 | SOURCES += \
11 | tst_coreapp.cpp \
12 | testapp.cpp \
13 | testpresenter.cpp \
14 | testviewmodel.cpp
15 |
16 | HEADERS += \
17 | testapp.h \
18 | testpresenter.h \
19 | testviewmodel.h
20 |
21 | include(../../testrun.pri)
22 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/coreapp/testapp.cpp:
--------------------------------------------------------------------------------
1 | #include "testapp.h"
2 | #include
3 |
4 | TestApp::TestApp(QObject *parent) :
5 | CoreApp(parent)
6 | {}
7 |
8 | TestPresenter *TestApp::presenter()
9 | {
10 | return static_cast(CoreApp::presenter());
11 | }
12 |
13 | void TestApp::performRegistrations()
14 | {
15 | wasRegistered = true;
16 | }
17 |
18 | int TestApp::startApp(const QStringList &arguments)
19 | {
20 | startArgs = arguments;
21 | return EXIT_SUCCESS;
22 | }
23 |
24 | void TestApp::closeApp()
25 | {
26 | wasClosed = false;
27 | }
28 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/coreapp/testapp.h:
--------------------------------------------------------------------------------
1 | #ifndef TESTAPP_H
2 | #define TESTAPP_H
3 |
4 | #include
5 | #include "testpresenter.h"
6 |
7 | class TestApp : public QtMvvm::CoreApp
8 | {
9 | Q_OBJECT
10 |
11 | public:
12 | explicit TestApp(QObject *parent = nullptr);
13 |
14 | bool wasRegistered = false;
15 | QStringList startArgs;
16 | bool wasClosed = false;
17 |
18 | static TestPresenter *presenter();
19 |
20 | protected:
21 | void performRegistrations() override;
22 | int startApp(const QStringList &arguments) override;
23 | void closeApp() override;
24 | };
25 |
26 | #undef coreApp
27 | #define coreApp static_cast(QtMvvm::CoreApp::instance())
28 |
29 | #endif // TESTAPP_H
30 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/coreapp/testpresenter.cpp:
--------------------------------------------------------------------------------
1 | #include "testpresenter.h"
2 |
3 | TestPresenter::TestPresenter(QObject *parent) :
4 | QObject{parent}
5 | {}
6 |
7 | void TestPresenter::present(QtMvvm::ViewModel *viewModel, const QVariantHash ¶ms, QPointer parent)
8 | {
9 | presented.append(std::make_tuple(viewModel, params, parent));
10 | emit presentDone();
11 | }
12 |
13 | void TestPresenter::showDialog(const QtMvvm::MessageConfig &config, QtMvvm::MessageResult *result)
14 | {
15 | dialogs.append(std::make_tuple(config, result));
16 | emit dialogDone();
17 | }
18 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/coreapp/testpresenter.h:
--------------------------------------------------------------------------------
1 | #ifndef TESTPRESENTER_H
2 | #define TESTPRESENTER_H
3 |
4 | #include
5 | #include
6 |
7 | class TestPresenter : public QObject, public QtMvvm::IPresenter
8 | {
9 | Q_OBJECT
10 | Q_INTERFACES(QtMvvm::IPresenter)
11 |
12 | public:
13 | Q_INVOKABLE explicit TestPresenter(QObject *parent = nullptr);
14 |
15 | void present(QtMvvm::ViewModel *viewModel, const QVariantHash ¶ms, QPointer parent) override;
16 | void showDialog(const QtMvvm::MessageConfig &config, QtMvvm::MessageResult *result) override;
17 |
18 | QList>> presented;
19 | QList> dialogs;
20 |
21 | Q_SIGNALS:
22 | void presentDone();
23 | void dialogDone();
24 | };
25 |
26 | #endif // TESTPRESENTER_H
27 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/coreapp/testviewmodel.cpp:
--------------------------------------------------------------------------------
1 | #include "testviewmodel.h"
2 |
3 | TestViewModel::TestViewModel(QObject *parent) :
4 | ViewModel(parent)
5 | {}
6 |
7 | void TestViewModel::presenChild(const QVariantHash ¶ms)
8 | {
9 | show(params);
10 | }
11 |
12 | void TestViewModel::presentResult(quint32 code)
13 | {
14 | showForResult(code);
15 | }
16 |
17 | void TestViewModel::onInit(const QVariantHash ¶ms)
18 | {
19 | }
20 |
21 | void TestViewModel::onResult(quint32 requestCode, const QVariant &result)
22 | {
23 | results.append(std::make_tuple(requestCode, result));
24 | }
25 |
26 |
27 |
28 | TestSingleViewModel::TestSingleViewModel(QObject *parent) :
29 | ViewModel(parent)
30 | {}
31 |
32 |
33 |
34 | TestContainedViewModel::TestContainedViewModel(QObject *parent) :
35 | ViewModel(parent)
36 | {}
37 |
38 |
39 |
40 | TestContainedSingleViewModel::TestContainedSingleViewModel(QObject *parent) :
41 | ViewModel(parent)
42 | {}
43 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/coreapp/testviewmodel.h:
--------------------------------------------------------------------------------
1 | #ifndef TESTVIEWMODEL_H
2 | #define TESTVIEWMODEL_H
3 |
4 | #include
5 |
6 | class TestViewModel : public QtMvvm::ViewModel
7 | {
8 | Q_OBJECT
9 |
10 | public:
11 | Q_INVOKABLE explicit TestViewModel(QObject *parent = nullptr);
12 |
13 | void presenChild(const QVariantHash ¶ms = {});
14 | void presentResult(quint32 code);
15 |
16 | QList> results;
17 |
18 | public Q_SLOTS:
19 | void onInit(const QVariantHash ¶ms) override;
20 | void onResult(quint32 requestCode, const QVariant &result) override;
21 | };
22 | Q_DECLARE_METATYPE(TestViewModel*)
23 |
24 | class TestSingleViewModel : public QtMvvm::ViewModel
25 | {
26 | Q_OBJECT
27 | QTMVVM_SINGLETON
28 |
29 | public:
30 | Q_INVOKABLE explicit TestSingleViewModel(QObject *parent = nullptr);
31 | };
32 | Q_DECLARE_METATYPE(TestSingleViewModel*)
33 |
34 | class TestContainedViewModel : public QtMvvm::ViewModel
35 | {
36 | Q_OBJECT
37 | QTMVVM_CONTAINER_VM(TestViewModel)
38 |
39 | public:
40 | Q_INVOKABLE explicit TestContainedViewModel(QObject *parent = nullptr);
41 | };
42 |
43 | class TestContainedSingleViewModel : public QtMvvm::ViewModel
44 | {
45 | Q_OBJECT
46 | QTMVVM_CONTAINER_VM(TestSingleViewModel)
47 |
48 | public:
49 | Q_INVOKABLE explicit TestContainedSingleViewModel(QObject *parent = nullptr);
50 | };
51 |
52 | #endif // TESTVIEWMODEL_H
53 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/mvvmcore.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | SUBDIRS += \
4 | settingsgenerator \
5 | serviceregistry \
6 | serviceregistrytestplugin \
7 | binding \
8 | qsettingsaccessor \
9 | settingsconfigloader \
10 | coreapp
11 |
12 | serviceregistry.depends += serviceregistrytestplugin
13 |
14 | equals(MSVC_VER, 14.0) {
15 | SUBDIRS -= \
16 | settingsgenerator \
17 | settingsconfigloader
18 | }
19 |
20 | prepareRecursiveTarget(run-tests)
21 | QMAKE_EXTRA_TARGETS += run-tests
22 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/qsettingsaccessor/qsettingsaccessor.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 |
3 | QT += testlib mvvmcore
4 | QT -= gui
5 | CONFIG += console
6 | CONFIG -= app_bundle
7 |
8 | TARGET = tst_qsettingsaccessor
9 |
10 | HEADERS += \
11 | ../../../shared/tst_isettingsaccessor.h
12 |
13 | SOURCES += \
14 | tst_qsettingsaccessor.cpp
15 |
16 | include(../../testrun.pri)
17 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/serviceregistry/plugintestinterface.h:
--------------------------------------------------------------------------------
1 | #ifndef PLUGINTESTINTERFACE_H
2 | #define PLUGINTESTINTERFACE_H
3 |
4 | #include
5 |
6 | class PluginTestInterface
7 | {
8 | Q_DISABLE_COPY(PluginTestInterface)
9 | public:
10 | inline PluginTestInterface() = default;
11 | virtual inline ~PluginTestInterface() = default;
12 |
13 | virtual int magicNumber() const = 0;
14 | };
15 |
16 | #define PluginTestInterfaceIId "de.skycoder42.qtmvvm.core.tests.PluginTestInterface"
17 | Q_DECLARE_INTERFACE(PluginTestInterface, PluginTestInterfaceIId)
18 |
19 | #endif // PLUGINTESTINTERFACE_H
20 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/serviceregistry/serviceregistry.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 |
3 | QT += testlib mvvmcore
4 | QT -= gui
5 | CONFIG += console
6 | CONFIG -= app_bundle
7 |
8 | TARGET = tst_serviceregistry
9 |
10 | HEADERS += \
11 | testinterface.h \
12 | testservice.h \
13 | testobject.h \
14 | plugintestinterface.h
15 |
16 | SOURCES += \
17 | tst_serviceregistry.cpp \
18 | testservice.cpp \
19 | testobject.cpp
20 |
21 | load(qt_build_paths)
22 | DEFINES += PLUGIN_TESTDIR=\\\"$$MODULE_BASE_OUTDIR/tests/plugins\\\"
23 |
24 | include(../../testrun.pri)
25 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/serviceregistry/testinterface.h:
--------------------------------------------------------------------------------
1 | #ifndef TESTINTERFACE_H
2 | #define TESTINTERFACE_H
3 |
4 | #include
5 |
6 | class TestInterface
7 | {
8 | Q_DISABLE_COPY(TestInterface)
9 | public:
10 | inline TestInterface() = default;
11 | virtual inline ~TestInterface() = default;
12 | };
13 |
14 | #define TestInterfaceIId "de.skycoder42.qtmvvm.core.tests.TestInterface"
15 | Q_DECLARE_INTERFACE(TestInterface, TestInterfaceIId)
16 |
17 | #endif // TESTINTERFACE_H
18 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/serviceregistry/testobject.cpp:
--------------------------------------------------------------------------------
1 | #include "testobject.h"
2 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/serviceregistry/testservice.cpp:
--------------------------------------------------------------------------------
1 | #include "testservice.h"
2 |
3 | TestService::TestService(QObject *parent) :
4 | QObject{parent}
5 | {}
6 |
7 | WeakTestService::WeakTestService(QObject *parent) :
8 | TestService{parent}
9 | {}
10 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/serviceregistry/testservice.h:
--------------------------------------------------------------------------------
1 | #ifndef TESTSERVICE_H
2 | #define TESTSERVICE_H
3 |
4 | #include
5 | #include "testinterface.h"
6 |
7 | class TestService : public QObject, public TestInterface
8 | {
9 | Q_OBJECT
10 | Q_INTERFACES(TestInterface)
11 |
12 | public:
13 | Q_INVOKABLE explicit TestService(QObject *parent = nullptr);
14 | };
15 |
16 | class WeakTestService : public TestService
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 | Q_INVOKABLE explicit WeakTestService(QObject *parent = nullptr);
22 | };
23 |
24 | #endif // TESTSERVICE_H
25 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/serviceregistrytestplugin/serviceregistrytestplugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "Keys" : [ "test1", "test2" ]
3 | }
4 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/serviceregistrytestplugin/serviceregistrytestplugin.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = lib
2 | CONFIG += plugin
3 |
4 | QT = core mvvmcore
5 |
6 | load(qt_build_paths)
7 |
8 | TARGET = $$qtLibraryTarget(serviceregistry_testplugin)
9 | DESTDIR = $$MODULE_BASE_OUTDIR/tests/plugins/serviceregistry
10 |
11 | HEADERS += \
12 | testplugin.h \
13 | ../serviceregistry/plugintestinterface.h
14 |
15 | SOURCES += \
16 | testplugin.cpp
17 |
18 | DISTFILES += serviceregistrytestplugin.json
19 |
20 | QMAKE_EXTRA_TARGETS += run-tests
21 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/serviceregistrytestplugin/testplugin.cpp:
--------------------------------------------------------------------------------
1 | #include "testplugin.h"
2 |
3 | TestPlugin::TestPlugin(QObject *parent) :
4 | QObject{parent}
5 | {}
6 |
7 | int TestPlugin::magicNumber() const
8 | {
9 | return 72;
10 | }
11 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/serviceregistrytestplugin/testplugin.h:
--------------------------------------------------------------------------------
1 | #ifndef TESTPLUGIN_H
2 | #define TESTPLUGIN_H
3 |
4 | #include "../serviceregistry/plugintestinterface.h"
5 |
6 | class TestPlugin : public QObject, public PluginTestInterface
7 | {
8 | Q_OBJECT
9 | Q_INTERFACES(PluginTestInterface)
10 | Q_PLUGIN_METADATA(IID PluginTestInterfaceIId FILE "serviceregistrytestplugin.json")
11 |
12 | public:
13 | TestPlugin(QObject *parent = nullptr);
14 |
15 | int magicNumber() const override;
16 | };
17 |
18 | #endif // TESTPLUGIN_H
19 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsconfigloader/categoryDocument.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
13 |
14 |
15 |
18 |
19 |
23 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsconfigloader/entryDocument.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
11 |
13 | hello
14 | world
15 |
16 |
18 | 42
19 | baum42
20 |
21 | 13
22 |
23 | 4.2
24 |
25 |
26 | 42
27 |
28 |
29 |
30 | 42
31 |
32 | 4.2
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsconfigloader/groupDocument.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
11 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsconfigloader/includeDocument.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | includeDocument_category.xml
4 |
5 | includeDocument_section.xml
6 |
7 |
8 | includeDocument_group.xml
9 |
10 | includeDocument_entry.xml
11 |
12 |
13 |
14 |
15 |
16 | includeDocument_section.xml
17 | includeDocument_invalid.xml
18 | includeDocument_filtered.xml
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsconfigloader/includeDocument_category.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | includeDocument_section.xml
4 |
5 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsconfigloader/includeDocument_entry.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsconfigloader/includeDocument_filtered.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsconfigloader/includeDocument_group.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsconfigloader/includeDocument_section.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsconfigloader/invalidDocument.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsconfigloader/sectionDocument.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
17 |
18 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsconfigloader/selectorDocument.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
14 |
15 |
16 |
17 |
18 |
19 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsconfigloader/settingsconfigloader.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 |
3 | QT += testlib mvvmcore mvvmcore-private
4 | QT -= gui
5 | CONFIG += console
6 | CONFIG -= app_bundle
7 |
8 | TARGET = tst_settingsconfigloader
9 |
10 | DEFINES += SRCDIR=\\\"$$_PRO_FILE_PWD_\\\"
11 |
12 | INCLUDEPATH += \
13 | ../../../../src/settingsconfig \
14 | $$shadowed(../../../../src/mvvmcore) \
15 | ../../../../src/3rdparty/optional-lite \
16 | ../../../../src/3rdparty/variant-lite
17 |
18 | CONFIG(release, debug|release): INCLUDEPATH += $$shadowed(../../../../src/mvvmcore/release)
19 | else:CONFIG(debug, debug|release): INCLUDEPATH += $$shadowed(../../../../src/mvvmcore/debug)
20 |
21 | SOURCES += \
22 | tst_settingsconfigloader.cpp
23 |
24 | DISTFILES += \
25 | entryDocument.xml \
26 | groupDocument.xml \
27 | sectionDocument.xml \
28 | categoryDocument.xml \
29 | selectorDocument.xml \
30 | includeDocument.xml \
31 | includeDocument_category.xml \
32 | includeDocument_section.xml \
33 | includeDocument_group.xml \
34 | includeDocument_entry.xml \
35 | includeDocument_filtered.xml \
36 | invalidDocument.xml
37 |
38 | include(../../testrun.pri)
39 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsgenerator/import_config.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 |
19 |
20 |
21 |
24 |
25 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsgenerator/import_normal.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsgenerator/importtest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | QtCore/QUrl
4 |
5 |
6 |
7 |
8 | import_normal.xml
9 |
10 | import_config.xml
11 |
12 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsgenerator/settingsgenerator.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 |
3 | QT += testlib mvvmcore
4 | QT -= gui
5 | CONFIG += console
6 | CONFIG -= app_bundle
7 |
8 | TARGET = tst_settingsgenerator
9 |
10 | HEADERS += \
11 | testbackend.h
12 |
13 | SOURCES += \
14 | tst_settingsgenerator.cpp \
15 | testbackend.cpp
16 |
17 | SETTINGS_DEFINITIONS += \
18 | generatortest.xml \
19 | importtest.xml
20 |
21 | # CONFIG += no_auto_lupdate
22 | SETTINGS_TRANSLATIONS += \
23 | translatortest.xml
24 |
25 | DISTFILES += \
26 | import_normal.xml \
27 | import_config.xml
28 |
29 | TRANSLATIONS += test_de.ts
30 |
31 | include(../../testrun.pri)
32 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsgenerator/testbackend.cpp:
--------------------------------------------------------------------------------
1 | #include "testbackend.h"
2 | #include
3 |
4 | TestBackend::TestBackend(QString name, int code, QObject *parent) :
5 | ISettingsAccessor{parent},
6 | _name{std::move(name)},
7 | _code{code}
8 | {}
9 |
10 | bool TestBackend::contains(const QString &key) const
11 | {
12 | return _data.contains(key);
13 | }
14 |
15 | QVariant TestBackend::load(const QString &key, const QVariant &defaultValue) const
16 | {
17 | return _data.value(key, defaultValue);
18 | }
19 |
20 | void TestBackend::save(const QString &key, const QVariant &value)
21 | {
22 | _data.insert(key, value);
23 | emit entryChanged(key, value);
24 | }
25 |
26 | void TestBackend::remove(const QString &key)
27 | {
28 | for(auto it = _data.begin(); it != _data.end();) {
29 | if(it.key().startsWith(key + QLatin1Char('/'))) {
30 | auto rmKey = it.key();
31 | it = _data.erase(it);
32 | emit entryRemoved(rmKey);
33 | } else
34 | ++it;
35 | }
36 | _data.remove(key);
37 | emit entryRemoved(key);
38 | }
39 |
40 | void TestBackend::sync()
41 | {
42 | }
43 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsgenerator/testbackend.h:
--------------------------------------------------------------------------------
1 | #ifndef TESTBACKEND_H
2 | #define TESTBACKEND_H
3 |
4 | #include
5 | #include
6 |
7 | class TestBackend : public QtMvvm::ISettingsAccessor
8 | {
9 | Q_OBJECT
10 |
11 | public:
12 | explicit TestBackend(QString name, int code, QObject *parent = nullptr);
13 |
14 | // ISettingsAccessor interface
15 | public:
16 | bool contains(const QString &key) const override;
17 | QVariant load(const QString &key, const QVariant &defaultValue) const override;
18 | void save(const QString &key, const QVariant &value) override;
19 | void remove(const QString &key) override;
20 |
21 | public slots:
22 | void sync() override;
23 |
24 | public:
25 | QString _name;
26 | int _code;
27 |
28 | QVariantHash _data;
29 | };
30 |
31 | #define SOME_EXPORT
32 |
33 | #endif // TESTBACKEND_H
34 |
--------------------------------------------------------------------------------
/tests/auto/mvvmcore/settingsgenerator/translatortest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 |
18 |
19 |
20 |
23 |
24 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/tests/auto/mvvmdatasynccore/datasyncsettingsaccessor/datasyncsettingsaccessor.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 |
3 | QT += testlib mvvmdatasynccore
4 | QT -= gui
5 | CONFIG += console
6 | CONFIG -= app_bundle
7 |
8 | TARGET = tst_datasyncsettingsaccessor
9 |
10 | HEADERS += \
11 | ../../../shared/tst_isettingsaccessor.h
12 |
13 | SOURCES += \
14 | tst_datasyncsettingsaccessor.cpp
15 |
16 | include(../../testrun.pri)
17 |
--------------------------------------------------------------------------------
/tests/auto/mvvmdatasynccore/mvvmdatasynccore.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | SUBDIRS += \
4 | datasyncsettingsaccessor
5 |
6 | prepareRecursiveTarget(run-tests)
7 | QMAKE_EXTRA_TARGETS += run-tests
8 |
--------------------------------------------------------------------------------
/tests/auto/qml/qml.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | SUBDIRS += \
4 | qmlsettingsgenerator \
5 | qmlmvvmcore
6 |
7 | equals(MSVC_VER, 14.0): SUBDIRS -= qmlsettingsgenerator
8 |
9 | prepareRecursiveTarget(run-tests)
10 | QMAKE_EXTRA_TARGETS += run-tests
11 |
--------------------------------------------------------------------------------
/tests/auto/qml/qmlmvvmcore/qmlmvvmcore.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 |
3 | QT += testlib mvvmcore qml
4 | CONFIG += qmltestcase console
5 | CONFIG -= app_bundle
6 |
7 | TARGET = tst_qmlmvvmcore
8 |
9 | SOURCES += \
10 | tst_qmlmvvmcore.cpp
11 |
12 | DISTFILES += \
13 | tst_qmlmvvmcore.qml
14 |
15 | importFiles.path = .
16 | DEPLOYMENT += importFiles
17 |
18 | win32:msvc:CONFIG(debug, debug|release): CONFIG += disable_testrun
19 | include(../../testrun.pri)
20 |
--------------------------------------------------------------------------------
/tests/auto/qml/qmlmvvmcore/tst_qmlmvvmcore.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | QUICK_TEST_MAIN(qmlmvvmcore)
5 |
--------------------------------------------------------------------------------
/tests/auto/qml/qmlmvvmcore/tst_qmlmvvmcore.qml:
--------------------------------------------------------------------------------
1 | import QtQuick 2.10
2 | import de.skycoder42.QtMvvm.Core 1.1
3 | import QtTest 1.1
4 |
5 | Item {
6 | id: root
7 |
8 | TestCase {
9 | name: "Binding"
10 |
11 | QtObject {
12 | id: obj
13 |
14 | property int prop1: 42
15 | property int prop2: 0
16 | }
17 |
18 | MvvmBinding {
19 | id: bind
20 | viewModel: obj
21 | view: obj
22 | viewModelProperty: "prop1"
23 | viewProperty: "prop2"
24 | type: MvvmBinding.SingleInit
25 | }
26 |
27 | function test_1_SingleInit() {
28 | verify(bind.isValid());
29 | compare(obj.prop1, 42);
30 | compare(obj.prop2, 42);
31 | obj.prop1 = 24;
32 | compare(obj.prop2, 42);
33 | obj.prop2 = 44;
34 | compare(obj.prop1, 24);
35 | }
36 |
37 | function test_2_OneWayToView() {
38 | bind.type = MvvmBinding.OneWayToView
39 | obj.prop1 = 33;
40 | compare(obj.prop2, 33);
41 | obj.prop2 = 44;
42 | compare(obj.prop1, 33);
43 | }
44 |
45 | function test_3_OneWayToViewModel() {
46 | bind.type = MvvmBinding.OneWayToViewModel
47 | obj.prop2 = 45;
48 | compare(obj.prop1, 45);
49 | obj.prop1 = 22;
50 | compare(obj.prop2, 45);
51 | }
52 |
53 | function test_4_TwoWay() {
54 | bind.type = MvvmBinding.TwoWay
55 | obj.prop1 = 78;
56 | compare(obj.prop2, 78);
57 | obj.prop2 = 87;
58 | compare(obj.prop1, 87);
59 | }
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/tests/auto/qml/qmlsettingsgenerator/.gitignore:
--------------------------------------------------------------------------------
1 | # This file is used to ignore files which are generated
2 | # ----------------------------------------------------------------------------
3 |
4 | *~
5 | *.autosave
6 | *.a
7 | *.core
8 | *.moc
9 | *.o
10 | *.obj
11 | *.orig
12 | *.rej
13 | *.so
14 | *.so.*
15 | *_pch.h.cpp
16 | *_resource.rc
17 | *.qm
18 | .#*
19 | *.*#
20 | core
21 | !core/
22 | tags
23 | .DS_Store
24 | .directory
25 | *.debug
26 | Makefile*
27 | *.prl
28 | *.app
29 | moc_*.cpp
30 | ui_*.h
31 | qrc_*.cpp
32 | Thumbs.db
33 | *.res
34 | *.rc
35 | /.qmake.cache
36 | /.qmake.stash
37 |
38 | # qtcreator generated files
39 | *.pro.user*
40 |
41 | # xemacs temporary files
42 | *.flc
43 |
44 | # Vim temporary files
45 | .*.swp
46 |
47 | # Visual Studio generated files
48 | *.ib_pdb_index
49 | *.idb
50 | *.ilk
51 | *.pdb
52 | *.sln
53 | *.suo
54 | *.vcproj
55 | *vcproj.*.*.user
56 | *.ncb
57 | *.sdf
58 | *.opensdf
59 | *.vcxproj
60 | *vcxproj.*
61 |
62 | # MinGW generated files
63 | *.Debug
64 | *.Release
65 |
66 | # Python byte code
67 | *.pyc
68 |
69 | # Binaries
70 | # --------
71 | *.dll
72 | *.exe
73 |
74 |
--------------------------------------------------------------------------------
/tests/auto/qml/qmlsettingsgenerator/qmlsettingsgenerator.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = app
2 |
3 | QT += testlib mvvmcore qml
4 | CONFIG += qmltestcase console
5 | CONFIG -= app_bundle
6 |
7 | TARGET = tst_qmlsettingsgenerator
8 |
9 | HEADERS += \
10 | testbackend.h
11 |
12 | SOURCES += \
13 | tst_qmlsettingsgenerator.cpp \
14 | testbackend.cpp
15 |
16 | QML_SETTINGS_DEFINITIONS += \
17 | generatortest.xml
18 |
19 | SETTINGS_DEFINITIONS += $$QML_SETTINGS_DEFINITIONS
20 |
21 | DISTFILES += \
22 | tst_qmlsettingsgenerator.qml
23 |
24 | importFiles.path = .
25 | DEPLOYMENT += importFiles
26 |
27 | win32:msvc:CONFIG(debug, debug|release): CONFIG += disable_testrun
28 | include(../../testrun.pri)
29 |
--------------------------------------------------------------------------------
/tests/auto/qml/qmlsettingsgenerator/testbackend.cpp:
--------------------------------------------------------------------------------
1 | #include "testbackend.h"
2 |
3 | TestBackend::TestBackend(QObject *parent) :
4 | ISettingsAccessor{parent}
5 | {}
6 |
7 | bool TestBackend::contains(const QString &key) const
8 | {
9 | return _data.contains(key);
10 | }
11 |
12 | QVariant TestBackend::load(const QString &key, const QVariant &defaultValue) const
13 | {
14 | return _data.value(key, defaultValue);
15 | }
16 |
17 | void TestBackend::save(const QString &key, const QVariant &value)
18 | {
19 | _data.insert(key, value);
20 | emit entryChanged(key, value);
21 | }
22 |
23 | void TestBackend::remove(const QString &key)
24 | {
25 | for(auto it = _data.begin(); it != _data.end();) {
26 | if(it.key().startsWith(key + QLatin1Char('/'))) {
27 | it = _data.erase(it);
28 | emit entryRemoved(key);
29 | } else
30 | ++it;
31 | }
32 | _data.remove(key);
33 | emit entryRemoved(key);
34 | }
35 |
36 | void TestBackend::sync()
37 | {
38 | }
39 |
--------------------------------------------------------------------------------
/tests/auto/qml/qmlsettingsgenerator/testbackend.h:
--------------------------------------------------------------------------------
1 | #ifndef TESTBACKEND_H
2 | #define TESTBACKEND_H
3 |
4 | #include
5 | #include
6 |
7 | class TestBackend : public QtMvvm::ISettingsAccessor
8 | {
9 | Q_OBJECT
10 |
11 | public:
12 | explicit TestBackend(QObject *parent = nullptr);
13 |
14 | // ISettingsAccessor interface
15 | public:
16 | bool contains(const QString &key) const override;
17 | QVariant load(const QString &key, const QVariant &defaultValue) const override;
18 | void save(const QString &key, const QVariant &value) override;
19 | void remove(const QString &key) override;
20 |
21 | public slots:
22 | void sync() override;
23 |
24 | public:
25 | QVariantHash _data;
26 | };
27 |
28 | #define SOME_EXPORT
29 |
30 | #endif // TESTBACKEND_H
31 |
--------------------------------------------------------------------------------
/tests/auto/qml/qmlsettingsgenerator/tst_qmlsettingsgenerator.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | QUICK_TEST_MAIN(qmlsettingsgenerator)
5 |
--------------------------------------------------------------------------------
/tests/auto/qml/qmlsettingsgenerator/tst_qmlsettingsgenerator.qmlc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Skycoder42/QtMvvm/441d68c6b3208cf7a50c5906782f797f3e5ccf32/tests/auto/qml/qmlsettingsgenerator/tst_qmlsettingsgenerator.qmlc
--------------------------------------------------------------------------------
/tests/global/global.cfg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/tests/tests.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | CONFIG += no_docs_target
4 |
5 | SUBDIRS += auto
6 |
7 | prepareRecursiveTarget(run-tests)
8 | QMAKE_EXTRA_TARGETS += run-tests
9 |
--------------------------------------------------------------------------------
/tools/settingsgenerator/qsettingsgenerator.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | qsettingsgenerator.xsd
4 |
5 |
6 |
--------------------------------------------------------------------------------
/tools/settingsgenerator/settingsgenerator.pro:
--------------------------------------------------------------------------------
1 | option(host_build)
2 |
3 | QT = core
4 | !force_bootstrap:qtHaveModule(xmlpatterns): QT += xmlpatterns
5 |
6 | TARGET = qsettingsgenerator
7 | VERSION = $$MODULE_VERSION
8 | COMPANY = Skycoder42
9 | BUNDLE_PREFIX = de.skycoder42
10 |
11 | DEFINES += BUILD_QSETTINGSGENERATOR
12 | DEFINES += "TARGET=\\\"$$TARGET\\\""
13 | DEFINES += "VERSION=\\\"$$VERSION\\\""
14 | DEFINES += "COMPANY=\\\"$$COMPANY\\\""
15 | DEFINES += "BUNDLE_PREFIX=\\\"$$BUNDLE_PREFIX\\\""
16 |
17 | HEADERS += \
18 | settingstranslator.h \
19 | cppsettingsgenerator.h \
20 | settingsgeneratorimpl.h \
21 | qmlsettingsgenerator.h
22 |
23 | SOURCES += \
24 | main.cpp \
25 | settingstranslator.cpp \
26 | cppsettingsgenerator.cpp \
27 | settingsgeneratorimpl.cpp \
28 | qmlsettingsgenerator.cpp
29 |
30 | XML_SCHEMA_DEFINITIONS += \
31 | qsettingsgenerator.xsd
32 |
33 | include(../../src/settingsconfig/settingsconfig.pri)
34 |
35 | contains(QT, xmlpatterns):RESOURCES += qsettingsgenerator.qrc
36 |
37 | load(qt_tool)
38 |
39 | win32 {
40 | QMAKE_TARGET_PRODUCT = "Qt Settings Builder"
41 | QMAKE_TARGET_COMPANY = $$COMPANY
42 | QMAKE_TARGET_COPYRIGHT = "Felix Barz"
43 | } else:mac {
44 | QMAKE_TARGET_BUNDLE_PREFIX = $${BUNDLE_PREFIX}.
45 | }
46 |
47 | !load(qdep):error("Failed to load qdep feature! Run 'qdep prfgen --qmake $$QMAKE_QMAKE' to create it.")
48 |
--------------------------------------------------------------------------------
/tools/settingsgenerator/settingstranslator.h:
--------------------------------------------------------------------------------
1 | #ifndef SETTINGSTRANSLATOR_H
2 | #define SETTINGSTRANSLATOR_H
3 |
4 | #include
5 | #include
6 |
7 | #include "settingsconfigimpl_p.h"
8 |
9 | class SettingsTranslator : public SettingsConfigImpl
10 | {
11 | public:
12 | SettingsTranslator(const QString &srcPath);
13 |
14 | void process(const QString &inPath);
15 |
16 | private:
17 | QFile _srcFile;
18 | QTextStream _src;
19 |
20 | void writeTranslations(const SettingsConfigType &settings, const QString &inPath);
21 |
22 | void readCategoryStrings(const CategoryType &category, QStringList &strings);
23 | void readSectionStrings(const SectionType §ion, QStringList &strings);
24 | void readGroupStrings(const GroupType &group, QStringList &strings);
25 | void readEntryStrings(const EntryType &entry, QStringList &strings);
26 |
27 | void readInfoStrings(const BasicContainerInfo &info, QStringList &strings);
28 | void readElementStrings(const ElementType &element, QStringList &strings);
29 | };
30 |
31 | #endif // SETTINGSTRANSLATOR_H
32 |
--------------------------------------------------------------------------------
/tools/tools.pro:
--------------------------------------------------------------------------------
1 | TEMPLATE = subdirs
2 |
3 | SUBDIRS += \
4 | settingsgenerator
5 |
6 | settingsgenerator.CONFIG += no_lrelease_target
7 |
8 | prepareRecursiveTarget(lrelease)
9 | QMAKE_EXTRA_TARGETS += lrelease
10 | QMAKE_EXTRA_TARGETS += run-tests
11 |
--------------------------------------------------------------------------------