From a35971bf9c9fb5402a1bdc5de6f3249ba1b4556d Mon Sep 17 00:00:00 2001
From: 0singh-ajit0
Date: Fri, 16 Dec 2022 12:03:00 +0530
Subject: [PATCH 01/18] Added threadingpush docs
---
docs/index.rst | 1 +
docs/modules/script.py | 3 ++-
docs/modules/threadingpush.rst | 6 ++++++
3 files changed, 9 insertions(+), 1 deletion(-)
create mode 100644 docs/modules/threadingpush.rst
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:
From 7397d114f809dc4966ca1b95021ae0a480752683 Mon Sep 17 00:00:00 2001
From: AMMAN
Date: Sat, 17 Dec 2022 00:45:25 +0530
Subject: [PATCH 02/18] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index a483e89d..af0432bc 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ Following information is updated on the fly, after correction of each page:-
# Video demo
https://tinyurl.com/y7wbpo6m
-1. After laoding the OCR page, as user clicks on Spell Check, the correct words remain black.
+1. After loading the OCR page, as user clicks on Spell Check, the correct words remain black.
2. The purple words are the auto corrections.
3. The incorrect words are colored with blue, green and red strings from Dictionary. This improves readability.
4. The user can type in slp1 format or right click on the word (right click suggestion may be a partially corrected word) to correct the words. "Ctrl+d" converts the slp1 word-under-cursor to Devanagari and removes the color coding from the word-under-cursor.
From e9fe1392aac2f65fc53f5d1cfdabb6406c05a2bd Mon Sep 17 00:00:00 2001
From: Amman30
Date: Sat, 17 Dec 2022 11:10:14 +0530
Subject: [PATCH 03/18] Loading Time of sets when opening first time
reduced,bug during project.xml crash solved
---
FrameWorkCode/mainwindow.cpp | 45 +++++++++++++++++++++---------------
1 file changed, 27 insertions(+), 18 deletions(-)
diff --git a/FrameWorkCode/mainwindow.cpp b/FrameWorkCode/mainwindow.cpp
index 08acf721..3ae4cc57 100644
--- a/FrameWorkCode/mainwindow.cpp
+++ b/FrameWorkCode/mainwindow.cpp
@@ -1166,9 +1166,9 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based
*/
//QString ProjFile;
- if(mProject.isProjectOpen()){ //checking if some project is opened, then closing it before opening new project
- on_actionClose_project_triggered();
- }
+// 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
@@ -1198,7 +1198,8 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based
int result = verifySetObj.testProjectXML();
if (result != 0) {
- mProject.setProjectOpen(false);
+ on_actionClose_project_triggered();
+// 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;
}
@@ -1275,13 +1276,14 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based
//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 +1291,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 +1301,12 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based
list = cdir.entryList(QDir::Filter::Files);
for (auto f : list)
{
- QStringList x = f.split(QRegExp("[.]"));
+ x= f.split(QRegExp("[.]"));
+
+ t= str2 + "/" + f;
- QString t = str2 + "/" + f;
- QFile f2(t);
if(x[1]=="html") {
+ QFile f2(t);
totalFileCountInDir++;
mProject.AddTemp(filter, f2, "");
}
@@ -1316,10 +1322,12 @@ 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);
+ totalFileCountInDir++;
mProject.AddTemp(filter, f2, "");
- totalFileCountInDir++;
+
+
}
fileCountInDir["Inds"] = totalFileCountInDir;
totalFileCountInDir = 0;
@@ -1332,10 +1340,12 @@ 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
@@ -1410,7 +1420,7 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based
//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.
@@ -1569,7 +1579,6 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based
ui->groupBox->setDisabled(false);
}
-
/*!
* \fn MainWindow::AddRecentProjects
* \brief This function will allow user to open the last opened project.
From dcc53b10d9d5778336b586d2b9413a53834d5840 Mon Sep 17 00:00:00 2001
From: AMMAN
Date: Sat, 17 Dec 2022 13:25:39 +0530
Subject: [PATCH 04/18] Updated Docs of threadingPush
---
FrameWorkCode/threadingpush.cpp | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
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()
{
From 82f88e501c8df2960d125a2debdd46b8e96359d4 Mon Sep 17 00:00:00 2001
From: Sadam452
Date: Sun, 18 Dec 2022 09:48:33 +0530
Subject: [PATCH 05/18] fixed last opened project files
---
FrameWorkCode/mainwindow.cpp | 315 +++++++++++++++--------------------
1 file changed, 137 insertions(+), 178 deletions(-)
diff --git a/FrameWorkCode/mainwindow.cpp b/FrameWorkCode/mainwindow.cpp
index 3ae4cc57..97de939f 100644
--- a/FrameWorkCode/mainwindow.cpp
+++ b/FrameWorkCode/mainwindow.cpp
@@ -170,7 +170,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";
@@ -1149,43 +1149,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,10 +1188,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) {
- on_actionClose_project_triggered();
-// 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;
}
@@ -1272,8 +1265,6 @@ 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;
@@ -1281,7 +1272,7 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based
for (auto f : list)
{
x = f.split(QRegExp("[.]"));
- t = str1 + "/" + f;
+ t = str1 + "/" + f;
if(x[1]=="html") {
QFile f2(t);
totalFileCountInDir++;
@@ -1292,7 +1283,7 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based
fileCountInDir["Corrector"] = totalFileCountInDir;
totalFileCountInDir = 0;
- QMessageBox::information(0, "Success", "Project opened successfully.");
+ QMessageBox::information(0, "Success", "Project opened successfully.");
//!Adds each file present in VerifierOutput directory to treeView
cdir.setPath(str2);
@@ -1301,10 +1292,8 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based
list = cdir.entryList(QDir::Filter::Files);
for (auto f : list)
{
- x= f.split(QRegExp("[.]"));
-
+ x= f.split(QRegExp("[.]"));
t= str2 + "/" + f;
-
if(x[1]=="html") {
QFile f2(t);
totalFileCountInDir++;
@@ -1322,12 +1311,10 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based
list = cdir.entryList(QDir::Filter::Files);
for (auto f : list)
{
- t = str3 + "/" + f;
+ t = str3 + "/" + f;
QFile f2(t);
- totalFileCountInDir++;
+ totalFileCountInDir++;
mProject.AddTemp(filter, f2, "");
-
-
}
fileCountInDir["Inds"] = totalFileCountInDir;
totalFileCountInDir = 0;
@@ -1340,12 +1327,10 @@ void MainWindow::on_actionOpen_Project_triggered() { //Version Based
list = cdir.entryList(QDir::Filter::Files);
for (auto f : list) {
- t= str4 + "/" + f;
+ t= str4 + "/" + f;
QFile f2(t);
totalFileCountInDir++;
mProject.AddTemp(filter, f2, "");
-
-
}
fileCountInDir["Image"] = totalFileCountInDir;
totalFileCountInDir = 0; // Resetting variable to 0
@@ -1379,7 +1364,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);
}
@@ -1389,16 +1373,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
@@ -1413,15 +1387,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");
-
-
-// ui->tabWidget_2->removeTab(0);
//!Genearte image.xml for figure/table/equation entries and initialize these values by 1.
markRegion objectMarkRegion;
@@ -1432,11 +1399,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");
@@ -1454,130 +1421,122 @@ 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
From 42ca3fcfafae54291fe8837150cca84e893ada44 Mon Sep 17 00:00:00 2001
From: 0singh-ajit0
Date: Tue, 20 Dec 2022 10:03:32 +0530
Subject: [PATCH 06/18] Fixed page clearing when undo operation performed on
fresh opened file
---
FrameWorkCode/mainwindow.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/FrameWorkCode/mainwindow.cpp b/FrameWorkCode/mainwindow.cpp
index 97de939f..324cdc36 100644
--- a/FrameWorkCode/mainwindow.cpp
+++ b/FrameWorkCode/mainwindow.cpp
@@ -6277,6 +6277,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();
From 9902f62e42e1bfab93427793a7aa35a38f555fe4 Mon Sep 17 00:00:00 2001
From: Sadam452
Date: Tue, 20 Dec 2022 18:49:09 +0530
Subject: [PATCH 07/18] Handled login if internet is not available, verion
update
---
FrameWorkCode/main.cpp | 2 +-
FrameWorkCode/mainwindow.cpp | 16 ++++++++++++----
FrameWorkCode/mainwindow.ui | 4 +++-
3 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/FrameWorkCode/main.cpp b/FrameWorkCode/main.cpp
index 4df24014..379f19d4 100755
--- a/FrameWorkCode/main.cpp
+++ b/FrameWorkCode/main.cpp
@@ -92,7 +92,7 @@ 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.2");
//! Writing Log Files
QFile logFile(QString::fromStdString(qApp->applicationDirPath().toStdString())+"/application.log");
diff --git a/FrameWorkCode/mainwindow.cpp b/FrameWorkCode/mainwindow.cpp
index 324cdc36..f8efca5f 100644
--- a/FrameWorkCode/mainwindow.cpp
+++ b/FrameWorkCode/mainwindow.cpp
@@ -6277,7 +6277,6 @@ 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();
@@ -7877,7 +7876,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();
@@ -8954,8 +8954,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.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{
-
+
From de90e30366e7571e9b02234c42b70544c87f766d Mon Sep 17 00:00:00 2001
From: 0singh-ajit0
Date: Wed, 21 Dec 2022 08:46:54 +0530
Subject: [PATCH 08/18] Added resize image using rubber band feature
Again pushed code for fixing the issue of page clearing when undo operation was executed after opening a page in tool
---
FrameWorkCode/customtextbrowser.cpp | 74 ++++++++-
FrameWorkCode/customtextbrowser.h | 11 +-
FrameWorkCode/mainwindow.cpp | 1 +
FrameWorkCode/qpadfinal.pri | 2 +
FrameWorkCode/rubberband.cpp | 239 ++++++++++++++++++++++++++++
FrameWorkCode/rubberband.h | 56 +++++++
6 files changed, 374 insertions(+), 9 deletions(-)
create mode 100644 FrameWorkCode/rubberband.cpp
create mode 100644 FrameWorkCode/rubberband.h
diff --git a/FrameWorkCode/customtextbrowser.cpp b/FrameWorkCode/customtextbrowser.cpp
index 7f07c3cb..38078f44 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,56 @@ void CustomTextBrowser::insertCompletion(const QString &completion)
setTextCursor(tc);
}
+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);
+ }
+}
+
+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 +204,13 @@ void CustomTextBrowser::focusInEvent(QFocusEvent *e)
QTextBrowser::focusInEvent(e);
}
+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/mainwindow.cpp b/FrameWorkCode/mainwindow.cpp
index f8efca5f..dc40b0f5 100644
--- a/FrameWorkCode/mainwindow.cpp
+++ b/FrameWorkCode/mainwindow.cpp
@@ -6277,6 +6277,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();
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..cb38cf14
--- /dev/null
+++ b/FrameWorkCode/rubberband.cpp
@@ -0,0 +1,239 @@
+#include "rubberband.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+RubberBand::RubberBand(QWidget *parent)
+ : QWidget{parent}
+{
+ m_moveEnabled = true;
+ m_gripSize = QSize(8, 8);
+ m_gripColor = QColor(Qt::blue);
+ m_dragPos = QPointF();
+ m_dragGrip = NoGrip;
+}
+
+bool RubberBand::isMoveEnabled() const
+{
+ return m_moveEnabled;
+}
+
+void RubberBand::setMoveEnabled(bool enabled)
+{
+ m_moveEnabled = enabled;
+}
+
+QSize RubberBand::gripSize() const
+{
+ return m_gripSize;
+}
+
+void RubberBand::setGripSize(const QSize &size)
+{
+ if (m_gripSize != size && size.isValid()) {
+ m_gripSize = size;
+ update();
+ }
+}
+
+QColor RubberBand::gripColor() const
+{
+ return m_gripColor;
+}
+
+void RubberBand::setGripColor(const QColor &color)
+{
+ if (m_gripColor != color) {
+ m_gripColor = color;
+ update();
+ }
+}
+
+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));
+ }
+}
+
+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;
+ break;
+ }
+ }
+
+ if (m_dragGrip == NoGrip && m_moveEnabled) {
+ m_dragPos = event->windowPos();
+ }
+ }
+}
+
+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());
+ }
+ }
+ }
+}
+
+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;
+
+ update();
+}
+
+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
From 5d800b89cd0131477f90681e7e4df78057bd95dd Mon Sep 17 00:00:00 2001
From: 0singh-ajit0
Date: Wed, 21 Dec 2022 10:23:11 +0530
Subject: [PATCH 09/18] Added docs for resizing image using rubber band feature
---
FrameWorkCode/customtextbrowser.cpp | 15 ++++++
FrameWorkCode/rubberband.cpp | 72 +++++++++++++++++++++++++++++
2 files changed, 87 insertions(+)
diff --git a/FrameWorkCode/customtextbrowser.cpp b/FrameWorkCode/customtextbrowser.cpp
index 38078f44..09ccece9 100644
--- a/FrameWorkCode/customtextbrowser.cpp
+++ b/FrameWorkCode/customtextbrowser.cpp
@@ -130,6 +130,11 @@ 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();
@@ -156,6 +161,11 @@ void CustomTextBrowser::updateGripBand()
}
}
+/*!
+ * \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();
@@ -204,6 +214,11 @@ 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();
diff --git a/FrameWorkCode/rubberband.cpp b/FrameWorkCode/rubberband.cpp
index cb38cf14..e9f453d7 100644
--- a/FrameWorkCode/rubberband.cpp
+++ b/FrameWorkCode/rubberband.cpp
@@ -7,6 +7,11 @@
#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}
{
@@ -17,21 +22,41 @@ RubberBand::RubberBand(QWidget *parent)
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()) {
@@ -40,11 +65,21 @@ void RubberBand::setGripSize(const QSize &size)
}
}
+/*!
+ * \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) {
@@ -53,6 +88,15 @@ void RubberBand::setGripColor(const QColor &color)
}
}
+/*!
+ * \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);
@@ -70,6 +114,16 @@ void RubberBand::paintEvent(QPaintEvent *event)
}
}
+/*!
+ * \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()) {
@@ -92,6 +146,14 @@ void RubberBand::mousePressEvent(QMouseEvent *event)
}
}
+/*!
+ * \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()) {
@@ -191,6 +253,11 @@ void RubberBand::mouseMoveEvent(QMouseEvent *event)
}
}
+/*!
+ * \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);
@@ -211,6 +278,11 @@ void RubberBand::mouseReleaseEvent(QMouseEvent *event)
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;
From e6284def44f6904d85bd0d610969e8569cc2ea75 Mon Sep 17 00:00:00 2001
From: Sadam452
Date: Wed, 21 Dec 2022 13:23:37 +0530
Subject: [PATCH 10/18] added dictionary word replacement logs
---
FrameWorkCode/mainwindow.cpp | 5 +++--
FrameWorkCode/mainwindow.h | 1 +
FrameWorkCode/worker.cpp | 29 ++++++++++++++++++++++++++---
FrameWorkCode/worker.h | 4 +++-
4 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/FrameWorkCode/mainwindow.cpp b/FrameWorkCode/mainwindow.cpp
index dc40b0f5..a7cdbff6 100644
--- a/FrameWorkCode/mainwindow.cpp
+++ b/FrameWorkCode/mainwindow.cpp
@@ -1946,7 +1946,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()));
@@ -5636,7 +5637,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")
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/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();
From a049f0e6bde4d81a35346cb79be989b83f729ddc Mon Sep 17 00:00:00 2001
From: Sadam452
Date: Thu, 22 Dec 2022 16:40:36 +0530
Subject: [PATCH 11/18] Verifier cloud save fixed; Detecting Book name from git
configuration
---
FrameWorkCode/Project.cpp | 298 ++++++++++++++++++-----------------
FrameWorkCode/mainwindow.cpp | 160 +++++++++++++------
2 files changed, 268 insertions(+), 190 deletions(-)
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"<
#include "threadingpush.h">
#include
+#include
map LSTM;
map Dict, GBook, IBook, PWords, PWordsP,ConfPmap,ConfPmapFont,CPairRight;
@@ -3396,8 +3397,20 @@ void MainWindow::on_actionFetch_2_triggered()
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");
- QStringList list = gDirTwoLevelUp.split("/");
- QString repo = list[list.size()-1];
+ //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;
@@ -3515,8 +3528,20 @@ void MainWindow::on_actionTurn_In_triggered()
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");
- QStringList list = gDirTwoLevelUp.split("/");
- QString repo = list[list.size()-1];
+ //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;
@@ -3669,15 +3694,73 @@ void MainWindow::on_actionVerifier_Turn_In_triggered()
//showing the message box for 2 seconds only.
QTimer cntDown;
QObject::connect(&cntDown, &QTimer::timeout, [&msg,&cnt, &cntDown]()->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.
@@ -3831,13 +3914,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();
}
@@ -3857,13 +3933,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();
}
@@ -3881,34 +3950,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 {
@@ -3933,7 +3996,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
{
From 53d035843b17590a1225675ef896de7fd54f294f Mon Sep 17 00:00:00 2001
From: Sadam452
Date: Sat, 24 Dec 2022 01:06:38 +0530
Subject: [PATCH 12/18] Optimize pdf download, removed few options, Ui change
in Dashboard and pdf range.
---
FrameWorkCode/dashboard.ui | 34 +++++++++------
FrameWorkCode/mainwindow.cpp | 74 ++++++++++++++++++---------------
FrameWorkCode/pdfrangedialog.ui | 6 +--
3 files changed, 66 insertions(+), 48 deletions(-)
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/mainwindow.cpp b/FrameWorkCode/mainwindow.cpp
index 60f4da2d..486887d0 100644
--- a/FrameWorkCode/mainwindow.cpp
+++ b/FrameWorkCode/mainwindow.cpp
@@ -266,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
@@ -362,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");
}
@@ -7048,12 +7052,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);
@@ -7075,7 +7079,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("."))
@@ -7098,15 +7102,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++;
@@ -7920,13 +7926,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();
@@ -8039,14 +8045,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";
@@ -8057,14 +8063,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("$$")){
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
From 244343dd6c34e0ca18970a2699a3cae7b96abe6c Mon Sep 17 00:00:00 2001
From: Sadam452
Date: Sun, 25 Dec 2022 12:24:45 +0530
Subject: [PATCH 13/18] Fixed bug which was causing problem in converting zip
to docx
---
FrameWorkCode/main.cpp | 2 +-
FrameWorkCode/mainwindow.cpp | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/FrameWorkCode/main.cpp b/FrameWorkCode/main.cpp
index 379f19d4..c0f5f5e4 100755
--- a/FrameWorkCode/main.cpp
+++ b/FrameWorkCode/main.cpp
@@ -92,7 +92,7 @@ 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.5.2");
+ a.setApplicationVersion("v3.5.4");
//! Writing Log Files
QFile logFile(QString::fromStdString(qApp->applicationDirPath().toStdString())+"/application.log");
diff --git a/FrameWorkCode/mainwindow.cpp b/FrameWorkCode/mainwindow.cpp
index 486887d0..ec21085b 100644
--- a/FrameWorkCode/mainwindow.cpp
+++ b/FrameWorkCode/mainwindow.cpp
@@ -4501,11 +4501,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
@@ -4513,7 +4513,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
@@ -4524,7 +4524,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);
@@ -4537,7 +4537,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);
From 2f8f159966514dbc988eb83d955def202543a9ad Mon Sep 17 00:00:00 2001
From: 0singh-ajit0
Date: Tue, 27 Dec 2022 10:50:03 +0530
Subject: [PATCH 14/18] Different cursor will show when clicked on a grip and
enabled high dpi scaling
---
FrameWorkCode/main.cpp | 1 +
FrameWorkCode/rubberband.cpp | 23 ++++++++++++++++++++++-
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/FrameWorkCode/main.cpp b/FrameWorkCode/main.cpp
index c0f5f5e4..b384af00 100755
--- a/FrameWorkCode/main.cpp
+++ b/FrameWorkCode/main.cpp
@@ -93,6 +93,7 @@ int main(int argc, char *argv[])
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.5.4");
+ a.setAttribute(Qt::AA_EnableHighDpiScaling);
//! Writing Log Files
QFile logFile(QString::fromStdString(qApp->applicationDirPath().toStdString())+"/application.log");
diff --git a/FrameWorkCode/rubberband.cpp b/FrameWorkCode/rubberband.cpp
index e9f453d7..55527fed 100644
--- a/FrameWorkCode/rubberband.cpp
+++ b/FrameWorkCode/rubberband.cpp
@@ -15,7 +15,7 @@
RubberBand::RubberBand(QWidget *parent)
: QWidget{parent}
{
- m_moveEnabled = true;
+ m_moveEnabled = false;
m_gripSize = QSize(8, 8);
m_gripColor = QColor(Qt::blue);
m_dragPos = QPointF();
@@ -136,6 +136,26 @@ void RubberBand::mousePressEvent(QMouseEvent *event)
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;
}
}
@@ -274,6 +294,7 @@ void RubberBand::mouseReleaseEvent(QMouseEvent *event)
m_diffBetweenPrevNowGeometry = false;
m_dragPos = QPointF();
m_dragGrip = NoGrip;
+ setCursor(Qt::ArrowCursor);
update();
}
From 9d53494f4b8205ca4710108530199afa2bd294d6 Mon Sep 17 00:00:00 2001
From: Sadam452
Date: Tue, 27 Dec 2022 11:45:04 +0530
Subject: [PATCH 15/18] Fixed font all properties and Table empty block
---
FrameWorkCode/handlebbox.cpp | 5 ++
FrameWorkCode/mainwindow.cpp | 110 ++++++++++++++++++++++++++++++++---
2 files changed, 107 insertions(+), 8 deletions(-)
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/mainwindow.cpp b/FrameWorkCode/mainwindow.cpp
index ec21085b..8406c34f 100644
--- a/FrameWorkCode/mainwindow.cpp
+++ b/FrameWorkCode/mainwindow.cpp
@@ -222,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);
@@ -2841,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()) {
@@ -2849,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];
@@ -2869,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("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);
@@ -6228,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") {
@@ -6245,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);
}
From ff1b2ade7186ef478789b9ee122c447c8902d37a Mon Sep 17 00:00:00 2001
From: Sadam452
Date: Tue, 27 Dec 2022 11:59:22 +0530
Subject: [PATCH 16/18] added special symbols
---
FrameWorkCode/Symbols.cpp | 3 ++-
FrameWorkCode/Symbols.h | 3 +++
FrameWorkCode/Symbols.ui | 20 +++++++++++++-------
3 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/FrameWorkCode/Symbols.cpp b/FrameWorkCode/Symbols.cpp
index 8eba818a..6d189287 100644
--- a/FrameWorkCode/Symbols.cpp
+++ b/FrameWorkCode/Symbols.cpp
@@ -56,7 +56,8 @@ SymbolsView::SymbolsView(QWidget *parent) : QDialog(parent, Qt::WindowCloseButto
ui->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>
From 6b5d8c6629b069e28937e439da11ea5638e7e1df Mon Sep 17 00:00:00 2001
From: AMMAN
Date: Tue, 27 Dec 2022 21:45:27 +0530
Subject: [PATCH 17/18] Document folder made Read Only
---
FrameWorkCode/mainwindow.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/FrameWorkCode/mainwindow.cpp b/FrameWorkCode/mainwindow.cpp
index 8406c34f..6a83f6b4 100644
--- a/FrameWorkCode/mainwindow.cpp
+++ b/FrameWorkCode/mainwindow.cpp
@@ -6527,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;
From e67064e9d0ca69f22474e5ec9a00463aafc3db86 Mon Sep 17 00:00:00 2001
From: AMMAN
Date: Tue, 27 Dec 2022 22:45:36 +0530
Subject: [PATCH 18/18] name Error resolved for Document ReadOnly
---
FrameWorkCode/mainwindow.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/FrameWorkCode/mainwindow.cpp b/FrameWorkCode/mainwindow.cpp
index 6a83f6b4..66f66ee7 100644
--- a/FrameWorkCode/mainwindow.cpp
+++ b/FrameWorkCode/mainwindow.cpp
@@ -6533,7 +6533,7 @@ void MainWindow::LoadDocument(QFile * f, QString ext, QString name)
curr_browser->setReadOnly(true);
}
else{
- curr_browser->setReadonly(false);
+ curr_browser->setReadOnly(false);
}
// Deleting temporarily created CustomTextBrowser