move Controller inheritance further up the tree

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20870 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2007-10-09 19:34:27 +00:00
parent 5a2deb94c3
commit 6f3cdf8da8
66 changed files with 113 additions and 234 deletions

View File

@ -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());
}

View File

@ -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);
}

View File

@ -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()));

View File

@ -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

View File

@ -74,11 +74,10 @@ void box_gui_tokens_special_length(vector<string> & 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_);

View File

@ -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

View File

@ -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()));

View File

@ -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

View File

@ -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()));

View File

@ -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.

View File

@ -273,11 +273,10 @@ static vector<FamilyPair> 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()));

View File

@ -48,7 +48,7 @@ typedef std::pair<QString, Font::FONT_SIZE> SizePair;
typedef std::pair<QString, FontState> BarPair;
typedef std::pair<QString, Color_color> 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

View File

@ -74,7 +74,6 @@ GuiDelimiter::GuiDelimiter(LyXView & lv)
{
setupUi(this);
setViewTitle(_("Math Delimiter"));
setController(this, false);
connect(closePB, SIGNAL(clicked()), this, SLOT(accept()));

View File

@ -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);
}

View File

@ -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.

View File

@ -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));

View File

@ -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<std::string> lang_;
/// parent controller
Controller & controller() { return *this; }
/// Available modules
QStringListModel * availableModel() { return &available_model_; }
/// Selected modules

View File

@ -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()));

View File

@ -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

View File

@ -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()));

View File

@ -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();
///

View File

@ -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()));

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -135,11 +135,10 @@ getSecond(vector<Pair> 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()));

View File

@ -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();

View File

@ -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()));

View File

@ -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

View File

@ -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()));

View File

@ -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

View File

@ -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()));

View File

@ -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() {}

View File

@ -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

View File

@ -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;

View File

@ -33,7 +33,6 @@ GuiMathMatrix::GuiMathMatrix(LyXView & lv)
{
setupUi(this);
setViewTitle(_("Math Matrix"));
setController(this, false);
table->setMinimumSize(100, 100);
rowsSB->setValue(5);

View File

@ -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()));

View File

@ -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

View File

@ -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()));

View File

@ -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);

View File

@ -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?)

View File

@ -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()));

View File

@ -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

View File

@ -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;
}
}
if (foundItem)
last_reference_ = textToFind;
else last_reference_ = "";
break;
}
}
}
refsLW->setUpdatesEnabled(true);
refsLW->update();

View File

@ -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<Controller*>(this); }
///
bool isValid();
/// apply changes

View File

@ -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);

View File

@ -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() {}

View File

@ -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()));

View File

@ -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

View File

@ -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()));

View File

@ -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();
///

View File

@ -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()));

View File

@ -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();

View File

@ -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));

View File

@ -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

View File

@ -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);

View File

@ -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();

View File

@ -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;

View File

@ -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
@ -52,8 +52,6 @@ private:
///
void closeEvent(QCloseEvent * e);
///
Controller & controller() { return *this; }
///
void updateStyles(TexFileType);
///
void updateStyles();

View File

@ -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();

View File

@ -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();
///

View File

@ -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()));

View File

@ -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

View File

@ -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()));

View File

@ -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

View File

@ -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 \