Subversion Repositories Scribus

Rev

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