Skip to content

Commit

Permalink
Apply Artistic Style code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatherly authored and ddennedy committed May 2, 2022
1 parent 368a372 commit 0350b90
Show file tree
Hide file tree
Showing 259 changed files with 6,351 additions and 5,260 deletions.
2 changes: 1 addition & 1 deletion src/abstractproducerwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ AbstractProducerWidget::~AbstractProducerWidget()
{
}

void AbstractProducerWidget::setProducer(Mlt::Producer* producer)
void AbstractProducerWidget::setProducer(Mlt::Producer *producer)
{
if (producer) {
loadPreset(*producer);
Expand Down
16 changes: 11 additions & 5 deletions src/abstractproducerwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,18 @@ class AbstractProducerWidget
public:
AbstractProducerWidget();
virtual ~AbstractProducerWidget();
virtual Mlt::Producer* newProducer(Mlt::Profile&) = 0;
virtual void setProducer(Mlt::Producer*);
virtual Mlt::Producer *newProducer(Mlt::Profile &) = 0;
virtual void setProducer(Mlt::Producer *);
virtual Mlt::Properties getPreset() const
{ Mlt::Properties p; return p; }
virtual void loadPreset(Mlt::Properties&) {}
Mlt::Producer* producer() const { return m_producer.data(); }
{
Mlt::Properties p;
return p;
}
virtual void loadPreset(Mlt::Properties &) {}
Mlt::Producer *producer() const
{
return m_producer.data();
}

protected:
QScopedPointer<Mlt::Producer> m_producer;
Expand Down
7 changes: 4 additions & 3 deletions src/autosavefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ static const QLatin1String extension(".mlt");

static QString hashName(const QString &name)
{
return QString::fromLatin1(QCryptographicHash::hash(name.toUtf8(), QCryptographicHash::Md5).toHex());
return QString::fromLatin1(QCryptographicHash::hash(name.toUtf8(),
QCryptographicHash::Md5).toHex());
}

AutoSaveFile::AutoSaveFile(const QString &filename, QObject *parent)
Expand Down Expand Up @@ -72,9 +73,9 @@ bool AutoSaveFile::open(OpenMode openmode)
return QFile::open(openmode);
}

AutoSaveFile* AutoSaveFile::getFile(const QString &filename)
AutoSaveFile *AutoSaveFile::getFile(const QString &filename)
{
AutoSaveFile* result = 0;
AutoSaveFile *result = 0;
QDir appDir(path());
QFileInfo info(appDir.absolutePath(), hashName(filename) + extension);

Expand Down
9 changes: 6 additions & 3 deletions src/autosavefile.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef AUTOSAVEFILE_H
#define AUTOSAVEFILE_H

Expand All @@ -31,11 +31,14 @@ class AutoSaveFile : public QFile
explicit AutoSaveFile(const QString &filename, QObject *parent = 0);
~AutoSaveFile();

QString managedFileName() const { return m_managedFile; }
QString managedFileName() const
{
return m_managedFile;
}
void changeManagedFile(const QString &filename);

virtual bool open(OpenMode openmode);
static AutoSaveFile* getFile(const QString &filename);
static AutoSaveFile *getFile(const QString &filename);
static QString path();

private:
Expand Down
27 changes: 11 additions & 16 deletions src/commands/markercommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
#include "markercommands.h"
#include <Logger.h>

namespace Markers
{
namespace Markers {

DeleteCommand::DeleteCommand(MarkersModel& model, const Marker& delMarker, int index)
DeleteCommand::DeleteCommand(MarkersModel &model, const Marker &delMarker, int index)
: QUndoCommand(0)
, m_model(model)
, m_delMarker(delMarker)
Expand All @@ -40,7 +39,7 @@ void DeleteCommand::undo()
m_model.doInsert(m_index, m_delMarker);
}

AppendCommand::AppendCommand(MarkersModel& model, const Marker& newMarker, int index)
AppendCommand::AppendCommand(MarkersModel &model, const Marker &newMarker, int index)
: QUndoCommand(0)
, m_model(model)
, m_newMarker(newMarker)
Expand All @@ -60,19 +59,17 @@ void AppendCommand::undo()
}


UpdateCommand::UpdateCommand(MarkersModel& model, const Marker& newMarker, const Marker& oldMarker, int index)
UpdateCommand::UpdateCommand(MarkersModel &model, const Marker &newMarker, const Marker &oldMarker,
int index)
: QUndoCommand(0)
, m_model(model)
, m_newMarker(newMarker)
, m_oldMarker(oldMarker)
, m_index(index)
{
if (m_newMarker.text == m_oldMarker.text && m_newMarker.color == m_oldMarker.color)
{
if (m_newMarker.text == m_oldMarker.text && m_newMarker.color == m_oldMarker.color) {
setText(QObject::tr("Move marker: %1").arg(m_oldMarker.text));
}
else
{
} else {
setText(QObject::tr("Edit marker: %1").arg(m_oldMarker.text));
}
}
Expand All @@ -89,19 +86,17 @@ void UpdateCommand::undo()

bool UpdateCommand::mergeWith(const QUndoCommand *other)
{
const UpdateCommand* that = static_cast<const UpdateCommand*>(other);
const UpdateCommand *that = static_cast<const UpdateCommand *>(other);
LOG_DEBUG() << "this index" << m_index << "that index" << that->m_index;
if (that->id() != id() || that->m_index != m_index)
return false;
bool merge = false;
if (that->m_newMarker.text == m_oldMarker.text &&
that->m_newMarker.color == m_oldMarker.color)
{
that->m_newMarker.color == m_oldMarker.color) {
// Only start/end change. Merge with previous move command.
merge = true;
} else if (that->m_newMarker.end == m_oldMarker.end &&
that->m_newMarker.start == m_oldMarker.start)
{
that->m_newMarker.start == m_oldMarker.start) {
// Only text/color change. Merge with previous edit command.
merge = true;
}
Expand All @@ -110,7 +105,7 @@ bool UpdateCommand::mergeWith(const QUndoCommand *other)
return true;
}

ClearCommand::ClearCommand(MarkersModel& model, QList<Marker>& clearMarkers)
ClearCommand::ClearCommand(MarkersModel &model, QList<Marker> &clearMarkers)
: QUndoCommand(0)
, m_model(model)
, m_clearMarkers(clearMarkers)
Expand Down
24 changes: 13 additions & 11 deletions src/commands/markercommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
#include "models/markersmodel.h"
#include <QUndoCommand>

namespace Markers
{
namespace Markers {

enum {
UndoIdUpdate,
Expand All @@ -31,38 +30,41 @@ enum {
class DeleteCommand : public QUndoCommand
{
public:
DeleteCommand(MarkersModel& model, const Marker& delMarker, int index);
DeleteCommand(MarkersModel &model, const Marker &delMarker, int index);
void redo();
void undo();
private:
MarkersModel& m_model;
MarkersModel &m_model;
Marker m_delMarker;
int m_index;
};

class AppendCommand : public QUndoCommand
{
public:
AppendCommand(MarkersModel& model, const Marker& newMarker, int index);
AppendCommand(MarkersModel &model, const Marker &newMarker, int index);
void redo();
void undo();
private:
MarkersModel& m_model;
MarkersModel &m_model;
Marker m_newMarker;
int m_index;
};

class UpdateCommand : public QUndoCommand
{
public:
UpdateCommand(MarkersModel& model, const Marker& newMarker, const Marker& oldMarker, int index);
UpdateCommand(MarkersModel &model, const Marker &newMarker, const Marker &oldMarker, int index);
void redo();
void undo();
protected:
int id() const { return UndoIdUpdate; }
int id() const
{
return UndoIdUpdate;
}
bool mergeWith(const QUndoCommand *other);
private:
MarkersModel& m_model;
MarkersModel &m_model;
Marker m_newMarker;
Marker m_oldMarker;
int m_index;
Expand All @@ -71,11 +73,11 @@ class UpdateCommand : public QUndoCommand
class ClearCommand : public QUndoCommand
{
public:
ClearCommand(MarkersModel& model, QList<Marker>& clearMarkers);
ClearCommand(MarkersModel &model, QList<Marker> &clearMarkers);
void redo();
void undo();
private:
MarkersModel& m_model;
MarkersModel &m_model;
QList<Marker> m_clearMarkers;
};

Expand Down
38 changes: 22 additions & 16 deletions src/commands/playlistcommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
#include "mainwindow.h"
#include <Logger.h>

namespace Playlist
{
namespace Playlist {

AppendCommand::AppendCommand(PlaylistModel& model, const QString& xml, bool emitModified, QUndoCommand *parent)
AppendCommand::AppendCommand(PlaylistModel &model, const QString &xml, bool emitModified,
QUndoCommand *parent)
: QUndoCommand(parent)
, m_model(model)
, m_xml(xml)
Expand All @@ -45,7 +45,8 @@ void AppendCommand::undo()
m_model.remove(m_model.rowCount() - 1);
}

InsertCommand::InsertCommand(PlaylistModel& model, const QString& xml, int row, QUndoCommand *parent)
InsertCommand::InsertCommand(PlaylistModel &model, const QString &xml, int row,
QUndoCommand *parent)
: QUndoCommand(parent)
, m_model(model)
, m_xml(xml)
Expand All @@ -67,7 +68,8 @@ void InsertCommand::undo()
m_model.remove(m_row);
}

UpdateCommand::UpdateCommand(PlaylistModel& model, const QString& xml, int row, QUndoCommand *parent)
UpdateCommand::UpdateCommand(PlaylistModel &model, const QString &xml, int row,
QUndoCommand *parent)
: QUndoCommand(parent)
, m_model(model)
, m_newXml(xml)
Expand Down Expand Up @@ -95,15 +97,15 @@ void UpdateCommand::undo()

bool UpdateCommand::mergeWith(const QUndoCommand *other)
{
const UpdateCommand* that = static_cast<const UpdateCommand*>(other);
const UpdateCommand *that = static_cast<const UpdateCommand *>(other);
LOG_DEBUG() << "this row" << m_row << "that row" << that->m_row;
if (that->id() != id() || that->m_row != m_row)
return false;
m_newXml = that->m_newXml;
return true;
}

RemoveCommand::RemoveCommand(PlaylistModel& model, int row, QUndoCommand *parent)
RemoveCommand::RemoveCommand(PlaylistModel &model, int row, QUndoCommand *parent)
: QUndoCommand(parent)
, m_model(model)
, m_row(row)
Expand All @@ -127,7 +129,7 @@ void RemoveCommand::undo()
m_model.insert(producer, m_row);
}

ClearCommand::ClearCommand(PlaylistModel& model, QUndoCommand *parent)
ClearCommand::ClearCommand(PlaylistModel &model, QUndoCommand *parent)
: QUndoCommand(parent)
, m_model(model)
{
Expand All @@ -144,7 +146,8 @@ void ClearCommand::redo()
void ClearCommand::undo()
{
LOG_DEBUG() << "";
Mlt::Producer* producer = new Mlt::Producer(MLT.profile(), "xml-string", m_xml.toUtf8().constData());
Mlt::Producer *producer = new Mlt::Producer(MLT.profile(), "xml-string",
m_xml.toUtf8().constData());
if (producer->is_valid()) {
producer->set("resource", "<playlist>");
if (!MLT.setProducer(producer)) {
Expand Down Expand Up @@ -178,7 +181,8 @@ void MoveCommand::undo()
m_model.move(m_to, m_from);
}

SortCommand::SortCommand(PlaylistModel& model, int column, Qt::SortOrder order, QUndoCommand *parent)
SortCommand::SortCommand(PlaylistModel &model, int column, Qt::SortOrder order,
QUndoCommand *parent)
: QUndoCommand(parent)
, m_model(model)
, m_column(column)
Expand All @@ -198,7 +202,8 @@ void SortCommand::redo()
void SortCommand::undo()
{
LOG_DEBUG() << "";
Mlt::Producer* producer = new Mlt::Producer(MLT.profile(), "xml-string", m_xml.toUtf8().constData());
Mlt::Producer *producer = new Mlt::Producer(MLT.profile(), "xml-string",
m_xml.toUtf8().constData());
if (producer->is_valid()) {
producer->set("resource", "<playlist>");
if (!MLT.setProducer(producer)) {
Expand All @@ -211,7 +216,7 @@ void SortCommand::undo()
}
}

TrimClipInCommand::TrimClipInCommand(PlaylistModel& model, int row, int in, QUndoCommand *parent)
TrimClipInCommand::TrimClipInCommand(PlaylistModel &model, int row, int in, QUndoCommand *parent)
: QUndoCommand(parent)
, m_model(model)
, m_row(row)
Expand Down Expand Up @@ -241,15 +246,15 @@ void TrimClipInCommand::undo()

bool TrimClipInCommand::mergeWith(const QUndoCommand *other)
{
const TrimClipInCommand* that = static_cast<const TrimClipInCommand*>(other);
const TrimClipInCommand *that = static_cast<const TrimClipInCommand *>(other);
LOG_DEBUG() << "this row" << m_row << "that row" << that->m_row;
if (that->id() != id() || that->m_row != m_row)
return false;
m_newIn = that->m_newIn;
return true;
}

TrimClipOutCommand::TrimClipOutCommand(PlaylistModel& model, int row, int out, QUndoCommand *parent)
TrimClipOutCommand::TrimClipOutCommand(PlaylistModel &model, int row, int out, QUndoCommand *parent)
: QUndoCommand(parent)
, m_model(model)
, m_row(row)
Expand Down Expand Up @@ -279,15 +284,16 @@ void TrimClipOutCommand::undo()

bool TrimClipOutCommand::mergeWith(const QUndoCommand *other)
{
const TrimClipOutCommand* that = static_cast<const TrimClipOutCommand*>(other);
const TrimClipOutCommand *that = static_cast<const TrimClipOutCommand *>(other);
LOG_DEBUG() << "this row" << m_row << "that row" << that->m_row;
if (that->id() != id() || that->m_row != m_row)
return false;
m_newOut = that->m_newOut;
return true;
}

ReplaceCommand::ReplaceCommand(PlaylistModel& model, const QString& xml, int row, QUndoCommand* parent)
ReplaceCommand::ReplaceCommand(PlaylistModel &model, const QString &xml, int row,
QUndoCommand *parent)
: QUndoCommand(parent)
, m_model(model)
, m_newXml(xml)
Expand Down
Loading

0 comments on commit 0350b90

Please sign in to comment.