#include <QObject>#include <memory>#include "def.h"#include "filemanager.h"#include "mainwindow.h"class Presenter : public QObject{ Q_OBJECTpublic: explicit Presenter(QObject *parent = nullptr); ~Presenter();signals: void Start();public slots: void StartWork(); void StartChecking(const QPair<QString, QString>&, QList<CheckInfo>&);private: MainWindow * window; std::unique_ptr<FileManager> m_file;};
Presenter::Presenter(QObject *parent) : QObject(parent){ window = new MainWindow; QObject::connect(window, &MainWindow::Ready, this, &Presenter::Start); QObject::connect(this, &Presenter::Start, this, &Presenter::StartWork); window->show();}Presenter::~Presenter(){}void Presenter::StartWork(){ QList<QPair<QString, QString>> m_userInfo; // Логины и пароли QList<CheckInfo> m_listInfo; // Запись парсинга m_file.reset(new FileManager); m_file->GetListAcc(m_userInfo); for(int i = 0; i < m_userInfo.length(); i++) { StartChecking(m_userInfo.at(i), m_listInfo); }}
void MainWindow::on_pushButton_clicked(){ double betMoney = 0.0; ....... emit Ready();}