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

   Copyright (C) 2011 Lukas Appelhans

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

#include <QtCore/QObject>
#include <akabeiclient_global.h>
#include <akabeicore_global.h>
#include "apm.h"
#include <akabeierror.h>

Lisa's avatar
Lisa committed
20 21 22
namespace AkabeiClient
{
class TransactionQuestion;
23 24
}

25 26
class QueueOperation : public QObject
{
Lisa's avatar
Lisa committed
27
    Q_OBJECT
28
public:
29
    QueueOperation(APM::OperationName operation, QHash<APM::OptionName, AkabeiOption> options, QObject * parent = 0);
30
    virtual ~QueueOperation();
Lisa's avatar
Lisa committed
31

32
    void start(AkabeiClient::PackageAction action, QList<Akabei::Package*> packages);
Lisa's avatar
Lisa committed
33

34
private slots:
35
    void validationFinished(bool valid, QList<AkabeiClient::TransactionQuestion*> questions);
36
    void showProgress();
37 38 39
    void errors(QList<Akabei::Error*>& errors);
    void transactionMessage(const QString &message);
    void transationFinished();
Lisa's avatar
Lisa committed
40 41
    void packageProgressChanged(Akabei::Package*, int);

42 43 44 45 46 47
signals:
    void finished();

private:
    AkabeiClient::PackageAction m_action;
    Akabei::ProcessingOptions m_processingOptions;
48 49
    APM::OperationName m_operation;
    QHash<APM::OptionName, AkabeiOption> m_options;
50
    QHash<Akabei::Package*, int> m_progresses;
51 52 53
};

#endif // QUEUEOPERATION_H