Commit fab53ac3 authored by Tobias Hunger's avatar Tobias Hunger Committed by hjk

Replace Q_ASSERTs with QTC_ASSERTs

or even with QTC_CHECKs.

Change-Id: I6df67f088bb2f944f0a1abd751fdb192db2be298
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent e4a0bdd8
......@@ -36,6 +36,7 @@
#include <texteditor/texteditorsettings.h>
#include <texteditor/fontsettings.h>
#include <texteditor/texteditorconstants.h>
#include <utils/qtcassert.h>
#include <QtGui/QSyntaxHighlighter>
#include <QtGui/QTextEdit>
......@@ -79,7 +80,7 @@ BazaarSubmitHighlighter::BazaarSubmitHighlighter(QTextEdit * parent) :
m_keywordPattern(QLatin1String("^\\w+:")),
m_hashChar(QLatin1Char('#'))
{
Q_ASSERT(m_keywordPattern.isValid());
QTC_CHECK(m_keywordPattern.isValid());
}
void BazaarSubmitHighlighter::highlightBlock(const QString &text)
......
......@@ -33,6 +33,7 @@
#include "pullorpushdialog.h"
#include "ui_pullorpushdialog.h"
#include <utils/qtcassert.h>
using namespace Bazaar::Internal;
......@@ -87,19 +88,19 @@ QString PullOrPushDialog::revision() const
bool PullOrPushDialog::isLocalOptionEnabled() const
{
Q_ASSERT(m_mode == PullMode);
QTC_ASSERT(m_mode == PullMode, return false);
return m_ui->localCheckBox->isChecked();
}
bool PullOrPushDialog::isUseExistingDirectoryOptionEnabled() const
{
Q_ASSERT(m_mode == PushMode);
QTC_ASSERT(m_mode == PushMode, return false);
return m_ui->useExistingDirCheckBox->isChecked();
}
bool PullOrPushDialog::isCreatePrefixOptionEnabled() const
{
Q_ASSERT(m_mode == PushMode);
QTC_ASSERT(m_mode == PushMode, return false);
return m_ui->createPrefixCheckBox->isChecked();
}
......
......@@ -85,9 +85,9 @@ public:
VcsInfo *findInCache(const QString &dir)
{
Q_ASSERT(QDir(dir).isAbsolute());
Q_ASSERT(!dir.endsWith(QLatin1Char('/')));
Q_ASSERT(QDir::fromNativeSeparators(dir) == dir);
QTC_ASSERT(QDir(dir).isAbsolute(), return 0);
QTC_ASSERT(!dir.endsWith(QLatin1Char('/')), return 0);
QTC_ASSERT(QDir::fromNativeSeparators(dir) == dir, return 0);
const QMap<QString, VcsInfo *>::const_iterator it = m_cachedMatches.constFind(dir);
if (it != m_cachedMatches.constEnd())
......
......@@ -39,6 +39,7 @@
#include "stashdialog.h" // Label helpers
#include <utils/checkablemessagebox.h>
#include <utils/qtcassert.h>
#include <vcsbase/vcsbaseoutputwindow.h>
#include <QtGui/QItemSelectionModel>
......@@ -151,7 +152,7 @@ void BranchDialog::add()
void BranchDialog::checkout()
{
QModelIndex idx = selectedIndex();
Q_ASSERT(m_model->isLocal(idx));
QTC_CHECK(m_model->isLocal(idx));
m_model->checkoutBranch(idx);
enableButtons();
......@@ -161,7 +162,7 @@ void BranchDialog::checkout()
void BranchDialog::remove()
{
QModelIndex selected = selectedIndex();
Q_ASSERT(selected != m_model->currentBranch()); // otherwise the button would not be enabled!
QTC_CHECK(selected != m_model->currentBranch()); // otherwise the button would not be enabled!
QString branchName = m_model->branchName(selected);
if (branchName.isEmpty())
......
......@@ -33,6 +33,7 @@
#include "branchmodel.h"
#include "gitclient.h"
#include <utils/qtcassert.h>
#include <vcsbase/vcsbaseoutputwindow.h>
#include <QtGui/QFont>
......@@ -103,7 +104,7 @@ public:
QStringList fullName() const
{
Q_ASSERT(isLeaf());
QTC_ASSERT(isLeaf(), return QStringList());
QStringList fn;
QList<const BranchNode *> nodes;
......@@ -172,7 +173,7 @@ BranchModel::BranchModel(GitClient *client, QObject *parent) :
m_client(client),
m_rootNode(new BranchNode)
{
Q_ASSERT(m_client);
QTC_CHECK(m_client);
m_rootNode->append(new BranchNode(tr("Local Branches")));
}
......
......@@ -113,8 +113,8 @@ static CommitData::FileState stateFor(const QChar &c)
static bool checkLine(const QString &stateInfo, const QString &file, QList<CommitData::StateFilePair> *files)
{
Q_ASSERT(stateInfo.count() == 2);
Q_ASSERT(files);
QTC_ASSERT(stateInfo.count() == 2, return false);
QTC_ASSERT(files, return false);
if (stateInfo == "??") {
files->append(qMakePair(CommitData::UntrackedFile, file));
......
......@@ -238,7 +238,7 @@ public:
void setEditor(VcsBase::VcsBaseEditorWidget *editor)
{
Q_ASSERT(editor);
QTC_ASSERT(editor, return);
m_editor = editor;
}
......@@ -354,7 +354,7 @@ GitClient::GitClient(GitSettings *settings) :
m_repositoryChangedSignalMapper(0),
m_settings(settings)
{
Q_ASSERT(settings);
QTC_CHECK(settings);
connect(m_core, SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings()));
}
......@@ -411,7 +411,7 @@ VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(const Core::Id &id,
QWidget *configWidget) const
{
VcsBase::VcsBaseEditorWidget *rc = 0;
Q_ASSERT(!findExistingVCSEditor(registerDynamicProperty, dynamicPropertyValue));
QTC_CHECK(!findExistingVCSEditor(registerDynamicProperty, dynamicPropertyValue));
// Create new, set wait message, set up with source and codec
Core::IEditor *outputEditor = m_core->editorManager()->openEditorWithContents(id, &title, m_msgWait);
......@@ -1553,7 +1553,7 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR
// split "82bfad2f51d34e98b18982211c82220b8db049b<tab>refs/heads/master"
foreach(const QString &line, resp.stdOut.split(QLatin1Char('\n'))) {
if (line.endsWith("\tHEAD")) {
Q_ASSERT(headSha.isNull());
QTC_CHECK(headSha.isNull());
headSha = line.left(line.indexOf(QChar('\t')));
continue;
}
......
......@@ -171,17 +171,17 @@ static QByteArray removeAnnotationDate(const QByteArray &b)
return QByteArray(b);
// Copy over the parts that have not changed into a new byte array
Q_ASSERT(b.size() >= parenPos);
QByteArray result;
QTC_ASSERT(b.size() >= parenPos, return result);
int prevPos = 0;
int pos = b.indexOf('\n', 0) + 1;
forever {
Q_ASSERT(prevPos < pos);
QTC_CHECK(prevPos < pos);
int afterParen = prevPos + parenPos;
result.append(b.constData() + prevPos, datePos);
result.append(b.constData() + afterParen, pos - afterParen);
prevPos = pos;
Q_ASSERT(prevPos != 0);
QTC_CHECK(prevPos != 0);
if (pos == b.size())
break;
......
......@@ -39,6 +39,7 @@
#include <QtNetwork/QNetworkReply>
#include <utils/qtcassert.h>
#include <utils/networkaccessmanager.h>
enum { debug = 0 };
......@@ -347,7 +348,7 @@ GitoriousRepository GitoriousProjectReader::readRepository(QXmlStreamReader &rea
void GitoriousProjectReader::readUnknownElement(QXmlStreamReader &reader)
{
Q_ASSERT(reader.isStartElement());
QTC_ASSERT(reader.isStartElement(), return);
while (!reader.atEnd()) {
reader.readNext();
......@@ -446,7 +447,7 @@ void Gitorious::listCategoriesReply(int index, QByteArray dataB)
const QString data = QString::fromUtf8(dataB);
// Cut out the contents of the anchors
QRegExp pattern = QRegExp(QLatin1String("<a href=[^>]+>([^<]+)</a>"));
Q_ASSERT(pattern.isValid());
QTC_CHECK(pattern.isValid());
GitoriousHost::CategoryList &categories = m_hosts[index].categories;
for (int pos = pattern.indexIn(data) ; pos != -1; ) {
const QString cat = pattern.cap(1);
......
......@@ -232,7 +232,7 @@ void GitoriousProjectWidget::setDescription(const QString &description,
// Should the text contain an URL, extract
// Do not fall for "(http://XX)", strip special characters
static const QRegExp urlRegExp(QLatin1String("(http://[\\w\\.-]+/[a-zA-Z0-9/\\-&]*)"));
Q_ASSERT(urlRegExp.isValid());
QTC_CHECK(urlRegExp.isValid());
if (urlRegExp.indexIn(description) != -1) {
*url= urlRegExp.cap(1);
} else {
......
......@@ -35,6 +35,7 @@
#include "gitconstants.h"
#include "commitdata.h"
#include <utils/qtcassert.h>
#include <vcsbase/submitfilemodel.h>
#include <QtCore/QDebug>
......
......@@ -36,6 +36,7 @@
#include <texteditor/texteditorsettings.h>
#include <texteditor/fontsettings.h>
#include <texteditor/texteditorconstants.h>
#include <utils/qtcassert.h>
#include <QtGui/QLineEdit>
#include <QtGui/QRegExpValidator>
......@@ -78,7 +79,7 @@ GitSubmitHighlighter::GitSubmitHighlighter(QTextEdit * parent) :
m_keywordPattern(QLatin1String("^\\w+:")),
m_hashChar(QLatin1Char('#'))
{
Q_ASSERT(m_keywordPattern.isValid());
QTC_CHECK(m_keywordPattern.isValid());
}
void GitSubmitHighlighter::highlightBlock(const QString &text)
......
......@@ -35,6 +35,7 @@
#include <texteditor/texteditorsettings.h>
#include <texteditor/fontsettings.h>
#include <texteditor/texteditorconstants.h>
#include <utils/qtcassert.h>
#include <QtGui/QSyntaxHighlighter>
#include <QtGui/QTextEdit>
......@@ -78,7 +79,7 @@ MercurialSubmitHighlighter::MercurialSubmitHighlighter(QTextEdit *parent) :
m_keywordPattern(QLatin1String("^\\w+:")),
m_hashChar(QLatin1Char('#'))
{
Q_ASSERT(m_keywordPattern.isValid());
QTC_CHECK(m_keywordPattern.isValid());
}
void MercurialSubmitHighlighter::highlightBlock(const QString &text)
......
......@@ -36,6 +36,7 @@
#include "tasklistplugin.h"
#include <projectexplorer/task.h>
#include <utils/qtcassert.h>
#include <QtGui/QAction>
#include <QtCore/QCoreApplication>
......@@ -61,7 +62,7 @@ bool StopMonitoringHandler::canHandle(const ProjectExplorer::Task &task)
void StopMonitoringHandler::handle(const ProjectExplorer::Task &task)
{
Q_ASSERT(canHandle(task));
QTC_ASSERT(canHandle(task), return);
Q_UNUSED(task);
TaskList::TaskListPlugin::instance()->stopMonitoring();
}
......
......@@ -40,6 +40,8 @@
#include <coreplugin/icore.h>
#include <coreplugin/iversioncontrol.h>
#include <utils/qtcassert.h>
namespace VcsBase {
namespace Internal {
......@@ -65,7 +67,7 @@ VcsConfigurationPage::VcsConfigurationPage(const Core::IVersionControl *vc, QWid
QWizardPage(parent),
d(new Internal::VcsConfigurationPagePrivate)
{
Q_ASSERT(vc);
QTC_CHECK(vc);
setTitle(tr("Configuration"));
setSubTitle(tr("Please configure <b>%1</b> now.").arg(vc->displayName()));
......
Markdown is supported
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