Rev 4122 | Rev 4201 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2834 | cbradney | 1 | /*************************************************************************** |
2 | copyright : (C) 2005 by Craig Bradney |
||
3 | email : cbradney@zip.com.au |
||
4 | ***************************************************************************/ |
||
5 | |||
6 | /*************************************************************************** |
||
7 | * * |
||
8 | * This program is free software; you can redistribute it and/or modify * |
||
9 | * it under the terms of the GNU General Public License as published by * |
||
10 | * the Free Software Foundation; either version 2 of the License, or * |
||
11 | * (at your option) any later version. * |
||
12 | * * |
||
13 | ***************************************************************************/ |
||
2835 | cbradney | 14 | |
15 | #include <qcolor.h> |
||
16 | #include <qdir.h> |
||
2889 | cbradney | 17 | #include <qdom.h> |
2835 | cbradney | 18 | #include <qfile.h> |
19 | #include <qstring.h> |
||
2889 | cbradney | 20 | #include <qstylefactory.h> |
2835 | cbradney | 21 | #include <qwmatrix.h> |
22 | |||
2834 | cbradney | 23 | #include "prefsmanager.h" |
3120 | fschmid | 24 | #include "prefsmanager.moc" |
2859 | cbradney | 25 | #include "filewatcher.h" |
2889 | cbradney | 26 | #include "missing.h" |
3932 | avox | 27 | #include "keymanager.h" |
2865 | cbradney | 28 | #include "pagesize.h" |
4122 | cbradney | 29 | #include "pagestructs.h" |
2835 | cbradney | 30 | #include "pdfoptions.h" |
31 | #include "prefsfile.h" |
||
32 | #include "scfonts.h" |
||
3953 | cbradney | 33 | #include "scmessagebox.h" |
2835 | cbradney | 34 | #include "scpaths.h" |
35 | #include "scribus.h" |
||
36 | #include "scribusstructs.h" |
||
37 | #include "scribusapp.h" |
||
38 | #include "util.h" |
||
2859 | cbradney | 39 | #include "werktoolb.h" |
2835 | cbradney | 40 | |
3205 | craig | 41 | |
2835 | cbradney | 42 | extern ScribusQApp* ScQApp; |
2859 | cbradney | 43 | extern bool emergencyActivated; |
2835 | cbradney | 44 | |
2834 | cbradney | 45 | PrefsManager* PrefsManager::_instance = 0; |
46 | |||
47 | PrefsManager::PrefsManager(QObject *parent, const char *name) |
||
48 | : QObject(parent, name) |
||
49 | { |
||
50 | } |
||
51 | |||
52 | PrefsManager::~PrefsManager() |
||
53 | { |
||
2871 | cbradney | 54 | appPrefs.AvailFonts.~SCFonts(); |
2856 | cbradney | 55 | delete prefsFile; |
2834 | cbradney | 56 | } |
57 | |||
58 | PrefsManager* PrefsManager::instance() |
||
59 | { |
||
60 | if (_instance == 0) |
||
61 | _instance = new PrefsManager(); |
||
62 | |||
63 | return _instance; |
||
64 | } |
||
65 | |||
66 | void PrefsManager::deleteInstance() |
||
67 | { |
||
68 | if (_instance) |
||
69 | delete _instance; |
||
70 | _instance = 0; |
||
71 | } |
||
72 | |||
73 | |||
74 | ApplicationPrefs* PrefsManager::applicationPrefs() |
||
75 | { |
||
76 | return &appPrefs; |
||
77 | } |
||
2835 | cbradney | 78 | |
2856 | cbradney | 79 | PrefsFile* PrefsManager::applicationPrefsFile() |
80 | { |
||
81 | return prefsFile; |
||
82 | } |
||
83 | |||
84 | const bool PrefsManager::importingFrom12x() |
||
85 | { |
||
86 | return importingFrom12; |
||
87 | } |
||
88 | |||
89 | |||
90 | void PrefsManager::setup() |
||
91 | { |
||
92 | setupPreferencesLocation(); |
||
93 | |||
94 | importingFrom12=copy12Preferences(); |
||
95 | prefsFile = new PrefsFile(QDir::convertSeparators(prefsLocation + "/prefs13.xml")); |
||
96 | if (importingFrom12) |
||
97 | convert12Preferences(); |
||
98 | //<<CB TODO Reset keyboard shortcuts of all 1.3 users as too many |
||
99 | // have conflicts if they dont nuke their settings. |
||
100 | // - Remove for 1.3.0 release: importingFrom12=true; |
||
101 | //>>CB |
||
102 | } |
||
103 | |||
2835 | cbradney | 104 | void PrefsManager::initDefaults() |
105 | { |
||
106 | /** Default font and size **/ |
||
107 | SCFontsIterator it(appPrefs.AvailFonts); |
||
108 | appPrefs.toolSettings.defFont = it.currentKey(); |
||
109 | appPrefs.toolSettings.defSize = 120; |
||
110 | |||
111 | /** Default colours **/ |
||
112 | appPrefs.DColors.clear(); |
||
113 | QString pfadC = ScPaths::instance().libDir(); |
||
114 | QString pfadC2 = pfadC + "rgbscribus.txt"; |
||
115 | QFile fiC(pfadC2); |
||
116 | if (!fiC.exists()) |
||
117 | { |
||
2886 | fschmid | 118 | appPrefs.DColors.insert("White", ScColor(0, 0, 0, 0)); |
119 | appPrefs.DColors.insert("Black", ScColor(0, 0, 0, 255)); |
||
120 | appPrefs.DColors.insert("Blue", ScColor(255, 255, 0, 0)); |
||
121 | appPrefs.DColors.insert("Cyan", ScColor(255, 0, 0, 0)); |
||
122 | appPrefs.DColors.insert("Green", ScColor(255, 0, 255, 0)); |
||
123 | appPrefs.DColors.insert("Red", ScColor(0, 255, 255, 0)); |
||
124 | appPrefs.DColors.insert("Yellow", ScColor(0, 0, 255, 0)); |
||
125 | appPrefs.DColors.insert("Magenta", ScColor(0, 255, 0, 0)); |
||
2835 | cbradney | 126 | appPrefs.DColorSet = "Scribus-Small"; |
127 | } |
||
128 | else |
||
129 | { |
||
130 | if (fiC.open(IO_ReadOnly)) |
||
131 | { |
||
132 | QString ColorEn, Cname; |
||
133 | int Rval, Gval, Bval; |
||
134 | QTextStream tsC(&fiC); |
||
135 | ColorEn = tsC.readLine(); |
||
136 | while (!tsC.atEnd()) |
||
137 | { |
||
138 | ColorEn = tsC.readLine(); |
||
139 | QTextStream CoE(&ColorEn, IO_ReadOnly); |
||
140 | CoE >> Rval; |
||
141 | CoE >> Gval; |
||
142 | CoE >> Bval; |
||
143 | CoE >> Cname; |
||
2886 | fschmid | 144 | ScColor tmp; |
2835 | cbradney | 145 | tmp.setColorRGB(Rval, Gval, Bval); |
146 | appPrefs.DColors.insert(Cname, tmp); |
||
147 | } |
||
148 | fiC.close(); |
||
149 | } |
||
150 | appPrefs.DColorSet = "X11 RGB-Set"; |
||
151 | } |
||
152 | |||
153 | appPrefs.Wheelval = 40; |
||
3641 | fschmid | 154 | /** Set Default window position and size to sane default values which should work on every screen */ |
155 | appPrefs.mainWinSettings.xPosition = 0; |
||
156 | appPrefs.mainWinSettings.yPosition = 0; |
||
157 | appPrefs.mainWinSettings.width = 640; |
||
158 | appPrefs.mainWinSettings.height = 480; |
||
2835 | cbradney | 159 | appPrefs.guidesSettings.marginsShown = true; |
160 | appPrefs.guidesSettings.framesShown = true; |
||
161 | appPrefs.guidesSettings.gridShown = false; |
||
162 | appPrefs.guidesSettings.guidesShown = false; |
||
163 | appPrefs.guidesSettings.baseShown = false; |
||
164 | appPrefs.guidesSettings.showPic = true; |
||
165 | appPrefs.guidesSettings.showControls = false; |
||
166 | appPrefs.guidesSettings.linkShown = false; |
||
2863 | fschmid | 167 | appPrefs.guidesSettings.rulerMode = true; |
2835 | cbradney | 168 | appPrefs.guidesSettings.grabRad = 4; |
169 | appPrefs.guidesSettings.guideRad = 10; |
||
170 | appPrefs.guidesSettings.minorGrid = 20; |
||
171 | appPrefs.guidesSettings.majorGrid = 100; |
||
172 | appPrefs.guidesSettings.minorColor = QColor(green); |
||
173 | appPrefs.guidesSettings.majorColor = QColor(green); |
||
174 | appPrefs.guidesSettings.margColor = QColor(blue); |
||
175 | appPrefs.guidesSettings.guideColor = QColor(darkBlue); |
||
176 | appPrefs.guidesSettings.baseColor = QColor(lightGray); |
||
2889 | cbradney | 177 | appPrefs.typographicSettings.valueSuperScript = 33; |
178 | appPrefs.typographicSettings.scalingSuperScript = 100; |
||
179 | appPrefs.typographicSettings.valueSubScript = 33; |
||
180 | appPrefs.typographicSettings.scalingSubScript = 100; |
||
181 | appPrefs.typographicSettings.valueSmallCaps = 75; |
||
182 | appPrefs.typographicSettings.autoLineSpacing = 20; |
||
183 | appPrefs.typographicSettings.valueUnderlinePos = -1; |
||
184 | appPrefs.typographicSettings.valueUnderlineWidth = -1; |
||
185 | appPrefs.typographicSettings.valueStrikeThruPos = -1; |
||
186 | appPrefs.typographicSettings.valueStrikeThruWidth = -1; |
||
187 | appPrefs.typographicSettings.valueBaseGrid = 14.4; |
||
188 | appPrefs.typographicSettings.offsetBaseGrid = 0.0; |
||
2835 | cbradney | 189 | appPrefs.GUI = "Default"; |
4039 | fschmid | 190 | appPrefs.showToolTips = true; |
2835 | cbradney | 191 | //FIXME |
192 | //Black here causes issues when a colour set is loaded without "Black" in it. |
||
193 | //"Black" is created with wrong values. Eg SVG colour set |
||
194 | appPrefs.toolSettings.dPen = "Black"; |
||
195 | appPrefs.toolSettings.dBrush = "Black"; |
||
196 | appPrefs.toolSettings.dShade = 100; |
||
197 | appPrefs.toolSettings.dShade2 = 100; |
||
198 | appPrefs.toolSettings.dLineArt = SolidLine; |
||
199 | appPrefs.toolSettings.dWidth = 1; |
||
200 | appPrefs.toolSettings.dPenLine = "Black"; |
||
201 | appPrefs.toolSettings.dPenText = "Black"; |
||
202 | appPrefs.toolSettings.dStrokeText = "Black"; |
||
3093 | fschmid | 203 | appPrefs.toolSettings.dTextBackGround = "None"; |
204 | appPrefs.toolSettings.dTextLineColor = "None"; |
||
205 | appPrefs.toolSettings.dTextBackGroundShade = 100; |
||
206 | appPrefs.toolSettings.dTextLineShade = 100; |
||
207 | appPrefs.toolSettings.dTextPenShade = 100; |
||
208 | appPrefs.toolSettings.dTextStrokeShade = 100; |
||
2835 | cbradney | 209 | appPrefs.toolSettings.tabFillChar = ""; |
210 | appPrefs.toolSettings.dTabWidth = 36.0; |
||
211 | appPrefs.DpapColor = QColor(white); |
||
212 | appPrefs.toolSettings.dCols = 1; |
||
213 | appPrefs.toolSettings.dGap = 0.0; |
||
214 | appPrefs.toolSettings.dShadeLine = 100; |
||
215 | appPrefs.toolSettings.dLstyleLine = SolidLine; |
||
216 | appPrefs.toolSettings.dWidthLine = 1; |
||
217 | appPrefs.toolSettings.dStartArrow = 0; |
||
218 | appPrefs.toolSettings.dEndArrow = 0; |
||
219 | appPrefs.toolSettings.magMin = 10; |
||
220 | appPrefs.toolSettings.magMax = 3200; |
||
221 | appPrefs.toolSettings.magStep = 25; |
||
222 | appPrefs.toolSettings.dBrushPict = "White"; |
||
223 | appPrefs.toolSettings.shadePict = 100; |
||
224 | appPrefs.toolSettings.scaleX = 1; |
||
225 | appPrefs.toolSettings.scaleY = 1; |
||
226 | appPrefs.guidesSettings.before = true; |
||
227 | appPrefs.docUnitIndex = 0; |
||
228 | appPrefs.toolSettings.polyC = 4; |
||
229 | appPrefs.toolSettings.polyF = 0.5; |
||
230 | appPrefs.toolSettings.polyS = false; |
||
231 | appPrefs.toolSettings.polyFd = 0; |
||
232 | appPrefs.toolSettings.polyR = 0; |
||
233 | appPrefs.mainToolBarSettings.visible = true; |
||
234 | appPrefs.pdfToolBarSettings.visible = true; |
||
235 | appPrefs.PSize = 40; |
||
236 | appPrefs.SaveAtQ = true; |
||
237 | appPrefs.ClipMargin = true; |
||
238 | appPrefs.GCRMode = false; |
||
239 | appPrefs.RecentDocs.clear(); |
||
240 | appPrefs.RecentDCount = 5; |
||
241 | appPrefs.marginColored = false; |
||
242 | appPrefs.pageSize = "A4"; |
||
243 | appPrefs.pageOrientation = 0; |
||
2865 | cbradney | 244 | PageSize a4("A4"); |
245 | appPrefs.PageWidth = a4.getPageWidth(); |
||
246 | appPrefs.PageHeight = a4.getPageHeight(); |
||
2835 | cbradney | 247 | appPrefs.RandOben = 40; |
248 | appPrefs.RandUnten = 40; |
||
249 | appPrefs.RandLinks = 40; |
||
250 | appPrefs.RandRechts = 40; |
||
251 | appPrefs.toolSettings.scaleType = true; |
||
252 | appPrefs.toolSettings.aspectRatio = true; |
||
253 | appPrefs.toolSettings.lowResType = 1; |
||
254 | appPrefs.toolSettings.useEmbeddedPath = false; |
||
255 | appPrefs.MinWordLen = 3; |
||
256 | appPrefs.HyCount = 2; |
||
257 | appPrefs.Language = ""; |
||
258 | appPrefs.Automatic = true; |
||
259 | appPrefs.AutoCheck = false; |
||
260 | appPrefs.AutoSave = false; |
||
261 | appPrefs.AutoSaveTime = 600000; |
||
262 | appPrefs.DisScale = 1.0; |
||
263 | appPrefs.DocDir = QDir::homeDirPath(); |
||
264 | appPrefs.ProfileDir = ""; |
||
265 | appPrefs.ScriptDir = ""; |
||
266 | appPrefs.documentTemplatesDir = ""; |
||
267 | appPrefs.CustomColorSets.clear(); |
||
268 | appPrefs.PrPr_Mode = false; |
||
269 | appPrefs.Gcr_Mode = true; |
||
270 | appPrefs.PrPr_AlphaText = false; |
||
271 | appPrefs.PrPr_AlphaGraphics = false; |
||
272 | appPrefs.PrPr_Transparency = false; |
||
273 | appPrefs.PrPr_C = true; |
||
274 | appPrefs.PrPr_M = true; |
||
275 | appPrefs.PrPr_Y = true; |
||
276 | appPrefs.PrPr_K = true; |
||
277 | appPrefs.imageEditorExecutable = "gimp"; |
||
278 | appPrefs.gs_AntiAliasGraphics = true; |
||
279 | appPrefs.gs_AntiAliasText = true; |
||
2910 | fschmid | 280 | appPrefs.gs_exe = getGSDefaultExeName(); |
2835 | cbradney | 281 | appPrefs.gs_Resolution = 72; |
282 | appPrefs.STEcolor = QColor(white); |
||
283 | appPrefs.DCMSset.DefaultMonitorProfile = ""; |
||
284 | appPrefs.DCMSset.DefaultPrinterProfile = ""; |
||
2984 | fschmid | 285 | appPrefs.DCMSset.DefaultImageRGBProfile = ""; |
286 | appPrefs.DCMSset.DefaultSolidColorProfile = ""; |
||
2835 | cbradney | 287 | appPrefs.DCMSset.CMSinUse = false; |
288 | appPrefs.DCMSset.SoftProofOn = false; |
||
289 | appPrefs.DCMSset.GamutCheck = false; |
||
290 | appPrefs.DCMSset.BlackPoint = true; |
||
291 | appPrefs.DCMSset.DefaultIntentMonitor = 1; |
||
2984 | fschmid | 292 | appPrefs.DCMSset.DefaultIntentImages = 1; |
2835 | cbradney | 293 | appPrefs.DCMSset.DefaultIntentPrinter = 0; |
294 | appPrefs.GFontSub.clear(); |
||
295 | appPrefs.ScratchLeft = 100; |
||
296 | appPrefs.ScratchRight = 100; |
||
297 | appPrefs.ScratchTop = 20; |
||
298 | appPrefs.ScratchBottom = 20; |
||
3016 | fschmid | 299 | struct PageSet pageS; |
300 | pageS.Name = tr( "Single Page" ); |
||
301 | pageS.FirstPage = 0; |
||
302 | pageS.Rows = 1; |
||
303 | pageS.Columns = 1; |
||
304 | pageS.GapHorizontal = 0.0; |
||
305 | pageS.GapVertical = 0.0; |
||
306 | pageS.GapBelow = 40.0; |
||
3026 | fschmid | 307 | pageS.pageNames.clear(); |
3016 | fschmid | 308 | appPrefs.pageSets.append(pageS); |
309 | pageS.Name = tr( "Double sided" ); |
||
310 | pageS.FirstPage = 1; |
||
311 | pageS.Columns = 2; |
||
3026 | fschmid | 312 | pageS.pageNames.clear(); |
313 | pageS.pageNames.append( tr("Left Page")); |
||
314 | pageS.pageNames.append( tr("Right Page")); |
||
3016 | fschmid | 315 | appPrefs.pageSets.append(pageS); |
316 | pageS.Name = tr( "3-Fold" ); |
||
317 | pageS.FirstPage = 0; |
||
318 | pageS.Columns = 3; |
||
3026 | fschmid | 319 | pageS.pageNames.clear(); |
320 | pageS.pageNames.append( tr("Left Page")); |
||
321 | pageS.pageNames.append( tr("Middle")); |
||
322 | pageS.pageNames.append( tr("Right Page")); |
||
3016 | fschmid | 323 | appPrefs.pageSets.append(pageS); |
324 | pageS.Name = tr( "4-Fold" ); |
||
325 | pageS.FirstPage = 0; |
||
326 | pageS.Columns = 4; |
||
3026 | fschmid | 327 | pageS.pageNames.clear(); |
328 | pageS.pageNames.append( tr("Left Page")); |
||
329 | pageS.pageNames.append( tr("Middle Left")); |
||
330 | pageS.pageNames.append( tr("Middle Right")); |
||
331 | pageS.pageNames.append( tr("Right Page")); |
||
3016 | fschmid | 332 | appPrefs.pageSets.append(pageS); |
333 | appPrefs.FacingPages = singlePage; |
||
2835 | cbradney | 334 | appPrefs.askBeforeSubstituite = true; |
335 | appPrefs.haveStylePreview = true; |
||
336 | // lorem ipsum defaults |
||
337 | appPrefs.useStandardLI = false; |
||
338 | appPrefs.paragraphsLI = 10; |
||
339 | appPrefs.showStartupDialog = true; |
||
3873 | subik | 340 | initDefaultCheckerPrefs(&appPrefs.checkerProfiles); |
3142 | cbradney | 341 | appPrefs.curCheckProfile = tr("PostScript"); |
2835 | cbradney | 342 | appPrefs.PDF_Options.Thumbnails = false; |
343 | appPrefs.PDF_Options.Articles = false; |
||
344 | appPrefs.PDF_Options.useLayers = false; |
||
345 | appPrefs.PDF_Options.Compress = true; |
||
346 | appPrefs.PDF_Options.CompressMethod = 0; |
||
347 | appPrefs.PDF_Options.Quality = 0; |
||
348 | appPrefs.PDF_Options.RecalcPic = false; |
||
349 | appPrefs.PDF_Options.Bookmarks = false; |
||
350 | appPrefs.PDF_Options.PicRes = 300; |
||
351 | appPrefs.PDF_Options.Version = PDFOptions::PDFVersion_14; |
||
352 | appPrefs.PDF_Options.Resolution = 300; |
||
353 | appPrefs.PDF_Options.Binding = 0; |
||
354 | appPrefs.PDF_Options.EmbedList.clear(); |
||
355 | appPrefs.PDF_Options.SubsetList.clear(); |
||
356 | appPrefs.PDF_Options.MirrorH = false; |
||
357 | appPrefs.PDF_Options.MirrorV = false; |
||
358 | appPrefs.PDF_Options.RotateDeg = 0; |
||
359 | appPrefs.PDF_Options.PresentMode = false; |
||
360 | appPrefs.PDF_Options.Datei = ""; |
||
361 | appPrefs.PDF_Options.PresentVals.clear(); |
||
362 | appPrefs.PDF_Options.isGrayscale = false; |
||
363 | appPrefs.PDF_Options.UseRGB = true; |
||
364 | appPrefs.PDF_Options.UseProfiles = false; |
||
365 | appPrefs.PDF_Options.UseProfiles2 = false; |
||
366 | appPrefs.PDF_Options.SolidProf = ""; |
||
367 | appPrefs.PDF_Options.SComp = 3; |
||
368 | appPrefs.PDF_Options.ImageProf = ""; |
||
369 | appPrefs.PDF_Options.PrintProf = ""; |
||
370 | appPrefs.PDF_Options.Info = ""; |
||
371 | appPrefs.PDF_Options.Intent = 0; |
||
372 | appPrefs.PDF_Options.Intent2 = 0; |
||
373 | appPrefs.PDF_Options.BleedTop = 0; |
||
374 | appPrefs.PDF_Options.BleedLeft = 0; |
||
375 | appPrefs.PDF_Options.BleedRight = 0; |
||
376 | appPrefs.PDF_Options.BleedBottom = 0; |
||
377 | appPrefs.PDF_Options.EmbeddedI = false; |
||
378 | appPrefs.PDF_Options.Encrypt = false; |
||
379 | appPrefs.PDF_Options.PassOwner = ""; |
||
380 | appPrefs.PDF_Options.PassUser = ""; |
||
381 | appPrefs.PDF_Options.Permissions = -4; |
||
382 | appPrefs.PDF_Options.UseLPI = false; |
||
383 | appPrefs.PDF_Options.LPISettings.clear(); |
||
3079 | fschmid | 384 | appPrefs.PDF_Options.UseSpotColors = true; |
385 | appPrefs.PDF_Options.doMultiFile = false; |
||
4197 | fschmid | 386 | appPrefs.PDF_Options.displayBookmarks = false; |
387 | appPrefs.PDF_Options.displayFullscreen = false; |
||
388 | appPrefs.PDF_Options.displayLayers = false; |
||
389 | appPrefs.PDF_Options.displayThumbs = false; |
||
390 | appPrefs.PDF_Options.PageLayout = PDFOptions::SinglePage; |
||
391 | appPrefs.PDF_Options.openAction = ""; |
||
2835 | cbradney | 392 | |
393 | //Attribute setup |
||
394 | appPrefs.defaultItemAttributes.clear(); |
||
395 | appPrefs.defaultToCSetups.clear(); |
||
396 | } |
||
397 | |||
398 | void PrefsManager::initDefaultGUIFont(const QFont& guiFont) |
||
399 | { |
||
3873 | subik | 400 | appPrefs.AppFontSize = guiFont.pointSize(); |
401 | appPrefs.STEfont = guiFont.toString(); |
||
3940 | tsoots | 402 | appPrefs.PaletteFontSize = appPrefs.AppFontSize; |
2835 | cbradney | 403 | } |
404 | |||
405 | void PrefsManager::initArrowStyles() |
||
406 | { |
||
407 | struct ArrowDesc arrow; |
||
408 | FPointArray points; |
||
409 | QWMatrix arrowScaling; |
||
410 | arrowScaling.scale(0.5, 0.5); |
||
411 | arrow.name = "Arrow1L"; |
||
412 | arrow.userArrow = false; |
||
413 | points.addQuadPoint(0, 0, 0, 0, 0, 0, 0, 0); |
||
414 | points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5); |
||
415 | points.addQuadPoint(12, 0, 12, 0, 12, 0, 12, 0); |
||
416 | points.addQuadPoint(-5, 5, -5, 5, -5, 5, -5, 5); |
||
417 | points.addQuadPoint(0, 0, 0, 0, 0, 0, 0, 0); |
||
418 | arrow.points = points.copy(); |
||
419 | appPrefs.arrowStyles.append(arrow); |
||
420 | arrow.name = "Arrow1M"; |
||
421 | points.map(arrowScaling); |
||
422 | arrow.points = points.copy(); |
||
423 | appPrefs.arrowStyles.append(arrow); |
||
424 | arrow.name = "Arrow1S"; |
||
425 | points.map(arrowScaling); |
||
426 | arrow.points = points.copy(); |
||
427 | appPrefs.arrowStyles.append(arrow); |
||
428 | arrow.name = "SquareL"; |
||
429 | points.resize(0); |
||
430 | points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5); |
||
431 | points.addQuadPoint(5, -5, 5, -5, 5, -5, 5, -5); |
||
432 | points.addQuadPoint(5, 5, 5, 5, 5, 5, 5, 5); |
||
433 | points.addQuadPoint(-5, 5, -5, 5, -5, 5, -5, 5); |
||
434 | points.addQuadPoint(-5, -5, -5, -5, -5, -5, -5, -5); |
||
435 | arrow.points = points.copy(); |
||
436 | appPrefs.arrowStyles.append(arrow); |
||
437 | arrow.name = "SquareM"; |
||
438 | points.map(arrowScaling); |
||
439 | arrow.points = points.copy(); |
||
440 | appPrefs.arrowStyles.append(arrow); |
||
441 | arrow.name = "SquareS"; |
||
442 | points.map(arrowScaling); |
||
443 | arrow.points = points.copy(); |
||
444 | appPrefs.arrowStyles.append(arrow); |
||
445 | arrow.name = "TriangleInL"; |
||
446 | points.resize(0); |
||
447 | points.addQuadPoint(5.77, 0, 5.77, 0, 5.77, 0, 5.77, 0); |
||
448 | points.addQuadPoint(-2.88, 5, -2.88, 5, -2.88, 5, -2.88, 5); |
||
449 | points.addQuadPoint(-2.88, -5, -2.88, -5, -2.88, -5, -2.88, -5); |
||
450 | points.addQuadPoint(5.77, 0, 5.77, 0, 5.77, 0, 5.77, 0); |
||
451 | arrow.points = points.copy(); |
||
452 | appPrefs.arrowStyles.append(arrow); |
||
453 | arrow.name = "TriangleInM"; |
||
454 | points.map(arrowScaling); |
||
455 | arrow.points = points.copy(); |
||
456 | appPrefs.arrowStyles.append(arrow); |
||
457 | arrow.name = "TriangleInS"; |
||
458 | points.map(arrowScaling); |
||
459 | arrow.points = points.copy(); |
||
460 | appPrefs.arrowStyles.append(arrow); |
||
461 | arrow.name = "TriangleOutL"; |
||
462 | points.resize(0); |
||
463 | points.addQuadPoint(-5.77, 0, -5.77, 0, -5.77, 0, -5.77, 0); |
||
464 | points.addQuadPoint(2.88, 5, 2.88, 5, 2.88, 5, 2.88, 5); |
||
465 | points.addQuadPoint(2.88, -5, 2.88, -5, 2.88, -5, 2.88, -5); |
||
466 | points.addQuadPoint(-5.77, 0, -5.77, 0, -5.77, 0, -5.77, 0); |
||
467 | arrow.points = points.copy(); |
||
468 | appPrefs.arrowStyles.append(arrow); |
||
469 | arrow.name = "TriangleOutM"; |
||
470 | points.map(arrowScaling); |
||
471 | arrow.points = points.copy(); |
||
472 | appPrefs.arrowStyles.append(arrow); |
||
473 | arrow.name = "TriangleOutS"; |
||
474 | points.map(arrowScaling); |
||
475 | arrow.points = points.copy(); |
||
476 | appPrefs.arrowStyles.append(arrow); |
||
477 | } |
||
478 | |||
479 | /*! |
||
480 | \fn QString PrefsManager::getPreferencesLocation() |
||
481 | \author Craig Bradney |
||
482 | \date Thu 18 Nov 2004 |
||
483 | \brief Set the user's preference file location. Rename any existing old preferences files |
||
484 | \retval QString Location of the user's preferences |
||
485 | */ |
||
486 | |||
487 | QString PrefsManager::setupPreferencesLocation() |
||
488 | { |
||
489 | QString Pff = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus"); |
||
490 | QFileInfo Pffi = QFileInfo(Pff); |
||
491 | QString PrefsPfad; |
||
492 | //If we are using ~/.scribus |
||
493 | if (Pffi.exists()) |
||
494 | { |
||
495 | if (Pffi.isDir()) |
||
496 | PrefsPfad = Pff; |
||
497 | else |
||
498 | PrefsPfad = QDir::homeDirPath(); |
||
499 | } |
||
500 | else // Move to using ~/.scribus/scribus.* from ~/.scribus.* |
||
501 | { |
||
502 | QDir prefsDirectory = QDir(); |
||
503 | prefsDirectory.mkdir(Pff); |
||
504 | PrefsPfad = Pff; |
||
505 | QString oldPR = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus.rc"); |
||
506 | QFileInfo oldPi = QFileInfo(oldPR); |
||
507 | if (oldPi.exists()) |
||
508 | moveFile(oldPR, Pff+"/scribus.rc"); |
||
509 | QString oldPR2 = QDir::convertSeparators(QDir::homeDirPath()+"/.scribusfont.rc"); |
||
510 | QFileInfo oldPi2 = QFileInfo(oldPR2); |
||
511 | if (oldPi2.exists()) |
||
512 | moveFile(oldPR2, Pff+"/scribusfont.rc"); |
||
513 | QString oldPR3 = QDir::convertSeparators(QDir::homeDirPath()+"/.scribusscrap.scs"); |
||
514 | QFileInfo oldPi3 = QFileInfo(oldPR3); |
||
515 | if (oldPi3.exists()) |
||
516 | moveFile(oldPR3, Pff+"/scrap.scs"); |
||
517 | } |
||
518 | prefsLocation=PrefsPfad; |
||
519 | return PrefsPfad; |
||
520 | } |
||
521 | |||
522 | /*! |
||
523 | \fn QString PrefsManager::getPreferencesLocation() |
||
524 | \retval QString Location of the user's preferences |
||
525 | */ |
||
526 | const QString PrefsManager::preferencesLocation() |
||
527 | { |
||
528 | return prefsLocation; |
||
529 | } |
||
530 | |||
531 | /*! |
||
4026 | craig | 532 | \fn bool ScribusMainWindow::copy12Preferences(const QString prefsLocation) |
2835 | cbradney | 533 | \author Craig Bradney |
534 | \date Sun 09 Jan 2005 |
||
535 | \brief Copy 1.2 prefs XML before loading, and copy rc files we don't yet convert |
||
536 | \param prefsLocation Location of user preferences |
||
537 | \retval bool true if prefs were imported |
||
538 | */ |
||
539 | bool PrefsManager::copy12Preferences() |
||
540 | { |
||
541 | //Now make copies for 1.3 use and leave the old ones alone for <1.3.0 usage |
||
542 | QString oldPR[4], newPR[4]; |
||
3152 | craig | 543 | |
544 | // Special case for scribus.rc - if found, use scribus123.rc, |
||
545 | // otherwise fall back to the possibly mis-encoded scribus.rc . |
||
546 | oldPR[0]=QDir::convertSeparators(prefsLocation+"/scribus123.rc"); |
||
547 | if (!QFile::exists(oldPR[0])) |
||
548 | oldPR[0] = prefsLocation+"/scribus.rc"; |
||
549 | |||
2835 | cbradney | 550 | oldPR[1]=QDir::convertSeparators(prefsLocation+"/scrap.scs"); |
551 | oldPR[2]=QDir::convertSeparators(prefsLocation+"/prefs.xml"); |
||
552 | oldPR[3]=QDir::convertSeparators(prefsLocation+"/scripter.rc"); |
||
553 | newPR[0]=QDir::convertSeparators(prefsLocation+"/scribus13.rc"); |
||
554 | newPR[1]=QDir::convertSeparators(prefsLocation+"/scrap13.scs"); |
||
555 | newPR[2]=QDir::convertSeparators(prefsLocation+"/prefs13.xml"); |
||
556 | newPR[3]=QDir::convertSeparators(prefsLocation+"/scripter13.rc"); |
||
557 | |||
558 | bool existsOldPR[4], existsNewPR[4]; |
||
3156 | craig | 559 | for (uint i=0;i<4;++i) |
2835 | cbradney | 560 | { |
561 | existsOldPR[i]=QFile::exists(oldPR[i]); |
||
562 | existsNewPR[i]=QFile::exists(newPR[i]); |
||
563 | } |
||
564 | |||
565 | bool retVal=false; |
||
566 | //Only check for these two as they will be autocreated if they dont exist. |
||
3151 | craig | 567 | if( (existsOldPR[0] && !existsNewPR[0]) || (existsOldPR[2] && !existsNewPR[2]) ) |
2835 | cbradney | 568 | { |
569 | retVal=true; // converting from 1.2 prefs |
||
570 | if (ScQApp->usingGUI()) |
||
571 | { |
||
4026 | craig | 572 | ScMW->showSplash(false); |
573 | if ( (ScMessageBox::question( ScMW, tr("Migrate Old Scribus Settings?"), |
||
2835 | cbradney | 574 | tr("Scribus has detected existing Scribus 1.2 preferences files.\n" |
575 | "Do you want to migrate them to the new Scribus version?"), |
||
576 | QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::NoButton))==QMessageBox::Yes ) |
||
577 | { |
||
578 | for (uint i=0;i<4;++i) |
||
579 | { |
||
580 | if (existsOldPR[i] && !existsNewPR[i]) |
||
581 | copyFile(oldPR[i], newPR[i]); |
||
582 | } |
||
583 | } |
||
4026 | craig | 584 | ScMW->showSplash(true); |
2835 | cbradney | 585 | } |
586 | } |
||
587 | return retVal; |
||
588 | } |
||
589 | |||
590 | /*! |
||
591 | \fn void PrefsManager::convert12Preferences() |
||
592 | \author Craig Ringer |
||
593 | \date Sun 26 June 2005 |
||
594 | \brief Import 1.2.x prefs rc data into new prefs xml |
||
595 | \retval None |
||
596 | */ |
||
2856 | cbradney | 597 | void PrefsManager::convert12Preferences() |
2835 | cbradney | 598 | { |
599 | // Import 1.2 font search path prefs |
||
600 | QFile fontPrefsFile12(QDir::convertSeparators(prefsLocation+"/scribusfont.rc")); |
||
601 | if (fontPrefsFile12.open(IO_ReadOnly)) |
||
602 | { |
||
2856 | cbradney | 603 | PrefsContext *pc = prefsFile->getContext("Fonts"); |
2835 | cbradney | 604 | PrefsTable *fontPrefs = pc->getTable("ExtraFontDirs"); |
605 | QTextStream tsx(&fontPrefsFile12); |
||
606 | QString extraPath = tsx.read(); |
||
607 | fontPrefsFile12.close(); |
||
608 | QStringList extraFonts = QStringList::split("\n",extraPath); |
||
609 | for (uint i = 0; i < extraFonts.count(); ++i) |
||
610 | fontPrefs->set(i, 0, extraFonts[i]); |
||
611 | } |
||
612 | } |
||
2859 | cbradney | 613 | |
3873 | subik | 614 | void PrefsManager::ReadPrefs(const QString & fname) |
2859 | cbradney | 615 | { |
3873 | subik | 616 | QString realFile; |
617 | if (fname.isNull()) |
||
618 | realFile = prefsLocation + "/scribus13.rc"; |
||
619 | else |
||
620 | realFile = fname; |
||
621 | |||
622 | if (QFile::exists(realFile)) |
||
623 | { |
||
624 | if (!ReadPref(realFile)) |
||
3171 | craig | 625 | { |
626 | alertLoadPrefsFailed(); |
||
627 | return; |
||
628 | } |
||
3873 | subik | 629 | } |
630 | |||
4026 | craig | 631 | ScMW->setDefaultPrinter(appPrefs.PrinterName, appPrefs.PrinterFile, appPrefs.PrinterCommand); |
2859 | cbradney | 632 | |
633 | uint max = QMIN(appPrefs.RecentDCount, appPrefs.RecentDocs.count()); |
||
634 | for (uint m = 0; m < max; ++m) |
||
635 | { |
||
636 | QFileInfo fd(appPrefs.RecentDocs[m]); |
||
637 | if (fd.exists()) |
||
638 | { |
||
4026 | craig | 639 | ScMW->RecentDocs.append(appPrefs.RecentDocs[m]); |
640 | ScMW->fileWatcher->addFile(appPrefs.RecentDocs[m]); |
||
2859 | cbradney | 641 | } |
642 | } |
||
4026 | craig | 643 | ScMW->rebuildRecentFileMenu(); |
644 | ScMW->move(appPrefs.mainWinSettings.xPosition, appPrefs.mainWinSettings.yPosition); |
||
645 | ScMW->resize(appPrefs.mainWinSettings.width, appPrefs.mainWinSettings.height); |
||
2859 | cbradney | 646 | ReadPrefsXML(); |
647 | if (appPrefs.checkerProfiles.count() == 0) |
||
648 | { |
||
3873 | subik | 649 | initDefaultCheckerPrefs(&appPrefs.checkerProfiles); |
3142 | cbradney | 650 | appPrefs.curCheckProfile = tr("PostScript"); |
2859 | cbradney | 651 | } |
652 | } |
||
653 | |||
654 | void PrefsManager::ReadPrefsXML() |
||
655 | { |
||
3171 | craig | 656 | if (prefsFile) |
2859 | cbradney | 657 | { |
658 | PrefsContext* userprefsContext = prefsFile->getContext("user_preferences"); |
||
659 | if (userprefsContext) { |
||
660 | appPrefs.guiLanguage = userprefsContext->get("gui_language",""); |
||
661 | //continue here... |
||
662 | //Prefs."blah blah" =... |
||
663 | } |
||
664 | } |
||
665 | } |
||
666 | |||
667 | |||
3873 | subik | 668 | void PrefsManager::SavePrefs(const QString & fname) |
2859 | cbradney | 669 | { |
670 | // If closing because of a crash don't save prefs as we can |
||
671 | // accidentally nuke the settings if the crash is before prefs are loaded |
||
3170 | craig | 672 | // The caller is responsible for ensuring we aren't called under those |
673 | // conditions. |
||
674 | Q_ASSERT(!emergencyActivated); |
||
4026 | craig | 675 | appPrefs.mainWinSettings.xPosition = abs(ScMW->pos().x()); |
676 | appPrefs.mainWinSettings.yPosition = abs(ScMW->pos().y()); |
||
677 | appPrefs.mainWinSettings.width = ScMW->size().width(); |
||
678 | appPrefs.mainWinSettings.height = ScMW->size().height(); |
||
679 | appPrefs.mainToolBarSettings.visible = ScMW->mainToolBarVisible(); |
||
680 | appPrefs.pdfToolBarSettings.visible = ScMW->pdfToolBarVisible(); |
||
2859 | cbradney | 681 | |
682 | appPrefs.RecentDocs.clear(); |
||
4026 | craig | 683 | uint max = QMIN(appPrefs.RecentDCount, ScMW->RecentDocs.count()); |
2859 | cbradney | 684 | for (uint m = 0; m < max; ++m) |
685 | { |
||
4026 | craig | 686 | appPrefs.RecentDocs.append(ScMW->RecentDocs[m]); |
2859 | cbradney | 687 | } |
4026 | craig | 688 | ScMW->getDefaultPrinter(&appPrefs.PrinterName, &appPrefs.PrinterFile, &appPrefs.PrinterCommand); |
2859 | cbradney | 689 | |
3170 | craig | 690 | SavePrefsXML(); |
3873 | subik | 691 | QString realFile; |
692 | if (fname.isNull()) |
||
693 | realFile = prefsLocation+"/scribus13.rc"; |
||
694 | else |
||
695 | realFile = fname; |
||
696 | if (!WritePref(realFile)) |
||
3170 | craig | 697 | alertSavePrefsFailed(); |
2859 | cbradney | 698 | } |
699 | |||
700 | void PrefsManager::SavePrefsXML() |
||
701 | { |
||
3170 | craig | 702 | if (prefsFile) |
2859 | cbradney | 703 | { |
704 | PrefsContext* userprefsContext = prefsFile->getContext("user_preferences"); |
||
705 | if (userprefsContext) { |
||
706 | userprefsContext->set("gui_language",appPrefs.guiLanguage); |
||
707 | //continue here... |
||
708 | //Prefs."blah blah" =... |
||
709 | } |
||
710 | prefsFile->write(); |
||
711 | } |
||
712 | } |
||
2862 | cbradney | 713 | |
714 | void PrefsManager::setGhostscriptExecutable(const QString& executableName) |
||
715 | { |
||
716 | appPrefs.gs_exe=executableName; |
||
717 | } |
||
718 | |||
719 | void PrefsManager::setImageEditorExecutable(const QString& executableName) |
||
720 | { |
||
721 | appPrefs.imageEditorExecutable=executableName; |
||
722 | } |
||
723 | |||
724 | const QString PrefsManager::ghostscriptExecutable() |
||
725 | { |
||
726 | return appPrefs.gs_exe; |
||
727 | } |
||
728 | |||
729 | const QString PrefsManager::imageEditorExecutable() |
||
730 | { |
||
731 | return appPrefs.imageEditorExecutable; |
||
732 | } |
||
2870 | cbradney | 733 | |
2871 | cbradney | 734 | const QString PrefsManager::documentDir() |
735 | { |
||
736 | return appPrefs.DocDir; |
||
737 | } |
||
738 | |||
3931 | subik | 739 | void PrefsManager::setDocumentDir(const QString& dirname) |
740 | { |
||
741 | appPrefs.DocDir = dirname; |
||
742 | } |
||
743 | |||
2871 | cbradney | 744 | const int PrefsManager::mouseWheelValue() |
745 | { |
||
746 | return appPrefs.Wheelval; |
||
747 | } |
||
748 | |||
2870 | cbradney | 749 | //Changed to return false when we have no fonts |
750 | const bool PrefsManager::GetAllFonts(bool showFontInfo) |
||
751 | { |
||
752 | appPrefs.AvailFonts.GetFonts(prefsLocation, showFontInfo); |
||
753 | if (appPrefs.AvailFonts.isEmpty()) |
||
754 | return false; |
||
755 | return true; |
||
756 | } |
||
2871 | cbradney | 757 | |
758 | void PrefsManager::setShowStartupDialog(const bool showDialog) |
||
759 | { |
||
760 | appPrefs.showStartupDialog=showDialog; |
||
761 | } |
||
762 | |||
763 | const ColorList& PrefsManager::colorSet() |
||
764 | { |
||
765 | return appPrefs.DColors; |
||
766 | } |
||
767 | |||
768 | ColorList* PrefsManager::colorSetPtr() |
||
769 | { |
||
770 | return &appPrefs.DColors; |
||
771 | } |
||
772 | |||
773 | const QString& PrefsManager::colorSetName() |
||
774 | { |
||
775 | return appPrefs.DColorSet; |
||
776 | } |
||
777 | |||
778 | void PrefsManager::setColorSet(const ColorList& colorSet) |
||
779 | { |
||
780 | appPrefs.DColors=colorSet; |
||
781 | } |
||
782 | |||
783 | void PrefsManager::setColorSetName(const QString& colorSetName) |
||
784 | { |
||
785 | appPrefs.DColorSet=colorSetName; |
||
786 | } |
||
2873 | cbradney | 787 | |
788 | |||
3932 | avox | 789 | void PrefsManager::setKeyEntry(const QString& actName, const QString& cleanMenuText, const QKeySequence& keyseq, const int& rowNumber) |
2873 | cbradney | 790 | { |
791 | Keys ke; |
||
2877 | cbradney | 792 | if (!actName.isEmpty()) |
2873 | cbradney | 793 | { |
4026 | craig | 794 | if (ScMW->scrActions[actName]) |
2873 | cbradney | 795 | { |
796 | ke.actionName=actName; |
||
797 | ke.keySequence = keyseq; |
||
798 | ke.cleanMenuText=cleanMenuText; |
||
799 | ke.tableRow=rowNumber; |
||
800 | appPrefs.KeyActions.insert(actName, ke); |
||
801 | } |
||
802 | else |
||
803 | qDebug("%s", QString("Action Name: %1 does not exist").arg(actName).ascii()); |
||
804 | } |
||
805 | } |
||
806 | |||
807 | const double PrefsManager::displayScale() |
||
808 | { |
||
809 | return appPrefs.DisScale; |
||
810 | } |
||
811 | |||
812 | const QString& PrefsManager::guiLanguage() |
||
813 | { |
||
814 | return appPrefs.guiLanguage; |
||
815 | } |
||
816 | |||
817 | const QString& PrefsManager::guiStyle() |
||
818 | { |
||
819 | return appPrefs.GUI; |
||
820 | } |
||
821 | |||
822 | const int& PrefsManager::guiFontSize() |
||
823 | { |
||
824 | return appPrefs.AppFontSize; |
||
825 | } |
||
2889 | cbradney | 826 | |
3940 | tsoots | 827 | const int& PrefsManager::paletteFontSize() |
828 | { |
||
829 | return appPrefs.PaletteFontSize; |
||
830 | } |
||
831 | |||
3170 | craig | 832 | bool PrefsManager::WritePref(QString ho) |
2889 | cbradney | 833 | { |
834 | QDomDocument docu("scribusrc"); |
||
835 | QString st="<SCRIBUSRC></SCRIBUSRC>"; |
||
836 | docu.setContent(st); |
||
837 | QDomElement elem=docu.documentElement(); |
||
838 | QDomElement dc=docu.createElement("GUI"); |
||
839 | dc.setAttribute("STILT",appPrefs.GUI); |
||
840 | dc.setAttribute("RAD",appPrefs.Wheelval); |
||
841 | dc.setAttribute("APF",appPrefs.AppFontSize); |
||
3940 | tsoots | 842 | dc.setAttribute("PFS",appPrefs.PaletteFontSize); |
2889 | cbradney | 843 | dc.setAttribute("GRAB",appPrefs.guidesSettings.grabRad); |
844 | dc.setAttribute("UNIT",appPrefs.docUnitIndex); |
||
845 | dc.setAttribute("RCD", appPrefs.RecentDCount); |
||
846 | dc.setAttribute("DOC", appPrefs.DocDir); |
||
847 | dc.setAttribute("PROFILES", appPrefs.ProfileDir); |
||
848 | dc.setAttribute("SCRIPTS", appPrefs.ScriptDir); |
||
849 | dc.setAttribute("TEMPLATES", appPrefs.documentTemplatesDir); |
||
850 | dc.setAttribute("SHOWGUIDES", static_cast<int>(appPrefs.guidesSettings.guidesShown)); |
||
851 | dc.setAttribute("FRV", static_cast<int>(appPrefs.guidesSettings.framesShown)); |
||
852 | dc.setAttribute("SHOWMARGIN", static_cast<int>(appPrefs.guidesSettings.marginsShown)); |
||
853 | dc.setAttribute("SHOWBASE", static_cast<int>(appPrefs.guidesSettings.baseShown)); |
||
854 | dc.setAttribute("SHOWLINK", static_cast<int>(appPrefs.guidesSettings.linkShown)); |
||
855 | dc.setAttribute("SHOWPICT", static_cast<int>(appPrefs.guidesSettings.showPic)); |
||
856 | dc.setAttribute("SHOWControl", static_cast<int>(appPrefs.guidesSettings.showControls)); |
||
857 | dc.setAttribute("rulerMode", static_cast<int>(appPrefs.guidesSettings.rulerMode)); |
||
858 | dc.setAttribute("ScratchBottom", appPrefs.ScratchBottom); |
||
859 | dc.setAttribute("ScratchLeft", appPrefs.ScratchLeft); |
||
860 | dc.setAttribute("ScratchRight", appPrefs.ScratchRight); |
||
861 | dc.setAttribute("ScratchTop", appPrefs.ScratchTop); |
||
862 | dc.setAttribute("STECOLOR", appPrefs.STEcolor.name()); |
||
863 | dc.setAttribute("STEFONT", appPrefs.STEfont); |
||
864 | dc.setAttribute("STYLEPREVIEW", static_cast<int>(appPrefs.haveStylePreview)); |
||
865 | dc.setAttribute("StartUp", static_cast<int>(appPrefs.showStartupDialog)); |
||
4039 | fschmid | 866 | dc.setAttribute("ToolTips", static_cast<int>(appPrefs.showToolTips)); |
2889 | cbradney | 867 | elem.appendChild(dc); |
868 | QDomElement dc1=docu.createElement("GRID"); |
||
869 | dc1.setAttribute("MINOR",appPrefs.guidesSettings.minorGrid); |
||
870 | dc1.setAttribute("MAJOR",appPrefs.guidesSettings.majorGrid); |
||
871 | dc1.setAttribute("MINORC",appPrefs.guidesSettings.minorColor.name()); |
||
872 | dc1.setAttribute("MAJORC",appPrefs.guidesSettings.majorColor.name()); |
||
873 | dc1.setAttribute("GuideC", appPrefs.guidesSettings.guideColor.name()); |
||
874 | dc1.setAttribute("BaseC", appPrefs.guidesSettings.baseColor.name()); |
||
875 | dc1.setAttribute("GuideZ", appPrefs.guidesSettings.guideRad); |
||
876 | dc1.setAttribute("BACKG", static_cast<int>(appPrefs.guidesSettings.before)); |
||
877 | dc1.setAttribute("SHOW", static_cast<int>(appPrefs.guidesSettings.gridShown)); |
||
878 | elem.appendChild(dc1); |
||
879 | QDomElement dc1a=docu.createElement("PAGE"); |
||
880 | dc1a.setAttribute("PAGEC",appPrefs.DpapColor.name()); |
||
881 | dc1a.setAttribute("MARGC",appPrefs.guidesSettings.margColor.name()); |
||
882 | dc1a.setAttribute("RANDF", static_cast<int>(appPrefs.marginColored)); |
||
883 | dc1a.setAttribute("DScale",appPrefs.DisScale); |
||
884 | elem.appendChild(dc1a); |
||
885 | QDomElement dc2=docu.createElement("FONTS"); |
||
886 | dc2.setAttribute("FACE",appPrefs.toolSettings.defFont); |
||
887 | dc2.setAttribute("SIZE",appPrefs.toolSettings.defSize / 10.0); |
||
888 | dc2.setAttribute("AutomaticSubst", static_cast<int>(appPrefs.askBeforeSubstituite)); |
||
889 | elem.appendChild(dc2); |
||
890 | QDomElement dc3=docu.createElement("TYPO"); |
||
891 | dc3.setAttribute("TIEF",appPrefs.typographicSettings.valueSubScript); |
||
892 | dc3.setAttribute("TIEFSC",appPrefs.typographicSettings.scalingSubScript); |
||
893 | dc3.setAttribute("HOCH",appPrefs.typographicSettings.valueSuperScript); |
||
894 | dc3.setAttribute("HOCHSC",appPrefs.typographicSettings.scalingSuperScript); |
||
895 | dc3.setAttribute("SMCAPS",appPrefs.typographicSettings.valueSmallCaps); |
||
896 | dc3.setAttribute("AUTOL", appPrefs.typographicSettings.autoLineSpacing); |
||
897 | dc3.setAttribute("BASE", appPrefs.typographicSettings.valueBaseGrid); |
||
898 | dc3.setAttribute("BASEO", appPrefs.typographicSettings.offsetBaseGrid); |
||
899 | if (appPrefs.typographicSettings.valueUnderlinePos == -1) |
||
900 | dc3.setAttribute("UnderlinePos", appPrefs.typographicSettings.valueUnderlinePos); |
||
901 | else |
||
902 | dc3.setAttribute("UnderlinePos", appPrefs.typographicSettings.valueUnderlinePos / 10.0); |
||
903 | if (appPrefs.typographicSettings.valueUnderlineWidth == -1) |
||
904 | dc3.setAttribute("UnderlineWidth", appPrefs.typographicSettings.valueUnderlineWidth); |
||
905 | else |
||
906 | dc3.setAttribute("UnderlineWidth", appPrefs.typographicSettings.valueUnderlineWidth / 10.0); |
||
907 | if (appPrefs.typographicSettings.valueStrikeThruPos == -1) |
||
908 | dc3.setAttribute("StrikeThruPos", appPrefs.typographicSettings.valueStrikeThruPos); |
||
909 | else |
||
910 | dc3.setAttribute("StrikeThruPos", appPrefs.typographicSettings.valueStrikeThruPos / 10.0); |
||
911 | if (appPrefs.typographicSettings.valueStrikeThruWidth == -1) |
||
912 | dc3.setAttribute("StrikeThruWidth", appPrefs.typographicSettings.valueStrikeThruWidth); |
||
913 | else |
||
914 | dc3.setAttribute("StrikeThruWidth", appPrefs.typographicSettings.valueStrikeThruWidth / 10.0); |
||
915 | elem.appendChild(dc3); |
||
916 | QDomElement dc9=docu.createElement("TOOLS"); |
||
917 | dc9.setAttribute("PEN",appPrefs.toolSettings.dPen); |
||
918 | dc9.setAttribute("BRUSH",appPrefs.toolSettings.dBrush); |
||
919 | dc9.setAttribute("PENLINE",appPrefs.toolSettings.dPenLine); |
||
920 | dc9.setAttribute("PENTEXT",appPrefs.toolSettings.dPenText); |
||
921 | dc9.setAttribute("StrokeText",appPrefs.toolSettings.dStrokeText); |
||
3093 | fschmid | 922 | dc9.setAttribute("TextBackGround", appPrefs.toolSettings.dTextBackGround); |
923 | dc9.setAttribute("TextLineColor", appPrefs.toolSettings.dTextLineColor); |
||
924 | dc9.setAttribute("TextBackGroundShade", appPrefs.toolSettings.dTextBackGroundShade); |
||
925 | dc9.setAttribute("TextLineShade", appPrefs.toolSettings.dTextLineShade); |
||
926 | dc9.setAttribute("TextPenShade", appPrefs.toolSettings.dTextPenShade); |
||
927 | dc9.setAttribute("TextStrokeShade", appPrefs.toolSettings.dTextStrokeShade); |
||
2889 | cbradney | 928 | dc9.setAttribute("TEXTCOL",appPrefs.toolSettings.dCols); |
929 | dc9.setAttribute("TEXTGAP",appPrefs.toolSettings.dGap); |
||
930 | dc9.setAttribute("TabWidth",appPrefs.toolSettings.dTabWidth); |
||
931 | dc9.setAttribute("TabFill",appPrefs.toolSettings.tabFillChar); |
||
932 | dc9.setAttribute("STIL",appPrefs.toolSettings.dLineArt); |
||
933 | dc9.setAttribute("STILLINE",appPrefs.toolSettings.dLstyleLine); |
||
934 | dc9.setAttribute("WIDTH",appPrefs.toolSettings.dWidth); |
||
935 | dc9.setAttribute("WIDTHLINE",appPrefs.toolSettings.dWidthLine); |
||
936 | dc9.setAttribute("PENSHADE",appPrefs.toolSettings.dShade2); |
||
937 | dc9.setAttribute("LINESHADE",appPrefs.toolSettings.dShadeLine); |
||
938 | dc9.setAttribute("BRUSHSHADE",appPrefs.toolSettings.dShade); |
||
939 | dc9.setAttribute("MAGMIN",appPrefs.toolSettings.magMin); |
||
940 | dc9.setAttribute("MAGMAX",appPrefs.toolSettings.magMax); |
||
941 | dc9.setAttribute("MAGSTEP",appPrefs.toolSettings.magStep); |
||
942 | dc9.setAttribute("CPICT",appPrefs.toolSettings.dBrushPict); |
||
943 | dc9.setAttribute("PICTSHADE",appPrefs.toolSettings.shadePict); |
||
944 | dc9.setAttribute("PICTSCX",appPrefs.toolSettings.scaleX); |
||
945 | dc9.setAttribute("PICTSCY",appPrefs.toolSettings.scaleY); |
||
946 | dc9.setAttribute("POLYC", appPrefs.toolSettings.polyC); |
||
947 | dc9.setAttribute("POLYF", appPrefs.toolSettings.polyF); |
||
948 | dc9.setAttribute("POLYR", appPrefs.toolSettings.polyR); |
||
949 | dc9.setAttribute("POLYFD", appPrefs.toolSettings.polyFd); |
||
950 | dc9.setAttribute("POLYS", static_cast<int>(appPrefs.toolSettings.polyS)); |
||
951 | dc9.setAttribute("PSCALE", static_cast<int>(appPrefs.toolSettings.scaleType)); |
||
952 | dc9.setAttribute("PASPECT", static_cast<int>(appPrefs.toolSettings.aspectRatio)); |
||
953 | dc9.setAttribute("EmbeddedPath", static_cast<int>(appPrefs.toolSettings.useEmbeddedPath)); |
||
954 | dc9.setAttribute("HalfRes", appPrefs.toolSettings.lowResType); |
||
955 | dc9.setAttribute("StartArrow", appPrefs.toolSettings.dStartArrow); |
||
956 | dc9.setAttribute("EndArrow", appPrefs.toolSettings.dEndArrow); |
||
957 | elem.appendChild(dc9); |
||
958 | QDomElement dc4=docu.createElement("MAINWINDOW"); |
||
959 | dc4.setAttribute("XPOS",appPrefs.mainWinSettings.xPosition); |
||
960 | dc4.setAttribute("YPOS",appPrefs.mainWinSettings.yPosition); |
||
961 | dc4.setAttribute("WIDTH",appPrefs.mainWinSettings.width); |
||
962 | dc4.setAttribute("HEIGHT",appPrefs.mainWinSettings.height); |
||
963 | elem.appendChild(dc4); |
||
964 | QDomElement dc5=docu.createElement("TOOLPALETTE"); |
||
965 | dc5.setAttribute("VISIBLE", static_cast<int>(appPrefs.mainToolBarSettings.visible)); |
||
966 | dc5.setAttribute("PDFVISIBLE", static_cast<int>(appPrefs.pdfToolBarSettings.visible)); |
||
967 | elem.appendChild(dc5); |
||
968 | QDomElement dc73=docu.createElement("SCRAPBOOK"); |
||
969 | dc73.setAttribute("PREVIEW",appPrefs.PSize); |
||
970 | dc73.setAttribute("SAVE", static_cast<int>(appPrefs.SaveAtQ)); |
||
971 | elem.appendChild(dc73); |
||
972 | QDomElement dc75=docu.createElement("PAGEPALETTE"); |
||
973 | dc75.setAttribute("THUMBS", static_cast<int>(appPrefs.SepalT)); |
||
974 | dc75.setAttribute("NAMES", static_cast<int>(appPrefs.SepalN)); |
||
975 | elem.appendChild(dc75); |
||
976 | QDomElement dc76=docu.createElement("DOKUMENT"); |
||
977 | dc76.setAttribute("PAGESIZE",appPrefs.pageSize); |
||
978 | dc76.setAttribute("AUSRICHTUNG",appPrefs.pageOrientation); |
||
979 | dc76.setAttribute("BREITE",appPrefs.PageWidth); |
||
980 | dc76.setAttribute("HOEHE",appPrefs.PageHeight); |
||
981 | dc76.setAttribute("RANDO",appPrefs.RandOben); |
||
982 | dc76.setAttribute("RANDU",appPrefs.RandUnten); |
||
983 | dc76.setAttribute("RANDL",appPrefs.RandLinks); |
||
984 | dc76.setAttribute("RANDR",appPrefs.RandRechts); |
||
2894 | fschmid | 985 | dc76.setAttribute("DOPPEL", appPrefs.FacingPages); |
2889 | cbradney | 986 | dc76.setAttribute("AutoSave", static_cast<int>(appPrefs.AutoSave)); |
987 | dc76.setAttribute("AutoSaveTime", appPrefs.AutoSaveTime); |
||
988 | elem.appendChild(dc76); |
||
3016 | fschmid | 989 | QDomElement pageSetAttr = docu.createElement("PageSets"); |
990 | QValueList<PageSet>::Iterator itpgset; |
||
991 | for(itpgset = appPrefs.pageSets.begin(); itpgset != appPrefs.pageSets.end(); ++itpgset ) |
||
992 | { |
||
993 | QDomElement pgst = docu.createElement("Set"); |
||
994 | pgst.setAttribute("Name", (*itpgset).Name); |
||
995 | pgst.setAttribute("FirstPage", (*itpgset).FirstPage); |
||
996 | pgst.setAttribute("Rows", (*itpgset).Rows); |
||
997 | pgst.setAttribute("Columns", (*itpgset).Columns); |
||
998 | pgst.setAttribute("GapHorizontal", (*itpgset).GapHorizontal); |
||
999 | pgst.setAttribute("GapVertical", (*itpgset).GapVertical); |
||
1000 | pgst.setAttribute("GapBelow", (*itpgset).GapBelow); |
||
3026 | fschmid | 1001 | QStringList pNames = (*itpgset).pageNames; |
1002 | QStringList::Iterator itpgsetN; |
||
1003 | for(itpgsetN = pNames.begin(); itpgsetN != pNames.end(); ++itpgsetN ) |
||
1004 | { |
||
1005 | QDomElement pgstN = docu.createElement("PageNames"); |
||
1006 | pgstN.setAttribute("Name", (*itpgsetN)); |
||
1007 | pgst.appendChild(pgstN); |
||
1008 | } |
||
3016 | fschmid | 1009 | pageSetAttr.appendChild(pgst); |
1010 | } |
||
1011 | elem.appendChild(pageSetAttr); |
||
3183 | fschmid | 1012 | QDomElement dc79ac=docu.createElement("Checker"); |
1013 | dc79ac.setAttribute("currentProfile", appPrefs.curCheckProfile); |
||
1014 | elem.appendChild(dc79ac); |
||
3033 | cbradney | 1015 | CheckerPrefsList::Iterator itcp; |
1016 | CheckerPrefsList::Iterator itcpend=appPrefs.checkerProfiles.end(); |
||
1017 | for (itcp = appPrefs.checkerProfiles.begin(); itcp != itcpend; ++itcp) |
||
2889 | cbradney | 1018 | { |
1019 | QDomElement dc79a=docu.createElement("CheckProfile"); |
||
1020 | dc79a.setAttribute("Name",itcp.key()); |
||
1021 | dc79a.setAttribute("ignoreErrors", static_cast<int>(itcp.data().ignoreErrors)); |
||
1022 | dc79a.setAttribute("autoCheck", static_cast<int>(itcp.data().autoCheck)); |
||
1023 | dc79a.setAttribute("checkGlyphs", static_cast<int>(itcp.data().checkGlyphs)); |
||
1024 | dc79a.setAttribute("checkOrphans", static_cast<int>(itcp.data().checkOrphans)); |
||
1025 | dc79a.setAttribute("checkOverflow", static_cast<int>(itcp.data().checkOverflow)); |
||
1026 | dc79a.setAttribute("checkPictures", static_cast<int>(itcp.data().checkPictures)); |
||
1027 | dc79a.setAttribute("checkResolution", static_cast<int>(itcp.data().checkResolution)); |
||
1028 | dc79a.setAttribute("checkTransparency", static_cast<int>(itcp.data().checkTransparency)); |
||
1029 | dc79a.setAttribute("checkAnnotations", static_cast<int>(itcp.data().checkAnnotations)); |
||
1030 | dc79a.setAttribute("checkRasterPDF", static_cast<int>(itcp.data().checkRasterPDF)); |
||
1031 | dc79a.setAttribute("minResolution",itcp.data().minResolution); |
||
1032 | elem.appendChild(dc79a); |
||
1033 | } |
||
1034 | QDomElement dc81=docu.createElement("CMS"); |
||
1035 | dc81.setAttribute("DPSo", static_cast<int>(appPrefs.DCMSset.SoftProofOn)); |
||
1036 | dc81.setAttribute("DPuse", static_cast<int>(appPrefs.DCMSset.CMSinUse)); |
||
1037 | dc81.setAttribute("DPgam", static_cast<int>(appPrefs.DCMSset.GamutCheck)); |
||
1038 | dc81.setAttribute("DPbla", static_cast<int>(appPrefs.DCMSset.BlackPoint)); |
||
1039 | dc81.setAttribute("DPMo",appPrefs.DCMSset.DefaultMonitorProfile); |
||
1040 | dc81.setAttribute("DPPr",appPrefs.DCMSset.DefaultPrinterProfile); |
||
2984 | fschmid | 1041 | dc81.setAttribute("DPIn",appPrefs.DCMSset.DefaultImageRGBProfile); |
1042 | dc81.setAttribute("DPInCMYK",appPrefs.DCMSset.DefaultImageCMYKProfile); |
||
1043 | dc81.setAttribute("DPIn2",appPrefs.DCMSset.DefaultSolidColorProfile); |
||
2889 | cbradney | 1044 | dc81.setAttribute("DIPr",appPrefs.DCMSset.DefaultIntentPrinter); |
1045 | dc81.setAttribute("DIMo",appPrefs.DCMSset.DefaultIntentMonitor); |
||
2984 | fschmid | 1046 | dc81.setAttribute("DIMo2",appPrefs.DCMSset.DefaultIntentImages); |
2889 | cbradney | 1047 | elem.appendChild(dc81); |
1048 | QDomElement dc82=docu.createElement("PRINTER"); |
||
1049 | dc82.setAttribute("NAME",appPrefs.PrinterName); |
||
1050 | dc82.setAttribute("FILE",appPrefs.PrinterFile); |
||
1051 | dc82.setAttribute("COMMAND",appPrefs.PrinterCommand); |
||
1052 | dc82.setAttribute("CLIPMARGIN", static_cast<int>(appPrefs.ClipMargin)); |
||
1053 | dc82.setAttribute("GMODE", static_cast<int>(appPrefs.GCRMode)); |
||
1054 | elem.appendChild(dc82); |
||
1055 | QDomElement dc8Pr=docu.createElement("PRINTPREVIEW"); |
||
1056 | dc8Pr.setAttribute("Mode", static_cast<int>(appPrefs.PrPr_Mode)); |
||
1057 | dc8Pr.setAttribute("GcrMode", static_cast<int>(appPrefs.Gcr_Mode)); |
||
1058 | dc8Pr.setAttribute("AlphaText", static_cast<int>(appPrefs.PrPr_AlphaText)); |
||
1059 | dc8Pr.setAttribute("AlphaGraphics", static_cast<int>(appPrefs.PrPr_AlphaGraphics)); |
||
1060 | dc8Pr.setAttribute("Transparency", static_cast<int>(appPrefs.PrPr_Transparency)); |
||
1061 | dc8Pr.setAttribute("Cyan", static_cast<int>(appPrefs.PrPr_C)); |
||
1062 | dc8Pr.setAttribute("Magenta", static_cast<int>(appPrefs.PrPr_M)); |
||
1063 | dc8Pr.setAttribute("Yellow", static_cast<int>(appPrefs.PrPr_Y)); |
||
1064 | dc8Pr.setAttribute("Black", static_cast<int>(appPrefs.PrPr_K)); |
||
1065 | elem.appendChild(dc8Pr); |
||
1066 | QDomElement dc8Ex = docu.createElement("EXTERNAL"); |
||
1067 | dc8Ex.setAttribute("GIMP", imageEditorExecutable()); |
||
1068 | dc8Ex.setAttribute("GS", ghostscriptExecutable()); |
||
1069 | dc8Ex.setAttribute("AlphaGraphics", static_cast<int>(appPrefs.gs_AntiAliasGraphics)); |
||
1070 | dc8Ex.setAttribute("AlphaText", static_cast<int>(appPrefs.gs_AntiAliasText)); |
||
1071 | dc8Ex.setAttribute("Resolution", appPrefs.gs_Resolution); |
||
1072 | elem.appendChild(dc8Ex); |
||
1073 | QDomElement rde=docu.createElement("HYPHEN"); |
||
1074 | rde.setAttribute("LANG", appPrefs.Language); |
||
1075 | rde.setAttribute("WORDLEN", appPrefs.MinWordLen); |
||
1076 | rde.setAttribute("HYCOUNT", appPrefs.HyCount); |
||
1077 | rde.setAttribute("MODE", static_cast<int>(appPrefs.Automatic)); |
||
1078 | rde.setAttribute("INMODE", static_cast<int>(appPrefs.AutoCheck)); |
||
1079 | elem.appendChild(rde); |
||
1080 | ColorList::Iterator itc; |
||
1081 | for (itc = appPrefs.DColors.begin(); itc != appPrefs.DColors.end(); ++itc) |
||
1082 | { |
||
1083 | QDomElement co=docu.createElement("COLOR"); |
||
1084 | co.setAttribute("NAME",itc.key()); |
||
1085 | co.setAttribute("RGB",appPrefs.DColors[itc.key()].getRGBColor().name()); |
||
1086 | co.setAttribute("CMYK",appPrefs.DColors[itc.key()].name()); |
||
3051 | fschmid | 1087 | co.setAttribute("Spot",static_cast<int>(appPrefs.DColors[itc.key()].isSpotColor())); |
3060 | fschmid | 1088 | co.setAttribute("Register",static_cast<int>(appPrefs.DColors[itc.key()].isRegistrationColor())); |
2889 | cbradney | 1089 | elem.appendChild(co); |
1090 | } |
||
1091 | for ( SCFontsIterator itf(appPrefs.AvailFonts); itf.current(); ++itf) |
||
1092 | { |
||
1093 | QDomElement fn=docu.createElement("FONT"); |
||
1094 | fn.setAttribute("NAME",itf.currentKey()); |
||
1095 | fn.setAttribute("EMBED",static_cast<int>(itf.current()->EmbedPS)); |
||
1096 | fn.setAttribute("USE", static_cast<int>(itf.current()->UseFont)); |
||
1097 | fn.setAttribute("SUBSET", static_cast<int>(itf.current()->Subset)); |
||
1098 | elem.appendChild(fn); |
||
1099 | } |
||
1100 | for (uint rd=0; rd<appPrefs.RecentDocs.count(); ++rd) |
||
1101 | { |
||
1102 | QDomElement rde=docu.createElement("RECENT"); |
||
1103 | rde.setAttribute("NAME",appPrefs.RecentDocs[rd]); |
||
1104 | elem.appendChild(rde); |
||
1105 | } |
||
1106 | for (QMap<QString,Keys>::Iterator ksc=appPrefs.KeyActions.begin(); ksc!=appPrefs.KeyActions.end(); ++ksc) |
||
1107 | { |
||
1108 | QDomElement kscc=docu.createElement("SHORTCUT"); |
||
1109 | kscc.setAttribute("ACTION",ksc.data().actionName); |
||
3932 | avox | 1110 | kscc.setAttribute("SEQUENCE",KeyManager::getKeyText(ksc.data().keySequence)); |
2889 | cbradney | 1111 | elem.appendChild(kscc); |
1112 | } |
||
1113 | QMap<QString,QString>::Iterator itfsu; |
||
1114 | for (itfsu = appPrefs.GFontSub.begin(); itfsu != appPrefs.GFontSub.end(); ++itfsu) |
||
1115 | { |
||
1116 | QDomElement fosu = docu.createElement("Substitute"); |
||
1117 | fosu.setAttribute("Name",itfsu.key()); |
||
1118 | fosu.setAttribute("Replace",itfsu.data()); |
||
1119 | elem.appendChild(fosu); |
||
1120 | } |
||
1121 | for (uint ccs=0; ccs<appPrefs.CustomColorSets.count(); ++ccs) |
||
1122 | { |
||
1123 | QDomElement cos=docu.createElement("COLORSET"); |
||
1124 | cos.setAttribute("NAME",appPrefs.CustomColorSets[ccs]); |
||
1125 | elem.appendChild(cos); |
||
1126 | } |
||
1127 | QDomElement cosd=docu.createElement("DCOLORSET"); |
||
1128 | cosd.setAttribute("NAME",appPrefs.DColorSet); |
||
1129 | elem.appendChild(cosd); |
||
1130 | QDomElement pdf = docu.createElement("PDF"); |
||
1131 | pdf.setAttribute("Thumbnails", static_cast<int>(appPrefs.PDF_Options.Thumbnails)); |
||
1132 | pdf.setAttribute("Articles", static_cast<int>(appPrefs.PDF_Options.Articles)); |
||
1133 | pdf.setAttribute("Bookmarks", static_cast<int>(appPrefs.PDF_Options.Bookmarks)); |
||
1134 | pdf.setAttribute("Compress", static_cast<int>(appPrefs.PDF_Options.Compress)); |
||
1135 | pdf.setAttribute("CMethod", appPrefs.PDF_Options.CompressMethod); |
||
1136 | pdf.setAttribute("Quality", appPrefs.PDF_Options.Quality); |
||
1137 | pdf.setAttribute("MirrorH", static_cast<int>(appPrefs.PDF_Options.MirrorH)); |
||
1138 | pdf.setAttribute("MirrorV", static_cast<int>(appPrefs.PDF_Options.MirrorV)); |
||
1139 | pdf.setAttribute("RotateDeg", static_cast<int>(appPrefs.PDF_Options.RotateDeg)); |
||
1140 | pdf.setAttribute("PresentMode", static_cast<int>(appPrefs.PDF_Options.PresentMode)); |
||
1141 | pdf.setAttribute("RecalcPic", static_cast<int>(appPrefs.PDF_Options.RecalcPic)); |
||
1142 | pdf.setAttribute("Grayscale", static_cast<int>(appPrefs.PDF_Options.isGrayscale)); |
||
1143 | pdf.setAttribute("RGBMode", static_cast<int>(appPrefs.PDF_Options.UseRGB)); |
||
1144 | pdf.setAttribute("UseProfiles", static_cast<int>(appPrefs.PDF_Options.UseProfiles)); |
||
1145 | pdf.setAttribute("UseProfiles2", static_cast<int>(appPrefs.PDF_Options.UseProfiles2)); |
||
1146 | pdf.setAttribute("Binding", appPrefs.PDF_Options.Binding); |
||
1147 | pdf.setAttribute("PicRes", appPrefs.PDF_Options.PicRes); |
||
1148 | pdf.setAttribute("Resolution", appPrefs.PDF_Options.Resolution); |
||
1149 | pdf.setAttribute("Version", appPrefs.PDF_Options.Version); |
||
1150 | pdf.setAttribute("Intent", appPrefs.PDF_Options.Intent); |
||
1151 | pdf.setAttribute("Intent2", appPrefs.PDF_Options.Intent2); |
||
1152 | pdf.setAttribute("SolidP", appPrefs.PDF_Options.SolidProf); |
||
1153 | pdf.setAttribute("ImageP", appPrefs.PDF_Options.ImageProf); |
||
1154 | pdf.setAttribute("PrintP", appPrefs.PDF_Options.PrintProf); |
||
1155 | pdf.setAttribute("InfoString", appPrefs.PDF_Options.Info); |
||
1156 | pdf.setAttribute("BTop", appPrefs.PDF_Options.BleedTop); |
||
1157 | pdf.setAttribute("BLeft", appPrefs.PDF_Options.BleedLeft); |
||
1158 | pdf.setAttribute("BRight", appPrefs.PDF_Options.BleedRight); |
||
1159 | pdf.setAttribute("BBottom", appPrefs.PDF_Options.BleedBottom); |
||
1160 | pdf.setAttribute("ImagePr", static_cast<int>(appPrefs.PDF_Options.EmbeddedI)); |
||
1161 | pdf.setAttribute("PassOwner", appPrefs.PDF_Options.PassOwner); |
||
1162 | pdf.setAttribute("PassUser", appPrefs.PDF_Options.PassUser); |
||
1163 | pdf.setAttribute("Permissions", appPrefs.PDF_Options.Permissions); |
||
1164 | pdf.setAttribute("Encrypt", static_cast<int>(appPrefs.PDF_Options.Encrypt)); |
||
1165 | pdf.setAttribute("UseLayers", static_cast<int>(appPrefs.PDF_Options.useLayers)); |
||
1166 | pdf.setAttribute("UseLpi", static_cast<int>(appPrefs.PDF_Options.UseLPI)); |
||
3079 | fschmid | 1167 | pdf.setAttribute("UseSpotColors", static_cast<int>(appPrefs.PDF_Options.UseSpotColors)); |
1168 | pdf.setAttribute("doMultiFile", static_cast<int>(appPrefs.PDF_Options.doMultiFile)); |
||
4197 | fschmid | 1169 | pdf.setAttribute("displayBookmarks", static_cast<int>(appPrefs.PDF_Options.displayBookmarks)); |
1170 | pdf.setAttribute("displayFullscreen", static_cast<int>(appPrefs.PDF_Options.displayFullscreen)); |
||
1171 | pdf.setAttribute("displayLayers", static_cast<int>(appPrefs.PDF_Options.displayLayers)); |
||
1172 | pdf.setAttribute("displayThumbs", static_cast<int>(appPrefs.PDF_Options.displayThumbs)); |
||
1173 | pdf.setAttribute("PageLayout", appPrefs.PDF_Options.PageLayout); |
||
1174 | pdf.setAttribute("openAction", appPrefs.PDF_Options.openAction); |
||
2889 | cbradney | 1175 | QMap<QString,LPIData>::Iterator itlp; |
1176 | for (itlp = appPrefs.PDF_Options.LPISettings.begin(); itlp != appPrefs.PDF_Options.LPISettings.end(); ++itlp) |
||
1177 | { |
||
1178 | QDomElement pdf4 = docu.createElement("LPI"); |
||
1179 | pdf4.setAttribute("Color", itlp.key()); |
||
1180 | pdf4.setAttribute("Frequency", itlp.data().Frequency); |
||
1181 | pdf4.setAttribute("Angle", itlp.data().Angle); |
||
1182 | pdf4.setAttribute("SpotFunction", itlp.data().SpotFunc); |
||
1183 | pdf.appendChild(pdf4); |
||
1184 | } |
||
1185 | elem.appendChild(pdf); |
||
1186 | QDomElement docItemAttrs = docu.createElement("DefaultItemAttributes"); |
||
1187 | for(ObjAttrVector::Iterator objAttrIt = appPrefs.defaultItemAttributes.begin() ; objAttrIt != appPrefs.defaultItemAttributes.end(); ++objAttrIt ) |
||
1188 | { |
||
1189 | QDomElement itemAttr = docu.createElement("ItemAttribute"); |
||
1190 | itemAttr.setAttribute("Name", (*objAttrIt).name); |
||
1191 | itemAttr.setAttribute("Type", (*objAttrIt).type); |
||
1192 | itemAttr.setAttribute("Value", (*objAttrIt).value); |
||
1193 | itemAttr.setAttribute("Parameter", (*objAttrIt).parameter); |
||
1194 | itemAttr.setAttribute("Relationship", (*objAttrIt).relationship); |
||
1195 | itemAttr.setAttribute("RelationshipTo", (*objAttrIt).relationshipto); |
||
1196 | itemAttr.setAttribute("AutoAddTo", (*objAttrIt).autoaddto); |
||
1197 | docItemAttrs.appendChild(itemAttr); |
||
1198 | } |
||
1199 | elem.appendChild(docItemAttrs); |
||
1200 | QDomElement tocElem = docu.createElement("TablesOfContents"); |
||
1201 | for(ToCSetupVector::Iterator tocSetupIt = appPrefs.defaultToCSetups.begin() ; tocSetupIt != appPrefs.defaultToCSetups.end(); ++tocSetupIt ) |
||
1202 | { |
||
1203 | QDomElement tocsetup = docu.createElement("TableOfContents"); |
||
1204 | tocsetup.setAttribute("Name", (*tocSetupIt).name); |
||
1205 | tocsetup.setAttribute("ItemAttributeName", (*tocSetupIt).itemAttrName); |
||
1206 | tocsetup.setAttribute("FrameName", (*tocSetupIt).frameName); |
||
1207 | tocsetup.setAttribute("ListNonPrinting", (*tocSetupIt).listNonPrintingFrames); |
||
1208 | tocsetup.setAttribute("Style", (*tocSetupIt).textStyle); |
||
1209 | tocsetup.setAttribute("NumberPlacement", (*tocSetupIt).pageLocation); |
||
1210 | tocElem.appendChild(tocsetup); |
||
1211 | } |
||
1212 | elem.appendChild(tocElem); |
||
1213 | // lorem ipsum |
||
1214 | QDomElement liElem = docu.createElement("LoremIpsum"); |
||
1215 | liElem.setAttribute("useStandardLI", static_cast<int>(appPrefs.useStandardLI)); |
||
1216 | liElem.setAttribute("paragraphsLI", appPrefs.paragraphsLI); |
||
1217 | elem.appendChild(liElem); |
||
1218 | // write file |
||
3170 | craig | 1219 | bool result = false; |
2889 | cbradney | 1220 | QFile f(ho); |
1221 | if(!f.open(IO_WriteOnly)) |
||
3170 | craig | 1222 | { |
1223 | m_lastError = tr("Could not open preferences file \"%1\" for writing: %2") |
||
1224 | .arg(ho).arg(qApp->translate("QFile",f.errorString())); |
||
1225 | } |
||
1226 | else |
||
1227 | { |
||
1228 | QTextStream s(&f); |
||
1229 | s.setEncoding(QTextStream::UnicodeUTF8); |
||
1230 | s<<docu.toString(); |
||
1231 | if (f.status() == IO_Ok) |
||
1232 | result = true; |
||
1233 | else |
||
1234 | m_lastError = tr("Writing to preferences file \"%1\" failed: " |
||
1235 | "QIODevice status code %2") |
||
1236 | .arg(ho).arg(f.status()); |
||
1237 | } |
||
1238 | if (f.isOpen()) |
||
1239 | f.close(); |
||
1240 | return result; |
||
2889 | cbradney | 1241 | } |
1242 | |||
3171 | craig | 1243 | // Returns false on error. It's the caller's job to make sure the prefs file |
1244 | // actually exists. |
||
2889 | cbradney | 1245 | bool PrefsManager::ReadPref(QString ho) |
1246 | { |
||
1247 | QDomDocument docu("scridoc"); |
||
1248 | QFile f(ho); |
||
1249 | if(!f.open(IO_ReadOnly)) |
||
3171 | craig | 1250 | { |
1251 | m_lastError = tr("Failed to open prefs file \"%1\": %2") |
||
1252 | .arg(ho).arg( qApp->translate("QFile",f.errorString()) ); |
||
2889 | cbradney | 1253 | return false; |
3171 | craig | 1254 | } |
2889 | cbradney | 1255 | QTextStream ts(&f); |
1256 | ts.setEncoding(QTextStream::UnicodeUTF8); |
||
1257 | QString errorMsg; |
||
1258 | int errorLine = 0, errorColumn = 0; |
||
1259 | if( !docu.setContent(ts.read(), &errorMsg, &errorLine, &errorColumn) ) |
||
1260 | { |
||
3171 | craig | 1261 | m_lastError = tr("Failed to read prefs XML from \"%1\": %2 at line %3, col %4") |
1262 | .arg(ho).arg(errorMsg).arg(errorLine).arg(errorColumn); |
||
2889 | cbradney | 1263 | f.close(); |
1264 | return false; |
||
1265 | } |
||
1266 | f.close(); |
||
1267 | QDomElement elem=docu.documentElement(); |
||
1268 | if (elem.tagName() != "SCRIBUSRC") |
||
1269 | return false; |
||
1270 | appPrefs.DColors.clear(); |
||
1271 | ScColor lf = ScColor(); |
||
1272 | QDomNode DOC=elem.firstChild(); |
||
3183 | fschmid | 1273 | if (!DOC.namedItem("CheckProfile").isNull()) |
1274 | appPrefs.checkerProfiles.clear(); |
||
2889 | cbradney | 1275 | while(!DOC.isNull()) |
1276 | { |
||
1277 | QDomElement dc=DOC.toElement(); |
||
1278 | if (dc.tagName()=="GUI") |
||
1279 | { |
||
1280 | appPrefs.GUI = dc.attribute("STILT","Default"); |
||
4026 | craig | 1281 | appPrefs.Wheelval = dc.attribute("RAD").toInt(); |
1282 | appPrefs.guidesSettings.grabRad = dc.attribute("GRAB", "4").toInt(); |
||
1283 | appPrefs.docUnitIndex = dc.attribute("UNIT", "0").toInt(); |
||
1284 | appPrefs.AppFontSize = dc.attribute("APF", "12").toInt(); |
||
1285 | appPrefs.PaletteFontSize = dc.attribute("PFS", "10").toInt(); |
||
2889 | cbradney | 1286 | appPrefs.RecentDCount = dc.attribute("RCD","5").toUInt(); |
1287 | appPrefs.DocDir = dc.attribute("DOC",""); |
||
1288 | appPrefs.ProfileDir = dc.attribute("PROFILES",""); |
||
1289 | appPrefs.ScriptDir = dc.attribute("SCRIPTS",""); |
||
1290 | appPrefs.documentTemplatesDir = dc.attribute("TEMPLATES",""); |
||
4026 | craig | 1291 | appPrefs.guidesSettings.guidesShown = static_cast<bool>(dc.attribute("SHOWGUIDES", "1").toInt()); |
1292 | appPrefs.guidesSettings.framesShown = static_cast<bool>(dc.attribute("FRV", "1").toInt()); |
||
1293 | appPrefs.guidesSettings.marginsShown = static_cast<bool>(dc.attribute("SHOWMARGIN", "1").toInt()); |
||
1294 | appPrefs.guidesSettings.baseShown = static_cast<bool>(dc.attribute("SHOWBASE", "1").toInt()); |
||
1295 | appPrefs.guidesSettings.linkShown = static_cast<bool>(dc.attribute("SHOWLINK", "0").toInt()); |
||
1296 | appPrefs.guidesSettings.showPic = static_cast<bool>(dc.attribute("SHOWPICT", "1").toInt()); |
||
1297 | appPrefs.guidesSettings.showControls = static_cast<bool>(dc.attribute("SHOWControl", "0").toInt()); |
||
1298 | appPrefs.guidesSettings.rulerMode = static_cast<bool>(dc.attribute("rulerMode", "1").toInt()); |
||
1299 | appPrefs.haveStylePreview = static_cast<bool>(dc.attribute("STYLEPREVIEW", "1").toInt()); |
||
1300 | appPrefs.showStartupDialog = static_cast<bool>(dc.attribute("StartUp", "1").toInt()); |
||
1301 | appPrefs.ScratchBottom = dc.attribute("ScratchBottom", "20").toDouble(); |
||
1302 | appPrefs.ScratchLeft = dc.attribute("ScratchLeft", "100").toDouble(); |
||
1303 | appPrefs.ScratchRight = dc.attribute("ScratchRight", "100").toDouble(); |
||
1304 | appPrefs.ScratchTop = dc.attribute("ScratchTop", "20").toDouble(); |
||
2889 | cbradney | 1305 | if (dc.hasAttribute("STECOLOR")) |
1306 | appPrefs.STEcolor = QColor(dc.attribute("STECOLOR")); |
||
1307 | if (dc.hasAttribute("STEFONT")) |
||
1308 | appPrefs.STEfont = dc.attribute("STEFONT"); |
||
4039 | fschmid | 1309 | appPrefs.showToolTips = static_cast<bool>(dc.attribute("ToolTips", "1").toInt()); |
2889 | cbradney | 1310 | } |
1311 | if (dc.tagName()=="GRID") |
||
1312 | { |
||
4026 | craig | 1313 | appPrefs.guidesSettings.minorGrid = dc.attribute("MINOR").toDouble(); |
1314 | appPrefs.guidesSettings.majorGrid = dc.attribute("MAJOR").toDouble(); |
||
2889 | cbradney | 1315 | appPrefs.guidesSettings.minorColor = QColor(dc.attribute("MINORC")); |
1316 | appPrefs.guidesSettings.majorColor = QColor(dc.attribute("MAJORC")); |
||
4026 | craig | 1317 | appPrefs.guidesSettings.before = static_cast<bool>(dc.attribute("BACKG", "1").toInt()); |
1318 | appPrefs.guidesSettings.gridShown = static_cast<bool>(dc.attribute("SHOW", "0").toInt()); |
||
2889 | cbradney | 1319 | if (dc.hasAttribute("GuideC")) |
1320 | appPrefs.guidesSettings.guideColor = QColor(dc.attribute("GuideC")); |
||
1321 | if (dc.hasAttribute("GuideZ")) |
||
4026 | craig | 1322 | appPrefs.guidesSettings.guideRad = dc.attribute("GuideZ").toDouble(); |
2889 | cbradney | 1323 | if (dc.hasAttribute("BaseC")) |
1324 | appPrefs.guidesSettings.baseColor = QColor(dc.attribute("BaseC")); |
||
1325 | } |
||
1326 | if (dc.tagName()=="PAGE") |
||
1327 | { |
||
1328 | appPrefs.DpapColor = QColor(dc.attribute("PAGEC")); |
||
1329 | appPrefs.guidesSettings.margColor = QColor(dc.attribute("MARGC","#0000ff")); |
||
4026 | craig | 1330 | appPrefs.marginColored = static_cast<bool>(dc.attribute("RANDF", "0").toInt()); |
1331 | appPrefs.DisScale = dc.attribute("DScale", "1").toDouble(); |
||
2889 | cbradney | 1332 | } |
1333 | if (dc.tagName()=="TYPO") |
||
1334 | { |
||
4026 | craig | 1335 | appPrefs.typographicSettings.valueSuperScript = dc.attribute("HOCH").toInt(); |
1336 | appPrefs.typographicSettings.scalingSuperScript = dc.attribute("HOCHSC").toInt(); |
||
1337 | appPrefs.typographicSettings.valueSubScript = dc.attribute("TIEF").toInt(); |
||
1338 | appPrefs.typographicSettings.scalingSubScript = dc.attribute("TIEFSC").toInt(); |
||
1339 | appPrefs.typographicSettings.valueSmallCaps = dc.attribute("SMCAPS").toInt(); |
||
1340 | appPrefs.typographicSettings.valueBaseGrid = dc.attribute("BASE", "12").toDouble(); |
||
1341 | appPrefs.typographicSettings.offsetBaseGrid = dc.attribute("BASEO", "0").toDouble(); |
||
1342 | appPrefs.typographicSettings.autoLineSpacing = dc.attribute("AUTOL", "20").toInt(); |
||
1343 | double ulp = dc.attribute("UnderlinePos", "-1").toDouble(); |
||
2889 | cbradney | 1344 | if (ulp != -1) |
1345 | appPrefs.typographicSettings.valueUnderlinePos = qRound(ulp * 10); |
||
1346 | else |
||
1347 | appPrefs.typographicSettings.valueUnderlinePos = -1; |
||
4026 | craig | 1348 | double ulw = dc.attribute("UnderlineWidth", "-1").toDouble(); |
2889 | cbradney | 1349 | if (ulw != -1) |
1350 | appPrefs.typographicSettings.valueUnderlineWidth = qRound(ulw * 10); |
||
1351 | else |
||
1352 | appPrefs.typographicSettings.valueUnderlineWidth = -1; |
||
4026 | craig | 1353 | double stp = dc.attribute("StrikeThruPos", "-1").toDouble(); |
2889 | cbradney | 1354 | if (stp != -1) |
1355 | appPrefs.typographicSettings.valueStrikeThruPos = qRound(ulp * 10); |
||
1356 | else |
||
1357 | appPrefs.typographicSettings.valueStrikeThruPos = -1; |
||
4026 | craig | 1358 | double stw = dc.attribute("StrikeThruWidth", "-1").toDouble(); |
2889 | cbradney | 1359 | if (stw != -1) |
1360 | appPrefs.typographicSettings.valueStrikeThruWidth = qRound(stw * 10); |
||
1361 | else |
||
1362 | appPrefs.typographicSettings.valueStrikeThruWidth = -1; |
||
1363 | } |
||
1364 | if (dc.tagName()=="TOOLS") |
||
1365 | { |
||
1366 | appPrefs.toolSettings.dPen = dc.attribute("PEN"); |
||
1367 | appPrefs.toolSettings.dBrush = dc.attribute("BRUSH"); |
||
1368 | appPrefs.toolSettings.dPenLine = dc.attribute("PENLINE"); |
||
1369 | appPrefs.toolSettings.dPenText = dc.attribute("PENTEXT"); |
||
1370 | appPrefs.toolSettings.dStrokeText = dc.attribute("StrokeText", appPrefs.toolSettings.dPenText); |
||
3093 | fschmid | 1371 | appPrefs.toolSettings.dTextBackGround = dc.attribute("TextBackGround", "None"); |
1372 | appPrefs.toolSettings.dTextLineColor = dc.attribute("TextLineColor", "None"); |
||
4026 | craig | 1373 | appPrefs.toolSettings.dTextBackGroundShade = dc.attribute("TextBackGroundShade", "100").toInt(); |
1374 | appPrefs.toolSettings.dTextLineShade = dc.attribute("TextLineShade", "100").toInt(); |
||
1375 | appPrefs.toolSettings.dTextPenShade = dc.attribute("TextPenShade", "100").toInt(); |
||
1376 | appPrefs.toolSettings.dTextStrokeShade = dc.attribute("TextStrokeShade", "100").toInt(); |
||
1377 | appPrefs.toolSettings.dCols = dc.attribute("TEXTCOL", "1").toInt(); |
||
1378 | appPrefs.toolSettings.dGap = dc.attribute("TEXTGAP", "0.0").toDouble(); |
||
2889 | cbradney | 1379 | appPrefs.toolSettings.tabFillChar = dc.attribute("TabFill", ""); |
4026 | craig | 1380 | appPrefs.toolSettings.dTabWidth = dc.attribute("TabWidth", "36.0").toDouble(); |
1381 | appPrefs.toolSettings.dLineArt = dc.attribute("STIL").toInt(); |
||
1382 | appPrefs.toolSettings.dLstyleLine = dc.attribute("STILLINE").toInt(); |
||
1383 | appPrefs.toolSettings.dWidth = dc.attribute("WIDTH").toDouble(); |
||
1384 | appPrefs.toolSettings.dWidthLine = dc.attribute("WIDTHLINE").toDouble(); |
||
1385 | appPrefs.toolSettings.dShade2 = dc.attribute("PENSHADE").toInt(); |
||
1386 | appPrefs.toolSettings.dShadeLine = dc.attribute("LINESHADE").toInt(); |
||
1387 | appPrefs.toolSettings.dShade = dc.attribute("BRUSHSHADE").toInt(); |
||
1388 | appPrefs.toolSettings.magMin = dc.attribute("MAGMIN", "10").toInt(); |
||
1389 | appPrefs.toolSettings.magMax = dc.attribute("MAGMAX", "3200").toInt(); |
||
1390 | appPrefs.toolSettings.magStep = dc.attribute("MAGSTEP", "25").toInt(); |
||
2889 | cbradney | 1391 | appPrefs.toolSettings.dBrushPict = dc.attribute("CPICT"); |
4026 | craig | 1392 | appPrefs.toolSettings.shadePict = dc.attribute("PICTSHADE", "100").toInt(); |
1393 | appPrefs.toolSettings.scaleX = dc.attribute("PICTSCX", "1").toDouble(); |
||
1394 | appPrefs.toolSettings.scaleY = dc.attribute("PICTSCY", "1").toDouble(); |
||
1395 | appPrefs.toolSettings.scaleType = static_cast<bool>(dc.attribute("PSCALE", "1").toInt()); |
||
1396 | appPrefs.toolSettings.aspectRatio = static_cast<bool>(dc.attribute("PASPECT", "0").toInt()); |
||
1397 | appPrefs.toolSettings.useEmbeddedPath = static_cast<bool>(dc.attribute("EmbeddedPath", "0").toInt()); |
||
1398 | appPrefs.toolSettings.lowResType = dc.attribute("HalfRes", "1").toInt(); |
||
1399 | appPrefs.toolSettings.polyC = dc.attribute("POLYC", "4").toInt(); |
||
1400 | appPrefs.toolSettings.polyF = dc.attribute("POLYF", "0.5").toDouble(); |
||
1401 | appPrefs.toolSettings.polyR = dc.attribute("POLYR", "0").toDouble(); |
||
1402 | appPrefs.toolSettings.polyFd = dc.attribute("POLYFD", "0").toInt(); |
||
1403 | appPrefs.toolSettings.polyS = static_cast<bool>(dc.attribute("POLYS", "0").toInt()); |
||
1404 | appPrefs.toolSettings.dStartArrow = dc.attribute("StartArrow", "0").toInt(); |
||
1405 | appPrefs.toolSettings.dEndArrow = dc.attribute("EndArrow", "0").toInt(); |
||
2889 | cbradney | 1406 | } |
1407 | if (dc.tagName()=="MAINWINDOW") |
||
1408 | { |
||
4026 | craig | 1409 | appPrefs.mainWinSettings.xPosition = dc.attribute("XPOS", "0").toInt(); |
1410 | appPrefs.mainWinSettings.yPosition = dc.attribute("YPOS", "0").toInt(); |
||
1411 | appPrefs.mainWinSettings.width = dc.attribute("WIDTH", "640").toInt(); |
||
1412 | appPrefs.mainWinSettings.height = dc.attribute("HEIGHT", "480").toInt(); |
||
3932 | avox | 1413 | QDesktopWidget *d = QApplication::desktop(); |
1414 | QSize gStrut = QApplication::globalStrut(); |
||
1415 | int minX = 0; |
||
1416 | #ifndef QT_MAC |
||
1417 | int minY = 0; |
||
1418 | #else |
||
1419 | // on Mac you're dead if the titlebar is not on screen |
||
1420 | int minY = 22; |
||
1421 | #endif |
||
1422 | if (appPrefs.mainWinSettings.xPosition < minX ) |
||
1423 | appPrefs.mainWinSettings.xPosition = minX; |
||
1424 | if (appPrefs.mainWinSettings.yPosition < minY) |
||
1425 | appPrefs.mainWinSettings.yPosition = minY; |
||
1426 | int minWidth = 5*gStrut.width(); |
||
1427 | int minHeight = 5*gStrut.width(); |
||
1428 | int maxWidth = d->width(); |
||
1429 | int maxHeight = d->height(); |
||
1430 | if (appPrefs.mainWinSettings.width > maxWidth) |
||
1431 | appPrefs.mainWinSettings.width = maxWidth; |
||
1432 | if (appPrefs.mainWinSettings.width < minWidth) |
||
1433 | appPrefs.mainWinSettings.width = minWidth; |
||
1434 | if (appPrefs.mainWinSettings.height > maxHeight) |
||
1435 | appPrefs.mainWinSettings.height = maxHeight; |
||
1436 | if (appPrefs.mainWinSettings.height < minHeight) |
||
1437 | appPrefs.mainWinSettings.height = minHeight; |
||
1438 | int maxX = d->width() - minWidth; |
||
1439 | int maxY = d->height() - minHeight; |
||
1440 | if (appPrefs.mainWinSettings.xPosition >= maxX) |
||
1441 | appPrefs.mainWinSettings.xPosition = maxX; |
||
1442 | if (appPrefs.mainWinSettings.yPosition >= maxY) |
||
1443 | appPrefs.mainWinSettings.yPosition = maxY; |
||
2889 | cbradney | 1444 | } |
1445 | if (dc.tagName()=="PAGEPALETTE") |
||
1446 | { |
||
4026 | craig | 1447 | appPrefs.SepalT = static_cast<bool>(dc.attribute("THUMBS").toInt()); |
1448 | appPrefs.SepalN = static_cast<bool>(dc.attribute("NAMES").toInt()); |
||
2889 | cbradney | 1449 | } |
1450 | if (dc.tagName()=="SCRAPBOOK") |
||
1451 | { |
||
4026 | craig | 1452 | appPrefs.PSize = dc.attribute("PREVIEW").toInt(); |
1453 | appPrefs.SaveAtQ = static_cast<bool>(dc.attribute("SAVE").toInt()); |
||
2889 | cbradney | 1454 | } |
1455 | if (dc.tagName() == "DOKUMENT") |
||
1456 | { |
||
1457 | appPrefs.pageSize = dc.attribute("PAGESIZE","A4"); |
||
4026 | craig | 1458 | appPrefs.pageOrientation = dc.attribute("AUSRICHTUNG", "0").toInt(); |
1459 | appPrefs.PageWidth = dc.attribute("BREITE", "595").toDouble(); |
||
1460 | appPrefs.PageHeight = dc.attribute("HOEHE", "842").toDouble(); |
||
1461 | appPrefs.RandOben = dc.attribute("RANDO", "9").toDouble(); |
||
1462 | appPrefs.RandUnten = dc.attribute("RANDU", "40").toDouble(); |
||
1463 | appPrefs.RandLinks = dc.attribute("RANDL", "9").toDouble(); |
||
1464 | appPrefs.RandRechts = dc.attribute("RANDR", "9").toDouble(); |
||
1465 | appPrefs.FacingPages = dc.attribute("DOPPEL", "0").toInt(); |
||
1466 | appPrefs.AutoSave = static_cast<bool>(dc.attribute("AutoSave", "0").toInt()); |
||
1467 | appPrefs.AutoSaveTime = dc.attribute("AutoSaveTime", "600000").toInt(); |
||
2889 | cbradney | 1468 | } |
3016 | fschmid | 1469 | if (dc.tagName()=="PageSets") |
1470 | { |
||
1471 | QDomNode PGS = DOC.firstChild(); |
||
3026 | fschmid | 1472 | if (!PGS.namedItem("PageNames").isNull()) |
3016 | fschmid | 1473 | { |
3026 | fschmid | 1474 | appPrefs.pageSets.clear(); |
1475 | while(!PGS.isNull()) |
||
3016 | fschmid | 1476 | { |
3026 | fschmid | 1477 | QDomElement PgsAttr = PGS.toElement(); |
1478 | if(PgsAttr.tagName() == "Set") |
||
1479 | { |
||
1480 | struct PageSet pageS; |
||
1481 | pageS.Name = PgsAttr.attribute("Name"); |
||
4026 | craig | 1482 | pageS.FirstPage = PgsAttr.attribute("FirstPage", "0").toInt(); |
1483 | pageS.Rows = PgsAttr.attribute("Rows", "1").toInt(); |
||
1484 | pageS.Columns = PgsAttr.attribute("Columns", "1").toInt(); |
||
1485 | pageS.GapHorizontal = PgsAttr.attribute("GapHorizontal", "0").toDouble(); |
||
1486 | pageS.GapVertical = PgsAttr.attribute("GapVertical", "0").toDouble(); |
||
1487 | pageS.GapBelow = PgsAttr.attribute("GapBelow", "0").toDouble(); |
||
3026 | fschmid | 1488 | pageS.pageNames.clear(); |
1489 | QDomNode PGSN = PGS.firstChild(); |
||
1490 | while(!PGSN.isNull()) |
||
1491 | { |
||
1492 | QDomElement PgsAttrN = PGSN.toElement(); |
||
1493 | if(PgsAttrN.tagName() == "PageNames") |
||
1494 | pageS.pageNames.append(PgsAttrN.attribute("Name")); |
||
1495 | PGSN = PGSN.nextSibling(); |
||
1496 | } |
||
1497 | appPrefs.pageSets.append(pageS); |
||
1498 | } |
||
1499 | PGS = PGS.nextSibling(); |
||
3016 | fschmid | 1500 | } |
1501 | } |
||
1502 | } |
||
2889 | cbradney | 1503 | if (dc.tagName()=="CMS") |
1504 | { |
||
4026 | craig | 1505 | appPrefs.DCMSset.SoftProofOn = static_cast<bool>(dc.attribute("DPSo", "0").toInt()); |
1506 | appPrefs.DCMSset.CMSinUse = static_cast<bool>(dc.attribute("DPuse", "0").toInt()); |
||
1507 | appPrefs.DCMSset.GamutCheck = static_cast<bool>(dc.attribute("DPgam", "0").toInt()); |
||
1508 | appPrefs.DCMSset.BlackPoint = static_cast<bool>(dc.attribute("DPbla", "1").toInt()); |
||
2889 | cbradney | 1509 | appPrefs.DCMSset.DefaultMonitorProfile = dc.attribute("DPMo",""); |
1510 | appPrefs.DCMSset.DefaultPrinterProfile = dc.attribute("DPPr",""); |
||
2984 | fschmid | 1511 | appPrefs.DCMSset.DefaultImageRGBProfile = dc.attribute("DPIn",""); |
1512 | appPrefs.DCMSset.DefaultImageCMYKProfile = dc.attribute("DPInCMYK",""); |
||
1513 | appPrefs.DCMSset.DefaultSolidColorProfile = dc.attribute("DPIn2",""); |
||
4026 | craig | 1514 | appPrefs.DCMSset.DefaultIntentPrinter = dc.attribute("DIPr", "0").toInt(); |
1515 | appPrefs.DCMSset.DefaultIntentMonitor = dc.attribute("DIMo", "3").toInt(); |
||
1516 | appPrefs.DCMSset.DefaultIntentImages = dc.attribute("DIMo2", "3").toInt(); |
||
2889 | cbradney | 1517 | } |
1518 | if (!importingFrom12 && dc.tagName()=="SHORTCUT") |
||
1519 | { |
||
1520 | if (appPrefs.KeyActions.contains(dc.attribute("ACTION"))) |
||
1521 | { |
||
1522 | appPrefs.KeyActions[dc.attribute("ACTION")].actionName = dc.attribute("ACTION"); |
||
3932 | avox | 1523 | QKeySequence newKeySequence = QKeySequence(dc.attribute("SEQUENCE")); |
1524 | // qDebug(QString("reading shortcut for %2 %1").arg(QString(newKeySequence)).arg(dc.attribute("ACTION"))); |
||
1525 | appPrefs.KeyActions[dc.attribute("ACTION")].keySequence = newKeySequence; |
||
2889 | cbradney | 1526 | } |
1527 | } |
||
1528 | if (dc.tagName()=="RECENT") |
||
1529 | appPrefs.RecentDocs.append(dc.attribute("NAME")); |
||
1530 | if (dc.tagName()=="Checker") |
||
1531 | { |
||
3142 | cbradney | 1532 | appPrefs.curCheckProfile = dc.attribute("currentProfile", tr("PostScript")); |
1533 | //#2516 work around old values until people wont have them anymore, not that these |
||
1534 | //translated strings should be going into prefs anyway! |
||
1535 | if (appPrefs.curCheckProfile == tr("Postscript")) |
||
1536 | appPrefs.curCheckProfile == tr("PostScript"); |
||
2889 | cbradney | 1537 | } |
1538 | if (dc.tagName()=="CheckProfile") |
||
1539 | { |
||
1540 | QString name=dc.attribute("Name"); |
||
3183 | fschmid | 1541 | struct checkerPrefs checkerSettings; |
4026 | craig | 1542 | checkerSettings.ignoreErrors = static_cast<bool>(dc.attribute("ignoreErrors", "0").toInt()); |
1543 | checkerSettings.autoCheck = static_cast<bool>(dc.attribute("autoCheck", "1").toInt()); |
||
1544 | checkerSettings.checkGlyphs = static_cast<bool>(dc.attribute("checkGlyphs", "1").toInt()); |
||
1545 | checkerSettings.checkOrphans = static_cast<bool>(dc.attribute("checkOrphans", "1").toInt()); |
||
1546 | checkerSettings.checkOverflow = static_cast<bool>(dc.attribute("checkOverflow", "1").toInt()); |
||
1547 | checkerSettings.checkPictures = static_cast<bool>(dc.attribute("checkPictures", "1").toInt()); |
||
1548 | checkerSettings.checkResolution = static_cast<bool>(dc.attribute("checkResolution", "1").toInt()); |
||
1549 | checkerSettings.checkTransparency = static_cast<bool>(dc.attribute("checkTransparency", "1").toInt()); |
||
1550 | checkerSettings.minResolution = dc.attribute("minResolution", "72").toDouble(); |
||
1551 | checkerSettings.checkAnnotations = static_cast<bool>(dc.attribute("checkAnnotations", "0").toInt()); |
||
1552 | checkerSettings.checkRasterPDF = static_cast<bool>(dc.attribute("checkRasterPDF", "1").toInt()); |
||
3183 | fschmid | 1553 | appPrefs.checkerProfiles[name] = checkerSettings; |
2889 | cbradney | 1554 | } |
1555 | if (dc.tagName()=="PRINTER") |
||
1556 | { |
||
1557 | appPrefs.PrinterName = dc.attribute("NAME"); |
||
1558 | appPrefs.PrinterFile = dc.attribute("FILE"); |
||
1559 | appPrefs.PrinterCommand = dc.attribute("COMMAND"); |
||
4026 | craig | 1560 | appPrefs.ClipMargin = static_cast<bool>(dc.attribute("CLIPMARGIN", "1").toInt()); |
1561 | appPrefs.GCRMode = static_cast<bool>(dc.attribute("GMODE", "1").toInt()); |
||
2889 | cbradney | 1562 | } |
1563 | if (dc.tagName()=="PRINTPREVIEW") |
||
1564 | { |
||
4026 | craig | 1565 | appPrefs.PrPr_Mode = static_cast<bool>(dc.attribute("Mode", "0").toInt()); |
1566 | appPrefs.Gcr_Mode = static_cast<bool>(dc.attribute("GcrMode", "1").toInt()); |
||
1567 | appPrefs.PrPr_AlphaText = static_cast<bool>(dc.attribute("AlphaText", "0").toInt()); |
||
1568 | appPrefs.PrPr_AlphaGraphics = static_cast<bool>(dc.attribute("AlphaGraphics", "0").toInt()); |
||
1569 | appPrefs.PrPr_Transparency = static_cast<bool>(dc.attribute("Transparency", "0").toInt()); |
||
1570 | appPrefs.PrPr_C = static_cast<bool>(dc.attribute("Cyan", "1").toInt()); |
||
1571 | appPrefs.PrPr_M = static_cast<bool>(dc.attribute("Magenta", "1").toInt()); |
||
1572 | appPrefs.PrPr_Y = static_cast<bool>(dc.attribute("Yellow", "1").toInt()); |
||
1573 | appPrefs.PrPr_K = static_cast<bool>(dc.attribute("Black", "1").toInt()); |
||
2889 | cbradney | 1574 | } |
1575 | if (dc.tagName()=="EXTERNAL") |
||
1576 | { |
||
1577 | setGhostscriptExecutable(dc.attribute("GS", "gs")); |
||
4026 | craig | 1578 | appPrefs.gs_AntiAliasText = static_cast<bool>(dc.attribute("AlphaText", "0").toInt()); |
1579 | appPrefs.gs_AntiAliasGraphics = static_cast<bool>(dc.attribute("AlphaGraphics", "0").toInt()); |
||
1580 | appPrefs.gs_Resolution = dc.attribute("Resolution", "72").toInt(); |
||
2889 | cbradney | 1581 | setImageEditorExecutable(dc.attribute("GIMP", "gimp")); |
1582 | } |
||
1583 | if (dc.tagName()=="HYPHEN") |
||
1584 | { |
||
1585 | if (!dc.attribute("LANG", "").isEmpty()) |
||
1586 | appPrefs.Language = dc.attribute("LANG"); |
||
4026 | craig | 1587 | appPrefs.MinWordLen = dc.attribute("WORDLEN", "3").toInt(); |
1588 | appPrefs.HyCount = dc.attribute("HYCOUNT", "2").toInt(); |
||
1589 | appPrefs.Automatic = static_cast<bool>(dc.attribute("MODE", "1").toInt()); |
||
1590 | appPrefs.AutoCheck = static_cast<bool>(dc.attribute("INMODE", "1").toInt()); |
||
2889 | cbradney | 1591 | } |
1592 | if (dc.tagName()=="FONTS") |
||
1593 | { |
||
1594 | QString tmpf = dc.attribute("FACE"); |
||
1595 | QString newFont = ""; |
||
1596 | if (!appPrefs.AvailFonts.find(tmpf)) |
||
1597 | { |
||
4026 | craig | 1598 | ScMW->showSplash(false); |
2889 | cbradney | 1599 | MissingFont *dia = new MissingFont(0, tmpf, 0); |
1600 | dia->exec(); |
||
1601 | newFont = dia->getReplacementFont(); |
||
1602 | delete dia; |
||
1603 | } |
||
1604 | else |
||
1605 | newFont = dc.attribute("FACE"); |
||
1606 | if (!newFont.isEmpty()) |
||
1607 | appPrefs.toolSettings.defFont = newFont; |
||
4026 | craig | 1608 | appPrefs.toolSettings.defSize = qRound(dc.attribute("SIZE").toDouble() * 10.0); |
1609 | appPrefs.askBeforeSubstituite = static_cast<bool>(dc.attribute("AutomaticSubst", "1").toInt()); |
||
2889 | cbradney | 1610 | } |
1611 | if (dc.tagName()=="FONT") |
||
1612 | { |
||
1613 | if (appPrefs.AvailFonts.find(dc.attribute("NAME"))) |
||
1614 | { |
||
4026 | craig | 1615 | appPrefs.AvailFonts[dc.attribute("NAME")]->EmbedPS = static_cast<bool>(dc.attribute("EMBED").toInt()); |
1616 | appPrefs.AvailFonts[dc.attribute("NAME")]->UseFont &= static_cast<bool>(dc.attribute("USE", "1").toInt()); |
||
1617 | appPrefs.AvailFonts[dc.attribute("NAME")]->Subset = static_cast<bool>(dc.attribute("SUBSET", "0").toInt()); |
||
2889 | cbradney | 1618 | } |
1619 | } |
||
1620 | if (dc.tagName()=="COLOR") |
||
1621 | { |
||
1622 | if (dc.hasAttribute("CMYK")) |
||
1623 | lf.setNamedColor(dc.attribute("CMYK")); |
||
1624 | else |
||
1625 | lf.fromQColor(QColor(dc.attribute("RGB"))); |
||
3051 | fschmid | 1626 | if (dc.hasAttribute("Spot")) |
4026 | craig | 1627 | lf.setSpotColor(static_cast<bool>(dc.attribute("Spot").toInt())); |
3051 | fschmid | 1628 | else |
1629 | lf.setSpotColor(false); |
||
3060 | fschmid | 1630 | if (dc.hasAttribute("Register")) |
4026 | craig | 1631 | lf.setRegistrationColor(static_cast<bool>(dc.attribute("Register").toInt())); |
3060 | fschmid | 1632 | else |
1633 | lf.setRegistrationColor(false); |
||
2889 | cbradney | 1634 | appPrefs.DColors[dc.attribute("NAME")] = lf; |
1635 | } |
||
1636 | if (dc.tagName()=="Substitute") |
||
1637 | appPrefs.GFontSub[dc.attribute("Name")] = dc.attribute("Replace"); |
||
1638 | if (dc.tagName()=="COLORSET") |
||
1639 | appPrefs.CustomColorSets.append(dc.attribute("NAME")); |
||
1640 | if (dc.tagName()=="DCOLORSET") |
||
1641 | appPrefs.DColorSet = dc.attribute("NAME"); |
||
1642 | if(dc.tagName()=="PDF") |
||
1643 | { |
||
4026 | craig | 1644 | appPrefs.PDF_Options.Articles = static_cast<bool>(dc.attribute("Articles").toInt()); |
1645 | appPrefs.PDF_Options.Thumbnails = static_cast<bool>(dc.attribute("Thumbnails").toInt()); |
||
1646 | appPrefs.PDF_Options.Compress = static_cast<bool>(dc.attribute("Compress").toInt()); |
||
1647 | appPrefs.PDF_Options.CompressMethod = dc.attribute("CMethod", "0").toInt(); |
||
1648 | appPrefs.PDF_Options.Quality = dc.attribute("Quality", "0").toInt(); |
||
1649 | appPrefs.PDF_Options.RecalcPic = static_cast<bool>(dc.attribute("RecalcPic").toInt()); |
||
1650 | appPrefs.PDF_Options.Bookmarks = static_cast<bool>(dc.attribute("Bookmarks").toInt()); |
||
1651 | appPrefs.PDF_Options.MirrorH = static_cast<bool>(dc.attribute("MirrorH").toInt()); |
||
1652 | appPrefs.PDF_Options.MirrorV = static_cast<bool>(dc.attribute("MirrorV").toInt()); |
||
1653 | appPrefs.PDF_Options.RotateDeg = dc.attribute("RotateDeg", "0").toInt(); |
||
1654 | appPrefs.PDF_Options.PresentMode = static_cast<bool>(dc.attribute("PresentMode").toInt()); |
||
1655 | appPrefs.PDF_Options.PicRes = dc.attribute("PicRes").toInt(); |
||
1656 | appPrefs.PDF_Options.Version = (PDFOptions::PDFVersion)dc.attribute("Version").toInt(); |
||
1657 | appPrefs.PDF_Options.Resolution = dc.attribute("Resolution").toInt(); |
||
1658 | appPrefs.PDF_Options.Binding = dc.attribute("Binding").toInt(); |
||
2889 | cbradney | 1659 | appPrefs.PDF_Options.Datei = ""; |
4026 | craig | 1660 | appPrefs.PDF_Options.isGrayscale = static_cast<bool>(dc.attribute("Grayscale", "0").toInt()); |
1661 | appPrefs.PDF_Options.UseRGB = static_cast<bool>(dc.attribute("RGBMode", "0").toInt()); |
||
1662 | appPrefs.PDF_Options.UseProfiles = static_cast<bool>(dc.attribute("UseProfiles", "0").toInt()); |
||
1663 | appPrefs.PDF_Options.UseProfiles2 = static_cast<bool>(dc.attribute("UseProfiles2", "0").toInt()); |
||
1664 | appPrefs.PDF_Options.Intent = dc.attribute("Intent", "1").toInt(); |
||
1665 | appPrefs.PDF_Options.Intent2 = dc.attribute("Intent2", "1").toInt(); |
||
2889 | cbradney | 1666 | appPrefs.PDF_Options.SolidProf = dc.attribute("SolidP", ""); |
1667 | appPrefs.PDF_Options.ImageProf = dc.attribute("ImageP", ""); |
||
1668 | appPrefs.PDF_Options.PrintProf = dc.attribute("PrintP", ""); |
||
1669 | appPrefs.PDF_Options.Info = dc.attribute("InfoString", ""); |
||
4026 | craig | 1670 | appPrefs.PDF_Options.BleedTop = dc.attribute("BTop", "0").toDouble(); |
1671 | appPrefs.PDF_Options.BleedLeft = dc.attribute("BLeft", "0").toDouble(); |
||
1672 | appPrefs.PDF_Options.BleedRight = dc.attribute("BRight", "0").toDouble(); |
||
1673 | appPrefs.PDF_Options.BleedBottom = dc.attribute("BBottom", "0").toDouble(); |
||
1674 | appPrefs.PDF_Options.EmbeddedI = static_cast<bool>(dc.attribute("ImagePr", "0").toInt()); |
||
2889 | cbradney | 1675 | appPrefs.PDF_Options.PassOwner = dc.attribute("PassOwner", ""); |
1676 | appPrefs.PDF_Options.PassUser = dc.attribute("PassUser", ""); |
||
4026 | craig | 1677 | appPrefs.PDF_Options.Permissions = dc.attribute("Permissions", "-4").toInt(); |
1678 | appPrefs.PDF_Options.Encrypt = static_cast<bool>(dc.attribute("Encrypt", "0").toInt()); |
||
1679 | appPrefs.PDF_Options.useLayers = static_cast<bool>(dc.attribute("UseLayers", "0").toInt()); |
||
1680 | appPrefs.PDF_Options.UseLPI = static_cast<bool>(dc.attribute("UseLpi", "0").toInt()); |
||
1681 | appPrefs.PDF_Options.UseSpotColors = static_cast<bool>(dc.attribute("UseSpotColors", "1").toInt()); |
||
1682 | appPrefs.PDF_Options.doMultiFile = static_cast<bool>(dc.attribute("doMultiFile", "0").toInt()); |
||
4197 | fschmid | 1683 | appPrefs.PDF_Options.displayBookmarks = static_cast<bool>(dc.attribute("displayBookmarks", "0").toInt()); |
1684 | appPrefs.PDF_Options.displayFullscreen = static_cast<bool>(dc.attribute("displayFullscreen", "0").toInt()); |
||
1685 | appPrefs.PDF_Options.displayLayers = static_cast<bool>(dc.attribute("displayLayers", "0").toInt()); |
||
1686 | appPrefs.PDF_Options.displayThumbs = static_cast<bool>(dc.attribute("displayThumbs", "0").toInt()); |
||
1687 | appPrefs.PDF_Options.PageLayout = dc.attribute("PageLayout", "0").toInt(); |
||
1688 | appPrefs.PDF_Options.openAction = dc.attribute("openAction", ""); |
||
2889 | cbradney | 1689 | QDomNode PFO = DOC.firstChild(); |
4039 | fschmid | 1690 | appPrefs.PDF_Options.LPISettings.clear(); |
2889 | cbradney | 1691 | while(!PFO.isNull()) |
1692 | { |
||
1693 | QDomElement pdfF = PFO.toElement(); |
||
1694 | if(pdfF.tagName() == "LPI") |
||
1695 | { |
||
1696 | struct LPIData lpo; |
||
4026 | craig | 1697 | lpo.Angle = pdfF.attribute("Angle").toInt(); |
1698 | lpo.Frequency = pdfF.attribute("Frequency").toInt(); |
||
1699 | lpo.SpotFunc = pdfF.attribute("SpotFunction").toInt(); |
||
2889 | cbradney | 1700 | appPrefs.PDF_Options.LPISettings[pdfF.attribute("Color")] = lpo; |
1701 | } |
||
1702 | PFO = PFO.nextSibling(); |
||
1703 | } |
||
1704 | } |
||
1705 | if(dc.tagName()=="DefaultItemAttributes") |
||
1706 | { |
||
1707 | QDomNode DIA = DOC.firstChild(); |
||
1708 | appPrefs.defaultItemAttributes.clear(); |
||
1709 | while(!DIA.isNull()) |
||
1710 | { |
||
1711 | QDomElement itemAttr = DIA.toElement(); |
||
1712 | if(itemAttr.tagName() == "ItemAttribute") |
||
1713 | { |
||
1714 | ObjectAttribute objattr; |
||
1715 | objattr.name=itemAttr.attribute("Name"); |
||
1716 | objattr.type=itemAttr.attribute("Type"); |
||
1717 | objattr.value=itemAttr.attribute("Value"); |
||
1718 | objattr.parameter=itemAttr.attribute("Parameter"); |
||
1719 | objattr.relationship=itemAttr.attribute("Relationship"); |
||
1720 | objattr.relationshipto=itemAttr.attribute("RelationshipTo"); |
||
1721 | objattr.autoaddto=itemAttr.attribute("AutoAddTo"); |
||
1722 | appPrefs.defaultItemAttributes.append(objattr); |
||
1723 | } |
||
1724 | DIA = DIA.nextSibling(); |
||
1725 | } |
||
1726 | } |
||
1727 | if(dc.tagName()=="TablesOfContents") |
||
1728 | { |
||
1729 | QDomNode TOC = DOC.firstChild(); |
||
1730 | appPrefs.defaultToCSetups.clear(); |
||
1731 | while(!TOC.isNull()) |
||
1732 | { |
||
1733 | QDomElement tocElem = TOC.toElement(); |
||
1734 | if(tocElem.tagName() == "TableOfContents") |
||
1735 | { |
||
1736 | ToCSetup tocsetup; |
||
1737 | tocsetup.name=tocElem.attribute("Name"); |
||
1738 | tocsetup.itemAttrName=tocElem.attribute("ItemAttributeName"); |
||
1739 | tocsetup.frameName=tocElem.attribute("FrameName"); |
||
1740 | tocsetup.listNonPrintingFrames=tocElem.attribute("ListNonPrinting"); |
||
1741 | tocsetup.textStyle=tocElem.attribute("Style"); |
||
1742 | QString numberPlacement=tocElem.attribute("NumberPlacement"); |
||
1743 | if (numberPlacement=="Beginning") |
||
1744 | tocsetup.pageLocation=Beginning; |
||
1745 | if (numberPlacement=="End") |
||
1746 | tocsetup.pageLocation=End; |
||
1747 | if (numberPlacement=="NotShown") |
||
1748 | tocsetup.pageLocation=NotShown; |
||
1749 | appPrefs.defaultToCSetups.append(tocsetup); |
||
1750 | } |
||
1751 | TOC = TOC.nextSibling(); |
||
1752 | } |
||
1753 | } |
||
1754 | // lorem ispum |
||
1755 | if (dc.tagName() == "LoremIpsum") |
||
1756 | { |
||
4026 | craig | 1757 | appPrefs.useStandardLI = static_cast<bool>(dc.attribute("useStandardLI", "0").toInt()); |
1758 | appPrefs.paragraphsLI = dc.attribute("paragraphsLI", "10").toInt(); |
||
2889 | cbradney | 1759 | } |
1760 | DOC=DOC.nextSibling(); |
||
1761 | } |
||
1762 | if (appPrefs.GUI != "Default") |
||
1763 | qApp->setStyle(QStyleFactory::create(appPrefs.GUI)); |
||
1764 | QFont apf = qApp->font(); |
||
1765 | apf.setPointSize(appPrefs.AppFontSize); |
||
1766 | qApp->setFont(apf,true); |
||
1767 | return true; |
||
1768 | } |
||
3097 | cbradney | 1769 | |
1770 | void PrefsManager::initDefaultCheckerPrefs(CheckerPrefsList* cp) |
||
1771 | { |
||
1772 | if (cp!=NULL) |
||
1773 | { |
||
1774 | struct checkerPrefs checkerSettings; |
||
1775 | checkerSettings.ignoreErrors = false; |
||
1776 | checkerSettings.autoCheck = true; |
||
1777 | checkerSettings.checkGlyphs = true; |
||
1778 | checkerSettings.checkOrphans = true; |
||
1779 | checkerSettings.checkOverflow = true; |
||
1780 | checkerSettings.checkPictures = true; |
||
1781 | checkerSettings.checkResolution = true; |
||
1782 | checkerSettings.checkTransparency = true; |
||
1783 | checkerSettings.checkAnnotations = false; |
||
1784 | checkerSettings.checkRasterPDF = true; |
||
1785 | checkerSettings.minResolution = 72.0; |
||
1786 | //TODO Stop translating these into settings!!!!!!!!! |
||
3142 | cbradney | 1787 | cp->insert( QT_TR_NOOP("PostScript"), checkerSettings); |
3097 | cbradney | 1788 | cp->insert( QT_TR_NOOP("PDF 1.3"), checkerSettings); |
1789 | checkerSettings.checkTransparency = false; |
||
1790 | cp->insert( QT_TR_NOOP("PDF 1.4"), checkerSettings); |
||
1791 | checkerSettings.checkTransparency = true; |
||
1792 | checkerSettings.checkAnnotations = true; |
||
1793 | checkerSettings.minResolution = 144.0; |
||
1794 | cp->insert( QT_TR_NOOP("PDF/X-3"), checkerSettings); |
||
1795 | } |
||
1796 | } |
||
3170 | craig | 1797 | |
1798 | const QString & PrefsManager::lastError() const |
||
1799 | { |
||
1800 | return m_lastError; |
||
1801 | } |
||
1802 | |||
1803 | // It's hard to say whether this should be here and called from SavePrefs, or |
||
4026 | craig | 1804 | // triggered by a signal sent from here and displayed by ScribusMainWindow. |
3170 | craig | 1805 | void PrefsManager::alertSavePrefsFailed() const |
1806 | { |
||
4026 | craig | 1807 | QMessageBox::critical(ScMW, tr("Error Writing Preferences"), |
3170 | craig | 1808 | "<qt>" + |
1809 | tr("Scribus was not able to save its preferences:<br>" |
||
1810 | "%1<br>" |
||
1811 | "Please check file and directory permissions and " |
||
1812 | "available disk space.", "scribus app error") |
||
1813 | .arg(lastError()) |
||
1814 | + "</qt>", |
||
1815 | QMessageBox::Ok|QMessageBox::Default|QMessageBox::Escape, |
||
1816 | QMessageBox::NoButton); |
||
1817 | } |
||
3171 | craig | 1818 | |
1819 | // It's hard to say whether this should be here and called from ReadPrefs, or |
||
4026 | craig | 1820 | // triggered by a signal sent from here and displayed by ScribusMainWindow. |
3171 | craig | 1821 | void PrefsManager::alertLoadPrefsFailed() const |
1822 | { |
||
4026 | craig | 1823 | bool splashShowing = ScMW->splashShowing(); |
3171 | craig | 1824 | if (splashShowing) |
4026 | craig | 1825 | ScMW->showSplash(false); |
1826 | QMessageBox::critical(ScMW, tr("Error Loading Preferences"), |
||
3171 | craig | 1827 | "<qt>" + |
1828 | tr("Scribus was not able to load its preferences:<br>" |
||
1829 | "%1<br>" |
||
1830 | "Default settings will be loaded.") |
||
1831 | .arg(lastError()) |
||
1832 | + "</qt>", |
||
1833 | QMessageBox::Ok|QMessageBox::Default|QMessageBox::Escape, |
||
1834 | QMessageBox::NoButton); |
||
4026 | craig | 1835 | ScMW->showSplash(splashShowing); |
3171 | craig | 1836 | } |
3302 | cbradney | 1837 | |
1838 | const int PrefsManager::gsResolution() |
||
1839 | { |
||
1840 | return appPrefs.gs_Resolution; |
||
1841 | } |