diff --git a/FrameWorkCode/Project.cpp b/FrameWorkCode/Project.cpp index bce7e54a..ffcbae82 100755 --- a/FrameWorkCode/Project.cpp +++ b/FrameWorkCode/Project.cpp @@ -671,7 +671,7 @@ void Project::set_verifier(){ QString id=user_id; std::string role = id.toUtf8().constData(); auto c = doc.child("Project").child("Metadata"); - c.child("Verifier").first_child().set_value(role.c_str()); + c.child("Verifier").first_child().set_value("None"); save_xml(); } @@ -686,148 +686,164 @@ void Project::set_verifier(){ * \param branchName * \return bool */ -bool Project::push(QString branchName) { -// lg2_add(); -// git_libgit2_init(); -// login_tries = 1; -// git_remote * remote = NULL; - -// QByteArray array = branchName.toLocal8Bit(); -// char* char_arr = array.data(); -// char * refspec = (char*)"refs/heads/"; -// char buffer[256]; -// strncpy(buffer, refspec, sizeof(buffer)); -// strncat(buffer, char_arr, sizeof(buffer)); -// qDebug()<<"Buffer"<SpecialCharacters->setText(R"(¶ ¦ Ȝ ȝ — – ‑ ° · † ‡ § ऽ ❀ ✿ ✽ ꕥ 💮 A᳒ B᳒ C᳒ D᳒ E᳒ F᳒ G᳒ H᳒ I᳒ J᳒ K᳒ L᳒ M᳒ N᳒ O᳒ P᳒ Q᳒ R᳒ S᳒ T᳒ U᳒ V᳒ W᳒ X᳒ Y᳒ Z᳒ -A᳙ B᳙ C᳙ D᳙ E᳙ F᳙ G᳙ H᳙ I᳙ J᳙ K᳙ L᳙ M᳙ N᳙ O᳙ P᳙ Q᳙ R᳙ S᳙ T᳙ U᳙ V᳙ W᳙ X᳙ Y᳙ Z᳙ )"); +A᳙ B᳙ C᳙ D᳙ E᳙ F᳙ G᳙ H᳙ I᳙ J᳙ K᳙ L᳙ M᳙ N᳙ O᳙ P᳙ Q᳙ R᳙ S᳙ T᳙ U᳙ V᳙ W᳙ X᳙ Y᳙ Z᳙ +• ⊙ ◉ ○ ◌ ● ⦿ ◆ ◇ ★ □ ✓ ✦ ➔ ➢ ➣ ➤ ▶ ▷ ⬛ ◼ ◾ ♦ ⚫ #⃣ ℹ ⛔ ⚠ ➡ *⃣ )"); setWindowTitle("Special Symbols"); ui->Diacritics->setText( R"(A diff --git a/FrameWorkCode/Symbols.h b/FrameWorkCode/Symbols.h index a524dc32..9560e94f 100755 --- a/FrameWorkCode/Symbols.h +++ b/FrameWorkCode/Symbols.h @@ -20,6 +20,9 @@ public slots: void on_copyButton_clicked(); void tabChanged(int idx); +private slots: + + private: Ui::SymbolsView *ui; QTextEdit *currentTab; diff --git a/FrameWorkCode/Symbols.ui b/FrameWorkCode/Symbols.ui index b525547d..d8d88c7a 100755 --- a/FrameWorkCode/Symbols.ui +++ b/FrameWorkCode/Symbols.ui @@ -82,7 +82,7 @@ QScrollBar::sub-line:vertical { - 2 + 1 @@ -98,7 +98,6 @@ QScrollBar::sub-line:vertical { Work Sans -1 - 50 false false @@ -112,8 +111,11 @@ font-size:30px; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css"> p, li { white-space: pre-wrap; } +hr { height: 1px; border-width: 0; } +li.unchecked::marker { content: "\2610"; } +li.checked::marker { content: "\2612"; } </style></head><body style=" font-family:'Work Sans'; font-size:30px; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Shobhika'; font-size:16pt;"><br /></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Shobhika'; font-size:16pt;"><br /></p></body></html> @@ -133,7 +135,6 @@ p, li { white-space: pre-wrap; } Work Sans -1 - 50 false false @@ -146,8 +147,11 @@ p, li { white-space: pre-wrap; } <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css"> p, li { white-space: pre-wrap; } +hr { height: 1px; border-width: 0; } +li.unchecked::marker { content: "\2610"; } +li.checked::marker { content: "\2612"; } </style></head><body style=" font-family:'Work Sans'; font-size:30px; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Shobhika'; font-size:16pt;"><br /></p></body></html> @@ -166,7 +170,6 @@ p, li { white-space: pre-wrap; } Work Sans -1 - 50 false false false @@ -180,8 +183,11 @@ p, li { white-space: pre-wrap; } <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css"> p, li { white-space: pre-wrap; } +hr { height: 1px; border-width: 0; } +li.unchecked::marker { content: "\2610"; } +li.checked::marker { content: "\2612"; } </style></head><body style=" font-family:'Work Sans'; font-size:30px; font-weight:400; font-style:normal;"> <p style="-qt-paragraph-type:empty; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Shobhika'; font-size:16pt;"><br /></p></body></html> diff --git a/FrameWorkCode/customtextbrowser.cpp b/FrameWorkCode/customtextbrowser.cpp index 7f07c3cb..09ccece9 100644 --- a/FrameWorkCode/customtextbrowser.cpp +++ b/FrameWorkCode/customtextbrowser.cpp @@ -19,20 +19,27 @@ */ CustomTextBrowser::CustomTextBrowser(QWidget *parent): QTextBrowser(parent) { - this->setReadOnly(false); c = new QCompleter((CustomTextBrowser *)this); - //c->setModel(modelFromFile(":/WordList/wordlists/english.txt")); - //c->setModelSorting(QCompleter::CaseInsensitivelySortedModel); - //c->setCaseSensitivity(Qt::CaseInsensitive); this->setCompleter(c); - QAbstractItemModel *temp; if(modelFlag == 0){ engModel = modelFromFile(":/WordList/wordlists/english.txt"); devModel = modelFromFile(":/WordList/wordlists/sanskrit.txt"); modelFlag = 1; } + + // Setup grip band + m_gripBand = new RubberBand(this); + m_gripBand->setMoveEnabled(false); + m_gripBand->setVisible(false); + + connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateGripBand())); + connect(this, SIGNAL(textChanged()), this, SLOT(updateGripBand())); + connect(this, SIGNAL(currentCharFormatChanged(const QTextCharFormat&)), this, SLOT(updateGripBand())); + connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(updateGripBand())); + connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(updateGripBand())); + connect(m_gripBand, SIGNAL(resizeFinished(QRect)), this, SLOT(resizeObject(QRect))); } /*! @@ -123,6 +130,66 @@ void CustomTextBrowser::insertCompletion(const QString &completion) setTextCursor(tc); } +/*! + * \fn CustomTextBrowser::updateGripBand + * \brief This function updates the geometry of rubber band + * whenever a signal like cursorPositionChanged or value of horizontal and vertical scroll bars is emitted. + */ +void CustomTextBrowser::updateGripBand() +{ + QTextCursor cursor = textCursor(); + m_gripBand->setVisible(!cursor.hasSelection() && cursor.charFormat().isImageFormat()); + + if (!cursor.hasSelection() && cursor.charFormat().isImageFormat()) { + QTextImageFormat fmt = cursor.charFormat().toImageFormat(); + + if (!cursor.atBlockStart()) + cursor.movePosition(QTextCursor::Left); + + QRect rc = cursorRect(cursor); + rc.setLeft(rc.left() + 1); + rc.setTop(rc.top() + 1); + rc.setWidth(fmt.width()); + rc.setHeight(rc.height() + 1); + + if (!rc.width()) { + QImage image = document()->resource(QTextDocument::ImageResource, fmt.name()).value(); + rc.setWidth(image.width()); + } + + m_gripBand->setGeometry(rc); + } +} + +/*! + * \fn CustomTextBrowser::resizeObject + * \brief Resizes the image to the geometry of rubber band after the mouse button is released. + * \param rect Used for resizing the image object to the geometry of this rect + */ +void CustomTextBrowser::resizeObject(const QRect &rect) +{ + QTextCursor cursor = textCursor(); + + if (cursor.charFormat().isImageFormat()) { + QTextImageFormat fmt = cursor.charFormat().toImageFormat(); + fmt.setWidth(rect.width()); + fmt.setHeight(rect.height()); + cursor.setCharFormat(fmt); + + QTextCursor temp = cursor; + + if (!temp.atBlockStart()) { + temp.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor); + } else { + temp.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor); + } + + setTextCursor(temp); + setCurrentCharFormat(fmt); + setTextCursor(cursor); + } +} + /*! * \fn CustomTextBrowser::textUnderCursor * \brief This function returns the word under the cursor. @@ -147,6 +214,18 @@ void CustomTextBrowser::focusInEvent(QFocusEvent *e) QTextBrowser::focusInEvent(e); } +/*! + * \fn CustomTextBrowser::resizeEvent + * \brief Updates the rubber band whenever geometry of this browser is altered. + * \param event QResizeEvent is used for passing it to QTextBrowser but not used for updating rubber band. + */ +void CustomTextBrowser::resizeEvent(QResizeEvent *event) +{ + updateGripBand(); + + QTextBrowser::resizeEvent(event); +} + /*! * \fn CustomTextBrowser::keyPressEvent * \brief The function is written to ignore key events like Qt::Key_Enter, Qt::Key_Return, Qt::Key_Escape, Qt::Key_Tab, and Qt::Key_Backtab so the completer can handle them. If there is an active completer, we cannot process the shortcut, Ctrl+E. e also handle other modifiers and shortcuts for which we do not want the completer to respond to. diff --git a/FrameWorkCode/customtextbrowser.h b/FrameWorkCode/customtextbrowser.h index 9c7e5bef..9a15a049 100644 --- a/FrameWorkCode/customtextbrowser.h +++ b/FrameWorkCode/customtextbrowser.h @@ -1,10 +1,10 @@ - #ifndef CUSTOMTEXTBROWSER_H #define CUSTOMTEXTBROWSER_H #include -#include -#include"slpNPatternDict.h" +#include +#include "slpNPatternDict.h" +#include "rubberband.h" QT_BEGIN_NAMESPACE class QCompleter; @@ -30,16 +30,19 @@ class CustomTextBrowser : public QTextBrowser protected: void keyPressEvent(QKeyEvent *e) override; void focusInEvent(QFocusEvent *e) override; + void resizeEvent(QResizeEvent *event) override; private slots: void insertCompletion(const QString &completion); + void updateGripBand(); + void resizeObject(const QRect &rect); private: QString textUnderCursor() const; - private: QCompleter *c = nullptr; + RubberBand *m_gripBand; }; //! [0] diff --git a/FrameWorkCode/dashboard.ui b/FrameWorkCode/dashboard.ui index 1281a410..18a29830 100644 --- a/FrameWorkCode/dashboard.ui +++ b/FrameWorkCode/dashboard.ui @@ -6,10 +6,16 @@ 0 0 - 555 - 342 + 791 + 488 + + + 0 + 0 + + Dialog @@ -21,8 +27,8 @@ -15 11 - 561 - 291 + 801 + 441 @@ -35,8 +41,8 @@ margin-left: 25%; - 430 - 310 + 670 + 460 111 25 @@ -53,13 +59,14 @@ margin-left: 25%; 10 - 310 + 450 31 31 - border:0px; + border:0px; +margin-top:5px; @@ -78,12 +85,15 @@ margin-left: 25%; - 250 - 310 + 490 + 460 67 21 + + + Project ID @@ -91,8 +101,8 @@ margin-left: 25%; - 323 - 310 + 560 + 460 101 26 diff --git a/FrameWorkCode/handlebbox.cpp b/FrameWorkCode/handlebbox.cpp index a6c07f07..d76f8d93 100644 --- a/FrameWorkCode/handlebbox.cpp +++ b/FrameWorkCode/handlebbox.cpp @@ -111,6 +111,7 @@ QTextDocument *HandleBbox::loadFileInDoc(QFile *f) i = i - 1; if(l[i].contains("")){ flag_ = 0; + int num = doc->blockCount(); inputText += l[i]; inputText += " "; inputText = latex2png(inputText); @@ -128,8 +129,12 @@ QTextDocument *HandleBbox::loadFileInDoc(QFile *f) } cur.insertBlock(); cur.insertHtml(inputText); + cur2 = QTextCursor(doc->findBlockByNumber(num)); + cur2.select(QTextCursor::BlockUnderCursor); + cur2.deletePreviousChar(); cur.setBlockFormat(blockFormat); inputText = ""; + } } diff --git a/FrameWorkCode/main.cpp b/FrameWorkCode/main.cpp index 4df24014..b384af00 100755 --- a/FrameWorkCode/main.cpp +++ b/FrameWorkCode/main.cpp @@ -92,7 +92,8 @@ int main(int argc, char *argv[]) a.setWindowIcon(windowIcon); //Sets icon of the GUI window. a.setStyleSheet("QMessageBox{font: 15px \"Work Sans\"; background:rgb(32, 33, 72);} QMessageBox QLabel{color:white;} QMessageBox QPushButton{background-color:rgb(227, 228, 228);border:0px; color: rgb(32, 33, 72); height:26.96px; width: 113.5px; padding-top:1px; border-radius:4.8px; padding-left:1.3px; selection-color: rgb(32, 33, 72); selection-background-color: rgb(136, 138, 133);} QMessageBox QPushButton:checked{background-color: rgb(136, 138, 133);} QMessageBox QPushButton:pressed {background-color: rgb(136, 138, 133);}"); a.setApplicationName( QStringLiteral( "Udaan Editing Tool" ) ); - a.setApplicationVersion("v3.2.0"); + a.setApplicationVersion("v3.5.4"); + a.setAttribute(Qt::AA_EnableHighDpiScaling); //! Writing Log Files QFile logFile(QString::fromStdString(qApp->applicationDirPath().toStdString())+"/application.log"); diff --git a/FrameWorkCode/mainwindow.cpp b/FrameWorkCode/mainwindow.cpp index 08acf721..66f66ee7 100644 --- a/FrameWorkCode/mainwindow.cpp +++ b/FrameWorkCode/mainwindow.cpp @@ -83,6 +83,7 @@ #include #include "threadingpush.h"> #include +#include map LSTM; map Dict, GBook, IBook, PWords, PWordsP,ConfPmap,ConfPmapFont,CPairRight; @@ -170,7 +171,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),ui(new Ui::MainWin ui->lineEdit_2->setReadOnly(true); ui->lineEdit_3->setReadOnly(true); - googleAuth(); +// googleAuth(); QString password = ""; QString passwordFilePath = QDir::currentPath() + "/pass.txt"; @@ -221,7 +222,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),ui(new Ui::MainWin gHindi+= "ग़् - $,, ऩ् - %,, ऑ - Z,, ऱ् - V,, ज़ - F,, ड़्/ड़ -x/xa,, ढ़्/ढ़ - X/Xa,, य़् - &,, क़ - @,, ख़ - #,, फ़् - ^,, ॅ - *,, ,, ,, "; gHindi += common; gHindi.replace(",, ", "\n"); - QFont font("Chandas"); + QFont font("Shobhika"); font.setWeight(14); font.setPointSize(12); ui->textEdit->setFont(font); @@ -265,6 +266,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),ui(new Ui::MainWin ui->actionLoadGDocPage->setVisible(false); ui->menuSelectLanguage->setTitle(""); ui->menuCreateReports->setTitle(""); + ui->pushButton_2->setVisible(false); // Disabling some buttons while opening the tool @@ -361,7 +363,7 @@ bool MainWindow::setRole(QString role) settings.endGroup(); if(!role.isEmpty()){ mRole = role; - qDebug()<<"mRole Admin if: "<actionVerifier_Turn_In->setVisible(false); ui->actionVerifier_Turn_In->setEnabled(false); + ui->viewComments->setVisible(false); + ui->viewComments->setEnabled(false); + isVerifier = 0; this->setWindowTitle("Udaan Editing Tool-Corrector"); } @@ -1149,43 +1154,35 @@ void MainWindow::on_actionEnglish_triggered() * \fn MainWindow::on_actionOpen_Project_triggered * \brief Opens a new OCR project * \note Every project contains six folders - Images, Inds, CorrectorOutput, VerifierOutput, Dicts and Comments. - * + * \details 1. Check if file named "project.xml" exists else terminates the function. + * \details 2. Create a new directory if CorrectorOutput, VerifierOutput or Comments folders does not exist. + * \details 3. Loading the requisites. + * \details a) Processing the project.xml file. + * \details b) Load git repository. + * \details Set the model for ProjectHierarchyWindow(TreeView). TreeView is composed of Documents and Images. + * \details Reset the current file name and directory levels. + * \details Get the value for time elapsed from Timelog.json. * \sa process_xml(), open_git_repo(), get_stage(), get_version(), getModel(), AddTemp(), getFilter(), insert(), UpdateFileBrekadown(), readJsonFile() */ void MainWindow::on_actionOpen_Project_triggered() { //Version Based - - /* Description - * 1. Check if file named "project.xml" exists else terminates the function. - * 2. Create a new directory if CorrectorOutput, VerifierOutput or Comments folders does not exist. - * 3. Loading the requisites. - * a) Processing the project.xml file. - * b) Load git repository. - * 4. Set the model for ProjectHierarchyWindow(TreeView). TreeView is composed of Documents and Images. - * 5. Reset the current file name and directory levels. - * 6. Get the value for time elapsed from Timelog.json. - */ - //QString ProjFile; - if(mProject.isProjectOpen()){ //checking if some project is opened, then closing it before opening new project - on_actionClose_project_triggered(); - } int totalFileCountInDir = 0; QMap fileCountInDir; -//to choose between recent three files + //to choose between recent three files if(isRecentProjclick == true && proj_flag == '0') { - ProjFile = RecentProjFile; + ProjFile = RecentProjFile; } else if(isRecentProjclick == true && proj_flag == '1') { - ProjFile = RecentProjFile2; + ProjFile = RecentProjFile2; } else if(isRecentProjclick == true && proj_flag == '2') { - ProjFile = RecentProjFile3; + ProjFile = RecentProjFile3; } else{ - ProjFile = QFileDialog::getOpenFileName(this, "Open Project", "./", tr("Project(*.xml)")); //Opens only if the file name is Project.xml + ProjFile = QFileDialog::getOpenFileName(this, "Open Project", "./", tr("Project(*.xml)")); //Opens only if the file name is Project.xml } if (ProjFile == "") @@ -1196,9 +1193,11 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based // Testing of project.xml VerifySet verifySetObj(ProjFile, toolDirAbsolutePath + "/projectXMLFormat.xml"); int result = verifySetObj.testProjectXML(); + if(mProject.isProjectOpen()){ //checking if some project is opened, then closing it before opening new project + on_actionClose_project_triggered(); + } if (result != 0) { - mProject.setProjectOpen(false); QMessageBox::warning(0, "Project XML file Error", "Project XML File is corrupted \n\nError "+ QString::fromStdString(std::to_string(verifySetObj.getErrorCode()))+": " + verifySetObj.getErrorString()+"\n\nPlease Report this to your administrator"); return; } @@ -1271,17 +1270,16 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based QDir cdir(str1); Filter * filter = mProject.getFilter("CorrectorOutput"); - //Filter * filter2 = mProject.getFilter("CorrectorOutput"); - //Filter * filter1 = mProject.getFilter("VerifierOutput"); //!Adds each file present in CorrectorOutput directory to treeView auto list = cdir.entryList(QDir::Filter::Files); - + QString t; + QStringList x; for (auto f : list) - { QStringList x = f.split(QRegExp("[.]")); - - QString t = str1 + "/" + f; - QFile f2(t); + { + x = f.split(QRegExp("[.]")); + t = str1 + "/" + f; if(x[1]=="html") { + QFile f2(t); totalFileCountInDir++; mProject.AddTemp(filter,f2,""); } @@ -1289,6 +1287,9 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based } fileCountInDir["Corrector"] = totalFileCountInDir; totalFileCountInDir = 0; + + QMessageBox::information(0, "Success", "Project opened successfully."); + //!Adds each file present in VerifierOutput directory to treeView cdir.setPath(str2); @@ -1296,11 +1297,10 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based list = cdir.entryList(QDir::Filter::Files); for (auto f : list) { - QStringList x = f.split(QRegExp("[.]")); - - QString t = str2 + "/" + f; - QFile f2(t); + x= f.split(QRegExp("[.]")); + t= str2 + "/" + f; if(x[1]=="html") { + QFile f2(t); totalFileCountInDir++; mProject.AddTemp(filter, f2, ""); } @@ -1316,10 +1316,10 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based list = cdir.entryList(QDir::Filter::Files); for (auto f : list) { - QString t = str3 + "/" + f; + t = str3 + "/" + f; QFile f2(t); - mProject.AddTemp(filter, f2, ""); totalFileCountInDir++; + mProject.AddTemp(filter, f2, ""); } fileCountInDir["Inds"] = totalFileCountInDir; totalFileCountInDir = 0; @@ -1332,10 +1332,10 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based list = cdir.entryList(QDir::Filter::Files); for (auto f : list) { - QString t = str4 + "/" + f; + t= str4 + "/" + f; QFile f2(t); - mProject.AddTemp(filter, f2, ""); totalFileCountInDir++; + mProject.AddTemp(filter, f2, ""); } fileCountInDir["Image"] = totalFileCountInDir; totalFileCountInDir = 0; // Resetting variable to 0 @@ -1369,7 +1369,6 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based int endIndex; for (int i = startIndex; projectWindowStylesheet[i] != ';'; i++) endIndex = i; - int replaceSize = endIndex - startIndex + 1; projectWindowStylesheet.replace(startIndex, replaceSize, heightValue); } @@ -1379,16 +1378,6 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based } ui->treeView->setStyleSheet(projectWindowStylesheet); - - -// //!Disable Corrector Turn In once the Corrector has Turned in until the next version is fetched. -// if(!isVerifier) -// { -// if (stage != "Corrector") -// { -// ui->actionTurn_In->setEnabled(false); -// } -// } UpdateFileBrekadown(); //Reset the current file and dir levels //!Get the elapsed time in Timelog.json file under Comments folder @@ -1403,15 +1392,8 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based QString dateTime = val.toObject().value("Date/Time").toString(); newTimeLog[directory] = {seconds, dateTime}; -// timeLog[directory] = seconds; + // timeLog[directory] = seconds; } - - //bool isSet = QDir::setCurrent(mProject.GetDir().absolutePath() + "/CorrectorOutput") ; //Change application Directory to any subfolder of mProject folder for Image Insertion feature. - //if(!QDir(mProject.GetDir().absolutePath() + "/Images/Inserted").exists()) - // QDir().mkdir(mProject.GetDir().absolutePath() + "/Images/Inserted"); - - QMessageBox::information(0, "Success", "Project opened successfully."); -// ui->tabWidget_2->removeTab(0); //!Genearte image.xml for figure/table/equation entries and initialize these values by 1. markRegion objectMarkRegion; @@ -1422,11 +1404,11 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based QSettings settings("IIT-B", "OpenOCRCorrect"); QString new_project = finfo.path()+"/project.xml"; if(new_project != RecentProjFile && new_project != RecentProjFile2 && new_project != RecentProjFile3 ){ - settings.beginGroup("RecentProjects"); - settings.setValue("Project3",RecentProjFile2 ); - settings.setValue("Project2",RecentProjFile ); - settings.setValue("Project",finfo.path()+"/project.xml" ); - settings.endGroup();} + settings.beginGroup("RecentProjects"); + settings.setValue("Project3",RecentProjFile2 ); + settings.setValue("Project2",RecentProjFile ); + settings.setValue("Project",finfo.path()+"/project.xml" ); + settings.endGroup();} //changing priorities of recent opened projects if(new_project == RecentProjFile2){ QSettings settings("IIT-B", "OpenOCRCorrect"); @@ -1444,132 +1426,123 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based settings.endGroup(); } isRecentProjclick = false; - - // Setting Project window size and dict window size = 50% - 50% -// QList list1 = ui->splitter_2->sizes(); -// int totalHeight; -// totalHeight = list1.at(0) + list1.at(1); -// ui->splitter_2->setSizes(QList() << totalHeight/2 << totalHeight/2); } else { QMessageBox::warning(0, "Project Error", "Couldn't open project. Please check your project."); return; } - AddRecentProjects();//to load recent project without restarting app - //--for last opened page--// - QSettings settings("IIT-B", "OpenOCRCorrect"); - settings.beginGroup("RecentPageLoaded"); - QString stored_project = settings.value("projectName1").toString(); - QString stored_project2 = settings.value("projectName2").toString(); - QString stored_project3 = settings.value("projectName3").toString(); - settings.endGroup(); - if(ProjFile == stored_project || ProjFile == stored_project2 || ProjFile == stored_project3){ - RecentPageInfo(); - } + AddRecentProjects();//to load recent project without restarting app + //--for last opened page--// + QSettings settings("IIT-B", "OpenOCRCorrect"); + settings.beginGroup("RecentPageLoaded"); + QString stored_project = settings.value("projectName1").toString(); + QString stored_project2 = settings.value("projectName2").toString(); + QString stored_project3 = settings.value("projectName3").toString(); + settings.endGroup(); + if(ProjFile == stored_project || ProjFile == stored_project2 || ProjFile == stored_project3){ + RecentPageInfo(); + } - // Enabling the buttons again after a project is opened - - // File Menu - ui->actionSave->setEnabled(true); - ui->actionSave_As->setEnabled(true); - ui->actionSpell_Check->setEnabled(true); - ui->actionLoad_Prev_Page->setEnabled(true); - ui->actionLoad_Next_Page->setEnabled(true); - ui->actionToDevanagari->setEnabled(true); - ui->actionToSlp1->setEnabled(true); - ui->actionLoadGDocPage->setEnabled(true); - ui->actionLoadData->setEnabled(true); - ui->actionLoadDict->setEnabled(true); - ui->actionLoadOCRWords->setEnabled(true); - ui->actionLoadDomain->setEnabled(true); - ui->actionLoadSubPS->setEnabled(true); - ui->actionLoadConfusions->setEnabled(true); - ui->actionSugg->setEnabled(true); - - // Edit Menu - ui->actionUndo->setEnabled(true); - ui->actionRedo->setEnabled(true); - ui->actionFind_and_Replace->setEnabled(true); - ui->actionUndo_Global_Replace->setEnabled(true); - ui->actionUpload->setEnabled(true); - - // Language Menu - ui->actionSanskrit_2->setEnabled(true); - ui->actionEnglish->setEnabled(true); - ui->actionHindi->setEnabled(true); - - // Reports Menu - ui->actionAccuracyLog->setEnabled(true); - ui->actionViewAverageAccuracies->setEnabled(true); - - // View Menu - ui->actionAllFontProperties->setEnabled(true); - ui->actionBold->setEnabled(true); - ui->actionItalic->setEnabled(true); - ui->actionLeftAlign->setEnabled(true); - ui->actionRightAlign->setEnabled(true); - ui->actionCentreAlign->setEnabled(true); - ui->actionJusitfiedAlign->setEnabled(true); - ui->actionSuperscript->setEnabled(true); - ui->actionSubscript->setEnabled(true); - ui->actionInsert_Horizontal_Line->setEnabled(true); - ui->actionFontBlack->setEnabled(true); - ui->actionInsert_Tab_Space->setEnabled(true); - ui->actionPDF_Preview->setEnabled(true); - if (isVerifier) - ui->actionHighlight->setEnabled(true); - - // Table Menu inside View Menu - ui->actionInsert_Table_2->setEnabled(true); - ui->actionInsert_Columnleft->setEnabled(true); - ui->actionInsert_Columnright->setEnabled(true); - ui->actionInsert_Rowabove->setEnabled(true); - ui->actionInsert_Rowbelow->setEnabled(true); - ui->actionRemove_Column->setEnabled(true); - ui->actionRemove_Row->setEnabled(true); - - // Versions Menu - ui->actionFetch_2->setEnabled(true); - ui->actionTurn_In->setEnabled(true); - ui->actionVerifier_Turn_In->setEnabled(true); - - // Download Menu - ui->actionas_PDF->setEnabled(true); - - ui->actionSymbols->setEnabled(true); - ui->actionZoom_In->setEnabled(true); - ui->actionZoom_Out->setEnabled(true); - //Reset loadData flag - LoadDataFlag = 1; - //reset data - mFilename.clear(); - //mFilename1.clear(); - LSTM.clear(); - CPairs.clear(); - Dict.clear(); - GBook.clear(); - IBook.clear(); - PWords.clear(); - ConfPmap.clear(); - vGBook.clear(); - vIBook.clear(); - TDict.clear(); - TGBook.clear(); - TGBookP.clear(); - TPWords.clear(); - TPWordsP.clear(); - synonym.clear(); - synrows.clear(); - - ui->pushButton->setDisabled(false); - ui->pushButton_2->setDisabled(false); - ui->viewComments->setDisabled(false); - ui->compareCorrectorOutput->setDisabled(false); - ui->groupBox->setDisabled(false); + // Enabling the buttons again after a project is opened + // File Menu + ui->actionSave->setEnabled(true); + ui->actionSave_As->setEnabled(true); + ui->actionSpell_Check->setEnabled(true); + ui->actionLoad_Prev_Page->setEnabled(true); + ui->actionLoad_Next_Page->setEnabled(true); + ui->actionToDevanagari->setEnabled(true); + ui->actionToSlp1->setEnabled(true); + ui->actionLoadGDocPage->setEnabled(true); + ui->actionLoadData->setEnabled(true); + ui->actionLoadDict->setEnabled(true); + ui->actionLoadOCRWords->setEnabled(true); + ui->actionLoadDomain->setEnabled(true); + ui->actionLoadSubPS->setEnabled(true); + ui->actionLoadConfusions->setEnabled(true); + ui->actionSugg->setEnabled(true); -} + // Edit Menu + ui->actionUndo->setEnabled(true); + ui->actionRedo->setEnabled(true); + ui->actionFind_and_Replace->setEnabled(true); + ui->actionUndo_Global_Replace->setEnabled(true); + ui->actionUpload->setEnabled(true); + + // Language Menu + ui->actionSanskrit_2->setEnabled(true); + ui->actionEnglish->setEnabled(true); + ui->actionHindi->setEnabled(true); + + // Reports Menu + ui->actionAccuracyLog->setEnabled(true); + ui->actionViewAverageAccuracies->setEnabled(true); + + // View Menu + ui->actionAllFontProperties->setEnabled(true); + ui->actionBold->setEnabled(true); + ui->actionItalic->setEnabled(true); + ui->actionLeftAlign->setEnabled(true); + ui->actionRightAlign->setEnabled(true); + ui->actionCentreAlign->setEnabled(true); + ui->actionJusitfiedAlign->setEnabled(true); + ui->actionSuperscript->setEnabled(true); + ui->actionSubscript->setEnabled(true); + ui->actionInsert_Horizontal_Line->setEnabled(true); + ui->actionFontBlack->setEnabled(true); + ui->actionInsert_Tab_Space->setEnabled(true); + ui->actionPDF_Preview->setEnabled(true); + if (isVerifier) + ui->actionHighlight->setEnabled(true); + + // Table Menu inside View Menu + ui->actionInsert_Table_2->setEnabled(true); + ui->actionInsert_Columnleft->setEnabled(true); + ui->actionInsert_Columnright->setEnabled(true); + ui->actionInsert_Rowabove->setEnabled(true); + ui->actionInsert_Rowbelow->setEnabled(true); + ui->actionRemove_Column->setEnabled(true); + ui->actionRemove_Row->setEnabled(true); + + // Versions Menu + ui->actionFetch_2->setEnabled(true); + ui->actionTurn_In->setEnabled(true); + ui->actionVerifier_Turn_In->setEnabled(true); + + // Download Menu + ui->actionas_PDF->setEnabled(true); + ui->actionSymbols->setEnabled(true); + ui->actionZoom_In->setEnabled(true); + ui->actionZoom_Out->setEnabled(true); + //Reset loadData flag + LoadDataFlag = 1; + //reset data + mFilename.clear(); + //mFilename1.clear(); + LSTM.clear(); + CPairs.clear(); + Dict.clear(); + GBook.clear(); + IBook.clear(); + PWords.clear(); + ConfPmap.clear(); + vGBook.clear(); + vIBook.clear(); + TDict.clear(); + TGBook.clear(); + TGBookP.clear(); + TPWords.clear(); + TPWordsP.clear(); + synonym.clear(); + synrows.clear(); + + ui->pushButton->setDisabled(false); + ui->pushButton_2->setDisabled(false); + ui->viewComments->setDisabled(false); + ui->compareCorrectorOutput->setDisabled(false); + ui->groupBox->setDisabled(false); +} /*! * \fn MainWindow::AddRecentProjects * \brief This function will allow user to open the last opened project. @@ -1978,7 +1951,8 @@ void MainWindow::on_actionSave_triggered() s2, CPair_editDis, &CPairs, - filestructure_fw); + filestructure_fw, + &dict_set1); QThread *thread = new QThread; connect(thread, SIGNAL(started()), worker, SLOT(doSaveBackend())); @@ -2867,7 +2841,7 @@ void MainWindow::on_actionAllFontProperties_triggered() QString fileText = file.readAll(); file.close(); - QRegularExpression regex_style("(]*>)"); + QRegularExpression regex_style("(]*>)"); QRegularExpressionMatchIterator itr = regex_style.globalMatch(fileText); while (itr.hasNext()) { @@ -2875,6 +2849,37 @@ void MainWindow::on_actionAllFontProperties_triggered() QString capString = match.captured(1); int capStart = match.capturedStart(1); + for (int i = 0; i < totalFontProperties; i++) { + QString property = styleProperties[i]; + QString value = stylePropertyValues[i]; + int propIndex = -1; + + if ((propIndex = capString.indexOf(property)) != -1) { // If value of the property is different + int endIndexOfProperty = capString.indexOf(";", propIndex); + int replacementLen = endIndexOfProperty - (propIndex + property.length()); + fileText.replace(capStart + propIndex + property.length(), replacementLen, value); + capString.replace(propIndex + property.length(), replacementLen, value); + } else if (capString.indexOf("style=\"") != -1) { // If property is not present + int indexOfStyle = capString.indexOf("style=\""); + fileText.insert(capStart + indexOfStyle + QString("style=\"").length(), " " + property + value + ";"); + capString.insert(indexOfStyle + QString("style=\"").length(), " " + property + value + ";"); + } else { // If style tag is not present + fileText.insert(capStart + QString("

]*>)"); + QRegularExpressionMatchIterator itr_span = regex_style_span.globalMatch(fileText); + + while (itr_span.hasNext()) { + QRegularExpressionMatch match = itr_span.next(); + QString capString = match.captured(1); + int capStart = match.capturedStart(1); + for (int i = 0; i < totalFontProperties; i++) { QString property = styleProperties[i]; QString value = stylePropertyValues[i]; @@ -2895,8 +2900,71 @@ void MainWindow::on_actionAllFontProperties_triggered() } } - itr = regex_style.globalMatch(fileText, capStart + capString.length()); + itr_span = regex_style_span.globalMatch(fileText, capStart + capString.length()); } + //for unordered list + + QRegularExpression regex_style_ul("(]*>)"); + QRegularExpressionMatchIterator itr_ul = regex_style_ul.globalMatch(fileText); + + while (itr_ul.hasNext()) { + QRegularExpressionMatch match = itr_ul.next(); + QString capString = match.captured(1); + int capStart = match.capturedStart(1); + + for (int i = 0; i < totalFontProperties; i++) { + QString property = styleProperties[i]; + QString value = stylePropertyValues[i]; + int propIndex = -1; + + if ((propIndex = capString.indexOf(property)) != -1) { // If value of the property is different + int endIndexOfProperty = capString.indexOf(";", propIndex); + int replacementLen = endIndexOfProperty - (propIndex + property.length()); + fileText.replace(capStart + propIndex + property.length(), replacementLen, value); + capString.replace(propIndex + property.length(), replacementLen, value); + } else if (capString.indexOf("style=\"") != -1) { // If property is not present + int indexOfStyle = capString.indexOf("style=\""); + fileText.insert(capStart + indexOfStyle + QString("style=\"").length(), " " + property + value + ";"); + capString.insert(indexOfStyle + QString("style=\"").length(), " " + property + value + ";"); + } else { // If style tag is not present + fileText.insert(capStart + QString("

  • ]*>)"); +// QRegularExpressionMatchIterator itr_ol = regex_style_ol.globalMatch(fileText); + +// while (itr_ol.hasNext()) { +// QRegularExpressionMatch match = itr_ol.next(); +// QString capString = match.captured(1); +// int capStart = match.capturedStart(1); + +// for (int i = 0; i < totalFontProperties; i++) { +// QString property = styleProperties[i]; +// QString value = stylePropertyValues[i]; +// int propIndex = -1; + +// if ((propIndex = capString.indexOf(property)) != -1) { // If value of the property is different +// int endIndexOfProperty = capString.indexOf(";", propIndex); +// int replacementLen = endIndexOfProperty - (propIndex + property.length()); +// fileText.replace(capStart + propIndex + property.length(), replacementLen, value); +// capString.replace(propIndex + property.length(), replacementLen, value); +// } else if (capString.indexOf("style=\"") != -1) { // If property is not present +// int indexOfStyle = capString.indexOf("style=\""); +// fileText.insert(capStart + indexOfStyle + QString("style=\"").length(), " " + property + value + ";"); +// capString.insert(indexOfStyle + QString("style=\"").length(), " " + property + value + ";"); +// } else { // If style tag is not present +// fileText.insert(capStart + QString("
      void{ - if(--cnt < 0){ - cntDown.stop(); - msg.close(); - } - }); + if(--cnt < 0){ + cntDown.stop(); + msg.close(); + } + }); cntDown.start(1000); msg.exec(); return; } + //retrieve details from database and check if user has access to push into this repo + settings.beginGroup("login"); + QString email = settings.value("email").toString(); + QString token = settings.value("token").toString(); + settings.endGroup(); + QProcess process; + process.execute("curl -d -X -k -POST --header " + "\"Content-type:application/x-www-form-urlencoded\" https://udaaniitb.aicte-india.org/udaan/email/ -d \"email="+email+"&password="+token+"\" -o validate.json"); + + //to find the repo name from .git/congig file + QString repo = ""; + QString gDir = gDirTwoLevelUp+"/.git/config"; + QFile f(gDir); + f.open(QIODevice::ReadOnly); + while(!f.atEnd()) { + QString line = f.readLine(); + if(line.contains("https://github.com")){ + QStringList l = line.split("/"); + repo = l[l.size()-1].remove("\n"); + break; + } + } + f.close(); + QJsonObject mainObj = readJsonFile("validate.json"); + QJsonArray repos = mainObj.value("repo_list").toArray(); + QJsonArray::iterator itr; int flag = 0; + for(itr = repos.begin(); itr != repos.end(); itr++){ + // qDebug()<toString(); + if(itr->toString() == repo){ + flag = 1; + break; + } + } + QFile::remove("validate.json"); + if(repos.size() == 0 || flag == 0){ + QMessageBox msg; + msg.setText("You don't have access to this project on cloud."); + msg.exec(); + return; + } + + //sending credentials + process.execute("curl -d -X -k -POST --header " + "\"Content-type:application/x-www-form-urlencoded\" https://udaaniitb.aicte-india.org/udaan/email/ -o gitToken.json"); + + QFile jsonFile("gitToken.json"); + jsonFile.open(QIODevice::ReadOnly | QIODevice::Text); + QByteArray data = jsonFile.readAll(); + + QJsonParseError errorPtr; + QJsonDocument document = QJsonDocument::fromJson(data, &errorPtr); + mainObj = document.object(); + jsonFile.close(); + QString git_token = mainObj.value("github_token").toString(); + QString git_username = mainObj.value("github_username").toString(); + QFile::remove("gitToken.json"); + std::string user = git_username.toStdString(); + std::string pass = git_token.toStdString(); /* * \description * 1. Checks if any project is opened or not. @@ -3862,13 +4012,6 @@ void MainWindow::on_actionVerifier_Turn_In_triggered() */ if (messageBox.clickedButton() == resubmitButton) { - //mProject.enable_push( false ); //Increment = false -// if(mProject.findNumberOfFilesInDirectory(mProject.GetDir().absolutePath().toStdString() + R"(/VerifierOutput/)") -// != 2* mProject.findNumberOfFilesInDirectory(mProject.GetDir().absolutePath().toStdString() + R"(/Inds/)")) -// { -// QMessageBox::information(0, "Couldn't Turn In", "Make sure all files are there in VerifierOutput directory"); -// return; -// } s = SubmissionType::resubmit; commit_msg = "Verifier Resubmitted Version:" + mProject.get_version(); } @@ -3888,13 +4031,6 @@ void MainWindow::on_actionVerifier_Turn_In_triggered() */ else if (messageBox.clickedButton() == finaliseButton) { - //mProject.enable_push( false ); //Increment = false -// if(mProject.findNumberOfFilesInDirectory(mProject.GetDir().absolutePath().toStdString() + R"(/VerifierOutput/)") -// != 2* mProject.findNumberOfFilesInDirectory(mProject.GetDir().absolutePath().toStdString() + R"(/Inds/)")) -// { -// QMessageBox::information(0, "Couldn't Turn In", "Make sure all files are there in VerifierOutput directory"); -// return; -// } s = SubmissionType::finalise; commit_msg = "Verifier Finalised Version:" + mProject.get_version(); } @@ -3912,34 +4048,28 @@ void MainWindow::on_actionVerifier_Turn_In_triggered() QPushButton *nButton2 = submitBox2.addButton(QMessageBox::StandardButton::No); submitBox2.exec(); - - - if (submitBox2.clickedButton() == yButton2) - { + if (submitBox2.clickedButton() == yButton2) + { bool ok; -// branchName = QInputDialog::getText(this, tr("Branch Name"), -// tr("Enter the branch name:"), QLineEdit::Normal, -// "", &ok ); - branchName ="master"; - if (!branchName.isEmpty() ) { - // user entered something and pressed OK - if(s == SubmissionType::return_set) //If yes button is clicked and submission type is return_set then enable push - { - mProject.enable_push( true ); - } - else if (s == SubmissionType::resubmit) //If yes button is clicked and submission type is resubmit then enable push - { - mProject.enable_push( false ); + // user entered something and pressed OK + if(s == SubmissionType::return_set) //If yes button is clicked and submission type is return_set then enable push + { + mProject.enable_push( true ); + } + else if (s == SubmissionType::resubmit) //If yes button is clicked and submission type is resubmit then enable push + { + mProject.enable_push( false ); + } + if(mProject.commit(commit_msg.toStdString())) + { + if(!mProject.push(gDirTwoLevelUp)){ + mProject.enable_push(false); + QMessageBox::information(0, "Cloud sync", "Cloud save failed!"); + return; } - if(!mProject.commit(commit_msg.toStdString()) || !mProject.push(branchName)) + if(s == SubmissionType::return_set) { - if(s == SubmissionType::return_set) - { - mProject.set_version( mProject.get_version().toInt() - 1 ); - } - // mProject.set_stage_verifier(); - QMessageBox::critical(0, "Cloud sync", "Sync failed!"); - return; + mProject.set_version( mProject.get_version().toInt() - 1 ); } } else { @@ -3964,7 +4094,6 @@ void MainWindow::on_actionVerifier_Turn_In_triggered() //! Updating the Project Version ui->lineEdit_2->setText("Version " + mProject.get_version()); QMessageBox::information(0, "Cloud sync", "Cloud save successful!"); - //deleteEditedFilesLog(); } else { @@ -4466,11 +4595,11 @@ void MainWindow::saveImageRegion(QPixmap cropped, QString a, QString s1,int z, i if(!QDir(gDirTwoLevelUp+"/Cropped_Images").exists()){ QDir(gDirTwoLevelUp).mkdir("Cropped_Images"); } - if(!QDir(gDirTwoLevelUp+"/Cropped_Images/Figures").exists()) + if(!QDir(gDirTwoLevelUp+"/Cropped_Images/tables").exists()) { - QDir(gDirTwoLevelUp).mkdir("Cropped_Images/Figures"); - QDir(gDirTwoLevelUp).mkdir("Cropped_Images/Tables"); - QDir(gDirTwoLevelUp).mkdir("Cropped_Images/Equations"); + QDir(gDirTwoLevelUp).mkdir("Cropped_Images/figures"); + QDir(gDirTwoLevelUp).mkdir("Cropped_Images/tables"); + QDir(gDirTwoLevelUp).mkdir("Cropped_Images/equations"); } //! Adding picture to the respective directory @@ -4478,7 +4607,7 @@ void MainWindow::saveImageRegion(QPixmap cropped, QString a, QString s1,int z, i { if(s1 == "IMGHOLDER") { - QString path = "/Cropped_Images/Figures/Figure"+a+"-"+QString::number(z)+".jpg"; + QString path = "/Cropped_Images/figures/Figure"+a+"-"+QString::number(z)+".jpg"; cropped.save(gDirTwoLevelUp+path,"JPG",100); //100 is storing the image in uncompressed high resolution @@ -4489,7 +4618,7 @@ void MainWindow::saveImageRegion(QPixmap cropped, QString a, QString s1,int z, i } else if(s1 == "TBHOLDER") { - QString path = "/Cropped_Images/Tables/Table"+a+"-"+QString::number(z)+".jpg"; + QString path = "/Cropped_Images/tables/Table"+a+"-"+QString::number(z)+".jpg"; cropped.save(gDirTwoLevelUp+path,"JPG", 100); @@ -4502,7 +4631,7 @@ void MainWindow::saveImageRegion(QPixmap cropped, QString a, QString s1,int z, i } else if(s1 == "EQHOLDER") { - QString path = "/Cropped_Images/Equations/Equation"+a+"-"+QString::number(z)+".jpg"; + QString path = "/Cropped_Images/equations/Equation"+a+"-"+QString::number(z)+".jpg"; cropped.save(gDirTwoLevelUp+path,"JPG",100); @@ -4915,10 +5044,10 @@ int MainWindow::writeGlobalCPairsToFiles(QString file_path, QMap setReadOnly(false); - QFont font("Chandas"); + QFont font("Shobhika-Regular"); font.setWeight(16); font.setPointSize(16); -// font.setFamily("Shobhika"); + font.setFamily("Shobhika"); browser->setFont(font); browser->setHtml(s1); @@ -5668,7 +5797,7 @@ void MainWindow::DisplayJsonDict(CustomTextBrowser *b, QString input) QByteArray data_json; QStringList list1; QSet dict_set; - QSet dict_set1; + dict_set1.clear(); //! Get dict file from current opened file QString dictFilename; if(mRole=="Verifier") @@ -6193,7 +6322,7 @@ void MainWindow::LoadDocument(QFile * f, QString ext, QString name) QTextStream stream(f); stream.setCodec("UTF-8"); QString input = stream.readAll(); - QFont font("Chandas"); + QFont font("Shobhika"); setWindowTitle(name); font.setPointSize(16); if(ext == "txt") { @@ -6210,10 +6339,10 @@ void MainWindow::LoadDocument(QFile * f, QString ext, QString name) QString qstrHtml = QString::fromStdString(strHtml); qstrHtml.replace("

      ", "

      "); - QFont font("Chandas"); + QFont font("Shobhika-Regular"); font.setWeight(16); font.setPointSize(16); -// font.setFamily("Shobhika"); + font.setFamily("Shobhika"); b->setFont(font); b->setHtml(qstrHtml); } @@ -6309,6 +6438,7 @@ void MainWindow::LoadDocument(QFile * f, QString ext, QString name) curr_browser = (CustomTextBrowser*)ui->splitter->widget(1); curr_browser->setDocument(b->document()->clone(curr_browser)); + curr_browser->document()->clearUndoRedoStacks(); QFileInfo info(*f); currentTabPageName = info.fileName(); @@ -6397,6 +6527,14 @@ void MainWindow::LoadDocument(QFile * f, QString ext, QString name) } } } + + QString x=finfo.fileName(); + if(x.contains("txt")){ + curr_browser->setReadOnly(true); + } + else{ + curr_browser->setReadOnly(false); + } // Deleting temporarily created CustomTextBrowser delete b; @@ -7016,12 +7154,12 @@ void MainWindow::on_actionas_PDF_triggered() int count = dir.entryList(QStringList("*.html"), QDir::Files | QDir::NoDotAndDotDot).count(); int counter=0; - int stIndex, startFrom = 0; +// int stIndex, startFrom = 0; - //! Set the background of the pdf to be printed to be white - QString searchString = "background-color:#"; // string to be searched - int l = searchString.length(); - QString whiteColor = "ffffff"; +// //! Set the background of the pdf to be printed to be white +// QString searchString = "background-color:#"; // string to be searched +// int l = searchString.length(); +// QString whiteColor = "ffffff"; int itr = 0; PdfRangeDialog *pdfRangeDialog = new PdfRangeDialog(this, count, 100); @@ -7043,7 +7181,7 @@ void MainWindow::on_actionas_PDF_triggered() { QString x = currentDirAbsolutePath + a; - startFrom = 0; // The position from which searchString will be scanned +// startFrom = 0; // The position from which searchString will be scanned //! if condition makes sure we extract only html files for PDF Processing //! (folder has hocr, dict, htranslate, and other such files) if(x.contains(".")) @@ -7066,15 +7204,17 @@ void MainWindow::on_actionas_PDF_triggered() //! Read the file mainHtml=stream.readAll(); - //! Changing the text background to white by setting the background to #fffff - while (true){ - stIndex = mainHtml.indexOf(searchString, startFrom); - if (stIndex == -1) - break; - stIndex += l; // increment line - mainHtml.replace(stIndex, 6, whiteColor); // Here, 6 is used because length of whiteColor is 6 - startFrom = stIndex + 6; - } + mainHtml.remove("background-color:#00ff00"); + mainHtml.remove("background-color:#ffff00"); +// //! Changing the text background to white by setting the background to #fffff +// while (true){ +// stIndex = mainHtml.indexOf(searchString, startFrom); +// if (stIndex == -1) +// break; +// stIndex += l; // increment line +// mainHtml.replace(stIndex, 6, whiteColor); // Here, 6 is used because length of whiteColor is 6 +// startFrom = stIndex + 6; +// } //! append counter when one file is fully scanned counter++; @@ -7888,13 +8028,13 @@ void MainWindow::RecentPageInfo() void MainWindow::on_actionCheck_for_Updates_triggered() { QUrl url("https://api.github.com/repos/IITB-OpenOCRCorrect/iitb-openocr-digit-tool/releases"); - qInfo() << url.toString(); +// qInfo() << url.toString(); QNetworkRequest request(url); //requesting url over the network request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); QNetworkAccessManager nam; //sending network request QNetworkReply * reply = nam.get(request); - QTimer *timer = new QTimer(); - timer->start(5000); +// QTimer *timer = new QTimer(); +// timer->start(5000); while(true){ qApp->processEvents(); @@ -7908,7 +8048,8 @@ void MainWindow::on_actionCheck_for_Updates_triggered() if(json[0]["name"].toString() == "") { qDebug() << QString("Timeout .... Internet Not Available"); - // return ""; + QMessageBox::information(0,"Error","Uh-Oh! we are unable to connect to the server at the moment. Check your internet connection."); + return; } QString latestVersion=json[0]["name"].toString(); QString newFeatures = json[0]["body"].toString(); @@ -8006,14 +8147,14 @@ void MainWindow::print(QPrinter *printer) QString html_contents=""; QString mainHtml ; - int startFrom,stIndex = 0; +// int startFrom,stIndex = 0; - //! Set the background of the pdf to be printed to be white - QString searchString = "background-color:#"; - int l = searchString.length(); - QString whiteColor = "ffffff"; +// //! Set the background of the pdf to be printed to be white +// QString searchString = "background-color:#"; +// int l = searchString.length(); +// QString whiteColor = "ffffff"; - startFrom = 0; +// startFrom = 0; QFile file(htmlFile); if (!file.open(QIODevice::ReadOnly)) qDebug() << "Error reading file main.html"; @@ -8024,14 +8165,16 @@ void MainWindow::print(QPrinter *printer) mainHtml=stream.readAll(); //! Changing the text background to white by setting the background to #fffff - while (true){ - stIndex = mainHtml.indexOf(searchString, startFrom); - if (stIndex == -1) - break; - stIndex += l; // increment line - mainHtml.replace(stIndex, 6, whiteColor); // Here, 6 is used because length of whiteColor is 6 - startFrom = stIndex + 6; - } +// while (true){ +// stIndex = mainHtml.indexOf(searchString, startFrom); +// if (stIndex == -1) +// break; +// stIndex += l; // increment line +// mainHtml.replace(stIndex, 6, whiteColor); // Here, 6 is used because length of whiteColor is 6 +// startFrom = stIndex + 6; +// } + mainHtml.remove("background-color:#00ff00"); + mainHtml.remove("background-color:#ffff00"); //latex to png mapping if(mainHtml.contains("$$")){ @@ -8985,8 +9128,16 @@ void MainWindow::login(){ process.execute("curl -d -X -k -POST --header " "\"Content-type:application/x-www-form-urlencoded\" https://udaaniitb.aicte-india.org/udaan/email/ -d \"email="+user_email+"&password="+user_pass+"\" -o client.json"); - - QJsonObject mainObj = readJsonFile("client.json"); + QFile jsonFile("client.json"); + if(!jsonFile.open(QIODevice::ReadOnly | QIODevice::Text)){ + QMessageBox::information(0,"Error","Uh-Oh! we are unable to connect to the server at the moment. Try switching your network or contact your administrator."); + return; + } + QByteArray data = jsonFile.readAll(); + QJsonParseError errorPtr; + QJsonDocument document = QJsonDocument::fromJson(data, &errorPtr); + QJsonObject mainObj = document.object(); + jsonFile.close(); auto status = mainObj.value("status").toBool(); QFile::remove("client.json"); diff --git a/FrameWorkCode/mainwindow.h b/FrameWorkCode/mainwindow.h index 8b337977..b37f0b98 100755 --- a/FrameWorkCode/mainwindow.h +++ b/FrameWorkCode/mainwindow.h @@ -482,6 +482,7 @@ public slots: GlobalReplaceDialog *currentGlobalReplaceDialog = nullptr; QOAuth2AuthorizationCodeFlow * google; void googleAuth(); + QSet dict_set1; //! Keep it available globally so that we need not to parse dictionary file at the time of saving logs. }; #endif // MAINWINDOW_H diff --git a/FrameWorkCode/mainwindow.ui b/FrameWorkCode/mainwindow.ui index 5b66340b..5694dee6 100755 --- a/FrameWorkCode/mainwindow.ui +++ b/FrameWorkCode/mainwindow.ui @@ -607,6 +607,8 @@ QScrollBar::sub-line:vertical { <html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css"> p, li { white-space: pre-wrap; } hr { height: 1px; border-width: 0; } +li.unchecked::marker { content: "\2610"; } +li.checked::marker { content: "\2612"; } </style></head><body style=" font-family:'Ubuntu'; font-size:20pt; font-weight:400; font-style:normal;" bgcolor="#ffffff"> <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:11pt;">Please Select the Language from top left menu before loading any document.</span></p></body></html> @@ -1192,8 +1194,8 @@ QMenu::item:selected{ - + diff --git a/FrameWorkCode/pdfrangedialog.ui b/FrameWorkCode/pdfrangedialog.ui index 2e11616c..995dec9f 100644 --- a/FrameWorkCode/pdfrangedialog.ui +++ b/FrameWorkCode/pdfrangedialog.ui @@ -83,7 +83,7 @@ - <html><head/><body><p><span style=" font-weight:700;">Cancel</span> if you want to download whole set</p></body></html> + <html><head/><body><p>Click<span style=" font-weight:700;"> 'Print Set'</span> if you want to download whole set or <span style=" font-weight:700;">'Print Range'</span>, to print selected pages.</p></body></html> @@ -105,14 +105,14 @@ - Cancel + Print Set - Ok + Print Range diff --git a/FrameWorkCode/qpadfinal.pri b/FrameWorkCode/qpadfinal.pri index 57d577a4..0a4445f8 100755 --- a/FrameWorkCode/qpadfinal.pri +++ b/FrameWorkCode/qpadfinal.pri @@ -17,6 +17,7 @@ HEADERS += ./Filters.h \ $$PWD/pdfrangedialog.h \ $$PWD/printworker.h \ $$PWD/progressbardialog.h \ + $$PWD/rubberband.h \ $$PWD/shortcutguidedialog.h \ $$PWD/textfinder.h \ $$PWD/globalreplacedialog.h \ @@ -68,6 +69,7 @@ SOURCES += ./DiffView.cpp \ $$PWD/pdfrangedialog.cpp \ $$PWD/printworker.cpp \ $$PWD/progressbardialog.cpp \ + $$PWD/rubberband.cpp \ $$PWD/shortcutguidedialog.cpp \ $$PWD/slpNPatternDict.cpp \ $$PWD/textfinder.cpp \ diff --git a/FrameWorkCode/rubberband.cpp b/FrameWorkCode/rubberband.cpp new file mode 100644 index 00000000..55527fed --- /dev/null +++ b/FrameWorkCode/rubberband.cpp @@ -0,0 +1,332 @@ +#include "rubberband.h" + +#include +#include +#include +#include +#include +#include + +/*! + * \fn RubberBand::RubberBand + * \brief Initializes the gripColor, gripSize, dragPos, dragGrip and moveEnabled + * \param parent Passed to QWidget to set the parent + */ +RubberBand::RubberBand(QWidget *parent) + : QWidget{parent} +{ + m_moveEnabled = false; + m_gripSize = QSize(8, 8); + m_gripColor = QColor(Qt::blue); + m_dragPos = QPointF(); + m_dragGrip = NoGrip; +} + +/*! + * \fn RubberBand::isMoveEnabled + * \brief Returns value accordingly if move is enabled/disabled + * \return true if move is enabled otherwise false + */ +bool RubberBand::isMoveEnabled() const +{ + return m_moveEnabled; +} + +/*! + * \fn RubberBand::setMoveEnabled + * \brief Sets the moveEnabled to the value passed + * \param enabled Used for setting if move is enabled + */ +void RubberBand::setMoveEnabled(bool enabled) +{ + m_moveEnabled = enabled; +} + +/*! + * \fn RubberBand::gripSize + * \brief Returns the grip size + * \return Grip size (QSize) + */ +QSize RubberBand::gripSize() const +{ + return m_gripSize; +} + +/*! + * \fn RubberBand::setGripSize + * \brief Sets the grip size if size passed is valid + * \param size Grip size is set to the value of this parameter + */ +void RubberBand::setGripSize(const QSize &size) +{ + if (m_gripSize != size && size.isValid()) { + m_gripSize = size; + update(); + } +} + +/*! + * \fn RubberBand::gripColor + * \brief Returns the Grip Color + * \return Grip color (QColor) + */ +QColor RubberBand::gripColor() const +{ + return m_gripColor; +} + +/*! + * \fn RubberBand::setGripColor + * \brief Sets the grip color to the color passed + * \param color Grip color is set to the value of this parameter + */ +void RubberBand::setGripColor(const QColor &color) +{ + if (m_gripColor != color) { + m_gripColor = color; + update(); + } +} + +/*! + * \fn RubberBand::paintEvent + * \brief This functions paints the entire rubber band and the grips + * \details + * 1. Calculates the grip positions. + * 2. Draws big rectangle in which image is enclosed + * 3. Draws all grips + * \param event Unused parameter + */ +void RubberBand::paintEvent(QPaintEvent *event) +{ + Q_UNUSED(event); + + QMap positions = gripPositions(); + QPainter painter(this); + + if (!m_dragPos.isNull()) { + painter.setPen(QPen(m_gripColor, 1, Qt::SolidLine)); + painter.drawRect(0, 0, size().width() - 1, size().height() - 1); + } + + for (const QRectF &rc : positions.values()) { + painter.fillRect(rc, QBrush(m_gripColor)); + } +} + +/*! + * \fn RubberBand::mousePressEvent + * \brief When mouse button is clicked this function gets fired which is used for getting the grip which is grabbed + * \details + * 1. Calculate grip positions. + * 2. Find the grip rectangle inside which mouse button was pressed. + * 3. If move is enabled store the original position in a data member + * \param event Used for getting the position where mouse button was pressed. + * \sa gripPositions() + */ +void RubberBand::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::LeftButton && isVisible()) { + QMap positions = gripPositions(); + QPoint pos = event->pos(); + + for (const Grip &key : positions.keys()) { + const QRectF &rc = positions.value(key); + + if (rc.contains(pos)) { + m_dragPos = event->windowPos(); + m_dragGrip = key; + switch (m_dragGrip) { + case NoGrip: + break; + case Left: + case Right: + setCursor(Qt::SizeHorCursor); + break; + case TopMiddle: + case BottomMiddle: + setCursor(Qt::SizeVerCursor); + break; + case TopLeft: + case BottomRight: + setCursor(Qt::SizeFDiagCursor); + break; + case TopRight: + case BottomLeft: + setCursor(Qt::SizeBDiagCursor); + break; + } + break; + } + } + + if (m_dragGrip == NoGrip && m_moveEnabled) { + m_dragPos = event->windowPos(); + } + } +} + +/*! + * \fn RubberBand::mouseMoveEvent + * \brief This function keeps track of mouse pointer. It handles resizing the geometry of the rubber band. + * \details + * 1. Mark the cursor style according to the grip box chosen. + * 2. Resize the rect of original rubber band and if rect is not less than minimum size or not more than the maximum size of the widget set then emit the resized/moved signals accordingly. + * \param event Used for getting the position of the mouse pointer + */ +void RubberBand::mouseMoveEvent(QMouseEvent *event) +{ + if (m_dragPos.isNull()) { + QPoint pos = event->pos(); + QMap positions = gripPositions(); + + for (const Grip &key : positions.keys()) { + const QRectF &rc = positions.value(key); + + if (rc.contains(pos)) { + switch (key) { + case NoGrip: + break; + case Left: + case Right: + setCursor(Qt::SizeHorCursor); + break; + case TopMiddle: + case BottomMiddle: + setCursor(Qt::SizeVerCursor); + break; + case TopLeft: + case BottomRight: + setCursor(Qt::SizeFDiagCursor); + break; + case TopRight: + case BottomLeft: + setCursor(Qt::SizeBDiagCursor); + break; + } + break; + } else { + setCursor(Qt::ArrowCursor); + } + } + } else { + QPointF pos = event->windowPos(); + QRectF rc = geometry(); + QRectF prevGeo = rc; + + switch(m_dragGrip) { + case NoGrip: + rc.moveLeft(rc.left() + pos.rx() - m_dragPos.rx()); + rc.moveTop(rc.top() + pos.ry() - m_dragPos.ry()); + break; + case BottomRight: + rc.setWidth(rc.width() + pos.rx() - m_dragPos.rx()); + rc.setHeight(rc.height() + pos.ry() - m_dragPos.ry()); + break; + case TopLeft: + rc.setLeft(rc.left() + pos.rx() - m_dragPos.rx()); + rc.setTop(rc.top() + pos.ry() - m_dragPos.ry()); + break; + case TopMiddle: + rc.setTop(rc.top() + pos.ry() - m_dragPos.ry()); + break; + case TopRight: + rc.setWidth(rc.width() + pos.rx() - m_dragPos.rx()); + rc.setTop(rc.top() + pos.ry() - m_dragPos.ry()); + break; + case Left: + rc.setLeft(rc.left() + pos.rx() - m_dragPos.rx()); + break; + case Right: + rc.setWidth(rc.width() + pos.rx() - m_dragPos.rx()); + break; + case BottomLeft: + rc.setLeft(rc.left() + pos.rx() - m_dragPos.rx()); + rc.setHeight(rc.height() + pos.ry() - m_dragPos.ry()); + break; + case BottomMiddle: + rc.setHeight(rc.height() + pos.ry() - m_dragPos.ry()); + break; + } + if (rc != prevGeo) { + m_diffBetweenPrevNowGeometry = true; + } + + for (bool _b = false; _b == false; _b = true) { + QSize minSize = minimumSize(); + if (minSize.isValid() && (rc.width() < minSize.width() || rc.height() < minSize.height())) + break; + + QSize maxSize = maximumSize(); + if (maxSize.isValid() && (rc.width() > maxSize.width() || rc.height() > maxSize.height())) + break; + + m_dragPos = pos; + setGeometry(rc.toRect()); + + if (m_dragGrip == NoGrip) { + emit moved(geometry()); + } else { + emit resized(geometry()); + } + } + } +} + +/*! + * \fn RubberBand::mouseReleaseEvent + * \brief Emits the moveFinished or resizeFinished signals according to the action performed when mouse button is released + * \param event Unused parameter + */ +void RubberBand::mouseReleaseEvent(QMouseEvent *event) +{ + Q_UNUSED(event); + + if (!m_dragPos.isNull()) { + if (m_dragGrip == NoGrip) { + emit moveFinished(geometry()); + } else { + if (m_diffBetweenPrevNowGeometry) + emit resizeFinished(geometry()); + } + } + + m_diffBetweenPrevNowGeometry = false; + m_dragPos = QPointF(); + m_dragGrip = NoGrip; + setCursor(Qt::ArrowCursor); + + update(); +} + +/*! + * \fn RubberBand::gripPositions + * \brief Returns the mapping of the widget grips' to their position on the rubber band + * \return Mapping of the grip to its position in the widget + */ +QMap RubberBand::gripPositions() const +{ + QMap positions; + QRectF rc = rect(); + double gw = m_gripSize.width(); + double gh = m_gripSize.height(); + double rw = rc.width(); + double rh = rc.height(); + + positions.insert(TopLeft, QRectF(0, 0, gw, gh)); + positions.insert(TopRight, QRectF(rw - gw, 0, gw, gh)); + positions.insert(BottomLeft, QRectF(0, rh - gh, gw, gh)); + positions.insert(BottomRight, QRectF(rw - gw, rh - gh, gw, gh)); + + if (rw >= gw * 3.0) { + positions.insert(TopMiddle, QRectF( (rw / 2.0) - (gw / 2.0), 0, gw, gh )); + positions.insert(BottomMiddle, QRectF( (rw / 2.0) - (gw / 2.0), rh - gh, gw, gh )); + } + + if (rh >= gh * 2.0) { + positions.insert(Left, QRectF( 0, (rh / 2.0) - (gh / 2.0), gw, gh )); + positions.insert(Right, QRectF( rw - gw, (rh / 2.0) - (gh / 2.0), gw, gh )); + } + + return positions; +} diff --git a/FrameWorkCode/rubberband.h b/FrameWorkCode/rubberband.h new file mode 100644 index 00000000..3d9ba0f7 --- /dev/null +++ b/FrameWorkCode/rubberband.h @@ -0,0 +1,56 @@ +#ifndef RUBBERBAND_H +#define RUBBERBAND_H + +#include + +class RubberBand : public QWidget +{ + Q_OBJECT + +public: + explicit RubberBand(QWidget *parent = nullptr); + bool isMoveEnabled() const; + void setMoveEnabled(bool enabled); + QSize gripSize() const; + void setGripSize(const QSize &size); + QColor gripColor() const; + void setGripColor(const QColor &color); + +protected: + virtual void paintEvent(QPaintEvent *event); + virtual void mousePressEvent(QMouseEvent *event); + virtual void mouseMoveEvent(QMouseEvent *event); + virtual void mouseReleaseEvent(QMouseEvent *event); + +private: + enum Grip { + NoGrip = 0, + BottomRight, + TopLeft, + TopMiddle, + TopRight, + Left, + Right, + BottomLeft, + BottomMiddle + }; + +private: + bool m_moveEnabled; + QSize m_gripSize; + QColor m_gripColor; + QPointF m_dragPos; + Grip m_dragGrip; + bool m_diffBetweenPrevNowGeometry = false; + +private: + QMap gripPositions() const; + +signals: + void resized(const QRect &rect); + void resizeFinished(const QRect &rect); + void moved(const QRect &rect); + void moveFinished(const QRect &rect); +}; + +#endif // RUBBERBAND_H diff --git a/FrameWorkCode/threadingpush.cpp b/FrameWorkCode/threadingpush.cpp index 242e5d22..7db57732 100644 --- a/FrameWorkCode/threadingpush.cpp +++ b/FrameWorkCode/threadingpush.cpp @@ -56,7 +56,14 @@ int credentials_cb_func(git_cred ** out, const char *url, const char *username_f /*! * \fn threadingPush::ControlPush - * \brief + * \brief + * This function helps in pushing the changes to the cloud in a thread. + * The branch Name is Store as an QByte Array + * This function first looks for the repo where changes are to be pushed. + * Then fetch options are initialized + * Then are commit is successful, The changes are pushed. + * This function is being called in mainwindow.cpp file where with the help of threads this function is called so that in + * large sets the changes are successfully pushed. */ void threadingPush::ControlPush() { diff --git a/FrameWorkCode/worker.cpp b/FrameWorkCode/worker.cpp index 50f99d2d..257aa3c0 100644 --- a/FrameWorkCode/worker.cpp +++ b/FrameWorkCode/worker.cpp @@ -26,7 +26,8 @@ Worker::Worker(QObject *parent, QString s2, std::map CPair_editDis, std::map >* CPairs, - map filestructure_fw + map filestructure_fw, + QSet* dict_set1 ) : QObject(parent) { this->CPairs = CPairs; @@ -38,6 +39,7 @@ Worker::Worker(QObject *parent, this->gCurrentDirName = gCurrentDirName; this->gDirTwoLevelUp = gDirTwoLevelUp; this->filestructure_fw = filestructure_fw; + this->dict_set1 = dict_set1; } slpNPatternDict slnp; @@ -46,6 +48,10 @@ slpNPatternDict slnp; * \fn Worker::doSaveBackend * \brief This function calls SaveFile_Backend functions and emits finished() whenever the function completes * executing. + * \details This functions checks if user has changed any dictionary word or not. If some dictionary word is changed by + * \details the user, we main a log file of the same. + * \details Log filename : DictChanges. Location /Dicts/ + * \details Entries are stored as old word \t New word * \sa SaveFile_Backend() */ void Worker::doSaveBackend() @@ -62,9 +68,26 @@ void Worker::doSaveBackend() QFile sFile(localFilename); edit_Distance ed; changedWords = ed.editDistance(s1, s2); // Update CPair by editdistance + QVectorIterator i(changedWords); - while (i.hasNext()) - qDebug() << i.next()<")[0].trimmed().remove(".").remove(","); + QStringList words = first.split(" "); + foreach(auto &x, *dict_set1){ + if(words.contains(x, Qt::CaseInsensitive)){ + qDebug()<")[1].trimmed()<<"\n"; + } + } + }} + file_.close(); //! Do commit when there are some changes in previous and new html file on the basis of editdistance. if(changedWords.size()) diff --git a/FrameWorkCode/worker.h b/FrameWorkCode/worker.h index 2ce5e5d1..a9f886f5 100644 --- a/FrameWorkCode/worker.h +++ b/FrameWorkCode/worker.h @@ -18,7 +18,8 @@ class Worker : public QObject QString s2 = "", std::map CPair_editDis = {}, std::map >* CPairs = nullptr, - std::map filestructure_fw = {}); + std::map filestructure_fw = {}, + QSet* dict_set1 = {}); private: QString gCurrentPageName; @@ -29,6 +30,7 @@ class Worker : public QObject std::map CPair_editDis; std::map filestructure_fw; std::map >* CPairs; + QSet* dict_set1; signals: void finished(); diff --git a/README.md b/README.md index f44e4a8f..6fe9cba2 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # [Project website](https://udaanproject.org) ## [Read the docs](https://posteditingtool.readthedocs.io/en/latest/) -# Installation +# Installation ## Windows - [Windows Installation Guide](https://docs.google.com/document/d/16P1UZ2t1Dd8qhAsl2UqL5hTkrsOkBJqr/edit) diff --git a/docs/index.rst b/docs/index.rst index 168b9282..33e47b33 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -55,6 +55,7 @@ Welcome to OpenOCRCorrect's documentation! modules/undoglobalreplace.rst modules/verifyset.rst modules/worker.rst + modules/threadingpush.rst Indices and tables diff --git a/docs/modules/script.py b/docs/modules/script.py index 82cf4606..586dd0de 100644 --- a/docs/modules/script.py +++ b/docs/modules/script.py @@ -40,7 +40,8 @@ "UndoGlobalReplace", "VerifySet", "Worker", - "Graphics_view_zoom" + "Graphics_view_zoom", + "threadingPush" ] for cpp_class in class_list: diff --git a/docs/modules/threadingpush.rst b/docs/modules/threadingpush.rst new file mode 100644 index 00000000..d8b45210 --- /dev/null +++ b/docs/modules/threadingpush.rst @@ -0,0 +1,6 @@ +threadingPush +============= + +.. doxygenclass:: threadingPush + :members: + :private-members: