1-goldbach/{v3.0 → v3.1}/GoldbachModel.h RENAMED
@@ -1,39 +1,40 @@
1
  #ifndef GOLDBACHMODEL_H
2
  #define GOLDBACHMODEL_H
3
 
4
  #include <QAbstractListModel>
5
  #include <QVector>
6
 
7
  class GoldbachWorker;
8
 
9
  class GoldbachModel : public QAbstractListModel
10
  {
11
  Q_OBJECT
12
  Q_DISABLE_COPY(GoldbachModel)
13
 
14
  protected:
15
  GoldbachWorker* worker = nullptr;
16
  QVector<QString> results;
17
  int fetchedRowCount = 0;
18
 
19
  public:
20
  explicit GoldbachModel(QObject *parent = nullptr);
21
  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
22
  virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
23
 
24
  void calculate(long long number);
 
25
 
26
  protected:
27
  bool canFetchMore(const QModelIndex &parent) const override;
28
  void fetchMore(const QModelIndex &parent) override;
29
 
30
  signals:
31
  void calculationDone(long long sumCount);
 
32
 
33
  private slots:
34
- void workerSumFound(const QString& sum);
35
  void workerDone(long long sumCount);
36
- // void updateProgressBar(int percent);
37
  };
38
 
39
  #endif // GOLDBACHMODEL_H
1
  #ifndef GOLDBACHMODEL_H
2
  #define GOLDBACHMODEL_H
3
 
4
  #include <QAbstractListModel>
5
  #include <QVector>
6
 
7
  class GoldbachWorker;
8
 
9
  class GoldbachModel : public QAbstractListModel
10
  {
11
  Q_OBJECT
12
  Q_DISABLE_COPY(GoldbachModel)
13
 
14
  protected:
15
  GoldbachWorker* worker = nullptr;
16
  QVector<QString> results;
17
  int fetchedRowCount = 0;
18
 
19
  public:
20
  explicit GoldbachModel(QObject *parent = nullptr);
21
  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const override;
22
  virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
23
 
24
  void calculate(long long number);
25
+ void stop();
26
 
27
  protected:
28
  bool canFetchMore(const QModelIndex &parent) const override;
29
  void fetchMore(const QModelIndex &parent) override;
30
 
31
  signals:
32
  void calculationDone(long long sumCount);
33
+ void progressUpdated(int percent) const;
34
 
35
  private slots:
 
36
  void workerDone(long long sumCount);
37
+ void updateProgress(int percent);
38
  };
39
 
40
  #endif // GOLDBACHMODEL_H