Rev 7075 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5244 | cbradney | 1 | /* |
2 | For general Scribus (>=1.3.2) copyright and licensing information please refer |
||
3 | to the COPYING file provided with the program. Following this notice may exist |
||
4 | a copyright and/or license notice that predates the release of Scribus 1.3.2 |
||
5 | for which a new license (GPL+exception) is in place. |
||
6 | */ |
||
7 | /*************************************************************************** |
||
8 | pageitem.h - description |
||
9 | ------------------- |
||
10 | copyright : Scribus Team |
||
11 | ***************************************************************************/ |
||
12 | |||
13 | /*************************************************************************** |
||
14 | * * |
||
15 | * This program is free software; you can redistribute it and/or modify * |
||
16 | * it under the terms of the GNU General Public License as published by * |
||
17 | * the Free Software Foundation; either version 2 of the License, or * |
||
18 | * (at your option) any later version. * |
||
19 | * * |
||
20 | ***************************************************************************/ |
||
21 | |||
5721 | avox | 22 | #include <cassert> |
23 | #include <iostream> |
||
24 | #include <qglobal.h> |
||
25 | |||
5244 | cbradney | 26 | #include "scribuscore.h" |
27 | #include "scribuscore.moc" |
||
28 | |||
7330 | jghali | 29 | #include "util.h" |
5244 | cbradney | 30 | #include "commonstrings.h" |
31 | #include "filewatcher.h" |
||
32 | #include "gsutil.h" |
||
33 | #include "pluginmanager.h" |
||
34 | #include "prefsmanager.h" |
||
35 | #include "scpaths.h" |
||
36 | #include "splash.h" |
||
37 | #include "scribusapp.h" |
||
38 | #include "undomanager.h" |
||
39 | |||
40 | extern ScribusQApp* ScQApp; |
||
41 | |||
42 | #include "cmserrorhandling.h" |
||
43 | |||
44 | ScribusCore::ScribusCore() : QObject() |
||
45 | { |
||
46 | m_ScribusInitialized=false; |
||
47 | m_SplashScreen=0; |
||
48 | m_UseGUI=false; |
||
5880 | jghali | 49 | m_HaveCMS=false; |
5257 | cbradney | 50 | m_PaletteParent=0; |
5418 | cbradney | 51 | m_currScMW=0; |
5244 | cbradney | 52 | } |
53 | |||
54 | |||
55 | |||
56 | ScribusCore::~ScribusCore() |
||
5257 | cbradney | 57 | { |
58 | delete m_PaletteParent; |
||
59 | } |
||
5244 | cbradney | 60 | |
5721 | avox | 61 | #ifndef NDEBUG |
62 | static void abort_on_error(QtMsgType t, const char * m) |
||
63 | { |
||
5980 | avox | 64 | std::cerr << m << "\n"; |
5721 | avox | 65 | if(t==QtFatalMsg) assert(false); |
5980 | avox | 66 | // if(t!=QtDebugMsg) assert(false); |
5721 | avox | 67 | } |
68 | #endif |
||
69 | |||
70 | |||
5244 | cbradney | 71 | int ScribusCore::init(bool useGUI, bool swapDialogButtonOrder, const QString fileToUse) |
72 | { |
||
73 | m_UseGUI=useGUI; |
||
74 | m_File=fileToUse; |
||
75 | m_SwapDialogButtonOrder=swapDialogButtonOrder; |
||
5721 | avox | 76 | #ifndef NDEBUG |
77 | qInstallMsgHandler( & abort_on_error ); |
||
78 | #endif |
||
79 | |||
5244 | cbradney | 80 | return 0; |
81 | } |
||
82 | |||
7330 | jghali | 83 | int ScribusCore::startGUI(bool showSplash, bool showFontInfo, bool showProfileInfo, const QString newGuiLanguage, const QString prefsUserFile) |
5244 | cbradney | 84 | { |
5257 | cbradney | 85 | m_PaletteParent=new QWidget(0); |
86 | Q_CHECK_PTR(m_PaletteParent); |
||
5418 | cbradney | 87 | ScribusMainWindow* scribus = new ScribusMainWindow(); |
5257 | cbradney | 88 | Q_CHECK_PTR(scribus); |
89 | if (!scribus) |
||
90 | return(EXIT_FAILURE); |
||
5418 | cbradney | 91 | ScMWList.append(scribus); |
92 | m_currScMW=0; |
||
5781 | cbradney | 93 | // ScMW=scribus; |
7330 | jghali | 94 | int retVal=initScribusCore(showSplash, showFontInfo, showProfileInfo,newGuiLanguage, prefsUserFile); |
5257 | cbradney | 95 | if (retVal == 1) |
96 | return(EXIT_FAILURE); |
||
97 | retVal = scribus->initScMW(true); |
||
98 | if (retVal == 1) |
||
99 | return(EXIT_FAILURE); |
||
100 | closeSplash(); |
||
101 | m_ScribusInitialized=true; |
||
102 | ScQApp->setMainWidget(scribus); |
||
103 | connect(ScQApp, SIGNAL(lastWindowClosed()), ScQApp, SLOT(quit())); |
||
5244 | cbradney | 104 | |
5257 | cbradney | 105 | scribus->show(); |
106 | scribus->ShowSubs(); |
||
5244 | cbradney | 107 | |
5257 | cbradney | 108 | if (!m_File.isEmpty()) |
109 | scribus->loadDoc(m_File); |
||
110 | else |
||
111 | { |
||
112 | if (PrefsManager::instance()->appPrefs.showStartupDialog) |
||
113 | scribus->startUpDialog(); |
||
5244 | cbradney | 114 | else |
5257 | cbradney | 115 | scribus->setFocus(); |
116 | } |
||
5244 | cbradney | 117 | |
5257 | cbradney | 118 | // A hook for plug-ins and scripts to trigger on. Some plugins and scripts |
119 | // require the app to be fully set up (in particular, the main window to be |
||
120 | // built and shown) before running their setup. |
||
121 | emit appStarted(); |
||
122 | return EXIT_SUCCESS; |
||
5244 | cbradney | 123 | } |
124 | |||
7330 | jghali | 125 | int ScribusCore::initScribusCore(bool showSplash, bool showFontInfo, bool showProfileInfo, |
126 | const QString newGuiLanguage, const QString prefsUserFile) |
||
5244 | cbradney | 127 | { |
128 | CommonStrings::languageChange(); |
||
129 | int retVal=0; |
||
130 | //FIXME ExternalApp = 0; |
||
131 | m_GuiLanguage = newGuiLanguage; |
||
132 | initSplash(showSplash); |
||
133 | prefsManager = PrefsManager::instance(); |
||
134 | prefsManager->setup(); |
||
6699 | cbradney | 135 | //CB #4428 Get fonts before prefs are set to default |
136 | bool haveFonts=false; |
||
137 | #ifdef QT_MAC |
||
138 | haveFonts=ScCore->initFonts(true); |
||
139 | #else |
||
140 | haveFonts=ScCore->initFonts(showFontInfo); |
||
141 | #endif |
||
142 | if (!haveFonts) |
||
143 | return 1; |
||
5244 | cbradney | 144 | prefsManager->initDefaults(); |
145 | prefsManager->initDefaultGUIFont(qApp->font()); |
||
146 | prefsManager->initArrowStyles(); |
||
147 | undoManager = UndoManager::instance(); |
||
148 | fileWatcher = new FileWatcher(this); |
||
149 | pluginManager = new PluginManager(); |
||
150 | setSplashStatus( tr("Initializing Plugins") ); |
||
151 | pluginManager->initPlugs(); |
||
6699 | cbradney | 152 | /* #4428, remove block later if ok |
5244 | cbradney | 153 | bool haveFonts=false; |
154 | #ifdef QT_MAC |
||
155 | haveFonts=ScCore->initFonts(true); |
||
156 | #else |
||
157 | haveFonts=ScCore->initFonts(showFontInfo); |
||
158 | #endif |
||
159 | if (!haveFonts) |
||
160 | return 1; |
||
6699 | cbradney | 161 | */ |
5244 | cbradney | 162 | setSplashStatus( tr("Initializing Keyboard Shortcuts") ); |
163 | prefsManager->initDefaultActionKeys(); |
||
164 | setSplashStatus( tr("Reading Preferences") ); |
||
165 | if (prefsUserFile.isNull()) |
||
166 | prefsManager->ReadPrefs(); |
||
167 | else |
||
168 | prefsManager->ReadPrefs(prefsUserFile); |
||
169 | |||
170 | m_HaveGS = testGSAvailability(); |
||
171 | m_HavePngAlpha = testGSDeviceAvailability("pngalpha"); |
||
172 | m_HaveTiffSep = testGSDeviceAvailability("tiffsep"); |
||
173 | |||
174 | ScCore->setSplashStatus( tr("Reading ICC Profiles") ); |
||
5880 | jghali | 175 | m_HaveCMS = false; |
7330 | jghali | 176 | getCMSProfiles(showProfileInfo); |
5244 | cbradney | 177 | initCMS(); |
178 | /* |
||
179 | |||
5257 | cbradney | 180 | buildFontMenu(); |
5244 | cbradney | 181 | |
182 | |||
183 | initPalettes(); |
||
184 | |||
185 | |||
186 | setSplashStatus( tr("Initializing Hyphenator") ); |
||
187 | QString preLang = prefsManager->appPrefs.Language; |
||
188 | initHyphenator(); |
||
189 | if (Sprachen.contains(preLang)) |
||
190 | prefsManager->appPrefs.Language = preLang; |
||
191 | setSplashStatus( tr("Reading Scrapbook") ); |
||
192 | initScrapbook(); |
||
193 | setSplashStatus( tr("Setting up Shortcuts") ); |
||
194 | SetShortCut(); |
||
195 | scrActions["helpTooltips"]->setOn(prefsManager->appPrefs.showToolTips); |
||
196 | ToggleTips(); |
||
197 | |||
198 | connect(fileWatcher, SIGNAL(fileDeleted(QString )), this, SLOT(removeRecent(QString))); |
||
199 | connect(this, SIGNAL(TextIFont(QString)), this, SLOT(AdjustFontMenu(QString))); |
||
200 | connect(this, SIGNAL(TextIFont(QString)), propertiesPalette, SLOT(setFontFace(QString))); |
||
201 | connect(this, SIGNAL(TextISize(int)), this, SLOT(setFSizeMenu(int))); |
||
202 | connect(this, SIGNAL(TextISize(int)), propertiesPalette, SLOT(setSize(int))); |
||
203 | connect(this, SIGNAL(TextUSval(int)), propertiesPalette, SLOT(setExtra(int))); |
||
204 | connect(this, SIGNAL(TextStil(int)), propertiesPalette, SLOT(setStil(int))); |
||
205 | connect(this, SIGNAL(TextScale(int)), propertiesPalette, SLOT(setTScale(int))); |
||
206 | connect(this, SIGNAL(TextScaleV(int)), propertiesPalette, SLOT(setTScaleV(int))); |
||
207 | connect(this, SIGNAL(TextBase(int)), propertiesPalette, SLOT(setTBase(int))); |
||
208 | connect(this, SIGNAL(TextShadow(int, int )), propertiesPalette, SLOT(setShadowOffs(int, int ))); |
||
209 | connect(this, SIGNAL(TextOutline(int)), propertiesPalette, SLOT(setOutlineW(int))); |
||
210 | connect(this, SIGNAL(TextUnderline(int, int)), propertiesPalette, SLOT(setUnderline(int, int))); |
||
211 | connect(this, SIGNAL(TextStrike(int, int)), propertiesPalette, SLOT(setStrike(int, int))); |
||
212 | connect(this, SIGNAL(TextFarben(QString, QString, int, int)), propertiesPalette, SLOT(setActFarben(QString, QString, int, int))); |
||
213 | }*/ |
||
5257 | cbradney | 214 | |
5244 | cbradney | 215 | return retVal; |
216 | } |
||
217 | |||
218 | |||
219 | void ScribusCore::initSplash(bool showSplash) |
||
220 | { |
||
221 | if (showSplash) |
||
222 | { |
||
223 | m_SplashScreen = new SplashScreen(); |
||
224 | if (m_SplashScreen != NULL && m_SplashScreen->isShown()) |
||
225 | setSplashStatus(QObject::tr("Initializing...")); |
||
226 | } |
||
227 | else |
||
228 | m_SplashScreen = NULL; |
||
229 | } |
||
230 | |||
231 | void ScribusCore::setSplashStatus(const QString& newText) |
||
232 | { |
||
233 | if (m_SplashScreen != NULL) |
||
234 | { |
||
235 | m_SplashScreen->setStatus( newText ); |
||
236 | qApp->processEvents(); |
||
237 | } |
||
238 | } |
||
239 | |||
240 | void ScribusCore::showSplash(bool shown) |
||
241 | { |
||
242 | if (m_SplashScreen!=NULL && shown!=m_SplashScreen->isShown()) |
||
243 | m_SplashScreen->setShown(shown); |
||
244 | } |
||
245 | |||
246 | bool ScribusCore::splashShowing() const |
||
247 | { |
||
248 | if (m_SplashScreen != NULL) |
||
249 | return m_SplashScreen->isShown(); |
||
250 | return false; |
||
251 | } |
||
252 | |||
253 | void ScribusCore::closeSplash() |
||
254 | { |
||
255 | if (m_SplashScreen!=NULL) |
||
256 | { |
||
257 | m_SplashScreen->close(); |
||
258 | delete m_SplashScreen; |
||
259 | m_SplashScreen = NULL; |
||
260 | } |
||
261 | } |
||
262 | |||
263 | bool ScribusCore::usingGUI() const |
||
264 | { |
||
265 | return m_UseGUI; |
||
266 | } |
||
267 | |||
268 | bool ScribusCore::isMacGUI() const |
||
269 | { |
||
270 | // Do it statically for now |
||
271 | #if defined(Q_WS_MAC) |
||
272 | return true; |
||
273 | #else |
||
274 | return false; |
||
275 | #endif |
||
276 | } |
||
277 | |||
278 | bool ScribusCore::isWinGUI() const |
||
279 | { |
||
280 | // Do it statically for now |
||
281 | #if defined(_WIN32) |
||
282 | return true; |
||
283 | #else |
||
284 | return false; |
||
285 | #endif |
||
286 | } |
||
287 | |||
288 | bool ScribusCore::reverseDialogButtons() const |
||
289 | { |
||
290 | if (m_SwapDialogButtonOrder) |
||
291 | return true; |
||
292 | //Win32 - dont switch |
||
293 | #if defined(_WIN32) |
||
294 | return false; |
||
295 | //Mac Aqua - switch |
||
296 | #elif defined(Q_WS_MAC) |
||
297 | return true; |
||
298 | #else |
||
299 | //Gnome - switch |
||
300 | QString gnomesession= ::getenv("GNOME_DESKTOP_SESSION_ID"); |
||
301 | if (!gnomesession.isEmpty()) |
||
302 | return true; |
||
303 | |||
304 | //KDE/KDE Aqua - dont switch |
||
305 | //Best guess for now if we are running under KDE |
||
306 | QString kdesession= ::getenv("KDE_FULL_SESSION"); |
||
307 | if (!kdesession.isEmpty()) |
||
308 | return false; |
||
309 | #endif |
||
310 | return false; |
||
311 | } |
||
312 | |||
313 | //Returns false when there are no fonts |
||
314 | bool ScribusCore::initFonts(bool showFontInfo) |
||
315 | { |
||
316 | setSplashStatus( tr("Searching for Fonts") ); |
||
317 | bool haveFonts=prefsManager->GetAllFonts(showFontInfo); |
||
318 | if (!haveFonts) |
||
319 | { |
||
320 | closeSplash(); |
||
321 | QString mess = tr("There are no fonts found on your system."); |
||
322 | mess += "\n" + tr("Exiting now."); |
||
323 | QMessageBox::critical(0, tr("Fatal Error"), mess, 1, 0, 0); |
||
324 | } |
||
325 | else |
||
326 | setSplashStatus( tr("Font System Initialized") ); |
||
327 | return haveFonts; |
||
328 | } |
||
329 | |||
330 | |||
7330 | jghali | 331 | void ScribusCore::getCMSProfiles(bool showInfo) |
5244 | cbradney | 332 | { |
333 | QString profDir; |
||
334 | QStringList profDirs; |
||
335 | MonitorProfiles.clear(); |
||
336 | PrinterProfiles.clear(); |
||
337 | InputProfiles.clear(); |
||
338 | InputProfilesCMYK.clear(); |
||
339 | QString pfad = ScPaths::instance().libDir(); |
||
340 | pfad += "profiles/"; |
||
341 | profDirs = ScPaths::getSystemProfilesDirs(); |
||
342 | profDirs.prepend( prefsManager->appPrefs.ProfileDir ); |
||
343 | profDirs.prepend( pfad ); |
||
344 | for(unsigned int i = 0; i < profDirs.count(); i++) |
||
345 | { |
||
346 | profDir = profDirs[i]; |
||
347 | if(!profDir.isEmpty()) |
||
348 | { |
||
349 | if(profDir.right(1) != "/") |
||
350 | profDir += "/"; |
||
7330 | jghali | 351 | getCMSProfilesDir(profDir, showInfo, true); |
5244 | cbradney | 352 | } |
353 | } |
||
354 | if ((!PrinterProfiles.isEmpty()) && (!InputProfiles.isEmpty()) && (!MonitorProfiles.isEmpty())) |
||
5880 | jghali | 355 | m_HaveCMS = true; |
5244 | cbradney | 356 | else |
5880 | jghali | 357 | m_HaveCMS = false; |
5244 | cbradney | 358 | } |
359 | |||
7330 | jghali | 360 | void ScribusCore::getCMSProfilesDir(QString pfad, bool showInfo, bool recursive) |
5244 | cbradney | 361 | { |
362 | QDir d(pfad, "*", QDir::Name, QDir::Files | QDir::Readable | QDir::Dirs | QDir::NoSymLinks); |
||
363 | if ((d.exists()) && (d.count() != 0)) |
||
364 | { |
||
365 | QString nam = ""; |
||
366 | const char *Descriptor; |
||
367 | cmsHPROFILE hIn = NULL; |
||
368 | |||
369 | for (uint dc = 0; dc < d.count(); ++dc) |
||
370 | { |
||
371 | QFileInfo fi(pfad + "/" + d[dc]); |
||
6208 | jghali | 372 | if (fi.isDir() && !recursive) |
373 | continue; |
||
374 | else if (fi.isDir() && d[dc][0] != '.') |
||
5244 | cbradney | 375 | { |
7330 | jghali | 376 | getCMSProfilesDir(fi.filePath()+"/", showInfo, true); |
5244 | cbradney | 377 | continue; |
378 | } |
||
379 | |||
380 | #ifndef QT_MAC |
||
381 | QString ext = fi.extension(false).lower(); |
||
382 | if ((ext != "icm") && (ext != "icc")) |
||
383 | continue; |
||
384 | #endif |
||
385 | |||
386 | QFile f(fi.filePath()); |
||
387 | QByteArray bb(40); |
||
388 | if (!f.open(IO_ReadOnly)) { |
||
7330 | jghali | 389 | sDebug(QString("couldn't open %1 as ICC").arg(fi.filePath())); |
5244 | cbradney | 390 | continue; |
391 | } |
||
392 | int len = f.readBlock(bb.data(), 40); |
||
393 | f.close(); |
||
394 | if (len == 40 && bb[36] == 'a' && bb[37] == 'c' && bb[38] == 's' && bb[39] == 'p') |
||
395 | { |
||
396 | const QCString profilePath( QString(pfad + d[dc]).local8Bit() ); |
||
397 | if (setjmp(cmsJumpBuffer)) |
||
398 | { |
||
7330 | jghali | 399 | // Profile is broken, show info if necessary |
400 | if (showInfo) |
||
401 | sDebug(QString("ICC profile %s is broken").arg(fi.filePath())); |
||
5244 | cbradney | 402 | // Reset to the default handler otherwise may enter a loop |
403 | // if an error occur in cmsCloseProfile() |
||
404 | cmsSetErrorHandler(NULL); |
||
405 | if (hIn) |
||
406 | { |
||
407 | cmsCloseProfile(hIn); |
||
408 | hIn = NULL; |
||
409 | } |
||
410 | continue; |
||
411 | } |
||
412 | cmsSetErrorHandler(&cmsErrorHandler); |
||
413 | hIn = cmsOpenProfileFromFile(profilePath.data(), "r"); |
||
414 | if (hIn == NULL) |
||
415 | continue; |
||
416 | Descriptor = cmsTakeProductDesc(hIn); |
||
417 | nam = QString(Descriptor); |
||
418 | switch (static_cast<int>(cmsGetDeviceClass(hIn))) |
||
419 | { |
||
420 | case icSigInputClass: |
||
5838 | jghali | 421 | if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigRgbData) |
6171 | jghali | 422 | InputProfiles.insert(nam, pfad + d[dc], false); |
5838 | jghali | 423 | break; |
5244 | cbradney | 424 | case icSigColorSpaceClass: |
425 | if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigRgbData) |
||
6171 | jghali | 426 | InputProfiles.insert(nam, pfad + d[dc], false); |
5244 | cbradney | 427 | if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigCmykData) |
6171 | jghali | 428 | InputProfilesCMYK.insert(nam, pfad + d[dc], false); |
5244 | cbradney | 429 | break; |
430 | case icSigDisplayClass: |
||
431 | if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigRgbData) |
||
432 | { |
||
6171 | jghali | 433 | MonitorProfiles.insert(nam, pfad + d[dc], false); |
434 | InputProfiles.insert(nam, pfad + d[dc], false); |
||
5244 | cbradney | 435 | } |
436 | if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigCmykData) |
||
6171 | jghali | 437 | InputProfilesCMYK.insert(nam, pfad + d[dc], false); |
5244 | cbradney | 438 | break; |
439 | case icSigOutputClass: |
||
7075 | jghali | 440 | // Disable rgb printer profile detection until effective support |
441 | // PrinterProfiles.insert(nam, pfad + d[dc], false); |
||
5244 | cbradney | 442 | if (static_cast<int>(cmsGetColorSpace(hIn)) == icSigCmykData) |
443 | { |
||
6171 | jghali | 444 | PDFXProfiles.insert(nam, pfad + d[dc], false); |
445 | InputProfilesCMYK.insert(nam, pfad + d[dc], false); |
||
7075 | jghali | 446 | PrinterProfiles.insert(nam, pfad + d[dc], false); |
5244 | cbradney | 447 | } |
448 | break; |
||
449 | } |
||
450 | cmsCloseProfile(hIn); |
||
451 | hIn = NULL; |
||
7330 | jghali | 452 | if (showInfo) |
453 | sDebug( QString("ICC profile %1 loaded from %2").arg(nam).arg(pfad + d[dc]) ); |
||
5244 | cbradney | 454 | } |
455 | } |
||
456 | cmsSetErrorHandler(NULL); |
||
457 | } |
||
458 | } |
||
459 | |||
460 | void ScribusCore::initCMS() |
||
461 | { |
||
5880 | jghali | 462 | if (m_HaveCMS) |
5244 | cbradney | 463 | { |
464 | ProfilesL::Iterator ip; |
||
465 | if ((prefsManager->appPrefs.DCMSset.DefaultImageRGBProfile.isEmpty()) || (!InputProfiles.contains(prefsManager->appPrefs.DCMSset.DefaultImageRGBProfile))) |
||
466 | { |
||
467 | ip = InputProfiles.begin(); |
||
468 | prefsManager->appPrefs.DCMSset.DefaultImageRGBProfile = ip.key(); |
||
469 | } |
||
470 | if ((prefsManager->appPrefs.DCMSset.DefaultImageCMYKProfile.isEmpty()) || (!InputProfilesCMYK.contains(prefsManager->appPrefs.DCMSset.DefaultImageCMYKProfile))) |
||
471 | { |
||
472 | ip = InputProfilesCMYK.begin(); |
||
473 | prefsManager->appPrefs.DCMSset.DefaultImageCMYKProfile = ip.key(); |
||
474 | } |
||
5345 | mrdocs | 475 | if ((prefsManager->appPrefs.DCMSset.DefaultSolidColorRGBProfile.isEmpty()) || (!InputProfiles.contains(prefsManager->appPrefs.DCMSset.DefaultSolidColorRGBProfile))) |
5244 | cbradney | 476 | { |
477 | ip = InputProfiles.begin(); |
||
5345 | mrdocs | 478 | prefsManager->appPrefs.DCMSset.DefaultSolidColorRGBProfile = ip.key(); |
5244 | cbradney | 479 | } |
5345 | mrdocs | 480 | if ((prefsManager->appPrefs.DCMSset.DefaultSolidColorCMYKProfile.isEmpty()) || (!InputProfilesCMYK.contains(prefsManager->appPrefs.DCMSset.DefaultSolidColorCMYKProfile))) |
481 | { |
||
482 | ip = InputProfilesCMYK.begin(); |
||
483 | prefsManager->appPrefs.DCMSset.DefaultSolidColorCMYKProfile = ip.key(); |
||
484 | } |
||
5244 | cbradney | 485 | if ((prefsManager->appPrefs.DCMSset.DefaultMonitorProfile.isEmpty()) || (!MonitorProfiles.contains(prefsManager->appPrefs.DCMSset.DefaultMonitorProfile))) |
486 | { |
||
487 | ip = MonitorProfiles.begin(); |
||
488 | prefsManager->appPrefs.DCMSset.DefaultMonitorProfile = ip.key(); |
||
489 | } |
||
490 | if ((prefsManager->appPrefs.DCMSset.DefaultPrinterProfile.isEmpty()) || (!PrinterProfiles.contains(prefsManager->appPrefs.DCMSset.DefaultPrinterProfile))) |
||
491 | { |
||
492 | ip = PrinterProfiles.begin(); |
||
493 | prefsManager->appPrefs.DCMSset.DefaultPrinterProfile = ip.key(); |
||
494 | } |
||
495 | } |
||
496 | } |
||
5418 | cbradney | 497 | |
498 | ScribusMainWindow * ScribusCore::primaryMainWindow( ) |
||
499 | { |
||
500 | if (ScMWList.count()==0 || m_currScMW>ScMWList.count()) |
||
501 | return 0; |
||
502 | ScribusMainWindow* mw=ScMWList.at(m_currScMW); |
||
503 | if (!mw) |
||
504 | return 0; |
||
505 | return mw; |
||
506 | } |
||
5781 | cbradney | 507 | |
6703 | fschmid | 508 | void ScribusCore::recheckGS() |
509 | { |
||
510 | m_HaveGS = testGSAvailability(); |
||
511 | m_HavePngAlpha = testGSDeviceAvailability("pngalpha"); |
||
512 | m_HaveTiffSep = testGSDeviceAvailability("tiffsep"); |
||
513 | } |
||
5781 | cbradney | 514 | |
515 | bool ScribusCore::fileWatcherActive() const |
||
516 | { |
||
517 | if (fileWatcher!=NULL) |
||
518 | return fileWatcher->isActive(); |
||
519 | return false; |
||
520 | } |