]> git.lyx.org Git - features.git/commitdiff
Get rid of GuiIndex since we no longer need it. Simplify the remaining code.
authorRichard Heck <rgheck@comcast.net>
Thu, 14 Feb 2008 18:06:47 +0000 (18:06 +0000)
committerRichard Heck <rgheck@comcast.net>
Thu, 14 Feb 2008 18:06:47 +0000 (18:06 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@23006 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiIndex.cpp [deleted file]
src/frontends/qt4/GuiIndex.h [deleted file]
src/frontends/qt4/GuiLabel.cpp [new file with mode: 0644]
src/frontends/qt4/GuiLabel.h [new file with mode: 0644]
src/frontends/qt4/GuiView.cpp
src/frontends/qt4/Makefile.am
src/frontends/qt4/ui/IndexUi.ui [deleted file]
src/frontends/qt4/ui/LabelUi.ui [new file with mode: 0644]

diff --git a/src/frontends/qt4/GuiIndex.cpp b/src/frontends/qt4/GuiIndex.cpp
deleted file mode 100644 (file)
index 737b30c..0000000
+++ /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 <config.h>
-
-#include "GuiIndex.h"
-
-#include "support/debug.h"
-#include "qt_helpers.h"
-
-#include <QLabel>
-#include <QPushButton>
-#include <QLineEdit>
-#include <QCloseEvent>
-
-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 (file)
index 32d1a27..0000000
+++ /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 (file)
index 0000000..d49bb74
--- /dev/null
@@ -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 <config.h>
+
+#include "GuiLabel.h"
+
+#include "support/debug.h"
+#include "qt_helpers.h"
+
+#include <QLabel>
+#include <QPushButton>
+#include <QLineEdit>
+#include <QCloseEvent>
+
+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 (file)
index 0000000..15ecdee
--- /dev/null
@@ -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
index 7e7439573ea63f72b2e977a9217af02a24ce4f79..ef3f5b7933dd2c190f6d4d5ace81079a10d183b2 100644 (file)
@@ -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")
index 4a054ad3ba9ce9dccadb8a100605383dc402d2bb..8965b97f9286c8cfb4f866b77a7bfd17d5a9a5fe 100644 (file)
@@ -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 (file)
index 76895fd..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-<ui version="4.0" >
- <class>IndexUi</class>
- <widget class="QDialog" name="IndexUi" >
-  <property name="geometry" >
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>203</width>
-    <height>82</height>
-   </rect>
-  </property>
-  <property name="windowTitle" >
-   <string/>
-  </property>
-  <property name="sizeGripEnabled" >
-   <bool>true</bool>
-  </property>
-  <layout class="QVBoxLayout" >
-   <property name="margin" >
-    <number>11</number>
-   </property>
-   <property name="spacing" >
-    <number>6</number>
-   </property>
-   <item>
-    <layout class="QHBoxLayout" >
-     <property name="margin" >
-      <number>0</number>
-     </property>
-     <property name="spacing" >
-      <number>6</number>
-     </property>
-     <item>
-      <widget class="QLabel" name="keywordLA" >
-       <property name="toolTip" >
-        <string/>
-       </property>
-       <property name="text" >
-        <string/>
-       </property>
-       <property name="buddy" >
-        <cstring>keywordED</cstring>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QLineEdit" name="keywordED" >
-       <property name="toolTip" >
-        <string/>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-   <item>
-    <layout class="QHBoxLayout" >
-     <property name="margin" >
-      <number>0</number>
-     </property>
-     <property name="spacing" >
-      <number>6</number>
-     </property>
-     <item>
-      <spacer>
-       <property name="orientation" >
-        <enum>Qt::Horizontal</enum>
-       </property>
-       <property name="sizeType" >
-        <enum>QSizePolicy::Expanding</enum>
-       </property>
-       <property name="sizeHint" >
-        <size>
-         <width>20</width>
-         <height>20</height>
-        </size>
-       </property>
-      </spacer>
-     </item>
-     <item>
-      <widget class="QPushButton" name="okPB" >
-       <property name="text" >
-        <string>&amp;OK</string>
-       </property>
-       <property name="default" >
-        <bool>true</bool>
-       </property>
-      </widget>
-     </item>
-     <item>
-      <widget class="QPushButton" name="closePB" >
-       <property name="text" >
-        <string>Cancel</string>
-       </property>
-       <property name="autoDefault" >
-        <bool>false</bool>
-       </property>
-       <property name="default" >
-        <bool>false</bool>
-       </property>
-      </widget>
-     </item>
-    </layout>
-   </item>
-  </layout>
- </widget>
- <includes>
-  <include location="local" >qt_helpers.h</include>
- </includes>
- <resources/>
- <connections/>
-</ui>
diff --git a/src/frontends/qt4/ui/LabelUi.ui b/src/frontends/qt4/ui/LabelUi.ui
new file mode 100644 (file)
index 0000000..3edf562
--- /dev/null
@@ -0,0 +1,111 @@
+<ui version="4.0" >
+ <class>LabelUi</class>
+ <widget class="QDialog" name="LabelUi" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>300</width>
+    <height>82</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string/>
+  </property>
+  <property name="sizeGripEnabled" >
+   <bool>true</bool>
+  </property>
+  <layout class="QVBoxLayout" >
+   <property name="margin" >
+    <number>11</number>
+   </property>
+   <property name="spacing" >
+    <number>6</number>
+   </property>
+   <item>
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <widget class="QLabel" name="keywordLA" >
+       <property name="toolTip" >
+        <string/>
+       </property>
+       <property name="text" >
+        <string>&amp;Label:</string>
+       </property>
+       <property name="buddy" >
+        <cstring>keywordED</cstring>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLineEdit" name="keywordED" >
+       <property name="toolTip" >
+        <string/>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" >
+     <property name="margin" >
+      <number>0</number>
+     </property>
+     <property name="spacing" >
+      <number>6</number>
+     </property>
+     <item>
+      <spacer>
+       <property name="orientation" >
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeType" >
+        <enum>QSizePolicy::Expanding</enum>
+       </property>
+       <property name="sizeHint" >
+        <size>
+         <width>20</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="okPB" >
+       <property name="text" >
+        <string>&amp;OK</string>
+       </property>
+       <property name="default" >
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="closePB" >
+       <property name="text" >
+        <string>Cancel</string>
+       </property>
+       <property name="autoDefault" >
+        <bool>false</bool>
+       </property>
+       <property name="default" >
+        <bool>false</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <includes>
+  <include location="local" >qt_helpers.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>