Subversion Repositories Scribus

Rev

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