From 604c1148ea8beedaebbe0bdbe5a0adc76237a697 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Sun, 9 Dec 2007 22:35:04 +0000 Subject: [PATCH] Factorize general code out of GuiDialog and into the base Dialog class. This is now possible thanks to the moving of Dialog.{cpp,h} to qt4/. Any dialog must inherit QWidget within Qt so it is safe to use Dialog::asQWidget() method (which is similar to dynamic casting). * GuiDialog now inherits DialogView. GuiDialog is only there to bring the ButtonController archaeological interface; any new dialog should inherit DialogView and any new dock widget should inherit DockView. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22049 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/Dialog.cpp | 119 +++++++++++++++++++ src/frontends/qt4/Dialog.h | 32 +++--- src/frontends/qt4/DialogView.cpp | 57 +++++++++ src/frontends/qt4/DialogView.h | 107 +++++------------ src/frontends/qt4/DockView.h | 21 +--- src/frontends/qt4/GuiCitation.cpp | 24 +--- src/frontends/qt4/GuiCitation.h | 8 +- src/frontends/qt4/GuiDialog.cpp | 172 +++------------------------- src/frontends/qt4/GuiDialog.h | 44 +------ src/frontends/qt4/GuiParagraph.cpp | 12 +- src/frontends/qt4/GuiParagraph.h | 46 +------- src/frontends/qt4/GuiSearch.cpp | 5 +- src/frontends/qt4/GuiSearch.h | 2 +- src/frontends/qt4/GuiView.cpp | 8 +- src/frontends/qt4/Makefile.am | 3 +- src/frontends/qt4/ui/ParagraphUi.ui | 2 +- 16 files changed, 268 insertions(+), 394 deletions(-) create mode 100644 src/frontends/qt4/DialogView.cpp diff --git a/src/frontends/qt4/Dialog.cpp b/src/frontends/qt4/Dialog.cpp index 3ecfa94752..27af0d11d7 100644 --- a/src/frontends/qt4/Dialog.cpp +++ b/src/frontends/qt4/Dialog.cpp @@ -19,8 +19,12 @@ #include "FuncStatus.h" #include "LyXFunc.h" +#include "support/Debug.h" + #include +using namespace std; + namespace lyx { namespace frontend { @@ -122,5 +126,120 @@ Buffer const & Dialog::buffer() const return *lyxview_->buffer(); } + +void Dialog::showData(string const & data) +{ + if (isBufferDependent() && !isBufferAvailable()) + return; + + if (!initialiseParams(data)) { + LYXERR0("Dialog \"" << name() + << "\" failed to translate the data string passed to show()"); + return; + } + + showView(); +} + + +void Dialog::apply() +{ + if (isBufferDependent()) { + if (!isBufferAvailable() || + (isBufferReadonly() && !canApplyToReadOnly())) + return; + } + + applyView(); + dispatchParams(); + + if (disconnectOnApply() && !isClosing()) { + disconnect(); + initialiseParams(string()); + updateView(); + } +} + + +void Dialog::updateData(string const & data) +{ + if (isBufferDependent() && !isBufferAvailable()) + return; + + if (!initialiseParams(data)) { + LYXERR0("Dialog \"" << name() + << "\" could not be initialized"); + return; + } + + updateView(); +} + + +void Dialog::showView() +{ + updateView(); // make sure its up-to-date + if (exitEarly()) + return; + + QWidget * w = asQWidget(); + QSize const hint = w->sizeHint(); + if (hint.height() >= 0 && hint.width() >= 0) + w->setMinimumSize(hint); + + if (w->isVisible()) { + w->raise(); + w->activateWindow(); + } else + w->show(); + + w->setFocus(); +} + + +void Dialog::hideView() +{ + QWidget * w = asQWidget(); + if (!w->isVisible()) + return; + clearParams(); + disconnect(); + w->hide(); +} + + +bool Dialog::isVisibleView() const +{ + return asQWidget()->isVisible(); +} + + +void Dialog::checkStatus() +{ + // buffer independant dialogs are always active. + // This check allows us leave canApply unimplemented for some dialogs. + if (!isBufferDependent()) + return; + + // deactivate the dialog if we have no buffer + if (!isBufferAvailable()) { + enableView(false); + return; + } + + // check whether this dialog may be active + if (canApply()) { + bool const readonly = isBufferReadonly(); + enableView(!readonly); + // refreshReadOnly() is too generous in _enabling_ widgets + // update dialog to disable disabled widgets again + + if (!readonly || canApplyToReadOnly()) + updateView(); + + } else + enableView(false); +} + } // namespace frontend } // namespace lyx diff --git a/src/frontends/qt4/Dialog.h b/src/frontends/qt4/Dialog.h index 2861eb0241..64dd730086 100644 --- a/src/frontends/qt4/Dialog.h +++ b/src/frontends/qt4/Dialog.h @@ -16,6 +16,8 @@ #include +class QWidget; + namespace lyx { class Buffer; @@ -51,6 +53,9 @@ public: virtual ~Dialog(); + virtual QWidget * asQWidget() = 0; + virtual QWidget const * asQWidget() const = 0; + /** \name Container Access * These methods are publicly accessible because they are invoked * by the parent container acting on commands from the LyX kernel. @@ -58,30 +63,21 @@ public: //@{ /// \param data is a string encoding of the data to be displayed. /// It is passed to the Controller to be translated into a useable form. - virtual void showData(std::string const & /*data*/) {} - virtual void updateData(std::string const & /*data*/) {} - - virtual void hide() {} - + virtual void showData(std::string const & data); + virtual void updateData(std::string const & data); //@} /** Check whether we may apply our data. * * The buttons are disabled if not and (re-)enabled if yes. */ - virtual void checkStatus() {} + virtual void checkStatus(); /** When applying, it's useful to know whether the dialog is about * to close or not (no point refreshing the display for example). */ virtual bool isClosing() const { return false; } - - /** \c Button controller part - */ - virtual void setButtonsValid(bool /*valid*/) {} - - /** \c View part * of a Model-Controller-View split of a generic dialog. * These few methods are all that a generic dialog needs of a @@ -95,16 +91,20 @@ public: virtual void applyView() = 0; /// Hide the dialog from sight - virtual void hideView() = 0; + void hideView(); /// Create the dialog if necessary, update it and display it. - virtual void showView() = 0; + void showView(); /// Update the display of the dialog whilst it is still visible. virtual void updateView() = 0; + // Default Implementation does nothing. + // Each dialog has to choose what control to enable or disable. + virtual void enableView(bool /*enable*/) {} + /// \return true if the dialog is visible. - virtual bool isVisibleView() const = 0; + virtual bool isVisibleView() const; //@} /// Dialog identifier. @@ -230,7 +230,7 @@ public: //@} protected: - virtual void apply() {} + virtual void apply(); private: /** The Dialog's name is the means by which a dialog identifies diff --git a/src/frontends/qt4/DialogView.cpp b/src/frontends/qt4/DialogView.cpp new file mode 100644 index 0000000000..b193bca2ae --- /dev/null +++ b/src/frontends/qt4/DialogView.cpp @@ -0,0 +1,57 @@ +/** + * \file Dialog.cpp + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Angus Leeming + * + * Full author contact details are available in file CREDITS. + */ + +#include + +#include "DialogView.h" + +#include "GuiView.h" +#include "qt_helpers.h" + +#include +#include +#include + + +namespace lyx { +namespace frontend { + +DialogView::DialogView(GuiView & lv, std::string const & name) + : QDialog(&lv), Dialog(lv, name) +{} + + +void DialogView::setViewTitle(docstring const & title) +{ + setWindowTitle("LyX: " + toqstr(title)); +} + + +void DialogView::showEvent(QShowEvent * e) +{ + QSettings settings; + QString key = toqstr(name()) + "/geometry"; + restoreGeometry(settings.value(key).toByteArray()); + QDialog::showEvent(e); +} + + +void DialogView::closeEvent(QCloseEvent * e) +{ + QSettings settings; + QString key = toqstr(name()) + "/geometry"; + settings.setValue(key, saveGeometry()); + QDialog::closeEvent(e); +} + +} // namespace frontend +} // namespace lyx + +#include "DialogView_moc.cpp" diff --git a/src/frontends/qt4/DialogView.h b/src/frontends/qt4/DialogView.h index e255b3bc86..36f3ef2f08 100644 --- a/src/frontends/qt4/DialogView.h +++ b/src/frontends/qt4/DialogView.h @@ -9,102 +9,47 @@ * Full author contact details are available in file CREDITS. */ -#ifndef DIALOG_VIEW_H -#define DIALOG_VIEW_H +#ifndef DIALOGVIEW_H +#define DIALOGVIEW_H #include "Dialog.h" -#include "GuiView.h" -#include "qt_helpers.h" -#include "support/debug.h" -#include #include -#include -#include -#include -#include +class QCloseEvent; +class QShowEvent; namespace lyx { 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 +/** \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: - DialogView( - GuiView & parent, ///< the main window where to dock. - std::string const & name, ///< dialog identifier. - bool modal = false, ///< Window modality. - Qt::WindowFlags flags = 0 - ) - : QDialog(&parent, flags), Dialog(parent, name) - { - setModal(modal); - QGridLayout * gridLayout = new QGridLayout(this); - gridLayout->setMargin(0); - widget_ = new MyWidget(*this, this); - gridLayout->addWidget(widget_); - setWindowTitle("LyX: " + widget_->windowTitle()); - } + /// \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() {} - /// Dialog inherited methods - //@{ - void applyView() {} - void hideView() - { - clearParams(); - QDialog::hide(); - } - void showData(std::string const & data) - { - initialiseParams(data); - showView(); - } - void showView() - { - widget_->updateView(); // make sure its up-to-date - QDialog::show(); - raise(); - activateWindow(); - } - bool isVisibleView() const { return QDialog::isVisible(); } - void checkStatus() { updateView(); } - void updateData(std::string const & data) - { - initialiseParams(data); - updateView(); - } - void updateView() - { - widget_->updateView(); - } - //@} -private: - /// The encapsulated widget. - MyWidget * widget_; + virtual QWidget * asQWidget() { return this; } + virtual QWidget const * asQWidget() const { return this; } - void showEvent(QShowEvent * e) - { - QSettings settings; - std::string key = name() + "/geometry"; - QDialog::restoreGeometry(settings.value(key.c_str()).toByteArray()); - QDialog::showEvent(e); - } +public: + /// + void setViewTitle(docstring const & title); - void closeEvent(QCloseEvent * e) - { - QSettings settings; - std::string key = name() + "/geometry"; - settings.setValue(key.c_str(), QDialog::saveGeometry()); - QDialog::closeEvent(e); - } + /// + void closeEvent(QCloseEvent *); + /// + void showEvent(QShowEvent *); }; -} // frontend -} // lyx +} // namespace frontend +} // namespace lyx -#endif // DIALOG_VIEW_H +#endif // DIALOGVIEW_H diff --git a/src/frontends/qt4/DockView.h b/src/frontends/qt4/DockView.h index 9f2563d687..3f0bd2347a 100644 --- a/src/frontends/qt4/DockView.h +++ b/src/frontends/qt4/DockView.h @@ -43,27 +43,12 @@ public: virtual ~DockView() {} + virtual QWidget * asQWidget() { return this; } + virtual QWidget const * asQWidget() const { return this; } + /// Dialog inherited methods //@{ void applyView() {} - void hideView() { QDockWidget::hide(); } - void showData(std::string const & data) - { - initialiseParams(data); - showView(); - } - void showView() - { - updateView(); // make sure its up-to-date - QDockWidget::show(); - } - bool isVisibleView() const { return QDockWidget::isVisible(); } - void checkStatus() { updateView(); } - void updateData(std::string const & data) - { - initialiseParams(data); - updateView(); - } bool isClosing() const { return false; } //@} }; diff --git a/src/frontends/qt4/GuiCitation.cpp b/src/frontends/qt4/GuiCitation.cpp index a1f7067e84..7e6470b963 100644 --- a/src/frontends/qt4/GuiCitation.cpp +++ b/src/frontends/qt4/GuiCitation.cpp @@ -30,6 +30,7 @@ #include #include +#include #undef KeyPress @@ -138,27 +139,12 @@ void GuiCitation::applyView() } -void GuiCitation::hideView() -{ - clearParams(); - accept(); -} - - -void GuiCitation::showView() +void GuiCitation::showEvent(QShowEvent * e) { init(); findLE->clear(); availableLV->setFocus(); - QDialog::show(); - raise(); - activateWindow(); -} - - -bool GuiCitation::isVisibleView() const -{ - return QDialog::isVisible(); + GuiDialog::showEvent(e); } @@ -166,14 +152,14 @@ void GuiCitation::on_okPB_clicked() { applyView(); clearSelection(); - hideView(); + hide(); } void GuiCitation::on_cancelPB_clicked() { clearSelection(); - hideView(); + hide(); } diff --git a/src/frontends/qt4/GuiCitation.h b/src/frontends/qt4/GuiCitation.h index de2655a453..9b9a867fc7 100644 --- a/src/frontends/qt4/GuiCitation.h +++ b/src/frontends/qt4/GuiCitation.h @@ -38,18 +38,14 @@ public: /// void applyView(); - /// Hide the dialog from sight - void hideView(); - /// Create the dialog if necessary, update it and display it. - void showView(); - /// \return true if the dialog is visible. - bool isVisibleView() const; public Q_SLOTS: /// Update the display of the dialog whilst it is still visible. void updateView(); private: + /// + void showEvent(QShowEvent * e); /// void closeEvent(QCloseEvent * e); /// prepares a call to GuiCitation::searchKeys when we diff --git a/src/frontends/qt4/GuiDialog.cpp b/src/frontends/qt4/GuiDialog.cpp index 9b70bccf08..f62754b2e6 100644 --- a/src/frontends/qt4/GuiDialog.cpp +++ b/src/frontends/qt4/GuiDialog.cpp @@ -12,9 +12,10 @@ #include "GuiDialog.h" #include "GuiView.h" -#include "support/debug.h" #include "qt_helpers.h" +#include "support/debug.h" + #include #include #include @@ -26,21 +27,10 @@ namespace lyx { namespace frontend { GuiDialog::GuiDialog(GuiView & lv, std::string const & name) - : QDialog(&lv), Dialog(lv, name), is_closing_(false) + : DialogView(lv, name), is_closing_(false) {} -GuiDialog::~GuiDialog() -{ -} - - -void GuiDialog::setViewTitle(docstring const & title) -{ - setWindowTitle("LyX: " + toqstr(title)); -} - - void GuiDialog::setButtonsValid(bool valid) { bc().setValid(valid); @@ -49,7 +39,7 @@ void GuiDialog::setButtonsValid(bool valid) void GuiDialog::slotApply() { - apply(); + applyView(); bc().apply(); } @@ -57,7 +47,7 @@ void GuiDialog::slotApply() void GuiDialog::slotOK() { is_closing_ = true; - apply(); + applyView(); is_closing_ = false; QDialog::hide(); bc().ok(); @@ -80,72 +70,20 @@ void GuiDialog::slotRestore() bc().restore(); } -void GuiDialog::checkStatus() -{ - // buffer independant dialogs are always active. - // This check allows us leave canApply unimplemented for some dialogs. - if (!isBufferDependent()) - return; - - // deactivate the dialog if we have no buffer - if (!isBufferAvailable()) { - bc().setReadOnly(true); - return; - } - - // check whether this dialog may be active - 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 || canApplyToReadOnly()) - updateView(); - - } else { - bc().setReadOnly(true); - } -} - - -bool GuiDialog::isVisibleView() const -{ - return QDialog::isVisible(); -} - -void GuiDialog::showView() +void GuiDialog::changed() { - QSize const hint = sizeHint(); - if (hint.height() >= 0 && hint.width() >= 0) - setMinimumSize(hint); - - updateView(); // make sure its up-to-date - if (exitEarly()) + if (updating_) return; - - if (QWidget::isVisible()) { - raise(); - activateWindow(); - } else { - QWidget::show(); - } - setFocus(); -} - - -void GuiDialog::hideView() -{ - QDialog::hide(); + bc().setValid(isValid()); } -void GuiDialog::changed() +void GuiDialog::enableView(bool enable) { - if (updating_) - return; - bc().setValid(isValid()); + bc().setReadOnly(!enable); + bc().setValid(enable); + DialogView::enableView(enable); } @@ -153,97 +91,15 @@ void GuiDialog::updateView() { setUpdatesEnabled(false); + bc().setReadOnly(isBufferReadonly()); // protect the BC from unwarranted state transitions updating_ = true; updateContents(); updating_ = false; - - setUpdatesEnabled(true); - QDialog::update(); -} - - -void GuiDialog::showData(string const & data) -{ - if (isBufferDependent() && !isBufferAvailable()) - return; - - if (!initialiseParams(data)) { - LYXERR0("Dialog \"" << name() - << "\" failed to translate the data string passed to show()"); - return; - } - - bc().setReadOnly(isBufferReadonly()); - showView(); - // The widgets may not be valid, so refresh the button controller - bc().refresh(); -} - - -void GuiDialog::updateData(string const & data) -{ - if (isBufferDependent() && !isBufferAvailable()) - return; - - if (!initialiseParams(data)) { - LYXERR0("Dialog \"" << name() - << "\" could not be initialized"); - return; - } - - bc().setReadOnly(isBufferReadonly()); - updateView(); // The widgets may not be valid, so refresh the button controller bc().refresh(); -} - - -void GuiDialog::hide() -{ - if (!isVisibleView()) - return; - clearParams(); - hideView(); - Dialog::disconnect(); -} - - -void GuiDialog::apply() -{ - if (isBufferDependent()) { - if (!isBufferAvailable() || - (isBufferReadonly() && !canApplyToReadOnly())) - return; - } - - applyView(); - dispatchParams(); - - if (disconnectOnApply() && !is_closing_) { - Dialog::disconnect(); - initialiseParams(string()); - updateView(); - } -} - - -void GuiDialog::showEvent(QShowEvent * e) -{ - QSettings settings; - string key = name() + "/geometry"; - restoreGeometry(settings.value(key.c_str()).toByteArray()); - QDialog::showEvent(e); -} - - -void GuiDialog::closeEvent(QCloseEvent * e) -{ - QSettings settings; - string key = name() + "/geometry"; - settings.setValue(key.c_str(), saveGeometry()); - QDialog::closeEvent(e); + setUpdatesEnabled(true); } } // namespace frontend diff --git a/src/frontends/qt4/GuiDialog.h b/src/frontends/qt4/GuiDialog.h index 977e361fa3..76889b5ccb 100644 --- a/src/frontends/qt4/GuiDialog.h +++ b/src/frontends/qt4/GuiDialog.h @@ -12,24 +12,18 @@ #ifndef GUIDIALOG_H #define GUIDIALOG_H -#include "Dialog.h" +#include "DialogView.h" #include "ButtonController.h" #include "insets/InsetCommandParams.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 GuiDialog : public QDialog, public Dialog +class GuiDialog : public DialogView { Q_OBJECT @@ -38,7 +32,6 @@ public: /// \param name is the identifier given to the dialog by its parent /// container. explicit GuiDialog(GuiView & lv, std::string const & name); - ~GuiDialog(); public Q_SLOTS: /** \name Buttons @@ -59,7 +52,6 @@ public: * * The buttons are disabled if not and (re-)enabled if yes. */ - void checkStatus(); void setButtonsValid(bool valid); /** \name Dialog Components @@ -70,53 +62,27 @@ public: ButtonController & bc() { return bc_; } //@} - void setViewTitle(docstring const & title); - - /// the dialog has changed contents virtual void changed(); + virtual void enableView(bool enable); + /// default: do nothing virtual void applyView() {} /// default: do nothing virtual void updateContents() {} - /// - void closeEvent(QCloseEvent *); - /// - void showEvent(QShowEvent *); -protected: - /// Hide the dialog. - virtual void hideView(); - /// Create the dialog if necessary, update it and display it. - virtual void showView(); - /// - virtual bool isVisibleView() const; +public: /// is the dialog currently valid ? virtual bool isValid() { return true; } public: - /** \name Container Access - * These methods are publicly accessible because they are invoked - * by the parent container acting on commands from the LyX kernel. - */ - //@{ - /// \param data is a string encoding of the data to be displayed. - /// It is passed to the Controller to be translated into a useable form. - void showData(std::string const & data); - void updateData(std::string const & data); - - void hide(); - - //@} /** When applying, it's useful to know whether the dialog is about * to close or not (no point refreshing the display for example). */ bool isClosing() const { return is_closing_; } - void apply(); - /// Update the display of the dialog whilst it is still visible. virtual void updateView(); diff --git a/src/frontends/qt4/GuiParagraph.cpp b/src/frontends/qt4/GuiParagraph.cpp index d0c2faac87..7e785a54d2 100644 --- a/src/frontends/qt4/GuiParagraph.cpp +++ b/src/frontends/qt4/GuiParagraph.cpp @@ -48,16 +48,11 @@ namespace lyx { namespace frontend { GuiParagraph::GuiParagraph(GuiView & lv) - : Dialog(lv, "paragraph") + : DialogView(lv, "paragraph") { setupUi(this); setWindowTitle(qt_("Paragraph Settings")); - //setModal(modal); - QGridLayout * gridLayout = new QGridLayout(this); - gridLayout->setMargin(0); - gridLayout->addWidget(this); - connect(alignDefaultRB, SIGNAL(clicked()), this, SLOT(changed())); connect(alignJustRB, SIGNAL(clicked()), this, SLOT(changed())); connect(alignLeftRB, SIGNAL(clicked()), this, SLOT(changed())); @@ -210,6 +205,11 @@ void GuiParagraph::on_restorePB_clicked() } +void GuiParagraph::enableView(bool enable) +{ +} + + void GuiParagraph::updateView() { on_synchronizedViewCB_toggled(); diff --git a/src/frontends/qt4/GuiParagraph.h b/src/frontends/qt4/GuiParagraph.h index a5e8a4f0c6..feddbbd709 100644 --- a/src/frontends/qt4/GuiParagraph.h +++ b/src/frontends/qt4/GuiParagraph.h @@ -19,7 +19,7 @@ #include "Layout.h" #include "ui_ParagraphUi.h" -#include "Dialog.h" +#include "DialogView.h" #include "ParagraphParameters.h" #include "GuiView.h" #include "qt_helpers.h" @@ -38,7 +38,7 @@ namespace lyx { namespace frontend { class GuiParagraph - : public QDialog, public Ui::ParagraphUi, public Dialog + : public DialogView, public Ui::ParagraphUi { Q_OBJECT public: @@ -63,51 +63,13 @@ private: QString const alignDefaultLabel; void applyView() {} - void hideView() - { - clearParams(); - QDialog::hide(); - } - void showData(std::string const & data) - { - initialiseParams(data); - showView(); - } - void showView() - { - updateView(); // make sure its up-to-date - QDialog::show(); - raise(); - activateWindow(); - } - bool isVisibleView() const { return QDialog::isVisible(); } - void checkStatus() { updateView(); } - void updateData(std::string const & data) - { - initialiseParams(data); - updateView(); - } + void enableView(bool enable); + std::string name() const { return "paragraph"; } private: QString name_; - void showEvent(QShowEvent * e) - { - QSettings settings; - QString key = name_ + "/geometry"; - QDialog::restoreGeometry(settings.value(key).toByteArray()); - QDialog::showEvent(e); - } - - void closeEvent(QCloseEvent * e) - { - QSettings settings; - QString key = name_ + "/geometry"; - settings.setValue(key, QDialog::saveGeometry()); - QDialog::closeEvent(e); - } - private Q_SLOTS: /// void changed(); diff --git a/src/frontends/qt4/GuiSearch.cpp b/src/frontends/qt4/GuiSearch.cpp index ee6bdfda72..6039c20a59 100644 --- a/src/frontends/qt4/GuiSearch.cpp +++ b/src/frontends/qt4/GuiSearch.cpp @@ -21,6 +21,7 @@ #include #include +#include using std::string; @@ -64,10 +65,10 @@ GuiSearch::GuiSearch(GuiView & lv) } -void GuiSearch::showView() +void GuiSearch::showEvent(QShowEvent * e) { findCO->lineEdit()->selectAll(); - GuiDialog::showView(); + GuiDialog::showEvent(e); } diff --git a/src/frontends/qt4/GuiSearch.h b/src/frontends/qt4/GuiSearch.h index 9f6f0d969a..85ea64843e 100644 --- a/src/frontends/qt4/GuiSearch.h +++ b/src/frontends/qt4/GuiSearch.h @@ -33,7 +33,7 @@ private Q_SLOTS: void replaceallClicked(); private: - void showView(); + void showEvent(QShowEvent * e); void closeEvent(QCloseEvent * e); /// bool initialiseParams(std::string const &) { return true; } diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 5752fb8948..f2c7ced203 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -1668,7 +1668,7 @@ void GuiView::hideDialog(string const & name, Inset * inset) Dialog * const dialog = it->second.get(); if (dialog->isVisibleView()) - dialog->hide(); + dialog->hideView(); d.open_insets_[name] = 0; } @@ -1699,7 +1699,7 @@ void GuiView::hideAll() const std::map::const_iterator end = d.dialogs_.end(); for(; it != end; ++it) - it->second->hide(); + it->second->hideView(); } @@ -1711,7 +1711,7 @@ void GuiView::hideBufferDependent() const for(; it != end; ++it) { Dialog * dialog = it->second.get(); if (dialog->isBufferDependent()) - dialog->hide(); + dialog->hideView(); } } @@ -1729,7 +1729,7 @@ void GuiView::updateBufferDependent(bool switched) const if (dialog->initialiseParams("")) dialog->updateView(); else - dialog->hide(); + dialog->hideView(); } else { // A bit clunky, but the dialog will request // that the kernel provides it with the necessary diff --git a/src/frontends/qt4/Makefile.am b/src/frontends/qt4/Makefile.am index 8fc0edf271..965357cbeb 100644 --- a/src/frontends/qt4/Makefile.am +++ b/src/frontends/qt4/Makefile.am @@ -50,6 +50,7 @@ SOURCEFILES = \ ButtonPolicy.h \ Dialog.cpp \ Dialog.h \ + DialogView.cpp \ Resources.cpp \ Action.cpp \ BulletsModule.cpp \ @@ -135,7 +136,6 @@ SOURCEFILES = \ NOMOCHEADER = \ ButtonController.h \ - DialogView.h \ GuiFontLoader.h \ GuiFontMetrics.h \ GuiImage.h \ @@ -149,6 +149,7 @@ MOCHEADER = \ BulletsModule.h \ ColorCache.h \ CustomizedWidgets.h \ + DialogView.h \ DockView.h \ EmptyTable.h \ FloatPlacement.h \ diff --git a/src/frontends/qt4/ui/ParagraphUi.ui b/src/frontends/qt4/ui/ParagraphUi.ui index bd72e92066..eeb03e5dd9 100644 --- a/src/frontends/qt4/ui/ParagraphUi.ui +++ b/src/frontends/qt4/ui/ParagraphUi.ui @@ -1,6 +1,6 @@ ParagraphUi - + 0 -- 2.39.2