Subversion Repositories Scribus

Rev

Rev 9527 | 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 "units.h"
12
#include "langmgr.h"
13
#include "hysettings.h"
14
#include "cmsprefs.h"
15
#include "tabtools.h"
16
#include "undomanager.h"
17
#include "tabcheckdoc.h"
18
#include "tabpdfoptions.h"
19
#include "fontprefs.h"
20
#include "units.h"
21
#include "pagesize.h"
4122 cbradney 22
#include "pagestructs.h"
1641 cbradney 23
#include "docitemattrprefs.h"
2769 fschmid 24
#include "marginWidget.h"
2834 cbradney 25
#include "prefsmanager.h"
2873 cbradney 26
#include "polygonwidget.h"
27
#include "fontcombo.h"
28
#include "linecombo.h"
29
#include "arrowchooser.h"
2901 fschmid 30
#include "pagelayout.h"
3213 craig 31
#include "pluginmanager.h"
3207 craig 32
#include "pluginmanagerprefsgui.h"
7880 fschmid 33
#include "prefsfile.h"
3213 craig 34
#include "scplugin.h"
3560 fschmid 35
#include "sccombobox.h"
4689 mrdocs 36
#include "colorcombo.h"
4546 subik 37
#include "commonstrings.h"
5342 cbradney 38
#include "scribusapp.h"
5243 cbradney 39
#include "scribuscore.h"
5326 cbradney 40
#include "tabtypography.h"
41
#include "tabguides.h"
42
#include "tabexternaltoolswidget.h"
5352 cbradney 43
#include "tabkeyboardshortcutswidget.h"
5326 cbradney 44
#include "tocindexprefs.h"
5507 subik 45
#include "hyphenator.h"
5851 subik 46
#include "tabgeneral.h"
47
#include "tabdisplay.h"
48
#include "tabdocument.h"
49
#include "tabmiscellaneous.h"
50
#include "tabscrapbook.h"
7109 fschmid 51
#include "tabprinter.h"
3213 craig 52
 
1641 cbradney 53
using namespace std;
54
 
55
extern QPixmap loadIcon(QString nam);
5342 cbradney 56
extern ScribusQApp* ScQApp;
1641 cbradney 57
 
2834 cbradney 58
Preferences::Preferences( QWidget* parent) : PrefsDialogBase( parent )
1641 cbradney 59
{
2834 cbradney 60
        prefsManager=PrefsManager::instance();
61
        ApplicationPrefs* prefsData=&(prefsManager->appPrefs);
4026 craig 62
        ap = (ScribusMainWindow*)parent;
1641 cbradney 63
        docUnitIndex = prefsData->docUnitIndex;
1790 cbradney 64
        unitRatio = unitGetRatioFromIndex(docUnitIndex);
1641 cbradney 65
 
66
        setCaption( tr( "Preferences" ) );
67
 
5851 subik 68
        tabGeneral = new TabGeneral( prefsWidgets, "tabGeneral" );
5507 subik 69
        addItem( tr("General"), loadIcon("scribusicon.png"), tabGeneral);
1641 cbradney 70
 
5851 subik 71
        tabDocument = new TabDocument( prefsWidgets, "tabDocument" );
5507 subik 72
        addItem( tr("Document"), loadIcon("scribusdoc.png"), tabDocument);
1641 cbradney 73
 
2889 cbradney 74
        tabGuides = new TabGuides(prefsWidgets, &prefsData->guidesSettings, &prefsData->typographicSettings, docUnitIndex);
1641 cbradney 75
        addItem( tr("Guides"), loadIcon("guides.png"), tabGuides);
5763 subik 76
 
2889 cbradney 77
        tabTypo = new TabTypograpy(  prefsWidgets, &prefsData->typographicSettings);
3504 avox 78
        addItem( tr("Typography"), loadIcon("typography.png"), tabTypo);
5763 subik 79
 
5898 subik 80
        tabTools = new TabTools(prefsWidgets, &prefsData->toolSettings, docUnitIndex, ap->doc);
1641 cbradney 81
        addItem( tr("Tools"), loadIcon("tools.png"), tabTools);
82
 
83
        tabHyphenator = new HySettings(prefsWidgets, &ap->LangTransl);
84
        addItem( tr("Hyphenator"), loadIcon("hyphenate.png"), tabHyphenator);
85
 
5890 subik 86
        tabFonts = new FontPrefs(prefsWidgets, false, prefsManager->preferencesLocation(), ap->doc);
1641 cbradney 87
        addItem( tr("Fonts"), loadIcon("font.png"), tabFonts);
7109 fschmid 88
 
89
        tabPrinter = new TabPrinter(prefsWidgets, "tabPrinter");
90
        addItem( tr("Printer"), loadIcon("printer.png"), tabPrinter);
1641 cbradney 91
 
92
        tabDocChecker = new TabCheckDoc(  prefsWidgets, prefsData->checkerProfiles, prefsData->curCheckProfile);
2770 cbradney 93
        addItem( tr("Preflight Verifier"), loadIcon("checkdoc.png"), tabDocChecker);
1641 cbradney 94
 
5880 jghali 95
        if (ScCore->haveCMS())
1641 cbradney 96
        {
5243 cbradney 97
                tabColorManagement = new CMSPrefs(prefsWidgets, &prefsData->DCMSset, &ScCore->InputProfiles, &ScCore->InputProfilesCMYK, &ScCore->PrinterProfiles, &ScCore->MonitorProfiles);
1641 cbradney 98
                addItem( tr("Color Management"), loadIcon("blend.png"), tabColorManagement);
99
        }
5763 subik 100
 
5387 avox 101
        QMap<QString, int> DocFonts;
1641 cbradney 102
        DocFonts.clear();
103
        tabPDF = new TabPDFOptions( prefsWidgets,
4260 craig 104
                                                                prefsData->PDF_Options,
2834 cbradney 105
                                                                prefsData->AvailFonts,
5243 cbradney 106
                                                                ScCore->PDFXProfiles,
1641 cbradney 107
                                                                DocFonts,
108
                                                                prefsData->PDF_Options.PresentVals,
1790 cbradney 109
                                                                docUnitIndex,
1641 cbradney 110
                                                                prefsData->PageHeight,
111
                                                                prefsData->PageWidth,
112
 
9533 cbradney 113
        addItem( tr("PDF Export"), loadIcon("acroread32.png"), tabPDF);
1644 cbradney 114
 
1641 cbradney 115
        tabDefaultItemAttributes = new DocumentItemAttributes( prefsWidgets);
5851 subik 116
        QStringList defaultAttributesList=tabDefaultItemAttributes->getDocAttributesNames();
1641 cbradney 117
        tabDefaultItemAttributes->setup(&prefsData->defaultItemAttributes);
118
        addItem( tr("Document Item Attributes"), loadIcon("docattributes.png"), tabDefaultItemAttributes);
1701 cbradney 119
 
120
        tabDefaultTOCIndexPrefs = new TOCIndexPrefs( prefsWidgets );
121
        tabDefaultTOCIndexPrefs->setupItemAttrs( defaultAttributesList );
122
        tabDefaultTOCIndexPrefs->setup(&prefsData->defaultToCSetups, NULL);
123
        addItem( tr("Table of Contents and Indexes"), loadIcon("tabtocindex.png"), tabDefaultTOCIndexPrefs);
2784 subik 124
 
5352 cbradney 125
        tabKeyboardShortcuts = new TabKeyboardShortcutsWidget(prefsData->KeyActions, prefsWidgets);
5356 cbradney 126
        addItem( tr("Keyboard Shortcuts"), loadIcon("key_bindings.png"), tabKeyboardShortcuts);
5763 subik 127
 
5851 subik 128
        tabScrapbook = new TabScrapbook( prefsWidgets, "tabScrapbook" );
129
        addItem(  tr("Scrapbook"), loadIcon("scrap.png"), tabScrapbook);
5787 fschmid 130
 
5851 subik 131
        tabView = new TabDisplay(prefsWidgets, "tabView");
1641 cbradney 132
        addItem( tr("Display"), loadIcon("screen.png"), tabView);
5763 subik 133
 
5326 cbradney 134
        tabExtTools = new TabExternalToolsWidget( prefsData, prefsWidgets );
135
        addItem(  tr("External Tools"), loadIcon("externaltools.png"), tabExtTools);
5763 subik 136
 
5851 subik 137
        tabMiscellaneous = new TabMiscellaneous( prefsWidgets, "tabMiscellaneous" );
5507 subik 138
        addItem(  tr("Miscellaneous"), loadIcon("misc.png"), tabMiscellaneous);
5851 subik 139
 
1641 cbradney 140
        // plugin manager. pv.
5556 subik 141
        pluginManagerPrefsGui = new PluginManagerPrefsGui(prefsWidgets);
3213 craig 142
        addItem( tr("Plugins"), loadIcon("plugins.png"), pluginManagerPrefsGui );
5851 subik 143
 
5711 subik 144
        setupGui();
3213 craig 145
        addPlugins();
146
 
2901 fschmid 147
        setDS(prefsData->FacingPages);
1641 cbradney 148
 
149
        resize( minimumSizeHint() );
150
        arrangeIcons();
1834 fschmid 151
        prefsSelection->setSelected(prefsSelection->firstItem(), true);
152
        itemSelected(prefsSelection->firstItem());
1641 cbradney 153
        clearWState( WState_Polished );
154
}
155
 
5763 subik 156
void Preferences::enableSignals(bool on)
157
{
158
        if (on)
159
        {
5851 subik 160
                connect(tabDocument->unitCombo, SIGNAL(activated(int)), this, SLOT(unitChange()));
161
                connect(tabDocument->docLayout, SIGNAL( selectedLayout(int) ), this, SLOT( setDS(int) ) );
5763 subik 162
                connect(buttonOk, SIGNAL(clicked()), this, SLOT(setActionHistoryLength()));
5880 jghali 163
                if (ScCore->haveCMS())
5763 subik 164
                        connect(tabColorManagement, SIGNAL(cmsOn(bool )), this, SLOT(switchCMS(bool )));
165
                connect(applyChangesButton, SIGNAL(clicked()), this, SLOT(applyChangesButton_clicked()));
166
                connect(backToDefaults, SIGNAL(clicked()), this, SLOT(backToDefaults_clicked()));
5851 subik 167
                connect( prefsWidgets, SIGNAL(aboutToShow(QWidget *)), this, SLOT(showWidgetInStack(QWidget *)));
168
                connect(this, SIGNAL(accepted()), pluginManagerPrefsGui, SLOT(apply()));
5763 subik 169
        }
170
        else
171
        {
5851 subik 172
                disconnect(tabDocument->unitCombo, SIGNAL(activated(int)), this, SLOT(unitChange()));
173
                disconnect(tabDocument->docLayout, SIGNAL( selectedLayout(int) ), this, SLOT( setDS(int) ) );
5763 subik 174
                disconnect(buttonOk, SIGNAL(clicked()), this, SLOT(setActionHistoryLength()));
5880 jghali 175
                if (ScCore->haveCMS())
5763 subik 176
                        disconnect(tabColorManagement, SIGNAL(cmsOn(bool )), this, SLOT(switchCMS(bool )));
177
                disconnect(applyChangesButton, SIGNAL(clicked()), this, SLOT(applyChangesButton_clicked()));
178
                disconnect(backToDefaults, SIGNAL(clicked()), this, SLOT(backToDefaults_clicked()));
5851 subik 179
                disconnect( prefsWidgets, SIGNAL(aboutToShow(QWidget *)), this, SLOT(showWidgetInStack(QWidget *)));
180
                disconnect(this, SIGNAL(accepted()), pluginManagerPrefsGui, SLOT(apply()));
5763 subik 181
        }
182
}
183
 
5507 subik 184
void Preferences::restoreDefaults()
185
{
186
        prefsManager->initDefaults();
5562 subik 187
        setupGui();
188
}
189
 
190
void Preferences::setupGui()
191
{
5763 subik 192
        enableSignals(false);
5507 subik 193
        ApplicationPrefs* prefsData=&(prefsManager->appPrefs);
194
 
5851 subik 195
        tabGeneral->restoreDefaults(prefsData);
196
        tabDocument->restoreDefaults(prefsData);
7109 fschmid 197
        tabPrinter->restoreDefaults(prefsData);
8012 cbradney 198
        tabView->restoreDefaults(prefsData, prefsData->guidesSettings, prefsData->pageSets, prefsData->FacingPages, prefsData->scratch);
5851 subik 199
        tabScrapbook->restoreDefaults(prefsData);
200
        tabHyphenator->restoreDefaults(prefsData);
5562 subik 201
        tabGuides->restoreDefaults(&prefsData->guidesSettings, &prefsData->typographicSettings, docUnitIndex);
202
        tabTypo->restoreDefaults(&prefsData->typographicSettings);
5851 subik 203
        tabTools->restoreDefaults(&prefsData->toolSettings, docUnitIndex);
204
        // main performance issue in availFonts->GetFonts(HomeP)!
205
        // no prefsData here
5562 subik 206
        tabFonts->restoreDefaults();
207
        tabDocChecker->restoreDefaults(&prefsData->checkerProfiles, prefsData->curCheckProfile);
5851 subik 208
 
5562 subik 209
        QMap<QString, int> DocFonts;
210
        DocFonts.clear();
211
        tabPDF->restoreDefaults(prefsData->PDF_Options,
212
                                                        prefsData->AvailFonts,
213
                                                        ScCore->PDFXProfiles,
214
                                                        DocFonts,
215
                                                        prefsData->PDF_Options.PresentVals,
216
                                                        docUnitIndex,
217
                                                        prefsData->PageHeight,
218
                                                        prefsData->PageWidth,
5880 jghali 219
                                                        0, false);
5851 subik 220
 
9527 avox 221
        if (ScCore->haveCMS())
222
                tabColorManagement->restoreDefaults(&prefsData->DCMSset, &ScCore->InputProfiles,
223
                                                                                        &ScCore->InputProfilesCMYK,
224
                                                                                        &ScCore->PrinterProfiles, &ScCore->MonitorProfiles);
5851 subik 225
        QStringList defaultAttributesList=tabDefaultItemAttributes->getDocAttributesNames();
5562 subik 226
        tabDefaultItemAttributes->setup(&prefsData->defaultItemAttributes);
227
        tabDefaultTOCIndexPrefs->setupItemAttrs( defaultAttributesList );
228
        tabDefaultTOCIndexPrefs->setup(&prefsData->defaultToCSetups, NULL);
229
        tabKeyboardShortcuts->restoreDefaults();
230
        tabExtTools->restoreDefaults(prefsData);
5851 subik 231
        tabMiscellaneous->restoreDefaults(prefsData);
5763 subik 232
        enableSignals(true);
233
        unitChange();
5507 subik 234
}
235
 
3213 craig 236
void Preferences::addPlugins()
237
{
238
        // Scan for plugins that provide a prefs widget, and add it to the
239
        // prefs dialog.
3383 craig 240
        // For each plugin, enabled or not:
7176 subik 241
        ScPlugin* plugin = 0;
242
        PrefsPanel* panel = 0;
243
        QString panelCaption;
244
        QPixmap panelIcon;
245
 
3213 craig 246
        PluginManager& pluginManager = PluginManager::instance();
3383 craig 247
        QValueList<QCString> pluginNames(pluginManager.pluginNames(true));
3213 craig 248
        QValueList<QCString>::Iterator itEnd(pluginNames.end());
7176 subik 249
 
3213 craig 250
        for (QValueList<QCString>::Iterator it(pluginNames.begin()); it != itEnd ; ++it )
251
        {
3214 craig 252
                // Ask the plugin manager for a plugin (skipping disabled plugins).
7176 subik 253
                plugin = pluginManager.getPlugin(*it, false);
3214 craig 254
                // If we got a plugin (which we know is enabled):
255
                if (plugin)
3213 craig 256
                {
3214 craig 257
                        // Ask the plugin for a prefs widget
258
                        bool wantPanel = plugin->newPrefsPanelWidget(
259
                                        prefsWidgets, panel, panelCaption, panelIcon);
260
                        // If it gave us one...
261
                        if (wantPanel)
262
                        {
263
                                // Ensure that we got sane return values
264
                                Q_ASSERT(panel);
265
                                Q_ASSERT(!panelIcon.isNull());
266
                                Q_ASSERT(!panelCaption.isNull());
267
                                // plug it in to the dialog,
268
                                addItem(panelCaption, panelIcon, panel);
269
                                // and connect a signal to tell it to save its
270
                                // settings.
271
                                connect(this, SIGNAL(accepted()), panel, SLOT(apply()));
272
                        }
3213 craig 273
                }
274
        }
275
}
276
 
277
void Preferences::accept()
278
{
279
        emit accepted();
280
        return PrefsDialogBase::accept();
281
}
282
 
2901 fschmid 283
void Preferences::setDS(int layout)
1641 cbradney 284
{
5851 subik 285
        tabDocument->marginGroup->setFacingPages(!(layout == singlePage));
286
        tabDocument->choosenLayout = layout;
287
        tabDocument->docLayout->firstPage->setCurrentItem(prefsManager->appPrefs.pageSets[tabDocument->choosenLayout].FirstPage);
288
        tabView->gapHorizontal->setValue(prefsManager->appPrefs.pageSets[tabDocument->choosenLayout].GapHorizontal * unitRatio);
289
        tabView->gapVertical->setValue(prefsManager->appPrefs.pageSets[tabDocument->choosenLayout].GapVertical * unitRatio);
1641 cbradney 290
}
291
 
292
void Preferences::unitChange()
293
{
1790 cbradney 294
        double oldUnitRatio = unitRatio;
5851 subik 295
        docUnitIndex = tabDocument->unitCombo->currentItem();
1790 cbradney 296
        unitRatio = unitGetRatioFromIndex(docUnitIndex);
5851 subik 297
        int decimals = unitGetDecimalsFromIndex(docUnitIndex);
298
        QString suffix = unitGetSuffixFromIndex(docUnitIndex);
1790 cbradney 299
        double invUnitConversion = 1.0 / oldUnitRatio * unitRatio;
5851 subik 300
 
5876 subik 301
        tabDocument->unitChange();
5851 subik 302
        tabGuides->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
303
        tabView->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
304
        tabTools->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
305
        tabPDF->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
7109 fschmid 306
        tabPrinter->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
1641 cbradney 307
}
308
 
309
 
310
void Preferences::setActionHistoryLength()
311
{
7880 fschmid 312
        PrefsContext *undoPrefs = PrefsManager::instance()->prefsFile->getContext("undo");
313
        bool isEnabled = tabDocument->urGroup->isChecked();
314
        if (!isEnabled)
315
                UndoManager::instance()->clearStack();
316
        UndoManager::instance()->setUndoEnabled(isEnabled);
317
        undoPrefs->set("enabled", isEnabled);
318
        UndoManager::instance()->setAllHistoryLengths(tabDocument->urSpinBox->value());
1641 cbradney 319
}
320
 
321
void Preferences::switchCMS(bool enable)
322
{
323
        tabPDF->enableCMS(enable);
324
}
325
 
5851 subik 326
void Preferences::showWidgetInStack(QWidget *widgetToShow)
1701 cbradney 327
{
2784 subik 328
        //Update the attributes list in TOC setup
1701 cbradney 329
        if (widgetToShow==tabDefaultTOCIndexPrefs)
330
                tabDefaultTOCIndexPrefs->setupItemAttrs( tabDefaultItemAttributes->getDocAttributesNames() );
5851 subik 331
        if (widgetToShow == tabTools)
332
                tabTools->enableFontPreview(true);
1701 cbradney 333
}
2873 cbradney 334
 
335
void Preferences::updatePreferences()
336
{
5851 subik 337
        double prefsUnitRatio = unitGetRatioFromIndex(tabDocument->unitCombo->currentItem());
338
 
339
        prefsManager->appPrefs.AppFontSize = tabGeneral->GFsize->value();
340
        prefsManager->appPrefs.PaletteFontSize = tabGeneral->GTFsize->value();
6338 cbradney 341
        ScQApp->neverSplash(!tabGeneral->showSplashCheckBox->isChecked());
342
        prefsManager->appPrefs.showStartupDialog = tabGeneral->startUpDialog->isChecked();
5851 subik 343
        prefsManager->appPrefs.Wheelval = tabGeneral->wheelJumpSpin->value();
5912 fschmid 344
        prefsManager->appPrefs.moveTimeout = tabGeneral->spinTimeout->value();
5851 subik 345
        prefsManager->appPrefs.RecentDCount = tabGeneral->recentDocs->value();
7117 jghali 346
        prefsManager->appPrefs.DocDir = ScPaths::separatorsToSlashes( tabGeneral->Docs->text() );
347
        prefsManager->appPrefs.ProfileDir = ScPaths::separatorsToSlashes( tabGeneral->ProPfad->text() );
348
        prefsManager->appPrefs.ScriptDir = ScPaths::separatorsToSlashes( tabGeneral->ScriptPfad->text() );
349
        prefsManager->appPrefs.documentTemplatesDir = ScPaths::separatorsToSlashes( tabGeneral->DocumentTemplateDir->text() );
5851 subik 350
        prefsManager->appPrefs.guiLanguage=tabGeneral->selectedGUILang;
351
        prefsManager->appPrefs.GUI = tabGeneral->GUICombo->currentText();
352
 
353
        prefsManager->appPrefs.pageSets[tabDocument->choosenLayout].GapHorizontal = tabView->gapHorizontal->value() / prefsUnitRatio;
354
        prefsManager->appPrefs.pageSets[tabDocument->choosenLayout].GapVertical = tabView->gapVertical->value() / prefsUnitRatio;
355
        prefsManager->appPrefs.marginColored = tabView->checkUnprintable->isChecked();
8012 cbradney 356
        prefsManager->appPrefs.scratch.Bottom = tabView->bottomScratch->value() / prefsUnitRatio;
357
        prefsManager->appPrefs.scratch.Left = tabView->leftScratch->value() / prefsUnitRatio;
358
        prefsManager->appPrefs.scratch.Right = tabView->rightScratch->value() / prefsUnitRatio;
359
        prefsManager->appPrefs.scratch.Top = tabView->topScratch->value() / prefsUnitRatio;
6337 cbradney 360
        // GUI colors
5851 subik 361
        prefsManager->appPrefs.DpapColor = tabView->colorPaper;
6337 cbradney 362
        prefsManager->appPrefs.DFrameColor = tabView->colorFrame;
363
        prefsManager->appPrefs.DFrameNormColor = tabView->colorFrameNorm;
364
        prefsManager->appPrefs.DFrameGroupColor = tabView->colorFrameGroup;
365
        prefsManager->appPrefs.DFrameLockColor = tabView->colorFrameLocked;
366
        prefsManager->appPrefs.DFrameLinkColor = tabView->colorFrameLinked;
367
        prefsManager->appPrefs.DFrameAnnotationColor = tabView->colorFrameAnnotation;
368
        prefsManager->appPrefs.DPageBorderColor = tabView->colorPageBorder;
369
        prefsManager->appPrefs.DControlCharColor = tabView->colorControlChars;
370
        // Guides
371
 
5851 subik 372
        prefsManager->appPrefs.guidesSettings.framesShown = tabView->checkFrame->isChecked();
7051 fschmid 373
        prefsManager->appPrefs.guidesSettings.showBleed = tabView->checkBleed->isChecked();
5851 subik 374
        prefsManager->appPrefs.guidesSettings.layerMarkersShown = tabView->checkLayerM->isChecked();
375
        prefsManager->appPrefs.guidesSettings.rulerMode = tabView->checkRuler->isChecked();
376
        prefsManager->appPrefs.guidesSettings.showPic = tabView->checkPictures->isChecked();
377
        prefsManager->appPrefs.guidesSettings.linkShown = tabView->checkLink->isChecked();
378
        prefsManager->appPrefs.guidesSettings.showControls = tabView->checkControl->isChecked();
379
        prefsManager->appPrefs.DisScale = tabView->DisScale;
380
 
381
        prefsManager->appPrefs.doCopyToScrapbook = tabScrapbook->useScrapBookasExtension->isChecked();
382
        prefsManager->appPrefs.persistentScrapbook = tabScrapbook->persistentScrapbook->isChecked();
383
        prefsManager->appPrefs.numScrapbookCopies = tabScrapbook->numScrapCopies->value();
384
 
2873 cbradney 385
        tabTools->polyWidget->getValues(&prefsManager->appPrefs.toolSettings.polyC, &prefsManager->appPrefs.toolSettings.polyFd, &prefsManager->appPrefs.toolSettings.polyF, &prefsManager->appPrefs.toolSettings.polyS, &prefsManager->appPrefs.toolSettings.polyR);
5851 subik 386
 
387
        prefsManager->appPrefs.pageSize = tabDocument->prefsPageSizeName;
388
        prefsManager->appPrefs.pageOrientation = tabDocument->pageOrientationComboBox->currentItem();
5876 subik 389
        prefsManager->appPrefs.PageWidth = tabDocument->pageW;
390
        prefsManager->appPrefs.PageHeight = tabDocument->pageH;
5851 subik 391
 
7225 cbradney 392
        prefsManager->appPrefs.margins.Top = tabDocument->marginGroup->top();
393
        prefsManager->appPrefs.margins.Bottom = tabDocument->marginGroup->bottom();
394
        prefsManager->appPrefs.margins.Left = tabDocument->marginGroup->left();
395
        prefsManager->appPrefs.margins.Right = tabDocument->marginGroup->right();
5851 subik 396
        prefsManager->appPrefs.FacingPages  = tabDocument->choosenLayout;
7225 cbradney 397
        prefsManager->appPrefs.bleeds.Bottom = tabDocument->marginGroup->bottomBleed();
398
        prefsManager->appPrefs.bleeds.Top = tabDocument->marginGroup->topBleed();
399
        prefsManager->appPrefs.bleeds.Left = tabDocument->marginGroup->leftBleed();
400
        prefsManager->appPrefs.bleeds.Right = tabDocument->marginGroup->rightBleed();
5851 subik 401
        prefsManager->appPrefs.pageSets[tabDocument->choosenLayout].FirstPage = tabDocument->docLayout->firstPage->currentItem();
402
 
5326 cbradney 403
        prefsManager->setImageEditorExecutable(tabExtTools->newImageTool());
5418 cbradney 404
        prefsManager->setExtBrowserExecutable(tabExtTools->newExtBrowserTool());
5326 cbradney 405
        prefsManager->appPrefs.gs_AntiAliasGraphics = tabExtTools->newAntialiasGraphics();
406
        prefsManager->appPrefs.gs_AntiAliasText = tabExtTools->newAntialiasText();
407
        prefsManager->setGhostscriptExecutable(tabExtTools->newPSTool());
408
        prefsManager->appPrefs.gs_Resolution = tabExtTools->newPSToolResolution();
5851 subik 409
 
2873 cbradney 410
        prefsManager->appPrefs.guidesSettings.before = tabGuides->inBackground->isChecked();
5851 subik 411
 
412
        prefsManager->appPrefs.askBeforeSubstituite = tabMiscellaneous->AskForSubs->isChecked();
413
        prefsManager->appPrefs.haveStylePreview = tabMiscellaneous->stylePreview->isChecked();
2873 cbradney 414
        // lorem ipsum
5851 subik 415
        prefsManager->appPrefs.useStandardLI = tabMiscellaneous->useStandardLI->isChecked();
416
        prefsManager->appPrefs.paragraphsLI = tabMiscellaneous->paragraphsLI->value();
3849 subik 417
 
5851 subik 418
        prefsManager->appPrefs.docUnitIndex = tabDocument->unitCombo->currentItem();
419
 
2873 cbradney 420
        prefsManager->appPrefs.toolSettings.defFont = tabTools->fontComboText->currentText();
421
        prefsManager->appPrefs.toolSettings.defSize = tabTools->sizeComboText->currentText().left(2).toInt() * 10;
5851 subik 422
 
2873 cbradney 423
        prefsManager->appPrefs.guidesSettings.marginsShown = tabGuides->marginBox->isChecked();
424
        prefsManager->appPrefs.guidesSettings.gridShown = tabGuides->checkGrid->isChecked();
425
        prefsManager->appPrefs.guidesSettings.guidesShown = tabGuides->guideBox->isChecked();
426
        prefsManager->appPrefs.guidesSettings.baseShown = tabGuides->baselineBox->isChecked();
427
        prefsManager->appPrefs.guidesSettings.grabRad = tabGuides->grabDistance->value();
7417 fschmid 428
        prefsManager->appPrefs.guidesSettings.guideRad = tabGuides->snapDistance->value();
2873 cbradney 429
        prefsManager->appPrefs.guidesSettings.minorGrid = tabGuides->minorSpace->value() / prefsUnitRatio;
430
        prefsManager->appPrefs.guidesSettings.majorGrid = tabGuides->majorSpace->value() / prefsUnitRatio;
431
        prefsManager->appPrefs.guidesSettings.minorColor = tabGuides->colorMinorGrid;
432
        prefsManager->appPrefs.guidesSettings.majorColor = tabGuides->colorMajorGrid;
433
        prefsManager->appPrefs.guidesSettings.margColor = tabGuides->colorMargin;
434
        prefsManager->appPrefs.guidesSettings.guideColor = tabGuides->colorGuides;
435
        prefsManager->appPrefs.guidesSettings.baseColor = tabGuides->colorBaselineGrid;
436
        prefsManager->appPrefs.checkerProfiles = tabDocChecker->checkerProfile;
437
        prefsManager->appPrefs.curCheckProfile = tabDocChecker->curCheckProfile->currentText();
2889 cbradney 438
        prefsManager->appPrefs.typographicSettings.valueSuperScript = tabTypo->superDisplacement->value();
439
        prefsManager->appPrefs.typographicSettings.scalingSuperScript = tabTypo->superScaling->value();
440
        prefsManager->appPrefs.typographicSettings.valueSubScript = tabTypo->subDisplacement->value();
441
        prefsManager->appPrefs.typographicSettings.scalingSubScript = tabTypo->subScaling->value();
442
        prefsManager->appPrefs.typographicSettings.valueSmallCaps = tabTypo->capsScaling->value();
443
        prefsManager->appPrefs.typographicSettings.autoLineSpacing = tabTypo->autoLine->value();
444
        prefsManager->appPrefs.typographicSettings.valueBaseGrid = tabGuides->baseGrid->value() / prefsUnitRatio;
445
        prefsManager->appPrefs.typographicSettings.offsetBaseGrid = tabGuides->baseOffset->value() / prefsUnitRatio;
446
        prefsManager->appPrefs.typographicSettings.valueUnderlinePos = qRound(tabTypo->underlinePos->value() * 10);
447
        prefsManager->appPrefs.typographicSettings.valueUnderlineWidth = qRound(tabTypo->underlineWidth->value() * 10);
448
        prefsManager->appPrefs.typographicSettings.valueStrikeThruPos = qRound(tabTypo->strikethruPos->value() * 10);
449
        prefsManager->appPrefs.typographicSettings.valueStrikeThruWidth = qRound(tabTypo->strikethruWidth->value() * 10);
3093 fschmid 450
        prefsManager->appPrefs.toolSettings.dTextBackGround = tabTools->colorComboTextBackground->currentText();
8439 cbradney 451
        if (prefsManager->appPrefs.toolSettings.dTextBackGround == CommonStrings::tr_NoneColor)
4546 subik 452
                prefsManager->appPrefs.toolSettings.dTextBackGround = CommonStrings::None;
3093 fschmid 453
        prefsManager->appPrefs.toolSettings.dTextLineColor = tabTools->colorComboTextLine->currentText();
8439 cbradney 454
        if (prefsManager->appPrefs.toolSettings.dTextLineColor == CommonStrings::tr_NoneColor)
4546 subik 455
                prefsManager->appPrefs.toolSettings.dTextLineColor = CommonStrings::None;
3093 fschmid 456
        prefsManager->appPrefs.toolSettings.dTextBackGroundShade = tabTools->shadingTextBack->value();
457
        prefsManager->appPrefs.toolSettings.dTextLineShade = tabTools->shadingTextLine->value();
458
        prefsManager->appPrefs.toolSettings.dTextPenShade = tabTools->shadingText->value();
459
        prefsManager->appPrefs.toolSettings.dTextStrokeShade = tabTools->shadingTextStroke->value();
2873 cbradney 460
        prefsManager->appPrefs.toolSettings.dPen = tabTools->colorComboLineShape->currentText();
8439 cbradney 461
        if (prefsManager->appPrefs.toolSettings.dPen == CommonStrings::tr_NoneColor)
4546 subik 462
                prefsManager->appPrefs.toolSettings.dPen = CommonStrings::None;
2873 cbradney 463
        prefsManager->appPrefs.toolSettings.dPenText = tabTools->colorComboText->currentText();
8439 cbradney 464
        if (prefsManager->appPrefs.toolSettings.dPenText == CommonStrings::tr_NoneColor)
4546 subik 465
                prefsManager->appPrefs.toolSettings.dPenText = CommonStrings::None;
2873 cbradney 466
        prefsManager->appPrefs.toolSettings.dStrokeText = tabTools->colorComboStrokeText->currentText();
8439 cbradney 467
        if (prefsManager->appPrefs.toolSettings.dStrokeText == CommonStrings::tr_NoneColor)
4546 subik 468
                prefsManager->appPrefs.toolSettings.dStrokeText = CommonStrings::None;
2873 cbradney 469
        prefsManager->appPrefs.toolSettings.dCols = tabTools->columnsText->value();
470
        prefsManager->appPrefs.toolSettings.dGap = tabTools->gapText->value() / prefsUnitRatio;
471
        prefsManager->appPrefs.toolSettings.dTabWidth = tabTools->gapTab->value() / prefsUnitRatio;
472
        prefsManager->appPrefs.toolSettings.dBrush = tabTools->comboFillShape->currentText();
8439 cbradney 473
        if (prefsManager->appPrefs.toolSettings.dBrush == CommonStrings::tr_NoneColor)
4546 subik 474
                prefsManager->appPrefs.toolSettings.dBrush = CommonStrings::None;
2873 cbradney 475
        prefsManager->appPrefs.toolSettings.dShade = tabTools->shadingFillShape->value();
476
        prefsManager->appPrefs.toolSettings.dShade2 = tabTools->shadingLineShape->value();
477
        switch (tabTools->tabFillCombo->currentItem())
478
        {
479
                case 0:
480
                        prefsManager->appPrefs.toolSettings.tabFillChar = "";
481
                        break;
482
                case 1:
483
                        prefsManager->appPrefs.toolSettings.tabFillChar = ".";
484
                        break;
485
                case 2:
486
                        prefsManager->appPrefs.toolSettings.tabFillChar = "-";
487
                        break;
488
                case 3:
489
                        prefsManager->appPrefs.toolSettings.tabFillChar = "_";
490
                        break;
491
                case 4:
492
                        prefsManager->appPrefs.toolSettings.tabFillChar = tabTools->tabFillCombo->currentText().right(1);
493
                        break;
494
        }
495
        switch (tabTools->comboStyleShape->currentItem())
496
        {
497
                case 0:
498
                        prefsManager->appPrefs.toolSettings.dLineArt = SolidLine;
499
                        break;
500
                case 1:
501
                        prefsManager->appPrefs.toolSettings.dLineArt = DashLine;
502
                        break;
503
                case 2:
504
                        prefsManager->appPrefs.toolSettings.dLineArt = DotLine;
505
                        break;
506
                case 3:
507
                        prefsManager->appPrefs.toolSettings.dLineArt = DashDotLine;
508
                        break;
509
                case 4:
510
                        prefsManager->appPrefs.toolSettings.dLineArt = DashDotDotLine;
511
                        break;
512
        }
513
        prefsManager->appPrefs.toolSettings.dWidth = tabTools->lineWidthShape->value();
514
        prefsManager->appPrefs.toolSettings.dPenLine = tabTools->colorComboLine->currentText();
8439 cbradney 515
        if (prefsManager->appPrefs.toolSettings.dPenLine == CommonStrings::tr_NoneColor)
4546 subik 516
                prefsManager->appPrefs.toolSettings.dPenLine = CommonStrings::None;
2873 cbradney 517
        prefsManager->appPrefs.toolSettings.dShadeLine = tabTools->shadingLine->value();
518
        switch (tabTools->comboStyleLine->currentItem())
519
        {
520
        case 0:
521
                prefsManager->appPrefs.toolSettings.dLstyleLine = SolidLine;
522
                break;
523
        case 1:
524
                prefsManager->appPrefs.toolSettings.dLstyleLine = DashLine;
525
                break;
526
        case 2:
527
                prefsManager->appPrefs.toolSettings.dLstyleLine = DotLine;
528
                break;
529
        case 3:
530
                prefsManager->appPrefs.toolSettings.dLstyleLine = DashDotLine;
531
                break;
532
        case 4:
533
                prefsManager->appPrefs.toolSettings.dLstyleLine = DashDotDotLine;
534
                break;
535
        }
536
        prefsManager->appPrefs.toolSettings.dWidthLine = tabTools->lineWidthLine->value();
537
        prefsManager->appPrefs.toolSettings.dStartArrow = tabTools->startArrow->currentItem();
538
        prefsManager->appPrefs.toolSettings.dEndArrow = tabTools->endArrow->currentItem();
539
        prefsManager->appPrefs.toolSettings.magMin = tabTools->minimumZoom->value();
540
        prefsManager->appPrefs.toolSettings.magMax = tabTools->maximumZoom->value();
541
        prefsManager->appPrefs.toolSettings.magStep = tabTools->zoomStep->value();
542
        prefsManager->appPrefs.toolSettings.dBrushPict = tabTools->comboFillImage->currentText();
8439 cbradney 543
        if (prefsManager->appPrefs.toolSettings.dBrushPict == CommonStrings::tr_NoneColor)
4546 subik 544
                prefsManager->appPrefs.toolSettings.dBrushPict = CommonStrings::None;
2873 cbradney 545
        prefsManager->appPrefs.toolSettings.shadePict = tabTools->shadingFillImage->value();
546
        prefsManager->appPrefs.toolSettings.scaleX = static_cast<double>(tabTools->scalingHorizontal->value()) / 100.0;
547
        prefsManager->appPrefs.toolSettings.scaleY = static_cast<double>(tabTools->scalingVertical->value()) / 100.0;
548
        prefsManager->appPrefs.toolSettings.scaleType = tabTools->buttonGroup3->isChecked();
549
        prefsManager->appPrefs.toolSettings.aspectRatio = tabTools->checkRatioImage->isChecked();
550
        prefsManager->appPrefs.toolSettings.useEmbeddedPath = tabTools->embeddedPath->isChecked();
551
        int haRes = 0;
552
        if (tabTools->checkFullRes->isChecked())
553
                haRes = 0;
554
        if (tabTools->checkNormalRes->isChecked())
555
                haRes = 1;
556
        if (tabTools->checkHalfRes->isChecked())
557
                haRes = 2;
558
        prefsManager->appPrefs.toolSettings.lowResType = haRes;
6606 fschmid 559
        prefsManager->appPrefs.toolSettings.dispX = tabTools->genDispX->value();
560
        prefsManager->appPrefs.toolSettings.dispY = tabTools->genDispY->value();
6618 fschmid 561
        prefsManager->appPrefs.toolSettings.constrain = tabTools->genRot->value();
5851 subik 562
        prefsManager->appPrefs.AutoSave = tabDocument->GroupAS->isChecked();
563
        prefsManager->appPrefs.AutoSaveTime = tabDocument->ASTime->value() * 60 * 1000;
2873 cbradney 564
        prefsManager->appPrefs.MinWordLen = tabHyphenator->wordLen->value();
5781 cbradney 565
        prefsManager->appPrefs.Language = ScCore->primaryMainWindow()->GetLang(tabHyphenator->language->currentText());
2873 cbradney 566
        prefsManager->appPrefs.Automatic = !tabHyphenator->verbose->isChecked();
567
        prefsManager->appPrefs.AutoCheck = tabHyphenator->input->isChecked();
568
        prefsManager->appPrefs.HyCount = tabHyphenator->maxCount->value();
5880 jghali 569
        if (ScCore->haveCMS())
2873 cbradney 570
                tabColorManagement->setValues();
571
        uint a = 0;
572
        SCFontsIterator it(prefsManager->appPrefs.AvailFonts);
5980 avox 573
        for ( ; it.hasNext() ; it.next())
2873 cbradney 574
        {
5980 avox 575
                it.current().embedPs(tabFonts->fontFlags[it.currentKey()].FlagPS);
576
                it.current().usable(tabFonts->fontFlags[it.currentKey()].FlagUse);
577
                it.current().subset(tabFonts->fontFlags[it.currentKey()].FlagSub);
2873 cbradney 578
        }
579
        a = 0;
580
        QMap<QString,QString>::Iterator itfsuend=tabFonts->RList.end();
581
        prefsManager->appPrefs.GFontSub.clear();
582
        for (QMap<QString,QString>::Iterator itfsu = tabFonts->RList.begin(); itfsu != itfsuend; ++itfsu)
583
                prefsManager->appPrefs.GFontSub[itfsu.key()] = tabFonts->FlagsRepl.at(a++)->currentText();
584
        prefsManager->appPrefs.PDF_Options.Thumbnails = tabPDF->CheckBox1->isChecked();
585
        prefsManager->appPrefs.PDF_Options.Compress = tabPDF->Compression->isChecked();
586
        prefsManager->appPrefs.PDF_Options.CompressMethod = tabPDF->CMethod->currentItem();
587
        prefsManager->appPrefs.PDF_Options.Quality = tabPDF->CQuality->currentItem();
588
        prefsManager->appPrefs.PDF_Options.Resolution = tabPDF->Resolution->value();
589
        prefsManager->appPrefs.PDF_Options.RecalcPic = tabPDF->DSColor->isChecked();
590
        prefsManager->appPrefs.PDF_Options.PicRes = tabPDF->ValC->value();
591
        prefsManager->appPrefs.PDF_Options.Bookmarks = tabPDF->CheckBM->isChecked();
592
        prefsManager->appPrefs.PDF_Options.Binding = tabPDF->ComboBind->currentItem();
593
        prefsManager->appPrefs.PDF_Options.MirrorH = tabPDF->MirrorH->isOn();
594
        prefsManager->appPrefs.PDF_Options.MirrorV = tabPDF->MirrorV->isOn();
595
        prefsManager->appPrefs.PDF_Options.RotateDeg = tabPDF->RotateDeg->currentItem() * 90;
596
        prefsManager->appPrefs.PDF_Options.Articles = tabPDF->Article->isChecked();
597
        prefsManager->appPrefs.PDF_Options.Encrypt = tabPDF->Encry->isChecked();
598
        prefsManager->appPrefs.PDF_Options.UseLPI = tabPDF->UseLPI->isChecked();
5320 fschmid 599
        prefsManager->appPrefs.PDF_Options.UseSpotColors = tabPDF->overprintMode->isChecked();
600
        prefsManager->appPrefs.PDF_Options.doOverprint = !tabPDF->useSpot->isChecked();
3079 fschmid 601
        prefsManager->appPrefs.PDF_Options.doMultiFile = false;
7225 cbradney 602
        prefsManager->appPrefs.PDF_Options.bleeds.Bottom = tabPDF->BleedBottom->value() / prefsUnitRatio;
603
        prefsManager->appPrefs.PDF_Options.bleeds.Top = tabPDF->BleedTop->value() / prefsUnitRatio;
604
        prefsManager->appPrefs.PDF_Options.bleeds.Left = tabPDF->BleedLeft->value() / prefsUnitRatio;
605
        prefsManager->appPrefs.PDF_Options.bleeds.Right = tabPDF->BleedRight->value() / prefsUnitRatio;
4649 fschmid 606
        prefsManager->appPrefs.PDF_Options.doClip = tabPDF->ClipMarg->isChecked();
2873 cbradney 607
        if (tabPDF->Encry->isChecked())
608
        {
609
                int Perm = -64;
610
                if (tabPDF->PDFVersionCombo->currentItem() == 1)
611
                        Perm &= ~0x00240000;
612
                if (tabPDF->PrintSec->isChecked())
613
                        Perm += 4;
614
                if (tabPDF->ModifySec->isChecked())
615
                        Perm += 8;
616
                if (tabPDF->CopySec->isChecked())
617
                        Perm += 16;
618
                if (tabPDF->AddSec->isChecked())
619
                        Perm += 32;
620
                prefsManager->appPrefs.PDF_Options.Permissions = Perm;
621
                prefsManager->appPrefs.PDF_Options.PassOwner = tabPDF->PassOwner->text();
622
                prefsManager->appPrefs.PDF_Options.PassUser = tabPDF->PassUser->text();
623
        }
624
        if (tabPDF->PDFVersionCombo->currentItem() == 0)
625
                prefsManager->appPrefs.PDF_Options.Version = PDFOptions::PDFVersion_13;
626
        if (tabPDF->PDFVersionCombo->currentItem() == 1)
627
                prefsManager->appPrefs.PDF_Options.Version = PDFOptions::PDFVersion_14;
628
        if (tabPDF->PDFVersionCombo->currentItem() == 2)
629
                prefsManager->appPrefs.PDF_Options.Version = PDFOptions::PDFVersion_15;
630
        if (tabPDF->PDFVersionCombo->currentItem() == 3)
631
                prefsManager->appPrefs.PDF_Options.Version = PDFOptions::PDFVersion_X3;
632
        if (tabPDF->OutCombo->currentItem() == 0)
633
        {
634
                prefsManager->appPrefs.PDF_Options.isGrayscale = false;
635
                prefsManager->appPrefs.PDF_Options.UseRGB = true;
636
                prefsManager->appPrefs.PDF_Options.UseProfiles = false;
637
                prefsManager->appPrefs.PDF_Options.UseProfiles2 = false;
638
        }
639
        else
640
        {
641
                if (tabPDF->OutCombo->currentItem() == 2)
642
                {
643
                        prefsManager->appPrefs.PDF_Options.isGrayscale = true;
644
                        prefsManager->appPrefs.PDF_Options.UseRGB = false;
645
                        prefsManager->appPrefs.PDF_Options.UseProfiles = false;
646
                        prefsManager->appPrefs.PDF_Options.UseProfiles2 = false;
647
                }
648
                else
649
                {
650
                        prefsManager->appPrefs.PDF_Options.isGrayscale = false;
651
                        prefsManager->appPrefs.PDF_Options.UseRGB = false;
5880 jghali 652
                        if (/*CMSuse*/ ScCore->haveCMS())
2873 cbradney 653
                        {
654
                                prefsManager->appPrefs.PDF_Options.UseProfiles = tabPDF->EmbedProfs->isChecked();
655
                                prefsManager->appPrefs.PDF_Options.UseProfiles2 = tabPDF->EmbedProfs2->isChecked();
656
                                prefsManager->appPrefs.PDF_Options.Intent = tabPDF->IntendS->currentItem();
657
                                prefsManager->appPrefs.PDF_Options.Intent2 = tabPDF->IntendI->currentItem();
658
                                prefsManager->appPrefs.PDF_Options.EmbeddedI = tabPDF->NoEmbedded->isChecked();
659
                                prefsManager->appPrefs.PDF_Options.SolidProf = tabPDF->SolidPr->currentText();
660
                                prefsManager->appPrefs.PDF_Options.ImageProf = tabPDF->ImageP->currentText();
661
                                prefsManager->appPrefs.PDF_Options.PrintProf = tabPDF->PrintProfC->currentText();
662
                        }
663
                }
664
        }
665
        prefsManager->appPrefs.defaultItemAttributes = *(tabDefaultItemAttributes->getNewAttributes());
666
        prefsManager->appPrefs.defaultToCSetups = *(tabDefaultTOCIndexPrefs->getNewToCs());
5352 cbradney 667
//      prefsManager->appPrefs.KeyActions = tabKeys->getNewKeyMap();
668
        prefsManager->appPrefs.KeyActions = tabKeyboardShortcuts->getNewKeyMap();
7109 fschmid 669
        tabPrinter->storeValues();
2873 cbradney 670
}
5504 subik 671
 
672
void Preferences::applyChangesButton_clicked()
673
{
5781 cbradney 674
        ScCore->primaryMainWindow()->prefsOrg(this);
5504 subik 675
}
5507 subik 676
 
677
void Preferences::backToDefaults_clicked()
678
{
679
        prefsManager->initDefaults();
680
        restoreDefaults();
681
}