From 6bb94129d8a5e087642458eb098c09c54c3c425e Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Tue, 5 Feb 2008 12:43:19 +0000 Subject: [PATCH] Factorize out the way window titles are handled. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22784 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/ButtonController.h | 2 -- src/frontends/qt4/Dialog.cpp | 6 ++++-- src/frontends/qt4/Dialog.h | 8 +++++++- src/frontends/qt4/DialogView.cpp | 5 +++-- src/frontends/qt4/DialogView.h | 3 ++- src/frontends/qt4/DockView.h | 3 ++- src/frontends/qt4/GuiAbout.cpp | 22 ++++++++++------------ src/frontends/qt4/GuiBibitem.cpp | 3 +-- src/frontends/qt4/GuiBibtex.cpp | 6 ++---- src/frontends/qt4/GuiBox.cpp | 3 +-- src/frontends/qt4/GuiBranch.cpp | 3 +-- src/frontends/qt4/GuiChanges.cpp | 4 ++-- src/frontends/qt4/GuiCharacter.cpp | 3 +-- src/frontends/qt4/GuiCitation.cpp | 3 +-- src/frontends/qt4/GuiDelimiter.cpp | 3 +-- src/frontends/qt4/GuiDialog.cpp | 15 +++++---------- src/frontends/qt4/GuiDialog.h | 8 +++----- src/frontends/qt4/GuiDocument.cpp | 5 ++--- src/frontends/qt4/GuiERT.cpp | 3 +-- src/frontends/qt4/GuiErrorList.cpp | 4 ++-- src/frontends/qt4/GuiExternal.cpp | 3 +-- src/frontends/qt4/GuiFloat.cpp | 5 ++--- src/frontends/qt4/GuiGraphics.cpp | 5 ++--- src/frontends/qt4/GuiHyperlink.cpp | 3 +-- src/frontends/qt4/GuiInclude.cpp | 3 +-- src/frontends/qt4/GuiIndex.cpp | 9 ++++----- src/frontends/qt4/GuiIndex.h | 2 +- src/frontends/qt4/GuiListings.cpp | 4 ++-- src/frontends/qt4/GuiLog.cpp | 4 ++-- src/frontends/qt4/GuiMath.cpp | 4 ++-- src/frontends/qt4/GuiMath.h | 2 +- src/frontends/qt4/GuiMathMatrix.cpp | 3 +-- src/frontends/qt4/GuiNomencl.cpp | 2 +- src/frontends/qt4/GuiNote.cpp | 3 +-- src/frontends/qt4/GuiParagraph.cpp | 3 +-- src/frontends/qt4/GuiPrefs.cpp | 3 +-- src/frontends/qt4/GuiPrint.cpp | 3 +-- src/frontends/qt4/GuiRef.cpp | 3 +-- src/frontends/qt4/GuiSearch.cpp | 3 +-- src/frontends/qt4/GuiSendto.cpp | 3 +-- src/frontends/qt4/GuiShowFile.cpp | 11 +++++------ src/frontends/qt4/GuiSpellchecker.cpp | 3 +-- src/frontends/qt4/GuiTabular.cpp | 3 +-- src/frontends/qt4/GuiTabularCreate.cpp | 3 +-- src/frontends/qt4/GuiTexinfo.cpp | 3 +-- src/frontends/qt4/GuiThesaurus.cpp | 10 ++++++---- src/frontends/qt4/GuiToc.cpp | 3 +-- src/frontends/qt4/GuiVSpace.cpp | 4 ++-- src/frontends/qt4/GuiViewSource.cpp | 4 +--- src/frontends/qt4/GuiWrap.cpp | 4 ++-- src/frontends/qt4/TocWidget.cpp | 1 - 51 files changed, 100 insertions(+), 131 deletions(-) diff --git a/src/frontends/qt4/ButtonController.h b/src/frontends/qt4/ButtonController.h index 5710cac3b5..808f97338a 100644 --- a/src/frontends/qt4/ButtonController.h +++ b/src/frontends/qt4/ButtonController.h @@ -14,8 +14,6 @@ #include "ButtonPolicy.h" -#include "support/gettext.h" - #include class QWidget; diff --git a/src/frontends/qt4/Dialog.cpp b/src/frontends/qt4/Dialog.cpp index 44b4ca5935..96fa1520ac 100644 --- a/src/frontends/qt4/Dialog.cpp +++ b/src/frontends/qt4/Dialog.cpp @@ -34,8 +34,8 @@ namespace lyx { namespace frontend { -Dialog::Dialog(GuiView & lv, string const & name) - : name_(name), lyxview_(&lv) +Dialog::Dialog(GuiView & lv, string const & name, QString const & title) + : name_(name), title_(title), lyxview_(&lv) {} @@ -189,6 +189,8 @@ void Dialog::showView() return; QWidget * w = asQWidget(); + w->setWindowTitle(title_); + QSize const hint = w->sizeHint(); if (hint.height() >= 0 && hint.width() >= 0) w->setMinimumSize(hint); diff --git a/src/frontends/qt4/Dialog.h b/src/frontends/qt4/Dialog.h index 987211d91f..43ae785ac6 100644 --- a/src/frontends/qt4/Dialog.h +++ b/src/frontends/qt4/Dialog.h @@ -50,7 +50,8 @@ 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. - Dialog(GuiView & lv, std::string const & name); + /// \param title is the window title used for decoration. + Dialog(GuiView & lv, std::string const & name, QString const & title); virtual ~Dialog(); @@ -251,6 +252,9 @@ public: //@} protected: + /// + void setTitle(QString const & title) { title_ = title; } + /// virtual void apply(); private: @@ -259,6 +263,8 @@ private: */ std::string const name_; /// + QString title_; + /// GuiView * lyxview_; /// intentionally unimplemented, therefore uncopiable diff --git a/src/frontends/qt4/DialogView.cpp b/src/frontends/qt4/DialogView.cpp index d0e1ab1f77..30a233354c 100644 --- a/src/frontends/qt4/DialogView.cpp +++ b/src/frontends/qt4/DialogView.cpp @@ -23,8 +23,9 @@ using namespace std; namespace lyx { namespace frontend { -DialogView::DialogView(GuiView & lv, string const & name) - : QDialog(&lv), Dialog(lv, name) +DialogView::DialogView(GuiView & lv, string const & name, + QString const & title) + : QDialog(&lv), Dialog(lv, name, "LyX: " + title) {} } // namespace frontend diff --git a/src/frontends/qt4/DialogView.h b/src/frontends/qt4/DialogView.h index 84747ad738..a5394963dc 100644 --- a/src/frontends/qt4/DialogView.h +++ b/src/frontends/qt4/DialogView.h @@ -30,7 +30,8 @@ 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. - explicit DialogView(GuiView & lv, std::string const & name); + /// \param title is the window title used for decoration. + DialogView(GuiView & lv, std::string const & name, QString const & title); virtual ~DialogView() {} virtual QWidget * asQWidget() { return this; } diff --git a/src/frontends/qt4/DockView.h b/src/frontends/qt4/DockView.h index 4b056789c4..c94f9a685b 100644 --- a/src/frontends/qt4/DockView.h +++ b/src/frontends/qt4/DockView.h @@ -32,10 +32,11 @@ public: DockView( GuiView & parent, ///< the main window where to dock. std::string 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 ) - : QDockWidget(&parent, flags), Dialog(parent, name) + : QDockWidget(&parent, flags), Dialog(parent, name, title) { if (flags & Qt::Drawer) setFeatures(QDockWidget::NoDockWidgetFeatures); diff --git a/src/frontends/qt4/GuiAbout.cpp b/src/frontends/qt4/GuiAbout.cpp index b621a98d91..347c26347b 100644 --- a/src/frontends/qt4/GuiAbout.cpp +++ b/src/frontends/qt4/GuiAbout.cpp @@ -13,7 +13,6 @@ #include "GuiAbout.h" #include "qt_helpers.h" -#include "support/gettext.h" #include "version.h" #include "support/filetools.h" @@ -36,9 +35,9 @@ static QString credits() QTextStream out(&res); if (file.isReadable()) { - out << toqstr(_("ERROR: LyX wasn't able to read CREDITS file\n")); - out << toqstr(_("Please install correctly to estimate the great\n")); - out << toqstr(_("amount of work other people have done for the LyX project.")); + out << qt_("ERROR: LyX wasn't able to read CREDITS file\n"); + out << qt_("Please install correctly to estimate the great\n"); + out << qt_("amount of work other people have done for the LyX project."); } else { file.open(QIODevice::ReadOnly); QTextStream ts(&file); @@ -61,19 +60,19 @@ static QString credits() static QString copyright() { - return toqstr(_("LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-2006 LyX Team")); + return qt_("LyX is Copyright (C) 1995 by Matthias Ettrich,\n1995-2006 LyX Team"); } static QString license() { - return toqstr(_("This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.")); + return qt_("This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version."); } static QString disclaimer() { - return toqstr(_("LyX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.")); + return qt_("LyX is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA."); } @@ -81,25 +80,24 @@ static QString version() { QString res; QTextStream out(&res); - out << toqstr(_("LyX Version ")); + out << qt_("LyX Version "); out << lyx_version; out << " ("; out << lyx_release_date; out << ")\n"; - out << toqstr(_("Library directory: ")); + out << qt_("Library directory: "); out << toqstr(makeDisplayPath(package().system_support().absFilename())); out << "\n"; - out << toqstr(_("User directory: ")); + out << qt_("User directory: "); out << toqstr(makeDisplayPath(package().user_support().absFilename())); return res; } GuiAbout::GuiAbout(GuiView & lv) - : GuiDialog(lv, "aboutlyx") + : GuiDialog(lv, "aboutlyx", qt_("About LyX")) { setupUi(this); - setViewTitle(_("About LyX")); connect(closePB, SIGNAL(clicked()), this, SLOT(reject())); diff --git a/src/frontends/qt4/GuiBibitem.cpp b/src/frontends/qt4/GuiBibitem.cpp index 4c651cec46..3f9cab6923 100644 --- a/src/frontends/qt4/GuiBibitem.cpp +++ b/src/frontends/qt4/GuiBibitem.cpp @@ -24,10 +24,9 @@ namespace frontend { GuiBibitem::GuiBibitem(GuiView & lv) - : GuiCommand(lv, "bibitem") + : GuiCommand(lv, "bibitem", qt_("Bibliography Entry Settings")) { setupUi(this); - setViewTitle(_("Bibliography Entry Settings")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); diff --git a/src/frontends/qt4/GuiBibtex.cpp b/src/frontends/qt4/GuiBibtex.cpp index 0423cdfa27..8d1cac783b 100644 --- a/src/frontends/qt4/GuiBibtex.cpp +++ b/src/frontends/qt4/GuiBibtex.cpp @@ -22,11 +22,11 @@ #include "qt_helpers.h" #include "Validator.h" #include "LyXRC.h" -#include "support/gettext.h" #include "ButtonPolicy.h" #include "support/filetools.h" // changeExtension +#include "support/gettext.h" #include "support/lstrings.h" #include "support/FileFilterList.h" @@ -44,12 +44,10 @@ namespace frontend { GuiBibtex::GuiBibtex(GuiView & lv) - : GuiCommand(lv, "bibtex") + : GuiCommand(lv, "bibtex", qt_("BibTeX Bibliography")) { setupUi(this); - setViewTitle( _("BibTeX Bibliography")); - QDialog::setModal(true); connect(okPB, SIGNAL(clicked()), diff --git a/src/frontends/qt4/GuiBox.cpp b/src/frontends/qt4/GuiBox.cpp index 91243256fd..9bd62817df 100644 --- a/src/frontends/qt4/GuiBox.cpp +++ b/src/frontends/qt4/GuiBox.cpp @@ -73,10 +73,9 @@ void box_gui_tokens_special_length(vector & ids, GuiBox::GuiBox(GuiView & lv) - : GuiDialog(lv, "box"), params_("") + : GuiDialog(lv, "box", qt_("Box Settings")), params_("") { setupUi(this); - setViewTitle(_("Box Settings")); // fill the box type choice box_gui_tokens(ids_, gui_names_); diff --git a/src/frontends/qt4/GuiBranch.cpp b/src/frontends/qt4/GuiBranch.cpp index f3599d1283..4c09892c0a 100644 --- a/src/frontends/qt4/GuiBranch.cpp +++ b/src/frontends/qt4/GuiBranch.cpp @@ -33,10 +33,9 @@ namespace lyx { namespace frontend { GuiBranch::GuiBranch(GuiView & lv) - : GuiDialog(lv, "branch") + : GuiDialog(lv, "branch", qt_("Branch Settings")) { setupUi(this); - setViewTitle(_("Branch Settings")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); diff --git a/src/frontends/qt4/GuiChanges.cpp b/src/frontends/qt4/GuiChanges.cpp index b99865736c..63b3533885 100644 --- a/src/frontends/qt4/GuiChanges.cpp +++ b/src/frontends/qt4/GuiChanges.cpp @@ -15,6 +15,7 @@ #include "qt_helpers.h" +#include "support/gettext.h" #include "support/lstrings.h" #include "support/lyxtime.h" @@ -37,10 +38,9 @@ namespace frontend { using support::bformat; GuiChanges::GuiChanges(GuiView & lv) - : GuiDialog(lv, "changes") + : GuiDialog(lv, "changes", qt_("Merge Changes")) { setupUi(this); - setViewTitle(_("Merge Changes")); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); connect(nextPB, SIGNAL(clicked()), this, SLOT(nextChange())); diff --git a/src/frontends/qt4/GuiCharacter.cpp b/src/frontends/qt4/GuiCharacter.cpp index 2f20575df9..14bb54f136 100644 --- a/src/frontends/qt4/GuiCharacter.cpp +++ b/src/frontends/qt4/GuiCharacter.cpp @@ -269,11 +269,10 @@ static vector const getFamilyData() GuiCharacter::GuiCharacter(GuiView & lv) - : GuiDialog(lv, "character"), font_(ignore_font), + : GuiDialog(lv, "character", qt_("Text Style")), font_(ignore_font), toggleall_(false), reset_lang_(false) { setupUi(this); - setViewTitle(_("Text Style")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); diff --git a/src/frontends/qt4/GuiCitation.cpp b/src/frontends/qt4/GuiCitation.cpp index 10e6d9bdaa..d9b8a4f8f0 100644 --- a/src/frontends/qt4/GuiCitation.cpp +++ b/src/frontends/qt4/GuiCitation.cpp @@ -76,10 +76,9 @@ static vector to_docstring_vector(QStringList const & qlist) GuiCitation::GuiCitation(GuiView & lv) - : GuiCommand(lv, "citation") + : GuiCommand(lv, "citation", qt_("Citation")) { setupUi(this); - setViewTitle(_("Citation")); connect(citationStyleCO, SIGNAL(activated(int)), this, SLOT(on_citationStyleCO_currentIndexChanged(int))); diff --git a/src/frontends/qt4/GuiDelimiter.cpp b/src/frontends/qt4/GuiDelimiter.cpp index 635319ca9c..461dc72b00 100644 --- a/src/frontends/qt4/GuiDelimiter.cpp +++ b/src/frontends/qt4/GuiDelimiter.cpp @@ -70,10 +70,9 @@ namespace frontend { GuiDelimiter::GuiDelimiter(GuiView & lv) - : GuiMath(lv, "mathdelimiter") + : GuiMath(lv, "mathdelimiter", qt_("Math Delimiter")) { setupUi(this); - setViewTitle(_("Math Delimiter")); connect(closePB, SIGNAL(clicked()), this, SLOT(accept())); diff --git a/src/frontends/qt4/GuiDialog.cpp b/src/frontends/qt4/GuiDialog.cpp index ddf3c8ae3e..5670894143 100644 --- a/src/frontends/qt4/GuiDialog.cpp +++ b/src/frontends/qt4/GuiDialog.cpp @@ -26,17 +26,11 @@ using namespace std; namespace lyx { namespace frontend { -GuiDialog::GuiDialog(GuiView & lv, string const & name) - : QDialog(&lv), Dialog(lv, name), is_closing_(false) +GuiDialog::GuiDialog(GuiView & lv, string const & name, QString const & title) + : QDialog(&lv), Dialog(lv, name, "LyX: " + title), is_closing_(false) {} -void GuiDialog::setViewTitle(docstring const & title) -{ - setWindowTitle("LyX: " + toqstr(title)); -} - - void GuiDialog::setButtonsValid(bool valid) { bc().setValid(valid); @@ -126,8 +120,9 @@ using namespace std; namespace lyx { namespace frontend { -GuiCommand::GuiCommand(GuiView & lv, string const & name) - : GuiDialog(lv, name), params_(insetCode(name)), lfun_name_(name) +GuiCommand::GuiCommand(GuiView & lv, string const & name, + QString const & title) + : GuiDialog(lv, name, title), params_(insetCode(name)), lfun_name_(name) { } diff --git a/src/frontends/qt4/GuiDialog.h b/src/frontends/qt4/GuiDialog.h index 608e5962e9..7ade39cd6e 100644 --- a/src/frontends/qt4/GuiDialog.h +++ b/src/frontends/qt4/GuiDialog.h @@ -39,7 +39,8 @@ 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. - explicit GuiDialog(GuiView & lv, std::string const & name); + /// \param title is the window title used for decoration. + GuiDialog(GuiView & lv, std::string const & name, QString const & title); virtual QWidget * asQWidget() { return this; } virtual QWidget const * asQWidget() const { return this; } @@ -59,9 +60,6 @@ public Q_SLOTS: void slotClose(); public: - /// - void setViewTitle(docstring const & title); - /** Check whether we may apply our data. * * The buttons are disabled if not and (re-)enabled if yes. @@ -114,7 +112,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); + GuiCommand(GuiView &, std::string const & name, QString const & title); /// bool initialiseParams(std::string const & data); /// clean-up on hide. diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 4e0ac136b2..3ea5e1aa83 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -492,11 +492,10 @@ void PreambleModule::closeEvent(QCloseEvent * e) GuiDocument::GuiDocument(GuiView & lv) - : GuiDialog(lv, "document"), current_id_(0) + : GuiDialog(lv, "document", qt_("Document Settings")), current_id_(0) { setupUi(this); - setViewTitle(_("Document Settings")); - + lang_ = getSecond(getLanguageData(false)); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); diff --git a/src/frontends/qt4/GuiERT.cpp b/src/frontends/qt4/GuiERT.cpp index c44795068c..289e809d8f 100644 --- a/src/frontends/qt4/GuiERT.cpp +++ b/src/frontends/qt4/GuiERT.cpp @@ -26,10 +26,9 @@ namespace lyx { namespace frontend { GuiERT::GuiERT(GuiView & lv) - : GuiDialog(lv, "ert"), status_(InsetERT::Collapsed) + : GuiDialog(lv, "ert", qt_("TeX Code Settings")), status_(InsetERT::Collapsed) { setupUi(this); - setViewTitle(_("TeX Code Settings")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); diff --git a/src/frontends/qt4/GuiErrorList.cpp b/src/frontends/qt4/GuiErrorList.cpp index 3aea59daac..3a9742e0ba 100644 --- a/src/frontends/qt4/GuiErrorList.cpp +++ b/src/frontends/qt4/GuiErrorList.cpp @@ -35,7 +35,7 @@ namespace lyx { namespace frontend { GuiErrorList::GuiErrorList(GuiView & lv) - : GuiDialog(lv, "errorlist") + : GuiDialog(lv, "errorlist", qt_("Error List")) { setupUi(this); @@ -74,7 +74,7 @@ void GuiErrorList::select(QListWidgetItem * wi) void GuiErrorList::updateContents() { - setViewTitle(name_); + setTitle(toqstr(name_)); errorsLW->clear(); descriptionTB->setPlainText(QString()); diff --git a/src/frontends/qt4/GuiExternal.cpp b/src/frontends/qt4/GuiExternal.cpp index 49fbdeadb7..b4bfd30e00 100644 --- a/src/frontends/qt4/GuiExternal.cpp +++ b/src/frontends/qt4/GuiExternal.cpp @@ -89,10 +89,9 @@ char const * const origin_gui_strs[] = { GuiExternal::GuiExternal(GuiView & lv) - : GuiDialog(lv, "external"), bbChanged_(false) + : GuiDialog(lv, "external", qt_("External Material")), bbChanged_(false) { setupUi(this); - setViewTitle(_("External Material")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); diff --git a/src/frontends/qt4/GuiFloat.cpp b/src/frontends/qt4/GuiFloat.cpp index 25d0f1aacb..14657a73f4 100644 --- a/src/frontends/qt4/GuiFloat.cpp +++ b/src/frontends/qt4/GuiFloat.cpp @@ -26,11 +26,10 @@ namespace lyx { namespace frontend { GuiFloat::GuiFloat(GuiView & lv) - : GuiDialog(lv, "float") + : GuiDialog(lv, "float", qt_("Float Settings")) { setupUi(this); - setViewTitle(_("Float Settings")); - + connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore())); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); diff --git a/src/frontends/qt4/GuiGraphics.cpp b/src/frontends/qt4/GuiGraphics.cpp index 10e90108b3..4fa354d9dd 100644 --- a/src/frontends/qt4/GuiGraphics.cpp +++ b/src/frontends/qt4/GuiGraphics.cpp @@ -113,11 +113,10 @@ vector getRotationOriginData(); GuiGraphics::GuiGraphics(GuiView & lv) - : GuiDialog(lv, "graphics") + : GuiDialog(lv, "graphics", qt_("Graphics")) { setupUi(this); - setViewTitle(_("Graphics")); - + //main buttons connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); diff --git a/src/frontends/qt4/GuiHyperlink.cpp b/src/frontends/qt4/GuiHyperlink.cpp index b7e7382b5e..ee3cb2e9a6 100644 --- a/src/frontends/qt4/GuiHyperlink.cpp +++ b/src/frontends/qt4/GuiHyperlink.cpp @@ -27,10 +27,9 @@ namespace lyx { namespace frontend { GuiHyperlink::GuiHyperlink(GuiView & lv) - : GuiCommand(lv, "href") + : GuiCommand(lv, "href",qt_("Hyperlink")) { setupUi(this); - setViewTitle( _("Hyperlink")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); diff --git a/src/frontends/qt4/GuiInclude.cpp b/src/frontends/qt4/GuiInclude.cpp index 8165a7e9af..190af32ad3 100644 --- a/src/frontends/qt4/GuiInclude.cpp +++ b/src/frontends/qt4/GuiInclude.cpp @@ -47,10 +47,9 @@ namespace frontend { GuiInclude::GuiInclude(GuiView & lv) - : GuiCommand(lv, "include") + : GuiCommand(lv, "include", qt_("Child Document")) { setupUi(this); - setViewTitle(_("Child Document")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); diff --git a/src/frontends/qt4/GuiIndex.cpp b/src/frontends/qt4/GuiIndex.cpp index e19041464d..737b30c1e0 100644 --- a/src/frontends/qt4/GuiIndex.cpp +++ b/src/frontends/qt4/GuiIndex.cpp @@ -32,12 +32,11 @@ namespace frontend { ///////////////////////////////////////////////////////////////// GuiIndexDialogBase::GuiIndexDialogBase(GuiView & lv, - docstring const & title, QString const & label, string const & name) - : GuiCommand(lv, name) + QString const & title, QString const & label, string const & name) + : GuiCommand(lv, name, title) { label_ = label; setupUi(this); - setViewTitle(title); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); @@ -118,7 +117,7 @@ bool GuiIndexDialogBase::isValid() GuiIndex::GuiIndex(GuiView & lv) - : GuiIndexDialogBase(lv, _("Index Entry"), qt_("&Keyword:"), "index") + : GuiIndexDialogBase(lv, qt_("Index Entry"), qt_("&Keyword:"), "index") { keywordED->setWhatsThis( qt_( "The format of the entry in the index.\n" @@ -148,7 +147,7 @@ Dialog * createGuiIndex(GuiView & lv) { return new GuiIndex(lv); } ///////////////////////////////////////////////////////////////// GuiLabel::GuiLabel(GuiView & lv) - : GuiIndexDialogBase(lv, _("Label"), qt_("&Label:"), "label") + : GuiIndexDialogBase(lv, qt_("Label"), qt_("&Label:"), "label") {} diff --git a/src/frontends/qt4/GuiIndex.h b/src/frontends/qt4/GuiIndex.h index 6d2b5e9a27..32d1a27b90 100644 --- a/src/frontends/qt4/GuiIndex.h +++ b/src/frontends/qt4/GuiIndex.h @@ -24,7 +24,7 @@ class GuiIndexDialogBase : public GuiCommand, public Ui::IndexUi Q_OBJECT public: - GuiIndexDialogBase(GuiView & lv, docstring const & title, + GuiIndexDialogBase(GuiView & lv, QString const & title, QString const & label, std::string const & name); private Q_SLOTS: diff --git a/src/frontends/qt4/GuiListings.cpp b/src/frontends/qt4/GuiListings.cpp index 8f908e15ea..08974c54f2 100644 --- a/src/frontends/qt4/GuiListings.cpp +++ b/src/frontends/qt4/GuiListings.cpp @@ -19,6 +19,7 @@ #include "insets/InsetListingsParams.h" #include "support/debug.h" +#include "support/gettext.h" #include "support/lstrings.h" #include @@ -158,10 +159,9 @@ char const * font_styles_gui[] = GuiListings::GuiListings(GuiView & lv) - : GuiDialog(lv, "listings") + : GuiDialog(lv, "listings", qt_("Program Listing Settings")) { setupUi(this); - setViewTitle(_("Program Listing Settings")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); diff --git a/src/frontends/qt4/GuiLog.cpp b/src/frontends/qt4/GuiLog.cpp index 713544a02c..4d748916fc 100644 --- a/src/frontends/qt4/GuiLog.cpp +++ b/src/frontends/qt4/GuiLog.cpp @@ -99,7 +99,7 @@ void LogHighlighter::highlightBlock(QString const & text) ///////////////////////////////////////////////////////////////////// GuiLog::GuiLog(GuiView & lv) - : GuiDialog(lv, "log"), type_(LatexLog) + : GuiDialog(lv, "log", qt_("LaTeX Log")), type_(LatexLog) { setupUi(this); @@ -129,7 +129,7 @@ void GuiLog::closeEvent(QCloseEvent * e) void GuiLog::updateContents() { - setViewTitle(title()); + setTitle(toqstr(title())); ostringstream ss; getContents(ss); diff --git a/src/frontends/qt4/GuiMath.cpp b/src/frontends/qt4/GuiMath.cpp index c40e91f03b..63ad6cc505 100644 --- a/src/frontends/qt4/GuiMath.cpp +++ b/src/frontends/qt4/GuiMath.cpp @@ -19,8 +19,8 @@ using namespace std; namespace lyx { namespace frontend { -GuiMath::GuiMath(GuiView & lv, string const & name) - : GuiDialog(lv, name) +GuiMath::GuiMath(GuiView & lv, string const & name, QString const & title) + : GuiDialog(lv, name, title) { // FIXME: Ideally, those unicode codepoints would be defined // in "lib/symbols". Unfortunately, some of those are already diff --git a/src/frontends/qt4/GuiMath.h b/src/frontends/qt4/GuiMath.h index 0f516b75d8..c9665ba402 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); + GuiMath(GuiView & lv, std::string const & name, QString const & title); /// Nothing to initialise in this case. bool initialiseParams(std::string const &) { return true; } diff --git a/src/frontends/qt4/GuiMathMatrix.cpp b/src/frontends/qt4/GuiMathMatrix.cpp index 53566e7120..b7dae78b48 100644 --- a/src/frontends/qt4/GuiMathMatrix.cpp +++ b/src/frontends/qt4/GuiMathMatrix.cpp @@ -28,10 +28,9 @@ namespace lyx { namespace frontend { GuiMathMatrix::GuiMathMatrix(GuiView & lv) - : GuiMath(lv, "mathmatrix") + : GuiMath(lv, "mathmatrix", qt_("Math Matrix")) { setupUi(this); - setViewTitle(_("Math Matrix")); table->setMinimumSize(100, 100); rowsSB->setValue(5); diff --git a/src/frontends/qt4/GuiNomencl.cpp b/src/frontends/qt4/GuiNomencl.cpp index f3b6e3c7ef..4516e5450a 100644 --- a/src/frontends/qt4/GuiNomencl.cpp +++ b/src/frontends/qt4/GuiNomencl.cpp @@ -29,7 +29,7 @@ namespace lyx { namespace frontend { GuiNomenclature::GuiNomenclature(GuiView & lv) - : GuiCommand(lv, "nomenclature") + : GuiCommand(lv, "nomenclature", qt_("Nomenclature")) { setupUi(this); diff --git a/src/frontends/qt4/GuiNote.cpp b/src/frontends/qt4/GuiNote.cpp index 4f15294755..6c3eff5fc6 100644 --- a/src/frontends/qt4/GuiNote.cpp +++ b/src/frontends/qt4/GuiNote.cpp @@ -25,10 +25,9 @@ namespace lyx { namespace frontend { GuiNote::GuiNote(GuiView & lv) - : GuiDialog(lv, "note") + : GuiDialog(lv, "note", qt_("Note Settings")) { setupUi(this); - setViewTitle(_("Note Settings")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); diff --git a/src/frontends/qt4/GuiParagraph.cpp b/src/frontends/qt4/GuiParagraph.cpp index 007531cccf..b840f54ae1 100644 --- a/src/frontends/qt4/GuiParagraph.cpp +++ b/src/frontends/qt4/GuiParagraph.cpp @@ -43,10 +43,9 @@ namespace lyx { namespace frontend { GuiParagraph::GuiParagraph(GuiView & lv) - : DialogView(lv, "paragraph") + : DialogView(lv, "paragraph", qt_("Paragraph Settings")) { setupUi(this); - setWindowTitle(qt_("Paragraph Settings")); connect(alignDefaultRB, SIGNAL(clicked()), this, SLOT(changed())); connect(alignJustRB, SIGNAL(clicked()), this, SLOT(changed())); diff --git a/src/frontends/qt4/GuiPrefs.cpp b/src/frontends/qt4/GuiPrefs.cpp index 06f3b4d503..7601cd28c1 100644 --- a/src/frontends/qt4/GuiPrefs.cpp +++ b/src/frontends/qt4/GuiPrefs.cpp @@ -2141,10 +2141,9 @@ void PrefIdentity::update(LyXRC const & rc) ///////////////////////////////////////////////////////////////////// GuiPreferences::GuiPreferences(GuiView & lv) - : GuiDialog(lv, "prefs"), update_screen_font_(false) + : GuiDialog(lv, "prefs", qt_("Preferences")), update_screen_font_(false) { setupUi(this); - setViewTitle(_("Preferences")); QDialog::setModal(false); diff --git a/src/frontends/qt4/GuiPrint.cpp b/src/frontends/qt4/GuiPrint.cpp index 56b22d3a72..80e2152a99 100644 --- a/src/frontends/qt4/GuiPrint.cpp +++ b/src/frontends/qt4/GuiPrint.cpp @@ -41,10 +41,9 @@ namespace frontend { GuiPrint::GuiPrint(GuiView & lv) - : GuiDialog(lv, "print") + : GuiDialog(lv, "print", qt_("Print Document")) { setupUi(this); - setViewTitle(_("Print Document")); connect(printPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); diff --git a/src/frontends/qt4/GuiRef.cpp b/src/frontends/qt4/GuiRef.cpp index 6c3b554b68..df032c00a3 100644 --- a/src/frontends/qt4/GuiRef.cpp +++ b/src/frontends/qt4/GuiRef.cpp @@ -39,10 +39,9 @@ namespace lyx { namespace frontend { GuiRef::GuiRef(GuiView & lv) - : GuiCommand(lv, "ref") + : GuiCommand(lv, "ref", qt_("Cross-reference")) { setupUi(this); - setViewTitle(_("Cross-reference")); sort_ = false; at_ref_ = false; diff --git a/src/frontends/qt4/GuiSearch.cpp b/src/frontends/qt4/GuiSearch.cpp index 814b208a56..fd401e7afd 100644 --- a/src/frontends/qt4/GuiSearch.cpp +++ b/src/frontends/qt4/GuiSearch.cpp @@ -39,10 +39,9 @@ static void uniqueInsert(QComboBox * box, QString const & text) GuiSearch::GuiSearch(GuiView & lv) - : GuiDialog(lv, "findreplace") + : GuiDialog(lv, "findreplace", qt_("Find and Replace")) { setupUi(this); - setViewTitle(_("Find and Replace")); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); connect(findPB, SIGNAL(clicked()), this, SLOT(findClicked())); diff --git a/src/frontends/qt4/GuiSendto.cpp b/src/frontends/qt4/GuiSendto.cpp index 416bb6480e..891d2b9721 100644 --- a/src/frontends/qt4/GuiSendto.cpp +++ b/src/frontends/qt4/GuiSendto.cpp @@ -35,10 +35,9 @@ namespace frontend { GuiSendTo::GuiSendTo(GuiView & lv) - : GuiDialog(lv, "sendto") + : GuiDialog(lv, "sendto", qt_("Send Document to Command")) { setupUi(this); - setViewTitle(_("Send Document to Command")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); diff --git a/src/frontends/qt4/GuiShowFile.cpp b/src/frontends/qt4/GuiShowFile.cpp index ac4e514fd7..95db41b06b 100644 --- a/src/frontends/qt4/GuiShowFile.cpp +++ b/src/frontends/qt4/GuiShowFile.cpp @@ -28,10 +28,9 @@ namespace frontend { GuiShowFile::GuiShowFile(GuiView & lv) - : GuiDialog(lv, "file") + : GuiDialog(lv, "file", qt_("Show File")) { setupUi(this); - setViewTitle(_("Show File")); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); @@ -51,11 +50,11 @@ void GuiShowFile::updateContents() { setWindowTitle(toqstr(onlyFilename(filename_.absFilename()))); - docstring contents = filename_.fileContents("UTF-8"); - if (contents.empty()) - contents = _("Error -> Cannot load file!"); + QString contents = toqstr(filename_.fileContents("UTF-8")); + if (contents.isEmpty()) + contents = qt_("Error -> Cannot load file!"); - textTB->setPlainText(toqstr(contents)); + textTB->setPlainText(contents); } diff --git a/src/frontends/qt4/GuiSpellchecker.cpp b/src/frontends/qt4/GuiSpellchecker.cpp index 1d932ec1b0..86d628c77a 100644 --- a/src/frontends/qt4/GuiSpellchecker.cpp +++ b/src/frontends/qt4/GuiSpellchecker.cpp @@ -54,11 +54,10 @@ namespace frontend { GuiSpellchecker::GuiSpellchecker(GuiView & lv) - : GuiDialog(lv, "spellchecker"), exitEarly_(false), + : GuiDialog(lv, "spellchecker", qt_("Spellchecker")), exitEarly_(false), oldval_(0), newvalue_(0), count_(0), speller_(0) { setupUi(this); - setViewTitle(_("Spellchecker")); connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); connect(replacePB, SIGNAL(clicked()), this, SLOT(replace())); diff --git a/src/frontends/qt4/GuiTabular.cpp b/src/frontends/qt4/GuiTabular.cpp index 4bd8ac77c8..9fff9843bc 100644 --- a/src/frontends/qt4/GuiTabular.cpp +++ b/src/frontends/qt4/GuiTabular.cpp @@ -37,12 +37,11 @@ namespace lyx { namespace frontend { GuiTabular::GuiTabular(GuiView & lv) - : GuiDialog(lv, "tabular") + : GuiDialog(lv, "tabular", qt_("Table Settings")) { active_cell_ = Tabular::npos; setupUi(this); - setViewTitle(_("Table Settings")); widthED->setValidator(unsignedLengthValidator(widthED)); topspaceED->setValidator(new LengthValidator(topspaceED)); diff --git a/src/frontends/qt4/GuiTabularCreate.cpp b/src/frontends/qt4/GuiTabularCreate.cpp index ba167bd384..fea04a3ac6 100644 --- a/src/frontends/qt4/GuiTabularCreate.cpp +++ b/src/frontends/qt4/GuiTabularCreate.cpp @@ -27,10 +27,9 @@ namespace lyx { namespace frontend { GuiTabularCreate::GuiTabularCreate(GuiView & lv) - : GuiDialog(lv, "tabularcreate") + : GuiDialog(lv, "tabularcreate", qt_("Insert Table")) { setupUi(this); - setViewTitle(_("Insert Table")); rowsSB->setValue(5); columnsSB->setValue(5); diff --git a/src/frontends/qt4/GuiTexinfo.cpp b/src/frontends/qt4/GuiTexinfo.cpp index dfa5b8356b..4c3d48bb2d 100644 --- a/src/frontends/qt4/GuiTexinfo.cpp +++ b/src/frontends/qt4/GuiTexinfo.cpp @@ -79,10 +79,9 @@ static string texFileFromList(string const & file, string const & type) GuiTexInfo::GuiTexInfo(GuiView & lv) - : GuiDialog(lv, "texinfo") + : GuiDialog(lv, "texinfo", qt_("TeX Information")) { setupUi(this); - setViewTitle(_("TeX Information")); warningPosted = false; activeStyle = ClsType; diff --git a/src/frontends/qt4/GuiThesaurus.cpp b/src/frontends/qt4/GuiThesaurus.cpp index b36cb3842f..782a071054 100644 --- a/src/frontends/qt4/GuiThesaurus.cpp +++ b/src/frontends/qt4/GuiThesaurus.cpp @@ -13,7 +13,12 @@ #include "GuiThesaurus.h" #include "qt_helpers.h" + +#include "FuncRequest.h" +#include "lyxfind.h" + #include "support/debug.h" +#include "support/gettext.h" #include #include @@ -22,8 +27,6 @@ #include #include -#include "lyxfind.h" -#include "FuncRequest.h" using namespace std; @@ -31,10 +34,9 @@ namespace lyx { namespace frontend { GuiThesaurus::GuiThesaurus(GuiView & lv) - : GuiDialog(lv, "thesaurus") + : GuiDialog(lv, "thesaurus", qt_("Thesaurus")) { setupUi(this); - setViewTitle(_("Thesaurus")); meaningsTV->setColumnCount(1); meaningsTV->header()->hide(); diff --git a/src/frontends/qt4/GuiToc.cpp b/src/frontends/qt4/GuiToc.cpp index 74fdae35a6..41d78877fe 100644 --- a/src/frontends/qt4/GuiToc.cpp +++ b/src/frontends/qt4/GuiToc.cpp @@ -41,11 +41,10 @@ namespace lyx { namespace frontend { GuiToc::GuiToc(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags) - : DockView(parent, "toc", area, flags), params_(TOC_CODE) + : DockView(parent, "toc", qt_("Outline"), area, flags), params_(TOC_CODE) { widget_ = new TocWidget(*this); setWidget(widget_); - setWindowTitle(widget_->windowTitle()); } diff --git a/src/frontends/qt4/GuiVSpace.cpp b/src/frontends/qt4/GuiVSpace.cpp index 51b1672e46..8a7442a0c7 100644 --- a/src/frontends/qt4/GuiVSpace.cpp +++ b/src/frontends/qt4/GuiVSpace.cpp @@ -26,6 +26,7 @@ #include "FuncRequest.h" #include "insets/InsetVSpace.h" +#include "support/gettext.h" #include "support/lstrings.h" #include @@ -40,10 +41,9 @@ namespace lyx { namespace frontend { GuiVSpace::GuiVSpace(GuiView & lv) - : GuiDialog(lv, "vspace") + : GuiDialog(lv, "vspace", qt_("Vertical Space Settings")) { setupUi(this); - setViewTitle(_("Vertical Space Settings")); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); connect(applyPB, SIGNAL(clicked()), this, SLOT(slotApply())); diff --git a/src/frontends/qt4/GuiViewSource.cpp b/src/frontends/qt4/GuiViewSource.cpp index f321d979e5..245dc71b18 100644 --- a/src/frontends/qt4/GuiViewSource.cpp +++ b/src/frontends/qt4/GuiViewSource.cpp @@ -39,7 +39,6 @@ ViewSourceWidget::ViewSourceWidget(GuiViewSource & controller) highlighter_(new LaTeXHighlighter(document_)) { setupUi(this); - setWindowTitle(qt_("LaTeX Source")); connect(viewFullSourceCB, SIGNAL(clicked()), this, SLOT(updateView())); @@ -89,11 +88,10 @@ void ViewSourceWidget::update(bool full_source) GuiViewSource::GuiViewSource(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags) - : DockView(parent, "view-source", area, flags) + : DockView(parent, "view-source", qt_("LaTeX Source"), area, flags) { widget_ = new ViewSourceWidget(*this); setWidget(widget_); - setWindowTitle(widget_->windowTitle()); } diff --git a/src/frontends/qt4/GuiWrap.cpp b/src/frontends/qt4/GuiWrap.cpp index 7c31e48b1b..95be49f141 100644 --- a/src/frontends/qt4/GuiWrap.cpp +++ b/src/frontends/qt4/GuiWrap.cpp @@ -19,6 +19,7 @@ #include "insets/InsetWrap.h" +#include "support/gettext.h" #include "support/lstrings.h" #include @@ -31,10 +32,9 @@ namespace lyx { namespace frontend { GuiWrap::GuiWrap(GuiView & lv) - : GuiDialog(lv, "wrap") + : GuiDialog(lv, "wrap", qt_("Wrap Float Settings")) { setupUi(this); - setViewTitle(_("Wrap Float Settings")); connect(restorePB, SIGNAL(clicked()), this, SLOT(slotRestore())); connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); diff --git a/src/frontends/qt4/TocWidget.cpp b/src/frontends/qt4/TocWidget.cpp index f88683d1cc..e90b53aeaf 100644 --- a/src/frontends/qt4/TocWidget.cpp +++ b/src/frontends/qt4/TocWidget.cpp @@ -31,7 +31,6 @@ TocWidget::TocWidget(GuiToc & form, QWidget * parent) : QWidget(parent), depth_(0), form_(form) { setupUi(this); - setWindowTitle(qt_("Outline")); connect(&form_, SIGNAL(modelReset()), SLOT(updateGui())); -- 2.39.5