summaryrefslogtreecommitdiffstats
path: root/buildtools/autotools/autolistviewitems.h
blob: 116d316c7577b72b01b210ee8dbcf07faf864990 (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
/***************************************************************************
*   Copyright (C) 2001-2002 by Bernd Gehrmann                             *
*   bernd@kdevelop.org                                                    *
*                                                                         *
*   Copyright (C) 2002 by Victor Röder                                    *
*   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 AUTOLISTVIEWITEMS_H
#define AUTOLISTVIEWITEMS_H

#include <tqptrlist.h>

#include <tqlistview.h>

class TargetItem;
class FileItem;
class AutoProjectPart;

/**
* Base class for all items appearing in ProjectOverview and ProjectDetails.
*/
class ProjectItem : public TQListViewItem
{
public:
	enum Type { Subproject, Target, File };

	ProjectItem( Type type, TQListView *parent, const TQString &text );
	ProjectItem( Type type, ProjectItem *parent, const TQString &text );

	void paintCell( TQPainter *p, const TQColorGroup &cg,
	                int column, int width, int tqalignment );
	void setBold( bool b )
	{
		bld = b;
	}
	bool isBold() const
	{
		return bld;
	}
	Type type()
	{
		return typ;
	}

private:
	Type typ;
	bool bld;

};


/**
* Stores the content of one Makefile.am
*/
class SubprojectItem : public ProjectItem
{
public:
	SubprojectItem( TQListView *parent, const TQString &text );
	SubprojectItem( SubprojectItem *parent, const TQString &text );

	/** name of the directory */
	TQString subdir;
	/** absolute path */
	TQString path;
	/** mapping from prefix to path */
	TQMap<TQString, TQString> prefixes;
	/** mapping from variable name to value */
	TQMap<TQString, TQString> variables;
	/** list of targets */
	TQPtrList<TargetItem> targets;

	TQString relativePath();

private:
	void init();
};


/**
* Stores one target
* For e.g. the line
*    bin_LTLIBRARIES = foo.la
* generates a target with name 'foo.la', primary LTLIBRARIES and prefix 'bin'
* In order to make things not too simple ;-) headers and data are handled
* a bit different from programs, libraries and scripts: All headers for a
* certain prefix (analogously for data) are put in _one_ TargetItem object,
* and the names of the files are put in the sources variable. This avoids
* cluttering the list view with lots of header items.
*/
class TargetItem : public ProjectItem
{
public:
	//enum TargetKind { Program, Library, DataGroup, IconGroup, DocGroup };

	TargetItem( TQListView *lv, bool group, const TQString &text );

	// Target kind - not used currently
	//TargetKind kind;
	//! Name of target, e.g. foo
	TQString name;
	//! One of PROGRAMS, LIBRARIES, LTLIBRARIES, SCRIPTS, HEADERS, DATA, JAVA
	//! In addition to these automake primaries, we use KDEICON and KDEDOCS
	//! for am_edit magic
	TQString primary;
	//! May be bin, pkglib, noinst, check, sbin, pkgdata, java...
	TQString prefix;
	//! Content of foo_SOURCES (or java_JAVA) assignment
	TQPtrList<FileItem> sources;
	//! Content of foo_LDFLAGS assignment
	TQString ldflags;
	//! Content of foo_LDADD assignment
	TQString ldadd;
	//! Content of foo_LIBADD assignment
	TQString libadd;
	//! Content of foo_DEPENDENCIES assignment
	TQString dependencies;
};


// Not sure if this complexity is really necessary...
class FileItem : public ProjectItem
{

public:
	FileItem( TQListView *lv, const TQString &text, bool set_is_subst = false );
	void changeSubstitution();
	void changeMakefileEntry( const TQString& );

	TQString name;
	TQString uiFileLink;
	const bool is_subst;
};

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