Eneboo - Documentación para desarrolladores
|
00001 /********************************************************************** 00002 ** Copyright (C) 2005-2007 Trolltech ASA. All rights reserved. 00003 ** 00004 ** This file is part of Qt Designer. 00005 ** 00006 ** This file may be distributed and/or modified under the terms of the 00007 ** GNU General Public License version 2 as published by the Free Software 00008 ** Foundation and appearing in the file LICENSE.GPL included in the 00009 ** packaging of this file. 00010 ** 00011 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00012 ** licenses may use this file in accordance with the Qt Commercial License 00013 ** Agreement provided with the Software. 00014 ** 00015 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00016 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00017 ** 00018 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00019 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00020 ** information about Qt Commercial License Agreements. 00021 ** 00022 ** Contact info@trolltech.com if any conditions of this licensing are 00023 ** not clear to you. 00024 ** 00025 **********************************************************************/ 00026 00027 #ifndef NEWFORMIMPL_H 00028 #define NEWFORMIMPL_H 00029 00030 #include "newform.h" 00031 #include <qiconview.h> 00032 00033 class Project; 00034 00035 class NewItem : public QIconViewItem 00036 { 00037 public: 00038 enum Type { 00039 ProjectType, 00040 Form, 00041 CustomForm, 00042 SourceFileType, 00043 SourceTemplateType 00044 }; 00045 00046 NewItem( QIconView *view, const QString &text ) 00047 : QIconViewItem( view, text ) {} 00048 virtual void insert( Project *pro ) = 0; 00049 virtual void setProject( Project * ) {} 00050 00051 }; 00052 00053 class ProjectItem : public NewItem 00054 { 00055 public: 00056 ProjectItem( QIconView *view, const QString &text ); 00057 void insert( Project *pro ); 00058 int rtti() const { return (int)ProjectType; } 00059 00060 void setLanguage( const QString &l ) { lang = l; } 00061 QString language() const { return lang; } 00062 00063 private: 00064 QString lang; 00065 00066 }; 00067 00068 class FormItem : public NewItem 00069 { 00070 public: 00071 enum FormType { 00072 Widget, 00073 Dialog, 00074 Wizard, 00075 MainWindow 00076 }; 00077 00078 FormItem( QIconView *view, const QString &text ); 00079 void insert( Project *pro ); 00080 int rtti() const { return (int)Form; } 00081 00082 void setFormType( FormType ft ) { fType = ft; } 00083 FormType formType() const { return fType; } 00084 00085 private: 00086 FormType fType; 00087 00088 }; 00089 00090 class CustomFormItem : public NewItem 00091 { 00092 public: 00093 CustomFormItem( QIconView *view, const QString &text ); 00094 void insert( Project *pro ); 00095 int rtti() const { return (int)CustomForm; } 00096 00097 void setTemplateFile( const QString &tf ) { templFile = tf; } 00098 QString templateFileName() const { return templFile; } 00099 00100 private: 00101 QString templFile; 00102 00103 }; 00104 00105 class SourceFileItem : public NewItem 00106 { 00107 public: 00108 SourceFileItem( QIconView *view, const QString &text ); 00109 void insert( Project *pro ); 00110 int rtti() const { return (int)SourceFileType; } 00111 00112 void setExtension( const QString &e ) { ext = e; } 00113 QString extension() const { return ext; } 00114 void setLanguage( const QString &l ) { lang = l; } 00115 void setProject( Project *pro ); 00116 00117 private: 00118 QString ext; 00119 QString lang; 00120 bool visible; 00121 00122 }; 00123 00124 class SourceTemplateItem : public NewItem 00125 { 00126 public: 00127 SourceTemplateItem( QIconView *view, const QString &text ); 00128 void insert( Project *pro ); 00129 int rtti() const { return (int)SourceTemplateType; } 00130 00131 void setTemplate( const QString &t ) { templ = t; } 00132 QString tenplate() const { return templ; } 00133 void setLanguage( const QString &l ) { lang = l; } 00134 void setProject( Project *pro ); 00135 00136 private: 00137 QString templ; 00138 QString lang; 00139 bool visible; 00140 00141 }; 00142 00143 class NewForm : public NewFormBase 00144 { 00145 Q_OBJECT 00146 00147 public: 00148 NewForm( QIconView *templateView, const QString &templatePath ); 00149 NewForm( QWidget *parent, const QStringList& projects, 00150 const QString& currentProject, const QString &templatePath ); 00151 void insertTemplates( QIconView*, const QString& ); 00152 void accept(); 00153 QPtrList<QIconViewItem> allViewItems(); 00154 00155 protected slots: 00156 void projectChanged( const QString &project ); 00157 void itemChanged( QIconViewItem *item ); 00158 00159 private: 00160 QPtrList<QIconViewItem> allItems; 00161 00162 }; 00163 00164 #endif