progressbar.h 1.27 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* This file is part of the Chakra project

   Copyright (C) 2012 Lukas Appelhans <l.appelhans@gmx.de>

   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 PROGRESSBAR_H
#define PROGRESSBAR_H

#include <QFlags>
#include <QString>
#include <QMap>
#include <QTime>
Luca Giambonini's avatar
Luca Giambonini committed
18
#include <QObject>
19 20 21 22 23 24 25 26 27 28

class ProgressBar
{
public:
    enum Column {
        Status = 0x01,
        Details = 0x02,
        Progress = 0x04,
        Eta = 0x08
    };
Luca Giambonini's avatar
Luca Giambonini committed
29
    Q_DECLARE_FLAGS(Columns, Column)
30 31 32 33 34 35 36 37 38
    ProgressBar();
    virtual ~ProgressBar();

    void setColumns(Columns columns);
    void setStatus(const QString &status);
    void setDetails(const QMap<QString, QString> &details);
    void setProgressDescription(const QString &desc);
    void setProgress(int percentage);
    void setEta(const QTime &eta);
39
    QString replaceMessage(const QString &message);
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

    QString line();

private:
    Columns m_columns;
    QString m_status;
    QMap<QString, QString> m_details;
    QString m_desc;
    int m_percentage;
    QTime m_eta;
};

Q_DECLARE_OPERATORS_FOR_FLAGS(ProgressBar::Columns)

#endif // PROGRESSBAR_H