summaryrefslogtreecommitdiffstats
path: root/parts/appwizard/appwizarddlg.h
blob: c63f66e1202072af54f14f19c85f298671e42870 (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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/***************************************************************************
 *   Copyright (C) 2001 by Bernd Gehrmann                                  *
 *   [email protected]                                                    *
 *   Copyright (C) 2001 by Sandy Meier                                     *
 *   [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 _APPWIZARDDIALOG_H_
#define _APPWIZARDDIALOG_H_

class AppWizardPart;
class TQMultiLineEdit;
class TQRadioButton;
class KTempFile;
class TQWidgetStack;
class TQVBox;
class KPopupMenu;
class TQHBoxLayout;
class KArchiveDirectory;
class KArchiveFile;
class ProfileSupport;
#include <tqptrlist.h>
#include <tqdict.h>
#include <klineedit.h>
#include <tqlabel.h>
#include <tqstringlist.h>
#include <klistview.h>
#include <kiconview.h>
#include "kdevversioncontrol.h"
#include "kdevvcsintegrator.h"
#include "appwizarddlgbase.h"
#include "vcs_form.h"
//#include "autoform.h"
#include "kdevlicense.h"

namespace PropertyLib {
	class PropertyList;
	class PropertyEditor;
}

struct installFile
{
	TQString source;
	TQString dest;
	TQString option;
	bool process;
	bool isXML;
};

struct installArchive
{
	TQString source;
	TQString dest;
	TQString option;
	bool process;
};

struct installDir
{
	TQString dir;
	TQString option;
	int perms;
};

struct ApplicationInfo
{
    TQString templateName;
    TQString name;
    TQString comment;
    TQString icon;
    TQString category;
    TQString defaultDestDir;
    TQString fileTemplates;
    TQStringList openFilesAfterGeneration;
    TQString templateFile;
    TQMap<TQString,TQString> subMap;
	TQMap<TQString,TQString> subMapXML;
    TQStringList includes;

	//TQMap<autoKey,TQVariant> subValues;
	PropertyLib::PropertyList *propValues;

    TQValueList<installFile> fileList;
    TQValueList<installArchive> archList;
    TQValueList<installDir> dirList;
    TQString customUI;
    TQString message;
    TQString finishCmd;
    TQString finishCmdDir;
    TQString sourceArchive;

    //! item pointer to the listview
    TQListViewItem *item;

	//! pointer to favourite icon (NULL if there isn't one)
	TQIconViewItem *favourite;

    ApplicationInfo()
    : item( 0 ), favourite( 0 )
    {}
};

struct AppWizardFileTemplate
{
    TQString suffix;
    TQString style;
    TQMultiLineEdit *edit;

    AppWizardFileTemplate()
    : edit( 0 )
    {}
};


class AppWizardDialog : public AppWizardDialogBase
{
    Q_OBJECT
  TQ_OBJECT

public:
    AppWizardDialog( AppWizardPart *part, TQWidget *tqparent=0, const char *name=0 );
    ~AppWizardDialog();
    TQString getProjectName() { return appname_edit->text(); }
    TQString getProjectLocation() { return finalLoc_label->text(); }

protected:
    virtual void accept();

	virtual TQDict<KDevLicense> licenses();
	void loadLicenses();

protected slots:
    virtual void templatesTreeViewClicked(TQListViewItem*);
    virtual void textChanged();
    virtual void licenseChanged();
    virtual void destButtonClicked(const TQString&);
    virtual void projectNameChanged();
    virtual void projectLocationChanged();
    virtual void favouritesIconViewClicked( TQIconViewItem * );
	virtual void templatesContextMenu(TQListViewItem*, const TQPoint&, int);
	virtual void favouritesContextMenu(TQIconViewItem* item, const TQPoint& point);
	virtual void addTemplateToFavourites();
	virtual void done(int r);
	virtual void removeFavourite();
	virtual void pageChanged();

private: //methods

    ApplicationInfo *templateForItem(TQListViewItem *item);
    void insertCategoryIntoTreeView(const TQString &completeCategoryPath);
    void loadVcs();
	void updateNextButtons();

	void populateFavourites();
	void addFavourite(TQListViewItem* item, TQString favouriteName="");
	ApplicationInfo* findFavouriteInfo(TQIconViewItem* item);

	void unpackArchive( const KArchiveDirectory *dir, const TQString &dest, bool process );
	bool copyFile( const installFile& file );
	bool copyFile( const TQString &source, const TQString &dest, bool isXML, bool process );
	TQString kdevRoot(const TQString &templateName ) const;
	void openAfterGeneration();

	void setPermissions(const KArchiveFile *source, TQString dest);
	void setPermissions(const installFile &file);

	void checkAndHideItems(TQListView *view);
	bool checkAndHideItems(TQListViewItem *item);

private: //data

    TQPtrList<ApplicationInfo> m_appsInfo;
	TQValueList<AppWizardFileTemplate> m_fileTemplates;
    //! Store the category name and the pointer in the treeview
    TQDict<TQListViewItem> m_categoryMap;
	TQValueList<TQListViewItem*> m_categoryItems;
    //! A list of currently available version control systems
//    TQDict<KDevVersionControl> m_availVcs;

    TQHBoxLayout *m_custom_options_layout;
	PropertyLib::PropertyEditor *m_customOptions;
    AppWizardPart *m_part;
    TQWidget *m_lastPage;
    TQPtrList<KTempFile> m_tempFiles;
    ApplicationInfo* m_pCurrentAppInfo;
    bool m_projectLocationWasChanged;
    VcsForm *m_vcsForm;
    bool m_pathIsValid;
	KPopupMenu* m_favouritesMenu;
	KPopupMenu* m_templatesMenu;

	TQDict<KDevLicense> m_licenses;
	TQDict<KDevVCSIntegrator> m_integrators;
	TQMap<int, VCSDialog*> m_integratorDialogs;

	ProfileSupport *m_profileSupport;

public slots:
    virtual void showTemplates(bool all);
};

#endif

// kate: indent-width 4; tqreplace-tabs off; tab-width 4; space-indent off;