示例#1
0
MenuSourceItem * MenuSourceButton::copy() {
	auto ret = construct<MenuSourceButton>();
	ret->setName(_name);
	ret->setNameIcon(_nameIcon);
	ret->setValue(_name);
	ret->setValueIcon(_nameIcon);
	ret->setSelected(_selected);
	ret->setNextMenu(_nextMenu);
	ret->setCallback(_callback);
	ret->setCustomData(_customData);
	return ret;
}
示例#2
0
MenuSourceItem * MenuSourceItem::copy() {
	auto ret = construct<MenuSourceItem>();
	ret->setCustomData(_customData);
	return ret;
}
示例#3
0
bool KgTheme::readFromDesktopFile(const QString& path_)
{
    if (path_.isEmpty())
    {
        qCDebug(GAMES_LIB) << "Refusing to load theme with no name";
        return false;
    }
    //legacy support: relative paths are resolved with KStandardDirs/appdata
    QString path(path_);
    if (QFileInfo(path).isRelative())
    {
        path = QStandardPaths::locate(QStandardPaths::DataLocation, path);
        if (path.isEmpty())
        {
            qCDebug(GAMES_LIB) << "Could not find theme description" << path;
            return false;
        }
    }
    //default group name
    if (Private::s_configGroupNames.isEmpty())
    {
        Private::s_configGroupNames << QLatin1String("KGameTheme");
    }
    //open file, look for a known config group
    KConfig config(path, KConfig::SimpleConfig);
    KConfigGroup group;
    foreach (const QString& groupName, Private::s_configGroupNames)
    {
        if (config.hasGroup(groupName))
        {
            group = config.group(groupName);
        }
    }
    if (!group.isValid())
    {
        qCDebug(GAMES_LIB) << "Could not read theme description at" << path;
        return false;
    }
    //check format version
    if (group.readEntry("VersionFormat", 1) > 1)
    {
        qCDebug(GAMES_LIB) << "Format of theme description too new at" << path;
        return false;
    }

    //resolve paths
    const QFileInfo fi(path);
    const QDir dir = fi.dir();
    QString graphicsPath = group.readEntry("FileName", QString());
    if (!graphicsPath.isEmpty() && QFileInfo(graphicsPath).isRelative())
        graphicsPath = dir.absoluteFilePath(graphicsPath);
    QString previewPath = group.readEntry("Preview", QString());
    if (!previewPath.isEmpty() && QFileInfo(previewPath).isRelative())
        previewPath = dir.absoluteFilePath(previewPath);
    //create theme
    setName(group.readEntry("Name", QString()));
    setDescription(group.readEntry("Description", QString()));
    setAuthor(group.readEntry("Author", QString()));
    setAuthorEmail(group.readEntry("AuthorEmail", QString()));
    setGraphicsPath(graphicsPath);
    setPreviewPath(previewPath);
    setCustomData(group.entryMap());
    //store modification date of this file in private property (KGameRenderer
    //wants to clear its cache also if the theme description changes)
    setProperty("_k_themeDescTimestamp", fi.lastModified().toTime_t());
    return true;
}
示例#4
0
MenuSourceItem * MenuSourceCustom::copy() {
	auto ret = construct<MenuSourceCustom>(_height, _function, _relativeHeight);
	ret->setCustomData(_customData);
	return ret;
}
JavaSourceFileType::JavaSourceFileType(std::shared_ptr<CustomDocumentTypeData> customData)
    : DocumentType("Java Source File", "java")
{
    setCustomData(customData);
}