Skip to content

Commit

Permalink
Fix printing symbols in log output in release build.
Browse files Browse the repository at this point in the history
This requires usage of the CuteLogger LOG_ macros instead of using
QtDebug facilities such as qDebug().
  • Loading branch information
ddennedy committed Apr 11, 2016
1 parent 33790bc commit d685e6e
Show file tree
Hide file tree
Showing 46 changed files with 236 additions and 232 deletions.
4 changes: 2 additions & 2 deletions src/commands/timelinecommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "timelinecommands.h"
#include "mltcontroller.h"
#include "shotcut_mlt_properties.h"
#include <QtDebug>
#include <Logger.h>
#include <QMetaObject>

namespace Timeline {
Expand Down Expand Up @@ -460,7 +460,7 @@ void AddTransitionCommand::undo()
}
}
} else {
qWarning() << "Failed to undo the transition!";
LOG_WARNING() << "Failed to undo the transition!";
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/commands/undohelper.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 Meltytech, LLC
* Copyright (c) 2015-2016 Meltytech, LLC
* Author: Harald Hvaal <harald.hvaal@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -20,14 +20,14 @@
#include "mltcontroller.h"
#include "models/audiolevelstask.h"
#include "shotcut_mlt_properties.h"
#include <QtDebug>
#include <Logger.h>
#include <QScopedPointer>
#include <QUuid>

#ifdef UNDOHELPER_DEBUG
#define UNDOLOG qDebug()
#define UNDOLOG LOG_DEBUG()
#else
#define UNDOLOG if (false) qDebug()
#define UNDOLOG if (false) LOG_DEBUG()
#endif

UndoHelper::UndoHelper(MultitrackModel& model)
Expand Down Expand Up @@ -186,7 +186,7 @@ void UndoHelper::undoChanges()
UNDOLOG << "inserting isBlank at " << currentIndex;
} else {
UNDOLOG << "inserting clip at " << currentIndex;
qDebug() << m_hints;
LOG_DEBUG() << m_hints;
Q_ASSERT(!(m_hints & SkipXML) && "Cannot restore clip without stored XML");
Q_ASSERT(!info.xml.isEmpty());
Mlt::Producer restoredClip(MLT.profile(), "xml-string", info.xml.toUtf8().constData());
Expand Down Expand Up @@ -263,7 +263,7 @@ void UndoHelper::debugPrintState()
playlist.clip_info(j, &info);
trackStr += QString(" [ %5 %1 -> %2 (%3 frames) %4]").arg(info.frame_in).arg(info.frame_out).arg(info.frame_count).arg(clip->is_blank() ? "blank " : "").arg(MLT.uuid(*clip).toString());
}
qDebug() << qPrintable(trackStr);
LOG_DEBUG() << qPrintable(trackStr);
}
qDebug("}");
}
8 changes: 4 additions & 4 deletions src/controllers/filtercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "filtercontroller.h"
#include <QQmlEngine>
#include <QDir>
#include <QDebug>
#include <Logger.h>
#include <QQmlComponent>
#include <QTimerEvent>
#include "mltcontroller.h"
Expand Down Expand Up @@ -51,20 +51,20 @@ void FilterController::loadFilterMetadata() {
subdir.setFilter(QDir::Files | QDir::NoDotAndDotDot | QDir::Readable);
subdir.setNameFilters(QStringList("meta*.qml"));
foreach (QString fileName, subdir.entryList()) {
qDebug() << "reading filter metadata" << dirName << fileName;
LOG_DEBUG() << "reading filter metadata" << dirName << fileName;
QQmlComponent component(QmlUtilities::sharedEngine(), subdir.absoluteFilePath(fileName));
QmlMetadata *meta = qobject_cast<QmlMetadata*>(component.create());
if (meta) {
// Check if mlt_service is available.
if (MLT.repository()->filters()->get_data(meta->mlt_service().toLatin1().constData())) {
qDebug() << "added filter" << meta->name();
LOG_DEBUG() << "added filter" << meta->name();
meta->loadSettings();
meta->setPath(subdir);
meta->setParent(0);
addMetadata(meta);
}
} else if (!meta) {
qWarning() << component.errorString();
LOG_WARNING() << component.errorString();
}
}
};
Expand Down
6 changes: 3 additions & 3 deletions src/controllers/scopecontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
#include "widgets/scopes/videowaveformscopewidget.h"
#include "docks/scopedock.h"
#include "settings.h"
#include <QDebug>
#include <Logger.h>
#include <QMainWindow>
#include <QMenu>

ScopeController::ScopeController(QMainWindow* mainWindow, QMenu* menu)
: QObject(mainWindow)
{
qDebug() << "begin";
LOG_DEBUG() << "begin";
QMenu* scopeMenu = menu->addMenu(tr("Scopes"));
createScopeDock<AudioLoudnessScopeWidget>(mainWindow, scopeMenu);
createScopeDock<AudioPeakMeterScopeWidget>(mainWindow, scopeMenu);
Expand All @@ -39,7 +39,7 @@ ScopeController::ScopeController(QMainWindow* mainWindow, QMenu* menu)
// if (!Settings.playerGPU()) {
// createScopeDock<VideoWaveformScopeWidget>(mainWindow, scopeMenu);
// }
qDebug() << "end";
LOG_DEBUG() << "end";
}

template<typename ScopeTYPE> void ScopeController::createScopeDock(QMainWindow* mainWindow, QMenu* menu)
Expand Down
20 changes: 10 additions & 10 deletions src/database.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2015 Meltytech, LLC
* Copyright (c) 2013-2016 Meltytech, LLC
* Author: Dan Dennedy <dan@dennedy.org>
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -22,7 +22,7 @@
#include <QtSql>
#include <QStandardPaths>
#include <QDir>
#include <QtDebug>
#include <Logger.h>

struct DatabaseJob {
enum Type {
Expand Down Expand Up @@ -64,9 +64,9 @@ bool Database::upgradeVersion1()
if (query.exec("CREATE TABLE thumbnails (hash TEXT PRIMARY KEY NOT NULL, accessed DATETIME NOT NULL, image BLOB);")) {
success = query.exec("UPDATE version SET version = 1;");
if (!success)
qCritical() << __FUNCTION__ << query.lastError();
LOG_ERROR() << query.lastError();
} else {
qCritical() << __PRETTY_FUNCTION__ << "Failed to create thumbnails table.";
LOG_ERROR() << "Failed to create thumbnails table.";
}
return success;
}
Expand All @@ -92,7 +92,7 @@ void Database::doJob(DatabaseJob * job)
query.bindValue(":image", ba);
job->result = query.exec();
if (!job->result)
qCritical() << __FUNCTION__ << query.lastError();
LOG_ERROR() << query.lastError();
} else if (job->type == DatabaseJob::GetThumbnail) {
QImage result;
QSqlQuery query;
Expand All @@ -104,7 +104,7 @@ void Database::doJob(DatabaseJob * job)
update.prepare("UPDATE thumbnails SET accessed = datetime('now') WHERE hash = :hash ;");
update.bindValue(":hash", job->hash);
if (!update.exec())
qCritical() << __FUNCTION__ << update.lastError();
LOG_ERROR() << update.lastError();
}
job->image = result;
}
Expand Down Expand Up @@ -166,7 +166,7 @@ void Database::deleteOldThumbnails()
QSqlQuery query;
// OFFSET is the numner of thumbnails to cache.
if (!query.exec("DELETE FROM thumbnails WHERE hash IN (SELECT hash FROM thumbnails ORDER BY accessed DESC LIMIT -1 OFFSET 10000);"))
qCritical() << __FUNCTION__ << query.lastError();
LOG_ERROR() << query.lastError();
}

void Database::run()
Expand All @@ -193,16 +193,16 @@ void Database::run()
QSqlQuery query;
if (query.exec("CREATE TABLE version (version INTEGER);")) {
if (!query.exec("INSERT INTO version VALUES (0);"))
qCritical() << __PRETTY_FUNCTION__ << "Failed to create version table.";
LOG_ERROR() << "Failed to create version table.";
} else if (query.exec("SELECT version FROM version")) {
query.next();
version = query.value(0).toInt();
} else {
qCritical() << __PRETTY_FUNCTION__ << "Failed to get version.";
LOG_ERROR() << "Failed to get version.";
}
if (version < 1 && upgradeVersion1())
version = 1;
qDebug() << "Database version is" << version;
LOG_DEBUG() << "Database version is" << version;

while (true) {
DatabaseJob * newJob = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/docks/encodedock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "jobs/encodejob.h"
#include "shotcut_mlt_properties.h"

#include <QtDebug>
#include <Logger.h>
#include <QtWidgets>
#include <QtXml>
#include <QtMath>
Expand All @@ -46,7 +46,7 @@ EncodeDock::EncodeDock(QWidget *parent) :
m_immediateJob(0),
m_profiles(Mlt::Profile::list())
{
qDebug() << "begin";
LOG_DEBUG() << "begin";
ui->setupUi(this);
ui->stopCaptureButton->hide();
ui->videoCodecThreadsSpinner->setMaximum(QThread::idealThreadCount());
Expand Down Expand Up @@ -95,7 +95,7 @@ EncodeDock::EncodeDock(QWidget *parent) :

on_resetButton_clicked();

qDebug() << "end";
LOG_DEBUG() << "end";
}

EncodeDock::~EncodeDock()
Expand Down
9 changes: 5 additions & 4 deletions src/docks/filtersdock.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2015 Meltytech, LLC
* Copyright (c) 2013-2016 Meltytech, LLC
* Author: Dan Dennedy <dan@dennedy.org>
* Author: Brian Matherly <code@brianmatherly.com>
*
Expand Down Expand Up @@ -27,6 +27,7 @@
#include <QQmlContext>
#include <QAction>
#include <QIcon>
#include <Logger.h>
#include "qmltypes/qmlfilter.h"
#include "qmltypes/qmlutilities.h"
#include "qmltypes/qmlview.h"
Expand All @@ -37,7 +38,7 @@ FiltersDock::FiltersDock(MetadataModel* metadataModel, AttachedFiltersModel* att
QDockWidget(tr("Filters"), parent),
m_qview(QmlUtilities::sharedEngine(), this)
{
qDebug() << "begin";
LOG_DEBUG() << "begin";
setObjectName("FiltersDock");
QIcon filterIcon = QIcon::fromTheme("view-filter", QIcon(":/icons/oxygen/32x32/actions/view-filter.png"));
setWindowIcon(filterIcon);
Expand All @@ -53,7 +54,7 @@ FiltersDock::FiltersDock(MetadataModel* metadataModel, AttachedFiltersModel* att
setCurrentFilter(0, 0, -1);
connect(m_qview.quickWindow(), SIGNAL(sceneGraphInitialized()), SLOT(resetQview()));

qDebug() << "end";
LOG_DEBUG() << "end";
}

void FiltersDock::clearCurrentFilter()
Expand Down Expand Up @@ -99,7 +100,7 @@ bool FiltersDock::event(QEvent *event)

void FiltersDock::resetQview()
{
qDebug();
LOG_DEBUG() << "begin";
if (m_qview.status() != QQuickWidget::Null) {
QObject* root = m_qview.rootObject();
QObject::disconnect(root, SIGNAL(currentFilterRequested(int)),
Expand Down
8 changes: 4 additions & 4 deletions src/docks/jobsdock.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2015 Meltytech, LLC
* Copyright (c) 2012-2016 Meltytech, LLC
* Author: Dan Dennedy <dan@dennedy.org>
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -20,14 +20,14 @@
#include "ui_jobsdock.h"
#include "jobqueue.h"
#include <QtWidgets>
#include <QDebug>
#include <Logger.h>
#include "dialogs/textviewerdialog.h"

JobsDock::JobsDock(QWidget *parent) :
QDockWidget(parent),
ui(new Ui::JobsDock)
{
qDebug() << "begin";
LOG_DEBUG() << "begin";
ui->setupUi(this);
toggleViewAction()->setIcon(windowIcon());
ui->treeView->setModel(&JOBS);
Expand All @@ -36,7 +36,7 @@ JobsDock::JobsDock(QWidget *parent) :
header->setSectionResizeMode(0, QHeaderView::Stretch);
header->setSectionResizeMode(1, QHeaderView::ResizeToContents);
ui->cleanButton->hide();
qDebug() << "end";
LOG_DEBUG() << "end";
}

JobsDock::~JobsDock()
Expand Down
8 changes: 4 additions & 4 deletions src/docks/playlistdock.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2015 Meltytech, LLC
* Copyright (c) 2012-2016 Meltytech, LLC
* Author: Dan Dennedy <dan@dennedy.org>
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -24,13 +24,13 @@
#include "shotcut_mlt_properties.h"
#include <commands/playlistcommands.h>
#include <QMenu>
#include <QDebug>
#include <Logger.h>

PlaylistDock::PlaylistDock(QWidget *parent) :
QDockWidget(parent),
ui(new Ui::PlaylistDock)
{
qDebug() << "begin";
LOG_DEBUG() << "begin";
ui->setupUi(this);
toggleViewAction()->setIcon(windowIcon());
ui->tableView->setModel(&m_model);
Expand Down Expand Up @@ -71,7 +71,7 @@ PlaylistDock::PlaylistDock(QWidget *parent) :
ui->actionThumbnailsHidden->setChecked(true);
on_actionThumbnailsHidden_triggered(true);
}
qDebug() << "end";
LOG_DEBUG() << "end";
}

PlaylistDock::~PlaylistDock()
Expand Down
8 changes: 4 additions & 4 deletions src/docks/recentdock.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012 Meltytech, LLC
* Copyright (c) 2012-2016 Meltytech, LLC
* Author: Dan Dennedy <dan@dennedy.org>
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -22,15 +22,15 @@
#include "util.h"

#include <QDir>
#include <QDebug>
#include <Logger.h>

static const int MaxItems = 100;

RecentDock::RecentDock(QWidget *parent) :
QDockWidget(parent),
ui(new Ui::RecentDock)
{
qDebug() << "begin";
LOG_DEBUG() << "begin";
ui->setupUi(this);
toggleViewAction()->setIcon(windowIcon());
m_recent = Settings.recent();
Expand All @@ -44,7 +44,7 @@ RecentDock::RecentDock(QWidget *parent) :
m_proxyModel.setSourceModel(&m_model);
m_proxyModel.setFilterCaseSensitivity(Qt::CaseInsensitive);
ui->listWidget->setModel(&m_proxyModel);
qDebug() << "end";
LOG_DEBUG() << "end";
}

RecentDock::~RecentDock()
Expand Down
8 changes: 4 additions & 4 deletions src/docks/scopedock.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015 Meltytech, LLC
* Copyright (c) 2015-2016 Meltytech, LLC
* Author: Brian Matherly <code@brianmatherly.com>
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -18,7 +18,7 @@

#include "scopedock.h"
#include "controllers/scopecontroller.h"
#include <QDebug>
#include <Logger.h>
#include <QtWidgets/QScrollArea>
#include <QAction>

Expand All @@ -27,7 +27,7 @@ ScopeDock::ScopeDock(ScopeController* scopeController, ScopeWidget* scopeWidget)
, m_scopeController(scopeController)
, m_scopeWidget(scopeWidget)
{
qDebug() << "begin";
LOG_DEBUG() << "begin";
setObjectName(m_scopeWidget->objectName() + "Dock");
QScrollArea *scrollArea = new QScrollArea();
scrollArea->setFrameShape(QFrame::NoFrame);
Expand All @@ -37,7 +37,7 @@ ScopeDock::ScopeDock(ScopeController* scopeController, ScopeWidget* scopeWidget)
QDockWidget::setWindowTitle(m_scopeWidget->getTitle());

connect(toggleViewAction(), SIGNAL(toggled(bool)), this, SLOT(onActionToggled(bool)));
qDebug() << "end";
LOG_DEBUG() << "end";
}

void ScopeDock::resizeEvent(QResizeEvent* e)
Expand Down

0 comments on commit d685e6e

Please sign in to comment.