Skip to content

Commit

Permalink
Added spellcheck functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
letapk committed Apr 10, 2024
1 parent 8b6228a commit 01327c7
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 40 deletions.
2 changes: 1 addition & 1 deletion COPYING
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Jane 0.1
Jane 0.2
is Copyright (c) Kartik Patel
This program is released under the GNU GPL ver 2 or later
E-Mail:letapk@gmail.com
Expand Down
22 changes: 19 additions & 3 deletions README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Jane 0.1
Jane 0.2
========

What is Jane?
Expand Down Expand Up @@ -27,6 +27,15 @@ Availability
------------
Jane is available as source code to compile on your own machine.

Changes in version 0.2
----------------------
Added spellcheck functionality. Wrongly spelled words are underlined and can be corrected
through a right click, and selecting the correct word from the pop-up that appears.

Changes in version 0.2
----------------------
Initial release.

Compiling the source
--------------------
All the source files are available on Github under the following link:
Expand All @@ -37,11 +46,18 @@ The repository is public. Anyone can check out the branch onto her local machine
In addition, you will need the libraries and developement files from Qt, which are
available from the depository of your Linux distribution or from www.qt.io.

You will also need the spellcheck package for Qt (libqtspell-qt5-dev) which may be available
from the package manager of your distribution. Alternatively it can be obtained from
GitHub ("https://github.com/Qt-Widgets/qtspell-spelling-checker").

Since the spellcheck code requires the enchant spell-checking library, that will have to be
installed as well. This should be available through the package manager as well.

If you are using QtCreator, load the project file jane.pro which is available in the source
package. Select the version you want to build (debug version or release version) and hit
Ctrl-B. If there are no problems, this should build the binary.

The program has been compiled and tested on version 5.15.2 of Qt, under Ubuntu
The program has been compiled and tested on version 5.15.3 of Qt, under Ubuntu
22.04.3.

The binary may be stored locally in a directoriy separate from the source subdirectory,
Expand Down Expand Up @@ -79,7 +95,7 @@ Enter your user password when prompted.

What is the copying policy?
---------------------------
While Jane is copyright, (C) 2001 onwards, Kartik Patel the program is also free
While Jane is copyright, (C) 2024 onwards, Kartik Patel the program is also free
software; you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version. This program
Expand Down
Binary file modified docs/janehelp.pdf
Binary file not shown.
15 changes: 13 additions & 2 deletions jane.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ email : letapk@gmail.com
*/

//Last modified 18 Feb 2024
//Last modified 9 April 2024

#ifndef MAINWINDOW_H
#define MAINWINDOW_H
Expand All @@ -42,6 +42,14 @@ email : letapk@gmail.com
#include <QTextCharFormat>
#include <QFontComboBox>
#include <QTranslator>
#include <QActionGroup>
#include <QtSpell-qt5/QtSpell.hpp>

#include <QLibraryInfo>
//#include <QCheckBox>
//#include <QVBoxLayout>
//#include <QDialogButtonBox>
//#include <QPushButton>

namespace Ui {
class MainWindow;
Expand All @@ -50,6 +58,7 @@ class MainWindow;
class MainWindow : public QMainWindow
{

Q_OBJECT
QMenu *filemenu, *helpmenu;

//toolbar and its contents
Expand Down Expand Up @@ -110,7 +119,9 @@ class MainWindow : public QMainWindow

void resizeEvent(QResizeEvent *);

Q_OBJECT
//Q_OBJECT

QtSpell::TextEditChecker* checker;

public:
explicit MainWindow(QWidget *parent = 0);
Expand Down
12 changes: 5 additions & 7 deletions jane.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Last modified 28 Jan 2024
#Last modified 9 April 2024

QT += core gui
QT += core gui

#This should be uncommented to produce a compile time error
#for string literals that are not enclosed within a tr()
Expand All @@ -18,10 +18,7 @@ SOURCES +=\
janemisc.cpp \
janeprefs.cpp

HEADERS += \
jane.h

FORMS +=
HEADERS = jane.h

OTHER_FILES += \
TODO \
Expand All @@ -32,4 +29,5 @@ OTHER_FILES += \
RESOURCES += \
jane.qrc

TRANSLATIONS += jane_de.ts
LIBS += -lqtspell-qt5

15 changes: 5 additions & 10 deletions janemain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ email : letapk@gmail.com
*/

//Last modified 30 Jan 2024
//Last modified 9 April 2024

#include <QHeaderView>
#include <QInputDialog>
Expand All @@ -34,14 +34,6 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(jane);
QApplication app(argc, argv);

QTranslator appTranslator;
appTranslator.load("jane_" + QLocale::system().name(), qApp->applicationDirPath());
app.installTranslator(&appTranslator);

QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(), qApp->applicationDirPath());
app.installTranslator(&qtTranslator);

//get the path to the user's home directory
userpath.clear();
//home/{account-name}
Expand All @@ -53,7 +45,7 @@ int main(int argc, char *argv[])
check_qtdata_dir();

MainWindow mainwindow;
mainwindow.setWindowTitle(QObject::tr("Jane 0.1"));
mainwindow.setWindowTitle(QObject::tr("Jane 0.2"));

mainwindow.show();

Expand Down Expand Up @@ -222,6 +214,9 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
searchthisnotebut->setToolTip(tr("Click to begin search"));
connect (searchthisnotebut, SIGNAL(clicked()), this, SLOT(search_this_note()));

checker = new QtSpell::TextEditChecker(this);
checker->setTextEdit(listeditor);

//read the data file and show the first note
initialize ();
}
Expand Down
34 changes: 17 additions & 17 deletions janemisc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ email : letapk@gmail.com
*/

//Last modified 30 Jan 2024
//Last modified 9 April 2024

#include "jane.h"
#include <QFileDialog>
Expand Down Expand Up @@ -109,7 +109,7 @@ int w, h;
w = width();
h = height();

tb->resize(w - 20, 35);
tb->resize(w - 20, 37);

//resize the tree
listree->setGeometry(10, 110, 300, h - 155);
Expand Down Expand Up @@ -144,12 +144,12 @@ void MainWindow::setuptoolbar()
//toolbar for the editor
tb = new QToolBar;
tb->setParent (this);
tb->setGeometry(10, 30, 1080, 35);
tb->setGeometry(10, 37, 1080, 35);
tb->setFloatable (false);
tb->setMovable(false);

actionTextBold = new QAction(QIcon::fromTheme("", QIcon(":/images/textbold.png")), tr("&Bold"), this);
actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
actionTextBold = new QAction(QIcon::fromTheme("", QIcon(":/images/textbold.png")), tr("&Bold, Ctrl-B"), this);
actionTextBold->setShortcut(Qt::CTRL | Qt::Key_B);
actionTextBold->setPriority(QAction::LowPriority);
QFont bold;
bold.setBold(true);
Expand All @@ -158,18 +158,18 @@ void MainWindow::setuptoolbar()
tb->addAction(actionTextBold);
actionTextBold->setCheckable(true);

actionTextItalic = new QAction(QIcon::fromTheme("", QIcon(":/images/textitalic.png")), tr("&Italic"), this);
actionTextItalic = new QAction(QIcon::fromTheme("", QIcon(":/images/textitalic.png")), tr("&Italic, Ctrl-I"), this);
actionTextItalic->setPriority(QAction::LowPriority);
actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
actionTextItalic->setShortcut(Qt::CTRL | Qt::Key_I);
QFont italic;
italic.setItalic(true);
actionTextItalic->setFont(italic);
connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic()));
tb->addAction(actionTextItalic);
actionTextItalic->setCheckable(true);

actionTextUnderline = new QAction(QIcon::fromTheme("", QIcon(":/images/textunder.png")), tr("&Underline"), this);
actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
actionTextUnderline = new QAction(QIcon::fromTheme("", QIcon(":/images/textunder.png")), tr("&Underline, Ctrl-U"), this);
actionTextUnderline->setShortcut(Qt::CTRL | Qt::Key_U);
actionTextUnderline->setPriority(QAction::LowPriority);
QFont underline;
underline.setUnderline(true);
Expand All @@ -181,21 +181,21 @@ void MainWindow::setuptoolbar()
QActionGroup *grp = new QActionGroup(this);
connect(grp, SIGNAL(triggered(QAction*)), this, SLOT(textAlign(QAction*)));

actionAlignLeft = new QAction(QIcon::fromTheme("", QIcon(":/images/textleft.png")),tr("&Left"), grp);
actionAlignCenter = new QAction(QIcon::fromTheme("",QIcon(":/images/textcenter.png")),tr("C&enter"), grp);
actionAlignRight = new QAction(QIcon::fromTheme("",QIcon(":/images/textright.png")),tr("&Right"), grp);
actionAlignJustify = new QAction(QIcon::fromTheme("",QIcon(":/images/textjustify.png")),tr("&Justify"), grp);
actionAlignLeft = new QAction(QIcon::fromTheme("", QIcon(":/images/textleft.png")),tr("&Left, Ctrl-L"), grp);
actionAlignCenter = new QAction(QIcon::fromTheme("",QIcon(":/images/textcenter.png")),tr("C&enter, Ctrl-E"), grp);
actionAlignRight = new QAction(QIcon::fromTheme("",QIcon(":/images/textright.png")),tr("&Right, Ctrl-R"), grp);
actionAlignJustify = new QAction(QIcon::fromTheme("",QIcon(":/images/textjustify.png")),tr("&Justify, Ctrl-J"), grp);

actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L);
actionAlignLeft->setShortcut(Qt::CTRL | Qt::Key_L);
actionAlignLeft->setCheckable(true);
actionAlignLeft->setPriority(QAction::LowPriority);
actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E);
actionAlignCenter->setShortcut(Qt::CTRL | Qt::Key_E);
actionAlignCenter->setCheckable(true);
actionAlignCenter->setPriority(QAction::LowPriority);
actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R);
actionAlignRight->setShortcut(Qt::CTRL | Qt::Key_R);
actionAlignRight->setCheckable(true);
actionAlignRight->setPriority(QAction::LowPriority);
actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
actionAlignJustify->setShortcut(Qt::CTRL | Qt::Key_J);
actionAlignJustify->setCheckable(true);
actionAlignJustify->setPriority(QAction::LowPriority);

Expand Down

0 comments on commit 01327c7

Please sign in to comment.