1 /**************************************************************************
2 ** This file is part of LiteIDE
3 **
4 ** Copyright (c) 2011-2019 LiteIDE. All rights reserved.
5 **
6 ** This library is free software; you can redistribute it and/or
7 ** modify it under the terms of the GNU Lesser General Public
8 ** License as published by the Free Software Foundation; either
9 ** version 2.1 of the License, or (at your option) any later version.
10 **
11 ** This library is distributed in the hope that it will be useful,
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 ** Lesser General Public License for more details.
15 **
16 ** In addition, as a special exception,  that plugins developed for LiteIDE,
17 ** are allowed to remain closed sourced and can be distributed under any license .
18 ** These rights are included in the file LGPL_EXCEPTION.txt in this package.
19 **
20 **************************************************************************/
21 // Module: build.h
22 // Creator: visualfc <visualfc@gmail.com>
23 
24 #ifndef BUILD_H
25 #define BUILD_H
26 
27 #include "litebuildapi/litebuildapi.h"
28 #include <QProcessEnvironment>
29 
30 using namespace LiteApi;
31 class Build : public LiteApi::IBuild
32 {
33     Q_OBJECT
34 public:
35     Build(QObject *parent = 0);
36     virtual ~Build();
37     virtual QString mimeType() const;
38     virtual QString id() const;
39     virtual QString work() const;
40     virtual QString lock() const;
41     virtual QList<BuildAction*> actionList() const;
42     virtual QList<BuildLookup*> lookupList() const;
43     virtual QList<BuildConfig*> configList() const;
44     virtual QList<BuildCustom*> customList() const;
45     virtual QList<BuildTarget*>  targetList() const;
46     virtual BuildAction *findAction(const QString &id);
47     virtual QList<QAction*> actions();
48 protected:
49     void make();
50     QAction *makeAction(BuildAction *ba);
51 protected slots:
52     void slotBuildAction();
53 public:
54     void setType(const QString &mimeType);
55     void setId(const QString &id);
56     void setWork(const QString &work);
57     void setLock(const QString &lock);
58     void appendAction(BuildAction *act);
59     void appendLookup(BuildLookup *lookup);
60     void appendConfig(BuildConfig *config);
61     void appendCustom(BuildCustom *custom);
62     void appendDebug(BuildTarget *debug);
63 public:
64     static bool loadBuild(LiteApi::IBuildManager *manager, const QString &fileName);
65     static bool loadBuild(LiteApi::IBuildManager *manager, QIODevice *dev, const QString &fileName);
66 protected:
67     QString m_mimeType;
68     QString m_id;
69     QString m_lock;
70     QString m_work;
71     QMap<QString,QMenu*> m_idMenuMap;
72     QList<QAction*> m_actions;
73     QList<BuildAction*> m_actionList;
74     QList<BuildLookup*> m_lookupList;
75     QList<BuildConfig*> m_configList;
76     QList<BuildCustom*> m_customList;
77     QList<BuildTarget*> m_targetList;
78     QMap<BuildAction*,QString> m_actionCmdMap;
79     QMap<BuildAction*,QString> m_actionArgMap;
80 };
81 
82 #endif // BUILD_H
83