forked from qt-creator/qt-creator
Talked to hjk, restore back Q_ASSERTs, since qtcassert.h lies outside of shared dir
This commit is contained in:
@@ -35,7 +35,7 @@
|
|||||||
#include "sizehandlerect.h"
|
#include "sizehandlerect.h"
|
||||||
#include "widgethostconstants.h"
|
#include "widgethostconstants.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
#include <QtDesigner/QDesignerFormWindowInterface>
|
#include <QtDesigner/QDesignerFormWindowInterface>
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ void FormResizer::setFormWindow(QDesignerFormWindowInterface *fw)
|
|||||||
if (debugFormResizer)
|
if (debugFormResizer)
|
||||||
qDebug() << "FormResizer::setFormWindow " << fw;
|
qDebug() << "FormResizer::setFormWindow " << fw;
|
||||||
QVBoxLayout *layout = qobject_cast<QVBoxLayout *>(m_frame->layout());
|
QVBoxLayout *layout = qobject_cast<QVBoxLayout *>(m_frame->layout());
|
||||||
QTC_ASSERT(layout, return);
|
Q_ASSERT(layout);
|
||||||
if (layout->count())
|
if (layout->count())
|
||||||
delete layout->takeAt(0);
|
delete layout->takeAt(0);
|
||||||
m_formWindow = fw;
|
m_formWindow = fw;
|
||||||
|
|||||||
@@ -33,8 +33,6 @@
|
|||||||
|
|
||||||
#include "indenter.h"
|
#include "indenter.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
using namespace SharedTools::IndenterInternal;
|
using namespace SharedTools::IndenterInternal;
|
||||||
|
|
||||||
// --- Constants
|
// --- Constants
|
||||||
@@ -59,10 +57,10 @@ Constants::Constants() :
|
|||||||
{
|
{
|
||||||
m_literal.setMinimal(true);
|
m_literal.setMinimal(true);
|
||||||
m_inlineCComment.setMinimal(true);
|
m_inlineCComment.setMinimal(true);
|
||||||
QTC_ASSERT(m_literal.isValid(), return);
|
Q_ASSERT(m_literal.isValid());
|
||||||
QTC_ASSERT(m_label.isValid(), return);
|
Q_ASSERT(m_label.isValid());
|
||||||
QTC_ASSERT(m_inlineCComment.isValid(), return);
|
Q_ASSERT(m_inlineCComment.isValid());
|
||||||
QTC_ASSERT(m_braceX.isValid(), return);
|
Q_ASSERT(m_braceX.isValid());
|
||||||
QTC_ASSERT(m_iflikeKeyword.isValid(), return);
|
Q_ASSERT(m_iflikeKeyword.isValid());
|
||||||
QTC_ASSERT(m_caseLabel.isValid(), return);
|
Q_ASSERT(m_caseLabel.isValid());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,6 @@
|
|||||||
|
|
||||||
#include "procommandmanager.h"
|
#include "procommandmanager.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace Qt4ProjectManager::Internal;
|
||||||
|
|
||||||
ProCommandGroup::ProCommandGroup(const QString &name)
|
ProCommandGroup::ProCommandGroup(const QString &name)
|
||||||
@@ -78,7 +76,7 @@ ProCommandManager::~ProCommandManager()
|
|||||||
|
|
||||||
void ProCommandManager::beginGroup(const QString &name)
|
void ProCommandManager::beginGroup(const QString &name)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(!m_group, return);
|
Q_ASSERT(!m_group);
|
||||||
|
|
||||||
if (m_pos != m_groups.count()) {
|
if (m_pos != m_groups.count()) {
|
||||||
int removecount = m_groups.count() - m_pos;
|
int removecount = m_groups.count() - m_pos;
|
||||||
@@ -97,7 +95,7 @@ bool ProCommandManager::hasGroup() const
|
|||||||
|
|
||||||
void ProCommandManager::endGroup()
|
void ProCommandManager::endGroup()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_group, return);
|
Q_ASSERT(m_group);
|
||||||
|
|
||||||
m_groups.append(m_group);
|
m_groups.append(m_group);
|
||||||
m_pos = m_groups.count();
|
m_pos = m_groups.count();
|
||||||
@@ -108,7 +106,7 @@ void ProCommandManager::endGroup()
|
|||||||
|
|
||||||
bool ProCommandManager::command(ProCommand *cmd)
|
bool ProCommandManager::command(ProCommand *cmd)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_group, return false);
|
Q_ASSERT(m_group);
|
||||||
|
|
||||||
if (cmd->redo()) {
|
if (cmd->redo()) {
|
||||||
m_group->appendCommand(cmd);
|
m_group->appendCommand(cmd);
|
||||||
|
|||||||
@@ -35,8 +35,6 @@
|
|||||||
#include "proparserutils.h"
|
#include "proparserutils.h"
|
||||||
#include "proitems.h"
|
#include "proitems.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
#include <QtCore/QByteArray>
|
#include <QtCore/QByteArray>
|
||||||
#include <QtCore/QDateTime>
|
#include <QtCore/QDateTime>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
@@ -824,7 +822,7 @@ bool ProFileEvaluator::Private::visitProFunction(ProFunction *func)
|
|||||||
QString text = func->text();
|
QString text = func->text();
|
||||||
int lparen = text.indexOf(QLatin1Char('('));
|
int lparen = text.indexOf(QLatin1Char('('));
|
||||||
int rparen = text.lastIndexOf(QLatin1Char(')'));
|
int rparen = text.lastIndexOf(QLatin1Char(')'));
|
||||||
QTC_ASSERT(lparen < rparen, return false);
|
Q_ASSERT(lparen < rparen);
|
||||||
QString arguments = text.mid(lparen + 1, rparen - lparen - 1);
|
QString arguments = text.mid(lparen + 1, rparen - lparen - 1);
|
||||||
QString funcName = text.left(lparen);
|
QString funcName = text.left(lparen);
|
||||||
m_lineNo = func->lineNumber();
|
m_lineNo = func->lineNumber();
|
||||||
|
|||||||
@@ -33,8 +33,6 @@
|
|||||||
|
|
||||||
#include "resourcefile_p.h"
|
#include "resourcefile_p.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
#include <QtCore/QCoreApplication>
|
#include <QtCore/QCoreApplication>
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
@@ -119,7 +117,7 @@ bool ResourceFile::load()
|
|||||||
} else {
|
} else {
|
||||||
p = m_prefix_list[idx];
|
p = m_prefix_list[idx];
|
||||||
}
|
}
|
||||||
QTC_ASSERT(p, return false);
|
Q_ASSERT(p);
|
||||||
|
|
||||||
QDomElement felt = relt.firstChildElement(QLatin1String("file"));
|
QDomElement felt = relt.firstChildElement(QLatin1String("file"));
|
||||||
for (; !felt.isNull(); felt = felt.nextSiblingElement(QLatin1String("file"))) {
|
for (; !felt.isNull(); felt = felt.nextSiblingElement(QLatin1String("file"))) {
|
||||||
@@ -251,7 +249,7 @@ bool ResourceFile::isEmpty() const
|
|||||||
QStringList ResourceFile::fileList(int pref_idx) const
|
QStringList ResourceFile::fileList(int pref_idx) const
|
||||||
{
|
{
|
||||||
QStringList result;
|
QStringList result;
|
||||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return result);
|
Q_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count());
|
||||||
const FileList &abs_file_list = m_prefix_list.at(pref_idx)->file_list;
|
const FileList &abs_file_list = m_prefix_list.at(pref_idx)->file_list;
|
||||||
foreach (const File *abs_file, abs_file_list)
|
foreach (const File *abs_file, abs_file_list)
|
||||||
result.append(relativePath(abs_file->name));
|
result.append(relativePath(abs_file->name));
|
||||||
@@ -261,9 +259,9 @@ QStringList ResourceFile::fileList(int pref_idx) const
|
|||||||
void ResourceFile::addFile(int prefix_idx, const QString &file, int file_idx)
|
void ResourceFile::addFile(int prefix_idx, const QString &file, int file_idx)
|
||||||
{
|
{
|
||||||
Prefix * const p = m_prefix_list[prefix_idx];
|
Prefix * const p = m_prefix_list[prefix_idx];
|
||||||
QTC_ASSERT(p, return);
|
Q_ASSERT(p);
|
||||||
FileList &files = p->file_list;
|
FileList &files = p->file_list;
|
||||||
QTC_ASSERT(file_idx >= -1 && file_idx <= files.size(), return);
|
Q_ASSERT(file_idx >= -1 && file_idx <= files.size());
|
||||||
if (file_idx == -1)
|
if (file_idx == -1)
|
||||||
file_idx = files.size();
|
file_idx = files.size();
|
||||||
files.insert(file_idx, new File(p, absolutePath(file)));
|
files.insert(file_idx, new File(p, absolutePath(file)));
|
||||||
@@ -275,7 +273,7 @@ void ResourceFile::addPrefix(const QString &prefix, int prefix_idx)
|
|||||||
if (indexOfPrefix(fixed_prefix) != -1)
|
if (indexOfPrefix(fixed_prefix) != -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QTC_ASSERT(prefix_idx >= -1 && prefix_idx <= m_prefix_list.size(), return);
|
Q_ASSERT(prefix_idx >= -1 && prefix_idx <= m_prefix_list.size());
|
||||||
if (prefix_idx == -1)
|
if (prefix_idx == -1)
|
||||||
prefix_idx = m_prefix_list.size();
|
prefix_idx = m_prefix_list.size();
|
||||||
m_prefix_list.insert(prefix_idx, new Prefix(fixed_prefix));
|
m_prefix_list.insert(prefix_idx, new Prefix(fixed_prefix));
|
||||||
@@ -283,7 +281,7 @@ void ResourceFile::addPrefix(const QString &prefix, int prefix_idx)
|
|||||||
|
|
||||||
void ResourceFile::removePrefix(int prefix_idx)
|
void ResourceFile::removePrefix(int prefix_idx)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||||
Prefix * const p = m_prefix_list.at(prefix_idx);
|
Prefix * const p = m_prefix_list.at(prefix_idx);
|
||||||
delete p;
|
delete p;
|
||||||
m_prefix_list.removeAt(prefix_idx);
|
m_prefix_list.removeAt(prefix_idx);
|
||||||
@@ -291,39 +289,39 @@ void ResourceFile::removePrefix(int prefix_idx)
|
|||||||
|
|
||||||
void ResourceFile::removeFile(int prefix_idx, int file_idx)
|
void ResourceFile::removeFile(int prefix_idx, int file_idx)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||||
FileList &fileList = m_prefix_list[prefix_idx]->file_list;
|
FileList &fileList = m_prefix_list[prefix_idx]->file_list;
|
||||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
|
Q_ASSERT(file_idx >= 0 && file_idx < fileList.count());
|
||||||
delete fileList.at(file_idx);
|
delete fileList.at(file_idx);
|
||||||
fileList.removeAt(file_idx);
|
fileList.removeAt(file_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceFile::replacePrefix(int prefix_idx, const QString &prefix)
|
void ResourceFile::replacePrefix(int prefix_idx, const QString &prefix)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||||
m_prefix_list[prefix_idx]->name = fixPrefix(prefix);
|
m_prefix_list[prefix_idx]->name = fixPrefix(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceFile::replaceLang(int prefix_idx, const QString &lang)
|
void ResourceFile::replaceLang(int prefix_idx, const QString &lang)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||||
m_prefix_list[prefix_idx]->lang = lang;
|
m_prefix_list[prefix_idx]->lang = lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceFile::replaceAlias(int prefix_idx, int file_idx, const QString &alias)
|
void ResourceFile::replaceAlias(int prefix_idx, int file_idx, const QString &alias)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||||
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
||||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
|
Q_ASSERT(file_idx >= 0 && file_idx < fileList.count());
|
||||||
fileList[file_idx]->alias = alias;
|
fileList[file_idx]->alias = alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ResourceFile::replaceFile(int pref_idx, int file_idx, const QString &file)
|
void ResourceFile::replaceFile(int pref_idx, int file_idx, const QString &file)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return);
|
Q_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count());
|
||||||
FileList &fileList = m_prefix_list.at(pref_idx)->file_list;
|
FileList &fileList = m_prefix_list.at(pref_idx)->file_list;
|
||||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
|
Q_ASSERT(file_idx >= 0 && file_idx < fileList.count());
|
||||||
fileList[file_idx]->name = file;
|
fileList[file_idx]->name = file;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,7 +337,7 @@ int ResourceFile::indexOfPrefix(const QString &prefix) const
|
|||||||
|
|
||||||
int ResourceFile::indexOfFile(int pref_idx, const QString &file) const
|
int ResourceFile::indexOfFile(int pref_idx, const QString &file) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return -1);
|
Q_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count());
|
||||||
Prefix * const p = m_prefix_list.at(pref_idx);
|
Prefix * const p = m_prefix_list.at(pref_idx);
|
||||||
File equalFile(p, absolutePath(file));
|
File equalFile(p, absolutePath(file));
|
||||||
return p->file_list.indexOf(&equalFile);
|
return p->file_list.indexOf(&equalFile);
|
||||||
@@ -373,16 +371,16 @@ bool ResourceFile::contains(const QString &prefix, const QString &file) const
|
|||||||
return false;
|
return false;
|
||||||
if (file.isEmpty())
|
if (file.isEmpty())
|
||||||
return true;
|
return true;
|
||||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return false);
|
Q_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count());
|
||||||
Prefix * const p = m_prefix_list.at(pref_idx);
|
Prefix * const p = m_prefix_list.at(pref_idx);
|
||||||
QTC_ASSERT(p, return false);
|
Q_ASSERT(p);
|
||||||
File equalFile(p, absolutePath(file));
|
File equalFile(p, absolutePath(file));
|
||||||
return p->file_list.contains(&equalFile);
|
return p->file_list.contains(&equalFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ResourceFile::contains(int pref_idx, const QString &file) const
|
bool ResourceFile::contains(int pref_idx, const QString &file) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return false);
|
Q_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count());
|
||||||
Prefix * const p = m_prefix_list.at(pref_idx);
|
Prefix * const p = m_prefix_list.at(pref_idx);
|
||||||
File equalFile(p, absolutePath(file));
|
File equalFile(p, absolutePath(file));
|
||||||
return p->file_list.contains(&equalFile);
|
return p->file_list.contains(&equalFile);
|
||||||
@@ -412,49 +410,49 @@ int ResourceFile::prefixCount() const
|
|||||||
|
|
||||||
QString ResourceFile::prefix(int idx) const
|
QString ResourceFile::prefix(int idx) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT((idx >= 0) && (idx < m_prefix_list.count()), return QString());
|
Q_ASSERT((idx >= 0) && (idx < m_prefix_list.count()));
|
||||||
return m_prefix_list.at(idx)->name;
|
return m_prefix_list.at(idx)->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ResourceFile::lang(int idx) const
|
QString ResourceFile::lang(int idx) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(idx >= 0 && idx < m_prefix_list.count(), return QString());
|
Q_ASSERT(idx >= 0 && idx < m_prefix_list.count());
|
||||||
return m_prefix_list.at(idx)->lang;
|
return m_prefix_list.at(idx)->lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ResourceFile::fileCount(int prefix_idx) const
|
int ResourceFile::fileCount(int prefix_idx) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return 0);
|
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||||
return m_prefix_list.at(prefix_idx)->file_list.size();
|
return m_prefix_list.at(prefix_idx)->file_list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ResourceFile::file(int prefix_idx, int file_idx) const
|
QString ResourceFile::file(int prefix_idx, int file_idx) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return QString());
|
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||||
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
||||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return QString());
|
Q_ASSERT(file_idx >= 0 && file_idx < fileList.count());
|
||||||
return fileList.at(file_idx)->name;
|
return fileList.at(file_idx)->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ResourceFile::alias(int prefix_idx, int file_idx) const
|
QString ResourceFile::alias(int prefix_idx, int file_idx) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return QString());
|
Q_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count());
|
||||||
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
||||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return QString());
|
Q_ASSERT(file_idx >= 0 && file_idx < fileList.count());
|
||||||
return fileList.at(file_idx)->alias;
|
return fileList.at(file_idx)->alias;
|
||||||
}
|
}
|
||||||
|
|
||||||
void * ResourceFile::prefixPointer(int prefixIndex) const
|
void * ResourceFile::prefixPointer(int prefixIndex) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(prefixIndex >= 0 && prefixIndex < m_prefix_list.count(), return 0);
|
Q_ASSERT(prefixIndex >= 0 && prefixIndex < m_prefix_list.count());
|
||||||
return m_prefix_list.at(prefixIndex);
|
return m_prefix_list.at(prefixIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void * ResourceFile::filePointer(int prefixIndex, int fileIndex) const
|
void * ResourceFile::filePointer(int prefixIndex, int fileIndex) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(prefixIndex >= 0 && prefixIndex < m_prefix_list.count(), return 0);
|
Q_ASSERT(prefixIndex >= 0 && prefixIndex < m_prefix_list.count());
|
||||||
FileList &fileList = m_prefix_list.at(prefixIndex)->file_list;
|
FileList &fileList = m_prefix_list.at(prefixIndex)->file_list;
|
||||||
QTC_ASSERT(fileIndex >= 0 && fileIndex < fileList.count(), return 0);
|
Q_ASSERT(fileIndex >= 0 && fileIndex < fileList.count());
|
||||||
return fileList.at(fileIndex);
|
return fileList.at(fileIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,7 +507,7 @@ QModelIndex ResourceModel::index(int row, int column, const QModelIndex &parent)
|
|||||||
// File node
|
// File node
|
||||||
Node * const node = reinterpret_cast<Node *>(pip);
|
Node * const node = reinterpret_cast<Node *>(pip);
|
||||||
Prefix * const prefix = node->prefix();
|
Prefix * const prefix = node->prefix();
|
||||||
QTC_ASSERT(prefix, return QModelIndex());
|
Q_ASSERT(prefix);
|
||||||
if (row < 0 || row >= prefix->file_list.count())
|
if (row < 0 || row >= prefix->file_list.count())
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
const int prefixIndex = m_resource_file.prefixPointerIndex(prefix);
|
const int prefixIndex = m_resource_file.prefixPointerIndex(prefix);
|
||||||
@@ -521,7 +519,7 @@ QModelIndex ResourceModel::index(int row, int column, const QModelIndex &parent)
|
|||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
internalPointer = m_resource_file.prefixPointer(row);
|
internalPointer = m_resource_file.prefixPointer(row);
|
||||||
}
|
}
|
||||||
QTC_ASSERT(internalPointer, return QModelIndex());
|
Q_ASSERT(internalPointer);
|
||||||
return createIndex(row, 0, internalPointer);
|
return createIndex(row, 0, internalPointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -535,12 +533,12 @@ QModelIndex ResourceModel::parent(const QModelIndex &index) const
|
|||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||||
Prefix * const prefix = node->prefix();
|
Prefix * const prefix = node->prefix();
|
||||||
QTC_ASSERT(prefix, return QModelIndex());
|
Q_ASSERT(prefix);
|
||||||
bool const isFileNode = (prefix != node);
|
bool const isFileNode = (prefix != node);
|
||||||
|
|
||||||
if (isFileNode) {
|
if (isFileNode) {
|
||||||
const int row = m_resource_file.prefixPointerIndex(prefix);
|
const int row = m_resource_file.prefixPointerIndex(prefix);
|
||||||
QTC_ASSERT(row >= 0, return QModelIndex());
|
Q_ASSERT(row >= 0);
|
||||||
return createIndex(row, 0, prefix);
|
return createIndex(row, 0, prefix);
|
||||||
} else {
|
} else {
|
||||||
return QModelIndex();
|
return QModelIndex();
|
||||||
@@ -553,7 +551,7 @@ int ResourceModel::rowCount(const QModelIndex &parent) const
|
|||||||
void * const internalPointer = parent.internalPointer();
|
void * const internalPointer = parent.internalPointer();
|
||||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||||
Prefix * const prefix = node->prefix();
|
Prefix * const prefix = node->prefix();
|
||||||
QTC_ASSERT(prefix, return 0);
|
Q_ASSERT(prefix);
|
||||||
bool const isFileNode = (prefix != node);
|
bool const isFileNode = (prefix != node);
|
||||||
|
|
||||||
if (isFileNode) {
|
if (isFileNode) {
|
||||||
@@ -612,7 +610,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
|||||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||||
Prefix const * const prefix = node->prefix();
|
Prefix const * const prefix = node->prefix();
|
||||||
File const * const file = node->file();
|
File const * const file = node->file();
|
||||||
QTC_ASSERT(prefix, return QVariant());
|
Q_ASSERT(prefix);
|
||||||
bool const isFileNode = (prefix != node);
|
bool const isFileNode = (prefix != node);
|
||||||
|
|
||||||
QVariant result;
|
QVariant result;
|
||||||
@@ -629,7 +627,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
|||||||
appendParenthesized(lang, stringRes);
|
appendParenthesized(lang, stringRes);
|
||||||
} else {
|
} else {
|
||||||
// File node
|
// File node
|
||||||
QTC_ASSERT(file, return result);
|
Q_ASSERT(file);
|
||||||
stringRes = QFileInfo(file->name).fileName();
|
stringRes = QFileInfo(file->name).fileName();
|
||||||
const QString alias = file->alias;
|
const QString alias = file->alias;
|
||||||
if (!alias.isEmpty())
|
if (!alias.isEmpty())
|
||||||
@@ -641,7 +639,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
|||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
if (isFileNode) {
|
if (isFileNode) {
|
||||||
// File node
|
// File node
|
||||||
QTC_ASSERT(file, return result);
|
Q_ASSERT(file);
|
||||||
const QString path = m_resource_file.absolutePath(file->name);
|
const QString path = m_resource_file.absolutePath(file->name);
|
||||||
if (iconFileExtension(path)) {
|
if (iconFileExtension(path)) {
|
||||||
const QIcon icon(path);
|
const QIcon icon(path);
|
||||||
@@ -653,7 +651,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
|||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
if (isFileNode) {
|
if (isFileNode) {
|
||||||
// File node
|
// File node
|
||||||
QTC_ASSERT(file, return result);
|
Q_ASSERT(file);
|
||||||
QString conv_file = m_resource_file.relativePath(file->name);
|
QString conv_file = m_resource_file.relativePath(file->name);
|
||||||
QString stringRes = conv_file.replace(QDir::separator(), QLatin1Char('/'));
|
QString stringRes = conv_file.replace(QDir::separator(), QLatin1Char('/'));
|
||||||
const QString &alias_file = file->alias;
|
const QString &alias_file = file->alias;
|
||||||
@@ -682,12 +680,12 @@ void ResourceModel::getItem(const QModelIndex &index, QString &prefix, QString &
|
|||||||
void * const internalPointer = index.internalPointer();
|
void * const internalPointer = index.internalPointer();
|
||||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||||
Prefix * const p = node->prefix();
|
Prefix * const p = node->prefix();
|
||||||
QTC_ASSERT(p, return);
|
Q_ASSERT(p);
|
||||||
bool const isFileNode = (p != node);
|
bool const isFileNode = (p != node);
|
||||||
|
|
||||||
if (isFileNode) {
|
if (isFileNode) {
|
||||||
File *const f = node->file();
|
File *const f = node->file();
|
||||||
QTC_ASSERT(f, return);
|
Q_ASSERT(f);
|
||||||
if (!f->alias.isEmpty())
|
if (!f->alias.isEmpty())
|
||||||
file = f->alias;
|
file = f->alias;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -36,8 +36,6 @@
|
|||||||
|
|
||||||
#include "namespace_global.h"
|
#include "namespace_global.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
#include <QtCore/QAbstractItemModel>
|
#include <QtCore/QAbstractItemModel>
|
||||||
#include <QtCore/QMap>
|
#include <QtCore/QMap>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
@@ -68,7 +66,7 @@ class Node
|
|||||||
protected:
|
protected:
|
||||||
Node(File *file, Prefix *prefix) : m_file(file), m_prefix(prefix)
|
Node(File *file, Prefix *prefix) : m_file(file), m_prefix(prefix)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_prefix, return);
|
Q_ASSERT(m_prefix);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
File *file() { return m_file; }
|
File *file() { return m_file; }
|
||||||
|
|||||||
@@ -35,8 +35,6 @@
|
|||||||
|
|
||||||
#include "undocommands_p.h"
|
#include "undocommands_p.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
@@ -312,14 +310,14 @@ void ResourceView::findSamePlacePostDeletionModelIndex(int &row, QModelIndex &pa
|
|||||||
|
|
||||||
EntryBackup * ResourceView::removeEntry(const QModelIndex &index)
|
EntryBackup * ResourceView::removeEntry(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_qrcModel, return 0);
|
Q_ASSERT(m_qrcModel);
|
||||||
return m_qrcModel->removeEntry(index);
|
return m_qrcModel->removeEntry(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResourceView::addFiles(int prefixIndex, const QStringList &fileNames, int cursorFile,
|
void ResourceView::addFiles(int prefixIndex, const QStringList &fileNames, int cursorFile,
|
||||||
int &firstFile, int &lastFile)
|
int &firstFile, int &lastFile)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_qrcModel, return);
|
Q_ASSERT(m_qrcModel);
|
||||||
m_qrcModel->addFiles(prefixIndex, fileNames, cursorFile, firstFile, lastFile);
|
m_qrcModel->addFiles(prefixIndex, fileNames, cursorFile, firstFile, lastFile);
|
||||||
|
|
||||||
// Expand prefix node
|
// Expand prefix node
|
||||||
@@ -331,11 +329,11 @@ void ResourceView::addFiles(int prefixIndex, const QStringList &fileNames, int c
|
|||||||
|
|
||||||
void ResourceView::removeFiles(int prefixIndex, int firstFileIndex, int lastFileIndex)
|
void ResourceView::removeFiles(int prefixIndex, int firstFileIndex, int lastFileIndex)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(prefixIndex >= 0 && prefixIndex < m_qrcModel->rowCount(QModelIndex()), return);
|
Q_ASSERT(prefixIndex >= 0 && prefixIndex < m_qrcModel->rowCount(QModelIndex()));
|
||||||
const QModelIndex prefixModelIndex = m_qrcModel->index(prefixIndex, 0, QModelIndex());
|
const QModelIndex prefixModelIndex = m_qrcModel->index(prefixIndex, 0, QModelIndex());
|
||||||
QTC_ASSERT(prefixModelIndex != QModelIndex(), return);
|
Q_ASSERT(prefixModelIndex != QModelIndex());
|
||||||
QTC_ASSERT(firstFileIndex >= 0 && firstFileIndex < m_qrcModel->rowCount(prefixModelIndex), return);
|
Q_ASSERT(firstFileIndex >= 0 && firstFileIndex < m_qrcModel->rowCount(prefixModelIndex));
|
||||||
QTC_ASSERT(lastFileIndex >= 0 && lastFileIndex < m_qrcModel->rowCount(prefixModelIndex), return);
|
Q_ASSERT(lastFileIndex >= 0 && lastFileIndex < m_qrcModel->rowCount(prefixModelIndex));
|
||||||
|
|
||||||
for (int i = lastFileIndex; i >= firstFileIndex; i--) {
|
for (int i = lastFileIndex; i >= firstFileIndex; i--) {
|
||||||
const QModelIndex index = m_qrcModel->index(i, 0, prefixModelIndex);
|
const QModelIndex index = m_qrcModel->index(i, 0, prefixModelIndex);
|
||||||
@@ -572,7 +570,7 @@ QString ResourceView::getCurrentValue(NodeProperty property) const
|
|||||||
case AliasProperty: return currentAlias();
|
case AliasProperty: return currentAlias();
|
||||||
case PrefixProperty: return currentPrefix();
|
case PrefixProperty: return currentPrefix();
|
||||||
case LanguageProperty: return currentLanguage();
|
case LanguageProperty: return currentLanguage();
|
||||||
default: QTC_ASSERT(false, /**/); return QString(); // Kill warning
|
default: Q_ASSERT(false); return QString(); // Kill warning
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,7 +581,7 @@ void ResourceView::changeValue(const QModelIndex &nodeIndex, NodeProperty proper
|
|||||||
case AliasProperty: m_qrcModel->changeAlias(nodeIndex, value); return;
|
case AliasProperty: m_qrcModel->changeAlias(nodeIndex, value); return;
|
||||||
case PrefixProperty: m_qrcModel->changePrefix(nodeIndex, value); return;
|
case PrefixProperty: m_qrcModel->changePrefix(nodeIndex, value); return;
|
||||||
case LanguageProperty: m_qrcModel->changeLang(nodeIndex, value); return;
|
case LanguageProperty: m_qrcModel->changeLang(nodeIndex, value); return;
|
||||||
default: QTC_ASSERT(false, /**/);
|
default: Q_ASSERT(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ bool ModifyPropertyCommand::mergeWith(const QUndoCommand * command)
|
|||||||
|
|
||||||
void ModifyPropertyCommand::undo()
|
void ModifyPropertyCommand::undo()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_view, return);
|
Q_ASSERT(m_view);
|
||||||
|
|
||||||
// Save current text in m_after for redo()
|
// Save current text in m_after for redo()
|
||||||
m_after = m_view->getCurrentValue(m_property);
|
m_after = m_view->getCurrentValue(m_property);
|
||||||
@@ -117,7 +117,7 @@ void ModifyPropertyCommand::redo()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Bring back text before undo
|
// Bring back text before undo
|
||||||
QTC_ASSERT(m_view, return);
|
Q_ASSERT(m_view);
|
||||||
m_view->changeValue(makeIndex(), m_property, m_after);
|
m_view->changeValue(makeIndex(), m_property, m_after);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ void RemoveEntryCommand::undo()
|
|||||||
{
|
{
|
||||||
if (m_entry == 0) {
|
if (m_entry == 0) {
|
||||||
m_entry->restore();
|
m_entry->restore();
|
||||||
QTC_ASSERT(m_view != 0, return);
|
Q_ASSERT(m_view != 0);
|
||||||
const QModelIndex index = makeIndex();
|
const QModelIndex index = makeIndex();
|
||||||
m_view->setExpanded(index, m_isExpanded);
|
m_view->setExpanded(index, m_isExpanded);
|
||||||
m_view->setCurrentIndex(index);
|
m_view->setCurrentIndex(index);
|
||||||
|
|||||||
@@ -34,8 +34,6 @@
|
|||||||
#ifndef WRAP_HELPERS_H
|
#ifndef WRAP_HELPERS_H
|
||||||
#define WRAP_HELPERS_H
|
#define WRAP_HELPERS_H
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
#include <QtScript/QScriptEngine>
|
#include <QtScript/QScriptEngine>
|
||||||
#include <QtScript/QScriptContext>
|
#include <QtScript/QScriptContext>
|
||||||
#include <QtScript/QScriptValue>
|
#include <QtScript/QScriptValue>
|
||||||
@@ -89,7 +87,7 @@ template <class Wrapper, class Wrapped>
|
|||||||
Wrapped * (Wrapper::*wrappedAccessor) () const)
|
Wrapped * (Wrapper::*wrappedAccessor) () const)
|
||||||
{
|
{
|
||||||
Wrapped *wrapped = wrappedFromScriptValue(context->thisObject(), wrappedAccessor);
|
Wrapped *wrapped = wrappedFromScriptValue(context->thisObject(), wrappedAccessor);
|
||||||
QTC_ASSERT(wrapped, return 0);
|
Q_ASSERT(wrapped);
|
||||||
return wrapped;
|
return wrapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,7 +314,7 @@ static void scriptValueToQObject(const QScriptValue &sv, SomeQObject * &p)
|
|||||||
{
|
{
|
||||||
QObject *qObject = sv.toQObject();
|
QObject *qObject = sv.toQObject();
|
||||||
p = qobject_cast<SomeQObject*>(qObject);
|
p = qobject_cast<SomeQObject*>(qObject);
|
||||||
QTC_ASSERT(p, return);
|
Q_ASSERT(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register a QObject-derived class which has Q_DECLARE_METATYPE(Ptr*)
|
// Register a QObject-derived class which has Q_DECLARE_METATYPE(Ptr*)
|
||||||
|
|||||||
Reference in New Issue
Block a user