]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiTabularCreate.cpp
QDialogButtonBox for the remaining dialogs.
[lyx.git] / src / frontends / qt4 / GuiTabularCreate.cpp
index be59c0bec9b90e89a04ae1465bd313ab1ff47b27..f2c4f98264284d77e3cc23643c68977cfd6c8a2a 100644 (file)
 
 #include "support/convert.h"
 
-#include <QCloseEvent>
 #include <QSpinBox>
 #include <QPushButton>
 
-using std::string;
-
+using namespace std;
 
 namespace lyx {
 namespace frontend {
 
-GuiTabularCreate::GuiTabularCreate(LyXView & lv)
-       : GuiDialog(lv, "tabularcreate"), Controller(this)
+GuiTabularCreate::GuiTabularCreate(GuiView & lv)
+       : GuiDialog(lv, "tabularcreate", qt_("Insert Table"))
 {
        setupUi(this);
-       setViewTitle(_("Insert Table"));
-       setController(this, false);
 
        rowsSB->setValue(5);
        columnsSB->setValue(5);
+       table->setMinimumSize(100, 100);
+
+       connect(table, SIGNAL(rowsChanged(int)),
+               rowsSB, SLOT(setValue(int)));
+       connect(table, SIGNAL(colsChanged(int)),
+               columnsSB, SLOT(setValue(int)));
+       connect(rowsSB, SIGNAL(valueChanged(int)),
+               table, SLOT(setNumberRows(int)));
+       connect(columnsSB, SIGNAL(valueChanged(int)),
+               table, SLOT(setNumberColumns(int)));
 
-       connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK()));
-       connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose()));
+       connect(buttonBox, SIGNAL(clicked(QAbstractButton *)),
+               this, SLOT(slotButtonBox(QAbstractButton *)));
 
        connect(rowsSB, SIGNAL(valueChanged(int)),
                this, SLOT(rowsChanged(int)));
        connect(columnsSB, SIGNAL(valueChanged(int)),
                this, SLOT(columnsChanged(int)));
 
-       bc().setPolicy(ButtonPolicy::IgnorantPolicy);
-       bc().setOK(okPB);
-       bc().setCancel(closePB);
+       bc().setPolicy(ButtonPolicy::OkApplyCancelReadOnlyPolicy);
+       bc().setOK(buttonBox->button(QDialogButtonBox::Ok));
+       bc().setApply(buttonBox->button(QDialogButtonBox::Apply));
+       bc().setCancel(buttonBox->button(QDialogButtonBox::Cancel));
+       bc().setValid(isValid());
 }
 
 
@@ -87,12 +95,13 @@ void GuiTabularCreate::clearParams()
 
 void GuiTabularCreate::dispatchParams()
 {
-       string const data = convert<string>(params().first) + ' ' + convert<string>(params().second);
-       dispatch(FuncRequest(getLfun(), data));
+       string const sdata = 
+               convert<string>(params().first) + ' ' + convert<string>(params().second);
+       dispatch(FuncRequest(getLfun(), sdata));
 }
 
 
-Dialog * createGuiTabularCreate(LyXView & lv)
+Dialog * createGuiTabularCreate(GuiView & lv)
 {
        return new GuiTabularCreate(lv);
 }
@@ -101,4 +110,4 @@ Dialog * createGuiTabularCreate(LyXView & lv)
 } // namespace frontend
 } // namespace lyx
 
-#include "GuiTabularCreate_moc.cpp"
+#include "moc_GuiTabularCreate.cpp"