* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
-
+#include <stdlib.h>
#include <QTextStream>
#include <QTimer>
EffectsList MainWindow::customEffects;
EffectsList MainWindow::transitions;
-MainWindow::MainWindow(QWidget *parent)
+MainWindow::MainWindow(const QString &MltPath, QWidget *parent)
: KXmlGuiWindow(parent),
m_activeDocument(NULL), m_activeTimeline(NULL), m_renderWidget(NULL), m_jogProcess(NULL), m_findActivated(false), m_initialized(false) {
setlocale(LC_NUMERIC, "POSIX");
setFont(KGlobalSettings::toolBarFont());
- parseProfiles();
+ parseProfiles(MltPath);
m_commandStack = new QUndoGroup;
m_timelineArea = new KTabWidget(this);
m_timelineArea->setTabReorderingEnabled(true);
m_findTimer.setSingleShot(true);
initEffects::parseEffectFiles();
+ //initEffects::parseCustomEffectsFile();
+
m_monitorManager = new MonitorManager();
projectListDock = new QDockWidget(i18n("Project Tree"), this);
}
m_customEffectsMenu = static_cast<QMenu*>(factory()->container("custom_effects_menu", this));
effects = customEffects.effectNames();
+ if (effects.isEmpty()) m_customEffectsMenu->setEnabled(false);
+ else m_customEffectsMenu->setEnabled(true);
+
foreach(const QString &name, effects) {
action = new QAction(name, this);
action->setData(name);
m_customEffectsMenu->addAction(action);
}
+ QMenu *newEffect = new QMenu(this);
+ newEffect->addMenu(videoEffectsMenu);
+ newEffect->addMenu(audioEffectsMenu);
+ newEffect->addMenu(m_customEffectsMenu);
+ effectStack->setMenu(newEffect);
+
+
QMenu *viewMenu = static_cast<QMenu*>(factory()->container("dockwindows", this));
const QList<QAction *> viewActions = createPopupMenu()->actions();
viewMenu->insertActions(NULL, viewActions);
m_timelineContextClipMenu->addMenu(transitionsMenu);
m_timelineContextClipMenu->addMenu(videoEffectsMenu);
m_timelineContextClipMenu->addMenu(audioEffectsMenu);
+ //TODO: re-enable custom effects menu when it is implemented
m_timelineContextClipMenu->addMenu(m_customEffectsMenu);
m_timelineContextTransitionMenu->addAction(actionCollection()->action("delete_timeline_clip"));
m_customEffectsMenu->clear();
const QStringList effects = customEffects.effectNames();
QAction *action;
+ if (effects.isEmpty()) m_customEffectsMenu->setEnabled(false);
+ else m_customEffectsMenu->setEnabled(true);
+
foreach(const QString &name, effects) {
action = new QAction(name, this);
action->setData(name);
connect(monitorPlay, SIGNAL(triggered(bool)), m_monitorManager, SLOT(slotPlay()));
KAction *markIn = collection->addAction("mark_in");
- markIn->setText(i18n("Set in point"));
+ markIn->setText(i18n("Set In Point"));
markIn->setShortcut(Qt::Key_I);
connect(markIn, SIGNAL(triggered(bool)), this, SLOT(slotSetInPoint()));
KAction *markOut = collection->addAction("mark_out");
- markOut->setText(i18n("Set in point"));
+ markOut->setText(i18n("Set Out Point"));
markOut->setShortcut(Qt::Key_O);
connect(markOut, SIGNAL(triggered(bool)), this, SLOT(slotSetOutPoint()));
initialGroup.writeEntry("version", "0.7");
delete w;
} else {
- delete w;
- // TODO: find a better way to exit application faster
- QTimer::singleShot(1000, this, SLOT(queryQuit()));
+ ::exit(1);
}
}
}
}
-void MainWindow::parseProfiles() {
+void MainWindow::parseProfiles(const QString &mltPath) {
//kdDebug()<<" + + YOUR MLT INSTALL WAS FOUND IN: "<< MLT_PREFIX <<endl;
//KdenliveSettings::setDefaulttmpfolder();
+ if (!mltPath.isEmpty()) {
+ KdenliveSettings::setMltpath(mltPath + "/share/mlt/profiles/");
+ KdenliveSettings::setRendererpath(mltPath + "/bin/inigo");
+ }
+
if (KdenliveSettings::mltpath().isEmpty()) {
KdenliveSettings::setMltpath(QString(MLT_PREFIX) + QString("/share/mlt/profiles/"));
}
// Cannot find the MLT profiles, ask for location
KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find your Mlt profiles, please give the path"), this);
getUrl->fileDialog()->setMode(KFile::Directory);
- getUrl->exec();
+ if (getUrl->exec() == QDialog::Rejected) {
+ ::exit(0);
+ }
KUrl mltPath = getUrl->selectedUrl();
delete getUrl;
- if (mltPath.isEmpty()) kapp->quit();
+ if (mltPath.isEmpty()) ::exit(0);
KdenliveSettings::setMltpath(mltPath.path());
QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
}
if (KdenliveSettings::rendererpath().isEmpty()) {
// Cannot find the MLT inigo renderer, ask for location
KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(QString(), i18n("Cannot find the inigo program required for rendering (part of Mlt)"), this);
- getUrl->exec();
+ if (getUrl->exec() == QDialog::Rejected) {
+ ::exit(0);
+ }
KUrl rendererPath = getUrl->selectedUrl();
delete getUrl;
- if (rendererPath.isEmpty()) kapp->quit();
+ if (rendererPath.isEmpty()) ::exit(0);
KdenliveSettings::setRendererpath(rendererPath.path());
}
void MainWindow::slotDeleteTimelineClip() {
- if (m_activeTimeline) {
+ if (projectListDock->isActiveWindow()) m_projectList->slotRemoveClip();
+ else if (m_activeTimeline) {
m_activeTimeline->projectView()->deleteSelectedClips();
}
}
void MainWindow::slotAddCustomEffect(QAction *result) {
if (!result) return;
+ if (result->data().toString().isEmpty()) return;
QDomElement effect = customEffects.getEffectByName(result->data().toString());
slotAddEffect(effect);
}