2007-09-03 05:59:32 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
|
|
|
* \file GuiDialog.h
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GUIDIALOG_H
|
|
|
|
#define GUIDIALOG_H
|
|
|
|
|
2008-02-05 10:53:31 +00:00
|
|
|
#include "Dialog.h"
|
2007-09-03 05:59:32 +00:00
|
|
|
#include "ButtonController.h"
|
|
|
|
|
2008-02-05 10:53:31 +00:00
|
|
|
#include <QDialog>
|
|
|
|
|
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2008-02-05 10:53:31 +00:00
|
|
|
/// Base class for historical LyX dialogs.
|
|
|
|
/**
|
|
|
|
* \warning New dialogs should use the leaner classes \c DialogView or
|
|
|
|
* \c DockView depending on the intent. Eventally, old dialog should be
|
|
|
|
* converted to \c DialogView too.
|
|
|
|
*/
|
|
|
|
class GuiDialog : public QDialog, public Dialog
|
2007-09-03 05:59:32 +00:00
|
|
|
{
|
2007-09-05 20:33:29 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
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.
|
2008-02-05 12:43:19 +00:00
|
|
|
/// \param title is the window title used for decoration.
|
2008-03-05 20:11:47 +00:00
|
|
|
GuiDialog(GuiView & lv, QString const & name, QString const & title);
|
2007-09-05 20:33:29 +00:00
|
|
|
|
2008-02-05 10:53:31 +00:00
|
|
|
virtual QWidget * asQWidget() { return this; }
|
|
|
|
virtual QWidget const * asQWidget() const { return this; }
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
public Q_SLOTS:
|
2007-09-11 17:06:15 +00:00
|
|
|
/** \name Buttons
|
|
|
|
* These methods are publicly accessible because they are invoked
|
|
|
|
* by the View when the user presses... guess what ;-)
|
|
|
|
*/
|
2007-09-05 20:33:29 +00:00
|
|
|
// Restore button clicked
|
|
|
|
void slotRestore();
|
|
|
|
// OK button clicked
|
|
|
|
void slotOK();
|
|
|
|
// Apply button clicked
|
|
|
|
void slotApply();
|
2009-01-18 14:33:51 +00:00
|
|
|
// AutoApply checkbox clicked
|
|
|
|
void slotAutoApply();
|
2007-09-11 17:06:15 +00:00
|
|
|
// Close button clicked or closed from WindowManager
|
2007-09-05 20:33:29 +00:00
|
|
|
void slotClose();
|
2008-02-17 20:16:14 +00:00
|
|
|
///
|
|
|
|
void closeEvent(QCloseEvent * e);
|
2007-09-03 05:59:32 +00:00
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
public:
|
2007-09-03 05:59:32 +00:00
|
|
|
/** Check whether we may apply our data.
|
|
|
|
*
|
|
|
|
* The buttons are disabled if not and (re-)enabled if yes.
|
|
|
|
*/
|
|
|
|
void setButtonsValid(bool valid);
|
|
|
|
|
|
|
|
/** \name Dialog Components
|
|
|
|
* Methods to access the various components making up a dialog.
|
|
|
|
*/
|
|
|
|
//@{
|
|
|
|
ButtonController const & bc() const { return bc_; }
|
|
|
|
ButtonController & bc() { return bc_; }
|
|
|
|
//@}
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
/// the dialog has changed contents
|
|
|
|
virtual void changed();
|
|
|
|
|
2007-12-09 22:35:04 +00:00
|
|
|
virtual void enableView(bool enable);
|
|
|
|
|
2007-09-05 20:33:29 +00:00
|
|
|
/// default: do nothing
|
|
|
|
virtual void applyView() {}
|
|
|
|
/// default: do nothing
|
2007-09-11 18:33:42 +00:00
|
|
|
virtual void updateContents() {}
|
2007-09-28 09:45:50 +00:00
|
|
|
|
2007-12-09 22:35:04 +00:00
|
|
|
public:
|
2007-09-05 20:33:29 +00:00
|
|
|
/// is the dialog currently valid ?
|
2007-09-10 22:32:59 +00:00
|
|
|
virtual bool isValid() { return true; }
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/** 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_; }
|
Fix bug #6451 (last part): Crash when interacting with buffer-dependent dialog with no buffer open.
- First, the comment for isBufferDependent is corrected. It seems that the actual use of this function differs from the comment. As the comment said, I decided to close all dialogs that were buffer dependent, but this didn't seem to be correct for the view source pan, the outliner, and find-and-replace.
- Second, the dialogs that are buffer dependent are now closed, but dockviews are not, except for the spellchecker pane, which really depends on an open buffer, but I can't test that.
So, please test whether the spellchecker dockviewed window behaves as one expects.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34291 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-26 02:12:10 +00:00
|
|
|
|
|
|
|
///
|
|
|
|
bool needBufferOpen() const { return isBufferDependent(); }
|
2007-09-10 22:32:59 +00:00
|
|
|
|
|
|
|
/// Update the display of the dialog whilst it is still visible.
|
2007-09-05 20:33:29 +00:00
|
|
|
virtual void updateView();
|
|
|
|
|
2007-10-09 21:21:01 +00:00
|
|
|
private:
|
2007-09-03 05:59:32 +00:00
|
|
|
ButtonController bc_;
|
2007-09-05 20:33:29 +00:00
|
|
|
/// are we updating ?
|
|
|
|
bool updating_;
|
2007-09-10 22:32:59 +00:00
|
|
|
|
|
|
|
bool is_closing_;
|
2007-09-03 05:59:32 +00:00
|
|
|
};
|
|
|
|
|
2007-10-07 14:41:49 +00:00
|
|
|
|
2007-09-03 05:59:32 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
|
|
#endif // GUIDIALOG_H
|