Rev 20264 | Rev 20383 | 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 | */ |
||
2834 | cbradney | 7 | /*************************************************************************** |
16357 | petr | 8 | copyright : (C) 2005 by Craig Bradney |
9 | email : cbradney@zip.com.au |
||
2834 | cbradney | 10 | ***************************************************************************/ |
11 | |||
12 | /*************************************************************************** |
||
16357 | petr | 13 | * * |
2834 | cbradney | 14 | * This program is free software; you can redistribute it and/or modify * |
15 | * it under the terms of the GNU General Public License as published by * |
||
16357 | petr | 16 | * the Free Software Foundation; either version 2 of the License, or * |
17 | * (at your option) any later version. * |
||
18 | * * |
||
2834 | cbradney | 19 | ***************************************************************************/ |
2835 | cbradney | 20 | |
10531 | avox | 21 | #include <QColor> |
22 | #include <QDebug> |
||
8528 | cbradney | 23 | #include <QDesktopWidget> |
10223 | cbradney | 24 | #include <QDir> |
25 | #include <QDomDocument> |
||
26 | #include <QFile> |
||
10531 | avox | 27 | #include <QList> |
17945 | jghali | 28 | #include <QMessageBox> |
10223 | cbradney | 29 | #include <QString> |
11506 | mrdocs | 30 | #include <QStringList> |
10223 | cbradney | 31 | #include <QStyleFactory> |
17945 | jghali | 32 | #include <QTransform> |
2835 | cbradney | 33 | |
2834 | cbradney | 34 | #include "prefsmanager.h" |
5243 | cbradney | 35 | |
36 | #include "actionmanager.h" |
||
4606 | cbradney | 37 | #include "colorsetmanager.h" |
4538 | cbradney | 38 | #include "commonstrings.h" |
2859 | cbradney | 39 | #include "filewatcher.h" |
11506 | mrdocs | 40 | #include "latexhelpers.h" |
17986 | craig | 41 | #include "localemgr.h" |
2865 | cbradney | 42 | #include "pagesize.h" |
4122 | cbradney | 43 | #include "pagestructs.h" |
2835 | cbradney | 44 | #include "pdfoptions.h" |
45 | #include "prefsfile.h" |
||
13460 | jghali | 46 | #include "scclocale.h" |
14150 | fschmid | 47 | #include "sccolorengine.h" |
17223 | jghali | 48 | #include "scdomelement.h" |
2835 | cbradney | 49 | #include "scfonts.h" |
50 | #include "scpaths.h" |
||
17986 | craig | 51 | #include "scribusapp.h" |
5781 | cbradney | 52 | #include "scribuscore.h" |
2835 | cbradney | 53 | #include "scribusstructs.h" |
16990 | fschmid | 54 | #include "sctextstream.h" |
17986 | craig | 55 | #include "units.h" |
15665 | fschmid | 56 | #include "util_color.h" |
11605 | jghali | 57 | #include "util_file.h" |
10212 | cbradney | 58 | #include "util_ghostscript.h" |
10976 | cbradney | 59 | |
17223 | jghali | 60 | #include "ui/missing.h" |
61 | #include "ui/modetoolbar.h" |
||
62 | #include "ui/prefs_keyboardshortcuts.h" |
||
63 | |||
17986 | craig | 64 | extern ScribusQApp* ScQApp; |
2859 | cbradney | 65 | extern bool emergencyActivated; |
2835 | cbradney | 66 | |
2834 | cbradney | 67 | PrefsManager* PrefsManager::_instance = 0; |
68 | |||
10427 | cbradney | 69 | PrefsManager::PrefsManager(QObject *parent) |
13482 | cbradney | 70 | : QObject(parent), |
71 | firstTimeIgnoreOldPrefs(false) |
||
2834 | cbradney | 72 | { |
73 | } |
||
74 | |||
75 | PrefsManager::~PrefsManager() |
||
76 | { |
||
13955 | cbradney | 77 | appPrefs.fontPrefs.AvailFonts.clear(); |
2856 | cbradney | 78 | delete prefsFile; |
2834 | cbradney | 79 | } |
80 | |||
81 | PrefsManager* PrefsManager::instance() |
||
82 | { |
||
14043 | jghali | 83 | if (_instance == 0) |
84 | _instance = new PrefsManager(); |
||
2834 | cbradney | 85 | |
14043 | jghali | 86 | return _instance; |
2834 | cbradney | 87 | } |
88 | |||
89 | void PrefsManager::deleteInstance() |
||
90 | { |
||
14043 | jghali | 91 | if (_instance) |
92 | delete _instance; |
||
93 | _instance = 0; |
||
2834 | cbradney | 94 | } |
95 | |||
96 | |||
97 | ApplicationPrefs* PrefsManager::applicationPrefs() |
||
98 | { |
||
99 | return &appPrefs; |
||
100 | } |
||
2835 | cbradney | 101 | |
14046 | cbradney | 102 | void PrefsManager::setNewPrefs(ApplicationPrefs& newPrefs) |
103 | { |
||
104 | appPrefs=newPrefs; |
||
105 | } |
||
106 | |||
2856 | cbradney | 107 | PrefsFile* PrefsManager::applicationPrefsFile() |
108 | { |
||
109 | return prefsFile; |
||
110 | } |
||
111 | |||
10509 | cbradney | 112 | bool PrefsManager::importingFrom12x() |
2856 | cbradney | 113 | { |
114 | return importingFrom12; |
||
115 | } |
||
116 | |||
117 | |||
118 | void PrefsManager::setup() |
||
119 | { |
||
120 | setupPreferencesLocation(); |
||
121 | |||
5200 | cbradney | 122 | importingFrom12=copyOldPreferences(); |
13608 | jghali | 123 | prefsFile = new PrefsFile( prefsLocation + "/prefs150.xml" ); |
2856 | cbradney | 124 | if (importingFrom12) |
125 | convert12Preferences(); |
||
126 | //<<CB TODO Reset keyboard shortcuts of all 1.3 users as too many |
||
16357 | petr | 127 | // have conflicts if they dont nuke their settings. |
2856 | cbradney | 128 | // - Remove for 1.3.0 release: importingFrom12=true; |
129 | //>>CB |
||
130 | } |
||
131 | |||
2835 | cbradney | 132 | void PrefsManager::initDefaults() |
133 | { |
||
134 | /** Default font and size **/ |
||
13955 | cbradney | 135 | SCFontsIterator it(appPrefs.fontPrefs.AvailFonts); |
4221 | fschmid | 136 | bool goodFont = false; |
13955 | cbradney | 137 | for ( SCFontsIterator itf(appPrefs.fontPrefs.AvailFonts); itf.hasNext(); itf.next()) |
4221 | fschmid | 138 | { |
139 | if ((itf.currentKey() == "Arial Regular") || (itf.currentKey() == "Times New Roman Regular")) |
||
140 | { |
||
13996 | cbradney | 141 | appPrefs.itemToolPrefs.textFont = itf.currentKey(); |
4221 | fschmid | 142 | goodFont = true; |
143 | break; |
||
144 | } |
||
145 | } |
||
146 | if (!goodFont) |
||
13996 | cbradney | 147 | appPrefs.itemToolPrefs.textFont = it.currentKey(); |
148 | appPrefs.itemToolPrefs.textSize = 120; |
||
2835 | cbradney | 149 | |
150 | /** Default colours **/ |
||
16016 | fschmid | 151 | appPrefs.defaultPatterns.clear(); |
14150 | fschmid | 152 | appPrefs.defaultGradients.clear(); |
13967 | cbradney | 153 | appPrefs.colorPrefs.DColors.clear(); |
14043 | jghali | 154 | |
4606 | cbradney | 155 | ColorSetManager csm; |
156 | csm.initialiseDefaultPrefs(appPrefs); |
||
2835 | cbradney | 157 | |
19584 | jghali | 158 | appPrefs.uiPrefs.mouseMoveTimeout = 150; |
13876 | cbradney | 159 | appPrefs.uiPrefs.wheelJump = 40; |
19584 | jghali | 160 | appPrefs.uiPrefs.style = ""; |
3641 | fschmid | 161 | /** Set Default window position and size to sane default values which should work on every screen */ |
13955 | cbradney | 162 | // appPrefs.uiPrefs.mainWinSettings.xPosition = 0; |
163 | // appPrefs.uiPrefs.mainWinSettings.yPosition = 0; |
||
164 | appPrefs.uiPrefs.mainWinSettings.width = 640; |
||
165 | appPrefs.uiPrefs.mainWinSettings.height = 480; |
||
13050 | cbradney | 166 | QDesktopWidget *d = QApplication::desktop(); |
13955 | cbradney | 167 | appPrefs.uiPrefs.mainWinSettings.xPosition=(d->availableGeometry().width()-appPrefs.uiPrefs.mainWinSettings.width)/2; |
168 | appPrefs.uiPrefs.mainWinSettings.yPosition=(d->availableGeometry().height()-appPrefs.uiPrefs.mainWinSettings.height)/2; |
||
169 | appPrefs.uiPrefs.mainWinSettings.maximized = false; |
||
170 | appPrefs.uiPrefs.mainWinState = QByteArray(); |
||
19584 | jghali | 171 | appPrefs.uiPrefs.RecentDocs.clear(); |
172 | appPrefs.uiPrefs.recentDocCount = 5; |
||
173 | appPrefs.uiPrefs.showStartupDialog = true; |
||
174 | appPrefs.uiPrefs.showSplashOnStartup = true; |
||
175 | appPrefs.uiPrefs.useSmallWidgets = false; |
||
176 | appPrefs.uiPrefs.useTabs = false; |
||
177 | appPrefs.uiPrefs.stickyTools = false; |
||
178 | appPrefs.uiPrefs.grayscaleIcons = false; |
||
20160 | craig | 179 | appPrefs.uiPrefs.iconSet = "1_5_0"; |
13889 | cbradney | 180 | appPrefs.guidesPrefs.marginsShown = true; |
181 | appPrefs.guidesPrefs.framesShown = true; |
||
182 | appPrefs.guidesPrefs.layerMarkersShown = false; |
||
183 | appPrefs.guidesPrefs.gridShown = false; |
||
184 | appPrefs.guidesPrefs.guidesShown = true; |
||
185 | appPrefs.guidesPrefs.colBordersShown = true; |
||
186 | appPrefs.guidesPrefs.baselineGridShown = false; |
||
187 | appPrefs.guidesPrefs.showPic = true; |
||
188 | appPrefs.guidesPrefs.showControls = false; |
||
189 | appPrefs.guidesPrefs.linkShown = false; |
||
190 | appPrefs.guidesPrefs.rulersShown = true; |
||
191 | appPrefs.guidesPrefs.showBleed = true; |
||
192 | appPrefs.guidesPrefs.rulerMode = true; |
||
193 | appPrefs.guidesPrefs.grabRadius = 4; |
||
194 | appPrefs.guidesPrefs.guideRad = 10; |
||
195 | appPrefs.guidesPrefs.minorGridSpacing = 20; |
||
196 | appPrefs.guidesPrefs.majorGridSpacing = 100; |
||
197 | appPrefs.guidesPrefs.minorGridColor = QColor(Qt::green); |
||
198 | appPrefs.guidesPrefs.majorGridColor = QColor(Qt::green); |
||
199 | appPrefs.guidesPrefs.marginColor = QColor(Qt::blue); |
||
200 | appPrefs.guidesPrefs.guideColor = QColor(Qt::darkBlue); |
||
201 | appPrefs.guidesPrefs.baselineGridColor = QColor(Qt::lightGray); |
||
20290 | craig | 202 | appPrefs.guidesPrefs.renderStackOrder.clear(); |
16990 | fschmid | 203 | appPrefs.guidesPrefs.renderStackOrder << 0 << 1 << 2 << 3 << 4; |
16992 | fschmid | 204 | appPrefs.guidesPrefs.gridType = 0; |
13953 | cbradney | 205 | appPrefs.typoPrefs.valueSuperScript = 33; |
206 | appPrefs.typoPrefs.scalingSuperScript = 66; |
||
207 | appPrefs.typoPrefs.valueSubScript = 33; |
||
208 | appPrefs.typoPrefs.scalingSubScript = 66; |
||
209 | appPrefs.typoPrefs.valueSmallCaps = 75; |
||
17223 | jghali | 210 | appPrefs.typoPrefs.autoLineSpacing = 100; |
13953 | cbradney | 211 | appPrefs.typoPrefs.valueUnderlinePos = -1; |
212 | appPrefs.typoPrefs.valueUnderlineWidth = -1; |
||
213 | appPrefs.typoPrefs.valueStrikeThruPos = -1; |
||
214 | appPrefs.typoPrefs.valueStrikeThruWidth = -1; |
||
13889 | cbradney | 215 | appPrefs.guidesPrefs.valueBaselineGrid = 14.4; |
216 | appPrefs.guidesPrefs.offsetBaselineGrid = 0.0; |
||
13955 | cbradney | 217 | appPrefs.displayPrefs.showToolTips = true; |
218 | appPrefs.displayPrefs.showMouseCoordinates = true; |
||
2835 | cbradney | 219 | //FIXME |
220 | //Black here causes issues when a colour set is loaded without "Black" in it. |
||
221 | //"Black" is created with wrong values. Eg SVG colour set |
||
14014 | cbradney | 222 | appPrefs.itemToolPrefs.shapeLineColor = "Black"; |
15187 | cbradney | 223 | appPrefs.itemToolPrefs.shapeFillColor = CommonStrings::None; |
14014 | cbradney | 224 | appPrefs.itemToolPrefs.shapeLineColorShade = 100; |
225 | appPrefs.itemToolPrefs.shapeFillColorShade = 100; |
||
226 | appPrefs.itemToolPrefs.shapeLineStyle = Qt::SolidLine; |
||
15187 | cbradney | 227 | appPrefs.itemToolPrefs.shapeLineWidth = 1; |
13996 | cbradney | 228 | appPrefs.itemToolPrefs.lineColor = "Black"; |
229 | appPrefs.itemToolPrefs.textColor = "Black"; |
||
230 | appPrefs.itemToolPrefs.textStrokeColor = "Black"; |
||
14014 | cbradney | 231 | appPrefs.itemToolPrefs.textFillColor = CommonStrings::None; |
13996 | cbradney | 232 | appPrefs.itemToolPrefs.textLineColor = CommonStrings::None; |
14014 | cbradney | 233 | appPrefs.itemToolPrefs.textFillColorShade = 100; |
234 | appPrefs.itemToolPrefs.textLineColorShade = 100; |
||
13996 | cbradney | 235 | appPrefs.itemToolPrefs.textShade = 100; |
236 | appPrefs.itemToolPrefs.textStrokeShade = 100; |
||
237 | appPrefs.itemToolPrefs.textTabFillChar = ""; |
||
238 | appPrefs.itemToolPrefs.textTabWidth = 36.0; |
||
15847 | fschmid | 239 | // defaults for calligraphic pen |
19378 | craig | 240 | appPrefs.itemToolPrefs.calligraphicPenFillColor = "Black"; |
241 | appPrefs.itemToolPrefs.calligraphicPenLineColor = "Black"; |
||
242 | appPrefs.itemToolPrefs.calligraphicPenFillColorShade = 100; |
||
243 | appPrefs.itemToolPrefs.calligraphicPenLineColorShade = 100; |
||
244 | appPrefs.itemToolPrefs.calligraphicPenLineWidth = 1.0; |
||
245 | appPrefs.itemToolPrefs.calligraphicPenAngle = 0.0; |
||
246 | appPrefs.itemToolPrefs.calligraphicPenWidth = 10.0; |
||
247 | appPrefs.itemToolPrefs.calligraphicPenStyle = Qt::SolidLine; |
||
15847 | fschmid | 248 | |
13953 | cbradney | 249 | appPrefs.opToolPrefs.dispX = 10.0; |
250 | appPrefs.opToolPrefs.dispY = 10.0; |
||
251 | appPrefs.opToolPrefs.constrain = 15.0; |
||
13974 | cbradney | 252 | appPrefs.displayPrefs.paperColor = QColor(Qt::white); |
15139 | cbradney | 253 | appPrefs.displayPrefs.scratchColor = qApp->palette().color(QPalette::Active, QPalette::Window); |
13955 | cbradney | 254 | appPrefs.displayPrefs.showPageShadow = true; |
14811 | cbradney | 255 | appPrefs.displayPrefs.showVerifierWarningsOnCanvas = true; |
17805 | fschmid | 256 | appPrefs.displayPrefs.showAutosaveClockOnCanvas = false; |
13974 | cbradney | 257 | appPrefs.displayPrefs.frameColor = QColor(Qt::red); |
258 | appPrefs.displayPrefs.frameNormColor = QColor(Qt::black); |
||
259 | appPrefs.displayPrefs.frameGroupColor = QColor(Qt::darkCyan); |
||
260 | appPrefs.displayPrefs.frameLockColor = QColor(Qt::darkRed); |
||
261 | appPrefs.displayPrefs.frameLinkColor = QColor(Qt::red); |
||
262 | appPrefs.displayPrefs.frameAnnotationColor = QColor(Qt::blue); |
||
263 | appPrefs.displayPrefs.pageBorderColor = QColor(Qt::red); |
||
264 | appPrefs.displayPrefs.controlCharColor = QColor(Qt::darkRed); |
||
13996 | cbradney | 265 | appPrefs.itemToolPrefs.textColumns = 1; |
266 | appPrefs.itemToolPrefs.textColumnGap = 0.0; |
||
14014 | cbradney | 267 | appPrefs.itemToolPrefs.lineColorShade = 100; |
13996 | cbradney | 268 | appPrefs.itemToolPrefs.lineStyle = Qt::SolidLine; |
269 | appPrefs.itemToolPrefs.lineWidth = 1; |
||
270 | appPrefs.itemToolPrefs.lineStartArrow = 0; |
||
271 | appPrefs.itemToolPrefs.lineEndArrow = 0; |
||
14730 | fschmid | 272 | appPrefs.opToolPrefs.magMin = 1; |
18963 | fschmid | 273 | appPrefs.opToolPrefs.magMax = 32000; |
17747 | craig | 274 | appPrefs.opToolPrefs.magStep = 25; |
19758 | fschmid | 275 | // qDebug()<<ScQApp->currGUILanguage(); |
17995 | craig | 276 | appPrefs.docSetupPrefs.docUnitIndex = unitIndexFromString(LocaleManager::instance()->unitForLocale(ScQApp->currGUILanguage())); |
13996 | cbradney | 277 | appPrefs.itemToolPrefs.polyCorners = 4; |
14022 | cbradney | 278 | appPrefs.itemToolPrefs.polyFactor = 0.5; |
13996 | cbradney | 279 | appPrefs.itemToolPrefs.polyUseFactor = false; |
280 | appPrefs.itemToolPrefs.polyRotation = 0.0; |
||
16191 | fschmid | 281 | appPrefs.itemToolPrefs.polyInnerRot = 0.0; |
13953 | cbradney | 282 | appPrefs.itemToolPrefs.polyCurvature = 0.0; |
16192 | fschmid | 283 | appPrefs.itemToolPrefs.polyOuterCurvature = 0.0; |
16215 | fschmid | 284 | appPrefs.itemToolPrefs.arcStartAngle = 30.0; |
285 | appPrefs.itemToolPrefs.arcSweepAngle = 300.0; |
||
16311 | fschmid | 286 | appPrefs.itemToolPrefs.spiralStartAngle = 0.0; |
287 | appPrefs.itemToolPrefs.spiralEndAngle = 1080.0; |
||
288 | appPrefs.itemToolPrefs.spiralFactor = 1.2; |
||
17054 | fschmid | 289 | // Image item prefs |
290 | appPrefs.itemToolPrefs.imageFillColor = CommonStrings::None; |
||
291 | appPrefs.itemToolPrefs.imageFillColorShade = 100; |
||
292 | appPrefs.itemToolPrefs.imageStrokeColor = CommonStrings::None; |
||
293 | appPrefs.itemToolPrefs.imageStrokeColorShade = 100; |
||
294 | appPrefs.itemToolPrefs.imageScaleX = 1; |
||
295 | appPrefs.itemToolPrefs.imageScaleY = 1; |
||
296 | appPrefs.itemToolPrefs.imageScaleType = true; |
||
297 | appPrefs.itemToolPrefs.imageAspectRatio = true; |
||
298 | appPrefs.itemToolPrefs.imageLowResType = 1; |
||
299 | appPrefs.itemToolPrefs.imageUseEmbeddedPath = false; |
||
4649 | fschmid | 300 | // appPrefs.PSize = 40; |
13955 | cbradney | 301 | appPrefs.printerPrefs.ClipMargin = false; |
13967 | cbradney | 302 | appPrefs.printerPrefs.GCRMode = false; |
13955 | cbradney | 303 | appPrefs.scrapbookPrefs.RecentScrapbooks.clear(); |
304 | appPrefs.scrapbookPrefs.doCopyToScrapbook = true; |
||
305 | appPrefs.scrapbookPrefs.persistentScrapbook = false; |
||
14715 | fschmid | 306 | appPrefs.scrapbookPrefs.writePreviews = true; |
13955 | cbradney | 307 | appPrefs.scrapbookPrefs.numScrapbookCopies = 10; |
308 | appPrefs.displayPrefs.marginColored = false; |
||
17995 | craig | 309 | appPrefs.docSetupPrefs.pageSize = LocaleManager::instance()->pageSizeForLocale(ScQApp->currGUILanguage()); |
13876 | cbradney | 310 | appPrefs.docSetupPrefs.pageOrientation = 0; |
17986 | craig | 311 | PageSize defaultPageSize(appPrefs.docSetupPrefs.pageSize); |
312 | appPrefs.docSetupPrefs.pageWidth = defaultPageSize.width(); |
||
313 | appPrefs.docSetupPrefs.pageHeight = defaultPageSize.height(); |
||
19831 | craig | 314 | appPrefs.docSetupPrefs.margins.set(40, 40, 40, 40); |
13876 | cbradney | 315 | appPrefs.docSetupPrefs.marginPreset = 0; |
19831 | craig | 316 | appPrefs.docSetupPrefs.bleeds.set(0, 0, 0, 0); |
13955 | cbradney | 317 | appPrefs.hyphPrefs.MinWordLen = 3; |
318 | appPrefs.hyphPrefs.HyCount = 2; |
||
17766 | jghali | 319 | appPrefs.hyphPrefs.Language = "en_GB"; |
13955 | cbradney | 320 | appPrefs.hyphPrefs.specialWords.clear(); |
321 | appPrefs.hyphPrefs.ignoredWords.clear(); |
||
322 | appPrefs.hyphPrefs.Automatic = true; |
||
323 | appPrefs.hyphPrefs.AutoCheck = false; |
||
13967 | cbradney | 324 | appPrefs.docSetupPrefs.AutoSave = true; |
325 | appPrefs.docSetupPrefs.AutoSaveTime = 600000; |
||
14764 | cbradney | 326 | appPrefs.docSetupPrefs.saveCompressed = false; |
12109 | fschmid | 327 | int dpi = qApp->desktop()->logicalDpiX(); |
328 | if ((dpi < 60) || (dpi > 200)) |
||
329 | dpi = 72; |
||
13974 | cbradney | 330 | appPrefs.displayPrefs.displayScale = dpi / 72.0; |
12109 | fschmid | 331 | |
13876 | cbradney | 332 | appPrefs.pathPrefs.documents = ScPaths::getUserDocumentDir(); |
333 | appPrefs.pathPrefs.colorProfiles = ""; |
||
334 | appPrefs.pathPrefs.scripts = ""; |
||
335 | appPrefs.pathPrefs.documentTemplates = ""; |
||
13967 | cbradney | 336 | appPrefs.printPreviewPrefs.PrPr_Mode = false; |
337 | //appPrefs.Gcr_Mode = true; |
||
338 | appPrefs.printPreviewPrefs.PrPr_AntiAliasing = false; |
||
339 | appPrefs.printPreviewPrefs.PrPr_Transparency = false; |
||
340 | appPrefs.printPreviewPrefs.PrPr_C = true; |
||
341 | appPrefs.printPreviewPrefs.PrPr_M = true; |
||
342 | appPrefs.printPreviewPrefs.PrPr_Y = true; |
||
343 | appPrefs.printPreviewPrefs.PrPr_K = true; |
||
344 | appPrefs.printPreviewPrefs.PrPr_InkCoverage = false; |
||
345 | appPrefs.printPreviewPrefs.PrPr_InkThreshold = 250; |
||
13955 | cbradney | 346 | appPrefs.extToolPrefs.imageEditorExecutable = "gimp"; |
347 | appPrefs.extToolPrefs.extBrowserExecutable = ""; |
||
13957 | herm | 348 | appPrefs.extToolPrefs.uniconvExecutable = "uniconv"; |
13955 | cbradney | 349 | appPrefs.extToolPrefs.latexConfigs = LatexConfigCache::defaultConfigs(); |
15439 | craig | 350 | appPrefs.extToolPrefs.latexCommands = LatexConfigCache::defaultCommands(); |
13955 | cbradney | 351 | appPrefs.extToolPrefs.latexEditorExecutable = ""; |
352 | appPrefs.extToolPrefs.latexResolution = 72; |
||
353 | appPrefs.extToolPrefs.latexForceDpi = true; |
||
354 | appPrefs.extToolPrefs.latexStartWithEmptyFrames = false; |
||
355 | appPrefs.extToolPrefs.gs_AntiAliasGraphics = true; |
||
356 | appPrefs.extToolPrefs.gs_AntiAliasText = true; |
||
357 | appPrefs.extToolPrefs.gs_exe = getGSDefaultExeName(); |
||
358 | appPrefs.extToolPrefs.gs_Resolution = 72; |
||
14823 | cbradney | 359 | appPrefs.storyEditorPrefs.guiFontColorBackground = QColor(Qt::white); |
360 | appPrefs.storyEditorPrefs.smartTextSelection=false; |
||
13967 | cbradney | 361 | appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile = ""; |
362 | appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile = ""; |
||
363 | appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile = ""; |
||
364 | appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile = ""; |
||
365 | appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile = ""; |
||
366 | appPrefs.colorPrefs.DCMSset.CMSinUse = false; |
||
367 | appPrefs.colorPrefs.DCMSset.SoftProofOn = false; |
||
368 | appPrefs.colorPrefs.DCMSset.SoftProofFullOn = false; |
||
369 | appPrefs.colorPrefs.DCMSset.GamutCheck = false; |
||
370 | appPrefs.colorPrefs.DCMSset.BlackPoint = true; |
||
14170 | jghali | 371 | appPrefs.colorPrefs.DCMSset.DefaultIntentColors = Intent_Relative_Colorimetric; |
372 | appPrefs.colorPrefs.DCMSset.DefaultIntentImages = Intent_Perceptual; |
||
13967 | cbradney | 373 | appPrefs.fontPrefs.GFontSub.clear(); |
19831 | craig | 374 | appPrefs.displayPrefs.scratch.setLeft(100); |
375 | appPrefs.displayPrefs.scratch.setRight(100); |
||
376 | appPrefs.displayPrefs.scratch.setTop(20); |
||
377 | appPrefs.displayPrefs.scratch.setBottom(20); |
||
13974 | cbradney | 378 | appPrefs.displayPrefs.pageGapHorizontal = 0.0; |
379 | appPrefs.displayPrefs.pageGapVertical = 40.0; |
||
3016 | fschmid | 380 | struct PageSet pageS; |
4538 | cbradney | 381 | pageS.Name = CommonStrings::pageSet1; |
3016 | fschmid | 382 | pageS.FirstPage = 0; |
383 | pageS.Rows = 1; |
||
384 | pageS.Columns = 1; |
||
3026 | fschmid | 385 | pageS.pageNames.clear(); |
3016 | fschmid | 386 | appPrefs.pageSets.append(pageS); |
4538 | cbradney | 387 | pageS.Name = CommonStrings::pageSet2; |
3016 | fschmid | 388 | pageS.FirstPage = 1; |
389 | pageS.Columns = 2; |
||
3026 | fschmid | 390 | pageS.pageNames.clear(); |
4538 | cbradney | 391 | pageS.pageNames.append(CommonStrings::pageLocLeft); |
392 | pageS.pageNames.append(CommonStrings::pageLocRight); |
||
3016 | fschmid | 393 | appPrefs.pageSets.append(pageS); |
4538 | cbradney | 394 | pageS.Name = CommonStrings::pageSet3; |
3016 | fschmid | 395 | pageS.FirstPage = 0; |
396 | pageS.Columns = 3; |
||
3026 | fschmid | 397 | pageS.pageNames.clear(); |
4538 | cbradney | 398 | pageS.pageNames.append(CommonStrings::pageLocLeft); |
399 | pageS.pageNames.append(CommonStrings::pageLocMiddle); |
||
400 | pageS.pageNames.append(CommonStrings::pageLocRight); |
||
3016 | fschmid | 401 | appPrefs.pageSets.append(pageS); |
4538 | cbradney | 402 | pageS.Name = CommonStrings::pageSet4; |
3016 | fschmid | 403 | pageS.FirstPage = 0; |
404 | pageS.Columns = 4; |
||
3026 | fschmid | 405 | pageS.pageNames.clear(); |
4538 | cbradney | 406 | pageS.pageNames.append(CommonStrings::pageLocLeft); |
407 | pageS.pageNames.append(CommonStrings::pageLocMiddleLeft); |
||
408 | pageS.pageNames.append(CommonStrings::pageLocMiddleRight); |
||
409 | pageS.pageNames.append(CommonStrings::pageLocRight); |
||
3016 | fschmid | 410 | appPrefs.pageSets.append(pageS); |
13876 | cbradney | 411 | appPrefs.docSetupPrefs.pagePositioning = singlePage; |
13955 | cbradney | 412 | appPrefs.fontPrefs.askBeforeSubstitute = true; |
413 | appPrefs.miscPrefs.haveStylePreview = true; |
||
2835 | cbradney | 414 | // lorem ipsum defaults |
13955 | cbradney | 415 | appPrefs.miscPrefs.useStandardLI = false; |
416 | appPrefs.miscPrefs.paragraphsLI = 10; |
||
14849 | cbradney | 417 | initDefaultCheckerPrefs(&appPrefs.verifierPrefs.checkerPrefsList); |
418 | appPrefs.verifierPrefs.curCheckProfile = CommonStrings::PostScript; |
||
419 | appPrefs.verifierPrefs.showPagesWithoutErrors=false; |
||
14850 | cbradney | 420 | appPrefs.verifierPrefs.showNonPrintingLayerErrors=false; |
13955 | cbradney | 421 | appPrefs.pdfPrefs.Thumbnails = false; |
422 | appPrefs.pdfPrefs.Articles = false; |
||
423 | appPrefs.pdfPrefs.useLayers = false; |
||
424 | appPrefs.pdfPrefs.Compress = true; |
||
425 | appPrefs.pdfPrefs.CompressMethod = PDFOptions::Compression_Auto; |
||
426 | appPrefs.pdfPrefs.Quality = 0; |
||
427 | appPrefs.pdfPrefs.RecalcPic = false; |
||
428 | appPrefs.pdfPrefs.embedPDF = false; |
||
429 | appPrefs.pdfPrefs.Bookmarks = false; |
||
430 | appPrefs.pdfPrefs.PicRes = 300; |
||
431 | appPrefs.pdfPrefs.Version = PDFOptions::PDFVersion_14; |
||
432 | appPrefs.pdfPrefs.Resolution = 300; |
||
433 | appPrefs.pdfPrefs.Binding = 0; |
||
20122 | jghali | 434 | appPrefs.pdfPrefs.FontEmbedding = PDFOptions::EmbedFonts; |
13955 | cbradney | 435 | appPrefs.pdfPrefs.EmbedList.clear(); |
436 | appPrefs.pdfPrefs.SubsetList.clear(); |
||
437 | appPrefs.pdfPrefs.MirrorH = false; |
||
438 | appPrefs.pdfPrefs.MirrorV = false; |
||
439 | appPrefs.pdfPrefs.doClip = false; |
||
17925 | fschmid | 440 | appPrefs.pdfPrefs.pageRangeSelection = 0; |
441 | appPrefs.pdfPrefs.pageRangeString = ""; |
||
13955 | cbradney | 442 | appPrefs.pdfPrefs.RotateDeg = 0; |
443 | appPrefs.pdfPrefs.PresentMode = false; |
||
444 | appPrefs.pdfPrefs.fileName = ""; |
||
445 | appPrefs.pdfPrefs.isGrayscale = false; |
||
446 | appPrefs.pdfPrefs.UseRGB = true; |
||
447 | appPrefs.pdfPrefs.UseProfiles = false; |
||
448 | appPrefs.pdfPrefs.UseProfiles2 = false; |
||
449 | appPrefs.pdfPrefs.SolidProf = ""; |
||
450 | appPrefs.pdfPrefs.SComp = 3; |
||
451 | appPrefs.pdfPrefs.ImageProf = ""; |
||
452 | appPrefs.pdfPrefs.PrintProf = ""; |
||
453 | appPrefs.pdfPrefs.Info = ""; |
||
454 | appPrefs.pdfPrefs.Intent = 0; |
||
455 | appPrefs.pdfPrefs.Intent2 = 0; |
||
19831 | craig | 456 | appPrefs.pdfPrefs.bleeds.set(0, 0, 0, 0); |
13955 | cbradney | 457 | appPrefs.pdfPrefs.useDocBleeds = true; |
458 | appPrefs.pdfPrefs.cropMarks = false; |
||
459 | appPrefs.pdfPrefs.bleedMarks = false; |
||
460 | appPrefs.pdfPrefs.registrationMarks = false; |
||
461 | appPrefs.pdfPrefs.colorMarks = false; |
||
462 | appPrefs.pdfPrefs.docInfoMarks = false; |
||
17401 | jghali | 463 | appPrefs.pdfPrefs.markLength = 20; |
13955 | cbradney | 464 | appPrefs.pdfPrefs.markOffset = 0; |
465 | appPrefs.pdfPrefs.EmbeddedI = false; |
||
466 | appPrefs.pdfPrefs.Encrypt = false; |
||
467 | appPrefs.pdfPrefs.PassOwner = ""; |
||
468 | appPrefs.pdfPrefs.PassUser = ""; |
||
469 | appPrefs.pdfPrefs.Permissions = -4; |
||
470 | appPrefs.pdfPrefs.UseLPI = false; |
||
471 | appPrefs.pdfPrefs.LPISettings.clear(); |
||
472 | appPrefs.pdfPrefs.UseSpotColors = true; |
||
473 | appPrefs.pdfPrefs.doMultiFile = false; |
||
474 | appPrefs.pdfPrefs.displayBookmarks = false; |
||
475 | appPrefs.pdfPrefs.displayFullscreen = false; |
||
476 | appPrefs.pdfPrefs.displayLayers = false; |
||
477 | appPrefs.pdfPrefs.displayThumbs = false; |
||
478 | appPrefs.pdfPrefs.hideMenuBar = false; |
||
479 | appPrefs.pdfPrefs.hideToolBar = false; |
||
480 | appPrefs.pdfPrefs.fitWindow = false; |
||
16204 | fschmid | 481 | appPrefs.pdfPrefs.openAfterExport = false; |
13955 | cbradney | 482 | appPrefs.pdfPrefs.PageLayout = PDFOptions::SinglePage; |
483 | appPrefs.pdfPrefs.openAction = ""; |
||
14539 | jghali | 484 | appPrefs.imageCachePrefs.cacheEnabled = false; |
485 | appPrefs.imageCachePrefs.maxCacheSizeMiB = 1000; |
||
486 | appPrefs.imageCachePrefs.maxCacheEntries = 1000; |
||
487 | appPrefs.imageCachePrefs.compressionLevel = 1; |
||
15105 | cbradney | 488 | appPrefs.activePageSizes.clear(); |
489 | appPrefs.activePageSizes << "A4" << "Letter"; |
||
2835 | cbradney | 490 | |
491 | //Attribute setup |
||
13955 | cbradney | 492 | appPrefs.itemAttrPrefs.defaultItemAttributes.clear(); |
493 | appPrefs.tocPrefs.defaultToCSetups.clear(); |
||
14043 | jghali | 494 | |
5243 | cbradney | 495 | initDefaultActionKeys(); |
2835 | cbradney | 496 | } |
497 | |||
5243 | cbradney | 498 | void PrefsManager::initDefaultActionKeys() |
499 | { |
||
500 | ActionManager::createDefaultShortcuts(); |
||
5257 | cbradney | 501 | QMap<QString, QKeySequence > *map=ActionManager::defaultShortcuts(); |
5243 | cbradney | 502 | for( QMap<QString, QKeySequence >::ConstIterator it = map->begin(); it!=map->end(); ++it ) |
503 | { |
||
13955 | cbradney | 504 | appPrefs.keyShortcutPrefs.KeyActions[it.key()].actionName = it.key(); |
505 | appPrefs.keyShortcutPrefs.KeyActions[it.key()].keySequence = it.value(); |
||
5243 | cbradney | 506 | } |
507 | } |
||
508 | |||
10977 | cbradney | 509 | void PrefsManager::applyLoadedShortCuts() |
510 | { |
||
13955 | cbradney | 511 | for (QMap<QString,Keys>::Iterator it = appPrefs.keyShortcutPrefs.KeyActions.begin(); it != appPrefs.keyShortcutPrefs.KeyActions.end(); ++it ) |
10977 | cbradney | 512 | { |
513 | if (!it.value().actionName.isEmpty()) |
||
514 | { |
||
515 | if (ScCore->primaryMainWindow()->scrActions[it.value().actionName]) |
||
17723 | craig | 516 | { |
10977 | cbradney | 517 | ScCore->primaryMainWindow()->scrActions[it.value().actionName]->setShortcut(it.value().keySequence); |
17723 | craig | 518 | ScCore->primaryMainWindow()->scrActions[it.value().actionName]->setToolTipFromTextAndShortcut(); |
519 | } |
||
10977 | cbradney | 520 | } |
521 | } |
||
522 | } |
||
523 | |||
2835 | cbradney | 524 | void PrefsManager::initDefaultGUIFont(const QFont& guiFont) |
525 | { |
||
13876 | cbradney | 526 | appPrefs.uiPrefs.applicationFontSize = guiFont.pointSize(); |
13996 | cbradney | 527 | appPrefs.storyEditorPrefs.guiFont = guiFont.toString(); |
13876 | cbradney | 528 | appPrefs.uiPrefs.paletteFontSize = appPrefs.uiPrefs.applicationFontSize; |
2835 | cbradney | 529 | } |
530 | |||
531 | void PrefsManager::initArrowStyles() |
||
532 | { |
||
533 | struct ArrowDesc arrow; |
||
534 | FPointArray points; |
||
13951 | fschmid | 535 | QTransform arrowScaling; |
2835 | cbradney | 536 | arrowScaling.scale(0.5, 0.5); |
13951 | fschmid | 537 | QTransform arrowRotate; |
11176 | fschmid | 538 | arrowRotate.rotate(180); |
2835 | cbradney | 539 | arrow.name = "Arrow1L"; |
540 | arrow.userArrow = false; |
||
541 | points.addQuadPoint(0, 0, 0, 0, 0, 0, 0, 0); |
||
542 | points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5); |
||
543 | points.addQuadPoint(12, 0, 12, 0, 12, 0, 12, 0); |
||
544 | points.addQuadPoint(-5, 5, -5, 5, -5, 5, -5, 5); |
||
545 | points.addQuadPoint(0, 0, 0, 0, 0, 0, 0, 0); |
||
546 | arrow.points = points.copy(); |
||
547 | appPrefs.arrowStyles.append(arrow); |
||
548 | arrow.name = "Arrow1M"; |
||
549 | points.map(arrowScaling); |
||
550 | arrow.points = points.copy(); |
||
551 | appPrefs.arrowStyles.append(arrow); |
||
552 | arrow.name = "Arrow1S"; |
||
553 | points.map(arrowScaling); |
||
554 | arrow.points = points.copy(); |
||
555 | appPrefs.arrowStyles.append(arrow); |
||
556 | arrow.name = "SquareL"; |
||
557 | points.resize(0); |
||
558 | points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5); |
||
559 | points.addQuadPoint(5, -5, 5, -5, 5, -5, 5, -5); |
||
560 | points.addQuadPoint(5, 5, 5, 5, 5, 5, 5, 5); |
||
561 | points.addQuadPoint(-5, 5, -5, 5, -5, 5, -5, 5); |
||
562 | points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5); |
||
563 | arrow.points = points.copy(); |
||
564 | appPrefs.arrowStyles.append(arrow); |
||
565 | arrow.name = "SquareM"; |
||
566 | points.map(arrowScaling); |
||
567 | arrow.points = points.copy(); |
||
568 | appPrefs.arrowStyles.append(arrow); |
||
569 | arrow.name = "SquareS"; |
||
570 | points.map(arrowScaling); |
||
571 | arrow.points = points.copy(); |
||
572 | appPrefs.arrowStyles.append(arrow); |
||
573 | arrow.name = "TriangleInL"; |
||
574 | points.resize(0); |
||
575 | points.addQuadPoint(5.77, 0, 5.77, 0, 5.77, 0, 5.77, 0); |
||
576 | points.addQuadPoint(-2.88, 5, -2.88, 5, -2.88, 5, -2.88, 5); |
||
577 | points.addQuadPoint(-2.88, -5, -2.88, -5, -2.88, -5, -2.88, -5); |
||
578 | points.addQuadPoint(5.77, 0, 5.77, 0, 5.77, 0, 5.77, 0); |
||
579 | arrow.points = points.copy(); |
||
580 | appPrefs.arrowStyles.append(arrow); |
||
581 | arrow.name = "TriangleInM"; |
||
582 | points.map(arrowScaling); |
||
583 | arrow.points = points.copy(); |
||
584 | appPrefs.arrowStyles.append(arrow); |
||
585 | arrow.name = "TriangleInS"; |
||
586 | points.map(arrowScaling); |
||
587 | arrow.points = points.copy(); |
||
588 | appPrefs.arrowStyles.append(arrow); |
||
589 | arrow.name = "TriangleOutL"; |
||
590 | points.resize(0); |
||
591 | points.addQuadPoint(-5.77, 0, -5.77, 0, -5.77, 0, -5.77, 0); |
||
592 | points.addQuadPoint(2.88, 5, 2.88, 5, 2.88, 5, 2.88, 5); |
||
593 | points.addQuadPoint(2.88, -5, 2.88, -5, 2.88, -5, 2.88, -5); |
||
594 | points.addQuadPoint(-5.77, 0, -5.77, 0, -5.77, 0, -5.77, 0); |
||
595 | arrow.points = points.copy(); |
||
596 | appPrefs.arrowStyles.append(arrow); |
||
597 | arrow.name = "TriangleOutM"; |
||
598 | points.map(arrowScaling); |
||
599 | arrow.points = points.copy(); |
||
600 | appPrefs.arrowStyles.append(arrow); |
||
601 | arrow.name = "TriangleOutS"; |
||
602 | points.map(arrowScaling); |
||
603 | arrow.points = points.copy(); |
||
604 | appPrefs.arrowStyles.append(arrow); |
||
11176 | fschmid | 605 | arrow.name = "DiamondL"; |
606 | points.resize(0); |
||
607 | points.parseSVG("M 0, -7.0710768 L -7.0710894, 0 L 0, 7.0710589 L 7.0710462, 0 L 0,-7.0710768 z"); |
||
608 | arrow.points = points.copy(); |
||
609 | appPrefs.arrowStyles.append(arrow); |
||
610 | arrow.name = "DiamondM"; |
||
611 | points.map(arrowScaling); |
||
612 | arrow.points = points.copy(); |
||
613 | appPrefs.arrowStyles.append(arrow); |
||
614 | arrow.name = "DiamondS"; |
||
615 | points.map(arrowScaling); |
||
616 | arrow.points = points.copy(); |
||
617 | appPrefs.arrowStyles.append(arrow); |
||
618 | points.resize(0); |
||
619 | arrow.name = "DotL"; |
||
620 | points.parseSVG("M -2.5,-1.0 C -2.5,1.7600000 -4.7400000,4.0 -7.5,4.0 C -10.260000,4.0 -12.5,1.7600000 -12.5,-1.0 C -12.5,-3.7600000 -10.260000,-6.0 -7.5,-6.0 C -4.7400000,-6.0 -2.5,-3.7600000 -2.5,-1.0 z"); |
||
621 | points.translate(7.4, 1.0); |
||
622 | arrow.points = points.copy(); |
||
623 | appPrefs.arrowStyles.append(arrow); |
||
624 | arrow.name = "DotM"; |
||
625 | points.map(arrowScaling); |
||
626 | arrow.points = points.copy(); |
||
627 | appPrefs.arrowStyles.append(arrow); |
||
628 | arrow.name = "DotS"; |
||
629 | points.map(arrowScaling); |
||
630 | arrow.points = points.copy(); |
||
631 | appPrefs.arrowStyles.append(arrow); |
||
632 | points.resize(0); |
||
633 | arrow.name = "SemiCircleInL"; |
||
634 | points.parseSVG("M -0.37450702,-0.045692580 C -0.37450702,2.7143074 1.8654930,4.9543074 4.6254930,4.9543074 L 4.6254930,-5.0456926 C 1.8654930,-5.0456926 -0.37450702,-2.8056926 -0.37450702,-0.045692580 z"); |
||
635 | arrow.points = points.copy(); |
||
636 | appPrefs.arrowStyles.append(arrow); |
||
637 | arrow.name = "SemiCircleInM"; |
||
638 | points.map(arrowScaling); |
||
639 | arrow.points = points.copy(); |
||
640 | appPrefs.arrowStyles.append(arrow); |
||
641 | arrow.name = "SemiCircleInS"; |
||
642 | points.map(arrowScaling); |
||
643 | arrow.points = points.copy(); |
||
644 | appPrefs.arrowStyles.append(arrow); |
||
645 | points.resize(0); |
||
646 | arrow.name = "SemiCircleOutL"; |
||
647 | points.parseSVG("M -2.5,-0.80913858 C -2.5,1.9508614 -4.7400000,4.1908614 -7.5,4.1908614 L -7.5,-5.8091386 C -4.7400000,-5.8091386 -2.5,-3.5691386 -2.5,-0.80913858 z"); |
||
648 | points.translate(7.125493, 0.763446); |
||
649 | arrow.points = points.copy(); |
||
650 | appPrefs.arrowStyles.append(arrow); |
||
651 | arrow.name = "SemiCircleOutM"; |
||
652 | points.map(arrowScaling); |
||
653 | arrow.points = points.copy(); |
||
654 | appPrefs.arrowStyles.append(arrow); |
||
655 | arrow.name = "SemiCircleOutS"; |
||
656 | points.map(arrowScaling); |
||
657 | arrow.points = points.copy(); |
||
658 | appPrefs.arrowStyles.append(arrow); |
||
659 | points.resize(0); |
||
660 | arrow.name = "Arrow2L"; |
||
661 | points.parseSVG("M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z"); |
||
12116 | fschmid | 662 | points.translate(-6.0, -0.016013256); |
11176 | fschmid | 663 | points.map(arrowRotate); |
664 | arrow.points = points.copy(); |
||
665 | appPrefs.arrowStyles.append(arrow); |
||
666 | arrow.name = "Arrow2M"; |
||
667 | points.map(arrowScaling); |
||
668 | arrow.points = points.copy(); |
||
669 | appPrefs.arrowStyles.append(arrow); |
||
670 | arrow.name = "Arrow2S"; |
||
671 | points.map(arrowScaling); |
||
672 | arrow.points = points.copy(); |
||
673 | appPrefs.arrowStyles.append(arrow); |
||
674 | points.resize(0); |
||
675 | arrow.name = "ScissorsL"; |
||
676 | points.parseSVG("M 9.0898857,-3.6061018 C 8.1198849,-4.7769976 6.3697607,-4.7358294 5.0623558,-4.2327734 L -3.1500488,-1.1548705 C -5.5383421,-2.4615840 -7.8983361,-2.0874077 -7.8983361,-2.7236578 C -7.8983361,-3.2209742 -7.4416699,-3.1119800 -7.5100293,-4.4068519 C -7.5756648,-5.6501286 -8.8736064,-6.5699315 -10.100428,-6.4884954 C -11.327699,-6.4958500 -12.599867,-5.5553341 -12.610769,-4.2584343 C -12.702194,-2.9520479 -11.603560,-1.7387447 -10.304005,-1.6532027 C -8.7816644,-1.4265411 -6.0857470,-2.3487593 -4.8210600,-0.082342643 C -5.7633447,1.6559151 -7.4350844,1.6607341 -8.9465707,1.5737277 C -10.201445,1.5014928 -11.708664,1.8611256 -12.307219,3.0945882 C -12.885586,4.2766744 -12.318421,5.9591904 -10.990470,6.3210002 C -9.6502788,6.8128279 -7.8098011,6.1912892 -7.4910978,4.6502760 C -7.2454393,3.4624530 -8.0864637,2.9043186 -7.7636052,2.4731223 C -7.5199917,2.1477623 -5.9728246,2.3362771 -3.2164999,1.0982979 L 5.6763468,4.2330688 C 6.8000164,4.5467672 8.1730685,4.5362646 9.1684433,3.4313614 L -0.051640930,-0.053722219 L 9.0898857,-3.6061018 z M -9.2179159,-5.5066058 C -7.9233569,-4.7838060 -8.0290767,-2.8230356 -9.3743431,-2.4433169 C -10.590861,-2.0196559 -12.145370,-3.2022863 -11.757521,-4.5207817 C -11.530373,-5.6026336 -10.104134,-6.0014137 -9.2179159,-5.5066058 z M -9.1616516,2.5107591 C -7.8108215,3.0096239 -8.0402087,5.2951947 -9.4138723,5.6023681 C -10.324932,5.9187072 -11.627422,5.4635705 -11.719569,4.3902287 C -11.897178,3.0851737 -10.363484,1.9060805 -9.1616516,2.5107591 z"); |
||
677 | points.map(arrowRotate); |
||
678 | arrow.points = points.copy(); |
||
679 | appPrefs.arrowStyles.append(arrow); |
||
680 | arrow.name = "ScissorsM"; |
||
681 | points.map(arrowScaling); |
||
682 | arrow.points = points.copy(); |
||
683 | appPrefs.arrowStyles.append(arrow); |
||
684 | arrow.name = "ScissorsS"; |
||
685 | points.map(arrowScaling); |
||
686 | arrow.points = points.copy(); |
||
687 | appPrefs.arrowStyles.append(arrow); |
||
688 | points.resize(0); |
||
689 | arrow.name = "ClubL"; |
||
690 | points.parseSVG("M -1.5971367,-7.0977635 C -3.4863874,-7.0977635 -5.0235187,-5.5606321 -5.0235187,-3.6713813 C -5.0235187,-3.0147015 -4.7851656,-2.4444556 -4.4641095,-1.9232271 C -4.5028609,-1.8911157 -4.5437814,-1.8647646 -4.5806531,-1.8299921 C -5.2030765,-2.6849849 -6.1700514,-3.2751330 -7.3077730,-3.2751330 C -9.1970245,-3.2751331 -10.734155,-1.7380016 -10.734155,0.15124914 C -10.734155,2.0404999 -9.1970245,3.5776313 -7.3077730,3.5776313 C -6.3143268,3.5776313 -5.4391540,3.1355702 -4.8137404,2.4588126 C -4.9384274,2.8137041 -5.0235187,3.1803000 -5.0235187,3.5776313 C -5.0235187,5.4668819 -3.4863874,7.0040135 -1.5971367,7.0040135 C 0.29211394,7.0040135 1.8292454,5.4668819 1.8292454,3.5776313 C 1.8292454,2.7842354 1.5136868,2.0838028 1.0600576,1.5031550 C 2.4152718,1.7663868 3.7718375,2.2973711 4.7661444,3.8340272 C 4.0279463,3.0958289 3.5540908,1.7534117 3.5540908,-0.058529361 L 2.9247554,-0.10514681 L 3.5074733,-0.12845553 C 3.5074733,-1.9403966 3.9580199,-3.2828138 4.6962183,-4.0210121 C 3.7371277,-2.5387813 2.4390549,-1.9946496 1.1299838,-1.7134486 C 1.5341802,-2.2753578 1.8292454,-2.9268556 1.8292454,-3.6713813 C 1.8292454,-5.5606319 0.29211394,-7.0977635 -1.5971367,-7.0977635 z"); |
||
691 | points.map(arrowRotate); |
||
692 | arrow.points = points.copy(); |
||
693 | appPrefs.arrowStyles.append(arrow); |
||
694 | arrow.name = "ClubM"; |
||
695 | points.map(arrowScaling); |
||
696 | arrow.points = points.copy(); |
||
697 | appPrefs.arrowStyles.append(arrow); |
||
698 | arrow.name = "ClubS"; |
||
699 | points.map(arrowScaling); |
||
700 | arrow.points = points.copy(); |
||
701 | appPrefs.arrowStyles.append(arrow); |
||
12515 | fschmid | 702 | arrow.name = "LineL"; |
703 | points.resize(0); |
||
704 | points.parseSVG("M 0, -5 L 1, -5 L 1, 5 L 0, 5 z"); |
||
705 | arrow.points = points.copy(); |
||
706 | appPrefs.arrowStyles.append(arrow); |
||
707 | arrow.name = "LineM"; |
||
708 | points.map(arrowScaling); |
||
709 | arrow.points = points.copy(); |
||
710 | appPrefs.arrowStyles.append(arrow); |
||
711 | arrow.name = "LineS"; |
||
712 | points.map(arrowScaling); |
||
713 | arrow.points = points.copy(); |
||
714 | appPrefs.arrowStyles.append(arrow); |
||
715 | points.resize(0); |
||
2835 | cbradney | 716 | } |
717 | |||
718 | QString PrefsManager::setupPreferencesLocation() |
||
719 | { |
||
16577 | craig | 720 | QString Pff = QDir::toNativeSeparators(ScPaths::getApplicationDataDir()); |
2835 | cbradney | 721 | QFileInfo Pffi = QFileInfo(Pff); |
722 | QString PrefsPfad; |
||
13171 | cbradney | 723 | //If we are using the ScPaths default prefs location |
2835 | cbradney | 724 | if (Pffi.exists()) |
725 | { |
||
726 | if (Pffi.isDir()) |
||
727 | PrefsPfad = Pff; |
||
728 | else |
||
10398 | cbradney | 729 | PrefsPfad = QDir::homePath(); |
2835 | cbradney | 730 | } |
13171 | cbradney | 731 | else // Move to using the ScPaths default prefs location/scribus.* from ~/.scribus.* |
2835 | cbradney | 732 | { |
733 | QDir prefsDirectory = QDir(); |
||
734 | prefsDirectory.mkdir(Pff); |
||
735 | PrefsPfad = Pff; |
||
16577 | craig | 736 | QString oldPR = QDir::toNativeSeparators(QDir::homePath()+"/.scribus.rc"); |
2835 | cbradney | 737 | QFileInfo oldPi = QFileInfo(oldPR); |
738 | if (oldPi.exists()) |
||
739 | moveFile(oldPR, Pff+"/scribus.rc"); |
||
16577 | craig | 740 | QString oldPR2 = QDir::toNativeSeparators(QDir::homePath()+"/.scribusfont.rc"); |
2835 | cbradney | 741 | QFileInfo oldPi2 = QFileInfo(oldPR2); |
742 | if (oldPi2.exists()) |
||
743 | moveFile(oldPR2, Pff+"/scribusfont.rc"); |
||
16577 | craig | 744 | QString oldPR3 = QDir::toNativeSeparators(QDir::homePath()+"/.scribusscrap.scs"); |
2835 | cbradney | 745 | QFileInfo oldPi3 = QFileInfo(oldPR3); |
746 | if (oldPi3.exists()) |
||
747 | moveFile(oldPR3, Pff+"/scrap.scs"); |
||
748 | } |
||
16577 | craig | 749 | QString scP = QDir::toNativeSeparators(ScPaths::getPluginDataDir()); |
13608 | jghali | 750 | QFileInfo scPi = QFileInfo(scP); |
751 | if (!scPi.exists()) |
||
752 | { |
||
753 | QDir pluginDataDirectory = QDir(); |
||
754 | pluginDataDirectory.mkdir(scP); |
||
755 | } |
||
16577 | craig | 756 | QString scB = QDir::toNativeSeparators(Pff+"/scrapbook"); |
4611 | fschmid | 757 | QFileInfo scBi = QFileInfo(scB); |
758 | if (!scBi.exists()) |
||
759 | { |
||
760 | QDir scrapDirectory = QDir(); |
||
761 | scrapDirectory.mkdir(scB); |
||
762 | QDir scrapMainDirectory = QDir(); |
||
16577 | craig | 763 | scrapDirectory.mkdir(QDir::toNativeSeparators(scB+"/main")); |
4611 | fschmid | 764 | } |
16577 | craig | 765 | QFileInfo scTmp = QFileInfo(QDir::toNativeSeparators(scB+"/tmp")); |
5760 | fschmid | 766 | if (!scTmp.exists()) |
767 | { |
||
768 | QDir scrapDirectoryT = QDir(); |
||
16577 | craig | 769 | scrapDirectoryT.mkdir(QDir::toNativeSeparators(scB+"/tmp")); |
5760 | fschmid | 770 | } |
2835 | cbradney | 771 | prefsLocation=PrefsPfad; |
15681 | fschmid | 772 | QFileInfo scSwatch = QFileInfo(ScPaths::getApplicationDataDir()+"swatches"); |
773 | if (!scSwatch.exists()) |
||
774 | { |
||
775 | QDir swatchDir = QDir(); |
||
776 | swatchDir.mkpath(ScPaths::getApplicationDataDir()+"swatches"); |
||
777 | swatchDir.mkpath(ScPaths::getApplicationDataDir()+"swatches/locked"); |
||
778 | } |
||
2835 | cbradney | 779 | return PrefsPfad; |
780 | } |
||
781 | |||
782 | const QString PrefsManager::preferencesLocation() |
||
783 | { |
||
784 | return prefsLocation; |
||
785 | } |
||
786 | |||
5200 | cbradney | 787 | bool PrefsManager::copyOldPreferences() |
2835 | cbradney | 788 | { |
789 | //Now make copies for 1.3 use and leave the old ones alone for <1.3.0 usage |
||
13608 | jghali | 790 | QString prefs135[4], prefs140[4], prefs150[4]; |
3152 | craig | 791 | |
16577 | craig | 792 | prefs135[0]=QDir::toNativeSeparators(prefsLocation+"/scribus135.rc"); |
793 | prefs135[1]=QDir::toNativeSeparators(prefsLocation+"/scrap135.scs"); |
||
794 | prefs135[2]=QDir::toNativeSeparators(prefsLocation+"/prefs135.xml"); |
||
795 | prefs135[3]=QDir::toNativeSeparators(prefsLocation+"/scripter135.rc"); |
||
796 | prefs140[0]=QDir::toNativeSeparators(prefsLocation+"/scribus140.rc"); |
||
797 | prefs140[1]=QDir::toNativeSeparators(prefsLocation+"/scrap140.scs"); |
||
798 | prefs140[2]=QDir::toNativeSeparators(prefsLocation+"/prefs140.xml"); |
||
799 | prefs140[3]=QDir::toNativeSeparators(prefsLocation+"/scripter140.rc"); |
||
800 | prefs150[0]=QDir::toNativeSeparators(prefsLocation+"/scribus150.rc"); |
||
801 | prefs150[1]=QDir::toNativeSeparators(prefsLocation+"/scrap150.scs"); |
||
802 | prefs150[2]=QDir::toNativeSeparators(prefsLocation+"/prefs150.xml"); |
||
803 | prefs150[3]=QDir::toNativeSeparators(prefsLocation+"/scripter150.rc"); |
||
2835 | cbradney | 804 | |
13608 | jghali | 805 | bool existsPrefs135[4], existsPrefs140[4], existsPrefs150[4]; |
3156 | craig | 806 | for (uint i=0;i<4;++i) |
2835 | cbradney | 807 | { |
8673 | cbradney | 808 | existsPrefs135[i]=QFile::exists(prefs135[i]); |
13608 | jghali | 809 | existsPrefs140[i]=QFile::exists(prefs140[i]); |
810 | existsPrefs150[i]=QFile::exists(prefs150[i]); |
||
2835 | cbradney | 811 | } |
812 | |||
813 | bool retVal=false; |
||
13608 | jghali | 814 | if (existsPrefs150[0] && existsPrefs150[2]) |
5200 | cbradney | 815 | return retVal; |
8673 | cbradney | 816 | //Only check for these three as they will be autocreated if they dont exist. |
13608 | jghali | 817 | if( (existsPrefs135[0] && !existsPrefs140[0]) || (existsPrefs135[2] && !existsPrefs140[2]) ) |
2835 | cbradney | 818 | { |
13608 | jghali | 819 | // Now always return false |
820 | // retVal=true; // converting from 1.2 prefs |
||
5243 | cbradney | 821 | if (ScCore->usingGUI()) |
2835 | cbradney | 822 | { |
5656 | cbradney | 823 | bool splashShown=ScCore->splashShowing(); |
824 | if (splashShown) |
||
825 | ScCore->showSplash(false); |
||
19605 | jghali | 826 | if ( ScMessageBox::question( ScCore->primaryMainWindow(), tr("Migrate Old Scribus Settings?"), |
827 | tr("Scribus has detected existing Scribus 1.3.5 preferences files.\n" |
||
828 | "Do you want to migrate them to the new Scribus version?"), |
||
829 | QMessageBox::Yes | QMessageBox::No, |
||
830 | QMessageBox::NoButton, // GUI default |
||
831 | QMessageBox::Yes // batch default |
||
832 | )==QMessageBox::Yes ) |
||
2835 | cbradney | 833 | { |
834 | for (uint i=0;i<4;++i) |
||
835 | { |
||
13608 | jghali | 836 | if (existsPrefs135[i] && !existsPrefs150[i]) |
837 | copyFile(prefs135[i], prefs150[i]); |
||
2835 | cbradney | 838 | } |
839 | } |
||
5656 | cbradney | 840 | if (splashShown) |
841 | ScCore->showSplash(true); |
||
2835 | cbradney | 842 | } |
843 | } |
||
13608 | jghali | 844 | else if(existsPrefs140[0]) |
8673 | cbradney | 845 | { |
846 | for (uint i=0;i<4;++i) |
||
847 | { |
||
13608 | jghali | 848 | if (existsPrefs140[i] && !existsPrefs150[i]) |
849 | copyFile(prefs140[i], prefs150[i]); |
||
8673 | cbradney | 850 | } |
851 | } |
||
13608 | jghali | 852 | else if(existsPrefs135[0]) |
5200 | cbradney | 853 | { |
854 | for (uint i=0;i<4;++i) |
||
855 | { |
||
13608 | jghali | 856 | if (existsPrefs135[i] && !existsPrefs150[i]) |
857 | copyFile(prefs135[i], prefs150[i]); |
||
5200 | cbradney | 858 | } |
859 | } |
||
2835 | cbradney | 860 | return retVal; |
861 | } |
||
862 | |||
2856 | cbradney | 863 | void PrefsManager::convert12Preferences() |
2835 | cbradney | 864 | { |
865 | // Import 1.2 font search path prefs |
||
16577 | craig | 866 | QFile fontPrefsFile12(QDir::toNativeSeparators(prefsLocation+"/scribusfont.rc")); |
8501 | cbradney | 867 | if (fontPrefsFile12.open(QIODevice::ReadOnly)) |
2835 | cbradney | 868 | { |
2856 | cbradney | 869 | PrefsContext *pc = prefsFile->getContext("Fonts"); |
2835 | cbradney | 870 | PrefsTable *fontPrefs = pc->getTable("ExtraFontDirs"); |
10004 | fschmid | 871 | QTextStream tsx(&fontPrefsFile12); |
872 | QString extraPath = tsx.readAll(); |
||
2835 | cbradney | 873 | fontPrefsFile12.close(); |
10603 | fschmid | 874 | QStringList extraFonts = extraPath.split("\n", QString::SkipEmptyParts); |
8528 | cbradney | 875 | for (int i = 0; i < extraFonts.count(); ++i) |
2835 | cbradney | 876 | fontPrefs->set(i, 0, extraFonts[i]); |
877 | } |
||
878 | } |
||
2859 | cbradney | 879 | |
3873 | subik | 880 | void PrefsManager::ReadPrefs(const QString & fname) |
2859 | cbradney | 881 | { |
3873 | subik | 882 | QString realFile; |
20264 | jghali | 883 | if (fname.isEmpty()) |
13608 | jghali | 884 | realFile = prefsLocation + "/scribus150.rc"; |
3873 | subik | 885 | else |
886 | realFile = fname; |
||
887 | |||
888 | if (QFile::exists(realFile)) |
||
889 | { |
||
890 | if (!ReadPref(realFile)) |
||
3171 | craig | 891 | { |
892 | alertLoadPrefsFailed(); |
||
893 | return; |
||
894 | } |
||
3873 | subik | 895 | } |
5243 | cbradney | 896 | } |
3873 | subik | 897 | |
5243 | cbradney | 898 | void PrefsManager::setupMainWindow(ScribusMainWindow* mw) |
899 | { |
||
13955 | cbradney | 900 | mw->setDefaultPrinter(appPrefs.printerPrefs.PrinterName, appPrefs.printerPrefs.PrinterFile, appPrefs.printerPrefs.PrinterCommand); |
2859 | cbradney | 901 | |
13955 | cbradney | 902 | uint max = qMin(appPrefs.uiPrefs.recentDocCount, appPrefs.uiPrefs.RecentDocs.count()); |
2859 | cbradney | 903 | for (uint m = 0; m < max; ++m) |
904 | { |
||
13955 | cbradney | 905 | QFileInfo fd(appPrefs.uiPrefs.RecentDocs[m]); |
2859 | cbradney | 906 | if (fd.exists()) |
907 | { |
||
13955 | cbradney | 908 | mw->RecentDocs.append(appPrefs.uiPrefs.RecentDocs[m]); |
16665 | craig | 909 | //#9845: ScCore->fileWatcher->addFile(appPrefs.uiPrefs.RecentDocs[m]); |
2859 | cbradney | 910 | } |
911 | } |
||
5243 | cbradney | 912 | mw->rebuildRecentFileMenu(); |
13955 | cbradney | 913 | mw->move(appPrefs.uiPrefs.mainWinSettings.xPosition, appPrefs.uiPrefs.mainWinSettings.yPosition); |
914 | mw->resize(appPrefs.uiPrefs.mainWinSettings.width, appPrefs.uiPrefs.mainWinSettings.height); |
||
915 | if (appPrefs.uiPrefs.mainWinSettings.maximized) |
||
10550 | avox | 916 | mw->setWindowState((ScCore->primaryMainWindow()->windowState() & ~Qt::WindowMinimized) | Qt::WindowMaximized); |
13482 | cbradney | 917 | //For 1.3.5, we dump prefs first time around. |
918 | if (!firstTimeIgnoreOldPrefs) |
||
919 | ReadPrefsXML(); |
||
14849 | cbradney | 920 | if (appPrefs.verifierPrefs.checkerPrefsList.count() == 0) |
2859 | cbradney | 921 | { |
14849 | cbradney | 922 | initDefaultCheckerPrefs(&appPrefs.verifierPrefs.checkerPrefsList); |
923 | appPrefs.verifierPrefs.curCheckProfile = CommonStrings::PostScript; |
||
2859 | cbradney | 924 | } |
13955 | cbradney | 925 | if (!appPrefs.uiPrefs.mainWinState.isEmpty()) |
10256 | fschmid | 926 | { |
13955 | cbradney | 927 | mw->restoreState(appPrefs.uiPrefs.mainWinState); |
10256 | fschmid | 928 | } |
2859 | cbradney | 929 | } |
930 | |||
931 | void PrefsManager::ReadPrefsXML() |
||
932 | { |
||
10256 | fschmid | 933 | if (prefsFile) |
934 | { |
||
935 | PrefsContext* userprefsContext = prefsFile->getContext("user_preferences"); |
||
936 | if (userprefsContext) |
||
937 | { |
||
13876 | cbradney | 938 | appPrefs.uiPrefs.language = userprefsContext->get("gui_language",""); |
18194 | fschmid | 939 | appPrefs.uiPrefs.mainWinState = QByteArray::fromBase64(userprefsContext->get("mainwinstate","").toLatin1()); |
14043 | jghali | 940 | //continue here... |
941 | //Prefs."blah blah" =... |
||
10256 | fschmid | 942 | } |
12104 | jghali | 943 | if (prefsFile->hasContext("print_options")) |
944 | { |
||
945 | // Reset copies number to 1 when user start new session |
||
946 | PrefsContext* printOptionsContext = prefsFile->getContext("print_options"); |
||
947 | if (printOptionsContext) |
||
948 | printOptionsContext->set("Copies", 1); |
||
949 | } |
||
10256 | fschmid | 950 | } |
2859 | cbradney | 951 | } |
952 | |||
953 | |||
3873 | subik | 954 | void PrefsManager::SavePrefs(const QString & fname) |
2859 | cbradney | 955 | { |
956 | // If closing because of a crash don't save prefs as we can |
||
957 | // accidentally nuke the settings if the crash is before prefs are loaded |
||
3170 | craig | 958 | // The caller is responsible for ensuring we aren't called under those |
959 | // conditions. |
||
960 | Q_ASSERT(!emergencyActivated); |
||
13955 | cbradney | 961 | appPrefs.uiPrefs.mainWinSettings.xPosition = abs(ScCore->primaryMainWindow()->pos().x()); |
962 | appPrefs.uiPrefs.mainWinSettings.yPosition = abs(ScCore->primaryMainWindow()->pos().y()); |
||
963 | appPrefs.uiPrefs.mainWinSettings.width = ScCore->primaryMainWindow()->size().width(); |
||
964 | appPrefs.uiPrefs.mainWinSettings.height = ScCore->primaryMainWindow()->size().height(); |
||
965 | appPrefs.uiPrefs.mainWinSettings.maximized = ScCore->primaryMainWindow()->isMaximized(); |
||
966 | appPrefs.uiPrefs.mainWinState = ScCore->primaryMainWindow()->saveState(); |
||
967 | appPrefs.uiPrefs.RecentDocs.clear(); |
||
13876 | cbradney | 968 | uint max = qMin(appPrefs.uiPrefs.recentDocCount, ScCore->primaryMainWindow()->RecentDocs.count()); |
2859 | cbradney | 969 | for (uint m = 0; m < max; ++m) |
970 | { |
||
13955 | cbradney | 971 | appPrefs.uiPrefs.RecentDocs.append(ScCore->primaryMainWindow()->RecentDocs[m]); |
2859 | cbradney | 972 | } |
13955 | cbradney | 973 | ScCore->primaryMainWindow()->getDefaultPrinter(appPrefs.printerPrefs.PrinterName, appPrefs.printerPrefs.PrinterFile, appPrefs.printerPrefs.PrinterCommand); |
3170 | craig | 974 | SavePrefsXML(); |
3873 | subik | 975 | QString realFile; |
976 | if (fname.isNull()) |
||
13608 | jghali | 977 | realFile = prefsLocation+"/scribus150.rc"; |
3873 | subik | 978 | else |
979 | realFile = fname; |
||
980 | if (!WritePref(realFile)) |
||
3170 | craig | 981 | alertSavePrefsFailed(); |
5257 | cbradney | 982 | emit prefsChanged(); |
2859 | cbradney | 983 | } |
984 | |||
985 | void PrefsManager::SavePrefsXML() |
||
986 | { |
||
10256 | fschmid | 987 | if (prefsFile) |
988 | { |
||
989 | PrefsContext* userprefsContext = prefsFile->getContext("user_preferences"); |
||
990 | if (userprefsContext) |
||
991 | { |
||
13876 | cbradney | 992 | userprefsContext->set("gui_language", appPrefs.uiPrefs.language); |
18194 | fschmid | 993 | userprefsContext->set("mainwinstate", QString::fromLatin1(appPrefs.uiPrefs.mainWinState.toBase64())); |
14043 | jghali | 994 | //continue here... |
995 | //Prefs."blah blah" =... |
||
10256 | fschmid | 996 | } |
997 | prefsFile->write(); |
||
998 | } |
||
2859 | cbradney | 999 | } |
2862 | cbradney | 1000 | |
1001 | void PrefsManager::setGhostscriptExecutable(const QString& executableName) |
||
1002 | { |
||
13955 | cbradney | 1003 | appPrefs.extToolPrefs.gs_exe=executableName; |
2862 | cbradney | 1004 | } |
1005 | |||
1006 | void PrefsManager::setImageEditorExecutable(const QString& executableName) |
||
1007 | { |
||
13955 | cbradney | 1008 | appPrefs.extToolPrefs.imageEditorExecutable=executableName; |
2862 | cbradney | 1009 | } |
1010 | |||
5418 | cbradney | 1011 | void PrefsManager::setExtBrowserExecutable(const QString& executableName) |
2862 | cbradney | 1012 | { |
13955 | cbradney | 1013 | appPrefs.extToolPrefs.extBrowserExecutable=executableName; |
2862 | cbradney | 1014 | } |
1015 | |||
13957 | herm | 1016 | void PrefsManager::setUniconvExecutable(const QString& executableName) |
1017 | { |
||
1018 | appPrefs.extToolPrefs.uniconvExecutable=executableName; |
||
1019 | } |
||
1020 | |||
11506 | mrdocs | 1021 | void PrefsManager::setLatexConfigs(const QStringList& configs) |
10228 | avox | 1022 | { |
13955 | cbradney | 1023 | appPrefs.extToolPrefs.latexConfigs=configs; |
10228 | avox | 1024 | } |
1025 | |||
15411 | craig | 1026 | void PrefsManager::setLatexCommands(const QMap<QString, QString>& commands) |
1027 | { |
||
1028 | appPrefs.extToolPrefs.latexCommands=commands; |
||
1029 | } |
||
1030 | |||
15434 | craig | 1031 | bool PrefsManager::renderFrameConfigured() |
1032 | { |
||
1033 | if (appPrefs.extToolPrefs.latexConfigs.isEmpty()) |
||
1034 | return false; |
||
1035 | if (appPrefs.extToolPrefs.latexCommands.isEmpty()) |
||
1036 | return false; |
||
19108 | jghali | 1037 | bool foundAny = false; |
15434 | craig | 1038 | foreach (QString cmd, appPrefs.extToolPrefs.latexCommands) |
15439 | craig | 1039 | { |
15434 | craig | 1040 | if (fileInPath(cmd)) |
19108 | jghali | 1041 | { |
1042 | foundAny = true; |
||
1043 | break; |
||
1044 | } |
||
15439 | craig | 1045 | } |
15434 | craig | 1046 | return foundAny; |
1047 | } |
||
15411 | craig | 1048 | |
15434 | craig | 1049 | |
10228 | avox | 1050 | void PrefsManager::setLatexEditorExecutable(const QString& executableName) |
1051 | { |
||
13955 | cbradney | 1052 | appPrefs.extToolPrefs.latexEditorExecutable=executableName; |
10228 | avox | 1053 | } |
1054 | |||
2871 | cbradney | 1055 | const QString PrefsManager::documentDir() |
1056 | { |
||
13876 | cbradney | 1057 | return appPrefs.pathPrefs.documents; |
2871 | cbradney | 1058 | } |
1059 | |||
3931 | subik | 1060 | void PrefsManager::setDocumentDir(const QString& dirname) |
1061 | { |
||
13876 | cbradney | 1062 | appPrefs.pathPrefs.documents = dirname; |
3931 | subik | 1063 | } |
1064 | |||
13870 | cbradney | 1065 | int PrefsManager::mouseWheelJump() const |
2871 | cbradney | 1066 | { |
13876 | cbradney | 1067 | return appPrefs.uiPrefs.wheelJump; |
2871 | cbradney | 1068 | } |
1069 | |||
2870 | cbradney | 1070 | //Changed to return false when we have no fonts |
6700 | cbradney | 1071 | bool PrefsManager::GetAllFonts(bool showFontInfo) |
2870 | cbradney | 1072 | { |
13955 | cbradney | 1073 | appPrefs.fontPrefs.AvailFonts.GetFonts(prefsLocation, showFontInfo); |
1074 | return !appPrefs.fontPrefs.AvailFonts.isEmpty(); |
||
2870 | cbradney | 1075 | } |
2871 | cbradney | 1076 | |
1077 | void PrefsManager::setShowStartupDialog(const bool showDialog) |
||
1078 | { |
||
13876 | cbradney | 1079 | appPrefs.uiPrefs.showStartupDialog=showDialog; |
2871 | cbradney | 1080 | } |
1081 | |||
1082 | const ColorList& PrefsManager::colorSet() |
||
1083 | { |
||
13967 | cbradney | 1084 | return appPrefs.colorPrefs.DColors; |
2871 | cbradney | 1085 | } |
1086 | |||
1087 | ColorList* PrefsManager::colorSetPtr() |
||
1088 | { |
||
13967 | cbradney | 1089 | return &appPrefs.colorPrefs.DColors; |
2871 | cbradney | 1090 | } |
1091 | |||
1092 | const QString& PrefsManager::colorSetName() |
||
1093 | { |
||
13967 | cbradney | 1094 | return appPrefs.colorPrefs.DColorSet; |
2871 | cbradney | 1095 | } |
1096 | |||
7718 | jghali | 1097 | bool PrefsManager::isToolColor(const QString& name) |
1098 | { |
||
13953 | cbradney | 1099 | return isToolColor(appPrefs.itemToolPrefs, name); |
7718 | jghali | 1100 | } |
1101 | |||
13953 | cbradney | 1102 | bool PrefsManager::isToolColor(const struct ItemToolPrefs& settings, const QString& name) |
7718 | jghali | 1103 | { |
19378 | craig | 1104 | if (settings.calligraphicPenLineColor == name) |
15847 | fschmid | 1105 | return true; |
19378 | craig | 1106 | if (settings.calligraphicPenFillColor == name) |
15847 | fschmid | 1107 | return true; |
13996 | cbradney | 1108 | if (settings.textColor == name) |
7718 | jghali | 1109 | return true; |
13996 | cbradney | 1110 | if (settings.textStrokeColor == name) |
7718 | jghali | 1111 | return true; |
14014 | cbradney | 1112 | if (settings.textFillColor == name) |
7718 | jghali | 1113 | return true; |
13996 | cbradney | 1114 | if (settings.textLineColor == name) |
7718 | jghali | 1115 | return true; |
14014 | cbradney | 1116 | if (settings.shapeLineColor == name) |
7718 | jghali | 1117 | return true; |
14014 | cbradney | 1118 | if (settings.shapeFillColor == name) |
7718 | jghali | 1119 | return true; |
13996 | cbradney | 1120 | if (settings.lineColor == name) |
7718 | jghali | 1121 | return true; |
13996 | cbradney | 1122 | if (settings.imageFillColor == name) |
7718 | jghali | 1123 | return true; |
17054 | fschmid | 1124 | if (settings.imageStrokeColor == name) |
1125 | return true; |
||
7718 | jghali | 1126 | return false; |
1127 | } |
||
1128 | |||
1129 | QStringList PrefsManager::toolColorNames() |
||
1130 | { |
||
13953 | cbradney | 1131 | return toolColorNames(appPrefs.itemToolPrefs); |
7718 | jghali | 1132 | } |
1133 | |||
13953 | cbradney | 1134 | QStringList PrefsManager::toolColorNames(const struct ItemToolPrefs& settings) |
7718 | jghali | 1135 | { |
1136 | QStringList names; |
||
13996 | cbradney | 1137 | names.append(settings.textColor); |
1138 | if (!names.contains(settings.textStrokeColor)) |
||
1139 | names.append(settings.textStrokeColor); |
||
14014 | cbradney | 1140 | if (!names.contains(settings.textFillColor)) |
1141 | names.append(settings.textFillColor); |
||
13996 | cbradney | 1142 | if (!names.contains(settings.textLineColor)) |
1143 | names.append(settings.textLineColor); |
||
14014 | cbradney | 1144 | if (!names.contains(settings.shapeLineColor)) |
1145 | names.append(settings.shapeLineColor); |
||
1146 | if (!names.contains(settings.shapeFillColor)) |
||
1147 | names.append(settings.shapeFillColor); |
||
13996 | cbradney | 1148 | if (!names.contains(settings.lineColor)) |
1149 | names.append(settings.lineColor); |
||
1150 | if (!names.contains(settings.imageFillColor)) |
||
1151 | names.append(settings.imageFillColor); |
||
17054 | fschmid | 1152 | if (!names.contains(settings.imageStrokeColor)) |
1153 | names.append(settings.imageStrokeColor); |
||
19378 | craig | 1154 | if (!names.contains(settings.calligraphicPenFillColor)) |
1155 | names.append(settings.calligraphicPenFillColor); |
||
1156 | if (!names.contains(settings.calligraphicPenLineColor)) |
||
1157 | names.append(settings.calligraphicPenLineColor); |
||
7718 | jghali | 1158 | return names; |
1159 | } |
||
1160 | |||
1161 | void PrefsManager::replaceToolColors(const QMap<QString, QString> replaceMap) |
||
1162 | { |
||
13953 | cbradney | 1163 | replaceToolColors(appPrefs.itemToolPrefs, replaceMap); |
7718 | jghali | 1164 | } |
1165 | |||
13953 | cbradney | 1166 | void PrefsManager::replaceToolColors(struct ItemToolPrefs& settings, const QMap<QString, QString> replaceMap) |
7718 | jghali | 1167 | { |
13996 | cbradney | 1168 | if (replaceMap.contains(settings.textColor)) |
1169 | settings.textColor = replaceMap[settings.textColor]; |
||
1170 | if (replaceMap.contains(settings.textStrokeColor)) |
||
1171 | settings.textStrokeColor = replaceMap[settings.textStrokeColor]; |
||
14014 | cbradney | 1172 | if (replaceMap.contains(settings.textFillColor)) |
1173 | settings.textFillColor = replaceMap[settings.textFillColor]; |
||
13996 | cbradney | 1174 | if (replaceMap.contains(settings.textLineColor)) |
1175 | settings.textLineColor = replaceMap[settings.textLineColor]; |
||
14014 | cbradney | 1176 | if (replaceMap.contains(settings.shapeLineColor)) |
1177 | settings.shapeLineColor = replaceMap[settings.shapeLineColor]; |
||
1178 | if (replaceMap.contains(settings.shapeFillColor)) |
||
1179 | settings.shapeFillColor = replaceMap[settings.shapeFillColor]; |
||
13996 | cbradney | 1180 | if (replaceMap.contains(settings.lineColor)) |
1181 | settings.lineColor = replaceMap[settings.lineColor]; |
||
1182 | if (replaceMap.contains(settings.imageFillColor)) |
||
1183 | settings.imageFillColor = replaceMap[settings.imageFillColor]; |
||
17054 | fschmid | 1184 | if (replaceMap.contains(settings.imageStrokeColor)) |
1185 | settings.imageStrokeColor = replaceMap[settings.imageStrokeColor]; |
||
19378 | craig | 1186 | if (replaceMap.contains(settings.calligraphicPenFillColor)) |
1187 | settings.calligraphicPenFillColor = replaceMap[settings.calligraphicPenFillColor]; |
||
1188 | if (replaceMap.contains(settings.calligraphicPenLineColor)) |
||
1189 | settings.calligraphicPenLineColor = replaceMap[settings.calligraphicPenLineColor]; |
||
7718 | jghali | 1190 | } |
1191 | |||
2871 | cbradney | 1192 | void PrefsManager::setColorSet(const ColorList& colorSet) |
1193 | { |
||
7718 | jghali | 1194 | // Color set may have changed and tools color not be present in the new color set |
1195 | ColorList tmpSet = colorSet; |
||
13996 | cbradney | 1196 | QString penText = appPrefs.itemToolPrefs.textColor; |
7718 | jghali | 1197 | if (!tmpSet.contains(penText) && penText != CommonStrings::None) |
13967 | cbradney | 1198 | tmpSet[penText] = appPrefs.colorPrefs.DColors[penText]; |
13996 | cbradney | 1199 | QString strokeText = appPrefs.itemToolPrefs.textStrokeColor; |
7718 | jghali | 1200 | if (!tmpSet.contains(strokeText) && strokeText != CommonStrings::None) |
13967 | cbradney | 1201 | tmpSet[strokeText] = appPrefs.colorPrefs.DColors[strokeText]; |
14014 | cbradney | 1202 | QString textFillColor = appPrefs.itemToolPrefs.textFillColor; |
1203 | if (!tmpSet.contains(textFillColor) && textFillColor != CommonStrings::None) |
||
1204 | tmpSet[textFillColor] = appPrefs.colorPrefs.DColors[textFillColor]; |
||
13996 | cbradney | 1205 | QString textLineColor = appPrefs.itemToolPrefs.textLineColor; |
7718 | jghali | 1206 | if (!tmpSet.contains(textLineColor) && textLineColor != CommonStrings::None) |
13967 | cbradney | 1207 | tmpSet[textLineColor] = appPrefs.colorPrefs.DColors[textLineColor]; |
14014 | cbradney | 1208 | QString pen = appPrefs.itemToolPrefs.shapeLineColor; |
7718 | jghali | 1209 | if (!tmpSet.contains(pen) && pen != CommonStrings::None) |
13967 | cbradney | 1210 | tmpSet[pen] = appPrefs.colorPrefs.DColors[pen]; |
14014 | cbradney | 1211 | QString brush = appPrefs.itemToolPrefs.shapeFillColor; |
7718 | jghali | 1212 | if (!tmpSet.contains(brush) && brush != CommonStrings::None) |
13967 | cbradney | 1213 | tmpSet[brush] = appPrefs.colorPrefs.DColors[brush]; |
13996 | cbradney | 1214 | QString penLine = appPrefs.itemToolPrefs.lineColor; |
7718 | jghali | 1215 | if (!tmpSet.contains(penLine) && penLine != CommonStrings::None) |
13967 | cbradney | 1216 | tmpSet[penLine] = appPrefs.colorPrefs.DColors[penLine]; |
13996 | cbradney | 1217 | QString brushPict = appPrefs.itemToolPrefs.imageFillColor; |
7718 | jghali | 1218 | if (!tmpSet.contains(brushPict) && brushPict != CommonStrings::None) |
13967 | cbradney | 1219 | tmpSet[brushPict] = appPrefs.colorPrefs.DColors[brushPict]; |
17054 | fschmid | 1220 | QString penPict = appPrefs.itemToolPrefs.imageStrokeColor; |
1221 | if (!tmpSet.contains(penPict) && penPict != CommonStrings::None) |
||
1222 | tmpSet[penPict] = appPrefs.colorPrefs.DColors[penPict]; |
||
19378 | craig | 1223 | QString brushCpen = appPrefs.itemToolPrefs.calligraphicPenFillColor; |
15847 | fschmid | 1224 | if (!tmpSet.contains(brushCpen) && brushCpen != CommonStrings::None) |
1225 | tmpSet[brushCpen] = appPrefs.colorPrefs.DColors[brushCpen]; |
||
19378 | craig | 1226 | QString brushCpen2 = appPrefs.itemToolPrefs.calligraphicPenLineColor; |
15847 | fschmid | 1227 | if (!tmpSet.contains(brushCpen2) && brushCpen2 != CommonStrings::None) |
1228 | tmpSet[brushCpen2] = appPrefs.colorPrefs.DColors[brushCpen2]; |
||
13967 | cbradney | 1229 | appPrefs.colorPrefs.DColors = tmpSet; |
2871 | cbradney | 1230 | } |
1231 | |||
1232 | void PrefsManager::setColorSetName(const QString& colorSetName) |
||
1233 | { |
||
13967 | cbradney | 1234 | appPrefs.colorPrefs.DColorSet=colorSetName; |
2871 | cbradney | 1235 | } |
2873 | cbradney | 1236 | |
1237 | |||
3932 | avox | 1238 | void PrefsManager::setKeyEntry(const QString& actName, const QString& cleanMenuText, const QKeySequence& keyseq, const int& rowNumber) |
2873 | cbradney | 1239 | { |
1240 | Keys ke; |
||
2877 | cbradney | 1241 | if (!actName.isEmpty()) |
2873 | cbradney | 1242 | { |
5781 | cbradney | 1243 | if (ScCore->primaryMainWindow()->scrActions[actName]) |
2873 | cbradney | 1244 | { |
1245 | ke.actionName=actName; |
||
1246 | ke.keySequence = keyseq; |
||
1247 | ke.cleanMenuText=cleanMenuText; |
||
1248 | ke.tableRow=rowNumber; |
||
13955 | cbradney | 1249 | appPrefs.keyShortcutPrefs.KeyActions.insert(actName, ke); |
2873 | cbradney | 1250 | } |
1251 | else |
||
18194 | fschmid | 1252 | qDebug("%s", QString("Action Name: %1 does not exist").arg(actName).toLatin1().constData()); |
2873 | cbradney | 1253 | } |
1254 | } |
||
1255 | |||
10509 | cbradney | 1256 | double PrefsManager::displayScale() const |
2873 | cbradney | 1257 | { |
13974 | cbradney | 1258 | return appPrefs.displayPrefs.displayScale; |
2873 | cbradney | 1259 | } |
1260 | |||
13870 | cbradney | 1261 | const QString& PrefsManager::uiLanguage() const |
2873 | cbradney | 1262 | { |
13876 | cbradney | 1263 | return appPrefs.uiPrefs.language; |
2873 | cbradney | 1264 | } |
1265 | |||
10390 | cbradney | 1266 | const QString& PrefsManager::guiStyle() const |
2873 | cbradney | 1267 | { |
13876 | cbradney | 1268 | return appPrefs.uiPrefs.style; |
2873 | cbradney | 1269 | } |
1270 | |||
11115 | subik | 1271 | const QString& PrefsManager::guiSystemStyle() const |
1272 | { |
||
13870 | cbradney | 1273 | return appPrefs.ui_SystemTheme; |
11115 | subik | 1274 | } |
1275 | |||
10390 | cbradney | 1276 | const int& PrefsManager::guiFontSize() const |
2873 | cbradney | 1277 | { |
13876 | cbradney | 1278 | return appPrefs.uiPrefs.applicationFontSize; |
2873 | cbradney | 1279 | } |
2889 | cbradney | 1280 | |
10390 | cbradney | 1281 | const int& PrefsManager::paletteFontSize() const |
3940 | tsoots | 1282 | { |
13876 | cbradney | 1283 | return appPrefs.uiPrefs.paletteFontSize; |
3940 | tsoots | 1284 | } |
1285 | |||
12476 | cbradney | 1286 | bool PrefsManager::showPageShadow() const |
1287 | { |
||
13955 | cbradney | 1288 | return appPrefs.displayPrefs.showPageShadow; |
12476 | cbradney | 1289 | } |
1290 | |||
3170 | craig | 1291 | bool PrefsManager::WritePref(QString ho) |
2889 | cbradney | 1292 | { |
1293 | QDomDocument docu("scribusrc"); |
||
1294 | QString st="<SCRIBUSRC></SCRIBUSRC>"; |
||
1295 | docu.setContent(st); |
||
1296 | QDomElement elem=docu.documentElement(); |
||
15124 | cbradney | 1297 | elem.setAttribute("VERSION","1.5.0"); |
1298 | |||
1299 | |||
1300 | QDomElement dcUI=docu.createElement("UI"); |
||
1301 | dcUI.setAttribute("ShowStartupDialog", static_cast<int>(appPrefs.uiPrefs.showStartupDialog)); |
||
1302 | dcUI.setAttribute("ShowSplashOnStartup", static_cast<int>(appPrefs.uiPrefs.showSplashOnStartup)); |
||
1303 | dcUI.setAttribute("UseSmallWidgets", static_cast<int>(appPrefs.uiPrefs.useSmallWidgets)); |
||
1304 | dcUI.setAttribute("UseDocumentTabs", static_cast<int>(appPrefs.uiPrefs.useTabs)); |
||
1305 | dcUI.setAttribute("StickyTools", static_cast<int>(appPrefs.uiPrefs.stickyTools)); |
||
1306 | dcUI.setAttribute("Theme", appPrefs.uiPrefs.style); |
||
1307 | dcUI.setAttribute("ScrollWheelJump", appPrefs.uiPrefs.wheelJump); |
||
1308 | dcUI.setAttribute("MouseMoveTimeout", appPrefs.uiPrefs.mouseMoveTimeout); |
||
1309 | dcUI.setAttribute("ApplicationFontSize", appPrefs.uiPrefs.applicationFontSize); |
||
1310 | dcUI.setAttribute("PaletteFontSize", appPrefs.uiPrefs.paletteFontSize); |
||
1311 | dcUI.setAttribute("RecentDocumentCount", appPrefs.uiPrefs.recentDocCount); |
||
15461 | craig | 1312 | dcUI.setAttribute("UseGrayscaleIcons", appPrefs.uiPrefs.grayscaleIcons); |
20160 | craig | 1313 | dcUI.setAttribute("IconSet", appPrefs.uiPrefs.iconSet); |
15124 | cbradney | 1314 | elem.appendChild(dcUI); |
1315 | |||
1316 | QDomElement deDocumentSetup=docu.createElement("DocumentSetup"); |
||
1317 | deDocumentSetup.setAttribute("UnitIndex",appPrefs.docSetupPrefs.docUnitIndex); |
||
1318 | deDocumentSetup.setAttribute("PageSize",appPrefs.docSetupPrefs.pageSize); |
||
1319 | deDocumentSetup.setAttribute("PageOrientation",appPrefs.docSetupPrefs.pageOrientation); |
||
1320 | deDocumentSetup.setAttribute("PageWidth",ScCLocale::toQStringC(appPrefs.docSetupPrefs.pageWidth)); |
||
1321 | deDocumentSetup.setAttribute("PageHeight",ScCLocale::toQStringC(appPrefs.docSetupPrefs.pageHeight)); |
||
19831 | craig | 1322 | deDocumentSetup.setAttribute("MarginTop",ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.top())); |
1323 | deDocumentSetup.setAttribute("MarginBottom",ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.bottom())); |
||
1324 | deDocumentSetup.setAttribute("MarginLeft",ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.left())); |
||
1325 | deDocumentSetup.setAttribute("MarginRight",ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.right())); |
||
15124 | cbradney | 1326 | deDocumentSetup.setAttribute("MarginPreset",appPrefs.docSetupPrefs.marginPreset); |
1327 | deDocumentSetup.setAttribute("PagePositioning", appPrefs.docSetupPrefs.pagePositioning); |
||
1328 | deDocumentSetup.setAttribute("AutoSave", static_cast<int>(appPrefs.docSetupPrefs.AutoSave)); |
||
1329 | deDocumentSetup.setAttribute("AutoSaveTime", appPrefs.docSetupPrefs.AutoSaveTime); |
||
1330 | deDocumentSetup.setAttribute("SaveCompressed", static_cast<int>(appPrefs.docSetupPrefs.saveCompressed)); |
||
19831 | craig | 1331 | deDocumentSetup.setAttribute("BleedTop", ScCLocale::toQStringC(appPrefs.docSetupPrefs.bleeds.top())); |
1332 | deDocumentSetup.setAttribute("BleedLeft", ScCLocale::toQStringC(appPrefs.docSetupPrefs.bleeds.left())); |
||
1333 | deDocumentSetup.setAttribute("BleedRight", ScCLocale::toQStringC(appPrefs.docSetupPrefs.bleeds.right())); |
||
1334 | deDocumentSetup.setAttribute("BleedBottom", ScCLocale::toQStringC(appPrefs.docSetupPrefs.bleeds.bottom())); |
||
15124 | cbradney | 1335 | elem.appendChild(deDocumentSetup); |
1336 | |||
1337 | QDomElement dePaths=docu.createElement("Paths"); |
||
1338 | dePaths.setAttribute("Documents", appPrefs.pathPrefs.documents); |
||
1339 | dePaths.setAttribute("Profiles", appPrefs.pathPrefs.colorProfiles); |
||
1340 | dePaths.setAttribute("Scripts", appPrefs.pathPrefs.scripts); |
||
1341 | dePaths.setAttribute("Templates", appPrefs.pathPrefs.documentTemplates); |
||
1342 | elem.appendChild(dePaths); |
||
1343 | |||
1344 | QDomElement deGuides=docu.createElement("Guides"); |
||
1345 | deGuides.setAttribute("GrabRadius",appPrefs.guidesPrefs.grabRadius); |
||
1346 | deGuides.setAttribute("ShowGuides", static_cast<int>(appPrefs.guidesPrefs.guidesShown)); |
||
1347 | deGuides.setAttribute("ShowColumnBorders", static_cast<int>(appPrefs.guidesPrefs.colBordersShown)); |
||
1348 | deGuides.setAttribute("ShowFrames", static_cast<int>(appPrefs.guidesPrefs.framesShown)); |
||
1349 | deGuides.setAttribute("ShowLayerMarkers", static_cast<int>(appPrefs.guidesPrefs.layerMarkersShown)); |
||
1350 | deGuides.setAttribute("ShowMargins", static_cast<int>(appPrefs.guidesPrefs.marginsShown)); |
||
1351 | deGuides.setAttribute("ShowBaselineGrid", static_cast<int>(appPrefs.guidesPrefs.baselineGridShown)); |
||
1352 | deGuides.setAttribute("ShowLinks", static_cast<int>(appPrefs.guidesPrefs.linkShown)); |
||
1353 | deGuides.setAttribute("ShowImages", static_cast<int>(appPrefs.guidesPrefs.showPic)); |
||
1354 | deGuides.setAttribute("ShowControls", static_cast<int>(appPrefs.guidesPrefs.showControls)); |
||
1355 | deGuides.setAttribute("ShowRulers", static_cast<int>(appPrefs.guidesPrefs.rulersShown)); |
||
1356 | deGuides.setAttribute("ShowBleed", static_cast<int>(appPrefs.guidesPrefs.showBleed)); |
||
1357 | deGuides.setAttribute("RulerMode", static_cast<int>(appPrefs.guidesPrefs.rulerMode)); |
||
1358 | deGuides.setAttribute("MinorGridSpacing",ScCLocale::toQStringC(appPrefs.guidesPrefs.minorGridSpacing)); |
||
1359 | deGuides.setAttribute("MajorGridSpacing",ScCLocale::toQStringC(appPrefs.guidesPrefs.majorGridSpacing)); |
||
1360 | deGuides.setAttribute("MinorGridColor",appPrefs.guidesPrefs.minorGridColor.name()); |
||
1361 | deGuides.setAttribute("MajorGridColor",appPrefs.guidesPrefs.majorGridColor.name()); |
||
1362 | deGuides.setAttribute("GuidesColor", appPrefs.guidesPrefs.guideColor.name()); |
||
1363 | deGuides.setAttribute("MarginColor",appPrefs.guidesPrefs.marginColor.name()); |
||
1364 | deGuides.setAttribute("BaselineGridColor", appPrefs.guidesPrefs.baselineGridColor.name()); |
||
1365 | deGuides.setAttribute("ObjectToGuideSnapRadius", ScCLocale::toQStringC(appPrefs.guidesPrefs.guideRad)); |
||
16990 | fschmid | 1366 | QString renderStack = ""; |
1367 | int renderStackCount = appPrefs.guidesPrefs.renderStackOrder.count(); |
||
1368 | for (int r = 0; r < renderStackCount; r++) |
||
1369 | { |
||
1370 | renderStack += QString("%1 ").arg(appPrefs.guidesPrefs.renderStackOrder[r]); |
||
1371 | } |
||
1372 | renderStack = renderStack.trimmed(); |
||
1373 | deGuides.setAttribute("renderStack", renderStack); |
||
16992 | fschmid | 1374 | deGuides.setAttribute("GridType", appPrefs.guidesPrefs.gridType); |
15124 | cbradney | 1375 | deGuides.setAttribute("ShowGrid", static_cast<int>(appPrefs.guidesPrefs.gridShown)); |
1376 | deGuides.setAttribute("BaselineGridDistance", ScCLocale::toQStringC(appPrefs.guidesPrefs.valueBaselineGrid)); |
||
1377 | deGuides.setAttribute("BaselineGridOffset", ScCLocale::toQStringC(appPrefs.guidesPrefs.offsetBaselineGrid)); |
||
1378 | elem.appendChild(deGuides); |
||
1379 | |||
1380 | QDomElement deMiscellaneous=docu.createElement("Miscellaneous"); |
||
1381 | deMiscellaneous.setAttribute("ShowStylePreview", static_cast<int>(appPrefs.miscPrefs.haveStylePreview)); |
||
1382 | deMiscellaneous.setAttribute("LoremIpsumUseStandard", static_cast<int>(appPrefs.miscPrefs.useStandardLI)); |
||
1383 | deMiscellaneous.setAttribute("LoremIpsumParagraphs", appPrefs.miscPrefs.paragraphsLI); |
||
1384 | elem.appendChild(deMiscellaneous); |
||
1385 | |||
1386 | |||
1387 | |||
14823 | cbradney | 1388 | QDomElement deSE=docu.createElement("StoryEditor"); |
1389 | deSE.setAttribute("Font",appPrefs.storyEditorPrefs.guiFont); |
||
1390 | deSE.setAttribute("FontColorBackground",appPrefs.storyEditorPrefs.guiFontColorBackground.name()); |
||
1391 | deSE.setAttribute("SmartTextSelection",static_cast<int>(appPrefs.storyEditorPrefs.smartTextSelection)); |
||
1392 | elem.appendChild(deSE); |
||
14811 | cbradney | 1393 | |
15124 | cbradney | 1394 | QDomElement deDisplay=docu.createElement("Display"); |
19831 | craig | 1395 | deDisplay.setAttribute("ScratchBottom", ScCLocale::toQStringC(appPrefs.displayPrefs.scratch.bottom())); |
1396 | deDisplay.setAttribute("ScratchLeft", ScCLocale::toQStringC(appPrefs.displayPrefs.scratch.left())); |
||
1397 | deDisplay.setAttribute("ScratchRight", ScCLocale::toQStringC(appPrefs.displayPrefs.scratch.right())); |
||
1398 | deDisplay.setAttribute("ScratchTop", ScCLocale::toQStringC(appPrefs.displayPrefs.scratch.top())); |
||
15124 | cbradney | 1399 | deDisplay.setAttribute("PageGapHorizontal", ScCLocale::toQStringC(appPrefs.displayPrefs.pageGapHorizontal)); |
1400 | deDisplay.setAttribute("PageGapVertical", ScCLocale::toQStringC(appPrefs.displayPrefs.pageGapVertical)); |
||
1401 | deDisplay.setAttribute("ShowPageShadow",static_cast<int>(appPrefs.displayPrefs.showPageShadow)); |
||
1402 | deDisplay.setAttribute("PageColor",appPrefs.displayPrefs.paperColor.name()); |
||
15139 | cbradney | 1403 | deDisplay.setAttribute("ScratchColor",appPrefs.displayPrefs.scratchColor.name()); |
15124 | cbradney | 1404 | deDisplay.setAttribute("FrameSelectedColor",appPrefs.displayPrefs.frameColor.name()); |
1405 | deDisplay.setAttribute("FrameNormColor",appPrefs.displayPrefs.frameNormColor.name()); |
||
1406 | deDisplay.setAttribute("FrameGroupColor",appPrefs.displayPrefs.frameGroupColor.name()); |
||
1407 | deDisplay.setAttribute("FrameLockColor",appPrefs.displayPrefs.frameLockColor.name()); |
||
1408 | deDisplay.setAttribute("FrameLinkColor",appPrefs.displayPrefs.frameLinkColor.name()); |
||
1409 | deDisplay.setAttribute("FrameAnnotationColor",appPrefs.displayPrefs.frameAnnotationColor.name()); |
||
1410 | deDisplay.setAttribute("PageBorderColor",appPrefs.displayPrefs.pageBorderColor.name()); |
||
1411 | deDisplay.setAttribute("ControlCharColor",appPrefs.displayPrefs.controlCharColor.name()); |
||
1412 | deDisplay.setAttribute("ShowMarginsFilled", static_cast<int>(appPrefs.displayPrefs.marginColored)); |
||
15179 | jghali | 1413 | deDisplay.setAttribute("DisplayScale", ScCLocale::toQStringC(appPrefs.displayPrefs.displayScale, 8)); |
15124 | cbradney | 1414 | deDisplay.setAttribute("ShowVerifierWarningsOnCanvas",static_cast<int>(appPrefs.displayPrefs.showVerifierWarningsOnCanvas)); |
17805 | fschmid | 1415 | deDisplay.setAttribute("ShowAutosaveClockOnCanvas",static_cast<int>(appPrefs.displayPrefs.showAutosaveClockOnCanvas)); |
15124 | cbradney | 1416 | deDisplay.setAttribute("ToolTips", static_cast<int>(appPrefs.displayPrefs.showToolTips)); |
1417 | deDisplay.setAttribute("ShowMouseCoordinates", static_cast<int>(appPrefs.displayPrefs.showMouseCoordinates)); |
||
1418 | elem.appendChild(deDisplay); |
||
1419 | |||
1420 | // Font information must be written before Fonts element so that face "usable" |
||
14312 | jghali | 1421 | // member is set properly before one try to set default font. Allows to check |
1422 | // that default font is indeed usable, problems expected otherwise |
||
1423 | for ( SCFontsIterator itf(appPrefs.fontPrefs.AvailFonts); itf.hasNext(); itf.next()) |
||
1424 | { |
||
1425 | if (!itf.currentKey().isEmpty()) |
||
1426 | { |
||
15124 | cbradney | 1427 | QDomElement fn=docu.createElement("Font"); |
1428 | fn.setAttribute("Name",itf.currentKey()); |
||
1429 | fn.setAttribute("Embed",static_cast<int>(itf.current().embedPs())); |
||
1430 | fn.setAttribute("Use", static_cast<int>(itf.current().usable())); |
||
1431 | fn.setAttribute("Subset", static_cast<int>(itf.current().subset())); |
||
14312 | jghali | 1432 | elem.appendChild(fn); |
1433 | } |
||
1434 | } |
||
1435 | QMap<QString,QString>::Iterator itfsu; |
||
1436 | for (itfsu = appPrefs.fontPrefs.GFontSub.begin(); itfsu != appPrefs.fontPrefs.GFontSub.end(); ++itfsu) |
||
1437 | { |
||
1438 | QDomElement fosu = docu.createElement("Substitute"); |
||
1439 | fosu.setAttribute("Name",itfsu.key()); |
||
1440 | fosu.setAttribute("Replace",itfsu.value()); |
||
1441 | elem.appendChild(fosu); |
||
1442 | } |
||
15124 | cbradney | 1443 | |
1444 | QDomElement dcFonts=docu.createElement("Fonts"); |
||
1445 | dcFonts.setAttribute("AutomaticSubstitution", static_cast<int>(appPrefs.fontPrefs.askBeforeSubstitute)); |
||
1446 | elem.appendChild(dcFonts); |
||
1447 | |||
1448 | QDomElement dcTypography=docu.createElement("Typography"); |
||
1449 | dcTypography.setAttribute("SubScriptDistance",appPrefs.typoPrefs.valueSubScript); |
||
1450 | dcTypography.setAttribute("SubScriptScaling",appPrefs.typoPrefs.scalingSubScript); |
||
1451 | dcTypography.setAttribute("SuperScriptDistance",appPrefs.typoPrefs.valueSuperScript); |
||
1452 | dcTypography.setAttribute("SuperScriptScaling",appPrefs.typoPrefs.scalingSuperScript); |
||
1453 | dcTypography.setAttribute("SmallCapsScaling",appPrefs.typoPrefs.valueSmallCaps); |
||
1454 | dcTypography.setAttribute("AutomaticLineSpacing", appPrefs.typoPrefs.autoLineSpacing); |
||
13953 | cbradney | 1455 | if (appPrefs.typoPrefs.valueUnderlinePos == -1) |
15124 | cbradney | 1456 | dcTypography.setAttribute("UnderlineDistance", appPrefs.typoPrefs.valueUnderlinePos); |
2889 | cbradney | 1457 | else |
15124 | cbradney | 1458 | dcTypography.setAttribute("UnderlineDistance", appPrefs.typoPrefs.valueUnderlinePos / 10.0); |
13953 | cbradney | 1459 | if (appPrefs.typoPrefs.valueUnderlineWidth == -1) |
15124 | cbradney | 1460 | dcTypography.setAttribute("UnderlineWidth", appPrefs.typoPrefs.valueUnderlineWidth); |
2889 | cbradney | 1461 | else |
15124 | cbradney | 1462 | dcTypography.setAttribute("UnderlineWidth", appPrefs.typoPrefs.valueUnderlineWidth / 10.0); |
13953 | cbradney | 1463 | if (appPrefs.typoPrefs.valueStrikeThruPos == -1) |
15124 | cbradney | 1464 | dcTypography.setAttribute("StrikeThruDistance", appPrefs.typoPrefs.valueStrikeThruPos); |
2889 | cbradney | 1465 | else |
15124 | cbradney | 1466 | dcTypography.setAttribute("StrikeThruDistance", appPrefs.typoPrefs.valueStrikeThruPos / 10.0); |
13953 | cbradney | 1467 | if (appPrefs.typoPrefs.valueStrikeThruWidth == -1) |
15124 | cbradney | 1468 | dcTypography.setAttribute("StrikeThruWidth", appPrefs.typoPrefs.valueStrikeThruWidth); |
2889 | cbradney | 1469 | else |
15124 | cbradney | 1470 | dcTypography.setAttribute("StrikeThruWidth", appPrefs.typoPrefs.valueStrikeThruWidth / 10.0); |
1471 | elem.appendChild(dcTypography); |
||
1472 | |||
1473 | QDomElement dcItemTools=docu.createElement("ItemTools"); |
||
1474 | dcItemTools.setAttribute("ShapeLineColor",appPrefs.itemToolPrefs.shapeLineColor); |
||
1475 | dcItemTools.setAttribute("ShapeFillColor",appPrefs.itemToolPrefs.shapeFillColor); |
||
1476 | dcItemTools.setAttribute("LineColor",appPrefs.itemToolPrefs.lineColor); |
||
1477 | dcItemTools.setAttribute("TextColor",appPrefs.itemToolPrefs.textColor); |
||
1478 | dcItemTools.setAttribute("TextStrokeColor",appPrefs.itemToolPrefs.textStrokeColor); |
||
1479 | dcItemTools.setAttribute("TextBackgroundColor", appPrefs.itemToolPrefs.textFillColor); |
||
1480 | dcItemTools.setAttribute("TextLineColor", appPrefs.itemToolPrefs.textLineColor); |
||
1481 | dcItemTools.setAttribute("TextBackgroundColorShade", appPrefs.itemToolPrefs.textFillColorShade); |
||
1482 | dcItemTools.setAttribute("TextLineColorShade", appPrefs.itemToolPrefs.textLineColorShade); |
||
1483 | dcItemTools.setAttribute("TextColorShade", appPrefs.itemToolPrefs.textShade); |
||
1484 | dcItemTools.setAttribute("TextStrokeColorShade", appPrefs.itemToolPrefs.textStrokeShade); |
||
1485 | dcItemTools.setAttribute("TextColumnCount",appPrefs.itemToolPrefs.textColumns); |
||
1486 | dcItemTools.setAttribute("TextColumnGap",ScCLocale::toQStringC(appPrefs.itemToolPrefs.textColumnGap)); |
||
1487 | dcItemTools.setAttribute("TextTabWidth",ScCLocale::toQStringC(appPrefs.itemToolPrefs.textTabWidth)); |
||
19831 | craig | 1488 | dcItemTools.setAttribute("TextDistanceTop",ScCLocale::toQStringC(appPrefs.itemToolPrefs.textDistances.top())); |
1489 | dcItemTools.setAttribute("TextDistanceBottom",ScCLocale::toQStringC(appPrefs.itemToolPrefs.textDistances.bottom())); |
||
1490 | dcItemTools.setAttribute("TextDistanceLeft",ScCLocale::toQStringC(appPrefs.itemToolPrefs.textDistances.left())); |
||
1491 | dcItemTools.setAttribute("TextDistanceRight",ScCLocale::toQStringC(appPrefs.itemToolPrefs.textDistances.right())); |
||
15124 | cbradney | 1492 | dcItemTools.setAttribute("TabFillCharacter",appPrefs.itemToolPrefs.textTabFillChar); |
1493 | dcItemTools.setAttribute("ShapeLineStyle",appPrefs.itemToolPrefs.shapeLineStyle); |
||
1494 | dcItemTools.setAttribute("LineStyle",appPrefs.itemToolPrefs.lineStyle); |
||
1495 | dcItemTools.setAttribute("ShapeLineWidth",ScCLocale::toQStringC(appPrefs.itemToolPrefs.shapeLineWidth)); |
||
1496 | dcItemTools.setAttribute("LineWidth",ScCLocale::toQStringC(appPrefs.itemToolPrefs.lineWidth)); |
||
1497 | dcItemTools.setAttribute("ShapeLineColorShade",appPrefs.itemToolPrefs.shapeLineColorShade); |
||
1498 | dcItemTools.setAttribute("LineColorShade",appPrefs.itemToolPrefs.lineColorShade); |
||
1499 | dcItemTools.setAttribute("ShapeFillColorShade",appPrefs.itemToolPrefs.shapeFillColorShade); |
||
1500 | dcItemTools.setAttribute("ImageFillColor",appPrefs.itemToolPrefs.imageFillColor); |
||
1501 | dcItemTools.setAttribute("ImageFillColorShade",appPrefs.itemToolPrefs.imageFillColorShade); |
||
17054 | fschmid | 1502 | dcItemTools.setAttribute("ImageStrokeColor",appPrefs.itemToolPrefs.imageStrokeColor); |
1503 | dcItemTools.setAttribute("ImageStrokeColorShade",appPrefs.itemToolPrefs.imageStrokeColorShade); |
||
15124 | cbradney | 1504 | dcItemTools.setAttribute("ImageScaleX",ScCLocale::toQStringC(appPrefs.itemToolPrefs.imageScaleX)); |
1505 | dcItemTools.setAttribute("ImageScaleY",ScCLocale::toQStringC(appPrefs.itemToolPrefs.imageScaleY)); |
||
1506 | dcItemTools.setAttribute("PolygonCorners", appPrefs.itemToolPrefs.polyCorners); |
||
1507 | dcItemTools.setAttribute("PolygonFactor", ScCLocale::toQStringC(appPrefs.itemToolPrefs.polyFactor)); |
||
1508 | dcItemTools.setAttribute("PolygonRotation", ScCLocale::toQStringC(appPrefs.itemToolPrefs.polyRotation)); |
||
16191 | fschmid | 1509 | dcItemTools.setAttribute("PolygonInnerRotation", ScCLocale::toQStringC(appPrefs.itemToolPrefs.polyInnerRot)); |
15124 | cbradney | 1510 | dcItemTools.setAttribute("PolygonCurvature", ScCLocale::toQStringC(appPrefs.itemToolPrefs.polyCurvature)); |
16192 | fschmid | 1511 | dcItemTools.setAttribute("PolygonOuterCurvature", ScCLocale::toQStringC(appPrefs.itemToolPrefs.polyOuterCurvature)); |
16525 | craig | 1512 | dcItemTools.setAttribute("ArcStartAngle", ScCLocale::toQStringC(appPrefs.itemToolPrefs.arcStartAngle)); |
1513 | dcItemTools.setAttribute("ArcSweepAngle", ScCLocale::toQStringC(appPrefs.itemToolPrefs.arcSweepAngle)); |
||
1514 | dcItemTools.setAttribute("SpiralStartAngle", ScCLocale::toQStringC(appPrefs.itemToolPrefs.spiralStartAngle)); |
||
1515 | dcItemTools.setAttribute("SpiralEndAngle", ScCLocale::toQStringC(appPrefs.itemToolPrefs.spiralEndAngle)); |
||
1516 | dcItemTools.setAttribute("SpiralFactor", ScCLocale::toQStringC(appPrefs.itemToolPrefs.spiralFactor)); |
||
15124 | cbradney | 1517 | dcItemTools.setAttribute("PolygonUseFactor", static_cast<int>(appPrefs.itemToolPrefs.polyUseFactor)); |
1518 | dcItemTools.setAttribute("ImageScaleType", static_cast<int>(appPrefs.itemToolPrefs.imageScaleType)); |
||
1519 | dcItemTools.setAttribute("ImageAspectRatio", static_cast<int>(appPrefs.itemToolPrefs.imageAspectRatio)); |
||
1520 | dcItemTools.setAttribute("ImageUseEmbeddedPath", static_cast<int>(appPrefs.itemToolPrefs.imageUseEmbeddedPath)); |
||
1521 | dcItemTools.setAttribute("ImageLowResType", appPrefs.itemToolPrefs.imageLowResType); |
||
1522 | dcItemTools.setAttribute("LineStartArrow", appPrefs.itemToolPrefs.lineStartArrow); |
||
1523 | dcItemTools.setAttribute("LineEndArrow", appPrefs.itemToolPrefs.lineEndArrow); |
||
1524 | dcItemTools.setAttribute("FontFace",appPrefs.itemToolPrefs.textFont); |
||
1525 | dcItemTools.setAttribute("FontSize",appPrefs.itemToolPrefs.textSize / 10.0); |
||
19378 | craig | 1526 | dcItemTools.setAttribute("CalligraphicPenFillColor", appPrefs.itemToolPrefs.calligraphicPenFillColor); |
1527 | dcItemTools.setAttribute("CalligraphicPenLineColor", appPrefs.itemToolPrefs.calligraphicPenLineColor); |
||
1528 | dcItemTools.setAttribute("CalligraphicPenFillColorShade", appPrefs.itemToolPrefs.calligraphicPenFillColorShade); |
||
1529 | dcItemTools.setAttribute("CalligraphicPenLineColorShade", appPrefs.itemToolPrefs.calligraphicPenLineColorShade); |
||
1530 | dcItemTools.setAttribute("CalligraphicPenLineWidth", appPrefs.itemToolPrefs.calligraphicPenLineWidth); |
||
1531 | dcItemTools.setAttribute("CalligraphicPenAngle", appPrefs.itemToolPrefs.calligraphicPenAngle); |
||
1532 | dcItemTools.setAttribute("CalligraphicPenWidth", appPrefs.itemToolPrefs.calligraphicPenWidth); |
||
1533 | dcItemTools.setAttribute("CalligraphicPenStyle",appPrefs.itemToolPrefs.calligraphicPenStyle); |
||
15124 | cbradney | 1534 | elem.appendChild(dcItemTools); |
1535 | |||
1536 | QDomElement dcOperatorTools=docu.createElement("OperatorTools"); |
||
1537 | dcOperatorTools.setAttribute("MinimumMagnification",appPrefs.opToolPrefs.magMin); |
||
1538 | dcOperatorTools.setAttribute("MaximumMagnification",appPrefs.opToolPrefs.magMax); |
||
1539 | dcOperatorTools.setAttribute("MagnificationStep",appPrefs.opToolPrefs.magStep); |
||
1540 | dcOperatorTools.setAttribute("DisplayOffsetX", ScCLocale::toQStringC(appPrefs.opToolPrefs.dispX)); |
||
1541 | dcOperatorTools.setAttribute("DisplayOffsetY", ScCLocale::toQStringC(appPrefs.opToolPrefs.dispY)); |
||
1542 | dcOperatorTools.setAttribute("RotationConstrainAngle", ScCLocale::toQStringC(appPrefs.opToolPrefs.constrain)); |
||
1543 | elem.appendChild(dcOperatorTools); |
||
1544 | |||
1545 | QDomElement dcMainWindow=docu.createElement("MainWindow"); |
||
1546 | dcMainWindow.setAttribute("XPosition",appPrefs.uiPrefs.mainWinSettings.xPosition); |
||
1547 | dcMainWindow.setAttribute("YPosition",appPrefs.uiPrefs.mainWinSettings.yPosition); |
||
1548 | dcMainWindow.setAttribute("Width",appPrefs.uiPrefs.mainWinSettings.width); |
||
1549 | dcMainWindow.setAttribute("Height",appPrefs.uiPrefs.mainWinSettings.height); |
||
1550 | dcMainWindow.setAttribute("Maximized",static_cast<int>(appPrefs.uiPrefs.mainWinSettings.maximized)); |
||
1551 | elem.appendChild(dcMainWindow); |
||
1552 | |||
1553 | QDomElement dcScrapbook=docu.createElement("ScrapBook"); |
||
1554 | dcScrapbook.setAttribute("CopyToScrapbook",static_cast<int>(appPrefs.scrapbookPrefs.doCopyToScrapbook)); |
||
1555 | dcScrapbook.setAttribute("PersistentScrapbook",static_cast<int>(appPrefs.scrapbookPrefs.persistentScrapbook)); |
||
1556 | dcScrapbook.setAttribute("WritePreviews",static_cast<int>(appPrefs.scrapbookPrefs.writePreviews)); |
||
1557 | dcScrapbook.setAttribute("ScrapbookCopies",appPrefs.scrapbookPrefs.numScrapbookCopies); |
||
1558 | for (int i=0; i<appPrefs.scrapbookPrefs.RecentScrapbooks.count(); ++i) |
||
4735 | fschmid | 1559 | { |
15124 | cbradney | 1560 | QDomElement rde=docu.createElement("Recent"); |
1561 | rde.setAttribute("Name",appPrefs.scrapbookPrefs.RecentScrapbooks[i]); |
||
1562 | dcScrapbook.appendChild(rde); |
||
4735 | fschmid | 1563 | } |
15124 | cbradney | 1564 | elem.appendChild(dcScrapbook); |
1565 | |||
1566 | |||
3016 | fschmid | 1567 | QDomElement pageSetAttr = docu.createElement("PageSets"); |
9803 | fschmid | 1568 | QList<PageSet>::Iterator itpgset; |
3016 | fschmid | 1569 | for(itpgset = appPrefs.pageSets.begin(); itpgset != appPrefs.pageSets.end(); ++itpgset ) |
1570 | { |
||
1571 | QDomElement pgst = docu.createElement("Set"); |
||
1572 | pgst.setAttribute("Name", (*itpgset).Name); |
||
1573 | pgst.setAttribute("FirstPage", (*itpgset).FirstPage); |
||
1574 | pgst.setAttribute("Rows", (*itpgset).Rows); |
||
1575 | pgst.setAttribute("Columns", (*itpgset).Columns); |
||
11349 | fschmid | 1576 | // pgst.setAttribute("GapHorizontal", (*itpgset).GapHorizontal); |
1577 | // pgst.setAttribute("GapVertical", (*itpgset).GapVertical); |
||
1578 | // pgst.setAttribute("GapBelow", (*itpgset).GapBelow); |
||
3026 | fschmid | 1579 | QStringList pNames = (*itpgset).pageNames; |
1580 | QStringList::Iterator itpgsetN; |
||
1581 | for(itpgsetN = pNames.begin(); itpgsetN != pNames.end(); ++itpgsetN ) |
||
1582 | { |
||
1583 | QDomElement pgstN = docu.createElement("PageNames"); |
||
1584 | pgstN.setAttribute("Name", (*itpgsetN)); |
||
1585 | pgst.appendChild(pgstN); |
||
1586 | } |
||
3016 | fschmid | 1587 | pageSetAttr.appendChild(pgst); |
1588 | } |
||
1589 | elem.appendChild(pageSetAttr); |
||
15124 | cbradney | 1590 | |
1591 | QDomElement dcPreflightVerifier=docu.createElement("PreflightVerifier"); |
||
1592 | dcPreflightVerifier.setAttribute("CurrentProfile", appPrefs.verifierPrefs.curCheckProfile); |
||
1593 | dcPreflightVerifier.setAttribute("ShowPagesWithoutErrors", appPrefs.verifierPrefs.showPagesWithoutErrors); |
||
1594 | dcPreflightVerifier.setAttribute("ShowNonPrintingLayerErrors", appPrefs.verifierPrefs.showNonPrintingLayerErrors); |
||
1595 | elem.appendChild(dcPreflightVerifier); |
||
1596 | |||
3033 | cbradney | 1597 | CheckerPrefsList::Iterator itcp; |
14849 | cbradney | 1598 | CheckerPrefsList::Iterator itcpend=appPrefs.verifierPrefs.checkerPrefsList.end(); |
1599 | for (itcp = appPrefs.verifierPrefs.checkerPrefsList.begin(); itcp != itcpend; ++itcp) |
||
2889 | cbradney | 1600 | { |
15124 | cbradney | 1601 | QDomElement dcVerifierProfile=docu.createElement("VerifierProfile"); |
1602 | dcVerifierProfile.setAttribute("Name",itcp.key()); |
||
1603 | dcVerifierProfile.setAttribute("IgnoreErrors", static_cast<int>(itcp.value().ignoreErrors)); |
||
1604 | dcVerifierProfile.setAttribute("AutoCheck", static_cast<int>(itcp.value().autoCheck)); |
||
1605 | dcVerifierProfile.setAttribute("CheckGlyphs", static_cast<int>(itcp.value().checkGlyphs)); |
||
1606 | dcVerifierProfile.setAttribute("CheckOrphans", static_cast<int>(itcp.value().checkOrphans)); |
||
1607 | dcVerifierProfile.setAttribute("CheckOverflow", static_cast<int>(itcp.value().checkOverflow)); |
||
1608 | dcVerifierProfile.setAttribute("CheckPictures", static_cast<int>(itcp.value().checkPictures)); |
||
1609 | dcVerifierProfile.setAttribute("CheckResolution", static_cast<int>(itcp.value().checkResolution)); |
||
16357 | petr | 1610 | dcVerifierProfile.setAttribute("CheckPartFilledImageFrames", static_cast<int>(itcp.value().checkPartFilledImageFrames)); |
15124 | cbradney | 1611 | dcVerifierProfile.setAttribute("CheckTransparency", static_cast<int>(itcp.value().checkTransparency)); |
1612 | dcVerifierProfile.setAttribute("CheckAnnotations", static_cast<int>(itcp.value().checkAnnotations)); |
||
1613 | dcVerifierProfile.setAttribute("CheckRasterPDF", static_cast<int>(itcp.value().checkRasterPDF)); |
||
1614 | dcVerifierProfile.setAttribute("CheckForGIF", static_cast<int>(itcp.value().checkForGIF)); |
||
1615 | dcVerifierProfile.setAttribute("IgnoreOffLayers", static_cast<int>(itcp.value().ignoreOffLayers)); |
||
1616 | dcVerifierProfile.setAttribute("CheckOffConflictLayers", static_cast<int>(itcp.value().checkOffConflictLayers)); |
||
1617 | dcVerifierProfile.setAttribute("MinimumResolution",ScCLocale::toQStringC(itcp.value().minResolution)); |
||
1618 | dcVerifierProfile.setAttribute("MaximumResolution",ScCLocale::toQStringC(itcp.value().maxResolution)); |
||
1619 | dcVerifierProfile.setAttribute("CheckNotCMYKOrSpot", static_cast<int>(itcp.value().checkNotCMYKOrSpot)); |
||
18410 | jghali | 1620 | dcVerifierProfile.setAttribute("CheckDeviceColorsAndOutputIntent", static_cast<int>(itcp.value().checkDeviceColorsAndOutputIntent)); |
15124 | cbradney | 1621 | dcVerifierProfile.setAttribute("CheckFontNotEmbedded", static_cast<int>(itcp.value().checkFontNotEmbedded)); |
1622 | dcVerifierProfile.setAttribute("CheckFontIsOpenType", static_cast<int>(itcp.value().checkFontIsOpenType)); |
||
18490 | craig | 1623 | dcVerifierProfile.setAttribute("CheckAppliedMasterDifferentSide", static_cast<int>(itcp.value().checkAppliedMasterDifferentSide)); |
18491 | craig | 1624 | dcVerifierProfile.setAttribute("CheckEmptyTextFrames", static_cast<int>(itcp.value().checkEmptyTextFrames)); |
15124 | cbradney | 1625 | elem.appendChild(dcVerifierProfile); |
2889 | cbradney | 1626 | } |
15124 | cbradney | 1627 | QDomElement dcColorManagement=docu.createElement("ColorManagement"); |
1628 | dcColorManagement.setAttribute("SoftProofOn", static_cast<int>(appPrefs.colorPrefs.DCMSset.SoftProofOn)); |
||
1629 | dcColorManagement.setAttribute("SoftProofFullOn", static_cast<int>(appPrefs.colorPrefs.DCMSset.SoftProofFullOn)); |
||
1630 | dcColorManagement.setAttribute("ColorManagementActive", static_cast<int>(appPrefs.colorPrefs.DCMSset.CMSinUse)); |
||
1631 | dcColorManagement.setAttribute("GamutCheck", static_cast<int>(appPrefs.colorPrefs.DCMSset.GamutCheck)); |
||
1632 | dcColorManagement.setAttribute("BlackPoint", static_cast<int>(appPrefs.colorPrefs.DCMSset.BlackPoint)); |
||
1633 | dcColorManagement.setAttribute("DefaultMonitorProfile",appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile); |
||
1634 | dcColorManagement.setAttribute("DefaultPrinterProfile",appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile); |
||
1635 | dcColorManagement.setAttribute("DefaultImageRGBProfile",appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile); |
||
1636 | dcColorManagement.setAttribute("DefaultImageCMYKProfile",appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile); |
||
1637 | dcColorManagement.setAttribute("DefaultSolidColorRGBProfile",appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile); |
||
1638 | dcColorManagement.setAttribute("DefaultSolorColorCMYKProfile",appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile); |
||
1639 | dcColorManagement.setAttribute("DefaultIntentColors",appPrefs.colorPrefs.DCMSset.DefaultIntentColors); |
||
1640 | dcColorManagement.setAttribute("DefaultIntentImages",appPrefs.colorPrefs.DCMSset.DefaultIntentImages); |
||
1641 | elem.appendChild(dcColorManagement); |
||
1642 | |||
1643 | QDomElement dcPrinter=docu.createElement("Printer"); |
||
1644 | dcPrinter.setAttribute("Name",appPrefs.printerPrefs.PrinterName); |
||
1645 | dcPrinter.setAttribute("File",appPrefs.printerPrefs.PrinterFile); |
||
1646 | dcPrinter.setAttribute("Command",appPrefs.printerPrefs.PrinterCommand); |
||
1647 | dcPrinter.setAttribute("ClipToMargins", static_cast<int>(appPrefs.printerPrefs.ClipMargin)); |
||
1648 | dcPrinter.setAttribute("GCRMode", static_cast<int>(appPrefs.printerPrefs.GCRMode)); |
||
1649 | elem.appendChild(dcPrinter); |
||
1650 | |||
1651 | QDomElement dc8Pr=docu.createElement("PrintPreview"); |
||
13967 | cbradney | 1652 | dc8Pr.setAttribute("Mode", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_Mode)); |
1653 | //dc8Pr.setAttribute("GcrMode", static_cast<int>(appPrefs.Gcr_Mode)); |
||
1654 | dc8Pr.setAttribute("AntiAliasing", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_AntiAliasing)); |
||
1655 | dc8Pr.setAttribute("Transparency", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_Transparency)); |
||
1656 | dc8Pr.setAttribute("Cyan", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_C)); |
||
1657 | dc8Pr.setAttribute("Magenta", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_M)); |
||
1658 | dc8Pr.setAttribute("Yellow", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_Y)); |
||
1659 | dc8Pr.setAttribute("Black", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_K)); |
||
1660 | dc8Pr.setAttribute("InkCoverage", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_InkCoverage)); |
||
1661 | dc8Pr.setAttribute("InkThreshold", appPrefs.printPreviewPrefs.PrPr_InkThreshold); |
||
2889 | cbradney | 1662 | elem.appendChild(dc8Pr); |
15130 | cbradney | 1663 | QDomElement dcExternalTools = docu.createElement("ExternalTools"); |
1664 | dcExternalTools.setAttribute("ImageEditor", imageEditorExecutable()); |
||
1665 | dcExternalTools.setAttribute("Ghostscript", ghostscriptExecutable()); |
||
1666 | dcExternalTools.setAttribute("WebBrowser", extBrowserExecutable()); |
||
1667 | dcExternalTools.setAttribute("GhostscriptAntiAliasGraphics", static_cast<int>(appPrefs.extToolPrefs.gs_AntiAliasGraphics)); |
||
1668 | dcExternalTools.setAttribute("GhostscriptAntiAliasText", static_cast<int>(appPrefs.extToolPrefs.gs_AntiAliasText)); |
||
1669 | dcExternalTools.setAttribute("Resolution", appPrefs.extToolPrefs.gs_Resolution); |
||
1670 | dcExternalTools.setAttribute("Uniconvertor", uniconvExecutable()); |
||
1671 | dcExternalTools.setAttribute("PDFViewer", appPrefs.extToolPrefs.pdfViewerExecutable); |
||
1672 | dcExternalTools.setAttribute("LatexEditor", latexEditorExecutable()); |
||
1673 | dcExternalTools.setAttribute("LatexResolution", latexResolution()); |
||
1674 | dcExternalTools.setAttribute("LatexForceDpi", static_cast<int>(appPrefs.extToolPrefs.latexForceDpi)); |
||
1675 | dcExternalTools.setAttribute("LatexStartWithEmptyFrames", static_cast<int>(appPrefs.extToolPrefs.latexStartWithEmptyFrames)); |
||
11506 | mrdocs | 1676 | QStringList configs = latexConfigs(); |
1677 | foreach (QString config, configs) { |
||
1678 | QDomElement domConfig = docu.createElement("LatexConfig"); |
||
1679 | domConfig.setAttribute("file", config); |
||
13955 | cbradney | 1680 | domConfig.setAttribute("command", appPrefs.extToolPrefs.latexCommands[config]); |
15130 | cbradney | 1681 | dcExternalTools.appendChild(domConfig); |
11506 | mrdocs | 1682 | } |
15130 | cbradney | 1683 | elem.appendChild(dcExternalTools); |
15124 | cbradney | 1684 | QDomElement rde=docu.createElement("Hyphenator"); |
1685 | rde.setAttribute("Language", appPrefs.hyphPrefs.Language); |
||
1686 | rde.setAttribute("WordLength", appPrefs.hyphPrefs.MinWordLen); |
||
1687 | rde.setAttribute("HyphenCount", appPrefs.hyphPrefs.HyCount); |
||
1688 | rde.setAttribute("Automatic", static_cast<int>(appPrefs.hyphPrefs.Automatic)); |
||
1689 | rde.setAttribute("AutomaticCheck", static_cast<int>(appPrefs.hyphPrefs.AutoCheck)); |
||
13955 | cbradney | 1690 | for (QHash<QString, QString>::Iterator hyit = appPrefs.hyphPrefs.specialWords.begin(); hyit != appPrefs.hyphPrefs.specialWords.end(); ++hyit) |
10170 | fschmid | 1691 | { |
15124 | cbradney | 1692 | QDomElement hyelm = docu.createElement("Exception"); |
1693 | hyelm.setAttribute("Word", hyit.key()); |
||
1694 | hyelm.setAttribute("Hyphenated", hyit.value()); |
||
10170 | fschmid | 1695 | rde.appendChild(hyelm); |
1696 | } |
||
13955 | cbradney | 1697 | for (QSet<QString>::Iterator hyit2 = appPrefs.hyphPrefs.ignoredWords.begin(); hyit2 != appPrefs.hyphPrefs.ignoredWords.end(); ++hyit2) |
10170 | fschmid | 1698 | { |
15124 | cbradney | 1699 | QDomElement hyelm2 = docu.createElement("Ignore"); |
1700 | hyelm2.setAttribute("Word", (*hyit2)); |
||
10170 | fschmid | 1701 | rde.appendChild(hyelm2); |
1702 | } |
||
2889 | cbradney | 1703 | elem.appendChild(rde); |
13955 | cbradney | 1704 | for (int rd=0; rd<appPrefs.uiPrefs.RecentDocs.count(); ++rd) |
2889 | cbradney | 1705 | { |
15124 | cbradney | 1706 | QDomElement rde=docu.createElement("Recent"); |
1707 | rde.setAttribute("Name",appPrefs.uiPrefs.RecentDocs[rd]); |
||
2889 | cbradney | 1708 | elem.appendChild(rde); |
1709 | } |
||
13955 | cbradney | 1710 | for (QMap<QString,Keys>::Iterator ksc=appPrefs.keyShortcutPrefs.KeyActions.begin(); ksc!=appPrefs.keyShortcutPrefs.KeyActions.end(); ++ksc) |
2889 | cbradney | 1711 | { |
10398 | cbradney | 1712 | if (ksc.value().actionName.isEmpty()) |
5354 | cbradney | 1713 | continue; |
15124 | cbradney | 1714 | QDomElement kscc=docu.createElement("Shortcut"); |
1715 | kscc.setAttribute("Action",ksc.value().actionName); |
||
17864 | jghali | 1716 | kscc.setAttribute("KeySequence", Prefs_KeyboardShortcuts::getKeyText(ksc.value().keySequence)); |
2889 | cbradney | 1717 | elem.appendChild(kscc); |
1718 | } |
||
15124 | cbradney | 1719 | QDomElement cosd=docu.createElement("DefaultColorSet"); |
15216 | cbradney | 1720 | cosd.setAttribute("Name",appPrefs.colorPrefs.DColorSet); |
2889 | cbradney | 1721 | elem.appendChild(cosd); |
15124 | cbradney | 1722 | |
2889 | cbradney | 1723 | QDomElement pdf = docu.createElement("PDF"); |
13955 | cbradney | 1724 | pdf.setAttribute("Thumbnails", static_cast<int>(appPrefs.pdfPrefs.Thumbnails)); |
1725 | pdf.setAttribute("Articles", static_cast<int>(appPrefs.pdfPrefs.Articles)); |
||
1726 | pdf.setAttribute("Bookmarks", static_cast<int>(appPrefs.pdfPrefs.Bookmarks)); |
||
1727 | pdf.setAttribute("Compress", static_cast<int>(appPrefs.pdfPrefs.Compress)); |
||
15124 | cbradney | 1728 | pdf.setAttribute("CompressionMethod", appPrefs.pdfPrefs.CompressMethod); |
13955 | cbradney | 1729 | pdf.setAttribute("Quality", appPrefs.pdfPrefs.Quality); |
1730 | pdf.setAttribute("EmbedPDF", static_cast<int>(appPrefs.pdfPrefs.embedPDF)); |
||
15124 | cbradney | 1731 | pdf.setAttribute("MirrorPagesHorizontal", static_cast<int>(appPrefs.pdfPrefs.MirrorH)); |
1732 | pdf.setAttribute("MirrorPagesVertical", static_cast<int>(appPrefs.pdfPrefs.MirrorV)); |
||
1733 | pdf.setAttribute("DoClip", static_cast<int>(appPrefs.pdfPrefs.doClip)); |
||
13955 | cbradney | 1734 | pdf.setAttribute("RotateDeg", static_cast<int>(appPrefs.pdfPrefs.RotateDeg)); |
1735 | pdf.setAttribute("PresentMode", static_cast<int>(appPrefs.pdfPrefs.PresentMode)); |
||
1736 | pdf.setAttribute("RecalcPic", static_cast<int>(appPrefs.pdfPrefs.RecalcPic)); |
||
1737 | pdf.setAttribute("Grayscale", static_cast<int>(appPrefs.pdfPrefs.isGrayscale)); |
||
1738 | pdf.setAttribute("RGBMode", static_cast<int>(appPrefs.pdfPrefs.UseRGB)); |
||
1739 | pdf.setAttribute("UseProfiles", static_cast<int>(appPrefs.pdfPrefs.UseProfiles)); |
||
1740 | pdf.setAttribute("UseProfiles2", static_cast<int>(appPrefs.pdfPrefs.UseProfiles2)); |
||
1741 | pdf.setAttribute("Binding", appPrefs.pdfPrefs.Binding); |
||
1742 | pdf.setAttribute("PicRes", appPrefs.pdfPrefs.PicRes); |
||
1743 | pdf.setAttribute("Resolution", appPrefs.pdfPrefs.Resolution); |
||
1744 | pdf.setAttribute("Version", appPrefs.pdfPrefs.Version); |
||
20122 | jghali | 1745 | pdf.setAttribute("FontEmbedding", static_cast<int>(appPrefs.pdfPrefs.FontEmbedding)); |
13955 | cbradney | 1746 | pdf.setAttribute("Intent", appPrefs.pdfPrefs.Intent); |
1747 | pdf.setAttribute("Intent2", appPrefs.pdfPrefs.Intent2); |
||
15124 | cbradney | 1748 | pdf.setAttribute("SolidProfile", appPrefs.pdfPrefs.SolidProf); |
1749 | pdf.setAttribute("ImageProfile", appPrefs.pdfPrefs.ImageProf); |
||
1750 | pdf.setAttribute("PrintProfile", appPrefs.pdfPrefs.PrintProf); |
||
13955 | cbradney | 1751 | pdf.setAttribute("InfoString", appPrefs.pdfPrefs.Info); |
19831 | craig | 1752 | pdf.setAttribute("BleedTop", ScCLocale::toQStringC(appPrefs.pdfPrefs.bleeds.top())); |
1753 | pdf.setAttribute("BleedLeft", ScCLocale::toQStringC(appPrefs.pdfPrefs.bleeds.left())); |
||
1754 | pdf.setAttribute("BleedRight", ScCLocale::toQStringC(appPrefs.pdfPrefs.bleeds.right())); |
||
1755 | pdf.setAttribute("BleedBottom", ScCLocale::toQStringC(appPrefs.pdfPrefs.bleeds.bottom())); |
||
15124 | cbradney | 1756 | pdf.setAttribute("UseDocBleeds", static_cast<int>(appPrefs.pdfPrefs.useDocBleeds)); |
1757 | pdf.setAttribute("CropMarks", static_cast<int>(appPrefs.pdfPrefs.cropMarks)); |
||
1758 | pdf.setAttribute("BleedMarks", static_cast<int>(appPrefs.pdfPrefs.bleedMarks)); |
||
1759 | pdf.setAttribute("RegistrationMarks", static_cast<int>(appPrefs.pdfPrefs.registrationMarks)); |
||
1760 | pdf.setAttribute("ColorMarks", static_cast<int>(appPrefs.pdfPrefs.colorMarks)); |
||
1761 | pdf.setAttribute("DocInfoMarks", static_cast<int>(appPrefs.pdfPrefs.docInfoMarks)); |
||
17401 | jghali | 1762 | pdf.setAttribute("MarkLength", appPrefs.pdfPrefs.markLength); |
15124 | cbradney | 1763 | pdf.setAttribute("MarkOffset", appPrefs.pdfPrefs.markOffset); |
13955 | cbradney | 1764 | pdf.setAttribute("ImagePr", static_cast<int>(appPrefs.pdfPrefs.EmbeddedI)); |
1765 | pdf.setAttribute("PassOwner", appPrefs.pdfPrefs.PassOwner); |
||
1766 | pdf.setAttribute("PassUser", appPrefs.pdfPrefs.PassUser); |
||
1767 | pdf.setAttribute("Permissions", appPrefs.pdfPrefs.Permissions); |
||
1768 | pdf.setAttribute("Encrypt", static_cast<int>(appPrefs.pdfPrefs.Encrypt)); |
||
1769 | pdf.setAttribute("UseLayers", static_cast<int>(appPrefs.pdfPrefs.useLayers)); |
||
1770 | pdf.setAttribute("UseLpi", static_cast<int>(appPrefs.pdfPrefs.UseLPI)); |
||
1771 | pdf.setAttribute("UseSpotColors", static_cast<int>(appPrefs.pdfPrefs.UseSpotColors)); |
||
15124 | cbradney | 1772 | pdf.setAttribute("DoMultiFile", static_cast<int>(appPrefs.pdfPrefs.doMultiFile)); |
1773 | pdf.setAttribute("DisplayBookmarks", static_cast<int>(appPrefs.pdfPrefs.displayBookmarks)); |
||
1774 | pdf.setAttribute("DisplayFullscreen", static_cast<int>(appPrefs.pdfPrefs.displayFullscreen)); |
||
1775 | pdf.setAttribute("DisplayLayers", static_cast<int>(appPrefs.pdfPrefs.displayLayers)); |
||
1776 | pdf.setAttribute("DisplayThumbs", static_cast<int>(appPrefs.pdfPrefs.displayThumbs)); |
||
16204 | fschmid | 1777 | pdf.setAttribute("hideMenuBar", static_cast<int>(appPrefs.pdfPrefs.hideMenuBar)); |
1778 | pdf.setAttribute("hideToolBar", static_cast<int>(appPrefs.pdfPrefs.hideToolBar)); |
||
1779 | pdf.setAttribute("fitWindow", static_cast<int>(appPrefs.pdfPrefs.fitWindow)); |
||
1780 | pdf.setAttribute("openAfterExport", static_cast<int>(appPrefs.pdfPrefs.openAfterExport)); |
||
13955 | cbradney | 1781 | pdf.setAttribute("PageLayout", appPrefs.pdfPrefs.PageLayout); |
15124 | cbradney | 1782 | pdf.setAttribute("OpenAction", appPrefs.pdfPrefs.openAction); |
2889 | cbradney | 1783 | QMap<QString,LPIData>::Iterator itlp; |
13955 | cbradney | 1784 | for (itlp = appPrefs.pdfPrefs.LPISettings.begin(); itlp != appPrefs.pdfPrefs.LPISettings.end(); ++itlp) |
2889 | cbradney | 1785 | { |
1786 | QDomElement pdf4 = docu.createElement("LPI"); |
||
1787 | pdf4.setAttribute("Color", itlp.key()); |
||
10398 | cbradney | 1788 | pdf4.setAttribute("Frequency", itlp.value().Frequency); |
1789 | pdf4.setAttribute("Angle", itlp.value().Angle); |
||
1790 | pdf4.setAttribute("SpotFunction", itlp.value().SpotFunc); |
||
2889 | cbradney | 1791 | pdf.appendChild(pdf4); |
1792 | } |
||
1793 | elem.appendChild(pdf); |
||
1794 | QDomElement docItemAttrs = docu.createElement("DefaultItemAttributes"); |
||
13955 | cbradney | 1795 | for(ObjAttrVector::Iterator objAttrIt = appPrefs.itemAttrPrefs.defaultItemAttributes.begin() ; objAttrIt != appPrefs.itemAttrPrefs.defaultItemAttributes.end(); ++objAttrIt ) |
2889 | cbradney | 1796 | { |
1797 | QDomElement itemAttr = docu.createElement("ItemAttribute"); |
||
1798 | itemAttr.setAttribute("Name", (*objAttrIt).name); |
||
1799 | itemAttr.setAttribute("Type", (*objAttrIt).type); |
||
1800 | itemAttr.setAttribute("Value", (*objAttrIt).value); |
||
1801 | itemAttr.setAttribute("Parameter", (*objAttrIt).parameter); |
||
1802 | itemAttr.setAttribute("Relationship", (*objAttrIt).relationship); |
||
1803 | itemAttr.setAttribute("RelationshipTo", (*objAttrIt).relationshipto); |
||
1804 | itemAttr.setAttribute("AutoAddTo", (*objAttrIt).autoaddto); |
||
1805 | docItemAttrs.appendChild(itemAttr); |
||
1806 | } |
||
1807 | elem.appendChild(docItemAttrs); |
||
1808 | QDomElement tocElem = docu.createElement("TablesOfContents"); |
||
13955 | cbradney | 1809 | for(ToCSetupVector::Iterator tocSetupIt = appPrefs.tocPrefs.defaultToCSetups.begin() ; tocSetupIt != appPrefs.tocPrefs.defaultToCSetups.end(); ++tocSetupIt ) |
2889 | cbradney | 1810 | { |
1811 | QDomElement tocsetup = docu.createElement("TableOfContents"); |
||
1812 | tocsetup.setAttribute("Name", (*tocSetupIt).name); |
||
1813 | tocsetup.setAttribute("ItemAttributeName", (*tocSetupIt).itemAttrName); |
||
1814 | tocsetup.setAttribute("FrameName", (*tocSetupIt).frameName); |
||
1815 | tocsetup.setAttribute("ListNonPrinting", (*tocSetupIt).listNonPrintingFrames); |
||
1816 | tocsetup.setAttribute("Style", (*tocSetupIt).textStyle); |
||
1817 | tocsetup.setAttribute("NumberPlacement", (*tocSetupIt).pageLocation); |
||
1818 | tocElem.appendChild(tocsetup); |
||
1819 | } |
||
1820 | elem.appendChild(tocElem); |
||
15124 | cbradney | 1821 | |
14539 | jghali | 1822 | // image cache |
1823 | QDomElement icElem = docu.createElement("ImageCache"); |
||
15124 | cbradney | 1824 | icElem.setAttribute("Enabled", appPrefs.imageCachePrefs.cacheEnabled); |
1825 | icElem.setAttribute("MaximumCacheSizeMiB", appPrefs.imageCachePrefs.maxCacheSizeMiB); |
||
1826 | icElem.setAttribute("MaximumCacheEntries", appPrefs.imageCachePrefs.maxCacheEntries); |
||
1827 | icElem.setAttribute("CompressionLevel", appPrefs.imageCachePrefs.compressionLevel); |
||
14539 | jghali | 1828 | elem.appendChild(icElem); |
15105 | cbradney | 1829 | // active page sizes |
1830 | QDomElement apsElem = docu.createElement("ActivePageSizes"); |
||
15124 | cbradney | 1831 | apsElem.setAttribute("Names", appPrefs.activePageSizes.join(",")); |
15105 | cbradney | 1832 | elem.appendChild(apsElem); |
1833 | |||
2889 | cbradney | 1834 | // write file |
3170 | craig | 1835 | bool result = false; |
2889 | cbradney | 1836 | QFile f(ho); |
8501 | cbradney | 1837 | if(!f.open(QIODevice::WriteOnly)) |
3170 | craig | 1838 | { |
1839 | m_lastError = tr("Could not open preferences file \"%1\" for writing: %2") |
||
10553 | fschmid | 1840 | .arg(ho).arg(qApp->translate("QFile",f.errorString().toLatin1().constData())); |
3170 | craig | 1841 | } |
1842 | else |
||
1843 | { |
||
10004 | fschmid | 1844 | QTextStream s(&f); |
1845 | s.setCodec("UTF-8"); |
||
3170 | craig | 1846 | s<<docu.toString(); |
8528 | cbradney | 1847 | if (f.error()==QFile::NoError) |
3170 | craig | 1848 | result = true; |
1849 | else |
||
1850 | m_lastError = tr("Writing to preferences file \"%1\" failed: " |
||
14043 | jghali | 1851 | "QIODevice status code %2") |
10553 | fschmid | 1852 | .arg(ho).arg(f.errorString()); |
3170 | craig | 1853 | } |
1854 | if (f.isOpen()) |
||
1855 | f.close(); |
||
1856 | return result; |
||
2889 | cbradney | 1857 | } |
1858 | |||
1859 | bool PrefsManager::ReadPref(QString ho) |
||
1860 | { |
||
1861 | QDomDocument docu("scridoc"); |
||
1862 | QFile f(ho); |
||
8501 | cbradney | 1863 | if(!f.open(QIODevice::ReadOnly)) |
3171 | craig | 1864 | { |
1865 | m_lastError = tr("Failed to open prefs file \"%1\": %2") |
||
10553 | fschmid | 1866 | .arg(ho).arg( qApp->translate("QFile",f.errorString().toLatin1().constData()) ); |
2889 | cbradney | 1867 | return false; |
3171 | craig | 1868 | } |
10004 | fschmid | 1869 | QTextStream ts(&f); |
1870 | ts.setCodec("UTF-8"); |
||
2889 | cbradney | 1871 | QString errorMsg; |
1872 | int errorLine = 0, errorColumn = 0; |
||
10004 | fschmid | 1873 | if( !docu.setContent(ts.readAll(), &errorMsg, &errorLine, &errorColumn) ) |
2889 | cbradney | 1874 | { |
3171 | craig | 1875 | m_lastError = tr("Failed to read prefs XML from \"%1\": %2 at line %3, col %4") |
1876 | .arg(ho).arg(errorMsg).arg(errorLine).arg(errorColumn); |
||
2889 | cbradney | 1877 | f.close(); |
1878 | return false; |
||
1879 | } |
||
1880 | f.close(); |
||
17223 | jghali | 1881 | ScDomElement elem = docu.documentElement(); |
2889 | cbradney | 1882 | if (elem.tagName() != "SCRIBUSRC") |
1883 | return false; |
||
15125 | cbradney | 1884 | //Ignore scribus*.rc files prior to 1.5.0 due to changes |
1885 | bool prefs150FileFound=false; |
||
13474 | cbradney | 1886 | if (elem.hasAttribute("VERSION")) |
1887 | { |
||
15125 | cbradney | 1888 | if (elem.attribute("VERSION") == "1.5.0") |
1889 | prefs150FileFound=true; |
||
13474 | cbradney | 1890 | } |
15125 | cbradney | 1891 | firstTimeIgnoreOldPrefs=!prefs150FileFound; |
1892 | if (!prefs150FileFound) |
||
13474 | cbradney | 1893 | return false; |
13967 | cbradney | 1894 | appPrefs.colorPrefs.DColors.clear(); |
15665 | fschmid | 1895 | ColorSetManager csm; |
1896 | csm.initialiseDefaultPrefs(appPrefs); |
||
1897 | csm.findPaletteLocations(); |
||
1898 | csm.findPalettes(); |
||
15681 | fschmid | 1899 | csm.findUserPalettes(); |
2889 | cbradney | 1900 | QDomNode DOC=elem.firstChild(); |
3183 | fschmid | 1901 | if (!DOC.namedItem("CheckProfile").isNull()) |
14849 | cbradney | 1902 | appPrefs.verifierPrefs.checkerPrefsList.clear(); |
2889 | cbradney | 1903 | while(!DOC.isNull()) |
1904 | { |
||
17223 | jghali | 1905 | ScDomElement dc = DOC.toElement(); |
15124 | cbradney | 1906 | |
1907 | if (dc.tagName()=="UI") |
||
2889 | cbradney | 1908 | { |
15124 | cbradney | 1909 | appPrefs.uiPrefs.style = dc.attribute("Theme","Default"); |
1910 | appPrefs.uiPrefs.wheelJump = dc.attribute("ScrollWheelJump").toInt(); |
||
1911 | appPrefs.uiPrefs.mouseMoveTimeout = dc.attribute("MouseMoveTimeout", "150").toInt(); |
||
1912 | appPrefs.uiPrefs.applicationFontSize = dc.attribute("ApplicationFontSize", "12").toInt(); |
||
1913 | appPrefs.uiPrefs.paletteFontSize = dc.attribute("PaletteFontSize", "10").toInt(); |
||
1914 | appPrefs.uiPrefs.recentDocCount = dc.attribute("RecentDocumentCount","5").toUInt(); |
||
1915 | appPrefs.uiPrefs.showStartupDialog = static_cast<bool>(dc.attribute("ShowStartupDialog", "1").toInt()); |
||
14203 | cbradney | 1916 | appPrefs.uiPrefs.showSplashOnStartup = static_cast<bool>(dc.attribute("UI_SHOWSPLASHSCREEN", "1").toInt()); |
15124 | cbradney | 1917 | appPrefs.uiPrefs.useSmallWidgets = dc.attribute("UseSmallWidgets").toInt(); |
1918 | appPrefs.uiPrefs.useTabs = static_cast<bool>(dc.attribute("UseDocumentTabs", "0").toInt()); |
||
1919 | appPrefs.uiPrefs.stickyTools = static_cast<bool>(dc.attribute("StickyTools", "0").toInt()); |
||
15461 | craig | 1920 | appPrefs.uiPrefs.grayscaleIcons = static_cast<bool>(dc.attribute("UseGrayscaleIcons",0).toInt()); |
20160 | craig | 1921 | appPrefs.uiPrefs.iconSet = dc.attribute("IconSet", "1_5_0"); |
15124 | cbradney | 1922 | } |
13876 | cbradney | 1923 | |
15124 | cbradney | 1924 | if (dc.tagName()=="DocumentSetup") |
1925 | { |
||
1926 | appPrefs.docSetupPrefs.docUnitIndex = dc.attribute("UnitIndex", "0").toInt(); |
||
1927 | appPrefs.docSetupPrefs.pageSize = dc.attribute("PageSize","A4"); |
||
1928 | appPrefs.docSetupPrefs.pageOrientation = dc.attribute("PageOrientation", "0").toInt(); |
||
1929 | appPrefs.docSetupPrefs.pageWidth = ScCLocale::toDoubleC(dc.attribute("PageWidth"), 595.0); |
||
1930 | appPrefs.docSetupPrefs.pageHeight = ScCLocale::toDoubleC |