Attempt to simplify as much as possible Inset parameter dialog creation. We now just need an ui file and a class that inherits InsetParamsWidget and implement 4 methods. Then InsetParamsDialog will take care of the rest. InsetParamsDialog has 2 running mode: "immediate apply" and "Restore/OK/Close" which is the default; I hope this is enough to satisfy all users. The checkbox status might be saved later in session settings.

This new attempt replace the previous attempt with InsetDialog which was still too tight with the older framework.
Status:
float, ert, box, info: migrated
vspace: migrated but buggy. To be fixed later.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33480 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2010-02-15 23:17:45 +00:00
parent 22e4332d2b
commit bbda43a400
28 changed files with 686 additions and 855 deletions

View File

@ -42,17 +42,6 @@ using namespace lyx::support;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
bool CheckedLineEdit2::check() const
{
bool const valid = input_->hasAcceptableInput();
// Visual feedback.
setValid(input_, valid);
if (label_)
setValid(label_, valid);
return valid;
}
Dialog::Dialog(GuiView & lv, QString const & name, QString const & title) Dialog::Dialog(GuiView & lv, QString const & name, QString const & title)
: name_(name), title_(title), lyxview_(&lv) : name_(name), title_(title), lyxview_(&lv)
{} {}
@ -62,21 +51,6 @@ Dialog::~Dialog()
{} {}
void Dialog::addCheckedWidget(QLineEdit * input, QWidget * label)
{
checked_line_edits_.append(CheckedLineEdit2(input, label));
}
bool Dialog::checkWidgets() const
{
bool valid = true;
Q_FOREACH(CheckedLineEdit2 const & le, checked_line_edits_)
valid &= le.check();
return valid;
}
bool Dialog::canApply() const bool Dialog::canApply() const
{ {
FuncRequest const fr(getLfun(), fromqstr(name_)); FuncRequest const fr(getLfun(), fromqstr(name_));

View File

@ -22,7 +22,6 @@
#include <QString> #include <QString>
class QWidget; class QWidget;
class QLineEdit;
namespace lyx { namespace lyx {
@ -46,28 +45,6 @@ enum KernelDocType
DOCBOOK 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<CheckedLineEdit2> CheckedLineEdits;
/** \c Dialog collects the different parts of a Model-Controller-View /** \c Dialog collects the different parts of a Model-Controller-View
* split of a generic dialog together. * split of a generic dialog together.
*/ */
@ -279,11 +256,6 @@ protected:
void setTitle(QString const & title) { title_ = title; } void setTitle(QString const & title) { title_ = title; }
/// ///
virtual void apply(); virtual void apply();
/// Add a widget to the list of all widgets whose validity should
/// be checked explicitly when the buttons are refreshed.
void addCheckedWidget(QLineEdit * input, QWidget * label = 0);
/// \return true if all CheckedWidgets are in a valid state.
bool checkWidgets() const;
private: private:
/** The Dialog's name is the means by which a dialog identifies /** The Dialog's name is the means by which a dialog identifies
@ -298,9 +270,6 @@ private:
/// intentionally unimplemented, therefore uncopiable /// intentionally unimplemented, therefore uncopiable
Dialog(Dialog const &); Dialog(Dialog const &);
void operator=(Dialog const &); void operator=(Dialog const &);
///
CheckedLineEdits checked_line_edits_;
}; };

View File

@ -27,8 +27,10 @@ using namespace lyx::support;
namespace lyx { namespace lyx {
namespace frontend {
FloatPlacement::FloatPlacement(bool show_options, QWidget * parent) FloatPlacement::FloatPlacement(bool show_options, QWidget * parent)
: QWidget(parent), float_list_(0) : InsetParamsWidget(parent), float_list_(0)
{ {
setupUi(this); setupUi(this);
@ -244,6 +246,7 @@ void FloatPlacement::checkAllowed()
} }
} }
} // namespace frontend
} // namespace lyx } // namespace lyx
#include "moc_FloatPlacement.cpp" #include "moc_FloatPlacement.cpp"

View File

@ -13,10 +13,9 @@
#ifndef FLOATPLACEMENT_H #ifndef FLOATPLACEMENT_H
#define FLOATPLACEMENT_H #define FLOATPLACEMENT_H
#include "InsetParamsWidget.h"
#include "ui_FloatPlacementUi.h" #include "ui_FloatPlacementUi.h"
#include <QWidget>
#include "support/docstring.h" #include "support/docstring.h"
namespace lyx { namespace lyx {
@ -25,15 +24,20 @@ class FloatList;
class Inset; class Inset;
class InsetFloatParams; class InsetFloatParams;
class FloatPlacement : public QWidget, public Ui::FloatPlacementUi { namespace frontend {
class FloatPlacement : public InsetParamsWidget, public Ui::FloatPlacementUi {
Q_OBJECT Q_OBJECT
public: public:
FloatPlacement(bool show_options = false, QWidget * parent = 0); FloatPlacement(bool show_options = false, QWidget * parent = 0);
/// /// \name DialogView inherited methods
//@{
InsetCode insetCode() { return FLOAT_CODE; }
FuncCode creationCode() { return LFUN_FLOAT_INSERT; }
void paramsToDialog(Inset const *); void paramsToDialog(Inset const *);
///
docstring dialogToParams() const; docstring dialogToParams() const;
//@}
/// ///
void useWide(); void useWide();
/// ///
@ -47,9 +51,6 @@ private Q_SLOTS:
void on_defaultsCB_stateChanged(int state); void on_defaultsCB_stateChanged(int state);
void changedSlot(); void changedSlot();
Q_SIGNALS:
void changed();
private: private:
/// ///
void checkAllowed(); void checkAllowed();
@ -64,6 +65,7 @@ private:
FloatList const * float_list_; FloatList const * float_list_;
}; };
} // namespace frontend
} // namespace lyx } // namespace lyx
#endif // FLOATPLACEMENT_H #endif // FLOATPLACEMENT_H

View File

@ -73,8 +73,7 @@ static QStringList boxGuiSpecialLengthNames()
} }
GuiBox::GuiBox(GuiView & lv) GuiBox::GuiBox(QWidget * parent) : InsetParamsWidget(parent)
: InsetDialog(lv, BOX_CODE, LFUN_BOX_INSERT, "box", "Box Settings")
{ {
setupUi(this); setupUi(this);
@ -91,15 +90,15 @@ GuiBox::GuiBox(GuiView & lv)
for (int i = 0; i != ids_spec_.size(); ++i) for (int i = 0; i != ids_spec_.size(); ++i)
heightUnitsLC->addItem(gui_names_spec_[i], ids_spec_[i]); heightUnitsLC->addItem(gui_names_spec_[i], ids_spec_[i]);
connect(widthED, SIGNAL(textChanged(QString)), this, SLOT(applyView())); connect(widthED, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
connect(widthUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)), connect(widthUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(applyView())); this, SIGNAL(changed()));
connect(valignCO, SIGNAL(highlighted(QString)), this, SLOT(applyView())); connect(valignCO, SIGNAL(highlighted(QString)), this, SIGNAL(changed()));
connect(heightED, SIGNAL(textChanged(QString)), this, SLOT(applyView())); connect(heightED, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
connect(heightUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)), connect(heightUnitsLC, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(applyView())); this, SIGNAL(changed()));
connect(halignCO, SIGNAL(activated(int)), this, SLOT(applyView())); connect(halignCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
connect(ialignCO, SIGNAL(activated(int)), this, SLOT(applyView())); connect(ialignCO, SIGNAL(activated(int)), this, SIGNAL(changed()));
heightED->setValidator(unsignedLengthValidator(heightED)); heightED->setValidator(unsignedLengthValidator(heightED));
widthED->setValidator(unsignedLengthValidator(widthED)); widthED->setValidator(unsignedLengthValidator(widthED));
@ -112,22 +111,6 @@ GuiBox::GuiBox(GuiView & lv)
} }
void GuiBox::enableView(bool enable)
{
typeCO->setEnabled(enable);
innerBoxCO->setEnabled(enable);
valignCO->setEnabled(enable);
ialignCO->setEnabled(enable);
halignCO->setEnabled(enable);
widthED->setEnabled(enable);
widthUnitsLC->setEnabled(enable);
heightCB->setEnabled(enable);
heightED->setEnabled(enable);
heightUnitsLC->setEnabled(enable);
pagebreakCB->setEnabled(enable);
}
void GuiBox::on_innerBoxCO_activated(QString const & str) void GuiBox::on_innerBoxCO_activated(QString const & str)
{ {
bool const ibox = (str != qt_("None")); bool const ibox = (str != qt_("None"));
@ -137,7 +120,7 @@ void GuiBox::on_innerBoxCO_activated(QString const & str)
heightCB->setEnabled(ibox); heightCB->setEnabled(ibox);
pagebreakCB->setEnabled(!ibox && typeCO->currentIndex() == 1); pagebreakCB->setEnabled(!ibox && typeCO->currentIndex() == 1);
setSpecial(ibox); setSpecial(ibox);
applyView(); changed();
} }
@ -160,7 +143,7 @@ void GuiBox::on_typeCO_activated(int index)
widthED->setEnabled(index != 5); widthED->setEnabled(index != 5);
widthUnitsLC->setEnabled(index != 5); widthUnitsLC->setEnabled(index != 5);
setInnerType(frameless, itype); setInnerType(frameless, itype);
applyView(); changed();
} }
@ -181,7 +164,7 @@ void GuiBox::on_heightCB_stateChanged(int state)
&& (state == Qt::Checked); && (state == Qt::Checked);
heightED->setEnabled(enable); heightED->setEnabled(enable);
heightUnitsLC->setEnabled(enable); heightUnitsLC->setEnabled(enable);
applyView(); changed();
} }
@ -202,7 +185,7 @@ void GuiBox::on_pagebreakCB_stateChanged()
heightED->setEnabled(false); heightED->setEnabled(false);
heightUnitsLC->setEnabled(false); heightUnitsLC->setEnabled(false);
setSpecial(false); setSpecial(false);
applyView(); changed();
} }
@ -378,10 +361,6 @@ void GuiBox::setInnerType(bool frameless, int i)
} }
} }
Dialog * createGuiBox(GuiView & lv) { return new GuiBox(lv); }
} // namespace frontend } // namespace frontend
} // namespace lyx } // namespace lyx

View File

@ -13,20 +13,19 @@
#ifndef GUIBOX_H #ifndef GUIBOX_H
#define GUIBOX_H #define GUIBOX_H
#include "InsetDialog.h" #include "InsetParamsWidget.h"
#include "ui_BoxUi.h" #include "ui_BoxUi.h"
#include "insets/InsetBox.h"
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class GuiBox : public InsetDialog, public Ui::BoxUi class GuiBox : public InsetParamsWidget, public Ui::BoxUi
{ {
Q_OBJECT Q_OBJECT
public: public:
GuiBox(GuiView & lv); GuiBox(QWidget * parent = 0);
private Q_SLOTS: private Q_SLOTS:
void on_innerBoxCO_activated(QString const &); void on_innerBoxCO_activated(QString const &);
@ -36,13 +35,10 @@ private Q_SLOTS:
void on_pagebreakCB_stateChanged(); void on_pagebreakCB_stateChanged();
private: private:
/// \name Dialog inerited methods /// \name DialogView inherited methods
//@{
void enableView(bool enable);
//@}
/// \name InsetDialog inherited methods
//@{ //@{
InsetCode insetCode() { return BOX_CODE; }
FuncCode creationCode() { return LFUN_BOX_INSERT; }
void paramsToDialog(Inset const *); void paramsToDialog(Inset const *);
docstring dialogToParams() const; docstring dialogToParams() const;
//@} //@}

View File

@ -43,12 +43,12 @@
namespace lyx { namespace lyx {
class BufferParams; class BufferParams;
class FloatPlacement;
class LayoutModuleList; class LayoutModuleList;
class TextClass; class TextClass;
namespace frontend { namespace frontend {
class FloatPlacement;
class GuiBranches; class GuiBranches;
class GuiIndices; class GuiIndices;
class ModuleSelectionManager; class ModuleSelectionManager;

View File

@ -14,6 +14,9 @@
#include "GuiERT.h" #include "GuiERT.h"
#include "GuiApplication.h"
#include "GuiView.h"
#include "insets/InsetERT.h" #include "insets/InsetERT.h"
#include "FuncRequest.h" #include "FuncRequest.h"
@ -28,20 +31,12 @@ using namespace std;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
GuiERT::GuiERT(GuiView & lv) GuiERT::GuiERT(QWidget * parent) : InsetParamsWidget(parent)
: InsetDialog(lv, ERT_CODE, LFUN_INSET_INSERT, "ert", "TeX Code Settings")
{ {
setupUi(this); setupUi(this);
connect(collapsedRB, SIGNAL(clicked()), this, SLOT(applyView())); connect(collapsedRB, SIGNAL(clicked()), this, SIGNAL(changed()));
connect(openRB, SIGNAL(clicked()), this, SLOT(applyView())); connect(openRB, SIGNAL(clicked()), this, SIGNAL(changed()));
}
void GuiERT::enableView(bool enable)
{
collapsedRB->setEnabled(enable);
openRB->setEnabled(enable);
} }
@ -56,17 +51,15 @@ docstring GuiERT::dialogToParams() const
void GuiERT::paramsToDialog(Inset const * inset) void GuiERT::paramsToDialog(Inset const * inset)
{ {
InsetERT const * ert = static_cast<InsetERT const *>(inset); InsetERT const * ert = static_cast<InsetERT const *>(inset);
InsetCollapsable::CollapseStatus status = ert->status(*bufferview()); // FIXME: This dialog has absolutely no value...
BufferView const * bv = guiApp->currentView()->currentBufferView();
InsetCollapsable::CollapseStatus status = ert->status(*bv);
switch (status) { switch (status) {
case InsetCollapsable::Open: openRB->setChecked(true); break; case InsetCollapsable::Open: openRB->setChecked(true); break;
case InsetCollapsable::Collapsed: collapsedRB->setChecked(true); break; case InsetCollapsable::Collapsed: collapsedRB->setChecked(true); break;
} }
} }
Dialog * createGuiERT(GuiView & lv) { return new GuiERT(lv); }
} // namespace frontend } // namespace frontend
} // namespace lyx } // namespace lyx

View File

@ -12,27 +12,24 @@
#ifndef GUIERT_H #ifndef GUIERT_H
#define GUIERT_H #define GUIERT_H
#include "InsetDialog.h" #include "InsetParamsWidget.h"
#include "ui_ERTUi.h" #include "ui_ERTUi.h"
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class GuiERT : public InsetDialog, public Ui::ERTUi class GuiERT : public InsetParamsWidget, public Ui::ERTUi
{ {
Q_OBJECT Q_OBJECT
public: public:
GuiERT(GuiView & lv); GuiERT(QWidget * parent = 0);
private: private:
/// \name Dialog inerited methods /// \name InsetParamsWidget inherited methods
//@{
void enableView(bool enable);
//@}
/// \name InsetDialog inherited methods
//@{ //@{
InsetCode insetCode() { return ERT_CODE; }
FuncCode creationCode() { return LFUN_INSET_INSERT; }
void paramsToDialog(Inset const *); void paramsToDialog(Inset const *);
docstring dialogToParams() const; docstring dialogToParams() const;
//@} //@}

View File

@ -1,62 +0,0 @@
/**
* \file GuiFloat.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Edwin Leuven
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "GuiFloat.h"
#include "FloatPlacement.h"
#include "FuncRequest.h"
#include <QPushButton>
using namespace std;
namespace lyx {
namespace frontend {
GuiFloat::GuiFloat(GuiView & lv)
: InsetDialog(lv, FLOAT_CODE, LFUN_FLOAT_INSERT, "float", "Float Settings")
{
setupUi(this);
// enable span columns checkbox
floatFP->useWide();
// enable sideways checkbox
floatFP->useSideways();
connect(floatFP, SIGNAL(changed()), this, SLOT(applyView()));
}
void GuiFloat::enableView(bool enable)
{
floatFP->setEnabled(enable);
}
void GuiFloat::paramsToDialog(Inset const * inset)
{
floatFP->paramsToDialog(inset);
}
docstring GuiFloat::dialogToParams() const
{
return floatFP->dialogToParams();
}
Dialog * createGuiFloat(GuiView & lv) { return new GuiFloat(lv); }
} // namespace frontend
} // namespace lyx
#include "moc_GuiFloat.cpp"

View File

@ -1,46 +0,0 @@
// -*- C++ -*-
/**
* \file GuiFloat.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Edwin Leuven
*
* Full author contact details are available in file CREDITS.
*/
#ifndef GUIFLOAT_H
#define GUIFLOAT_H
#include "InsetDialog.h"
#include "ui_FloatUi.h"
namespace lyx {
namespace frontend {
class GuiFloat : public InsetDialog, public Ui::FloatUi
{
Q_OBJECT
public:
GuiFloat(GuiView & lv);
private:
/// \name Dialog inerited methods
//@{
void enableView(bool enable);
//@}
/// \name InsetDialog inherited methods
//@{
void paramsToDialog(Inset const *);
docstring dialogToParams() const;
//@}
};
} // namespace frontend
} // namespace lyx
#endif // GUIFLOAT_H

View File

@ -47,8 +47,7 @@ char const * info_types_gui[] =
N_("menu"), N_("icon"), N_("buffer"), ""}; N_("menu"), N_("icon"), N_("buffer"), ""};
GuiInfo::GuiInfo(GuiView & lv) GuiInfo::GuiInfo(QWidget * parent) : InsetParamsWidget(parent)
: InsetDialog(lv, INFO_CODE, LFUN_INFO_INSERT, "info", "Info")
{ {
setupUi(this); setupUi(this);
@ -57,8 +56,8 @@ GuiInfo::GuiInfo(GuiView & lv)
typeCO->addItem(qt_(info_types_gui[n])); typeCO->addItem(qt_(info_types_gui[n]));
typeCO->blockSignals(false); typeCO->blockSignals(false);
connect(typeCO, SIGNAL(currentIndexChanged(int)), this, SLOT(applyView())); connect(typeCO, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
connect(nameLE, SIGNAL(textChanged(QString)), this, SLOT(applyView())); connect(nameLE, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
} }
@ -91,17 +90,6 @@ docstring GuiInfo::dialogToParams() const
} }
void GuiInfo::enableView(bool enable)
{
typeCO->setEnabled(enable);
nameLE->setEnabled(enable);
newPB->setEnabled(!enable);
}
Dialog * createGuiInfo(GuiView & lv) { return new GuiInfo(lv); }
} // namespace frontend } // namespace frontend
} // namespace lyx } // namespace lyx

View File

@ -12,7 +12,7 @@
#ifndef GUI_INFO_H #ifndef GUI_INFO_H
#define GUI_INFO_H #define GUI_INFO_H
#include "InsetDialog.h" #include "InsetParamsWidget.h"
#include "ui_InfoUi.h" #include "ui_InfoUi.h"
namespace lyx { namespace lyx {
@ -21,21 +21,18 @@ class Inset;
namespace frontend { namespace frontend {
class GuiInfo : public InsetDialog, public Ui::InfoUi class GuiInfo : public InsetParamsWidget, public Ui::InfoUi
{ {
Q_OBJECT Q_OBJECT
public: public:
GuiInfo(GuiView & lv); GuiInfo(QWidget * parent = 0);
/// \name Dialog inherited methods
//@{
void enableView(bool enable);
//@}
private: private:
/// \name InsetDialog inherited methods /// \name InsetParamsWidget inherited methods
//@{ //@{
InsetCode insetCode() { return INFO_CODE; }
FuncCode creationCode() { return LFUN_INFO_INSERT; }
void paramsToDialog(Inset const *); void paramsToDialog(Inset const *);
docstring dialogToParams() const; docstring dialogToParams() const;
//@} //@}

View File

@ -21,8 +21,9 @@
#include "qt_helpers.h" #include "qt_helpers.h"
#include "Validator.h" #include "Validator.h"
#include "Spacing.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "Spacing.h"
#include "VSpace.h"
#include "insets/InsetVSpace.h" #include "insets/InsetVSpace.h"
@ -39,48 +40,24 @@ using namespace std;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
GuiVSpace::GuiVSpace(GuiView & lv) GuiVSpace::GuiVSpace(QWidget * parent) : InsetParamsWidget(parent)
: GuiDialog(lv, "vspace", qt_("Vertical Space Settings"))
{ {
setupUi(this); setupUi(this);
connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
connect(spacingCO, SIGNAL(highlighted(QString)),
this, SLOT(change_adaptor()));
connect(valueLE, SIGNAL(textChanged(QString)), connect(valueLE, SIGNAL(textChanged(QString)),
this, SLOT(change_adaptor())); this, SIGNAL(changed()));
connect(keepCB, SIGNAL(clicked()),
this, SIGNAL(changed()));
connect(unitCO, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SIGNAL(changed()));
connect(spacingCO, SIGNAL(activated(int)), connect(spacingCO, SIGNAL(activated(int)),
this, SLOT(enableCustom(int))); this, SLOT(enableCustom(int)));
connect(keepCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
connect(unitCO, SIGNAL(selectionChanged(lyx::Length::UNIT)),
this, SLOT(change_adaptor()));
valueLE->setValidator(unsignedGlueLengthValidator(valueLE)); valueLE->setValidator(unsignedGlueLengthValidator(valueLE));
// Manage the ok, apply, restore and cancel/close buttons
bc().setPolicy(ButtonPolicy::OkApplyCancelReadOnlyPolicy);
bc().setOK(okPB);
bc().setApply(applyPB);
bc().setCancel(closePB);
// disable for read-only documents
bc().addReadOnly(spacingCO);
bc().addReadOnly(valueLE);
bc().addReadOnly(unitCO);
bc().addReadOnly(keepCB);
// initialize the length validator // initialize the length validator
bc().addCheckedLineEdit(valueLE, valueL); addCheckedWidget(valueLE, valueL);
}
void GuiVSpace::change_adaptor()
{
changed();
} }
@ -144,47 +121,26 @@ static VSpace setVSpaceFromWidgets(int spacing,
} }
void GuiVSpace::applyView() docstring GuiVSpace::dialogToParams() const
{ {
// If a vspace choice is "Length" but there's no text in // If a vspace choice is "Length" but there's no text in
// the input field, do not insert a vspace at all. // the input field, do not insert a vspace at all.
if (spacingCO->currentIndex() == 5 && valueLE->text().isEmpty()) if (spacingCO->currentIndex() == 5 && valueLE->text().isEmpty())
return; return docstring();
params_ = setVSpaceFromWidgets(spacingCO->currentIndex(), VSpace const params = setVSpaceFromWidgets(spacingCO->currentIndex(),
valueLE, unitCO, keepCB->isChecked()); valueLE, unitCO, keepCB->isChecked());
return from_ascii(InsetVSpace::params2string(params));
} }
void GuiVSpace::updateContents() void GuiVSpace::paramsToDialog(Inset const * inset)
{ {
setWidgetsFromVSpace(params_, spacingCO, valueLE, unitCO, keepCB); InsetVSpace const * vs = static_cast<InsetVSpace const *>(inset);
VSpace const & params = vs->space();
setWidgetsFromVSpace(params, spacingCO, valueLE, unitCO, keepCB);
} }
bool GuiVSpace::initialiseParams(string const & data)
{
InsetVSpace::string2params(data, params_);
setButtonsValid(true);
return true;
}
void GuiVSpace::clearParams()
{
params_ = VSpace();
}
void GuiVSpace::dispatchParams()
{
dispatch(FuncRequest(getLfun(), InsetVSpace::params2string(params_)));
}
Dialog * createGuiVSpace(GuiView & lv) { return new GuiVSpace(lv); }
} // namespace frontend } // namespace frontend
} // namespace lyx } // namespace lyx

View File

@ -15,42 +15,31 @@
#ifndef GUIVSPACE_H #ifndef GUIVSPACE_H
#define GUIVSPACE_H #define GUIVSPACE_H
#include "GuiDialog.h" #include "InsetParamsWidget.h"
#include "ui_VSpaceUi.h" #include "ui_VSpaceUi.h"
#include "VSpace.h"
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
class GuiVSpace : public GuiDialog, public Ui::VSpaceUi class GuiVSpace : public InsetParamsWidget, public Ui::VSpaceUi
{ {
Q_OBJECT Q_OBJECT
public: public:
GuiVSpace(GuiView & lv); GuiVSpace(QWidget * parent = 0);
private Q_SLOTS: private Q_SLOTS:
///
void change_adaptor();
/// ///
void enableCustom(int); void enableCustom(int);
private: private:
/// Apply from dialog /// \name DialogView inherited methods
void applyView(); //@{
/// Update the dialog InsetCode insetCode() { return VSPACE_CODE; }
void updateContents(); FuncCode creationCode() { return LFUN_INSET_INSERT; }
/// void paramsToDialog(Inset const *);
bool initialiseParams(std::string const & data); docstring dialogToParams() const;
/// clean-up on hide. //@}
void clearParams();
/// clean-up on hide.
void dispatchParams();
///
bool isBufferDependent() const { return true; }
///
VSpace params_;
}; };
} // namespace frontend } // namespace frontend

View File

@ -3437,12 +3437,12 @@ void GuiView::updateDialogs()
updateLayoutList(); updateLayoutList();
} }
Dialog * createDialog(GuiView & lv, string const & name);
// will be replaced by a proper factory... // will be replaced by a proper factory...
Dialog * createGuiAbout(GuiView & lv); Dialog * createGuiAbout(GuiView & lv);
Dialog * createGuiBibitem(GuiView & lv); Dialog * createGuiBibitem(GuiView & lv);
Dialog * createGuiBibtex(GuiView & lv); Dialog * createGuiBibtex(GuiView & lv);
Dialog * createGuiBox(GuiView & lv);
Dialog * createGuiBranch(GuiView & lv); Dialog * createGuiBranch(GuiView & lv);
Dialog * createGuiChanges(GuiView & lv); Dialog * createGuiChanges(GuiView & lv);
Dialog * createGuiCharacter(GuiView & lv); Dialog * createGuiCharacter(GuiView & lv);
@ -3451,13 +3451,10 @@ Dialog * createGuiCompare(GuiView & lv);
Dialog * createGuiDelimiter(GuiView & lv); Dialog * createGuiDelimiter(GuiView & lv);
Dialog * createGuiDocument(GuiView & lv); Dialog * createGuiDocument(GuiView & lv);
Dialog * createGuiErrorList(GuiView & lv); Dialog * createGuiErrorList(GuiView & lv);
Dialog * createGuiERT(GuiView & lv);
Dialog * createGuiExternal(GuiView & lv); Dialog * createGuiExternal(GuiView & lv);
Dialog * createGuiFloat(GuiView & lv);
Dialog * createGuiGraphics(GuiView & lv); Dialog * createGuiGraphics(GuiView & lv);
Dialog * createGuiInclude(GuiView & lv); Dialog * createGuiInclude(GuiView & lv);
Dialog * createGuiIndex(GuiView & lv); Dialog * createGuiIndex(GuiView & lv);
Dialog * createGuiInfo(GuiView & lv);
Dialog * createGuiLabel(GuiView & lv); Dialog * createGuiLabel(GuiView & lv);
Dialog * createGuiListings(GuiView & lv); Dialog * createGuiListings(GuiView & lv);
Dialog * createGuiLog(GuiView & lv); Dialog * createGuiLog(GuiView & lv);
@ -3485,7 +3482,6 @@ Dialog * createGuiTextHSpace(GuiView & lv);
Dialog * createGuiToc(GuiView & lv); Dialog * createGuiToc(GuiView & lv);
Dialog * createGuiThesaurus(GuiView & lv); Dialog * createGuiThesaurus(GuiView & lv);
Dialog * createGuiHyperlink(GuiView & lv); Dialog * createGuiHyperlink(GuiView & lv);
Dialog * createGuiVSpace(GuiView & lv);
Dialog * createGuiViewSource(GuiView & lv); Dialog * createGuiViewSource(GuiView & lv);
Dialog * createGuiWrap(GuiView & lv); Dialog * createGuiWrap(GuiView & lv);
Dialog * createGuiProgressView(GuiView & lv); Dialog * createGuiProgressView(GuiView & lv);
@ -3496,14 +3492,16 @@ Dialog * GuiView::build(string const & name)
{ {
LASSERT(isValidName(name), return 0); LASSERT(isValidName(name), return 0);
Dialog * dialog = createDialog(*this, name);
if (dialog)
return dialog;
if (name == "aboutlyx") if (name == "aboutlyx")
return createGuiAbout(*this); return createGuiAbout(*this);
if (name == "bibitem") if (name == "bibitem")
return createGuiBibitem(*this); return createGuiBibitem(*this);
if (name == "bibtex") if (name == "bibtex")
return createGuiBibtex(*this); return createGuiBibtex(*this);
if (name == "box")
return createGuiBox(*this);
if (name == "branch") if (name == "branch")
return createGuiBranch(*this); return createGuiBranch(*this);
if (name == "changes") if (name == "changes")
@ -3518,8 +3516,6 @@ Dialog * GuiView::build(string const & name)
return createGuiDocument(*this); return createGuiDocument(*this);
if (name == "errorlist") if (name == "errorlist")
return createGuiErrorList(*this); return createGuiErrorList(*this);
if (name == "ert")
return createGuiERT(*this);
if (name == "external") if (name == "external")
return createGuiExternal(*this); return createGuiExternal(*this);
if (name == "file") if (name == "file")
@ -3528,8 +3524,6 @@ Dialog * GuiView::build(string const & name)
return createGuiSearch(*this); return createGuiSearch(*this);
if (name == "findreplaceadv") if (name == "findreplaceadv")
return createGuiSearchAdv(*this); return createGuiSearchAdv(*this);
if (name == "float")
return createGuiFloat(*this);
if (name == "graphics") if (name == "graphics")
return createGuiGraphics(*this); return createGuiGraphics(*this);
if (name == "href") if (name == "href")
@ -3540,8 +3534,6 @@ Dialog * GuiView::build(string const & name)
return createGuiIndex(*this); return createGuiIndex(*this);
if (name == "index_print") if (name == "index_print")
return createGuiPrintindex(*this); return createGuiPrintindex(*this);
if (name == "info")
return createGuiInfo(*this);
if (name == "label") if (name == "label")
return createGuiLabel(*this); return createGuiLabel(*this);
if (name == "listings") if (name == "listings")
@ -3590,8 +3582,6 @@ Dialog * GuiView::build(string const & name)
return createGuiToc(*this); return createGuiToc(*this);
if (name == "view-source") if (name == "view-source")
return createGuiViewSource(*this); return createGuiViewSource(*this);
if (name == "vspace")
return createGuiVSpace(*this);
if (name == "wrap") if (name == "wrap")
return createGuiWrap(*this); return createGuiWrap(*this);
if (name == "progress") if (name == "progress")

View File

@ -1,115 +0,0 @@
/**
* \file InsetDialog.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "InsetDialog.h"
#include "qt_helpers.h"
#include "Buffer.h"
#include "buffer_funcs.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "Cursor.h"
#include "FuncRequest.h"
#include "support/debug.h"
#include "support/lstrings.h"
using namespace std;
using namespace lyx::support;
namespace lyx {
namespace frontend {
/////////////////////////////////////////////////////////////////
//
// InsetDialog::Private
//
/////////////////////////////////////////////////////////////////
struct InsetDialog::Private
{
Private(InsetCode code, FuncCode creation_code)
: inset_code_(code), creation_code_(creation_code)
{
}
///
InsetCode inset_code_;
///
FuncCode creation_code_;
};
/////////////////////////////////////////////////////////////////
//
// InsetDialog
//
/////////////////////////////////////////////////////////////////
InsetDialog::InsetDialog(GuiView & lv, InsetCode code, FuncCode creation_code,
char const * name, char const * display_name)
: DialogView(lv, name, qt_(display_name)), d(new Private(code, creation_code))
{
}
void InsetDialog::on_closePB_clicked()
{
hide();
}
void InsetDialog::on_newPB_clicked()
{
docstring const argument = dialogToParams();
dispatch(FuncRequest(d->creation_code_, argument));
}
void InsetDialog::applyView()
{
if (!checkWidgets())
return;
Inset const * i = inset(d->inset_code_);
if (!i)
return;
docstring const argument = dialogToParams();
if (!i->validateModifyArgument(argument))
return;
dispatch(FuncRequest(LFUN_INSET_MODIFY, argument));
}
void InsetDialog::updateView()
{
Inset const * i = inset(d->inset_code_);
if (i)
paramsToDialog(i);
else
enableView(false);
//FIXME: the newPB push button cannot be accessed here and so cannot be
// disabled...
/*
docstring const argument = dialogToParams();
newPB->setEnabled(
getStatus(FuncRequest(LFUN_INSET_MODIFY, argument).enabled());
*/
}
} // namespace frontend
} // namespace lyx
#include "moc_InsetDialog.cpp"

View File

@ -0,0 +1,200 @@
/**
* \file InsetParamsDialog.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "InsetParamsDialog.h"
#include "GuiBox.h"
#include "GuiERT.h"
#include "GuiInfo.h"
#include "GuiVSpace.h"
#include "FloatPlacement.h"
#include "InsetParamsWidget.h"
#include "qt_helpers.h"
#include "Buffer.h"
#include "buffer_funcs.h"
#include "BufferParams.h"
#include "BufferView.h"
#include "Cursor.h"
#include "FuncRequest.h"
#include "FuncStatus.h"
#include "LyX.h"
#include "support/debug.h"
#include "support/lstrings.h"
using namespace std;
using namespace lyx::support;
namespace lyx {
namespace frontend {
/////////////////////////////////////////////////////////////////
//
// InsetParamsDialog::Private
//
/////////////////////////////////////////////////////////////////
struct InsetParamsDialog::Private
{
///
InsetParamsWidget * widget_;
};
/////////////////////////////////////////////////////////////////
//
// InsetParamsDialog
//
/////////////////////////////////////////////////////////////////
InsetParamsDialog::InsetParamsDialog(GuiView & lv, InsetParamsWidget * widget)
: DialogView(lv, toqstr(insetName(widget->insetCode())),
toqstr(insetName(widget->insetCode()))), d(new Private)
{
setupUi(this);
setInsetParamsWidget(widget);
synchronizedViewCB->setChecked(false);
on_synchronizedViewCB_stateChanged(false);
}
InsetParamsDialog::~InsetParamsDialog()
{
delete d;
}
void InsetParamsDialog::setInsetParamsWidget(InsetParamsWidget * widget)
{
d->widget_ = widget;
stackedWidget->addWidget(widget);
stackedWidget->setCurrentWidget(widget);
}
void InsetParamsDialog::on_restorePB_clicked()
{
updateView();
}
void InsetParamsDialog::on_okPB_clicked()
{
applyView();
hide();
}
void InsetParamsDialog::on_applyPB_clicked()
{
if (synchronizedViewCB->isChecked()) {
docstring const argument = d->widget_->dialogToParams();
dispatch(FuncRequest(d->widget_->creationCode(), argument));
} else {
applyView();
}
}
void InsetParamsDialog::on_closePB_clicked()
{
hide();
}
void InsetParamsDialog::on_synchronizedViewCB_stateChanged(int state)
{
bool const sync = (state == Qt::Checked);
QString const label = sync ? qt_("&New") : qt_("&Apply");
applyPB->setText(label);
okPB->setEnabled(!sync);
restorePB->setEnabled(!sync);
if (sync)
connect(d->widget_, SIGNAL(changed()), this, SLOT(applyView()));
else
QObject::disconnect(d->widget_, SIGNAL(changed()), this, SLOT(applyView()));
}
void InsetParamsDialog::applyView()
{
if (!d->widget_->checkWidgets())
return;
Inset const * i = inset(d->widget_->insetCode());
if (!i)
return;
docstring const argument = d->widget_->dialogToParams();
if (argument.empty() || !i->validateModifyArgument(argument)) {
//FIXME: newPB is not accessible
//newPB->setEnabled(false);
return;
}
//FIXME: newPB is not accessible
//newPB->setEnabled(true);
dispatch(FuncRequest(LFUN_INSET_MODIFY, argument));
}
void InsetParamsDialog::updateView()
{
Inset const * i = inset(d->widget_->insetCode());
if (i)
d->widget_->paramsToDialog(i);
else
d->widget_->setEnabled(false);
docstring const argument = d->widget_->dialogToParams();
FuncCode const code = synchronizedViewCB->isChecked()
? d->widget_->creationCode() : LFUN_INSET_MODIFY;
applyPB->setEnabled(
lyx::getStatus(FuncRequest(code, argument)).enabled());
}
Dialog * createDialog(GuiView & lv, InsetCode code)
{
InsetParamsWidget * widget;
switch (code) {
case ERT_CODE:
widget = new GuiERT;
break;
case FLOAT_CODE:
widget = new FloatPlacement(true);
break;
case BOX_CODE:
widget = new GuiBox;
break;
case INFO_CODE:
widget = new GuiInfo;
break;
case VSPACE_CODE:
widget = new GuiVSpace;
break;
default: return 0;
}
InsetParamsDialog * dialog = new InsetParamsDialog(lv, widget);
return dialog;
}
Dialog * createDialog(GuiView & lv, string const & name)
{
return createDialog(lv, insetCode(name));
}
} // namespace frontend
} // namespace lyx
#include "moc_InsetParamsDialog.cpp"

View File

@ -1,6 +1,6 @@
// -*- C++ -*- // -*- C++ -*-
/** /**
* \file InsetDialog.h * \file InsetParamsDialog.h
* This file is part of LyX, the document processor. * This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING. * Licence details can be found in the file COPYING.
* *
@ -9,10 +9,11 @@
* Full author contact details are available in file CREDITS. * Full author contact details are available in file CREDITS.
*/ */
#ifndef INSET_DIALOG_H #ifndef INSET_PARAMS_DIALOG_H
#define INSET_DIALOG_H #define INSET_PARAMS_DIALOG_H
#include "DialogView.h" #include "DialogView.h"
#include "ui_InsetParamsUi.h"
#include "qt_i18n.h" #include "qt_i18n.h"
@ -22,15 +23,27 @@ class Inset;
namespace frontend { namespace frontend {
class InsetParamsWidget;
class InsetDialog : public DialogView class InsetParamsDialog : public DialogView, public Ui::InsetParamsUi
{ {
Q_OBJECT Q_OBJECT
public: public:
InsetDialog(GuiView & lv, InsetCode code, FuncCode creation_code, InsetParamsDialog(GuiView & lv, InsetParamsWidget * widget);
char const * name, char const * display_name); ~InsetParamsDialog();
///
void setInsetParamsWidget(InsetParamsWidget * widget);
protected Q_SLOTS:
void applyView();
void on_restorePB_clicked();
void on_okPB_clicked();
void on_applyPB_clicked();
void on_closePB_clicked();
void on_synchronizedViewCB_stateChanged(int state);
private:
/// \name DialogView inherited methods /// \name DialogView inherited methods
//@{ //@{
void updateView(); void updateView();
@ -38,19 +51,6 @@ public:
bool isBufferDependent() const { return true; } bool isBufferDependent() const { return true; }
bool canApply() const { return true; } bool canApply() const { return true; }
//@} //@}
protected Q_SLOTS:
void applyView();
void on_newPB_clicked();
void on_closePB_clicked();
protected:
///
virtual void paramsToDialog(Inset const *) = 0;
///
virtual docstring dialogToParams() const = 0;
private:
/// pimpl /// pimpl
struct Private; struct Private;
Private * d; Private * d;
@ -59,4 +59,4 @@ private:
} // namespace frontend } // namespace frontend
} // namespace lyx } // namespace lyx
#endif // INSET_DIALOG_H #endif // INSET_PARAMS_DIALOG_H

View File

@ -0,0 +1,64 @@
// -*- C++ -*-
/**
* \file InsetParamsWidget.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "InsetParamsWidget.h"
#include "qt_helpers.h"
#include <QLineEdit>
namespace lyx {
namespace frontend {
CheckedWidget::CheckedWidget(QLineEdit * input, QWidget * label)
: input_(input), label_(label)
{
}
bool CheckedWidget::check() const
{
bool const valid = input_->hasAcceptableInput();
// Visual feedback.
setValid(input_, valid);
if (label_)
setValid(label_, valid);
return valid;
}
InsetParamsWidget::InsetParamsWidget(QWidget * parent) : QWidget(parent)
{
}
void InsetParamsWidget::addCheckedWidget(QLineEdit * input, QWidget * label)
{
checked_widgets_.append(CheckedWidget(input, label));
}
bool InsetParamsWidget::checkWidgets() const
{
bool valid = true;
Q_FOREACH(CheckedWidget const & le, checked_widgets_)
valid &= le.check();
return valid;
}
} // namespace frontend
} // namespace lyx
#include "moc_InsetParamsWidget.cpp"

View File

@ -0,0 +1,84 @@
// -*- C++ -*-
/**
* \file InsetParamsWidget.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Abdelrazak Younes
*
* Full author contact details are available in file CREDITS.
*/
#ifndef INSET_PARAMS_WIDGET_H
#define INSET_PARAMS_WIDGET_H
#include "insets/InsetCode.h"
#include "FuncCode.h"
#include "support/strfwd.h"
#include <QWidget>
class QLineEdit;
namespace lyx {
class Inset;
namespace frontend {
/// CheckedWidget
// FIXME: Get rid of CheckedLineEdit in ButtonController and rename this one
// to it.
class CheckedWidget
{
public:
CheckedWidget(QLineEdit * input, QWidget * label = 0);
///
bool check() const;
private:
// non-owned
QLineEdit * input_;
QWidget * label_;
};
typedef QList<CheckedWidget> CheckedWidgets;
class InsetParamsWidget : public QWidget
{
Q_OBJECT
Q_SIGNALS:
void changed();
public:
InsetParamsWidget(QWidget * parent);
/// This is a base class; destructor must exist and be virtual.
virtual ~InsetParamsWidget() {}
///
virtual InsetCode insetCode() = 0;
///
virtual FuncCode creationCode() = 0;
///
virtual void paramsToDialog(Inset const *) = 0;
///
virtual docstring dialogToParams() const = 0;
/// \return true if all CheckedWidgets are in a valid state.
bool checkWidgets() const;
protected:
/// Add a widget to the list of all widgets whose validity should
/// be checked explicitly when the buttons are refreshed.
void addCheckedWidget(QLineEdit * input, QWidget * label = 0);
private:
///
CheckedWidgets checked_widgets_;
};
} // namespace frontend
} // namespace lyx
#endif // INSET_PARAMS_WIDGET_H

View File

@ -132,7 +132,8 @@ SOURCEFILES = \
GuiWrap.cpp \ GuiWrap.cpp \
IconPalette.cpp \ IconPalette.cpp \
InsertTableWidget.cpp \ InsertTableWidget.cpp \
InsetDialog.cpp \ InsetParamsDialog.cpp \
InsetParamsWidget.cpp \
LengthCombo.cpp \ LengthCombo.cpp \
LyXFileDialog.cpp \ LyXFileDialog.cpp \
LaTeXHighlighter.cpp \ LaTeXHighlighter.cpp \
@ -235,7 +236,8 @@ MOCHEADER = \
GuiWrap.h \ GuiWrap.h \
IconPalette.h \ IconPalette.h \
InsertTableWidget.h \ InsertTableWidget.h \
InsetDialog.h \ InsetParamsDialog.h \
InsetParamsWidget.h \
LayoutBox.h \ LayoutBox.h \
LengthCombo.h \ LengthCombo.h \
LyXFileDialog.h \ LyXFileDialog.h \
@ -267,7 +269,6 @@ UIFILES = \
ExternalUi.ui \ ExternalUi.ui \
FindAndReplaceUi.ui \ FindAndReplaceUi.ui \
FloatPlacementUi.ui \ FloatPlacementUi.ui \
FloatUi.ui \
FontUi.ui \ FontUi.ui \
GraphicsUi.ui \ GraphicsUi.ui \
HSpaceUi.ui \ HSpaceUi.ui \
@ -276,6 +277,7 @@ UIFILES = \
IndexUi.ui \ IndexUi.ui \
IndicesUi.ui \ IndicesUi.ui \
InfoUi.ui \ InfoUi.ui \
InsetParamsUi.ui \
LabelUi.ui \ LabelUi.ui \
LanguageUi.ui \ LanguageUi.ui \
LaTeXUi.ui \ LaTeXUi.ui \

View File

@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>BoxUi</class> <class>BoxUi</class>
<widget class="QDialog" name="BoxUi"> <widget class="QWidget" name="BoxUi">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>356</width> <width>261</width>
<height>288</height> <height>245</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string/> <string/>
</property> </property>
<property name="sizeGripEnabled"> <property name="sizeGripEnabled" stdset="0">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QGridLayout"> <layout class="QGridLayout">
@ -181,61 +182,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="6" column="0" colspan="3">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="newPB">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>&amp;New</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closePB">
<property name="text">
<string>&amp;Close</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="2"> <item row="3" column="2">
<widget class="LengthCombo" name="heightUnitsLC"> <widget class="LengthCombo" name="heightUnitsLC">
<property name="enabled"> <property name="enabled">
@ -367,8 +313,6 @@
<tabstop>ialignCO</tabstop> <tabstop>ialignCO</tabstop>
<tabstop>halignCO</tabstop> <tabstop>halignCO</tabstop>
<tabstop>valignCO</tabstop> <tabstop>valignCO</tabstop>
<tabstop>closePB</tabstop>
<tabstop>newPB</tabstop>
</tabstops> </tabstops>
<includes> <includes>
<include location="local">qt_i18n.h</include> <include location="local">qt_i18n.h</include>

View File

@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>ERTUi</class> <class>ERTUi</class>
<widget class="QDialog" name="ERTUi"> <widget class="QWidget" name="ERTUi">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>197</width> <width>175</width>
<height>135</height> <height>99</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string/> <string/>
</property> </property>
<property name="sizeGripEnabled"> <property name="sizeGripEnabled" stdset="0">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
@ -57,58 +58,6 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="newPB">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>&amp;New</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closePB">
<property name="text">
<string>Close</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
<includes> <includes>

View File

@ -1,95 +0,0 @@
<ui version="4.0">
<class>FloatUi</class>
<widget class="QDialog" name="FloatUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>410</width>
<height>336</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>11</number>
</property>
<item>
<widget class="lyx::FloatPlacement" name="floatFP" native="true"/>
</item>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="newPB">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>&amp;New</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closePB">
<property name="text">
<string>&amp;Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>lyx::FloatPlacement</class>
<extends></extends>
<header>FloatPlacement.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>closePB</tabstop>
</tabstops>
<includes>
<include location="local">qt_i18n.h</include>
</includes>
<resources/>
<connections/>
</ui>

View File

@ -1,86 +1,50 @@
<ui version="4.0" > <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>InfoUi</class> <class>InfoUi</class>
<widget class="QDialog" name="InfoUi" > <widget class="QWidget" name="InfoUi">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>320</width> <width>320</width>
<height>131</height> <height>75</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle">
<string/> <string/>
</property> </property>
<property name="sizeGripEnabled" > <property name="sizeGripEnabled" stdset="0">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QVBoxLayout" > <layout class="QVBoxLayout">
<item> <item>
<layout class="QGridLayout" > <layout class="QGridLayout">
<item row="0" column="0" > <item row="0" column="0">
<widget class="QLabel" name="typeLBL" > <widget class="QLabel" name="typeLBL">
<property name="text" > <property name="text">
<string>Information Type:</string> <string>Information Type:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" > <item row="0" column="1">
<widget class="QComboBox" name="typeCO" /> <widget class="QComboBox" name="typeCO"/>
</item> </item>
<item row="1" column="0" > <item row="1" column="0">
<widget class="QLabel" name="nameLBL" > <widget class="QLabel" name="nameLBL">
<property name="text" > <property name="text">
<string>Information Name:</string> <string>Information Name:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" > <item row="1" column="1">
<widget class="QLineEdit" name="nameLE" /> <widget class="QLineEdit" name="nameLE"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>84</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="newPB" >
<property name="text" >
<string>&amp;New</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closePB" >
<property name="text" >
<string>&amp;Close</string>
</property>
<property name="default" >
<bool>true</bool>
</property>
</widget>
</item> </item>
</layout> </layout>
</item> </item>
</layout> </layout>
</widget> </widget>
<includes> <includes>
<include location="local" >qt_i18n.h</include> <include location="local">qt_i18n.h</include>
</includes> </includes>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>InsetParamsUi</class>
<widget class="QDialog" name="InsetParamsUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>438</width>
<height>292</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="windowTitle">
<string>Inset Parameter Configuration</string>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="0" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>281</width>
<height>31</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="synchronizedViewCB">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>I&amp;mmediate Apply</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="restorePB">
<property name="text">
<string>&amp;Restore</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>31</width>
<height>27</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="okPB">
<property name="text">
<string>&amp;OK</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="applyPB">
<property name="text">
<string>&amp;Apply</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closePB">
<property name="text">
<string>&amp;Close</string>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" colspan="3">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>351</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="page"/>
<widget class="QWidget" name="page_2"/>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>synchronizedViewCB</tabstop>
<tabstop>restorePB</tabstop>
<tabstop>okPB</tabstop>
<tabstop>applyPB</tabstop>
<tabstop>closePB</tabstop>
</tabstops>
<includes>
<include location="local">qt_i18n.h</include>
</includes>
<resources/>
<connections/>
</ui>

View File

@ -1,146 +1,110 @@
<ui version="4.0" > <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VSpaceUi</class> <class>VSpaceUi</class>
<widget class="QDialog" name="VSpaceUi" > <widget class="QWidget" name="VSpaceUi">
<property name="geometry" > <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>259</width> <width>215</width>
<height>120</height> <height>96</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle">
<string/> <string/>
</property> </property>
<property name="sizeGripEnabled" > <property name="sizeGripEnabled" stdset="0">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout">
<item row="3" column="0" colspan="3" > <item row="0" column="0">
<layout class="QHBoxLayout" > <widget class="QLabel" name="spacingL">
<item> <property name="text">
<widget class="QPushButton" name="okPB" >
<property name="text" >
<string>&amp;OK</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
<property name="default" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="applyPB" >
<property name="text" >
<string>&amp;Apply</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="closePB" >
<property name="text" >
<string>&amp;Close</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="spacingL" >
<property name="text" >
<string>&amp;Spacing:</string> <string>&amp;Spacing:</string>
</property> </property>
<property name="buddy" > <property name="buddy">
<cstring>spacingCO</cstring> <cstring>spacingCO</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1" colspan="2" > <item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="keepCB" > <widget class="QCheckBox" name="keepCB">
<property name="toolTip" > <property name="toolTip">
<string>Insert the spacing even after a page break</string> <string>Insert the spacing even after a page break</string>
</property> </property>
<property name="text" > <property name="text">
<string/> <string/>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" > <item row="2" column="0">
<widget class="QLabel" name="keepL" > <widget class="QLabel" name="keepL">
<property name="toolTip" > <property name="toolTip">
<string/> <string/>
</property> </property>
<property name="text" > <property name="text">
<string>&amp;Protect:</string> <string>&amp;Protect:</string>
</property> </property>
<property name="buddy" > <property name="buddy">
<cstring>keepCB</cstring> <cstring>keepCB</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2" > <item row="1" column="2">
<widget class="LengthCombo" name="unitCO" /> <widget class="LengthCombo" name="unitCO"/>
</item> </item>
<item row="1" column="1" > <item row="1" column="1">
<widget class="QLineEdit" name="valueLE" > <widget class="QLineEdit" name="valueLE">
<property name="enabled" > <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="toolTip" > <property name="toolTip">
<string>Custom value. Needs spacing type "Custom".</string> <string>Custom value. Needs spacing type &quot;Custom&quot;.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" > <item row="1" column="0">
<widget class="QLabel" name="valueL" > <widget class="QLabel" name="valueL">
<property name="text" > <property name="text">
<string>&amp;Value:</string> <string>&amp;Value:</string>
</property> </property>
<property name="buddy" > <property name="buddy">
<cstring>valueLE</cstring> <cstring>valueLE</cstring>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1" colspan="2" > <item row="0" column="1" colspan="2">
<widget class="QComboBox" name="spacingCO" > <widget class="QComboBox" name="spacingCO">
<property name="toolTip" > <property name="toolTip">
<string>Supported spacing types</string> <string>Supported spacing types</string>
</property> </property>
<item> <item>
<property name="text" > <property name="text">
<string>DefSkip</string> <string>DefSkip</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text" > <property name="text">
<string>SmallSkip</string> <string>SmallSkip</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text" > <property name="text">
<string>MedSkip</string> <string>MedSkip</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text" > <property name="text">
<string>BigSkip</string> <string>BigSkip</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text" > <property name="text">
<string>VFill</string> <string>VFill</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text" > <property name="text">
<string>Custom</string> <string>Custom</string>
</property> </property>
</item> </item>
@ -160,12 +124,9 @@
<tabstop>valueLE</tabstop> <tabstop>valueLE</tabstop>
<tabstop>unitCO</tabstop> <tabstop>unitCO</tabstop>
<tabstop>keepCB</tabstop> <tabstop>keepCB</tabstop>
<tabstop>okPB</tabstop>
<tabstop>applyPB</tabstop>
<tabstop>closePB</tabstop>
</tabstops> </tabstops>
<includes> <includes>
<include location="local" >qt_i18n.h</include> <include location="local">qt_i18n.h</include>
</includes> </includes>
<resources/> <resources/>
<connections/> <connections/>