summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/dialogs/settingsdlg.cpp
blob: 1bcb47699906cda188b8488d60b45d06aac3ce53 (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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 *  copyright (C) 2002-2006                                                *
 *  Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                   *
 ***************************************************************************/

// own header
#include "settingsdlg.h"

// qt includes
#include <tqlayout.h>
#include <tqtooltip.h>
#include <tqvbox.h>
// kde includes
#include <kdebug.h>
#include <kiconloader.h>
#include <tdelocale.h>
#include <tdefiledialog.h>
// app includes
#include "codegenerationoptionspage.h"
#include "codevieweroptionspage.h"
#include "../dialog_utils.h"

SettingsDlg::SettingsDlg( TQWidget * parent, Settings::OptionState *state )
        : KDialogBase( IconList, i18n("Umbrello Setup"),
               Help | Default | Apply | Ok | Cancel, Ok, parent, 0, true, true ) {
    m_bChangesApplied = false;
    m_pOptionState = state;
    setHelp( "umbrello/index.html", TQString() );
    setupGeneralPage();
    setupFontPage();
    setupUIPage();
    setupClassPage();
    setupCodeGenPage();
    setupCodeViewerPage(state->codeViewerState);
}

SettingsDlg::~SettingsDlg() {}

void SettingsDlg::setupUIPage() {
    //setup UI page
    TQVBox * page = addVBoxPage( i18n("User Interface"), i18n("User Interface Settings"), DesktopIcon( "window_list") );

    m_UiWidgets.colorGB = new TQGroupBox( i18n("Color"), page );
    TQGridLayout * colorLayout = new TQGridLayout( m_UiWidgets.colorGB, 3, 3 );
    colorLayout -> setSpacing( spacingHint() );
    colorLayout -> setMargin( fontMetrics().height() );

    m_UiWidgets.lineColorL = new TQLabel( i18n("Line color:"), m_UiWidgets.colorGB );
    colorLayout -> addWidget( m_UiWidgets.lineColorL, 0, 0 );

    m_UiWidgets.lineColorB = new KColorButton( m_pOptionState->uiState.lineColor, m_UiWidgets.colorGB );
    colorLayout -> addWidget( m_UiWidgets.lineColorB, 0, 1 );

    m_UiWidgets.lineDefaultB = new TQPushButton( i18n("D&efault Color"), m_UiWidgets.colorGB );
    colorLayout -> addWidget( m_UiWidgets.lineDefaultB, 0, 2 );

    m_UiWidgets.fillColorL = new TQLabel( i18n("Fill color:"), m_UiWidgets.colorGB );
    colorLayout -> addWidget( m_UiWidgets.fillColorL, 1, 0 );

    m_UiWidgets.fillColorB = new KColorButton( m_pOptionState->uiState.fillColor, m_UiWidgets.colorGB );
    colorLayout -> addWidget( m_UiWidgets.fillColorB, 1, 1 );

    m_UiWidgets.fillDefaultB = new TQPushButton( i18n("De&fault Color"), m_UiWidgets.colorGB );
    colorLayout -> addWidget( m_UiWidgets.fillDefaultB, 1, 2 );


    m_UiWidgets.lineWidthL = new TQLabel( i18n("Line width:"), m_UiWidgets.colorGB );
    colorLayout -> addWidget( m_UiWidgets.lineWidthL, 2, 0 );

    // Low-Limit: 0, High-Limit: 10, Step: 1, Initial-Val: m_pOptionState->uiState.lineWidth
    // Number-Base: 10 ( decimal ), Parent: m_UiWidgets.colorGB
    m_UiWidgets.lineWidthB = new KIntSpinBox( 0, 10, 1, m_pOptionState->uiState.lineWidth, 10, m_UiWidgets.colorGB );
    colorLayout -> addWidget( m_UiWidgets.lineWidthB, 2, 1 );

    m_UiWidgets.lineWidthDefaultB = new TQPushButton( i18n("D&efault Width"), m_UiWidgets.colorGB );
    colorLayout -> addWidget( m_UiWidgets.lineWidthDefaultB, 2, 2 );



    m_UiWidgets.useFillColorCB = new TQCheckBox( i18n("&Use fill color"), m_UiWidgets.colorGB );
    colorLayout -> setRowStretch( 3, 2 );
    colorLayout -> addWidget( m_UiWidgets.useFillColorCB, 3, 0 );
    m_UiWidgets.useFillColorCB -> setChecked( m_pOptionState->uiState.useFillColor );

    //connect button signals up
    connect( m_UiWidgets.lineDefaultB, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotLineBClicked()) );
    connect( m_UiWidgets.fillDefaultB, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotFillBClicked()) );
}

void SettingsDlg::setupGeneralPage() {
    //setup General page

    TQVBox * page = addVBoxPage( i18n("General"), i18n("General Settings"), DesktopIcon( "misc")  );

    // Set up undo setting
    m_GeneralWidgets.miscGB = new TQGroupBox( i18n("Miscellaneous"), page );

    TQGridLayout * miscLayout = new TQGridLayout( m_GeneralWidgets.miscGB, 2, 2 );
    miscLayout -> setSpacing( spacingHint() );
    miscLayout -> setMargin( fontMetrics().height() );

    m_GeneralWidgets.undoCB = new TQCheckBox( i18n("Enable undo"), m_GeneralWidgets.miscGB );
    m_GeneralWidgets.undoCB -> setChecked( m_pOptionState->generalState.undo );
    miscLayout -> addWidget( m_GeneralWidgets.undoCB, 0, 0 );

    m_GeneralWidgets.tabdiagramsCB = new TQCheckBox( i18n("Use tabbed diagrams"), m_GeneralWidgets.miscGB );
    m_GeneralWidgets.tabdiagramsCB -> setChecked( m_pOptionState->generalState.tabdiagrams );
    miscLayout -> addWidget( m_GeneralWidgets.tabdiagramsCB, 0, 1 );

    m_GeneralWidgets.newcodegenCB = new TQCheckBox( i18n("Use new C++/Java/Ruby generators"), m_GeneralWidgets.miscGB );
    m_GeneralWidgets.newcodegenCB -> setChecked( m_pOptionState->generalState.newcodegen );
    miscLayout -> addWidget( m_GeneralWidgets.newcodegenCB, 1, 0 );

    m_GeneralWidgets.angularLinesCB = new TQCheckBox( i18n("Use angular association lines"), m_GeneralWidgets.miscGB );
    m_GeneralWidgets.angularLinesCB -> setChecked( m_pOptionState->generalState.angularlines );
    miscLayout -> addWidget( m_GeneralWidgets.angularLinesCB, 1, 1 );

    //setup autosave settings

    m_GeneralWidgets.autosaveGB = new TQGroupBox( i18n("Autosave"), page );

    TQGridLayout * autosaveLayout = new TQGridLayout( m_GeneralWidgets.autosaveGB, 3, 2 );
    autosaveLayout -> setSpacing( spacingHint() );
    autosaveLayout -> setMargin( fontMetrics().height() );

    m_GeneralWidgets.autosaveCB = new TQCheckBox( i18n("E&nable autosave"), m_GeneralWidgets.autosaveGB );
    m_GeneralWidgets.autosaveCB -> setChecked( m_pOptionState->generalState.autosave );
    autosaveLayout -> addWidget( m_GeneralWidgets.autosaveCB, 0, 0 );

    m_GeneralWidgets.autosaveL = new TQLabel( i18n("Select auto-save time interval (mins):"), m_GeneralWidgets.autosaveGB );
    autosaveLayout -> addWidget( m_GeneralWidgets.autosaveL, 1, 0 );

    m_GeneralWidgets.timeISB = new KIntSpinBox( 1, 600, 1, m_pOptionState->generalState.autosavetime, 10, m_GeneralWidgets.autosaveGB );
    m_GeneralWidgets.timeISB -> setEnabled( m_pOptionState->generalState.autosave );
    autosaveLayout -> addWidget( m_GeneralWidgets.timeISB, 1, 1 );

    // 2004-05-17 Achim Spangler: Allow definition of Suffix for autosave
    // ( default: ".xmi" )
    Dialog_Utils::makeLabeledEditField( m_GeneralWidgets.autosaveGB, autosaveLayout, 2,
                                    m_GeneralWidgets.autosaveSuffixL, i18n("Set autosave suffix:"),
                                    m_GeneralWidgets.autosaveSuffixT, m_pOptionState->generalState.autosavesuffix );
    TQString autoSaveSuffixToolTip = i18n( "<qt><p>The autosave file will be saved to ~/autosave.xmi if the autosaving occurs "
                                          "before you have manually saved the file.</p>"
                                          "<p>If you've already saved it, the autosave file will be saved in the same folder as the file "
                                          "and will be named like the file's name, followed by the suffix specified.</p>"
                                          "<p>If the suffix is equal to the suffix of the file you've saved, "
                                          "the autosave will overwrite your file automatically.</p></qt>" );
    TQToolTip::add( m_GeneralWidgets.autosaveSuffixL, autoSaveSuffixToolTip );
    TQToolTip::add( m_GeneralWidgets.autosaveSuffixT, autoSaveSuffixToolTip );

    //setup startup settings
    m_GeneralWidgets.startupGB = new TQGroupBox( i18n("Startup"), page );

    TQGridLayout * startupLayout = new TQGridLayout( m_GeneralWidgets.startupGB, 3, 2 );
    startupLayout -> setSpacing( spacingHint() );
    startupLayout -> setMargin( fontMetrics().height() );

    m_GeneralWidgets.logoCB = new TQCheckBox( i18n("Sta&rtup logo"), m_GeneralWidgets.startupGB );
    m_GeneralWidgets.logoCB -> setChecked( m_pOptionState->generalState.logo );
    startupLayout -> addWidget( m_GeneralWidgets.logoCB, 0, 0 );

    m_GeneralWidgets.tipCB = new TQCheckBox( i18n("&Tip of the day"), m_GeneralWidgets.startupGB );
    m_GeneralWidgets.tipCB -> setChecked( m_pOptionState->generalState.tip );
    startupLayout -> addWidget( m_GeneralWidgets.tipCB, 0, 1 );

    m_GeneralWidgets.loadlastCB = new TQCheckBox( i18n("&Load last project"), m_GeneralWidgets.startupGB );
    m_GeneralWidgets.loadlastCB -> setChecked( m_pOptionState->generalState.loadlast );
    startupLayout -> addWidget( m_GeneralWidgets.loadlastCB, 1, 0 );

    m_GeneralWidgets.startL = new TQLabel( i18n("Start new project with:"), m_GeneralWidgets.startupGB );
    startupLayout -> addWidget( m_GeneralWidgets.startL, 2, 0 );

    m_GeneralWidgets.diagramKB = new KComboBox( m_GeneralWidgets.startupGB );
    m_GeneralWidgets.diagramKB->setCompletionMode( TDEGlobalSettings::CompletionPopup );
    startupLayout -> addWidget( m_GeneralWidgets.diagramKB, 2, 1 );

    TQString diagrams [] = { i18n("No Diagram"), i18n("Class Diagram"),
                            i18n("Use Case Diagram"), i18n("Sequence Diagram"),
                            i18n("Collaboration Diagram"), i18n("State Diagram"),
                            i18n("Activity Diagram"), i18n("Component Diagram"),
                            i18n("Deployment Diagram") };

    //start at 1 because we don't allow No Diagram any more
    for (int i=1; i<9; i++) {
        insertDiagram( diagrams[i] );
    }

    m_GeneralWidgets.diagramKB->setCurrentItem( (int)m_pOptionState->generalState.diagram-1 );
    connect( m_GeneralWidgets.autosaveCB, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotAutosaveCBClicked()) );
}

/**
* Inserts @p type into the type-combobox as well as its completion object.
*/
void SettingsDlg::insertDiagram( const TQString& type, int index )
{
    m_GeneralWidgets.diagramKB->insertItem( type, index );
    m_GeneralWidgets.diagramKB->completionObject()->addItem( type );
}

void SettingsDlg::setupClassPage() {
    //setup class settings page

    TQVBox * page = addVBoxPage( i18n("Class"), i18n("Class Settings"), DesktopIcon( "edit")  );
    m_ClassWidgets.visibilityGB = new TQGroupBox( i18n("Visibility"), page );

    TQGridLayout * visibilityLayout = new TQGridLayout( m_ClassWidgets.visibilityGB );
    visibilityLayout -> setSpacing( spacingHint() );
    visibilityLayout -> setMargin(  fontMetrics().height()  );

    m_ClassWidgets.showVisibilityCB = new TQCheckBox(i18n("Show &visibility"), m_ClassWidgets.visibilityGB);
    m_ClassWidgets.showVisibilityCB -> setChecked(  m_pOptionState->classState.showVisibility );
    visibilityLayout -> addWidget( m_ClassWidgets.showVisibilityCB, 0, 0 );

    m_ClassWidgets.showAttsCB = new TQCheckBox( i18n("Show attributes"), m_ClassWidgets.visibilityGB );
    m_ClassWidgets.showAttsCB -> setChecked(  m_pOptionState->classState.showAtts );
    visibilityLayout -> addWidget( m_ClassWidgets.showAttsCB, 0, 1 );

    m_ClassWidgets.showOpsCB = new TQCheckBox( i18n("Show operations"), m_ClassWidgets.visibilityGB );
    m_ClassWidgets.showOpsCB -> setChecked(  m_pOptionState->classState.showOps );
    visibilityLayout -> addWidget( m_ClassWidgets.showOpsCB, 1, 0 );

    m_ClassWidgets.showStereotypeCB = new TQCheckBox( i18n("Show stereot&ype"), m_ClassWidgets.visibilityGB );
    m_ClassWidgets.showStereotypeCB -> setChecked(  m_pOptionState->classState.showStereoType );
    visibilityLayout -> addWidget( m_ClassWidgets.showStereotypeCB, 1, 1 );

    m_ClassWidgets.showAttSigCB = new TQCheckBox(i18n("Show attribute signature"), m_ClassWidgets.visibilityGB);
    m_ClassWidgets.showAttSigCB -> setChecked(   m_pOptionState->classState.showAttSig );
    visibilityLayout -> addWidget( m_ClassWidgets.showAttSigCB, 2, 0 );


    m_ClassWidgets.showPackageCB = new TQCheckBox(i18n("Show package"), m_ClassWidgets.visibilityGB);
    m_ClassWidgets.showPackageCB -> setChecked(  m_pOptionState->classState.showPackage );
    visibilityLayout -> addWidget( m_ClassWidgets.showPackageCB, 2, 1 );

    m_ClassWidgets.showOpSigCB = new TQCheckBox( i18n("Show operation signature"), m_ClassWidgets.visibilityGB );
    m_ClassWidgets.showOpSigCB -> setChecked(  m_pOptionState->classState.showOpSig );
    visibilityLayout -> addWidget( m_ClassWidgets.showOpSigCB, 3, 0 );
    visibilityLayout -> setRowStretch( 3, 1 );

    m_ClassWidgets.scopeGB = new TQGroupBox( i18n("Starting Scope"), page );
    TQGridLayout * scopeLayout = new TQGridLayout( m_ClassWidgets.scopeGB );
    scopeLayout -> setSpacing( spacingHint() );
    scopeLayout -> setMargin(  fontMetrics().height()  );

    m_ClassWidgets.attributeLabel = new TQLabel( i18n("Default attribute scope:"), m_ClassWidgets.scopeGB);
    scopeLayout -> addWidget( m_ClassWidgets.attributeLabel, 0, 0 );

    m_ClassWidgets.operationLabel = new TQLabel( i18n("Default operation scope:"), m_ClassWidgets.scopeGB);
    scopeLayout -> addWidget( m_ClassWidgets.operationLabel, 1, 0 );

    m_ClassWidgets.m_pAttribScopeCB = new KComboBox(m_ClassWidgets.scopeGB);
    insertAttribScope( tr2i18n( "Public" ) );
    insertAttribScope( tr2i18n( "Private" ) );
    insertAttribScope( tr2i18n( "Protected" ) );
    m_ClassWidgets.m_pAttribScopeCB->setCurrentItem((m_pOptionState->classState.defaultAttributeScope - 200));
    m_ClassWidgets.m_pAttribScopeCB->setCompletionMode( TDEGlobalSettings::CompletionPopup );
    scopeLayout -> addWidget( m_ClassWidgets.m_pAttribScopeCB, 0, 1 );

    m_ClassWidgets.m_pOperationScopeCB = new KComboBox(m_ClassWidgets.scopeGB);
    insertOperationScope( tr2i18n( "Public" ) );
    insertOperationScope( tr2i18n( "Private" ) );
    insertOperationScope( tr2i18n( "Protected" ) );
    m_ClassWidgets.m_pOperationScopeCB->setCurrentItem((m_pOptionState->classState.defaultOperationScope - 200));
    m_ClassWidgets.m_pOperationScopeCB->setCompletionMode( TDEGlobalSettings::CompletionPopup );
    scopeLayout -> addWidget( m_ClassWidgets.m_pOperationScopeCB, 1, 1 );

}
/**
* Inserts @p type into the type-combobox as well as its completion object.
*/
void SettingsDlg::insertAttribScope( const TQString& type, int index )
{
    m_ClassWidgets.m_pAttribScopeCB->insertItem( type, index );
    m_ClassWidgets.m_pAttribScopeCB->completionObject()->addItem( type );
}
/**
* Inserts @p type into the type-combobox as well as its completion object.
*/
void SettingsDlg::insertOperationScope( const TQString& type, int index )
{
    m_ClassWidgets.m_pOperationScopeCB->insertItem( type, index );
    m_ClassWidgets.m_pOperationScopeCB->completionObject()->addItem( type );
}

void SettingsDlg::setupCodeGenPage() {
    //setup code generation settings page
    TQVBox * page = addVBoxPage( i18n("Code Generation"), i18n("Code Generation Settings"), DesktopIcon( "source") );
    m_pCodeGenPage = new CodeGenerationOptionsPage(page);
    connect( m_pCodeGenPage, TQT_SIGNAL(languageChanged()), this, TQT_SLOT(slotApply()) );
}

void SettingsDlg::setupCodeViewerPage(Settings::CodeViewerState options) {
    //setup code generation settings page
    TQVBox * page = addVBoxPage( i18n("Code Viewer"), i18n("Code Viewer Settings"), DesktopIcon( "source") );
    m_pCodeViewerPage = new CodeViewerOptionsPage(options, page);
}

void SettingsDlg::setupFontPage() {
    TQVBox * page = addVBoxPage( i18n("Font"), i18n("Font Settings"), DesktopIcon( "fonts")  );
    m_FontWidgets.chooser = new TDEFontChooser( page, "font", false, TQStringList(), false);
    m_FontWidgets.chooser->setFont( m_pOptionState->uiState.font );

}

void SettingsDlg::slotApply() {
    applyPage( (Settings::Page) activePageIndex() );
    //do no emit signal applyClicked in the slot slotApply -> infinite loop
    //emit applyClicked();
}

void SettingsDlg::slotOk() {
    applyPage( Settings::page_general );
    applyPage( Settings::page_font );
    applyPage( Settings::page_UI );
    applyPage( Settings::page_class );
    applyPage( Settings::page_codegen );
    applyPage( Settings::page_codeview );
    accept();
}


void SettingsDlg::slotDefault() {
    /*
       Defaults hard coded.  Make sure that this is alright.
       If defaults are set anywhere else, like in setting up config file, make sure the same.
    */
    switch( activePageIndex() ) {
    case Settings::page_general:
        m_GeneralWidgets.autosaveCB -> setChecked( false );
        m_GeneralWidgets.timeISB -> setValue( 5 );
        m_GeneralWidgets.timeISB->setEnabled( true );
        m_GeneralWidgets.logoCB -> setChecked( true );
        m_GeneralWidgets.tipCB -> setChecked( true );
        m_GeneralWidgets.loadlastCB -> setChecked( true );
        m_GeneralWidgets.diagramKB -> setCurrentItem( 0 );
        break;

    case Settings::page_font:
        m_FontWidgets.chooser -> setFont( parentWidget() -> font() );
        break;

    case Settings::page_UI:
        m_UiWidgets.useFillColorCB -> setChecked( true );
        m_UiWidgets.fillColorB -> setColor( TQColor( 255, 255, 192 ) );
        m_UiWidgets.lineColorB -> setColor( TQt::red );
        m_UiWidgets.lineWidthB -> setValue( 0 );
        break;

    case Settings::page_class:
        m_ClassWidgets.showVisibilityCB -> setChecked( false );
        m_ClassWidgets.showAttsCB -> setChecked( true );
        m_ClassWidgets.showOpsCB -> setChecked( true );
        m_ClassWidgets.showStereotypeCB -> setChecked( false );
        m_ClassWidgets.showAttSigCB -> setChecked( false );
        m_ClassWidgets.showOpSigCB -> setChecked( false );
        m_ClassWidgets.showPackageCB -> setChecked( false );
        m_ClassWidgets.m_pAttribScopeCB->setCurrentItem(1); // Private
        m_ClassWidgets.m_pOperationScopeCB->setCurrentItem(0); // Public
        break;

    case Settings::page_codegen:
    case Settings::page_codeview:
        // do nothing
        break;
    };
}

void SettingsDlg::applyPage( Settings::Page page ) {
    m_bChangesApplied = true;
    switch( page ) {
    case Settings::page_general:
        m_pOptionState->generalState.undo = m_GeneralWidgets.undoCB -> isChecked();
        m_pOptionState->generalState.tabdiagrams = m_GeneralWidgets.tabdiagramsCB->isChecked();
        m_pOptionState->generalState.newcodegen = m_GeneralWidgets.newcodegenCB->isChecked();
        m_pOptionState->generalState.angularlines = m_GeneralWidgets.angularLinesCB->isChecked();
        m_pOptionState->generalState.autosave = m_GeneralWidgets.autosaveCB -> isChecked();
        m_pOptionState->generalState.autosavetime = m_GeneralWidgets.timeISB -> value();
        // 2004-05-17 Achim Spangler: retrieve Suffix setting from dialog entry
        m_pOptionState->generalState.autosavesuffix = m_GeneralWidgets.autosaveSuffixT -> text();
        m_pOptionState->generalState.logo = m_GeneralWidgets.logoCB -> isChecked();
        m_pOptionState->generalState.tip = m_GeneralWidgets.tipCB -> isChecked();
        m_pOptionState->generalState.loadlast = m_GeneralWidgets.loadlastCB -> isChecked();
        m_pOptionState->generalState.diagram  = (Uml::Diagram_Type)(m_GeneralWidgets.diagramKB->currentItem() + 1);
        break;

    case Settings::page_font:
        m_pOptionState->uiState.font = m_FontWidgets.chooser -> font();
        break;

    case Settings::page_UI:
        m_pOptionState->uiState.useFillColor = m_UiWidgets.useFillColorCB -> isChecked();
        m_pOptionState->uiState.fillColor = m_UiWidgets.fillColorB -> color();
        m_pOptionState->uiState.lineColor = m_UiWidgets.lineColorB -> color();
        m_pOptionState->uiState.lineWidth = m_UiWidgets.lineWidthB -> value();
        break;

    case Settings::page_class:
        m_pOptionState->classState.showVisibility = m_ClassWidgets.showVisibilityCB -> isChecked();
        m_pOptionState->classState.showAtts = m_ClassWidgets.showAttsCB -> isChecked();
        m_pOptionState->classState.showOps = m_ClassWidgets.showOpsCB -> isChecked();
        m_pOptionState->classState.showStereoType = m_ClassWidgets.showStereotypeCB -> isChecked();
        m_pOptionState->classState.showAttSig = m_ClassWidgets.showAttSigCB -> isChecked();
        m_pOptionState->classState.showOpSig = m_ClassWidgets.showOpSigCB -> isChecked();
        m_pOptionState->classState.showPackage = m_ClassWidgets.showPackageCB -> isChecked();
            m_pOptionState->classState.defaultAttributeScope = (Uml::Visibility::Value) (m_ClassWidgets.m_pAttribScopeCB->currentItem() + 200);
            m_pOptionState->classState.defaultOperationScope = (Uml::Visibility::Value) (m_ClassWidgets.m_pOperationScopeCB->currentItem() + 200);
        break;

    case Settings::page_codegen:
        m_pCodeGenPage->apply();
        break;

    case Settings::page_codeview:
        m_pCodeViewerPage->apply();
        m_pOptionState->codeViewerState = m_pCodeViewerPage->getOptions();
        break;
    }
}

void SettingsDlg::slotLineBClicked() {
    m_UiWidgets.lineColorB -> setColor( TQt::red );
}

void SettingsDlg::slotFillBClicked() {
    m_UiWidgets.fillColorB -> setColor( TQColor(255, 255, 192) );
}

void SettingsDlg::slotAutosaveCBClicked() {
    m_GeneralWidgets.timeISB -> setEnabled( m_GeneralWidgets.autosaveCB -> isChecked() );
}

TQString SettingsDlg::getCodeGenerationLanguage() {
    return m_pCodeGenPage->getCodeGenerationLanguage();
}

#include "settingsdlg.moc"