]> git.lyx.org Git - features.git/blobdiff - src/frontends/qt4/GuiFloat.cpp
* Migrate InsetFloat to InsetDialog
[features.git] / src / frontends / qt4 / GuiFloat.cpp
index 6b8abe01078688d1e205b74df284cd455f46aab7..832ed8396fabb9f326329c5f899d8dc98d306221 100644 (file)
 #include "GuiFloat.h"
 
 #include "FloatPlacement.h"
-#include "FuncRequest.h"
 
-#include "insets/InsetFloat.h"
+#include "FuncRequest.h"
 
-#include <QCloseEvent>
 #include <QPushButton>
 
-using std::string;
-
+using namespace std;
 
 namespace lyx {
 namespace frontend {
 
-GuiFloat::GuiFloat(LyXView & lv)
-       : GuiDialog(lv, "float"), Controller(this)
+GuiFloat::GuiFloat(GuiView & lv)
+       : InsetDialog(lv, FLOAT_CODE, LFUN_FLOAT_INSERT, "float", "Float Settings")
 {
-       setController(this, false);
-       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);
-}
-
-
-void GuiFloat::change_adaptor()
-{
-       changed();
-}
-
-
-void GuiFloat::closeEvent(QCloseEvent * e)
-{
-       slotClose();
-       e->accept();
-}
-
-
-void GuiFloat::updateContents()
-{
-       floatFP->set(params_);
+       connect(floatFP, SIGNAL(changed()), this, SLOT(applyView()));
 }
 
 
-void GuiFloat::applyView()
+void GuiFloat::enableView(bool enable)
 {
-       params_.placement = floatFP->get(params_.wide, params_.sideways);
+       floatFP->setEnabled(enable);
 }
 
 
-bool GuiFloat::initialiseParams(string const & data)
+void GuiFloat::paramsToDialog(Inset const * inset)
 {
-       InsetFloatMailer::string2params(data, params_);
-       return true;
+       floatFP->paramsToDialog(inset);
 }
 
 
-void GuiFloat::clearParams()
+docstring GuiFloat::dialogToParams() const
 {
-       params_ = InsetFloatParams();
+       return floatFP->dialogToParams();
 }
 
-
-void GuiFloat::dispatchParams()
-{
-       dispatch(FuncRequest(getLfun(), InsetFloatMailer::params2string(params_)));
-}
-
-
-Dialog * createGuiFloat(LyXView & lv) { return new GuiFloat(lv); }
-
+Dialog * createGuiFloat(GuiView & lv) { return new GuiFloat(lv); }
 
 } // namespace frontend
 } // namespace lyx
 
-#include "GuiFloat_moc.cpp"
+#include "moc_GuiFloat.cpp"