From: Richard Heck Date: Thu, 14 Feb 2008 18:06:47 +0000 (+0000) Subject: Get rid of GuiIndex since we no longer need it. Simplify the remaining code. X-Git-Tag: 1.6.10~6265 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=85deaeb1659c4bcd5cb8d60bbdebe55506a767d5;p=features.git Get rid of GuiIndex since we no longer need it. Simplify the remaining code. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23006 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiIndex.cpp b/src/frontends/qt4/GuiIndex.cpp deleted file mode 100644 index 737b30c1e0..0000000000 --- a/src/frontends/qt4/GuiIndex.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/** - * \file GuiIndex.cpp - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author John Levon - * - * Full author contact details are available in file CREDITS. - */ - -#include - -#include "GuiIndex.h" - -#include "support/debug.h" -#include "qt_helpers.h" - -#include -#include -#include -#include - -using namespace std; - -namespace lyx { -namespace frontend { - -///////////////////////////////////////////////////////////////// -// -// Base implementation -// -///////////////////////////////////////////////////////////////// - -GuiIndexDialogBase::GuiIndexDialogBase(GuiView & lv, - QString const & title, QString const & label, string const & name) - : GuiCommand(lv, name, title) -{ - label_ = label; - setupUi(this); - - connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); - connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); - connect(keywordED, SIGNAL(textChanged(const QString &)), - this, SLOT(change_adaptor())); - - setFocusProxy(keywordED); - - keywordLA->setText(label_); - - keywordED->setWhatsThis( qt_( - "The format of the entry in the index.\n" - "\n" - "An entry can be specified as a sub-entry of\n" - "another with \"!\":\n" - "\n" - "cars!mileage\n" - "\n" - "You can cross-refer to another entry like so:\n" - "\n" - "cars!mileage|see{economy}\n" - "\n" - "For further details refer to the local LaTeX\n" - "documentation.\n") - ); - - bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy); - bc().setOK(okPB); - bc().setCancel(closePB); - bc().addReadOnly(keywordED); -} - - -void GuiIndexDialogBase::change_adaptor() -{ - changed(); -} - - -void GuiIndexDialogBase::reject() -{ - slotClose(); -} - - -void GuiIndexDialogBase::closeEvent(QCloseEvent * e) -{ - slotClose(); - e->accept(); -} - - -void GuiIndexDialogBase::updateContents() -{ - docstring const contents = params_["name"]; - keywordED->setText(toqstr(contents)); - bc().setValid(!contents.empty()); -} - - -void GuiIndexDialogBase::applyView() -{ - params_["name"] = qstring_to_ucs4(keywordED->text()); -} - - -bool GuiIndexDialogBase::isValid() -{ - return !keywordED->text().isEmpty(); -} - - -///////////////////////////////////////////////////////////////// -// -// Index Dialog -// -///////////////////////////////////////////////////////////////// - - -GuiIndex::GuiIndex(GuiView & lv) - : GuiIndexDialogBase(lv, qt_("Index Entry"), qt_("&Keyword:"), "index") -{ - keywordED->setWhatsThis( qt_( - "The format of the entry in the index.\n" - "\n" - "An entry can be specified as a sub-entry of\n" - "another with \"!\":\n" - "\n" - "cars!mileage\n" - "\n" - "You can cross-refer to another entry like so:\n" - "\n" - "cars!mileage|see{economy}\n" - "\n" - "For further details refer to the local LaTeX\n" - "documentation.\n") - ); -} - - -Dialog * createGuiIndex(GuiView & lv) { return new GuiIndex(lv); } - - -///////////////////////////////////////////////////////////////// -// -// Label Dialog -// -///////////////////////////////////////////////////////////////// - -GuiLabel::GuiLabel(GuiView & lv) - : GuiIndexDialogBase(lv, qt_("Label"), qt_("&Label:"), "label") -{} - - -Dialog * createGuiLabel(GuiView & lv) { return new GuiLabel(lv); } - - -} // namespace frontend -} // namespace lyx - -#include "GuiIndex_moc.cpp" diff --git a/src/frontends/qt4/GuiIndex.h b/src/frontends/qt4/GuiIndex.h deleted file mode 100644 index 32d1a27b90..0000000000 --- a/src/frontends/qt4/GuiIndex.h +++ /dev/null @@ -1,66 +0,0 @@ -// -*- C++ -*- -/** - * \file GuiIndex.h - * This file is part of LyX, the document processor. - * Licence details can be found in the file COPYING. - * - * \author John Levon - * \author Kalle Dalheimer - * - * Full author contact details are available in file CREDITS. - */ - -#ifndef GUIINDEX_H -#define GUIINDEX_H - -#include "GuiDialog.h" -#include "ui_IndexUi.h" - -namespace lyx { -namespace frontend { - -class GuiIndexDialogBase : public GuiCommand, public Ui::IndexUi -{ - Q_OBJECT - -public: - GuiIndexDialogBase(GuiView & lv, QString const & title, - QString const & label, std::string const & name); - -private Q_SLOTS: - void change_adaptor(); - void reject(); - -private: - /// - void closeEvent(QCloseEvent * e); - /// - bool isValid(); - /// Apply changes - void applyView(); - /// update - void updateContents(); - - /// - QString label_; -}; - - -class GuiIndex : public GuiIndexDialogBase -{ -public: - GuiIndex(GuiView & lv); -}; - - -class GuiLabel : public GuiIndexDialogBase -{ -public: - GuiLabel(GuiView & lv); -}; - - -} // namespace frontend -} // namespace lyx - -#endif // GUIINDEX_H diff --git a/src/frontends/qt4/GuiLabel.cpp b/src/frontends/qt4/GuiLabel.cpp new file mode 100644 index 0000000000..d49bb74585 --- /dev/null +++ b/src/frontends/qt4/GuiLabel.cpp @@ -0,0 +1,98 @@ +/** + * \file GuiLabel.cpp + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author John Levon + * + * Full author contact details are available in file CREDITS. + */ + +#include + +#include "GuiLabel.h" + +#include "support/debug.h" +#include "qt_helpers.h" + +#include +#include +#include +#include + +using namespace std; + +namespace lyx { +namespace frontend { + +///////////////////////////////////////////////////////////////// +// +// Base implementation +// +///////////////////////////////////////////////////////////////// + +GuiLabel::GuiLabel(GuiView & lv) + : GuiCommand(lv, "label", qt_("Label")) +{ + setupUi(this); + + connect(okPB, SIGNAL(clicked()), this, SLOT(slotOK())); + connect(closePB, SIGNAL(clicked()), this, SLOT(slotClose())); + connect(keywordED, SIGNAL(textChanged(const QString &)), + this, SLOT(change_adaptor())); + + setFocusProxy(keywordED); + + bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy); + bc().setOK(okPB); + bc().setCancel(closePB); + bc().addReadOnly(keywordED); +} + + +void GuiLabel::change_adaptor() +{ + changed(); +} + + +void GuiLabel::reject() +{ + slotClose(); +} + + +void GuiLabel::closeEvent(QCloseEvent * e) +{ + slotClose(); + e->accept(); +} + + +void GuiLabel::updateContents() +{ + docstring const contents = params_["name"]; + keywordED->setText(toqstr(contents)); + bc().setValid(!contents.empty()); +} + + +void GuiLabel::applyView() +{ + params_["name"] = qstring_to_ucs4(keywordED->text()); +} + + +bool GuiLabel::isValid() +{ + return !keywordED->text().isEmpty(); +} + + +Dialog * createGuiLabel(GuiView & lv) { return new GuiLabel(lv); } + + +} // namespace frontend +} // namespace lyx + +#include "GuiLabel_moc.cpp" diff --git a/src/frontends/qt4/GuiLabel.h b/src/frontends/qt4/GuiLabel.h new file mode 100644 index 0000000000..15ecdee562 --- /dev/null +++ b/src/frontends/qt4/GuiLabel.h @@ -0,0 +1,48 @@ +// -*- C++ -*- +/** + * \file GuiLabel.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author John Levon + * \author Kalle Dalheimer + * + * Full author contact details are available in file CREDITS. + */ + +#ifndef GUILABEL_H +#define GUILABEL_H + +#include "GuiDialog.h" +#include "ui_LabelUi.h" + +namespace lyx { +namespace frontend { + +class GuiLabel : public GuiCommand, public Ui::LabelUi +{ + Q_OBJECT + +public: + GuiLabel(GuiView & lv); + +private Q_SLOTS: + void change_adaptor(); + void reject(); + +private: + /// + void closeEvent(QCloseEvent * e); + /// + bool isValid(); + /// Apply changes + void applyView(); + /// update + void updateContents(); +}; + + +} // namespace frontend +} // namespace lyx + +#endif // GUIINDEX_H diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 7e7439573e..ef3f5b7933 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -2128,7 +2128,6 @@ Dialog * createGuiExternal(GuiView & lv); Dialog * createGuiFloat(GuiView & lv); Dialog * createGuiGraphics(GuiView & lv); Dialog * createGuiInclude(GuiView & lv); -Dialog * createGuiIndex(GuiView & lv); Dialog * createGuiLabel(GuiView & lv); Dialog * createGuiListings(GuiView & lv); Dialog * createGuiLog(GuiView & lv); @@ -2193,8 +2192,6 @@ Dialog * GuiView::build(string const & name) return createGuiGraphics(*this); if (name == "include") return createGuiInclude(*this); - if (name == "index") - return createGuiIndex(*this); if (name == "nomenclature") return createGuiNomenclature(*this); if (name == "label") diff --git a/src/frontends/qt4/Makefile.am b/src/frontends/qt4/Makefile.am index 4a054ad3ba..8965b97f92 100644 --- a/src/frontends/qt4/Makefile.am +++ b/src/frontends/qt4/Makefile.am @@ -88,8 +88,8 @@ SOURCEFILES = \ GuiIdListModel.cpp \ GuiImage.cpp \ GuiInclude.cpp \ - GuiIndex.cpp \ GuiKeySymbol.cpp \ + GuiLabel.cpp \ GuiListings.cpp \ GuiLog.cpp \ GuiMath.cpp \ @@ -182,7 +182,7 @@ MOCHEADER = \ GuiGraphics.h \ GuiHyperlink.h \ GuiInclude.h \ - GuiIndex.h \ + GuiLabel.h \ GuiListings.h \ GuiLog.h \ GuiMathMatrix.h \ @@ -248,7 +248,7 @@ UIFILES = \ GraphicsUi.ui \ HyperlinkUi.ui \ IncludeUi.ui \ - IndexUi.ui \ + LabelUi.ui \ LanguageUi.ui \ LaTeXUi.ui \ ListingsUi.ui \ diff --git a/src/frontends/qt4/ui/IndexUi.ui b/src/frontends/qt4/ui/IndexUi.ui deleted file mode 100644 index 76895fdfd5..0000000000 --- a/src/frontends/qt4/ui/IndexUi.ui +++ /dev/null @@ -1,111 +0,0 @@ - - IndexUi - - - - 0 - 0 - 203 - 82 - - - - - - - true - - - - 11 - - - 6 - - - - - 0 - - - 6 - - - - - - - - - - - keywordED - - - - - - - - - - - - - - - - 0 - - - 6 - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 20 - 20 - - - - - - - - &OK - - - true - - - - - - - Cancel - - - false - - - false - - - - - - - - - qt_helpers.h - - - - diff --git a/src/frontends/qt4/ui/LabelUi.ui b/src/frontends/qt4/ui/LabelUi.ui new file mode 100644 index 0000000000..3edf562d9f --- /dev/null +++ b/src/frontends/qt4/ui/LabelUi.ui @@ -0,0 +1,111 @@ + + LabelUi + + + + 0 + 0 + 300 + 82 + + + + + + + true + + + + 11 + + + 6 + + + + + 0 + + + 6 + + + + + + + + &Label: + + + keywordED + + + + + + + + + + + + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 20 + 20 + + + + + + + + &OK + + + true + + + + + + + Cancel + + + false + + + false + + + + + + + + + qt_helpers.h + + + +