apm.h 2.24 KB
Newer Older
Lukas Appelhans's avatar
Lukas Appelhans committed
1 2 3 4 5 6 7 8 9 10 11 12
/* This file is part of the Chakra project

   Copyright (C) 2011 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 APM_H
#define APM_H

13 14
#include <akabeibackend.h>

Lukas Appelhans's avatar
Lukas Appelhans committed
15
#include <QtCore/QObject>
16
#include <QStringList>
Lukas Appelhans's avatar
Lukas Appelhans committed
17 18 19 20 21 22 23

class APM : public QObject
{
Q_OBJECT
public:
    enum OperationType {
        NoType = 0,
Lukas Appelhans's avatar
Lukas Appelhans committed
24 25 26 27 28
        DatabaseOperationType = 1,
        QueryOperationType = 2,
        RemoveOperationType = 3,
        SyncOperationType = 4,
        UpgradeOperationType = 5
Lukas Appelhans's avatar
Lukas Appelhans committed
29 30 31
    };
    enum Operation {
        NoOperation = 0,
32 33 34 35
        ///Query operations
        ShowChangelog,
        ShowInstalledAsDeps,
        ShowInstalledExplicitely,
36 37
        ShowPackagesOfGroup, //Also in Sync
        ShowInformation, //Also in Sync
38 39 40 41 42 43 44 45 46
        CheckFiles,
        ShowLocal,
        ShowOwner,
        QueryPackageFile,
        SearchLocal,
        ShowNotRequired,
        ShowUpgradeable,
        ShowLess,
        ///Sync operations
Lisa's avatar
Lisa committed
47
        Install,
48 49
        AsDeps,//Also in upgrade
        AsExplicit,//Also in upgrade
50 51
        RemoveOldPackages,
        RemoveAllPackages,
52 53
        SkipDependencyCheck,//Also in Remove/Upgrade
        Force,//Also in upgrade
54 55 56 57 58 59
        ListRepo,
        Search,
        DownloadOnly,
        OnlyNeeded,
        Ignore,
        IgnoreGroup,
60
        UpdateDatabases,
61 62
        UpdateSystem,
        ///Remove operations
Lisa's avatar
Lisa committed
63
        Remove,
64
        Cascade,
65
        DatabaseOnly,//Also in upgrade
66 67
        RemoveConfig,
        Recursive,
Lukas Appelhans's avatar
Lukas Appelhans committed
68
        Unneeded,
69
        ///Upgrade operation makes only use of operations specified above
Lukas Appelhans's avatar
Lukas Appelhans committed
70 71 72 73
        ///Random
        RootDir,
        CacheDir,
        DBPath
Lukas Appelhans's avatar
Lukas Appelhans committed
74
    };
75
    explicit APM(OperationType type, QList<Operation> operations, QMultiHash<Operation, QString> options, QStringList args, QObject* parent = 0);
Lukas Appelhans's avatar
Lukas Appelhans committed
76 77
    virtual ~APM();
    
78 79 80 81
private slots:
    void statusChanged(Akabei::Backend::Status);
    void start();
    
82 83 84
private:
    OperationType m_operationType;
    QList<Operation> m_operations;
85
    QMultiHash<Operation, QString> m_options;
86
    QStringList m_args;
Lukas Appelhans's avatar
Lukas Appelhans committed
87 88 89
};

#endif //APM:H