summaryrefslogtreecommitdiffstats
path: root/src/common/global/progress_monitor.h
blob: 03628f7b6dfb8388238a8f8b68d3345eede3aea0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/***************************************************************************
 *   Copyright (C) 2007 Nicolas Hadacek <hadacek@kde.org>                  *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/
#ifndef PROGRESS_MONITOR_H
#define PROGRESS_MONITOR_H

#include "global.h"

class ProgressMonitor : public TQObject
{
Q_OBJECT
  TQ_OBJECT
public:
  ProgressMonitor(TQObject *parent = 0);
  void clear();
  void appendTask(const TQString &label, uint nbSteps);
  void insertTask(const TQString &label, uint nbSteps);
  void startNextTask();
  void addTaskProgress(uint nbSteps);
  uint nbSteps() const;
  uint nbDoneSteps() const;

public slots:
  void update();

signals:
  void showProgress(bool show);
  void setLabel(const TQString &label);
  void setTotalProgress(uint nbSteps);
  void setProgress(uint nbSteps);

private:
  class Task {
  public:
    TQString label;
    uint nbSteps, nbDoneSteps;
  };
  TQValueList<Task> _tasks;
  TQValueList<Task>::iterator _current;
};

#endif