本文整理汇总了C++中KConfigGroup::readEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ KConfigGroup::readEntry方法的具体用法?C++ KConfigGroup::readEntry怎么用?C++ KConfigGroup::readEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KConfigGroup
的用法示例。
在下文中一共展示了KConfigGroup::readEntry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configChanged
void nuclearCalculator::configChanged()
{
KConfigGroup cg = config();
m_massOnly = cg.readEntry("massOnly",true);
}
示例2: createDatabase
RecipeDB* RecipeDB::createDatabase()
{
KConfigGroup config = KGlobal::config()->group( "DBType" );
QString dbType = config.readEntry( "Type", "" );
return createDatabase( dbType );
}
示例3: restore
bool RecipeDB::restore( const QString &file, QString *errMsg )
{
kDebug();
m_dumpFile = KFilterDev::deviceForFile(file,"application/x-gzip");
if ( m_dumpFile->open( QIODevice::ReadOnly ) ) {
m_dumpFile->setTextModeEnabled( true );
QString firstLine = QString::fromUtf8(m_dumpFile->readLine()).trimmed();
QString dbVersion = QString::fromUtf8(m_dumpFile->readLine()).trimmed();
dbVersion = dbVersion.right( dbVersion.length() - dbVersion.indexOf(":") - 2 );
if ( qRound(dbVersion.toDouble()*1e5) > qRound(latestDBVersion()*1e5) ) { //correct for float's imprecision
if ( errMsg ) *errMsg = i18n( "This backup was created with a newer version of Krecipes and cannot be restored." );
delete m_dumpFile;
return false;
}
KConfigGroup config = KGlobal::config()->group( "DBType" );
QString dbType = QString::fromUtf8(m_dumpFile->readLine()).trimmed();
dbType = dbType.right( dbType.length() - dbType.indexOf(":") - 2 );
if ( dbType.isEmpty() || !firstLine.startsWith("-- Generated for Krecipes") ) {
if ( errMsg ) *errMsg = i18n("This file is not a Krecipes backup file or has become corrupt.");
delete m_dumpFile;
return false;
}
else if ( dbType != config.readEntry("Type",QString()) ) {
if ( errMsg ) *errMsg = i18n("This backup was created using the \"%1\" backend. It can only be restored into a database using this backend." ,dbType);
delete m_dumpFile;
return false;
}
process = new KProcess;
QStringList command = restoreCommand();
kDebug()<<"Restoring backup using: "<<command[0];
*process << command;
QApplication::connect( process, SIGNAL(started()), this, SLOT(processStarted()) );
QApplication::connect( process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(processError(QProcess::ProcessError)) );
QApplication::connect( process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processFinished(int,QProcess::ExitStatus)) );
m_processStarted = false;
m_processFinished = false;
m_processError = false;
m_operationHalted = false;
emit progressBegin(0,QString(),
QString("<center><b>%1</b></center>%2")
.arg(i18nc("@info:progress", "Restoring backup"))
.arg(i18n("Depending on the number of recipes and amount of data, this could take some time.")),50);
process->start();
m_localEventLoop = new QEventLoop;
m_localEventLoop->exec();
if ( m_processError && !m_processStarted ) {
if ( errMsg ) *errMsg = i18n("Unable to find or run the program '%1'. Either it is not installed on your system or it is not in $PATH.",
command.first());
delete m_localEventLoop;
delete process;
process = NULL;
delete m_dumpFile;
emit progressDone();
return false;
}
//We have to first wipe the database structure. Note that if we load a dump
//with from a previous version of Krecipes, the difference in structure
// wouldn't allow the data to be inserted. This remains forward-compatibity
//by loading the old schema and then porting it to the current version.
kDebug()<<"Wiping database...";
empty(); //the user had better be warned!
kDebug()<<"Database wiped.";
kDebug()<<"Reading backup file...";
m_timer = new QTimer;
QApplication::connect( m_timer, SIGNAL(timeout()), this, SLOT(processReadDump()) );
m_timer->start();
m_localEventLoop->exec();
delete m_timer;
kDebug()<<"Done.";
//Since the process will exit when all stdin has been sent and processed,
//just loop until the process is no longer running. If something goes
//wrong, the user can still hit cancel.
process->closeWriteChannel();
if (!m_processFinished && !m_processError) {
kDebug()<<"Waiting for process exit...";
m_localEventLoop->exec();
}
delete m_localEventLoop;
delete process;
process = NULL;
emit progressDone();
//Since we just loaded part of a file, the database won't be in a usable state.
//We'll wipe out the database structure and recreate it, leaving no data.
if ( haltOperation ) {
haltOperation=false;
empty();
//.........这里部分代码省略.........
示例4: saveElement
}
return true;
}
void KrePropertyActionsHandler::saveElement( const QModelIndex & topLeft,
const QModelIndex & bottomRight )
{
//Not used parameters.
Q_UNUSED( bottomRight )
if ( topLeft.column() == 3 ) {
KConfigGroup config = KGlobal::config()->group("Formatting");
config.sync();
QStringList hiddenList = config.readEntry("HiddenProperties", QStringList());
QString propName = m_listWidget->getData( topLeft.row(), 1 ).toString();
if ( m_listWidget->getItem( topLeft.row(), topLeft.column() )->checkState() == Qt::Checked ) {
hiddenList.removeAll( propName );
} else if ( !hiddenList.contains(propName) ) {
hiddenList.append( propName );
}
config.writeEntry( "HiddenProperties", hiddenList );
} else {
//Revert the changed text if the new name is longer than the maximum length.
QString newPropName = topLeft.data().toString();
if ( !checkBounds(newPropName) ) {
m_listWidget->reload( ForceReload ); //reset the changed text
return ;
}
示例5: loadState
void SyndicationTab::loadState(KConfigGroup & g)
{
splitter->restoreState(g.readEntry("ver_splitter",QByteArray()));
}
示例6: main
int main(int argc, char *argv[])
{
KCmdLineArgs::init(argc, argv, appName, "kscreensaver", ki18n("Random screen saver"),
KDE_VERSION_STRING, ki18n(description));
KCmdLineOptions options;
options.add("setup", ki18n("Setup screen saver"));
options.add("window-id wid", ki18n("Run in the specified XWindow"));
options.add("root", ki18n("Run in the root XWindow"));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
WId windowId = 0;
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->isSet("setup"))
{
KRandomSetup setup;
setup.exec();
exit(0);
}
if (args->isSet("window-id"))
{
windowId = args->getOption("window-id").toInt();
}
#ifdef Q_WS_X11
if (args->isSet("root"))
{
QX11Info info;
windowId = RootWindow(QX11Info::display(), info.screen());
}
#endif
args->clear();
const KService::List lst = KServiceTypeTrader::self()->query( "ScreenSaver");
KService::List availableSavers;
KConfig type("krandom.kssrc", KConfig::NoGlobals);
const KConfigGroup configGroup = type.group("Settings");
const bool opengl = configGroup.readEntry("OpenGL", false);
const bool manipulatescreen = configGroup.readEntry("ManipulateScreen", false);
// TODO replace this with TryExec=fortune in the desktop files
const bool fortune = !KStandardDirs::findExe("fortune").isEmpty();
foreach( const KService::Ptr& service, lst ) {
//QString file = KStandardDirs::locate("services", service->entryPath());
//kDebug() << "Looking at " << file;
const QString saverType = service->property("X-KDE-Type").toString();
foreach (const QString &type, saverType.split(QLatin1Char(';'))) {
//kDebug() << "saverTypes is "<< type;
if (type == QLatin1String("ManipulateScreen")) {
if (!manipulatescreen)
goto fail;
} else if (type == QLatin1String("OpenGL")) {
if (!opengl)
goto fail;
} else if (type == QLatin1String("Fortune")) {
if (!fortune)
goto fail;
}
}
availableSavers.append(service);
fail: ;
}
KRandomSequence rnd;
const int indx = rnd.getLong(availableSavers.count());
const KService::Ptr service = availableSavers.at(indx);
const QList<KServiceAction> actions = service->actions();
QString cmd;
if (windowId)
cmd = exeFromActionGroup(actions, "InWindow");
if (cmd.isEmpty() && windowId == 0)
cmd = exeFromActionGroup(actions, "Root");
if (cmd.isEmpty())
cmd = service->exec();
QHash<QChar, QString> keyMap;
keyMap.insert('w', QString::number(windowId));
const QStringList words = KShell::splitArgs(KMacroExpander::expandMacrosShellQuote(cmd, keyMap));
if (!words.isEmpty()) {
QString exeFile = KStandardDirs::findExe(words.first());
if (!exeFile.isEmpty()) {
char **sargs = new char *[words.size() + 1];
int i = 0;
for (; i < words.size(); i++)
sargs[i] = qstrdup(words[i].toLocal8Bit().constData());
sargs[i] = 0;
execv(exeFile.toLocal8Bit(), sargs);
}
}
//.........这里部分代码省略.........
示例7: QDateTime
void KNode::Cleanup::loadConfig(const KConfigGroup &conf)
{
// group expire settings
d_oExpire = conf.readEntry( "doExpire", true );
r_emoveUnavailable = conf.readEntry( "removeUnavailable", true );
p_reserveThr = conf.readEntry( "saveThreads", true );
e_xpireInterval = conf.readEntry( "expInterval", 5 );
r_eadMaxAge = conf.readEntry( "readDays", 10 );
u_nreadMaxAge = conf.readEntry( "unreadDays", 15 );
mLastExpDate = conf.readEntry( "lastExpire", QDateTime() ).date();
// folder compaction settings (only available globally)
if (mGlobal) {
d_oCompact = conf.readEntry( "doCompact", true );
c_ompactInterval = conf.readEntry( "comInterval", 5 );
mLastCompDate = conf.readEntry( "lastCompact", QDateTime() ).date();
}
if (!mGlobal)
mDefault = conf.readEntry( "UseDefaultExpConf", true );
}
示例8: readSettings
void SettingsWidget::readSettings(KConfigGroup& group)
{
d->settingsExpander->readSettings(group);
int useTimestampType = group.readEntry("Use Timestamp Type", (int)TimeAdjustSettings::APPDATE);
if (useTimestampType == TimeAdjustSettings::APPDATE) d->useApplDateBtn->setChecked(true);
else if (useTimestampType == TimeAdjustSettings::FILEDATE) d->useFileDateBtn->setChecked(true);
else if (useTimestampType == TimeAdjustSettings::METADATADATE) d->useMetaDateBtn->setChecked(true);
else if (useTimestampType == TimeAdjustSettings::CUSTOMDATE) d->useCustomDateBtn->setChecked(true);
d->useFileDateTypeChooser->setCurrentIndex(group.readEntry("File Timestamp Type", (int)TimeAdjustSettings::FILELASTMOD));
d->useMetaDateTypeChooser->setCurrentIndex(group.readEntry("Meta Timestamp Type", (int)TimeAdjustSettings::EXIFIPTCXMP));
d->useCustDateInput->setDateTime(group.readEntry("Custom Date", QDateTime::currentDateTime()));
d->useCustTimeInput->setDateTime(group.readEntry("Custom Time", QDateTime::currentDateTime()));
d->adjTypeChooser->setCurrentIndex(group.readEntry("Adjustment Type", (int)TimeAdjustSettings::COPYVALUE));
d->adjDaysInput->setValue(group.readEntry("Adjustment Days", 0));
d->adjTimeInput->setDateTime(group.readEntry("Adjustment Time", QDateTime()));
d->updAppDateCheck->setChecked(group.readEntry("Update Application Time", false));
d->updFileModDateCheck->setChecked(group.readEntry("Update File Modification Time", false));
d->updEXIFModDateCheck->setChecked(group.readEntry("Update EXIF Modification Time", false));
d->updEXIFOriDateCheck->setChecked(group.readEntry("Update EXIF Original Time", false));
d->updEXIFDigDateCheck->setChecked(group.readEntry("Update EXIF Digitization Time", false));
d->updEXIFThmDateCheck->setChecked(group.readEntry("Update EXIF Thumbnail Time", false));
d->updIPTCDateCheck->setChecked(group.readEntry("Update IPTC Time", false));
d->updXMPDateCheck->setChecked(group.readEntry("Update XMP Creation Time", false));
d->updFileNameCheck->setChecked(group.readEntry("Update File Name", false));
slotSrcTimestampChanged();
slotAdjustmentTypeChanged();
}
示例9: animationTime
double Effect::animationTime(const KConfigGroup& cfg, const QString& key, int defaultTime)
{
int time = cfg.readEntry(key, 0);
return time != 0 ? time : qMax(defaultTime * effects->animationTimeFactor(), 1.);
}
示例10: thumbForDirectory
QImage ThumbnailProtocol::thumbForDirectory(const QUrl& directory)
{
QImage img;
if (m_propagationDirectories.isEmpty()) {
// Directories that the directory preview will be propagated into if there is no direct sub-directories
const KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings");
m_propagationDirectories = globalConfig.readEntry("PropagationDirectories", QStringList() << "VIDEO_TS").toSet();
m_maxFileSize = globalConfig.readEntry("MaximumSize", 5 * 1024 * 1024); // 5 MByte default
}
const int tiles = 2; //Count of items shown on each dimension
const int spacing = 1;
const int visibleCount = tiles * tiles;
// TODO: the margins are optimized for the Oxygen iconset
// Provide a fallback solution for other iconsets (e. g. draw folder
// only as small overlay, use no margins)
//Use the current (custom) folder icon
const QMimeDatabase db;
const QString iconName = db.mimeTypeForName("inode/directory").iconName();
const QPixmap folder = QIcon::fromTheme(iconName).pixmap(qMin(m_width, m_height));
const int folderWidth = folder.width();
const int folderHeight = folder.height();
const int topMargin = folderHeight * 30 / 100;
const int bottomMargin = folderHeight / 6;
const int leftMargin = folderWidth / 13;
const int rightMargin = leftMargin;
const int segmentWidth = (folderWidth - leftMargin - rightMargin + spacing) / tiles - spacing;
const int segmentHeight = (folderHeight - topMargin - bottomMargin + spacing) / tiles - spacing;
if ((segmentWidth < 5) || (segmentHeight < 5)) {
// the segment size is too small for a useful preview
return img;
}
QString localFile = directory.path();
// Multiply with a high number, so we get some semi-random sequence
int skipValidItems = ((int)sequenceIndex()) * tiles * tiles;
img = QImage(QSize(folderWidth, folderHeight), QImage::Format_ARGB32);
img.fill(0);
QPainter p;
p.begin(&img);
p.setCompositionMode(QPainter::CompositionMode_Source);
p.drawPixmap(0, 0, folder);
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
int xPos = leftMargin;
int yPos = topMargin;
int frameWidth = qRound(folderWidth / 85.);
int iterations = 0;
QString hadFirstThumbnail;
int skipped = 0;
const int maxYPos = folderHeight - bottomMargin - segmentHeight;
// Setup image object for preview with only one tile
QImage oneTileImg(folder.size(), QImage::Format_ARGB32);
oneTileImg.fill(0);
QPainter oneTilePainter(&oneTileImg);
oneTilePainter.setCompositionMode(QPainter::CompositionMode_Source);
oneTilePainter.drawPixmap(0, 0, folder);
oneTilePainter.setCompositionMode(QPainter::CompositionMode_SourceOver);
const int oneTileWidth = folderWidth - leftMargin - rightMargin;
const int oneTileHeight = folderHeight - topMargin - bottomMargin;
int validThumbnails = 0;
while ((skipped <= skipValidItems) && (yPos <= maxYPos) && validThumbnails == 0) {
QDirIterator dir(localFile, QDir::Files | QDir::Readable);
if (!dir.hasNext()) {
break;
}
while (dir.hasNext() && (yPos <= maxYPos)) {
++iterations;
if (iterations > 500) {
skipValidItems = skipped = 0;
break;
}
dir.next();
if (validThumbnails > 0 && hadFirstThumbnail == dir.filePath()) {
break; // Never show the same thumbnail twice
}
if (dir.fileInfo().size() > m_maxFileSize) {
// don't create thumbnails for files that exceed
//.........这里部分代码省略.........
示例11: createSubThumbnail
bool ThumbnailProtocol::createSubThumbnail(QImage& thumbnail, const QString& filePath,
int segmentWidth, int segmentHeight)
{
if (m_enabledPlugins.isEmpty()) {
const KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings");
m_enabledPlugins = globalConfig.readEntry("Plugins", QStringList()
<< "imagethumbnail"
<< "jpegthumbnail"
<< "videopreview");
}
const QMimeDatabase db;
const QUrl fileUrl = QUrl::fromLocalFile(filePath);
const QString subPlugin = pluginForMimeType(db.mimeTypeForUrl(fileUrl).name());
if (subPlugin.isEmpty() || !m_enabledPlugins.contains(subPlugin)) {
return false;
}
ThumbCreator* subCreator = getThumbCreator(subPlugin);
if (!subCreator) {
// qDebug() << "found no creator for" << dir.filePath();
return false;
}
if ((segmentWidth <= 256) && (segmentHeight <= 256)) {
// check whether a cached version of the file is available for
// 128 x 128 or 256 x 256 pixels
int cacheSize = 0;
QCryptographicHash md5(QCryptographicHash::Md5);
md5.addData(QFile::encodeName(fileUrl.toString()));
const QString thumbName = QFile::encodeName(md5.result().toHex()).append(".png");
if (m_thumbBasePath.isEmpty()) {
m_thumbBasePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QLatin1String("/thumbnails/");
QDir basePath(m_thumbBasePath);
basePath.mkpath("normal/");
QFile::setPermissions(basePath.absoluteFilePath("normal"), QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner);
basePath.mkpath("large/");
QFile::setPermissions(basePath.absoluteFilePath("large"), QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner);
}
QDir thumbPath(m_thumbBasePath);
if ((segmentWidth <= 128) && (segmentHeight <= 128)) {
cacheSize = 128;
thumbPath.cd("normal");
} else {
cacheSize = 256;
thumbPath.cd("large");
}
if (!thumbnail.load(thumbPath.absoluteFilePath(thumbName))) {
// no cached version is available, a new thumbnail must be created
QSaveFile thumbnailfile(thumbPath.absoluteFilePath(thumbName));
bool savedCorrectly = false;
if (subCreator->create(filePath, cacheSize, cacheSize, thumbnail)) {
scaleDownImage(thumbnail, cacheSize, cacheSize);
// The thumbnail has been created successfully. Store the thumbnail
// to the cache for future access.
if (thumbnailfile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
savedCorrectly = thumbnail.save(&thumbnailfile, "PNG");
}
} else {
return false;
}
if(savedCorrectly)
{
thumbnailfile.commit();
}
}
} else if (!subCreator->create(filePath, segmentWidth, segmentHeight, thumbnail)) {
return false;
}
return true;
}
示例12: loadSettings
void SettingsCore::loadSettings()
{
#ifdef ABAKUS_QTONLY
//TODO
#else
KConfigGroup config = KGlobal::config()->group("Settings");
QString mode = config.readEntry("Trigonometric mode", "Degrees");
if(mode == "Degrees") {
setTrigMode(Abakus::Degrees);
}
else {
setTrigMode(Abakus::Radians);
}
int precision = config.readEntry("Decimal Precision", -1);
if(precision < -1 || precision > 75)
{
precision = -1;
}
Abakus::m_prec = precision;
m_historyLimit = config.readEntry("History Limit", 500);
config = KGlobal::config()->group("GUI");
m_mathematicalSidebarVisible = config.readEntry("ShowMathematicalSidebar", true);
m_mathematicalSidebarActiveView = config.readEntry("MathematicalSidebarActiveTab", "numerals");
m_mathematicalSidebarWidth = config.readEntry("MathematicalSidebarWidth", 200);
m_compactMode = config.readEntry("InCompactMode", false);
m_windowSize = config.readEntry("Size", QSize(600, 220));
config = KGlobal::config()->group("Variables");
QStringList variableKeys = config.keyList();
QStringList variableValues;
Abakus::Number number;
for(int i = 0; i < variableKeys.count(); ++i)
{
variableValues = config.readEntry(variableKeys[i], QStringList());
if(variableValues.count() < 3) continue;
number = Abakus::Number(variableValues[1].toLatin1());
number.setNumeralSystem((Abakus::NumeralSystem) variableValues[2].toInt());
NumeralModel::instance()->setValue(variableValues[0], number);
}
config = KGlobal::config()->group("Functions");
QStringList functionKeys = config.keyList();
QString functionValue;
for(int i = 0; i < functionKeys.count(); ++i)
{
functionValue = config.readEntry(functionKeys[i], QString());
if(functionValue.isEmpty()) continue;
QByteArray strValue = "set " + functionValue.toLatin1();
parseString(strValue.data()); // Run the function definitions through the parser
}
config = KGlobal::config()->group("History");
QStringList historyKeys = config.keyList();
QStringList historyValues;
ResultModel* resultModel = ResultModel::instance();
ResultModelItem* resultModelItem;
for(int i = historyKeys.count() - 1; i >= 0; --i)
{
historyValues = config.readEntry(historyKeys[i], QStringList());
if(historyValues.count() < 1) continue;
if(historyValues[0].toInt() == ResultModelItem::Result)
{
if(historyValues.count() < 4) continue;
number = Abakus::Number(historyValues[2].toLatin1());
number.setNumeralSystem((Abakus::NumeralSystem) historyValues[3].toInt());
resultModelItem = new ResultModelItem(historyValues[1], number);
}
else
{
if(historyValues.count() < 3) continue;
resultModelItem = new ResultModelItem(historyValues[1], historyValues[2]);
}
resultModel->addResultModelItem(resultModelItem);
}
m_actionCollection->readSettings();
#endif
}
示例13: readConfig
void Autocorrect::readConfig()
{
KConfigGroup interface = KoGlobal::kofficeConfig()->group("Autocorrect");
m_enabled->setChecked(interface.readEntry("enabled", m_enabled->isChecked()));
m_uppercaseFirstCharOfSentence = interface.readEntry("UppercaseFirstCharOfSentence", m_uppercaseFirstCharOfSentence);
m_fixTwoUppercaseChars = interface.readEntry("FixTwoUppercaseChars", m_fixTwoUppercaseChars);
m_autoFormatURLs = interface.readEntry("AutoFormatURLs", m_autoFormatURLs);
m_singleSpaces = interface.readEntry("SingleSpaces", m_singleSpaces);
m_trimParagraphs = interface.readEntry("TrimParagraphs", m_trimParagraphs);
m_autoBoldUnderline = interface.readEntry("AutoBoldUnderline", m_autoBoldUnderline);
m_autoFractions = interface.readEntry("AutoFractions", m_autoFractions);
m_autoNumbering = interface.readEntry("AutoNumbering", m_autoNumbering);
m_superscriptAppendix = interface.readEntry("SuperscriptAppendix", m_superscriptAppendix);
m_capitalizeWeekDays = interface.readEntry("CapitalizeWeekDays", m_capitalizeWeekDays);
m_autoFormatBulletList = interface.readEntry("AutoFormatBulletList", m_autoFormatBulletList);
m_advancedAutocorrect = interface.readEntry("AdvancedAutocorrect", m_advancedAutocorrect);
m_replaceDoubleQuotes = interface.readEntry("ReplaceDoubleQuotes", m_replaceDoubleQuotes);
m_replaceSingleQuotes = interface.readEntry("ReplaceSingleQuotes", m_replaceSingleQuotes);
m_autocorrectLang = interface.readEntry("formatLanguage", m_autocorrectLang);
readAutocorrectXmlEntry();
}
示例14: init
void DatapickerCurve::init() {
Q_D(DatapickerCurve);
KConfig config;
KConfigGroup group;
group = config.group("DatapickerCurve");
d->posXColumn = NULL;
d->posYColumn = NULL;
d->posZColumn = NULL;
d->plusDeltaXColumn = NULL;
d->minusDeltaXColumn = NULL;
d->plusDeltaYColumn = NULL;
d->minusDeltaYColumn = NULL;
d->curveErrorTypes.x = (ErrorType) group.readEntry("CurveErrorType_X", (int) NoError);
d->curveErrorTypes.y = (ErrorType) group.readEntry("CurveErrorType_X", (int) NoError);
// point properties
d->pointStyle = (Symbol::Style)group.readEntry("PointStyle", (int)Symbol::Cross);
d->pointSize = group.readEntry("Size", Worksheet::convertToSceneUnits(7, Worksheet::Point));
d->pointRotationAngle = group.readEntry("Rotation", 0.0);
d->pointOpacity = group.readEntry("Opacity", 1.0);
d->pointBrush.setStyle( (Qt::BrushStyle)group.readEntry("FillingStyle", (int)Qt::NoBrush) );
d->pointBrush.setColor( group.readEntry("FillingColor", QColor(Qt::black)) );
d->pointPen.setStyle( (Qt::PenStyle)group.readEntry("BorderStyle", (int)Qt::SolidLine) );
d->pointPen.setColor( group.readEntry("BorderColor", QColor(Qt::red)) );
d->pointPen.setWidthF( group.readEntry("BorderWidth", Worksheet::convertToSceneUnits(1, Worksheet::Point)) );
d->pointErrorBarSize = group.readEntry("ErrorBarSize", Worksheet::convertToSceneUnits(8, Worksheet::Point));
d->pointErrorBarBrush.setStyle( (Qt::BrushStyle)group.readEntry("ErrorBarFillingStyle", (int)Qt::NoBrush) );
d->pointErrorBarBrush.setColor( group.readEntry("ErrorBarFillingColor", QColor(Qt::black)) );
d->pointErrorBarPen.setStyle( (Qt::PenStyle)group.readEntry("ErrorBarBorderStyle", (int)Qt::SolidLine) );
d->pointErrorBarPen.setColor( group.readEntry("ErrorBarBorderColor", QColor(Qt::black)) );
d->pointErrorBarPen.setWidthF( group.readEntry("ErrorBarBorderWidth", Worksheet::convertToSceneUnits(1, Worksheet::Point)) );
d->pointVisibility = group.readEntry("PointVisibility", true);
this->initAction();
}
示例15: main
int main(int argc, char **argv)
{
QApplication app(argc, argv);
App::initializeDependencies();
auto aboutData = App::getAboutData();
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
parser.addVersionOption();
parser.addHelpOption();
aboutData.setupCommandLine(&parser);
parser.process(app);
aboutData.processCommandLine(&parser);
KSharedConfig::Ptr config = KSharedConfig::openConfig(QStringLiteral("zanshin-migratorrc"));
KConfigGroup group = config->group("Migrations");
if (!group.readEntry("Migrated021Projects", false)) {
std::cerr << "Migrating data from zanshin 0.2, please wait..." << std::endl;
QProcess proc;
proc.start(QStringLiteral("zanshin-migrator"));
proc.waitForFinished(-1);
if (proc.exitStatus() == QProcess::CrashExit) {
std::cerr << "Migrator crashed!" << std::endl;
} else if (proc.exitCode() == 0) {
std::cerr << "Migration done" << std::endl;
} else {
std::cerr << "Migration error, code" << proc.exitCode() << std::endl;
}
}
auto widget = new QWidget;
auto components = new Widgets::ApplicationComponents(widget);
components->setModel(Presentation::ApplicationModel::Ptr::create());
auto layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(components->pageView());
widget->setLayout(layout);
auto sourcesDock = new QDockWidget(QObject::tr("Sources"));
sourcesDock->setObjectName(QStringLiteral("sourcesDock"));
sourcesDock->setWidget(components->availableSourcesView());
auto pagesDock = new QDockWidget(QObject::tr("Pages"));
pagesDock->setObjectName(QStringLiteral("pagesDock"));
pagesDock->setWidget(components->availablePagesView());
auto editorDock = new QDockWidget(QObject::tr("Editor"));
editorDock->setObjectName(QStringLiteral("editorDock"));
editorDock->setWidget(components->editorView());
auto window = new KXmlGuiWindow;
window->setCentralWidget(widget);
window->addDockWidget(Qt::RightDockWidgetArea, editorDock);
window->addDockWidget(Qt::LeftDockWidgetArea, pagesDock);
window->addDockWidget(Qt::LeftDockWidgetArea, sourcesDock);
auto actions = components->globalActions();
actions.insert(QStringLiteral("dock_sources"), sourcesDock->toggleViewAction());
actions.insert(QStringLiteral("dock_pages"), pagesDock->toggleViewAction());
actions.insert(QStringLiteral("dock_editor"), editorDock->toggleViewAction());
auto ac = window->actionCollection();
ac->addAction(KStandardAction::Quit, window, SLOT(close()));
for (auto it = actions.constBegin(); it != actions.constEnd(); ++it) {
auto shortcut = it.value()->shortcut();
if (!shortcut.isEmpty()) {
ac->setDefaultShortcut(it.value(), shortcut);
}
ac->addAction(it.key(), it.value());
}
window->setupGUI(QSize(1024, 600),
KXmlGuiWindow::ToolBar
| KXmlGuiWindow::Keys
| KXmlGuiWindow::Save
| KXmlGuiWindow::Create);
window->show();
return app.exec();
}