Skip to content

Commit

Permalink
Merge pull request #324 from UDAAN-LEAP/v4.5.0
Browse files Browse the repository at this point in the history
v4.5.0 Release
  • Loading branch information
NishantWankhade authored Dec 26, 2023
2 parents 15fb90c + fd50410 commit 77cbcd2
Show file tree
Hide file tree
Showing 44 changed files with 2,908 additions and 707 deletions.
1 change: 1 addition & 0 deletions FrameWorkCode/AppResources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
<file>Resources/pen.png</file>
<file>Resources/view.png</file>
<file>Resources/release.png</file>
<file>Resources/sync_history.png</file>
</qresource>
<qresource prefix="/WordList">
<file>wordlists/english.txt</file>
Expand Down
75 changes: 73 additions & 2 deletions FrameWorkCode/Project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ int credentials_cb(git_cred ** out, const char *url, const char *username_from_u
{
}
QNetworkAccessManager* manager = new QNetworkAccessManager();
QUrl url_("https://udaaniitb.aicte-india.org/udaan/email/");
QUrl url_("http://92.204.144.173/udaan/email/");

QByteArray postData;
postData.append("username=username&password=password");
Expand Down Expand Up @@ -1182,7 +1182,7 @@ bool Project::commit(std::string message)
//qDebug()<<"email"<<email;
settings.endGroup();
QNetworkAccessManager* manager = new QNetworkAccessManager();
QUrl url_("https://udaaniitb.aicte-india.org/udaan/commits/");
QUrl url_("http://92.204.144.173/udaan/commits/");

QByteArray postData;
postData.append("commit_no="+sha+"&email="+email);
Expand Down Expand Up @@ -1839,3 +1839,74 @@ int Project::findNumberOfFilesInDirectory(std::string path)

}
#endif

/*!
* \fn Project::describe_commit
* \brief Returns the names of changed files in the particular commit number
* \details It is equivalent to "git show --name-only {commit number}" command on git bash
* \param mRole, commit_number
* \return QString
*/
QString Project::describe_commit(QString mRole,QString commit_number)
{
QByteArray array = commit_number.toLocal8Bit();
const char * commit_no = array.data();
QString changedFiles = "No Changed Files";
git_commit *commit = NULL;

int error = git_revparse_single((git_object **)&commit, repo, commit_no);
if (error < 0) {
qDebug() << "Error parsing commit: " << git_error_last()->message;
return changedFiles;
}

size_t parent_count = git_commit_parentcount(commit);
if (parent_count > 0) {
git_commit *parent = NULL;
error = git_commit_parent(&parent, commit, 0);
if (error >= 0) {
git_tree *tree, *parent_tree;
error = git_commit_tree(&tree, commit);
if (error >= 0) {
error = git_commit_tree(&parent_tree, parent);
if (error >= 0) {
git_diff *diff;
error = git_diff_tree_to_tree(&diff, repo, parent_tree, tree, NULL);
if (error >= 0) {
size_t num_deltas = git_diff_num_deltas(diff);
for (size_t i = 0; i < num_deltas; ++i) {
const git_diff_delta *delta = git_diff_get_delta(diff, i);
QString str = delta->new_file.path;
if(mRole == "Corrector" && !str.contains("CorrectorOutput")){
continue;
}
else{
str.remove("CorrectorOutput");
}
if(mRole == "Verifier" && !str.contains("VerifierOutput")){
continue;
}
else{
str.remove("VerifierOutput");
}

if(changedFiles == "No Changed Files")
changedFiles = str;
else
changedFiles += str;
changedFiles.append("\n");
}
git_diff_free(diff);
}
}
git_tree_free(parent_tree);
}
git_tree_free(tree);
git_commit_free(parent);
}
}

git_commit_free(commit);

return changedFiles;
}
1 change: 1 addition & 0 deletions FrameWorkCode/Project.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class Project {
int GetGraphemesCount(QString string);
int GetPageNumber(std::string localFilename, std::string *no, size_t *loc, QString *ext);
static int clone(QString url_, QString path, LoadingSpinner* spinner);
QString describe_commit(QString mRole,QString commit_number);

~Project() {
for (auto p : mFiles) {
Expand Down
Binary file modified FrameWorkCode/Resources/about-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/close_project-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/copy-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/cut-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/date-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/decrease_size-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/download-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/equation-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/image-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/import-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/increase_size-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/indent-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/keyboard_shortcuts-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/link-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/linux-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/outdent-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/paste(1)-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/resize-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/select_all-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/sync_from_cloud-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FrameWorkCode/Resources/sync_history.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/tab-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/table-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/tutorial-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/update-modified.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified FrameWorkCode/Resources/user-guide-modified.png
Binary file modified FrameWorkCode/Resources/voice_typing-modified.png
Binary file modified FrameWorkCode/Resources/windows-modified.png
3 changes: 3 additions & 0 deletions FrameWorkCode/Symbols.ui
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ li.checked::marker { content: &quot;\2612&quot;; }
<string notr="true">background-color: rgb(255, 255, 255); color: black;
font-size:30px;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
Expand Down
14 changes: 14 additions & 0 deletions FrameWorkCode/customtreeviewitem.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include "customtreeviewitem.h"

customTreeviewItem::customTreeviewItem(QTreeView* tv,QMap<QString, int> checkedPages, QAbstractItemModel *model)
{
this->treeView = tv;
this->changedPages = checkedPages;
this->model = model;
}

void customTreeviewItem::update(QMap<QString, int> checkedPages)
{
this->changedPages = checkedPages;
}

38 changes: 38 additions & 0 deletions FrameWorkCode/customtreeviewitem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifndef CUSTOMTREEVIEWITEM_H
#define CUSTOMTREEVIEWITEM_H

#include<QStyledItemDelegate>
#include<QTreeView>
#include<QObject>
#include<QPainter>
#include<QStyleOptionViewItem>
#include<QModelIndex>
#include<QDebug>
#include<QAbstractItemModel>
class customTreeviewItem: public QStyledItemDelegate
{
public:
customTreeviewItem(QTreeView* treeView, QMap<QString, int> checkedPages,QAbstractItemModel *model);

void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override
{
QString treeItemLabel = index.data(Qt::DisplayRole).toString();
QStringList pageNames = changedPages.keys();
if (pageNames.contains(treeItemLabel) ){
painter->fillRect(option.rect, QColor(60,179,113));
QRect adjustedRect = option.rect.adjusted(0, 0, 0, 0);
painter->drawRect(adjustedRect);
}
QStyledItemDelegate::paint(painter, option, index);

}

void update(QMap<QString, int> checkedPages);

private:
QTreeView* treeView;
QMap<QString, int> changedPages;
QAbstractItemModel *model;
};

#endif // CUSTOMTREEVIEWITEM_H
13 changes: 6 additions & 7 deletions FrameWorkCode/indentoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ indentOptions::indentOptions(QWidget *parent, int* left, int* right) :
ui->setupUi(this);
this->left = left;
this->right = right;
setWindowTitle("Indentation Options");
}

indentOptions::~indentOptions()
Expand All @@ -17,30 +18,28 @@ indentOptions::~indentOptions()

void indentOptions::closeEvent(QCloseEvent* event)
{

reject();// Set check_b to true when the dialog is closed
emit dialogRejected();
QDialog::closeEvent(event);
}

void indentOptions::on_buttonBox_accepted()
{

int l = ui->textEdit_left->toPlainText().toInt();
int r = ui->textEdit_right->toPlainText().toInt();
if(l==0 && r==0){
reject();
emit dialogRejected();
return;
}

*left = l;
*right = r;
accept();


emit dialogAccepted();
}


void indentOptions::on_buttonBox_rejected()
{
reject();
emit dialogRejected();
this->close();
}
4 changes: 3 additions & 1 deletion FrameWorkCode/indentoptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class indentOptions : public QDialog
public:
explicit indentOptions(QWidget *parent = nullptr, int * left = nullptr, int * right = nullptr);
~indentOptions();

signals:
void dialogAccepted();
void dialogRejected();

protected:
void closeEvent(QCloseEvent* event) override;
Expand Down
9 changes: 8 additions & 1 deletion FrameWorkCode/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,14 @@ int main(int argc, char *argv[])
#endif
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("v4.1");

QSettings settings("IIT-B", "OpenOCRCorrect");
settings.beginGroup("update");
QString default_version = "v4.1";
QString version = settings.value("version").toString();
settings.endGroup();
if(version == "") version = default_version;
a.setApplicationVersion(version);
a.setAttribute(Qt::AA_EnableHighDpiScaling);

//! Writing Log Files
Expand Down
Loading

0 comments on commit 77cbcd2

Please sign in to comment.