forked from qt-creator/qt-creator
use QTC_ASSERT instead of Q_ASSERT
This commit is contained in:
@@ -30,19 +30,22 @@
|
||||
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "formresizer.h"
|
||||
#include "sizehandlerect.h"
|
||||
#include "widgethostconstants.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtDesigner/QDesignerFormWindowInterface>
|
||||
|
||||
#include <QtGui/QResizeEvent>
|
||||
#include <QtGui/QPalette>
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QFrame>
|
||||
#include <QtGui/QResizeEvent>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
enum { debugFormResizer=0 };
|
||||
enum { debugFormResizer = 0 };
|
||||
|
||||
using namespace SharedTools::Internal;
|
||||
|
||||
@@ -140,7 +143,7 @@ void FormResizer::setFormWindow(QDesignerFormWindowInterface *fw)
|
||||
if (debugFormResizer)
|
||||
qDebug() << "FormResizer::setFormWindow " << fw;
|
||||
QVBoxLayout *layout = qobject_cast<QVBoxLayout *>(m_frame->layout());
|
||||
Q_ASSERT(layout);
|
||||
QTC_ASSERT(layout, return);
|
||||
if (layout->count())
|
||||
delete layout->takeAt(0);
|
||||
m_formWindow = fw;
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
|
||||
#include "indenter.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace SharedTools::IndenterInternal;
|
||||
|
||||
// --- Constants
|
||||
@@ -55,12 +57,12 @@ Constants::Constants() :
|
||||
"|(?:public|protected|private|signals|Q_SIGNALS|default)(?:\\s+slots|\\s+Q_SLOTS)?\\s*"
|
||||
")?:.*"))
|
||||
{
|
||||
m_literal.setMinimal( true );
|
||||
m_inlineCComment.setMinimal( true );
|
||||
Q_ASSERT(m_literal.isValid());
|
||||
Q_ASSERT(m_label.isValid());
|
||||
Q_ASSERT(m_inlineCComment.isValid());
|
||||
Q_ASSERT(m_braceX.isValid());
|
||||
Q_ASSERT(m_iflikeKeyword.isValid());
|
||||
Q_ASSERT(m_caseLabel.isValid());
|
||||
m_literal.setMinimal(true);
|
||||
m_inlineCComment.setMinimal(true);
|
||||
QTC_ASSERT(m_literal.isValid(), return);
|
||||
QTC_ASSERT(m_label.isValid(), return);
|
||||
QTC_ASSERT(m_inlineCComment.isValid(), return);
|
||||
QTC_ASSERT(m_braceX.isValid(), return);
|
||||
QTC_ASSERT(m_iflikeKeyword.isValid(), return);
|
||||
QTC_ASSERT(m_caseLabel.isValid(), return);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
|
||||
#include "procommandmanager.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
ProCommandGroup::ProCommandGroup(const QString &name)
|
||||
@@ -76,7 +78,7 @@ ProCommandManager::~ProCommandManager()
|
||||
|
||||
void ProCommandManager::beginGroup(const QString &name)
|
||||
{
|
||||
Q_ASSERT(!m_group);
|
||||
QTC_ASSERT(!m_group, return);
|
||||
|
||||
if (m_pos != m_groups.count()) {
|
||||
int removecount = m_groups.count() - m_pos;
|
||||
@@ -95,7 +97,7 @@ bool ProCommandManager::hasGroup() const
|
||||
|
||||
void ProCommandManager::endGroup()
|
||||
{
|
||||
Q_ASSERT(m_group);
|
||||
QTC_ASSERT(m_group, return);
|
||||
|
||||
m_groups.append(m_group);
|
||||
m_pos = m_groups.count();
|
||||
@@ -106,7 +108,7 @@ void ProCommandManager::endGroup()
|
||||
|
||||
bool ProCommandManager::command(ProCommand *cmd)
|
||||
{
|
||||
Q_ASSERT(m_group);
|
||||
QTC_ASSERT(m_group, return false);
|
||||
|
||||
if (cmd->redo()) {
|
||||
m_group->appendCommand(cmd);
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include "proparserutils.h"
|
||||
#include "proitems.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
@@ -683,7 +685,7 @@ bool ProFileEvaluator::Private::visitProFunction(ProFunction *func)
|
||||
QString text = func->text();
|
||||
int lparen = text.indexOf(QLatin1Char('('));
|
||||
int rparen = text.lastIndexOf(QLatin1Char(')'));
|
||||
Q_ASSERT(lparen < rparen);
|
||||
QTC_ASSERT(lparen < rparen, return false);
|
||||
|
||||
QString arguments = text.mid(lparen + 1, rparen - lparen - 1);
|
||||
QString funcName = text.left(lparen);
|
||||
|
||||
@@ -33,13 +33,16 @@
|
||||
|
||||
#include "resourcefile_p.h"
|
||||
|
||||
#include <QtCore/QtAlgorithms>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QMimeData>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QMimeData>
|
||||
#include <QtCore/QtAlgorithms>
|
||||
#include <QtCore/QTextStream>
|
||||
|
||||
#include <QtGui/QIcon>
|
||||
#include <QtGui/QImageReader>
|
||||
|
||||
@@ -109,14 +112,14 @@ bool ResourceFile::load()
|
||||
const QString language = relt.attribute(QLatin1String("lang"));
|
||||
|
||||
const int idx = indexOfPrefix(prefix);
|
||||
Prefix * p = NULL;
|
||||
Prefix * p = 0;
|
||||
if (idx == -1) {
|
||||
p = new Prefix(prefix, language);
|
||||
m_prefix_list.append(p);
|
||||
} else {
|
||||
p = m_prefix_list[idx];
|
||||
}
|
||||
Q_ASSERT(p != NULL);
|
||||
QTC_ASSERT(p, return false);
|
||||
|
||||
QDomElement felt = relt.firstChildElement(QLatin1String("file"));
|
||||
for (; !felt.isNull(); felt = felt.nextSiblingElement(QLatin1String("file"))) {
|
||||
@@ -247,9 +250,9 @@ bool ResourceFile::isEmpty() const
|
||||
|
||||
QStringList ResourceFile::fileList(int pref_idx) const
|
||||
{
|
||||
Q_ASSERT((pref_idx >= 0) && (pref_idx < m_prefix_list.count()));
|
||||
const FileList &abs_file_list = m_prefix_list.at(pref_idx)->file_list;
|
||||
QStringList result;
|
||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return result);
|
||||
const FileList &abs_file_list = m_prefix_list.at(pref_idx)->file_list;
|
||||
foreach (const File *abs_file, abs_file_list)
|
||||
result.append(relativePath(abs_file->name));
|
||||
return result;
|
||||
@@ -258,9 +261,9 @@ QStringList ResourceFile::fileList(int pref_idx) const
|
||||
void ResourceFile::addFile(int prefix_idx, const QString &file, int file_idx)
|
||||
{
|
||||
Prefix * const p = m_prefix_list[prefix_idx];
|
||||
Q_ASSERT(p != NULL);
|
||||
QTC_ASSERT(p, return);
|
||||
FileList &files = p->file_list;
|
||||
Q_ASSERT((file_idx >= -1) && (file_idx <= files.size()));
|
||||
QTC_ASSERT(file_idx >= -1 && file_idx <= files.size(), return);
|
||||
if (file_idx == -1)
|
||||
file_idx = files.size();
|
||||
files.insert(file_idx, new File(p, absolutePath(file)));
|
||||
@@ -272,7 +275,7 @@ void ResourceFile::addPrefix(const QString &prefix, int prefix_idx)
|
||||
if (indexOfPrefix(fixed_prefix) != -1)
|
||||
return;
|
||||
|
||||
Q_ASSERT((prefix_idx >= -1) && (prefix_idx <= m_prefix_list.size()));
|
||||
QTC_ASSERT(prefix_idx >= -1 && prefix_idx <= m_prefix_list.size(), return);
|
||||
if (prefix_idx == -1)
|
||||
prefix_idx = m_prefix_list.size();
|
||||
m_prefix_list.insert(prefix_idx, new Prefix(fixed_prefix));
|
||||
@@ -280,7 +283,7 @@ void ResourceFile::addPrefix(const QString &prefix, int prefix_idx)
|
||||
|
||||
void ResourceFile::removePrefix(int prefix_idx)
|
||||
{
|
||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||
Prefix * const p = m_prefix_list.at(prefix_idx);
|
||||
delete p;
|
||||
m_prefix_list.removeAt(prefix_idx);
|
||||
@@ -288,39 +291,39 @@ void ResourceFile::removePrefix(int prefix_idx)
|
||||
|
||||
void ResourceFile::removeFile(int prefix_idx, int file_idx)
|
||||
{
|
||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||
FileList &fileList = m_prefix_list[prefix_idx]->file_list;
|
||||
Q_ASSERT((file_idx >= 0) && (file_idx < fileList.count()));
|
||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
|
||||
delete fileList.at(file_idx);
|
||||
fileList.removeAt(file_idx);
|
||||
}
|
||||
|
||||
void ResourceFile::replacePrefix(int prefix_idx, const QString &prefix)
|
||||
{
|
||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||
m_prefix_list[prefix_idx]->name = fixPrefix(prefix);
|
||||
}
|
||||
|
||||
void ResourceFile::replaceLang(int prefix_idx, const QString &lang)
|
||||
{
|
||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||
m_prefix_list[prefix_idx]->lang = lang;
|
||||
}
|
||||
|
||||
void ResourceFile::replaceAlias(int prefix_idx, int file_idx, const QString &alias)
|
||||
{
|
||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return);
|
||||
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
||||
Q_ASSERT((file_idx >= 0) && (file_idx < fileList.count()));
|
||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
|
||||
fileList[file_idx]->alias = alias;
|
||||
}
|
||||
|
||||
|
||||
void ResourceFile::replaceFile(int pref_idx, int file_idx, const QString &file)
|
||||
{
|
||||
Q_ASSERT((pref_idx >= 0) && (pref_idx < m_prefix_list.count()));
|
||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return);
|
||||
FileList &fileList = m_prefix_list.at(pref_idx)->file_list;
|
||||
Q_ASSERT((file_idx >= 0) && (file_idx < fileList.count()));
|
||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
|
||||
fileList[file_idx]->name = file;
|
||||
}
|
||||
|
||||
@@ -336,7 +339,7 @@ int ResourceFile::indexOfPrefix(const QString &prefix) const
|
||||
|
||||
int ResourceFile::indexOfFile(int pref_idx, const QString &file) const
|
||||
{
|
||||
Q_ASSERT((pref_idx >= 0) && (pref_idx < m_prefix_list.count()));
|
||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return -1);
|
||||
Prefix * const p = m_prefix_list.at(pref_idx);
|
||||
File equalFile(p, absolutePath(file));
|
||||
return p->file_list.indexOf(&equalFile);
|
||||
@@ -370,16 +373,16 @@ bool ResourceFile::contains(const QString &prefix, const QString &file) const
|
||||
return false;
|
||||
if (file.isEmpty())
|
||||
return true;
|
||||
Q_ASSERT((pref_idx >= 0) && (pref_idx < m_prefix_list.count()));
|
||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return false);
|
||||
Prefix * const p = m_prefix_list.at(pref_idx);
|
||||
Q_ASSERT(p != NULL);
|
||||
QTC_ASSERT(p, return false);
|
||||
File equalFile(p, absolutePath(file));
|
||||
return p->file_list.contains(&equalFile);
|
||||
}
|
||||
|
||||
bool ResourceFile::contains(int pref_idx, const QString &file) const
|
||||
{
|
||||
Q_ASSERT((pref_idx >= 0) && (pref_idx < m_prefix_list.count()));
|
||||
QTC_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count(), return false);
|
||||
Prefix * const p = m_prefix_list.at(pref_idx);
|
||||
File equalFile(p, absolutePath(file));
|
||||
return p->file_list.contains(&equalFile);
|
||||
@@ -409,49 +412,49 @@ int ResourceFile::prefixCount() const
|
||||
|
||||
QString ResourceFile::prefix(int idx) const
|
||||
{
|
||||
Q_ASSERT((idx >= 0) && (idx < m_prefix_list.count()));
|
||||
QTC_ASSERT((idx >= 0) && (idx < m_prefix_list.count()), return QString());
|
||||
return m_prefix_list.at(idx)->name;
|
||||
}
|
||||
|
||||
QString ResourceFile::lang(int idx) const
|
||||
{
|
||||
Q_ASSERT((idx >= 0) && (idx < m_prefix_list.count()));
|
||||
QTC_ASSERT(idx >= 0 && idx < m_prefix_list.count(), return QString());
|
||||
return m_prefix_list.at(idx)->lang;
|
||||
}
|
||||
|
||||
int ResourceFile::fileCount(int prefix_idx) const
|
||||
{
|
||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return 0);
|
||||
return m_prefix_list.at(prefix_idx)->file_list.size();
|
||||
}
|
||||
|
||||
QString ResourceFile::file(int prefix_idx, int file_idx) const
|
||||
{
|
||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return QString());
|
||||
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
||||
Q_ASSERT((file_idx >= 0) && (file_idx < fileList.count()));
|
||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return QString());
|
||||
return fileList.at(file_idx)->name;
|
||||
}
|
||||
|
||||
QString ResourceFile::alias(int prefix_idx, int file_idx) const
|
||||
{
|
||||
Q_ASSERT((prefix_idx >= 0) && (prefix_idx < m_prefix_list.count()));
|
||||
QTC_ASSERT(prefix_idx >= 0 && prefix_idx < m_prefix_list.count(), return QString());
|
||||
FileList &fileList = m_prefix_list.at(prefix_idx)->file_list;
|
||||
Q_ASSERT((file_idx >= 0) && (file_idx < fileList.count()));
|
||||
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return QString());
|
||||
return fileList.at(file_idx)->alias;
|
||||
}
|
||||
|
||||
void * ResourceFile::prefixPointer(int prefixIndex) const
|
||||
{
|
||||
Q_ASSERT((prefixIndex >= 0) && (prefixIndex < m_prefix_list.count()));
|
||||
QTC_ASSERT(prefixIndex >= 0 && prefixIndex < m_prefix_list.count(), return 0);
|
||||
return m_prefix_list.at(prefixIndex);
|
||||
}
|
||||
|
||||
void * ResourceFile::filePointer(int prefixIndex, int fileIndex) const
|
||||
{
|
||||
Q_ASSERT((prefixIndex >= 0) && (prefixIndex < m_prefix_list.count()));
|
||||
QTC_ASSERT(prefixIndex >= 0 && prefixIndex < m_prefix_list.count(), return 0);
|
||||
FileList &fileList = m_prefix_list.at(prefixIndex)->file_list;
|
||||
Q_ASSERT((fileIndex >= 0) && (fileIndex < fileList.count()));
|
||||
QTC_ASSERT(fileIndex >= 0 && fileIndex < fileList.count(), return 0);
|
||||
return fileList.at(fileIndex);
|
||||
}
|
||||
|
||||
@@ -497,28 +500,28 @@ QModelIndex ResourceModel::index(int row, int column, const QModelIndex &parent)
|
||||
if (column != 0)
|
||||
return QModelIndex();
|
||||
|
||||
void * internalPointer = NULL;
|
||||
void * internalPointer = 0;
|
||||
if (parent.isValid()) {
|
||||
void * const pip = parent.internalPointer();
|
||||
if (pip == NULL)
|
||||
if (pip == 0)
|
||||
return QModelIndex();
|
||||
|
||||
// File node
|
||||
Node * const node = reinterpret_cast<Node *>(pip);
|
||||
Prefix * const prefix = node->prefix();
|
||||
Q_ASSERT(prefix != NULL);
|
||||
if ((row < 0) || (row >= prefix->file_list.count()))
|
||||
QTC_ASSERT(prefix, return QModelIndex());
|
||||
if (row < 0 || row >= prefix->file_list.count())
|
||||
return QModelIndex();
|
||||
const int prefixIndex = m_resource_file.prefixPointerIndex(prefix);
|
||||
const int fileIndex = row;
|
||||
internalPointer = m_resource_file.filePointer(prefixIndex, fileIndex);
|
||||
} else {
|
||||
// Prefix node
|
||||
if ((row < 0) || (row >= m_resource_file.prefixCount()))
|
||||
if (row < 0 || row >= m_resource_file.prefixCount())
|
||||
return QModelIndex();
|
||||
internalPointer = m_resource_file.prefixPointer(row);
|
||||
}
|
||||
Q_ASSERT(internalPointer != NULL);
|
||||
QTC_ASSERT(internalPointer, return QModelIndex());
|
||||
return createIndex(row, 0, internalPointer);
|
||||
}
|
||||
|
||||
@@ -528,16 +531,16 @@ QModelIndex ResourceModel::parent(const QModelIndex &index) const
|
||||
return QModelIndex();
|
||||
|
||||
void * const internalPointer = index.internalPointer();
|
||||
if (internalPointer == NULL)
|
||||
if (internalPointer == 0)
|
||||
return QModelIndex();
|
||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||
Prefix * const prefix = node->prefix();
|
||||
Q_ASSERT(prefix != NULL);
|
||||
QTC_ASSERT(prefix, return QModelIndex());
|
||||
bool const isFileNode = (prefix != node);
|
||||
|
||||
if (isFileNode) {
|
||||
const int row = m_resource_file.prefixPointerIndex(prefix);
|
||||
Q_ASSERT(row >= 0);
|
||||
QTC_ASSERT(row >= 0, return QModelIndex());
|
||||
return createIndex(row, 0, prefix);
|
||||
} else {
|
||||
return QModelIndex();
|
||||
@@ -550,7 +553,7 @@ int ResourceModel::rowCount(const QModelIndex &parent) const
|
||||
void * const internalPointer = parent.internalPointer();
|
||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||
Prefix * const prefix = node->prefix();
|
||||
Q_ASSERT(prefix != NULL);
|
||||
QTC_ASSERT(prefix, return 0);
|
||||
bool const isFileNode = (prefix != node);
|
||||
|
||||
if (isFileNode) {
|
||||
@@ -609,7 +612,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||
Prefix const * const prefix = node->prefix();
|
||||
File const * const file = node->file();
|
||||
Q_ASSERT(prefix != NULL);
|
||||
QTC_ASSERT(prefix, return QVariant());
|
||||
bool const isFileNode = (prefix != node);
|
||||
|
||||
QVariant result;
|
||||
@@ -626,7 +629,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
||||
appendParenthesized(lang, stringRes);
|
||||
} else {
|
||||
// File node
|
||||
Q_ASSERT(file != NULL);
|
||||
QTC_ASSERT(file, return result);
|
||||
stringRes = QFileInfo(file->name).fileName();
|
||||
const QString alias = file->alias;
|
||||
if (!alias.isEmpty())
|
||||
@@ -638,7 +641,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
||||
case Qt::DecorationRole:
|
||||
if (isFileNode) {
|
||||
// File node
|
||||
Q_ASSERT(file != NULL);
|
||||
QTC_ASSERT(file, return result);
|
||||
const QString path = m_resource_file.absolutePath(file->name);
|
||||
if (iconFileExtension(path)) {
|
||||
const QIcon icon(path);
|
||||
@@ -650,7 +653,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
|
||||
case Qt::ToolTipRole:
|
||||
if (isFileNode) {
|
||||
// File node
|
||||
Q_ASSERT(file != NULL);
|
||||
QTC_ASSERT(file, return result);
|
||||
QString conv_file = m_resource_file.relativePath(file->name);
|
||||
QString stringRes = conv_file.replace(QDir::separator(), QLatin1Char('/'));
|
||||
const QString &alias_file = file->alias;
|
||||
@@ -679,12 +682,12 @@ void ResourceModel::getItem(const QModelIndex &index, QString &prefix, QString &
|
||||
void * const internalPointer = index.internalPointer();
|
||||
Node * const node = reinterpret_cast<Node *>(internalPointer);
|
||||
Prefix * const p = node->prefix();
|
||||
Q_ASSERT(p != NULL);
|
||||
QTC_ASSERT(p, return);
|
||||
bool const isFileNode = (p != node);
|
||||
|
||||
if (isFileNode) {
|
||||
File * const f = node->file();
|
||||
Q_ASSERT(f != NULL);
|
||||
File *const f = node->file();
|
||||
QTC_ASSERT(f, return);
|
||||
if (!f->alias.isEmpty())
|
||||
file = f->alias;
|
||||
else
|
||||
|
||||
@@ -36,10 +36,12 @@
|
||||
|
||||
#include "namespace_global.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QAbstractItemModel>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QAbstractItemModel>
|
||||
|
||||
#include "shared_global_p.h"
|
||||
|
||||
@@ -66,11 +68,11 @@ class Node
|
||||
protected:
|
||||
Node(File *file, Prefix *prefix) : m_file(file), m_prefix(prefix)
|
||||
{
|
||||
Q_ASSERT(m_prefix != NULL);
|
||||
QTC_ASSERT(m_prefix, return);
|
||||
}
|
||||
public:
|
||||
File * file() { return m_file; }
|
||||
Prefix * prefix() { Q_ASSERT(m_prefix != NULL); return m_prefix; }
|
||||
File *file() { return m_file; }
|
||||
Prefix *prefix() { return m_prefix; }
|
||||
private:
|
||||
File *m_file;
|
||||
Prefix *m_prefix;
|
||||
|
||||
@@ -32,16 +32,20 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "resourceview.h"
|
||||
|
||||
#include "undocommands_p.h"
|
||||
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QMenu>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QMouseEvent>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QInputDialog>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtCore/QtDebug>
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QInputDialog>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QMouseEvent>
|
||||
#include <QtGui/QUndoStack>
|
||||
|
||||
namespace SharedTools {
|
||||
@@ -308,14 +312,14 @@ void ResourceView::findSamePlacePostDeletionModelIndex(int &row, QModelIndex &pa
|
||||
|
||||
EntryBackup * ResourceView::removeEntry(const QModelIndex &index)
|
||||
{
|
||||
Q_ASSERT(m_qrcModel != NULL);
|
||||
QTC_ASSERT(m_qrcModel, return 0);
|
||||
return m_qrcModel->removeEntry(index);
|
||||
}
|
||||
|
||||
void ResourceView::addFiles(int prefixIndex, const QStringList &fileNames, int cursorFile,
|
||||
int &firstFile, int &lastFile)
|
||||
{
|
||||
Q_ASSERT(m_qrcModel != NULL);
|
||||
QTC_ASSERT(m_qrcModel, return);
|
||||
m_qrcModel->addFiles(prefixIndex, fileNames, cursorFile, firstFile, lastFile);
|
||||
|
||||
// Expand prefix node
|
||||
@@ -327,11 +331,11 @@ void ResourceView::addFiles(int prefixIndex, const QStringList &fileNames, int c
|
||||
|
||||
void ResourceView::removeFiles(int prefixIndex, int firstFileIndex, int lastFileIndex)
|
||||
{
|
||||
Q_ASSERT((prefixIndex >= 0) && (prefixIndex < m_qrcModel->rowCount(QModelIndex())));
|
||||
QTC_ASSERT(prefixIndex >= 0 && prefixIndex < m_qrcModel->rowCount(QModelIndex()), return);
|
||||
const QModelIndex prefixModelIndex = m_qrcModel->index(prefixIndex, 0, QModelIndex());
|
||||
Q_ASSERT(prefixModelIndex != QModelIndex());
|
||||
Q_ASSERT((firstFileIndex >= 0) && (firstFileIndex < m_qrcModel->rowCount(prefixModelIndex)));
|
||||
Q_ASSERT((lastFileIndex >= 0) && (lastFileIndex < m_qrcModel->rowCount(prefixModelIndex)));
|
||||
QTC_ASSERT(prefixModelIndex != QModelIndex(), return);
|
||||
QTC_ASSERT(firstFileIndex >= 0 && firstFileIndex < m_qrcModel->rowCount(prefixModelIndex), return);
|
||||
QTC_ASSERT(lastFileIndex >= 0 && lastFileIndex < m_qrcModel->rowCount(prefixModelIndex), return);
|
||||
|
||||
for (int i = lastFileIndex; i >= firstFileIndex; i--) {
|
||||
const QModelIndex index = m_qrcModel->index(i, 0, prefixModelIndex);
|
||||
@@ -568,7 +572,7 @@ QString ResourceView::getCurrentValue(NodeProperty property) const
|
||||
case AliasProperty: return currentAlias();
|
||||
case PrefixProperty: return currentPrefix();
|
||||
case LanguageProperty: return currentLanguage();
|
||||
default: Q_ASSERT(false); return QString(); // Kill warning
|
||||
default: QTC_ASSERT(false, /**/); return QString(); // Kill warning
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,7 +583,7 @@ void ResourceView::changeValue(const QModelIndex &nodeIndex, NodeProperty proper
|
||||
case AliasProperty: m_qrcModel->changeAlias(nodeIndex, value); return;
|
||||
case PrefixProperty: m_qrcModel->changePrefix(nodeIndex, value); return;
|
||||
case LanguageProperty: m_qrcModel->changeLang(nodeIndex, value); return;
|
||||
default: Q_ASSERT(false);
|
||||
default: QTC_ASSERT(false, /**/);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ bool ModifyPropertyCommand::mergeWith(const QUndoCommand * command)
|
||||
{
|
||||
const ModifyPropertyCommand * const brother
|
||||
= dynamic_cast<const ModifyPropertyCommand *>(command);
|
||||
if (command == NULL || m_property != brother->m_property)
|
||||
if (command == 0 || m_property != brother->m_property)
|
||||
return false;
|
||||
|
||||
// Choose older command (this) and forgot the other
|
||||
@@ -101,7 +101,7 @@ bool ModifyPropertyCommand::mergeWith(const QUndoCommand * command)
|
||||
|
||||
void ModifyPropertyCommand::undo()
|
||||
{
|
||||
Q_ASSERT(m_view != NULL);
|
||||
QTC_ASSERT(m_view, return);
|
||||
|
||||
// Save current text in m_after for redo()
|
||||
m_after = m_view->getCurrentValue(m_property);
|
||||
@@ -117,12 +117,12 @@ void ModifyPropertyCommand::redo()
|
||||
return;
|
||||
|
||||
// Bring back text before undo
|
||||
Q_ASSERT(m_view != NULL);
|
||||
QTC_ASSERT(m_view, return);
|
||||
m_view->changeValue(makeIndex(), m_property, m_after);
|
||||
}
|
||||
|
||||
RemoveEntryCommand::RemoveEntryCommand(ResourceView *view, const QModelIndex &index)
|
||||
: ModelIndexViewCommand(view), m_entry(NULL), m_isExpanded(true)
|
||||
: ModelIndexViewCommand(view), m_entry(0), m_isExpanded(true)
|
||||
{
|
||||
storeIndex(index);
|
||||
}
|
||||
@@ -142,9 +142,9 @@ void RemoveEntryCommand::redo()
|
||||
|
||||
void RemoveEntryCommand::undo()
|
||||
{
|
||||
if (m_entry != NULL) {
|
||||
if (m_entry == 0) {
|
||||
m_entry->restore();
|
||||
Q_ASSERT(m_view != NULL);
|
||||
QTC_ASSERT(m_view != 0, return);
|
||||
const QModelIndex index = makeIndex();
|
||||
m_view->setExpanded(index, m_isExpanded);
|
||||
m_view->setCurrentIndex(index);
|
||||
@@ -155,7 +155,7 @@ void RemoveEntryCommand::undo()
|
||||
void RemoveEntryCommand::freeEntry()
|
||||
{
|
||||
delete m_entry;
|
||||
m_entry = NULL;
|
||||
m_entry = 0;
|
||||
}
|
||||
|
||||
AddFilesCommand::AddFilesCommand(ResourceView *view, int prefixIndex, int cursorFileIndex,
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#ifndef WRAP_HELPERS_H
|
||||
#define WRAP_HELPERS_H
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtScript/QScriptEngine>
|
||||
#include <QtScript/QScriptContext>
|
||||
#include <QtScript/QScriptValue>
|
||||
@@ -87,7 +89,7 @@ template <class Wrapper, class Wrapped>
|
||||
Wrapped * (Wrapper::*wrappedAccessor) () const)
|
||||
{
|
||||
Wrapped *wrapped = wrappedFromScriptValue(context->thisObject(), wrappedAccessor);
|
||||
Q_ASSERT(wrapped);
|
||||
QTC_ASSERT(wrapped, return 0);
|
||||
return wrapped;
|
||||
}
|
||||
|
||||
@@ -314,7 +316,7 @@ static void scriptValueToQObject(const QScriptValue &sv, SomeQObject * &p)
|
||||
{
|
||||
QObject *qObject = sv.toQObject();
|
||||
p = qobject_cast<SomeQObject*>(qObject);
|
||||
Q_ASSERT(p);
|
||||
QTC_ASSERT(p, return);
|
||||
}
|
||||
|
||||
// Register a QObject-derived class which has Q_DECLARE_METATYPE(Ptr*)
|
||||
|
||||
Reference in New Issue
Block a user