From fee6fea248bb6b549dda5bf280469f47e53134f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 9 Oct 2007 19:52:34 +0000 Subject: [PATCH] some controller simplification git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20871 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/DialogView.h | 18 ++++++++---------- src/frontends/qt4/Makefile.am | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/frontends/qt4/DialogView.h b/src/frontends/qt4/DialogView.h index 09201abefe..0f36c4894e 100644 --- a/src/frontends/qt4/DialogView.h +++ b/src/frontends/qt4/DialogView.h @@ -31,8 +31,8 @@ namespace frontend { /// Window Dialog container for LyX dialogs. /// This template class that encapsulates a given Widget inside a /// QDialog and presents a Dialog interface -template -class DialogView : public QDialog, public Dialog +template +class DialogView : public QDialog, public Dialog, public Controller { public: DialogView( @@ -44,10 +44,9 @@ public: : QDialog(&parent, flags), name_(name) { setModal(modal); - controller_ = new MyController(*this, parent); QGridLayout * gridLayout = new QGridLayout(this); gridLayout->setMargin(0); - widget_ = new MyWidget(*controller_, this); + widget_ = new MyWidget(*this, this); gridLayout->addWidget(widget_); setWindowTitle("LyX: " + widget_->windowTitle()); } @@ -57,12 +56,12 @@ public: void applyView() {} void hideView() { - controller().clearParams(); + clearParams(); QDialog::hide(); } void showData(std::string const & data) { - controller_->initialiseParams(data); + initialiseParams(data); showView(); } void showView() @@ -78,7 +77,7 @@ public: void redrawView() {} void updateData(std::string const & data) { - controller_->initialiseParams(data); + initialiseParams(data); updateView(); } void updateView() @@ -86,13 +85,12 @@ public: widget_->updateView(); } void partialUpdateView(int /*id*/) {} - Controller & controller() { return *controller_; } + Controller & controller() { return *this; } std::string name() const { return name_; } //@} private: /// The encapsulated widget. MyWidget * widget_; - Controller * controller_; std::string name_; void showEvent(QShowEvent * e) @@ -112,7 +110,7 @@ private: std::string key = name_ + "/geometry"; settings.setValue(key.c_str(), QDialog::saveGeometry()); #endif - QDialog::closeEvent(e); + QDialog::closeEvent(e); } }; diff --git a/src/frontends/qt4/Makefile.am b/src/frontends/qt4/Makefile.am index ceab677890..0717da9373 100644 --- a/src/frontends/qt4/Makefile.am +++ b/src/frontends/qt4/Makefile.am @@ -138,6 +138,7 @@ SOURCEFILES = \ NOMOCHEADER = \ ButtonController.h \ + DialogView.h \ GuiFontLoader.h \ GuiFontMetrics.h \ GuiImage.h \ @@ -150,7 +151,6 @@ MOCHEADER = \ Action.h \ BulletsModule.h \ ColorCache.h \ - DialogView.h \ DockView.h \ EmptyTable.h \ FloatPlacement.h \ -- 2.39.2