summaryrefslogtreecommitdiffstats
path: root/buildtools/custommakefiles/customprojectpart.h
blob: 7f4775ad4d92f1b06fe01c9e0292793f60200cb8 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/***************************************************************************
 *   Copyright (C) 2001-2002 by Bernd Gehrmann                             *
 *   bernd@kdevelop.org                                                    *
 *   Copyright (C) 2007 by Andreas Pakulat                                 *
 *   apaku@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 _CUSTOMPROJECTPART_H_
#define _CUSTOMPROJECTPART_H_

#include <tqdict.h>
#include <tqguardedptr.h>
#include <tqmap.h>
#include <tqdatetime.h>
#include <tqvaluestack.h>

#include <kdevbuildtool.h>

class TQListViewItem;
class TQPopupMenu;
class TQStringList;
class KDialogBase;
class CustomProjectWidget;
class Context;
class KSelectAction;

class CustomProjectPart : public KDevBuildTool
{
    Q_OBJECT
  TQ_OBJECT

public:
    CustomProjectPart( TQObject *tqparent, const char *name, const TQStringList & );
    ~CustomProjectPart();

    TQStringList allMakeEnvironments() const;
    TQString currentMakeEnvironment() const;

    bool isDirty();
    TQStringList distFiles() const;

    virtual void openProject( const TQString &dirName, const TQString &projectName );
    virtual void closeProject();

    virtual TQString projectDirectory() const;
    virtual TQString projectName() const;
    virtual TQString mainProgram() const;
    virtual TQString activeDirectory() const;
    virtual TQStringList allFiles() const;
    virtual void addFile( const TQString &fileName );
    virtual void addFiles( const TQStringList& fileList );
    virtual void removeFile( const TQString &fileName );
    virtual void removeFiles( const TQStringList &fileList );
    virtual TQString buildDirectory() const;
    virtual TQString runDirectory() const;
    virtual TQString debugArguments() const;
    virtual TQString runArguments() const;
    virtual DomUtil::PairList runEnvironmentVars() const;
    TQString relativeToProject( const TQString& ) const;


private slots:
    void populateProject();
    void projectConfigWidget( KDialogBase *dlg );
    void contextMenu( TQPopupMenu *popup, const Context *context );
    void slotAddToProject();
    void slotRemoveFromProject();
    void slotAddToProjectRecursive();
    void slotRemoveFromProjectRecursive();
    void addNewFilesToProject( const TQStringList& );
    void slotChangeBlacklist();
    void slotChooseActiveDirectory();
    void slotBuild();
    void slotBuildActiveDir();
    void slotCompileFile();
    void slotInstall();
    void slotInstallActiveDir();
    void slotInstallWithKdesu();
    void slotClean();
    void slotExecute();
    void updateTargetMenu();
    void targetMenuActivated( int id );
    void targetObjectFilesMenuActivated( int id );
    void targetOtherFilesMenuActivated( int id );
    void updateMakeEnvironmentsMenu();
    void makeEnvironmentsMenuActivated( int id );
    void slotCommandFinished( const TQString& command );
    void slotCommandFailed( const TQString& command );

private:
    bool containsNonProjectFiles( const TQString& url );
    TQStringList projectFilesInDir( const TQString& dir );
    bool containsProjectFiles( const TQString& url );
    bool isProjectFileType( const TQString& absFile ) const;
    bool isInBlacklist( const TQString& ) const;
    void cleanFileList();
    void setFiletypes( const TQStringList& );
    void findNewFiles( const TQString& dir, TQStringList& list) const;

    TQStringList filetypes() const;
    TQStringList blacklist() const;
    void updateBlacklist( const TQStringList& );
    void saveProject();
    void startMakeCommand( const TQString &dir, const TQString &target, bool withKdesu = false );
    void parseMakefile( const TQString& file );
    TQString makeEnvironment() const;
    void putEnvVarsInVarMap();
    void switchBlacklistEntry(const TQString& );

    bool isInProject( const TQString& fileName ) const;
    void addToProject( const TQString& fileName );
    void removeFromProject( const TQString& fileName );

    /**
     * @brief Set of all the project's files.
     *
     * @bug
     * Due to deficiency in QT3,
     * we have to use a map with next-to-useless element value,
     * keyed by the file name,
     * as a set-container replacement.
     */
    typedef TQMap<TQString, bool> ProjectFilesSet;

    TQString m_projectDirectory;
    TQString m_projectName;
    TQString m_filelistDir;
    /** All the sources (files and directories) of this project. */
    ProjectFilesSet m_sourceFilesSet;
    TQPopupMenu *m_targetMenu;
    TQPopupMenu *m_targetObjectFilesMenu;
    TQPopupMenu *m_targetOtherFilesMenu;
    KSelectAction *m_makeEnvironmentsSelector;
    TQStringList m_targets;
    TQStringList m_targetsObjectFiles;
    TQStringList m_targetsOtherFiles;
    TQStringList m_contextAddFiles;
    TQStringList m_contextRemoveFiles;
    TQString m_contextDirName;

    TQMap<TQString, TQDateTime> m_timestamp;
    bool m_executeAfterBuild;
    TQString m_buildCommand;
    bool m_lastCompilationFailed;
    TQMap<TQString, int> m_parsedMakefiles;
    TQValueStack<TQString> m_makefilesToParse;
    TQMap<TQString, TQString> m_makefileVars;
    bool m_recursive;
    bool m_first_recursive;
};

#endif
// kate: space-indent on; indent-width 4; tab-width 4; replace-tabs on