Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 5916 → Rev 5917

/branches/Version13x/Scribus/scribus/helpbrowser.cpp
66,6 → 66,7
#include "scpaths.h"
#include "util.h"
#include "scconfig.h"
#include "scpaths.h"
#include "prefsmanager.h"
#include "prefsfile.h"
 
83,11 → 84,11
*/
QString bookmarkFile()
{
QString fname(QDir::convertSeparators(QDir::homeDirPath()+ "/.scribus/doc/bookmarks.xml"));
QFileInfo f(fname);
if (!f.exists())
QString appDataDir(ScPaths::getApplicationDataDir());
QString fname(appDataDir + "doc/bookmarks.xml");
if (!QFile::exists(fname))
{
QDir d(QDir::convertSeparators(QDir::homeDirPath()+ "/.scribus/"));
QDir d(QDir::convertSeparators(appDataDir));
d.mkdir("doc");
}
return fname;
100,11 → 101,11
*/
QString historyFile()
{
QString fname(QDir::convertSeparators(QDir::homeDirPath()+ "/.scribus/doc/history.xml"));
QFileInfo f(fname);
if (!f.exists())
QString appDataDir(ScPaths::getApplicationDataDir());
QString fname(appDataDir + "doc/history.xml");
if (!QFile::exists(fname))
{
QDir d(QDir::convertSeparators(QDir::homeDirPath()+ "/.scribus/"));
QDir d(QDir::convertSeparators(appDataDir));
d.mkdir("doc");
}
return fname;
/branches/Version13x/Scribus/scribus/prefsmanager.cpp
295,7 → 295,7
appPrefs.AutoSave = false;
appPrefs.AutoSaveTime = 600000;
appPrefs.DisScale = 1.0;
appPrefs.DocDir = QDir::homeDirPath();
appPrefs.DocDir = ScPaths::getUserDocumentDir();
appPrefs.ProfileDir = "";
appPrefs.ScriptDir = "";
appPrefs.documentTemplatesDir = "";
533,7 → 533,7
 
QString PrefsManager::setupPreferencesLocation()
{
QString Pff = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus");
QString Pff = QDir::convertSeparators(ScPaths::getApplicationDataDir());
QFileInfo Pffi = QFileInfo(Pff);
QString PrefsPfad;
//If we are using ~/.scribus
/branches/Version13x/Scribus/scribus/scpaths.h
54,8 → 54,16
/** @brief Return paths to system icc profiles directories*/
static QStringList getSystemProfilesDirs(void);
/** @brief Return paths to system create project directories*/
static QStringList getSystemCreateSwatchesDirs();
static QStringList getSystemCreateSwatchesDirs(void);
 
/** @brief Return path to application data dir*/
static QString getApplicationDataDir(void);
/** @brief Return path to user documents*/
static QString getUserDocumentDir(void);
/** @brief Return path to directory used for temporary files*/
static QString getTempFileDir(void);
 
 
protected:
/** @brief Constructor. Use ScPaths::instance() instead. */
ScPaths();
/branches/Version13x/Scribus/scribus/fileunzip.cpp
54,6 → 54,8
#include "unzip.h"
#include <qdir.h>
 
#include "scpaths.h"
 
#define CASESENSITIVITY (0)
#define WRITEBUFFERSIZE (8192)
#define MAXFILENAME (256)
72,11 → 74,11
QString FileUnzip::getFile(QString name)
{
QString pwd = QDir::currentDirPath();
QString outDir = zipFile.left(zipFile.findRev("/") + 1);
QString outDir = ScPaths::getTempFileDir();
QFile f(outDir);
QFileInfo fi(f);
if (!fi.isWritable())
outDir = QDir::homeDirPath() + "/.scribus/";
outDir = ScPaths::getApplicationDataDir();
QDir::setCurrent(outDir);
const char *zipfilename = zipFile.ascii();
const char *filename_to_extract = name.ascii();
/branches/Version13x/Scribus/scribus/cmykfw.cpp
191,7 → 191,7
realEx.clear();
for (uint m = 0; m < Cust.count(); ++m)
{
QString Cpfad = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus/"+Cust[m]);
QString Cpfad = QDir::convertSeparators( ScPaths::getApplicationDataDir() +Cust[m]);
QFileInfo cfi(Cpfad);
if (cfi.exists())
{
560,7 → 560,7
{
bool cus = false;
CurrSwatch.clear();
QString Cpfad = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus/"+Swatches->currentText());
QString Cpfad = QDir::convertSeparators(ScPaths::getApplicationDataDir() + Swatches->currentText());
QString pfadC = ScPaths::instance().libDir()+"swatches/";
QString pfadC2 = pfadC + "Scribus_X11.txt";
switch (n)
/branches/Version13x/Scribus/scribus/colorm.cpp
306,7 → 306,7
realEx.clear();
for (uint m = 0; m < custColSet.count(); ++m)
{
QString Cpfad = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus/"+custColSet[m]);
QString Cpfad = QDir::convertSeparators(ScPaths::getApplicationDataDir() + custColSet[m]);
QFileInfo cfi(Cpfad);
if (cfi.exists())
{
369,7 → 369,7
 
void ColorManager::saveDefaults()
{
QString Cpfad = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus/");
QString Cpfad = QDir::convertSeparators(ScPaths::getApplicationDataDir());
QString Name = LoadColSet->text();
Query* dia = new Query(this, "Name", 1, 0, tr("&Name:"), tr("Choose a Name"));
if ((Name == "Scribus Small") || (Name == "X11 RGB-Set") || (Name == "OpenOffice.org-Set")
415,7 → 415,7
bool cus = false;
LoadColSet->setText(CSets->text(id));
EditColors.clear();
QString Cpfad = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus/"+CSets->text(id));
QString Cpfad = QDir::convertSeparators(ScPaths::getApplicationDataDir()+CSets->text(id));
QString pfadC = ScPaths::instance().libDir()+"swatches/";
QString pfadC2 = pfadC + "Scribus_X11.txt";
switch (c)
/branches/Version13x/Scribus/scribus/scpaths.cpp
250,6 → 250,48
return createDirs;
}
 
QString ScPaths::getApplicationDataDir(void)
{
#if defined(_WIN32)
QString appData = getSpecialDir(CSIDL_APPDATA);
if (QDir(appData).exists())
return (appData + "/Scribus/");
#endif
return (QDir::homeDirPath() + "/.scribus/");
}
 
QString ScPaths::getUserDocumentDir(void)
{
#if defined(_WIN32)
QString userDocs = getSpecialDir(CSIDL_PERSONAL);
if (QDir(userDocs).exists())
return userDocs;
#endif
return (QDir::homeDirPath() + "/");
}
 
QString ScPaths::getTempFileDir(void)
{
#if defined(_WIN32)
QString tempPath;
WCHAR wTempPath[1024];
DWORD result = GetTempPathW(1024, wTempPath);
if ( result )
{
tempPath = QString::fromUcs2(wTempPath);
tempPath.replace( '\\', '/' );
tempPath += "/";
// GetTempPath may return Windows directory, better not use this one
// for temporary files
if (QDir(tempPath).exists() && tempPath != getSpecialDir(CSIDL_WINDOWS))
return tempPath;
}
return getApplicationDataDir();
#else
return (QDir::homeDirPath() + "/.scribus/");
#endif
}
 
QString ScPaths::getSpecialDir(int folder)
{
QString qstr;
/branches/Version13x/Scribus/scribus/pdflib.cpp
46,6 → 46,7
#include "page.h"
#include "pageitem.h"
#include "bookmwin.h"
#include "scpaths.h"
#include "scribus.h"
#include "scribuscore.h"
#include "scribusdoc.h"
4740,7 → 4741,7
{ */
if ((ext == "eps") || (ext == "pdf"))
{
QString tmpFile = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus/sc.png");
QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.png");
if (Options.RecalcPic)
{
afl = QMIN(Options.PicRes, Options.Resolution);
5076,7 → 5077,7
{
if (Options.CompressMethod == 1)
{
QString tmpFile = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus/sc.jpg");
QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.jpg");
if ((Options.UseRGB) || (Options.UseProfiles2) && (!realCMYK))
img.Convert2JPG(tmpFile, Options.Quality, false, false);
else
5102,7 → 5103,7
{
if ((Options.CompressMethod == 1) || (Options.CompressMethod == 0))
{
QString tmpFile = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus/sc.jpg");
QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.jpg");
if ((Options.UseRGB) || (Options.UseProfiles2) && (!realCMYK))
img.Convert2JPG(tmpFile, Options.Quality, false, false);
else
/branches/Version13x/Scribus/scribus/customfdialog.h
95,10 → 95,6
\param filter a mask/filter. E.g.: *.txt
\param flags combination of fdFlags, default to fdExistingFiles
*/
/*CustomFDialog(QWidget *parent, QString wDir, QString caption = "",
QString filter = "", bool preview = false,
bool existing = true, bool compress = false,
bool codec = false, bool dirOnly = false);*/
CustomFDialog(QWidget *parent, QString wDir, QString caption = "", QString filter = "",
int flags = fdExistingFiles);
~CustomFDialog();
/branches/Version13x/Scribus/scribus/scimage.cpp
6,6 → 6,7
*/
#include "scimage.h"
#include "scribus.h"
#include "scpaths.h"
#include "scribuscore.h"
#include <qtextstream.h>
#include <cassert>
2646,7 → 2647,7
return retArray;
QString tmp, BBox, tmp2;
QString ext = fi.extension(false).lower();
QString tmpFile = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus/sc.png");
QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.png");
QString picFile = QDir::convertSeparators(fn);
if ((ext == "jpg") || (ext == "jpeg"))
return retArray;
3321,7 → 3322,7
double x, y, b, h;
bool found = false;
int retg = -1;
QString tmpFile = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus/sc.png");
QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.png");
QString picFile = QDir::convertSeparators(fn);
if (ext == "pdf")
{
/branches/Version13x/Scribus/scribus/plugins/newfromtemplateplugin/nftsettings.cpp
14,7 → 14,7
{
lang = guilang;
scribusShare = ScPaths::instance().templateDir();
scribusUserHome = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus");
scribusUserHome = QDir::convertSeparators(ScPaths::getApplicationDataDir());
userTemplateDir = templateDir;
if (userTemplateDir.right(1) == "/")
userTemplateDir = userTemplateDir.left(userTemplateDir.length() - 1);
/branches/Version13x/Scribus/scribus/plugins/short-words/version.h
19,8 → 19,8
#ifndef _SCRIBUS_SHORTVER_H_
#define _SCRIBUS_SHORTVER_H_
 
#define RC_PATH QDir::convertSeparators( ScPaths::instance().shareDir() + "/plugins/scribus-short-words.rc")
#define RC_PATH_USR QDir::homeDirPath() + QDir::convertSeparators("/.scribus/scribus-short-words.rc")
#define RC_PATH QDir::convertSeparators(ScPaths::instance().shareDir() + "/plugins/scribus-short-words.rc")
#define RC_PATH_USR QDir::convertSeparators(ScPaths::getApplicationDataDir() + "/scribus-short-words.rc")
 
#define UNBREAKABLE_SPACE QString(QChar(29))
#define SPACE QChar(' ')
/branches/Version13x/Scribus/scribus/plugins/saveastemplateplugin/satemplate.cpp
11,6 → 11,7
#include "satemplate.moc"
#include "satdialog.h"
 
#include "scpaths.h"
#include "scribuscore.h"
#include "scribusdoc.h"
#include "prefsfile.h"
111,7 → 112,7
}
void MenuSAT::RunSATPlug(ScribusDoc* doc)
{
QDir templates(QDir::homeDirPath() + "/.scribus");
QDir templates(ScPaths::getApplicationDataDir());
if (!templates.exists("templates"))
{
templates.mkdir("templates");
125,7 → 126,7
QString oldCollect = dirs->get("collect", ".");
QString templatesDir = ".";
if (userTemplatesDir.isEmpty())
templatesDir = QDir::homeDirPath() + "/.scribus/templates";
templatesDir = ScPaths::getApplicationDataDir() + "templates";
else
{
if (userTemplatesDir.right(1) == "/")
/branches/Version13x/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
123,8 → 123,8
paintColorSample(txtLabel, txtColor);
paintColorSample(bgLabel, bgColor);
 
tmpFile = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus/bcode.png");
psFile = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus/bcode.ps");
tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "bcode.png");
psFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "bcode.ps");
 
// PS engine
psCommand.append("%!PS-Adobe-2.0 EPSF-2.0\n");
/branches/Version13x/Scribus/scribus/scribusapp.cpp
242,7 → 242,7
langs.push_back(lang);
 
//add in user preferences lang, only overridden by lang command line option
QString Pff = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus");
QString Pff = QDir::convertSeparators(ScPaths::getApplicationDataDir());
QFileInfo Pffi = QFileInfo(Pff);
if (Pffi.exists())
{
438,7 → 438,7
 
void ScribusQApp::neverSplash(bool splashOff)
{
QString prefsDir = QDir::homeDirPath()+"/.scribus";
QString prefsDir = ScPaths::getApplicationDataDir();
QFile ns(prefsDir+"/.neversplash");
if (splashOff)
{
460,5 → 460,5
 
bool ScribusQApp::neverSplashExists()
{
return QFileInfo(QDir::homeDirPath()+"/.scribus/.neversplash").exists();
return QFileInfo(ScPaths::getApplicationDataDir() + ".neversplash").exists();
}
/branches/Version13x/Scribus/scribus/upgradechecker.cpp
12,6 → 12,7
#include <iostream>
#include <cstdlib>
 
#include "scpaths.h"
#include "upgradechecker.h"
#include "upgradechecker.moc"
#include "prefsmanager.h"
54,7 → 55,7
{
QString filename("scribusversions.xml");
//TODO fix for win32 and mac
tempFile=QDir::homeDirPath()+"/.scribus/"+filename;
tempFile=ScPaths::getTempFileDir()+filename;
 
fin=false;
/branches/Version13x/Scribus/scribus/gsutil.cpp
306,7 → 306,7
{
QString tmp, cmd1, cmd2;
QString pdfFile = QDir::convertSeparators(fn);
QString tmpFile = QDir::convertSeparators(QDir::homeDirPath()+"/.scribus/sc.png");
QString tmpFile = QDir::convertSeparators(ScPaths::getTempFileDir() + "sc.png");
QPixmap pm;
int ret = -1;
tmp.setNum(Page);