X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FDialogView.h;h=a95b1a435cd910141d5557a5e5b7ac7c314c7ece;hb=425d092204118ea6c24c28e85fdf03fcf2bb51a4;hp=36f3ef2f0892e327735ee92eb82f40da7217683e;hpb=604c1148ea8beedaebbe0bdbe5a0adc76237a697;p=lyx.git diff --git a/src/frontends/qt4/DialogView.h b/src/frontends/qt4/DialogView.h index 36f3ef2f08..a95b1a435c 100644 --- a/src/frontends/qt4/DialogView.h +++ b/src/frontends/qt4/DialogView.h @@ -13,40 +13,51 @@ #define DIALOGVIEW_H #include "Dialog.h" +#include "GuiView.h" +#include #include -class QCloseEvent; -class QShowEvent; - namespace lyx { namespace frontend { -/** \c Dialog collects the different parts of a Model-Controller-View - * split of a generic dialog together. - */ class DialogView : public QDialog, public Dialog { - Q_OBJECT - public: /// \param lv is the access point for the dialog to the LyX kernel. /// \param name is the identifier given to the dialog by its parent /// container. - explicit DialogView(GuiView & lv, std::string const & name); - virtual ~DialogView() {} + /// \param title is the window title used for decoration. + DialogView(GuiView & lv, QString const & name, QString const & title) + : QDialog(&lv), Dialog(lv, name, "LyX: " + title) + {} virtual QWidget * asQWidget() { return this; } virtual QWidget const * asQWidget() const { return this; } -public: - /// - void setViewTitle(docstring const & title); - - /// - void closeEvent(QCloseEvent *); - /// - void showEvent(QShowEvent *); +protected: + /// \name Dialog inherited methods + //@{ + void applyView() {} + bool initialiseParams(std::string const & /*data*/) { return true; } + void clearParams() {} + //@} + /// Any dialog that overrides this method should make sure to call it. + void closeEvent(QCloseEvent * ev) + { + clearParams(); + Dialog::disconnect(); + ev->accept(); + } + /// Any dialog that overrides this method should make sure to call it. + void hideEvent(QHideEvent * ev) + { + if (!ev->spontaneous()) { + clearParams(); + Dialog::disconnect(); + ev->accept(); + } + } }; } // namespace frontend