From kde-commits Sun Jan 08 13:11:31 2017 From: Jean-Baptiste Mardelle Date: Sun, 08 Jan 2017 13:11:31 +0000 To: kde-commits Subject: [kdenlive] src: Merge branch '16.12' Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=148388110121745 Git commit 66d9cc77c734f8ab7217c3f839c35ecb7b549e02 by Jean-Baptiste Mardel= le. Committed on 08/01/2017 at 13:11. Pushed by mardelle into branch 'master'. Merge branch '16.12' M +35 -2 src/doc/kdenlivedoc.cpp M +34 -11 src/effectstack/graphicsscenerectmove.cpp M +2 -0 src/effectstack/graphicsscenerectmove.h M +2 -2 src/mltcontroller/clipcontroller.cpp M +1 -0 src/titler/titledocument.cpp M +2 -2 src/titler/titlewidget.cpp https://commits.kde.org/kdenlive/66d9cc77c734f8ab7217c3f839c35ecb7b549e02 diff --cc src/doc/kdenlivedoc.cpp index cdb5bf1dc,2bfc04e44..370410562 --- a/src/doc/kdenlivedoc.cpp +++ b/src/doc/kdenlivedoc.cpp @@@ -1520,11 -1470,9 +1520,11 @@@ void KdenliveDoc::updateProjectProfile( m_timecode.setFormat(fps); KdenliveSettings::setCurrent_profile(m_profile.path); pCore->monitorManager()->resetProfiles(m_profile, m_timecode); - if (!reloadProducers) return; + if (!reloadProducers) { + return; + } emit updateFps(fpsChanged); - if (fpsChanged) { + if (fpsChanged !=3D 1.0) { pCore->bin()->reloadAllProducers(); } } @@@ -1605,9 -1552,42 +1605,42 @@@ void KdenliveDoc::switchProfile(MltVide pCore->bin()->doDisplayMessage(i18n("Switch to clip profile %1?",= profile.descriptiveString()), KMessageWidget::Information, list); } else { // No known profile, ask user if he wants to use clip profile any= way - if (KMessageBox::warningContinueCancel(QApplication::activeWindow= (), i18n("No profile found for your clip.\nCreate and switch to new profile= (%1x%2, %3fps)?", profile.width, profile.height, QString::number((double)p= rofile.frame_rate_num / profile.frame_rate_den, 'f', 2))) =3D=3D KMessageBo= x::Continue) { + // Check profile fps so that we don't end up with an fps =3D 30.0= 03 which would mess things up + QString adjustMessage; + double fps =3D (double)profile.frame_rate_num / profile.frame_rat= e_den; + double fps_int; + double fps_frac =3D std::modf(fps, &fps_int); + if (fps_frac < 0.4) { + profile.frame_rate_num =3D (int) fps_int; + profile.frame_rate_den =3D 1; + } else { + // Check for 23.98, 29.97, 59.94 + if (fps_int =3D=3D 23.0) { + if (qAbs(fps - 23.98) < 0.01) { + profile.frame_rate_num =3D 24000; + profile.frame_rate_den =3D 1001; + } + } else if (fps_int =3D=3D 29.0) { + if (qAbs(fps - 29.97) < 0.01) { + profile.frame_rate_num =3D 30000; + profile.frame_rate_den =3D 1001; + } + } else if (fps_int =3D=3D 59.0) { + if (qAbs(fps - 59.94) < 0.01) { + profile.frame_rate_num =3D 60000; + profile.frame_rate_den =3D 1001; + } + } else { + // Unknown profile fps, warn user + adjustMessage =3D i18n("\nWarning: unknown non integer fp= s, might cause incorrect duration display."); + } + } + if ((double)profile.frame_rate_num / profile.frame_rate_den !=3D = fps) { + adjustMessage =3D i18n("\nProfile fps adjusted from original = %1", QString::number(fps, 'f', 4)); + } + if (KMessageBox::warningContinueCancel(QApplication::activeWindow= (), i18n("No profile found for your clip.\nCreate and switch to new profile= (%1x%2, %3fps)?%4", profile.width, profile.height, QString::number((double= )profile.frame_rate_num / profile.frame_rate_den, 'f', 2), adjustMessage)) = =3D=3D KMessageBox::Continue) { m_profile =3D profile; - m_profile.description =3D QString("%1x%2 %3fps").arg(profile.= width).arg(profile.height).arg(QString::number((double)profile.frame_rate_n= um / profile.frame_rate_den, 'f', 2)); + m_profile.description =3D QStringLiteral("%1x%2 %3fps").arg(p= rofile.width).arg(profile.height).arg(QString::number((double)profile.frame= _rate_num / profile.frame_rate_den, 'f', 2)); ProfilesDialog::saveProfile(m_profile); updateProjectProfile(true); emit docModified(true); diff --cc src/effectstack/graphicsscenerectmove.cpp index 985ac9ee0,e0f469bbe..e5107f7d4 --- a/src/effectstack/graphicsscenerectmove.cpp +++ b/src/effectstack/graphicsscenerectmove.cpp @@@ -725,11 -721,13 +746,13 @@@ void GraphicsSceneRectMove::mousePressE } QGraphicsScene::mousePressEvent(e); } else if (m_tool =3D=3D TITLE_RECTANGLE) { + clearTextSelection(); m_sceneClickPoint =3D QPointF(xPos, yPos); - m_selectedItem =3D NULL; + m_selectedItem =3D Q_NULLPTR; e->ignore(); } else if (m_tool =3D=3D TITLE_TEXT) { + clearTextSelection(); - MyTextItem *textItem =3D new MyTextItem(i18n("Text"), NULL); + MyTextItem *textItem =3D new MyTextItem(i18n("Text"), Q_NULLPTR); yPos =3D (((int) e->scenePos().y() - (int)(m_fontSize / 2)) / m_g= ridSize) * m_gridSize; textItem->setPos(xPos, yPos); addItem(textItem); diff --cc src/effectstack/graphicsscenerectmove.h index 498c46bc2,38f1cfef6..99a9cad7d --- a/src/effectstack/graphicsscenerectmove.h +++ b/src/effectstack/graphicsscenerectmove.h @@@ -57,12 -57,13 +57,13 @@@ public Qt::Alignment alignment() const; void updateShadow(bool enabled, int blur, int xoffset, int yoffset, Q= Color color); QStringList shadowInfo() const; - void loadShadow(QStringList info); - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *evt); + void loadShadow(const QStringList &info); + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *evt) Q_DECL_OVER= RIDE; + void setTextColor(const QColor &col); = protected: - virtual QVariant itemChange(GraphicsItemChange change, const QVariant= &value); - virtual void paint( QPainter *painter, const QStyleOptionGraphicsItem= * option, QWidget* w); + QVariant itemChange(GraphicsItemChange change, const QVariant &value)= Q_DECL_OVERRIDE; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,= QWidget *w) Q_DECL_OVERRIDE; = private: Qt::Alignment m_alignment; diff --cc src/mltcontroller/clipcontroller.cpp index 7807193f6,0b2cdb0d1..598cbb040 --- a/src/mltcontroller/clipcontroller.cpp +++ b/src/mltcontroller/clipcontroller.cpp @@@ -308,11 -308,11 +308,11 @@@ const QString ClipController::getString if (m_masterProducer) { int playtime =3D m_masterProducer->get_int("kdenlive:duration"); if (playtime > 0) { - return QString(properties().frames_to_time(playtime, mlt_time= _smpte)); + return QString(m_properties->frames_to_time(playtime, mlt_tim= e_smpte_df)); } - return m_masterProducer->get_length_time(mlt_time_smpte); + return m_masterProducer->get_length_time(mlt_time_smpte_df); } - return QString(i18n("Unknown")); + return i18n("Unknown"); } = GenTime ClipController::getPlaytime() const