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 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)
: 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
{
FuncRequest const fr(getLfun(), fromqstr(name_));

View File

@ -22,7 +22,6 @@
#include <QString>
class QWidget;
class QLineEdit;
namespace lyx {
@ -46,28 +45,6 @@ enum KernelDocType
DOCBOOK
};
/// CheckedLineEdit
// FIXME: Get rid of CheckedLineEdit in ButtonController and rename this one
// to it.
class CheckedLineEdit2
{
public:
CheckedLineEdit2(QLineEdit * input, QWidget * label = 0)
: input_(input), label_(label)
{}
///
bool check() const;
private:
// non-owned
QLineEdit * input_;
QWidget * label_;
};
typedef QList<CheckedLineEdit2> CheckedLineEdits;
/** \c Dialog collects the different parts of a Model-Controller-View
* split of a generic dialog together.
*/
@ -279,11 +256,6 @@ protected:
void setTitle(QString const & title) { title_ = title; }
///
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:
/** The Dialog's name is the means by which a dialog identifies
@ -298,9 +270,6 @@ private:
/// intentionally unimplemented, therefore uncopiable
Dialog(Dialog const &);
void operator=(Dialog const &);
///
CheckedLineEdits checked_line_edits_;
};

View File

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

View File

@ -13,10 +13,9 @@
#ifndef FLOATPLACEMENT_H
#define FLOATPLACEMENT_H
#include "InsetParamsWidget.h"
#include "ui_FloatPlacementUi.h"
#include <QWidget>
#include "support/docstring.h"
namespace lyx {
@ -25,15 +24,20 @@ class FloatList;
class Inset;
class InsetFloatParams;
class FloatPlacement : public QWidget, public Ui::FloatPlacementUi {
namespace frontend {
class FloatPlacement : public InsetParamsWidget, public Ui::FloatPlacementUi {
Q_OBJECT
public:
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 *);
///
docstring dialogToParams() const;
//@}
///
void useWide();
///
@ -47,9 +51,6 @@ private Q_SLOTS:
void on_defaultsCB_stateChanged(int state);
void changedSlot();
Q_SIGNALS:
void changed();
private:
///
void checkAllowed();
@ -64,6 +65,7 @@ private:
FloatList const * float_list_;
};
} // namespace frontend
} // namespace lyx
#endif // FLOATPLACEMENT_H

View File

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

View File

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

View File

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

View File

@ -14,6 +14,9 @@
#include "GuiERT.h"
#include "GuiApplication.h"
#include "GuiView.h"
#include "insets/InsetERT.h"
#include "FuncRequest.h"
@ -28,20 +31,12 @@ using namespace std;
namespace lyx {
namespace frontend {
GuiERT::GuiERT(GuiView & lv)
: InsetDialog(lv, ERT_CODE, LFUN_INSET_INSERT, "ert", "TeX Code Settings")
GuiERT::GuiERT(QWidget * parent) : InsetParamsWidget(parent)
{
setupUi(this);
connect(collapsedRB, SIGNAL(clicked()), this, SLOT(applyView()));
connect(openRB, SIGNAL(clicked()), this, SLOT(applyView()));
}
void GuiERT::enableView(bool enable)
{
collapsedRB->setEnabled(enable);
openRB->setEnabled(enable);
connect(collapsedRB, SIGNAL(clicked()), this, SIGNAL(changed()));
connect(openRB, SIGNAL(clicked()), this, SIGNAL(changed()));
}
@ -56,17 +51,15 @@ docstring GuiERT::dialogToParams() const
void GuiERT::paramsToDialog(Inset 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) {
case InsetCollapsable::Open: openRB->setChecked(true); break;
case InsetCollapsable::Collapsed: collapsedRB->setChecked(true); break;
}
}
Dialog * createGuiERT(GuiView & lv) { return new GuiERT(lv); }
} // namespace frontend
} // namespace lyx

View File

@ -12,27 +12,24 @@
#ifndef GUIERT_H
#define GUIERT_H
#include "InsetDialog.h"
#include "InsetParamsWidget.h"
#include "ui_ERTUi.h"
namespace lyx {
namespace frontend {
class GuiERT : public InsetDialog, public Ui::ERTUi
class GuiERT : public InsetParamsWidget, public Ui::ERTUi
{
Q_OBJECT
public:
GuiERT(GuiView & lv);
GuiERT(QWidget * parent = 0);
private:
/// \name Dialog inerited methods
//@{
void enableView(bool enable);
//@}
/// \name InsetDialog inherited methods
/// \name InsetParamsWidget inherited methods
//@{
InsetCode insetCode() { return ERT_CODE; }
FuncCode creationCode() { return LFUN_INSET_INSERT; }
void paramsToDialog(Inset 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"), ""};
GuiInfo::GuiInfo(GuiView & lv)
: InsetDialog(lv, INFO_CODE, LFUN_INFO_INSERT, "info", "Info")
GuiInfo::GuiInfo(QWidget * parent) : InsetParamsWidget(parent)
{
setupUi(this);
@ -57,8 +56,8 @@ GuiInfo::GuiInfo(GuiView & lv)
typeCO->addItem(qt_(info_types_gui[n]));
typeCO->blockSignals(false);
connect(typeCO, SIGNAL(currentIndexChanged(int)), this, SLOT(applyView()));
connect(nameLE, SIGNAL(textChanged(QString)), this, SLOT(applyView()));
connect(typeCO, SIGNAL(currentIndexChanged(int)), this, SIGNAL(changed()));
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 lyx

View File

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

View File

@ -21,8 +21,9 @@
#include "qt_helpers.h"
#include "Validator.h"
#include "Spacing.h"
#include "FuncRequest.h"
#include "Spacing.h"
#include "VSpace.h"
#include "insets/InsetVSpace.h"
@ -39,48 +40,24 @@ using namespace std;
namespace lyx {
namespace frontend {
GuiVSpace::GuiVSpace(GuiView & lv)
: GuiDialog(lv, "vspace", qt_("Vertical Space Settings"))
GuiVSpace::GuiVSpace(QWidget * parent) : InsetParamsWidget(parent)
{
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)),
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)),
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));
// 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
bc().addCheckedLineEdit(valueLE, valueL);
}
void GuiVSpace::change_adaptor()
{
changed();
addCheckedWidget(valueLE, valueL);
}
@ -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
// the input field, do not insert a vspace at all.
if (spacingCO->currentIndex() == 5 && valueLE->text().isEmpty())
return;
return docstring();
params_ = setVSpaceFromWidgets(spacingCO->currentIndex(),
VSpace const params = setVSpaceFromWidgets(spacingCO->currentIndex(),
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 lyx

View File

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

View File

@ -3437,12 +3437,12 @@ void GuiView::updateDialogs()
updateLayoutList();
}
Dialog * createDialog(GuiView & lv, string const & name);
// will be replaced by a proper factory...
Dialog * createGuiAbout(GuiView & lv);
Dialog * createGuiBibitem(GuiView & lv);
Dialog * createGuiBibtex(GuiView & lv);
Dialog * createGuiBox(GuiView & lv);
Dialog * createGuiBranch(GuiView & lv);
Dialog * createGuiChanges(GuiView & lv);
Dialog * createGuiCharacter(GuiView & lv);
@ -3451,13 +3451,10 @@ Dialog * createGuiCompare(GuiView & lv);
Dialog * createGuiDelimiter(GuiView & lv);
Dialog * createGuiDocument(GuiView & lv);
Dialog * createGuiErrorList(GuiView & lv);
Dialog * createGuiERT(GuiView & lv);
Dialog * createGuiExternal(GuiView & lv);
Dialog * createGuiFloat(GuiView & lv);
Dialog * createGuiGraphics(GuiView & lv);
Dialog * createGuiInclude(GuiView & lv);
Dialog * createGuiIndex(GuiView & lv);
Dialog * createGuiInfo(GuiView & lv);
Dialog * createGuiLabel(GuiView & lv);
Dialog * createGuiListings(GuiView & lv);
Dialog * createGuiLog(GuiView & lv);
@ -3485,7 +3482,6 @@ Dialog * createGuiTextHSpace(GuiView & lv);
Dialog * createGuiToc(GuiView & lv);
Dialog * createGuiThesaurus(GuiView & lv);
Dialog * createGuiHyperlink(GuiView & lv);
Dialog * createGuiVSpace(GuiView & lv);
Dialog * createGuiViewSource(GuiView & lv);
Dialog * createGuiWrap(GuiView & lv);
Dialog * createGuiProgressView(GuiView & lv);
@ -3496,14 +3492,16 @@ Dialog * GuiView::build(string const & name)
{
LASSERT(isValidName(name), return 0);
Dialog * dialog = createDialog(*this, name);
if (dialog)
return dialog;
if (name == "aboutlyx")
return createGuiAbout(*this);
if (name == "bibitem")
return createGuiBibitem(*this);
if (name == "bibtex")
return createGuiBibtex(*this);
if (name == "box")
return createGuiBox(*this);
if (name == "branch")
return createGuiBranch(*this);
if (name == "changes")
@ -3518,8 +3516,6 @@ Dialog * GuiView::build(string const & name)
return createGuiDocument(*this);
if (name == "errorlist")
return createGuiErrorList(*this);
if (name == "ert")
return createGuiERT(*this);
if (name == "external")
return createGuiExternal(*this);
if (name == "file")
@ -3528,8 +3524,6 @@ Dialog * GuiView::build(string const & name)
return createGuiSearch(*this);
if (name == "findreplaceadv")
return createGuiSearchAdv(*this);
if (name == "float")
return createGuiFloat(*this);
if (name == "graphics")
return createGuiGraphics(*this);
if (name == "href")
@ -3540,8 +3534,6 @@ Dialog * GuiView::build(string const & name)
return createGuiIndex(*this);
if (name == "index_print")
return createGuiPrintindex(*this);
if (name == "info")
return createGuiInfo(*this);
if (name == "label")
return createGuiLabel(*this);
if (name == "listings")
@ -3590,8 +3582,6 @@ Dialog * GuiView::build(string const & name)
return createGuiToc(*this);
if (name == "view-source")
return createGuiViewSource(*this);
if (name == "vspace")
return createGuiVSpace(*this);
if (name == "wrap")
return createGuiWrap(*this);
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++ -*-
/**
* \file InsetDialog.h
* \file InsetParamsDialog.h
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
@ -9,10 +9,11 @@
* Full author contact details are available in file CREDITS.
*/
#ifndef INSET_DIALOG_H
#define INSET_DIALOG_H
#ifndef INSET_PARAMS_DIALOG_H
#define INSET_PARAMS_DIALOG_H
#include "DialogView.h"
#include "ui_InsetParamsUi.h"
#include "qt_i18n.h"
@ -22,15 +23,27 @@ class Inset;
namespace frontend {
class InsetParamsWidget;
class InsetDialog : public DialogView
class InsetParamsDialog : public DialogView, public Ui::InsetParamsUi
{
Q_OBJECT
public:
InsetDialog(GuiView & lv, InsetCode code, FuncCode creation_code,
char const * name, char const * display_name);
InsetParamsDialog(GuiView & lv, InsetParamsWidget * widget);
~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
//@{
void updateView();
@ -38,19 +51,6 @@ public:
bool isBufferDependent() 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
struct Private;
Private * d;
@ -59,4 +59,4 @@ private:
} // namespace frontend
} // 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 \
IconPalette.cpp \
InsertTableWidget.cpp \
InsetDialog.cpp \
InsetParamsDialog.cpp \
InsetParamsWidget.cpp \
LengthCombo.cpp \
LyXFileDialog.cpp \
LaTeXHighlighter.cpp \
@ -235,7 +236,8 @@ MOCHEADER = \
GuiWrap.h \
IconPalette.h \
InsertTableWidget.h \
InsetDialog.h \
InsetParamsDialog.h \
InsetParamsWidget.h \
LayoutBox.h \
LengthCombo.h \
LyXFileDialog.h \
@ -267,7 +269,6 @@ UIFILES = \
ExternalUi.ui \
FindAndReplaceUi.ui \
FloatPlacementUi.ui \
FloatUi.ui \
FontUi.ui \
GraphicsUi.ui \
HSpaceUi.ui \
@ -276,6 +277,7 @@ UIFILES = \
IndexUi.ui \
IndicesUi.ui \
InfoUi.ui \
InsetParamsUi.ui \
LabelUi.ui \
LanguageUi.ui \
LaTeXUi.ui \

View File

@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>BoxUi</class>
<widget class="QDialog" name="BoxUi">
<widget class="QWidget" name="BoxUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>356</width>
<height>288</height>
<width>261</width>
<height>245</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
<property name="sizeGripEnabled">
<property name="sizeGripEnabled" stdset="0">
<bool>true</bool>
</property>
<layout class="QGridLayout">
@ -181,61 +182,6 @@
</layout>
</widget>
</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">
<widget class="LengthCombo" name="heightUnitsLC">
<property name="enabled">
@ -367,8 +313,6 @@
<tabstop>ialignCO</tabstop>
<tabstop>halignCO</tabstop>
<tabstop>valignCO</tabstop>
<tabstop>closePB</tabstop>
<tabstop>newPB</tabstop>
</tabstops>
<includes>
<include location="local">qt_i18n.h</include>

View File

@ -1,18 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ERTUi</class>
<widget class="QDialog" name="ERTUi">
<widget class="QWidget" name="ERTUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>197</width>
<height>135</height>
<width>175</width>
<height>99</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
<property name="sizeGripEnabled">
<property name="sizeGripEnabled" stdset="0">
<bool>true</bool>
</property>
<layout class="QVBoxLayout">
@ -57,58 +58,6 @@
</layout>
</widget>
</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>
</widget>
<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>
<widget class="QDialog" name="InfoUi" >
<property name="geometry" >
<widget class="QWidget" name="InfoUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>320</width>
<height>131</height>
<height>75</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string/>
</property>
<property name="sizeGripEnabled" >
<property name="sizeGripEnabled" stdset="0">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout">
<item>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="typeLBL" >
<property name="text" >
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="typeLBL">
<property name="text">
<string>Information Type:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QComboBox" name="typeCO" />
<item row="0" column="1">
<widget class="QComboBox" name="typeCO"/>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="nameLBL" >
<property name="text" >
<item row="1" column="0">
<widget class="QLabel" name="nameLBL">
<property name="text">
<string>Information Name:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<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 row="1" column="1">
<widget class="QLineEdit" name="nameLE"/>
</item>
</layout>
</item>
</layout>
</widget>
<includes>
<include location="local" >qt_i18n.h</include>
<include location="local">qt_i18n.h</include>
</includes>
<resources/>
<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>
<widget class="QDialog" name="VSpaceUi" >
<property name="geometry" >
<widget class="QWidget" name="VSpaceUi">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>259</width>
<height>120</height>
<width>215</width>
<height>96</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string/>
</property>
<property name="sizeGripEnabled" >
<property name="sizeGripEnabled" stdset="0">
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<item row="3" column="0" colspan="3" >
<layout class="QHBoxLayout" >
<item>
<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" >
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="spacingL">
<property name="text">
<string>&amp;Spacing:</string>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>spacingCO</cstring>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2" >
<widget class="QCheckBox" name="keepCB" >
<property name="toolTip" >
<item row="2" column="1" colspan="2">
<widget class="QCheckBox" name="keepCB">
<property name="toolTip">
<string>Insert the spacing even after a page break</string>
</property>
<property name="text" >
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="keepL" >
<property name="toolTip" >
<item row="2" column="0">
<widget class="QLabel" name="keepL">
<property name="toolTip">
<string/>
</property>
<property name="text" >
<property name="text">
<string>&amp;Protect:</string>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>keepCB</cstring>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="LengthCombo" name="unitCO" />
<item row="1" column="2">
<widget class="LengthCombo" name="unitCO"/>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="valueLE" >
<property name="enabled" >
<item row="1" column="1">
<widget class="QLineEdit" name="valueLE">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip" >
<string>Custom value. Needs spacing type "Custom".</string>
<property name="toolTip">
<string>Custom value. Needs spacing type &quot;Custom&quot;.</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="valueL" >
<property name="text" >
<item row="1" column="0">
<widget class="QLabel" name="valueL">
<property name="text">
<string>&amp;Value:</string>
</property>
<property name="buddy" >
<property name="buddy">
<cstring>valueLE</cstring>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QComboBox" name="spacingCO" >
<property name="toolTip" >
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="spacingCO">
<property name="toolTip">
<string>Supported spacing types</string>
</property>
<item>
<property name="text" >
<property name="text">
<string>DefSkip</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>SmallSkip</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>MedSkip</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>BigSkip</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>VFill</string>
</property>
</item>
<item>
<property name="text" >
<property name="text">
<string>Custom</string>
</property>
</item>
@ -160,12 +124,9 @@
<tabstop>valueLE</tabstop>
<tabstop>unitCO</tabstop>
<tabstop>keepCB</tabstop>
<tabstop>okPB</tabstop>
<tabstop>applyPB</tabstop>
<tabstop>closePB</tabstop>
</tabstops>
<includes>
<include location="local" >qt_i18n.h</include>
<include location="local">qt_i18n.h</include>
</includes>
<resources/>
<connections/>