summaryrefslogtreecommitdiffstats
path: root/buildtools/autotools/autoprojectpart.h
blob: 16be5886aba1c9e36f2999497b14898f8fc8b63d (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
/***************************************************************************
*   Copyright (C) 2001-2002 by Bernd Gehrmann                             *
*   bernd@kdevelop.org                                                    *
*                                                                         *
*   Copyright (C) 2002 by Victor R�er                                    *
*   victor_roeder@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 _AUTOPROJECTPART_H_
#define _AUTOPROJECTPART_H_

#include <tqdict.h>
#include <tqguardedptr.h>
#include <tqmap.h>
#include <tqdatetime.h>
#include <tqdir.h>
#include <kdevgenericfactory.h>
#include "kdevbuildtool.h"

class TQDomElement;
class TQStringList;
class KDialogBase;
class AutoProjectWidget;
class KSelectAction;
class TargetItem;
class ConfigWidgetProxy;

class AutoProjectPart : public KDevBuildTool
{
	Q_OBJECT
  TQ_OBJECT

public:
	AutoProjectPart( TQObject *tqparent, const char *name, const TQStringList &args );
	virtual ~AutoProjectPart();

	/**
	 * Implementation of the KDevProject interface.
	 */
	virtual TQString projectDirectory() const;
	virtual TQString projectName() const;
	virtual DomUtil::PairList runEnvironmentVars() const;
	virtual TQString runDirectory() const;
	virtual TQString mainProgram() const;
	virtual TQString debugArguments() const;
	virtual TQString runArguments() const;
	virtual TQString environString() 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 Options options() const;

	/**
	 * Implementation of the KDevPlugin interface.
	 */
	virtual void restorePartialProjectSession ( const TQDomElement* el );
	virtual void savePartialProjectSession ( TQDomElement* el );

	/**
	 * automake specific methods.
	 */
	TQStringList allBuildConfigs() const;
	TQString currentBuildConfig() const;
	TQString topsourceDirectory() const;
	void startMakeCommand( const TQString &dir, const TQString &target, bool withKdesu = false );
	void startSimpleMakeCommand( const TQString &dir, const TQString &command, bool withKdesu = false );
	void buildTarget( TQString relpath, TargetItem* titem );
	void executeTarget( const TQDir& dir, const TargetItem* titem );

	void needMakefileCvs();
	bool isDirty();
	bool isKDE() const;
	TQStringList distFiles() const;
	TQString getAutoConfFile(const TQString& dir);

protected:
	/**
	 * Reimplemented from KDevProject. These methods are only
	 * for use by the application core.
	 */
	virtual void openProject( const TQString &dirName, const TQString &projectName );
	virtual void closeProject();

private slots:
	//    void projectConfigWidget(KDialogBase *dlg);
	void slotAddTranslation();
	void slotBuild();
	void slotBuildActiveTarget();
	void slotCompileFile();
	void slotClean();
	void slotDistClean();
	void slotInstall();
	void slotInstallWithKdesu();
	void slotMakefilecvs();
	void slotMakeMessages();
	void slotConfigure();
	void slotExecute();
	void slotExecute2();
	void slotExecuteTargetAfterBuild( const TQString& command );
	void slotNotExecuteTargetAfterBuildFailed( const TQString& command );
	void slotBuildConfigChanged( const TQString &config );
	void slotBuildConfigAboutToShow();
	void slotCommandFinished( const TQString& command );
	void slotCommandFailed( const TQString& command );
	//void slotImportExisting();
	void insertConfigWidget( const KDialogBase* dlg, TQWidget * page, unsigned int );


private:
	TQGuardedPtr<AutoProjectWidget> m_widget;
	TQString m_projectName;
	TQString m_projectPath;
	KSelectAction *buildConfigAction;

	TQString makeEnvironment() const;
	void setWantautotools();
	TQString makefileCvsCommand() const;
	TQString configureCommand() const;

	TQMap<TQString, TQDateTime> m_timestamp;
	bool m_executeAfterBuild;
	TQString m_buildCommand;
	bool m_needMakefileCvs;
	bool m_lastCompilationFailed;
	bool m_isKDE;
	TQPair<TQDir, TargetItem*> m_executeTargetAfterBuild;
	TQString m_runProg;

	ConfigWidgetProxy * _configProxy;

	// Enble AutoProjectWidget to emit our signals
	friend class AutoProjectWidget;
	friend class AddSubprojectDialog;
	friend class FileItem;

	// For make commands queuing
	TQString constructMakeCommandLine( const TQString &dir, const TQString &target ) const;
	bool queueInternalLibDependenciesBuild( TargetItem* titem, TQStringList& list );
};

typedef KDevGenericFactory<AutoProjectPart> AutoProjectFactory;

#endif
// kate: indent-mode csands; tab-width 4;