~ubuntu-branches/debian/sid/kdevelop/sid

« back to all changes in this revision

Viewing changes to buildtools/autotools/autoprojectwidget.h

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Lainé
  • Date: 2006-05-23 18:39:42 UTC
  • Revision ID: james.westby@ubuntu.com-20060523183942-hucifbvh68k2bwz7
Tags: upstream-3.3.2
Import upstream version 3.3.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  KDevelop Autotools Support
 
3
  Copyright (c) 2001-2002 by Bernd Gehrmann <bernd@kdevelop.org>
 
4
  Copyright (c) 2002 by Victor Roeder <victor_roeder@gmx.de>
 
5
  Copyright (c) 2005 by Matt Rogers <mattr@kde.org>
 
6
 
 
7
***************************************************************************
 
8
*                                                                         *
 
9
*   This program is free software; you can redistribute it and/or modify  *
 
10
*   it under the terms of the GNU General Public License as published by  *
 
11
*   the Free Software Foundation; either version 2 of the License, or     *
 
12
*   (at your option) any later version.                                   *
 
13
*                                                                         *
 
14
***************************************************************************
 
15
*/
 
16
 
 
17
#ifndef _AUTOPROJECTWIDGET_H_
 
18
#define _AUTOPROJECTWIDGET_H_
 
19
 
 
20
#include <qdict.h>
 
21
#include <qlistview.h>
 
22
#include <qmap.h>
 
23
#include <qvbox.h>
 
24
#include <qhbox.h>
 
25
#include <qlayout.h>
 
26
#include <qtoolbutton.h>
 
27
#include <kiconloader.h>
 
28
#include <klocale.h>
 
29
 
 
30
#include "domutil.h"
 
31
#include "makefilehandler.h"
 
32
 
 
33
class AutoProjectPart;
 
34
class AutoSubprojectView;
 
35
class AutoDetailsView;
 
36
class SubprojectItem;
 
37
class TargetItem;
 
38
class FileItem;
 
39
class KAction;
 
40
class QDomElement;
 
41
class QToolButton;
 
42
class QStringList;
 
43
class QFocusEvent;
 
44
class KListViewItem;
 
45
class QListViewItem;
 
46
class MakefileHandler;
 
47
 
 
48
class AutoProjectWidget : public QVBox
 
49
{
 
50
        Q_OBJECT
 
51
        friend class RemoveFileDialog;
 
52
        friend class TargetOptionsDialog;  // to access projectDom() via m_part->projectDom()
 
53
public:
 
54
        AutoProjectWidget( AutoProjectPart *part, bool kde );
 
55
        ~AutoProjectWidget();
 
56
 
 
57
        void openProject( const QString &dirName );
 
58
        void closeProject();
 
59
 
 
60
        /**
 
61
        * A list of the (relative) names of all subprojects (== subdirectories)
 
62
        */
 
63
        QStringList allSubprojects();
 
64
        /**
 
65
         * A list of all Subproject items in the overview KListView
 
66
         */
 
67
        QPtrList <SubprojectItem> allSubprojectItems();
 
68
        /**
 
69
        * A list of the (relative) names of all libraries
 
70
        */
 
71
        QStringList allLibraries();
 
72
        /**
 
73
        * A list of all files that belong to the project
 
74
        **/
 
75
        QStringList allFiles();
 
76
        /**
 
77
        * The top level directory of the project.
 
78
        **/
 
79
        QString projectDirectory() const;
 
80
        /**
 
81
        * The directory of the currently shown subproject.
 
82
        */
 
83
        QString subprojectDirectory();
 
84
        /**
 
85
        * Are we in KDE mode?
 
86
        */
 
87
        bool kdeMode() const
 
88
        {
 
89
                return m_kdeMode;
 
90
        }
 
91
 
 
92
        /**
 
93
        * Sets the given target active. The argument is given
 
94
        * relative to the project directory.
 
95
        */
 
96
        void setActiveTarget( const QString &targetPath );
 
97
        /**
 
98
        * Returns the active target as path relative to
 
99
        * the project directory.
 
100
        */
 
101
        QString activeDirectory();
 
102
 
 
103
        /**
 
104
        * Adds a file to the active target.
 
105
        * If the file does not contain a "/" character, it is added
 
106
        * to the active target.
 
107
        * If it does contain "/" character(s), ... @todo .. add to appropriate target
 
108
        */
 
109
        void addFiles( const QStringList &list );
 
110
        /**
 
111
        * Removes the file fileName from the directory directory.
 
112
        * (not implemented currently)
 
113
        */
 
114
        void removeFiles( const QStringList &list );
 
115
 
 
116
        /**
 
117
        * Returns the currently selected target. Returns 0 if
 
118
        * no target is selected.
 
119
        */
 
120
        TargetItem *selectedTarget();
 
121
 
 
122
        /**
 
123
        * Returns the currently selected file. Returns 0 if
 
124
        * no file is selected.
 
125
        */
 
126
        FileItem *selectedFile();
 
127
 
 
128
        /**
 
129
        * Returns the currently selected subproject (directory with Makefile.am). Returns 0 if
 
130
        * no subproject is selected.
 
131
        */
 
132
        SubprojectItem* selectedSubproject();
 
133
 
 
134
        /**
 
135
        * Creates a TargetItem instance without a parent item.
 
136
        */
 
137
        TargetItem *createTargetItem( const QString &name,
 
138
                                      const QString &prefix, const QString &primary,
 
139
                                      bool take = true );
 
140
        /**
 
141
        * Creates a FileItem instance without a parent item.
 
142
        */
 
143
        FileItem *createFileItem( const QString &name, SubprojectItem *subproject );
 
144
 
 
145
        /**
 
146
         * Returns the Subproject that contains the Active Target. The Active Target is a special target
 
147
         * to which e.g. all files are added to.
 
148
         */
 
149
        SubprojectItem* activeSubproject ();
 
150
        void setActiveSubproject( SubprojectItem* spitem );
 
151
 
 
152
        /**
 
153
         * Returns the Active Target. The Active Target is a special target
 
154
         * to which e.g. all files are added to.
 
155
         */
 
156
        TargetItem* activeTarget();
 
157
 
 
158
        /**
 
159
         * Returns the sub project item, if any, for a given path. The path supplied can be either
 
160
         * absolute, or relative to the project directory. If no subproject item is found for the
 
161
         * path, null is returned.
 
162
         */
 
163
        SubprojectItem* subprojectItemForPath( const QString & path, bool pathIsAbsolute = false );
 
164
 
 
165
        /**
 
166
         * Returns the projectdir-relative path for a target item
 
167
         */
 
168
        QString pathForTarget( const TargetItem *item ) const;
 
169
 
 
170
        /**
 
171
         * Adds file fileName to target titem in subproject spitem
 
172
         */
 
173
        void addToTarget( const QString & fileName, SubprojectItem* spitem, TargetItem* titem );
 
174
 
 
175
        /**
 
176
        * Restores the last settings of the AutoProjectWidget
 
177
        */
 
178
        void restoreSession ( const QDomElement* el );
 
179
 
 
180
        /**
 
181
         * Saves the latest changes of the AutoProjectWidget to the session file.
 
182
         */
 
183
        void saveSession ( QDomElement* el );
 
184
 
 
185
        AutoSubprojectView* getSubprojectView ();
 
186
        AutoDetailsView* getDetailsView ();
 
187
 
 
188
 
 
189
        void emitAddedFile ( const QString& name );
 
190
        void emitAddedFiles( const QStringList &fileList );
 
191
        void emitRemovedFile ( const QString& name );
 
192
        void emitRemovedFiles( const QStringList &fileList );
 
193
 
 
194
        void parse( SubprojectItem *item );
 
195
 
 
196
        enum AutoProjectView { SubprojectView, DetailsView };
 
197
        void setLastFocusedView( AutoProjectView view );
 
198
 
 
199
        MakefileHandler* makefileHandler();
 
200
 
 
201
public slots:
 
202
        void slotOverviewSelectionChanged( QListViewItem *item );
 
203
 
 
204
protected:
 
205
        void initOverview ( QWidget* parent );
 
206
        void initDetailview ( QWidget* parent );
 
207
        void initActions ();
 
208
 
 
209
        virtual void focusInEvent( QFocusEvent *e );
 
210
 
 
211
private:
 
212
 
 
213
        AutoSubprojectView* m_subprojectView;
 
214
        AutoDetailsView* m_detailView;
 
215
 
 
216
        bool m_kdeMode;
 
217
        AutoProjectPart *m_part;
 
218
        SubprojectItem *m_activeSubproject;
 
219
        TargetItem *m_activeTarget;
 
220
        TargetItem *m_choosenTarget;
 
221
        SubprojectItem *m_shownSubproject;
 
222
 
 
223
        AutoProjectView m_lastFocusedView;
 
224
 
 
225
        MakefileHandler *m_makefileHandler;
 
226
};
 
227
 
 
228
#endif
 
229
// kate: indent-mode csands; tab-width 4;