*/
void drawKeyFrames(QPainter *painter, const QTransform &transformation, bool limitedKeyFrames);
int mouseOverKeyFrames(QPointF pos, double maxOffset);
- virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
+ void mousePressEvent(QGraphicsSceneMouseEvent * event);
};
AbstractGroupItem::AbstractGroupItem(double /* fps */) :
- QObject(),
- QGraphicsItemGroup()
+ QObject(),
+ QGraphicsItemGroup()
{
setZValue(1);
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
int topTrack = -1;
QList<QGraphicsItem *> children = childItems();
for (int i = 0; i < children.count(); ++i) {
- if (children.at(i)->type() == GROUPWIDGET) {
- children.append(children.at(i)->childItems());
- continue;
- }
+ if (children.at(i)->type() == GROUPWIDGET) {
+ children.append(children.at(i)->childItems());
+ continue;
+ }
AbstractClipItem *item = static_cast <AbstractClipItem *>(children.at(i));
if (item && (topTrack == -1 || topTrack > item->track())) {
- topTrack = item->track();
- }
+ topTrack = item->track();
+ }
}
return topTrack;
}
if (children.at(i)->type() == (int)type) {
QRectF r(children.at(i)->sceneBoundingRect());
r.translate(offset);
- r.setRight(scene()->width());
+ r.setRight(scene()->width());
path.addRect(r);
} else if (children.at(i)->type() == GROUPWIDGET) {
QList<QGraphicsItem *> subchildren = children.at(i)->childItems();
if (subchildren.at(j)->type() == (int)type) {
QRectF r(subchildren.at(j)->sceneBoundingRect());
r.translate(offset);
- r.setRight(scene()->width());
+ r.setRight(scene()->width());
path.addRect(r);
}
}
xpos = qMax(xpos, 0);
//kDebug()<<"GRP XPOS:"<<xpos<<", START:"<<start.x()<<",NEW:"<<newPos.x()<<"; SCENE:"<<scenePos().x()<<",POS:"<<pos().x();
newPos.setX((int)(pos().x() + xpos - (int) start.x()));
- QStringList lockedTracks = property("locked_tracks").toStringList();
+ QStringList lockedTracks = property("locked_tracks").toStringList();
int proposedTrack = (property("y_absolute").toInt() + newPos.y()) / trackHeight;
// Check if top item is a clip or a transition
int offset = 0;
int topTrack = -1;
- QList<int> groupTracks;
+ QList<int> groupTracks;
QList<QGraphicsItem *> children = childItems();
for (int i = 0; i < children.count(); ++i) {
int currentTrack = 0;
- if (children.at(i)->type() == AVWIDGET || children.at(i)->type() == TRANSITIONWIDGET) {
- currentTrack = static_cast <AbstractClipItem*> (children.at(i))->track();
- if (!groupTracks.contains(currentTrack)) groupTracks.append(currentTrack);
- }
- else if (children.at(i)->type() == GROUPWIDGET) {
- currentTrack = static_cast <AbstractGroupItem*> (children.at(i))->track();
- }
- else continue;
+ if (children.at(i)->type() == AVWIDGET || children.at(i)->type() == TRANSITIONWIDGET) {
+ currentTrack = static_cast <AbstractClipItem*> (children.at(i))->track();
+ if (!groupTracks.contains(currentTrack)) groupTracks.append(currentTrack);
+ }
+ else if (children.at(i)->type() == GROUPWIDGET) {
+ currentTrack = static_cast <AbstractGroupItem*> (children.at(i))->track();
+ }
+ else continue;
if (children.at(i)->type() == AVWIDGET) {
if (topTrack == -1 || currentTrack <= topTrack) {
offset = 0;
bool clipGroup = false;
for (int j = 0; j < subchildren.count(); j++) {
if (subchildren.at(j)->type() == AVWIDGET || subchildren.at(j)->type() == TRANSITIONWIDGET) {
- int subTrack = static_cast <AbstractClipItem*> (subchildren.at(j))->track();
- if (!groupTracks.contains(subTrack)) groupTracks.append(subTrack);
+ int subTrack = static_cast <AbstractClipItem*> (subchildren.at(j))->track();
+ if (!groupTracks.contains(subTrack)) groupTracks.append(subTrack);
clipGroup = true;
}
}
}
// Check no clip in the group goes outside of existing tracks
int maximumTrack = projectScene()->tracksCount() - 1;
- int groupHeight = 0;
- for (int i = 0; i < groupTracks.count(); ++i) {
- int offset = groupTracks.at(i) - topTrack;
- if (offset > groupHeight) groupHeight = offset;
- }
- maximumTrack -= groupHeight;
+ int groupHeight = 0;
+ for (int i = 0; i < groupTracks.count(); ++i) {
+ int offset = groupTracks.at(i) - topTrack;
+ if (offset > groupHeight) groupHeight = offset;
+ }
+ maximumTrack -= groupHeight;
proposedTrack = qMin(proposedTrack, maximumTrack);
proposedTrack = qMax(proposedTrack, 0);
- int groupOffset = proposedTrack - topTrack;
- if (!lockedTracks.isEmpty()) {
- for (int i = 0; i < groupTracks.count(); ++i) {
- if (lockedTracks.contains(QString::number(groupTracks.at(i) + groupOffset))) {
- return pos();
- }
- }
- }
+ int groupOffset = proposedTrack - topTrack;
+ if (!lockedTracks.isEmpty()) {
+ for (int i = 0; i < groupTracks.count(); ++i) {
+ if (lockedTracks.contains(QString::number(groupTracks.at(i) + groupOffset))) {
+ return pos();
+ }
+ }
+ }
newPos.setY((int)((proposedTrack) * trackHeight) + offset);
//if (newPos == start) return start;
QList<QGraphicsItem *> selection = scene()->items(dropPos);
AbstractClipItem *dropChild = NULL;
for (int i = 0; i < selection.count(); ++i) {
- if (selection.at(i)->type() == AVWIDGET) {
+ if (selection.at(i)->type() == AVWIDGET) {
dropChild = (AbstractClipItem *) selection.at(i);
- break;
+ break;
}
- }
+ }
if (view) view->slotAddGroupEffect(e, this, dropChild);
}
// User want to do a rectangle selection, so ignore the event to pass it to the view
event->ignore();
} else {
- QList <QGraphicsItem *>list = scene()->items(event->scenePos());
- // only allow group move if we click over an item in the group
- foreach(const QGraphicsItem *item, list) {
- if (item->type() == TRANSITIONWIDGET || item->type() == AVWIDGET) {
- QGraphicsItem::mousePressEvent(event);
- return;
- }
- }
- event->ignore();
+ QList <QGraphicsItem *>list = scene()->items(event->scenePos());
+ // only allow group move if we click over an item in the group
+ foreach(const QGraphicsItem *item, list) {
+ if (item->type() == TRANSITIONWIDGET || item->type() == AVWIDGET) {
+ QGraphicsItem::mousePressEvent(event);
+ return;
+ }
+ }
+ event->ignore();
}
}
stream.setFieldAlignment(QTextStream::AlignRight);
stream.setPadChar('0');
stream << color.red() << color.green() << color.blue();
- if(alpha)
- {
+ if (alpha) {
stream << color.alpha();
- }
- else {
+ } else {
// MLT always wants 0xRRGGBBAA format
stream << "ff";
}
bool allowCrop = true;
if (clip->type() == AVWIDGET) {
ClipItem *item = static_cast <ClipItem *>(clip);
- int t = item->clipType();
+ const int t = item->clipType();
if (t == COLOR || t == IMAGE || t == TEXT)
allowCrop = false;
}
{
QStringList result;
// Simple keyframes
- const QStringList list = keyframes.split(';', QString::SkipEmptyParts);
+ const QStringList list = keyframes.split(QLatin1Char(';'), QString::SkipEmptyParts);
foreach(const QString &keyframe, list) {
- int pos = keyframe.section(':', 0, 0).toInt() - offset;
- QString newKey = QString::number(pos) + ":" + keyframe.section(':', 1);
+ const int pos = keyframe.section(':', 0, 0).toInt() - offset;
+ const QString newKey = QString::number(pos) + ":" + keyframe.section(':', 1);
result.append(newKey);
}
return result.join(";");
QDomElement ClipItem::selectedEffect()
{
- if (m_selectedEffect == -1 || m_effectList.isEmpty()) return QDomElement();
+ if (m_selectedEffect == -1 || m_effectList.isEmpty())
+ return QDomElement();
return effectAtIndex(m_selectedEffect);
}
protected:
//virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
- virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
- virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
- virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
+ void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
+ void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
+ void dropEvent(QGraphicsSceneDragDropEvent *event);
//virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *);
//virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *);
- virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value);
private:
DocClipBase *m_clip;
QStringList values = i.value();
QString parentName;
QString iconName;
- if (values.count() > 1 && !values.at(1).isEmpty()) parentName = values.at(1);
- else {
+ if (values.count() > 1 && !values.at(1).isEmpty()) {
+ parentName = values.at(1);
+ } else {
if (KdenliveSettings::ffmpegpath().endsWith("avconv")) {
parentName = i18n("Libav");
iconName = "meta_libav.png";
}
QTreeWidgetItem *parent = NULL;
QList <QTreeWidgetItem *> matches = m_view.metadata_list->findItems(parentName, Qt::MatchExactly);
- if (!matches.isEmpty()) parent = matches.at(0);
- else {
- if (parentName == "Magic Lantern") iconName = "meta_magiclantern.png";
+ if (!matches.isEmpty()) {
+ parent = matches.at(0);
+ } else {
+ if (parentName == "Magic Lantern")
+ iconName = "meta_magiclantern.png";
parent = new QTreeWidgetItem(m_view.metadata_list, QStringList() << parentName);
if (!iconName.isEmpty()) {
KIcon icon(KStandardDirs::locate("appdata", iconName));
m_view.image_transparency->setChecked(props.value("transparency").toInt());
connect(m_view.image_transparency, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
int width = 180.0 * KdenliveSettings::project_display_ratio();
- if (width % 2 == 1) width++;
+ if (width % 2 == 1)
+ width++;
m_view.clip_thumb->setPixmap(QPixmap(url.path()).scaled(QSize(width, 180), Qt::KeepAspectRatio));
} else if (t == COLOR) {
m_view.clip_path->setEnabled(false);
m_view.clip_color->setColor(QColor('#' + props.value("colour").right(8).left(6)));
connect(m_view.clip_color, SIGNAL(changed(QColor)), this, SLOT(slotModified()));
} else if (t == SLIDESHOW) {
- if (url.fileName().startsWith(".all.")) {
+ if (url.fileName().startsWith(QLatin1String(".all."))) {
// the image sequence is defined by mimetype
m_view.clip_path->setText(url.directory());
} else {
m_view.clip_thumb->setMinimumSize(180 * KdenliveSettings::project_display_ratio(), 180);
- if (t == IMAGE || t == VIDEO || t == PLAYLIST) m_view.tabWidget->removeTab(AUDIOTAB);
+ if (t == IMAGE || t == VIDEO || t == PLAYLIST)
+ m_view.tabWidget->removeTab(AUDIOTAB);
} else {
m_view.tabWidget->removeTab(IMAGETAB);
m_view.tabWidget->removeTab(SLIDETAB);
}
m_view.clip_duration->setInputMask(tc.mask());
m_view.clip_duration->setText(tc.getTimecode(m_clip->duration()));
- if (t != IMAGE && t != COLOR && t != TEXT) m_view.clip_duration->setReadOnly(true);
- else {
+ if (t != IMAGE && t != COLOR && t != TEXT) {
+ m_view.clip_duration->setReadOnly(true);
+ } else {
connect(m_view.clip_duration, SIGNAL(editingFinished()), this, SLOT(slotCheckMaxLength()));
connect(m_view.clip_duration, SIGNAL(textChanged(QString)), this, SLOT(slotModified()));
}
if (commonproperties.value("out").toInt() > 0) {
m_view.clip_force_out->setChecked(true);
m_view.clip_out->setText(m_tc.getTimecodeFromFrames(commonproperties.value("out").toInt()));
- } else m_view.clip_out->setText(KdenliveSettings::image_duration());
+ } else {
+ m_view.clip_out->setText(KdenliveSettings::image_duration());
+ }
} else {
m_view.clip_force_out->setHidden(true);
m_view.clip_out->setHidden(true);
void ClipProperties::slotGotThumbnail(const QString &id, const QImage &img)
{
- if (id != m_clip->getId()) return;
+ if (id != m_clip->getId())
+ return;
QPixmap framedPix(img.width(), img.height());
framedPix.fill(Qt::transparent);
QPainter p(&framedPix);
void ClipProperties::slotReloadVideoProperties()
{
- if (m_clip == NULL) return;
+ if (m_clip == NULL)
+ return;
loadVideoProperties(m_clip->properties());
}
void ClipProperties::slotReloadVideoThumb()
{
- if (m_clip == NULL) return;
+ if (m_clip == NULL)
+ return;
emit requestThumb(QString('?' + m_clip->getId()), QList<int>() << m_clip->getClipThumbFrame());
}
void ClipProperties::slotSaveAnalysis()
{
- QString url = KFileDialog::getSaveFileName(KUrl("kfiledialog:///projectfolder"), "text/plain", this, i18n("Save Analysis Data"));
- if (url.isEmpty()) return;
+ const QString url = KFileDialog::getSaveFileName(KUrl("kfiledialog:///projectfolder"), "text/plain", this, i18n("Save Analysis Data"));
+ if (url.isEmpty())
+ return;
KSharedConfigPtr config = KSharedConfig::openConfig(url, KConfig::SimpleConfig);
KConfigGroup analysisConfig(config, "Analysis");
QTreeWidgetItem *current = m_view.analysis_list->currentItem();
void ClipProperties::slotLoadAnalysis()
{
- QString url = KFileDialog::getOpenFileName(KUrl("kfiledialog:///projectfolder"), "text/plain", this, i18n("Open Analysis Data"));
- if (url.isEmpty()) return;
+ const QString url = KFileDialog::getOpenFileName(KUrl("kfiledialog:///projectfolder"), "text/plain", this, i18n("Open Analysis Data"));
+ if (url.isEmpty())
+ return;
KSharedConfigPtr config = KSharedConfig::openConfig(url, KConfig::SimpleConfig);
KConfigGroup transConfig(config, "Analysis");
// read the entries
void ClipProperties::slotCheckMaxLength()
{
- if (m_clip->maxDuration() == GenTime()) return;
- int duration = m_tc.getFrameCount(m_view.clip_duration->text());
+ if (m_clip->maxDuration() == GenTime())
+ return;
+ const int duration = m_tc.getFrameCount(m_view.clip_duration->text());
if (duration > m_clip->maxDuration().frames(m_fps)) {
m_view.clip_duration->setText(m_tc.getTimecode(m_clip->maxDuration()));
}
void ClipProperties::slotUpdateDurationFormat(int ix)
{
- bool framesFormat = ix == 1;
+ bool framesFormat = (ix == 1);
if (framesFormat) {
// switching to frames count, update widget
m_view.slide_duration_frames->setValue(m_tc.getFrameCount(m_view.slide_duration->text()));
void ClipProperties::slotDeleteProxy()
{
- QString proxy = m_clip->getProperty("proxy");
- if (proxy.isEmpty()) return;
+ const QString proxy = m_clip->getProperty("proxy");
+ if (proxy.isEmpty())
+ return;
emit deleteProxy(proxy);
- if (m_proxyContainer) delete m_proxyContainer;
+ delete m_proxyContainer;
}
void ClipProperties::slotOpenUrl(const QString &url)
dest_url->setMode(KFile::File);
dest_url->setUrl(KUrl(newFile));
dest_url->fileDialog()->setOperationMode(KFileDialog::Saving);
+
} else {
label_dest->setText(i18n("Destination folder"));
dest_url->setMode(KFile::Directory);
ClipTranscode::ClipTranscode(const KUrl::List &urls, const QString ¶ms, const QStringList &postParams, const QString &description, bool automaticMode, QWidget * parent) :
- QDialog(parent), m_urls(urls), m_duration(0), m_automaticMode(automaticMode), m_postParams(postParams)
+ QDialog(parent), m_urls(urls), m_duration(0), m_automaticMode(automaticMode), m_postParams(postParams)
{
setFont(KGlobalSettings::toolBarFont());
setupUi(this);
log_text->setHidden(true);
setWindowTitle(i18n("Transcode Clip"));
if (m_automaticMode) {
- auto_add->setHidden(true);
+ auto_add->setHidden(true);
}
auto_add->setText(i18np("Add clip to project", "Add clips to project", m_urls.count()));
auto_add->setChecked(KdenliveSettings::add_new_clip());
parameters << "-i" << s_url;
if (QFile::exists(destination + extension)) {
if (KMessageBox::questionYesNo(this, i18n("File %1 already exists.\nDo you want to overwrite it?", destination + extension)) == KMessageBox::No) {
- // Abort operation
- if (m_automaticMode) {
- // inform caller that we aborted
- emit transcodedClip(source_url->url(), KUrl());
- close();
- }
- return;
- }
+ // Abort operation
+ if (m_automaticMode) {
+ // inform caller that we aborted
+ emit transcodedClip(source_url->url(), KUrl());
+ close();
+ }
+ return;
+ }
parameters << "-y";
}
bool replaceVfParams = false;
foreach(QString s, params.split(' ')) {
- if (replaceVfParams) {
- s= m_postParams.at(1);
- replaceVfParams = false;
- }
+ if (replaceVfParams) {
+ s= m_postParams.at(1);
+ replaceVfParams = false;
+ }
parameters << s.replace("%1", destination);
- if (s == "-vf") {
- replaceVfParams = true;
- }
+ if (s == "-vf") {
+ replaceVfParams = true;
+ }
}
buttonBox->button(QDialogButtonBox::Abort)->setText(i18n("Abort"));
QString extension = params.section("%1", 1, 1).section(' ', 0, 0);
url = KUrl(dest_url->url().path(KUrl::AddTrailingSlash) + source_url->url().fileName() + extension);
} else url = dest_url->url();
- if (m_automaticMode) emit transcodedClip(source_url->url(), url);
+ if (m_automaticMode) emit transcodedClip(source_url->url(), url);
else emit addClip(url);
}
if (urls_list->count() > 0 && m_urls.count() > 0) {
virtual ~ColorPickerWidget();
protected:
- virtual void mousePressEvent(QMouseEvent *event);
- virtual void mouseReleaseEvent(QMouseEvent *event);
- virtual void mouseMoveEvent(QMouseEvent *event);
+ void mousePressEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent *event);
bool eventFilter(QObject *object, QEvent *event);
private:
public:
explicit ComplexParameter(QWidget *parent = 0);
QDomElement getParamDesc() const;
-private:
- Ui::KeyframeWidget_UI m_ui;
- QDomElement m_param;
- void setupListView();
- void updateButtonStatus();
public slots:
void slotSetMoveX();
void setupParam(const QDomElement &, const QString& paramName, int, int);
void slotUpdateEffectParams(const QDomElement &e);
void slotUpdateParameterList(const QStringList &);
+
signals:
void removeEffect(ClipItem*, const QDomElement &);
void updateClipEffect(ClipItem*, const QDomElement &);
void parameterChanged();
+private:
+ Ui::KeyframeWidget_UI m_ui;
+ QDomElement m_param;
+ void setupListView();
+ void updateButtonStatus();
};
#endif
void updatePalette();
protected:
- virtual void paintEvent(QPaintEvent * /*e*/);
- virtual void wheelEvent(QWheelEvent * e);
- virtual void mousePressEvent(QMouseEvent * event);
- virtual void mouseReleaseEvent(QMouseEvent * event);
- virtual void mouseMoveEvent(QMouseEvent * event);
- virtual void leaveEvent(QEvent * event);
+ void paintEvent(QPaintEvent * /*e*/);
+ void wheelEvent(QWheelEvent * e);
+ void mousePressEvent(QMouseEvent * event);
+ void mouseReleaseEvent(QMouseEvent * event);
+ void mouseMoveEvent(QMouseEvent * event);
+ void leaveEvent(QEvent * event);
private:
Timecode m_timecode;
} else QGraphicsView::dragEnterEvent(event);
}
-bool CustomTrackView::itemCollision(AbstractClipItem *item, ItemInfo newPos)
+bool CustomTrackView::itemCollision(AbstractClipItem *item, const ItemInfo &newPos)
{
QRectF shape = QRectF(newPos.startPos.frames(m_document->fps()), newPos.track * m_tracksHeight + 1, (newPos.endPos - newPos.startPos).frames(m_document->fps()) - 0.02, m_tracksHeight - 1);
QList<QGraphicsItem*> collindingItems = scene()->items(shape, Qt::IntersectsItemShape);
collindingItems.removeAll(item);
- if (collindingItems.isEmpty()) return false;
- else {
+ if (collindingItems.isEmpty()) {
+ return false;
+ } else {
for (int i = 0; i < collindingItems.count(); ++i) {
QGraphicsItem *collision = collindingItems.at(i);
if (collision->type() == item->type()) {
} else emit displayMessage(i18n("Cannot find clip to add effect"), ErrorMessage);
}
-void CustomTrackView::deleteEffect(int track, GenTime pos, QDomElement effect)
+void CustomTrackView::deleteEffect(int track, const GenTime &pos, const QDomElement &effect)
{
QString index = effect.attribute("kdenlive_ix");
if (pos < GenTime()) {
}
}
-void CustomTrackView::slotAddEffect(ClipItem *clip, QDomElement effect)
+void CustomTrackView::slotAddEffect(ClipItem *clip, const QDomElement &effect)
{
if (clip) slotAddEffect(effect, clip->startPos(), clip->track());
}
}
}
-void CustomTrackView::updatePositionEffects(ClipItem* item, ItemInfo info, bool standalone)
+void CustomTrackView::updatePositionEffects(ClipItem* item, const ItemInfo &info, bool standalone)
{
int end = item->fadeIn();
if (end != 0) {
void slotAddEffect(QDomElement effect, const GenTime &pos, int track);
void slotAddGroupEffect(QDomElement effect, AbstractGroupItem *group, AbstractClipItem *dropTarget = NULL);
void addEffect(int track, GenTime pos, QDomElement effect);
- void deleteEffect(int track, GenTime pos, QDomElement effect);
+ void deleteEffect(int track, const GenTime &pos, const QDomElement &effect);
void updateEffect(int track, GenTime pos, QDomElement insertedEffect, bool refreshEffectStack = false);
/** @brief Enable / disable a list of effects */
void updateEffectState(int track, GenTime pos, QList <int> effectIndexes, bool disable, bool updateEffectStack);
* @param skipSelectedItems if true, the selected item start and end points will not be added to snap list */
void updateSnapPoints(AbstractClipItem *selected, QList <GenTime> offsetList = QList <GenTime> (), bool skipSelectedItems = false);
- void slotAddEffect(ClipItem *clip, QDomElement effect);
+ void slotAddEffect(ClipItem *clip, const QDomElement &effect);
void slotImportClipKeyframes(GRAPHICSRECTITEM type);
/** @brief Get effect parameters ready for MLT*/
/** Get the index of the video track that is just below current track */
int getPreviousVideoTrack(int track);
- void updatePositionEffects(ClipItem * item, ItemInfo info, bool standalone = true);
+ void updatePositionEffects(ClipItem * item, const ItemInfo &info, bool standalone = true);
bool insertDropClips(const QMimeData *data, const QPoint &pos);
bool canBePastedTo(QList <ItemInfo> infoList, int type) const;
bool canBePasted(QList<AbstractClipItem *> items, GenTime offset, int trackOffset) const;
void getTransitionAvailableSpace(AbstractClipItem *item, GenTime &minimum, GenTime &maximum);
void updateClipTypeActions(ClipItem *clip);
/** Whether an item can be moved to a new position without colliding with similar items */
- bool itemCollision(AbstractClipItem *item, ItemInfo newPos);
+ bool itemCollision(AbstractClipItem *item, const ItemInfo &newPos);
/** Selects all items in the scene rect, and sets ok to false if a group going over several tracks is found in it */
QList<QGraphicsItem *> checkForGroups(const QRectF &rect, bool *ok);
/** Adjust clips under another one when working in overwrite mode */
cornersActions getMode(const QPointF &pos, int *corner);
/** @brief Reimplemented to draw the handles. */
- virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 );
+ void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 );
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
#include <mlt++/Mlt.h>
OnMonitorPathItem::OnMonitorPathItem(double dar, QGraphicsItem* parent) :
- QGraphicsPathItem(parent),
- m_dar(dar),
- m_modified(false),
- m_view(NULL),
- m_activePoint(-1)
+ QGraphicsPathItem(parent),
+ m_dar(dar),
+ m_modified(false),
+ m_view(NULL),
+ m_activePoint(-1)
{
setFlags(QGraphicsItem::ItemIsMovable);
int pos = 0;
Mlt::GeometryItem item;
while (!geometry->next_key(&item, pos)) {
- r = QRectF(item.x(), item.y(), item.w(), item.h());
- m_points << r.center();
- pos = item.frame() + 1;
+ r = QRectF(item.x(), item.y(), item.w(), item.h());
+ m_points << r.center();
+ pos = item.frame() + 1;
}
rebuildShape();
}
QPainterPath shape;
if (!m_points.isEmpty()) {
- QRectF r(0, 0, 20, 20);
- r.moveCenter(m_points.at(0));
- shape.addRect(r);
-
- p.moveTo(m_points.at(0));
- for (int i = 1; i < m_points.count(); ++i) {
- p.lineTo(m_points.at(i));
- r.moveCenter(m_points.at(i));
- shape.addRect(r);
- }
+ QRectF r(0, 0, 20, 20);
+ r.moveCenter(m_points.at(0));
+ shape.addRect(r);
+
+ p.moveTo(m_points.at(0));
+ for (int i = 1; i < m_points.count(); ++i) {
+ p.lineTo(m_points.at(i));
+ r.moveCenter(m_points.at(i));
+ shape.addRect(r);
+ }
}
prepareGeometryChange();
m_shape = shape;
}
// Item mapped coordinates
for (int i = 0; i < m_points.count(); ++i) {
- if ((pos - m_points.at(i)).manhattanLength() <= dist) {
- m_activePoint = i;
- return;
- }
+ if ((pos - m_points.at(i)).manhattanLength() <= dist) {
+ m_activePoint = i;
+ return;
+ }
}
m_activePoint = -1;
}
}*/
if (m_activePoint >= 0 && event->buttons() & Qt::LeftButton) {
- QPointF mousePos = event->pos();
- m_points[m_activePoint] = mousePos;
- rebuildShape();
- m_modified = true;
- update();
+ QPointF mousePos = event->pos();
+ m_points[m_activePoint] = mousePos;
+ rebuildShape();
+ m_modified = true;
+ update();
}
if (m_modified) {
void OnMonitorPathItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* /*event*/)
{
if (m_activePoint != -1) {
- m_activePoint = -1;
- update();
+ m_activePoint = -1;
+ update();
}
unsetCursor();
}
double h = 6;
if (getView()) {
w /= m_view->matrix().m11();
- h /= m_view->matrix().m22();
+ h /= m_view->matrix().m22();
}
QRectF handle(0, 0, w, h);
for (int i = 0; i < m_points.count(); ++i) {
- handle.moveCenter(m_points.at(i));
+ handle.moveCenter(m_points.at(i));
painter->fillRect(handle, m_activePoint == i ? Qt::blue : pen().color());
}
}
#include <QGraphicsView>
OnMonitorRectItem::OnMonitorRectItem(const QRectF &rect, double dar, QGraphicsItem* parent) :
- QGraphicsRectItem(rect, parent)
- , m_dar(dar)
- , m_mode(NoAction)
- , m_modified(false)
- , m_view(NULL)
+ QGraphicsRectItem(rect, parent)
+ , m_dar(dar)
+ , m_mode(NoAction)
+ , m_modified(false)
+ , m_view(NULL)
{
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
qreal ysize = 12;
if (getView()) {
xsize /= m_view->matrix().m11();
- ysize /= m_view->matrix().m22();
+ ysize /= m_view->matrix().m22();
}
mouseArea.addRect(pos.x() - xsize / 2, pos.y() - ysize / 2, xsize, ysize);
// Keep aspect ratio
if (event->modifiers() == Qt::ControlModifier) {
- // compare to rect during mouse press:
+ // compare to rect during mouse press:
// if we subtract rect() we'll get a whole lot of flickering
// because of diffWidth > diffHeight changing all the time
int diffWidth = qAbs(r.width() - m_oldRect.width());
painter->drawRect(r);
QRectF handle = painter->worldTransform().inverted().mapRect(QRectF(0, 0, 6, 6));
if (isEnabled()) {
- handle.moveTopLeft(r.topLeft());
+ handle.moveTopLeft(r.topLeft());
painter->fillRect(handle, QColor(Qt::yellow));
- handle.moveTopRight(r.topRight());
+ handle.moveTopRight(r.topRight());
painter->fillRect(handle, QColor(Qt::yellow));
- handle.moveBottomLeft(r.bottomLeft());
+ handle.moveBottomLeft(r.bottomLeft());
painter->fillRect(handle, QColor(Qt::yellow));
- handle.moveBottomRight(r.bottomRight());
+ handle.moveBottomRight(r.bottomRight());
painter->fillRect(handle, QColor(Qt::yellow));
}
m_point.h2 = mapFromScene(point.h2);
m_point.handlesLinked = false;
- m_view = scene()->views()[0];
+ m_view = scene()->views().first();
}
BPoint BPointItem::getPoint() const
QTime start = QTime::currentTime();
start.start();
- int paintmode = ui->paintMode->itemData(ui->paintMode->currentIndex()).toInt();
+ const int paintmode = ui->paintMode->itemData(ui->paintMode->currentIndex()).toInt();
WaveformGenerator::Rec rec = m_aRec601->isChecked() ? WaveformGenerator::Rec_601 : WaveformGenerator::Rec_709;
QImage wave = m_waveformGenerator->calculateWaveform(scopeRect().size() - m_textWidth - QSize(0,m_paddingBottom), qimage,
(WaveformGenerator::PaintMode) paintmode, true, rec, accelFactor);
void StopmotionWidget::slotUpdateOverlayEffect(QAction* act)
{
- if (act) m_effectIndex = act->data().toInt();
+ if (act)
+ m_effectIndex = act->data().toInt();
KdenliveSettings::setStopmotioneffect(m_effectIndex);
slotUpdateOverlay();
}
void StopmotionWidget::reloadOverlay()
{
- QString path = getPathForFrame(m_sequenceFrame - 1);
+ const QString path = getPathForFrame(m_sequenceFrame - 1);
if (!QFile::exists(path)) {
log_box->insertItem(-1, i18n("No previous frame found"));
log_box->setCurrentIndex(0);
m_sequenceFrame++;
button_addsequence->setEnabled(true);
if (capture_interval->isChecked()) {
- if (KdenliveSettings::sm_prenotify()) QTimer::singleShot((KdenliveSettings::captureinterval() - KdenliveSettings::sm_notifytime()) * 1000, this, SLOT(slotPreNotify()));
+ if (KdenliveSettings::sm_prenotify())
+ QTimer::singleShot((KdenliveSettings::captureinterval() - KdenliveSettings::sm_notifytime()) * 1000, this, SLOT(slotPreNotify()));
m_intervalTimer.start();
}
- else m_captureAction->setChecked(false);
+ else
+ m_captureAction->setChecked(false);
}
void StopmotionWidget::slotPreNotify()
void StopmotionWidget::slotPrepareThumbs()
{
- if (m_filesList.isEmpty()) return;
+ if (m_filesList.isEmpty())
+ return;
QString path = m_filesList.takeFirst();
emit doCreateThumbs(QImage(path), SlideshowClip::getFrameNumberFromPath(path));