From: André Pönitz Date: Wed, 5 Mar 2008 20:11:47 +0000 (+0000) Subject: do what the FIXME suggested X-Git-Tag: 1.6.10~5859 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=a500e629021cfe08c29a951a18623d02191d39ec;p=features.git do what the FIXME suggested git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23486 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/Dialog.cpp b/src/frontends/qt4/Dialog.cpp index 2be31a4ffc..7df839d56c 100644 --- a/src/frontends/qt4/Dialog.cpp +++ b/src/frontends/qt4/Dialog.cpp @@ -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(); } diff --git a/src/frontends/qt4/Dialog.h b/src/frontends/qt4/Dialog.h index fb0f1ac644..7b96d65390 100644 --- a/src/frontends/qt4/Dialog.h +++ b/src/frontends/qt4/Dialog.h @@ -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 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 index 433e22df6a..0000000000 --- a/src/frontends/qt4/DialogView.cpp +++ /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 - -#include "DialogView.h" - -#include "GuiView.h" -#include "qt_helpers.h" - -#include - -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" diff --git a/src/frontends/qt4/DialogView.h b/src/frontends/qt4/DialogView.h index a5394963dc..d34b83dff2 100644 --- a/src/frontends/qt4/DialogView.h +++ b/src/frontends/qt4/DialogView.h @@ -13,6 +13,7 @@ #define DIALOGVIEW_H #include "Dialog.h" +#include "GuiView.h" #include @@ -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; } diff --git a/src/frontends/qt4/DockView.h b/src/frontends/qt4/DockView.h index c94f9a685b..5b2cdd7a96 100644 --- a/src/frontends/qt4/DockView.h +++ b/src/frontends/qt4/DockView.h @@ -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 diff --git a/src/frontends/qt4/GuiDialog.cpp b/src/frontends/qt4/GuiDialog.cpp index 41f358e31c..d3f9836c08 100644 --- a/src/frontends/qt4/GuiDialog.cpp +++ b/src/frontends/qt4/GuiDialog.cpp @@ -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)) { } diff --git a/src/frontends/qt4/GuiDialog.h b/src/frontends/qt4/GuiDialog.h index 9f91385e30..ce9f2fcd6a 100644 --- a/src/frontends/qt4/GuiDialog.h +++ b/src/frontends/qt4/GuiDialog.h @@ -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. diff --git a/src/frontends/qt4/GuiMath.cpp b/src/frontends/qt4/GuiMath.cpp index a183a69a01..314b001c07 100644 --- a/src/frontends/qt4/GuiMath.cpp +++ b/src/frontends/qt4/GuiMath.cpp @@ -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 diff --git a/src/frontends/qt4/GuiMath.h b/src/frontends/qt4/GuiMath.h index c9665ba402..4d45cba98f 100644 --- a/src/frontends/qt4/GuiMath.h +++ b/src/frontends/qt4/GuiMath.h @@ -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; } diff --git a/src/frontends/qt4/Makefile.am b/src/frontends/qt4/Makefile.am index ee96106f46..225dca655b 100644 --- a/src/frontends/qt4/Makefile.am +++ b/src/frontends/qt4/Makefile.am @@ -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 \