Commit 7ecfd542 authored by Nicolas Carion's avatar Nicolas Carion

Temporarily move dialogs (nothing implemented)

parent e532bad5
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "clipdurationdialog.h"
#include "clipitem.h"
#include <QFontDatabase>
#include <QWheelEvent>
ClipDurationDialog::ClipDurationDialog(AbstractClipItem *clip, const Timecode &tc, const GenTime &min, const GenTime &max, QWidget *parent):
QDialog(parent),
m_clip(clip),
m_min(min),
m_max(max)
{
setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
setupUi(this);
m_pos = new TimecodeDisplay(tc);
m_cropStart = new TimecodeDisplay(tc);
m_dur = new TimecodeDisplay(tc);
m_cropEnd = new TimecodeDisplay(tc);
clip_position_box->addWidget(m_pos);
crop_start_box->addWidget(m_cropStart);
clip_duration_box->addWidget(m_dur);
crop_end_box->addWidget(m_cropEnd);
bool allowCrop = true;
if (clip->type() == AVWidget) {
ClipItem *item = static_cast <ClipItem *>(clip);
const int t = item->clipType();
if (t == Color || t == Image || t == Text) {
allowCrop = false;
}
}
if (!allowCrop || clip->type() == TransitionWidget) {
m_cropStart->setHidden(true);
crop_label->hide();
m_cropEnd->setHidden(true),
end_label->hide();
}
m_crop = m_clip->cropStart();
m_pos->setValue(m_clip->startPos());
m_dur->setValue(m_clip->cropDuration());
m_cropStart->setValue(m_clip->cropStart());
m_cropEnd->setValue(m_clip->maxDuration() - m_clip->cropDuration() - m_clip->cropStart());
connect(m_pos, &TimecodeDisplay::timeCodeEditingFinished, this, &ClipDurationDialog::slotCheckStart);
connect(m_dur, &TimecodeDisplay::timeCodeEditingFinished, this, &ClipDurationDialog::slotCheckDuration);
connect(m_cropStart, &TimecodeDisplay::timeCodeEditingFinished, this, &ClipDurationDialog::slotCheckCrop);
connect(m_cropEnd, &TimecodeDisplay::timeCodeEditingFinished, this, &ClipDurationDialog::slotCheckEnd);
adjustSize();
}
ClipDurationDialog::~ClipDurationDialog()
{
delete m_pos;
delete m_dur;
delete m_cropStart;
delete m_cropEnd;
}
void ClipDurationDialog::slotCheckStart()
{
GenTime start = m_pos->gentime();
GenTime duration = m_dur->gentime();
if (m_min != GenTime() && start < m_min) {
m_pos->setValue(m_min);
} else if (m_max != GenTime() && start + duration > m_max) {
m_pos->setValue(m_max - duration);
}
}
void ClipDurationDialog::slotCheckDuration()
{
GenTime start = m_pos->gentime();
GenTime duration = m_dur->gentime();
GenTime cropStart = m_cropStart->gentime();
GenTime maxDuration;
if (m_clip->maxDuration() == GenTime()) {
maxDuration = m_max;
} else {
maxDuration = m_max == GenTime() ? start + m_clip->maxDuration() - cropStart : qMin(m_max, start + m_clip->maxDuration() - cropStart);
}
if (maxDuration != GenTime() && start + duration > maxDuration) {
m_dur->blockSignals(true);
m_dur->setValue(maxDuration - start);
m_dur->blockSignals(false);
}
m_cropEnd->blockSignals(true);
m_cropEnd->setValue(m_clip->maxDuration() - m_dur->gentime() - cropStart);
m_cropEnd->blockSignals(false);
}
void ClipDurationDialog::slotCheckCrop()
{
GenTime duration = m_dur->gentime();
GenTime cropStart = m_cropStart->gentime();
GenTime maxDuration = m_clip->maxDuration();
GenTime diff = cropStart - m_crop;
if ((diff > GenTime() && diff < duration) || diff < GenTime()) {
duration -= diff;
} else {
m_cropStart->setValue(m_crop);
return;
}
if (maxDuration != GenTime() && cropStart + duration > maxDuration) {
m_cropStart->setValue(m_crop);
} else {
m_crop = cropStart;
m_dur->blockSignals(true);
m_dur->setValue(duration);
m_dur->blockSignals(false);
}
}
void ClipDurationDialog::slotCheckEnd()
{
GenTime cropStart = m_cropStart->gentime();
GenTime cropEnd = m_cropEnd->gentime();
GenTime duration = m_clip->maxDuration() - cropEnd - cropStart;
if (duration >= GenTime()) {
m_dur->setValue(duration);
slotCheckDuration();
} else {
m_cropEnd->blockSignals(true);
m_cropEnd->setValue(m_clip->maxDuration() - m_dur->gentime() - cropStart);
m_cropEnd->blockSignals(false);
}
}
GenTime ClipDurationDialog::startPos() const
{
return m_pos->gentime();
}
GenTime ClipDurationDialog::cropStart() const
{
return m_cropStart->gentime();
}
GenTime ClipDurationDialog::duration() const
{
return m_dur->gentime();
}
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef CLIPDURATIONDIALOG_H
#define CLIPDURATIONDIALOG_H
#include "timeline/abstractclipitem.h"
#include "timecodedisplay.h"
#include "ui_clipdurationdialog_ui.h"
/**
* @class ClipDurationDialog
* @brief A dialog for modifying an item's (clip or transition) duration.
* @author Jean-Baptiste Mardelle
*/
class ClipDurationDialog : public QDialog, public Ui::ClipDurationDialog_UI
{
Q_OBJECT
public:
explicit ClipDurationDialog(AbstractClipItem *clip, const Timecode &tc, const GenTime &min, const GenTime &max, QWidget *parent = nullptr);
~ClipDurationDialog();
GenTime startPos() const;
GenTime cropStart() const;
GenTime duration() const;
private slots:
void slotCheckDuration();
void slotCheckStart();
void slotCheckCrop();
void slotCheckEnd();
private:
AbstractClipItem *m_clip;
TimecodeDisplay *m_pos;
TimecodeDisplay *m_dur;
TimecodeDisplay *m_cropStart;
TimecodeDisplay *m_cropEnd;
GenTime m_min;
GenTime m_max;
GenTime m_crop;
};
#endif
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "markerdialog.h"
#include "doc/kthumb.h"
#include "kdenlivesettings.h"
#include "mltcontroller/clipcontroller.h"
#include <QWheelEvent>
#include "kdenlive_debug.h"
#include <QTimer>
#include <QFontDatabase>
#include "klocalizedstring.h"
MarkerDialog::MarkerDialog(ClipController *clip, const CommentedTime &t, const Timecode &tc, const QString &caption, QWidget *parent)
: QDialog(parent)
, m_clip(clip)
, m_dar(4.0 / 3.0)
{
setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
setupUi(this);
setWindowTitle(caption);
// Set up categories
for (int i = 0; i < 5; ++i) {
marker_type->insertItem(i, i18n("Category %1", i));
marker_type->setItemData(i, CommentedTime::markerColor(i), Qt::DecorationRole);
}
marker_type->setCurrentIndex(t.markerType());
m_in = new TimecodeDisplay(tc, this);
inputLayout->addWidget(m_in);
m_in->setValue(t.time());
m_previewTimer = new QTimer(this);
if (m_clip != nullptr) {
m_in->setRange(0, m_clip->getPlaytime().frames(tc.fps()));
m_previewTimer->setInterval(500);
connect(m_previewTimer, &QTimer::timeout, this, &MarkerDialog::slotUpdateThumb);
m_dar = m_clip->dar();
int width = Kdenlive::DefaultThumbHeight * m_dar;
QPixmap p(width, Kdenlive::DefaultThumbHeight);
p.fill(Qt::transparent);
QString colour = clip->property(QStringLiteral("colour"));
switch (m_clip->clipType()) {
case Video:
case AV:
case SlideShow:
case Playlist:
m_previewTimer->start();
connect(this, SIGNAL(updateThumb()), m_previewTimer, SLOT(start()));
break;
case Image:
case Text:
case QText:
m_previewTimer->start();
//p = m_clip->pixmap(m_in->getValue(), width, height);
break;
case Color:
colour = colour.replace(0, 2, QLatin1Char('#'));
p.fill(QColor(colour.left(7)));
break;
//UNKNOWN, AUDIO, VIRTUAL:
default:
p.fill(Qt::black);
}
if (!p.isNull()) {
clip_thumb->setFixedWidth(p.width());
clip_thumb->setFixedHeight(p.height());
clip_thumb->setPixmap(p);
}
connect(m_in, &TimecodeDisplay::timeCodeEditingFinished, this, &MarkerDialog::updateThumb);
} else {
clip_thumb->setHidden(true);
label_category->setHidden(true);
marker_type->setHidden(true);
}
marker_comment->setText(t.comment());
marker_comment->selectAll();
marker_comment->setFocus();
adjustSize();
}
MarkerDialog::~MarkerDialog()
{
delete m_previewTimer;
}
void MarkerDialog::slotUpdateThumb()
{
m_previewTimer->stop();
int pos = m_in->getValue();
int width = Kdenlive::DefaultThumbHeight * m_dar;
/*m_image = KThumb::getFrame(m_producer, pos, swidth, width, 100);
const QPixmap p = QPixmap::fromImage(m_image);*/
const QPixmap p = m_clip->pixmap(pos, width, Kdenlive::DefaultThumbHeight);
if (!p.isNull()) {
clip_thumb->setPixmap(p);
} else {
qCDebug(KDENLIVE_LOG) << "!!!!!!!!!!! ERROR CREATING THUMB";
}
}
QImage MarkerDialog::markerImage() const
{
return clip_thumb->pixmap()->toImage();
}
CommentedTime MarkerDialog::newMarker()
{
KdenliveSettings::setDefault_marker_type(marker_type->currentIndex());
return CommentedTime(m_in->gentime(), marker_comment->text(), marker_type->currentIndex());
}
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef MARKERDIALOG_H
#define MARKERDIALOG_H
#include "ui_markerdialog_ui.h"
#include "definitions.h"
#include "timecode.h"
#include "timecodedisplay.h"
class ClipController;
namespace Mlt
{
}
/**
* @class MarkerDialog
* @brief A dialog for editing markers and guides.
* @author Jean-Baptiste Mardelle
*/
class MarkerDialog : public QDialog, public Ui::MarkerDialog_UI
{
Q_OBJECT
public:
explicit MarkerDialog(ClipController *clip, const CommentedTime &t, const Timecode &tc, const QString &caption, QWidget *parent = nullptr);
~MarkerDialog();
CommentedTime newMarker();
QImage markerImage() const;
private slots:
void slotUpdateThumb();
private:
ClipController *m_clip;
TimecodeDisplay *m_in;
double m_dar;
QTimer *m_previewTimer;
signals:
void updateThumb();
};
#endif
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "spacerdialog.h"
#include "doc/kthumb.h"
#include "kdenlivesettings.h"
#include <QWheelEvent>
#include <QFontDatabase>
#include "klocalizedstring.h"
SpacerDialog::SpacerDialog(const GenTime &duration, const Timecode &tc, int track, const QList<TrackInfo> &tracks, QWidget *parent) :
QDialog(parent),
m_in(tc)
{
setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
setupUi(this);
inputLayout->addWidget(&m_in);
m_in.setValue(duration);
QIcon videoIcon = QIcon::fromTheme(QStringLiteral("kdenlive-show-video"));
QIcon audioIcon = QIcon::fromTheme(QStringLiteral("kdenlive-show-audio"));
track_number->addItem(i18n("All tracks"), -1);
for (int i = tracks.count() - 1; i > 0; i--) {
TrackInfo info = tracks.at(i);
track_number->addItem(info.type == VideoTrack ? videoIcon : audioIcon,
info.trackName.isEmpty() ? QString::number(i) : info.trackName, i);
}
track_number->setCurrentIndex(track == 0 ? 0 : tracks.count() - track);
adjustSize();
}
GenTime SpacerDialog::selectedDuration() const
{
return m_in.gentime();
}
int SpacerDialog::selectedTrack() const
{
return track_number->currentData().toInt();
}
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef SPACERDIALOG_H
#define SPACERDIALOG_H
#include "ui_spacerdialog_ui.h"
#include "timecode.h"
#include "timecodedisplay.h"
#include "definitions.h"
/**
* @class SpacerDialog
* @brief A dialog to specify length and track of inserted space.
* @author Jean-Baptiste Mardelle
*/
class SpacerDialog : public QDialog, public Ui::SpacerDialog_UI
{
Q_OBJECT
public:
SpacerDialog(const GenTime &duration, const Timecode &tc, int track, const QList<TrackInfo> &tracks, QWidget *parent = nullptr);
GenTime selectedDuration() const;
int selectedTrack() const;
private:
TimecodeDisplay m_in;
};
#endif
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "trackdialog.h"
#include "kdenlivesettings.h"
#include "timeline.h"
#include <QIcon>
TrackDialog::TrackDialog(Timeline *timeline, QWidget *parent) :
QDialog(parent)
{
//setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
QIcon videoIcon = QIcon::fromTheme(QStringLiteral("kdenlive-show-video"));
QIcon audioIcon = QIcon::fromTheme(QStringLiteral("kdenlive-show-audio"));
setupUi(this);
for (int i = timeline->tracksCount() - 1; i > 0; i--) {
TrackInfo info = timeline->getTrackInfo(i);
comboTracks->addItem(info.type == VideoTrack ? videoIcon : audioIcon,
info.trackName.isEmpty() ? QString::number(i) : info.trackName);
}
}
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef TRACKDIALOG_H
#define TRACKDIALOG_H
#include "ui_addtrack_ui.h"
class Timeline;
class TrackDialog : public QDialog, public Ui::AddTrack_UI
{
Q_OBJECT
public:
explicit TrackDialog(Timeline *timeline, QWidget *parent = nullptr);
};
#endif
/***************************************************************************
* Copyright (C) 2010 by Till Theato (root@ttill.de) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "tracksconfigdialog.h"
#include "timeline/timeline.h"
#include <QTableWidget>
#include <KComboBox>
#include <QIcon>
#include "klocalizedstring.h"
TracksDelegate::TracksDelegate(QObject *parent) :
QItemDelegate(parent)
{
}
QWidget *TracksDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem & /* option */, const QModelIndex & /*index*/) const
{
KComboBox *comboBox = new KComboBox(parent);
comboBox->addItem