Patch 1 Log:

* controllers/Dialog.[Ch]
  - View::title_ is now a docstring (ctor and access functions changed)

* controllers/ControlLog.[Ch]
  - title() now returns a docstring

* controllers/ControlLog.[Ch]
  - title() now returns a docstring

* qt4/*: adapted to above changes.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15283 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-10-09 10:35:14 +00:00
parent e7c4a0554c
commit e6fea4b844
46 changed files with 73 additions and 65 deletions

View File

@ -19,6 +19,8 @@
#include <sstream> #include <sstream>
#include <fstream> #include <fstream>
using lyx::docstring;
using std::istringstream; using std::istringstream;
using std::ostream; using std::ostream;
using std::string; using std::string;
@ -70,21 +72,21 @@ void ControlLog::clearParams()
} }
string const ControlLog::title() const docstring const ControlLog::title() const
{ {
string t; docstring t;
switch (type_) { switch (type_) {
case LatexLog: case LatexLog:
t = lyx::to_utf8(_("LaTeX Log")); t = _("LaTeX Log");
break; break;
case LiterateLog: case LiterateLog:
t = lyx::to_utf8(_("Literate Programming Build Log")); t = _("Literate Programming Build Log");
break; break;
case Lyx2lyxLog: case Lyx2lyxLog:
t = lyx::to_utf8(_("lyx2lyx Error Log")); t = _("lyx2lyx Error Log");
break; break;
case VCLog: case VCLog:
t = lyx::to_utf8(_("Version Control Log")); t = _("Version Control Log");
break; break;
} }
return t; return t;

View File

@ -37,7 +37,7 @@ public:
virtual bool isBufferDependent() const { return true; } virtual bool isBufferDependent() const { return true; }
/// The title displayed by the dialog reflects the \c LOGTYPE /// The title displayed by the dialog reflects the \c LOGTYPE
std::string const title() const; lyx::docstring const title() const;
/// put the log file into the ostream /// put the log file into the ostream
void getContents(std::ostream & ss) const; void getContents(std::ostream & ss) const;

View File

@ -64,7 +64,7 @@ void ControlViewSource::clearParams()
} }
string const ControlViewSource::title() const docstring const ControlViewSource::title() const
{ {
string source_type; string source_type;
@ -81,7 +81,7 @@ string const ControlViewSource::title() const
default: default:
BOOST_ASSERT(false); BOOST_ASSERT(false);
} }
return lyx::to_utf8(_(source_type + " Source")); return _(source_type + " Source");
} }
} // namespace frontend } // namespace frontend

View File

@ -37,7 +37,7 @@ public:
virtual bool isBufferDependent() const { return true; } virtual bool isBufferDependent() const { return true; }
/// The title displayed by the dialog reflects source type. /// The title displayed by the dialog reflects source type.
std::string const title() const; lyx::docstring const title() const;
/** get the source code of selected paragraphs, or the whole document /** get the source code of selected paragraphs, or the whole document
\param fullSource get full source code \param fullSource get full source code

View File

@ -21,6 +21,7 @@
#include "FuncStatus.h" #include "FuncStatus.h"
#include "lyxfunc.h" #include "lyxfunc.h"
using lyx::docstring;
using std::string; using std::string;
@ -219,7 +220,7 @@ Dialog::Controller & Dialog::controller() const
} }
Dialog::View::View(Dialog & parent, string title) : Dialog::View::View(Dialog & parent, docstring title) :
p_(parent), title_(title) p_(parent), title_(title)
{} {}
@ -231,13 +232,13 @@ Dialog::View & Dialog::view() const
} }
void Dialog::View::setTitle(string const & newtitle) void Dialog::View::setTitle(docstring const & newtitle)
{ {
title_ = newtitle; title_ = newtitle;
} }
string const & Dialog::View::getTitle() const docstring const & Dialog::View::getTitle() const
{ {
return title_; return title_;
} }

View File

@ -15,6 +15,8 @@
#include "Kernel.h" #include "Kernel.h"
#include "lfuns.h" #include "lfuns.h"
#include "support/docstring.h"
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
@ -219,7 +221,7 @@ public:
/** \param parent Dialog owning this Controller. /** \param parent Dialog owning this Controller.
* \param title is the dialog title displayed by the WM. * \param title is the dialog title displayed by the WM.
*/ */
View(Dialog & parent, std::string title); View(Dialog & parent, lyx::docstring title);
virtual ~View() {} virtual ~View() {}
/** \name Generic View /** \name Generic View
@ -257,9 +259,9 @@ public:
virtual void partialUpdate(int id); virtual void partialUpdate(int id);
/// sets the title of the dialog (window caption) /// sets the title of the dialog (window caption)
void setTitle(std::string const &); void setTitle(lyx::docstring const &);
/// gets the title of the dialog (window caption) /// gets the title of the dialog (window caption)
std::string const & getTitle() const; lyx::docstring const & getTitle() const;
/** \name View Access /** \name View Access
* Enable the derived classes to access the other parts of the whole. * Enable the derived classes to access the other parts of the whole.
@ -281,7 +283,7 @@ protected:
private: private:
Dialog & p_; Dialog & p_;
std::string title_; lyx::docstring title_;
}; };
} // namespace frontend } // namespace frontend

View File

@ -213,13 +213,13 @@ Dialogs::DialogPtr Dialogs::build(string const & name)
} else if (name == "index") { } else if (name == "index") {
dialog->setController(new ControlCommand(*dialog, name)); dialog->setController(new ControlCommand(*dialog, name));
dialog->setView(new QIndex(*dialog, dialog->setView(new QIndex(*dialog,
lyx::to_utf8(_("Index Entry")), _("Index Entry"),
qt_("&Keyword:"))); qt_("&Keyword:")));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "label") { } else if (name == "label") {
dialog->setController(new ControlCommand(*dialog, name)); dialog->setController(new ControlCommand(*dialog, name));
dialog->setView(new QIndex(*dialog, dialog->setView(new QIndex(*dialog,
lyx::to_utf8(_("Label")), _("Label"),
qt_("&Label:"))); qt_("&Label:")));
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy); dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
} else if (name == "log") { } else if (name == "log") {

View File

@ -41,7 +41,7 @@ namespace frontend {
typedef QController<ControlAboutlyx, QView<QAboutDialog> > base_class; typedef QController<ControlAboutlyx, QView<QAboutDialog> > base_class;
QAbout::QAbout(Dialog & parent) QAbout::QAbout(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("About LyX"))) : base_class(parent, _("About LyX"))
{ {
} }

View File

@ -28,7 +28,7 @@ typedef QController<ControlCommand, QView<QBibitemDialog> > base_class;
QBibitem::QBibitem(Dialog & parent) QBibitem::QBibitem(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Bibliography Entry Settings"))) : base_class(parent, _("Bibliography Entry Settings"))
{ {
} }

View File

@ -44,7 +44,7 @@ namespace frontend {
typedef QController<ControlBibtex, QView<QBibtexDialog> > base_class; typedef QController<ControlBibtex, QView<QBibtexDialog> > base_class;
QBibtex::QBibtex(Dialog & parent) QBibtex::QBibtex(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("BibTeX Bibliography"))) : base_class(parent, _("BibTeX Bibliography"))
{ {
} }

View File

@ -46,7 +46,7 @@ namespace frontend {
typedef QController<ControlBox, QView<QBoxDialog> > base_class; typedef QController<ControlBox, QView<QBoxDialog> > base_class;
QBox::QBox(Dialog & parent) QBox::QBox(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Box Settings"))) : base_class(parent, _("Box Settings"))
{} {}

View File

@ -32,7 +32,7 @@ typedef QController<ControlBranch, QView<QBranchDialog> > base_class;
QBranch::QBranch(Dialog & parent) QBranch::QBranch(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Branch Settings"))) : base_class(parent, _("Branch Settings"))
{} {}

View File

@ -33,7 +33,7 @@ typedef QController<ControlChanges, QView<QChangesDialog> > base_class;
QChanges::QChanges(Dialog & parent) QChanges::QChanges(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Merge Changes"))) : base_class(parent, _("Merge Changes"))
{ {
} }

View File

@ -31,7 +31,7 @@ typedef QController<ControlCharacter, QView<QCharacterDialog> > base_class;
QCharacter::QCharacter(Dialog & parent) QCharacter::QCharacter(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Text Style"))) : base_class(parent, _("Text Style"))
{ {
} }

View File

@ -17,6 +17,7 @@
#include "qt_helpers.h" #include "qt_helpers.h"
#include "bufferparams.h" #include "bufferparams.h"
#include "gettext.h"
#include "controllers/ControlCitation.h" #include "controllers/ControlCitation.h"
@ -37,7 +38,7 @@ namespace frontend {
QCitationDialog::QCitationDialog(Dialog & dialog, QCitation * form) QCitationDialog::QCitationDialog(Dialog & dialog, QCitation * form)
: Dialog::View(dialog, "Citation"), form_(form) : Dialog::View(dialog, _("Citation")), form_(form)
{ {
setupUi(this); setupUi(this);

View File

@ -16,10 +16,12 @@
#include "controllers/ButtonController.h" #include "controllers/ButtonController.h"
using lyx::docstring;
namespace lyx { namespace lyx {
namespace frontend { namespace frontend {
QDialogView::QDialogView(Dialog & parent, std::string const & t) QDialogView::QDialogView(Dialog & parent, docstring const & t)
: Dialog::View(parent,t), updating_(false) : Dialog::View(parent,t), updating_(false)
{} {}

View File

@ -31,7 +31,7 @@ class QDialogView : public QObject, public Dialog::View {
Q_OBJECT Q_OBJECT
public: public:
/// ///
QDialogView(Dialog &, std::string const &); QDialogView(Dialog &, lyx::docstring const &);
/// ///
virtual ~QDialogView() {} virtual ~QDialogView() {}
/// ///
@ -87,7 +87,7 @@ private:
template <class GUIDialog> template <class GUIDialog>
class QView: public QDialogView { class QView: public QDialogView {
protected: protected:
QView(Dialog &, std::string const &); QView(Dialog &, lyx::docstring const &);
/// update the dialog /// update the dialog
virtual void update(); virtual void update();
@ -105,7 +105,7 @@ protected:
template <class GUIDialog> template <class GUIDialog>
QView<GUIDialog>::QView(Dialog & p, std::string const & t) QView<GUIDialog>::QView(Dialog & p, lyx::docstring const & t)
: QDialogView(p, t) : QDialogView(p, t)
{} {}
@ -153,7 +153,7 @@ class QController: public Base
{ {
protected: protected:
/// ///
QController(Dialog &, std::string const &); QController(Dialog &, docstring const &);
public: public:
/// The parent controller /// The parent controller
Controller & controller(); Controller & controller();
@ -163,7 +163,7 @@ public:
template <class Controller, class Base> template <class Controller, class Base>
QController<Controller, Base>::QController(Dialog & p, std::string const & t) QController<Controller, Base>::QController(Dialog & p, docstring const & t)
: Base(p, t) : Base(p, t)
{} {}

View File

@ -45,7 +45,7 @@ typedef QController<ControlDocument, QView<QDocumentDialog> > base_class;
QDocument::QDocument(Dialog & parent) QDocument::QDocument(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Document Settings"))) : base_class(parent, _("Document Settings"))
{} {}

View File

@ -27,7 +27,7 @@ typedef QController<ControlERT, QView<QERTDialog> > base_class;
QERT::QERT(Dialog & parent) QERT::QERT(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("TeX Code Settings"))) : base_class(parent, _("TeX Code Settings"))
{ {
} }

View File

@ -27,7 +27,7 @@ namespace frontend {
typedef QController<ControlErrorList, QView<QErrorListDialog> > base_class; typedef QController<ControlErrorList, QView<QErrorListDialog> > base_class;
QErrorList::QErrorList(Dialog & parent) QErrorList::QErrorList(Dialog & parent)
: base_class(parent, "") : base_class(parent, lyx::docstring())
{} {}
@ -48,7 +48,7 @@ void QErrorList::select(QListWidgetItem * wi)
void QErrorList::update_contents() void QErrorList::update_contents()
{ {
setTitle(controller().name()); setTitle(lyx::from_ascii(controller().name()));
dialog_->errorsLW->clear(); dialog_->errorsLW->clear();
dialog_->descriptionTB->setPlainText(QString()); dialog_->descriptionTB->setPlainText(QString());

View File

@ -276,7 +276,7 @@ void getExtra(external::ExtraData & data,
typedef QController<ControlExternal, QView<QExternalDialog> > base_class; typedef QController<ControlExternal, QView<QExternalDialog> > base_class;
QExternal::QExternal(Dialog & parent) QExternal::QExternal(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("External Material"))) : base_class(parent, _("External Material"))
{} {}

View File

@ -28,7 +28,7 @@ typedef QController<ControlFloat, QView<QFloatDialog> > base_class;
QFloat::QFloat(Dialog & parent) QFloat::QFloat(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Float Settings"))) : base_class(parent, _("Float Settings"))
{ {
} }

View File

@ -56,7 +56,7 @@ namespace frontend {
typedef QController<ControlGraphics, QView<QGraphicsDialog> > base_class; typedef QController<ControlGraphics, QView<QGraphicsDialog> > base_class;
QGraphics::QGraphics(Dialog & parent) QGraphics::QGraphics(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Graphics"))) : base_class(parent, _("Graphics"))
{ {
} }

View File

@ -35,7 +35,7 @@ typedef QController<ControlInclude, QView<QIncludeDialog> > base_class;
QInclude::QInclude(Dialog & parent) QInclude::QInclude(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Child Document"))) : base_class(parent, _("Child Document"))
{} {}

View File

@ -30,7 +30,7 @@ namespace frontend {
typedef QController<ControlCommand, QView<QIndexDialog> > base_class; typedef QController<ControlCommand, QView<QIndexDialog> > base_class;
QIndex::QIndex(Dialog & parent, string const & title, QString const & label) QIndex::QIndex(Dialog & parent, docstring const & title, QString const & label)
: base_class(parent, title), label_(label) : base_class(parent, title), label_(label)
{ {
} }

View File

@ -28,7 +28,7 @@ class QIndex :
public: public:
friend class QIndexDialog; friend class QIndexDialog;
QIndex(Dialog &, std::string const & title, QString const & label); QIndex(Dialog &, lyx::docstring const & title, QString const & label);
protected: protected:
virtual bool isValid(); virtual bool isValid();
private: private:

View File

@ -27,7 +27,7 @@ namespace frontend {
typedef QController<ControlLog, QView<QLogDialog> > base_class; typedef QController<ControlLog, QView<QLogDialog> > base_class;
QLog::QLog(Dialog & parent) QLog::QLog(Dialog & parent)
: base_class(parent, "") : base_class(parent, lyx::docstring())
{} {}

View File

@ -24,7 +24,7 @@ typedef QController<ControlMath, QView<QMathDialog> > math_base;
QMath::QMath(Dialog & parent) QMath::QMath(Dialog & parent)
: math_base(parent, lyx::to_utf8(_("Math Panel"))) : math_base(parent, _("Math Panel"))
{} {}
@ -38,7 +38,7 @@ typedef QController<ControlMath, QView<QMathMatrixDialog> > matrix_base;
QMathMatrix::QMathMatrix(Dialog & parent) QMathMatrix::QMathMatrix(Dialog & parent)
: matrix_base(parent, lyx::to_utf8(_("Math Matrix"))) : matrix_base(parent, _("Math Matrix"))
{} {}
@ -52,7 +52,7 @@ typedef QController<ControlMath, QView<QDelimiterDialog> > delimiter_base;
QMathDelimiter::QMathDelimiter(Dialog & parent) QMathDelimiter::QMathDelimiter(Dialog & parent)
: delimiter_base(parent, lyx::to_utf8(_("Math Delimiter"))) : delimiter_base(parent, _("Math Delimiter"))
{} {}

View File

@ -31,7 +31,7 @@ typedef QController<ControlNote, QView<QNoteDialog> > base_class;
QNote::QNote(Dialog & parent) QNote::QNote(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Note Settings"))) : base_class(parent, _("Note Settings"))
{} {}

View File

@ -35,7 +35,7 @@ typedef QController<ControlParagraph, QView<QParagraphDialog> > base_class;
QParagraph::QParagraph(Dialog & parent) QParagraph::QParagraph(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Paragraph Settings"))) : base_class(parent, _("Paragraph Settings"))
{} {}

View File

@ -37,7 +37,7 @@ namespace frontend {
typedef QController<ControlPrefs, QView<QPrefsDialog> > base_class; typedef QController<ControlPrefs, QView<QPrefsDialog> > base_class;
QPrefs::QPrefs(Dialog & parent) QPrefs::QPrefs(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Preferences"))) : base_class(parent, _("Preferences"))
{ {
} }

View File

@ -33,7 +33,7 @@ typedef QController<ControlPrint, QView<QLPrintDialog> > base_class;
QPrint::QPrint(Dialog & parent) QPrint::QPrint(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Print Document"))) : base_class(parent, _("Print Document"))
{ {
} }

View File

@ -40,7 +40,7 @@ typedef QController<lyx::frontend::ControlRef, QView<QRefDialog> > base_class;
QRef::QRef(Dialog & parent) QRef::QRef(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Cross-reference"))), : base_class(parent, _("Cross-reference")),
sort_(false), at_ref_(false) sort_(false), at_ref_(false)
{ {
} }

View File

@ -27,7 +27,7 @@ typedef QController<ControlSearch, QView<QSearchDialog> > base_class;
QSearch::QSearch(Dialog & parent) QSearch::QSearch(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Find and Replace"))) : base_class(parent, _("Find and Replace"))
{ {
} }

View File

@ -32,7 +32,7 @@ typedef QController<ControlSendto, QView<QSendtoDialog> > base_class;
QSendto::QSendto(Dialog & parent) QSendto::QSendto(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Send Document to Command"))) : base_class(parent, _("Send Document to Command"))
{ {
} }

View File

@ -29,7 +29,7 @@ typedef QController<ControlShowFile, QView<QShowFileDialog> > base_class;
QShowFile::QShowFile(Dialog & parent) QShowFile::QShowFile(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Show File"))) : base_class(parent, _("Show File"))
{ {
} }

View File

@ -31,7 +31,7 @@ namespace frontend {
typedef QController<ControlSpellchecker, QView<QSpellcheckerDialog> > base_class; typedef QController<ControlSpellchecker, QView<QSpellcheckerDialog> > base_class;
QSpellchecker::QSpellchecker(Dialog & parent) QSpellchecker::QSpellchecker(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Spellchecker"))) : base_class(parent, _("Spellchecker"))
{} {}

View File

@ -39,7 +39,7 @@ namespace frontend {
typedef QController<ControlTabular, QView<QTabularDialog> > base_class; typedef QController<ControlTabular, QView<QTabularDialog> > base_class;
QTabular::QTabular(Dialog & parent) QTabular::QTabular(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Table Settings"))) : base_class(parent, _("Table Settings"))
{ {
} }

View File

@ -26,7 +26,7 @@ typedef QController<ControlTabularCreate, QView<QTabularCreateDialog> > base_cla
QTabularCreate::QTabularCreate(Dialog & parent) QTabularCreate::QTabularCreate(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Insert Table"))) : base_class(parent, _("Insert Table"))
{ {
} }

View File

@ -29,7 +29,7 @@ namespace frontend {
typedef QController<ControlTexinfo, QView<QTexinfoDialog> > base_class; typedef QController<ControlTexinfo, QView<QTexinfoDialog> > base_class;
QTexinfo::QTexinfo(Dialog & parent) QTexinfo::QTexinfo(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("TeX Information"))), : base_class(parent, _("TeX Information")),
warningPosted(false), activeStyle(ControlTexinfo::cls) warningPosted(false), activeStyle(ControlTexinfo::cls)
{ {
} }

View File

@ -26,7 +26,7 @@ namespace frontend {
typedef QController<ControlThesaurus, QView<QThesaurusDialog> > base_class; typedef QController<ControlThesaurus, QView<QThesaurusDialog> > base_class;
QThesaurus::QThesaurus(Dialog & parent) QThesaurus::QThesaurus(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Thesaurus"))) : base_class(parent, _("Thesaurus"))
{ {
} }

View File

@ -39,7 +39,7 @@ namespace lyx {
namespace frontend { namespace frontend {
QTocDialog::QTocDialog(Dialog & dialog, QToc * form) QTocDialog::QTocDialog(Dialog & dialog, QToc * form)
: Dialog::View(dialog, "Toc"), form_(form), depth_(2) : Dialog::View(dialog, _("Toc")), form_(form), depth_(2)
{ {
setupUi(this); setupUi(this);

View File

@ -129,7 +129,7 @@ VSpace setVSpaceFromWidgets(int spacing,
typedef QController<ControlVSpace, QView<QVSpaceDialog> > base_class; typedef QController<ControlVSpace, QView<QVSpaceDialog> > base_class;
QVSpace::QVSpace(Dialog & parent) QVSpace::QVSpace(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Vertical Space Settings"))) : base_class(parent, _("Vertical Space Settings"))
{} {}

View File

@ -31,7 +31,7 @@ typedef QController<ControlViewSource, QView<QViewSourceDialog> > base_class;
QViewSource::QViewSource(Dialog & parent) QViewSource::QViewSource(Dialog & parent)
: base_class(parent, "") : base_class(parent, lyx::docstring())
{} {}

View File

@ -36,7 +36,7 @@ namespace frontend {
typedef QController<ControlWrap, QView<QWrapDialog> > base_class; typedef QController<ControlWrap, QView<QWrapDialog> > base_class;
QWrap::QWrap(Dialog & parent) QWrap::QWrap(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("Text Wrap Settings"))) : base_class(parent, _("Text Wrap Settings"))
{ {
} }

View File

@ -30,7 +30,7 @@ namespace frontend {
typedef QController< ControlCommand, QView<QURLDialog> > base_class; typedef QController< ControlCommand, QView<QURLDialog> > base_class;
UrlView::UrlView(Dialog & parent) UrlView::UrlView(Dialog & parent)
: base_class(parent, lyx::to_utf8(_("URL"))) : base_class(parent, _("URL"))
{ {
} }