#include "transitionsettings.h"
#include "renderwidget.h"
#include "renderer.h"
+#ifndef NO_JOGSHUTTLE
#include "jogshuttle.h"
+#endif /* NO_JOGSHUTTLE */
#include "clipproperties.h"
#include "wizard.h"
#include "editclipcommand.h"
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), m_jogProcess(NULL), m_findActivated(false), m_initialized(false) {
+ m_activeDocument(NULL), m_activeTimeline(NULL), m_renderWidget(NULL),
+#ifndef NO_JOGSHUTTLE
+ m_jogProcess(NULL),
+#endif /* NO_JOGSHUTTLE */
+ m_findActivated(false), m_initialized(false) {
setlocale(LC_NUMERIC, "POSIX");
setFont(KGlobalSettings::toolBarFont());
parseProfiles(MltPath);
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);
}
+#ifndef NO_JOGSHUTTLE
activateShuttleDevice();
+#endif /* NO_JOGSHUTTLE */
projectListDock->raise();
}
m_effectList->reloadEffectList();
}
+#ifndef NO_JOGSHUTTLE
void MainWindow::activateShuttleDevice() {
if (m_jogProcess) delete m_jogProcess;
m_jogProcess = NULL;
break;
}
}
+#endif /* NO_JOGSHUTTLE */
void MainWindow::configureNotifications() {
KNotifyConfigWidget::configure(this);
KdenliveSettings::self()->writeConfig();
KSharedConfigPtr config = KGlobal::config();
m_fileOpenRecent->saveEntries(KConfigGroup(config, "Recent Files"));
+ KConfigGroup treecolumns(config, "Project Tree");
+ treecolumns.writeEntry("columns", m_projectList->headerInfo());
config->sync();
}
::exit(1);
}
}
+ KConfigGroup treecolumns(config, "Project Tree");
+ const QByteArray state = treecolumns.readEntry("columns", QByteArray());
+ if (!state.isEmpty())
+ m_projectList->setHeaderInfo(state);
}
void MainWindow::newFile(bool showProjectSettings) {
}
}
m_timelineArea->removeTab(m_timelineArea->indexOf(w));
- if (m_timelineArea->count() == 1) m_timelineArea->setTabBarHidden(true);
+ if (m_timelineArea->count() == 1) {
+ m_timelineArea->setTabBarHidden(true);
+ m_closeAction->setEnabled(false);
+ }
delete docToClose;
delete w;
if (m_timelineArea->count() == 0) {
disconnect(m_activeDocument, SIGNAL(updateClipDisplay(const QString &)), m_projectList, SLOT(slotUpdateClip(const QString &)));
disconnect(m_activeDocument, SIGNAL(selectLastAddedClip(const QString &)), m_projectList, SLOT(slotSelectClip(const QString &)));
disconnect(m_activeDocument, SIGNAL(deleteTimelineClip(const QString &)), m_activeTimeline, SLOT(slotDeleteClip(const QString &)));
- disconnect(m_activeTimeline, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
- disconnect(m_activeTimeline, SIGNAL(clipItemSelected(ClipItem*)), this, SLOT(slotActivateEffectStackView()));
+ disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
+ disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
disconnect(m_activeTimeline, SIGNAL(transitionItemSelected(Transition*)), transitionConfig, SLOT(slotTransitionItemSelected(Transition*)));
disconnect(m_activeTimeline, SIGNAL(transitionItemSelected(Transition*)), this, SLOT(slotActivateTransitionView()));
disconnect(m_zoomSlider, SIGNAL(valueChanged(int)), m_activeTimeline, SLOT(slotChangeZoom(int)));
connect(doc, SIGNAL(guidesUpdated()), this, SLOT(slotGuidesUpdated()));
- connect(trackView, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
- connect(trackView, SIGNAL(clipItemSelected(ClipItem*)), this, SLOT(slotActivateEffectStackView()));
+ connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
+ connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
connect(trackView, SIGNAL(transitionItemSelected(Transition*)), transitionConfig, SLOT(slotTransitionItemSelected(Transition*)));
connect(trackView, SIGNAL(transitionItemSelected(Transition*)), this, SLOT(slotActivateTransitionView()));
m_zoomSlider->setValue(doc->zoom());
}
m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
+#ifndef NO_JOGSHUTTLE
activateShuttleDevice();
+#endif /* NO_JOGSHUTTLE */
}
} 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) {