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

« back to all changes in this revision

Viewing changes to kdevdesigner/designer/newformimpl.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
** Copyright (C) 2000 Trolltech AS.  All rights reserved.
 
3
**
 
4
** This file is part of Qt Designer.
 
5
**
 
6
** This file may be distributed and/or modified under the terms of the
 
7
** GNU General Public License version 2 as published by the Free Software
 
8
** Foundation and appearing in the file LICENSE.GPL included in the
 
9
** packaging of this file.
 
10
**
 
11
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
 
12
** licenses may use this file in accordance with the Qt Commercial License
 
13
** Agreement provided with the Software.
 
14
**
 
15
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
16
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
17
**
 
18
** See http://www.trolltech.com/gpl/ for GPL licensing information.
 
19
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 
20
**   information about Qt Commercial License Agreements.
 
21
**
 
22
** Contact info@trolltech.com if any conditions of this licensing are
 
23
** not clear to you.
 
24
**
 
25
**********************************************************************/
 
26
 
 
27
#ifndef NEWFORMIMPL_H
 
28
#define NEWFORMIMPL_H
 
29
 
 
30
#include "newform.h"
 
31
#include <qiconview.h>
 
32
 
 
33
class Project;
 
34
 
 
35
class NewItem : public QIconViewItem
 
36
{
 
37
public:
 
38
    enum Type {
 
39
        ProjectType,
 
40
        Form,
 
41
        CustomForm,
 
42
        SourceFileType,
 
43
        SourceTemplateType
 
44
    };
 
45
 
 
46
    NewItem( QIconView *view, const QString &text )
 
47
        : QIconViewItem( view, text ) {}
 
48
    virtual void insert( Project *pro ) = 0;
 
49
    virtual void setProject( Project * ) {}
 
50
 
 
51
};
 
52
 
 
53
class ProjectItem : public NewItem
 
54
{
 
55
public:
 
56
    ProjectItem( QIconView *view, const QString &text );
 
57
    void insert( Project *pro );
 
58
    int rtti() const { return (int)ProjectType; }
 
59
 
 
60
    void setLanguage( const QString &l ) { lang = l; }
 
61
    QString language() const { return lang; }
 
62
 
 
63
private:
 
64
    QString lang;
 
65
 
 
66
};
 
67
 
 
68
class FormItem : public NewItem
 
69
{
 
70
public:
 
71
    enum FormType {
 
72
        Widget,
 
73
        Dialog,
 
74
        Wizard,
 
75
        MainWindow
 
76
    };
 
77
 
 
78
    FormItem( QIconView *view, const QString &text );
 
79
    void insert( Project *pro );
 
80
    int rtti() const { return (int)Form; }
 
81
 
 
82
    void setFormType( FormType ft ) { fType = ft; }
 
83
    FormType formType() const { return fType; }
 
84
 
 
85
private:
 
86
    FormType fType;
 
87
 
 
88
};
 
89
 
 
90
class CustomFormItem : public NewItem
 
91
{
 
92
public:
 
93
    CustomFormItem( QIconView *view, const QString &text );
 
94
    void insert( Project *pro );
 
95
    int rtti() const { return (int)CustomForm; }
 
96
 
 
97
    void setTemplateFile( const QString &tf ) { templFile = tf; }
 
98
    QString templateFileName() const { return templFile; }
 
99
 
 
100
private:
 
101
    QString templFile;
 
102
 
 
103
};
 
104
 
 
105
class SourceFileItem : public NewItem
 
106
{
 
107
public:
 
108
    SourceFileItem( QIconView *view, const QString &text );
 
109
    void insert( Project *pro );
 
110
    int rtti() const { return (int)SourceFileType; }
 
111
 
 
112
    void setExtension( const QString &e ) { ext = e; }
 
113
    QString extension() const { return ext; }
 
114
    void setLanguage( const QString &l ) { lang = l; }
 
115
    void setProject( Project *pro );
 
116
 
 
117
private:
 
118
    QString ext;
 
119
    QString lang;
 
120
    bool visible;
 
121
 
 
122
};
 
123
 
 
124
class SourceTemplateItem : public NewItem
 
125
{
 
126
public:
 
127
    SourceTemplateItem( QIconView *view, const QString &text );
 
128
    void insert( Project *pro );
 
129
    int rtti() const { return (int)SourceTemplateType; }
 
130
 
 
131
    void setTemplate( const QString &t ) { templ = t; }
 
132
    QString tenplate() const { return templ; }
 
133
    void setLanguage( const QString &l ) { lang = l; }
 
134
    void setProject( Project *pro );
 
135
 
 
136
private:
 
137
    QString templ;
 
138
    QString lang;
 
139
    bool visible;
 
140
 
 
141
};
 
142
 
 
143
class NewForm : public NewFormBase
 
144
{
 
145
    Q_OBJECT
 
146
 
 
147
public:
 
148
    NewForm( QIconView *templateView, const QString &templatePath );
 
149
    NewForm( QWidget *parent, const QStringList& projects,
 
150
             const QString& currentProject, const QString &templatePath );
 
151
    void insertTemplates( QIconView*, const QString& );
 
152
    void accept();
 
153
    QPtrList<QIconViewItem> allViewItems();
 
154
 
 
155
protected slots:
 
156
    void projectChanged( const QString &project );
 
157
    void itemChanged( QIconViewItem *item );
 
158
 
 
159
private:
 
160
    QPtrList<QIconViewItem> allItems;
 
161
 
 
162
};
 
163
 
 
164
#endif