Commit 15df53a7 authored by Nicolas Carion's avatar Nicolas Carion

format

parent 8d24ba4b
......@@ -2753,15 +2753,16 @@ void Bin::slotExpandUrl(const ItemInfo &info, const QString &url, QUndoCommand *
// So we use mlt service-specific hashes to identify duplicate producers.
QString hash;
QString mltService = EffectsList::property(prod, QStringLiteral("mlt_service"));
if (mltService == QLatin1String("pixbuf")|| mltService == QLatin1String("qimage") || mltService == QLatin1String("kdenlivetitle") || mltService == QLatin1String("color") ||
mltService == QLatin1String("colour")) {
if (mltService == QLatin1String("pixbuf") || mltService == QLatin1String("qimage") || mltService == QLatin1String("kdenlivetitle") ||
mltService == QLatin1String("color") || mltService == QLatin1String("colour")) {
hash = mltService + QLatin1Char(':') + EffectsList::property(prod, QStringLiteral("kdenlive:clipname")) + QLatin1Char(':') +
EffectsList::property(prod, QStringLiteral("kdenlive:folderid")) + QLatin1Char(':');
if (mltService == QLatin1String("kdenlivetitle")) {
// Calculate hash based on title contents.
hash.append(
QString(QCryptographicHash::hash(EffectsList::property(prod, QStringLiteral("xmldata")).toUtf8(), QCryptographicHash::Md5).toHex()));
} else if (mltService == QLatin1String("pixbuf") || mltService == QLatin1String("qimage") || mltService == QLatin1String("color") || mltService == QLatin1String("colour")) {
} else if (mltService == QLatin1String("pixbuf") || mltService == QLatin1String("qimage") || mltService == QLatin1String("color") ||
mltService == QLatin1String("colour")) {
hash.append(EffectsList::property(prod, QStringLiteral("resource")));
}
......
......@@ -36,8 +36,7 @@
// include after QTimer to have C++ phtreads defined
#include <mlt/framework/mlt_types.h>
namespace Mlt
{
namespace Mlt {
class Consumer;
class Frame;
class Event;
......
......@@ -101,7 +101,7 @@ void Core::initGUI(const QUrl &Url)
{
m_mainWindow = new MainWindow();
//load default profile and ask user to select one if not found.
// load default profile and ask user to select one if not found.
m_profile = KdenliveSettings::default_profile();
if (m_profile.isEmpty()) {
m_profile = ProjectManager::getDefaultProjectFormat();
......
......@@ -87,12 +87,24 @@ enum JOBSTATUS { WAITINGJOB = 0, STARTINGJOB, RUNNINGJOB, FINISHEDJOB, FAILEDJOB
#ifdef Q_OS_WIN
const QLatin1String ScriptFormat(".bat");
QString ScriptSetVar(const QString name, const QString value) { return QString("set ") + name + "=" + value; }
QString ScriptGetVar(const QString varName) { return QString('%') + varName + '%'; }
QString ScriptSetVar(const QString name, const QString value)
{
return QString("set ") + name + "=" + value;
}
QString ScriptGetVar(const QString varName)
{
return QString('%') + varName + '%';
}
#else
const QLatin1String ScriptFormat(".sh");
QString ScriptSetVar(const QString name, const QString value) { return name + "=\"" + value + '\"'; }
QString ScriptGetVar(const QString varName) { return QString('$') + varName; }
QString ScriptSetVar(const QString name, const QString value)
{
return name + "=\"" + value + '\"';
}
QString ScriptGetVar(const QString varName)
{
return QString('$') + varName;
}
#endif
static QStringList acodecsList;
......@@ -1198,8 +1210,8 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
render_process_args << parser.resultingArguments().join(QLatin1Char(' '));
} else {
// no service found to play mime type
//TODO: inform user
//errorMessage(PlaybackError, i18n("No service found to play %1", mime.name()));
// TODO: inform user
// errorMessage(PlaybackError, i18n("No service found to play %1", mime.name()));
render_process_args << QStringLiteral("-");
}
} else {
......@@ -1278,32 +1290,31 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
}
// evaluate expression
if (paramValue.startsWith(QLatin1Char('%'))) {
if (paramValue.startsWith(QStringLiteral("%bitrate"))
|| paramValue == QStringLiteral("%quality")) {
if (paramValue.startsWith(QStringLiteral("%bitrate")) || paramValue == QStringLiteral("%quality")) {
if (paramValue.contains("+'k'"))
paramValue = QString::number(m_view.video->value()) + 'k';
else
paramValue = QString::number(m_view.video->value());
}
if (paramValue.startsWith(QStringLiteral("%audiobitrate"))
|| paramValue == QStringLiteral("%audioquality")) {
if (paramValue.startsWith(QStringLiteral("%audiobitrate")) || paramValue == QStringLiteral("%audioquality")) {
if (paramValue.contains("+'k'"))
paramValue = QString::number(m_view.audio->value()) + 'k';
else
paramValue = QString::number(m_view.audio->value());
}
if (paramValue == QStringLiteral("%dar"))
paramValue = '@' + QString::number(profile->display_aspect_num()) + QLatin1Char('/') + QString::number(profile->display_aspect_den());
if (paramValue == QStringLiteral("%passes"))
paramValue = QString::number(static_cast<int>(m_view.checkTwoPass->isChecked()) + 1);
paramValue = '@' + QString::number(profile->display_aspect_num()) + QLatin1Char('/') + QString::number(profile->display_aspect_den());
if (paramValue == QStringLiteral("%passes")) paramValue = QString::number(static_cast<int>(m_view.checkTwoPass->isChecked()) + 1);
paramsList[i] = paramName + QLatin1Char('=') + paramValue;
}
}
if (resizeProfile && !KdenliveSettings::gpu_accel()) {
render_process_args << "consumer:" + (scriptExport ? ScriptGetVar("SOURCE_" + QString::number(stemIdx)) : QUrl::fromLocalFile(playlistPaths.at(stemIdx)).toEncoded());
render_process_args << "consumer:" + (scriptExport ? ScriptGetVar("SOURCE_" + QString::number(stemIdx))
: QUrl::fromLocalFile(playlistPaths.at(stemIdx)).toEncoded());
} else {
render_process_args << (scriptExport ? ScriptGetVar("SOURCE_" + QString::number(stemIdx)) : QUrl::fromLocalFile(playlistPaths.at(stemIdx)).toEncoded());
render_process_args << (scriptExport ? ScriptGetVar("SOURCE_" + QString::number(stemIdx))
: QUrl::fromLocalFile(playlistPaths.at(stemIdx)).toEncoded());
}
render_process_args << (scriptExport ? ScriptGetVar("TARGET_" + QString::number(stemIdx)) : QUrl::fromLocalFile(dest).toEncoded());
......@@ -1316,8 +1327,8 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
QTextStream outStream(&file);
QString stemIdxStr(QString::number(stemIdx));
outStream << ScriptSetVar("SOURCE_" + stemIdxStr, QUrl::fromLocalFile(playlistPaths.at(stemIdx)).toEncoded()) << '\n';
outStream << ScriptSetVar("TARGET_" + stemIdxStr, QUrl::fromLocalFile(dest).toEncoded()) << '\n';
outStream << ScriptSetVar("SOURCE_" + stemIdxStr, QUrl::fromLocalFile(playlistPaths.at(stemIdx)).toEncoded()) << '\n';
outStream << ScriptSetVar("TARGET_" + stemIdxStr, QUrl::fromLocalFile(dest).toEncoded()) << '\n';
outStream << ScriptSetVar("PARAMETERS_" + stemIdxStr, render_process_args.join(QLatin1Char(' '))) << '\n';
outStream << ScriptGetVar("RENDERER") + " " + ScriptGetVar("PARAMETERS_" + stemIdxStr) << "\n";
......
......@@ -1836,7 +1836,6 @@ bool DocumentValidator::isModified() const
return m_modified;
}
bool DocumentValidator::checkMovit()
{
QString playlist = m_doc.toString();
......
......@@ -513,8 +513,9 @@ void AnimationWidget::slotPositionChanged(int pos, bool seek)
// scene ratio lock
if (m_spinWidth && m_spinWidth->isEnabled()) {
double ratio = m_originalSize->isChecked() ? (double)m_frameSize.x() / m_frameSize.y() : (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight();
bool lockRatio = m_spinHeight->value() == (int) (m_spinWidth->value() / ratio + 0.5);
double ratio = m_originalSize->isChecked() ? (double)m_frameSize.x() / m_frameSize.y()
: (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight();
bool lockRatio = m_spinHeight->value() == (int)(m_spinWidth->value() / ratio + 0.5);
m_lockRatio->blockSignals(true);
m_lockRatio->setChecked(lockRatio);
m_lockRatio->blockSignals(false);
......@@ -1462,7 +1463,9 @@ void AnimationWidget::slotAdjustToSource()
m_spinHeight->blockSignals(false);
slotAdjustRectKeyframeValue();
if (m_lockRatio->isChecked()) {
m_monitor->setEffectSceneProperty(QStringLiteral("lockratio"), m_originalSize->isChecked() ? (double)m_frameSize.x() / m_frameSize.y() : (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight());
m_monitor->setEffectSceneProperty(QStringLiteral("lockratio"), m_originalSize->isChecked()
? (double)m_frameSize.x() / m_frameSize.y()
: (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight());
}
}
......@@ -1575,9 +1578,11 @@ void AnimationWidget::slotImportKeyframes()
void AnimationWidget::slotLockRatio()
{
QAction *lockRatio = qobject_cast<QAction*> (QObject::sender());
QAction *lockRatio = qobject_cast<QAction *>(QObject::sender());
if (lockRatio->isChecked()) {
m_monitor->setEffectSceneProperty(QStringLiteral("lockratio"), m_originalSize->isChecked() ? (double)m_frameSize.x() / m_frameSize.y() : (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight());
m_monitor->setEffectSceneProperty(QStringLiteral("lockratio"), m_originalSize->isChecked()
? (double)m_frameSize.x() / m_frameSize.y()
: (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight());
} else {
m_monitor->setEffectSceneProperty(QStringLiteral("lockratio"), -1);
}
......
......@@ -506,8 +506,9 @@ void GeometryWidget::slotPositionChanged(int pos, bool seek)
// scene ratio lock
if (m_ui.widgetGeometry->isEnabled()) {
double ratio = m_originalSize->isChecked() ? (double)m_frameSize.x() / m_frameSize.y() : (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight();
bool lockRatio = m_spinHeight->value() == (int) (m_spinWidth->value() / ratio + 0.5);
double ratio = m_originalSize->isChecked() ? (double)m_frameSize.x() / m_frameSize.y()
: (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight();
bool lockRatio = m_spinHeight->value() == (int)(m_spinWidth->value() / ratio + 0.5);
m_lockRatio->blockSignals(true);
m_lockRatio->setChecked(lockRatio);
m_lockRatio->blockSignals(false);
......@@ -846,9 +847,9 @@ void GeometryWidget::slotSetWidth(double value)
if (m_lockRatio->isChecked()) {
m_spinHeight->blockSignals(true);
if (m_originalSize->isChecked()) {
m_spinHeight->setValue((int) (value * m_frameSize.y() / m_frameSize.x() + 0.5));
m_spinHeight->setValue((int)(value * m_frameSize.y() / m_frameSize.x() + 0.5));
} else {
m_spinHeight->setValue((int) (value * m_monitor->render->renderHeight() / m_monitor->render->frameRenderWidth() + 0.5));
m_spinHeight->setValue((int)(value * m_monitor->render->renderHeight() / m_monitor->render->frameRenderWidth() + 0.5));
}
m_spinHeight->blockSignals(false);
}
......@@ -862,9 +863,9 @@ void GeometryWidget::slotSetHeight(double value)
if (m_lockRatio->isChecked()) {
m_spinWidth->blockSignals(true);
if (m_originalSize->isChecked()) {
m_spinWidth->setValue((int) (value * m_frameSize.x() / m_frameSize.y() + 0.5));
m_spinWidth->setValue((int)(value * m_frameSize.x() / m_frameSize.y() + 0.5));
} else {
m_spinWidth->setValue((int) (value * m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight() + 0.5));
m_spinWidth->setValue((int)(value * m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight() + 0.5));
}
m_spinWidth->blockSignals(false);
}
......@@ -955,7 +956,9 @@ void GeometryWidget::setFrameSize(const QPoint &size)
m_originalSize->setEnabled(true);
}
if (m_lockRatio->isChecked()) {
m_monitor->setEffectSceneProperty(QStringLiteral("lockratio"), m_originalSize->isChecked() ? (double)m_frameSize.x() / m_frameSize.y() : (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight());
m_monitor->setEffectSceneProperty(QStringLiteral("lockratio"), m_originalSize->isChecked()
? (double)m_frameSize.x() / m_frameSize.y()
: (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight());
} else {
m_monitor->setEffectSceneProperty(QStringLiteral("lockratio"), -1);
}
......@@ -978,7 +981,9 @@ void GeometryWidget::slotAdjustToSource()
m_spinHeight->blockSignals(false);
updateMonitorGeometry();
if (m_lockRatio->isChecked()) {
m_monitor->setEffectSceneProperty(QStringLiteral("lockratio"), m_originalSize->isChecked() ? (double)m_frameSize.x() / m_frameSize.y() : (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight());
m_monitor->setEffectSceneProperty(QStringLiteral("lockratio"), m_originalSize->isChecked()
? (double)m_frameSize.x() / m_frameSize.y()
: (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight());
}
}
......@@ -1202,9 +1207,11 @@ void GeometryWidget::slotUpdateRange(int inPoint, int outPoint)
void GeometryWidget::slotLockRatio()
{
QAction *lockRatio = qobject_cast<QAction*>(QObject::sender());
QAction *lockRatio = qobject_cast<QAction *>(QObject::sender());
if (lockRatio->isChecked()) {
m_monitor->setEffectSceneProperty(QStringLiteral("lockratio"), m_originalSize->isChecked() ? (double)m_frameSize.x() / m_frameSize.y() : (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight());
m_monitor->setEffectSceneProperty(QStringLiteral("lockratio"), m_originalSize->isChecked()
? (double)m_frameSize.x() / m_frameSize.y()
: (double)m_monitor->render->frameRenderWidth() / m_monitor->render->renderHeight());
} else {
m_monitor->setEffectSceneProperty(QStringLiteral("lockratio"), -1);
}
......
......@@ -619,7 +619,7 @@ void MainWindow::init()
new JogManager(this);
#endif
scmanager->slotCheckActiveScopes();
//m_messageLabel->setMessage(QStringLiteral("This is a beta version. Always backup your data"), MltError);
// m_messageLabel->setMessage(QStringLiteral("This is a beta version. Always backup your data"), MltError);
}
void MainWindow::slotThemeChanged(const QString &theme)
......
......@@ -235,10 +235,10 @@ void EffectsController::adjustEffectParameters(EffectsParameterList &parameters,
double EffectsController::getStringEval(const ProfileInfo &info, QString eval, const QPoint &frameSize)
{
eval.replace(QLatin1String("%maxWidth"), QString::number(info.profileSize.width() > frameSize.x() ? info.profileSize.width() : frameSize.x()))
eval.replace(QLatin1String("%maxWidth"), QString::number(info.profileSize.width() > frameSize.x() ? info.profileSize.width() : frameSize.x()))
.replace(QLatin1String("%maxHeight"), QString::number(info.profileSize.height() > frameSize.y() ? info.profileSize.height() : frameSize.y()))
.replace(QLatin1String("%width"), QString::number(info.profileSize.width()))
.replace(QLatin1String("%height"), QString::number(info.profileSize.height()));
.replace(QLatin1String("%width"), QString::number(info.profileSize.width()))
.replace(QLatin1String("%height"), QString::number(info.profileSize.height()));
Mlt::Properties p;
p.set("eval", eval.toLatin1().constData());
return p.get_double("eval");
......@@ -280,7 +280,7 @@ void EffectsController::initTrackEffect(ProfileInfo pInfo, const QDomElement &ef
} else {
e.setAttribute(QStringLiteral("value"), evaluatedValue);
}
} else if (!hasValue) {
} else if (!hasValue) {
if (type == QLatin1String("animated")) {
e.setAttribute(QStringLiteral("value"), AnimationWidget::getDefaultKeyframes(0, e.attribute(QStringLiteral("default"))));
} else if (type == QLatin1String("keyframe") || type == QLatin1String("simplekeyframe")) {
......
......@@ -543,7 +543,7 @@ void Monitor::slotForceSize(QAction *a)
profileWidth = m_glMonitor->profile()->dar() * profileHeight;
if (profileWidth > r.width() * 0.8 || profileHeight > r.height() * 0.7) {
// reset action to free resize
const QList< QAction * > list = m_forceSize->actions();
const QList<QAction *> list = m_forceSize->actions();
for (QAction *ac : list) {
if (ac->data().toInt() == m_forceSizeFactor) {
m_forceSize->setCurrentAction(ac);
......
......@@ -454,7 +454,7 @@ void ArchiveWidget::generateItems(QTreeWidgetItem *parentItem, const QMap<QStrin
foreach (const QString &path, result) {
if (rx.exactMatch(path)) {
totalSize += QFileInfo(dir.absoluteFilePath(path)).size();
slideImages << dir.absoluteFilePath(path);
slideImages << dir.absoluteFilePath(path);
}
}
item->setData(0, Qt::UserRole + 1, slideImages);
......@@ -706,7 +706,8 @@ bool ArchiveWidget::processProjectFile()
QUrl src = QUrl::fromLocalFile(item->text(0));
QUrl dest = QUrl::fromLocalFile(destFolder.absolutePath());
if (isSlideshow) {
dest = QUrl::fromLocalFile(parentItem->data(0, Qt::UserRole).toString() + QLatin1Char('/') + item->data(0, Qt::UserRole).toString() + QLatin1Char('/') + src.fileName());
dest = QUrl::fromLocalFile(parentItem->data(0, Qt::UserRole).toString() + QLatin1Char('/') + item->data(0, Qt::UserRole).toString() +
QLatin1Char('/') + src.fileName());
} else if (item->data(0, Qt::UserRole).isNull()) {
dest = QUrl::fromLocalFile(parentItem->data(0, Qt::UserRole).toString() + QLatin1Char('/') + src.fileName());
} else {
......@@ -873,7 +874,8 @@ bool ArchiveWidget::processProjectFile()
void ArchiveWidget::createArchive()
{
QString archiveName(archive_url->url().toLocalFile() + QDir::separator() + m_name + QStringLiteral(".tar.gz"));
if (QFile::exists(archiveName) && KMessageBox::questionYesNo(this, i18n("File %1 already exists.\nDo you want to overwrite it?", archiveName)) == KMessageBox::No) {
if (QFile::exists(archiveName) &&
KMessageBox::questionYesNo(this, i18n("File %1 already exists.\nDo you want to overwrite it?", archiveName)) == KMessageBox::No) {
return;
}
QFileInfo dirInfo(archive_url->url().toLocalFile());
......
......@@ -175,7 +175,8 @@ void ProfileWidget::fillDescriptionPanel(const QString &profile_path)
std::unique_ptr<ProfileModel> &profile = ProfileRepository::get()->getProfile(profile_path);
description += i18n("<h5>Video Settings</h5>");
description += i18n("<p style='font-size:small'>Frame size: %1 x %2 (%3:%4)<br/>", profile->width(), profile->height(), profile->display_aspect_num(), profile->display_aspect_den());
description += i18n("<p style='font-size:small'>Frame size: %1 x %2 (%3:%4)<br/>", profile->width(), profile->height(), profile->display_aspect_num(),
profile->display_aspect_den());
description += i18n("Frame rate: %1 fps<br/>", profile->fps());
description += i18n("Pixel Aspect Ratio: %1<br/>", profile->sar());
description += i18n("Color Space: %1<br/>", profile->colorspaceDescription());
......
......@@ -194,10 +194,11 @@ private:
int m_currentInsertionOrder;
std::map<int, std::shared_ptr<ClipModel>> m_allClips; /*this is important to keep an
ordered structure to store the clips, since we use their ids order as row order*/
std::map<int, std::shared_ptr<CompositionModel>> m_allCompositions; /*this is important to keep an
ordered structure to store the clips, since we use their ids order as row order*/
std::map<int, std::shared_ptr<ClipModel>> m_allClips; /*this is important to keep an
ordered structure to store the clips, since we use their ids order as row order*/
std::map<int, std::shared_ptr<CompositionModel>>
m_allCompositions; /*this is important to keep an
ordered structure to store the clips, since we use their ids order as row order*/
std::map<int, int> m_compoPos; // We store the positions of the compositions. In Melt, the compositions are not inserted at the track level, but we keep
// those positions here to check for moves and resize
......
#include "kdenlivesettings.h"
#include <QLinearGradient>
#include <QPainter>
#include <QPainterPath>
#include <QPalette>
#include <QLinearGradient>
#include <QQuickPaintedItem>
#include "kdenlivesettings.h"
class TimelineTriangle : public QQuickPaintedItem
{
......@@ -52,10 +52,10 @@ public:
// Fill gradient
m_gradient.setStart(0, 0);
m_gradient.setFinalStop(0, height());
m_gradient.setColorAt(1, QColor(129,233,139));
m_gradient.setColorAt(0.4, QColor(129,233,139));
m_gradient.setColorAt(0.2, QColor(233,215,129));
m_gradient.setColorAt(0.1, QColor(255,0,0));
m_gradient.setColorAt(1, QColor(129, 233, 139));
m_gradient.setColorAt(0.4, QColor(129, 233, 139));
m_gradient.setColorAt(0.2, QColor(233, 215, 129));
m_gradient.setColorAt(0.1, QColor(255, 0, 0));
m_gradient.setSpread(QGradient::ReflectSpread);
}
......@@ -69,7 +69,7 @@ public:
pen.setWidthF(0.5);
pen.setColor(m_color.darker());
painter->setPen(Qt::NoPen);
//painter->setBrush(QBrush(m_color.lighter()));
// painter->setBrush(QBrush(m_color.lighter()));
if (!KdenliveSettings::displayallchannels()) {
m_gradient.setFinalStop(0, height());
......@@ -89,7 +89,7 @@ public:
painter->drawPath(path);
} else {
// Fill gradient
m_gradient.setFinalStop(0, height()/4);
m_gradient.setFinalStop(0, height() / 4);
painter->setBrush(m_gradient);
// Draw separate channels
......
......@@ -207,8 +207,7 @@ void ThemeManager::populateThemeMenu()
config->setIcon(QIcon::fromTheme(QStringLiteral("preferences-desktop-theme")));
d->themeMenuAction->addAction(config);
connect(config, &QAction::triggered,
this, &ThemeManager::slotConfigColors);
connect(config, &QAction::triggered, this, &ThemeManager::slotConfigColors);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment