]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt4/GuiFloat.cpp
* Migrate InsetFloat to InsetDialog
[features.git] / src / frontends / qt4 / GuiFloat.cpp
index cc1eff1ec13ce2ca7e4e46ac4282507da10b1136..832ed8396fabb9f326329c5f899d8dc98d306221 100644 (file)
 
 #include "GuiFloat.h"
 
-#include "ControlFloat.h"
 #include "FloatPlacement.h"
 
-#include "insets/InsetFloat.h"
+#include "FuncRequest.h"
 
-#include <QCloseEvent>
 #include <QPushButton>
 
+using namespace std;
 
 namespace lyx {
 namespace frontend {
 
-GuiFloatDialog::GuiFloatDialog(LyXView & lv)
-       : GuiDialog(lv, "float")
+GuiFloat::GuiFloat(GuiView & lv)
+       : InsetDialog(lv, FLOAT_CODE, LFUN_FLOAT_INSERT, "float", "Float Settings")
 {
-       setController(new ControlFloat(*this));
-       setViewTitle(_("Float Settings"));
-
        setupUi(this);
-       connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore()));
-       connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
-       connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply()));
-       connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
-
+       
        // enable span columns checkbox
        floatFP->useWide();
        // enable sideways checkbox
        floatFP->useSideways();
 
-       connect(floatFP, SIGNAL(changed()), this, SLOT(change_adaptor()));
-
-       bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
-
-       bc().setCancel(closePB);
-       bc().setApply(applyPB);
-       bc().setOK(okPB);
-       bc().setRestore(restorePB);
-
-       bc().addReadOnly(floatFP);
-}
-
-
-ControlFloat & GuiFloatDialog::controller() const
-{
-       return static_cast<ControlFloat &>(GuiDialog::controller());
+       connect(floatFP, SIGNAL(changed()), this, SLOT(applyView()));
 }
 
 
-void GuiFloatDialog::change_adaptor()
+void GuiFloat::enableView(bool enable)
 {
-       changed();
+       floatFP->setEnabled(enable);
 }
 
 
-void GuiFloatDialog::closeEvent(QCloseEvent * e)
+void GuiFloat::paramsToDialog(Inset const * inset)
 {
-       slotClose();
-       e->accept();
+       floatFP->paramsToDialog(inset);
 }
 
 
-void GuiFloatDialog::update_contents()
+docstring GuiFloat::dialogToParams() const
 {
-       floatFP->set(controller().params());
+       return floatFP->dialogToParams();
 }
 
-
-void GuiFloatDialog::applyView()
-{
-       InsetFloatParams & params = controller().params();
-       params.placement = floatFP->get(params.wide, params.sideways);
-}
+Dialog * createGuiFloat(GuiView & lv) { return new GuiFloat(lv); }
 
 } // namespace frontend
 } // namespace lyx
 
-#include "GuiFloat_moc.cpp"
+#include "moc_GuiFloat.cpp"