+2001-08-27 John Levon <moz@compsoc.man.ac.uk>
+
+ * Dialogs.C:
+ * Makefile.dialogs:
+ * QThesaurus.[Ch]:
+ * QThesaurusDialog.[Ch]:
+ * ui/QThesaurusDialog.ui: add thesaurus dialog
+
2001-08-27 John Levon <moz@compsoc.man.ac.uk>
* Dialogs.C:
#include "QExternalDialog.h"
#include "QIndexDialog.h"
#include "QRefDialog.h"
+#include "QThesaurusDialog.h"
#include "QURLDialog.h"
#include "QAbout.h"
#include "QSearch.h"
#include "QSplash.h"
#include "QTabularCreate.h"
+#include "QThesaurus.h"
#include "QURL.h"
#include "QtLyXView.h"
#include "controllers/ControlIndex.h"
#include "controllers/ControlRef.h"
#include "controllers/ControlSplash.h"
+#include "controllers/ControlThesaurus.h"
#include "controllers/ControlUrl.h"
#if 0
#include "controllers/ControlButtons.h"
#include "controllers/ControlSearch.h"
#include "controllers/ControlSpellchecker.h"
#include "controllers/ControlTabularCreate.h"
-#include "controllers/ControlThesaurus.h"
#include "controllers/ControlToc.h"
#include "controllers/ControlVCLog.h"
#endif
add(new GUIExternal<QExternal, Qt2BC>(*lv, *this));
add(new GUIIndex<QIndex, Qt2BC>(*lv, *this));
add(new GUIRef<QRef, Qt2BC>(*lv, *this));
+ add(new GUIThesaurus<QThesaurus, Qt2BC>(*lv, *this));
add(new GUIUrl<QURL, Qt2BC>(*lv, *this));
// reduce the number of connections needed in
QSearch \
QSplash \
QTabularCreate \
+ QThesaurus \
QToc \
QURL
QSplash.C QSplashDialog.C \
QTabularCreate.h QTabularCreateDialog.h \
QTabularCreate.C QTabularCreateDialog.C \
+ QThesaurus.h QThesaurusDialog.h \
+ QThesaurus.C QThesaurusDialog.C \
QToc.h QTocDialog.h \
QToc.C QTocDialog.C \
QURL.h QURLDialog.h \
QSearchDialog_moc.C \
QSplashDialog_moc.C \
QTabularCreateDialog_moc.C \
+ QThesaurusDialog_moc.C \
QTocDialog_moc.C \
QURLDialog_moc.C
QSearchDialogBase.C \
QTabularCreateDialogBase.h \
QTabularCreateDialogBase.C \
+ QThesaurusDialogBase.h \
+ QThesaurusDialogBase.C \
QTocDialogBase.h \
QTocDialogBase.C \
QURLDialogBase.h \
QRefDialogBase_moc.C \
QSearchDialogBase_moc.C \
QTabularCreateDialogBase_moc.C \
+ QThesaurusDialogBase_moc.C \
QTocDialogBase_moc.C \
QURLDialogBase_moc.C
--- /dev/null
+/**
+ * \file QThesaurus.C
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include <config.h>
+
+#include "ControlThesaurus.h"
+#include "QThesaurusDialog.h"
+#include "QThesaurus.h"
+#include "Qt2BC.h"
+#include "gettext.h"
+
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qlistbox.h>
+
+typedef Qt2CB<ControlThesaurus, Qt2DB<QThesaurusDialog> > base_class;
+
+QThesaurus::QThesaurus(ControlThesaurus & c)
+ : base_class(c, _("Thesaurus"))
+{
+}
+
+
+void QThesaurus::build_dialog()
+{
+ dialog_.reset(new QThesaurusDialog(this));
+
+ bc().setCancel(dialog_->closePB);
+ bc().addReadOnly(dialog_->replaceED);
+ bc().addReadOnly(dialog_->replacePB);
+}
+
+
+void QThesaurus::update_contents()
+{
+ dialog_->entryED->setText(controller().text().c_str());
+ dialog_->updateLists();
+}
+
+
+void QThesaurus::replace()
+{
+ controller().replace(dialog_->replaceED->text().latin1());
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file QThesaurus.h
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#ifndef QTHESAURUS_H
+#define QTHESAURUS_H
+
+#include "Qt2Base.h"
+
+class ControlThesaurus;
+class QThesaurusDialog;
+
+class QThesaurus :
+ public Qt2CB<ControlThesaurus, Qt2DB<QThesaurusDialog> >
+{
+ friend class QThesaurusDialog;
+
+public:
+ QThesaurus(ControlThesaurus &);
+
+private:
+ /// Apply changes
+ virtual void apply();
+ /// update
+ virtual void update_contents();
+ /// build the dialog
+ virtual void build_dialog();
+
+ /// replace the word
+ void replace();
+};
+
+#endif // QTHESAURUS_H
--- /dev/null
+/**
+ * \file QThesaurusDialog.C
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include <config.h>
+#include <vector>
+
+#include "LString.h"
+
+#include "ControlThesaurus.h"
+#include "QThesaurusDialog.h"
+#include "Dialogs.h"
+#include "QThesaurus.h"
+
+#include <qwidget.h>
+#include <qpushbutton.h>
+#include <qlistbox.h>
+#include <qlineedit.h>
+
+QThesaurusDialog::QThesaurusDialog(QThesaurus * form)
+ : QThesaurusDialogBase(0, 0, false, 0),
+ form_(form)
+{
+ connect(closePB, SIGNAL(clicked()),
+ form, SLOT(slotClose()));
+}
+
+
+void QThesaurusDialog::change_adaptor()
+{
+ form_->changed();
+}
+
+
+void QThesaurusDialog::closeEvent(QCloseEvent * e)
+{
+ form_->slotWMHide();
+ e->accept();
+}
+
+
+void QThesaurusDialog::entryChanged()
+{
+ updateLists();
+}
+
+
+void QThesaurusDialog::replaceClicked()
+{
+ form_->replace();
+}
+
+
+void QThesaurusDialog::selectionChanged(const QString & str)
+{
+ string const entry(str.latin1());
+ entryED->setText(entry.c_str());
+ updateLists();
+}
+
+
+void QThesaurusDialog::updateLists()
+{
+ ControlThesaurus & control(form_->controller());
+ string const entry(entryED->text().latin1());
+
+ std::vector<string> matches;
+
+ matches = control.getNouns(entry);
+ for (std::vector<string>::const_iterator cit = matches.begin();
+ cit != matches.end(); ++cit)
+ nounsLB->insertItem(cit->c_str());
+ matches = control.getVerbs(entry);
+ for (std::vector<string>::const_iterator cit = matches.begin();
+ cit != matches.end(); ++cit)
+ verbsLB->insertItem(cit->c_str());
+ matches = control.getAdjectives(entry);
+ for (std::vector<string>::const_iterator cit = matches.begin();
+ cit != matches.end(); ++cit)
+ adjectivesLB->insertItem(cit->c_str());
+ matches = control.getAdverbs(entry);
+ for (std::vector<string>::const_iterator cit = matches.begin();
+ cit != matches.end(); ++cit)
+ adverbsLB->insertItem(cit->c_str());
+ matches = control.getOthers(entry);
+ for (std::vector<string>::const_iterator cit = matches.begin();
+ cit != matches.end(); ++cit)
+ otherLB->insertItem(cit->c_str());
+}
--- /dev/null
+/**
+ * \file QThesaurusDialog.h
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#ifndef QTHESAURUSDIALOG_H
+#define QTHESAURUSDIALOG_H
+
+#include <config.h>
+
+#include "ui/QThesaurusDialogBase.h"
+
+class QThesaurus;
+
+class QThesaurusDialog : public QThesaurusDialogBase
+{ Q_OBJECT
+
+public:
+ QThesaurusDialog(QThesaurus * form);
+
+ void updateLists();
+
+protected slots:
+ virtual void change_adaptor();
+ virtual void entryChanged();
+ virtual void replaceClicked();
+ virtual void selectionChanged(const QString &);
+
+protected:
+ virtual void closeEvent(QCloseEvent * e);
+
+private:
+ QThesaurus * form_;
+};
+
+#endif // QTHESAURUSDIALOG_H
--- /dev/null
+<!DOCTYPE UI><UI>
+<class>QThesaurusDialogBase</class>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>QThesaurusDialogBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>490</width>
+ <height>442</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Thesaurus</string>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>entryLA</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Keyword</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>entryED</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Index entry</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>entryED</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Entry</string>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QTabWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TabWidget2</cstring>
+ </property>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>&Nouns</string>
+ </attribute>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QListBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>nounsLB</cstring>
+ </property>
+ <property stdset="1">
+ <name>columnMode</name>
+ <enum>FitToHeight</enum>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Matching nouns</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>&Verbs</string>
+ </attribute>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QListBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>New Item</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>verbsLB</cstring>
+ </property>
+ <property stdset="1">
+ <name>columnMode</name>
+ <enum>FitToHeight</enum>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>&Adjectives</string>
+ </attribute>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QListBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>New Item</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>adjectivesLB</cstring>
+ </property>
+ <property stdset="1">
+ <name>columnMode</name>
+ <enum>FitToHeight</enum>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>A&dverbs</string>
+ </attribute>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QListBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>New Item</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>adverbsLB</cstring>
+ </property>
+ <property stdset="1">
+ <name>columnMode</name>
+ <enum>FitToHeight</enum>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>tab</cstring>
+ </property>
+ <attribute>
+ <name>title</name>
+ <string>&Other</string>
+ </attribute>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QListBox</class>
+ <item>
+ <property>
+ <name>text</name>
+ <string>New Item</string>
+ </property>
+ </item>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>otherLB</cstring>
+ </property>
+ <property stdset="1">
+ <name>columnMode</name>
+ <enum>FitToHeight</enum>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout5</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>selectionLA</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Selection</string>
+ </property>
+ <property>
+ <name>buddy</name>
+ <cstring>selectionED</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>The selected entry</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>replaceED</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>The selected entry</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>replacePB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Replace</string>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Replace the entry with the selection</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout27</cstring>
+ </property>
+ <hbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer3</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Expanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>closePB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Close</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </vbox>
+</widget>
+<connections>
+ <connection>
+ <sender>replaceED</sender>
+ <signal>returnPressed()</signal>
+ <receiver>QThesaurusDialogBase</receiver>
+ <slot>replaceClicked()</slot>
+ </connection>
+ <connection>
+ <sender>replaceED</sender>
+ <signal>textChanged(const QString&)</signal>
+ <receiver>QThesaurusDialogBase</receiver>
+ <slot>change_adaptor()</slot>
+ </connection>
+ <connection>
+ <sender>nounsLB</sender>
+ <signal>selected(const QString&)</signal>
+ <receiver>QThesaurusDialogBase</receiver>
+ <slot>selectionChanged(const QString &)</slot>
+ </connection>
+ <connection>
+ <sender>verbsLB</sender>
+ <signal>selected(const QString&)</signal>
+ <receiver>QThesaurusDialogBase</receiver>
+ <slot>selectionChanged(const QString &)</slot>
+ </connection>
+ <connection>
+ <sender>adjectivesLB</sender>
+ <signal>selected(const QString&)</signal>
+ <receiver>QThesaurusDialogBase</receiver>
+ <slot>selectionChanged(const QString &)</slot>
+ </connection>
+ <connection>
+ <sender>adverbsLB</sender>
+ <signal>selected(const QString&)</signal>
+ <receiver>QThesaurusDialogBase</receiver>
+ <slot>selectionChanged(const QString &)</slot>
+ </connection>
+ <connection>
+ <sender>otherLB</sender>
+ <signal>selected(const QString&)</signal>
+ <receiver>QThesaurusDialogBase</receiver>
+ <slot>selectionChanged(const QString &)</slot>
+ </connection>
+ <connection>
+ <sender>entryED</sender>
+ <signal>returnPressed()</signal>
+ <receiver>QThesaurusDialogBase</receiver>
+ <slot>entryChanged()</slot>
+ </connection>
+ <connection>
+ <sender>replacePB</sender>
+ <signal>clicked()</signal>
+ <receiver>QThesaurusDialogBase</receiver>
+ <slot>replaceClicked()</slot>
+ </connection>
+ <slot access="public">change_adaptor()</slot>
+ <slot access="public">entryChanged()</slot>
+ <slot access="public">replaceClicked()</slot>
+ <slot access="public">selectionChanged(const QString &)</slot>
+</connections>
+<tabstops>
+ <tabstop>TabWidget2</tabstop>
+ <tabstop>entryED</tabstop>
+ <tabstop>nounsLB</tabstop>
+ <tabstop>verbsLB</tabstop>
+ <tabstop>adjectivesLB</tabstop>
+ <tabstop>adverbsLB</tabstop>
+ <tabstop>otherLB</tabstop>
+ <tabstop>replaceED</tabstop>
+ <tabstop>replacePB</tabstop>
+ <tabstop>closePB</tabstop>
+</tabstops>
+</UI>