]> git.lyx.org Git - features.git/commitdiff
GuiInfo: Migrate [New] push button slot to InsetDialog.
authorAbdelrazak Younes <younes@lyx.org>
Sat, 30 Jan 2010 15:30:49 +0000 (15:30 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sat, 30 Jan 2010 15:30:49 +0000 (15:30 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33276 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiInfo.cpp
src/frontends/qt4/GuiInfo.h
src/frontends/qt4/InsetDialog.cpp
src/frontends/qt4/InsetDialog.h

index 6c37c819f59069161399cd8f2bda3052004d2c8e..89ebfd298b63efc8299c15aa8861ce63b2cc47f8 100644 (file)
@@ -48,7 +48,7 @@ char const * info_types_gui[] =
 
 
 GuiInfo::GuiInfo(GuiView & lv)
-       : InsetDialog(lv, INFO_CODE, "info", qt_("Info"))
+       : InsetDialog(lv, INFO_CODE, LFUN_INFO_INSERT, "info", "Info")
 {
        setupUi(this);
 
@@ -59,15 +59,6 @@ GuiInfo::GuiInfo(GuiView & lv)
 }
 
 
-void GuiInfo::on_newPB_clicked()
-{
-       // FIXME: if we used a standard LFUN_INSET_INSERT command,
-       // This slot could be transferred to InsetDialog.
-       docstring const argument = dialogToParams();
-       dispatch(FuncRequest(LFUN_INFO_INSERT, argument));
-}
-
-
 void GuiInfo::on_typeCO_currentIndexChanged(int)
 {
        applyView();
index 562a9a1faf8a63e8e79b8d8c3d246574d38be8be..001a9a81af4312747c646ccad547bf7fbee6c61e 100644 (file)
@@ -34,7 +34,6 @@ public:
        //@}
 
 private Q_SLOTS:
-       void on_newPB_clicked();
        void on_typeCO_currentIndexChanged(int);
        void on_nameLE_textChanged(QString const &);
 
index 7f3e90fff7cdff2c20ced62d147a28612e872f75..38b543c1659c5fdfb1ee1d97787e5e1547b51931 100644 (file)
@@ -38,9 +38,10 @@ namespace frontend {
 /////////////////////////////////////////////////////////////////\r
 \r
 \r
-InsetDialog::InsetDialog(GuiView & lv, InsetCode code,\r
-                                                QString const & name, QString const & title)\r
-       : DialogView(lv, name, title), code_(code)\r
+InsetDialog::InsetDialog(GuiView & lv, InsetCode code, FuncCode creation_code,\r
+               char const * name, char const * display_name)\r
+       : DialogView(lv, name, qt_(display_name)), inset_code_(code),\r
+       creation_code_(creation_code)\r
 {\r
 }\r
 \r
@@ -51,9 +52,16 @@ void InsetDialog::on_closePB_clicked()
 }\r
 \r
 \r
+void InsetDialog::on_newPB_clicked()\r
+{\r
+       docstring const argument = dialogToParams();\r
+       dispatch(FuncRequest(creation_code_, argument));\r
+}\r
+\r
+\r
 void InsetDialog::applyView()\r
 {\r
-       Inset const * i = inset(code_);\r
+       Inset const * i = inset(inset_code_);\r
        if (!i)\r
                return;\r
        \r
@@ -67,7 +75,7 @@ void InsetDialog::applyView()
 \r
 void InsetDialog::updateView()\r
 {\r
-       Inset const * i = inset(code_);\r
+       Inset const * i = inset(inset_code_);\r
        if (i)\r
                paramsToDialog(i);\r
        else\r
index d6595d188e318ee4c8855a4de7dd78d52504ba62..bf0336df0aabe146fc8e2bc1a7b59a71e09034cd 100644 (file)
 \r
 #include "DialogView.h"\r
 \r
+#include "qt_i18n.h"\r
+\r
 namespace lyx {\r
 \r
 class Inset;\r
 \r
 namespace frontend {\r
 \r
+\r
 class InsetDialog : public DialogView\r
 {\r
        Q_OBJECT\r
 \r
 public:\r
-       InsetDialog(GuiView & lv, InsetCode code, \r
-               QString const & name, QString const & title);\r
+       InsetDialog(GuiView & lv, InsetCode code, FuncCode creation_code,\r
+               char const * name, char const * display_name);\r
 \r
        /// \name DialogView inherited methods\r
        //@{\r
@@ -38,6 +41,7 @@ public:
        //@}\r
 \r
 protected Q_SLOTS:\r
+       void on_newPB_clicked();\r
        void on_closePB_clicked();\r
 \r
 protected:\r
@@ -45,8 +49,12 @@ protected:
        virtual void paramsToDialog(Inset const *) = 0;\r
        ///\r
        virtual docstring dialogToParams() const = 0;\r
+\r
+private:\r
+       ///\r
+       InsetCode inset_code_;\r
        ///\r
-       InsetCode const code_;\r
+       FuncCode creation_code_;\r
 };\r
 \r
 } // namespace frontend\r