]> git.lyx.org Git - features.git/commitdiff
merge QSpellChecker and QSpellcheckerDialog
authorAndré Pönitz <poenitz@gmx.net>
Tue, 24 Apr 2007 15:32:14 +0000 (15:32 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 24 Apr 2007 15:32:14 +0000 (15:32 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17953 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/Makefile.am
src/frontends/qt4/Makefile.dialogs
src/frontends/qt4/QSpellchecker.C
src/frontends/qt4/QSpellchecker.h
src/frontends/qt4/QSpellcheckerDialog.C [deleted file]
src/frontends/qt4/QSpellcheckerDialog.h [deleted file]

index 0d22519cea0417ac6f2585e73d49a65d78b4794f..07054948a95904478ba51c9362fe3dc293b2d81e 100644 (file)
@@ -70,7 +70,6 @@ libqt4_la_SOURCES = \
        QRef.C QRef.h \
        QSendto.C QSendto.h \
        QShowFile.C QShowFile.h \
-       QSpellchecker.C QSpellchecker.h \
        QTabular.C QTabular.h \
        QTabularCreate.C QTabularCreate.h \
        Qt2BC.C Qt2BC.h \
index f7a83863ad544e3be91baa8d802070be27202b29..845880d0b3d4f064d5e30d7fb6e5c32c19d37bde 100644 (file)
@@ -122,7 +122,7 @@ MOCFILES = \
        QSendtoDialog.C QSendtoDialog.h \
        qsetborder.C qsetborder.h \
        QShowFileDialog.C QShowFileDialog.h \
-       QSpellcheckerDialog.C QSpellcheckerDialog.h \
+       QSpellchecker.C QSpellchecker.h \
        QDialogView.C QDialogView.h \
        QTabularCreateDialog.C QTabularCreateDialog.h \
        QTabularDialog.C QTabularDialog.h \
index 1c43e69ef97cb87a6719989b64eab4a239f446bf..2089fb00b9f2ab651fc122348927f6c38cca2632 100644 (file)
@@ -11,7 +11,6 @@
 #include <config.h>
 
 #include "QSpellchecker.h"
-#include "QSpellcheckerDialog.h"
 #include "Qt2BC.h"
 #include "qt_helpers.h"
 
 #include <QPushButton>
 #include <QListWidget>
 #include <QListWidgetItem>
+#include <QCloseEvent>
+#include <QSyntaxHighlighter>
+#include <QTextCharFormat>
+#include <QTextDocument>
+
 
 using std::string;
 
 namespace lyx {
 namespace frontend {
 
-typedef QController<ControlSpellchecker, QView<QSpellcheckerDialog> > spellchecker_base_class;
+/////////////////////////////////////////////////////////////////////
+//
+// QSpellCheckerDialog
+//
+/////////////////////////////////////////////////////////////////////
+
+
+QSpellcheckerDialog::QSpellcheckerDialog(QSpellchecker * form)
+       : form_(form)
+{
+       setupUi(this);
+
+       connect(closePB, SIGNAL(clicked()), form, SLOT(slotClose()));
+
+       connect(replaceCO, SIGNAL(highlighted(const QString &)),
+               this, SLOT(replaceChanged(const QString &)));
+       connect(replacePB, SIGNAL(clicked()),
+               this, SLOT(replaceClicked()));
+       connect(ignorePB, SIGNAL(clicked()),
+               this, SLOT(ignoreClicked()));
+       connect(replacePB_3, SIGNAL(clicked()),
+               this, SLOT(acceptClicked()));
+       connect(addPB, SIGNAL(clicked()),
+               this, SLOT(addClicked()));
+       connect(suggestionsLW, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
+               this, SLOT(replaceClicked() ) );
+       connect(suggestionsLW, SIGNAL(itemClicked(QListWidgetItem*)),
+               this, SLOT(suggestionChanged(QListWidgetItem*)));
+}
+
+
+void QSpellcheckerDialog::acceptClicked()
+{
+       form_->accept();
+}
+
+void QSpellcheckerDialog::addClicked()
+{
+       form_->add();
+}
+
+void QSpellcheckerDialog::replaceClicked()
+{
+       form_->replace();
+}
+
+void QSpellcheckerDialog::ignoreClicked()
+{
+       form_->ignore();
+}
+
+void QSpellcheckerDialog::suggestionChanged(QListWidgetItem * item)
+{
+       if (replaceCO->count() != 0)
+               replaceCO->setItemText(0, item->text());
+       else
+               replaceCO->addItem(item->text());
+
+       replaceCO->setCurrentIndex(0);
+}
+
+void QSpellcheckerDialog::replaceChanged(const QString & str)
+{
+       if (suggestionsLW->currentItem()->text() == str)
+               return;
+
+       for (int i = 0; i < suggestionsLW->count(); ++i) {
+               if (suggestionsLW->item(i)->text() == str) {
+                       suggestionsLW->setCurrentRow(i);
+                       break;
+               }
+       }
+}
+
+
+void QSpellcheckerDialog::closeEvent(QCloseEvent * e)
+{
+       form_->slotWMHide();
+       e->accept();
+}
+
+
+void QSpellcheckerDialog::reject()
+{
+       form_->slotWMHide();
+       QDialog::reject();
+}
+
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// QSpellChecker
+//
+/////////////////////////////////////////////////////////////////////
+
+typedef QController<ControlSpellchecker, QView<QSpellcheckerDialog> >
+       SpellcheckerBase;
 
 QSpellchecker::QSpellchecker(Dialog & parent)
-       : spellchecker_base_class(parent, _("Spellchecker"))
+       : SpellcheckerBase(parent, _("Spellchecker"))
 {}
 
 
@@ -110,3 +211,5 @@ void QSpellchecker::partialUpdate(int s)
 
 } // namespace frontend
 } // namespace lyx
+
+#include "QSpellchecker_moc.cpp"
index 67d00de62712a97d29b64104c50e0a8d2e37bf0b..2a72716ee91b7993999bba729a0b9ab1ab8e56e9 100644 (file)
 #define QSPELLCHECKER_H
 
 #include "QDialogView.h"
-#include "QSpellcheckerDialog.h"
+#include "ui/SpellcheckerUi.h"
+
+#include <QDialog>
+#include <QCloseEvent>
+
+class QListWidgetItem;
 
 namespace lyx {
 namespace frontend {
 
+class QSpellchecker;
+
+class QSpellcheckerDialog: public QDialog, public Ui::QSpellcheckerUi {
+       Q_OBJECT
+public:
+       QSpellcheckerDialog(QSpellchecker * form);
+public Q_SLOTS:
+       virtual void suggestionChanged(QListWidgetItem *);
+
+protected Q_SLOTS:
+       virtual void acceptClicked();
+       virtual void addClicked();
+       virtual void replaceClicked();
+       virtual void ignoreClicked();
+       virtual void replaceChanged(const QString &);
+       virtual void reject();
+
+protected:
+       virtual void closeEvent(QCloseEvent * e);
+
+private:
+       QSpellchecker * form_;
+};
+
+
 class ControlSpellchecker;
 
 class QSpellchecker
diff --git a/src/frontends/qt4/QSpellcheckerDialog.C b/src/frontends/qt4/QSpellcheckerDialog.C
deleted file mode 100644 (file)
index b714ac3..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/**
- * \file QSpellcheckerDialog.C
- * 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 "QSpellcheckerDialog.h"
-#include "QSpellchecker.h"
-
-#include <QListWidget>
-#include <QPushButton>
-#include <QCloseEvent>
-
-namespace lyx {
-namespace frontend {
-
-QSpellcheckerDialog::QSpellcheckerDialog(QSpellchecker * form)
-       : form_(form)
-{
-       setupUi(this);
-
-       connect(closePB, SIGNAL(clicked()),
-               form, SLOT(slotClose()));
-
-       connect( replaceCO, SIGNAL( highlighted(const QString&) ),
-               this, SLOT( replaceChanged(const QString &) ) );
-       connect( replacePB, SIGNAL( clicked() ),
-               this, SLOT( replaceClicked() ) );
-       connect( ignorePB, SIGNAL( clicked() ),
-               this, SLOT( ignoreClicked() ) );
-       connect( replacePB_3, SIGNAL( clicked() ),
-               this, SLOT( acceptClicked() ) );
-       connect( addPB, SIGNAL( clicked() ),
-               this, SLOT( addClicked() ) );
-       connect( suggestionsLW, SIGNAL( itemDoubleClicked(QListWidgetItem*) ),
-               this, SLOT( replaceClicked() ) );
-       connect( suggestionsLW, SIGNAL( itemClicked(QListWidgetItem*) ),
-               this, SLOT( suggestionChanged(QListWidgetItem*) ) );
-}
-
-
-void QSpellcheckerDialog::acceptClicked()
-{
-       form_->accept();
-}
-
-void QSpellcheckerDialog::addClicked()
-{
-       form_->add();
-}
-
-void QSpellcheckerDialog::replaceClicked()
-{
-       form_->replace();
-}
-
-void QSpellcheckerDialog::ignoreClicked()
-{
-       form_->ignore();
-}
-
-void QSpellcheckerDialog::suggestionChanged(QListWidgetItem * item)
-{
-       if (replaceCO->count() != 0)
-               replaceCO->setItemText(0, item->text());
-       else
-               replaceCO->addItem(item->text());
-
-       replaceCO->setCurrentIndex(0);
-}
-
-void QSpellcheckerDialog::replaceChanged(const QString & str)
-{
-       if (suggestionsLW->currentItem()->text() == str)
-               return;
-
-       for (int i = 0; i < suggestionsLW->count(); ++i) {
-               if (suggestionsLW->item(i)->text() == str) {
-                       suggestionsLW->setCurrentRow(i);
-                       break;
-               }
-       }
-}
-
-
-void QSpellcheckerDialog::closeEvent(QCloseEvent * e)
-{
-       form_->slotWMHide();
-       e->accept();
-}
-
-
-void QSpellcheckerDialog::reject()
-{
-       form_->slotWMHide();
-       QDialog::reject();
-}
-
-} // namespace frontend
-} // namespace lyx
-
-#include "QSpellcheckerDialog_moc.cpp"
diff --git a/src/frontends/qt4/QSpellcheckerDialog.h b/src/frontends/qt4/QSpellcheckerDialog.h
deleted file mode 100644 (file)
index d4c8fee..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-// -*- C++ -*-
-/**
- * \file QSpellcheckerDialog.h
- * 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.
- */
-
-#ifndef QSPELLCHECKERDIALOG_H
-#define QSPELLCHECKERDIALOG_H
-
-#include "ui/SpellcheckerUi.h"
-
-#include <QDialog>
-#include <QCloseEvent>
-
-class QListWidgetItem;
-
-namespace lyx {
-namespace frontend {
-
-class QSpellchecker;
-
-class QSpellcheckerDialog: public QDialog, public Ui::QSpellcheckerUi {
-       Q_OBJECT
-public:
-       QSpellcheckerDialog(QSpellchecker * form);
-public Q_SLOTS:
-       virtual void suggestionChanged(QListWidgetItem *);
-
-protected Q_SLOTS:
-       virtual void acceptClicked();
-       virtual void addClicked();
-       virtual void replaceClicked();
-       virtual void ignoreClicked();
-       virtual void replaceChanged(const QString &);
-       virtual void reject();
-
-protected:
-       virtual void closeEvent(QCloseEvent * e);
-
-private:
-       QSpellchecker * form_;
-};
-
-} // namespace frontend
-} // namespace lyx
-
-#endif // QSPELLCHECKERDIALOG_H