Subversion Repositories Scribus

Rev

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