Commit 1b77e4e9 authored by Jarek Kobus's avatar Jarek Kobus
Browse files

Talked to hjk, restore back Q_ASSERTs, since qtcassert.h lies outside of shared dir

parent 7cf9888a
......@@ -35,7 +35,7 @@
#include "sizehandlerect.h"
#include "widgethostconstants.h"
#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtDesigner/QDesignerFormWindowInterface>
......@@ -143,7 +143,7 @@ void FormResizer::setFormWindow(QDesignerFormWindowInterface *fw)
if (debugFormResizer)
qDebug() << "FormResizer::setFormWindow " << fw;
QVBoxLayout *layout = qobject_cast<QVBoxLayout *>(m_frame->layout());
QTC_ASSERT(layout, return);
Q_ASSERT(layout);
if (layout->count())
delete layout->takeAt(0);
m_formWindow = fw;
......
......@@ -33,8 +33,6 @@
#include "indenter.h"
#include <utils/qtcassert.h>
using namespace SharedTools::IndenterInternal;
// --- Constants
......@@ -59,10 +57,10 @@ Constants::Constants() :
{
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);
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());
}
......@@ -33,8 +33,6 @@
#include "procommandmanager.h"
#include <utils/qtcassert.h>
using namespace Qt4ProjectManager::Internal;
ProCommandGroup::ProCommandGroup(const QString &name)
......@@ -78,7 +76,7 @@ ProCommandManager::~ProCommandManager()
void ProCommandManager::beginGroup(const QString &name)
{
QTC_ASSERT(!m_group, return);
Q_ASSERT(!m_group);
if (m_pos != m_groups.count()) {
int removecount = m_groups.count() - m_pos;
......@@ -97,7 +95,7 @@ bool ProCommandManager::hasGroup() const
void ProCommandManager::endGroup()
{
QTC_ASSERT(m_group, return);
Q_ASSERT(m_group);
m_groups.append(m_group);
m_pos = m_groups.count();
......@@ -108,7 +106,7 @@ void ProCommandManager::endGroup()
bool ProCommandManager::command(ProCommand *cmd)
{
QTC_ASSERT(m_group, return false);
Q_ASSERT(m_group);
if (cmd->redo()) {
m_group->appendCommand(cmd);
......
......@@ -35,8 +35,6 @@
#include "proparserutils.h"
#include "proitems.h"
#include <utils/qtcassert.h>
#include <QtCore/QByteArray>
#include <QtCore/QDateTime>
#include <QtCore/QDebug>
......@@ -824,7 +822,7 @@ bool ProFileEvaluator::Private::visitProFunction(ProFunction *func)
QString text = func->text();
int lparen = text.indexOf(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 funcName = text.left(lparen);
m_lineNo = func->lineNumber();
......
......@@ -33,8 +33,6 @@
#include "resourcefile_p.h"
#include <utils/qtcassert.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
#include <QtCore/QDir>
......@@ -119,7 +117,7 @@ bool ResourceFile::load()
} else {
p = m_prefix_list[idx];
}
QTC_ASSERT(p, return false);
Q_ASSERT(p);
QDomElement felt = relt.firstChildElement(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 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;
foreach (const File *abs_file, abs_file_list)
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)
{
Prefix * const p = m_prefix_list[prefix_idx];
QTC_ASSERT(p, return);
Q_ASSERT(p);
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)
file_idx = files.size();
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)
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)
prefix_idx = m_prefix_list.size();
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)
{
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);
delete p;
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)
{
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;
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
Q_ASSERT(file_idx >= 0 && file_idx < fileList.count());
delete fileList.at(file_idx);
fileList.removeAt(file_idx);
}
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);
}
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;
}
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;
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
Q_ASSERT(file_idx >= 0 && file_idx < fileList.count());
fileList[file_idx]->alias = alias;
}
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;
QTC_ASSERT(file_idx >= 0 && file_idx < fileList.count(), return);
Q_ASSERT(file_idx >= 0 && file_idx < fileList.count());
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
{
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);
File equalFile(p, absolutePath(file));
return p->file_list.indexOf(&equalFile);
......@@ -373,16 +371,16 @@ bool ResourceFile::contains(const QString &prefix, const QString &file) const
return false;
if (file.isEmpty())
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);
QTC_ASSERT(p, return false);
Q_ASSERT(p);
File equalFile(p, absolutePath(file));
return p->file_list.contains(&equalFile);
}
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);
File equalFile(p, absolutePath(file));
return p->file_list.contains(&equalFile);
......@@ -412,49 +410,49 @@ int ResourceFile::prefixCount() 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;
}
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;
}
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();
}
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;
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;
}
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;
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;
}
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);
}
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;
QTC_ASSERT(fileIndex >= 0 && fileIndex < fileList.count(), return 0);
Q_ASSERT(fileIndex >= 0 && fileIndex < fileList.count());
return fileList.at(fileIndex);
}
......@@ -509,7 +507,7 @@ QModelIndex ResourceModel::index(int row, int column, const QModelIndex &parent)
// File node
Node * const node = reinterpret_cast<Node *>(pip);
Prefix * const prefix = node->prefix();
QTC_ASSERT(prefix, return QModelIndex());
Q_ASSERT(prefix);
if (row < 0 || row >= prefix->file_list.count())
return QModelIndex();
const int prefixIndex = m_resource_file.prefixPointerIndex(prefix);
......@@ -521,7 +519,7 @@ QModelIndex ResourceModel::index(int row, int column, const QModelIndex &parent)
return QModelIndex();
internalPointer = m_resource_file.prefixPointer(row);
}
QTC_ASSERT(internalPointer, return QModelIndex());
Q_ASSERT(internalPointer);
return createIndex(row, 0, internalPointer);
}
......@@ -535,12 +533,12 @@ QModelIndex ResourceModel::parent(const QModelIndex &index) const
return QModelIndex();
Node * const node = reinterpret_cast<Node *>(internalPointer);
Prefix * const prefix = node->prefix();
QTC_ASSERT(prefix, return QModelIndex());
Q_ASSERT(prefix);
bool const isFileNode = (prefix != node);
if (isFileNode) {
const int row = m_resource_file.prefixPointerIndex(prefix);
QTC_ASSERT(row >= 0, return QModelIndex());
Q_ASSERT(row >= 0);
return createIndex(row, 0, prefix);
} else {
return QModelIndex();
......@@ -553,7 +551,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();
QTC_ASSERT(prefix, return 0);
Q_ASSERT(prefix);
bool const isFileNode = (prefix != node);
if (isFileNode) {
......@@ -612,7 +610,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();
QTC_ASSERT(prefix, return QVariant());
Q_ASSERT(prefix);
bool const isFileNode = (prefix != node);
QVariant result;
......@@ -629,7 +627,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
appendParenthesized(lang, stringRes);
} else {
// File node
QTC_ASSERT(file, return result);
Q_ASSERT(file);
stringRes = QFileInfo(file->name).fileName();
const QString alias = file->alias;
if (!alias.isEmpty())
......@@ -641,7 +639,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
case Qt::DecorationRole:
if (isFileNode) {
// File node
QTC_ASSERT(file, return result);
Q_ASSERT(file);
const QString path = m_resource_file.absolutePath(file->name);
if (iconFileExtension(path)) {
const QIcon icon(path);
......@@ -653,7 +651,7 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
case Qt::ToolTipRole:
if (isFileNode) {
// File node
QTC_ASSERT(file, return result);
Q_ASSERT(file);
QString conv_file = m_resource_file.relativePath(file->name);
QString stringRes = conv_file.replace(QDir::separator(), QLatin1Char('/'));
const QString &alias_file = file->alias;
......@@ -682,12 +680,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();
QTC_ASSERT(p, return);
Q_ASSERT(p);
bool const isFileNode = (p != node);
if (isFileNode) {
File *const f = node->file();
QTC_ASSERT(f, return);
Q_ASSERT(f);
if (!f->alias.isEmpty())
file = f->alias;
else
......
......@@ -36,8 +36,6 @@
#include "namespace_global.h"
#include <utils/qtcassert.h>
#include <QtCore/QAbstractItemModel>
#include <QtCore/QMap>
#include <QtCore/QString>
......@@ -68,7 +66,7 @@ class Node
protected:
Node(File *file, Prefix *prefix) : m_file(file), m_prefix(prefix)
{
QTC_ASSERT(m_prefix, return);
Q_ASSERT(m_prefix);
}
public:
File *file() { return m_file; }
......
......@@ -35,8 +35,6 @@
#include "undocommands_p.h"
#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtGui/QAction>
......@@ -312,14 +310,14 @@ void ResourceView::findSamePlacePostDeletionModelIndex(int &row, QModelIndex &pa
EntryBackup * ResourceView::removeEntry(const QModelIndex &index)
{
QTC_ASSERT(m_qrcModel, return 0);
Q_ASSERT(m_qrcModel);
return m_qrcModel->removeEntry(index);
}
void ResourceView::addFiles(int prefixIndex, const QStringList &fileNames, int cursorFile,
int &firstFile, int &lastFile)
{
QTC_ASSERT(m_qrcModel, return);
Q_ASSERT(m_qrcModel);
m_qrcModel->addFiles(prefixIndex, fileNames, cursorFile, firstFile, lastFile);
// 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)
{
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());
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);
Q_ASSERT(prefixModelIndex != QModelIndex());
Q_ASSERT(firstFileIndex >= 0 && firstFileIndex < m_qrcModel->rowCount(prefixModelIndex));
Q_ASSERT(lastFileIndex >= 0 && lastFileIndex < m_qrcModel->rowCount(prefixModelIndex));
for (int i = lastFileIndex; i >= firstFileIndex; i--) {
const QModelIndex index = m_qrcModel->index(i, 0, prefixModelIndex);
......@@ -572,7 +570,7 @@ QString ResourceView::getCurrentValue(NodeProperty property) const
case AliasProperty: return currentAlias();
case PrefixProperty: return currentPrefix();
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 PrefixProperty: m_qrcModel->changePrefix(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()
{
QTC_ASSERT(m_view, return);
Q_ASSERT(m_view);
// Save current text in m_after for redo()
m_after = m_view->getCurrentValue(m_property);
......@@ -117,7 +117,7 @@ void ModifyPropertyCommand::redo()
return;
// Bring back text before undo
QTC_ASSERT(m_view, return);
Q_ASSERT(m_view);
m_view->changeValue(makeIndex(), m_property, m_after);
}
......@@ -144,7 +144,7 @@ void RemoveEntryCommand::undo()
{
if (m_entry == 0) {
m_entry->restore();
QTC_ASSERT(m_view != 0, return);
Q_ASSERT(m_view != 0);
const QModelIndex index = makeIndex();
m_view->setExpanded(index, m_isExpanded);
m_view->setCurrentIndex(index);
......
......@@ -34,8 +34,6 @@
#ifndef WRAP_HELPERS_H
#define WRAP_HELPERS_H
#include <utils/qtcassert.h>
#include <QtScript/QScriptEngine>
#include <QtScript/QScriptContext>
#include <QtScript/QScriptValue>
......@@ -89,7 +87,7 @@ template <class Wrapper, class Wrapped>
Wrapped * (Wrapper::*wrappedAccessor) () const)
{
Wrapped *wrapped = wrappedFromScriptValue(context->thisObject(), wrappedAccessor);
QTC_ASSERT(wrapped, return 0);
Q_ASSERT(wrapped);
return wrapped;
}
......@@ -316,7 +314,7 @@ static void scriptValueToQObject(const QScriptValue &sv, SomeQObject * &p)
{
QObject *qObject = sv.toQObject();
p = qobject_cast<SomeQObject*>(qObject);
QTC_ASSERT(p, return);
Q_ASSERT(p);
}
// Register a QObject-derived class which has Q_DECLARE_METATYPE(Ptr*)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment