00001 #include <kdialog.h>
00002 #include <klocale.h>
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "codegenerationoptionsbase.h"
00013
00014 #include <qvariant.h>
00015 #include <qpushbutton.h>
00016 #include <qtabwidget.h>
00017 #include <qgroupbox.h>
00018 #include <qcombobox.h>
00019 #include <qlabel.h>
00020 #include <qcheckbox.h>
00021 #include <qlineedit.h>
00022 #include <qbuttongroup.h>
00023 #include <qradiobutton.h>
00024 #include <knuminput.h>
00025 #include <qframe.h>
00026 #include <qlayout.h>
00027 #include <qtooltip.h>
00028 #include <qwhatsthis.h>
00029
00030
00031
00032
00033
00034 CodeGenerationOptionsBase::CodeGenerationOptionsBase( QWidget* parent, const char* name, WFlags fl )
00035 : QWidget( parent, name, fl )
00036 {
00037 if ( !name )
00038 setName( "CodeGenerationOptionsBase" );
00039 setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)3, 0, 0, sizePolicy().hasHeightForWidth() ) );
00040 CodeGenerationOptionsBaseLayout = new QGridLayout( this, 1, 1, 11, 6, "CodeGenerationOptionsBaseLayout");
00041
00042 tabWidget = new QTabWidget( this, "tabWidget" );
00043 tabWidget->setEnabled( TRUE );
00044 tabWidget->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, 0, 0, tabWidget->sizePolicy().hasHeightForWidth() ) );
00045
00046 tab = new QWidget( tabWidget, "tab" );
00047 tabLayout = new QVBoxLayout( tab, 11, 6, "tabLayout");
00048
00049 layout1 = new QVBoxLayout( 0, 0, 6, "layout1");
00050
00051 m_SelectLanguageGroup = new QGroupBox( tab, "m_SelectLanguageGroup" );
00052 m_SelectLanguageGroup->setColumnLayout(0, Qt::Vertical );
00053 m_SelectLanguageGroup->layout()->setSpacing( 6 );
00054 m_SelectLanguageGroup->layout()->setMargin( 11 );
00055 m_SelectLanguageGroupLayout = new QHBoxLayout( m_SelectLanguageGroup->layout() );
00056 m_SelectLanguageGroupLayout->setAlignment( Qt::AlignTop );
00057
00058 m_SelectLanguageBox = new QComboBox( FALSE, m_SelectLanguageGroup, "m_SelectLanguageBox" );
00059 m_SelectLanguageGroupLayout->addWidget( m_SelectLanguageBox );
00060 layout1->addWidget( m_SelectLanguageGroup );
00061
00062 GroupBox1 = new QGroupBox( tab, "GroupBox1" );
00063 GroupBox1->setColumnLayout(0, Qt::Vertical );
00064 GroupBox1->layout()->setSpacing( 6 );
00065 GroupBox1->layout()->setMargin( 11 );
00066 GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
00067 GroupBox1Layout->setAlignment( Qt::AlignTop );
00068
00069 TextLabel2 = new QLabel( GroupBox1, "TextLabel2" );
00070
00071 GroupBox1Layout->addMultiCellWidget( TextLabel2, 0, 0, 0, 1 );
00072
00073 m_browseOutput = new QPushButton( GroupBox1, "m_browseOutput" );
00074
00075 GroupBox1Layout->addWidget( m_browseOutput, 1, 2 );
00076
00077 m_browseHeadings = new QPushButton( GroupBox1, "m_browseHeadings" );
00078
00079 GroupBox1Layout->addWidget( m_browseHeadings, 3, 2 );
00080
00081 m_includeHeadings = new QCheckBox( GroupBox1, "m_includeHeadings" );
00082 m_includeHeadings->setChecked( TRUE );
00083
00084 GroupBox1Layout->addMultiCellWidget( m_includeHeadings, 2, 2, 0, 1 );
00085
00086 m_outputDir = new QLineEdit( GroupBox1, "m_outputDir" );
00087
00088 GroupBox1Layout->addWidget( m_outputDir, 1, 1 );
00089
00090 m_headingsDir = new QLineEdit( GroupBox1, "m_headingsDir" );
00091
00092 GroupBox1Layout->addWidget( m_headingsDir, 3, 1 );
00093 Spacer1 = new QSpacerItem( 30, 20, QSizePolicy::Fixed, QSizePolicy::Minimum );
00094 GroupBox1Layout->addItem( Spacer1, 1, 0 );
00095 Spacer2 = new QSpacerItem( 30, 20, QSizePolicy::Fixed, QSizePolicy::Minimum );
00096 GroupBox1Layout->addItem( Spacer2, 3, 0 );
00097 layout1->addWidget( GroupBox1 );
00098
00099 m_overwriteGroup = new QButtonGroup( tab, "m_overwriteGroup" );
00100 m_overwriteGroup->setColumnLayout(0, Qt::Vertical );
00101 m_overwriteGroup->layout()->setSpacing( 6 );
00102 m_overwriteGroup->layout()->setMargin( 11 );
00103 m_overwriteGroupLayout = new QVBoxLayout( m_overwriteGroup->layout() );
00104 m_overwriteGroupLayout->setAlignment( Qt::AlignTop );
00105
00106 TextLabel1 = new QLabel( m_overwriteGroup, "TextLabel1" );
00107 m_overwriteGroupLayout->addWidget( TextLabel1 );
00108
00109 m_overwrite = new QRadioButton( m_overwriteGroup, "m_overwrite" );
00110 m_overwriteGroupLayout->addWidget( m_overwrite );
00111
00112 m_ask = new QRadioButton( m_overwriteGroup, "m_ask" );
00113 m_ask->setChecked( TRUE );
00114 m_overwriteGroupLayout->addWidget( m_ask );
00115
00116 m_changeName = new QRadioButton( m_overwriteGroup, "m_changeName" );
00117 m_overwriteGroupLayout->addWidget( m_changeName );
00118 layout1->addWidget( m_overwriteGroup );
00119 tabLayout->addLayout( layout1 );
00120 tabWidget->insertTab( tab, QString::fromLatin1("") );
00121
00122 tab_2 = new QWidget( tabWidget, "tab_2" );
00123 tabLayout_2 = new QGridLayout( tab_2, 1, 1, 11, 6, "tabLayout_2");
00124
00125 layout8 = new QGridLayout( 0, 1, 1, 0, 6, "layout8");
00126
00127 groupBox5 = new QGroupBox( tab_2, "groupBox5" );
00128 groupBox5->setColumnLayout(0, Qt::Vertical );
00129 groupBox5->layout()->setSpacing( 6 );
00130 groupBox5->layout()->setMargin( 11 );
00131 groupBox5Layout = new QGridLayout( groupBox5->layout() );
00132 groupBox5Layout->setAlignment( Qt::AlignTop );
00133 spacer3 = new QSpacerItem( 16, 30, QSizePolicy::Expanding, QSizePolicy::Minimum );
00134 groupBox5Layout->addItem( spacer3, 0, 0 );
00135 spacer3_2_2 = new QSpacerItem( 16, 30, QSizePolicy::Expanding, QSizePolicy::Minimum );
00136 groupBox5Layout->addItem( spacer3_2_2, 2, 0 );
00137 spacer3_2 = new QSpacerItem( 16, 30, QSizePolicy::Expanding, QSizePolicy::Minimum );
00138 groupBox5Layout->addItem( spacer3_2, 1, 0 );
00139
00140 textLabel3 = new QLabel( groupBox5, "textLabel3" );
00141
00142 groupBox5Layout->addWidget( textLabel3, 2, 1 );
00143
00144 textLabel1 = new QLabel( groupBox5, "textLabel1" );
00145
00146 groupBox5Layout->addMultiCellWidget( textLabel1, 0, 0, 1, 2 );
00147
00148 textLabel2 = new QLabel( groupBox5, "textLabel2" );
00149
00150 groupBox5Layout->addMultiCellWidget( textLabel2, 1, 1, 1, 3 );
00151
00152 m_SelectEndLineCharsBox = new QComboBox( FALSE, groupBox5, "m_SelectEndLineCharsBox" );
00153
00154 groupBox5Layout->addMultiCellWidget( m_SelectEndLineCharsBox, 2, 2, 2, 4 );
00155
00156 m_SelectIndentationTypeBox = new QComboBox( FALSE, groupBox5, "m_SelectIndentationTypeBox" );
00157
00158 groupBox5Layout->addMultiCellWidget( m_SelectIndentationTypeBox, 0, 0, 3, 4 );
00159
00160 m_SelectIndentationNumber = new KIntNumInput( groupBox5, "m_SelectIndentationNumber" );
00161
00162 groupBox5Layout->addWidget( m_SelectIndentationNumber, 1, 4 );
00163
00164 layout8->addWidget( groupBox5, 1, 0 );
00165
00166 GroupBox3 = new QGroupBox( tab_2, "GroupBox3" );
00167
00168 m_forceSections = new QCheckBox( GroupBox3, "m_forceSections" );
00169 m_forceSections->setGeometry( QRect( 10, 60, 446, 52 ) );
00170
00171 m_forceDoc = new QCheckBox( GroupBox3, "m_forceDoc" );
00172 m_forceDoc->setGeometry( QRect( 11, 29, 446, 28 ) );
00173
00174 layout8->addWidget( GroupBox3, 0, 0 );
00175
00176 tabLayout_2->addLayout( layout8, 0, 0 );
00177 tabWidget->insertTab( tab_2, QString::fromLatin1("") );
00178
00179 tab_3 = new QWidget( tabWidget, "tab_3" );
00180 tabLayout_3 = new QGridLayout( tab_3, 1, 1, 11, 6, "tabLayout_3");
00181
00182 languageOptionsFrame = new QFrame( tab_3, "languageOptionsFrame" );
00183 languageOptionsFrame->setFrameShape( QFrame::StyledPanel );
00184 languageOptionsFrame->setFrameShadow( QFrame::Raised );
00185
00186 tabLayout_3->addWidget( languageOptionsFrame, 0, 0 );
00187 tabWidget->insertTab( tab_3, QString::fromLatin1("") );
00188
00189 CodeGenerationOptionsBaseLayout->addWidget( tabWidget, 0, 0 );
00190 languageChange();
00191 resize( QSize(581, 525).expandedTo(minimumSizeHint()) );
00192 clearWState( WState_Polished );
00193
00194
00195 connect( m_includeHeadings, SIGNAL( toggled(bool) ), m_browseHeadings, SLOT( setEnabled(bool) ) );
00196 connect( m_includeHeadings, SIGNAL( toggled(bool) ), m_headingsDir, SLOT( setEnabled(bool) ) );
00197 connect( m_browseOutput, SIGNAL( clicked() ), this, SLOT( browseClicked() ) );
00198 connect( m_browseHeadings, SIGNAL( clicked() ), this, SLOT( browseClicked() ) );
00199 connect( m_SelectLanguageBox, SIGNAL( activated(int) ), this, SLOT( activeLanguageChanged(int) ) );
00200 }
00201
00202
00203
00204
00205 CodeGenerationOptionsBase::~CodeGenerationOptionsBase()
00206 {
00207
00208 }
00209
00210
00211
00212
00213
00214 void CodeGenerationOptionsBase::languageChange()
00215 {
00216 setCaption( tr2i18n( "Code Generation Options" ) );
00217 m_SelectLanguageGroup->setTitle( tr2i18n( "Language" ) );
00218 GroupBox1->setTitle( tr2i18n( "Folders" ) );
00219 TextLabel2->setText( tr2i18n( "Write all generated files to folder:" ) );
00220 m_browseOutput->setText( tr2i18n( "Bro&wse..." ) );
00221 m_browseHeadings->setText( tr2i18n( "B&rowse..." ) );
00222 m_includeHeadings->setText( tr2i18n( "&Include heading files from folder:" ) );
00223 QWhatsThis::add( m_outputDir, tr2i18n( "Files generated by Code Generator will be written to this folder" ) );
00224 QWhatsThis::add( m_headingsDir, tr2i18n( "Files in this folder will be used as heading files in the generated code" ) );
00225 m_overwriteGroup->setTitle( tr2i18n( "Overwrite Policy" ) );
00226 TextLabel1->setText( tr2i18n( "If a file with the same name as the name code \n"
00227 "generator wants to use as output file already exists:" ) );
00228 m_overwrite->setText( tr2i18n( "O&verwrite" ) );
00229 QWhatsThis::add( m_overwrite, tr2i18n( "Overwrite existing files if they exist in the destination folder" ) );
00230 m_ask->setText( tr2i18n( "As&k" ) );
00231 QWhatsThis::add( m_ask, tr2i18n( "If a file with the same name already exists, ask what to do" ) );
00232 m_changeName->setText( tr2i18n( "&Use a different name" ) );
00233 QWhatsThis::add( m_changeName, tr2i18n( "If a file already exists in the destination folder, select a different name to use by adding a suffix to the file name" ) );
00234 tabWidget->changeTab( tab, tr2i18n( "General" ) );
00235 groupBox5->setTitle( tr2i18n( "Lines" ) );
00236 textLabel3->setText( tr2i18n( "Line ending style:" ) );
00237 textLabel1->setText( tr2i18n( "Indentation type:" ) );
00238 textLabel2->setText( tr2i18n( "Indentation amount:" ) );
00239 m_SelectEndLineCharsBox->clear();
00240 m_SelectEndLineCharsBox->insertItem( tr2i18n( "*NIX (\"\\n\")" ) );
00241 m_SelectEndLineCharsBox->insertItem( tr2i18n( "Windows (\"\\r\\n\")" ) );
00242 m_SelectEndLineCharsBox->insertItem( tr2i18n( "Mac (\"\\r\")" ) );
00243 m_SelectIndentationTypeBox->clear();
00244 m_SelectIndentationTypeBox->insertItem( tr2i18n( "No Indentation" ) );
00245 m_SelectIndentationTypeBox->insertItem( tr2i18n( "Tab" ) );
00246 m_SelectIndentationTypeBox->insertItem( tr2i18n( "Space" ) );
00247 GroupBox3->setTitle( tr2i18n( "Comment Verbosity" ) );
00248 m_forceSections->setText( tr2i18n( "Write comments &for sections even if section \n"
00249 "is empty" ) );
00250 QWhatsThis::add( m_forceSections, tr2i18n( "Writes comments to indicate the different sections (public, private etc) in a class, even if the sections are empty" ) );
00251 m_forceDoc->setText( tr2i18n( "&Write documentation comments even if empty" ) );
00252 QWhatsThis::add( m_forceDoc, tr2i18n( "Write comments &for class and method documentation even if empty" ) );
00253 tabWidget->changeTab( tab_2, tr2i18n( "Formatting" ) );
00254 tabWidget->changeTab( tab_3, tr2i18n( "Language Options" ) );
00255 }
00256
00257 void CodeGenerationOptionsBase::browseClicked()
00258 {
00259 qWarning( "CodeGenerationOptionsBase::browseClicked(): Not implemented yet" );
00260 }
00261
00262 void CodeGenerationOptionsBase::activeLanguageChanged(int)
00263 {
00264 qWarning( "CodeGenerationOptionsBase::activeLanguageChanged(int): Not implemented yet" );
00265 }
00266
00267 #include "codegenerationoptionsbase.moc"