X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FDialog.h;h=5f958e79d0d835a552354de0cf7a704437b913c6;hb=b7f6b979d0f889f08e735f35378bb20ba3788b4b;hp=cc76f93c22f1120b5e963f4269771b867d241039;hpb=1c188f022cf5f2bad4a088d60e87d86e4834fcf2;p=lyx.git diff --git a/src/frontends/qt4/Dialog.h b/src/frontends/qt4/Dialog.h index cc76f93c22..5f958e79d0 100644 --- a/src/frontends/qt4/Dialog.h +++ b/src/frontends/qt4/Dialog.h @@ -18,11 +18,10 @@ #include "support/strfwd.h" -#include #include +class QSettings; class QWidget; -class QLineEdit; namespace lyx { @@ -46,32 +45,10 @@ enum KernelDocType DOCBOOK }; -/// CheckedLineEdit -// FIXME: Get rid of CheckedLineEdit in ButtonController and rename this one -// to it. -class CheckedLineEdit2 -{ -public: - CheckedLineEdit2(QLineEdit * input, QWidget * label = 0) - : input_(input), label_(label) - {} - /// - bool check() const; - -private: - // non-owned - QLineEdit * input_; - QWidget * label_; -}; - - -typedef QList CheckedLineEdits; - - /** \c Dialog collects the different parts of a Model-Controller-View * split of a generic dialog together. */ -class Dialog +class Dialog { public: /// \param lv is the access point for the dialog to the LyX kernel. @@ -85,9 +62,6 @@ public: virtual QWidget * asQWidget() = 0; virtual QWidget const * asQWidget() const = 0; - /// - void addCheckedWidget(QLineEdit * input, QWidget * label); - /// Session key. /** * This key must be used for any session setting. @@ -99,7 +73,7 @@ public: * This default implementation saves the geometry state. * Reimplement to save more settings. **/ - virtual void saveSession() const; + virtual void saveSession(QSettings & settings) const; /// Restore session settings. /** @@ -185,10 +159,15 @@ public: /// Enable the Controller to dispatch its data back to the LyX kernel. virtual void dispatchParams() = 0; + /** \return true if the dialog should be updated when the + * buffer has changed. + */ + virtual bool isBufferDependent() const = 0; + /** \return true if the dialog should be shown only when * a buffer is open. */ - virtual bool isBufferDependent() const = 0; + virtual bool needBufferOpen() const = 0; /** \return true if the dialog can apply data also * for ReadOnly buffers. @@ -261,7 +240,7 @@ public: //@{ bool isBufferAvailable() const; bool isBufferReadonly() const; - QString bufferFilepath() const; + QString bufferFilePath() const; //@} /// The type of the current buffer. @@ -272,8 +251,12 @@ public: * We should aim to reduce/remove these from the interface. */ //@{ - GuiView const & lyxview() const { return *lyxview_; } + GuiView const & lyxview() const { return lyxview_; } + /// Current buffer Buffer const & buffer() const; + /// Main document buffer + Buffer const & documentBuffer() const; + /// Current BufferView BufferView const * bufferview() const; //@} @@ -282,25 +265,22 @@ protected: void setTitle(QString const & title) { title_ = title; } /// virtual void apply(); - /// \return true if all CheckedWidgets are in a valid state. - bool checkWidgets() const; + /// To be called when the buffer view has changed + virtual void onBufferViewChanged() = 0; private: /** The Dialog's name is the means by which a dialog identifies - * itself to the LyXView. + * itself to the GuiView. */ QString const name_; /// QString title_; /// - GuiView * lyxview_; + GuiView & lyxview_; /// intentionally unimplemented, therefore uncopiable Dialog(Dialog const &); void operator=(Dialog const &); - - /// - CheckedLineEdits checked_line_edits_; };