From 6f3cdf8da80a6b3889f2a3b8b53f44590152d600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 9 Oct 2007 19:34:27 +0000 Subject: [PATCH] move Controller inheritance further up the tree git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20870 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/DialogView.h | 6 +-- src/frontends/qt4/DockView.h | 3 +- src/frontends/qt4/GuiAbout.cpp | 3 +- src/frontends/qt4/GuiAbout.h | 2 +- src/frontends/qt4/GuiBox.cpp | 3 +- src/frontends/qt4/GuiBox.h | 4 +- src/frontends/qt4/GuiBranch.cpp | 3 +- src/frontends/qt4/GuiBranch.h | 4 +- src/frontends/qt4/GuiChanges.cpp | 3 +- src/frontends/qt4/GuiChanges.h | 3 +- src/frontends/qt4/GuiCharacter.cpp | 3 +- src/frontends/qt4/GuiCharacter.h | 4 +- src/frontends/qt4/GuiDelimiter.cpp | 1 - src/frontends/qt4/GuiDialog.cpp | 65 ++++++++++---------------- src/frontends/qt4/GuiDialog.h | 18 ++----- src/frontends/qt4/GuiDocument.cpp | 3 +- src/frontends/qt4/GuiDocument.h | 4 +- src/frontends/qt4/GuiERT.cpp | 3 +- src/frontends/qt4/GuiERT.h | 4 +- src/frontends/qt4/GuiErrorList.cpp | 3 +- src/frontends/qt4/GuiErrorList.h | 4 +- src/frontends/qt4/GuiExternal.cpp | 25 +++++----- src/frontends/qt4/GuiExternal.h | 4 +- src/frontends/qt4/GuiFloat.cpp | 3 +- src/frontends/qt4/GuiFloat.h | 4 +- src/frontends/qt4/GuiGraphics.cpp | 3 +- src/frontends/qt4/GuiGraphics.h | 4 +- src/frontends/qt4/GuiInclude.cpp | 3 +- src/frontends/qt4/GuiInclude.h | 4 +- src/frontends/qt4/GuiListings.cpp | 3 +- src/frontends/qt4/GuiListings.h | 4 +- src/frontends/qt4/GuiLog.cpp | 3 +- src/frontends/qt4/GuiLog.h | 4 +- src/frontends/qt4/GuiMath.cpp | 2 +- src/frontends/qt4/GuiMath.h | 4 +- src/frontends/qt4/GuiMathMatrix.cpp | 1 - src/frontends/qt4/GuiNote.cpp | 3 +- src/frontends/qt4/GuiNote.h | 4 +- src/frontends/qt4/GuiParagraph.cpp | 7 ++- src/frontends/qt4/GuiPrefs.cpp | 3 +- src/frontends/qt4/GuiPrefs.h | 4 +- src/frontends/qt4/GuiPrint.cpp | 3 +- src/frontends/qt4/GuiPrint.h | 4 +- src/frontends/qt4/GuiRef.cpp | 19 ++++---- src/frontends/qt4/GuiRef.h | 4 +- src/frontends/qt4/GuiSearch.cpp | 5 +- src/frontends/qt4/GuiSearch.h | 4 +- src/frontends/qt4/GuiSendto.cpp | 3 +- src/frontends/qt4/GuiSendto.h | 4 +- src/frontends/qt4/GuiShowFile.cpp | 3 +- src/frontends/qt4/GuiShowFile.h | 4 +- src/frontends/qt4/GuiSpellchecker.cpp | 3 +- src/frontends/qt4/GuiSpellchecker.h | 5 +- src/frontends/qt4/GuiTabular.cpp | 3 +- src/frontends/qt4/GuiTabular.h | 4 +- src/frontends/qt4/GuiTabularCreate.cpp | 3 +- src/frontends/qt4/GuiTabularCreate.h | 6 +-- src/frontends/qt4/GuiTexinfo.cpp | 3 +- src/frontends/qt4/GuiTexinfo.h | 6 +-- src/frontends/qt4/GuiThesaurus.cpp | 3 +- src/frontends/qt4/GuiThesaurus.h | 4 +- src/frontends/qt4/GuiVSpace.cpp | 3 +- src/frontends/qt4/GuiVSpace.h | 4 +- src/frontends/qt4/GuiWrap.cpp | 3 +- src/frontends/qt4/GuiWrap.h | 4 +- src/frontends/qt4/Makefile.am | 2 +- 66 files changed, 113 insertions(+), 234 deletions(-) diff --git a/src/frontends/qt4/DialogView.h b/src/frontends/qt4/DialogView.h index fc523ffdf0..09201abefe 100644 --- a/src/frontends/qt4/DialogView.h +++ b/src/frontends/qt4/DialogView.h @@ -44,12 +44,10 @@ public: : QDialog(&parent, flags), name_(name) { setModal(modal); - MyController * c = new MyController(*this); - controller_ = c; - controller_->setLyXView(parent); + controller_ = new MyController(*this, parent); QGridLayout * gridLayout = new QGridLayout(this); gridLayout->setMargin(0); - widget_ = new MyWidget(*c, this); + widget_ = new MyWidget(*controller_, this); gridLayout->addWidget(widget_); setWindowTitle("LyX: " + widget_->windowTitle()); } diff --git a/src/frontends/qt4/DockView.h b/src/frontends/qt4/DockView.h index c56ceea4a6..c4db29f94e 100644 --- a/src/frontends/qt4/DockView.h +++ b/src/frontends/qt4/DockView.h @@ -34,11 +34,10 @@ public: Qt::DockWidgetArea area = Qt::LeftDockWidgetArea, ///< Position of the dock (and also drawer) Qt::WindowFlags flags = 0 ) - : QDockWidget(&parent, flags), name_(name), Controller(this) + : QDockWidget(&parent, flags), Controller(this, parent), name_(name) { if (flags & Qt::Drawer) setFeatures(QDockWidget::NoDockWidgetFeatures); - setLyXView(parent); parent.addDockWidget(area, this); } diff --git a/src/frontends/qt4/GuiAbout.cpp b/src/frontends/qt4/GuiAbout.cpp index 484c06a35d..9fd2e49bdc 100644 --- a/src/frontends/qt4/GuiAbout.cpp +++ b/src/frontends/qt4/GuiAbout.cpp @@ -96,11 +96,10 @@ static QString version() GuiAbout::GuiAbout(LyXView & lv) - : GuiDialog(lv, "aboutlyx"), Controller(this) + : GuiDialog(lv, "aboutlyx") { setupUi(this); setViewTitle(_("About LyX")); - setController(this, false); connect(closePB, SIGNAL(clicked()), this, SLOT(reject())); diff --git a/src/frontends/qt4/GuiAbout.h b/src/frontends/qt4/GuiAbout.h index a68cd6810a..8391002309 100644 --- a/src/frontends/qt4/GuiAbout.h +++ b/src/frontends/qt4/GuiAbout.h @@ -18,7 +18,7 @@ namespace lyx { namespace frontend { -class GuiAbout : public GuiDialog, public Ui::AboutUi, public Controller +class GuiAbout : public GuiDialog, public Ui::AboutUi { Q_OBJECT diff --git a/src/frontends/qt4/GuiBox.cpp b/src/frontends/qt4/GuiBox.cpp index 92f645091c..93bf7b57b7 100644 --- a/src/frontends/qt4/GuiBox.cpp +++ b/src/frontends/qt4/GuiBox.cpp @@ -74,11 +74,10 @@ void box_gui_tokens_special_length(vector & ids, GuiBox::GuiBox(LyXView & lv) - : GuiDialog(lv, "box"), Controller(this), params_("") + : GuiDialog(lv, "box"), params_("") { setupUi(this); setViewTitle(_("Box Settings")); - setController(this, false); // fill the box type choice box_gui_tokens(ids_, gui_names_); diff --git a/src/frontends/qt4/GuiBox.h b/src/frontends/qt4/GuiBox.h index 372f4b24c3..be9874df47 100644 --- a/src/frontends/qt4/GuiBox.h +++ b/src/frontends/qt4/GuiBox.h @@ -23,7 +23,7 @@ namespace lyx { namespace frontend { -class GuiBox : public GuiDialog, public Ui::BoxUi, public Controller +class GuiBox : public GuiDialog, public Ui::BoxUi { Q_OBJECT @@ -40,8 +40,6 @@ private: /// void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// add and remove special lengths void setSpecial(bool ibox); /// only show valid inner box items diff --git a/src/frontends/qt4/GuiBranch.cpp b/src/frontends/qt4/GuiBranch.cpp index 7832e9e05e..515bdf9c12 100644 --- a/src/frontends/qt4/GuiBranch.cpp +++ b/src/frontends/qt4/GuiBranch.cpp @@ -34,10 +34,9 @@ namespace lyx { namespace frontend { GuiBranch::GuiBranch(LyXView & lv) - : GuiDialog(lv, "branch"), Controller(this) + : GuiDialog(lv, "branch") { setupUi(this); - setController(this, false); setViewTitle(_("Branch Settings")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); diff --git a/src/frontends/qt4/GuiBranch.h b/src/frontends/qt4/GuiBranch.h index 7fe05e6897..52f195613e 100644 --- a/src/frontends/qt4/GuiBranch.h +++ b/src/frontends/qt4/GuiBranch.h @@ -22,7 +22,7 @@ namespace lyx { namespace frontend { -class GuiBranch : public GuiDialog, public Ui::BranchUi, public Controller +class GuiBranch : public GuiDialog, public Ui::BranchUi { Q_OBJECT @@ -35,8 +35,6 @@ private Q_SLOTS: private: /// void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// Apply changes void applyView(); /// Update dialog before showing it diff --git a/src/frontends/qt4/GuiChanges.cpp b/src/frontends/qt4/GuiChanges.cpp index a2568fed31..e5587819b2 100644 --- a/src/frontends/qt4/GuiChanges.cpp +++ b/src/frontends/qt4/GuiChanges.cpp @@ -37,10 +37,9 @@ namespace frontend { using support::bformat; GuiChanges::GuiChanges(LyXView & lv) - : GuiDialog(lv, "changes"), Controller(this) + : GuiDialog(lv, "changes") { setupUi(this); - setController(this, false); setViewTitle(_("Merge Changes")); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); diff --git a/src/frontends/qt4/GuiChanges.h b/src/frontends/qt4/GuiChanges.h index dc9b063503..816dd03ddb 100644 --- a/src/frontends/qt4/GuiChanges.h +++ b/src/frontends/qt4/GuiChanges.h @@ -21,7 +21,7 @@ namespace lyx { namespace frontend { -class GuiChanges : public GuiDialog, public Ui::ChangesUi, public Controller +class GuiChanges : public GuiDialog, public Ui::ChangesUi { Q_OBJECT @@ -38,7 +38,6 @@ protected Q_SLOTS: private: void closeEvent(QCloseEvent * e); - Controller & controller() { return *this; } void updateContents(); /// Nothing to initialise in this case. diff --git a/src/frontends/qt4/GuiCharacter.cpp b/src/frontends/qt4/GuiCharacter.cpp index 1dbae616d7..4388095e4f 100644 --- a/src/frontends/qt4/GuiCharacter.cpp +++ b/src/frontends/qt4/GuiCharacter.cpp @@ -273,11 +273,10 @@ static vector const getFamilyData() GuiCharacter::GuiCharacter(LyXView & lv) - : GuiDialog(lv, "character"), Controller(this), font_(Font::ALL_IGNORE), + : GuiDialog(lv, "character"), font_(Font::ALL_IGNORE), toggleall_(false), reset_lang_(false) { setupUi(this); - setController(this, false); setViewTitle(_("Text Style")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); diff --git a/src/frontends/qt4/GuiCharacter.h b/src/frontends/qt4/GuiCharacter.h index f59a96320b..81b06ab9ab 100644 --- a/src/frontends/qt4/GuiCharacter.h +++ b/src/frontends/qt4/GuiCharacter.h @@ -48,7 +48,7 @@ typedef std::pair SizePair; typedef std::pair BarPair; typedef std::pair ColorPair; -class GuiCharacter : public GuiDialog, public Ui::CharacterUi, public Controller +class GuiCharacter : public GuiDialog, public Ui::CharacterUi { Q_OBJECT @@ -60,8 +60,6 @@ protected Q_SLOTS: private: void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// Apply changes void applyView(); /// update diff --git a/src/frontends/qt4/GuiDelimiter.cpp b/src/frontends/qt4/GuiDelimiter.cpp index fabf3db3ba..8036c9f2c7 100644 --- a/src/frontends/qt4/GuiDelimiter.cpp +++ b/src/frontends/qt4/GuiDelimiter.cpp @@ -74,7 +74,6 @@ GuiDelimiter::GuiDelimiter(LyXView & lv) { setupUi(this); setViewTitle(_("Math Delimiter")); - setController(this, false); connect(closePB, SIGNAL(clicked()), this, SLOT(accept())); diff --git a/src/frontends/qt4/GuiDialog.cpp b/src/frontends/qt4/GuiDialog.cpp index fce86af551..351ee5056a 100644 --- a/src/frontends/qt4/GuiDialog.cpp +++ b/src/frontends/qt4/GuiDialog.cpp @@ -25,16 +25,12 @@ namespace lyx { namespace frontend { GuiDialog::GuiDialog(LyXView & lv, std::string const & name) - : is_closing_(false), name_(name), controller_(0), destroy_controller_(false) -{ - lyxview_ = &lv; -} + : Controller(this, lv), is_closing_(false), name_(name) +{} GuiDialog::~GuiDialog() { - if (destroy_controller_) - delete controller_; } @@ -79,7 +75,7 @@ void GuiDialog::slotRestore() // Tell the controller that a request to refresh the dialog's contents // has been received. It's up to the controller to supply the necessary // info by calling GuiDialog::updateView(). - controller().updateDialog(name_); + updateDialog(name_); bc().restore(); } @@ -87,23 +83,23 @@ void GuiDialog::checkStatus() { // buffer independant dialogs are always active. // This check allows us leave canApply unimplemented for some dialogs. - if (!controller().isBufferDependent()) + if (!isBufferDependent()) return; // deactivate the dialog if we have no buffer - if (!controller().isBufferAvailable()) { + if (!isBufferAvailable()) { bc().setReadOnly(true); return; } // check whether this dialog may be active - if (controller().canApply()) { - bool const readonly = controller().isBufferReadonly(); + if (canApply()) { + bool const readonly = isBufferReadonly(); bc().setReadOnly(readonly); // refreshReadOnly() is too generous in _enabling_ widgets // update dialog to disable disabled widgets again - if (!readonly || controller().canApplyToReadOnly()) + if (!readonly || canApplyToReadOnly()) updateView(); } else { @@ -125,7 +121,7 @@ void GuiDialog::showView() setMinimumSize(hint); updateView(); // make sure its up-to-date - if (controller().exitEarly()) + if (exitEarly()) return; if (QWidget::isVisible()) { @@ -168,17 +164,17 @@ void GuiDialog::updateView() void GuiDialog::showData(string const & data) { - if (controller().isBufferDependent() && !controller().isBufferAvailable()) + if (isBufferDependent() && !isBufferAvailable()) return; - if (!controller().initialiseParams(data)) { + if (!initialiseParams(data)) { lyxerr << "Dialog \"" << name_ << "\" failed to translate the data " "string passed to show()" << std::endl; return; } - bc().setReadOnly(controller().isBufferReadonly()); + bc().setReadOnly(isBufferReadonly()); showView(); // The widgets may not be valid, so refresh the button controller bc().refresh(); @@ -187,16 +183,16 @@ void GuiDialog::showData(string const & data) void GuiDialog::updateData(string const & data) { - if (controller().isBufferDependent() && !controller().isBufferAvailable()) + if (isBufferDependent() && !isBufferAvailable()) return; - if (!controller().initialiseParams(data)) { + if (!initialiseParams(data)) { lyxerr << "Dialog \"" << name_ << "\" could not be initialized" << std::endl; return; } - bc().setReadOnly(controller().isBufferReadonly()); + bc().setReadOnly(isBufferReadonly()); updateView(); // The widgets may not be valid, so refresh the button controller bc().refresh(); @@ -208,41 +204,31 @@ void GuiDialog::hide() if (!isVisibleView()) return; - controller().clearParams(); + clearParams(); hideView(); - controller().disconnect(name_); + Controller::disconnect(name_); } void GuiDialog::apply() { - if (controller().isBufferDependent()) { - if (!controller().isBufferAvailable() || - (controller().isBufferReadonly() && !controller().canApplyToReadOnly())) + if (isBufferDependent()) { + if (!isBufferAvailable() || + (isBufferReadonly() && !canApplyToReadOnly())) return; } applyView(); - controller().dispatchParams(); + dispatchParams(); - if (controller().disconnectOnApply() && !is_closing_) { - controller().disconnect(name_); - controller().initialiseParams(string()); + if (disconnectOnApply() && !is_closing_) { + Controller::disconnect(name_); + initialiseParams(string()); updateView(); } } -void GuiDialog::setController(Controller * controller, bool destroy) -{ - BOOST_ASSERT(controller); - BOOST_ASSERT(!controller_); - destroy_controller_ = destroy; - controller_ = controller; - controller_->setLyXView(*lyxview_); -} - - void GuiDialog::showEvent(QShowEvent * e) { #if (QT_VERSION >= 0x040200) @@ -284,9 +270,8 @@ namespace lyx { namespace frontend { GuiCommand::GuiCommand(LyXView & lv, string const & name) - : GuiDialog(lv, name), Controller(this), params_(name), lfun_name_(name) + : GuiDialog(lv, name), params_(name), lfun_name_(name) { - setController(this, false); } diff --git a/src/frontends/qt4/GuiDialog.h b/src/frontends/qt4/GuiDialog.h index 33d3b28577..87748a7d37 100644 --- a/src/frontends/qt4/GuiDialog.h +++ b/src/frontends/qt4/GuiDialog.h @@ -29,7 +29,7 @@ namespace frontend { /** \c Dialog collects the different parts of a Model-Controller-View * split of a generic dialog together. */ -class GuiDialog : public QDialog, public Dialog +class GuiDialog : public QDialog, public Dialog, public Controller { Q_OBJECT @@ -119,20 +119,11 @@ public: */ bool isClosing() const { return is_closing_; } - /** \name Dialog Specialization - * Methods to set the Controller and View and so specialise - * to a particular dialog. - */ - //@{ - /// \param ptr is stored and destroyed by \c Dialog. - void setController(Controller * ptr, bool destroy = true); - //@} - /** \name Dialog Components * Methods to access the various components making up a dialog. */ //@{ - virtual Controller & controller() { return *controller_; } + virtual Controller & controller() { return *this; } //@} /** Defaults to nothing. Can be used by the Controller, however, to @@ -161,13 +152,10 @@ private: * itself to the kernel. */ std::string name_; - Controller * controller_; - bool destroy_controller_; - LyXView * lyxview_; // FIXME: replace by moving to constructor }; -class GuiCommand : public GuiDialog, public Controller +class GuiCommand : public GuiDialog { public: /// We need to know with what sort of inset we're associated. diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 1ab2ae996e..27e6e99144 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -219,10 +219,9 @@ void PreambleModule::closeEvent(QCloseEvent * e) GuiDocument::GuiDocument(LyXView & lv) - : GuiDialog(lv, "document"), Controller(this) + : GuiDialog(lv, "document") { setupUi(this); - setController(this, false); setViewTitle(_("Document Settings")); lang_ = getSecond(getLanguageData(false)); diff --git a/src/frontends/qt4/GuiDocument.h b/src/frontends/qt4/GuiDocument.h index 409116edcf..0c13da6801 100644 --- a/src/frontends/qt4/GuiDocument.h +++ b/src/frontends/qt4/GuiDocument.h @@ -70,7 +70,7 @@ public: }; -class GuiDocument : public GuiDialog, public Ui::DocumentUi, public Controller +class GuiDocument : public GuiDialog, public Ui::DocumentUi { Q_OBJECT public: @@ -134,8 +134,6 @@ private: // FIXME std::vector lang_; - /// parent controller - Controller & controller() { return *this; } /// Available modules QStringListModel * availableModel() { return &available_model_; } /// Selected modules diff --git a/src/frontends/qt4/GuiERT.cpp b/src/frontends/qt4/GuiERT.cpp index efd6d7e07d..70beaaf90a 100644 --- a/src/frontends/qt4/GuiERT.cpp +++ b/src/frontends/qt4/GuiERT.cpp @@ -25,11 +25,10 @@ namespace lyx { namespace frontend { GuiERT::GuiERT(LyXView & lv) - : GuiDialog(lv, "ert"), Controller(this), status_(InsetERT::Collapsed) + : GuiDialog(lv, "ert"), status_(InsetERT::Collapsed) { setupUi(this); setViewTitle(_("TeX Code Settings")); - setController(this, false); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); diff --git a/src/frontends/qt4/GuiERT.h b/src/frontends/qt4/GuiERT.h index 20577dac2a..040a89dc4a 100644 --- a/src/frontends/qt4/GuiERT.h +++ b/src/frontends/qt4/GuiERT.h @@ -19,7 +19,7 @@ namespace lyx { namespace frontend { -class GuiERT : public GuiDialog, public Ui::ERTUi, public Controller +class GuiERT : public GuiDialog, public Ui::ERTUi { Q_OBJECT @@ -31,8 +31,6 @@ private Q_SLOTS: private: void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// Apply changes void applyView(); /// update diff --git a/src/frontends/qt4/GuiErrorList.cpp b/src/frontends/qt4/GuiErrorList.cpp index a0d824deeb..1f135a0cff 100644 --- a/src/frontends/qt4/GuiErrorList.cpp +++ b/src/frontends/qt4/GuiErrorList.cpp @@ -43,10 +43,9 @@ namespace frontend { using support::bformat; GuiErrorList::GuiErrorList(LyXView & lv) - : GuiDialog(lv, "errorlist"), Controller(this) + : GuiDialog(lv, "errorlist") { setupUi(this); - setController(this, false); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); diff --git a/src/frontends/qt4/GuiErrorList.h b/src/frontends/qt4/GuiErrorList.h index 31210a4aeb..26ec430fbe 100644 --- a/src/frontends/qt4/GuiErrorList.h +++ b/src/frontends/qt4/GuiErrorList.h @@ -21,7 +21,7 @@ class QListWidgetItem; namespace lyx { namespace frontend { -class GuiErrorList : public GuiDialog, public Ui::ErrorListUi, public Controller +class GuiErrorList : public GuiDialog, public Ui::ErrorListUi { Q_OBJECT @@ -37,8 +37,6 @@ private: void closeEvent(QCloseEvent *); /// void showEvent(QShowEvent *); - /// parent controller - Controller & controller() { return *this; } /// update contents void updateContents(); /// diff --git a/src/frontends/qt4/GuiExternal.cpp b/src/frontends/qt4/GuiExternal.cpp index befef46e55..f0e9ed8af3 100644 --- a/src/frontends/qt4/GuiExternal.cpp +++ b/src/frontends/qt4/GuiExternal.cpp @@ -103,11 +103,10 @@ char const * const origin_gui_strs[] = { GuiExternal::GuiExternal(LyXView & lv) - : GuiDialog(lv, "external"), Controller(this), bbChanged_(false) + : GuiDialog(lv, "external"), bbChanged_(false) { setupUi(this); setViewTitle(_("External Material")); - setController(this, false); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); @@ -117,7 +116,7 @@ GuiExternal::GuiExternal(LyXView & lv) showCO, SLOT(setEnabled(bool))); connect(displayCB, SIGNAL(toggled(bool)), displayscaleED, SLOT(setEnabled(bool))); - connect(showCO, SIGNAL(activated(const QString&)), + connect(showCO, SIGNAL(activated(QString)), this, SLOT(change_adaptor())); connect(originCO, SIGNAL(activated(int)), this, SLOT(change_adaptor())); @@ -127,27 +126,27 @@ GuiExternal::GuiExternal(LyXView & lv) this, SLOT(browseClicked())); connect(editPB, SIGNAL(clicked()), this, SLOT(editClicked())); - connect(externalCO, SIGNAL(activated(const QString &)), + connect(externalCO, SIGNAL(activated(QString)), this, SLOT(templateChanged())); - connect(extraED, SIGNAL(textChanged(const QString &)), - this, SLOT(extraChanged(const QString&))); - connect(extraFormatCO, SIGNAL(activated(const QString &)), - this, SLOT(formatChanged(const QString&))); + connect(extraED, SIGNAL(textChanged(QString)), + this, SLOT(extraChanged(QString))); + connect(extraFormatCO, SIGNAL(activated(QString)), + this, SLOT(formatChanged(QString))); connect(widthUnitCO, SIGNAL(activated(int)), this, SLOT(widthUnitChanged())); connect(heightUnitCO, SIGNAL(selectionChanged(lyx::Length::UNIT)), this, SLOT(change_adaptor())); connect(displayCB, SIGNAL(stateChanged(int)), this, SLOT(change_adaptor())); - connect(displayscaleED, SIGNAL(textChanged(const QString &)), + connect(displayscaleED, SIGNAL(textChanged(QString)), this, SLOT(change_adaptor())); - connect(angleED, SIGNAL(textChanged(const QString &)), + connect(angleED, SIGNAL(textChanged(QString)), this, SLOT(change_adaptor())); - connect(widthED, SIGNAL(textChanged(const QString &)), + connect(widthED, SIGNAL(textChanged(QString)), this, SLOT(sizeChanged())); - connect(heightED, SIGNAL(textChanged(const QString &)), + connect(heightED, SIGNAL(textChanged(QString)), this, SLOT(sizeChanged())); - connect(fileED, SIGNAL(textChanged(const QString &)), + connect(fileED, SIGNAL(textChanged(QString)), this, SLOT(change_adaptor())); connect(clipCB, SIGNAL(stateChanged(int)), this, SLOT(change_adaptor())); diff --git a/src/frontends/qt4/GuiExternal.h b/src/frontends/qt4/GuiExternal.h index 74ebab3ff2..b5ae2becee 100644 --- a/src/frontends/qt4/GuiExternal.h +++ b/src/frontends/qt4/GuiExternal.h @@ -36,7 +36,7 @@ class RotationDataType; namespace frontend { -class GuiExternal : public GuiDialog, public Ui::ExternalUi, public Controller +class GuiExternal : public GuiDialog, public Ui::ExternalUi { Q_OBJECT @@ -63,8 +63,6 @@ private: void closeEvent(QCloseEvent * e); // bool activateAspectratio() const; - /// parent controller - Controller & controller() { return *this; } /// Apply changes void applyView(); /// update diff --git a/src/frontends/qt4/GuiFloat.cpp b/src/frontends/qt4/GuiFloat.cpp index 6b8abe0107..c8d6e828d6 100644 --- a/src/frontends/qt4/GuiFloat.cpp +++ b/src/frontends/qt4/GuiFloat.cpp @@ -27,9 +27,8 @@ namespace lyx { namespace frontend { GuiFloat::GuiFloat(LyXView & lv) - : GuiDialog(lv, "float"), Controller(this) + : GuiDialog(lv, "float") { - setController(this, false); setViewTitle(_("Float Settings")); setupUi(this); diff --git a/src/frontends/qt4/GuiFloat.h b/src/frontends/qt4/GuiFloat.h index 28049e5f40..3bb23aab0d 100644 --- a/src/frontends/qt4/GuiFloat.h +++ b/src/frontends/qt4/GuiFloat.h @@ -20,7 +20,7 @@ namespace lyx { namespace frontend { -class GuiFloat : public GuiDialog, public Ui::FloatUi, public Controller +class GuiFloat : public GuiDialog, public Ui::FloatUi { Q_OBJECT @@ -32,8 +32,6 @@ private Q_SLOTS: private: void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// Apply changes void applyView(); /// update diff --git a/src/frontends/qt4/GuiGraphics.cpp b/src/frontends/qt4/GuiGraphics.cpp index be8f7541ac..fa71db87a8 100644 --- a/src/frontends/qt4/GuiGraphics.cpp +++ b/src/frontends/qt4/GuiGraphics.cpp @@ -135,11 +135,10 @@ getSecond(vector const & pr) } GuiGraphics::GuiGraphics(LyXView & lv) - : GuiDialog(lv, "graphics"), Controller(this) + : GuiDialog(lv, "graphics") { setupUi(this); setViewTitle(_("Graphics")); - setController(this, false); //main buttons connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); diff --git a/src/frontends/qt4/GuiGraphics.h b/src/frontends/qt4/GuiGraphics.h index 27efa82e5e..fc15ebad5b 100644 --- a/src/frontends/qt4/GuiGraphics.h +++ b/src/frontends/qt4/GuiGraphics.h @@ -35,7 +35,7 @@ namespace frontend { class LyXView; -class GuiGraphics : public GuiDialog, public Ui::GraphicsUi, public Controller +class GuiGraphics : public GuiDialog, public Ui::GraphicsUi { Q_OBJECT @@ -57,8 +57,6 @@ private Q_SLOTS: private: void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } bool isValid(); /// Apply changes void applyView(); diff --git a/src/frontends/qt4/GuiInclude.cpp b/src/frontends/qt4/GuiInclude.cpp index 155c85af87..3f31f3f000 100644 --- a/src/frontends/qt4/GuiInclude.cpp +++ b/src/frontends/qt4/GuiInclude.cpp @@ -61,11 +61,10 @@ using support::getVectorFromString; GuiInclude::GuiInclude(LyXView & lv) - : GuiDialog(lv, "include"), Controller(this), params_("include") + : GuiDialog(lv, "include"), params_("include") { setupUi(this); setViewTitle(_("Child Document")); - setController(this, false); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); diff --git a/src/frontends/qt4/GuiInclude.h b/src/frontends/qt4/GuiInclude.h index 8330684ca2..8230860dd1 100644 --- a/src/frontends/qt4/GuiInclude.h +++ b/src/frontends/qt4/GuiInclude.h @@ -25,7 +25,7 @@ namespace lyx { namespace frontend { -class GuiInclude : public GuiDialog, public Ui::IncludeUi, public Controller +class GuiInclude : public GuiDialog, public Ui::IncludeUi { Q_OBJECT @@ -49,8 +49,6 @@ private Q_SLOTS: private: void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// void updateLists(); /// validate listings parameters and return an error message, if any diff --git a/src/frontends/qt4/GuiListings.cpp b/src/frontends/qt4/GuiListings.cpp index 4ccb93de54..0ad96d07c9 100644 --- a/src/frontends/qt4/GuiListings.cpp +++ b/src/frontends/qt4/GuiListings.cpp @@ -166,11 +166,10 @@ char const * font_styles_gui[] = GuiListings::GuiListings(LyXView & lv) - : GuiDialog(lv, "listings"), Controller(this) + : GuiDialog(lv, "listings") { setupUi(this); setViewTitle(_("Program Listing Settings")); - setController(this, false); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); diff --git a/src/frontends/qt4/GuiListings.h b/src/frontends/qt4/GuiListings.h index 2ac5194e77..400b867e38 100644 --- a/src/frontends/qt4/GuiListings.h +++ b/src/frontends/qt4/GuiListings.h @@ -19,7 +19,7 @@ namespace lyx { namespace frontend { -class GuiListings : public GuiDialog, public Ui::ListingsUi, public Controller +class GuiListings : public GuiDialog, public Ui::ListingsUi { Q_OBJECT public: @@ -45,8 +45,6 @@ private Q_SLOTS: void on_languageCO_currentIndexChanged(int); private: void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// return false if validate_listings_params returns error bool isValid(); /// Apply changes diff --git a/src/frontends/qt4/GuiLog.cpp b/src/frontends/qt4/GuiLog.cpp index 67609d9fb4..f736fc2fe5 100644 --- a/src/frontends/qt4/GuiLog.cpp +++ b/src/frontends/qt4/GuiLog.cpp @@ -103,10 +103,9 @@ void LogHighlighter::highlightBlock(QString const & text) ///////////////////////////////////////////////////////////////////// GuiLog::GuiLog(LyXView & lv) - : GuiDialog(lv, "log"), Controller(this), type_(LatexLog) + : GuiDialog(lv, "log"), type_(LatexLog) { setupUi(this); - setController(this, false); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); connect(updatePB, SIGNAL(clicked()), this, SLOT(updateContents())); diff --git a/src/frontends/qt4/GuiLog.h b/src/frontends/qt4/GuiLog.h index 6be299386a..8305e72aeb 100644 --- a/src/frontends/qt4/GuiLog.h +++ b/src/frontends/qt4/GuiLog.h @@ -24,7 +24,7 @@ namespace frontend { class LogHighlighter; -class GuiLog : public GuiDialog, public Ui::LogUi, public Controller +class GuiLog : public GuiDialog, public Ui::LogUi { Q_OBJECT @@ -36,8 +36,6 @@ private Q_SLOTS: private: void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// Apply changes void applyView() {} diff --git a/src/frontends/qt4/GuiMath.cpp b/src/frontends/qt4/GuiMath.cpp index 07ea4fa356..616aecd52f 100644 --- a/src/frontends/qt4/GuiMath.cpp +++ b/src/frontends/qt4/GuiMath.cpp @@ -21,7 +21,7 @@ namespace lyx { namespace frontend { GuiMath::GuiMath(LyXView & lv, std::string const & name) - : GuiDialog(lv, name), Controller(this) + : GuiDialog(lv, name) { // FIXME: Ideally, those unicode codepoints would be defined // in "lib/symbols". Unfortunately, some of those are already diff --git a/src/frontends/qt4/GuiMath.h b/src/frontends/qt4/GuiMath.h index ed57825afd..c6026ad32d 100644 --- a/src/frontends/qt4/GuiMath.h +++ b/src/frontends/qt4/GuiMath.h @@ -33,7 +33,7 @@ struct MathSymbol { }; -class GuiMath : public GuiDialog, public Controller +class GuiMath : public GuiDialog { public: GuiMath(LyXView & lv, std::string const & name); @@ -44,8 +44,6 @@ public: void dispatchParams() {} bool isBufferDependent() const { return true; } - Controller & controller() { return *this; } - /// dispatch an LFUN void dispatchFunc(kb_action action, std::string const & arg = std::string()) const; diff --git a/src/frontends/qt4/GuiMathMatrix.cpp b/src/frontends/qt4/GuiMathMatrix.cpp index a2c8fea040..6137e4e1f3 100644 --- a/src/frontends/qt4/GuiMathMatrix.cpp +++ b/src/frontends/qt4/GuiMathMatrix.cpp @@ -33,7 +33,6 @@ GuiMathMatrix::GuiMathMatrix(LyXView & lv) { setupUi(this); setViewTitle(_("Math Matrix")); - setController(this, false); table->setMinimumSize(100, 100); rowsSB->setValue(5); diff --git a/src/frontends/qt4/GuiNote.cpp b/src/frontends/qt4/GuiNote.cpp index 93b1e7dfde..6f56ac1828 100644 --- a/src/frontends/qt4/GuiNote.cpp +++ b/src/frontends/qt4/GuiNote.cpp @@ -26,10 +26,9 @@ namespace lyx { namespace frontend { GuiNote::GuiNote(LyXView & lv) - : GuiDialog(lv, "note"), Controller(this) + : GuiDialog(lv, "note") { setupUi(this); - setController(this, false); setViewTitle(_("Note Settings")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); diff --git a/src/frontends/qt4/GuiNote.h b/src/frontends/qt4/GuiNote.h index 31b26d93ad..d4cb92942c 100644 --- a/src/frontends/qt4/GuiNote.h +++ b/src/frontends/qt4/GuiNote.h @@ -19,7 +19,7 @@ namespace lyx { namespace frontend { -class GuiNote : public GuiDialog, public Ui::NoteUi, public Controller +class GuiNote : public GuiDialog, public Ui::NoteUi { Q_OBJECT public: @@ -28,8 +28,6 @@ private Q_SLOTS: void change_adaptor(); private: void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// Apply changes void applyView(); /// Update dialog before showing it diff --git a/src/frontends/qt4/GuiParagraph.cpp b/src/frontends/qt4/GuiParagraph.cpp index 7d812096ec..afc9462d62 100644 --- a/src/frontends/qt4/GuiParagraph.cpp +++ b/src/frontends/qt4/GuiParagraph.cpp @@ -50,13 +50,12 @@ namespace lyx { namespace frontend { GuiParagraph::GuiParagraph(LyXView & lv) - : Controller(this) + : Controller(this, lv) { setupUi(this); setWindowTitle(qt_("Paragraph Settings")); //setModal(modal); - setLyXView(lv); QGridLayout * gridLayout = new QGridLayout(this); gridLayout->setMargin(0); gridLayout->addWidget(this); @@ -67,10 +66,10 @@ GuiParagraph::GuiParagraph(LyXView & lv) connect(alignRightRB, SIGNAL(clicked()), this, SLOT(changed())); connect(alignCenterRB, SIGNAL(clicked()), this, SLOT(changed())); connect(linespacing, SIGNAL(activated(int)), this, SLOT(changed())); - connect(linespacingValue, SIGNAL(textChanged(const QString &)), + connect(linespacingValue, SIGNAL(textChanged(QString)), this, SLOT(changed())); connect(indentCB, SIGNAL(clicked()), this, SLOT(changed())); - connect(labelWidth, SIGNAL(textChanged(const QString &)), + connect(labelWidth, SIGNAL(textChanged(QString)), this, SLOT(changed())); diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 5a2c3268f9..1e4e8cf731 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -1721,11 +1721,10 @@ void PrefIdentity::update(LyXRC const & rc) ///////////////////////////////////////////////////////////////////// GuiPreferences::GuiPreferences(LyXView & lv) - : GuiDialog(lv, "prefs"), Controller(this), update_screen_font_(false) + : GuiDialog(lv, "prefs"), update_screen_font_(false) { setupUi(this); setViewTitle(_("Preferences")); - setController(this, false); QDialog::setModal(false); diff --git a/src/frontends/qt4/GuiPrefs.h b/src/frontends/qt4/GuiPrefs.h index 8421fc3bc6..70ad48eee0 100644 --- a/src/frontends/qt4/GuiPrefs.h +++ b/src/frontends/qt4/GuiPrefs.h @@ -355,7 +355,7 @@ public: }; -class GuiPreferences : public GuiDialog, public Ui::PrefsUi, public Controller +class GuiPreferences : public GuiDialog, public Ui::PrefsUi { Q_OBJECT public: @@ -372,8 +372,6 @@ public: void closeEvent(QCloseEvent * e); /// void add(PrefModule * module); - /// parent controller - Controller & controller() { return *this; } /// Apply changes void applyView(); /// update (do we need this?) diff --git a/src/frontends/qt4/GuiPrint.cpp b/src/frontends/qt4/GuiPrint.cpp index 0349fdf448..496d1f2492 100644 --- a/src/frontends/qt4/GuiPrint.cpp +++ b/src/frontends/qt4/GuiPrint.cpp @@ -45,10 +45,9 @@ using support::FileFilterList; GuiPrint::GuiPrint(LyXView & lv) - : GuiDialog(lv, "print"), Controller(this) + : GuiDialog(lv, "print") { setupUi(this); - setController(this, false); setViewTitle(_("Print Document")); connect(printPB, SIGNAL(clicked()), this, SLOT(slotOK())); diff --git a/src/frontends/qt4/GuiPrint.h b/src/frontends/qt4/GuiPrint.h index 5c84ba23ed..169752896a 100644 --- a/src/frontends/qt4/GuiPrint.h +++ b/src/frontends/qt4/GuiPrint.h @@ -25,7 +25,7 @@ namespace lyx { namespace frontend { -class GuiPrint : public GuiDialog, public Ui::PrintUi, public Controller +class GuiPrint : public GuiDialog, public Ui::PrintUi { Q_OBJECT @@ -39,8 +39,6 @@ private Q_SLOTS: void copiesChanged(int); void printerChanged(); void pagerangeChanged(); - /// parent controller - Controller & controller() { return *this; } private: /// Apply changes diff --git a/src/frontends/qt4/GuiRef.cpp b/src/frontends/qt4/GuiRef.cpp index a01e1d339a..630256f6ae 100644 --- a/src/frontends/qt4/GuiRef.cpp +++ b/src/frontends/qt4/GuiRef.cpp @@ -52,11 +52,9 @@ using support::makeDisplayPath; static std::string const lfun_name_ = "ref"; GuiRef::GuiRef(LyXView & lv) - : GuiDialog(lv, "ref"), Controller(this), - params_("ref") + : GuiDialog(lv, "ref"), params_("ref") { setupUi(this); - setController(this, false); setViewTitle(_("Cross-reference")); sort_ = false; @@ -70,9 +68,9 @@ GuiRef::GuiRef(LyXView & lv) connect(typeCO, SIGNAL(activated(int)), this, SLOT(changed_adaptor())); - connect(referenceED, SIGNAL(textChanged(const QString &)), + connect(referenceED, SIGNAL(textChanged(QString)), this, SLOT(changed_adaptor())); - connect(nameED, SIGNAL(textChanged(const QString &)), + connect(nameED, SIGNAL(textChanged(QString)), this, SLOT(changed_adaptor())); connect(refsLW, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(refHighlighted(QListWidgetItem *))); @@ -117,6 +115,7 @@ void GuiRef::gotoClicked() gotoRef(); } + void GuiRef::selectionChanged() { if (isBufferReadonly()) @@ -326,20 +325,18 @@ void GuiRef::redoRefs() if (!oldSelection.isEmpty() || !last_reference_.isEmpty()) { bool const newInset = oldSelection.isEmpty(); QString textToFind = newInset ? last_reference_ : oldSelection; - bool foundItem = false; - for (int i = 0; !foundItem && i < refsLW->count(); ++i) { + last_reference_.clear(); + for (int i = 0; i != refsLW->count(); ++i) { QListWidgetItem * item = refsLW->item(i); if (textToFind == item->text()) { refsLW->setCurrentItem(item); refsLW->setItemSelected(item, !newInset); //Make sure selected item is visible refsLW->scrollToItem(item); - foundItem = true; + last_reference_ = textToFind; + break; } } - if (foundItem) - last_reference_ = textToFind; - else last_reference_ = ""; } refsLW->setUpdatesEnabled(true); refsLW->update(); diff --git a/src/frontends/qt4/GuiRef.h b/src/frontends/qt4/GuiRef.h index 3578985f7b..72630684af 100644 --- a/src/frontends/qt4/GuiRef.h +++ b/src/frontends/qt4/GuiRef.h @@ -24,7 +24,7 @@ class QListWidgetItem; namespace lyx { namespace frontend { -class GuiRef : public GuiDialog, public Ui::RefUi, public Controller +class GuiRef : public GuiDialog, public Ui::RefUi { Q_OBJECT @@ -63,8 +63,6 @@ private: /// void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *static_cast(this); } /// bool isValid(); /// apply changes diff --git a/src/frontends/qt4/GuiSearch.cpp b/src/frontends/qt4/GuiSearch.cpp index 1d42dd852f..cb5833d439 100644 --- a/src/frontends/qt4/GuiSearch.cpp +++ b/src/frontends/qt4/GuiSearch.cpp @@ -40,17 +40,16 @@ static void uniqueInsert(QComboBox * box, QString const & text) GuiSearch::GuiSearch(LyXView & lv) - : GuiDialog(lv, "findreplace"), Controller(this) + : GuiDialog(lv, "findreplace") { setupUi(this); - setController(this, false); setViewTitle(_("Find and Replace")); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); connect(findPB, SIGNAL(clicked()), this, SLOT(findClicked())); connect(replacePB, SIGNAL(clicked()), this, SLOT(replaceClicked())); connect(replaceallPB, SIGNAL(clicked()), this, SLOT(replaceallClicked())); - connect(findCO, SIGNAL(editTextChanged(const QString &)), + connect(findCO, SIGNAL(editTextChanged(QString)), this, SLOT(findChanged())); setFocusProxy(findCO); diff --git a/src/frontends/qt4/GuiSearch.h b/src/frontends/qt4/GuiSearch.h index d9f71252e9..73c5d40644 100644 --- a/src/frontends/qt4/GuiSearch.h +++ b/src/frontends/qt4/GuiSearch.h @@ -19,7 +19,7 @@ namespace lyx { namespace frontend { -class GuiSearch : public GuiDialog, public Ui::SearchUi, public Controller +class GuiSearch : public GuiDialog, public Ui::SearchUi { Q_OBJECT @@ -35,8 +35,6 @@ private Q_SLOTS: private: void showView(); void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// bool initialiseParams(std::string const &) { return true; } void clearParams() {} diff --git a/src/frontends/qt4/GuiSendto.cpp b/src/frontends/qt4/GuiSendto.cpp index 798fad0c39..6e6452350c 100644 --- a/src/frontends/qt4/GuiSendto.cpp +++ b/src/frontends/qt4/GuiSendto.cpp @@ -37,11 +37,10 @@ namespace frontend { using support::trim; GuiSendTo::GuiSendTo(LyXView & lv) - : GuiDialog(lv, "sendto"), Controller(this) + : GuiDialog(lv, "sendto") { setupUi(this); setViewTitle(_("Send Document to Command")); - setController(this, false); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); diff --git a/src/frontends/qt4/GuiSendto.h b/src/frontends/qt4/GuiSendto.h index 095c249142..644971fdc6 100644 --- a/src/frontends/qt4/GuiSendto.h +++ b/src/frontends/qt4/GuiSendto.h @@ -26,7 +26,7 @@ class Format; namespace frontend { -class GuiSendTo : public GuiDialog, public Ui::SendtoUi, public Controller +class GuiSendTo : public GuiDialog, public Ui::SendtoUi { Q_OBJECT @@ -40,8 +40,6 @@ private Q_SLOTS: private: void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// bool isValid(); /// Apply from dialog diff --git a/src/frontends/qt4/GuiShowFile.cpp b/src/frontends/qt4/GuiShowFile.cpp index 7b1b8abae9..c825e0306a 100644 --- a/src/frontends/qt4/GuiShowFile.cpp +++ b/src/frontends/qt4/GuiShowFile.cpp @@ -28,11 +28,10 @@ using support::FileName; using support::onlyFilename; GuiShowFile::GuiShowFile(LyXView & lv) - : GuiDialog(lv, "file"), Controller(this) + : GuiDialog(lv, "file") { setupUi(this); setViewTitle(_("Show File")); - setController(this, false); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); diff --git a/src/frontends/qt4/GuiShowFile.h b/src/frontends/qt4/GuiShowFile.h index 20ea49fc20..1287597884 100644 --- a/src/frontends/qt4/GuiShowFile.h +++ b/src/frontends/qt4/GuiShowFile.h @@ -21,7 +21,7 @@ namespace lyx { namespace frontend { -class GuiShowFile : public GuiDialog, public Ui::ShowFileUi, public Controller +class GuiShowFile : public GuiDialog, public Ui::ShowFileUi { Q_OBJECT @@ -31,8 +31,6 @@ public: private: /// void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// update void updateContents(); /// diff --git a/src/frontends/qt4/GuiSpellchecker.cpp b/src/frontends/qt4/GuiSpellchecker.cpp index 2236de3ee5..4b0448c663 100644 --- a/src/frontends/qt4/GuiSpellchecker.cpp +++ b/src/frontends/qt4/GuiSpellchecker.cpp @@ -71,12 +71,11 @@ using support::bformat; using support::contains; GuiSpellchecker::GuiSpellchecker(LyXView & lv) - : GuiDialog(lv, "spellchecker"), Controller(this), exitEarly_(false), + : GuiDialog(lv, "spellchecker"), exitEarly_(false), oldval_(0), newvalue_(0), count_(0), speller_(0) { setupUi(this); setViewTitle(_("Spellchecker")); - setController(this, false); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); connect(replacePB, SIGNAL(clicked()), this, SLOT(replaceClicked())); diff --git a/src/frontends/qt4/GuiSpellchecker.h b/src/frontends/qt4/GuiSpellchecker.h index 52fa3719f3..fc58b0f741 100644 --- a/src/frontends/qt4/GuiSpellchecker.h +++ b/src/frontends/qt4/GuiSpellchecker.h @@ -27,8 +27,7 @@ class SpellBase; namespace frontend { -class GuiSpellchecker - : public GuiDialog, public Ui::SpellcheckerUi, public Controller +class GuiSpellchecker : public GuiDialog, public Ui::SpellcheckerUi { Q_OBJECT @@ -52,8 +51,6 @@ private: void closeEvent(QCloseEvent * e); /// update from controller void partialUpdate(int id); - /// parent controller - Controller & controller() { return *this; } /// void updateContents(); diff --git a/src/frontends/qt4/GuiTabular.cpp b/src/frontends/qt4/GuiTabular.cpp index 7f1277f3eb..0e24dd1ec7 100644 --- a/src/frontends/qt4/GuiTabular.cpp +++ b/src/frontends/qt4/GuiTabular.cpp @@ -38,13 +38,12 @@ namespace lyx { namespace frontend { GuiTabular::GuiTabular(LyXView & lv) - : GuiDialog(lv, "tabular"), Controller(this) + : GuiDialog(lv, "tabular") { active_cell_ = Tabular::npos; setupUi(this); setViewTitle(_("Table Settings")); - setController(this, false); widthED->setValidator(unsignedLengthValidator(widthED)); topspaceED->setValidator(new LengthValidator(topspaceED)); diff --git a/src/frontends/qt4/GuiTabular.h b/src/frontends/qt4/GuiTabular.h index 8b32715b26..23a976a3c7 100644 --- a/src/frontends/qt4/GuiTabular.h +++ b/src/frontends/qt4/GuiTabular.h @@ -22,7 +22,7 @@ namespace lyx { namespace frontend { -class GuiTabular : public GuiDialog, public Ui::TabularUi, public Controller +class GuiTabular : public GuiDialog, public Ui::TabularUi { Q_OBJECT @@ -71,8 +71,6 @@ private Q_SLOTS: private: /// void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// bool isValid() { return true; } /// update borders diff --git a/src/frontends/qt4/GuiTabularCreate.cpp b/src/frontends/qt4/GuiTabularCreate.cpp index be59c0bec9..76f4362e3d 100644 --- a/src/frontends/qt4/GuiTabularCreate.cpp +++ b/src/frontends/qt4/GuiTabularCreate.cpp @@ -28,11 +28,10 @@ namespace lyx { namespace frontend { GuiTabularCreate::GuiTabularCreate(LyXView & lv) - : GuiDialog(lv, "tabularcreate"), Controller(this) + : GuiDialog(lv, "tabularcreate") { setupUi(this); setViewTitle(_("Insert Table")); - setController(this, false); rowsSB->setValue(5); columnsSB->setValue(5); diff --git a/src/frontends/qt4/GuiTabularCreate.h b/src/frontends/qt4/GuiTabularCreate.h index 45f14a8838..a56001a66c 100644 --- a/src/frontends/qt4/GuiTabularCreate.h +++ b/src/frontends/qt4/GuiTabularCreate.h @@ -21,8 +21,7 @@ namespace lyx { namespace frontend { -class GuiTabularCreate - : public GuiDialog, public Ui::TabularCreateUi, public Controller +class GuiTabularCreate : public GuiDialog, public Ui::TabularCreateUi { Q_OBJECT @@ -33,9 +32,6 @@ private Q_SLOTS: void columnsChanged(int); void rowsChanged(int); - /// parent controller - Controller & controller() { return *this; } - private: /// Apply changes void applyView(); diff --git a/src/frontends/qt4/GuiTexinfo.cpp b/src/frontends/qt4/GuiTexinfo.cpp index 65900275cd..7844247945 100644 --- a/src/frontends/qt4/GuiTexinfo.cpp +++ b/src/frontends/qt4/GuiTexinfo.cpp @@ -86,11 +86,10 @@ static string texFileFromList(string const & file, string const & type) GuiTexInfo::GuiTexInfo(LyXView & lv) - : GuiDialog(lv, "texinfo"), Controller(this) + : GuiDialog(lv, "texinfo") { setupUi(this); setViewTitle(_("TeX Information")); - setController(this, false); warningPosted = false; activeStyle = ClsType; diff --git a/src/frontends/qt4/GuiTexinfo.h b/src/frontends/qt4/GuiTexinfo.h index cab48828b5..9a72e23240 100644 --- a/src/frontends/qt4/GuiTexinfo.h +++ b/src/frontends/qt4/GuiTexinfo.h @@ -24,7 +24,7 @@ namespace lyx { namespace frontend { -class GuiTexInfo : public GuiDialog, public Ui::TexinfoUi, public Controller +class GuiTexInfo : public GuiDialog, public Ui::TexinfoUi { Q_OBJECT @@ -32,7 +32,7 @@ public: /// GuiTexInfo(LyXView & lv); /// the file extensions. order matters in GuiTexInfo::fileType() - enum TexFileType {ClsType, StyType, BstType}; + enum TexFileType { ClsType, StyType, BstType }; public Q_SLOTS: /// @@ -52,8 +52,6 @@ private: /// void closeEvent(QCloseEvent * e); /// - Controller & controller() { return *this; } - /// void updateStyles(TexFileType); /// void updateStyles(); diff --git a/src/frontends/qt4/GuiThesaurus.cpp b/src/frontends/qt4/GuiThesaurus.cpp index 9daa18aeed..3cc0de64cc 100644 --- a/src/frontends/qt4/GuiThesaurus.cpp +++ b/src/frontends/qt4/GuiThesaurus.cpp @@ -32,11 +32,10 @@ namespace lyx { namespace frontend { GuiThesaurus::GuiThesaurus(LyXView & lv) - : GuiDialog(lv, "thesaurus"), Controller(this) + : GuiDialog(lv, "thesaurus") { setupUi(this); setViewTitle(_("Thesaurus")); - setController(this, false); meaningsTV->setColumnCount(1); meaningsTV->header()->hide(); diff --git a/src/frontends/qt4/GuiThesaurus.h b/src/frontends/qt4/GuiThesaurus.h index 3e07f80eec..4a3d5f9210 100644 --- a/src/frontends/qt4/GuiThesaurus.h +++ b/src/frontends/qt4/GuiThesaurus.h @@ -21,7 +21,7 @@ class QTreeWidgetItem; namespace lyx { namespace frontend { -class GuiThesaurus : public GuiDialog, public Ui::ThesaurusUi, public Controller +class GuiThesaurus : public GuiDialog, public Ui::ThesaurusUi { Q_OBJECT @@ -38,8 +38,6 @@ private Q_SLOTS: private: void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// update void updateContents(); /// diff --git a/src/frontends/qt4/GuiVSpace.cpp b/src/frontends/qt4/GuiVSpace.cpp index e6c2dc171b..282fa23310 100644 --- a/src/frontends/qt4/GuiVSpace.cpp +++ b/src/frontends/qt4/GuiVSpace.cpp @@ -41,11 +41,10 @@ namespace lyx { namespace frontend { GuiVSpace::GuiVSpace(LyXView & lv) - : GuiDialog(lv, "vspace"), Controller(this) + : GuiDialog(lv, "vspace") { setupUi(this); setViewTitle(_("Vertical Space Settings")); - setController(this, false); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); diff --git a/src/frontends/qt4/GuiVSpace.h b/src/frontends/qt4/GuiVSpace.h index b138c17696..a583f6213b 100644 --- a/src/frontends/qt4/GuiVSpace.h +++ b/src/frontends/qt4/GuiVSpace.h @@ -22,7 +22,7 @@ namespace lyx { namespace frontend { -class GuiVSpace : public GuiDialog, public Ui::VSpaceUi, public Controller +class GuiVSpace : public GuiDialog, public Ui::VSpaceUi { Q_OBJECT @@ -38,8 +38,6 @@ private Q_SLOTS: void enableCustom(int); private: - /// parent controller - Controller & controller() { return *this; } /// Apply from dialog void applyView(); /// Update the dialog diff --git a/src/frontends/qt4/GuiWrap.cpp b/src/frontends/qt4/GuiWrap.cpp index 66c7d91f2d..615dbc9ac7 100644 --- a/src/frontends/qt4/GuiWrap.cpp +++ b/src/frontends/qt4/GuiWrap.cpp @@ -32,11 +32,10 @@ namespace lyx { namespace frontend { GuiWrap::GuiWrap(LyXView & lv) - : GuiDialog(lv, "wrap"), Controller(this) + : GuiDialog(lv, "wrap") { setupUi(this); setViewTitle(_("Wrap Float Settings")); - setController(this, false); connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore())); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); diff --git a/src/frontends/qt4/GuiWrap.h b/src/frontends/qt4/GuiWrap.h index e066b7466d..151d2e1be1 100644 --- a/src/frontends/qt4/GuiWrap.h +++ b/src/frontends/qt4/GuiWrap.h @@ -19,7 +19,7 @@ namespace lyx { namespace frontend { -class GuiWrap : public GuiDialog, public Ui::WrapUi, public Controller +class GuiWrap : public GuiDialog, public Ui::WrapUi { Q_OBJECT @@ -31,8 +31,6 @@ private Q_SLOTS: private: void closeEvent(QCloseEvent * e); - /// parent controller - Controller & controller() { return *this; } /// Apply changes void applyView(); /// update diff --git a/src/frontends/qt4/Makefile.am b/src/frontends/qt4/Makefile.am index 5e1eda8f6a..ceab677890 100644 --- a/src/frontends/qt4/Makefile.am +++ b/src/frontends/qt4/Makefile.am @@ -141,6 +141,7 @@ NOMOCHEADER = \ GuiFontLoader.h \ GuiFontMetrics.h \ GuiImage.h \ + GuiMath.h \ GuiPainter.h \ GuiToolbars.h \ qt_helpers.h @@ -182,7 +183,6 @@ MOCHEADER = \ GuiKeySymbol.h \ GuiListings.h \ GuiLog.h \ - GuiMath.h \ GuiMathMatrix.h \ GuiMenubar.h \ GuiNomencl.h \