Subversion Repositories Scribus

Rev

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