+2001-09-01 John Levon <moz@compsoc.man.ac.uk>
+
+ * Makefile.dialogs:
+ * Dialogs.C:
+ * QSpellchecker.[Ch]:
+ * QSpellcheckerDialog.[Ch]:
+ * ui/QSpellcheckerDialog.ui: add spellchecker dialog
+
2001-08-31 Edwin Leuven <leuven@fee.uva.nl>
* ui/QMinipageDialog.ui: layout tweak again (but it's getting better)
#include "QPrintDialog.h"
#include "QRefDialog.h"
#include "QSearchDialog.h"
+#include "QSpellcheckerDialog.h"
#include "QTabularCreateDialog.h"
#include "QThesaurusDialog.h"
#include "QURLDialog.h"
#include "QPrint.h"
#include "QRef.h"
#include "QSearch.h"
+#include "QSpellchecker.h"
#include "QSplash.h"
#include "QTabularCreate.h"
#include "QThesaurus.h"
#include "controllers/ControlPrint.h"
#include "controllers/ControlRef.h"
#include "controllers/ControlSearch.h"
+#include "controllers/ControlSpellchecker.h"
#include "controllers/ControlSplash.h"
#include "controllers/ControlTabularCreate.h"
#include "controllers/ControlThesaurus.h"
#include "controllers/ControlUrl.h"
#include "controllers/ControlVCLog.h"
#if 0
-#include "controllers/ControlButtons.h"
#include "controllers/ControlCitation.h"
#include "controllers/ControlFloat.h"
-#include "controllers/ControlLabel.h"
#include "controllers/ControlRef.h"
-#include "controllers/ControlSpellchecker.h"
#include "controllers/ControlToc.h"
#endif
add(new GUIPrint<QPrint, Qt2BC>(*lv, *this));
add(new GUIRef<QRef, Qt2BC>(*lv, *this));
add(new GUISearch<QSearch, Qt2BC>(*lv, *this));
+ add(new GUISpellchecker<QSpellchecker, Qt2BC>(*lv, *this));
add(new GUITabularCreate<QTabularCreate, Qt2BC>(*lv, *this));
add(new GUIThesaurus<QThesaurus, Qt2BC>(*lv, *this));
add(new GUIUrl<QURL, Qt2BC>(*lv, *this));
QPrint \
QRef \
QSearch \
+ QSpellchecker \
QSplash \
QTabularCreate \
QThesaurus \
QRef.C QRefDialog.C \
QSearch.h QSearchDialog.h \
QSearch.C QSearchDialog.C \
+ QSpellchecker.h QSpellcheckerDialog.h \
+ QSpellchecker.C QSpellcheckerDialog.C \
QSplash.h QSplashDialog.h \
QSplash.C QSplashDialog.C \
QTabularCreate.h QTabularCreateDialog.h \
QPrintDialog_moc.C \
QRefDialog_moc.C \
QSearchDialog_moc.C \
+ QSpellcheckerDialog_moc.C \
QSplashDialog_moc.C \
QTabularCreateDialog_moc.C \
QThesaurusDialog_moc.C \
QRefDialogBase.C \
QSearchDialogBase.h \
QSearchDialogBase.C \
+ QSpellcheckerDialogBase.h \
+ QSpellcheckerDialogBase.C \
QTabularCreateDialogBase.h \
QTabularCreateDialogBase.C \
QThesaurusDialogBase.h \
QPrintDialogBase_moc.C \
QRefDialogBase_moc.C \
QSearchDialogBase_moc.C \
+ QSpellcheckerDialogBase_moc.C \
QTabularCreateDialogBase_moc.C \
QThesaurusDialogBase_moc.C \
QTocDialogBase_moc.C \
--- /dev/null
+/**
+ * \file QSpellchecker.C
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include <config.h>
+
+#include "ControlSpellchecker.h"
+#include "QSpellcheckerDialog.h"
+#include "QSpellchecker.h"
+#include "Qt2BC.h"
+#include "gettext.h"
+
+#include <qprogressbar.h>
+#include <qmessagebox.h>
+#include <qlineedit.h>
+#include <qpushbutton.h>
+#include <qlistbox.h>
+#include <qcombobox.h>
+
+typedef Qt2CB<ControlSpellchecker, Qt2DB<QSpellcheckerDialog> > base_class;
+
+QSpellchecker::QSpellchecker(ControlSpellchecker & c)
+ : base_class(c, _("Spellchecker"))
+{
+}
+
+
+void QSpellchecker::build_dialog()
+{
+ dialog_.reset(new QSpellcheckerDialog(this));
+
+ bc().setCancel(dialog_->closePB);
+ dialog_->wordED->setReadOnly(true);
+}
+
+
+void QSpellchecker::update_contents()
+{
+ dialog_->wordED->setText("");
+ dialog_->replaceCO->clear();
+ dialog_->suggestionsLB->clear();
+}
+
+
+void QSpellchecker::accept()
+{
+ controller().ignoreAll();
+}
+
+
+void QSpellchecker::add()
+{
+ controller().insert();
+}
+
+
+void QSpellchecker::ignore()
+{
+ controller().check();
+}
+
+
+void QSpellchecker::replace()
+{
+ controller().replace(dialog_->replaceCO->currentText().latin1());
+}
+
+
+void QSpellchecker::options()
+{
+ controller().options();
+}
+
+
+void QSpellchecker::spellcheck()
+{
+ controller().check();
+ dialog_->spellcheckPB->setEnabled(false);
+}
+
+
+void QSpellchecker::stop()
+{
+ controller().stop();
+ dialog_->spellcheckPB->setEnabled(true);
+ hide();
+}
+
+
+void QSpellchecker::partialUpdate(int id)
+{
+ switch (id) {
+ case 0:
+ dialog_->spellcheckPR->setProgress(controller().getProgress());
+ break;
+ case 1:
+ {
+ dialog_->wordED->setText(controller().getWord().c_str());
+ dialog_->suggestionsLB->clear();
+
+ string w;
+ while (!(w = controller().getSuggestion()).empty()) {
+ dialog_->suggestionsLB->insertItem(w.c_str());
+ }
+ }
+ break;
+ case 2:
+ dialog_->spellcheckPB->setEnabled(true);
+ hide();
+ QMessageBox::information(0, _("Spellcheck complete"), controller().getMessage().c_str() , _("OK"));
+ break;
+ }
+}
--- /dev/null
+// -*- C++ -*-
+/**
+ * \file QSpellchecker.h
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ * \author Kalle Dalheimer <kalle@klaralvdalens-datakonsult.se>
+ */
+
+#ifndef QSPELLCHECKER_H
+#define QSPELLCHECKER_H
+
+#include "Qt2Base.h"
+
+
+class ControlSpellchecker;
+class QSpellcheckerDialog;
+
+class QSpellchecker :
+ public Qt2CB<ControlSpellchecker, Qt2DB<QSpellcheckerDialog> >
+{
+ friend class QSpellcheckerDialog;
+
+public:
+ QSpellchecker(ControlSpellchecker &);
+
+ /// update from controller
+ void partialUpdate(int id);
+
+private:
+ void stop();
+ void accept();
+ void add();
+ void ignore();
+ void replace();
+ void options();
+ void spellcheck();
+
+ /// Apply changes
+ virtual void apply() {};
+ /// update
+ virtual void update_contents();
+ /// build the dialog
+ virtual void build_dialog();
+};
+
+#endif // QSPELLCHECKER_H
--- /dev/null
+/**
+ * \file QSpellcheckerDialog.C
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#include <config.h>
+
+#include "QSpellcheckerDialog.h"
+#include "Dialogs.h"
+#include "QSpellchecker.h"
+#include "gettext.h"
+
+#include <qpushbutton.h>
+#include <qlineedit.h>
+#include <qlistbox.h>
+#include <qcombobox.h>
+
+QSpellcheckerDialog::QSpellcheckerDialog(QSpellchecker * form)
+ : QSpellcheckerDialogBase(0, 0, false, 0),
+ form_(form)
+{
+ connect(closePB, SIGNAL(clicked()),
+ this, SLOT(stop()));
+}
+
+
+void QSpellcheckerDialog:: suggestionChanged(const QString & str)
+{
+ if (replaceCO->count() != 0)
+ replaceCO->changeItem(str, 0);
+ else
+ replaceCO->insertItem(str);
+
+ replaceCO->setCurrentItem(0);
+}
+
+
+void QSpellcheckerDialog:: replaceChanged(const QString & str)
+{
+ if (suggestionsLB->currentText() == str)
+ return;
+
+ int i = 0;
+ for (; i < suggestionsLB->count(); ++i) {
+ if (suggestionsLB->text(i) == str)
+ break;
+ }
+
+ if (i != suggestionsLB->count())
+ suggestionsLB->setCurrentItem(i);
+}
+
+
+void QSpellcheckerDialog::closeEvent(QCloseEvent * e)
+{
+ form_->slotWMHide();
+ e->accept();
+}
--- /dev/null
+/**
+ * \file QSpellcheckerDialog.h
+ * Copyright 2001 the LyX Team
+ * Read the file COPYING
+ *
+ * \author John Levon <moz@compsoc.man.ac.uk>
+ */
+
+#ifndef QSPELLCHECKERDIALOG_H
+#define QSPELLCHECKERDIALOG_H
+
+#include <config.h>
+
+#include "ui/QSpellcheckerDialogBase.h"
+
+#include "QSpellchecker.h"
+
+class QSpellcheckerDialog : public QSpellcheckerDialogBase
+{ Q_OBJECT
+
+public:
+ QSpellcheckerDialog(QSpellchecker * form);
+
+protected slots:
+ virtual void stop() {
+ form_->stop();
+ }
+
+ virtual void acceptClicked() {
+ form_->accept();
+ }
+ virtual void spellcheckClicked() {
+ form_->spellcheck();
+ }
+ virtual void addClicked() {
+ form_->add();
+ }
+ virtual void replaceClicked() {
+ form_->replace();
+ }
+ virtual void ignoreClicked() {
+ form_->ignore();
+ }
+ virtual void optionsClicked() {
+ form_->options();
+ }
+ virtual void suggestionChanged(const QString &);
+ virtual void replaceChanged(const QString &);
+
+protected:
+ virtual void closeEvent(QCloseEvent * e);
+
+private:
+ QSpellchecker * form_;
+};
+
+#endif // QSPELLCHECKERDIALOG_H
--- /dev/null
+<!DOCTYPE UI><UI>
+<class>QSpellcheckerDialogBase</class>
+<include location="global">config.h</include>
+<include location="local">gettext.h</include>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>QSpellcheckerDialogBase</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>434</width>
+ <height>282</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Spellchecker</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>Layout8</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>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout7</cstring>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout10</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>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout9</cstring>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>wordED</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Current word</string>
+ </property>
+ </widget>
+ <widget row="1" column="0" >
+ <class>QComboBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>replaceCO</cstring>
+ </property>
+ <property stdset="1">
+ <name>focusPolicy</name>
+ <enum>StrongFocus</enum>
+ </property>
+ <property stdset="1">
+ <name>editable</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>insertionPolicy</name>
+ <enum>AtTop</enum>
+ </property>
+ <property stdset="1">
+ <name>autoCompletion</name>
+ <bool>true</bool>
+ </property>
+ <property stdset="1">
+ <name>duplicatesEnabled</name>
+ <bool>false</bool>
+ </property>
+ <property stdset="1">
+ <name>sizePolicy</name>
+ <sizepolicy>
+ <hsizetype>3</hsizetype>
+ <vsizetype>0</vsizetype>
+ </sizepolicy>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Replace with selected word</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer11</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>MinimumExpanding</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QListBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>suggestionsLB</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Suggestions</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QProgressBar</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>spellcheckPR</cstring>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>How far spellchecking has got</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout5</cstring>
+ </property>
+ <vbox>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <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 word with current choice</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ignorePB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Ignore</string>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Ignore this word</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>replacePB_3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Accept</string>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Accept word for this session</string>
+ </property>
+ </widget>
+ <widget>
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>addPB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Add to dictionary</string>
+ </property>
+ <property>
+ <name>toolTip</name>
+ <string>Add the word to your personal dictionary</string>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer10</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Vertical</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>
+ </vbox>
+ </widget>
+ </hbox>
+ </widget>
+ <widget>
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout1</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>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>spellcheckPB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Spellcheck ...</string>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer6</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>optionsPB</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&Options ...</string>
+ </property>
+ </widget>
+ <spacer>
+ <property>
+ <name>name</name>
+ <cstring>Spacer5</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>suggestionsLB</sender>
+ <signal>highlighted(const QString&)</signal>
+ <receiver>QSpellcheckerDialogBase</receiver>
+ <slot>suggestionChanged(const QString &)</slot>
+ </connection>
+ <connection>
+ <sender>replaceCO</sender>
+ <signal>highlighted(const QString&)</signal>
+ <receiver>QSpellcheckerDialogBase</receiver>
+ <slot>replaceChanged(const QString &)</slot>
+ </connection>
+ <connection>
+ <sender>replacePB</sender>
+ <signal>clicked()</signal>
+ <receiver>QSpellcheckerDialogBase</receiver>
+ <slot>replaceClicked()</slot>
+ </connection>
+ <connection>
+ <sender>ignorePB</sender>
+ <signal>clicked()</signal>
+ <receiver>QSpellcheckerDialogBase</receiver>
+ <slot>ignoreClicked()</slot>
+ </connection>
+ <connection>
+ <sender>replacePB_3</sender>
+ <signal>clicked()</signal>
+ <receiver>QSpellcheckerDialogBase</receiver>
+ <slot>acceptClicked()</slot>
+ </connection>
+ <connection>
+ <sender>addPB</sender>
+ <signal>clicked()</signal>
+ <receiver>QSpellcheckerDialogBase</receiver>
+ <slot>addClicked()</slot>
+ </connection>
+ <connection>
+ <sender>optionsPB</sender>
+ <signal>clicked()</signal>
+ <receiver>QSpellcheckerDialogBase</receiver>
+ <slot>optionsClicked()</slot>
+ </connection>
+ <connection>
+ <sender>spellcheckPB</sender>
+ <signal>clicked()</signal>
+ <receiver>QSpellcheckerDialogBase</receiver>
+ <slot>spellcheckClicked()</slot>
+ </connection>
+ <slot access="public">acceptClicked()</slot>
+ <slot access="public">addClicked()</slot>
+ <slot access="public">ignoreClicked()</slot>
+ <slot access="public">optionsClicked()</slot>
+ <slot access="public">replaceChanged(const QString &)</slot>
+ <slot access="public">replaceClicked()</slot>
+ <slot access="public">spellcheckClicked()</slot>
+ <slot access="public">suggestionChanged(const QString &)</slot>
+</connections>
+</UI>