Commit c42a0262 authored by Ray Lehtiniemi's avatar Ray Lehtiniemi

Reindent the codebase using 'linux' bracket placement.

Signed-off-by: default avatarRay Lehtiniemi <rayl@mail.com>

svn path=/trunk/kdenlive/; revision=3207
parent 00cd3b8d
......@@ -30,12 +30,14 @@
#include <QDomDocument>
#include <QInputDialog>
QStringList SamplePlugin::generators() const {
QStringList SamplePlugin::generators() const
{
return QStringList() << i18n("Countdown") << i18n("Noise");
}
KUrl SamplePlugin::generatedClip(const QString &generator, const KUrl &projectFolder, const QStringList &/*lumaNames*/, const QStringList &/*lumaFiles*/, const double fps, const int /*width*/, const int /*height*/) {
KUrl SamplePlugin::generatedClip(const QString &generator, const KUrl &projectFolder, const QStringList &/*lumaNames*/, const QStringList &/*lumaFiles*/, const double fps, const int /*width*/, const int /*height*/)
{
QString prePath;
if (generator == i18n("Noise")) {
prePath = projectFolder.path() + "/noise";
......
......@@ -28,7 +28,8 @@
#include "interfaces.h"
class SamplePlugin : public QObject, public ClipGenerator {
class SamplePlugin : public QObject, public ClipGenerator
{
Q_OBJECT
Q_INTERFACES(ClipGenerator)
......
......@@ -25,7 +25,8 @@
#include "renderjob.h"
int main(int argc, char **argv) {
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
QStringList args = app.arguments();
QStringList preargs;
......
......@@ -25,7 +25,8 @@
#include <QThread>
// Can't believe I need to do this to sleep.
class SleepThread : QThread {
class SleepThread : QThread
{
public:
virtual void run() {};
static void msleep(unsigned long msecs) {
......@@ -35,7 +36,8 @@ public:
static QDBusConnection connection(QLatin1String(""));
RenderJob::RenderJob(bool erase, bool usekuiserver, const QString &renderer, const QString &profile, const QString &rendermodule, const QString &player, const QString &scenelist, const QString &dest, const QStringList &preargs, const QStringList &args, int in, int out) : QObject(), m_usekuiserver(usekuiserver), m_jobUiserver(NULL), m_kdenliveinterface(NULL) {
RenderJob::RenderJob(bool erase, bool usekuiserver, const QString &renderer, const QString &profile, const QString &rendermodule, const QString &player, const QString &scenelist, const QString &dest, const QStringList &preargs, const QStringList &args, int in, int out) : QObject(), m_usekuiserver(usekuiserver), m_jobUiserver(NULL), m_kdenliveinterface(NULL)
{
m_scenelist = scenelist;
m_dest = dest;
m_player = player;
......@@ -85,16 +87,19 @@ RenderJob::RenderJob(bool erase, bool usekuiserver, const QString &renderer, con
}
RenderJob::~RenderJob() {
RenderJob::~RenderJob()
{
if (m_renderProcess) delete m_renderProcess;
// m_logfile.close();
}
void RenderJob::slotAbort(const QString& url) {
void RenderJob::slotAbort(const QString& url)
{
if (m_dest == url) slotAbort();
}
void RenderJob::slotAbort() {
void RenderJob::slotAbort()
{
qDebug() << "Kdenlive-render: JOB ABORTED BY USER...";
m_renderProcess->kill();
......@@ -118,7 +123,8 @@ void RenderJob::slotAbort() {
qApp->quit();
}
void RenderJob::receivedStderr() {
void RenderJob::receivedStderr()
{
QString result = QString(m_renderProcess->readAllStandardError()).simplified();
if (!result.startsWith("Current Frame")) m_errorMessage.append(result + "<br>");
else {
......@@ -153,7 +159,8 @@ void RenderJob::receivedStderr() {
}
}
void RenderJob::start() {
void RenderJob::start()
{
QDBusConnectionInterface* interface = QDBusConnection::sessionBus().interface();
if (interface && m_usekuiserver) {
if (!interface->isServiceRegistered("org.kde.JobViewServer")) {
......@@ -199,7 +206,8 @@ void RenderJob::start() {
}
void RenderJob::initKdenliveDbusInterface() {
void RenderJob::initKdenliveDbusInterface()
{
QString kdenliveId;
QDBusConnection connection = QDBusConnection::sessionBus();
QDBusConnectionInterface *ibus = connection.interface();
......@@ -228,7 +236,8 @@ void RenderJob::initKdenliveDbusInterface() {
}
void RenderJob::slotIsOver(int /*exitcode*/, QProcess::ExitStatus status) {
void RenderJob::slotIsOver(int /*exitcode*/, QProcess::ExitStatus status)
{
if (m_jobUiserver) m_jobUiserver->call("terminate", QString());
if (m_erase) {
QFile f(m_scenelist);
......
......@@ -29,7 +29,8 @@
#include <QTemporaryFile>
#include <QTextStream>
class RenderJob : public QObject {
class RenderJob : public QObject
{
Q_OBJECT
public:
......
......@@ -28,14 +28,16 @@
#include <QPainter>
#include <QToolTip>
AbstractClipItem::AbstractClipItem(const ItemInfo info, const QRectF& rect, double fps): QGraphicsRectItem(rect), m_track(0), m_fps(fps), m_editedKeyframe(-1), m_selectedKeyframe(0), m_keyframeFactor(1) {
AbstractClipItem::AbstractClipItem(const ItemInfo info, const QRectF& rect, double fps): QGraphicsRectItem(rect), m_track(0), m_fps(fps), m_editedKeyframe(-1), m_selectedKeyframe(0), m_keyframeFactor(1)
{
setFlags(/*QGraphicsItem::ItemClipsToShape | */QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
setTrack(info.track);
m_startPos = info.startPos;
m_cropDuration = info.endPos - info.startPos;
}
ItemInfo AbstractClipItem::info() const {
ItemInfo AbstractClipItem::info() const
{
ItemInfo itemInfo;
itemInfo.startPos = startPos();
itemInfo.endPos = endPos();
......@@ -44,36 +46,44 @@ ItemInfo AbstractClipItem::info() const {
return itemInfo;
}
GenTime AbstractClipItem::endPos() const {
GenTime AbstractClipItem::endPos() const
{
return m_startPos + m_cropDuration;
}
int AbstractClipItem::track() const {
int AbstractClipItem::track() const
{
return m_track;
}
GenTime AbstractClipItem::cropStart() const {
GenTime AbstractClipItem::cropStart() const
{
return m_cropStart;
}
GenTime AbstractClipItem::cropDuration() const {
GenTime AbstractClipItem::cropDuration() const
{
return m_cropDuration;
}
void AbstractClipItem::setCropStart(GenTime pos) {
void AbstractClipItem::setCropStart(GenTime pos)
{
m_cropStart = pos;
}
void AbstractClipItem::updateItem() {
void AbstractClipItem::updateItem()
{
m_track = (int)(scenePos().y() / KdenliveSettings::trackheight());
m_startPos = GenTime((int) scenePos().x(), m_fps);
}
void AbstractClipItem::updateRectGeometry() {
void AbstractClipItem::updateRectGeometry()
{
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
}
void AbstractClipItem::resizeStart(int posx, double speed) {
void AbstractClipItem::resizeStart(int posx, double speed)
{
GenTime durationDiff = GenTime(posx, m_fps) - m_startPos;
if (durationDiff == GenTime()) return;
//kDebug() << "-- RESCALE DIFF=" << durationDiff.frames(25) << ", CLIP: " << startPos().frames(25) << "-" << endPos().frames(25);
......@@ -124,7 +134,8 @@ void AbstractClipItem::resizeStart(int posx, double speed) {
}*/
}
void AbstractClipItem::resizeEnd(int posx, double speed, bool /*updateKeyFrames*/) {
void AbstractClipItem::resizeEnd(int posx, double speed, bool /*updateKeyFrames*/)
{
GenTime durationDiff = GenTime(posx, m_fps) - endPos();
if (durationDiff == GenTime()) return;
//kDebug() << "// DUR DIFF1:" << durationDiff.frames(25) << ", ADJUSTED: " << durationDiff.frames(25) * speed << ", SPED:" << speed;
......@@ -154,31 +165,38 @@ void AbstractClipItem::resizeEnd(int posx, double speed, bool /*updateKeyFrames*
}
}
GenTime AbstractClipItem::duration() const {
GenTime AbstractClipItem::duration() const
{
return m_cropDuration;
}
GenTime AbstractClipItem::startPos() const {
GenTime AbstractClipItem::startPos() const
{
return m_startPos;
}
void AbstractClipItem::setTrack(int track) {
void AbstractClipItem::setTrack(int track)
{
m_track = track;
}
double AbstractClipItem::fps() const {
double AbstractClipItem::fps() const
{
return m_fps;
}
GenTime AbstractClipItem::maxDuration() const {
GenTime AbstractClipItem::maxDuration() const
{
return m_maxDuration;
}
void AbstractClipItem::setMaxDuration(const GenTime &max) {
void AbstractClipItem::setMaxDuration(const GenTime &max)
{
m_maxDuration = max;
}
QPainterPath AbstractClipItem::upperRectPart(QRectF br) {
QPainterPath AbstractClipItem::upperRectPart(QRectF br)
{
QPainterPath roundRectPathUpper;
double roundingY = 20;
double roundingX = 20;
......@@ -202,7 +220,8 @@ QPainterPath AbstractClipItem::upperRectPart(QRectF br) {
return roundRectPathUpper;
}
QPainterPath AbstractClipItem::lowerRectPart(QRectF br) {
QPainterPath AbstractClipItem::lowerRectPart(QRectF br)
{
QPainterPath roundRectPathLower;
double roundingY = 20;
double roundingX = 20;
......@@ -225,7 +244,8 @@ QPainterPath AbstractClipItem::lowerRectPart(QRectF br) {
return roundRectPathLower;
}
void AbstractClipItem::drawKeyFrames(QPainter *painter, QRectF /*exposedRect*/) {
void AbstractClipItem::drawKeyFrames(QPainter *painter, QRectF /*exposedRect*/)
{
if (m_keyframes.count() < 2) return;
QRectF br = rect();
double maxw = br.width() / m_cropDuration.frames(m_fps);
......@@ -275,7 +295,8 @@ void AbstractClipItem::drawKeyFrames(QPainter *painter, QRectF /*exposedRect*/)
if (isSelected()) painter->fillRect(l2.x2() - 3, l2.y2() - 3, 6, 6, QBrush(color));
}
int AbstractClipItem::mouseOverKeyFrames(QPointF pos) {
int AbstractClipItem::mouseOverKeyFrames(QPointF pos)
{
QRectF br = sceneBoundingRect();
double maxw = br.width() / m_cropDuration.frames(m_fps);
double maxh = br.height() / 100.0 * m_keyframeFactor;
......@@ -297,7 +318,8 @@ int AbstractClipItem::mouseOverKeyFrames(QPointF pos) {
return -1;
}
void AbstractClipItem::updateSelectedKeyFrame() {
void AbstractClipItem::updateSelectedKeyFrame()
{
if (m_editedKeyframe == -1) return;
QRectF br = sceneBoundingRect();
double maxw = br.width() / m_cropDuration.frames(m_fps);
......@@ -307,15 +329,18 @@ void AbstractClipItem::updateSelectedKeyFrame() {
update(br.x() + maxw * (m_selectedKeyframe - m_cropStart.frames(m_fps)) - 3, br.bottom() - m_keyframes[m_selectedKeyframe] * maxh - 3, 12, 12);
}
int AbstractClipItem::selectedKeyFramePos() const {
int AbstractClipItem::selectedKeyFramePos() const
{
return m_editedKeyframe;
}
double AbstractClipItem::selectedKeyFrameValue() const {
double AbstractClipItem::selectedKeyFrameValue() const
{
return m_keyframes[m_editedKeyframe];
}
void AbstractClipItem::updateKeyFramePos(const GenTime pos, const double value) {
void AbstractClipItem::updateKeyFramePos(const GenTime pos, const double value)
{
if (!m_keyframes.contains(m_selectedKeyframe)) return;
int newpos = (int) pos.frames(m_fps);
int start = m_cropStart.frames(m_fps);
......@@ -345,11 +370,13 @@ void AbstractClipItem::updateKeyFramePos(const GenTime pos, const double value)
update();
}
double AbstractClipItem::keyFrameFactor() const {
double AbstractClipItem::keyFrameFactor() const
{
return m_keyframeFactor;
}
void AbstractClipItem::addKeyFrame(const GenTime pos, const double value) {
void AbstractClipItem::addKeyFrame(const GenTime pos, const double value)
{
QRectF br = sceneBoundingRect();
double maxh = 100.0 / br.height() / m_keyframeFactor;
double newval = (br.bottom() - value) * maxh;
......@@ -360,7 +387,8 @@ void AbstractClipItem::addKeyFrame(const GenTime pos, const double value) {
update();
}
bool AbstractClipItem::hasKeyFrames() const {
bool AbstractClipItem::hasKeyFrames() const
{
return !m_keyframes.isEmpty();
}
......@@ -375,12 +403,14 @@ bool AbstractClipItem::hasKeyFrames() const {
return rectInView;
}*/
CustomTrackScene* AbstractClipItem::projectScene() {
CustomTrackScene* AbstractClipItem::projectScene()
{
if (scene()) return static_cast <CustomTrackScene*>(scene());
return NULL;
}
void AbstractClipItem::setItemLocked(bool locked) {
void AbstractClipItem::setItemLocked(bool locked)
{
if (locked) {
setSelected(false);
setFlag(QGraphicsItem::ItemIsMovable, false);
......@@ -388,7 +418,8 @@ void AbstractClipItem::setItemLocked(bool locked) {
} else setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
}
bool AbstractClipItem::isItemLocked() const {
bool AbstractClipItem::isItemLocked() const
{
return !(flags() & (QGraphicsItem::ItemIsSelectable));
}
......@@ -27,7 +27,8 @@
class CustomTrackScene;
class AbstractClipItem : public QObject , public QGraphicsRectItem {
class AbstractClipItem : public QObject , public QGraphicsRectItem
{
Q_OBJECT
public:
AbstractClipItem(const ItemInfo info, const QRectF& rect, double fps);
......
......@@ -32,26 +32,31 @@
#include <QMimeData>
AbstractGroupItem::AbstractGroupItem(double fps): QGraphicsItemGroup(), m_fps(fps) {
AbstractGroupItem::AbstractGroupItem(double fps): QGraphicsItemGroup(), m_fps(fps)
{
setZValue(2);
setFlags(QGraphicsItem::ItemClipsToShape | QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
setAcceptDrops(true);
}
int AbstractGroupItem::type() const {
int AbstractGroupItem::type() const
{
return GROUPWIDGET;
}
int AbstractGroupItem::track() const {
int AbstractGroupItem::track() const
{
return (int)(scenePos().y() / KdenliveSettings::trackheight());
}
CustomTrackScene* AbstractGroupItem::projectScene() {
CustomTrackScene* AbstractGroupItem::projectScene()
{
if (scene()) return static_cast <CustomTrackScene*>(scene());
return NULL;
}
QPainterPath AbstractGroupItem::groupShape(QPointF offset) {
QPainterPath AbstractGroupItem::groupShape(QPointF offset)
{
QPainterPath path;
QList<QGraphicsItem *> children = childItems();
for (int i = 0; i < children.count(); i++) {
......@@ -64,12 +69,14 @@ QPainterPath AbstractGroupItem::groupShape(QPointF offset) {
return path;
}
void AbstractGroupItem::addItem(QGraphicsItem * item) {
void AbstractGroupItem::addItem(QGraphicsItem * item)
{
addToGroup(item);
//fixItemRect();
}
void AbstractGroupItem::fixItemRect() {
void AbstractGroupItem::fixItemRect()
{
QPointF start = boundingRect().topLeft();
if (start != QPointF(0, 0)) {
translate(0 - start.x(), 0 - start.y());
......@@ -85,7 +92,8 @@ void AbstractGroupItem::fixItemRect() {
}*/
// virtual
void AbstractGroupItem::paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *) {
void AbstractGroupItem::paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *)
{
const double scale = option->matrix.m11();
QRect clipRect = option->exposedRect.toRect();
clipRect.adjust(0, 0, 1 / scale + 0.5, 1);
......@@ -99,7 +107,8 @@ void AbstractGroupItem::paint(QPainter *p, const QStyleOptionGraphicsItem *optio
}
//virtual
QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant &value) {
QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
if (change == ItemPositionChange && scene()) {
// calculate new position.
const int trackHeight = KdenliveSettings::trackheight();
......@@ -203,7 +212,8 @@ QVariant AbstractGroupItem::itemChange(GraphicsItemChange change, const QVariant
}
//virtual
void AbstractGroupItem::dropEvent(QGraphicsSceneDragDropEvent * event) {
void AbstractGroupItem::dropEvent(QGraphicsSceneDragDropEvent * event)
{
QString effects = QString(event->mimeData()->data("kdenlive/effectslist"));
QDomDocument doc;
doc.setContent(effects, true);
......@@ -213,10 +223,12 @@ void AbstractGroupItem::dropEvent(QGraphicsSceneDragDropEvent * event) {
}
//virtual
void AbstractGroupItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event) {
void AbstractGroupItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
{
event->setAccepted(event->mimeData()->hasFormat("kdenlive/effectslist"));
}
void AbstractGroupItem::dragLeaveEvent(QGraphicsSceneDragDropEvent *event) {
void AbstractGroupItem::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
{
Q_UNUSED(event);
}
......@@ -29,7 +29,8 @@
class CustomTrackScene;
class AbstractGroupItem : public QObject , public QGraphicsItemGroup {
class AbstractGroupItem : public QObject , public QGraphicsItemGroup
{
Q_OBJECT
public:
AbstractGroupItem(double fps);
......
......@@ -23,20 +23,23 @@
#include <KLocale>
AddClipCommand::AddClipCommand(KdenliveDoc *doc, const QDomElement &xml, const QString &id, bool doIt, QUndoCommand * parent) : QUndoCommand(parent), m_doc(doc), m_xml(xml), m_id(id), m_doIt(doIt) {
AddClipCommand::AddClipCommand(KdenliveDoc *doc, const QDomElement &xml, const QString &id, bool doIt, QUndoCommand * parent) : QUndoCommand(parent), m_doc(doc), m_xml(xml), m_id(id), m_doIt(doIt)
{
if (doIt) setText(i18n("Add clip"));
else setText(i18n("Delete clip"));
}
// virtual
void AddClipCommand::undo() {
void AddClipCommand::undo()
{
kDebug() << "---- undoing action";
if (m_doIt) m_doc->deleteClip(m_id);
else m_doc->addClip(m_xml, m_id);
}
// virtual
void AddClipCommand::redo() {
void AddClipCommand::redo()
{
kDebug() << "---- redoing action";
if (m_doIt) m_doc->addClip(m_xml, m_id);
else m_doc->deleteClip(m_id);
......
......@@ -27,7 +27,8 @@
class KdenliveDoc;
class AddClipCommand : public QUndoCommand {
class AddClipCommand : public QUndoCommand
{
public:
AddClipCommand(KdenliveDoc *doc, const QDomElement &xml, const QString &id, bool doIt, QUndoCommand * parent = 0);
......
......@@ -23,7 +23,8 @@
#include <KLocale>
AddEffectCommand::AddEffectCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement effect, bool doIt, QUndoCommand * parent) : QUndoCommand(parent), m_view(view), m_track(track), m_pos(pos), m_effect(effect), m_doIt(doIt) {
AddEffectCommand::AddEffectCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement effect, bool doIt, QUndoCommand * parent) : QUndoCommand(parent), m_view(view), m_track(track), m_pos(pos), m_effect(effect), m_doIt(doIt)
{
QString effectName;
QDomNode namenode = effect.elementsByTagName("name").item(0);
if (!namenode.isNull()) effectName = i18n(namenode.toElement().text().toUtf8().data());
......@@ -34,13 +35,15 @@ AddEffectCommand::AddEffectCommand(CustomTrackView *view, const int track, GenTi
// virtual
void AddEffectCommand::undo() {
void AddEffectCommand::undo()
{
kDebug() << "---- undoing action";
if (m_doIt) m_view->deleteEffect(m_track, m_pos, m_effect);
else m_view->addEffect(m_track, m_pos, m_effect);
}
// virtual
void AddEffectCommand::redo() {
void AddEffectCommand::redo()
{
kDebug() << "---- redoing action";
if (m_doIt) m_view->addEffect(m_track, m_pos, m_effect);
else m_view->deleteEffect(m_track, m_pos, m_effect);
......
......@@ -28,7 +28,8 @@
class CustomTrackView;
class AddEffectCommand : public QUndoCommand {
class AddEffectCommand : public QUndoCommand
{
public:
AddEffectCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement effect, bool doIt, QUndoCommand * parent = 0);
......
......@@ -23,18 +23,21 @@
#include <KLocale>
AddFolderCommand::AddFolderCommand(ProjectList *view, const QString folderName, const QString &clipId, bool doIt, QUndoCommand *parent) : QUndoCommand(parent), m_view(view), m_name(folderName), m_id(clipId), m_doIt(doIt) {
AddFolderCommand::AddFolderCommand(ProjectList *view, const QString folderName, const QString &clipId, bool doIt, QUndoCommand *parent) : QUndoCommand(parent), m_view(view), m_name(folderName), m_id(clipId), m_doIt(doIt)
{
if (doIt) setText(i18n("Add folder"));
else setText(i18n("Delete folder"));
}
// virtual
void AddFolderCommand::undo() {
void AddFolderCommand::undo()
{
if (m_doIt) m_view->slotAddFolder(m_name, m_id, true);
else m_view->slotAddFolder(m_name, m_id, false);
}
// virtual
void AddFolderCommand::redo() {
void AddFolderCommand::redo()
{
if (m_doIt) m_view->slotAddFolder(m_name, m_id, false);
else m_view->slotAddFolder(m_name, m_id, true);
}
......
......@@ -25,7 +25,8 @@
class ProjectList;
class AddFolderCommand : public QUndoCommand {
class AddFolderCommand : public QUndoCommand
{
public:
AddFolderCommand(ProjectList *view, const QString folderName, const QString &clipId, bool doIt, QUndoCommand *parent = 0);
......
......@@ -21,7 +21,8 @@
#include <KLocale>
AddMarkerCommand::AddMarkerCommand(CustomTrackView *view, const QString &oldcomment, const QString &comment, const QString &id, const GenTime &pos, bool doIt, QUndoCommand * parent) : QUndoCommand(parent), m_view(view), m_oldcomment(oldcomment), m_comment(comment), m_id(id), m_pos(pos), m_doIt(doIt) {
AddMarkerCommand::AddMarkerCommand(CustomTrackView *view, const QString &oldcomment, const QString &comment, const QString &id, const GenTime &pos, bool doIt, QUndoCommand * parent) : QUndoCommand(parent), m_view(view), m_oldcomment(oldcomment), m_comment(comment), m_id(id), m_pos(pos), m_doIt(doIt)
{
if (m_comment.isEmpty()) setText(i18n("Delete marker"));
else if (m_oldcomment.isEmpty()) setText(i18n("Add marker"));
else setText(i18n("Edit marker"));
......@@ -29,11 +30,13 @@ AddMarkerCommand::AddMarkerCommand(CustomTrackView *view, const QString &oldcomm
// virtual
void AddMarkerCommand::undo() {
void AddMarkerCommand::undo()
{
m_view->addMarker(m_id, m_pos, m_oldcomment);