if (m_dropFrame) {
//Get Hours, Minutes, Seconds, Frames from timecode
int hours, minutes, seconds, frames;
-
+
hours = duration.section(':', 0, 0).toInt();
if (duration.contains('.')) {
minutes = duration.section('.', 0, 0).section(':', 1, 1).toInt();
seconds = duration.section(':', 2, 2).toInt();
frames = duration.section(':', 3, 3).toInt();
}
-
+
//Calculate the frame count
- int dropRate = (int) ((ceil(m_displayedFramesPerSecond) / 30) * 2);
+ int dropRate = (int)((ceil(m_displayedFramesPerSecond) / 30) * 2);
frames += ((hours * 60 + minutes) * 60 + seconds) * m_displayedFramesPerSecond;
frames -= dropRate * ((hours * 60 + minutes) - (floor((hours * 60 + minutes) / 10)));
return frames;
text.append(':');
text.append(QString::number(minutes).rightJustified(2, '0', false));
if (m_dropFrame) {
- text.append('.');
+ text.append('.');
} else {
text.append(':');
}
text.append(QString::number(seconds).rightJustified(2, '0', false));
- text.append(':');
+ text.append(':');
text.append(QString::number(hundredths).rightJustified(2, '0', false));
return text;
// calculate how many frames need to be dropped every minute.
int dropRate = 0;
if (m_dropFrame) {
- dropRate = (int) ((ceil(m_displayedFramesPerSecond) / 30) * 2);
+ dropRate = (int)((ceil(m_displayedFramesPerSecond) / 30) * 2);
}
// calculate how many frames are in a normal minute, and how many are in a tenth minute.
text.append(QString::number(tenMinuteIntervals));
text.append(QString::number(numMinutes));
if (m_dropFrame) {
- text.append('.');
+ text.append('.');
} else {
text.append(':');
}
text.append(QString::number(seconds).rightJustified(2, '0', false));
- text.append(':');
+ text.append(':');
text.append(QString::number(frames).rightJustified(2, '0', false));
return text;
initAnimation();
connect(anim_start, SIGNAL(toggled(bool)), this, SLOT(slotAnimStart(bool)));
connect(anim_end, SIGNAL(toggled(bool)), this, SLOT(slotAnimEnd(bool)));
- connect(templateBox,SIGNAL(currentIndexChanged(int)),this,SLOT(templateIndexChanged(int)));
+ connect(templateBox, SIGNAL(currentIndexChanged(int)), this, SLOT(templateIndexChanged(int)));
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(KdenliveSettings::hastitleproducer());
- refreshTitleTemplates();
- //templateBox->setIconSize(QSize(60,60));
- templateBox->clear();
- templateBox->addItem("");
- foreach (TitleTemplate t, titletemplates)
- {
- templateBox->addItem(t.icon,t.name,t.file);
- }
- lastDocumentHash=QCryptographicHash::hash(xml().toString().toAscii(), QCryptographicHash::Md5).toHex();
+ refreshTitleTemplates();
+ //templateBox->setIconSize(QSize(60,60));
+ templateBox->clear();
+ templateBox->addItem("");
+ foreach(TitleTemplate t, titletemplates) {
+ templateBox->addItem(t.icon, t.name, t.file);
+ }
+ lastDocumentHash = QCryptographicHash::hash(xml().toString().toAscii(), QCryptographicHash::Md5).toHex();
}
TitleWidget::~TitleWidget()
//static
void TitleWidget::refreshTitleTemplates()
{
- QStringList titlenamelist = QStringList() << i18n("None");
+ QStringList titlenamelist = QStringList() << i18n("None");
QStringList titlefiles = QStringList() << QString();
QStringList filters;
filters << "*.kdenlivetitle" ;
- titletemplates.clear();
+ titletemplates.clear();
QStringList titleTemplates = KGlobal::dirs()->findDirs("appdata", "titles");
foreach(const QString &folder, titleTemplates) {
QStringList filesnames = QDir(folder).entryList(filters, QDir::Files);
foreach(const QString &fname, filesnames) {
- //titlenamelist.append(fname);
+ //titlenamelist.append(fname);
//titlefiles.append(KUrl(folder).path(KUrl::AddTrailingSlash) + fname);
- TitleTemplate t;
- t.name=fname;
- t.file=KUrl(folder).path(KUrl::AddTrailingSlash) + fname;
- t.icon=QIcon(KThumb::getImage(t.file,0,60,60));
- titletemplates.append(t);
+ TitleTemplate t;
+ t.name = fname;
+ t.file = KUrl(folder).path(KUrl::AddTrailingSlash) + fname;
+ t.icon = QIcon(KThumb::getImage(t.file, 0, 60, 60));
+ titletemplates.append(t);
}
}
- kDebug() << titlenamelist << titlefiles;
+ kDebug() << titlenamelist << titlefiles;
}
-void TitleWidget::templateIndexChanged(int index )
+void TitleWidget::templateIndexChanged(int index)
{
- QString item=templateBox->itemData(index).toString();
- if (item!="")
- {
- if (lastDocumentHash!=QCryptographicHash::hash(xml().toString().toAscii(), QCryptographicHash::Md5).toHex())
- {
- if (KMessageBox::questionYesNo(this, i18n("Title was changed !\nDo you really want to load a new template?\nAll changes in this document are lost !!")) == KMessageBox::No) return;
- }
- loadTitle(item);
- lastDocumentHash=QCryptographicHash::hash(xml().toString().toAscii(), QCryptographicHash::Md5).toHex();
- }
+ QString item = templateBox->itemData(index).toString();
+ if (item != "") {
+ if (lastDocumentHash != QCryptographicHash::hash(xml().toString().toAscii(), QCryptographicHash::Md5).toHex()) {
+ if (KMessageBox::questionYesNo(this, i18n("Title was changed !\nDo you really want to load a new template?\nAll changes in this document are lost !!")) == KMessageBox::No) return;
+ }
+ loadTitle(item);
+ lastDocumentHash = QCryptographicHash::hash(xml().toString().toAscii(), QCryptographicHash::Md5).toHex();
+ }
}
//virtual
void TitleWidget::resizeEvent(QResizeEvent * /*event*/)
class TitleTemplate
{
public:
- QString file;
- QString name;
- QIcon icon;
+ QString file;
+ QString name;
+ QIcon icon;
};
class Transform
/** \brief Get clip duration. */
int duration() const;
- /** load Title Templates*/
- static void refreshTitleTemplates();
+ /** load Title Templates*/
+ static void refreshTitleTemplates();
protected:
virtual void resizeEvent(QResizeEvent * event);
/** project path for storing title clips */
QString m_projectTitlePath;
Timecode m_tc;
- QString lastDocumentHash;
+ QString lastDocumentHash;
/** See http://doc.trolltech.com/4.5/signalsandslots.html#advanced-signals-and-slots-usage */
QSignalMapper *m_signalMapper;
void slotZIndexDown();
void slotZIndexTop();
void slotZIndexBottom();
- void templateIndexChanged(int);
+ void templateIndexChanged(int);
};