r15434 by craig - #9282: Test if we have any render frames apps configured before allowing render frame mode
scribus-commit
scribus-commit at lists.scribus.net
Thu Aug 19 23:59:34 CEST 2010
Author: craig
Date: Thu Aug 19 21:59:34 2010
New Revision: 15434
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15434
Log:
#9282: Test if we have any render frames apps configured before allowing render frame mode
Modified:
trunk/Scribus/scribus/prefsmanager.cpp
trunk/Scribus/scribus/prefsmanager.h
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/ui/prefs_externaltools.cpp
trunk/Scribus/scribus/ui/prefs_externaltools.h
trunk/Scribus/scribus/util_file.cpp
trunk/Scribus/scribus/util_file.h
Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15434&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp (original)
+++ trunk/Scribus/scribus/prefsmanager.cpp Thu Aug 19 21:59:34 2010
@@ -991,6 +991,19 @@
appPrefs.extToolPrefs.latexCommands=commands;
}
+bool PrefsManager::renderFrameConfigured()
+{
+ if (appPrefs.extToolPrefs.latexConfigs.isEmpty())
+ return false;
+ if (appPrefs.extToolPrefs.latexCommands.isEmpty())
+ return false;
+ bool foundAny=false;
+ foreach (QString cmd, appPrefs.extToolPrefs.latexCommands)
+ if (fileInPath(cmd))
+ foundAny=true;
+ return foundAny;
+}
+
void PrefsManager::setLatexEditorExecutable(const QString& executableName)
{
Modified: trunk/Scribus/scribus/prefsmanager.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15434&path=/trunk/Scribus/scribus/prefsmanager.h
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.h (original)
+++ trunk/Scribus/scribus/prefsmanager.h Thu Aug 19 21:59:34 2010
@@ -135,6 +135,7 @@
QString uniconvExecutable() const {return appPrefs.extToolPrefs.uniconvExecutable;}
QStringList latexConfigs() const {return appPrefs.extToolPrefs.latexConfigs;}
QMap<QString, QString> latexCommands() const {return appPrefs.extToolPrefs.latexCommands;}
+ bool renderFrameConfigured();
QString latexEditorExecutable() const {return appPrefs.extToolPrefs.latexEditorExecutable;}
bool latexStartWithEmptyFrames() const {return appPrefs.extToolPrefs.latexStartWithEmptyFrames;}
//! \brief Get the users preferred preview resolution
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15434&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Aug 19 21:59:34 2010
@@ -6172,6 +6172,11 @@
void ScribusMainWindow::setAppModeByToggle(bool isOn, int newMode)
{
keyrep=false;
+ if (newMode==modeDrawLatex && !prefsManager->renderFrameConfigured())
+ {
+ QMessageBox::critical(this, "Render Frames Not Configured", "Scribus Preferences do not contain valid Render Frame configuration, please check these settings");
+ return;
+ }
if (doc && isOn)
view->requestMode(newMode);
else
Modified: trunk/Scribus/scribus/ui/prefs_externaltools.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15434&path=/trunk/Scribus/scribus/ui/prefs_externaltools.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_externaltools.cpp (original)
+++ trunk/Scribus/scribus/ui/prefs_externaltools.cpp Thu Aug 19 21:59:34 2010
@@ -9,11 +9,13 @@
#include <QInputDialog>
#include <QProcess>
#include <QMessageBox>
-#include "util_ghostscript.h"
#include "scpaths.h"
#include "prefsstructs.h"
#include "latexhelpers.h"
#include "commonstrings.h"
+#include "util_file.h"
+#include "util_ghostscript.h"
+
#include "prefs_externaltools.h"
@@ -288,47 +290,6 @@
latexConfigsListWidget->setCurrentItem(item);
}
-bool Prefs_ExternalTools::fileInPath(QString file)
-{
- if (file.isEmpty())
- return false;
- file = file.split(' ', QString::SkipEmptyParts).at(0); //Ignore parameters
-
- file = QDir::fromNativeSeparators(file);
- if (file.indexOf('/') >= 0)
- {
- //Looks like an absolute path
- QFileInfo info(file);
- return info.exists();
- }
-
- //Get $PATH
- QStringList env = QProcess::systemEnvironment();
- QString path;
- foreach (QString line, env)
- {
- if (line.indexOf("PATH") == 0)
- {
- path = line.mid(5); //Strip "PATH="
- break;
- }
- }
- QStringList splitpath;
- //TODO: Check this again! OS2? MacOS?
- #ifdef _WIN32
- splitpath = path.split(';', QString::SkipEmptyParts);
- #else
- splitpath = path.split(':', QString::SkipEmptyParts);
- #endif
- foreach (QString dir, splitpath)
- {
- QFileInfo info(dir, file);
- if (info.exists())
- return true;
- }
- return false;
-}
-
void Prefs_ExternalTools::setConfigItemText(QListWidgetItem *item)
{
QString config = item->data(Qt::UserRole).toString();
Modified: trunk/Scribus/scribus/ui/prefs_externaltools.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15434&path=/trunk/Scribus/scribus/ui/prefs_externaltools.h
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_externaltools.h (original)
+++ trunk/Scribus/scribus/ui/prefs_externaltools.h Thu Aug 19 21:59:34 2010
@@ -27,7 +27,6 @@
void languageChange();
protected:
- bool fileInPath(QString file);
void insertConfigItem(QString config, int row = -1);
void setConfigItemText(QListWidgetItem *item);
QMap<QString, QString> commands;
Modified: trunk/Scribus/scribus/util_file.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15434&path=/trunk/Scribus/scribus/util_file.cpp
==============================================================================
--- trunk/Scribus/scribus/util_file.cpp (original)
+++ trunk/Scribus/scribus/util_file.cpp Thu Aug 19 21:59:34 2010
@@ -14,8 +14,11 @@
#endif
#include <QDataStream>
+#include <QDir>
#include <QFile>
+#include <QFileInfo>
#include <QString>
+#include <QProcess>
#include <QTemporaryFile>
#include "scstreamfilter.h"
@@ -185,3 +188,45 @@
return utime(fname.data(), NULL) == 0;
#endif
}
+
+
+bool fileInPath(const QString& filename)
+{
+ if (filename.isEmpty())
+ return false;
+ QString file = filename.split(' ', QString::SkipEmptyParts).at(0); //Ignore parameters
+
+ file = QDir::fromNativeSeparators(file);
+ if (file.indexOf('/') >= 0)
+ {
+ //Looks like an absolute path
+ QFileInfo info(file);
+ return info.exists();
+ }
+
+ //Get $PATH
+ QStringList env = QProcess::systemEnvironment();
+ QString path;
+ foreach (QString line, env)
+ {
+ if (line.indexOf("PATH") == 0)
+ {
+ path = line.mid(5); //Strip "PATH="
+ break;
+ }
+ }
+ QStringList splitpath;
+ //TODO: Check this again! OS2? MacOS?
+ #ifdef _WIN32
+ splitpath = path.split(';', QString::SkipEmptyParts);
+ #else
+ splitpath = path.split(':', QString::SkipEmptyParts);
+ #endif
+ foreach (QString dir, splitpath)
+ {
+ QFileInfo info(dir, file);
+ if (info.exists())
+ return true;
+ }
+ return false;
+}
Modified: trunk/Scribus/scribus/util_file.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15434&path=/trunk/Scribus/scribus/util_file.h
==============================================================================
--- trunk/Scribus/scribus/util_file.h (original)
+++ trunk/Scribus/scribus/util_file.h Thu Aug 19 21:59:34 2010
@@ -73,5 +73,14 @@
* @return true on success, false on failure.
**/
bool SCRIBUS_API touchFile(const QString& file);
+/**
+* @brief Check if an executable exists in the path given
+ *
+ * This function checks if an executable exists in the path given
+ *
+ * @param file name of the file to check, possibly including parameters that will be igored
+ * @return true on success, false on failure.
+**/
+bool SCRIBUS_API fileInPath(const QString& filename);
#endif
More information about the scribus-commit
mailing list