Commit bfd9fcbb authored by hjk's avatar hjk Committed by hjk
Browse files

all: some m_d -> d style

Change-Id: Iac1f12980bf47666007817cfb2c64a6d1e9b780e
Reviewed-on: http://codereview.qt-project.org/4477

Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 66ab323e
......@@ -61,18 +61,18 @@ public:
} // namespace QmlJS
Icons::Icons()
: m_d(new IconsPrivate)
: d(new IconsPrivate)
{
m_d->elementIcon = QIcon(QLatin1String(":/qmljs/images/element.png"));
m_d->propertyIcon = QIcon(QLatin1String(":/qmljs/images/property.png"));
m_d->publicMemberIcon = QIcon(QLatin1String(":/qmljs/images/publicmember.png"));
m_d->functionDeclarationIcon = QIcon(QLatin1String(":/qmljs/images/func.png"));
d->elementIcon = QIcon(QLatin1String(":/qmljs/images/element.png"));
d->propertyIcon = QIcon(QLatin1String(":/qmljs/images/property.png"));
d->publicMemberIcon = QIcon(QLatin1String(":/qmljs/images/publicmember.png"));
d->functionDeclarationIcon = QIcon(QLatin1String(":/qmljs/images/func.png"));
}
Icons::~Icons()
{
m_instance = 0;
delete m_d;
delete d;
}
Icons *Icons::instance()
......@@ -84,10 +84,10 @@ Icons *Icons::instance()
void Icons::setIconFilesPath(const QString &iconPath)
{
if (iconPath == m_d->resourcePath)
if (iconPath == d->resourcePath)
return;
m_d->resourcePath = iconPath;
d->resourcePath = iconPath;
if (debug)
qDebug() << "QmlJSIcons -" << "parsing" << iconPath;
......@@ -107,7 +107,7 @@ void Icons::setIconFilesPath(const QString &iconPath)
if (debug)
qDebug() << "QmlJSIcons - adding" << packageName << iconFile.baseName() << "icon to database";
QPair<QString,QString> element(packageName, iconFile.baseName());
m_d->iconHash.insert(element, icon);
d->iconHash.insert(element, icon);
}
}
}
......@@ -116,8 +116,8 @@ QIcon Icons::icon(const QString &packageName, const QString typeName) const
{
QPair<QString,QString> element(packageName, typeName);
if (debug)
qDebug() << "QmlJSIcons - icon for" << packageName << typeName << "requested" << m_d->iconHash.contains(element);
return m_d->iconHash.value(element);
qDebug() << "QmlJSIcons - icon for" << packageName << typeName << "requested" << d->iconHash.contains(element);
return d->iconHash.value(element);
}
QIcon Icons::icon(Node *node) const
......@@ -134,20 +134,20 @@ QIcon Icons::icon(Node *node) const
QIcon Icons::objectDefinitionIcon() const
{
return m_d->elementIcon;
return d->elementIcon;
}
QIcon Icons::scriptBindingIcon() const
{
return m_d->propertyIcon;
return d->propertyIcon;
}
QIcon Icons::publicMemberIcon() const
{
return m_d->publicMemberIcon;
return d->publicMemberIcon;
}
QIcon Icons::functionDeclarationIcon() const
{
return m_d->functionDeclarationIcon;
return d->functionDeclarationIcon;
}
......@@ -61,7 +61,7 @@ public:
private:
Icons();
static Icons *m_instance;
IconsPrivate *m_d;
IconsPrivate *d;
};
} // namespace QmlJS
......
......@@ -57,124 +57,124 @@ struct CheckableMessageBoxPrivate {
CheckableMessageBox::CheckableMessageBox(QWidget *parent) :
QDialog(parent),
m_d(new CheckableMessageBoxPrivate)
d(new CheckableMessageBoxPrivate)
{
setModal(true);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_d->ui.setupUi(this);
m_d->ui.pixmapLabel->setVisible(false);
connect(m_d->ui.buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(m_d->ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(m_d->ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotClicked(QAbstractButton*)));
d->ui.setupUi(this);
d->ui.pixmapLabel->setVisible(false);
connect(d->ui.buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(d->ui.buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(d->ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotClicked(QAbstractButton*)));
}
CheckableMessageBox::~CheckableMessageBox()
{
delete m_d;
delete d;
}
void CheckableMessageBox::slotClicked(QAbstractButton *b)
{
m_d->clickedButton = b;
d->clickedButton = b;
}
QAbstractButton *CheckableMessageBox::clickedButton() const
{
return m_d->clickedButton;
return d->clickedButton;
}
QDialogButtonBox::StandardButton CheckableMessageBox::clickedStandardButton() const
{
if (m_d->clickedButton)
return m_d->ui.buttonBox->standardButton(m_d->clickedButton);
if (d->clickedButton)
return d->ui.buttonBox->standardButton(d->clickedButton);
return QDialogButtonBox::NoButton;
}
QString CheckableMessageBox::text() const
{
return m_d->ui.messageLabel->text();
return d->ui.messageLabel->text();
}
void CheckableMessageBox::setText(const QString &t)
{
m_d->ui.messageLabel->setText(t);
d->ui.messageLabel->setText(t);
}
QPixmap CheckableMessageBox::iconPixmap() const
{
if (const QPixmap *p = m_d->ui.pixmapLabel->pixmap())
if (const QPixmap *p = d->ui.pixmapLabel->pixmap())
return QPixmap(*p);
return QPixmap();
}
void CheckableMessageBox::setIconPixmap(const QPixmap &p)
{
m_d->ui.pixmapLabel->setPixmap(p);
m_d->ui.pixmapLabel->setVisible(!p.isNull());
d->ui.pixmapLabel->setPixmap(p);
d->ui.pixmapLabel->setVisible(!p.isNull());
}
bool CheckableMessageBox::isChecked() const
{
return m_d->ui.checkBox->isChecked();
return d->ui.checkBox->isChecked();
}
void CheckableMessageBox::setChecked(bool s)
{
m_d->ui.checkBox->setChecked(s);
d->ui.checkBox->setChecked(s);
}
QString CheckableMessageBox::checkBoxText() const
{
return m_d->ui.checkBox->text();
return d->ui.checkBox->text();
}
void CheckableMessageBox::setCheckBoxText(const QString &t)
{
m_d->ui.checkBox->setText(t);
d->ui.checkBox->setText(t);
}
bool CheckableMessageBox::isCheckBoxVisible() const
{
return m_d->ui.checkBox->isVisible();
return d->ui.checkBox->isVisible();
}
void CheckableMessageBox::setCheckBoxVisible(bool v)
{
m_d->ui.checkBox->setVisible(v);
d->ui.checkBox->setVisible(v);
}
QDialogButtonBox::StandardButtons CheckableMessageBox::standardButtons() const
{
return m_d->ui.buttonBox->standardButtons();
return d->ui.buttonBox->standardButtons();
}
void CheckableMessageBox::setStandardButtons(QDialogButtonBox::StandardButtons s)
{
m_d->ui.buttonBox->setStandardButtons(s);
d->ui.buttonBox->setStandardButtons(s);
}
QPushButton *CheckableMessageBox::button(QDialogButtonBox::StandardButton b) const
{
return m_d->ui.buttonBox->button(b);
return d->ui.buttonBox->button(b);
}
QPushButton *CheckableMessageBox::addButton(const QString &text, QDialogButtonBox::ButtonRole role)
{
return m_d->ui.buttonBox->addButton(text, role);
return d->ui.buttonBox->addButton(text, role);
}
QDialogButtonBox::StandardButton CheckableMessageBox::defaultButton() const
{
foreach (QAbstractButton *b, m_d->ui.buttonBox->buttons())
foreach (QAbstractButton *b, d->ui.buttonBox->buttons())
if (QPushButton *pb = qobject_cast<QPushButton *>(b))
if (pb->isDefault())
return m_d->ui.buttonBox->standardButton(pb);
return d->ui.buttonBox->standardButton(pb);
return QDialogButtonBox::NoButton;
}
void CheckableMessageBox::setDefaultButton(QDialogButtonBox::StandardButton s)
{
if (QPushButton *b = m_d->ui.buttonBox->button(s)) {
if (QPushButton *b = d->ui.buttonBox->button(s)) {
b->setDefault(true);
b->setFocus();
}
......
......@@ -100,7 +100,7 @@ private slots:
void slotClicked(QAbstractButton *b);
private:
CheckableMessageBoxPrivate *m_d;
CheckableMessageBoxPrivate *d;
};
} // namespace Utils
......
......@@ -68,28 +68,28 @@ ClassNameValidatingLineEditPrivate:: ClassNameValidatingLineEditPrivate() :
// --------------------- ClassNameValidatingLineEdit
ClassNameValidatingLineEdit::ClassNameValidatingLineEdit(QWidget *parent) :
Utils::BaseValidatingLineEdit(parent),
m_d(new ClassNameValidatingLineEditPrivate)
d(new ClassNameValidatingLineEditPrivate)
{
}
ClassNameValidatingLineEdit::~ClassNameValidatingLineEdit()
{
delete m_d;
delete d;
}
bool ClassNameValidatingLineEdit::namespacesEnabled() const
{
return m_d->m_namespacesEnabled;
return d->m_namespacesEnabled;
}
void ClassNameValidatingLineEdit::setNamespacesEnabled(bool b)
{
m_d->m_namespacesEnabled = b;
d->m_namespacesEnabled = b;
}
bool ClassNameValidatingLineEdit::validate(const QString &value, QString *errorMessage) const
{
if (!m_d->m_namespacesEnabled && value.contains(QLatin1Char(':'))) {
if (!d->m_namespacesEnabled && value.contains(QLatin1Char(':'))) {
if (errorMessage)
*errorMessage = tr("The class name must not contain namespace delimiters.");
return false;
......@@ -97,7 +97,7 @@ bool ClassNameValidatingLineEdit::validate(const QString &value, QString *errorM
if (errorMessage)
*errorMessage = tr("Please enter a class name.");
return false;
} else if (!m_d->m_nameRegexp.exactMatch(value)) {
} else if (!d->m_nameRegexp.exactMatch(value)) {
if (errorMessage)
*errorMessage = tr("The class name contains invalid characters.");
return false;
......@@ -110,11 +110,11 @@ void ClassNameValidatingLineEdit::slotChanged(const QString &t)
Utils::BaseValidatingLineEdit::slotChanged(t);
if (isValid()) {
// Suggest file names, strip namespaces
QString fileName = m_d->m_lowerCaseFileName ? t.toLower() : t;
if (m_d->m_namespacesEnabled) {
const int namespaceIndex = fileName.lastIndexOf(m_d->m_namespaceDelimiter);
QString fileName = d->m_lowerCaseFileName ? t.toLower() : t;
if (d->m_namespacesEnabled) {
const int namespaceIndex = fileName.lastIndexOf(d->m_namespaceDelimiter);
if (namespaceIndex != -1)
fileName.remove(0, namespaceIndex + m_d->m_namespaceDelimiter.size());
fileName.remove(0, namespaceIndex + d->m_namespaceDelimiter.size());
}
emit updateFileName(fileName);
}
......@@ -148,12 +148,12 @@ QString ClassNameValidatingLineEdit::createClassName(const QString &name)
bool ClassNameValidatingLineEdit::lowerCaseFileName() const
{
return m_d->m_lowerCaseFileName;
return d->m_lowerCaseFileName;
}
void ClassNameValidatingLineEdit::setLowerCaseFileName(bool v)
{
m_d->m_lowerCaseFileName = v;
d->m_lowerCaseFileName = v;
}
} // namespace Utils
......@@ -70,7 +70,7 @@ protected:
virtual void slotChanged(const QString &t);
private:
ClassNameValidatingLineEditPrivate *m_d;
ClassNameValidatingLineEditPrivate *d;
};
} // namespace Utils
......
......@@ -93,26 +93,26 @@ public:
EnvironmentModel::EnvironmentModel(QObject *parent) :
QAbstractTableModel(parent),
m_d(new Internal::EnvironmentModelPrivate)
d(new Internal::EnvironmentModelPrivate)
{ }
EnvironmentModel::~EnvironmentModel()
{
delete m_d;
delete d;
}
QString EnvironmentModel::indexToVariable(const QModelIndex &index) const
{
return m_d->m_resultEnvironment.key(m_d->m_resultEnvironment.constBegin() + index.row());
return d->m_resultEnvironment.key(d->m_resultEnvironment.constBegin() + index.row());
}
void EnvironmentModel::setBaseEnvironment(const Utils::Environment &env)
{
if (m_d->m_baseEnvironment == env)
if (d->m_baseEnvironment == env)
return;
beginResetModel();
m_d->m_baseEnvironment = env;
m_d->updateResultEnvironment();
d->m_baseEnvironment = env;
d->updateResultEnvironment();
endResetModel();
}
......@@ -121,7 +121,7 @@ int EnvironmentModel::rowCount(const QModelIndex &parent) const
if (parent.isValid())
return 0;
return m_d->m_resultEnvironment.size();
return d->m_resultEnvironment.size();
}
int EnvironmentModel::columnCount(const QModelIndex &parent) const
{
......@@ -133,7 +133,7 @@ int EnvironmentModel::columnCount(const QModelIndex &parent) const
bool EnvironmentModel::changes(const QString &name) const
{
return m_d->findInChanges(name) >= 0;
return d->findInChanges(name) >= 0;
}
QVariant EnvironmentModel::data(const QModelIndex &index, int role) const
......@@ -143,20 +143,20 @@ QVariant EnvironmentModel::data(const QModelIndex &index, int role) const
if (role == Qt::DisplayRole || role == Qt::EditRole || role == Qt::ToolTipRole) {
if (index.column() == 0) {
return m_d->m_resultEnvironment.key(m_d->m_resultEnvironment.constBegin() + index.row());
return d->m_resultEnvironment.key(d->m_resultEnvironment.constBegin() + index.row());
} else if (index.column() == 1) {
// Do not return "<UNSET>" when editing a previously unset variable:
if (role == Qt::EditRole) {
int pos = m_d->findInChanges(indexToVariable(index));
int pos = d->findInChanges(indexToVariable(index));
if (pos >= 0)
return m_d->m_items.at(pos).value;
return d->m_items.at(pos).value;
}
return m_d->m_resultEnvironment.value(m_d->m_resultEnvironment.constBegin() + index.row());
return d->m_resultEnvironment.value(d->m_resultEnvironment.constBegin() + index.row());
}
}
if (role == Qt::FontRole) {
// check whether this environment variable exists in m_d->m_items
if (changes(m_d->m_resultEnvironment.key(m_d->m_resultEnvironment.constBegin() + index.row()))) {
if (changes(d->m_resultEnvironment.key(d->m_resultEnvironment.constBegin() + index.row()))) {
QFont f;
f.setBold(true);
return QVariant(f);
......@@ -184,7 +184,7 @@ QVariant EnvironmentModel::headerData(int section, Qt::Orientation orientation,
/// *****************
QModelIndex EnvironmentModel::variableToIndex(const QString &name) const
{
int row = m_d->findInResult(name);
int row = d->findInResult(name);
if (row == -1)
return QModelIndex();
return index(row, 0);
......@@ -201,7 +201,7 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value,
const QString oldName = data(this->index(index.row(), 0, QModelIndex())).toString();
const QString oldValue = data(this->index(index.row(), 1, QModelIndex())).toString();
int changesPos = m_d->findInChanges(oldName);
int changesPos = d->findInChanges(oldName);
if (index.column() == 0) {
//fail if a variable with the same name already exists
......@@ -211,7 +211,7 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value,
const QString &newName = value.toString();
#endif
// Does the new name exist already?
if (m_d->m_resultEnvironment.hasKey(newName))
if (d->m_resultEnvironment.hasKey(newName))
return false;
Utils::EnvironmentItem newVariable(newName, oldValue);
......@@ -227,19 +227,19 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value,
const QString stringValue = value.toString();
if (changesPos != -1) {
// We have already changed this value
if (stringValue == m_d->m_baseEnvironment.value(oldName)) {
if (stringValue == d->m_baseEnvironment.value(oldName)) {
// ... and now went back to the base value
m_d->m_items.removeAt(changesPos);
d->m_items.removeAt(changesPos);
} else {
// ... and changed it again
m_d->m_items[changesPos].value = stringValue;
m_d->m_items[changesPos].unset = false;
d->m_items[changesPos].value = stringValue;
d->m_items[changesPos].unset = false;
}
} else {
// Add a new change item:
m_d->m_items.append(Utils::EnvironmentItem(oldName, stringValue));
d->m_items.append(Utils::EnvironmentItem(oldName, stringValue));
}
m_d->updateResultEnvironment();
d->updateResultEnvironment();
emit dataChanged(index, index);
emit userChangesChanged();
return true;
......@@ -259,28 +259,28 @@ QModelIndex EnvironmentModel::addVariable(const Utils::EnvironmentItem &item)
{
// Return existing index if the name is already in the result set:
int pos = m_d->findInResult(item.name);
if (pos >= 0 && pos < m_d->m_resultEnvironment.size())
int pos = d->findInResult(item.name);
if (pos >= 0 && pos < d->m_resultEnvironment.size())
return index(pos, 0, QModelIndex());
int insertPos = m_d->findInResultInsertPosition(item.name);
int changePos = m_d->findInChanges(item.name);
if (m_d->m_baseEnvironment.hasKey(item.name)) {
int insertPos = d->findInResultInsertPosition(item.name);
int changePos = d->findInChanges(item.name);
if (d->m_baseEnvironment.hasKey(item.name)) {
// We previously unset this!
Q_ASSERT(changePos >= 0);
// Do not insert a line here as we listed the variable as <UNSET> before!
Q_ASSERT(m_d->m_items.at(changePos).name == item.name);
Q_ASSERT(m_d->m_items.at(changePos).unset);
Q_ASSERT(m_d->m_items.at(changePos).value.isEmpty());
m_d->m_items[changePos] = item;
Q_ASSERT(d->m_items.at(changePos).name == item.name);
Q_ASSERT(d->m_items.at(changePos).unset);
Q_ASSERT(d->m_items.at(changePos).value.isEmpty());
d->m_items[changePos] = item;
emit dataChanged(index(insertPos, 0, QModelIndex()), index(insertPos, 1, QModelIndex()));
} else {
// We add something that is not in the base environment
// Insert a new line!
beginInsertRows(QModelIndex(), insertPos, insertPos);
Q_ASSERT(changePos < 0);
m_d->m_items.append(item);
m_d->updateResultEnvironment();
d->m_items.append(item);
d->updateResultEnvironment();
endInsertRows();
}
emit userChangesChanged();
......@@ -289,24 +289,24 @@ QModelIndex EnvironmentModel::addVariable(const Utils::EnvironmentItem &item)
void EnvironmentModel::resetVariable(const QString &name)
{
int rowInChanges = m_d->findInChanges(name);
int rowInChanges = d->findInChanges(name);
if (rowInChanges < 0)
return;
int rowInResult = m_d->findInResult(name);
int rowInResult = d->findInResult(name);
if (rowInResult < 0)
return;
if (m_d->m_baseEnvironment.hasKey(name)) {
m_d->m_items.removeAt(rowInChanges);
m_d->updateResultEnvironment();
if (d->m_baseEnvironment.hasKey(name)) {
d->m_items.removeAt(rowInChanges);
d->updateResultEnvironment();
emit dataChanged(index(rowInResult, 0, QModelIndex()), index(rowInResult, 1, QModelIndex()));
emit userChangesChanged();
} else {
// Remove the line completely!
beginRemoveRows(QModelIndex(), rowInResult, rowInResult);
m_d->m_items.removeAt(rowInChanges);
m_d->updateResultEnvironment();
d->m_items.removeAt(rowInChanges);
d->updateResultEnvironment();
endRemoveRows();
emit userChangesChanged();
}
......@@ -316,55 +316,55 @@ void EnvironmentModel::unsetVariable(const QString &name)
{
// This does not change the number of rows as we will display a <UNSET>
// in place of the original variable!
int row = m_d->findInResult(name);
int row = d->findInResult(name);
if (row < 0)
return;
// look in m_d->m_items for the variable
int pos = m_d->findInChanges(name);
int pos = d->findInChanges(name);
if (pos != -1) {
m_d->m_items[pos].unset = true;
m_d->m_items[pos].value.clear();
m_d->updateResultEnvironment();
d->m_items[pos].unset = true;
d->m_items[pos].value.clear();
d->updateResultEnvironment();
emit dataChanged(index(row, 0, QModelIndex()), index(row, 1, QModelIndex()));
emit userChangesChanged();
return;
}
Utils::EnvironmentItem item(name, QString());
item.unset = true;
m_d->m_items.append(item);
m_d->updateResultEnvironment();
d->m_items.append(item);
d->updateResultEnvironment();
emit dataChanged(index(row, 0, QModelIndex()), index(row, 1, QModelIndex()));
emit userChangesChanged();
}
bool EnvironmentModel::canUnset(const QString &name)
{
int pos = m_d->findInChanges(name);
int pos = d->findInChanges(name);
if (pos != -1)
return m_d->m_items.at(pos).unset;
return d->m_items.at(pos).unset;
else
return false;
}
bool EnvironmentModel::canReset(const QString &name)
{
return m_d->m_baseEnvironment.hasKey(name);
return d->m_baseEnvironment.hasKey(name);
}
QList<Utils::EnvironmentItem> EnvironmentModel::userChanges() const
{
return m_d->m_items;
return d->m_items;
}
void EnvironmentModel