Subversion Repositories Scribus

Rev

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