summaryrefslogtreecommitdiffstats
path: root/buildtools/autotools/autolistviewitems.h
blob: 0dece2a2fd193b78b7ba24e98d6a8e16db800bae (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                             *
*   [email protected]                                                    *
*                                                                         *
*   Copyright (C) 2002 by Victor R�der                                    *
*   [email protected]                                                  *
*                                                                         *
*   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 <qptrlist.h>

#include <qlistview.h>

class TargetItem;
class FileItem;
class AutoProjectPart;

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

	ProjectItem( Type type, QListView *parent, const QString &text );
	ProjectItem( Type type, ProjectItem *parent, const QString &text );

	void paintCell( QPainter *p, const QColorGroup &cg,
	                int column, int width, int alignment );
	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( QListView *parent, const QString &text );
	SubprojectItem( SubprojectItem *parent, const QString &text );

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

	QString 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( QListView *lv, bool group, const QString &text );

	// Target kind - not used currently
	//TargetKind kind;
	//! Name of target, e.g. foo
	QString 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
	QString primary;
	//! May be bin, pkglib, noinst, check, sbin, pkgdata, java...
	QString prefix;
	//! Content of foo_SOURCES (or java_JAVA) assignment
	QPtrList<FileItem> sources;
	//! Content of foo_LDFLAGS assignment
	QString ldflags;
	//! Content of foo_LDADD assignment
	QString ldadd;
	//! Content of foo_LIBADD assignment
	QString libadd;
	//! Content of foo_DEPENDENCIES assignment
	QString dependencies;
};


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

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

	QString name;
	QString uiFileLink;
	const bool is_subst;
};

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