Back to index

scribus-ng  1.3.4.dfsg+svn20071115
prefs.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #include "prefs.h"
00008 #include "prefs.moc"
00009 #include "scribusdoc.h"
00010 #include "scribusstructs.h"
00011 #include "units.h"
00012 #include "langmgr.h"
00013 #include "hysettings.h"
00014 #include "cmsprefs.h"
00015 #include "tabtools.h"
00016 #include "undomanager.h"
00017 #include "tabcheckdoc.h"
00018 #include "tabpdfoptions.h"
00019 #include "fontprefs.h"
00020 #include "units.h"
00021 #include "pagesize.h"
00022 #include "pagestructs.h"
00023 #include "docitemattrprefs.h"
00024 #include "marginWidget.h"
00025 #include "prefsmanager.h"
00026 #include "polygonwidget.h"
00027 #include "fontcombo.h"
00028 #include "linecombo.h"
00029 #include "arrowchooser.h"
00030 #include "pagelayout.h"
00031 #include "pluginmanager.h"
00032 #include "pluginmanagerprefsgui.h"
00033 #include "prefsfile.h"
00034 #include "scplugin.h"
00035 #include "sccombobox.h"
00036 #include "colorcombo.h"
00037 #include "commonstrings.h"
00038 #include "scribusapp.h"
00039 #include "scribuscore.h"
00040 #include "tabtypography.h"
00041 #include "tabguides.h"
00042 #include "tabexternaltoolswidget.h"
00043 #include "tabkeyboardshortcutswidget.h"
00044 #include "tocindexprefs.h"
00045 #include "hyphenator.h"
00046 #include "tabgeneral.h"
00047 #include "tabdisplay.h"
00048 #include "tabdocument.h"
00049 #include "tabmiscellaneous.h"
00050 #include "tabscrapbook.h"
00051 #include "tabprinter.h"
00052 
00053 using namespace std;
00054 
00055 extern QPixmap loadIcon(QString nam);
00056 extern ScribusQApp* ScQApp;
00057 
00058 Preferences::Preferences( QWidget* parent) : PrefsDialogBase( parent )
00059 {
00060        prefsManager=PrefsManager::instance();
00061        ApplicationPrefs* prefsData=&(prefsManager->appPrefs);
00062        ap = (ScribusMainWindow*)parent;
00063        docUnitIndex = prefsData->docUnitIndex;
00064        unitRatio = unitGetRatioFromIndex(docUnitIndex);
00065 
00066        setCaption( tr( "Preferences" ) );
00067 
00068        tabGeneral = new TabGeneral( prefsWidgets, "tabGeneral" );
00069        addItem( tr("General"), loadIcon("scribusicon.png"), tabGeneral);
00070 
00071        tabDocument = new TabDocument( prefsWidgets, "tabDocument" );
00072        addItem( tr("Document"), loadIcon("scribusdoc.png"), tabDocument);
00073 
00074        tabGuides = new TabGuides(prefsWidgets, &prefsData->guidesSettings, &prefsData->typographicSettings, docUnitIndex);
00075        addItem( tr("Guides"), loadIcon("guides.png"), tabGuides);
00076 
00077        tabTypo = new TabTypograpy(  prefsWidgets, &prefsData->typographicSettings);
00078        addItem( tr("Typography"), loadIcon("typography.png"), tabTypo);
00079 
00080        tabTools = new TabTools(prefsWidgets, &prefsData->toolSettings, docUnitIndex, ap->doc);
00081        addItem( tr("Tools"), loadIcon("tools.png"), tabTools);
00082 
00083        tabHyphenator = new HySettings(prefsWidgets, &ap->LangTransl);
00084        addItem( tr("Hyphenator"), loadIcon("hyphenate.png"), tabHyphenator);
00085 
00086        tabFonts = new FontPrefs(prefsWidgets, false, prefsManager->preferencesLocation(), ap->doc);
00087        addItem( tr("Fonts"), loadIcon("font.png"), tabFonts);
00088        
00089        tabPrinter = new TabPrinter(prefsWidgets, "tabPrinter");
00090        addItem( tr("Printer"), loadIcon("printer.png"), tabPrinter);
00091 
00092        tabDocChecker = new TabCheckDoc(  prefsWidgets, prefsData->checkerProfiles, prefsData->curCheckProfile);
00093        addItem( tr("Preflight Verifier"), loadIcon("checkdoc.png"), tabDocChecker);
00094 
00095        if (ScCore->haveCMS())
00096        {
00097               tabColorManagement = new CMSPrefs(prefsWidgets, &prefsData->DCMSset, &ScCore->InputProfiles, &ScCore->InputProfilesCMYK, &ScCore->PrinterProfiles, &ScCore->MonitorProfiles);
00098               addItem( tr("Color Management"), loadIcon("blend.png"), tabColorManagement);
00099        }
00100 
00101        QMap<QString, int> DocFonts;
00102        DocFonts.clear();
00103        tabPDF = new TabPDFOptions( prefsWidgets,
00104                                                         prefsData->PDF_Options,
00105                                                         prefsData->AvailFonts,
00106                                                         ScCore->PDFXProfiles,
00107                                                         DocFonts,
00108                                                         prefsData->PDF_Options.PresentVals,
00109                                                         docUnitIndex,
00110                                                         prefsData->PageHeight,
00111                                                         prefsData->PageWidth,
00112                                                         0 );
00113        addItem( tr("PDF Export"), loadIcon("acroread32.png"), tabPDF);
00114 
00115        tabDefaultItemAttributes = new DocumentItemAttributes( prefsWidgets);
00116        QStringList defaultAttributesList=tabDefaultItemAttributes->getDocAttributesNames();
00117        tabDefaultItemAttributes->setup(&prefsData->defaultItemAttributes);
00118        addItem( tr("Document Item Attributes"), loadIcon("docattributes.png"), tabDefaultItemAttributes);
00119 
00120        tabDefaultTOCIndexPrefs = new TOCIndexPrefs( prefsWidgets );
00121        tabDefaultTOCIndexPrefs->setupItemAttrs( defaultAttributesList );
00122        tabDefaultTOCIndexPrefs->setup(&prefsData->defaultToCSetups, NULL);
00123        addItem( tr("Table of Contents and Indexes"), loadIcon("tabtocindex.png"), tabDefaultTOCIndexPrefs);
00124 
00125        tabKeyboardShortcuts = new TabKeyboardShortcutsWidget(prefsData->KeyActions, prefsWidgets);
00126        addItem( tr("Keyboard Shortcuts"), loadIcon("key_bindings.png"), tabKeyboardShortcuts);
00127 
00128        tabScrapbook = new TabScrapbook( prefsWidgets, "tabScrapbook" );
00129        addItem(  tr("Scrapbook"), loadIcon("scrap.png"), tabScrapbook);
00130 
00131        tabView = new TabDisplay(prefsWidgets, "tabView");
00132        addItem( tr("Display"), loadIcon("screen.png"), tabView);
00133 
00134        tabExtTools = new TabExternalToolsWidget( prefsData, prefsWidgets );
00135        addItem(  tr("External Tools"), loadIcon("externaltools.png"), tabExtTools);
00136 
00137        tabMiscellaneous = new TabMiscellaneous( prefsWidgets, "tabMiscellaneous" );
00138        addItem(  tr("Miscellaneous"), loadIcon("misc.png"), tabMiscellaneous);
00139 
00140        // plugin manager. pv.
00141        pluginManagerPrefsGui = new PluginManagerPrefsGui(prefsWidgets);
00142        addItem( tr("Plugins"), loadIcon("plugins.png"), pluginManagerPrefsGui );
00143 
00144        setupGui();
00145        addPlugins();
00146 
00147        setDS(prefsData->FacingPages);
00148 
00149        resize( minimumSizeHint() );
00150        arrangeIcons();
00151        prefsSelection->setSelected(prefsSelection->firstItem(), true);
00152        itemSelected(prefsSelection->firstItem());
00153        clearWState( WState_Polished );
00154 }
00155 
00156 void Preferences::enableSignals(bool on)
00157 {
00158        if (on)
00159        {
00160               connect(tabDocument->unitCombo, SIGNAL(activated(int)), this, SLOT(unitChange()));
00161               connect(tabDocument->docLayout, SIGNAL( selectedLayout(int) ), this, SLOT( setDS(int) ) );
00162               connect(buttonOk, SIGNAL(clicked()), this, SLOT(setActionHistoryLength()));
00163               if (ScCore->haveCMS())
00164                      connect(tabColorManagement, SIGNAL(cmsOn(bool )), this, SLOT(switchCMS(bool )));
00165               connect(applyChangesButton, SIGNAL(clicked()), this, SLOT(applyChangesButton_clicked()));
00166               connect(backToDefaults, SIGNAL(clicked()), this, SLOT(backToDefaults_clicked()));
00167               connect( prefsWidgets, SIGNAL(aboutToShow(QWidget *)), this, SLOT(showWidgetInStack(QWidget *)));
00168               connect(this, SIGNAL(accepted()), pluginManagerPrefsGui, SLOT(apply()));
00169        }
00170        else
00171        {
00172               disconnect(tabDocument->unitCombo, SIGNAL(activated(int)), this, SLOT(unitChange()));
00173               disconnect(tabDocument->docLayout, SIGNAL( selectedLayout(int) ), this, SLOT( setDS(int) ) );
00174               disconnect(buttonOk, SIGNAL(clicked()), this, SLOT(setActionHistoryLength()));
00175               if (ScCore->haveCMS())
00176                      disconnect(tabColorManagement, SIGNAL(cmsOn(bool )), this, SLOT(switchCMS(bool )));
00177               disconnect(applyChangesButton, SIGNAL(clicked()), this, SLOT(applyChangesButton_clicked()));
00178               disconnect(backToDefaults, SIGNAL(clicked()), this, SLOT(backToDefaults_clicked()));
00179               disconnect( prefsWidgets, SIGNAL(aboutToShow(QWidget *)), this, SLOT(showWidgetInStack(QWidget *)));
00180               disconnect(this, SIGNAL(accepted()), pluginManagerPrefsGui, SLOT(apply()));
00181        }
00182 }
00183 
00184 void Preferences::restoreDefaults()
00185 {
00186        prefsManager->initDefaults();
00187        setupGui();
00188 }
00189 
00190 void Preferences::setupGui()
00191 {
00192        enableSignals(false);
00193        ApplicationPrefs* prefsData=&(prefsManager->appPrefs);
00194 
00195        tabGeneral->restoreDefaults(prefsData);
00196        tabDocument->restoreDefaults(prefsData);
00197        tabPrinter->restoreDefaults(prefsData);
00198        tabView->restoreDefaults(prefsData, prefsData->guidesSettings, prefsData->pageSets, prefsData->FacingPages, prefsData->scratch);
00199        tabScrapbook->restoreDefaults(prefsData);
00200        tabHyphenator->restoreDefaults(prefsData);
00201        tabGuides->restoreDefaults(&prefsData->guidesSettings, &prefsData->typographicSettings, docUnitIndex);
00202        tabTypo->restoreDefaults(&prefsData->typographicSettings);
00203        tabTools->restoreDefaults(&prefsData->toolSettings, docUnitIndex);
00204        // main performance issue in availFonts->GetFonts(HomeP)!
00205        // no prefsData here
00206        tabFonts->restoreDefaults();
00207        tabDocChecker->restoreDefaults(&prefsData->checkerProfiles, prefsData->curCheckProfile);
00208 
00209        QMap<QString, int> DocFonts;
00210        DocFonts.clear();
00211        tabPDF->restoreDefaults(prefsData->PDF_Options,
00212                                                  prefsData->AvailFonts,
00213                                                  ScCore->PDFXProfiles,
00214                                                  DocFonts,
00215                                                  prefsData->PDF_Options.PresentVals,
00216                                                  docUnitIndex,
00217                                                  prefsData->PageHeight,
00218                                                  prefsData->PageWidth,
00219                                                  0, false);
00220 
00221        if (ScCore->haveCMS())
00222               tabColorManagement->restoreDefaults(&prefsData->DCMSset, &ScCore->InputProfiles,
00223                                                                              &ScCore->InputProfilesCMYK,
00224                                                                              &ScCore->PrinterProfiles, &ScCore->MonitorProfiles);
00225        QStringList defaultAttributesList=tabDefaultItemAttributes->getDocAttributesNames();
00226        tabDefaultItemAttributes->setup(&prefsData->defaultItemAttributes);
00227        tabDefaultTOCIndexPrefs->setupItemAttrs( defaultAttributesList );
00228        tabDefaultTOCIndexPrefs->setup(&prefsData->defaultToCSetups, NULL);
00229        tabKeyboardShortcuts->restoreDefaults();
00230        tabExtTools->restoreDefaults(prefsData);
00231        tabMiscellaneous->restoreDefaults(prefsData);
00232        enableSignals(true);
00233        unitChange();
00234 }
00235 
00236 void Preferences::addPlugins()
00237 {
00238        // Scan for plugins that provide a prefs widget, and add it to the
00239        // prefs dialog.
00240        // For each plugin, enabled or not:
00241        ScPlugin* plugin = 0;
00242        PrefsPanel* panel = 0;
00243        QString panelCaption;
00244        QPixmap panelIcon;
00245 
00246        PluginManager& pluginManager = PluginManager::instance();
00247        QValueList<QCString> pluginNames(pluginManager.pluginNames(true));
00248        QValueList<QCString>::Iterator itEnd(pluginNames.end());
00249 
00250        for (QValueList<QCString>::Iterator it(pluginNames.begin()); it != itEnd ; ++it )
00251        {
00252               // Ask the plugin manager for a plugin (skipping disabled plugins).
00253               plugin = pluginManager.getPlugin(*it, false);
00254               // If we got a plugin (which we know is enabled):
00255               if (plugin)
00256               {
00257                      // Ask the plugin for a prefs widget
00258                      bool wantPanel = plugin->newPrefsPanelWidget(
00259                                    prefsWidgets, panel, panelCaption, panelIcon);
00260                      // If it gave us one...
00261                      if (wantPanel)
00262                      {
00263                             // Ensure that we got sane return values
00264                             Q_ASSERT(panel);
00265                             Q_ASSERT(!panelIcon.isNull());
00266                             Q_ASSERT(!panelCaption.isNull());
00267                             // plug it in to the dialog,
00268                             addItem(panelCaption, panelIcon, panel);
00269                             // and connect a signal to tell it to save its
00270                             // settings.
00271                             connect(this, SIGNAL(accepted()), panel, SLOT(apply()));
00272                      }
00273               }
00274        }
00275 }
00276 
00277 void Preferences::accept()
00278 {
00279        emit accepted();
00280        return PrefsDialogBase::accept();
00281 }
00282 
00283 void Preferences::setDS(int layout)
00284 {
00285        tabDocument->marginGroup->setFacingPages(!(layout == singlePage));
00286        tabDocument->choosenLayout = layout;
00287        tabDocument->docLayout->firstPage->setCurrentItem(prefsManager->appPrefs.pageSets[tabDocument->choosenLayout].FirstPage);
00288        tabView->gapHorizontal->setValue(prefsManager->appPrefs.pageSets[tabDocument->choosenLayout].GapHorizontal * unitRatio);
00289        tabView->gapVertical->setValue(prefsManager->appPrefs.pageSets[tabDocument->choosenLayout].GapVertical * unitRatio);
00290 }
00291 
00292 void Preferences::unitChange()
00293 {
00294        double oldUnitRatio = unitRatio;
00295        docUnitIndex = tabDocument->unitCombo->currentItem();
00296        unitRatio = unitGetRatioFromIndex(docUnitIndex);
00297        int decimals = unitGetDecimalsFromIndex(docUnitIndex);
00298        QString suffix = unitGetSuffixFromIndex(docUnitIndex);
00299        double invUnitConversion = 1.0 / oldUnitRatio * unitRatio;
00300        
00301        tabDocument->unitChange();
00302        tabGuides->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
00303        tabView->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
00304        tabTools->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
00305        tabPDF->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
00306        tabPrinter->unitChange(suffix, docUnitIndex, decimals, invUnitConversion);
00307 }
00308 
00309 
00310 void Preferences::setActionHistoryLength()
00311 {
00312        PrefsContext *undoPrefs = PrefsManager::instance()->prefsFile->getContext("undo");
00313        bool isEnabled = tabDocument->urGroup->isChecked();
00314        if (!isEnabled)
00315               UndoManager::instance()->clearStack();
00316        UndoManager::instance()->setUndoEnabled(isEnabled);
00317        undoPrefs->set("enabled", isEnabled);
00318        UndoManager::instance()->setAllHistoryLengths(tabDocument->urSpinBox->value());
00319 }
00320 
00321 void Preferences::switchCMS(bool enable)
00322 {
00323        tabPDF->enableCMS(enable);
00324 }
00325 
00326 void Preferences::showWidgetInStack(QWidget *widgetToShow)
00327 {
00328        //Update the attributes list in TOC setup
00329        if (widgetToShow==tabDefaultTOCIndexPrefs)
00330               tabDefaultTOCIndexPrefs->setupItemAttrs( tabDefaultItemAttributes->getDocAttributesNames() );
00331        if (widgetToShow == tabTools)
00332               tabTools->enableFontPreview(true);
00333 }
00334 
00335 void Preferences::updatePreferences()
00336 {
00337        double prefsUnitRatio = unitGetRatioFromIndex(tabDocument->unitCombo->currentItem());
00338 
00339        prefsManager->appPrefs.AppFontSize = tabGeneral->GFsize->value();
00340        prefsManager->appPrefs.PaletteFontSize = tabGeneral->GTFsize->value();
00341        ScQApp->neverSplash(!tabGeneral->showSplashCheckBox->isChecked());
00342        prefsManager->appPrefs.showStartupDialog = tabGeneral->startUpDialog->isChecked();
00343        prefsManager->appPrefs.Wheelval = tabGeneral->wheelJumpSpin->value();
00344        prefsManager->appPrefs.moveTimeout = tabGeneral->spinTimeout->value();
00345        prefsManager->appPrefs.RecentDCount = tabGeneral->recentDocs->value();
00346        prefsManager->appPrefs.DocDir = ScPaths::separatorsToSlashes( tabGeneral->Docs->text() );
00347        prefsManager->appPrefs.ProfileDir = ScPaths::separatorsToSlashes( tabGeneral->ProPfad->text() );
00348        prefsManager->appPrefs.ScriptDir = ScPaths::separatorsToSlashes( tabGeneral->ScriptPfad->text() );
00349        prefsManager->appPrefs.documentTemplatesDir = ScPaths::separatorsToSlashes( tabGeneral->DocumentTemplateDir->text() );
00350        prefsManager->appPrefs.guiLanguage=tabGeneral->selectedGUILang;
00351        prefsManager->appPrefs.GUI = tabGeneral->GUICombo->currentText();
00352 
00353        prefsManager->appPrefs.pageSets[tabDocument->choosenLayout].GapHorizontal = tabView->gapHorizontal->value() / prefsUnitRatio;
00354        prefsManager->appPrefs.pageSets[tabDocument->choosenLayout].GapVertical = tabView->gapVertical->value() / prefsUnitRatio;
00355        prefsManager->appPrefs.marginColored = tabView->checkUnprintable->isChecked();
00356        prefsManager->appPrefs.scratch.Bottom = tabView->bottomScratch->value() / prefsUnitRatio;
00357        prefsManager->appPrefs.scratch.Left = tabView->leftScratch->value() / prefsUnitRatio;
00358        prefsManager->appPrefs.scratch.Right = tabView->rightScratch->value() / prefsUnitRatio;
00359        prefsManager->appPrefs.scratch.Top = tabView->topScratch->value() / prefsUnitRatio;
00360        // GUI colors
00361        prefsManager->appPrefs.DpapColor = tabView->colorPaper;
00362        prefsManager->appPrefs.DFrameColor = tabView->colorFrame;
00363        prefsManager->appPrefs.DFrameNormColor = tabView->colorFrameNorm;
00364        prefsManager->appPrefs.DFrameGroupColor = tabView->colorFrameGroup;
00365        prefsManager->appPrefs.DFrameLockColor = tabView->colorFrameLocked;
00366        prefsManager->appPrefs.DFrameLinkColor = tabView->colorFrameLinked;
00367        prefsManager->appPrefs.DFrameAnnotationColor = tabView->colorFrameAnnotation;
00368        prefsManager->appPrefs.DPageBorderColor = tabView->colorPageBorder;
00369        prefsManager->appPrefs.DControlCharColor = tabView->colorControlChars;
00370        // Guides
00371 
00372        prefsManager->appPrefs.guidesSettings.framesShown = tabView->checkFrame->isChecked();
00373        prefsManager->appPrefs.guidesSettings.showBleed = tabView->checkBleed->isChecked();
00374        prefsManager->appPrefs.guidesSettings.layerMarkersShown = tabView->checkLayerM->isChecked();
00375        prefsManager->appPrefs.guidesSettings.rulerMode = tabView->checkRuler->isChecked();
00376        prefsManager->appPrefs.guidesSettings.showPic = tabView->checkPictures->isChecked();
00377        prefsManager->appPrefs.guidesSettings.linkShown = tabView->checkLink->isChecked();
00378        prefsManager->appPrefs.guidesSettings.showControls = tabView->checkControl->isChecked();
00379        prefsManager->appPrefs.DisScale = tabView->DisScale;
00380 
00381        prefsManager->appPrefs.doCopyToScrapbook = tabScrapbook->useScrapBookasExtension->isChecked();
00382        prefsManager->appPrefs.persistentScrapbook = tabScrapbook->persistentScrapbook->isChecked();
00383        prefsManager->appPrefs.numScrapbookCopies = tabScrapbook->numScrapCopies->value();
00384 
00385        tabTools->polyWidget->getValues(&prefsManager->appPrefs.toolSettings.polyC, &prefsManager->appPrefs.toolSettings.polyFd, &prefsManager->appPrefs.toolSettings.polyF, &prefsManager->appPrefs.toolSettings.polyS, &prefsManager->appPrefs.toolSettings.polyR);
00386 
00387        prefsManager->appPrefs.pageSize = tabDocument->prefsPageSizeName;
00388        prefsManager->appPrefs.pageOrientation = tabDocument->pageOrientationComboBox->currentItem();
00389        prefsManager->appPrefs.PageWidth = tabDocument->pageW;
00390        prefsManager->appPrefs.PageHeight = tabDocument->pageH;
00391 
00392        prefsManager->appPrefs.margins.Top = tabDocument->marginGroup->top();
00393        prefsManager->appPrefs.margins.Bottom = tabDocument->marginGroup->bottom();
00394        prefsManager->appPrefs.margins.Left = tabDocument->marginGroup->left();
00395        prefsManager->appPrefs.margins.Right = tabDocument->marginGroup->right();
00396        prefsManager->appPrefs.FacingPages  = tabDocument->choosenLayout;
00397        prefsManager->appPrefs.bleeds.Bottom = tabDocument->marginGroup->bottomBleed();
00398        prefsManager->appPrefs.bleeds.Top = tabDocument->marginGroup->topBleed();
00399        prefsManager->appPrefs.bleeds.Left = tabDocument->marginGroup->leftBleed();
00400        prefsManager->appPrefs.bleeds.Right = tabDocument->marginGroup->rightBleed();
00401        prefsManager->appPrefs.pageSets[tabDocument->choosenLayout].FirstPage = tabDocument->docLayout->firstPage->currentItem();
00402 
00403        prefsManager->setImageEditorExecutable(tabExtTools->newImageTool());
00404        prefsManager->setExtBrowserExecutable(tabExtTools->newExtBrowserTool());
00405        prefsManager->appPrefs.gs_AntiAliasGraphics = tabExtTools->newAntialiasGraphics();
00406        prefsManager->appPrefs.gs_AntiAliasText = tabExtTools->newAntialiasText();
00407        prefsManager->setGhostscriptExecutable(tabExtTools->newPSTool());
00408        prefsManager->appPrefs.gs_Resolution = tabExtTools->newPSToolResolution();
00409 
00410        prefsManager->appPrefs.guidesSettings.before = tabGuides->inBackground->isChecked();
00411        
00412        prefsManager->appPrefs.askBeforeSubstituite = tabMiscellaneous->AskForSubs->isChecked();
00413        prefsManager->appPrefs.haveStylePreview = tabMiscellaneous->stylePreview->isChecked();
00414        // lorem ipsum
00415        prefsManager->appPrefs.useStandardLI = tabMiscellaneous->useStandardLI->isChecked();
00416        prefsManager->appPrefs.paragraphsLI = tabMiscellaneous->paragraphsLI->value();
00417 
00418        prefsManager->appPrefs.docUnitIndex = tabDocument->unitCombo->currentItem();
00419 
00420        prefsManager->appPrefs.toolSettings.defFont = tabTools->fontComboText->currentText();
00421        prefsManager->appPrefs.toolSettings.defSize = tabTools->sizeComboText->currentText().left(2).toInt() * 10;
00422 
00423        prefsManager->appPrefs.guidesSettings.marginsShown = tabGuides->marginBox->isChecked();
00424        prefsManager->appPrefs.guidesSettings.gridShown = tabGuides->checkGrid->isChecked();
00425        prefsManager->appPrefs.guidesSettings.guidesShown = tabGuides->guideBox->isChecked();
00426        prefsManager->appPrefs.guidesSettings.baseShown = tabGuides->baselineBox->isChecked();
00427        prefsManager->appPrefs.guidesSettings.grabRad = tabGuides->grabDistance->value();
00428        prefsManager->appPrefs.guidesSettings.guideRad = tabGuides->snapDistance->value();
00429        prefsManager->appPrefs.guidesSettings.minorGrid = tabGuides->minorSpace->value() / prefsUnitRatio;
00430        prefsManager->appPrefs.guidesSettings.majorGrid = tabGuides->majorSpace->value() / prefsUnitRatio;
00431        prefsManager->appPrefs.guidesSettings.minorColor = tabGuides->colorMinorGrid;
00432        prefsManager->appPrefs.guidesSettings.majorColor = tabGuides->colorMajorGrid;
00433        prefsManager->appPrefs.guidesSettings.margColor = tabGuides->colorMargin;
00434        prefsManager->appPrefs.guidesSettings.guideColor = tabGuides->colorGuides;
00435        prefsManager->appPrefs.guidesSettings.baseColor = tabGuides->colorBaselineGrid;
00436        prefsManager->appPrefs.checkerProfiles = tabDocChecker->checkerProfile;
00437        prefsManager->appPrefs.curCheckProfile = tabDocChecker->curCheckProfile->currentText();
00438        prefsManager->appPrefs.typographicSettings.valueSuperScript = tabTypo->superDisplacement->value();
00439        prefsManager->appPrefs.typographicSettings.scalingSuperScript = tabTypo->superScaling->value();
00440        prefsManager->appPrefs.typographicSettings.valueSubScript = tabTypo->subDisplacement->value();
00441        prefsManager->appPrefs.typographicSettings.scalingSubScript = tabTypo->subScaling->value();
00442        prefsManager->appPrefs.typographicSettings.valueSmallCaps = tabTypo->capsScaling->value();
00443        prefsManager->appPrefs.typographicSettings.autoLineSpacing = tabTypo->autoLine->value();
00444        prefsManager->appPrefs.typographicSettings.valueBaseGrid = tabGuides->baseGrid->value() / prefsUnitRatio;
00445        prefsManager->appPrefs.typographicSettings.offsetBaseGrid = tabGuides->baseOffset->value() / prefsUnitRatio;
00446        prefsManager->appPrefs.typographicSettings.valueUnderlinePos = qRound(tabTypo->underlinePos->value() * 10);
00447        prefsManager->appPrefs.typographicSettings.valueUnderlineWidth = qRound(tabTypo->underlineWidth->value() * 10);
00448        prefsManager->appPrefs.typographicSettings.valueStrikeThruPos = qRound(tabTypo->strikethruPos->value() * 10);
00449        prefsManager->appPrefs.typographicSettings.valueStrikeThruWidth = qRound(tabTypo->strikethruWidth->value() * 10);
00450        prefsManager->appPrefs.toolSettings.dTextBackGround = tabTools->colorComboTextBackground->currentText();
00451        if (prefsManager->appPrefs.toolSettings.dTextBackGround == CommonStrings::tr_NoneColor)
00452               prefsManager->appPrefs.toolSettings.dTextBackGround = CommonStrings::None;
00453        prefsManager->appPrefs.toolSettings.dTextLineColor = tabTools->colorComboTextLine->currentText();
00454        if (prefsManager->appPrefs.toolSettings.dTextLineColor == CommonStrings::tr_NoneColor)
00455               prefsManager->appPrefs.toolSettings.dTextLineColor = CommonStrings::None;
00456        prefsManager->appPrefs.toolSettings.dTextBackGroundShade = tabTools->shadingTextBack->value();
00457        prefsManager->appPrefs.toolSettings.dTextLineShade = tabTools->shadingTextLine->value();
00458        prefsManager->appPrefs.toolSettings.dTextPenShade = tabTools->shadingText->value();
00459        prefsManager->appPrefs.toolSettings.dTextStrokeShade = tabTools->shadingTextStroke->value();
00460        prefsManager->appPrefs.toolSettings.dPen = tabTools->colorComboLineShape->currentText();
00461        if (prefsManager->appPrefs.toolSettings.dPen == CommonStrings::tr_NoneColor)
00462               prefsManager->appPrefs.toolSettings.dPen = CommonStrings::None;
00463        prefsManager->appPrefs.toolSettings.dPenText = tabTools->colorComboText->currentText();
00464        if (prefsManager->appPrefs.toolSettings.dPenText == CommonStrings::tr_NoneColor)
00465               prefsManager->appPrefs.toolSettings.dPenText = CommonStrings::None;
00466        prefsManager->appPrefs.toolSettings.dStrokeText = tabTools->colorComboStrokeText->currentText();
00467        if (prefsManager->appPrefs.toolSettings.dStrokeText == CommonStrings::tr_NoneColor)
00468               prefsManager->appPrefs.toolSettings.dStrokeText = CommonStrings::None;
00469        prefsManager->appPrefs.toolSettings.dCols = tabTools->columnsText->value();
00470        prefsManager->appPrefs.toolSettings.dGap = tabTools->gapText->value() / prefsUnitRatio;
00471        prefsManager->appPrefs.toolSettings.dTabWidth = tabTools->gapTab->value() / prefsUnitRatio;
00472        prefsManager->appPrefs.toolSettings.dBrush = tabTools->comboFillShape->currentText();
00473        if (prefsManager->appPrefs.toolSettings.dBrush == CommonStrings::tr_NoneColor)
00474               prefsManager->appPrefs.toolSettings.dBrush = CommonStrings::None;
00475        prefsManager->appPrefs.toolSettings.dShade = tabTools->shadingFillShape->value();
00476        prefsManager->appPrefs.toolSettings.dShade2 = tabTools->shadingLineShape->value();
00477        switch (tabTools->tabFillCombo->currentItem())
00478        {
00479               case 0:
00480                      prefsManager->appPrefs.toolSettings.tabFillChar = "";
00481                      break;
00482               case 1:
00483                      prefsManager->appPrefs.toolSettings.tabFillChar = ".";
00484                      break;
00485               case 2:
00486                      prefsManager->appPrefs.toolSettings.tabFillChar = "-";
00487                      break;
00488               case 3:
00489                      prefsManager->appPrefs.toolSettings.tabFillChar = "_";
00490                      break;
00491               case 4:
00492                      prefsManager->appPrefs.toolSettings.tabFillChar = tabTools->tabFillCombo->currentText().right(1);
00493                      break;
00494        }
00495        switch (tabTools->comboStyleShape->currentItem())
00496        {
00497               case 0:
00498                      prefsManager->appPrefs.toolSettings.dLineArt = SolidLine;
00499                      break;
00500               case 1:
00501                      prefsManager->appPrefs.toolSettings.dLineArt = DashLine;
00502                      break;
00503               case 2:
00504                      prefsManager->appPrefs.toolSettings.dLineArt = DotLine;
00505                      break;
00506               case 3:
00507                      prefsManager->appPrefs.toolSettings.dLineArt = DashDotLine;
00508                      break;
00509               case 4:
00510                      prefsManager->appPrefs.toolSettings.dLineArt = DashDotDotLine;
00511                      break;
00512        }
00513        prefsManager->appPrefs.toolSettings.dWidth = tabTools->lineWidthShape->value();
00514        prefsManager->appPrefs.toolSettings.dPenLine = tabTools->colorComboLine->currentText();
00515        if (prefsManager->appPrefs.toolSettings.dPenLine == CommonStrings::tr_NoneColor)
00516               prefsManager->appPrefs.toolSettings.dPenLine = CommonStrings::None;
00517        prefsManager->appPrefs.toolSettings.dShadeLine = tabTools->shadingLine->value();
00518        switch (tabTools->comboStyleLine->currentItem())
00519        {
00520        case 0:
00521               prefsManager->appPrefs.toolSettings.dLstyleLine = SolidLine;
00522               break;
00523        case 1:
00524               prefsManager->appPrefs.toolSettings.dLstyleLine = DashLine;
00525               break;
00526        case 2:
00527               prefsManager->appPrefs.toolSettings.dLstyleLine = DotLine;
00528               break;
00529        case 3:
00530               prefsManager->appPrefs.toolSettings.dLstyleLine = DashDotLine;
00531               break;
00532        case 4:
00533               prefsManager->appPrefs.toolSettings.dLstyleLine = DashDotDotLine;
00534               break;
00535        }
00536        prefsManager->appPrefs.toolSettings.dWidthLine = tabTools->lineWidthLine->value();
00537        prefsManager->appPrefs.toolSettings.dStartArrow = tabTools->startArrow->currentItem();
00538        prefsManager->appPrefs.toolSettings.dEndArrow = tabTools->endArrow->currentItem();
00539        prefsManager->appPrefs.toolSettings.magMin = tabTools->minimumZoom->value();
00540        prefsManager->appPrefs.toolSettings.magMax = tabTools->maximumZoom->value();
00541        prefsManager->appPrefs.toolSettings.magStep = tabTools->zoomStep->value();
00542        prefsManager->appPrefs.toolSettings.dBrushPict = tabTools->comboFillImage->currentText();
00543        if (prefsManager->appPrefs.toolSettings.dBrushPict == CommonStrings::tr_NoneColor)
00544               prefsManager->appPrefs.toolSettings.dBrushPict = CommonStrings::None;
00545        prefsManager->appPrefs.toolSettings.shadePict = tabTools->shadingFillImage->value();
00546        prefsManager->appPrefs.toolSettings.scaleX = static_cast<double>(tabTools->scalingHorizontal->value()) / 100.0;
00547        prefsManager->appPrefs.toolSettings.scaleY = static_cast<double>(tabTools->scalingVertical->value()) / 100.0;
00548        prefsManager->appPrefs.toolSettings.scaleType = tabTools->buttonGroup3->isChecked();
00549        prefsManager->appPrefs.toolSettings.aspectRatio = tabTools->checkRatioImage->isChecked();
00550        prefsManager->appPrefs.toolSettings.useEmbeddedPath = tabTools->embeddedPath->isChecked();
00551        int haRes = 0;
00552        if (tabTools->checkFullRes->isChecked())
00553               haRes = 0;
00554        if (tabTools->checkNormalRes->isChecked())
00555               haRes = 1;
00556        if (tabTools->checkHalfRes->isChecked())
00557               haRes = 2;
00558        prefsManager->appPrefs.toolSettings.lowResType = haRes;
00559        prefsManager->appPrefs.toolSettings.dispX = tabTools->genDispX->value();
00560        prefsManager->appPrefs.toolSettings.dispY = tabTools->genDispY->value();
00561        prefsManager->appPrefs.toolSettings.constrain = tabTools->genRot->value();
00562        prefsManager->appPrefs.AutoSave = tabDocument->GroupAS->isChecked();
00563        prefsManager->appPrefs.AutoSaveTime = tabDocument->ASTime->value() * 60 * 1000;
00564        prefsManager->appPrefs.MinWordLen = tabHyphenator->wordLen->value();
00565        prefsManager->appPrefs.Language = ScCore->primaryMainWindow()->GetLang(tabHyphenator->language->currentText());
00566        prefsManager->appPrefs.Automatic = !tabHyphenator->verbose->isChecked();
00567        prefsManager->appPrefs.AutoCheck = tabHyphenator->input->isChecked();
00568        prefsManager->appPrefs.HyCount = tabHyphenator->maxCount->value();
00569        if (ScCore->haveCMS())
00570               tabColorManagement->setValues();
00571        uint a = 0;
00572        SCFontsIterator it(prefsManager->appPrefs.AvailFonts);
00573        for ( ; it.hasNext() ; it.next())
00574        {
00575               it.current().embedPs(tabFonts->fontFlags[it.currentKey()].FlagPS);
00576               it.current().usable(tabFonts->fontFlags[it.currentKey()].FlagUse);
00577               it.current().subset(tabFonts->fontFlags[it.currentKey()].FlagSub);
00578        }
00579        a = 0;
00580        QMap<QString,QString>::Iterator itfsuend=tabFonts->RList.end();
00581        prefsManager->appPrefs.GFontSub.clear();
00582        for (QMap<QString,QString>::Iterator itfsu = tabFonts->RList.begin(); itfsu != itfsuend; ++itfsu)
00583               prefsManager->appPrefs.GFontSub[itfsu.key()] = tabFonts->FlagsRepl.at(a++)->currentText();
00584        prefsManager->appPrefs.PDF_Options.Thumbnails = tabPDF->CheckBox1->isChecked();
00585        prefsManager->appPrefs.PDF_Options.Compress = tabPDF->Compression->isChecked();
00586        prefsManager->appPrefs.PDF_Options.CompressMethod = tabPDF->CMethod->currentItem();
00587        prefsManager->appPrefs.PDF_Options.Quality = tabPDF->CQuality->currentItem();
00588        prefsManager->appPrefs.PDF_Options.Resolution = tabPDF->Resolution->value();
00589        prefsManager->appPrefs.PDF_Options.RecalcPic = tabPDF->DSColor->isChecked();
00590        prefsManager->appPrefs.PDF_Options.PicRes = tabPDF->ValC->value();
00591        prefsManager->appPrefs.PDF_Options.Bookmarks = tabPDF->CheckBM->isChecked();
00592        prefsManager->appPrefs.PDF_Options.Binding = tabPDF->ComboBind->currentItem();
00593        prefsManager->appPrefs.PDF_Options.MirrorH = tabPDF->MirrorH->isOn();
00594        prefsManager->appPrefs.PDF_Options.MirrorV = tabPDF->MirrorV->isOn();
00595        prefsManager->appPrefs.PDF_Options.RotateDeg = tabPDF->RotateDeg->currentItem() * 90;
00596        prefsManager->appPrefs.PDF_Options.Articles = tabPDF->Article->isChecked();
00597        prefsManager->appPrefs.PDF_Options.Encrypt = tabPDF->Encry->isChecked();
00598        prefsManager->appPrefs.PDF_Options.UseLPI = tabPDF->UseLPI->isChecked();
00599        prefsManager->appPrefs.PDF_Options.UseSpotColors = tabPDF->overprintMode->isChecked();
00600        prefsManager->appPrefs.PDF_Options.doOverprint = !tabPDF->useSpot->isChecked();
00601        prefsManager->appPrefs.PDF_Options.doMultiFile = false;
00602        prefsManager->appPrefs.PDF_Options.bleeds.Bottom = tabPDF->BleedBottom->value() / prefsUnitRatio;
00603        prefsManager->appPrefs.PDF_Options.bleeds.Top = tabPDF->BleedTop->value() / prefsUnitRatio;
00604        prefsManager->appPrefs.PDF_Options.bleeds.Left = tabPDF->BleedLeft->value() / prefsUnitRatio;
00605        prefsManager->appPrefs.PDF_Options.bleeds.Right = tabPDF->BleedRight->value() / prefsUnitRatio;
00606        prefsManager->appPrefs.PDF_Options.doClip = tabPDF->ClipMarg->isChecked();
00607        if (tabPDF->Encry->isChecked())
00608        {
00609               int Perm = -64;
00610               if (tabPDF->PDFVersionCombo->currentItem() == 1)
00611                      Perm &= ~0x00240000;
00612               if (tabPDF->PrintSec->isChecked())
00613                      Perm += 4;
00614               if (tabPDF->ModifySec->isChecked())
00615                      Perm += 8;
00616               if (tabPDF->CopySec->isChecked())
00617                      Perm += 16;
00618               if (tabPDF->AddSec->isChecked())
00619                      Perm += 32;
00620               prefsManager->appPrefs.PDF_Options.Permissions = Perm;
00621               prefsManager->appPrefs.PDF_Options.PassOwner = tabPDF->PassOwner->text();
00622               prefsManager->appPrefs.PDF_Options.PassUser = tabPDF->PassUser->text();
00623        }
00624        if (tabPDF->PDFVersionCombo->currentItem() == 0)
00625               prefsManager->appPrefs.PDF_Options.Version = PDFOptions::PDFVersion_13;
00626        if (tabPDF->PDFVersionCombo->currentItem() == 1)
00627               prefsManager->appPrefs.PDF_Options.Version = PDFOptions::PDFVersion_14;
00628        if (tabPDF->PDFVersionCombo->currentItem() == 2)
00629               prefsManager->appPrefs.PDF_Options.Version = PDFOptions::PDFVersion_15;
00630        if (tabPDF->PDFVersionCombo->currentItem() == 3)
00631               prefsManager->appPrefs.PDF_Options.Version = PDFOptions::PDFVersion_X3;
00632        if (tabPDF->OutCombo->currentItem() == 0)
00633        {
00634               prefsManager->appPrefs.PDF_Options.isGrayscale = false;
00635               prefsManager->appPrefs.PDF_Options.UseRGB = true;
00636               prefsManager->appPrefs.PDF_Options.UseProfiles = false;
00637               prefsManager->appPrefs.PDF_Options.UseProfiles2 = false;
00638        }
00639        else
00640        {
00641               if (tabPDF->OutCombo->currentItem() == 2)
00642               {
00643                      prefsManager->appPrefs.PDF_Options.isGrayscale = true;
00644                      prefsManager->appPrefs.PDF_Options.UseRGB = false;
00645                      prefsManager->appPrefs.PDF_Options.UseProfiles = false;
00646                      prefsManager->appPrefs.PDF_Options.UseProfiles2 = false;
00647               }
00648               else
00649               {
00650                      prefsManager->appPrefs.PDF_Options.isGrayscale = false;
00651                      prefsManager->appPrefs.PDF_Options.UseRGB = false;
00652                      if (/*CMSuse*/ ScCore->haveCMS())
00653                      {
00654                             prefsManager->appPrefs.PDF_Options.UseProfiles = tabPDF->EmbedProfs->isChecked();
00655                             prefsManager->appPrefs.PDF_Options.UseProfiles2 = tabPDF->EmbedProfs2->isChecked();
00656                             prefsManager->appPrefs.PDF_Options.Intent = tabPDF->IntendS->currentItem();
00657                             prefsManager->appPrefs.PDF_Options.Intent2 = tabPDF->IntendI->currentItem();
00658                             prefsManager->appPrefs.PDF_Options.EmbeddedI = tabPDF->NoEmbedded->isChecked();
00659                             prefsManager->appPrefs.PDF_Options.SolidProf = tabPDF->SolidPr->currentText();
00660                             prefsManager->appPrefs.PDF_Options.ImageProf = tabPDF->ImageP->currentText();
00661                             prefsManager->appPrefs.PDF_Options.PrintProf = tabPDF->PrintProfC->currentText();
00662                      }
00663               }
00664        }
00665        prefsManager->appPrefs.defaultItemAttributes = *(tabDefaultItemAttributes->getNewAttributes());
00666        prefsManager->appPrefs.defaultToCSetups = *(tabDefaultTOCIndexPrefs->getNewToCs());
00667 //     prefsManager->appPrefs.KeyActions = tabKeys->getNewKeyMap();
00668        prefsManager->appPrefs.KeyActions = tabKeyboardShortcuts->getNewKeyMap();
00669        tabPrinter->storeValues();
00670 }
00671 
00672 void Preferences::applyChangesButton_clicked()
00673 {
00674        ScCore->primaryMainWindow()->prefsOrg(this);
00675 }
00676 
00677 void Preferences::backToDefaults_clicked()
00678 {
00679        prefsManager->initDefaults();
00680        restoreDefaults();
00681 }