Subversion Repositories Scribus

Rev

Rev 1642 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1641 cbradney 1
#include "prefs.h"
2
#include "prefs.moc"
3
#include "keymanager.h"
4
#include "scribusdoc.h"
5
#include "scribusstructs.h"
6
#include <qfont.h>
7
#include <qcolordialog.h>
8
#include <qcombobox.h>
9
#include <qcolor.h>
10
#include <qstringlist.h>
11
#include <qstylefactory.h>
12
#include <qpointarray.h>
13
#include <qpainter.h>
14
#include <qrect.h>
15
#include <qstring.h>
16
#include <qwmatrix.h>
17
#include <cmath>
18
#include "units.h"
19
#include "langmgr.h"
20
#include "tabtypography.h"
21
#include "tabguides.h"
22
#include "hysettings.h"
23
#include "cmsprefs.h"
24
#include "keymanager.h"
25
#include "tabtools.h"
26
#include "undomanager.h"
27
#include "tabcheckdoc.h"
28
#include "tabpdfoptions.h"
29
#include "fontprefs.h"
30
#include "units.h"
31
#include "pluginmanager.h"
32
#include "pagesize.h"
33
#include "docitemattrprefs.h"
34
 
35
 
36
using namespace std;
37
 
38
extern QPixmap loadIcon(QString nam);
39
extern bool CMSavail;
40
extern ProfilesL InputProfiles;
41
extern ScribusApp *ScApp;
42
 
43
/*!
44
 \fn Preferences::Preferences( QWidget* parent, ApplicationPrefs *prefsData)
45
 \author Franz Schmid
46
 \date
47
 \brief Constructor for Preferences dialog box
48
 \param parent QWidget pointer to parent window
49
 \param prefsData ApplicationPrefs * struct
50
 \retval Preferences dialog
51
 */
52
Preferences::Preferences( QWidget* parent, ApplicationPrefs *prefsData) : PrefsDialogBase( parent )
53
{
54
        int decimals;
55
        ap = (ScribusApp*)parent;
56
        Umrech = 1.0;
57
        docUnitIndex = prefsData->docUnitIndex;
58
        decimals = unitGetPrecisionFromIndex(docUnitIndex);
59
 
60
        DisScale = prefsData->DisScale;
61
        setCaption( tr( "Preferences" ) );
62
 
63
        tab = new QWidget( prefsWidgets, "tab" );
64
        tabLayout = new QGridLayout( tab );
65
        tabLayout->setSpacing( 6 );
66
        tabLayout->setMargin( 10 );
67
        tabLayout->setAlignment( Qt::AlignTop );
68
 
69
        // GUI Group
70
        ButtonGroup1 = new QButtonGroup( tr( "GUI" ), tab, "ButtonGroup1" );
71
        ButtonGroup1->setColumnLayout(0, Qt::Vertical );
72
        ButtonGroup1->layout()->setSpacing( 0 );
73
        ButtonGroup1->layout()->setMargin( 0 );
74
        ButtonGroup1Layout = new QGridLayout( ButtonGroup1->layout() );
75
        ButtonGroup1Layout->setAlignment( Qt::AlignTop );
76
        ButtonGroup1Layout->setSpacing( 6 );
77
        ButtonGroup1Layout->setMargin( 10 );
78
 
79
        langMgr.init();
80
        QStringList languageList;
81
        langMgr.fillInstalledStringList(&languageList, true);
82
        languageList.sort();
83
        guiLangCombo = new QComboBox( false, ButtonGroup1, "guiLangCombo");
84
        guiLangCombo->insertStringList( languageList );
85
        guiLangCombo->setCurrentText(langMgr.getLangFromAbbrev(prefsData->guiLanguage));
86
        selectedGUILang=prefsData->guiLanguage;
87
        guiLangLabel = new QLabel(guiLangCombo, tr("&Language:"), ButtonGroup1, "guiLangLabel");
88
        ButtonGroup1Layout->addWidget( guiLangLabel, 0, 0 );
89
        ButtonGroup1Layout->addWidget( guiLangCombo, 0, 1, Qt::AlignLeft );
90
 
91
        GUICombo = new QComboBox( true, ButtonGroup1, "GUICombo" );
92
        QStringList STtest;
93
        STtest = QStyleFactory::keys();
94
        for (uint stt = 0; stt < STtest.count(); ++stt)
95
                GUICombo->insertItem(STtest[stt]);
96
        GUICombo->setEditable(false);
97
        GUICombo->setCurrentText(prefsData->GUI);
98
        TextGstil = new QLabel(GUICombo, tr("&Theme:"), ButtonGroup1, "dd");
99
        ButtonGroup1Layout->addWidget( TextGstil, 1, 0 );
100
        ButtonGroup1Layout->addWidget( GUICombo, 1, 1, Qt::AlignLeft );
101
 
102
        GFsize = new QSpinBox(ButtonGroup1, "gfs" );
103
        GFsize->setSuffix( tr( " pt" ) );
104
        GFsize->setMaxValue( 22 );
105
        GFsize->setMinValue( 8 );
106
        GFsize->setValue( prefsData->AppFontSize );
107
        TextGstil2 = new QLabel(GFsize, tr("&Font Size:"), ButtonGroup1, "dd");
108
        ButtonGroup1Layout->addWidget( TextGstil2, 2, 0 );
109
        ButtonGroup1Layout->addWidget( GFsize, 2, 1, Qt::AlignLeft );
110
        SpinBox3 = new QSpinBox( ButtonGroup1, "SpinBox3" );
111
        SpinBox3->setMaxValue( 1000 );
112
        SpinBox3->setMinValue( 0 );
113
        SpinBox3->setLineStep( 10 );
114
        SpinBox3->setValue( prefsData->Wheelval );
115
        TextLabel1_2 = new QLabel( SpinBox3, tr( "&Wheel Jump:" ), ButtonGroup1, "TextLabel1_2" );
116
        ButtonGroup1Layout->addWidget( TextLabel1_2, 3, 0 );
117
        ButtonGroup1Layout->addWidget( SpinBox3, 3, 1, Qt::AlignLeft );
118
        Recen = new QSpinBox( ButtonGroup1, "Recen" );
119
        Recen->setMaxValue( 30 );
120
        Recen->setMinValue( 1 );
121
        Recen->setValue( prefsData->RecentDCount );
122
        TextLabel4c = new QLabel( Recen, tr( "&Recent Documents:" ), ButtonGroup1, "TextLabel4c" );
123
        ButtonGroup1Layout->addWidget( TextLabel4c, 4, 0);
124
        ButtonGroup1Layout->addWidget( Recen, 4, 1, Qt::AlignLeft );
125
        tabLayout->addWidget( ButtonGroup1, 0, 0 );
126
 
127
        GroupBox200 = new QGroupBox( tr( "Paths" ), tab, "GroupBox200" );
128
        GroupBox200->setColumnLayout(0, Qt::Horizontal );
129
        GroupBox200->layout()->setSpacing( 0 );
130
        GroupBox200->layout()->setMargin( 0 );
131
        GroupBox200Layout = new QGridLayout( GroupBox200->layout() );
132
        GroupBox200Layout->setAlignment( Qt::AlignTop );
133
        GroupBox200Layout->setSpacing( 0 );
134
        GroupBox200Layout->setMargin( 5 );
135
 
136
        Docs = new QLineEdit( GroupBox200, "Datei" );
137
        Docs->setMinimumSize( QSize( 268, 22 ) );
138
        Docs->setText(prefsData->DocDir);
139
        PfadText = new QLabel( Docs, tr("&Documents:"), GroupBox200, "Pfadtext" );
140
        FileC = new QToolButton( GroupBox200, "FileC" );
141
        FileC->setMinimumSize( QSize( 88, 24 ) );
142
        FileC->setText( tr( "&Change..." ) );
143
        GroupBox200Layout->addWidget( PfadText, 0, 0 );
144
        GroupBox200Layout->addWidget( Docs, 0, 1 );
145
        GroupBox200Layout->addWidget( FileC, 0, 2 );
146
 
147
        ProPfad = new QLineEdit( GroupBox200, "Datei1" );
148
        ProPfad->setMinimumSize( QSize( 268, 22 ) );
149
        ProPfad->setText(prefsData->ProfileDir);
150
        PfadText2 = new QLabel( ProPfad, tr("&ICC Profiles:"), GroupBox200, "Pfadtext1" );
151
        FileC2 = new QToolButton( GroupBox200, "FileC1" );
152
        FileC2->setMinimumSize( QSize( 88, 24 ) );
153
        FileC2->setText( tr( "C&hange..." ) );
154
        GroupBox200Layout->addWidget( PfadText2, 1, 0 );
155
        GroupBox200Layout->addWidget( ProPfad, 1, 1 );
156
        GroupBox200Layout->addWidget( FileC2, 1, 2 );
157
 
158
        ScriptPfad = new QLineEdit( GroupBox200, "Datei1" );
159
        ScriptPfad->setMinimumSize( QSize( 268, 22 ) );
160
        ScriptPfad->setText(prefsData->ScriptDir);
161
        PfadText3 = new QLabel( ScriptPfad, tr("&Scripts:"), GroupBox200, "Pfadtext1" );
162
        FileC3 = new QToolButton( GroupBox200, "FileC3" );
163
        FileC3->setMinimumSize( QSize( 88, 24 ) );
164
        FileC3->setText( tr( "Ch&ange..." ) );
165
        GroupBox200Layout->addWidget( PfadText3, 2, 0 );
166
        GroupBox200Layout->addWidget( ScriptPfad, 2, 1 );
167
        GroupBox200Layout->addWidget( FileC3, 2, 2 );
168
 
169
        TemplateDir = new QLineEdit( GroupBox200, "Datei1" );
170
        TemplateDir->setMinimumSize( QSize( 268, 22 ) );
171
        TemplateDir->setText(prefsData->TemplateDir);
172
        PfadText4 = new QLabel( TemplateDir, tr("T&emplates:"), GroupBox200, "Pfadtext1" );
173
        FileC4 = new QToolButton( GroupBox200, "FileC4" );
174
        FileC4->setMinimumSize( QSize( 88, 24 ) );
175
        FileC4->setText( tr( "Cha&nge..." ) );
176
        GroupBox200Layout->addWidget( PfadText4, 3, 0 );
177
        GroupBox200Layout->addWidget( TemplateDir, 3, 1 );
178
        GroupBox200Layout->addWidget( FileC4, 3, 2 );
179
        tabLayout->addWidget( GroupBox200, 1, 0 );
180
        addItem( tr("General"), loadIcon("AppIcon.png"), tab);
181
 
182
        tab_7 = new QWidget( prefsWidgets, "tab_7" );
183
        tabLayout_7 = new QHBoxLayout( tab_7, 11, 6, "tabLayout_7");
184
        Layout21 = new QVBoxLayout( 0, 0, 6, "Layout21");
185
        GroupSize = new QButtonGroup( tr( "Page Size" ), tab_7, "GroupSize" );
186
        GroupSize->setColumnLayout(0, Qt::Vertical );
187
        GroupSize->layout()->setSpacing( 6 );
188
        GroupSize->layout()->setMargin( 10 );
189
        GroupSizeLayout = new QVBoxLayout( GroupSize->layout() );
190
        GroupSizeLayout->setAlignment( Qt::AlignTop );
191
        Layout6 = new QGridLayout( 0, 1, 1, 0, 6, "Layout6");
192
 
193
        GZComboF = new QComboBox( true, GroupSize, "GZComboF" );
194
        /*
195
        const QString ar_size[] =
196
            {"A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "B0", "B1", "B2", "B3",
197
             "B4", "B5", "B6", "B7", "B8", "B9", "B10", "C5E", "Comm10E", "DLE", tr("Executive"),
198
             tr("Folio"), tr("Ledger"), tr("Legal"), tr("Letter"), tr("Tabloid")
199
            };
200
        size_t ar_s = sizeof(ar_size) / sizeof(*ar_size);
201
        for (uint s = 0; s < ar_s; ++s)
202
                GZComboF->insertItem(ar_size[s]);
203
        */
204
 
205
        PageSize *ps=new PageSize(prefsData->pageSize);
206
        GZComboF->insertStringList(ps->getTrPageSizeList());
207
        GZComboF->insertItem( tr( "Custom" ) );
208
        GZComboF->setEditable(false);
209
 
210
        QStringList pageSizes=ps->getPageSizeList();
211
        int sizeIndex=pageSizes.findIndex(ps->getPageText());
212
        if (sizeIndex!=-1)
213
                GZComboF->setCurrentItem(sizeIndex);
214
        else
215
                GZComboF->setCurrentItem(GZComboF->count()-1);
216
        GZText1 = new QLabel( GZComboF, tr( "&Size:" ), GroupSize, "GZText1" );
217
        Layout6->addWidget( GZText1, 0, 0 );
218
        Layout6->addWidget( GZComboF, 0, 1 );
219
 
220
        GZComboO = new QComboBox( true, GroupSize, "GZComboO" );
221
        GZComboO->insertItem( tr( "Portrait" ) );
222
        GZComboO->insertItem( tr( "Landscape" ) );
223
        GZComboO->setEditable(false);
224
        GZComboO->setCurrentItem(prefsData->pageOrientation);
225
        GZText2 = new QLabel( GZComboO, tr( "Orie&ntation:" ), GroupSize, "GZText2" );
226
        Layout6->addWidget( GZText2, 1, 0 );
227
        Layout6->addWidget( GZComboO, 1, 1 );
228
        UnitCombo = new QComboBox( true, GroupSize, "UnitCombo" );
229
        UnitCombo->insertStringList(unitGetTextUnitList());
230
        UnitCombo->setEditable(false);
231
        UnitCombo->setCurrentItem(prefsData->docUnitIndex);
232
        unitComboText = new QLabel( UnitCombo, tr( "Units:" ), GroupSize, "unitComboText" );
233
        Layout6->addWidget( unitComboText, 2, 0 );
234
        Layout6->addWidget( UnitCombo, 2, 1 );
235
 
236
        GroupSizeLayout->addLayout( Layout6 );
237
 
238
        Layout5_2 = new QHBoxLayout( 0, 0, 6, "Layout5_2");
239
 
240
        pageWidth = new MSpinBox( 1, 10000, GroupSize, decimals );
241
        pageWidth->setEnabled( false );
242
        pageWidth->setMinimumSize( QSize( 70, 20 ) );
243
        pageWidth->setValue(prefsData->PageWidth * Umrech);
244
        GZText3 = new QLabel( pageWidth, tr( "&Width:" ), GroupSize, "GZText3" );
245
        Layout5_2->addWidget( GZText3 );
246
        Layout5_2->addWidget( pageWidth );
247
 
248
        pageHeight = new MSpinBox( 1, 10000, GroupSize, decimals );
249
        pageHeight->setEnabled( false );
250
        pageHeight->setMinimumSize( QSize( 70, 20 ) );
251
        pageHeight->setValue(prefsData->PageHeight * Umrech);
252
        GZText4 = new QLabel( pageHeight, tr( "&Height:" ), GroupSize, "GZText4" );
253
        Layout5_2->addWidget( GZText4 );
254
        Layout5_2->addWidget( pageHeight );
255
 
256
        GroupSizeLayout->addLayout( Layout5_2 );
257
 
258
        Layout8 = new QHBoxLayout( 0, 0, 6, "Layout8");
259
 
260
        facingPages = new QCheckBox( tr( "&Facing Pages" ), GroupSize, "facingPages" );
261
        facingPages->setChecked(prefsData->FacingPages);
262
        Layout8->addWidget( facingPages );
263
 
264
        Linkszuerst = new QCheckBox( tr( "Left &Page First" ), GroupSize, "Linkszuerst" );
265
        Linkszuerst->setChecked(prefsData->LeftPageFirst);
266
        if (!facingPages->isChecked())
267
                Linkszuerst->setEnabled(false);
268
        Layout8->addWidget( Linkszuerst );
269
        GroupSizeLayout->addLayout( Layout8 );
270
        Layout21->addWidget( GroupSize );
271
 
272
        GroupRand = new QGroupBox( tr( "Margin Guides" ), tab_7, "GroupRand" );
273
        GroupRand->setColumnLayout(0, Qt::Vertical );
274
        GroupRand->layout()->setSpacing( 5 );
275
        GroupRand->layout()->setMargin( 10 );
276
        GroupRandLayout = new QGridLayout( GroupRand->layout() );
277
        GroupRandLayout->setAlignment( Qt::AlignTop );
278
 
279
        TopR = new MSpinBox( 0, 1000, GroupRand, decimals );
280
        TopR->setMinimumSize( QSize( 70, 20 ) );
281
        TopR->setValue(prefsData->RandOben * Umrech);
282
        RandT = prefsData->RandOben;
283
        GroupRandLayout->addWidget( TopR, 0, 1 );
284
        BottomR = new MSpinBox( 0, 1000, GroupRand, decimals );
285
        BottomR->setMinimumSize( QSize( 70, 20 ) );
286
        BottomR->setValue(prefsData->RandUnten * Umrech);
287
        RandB = prefsData->RandUnten;
288
        GroupRandLayout->addWidget( BottomR, 1, 1 );
289
        RightR = new MSpinBox( 0, 1000, GroupRand, decimals );
290
        RightR->setMinimumSize( QSize( 70, 20 ) );
291
        RightR->setValue(prefsData->RandRechts * Umrech);
292
        RandR = prefsData->RandRechts;
293
        GroupRandLayout->addWidget( RightR, 1, 3 );
294
        LeftR = new MSpinBox( 0, 1000, GroupRand, decimals );
295
        LeftR->setMinimumSize( QSize( 70, 20 ) );
296
        LeftR->setValue(prefsData->RandLinks * Umrech);
297
        RandL = prefsData->RandLinks;
298
        GroupRandLayout->addWidget( LeftR, 0, 3 );
299
 
300
        GRText2 = new QLabel( BottomR, tr( "&Bottom:" ), GroupRand, "GRText2" );
301
        GroupRandLayout->addWidget( GRText2, 1, 0 );
302
        GRText1 = new QLabel( TopR, tr( "&Top:" ), GroupRand, "GRText1" );
303
        GroupRandLayout->addWidget( GRText1, 0, 0 );
304
        GRText4 = new QLabel( RightR, tr( "&Right:" ), GroupRand, "GRText4" );
305
        GroupRandLayout->addWidget( GRText4, 1, 2 );
306
        GRText3 = new QLabel( LeftR, tr( "&Left:" ), GroupRand, "GRText3" );
307
        GroupRandLayout->addWidget( GRText3, 0, 2 );
308
 
309
        Layout21->addWidget( GroupRand );
310
        QBoxLayout *asurLayout = new QHBoxLayout( 0, 0, 6, "asurLayout");
311
 
312
        GroupAS = new QGroupBox( tr( "Autosave" ), tab_7, "GroupAS" );
313
        GroupAS->setColumnLayout(0, Qt::Vertical );
314
        GroupAS->layout()->setSpacing( 5 );
315
        GroupAS->layout()->setMargin( 10 );
316
        GroupASLayout = new QGridLayout( GroupAS->layout() );
317
        GroupASLayout->setAlignment( Qt::AlignTop );
318
        ASon = new QCheckBox( tr( "&Enabled" ), GroupAS, "Enable Autosave" );
319
        ASon->setChecked(prefsData->AutoSave);
320
        GroupASLayout->addMultiCellWidget( ASon, 0, 0, 0, 1 );
321
        ASTime = new QSpinBox( GroupAS, "Time" );
322
        ASTime->setMaxValue( 60 );
323
        ASTime->setMinValue( 1 );
324
        ASTime->setSuffix( " " + tr("min") );
325
        ASTime->setValue(prefsData->AutoSaveTime / 1000 / 60);
326
        ASText = new QLabel( ASTime, tr( "&Interval:" ), GroupAS, "ASText" );
327
        GroupASLayout->addWidget( ASText, 1, 0 );
328
        GroupASLayout->addWidget( ASTime, 1, 1 );
329
        asurLayout->addWidget(GroupAS);
330
 
331
        urGroup = new QGroupBox(tr("Undo/Redo"), tab_7, "urGroup");
332
        urGroup->setColumnLayout(0, Qt::Vertical);
333
        urGroup->layout()->setSpacing(5);
334
        urGroup->layout()->setMargin(10);
335
        QGridLayout *urGroupLayout = new QGridLayout(urGroup->layout());
336
        urGroupLayout->setAlignment(Qt::AlignTop);
337
        urSpinBox = new QSpinBox(urGroup, "urSpinBox");
338
        urSpinBox->setMinValue(0);
339
        urSpinBox->setMaxValue(1000);
340
        int urSBValue = UndoManager::instance()->getHistoryLength();
341
        if (urSBValue == -1)
342
                urSpinBox->setEnabled(false);
343
        else
344
                urSpinBox->setValue(urSBValue);
345
        urLabel = new QLabel(urSpinBox, tr("Action history length"), urGroup, "urLabel");
346
        urGroupLayout->addWidget(urLabel, 0, 0);
347
        urGroupLayout->addWidget(urSpinBox, 0, 1);
348
        asurLayout->addWidget(urGroup);
349
        Layout21->addLayout(asurLayout);
350
 
351
        tabLayout_7->addLayout( Layout21 );
352
        addItem( tr("Document"), loadIcon("page.png"), tab_7);
353
 
354
        tabGuides = new TabGuides(prefsWidgets, &prefsData->guidesSettings, &prefsData->typographicSetttings, Umrech, "");
355
        addItem( tr("Guides"), loadIcon("guides.png"), tabGuides);
356
        tabTypo = new TabTypograpy(  prefsWidgets, &prefsData->typographicSetttings);
357
        addItem( tr("Typography"), loadIcon("font.png"), tabTypo);
358
        tabTools = new TabTools(  prefsWidgets, &prefsData->toolSettings, Umrech, "", 0);
359
        addItem( tr("Tools"), loadIcon("tools.png"), tabTools);
360
 
361
        tabHyphenator = new HySettings(prefsWidgets, &ap->LangTransl);
362
        tabHyphenator->verbose->setChecked(!prefsData->Automatic);
363
        tabHyphenator->input->setChecked(prefsData->AutoCheck);
364
        tabHyphenator->language->setCurrentText(ap->LangTransl[prefsData->Language]);
365
        tabHyphenator->wordLen->setValue(prefsData->MinWordLen);
366
        tabHyphenator->maxCount->setValue(prefsData->HyCount);
367
        addItem( tr("Hyphenator"), loadIcon("hyphenate.png"), tabHyphenator);
368
 
369
        tabFonts = new FontPrefs(  prefsWidgets, ap->Prefs.AvailFonts, false, prefsData, ap->PrefsPfad, 0);
370
        addItem( tr("Fonts"), loadIcon("font.png"), tabFonts);
371
 
372
        tabDocChecker = new TabCheckDoc(  prefsWidgets, prefsData->checkerProfiles, prefsData->curCheckProfile);
373
        addItem( tr("Doc-Checker"), loadIcon("checkdoc.png"), tabDocChecker);
374
 
375
        if (CMSavail)
376
        {
377
                tabColorManagement = new CMSPrefs(prefsWidgets, &prefsData->DCMSset, &InputProfiles, &ap->PrinterProfiles, &ap->MonitorProfiles);
378
                addItem( tr("Color Management"), loadIcon("blend.png"), tabColorManagement);
379
        }
380
        QMap<QString,QFont> DocFonts;
381
        DocFonts.clear();
382
        tabPDF = new TabPDFOptions( prefsWidgets,
383
                                                                &prefsData->PDF_Options,
384
                                                                ap->Prefs.AvailFonts,
385
                                                                &ap->PDFXProfiles,
386
                                                                DocFonts,
387
                                                                prefsData->PDF_Options.PresentVals,
388
                                                                Umrech,
389
                                                                unitGetSuffixFromIndex(prefsData->docUnitIndex),
390
                                                                prefsData->PageHeight,
391
                                                                prefsData->PageWidth,
392
 
393
        addItem( tr("PDF Export"), loadIcon("acroread.png"), tabPDF);
394
 
395
        tabDefaultItemAttributes = new DocumentItemAttributes( prefsWidgets);
396
        tabDefaultItemAttributes->setup(&prefsData->defaultItemAttributes);
397
        addItem( tr("Document Item Attributes"), loadIcon("docattributes.png"), tabDefaultItemAttributes);
398
 
399
        tabKeys = new KeyManager(prefsWidgets, prefsData->KeyActions);
400
        addItem( tr("Keyboard Shortcuts"), loadIcon("key_bindings.png"), tabKeys);
401
 
402
        tab_5 = new QWidget( prefsWidgets, "tab_5" );
403
        tabLayout_5 = new QGridLayout( tab_5 );
404
        tabLayout_5->setSpacing( 6 );
405
        tabLayout_5->setMargin( 11 );
406
        saving = new QGroupBox( tr( "Other Options" ), tab_5, "Saving" );
407
        saving->setColumnLayout(0, Qt::Vertical );
408
        saving->layout()->setSpacing( 0 );
409
        saving->layout()->setMargin( 0 );
410
        savingLayout = new QHBoxLayout( saving->layout() );
411
        savingLayout->setAlignment( Qt::AlignTop );
412
        savingLayout->setSpacing( 6 );
413
        savingLayout->setMargin( 25 );
414
        SaveAtQuit = new QCheckBox( tr( "Sa&ve Contents on Changes" ), saving, "SaveAtQuit" );
415
        SaveAtQuit->setChecked(prefsData->SaveAtQ);
416
        savingLayout->addWidget( SaveAtQuit );
417
        tabLayout_5->addWidget( saving, 1, 0 );
418
        preview = new QGroupBox( tr( "Preview" ), tab_5, "Preview" );
419
        preview->setColumnLayout(0, Qt::Vertical );
420
        preview->layout()->setSpacing( 0 );
421
        preview->layout()->setMargin( 0 );
422
        previewLayout = new QHBoxLayout( preview->layout() );
423
        previewLayout->setAlignment( Qt::AlignTop );
424
        previewLayout->setSpacing( 10 );
425
        previewLayout->setMargin( 24 );
426
        PreviewSize = new QComboBox( true, preview, "PreviewSize" );
427
        PreviewSize->insertItem( tr( "Small" ) );
428
        PreviewSize->insertItem( tr( "Medium" ) );
429
        PreviewSize->insertItem( tr( "Large" ) );
430
        PreviewSize->setEditable(false);
431
        int sci = prefsData->PSize == 40 ? 0 : prefsData->PSize == 60 ? 1 : 2;
432
        PreviewSize->setCurrentItem(sci);
433
        textLabelP = new QLabel( PreviewSize, tr( "&Size:" ), preview, "TextLabel1_3" );
434
        previewLayout->addWidget( textLabelP );
435
        previewLayout->addWidget( PreviewSize );
436
        tabLayout_5->addWidget( preview, 0, 0 );
437
        addItem(  tr("Scrapbook"), loadIcon("scrap.png"), tab_5);
438
 
439
        tabView = new QWidget( prefsWidgets, "tabView" );
440
        tabViewLayout = new QVBoxLayout( tabView, 10, 5, "tabViewLayout");
441
        tabViewLayout->setAlignment( Qt::AlignTop );
442
        pageBackground = new QButtonGroup( tabView, "pageBackground" );
443
        pageBackground->setTitle( tr( "Page Display" ) );
444
        pageBackground->setColumnLayout(0, Qt::Vertical );
445
        pageBackground->layout()->setSpacing( 5 );
446
        pageBackground->layout()->setMargin( 10 );
447
        pageBackgroundLayout = new QVBoxLayout( pageBackground->layout() );
448
        pageBackgroundLayout->setAlignment( Qt::AlignTop );
449
        layout10 = new QHBoxLayout( 0, 0, 5, "layout10");
450
        textLabel9 = new QLabel( pageBackground, "textLabel9" );
451
        textLabel9->setText( tr( "Color:" ) );
452
        layout10->addWidget( textLabel9 );
453
        backColor = new QPushButton( pageBackground, "backColor" );
454
        backColor->setMinimumSize( QSize( 60, 20 ) );
455
        backColor->setMaximumSize( QSize( 60, 20 ) );
456
        backColor->setFlat( false );
457
        backColor->setAutoDefault( false );
458
        QPixmap pm5 = QPixmap(54, 14);
459
        pm5.fill(prefsData->DpapColor);
460
        colorPaper = prefsData->DpapColor;
461
        backColor->setPixmap(pm5);
462
        backColor->setText( QString::null );
463
        layout10->addWidget( backColor );
464
        QSpacerItem* spacer3 = new QSpacerItem( 61, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
465
        layout10->addItem( spacer3 );
466
        pageBackgroundLayout->addLayout( layout10 );
467
        checkUnprintable = new QCheckBox( pageBackground, "checkUnprintable" );
468
        checkUnprintable->setText( tr( "Display &Unprintable Area in Margin Color" ) );
469
        checkUnprintable->setAccel( QKeySequence( tr( "Alt+U" ) ) );
470
        checkUnprintable->setChecked( prefsData->marginColored );
471
        pageBackgroundLayout->addWidget( checkUnprintable );
472
        checkPictures = new QCheckBox( pageBackground, "checkPictures" );
473
        checkPictures->setText( tr( "Show Pictures" ) );
474
        checkPictures->setChecked(prefsData->guidesSettings.showPic);
475
        pageBackgroundLayout->addWidget( checkPictures );
476
        checkLink = new QCheckBox( pageBackground, "checkLink" );
477
        checkLink->setText( tr( "Show Text Chains" ) );
478
        checkLink->setChecked(prefsData->guidesSettings.linkShown);
479
        pageBackgroundLayout->addWidget( checkLink );
480
        checkFrame = new QCheckBox( pageBackground, "checkFrame" );
481
        checkFrame->setText( tr( "Show Frames" ) );
482
        checkFrame->setChecked(prefsData->guidesSettings.framesShown);
483
        pageBackgroundLayout->addWidget( checkFrame );
484
        tabViewLayout->addWidget( pageBackground );
485
 
486
        groupScratch = new QGroupBox( tabView, "GroupBox7" );
487
        groupScratch->setTitle( tr( "Scratch Space" ) );
488
        groupScratch->setColumnLayout(0, Qt::Vertical );
489
        groupScratch->layout()->setSpacing( 0 );
490
        groupScratch->layout()->setMargin( 0 );
491
        groupScratchLayout = new QHBoxLayout( groupScratch->layout() );
492
        groupScratchLayout->setAlignment( Qt::AlignTop );
493
        groupScratchLayout->setSpacing( 0 );
494
        groupScratchLayout->setMargin( 10 );
495
        Layout4s = new QGridLayout;
496
        Layout4s->setSpacing( 6 );
497
        Layout4s->setMargin( 0 );
498
        topScratch = new MSpinBox( groupScratch, 4 );
499
        topScratch->setDecimals( decimals );
500
        topScratch->setMaxValue(1000);
501
        topScratch->setValue(prefsData->ScratchTop * Umrech);
502
        Layout4s->addWidget( topScratch, 0, 1 );
503
        TextLabel5s = new QLabel(topScratch, tr( "&Top:" ), groupScratch, "TextLabel5" );
504
        Layout4s->addWidget( TextLabel5s, 0, 0 );
505
        leftScratch = new MSpinBox( groupScratch, 4 );
506
        leftScratch->setDecimals( decimals );
507
        leftScratch->setMaxValue(1000);
508
        leftScratch->setValue(prefsData->ScratchLeft * Umrech);
509
        Layout4s->addWidget( leftScratch, 0, 3 );
510
        Linkss = new QLabel(leftScratch, tr( "&Left:" ), groupScratch, "Links" );
511
        Layout4s->addWidget( Linkss, 0, 2 );
512
        bottomScratch = new MSpinBox( groupScratch, 4 );
513
        bottomScratch->setDecimals( decimals );
514
        bottomScratch->setMaxValue(1000);
515
        bottomScratch->setValue(prefsData->ScratchBottom * Umrech);
516
        Layout4s->addWidget( bottomScratch, 1, 1 );
517
        TextLabel7s = new QLabel(bottomScratch, tr( "&Bottom:" ), groupScratch, "TextLabel7" );
518
        Layout4s->addWidget( TextLabel7s, 1, 0 );
519
        rightScratch = new MSpinBox( groupScratch, 4 );
520
        rightScratch->setDecimals( decimals );
521
        rightScratch->setMaxValue(1000);
522
        rightScratch->setValue(prefsData->ScratchRight * Umrech);
523
        Layout4s->addWidget( rightScratch, 1, 3 );
524
        Rechtss = new QLabel(rightScratch, tr( "&Right:" ), groupScratch, "Rechts" );
525
        Layout4s->addWidget( Rechtss, 1, 2 );
526
        groupScratchLayout->addLayout( Layout4s );
527
        tabViewLayout->addWidget( groupScratch );
528
 
529
        CaliGroup = new QGroupBox( tr( "&Adjust Display Size" ), tabView, "CaliGroup" );
530
        CaliGroup->setColumnLayout(0, Qt::Vertical );
531
        CaliGroup->layout()->setSpacing( 6 );
532
        CaliGroup->layout()->setMargin( 11 );
533
        CaliGroupLayout = new QVBoxLayout( CaliGroup->layout() );
534
        CaliGroupLayout->setAlignment( Qt::AlignTop );
535
        CaliText = new QLabel( tr( "To adjust the display drag the ruler below with the Slider." ), CaliGroup, "CaliText" );
536
        CaliGroupLayout->addWidget( CaliText );
537
        CaliRuler = new QLabel( CaliGroup, "CaliRuler" );
538
        CaliRuler->setMinimumSize( QSize( 20, 20 ) );
539
        drawRuler();
540
        CaliRuler->setFrameShape( QLabel::Box );
541
        CaliRuler->setFrameShadow( QLabel::Sunken );
542
        CaliRuler->setScaledContents( false );
543
        CaliGroupLayout->addWidget( CaliRuler );
544
        layout15ca = new QHBoxLayout( 0, 0, 6, "layout15");
545
        CaliSlider = new QSlider( CaliGroup, "CaliSlider" );
546
        CaliSlider->setMinValue( -100 );
547
        CaliSlider->setMaxValue( 100 );
548
        CaliSlider->setValue(static_cast<int>(100 * DisScale)-100);
549
        CaliSlider->setOrientation( QSlider::Horizontal );
550
        CaliSlider->setTickmarks( QSlider::Right );
551
        CaliSlider->setTickInterval( 10 );
552
        CaliText->setBuddy(CaliGroup);
553
        layout15ca->addWidget( CaliSlider );
554
        CaliAnz = new QLabel( CaliGroup, "CaliAnz" );
555
        CaliAnz->setText(QString::number(DisScale*100, 'f', 2)+" %");
556
        layout15ca->addWidget( CaliAnz );
557
        CaliGroupLayout->addLayout( layout15ca );
558
        tabViewLayout->addWidget( CaliGroup );
559
        addItem( tr("Display"), loadIcon("screen.png"), tabView);
560
 
561
        ExtTool = new QWidget( prefsWidgets, "ExtTool" );
562
        ExtToolLayout = new QVBoxLayout( ExtTool, 11, 6, "ExtToolLayout");
563
        ExtToolLayout->setAlignment( Qt::AlignTop );
564
        groupGS = new QGroupBox( tr( "Postscript Interpreter" ), ExtTool, "groupGS" );
565
        groupGS->setColumnLayout(0, Qt::Vertical );
566
        groupGS->layout()->setSpacing( 6 );
567
        groupGS->layout()->setMargin( 10 );
568
        groupGSLayout = new QVBoxLayout( groupGS->layout() );
569
        groupGSLayout->setAlignment( Qt::AlignTop );
570
        GSlayout = new QHBoxLayout( 0, 0, 6, "GSlayout");
571
        GSName = new QLineEdit( groupGS, "GSName" );
572
        GSName->setText(prefsData->gs_exe);
573
        GSText = new QLabel( GSName, tr( "&Name of Executable:" ), groupGS, "GSText" );
574
        GSlayout->addWidget( GSText );
575
        GSlayout->addWidget( GSName );
576
        groupGSLayout->addLayout( GSlayout );
577
        GSantiText = new QCheckBox( tr( "Antialias &Text" ), groupGS, "GSantiText" );
578
        GSantiText->setChecked(prefsData->gs_AntiAliasText);
579
        groupGSLayout->addWidget( GSantiText );
580
        GSantiGraph = new QCheckBox( tr( "Antialias &Graphics" ), groupGS, "GSantiGraph" );
581
        GSantiGraph->setChecked(prefsData->gs_AntiAliasGraphics);
582
        groupGSLayout->addWidget( GSantiGraph );
583
        ExtToolLayout->addWidget( groupGS );
584
        groupGimp = new QGroupBox( tr( "Image Processing Tool" ), ExtTool, "groupGimp" );
585
        groupGimp->setColumnLayout(0, Qt::Vertical );
586
        groupGimp->layout()->setSpacing( 6 );
587
        groupGimp->layout()->setMargin( 10 );
588
        groupGimpLayout = new QHBoxLayout( groupGimp->layout() );
589
        groupGimpLayout->setAlignment( Qt::AlignTop );
590
        GimpName = new QLineEdit( groupGimp, "GimpName" );
591
        GimpName->setText(prefsData->gimp_exe);
592
        GimpText = new QLabel( GimpName, tr( "Name of &Executable:" ), groupGimp, "GimpText" );
593
        groupGimpLayout->addWidget( GimpText );
594
        groupGimpLayout->addWidget( GimpName );
595
        ExtToolLayout->addWidget( groupGimp );
596
        QSpacerItem* spacer_gs = new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::Expanding );
597
        ExtToolLayout->addItem( spacer_gs );
598
        addItem(  tr("External Tools."), loadIcon("misc.png"), ExtTool);
599
 
600
        Misc = new QWidget( prefsWidgets, "Misc" );
601
        MiscLayout = new QVBoxLayout( Misc, 10, 5, "MiscLayout");
602
        MiscLayout->setAlignment( Qt::AlignTop );
603
        groupPrint = new QGroupBox( tr( "Printing" ), Misc, "groupPrint" );
604
        groupPrint->setColumnLayout(0, Qt::Vertical );
605
        groupPrint->layout()->setSpacing( 10 );
606
        groupPrint->layout()->setMargin( 10 );
607
        groupPrintLayout = new QVBoxLayout( groupPrint->layout() );
608
        groupPrintLayout->setAlignment( Qt::AlignTop );
609
        ClipMarg = new QCheckBox( tr( "Clip to Page &Margins" ), groupPrint, "ClipMarg" );
610
        ClipMarg->setChecked(prefsData->ClipMargin);
611
        groupPrintLayout->addWidget( ClipMarg );
612
        DoGCR = new QCheckBox( tr( "Apply &Under Color Removal" ), groupPrint, "ClipMarg" );
613
        DoGCR->setChecked(prefsData->GCRMode);
614
        groupPrintLayout->addWidget( DoGCR );
615
        MiscLayout->addWidget( groupPrint );
616
        AskForSubs = new QCheckBox( tr( "Always ask before Fonts are replaced when loading a Document" ), Misc, "askforSubs" );
617
        AskForSubs->setChecked(prefsData->askBeforeSubstituite);
618
        MiscLayout->addWidget( AskForSubs );
619
        QSpacerItem* spacer_3m = new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::Expanding );
620
        MiscLayout->addItem( spacer_3m );
621
        addItem(  tr("Misc."), loadIcon("misc.png"), Misc);
622
 
623
        // plugin manager. pv.
624
        pluginManagerWidget = new QWidget(prefsWidgets, "pluginManagerWidget");
625
        pluginMainLayout = new QVBoxLayout( pluginManagerWidget, 10, 5, "pluginMainLayout");
626
        pluginMainLayout->setAlignment( Qt::AlignTop );
627
        plugGroupBox = new QGroupBox(tr("Plugin Manager"), pluginManagerWidget, "plugGroupBox");
628
        plugGroupBox->setColumnLayout(0, Qt::Vertical);
629
        plugGroupBox->layout()->setSpacing(6);
630
        plugGroupBox->layout()->setMargin(11);
631
        plugGroupBoxLayout = new QGridLayout( plugGroupBox->layout() );
632
        plugGroupBoxLayout->setAlignment(Qt::AlignTop);
633
        plugLayout1 = new QVBoxLayout( 0, 0, 6, "plugLayout1");
634
        pluginsList = new QListView(plugGroupBox, "pluginsList");
635
        pluginsList->setAllColumnsShowFocus(true);
636
        pluginsList->setShowSortIndicator(true);
637
        pluginsList->addColumn(tr("Plugin"));
638
        pluginsList->setColumnWidthMode(0, QListView::Maximum);
639
        pluginsList->addColumn(tr("How to run"));
640
        pluginsList->setColumnWidthMode(1, QListView::Maximum);
641
        pluginsList->addColumn(tr("Type"));
642
        pluginsList->setColumnWidthMode(2, QListView::Maximum);
643
        pluginsList->addColumn(tr("Load it?"));
644
        pluginsList->setColumnWidthMode(3, QListView::Maximum);
645
        pluginsList->addColumn(tr("Plugin ID"));
646
        pluginsList->setColumnWidthMode(4, QListView::Maximum);
647
        pluginsList->addColumn(tr("File"));
648
        pluginsList->setColumnWidthMode(5, QListView::Maximum);
649
        for (QMap<int,PluginManager::PluginData>::Iterator it = ap->pluginManager->pluginMap.begin(); it != ap->pluginManager->pluginMap.end(); ++it)
650
        {
651
                QListViewItem *plugItem = new QListViewItem(pluginsList);
652
                plugItem->setText(0, (*it).name.replace('&', "").replace("...", "")); // name
653
                plugItem->setText(1, QString("%1 %2").arg((*it).actMenu).arg((*it).actMenuAfterName)); // menu path
654
                plugItem->setText(2, ap->pluginManager->getPluginType((*it).type)); // type
655
                // load at start?
656
                plugItem->setPixmap(3, (*it).loadPlugin ? loadIcon("ok.png") : loadIcon("DateiClos16.png"));
657
                plugItem->setText(3, (*it).loadPlugin ? tr("Yes") : tr("No"));
658
                plugItem->setText(4, QString("%1").arg(it.key())); // id for developers
659
                plugItem->setText(5, (*it).pluginFile); // file for developers
660
        }
661
        plugLayout1->addWidget(pluginsList);
662
        pluginWarning = new QLabel(plugGroupBox);
663
        pluginWarning->setText("<qt>" + tr("You need to restart the application to promote the changes.") + "</qt>");
664
        plugLayout1->addWidget(pluginWarning);
665
        plugGroupBoxLayout->addLayout(plugLayout1, 0, 0);
666
        pluginMainLayout->addWidget(plugGroupBox);
667
        addItem(tr("Plugins"), loadIcon("plugins.png"), pluginManagerWidget);
668
 
669
        setDS();
670
        //tab order
671
        QWidget::setTabOrder( GFsize, SpinBox3 );
672
        QWidget::setTabOrder( SpinBox3, UnitCombo );
673
        QWidget::setTabOrder( UnitCombo, Recen );
674
        QWidget::setTabOrder( Recen, Docs );
675
        QWidget::setTabOrder( Docs, FileC );
676
        QWidget::setTabOrder( FileC, ProPfad );
677
        QWidget::setTabOrder( ProPfad, FileC2  );
678
        QWidget::setTabOrder( FileC2, ScriptPfad );
679
        QWidget::setTabOrder( ScriptPfad, FileC3 );
680
        QWidget::setTabOrder( FileC3, TemplateDir );
681
        QWidget::setTabOrder( TemplateDir, FileC4 );
682
 
683
 
684
        QWidget::setTabOrder( TopR, BottomR );
685
        QWidget::setTabOrder( BottomR, LeftR );
686
        QWidget::setTabOrder( LeftR, RightR );
687
 
688
        QWidget::setTabOrder( PreviewSize, SaveAtQuit );
689
 
690
        QToolTip::add( checkLink, tr("Turns the of linked frames on or off"));
691
        QToolTip::add( checkFrame, tr("Turns the display of frames on or off"));
692
        QToolTip::add( checkPictures, tr("Turns the display of pictures on or off"));
693
        QToolTip::add( guiLangCombo, tr( "Select your default language for Scribus to run with.\nLeave this blank to choose based on environment variables.\nYou can still override this by passing a command line option when starting Scribus" ) );
694
        QToolTip::add( GUICombo, tr( "Choose the default window decoration and looks.\nScribus inherits any available KDE or Qt themes" ) );
695
        QToolTip::add( GFsize, tr( "Default font size for the menus and windows" ) );
696
        QToolTip::add( UnitCombo, tr( "Default unit of measurement for document editing" ) );
697
        QToolTip::add( SpinBox3, tr( "Number of lines Scribus will scroll for each move of the mouse wheel" ) );
698
        QToolTip::add( Recen, tr( "Number of recently edited documents to show in the File menu" ) );
699
        QToolTip::add( Docs, tr( "Default documents directory" ) );
700
        QToolTip::add( ProPfad, tr( "Default ICC profiles directory" ) );
701
        QToolTip::add( ScriptPfad, tr( "Default Scripter scripts directory" ) );
702
        QToolTip::add( TemplateDir, tr( "Additional Directory for Document Templates" ) );
703
 
704
        QToolTip::add( GZComboF, tr( "Default page size, either a standard size or a custom size" ) );
705
        QToolTip::add( GZComboO, tr( "Default orientation of document pages" ) );
706
        QToolTip::add( pageWidth, tr( "Width of document pages, editable if you have chosen a custom page size" ) );
707
        QToolTip::add( pageHeight, tr( "Height of document pages, editable if you have chosen a custom page size" ) );
708
        QToolTip::add( facingPages, tr( "Enable single or spread based layout" ) );
709
        QToolTip::add( Linkszuerst, tr( "Make the first page the left page of a document" ) );
710
        QToolTip::add( TopR, tr( "Distance between the top margin guide and the edge of the page" ) );
711
        QToolTip::add( BottomR, tr( "Distance between the bottom margin guide and the edge of the page" ) );
712
        QToolTip::add( LeftR, tr( "Distance between the left margin guide and the edge of the page.\nIf Facing Pages is selected, this margin space can be used to achieve the correct margins for binding" ) );
713
        QToolTip::add( RightR, tr( "Distance between the right margin guide and the edge of the page.\nIf Facing Pages is selected, this margin space can be used to achieve the correct margins for binding" ) );
714
        QToolTip::add( ASon, tr( "When enabled, Scribus saves a backup copy of your file with the .bak extension\neach time the time period elapses" ) );
715
        QToolTip::add( ASTime, tr( "Time period between saving automatically" ) );
716
 
717
        QToolTip::add( urSpinBox, tr("Set the length of the action history in steps.\nIf set to 0 infinite amount of actions will be stored."));
718
 
719
        QToolTip::add( PreviewSize, tr( "Choose the size of the preview in the scrapbook palette" ) );
720
        QToolTip::add( SaveAtQuit, tr( "Save the scrapbook contents everytime after a change" ) );
721
 
722
        QToolTip::add( backColor, tr( "Color for paper" ) );
723
        QToolTip::add( checkUnprintable, tr( "Mask the area outside the margins in the margin color" ) );
724
        QToolTip::add( CaliSlider, tr( "Set the default zoom level" ) );
725
 
726
        QToolTip::add( GSName, tr( "Filesystem location for the Ghostscript interpreter" ) );
727
        QToolTip::add( GSantiText, tr( "Antialias text for EPS and PDF onscreen rendering" ) );
728
        QToolTip::add( GSantiGraph, tr( "Antialias graphics for EPS and PDF onscreen rendering" ) );
729
        QToolTip::add( GimpName, tr( "Filesystem location for graphics editor" ) );
730
 
731
        QToolTip::add( ClipMarg, tr( "Do not show objects outside the margins on the printed page or exported file" ) );
732
        QToolTip::add( DoGCR, tr( "A way of switching off some of the gray shades which are composed\n"
733
                                          "of cyan, yellow and magenta and using black instead.\n"
734
                                          "UCR most affects parts of images which are neutral and/or dark tones\n"
735
                                          "which are close to the gray. Use of this may improve printing some images\n"
736
                                          "and some experimentation and testing is need on a case by case basis.\n"
737
                                          "UCR reduces the possibility of over saturation with CMY inks." ) );
738
 
739
        // signals and slots connections
740
        connect( guiLangCombo, SIGNAL( activated( const QString & ) ), this, SLOT( setSelectedGUILang( const QString & ) ) );
741
        connect(backColor, SIGNAL(clicked()), this, SLOT(changePaperColor()));
742
        connect(UnitCombo, SIGNAL(activated(int)), this, SLOT(unitChange()));
743
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
744
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
745
        connect(TopR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
746
        connect(BottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
747
        connect(LeftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
748
        connect(RightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
749
        connect(GZComboO, SIGNAL(activated(int)), this, SLOT(setOrien(int)));
750
        connect(GZComboF, SIGNAL(activated(const QString &)), this, SLOT(setSize(const QString &)));
751
        connect(facingPages, SIGNAL(clicked()), this, SLOT(setDS()));
752
        connect(FileC, SIGNAL(clicked()), this, SLOT(changeDocs()));
753
        connect(FileC2, SIGNAL(clicked()), this, SLOT(changeProfs()));
754
        connect(FileC3, SIGNAL(clicked()), this, SLOT(changeScripts()));
755
        connect(FileC4, SIGNAL(clicked()), this, SLOT(changeTemplates()));
756
        connect(CaliSlider, SIGNAL(valueChanged(int)), this, SLOT(setDisScale()));
757
        connect(buttonOk, SIGNAL(clicked()), this, SLOT(setActionHistoryLength()));
758
        connect(pluginsList, SIGNAL(clicked(QListViewItem *, const QPoint &, int)),
759
                        this, SLOT(changePluginLoad(QListViewItem *, const QPoint &, int)));
760
        if (CMSavail)
761
                connect(tabColorManagement, SIGNAL(cmsOn(bool )), this, SLOT(switchCMS(bool )));
762
 
763
        setSize(prefsData->pageSize);
764
        setOrien(prefsData->pageOrientation);
765
 
766
        pageWidth->setValue(prefsData->PageWidth * Umrech);
767
        pageHeight->setValue(prefsData->PageHeight * Umrech);
768
 
769
        unitChange();
770
 
771
        prefsWidgets->raiseWidget(0);
772
        resize( minimumSizeHint() );
773
        arrangeIcons();
774
        clearWState( WState_Polished );
775
}
776
 
777
/*!
778
 \fn Preferences::~Preferences
779
 \author Franz Schmid
780
 \date
781
 \brief Destructor for Preferences dialog box
782
 \param None
783
 \retval None
784
 */
785
Preferences::~Preferences()
786
{
787
        // no need to delete child widgets, Qt does it all for us
788
}
789
 
790
 
791
/*!
792
 \fn void Preferences::ChangeDocs()
793
 \author Franz Schmid
794
 \date
795
 \brief Runs QFileDialog to get Preferences (General) Path to Documents directory
796
 \param None
797
 \retval None
798
 */
799
void Preferences::changeDocs()
800
{
801
        QString s = QFileDialog::getExistingDirectory(Docs->text(), this, "d", tr("Choose a Directory"), true);
802
        if (s != "")
803
                Docs->setText(s);
804
}
805
 
806
/*!
807
 \fn void Preferences::ChangeProfs()
808
 \author Franz Schmid
809
 \date
810
 \brief Runs QFileDialog to get Preferences (General) Path to Colour Profiles directory
811
 \param None
812
 \retval None
813
 */
814
void Preferences::changeProfs()
815
{
816
        QString s = QFileDialog::getExistingDirectory(ProPfad->text(), this, "d", tr("Choose a Directory"), true);
817
        if (s != "")
818
                ProPfad->setText(s);
819
}
820
 
821
/*!
822
 \fn void Preferences::ChangeScripts()
823
 \author Franz Schmid
824
 \date
825
 \brief Runs QFileDialog to get Preferences (General) Path to Scripts directory
826
 \param None
827
 \retval None
828
 */
829
void Preferences::changeScripts()
830
{
831
        QString s = QFileDialog::getExistingDirectory(ScriptPfad->text(), this, "d", tr("Choose a Directory"), true);
832
        if (s != "")
833
                ScriptPfad->setText(s);
834
}
835
 
836
/*!
837
 \fn void Preferences::ChangeTemplates()
838
 \author Riku Leino
839
 \date
840
 \brief Runs QFileDialog to get Preferences (General) Path to Templates directory
841
 \param None
842
 \retval None
843
 */
844
void Preferences::changeTemplates()
845
{
846
        QString s = QFileDialog::getExistingDirectory(TemplateDir->text(), this, "d", tr("Choose a Directory"), true);
847
        if (s != "")
848
                TemplateDir->setText(s);
849
}
850
 
851
/*!
852
 \fn void Preferences::setDS()
853
 \author Franz Schmid
854
 \date
855
 \brief Preferences (Document / Page Size), switches default between Facing Pages and swaps text labels for margin guides
856
 \param None
857
 \retval None
858
 */
859
void Preferences::setDS()
860
{
861
        bool m = facingPages->isChecked() ? true : false;
862
        GRText3->setText(m == true ? tr( "&Inside:" ) : tr( "&Left:" ));
863
        GRText4->setText(m == true ? tr( "O&utside:" ) : tr( "&Right:" ));
864
        Linkszuerst->setEnabled(m);
865
        if (m == false)
866
                Linkszuerst->setChecked(false);
867
}
868
 
869
/*!
870
 \fn void Preferences::setPageWidth(int v)
871
 \author Franz Schmid
872
 \date
873
 \brief Preferences (Document / Page Size), sets Page width values
874
 \param v Width value
875
 \retval None
876
 */
877
void Preferences::setPageWidth(int)
878
{
879
        Pagebr = pageWidth->value() / Umrech;
880
        RightR->setMaxValue(pageWidth->value() - LeftR->value());
881
        LeftR->setMaxValue(pageWidth->value() - RightR->value());
882
        TopR->setMaxValue(pageHeight->value() - BottomR->value());
883
        BottomR->setMaxValue(pageHeight->value() - TopR->value());
884
}
885
 
886
/*!
887
 \fn void Preferences::setPageHeight(int v)
888
 \author Franz Schmid
889
 \date
890
 \brief Preferences (Document / Page Size), sets Page height values
891
 \param v Height value
892
 \retval None
893
 */
894
void Preferences::setPageHeight(int)
895
{
896
        Pageho = pageHeight->value() / Umrech;
897
        RightR->setMaxValue(pageWidth->value() - LeftR->value());
898
        LeftR->setMaxValue(pageWidth->value() - RightR->value());
899
        TopR->setMaxValue(pageHeight->value() - BottomR->value());
900
        BottomR->setMaxValue(pageHeight->value() - TopR->value());
901
}
902
 
903
/*!
904
 \fn void Preferences::setTop(int v)
905
 \author Franz Schmid
906
 \date
907
 \brief Preferences (Document / Page Size), sets Page top values
908
 \param v Top value
909
 \retval None
910
 */
911
void Preferences::setTop(int)
912
{
913
        RandT = TopR->value() / Umrech;
914
        BottomR->setMaxValue(pageHeight->value() - TopR->value());
915
}
916
 
917
/*!
918
 \fn void Preferences::setBottom(int v)
919
 \author Franz Schmid
920
 \date
921
 \brief Preferences (Document / Page Size), sets Page bottom values
922
 \param v Bottom value
923
 \retval None
924
 */
925
void Preferences::setBottom(int)
926
{
927
        RandB = BottomR->value() / Umrech;
928
        TopR->setMaxValue(pageHeight->value() - BottomR->value());
929
}
930
 
931
/*!
932
 \fn void Preferences::setLeft(int v)
933
 \author Franz Schmid
934
 \date
935
 \brief Preferences (Document / Page Size), sets Page left values
936
 \param v Top value
937
 \retval None
938
 */
939
void Preferences::setLeft(int)
940
{
941
        RandL = LeftR->value() / Umrech;
942
        RightR->setMaxValue(pageWidth->value() - LeftR->value());
943
}
944
 
945
/*!
946
 \fn void Preferences::setRight(int v)
947
 \author Franz Schmid
948
 \date
949
 \brief Preferences (Document / Page Size), sets Page right values
950
 \param v Right value
951
 \retval None
952
 */
953
void Preferences::setRight(int)
954
{
955
        RandR = RightR->value() / Umrech;
956
        LeftR->setMaxValue(pageWidth->value() - RightR->value());
957
}
958
 
959
/*!
960
 \fn void Preferences::setSize(QString gr)
961
 \author Franz Schmid
962
 \date
963
 \brief Preferences (Document / Page Size), sets Page size values. Connects signals for setting page dimensions.
964
 \param gr Standard page size value (eg A4)
965
 \retval None
966
 */
967
void Preferences::setSize(const QString & gr)
968
{
969
        Pagebr = pageWidth->value() / Umrech;
970
        Pageho = pageHeight->value() / Umrech;
971
        pageWidth->setEnabled(false);
972
        pageHeight->setEnabled(false);
973
        PageSize *ps2=new PageSize(gr);
974
 
975
        prefsPageSizeName=ps2->getPageName();
976
        if (gr==tr("Custom"))
977
        {
978
                pageWidth->setEnabled(true);
979
                pageHeight->setEnabled(true);
980
        }
981
        else
982
        {
983
                Pagebr = ps2->getPageWidth();
984
                Pageho = ps2->getPageHeight();
985
        }
986
        disconnect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
987
        disconnect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
988
        pageWidth->setValue(Pagebr * Umrech);
989
        pageHeight->setValue(Pageho * Umrech);
990
        RightR->setMaxValue(pageWidth->value() - LeftR->value());
991
        LeftR->setMaxValue(pageWidth->value() - RightR->value());
992
        TopR->setMaxValue(pageHeight->value() - BottomR->value());
993
        BottomR->setMaxValue(pageHeight->value() - TopR->value());
994
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
995
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
996
}
997
 
998
/*!
999
 \fn void Preferences::setOrien(int ori)
1000
 \author Franz Schmid
1001
 \date
1002
 \brief Preferences (Document / Page Size), sets Page orientation value and page dimensions
1003
 \param ori Orientation value
1004
 \retval None
1005
 */
1006
void Preferences::setOrien(int ori)
1007
{
1008
        double br;
1009
        setSize(GZComboF->currentText());
1010
        disconnect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1011
        disconnect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1012
        if (ori == 0)
1013
        {
1014
                //if (GZComboF->currentItem() == 30)
1015
                if (GZComboF->currentText() == tr("Custom"))
1016
                {
1017
                        br = pageWidth->value();
1018
                        pageWidth->setValue(pageHeight->value());
1019
                        pageHeight->setValue(br);
1020
                }
1021
        }
1022
        else
1023
        {
1024
                br = pageWidth->value();
1025
                pageWidth->setValue(pageHeight->value());
1026
                pageHeight->setValue(br);
1027
        }
1028
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1029
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1030
}
1031
 
1032
/*!
1033
 \fn void Preferences::changePaperColor()
1034
 \author Franz Schmid
1035
 \date
1036
 \brief Preferences ([dox?], [dox?]), Sets Paper color [dox?]
1037
 \param None
1038
 \retval None
1039
 */
1040
void Preferences::changePaperColor()
1041
{
1042
        QColor neu = QColor();
1043
        neu = QColorDialog::getColor(colorPaper, this);
1044
        if (neu.isValid())
1045
        {
1046
                QPixmap pm = QPixmap(54, 14);
1047
                pm.fill(neu);
1048
                colorPaper = neu;
1049
                backColor->setPixmap(pm);
1050
        }
1051
}
1052
 
1053
/*!
1054
 \fn void Preferences::UnitChange()
1055
 \author Franz Schmid
1056
 \date
1057
 \brief Preferences (General, Units). Sets scaling factors and units descriptions when default units are changed. Updates preference values
1058
 \param None
1059
 \retval None
1060
 */
1061
void Preferences::unitChange()
1062
{
1063
        disconnect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1064
        disconnect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1065
        disconnect(TopR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
1066
        disconnect(BottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
1067
        disconnect(LeftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
1068
        disconnect(RightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
1069
        int decimals;
1070
        double AltUmrech = Umrech;
1071
        double oldMin, oldMax, oldB, oldBM, oldH, oldHM, val;
1072
        pageWidth->getValues(&oldB, &oldBM, &decimals, &val);
1073
        oldB /= AltUmrech;
1074
        oldBM /= AltUmrech;
1075
        pageHeight->getValues(&oldH, &oldHM, &decimals, &val);
1076
        oldH /= AltUmrech;
1077
        oldHM /= AltUmrech;
1078
        QString einh;
1079
        docUnitIndex = UnitCombo->currentItem();
1080
        Umrech = unitGetRatioFromIndex(docUnitIndex);
1081
        decimals = unitGetDecimalsFromIndex(docUnitIndex);
1082
        einh = unitGetSuffixFromIndex(docUnitIndex);
1083
 
1084
        pageWidth->setSuffix(einh);
1085
        pageHeight->setSuffix(einh);
1086
        TopR->setSuffix(einh);
1087
        BottomR->setSuffix(einh);
1088
        LeftR->setSuffix(einh);
1089
        RightR->setSuffix(einh);
1090
        tabGuides->minorSpace->setSuffix(einh);
1091
        tabGuides->majorSpace->setSuffix(einh);
1092
        tabGuides->snapDistance->setSuffix(einh);
1093
        tabGuides->baseGrid->setSuffix(einh);
1094
        tabGuides->baseOffset->setSuffix(einh);
1095
        tabTools->gapText->setSuffix(einh);
1096
        topScratch->setSuffix(einh);
1097
        bottomScratch->setSuffix(einh);
1098
        leftScratch->setSuffix(einh);
1099
        rightScratch->setSuffix(einh);
1100
        tabPDF->BleedBottom->setSuffix(einh);
1101
        tabPDF->BleedTop->setSuffix(einh);
1102
        tabPDF->BleedRight->setSuffix(einh);
1103
        tabPDF->BleedLeft->setSuffix(einh);
1104
        pageWidth->setValues(oldB * Umrech, oldBM * Umrech, decimals, Pagebr * Umrech);
1105
        pageHeight->setValues(oldH * Umrech, oldHM * Umrech, decimals, Pageho * Umrech);
1106
        TopR->setValues(0, pageHeight->value() - RandB * Umrech, decimals, RandT * Umrech);
1107
        BottomR->setValues(0, pageHeight->value() - RandT * Umrech, decimals, RandB * Umrech);
1108
        LeftR->setValues(0, pageWidth->value() - RandR * Umrech, decimals, RandL * Umrech);
1109
        RightR->setValues(0, pageWidth->value() - RandL * Umrech, decimals, RandR * Umrech);
1110
        int decimalsOld;
1111
        double invUnitConversion = 1.0 / AltUmrech * Umrech;
1112
        tabGuides->minorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1113
        tabGuides->minorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1114
        tabGuides->majorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1115
        tabGuides->majorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1116
        tabGuides->snapDistance->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1117
        tabGuides->snapDistance->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1118
        tabGuides->baseGrid->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1119
        tabGuides->baseGrid->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1120
        tabGuides->baseOffset->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1121
        tabGuides->baseOffset->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1122
        tabTools->gapText->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1123
        tabTools->gapText->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1124
        topScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1125
        topScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1126
        bottomScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1127
        bottomScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1128
        leftScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1129
        leftScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1130
        rightScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1131
        rightScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1132
        tabPDF->BleedBottom->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1133
        tabPDF->BleedBottom->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1134
        tabPDF->BleedTop->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1135
        tabPDF->BleedTop->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1136
        tabPDF->BleedRight->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1137
        tabPDF->BleedRight->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1138
        tabPDF->BleedLeft->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1139
        tabPDF->BleedLeft->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1140
        tabPDF->unitConv = Umrech;
1141
        drawRuler();
1142
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1143
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1144
        connect(TopR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
1145
        connect(BottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
1146
        connect(LeftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
1147
        connect(RightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
1148
}
1149
 
1150
/*!
1151
 \fn void Preferences::SetDisScale()
1152
 \author Franz Schmid
1153
 \date
1154
 \brief Preferences (Display, Display Size). Sets Scale for ruler scale
1155
 \param None
1156
 \retval None
1157
 */
1158
void Preferences::setDisScale()
1159
{
1160
        DisScale = QMAX((100.0 + CaliSlider->value()) / 100.0, 0.01);
1161
        drawRuler();
1162
        CaliAnz->setText(QString::number(DisScale*100, 'f', 2)+" %");
1163
}
1164
 
1165
/*!
1166
 \fn void Preferences::DrawRuler()
1167
 \author Franz Schmid
1168
 \date
1169
 \brief Preferences (Display, Display Size). Draws ruler depending on scaling factor
1170
 \param None
1171
 \retval None
1172
 */
1173
void Preferences::drawRuler()
1174
{
1175
        double xl, iter, iter2, maxi;
1176
        switch (docUnitIndex)
1177
        {
1178
        case 0:
1179
                iter = 10.0;
1180
                iter2 = iter * 10.0;
1181
                maxi = 200.0;
1182
                break;
1183
        case 1:
1184
                iter = (10.0 / 25.4) * 72.0;
1185
                iter2 = iter * 10.0;
1186
                maxi = iter2;
1187
                break;
1188
        case 2:
1189
                iter = 18.0;
1190
                iter2 = 72.0;
1191
                maxi = 2 * iter2;
1192
                break;
1193
        case 3:
1194
                iter = 12.0;
1195
                iter2 = 120.0;
1196
                maxi = 240.0;
1197
                break;
1198
        default:
1199
                iter = 10.0;
1200
                iter2 = iter * 10.0;
1201
                maxi = 200.0;
1202
                break;
1203
        }
1204
 
1205
        QPixmap pm(static_cast<int>(maxi*DisScale+30), 21);
1206
        pm.fill();
1207
        QPainter p;
1208
        p.begin(&pm);
1209
        p.drawLine(0, 19, width(), 19);
1210
        p.setBrush(black);
1211
        p.setPen(black);
1212
        p.scale(DisScale, 1.0);
1213
        for (xl = 0; xl < maxi; xl += iter)
1214
                p.drawLine(static_cast<int>(xl), 13, static_cast<int>(xl), 19);
1215
        for (xl = 0; xl < maxi+10; xl += iter2)
1216
        {
1217
                p.drawLine(static_cast<int>(xl), 6, static_cast<int>(xl), 19);
1218
                p.save();
1219
                p.scale(1.0 / DisScale, 1.0);
1220
                switch (docUnitIndex)
1221
                {
1222
                case 2:
1223
                        p.drawText(static_cast<int>((xl+qRound(2/DisScale)) * DisScale), 12,
1224
                                   QString::number(xl / iter2));
1225
                        break;
1226
                case 3:
1227
                        p.drawText(static_cast<int>((xl+qRound(2/DisScale)) * DisScale), 12,
1228
                                   QString::number(xl / iter));
1229
                        break;
1230
                default:
1231
                        p.drawText(static_cast<int>((xl+qRound(2/DisScale)) * DisScale), 12,
1232
                                   QString::number(xl / iter * 10));
1233
                        break;
1234
                }
1235
                p.restore();
1236
        }
1237
        p.end();
1238
        CaliRuler->setPixmap(pm);
1239
}
1240
/*
1241
QString Preferences::getSelectedGUILang( )
1242
{
1243
        return langMgr.getAbbrevFromLang(guiLangCombo->currentText());
1244
}
1245
*/
1246
void Preferences::setSelectedGUILang( const QString &newLang )
1247
{
1248
        selectedGUILang=langMgr.getAbbrevFromLang(newLang);
1249
}
1250
 
1251
void Preferences::setActionHistoryLength()
1252
{
1253
  UndoManager::instance()->setHistoryLength(urSpinBox->value());
1254
}
1255
 
1256
void Preferences::switchCMS(bool enable)
1257
{
1258
        tabPDF->enableCMS(enable);
1259
}
1260
 
1261
/*! Set selected item(=plugin) un/loadable (petr vanek) */
1262
void Preferences::changePluginLoad(QListViewItem *item, const QPoint &, int column)
1263
{
1264
        if (column != 3)
1265
                return;
1266
        if (item->text(3) == tr("Yes"))
1267
        {
1268
                item->setPixmap(3, loadIcon("DateiClos16.png"));
1269
                item->setText(3, tr("No"));
1270
                ap->pluginManager->pluginMap[item->text(4).toInt()].loadPlugin = false;
1271
        }
1272
        else
1273
        {
1274
                item->setPixmap(3, loadIcon("ok.png"));
1275
                item->setText(3, tr("Yes"));
1276
                ap->pluginManager->pluginMap[item->text(4).toInt()].loadPlugin = true;
1277
        }
1278
}