mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-23 00:38:01 +00:00
do what the FIXME suggested
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23486 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
cdf8979160
commit
a500e62902
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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_;
|
||||
///
|
||||
|
@ -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"
|
@ -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; }
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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; }
|
||||
|
@ -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 \
|
||||
|
Loading…
x
Reference in New Issue
Block a user