You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
43 lines
1.1 KiB
#ifndef QTMVVM_IPRESENTER_H
|
|
#define QTMVVM_IPRESENTER_H
|
|
|
|
#include <QtCore/qexception.h>
|
|
|
|
#include "QtMvvmCore/qtmvvmcore_global.h"
|
|
#include "QtMvvmCore/viewmodel.h"
|
|
#include "QtMvvmCore/message.h"
|
|
|
|
namespace QtMvvm {
|
|
|
|
class Q_MVVMCORE_EXPORT PresenterException : public QException
|
|
{
|
|
public:
|
|
PresenterException(const QByteArray &what);
|
|
|
|
const char *what() const noexcept override;
|
|
|
|
void raise() const override;
|
|
QException *clone() const override;
|
|
|
|
protected:
|
|
PresenterException(const PresenterException * const other);
|
|
|
|
const QByteArray _what;
|
|
};
|
|
|
|
class Q_MVVMCORE_EXPORT IPresenter //TODO use via service registry EVERYWHERE
|
|
{
|
|
public:
|
|
inline virtual ~IPresenter() = default;
|
|
|
|
virtual void present(ViewModel *viewModel, const QVariantHash ¶ms, QPointer<ViewModel> parent = nullptr) = 0;
|
|
virtual void showDialog(const MessageConfig &config, MessageResult *result) = 0;
|
|
};
|
|
|
|
}
|
|
|
|
#define QtMvvm_IPresenterIid "de.skycoder42.qtmvvm.core.IPresenter"
|
|
Q_DECLARE_INTERFACE(QtMvvm::IPresenter, QtMvvm_IPresenterIid)
|
|
Q_DECLARE_METATYPE(QtMvvm::IPresenter*)
|
|
|
|
#endif // QTMVVM_IPRESENTER_H
|
|
|