#include "solvecaptchadialog.h" #include "ui_solvecaptchadialog.h" #include "utils/utils.h" #include #include SolveCaptchaDialog::SolveCaptchaDialog(QWidget *parent, std::string* solved_captcha) : QDialog(parent), ui(new Ui::SolveCaptchaDialog), solved_captcha(solved_captcha) { ui->setupUi(this); QString captcha_path = QString::fromStdString(get_path_relative_to_home(".local/share/checks_parser/captcha.jpg")); std::cout << captcha_path.toStdString() << std::endl; ui->captcha_picture->setPixmap(captcha_path); ui->captcha_picture->setScaledContents(true); } void SolveCaptchaDialog::accept() { std::string userInput = ui->captcha_edit->text().toStdString(); if (userInput.length() < 6) { QMessageBox infoDialog; infoDialog.setText(tr("Please, enter a valid captcha")); infoDialog.setIcon(QMessageBox::Warning); infoDialog.setWindowTitle(tr("No captcha")); infoDialog.exec(); } else { solved_captcha->erase(); solved_captcha->append(userInput); QDialog::accept(); } } SolveCaptchaDialog::~SolveCaptchaDialog() { delete ui; }