From 726321a73dba8cfc359bebd8849332b963a6671b Mon Sep 17 00:00:00 2001 From: Skycoder42 Date: Thu, 22 Feb 2018 15:54:54 +0100 Subject: [PATCH] todo cleanup --- src/imports/mvvmquick/PresentingDrawer.qml | 2 +- src/imports/mvvmquick/PresentingStackView.qml | 1 - src/imports/mvvmquick/qqmlquickpresenter.cpp | 12 ++++++------ src/mvvmwidgets/widgetspresenter.cpp | 12 +----------- src/mvvmwidgets/widgetspresenter.h | 1 - 5 files changed, 8 insertions(+), 20 deletions(-) diff --git a/src/imports/mvvmquick/PresentingDrawer.qml b/src/imports/mvvmquick/PresentingDrawer.qml index 77e79d5..65dd2ad 100644 --- a/src/imports/mvvmquick/PresentingDrawer.qml +++ b/src/imports/mvvmquick/PresentingDrawer.qml @@ -19,7 +19,7 @@ Drawer { function presentDrawerContent(item) { if(_mainChild) _mainChild.destroy(); - item.parent = _presentingDrawer.contentItem; //TODO test + item.parent = _presentingDrawer.contentItem; item.drawer = _presentingDrawer; _mainChild = item; return true; diff --git a/src/imports/mvvmquick/PresentingStackView.qml b/src/imports/mvvmquick/PresentingStackView.qml index 5a36e1b..caccad5 100644 --- a/src/imports/mvvmquick/PresentingStackView.qml +++ b/src/imports/mvvmquick/PresentingStackView.qml @@ -72,7 +72,6 @@ StackView { _clearItems = []; } - //TODO only for android? maybe move to second class? pushEnter: Transition { PropertyAnimation { property: "y" diff --git a/src/imports/mvvmquick/qqmlquickpresenter.cpp b/src/imports/mvvmquick/qqmlquickpresenter.cpp index 79f2b3f..c291200 100644 --- a/src/imports/mvvmquick/qqmlquickpresenter.cpp +++ b/src/imports/mvvmquick/qqmlquickpresenter.cpp @@ -92,8 +92,8 @@ void QQmlQuickPresenter::present(ViewModel *viewModel, const QVariantHash ¶m void QQmlQuickPresenter::showDialog(const MessageConfig &config, MessageResult *result) { if(!_qmlPresenter) { - qmlWarning(this).space() << "No QML-Presenter registered! Unable to present dialog of type" //TODO use via define EVERYWHERE!!! - << config.type(); + qmlWarning(this).space() << "No QML-Presenter registered! Unable to present dialog of type" + << config.type(); return; } @@ -104,7 +104,7 @@ void QQmlQuickPresenter::showDialog(const MessageConfig &config, MessageResult * Q_ARG(QVariant, QVariant::fromValue(result))); if(!res.toBool()) { qmlWarning(this).space() << "Failed to present dialog of type" - << config.type(); + << config.type(); } } @@ -143,7 +143,7 @@ void QQmlQuickPresenter::addObject(QQmlComponent *component, ViewModel *viewMode { if(!_qmlPresenter) { qmlWarning(this).space() << "No QML-Presenter registered! Unable to present viewModel of type" - << viewModel->metaObject()->className(); + << viewModel->metaObject()->className(); return; } @@ -151,7 +151,7 @@ void QQmlQuickPresenter::addObject(QQmlComponent *component, ViewModel *viewMode auto item = component->beginCreate(_engine->rootContext()); if(!item) { qmlWarning(this).space() << "Unable to create quick view from the loaded component" - << component->url(); + << component->url(); return; } item->setProperty("viewModel", QVariant::fromValue(viewModel)); @@ -171,7 +171,7 @@ void QQmlQuickPresenter::addObject(QQmlComponent *component, ViewModel *viewMode QQmlEngine::setObjectOwnership(item, QQmlEngine::JavaScriptOwnership); } else { qmlWarning(this).space() << "Failed to present item for viewModel of type" - << viewModel->metaObject()->className(); + << viewModel->metaObject()->className(); item->deleteLater(); } } diff --git a/src/mvvmwidgets/widgetspresenter.cpp b/src/mvvmwidgets/widgetspresenter.cpp index a97d216..1a1dd71 100644 --- a/src/mvvmwidgets/widgetspresenter.cpp +++ b/src/mvvmwidgets/widgetspresenter.cpp @@ -66,9 +66,7 @@ void WidgetsPresenter::present(ViewModel *viewModel, const QVariantHash ¶ms, // initialize viewmodel and view relationship viewModel->setParent(view); - auto hasCycle = setupLifeCycle(viewModel, view); - if(!hasCycle) - view->setAttribute(Qt::WA_DeleteOnClose); + view->setAttribute(Qt::WA_DeleteOnClose); viewModel->onInit(params); // present the view @@ -187,14 +185,6 @@ bool WidgetsPresenter::tryPresent(QWidget *view, QWidget *parentView) return true; } -bool WidgetsPresenter::setupLifeCycle(ViewModel *viewModel, QWidget *view) -{ - //TODO implement as soon as quick part is ready as well - Q_UNUSED(viewModel) - Q_UNUSED(view) - return false; -} - void WidgetsPresenter::showForeground(QWidget *view) const { if(view->windowState().testFlag(Qt::WindowMinimized)) diff --git a/src/mvvmwidgets/widgetspresenter.h b/src/mvvmwidgets/widgetspresenter.h index 853fc0c..30840b1 100644 --- a/src/mvvmwidgets/widgetspresenter.h +++ b/src/mvvmwidgets/widgetspresenter.h @@ -51,7 +51,6 @@ Q_SIGNALS: protected: virtual const QMetaObject *findWidgetMetaObject(const QMetaObject *viewModelMetaObject); virtual bool tryPresent(QWidget *view, QWidget *parentView); - virtual bool setupLifeCycle(ViewModel *viewModel, QWidget *view); virtual void showForeground(QWidget *view) const;