本文整理汇总了C++中PrefsContext::getTable方法的典型用法代码示例。如果您正苦于以下问题:C++ PrefsContext::getTable方法的具体用法?C++ PrefsContext::getTable怎么用?C++ PrefsContext::getTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PrefsContext
的用法示例。
在下文中一共展示了PrefsContext::getTable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: callGS
int callGS(const QString& args_in, const QString device)
{
PrefsManager* prefsManager=PrefsManager::instance();
QString cmd1 = getShortPathName(prefsManager->ghostscriptExecutable());
cmd1 += " -q -dNOPAUSE -dQUIET -dPARANOIDSAFER -dBATCH";
// Choose rendering device
if (!device.isEmpty())
// user specified device
cmd1 += " -sDEVICE="+device;
else if (!ScCore->havePNGAlpha())
cmd1 += " -sDEVICE=png16m";
else
cmd1 += " -sDEVICE=pngalpha";
// and antialiasing
if (prefsManager->appPrefs.extToolPrefs.gs_AntiAliasText)
cmd1 += " -dTextAlphaBits=4";
if (prefsManager->appPrefs.extToolPrefs.gs_AntiAliasGraphics)
cmd1 += " -dGraphicsAlphaBits=4";
// Add any extra font paths being used by Scribus to gs's font search path
PrefsContext *pc = PrefsManager::instance()->prefsFile->getContext("Fonts");
PrefsTable *extraFonts = pc->getTable("ExtraFontDirs");
#ifndef _WIN32
if (extraFonts->getRowCount() >= 1)
cmd1 += QString(" -sFONTPATH='%1'").arg(extraFonts->get(0,0));
for (int i = 1; i < extraFonts->getRowCount(); ++i)
cmd1 += QString(":'%1'").arg(extraFonts->get(i,0));
#else
if (extraFonts->getRowCount() >= 1)
cmd1 += QString(" -sFONTPATH=\"%1\"").arg(extraFonts->get(0,0));
for (int i = 1; i < extraFonts->getRowCount(); ++i)
cmd1 += QString(";\"%1\"").arg(extraFonts->get(i,0));
#endif
// then add any user specified args and run gs
cmd1 += " " + args_in + " -c showpage";
// qDebug("Calling gs as: %s", cmd1.ascii());
return system(cmd1.toLocal8Bit().constData());
}
示例2: SavePlugPrefs
void ScripterCore::SavePlugPrefs()
{
PrefsContext* prefs = PrefsManager::instance()->prefsFile->getPluginContext("scriptplugin");
if (!prefs)
{
qDebug("scriptplugin: Unable to load prefs");
return;
}
PrefsTable* prefRecentScripts = prefs->getTable("recentscripts");
if (!prefRecentScripts)
{
qDebug("scriptplugin: Unable to get recent scripts");
return;
}
for (int i = 0; i < RecentScripts.count(); i++)
{
prefRecentScripts->set(i, 0, RecentScripts[i]);
}
// then save more general preferences
prefs->set("extensionscripts", m_enableExtPython);
prefs->set("importall", m_importAllNames);
prefs->set("startupscript", m_startupScript);
}
示例3: ReadPlugPrefs
void ScripterCore::ReadPlugPrefs()
{
PrefsContext* prefs = PrefsManager::instance()->prefsFile->getPluginContext("scriptplugin");
if (!prefs)
{
qDebug("scriptplugin: Unable to load prefs");
return;
}
PrefsTable* prefRecentScripts = prefs->getTable("recentscripts");
if (!prefRecentScripts)
{
qDebug("scriptplugin: Unable to get recent scripts");
return;
}
// Load recent scripts from the prefs
for (int i = 0; i < prefRecentScripts->getRowCount(); i++)
SavedRecentScripts.append(prefRecentScripts->get(i,0));
// then get more general preferences
m_enableExtPython = prefs->getBool("extensionscripts",false);
m_importAllNames = prefs->getBool("importall",true);
m_startupScript = prefs->get("startupscript", QString::null);
// and have the console window set up its position
}
示例4: convert
bool EPSPlug::convert(QString fn, double x, double y, double b, double h)
{
QStringList args;
QString cmd, cmd1, cmd2, cmd3, tmp, tmp2, tmp3, tmp4;
// import.prolog do not cope with filenames containing blank spaces
// so take care that output filename does not (win32 compatibility)
QString tmpFile = getShortPathName(ScPaths::getTempFileDir())+ "/ps.out";
QString errFile = getShortPathName(ScPaths::getTempFileDir())+ "/ps.err";
QString pfad = ScPaths::instance().libDir();
QString pfad2 = QDir::toNativeSeparators(pfad + "import.prolog");
QFileInfo fi = QFileInfo(fn);
QString ext = fi.suffix().toLower();
if (progressDialog) {
progressDialog->setOverallProgress(1);
qApp->processEvents();
}
/*
// Destill the eps with ghostscript to get a clean eps file
QString cleanFile = getShortPathName(ScPaths::getTempFileDir())+ "/clean.eps";
args.append( "-q" );
args.append( "-dNOPAUSE" );
args.append( "-sDEVICE=epswrite" );
args.append( "-dBATCH" );
args.append( "-dSAFER" );
args.append( "-dDEVICEWIDTH=250000" );
args.append( "-dDEVICEHEIGHT=250000" );
args.append( QString("-sOutputFile=%1").arg(QDir::toNativeSeparators(cleanFile)) );
args.append( QDir::toNativeSeparators(fn) );
System(getShortPathName(PrefsManager::instance()->ghostscriptExecutable()), args, errFile, errFile, &cancel);
args.clear();
*/
args.append( "-q" );
args.append( "-dNOPAUSE" );
args.append( "-dNODISPLAY" );
args.append( "-dBATCH" );
args.append( "-dDELAYBIND" );
// Add any extra font paths being used by Scribus to gs's font search
// path We have to use Scribus's prefs context, not a plugin context, to
// get to the required information.
PrefsContext *pc = PrefsManager::instance()->prefsFile->getContext("Fonts");
PrefsTable *extraFonts = pc->getTable("ExtraFontDirs");
const char sep = ScPaths::envPathSeparator;
if (extraFonts->getRowCount() >= 1)
cmd = QString("-sFONTPATH=%1").arg(extraFonts->get(0,0));
for (int i = 1; i < extraFonts->getRowCount(); ++i)
cmd += QString("%1%2").arg(sep).arg(extraFonts->get(i,0));
if( !cmd.isEmpty() )
args.append( cmd );
// then finish building the command and call gs
args.append( QString("-g%1x%2").arg(tmp2.setNum(qRound((b-x)*4))).arg(tmp3.setNum(qRound((h-y)*4))) );
args.append( "-r288");
args.append( "-dTextAlphaBits=4" );
args.append( "-dGraphicsAlphaBits=4" );
args.append( "-c" );
args.append( tmp.setNum(-x) );
args.append( tmp.setNum(-y) );
args.append( "translate" );
args.append( QString("-sTraceFile=%1").arg(QDir::toNativeSeparators(tmpFile)) );
QString exportPath = m_Doc->DocName + "-" + fi.baseName();
QFileInfo exportFi(exportPath);
if ( !exportFi.isWritable() ) {
PrefsContext* docContext = PrefsManager::instance()->prefsFile->getContext("docdirs", false);
QString docDir = ".";
QString prefsDocDir=PrefsManager::instance()->documentDir();
if (!prefsDocDir.isEmpty())
docDir = docContext->get("docsopen", prefsDocDir);
else
docDir = docContext->get("docsopen", ".");
exportFi.setFile(docDir + "/" + exportFi.baseName());
}
//qDebug() << QString("using export path %1").arg(exportFi.absFilePath());
args.append( QString("-sExportFiles=%1").arg(QDir::toNativeSeparators(exportFi.absoluteFilePath())) );
args.append( pfad2 );
args.append( QDir::toNativeSeparators(fn) );
args.append( "-c" );
args.append( "flush" );
args.append( "cfile" );
args.append( "closefile" );
args.append( "quit" );
QByteArray finalCmd = args.join(" ").toLocal8Bit();
int ret = System(getShortPathName(PrefsManager::instance()->ghostscriptExecutable()), args, errFile, errFile, &cancel);
if (ret != 0 && !cancel)
{
qDebug("PostScript import failed when calling gs as: \n%s\n", finalCmd.data());
qDebug("%s", "Ghostscript diagnostics:\n");
QFile diag(errFile);
if (diag.open(QIODevice::ReadOnly) && !diag.atEnd() ) {
char buf[121];
while (diag.readLine(buf, 120) > 0) {
qDebug("\t%s", buf);
}
diag.close();
}
else {
qDebug("%s", "-- no output --");
}
if (progressDialog)
progressDialog->close();
QString mess = tr("Importing File:\n%1\nfailed!").arg(fn);
//.........这里部分代码省略.........