Rev 14730 | Rev 14811 | 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 | /*************************************************************************** |
8 | copyright : (C) 2005 by Craig Bradney |
||
9 | email : cbradney@zip.com.au |
||
10 | ***************************************************************************/ |
||
11 | |||
12 | /*************************************************************************** |
||
13 | * * |
||
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 * |
||
16 | * the Free Software Foundation; either version 2 of the License, or * |
||
17 | * (at your option) any later version. * |
||
18 | * * |
||
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> |
||
13951 | fschmid | 27 | #include <QTransform> |
10531 | avox | 28 | #include <QList> |
10223 | cbradney | 29 | #include <QString> |
11506 | mrdocs | 30 | #include <QStringList> |
10223 | cbradney | 31 | #include <QStyleFactory> |
2835 | cbradney | 32 | |
2834 | cbradney | 33 | #include "prefsmanager.h" |
5243 | cbradney | 34 | |
35 | #include "actionmanager.h" |
||
4606 | cbradney | 36 | #include "colorsetmanager.h" |
4538 | cbradney | 37 | #include "commonstrings.h" |
2859 | cbradney | 38 | #include "filewatcher.h" |
11506 | mrdocs | 39 | #include "latexhelpers.h" |
13650 | cbradney | 40 | #include "ui/missing.h" |
13544 | cbradney | 41 | #include "ui/tabkeyboardshortcutswidget.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" |
2835 | cbradney | 48 | #include "scfonts.h" |
13576 | cbradney | 49 | #include "ui/scmessagebox.h" |
2835 | cbradney | 50 | #include "scpaths.h" |
5781 | cbradney | 51 | #include "scribuscore.h" |
2835 | cbradney | 52 | #include "scribusstructs.h" |
5243 | cbradney | 53 | #include "scribuscore.h" |
10976 | cbradney | 54 | #include "ui/modetoolbar.h" |
11605 | jghali | 55 | #include "util_file.h" |
10212 | cbradney | 56 | #include "util_ghostscript.h" |
10976 | cbradney | 57 | |
2859 | cbradney | 58 | extern bool emergencyActivated; |
2835 | cbradney | 59 | |
2834 | cbradney | 60 | PrefsManager* PrefsManager::_instance = 0; |
61 | |||
10427 | cbradney | 62 | PrefsManager::PrefsManager(QObject *parent) |
13482 | cbradney | 63 | : QObject(parent), |
64 | firstTimeIgnoreOldPrefs(false) |
||
2834 | cbradney | 65 | { |
66 | } |
||
67 | |||
68 | PrefsManager::~PrefsManager() |
||
69 | { |
||
13955 | cbradney | 70 | appPrefs.fontPrefs.AvailFonts.clear(); |
2856 | cbradney | 71 | delete prefsFile; |
2834 | cbradney | 72 | } |
73 | |||
74 | PrefsManager* PrefsManager::instance() |
||
75 | { |
||
14043 | jghali | 76 | if (_instance == 0) |
77 | _instance = new PrefsManager(); |
||
2834 | cbradney | 78 | |
14043 | jghali | 79 | return _instance; |
2834 | cbradney | 80 | } |
81 | |||
82 | void PrefsManager::deleteInstance() |
||
83 | { |
||
14043 | jghali | 84 | if (_instance) |
85 | delete _instance; |
||
86 | _instance = 0; |
||
2834 | cbradney | 87 | } |
88 | |||
89 | |||
90 | ApplicationPrefs* PrefsManager::applicationPrefs() |
||
91 | { |
||
92 | return &appPrefs; |
||
93 | } |
||
2835 | cbradney | 94 | |
14046 | cbradney | 95 | void PrefsManager::setNewPrefs(ApplicationPrefs& newPrefs) |
96 | { |
||
97 | appPrefs=newPrefs; |
||
98 | } |
||
99 | |||
2856 | cbradney | 100 | PrefsFile* PrefsManager::applicationPrefsFile() |
101 | { |
||
102 | return prefsFile; |
||
103 | } |
||
104 | |||
10509 | cbradney | 105 | bool PrefsManager::importingFrom12x() |
2856 | cbradney | 106 | { |
107 | return importingFrom12; |
||
108 | } |
||
109 | |||
110 | |||
111 | void PrefsManager::setup() |
||
112 | { |
||
113 | setupPreferencesLocation(); |
||
114 | |||
5200 | cbradney | 115 | importingFrom12=copyOldPreferences(); |
13608 | jghali | 116 | prefsFile = new PrefsFile( prefsLocation + "/prefs150.xml" ); |
2856 | cbradney | 117 | if (importingFrom12) |
118 | convert12Preferences(); |
||
119 | //<<CB TODO Reset keyboard shortcuts of all 1.3 users as too many |
||
120 | // have conflicts if they dont nuke their settings. |
||
121 | // - Remove for 1.3.0 release: importingFrom12=true; |
||
122 | //>>CB |
||
123 | } |
||
124 | |||
2835 | cbradney | 125 | void PrefsManager::initDefaults() |
126 | { |
||
127 | /** Default font and size **/ |
||
13955 | cbradney | 128 | SCFontsIterator it(appPrefs.fontPrefs.AvailFonts); |
4221 | fschmid | 129 | bool goodFont = false; |
13955 | cbradney | 130 | for ( SCFontsIterator itf(appPrefs.fontPrefs.AvailFonts); itf.hasNext(); itf.next()) |
4221 | fschmid | 131 | { |
132 | if ((itf.currentKey() == "Arial Regular") || (itf.currentKey() == "Times New Roman Regular")) |
||
133 | { |
||
13996 | cbradney | 134 | appPrefs.itemToolPrefs.textFont = itf.currentKey(); |
4221 | fschmid | 135 | goodFont = true; |
136 | break; |
||
137 | } |
||
138 | } |
||
139 | if (!goodFont) |
||
13996 | cbradney | 140 | appPrefs.itemToolPrefs.textFont = it.currentKey(); |
141 | appPrefs.itemToolPrefs.textSize = 120; |
||
2835 | cbradney | 142 | |
143 | /** Default colours **/ |
||
14150 | fschmid | 144 | appPrefs.defaultGradients.clear(); |
13967 | cbradney | 145 | appPrefs.colorPrefs.DColors.clear(); |
14043 | jghali | 146 | |
4606 | cbradney | 147 | ColorSetManager csm; |
148 | csm.initialiseDefaultPrefs(appPrefs); |
||
149 | csm.findPaletteLocations(); |
||
150 | csm.findPalettes(); |
||
151 | /* |
||
4602 | cbradney | 152 | QString pfadC = ScPaths::instance().libDir()+"swatches/"; |
4606 | cbradney | 153 | QString pfadC2 = pfadC + "Scribus_X11.txt"; |
2835 | cbradney | 154 | QFile fiC(pfadC2); |
155 | if (!fiC.exists()) |
||
156 | { |
||
13967 | cbradney | 157 | appPrefs.colorPrefs.DColors.insert("White", ScColor(0, 0, 0, 0)); |
158 | appPrefs.colorPrefs.DColors.insert("Black", ScColor(0, 0, 0, 255)); |
||
159 | appPrefs.colorPrefs.DColors.insert("Blue", ScColor(255, 255, 0, 0)); |
||
160 | appPrefs.colorPrefs.DColors.insert("Cyan", ScColor(255, 0, 0, 0)); |
||
161 | appPrefs.colorPrefs.DColors.insert("Green", ScColor(255, 0, 255, 0)); |
||
162 | appPrefs.colorPrefs.DColors.insert("Red", ScColor(0, 255, 255, 0)); |
||
163 | appPrefs.colorPrefs.DColors.insert("Yellow", ScColor(0, 0, 255, 0)); |
||
164 | appPrefs.colorPrefs.DColors.insert("Magenta", ScColor(0, 255, 0, 0)); |
||
165 | appPrefs.colorPrefs.DColorSet = "Scribus-Small"; |
||
2835 | cbradney | 166 | } |
167 | else |
||
168 | { |
||
169 | if (fiC.open(IO_ReadOnly)) |
||
170 | { |
||
171 | QString ColorEn, Cname; |
||
172 | int Rval, Gval, Bval; |
||
173 | QTextStream tsC(&fiC); |
||
174 | ColorEn = tsC.readLine(); |
||
175 | while (!tsC.atEnd()) |
||
176 | { |
||
177 | ColorEn = tsC.readLine(); |
||
178 | QTextStream CoE(&ColorEn, IO_ReadOnly); |
||
179 | CoE >> Rval; |
||
180 | CoE >> Gval; |
||
181 | CoE >> Bval; |
||
182 | CoE >> Cname; |
||
2886 | fschmid | 183 | ScColor tmp; |
2835 | cbradney | 184 | tmp.setColorRGB(Rval, Gval, Bval); |
13967 | cbradney | 185 | appPrefs.colorPrefs.DColors.insert(Cname, tmp); |
2835 | cbradney | 186 | } |
187 | fiC.close(); |
||
188 | } |
||
13967 | cbradney | 189 | appPrefs.colorPrefs.DColorSet = "X11 RGB-Set"; |
2835 | cbradney | 190 | } |
4606 | cbradney | 191 | */ |
2835 | cbradney | 192 | |
13876 | cbradney | 193 | appPrefs.uiPrefs.wheelJump = 40; |
3641 | fschmid | 194 | /** Set Default window position and size to sane default values which should work on every screen */ |
13955 | cbradney | 195 | // appPrefs.uiPrefs.mainWinSettings.xPosition = 0; |
196 | // appPrefs.uiPrefs.mainWinSettings.yPosition = 0; |
||
197 | appPrefs.uiPrefs.mainWinSettings.width = 640; |
||
198 | appPrefs.uiPrefs.mainWinSettings.height = 480; |
||
13050 | cbradney | 199 | QDesktopWidget *d = QApplication::desktop(); |
13955 | cbradney | 200 | appPrefs.uiPrefs.mainWinSettings.xPosition=(d->availableGeometry().width()-appPrefs.uiPrefs.mainWinSettings.width)/2; |
201 | appPrefs.uiPrefs.mainWinSettings.yPosition=(d->availableGeometry().height()-appPrefs.uiPrefs.mainWinSettings.height)/2; |
||
202 | appPrefs.uiPrefs.mainWinSettings.maximized = false; |
||
203 | appPrefs.uiPrefs.mainWinState = QByteArray(); |
||
13889 | cbradney | 204 | appPrefs.guidesPrefs.marginsShown = true; |
205 | appPrefs.guidesPrefs.framesShown = true; |
||
206 | appPrefs.guidesPrefs.layerMarkersShown = false; |
||
207 | appPrefs.guidesPrefs.gridShown = false; |
||
208 | appPrefs.guidesPrefs.guidesShown = true; |
||
209 | appPrefs.guidesPrefs.colBordersShown = true; |
||
210 | appPrefs.guidesPrefs.baselineGridShown = false; |
||
211 | appPrefs.guidesPrefs.showPic = true; |
||
212 | appPrefs.guidesPrefs.showControls = false; |
||
213 | appPrefs.guidesPrefs.linkShown = false; |
||
214 | appPrefs.guidesPrefs.rulersShown = true; |
||
215 | appPrefs.guidesPrefs.showBleed = true; |
||
216 | appPrefs.guidesPrefs.rulerMode = true; |
||
217 | appPrefs.guidesPrefs.grabRadius = 4; |
||
218 | appPrefs.guidesPrefs.guideRad = 10; |
||
219 | appPrefs.guidesPrefs.minorGridSpacing = 20; |
||
220 | appPrefs.guidesPrefs.majorGridSpacing = 100; |
||
221 | appPrefs.guidesPrefs.minorGridColor = QColor(Qt::green); |
||
222 | appPrefs.guidesPrefs.majorGridColor = QColor(Qt::green); |
||
223 | appPrefs.guidesPrefs.marginColor = QColor(Qt::blue); |
||
224 | appPrefs.guidesPrefs.guideColor = QColor(Qt::darkBlue); |
||
225 | appPrefs.guidesPrefs.baselineGridColor = QColor(Qt::lightGray); |
||
13953 | cbradney | 226 | appPrefs.typoPrefs.valueSuperScript = 33; |
227 | appPrefs.typoPrefs.scalingSuperScript = 66; |
||
228 | appPrefs.typoPrefs.valueSubScript = 33; |
||
229 | appPrefs.typoPrefs.scalingSubScript = 66; |
||
230 | appPrefs.typoPrefs.valueSmallCaps = 75; |
||
231 | appPrefs.typoPrefs.autoLineSpacing = 20; |
||
232 | appPrefs.typoPrefs.valueUnderlinePos = -1; |
||
233 | appPrefs.typoPrefs.valueUnderlineWidth = -1; |
||
234 | appPrefs.typoPrefs.valueStrikeThruPos = -1; |
||
235 | appPrefs.typoPrefs.valueStrikeThruWidth = -1; |
||
13889 | cbradney | 236 | appPrefs.guidesPrefs.valueBaselineGrid = 14.4; |
237 | appPrefs.guidesPrefs.offsetBaselineGrid = 0.0; |
||
13876 | cbradney | 238 | appPrefs.uiPrefs.style = ""; |
13955 | cbradney | 239 | appPrefs.uiPrefs.grayscaleIcons = false; // can be a little slower on startup.. but its a nice effect to play with |
240 | appPrefs.displayPrefs.showToolTips = true; |
||
241 | appPrefs.displayPrefs.showMouseCoordinates = true; |
||
13876 | cbradney | 242 | appPrefs.uiPrefs.mouseMoveTimeout = 150; |
13955 | cbradney | 243 | appPrefs.uiPrefs.stickyTools = false; |
2835 | cbradney | 244 | //FIXME |
245 | //Black here causes issues when a colour set is loaded without "Black" in it. |
||
246 | //"Black" is created with wrong values. Eg SVG colour set |
||
14014 | cbradney | 247 | appPrefs.itemToolPrefs.shapeLineColor = "Black"; |
248 | appPrefs.itemToolPrefs.shapeFillColor = "Black"; |
||
249 | appPrefs.itemToolPrefs.shapeLineColorShade = 100; |
||
250 | appPrefs.itemToolPrefs.shapeFillColorShade = 100; |
||
251 | appPrefs.itemToolPrefs.shapeLineStyle = Qt::SolidLine; |
||
252 | appPrefs.itemToolPrefs.shapeLineWidth = 0; |
||
13996 | cbradney | 253 | appPrefs.itemToolPrefs.lineColor = "Black"; |
254 | appPrefs.itemToolPrefs.textColor = "Black"; |
||
255 | appPrefs.itemToolPrefs.textStrokeColor = "Black"; |
||
14014 | cbradney | 256 | appPrefs.itemToolPrefs.textFillColor = CommonStrings::None; |
13996 | cbradney | 257 | appPrefs.itemToolPrefs.textLineColor = CommonStrings::None; |
14014 | cbradney | 258 | appPrefs.itemToolPrefs.textFillColorShade = 100; |
259 | appPrefs.itemToolPrefs.textLineColorShade = 100; |
||
13996 | cbradney | 260 | appPrefs.itemToolPrefs.textShade = 100; |
261 | appPrefs.itemToolPrefs.textStrokeShade = 100; |
||
262 | appPrefs.itemToolPrefs.textTabFillChar = ""; |
||
263 | appPrefs.itemToolPrefs.textTabWidth = 36.0; |
||
13953 | cbradney | 264 | appPrefs.opToolPrefs.dispX = 10.0; |
265 | appPrefs.opToolPrefs.dispY = 10.0; |
||
266 | appPrefs.opToolPrefs.constrain = 15.0; |
||
13974 | cbradney | 267 | appPrefs.displayPrefs.paperColor = QColor(Qt::white); |
13955 | cbradney | 268 | appPrefs.displayPrefs.showPageShadow = true; |
13974 | cbradney | 269 | appPrefs.displayPrefs.frameColor = QColor(Qt::red); |
270 | appPrefs.displayPrefs.frameNormColor = QColor(Qt::black); |
||
271 | appPrefs.displayPrefs.frameGroupColor = QColor(Qt::darkCyan); |
||
272 | appPrefs.displayPrefs.frameLockColor = QColor(Qt::darkRed); |
||
273 | appPrefs.displayPrefs.frameLinkColor = QColor(Qt::red); |
||
274 | appPrefs.displayPrefs.frameAnnotationColor = QColor(Qt::blue); |
||
275 | appPrefs.displayPrefs.pageBorderColor = QColor(Qt::red); |
||
276 | appPrefs.displayPrefs.controlCharColor = QColor(Qt::darkRed); |
||
13996 | cbradney | 277 | appPrefs.itemToolPrefs.textColumns = 1; |
278 | appPrefs.itemToolPrefs.textColumnGap = 0.0; |
||
14014 | cbradney | 279 | appPrefs.itemToolPrefs.lineColorShade = 100; |
13996 | cbradney | 280 | appPrefs.itemToolPrefs.lineStyle = Qt::SolidLine; |
281 | appPrefs.itemToolPrefs.lineWidth = 1; |
||
282 | appPrefs.itemToolPrefs.lineStartArrow = 0; |
||
283 | appPrefs.itemToolPrefs.lineEndArrow = 0; |
||
14730 | fschmid | 284 | appPrefs.opToolPrefs.magMin = 1; |
13953 | cbradney | 285 | appPrefs.opToolPrefs.magMax = 3200; |
286 | appPrefs.opToolPrefs.magStep = 200; |
||
13996 | cbradney | 287 | appPrefs.itemToolPrefs.imageFillColor = CommonStrings::None; |
14014 | cbradney | 288 | appPrefs.itemToolPrefs.imageFillColorShade = 100; |
13996 | cbradney | 289 | appPrefs.itemToolPrefs.imageScaleX = 1; |
290 | appPrefs.itemToolPrefs.imageScaleY = 1; |
||
13889 | cbradney | 291 | appPrefs.guidesPrefs.guidePlacement = true; |
13876 | cbradney | 292 | appPrefs.docSetupPrefs.docUnitIndex = 0; |
13996 | cbradney | 293 | appPrefs.itemToolPrefs.polyCorners = 4; |
14022 | cbradney | 294 | appPrefs.itemToolPrefs.polyFactor = 0.5; |
13996 | cbradney | 295 | appPrefs.itemToolPrefs.polyUseFactor = false; |
14027 | fschmid | 296 | appPrefs.itemToolPrefs.polyFactorGuiVal = 0; |
13996 | cbradney | 297 | appPrefs.itemToolPrefs.polyRotation = 0.0; |
13953 | cbradney | 298 | appPrefs.itemToolPrefs.polyCurvature = 0.0; |
4649 | fschmid | 299 | // appPrefs.PSize = 40; |
13955 | cbradney | 300 | appPrefs.printerPrefs.ClipMargin = false; |
13967 | cbradney | 301 | appPrefs.printerPrefs.GCRMode = false; |
13955 | cbradney | 302 | appPrefs.uiPrefs.RecentDocs.clear(); |
303 | appPrefs.scrapbookPrefs.RecentScrapbooks.clear(); |
||
13876 | cbradney | 304 | appPrefs.uiPrefs.recentDocCount = 5; |
13955 | cbradney | 305 | appPrefs.scrapbookPrefs.doCopyToScrapbook = true; |
306 | appPrefs.scrapbookPrefs.persistentScrapbook = false; |
||
14715 | fschmid | 307 | appPrefs.scrapbookPrefs.writePreviews = true; |
13955 | cbradney | 308 | appPrefs.scrapbookPrefs.numScrapbookCopies = 10; |
309 | appPrefs.displayPrefs.marginColored = false; |
||
13876 | cbradney | 310 | appPrefs.docSetupPrefs.pageSize = "A4"; |
311 | appPrefs.docSetupPrefs.pageOrientation = 0; |
||
2865 | cbradney | 312 | PageSize a4("A4"); |
13876 | cbradney | 313 | appPrefs.docSetupPrefs.pageWidth = a4.width(); |
314 | appPrefs.docSetupPrefs.pageHeight = a4.height(); |
||
315 | appPrefs.docSetupPrefs.margins.Top = 40; |
||
316 | appPrefs.docSetupPrefs.margins.Bottom = 40; |
||
317 | appPrefs.docSetupPrefs.margins.Left = 40; |
||
318 | appPrefs.docSetupPrefs.margins.Right = 40; |
||
319 | appPrefs.docSetupPrefs.marginPreset = 0; |
||
320 | appPrefs.docSetupPrefs.bleeds.Top = 0; |
||
321 | appPrefs.docSetupPrefs.bleeds.Left = 0; |
||
322 | appPrefs.docSetupPrefs.bleeds.Right = 0; |
||
323 | appPrefs.docSetupPrefs.bleeds.Bottom = 0; |
||
13996 | cbradney | 324 | appPrefs.itemToolPrefs.imageScaleType = true; |
325 | appPrefs.itemToolPrefs.imageAspectRatio = true; |
||
326 | appPrefs.itemToolPrefs.imageLowResType = 1; |
||
327 | appPrefs.itemToolPrefs.imageUseEmbeddedPath = false; |
||
13955 | cbradney | 328 | appPrefs.hyphPrefs.MinWordLen = 3; |
329 | appPrefs.hyphPrefs.HyCount = 2; |
||
330 | appPrefs.hyphPrefs.Language = ""; |
||
331 | appPrefs.hyphPrefs.specialWords.clear(); |
||
332 | appPrefs.hyphPrefs.ignoredWords.clear(); |
||
333 | appPrefs.hyphPrefs.Automatic = true; |
||
334 | appPrefs.hyphPrefs.AutoCheck = false; |
||
13967 | cbradney | 335 | appPrefs.docSetupPrefs.AutoSave = true; |
336 | appPrefs.docSetupPrefs.AutoSaveTime = 600000; |
||
14764 | cbradney | 337 | appPrefs.docSetupPrefs.saveCompressed = false; |
12109 | fschmid | 338 | int dpi = qApp->desktop()->logicalDpiX(); |
339 | if ((dpi < 60) || (dpi > 200)) |
||
340 | dpi = 72; |
||
13974 | cbradney | 341 | appPrefs.displayPrefs.displayScale = dpi / 72.0; |
12109 | fschmid | 342 | |
13876 | cbradney | 343 | appPrefs.pathPrefs.documents = ScPaths::getUserDocumentDir(); |
344 | appPrefs.pathPrefs.colorProfiles = ""; |
||
345 | appPrefs.pathPrefs.scripts = ""; |
||
346 | appPrefs.pathPrefs.documentTemplates = ""; |
||
13967 | cbradney | 347 | appPrefs.colorPrefs.CustomColorSets.clear(); |
348 | appPrefs.printPreviewPrefs.PrPr_Mode = false; |
||
349 | //appPrefs.Gcr_Mode = true; |
||
350 | appPrefs.printPreviewPrefs.PrPr_AntiAliasing = false; |
||
351 | appPrefs.printPreviewPrefs.PrPr_Transparency = false; |
||
352 | appPrefs.printPreviewPrefs.PrPr_C = true; |
||
353 | appPrefs.printPreviewPrefs.PrPr_M = true; |
||
354 | appPrefs.printPreviewPrefs.PrPr_Y = true; |
||
355 | appPrefs.printPreviewPrefs.PrPr_K = true; |
||
356 | appPrefs.printPreviewPrefs.PrPr_InkCoverage = false; |
||
357 | appPrefs.printPreviewPrefs.PrPr_InkThreshold = 250; |
||
13955 | cbradney | 358 | appPrefs.extToolPrefs.imageEditorExecutable = "gimp"; |
359 | appPrefs.extToolPrefs.extBrowserExecutable = ""; |
||
13957 | herm | 360 | appPrefs.extToolPrefs.uniconvExecutable = "uniconv"; |
13955 | cbradney | 361 | appPrefs.extToolPrefs.latexConfigs = LatexConfigCache::defaultConfigs(); |
362 | appPrefs.extToolPrefs.latexCommands.clear(); |
||
363 | appPrefs.extToolPrefs.latexEditorExecutable = ""; |
||
364 | appPrefs.extToolPrefs.latexResolution = 72; |
||
365 | appPrefs.extToolPrefs.latexForceDpi = true; |
||
366 | appPrefs.extToolPrefs.latexStartWithEmptyFrames = false; |
||
367 | appPrefs.extToolPrefs.gs_AntiAliasGraphics = true; |
||
368 | appPrefs.extToolPrefs.gs_AntiAliasText = true; |
||
369 | appPrefs.extToolPrefs.gs_exe = getGSDefaultExeName(); |
||
370 | appPrefs.extToolPrefs.gs_Resolution = 72; |
||
13996 | cbradney | 371 | appPrefs.storyEditorPrefs.guiFontColor = QColor(Qt::white); |
13967 | cbradney | 372 | appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile = ""; |
373 | appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile = ""; |
||
374 | appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile = ""; |
||
375 | appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile = ""; |
||
376 | appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile = ""; |
||
377 | appPrefs.colorPrefs.DCMSset.CMSinUse = false; |
||
378 | appPrefs.colorPrefs.DCMSset.SoftProofOn = false; |
||
379 | appPrefs.colorPrefs.DCMSset.SoftProofFullOn = false; |
||
380 | appPrefs.colorPrefs.DCMSset.GamutCheck = false; |
||
381 | appPrefs.colorPrefs.DCMSset.BlackPoint = true; |
||
14170 | jghali | 382 | appPrefs.colorPrefs.DCMSset.DefaultIntentColors = Intent_Relative_Colorimetric; |
383 | appPrefs.colorPrefs.DCMSset.DefaultIntentImages = Intent_Perceptual; |
||
13967 | cbradney | 384 | appPrefs.fontPrefs.GFontSub.clear(); |
13955 | cbradney | 385 | appPrefs.displayPrefs.scratch.Left = 100; |
386 | appPrefs.displayPrefs.scratch.Right = 100; |
||
387 | appPrefs.displayPrefs.scratch.Top = 20; |
||
388 | appPrefs.displayPrefs.scratch.Bottom = 20; |
||
13974 | cbradney | 389 | appPrefs.displayPrefs.pageGapHorizontal = 0.0; |
390 | appPrefs.displayPrefs.pageGapVertical = 40.0; |
||
3016 | fschmid | 391 | struct PageSet pageS; |
4538 | cbradney | 392 | pageS.Name = CommonStrings::pageSet1; |
3016 | fschmid | 393 | pageS.FirstPage = 0; |
394 | pageS.Rows = 1; |
||
395 | pageS.Columns = 1; |
||
3026 | fschmid | 396 | pageS.pageNames.clear(); |
3016 | fschmid | 397 | appPrefs.pageSets.append(pageS); |
4538 | cbradney | 398 | pageS.Name = CommonStrings::pageSet2; |
3016 | fschmid | 399 | pageS.FirstPage = 1; |
400 | pageS.Columns = 2; |
||
3026 | fschmid | 401 | pageS.pageNames.clear(); |
4538 | cbradney | 402 | pageS.pageNames.append(CommonStrings::pageLocLeft); |
403 | pageS.pageNames.append(CommonStrings::pageLocRight); |
||
3016 | fschmid | 404 | appPrefs.pageSets.append(pageS); |
4538 | cbradney | 405 | pageS.Name = CommonStrings::pageSet3; |
3016 | fschmid | 406 | pageS.FirstPage = 0; |
407 | pageS.Columns = 3; |
||
3026 | fschmid | 408 | pageS.pageNames.clear(); |
4538 | cbradney | 409 | pageS.pageNames.append(CommonStrings::pageLocLeft); |
410 | pageS.pageNames.append(CommonStrings::pageLocMiddle); |
||
411 | pageS.pageNames.append(CommonStrings::pageLocRight); |
||
3016 | fschmid | 412 | appPrefs.pageSets.append(pageS); |
4538 | cbradney | 413 | pageS.Name = CommonStrings::pageSet4; |
3016 | fschmid | 414 | pageS.FirstPage = 0; |
415 | pageS.Columns = 4; |
||
3026 | fschmid | 416 | pageS.pageNames.clear(); |
4538 | cbradney | 417 | pageS.pageNames.append(CommonStrings::pageLocLeft); |
418 | pageS.pageNames.append(CommonStrings::pageLocMiddleLeft); |
||
419 | pageS.pageNames.append(CommonStrings::pageLocMiddleRight); |
||
420 | pageS.pageNames.append(CommonStrings::pageLocRight); |
||
3016 | fschmid | 421 | appPrefs.pageSets.append(pageS); |
13876 | cbradney | 422 | appPrefs.docSetupPrefs.pagePositioning = singlePage; |
13955 | cbradney | 423 | appPrefs.fontPrefs.askBeforeSubstitute = true; |
424 | appPrefs.miscPrefs.haveStylePreview = true; |
||
2835 | cbradney | 425 | // lorem ipsum defaults |
13955 | cbradney | 426 | appPrefs.miscPrefs.useStandardLI = false; |
427 | appPrefs.miscPrefs.paragraphsLI = 10; |
||
13876 | cbradney | 428 | appPrefs.uiPrefs.showStartupDialog = true; |
14203 | cbradney | 429 | appPrefs.uiPrefs.showSplashOnStartup = true; |
13876 | cbradney | 430 | appPrefs.uiPrefs.useSmallWidgets = false; |
14224 | fschmid | 431 | appPrefs.uiPrefs.useTabs = false; |
13955 | cbradney | 432 | initDefaultCheckerPrefs(&appPrefs.checkerPrefsList); |
10096 | jghali | 433 | appPrefs.curCheckProfile = CommonStrings::PostScript; |
13955 | cbradney | 434 | appPrefs.pdfPrefs.Thumbnails = false; |
435 | appPrefs.pdfPrefs.Articles = false; |
||
436 | appPrefs.pdfPrefs.useLayers = false; |
||
437 | appPrefs.pdfPrefs.Compress = true; |
||
438 | appPrefs.pdfPrefs.CompressMethod = PDFOptions::Compression_Auto; |
||
439 | appPrefs.pdfPrefs.Quality = 0; |
||
440 | appPrefs.pdfPrefs.RecalcPic = false; |
||
441 | appPrefs.pdfPrefs.embedPDF = false; |
||
442 | appPrefs.pdfPrefs.Bookmarks = false; |
||
443 | appPrefs.pdfPrefs.PicRes = 300; |
||
444 | appPrefs.pdfPrefs.Version = PDFOptions::PDFVersion_14; |
||
445 | appPrefs.pdfPrefs.Resolution = 300; |
||
446 | appPrefs.pdfPrefs.Binding = 0; |
||
447 | appPrefs.pdfPrefs.EmbedList.clear(); |
||
448 | appPrefs.pdfPrefs.SubsetList.clear(); |
||
449 | appPrefs.pdfPrefs.MirrorH = false; |
||
450 | appPrefs.pdfPrefs.MirrorV = false; |
||
451 | appPrefs.pdfPrefs.doClip = false; |
||
452 | appPrefs.pdfPrefs.RotateDeg = 0; |
||
453 | appPrefs.pdfPrefs.PresentMode = false; |
||
454 | appPrefs.pdfPrefs.fileName = ""; |
||
455 | appPrefs.pdfPrefs.PresentVals.clear(); |
||
456 | appPrefs.pdfPrefs.isGrayscale = false; |
||
457 | appPrefs.pdfPrefs.UseRGB = true; |
||
458 | appPrefs.pdfPrefs.UseProfiles = false; |
||
459 | appPrefs.pdfPrefs.UseProfiles2 = false; |
||
460 | appPrefs.pdfPrefs.SolidProf = ""; |
||
461 | appPrefs.pdfPrefs.SComp = 3; |
||
462 | appPrefs.pdfPrefs.ImageProf = ""; |
||
463 | appPrefs.pdfPrefs.PrintProf = ""; |
||
464 | appPrefs.pdfPrefs.Info = ""; |
||
465 | appPrefs.pdfPrefs.Intent = 0; |
||
466 | appPrefs.pdfPrefs.Intent2 = 0; |
||
467 | appPrefs.pdfPrefs.bleeds.Top = 0; |
||
468 | appPrefs.pdfPrefs.bleeds.Left = 0; |
||
469 | appPrefs.pdfPrefs.bleeds.Right = 0; |
||
470 | appPrefs.pdfPrefs.bleeds.Bottom = 0; |
||
471 | appPrefs.pdfPrefs.useDocBleeds = true; |
||
472 | appPrefs.pdfPrefs.cropMarks = false; |
||
473 | appPrefs.pdfPrefs.bleedMarks = false; |
||
474 | appPrefs.pdfPrefs.registrationMarks = false; |
||
475 | appPrefs.pdfPrefs.colorMarks = false; |
||
476 | appPrefs.pdfPrefs.docInfoMarks = false; |
||
477 | appPrefs.pdfPrefs.markOffset = 0; |
||
478 | appPrefs.pdfPrefs.EmbeddedI = false; |
||
479 | appPrefs.pdfPrefs.Encrypt = false; |
||
480 | appPrefs.pdfPrefs.PassOwner = ""; |
||
481 | appPrefs.pdfPrefs.PassUser = ""; |
||
482 | appPrefs.pdfPrefs.Permissions = -4; |
||
483 | appPrefs.pdfPrefs.UseLPI = false; |
||
484 | appPrefs.pdfPrefs.LPISettings.clear(); |
||
485 | appPrefs.pdfPrefs.UseSpotColors = true; |
||
486 | appPrefs.pdfPrefs.doMultiFile = false; |
||
487 | appPrefs.pdfPrefs.displayBookmarks = false; |
||
488 | appPrefs.pdfPrefs.displayFullscreen = false; |
||
489 | appPrefs.pdfPrefs.displayLayers = false; |
||
490 | appPrefs.pdfPrefs.displayThumbs = false; |
||
491 | appPrefs.pdfPrefs.hideMenuBar = false; |
||
492 | appPrefs.pdfPrefs.hideToolBar = false; |
||
493 | appPrefs.pdfPrefs.fitWindow = false; |
||
494 | appPrefs.pdfPrefs.PageLayout = PDFOptions::SinglePage; |
||
495 | appPrefs.pdfPrefs.openAction = ""; |
||
14539 | jghali | 496 | appPrefs.imageCachePrefs.cacheEnabled = false; |
497 | appPrefs.imageCachePrefs.maxCacheSizeMiB = 1000; |
||
498 | appPrefs.imageCachePrefs.maxCacheEntries = 1000; |
||
499 | appPrefs.imageCachePrefs.compressionLevel = 1; |
||
2835 | cbradney | 500 | |
501 | //Attribute setup |
||
13955 | cbradney | 502 | appPrefs.itemAttrPrefs.defaultItemAttributes.clear(); |
503 | appPrefs.tocPrefs.defaultToCSetups.clear(); |
||
14043 | jghali | 504 | |
5243 | cbradney | 505 | initDefaultActionKeys(); |
2835 | cbradney | 506 | } |
507 | |||
5243 | cbradney | 508 | void PrefsManager::initDefaultActionKeys() |
509 | { |
||
510 | ActionManager::createDefaultShortcuts(); |
||
5257 | cbradney | 511 | QMap<QString, QKeySequence > *map=ActionManager::defaultShortcuts(); |
5243 | cbradney | 512 | for( QMap<QString, QKeySequence >::ConstIterator it = map->begin(); it!=map->end(); ++it ) |
513 | { |
||
13955 | cbradney | 514 | appPrefs.keyShortcutPrefs.KeyActions[it.key()].actionName = it.key(); |
515 | appPrefs.keyShortcutPrefs.KeyActions[it.key()].keySequence = it.value(); |
||
5243 | cbradney | 516 | } |
517 | } |
||
518 | |||
10977 | cbradney | 519 | void PrefsManager::applyLoadedShortCuts() |
520 | { |
||
13955 | cbradney | 521 | for (QMap<QString,Keys>::Iterator it = appPrefs.keyShortcutPrefs.KeyActions.begin(); it != appPrefs.keyShortcutPrefs.KeyActions.end(); ++it ) |
10977 | cbradney | 522 | { |
523 | if (!it.value().actionName.isEmpty()) |
||
524 | { |
||
525 | if (ScCore->primaryMainWindow()->scrActions[it.value().actionName]) |
||
526 | ScCore->primaryMainWindow()->scrActions[it.value().actionName]->setShortcut(it.value().keySequence); |
||
527 | } |
||
528 | } |
||
529 | } |
||
530 | |||
2835 | cbradney | 531 | void PrefsManager::initDefaultGUIFont(const QFont& guiFont) |
532 | { |
||
13876 | cbradney | 533 | appPrefs.uiPrefs.applicationFontSize = guiFont.pointSize(); |
13996 | cbradney | 534 | appPrefs.storyEditorPrefs.guiFont = guiFont.toString(); |
13876 | cbradney | 535 | appPrefs.uiPrefs.paletteFontSize = appPrefs.uiPrefs.applicationFontSize; |
2835 | cbradney | 536 | } |
537 | |||
538 | void PrefsManager::initArrowStyles() |
||
539 | { |
||
540 | struct ArrowDesc arrow; |
||
541 | FPointArray points; |
||
13951 | fschmid | 542 | QTransform arrowScaling; |
2835 | cbradney | 543 | arrowScaling.scale(0.5, 0.5); |
13951 | fschmid | 544 | QTransform arrowRotate; |
11176 | fschmid | 545 | arrowRotate.rotate(180); |
2835 | cbradney | 546 | arrow.name = "Arrow1L"; |
547 | arrow.userArrow = false; |
||
548 | points.addQuadPoint(0, 0, 0, 0, 0, 0, 0, 0); |
||
549 | points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5); |
||
550 | points.addQuadPoint(12, 0, 12, 0, 12, 0, 12, 0); |
||
551 | points.addQuadPoint(-5, 5, -5, 5, -5, 5, -5, 5); |
||
552 | points.addQuadPoint(0, 0, 0, 0, 0, 0, 0, 0); |
||
553 | arrow.points = points.copy(); |
||
554 | appPrefs.arrowStyles.append(arrow); |
||
555 | arrow.name = "Arrow1M"; |
||
556 | points.map(arrowScaling); |
||
557 | arrow.points = points.copy(); |
||
558 | appPrefs.arrowStyles.append(arrow); |
||
559 | arrow.name = "Arrow1S"; |
||
560 | points.map(arrowScaling); |
||
561 | arrow.points = points.copy(); |
||
562 | appPrefs.arrowStyles.append(arrow); |
||
563 | arrow.name = "SquareL"; |
||
564 | points.resize(0); |
||
565 | points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5); |
||
566 | points.addQuadPoint(5, -5, 5, -5, 5, -5, 5, -5); |
||
567 | points.addQuadPoint(5, 5, 5, 5, 5, 5, 5, 5); |
||
568 | points.addQuadPoint(-5, 5, -5, 5, -5, 5, -5, 5); |
||
569 | points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5); |
||
570 | arrow.points = points.copy(); |
||
571 | appPrefs.arrowStyles.append(arrow); |
||
572 | arrow.name = "SquareM"; |
||
573 | points.map(arrowScaling); |
||
574 | arrow.points = points.copy(); |
||
575 | appPrefs.arrowStyles.append(arrow); |
||
576 | arrow.name = "SquareS"; |
||
577 | points.map(arrowScaling); |
||
578 | arrow.points = points.copy(); |
||
579 | appPrefs.arrowStyles.append(arrow); |
||
580 | arrow.name = "TriangleInL"; |
||
581 | points.resize(0); |
||
582 | points.addQuadPoint(5.77, 0, 5.77, 0, 5.77, 0, 5.77, 0); |
||
583 | points.addQuadPoint(-2.88, 5, -2.88, 5, -2.88, 5, -2.88, 5); |
||
584 | points.addQuadPoint(-2.88, -5, -2.88, -5, -2.88, -5, -2.88, -5); |
||
585 | points.addQuadPoint(5.77, 0, 5.77, 0, 5.77, 0, 5.77, 0); |
||
586 | arrow.points = points.copy(); |
||
587 | appPrefs.arrowStyles.append(arrow); |
||
588 | arrow.name = "TriangleInM"; |
||
589 | points.map(arrowScaling); |
||
590 | arrow.points = points.copy(); |
||
591 | appPrefs.arrowStyles.append(arrow); |
||
592 | arrow.name = "TriangleInS"; |
||
593 | points.map(arrowScaling); |
||
594 | arrow.points = points.copy(); |
||
595 | appPrefs.arrowStyles.append(arrow); |
||
596 | arrow.name = "TriangleOutL"; |
||
597 | points.resize(0); |
||
598 | points.addQuadPoint(-5.77, 0, -5.77, 0, -5.77, 0, -5.77, 0); |
||
599 | points.addQuadPoint(2.88, 5, 2.88, 5, 2.88, 5, 2.88, 5); |
||
600 | points.addQuadPoint(2.88, -5, 2.88, -5, 2.88, -5, 2.88, -5); |
||
601 | points.addQuadPoint(-5.77, 0, -5.77, 0, -5.77, 0, -5.77, 0); |
||
602 | arrow.points = points.copy(); |
||
603 | appPrefs.arrowStyles.append(arrow); |
||
604 | arrow.name = "TriangleOutM"; |
||
605 | points.map(arrowScaling); |
||
606 | arrow.points = points.copy(); |
||
607 | appPrefs.arrowStyles.append(arrow); |
||
608 | arrow.name = "TriangleOutS"; |
||
609 | points.map(arrowScaling); |
||
610 | arrow.points = points.copy(); |
||
611 | appPrefs.arrowStyles.append(arrow); |
||
11176 | fschmid | 612 | arrow.name = "DiamondL"; |
613 | points.resize(0); |
||
614 | points.parseSVG("M 0, -7.0710768 L -7.0710894, 0 L 0, 7.0710589 L 7.0710462, 0 L 0,-7.0710768 z"); |
||
615 | arrow.points = points.copy(); |
||
616 | appPrefs.arrowStyles.append(arrow); |
||
617 | arrow.name = "DiamondM"; |
||
618 | points.map(arrowScaling); |
||
619 | arrow.points = points.copy(); |
||
620 | appPrefs.arrowStyles.append(arrow); |
||
621 | arrow.name = "DiamondS"; |
||
622 | points.map(arrowScaling); |
||
623 | arrow.points = points.copy(); |
||
624 | appPrefs.arrowStyles.append(arrow); |
||
625 | points.resize(0); |
||
626 | arrow.name = "DotL"; |
||
627 | 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"); |
||
628 | points.translate(7.4, 1.0); |
||
629 | arrow.points = points.copy(); |
||
630 | appPrefs.arrowStyles.append(arrow); |
||
631 | arrow.name = "DotM"; |
||
632 | points.map(arrowScaling); |
||
633 | arrow.points = points.copy(); |
||
634 | appPrefs.arrowStyles.append(arrow); |
||
635 | arrow.name = "DotS"; |
||
636 | points.map(arrowScaling); |
||
637 | arrow.points = points.copy(); |
||
638 | appPrefs.arrowStyles.append(arrow); |
||
639 | points.resize(0); |
||
640 | arrow.name = "SemiCircleInL"; |
||
641 | 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"); |
||
642 | arrow.points = points.copy(); |
||
643 | appPrefs.arrowStyles.append(arrow); |
||
644 | arrow.name = "SemiCircleInM"; |
||
645 | points.map(arrowScaling); |
||
646 | arrow.points = points.copy(); |
||
647 | appPrefs.arrowStyles.append(arrow); |
||
648 | arrow.name = "SemiCircleInS"; |
||
649 | points.map(arrowScaling); |
||
650 | arrow.points = points.copy(); |
||
651 | appPrefs.arrowStyles.append(arrow); |
||
652 | points.resize(0); |
||
653 | arrow.name = "SemiCircleOutL"; |
||
654 | 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"); |
||
655 | points.translate(7.125493, 0.763446); |
||
656 | arrow.points = points.copy(); |
||
657 | appPrefs.arrowStyles.append(arrow); |
||
658 | arrow.name = "SemiCircleOutM"; |
||
659 | points.map(arrowScaling); |
||
660 | arrow.points = points.copy(); |
||
661 | appPrefs.arrowStyles.append(arrow); |
||
662 | arrow.name = "SemiCircleOutS"; |
||
663 | points.map(arrowScaling); |
||
664 | arrow.points = points.copy(); |
||
665 | appPrefs.arrowStyles.append(arrow); |
||
666 | points.resize(0); |
||
667 | arrow.name = "Arrow2L"; |
||
668 | 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 | 669 | points.translate(-6.0, -0.016013256); |
11176 | fschmid | 670 | points.map(arrowRotate); |
671 | arrow.points = points.copy(); |
||
672 | appPrefs.arrowStyles.append(arrow); |
||
673 | arrow.name = "Arrow2M"; |
||
674 | points.map(arrowScaling); |
||
675 | arrow.points = points.copy(); |
||
676 | appPrefs.arrowStyles.append(arrow); |
||
677 | arrow.name = "Arrow2S"; |
||
678 | points.map(arrowScaling); |
||
679 | arrow.points = points.copy(); |
||
680 | appPrefs.arrowStyles.append(arrow); |
||
681 | points.resize(0); |
||
682 | arrow.name = "ScissorsL"; |
||
683 | 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"); |
||
684 | points.map(arrowRotate); |
||
685 | arrow.points = points.copy(); |
||
686 | appPrefs.arrowStyles.append(arrow); |
||
687 | arrow.name = "ScissorsM"; |
||
688 | points.map(arrowScaling); |
||
689 | arrow.points = points.copy(); |
||
690 | appPrefs.arrowStyles.append(arrow); |
||
691 | arrow.name = "ScissorsS"; |
||
692 | points.map(arrowScaling); |
||
693 | arrow.points = points.copy(); |
||
694 | appPrefs.arrowStyles.append(arrow); |
||
695 | points.resize(0); |
||
696 | arrow.name = "ClubL"; |
||
697 | 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"); |
||
698 | points.map(arrowRotate); |
||
699 | arrow.points = points.copy(); |
||
700 | appPrefs.arrowStyles.append(arrow); |
||
701 | arrow.name = "ClubM"; |
||
702 | points.map(arrowScaling); |
||
703 | arrow.points = points.copy(); |
||
704 | appPrefs.arrowStyles.append(arrow); |
||
705 | arrow.name = "ClubS"; |
||
706 | points.map(arrowScaling); |
||
707 | arrow.points = points.copy(); |
||
708 | appPrefs.arrowStyles.append(arrow); |
||
12515 | fschmid | 709 | arrow.name = "LineL"; |
710 | points.resize(0); |
||
711 | points.parseSVG("M 0, -5 L 1, -5 L 1, 5 L 0, 5 z"); |
||
712 | arrow.points = points.copy(); |
||
713 | appPrefs.arrowStyles.append(arrow); |
||
714 | arrow.name = "LineM"; |
||
715 | points.map(arrowScaling); |
||
716 | arrow.points = points.copy(); |
||
717 | appPrefs.arrowStyles.append(arrow); |
||
718 | arrow.name = "LineS"; |
||
719 | points.map(arrowScaling); |
||
720 | arrow.points = points.copy(); |
||
721 | appPrefs.arrowStyles.append(arrow); |
||
722 | points.resize(0); |
||
2835 | cbradney | 723 | } |
724 | |||
725 | QString PrefsManager::setupPreferencesLocation() |
||
726 | { |
||
5917 | jghali | 727 | QString Pff = QDir::convertSeparators(ScPaths::getApplicationDataDir()); |
2835 | cbradney | 728 | QFileInfo Pffi = QFileInfo(Pff); |
729 | QString PrefsPfad; |
||
13171 | cbradney | 730 | //If we are using the ScPaths default prefs location |
2835 | cbradney | 731 | if (Pffi.exists()) |
732 | { |
||
733 | if (Pffi.isDir()) |
||
734 | PrefsPfad = Pff; |
||
735 | else |
||
10398 | cbradney | 736 | PrefsPfad = QDir::homePath(); |
2835 | cbradney | 737 | } |
13171 | cbradney | 738 | else // Move to using the ScPaths default prefs location/scribus.* from ~/.scribus.* |
2835 | cbradney | 739 | { |
740 | QDir prefsDirectory = QDir(); |
||
741 | prefsDirectory.mkdir(Pff); |
||
742 | PrefsPfad = Pff; |
||
10398 | cbradney | 743 | QString oldPR = QDir::convertSeparators(QDir::homePath()+"/.scribus.rc"); |
2835 | cbradney | 744 | QFileInfo oldPi = QFileInfo(oldPR); |
745 | if (oldPi.exists()) |
||
746 | moveFile(oldPR, Pff+"/scribus.rc"); |
||
10398 | cbradney | 747 | QString oldPR2 = QDir::convertSeparators(QDir::homePath()+"/.scribusfont.rc"); |
2835 | cbradney | 748 | QFileInfo oldPi2 = QFileInfo(oldPR2); |
749 | if (oldPi2.exists()) |
||
750 | moveFile(oldPR2, Pff+"/scribusfont.rc"); |
||
10398 | cbradney | 751 | QString oldPR3 = QDir::convertSeparators(QDir::homePath()+"/.scribusscrap.scs"); |
2835 | cbradney | 752 | QFileInfo oldPi3 = QFileInfo(oldPR3); |
753 | if (oldPi3.exists()) |
||
754 | moveFile(oldPR3, Pff+"/scrap.scs"); |
||
755 | } |
||
13608 | jghali | 756 | QString scP = QDir::convertSeparators(ScPaths::getPluginDataDir()); |
757 | QFileInfo scPi = QFileInfo(scP); |
||
758 | if (!scPi.exists()) |
||
759 | { |
||
760 | QDir pluginDataDirectory = QDir(); |
||
761 | pluginDataDirectory.mkdir(scP); |
||
762 | } |
||
4611 | fschmid | 763 | QString scB = QDir::convertSeparators(Pff+"/scrapbook"); |
764 | QFileInfo scBi = QFileInfo(scB); |
||
765 | if (!scBi.exists()) |
||
766 | { |
||
767 | QDir scrapDirectory = QDir(); |
||
768 | scrapDirectory.mkdir(scB); |
||
769 | QDir scrapMainDirectory = QDir(); |
||
770 | scrapDirectory.mkdir(QDir::convertSeparators(scB+"/main")); |
||
771 | } |
||
5760 | fschmid | 772 | QFileInfo scTmp = QFileInfo(QDir::convertSeparators(scB+"/tmp")); |
773 | if (!scTmp.exists()) |
||
774 | { |
||
775 | QDir scrapDirectoryT = QDir(); |
||
776 | scrapDirectoryT.mkdir(QDir::convertSeparators(scB+"/tmp")); |
||
777 | } |
||
2835 | cbradney | 778 | prefsLocation=PrefsPfad; |
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 | |
8673 | cbradney | 792 | prefs135[0]=QDir::convertSeparators(prefsLocation+"/scribus135.rc"); |
793 | prefs135[1]=QDir::convertSeparators(prefsLocation+"/scrap135.scs"); |
||
794 | prefs135[2]=QDir::convertSeparators(prefsLocation+"/prefs135.xml"); |
||
795 | prefs135[3]=QDir::convertSeparators(prefsLocation+"/scripter135.rc"); |
||
13608 | jghali | 796 | prefs140[0]=QDir::convertSeparators(prefsLocation+"/scribus140.rc"); |
797 | prefs140[1]=QDir::convertSeparators(prefsLocation+"/scrap140.scs"); |
||
798 | prefs140[2]=QDir::convertSeparators(prefsLocation+"/prefs140.xml"); |
||
799 | prefs140[3]=QDir::convertSeparators(prefsLocation+"/scripter140.rc"); |
||
800 | prefs150[0]=QDir::convertSeparators(prefsLocation+"/scribus150.rc"); |
||
801 | prefs150[1]=QDir::convertSeparators(prefsLocation+"/scrap150.scs"); |
||
802 | prefs150[2]=QDir::convertSeparators(prefsLocation+"/prefs150.xml"); |
||
803 | prefs150[3]=QDir::convertSeparators(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); |
||
5781 | cbradney | 826 | if ( (ScMessageBox::question( ScCore->primaryMainWindow(), tr("Migrate Old Scribus Settings?"), |
13608 | jghali | 827 | tr("Scribus has detected existing Scribus 1.3.5 preferences files.\n" |
2835 | cbradney | 828 | "Do you want to migrate them to the new Scribus version?"), |
829 | QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::NoButton))==QMessageBox::Yes ) |
||
830 | { |
||
831 | for (uint i=0;i<4;++i) |
||
832 | { |
||
13608 | jghali | 833 | if (existsPrefs135[i] && !existsPrefs150[i]) |
834 | copyFile(prefs135[i], prefs150[i]); |
||
2835 | cbradney | 835 | } |
836 | } |
||
5656 | cbradney | 837 | if (splashShown) |
838 | ScCore->showSplash(true); |
||
2835 | cbradney | 839 | } |
840 | } |
||
13608 | jghali | 841 | else if(existsPrefs140[0]) |
8673 | cbradney | 842 | { |
843 | for (uint i=0;i<4;++i) |
||
844 | { |
||
13608 | jghali | 845 | if (existsPrefs140[i] && !existsPrefs150[i]) |
846 | copyFile(prefs140[i], prefs150[i]); |
||
8673 | cbradney | 847 | } |
848 | } |
||
13608 | jghali | 849 | else if(existsPrefs135[0]) |
5200 | cbradney | 850 | { |
851 | for (uint i=0;i<4;++i) |
||
852 | { |
||
13608 | jghali | 853 | if (existsPrefs135[i] && !existsPrefs150[i]) |
854 | copyFile(prefs135[i], prefs150[i]); |
||
5200 | cbradney | 855 | } |
856 | } |
||
2835 | cbradney | 857 | return retVal; |
858 | } |
||
859 | |||
2856 | cbradney | 860 | void PrefsManager::convert12Preferences() |
2835 | cbradney | 861 | { |
862 | // Import 1.2 font search path prefs |
||
863 | QFile fontPrefsFile12(QDir::convertSeparators(prefsLocation+"/scribusfont.rc")); |
||
8501 | cbradney | 864 | if (fontPrefsFile12.open(QIODevice::ReadOnly)) |
2835 | cbradney | 865 | { |
2856 | cbradney | 866 | PrefsContext *pc = prefsFile->getContext("Fonts"); |
2835 | cbradney | 867 | PrefsTable *fontPrefs = pc->getTable("ExtraFontDirs"); |
10004 | fschmid | 868 | QTextStream tsx(&fontPrefsFile12); |
869 | QString extraPath = tsx.readAll(); |
||
2835 | cbradney | 870 | fontPrefsFile12.close(); |
10603 | fschmid | 871 | QStringList extraFonts = extraPath.split("\n", QString::SkipEmptyParts); |
8528 | cbradney | 872 | for (int i = 0; i < extraFonts.count(); ++i) |
2835 | cbradney | 873 | fontPrefs->set(i, 0, extraFonts[i]); |
874 | } |
||
875 | } |
||
2859 | cbradney | 876 | |
3873 | subik | 877 | void PrefsManager::ReadPrefs(const QString & fname) |
2859 | cbradney | 878 | { |
3873 | subik | 879 | QString realFile; |
880 | if (fname.isNull()) |
||
13608 | jghali | 881 | realFile = prefsLocation + "/scribus150.rc"; |
3873 | subik | 882 | else |
883 | realFile = fname; |
||
884 | |||
885 | if (QFile::exists(realFile)) |
||
886 | { |
||
887 | if (!ReadPref(realFile)) |
||
3171 | craig | 888 | { |
889 | alertLoadPrefsFailed(); |
||
890 | return; |
||
891 | } |
||
3873 | subik | 892 | } |
5243 | cbradney | 893 | } |
3873 | subik | 894 | |
5243 | cbradney | 895 | void PrefsManager::setupMainWindow(ScribusMainWindow* mw) |
896 | { |
||
13955 | cbradney | 897 | mw->setDefaultPrinter(appPrefs.printerPrefs.PrinterName, appPrefs.printerPrefs.PrinterFile, appPrefs.printerPrefs.PrinterCommand); |
2859 | cbradney | 898 | |
13955 | cbradney | 899 | uint max = qMin(appPrefs.uiPrefs.recentDocCount, appPrefs.uiPrefs.RecentDocs.count()); |
2859 | cbradney | 900 | for (uint m = 0; m < max; ++m) |
901 | { |
||
13955 | cbradney | 902 | QFileInfo fd(appPrefs.uiPrefs.RecentDocs[m]); |
2859 | cbradney | 903 | if (fd.exists()) |
904 | { |
||
13955 | cbradney | 905 | mw->RecentDocs.append(appPrefs.uiPrefs.RecentDocs[m]); |
906 | ScCore->fileWatcher->addFile(appPrefs.uiPrefs.RecentDocs[m]); |
||
2859 | cbradney | 907 | } |
908 | } |
||
5243 | cbradney | 909 | mw->rebuildRecentFileMenu(); |
13955 | cbradney | 910 | mw->move(appPrefs.uiPrefs.mainWinSettings.xPosition, appPrefs.uiPrefs.mainWinSettings.yPosition); |
911 | mw->resize(appPrefs.uiPrefs.mainWinSettings.width, appPrefs.uiPrefs.mainWinSettings.height); |
||
912 | if (appPrefs.uiPrefs.mainWinSettings.maximized) |
||
10550 | avox | 913 | mw->setWindowState((ScCore->primaryMainWindow()->windowState() & ~Qt::WindowMinimized) | Qt::WindowMaximized); |
13482 | cbradney | 914 | //For 1.3.5, we dump prefs first time around. |
915 | if (!firstTimeIgnoreOldPrefs) |
||
916 | ReadPrefsXML(); |
||
13955 | cbradney | 917 | if (appPrefs.checkerPrefsList.count() == 0) |
2859 | cbradney | 918 | { |
13955 | cbradney | 919 | initDefaultCheckerPrefs(&appPrefs.checkerPrefsList); |
10096 | jghali | 920 | appPrefs.curCheckProfile = CommonStrings::PostScript; |
2859 | cbradney | 921 | } |
13955 | cbradney | 922 | if (!appPrefs.uiPrefs.mainWinState.isEmpty()) |
10256 | fschmid | 923 | { |
13955 | cbradney | 924 | mw->restoreState(appPrefs.uiPrefs.mainWinState); |
10256 | fschmid | 925 | } |
2859 | cbradney | 926 | } |
927 | |||
928 | void PrefsManager::ReadPrefsXML() |
||
929 | { |
||
10256 | fschmid | 930 | if (prefsFile) |
931 | { |
||
932 | PrefsContext* userprefsContext = prefsFile->getContext("user_preferences"); |
||
933 | if (userprefsContext) |
||
934 | { |
||
13876 | cbradney | 935 | appPrefs.uiPrefs.language = userprefsContext->get("gui_language",""); |
13955 | cbradney | 936 | appPrefs.uiPrefs.mainWinState = QByteArray::fromBase64(userprefsContext->get("mainwinstate","").toAscii()); |
14043 | jghali | 937 | //continue here... |
938 | //Prefs."blah blah" =... |
||
10256 | fschmid | 939 | } |
12104 | jghali | 940 | if (prefsFile->hasContext("print_options")) |
941 | { |
||
942 | // Reset copies number to 1 when user start new session |
||
943 | PrefsContext* printOptionsContext = prefsFile->getContext("print_options"); |
||
944 | if (printOptionsContext) |
||
945 | printOptionsContext->set("Copies", 1); |
||
946 | } |
||
10256 | fschmid | 947 | } |
2859 | cbradney | 948 | } |
949 | |||
950 | |||
3873 | subik | 951 | void PrefsManager::SavePrefs(const QString & fname) |
2859 | cbradney | 952 | { |
953 | // If closing because of a crash don't save prefs as we can |
||
954 | // accidentally nuke the settings if the crash is before prefs are loaded |
||
3170 | craig | 955 | // The caller is responsible for ensuring we aren't called under those |
956 | // conditions. |
||
957 | Q_ASSERT(!emergencyActivated); |
||
13955 | cbradney | 958 | appPrefs.uiPrefs.mainWinSettings.xPosition = abs(ScCore->primaryMainWindow()->pos().x()); |
959 | appPrefs.uiPrefs.mainWinSettings.yPosition = abs(ScCore->primaryMainWindow()->pos().y()); |
||
960 | appPrefs.uiPrefs.mainWinSettings.width = ScCore->primaryMainWindow()->size().width(); |
||
961 | appPrefs.uiPrefs.mainWinSettings.height = ScCore->primaryMainWindow()->size().height(); |
||
962 | appPrefs.uiPrefs.mainWinSettings.maximized = ScCore->primaryMainWindow()->isMaximized(); |
||
963 | appPrefs.uiPrefs.mainWinState = ScCore->primaryMainWindow()->saveState(); |
||
964 | appPrefs.uiPrefs.RecentDocs.clear(); |
||
13876 | cbradney | 965 | uint max = qMin(appPrefs.uiPrefs.recentDocCount, ScCore->primaryMainWindow()->RecentDocs.count()); |
2859 | cbradney | 966 | for (uint m = 0; m < max; ++m) |
967 | { |
||
13955 | cbradney | 968 | appPrefs.uiPrefs.RecentDocs.append(ScCore->primaryMainWindow()->RecentDocs[m]); |
2859 | cbradney | 969 | } |
13955 | cbradney | 970 | ScCore->primaryMainWindow()->getDefaultPrinter(appPrefs.printerPrefs.PrinterName, appPrefs.printerPrefs.PrinterFile, appPrefs.printerPrefs.PrinterCommand); |
3170 | craig | 971 | SavePrefsXML(); |
3873 | subik | 972 | QString realFile; |
973 | if (fname.isNull()) |
||
13608 | jghali | 974 | realFile = prefsLocation+"/scribus150.rc"; |
3873 | subik | 975 | else |
976 | realFile = fname; |
||
977 | if (!WritePref(realFile)) |
||
3170 | craig | 978 | alertSavePrefsFailed(); |
5257 | cbradney | 979 | emit prefsChanged(); |
2859 | cbradney | 980 | } |
981 | |||
982 | void PrefsManager::SavePrefsXML() |
||
983 | { |
||
10256 | fschmid | 984 | if (prefsFile) |
985 | { |
||
986 | PrefsContext* userprefsContext = prefsFile->getContext("user_preferences"); |
||
987 | if (userprefsContext) |
||
988 | { |
||
13876 | cbradney | 989 | userprefsContext->set("gui_language", appPrefs.uiPrefs.language); |
13955 | cbradney | 990 | userprefsContext->set("mainwinstate", QString::fromAscii(appPrefs.uiPrefs.mainWinState.toBase64())); |
14043 | jghali | 991 | //continue here... |
992 | //Prefs."blah blah" =... |
||
10256 | fschmid | 993 | } |
994 | prefsFile->write(); |
||
995 | } |
||
2859 | cbradney | 996 | } |
2862 | cbradney | 997 | |
998 | void PrefsManager::setGhostscriptExecutable(const QString& executableName) |
||
999 | { |
||
13955 | cbradney | 1000 | appPrefs.extToolPrefs.gs_exe=executableName; |
2862 | cbradney | 1001 | } |
1002 | |||
1003 | void PrefsManager::setImageEditorExecutable(const QString& executableName) |
||
1004 | { |
||
13955 | cbradney | 1005 | appPrefs.extToolPrefs.imageEditorExecutable=executableName; |
2862 | cbradney | 1006 | } |
1007 | |||
5418 | cbradney | 1008 | void PrefsManager::setExtBrowserExecutable(const QString& executableName) |
2862 | cbradney | 1009 | { |
13955 | cbradney | 1010 | appPrefs.extToolPrefs.extBrowserExecutable=executableName; |
2862 | cbradney | 1011 | } |
1012 | |||
13957 | herm | 1013 | void PrefsManager::setUniconvExecutable(const QString& executableName) |
1014 | { |
||
1015 | appPrefs.extToolPrefs.uniconvExecutable=executableName; |
||
1016 | } |
||
1017 | |||
11506 | mrdocs | 1018 | void PrefsManager::setLatexConfigs(const QStringList& configs) |
10228 | avox | 1019 | { |
13955 | cbradney | 1020 | appPrefs.extToolPrefs.latexConfigs=configs; |
10228 | avox | 1021 | } |
1022 | |||
1023 | void PrefsManager::setLatexEditorExecutable(const QString& executableName) |
||
1024 | { |
||
13955 | cbradney | 1025 | appPrefs.extToolPrefs.latexEditorExecutable=executableName; |
10228 | avox | 1026 | } |
1027 | |||
2871 | cbradney | 1028 | const QString PrefsManager::documentDir() |
1029 | { |
||
13876 | cbradney | 1030 | return appPrefs.pathPrefs.documents; |
2871 | cbradney | 1031 | } |
1032 | |||
3931 | subik | 1033 | void PrefsManager::setDocumentDir(const QString& dirname) |
1034 | { |
||
13876 | cbradney | 1035 | appPrefs.pathPrefs.documents = dirname; |
3931 | subik | 1036 | } |
1037 | |||
13870 | cbradney | 1038 | int PrefsManager::mouseWheelJump() const |
2871 | cbradney | 1039 | { |
13876 | cbradney | 1040 | return appPrefs.uiPrefs.wheelJump; |
2871 | cbradney | 1041 | } |
1042 | |||
2870 | cbradney | 1043 | //Changed to return false when we have no fonts |
6700 | cbradney | 1044 | bool PrefsManager::GetAllFonts(bool showFontInfo) |
2870 | cbradney | 1045 | { |
13955 | cbradney | 1046 | appPrefs.fontPrefs.AvailFonts.GetFonts(prefsLocation, showFontInfo); |
1047 | return !appPrefs.fontPrefs.AvailFonts.isEmpty(); |
||
2870 | cbradney | 1048 | } |
2871 | cbradney | 1049 | |
1050 | void PrefsManager::setShowStartupDialog(const bool showDialog) |
||
1051 | { |
||
13876 | cbradney | 1052 | appPrefs.uiPrefs.showStartupDialog=showDialog; |
2871 | cbradney | 1053 | } |
1054 | |||
1055 | const ColorList& PrefsManager::colorSet() |
||
1056 | { |
||
13967 | cbradney | 1057 | return appPrefs.colorPrefs.DColors; |
2871 | cbradney | 1058 | } |
1059 | |||
1060 | ColorList* PrefsManager::colorSetPtr() |
||
1061 | { |
||
13967 | cbradney | 1062 | return &appPrefs.colorPrefs.DColors; |
2871 | cbradney | 1063 | } |
1064 | |||
1065 | const QString& PrefsManager::colorSetName() |
||
1066 | { |
||
13967 | cbradney | 1067 | return appPrefs.colorPrefs.DColorSet; |
2871 | cbradney | 1068 | } |
1069 | |||
7718 | jghali | 1070 | bool PrefsManager::isToolColor(const QString& name) |
1071 | { |
||
13953 | cbradney | 1072 | return isToolColor(appPrefs.itemToolPrefs, name); |
7718 | jghali | 1073 | } |
1074 | |||
13953 | cbradney | 1075 | bool PrefsManager::isToolColor(const struct ItemToolPrefs& settings, const QString& name) |
7718 | jghali | 1076 | { |
13996 | cbradney | 1077 | if (settings.textColor == name) |
7718 | jghali | 1078 | return true; |
13996 | cbradney | 1079 | if (settings.textStrokeColor == name) |
7718 | jghali | 1080 | return true; |
14014 | cbradney | 1081 | if (settings.textFillColor == name) |
7718 | jghali | 1082 | return true; |
13996 | cbradney | 1083 | if (settings.textLineColor == name) |
7718 | jghali | 1084 | return true; |
14014 | cbradney | 1085 | if (settings.shapeLineColor == name) |
7718 | jghali | 1086 | return true; |
14014 | cbradney | 1087 | if (settings.shapeFillColor == name) |
7718 | jghali | 1088 | return true; |
13996 | cbradney | 1089 | if (settings.lineColor == name) |
7718 | jghali | 1090 | return true; |
13996 | cbradney | 1091 | if (settings.imageFillColor == name) |
7718 | jghali | 1092 | return true; |
1093 | return false; |
||
1094 | } |
||
1095 | |||
1096 | QStringList PrefsManager::toolColorNames() |
||
1097 | { |
||
13953 | cbradney | 1098 | return toolColorNames(appPrefs.itemToolPrefs); |
7718 | jghali | 1099 | } |
1100 | |||
13953 | cbradney | 1101 | QStringList PrefsManager::toolColorNames(const struct ItemToolPrefs& settings) |
7718 | jghali | 1102 | { |
1103 | QStringList names; |
||
13996 | cbradney | 1104 | names.append(settings.textColor); |
1105 | if (!names.contains(settings.textStrokeColor)) |
||
1106 | names.append(settings.textStrokeColor); |
||
14014 | cbradney | 1107 | if (!names.contains(settings.textFillColor)) |
1108 | names.append(settings.textFillColor); |
||
13996 | cbradney | 1109 | if (!names.contains(settings.textLineColor)) |
1110 | names.append(settings.textLineColor); |
||
14014 | cbradney | 1111 | if (!names.contains(settings.shapeLineColor)) |
1112 | names.append(settings.shapeLineColor); |
||
1113 | if (!names.contains(settings.shapeFillColor)) |
||
1114 | names.append(settings.shapeFillColor); |
||
13996 | cbradney | 1115 | if (!names.contains(settings.lineColor)) |
1116 | names.append(settings.lineColor); |
||
1117 | if (!names.contains(settings.imageFillColor)) |
||
1118 | names.append(settings.imageFillColor); |
||
7718 | jghali | 1119 | return names; |
1120 | } |
||
1121 | |||
1122 | void PrefsManager::replaceToolColors(const QMap<QString, QString> replaceMap) |
||
1123 | { |
||
13953 | cbradney | 1124 | replaceToolColors(appPrefs.itemToolPrefs, replaceMap); |
7718 | jghali | 1125 | } |
1126 | |||
13953 | cbradney | 1127 | void PrefsManager::replaceToolColors(struct ItemToolPrefs& settings, const QMap<QString, QString> replaceMap) |
7718 | jghali | 1128 | { |
13996 | cbradney | 1129 | if (replaceMap.contains(settings.textColor)) |
1130 | settings.textColor = replaceMap[settings.textColor]; |
||
1131 | if (replaceMap.contains(settings.textStrokeColor)) |
||
1132 | settings.textStrokeColor = replaceMap[settings.textStrokeColor]; |
||
14014 | cbradney | 1133 | if (replaceMap.contains(settings.textFillColor)) |
1134 | settings.textFillColor = replaceMap[settings.textFillColor]; |
||
13996 | cbradney | 1135 | if (replaceMap.contains(settings.textLineColor)) |
1136 | settings.textLineColor = replaceMap[settings.textLineColor]; |
||
14014 | cbradney | 1137 | if (replaceMap.contains(settings.shapeLineColor)) |
1138 | settings.shapeLineColor = replaceMap[settings.shapeLineColor]; |
||
1139 | if (replaceMap.contains(settings.shapeFillColor)) |
||
1140 | settings.shapeFillColor = replaceMap[settings.shapeFillColor]; |
||
13996 | cbradney | 1141 | if (replaceMap.contains(settings.lineColor)) |
1142 | settings.lineColor = replaceMap[settings.lineColor]; |
||
1143 | if (replaceMap.contains(settings.imageFillColor)) |
||
1144 | settings.imageFillColor = replaceMap[settings.imageFillColor]; |
||
7718 | jghali | 1145 | } |
1146 | |||
2871 | cbradney | 1147 | void PrefsManager::setColorSet(const ColorList& colorSet) |
1148 | { |
||
7718 | jghali | 1149 | // Color set may have changed and tools color not be present in the new color set |
1150 | ColorList tmpSet = colorSet; |
||
13996 | cbradney | 1151 | QString penText = appPrefs.itemToolPrefs.textColor; |
7718 | jghali | 1152 | if (!tmpSet.contains(penText) && penText != CommonStrings::None) |
13967 | cbradney | 1153 | tmpSet[penText] = appPrefs.colorPrefs.DColors[penText]; |
13996 | cbradney | 1154 | QString strokeText = appPrefs.itemToolPrefs.textStrokeColor; |
7718 | jghali | 1155 | if (!tmpSet.contains(strokeText) && strokeText != CommonStrings::None) |
13967 | cbradney | 1156 | tmpSet[strokeText] = appPrefs.colorPrefs.DColors[strokeText]; |
14014 | cbradney | 1157 | QString textFillColor = appPrefs.itemToolPrefs.textFillColor; |
1158 | if (!tmpSet.contains(textFillColor) && textFillColor != CommonStrings::None) |
||
1159 | tmpSet[textFillColor] = appPrefs.colorPrefs.DColors[textFillColor]; |
||
13996 | cbradney | 1160 | QString textLineColor = appPrefs.itemToolPrefs.textLineColor; |
7718 | jghali | 1161 | if (!tmpSet.contains(textLineColor) && textLineColor != CommonStrings::None) |
13967 | cbradney | 1162 | tmpSet[textLineColor] = appPrefs.colorPrefs.DColors[textLineColor]; |
14014 | cbradney | 1163 | QString pen = appPrefs.itemToolPrefs.shapeLineColor; |
7718 | jghali | 1164 | if (!tmpSet.contains(pen) && pen != CommonStrings::None) |
13967 | cbradney | 1165 | tmpSet[pen] = appPrefs.colorPrefs.DColors[pen]; |
14014 | cbradney | 1166 | QString brush = appPrefs.itemToolPrefs.shapeFillColor; |
7718 | jghali | 1167 | if (!tmpSet.contains(brush) && brush != CommonStrings::None) |
13967 | cbradney | 1168 | tmpSet[brush] = appPrefs.colorPrefs.DColors[brush]; |
13996 | cbradney | 1169 | QString penLine = appPrefs.itemToolPrefs.lineColor; |
7718 | jghali | 1170 | if (!tmpSet.contains(penLine) && penLine != CommonStrings::None) |
13967 | cbradney | 1171 | tmpSet[penLine] = appPrefs.colorPrefs.DColors[penLine]; |
13996 | cbradney | 1172 | QString brushPict = appPrefs.itemToolPrefs.imageFillColor; |
7718 | jghali | 1173 | if (!tmpSet.contains(brushPict) && brushPict != CommonStrings::None) |
13967 | cbradney | 1174 | tmpSet[brushPict] = appPrefs.colorPrefs.DColors[brushPict]; |
1175 | appPrefs.colorPrefs.DColors = tmpSet; |
||
2871 | cbradney | 1176 | } |
1177 | |||
1178 | void PrefsManager::setColorSetName(const QString& colorSetName) |
||
1179 | { |
||
13967 | cbradney | 1180 | appPrefs.colorPrefs.DColorSet=colorSetName; |
2871 | cbradney | 1181 | } |
2873 | cbradney | 1182 | |
1183 | |||
3932 | avox | 1184 | void PrefsManager::setKeyEntry(const QString& actName, const QString& cleanMenuText, const QKeySequence& keyseq, const int& rowNumber) |
2873 | cbradney | 1185 | { |
1186 | Keys ke; |
||
2877 | cbradney | 1187 | if (!actName.isEmpty()) |
2873 | cbradney | 1188 | { |
5781 | cbradney | 1189 | if (ScCore->primaryMainWindow()->scrActions[actName]) |
2873 | cbradney | 1190 | { |
1191 | ke.actionName=actName; |
||
1192 | ke.keySequence = keyseq; |
||
1193 | ke.cleanMenuText=cleanMenuText; |
||
1194 | ke.tableRow=rowNumber; |
||
13955 | cbradney | 1195 | appPrefs.keyShortcutPrefs.KeyActions.insert(actName, ke); |
2873 | cbradney | 1196 | } |
1197 | else |
||
10553 | fschmid | 1198 | qDebug("%s", QString("Action Name: %1 does not exist").arg(actName).toAscii().constData()); |
2873 | cbradney | 1199 | } |
1200 | } |
||
1201 | |||
10509 | cbradney | 1202 | double PrefsManager::displayScale() const |
2873 | cbradney | 1203 | { |
13974 | cbradney | 1204 | return appPrefs.displayPrefs.displayScale; |
2873 | cbradney | 1205 | } |
1206 | |||
13870 | cbradney | 1207 | const QString& PrefsManager::uiLanguage() const |
2873 | cbradney | 1208 | { |
13876 | cbradney | 1209 | return appPrefs.uiPrefs.language; |
2873 | cbradney | 1210 | } |
1211 | |||
10390 | cbradney | 1212 | const QString& PrefsManager::guiStyle() const |
2873 | cbradney | 1213 | { |
13876 | cbradney | 1214 | return appPrefs.uiPrefs.style; |
2873 | cbradney | 1215 | } |
1216 | |||
11115 | subik | 1217 | const QString& PrefsManager::guiSystemStyle() const |
1218 | { |
||
13870 | cbradney | 1219 | return appPrefs.ui_SystemTheme; |
11115 | subik | 1220 | } |
1221 | |||
10390 | cbradney | 1222 | const int& PrefsManager::guiFontSize() const |
2873 | cbradney | 1223 | { |
13876 | cbradney | 1224 | return appPrefs.uiPrefs.applicationFontSize; |
2873 | cbradney | 1225 | } |
2889 | cbradney | 1226 | |
10390 | cbradney | 1227 | const int& PrefsManager::paletteFontSize() const |
3940 | tsoots | 1228 | { |
13876 | cbradney | 1229 | return appPrefs.uiPrefs.paletteFontSize; |
3940 | tsoots | 1230 | } |
1231 | |||
12476 | cbradney | 1232 | bool PrefsManager::showPageShadow() const |
1233 | { |
||
13955 | cbradney | 1234 | return appPrefs.displayPrefs.showPageShadow; |
12476 | cbradney | 1235 | } |
1236 | |||
3170 | craig | 1237 | bool PrefsManager::WritePref(QString ho) |
2889 | cbradney | 1238 | { |
1239 | QDomDocument docu("scribusrc"); |
||
1240 | QString st="<SCRIBUSRC></SCRIBUSRC>"; |
||
1241 | docu.setContent(st); |
||
1242 | QDomElement elem=docu.documentElement(); |
||
13474 | cbradney | 1243 | elem.setAttribute("VERSION","1.3.5"); |
2889 | cbradney | 1244 | QDomElement dc=docu.createElement("GUI"); |
13876 | cbradney | 1245 | dc.setAttribute("UI_THEME",appPrefs.uiPrefs.style); |
1246 | dc.setAttribute("UI_WHEELJUMP",appPrefs.uiPrefs.wheelJump); |
||
1247 | dc.setAttribute("UI_MOUSEMOVETIMEOUT", appPrefs.uiPrefs.mouseMoveTimeout); |
||
1248 | dc.setAttribute("UI_APPLICATIONFONTSIZE",appPrefs.uiPrefs.applicationFontSize); |
||
1249 | dc.setAttribute("UI_PALETTEFONTSIZE",appPrefs.uiPrefs.paletteFontSize); |
||
13889 | cbradney | 1250 | dc.setAttribute("GRAB",appPrefs.guidesPrefs.grabRadius); |
13876 | cbradney | 1251 | dc.setAttribute("UNIT",appPrefs.docSetupPrefs.docUnitIndex); |
1252 | dc.setAttribute("UI_RECENTDOCCOUNT", appPrefs.uiPrefs.recentDocCount); |
||
1253 | dc.setAttribute("DOC", appPrefs.pathPrefs.documents); |
||
1254 | dc.setAttribute("PROFILES", appPrefs.pathPrefs.colorProfiles); |
||
1255 | dc.setAttribute("SCRIPTS", appPrefs.pathPrefs.scripts); |
||
1256 | dc.setAttribute("TEMPLATES", appPrefs.pathPrefs.documentTemplates); |
||
13889 | cbradney | 1257 | dc.setAttribute("SHOWGUIDES", static_cast<int>(appPrefs.guidesPrefs.guidesShown)); |
1258 | dc.setAttribute("showcolborders", static_cast<int>(appPrefs.guidesPrefs.colBordersShown)); |
||
1259 | dc.setAttribute("FRV", static_cast<int>(appPrefs.guidesPrefs.framesShown)); |
||
1260 | dc.setAttribute("SHOWLAYERM", static_cast<int>(appPrefs.guidesPrefs.layerMarkersShown)); |
||
1261 | dc.setAttribute("SHOWMARGIN", static_cast<int>(appPrefs.guidesPrefs.marginsShown)); |
||
1262 | dc.setAttribute("SHOWBASE", static_cast<int>(appPrefs.guidesPrefs.baselineGridShown)); |
||
1263 | dc.setAttribute("SHOWLINK", static_cast<int>(appPrefs.guidesPrefs.linkShown)); |
||
1264 | dc.setAttribute("SHOWPICT", static_cast<int>(appPrefs.guidesPrefs.showPic)); |
||
1265 | dc.setAttribute("SHOWControl", static_cast<int>(appPrefs.guidesPrefs.showControls)); |
||
1266 | dc.setAttribute("rulersShown", static_cast<int>(appPrefs.guidesPrefs.rulersShown)); |
||
1267 | dc.setAttribute("showBleed", static_cast<int>(appPrefs.guidesPrefs.showBleed)); |
||
1268 | dc.setAttribute("rulerMode", static_cast<int>(appPrefs.guidesPrefs.rulerMode)); |
||
13955 | cbradney | 1269 | dc.setAttribute("ScratchBottom", appPrefs.displayPrefs.scratch.Bottom); |
1270 | dc.setAttribute("ScratchLeft", appPrefs.displayPrefs.scratch.Left); |
||
1271 | dc.setAttribute("ScratchRight", appPrefs.displayPrefs.scratch.Right); |
||
1272 | dc.setAttribute("ScratchTop", appPrefs.displayPrefs.scratch.Top); |
||
13974 | cbradney | 1273 | dc.setAttribute("GapHorizontal", ScCLocale::toQStringC(appPrefs.displayPrefs.pageGapHorizontal)); |
1274 | dc.setAttribute("GapVertical", ScCLocale::toQStringC(appPrefs.displayPrefs.pageGapVertical)); |
||
13996 | cbradney | 1275 | dc.setAttribute("STECOLOR", appPrefs.storyEditorPrefs.guiFontColor.name()); |
1276 | dc.setAttribute("STEFONT", appPrefs.storyEditorPrefs.guiFont); |
||
13955 | cbradney | 1277 | dc.setAttribute("STYLEPREVIEW", static_cast<int>(appPrefs.miscPrefs.haveStylePreview)); |
13876 | cbradney | 1278 | dc.setAttribute("UI_SHOWSTARTUPDIALOG", static_cast<int>(appPrefs.uiPrefs.showStartupDialog)); |
14203 | cbradney | 1279 | dc.setAttribute("UI_SHOWSPLASHSCREEN", static_cast<int>(appPrefs.uiPrefs.showSplashOnStartup)); |
13876 | cbradney | 1280 | dc.setAttribute("UI_USESMALLWIDGETS", static_cast<int>(appPrefs.uiPrefs.useSmallWidgets)); |
14224 | fschmid | 1281 | dc.setAttribute("UI_USESTABS", static_cast<int>(appPrefs.uiPrefs.useTabs)); |
13955 | cbradney | 1282 | dc.setAttribute("ToolTips", static_cast<int>(appPrefs.displayPrefs.showToolTips)); |
1283 | dc.setAttribute("showMouseCoordinates", static_cast<int>(appPrefs.displayPrefs.showMouseCoordinates)); |
||
1284 | dc.setAttribute("stickyTools", static_cast<int>(appPrefs.uiPrefs.stickyTools)); |
||
2889 | cbradney | 1285 | elem.appendChild(dc); |
1286 | QDomElement dc1=docu.createElement("GRID"); |
||
13889 | cbradney | 1287 | dc1.setAttribute("MINOR",ScCLocale::toQStringC(appPrefs.guidesPrefs.minorGridSpacing)); |
1288 | dc1.setAttribute("MAJOR",ScCLocale::toQStringC(appPrefs.guidesPrefs.majorGridSpacing)); |
||
1289 | dc1.setAttribute("MINORC",appPrefs.guidesPrefs.minorGridColor.name()); |
||
1290 | dc1.setAttribute("MAJORC",appPrefs.guidesPrefs.majorGridColor.name()); |
||
1291 | dc1.setAttribute("GuideC", appPrefs.guidesPrefs.guideColor.name()); |
||
1292 | dc1.setAttribute("BaseC", appPrefs.guidesPrefs.baselineGridColor.name()); |
||
1293 | dc1.setAttribute("GuideZ", ScCLocale::toQStringC(appPrefs.guidesPrefs.guideRad)); |
||
1294 | dc1.setAttribute("BACKG", static_cast<int>(appPrefs.guidesPrefs.guidePlacement)); |
||
1295 | dc1.setAttribute("SHOW", static_cast<int>(appPrefs.guidesPrefs.gridShown)); |
||
2889 | cbradney | 1296 | elem.appendChild(dc1); |
1297 | QDomElement dc1a=docu.createElement("PAGE"); |
||
13955 | cbradney | 1298 | dc1a.setAttribute("ShowPageShadow",static_cast<int>(appPrefs.displayPrefs.showPageShadow)); |
13974 | cbradney | 1299 | dc1a.setAttribute("PAGEC",appPrefs.displayPrefs.paperColor.name()); |
1300 | dc1a.setAttribute("SELEC",appPrefs.displayPrefs.frameColor.name()); |
||
1301 | dc1a.setAttribute("DFrameNormColor",appPrefs.displayPrefs.frameNormColor.name()); |
||
1302 | dc1a.setAttribute("DFrameGroupColor",appPrefs.displayPrefs.frameGroupColor.name()); |
||
1303 | dc1a.setAttribute("DFrameLockColor",appPrefs.displayPrefs.frameLockColor.name()); |
||
1304 | dc1a.setAttribute("DFrameLinkColor",appPrefs.displayPrefs.frameLinkColor.name()); |
||
1305 | dc1a.setAttribute("DFrameAnnotationColor",appPrefs.displayPrefs.frameAnnotationColor.name()); |
||
1306 | dc1a.setAttribute("DPageBorderColor",appPrefs.displayPrefs.pageBorderColor.name()); |
||
1307 | dc1a.setAttribute("DControlCharColor",appPrefs.displayPrefs.controlCharColor.name()); |
||
13889 | cbradney | 1308 | dc1a.setAttribute("MARGC",appPrefs.guidesPrefs.marginColor.name()); |
13955 | cbradney | 1309 | dc1a.setAttribute("RANDF", static_cast<int>(appPrefs.displayPrefs.marginColored)); |
13974 | cbradney | 1310 | dc1a.setAttribute("DScale", ScCLocale::toQStringC(appPrefs.displayPrefs.displayScale)); |
2889 | cbradney | 1311 | elem.appendChild(dc1a); |
14312 | jghali | 1312 | // Font information must be written before FONTS element so that face "usable" |
1313 | // member is set properly before one try to set default font. Allows to check |
||
1314 | // that default font is indeed usable, problems expected otherwise |
||
1315 | for ( SCFontsIterator itf(appPrefs.fontPrefs.AvailFonts); itf.hasNext(); itf.next()) |
||
1316 | { |
||
1317 | if (!itf.currentKey().isEmpty()) |
||
1318 | { |
||
1319 | QDomElement fn=docu.createElement("FONT"); |
||
1320 | fn.setAttribute("NAME",itf.currentKey()); |
||
1321 | fn.setAttribute("EMBED",static_cast<int>(itf.current().embedPs())); |
||
1322 | fn.setAttribute("USE", static_cast<int>(itf.current().usable())); |
||
1323 | fn.setAttribute("SUBSET", static_cast<int>(itf.current().subset())); |
||
1324 | elem.appendChild(fn); |
||
1325 | } |
||
1326 | } |
||
1327 | QMap<QString,QString>::Iterator itfsu; |
||
1328 | for (itfsu = appPrefs.fontPrefs.GFontSub.begin(); itfsu != appPrefs.fontPrefs.GFontSub.end(); ++itfsu) |
||
1329 | { |
||
1330 | QDomElement fosu = docu.createElement("Substitute"); |
||
1331 | fosu.setAttribute("Name",itfsu.key()); |
||
1332 | fosu.setAttribute("Replace",itfsu.value()); |
||
1333 | elem.appendChild(fosu); |
||
1334 | } |
||
2889 | cbradney | 1335 | QDomElement dc2=docu.createElement("FONTS"); |
13996 | cbradney | 1336 | dc2.setAttribute("FACE",appPrefs.itemToolPrefs.textFont); |
1337 | dc2.setAttribute("SIZE",appPrefs.itemToolPrefs.textSize / 10.0); |
||
13955 | cbradney | 1338 | dc2.setAttribute("AutomaticSubst", static_cast<int>(appPrefs.fontPrefs.askBeforeSubstitute)); |
2889 | cbradney | 1339 | elem.appendChild(dc2); |
1340 | QDomElement dc3=docu.createElement("TYPO"); |
||
13953 | cbradney | 1341 | dc3.setAttribute("TIEF",appPrefs.typoPrefs.valueSubScript); |
1342 | dc3.setAttribute("TIEFSC",appPrefs.typoPrefs.scalingSubScript); |
||
1343 | dc3.setAttribute("HOCH",appPrefs.typoPrefs.valueSuperScript); |
||
1344 | dc3.setAttribute("HOCHSC",appPrefs.typoPrefs.scalingSuperScript); |
||
1345 | dc3.setAttribute("SMCAPS",appPrefs.typoPrefs.valueSmallCaps); |
||
1346 | dc3.setAttribute("AUTOL", appPrefs.typoPrefs.autoLineSpacing); |
||
13889 | cbradney | 1347 | dc3.setAttribute("BASE", ScCLocale::toQStringC(appPrefs.guidesPrefs.valueBaselineGrid)); |
1348 | dc3.setAttribute("BASEO", ScCLocale::toQStringC(appPrefs.guidesPrefs.offsetBaselineGrid)); |
||
13953 | cbradney | 1349 | if (appPrefs.typoPrefs.valueUnderlinePos == -1) |
1350 | dc3.setAttribute("UnderlinePos", appPrefs.typoPrefs.valueUnderlinePos); |
||
2889 | cbradney | 1351 | else |
13953 | cbradney | 1352 | dc3.setAttribute("UnderlinePos", appPrefs.typoPrefs.valueUnderlinePos / 10.0); |
1353 | if (appPrefs.typoPrefs.valueUnderlineWidth == -1) |
||
1354 | dc3.setAttribute("UnderlineWidth", appPrefs.typoPrefs.valueUnderlineWidth); |
||
2889 | cbradney | 1355 | else |
13953 | cbradney | 1356 | dc3.setAttribute("UnderlineWidth", appPrefs.typoPrefs.valueUnderlineWidth / 10.0); |
1357 | if (appPrefs.typoPrefs.valueStrikeThruPos == -1) |
||
1358 | dc3.setAttribute("StrikeThruPos", appPrefs.typoPrefs.valueStrikeThruPos); |
||
2889 | cbradney | 1359 | else |
13953 | cbradney | 1360 | dc3.setAttribute("StrikeThruPos", appPrefs.typoPrefs.valueStrikeThruPos / 10.0); |
1361 | if (appPrefs.typoPrefs.valueStrikeThruWidth == -1) |
||
1362 | dc3.setAttribute("StrikeThruWidth", appPrefs.typoPrefs.valueStrikeThruWidth); |
||
2889 | cbradney | 1363 | else |
13953 | cbradney | 1364 | dc3.setAttribute("StrikeThruWidth", appPrefs.typoPrefs.valueStrikeThruWidth / 10.0); |
2889 | cbradney | 1365 | elem.appendChild(dc3); |
1366 | QDomElement dc9=docu.createElement("TOOLS"); |
||
14014 | cbradney | 1367 | dc9.setAttribute("PEN",appPrefs.itemToolPrefs.shapeLineColor); |
1368 | dc9.setAttribute("BRUSH",appPrefs.itemToolPrefs.shapeFillColor); |
||
13996 | cbradney | 1369 | dc9.setAttribute("PENLINE",appPrefs.itemToolPrefs.lineColor); |
1370 | dc9.setAttribute("PENTEXT",appPrefs.itemToolPrefs.textColor); |
||
1371 | dc9.setAttribute("StrokeText",appPrefs.itemToolPrefs.textStrokeColor); |
||
14014 | cbradney | 1372 | dc9.setAttribute("TextBackGround", appPrefs.itemToolPrefs.textFillColor); |
13996 | cbradney | 1373 | dc9.setAttribute("TextLineColor", appPrefs.itemToolPrefs.textLineColor); |
14014 | cbradney | 1374 | dc9.setAttribute("TextBackGroundShade", appPrefs.itemToolPrefs.textFillColorShade); |
1375 | dc9.setAttribute("TextLineShade", appPrefs.itemToolPrefs.textLineColorShade); |
||
13996 | cbradney | 1376 | dc9.setAttribute("TextPenShade", appPrefs.itemToolPrefs.textShade); |
1377 | dc9.setAttribute("TextStrokeShade", appPrefs.itemToolPrefs.textStrokeShade); |
||
1378 | dc9.setAttribute("TEXTCOL",appPrefs.itemToolPrefs.textColumns); |
||
1379 | dc9.setAttribute("TEXTGAP",ScCLocale::toQStringC(appPrefs.itemToolPrefs.textColumnGap)); |
||
1380 | dc9.setAttribute("TabWidth",ScCLocale::toQStringC(appPrefs.itemToolPrefs.textTabWidth)); |
||
1381 | dc9.setAttribute("TabFill",appPrefs.itemToolPrefs.textTabFillChar); |
||
14014 | cbradney | 1382 | dc9.setAttribute("STIL",appPrefs.itemToolPrefs.shapeLineStyle); |
13996 | cbradney | 1383 | dc9.setAttribute("STILLINE",appPrefs.itemToolPrefs.lineStyle); |
14014 | cbradney | 1384 | dc9.setAttribute("WIDTH",ScCLocale::toQStringC(appPrefs.itemToolPrefs.shapeLineWidth)); |
13996 | cbradney | 1385 | dc9.setAttribute("WIDTHLINE",ScCLocale::toQStringC(appPrefs.itemToolPrefs.lineWidth)); |
14014 | cbradney | 1386 | dc9.setAttribute("PENSHADE",appPrefs.itemToolPrefs.shapeLineColorShade); |
1387 | dc9.setAttribute("LINESHADE",appPrefs.itemToolPrefs.lineColorShade); |
||
1388 | dc9.setAttribute("BRUSHSHADE",appPrefs.itemToolPrefs.shapeFillColorShade); |
||
13953 | cbradney | 1389 | dc9.setAttribute("MAGMIN",appPrefs.opToolPrefs.magMin); |
1390 | dc9.setAttribute("MAGMAX",appPrefs.opToolPrefs.magMax); |
||
1391 | dc9.setAttribute("MAGSTEP",appPrefs.opToolPrefs.magStep); |
||
13996 | cbradney | 1392 | dc9.setAttribute("CPICT",appPrefs.itemToolPrefs.imageFillColor); |
14014 | cbradney | 1393 | dc9.setAttribute("PICTSHADE",appPrefs.itemToolPrefs.imageFillColorShade); |
13996 | cbradney | 1394 | dc9.setAttribute("PICTSCX",ScCLocale::toQStringC(appPrefs.itemToolPrefs.imageScaleX)); |
1395 | dc9.setAttribute("PICTSCY",ScCLocale::toQStringC(appPrefs.itemToolPrefs.imageScaleY)); |
||
1396 | dc9.setAttribute("POLYC", appPrefs.itemToolPrefs.polyCorners); |
||
14022 | cbradney | 1397 | dc9.setAttribute("POLYF", ScCLocale::toQStringC(appPrefs.itemToolPrefs.polyFactor)); |
13996 | cbradney | 1398 | dc9.setAttribute("POLYR", ScCLocale::toQStringC(appPrefs.itemToolPrefs.polyRotation)); |
14027 | fschmid | 1399 | dc9.setAttribute("POLYFD", appPrefs.itemToolPrefs.polyFactorGuiVal); |
13953 | cbradney | 1400 | dc9.setAttribute("POLYCUR", ScCLocale::toQStringC(appPrefs.itemToolPrefs.polyCurvature)); |
13996 | cbradney | 1401 | dc9.setAttribute("POLYS", static_cast<int>(appPrefs.itemToolPrefs.polyUseFactor)); |
1402 | dc9.setAttribute("PSCALE", static_cast<int>(appPrefs.itemToolPrefs.imageScaleType)); |
||
1403 | dc9.setAttribute("PASPECT", static_cast<int>(appPrefs.itemToolPrefs.imageAspectRatio)); |
||
1404 | dc9.setAttribute("EmbeddedPath", static_cast<int>(appPrefs.itemToolPrefs.imageUseEmbeddedPath)); |
||
1405 | dc9.setAttribute("HalfRes", appPrefs.itemToolPrefs.imageLowResType); |
||
1406 | dc9.setAttribute("StartArrow", appPrefs.itemToolPrefs.lineStartArrow); |
||
1407 | dc9.setAttribute("EndArrow", appPrefs.itemToolPrefs.lineEndArrow); |
||
13953 | cbradney | 1408 | dc9.setAttribute("dispX", ScCLocale::toQStringC(appPrefs.opToolPrefs.dispX)); |
1409 | dc9.setAttribute("dispY", ScCLocale::toQStringC(appPrefs.opToolPrefs.dispY)); |
||
1410 | dc9.setAttribute("constrain", ScCLocale::toQStringC(appPrefs.opToolPrefs.constrain)); |
||
2889 | cbradney | 1411 | elem.appendChild(dc9); |
1412 | QDomElement dc4=docu.createElement("MAINWINDOW"); |
||
13955 | cbradney | 1413 | dc4.setAttribute("XPOS",appPrefs.uiPrefs.mainWinSettings.xPosition); |
1414 | dc4.setAttribute("YPOS",appPrefs.uiPrefs.mainWinSettings.yPosition); |
||
1415 | dc4.setAttribute("WIDTH",appPrefs.uiPrefs.mainWinSettings.width); |
||
1416 | dc4.setAttribute("HEIGHT",appPrefs.uiPrefs.mainWinSettings.height); |
||
1417 | dc4.setAttribute("MAXIMIZED",static_cast<int>(appPrefs.uiPrefs.mainWinSettings.maximized)); |
||
2889 | cbradney | 1418 | elem.appendChild(dc4); |
4735 | fschmid | 1419 | QDomElement dc73=docu.createElement("SCRAPBOOK"); |
13955 | cbradney | 1420 | dc73.setAttribute("CopyToScrapbook",static_cast<int>(appPrefs.scrapbookPrefs.doCopyToScrapbook)); |
1421 | dc73.setAttribute("persistentScrapbook",static_cast<int>(appPrefs.scrapbookPrefs.persistentScrapbook)); |
||
14715 | fschmid | 1422 | dc73.setAttribute("writePreviews",static_cast<int>(appPrefs.scrapbookPrefs.writePreviews)); |
13955 | cbradney | 1423 | dc73.setAttribute("numScrapbookCopies",appPrefs.scrapbookPrefs.numScrapbookCopies); |
1424 | for (int rd=0; rd<appPrefs.scrapbookPrefs.RecentScrapbooks.count(); ++rd) |
||
4735 | fschmid | 1425 | { |
1426 | QDomElement rde=docu.createElement("RECENT"); |
||
13955 | cbradney | 1427 | rde.setAttribute("NAME",appPrefs.scrapbookPrefs.RecentScrapbooks[rd]); |
4735 | fschmid | 1428 | dc73.appendChild(rde); |
1429 | } |
||
1430 | elem.appendChild(dc73); |
||
2889 | cbradney | 1431 | QDomElement dc75=docu.createElement("PAGEPALETTE"); |
13967 | cbradney | 1432 | dc75.setAttribute("THUMBS", static_cast<int>(appPrefs.uiPrefs.SepalT)); |
1433 | dc75.setAttribute("NAMES", static_cast<int>(appPrefs.uiPrefs.SepalN)); |
||
2889 | cbradney | 1434 | elem.appendChild(dc75); |
1435 | QDomElement dc76=docu.createElement("DOKUMENT"); |
||
13876 | cbradney | 1436 | dc76.setAttribute("PAGESIZE",appPrefs.docSetupPrefs.pageSize); |
1437 | dc76.setAttribute("AUSRICHTUNG",appPrefs.docSetupPrefs.pageOrientation); |
||
1438 | dc76.setAttribute("BREITE",ScCLocale::toQStringC(appPrefs.docSetupPrefs.pageWidth)); |
||
1439 | dc76.setAttribute("HOEHE",ScCLocale::toQStringC(appPrefs.docSetupPrefs.pageHeight)); |
||
1440 | dc76.setAttribute("RANDO",ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.Top)); |
||
1441 | dc76.setAttribute("RANDU",ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.Bottom)); |
||
1442 | dc76.setAttribute("RANDL",ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.Left)); |
||
1443 | dc76.setAttribute("RANDR",ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.Right)); |
||
1444 | dc76.setAttribute("PRESET",appPrefs.docSetupPrefs.marginPreset); |
||
1445 | dc76.setAttribute("DOPPEL", appPrefs.docSetupPrefs.pagePositioning); |
||
13967 | cbradney | 1446 | dc76.setAttribute("AutoSave", static_cast<int>(appPrefs.docSetupPrefs.AutoSave)); |
1447 | dc76.setAttribute("AutoSaveTime", appPrefs.docSetupPrefs.AutoSaveTime); |
||
14764 | cbradney | 1448 | dc76.setAttribute("SaveCompressed", static_cast<int>(appPrefs.docSetupPrefs.saveCompressed)); |
13876 | cbradney | 1449 | dc76.setAttribute("BleedTop", ScCLocale::toQStringC(appPrefs.docSetupPrefs.bleeds.Top)); |
1450 | dc76.setAttribute("BleedLeft", ScCLocale::toQStringC(appPrefs.docSetupPrefs.bleeds.Left)); |
||
1451 | dc76.setAttribute("BleedRight", ScCLocale::toQStringC(appPrefs.docSetupPrefs.bleeds.Right)); |
||
1452 | dc76.setAttribute("BleedBottom", ScCLocale::toQStringC(appPrefs.docSetupPrefs.bleeds.Bottom)); |
||
2889 | cbradney | 1453 | elem.appendChild(dc76); |
3016 | fschmid | 1454 | QDomElement pageSetAttr = docu.createElement("PageSets"); |
9803 | fschmid | 1455 | QList<PageSet>::Iterator itpgset; |
3016 | fschmid | 1456 | for(itpgset = appPrefs.pageSets.begin(); itpgset != appPrefs.pageSets.end(); ++itpgset ) |
1457 | { |
||
1458 | QDomElement pgst = docu.createElement("Set"); |
||
1459 | pgst.setAttribute("Name", (*itpgset).Name); |
||
1460 | pgst.setAttribute("FirstPage", (*itpgset).FirstPage); |
||
1461 | pgst.setAttribute("Rows", (*itpgset).Rows); |
||
1462 | pgst.setAttribute("Columns", (*itpgset).Columns); |
||
11349 | fschmid | 1463 | // pgst.setAttribute("GapHorizontal", (*itpgset).GapHorizontal); |
1464 | // pgst.setAttribute("GapVertical", (*itpgset).GapVertical); |
||
1465 | // pgst.setAttribute("GapBelow", (*itpgset).GapBelow); |
||
3026 | fschmid | 1466 | QStringList pNames = (*itpgset).pageNames; |
1467 | QStringList::Iterator itpgsetN; |
||
1468 | for(itpgsetN = pNames.begin(); itpgsetN != pNames.end(); ++itpgsetN ) |
||
1469 | { |
||
1470 | QDomElement pgstN = docu.createElement("PageNames"); |
||
1471 | pgstN.setAttribute("Name", (*itpgsetN)); |
||
1472 | pgst.appendChild(pgstN); |
||
1473 | } |
||
3016 | fschmid | 1474 | pageSetAttr.appendChild(pgst); |
1475 | } |
||
1476 | elem.appendChild(pageSetAttr); |
||
3183 | fschmid | 1477 | QDomElement dc79ac=docu.createElement("Checker"); |
1478 | dc79ac.setAttribute("currentProfile", appPrefs.curCheckProfile); |
||
1479 | elem.appendChild(dc79ac); |
||
3033 | cbradney | 1480 | CheckerPrefsList::Iterator itcp; |
13955 | cbradney | 1481 | CheckerPrefsList::Iterator itcpend=appPrefs.checkerPrefsList.end(); |
1482 | for (itcp = appPrefs.checkerPrefsList.begin(); itcp != itcpend; ++itcp) |
||
2889 | cbradney | 1483 | { |
1484 | QDomElement dc79a=docu.createElement("CheckProfile"); |
||
1485 | dc79a.setAttribute("Name",itcp.key()); |
||
10398 | cbradney | 1486 | dc79a.setAttribute("ignoreErrors", static_cast<int>(itcp.value().ignoreErrors)); |
1487 | dc79a.setAttribute("autoCheck", static_cast<int>(itcp.value().autoCheck)); |
||
1488 | dc79a.setAttribute("checkGlyphs", static_cast<int>(itcp.value().checkGlyphs)); |
||
1489 | dc79a.setAttribute("checkOrphans", static_cast<int>(itcp.value().checkOrphans)); |
||
1490 | dc79a.setAttribute("checkOverflow", static_cast<int>(itcp.value().checkOverflow)); |
||
1491 | dc79a.setAttribute("checkPictures", static_cast<int>(itcp.value().checkPictures)); |
||
1492 | dc79a.setAttribute("checkResolution", static_cast<int>(itcp.value().checkResolution)); |
||
1493 | dc79a.setAttribute("checkTransparency", static_cast<int>(itcp.value().checkTransparency)); |
||
1494 | dc79a.setAttribute("checkAnnotations", static_cast<int>(itcp.value().checkAnnotations)); |
||
1495 | dc79a.setAttribute("checkRasterPDF", static_cast<int>(itcp.value().checkRasterPDF)); |
||
1496 | dc79a.setAttribute("checkForGIF", static_cast<int>(itcp.value().checkForGIF)); |
||
1497 | dc79a.setAttribute("ignoreOffLayers", static_cast<int>(itcp.value().ignoreOffLayers)); |
||
14541 | cbradney | 1498 | dc79a.setAttribute("checkOffConflictLayers", static_cast<int>(itcp.value().checkOffConflictLayers)); |
13470 | cbradney | 1499 | dc79a.setAttribute("minResolution",ScCLocale::toQStringC(itcp.value().minResolution)); |
1500 | dc79a.setAttribute("maxResolution",ScCLocale::toQStringC(itcp.value().maxResolution)); |
||
14043 | jghali | 1501 | dc79a.setAttribute("checkNotCMYKOrSpot", static_cast<int>(itcp.value().checkNotCMYKOrSpot)); |
1502 | dc79a.setAttribute("checkDeviceColorsAndOutputIntend", static_cast<int>(itcp.value().checkDeviceColorsAndOutputIntend)); |
||
1503 | dc79a.setAttribute("checkFontNotEmbedded", static_cast<int>(itcp.value().checkFontNotEmbedded)); |
||
1504 | dc79a.setAttribute("checkFontIsOpenType", static_cast<int>(itcp.value().checkFontIsOpenType)); |
||
2889 | cbradney | 1505 | elem.appendChild(dc79a); |
1506 | } |
||
1507 | QDomElement dc81=docu.createElement("CMS"); |
||
13967 | cbradney | 1508 | dc81.setAttribute("DPSo", static_cast<int>(appPrefs.colorPrefs.DCMSset.SoftProofOn)); |
1509 | dc81.setAttribute("DPSFo", static_cast<int>(appPrefs.colorPrefs.DCMSset.SoftProofFullOn)); |
||
1510 | dc81.setAttribute("DPuse", static_cast<int>(appPrefs.colorPrefs.DCMSset.CMSinUse)); |
||
1511 | dc81.setAttribute("DPgam", static_cast<int>(appPrefs.colorPrefs.DCMSset.GamutCheck)); |
||
1512 | dc81.setAttribute("DPbla", static_cast<int>(appPrefs.colorPrefs.DCMSset.BlackPoint)); |
||
1513 | dc81.setAttribute("DPMo",appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile); |
||
1514 | dc81.setAttribute("DPPr",appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile); |
||
1515 | dc81.setAttribute("DPIn",appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile); |
||
1516 | dc81.setAttribute("DPInCMYK",appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile); |
||
1517 | dc81.setAttribute("DPIn2",appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile); |
||
1518 | dc81.setAttribute("DPIn3",appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile); |
||
1519 | //dc81.setAttribute("DIPr",appPrefs.colorPrefs.DCMSset.DefaultIntentPrinter); |
||
1520 | //dc81.setAttribute("DIMo",appPrefs.colorPrefs.DCMSset.DefaultIntentMonitor); |
||
1521 | dc81.setAttribute("DISc",appPrefs.colorPrefs.DCMSset.DefaultIntentColors); |
||
1522 | dc81.setAttribute("DIIm",appPrefs.colorPrefs.DCMSset.DefaultIntentImages); |
||
2889 | cbradney | 1523 | elem.appendChild(dc81); |
1524 | QDomElement dc82=docu.createElement("PRINTER"); |
||
13955 | cbradney | 1525 | dc82.setAttribute("NAME",appPrefs.printerPrefs.PrinterName); |
1526 | dc82.setAttribute("FILE",appPrefs.printerPrefs.PrinterFile); |
||
1527 | dc82.setAttribute("COMMAND",appPrefs.printerPrefs.PrinterCommand); |
||
1528 | dc82.setAttribute("CLIPMARGIN", static_cast<int>(appPrefs.printerPrefs.ClipMargin)); |
||
13967 | cbradney | 1529 | dc82.setAttribute("GMODE", static_cast<int>(appPrefs.printerPrefs.GCRMode)); |
2889 | cbradney | 1530 | elem.appendChild(dc82); |
1531 | QDomElement dc8Pr=docu.createElement("PRINTPREVIEW"); |
||
13967 | cbradney | 1532 | dc8Pr.setAttribute("Mode", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_Mode)); |
1533 | //dc8Pr.setAttribute("GcrMode", static_cast<int>(appPrefs.Gcr_Mode)); |
||
1534 | dc8Pr.setAttribute("AntiAliasing", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_AntiAliasing)); |
||
1535 | dc8Pr.setAttribute("Transparency", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_Transparency)); |
||
1536 | dc8Pr.setAttribute("Cyan", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_C)); |
||
1537 | dc8Pr.setAttribute("Magenta", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_M)); |
||
1538 | dc8Pr.setAttribute("Yellow", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_Y)); |
||
1539 | dc8Pr.setAttribute("Black", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_K)); |
||
1540 | dc8Pr.setAttribute("InkCoverage", static_cast<int>(appPrefs.printPreviewPrefs.PrPr_InkCoverage)); |
||
1541 | dc8Pr.setAttribute("InkThreshold", appPrefs.printPreviewPrefs.PrPr_InkThreshold); |
||
2889 | cbradney | 1542 | elem.appendChild(dc8Pr); |
1543 | QDomElement dc8Ex = docu.createElement("EXTERNAL"); |
||
1544 | dc8Ex.setAttribute("GIMP", imageEditorExecutable()); |
||
1545 | dc8Ex.setAttribute("GS", ghostscriptExecutable()); |
||
5418 | cbradney | 1546 | dc8Ex.setAttribute("WebBrowser", extBrowserExecutable()); |
13955 | cbradney | 1547 | dc8Ex.setAttribute("AlphaGraphics", static_cast<int>(appPrefs.extToolPrefs.gs_AntiAliasGraphics)); |
1548 | dc8Ex.setAttribute("AlphaText", static_cast<int>(appPrefs.extToolPrefs.gs_AntiAliasText)); |
||
1549 | dc8Ex.setAttribute("Resolution", appPrefs.extToolPrefs.gs_Resolution); |
||
13957 | herm | 1550 | dc8Ex.setAttribute("Uniconv", uniconvExecutable()); |
10228 | avox | 1551 | dc8Ex.setAttribute("LatexEditor", latexEditorExecutable()); |
1552 | dc8Ex.setAttribute("LatexResolution", latexResolution()); |
||
13955 | cbradney | 1553 | dc8Ex.setAttribute("LatexForceDpi", static_cast<int>(appPrefs.extToolPrefs.latexForceDpi)); |
1554 | dc8Ex.setAttribute("LatexStartWithEmptyFrames", static_cast<int>(appPrefs.extToolPrefs.latexStartWithEmptyFrames)); |
||
11506 | mrdocs | 1555 | QStringList configs = latexConfigs(); |
1556 | foreach (QString config, configs) { |
||
1557 | QDomElement domConfig = docu.createElement("LatexConfig"); |
||
1558 | domConfig.setAttribute("file", config); |
||
13955 | cbradney | 1559 | domConfig.setAttribute("command", appPrefs.extToolPrefs.latexCommands[config]); |
11506 | mrdocs | 1560 | dc8Ex.appendChild(domConfig); |
1561 | } |
||
2889 | cbradney | 1562 | elem.appendChild(dc8Ex); |
1563 | QDomElement rde=docu.createElement("HYPHEN"); |
||
13955 | cbradney | 1564 | rde.setAttribute("LANG", appPrefs.hyphPrefs.Language); |
1565 | rde.setAttribute("WORDLEN", appPrefs.hyphPrefs.MinWordLen); |
||
1566 | rde.setAttribute("HYCOUNT", appPrefs.hyphPrefs.HyCount); |
||
1567 | rde.setAttribute("MODE", static_cast<int>(appPrefs.hyphPrefs.Automatic)); |
||
1568 | rde.setAttribute("INMODE", static_cast<int>(appPrefs.hyphPrefs.AutoCheck)); |
||
1569 | for (QHash<QString, QString>::Iterator hyit = appPrefs.hyphPrefs.specialWords.begin(); hyit != appPrefs.hyphPrefs.specialWords.end(); ++hyit) |
||
10170 | fschmid | 1570 | { |
1571 | QDomElement hyelm = docu.createElement("EXCEPTION"); |
||
1572 | hyelm.setAttribute("WORD", hyit.key()); |
||
1573 | hyelm.setAttribute("HYPHENATED", hyit.value()); |
||
1574 | rde.appendChild(hyelm); |
||
1575 | } |
||
13955 | cbradney | 1576 | for (QSet<QString>::Iterator hyit2 = appPrefs.hyphPrefs.ignoredWords.begin(); hyit2 != appPrefs.hyphPrefs.ignoredWords.end(); ++hyit2) |
10170 | fschmid | 1577 | { |
1578 | QDomElement hyelm2 = docu.createElement("IGNORE"); |
||
1579 | hyelm2.setAttribute("WORD", (*hyit2)); |
||
1580 | rde.appendChild(hyelm2); |
||
1581 | } |
||
2889 | cbradney | 1582 | elem.appendChild(rde); |
1583 | ColorList::Iterator itc; |
||
13967 | cbradney | 1584 | for (itc = appPrefs.colorPrefs.DColors.begin(); itc != appPrefs.colorPrefs.DColors.end(); ++itc) |
2889 | cbradney | 1585 | { |
1586 | QDomElement co=docu.createElement("COLOR"); |
||
1587 | co.setAttribute("NAME",itc.key()); |
||
10398 | cbradney | 1588 | if (itc.value().getColorModel() == colorModelRGB) |
1589 | co.setAttribute("RGB", itc.value().nameRGB()); |
||
4535 | fschmid | 1590 | else |
10398 | cbradney | 1591 | co.setAttribute("CMYK", itc.value().nameCMYK()); |
1592 | co.setAttribute("Spot", static_cast<int>(itc.value().isSpotColor())); |
||
1593 | co.setAttribute("Register", static_cast<int>(itc.value().isRegistrationColor())); |
||
2889 | cbradney | 1594 | elem.appendChild(co); |
1595 | } |
||
14150 | fschmid | 1596 | QMap<QString, VGradient>::Iterator itGrad; |
1597 | for (itGrad = appPrefs.defaultGradients.begin(); itGrad != appPrefs.defaultGradients.end(); ++itGrad) |
||
1598 | { |
||
1599 | QDomElement grad = docu.createElement("Gradient"); |
||
1600 | grad.setAttribute("Name",itGrad.key()); |
||
1601 | VGradient gra = itGrad.value(); |
||
1602 | QList<VColorStop*> cstops = gra.colorStops(); |
||
1603 | for (uint cst = 0; cst < gra.Stops(); ++cst) |
||
1604 | { |
||
1605 | QDomElement stop = docu.createElement("CSTOP"); |
||
1606 | stop.setAttribute("NAME", cstops.at(cst)->name); |
||
1607 | stop.setAttribute("RAMP", ScCLocale::toQStringC(cstops.at(cst)->rampPoint)); |
||
1608 | stop.setAttribute("TRANS", ScCLocale::toQStringC(cstops.at(cst)->opacity)); |
||
1609 | stop.setAttribute("SHADE", cstops.at(cst)->shade); |
||
1610 | grad.appendChild(stop); |
||
1611 | } |
||
1612 | elem.appendChild(grad); |
||
1613 | } |
||
13955 | cbradney | 1614 | for (int rd=0; rd<appPrefs.uiPrefs.RecentDocs.count(); ++rd) |
2889 | cbradney | 1615 | { |
1616 | QDomElement rde=docu.createElement("RECENT"); |
||
13955 | cbradney | 1617 | rde.setAttribute("NAME",appPrefs.uiPrefs.RecentDocs[rd]); |
2889 | cbradney | 1618 | elem.appendChild(rde); |
1619 | } |
||
13955 | cbradney | 1620 | for (QMap<QString,Keys>::Iterator ksc=appPrefs.keyShortcutPrefs.KeyActions.begin(); ksc!=appPrefs.keyShortcutPrefs.KeyActions.end(); ++ksc) |
2889 | cbradney | 1621 | { |
10398 | cbradney | 1622 | if (ksc.value().actionName.isEmpty()) |
5354 | cbradney | 1623 | continue; |
2889 | cbradney | 1624 | QDomElement kscc=docu.createElement("SHORTCUT"); |
10398 | cbradney | 1625 | kscc.setAttribute("ACTION",ksc.value().actionName); |
1626 | kscc.setAttribute("SEQUENCE",TabKeyboardShortcutsWidget::getKeyText(ksc.value().keySequence)); |
||
2889 | cbradney | 1627 | elem.appendChild(kscc); |
1628 | } |
||
13967 | cbradney | 1629 | for (int ccs=0; ccs<appPrefs.colorPrefs.CustomColorSets.count(); ++ccs) |
2889 | cbradney | 1630 | { |
1631 | QDomElement cos=docu.createElement("COLORSET"); |
||
13967 | cbradney | 1632 | cos.setAttribute("NAME",appPrefs.colorPrefs.CustomColorSets[ccs]); |
2889 | cbradney | 1633 | elem.appendChild(cos); |
1634 | } |
||
1635 | QDomElement cosd=docu.createElement("DCOLORSET"); |
||
13967 | cbradney | 1636 | cosd.setAttribute("NAME",appPrefs.colorPrefs.DColorSet); |
2889 | cbradney | 1637 | elem.appendChild(cosd); |
1638 | QDomElement pdf = docu.createElement("PDF"); |
||
13955 | cbradney | 1639 | pdf.setAttribute("Thumbnails", static_cast<int>(appPrefs.pdfPrefs.Thumbnails)); |
1640 | pdf.setAttribute("Articles", static_cast<int>(appPrefs.pdfPrefs.Articles)); |
||
1641 | pdf.setAttribute("Bookmarks", static_cast<int>(appPrefs.pdfPrefs.Bookmarks)); |
||
1642 | pdf.setAttribute("Compress", static_cast<int>(appPrefs.pdfPrefs.Compress)); |
||
1643 | pdf.setAttribute("CMethod", appPrefs.pdfPrefs.CompressMethod); |
||
1644 | pdf.setAttribute("Quality", appPrefs.pdfPrefs.Quality); |
||
1645 | pdf.setAttribute("EmbedPDF", static_cast<int>(appPrefs.pdfPrefs.embedPDF)); |
||
1646 | pdf.setAttribute("MirrorH", static_cast<int>(appPrefs.pdfPrefs.MirrorH)); |
||
1647 | pdf.setAttribute("MirrorV", static_cast<int>(appPrefs.pdfPrefs.MirrorV)); |
||
1648 | pdf.setAttribute("Clip", static_cast<int>(appPrefs.pdfPrefs.doClip)); |
||
1649 | pdf.setAttribute("RotateDeg", static_cast<int>(appPrefs.pdfPrefs.RotateDeg)); |
||
1650 | pdf.setAttribute("PresentMode", static_cast<int>(appPrefs.pdfPrefs.PresentMode)); |
||
1651 | pdf.setAttribute("RecalcPic", static_cast<int>(appPrefs.pdfPrefs.RecalcPic)); |
||
1652 | pdf.setAttribute("Grayscale", static_cast<int>(appPrefs.pdfPrefs.isGrayscale)); |
||
1653 | pdf.setAttribute("RGBMode", static_cast<int>(appPrefs.pdfPrefs.UseRGB)); |
||
1654 | pdf.setAttribute("UseProfiles", static_cast<int>(appPrefs.pdfPrefs.UseProfiles)); |
||
1655 | pdf.setAttribute("UseProfiles2", static_cast<int>(appPrefs.pdfPrefs.UseProfiles2)); |
||
1656 | pdf.setAttribute("Binding", appPrefs.pdfPrefs.Binding); |
||
1657 | pdf.setAttribute("PicRes", appPrefs.pdfPrefs.PicRes); |
||
1658 | pdf.setAttribute("Resolution", appPrefs.pdfPrefs.Resolution); |
||
1659 | pdf.setAttribute("Version", appPrefs.pdfPrefs.Version); |
||
1660 | pdf.setAttribute("Intent", appPrefs.pdfPrefs.Intent); |
||
1661 | pdf.setAttribute("Intent2", appPrefs.pdfPrefs.Intent2); |
||
1662 | pdf.setAttribute("SolidP", appPrefs.pdfPrefs.SolidProf); |
||
1663 | pdf.setAttribute("ImageP", appPrefs.pdfPrefs.ImageProf); |
||
1664 | pdf.setAttribute("PrintP", appPrefs.pdfPrefs.PrintProf); |
||
1665 | pdf.setAttribute("InfoString", appPrefs.pdfPrefs.Info); |
||
1666 | pdf.setAttribute("BTop", ScCLocale::toQStringC(appPrefs.pdfPrefs.bleeds.Top)); |
||
1667 | pdf.setAttribute("BLeft", ScCLocale::toQStringC(appPrefs.pdfPrefs.bleeds.Left)); |
||
1668 | pdf.setAttribute("BRight", ScCLocale::toQStringC(appPrefs.pdfPrefs.bleeds.Right)); |
||
1669 | pdf.setAttribute("BBottom", ScCLocale::toQStringC(appPrefs.pdfPrefs.bleeds.Bottom)); |
||
1670 | pdf.setAttribute("useDocBleeds", static_cast<int>(appPrefs.pdfPrefs.useDocBleeds)); |
||
1671 | pdf.setAttribute("cropMarks", static_cast<int>(appPrefs.pdfPrefs.cropMarks)); |
||
1672 | pdf.setAttribute("bleedMarks", static_cast<int>(appPrefs.pdfPrefs.bleedMarks)); |
||
1673 | pdf.setAttribute("registrationMarks", static_cast<int>(appPrefs.pdfPrefs.registrationMarks)); |
||
1674 | pdf.setAttribute("colorMarks", static_cast<int>(appPrefs.pdfPrefs.colorMarks)); |
||
1675 | pdf.setAttribute("docInfoMarks", static_cast<int>(appPrefs.pdfPrefs.docInfoMarks)); |
||
1676 | pdf.setAttribute("markOffset", appPrefs.pdfPrefs.markOffset); |
||
1677 | pdf.setAttribute("ImagePr", static_cast<int>(appPrefs.pdfPrefs.EmbeddedI)); |
||
1678 | pdf.setAttribute("PassOwner", appPrefs.pdfPrefs.PassOwner); |
||
1679 | pdf.setAttribute("PassUser", appPrefs.pdfPrefs.PassUser); |
||
1680 | pdf.setAttribute("Permissions", appPrefs.pdfPrefs.Permissions); |
||
1681 | pdf.setAttribute("Encrypt", static_cast<int>(appPrefs.pdfPrefs.Encrypt)); |
||
1682 | pdf.setAttribute("UseLayers", static_cast<int>(appPrefs.pdfPrefs.useLayers)); |
||
1683 | pdf.setAttribute("UseLpi", static_cast<int>(appPrefs.pdfPrefs.UseLPI)); |
||
1684 | pdf.setAttribute("UseSpotColors", static_cast<int>(appPrefs.pdfPrefs.UseSpotColors)); |
||
1685 | pdf.setAttribute("doMultiFile", static_cast<int>(appPrefs.pdfPrefs.doMultiFile)); |
||
1686 | pdf.setAttribute("displayBookmarks", static_cast<int>(appPrefs.pdfPrefs.displayBookmarks)); |
||
1687 | pdf.setAttribute("displayFullscreen", static_cast<int>(appPrefs.pdfPrefs.displayFullscreen)); |
||
1688 | pdf.setAttribute("displayLayers", static_cast<int>(appPrefs.pdfPrefs.displayLayers)); |
||
1689 | pdf.setAttribute("displayThumbs", static_cast<int>(appPrefs.pdfPrefs.displayThumbs)); |
||
1690 | pdf.setAttribute("PageLayout", appPrefs.pdfPrefs.PageLayout); |
||
1691 | pdf.setAttribute("openAction", appPrefs.pdfPrefs.openAction); |
||
2889 | cbradney | 1692 | QMap<QString,LPIData>::Iterator itlp; |
13955 | cbradney | 1693 | for (itlp = appPrefs.pdfPrefs.LPISettings.begin(); itlp != appPrefs.pdfPrefs.LPISettings.end(); ++itlp) |
2889 | cbradney | 1694 | { |
1695 | QDomElement pdf4 = docu.createElement("LPI"); |
||
1696 | pdf4.setAttribute("Color", itlp.key()); |
||
10398 | cbradney | 1697 | pdf4.setAttribute("Frequency", itlp.value().Frequency); |
1698 | pdf4.setAttribute("Angle", itlp.value().Angle); |
||
1699 | pdf4.setAttribute("SpotFunction", itlp.value().SpotFunc); |
||
2889 | cbradney | 1700 | pdf.appendChild(pdf4); |
1701 | } |
||
1702 | elem.appendChild(pdf); |
||
1703 | QDomElement docItemAttrs = docu.createElement("DefaultItemAttributes"); |
||
13955 | cbradney | 1704 | for(ObjAttrVector::Iterator objAttrIt = appPrefs.itemAttrPrefs.defaultItemAttributes.begin() ; objAttrIt != appPrefs.itemAttrPrefs.defaultItemAttributes.end(); ++objAttrIt ) |
2889 | cbradney | 1705 | { |
1706 | QDomElement itemAttr = docu.createElement("ItemAttribute"); |
||
1707 | itemAttr.setAttribute("Name", (*objAttrIt).name); |
||
1708 | itemAttr.setAttribute("Type", (*objAttrIt).type); |
||
1709 | itemAttr.setAttribute("Value", (*objAttrIt).value); |
||
1710 | itemAttr.setAttribute("Parameter", (*objAttrIt).parameter); |
||
1711 | itemAttr.setAttribute("Relationship", (*objAttrIt).relationship); |
||
1712 | itemAttr.setAttribute("RelationshipTo", (*objAttrIt).relationshipto); |
||
1713 | itemAttr.setAttribute("AutoAddTo", (*objAttrIt).autoaddto); |
||
1714 | docItemAttrs.appendChild(itemAttr); |
||
1715 | } |
||
1716 | elem.appendChild(docItemAttrs); |
||
1717 | QDomElement tocElem = docu.createElement("TablesOfContents"); |
||
13955 | cbradney | 1718 | for(ToCSetupVector::Iterator tocSetupIt = appPrefs.tocPrefs.defaultToCSetups.begin() ; tocSetupIt != appPrefs.tocPrefs.defaultToCSetups.end(); ++tocSetupIt ) |
2889 | cbradney | 1719 | { |
1720 | QDomElement tocsetup = docu.createElement("TableOfContents"); |
||
1721 | tocsetup.setAttribute("Name", (*tocSetupIt).name); |
||
1722 | tocsetup.setAttribute("ItemAttributeName", (*tocSetupIt).itemAttrName); |
||
1723 | tocsetup.setAttribute("FrameName", (*tocSetupIt).frameName); |
||
1724 | tocsetup.setAttribute("ListNonPrinting", (*tocSetupIt).listNonPrintingFrames); |
||
1725 | tocsetup.setAttribute("Style", (*tocSetupIt).textStyle); |
||
1726 | tocsetup.setAttribute("NumberPlacement", (*tocSetupIt).pageLocation); |
||
1727 | tocElem.appendChild(tocsetup); |
||
1728 | } |
||
1729 | elem.appendChild(tocElem); |
||
1730 | // lorem ipsum |
||
1731 | QDomElement liElem = docu.createElement("LoremIpsum"); |
||
13955 | cbradney | 1732 | liElem.setAttribute("useStandardLI", static_cast<int>(appPrefs.miscPrefs.useStandardLI)); |
1733 | liElem.setAttribute("paragraphsLI", appPrefs.miscPrefs.paragraphsLI); |
||
2889 | cbradney | 1734 | elem.appendChild(liElem); |
14539 | jghali | 1735 | // image cache |
1736 | QDomElement icElem = docu.createElement("ImageCache"); |
||
1737 | icElem.setAttribute("cacheEnabled", appPrefs.imageCachePrefs.cacheEnabled); |
||
1738 | icElem.setAttribute("maxCacheSizeMiB", appPrefs.imageCachePrefs.maxCacheSizeMiB); |
||
1739 | icElem.setAttribute("maxCacheEntries", appPrefs.imageCachePrefs.maxCacheEntries); |
||
1740 | icElem.setAttribute("compressionLevel", appPrefs.imageCachePrefs.compressionLevel); |
||
1741 | elem.appendChild(icElem); |
||
2889 | cbradney | 1742 | // write file |
3170 | craig | 1743 | bool result = false; |
2889 | cbradney | 1744 | QFile f(ho); |
8501 | cbradney | 1745 | if(!f.open(QIODevice::WriteOnly)) |
3170 | craig | 1746 | { |
1747 | m_lastError = tr("Could not open preferences file \"%1\" for writing: %2") |
||
10553 | fschmid | 1748 | .arg(ho).arg(qApp->translate("QFile",f.errorString().toLatin1().constData())); |
3170 | craig | 1749 | } |
1750 | else |
||
1751 | { |
||
10004 | fschmid | 1752 | QTextStream s(&f); |
1753 | s.setCodec("UTF-8"); |
||
3170 | craig | 1754 | s<<docu.toString(); |
8528 | cbradney | 1755 | if (f.error()==QFile::NoError) |
3170 | craig | 1756 | result = true; |
1757 | else |
||
1758 | m_lastError = tr("Writing to preferences file \"%1\" failed: " |
||
14043 | jghali | 1759 | "QIODevice status code %2") |
10553 | fschmid | 1760 | .arg(ho).arg(f.errorString()); |
3170 | craig | 1761 | } |
1762 | if (f.isOpen()) |
||
1763 | f.close(); |
||
1764 | return result; |
||
2889 | cbradney | 1765 | } |
1766 | |||
1767 | bool PrefsManager::ReadPref(QString ho) |
||
1768 | { |
||
1769 | QDomDocument docu("scridoc"); |
||
1770 | QFile f(ho); |
||
8501 | cbradney | 1771 | if(!f.open(QIODevice::ReadOnly)) |
3171 | craig | 1772 | { |
1773 | m_lastError = tr("Failed to open prefs file \"%1\": %2") |
||
10553 | fschmid | 1774 | .arg(ho).arg( qApp->translate("QFile",f.errorString().toLatin1().constData()) ); |
2889 | cbradney | 1775 | return false; |
3171 | craig | 1776 | } |
10004 | fschmid | 1777 | QTextStream ts(&f); |
1778 | ts.setCodec("UTF-8"); |
||
2889 | cbradney | 1779 | QString errorMsg; |
1780 | int errorLine = 0, errorColumn = 0; |
||
10004 | fschmid | 1781 | if( !docu.setContent(ts.readAll(), &errorMsg, &errorLine, &errorColumn) ) |
2889 | cbradney | 1782 | { |
3171 | craig | 1783 | m_lastError = tr("Failed to read prefs XML from \"%1\": %2 at line %3, col %4") |
1784 | .arg(ho).arg(errorMsg).arg(errorLine).arg(errorColumn); |
||
2889 | cbradney | 1785 | f.close(); |
1786 | return false; |
||
1787 | } |
||
1788 | f.close(); |
||
1789 | QDomElement elem=docu.documentElement(); |
||
1790 | if (elem.tagName() != "SCRIBUSRC") |
||
1791 | return false; |
||
13474 | cbradney | 1792 | //Ignore scribus*.rc files prior to 1.3.5 due to changes |
1793 | bool prefs135FileFound=false; |
||
1794 | if (elem.hasAttribute("VERSION")) |
||
1795 | { |
||
1796 | if (elem.attribute("VERSION") == "1.3.5") |
||
1797 | prefs135FileFound=true; |
||
1798 | } |
||
13482 | cbradney | 1799 | firstTimeIgnoreOldPrefs=!prefs135FileFound; |
13474 | cbradney | 1800 | if (!prefs135FileFound) |
1801 | return false; |
||
13967 | cbradney | 1802 | appPrefs.colorPrefs.DColors.clear(); |
13955 | cbradney | 1803 | appPrefs.extToolPrefs.latexCommands.clear(); |
2889 | cbradney | 1804 | ScColor lf = ScColor(); |
1805 | QDomNode DOC=elem.firstChild(); |
||
3183 | fschmid | 1806 | if (!DOC.namedItem("CheckProfile").isNull()) |
13955 | cbradney | 1807 | appPrefs.checkerPrefsList.clear(); |
2889 | cbradney | 1808 | while(!DOC.isNull()) |
1809 | { |
||
1810 | QDomElement dc=DOC.toElement(); |
||
1811 | if (dc.tagName()=="GUI") |
||
1812 | { |
||
13870 | cbradney | 1813 | if (dc.hasAttribute("STILT")) |
13876 | cbradney | 1814 | appPrefs.uiPrefs.style = dc.attribute("STILT"); |
13870 | cbradney | 1815 | else |
13876 | cbradney | 1816 | appPrefs.uiPrefs.style = dc.attribute("UI_THEME","Default"); |
13870 | cbradney | 1817 | if (dc.hasAttribute("RAD")) |
13876 | cbradney | 1818 | appPrefs.uiPrefs.wheelJump = dc.attribute("RAD").toInt(); |
13870 | cbradney | 1819 | else |
13876 | cbradney | 1820 | appPrefs.uiPrefs.wheelJump = dc.attribute("UI_WHEELJUMP").toInt(); |
13870 | cbradney | 1821 | if (dc.hasAttribute("MOVT")) |
13876 | cbradney | 1822 | appPrefs.uiPrefs.mouseMoveTimeout = dc.attribute("MOVT").toInt(); |
13870 | cbradney | 1823 | else |
13876 | cbradney | 1824 | appPrefs.uiPrefs.mouseMoveTimeout = dc.attribute("UI_MOUSEMOVETIMEOUT", "150").toInt(); |
13870 | cbradney | 1825 | if (dc.hasAttribute("APF")) |
13876 | cbradney | 1826 | appPrefs.uiPrefs.applicationFontSize = dc.attribute("APF").toInt(); |
13870 | cbradney | 1827 | else |
13876 | cbradney | 1828 | appPrefs.uiPrefs.applicationFontSize = dc.attribute("UI_APPLICATIONFONTSIZE", "12").toInt(); |
13870 | cbradney | 1829 | if (dc.hasAttribute("PFS")) |
13876 | cbradney | 1830 | appPrefs.uiPrefs.paletteFontSize = dc.attribute("PFS").toInt(); |
13870 | cbradney | 1831 | else |
13876 | cbradney | 1832 | appPrefs.uiPrefs.paletteFontSize = dc.attribute("UI_PALETTEFONTSIZE", "10").toInt(); |
13870 | cbradney | 1833 | if (dc.hasAttribute("RCD")) |
13876 | cbradney | 1834 | appPrefs.uiPrefs.recentDocCount = dc.attribute("RCD").toInt(); |
13870 | cbradney | 1835 | else |
13876 | cbradney | 1836 | appPrefs.uiPrefs.recentDocCount = dc.attribute("UI_RECENTDOCCOUNT","5").toUInt(); |
1837 | if (dc.hasAttribute("StartUp")) |
||
1838 | appPrefs.uiPrefs.showStartupDialog = dc.attribute("StartUp").toInt(); |
||
1839 | else |
||
1840 | appPrefs.uiPrefs.showStartupDialog = static_cast<bool>(dc.attribute("UI_SHOWSTARTUPDIALOG", "1").toInt()); |
||
14203 | cbradney | 1841 | appPrefs.uiPrefs.showSplashOnStartup = static_cast<bool>(dc.attribute("UI_SHOWSPLASHSCREEN", "1").toInt()); |
13876 | cbradney | 1842 | if (dc.hasAttribute("UseSmallWidgets")) |
1843 | appPrefs.uiPrefs.useSmallWidgets = dc.attribute("UseSmallWidgets").toInt(); |
||
1844 | else |
||
1845 | appPrefs.uiPrefs.useSmallWidgets = static_cast<bool>(dc.attribute("UI_USESMALLWIDGETS", "0").toInt()); |
||
14682 | fschmid | 1846 | appPrefs.uiPrefs.useTabs = static_cast<bool>(dc.attribute("UI_USESTABS", "0").toInt()); |
13876 | cbradney | 1847 | appPrefs.pathPrefs.documents = dc.attribute("DOC",""); |
1848 | appPrefs.pathPrefs.colorProfiles = dc.attribute("PROFILES",""); |
||
1849 | appPrefs.pathPrefs.scripts = dc.attribute("SCRIPTS",""); |
||
1850 | appPrefs.pathPrefs.documentTemplates = dc.attribute("TEMPLATES",""); |
||
1851 | appPrefs.docSetupPrefs.docUnitIndex = dc.attribute("UNIT", "0").toInt(); |
||
13889 | cbradney | 1852 | appPrefs.guidesPrefs.grabRadius = dc.attribute("GRAB", "4").toInt(); |
1853 | appPrefs.guidesPrefs.guidesShown = static_cast<bool>(dc.attribute("SHOWGUIDES", "1").toInt()); |
||
1854 | appPrefs.guidesPrefs.colBordersShown = static_cast<bool>(dc.attribute("showcolborders", "0").toInt()); |
||
1855 | appPrefs.guidesPrefs.framesShown = static_cast<bool>(dc.attribute("FRV", "1").toInt()); |
||
1856 | appPrefs.guidesPrefs.layerMarkersShown = static_cast<bool>(dc.attribute("SHOWLAYERM", "0").toInt()); |
||
1857 | appPrefs.guidesPrefs.marginsShown = static_cast<bool>(dc.attribute("SHOWMARGIN", "1").toInt()); |
||
1858 | appPrefs.guidesPrefs.baselineGridShown = static_cast<bool>(dc.attribute("SHOWBASE", "1").toInt()); |
||
1859 | appPrefs.guidesPrefs.linkShown = static_cast<bool>(dc.attribute("SHOWLINK", "0").toInt()); |
||
1860 | appPrefs.guidesPrefs.showPic = static_cast<bool>(dc.attribute("SHOWPICT", "1").toInt()); |
||
1861 | appPrefs.guidesPrefs.showControls = static_cast<bool>(dc.attribute("SHOWControl", "0").toInt()); |
||
1862 | appPrefs.guidesPrefs.rulersShown = static_cast<bool>(dc.attribute("rulersShown", "1").toInt()); |
||
1863 | appPrefs.guidesPrefs.showBleed = static_cast<bool>(dc.attribute("showBleed", "1").toInt()); |
||
1864 | appPrefs.guidesPrefs.rulerMode = static_cast<bool>(dc.attribute("rulerMode", "1").toInt()); |
||
13955 | cbradney | 1865 | appPrefs.miscPrefs.haveStylePreview = static_cast<bool>(dc.attribute("STYLEPREVIEW", "1").toInt()); |
13876 | cbradney | 1866 | |
13955 | cbradney | 1867 | appPrefs.displayPrefs.scratch.Bottom = ScCLocale::toDoubleC(dc.attribute("ScratchBottom"), 20.0); |
1868 | appPrefs.displayPrefs.scratch.Left = ScCLocale::toDoubleC(dc.attribute("ScratchLeft"), 100.0); |
||
1869 | appPrefs.displayPrefs.scratch.Right = ScCLocale::toDoubleC(dc.attribute("ScratchRight"), 100.0); |
||
1870 | appPrefs.displayPrefs.scratch.Top = ScCLocale::toDoubleC(dc.attribute("ScratchTop"), 20.0); |
||
13974 | cbradney | 1871 | appPrefs.displayPrefs.pageGapHorizontal = ScCLocale::toDoubleC(dc.attribute("GapHorizontal"), 0.0); |
1872 | appPrefs.displayPrefs.pageGapVertical = ScCLocale::toDoubleC(dc.attribute("GapVertical"), 40.0); |
||
2889 | cbradney | 1873 | if (dc.hasAttribute("STECOLOR")) |
13996 | cbradney | 1874 | appPrefs.storyEditorPrefs.guiFontColor = QColor(dc.attribute("STECOLOR")); |
2889 | cbradney | 1875 | if (dc.hasAttribute("STEFONT")) |
13996 | cbradney | 1876 | appPrefs.storyEditorPrefs.guiFont = dc.attribute("STEFONT"); |
13955 | cbradney | 1877 | appPrefs.displayPrefs.showToolTips = static_cast<bool>(dc.attribute("ToolTips", "1").toInt()); |
1878 | appPrefs.displayPrefs.showMouseCoordinates = static_cast<bool>(dc.attribute("showMouseCoordinates", "1").toInt()); |
||
1879 | appPrefs.uiPrefs.stickyTools = static_cast<bool>(dc.attribute("stickyTools", "0").toInt()); |
||
2889 | cbradney | 1880 | } |
1881 | if (dc.tagName()=="GRID") |
||
1882 | { |
||
13889 | cbradney | 1883 | appPrefs.guidesPrefs.minorGridSpacing = ScCLocale::toDoubleC(dc.attribute("MINOR"), 20.0); |
1884 | appPrefs.guidesPrefs.majorGridSpacing = ScCLocale::toDoubleC(dc.attribute("MAJOR"), 100.0); |
||
1885 | appPrefs.guidesPrefs.minorGridColor = QColor(dc.attribute("MINORC")); |
||
1886 | appPrefs.guidesPrefs.majorGridColor = QColor(dc.attribute("MAJORC")); |
||
1887 | appPrefs.guidesPrefs.guidePlacement = static_cast<bool>(dc.attribute("BACKG", "1").toInt()); |
||
1888 | appPrefs.guidesPrefs.gridShown = static_cast<bool>(dc.attribute("SHOW", "0").toInt()); |
||
2889 | cbradney | 1889 | if (dc.hasAttribute("GuideC")) |
13889 | cbradney | 1890 | appPrefs.guidesPrefs.guideColor = QColor(dc.attribute("GuideC")); |
2889 | cbradney | 1891 | if (dc.hasAttribute("GuideZ")) |
13889 | cbradney | 1892 | appPrefs.guidesPrefs.guideRad = ScCLocale::toDoubleC(dc.attribute("GuideZ"), 10.0); |
2889 | cbradney | 1893 | if (dc.hasAttribute("BaseC")) |
13889 | cbradney | 1894 | appPrefs.guidesPrefs.baselineGridColor = QColor(dc.attribute("BaseC")); |
2889 | cbradney | 1895 | } |
1896 | if (dc.tagName()=="PAGE") |
||
1897 | { |
||
13955 | cbradney | 1898 | appPrefs.displayPrefs.showPageShadow = static_cast<bool>(dc.attribute("ShowPageShadow", "1").toInt()); |
13974 | cbradney | 1899 | appPrefs.displayPrefs.paperColor = QColor(dc.attribute("PAGEC")); |
1900 | appPrefs.displayPrefs.frameColor = QColor(dc.attribute("SELEC","#ff0000")); |
||
1901 | appPrefs.displayPrefs.frameNormColor = QColor(dc.attribute("DFrameNormColor","#000000")); |
||
1902 | appPrefs.displayPrefs.frameGroupColor = QColor(dc.attribute("DFrameGroupColor","#008080")); |
||
1903 | appPrefs.displayPrefs.frameLockColor = QColor(dc.attribute("DFrameLockColor","#800000")); |
||
1904 | appPrefs.displayPrefs.frameLinkColor = QColor(dc.attribute("DFrameLinkColor","#ff0000")); |
||
1905 | appPrefs.displayPrefs.frameAnnotationColor = QColor(dc.attribute("DFrameAnnotationColor","#0000ff")); |
||
1906 | appPrefs.displayPrefs.pageBorderColor = QColor(dc.attribute("DPageBorderColor","#ff0000")); |
||
1907 | appPrefs.displayPrefs.controlCharColor = QColor(dc.attribute("DControlCharColor","#800000")); |
||
13889 | cbradney | 1908 | appPrefs.guidesPrefs.marginColor = QColor(dc.attribute("MARGC","#0000ff")); |