qtcassert: move actual printing to separate function and enforce style

This also allows simple setting of breakpoints on failed asserts.

Change-Id: I6dd84cbfaf659d57e39f3447386cebc0221b2b84
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
hjk
2012-04-17 08:01:25 +02:00
committed by hjk
parent 37e3853090
commit 5b0bf61640
95 changed files with 347 additions and 297 deletions

View File

@@ -110,7 +110,7 @@ QMap<QString, QKeySequence> CommandsFile::importCommands() const
if (name == ctx.shortCutElement) {
currentId = r.attributes().value(ctx.idAttribute).toString();
} else if (name == ctx.keyElement) {
QTC_ASSERT(!currentId.isEmpty(), return result; )
QTC_ASSERT(!currentId.isEmpty(), return result);
const QXmlStreamAttributes attributes = r.attributes();
if (attributes.hasAttribute(ctx.valueAttribute)) {
const QString keyString = attributes.value(ctx.valueAttribute).toString();

View File

@@ -742,7 +742,7 @@ BaseFileWizard::OverwriteResult BaseFileWizard::promptOverwrite(GeneratedFiles *
// Set 'keep' attribute in files
foreach (const QString &keepFile, existingFilesToKeep) {
const int i = indexOfFile(*files, keepFile);
QTC_ASSERT(i != -1, return OverwriteCanceled; )
QTC_ASSERT(i != -1, return OverwriteCanceled);
GeneratedFile &file = (*files)[i];
file.setAttributes(file.attributes() | GeneratedFile::KeepExistingFileAttribute);
}

View File

@@ -208,7 +208,7 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE
if (hi.document.isNull() || documentsDone.contains(hi.document))
continue;
QString title = model->displayNameForDocument(hi.document);
QTC_ASSERT(!title.isEmpty(), continue;)
QTC_ASSERT(!title.isEmpty(), continue);
documentsDone.insert(hi.document.data());
QTreeWidgetItem *item = new QTreeWidgetItem();
if (hi.document->isModified())

View File

@@ -218,7 +218,7 @@ EditorToolBar::~EditorToolBar()
void EditorToolBar::removeToolbarForEditor(IEditor *editor)
{
QTC_ASSERT(editor, return)
QTC_ASSERT(editor, return);
disconnect(editor, SIGNAL(changed()), this, SLOT(checkEditorStatus()));
QWidget *toolBar = editor->toolBar();
@@ -259,7 +259,7 @@ void EditorToolBar::closeEditor()
void EditorToolBar::addEditor(IEditor *editor)
{
QTC_ASSERT(editor, return)
QTC_ASSERT(editor, return);
connect(editor, SIGNAL(changed()), this, SLOT(checkEditorStatus()));
QWidget *toolBar = editor->toolBar();
@@ -271,7 +271,7 @@ void EditorToolBar::addEditor(IEditor *editor)
void EditorToolBar::addCenterToolBar(QWidget *toolBar)
{
QTC_ASSERT(toolBar, return)
QTC_ASSERT(toolBar, return);
toolBar->setVisible(false); // will be made visible in setCurrentEditor
d->m_toolBarPlaceholder->layout()->addWidget(toolBar);
@@ -305,7 +305,7 @@ void EditorToolBar::setToolbarCreationFlags(ToolbarCreationFlags flags)
void EditorToolBar::setCurrentEditor(IEditor *editor)
{
QTC_ASSERT(editor, return)
QTC_ASSERT(editor, return);
d->m_editorList->setCurrentIndex(d->m_editorsListModel->indexOf(editor).row());
// If we never added the toolbar from the editor, we will never change

View File

@@ -176,7 +176,7 @@ void FileIconProvider::registerIconOverlayForSuffix(const QIcon &icon,
if (debug)
qDebug() << "FileIconProvider::registerIconOverlayForSuffix" << suffix;
QTC_ASSERT(!icon.isNull() && !suffix.isEmpty(), return)
QTC_ASSERT(!icon.isNull() && !suffix.isEmpty(), return);
const QPixmap fileIconPixmap = overlayIcon(QStyle::SP_FileIcon, icon, QSize(16, 16));
// replace old icon, if it exists

View File

@@ -1122,7 +1122,7 @@ bool BaseMimeTypeParser::parse(QIODevice *dev, const QString &fileName, QString
}
break;
case ParseMagicMatchRule:
QTC_ASSERT(!ruleMatcher.isNull(), return false)
QTC_ASSERT(!ruleMatcher.isNull(), return false);
if (!addMagicMatchRule(atts, ruleMatcher, errorMessage))
return false;
break;
@@ -1142,7 +1142,7 @@ bool BaseMimeTypeParser::parse(QIODevice *dev, const QString &fileName, QString
} else {
// Finished a match sequence
if (reader.name() == QLatin1String(magicTagC)) {
QTC_ASSERT(!ruleMatcher.isNull(), return false)
QTC_ASSERT(!ruleMatcher.isNull(), return false);
data.magicMatchers.push_back(ruleMatcher);
ruleMatcher = MagicRuleMatcherPtr();
}

View File

@@ -306,7 +306,7 @@ QString VcsManager::repositoryUrl(const QString &directory)
bool VcsManager::promptToDelete(IVersionControl *vc, const QString &fileName)
{
QTC_ASSERT(vc, return true)
QTC_ASSERT(vc, return true);
if (!vc->supportsOperation(IVersionControl::DeleteOperation))
return true;
const QString title = tr("Version Control");