]> git.lyx.org Git - features.git/commitdiff
do what the FIXME suggested
authorAndré Pönitz <poenitz@gmx.net>
Wed, 5 Mar 2008 20:11:47 +0000 (20:11 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 5 Mar 2008 20:11:47 +0000 (20:11 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23486 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/Dialog.cpp
src/frontends/qt4/Dialog.h
src/frontends/qt4/DialogView.cpp [deleted file]
src/frontends/qt4/DialogView.h
src/frontends/qt4/DockView.h
src/frontends/qt4/GuiDialog.cpp
src/frontends/qt4/GuiDialog.h
src/frontends/qt4/GuiMath.cpp
src/frontends/qt4/GuiMath.h
src/frontends/qt4/Makefile.am

index 2be31a4ffc4aff2343b140fab629afdfb53798f0..7df839d56cf56f8caf3bc44f75042a0977a4f5eb 100644 (file)
@@ -36,7 +36,7 @@ namespace lyx {
 namespace frontend {
 
 
-Dialog::Dialog(GuiView & lv, string const & name, QString const & title)
+Dialog::Dialog(GuiView & lv, QString const & name, QString const & title)
        : name_(name), title_(title), lyxview_(&lv)
 {}
 
@@ -45,15 +45,9 @@ Dialog::~Dialog()
 {}
 
 
-string const & Dialog::name() const
-{
-       return name_;
-}
-
-
 bool Dialog::canApply() const
 {
-       FuncRequest const fr(getLfun(), from_ascii(name_));
+       FuncRequest const fr(getLfun(), fromqstr(name_));
        FuncStatus const fs(getStatus(fr));
        return fs.enabled();
 }
@@ -68,13 +62,13 @@ void Dialog::dispatch(FuncRequest const & fr) const
 
 void Dialog::updateDialog() const
 {
-       dispatch(FuncRequest(LFUN_DIALOG_UPDATE, from_ascii(name_)));
+       dispatch(FuncRequest(LFUN_DIALOG_UPDATE, fromqstr(name_)));
 }
 
 
 void Dialog::disconnect() const
 {
-       lyxview_->disconnectDialog(name_);
+       lyxview_->disconnectDialog(fromqstr(name_));
 }
 
 
@@ -141,7 +135,7 @@ void Dialog::showData(string const & data)
                return;
 
        if (!initialiseParams(data)) {
-               LYXERR0("Dialog \"" << name()
+               LYXERR0("Dialog \"" << fromqstr(name())
                        << "\" failed to translate the data string passed to show()");
                return;
        }
@@ -175,7 +169,7 @@ void Dialog::updateData(string const & data)
                return;
 
        if (!initialiseParams(data)) {
-               LYXERR0("Dialog \"" << name()
+               LYXERR0("Dialog \"" << fromqstr(name())
                       << "\" could not be initialized");
                return;
        }
@@ -259,7 +253,7 @@ void Dialog::checkStatus()
 QString Dialog::sessionKey() const
 {
        return "view-" + QString::number(lyxview_->id())
-               + "/" + toqstr(name());
+               + "/" + name();
 }
 
 
index fb0f1ac644345a2eb3983cccaf03d1e72e4d3aa1..7b96d65390cc35eee15587f82bb9a8b53c7ba3f1 100644 (file)
@@ -51,7 +51,7 @@ public:
        /// \param name is the identifier given to the dialog by its parent
        /// container.
        /// \param title is the window title used for decoration.
-       Dialog(GuiView & lv, std::string const & name, QString const & title);
+       Dialog(GuiView & lv, QString const & name, QString const & title);
 
        virtual ~Dialog();
 
@@ -130,10 +130,7 @@ public:
        //@}
 
        /// Dialog identifier.
-       /// FIXME for Andre': Now that Dialog is entirely within qt4/
-       /// We can use QString instead in order to avoid <string> inclusion
-       /// or we can pimpl name_.
-       std::string const & name() const;
+       QString name() const { return name_; }
 
        //@{
        /** Enable the controller to initialise its data structures.
@@ -261,7 +258,7 @@ private:
        /** The Dialog's name is the means by which a dialog identifies
         *  itself to the LyXView.
         */
-       std::string const name_;
+       QString const name_;
        ///
        QString title_;
        ///
diff --git a/src/frontends/qt4/DialogView.cpp b/src/frontends/qt4/DialogView.cpp
deleted file mode 100644 (file)
index 433e22d..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * \file DialogView.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * \author Angus Leeming
- *
- * Full author contact details are available in file CREDITS.
- */
-
-#include <config.h>
-
-#include "DialogView.h"
-
-#include "GuiView.h"
-#include "qt_helpers.h"
-
-#include <QShowEvent>
-
-using namespace std;
-
-namespace lyx {
-namespace frontend {
-
-DialogView::DialogView(GuiView & lv, string const & name,
-       QString const & title)
-       : QDialog(&lv), Dialog(lv, name, "LyX: " + title)
-{}
-
-} // namespace frontend
-} // namespace lyx
-
-#include "DialogView_moc.cpp"
index a5394963dcf2fe6f5f3bee82078b6cd9a8c8637e..d34b83dff28f375f41060e88402a3ce4cd6545c9 100644 (file)
@@ -13,6 +13,7 @@
 #define DIALOGVIEW_H
 
 #include "Dialog.h"
+#include "GuiView.h"
 
 #include <QDialog>
 
@@ -24,15 +25,14 @@ namespace frontend {
  */
 class DialogView : public QDialog, public Dialog
 {
-       Q_OBJECT
-
 public:
        /// \param lv is the access point for the dialog to the LyX kernel.
        /// \param name is the identifier given to the dialog by its parent
        /// container.
        /// \param title is the window title used for decoration.
-       DialogView(GuiView & lv, std::string const & name, QString const & title);
-       virtual ~DialogView() {}
+       DialogView(GuiView & lv, QString const & name, QString const & title)
+               : QDialog(&lv), Dialog(lv, name, "LyX: " + title)
+       {}
 
        virtual QWidget * asQWidget() { return this; }
        virtual QWidget const * asQWidget() const { return this; }
index c94f9a685bcc7baa8824361d3c4cf1331816dfe6..5b2cdd7a96fa44185a95fc74b70a4f7a827ba7e6 100644 (file)
@@ -31,7 +31,7 @@ class DockView : public QDockWidget, public Dialog
 public:
        DockView(
                GuiView & parent, ///< the main window where to dock.
-               std::string const & name, ///< dialog identifier.
+               QString const & name, ///< dialog identifier.
                QString const & title, ///< dialog title.
                Qt::DockWidgetArea area = Qt::LeftDockWidgetArea, ///< Position of the dock (and also drawer)
                Qt::WindowFlags flags = 0
index 41f358e31c1729466e87806a1312a172892818fe..d3f9836c089d43476631262529efc760e03e5fc2 100644 (file)
@@ -13,6 +13,9 @@
 #include "GuiDialog.h"
 #include "GuiView.h"
 #include "qt_helpers.h"
+#include "FuncRequest.h"
+
+#include "insets/InsetCommand.h"
 
 #include "support/debug.h"
 
@@ -26,15 +29,15 @@ using namespace std;
 namespace lyx {
 namespace frontend {
 
-GuiDialog::GuiDialog(GuiView & lv, string const & name, QString const & title)
+GuiDialog::GuiDialog(GuiView & lv, QString const & name, QString const & title)
        :  QDialog(&lv), Dialog(lv, name, "LyX: " + title), is_closing_(false)
 {}
 
 
-void GuiDialog::closeEvent(QCloseEvent *e)
+void GuiDialog::closeEvent(QCloseEvent * ev)
 {
        slotClose();
-       e->accept();
+       ev->accept();
 }
 
 
@@ -109,9 +112,6 @@ void GuiDialog::updateView()
        setUpdatesEnabled(true);
 }
 
-} // namespace frontend
-} // namespace lyx
-
 
 /////////////////////////////////////////////////////////////////////
 //
@@ -119,17 +119,11 @@ void GuiDialog::updateView()
 //
 /////////////////////////////////////////////////////////////////////
 
-#include "FuncRequest.h"
-#include "insets/InsetCommand.h"
-
-using namespace std;
-
-namespace lyx {
-namespace frontend {
 
-GuiCommand::GuiCommand(GuiView & lv, string const & name,
+GuiCommand::GuiCommand(GuiView & lv, QString const & name,
        QString const & title)
-       : GuiDialog(lv, name, title), params_(insetCode(name)), lfun_name_(name)
+       : GuiDialog(lv, name, title), params_(insetCode(fromqstr(name))),
+               lfun_name_(fromqstr(name))
 {
 }
 
index 9f91385e30cb448593f9329dc9404d0fca489160..ce9f2fcd6a774ae7a3bb1d701c4a9e6512f94fee 100644 (file)
@@ -40,7 +40,7 @@ public:
        /// \param name is the identifier given to the dialog by its parent
        /// container.
        /// \param title is the window title used for decoration.
-       GuiDialog(GuiView & lv, std::string const & name, QString const & title);
+       GuiDialog(GuiView & lv, QString const & name, QString const & title);
 
        virtual QWidget * asQWidget() { return this; }
        virtual QWidget const * asQWidget() const { return this; }
@@ -114,7 +114,7 @@ class GuiCommand : public GuiDialog
 public:
        /// We need to know with what sort of inset we're associated.
        // FIXME This should probably be an InsetCode
-       GuiCommand(GuiView &, std::string const & name, QString const & title);
+       GuiCommand(GuiView &, QString const & name, QString const & title);
        ///
        bool initialiseParams(std::string const & data);
        /// clean-up on hide.
index a183a69a015580aaa2d3464cfdd726765317c5cd..314b001c078134edb2ff0a24910c2deefb2840aa 100644 (file)
@@ -21,7 +21,7 @@ using namespace std;
 namespace lyx {
 namespace frontend {
 
-GuiMath::GuiMath(GuiView & lv, string const & name, QString const & title)
+GuiMath::GuiMath(GuiView & lv, QString const & name, QString const & title)
        : GuiDialog(lv, name, title)
 {
        // FIXME: Ideally, those unicode codepoints would be defined
index c9665ba4024cd89ff46326d90222aa8cfb60bc6f..4d45cba98fd213136485e43dc5ce5f1e69d90b83 100644 (file)
@@ -36,7 +36,7 @@ struct MathSymbol {
 class GuiMath : public GuiDialog
 {
 public:
-       GuiMath(GuiView & lv, std::string const & name, QString const & title);
+       GuiMath(GuiView & lv, QString const & name, QString const & title);
 
        /// Nothing to initialise in this case.
        bool initialiseParams(std::string const &) { return true; }
index ee96106f467e1712ee575f3ed03cabad2f90ca8b..225dca655b81989df9fc14fe426695bdd27268c4 100644 (file)
@@ -49,7 +49,6 @@ SOURCEFILES = \
        ButtonPolicy.h \
        Dialog.cpp \
        Dialog.h \
-       DialogView.cpp \
        Resources.cpp \
        Action.cpp \
        BulletsModule.cpp \
@@ -138,6 +137,7 @@ SOURCEFILES = \
 NOMOCHEADER = \
        ButtonController.h \
        ColorCache.h \
+       DialogView.h \
        DockView.h \
        FileDialog.h \
        GuiFontExample.h \
@@ -157,7 +157,6 @@ MOCHEADER = \
        Action.h \
        BulletsModule.h \
        CustomizedWidgets.h \
-       DialogView.h \
        EmptyTable.h \
        FloatPlacement.h \
        GuiAbout.h \