本文整理汇总了C++中PrefsContext::get方法的典型用法代码示例。如果您正苦于以下问题:C++ PrefsContext::get方法的具体用法?C++ PrefsContext::get怎么用?C++ PrefsContext::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PrefsContext
的用法示例。
在下文中一共展示了PrefsContext::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: restoreDefaults
void Prefs_Printer::restoreDefaults(struct ApplicationPrefs *prefsData)
{
int docUnitIndex = prefsData->docSetupPrefs.docUnitIndex;
unitChange(docUnitIndex);
double unitRatio = unitGetRatioFromIndex(docUnitIndex);
QString Pcap;
QString printerName;
QStringList printerNames = PrinterUtil::getPrinterNames();
int numPrinters = printerNames.count();
for( int i = 0; i < numPrinters; i++)
{
printerName = printerNames[i];
destinationComboBox->addItem(printerName);
}
destinationComboBox->addItem( tr("File"));
PrefsContext* prefs = PrefsManager::instance()->prefsFile->getContext("print_options");
QString selectedDest = prefs->get("CurrentPrn", "");
int prnIndex = destinationComboBox->findText(selectedDest);
if ((prnIndex > -1) && (prnIndex < destinationComboBox->count()))
destinationComboBox->setCurrentIndex(prnIndex);
useAltPrinterCmdCheckBox->setChecked(prefs->getBool("OtherCom", false));
selOtherComm();
altPrinterCmdLineEdit->setText(prefs->get("Command", ""));
bool iccInUse = prefs->getBool("ICCinUse", false);
bool psPrinter = PrinterUtil::isPostscriptPrinter(destinationComboBox->currentText());
applyICCProfilesCheckBox->setChecked( psPrinter ? iccInUse : false );
applyICCProfilesCheckBox->setEnabled( psPrinter );
outputComboBox->setCurrentIndex(prefs->getInt("Separations", 0));
postscriptPrintToColorComboBox->setCurrentIndex(prefs->getInt("PrintColor", 0));
postscriptLevelComboBox->setCurrentIndex(prefs->getInt("PSLevel", 3)-1);
pageMirrorHorizontallyCheckBox->setChecked(prefs->getBool("MirrorH", false));
pageMirrorVerticallyCheckBox->setChecked(prefs->getBool("MirrorV", false));
setMediaSizeCheckBox->setChecked(prefs->getBool("doDev", false));
applyUnderColorRemovalCheckBox->setChecked(prefs->getBool("DoGCR", false));
clipToPrinterMarginsCheckBox->setChecked(prefs->getBool("Clip", false));
convertSpotsToProcessCheckBox->setChecked(!prefs->getBool("doSpot", true));
MarginStruct bleeds;
bleeds.set(prefs->getDouble("BleedTop",0.0),
prefs->getDouble("BleedBottom", 0.0),
prefs->getDouble("BleedRight", 0.0),
prefs->getDouble("BleedLeft", 0.0));
bleedsWidget->setup(bleeds, 0, docUnitIndex, false, false);
bleedsWidget->setPageWidth(prefsData->docSetupPrefs.pageWidth);
bleedsWidget->setPageHeight(prefsData->docSetupPrefs.pageHeight);
markLengthSpinBox->setValue(prefs->getDouble("markLength", 20.0) * unitRatio);
markOffsetSpinBox->setValue(prefs->getDouble("markOffset", 0.0) * unitRatio);
cropMarksCheckBox->setChecked(prefs->getBool("cropMarks", false));
bleedMarksCheckBox->setChecked(prefs->getBool("bleedMarks", false));
registrationMarksCheckBox->setChecked(prefs->getBool("registrationMarks", false));
colorBarsCheckBox->setChecked(prefs->getBool("colorMarks", false));
includePDFAnnotationsCheckBox->setChecked(prefs->getBool("includePDFMarks", true));
}
示例2: 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++)
{
QString rs(prefRecentScripts->get(i,0));
SavedRecentScripts.append(rs);
}
// 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
}
示例3: loadGradients
void gradientManagerDialog::loadGradients()
{
QString fileName;
QString allFormats = tr("All Supported Formats")+" (";
allFormats += "*.sgr *.SGR";
allFormats += " *.ggr *.GGR";
allFormats += ");;";
QString formats = tr("Scribus Gradient Files \"*.sgr\" (*.sgr *.SGR);;");
formats += tr("Gimp Gradient Files \"*.ggr\" (*.ggr *.GGR);;");
formats += tr("All Files (*)");
allFormats += formats;
PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
QString wdir = dirs->get("gradients", ".");
CustomFDialog dia(this, wdir, tr("Open"), allFormats, fdHidePreviewCheckBox | fdExistingFiles);
if (dia.exec() == QDialog::Accepted)
fileName = dia.selectedFile();
else
return;
if (!fileName.isEmpty())
{
PrefsManager::instance()->prefsFile->getContext("dirs")->set("gradients", fileName.left(fileName.lastIndexOf("/")));
QFileInfo fi(fileName);
QString ext = fi.suffix().toLower();
if (ext == "sgr")
loadScribusFormat(fileName);
else if (ext == "ggr")
loadGimpFormat(fileName);
updateGradientList();
}
}
示例4: print
bool ScPrintEngine_GDI::print( ScribusDoc& doc, PrintOptions& options )
{
bool toFile;
bool success;
HDC printerDC;
QString diaSelection, docDir, prefsDocDir;
QString printerName = options.printer;
QByteArray devMode = options.devMode;
QString fileName;
if( options.toFile )
return false;
resetData();
toFile = printerUseFilePort( options.printer );
if ( toFile )
{
diaSelection = doc.DocName.right( doc.DocName.length() - doc.DocName.lastIndexOf("/") - 1 );
diaSelection = diaSelection.left( diaSelection.indexOf(".") );
diaSelection += ".prn";
PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
QString prefsDocDir = PrefsManager::instance()->documentDir();
if (!prefsDocDir.isEmpty())
docDir = dirs->get("winprn", prefsDocDir);
else
docDir = ".";
CustomFDialog dia( doc.scMW()->view, docDir, QObject::tr("Save As"), "Spool Files (*.prn *.ps);;All Files (*)", fdNone);
dia.setSelection( diaSelection );
if (dia.exec() == QDialog::Accepted)
{
QString selectedFile = dia.selectedFile();
if ( overwrite(doc.scMW()->view, selectedFile) )
{
dirs->set("winprn", selectedFile.left(selectedFile.lastIndexOf("/")));
fileName = QDir::toNativeSeparators( selectedFile );
}
}
else
return true;
}
// Set user options in the DEVmode structure
setDeviceParams( &doc, options, (DEVMODEW*) devMode.data() );
// Create the device context
printerDC = CreateDCW( NULL, (LPCWSTR) printerName.utf16(), NULL, (DEVMODEW*) devMode.data() );
if( printerDC )
{
success = printPages( &doc, options, printerDC, (DEVMODEW*) devMode.data(), fileName);
DeleteDC( printerDC );
}
else
{
qWarning("doPrintPages : the device context could not be created");
success = false;
}
return success;
}
示例5: createOpenDocPage
void NewDoc::createOpenDocPage()
{
PrefsContext* docContext = prefsManager->prefsFile->getContext("docdirs", false);
QString docDir = ".";
QString prefsDocDir=prefsManager->documentDir();
if (!prefsDocDir.isEmpty())
docDir = docContext->get("docsopen", prefsDocDir);
else
docDir = docContext->get("docsopen", ".");
QString formats(FileLoader::getLoadFilterString());
// formats.remove("PDF (*.pdf *.PDF);;");
openDocFrame = new QFrame(this);
openDocLayout = new QVBoxLayout(openDocFrame);
openDocLayout->setMargin(5);
openDocLayout->setSpacing(5);
m_selectedFile = "";
fileDialog = new QFileDialog(openDocFrame, tr("Open"), docDir, formats);
fileDialog->setFileMode(QFileDialog::ExistingFile);
fileDialog->setAcceptMode(QFileDialog::AcceptOpen);
fileDialog->setOption(QFileDialog::DontUseNativeDialog);
fileDialog->setNameFilterDetailsVisible(false);
fileDialog->setReadOnly(true);
fileDialog->setSizeGripEnabled(false);
fileDialog->setModal(false);
QList<QPushButton *> b = fileDialog->findChildren<QPushButton *>();
QListIterator<QPushButton *> i(b);
while (i.hasNext())
i.next()->setVisible(false);
fileDialog->setWindowFlags(Qt::Widget);
openDocLayout->addWidget(fileDialog);
FileDialogEventCatcher* keyCatcher = new FileDialogEventCatcher(this);
QList<QListView *> lv = fileDialog->findChildren<QListView *>();
QListIterator<QListView *> lvi(lv);
while (lvi.hasNext())
lvi.next()->installEventFilter(keyCatcher);
connect(keyCatcher, SIGNAL(escapePressed()), this, SLOT(reject()));
connect(keyCatcher, SIGNAL(dropLocation(QString)), this, SLOT(locationDropped(QString)));
connect(keyCatcher, SIGNAL(desktopPressed()), this, SLOT(gotoDesktopDirectory()));
connect(keyCatcher, SIGNAL(homePressed()), this, SLOT(gotoHomeDirectory()));
connect(keyCatcher, SIGNAL(parentPressed()), this, SLOT(gotoParentDirectory()));
connect(keyCatcher, SIGNAL(enterSelectedPressed()), this, SLOT(gotoSelectedDirectory()));
connect(fileDialog, SIGNAL(filesSelected(const QStringList &)), this, SLOT(openFile()));
connect(fileDialog, SIGNAL(rejected()), this, SLOT(reject()));
}
示例6: exportKeySetFile
void Prefs_KeyboardShortcuts::exportKeySetFile()
{
PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
QString currentPath= dirs->get("keymapprefs_export", ".");
QString s = QFileDialog::getSaveFileName(this, tr("Select a Key set file to save to"), currentPath, tr("Key Set XML Files (*.xml)") );
if (!s.isEmpty())
exportKeySet(s);
}
示例7: importKeySetFile
void Prefs_KeyboardShortcuts::importKeySetFile()
{
PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
QString currentPath = dirs->get("keymapprefs_import", ScPaths::instance().shareDir() + "keysets/");
QString s = QFileDialog::getOpenFileName(this, tr("Select a Key set file to read"), currentPath, tr("Key Set XML Files (*.xml)"));
if (!s.isEmpty())
importKeySet(s);
}
示例8: RunSATPlug
void MenuSAT::RunSATPlug(ScribusDoc* doc)
{
QDir templates(ScPaths::getApplicationDataDir());
if (!templates.exists("templates"))
{
templates.mkdir("templates");
}
QString currentPath(QDir::currentPath());
QString currentFile(doc->DocName);
bool hasName = doc->hasName;
bool isModified = doc->isModified();
QString userTemplatesDir = PrefsManager::instance()->appPrefs.pathPrefs.documentTemplates;
PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
QString oldCollect = dirs->get("collect", ".");
QString templatesDir = ".";
if (userTemplatesDir.isEmpty())
templatesDir = ScPaths::getApplicationDataDir() + "templates";
else
{
if (userTemplatesDir.right(1) == "/")
userTemplatesDir.chop(1);
templatesDir = userTemplatesDir;
}
dirs->set("collect", templatesDir);
if (doc->scMW()->fileCollect().isEmpty())
return;
if (oldCollect != ".")
dirs->set("collect", oldCollect);
QString docPath = doc->DocName;
QString docDir = docPath.left(docPath.lastIndexOf('/'));
QString docName = docPath.right(docPath.length() - docPath.lastIndexOf('/') - 1);
docName = docName.left(docName.lastIndexOf(".s"));
if (currentFile != doc->DocName)
{
SATDialog* satdia = new SATDialog(doc->scMW(),docName,
static_cast<int>(doc->pageWidth() + 0.5),
static_cast<int>(doc->pageHeight() + 0.5));
if (satdia->exec())
{
sat* s = new sat(doc, satdia, docPath.right(docPath.length() - docPath.lastIndexOf('/') - 1),docDir);
s->createImages();
s->createTmplXml();
delete s;
}
// Restore the state that was before ScMW->Collect()
doc->DocName = currentFile;
doc->hasName = hasName;
doc->setModified(isModified);
QString newCaption=currentFile;
if (isModified)
newCaption.append('*');
doc->scMW()->updateActiveWindowCaption(newCaption);
doc->scMW()->removeRecent(docPath);
QDir::setCurrent(currentPath);
delete satdia;
}
}
示例9: ChangeFile
void PDFExportDialog::ChangeFile()
{
PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
QString wdir = dirs->get("pdf", ".");
QString d = QFileDialog::getSaveFileName(this, tr("Save As"), wdir, tr("PDF Files (*.pdf);;All Files (*)"), 0, QFileDialog::DontConfirmOverwrite);
if (d.length()>0)
{
QString fn(QDir::fromNativeSeparators(d));
dirs->set("pdf", fn.left(fn.lastIndexOf("/")));
fileNameLineEdit->setText( d );
}
}
示例10: import
bool WMFImportPlugin::import(QString filename, int flags)
{
if (!checkFlags(flags))
return false;
if (m_Doc == nullptr)
m_Doc = ScCore->primaryMainWindow()->doc;
ScribusMainWindow* mw=(m_Doc==nullptr) ? ScCore->primaryMainWindow() : m_Doc->scMW();
if (filename.isEmpty())
{
flags |= lfInteractive;
PrefsContext* prefs = PrefsManager::instance()->prefsFile->getPluginContext("WMFPlugin");
QString wdir = prefs->get("wdir", ".");
CustomFDialog diaf(mw, wdir, QObject::tr("Open"), FormatsManager::instance()->fileDialogFormatList(FormatsManager::WMF));
if (diaf.exec())
{
filename = diaf.selectedFile();
prefs->set("wdir", filename.left(filename.lastIndexOf("/")));
}
else
return true;
}
bool hasCurrentPage = (m_Doc && m_Doc->currentPage());
TransactionSettings trSettings;
trSettings.targetName = hasCurrentPage ? m_Doc->currentPage()->getUName() : "";
trSettings.targetPixmap = Um::IImageFrame;
trSettings.actionName = Um::ImportWMF;
trSettings.description = filename;
trSettings.actionPixmap = Um::IWMF;
UndoTransaction activeTransaction;
if ((m_Doc == nullptr) || !(flags & lfInteractive) || !(flags & lfScripted))
UndoManager::instance()->setUndoEnabled(false);
if (UndoManager::undoEnabled())
activeTransaction = UndoManager::instance()->beginTransaction(trSettings);
WMFImport *dia = new WMFImport(m_Doc, flags);
dia->import(filename, trSettings, flags);
Q_CHECK_PTR(dia);
if (activeTransaction)
activeTransaction.commit();
if ((m_Doc == nullptr) || !(flags & lfInteractive) || !(flags & lfScripted))
UndoManager::instance()->setUndoEnabled(true);
if (dia->importCanceled)
{
if (dia->importFailed)
ScMessageBox::warning(mw, CommonStrings::trWarning, tr("The file could not be imported"));
else if (dia->unsupported)
ScMessageBox::warning(mw, CommonStrings::trWarning, tr("WMF file contains some unsupported features"));
}
bool success = !dia->importFailed;
delete dia;
return success;
}
示例11: createOpenDocPage
void NewDoc::createOpenDocPage()
{
PrefsContext* docContext = prefsManager->prefsFile->getContext("docdirs", false);
QString docDir = ".";
QString prefsDocDir=prefsManager->documentDir();
if (!prefsDocDir.isEmpty())
docDir = docContext->get("docsopen", prefsDocDir);
else
docDir = docContext->get("docsopen", ".");
QString formats(FileLoader::getLoadFilterString());
formats.remove("PDF (*.pdf *.PDF);;");
openDocFrame = new QFrame(this);
openDocLayout = new QVBoxLayout(openDocFrame);
openDocLayout->setMargin(5);
openDocLayout->setSpacing(5);
m_selectedFile = "";
#if QT_VERSION >= 0x040300
fileDialog = new QFileDialog(openDocFrame, tr("Open"), docDir, formats);
fileDialog->setFileMode(QFileDialog::ExistingFile);
fileDialog->setAcceptMode(QFileDialog::AcceptOpen);
fileDialog->setReadOnly(true);
#else
fileDialog = new CustomFDialog(openDocFrame, docDir, tr("Open"), formats, fdNone);
#endif
fileDialog->setSizeGripEnabled(false);
fileDialog->setModal(false);
QList<QPushButton *> b = fileDialog->findChildren<QPushButton *>();
QListIterator<QPushButton *> i(b);
while (i.hasNext())
i.next()->setVisible(false);
fileDialog->setWindowFlags(Qt::Widget);
openDocLayout->addWidget(fileDialog);
#if QT_VERSION >= 0x040300
connect(fileDialog, SIGNAL(filesSelected(const QStringList &)), this, SLOT(openFile()));
#else
connect(fileDialog, SIGNAL(fileSelected (const QString &)), this, SLOT(openFile()));
#endif
}
示例12: import
bool ImportXfigPlugin::import(QString fileName, int flags)
{
if (!checkFlags(flags))
return false;
if( fileName.isEmpty() )
{
flags |= lfInteractive;
PrefsContext* prefs = PrefsManager::instance()->prefsFile->getPluginContext("importxfig");
QString wdir = prefs->get("wdir", ".");
CustomFDialog diaf(ScCore->primaryMainWindow(), wdir, QObject::tr("Open"), tr("All Supported Formats")+" (*.fig *.FIG);;All Files (*)");
if (diaf.exec())
{
fileName = diaf.selectedFile();
prefs->set("wdir", fileName.left(fileName.lastIndexOf("/")));
}
else
return true;
}
m_Doc=ScCore->primaryMainWindow()->doc;
UndoTransaction* activeTransaction = NULL;
bool emptyDoc = (m_Doc == NULL);
bool hasCurrentPage = (m_Doc && m_Doc->currentPage());
TransactionSettings trSettings;
trSettings.targetName = hasCurrentPage ? m_Doc->currentPage()->getUName() : "";
trSettings.targetPixmap = Um::IImageFrame;
trSettings.actionName = Um::ImportXfig;
trSettings.description = fileName;
trSettings.actionPixmap = Um::IXFIG;
if (emptyDoc || !(flags & lfInteractive) || !(flags & lfScripted))
UndoManager::instance()->setUndoEnabled(false);
if (UndoManager::undoEnabled())
activeTransaction = new UndoTransaction(UndoManager::instance()->beginTransaction(trSettings));
XfigPlug *dia = new XfigPlug(m_Doc, flags);
Q_CHECK_PTR(dia);
dia->import(fileName, trSettings, flags);
if (activeTransaction)
{
activeTransaction->commit();
delete activeTransaction;
activeTransaction = NULL;
}
if (emptyDoc || !(flags & lfInteractive) || !(flags & lfScripted))
UndoManager::instance()->setUndoEnabled(true);
delete dia;
return true;
}
示例13: ChangeFile
void PDFExportDialog::ChangeFile()
{
QString fn;
PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
QString wdir = dirs->get("pdf", ".");
CustomFDialog dia(this, wdir, tr("Save As"), tr("PDF Files (*.pdf);;All Files (*)"), fdNone);
if (!fileNameLineEdit->text().isEmpty())
{
QString fileName = QDir::fromNativeSeparators(fileNameLineEdit->text());
dia.setSelection(fileName);
}
if (dia.exec() == QDialog::Accepted)
{
// selectedFile() may return path with native separators
fn = QDir::fromNativeSeparators(dia.selectedFile());
dirs->set("pdf", fn.left(fn.lastIndexOf("/")));
fileNameLineEdit->setText( QDir::toNativeSeparators(fn) );
}
}
示例14: import
bool ImportPSPlugin::import(QString fileName, int flags)
{
if (!checkFlags(flags))
return false;
if( fileName.isEmpty() )
{
flags |= lfInteractive;
PrefsContext* prefs = PrefsManager::instance()->prefsFile->getPluginContext("importps");
QString wdir = prefs->get("wdir", ".");
CustomFDialog diaf(ScCore->primaryMainWindow(), wdir, QObject::tr("Open"), FormatsManager::instance()->fileDialogFormatList(FormatsManager::EPS|FormatsManager::PS));
if (diaf.exec())
{
fileName = diaf.selectedFile();
prefs->set("wdir", fileName.left(fileName.lastIndexOf("/")));
}
else
return true;
}
m_Doc=ScCore->primaryMainWindow()->doc;
UndoTransaction activeTransaction;
bool emptyDoc = (m_Doc == nullptr);
bool hasCurrentPage = (m_Doc && m_Doc->currentPage());
TransactionSettings trSettings;
trSettings.targetName = hasCurrentPage ? m_Doc->currentPage()->getUName() : "";
trSettings.targetPixmap = Um::IImageFrame;
trSettings.actionName = Um::ImportEPS;
trSettings.description = fileName;
trSettings.actionPixmap = Um::IEPS;
if (emptyDoc || !(flags & lfInteractive) || !(flags & lfScripted))
UndoManager::instance()->setUndoEnabled(false);
if (UndoManager::undoEnabled())
activeTransaction = UndoManager::instance()->beginTransaction(trSettings);
EPSPlug *dia = new EPSPlug(m_Doc, flags);
Q_CHECK_PTR(dia);
dia->import(fileName, trSettings, flags);
if (activeTransaction)
activeTransaction.commit();
if (emptyDoc || !(flags & lfInteractive) || !(flags & lfScripted))
UndoManager::instance()->setUndoEnabled(true);
delete dia;
return true;
}
示例15: runFileDialog
bool gtDialogs::runFileDialog(const QString& filters, const QStringList& importers)
{
bool accepted = false;
PrefsContext* dirs = PrefsManager::instance()->prefsFile->getContext("dirs");
QString dir = dirs->get("get_text", ".");
fdia = new gtFileDialog(filters, importers, dir);
if (fdia->exec() == QDialog::Accepted)
{
fileName = fdia->selectedFile();
if (!fileName.isEmpty())
accepted = true;
encoding = fdia->encodingCombo->currentText();
// if (encoding == "UTF-16")
// encoding = "ISO-10646-UCS-2";
importer = fdia->importerCombo->currentIndex() - 1;
dirs->set("get_text", fileName.left(fileName.lastIndexOf("/")));
}
QDir::setCurrent(pwd);
return accepted;
}