completed requests to ofd.ru
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "outputdialog.h"
|
||||
#include "adjustpicturedialog.h"
|
||||
#include "settingsdialog.h"
|
||||
#include "solvecaptchadialog.h"
|
||||
#include <iostream>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
@@ -46,15 +47,42 @@ void MainWindow::setupStoresList() {
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string MainWindow::makeRequestToOfd(std::string captcha) {
|
||||
std::string checkContent = Net().fetch_check_data_from_ofdru(
|
||||
ui->fn_edit->text().toStdString(),
|
||||
ui->fd_edit->text().toStdString(),
|
||||
ui->fi_edit->text().toStdString(),
|
||||
ui->dateTimeEdit->dateTime().toString(Qt::ISODate).toStdString(),
|
||||
ui->fundIncomeCombo->currentIndex() + 1,
|
||||
// In the request to ofd.ru, total is in a strange format, like a string of a format where 2 last digits represent decimal part of a number.
|
||||
ui->total_edit->text().toDouble() * 100,
|
||||
captcha);
|
||||
|
||||
return checkContent
|
||||
}
|
||||
|
||||
void MainWindow::receiveSolvedCaptcha(std::string captcha) {
|
||||
|
||||
std::string check_content = makeRequestToOfd(captcha);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::on_parseButton_clicked() {
|
||||
QString s;
|
||||
switch (ui->checkType->currentIndex()) {
|
||||
switch (ui->tabWidget->currentIndex()) {
|
||||
case 0:
|
||||
s = ui->checkContent->toPlainText();
|
||||
break;
|
||||
case 1:
|
||||
s = ui->checkContentFromImage->toPlainText();
|
||||
break;
|
||||
case 2:
|
||||
Net().get_captcha_from_ofdru();
|
||||
SolveCaptchaDialog dialog = SolveCaptchaDialog(this);
|
||||
connect(&dialog, &SolveCaptchaDialog::solvedCaptcha, this, &MainWindow::receiveSolvedCaptcha);
|
||||
dialog.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
std::wstring check_plaintext = s.toStdWString();
|
||||
@@ -118,6 +146,12 @@ void MainWindow::onDecodedData(std::string data) {
|
||||
QDateTime datetime = QDateTime::fromString(extractedDateTime, "yyyyMMddThhmm");
|
||||
ui->dateTimeEdit->setDateTime(datetime);
|
||||
|
||||
int type = std::stoi(split(dataSplit[5], "=")[1]);
|
||||
ui->fundIncomeCombo->setCurrentIndex(type - 1);
|
||||
|
||||
std::string total = split(dataSplit[1], "=")[1];
|
||||
|
||||
ui->total_edit->setText(QString::fromStdString(total));
|
||||
}
|
||||
|
||||
void MainWindow::on_chooseImageButton_ocr_clicked()
|
||||
|
||||
Reference in New Issue
Block a user