Commit 922058cd authored by hjk's avatar hjk Committed by hjk

qmldesigner: code style

Change-Id: I4088695312de5ea526578c6b901a79a9662797b8
Reviewed-on: http://codereview.qt-project.org/4961Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent 940fb1c4
......@@ -144,7 +144,7 @@ private:
QWidget *centralWidget() const;
QString pathToQt() const;
class DesignDocumentControllerPrivate *m_d;
class DesignDocumentControllerPrivate *d;
static DesignDocumentController* m_this;
};
......
......@@ -71,7 +71,7 @@ IntegrationCore *CorePrivate::m_instance = 0;
*/
IntegrationCore::IntegrationCore() :
m_d(new CorePrivate)
d(new CorePrivate)
{
Q_ASSERT(CorePrivate::m_instance == 0);
CorePrivate::m_instance = this;
......@@ -80,7 +80,7 @@ IntegrationCore::IntegrationCore() :
IntegrationCore::~IntegrationCore()
{
CorePrivate::m_instance = 0;
delete m_d;
delete d;
}
IntegrationCore *IntegrationCore::instance()
......@@ -91,7 +91,7 @@ IntegrationCore *IntegrationCore::instance()
PluginManager *IntegrationCore::pluginManager() const
{
return &m_d->m_pluginManager;
return &d->m_pluginManager;
}
}
......@@ -59,7 +59,7 @@ public:
static IntegrationCore *instance();
private:
CorePrivate *m_d;
CorePrivate *d;
};
} // namspace QmlDesigner
......
......@@ -96,7 +96,7 @@ signals:
void symbianChecked(bool b);
private:
ItemLibraryWidgetPrivate *m_d;
ItemLibraryWidgetPrivate *d;
FilterChangeFlag m_filterFlag;
};
......
......@@ -113,13 +113,13 @@ public:
};
PluginManager::PluginManager() :
m_d(new PluginManagerPrivate)
d(new PluginManagerPrivate)
{
}
PluginManager::~PluginManager()
{
delete m_d;
delete d;
}
PluginManager::IPluginList PluginManager::instances()
......@@ -127,8 +127,8 @@ PluginManager::IPluginList PluginManager::instances()
if (debug)
qDebug() << '>' << Q_FUNC_INFO << QLibraryInfo::buildKey();
IPluginList rc;
const PluginManagerPrivate::PluginPathList::iterator end = m_d->m_paths.end();
for (PluginManagerPrivate::PluginPathList::iterator it = m_d->m_paths.begin(); it != end; ++it)
const PluginManagerPrivate::PluginPathList::iterator end = d->m_paths.end();
for (PluginManagerPrivate::PluginPathList::iterator it = d->m_paths.begin(); it != end; ++it)
it->getInstances(&rc);
if (debug)
qDebug() << '<' << Q_FUNC_INFO << rc.size();
......@@ -141,7 +141,7 @@ void PluginManager::setPluginPaths(const QStringList &paths)
const QDir dir(path);
if (!dir.exists())
continue;
m_d->m_paths.push_back(PluginPath(dir));
d->m_paths.push_back(PluginPath(dir));
}
// also register path in widgetpluginmanager
......@@ -151,8 +151,8 @@ void PluginManager::setPluginPaths(const QStringList &paths)
QAbstractItemModel *PluginManager::createModel(QObject *parent)
{
QStandardItemModel *model = new QStandardItemModel(parent);
const PluginManagerPrivate::PluginPathList::iterator end = m_d->m_paths.end();
for (PluginManagerPrivate::PluginPathList::iterator it = m_d->m_paths.begin(); it != end; ++it)
const PluginManagerPrivate::PluginPathList::iterator end = d->m_paths.end();
for (PluginManagerPrivate::PluginPathList::iterator it = d->m_paths.begin(); it != end; ++it)
model->appendRow(it->createModelItem());
return model;
}
......
......@@ -73,7 +73,7 @@ private:
// dialog. Forces plugin initialization.
QAbstractItemModel *createModel(QObject *parent = 0);
PluginManagerPrivate *m_d;
PluginManagerPrivate *d;
};
} // namespace QmlDesigner
......
......@@ -118,7 +118,7 @@ signals:
private:
ItemLibraryInfo(QObject *parent = 0);
void setBaseInfo(ItemLibraryInfo *baseInfo);
QScopedPointer<Internal::ItemLibraryInfoPrivate> m_d;
QScopedPointer<Internal::ItemLibraryInfoPrivate> d;
};
} // namespace QmlDesigner
......
......@@ -114,7 +114,7 @@ protected:
Model();
public:
Internal::ModelPrivate *m_d;
Internal::ModelPrivate *d;
};
}
......
......@@ -63,7 +63,7 @@ public:
private:
friend class Internal::SubComponentManagerPrivate;
Internal::SubComponentManagerPrivate *m_d;
Internal::SubComponentManagerPrivate *d;
};
} // namespace QmlDesigner
......
......@@ -257,7 +257,7 @@ QDataStream& operator>>(QDataStream& stream, ItemLibraryEntry &itemLibraryEntry)
ItemLibraryInfo::ItemLibraryInfo(QObject *parent) :
QObject(parent),
m_d(new Internal::ItemLibraryInfoPrivate())
d(new Internal::ItemLibraryInfoPrivate())
{
}
......@@ -269,35 +269,35 @@ QList<ItemLibraryEntry> ItemLibraryInfo::entriesForType(const QString &typeName,
{
QList<ItemLibraryEntry> entries;
foreach (const ItemLibraryEntry &entry, m_d->nameToEntryHash) {
foreach (const ItemLibraryEntry &entry, d->nameToEntryHash) {
if (entry.typeName() == typeName
&& entry.majorVersion() >= majorVersion
&& entry.minorVersion() >= minorVersion)
entries += entry;
}
if (m_d->baseInfo)
entries += m_d->baseInfo->entriesForType(typeName, majorVersion, minorVersion);
if (d->baseInfo)
entries += d->baseInfo->entriesForType(typeName, majorVersion, minorVersion);
return entries;
}
ItemLibraryEntry ItemLibraryInfo::entry(const QString &name) const
{
if (m_d->nameToEntryHash.contains(name))
return m_d->nameToEntryHash.value(name);
if (d->nameToEntryHash.contains(name))
return d->nameToEntryHash.value(name);
if (m_d->baseInfo)
return m_d->baseInfo->entry(name);
if (d->baseInfo)
return d->baseInfo->entry(name);
return ItemLibraryEntry();
}
QList<ItemLibraryEntry> ItemLibraryInfo::entries() const
{
QList<ItemLibraryEntry> list = m_d->nameToEntryHash.values();
if (m_d->baseInfo)
list += m_d->baseInfo->entries();
QList<ItemLibraryEntry> list = d->nameToEntryHash.values();
if (d->baseInfo)
list += d->baseInfo->entries();
return list;
}
......@@ -309,9 +309,9 @@ static inline QString keyForEntry(const ItemLibraryEntry &entry)
void ItemLibraryInfo::addEntry(const ItemLibraryEntry &entry)
{
const QString key = keyForEntry(entry);
if (m_d->nameToEntryHash.contains(key))
if (d->nameToEntryHash.contains(key))
throw InvalidMetaInfoException(__LINE__, __FUNCTION__, __FILE__);
m_d->nameToEntryHash.insert(key, entry);
d->nameToEntryHash.insert(key, entry);
emit entriesChanged();
}
......@@ -319,18 +319,18 @@ void ItemLibraryInfo::addEntry(const ItemLibraryEntry &entry)
bool ItemLibraryInfo::containsEntry(const ItemLibraryEntry &entry)
{
const QString key = keyForEntry(entry);
return m_d->nameToEntryHash.contains(key);
return d->nameToEntryHash.contains(key);
}
void ItemLibraryInfo::clearEntries()
{
m_d->nameToEntryHash.clear();
d->nameToEntryHash.clear();
emit entriesChanged();
}
void ItemLibraryInfo::setBaseInfo(ItemLibraryInfo *baseInfo)
{
m_d->baseInfo = baseInfo;
d->baseInfo = baseInfo;
}
} // namespace QmlDesigner
......@@ -372,23 +372,23 @@ Model *SubComponentManagerPrivate::model() const
SubComponentManager::SubComponentManager(Model *model, QObject *parent) :
QObject(parent),
m_d(new Internal::SubComponentManagerPrivate(model, this))
d(new Internal::SubComponentManagerPrivate(model, this))
{
}
SubComponentManager::~SubComponentManager()
{
delete m_d;
delete d;
}
QStringList SubComponentManager::directories() const
{
return m_d->m_watcher.directories();
return d->m_watcher.directories();
}
QStringList SubComponentManager::qmlFiles() const
{
return m_d->m_watcher.files();
return d->m_watcher.files();
}
void SubComponentManager::update(const QUrl &filePath, const QList<Import> &imports)
......@@ -398,8 +398,8 @@ void SubComponentManager::update(const QUrl &filePath, const QList<Import> &impo
QFileInfo oldDir, newDir;
if (!m_d->m_filePath.isEmpty()) {
const QString file = m_d->m_filePath.toLocalFile();
if (!d->m_filePath.isEmpty()) {
const QString file = d->m_filePath.toLocalFile();
oldDir = QFileInfo(QFileInfo(file).path());
}
if (!filePath.isEmpty()) {
......@@ -407,20 +407,20 @@ void SubComponentManager::update(const QUrl &filePath, const QList<Import> &impo
newDir = QFileInfo(QFileInfo(file).path());
}
m_d->m_filePath = filePath;
d->m_filePath = filePath;
//
// (implicit) import of local directory
//
if (oldDir != newDir) {
if (!oldDir.filePath().isEmpty()) {
m_d->m_dirToQualifier.remove(oldDir.canonicalFilePath(), QString());
if (!m_d->m_dirToQualifier.contains(oldDir.canonicalFilePath()))
m_d->m_watcher.removePath(oldDir.filePath());
d->m_dirToQualifier.remove(oldDir.canonicalFilePath(), QString());
if (!d->m_dirToQualifier.contains(oldDir.canonicalFilePath()))
d->m_watcher.removePath(oldDir.filePath());
}
if (!newDir.filePath().isEmpty()) {
m_d->m_dirToQualifier.insertMulti(newDir.canonicalFilePath(), QString());
d->m_dirToQualifier.insertMulti(newDir.canonicalFilePath(), QString());
}
}
......@@ -430,20 +430,20 @@ void SubComponentManager::update(const QUrl &filePath, const QList<Import> &impo
// skip first list items until the lists differ
int i = 0;
while (i < qMin(imports.size(), m_d->m_imports.size())) {
if (!(imports.at(i) == m_d->m_imports.at(i)))
while (i < qMin(imports.size(), d->m_imports.size())) {
if (!(imports.at(i) == d->m_imports.at(i)))
break;
++i;
}
for (int ii = m_d->m_imports.size() - 1; ii >= i; --ii)
m_d->removeImport(ii);
for (int ii = d->m_imports.size() - 1; ii >= i; --ii)
d->removeImport(ii);
for (int ii = i; ii < imports.size(); ++ii) {
m_d->addImport(ii, imports.at(ii));
d->addImport(ii, imports.at(ii));
}
m_d->parseDirectories();
d->parseDirectories();
}
} // namespace QmlDesigner
......
......@@ -85,7 +85,7 @@ ModelNode AbstractView::createModelNode(const QString &typeString,
const QString &nodeSource,
ModelNode::NodeSourceType nodeSourceType)
{
return ModelNode(model()->m_d->createNode(typeString, majorVersion, minorVersion, propertyList, auxPropertyList, nodeSource, nodeSourceType), model(), this);
return ModelNode(model()->d->createNode(typeString, majorVersion, minorVersion, propertyList, auxPropertyList, nodeSource, nodeSourceType), model(), this);
}
......@@ -97,7 +97,7 @@ ModelNode AbstractView::createModelNode(const QString &typeString,
const ModelNode AbstractView::rootModelNode() const
{
Q_ASSERT(model());
return ModelNode(model()->m_d->rootNode(), model(), const_cast<AbstractView*>(this));
return ModelNode(model()->d->rootNode(), model(), const_cast<AbstractView*>(this));
}
......@@ -109,7 +109,7 @@ const ModelNode AbstractView::rootModelNode() const
ModelNode AbstractView::rootModelNode()
{
Q_ASSERT(model());
return ModelNode(model()->m_d->rootNode(), model(), this);
return ModelNode(model()->d->rootNode(), model(), this);
}
/*!
......@@ -276,7 +276,7 @@ QList<Internal::InternalNode::Pointer> toInternalNodeList(const QList<ModelNode>
*/
void AbstractView::setSelectedModelNodes(const QList<ModelNode> &selectedNodeList)
{
model()->m_d->setSelectedNodes(toInternalNodeList(selectedNodeList));
model()->d->setSelectedNodes(toInternalNodeList(selectedNodeList));
}
/*!
......@@ -284,7 +284,7 @@ void AbstractView::setSelectedModelNodes(const QList<ModelNode> &selectedNodeLis
*/
void AbstractView::clearSelectedModelNodes()
{
model()->m_d->clearSelectedNodes();
model()->d->clearSelectedNodes();
}
/*!
......@@ -293,7 +293,7 @@ void AbstractView::clearSelectedModelNodes()
*/
QList<ModelNode> AbstractView::selectedModelNodes() const
{
return toModelNodeList(model()->m_d->selectedNodes());
return toModelNodeList(model()->d->selectedNodes());
}
/*!
......@@ -302,7 +302,7 @@ QList<ModelNode> AbstractView::selectedModelNodes() const
*/
void AbstractView::selectModelNode(const ModelNode &node)
{
model()->m_d->selectNode(node.internalNode());
model()->d->selectNode(node.internalNode());
}
/*!
......@@ -311,27 +311,27 @@ void AbstractView::selectModelNode(const ModelNode &node)
*/
void AbstractView::deselectModelNode(const ModelNode &node)
{
model()->m_d->deselectNode(node.internalNode());
model()->d->deselectNode(node.internalNode());
}
ModelNode AbstractView::modelNodeForId(const QString &id)
{
return ModelNode(model()->m_d->nodeForId(id), model(), this);
return ModelNode(model()->d->nodeForId(id), model(), this);
}
bool AbstractView::hasId(const QString &id) const
{
return model()->m_d->hasId(id);
return model()->d->hasId(id);
}
ModelNode AbstractView::modelNodeForInternalId(qint32 internalId)
{
return ModelNode(model()->m_d->nodeForInternalId(internalId), model(), this);
return ModelNode(model()->d->nodeForInternalId(internalId), model(), this);
}
bool AbstractView::hasModelNodeForInternalId(qint32 internalId) const
{
return model()->m_d->hasNodeForInternalId(internalId);
return model()->d->hasNodeForInternalId(internalId);
}
QmlModelView *AbstractView::toQmlModelView()
......@@ -342,7 +342,7 @@ QmlModelView *AbstractView::toQmlModelView()
NodeInstanceView *AbstractView::nodeInstanceView() const
{
if (model()) {
return model()->m_d->nodeInstanceView();
return model()->d->nodeInstanceView();
} else {
return 0;
}
......@@ -351,7 +351,7 @@ NodeInstanceView *AbstractView::nodeInstanceView() const
RewriterView *AbstractView::rewriterView() const
{
if (model()) {
return model()->m_d->rewriterView();
return model()->d->rewriterView();
} else {
return 0;
}
......@@ -369,7 +369,7 @@ void AbstractView::resetView()
QList<ModelNode> AbstractView::allModelNodes()
{
return toModelNodeList(model()->m_d->allNodes());
return toModelNodeList(model()->d->allNodes());
}
void AbstractView::emitCustomNotification(const QString &identifier)
......@@ -384,49 +384,49 @@ void AbstractView::emitCustomNotification(const QString &identifier, const QList
void AbstractView::emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data)
{
model()->m_d->notifyCustomNotification(this, identifier, nodeList, data);
model()->d->notifyCustomNotification(this, identifier, nodeList, data);
}
void AbstractView::emitInstancePropertyChange(const QList<QPair<ModelNode, QString> > &propertyList)
{
if (model() && nodeInstanceView() == this)
model()->m_d->notifyInstancePropertyChange(propertyList);
model()->d->notifyInstancePropertyChange(propertyList);
}
void AbstractView::emitInstancesCompleted(const QVector<ModelNode> &nodeVector)
{
if (model() && nodeInstanceView() == this)
model()->m_d->notifyInstancesCompleted(nodeVector);
model()->d->notifyInstancesCompleted(nodeVector);
}
void AbstractView::emitInstanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash)
{
if (model() && nodeInstanceView() == this)
model()->m_d->notifyInstancesInformationsChange(informationChangeHash);
model()->d->notifyInstancesInformationsChange(informationChangeHash);
}
void AbstractView::emitInstancesRenderImageChanged(const QVector<ModelNode> &nodeVector)
{
if (model() && nodeInstanceView() == this)
model()->m_d->notifyInstancesRenderImageChanged(nodeVector);
model()->d->notifyInstancesRenderImageChanged(nodeVector);
}
void AbstractView::emitInstancesPreviewImageChanged(const QVector<ModelNode> &nodeVector)
{
if (model() && nodeInstanceView() == this)
model()->m_d->notifyInstancesPreviewImageChanged(nodeVector);
model()->d->notifyInstancesPreviewImageChanged(nodeVector);
}
void AbstractView::emitInstancesChildrenChanged(const QVector<ModelNode> &nodeVector)
{
if (model() && nodeInstanceView() == this)
model()->m_d->notifyInstancesChildrenChanged(nodeVector);
model()->d->notifyInstancesChildrenChanged(nodeVector);
}
void AbstractView::emitRewriterBeginTransaction()
{
if (model())
model()->m_d->notifyRewriterBeginTransaction();
model()->d->notifyRewriterBeginTransaction();
}
void AbstractView::sendTokenToInstances(const QString &token, int number, const QVector<ModelNode> &nodeVector)
......@@ -438,33 +438,33 @@ void AbstractView::sendTokenToInstances(const QString &token, int number, const
void AbstractView::emitInstanceToken(const QString &token, int number, const QVector<ModelNode> &nodeVector)
{
if (nodeInstanceView())
model()->m_d->notifyInstanceToken(token, number, nodeVector);
model()->d->notifyInstanceToken(token, number, nodeVector);
}
void AbstractView::emitRewriterEndTransaction()
{
if (model())
model()->m_d->notifyRewriterEndTransaction();
model()->d->notifyRewriterEndTransaction();
}
void AbstractView::setAcutalStateNode(const ModelNode &node)
{
Internal::WriteLocker locker(m_model.data());
if (model())
model()->m_d->notifyActualStateChanged(node);
model()->d->notifyActualStateChanged(node);
}
void AbstractView::changeRootNodeType(const QString &type, int majorVersion, int minorVersion)
{
Internal::WriteLocker locker(m_model.data());
m_model.data()->m_d->changeRootNodeType(type, majorVersion, minorVersion);
m_model.data()->d->changeRootNodeType(type, majorVersion, minorVersion);
}
ModelNode AbstractView::actualStateNode() const
{
if (model())
return ModelNode(m_model.data()->m_d->actualStateNode(), m_model.data(), const_cast<AbstractView*>(this));
return ModelNode(m_model.data()->d->actualStateNode(), m_model.data(), const_cast<AbstractView*>(this));
return ModelNode();
}
......
......@@ -81,9 +81,9 @@ void BindingProperty::setExpression(const QString &expression)
}
if (internalNode()->hasProperty(name()) && !internalNode()->property(name())->isBindingProperty())
model()->m_d->removeProperty(internalNode()->property(name()));
model()->d->removeProperty(internalNode()->property(name()));
model()->m_d->setBindingProperty(internalNode(), name(), expression);
model()->d->setBindingProperty(internalNode(), name(), expression);
}
QString BindingProperty::expression() const
......@@ -229,9 +229,9 @@ void BindingProperty::setDynamicTypeNameAndExpression(const QString &typeName, c
}
if (internalNode()->hasProperty(name()) && !internalNode()->property(name())->isBindingProperty())
model()->m_d->removeProperty(internalNode()->property(name()));
model()->d->removeProperty(internalNode()->property(name()));
model()->m_d->setDynamicBindingProperty(internalNode(), name(), typeName, expression);
model()->d->setDynamicBindingProperty(internalNode(), name(), typeName, expression);
}
BindingProperty& BindingProperty::operator= (const QPair<QString, QString> &typeExpressionPair)
......
......@@ -126,10 +126,10 @@ Model *ModelPrivate::create(QString type, int major, int minor, Model *metaInfoP
{
Model *model = new Model;
model->m_d->m_metaInfoProxyModel = metaInfoPropxyModel;
model->m_d->rootNode()->setType(type);
model->m_d->rootNode()->setMajorVersion(major);
model->m_d->rootNode()->setMinorVersion(minor);
model->d->m_metaInfoProxyModel = metaInfoPropxyModel;
model->d->rootNode()->setType(type);
model->d->rootNode()->setMajorVersion(major);
model->d->rootNode()->setMinorVersion(minor);
return model;
}
......@@ -1659,9 +1659,9 @@ WriteLocker::WriteLocker(ModelPrivate *model)
}
WriteLocker::WriteLocker(Model *model)
: m_model(model->m_d)
: m_model(model->d)
{
Q_ASSERT(model->m_d);
Q_ASSERT(model->d);
if (m_model->m_writeLock)
qWarning() << "QmlDesigner: Misbehaving view calls back to model!!!";
// FIXME: Enable it again
......@@ -1716,14 +1716,14 @@ WriteLocker::~WriteLocker()
Model::Model() :
QObject(),
m_d(new Internal::ModelPrivate(this))
d(new Internal::ModelPrivate(this))
{
}
Model::~Model()
{
delete m_d;
delete d;
}