the attached patch fp.diff * implements the float widget as a .ui file * renames from floatplacement.[Ch] -> FloatPlacement.[Ch]
compare.diff shows the differences between the two files comments welcome thanks, ed.
Index: src/frontends/qt4/QFloatDialog.C =================================================================== --- src/frontends/qt4/QFloatDialog.C (revision 14837) +++ src/frontends/qt4/QFloatDialog.C (working copy) @@ -12,13 +12,14 @@ #include "QFloatDialog.h" #include "QFloat.h" -//Added by qt3to4: + #include <QCloseEvent> -#include "floatplacement.h" +#include <QPushButton> -#include <qpushbutton.h> +#include "FloatPlacement.h" + namespace lyx { namespace frontend { Index: src/frontends/qt4/FloatPlacement.C =================================================================== --- src/frontends/qt4/FloatPlacement.C (revision 0) +++ src/frontends/qt4/FloatPlacement.C (revision 0) @@ -0,0 +1,242 @@ +/** + * \file floatplacement.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Edwin Leuven + * \author John Levon + * + * Full author contact details are available in file CREDITS. + */ + +#include <config.h> + +#include "FloatPlacement.h" +#include "qt_helpers.h" + +#include "insets/insetfloat.h" +#include "support/lstrings.h" + +using lyx::support::contains; +using std::string; + +FloatPlacement::FloatPlacement(QWidget *) +{ + setupUi(this); + + connect(heredefinitelyCB, SIGNAL(clicked()), this, SLOT(heredefinitelyClicked())); + connect(topCB, SIGNAL(clicked()), this, SLOT(tbhpClicked())); + connect(bottomCB, SIGNAL(clicked()), this, SLOT(tbhpClicked())); + connect(pageCB, SIGNAL(clicked()), this, SLOT(tbhpClicked())); + connect(herepossiblyCB, SIGNAL(clicked()), this, SLOT(tbhpClicked())); + connect(defaultsCB, SIGNAL(clicked()), this, SLOT(tbhpClicked())); + + connect(defaultsCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); + connect(ignoreCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); + connect(pageCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); + connect(heredefinitelyCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); + connect(herepossiblyCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); + connect(bottomCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); + connect(topCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); + + spanCB->hide(); + sidewaysCB->hide(); +} + + +FloatPlacement::~FloatPlacement() +{ +} + + +void FloatPlacement::useWide() +{ + spanCB->show(); +} + + +void FloatPlacement::useSideways() +{ + sidewaysCB->show(); +} + + +void FloatPlacement::changedSlot() +{ + // emit signal + changed(); +} + + +void FloatPlacement::set(string const & placement) +{ + bool def_placement = false; + bool top = false; + bool bottom = false; + bool page = false; + bool here = false; + bool force = false; + bool here_definitely = false; + + if (placement.empty()) { + def_placement = true; + } else if (contains(placement, 'H')) { + here_definitely = true; + } else { + if (contains(placement, '!')) { + force = true; + } + if (contains(placement, 't')) { + top = true; + } + if (contains(placement, 'b')) { + bottom = true; + } + if (contains(placement, 'p')) { + page = true; + } + if (contains(placement, 'h')) { + here = true; + } + } + + defaultsCB->setChecked(def_placement); + topCB->setChecked(top); + bottomCB->setChecked(bottom); + pageCB->setChecked(page); + herepossiblyCB->setChecked(here); + ignoreCB->setChecked(force); + ignoreCB->setEnabled(top || bottom || page || here); + heredefinitelyCB->setChecked(here_definitely); + checkAllowed(); +} + + +void FloatPlacement::set(InsetFloatParams const & params) +{ + set(params.placement); + + if (params.wide) { + herepossiblyCB->setChecked(false); + heredefinitelyCB->setChecked(false); + bottomCB->setChecked(false); + } + + spanCB->setChecked(params.wide); + sidewaysCB->setChecked(params.sideways); + sidewaysCB->setEnabled(params.type == "figure" + || params.type == "table"); + checkAllowed(); +} + + +string const FloatPlacement::get(bool & wide, bool & sideways) const +{ + wide = spanCB->isChecked(); + sideways = sidewaysCB->isChecked(); + + return get(); +} + + +string const FloatPlacement::get() const +{ + string placement; + + if (defaultsCB->isChecked()) + return placement; + + if (heredefinitelyCB->isChecked()) { + placement += 'H'; + } else { + if (ignoreCB->isChecked()) { + placement += '!'; + } + if (topCB->isChecked()) { + placement += 't'; + } + if (bottomCB->isChecked()) { + placement += 'b'; + } + if (pageCB->isChecked()) { + placement += 'p'; + } + if (herepossiblyCB->isChecked()) { + placement += 'h'; + } + } + return placement; +} + + +void FloatPlacement::tbhpClicked() +{ + heredefinitelyCB->setChecked(false); + checkAllowed(); +} + + +void FloatPlacement::heredefinitelyClicked() +{ + if (heredefinitelyCB->isChecked()) + ignoreCB->setEnabled(false); + + topCB->setChecked(false); + bottomCB->setChecked(false); + pageCB->setChecked(false); + herepossiblyCB->setChecked(false); + ignoreCB->setChecked(false); +} + + +void FloatPlacement::spanClicked() +{ + checkAllowed(); + + if (!spanCB->isChecked()) + return; + + herepossiblyCB->setChecked(false); + heredefinitelyCB->setChecked(false); + bottomCB->setChecked(false); +} + + +void FloatPlacement::sidewaysClicked() +{ + checkAllowed(); +} + + +void FloatPlacement::checkAllowed() +{ + bool const defaults(defaultsCB->isChecked()); + bool ignore(topCB->isChecked()); + ignore |= bottomCB->isChecked(); + ignore |= pageCB->isChecked(); + ignore |= herepossiblyCB->isChecked(); + + // float or document dialog? + if (spanCB->isVisible()) { + bool const span(spanCB->isChecked()); + bool const sideways(sidewaysCB->isChecked()); + defaultsCB->setEnabled(!sideways); + topCB->setEnabled(!sideways && !defaults); + bottomCB->setEnabled(!sideways && !defaults && !span); + pageCB->setEnabled(!sideways && !defaults); + ignoreCB->setEnabled(!sideways && !defaults && ignore); + herepossiblyCB->setEnabled(!sideways && !defaults && !span); + heredefinitelyCB->setEnabled(!sideways && !defaults && !span); + spanCB->setEnabled(!sideways); + } else { + topCB->setEnabled(!defaults); + bottomCB->setEnabled(!defaults); + pageCB->setEnabled(!defaults); + ignoreCB->setEnabled(!defaults && ignore); + herepossiblyCB->setEnabled(!defaults); + heredefinitelyCB->setEnabled(!defaults); + } +} + + +#include "FloatPlacement_moc.cpp" Index: src/frontends/qt4/Makefile.dialogs =================================================================== --- src/frontends/qt4/Makefile.dialogs (revision 14837) +++ src/frontends/qt4/Makefile.dialogs (working copy) @@ -4,6 +4,7 @@ BiblioUi.ui \ BranchesUi.ui \ BulletsUi.ui \ + FloatPlacementUi.ui \ FontUi.ui \ TextLayoutUi.ui \ LanguageUi.ui \ @@ -76,7 +77,7 @@ BulletsModule.C BulletsModule.h \ emptytable.C emptytable.h \ FileDialog_private.C FileDialog_private.h \ - floatplacement.C floatplacement.h \ + FloatPlacement.C FloatPlacement.h \ GuiView.C GuiView.h \ GuiWorkArea.C GuiWorkArea.h \ iconpalette.C iconpalette.h \ Index: src/frontends/qt4/QFloat.C =================================================================== --- src/frontends/qt4/QFloat.C (revision 14837) +++ src/frontends/qt4/QFloat.C (working copy) @@ -13,13 +13,13 @@ #include "QFloat.h" #include "QFloatDialog.h" #include "Qt2BC.h" -#include "floatplacement.h" +#include "FloatPlacement.h" #include "controllers/ControlFloat.h" #include "insets/insetfloat.h" -#include <qpushbutton.h> +#include <QPushButton> namespace lyx { namespace frontend { Index: src/frontends/qt4/FloatPlacement.h =================================================================== --- src/frontends/qt4/FloatPlacement.h (revision 0) +++ src/frontends/qt4/FloatPlacement.h (revision 0) @@ -0,0 +1,51 @@ +// -*- C++ -*- +/** + * \file floatplacement.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Edwin Leuven + * \author John Levon + * + * Full author contact details are available in file CREDITS. + */ + +#ifndef QT_FLOATPLACEMENT_H +#define QT_FLOATPLACEMENT_H + +#include "ui/FloatPlacementUi.h" +#include <QWidget> + +#include <string> + +class InsetFloatParams; + +class FloatPlacement : public QWidget, public Ui::FloatPlacementUi { + Q_OBJECT +public: + FloatPlacement(QWidget * parent = 0); + ~FloatPlacement(); + + void useWide(); + void useSideways(); + + void set(InsetFloatParams const & params); + void set(std::string const & placement); + void checkAllowed(); + + std::string const get(bool & wide, bool & sideways) const; + std::string const get() const; + +public Q_SLOTS: + void tbhpClicked(); + void heredefinitelyClicked(); + void spanClicked(); + void sidewaysClicked(); + void changedSlot(); + +Q_SIGNALS: + void changed(); + +}; + +#endif Index: src/frontends/qt4/QDocumentDialog.C =================================================================== --- src/frontends/qt4/QDocumentDialog.C (revision 14837) +++ src/frontends/qt4/QDocumentDialog.C (working copy) @@ -16,7 +16,7 @@ #include <QCloseEvent> -#include "floatplacement.h" +#include "FloatPlacement.h" #include "lengthcombo.h" #include "validators.h" #include "panelstack.h" Index: src/frontends/qt4/floatplacement.C =================================================================== --- src/frontends/qt4/floatplacement.C (revision 14836) +++ src/frontends/qt4/floatplacement.C (working copy) @@ -1,291 +0,0 @@ -/** - * \file floatplacement.C - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Edwin Leuven - * \author John Levon - * - * Full author contact details are available in file CREDITS. - */ - -#include <config.h> - -#include "floatplacement.h" -#include "qt_helpers.h" -//Added by qt3to4: -#include <QVBoxLayout> -#include <QHBoxLayout> - -#include "insets/insetfloat.h" -#include "support/lstrings.h" - -#include <QCheckBox> -#include <QLayout> -#include <QGroupBox> - -using lyx::support::contains; - -using std::string; - - -// FIXME: set disabled doesn't work properly -// should be fixed now (jspitzm) -FloatPlacement::FloatPlacement(QWidget * parent) - : QWidget(parent) -{ - QHBoxLayout * toplayout = new QHBoxLayout(this); - toplayout->setMargin(11); - toplayout->setSpacing(6); - - layout = new QVBoxLayout(0); - layout->setMargin(0); - layout->setSpacing(6); - - QGroupBox * options = new QGroupBox(qt_("Advanced Placement Options"), this); - - defaultsCB = new QCheckBox(qt_("Use &default placement"), this); - topCB = new QCheckBox(qt_("&Top of page"), options); - bottomCB = new QCheckBox(qt_("&Bottom of page"), options); - pageCB = new QCheckBox(qt_("&Page of floats"), options); - herepossiblyCB = new QCheckBox(qt_("&Here if possible"), options); - heredefinitelyCB = new QCheckBox(qt_("Here definitely"), options); - ignoreCB = new QCheckBox(qt_("&Ignore LaTeX rules"), options); - spanCB = 0; - sidewaysCB = 0; - - layout->addWidget(defaultsCB); - - QVBoxLayout * optlay = new QVBoxLayout(options); - optlay->setMargin(10); - optlay->setSpacing(6); - - optlay->addSpacing(6); - optlay->addWidget(topCB); - optlay->addWidget(bottomCB); - optlay->addWidget(pageCB); - optlay->addWidget(herepossiblyCB); - optlay->addWidget(heredefinitelyCB); - optlay->addWidget(ignoreCB); - - layout->addWidget(options); - - toplayout->addLayout(layout); - - connect(defaultsCB, SIGNAL(toggled(bool)), options, SLOT(setDisabled(bool))); - - connect(heredefinitelyCB, SIGNAL(clicked()), this, SLOT(heredefinitelyClicked())); - connect(topCB, SIGNAL(clicked()), this, SLOT(tbhpClicked())); - connect(bottomCB, SIGNAL(clicked()), this, SLOT(tbhpClicked())); - connect(pageCB, SIGNAL(clicked()), this, SLOT(tbhpClicked())); - connect(herepossiblyCB, SIGNAL(clicked()), this, SLOT(tbhpClicked())); - connect(defaultsCB, SIGNAL(clicked()), this, SLOT(tbhpClicked())); - - connect(defaultsCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); - connect(ignoreCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); - connect(pageCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); - connect(heredefinitelyCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); - connect(herepossiblyCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); - connect(bottomCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); - connect(topCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); -} - - -void FloatPlacement::useWide() -{ - spanCB = new QCheckBox(qt_("&Span columns"), this); - layout->addWidget(spanCB); - setTabOrder(ignoreCB, spanCB); - connect(spanCB, SIGNAL(clicked()), this, SLOT(spanClicked())); - connect(spanCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); -} - - -void FloatPlacement::useSideways() -{ - sidewaysCB = new QCheckBox(qt_("&Rotate sideways"), this); - layout->addWidget(sidewaysCB); - setTabOrder(spanCB, sidewaysCB); - connect(sidewaysCB, SIGNAL(clicked()), this, SLOT(sidewaysClicked())); - connect(sidewaysCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); -} - - -void FloatPlacement::changedSlot() -{ - // emit signal - changed(); -} - - -void FloatPlacement::set(string const & placement) -{ - bool def_placement = false; - bool top = false; - bool bottom = false; - bool page = false; - bool here = false; - bool force = false; - bool here_definitely = false; - - if (placement.empty()) { - def_placement = true; - } else if (contains(placement, 'H')) { - here_definitely = true; - } else { - if (contains(placement, '!')) { - force = true; - } - if (contains(placement, 't')) { - top = true; - } - if (contains(placement, 'b')) { - bottom = true; - } - if (contains(placement, 'p')) { - page = true; - } - if (contains(placement, 'h')) { - here = true; - } - } - - defaultsCB->setChecked(def_placement); - topCB->setChecked(top); - bottomCB->setChecked(bottom); - pageCB->setChecked(page); - herepossiblyCB->setChecked(here); - ignoreCB->setChecked(force); - ignoreCB->setEnabled(top || bottom || page || here); - heredefinitelyCB->setChecked(here_definitely); - checkAllowed(); -} - - -void FloatPlacement::set(InsetFloatParams const & params) -{ - set(params.placement); - - if (params.wide) { - herepossiblyCB->setChecked(false); - heredefinitelyCB->setChecked(false); - bottomCB->setChecked(false); - } - - spanCB->setChecked(params.wide); - sidewaysCB->setChecked(params.sideways); - sidewaysCB->setEnabled(params.type == "figure" - || params.type == "table"); - checkAllowed(); -} - - -string const FloatPlacement::get(bool & wide, bool & sideways) const -{ - wide = spanCB->isChecked(); - sideways = sidewaysCB->isChecked(); - - return get(); -} - - -string const FloatPlacement::get() const -{ - string placement; - - if (defaultsCB->isChecked()) - return placement; - - if (heredefinitelyCB->isChecked()) { - placement += 'H'; - } else { - if (ignoreCB->isChecked()) { - placement += '!'; - } - if (topCB->isChecked()) { - placement += 't'; - } - if (bottomCB->isChecked()) { - placement += 'b'; - } - if (pageCB->isChecked()) { - placement += 'p'; - } - if (herepossiblyCB->isChecked()) { - placement += 'h'; - } - } - return placement; -} - - -void FloatPlacement::tbhpClicked() -{ - heredefinitelyCB->setChecked(false); - checkAllowed(); -} - - -void FloatPlacement::heredefinitelyClicked() -{ - if (heredefinitelyCB->isChecked()) - ignoreCB->setEnabled(false); - - topCB->setChecked(false); - bottomCB->setChecked(false); - pageCB->setChecked(false); - herepossiblyCB->setChecked(false); - ignoreCB->setChecked(false); -} - - -void FloatPlacement::spanClicked() -{ - checkAllowed(); - - if (!spanCB->isChecked()) - return; - - herepossiblyCB->setChecked(false); - heredefinitelyCB->setChecked(false); - bottomCB->setChecked(false); -} - - -void FloatPlacement::sidewaysClicked() -{ - checkAllowed(); -} - - -void FloatPlacement::checkAllowed() -{ - bool const defaults(defaultsCB->isChecked()); - bool ignore(topCB->isChecked()); - ignore |= bottomCB->isChecked(); - ignore |= pageCB->isChecked(); - ignore |= herepossiblyCB->isChecked(); - - // float or document dialog? - if (spanCB != 0) { - bool const span(spanCB->isChecked()); - bool const sideways(sidewaysCB->isChecked()); - defaultsCB->setEnabled(!sideways); - topCB->setEnabled(!sideways && !defaults); - bottomCB->setEnabled(!sideways && !defaults && !span); - pageCB->setEnabled(!sideways && !defaults); - ignoreCB->setEnabled(!sideways && !defaults && ignore); - herepossiblyCB->setEnabled(!sideways && !defaults && !span); - heredefinitelyCB->setEnabled(!sideways && !defaults && !span); - spanCB->setEnabled(!sideways); - } else { - topCB->setEnabled(!defaults); - bottomCB->setEnabled(!defaults); - pageCB->setEnabled(!defaults); - ignoreCB->setEnabled(!defaults && ignore); - herepossiblyCB->setEnabled(!defaults); - heredefinitelyCB->setEnabled(!defaults); - } -} - -#include "floatplacement_moc.cpp" Index: src/frontends/qt4/ui/FloatPlacementUi.ui =================================================================== --- src/frontends/qt4/ui/FloatPlacementUi.ui (revision 0) +++ src/frontends/qt4/ui/FloatPlacementUi.ui (revision 0) @@ -0,0 +1,125 @@ +<ui version="4.0" > + <author></author> + <comment></comment> + <exportmacro></exportmacro> + <class>FloatPlacementUi</class> + <widget class="QWidget" name="FloatPlacementUi" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>211</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle" > + <string>Form</string> + </property> + <layout class="QVBoxLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QCheckBox" name="defaultsCB" > + <property name="text" > + <string>Use &default placement</string> + </property> + </widget> + </item> + <item> + <widget class="QGroupBox" name="options" > + <property name="title" > + <string>Advanced Placement Options</string> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>9</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="0" column="0" > + <widget class="QCheckBox" name="topCB" > + <property name="text" > + <string>&Top of page</string> + </property> + </widget> + </item> + <item row="5" column="0" > + <widget class="QCheckBox" name="ignoreCB" > + <property name="text" > + <string>&Ignore LaTeX rules</string> + </property> + </widget> + </item> + <item row="4" column="0" > + <widget class="QCheckBox" name="heredefinitelyCB" > + <property name="text" > + <string>Here de&finitely</string> + </property> + </widget> + </item> + <item row="3" column="0" > + <widget class="QCheckBox" name="herepossiblyCB" > + <property name="text" > + <string>&Here if possible</string> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QCheckBox" name="pageCB" > + <property name="text" > + <string>&Page of floats</string> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QCheckBox" name="bottomCB" > + <property name="text" > + <string>&Bottom of page</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QCheckBox" name="spanCB" > + <property name="text" > + <string>&Span columns</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="sidewaysCB" > + <property name="text" > + <string>&Rotate sideways</string> + </property> + </widget> + </item> + </layout> + </widget> + <pixmapfunction></pixmapfunction> + <resources/> + <connections> + <connection> + <sender>defaultsCB</sender> + <signal>toggled(bool)</signal> + <receiver>options</receiver> + <slot>setDisabled(bool)</slot> + <hints> + <hint type="sourcelabel" > + <x>51</x> + <y>20</y> + </hint> + <hint type="destinationlabel" > + <x>201</x> + <y>47</y> + </hint> + </hints> + </connection> + </connections> +</ui> Index: src/frontends/qt4/ui/QFloatUi.ui =================================================================== --- src/frontends/qt4/ui/QFloatUi.ui (revision 14837) +++ src/frontends/qt4/ui/QFloatUi.ui (working copy) @@ -95,7 +95,7 @@ <customwidget> <class>FloatPlacement</class> <extends></extends> - <header>floatplacement.h</header> + <header>FloatPlacement.h</header> <container>1</container> <pixmap></pixmap> </customwidget> Index: src/frontends/qt4/floatplacement.h =================================================================== --- src/frontends/qt4/floatplacement.h (revision 14836) +++ src/frontends/qt4/floatplacement.h (working copy) @@ -1,64 +0,0 @@ -// -*- C++ -*- -/** - * \file floatplacement.h - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author Edwin Leuven - * \author John Levon - * - * Full author contact details are available in file CREDITS. - */ - -#ifndef QT_FLOATPLACEMENT_H -#define QT_FLOATPLACEMENT_H - -#include <QWidget> - -#include <string> - -class QCheckBox; -class QVBoxLayout; -class InsetFloatParams; - -class FloatPlacement : public QWidget { - Q_OBJECT - -public: - FloatPlacement(QWidget * parent=0); - - void useWide(); - void useSideways(); - - void set(InsetFloatParams const & params); - void set(std::string const & placement); - void checkAllowed(); - - std::string const get(bool & wide, bool & sideways) const; - std::string const get() const; - -public Q_SLOTS: - void tbhpClicked(); - void heredefinitelyClicked(); - void spanClicked(); - void sidewaysClicked(); - void changedSlot(); - -Q_SIGNALS: - void changed(); - -private: - QVBoxLayout * layout; - - QCheckBox * defaultsCB; - QCheckBox * spanCB; - QCheckBox * sidewaysCB; - QCheckBox * ignoreCB; - QCheckBox * pageCB; - QCheckBox * heredefinitelyCB; - QCheckBox * herepossiblyCB; - QCheckBox * bottomCB; - QCheckBox * topCB; -}; - -#endif Index: src/frontends/qt4/QDocument.C =================================================================== --- src/frontends/qt4/QDocument.C (revision 14837) +++ src/frontends/qt4/QDocument.C (working copy) @@ -16,7 +16,7 @@ #include "qt_helpers.h" #include "bufferparams.h" -#include "floatplacement.h" +#include "FloatPlacement.h" #include "gettext.h" #include "helper_funcs.h" // getSecond() #include "language.h" Index: development/scons/scons_manifest.py =================================================================== --- development/scons/scons_manifest.py (revision 14836) +++ development/scons/scons_manifest.py (working copy) @@ -669,7 +669,7 @@ BulletsModule.C emptytable.C FileDialog_private.C - floatplacement.C + FloatPlacement.C iconpalette.C lengthcombo.C panelstack.C @@ -824,7 +824,7 @@ QtView.h checkedwidgets.h emptytable.h - floatplacement.h + FloatPlacement.h iconpalette.h lcolorcache.h lengthcombo.h @@ -942,7 +942,7 @@ QtView.C checkedwidgets.C emptytable.C - floatplacement.C + FloatPlacement.C iconpalette.C lcolorcache.C lengthcombo.C @@ -1039,7 +1039,7 @@ BulletsModule.C emptytable.C FileDialog_private.C - floatplacement.C + FloatPlacement.C iconpalette.C lengthcombo.C InsertTableWidget.C @@ -1204,7 +1204,7 @@ UrlView.h checkedwidgets.h emptytable.h - floatplacement.h + FloatPlacement.h iconpalette.h lengthcombo.h panelstack.h @@ -1323,7 +1323,7 @@ UrlView.C checkedwidgets.C emptytable.C - floatplacement.C + FloatPlacement.C iconpalette.C lengthcombo.C lyx_gui.C
Index: src/frontends/qt4/floatplacement.C =================================================================== --- src/frontends/qt4/floatplacement.C (revision 14836) +++ src/frontends/qt4/floatplacement.C (working copy) @@ -13,67 +13,17 @@ #include "floatplacement.h" #include "qt_helpers.h" -//Added by qt3to4: -#include <QVBoxLayout> -#include <QHBoxLayout> #include "insets/insetfloat.h" #include "support/lstrings.h" -#include <QCheckBox> -#include <QLayout> -#include <QGroupBox> - using lyx::support::contains; - using std::string; - -// FIXME: set disabled doesn't work properly -// should be fixed now (jspitzm) -FloatPlacement::FloatPlacement(QWidget * parent) - : QWidget(parent) +FloatPlacement::FloatPlacement(QWidget *) { - QHBoxLayout * toplayout = new QHBoxLayout(this); - toplayout->setMargin(11); - toplayout->setSpacing(6); + setupUi(this); - layout = new QVBoxLayout(0); - layout->setMargin(0); - layout->setSpacing(6); - - QGroupBox * options = new QGroupBox(qt_("Advanced Placement Options"), this); - - defaultsCB = new QCheckBox(qt_("Use &default placement"), this); - topCB = new QCheckBox(qt_("&Top of page"), options); - bottomCB = new QCheckBox(qt_("&Bottom of page"), options); - pageCB = new QCheckBox(qt_("&Page of floats"), options); - herepossiblyCB = new QCheckBox(qt_("&Here if possible"), options); - heredefinitelyCB = new QCheckBox(qt_("Here definitely"), options); - ignoreCB = new QCheckBox(qt_("&Ignore LaTeX rules"), options); - spanCB = 0; - sidewaysCB = 0; - - layout->addWidget(defaultsCB); - - QVBoxLayout * optlay = new QVBoxLayout(options); - optlay->setMargin(10); - optlay->setSpacing(6); - - optlay->addSpacing(6); - optlay->addWidget(topCB); - optlay->addWidget(bottomCB); - optlay->addWidget(pageCB); - optlay->addWidget(herepossiblyCB); - optlay->addWidget(heredefinitelyCB); - optlay->addWidget(ignoreCB); - - layout->addWidget(options); - - toplayout->addLayout(layout); - - connect(defaultsCB, SIGNAL(toggled(bool)), options, SLOT(setDisabled(bool))); - connect(heredefinitelyCB, SIGNAL(clicked()), this, SLOT(heredefinitelyClicked())); connect(topCB, SIGNAL(clicked()), this, SLOT(tbhpClicked())); connect(bottomCB, SIGNAL(clicked()), this, SLOT(tbhpClicked())); @@ -88,26 +38,26 @@ connect(herepossiblyCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); connect(bottomCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); connect(topCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); + + spanCB->hide(); + sidewaysCB->hide(); } +FloatPlacement::~FloatPlacement() +{ +} + + void FloatPlacement::useWide() { - spanCB = new QCheckBox(qt_("&Span columns"), this); - layout->addWidget(spanCB); - setTabOrder(ignoreCB, spanCB); - connect(spanCB, SIGNAL(clicked()), this, SLOT(spanClicked())); - connect(spanCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); + spanCB->show(); } void FloatPlacement::useSideways() { - sidewaysCB = new QCheckBox(qt_("&Rotate sideways"), this); - layout->addWidget(sidewaysCB); - setTabOrder(spanCB, sidewaysCB); - connect(sidewaysCB, SIGNAL(clicked()), this, SLOT(sidewaysClicked())); - connect(sidewaysCB, SIGNAL(toggled(bool)), this, SLOT(changedSlot())); + sidewaysCB->show(); } @@ -267,7 +217,7 @@ ignore |= herepossiblyCB->isChecked(); // float or document dialog? - if (spanCB != 0) { + if (spanCB->isVisible()) { bool const span(spanCB->isChecked()); bool const sideways(sidewaysCB->isChecked()); defaultsCB->setEnabled(!sideways); @@ -288,4 +238,5 @@ } } + #include "floatplacement_moc.cpp" Index: src/frontends/qt4/floatplacement.h =================================================================== --- src/frontends/qt4/floatplacement.h (revision 14836) +++ src/frontends/qt4/floatplacement.h (working copy) @@ -13,19 +13,18 @@ #ifndef QT_FLOATPLACEMENT_H #define QT_FLOATPLACEMENT_H +#include "ui/FloatPlacementUi.h" #include <QWidget> #include <string> -class QCheckBox; -class QVBoxLayout; class InsetFloatParams; -class FloatPlacement : public QWidget { +class FloatPlacement : public QWidget, public Ui::FloatPlacementUi { Q_OBJECT - public: - FloatPlacement(QWidget * parent=0); + FloatPlacement(QWidget * parent = 0); + ~FloatPlacement(); void useWide(); void useSideways(); @@ -47,18 +46,6 @@ Q_SIGNALS: void changed(); -private: - QVBoxLayout * layout; - - QCheckBox * defaultsCB; - QCheckBox * spanCB; - QCheckBox * sidewaysCB; - QCheckBox * ignoreCB; - QCheckBox * pageCB; - QCheckBox * heredefinitelyCB; - QCheckBox * herepossiblyCB; - QCheckBox * bottomCB; - QCheckBox * topCB; }; #endif