File indexing completed on 2024-04-14 03:58:19

0001 // krazy:excludeall=spelling
0002 /**
0003  * test_dialog.cpp
0004  *
0005  * SPDX-FileCopyrightText: 2004 Zack Rusin <zack@kde.org>
0006  *
0007  * SPDX-License-Identifier: LGPL-2.1-or-later
0008  */
0009 #include "dialogexample.h"
0010 
0011 #include "backgroundchecker.h"
0012 
0013 #include <QApplication>
0014 #include <QDebug>
0015 using namespace Sonnet;
0016 
0017 TestDialog::TestDialog()
0018     : QObject(nullptr)
0019 {
0020 }
0021 
0022 //@@snippet_begin(dictionary_combo_box_example)
0023 void TestDialog::check(const QString &buffer)
0024 {
0025     Sonnet::Dialog *dlg = new Sonnet::Dialog(new BackgroundChecker(this), nullptr);
0026     connect(dlg, &Dialog::spellCheckDone, this, &TestDialog::doneChecking);
0027     dlg->setBuffer(buffer);
0028     dlg->show();
0029 }
0030 
0031 //@@snippet_end
0032 
0033 void TestDialog::doneChecking(const QString &buf)
0034 {
0035     qDebug() << "Done with :" << buf;
0036     qApp->quit();
0037 }
0038 
0039 int main(int argc, char **argv)
0040 {
0041     QApplication app(argc, argv);
0042 
0043     TestDialog test;
0044     test.check(
0045         QString::fromLatin1("This is a sample buffer. Whih this thingg will "
0046                             "be checkin for misstakes. Whih, Enviroment, govermant. Whih."));
0047 
0048     return app.exec();
0049 }
0050 
0051 #include "moc_dialogexample.cpp"