本文整理汇总了C++中TilesetManager类的典型用法代码示例。如果您正苦于以下问题:C++ TilesetManager类的具体用法?C++ TilesetManager怎么用?C++ TilesetManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TilesetManager类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Document
TilesetDocument::TilesetDocument(const SharedTileset &tileset, const QString &fileName)
: Document(TilesetDocumentType, fileName)
, mTileset(tileset)
, mTerrainModel(new TilesetTerrainModel(this, this))
, mWangSetModel(new TilesetWangSetModel(this, this))
, mWangColorModel(nullptr)
{
mCurrentObject = tileset.data();
// warning: will need to be kept up-to-date
mFileName = tileset->fileName();
connect(this, &TilesetDocument::propertyAdded,
this, &TilesetDocument::onPropertyAdded);
connect(this, &TilesetDocument::propertyRemoved,
this, &TilesetDocument::onPropertyRemoved);
connect(this, &TilesetDocument::propertyChanged,
this, &TilesetDocument::onPropertyChanged);
connect(this, &TilesetDocument::propertiesChanged,
this, &TilesetDocument::onPropertiesChanged);
connect(mTerrainModel, &TilesetTerrainModel::terrainRemoved,
this, &TilesetDocument::onTerrainRemoved);
connect(mWangSetModel, &TilesetWangSetModel::wangSetRemoved,
this, &TilesetDocument::onWangSetRemoved);
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->addReference(tileset);
}
开发者ID:aTom3333,项目名称:tiled,代码行数:30,代码来源:tilesetdocument.cpp
示例2: unifyTilesets
/**
* Replaces tilesets in \a map by similar tilesets in this map when possible,
* and adds tilesets to \a missingTilesets whenever there is a tileset without
* replacement in this map.
*
* \warning This method assumes that the tilesets in \a map are managed by
* the TilesetManager!
*/
void MapDocument::unifyTilesets(Map *map, QVector<SharedTileset> &missingTilesets)
{
QVector<SharedTileset> availableTilesets = mMap->tilesets();
for (const SharedTileset &tileset : qAsConst(missingTilesets))
if (!availableTilesets.contains(tileset))
availableTilesets.append(tileset);
TilesetManager *tilesetManager = TilesetManager::instance();
// Iterate over a copy because map->replaceTileset may invalidate iterator
const QVector<SharedTileset> tilesets = map->tilesets();
for (const SharedTileset &tileset : tilesets) {
// tileset already added
if (availableTilesets.contains(tileset))
continue;
SharedTileset replacement = tileset->findSimilarTileset(availableTilesets);
// tileset not present and no replacement tileset found
if (!replacement) {
missingTilesets.append(tileset);
availableTilesets.append(tileset);
continue;
}
// replacement tileset found, change given map
if (map->replaceTileset(tileset, replacement))
tilesetManager->addReference(replacement);
tilesetManager->removeReference(tileset);
}
}
开发者ID:stt,项目名称:tiled,代码行数:39,代码来源:mapdocument.cpp
示例3: mFileName
MapDocument::MapDocument(Map *map, const QString &fileName):
mFileName(fileName),
mMap(map),
mLayerModel(new LayerModel(this)),
mUndoStack(new QUndoStack(this))
{
switch (map->orientation()) {
case Map::Isometric:
mRenderer = new IsometricRenderer(map);
break;
case Map::Hexagonal:
mRenderer = new HexagonalRenderer(map);
break;
default:
mRenderer = new OrthogonalRenderer(map);
break;
}
mCurrentLayerIndex = (map->layerCount() == 0) ? -1 : 0;
mLayerModel->setMapDocument(this);
// Forward signals emitted from the layer model
connect(mLayerModel, SIGNAL(layerAdded(int)), SLOT(onLayerAdded(int)));
connect(mLayerModel, SIGNAL(layerAboutToBeRemoved(int)),
SLOT(onLayerAboutToBeRemoved(int)));
connect(mLayerModel, SIGNAL(layerRemoved(int)), SLOT(onLayerRemoved(int)));
connect(mLayerModel, SIGNAL(layerChanged(int)), SIGNAL(layerChanged(int)));
connect(mUndoStack, SIGNAL(cleanChanged(bool)), SIGNAL(modifiedChanged()));
// Register tileset references
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->addReferences(mMap->tilesets());
}
开发者ID:Laiff,项目名称:tiled,代码行数:34,代码来源:mapdocument.cpp
示例4: tilesetAboutToBeAdded
/**
* Adds a tileset to this map at the given \a index. Emits the appropriate
* signal.
*/
void MapDocument::insertTileset(int index, const SharedTileset &tileset)
{
emit tilesetAboutToBeAdded(index);
mMap->insertTileset(index, tileset);
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->addReference(tileset);
emit tilesetAdded(index, tileset.data());
}
开发者ID:stt,项目名称:tiled,代码行数:12,代码来源:mapdocument.cpp
示例5:
MapDocument::~MapDocument()
{
// Unregister tileset references
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->removeReferences(mMap->tilesets());
delete mRenderer;
delete mMap;
}
开发者ID:Ohmnivore,项目名称:tiled,代码行数:9,代码来源:mapdocument.cpp
示例6: mFileName
MapDocument::MapDocument(Map *map, const QString &fileName):
mFileName(fileName),
mMap(map),
mLayerModel(new LayerModel(this)),
mCurrentObject(map),
mMapObjectModel(new MapObjectModel(this)),
mTerrainModel(new TerrainModel(this, this)),
mUndoStack(new QUndoStack(this))
{
switch (map->orientation()) {
case Map::Isometric:
mRenderer = new IsometricRenderer(map);
break;
case Map::Staggered:
mRenderer = new StaggeredRenderer(map);
break;
default:
mRenderer = new OrthogonalRenderer(map);
break;
}
mCurrentLayerIndex = (map->layerCount() == 0) ? -1 : 0;
mLayerModel->setMapDocument(this);
// Forward signals emitted from the layer model
connect(mLayerModel, SIGNAL(layerAdded(int)), SLOT(onLayerAdded(int)));
connect(mLayerModel, SIGNAL(layerAboutToBeRemoved(int)),
SLOT(onLayerAboutToBeRemoved(int)));
connect(mLayerModel, SIGNAL(layerRemoved(int)), SLOT(onLayerRemoved(int)));
connect(mLayerModel, SIGNAL(layerChanged(int)), SIGNAL(layerChanged(int)));
// Forward signals emitted from the map object model
mMapObjectModel->setMapDocument(this);
connect(mMapObjectModel, SIGNAL(objectsAdded(QList<MapObject*>)),
SIGNAL(objectsAdded(QList<MapObject*>)));
connect(mMapObjectModel, SIGNAL(objectsChanged(QList<MapObject*>)),
SIGNAL(objectsChanged(QList<MapObject*>)));
connect(mMapObjectModel, SIGNAL(objectsRemoved(QList<MapObject*>)),
SLOT(onObjectsRemoved(QList<MapObject*>)));
connect(mMapObjectModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
SLOT(onMapObjectModelRowsInserted(QModelIndex,int,int)));
connect(mMapObjectModel, SIGNAL(rowsRemoved(QModelIndex,int,int)),
SLOT(onMapObjectModelRowsInsertedOrRemoved(QModelIndex,int,int)));
connect(mMapObjectModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
SLOT(onObjectsMoved(QModelIndex,int,int,QModelIndex,int)));
connect(mTerrainModel, SIGNAL(terrainRemoved(Terrain*)),
SLOT(onTerrainRemoved(Terrain*)));
connect(mUndoStack, SIGNAL(cleanChanged(bool)), SIGNAL(modifiedChanged()));
// Register tileset references
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->addReferences(mMap->tilesets());
}
开发者ID:Clementine913,项目名称:tiled,代码行数:56,代码来源:mapdocument.cpp
示例7:
TileStampData::~TileStampData()
{
TilesetManager *tilesetManager = TilesetManager::instance();
// decrease reference to tilesets and delete maps
for (const TileStampVariation &variation : variations) {
tilesetManager->removeReferences(variation.map->tilesets());
delete variation.map;
}
}
开发者ID:Shorttail,项目名称:tiled,代码行数:10,代码来源:tilestamp.cpp
示例8: tilesetAboutToBeRemoved
/**
* Removes the tileset at the given \a index from this map. Emits the
* appropriate signal.
*
* \warning Does not make sure that any references to tiles in the removed
* tileset are cleared.
*/
void MapDocument::removeTilesetAt(int index)
{
emit tilesetAboutToBeRemoved(index);
SharedTileset tileset = mMap->tilesets().at(index);
mMap->removeTilesetAt(index);
emit tilesetRemoved(tileset.data());
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->removeReference(tileset);
}
开发者ID:stt,项目名称:tiled,代码行数:18,代码来源:mapdocument.cpp
示例9: mSettings
Preferences::Preferences()
: mSettings(new QSettings)
{
// Retrieve storage settings
mSettings->beginGroup(QLatin1String("Storage"));
mLayerDataFormat = (MapWriter::LayerDataFormat)
mSettings->value(QLatin1String("LayerDataFormat"),
MapWriter::Base64Zlib).toInt();
mDtdEnabled = mSettings->value(QLatin1String("DtdEnabled")).toBool();
mReloadTilesetsOnChange =
mSettings->value(QLatin1String("ReloadTilesets"), true).toBool();
mSettings->endGroup();
// Retrieve interface settings
mSettings->beginGroup(QLatin1String("Interface"));
mShowGrid = mSettings->value(QLatin1String("ShowGrid"), false).toBool();
mSnapToGrid = mSettings->value(QLatin1String("SnapToGrid"),
false).toBool();
mGridColor = QColor(mSettings->value(QLatin1String("GridColor"),
QColor(Qt::black).name()).toString());
mHighlightCurrentLayer = mSettings->value(QLatin1String("HighlightCurrentLayer"),
false).toBool();
mShowTilesetGrid = mSettings->value(QLatin1String("ShowTilesetGrid"),
true).toBool();
mLanguage = mSettings->value(QLatin1String("Language"),
QString()).toString();
mUseOpenGL = mSettings->value(QLatin1String("OpenGL"), false).toBool();
mSettings->endGroup();
// Retrieve defined object types
mSettings->beginGroup(QLatin1String("ObjectTypes"));
const QStringList names =
mSettings->value(QLatin1String("Names")).toStringList();
const QStringList colors =
mSettings->value(QLatin1String("Colors")).toStringList();
mSettings->endGroup();
const int count = qMin(names.size(), colors.size());
for (int i = 0; i < count; ++i)
mObjectTypes.append(ObjectType(names.at(i), QColor(colors.at(i))));
mSettings->beginGroup(QLatin1String("Automapping"));
mAutoMapDrawing = mSettings->value(QLatin1String("WhileDrawing"),
false).toBool();
mSettings->endGroup();
mSettings->beginGroup(QLatin1String("MapsDirectory"));
mMapsDirectory = mSettings->value(QLatin1String("Current"), QString()).toString();
mSettings->endGroup();
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->setReloadTilesetsOnChange(mReloadTilesetsOnChange);
}
开发者ID:brun01,项目名称:tiled,代码行数:53,代码来源:preferences.cpp
示例10: setReloadTilesetsOnChanged
void Preferences::setReloadTilesetsOnChanged(bool value)
{
if (mReloadTilesetsOnChange == value)
return;
mReloadTilesetsOnChange = value;
mSettings->setValue(QLatin1String("Storage/ReloadTilesets"),
mReloadTilesetsOnChange);
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->setReloadTilesetsOnChange(mReloadTilesetsOnChange);
}
开发者ID:brun01,项目名称:tiled,代码行数:12,代码来源:preferences.cpp
示例11: mSettings
Preferences::Preferences()
: mSettings(new QSettings(this))
{
// Retrieve storage settings
mSettings->beginGroup(QLatin1String("Storage"));
mLayerDataFormat = (Map::LayerDataFormat)
mSettings->value(QLatin1String("LayerDataFormat"),
Map::Base64Zlib).toInt();
mDtdEnabled = boolValue("DtdEnabled");
mReloadTilesetsOnChange = boolValue("ReloadTilesets", true);
mSettings->endGroup();
// Retrieve interface settings
mSettings->beginGroup(QLatin1String("Interface"));
mShowGrid = boolValue("ShowGrid");
mShowTileObjectOutlines = boolValue("ShowTileObjectOutlines");
mShowTileAnimations = boolValue("ShowTileAnimations", true);
mSnapToGrid = boolValue("SnapToGrid");
mSnapToFineGrid = boolValue("SnapToFineGrid");
mGridColor = colorValue("GridColor", Qt::black);
mGridFine = intValue("GridFine", 4);
mObjectLineWidth = realValue("ObjectLineWidth", 2);
mHighlightCurrentLayer = boolValue("HighlightCurrentLayer");
mShowTilesetGrid = boolValue("ShowTilesetGrid", true);
mLanguage = stringValue("Language");
mUseOpenGL = boolValue("OpenGL");
mSettings->endGroup();
// Retrieve defined object types
mSettings->beginGroup(QLatin1String("ObjectTypes"));
const QStringList names =
mSettings->value(QLatin1String("Names")).toStringList();
const QStringList colors =
mSettings->value(QLatin1String("Colors")).toStringList();
mSettings->endGroup();
const int count = qMin(names.size(), colors.size());
for (int i = 0; i < count; ++i)
mObjectTypes.append(ObjectType(names.at(i), QColor(colors.at(i))));
mSettings->beginGroup(QLatin1String("Automapping"));
mAutoMapDrawing = boolValue("WhileDrawing");
mSettings->endGroup();
mSettings->beginGroup(QLatin1String("MapsDirectory"));
mMapsDirectory = stringValue("Current");
mSettings->endGroup();
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->setReloadTilesetsOnChange(mReloadTilesetsOnChange);
tilesetManager->setAnimateTiles(mShowTileAnimations);
}
开发者ID:071300726,项目名称:tiled,代码行数:52,代码来源:preferences.cpp
示例12: setShowTileAnimations
void Preferences::setShowTileAnimations(bool enabled)
{
if (mShowTileAnimations == enabled)
return;
mShowTileAnimations = enabled;
mSettings->setValue(QLatin1String("Interface/ShowTileAnimations"),
mShowTileAnimations);
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->setAnimateTiles(mShowTileAnimations);
emit showTileAnimationsChanged(mShowTileAnimations);
}
开发者ID:071300726,项目名称:tiled,代码行数:14,代码来源:preferences.cpp
示例13: QSharedData
TileStampData::TileStampData(const TileStampData &other)
: QSharedData(other)
, name(other.name)
, fileName() // not copied
, variations(other.variations)
, quickStampIndex(-1)
{
TilesetManager *tilesetManager = TilesetManager::instance();
// deep-copy the map data
for (TileStampVariation &variation : variations) {
variation.map = new Map(*variation.map);
tilesetManager->addReferences(variation.map->tilesets());
}
}
开发者ID:Shorttail,项目名称:tiled,代码行数:15,代码来源:tilestamp.cpp
示例14: Document
MapDocument::MapDocument(Map *map, const QString &fileName)
: Document(MapDocumentType, fileName)
, mMap(map)
, mLayerModel(new LayerModel(this))
, mHoveredMapObject(nullptr)
, mRenderer(nullptr)
, mMapObjectModel(new MapObjectModel(this))
{
mCurrentObject = map;
createRenderer();
mCurrentLayer = (map->layerCount() == 0) ? nullptr : map->layerAt(0);
mLayerModel->setMapDocument(this);
// Forward signals emitted from the layer model
connect(mLayerModel, &LayerModel::layerAdded,
this, &MapDocument::onLayerAdded);
connect(mLayerModel, &LayerModel::layerAboutToBeRemoved,
this, &MapDocument::onLayerAboutToBeRemoved);
connect(mLayerModel, &LayerModel::layerRemoved,
this, &MapDocument::onLayerRemoved);
connect(mLayerModel, &LayerModel::layerChanged,
this, &MapDocument::layerChanged);
// Forward signals emitted from the map object model
mMapObjectModel->setMapDocument(this);
connect(mMapObjectModel, SIGNAL(objectsAdded(QList<MapObject*>)),
SIGNAL(objectsAdded(QList<MapObject*>)));
connect(mMapObjectModel, SIGNAL(objectsChanged(QList<MapObject*>)),
SIGNAL(objectsChanged(QList<MapObject*>)));
connect(mMapObjectModel, SIGNAL(objectsTypeChanged(QList<MapObject*>)),
SIGNAL(objectsTypeChanged(QList<MapObject*>)));
connect(mMapObjectModel, SIGNAL(objectsRemoved(QList<MapObject*>)),
SLOT(onObjectsRemoved(QList<MapObject*>)));
connect(mMapObjectModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
SLOT(onMapObjectModelRowsInserted(QModelIndex,int,int)));
connect(mMapObjectModel, SIGNAL(rowsRemoved(QModelIndex,int,int)),
SLOT(onMapObjectModelRowsInsertedOrRemoved(QModelIndex,int,int)));
connect(mMapObjectModel, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
SLOT(onObjectsMoved(QModelIndex,int,int,QModelIndex,int)));
// Register tileset references
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->addReferences(mMap->tilesets());
}
开发者ID:stt,项目名称:tiled,代码行数:47,代码来源:mapdocument.cpp
示例15: replaceTileset
/**
* Replaces the tileset at the given \a index with the new \a tileset. Replaces
* all tiles from the replaced tileset with tiles from the new tileset.
*
* @return The replaced tileset.
*/
SharedTileset MapDocument::replaceTileset(int index, const SharedTileset &tileset)
{
SharedTileset oldTileset = mMap->tilesetAt(index);
bool added = mMap->replaceTileset(oldTileset, tileset);
TilesetManager *tilesetManager = TilesetManager::instance();
if (added)
tilesetManager->addReference(tileset);
tilesetManager->removeReference(oldTileset);
if (added)
emit tilesetReplaced(index, tileset.data(), oldTileset.data());
else
emit tilesetRemoved(oldTileset.data());
return oldTileset;
}
开发者ID:stt,项目名称:tiled,代码行数:24,代码来源:mapdocument.cpp
示例16: mSettings
Preferences::Preferences()
: mSettings(new QSettings(this))
{
// Retrieve storage settings
mSettings->beginGroup(QLatin1String("Storage"));
mLayerDataFormat = static_cast<Map::LayerDataFormat>
(intValue("LayerDataFormat", Map::CSV));
mMapRenderOrder = static_cast<Map::RenderOrder>
(intValue("MapRenderOrder", Map::RightDown));
mDtdEnabled = boolValue("DtdEnabled");
mReloadTilesetsOnChange = boolValue("ReloadTilesets", true);
mStampsDirectory = stringValue("StampsDirectory");
mObjectTypesFile = stringValue("ObjectTypesFile");
mSettings->endGroup();
// Retrieve interface settings
mSettings->beginGroup(QLatin1String("Interface"));
mShowGrid = boolValue("ShowGrid", true);
mShowTileObjectOutlines = boolValue("ShowTileObjectOutlines");
mShowTileAnimations = boolValue("ShowTileAnimations", true);
mSnapToGrid = boolValue("SnapToGrid");
mSnapToFineGrid = boolValue("SnapToFineGrid");
mGridColor = colorValue("GridColor", Qt::black);
mGridFine = intValue("GridFine", 4);
mObjectLineWidth = realValue("ObjectLineWidth", 2);
mHighlightCurrentLayer = boolValue("HighlightCurrentLayer");
mShowTilesetGrid = boolValue("ShowTilesetGrid", true);
mLanguage = stringValue("Language");
mUseOpenGL = boolValue("OpenGL");
mObjectLabelVisibility = static_cast<ObjectLabelVisiblity>
(intValue("ObjectLabelVisibility", AllObjectLabels));
mSettings->endGroup();
// Retrieve defined object types
ObjectTypesReader objectTypesReader;
mObjectTypes = objectTypesReader.readObjectTypes(objectTypesFile());
// For backwards compatibilty, read in object types from settings
if (!objectTypesReader.errorString().isEmpty()) {
mSettings->beginGroup(QLatin1String("ObjectTypes"));
const QStringList names = mSettings->value(QLatin1String("Names")).toStringList();
const QStringList colors = mSettings->value(QLatin1String("Colors")).toStringList();
mSettings->endGroup();
if (!names.isEmpty()) {
const int count = qMin(names.size(), colors.size());
for (int i = 0; i < count; ++i)
mObjectTypes.append(ObjectType(names.at(i), QColor(colors.at(i))));
}
} else {
mSettings->remove(QLatin1String("ObjectTypes"));
}
mSettings->beginGroup(QLatin1String("Automapping"));
mAutoMapDrawing = boolValue("WhileDrawing");
mSettings->endGroup();
mSettings->beginGroup(QLatin1String("MapsDirectory"));
mMapsDirectory = stringValue("Current");
mSettings->endGroup();
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->setReloadTilesetsOnChange(mReloadTilesetsOnChange);
tilesetManager->setAnimateTiles(mShowTileAnimations);
// Read the lists of enabled and disabled plugins
const QStringList disabledPlugins = mSettings->value(QLatin1String("Plugins/Disabled")).toStringList();
const QStringList enabledPlugins = mSettings->value(QLatin1String("Plugins/Enabled")).toStringList();
PluginManager *pluginManager = PluginManager::instance();
for (const QString &fileName : disabledPlugins)
pluginManager->setPluginState(fileName, PluginDisabled);
for (const QString &fileName : enabledPlugins)
pluginManager->setPluginState(fileName, PluginEnabled);
// Keeping track of some usage information
mSettings->beginGroup(QLatin1String("Install"));
mFirstRun = mSettings->value(QLatin1String("FirstRun")).toDate();
mRunCount = intValue("RunCount", 0) + 1;
mIsPatron = boolValue("IsPatron");
mCheckForUpdates = boolValue("CheckForUpdates");
if (!mFirstRun.isValid()) {
mFirstRun = QDate::currentDate();
mSettings->setValue(QLatin1String("FirstRun"), mFirstRun.toString(Qt::ISODate));
}
mSettings->setValue(QLatin1String("RunCount"), mRunCount);
mSettings->endGroup();
// Retrieve startup settings
mSettings->beginGroup(QLatin1String("Startup"));
mOpenLastFilesOnStartup = boolValue("OpenLastFiles", true);
mSettings->endGroup();
}
开发者ID:4everyan,项目名称:tiled,代码行数:94,代码来源:preferences.cpp
示例17: mSettings
Preferences::Preferences()
: mSettings(new QSettings(this))
{
// Retrieve storage settings
mSettings->beginGroup(QLatin1String("Storage"));
mLayerDataFormat = (Map::LayerDataFormat)
mSettings->value(QLatin1String("LayerDataFormat"),
Map::Base64Zlib).toInt();
mMapRenderOrder = (Map::RenderOrder)
mSettings->value(QLatin1String("MapRenderOrder"),
Map::RightDown).toInt();
mDtdEnabled = boolValue("DtdEnabled");
mReloadTilesetsOnChange = boolValue("ReloadTilesets", true);
mStampsDirectory = stringValue("StampsDirectory");
mSettings->endGroup();
// Retrieve interface settings
mSettings->beginGroup(QLatin1String("Interface"));
mShowGrid = boolValue("ShowGrid");
mShowTileObjectOutlines = boolValue("ShowTileObjectOutlines");
mShowTileAnimations = boolValue("ShowTileAnimations", true);
mSnapToGrid = boolValue("SnapToGrid");
mSnapToFineGrid = boolValue("SnapToFineGrid");
mGridColor = colorValue("GridColor", Qt::black);
mGridFine = intValue("GridFine", 4);
mObjectLineWidth = realValue("ObjectLineWidth", 2);
mHighlightCurrentLayer = boolValue("HighlightCurrentLayer");
mShowTilesetGrid = boolValue("ShowTilesetGrid", true);
mLanguage = stringValue("Language");
mUseOpenGL = boolValue("OpenGL");
mSettings->endGroup();
// Retrieve defined object types
mSettings->beginGroup(QLatin1String("ObjectTypes"));
const QStringList names =
mSettings->value(QLatin1String("Names")).toStringList();
const QStringList colors =
mSettings->value(QLatin1String("Colors")).toStringList();
mSettings->endGroup();
const int count = qMin(names.size(), colors.size());
for (int i = 0; i < count; ++i)
mObjectTypes.append(ObjectType(names.at(i), QColor(colors.at(i))));
mSettings->beginGroup(QLatin1String("Automapping"));
mAutoMapDrawing = boolValue("WhileDrawing");
mSettings->endGroup();
mSettings->beginGroup(QLatin1String("MapsDirectory"));
mMapsDirectory = stringValue("Current");
mSettings->endGroup();
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->setReloadTilesetsOnChange(mReloadTilesetsOnChange);
tilesetManager->setAnimateTiles(mShowTileAnimations);
// Keeping track of some usage information
mSettings->beginGroup(QLatin1String("Install"));
mFirstRun = mSettings->value(QLatin1String("FirstRun")).toDate();
mRunCount = intValue("RunCount", 0) + 1;
mIsPatron = boolValue("IsPatron");
if (!mFirstRun.isValid()) {
mFirstRun = QDate::currentDate();
mSettings->setValue(QLatin1String("FirstRun"), mFirstRun.toString(Qt::ISODate));
}
mSettings->setValue(QLatin1String("RunCount"), mRunCount);
mSettings->endGroup();
// Retrieve startup settings
mSettings->beginGroup(QLatin1String("Startup"));
mOpenLastFilesOnStartup = boolValue("OpenLastFiles", true);
mSettings->endGroup();
}
开发者ID:astillich,项目名称:tiled,代码行数:73,代码来源:preferences.cpp
示例18:
TilesetDocument::~TilesetDocument()
{
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->removeReference(mTileset);
}
开发者ID:aTom3333,项目名称:tiled,代码行数:5,代码来源:tilesetdocument.cpp
注:本文中的TilesetManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论