Skip to content

Commit

Permalink
Merge pull request #337 from UDAAN-LEAP/dev
Browse files Browse the repository at this point in the history
v4.7
  • Loading branch information
Kaushal-04 authored Sep 11, 2024
2 parents 54a50a0 + 7af2e77 commit c67a745
Show file tree
Hide file tree
Showing 10 changed files with 23,195 additions and 68 deletions.
4 changes: 2 additions & 2 deletions FrameWorkCode/Project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,11 +836,11 @@ bool Project::push(QString gDirTwoLevelUp) {
*/
error = (git_reference_peel((git_object **)&parents[0], head_ref, GIT_OBJ_COMMIT))
|| (git_commit_lookup(&parents[1], repo, git_annotated_commit_id(heads[0])))
|| (git_commit_create(&id, repo, "HEAD", signature, signature, NULL, "Merge commit - Udaan Translation Tool", tree, 2, (const git_commit **)parents))
|| (git_commit_create(&id, repo, "HEAD", signature, signature, NULL, "Merge commit - Udaan Translation Tool", tree, 2, parents))
|| (git_repository_state_cleanup(repo));

if(error){
std::cout<<4<<endl;
std::cout << 4 << endl;
//goto cleanup;
}
}
Expand Down
Binary file added FrameWorkCode/SimpleMail2Qt5.lib
Binary file not shown.
10 changes: 8 additions & 2 deletions FrameWorkCode/dashboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ dashboard::dashboard(QWidget *parent, QString s, int max, QMap<int, QString> rep
searchLineEdit->setPlaceholderText("Search...");
searchLineEdit->setStyleSheet("color : black; text-align : left; background-color :rgb(255,255,255); border: 1px solid black; border-radius :5px;");
ui->verticalLayout->addWidget(searchLineEdit);
searchLineEdit->setFixedWidth(510);
searchLineEdit->setFixedHeight(30); // Set the desired height
//

ui->scrollArea->setWidget(ui->verticalLayout->widget());
Expand All @@ -73,7 +75,8 @@ dashboard::dashboard(QWidget *parent, QString s, int max, QMap<int, QString> rep

btn->setText(i.value());
btn->setFixedHeight(50);
btn->setMinimumWidth(ui->scrollArea->width());
btn->setFixedWidth(510);
//btn->setMinimumWidth(ui->scrollArea->width());
btn->setStyleSheet("color : black; text-align : left; padding : 10px;background-color :rgb(229,228,226); border-radius :5px;");
connect(btn, &QPushButton::clicked , [this, index] {clicked(index);});
this->btnMap[index] = btn;
Expand All @@ -94,7 +97,8 @@ dashboard::dashboard(QWidget *parent, QString s, int max, QMap<int, QString> rep

btn->setText(i.value());
btn->setFixedHeight(50);
btn->setMinimumWidth(ui->scrollArea->width());
btn->setFixedWidth(510);
//btn->setMinimumWidth(ui->scrollArea->width());
btn->setStyleSheet("color : black; text-align : left; padding : 10px;background-color :rgb(229,228,226); border-radius :5px;");
connect(btn, &QPushButton::clicked , [this, index] {clicked(index);});
this->btnMap[index] = btn;
Expand All @@ -119,6 +123,8 @@ dashboard::~dashboard()
* \brief Removes all the current repo buttons in the dashboard
*/
void dashboard::clearButtons() {
//Clearing the total clicked button count
this->totalClickedBooks = 0;
// Iterate through the button map and delete each button
for (auto it = btnMap.begin(); it != btnMap.end(); ++it) {
QPushButton *btn = it.value();
Expand Down
15 changes: 15 additions & 0 deletions FrameWorkCode/dashboard.ui
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,27 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>589</width>
<height>574</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>589</width>
<height>574</height>
</size>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="sizeGripEnabled">
<bool>false</bool>
</property>
<widget class="QPushButton" name="pushButton_2">
<property name="geometry">
<rect>
Expand Down
3 changes: 2 additions & 1 deletion FrameWorkCode/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ int main(int argc, char *argv[])

QSettings settings("IIT-B", "OpenOCRCorrect");
settings.beginGroup("update");
QString default_version = "v4.6";
QString default_version = "v4.7";

QString version = settings.value("version").toString();
settings.endGroup();
if(version == "") version = default_version;
Expand Down
49 changes: 31 additions & 18 deletions FrameWorkCode/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),ui(new Ui::MainWin
ui->copyToVerifier->setEnabled(false);
ui->checkBox->setEnabled(false);
ui->addDictionary->setEnabled(false);
ui->actionComment->setVisible(false);
ui->actionComment->setEnabled(false);
ui->actionComment->setVisible(true);
ui->actionComment->setEnabled(true);

settings.beginGroup("cloudSave");
settings.remove("");
Expand Down Expand Up @@ -4452,6 +4452,7 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
//! Apply event on graphicsview (image loaded part)
if( object->parent() == ui->graphicsView)
{
installEventFilter(this);
//! Capturing mouse press event on graphics view for OCR
if (event->type() == QEvent::MouseButtonPress && shouldIOCR){
//! calls handleOCR function reponsible for handling the OCR functionality
Expand All @@ -4464,7 +4465,6 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
handleOCR(event, x1, y1, x2, y2);
}

installEventFilter(this);
//! Capturing mouse press event on graphicsview
if (event->type() == QEvent::MouseButtonPress && shouldIDraw)
{
Expand All @@ -4486,7 +4486,6 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
drawRectangleFlag=false;
pressedFlag =0; //for stopping the drawing
event->accept();
return true;
}
if(shouldIDraw){

Expand Down Expand Up @@ -4652,7 +4651,6 @@ bool MainWindow::eventFilter(QObject *object, QEvent *event)
//! setting for cancelbutton
else
{
QMessageBox::information(0, "Not saved", "Cancelled");
crop_rect->setRect(0,0,1,1);
shouldIDraw=false;
ui->pushButton->setStyleSheet("background-color:rgb(227, 228, 228);border:0px; color: rgb(32, 33, 72);height:26.96px; width: 109.11px; padding-top:1px; border-radius:4.8px; padding-left:1.3px;"); //remove the style once the operation is done
Expand Down Expand Up @@ -8127,7 +8125,7 @@ void MainWindow::on_actionLinux_triggered()
*/
void MainWindow::on_actionWindows_triggered()
{
QDesktopServices::openUrl(QUrl("https://docs.google.com/document/d/12Zbe9OLYOoguGu7HWRnpYkHD0BaW8SOvjYh96DYZ_8Y/edit", QUrl::TolerantMode));
QDesktopServices::openUrl(QUrl("https://docs.google.com/document/d/1FcnBcxjjQ4rd3xfDMyHft0iVndEj8Iu7PaTvuWJrTSM/edit?usp=sharing", QUrl::TolerantMode));
}

/*!
Expand Down Expand Up @@ -8899,7 +8897,6 @@ void MainWindow::on_actionCheck_for_Updates_triggered(int arg)
if(latestVersion == "false") return;
QString curr_version = qApp->applicationVersion();
//QString latestVersion = UpdateInfo();
qDebug() << curr_version;
if(curr_version==latestVersion)
{
if(arg!=1){
Expand Down Expand Up @@ -9572,6 +9569,7 @@ void MainWindow::on_actionClone_Repository()
QJsonDocument document = QJsonDocument::fromJson(m_data, &errorPtr);
QJsonObject mainObj = document.object();
QJsonArray repos = mainObj.value("repo_list").toArray();
qDebug()<<repos;
if(repos.size() == 0){
QMessageBox msg;
msg.setText("There is nothing to show on dashboard");
Expand All @@ -9583,12 +9581,18 @@ void MainWindow::on_actionClone_Repository()
QString importHtml="<table><tr><th>#Project ID</th><th>#Project name</th></tr>";
QStandardItemModel *model = new QStandardItemModel;
QMap<int, QString> repoMap;
for(itr = repos.begin(); itr != repos.end(); itr++){
for(itr = repos.end() - 1; itr != repos.begin(); itr--){
lineindex++;
repoMap[lineindex] = itr->toString();
QString num = QString::number(lineindex);
importHtml += QString::fromStdString("<tr><td>")+num+"</td><td>"+itr->toString()+"</td></tr";
}
itr = repos.begin();
lineindex++;
repoMap[lineindex] = itr->toString();
QString num = QString::number(lineindex);
importHtml += QString::fromStdString("<tr><td>")+num+"</td><td>"+itr->toString()+"</td></tr";

importHtml += "</table>";
QString p_str = "";
bool open = false;
Expand Down Expand Up @@ -12782,13 +12786,19 @@ void MainWindow::on_actionFullScreen_triggered(bool viewMode)
ui->menuBar->setVisible(false);
ui->mainToolBar->setVisible(false);
if(viewMode == false)ui->pushButton_8->setVisible(true);
ui->textEdit_dict->setVisible(false);
ui->lineEdit_4->setVisible(false);
ui->tabWidget->setVisible(false);
}

void MainWindow::on_pushButton_8_clicked()
{
ui->menuBar->setVisible(true);
ui->mainToolBar->setVisible(true);
ui->pushButton_8->setVisible(false);
ui->textEdit_dict->setVisible(true);
ui->lineEdit_4->setVisible(true);
ui->tabWidget->setVisible(true);
}

/*!
Expand Down Expand Up @@ -12940,9 +12950,7 @@ void MainWindow::on_actionComment_triggered()
comment->exec();

QString str = comment->getComment();

if(str == "") return;

writeCommentLogs(text,str);
sendComment(str);
}
Expand Down Expand Up @@ -13363,8 +13371,6 @@ void MainWindow::on_actionNormal_Text_triggered()
*/
void MainWindow::sendComment(QString str)
{
QThread* workerThread = new QThread();
QObject::connect(workerThread, &QThread::started, [=](){
QString comment_mail = "";
QString app_password = "";

Expand Down Expand Up @@ -13403,7 +13409,6 @@ void MainWindow::sendComment(QString str)
} else {
qDebug() << "Error:" << reply->errorString();
QMessageBox::critical(this, "Error", reply->errorString());
workerThread->quit();
return;
}
reply->deleteLater();
Expand Down Expand Up @@ -13543,11 +13548,6 @@ void MainWindow::sendComment(QString str)
if(!sender.sendMail(message))
qDebug()<<"Not sent";
else qDebug()<<"Sent";
});

QObject::connect(workerThread, &QThread::finished, workerThread, &QThread::deleteLater);

workerThread->start();
}

/*!
Expand Down Expand Up @@ -16536,3 +16536,16 @@ QString MainWindow::decrypt(QByteArray encrypted_arr){

return decodedString;
}

/*!
* \brief Fit To Width Button to fit the image width in graphicView for better visibility
*/
void MainWindow::on_fit_to_width_clicked()
{
if (ui->graphicsView && ui->graphicsView->scene())
{
QRectF rect = ui->graphicsView->scene()->itemsBoundingRect();
ui->graphicsView->fitInView(rect, Qt::KeepAspectRatioByExpanding);
}
}

2 changes: 2 additions & 0 deletions FrameWorkCode/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,8 @@ private slots:

QString decrypt(QByteArray encrypted_arr);

void on_fit_to_width_clicked();

public slots:
void on_actionLoad_Next_Page_triggered();

Expand Down
Loading

0 comments on commit c67a745

Please sign in to comment.