Subversion Repositories Scribus

Rev

Rev 2150 | Rev 2217 | 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
 
2093 cbradney 166
        DocumentTemplateDir = new QLineEdit( GroupBox200, "Datei1" );
167
        DocumentTemplateDir->setMinimumSize( QSize( 268, 22 ) );
168
        DocumentTemplateDir->setText(prefsData->documentTemplatesDir);
169
        PfadText4 = new QLabel( DocumentTemplateDir, tr("Document T&emplates:"), GroupBox200, "Pfadtext1" );
1641 cbradney 170
        FileC4 = new QToolButton( GroupBox200, "FileC4" );
171
        FileC4->setMinimumSize( QSize( 88, 24 ) );
172
        FileC4->setText( tr( "Cha&nge..." ) );
173
        GroupBox200Layout->addWidget( PfadText4, 3, 0 );
2093 cbradney 174
        GroupBox200Layout->addWidget( DocumentTemplateDir, 3, 1 );
1641 cbradney 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 );
2189 cbradney 528
        QString unitSuffix = unitGetSuffixFromIndex(docUnitIndex);
529
        topScratch->setSuffix(unitSuffix);
530
        bottomScratch->setSuffix(unitSuffix);
531
        leftScratch->setSuffix(unitSuffix);
532
        rightScratch->setSuffix(unitSuffix);
1641 cbradney 533
        Rechtss = new QLabel(rightScratch, tr( "&Right:" ), groupScratch, "Rechts" );
534
        Layout4s->addWidget( Rechtss, 1, 2 );
535
        groupScratchLayout->addLayout( Layout4s );
536
        tabViewLayout->addWidget( groupScratch );
537
 
538
        CaliGroup = new QGroupBox( tr( "&Adjust Display Size" ), tabView, "CaliGroup" );
539
        CaliGroup->setColumnLayout(0, Qt::Vertical );
540
        CaliGroup->layout()->setSpacing( 6 );
541
        CaliGroup->layout()->setMargin( 11 );
542
        CaliGroupLayout = new QVBoxLayout( CaliGroup->layout() );
543
        CaliGroupLayout->setAlignment( Qt::AlignTop );
544
        CaliText = new QLabel( tr( "To adjust the display drag the ruler below with the Slider." ), CaliGroup, "CaliText" );
545
        CaliGroupLayout->addWidget( CaliText );
546
        CaliRuler = new QLabel( CaliGroup, "CaliRuler" );
547
        CaliRuler->setMinimumSize( QSize( 20, 20 ) );
548
        drawRuler();
549
        CaliRuler->setFrameShape( QLabel::Box );
550
        CaliRuler->setFrameShadow( QLabel::Sunken );
551
        CaliRuler->setScaledContents( false );
552
        CaliGroupLayout->addWidget( CaliRuler );
553
        layout15ca = new QHBoxLayout( 0, 0, 6, "layout15");
554
        CaliSlider = new QSlider( CaliGroup, "CaliSlider" );
555
        CaliSlider->setMinValue( -100 );
556
        CaliSlider->setMaxValue( 100 );
557
        CaliSlider->setValue(static_cast<int>(100 * DisScale)-100);
558
        CaliSlider->setOrientation( QSlider::Horizontal );
559
        CaliSlider->setTickmarks( QSlider::Right );
560
        CaliSlider->setTickInterval( 10 );
561
        CaliText->setBuddy(CaliGroup);
562
        layout15ca->addWidget( CaliSlider );
563
        CaliAnz = new QLabel( CaliGroup, "CaliAnz" );
564
        CaliAnz->setText(QString::number(DisScale*100, 'f', 2)+" %");
565
        layout15ca->addWidget( CaliAnz );
566
        CaliGroupLayout->addLayout( layout15ca );
567
        tabViewLayout->addWidget( CaliGroup );
568
        addItem( tr("Display"), loadIcon("screen.png"), tabView);
569
 
570
        ExtTool = new QWidget( prefsWidgets, "ExtTool" );
1878 cbradney 571
        ExtToolLayout = new QVBoxLayout( ExtTool, 0, 5, "ExtToolLayout");
1641 cbradney 572
        ExtToolLayout->setAlignment( Qt::AlignTop );
573
        groupGS = new QGroupBox( tr( "Postscript Interpreter" ), ExtTool, "groupGS" );
574
        groupGS->setColumnLayout(0, Qt::Vertical );
575
        groupGS->layout()->setSpacing( 6 );
576
        groupGS->layout()->setMargin( 10 );
577
        groupGSLayout = new QVBoxLayout( groupGS->layout() );
578
        groupGSLayout->setAlignment( Qt::AlignTop );
579
        GSlayout = new QHBoxLayout( 0, 0, 6, "GSlayout");
580
        GSName = new QLineEdit( groupGS, "GSName" );
581
        GSName->setText(prefsData->gs_exe);
582
        GSText = new QLabel( GSName, tr( "&Name of Executable:" ), groupGS, "GSText" );
583
        GSlayout->addWidget( GSText );
584
        GSlayout->addWidget( GSName );
585
        groupGSLayout->addLayout( GSlayout );
586
        GSantiText = new QCheckBox( tr( "Antialias &Text" ), groupGS, "GSantiText" );
587
        GSantiText->setChecked(prefsData->gs_AntiAliasText);
588
        groupGSLayout->addWidget( GSantiText );
589
        GSantiGraph = new QCheckBox( tr( "Antialias &Graphics" ), groupGS, "GSantiGraph" );
590
        GSantiGraph->setChecked(prefsData->gs_AntiAliasGraphics);
591
        groupGSLayout->addWidget( GSantiGraph );
592
        ExtToolLayout->addWidget( groupGS );
593
        groupGimp = new QGroupBox( tr( "Image Processing Tool" ), ExtTool, "groupGimp" );
594
        groupGimp->setColumnLayout(0, Qt::Vertical );
595
        groupGimp->layout()->setSpacing( 6 );
596
        groupGimp->layout()->setMargin( 10 );
597
        groupGimpLayout = new QHBoxLayout( groupGimp->layout() );
598
        groupGimpLayout->setAlignment( Qt::AlignTop );
599
        GimpName = new QLineEdit( groupGimp, "GimpName" );
2150 cbradney 600
        GimpName->setText(prefsData->imageEditorExecutable);
1641 cbradney 601
        GimpText = new QLabel( GimpName, tr( "Name of &Executable:" ), groupGimp, "GimpText" );
602
        groupGimpLayout->addWidget( GimpText );
603
        groupGimpLayout->addWidget( GimpName );
604
        ExtToolLayout->addWidget( groupGimp );
605
        QSpacerItem* spacer_gs = new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::Expanding );
606
        ExtToolLayout->addItem( spacer_gs );
1878 cbradney 607
        addItem(  tr("External Tools"), loadIcon("misc.png"), ExtTool);
1641 cbradney 608
 
609
        Misc = new QWidget( prefsWidgets, "Misc" );
1878 cbradney 610
        MiscLayout = new QVBoxLayout( Misc, 0, 5, "MiscLayout");
1641 cbradney 611
        MiscLayout->setAlignment( Qt::AlignTop );
612
        groupPrint = new QGroupBox( tr( "Printing" ), Misc, "groupPrint" );
613
        groupPrint->setColumnLayout(0, Qt::Vertical );
614
        groupPrint->layout()->setSpacing( 10 );
615
        groupPrint->layout()->setMargin( 10 );
616
        groupPrintLayout = new QVBoxLayout( groupPrint->layout() );
617
        groupPrintLayout->setAlignment( Qt::AlignTop );
618
        ClipMarg = new QCheckBox( tr( "Clip to Page &Margins" ), groupPrint, "ClipMarg" );
619
        ClipMarg->setChecked(prefsData->ClipMargin);
620
        groupPrintLayout->addWidget( ClipMarg );
621
        DoGCR = new QCheckBox( tr( "Apply &Under Color Removal" ), groupPrint, "ClipMarg" );
622
        DoGCR->setChecked(prefsData->GCRMode);
623
        groupPrintLayout->addWidget( DoGCR );
624
        MiscLayout->addWidget( groupPrint );
625
        AskForSubs = new QCheckBox( tr( "Always ask before Fonts are replaced when loading a Document" ), Misc, "askforSubs" );
626
        AskForSubs->setChecked(prefsData->askBeforeSubstituite);
627
        MiscLayout->addWidget( AskForSubs );
628
        QSpacerItem* spacer_3m = new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::Expanding );
629
        MiscLayout->addItem( spacer_3m );
1878 cbradney 630
        addItem(  tr("Miscellaneous"), loadIcon("misc.png"), Misc);
1641 cbradney 631
 
632
        // plugin manager. pv.
633
        pluginManagerWidget = new QWidget(prefsWidgets, "pluginManagerWidget");
1878 cbradney 634
        pluginMainLayout = new QVBoxLayout( pluginManagerWidget, 0, 5, "pluginMainLayout");
1641 cbradney 635
        pluginMainLayout->setAlignment( Qt::AlignTop );
636
        plugGroupBox = new QGroupBox(tr("Plugin Manager"), pluginManagerWidget, "plugGroupBox");
637
        plugGroupBox->setColumnLayout(0, Qt::Vertical);
638
        plugGroupBox->layout()->setSpacing(6);
639
        plugGroupBox->layout()->setMargin(11);
640
        plugGroupBoxLayout = new QGridLayout( plugGroupBox->layout() );
641
        plugGroupBoxLayout->setAlignment(Qt::AlignTop);
642
        plugLayout1 = new QVBoxLayout( 0, 0, 6, "plugLayout1");
643
        pluginsList = new QListView(plugGroupBox, "pluginsList");
644
        pluginsList->setAllColumnsShowFocus(true);
645
        pluginsList->setShowSortIndicator(true);
646
        pluginsList->addColumn(tr("Plugin"));
647
        pluginsList->setColumnWidthMode(0, QListView::Maximum);
648
        pluginsList->addColumn(tr("How to run"));
649
        pluginsList->setColumnWidthMode(1, QListView::Maximum);
650
        pluginsList->addColumn(tr("Type"));
651
        pluginsList->setColumnWidthMode(2, QListView::Maximum);
652
        pluginsList->addColumn(tr("Load it?"));
653
        pluginsList->setColumnWidthMode(3, QListView::Maximum);
654
        pluginsList->addColumn(tr("Plugin ID"));
655
        pluginsList->setColumnWidthMode(4, QListView::Maximum);
656
        pluginsList->addColumn(tr("File"));
657
        pluginsList->setColumnWidthMode(5, QListView::Maximum);
658
        for (QMap<int,PluginManager::PluginData>::Iterator it = ap->pluginManager->pluginMap.begin(); it != ap->pluginManager->pluginMap.end(); ++it)
659
        {
660
                QListViewItem *plugItem = new QListViewItem(pluginsList);
661
                plugItem->setText(0, (*it).name.replace('&', "").replace("...", "")); // name
662
                plugItem->setText(1, QString("%1 %2").arg((*it).actMenu).arg((*it).actMenuAfterName)); // menu path
663
                plugItem->setText(2, ap->pluginManager->getPluginType((*it).type)); // type
664
                // load at start?
665
                plugItem->setPixmap(3, (*it).loadPlugin ? loadIcon("ok.png") : loadIcon("DateiClos16.png"));
666
                plugItem->setText(3, (*it).loadPlugin ? tr("Yes") : tr("No"));
667
                plugItem->setText(4, QString("%1").arg(it.key())); // id for developers
668
                plugItem->setText(5, (*it).pluginFile); // file for developers
669
        }
670
        plugLayout1->addWidget(pluginsList);
671
        pluginWarning = new QLabel(plugGroupBox);
2018 mrdocs 672
        pluginWarning->setText("<qt>" + tr("You need to restart the application to apply the changes.") + "</qt>");
1641 cbradney 673
        plugLayout1->addWidget(pluginWarning);
674
        plugGroupBoxLayout->addLayout(plugLayout1, 0, 0);
675
        pluginMainLayout->addWidget(plugGroupBox);
676
        addItem(tr("Plugins"), loadIcon("plugins.png"), pluginManagerWidget);
677
 
678
        setDS();
679
        //tab order
680
        QWidget::setTabOrder( GFsize, SpinBox3 );
681
        QWidget::setTabOrder( SpinBox3, UnitCombo );
682
        QWidget::setTabOrder( UnitCombo, Recen );
683
        QWidget::setTabOrder( Recen, Docs );
684
        QWidget::setTabOrder( Docs, FileC );
685
        QWidget::setTabOrder( FileC, ProPfad );
686
        QWidget::setTabOrder( ProPfad, FileC2  );
687
        QWidget::setTabOrder( FileC2, ScriptPfad );
688
        QWidget::setTabOrder( ScriptPfad, FileC3 );
2093 cbradney 689
        QWidget::setTabOrder( FileC3, DocumentTemplateDir );
690
        QWidget::setTabOrder( DocumentTemplateDir, FileC4 );
1641 cbradney 691
 
692
 
693
        QWidget::setTabOrder( TopR, BottomR );
694
        QWidget::setTabOrder( BottomR, LeftR );
695
        QWidget::setTabOrder( LeftR, RightR );
696
 
697
        QWidget::setTabOrder( PreviewSize, SaveAtQuit );
698
 
2093 cbradney 699
        QToolTip::add( checkLink, tr("Turns the display of linked frames on or off"));
1641 cbradney 700
        QToolTip::add( checkFrame, tr("Turns the display of frames on or off"));
701
        QToolTip::add( checkPictures, tr("Turns the display of pictures on or off"));
702
        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" ) );
703
        QToolTip::add( GUICombo, tr( "Choose the default window decoration and looks.\nScribus inherits any available KDE or Qt themes" ) );
704
        QToolTip::add( GFsize, tr( "Default font size for the menus and windows" ) );
705
        QToolTip::add( UnitCombo, tr( "Default unit of measurement for document editing" ) );
706
        QToolTip::add( SpinBox3, tr( "Number of lines Scribus will scroll for each move of the mouse wheel" ) );
707
        QToolTip::add( Recen, tr( "Number of recently edited documents to show in the File menu" ) );
708
        QToolTip::add( Docs, tr( "Default documents directory" ) );
2018 mrdocs 709
        QToolTip::add( ProPfad, tr( "Default ICC profiles directory. This cannot\nbe changed with a document open." ) );
1641 cbradney 710
        QToolTip::add( ScriptPfad, tr( "Default Scripter scripts directory" ) );
2093 cbradney 711
        QToolTip::add( DocumentTemplateDir, "<qt>"+tr("Additional directory for document templates")+"</qt>" );
1641 cbradney 712
 
713
        QToolTip::add( GZComboF, tr( "Default page size, either a standard size or a custom size" ) );
714
        QToolTip::add( GZComboO, tr( "Default orientation of document pages" ) );
715
        QToolTip::add( pageWidth, tr( "Width of document pages, editable if you have chosen a custom page size" ) );
716
        QToolTip::add( pageHeight, tr( "Height of document pages, editable if you have chosen a custom page size" ) );
717
        QToolTip::add( facingPages, tr( "Enable single or spread based layout" ) );
718
        QToolTip::add( Linkszuerst, tr( "Make the first page the left page of a document" ) );
719
        QToolTip::add( TopR, tr( "Distance between the top margin guide and the edge of the page" ) );
720
        QToolTip::add( BottomR, tr( "Distance between the bottom margin guide and the edge of the page" ) );
721
        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" ) );
722
        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" ) );
723
        QToolTip::add( ASon, tr( "When enabled, Scribus saves a backup copy of your file with the .bak extension\neach time the time period elapses" ) );
724
        QToolTip::add( ASTime, tr( "Time period between saving automatically" ) );
725
 
726
        QToolTip::add( urSpinBox, tr("Set the length of the action history in steps.\nIf set to 0 infinite amount of actions will be stored."));
727
 
728
        QToolTip::add( PreviewSize, tr( "Choose the size of the preview in the scrapbook palette" ) );
729
        QToolTip::add( SaveAtQuit, tr( "Save the scrapbook contents everytime after a change" ) );
730
 
731
        QToolTip::add( backColor, tr( "Color for paper" ) );
732
        QToolTip::add( checkUnprintable, tr( "Mask the area outside the margins in the margin color" ) );
733
        QToolTip::add( CaliSlider, tr( "Set the default zoom level" ) );
734
 
735
        QToolTip::add( GSName, tr( "Filesystem location for the Ghostscript interpreter" ) );
736
        QToolTip::add( GSantiText, tr( "Antialias text for EPS and PDF onscreen rendering" ) );
737
        QToolTip::add( GSantiGraph, tr( "Antialias graphics for EPS and PDF onscreen rendering" ) );
1912 mrdocs 738
        QToolTip::add( GimpName, tr( "File system location for graphics editor. If you use gimp\n"
739
                                                "and your distro includes it, we recommend 'gimp-remote',\n"
740
                                                "as it allows you to edit the image in an already running\n"
741
                                                "instance of gimp." ) );
1641 cbradney 742
        QToolTip::add( ClipMarg, tr( "Do not show objects outside the margins on the printed page or exported file" ) );
743
        QToolTip::add( DoGCR, tr( "A way of switching off some of the gray shades which are composed\n"
744
                                          "of cyan, yellow and magenta and using black instead.\n"
745
                                          "UCR most affects parts of images which are neutral and/or dark tones\n"
746
                                          "which are close to the gray. Use of this may improve printing some images\n"
747
                                          "and some experimentation and testing is need on a case by case basis.\n"
748
                                          "UCR reduces the possibility of over saturation with CMY inks." ) );
749
 
750
        // signals and slots connections
751
        connect( guiLangCombo, SIGNAL( activated( const QString & ) ), this, SLOT( setSelectedGUILang( const QString & ) ) );
752
        connect(backColor, SIGNAL(clicked()), this, SLOT(changePaperColor()));
753
        connect(UnitCombo, SIGNAL(activated(int)), this, SLOT(unitChange()));
754
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
755
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
756
        connect(TopR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
757
        connect(BottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
758
        connect(LeftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
759
        connect(RightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
760
        connect(GZComboO, SIGNAL(activated(int)), this, SLOT(setOrien(int)));
761
        connect(GZComboF, SIGNAL(activated(const QString &)), this, SLOT(setSize(const QString &)));
762
        connect(facingPages, SIGNAL(clicked()), this, SLOT(setDS()));
763
        connect(FileC, SIGNAL(clicked()), this, SLOT(changeDocs()));
764
        connect(FileC2, SIGNAL(clicked()), this, SLOT(changeProfs()));
765
        connect(FileC3, SIGNAL(clicked()), this, SLOT(changeScripts()));
2093 cbradney 766
        connect(FileC4, SIGNAL(clicked()), this, SLOT(changeDocumentTemplates()));
1641 cbradney 767
        connect(CaliSlider, SIGNAL(valueChanged(int)), this, SLOT(setDisScale()));
768
        connect(buttonOk, SIGNAL(clicked()), this, SLOT(setActionHistoryLength()));
769
        connect(pluginsList, SIGNAL(clicked(QListViewItem *, const QPoint &, int)),
770
                        this, SLOT(changePluginLoad(QListViewItem *, const QPoint &, int)));
771
        if (CMSavail)
772
                connect(tabColorManagement, SIGNAL(cmsOn(bool )), this, SLOT(switchCMS(bool )));
773
 
774
        setSize(prefsData->pageSize);
775
        setOrien(prefsData->pageOrientation);
776
 
1790 cbradney 777
        pageWidth->setValue(prefsData->PageWidth * unitRatio);
778
        pageHeight->setValue(prefsData->PageHeight * unitRatio);
1641 cbradney 779
 
1790 cbradney 780
        //unitChange();
1641 cbradney 781
        resize( minimumSizeHint() );
782
        arrangeIcons();
1828 fschmid 783
        backToDefaults->hide();
1834 fschmid 784
        prefsSelection->setSelected(prefsSelection->firstItem(), true);
785
        itemSelected(prefsSelection->firstItem());
1641 cbradney 786
        clearWState( WState_Polished );
787
}
788
 
789
/*!
790
 \fn Preferences::~Preferences
791
 \author Franz Schmid
792
 \date
793
 \brief Destructor for Preferences dialog box
794
 \param None
795
 \retval None
796
 */
797
Preferences::~Preferences()
798
{
799
        // no need to delete child widgets, Qt does it all for us
800
}
801
 
802
 
803
/*!
804
 \fn void Preferences::ChangeDocs()
805
 \author Franz Schmid
806
 \date
807
 \brief Runs QFileDialog to get Preferences (General) Path to Documents directory
808
 \param None
809
 \retval None
810
 */
811
void Preferences::changeDocs()
812
{
813
        QString s = QFileDialog::getExistingDirectory(Docs->text(), this, "d", tr("Choose a Directory"), true);
814
        if (s != "")
815
                Docs->setText(s);
816
}
817
 
818
/*!
819
 \fn void Preferences::ChangeProfs()
820
 \author Franz Schmid
821
 \date
822
 \brief Runs QFileDialog to get Preferences (General) Path to Colour Profiles directory
823
 \param None
824
 \retval None
825
 */
826
void Preferences::changeProfs()
827
{
828
        QString s = QFileDialog::getExistingDirectory(ProPfad->text(), this, "d", tr("Choose a Directory"), true);
829
        if (s != "")
830
                ProPfad->setText(s);
831
}
832
 
833
/*!
834
 \fn void Preferences::ChangeScripts()
835
 \author Franz Schmid
836
 \date
837
 \brief Runs QFileDialog to get Preferences (General) Path to Scripts directory
838
 \param None
839
 \retval None
840
 */
841
void Preferences::changeScripts()
842
{
843
        QString s = QFileDialog::getExistingDirectory(ScriptPfad->text(), this, "d", tr("Choose a Directory"), true);
844
        if (s != "")
845
                ScriptPfad->setText(s);
846
}
847
 
848
/*!
2093 cbradney 849
 \fn void Preferences::ChangeDocumentTemplates()
1641 cbradney 850
 \author Riku Leino
851
 \date
2093 cbradney 852
 \brief Runs QFileDialog to get Preferences (General) Path to Document Templates directory
1641 cbradney 853
 \param None
854
 \retval None
855
 */
2093 cbradney 856
void Preferences::changeDocumentTemplates()
1641 cbradney 857
{
2093 cbradney 858
        QString s = QFileDialog::getExistingDirectory(DocumentTemplateDir->text(), this, "d", tr("Choose a Directory"), true);
1641 cbradney 859
        if (s != "")
2093 cbradney 860
                DocumentTemplateDir->setText(s);
1641 cbradney 861
}
862
 
863
/*!
864
 \fn void Preferences::setDS()
865
 \author Franz Schmid
866
 \date
867
 \brief Preferences (Document / Page Size), switches default between Facing Pages and swaps text labels for margin guides
868
 \param None
869
 \retval None
870
 */
871
void Preferences::setDS()
872
{
873
        bool m = facingPages->isChecked() ? true : false;
874
        GRText3->setText(m == true ? tr( "&Inside:" ) : tr( "&Left:" ));
875
        GRText4->setText(m == true ? tr( "O&utside:" ) : tr( "&Right:" ));
876
        Linkszuerst->setEnabled(m);
877
        if (m == false)
878
                Linkszuerst->setChecked(false);
879
}
880
 
881
/*!
882
 \fn void Preferences::setPageWidth(int v)
883
 \author Franz Schmid
884
 \date
885
 \brief Preferences (Document / Page Size), sets Page width values
886
 \param v Width value
887
 \retval None
888
 */
889
void Preferences::setPageWidth(int)
890
{
1790 cbradney 891
        Pagebr = pageWidth->value() / unitRatio;
1641 cbradney 892
        RightR->setMaxValue(pageWidth->value() - LeftR->value());
893
        LeftR->setMaxValue(pageWidth->value() - RightR->value());
894
        TopR->setMaxValue(pageHeight->value() - BottomR->value());
895
        BottomR->setMaxValue(pageHeight->value() - TopR->value());
896
}
897
 
898
/*!
899
 \fn void Preferences::setPageHeight(int v)
900
 \author Franz Schmid
901
 \date
902
 \brief Preferences (Document / Page Size), sets Page height values
903
 \param v Height value
904
 \retval None
905
 */
906
void Preferences::setPageHeight(int)
907
{
1790 cbradney 908
        Pageho = pageHeight->value() / unitRatio;
1641 cbradney 909
        RightR->setMaxValue(pageWidth->value() - LeftR->value());
910
        LeftR->setMaxValue(pageWidth->value() - RightR->value());
911
        TopR->setMaxValue(pageHeight->value() - BottomR->value());
912
        BottomR->setMaxValue(pageHeight->value() - TopR->value());
913
}
914
 
915
/*!
916
 \fn void Preferences::setTop(int v)
917
 \author Franz Schmid
918
 \date
919
 \brief Preferences (Document / Page Size), sets Page top values
920
 \param v Top value
921
 \retval None
922
 */
923
void Preferences::setTop(int)
924
{
1790 cbradney 925
        RandT = TopR->value() / unitRatio;
1641 cbradney 926
        BottomR->setMaxValue(pageHeight->value() - TopR->value());
927
}
928
 
929
/*!
930
 \fn void Preferences::setBottom(int v)
931
 \author Franz Schmid
932
 \date
933
 \brief Preferences (Document / Page Size), sets Page bottom values
934
 \param v Bottom value
935
 \retval None
936
 */
937
void Preferences::setBottom(int)
938
{
1790 cbradney 939
        RandB = BottomR->value() / unitRatio;
1641 cbradney 940
        TopR->setMaxValue(pageHeight->value() - BottomR->value());
941
}
942
 
943
/*!
944
 \fn void Preferences::setLeft(int v)
945
 \author Franz Schmid
946
 \date
947
 \brief Preferences (Document / Page Size), sets Page left values
948
 \param v Top value
949
 \retval None
950
 */
951
void Preferences::setLeft(int)
952
{
1790 cbradney 953
        RandL = LeftR->value() / unitRatio;
1641 cbradney 954
        RightR->setMaxValue(pageWidth->value() - LeftR->value());
955
}
956
 
957
/*!
958
 \fn void Preferences::setRight(int v)
959
 \author Franz Schmid
960
 \date
961
 \brief Preferences (Document / Page Size), sets Page right values
962
 \param v Right value
963
 \retval None
964
 */
965
void Preferences::setRight(int)
966
{
1790 cbradney 967
        RandR = RightR->value() / unitRatio;
1641 cbradney 968
        LeftR->setMaxValue(pageWidth->value() - RightR->value());
969
}
970
 
971
/*!
972
 \fn void Preferences::setSize(QString gr)
973
 \author Franz Schmid
974
 \date
975
 \brief Preferences (Document / Page Size), sets Page size values. Connects signals for setting page dimensions.
976
 \param gr Standard page size value (eg A4)
977
 \retval None
978
 */
979
void Preferences::setSize(const QString & gr)
980
{
1790 cbradney 981
        Pagebr = pageWidth->value() / unitRatio;
982
        Pageho = pageHeight->value() / unitRatio;
1641 cbradney 983
        pageWidth->setEnabled(false);
984
        pageHeight->setEnabled(false);
985
        PageSize *ps2=new PageSize(gr);
986
 
987
        prefsPageSizeName=ps2->getPageName();
988
        if (gr==tr("Custom"))
989
        {
990
                pageWidth->setEnabled(true);
991
                pageHeight->setEnabled(true);
992
        }
993
        else
994
        {
995
                Pagebr = ps2->getPageWidth();
996
                Pageho = ps2->getPageHeight();
997
        }
998
        disconnect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
999
        disconnect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1790 cbradney 1000
        pageWidth->setValue(Pagebr * unitRatio);
1001
        pageHeight->setValue(Pageho * unitRatio);
1641 cbradney 1002
        RightR->setMaxValue(pageWidth->value() - LeftR->value());
1003
        LeftR->setMaxValue(pageWidth->value() - RightR->value());
1004
        TopR->setMaxValue(pageHeight->value() - BottomR->value());
1005
        BottomR->setMaxValue(pageHeight->value() - TopR->value());
1006
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1007
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1008
}
1009
 
1010
/*!
1011
 \fn void Preferences::setOrien(int ori)
1012
 \author Franz Schmid
1013
 \date
1014
 \brief Preferences (Document / Page Size), sets Page orientation value and page dimensions
1015
 \param ori Orientation value
1016
 \retval None
1017
 */
1018
void Preferences::setOrien(int ori)
1019
{
1020
        double br;
1021
        setSize(GZComboF->currentText());
1022
        disconnect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1023
        disconnect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1024
        if (ori == 0)
1025
        {
1026
                //if (GZComboF->currentItem() == 30)
1027
                if (GZComboF->currentText() == tr("Custom"))
1028
                {
1029
                        br = pageWidth->value();
1030
                        pageWidth->setValue(pageHeight->value());
1031
                        pageHeight->setValue(br);
1032
                }
1033
        }
1034
        else
1035
        {
1036
                br = pageWidth->value();
1037
                pageWidth->setValue(pageHeight->value());
1038
                pageHeight->setValue(br);
1039
        }
1040
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1041
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1042
}
1043
 
1044
/*!
1045
 \fn void Preferences::changePaperColor()
1046
 \author Franz Schmid
1047
 \date
1048
 \brief Preferences ([dox?], [dox?]), Sets Paper color [dox?]
1049
 \param None
1050
 \retval None
1051
 */
1052
void Preferences::changePaperColor()
1053
{
1054
        QColor neu = QColor();
1055
        neu = QColorDialog::getColor(colorPaper, this);
1056
        if (neu.isValid())
1057
        {
1058
                QPixmap pm = QPixmap(54, 14);
1059
                pm.fill(neu);
1060
                colorPaper = neu;
1061
                backColor->setPixmap(pm);
1062
        }
1063
}
1064
 
1065
/*!
1066
 \fn void Preferences::UnitChange()
1067
 \author Franz Schmid
1068
 \date
1069
 \brief Preferences (General, Units). Sets scaling factors and units descriptions when default units are changed. Updates preference values
1070
 \param None
1071
 \retval None
1072
 */
1073
void Preferences::unitChange()
1074
{
1075
        disconnect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1076
        disconnect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1077
        disconnect(TopR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
1078
        disconnect(BottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
1079
        disconnect(LeftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
1080
        disconnect(RightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
1081
        int decimals;
1790 cbradney 1082
        double oldUnitRatio = unitRatio;
1641 cbradney 1083
        double oldMin, oldMax, oldB, oldBM, oldH, oldHM, val;
1084
        pageWidth->getValues(&oldB, &oldBM, &decimals, &val);
1790 cbradney 1085
        oldB /= oldUnitRatio;
1086
        oldBM /= oldUnitRatio;
1641 cbradney 1087
        pageHeight->getValues(&oldH, &oldHM, &decimals, &val);
1790 cbradney 1088
        oldH /= oldUnitRatio;
1089
        oldHM /= oldUnitRatio;
1641 cbradney 1090
        QString einh;
1091
        docUnitIndex = UnitCombo->currentItem();
1790 cbradney 1092
        unitRatio = unitGetRatioFromIndex(docUnitIndex);
1641 cbradney 1093
        decimals = unitGetDecimalsFromIndex(docUnitIndex);
1094
        einh = unitGetSuffixFromIndex(docUnitIndex);
1095
 
1096
        pageWidth->setSuffix(einh);
1097
        pageHeight->setSuffix(einh);
1098
        TopR->setSuffix(einh);
1099
        BottomR->setSuffix(einh);
1100
        LeftR->setSuffix(einh);
1101
        RightR->setSuffix(einh);
1102
        tabGuides->minorSpace->setSuffix(einh);
1103
        tabGuides->majorSpace->setSuffix(einh);
1104
        tabGuides->snapDistance->setSuffix(einh);
1105
        tabGuides->baseGrid->setSuffix(einh);
1106
        tabGuides->baseOffset->setSuffix(einh);
1107
        tabTools->gapText->setSuffix(einh);
1108
        topScratch->setSuffix(einh);
1109
        bottomScratch->setSuffix(einh);
1110
        leftScratch->setSuffix(einh);
1111
        rightScratch->setSuffix(einh);
1112
        tabPDF->BleedBottom->setSuffix(einh);
1113
        tabPDF->BleedTop->setSuffix(einh);
1114
        tabPDF->BleedRight->setSuffix(einh);
1115
        tabPDF->BleedLeft->setSuffix(einh);
1790 cbradney 1116
        pageWidth->setValues(oldB * unitRatio, oldBM * unitRatio, decimals, Pagebr * unitRatio);
1117
        pageHeight->setValues(oldH * unitRatio, oldHM * unitRatio, decimals, Pageho * unitRatio);
1118
        TopR->setValues(0, pageHeight->value() - RandB * unitRatio, decimals, RandT * unitRatio);
1119
        BottomR->setValues(0, pageHeight->value() - RandT * unitRatio, decimals, RandB * unitRatio);
1120
        LeftR->setValues(0, pageWidth->value() - RandR * unitRatio, decimals, RandL * unitRatio);
1121
        RightR->setValues(0, pageWidth->value() - RandL * unitRatio, decimals, RandR * unitRatio);
1641 cbradney 1122
        int decimalsOld;
1790 cbradney 1123
        double invUnitConversion = 1.0 / oldUnitRatio * unitRatio;
1124
 
1641 cbradney 1125
        tabGuides->minorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1126
        tabGuides->minorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1127
        tabGuides->majorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1128
        tabGuides->majorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1129
        tabGuides->snapDistance->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1130
        tabGuides->snapDistance->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1131
        tabGuides->baseGrid->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1132
        tabGuides->baseGrid->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1133
        tabGuides->baseOffset->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1134
        tabGuides->baseOffset->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1135
        tabTools->gapText->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1136
        tabTools->gapText->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1137
        topScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1138
        topScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1139
        bottomScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1140
        bottomScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1141
        leftScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1142
        leftScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1143
        rightScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1144
        rightScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1145
        tabPDF->BleedBottom->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1146
        tabPDF->BleedBottom->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1147
        tabPDF->BleedTop->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1148
        tabPDF->BleedTop->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1149
        tabPDF->BleedRight->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1150
        tabPDF->BleedRight->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1151
        tabPDF->BleedLeft->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1152
        tabPDF->BleedLeft->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1790 cbradney 1153
        tabPDF->unitRatio = unitRatio;
1641 cbradney 1154
        drawRuler();
1155
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1156
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1157
        connect(TopR, SIGNAL(valueChanged(int)), this, SLOT(setTop(int)));
1158
        connect(BottomR, SIGNAL(valueChanged(int)), this, SLOT(setBottom(int)));
1159
        connect(LeftR, SIGNAL(valueChanged(int)), this, SLOT(setLeft(int)));
1160
        connect(RightR, SIGNAL(valueChanged(int)), this, SLOT(setRight(int)));
1161
}
1162
 
1163
/*!
1164
 \fn void Preferences::SetDisScale()
1165
 \author Franz Schmid
1166
 \date
1167
 \brief Preferences (Display, Display Size). Sets Scale for ruler scale
1168
 \param None
1169
 \retval None
1170
 */
1171
void Preferences::setDisScale()
1172
{
1173
        DisScale = QMAX((100.0 + CaliSlider->value()) / 100.0, 0.01);
1174
        drawRuler();
1175
        CaliAnz->setText(QString::number(DisScale*100, 'f', 2)+" %");
1176
}
1177
 
1178
/*!
1179
 \fn void Preferences::DrawRuler()
1180
 \author Franz Schmid
1181
 \date
1182
 \brief Preferences (Display, Display Size). Draws ruler depending on scaling factor
1183
 \param None
1184
 \retval None
1185
 */
1186
void Preferences::drawRuler()
1187
{
1188
        double xl, iter, iter2, maxi;
1189
        switch (docUnitIndex)
1190
        {
1191
        case 0:
1192
                iter = 10.0;
1193
                iter2 = iter * 10.0;
1194
                maxi = 200.0;
1195
                break;
1196
        case 1:
1197
                iter = (10.0 / 25.4) * 72.0;
1198
                iter2 = iter * 10.0;
1199
                maxi = iter2;
1200
                break;
1201
        case 2:
1202
                iter = 18.0;
1203
                iter2 = 72.0;
1204
                maxi = 2 * iter2;
1205
                break;
1206
        case 3:
1207
                iter = 12.0;
1208
                iter2 = 120.0;
1209
                maxi = 240.0;
1210
                break;
1211
        default:
1212
                iter = 10.0;
1213
                iter2 = iter * 10.0;
1214
                maxi = 200.0;
1215
                break;
1216
        }
1217
 
1218
        QPixmap pm(static_cast<int>(maxi*DisScale+30), 21);
1219
        pm.fill();
1220
        QPainter p;
1221
        p.begin(&pm);
1222
        p.drawLine(0, 19, width(), 19);
1223
        p.setBrush(black);
1224
        p.setPen(black);
1225
        p.scale(DisScale, 1.0);
1226
        for (xl = 0; xl < maxi; xl += iter)
1227
                p.drawLine(static_cast<int>(xl), 13, static_cast<int>(xl), 19);
1228
        for (xl = 0; xl < maxi+10; xl += iter2)
1229
        {
1230
                p.drawLine(static_cast<int>(xl), 6, static_cast<int>(xl), 19);
1231
                p.save();
1232
                p.scale(1.0 / DisScale, 1.0);
1233
                switch (docUnitIndex)
1234
                {
1235
                case 2:
1236
                        p.drawText(static_cast<int>((xl+qRound(2/DisScale)) * DisScale), 12,
1237
                                   QString::number(xl / iter2));
1238
                        break;
1239
                case 3:
1240
                        p.drawText(static_cast<int>((xl+qRound(2/DisScale)) * DisScale), 12,
1241
                                   QString::number(xl / iter));
1242
                        break;
1243
                default:
1244
                        p.drawText(static_cast<int>((xl+qRound(2/DisScale)) * DisScale), 12,
1245
                                   QString::number(xl / iter * 10));
1246
                        break;
1247
                }
1248
                p.restore();
1249
        }
1250
        p.end();
1251
        CaliRuler->setPixmap(pm);
1252
}
1253
/*
1254
QString Preferences::getSelectedGUILang( )
1255
{
1256
        return langMgr.getAbbrevFromLang(guiLangCombo->currentText());
1257
}
1258
*/
1259
void Preferences::setSelectedGUILang( const QString &newLang )
1260
{
1261
        selectedGUILang=langMgr.getAbbrevFromLang(newLang);
1262
}
1263
 
1264
void Preferences::setActionHistoryLength()
1265
{
1266
  UndoManager::instance()->setHistoryLength(urSpinBox->value());
1267
}
1268
 
1269
void Preferences::switchCMS(bool enable)
1270
{
1271
        tabPDF->enableCMS(enable);
1272
}
1273
 
1274
/*! Set selected item(=plugin) un/loadable (petr vanek) */
1275
void Preferences::changePluginLoad(QListViewItem *item, const QPoint &, int column)
1276
{
1277
        if (column != 3)
1278
                return;
1279
        if (item->text(3) == tr("Yes"))
1280
        {
1281
                item->setPixmap(3, loadIcon("DateiClos16.png"));
1282
                item->setText(3, tr("No"));
1283
                ap->pluginManager->pluginMap[item->text(4).toInt()].loadPlugin = false;
1284
        }
1285
        else
1286
        {
1287
                item->setPixmap(3, loadIcon("ok.png"));
1288
                item->setText(3, tr("Yes"));
1289
                ap->pluginManager->pluginMap[item->text(4).toInt()].loadPlugin = true;
1290
        }
1291
}
1701 cbradney 1292
 
1293
void Preferences::setTOCIndexData(QWidget *widgetToShow)
1294
{
1295
        //Update the attributes list in TOC setup 
1296
        if (widgetToShow==tabDefaultTOCIndexPrefs)
1297
                tabDefaultTOCIndexPrefs->setupItemAttrs( tabDefaultItemAttributes->getDocAttributesNames() );
1298
}