Subversion Repositories Scribus

Rev

Rev 5553 | Rev 5562 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
1641 cbradney 7
#include "prefs.h"
8
#include "prefs.moc"
9
#include "scribusdoc.h"
10
#include "scribusstructs.h"
11
#include <qfont.h>
12
#include <qcolordialog.h>
13
#include <qcombobox.h>
14
#include <qcolor.h>
15
#include <qstringlist.h>
16
#include <qstylefactory.h>
17
#include <qpointarray.h>
18
#include <qpainter.h>
19
#include <qrect.h>
20
#include <qstring.h>
21
#include <qwmatrix.h>
22
#include <cmath>
23
#include "units.h"
24
#include "langmgr.h"
25
#include "hysettings.h"
26
#include "cmsprefs.h"
5352 cbradney 27
//#include "keymanager.h"
1641 cbradney 28
#include "tabtools.h"
29
#include "undomanager.h"
30
#include "tabcheckdoc.h"
31
#include "tabpdfoptions.h"
32
#include "fontprefs.h"
33
#include "units.h"
34
#include "pagesize.h"
4122 cbradney 35
#include "pagestructs.h"
1641 cbradney 36
#include "docitemattrprefs.h"
5326 cbradney 37
 
2769 fschmid 38
#include "marginWidget.h"
2834 cbradney 39
#include "prefsmanager.h"
2873 cbradney 40
#include "polygonwidget.h"
41
#include "fontcombo.h"
42
#include "linecombo.h"
43
#include "arrowchooser.h"
2901 fschmid 44
#include "pagelayout.h"
3213 craig 45
#include "pluginmanager.h"
3207 craig 46
#include "pluginmanagerprefsgui.h"
3213 craig 47
#include "scplugin.h"
3560 fschmid 48
#include "sccombobox.h"
4689 mrdocs 49
#include "colorcombo.h"
4546 subik 50
#include "commonstrings.h"
5342 cbradney 51
#include "scribusapp.h"
5243 cbradney 52
#include "scribuscore.h"
5326 cbradney 53
#include "tabtypography.h"
54
#include "tabguides.h"
55
#include "tabexternaltoolswidget.h"
5352 cbradney 56
#include "tabkeyboardshortcutswidget.h"
5326 cbradney 57
#include "tocindexprefs.h"
5507 subik 58
#include "hyphenator.h"
3213 craig 59
 
1641 cbradney 60
using namespace std;
61
 
62
extern QPixmap loadIcon(QString nam);
63
extern bool CMSavail;
2873 cbradney 64
extern bool CMSuse;
5342 cbradney 65
extern ScribusQApp* ScQApp;
1641 cbradney 66
 
3205 craig 67
 
2834 cbradney 68
Preferences::Preferences( QWidget* parent) : PrefsDialogBase( parent )
1641 cbradney 69
{
2834 cbradney 70
        prefsManager=PrefsManager::instance();
71
        ApplicationPrefs* prefsData=&(prefsManager->appPrefs);
4026 craig 72
        ap = (ScribusMainWindow*)parent;
4730 subik 73
 
4555 cbradney 74
        customText="Custom";
75
        customTextTR=tr( "Custom" );
1641 cbradney 76
        docUnitIndex = prefsData->docUnitIndex;
1790 cbradney 77
        unitRatio = unitGetRatioFromIndex(docUnitIndex);
4555 cbradney 78
        int decimals = unitGetPrecisionFromIndex(docUnitIndex);
1641 cbradney 79
 
80
        DisScale = prefsData->DisScale;
81
        setCaption( tr( "Preferences" ) );
82
 
5507 subik 83
        tabGeneral = new QWidget( prefsWidgets, "tabGeneral" );
84
        tabLayout = new QGridLayout( tabGeneral );
1878 cbradney 85
        tabLayout->setSpacing( 5 );
86
        tabLayout->setMargin( 0 );
1641 cbradney 87
        tabLayout->setAlignment( Qt::AlignTop );
88
 
89
        // GUI Group
5507 subik 90
        ButtonGroup1 = new QButtonGroup( tr( "GUI" ), tabGeneral, "ButtonGroup1" );
1641 cbradney 91
        ButtonGroup1->setColumnLayout(0, Qt::Vertical );
92
        ButtonGroup1->layout()->setSpacing( 0 );
93
        ButtonGroup1->layout()->setMargin( 0 );
94
        ButtonGroup1Layout = new QGridLayout( ButtonGroup1->layout() );
95
        ButtonGroup1Layout->setAlignment( Qt::AlignTop );
96
        ButtonGroup1Layout->setSpacing( 6 );
97
        ButtonGroup1Layout->setMargin( 10 );
98
 
99
        langMgr.init();
100
        QStringList languageList;
101
        langMgr.fillInstalledStringList(&languageList, true);
102
        languageList.sort();
103
        guiLangCombo = new QComboBox( false, ButtonGroup1, "guiLangCombo");
104
        guiLangCombo->insertStringList( languageList );
105
        selectedGUILang=prefsData->guiLanguage;
2834 cbradney 106
        guiLangCombo->setCurrentText(langMgr.getLangFromAbbrev(selectedGUILang));
1641 cbradney 107
        guiLangLabel = new QLabel(guiLangCombo, tr("&Language:"), ButtonGroup1, "guiLangLabel");
108
        ButtonGroup1Layout->addWidget( guiLangLabel, 0, 0 );
2439 cbradney 109
        ButtonGroup1Layout->addWidget( guiLangCombo, 0, 1 );
1641 cbradney 110
 
111
        GUICombo = new QComboBox( true, ButtonGroup1, "GUICombo" );
112
        QStringList STtest;
113
        STtest = QStyleFactory::keys();
114
        for (uint stt = 0; stt < STtest.count(); ++stt)
115
                GUICombo->insertItem(STtest[stt]);
116
        GUICombo->setEditable(false);
117
        GUICombo->setCurrentText(prefsData->GUI);
118
        TextGstil = new QLabel(GUICombo, tr("&Theme:"), ButtonGroup1, "dd");
119
        ButtonGroup1Layout->addWidget( TextGstil, 1, 0 );
2439 cbradney 120
        ButtonGroup1Layout->addWidget( GUICombo, 1, 1 );
1641 cbradney 121
 
5342 cbradney 122
        showSplashCheckBox = new QCheckBox( ButtonGroup1, "showsplashcheckbox" );
123
        showSplashCheckBox->setChecked( !ScQApp->neverSplashExists() );
124
        showSplashLabel = new QLabel(showSplashCheckBox, tr("Show S&plashscreen On Startup:"), ButtonGroup1, "showSplashLabel");
125
        ButtonGroup1Layout->addWidget( showSplashLabel, 2, 0 );
126
        ButtonGroup1Layout->addWidget( showSplashCheckBox, 2, 1, Qt::AlignLeft );
127
 
1790 cbradney 128
        GFsize = new QSpinBox(8, 22, 1, ButtonGroup1, "gfs" );
1641 cbradney 129
        GFsize->setSuffix( tr( " pt" ) );
130
        GFsize->setValue( prefsData->AppFontSize );
3940 tsoots 131
        TextGstil2 = new QLabel(GFsize, tr("&Font Size (Menus):"), ButtonGroup1, "dd");
5342 cbradney 132
        ButtonGroup1Layout->addWidget( TextGstil2, 3, 0 );
133
        ButtonGroup1Layout->addWidget( GFsize, 3, 1, Qt::AlignLeft );
3940 tsoots 134
 
135
        GTFsize = new QSpinBox(5, 22, 1, ButtonGroup1, "gtfs");
136
        GTFsize->setSuffix(tr(" pt"));
137
        GTFsize->setValue( prefsData->PaletteFontSize); // temp solution
138
        TextGstil3 = new QLabel(GTFsize, tr("Font Size (&Palettes):"), ButtonGroup1, "dd");
5342 cbradney 139
        ButtonGroup1Layout->addWidget(TextGstil3, 4, 0);
140
        ButtonGroup1Layout->addWidget(GTFsize, 4, 1, Qt::AlignLeft);
3940 tsoots 141
 
5507 subik 142
        wheelJumpSpin = new QSpinBox( 0, 1000, 10, ButtonGroup1, "wheelJumpSpin" );
143
        wheelJumpSpin->setValue( prefsData->Wheelval );
144
        TextLabel1_2 = new QLabel( wheelJumpSpin, tr( "&Wheel Jump:" ), ButtonGroup1, "TextLabel1_2" );
5342 cbradney 145
        ButtonGroup1Layout->addWidget( TextLabel1_2, 5, 0 );
5507 subik 146
        ButtonGroup1Layout->addWidget( wheelJumpSpin, 5, 1, Qt::AlignLeft );
1790 cbradney 147
        Recen = new QSpinBox( 1, 30, 1, ButtonGroup1, "Recen" );
1641 cbradney 148
        Recen->setValue( prefsData->RecentDCount );
149
        TextLabel4c = new QLabel( Recen, tr( "&Recent Documents:" ), ButtonGroup1, "TextLabel4c" );
5342 cbradney 150
        ButtonGroup1Layout->addWidget( TextLabel4c, 6, 0);
151
        ButtonGroup1Layout->addWidget( Recen, 6, 1, Qt::AlignLeft );
1641 cbradney 152
        tabLayout->addWidget( ButtonGroup1, 0, 0 );
153
 
5507 subik 154
        GroupBox200 = new QGroupBox( tr( "Paths" ), tabGeneral, "GroupBox200" );
1641 cbradney 155
        GroupBox200->setColumnLayout(0, Qt::Horizontal );
156
        GroupBox200->layout()->setSpacing( 0 );
157
        GroupBox200->layout()->setMargin( 0 );
158
        GroupBox200Layout = new QGridLayout( GroupBox200->layout() );
159
        GroupBox200Layout->setAlignment( Qt::AlignTop );
160
        GroupBox200Layout->setSpacing( 0 );
161
        GroupBox200Layout->setMargin( 5 );
162
 
163
        Docs = new QLineEdit( GroupBox200, "Datei" );
164
        Docs->setMinimumSize( QSize( 268, 22 ) );
165
        Docs->setText(prefsData->DocDir);
166
        PfadText = new QLabel( Docs, tr("&Documents:"), GroupBox200, "Pfadtext" );
167
        FileC = new QToolButton( GroupBox200, "FileC" );
168
        FileC->setMinimumSize( QSize( 88, 24 ) );
169
        FileC->setText( tr( "&Change..." ) );
170
        GroupBox200Layout->addWidget( PfadText, 0, 0 );
171
        GroupBox200Layout->addWidget( Docs, 0, 1 );
172
        GroupBox200Layout->addWidget( FileC, 0, 2 );
173
 
174
        ProPfad = new QLineEdit( GroupBox200, "Datei1" );
175
        ProPfad->setMinimumSize( QSize( 268, 22 ) );
176
        ProPfad->setText(prefsData->ProfileDir);
4026 craig 177
        if (ScMW->HaveDoc)
2012 fschmid 178
                ProPfad->setEnabled(false);
1641 cbradney 179
        PfadText2 = new QLabel( ProPfad, tr("&ICC Profiles:"), GroupBox200, "Pfadtext1" );
180
        FileC2 = new QToolButton( GroupBox200, "FileC1" );
181
        FileC2->setMinimumSize( QSize( 88, 24 ) );
182
        FileC2->setText( tr( "C&hange..." ) );
4026 craig 183
        if (ScMW->HaveDoc)
2012 fschmid 184
                FileC2->setEnabled(false);
1641 cbradney 185
        GroupBox200Layout->addWidget( PfadText2, 1, 0 );
186
        GroupBox200Layout->addWidget( ProPfad, 1, 1 );
187
        GroupBox200Layout->addWidget( FileC2, 1, 2 );
188
 
189
        ScriptPfad = new QLineEdit( GroupBox200, "Datei1" );
190
        ScriptPfad->setMinimumSize( QSize( 268, 22 ) );
191
        ScriptPfad->setText(prefsData->ScriptDir);
192
        PfadText3 = new QLabel( ScriptPfad, tr("&Scripts:"), GroupBox200, "Pfadtext1" );
193
        FileC3 = new QToolButton( GroupBox200, "FileC3" );
194
        FileC3->setMinimumSize( QSize( 88, 24 ) );
195
        FileC3->setText( tr( "Ch&ange..." ) );
196
        GroupBox200Layout->addWidget( PfadText3, 2, 0 );
197
        GroupBox200Layout->addWidget( ScriptPfad, 2, 1 );
198
        GroupBox200Layout->addWidget( FileC3, 2, 2 );
199
 
2093 cbradney 200
        DocumentTemplateDir = new QLineEdit( GroupBox200, "Datei1" );
201
        DocumentTemplateDir->setMinimumSize( QSize( 268, 22 ) );
202
        DocumentTemplateDir->setText(prefsData->documentTemplatesDir);
203
        PfadText4 = new QLabel( DocumentTemplateDir, tr("Document T&emplates:"), GroupBox200, "Pfadtext1" );
1641 cbradney 204
        FileC4 = new QToolButton( GroupBox200, "FileC4" );
205
        FileC4->setMinimumSize( QSize( 88, 24 ) );
206
        FileC4->setText( tr( "Cha&nge..." ) );
207
        GroupBox200Layout->addWidget( PfadText4, 3, 0 );
2093 cbradney 208
        GroupBox200Layout->addWidget( DocumentTemplateDir, 3, 1 );
1641 cbradney 209
        GroupBox200Layout->addWidget( FileC4, 3, 2 );
210
        tabLayout->addWidget( GroupBox200, 1, 0 );
5507 subik 211
        addItem( tr("General"), loadIcon("scribusicon.png"), tabGeneral);
1641 cbradney 212
 
5507 subik 213
        tabDocument = new QWidget( prefsWidgets, "tabDocument" );
214
        tabLayout_7 = new QHBoxLayout( tabDocument, 0, 5, "tabLayout_7");
1641 cbradney 215
        Layout21 = new QVBoxLayout( 0, 0, 6, "Layout21");
2901 fschmid 216
        dsLayout4p = new QHBoxLayout;
217
        dsLayout4p->setSpacing( 5 );
218
        dsLayout4p->setMargin( 0 );
219
        dsLayout4p->setAlignment( Qt::AlignLeft );
5507 subik 220
        docLayout = new PageLayouts(tabDocument, prefsData->pageSets);
2901 fschmid 221
        docLayout->selectItem(prefsData->FacingPages);
3016 fschmid 222
        docLayout->firstPage->setCurrentItem(prefsData->pageSets[prefsData->FacingPages].FirstPage);
2901 fschmid 223
        dsLayout4p->addWidget( docLayout );
224
        dsLayout4pv = new QVBoxLayout;
225
        dsLayout4pv->setSpacing( 5 );
226
        dsLayout4pv->setMargin( 0 );
227
 
5507 subik 228
        GroupSize = new QButtonGroup( tr( "Page Size" ), tabDocument, "GroupSize" );
1641 cbradney 229
        GroupSize->setColumnLayout(0, Qt::Vertical );
230
        GroupSize->layout()->setSpacing( 6 );
231
        GroupSize->layout()->setMargin( 10 );
232
        GroupSizeLayout = new QVBoxLayout( GroupSize->layout() );
233
        GroupSizeLayout->setAlignment( Qt::AlignTop );
234
        Layout6 = new QGridLayout( 0, 1, 1, 0, 6, "Layout6");
235
 
4555 cbradney 236
        pageSizeComboBox = new QComboBox( true, GroupSize, "pageSizeComboBox" );
1641 cbradney 237
 
238
        PageSize *ps=new PageSize(prefsData->pageSize);
4555 cbradney 239
        pageSizeComboBox->insertStringList(ps->getTrPageSizeList());
240
        pageSizeComboBox->insertItem( customTextTR );
241
        pageSizeComboBox->setEditable(false);
1641 cbradney 242
 
243
        QStringList pageSizes=ps->getPageSizeList();
244
        int sizeIndex=pageSizes.findIndex(ps->getPageText());
245
        if (sizeIndex!=-1)
4555 cbradney 246
                pageSizeComboBox->setCurrentItem(sizeIndex);
1641 cbradney 247
        else
4555 cbradney 248
                pageSizeComboBox->setCurrentItem(pageSizeComboBox->count()-1);
249
        GZText1 = new QLabel( pageSizeComboBox, tr( "&Size:" ), GroupSize, "GZText1" );
1641 cbradney 250
        Layout6->addWidget( GZText1, 0, 0 );
4555 cbradney 251
        Layout6->addWidget( pageSizeComboBox, 0, 1 );
1641 cbradney 252
 
4555 cbradney 253
        pageOrientationComboBox = new QComboBox( true, GroupSize, "pageOrientationComboBox" );
254
        pageOrientationComboBox->insertItem( tr( "Portrait" ) );
255
        pageOrientationComboBox->insertItem( tr( "Landscape" ) );
256
        pageOrientationComboBox->setEditable(false);
257
        pageOrientationComboBox->setCurrentItem(prefsData->pageOrientation);
258
        GZText2 = new QLabel( pageOrientationComboBox, tr( "Orie&ntation:" ), GroupSize, "GZText2" );
1641 cbradney 259
        Layout6->addWidget( GZText2, 1, 0 );
4555 cbradney 260
        Layout6->addWidget( pageOrientationComboBox, 1, 1 );
5507 subik 261
        unitCombo = new QComboBox( true, GroupSize, "unitCombo" );
262
        unitCombo->insertStringList(unitGetTextUnitList());
263
        unitCombo->setEditable(false);
264
        unitCombo->setCurrentItem(prefsData->docUnitIndex);
265
        unitComboText = new QLabel( unitCombo, tr( "Units:" ), GroupSize, "unitComboText" );
1641 cbradney 266
        Layout6->addWidget( unitComboText, 2, 0 );
5507 subik 267
        Layout6->addWidget( unitCombo, 2, 1 );
1641 cbradney 268
 
269
        GroupSizeLayout->addLayout( Layout6 );
270
 
271
        Layout5_2 = new QHBoxLayout( 0, 0, 6, "Layout5_2");
272
 
2582 cbradney 273
        pageWidth = new MSpinBox( 1, 100000, GroupSize, decimals );
4555 cbradney 274
        //pageWidth->setEnabled( false );
1641 cbradney 275
        pageWidth->setMinimumSize( QSize( 70, 20 ) );
1790 cbradney 276
        pageWidth->setValue(prefsData->PageWidth * unitRatio);
1641 cbradney 277
        GZText3 = new QLabel( pageWidth, tr( "&Width:" ), GroupSize, "GZText3" );
278
        Layout5_2->addWidget( GZText3 );
279
        Layout5_2->addWidget( pageWidth );
280
 
2582 cbradney 281
        pageHeight = new MSpinBox( 1, 100000, GroupSize, decimals );
4555 cbradney 282
        //pageHeight->setEnabled( false );
1641 cbradney 283
        pageHeight->setMinimumSize( QSize( 70, 20 ) );
1790 cbradney 284
        pageHeight->setValue(prefsData->PageHeight * unitRatio);
1641 cbradney 285
        GZText4 = new QLabel( pageHeight, tr( "&Height:" ), GroupSize, "GZText4" );
286
        Layout5_2->addWidget( GZText4 );
287
        Layout5_2->addWidget( pageHeight );
288
 
289
        GroupSizeLayout->addLayout( Layout5_2 );
2901 fschmid 290
        dsLayout4pv->addWidget( GroupSize );
1641 cbradney 291
 
2769 fschmid 292
        struct MarginStruct marg;
293
        marg.Top = prefsData->RandOben;
294
        marg.Bottom = prefsData->RandUnten;
295
        marg.Left = prefsData->RandLinks;
296
        marg.Right = prefsData->RandRechts;
5512 subik 297
        marginGroup = new MarginWidget(tabDocument,  tr( "Margin Guides" ), &marg, docUnitIndex );
298
        marginGroup->setPageWidthHeight(prefsData->PageWidth, prefsData->PageHeight);
299
        dsLayout4pv->addWidget( marginGroup );
2901 fschmid 300
        dsLayout4p->addLayout( dsLayout4pv );
301
        Layout21->addLayout( dsLayout4p );
1641 cbradney 302
        QBoxLayout *asurLayout = new QHBoxLayout( 0, 0, 6, "asurLayout");
303
 
5507 subik 304
        GroupAS = new QGroupBox( tr( "Autosave" ), tabDocument, "GroupAS" );
3389 fschmid 305
        GroupAS->setCheckable( true );
306
        GroupAS->setChecked( prefsData->AutoSave );
1641 cbradney 307
        GroupAS->setColumnLayout(0, Qt::Vertical );
308
        GroupAS->layout()->setSpacing( 5 );
309
        GroupAS->layout()->setMargin( 10 );
3389 fschmid 310
        GroupASLayout = new QHBoxLayout( GroupAS->layout() );
1641 cbradney 311
        GroupASLayout->setAlignment( Qt::AlignTop );
312
        ASTime = new QSpinBox( GroupAS, "Time" );
313
        ASTime->setMaxValue( 60 );
314
        ASTime->setMinValue( 1 );
315
        ASTime->setSuffix( " " + tr("min") );
316
        ASTime->setValue(prefsData->AutoSaveTime / 1000 / 60);
317
        ASText = new QLabel( ASTime, tr( "&Interval:" ), GroupAS, "ASText" );
3389 fschmid 318
        GroupASLayout->addWidget( ASText);
319
        GroupASLayout->addWidget( ASTime );
1641 cbradney 320
        asurLayout->addWidget(GroupAS);
321
 
5507 subik 322
        urGroup = new QGroupBox( tr("Undo/Redo"), tabDocument, "urGroup");
1641 cbradney 323
        urGroup->setColumnLayout(0, Qt::Vertical);
324
        urGroup->layout()->setSpacing(5);
325
        urGroup->layout()->setMargin(10);
326
        QGridLayout *urGroupLayout = new QGridLayout(urGroup->layout());
327
        urGroupLayout->setAlignment(Qt::AlignTop);
328
        urSpinBox = new QSpinBox(urGroup, "urSpinBox");
329
        urSpinBox->setMinValue(0);
330
        urSpinBox->setMaxValue(1000);
331
        int urSBValue = UndoManager::instance()->getHistoryLength();
332
        if (urSBValue == -1)
333
                urSpinBox->setEnabled(false);
334
        else
335
                urSpinBox->setValue(urSBValue);
336
        urLabel = new QLabel(urSpinBox, tr("Action history length"), urGroup, "urLabel");
337
        urGroupLayout->addWidget(urLabel, 0, 0);
338
        urGroupLayout->addWidget(urSpinBox, 0, 1);
339
        asurLayout->addWidget(urGroup);
340
        Layout21->addLayout(asurLayout);
341
 
342
        tabLayout_7->addLayout( Layout21 );
5507 subik 343
        addItem( tr("Document"), loadIcon("scribusdoc.png"), tabDocument);
1641 cbradney 344
 
2889 cbradney 345
        tabGuides = new TabGuides(prefsWidgets, &prefsData->guidesSettings, &prefsData->typographicSettings, docUnitIndex);
1641 cbradney 346
        addItem( tr("Guides"), loadIcon("guides.png"), tabGuides);
2889 cbradney 347
        tabTypo = new TabTypograpy(  prefsWidgets, &prefsData->typographicSettings);
3504 avox 348
        addItem( tr("Typography"), loadIcon("typography.png"), tabTypo);
1790 cbradney 349
        tabTools = new TabTools(  prefsWidgets, &prefsData->toolSettings, docUnitIndex, 0);
1641 cbradney 350
        addItem( tr("Tools"), loadIcon("tools.png"), tabTools);
351
 
352
        tabHyphenator = new HySettings(prefsWidgets, &ap->LangTransl);
353
        tabHyphenator->verbose->setChecked(!prefsData->Automatic);
354
        tabHyphenator->input->setChecked(prefsData->AutoCheck);
355
        tabHyphenator->language->setCurrentText(ap->LangTransl[prefsData->Language]);
356
        tabHyphenator->wordLen->setValue(prefsData->MinWordLen);
357
        tabHyphenator->maxCount->setValue(prefsData->HyCount);
358
        addItem( tr("Hyphenator"), loadIcon("hyphenate.png"), tabHyphenator);
359
 
5385 subik 360
        tabFonts = new FontPrefs(prefsWidgets, false, ap->PrefsPfad, 0);
1641 cbradney 361
        addItem( tr("Fonts"), loadIcon("font.png"), tabFonts);
362
 
363
        tabDocChecker = new TabCheckDoc(  prefsWidgets, prefsData->checkerProfiles, prefsData->curCheckProfile);
2770 cbradney 364
        addItem( tr("Preflight Verifier"), loadIcon("checkdoc.png"), tabDocChecker);
1641 cbradney 365
 
366
        if (CMSavail)
367
        {
5243 cbradney 368
                tabColorManagement = new CMSPrefs(prefsWidgets, &prefsData->DCMSset, &ScCore->InputProfiles, &ScCore->InputProfilesCMYK, &ScCore->PrinterProfiles, &ScCore->MonitorProfiles);
1641 cbradney 369
                addItem( tr("Color Management"), loadIcon("blend.png"), tabColorManagement);
370
        }
5387 avox 371
        QMap<QString, int> DocFonts;
1641 cbradney 372
        DocFonts.clear();
373
        tabPDF = new TabPDFOptions( prefsWidgets,
4260 craig 374
                                                                prefsData->PDF_Options,
2834 cbradney 375
                                                                prefsData->AvailFonts,
5243 cbradney 376
                                                                ScCore->PDFXProfiles,
1641 cbradney 377
                                                                DocFonts,
378
                                                                prefsData->PDF_Options.PresentVals,
1790 cbradney 379
                                                                docUnitIndex,
1641 cbradney 380
                                                                prefsData->PageHeight,
381
                                                                prefsData->PageWidth,
382
 
383
        addItem( tr("PDF Export"), loadIcon("acroread.png"), tabPDF);
1644 cbradney 384
 
1641 cbradney 385
        tabDefaultItemAttributes = new DocumentItemAttributes( prefsWidgets);
1701 cbradney 386
        defaultAttributesList=tabDefaultItemAttributes->getDocAttributesNames();
1641 cbradney 387
        tabDefaultItemAttributes->setup(&prefsData->defaultItemAttributes);
388
        addItem( tr("Document Item Attributes"), loadIcon("docattributes.png"), tabDefaultItemAttributes);
1701 cbradney 389
 
390
        tabDefaultTOCIndexPrefs = new TOCIndexPrefs( prefsWidgets );
391
        tabDefaultTOCIndexPrefs->setupItemAttrs( defaultAttributesList );
392
        tabDefaultTOCIndexPrefs->setup(&prefsData->defaultToCSetups, NULL);
393
        connect( prefsWidgets, SIGNAL(aboutToShow(QWidget *)), this, SLOT(setTOCIndexData(QWidget *)));
394
        addItem( tr("Table of Contents and Indexes"), loadIcon("tabtocindex.png"), tabDefaultTOCIndexPrefs);
2784 subik 395
 
5352 cbradney 396
        tabKeyboardShortcuts = new TabKeyboardShortcutsWidget(prefsData->KeyActions, prefsWidgets);
5356 cbradney 397
        addItem( tr("Keyboard Shortcuts"), loadIcon("key_bindings.png"), tabKeyboardShortcuts);
5352 cbradney 398
//      tabKeys = new KeyManager(prefsWidgets, prefsData->KeyActions);
399
//      addItem( tr("Keyboard Shortcuts"), loadIcon("key_bindings.png"), tabKeys);
4649 fschmid 400
/*
1641 cbradney 401
        tab_5 = new QWidget( prefsWidgets, "tab_5" );
402
        tabLayout_5 = new QGridLayout( tab_5 );
1878 cbradney 403
        tabLayout_5->setSpacing( 5 );
404
        tabLayout_5->setMargin( 0 );
1641 cbradney 405
        preview = new QGroupBox( tr( "Preview" ), tab_5, "Preview" );
406
        preview->setColumnLayout(0, Qt::Vertical );
407
        preview->layout()->setSpacing( 0 );
408
        preview->layout()->setMargin( 0 );
409
        previewLayout = new QHBoxLayout( preview->layout() );
410
        previewLayout->setAlignment( Qt::AlignTop );
411
        previewLayout->setSpacing( 10 );
412
        previewLayout->setMargin( 24 );
413
        PreviewSize = new QComboBox( true, preview, "PreviewSize" );
414
        PreviewSize->insertItem( tr( "Small" ) );
415
        PreviewSize->insertItem( tr( "Medium" ) );
416
        PreviewSize->insertItem( tr( "Large" ) );
417
        PreviewSize->setEditable(false);
418
        int sci = prefsData->PSize == 40 ? 0 : prefsData->PSize == 60 ? 1 : 2;
419
        PreviewSize->setCurrentItem(sci);
420
        textLabelP = new QLabel( PreviewSize, tr( "&Size:" ), preview, "TextLabel1_3" );
421
        previewLayout->addWidget( textLabelP );
422
        previewLayout->addWidget( PreviewSize );
423
        tabLayout_5->addWidget( preview, 0, 0 );
424
        addItem(  tr("Scrapbook"), loadIcon("scrap.png"), tab_5);
4649 fschmid 425
*/
1641 cbradney 426
        tabView = new QWidget( prefsWidgets, "tabView" );
1878 cbradney 427
        tabViewLayout = new QVBoxLayout( tabView, 0, 5, "tabViewLayout");
1641 cbradney 428
        tabViewLayout->setAlignment( Qt::AlignTop );
429
        pageBackground = new QButtonGroup( tabView, "pageBackground" );
430
        pageBackground->setTitle( tr( "Page Display" ) );
431
        pageBackground->setColumnLayout(0, Qt::Vertical );
432
        pageBackground->layout()->setSpacing( 5 );
433
        pageBackground->layout()->setMargin( 10 );
2872 fschmid 434
        pageBackgroundLayout = new QGridLayout( pageBackground->layout() );
1641 cbradney 435
        pageBackgroundLayout->setAlignment( Qt::AlignTop );
436
        layout10 = new QHBoxLayout( 0, 0, 5, "layout10");
437
        textLabel9 = new QLabel( pageBackground, "textLabel9" );
438
        textLabel9->setText( tr( "Color:" ) );
439
        layout10->addWidget( textLabel9 );
440
        backColor = new QPushButton( pageBackground, "backColor" );
441
        backColor->setMinimumSize( QSize( 60, 20 ) );
442
        backColor->setMaximumSize( QSize( 60, 20 ) );
443
        backColor->setFlat( false );
444
        backColor->setAutoDefault( false );
3333 avox 445
        QPixmap pm5(54, 14);
1641 cbradney 446
        pm5.fill(prefsData->DpapColor);
447
        colorPaper = prefsData->DpapColor;
448
        backColor->setPixmap(pm5);
449
        backColor->setText( QString::null );
450
        layout10->addWidget( backColor );
451
        QSpacerItem* spacer3 = new QSpacerItem( 61, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
452
        layout10->addItem( spacer3 );
2872 fschmid 453
        pageBackgroundLayout->addLayout( layout10, 0 ,0 );
1641 cbradney 454
        checkUnprintable = new QCheckBox( pageBackground, "checkUnprintable" );
455
        checkUnprintable->setText( tr( "Display &Unprintable Area in Margin Color" ) );
456
        checkUnprintable->setAccel( QKeySequence( tr( "Alt+U" ) ) );
457
        checkUnprintable->setChecked( prefsData->marginColored );
2872 fschmid 458
        pageBackgroundLayout->addWidget( checkUnprintable, 0, 1 );
1641 cbradney 459
        checkPictures = new QCheckBox( pageBackground, "checkPictures" );
460
        checkPictures->setText( tr( "Show Pictures" ) );
461
        checkPictures->setChecked(prefsData->guidesSettings.showPic);
2872 fschmid 462
        pageBackgroundLayout->addWidget( checkPictures, 1 , 0 );
1641 cbradney 463
        checkLink = new QCheckBox( pageBackground, "checkLink" );
464
        checkLink->setText( tr( "Show Text Chains" ) );
465
        checkLink->setChecked(prefsData->guidesSettings.linkShown);
2872 fschmid 466
        pageBackgroundLayout->addWidget( checkLink, 1, 1 );
2353 fschmid 467
        checkControl = new QCheckBox( pageBackground, "checkControl" );
468
        checkControl->setText( tr( "Show Text Control Characters" ) );
469
        checkControl->setChecked(prefsData->guidesSettings.showControls);
2872 fschmid 470
        pageBackgroundLayout->addWidget( checkControl, 2 , 0 );
1641 cbradney 471
        checkFrame = new QCheckBox( pageBackground, "checkFrame" );
472
        checkFrame->setText( tr( "Show Frames" ) );
473
        checkFrame->setChecked(prefsData->guidesSettings.framesShown);
2872 fschmid 474
        pageBackgroundLayout->addWidget( checkFrame, 2, 1 );
2863 fschmid 475
        checkRuler = new QCheckBox( pageBackground, "checkRuler" );
476
        checkRuler->setText( tr( "Rulers relative to Page" ) );
477
        checkRuler->setChecked(prefsData->guidesSettings.rulerMode);
2872 fschmid 478
        pageBackgroundLayout->addWidget( checkRuler, 3, 0 );
1641 cbradney 479
        tabViewLayout->addWidget( pageBackground );
480
 
481
        groupScratch = new QGroupBox( tabView, "GroupBox7" );
482
        groupScratch->setTitle( tr( "Scratch Space" ) );
483
        groupScratch->setColumnLayout(0, Qt::Vertical );
484
        groupScratch->layout()->setSpacing( 0 );
485
        groupScratch->layout()->setMargin( 0 );
486
        groupScratchLayout = new QHBoxLayout( groupScratch->layout() );
487
        groupScratchLayout->setAlignment( Qt::AlignTop );
488
        groupScratchLayout->setSpacing( 0 );
489
        groupScratchLayout->setMargin( 10 );
490
        Layout4s = new QGridLayout;
491
        Layout4s->setSpacing( 6 );
492
        Layout4s->setMargin( 0 );
493
        topScratch = new MSpinBox( groupScratch, 4 );
494
        topScratch->setDecimals( decimals );
495
        topScratch->setMaxValue(1000);
1790 cbradney 496
        topScratch->setValue(prefsData->ScratchTop * unitRatio);
1641 cbradney 497
        Layout4s->addWidget( topScratch, 0, 1 );
498
        TextLabel5s = new QLabel(topScratch, tr( "&Top:" ), groupScratch, "TextLabel5" );
499
        Layout4s->addWidget( TextLabel5s, 0, 0 );
500
        leftScratch = new MSpinBox( groupScratch, 4 );
501
        leftScratch->setDecimals( decimals );
502
        leftScratch->setMaxValue(1000);
1790 cbradney 503
        leftScratch->setValue(prefsData->ScratchLeft * unitRatio);
1641 cbradney 504
        Layout4s->addWidget( leftScratch, 0, 3 );
505
        Linkss = new QLabel(leftScratch, tr( "&Left:" ), groupScratch, "Links" );
506
        Layout4s->addWidget( Linkss, 0, 2 );
507
        bottomScratch = new MSpinBox( groupScratch, 4 );
508
        bottomScratch->setDecimals( decimals );
509
        bottomScratch->setMaxValue(1000);
1790 cbradney 510
        bottomScratch->setValue(prefsData->ScratchBottom * unitRatio);
1641 cbradney 511
        Layout4s->addWidget( bottomScratch, 1, 1 );
512
        TextLabel7s = new QLabel(bottomScratch, tr( "&Bottom:" ), groupScratch, "TextLabel7" );
513
        Layout4s->addWidget( TextLabel7s, 1, 0 );
514
        rightScratch = new MSpinBox( groupScratch, 4 );
515
        rightScratch->setDecimals( decimals );
516
        rightScratch->setMaxValue(1000);
1790 cbradney 517
        rightScratch->setValue(prefsData->ScratchRight * unitRatio);
1641 cbradney 518
        Layout4s->addWidget( rightScratch, 1, 3 );
2189 cbradney 519
        QString unitSuffix = unitGetSuffixFromIndex(docUnitIndex);
520
        topScratch->setSuffix(unitSuffix);
521
        bottomScratch->setSuffix(unitSuffix);
522
        leftScratch->setSuffix(unitSuffix);
523
        rightScratch->setSuffix(unitSuffix);
1641 cbradney 524
        Rechtss = new QLabel(rightScratch, tr( "&Right:" ), groupScratch, "Rechts" );
525
        Layout4s->addWidget( Rechtss, 1, 2 );
526
        groupScratchLayout->addLayout( Layout4s );
527
        tabViewLayout->addWidget( groupScratch );
2872 fschmid 528
        groupGap = new QGroupBox( tabView, "GroupBox7" );
529
        groupGap->setTitle( tr( "Gaps between Pages" ) );
530
        groupGap->setColumnLayout(0, Qt::Vertical );
531
        groupGap->layout()->setSpacing( 0 );
532
        groupGap->layout()->setMargin( 0 );
533
        groupGapLayout = new QHBoxLayout( groupGap->layout() );
534
        groupGapLayout->setAlignment( Qt::AlignTop );
535
        groupGapLayout->setSpacing( 0 );
536
        groupGapLayout->setMargin( 10 );
537
        layout4sg = new QGridLayout;
538
        layout4sg->setSpacing( 6 );
539
        layout4sg->setMargin( 0 );
540
        gapHorizontal = new MSpinBox( groupGap, 4 );
541
        gapHorizontal->setSuffix( unitSuffix );
542
        gapHorizontal->setDecimals( decimals );
543
        gapHorizontal->setMaxValue(1000);
3016 fschmid 544
        gapHorizontal->setValue(prefsData->pageSets[prefsData->FacingPages].GapHorizontal * unitRatio);
2872 fschmid 545
        layout4sg->addWidget( gapHorizontal, 0, 1 );
546
        TextLabel5sg = new QLabel(gapHorizontal, tr( "Horizontal:" ), groupGap, "TextLabel5" );
547
        layout4sg->addWidget( TextLabel5sg, 0, 0 );
548
        gapVertical = new MSpinBox( groupGap, 4 );
549
        gapVertical->setSuffix( unitSuffix );
550
        gapVertical->setDecimals( decimals );
551
        gapVertical->setMaxValue(1000);
3016 fschmid 552
        gapVertical->setValue(prefsData->pageSets[prefsData->FacingPages].GapVertical * unitRatio);
2872 fschmid 553
        layout4sg->addWidget( gapVertical, 0, 3 );
554
        TextLabel7sg = new QLabel(gapVertical, tr( "Vertical:" ), groupGap, "Links" );
555
        layout4sg->addWidget( TextLabel7sg, 0, 2 );
556
        groupGapLayout->addLayout( layout4sg );
557
        tabViewLayout->addWidget( groupGap );
1641 cbradney 558
 
559
        CaliGroup = new QGroupBox( tr( "&Adjust Display Size" ), tabView, "CaliGroup" );
560
        CaliGroup->setColumnLayout(0, Qt::Vertical );
561
        CaliGroup->layout()->setSpacing( 6 );
562
        CaliGroup->layout()->setMargin( 11 );
563
        CaliGroupLayout = new QVBoxLayout( CaliGroup->layout() );
564
        CaliGroupLayout->setAlignment( Qt::AlignTop );
2598 cbradney 565
        CaliText = new QLabel( tr( "To adjust the display drag the ruler below with the slider." ), CaliGroup, "CaliText" );
1641 cbradney 566
        CaliGroupLayout->addWidget( CaliText );
567
        CaliRuler = new QLabel( CaliGroup, "CaliRuler" );
568
        CaliRuler->setMinimumSize( QSize( 20, 20 ) );
569
        drawRuler();
570
        CaliRuler->setFrameShape( QLabel::Box );
571
        CaliRuler->setFrameShadow( QLabel::Sunken );
572
        CaliRuler->setScaledContents( false );
573
        CaliGroupLayout->addWidget( CaliRuler );
574
        layout15ca = new QHBoxLayout( 0, 0, 6, "layout15");
575
        CaliSlider = new QSlider( CaliGroup, "CaliSlider" );
576
        CaliSlider->setMinValue( -100 );
577
        CaliSlider->setMaxValue( 100 );
578
        CaliSlider->setValue(static_cast<int>(100 * DisScale)-100);
579
        CaliSlider->setOrientation( QSlider::Horizontal );
580
        CaliSlider->setTickmarks( QSlider::Right );
581
        CaliSlider->setTickInterval( 10 );
582
        CaliText->setBuddy(CaliGroup);
583
        layout15ca->addWidget( CaliSlider );
584
        CaliAnz = new QLabel( CaliGroup, "CaliAnz" );
585
        CaliAnz->setText(QString::number(DisScale*100, 'f', 2)+" %");
586
        layout15ca->addWidget( CaliAnz );
587
        CaliGroupLayout->addLayout( layout15ca );
588
        tabViewLayout->addWidget( CaliGroup );
589
        addItem( tr("Display"), loadIcon("screen.png"), tabView);
5326 cbradney 590
 
591
 
592
        tabExtTools = new TabExternalToolsWidget( prefsData, prefsWidgets );
593
        addItem(  tr("External Tools"), loadIcon("externaltools.png"), tabExtTools);
594
 
595
/*     
1641 cbradney 596
        ExtTool = new QWidget( prefsWidgets, "ExtTool" );
1878 cbradney 597
        ExtToolLayout = new QVBoxLayout( ExtTool, 0, 5, "ExtToolLayout");
1641 cbradney 598
        ExtToolLayout->setAlignment( Qt::AlignTop );
3142 cbradney 599
        ghostscriptGroup = new QGroupBox( tr( "PostScript Interpreter" ), ExtTool, "ghostscriptGroup" );
2925 cbradney 600
        ghostscriptGroup->setColumnLayout(0, Qt::Vertical );
601
        ghostscriptGroup->layout()->setSpacing( 6 );
602
        ghostscriptGroup->layout()->setMargin( 10 );
603
        groupGhostScriptLayout = new QVBoxLayout( ghostscriptGroup->layout() );
604
        groupGhostScriptLayout->setAlignment( Qt::AlignTop );
605
        ghostscriptLayout = new QHBoxLayout( 0, 0, 6, "ghostscriptLayout");
606
        ghostscriptLineEdit = new QLineEdit( ghostscriptGroup, "ghostscriptLineEdit" );
607
        ghostscriptLineEdit->setText(prefsManager->ghostscriptExecutable());
608
        ghostscriptLabel = new QLabel( ghostscriptLineEdit, tr( "&Name of Executable:" ), ghostscriptGroup, "ghostscriptLabel" );
609
        ghostscriptChangeButton = new QToolButton( ghostscriptGroup, "ghostscriptChangeButton" );
610
        ghostscriptChangeButton->setMinimumSize( QSize( 88, 24 ) );
611
        ghostscriptChangeButton->setText( tr( "&Change..." ) );
612
        ghostscriptLayout->addWidget( ghostscriptLabel );
613
        ghostscriptLayout->addWidget( ghostscriptLineEdit );
614
        ghostscriptLayout->addWidget( ghostscriptChangeButton );
615
        groupGhostScriptLayout->addLayout( ghostscriptLayout );
616
        GSantiText = new QCheckBox( tr( "Antialias &Text" ), ghostscriptGroup, "GSantiText" );
1641 cbradney 617
        GSantiText->setChecked(prefsData->gs_AntiAliasText);
2925 cbradney 618
        groupGhostScriptLayout->addWidget( GSantiText );
619
        GSantiGraph = new QCheckBox( tr( "Antialias &Graphics" ), ghostscriptGroup, "GSantiGraph" );
1641 cbradney 620
        GSantiGraph->setChecked(prefsData->gs_AntiAliasGraphics);
2925 cbradney 621
        groupGhostScriptLayout->addWidget( GSantiGraph );
622
        GSlayout2 = new QHBoxLayout( 0, 0, 6, "ghostscriptLayout");
623
        GSResolution = new QSpinBox( ghostscriptGroup, "Time" );
2703 fschmid 624
        GSResolution->setMaxValue( 2400 );
625
        GSResolution->setMinValue( 10 );
626
        GSResolution->setSuffix( " " + tr("dpi") );
627
        GSResolution->setValue(prefsData->gs_Resolution);
2925 cbradney 628
        GSResText = new QLabel( GSResolution, tr( "Resolution:" ), ghostscriptGroup, "GSResText" );
2703 fschmid 629
        GSlayout2->addWidget( GSResText );
630
        GSlayout2->addWidget( GSResolution );
2925 cbradney 631
        groupGhostScriptLayout->addLayout( GSlayout2 );
632
        ExtToolLayout->addWidget( ghostscriptGroup );
633
        groupImageEditor = new QGroupBox( tr( "Image Processing Tool" ), ExtTool, "groupImageEditor" );
634
        groupImageEditor->setColumnLayout(0, Qt::Vertical );
635
        groupImageEditor->layout()->setSpacing( 6 );
636
        groupImageEditor->layout()->setMargin( 10 );
637
        groupImageEditorLayout = new QHBoxLayout( groupImageEditor->layout() );
638
        groupImageEditorLayout->setAlignment( Qt::AlignTop );
639
        imageEditorLineEdit = new QLineEdit( groupImageEditor, "imageEditorLineEdit" );
640
        imageEditorLineEdit->setText(prefsManager->imageEditorExecutable());
641
        imageEditorLabel = new QLabel( imageEditorLineEdit, tr( "Name of &Executable:" ), groupImageEditor, "imageEditorLabel" );
642
        imageEditorChangeButton = new QToolButton( groupImageEditor, "imageEditorChangeButton" );
643
        imageEditorChangeButton->setMinimumSize( QSize( 88, 24 ) );
644
        imageEditorChangeButton->setText( tr( "&Change..." ) );
645
        groupImageEditorLayout->addWidget( imageEditorLabel );
646
        groupImageEditorLayout->addWidget( imageEditorLineEdit );
647
        groupImageEditorLayout->addWidget( imageEditorChangeButton );
648
        ExtToolLayout->addWidget( groupImageEditor );
1641 cbradney 649
        QSpacerItem* spacer_gs = new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::Expanding );
650
        ExtToolLayout->addItem( spacer_gs );
3504 avox 651
        addItem(  tr("External Tools"), loadIcon("externaltools.png"), ExtTool);
5326 cbradney 652
*/
5507 subik 653
        tabMiscellaneous = new QWidget( prefsWidgets, "tabMiscellaneous" );
654
        MiscLayout = new QVBoxLayout( tabMiscellaneous, 0, 5, "MiscLayout");
1641 cbradney 655
        MiscLayout->setAlignment( Qt::AlignTop );
5507 subik 656
/*      groupPrint = new QGroupBox( tr( "Printing" ), tabMiscellaneous, "groupPrint" );
1641 cbradney 657
        groupPrint->setColumnLayout(0, Qt::Vertical );
658
        groupPrint->layout()->setSpacing( 10 );
659
        groupPrint->layout()->setMargin( 10 );
660
        groupPrintLayout = new QVBoxLayout( groupPrint->layout() );
661
        groupPrintLayout->setAlignment( Qt::AlignTop );
662
        ClipMarg = new QCheckBox( tr( "Clip to Page &Margins" ), groupPrint, "ClipMarg" );
663
        ClipMarg->setChecked(prefsData->ClipMargin);
664
        groupPrintLayout->addWidget( ClipMarg );
665
        DoGCR = new QCheckBox( tr( "Apply &Under Color Removal" ), groupPrint, "ClipMarg" );
666
        DoGCR->setChecked(prefsData->GCRMode);
667
        groupPrintLayout->addWidget( DoGCR );
4649 fschmid 668
        MiscLayout->addWidget( groupPrint ); */
5507 subik 669
        AskForSubs = new QCheckBox( tr( "Always ask before fonts are replaced when loading a document" ), tabMiscellaneous, "askforSubs" );
1641 cbradney 670
        AskForSubs->setChecked(prefsData->askBeforeSubstituite);
671
        MiscLayout->addWidget( AskForSubs );
5507 subik 672
        stylePreview = new QCheckBox( tr( "Preview of current Paragraph Style visible when editing Styles" ), tabMiscellaneous, "stylePreview" );
2263 fschmid 673
        stylePreview->setChecked(prefsData->haveStylePreview);
674
        MiscLayout->addWidget( stylePreview );
5507 subik 675
        startUpDialog = new QCheckBox( tr( "Show Startup Dialog" ), tabMiscellaneous, "startUpDialog" );
2833 fschmid 676
        startUpDialog->setChecked(prefsData->showStartupDialog);
677
        MiscLayout->addWidget( startUpDialog );
2784 subik 678
        // lorem ipsum
5507 subik 679
        groupLI = new QGroupBox(tr("Lorem Ipsum"), tabMiscellaneous, "groupLI");
2784 subik 680
        groupLI->setColumnLayout(0, Qt::Vertical);
681
        groupLI->layout()->setSpacing(10);
682
        groupLI->layout()->setMargin(10);
683
        groupLILayout = new QVBoxLayout(groupLI->layout());
684
        groupLILayout->setAlignment(Qt::AlignTop);
685
        useStandardLI = new QCheckBox(tr("Always use standard Lorem Ipsum"), groupLI, "useStandardLI");
686
        useStandardLI->setChecked(prefsData->useStandardLI);
687
        groupLILayout->addWidget(useStandardLI);
688
        paraLabelLI = new QLabel(tr("Count of the Paragraphs:"), groupLI, "paraLabelLI");
689
        paragraphsLI = new QSpinBox(groupLI, "paragraphsLI");
690
        paragraphsLI->setMinValue(1);
691
        paragraphsLI->setValue(prefsData->paragraphsLI);
692
        QHBoxLayout *liLayout = new QHBoxLayout();
693
        liLayout->addWidget(paraLabelLI);
694
        liLayout->addWidget(paragraphsLI);
695
        groupLILayout->addLayout(liLayout);
696
        MiscLayout->addWidget(groupLI);
697
        // spacer filling
1641 cbradney 698
        QSpacerItem* spacer_3m = new QSpacerItem( 0, 1, QSizePolicy::Minimum, QSizePolicy::Expanding );
699
        MiscLayout->addItem( spacer_3m );
5507 subik 700
        addItem(  tr("Miscellaneous"), loadIcon("misc.png"), tabMiscellaneous);
1641 cbradney 701
 
702
        // plugin manager. pv.
5556 subik 703
        pluginManagerPrefsGui = new PluginManagerPrefsGui(prefsWidgets);
3213 craig 704
        addItem( tr("Plugins"), loadIcon("plugins.png"), pluginManagerPrefsGui );
705
        connect(this, SIGNAL(accepted()), pluginManagerPrefsGui, SLOT(apply()));
1641 cbradney 706
 
3213 craig 707
        addPlugins();
708
 
2901 fschmid 709
        setDS(prefsData->FacingPages);
1641 cbradney 710
        //tab order
3940 tsoots 711
        QWidget::setTabOrder( GFsize, GTFsize );
5507 subik 712
        QWidget::setTabOrder( GTFsize, wheelJumpSpin );
713
        QWidget::setTabOrder( wheelJumpSpin, unitCombo );
714
        QWidget::setTabOrder( unitCombo, Recen );
1641 cbradney 715
        QWidget::setTabOrder( Recen, Docs );
716
        QWidget::setTabOrder( Docs, FileC );
717
        QWidget::setTabOrder( FileC, ProPfad );
718
        QWidget::setTabOrder( ProPfad, FileC2  );
719
        QWidget::setTabOrder( FileC2, ScriptPfad );
720
        QWidget::setTabOrder( ScriptPfad, FileC3 );
2093 cbradney 721
        QWidget::setTabOrder( FileC3, DocumentTemplateDir );
722
        QWidget::setTabOrder( DocumentTemplateDir, FileC4 );
1641 cbradney 723
 
3849 subik 724
        QToolTip::add( checkLink, "<qt>" + tr("Enable or disable  the display of linked frames.") + "</qt>");
2598 cbradney 725
        QToolTip::add( checkControl, "<qt>" + tr("Display non-printing characters such as paragraph markers in text frames") + "</qt>");
3849 subik 726
        QToolTip::add( checkFrame, "<qt>" + tr("Turns the display of frames on or off") + "</qt>");
727
        QToolTip::add( checkPictures, "<qt>" + tr("Turns the display of pictures on or off") + "</qt>");
3095 mrdocs 728
        QToolTip::add( guiLangCombo, "<qt>" + tr( "Select your default language for Scribus to run with. Leave this blank to choose based on environment variables. You can still override this by passing a command line option when starting Scribus" )+"</qt>" );
3961 mrdocs 729
        QToolTip::add( GUICombo, "<qt>" + tr( "Choose the default window decoration and looks. Scribus inherits any available KDE or Qt themes, if Qt is configured to search KDE plugins." ) + "</qt>" );
3849 subik 730
        QToolTip::add( GFsize, "<qt>" + tr( "Default font size for the menus and windows" ) + "</qt>" );
3940 tsoots 731
        QToolTip::add( GTFsize, "<qt>" + tr("Default font size for the tool windows") + "</qt>" );
5507 subik 732
        QToolTip::add( unitCombo, "<qt>" + tr( "Default unit of measurement for document editing" ) + "</qt>" );
733
        QToolTip::add( wheelJumpSpin, "<qt>" + tr( "Number of lines Scribus will scroll for each move of the mouse wheel" ) + "</qt>" );
3849 subik 734
        QToolTip::add( Recen, "<qt>" + tr( "Number of recently edited documents to show in the File menu" ) + "</qt>" );
735
        QToolTip::add( Docs, "<qt>" + tr( "Default documents directory" ) + "</qt>" );
3961 mrdocs 736
        QToolTip::add( ProPfad, "<qt>" + tr( "Default ICC profiles directory. This cannot be changed with a document open. By default, Scribus will look in the System Directories under Mac OSX and Windows. On Linux and Unix, Scribus will search $home/.color/icc,/usr/share/color/icc and /usr/local/share/color/icc " ) + "</qt>" );
3849 subik 737
        QToolTip::add( ScriptPfad, "<qt>" + tr( "Default Scripter scripts directory" ) + "</qt>" );
2093 cbradney 738
        QToolTip::add( DocumentTemplateDir, "<qt>"+tr("Additional directory for document templates")+"</qt>" );
1641 cbradney 739
 
4555 cbradney 740
        QToolTip::add( pageSizeComboBox, "<qt>" + tr( "Default page size, either a standard size or a custom size" ) + "</qt>" );
741
        QToolTip::add( pageOrientationComboBox, "<qt>" + tr( "Default orientation of document pages" ) + "</qt>" );
3849 subik 742
        QToolTip::add( pageWidth, "<qt>" + tr( "Width of document pages, editable if you have chosen a custom page size" ) + "</qt>" );
743
        QToolTip::add( pageHeight, "<qt>" + tr( "Height of document pages, editable if you have chosen a custom page size" ) + "</qt>" );
2901 fschmid 744
//      QToolTip::add( facingPages, tr( "Enable single or spread based layout" ) );
745
//      QToolTip::add( Linkszuerst, tr( "Make the first page the left page of a document" ) );
3849 subik 746
        QToolTip::add( GroupAS, "<qt>" + tr( "When enabled, Scribus saves a backup copy of your file with the .bak extension each time the time period elapses" ) + "</qt>" );
747
        QToolTip::add( ASTime, "<qt>" + tr( "Time period between saving automatically" ) + "</qt>" );
1641 cbradney 748
 
3849 subik 749
        QToolTip::add( urSpinBox, "<qt>" + tr("Set the length of the action history in steps. If set to 0 infinite amount of actions will be stored.") + "</qt>");
1641 cbradney 750
 
4649 fschmid 751
//      QToolTip::add( PreviewSize, "<qt>" + tr( "Choose the size of the preview in the scrapbook palette" ) + "</qt>" );
1641 cbradney 752
 
3849 subik 753
        QToolTip::add( backColor, "<qt>" + tr( "Color for paper" ) + "</qt>");
754
        QToolTip::add( checkUnprintable, "<qt>" + tr( "Mask the area outside the margins in the margin color" ) + "</qt>" );
755
        QToolTip::add( CaliText, "<qt>" + tr( "Set the default zoom level" )  + "</qt>");
2598 cbradney 756
        QToolTip::add( CaliGroup, "<qt>" + tr( "Place a ruler against your screen and drag the slider to set the zoom level so Scribus will display your pages and objects on them at the correct size" ) + "</qt>" );
1641 cbradney 757
 
5326 cbradney 758
//      QToolTip::add( ghostscriptLineEdit, "<qt>" + tr( "Add the path for the Ghostscript interpreter. On Windows, please note it is important to note you need to use the program named gswin32c.exe - NOT gswin32.exe. Otherwise, this maybe cause a hang when starting Scribus." ) + "</qt>" );
759
//      QToolTip::add( GSantiText, "<qt>" + tr( "Antialias text for EPS and PDF onscreen rendering" ) + "</qt>");
760
//      QToolTip::add( GSantiGraph, "<qt>" + tr( "Antialias graphics for EPS and PDF onscreen rendering" ) + "</qt>" );
761
//      QToolTip::add( imageEditorLineEdit, "<qt>" + tr( "File system location for graphics editor. If you use gimp "
762
//                                              "and your distro includes it, we recommend 'gimp-remote', "
763
//                                              "as it allows you to edit the image in an already running "
764
//                                                              "instance of gimp." ) + "</qt>" );
4649 fschmid 765
/*      QToolTip::add( ClipMarg, "<qt>" + tr( "Do not show objects outside the margins on the printed page or exported file" ) + "</qt>" );
3849 subik 766
        QToolTip::add( DoGCR, "<qt>" + tr( "A way of switching off some of the gray shades which are composed "
767
                                          "of cyan, yellow and magenta and using black instead. "
768
                                          "UCR most affects parts of images which are neutral and/or dark tones "
769
                                          "which are close to the gray. Use of this may improve printing some images "
770
                                          "and some experimentation and testing is need on a case by case basis. "
771
                                                                                  "UCR reduces the possibility of over saturation with CMY inks." ) + "</qt>" );
4649 fschmid 772
*/
2598 cbradney 773
        QToolTip::add( leftScratch, "<qt>" + tr( "Defines amount of space left of the document canvas available as a pasteboard for creating and modifying elements and dragging them onto the active page" ) + "</qt>" );
774
        QToolTip::add( rightScratch, "<qt>" + tr( "Defines amount of space right of the document canvas available as a pasteboard for creating and modifying elements and dragging them onto the active page" ) + "</qt>" );
775
        QToolTip::add( topScratch, "<qt>" + tr( "Defines amount of space above the document canvas available as a pasteboard for creating and modifying elements and dragging them onto the active page" ) + "</qt>" );
776
        QToolTip::add( bottomScratch, "<qt>" + tr( "Defines amount of space below the document canvas available as a pasteboard for creating and modifying elements and dragging them onto the active page" ) + "</qt>" );
777
 
778
 
1641 cbradney 779
        // signals and slots connections
780
        connect( guiLangCombo, SIGNAL( activated( const QString & ) ), this, SLOT( setSelectedGUILang( const QString & ) ) );
781
        connect(backColor, SIGNAL(clicked()), this, SLOT(changePaperColor()));
5507 subik 782
        connect(unitCombo, SIGNAL(activated(int)), this, SLOT(unitChange()));
1641 cbradney 783
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
784
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
2901 fschmid 785
        connect(docLayout, SIGNAL( selectedLayout(int) ), this, SLOT( setDS(int) ) );
4555 cbradney 786
        connect(pageOrientationComboBox, SIGNAL(activated(int)), this, SLOT(setOrien(int)));
787
        connect(pageSizeComboBox, SIGNAL(activated(const QString &)), this, SLOT(setPageSize()));
1641 cbradney 788
        connect(FileC, SIGNAL(clicked()), this, SLOT(changeDocs()));
789
        connect(FileC2, SIGNAL(clicked()), this, SLOT(changeProfs()));
790
        connect(FileC3, SIGNAL(clicked()), this, SLOT(changeScripts()));
2093 cbradney 791
        connect(FileC4, SIGNAL(clicked()), this, SLOT(changeDocumentTemplates()));
5326 cbradney 792
//      connect(ghostscriptChangeButton, SIGNAL(clicked()), this, SLOT(changeGhostscript()));
793
//      connect(imageEditorChangeButton, SIGNAL(clicked()), this, SLOT(changeImageEditor()));
1641 cbradney 794
        connect(CaliSlider, SIGNAL(valueChanged(int)), this, SLOT(setDisScale()));
795
        connect(buttonOk, SIGNAL(clicked()), this, SLOT(setActionHistoryLength()));
796
        if (CMSavail)
797
                connect(tabColorManagement, SIGNAL(cmsOn(bool )), this, SLOT(switchCMS(bool )));
5504 subik 798
        connect(applyChangesButton, SIGNAL(clicked()), this, SLOT(applyChangesButton_clicked()));
5507 subik 799
        connect(backToDefaults, SIGNAL(clicked()), this, SLOT(backToDefaults_clicked()));
1641 cbradney 800
 
801
        setSize(prefsData->pageSize);
802
        setOrien(prefsData->pageOrientation);
1790 cbradney 803
        pageWidth->setValue(prefsData->PageWidth * unitRatio);
804
        pageHeight->setValue(prefsData->PageHeight * unitRatio);
2769 fschmid 805
        pageWidth->setSuffix(unitSuffix);
806
        pageHeight->setSuffix(unitSuffix);
1641 cbradney 807
 
1790 cbradney 808
        //unitChange();
1641 cbradney 809
        resize( minimumSizeHint() );
810
        arrangeIcons();
1834 fschmid 811
        prefsSelection->setSelected(prefsSelection->firstItem(), true);
812
        itemSelected(prefsSelection->firstItem());
1641 cbradney 813
        clearWState( WState_Polished );
814
}
815
 
5507 subik 816
void Preferences::restoreDefaults()
817
{
818
        prefsManager->initDefaults();
819
        ApplicationPrefs* prefsData=&(prefsManager->appPrefs);
820
        QWidget* current = prefsWidgets->visibleWidget();
821
 
822
        if (current == tabGeneral) // General
823
        {
824
                selectedGUILang = prefsData->guiLanguage;
825
                guiLangCombo->setCurrentText(langMgr.getLangFromAbbrev(selectedGUILang));
826
                GUICombo->setCurrentText(prefsData->GUI);
827
                showSplashCheckBox->setChecked( !ScQApp->neverSplashExists() );
828
                GFsize->setValue( prefsData->AppFontSize );
829
                GTFsize->setValue( prefsData->PaletteFontSize); // temp solution
830
                wheelJumpSpin->setValue( prefsData->Wheelval );
831
                Recen->setValue( prefsData->RecentDCount );
832
                Docs->setText(prefsData->DocDir);
833
                ProPfad->setText(prefsData->ProfileDir);
834
                ScriptPfad->setText(prefsData->ScriptDir);
835
                DocumentTemplateDir->setText(prefsData->documentTemplatesDir);
836
        }
837
        else if (current == tabDocument) // Document
5512 subik 838
        {
839
                docLayout->selectItem(prefsData->FacingPages);
840
                docLayout->firstPage->setCurrentItem(prefsData->pageSets[prefsData->FacingPages].FirstPage);
841
                pageOrientationComboBox->setCurrentItem(prefsData->pageOrientation);
842
                unitCombo->setCurrentItem(prefsData->docUnitIndex);
843
                pageWidth->setValue(prefsData->PageWidth * unitRatio);
844
                pageHeight->setValue(prefsData->PageHeight * unitRatio);
845
                marginGroup->setNewMargins(prefsData->RandOben, prefsData->RandUnten,
846
                                                                   prefsData->RandLinks, prefsData->RandRechts);
847
                marginGroup->setPageWidthHeight(prefsData->PageWidth, prefsData->PageHeight);
848
                GroupAS->setChecked( prefsData->AutoSave );
849
                ASTime->setValue(prefsData->AutoSaveTime / 1000 / 60);
5507 subik 850
        }
851
        else if (current == tabView) // Display
5556 subik 852
        {
853
                int decimals = unitGetPrecisionFromIndex(docUnitIndex);
854
                QString unitSuffix = unitGetSuffixFromIndex(docUnitIndex);
855
                QPixmap pm5(54, 14);
856
                pm5.fill(prefsData->DpapColor);
857
                colorPaper = prefsData->DpapColor;
858
                backColor->setPixmap(pm5);
859
                backColor->setText( QString::null );
860
                checkUnprintable->setChecked( prefsData->marginColored );
861
                checkPictures->setChecked(prefsData->guidesSettings.showPic);
862
                checkLink->setChecked(prefsData->guidesSettings.linkShown);
863
                checkControl->setChecked(prefsData->guidesSettings.showControls);
864
                checkFrame->setChecked(prefsData->guidesSettings.framesShown);
865
                checkRuler->setChecked(prefsData->guidesSettings.rulerMode);
866
                checkRuler->setChecked(prefsData->guidesSettings.rulerMode);
867
                topScratch->setDecimals( decimals );
868
                topScratch->setValue(prefsData->ScratchTop * unitRatio);
869
                leftScratch->setDecimals( decimals );
870
                leftScratch->setValue(prefsData->ScratchLeft * unitRatio);
871
                bottomScratch->setDecimals( decimals );
872
                bottomScratch->setValue(prefsData->ScratchBottom * unitRatio);
873
                rightScratch->setDecimals( decimals );
874
                rightScratch->setValue(prefsData->ScratchRight * unitRatio);
875
                topScratch->setSuffix(unitSuffix);
876
                bottomScratch->setSuffix(unitSuffix);
877
                leftScratch->setSuffix(unitSuffix);
878
                rightScratch->setSuffix(unitSuffix);
879
                gapHorizontal->setSuffix( unitSuffix );
880
                gapHorizontal->setDecimals( decimals );
881
                gapHorizontal->setValue(prefsData->pageSets[prefsData->FacingPages].GapHorizontal * unitRatio);
882
                gapVertical->setSuffix( unitSuffix );
883
                gapVertical->setDecimals( decimals );
884
                gapVertical->setValue(prefsData->pageSets[prefsData->FacingPages].GapVertical * unitRatio);
885
                drawRuler();
886
                CaliSlider->setValue(static_cast<int>(100 * DisScale)-100);
5507 subik 887
        }
888
        else if (current == tabHyphenator) // Hyphenator
5553 subik 889
        {
890
                tabHyphenator->verbose->setChecked(!prefsData->Automatic);
891
                tabHyphenator->input->setChecked(prefsData->AutoCheck);
892
                tabHyphenator->language->setCurrentText(ap->LangTransl[prefsData->Language]);
893
                tabHyphenator->wordLen->setValue(prefsData->MinWordLen);
894
                tabHyphenator->maxCount->setValue(prefsData->HyCount);
5507 subik 895
        }
896
        else if (current == tabGuides) // Guides
5512 subik 897
                tabGuides->restoreDefaults(&prefsData->guidesSettings, &prefsData->typographicSettings, docUnitIndex);
5507 subik 898
        else if (current == tabTypo) // Typography
5512 subik 899
                tabTypo->restoreDefaults(&prefsData->typographicSettings);
5507 subik 900
        else if (current == tabTools) // Tools
5512 subik 901
                tabTools->restoreDefaults(&prefsData->toolSettings, docUnitIndex);
5507 subik 902
        else if (current == tabFonts) // Fonts
5553 subik 903
                tabFonts->restoreDefaults();
5507 subik 904
        else if (current == tabDocChecker) // Preflight Verifier
5553 subik 905
                tabDocChecker->restoreDefaults(&prefsData->checkerProfiles, prefsData->curCheckProfile);
5507 subik 906
        else if (current == tabPDF) // PDF Export
5553 subik 907
        {
908
                QMap<QString, int> DocFonts;
909
                DocFonts.clear();
910
                tabPDF->restoreDefaults(prefsData->PDF_Options,
911
                                                                prefsData->AvailFonts,
912
                                                                ScCore->PDFXProfiles,
913
                                                                DocFonts,
914
                                                                prefsData->PDF_Options.PresentVals,
915
                                                                docUnitIndex,
916
                                                                prefsData->PageHeight,
917
                                                                prefsData->PageWidth,
918
                                                                0);
5507 subik 919
        }
5553 subik 920
        else if (current == tabColorManagement && CMSavail) // Color Management
921
                tabColorManagement->restoreDefaults();
5507 subik 922
        else if (current == tabDefaultItemAttributes) // Document Item Attributes
5556 subik 923
        {
924
                defaultAttributesList=tabDefaultItemAttributes->getDocAttributesNames();
925
                tabDefaultItemAttributes->setup(&prefsData->defaultItemAttributes);
5507 subik 926
        }
927
        else if (current == tabDefaultTOCIndexPrefs) // Table of Contents
5556 subik 928
        {
929
                tabDefaultTOCIndexPrefs->setupItemAttrs( defaultAttributesList );
930
                tabDefaultTOCIndexPrefs->setup(&prefsData->defaultToCSetups, NULL);
5507 subik 931
        }
932
        else if (current == tabKeyboardShortcuts) // Keyboard Shortcuts
5556 subik 933
                tabKeyboardShortcuts->restoreDefaults();
5507 subik 934
        else if (current == tabExtTools) // External Tools
5556 subik 935
                tabExtTools->restoreDefaults(prefsData);
5507 subik 936
        else if (current == tabMiscellaneous) // Miscellaneous
5556 subik 937
        {
938
                AskForSubs->setChecked(prefsData->askBeforeSubstituite);
939
                stylePreview->setChecked(prefsData->haveStylePreview);
940
                startUpDialog->setChecked(prefsData->showStartupDialog);
941
                useStandardLI->setChecked(prefsData->useStandardLI);
942
                paragraphsLI->setValue(prefsData->paragraphsLI);
5507 subik 943
        }
5556 subik 944
//      else if (current == pluginManagerPrefsGui) // Plugins   
5507 subik 945
}
946
 
3213 craig 947
void Preferences::addPlugins()
948
{
949
        // Scan for plugins that provide a prefs widget, and add it to the
950
        // prefs dialog.
3383 craig 951
        // For each plugin, enabled or not:
3213 craig 952
        PluginManager& pluginManager = PluginManager::instance();
3383 craig 953
        QValueList<QCString> pluginNames(pluginManager.pluginNames(true));
3213 craig 954
        QValueList<QCString>::Iterator itEnd(pluginNames.end());
955
        for (QValueList<QCString>::Iterator it(pluginNames.begin()); it != itEnd ; ++it )
956
        {
3214 craig 957
                // Ask the plugin manager for a plugin (skipping disabled plugins).
3213 craig 958
                ScPlugin* plugin = pluginManager.getPlugin(*it, false);
3214 craig 959
                // If we got a plugin (which we know is enabled):
960
                if (plugin)
3213 craig 961
                {
3214 craig 962
                        // Ask the plugin for a prefs widget
963
                        PrefsPanel* panel;
964
                        QString panelCaption;
965
                        QPixmap panelIcon;
966
                        bool wantPanel = plugin->newPrefsPanelWidget(
967
                                        prefsWidgets, panel, panelCaption, panelIcon);
968
                        // If it gave us one...
969
                        if (wantPanel)
970
                        {
971
                                // Ensure that we got sane return values
972
                                Q_ASSERT(panel);
973
                                Q_ASSERT(!panelIcon.isNull());
974
                                Q_ASSERT(!panelCaption.isNull());
975
                                // plug it in to the dialog,
976
                                addItem(panelCaption, panelIcon, panel);
977
                                // and connect a signal to tell it to save its
978
                                // settings.
979
                                connect(this, SIGNAL(accepted()), panel, SLOT(apply()));
980
                        }
3213 craig 981
                }
982
        }
983
}
984
 
985
void Preferences::accept()
986
{
987
        emit accepted();
988
        return PrefsDialogBase::accept();
989
}
990
 
1641 cbradney 991
void Preferences::changeDocs()
992
{
993
        QString s = QFileDialog::getExistingDirectory(Docs->text(), this, "d", tr("Choose a Directory"), true);
2877 cbradney 994
        if (!s.isEmpty())
1641 cbradney 995
                Docs->setText(s);
996
}
997
 
998
void Preferences::changeProfs()
999
{
1000
        QString s = QFileDialog::getExistingDirectory(ProPfad->text(), this, "d", tr("Choose a Directory"), true);
2877 cbradney 1001
        if (!s.isEmpty())
1641 cbradney 1002
                ProPfad->setText(s);
1003
}
1004
 
1005
void Preferences::changeScripts()
1006
{
1007
        QString s = QFileDialog::getExistingDirectory(ScriptPfad->text(), this, "d", tr("Choose a Directory"), true);
2877 cbradney 1008
        if (!s.isEmpty())
1641 cbradney 1009
                ScriptPfad->setText(s);
1010
}
1011
 
2093 cbradney 1012
void Preferences::changeDocumentTemplates()
1641 cbradney 1013
{
2093 cbradney 1014
        QString s = QFileDialog::getExistingDirectory(DocumentTemplateDir->text(), this, "d", tr("Choose a Directory"), true);
2877 cbradney 1015
        if (!s.isEmpty())
2093 cbradney 1016
                DocumentTemplateDir->setText(s);
1641 cbradney 1017
}
1018
 
5326 cbradney 1019
/*
2925 cbradney 1020
void Preferences::changeGhostscript()
1021
{
1022
        QFileInfo fi(ghostscriptLineEdit->text());
1023
        QString s = QFileDialog::getOpenFileName(fi.dirPath(), QString::null, this, "changeGhostscript", tr("Locate Ghostscript"));
1024
        if (!s.isEmpty())
1025
                ghostscriptLineEdit->setText(s);
1026
}
1027
 
1028
void Preferences::changeImageEditor()
1029
{
1030
        QFileInfo fi(imageEditorLineEdit->text());
1031
        QString s = QFileDialog::getOpenFileName(fi.dirPath(), QString::null, this, "changeImageEditor", tr("Locate your image editor"));
1032
        if (!s.isEmpty())
1033
                imageEditorLineEdit->setText(s);
1034
}
5326 cbradney 1035
*/
2925 cbradney 1036
 
2901 fschmid 1037
void Preferences::setDS(int layout)
1641 cbradney 1038
{
5512 subik 1039
        marginGroup->setFacingPages(!(layout == singlePage));
2901 fschmid 1040
        choosenLayout = layout;
3016 fschmid 1041
        docLayout->firstPage->setCurrentItem(prefsManager->appPrefs.pageSets[choosenLayout].FirstPage);
1042
        gapHorizontal->setValue(prefsManager->appPrefs.pageSets[choosenLayout].GapHorizontal * unitRatio);
1043
        gapVertical->setValue(prefsManager->appPrefs.pageSets[choosenLayout].GapVertical * unitRatio);
1641 cbradney 1044
}
1045
 
1046
void Preferences::setPageWidth(int)
1047
{
1790 cbradney 1048
        Pagebr = pageWidth->value() / unitRatio;
5512 subik 1049
        marginGroup->setPageWidth(Pagebr);
4555 cbradney 1050
        QString psText=pageSizeComboBox->currentText();
1051
        if (psText!=customTextTR && psText!=customText)
1052
                pageSizeComboBox->setCurrentItem(pageSizeComboBox->count()-1);
1641 cbradney 1053
}
1054
 
1055
void Preferences::setPageHeight(int)
1056
{
1790 cbradney 1057
        Pageho = pageHeight->value() / unitRatio;
5512 subik 1058
        marginGroup->setPageHeight(Pageho);
4555 cbradney 1059
        QString psText=pageSizeComboBox->currentText();
1060
        if (psText!=customTextTR && psText!=customText)
1061
                pageSizeComboBox->setCurrentItem(pageSizeComboBox->count()-1);
1641 cbradney 1062
}
1063
 
2923 fschmid 1064
void Preferences::setPageSize()
1065
{
4555 cbradney 1066
        setOrien(pageOrientationComboBox->currentItem());
2923 fschmid 1067
}
1068
 
1641 cbradney 1069
void Preferences::setSize(const QString & gr)
1070
{
1790 cbradney 1071
        Pagebr = pageWidth->value() / unitRatio;
1072
        Pageho = pageHeight->value() / unitRatio;
4555 cbradney 1073
        //pageWidth->setEnabled(false);
1074
        //pageHeight->setEnabled(false);
1641 cbradney 1075
        PageSize *ps2=new PageSize(gr);
1076
 
1077
        prefsPageSizeName=ps2->getPageName();
4555 cbradney 1078
        if (gr == customTextTR)
1641 cbradney 1079
        {
4555 cbradney 1080
                //pageWidth->setEnabled(true);
1081
                //pageHeight->setEnabled(true);
1641 cbradney 1082
        }
1083
        else
1084
        {
1085
                Pagebr = ps2->getPageWidth();
1086
                Pageho = ps2->getPageHeight();
1087
        }
1088
        disconnect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1089
        disconnect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1790 cbradney 1090
        pageWidth->setValue(Pagebr * unitRatio);
1091
        pageHeight->setValue(Pageho * unitRatio);
5512 subik 1092
        marginGroup->setPageHeight(Pageho);
1093
        marginGroup->setPageWidth(Pagebr);
1094
        marginGroup->setPageSize(gr);
1641 cbradney 1095
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1096
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
2607 fschmid 1097
        delete ps2;
1641 cbradney 1098
}
1099
 
1100
void Preferences::setOrien(int ori)
1101
{
1102
        double br;
4555 cbradney 1103
        setSize(pageSizeComboBox->currentText());
1641 cbradney 1104
        disconnect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1105
        disconnect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1106
        if (ori == 0)
1107
        {
4555 cbradney 1108
                //if (pageSizeComboBox->currentItem() == 30)
1109
                if (pageSizeComboBox->currentText() == customTextTR)
1641 cbradney 1110
                {
1111
                        br = pageWidth->value();
1112
                        pageWidth->setValue(pageHeight->value());
1113
                        pageHeight->setValue(br);
1114
                }
1115
        }
1116
        else
1117
        {
1118
                br = pageWidth->value();
1119
                pageWidth->setValue(pageHeight->value());
1120
                pageHeight->setValue(br);
1121
        }
1122
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1123
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1124
}
1125
 
1126
void Preferences::changePaperColor()
1127
{
1128
        QColor neu = QColor();
1129
        neu = QColorDialog::getColor(colorPaper, this);
1130
        if (neu.isValid())
1131
        {
3333 avox 1132
                QPixmap pm(54, 14);
1641 cbradney 1133
                pm.fill(neu);
1134
                colorPaper = neu;
1135
                backColor->setPixmap(pm);
1136
        }
1137
}
1138
 
1139
void Preferences::unitChange()
1140
{
1141
        disconnect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1142
        disconnect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1143
        int decimals;
1790 cbradney 1144
        double oldUnitRatio = unitRatio;
1641 cbradney 1145
        double oldMin, oldMax, oldB, oldBM, oldH, oldHM, val;
1146
        pageWidth->getValues(&oldB, &oldBM, &decimals, &val);
1790 cbradney 1147
        oldB /= oldUnitRatio;
1148
        oldBM /= oldUnitRatio;
1641 cbradney 1149
        pageHeight->getValues(&oldH, &oldHM, &decimals, &val);
1790 cbradney 1150
        oldH /= oldUnitRatio;
1151
        oldHM /= oldUnitRatio;
1641 cbradney 1152
        QString einh;
5507 subik 1153
        docUnitIndex = unitCombo->currentItem();
1790 cbradney 1154
        unitRatio = unitGetRatioFromIndex(docUnitIndex);
1641 cbradney 1155
        decimals = unitGetDecimalsFromIndex(docUnitIndex);
1156
        einh = unitGetSuffixFromIndex(docUnitIndex);
2784 subik 1157
 
1641 cbradney 1158
        pageWidth->setSuffix(einh);
1159
        pageHeight->setSuffix(einh);
1160
        tabGuides->minorSpace->setSuffix(einh);
1161
        tabGuides->majorSpace->setSuffix(einh);
1162
        tabGuides->snapDistance->setSuffix(einh);
1163
        tabGuides->baseGrid->setSuffix(einh);
1164
        tabGuides->baseOffset->setSuffix(einh);
1165
        tabTools->gapText->setSuffix(einh);
1166
        topScratch->setSuffix(einh);
1167
        bottomScratch->setSuffix(einh);
1168
        leftScratch->setSuffix(einh);
1169
        rightScratch->setSuffix(einh);
2872 fschmid 1170
        gapVertical->setSuffix( einh );
1171
        gapHorizontal->setSuffix( einh );
1790 cbradney 1172
        pageWidth->setValues(oldB * unitRatio, oldBM * unitRatio, decimals, Pagebr * unitRatio);
1173
        pageHeight->setValues(oldH * unitRatio, oldHM * unitRatio, decimals, Pageho * unitRatio);
5512 subik 1174
        marginGroup->unitChange(unitRatio, decimals, einh);
1175
        marginGroup->setPageHeight(Pageho);
1176
        marginGroup->setPageWidth(Pagebr);
1641 cbradney 1177
        int decimalsOld;
1790 cbradney 1178
        double invUnitConversion = 1.0 / oldUnitRatio * unitRatio;
2784 subik 1179
 
1641 cbradney 1180
        tabGuides->minorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1181
        tabGuides->minorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1182
        tabGuides->majorSpace->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1183
        tabGuides->majorSpace->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1184
        tabGuides->snapDistance->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1185
        tabGuides->snapDistance->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1186
        tabGuides->baseGrid->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1187
        tabGuides->baseGrid->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1188
        tabGuides->baseOffset->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1189
        tabGuides->baseOffset->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1190
        tabTools->gapText->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1191
        tabTools->gapText->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
2285 fschmid 1192
        tabTools->gapTab->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1193
        tabTools->gapTab->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1641 cbradney 1194
        topScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1195
        topScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1196
        bottomScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1197
        bottomScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1198
        leftScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1199
        leftScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1200
        rightScratch->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1201
        rightScratch->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
2872 fschmid 1202
        gapVertical->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1203
        gapVertical->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
1204
        gapHorizontal->getValues(&oldMin, &oldMax, &decimalsOld, &val);
1205
        gapHorizontal->setValues(oldMin * invUnitConversion, oldMax * invUnitConversion, decimals, val * invUnitConversion);
4257 craig 1206
        tabPDF->unitChange(docUnitIndex);
1641 cbradney 1207
        drawRuler();
1208
        connect(pageWidth, SIGNAL(valueChanged(int)), this, SLOT(setPageWidth(int)));
1209
        connect(pageHeight, SIGNAL(valueChanged(int)), this, SLOT(setPageHeight(int)));
1210
}
1211
 
1212
void Preferences::setDisScale()
1213
{
1214
        DisScale = QMAX((100.0 + CaliSlider->value()) / 100.0, 0.01);
1215
        drawRuler();
1216
        CaliAnz->setText(QString::number(DisScale*100, 'f', 2)+" %");
1217
}
1218
 
1219
void Preferences::drawRuler()
1220
{
1221
        double xl, iter, iter2, maxi;
1222
        switch (docUnitIndex)
1223
        {
1224
        case 0:
1225
                iter = 10.0;
1226
                iter2 = iter * 10.0;
1227
                maxi = 200.0;
1228
                break;
1229
        case 1:
1230
                iter = (10.0 / 25.4) * 72.0;
1231
                iter2 = iter * 10.0;
1232
                maxi = iter2;
1233
                break;
1234
        case 2:
1235
                iter = 18.0;
1236
                iter2 = 72.0;
1237
                maxi = 2 * iter2;
1238
                break;
1239
        case 3:
1240
                iter = 12.0;
1241
                iter2 = 120.0;
1242
                maxi = 240.0;
1243
                break;
2925 cbradney 1244
        case 4:
1245
                iter = 12.0;
1246
                iter2 = 120.0;
1247
                maxi = 240.0;
3849 subik 1248
                break;
1641 cbradney 1249
        default:
1250
                iter = 10.0;
1251
                iter2 = iter * 10.0;
1252
                maxi = 200.0;
1253
                break;
1254
        }
1255
 
1256
        QPixmap pm(static_cast<int>(maxi*DisScale+30), 21);
1257
        pm.fill();
1258
        QPainter p;
1259
        p.begin(&pm);
1260
        p.drawLine(0, 19, width(), 19);
1261
        p.setBrush(black);
1262
        p.setPen(black);
1263
        p.scale(DisScale, 1.0);
1264
        for (xl = 0; xl < maxi; xl += iter)
1265
                p.drawLine(static_cast<int>(xl), 13, static_cast<int>(xl), 19);
1266
        for (xl = 0; xl < maxi+10; xl += iter2)
1267
        {
1268
                p.drawLine(static_cast<int>(xl), 6, static_cast<int>(xl), 19);
1269
                p.save();
1270
                p.scale(1.0 / DisScale, 1.0);
1271
                switch (docUnitIndex)
1272
                {
1273
                case 2:
1274
                        p.drawText(static_cast<int>((xl+qRound(2/DisScale)) * DisScale), 12,
1275
                                   QString::number(xl / iter2));
1276
                        break;
1277
                case 3:
1278
                        p.drawText(static_cast<int>((xl+qRound(2/DisScale)) * DisScale), 12,
1279
                                   QString::number(xl / iter));
1280
                        break;
1281
                default:
1282
                        p.drawText(static_cast<int>((xl+qRound(2/DisScale)) * DisScale), 12,
1283
                                   QString::number(xl / iter * 10));
1284
                        break;
1285
                }
1286
                p.restore();
1287
        }
1288
        p.end();
1289
        CaliRuler->setPixmap(pm);
1290
}
1291
/*
1292
QString Preferences::getSelectedGUILang( )
1293
{
1294
        return langMgr.getAbbrevFromLang(guiLangCombo->currentText());
1295
}
1296
*/
1297
void Preferences::setSelectedGUILang( const QString &newLang )
1298
{
1299
        selectedGUILang=langMgr.getAbbrevFromLang(newLang);
1300
}
1301
 
1302
void Preferences::setActionHistoryLength()
1303
{
5504 subik 1304
        UndoManager::instance()->setHistoryLength(urSpinBox->value());
1641 cbradney 1305
}
1306
 
1307
void Preferences::switchCMS(bool enable)
1308
{
1309
        tabPDF->enableCMS(enable);
1310
}
1311
 
1701 cbradney 1312
void Preferences::setTOCIndexData(QWidget *widgetToShow)
1313
{
2784 subik 1314
        //Update the attributes list in TOC setup
1701 cbradney 1315
        if (widgetToShow==tabDefaultTOCIndexPrefs)
1316
                tabDefaultTOCIndexPrefs->setupItemAttrs( tabDefaultItemAttributes->getDocAttributesNames() );
1317
}
2873 cbradney 1318
 
1319
void Preferences::updatePreferences()
1320
{
1321
        prefsManager->appPrefs.AppFontSize = GFsize->value();
3940 tsoots 1322
        prefsManager->appPrefs.PaletteFontSize = GTFsize->value();
5342 cbradney 1323
        ScQApp->neverSplash(!showSplashCheckBox->isChecked());
5507 subik 1324
        prefsManager->appPrefs.Wheelval = wheelJumpSpin->value();
2873 cbradney 1325
        prefsManager->appPrefs.RecentDCount = Recen->value();
1326
        prefsManager->appPrefs.DocDir = Docs->text();
1327
        prefsManager->appPrefs.ProfileDir = ProPfad->text();
1328
        prefsManager->appPrefs.ScriptDir = ScriptPfad->text();
1329
        prefsManager->appPrefs.documentTemplatesDir = DocumentTemplateDir->text();
4649 fschmid 1330
/*      switch (PreviewSize->currentItem())
2873 cbradney 1331
        {
1332
                case 0:
1333
                        prefsManager->appPrefs.PSize = 40;
1334
                        break;
1335
                case 1:
1336
                        prefsManager->appPrefs.PSize = 60;
1337
                        break;
1338
                case 2:
1339
                        prefsManager->appPrefs.PSize = 80;
1340
                        break;
4649 fschmid 1341
        } */
2873 cbradney 1342
        prefsManager->appPrefs.guiLanguage=selectedGUILang;
1343
        prefsManager->appPrefs.GUI = GUICombo->currentText();
1344
        tabTools->polyWidget->getValues(&prefsManager->appPrefs.toolSettings.polyC, &prefsManager->appPrefs.toolSettings.polyFd, &prefsManager->appPrefs.toolSettings.polyF, &prefsManager->appPrefs.toolSettings.polyS, &prefsManager->appPrefs.toolSettings.polyR);
1345
        prefsManager->appPrefs.pageSize = prefsPageSizeName;
4555 cbradney 1346
        prefsManager->appPrefs.pageOrientation = pageOrientationComboBox->currentItem();
2873 cbradney 1347
        prefsManager->appPrefs.PageWidth = Pagebr;
1348
        prefsManager->appPrefs.PageHeight = Pageho;
5512 subik 1349
        prefsManager->appPrefs.RandOben = marginGroup->top();
1350
        prefsManager->appPrefs.RandUnten = marginGroup->bottom();
1351
        prefsManager->appPrefs.RandLinks = marginGroup->left();
1352
        prefsManager->appPrefs.RandRechts = marginGroup->right();
5507 subik 1353
        double prefsUnitRatio = unitGetRatioFromIndex(unitCombo->currentItem());
2901 fschmid 1354
        prefsManager->appPrefs.FacingPages  = choosenLayout;
3016 fschmid 1355
        prefsManager->appPrefs.pageSets[choosenLayout].FirstPage = docLayout->firstPage->currentItem();
1356
        prefsManager->appPrefs.pageSets[choosenLayout].GapHorizontal = gapHorizontal->value() / prefsUnitRatio;
1357
        prefsManager->appPrefs.pageSets[choosenLayout].GapVertical = gapVertical->value() / prefsUnitRatio;
5326 cbradney 1358
        prefsManager->setImageEditorExecutable(tabExtTools->newImageTool());
5418 cbradney 1359
        prefsManager->setExtBrowserExecutable(tabExtTools->newExtBrowserTool());
5326 cbradney 1360
        prefsManager->appPrefs.gs_AntiAliasGraphics = tabExtTools->newAntialiasGraphics();
1361
        prefsManager->appPrefs.gs_AntiAliasText = tabExtTools->newAntialiasText();
1362
        prefsManager->setGhostscriptExecutable(tabExtTools->newPSTool());
1363
        prefsManager->appPrefs.gs_Resolution = tabExtTools->newPSToolResolution();
1364
/*      prefsManager->setImageEditorExecutable(imageEditorLineEdit->text());
2873 cbradney 1365
        prefsManager->appPrefs.gs_AntiAliasGraphics = GSantiGraph->isChecked();
1366
        prefsManager->appPrefs.gs_AntiAliasText = GSantiText->isChecked();
2925 cbradney 1367
        prefsManager->setGhostscriptExecutable(ghostscriptLineEdit->text());
5326 cbradney 1368
        prefsManager->appPrefs.gs_Resolution = GSResolution->value();*/
4649 fschmid 1369
//      prefsManager->appPrefs.ClipMargin = ClipMarg->isChecked();
1370
//      prefsManager->appPrefs.GCRMode = DoGCR->isChecked();
2873 cbradney 1371
        prefsManager->appPrefs.guidesSettings.before = tabGuides->inBackground->isChecked();
1372
        prefsManager->appPrefs.marginColored = checkUnprintable->isChecked();
1373
        prefsManager->appPrefs.askBeforeSubstituite = AskForSubs->isChecked();
1374
        prefsManager->appPrefs.haveStylePreview = stylePreview->isChecked();
1375
        prefsManager->appPrefs.showStartupDialog = startUpDialog->isChecked();
1376
        // lorem ipsum
1377
        prefsManager->appPrefs.useStandardLI = useStandardLI->isChecked();
1378
        prefsManager->appPrefs.paragraphsLI = paragraphsLI->value();
1379
        prefsManager->appPrefs.DisScale = DisScale;
3849 subik 1380
 
5507 subik 1381
        prefsManager->appPrefs.docUnitIndex = unitCombo->currentItem();
2873 cbradney 1382
        prefsManager->appPrefs.ScratchBottom = bottomScratch->value() / prefsUnitRatio;
1383
        prefsManager->appPrefs.ScratchLeft = leftScratch->value() / prefsUnitRatio;
1384
        prefsManager->appPrefs.ScratchRight = rightScratch->value() / prefsUnitRatio;
1385
        prefsManager->appPrefs.ScratchTop = topScratch->value() / prefsUnitRatio;
1386
        prefsManager->appPrefs.DpapColor = colorPaper;
1387
        prefsManager->appPrefs.toolSettings.defFont = tabTools->fontComboText->currentText();
1388
        prefsManager->appPrefs.toolSettings.defSize = tabTools->sizeComboText->currentText().left(2).toInt() * 10;
1389
        prefsManager->appPrefs.guidesSettings.marginsShown = tabGuides->marginBox->isChecked();
1390
        prefsManager->appPrefs.guidesSettings.framesShown = checkFrame->isChecked();
1391
        prefsManager->appPrefs.guidesSettings.rulerMode = checkRuler->isChecked();
1392
        prefsManager->appPrefs.guidesSettings.gridShown = tabGuides->checkGrid->isChecked();
1393
        prefsManager->appPrefs.guidesSettings.guidesShown = tabGuides->guideBox->isChecked();
1394
        prefsManager->appPrefs.guidesSettings.baseShown = tabGuides->baselineBox->isChecked();
1395
        prefsManager->appPrefs.guidesSettings.showPic = checkPictures->isChecked();
1396
        prefsManager->appPrefs.guidesSettings.linkShown = checkLink->isChecked();
1397
        prefsManager->appPrefs.guidesSettings.showControls = checkControl->isChecked();
1398
        prefsManager->appPrefs.guidesSettings.grabRad = tabGuides->grabDistance->value();
1399
        prefsManager->appPrefs.guidesSettings.guideRad = tabGuides->snapDistance->value() / prefsUnitRatio;
1400
        prefsManager->appPrefs.guidesSettings.minorGrid = tabGuides->minorSpace->value() / prefsUnitRatio;
1401
        prefsManager->appPrefs.guidesSettings.majorGrid = tabGuides->majorSpace->value() / prefsUnitRatio;
1402
        prefsManager->appPrefs.guidesSettings.minorColor = tabGuides->colorMinorGrid;
1403
        prefsManager->appPrefs.guidesSettings.majorColor = tabGuides->colorMajorGrid;
1404
        prefsManager->appPrefs.guidesSettings.margColor = tabGuides->colorMargin;
1405
        prefsManager->appPrefs.guidesSettings.guideColor = tabGuides->colorGuides;
1406
        prefsManager->appPrefs.guidesSettings.baseColor = tabGuides->colorBaselineGrid;
1407
        prefsManager->appPrefs.checkerProfiles = tabDocChecker->checkerProfile;
1408
        prefsManager->appPrefs.curCheckProfile = tabDocChecker->curCheckProfile->currentText();
2889 cbradney 1409
        prefsManager->appPrefs.typographicSettings.valueSuperScript = tabTypo->superDisplacement->value();
1410
        prefsManager->appPrefs.typographicSettings.scalingSuperScript = tabTypo->superScaling->value();
1411
        prefsManager->appPrefs.typographicSettings.valueSubScript = tabTypo->subDisplacement->value();
1412
        prefsManager->appPrefs.typographicSettings.scalingSubScript = tabTypo->subScaling->value();
1413
        prefsManager->appPrefs.typographicSettings.valueSmallCaps = tabTypo->capsScaling->value();
1414
        prefsManager->appPrefs.typographicSettings.autoLineSpacing = tabTypo->autoLine->value();
1415
        prefsManager->appPrefs.typographicSettings.valueBaseGrid = tabGuides->baseGrid->value() / prefsUnitRatio;
1416
        prefsManager->appPrefs.typographicSettings.offsetBaseGrid = tabGuides->baseOffset->value() / prefsUnitRatio;
1417
        prefsManager->appPrefs.typographicSettings.valueUnderlinePos = qRound(tabTypo->underlinePos->value() * 10);
1418
        prefsManager->appPrefs.typographicSettings.valueUnderlineWidth = qRound(tabTypo->underlineWidth->value() * 10);
1419
        prefsManager->appPrefs.typographicSettings.valueStrikeThruPos = qRound(tabTypo->strikethruPos->value() * 10);
1420
        prefsManager->appPrefs.typographicSettings.valueStrikeThruWidth = qRound(tabTypo->strikethruWidth->value() * 10);
3093 fschmid 1421
        prefsManager->appPrefs.toolSettings.dTextBackGround = tabTools->colorComboTextBackground->currentText();
4730 subik 1422
        if (prefsManager->appPrefs.toolSettings.dTextBackGround == CommonStrings::NoneColor)
4546 subik 1423
                prefsManager->appPrefs.toolSettings.dTextBackGround = CommonStrings::None;
3093 fschmid 1424
        prefsManager->appPrefs.toolSettings.dTextLineColor = tabTools->colorComboTextLine->currentText();
4730 subik 1425
        if (prefsManager->appPrefs.toolSettings.dTextLineColor == CommonStrings::NoneColor)
4546 subik 1426
                prefsManager->appPrefs.toolSettings.dTextLineColor = CommonStrings::None;
3093 fschmid 1427
        prefsManager->appPrefs.toolSettings.dTextBackGroundShade = tabTools->shadingTextBack->value();
1428
        prefsManager->appPrefs.toolSettings.dTextLineShade = tabTools->shadingTextLine->value();
1429
        prefsManager->appPrefs.toolSettings.dTextPenShade = tabTools->shadingText->value();
1430
        prefsManager->appPrefs.toolSettings.dTextStrokeShade = tabTools->shadingTextStroke->value();
2873 cbradney 1431
        prefsManager->appPrefs.toolSettings.dPen = tabTools->colorComboLineShape->currentText();
4730 subik 1432
        if (prefsManager->appPrefs.toolSettings.dPen == CommonStrings::NoneColor)
4546 subik 1433
                prefsManager->appPrefs.toolSettings.dPen = CommonStrings::None;
2873 cbradney 1434
        prefsManager->appPrefs.toolSettings.dPenText = tabTools->colorComboText->currentText();
4730 subik 1435
        if (prefsManager->appPrefs.toolSettings.dPenText == CommonStrings::NoneColor)
4546 subik 1436
                prefsManager->appPrefs.toolSettings.dPenText = CommonStrings::None;
2873 cbradney 1437
        prefsManager->appPrefs.toolSettings.dStrokeText = tabTools->colorComboStrokeText->currentText();
4730 subik 1438
        if (prefsManager->appPrefs.toolSettings.dStrokeText == CommonStrings::NoneColor)
4546 subik 1439
                prefsManager->appPrefs.toolSettings.dStrokeText = CommonStrings::None;
2873 cbradney 1440
        prefsManager->appPrefs.toolSettings.dCols = tabTools->columnsText->value();
1441
        prefsManager->appPrefs.toolSettings.dGap = tabTools->gapText->value() / prefsUnitRatio;
1442
        prefsManager->appPrefs.toolSettings.dTabWidth = tabTools->gapTab->value() / prefsUnitRatio;
1443
        prefsManager->appPrefs.toolSettings.dBrush = tabTools->comboFillShape->currentText();
4730 subik 1444
        if (prefsManager->appPrefs.toolSettings.dBrush == CommonStrings::NoneColor)
4546 subik 1445
                prefsManager->appPrefs.toolSettings.dBrush = CommonStrings::None;
2873 cbradney 1446
        prefsManager->appPrefs.toolSettings.dShade = tabTools->shadingFillShape->value();
1447
        prefsManager->appPrefs.toolSettings.dShade2 = tabTools->shadingLineShape->value();
1448
        switch (tabTools->tabFillCombo->currentItem())
1449
        {
1450
                case 0:
1451
                        prefsManager->appPrefs.toolSettings.tabFillChar = "";
1452
                        break;
1453
                case 1:
1454
                        prefsManager->appPrefs.toolSettings.tabFillChar = ".";
1455
                        break;
1456
                case 2:
1457
                        prefsManager->appPrefs.toolSettings.tabFillChar = "-";
1458
                        break;
1459
                case 3:
1460
                        prefsManager->appPrefs.toolSettings.tabFillChar = "_";
1461
                        break;
1462
                case 4:
1463
                        prefsManager->appPrefs.toolSettings.tabFillChar = tabTools->tabFillCombo->currentText().right(1);
1464
                        break;
1465
        }
1466
        switch (tabTools->comboStyleShape->currentItem())
1467
        {
1468
                case 0:
1469
                        prefsManager->appPrefs.toolSettings.dLineArt = SolidLine;
1470
                        break;
1471
                case 1:
1472
                        prefsManager->appPrefs.toolSettings.dLineArt = DashLine;
1473
                        break;
1474
                case 2:
1475
                        prefsManager->appPrefs.toolSettings.dLineArt = DotLine;
1476
                        break;
1477
                case 3:
1478
                        prefsManager->appPrefs.toolSettings.dLineArt = DashDotLine;
1479
                        break;
1480
                case 4:
1481
                        prefsManager->appPrefs.toolSettings.dLineArt = DashDotDotLine;
1482
                        break;
1483
        }
1484
        prefsManager->appPrefs.toolSettings.dWidth = tabTools->lineWidthShape->value();
1485
        prefsManager->appPrefs.toolSettings.dPenLine = tabTools->colorComboLine->currentText();
4730 subik 1486
        if (prefsManager->appPrefs.toolSettings.dPenLine == CommonStrings::NoneColor)
4546 subik 1487
                prefsManager->appPrefs.toolSettings.dPenLine = CommonStrings::None;
2873 cbradney 1488
        prefsManager->appPrefs.toolSettings.dShadeLine = tabTools->shadingLine->value();
1489
        switch (tabTools->comboStyleLine->currentItem())
1490
        {
1491
        case 0:
1492
                prefsManager->appPrefs.toolSettings.dLstyleLine = SolidLine;
1493
                break;
1494
        case 1:
1495
                prefsManager->appPrefs.toolSettings.dLstyleLine = DashLine;
1496
                break;
1497
        case 2:
1498
                prefsManager->appPrefs.toolSettings.dLstyleLine = DotLine;
1499
                break;
1500
        case 3:
1501
                prefsManager->appPrefs.toolSettings.dLstyleLine = DashDotLine;
1502
                break;
1503
        case 4:
1504
                prefsManager->appPrefs.toolSettings.dLstyleLine = DashDotDotLine;
1505
                break;
1506
        }
1507
        prefsManager->appPrefs.toolSettings.dWidthLine = tabTools->lineWidthLine->value();
1508
        prefsManager->appPrefs.toolSettings.dStartArrow = tabTools->startArrow->currentItem();
1509
        prefsManager->appPrefs.toolSettings.dEndArrow = tabTools->endArrow->currentItem();
1510
        prefsManager->appPrefs.toolSettings.magMin = tabTools->minimumZoom->value();
1511
        prefsManager->appPrefs.toolSettings.magMax = tabTools->maximumZoom->value();
1512
        prefsManager->appPrefs.toolSettings.magStep = tabTools->zoomStep->value();
1513
        prefsManager->appPrefs.toolSettings.dBrushPict = tabTools->comboFillImage->currentText();
4730 subik 1514
        if (prefsManager->appPrefs.toolSettings.dBrushPict == CommonStrings::NoneColor)
4546 subik 1515
                prefsManager->appPrefs.toolSettings.dBrushPict = CommonStrings::None;
2873 cbradney 1516
        prefsManager->appPrefs.toolSettings.shadePict = tabTools->shadingFillImage->value();
1517
        prefsManager->appPrefs.toolSettings.scaleX = static_cast<double>(tabTools->scalingHorizontal->value()) / 100.0;
1518
        prefsManager->appPrefs.toolSettings.scaleY = static_cast<double>(tabTools->scalingVertical->value()) / 100.0;
1519
        prefsManager->appPrefs.toolSettings.scaleType = tabTools->buttonGroup3->isChecked();
1520
        prefsManager->appPrefs.toolSettings.aspectRatio = tabTools->checkRatioImage->isChecked();
1521
        prefsManager->appPrefs.toolSettings.useEmbeddedPath = tabTools->embeddedPath->isChecked();
1522
        int haRes = 0;
1523
        if (tabTools->checkFullRes->isChecked())
1524
                haRes = 0;
1525
        if (tabTools->checkNormalRes->isChecked())
1526
                haRes = 1;
1527
        if (tabTools->checkHalfRes->isChecked())
1528
                haRes = 2;
1529
        prefsManager->appPrefs.toolSettings.lowResType = haRes;
3389 fschmid 1530
        prefsManager->appPrefs.AutoSave = GroupAS->isChecked();
2873 cbradney 1531
        prefsManager->appPrefs.AutoSaveTime = ASTime->value() * 60 * 1000;
1532
        prefsManager->appPrefs.MinWordLen = tabHyphenator->wordLen->value();
4026 craig 1533
        prefsManager->appPrefs.Language = ScMW->GetLang(tabHyphenator->language->currentText());
2873 cbradney 1534
        prefsManager->appPrefs.Automatic = !tabHyphenator->verbose->isChecked();
1535
        prefsManager->appPrefs.AutoCheck = tabHyphenator->input->isChecked();
1536
        prefsManager->appPrefs.HyCount = tabHyphenator->maxCount->value();
1537
        if (CMSavail)
1538
                tabColorManagement->setValues();
1539
        uint a = 0;
1540
        SCFontsIterator it(prefsManager->appPrefs.AvailFonts);
1541
        for ( ; it.current() ; ++it)
1542
        {
5387 avox 1543
                it.current()->embedPs(tabFonts->fontFlags[it.currentKey()].FlagPS);
1544
                it.current()->useFont(tabFonts->fontFlags[it.currentKey()].FlagUse);
1545
                it.current()->subset(tabFonts->fontFlags[it.currentKey()].FlagSub);
2873 cbradney 1546
        }
1547
        a = 0;
1548
        QMap<QString,QString>::Iterator itfsuend=tabFonts->RList.end();
1549
        prefsManager->appPrefs.GFontSub.clear();
1550
        for (QMap<QString,QString>::Iterator itfsu = tabFonts->RList.begin(); itfsu != itfsuend; ++itfsu)
1551
                prefsManager->appPrefs.GFontSub[itfsu.key()] = tabFonts->FlagsRepl.at(a++)->currentText();
1552
        prefsManager->appPrefs.PDF_Options.Thumbnails = tabPDF->CheckBox1->isChecked();
1553
        prefsManager->appPrefs.PDF_Options.Compress = tabPDF->Compression->isChecked();
1554
        prefsManager->appPrefs.PDF_Options.CompressMethod = tabPDF->CMethod->currentItem();
1555
        prefsManager->appPrefs.PDF_Options.Quality = tabPDF->CQuality->currentItem();
1556
        prefsManager->appPrefs.PDF_Options.Resolution = tabPDF->Resolution->value();
1557
        prefsManager->appPrefs.PDF_Options.RecalcPic = tabPDF->DSColor->isChecked();
1558
        prefsManager->appPrefs.PDF_Options.PicRes = tabPDF->ValC->value();
1559
        prefsManager->appPrefs.PDF_Options.Bookmarks = tabPDF->CheckBM->isChecked();
1560
        prefsManager->appPrefs.PDF_Options.Binding = tabPDF->ComboBind->currentItem();
1561
        prefsManager->appPrefs.PDF_Options.MirrorH = tabPDF->MirrorH->isOn();
1562
        prefsManager->appPrefs.PDF_Options.MirrorV = tabPDF->MirrorV->isOn();
1563
        prefsManager->appPrefs.PDF_Options.RotateDeg = tabPDF->RotateDeg->currentItem() * 90;
1564
        prefsManager->appPrefs.PDF_Options.Articles = tabPDF->Article->isChecked();
1565
        prefsManager->appPrefs.PDF_Options.Encrypt = tabPDF->Encry->isChecked();
1566
        prefsManager->appPrefs.PDF_Options.UseLPI = tabPDF->UseLPI->isChecked();
5320 fschmid 1567
        prefsManager->appPrefs.PDF_Options.UseSpotColors = tabPDF->overprintMode->isChecked();
1568
        prefsManager->appPrefs.PDF_Options.doOverprint = !tabPDF->useSpot->isChecked();
3079 fschmid 1569
        prefsManager->appPrefs.PDF_Options.doMultiFile = false;
2873 cbradney 1570
        prefsManager->appPrefs.PDF_Options.BleedBottom = tabPDF->BleedBottom->value() / prefsUnitRatio;
1571
        prefsManager->appPrefs.PDF_Options.BleedTop = tabPDF->BleedTop->value() / prefsUnitRatio;
1572
        prefsManager->appPrefs.PDF_Options.BleedLeft = tabPDF->BleedLeft->value() / prefsUnitRatio;
1573
        prefsManager->appPrefs.PDF_Options.BleedRight = tabPDF->BleedRight->value() / prefsUnitRatio;
4649 fschmid 1574
        prefsManager->appPrefs.PDF_Options.doClip = tabPDF->ClipMarg->isChecked();
2873 cbradney 1575
        if (tabPDF->Encry->isChecked())
1576
        {
1577
                int Perm = -64;
1578
                if (tabPDF->PDFVersionCombo->currentItem() == 1)
1579
                        Perm &= ~0x00240000;
1580
                if (tabPDF->PrintSec->isChecked())
1581
                        Perm += 4;
1582
                if (tabPDF->ModifySec->isChecked())
1583
                        Perm += 8;
1584
                if (tabPDF->CopySec->isChecked())
1585
                        Perm += 16;
1586
                if (tabPDF->AddSec->isChecked())
1587
                        Perm += 32;
1588
                prefsManager->appPrefs.PDF_Options.Permissions = Perm;
1589
                prefsManager->appPrefs.PDF_Options.PassOwner = tabPDF->PassOwner->text();
1590
                prefsManager->appPrefs.PDF_Options.PassUser = tabPDF->PassUser->text();
1591
        }
1592
        if (tabPDF->PDFVersionCombo->currentItem() == 0)
1593
                prefsManager->appPrefs.PDF_Options.Version = PDFOptions::PDFVersion_13;
1594
        if (tabPDF->PDFVersionCombo->currentItem() == 1)
1595
                prefsManager->appPrefs.PDF_Options.Version = PDFOptions::PDFVersion_14;
1596
        if (tabPDF->PDFVersionCombo->currentItem() == 2)
1597
                prefsManager->appPrefs.PDF_Options.Version = PDFOptions::PDFVersion_15;
1598
        if (tabPDF->PDFVersionCombo->currentItem() == 3)
1599
                prefsManager->appPrefs.PDF_Options.Version = PDFOptions::PDFVersion_X3;
1600
        if (tabPDF->OutCombo->currentItem() == 0)
1601
        {
1602
                prefsManager->appPrefs.PDF_Options.isGrayscale = false;
1603
                prefsManager->appPrefs.PDF_Options.UseRGB = true;
1604
                prefsManager->appPrefs.PDF_Options.UseProfiles = false;
1605
                prefsManager->appPrefs.PDF_Options.UseProfiles2 = false;
1606
        }
1607
        else
1608
        {
1609
                if (tabPDF->OutCombo->currentItem() == 2)
1610
                {
1611
                        prefsManager->appPrefs.PDF_Options.isGrayscale = true;
1612
                        prefsManager->appPrefs.PDF_Options.UseRGB = false;
1613
                        prefsManager->appPrefs.PDF_Options.UseProfiles = false;
1614
                        prefsManager->appPrefs.PDF_Options.UseProfiles2 = false;
1615
                }
1616
                else
1617
                {
1618
                        prefsManager->appPrefs.PDF_Options.isGrayscale = false;
1619
                        prefsManager->appPrefs.PDF_Options.UseRGB = false;
1620
#ifdef HAVE_CMS
1621
                        if (CMSuse)
1622
                        {
1623
                                prefsManager->appPrefs.PDF_Options.UseProfiles = tabPDF->EmbedProfs->isChecked();
1624
                                prefsManager->appPrefs.PDF_Options.UseProfiles2 = tabPDF->EmbedProfs2->isChecked();
1625
                                prefsManager->appPrefs.PDF_Options.Intent = tabPDF->IntendS->currentItem();
1626
                                prefsManager->appPrefs.PDF_Options.Intent2 = tabPDF->IntendI->currentItem();
1627
                                prefsManager->appPrefs.PDF_Options.EmbeddedI = tabPDF->NoEmbedded->isChecked();
1628
                                prefsManager->appPrefs.PDF_Options.SolidProf = tabPDF->SolidPr->currentText();
1629
                                prefsManager->appPrefs.PDF_Options.ImageProf = tabPDF->ImageP->currentText();
1630
                                prefsManager->appPrefs.PDF_Options.PrintProf = tabPDF->PrintProfC->currentText();
1631
                        }
1632
#endif
1633
                }
1634
        }
1635
        prefsManager->appPrefs.defaultItemAttributes = *(tabDefaultItemAttributes->getNewAttributes());
1636
        prefsManager->appPrefs.defaultToCSetups = *(tabDefaultTOCIndexPrefs->getNewToCs());
5352 cbradney 1637
//      prefsManager->appPrefs.KeyActions = tabKeys->getNewKeyMap();
1638
        prefsManager->appPrefs.KeyActions = tabKeyboardShortcuts->getNewKeyMap();
2873 cbradney 1639
}
5504 subik 1640
 
1641
void Preferences::applyChangesButton_clicked()
1642
{
1643
        ScMW->prefsOrg(this);
1644
}
5507 subik 1645
 
1646
void Preferences::backToDefaults_clicked()
1647
{
1648
        prefsManager->initDefaults();
1649
        restoreDefaults();
1650
}