EffectsList MainWindow::customEffects;
EffectsList MainWindow::transitions;
+QMap <QString,QImage> MainWindow::m_lumacache;
+
MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & clipsToLoad, QWidget *parent) :
KXmlGuiWindow(parent),
m_activeDocument(NULL),
char *separator = localeconv()->decimal_point;
if (separator != systemLocale.decimalPoint()) {
kDebug()<<"------\n!!! system locale is not similar to Qt's locale... be prepared for bugs!!!\n------";
- // HACK: There is a locale conflict, so set locale to at least have correct decimal point
- if (strncmp(separator, ".", 1) == 0) systemLocale = QLocale::c();
- else if (strncmp(separator, ",", 1) == 0) systemLocale = QLocale("fr_FR.UTF-8");
+ // HACK: There is a locale conflict, so set locale to C
+ // Make sure to override exported values or it won't work
+ setenv("LANG", "C", 1);
+ setlocale(LC_NUMERIC, "C");
+ systemLocale = QLocale::c();
}
systemLocale.setNumberOptions(QLocale::OmitGroupSeparator);
// FIXME: the next call returns a newly allocated object, which leaks
initEffects::parseEffectFiles();
//initEffects::parseCustomEffectsFile();
-
+
m_monitorManager = new MonitorManager();
m_shortcutRemoveFocus = new QShortcut(QKeySequence("Esc"), this);
KActionCategory *layoutActions = new KActionCategory(i18n("Layouts"), actionCollection());
m_loadLayout = new KSelectAction(i18n("Load Layout"), actionCollection());
for (int i = 1; i < 5; i++) {
- KAction *load = new KAction(KIcon(), i18n("Layout %1").arg(i), this);
+ KAction *load = new KAction(KIcon(), i18n("Layout %1", i), this);
load->setData("_" + QString::number(i));
layoutActions->addAction("load_layout" + QString::number(i), load);
m_loadLayout->addAction(load);
- KAction *save = new KAction(KIcon(), i18n("Save As Layout %1").arg(i), this);
+ KAction *save = new KAction(KIcon(), i18n("Save As Layout %1", i), this);
save->setData("_" + QString::number(i));
layoutActions->addAction("save_layout" + QString::number(i), save);
}
m_timelineContextClipMenu->addAction(actionCollection()->action("group_clip"));
m_timelineContextClipMenu->addAction(actionCollection()->action("ungroup_clip"));
m_timelineContextClipMenu->addAction(actionCollection()->action("split_audio"));
+ m_timelineContextClipMenu->addAction(actionCollection()->action("set_audio_align_ref"));
+ m_timelineContextClipMenu->addAction(actionCollection()->action("align_audio"));
m_timelineContextClipMenu->addSeparator();
m_timelineContextClipMenu->addAction(actionCollection()->action("cut_timeline_clip"));
m_timelineContextClipMenu->addAction(actionCollection()->action(KStandardAction::name(KStandardAction::Copy)));
if (m_activeDocument->url().fileName().isEmpty())
message = i18n("Save changes to document?");
else
- message = i18n("The project <b>\"%1\"</b> has been changed.\nDo you want to save your changes?").arg(m_activeDocument->url().fileName());
+ message = i18n("The project <b>\"%1\"</b> has been changed.\nDo you want to save your changes?", m_activeDocument->url().fileName());
switch (KMessageBox::warningYesNoCancel(this, message)) {
case KMessageBox::Yes :
// save document here. If saving fails, return false;
collection.addAction("edit_clip_marker", editClipMarker);
connect(editClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotEditClipMarker()));
- KAction *addMarkerGuideQuickly = new KAction(KIcon("bookmark-new"), i18n("Add Marker/Guide quickly"), this);
+ KAction* addMarkerGuideQuickly = new KAction(KIcon("bookmark-new"), i18n("Add Marker/Guide quickly"), this);
addMarkerGuideQuickly->setShortcut(Qt::Key_Asterisk);
collection.addAction("add_marker_guide_quickly", addMarkerGuideQuickly);
connect(addMarkerGuideQuickly, SIGNAL(triggered(bool)), this, SLOT(slotAddMarkerGuideQuickly()));
collection.addAction("split_audio", splitAudio);
connect(splitAudio, SIGNAL(triggered(bool)), this, SLOT(slotSplitAudio()));
+ KAction* setAudioAlignReference = new KAction(i18n("Set Audio Reference"), this);
+ collection.addAction("set_audio_align_ref", setAudioAlignReference);
+ connect(setAudioAlignReference, SIGNAL(triggered()), this, SLOT(slotSetAudioAlignReference()));
+
+ KAction* alignAudio = new KAction(i18n("Align Audio to Reference"), this);
+ collection.addAction("align_audio", alignAudio);
+ connect(alignAudio, SIGNAL(triggered()), this, SLOT(slotAlignAudio()));
+
KAction* audioOnly = new KAction(KIcon("document-new"), i18n("Audio Only"), this);
collection.addAction("clip_audio_only", audioOnly);
audioOnly->setData("clip_audio_only");
}
for (int j = 0; j < saveActions.count(); j++) {
if (saveActions.at(j)->data().toString().endsWith("_" + QString::number(i))) {
- saveActions[j]->setText(i18n("Save as %1").arg(layoutName));
+ saveActions[j]->setText(i18n("Save as %1", layoutName));
saveActions[j]->setData(key);
break;
}
if (m_activeDocument->url().fileName().isEmpty())
message = i18n("Save changes to document?");
else
- message = i18n("The project <b>\"%1\"</b> has been changed.\nDo you want to save your changes?").arg(m_activeDocument->url().fileName());
+ message = i18n("The project <b>\"%1\"</b> has been changed.\nDo you want to save your changes?", m_activeDocument->url().fileName());
switch (KMessageBox::warningYesNoCancel(this, message)) {
case KMessageBox::Yes :
// save document here. If saving fails, return false;
disconnect(m_effectStack, SIGNAL(updateEffect(ClipItem*, int, QDomElement, QDomElement, int,bool)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, int, QDomElement, QDomElement, int,bool)));
disconnect(m_effectStack, SIGNAL(removeEffect(ClipItem*, int, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, int, QDomElement)));
disconnect(m_effectStack, SIGNAL(addEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotAddEffect(ClipItem*, QDomElement)));
- disconnect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, int, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, int, bool)));
+ disconnect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, QList <int>, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, QList <int>, bool)));
disconnect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, QList<int>, int)), m_activeTimeline->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, QList <int>, int)));
disconnect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
disconnect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
connect(m_effectStack, SIGNAL(updateClipRegion(ClipItem*, int, QString)), trackView->projectView(), SLOT(slotUpdateClipRegion(ClipItem*, int, QString)));
connect(m_effectStack, SIGNAL(removeEffect(ClipItem*, int, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, int, QDomElement)));
connect(m_effectStack, SIGNAL(addEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotAddEffect(ClipItem*, QDomElement)));
- connect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, int, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, int, bool)));
+ connect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, QList <int>, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, QList <int>, bool)));
connect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, QList <int>, int)), trackView->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, QList <int>, int)));
connect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
connect(m_effectStack, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
else
effect = customEffects.getEffectByTag(info.at(0), info.at(1));
if (!effect.isNull()) slotAddEffect(effect);
- else m_messageLabel->setMessage(i18n("Cannot find effect %1 / %2").arg(info.at(0)).arg(info.at(1)), ErrorMessage);
+ else m_messageLabel->setMessage(i18n("Cannot find effect %1 / %2", info.at(0), info.at(1)), ErrorMessage);
}
m_activeTimeline->projectView()->splitAudio();
}
+void MainWindow::slotSetAudioAlignReference()
+{
+ if (m_activeTimeline) {
+ m_activeTimeline->projectView()->setAudioAlignReference();
+ }
+}
+
+void MainWindow::slotAlignAudio()
+{
+ if (m_activeTimeline) {
+ m_activeTimeline->projectView()->alignAudio();
+ }
+}
+
void MainWindow::slotUpdateClipType(QAction *action)
{
if (m_activeTimeline) {
// Do save scenelist
QFile file(playlistPath);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
- m_messageLabel->setMessage(i18n("Cannot write to file %1").arg(playlistPath), ErrorMessage);
+ m_messageLabel->setMessage(i18n("Cannot write to file %1", playlistPath), ErrorMessage);
return;
}
file.write(playlistContent.toUtf8());
if (file.error() != QFile::NoError) {
- m_messageLabel->setMessage(i18n("Cannot write to file %1").arg(playlistPath), ErrorMessage);
+ m_messageLabel->setMessage(i18n("Cannot write to file %1", playlistPath), ErrorMessage);
file.close();
return;
}