EffectsList MainWindow::customEffects;
EffectsList MainWindow::transitions;
-MainWindow::MainWindow(const QString &MltPath, QWidget *parent)
+MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent)
: KXmlGuiWindow(parent),
m_activeDocument(NULL), m_activeTimeline(NULL), m_renderWidget(NULL),
#ifndef NO_JOGSHUTTLE
- m_jogProcess(NULL),
+ m_jogProcess(NULL),
#endif /* NO_JOGSHUTTLE */
- m_findActivated(false), m_initialized(false) {
+ m_findActivated(false), m_initialized(false) {
setlocale(LC_NUMERIC, "POSIX");
setFont(KGlobalSettings::toolBarFont());
parseProfiles(MltPath);
QMenu *transitionsMenu = new QMenu(i18n("Add Transition"), this);
QStringList effects = transitions.effectNames();
- foreach(const QString &name, effects) {
- action = new QAction(name, this);
- action->setData(name);
+
+ effectsList.clear();
+ for (int ix = 0; ix < transitions.count(); ix++) {
+ effectInfo = transitions.effectIdInfo(ix);
+ effectsList.insert(effectInfo.at(0).toLower(), effectInfo);
+ }
+ foreach(QStringList value, effectsList) {
+ action = new QAction(value.at(0), this);
+ action->setData(value);
transitionsMenu->addAction(action);
}
connect(transitionsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddTransition(QAction *)));
m_monitorManager->initMonitors(m_clipMonitor, m_projectMonitor);
slotConnectMonitors();
- if (KdenliveSettings::openlastproject()) {
- openLastFile();
+ // Open or create a file. Command line argument passed in Url has
+ // precedence, then "openlastproject", then just a plain empty file.
+ // If opening Url fails, openlastproject will _not_ be used.
+ if (!Url.isEmpty()) {
+ openFile(Url);
} else {
- /*QList<KAutoSaveFile *> staleFiles = KAutoSaveFile::allStaleFiles();
- if (!staleFiles.isEmpty()) {
- if (KMessageBox::questionYesNo(this, i18n("Auto-saved files exist. Do you want to recover them now?"), i18n("File Recovery"), KGuiItem(i18n("Recover")), KGuiItem(i18n("Don't recover"))) == KMessageBox::Yes) {
- recoverFiles(staleFiles);
- }
- else newFile();
+ if (KdenliveSettings::openlastproject()) {
+ openLastFile();
}
- else*/
+ }
+ if (m_timelineArea->count() == 0) {
newFile(false);
}
}
void MainWindow::saveFileAs(const QString &outputFileName) {
- m_projectMonitor->saveSceneList(outputFileName, m_activeDocument->documentInfoXml());
+ QDomDocument currentSceneList = m_projectMonitor->sceneList();
+ m_activeDocument->saveSceneList(outputFileName, currentSceneList);
m_activeDocument->setUrl(KUrl(outputFileName));
if (m_activeDocument->m_autosave == NULL) {
m_activeDocument->m_autosave = new KAutoSaveFile(KUrl(outputFileName), this);
}
void MainWindow::saveFileAs() {
- QString outputFile = KFileDialog::getSaveFileName(KUrl(), "*.kdenlive|Kdenlive project files (*.kdenlive)");
+ QString outputFile = KFileDialog::getSaveFileName(KUrl(), "application/x-kdenlive");
if (QFile::exists(outputFile)) {
if (KMessageBox::questionYesNo(this, i18n("File already exists.\nDo you want to overwrite it ?")) == KMessageBox::No) return;
}
}
void MainWindow::openFile() {
- KUrl url = KFileDialog::getOpenUrl(KUrl(), "*.kdenlive|Kdenlive project files (*.kdenlive)\n*.westley|MLT project files (*.westley)");
+ KUrl url = KFileDialog::getOpenUrl(KUrl(), "application/x-kdenlive");
if (url.isEmpty()) return;
m_fileOpenRecent->addUrl(url);
openFile(url);
void MainWindow::slotAddTransition(QAction *result) {
if (!result) return;
- QDomElement effect = transitions.getEffectByName(result->data().toString());
+ QStringList info = result->data().toStringList();
+ if (info.isEmpty()) return;
+ QDomElement transition = transitions.getEffectByTag(info.at(1), info.at(2));
+ //QDomElement effect = transitions.getEffectByName(result->data().toString());
if (m_activeTimeline) {
- m_activeTimeline->projectView()->slotAddTransitionToSelectedClips(effect);
+ m_activeTimeline->projectView()->slotAddTransitionToSelectedClips(transition);
}
}
} else KXmlGuiWindow::keyPressEvent(ke);
}
+
+/** Gets called when the window gets hidden */
+void MainWindow::hideEvent(QHideEvent *event) {
+ // kDebug() << "I was hidden";
+ // issue http://www.kdenlive.org/mantis/view.php?id=231
+ if (this->isMinimized()) {
+ // kDebug() << "I am minimized";
+ if (m_monitorManager) m_monitorManager->stopActiveMonitor();
+ }
+}
+
bool MainWindow::eventFilter(QObject *obj, QEvent *event) {
if (m_findActivated) {
if (event->type() == QEvent::ShortcutOverride) {