From: Jean-Baptiste Mardelle Date: Wed, 22 Sep 2010 16:51:32 +0000 (+0000) Subject: Captured files should go to project folder if wanted: X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=4ce2b16c0f8de76f0c3d372f29a2ece650c72f24;p=kdenlive Captured files should go to project folder if wanted: http://kdenlive.org/mantis/view.php?id=620 svn path=/trunk/kdenlive/; revision=4924 --- diff --git a/src/kdenlivesettings.kcfg b/src/kdenlivesettings.kcfg index 80a37af2..f2ceeb6b 100644 --- a/src/kdenlivesettings.kcfg +++ b/src/kdenlivesettings.kcfg @@ -193,6 +193,11 @@ $HOME/kdenlive + + + true + + $HOME diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp index 9ddc792d..31ec0d9e 100644 --- a/src/kdenlivesettingsdialog.cpp +++ b/src/kdenlivesettingsdialog.cpp @@ -43,8 +43,8 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent) : - KConfigDialog(parent, "settings", KdenliveSettings::self()), - m_modified(false) + KConfigDialog(parent, "settings", KdenliveSettings::self()), + m_modified(false) { QWidget *p1 = new QWidget; @@ -73,6 +73,8 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent) : m_configEnv.projecturl->lineEdit()->setObjectName("kcfg_defaultprojectfolder"); m_configEnv.capturefolderurl->setMode(KFile::Directory); m_configEnv.capturefolderurl->lineEdit()->setObjectName("kcfg_capturefolder"); + m_configEnv.capturefolderurl->setEnabled(!KdenliveSettings::capturetoprojectfolder()); + connect(m_configEnv.kcfg_capturetoprojectfolder, SIGNAL(clicked()), this, SLOT(slotEnableCaptureFolder())); m_page2 = addPage(p2, i18n("Environment"), "application-x-executable-script"); QWidget *p4 = new QWidget; @@ -199,6 +201,11 @@ void KdenliveSettingsDialog::slotUpdateRmdRegionStatus() m_configCapture.region_group->setHidden(m_configCapture.kcfg_rmd_capture_type->currentIndex() != 1); } +void KdenliveSettingsDialog::slotEnableCaptureFolder() +{ + m_configEnv.capturefolderurl->setEnabled(!m_configEnv.kcfg_capturetoprojectfolder->isChecked()); +} + void KdenliveSettingsDialog::checkProfile() { m_configProject.kcfg_profiles_list->clear(); @@ -305,7 +312,7 @@ void KdenliveSettingsDialog::slotReadAudioDevices() kDebug() << "// / / / / / READING APLAY: "; kDebug() << result; QStringList lines = result.split('\n'); - foreach(const QString &data, lines) { + foreach(const QString & data, lines) { kDebug() << "// READING LINE: " << data; if (data.simplified().startsWith("card")) { QString card = data.section(':', 0, 0).section(' ', -1); @@ -430,6 +437,11 @@ void KdenliveSettingsDialog::updateSettings() bool resetProfile = false; bool updateCapturePath = false; + if (m_configEnv.kcfg_capturetoprojectfolder->isChecked() != KdenliveSettings::capturetoprojectfolder()) { + KdenliveSettings::setCapturetoprojectfolder(m_configEnv.kcfg_capturetoprojectfolder->isChecked()); + updateCapturePath = true; + } + if (m_configEnv.capturefolderurl->url().path() != KdenliveSettings::capturefolder()) { KdenliveSettings::setCapturefolder(m_configEnv.capturefolderurl->url().path()); updateCapturePath = true; diff --git a/src/kdenlivesettingsdialog.h b/src/kdenlivesettingsdialog.h index b41e691d..8b6edb63 100644 --- a/src/kdenlivesettingsdialog.h +++ b/src/kdenlivesettingsdialog.h @@ -65,6 +65,7 @@ private slots: void slotAddTranscode(); void slotDeleteTranscode(); void slotDialogModified(); + void slotEnableCaptureFolder(); private: KPageWidgetItem *m_page1; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0b8022d3..57d374d4 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2082,7 +2082,8 @@ void MainWindow::slotEditProjectSettings() if (w->exec() == QDialog::Accepted) { QString profile = w->selectedProfile(); m_activeDocument->setProjectFolder(w->selectedFolder()); - if (m_renderWidget) m_renderWidget->setDocumentPath(w->selectedFolder().path(KUrl::AddTrailingSlash)); + m_recMonitor->slotUpdateCaptureFolder(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash)); + if (m_renderWidget) m_renderWidget->setDocumentPath(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash)); if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs()) slotSwitchVideoThumbs(); if (KdenliveSettings::audiothumbnails() != w->enableAudioThumbs()) slotSwitchAudioThumbs(); if (m_activeDocument->profilePath() != profile) slotUpdateProjectProfile(profile); @@ -2373,6 +2374,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //cha m_activeDocument = doc; m_activeTimeline->updateProjectFps(); m_activeDocument->checkProjectClips(); + m_recMonitor->slotUpdateCaptureFolder(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash)); if (KdenliveSettings::dropbframes()) slotUpdatePreviewSettings(); //Update the mouse position display so it will display in DF/NDF format by default based on the project setting. slotUpdateMousePosition(0); @@ -2419,13 +2421,19 @@ void MainWindow::slotPreferences(int page, int option) connect(dialog, SIGNAL(doResetProfile()), m_monitorManager, SLOT(slotResetProfiles())); connect(dialog, SIGNAL(updatePreviewSettings()), this, SLOT(slotUpdatePreviewSettings())); #ifndef Q_WS_MAC - connect(dialog, SIGNAL(updateCaptureFolder()), m_recMonitor, SLOT(slotUpdateCaptureFolder())); + connect(dialog, SIGNAL(updateCaptureFolder()), this, SLOT(slotUpdateCaptureFolder())); #endif //connect(dialog, SIGNAL(updatePreviewSettings()), this, SLOT(slotUpdatePreviewSettings())); dialog->show(); if (page != -1) dialog->showPage(page, option); } +void MainWindow::slotUpdateCaptureFolder() +{ + if (m_activeDocument) m_recMonitor->slotUpdateCaptureFolder(m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash)); + else m_recMonitor->slotUpdateCaptureFolder(KdenliveSettings::defaultprojectfolder()); +} + void MainWindow::slotUpdatePreviewSettings() { if (m_activeDocument) { @@ -3313,8 +3321,7 @@ void MainWindow::slotSaveZone(Render *render, QPoint zone) QVBoxLayout *vbox = new QVBoxLayout(widget); QLabel *label1 = new QLabel(i18n("Save clip zone as:"), this); - QString path = m_activeDocument->projectFolder().path(); - path.append("/"); + QString path = m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash); path.append("untitled.mlt"); KUrlRequester *url = new KUrlRequester(KUrl(path), this); url->setFilter("video/mlt-playlist"); @@ -3543,7 +3550,7 @@ void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QS QString playlistPath; if (scriptExport) { bool ok; - QString scriptsFolder = m_activeDocument->projectFolder().path() + "/scripts/"; + QString scriptsFolder = m_activeDocument->projectFolder().path(KUrl::AddTrailingSlash) + "scripts/"; QString path = m_renderWidget->getFreeScriptName(); scriptPath = QInputDialog::getText(this, i18n("Create Render Script"), i18n("Script name (will be saved in: %1)", scriptsFolder), QLineEdit::Normal, KUrl(path).fileName(), &ok); if (!ok || scriptPath.isEmpty()) return; @@ -3834,7 +3841,7 @@ void MainWindow::slotShowTitleBars(bool show) if (!m_histogramDock->isFloating()) { m_histogramDock->setTitleBarWidget(new QWidget(this)); } - if(!m_notesDock->isFloating()) { + if (!m_notesDock->isFloating()) { m_notesDock->setTitleBarWidget(new QWidget(this)); } } diff --git a/src/mainwindow.h b/src/mainwindow.h index 5d723fa5..c27f7dee 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -475,6 +475,8 @@ private slots: void slotDeleteProjectClips(QStringList ids, QMap folderids); void slotShowTitleBars(bool show); void slotSwitchTitles(); + /** @brief Update the capture folder if user asked a change. */ + void slotUpdateCaptureFolder(); /** @brief Saves the widgets layout */ void slotSaveLayout(QAction*); diff --git a/src/recmonitor.cpp b/src/recmonitor.cpp index 6542c5fb..24cdd811 100644 --- a/src/recmonitor.cpp +++ b/src/recmonitor.cpp @@ -45,12 +45,12 @@ RecMonitor::RecMonitor(QString name, QWidget *parent) : - QWidget(parent), - m_name(name), - m_isActive(false), - m_isCapturing(false), - m_didCapture(false), - m_isPlaying(false) + QWidget(parent), + m_name(name), + m_isActive(false), + m_isCapturing(false), + m_didCapture(false), + m_isPlaying(false) { setupUi(this); @@ -160,15 +160,16 @@ void RecMonitor::slotConfigure() emit showConfigDialog(4, device_selector->currentIndex()); } -void RecMonitor::slotUpdateCaptureFolder() +void RecMonitor::slotUpdateCaptureFolder(const QString currentProjectFolder) { - if (m_captureProcess) m_captureProcess->setWorkingDirectory(KdenliveSettings::capturefolder()); + if (KdenliveSettings::capturetoprojectfolder()) m_capturePath = currentProjectFolder; + else m_capturePath = KdenliveSettings::capturefolder(); + if (m_captureProcess) m_captureProcess->setWorkingDirectory(m_capturePath); if (m_captureProcess->state() != QProcess::NotRunning) { if (device_selector->currentIndex() == FIREWIRE) KMessageBox::information(this, i18n("You need to disconnect and reconnect in the capture monitor to apply your changes"), i18n("Capturing")); else KMessageBox::information(this, i18n("You need to stop capture before your changes can be applied"), i18n("Capturing")); } else slotVideoDeviceChanged(device_selector->currentIndex()); - kDebug() << "// UPDATE CAPT FOLD: " << KdenliveSettings::capturefolder(); #if KDE_IS_VERSION(4,2,0) // update free space info @@ -191,7 +192,7 @@ void RecMonitor::slotVideoDeviceChanged(int ix) if (rmdpath.isEmpty()) video_frame->setPixmap(mergeSideBySide(KIcon("dialog-warning").pixmap(QSize(50, 50)), i18n("Recordmydesktop utility not found,\n please install it for screen grabs"))); else KdenliveSettings::setRmd_path(rmdpath); } - if (!KdenliveSettings::rmd_path().isEmpty()) video_frame->setPixmap(mergeSideBySide(KIcon("video-display").pixmap(QSize(50, 50)), i18n("Press record button\nto start screen capture\nFiles will be saved in:\n%1", KdenliveSettings::capturefolder()))); + if (!KdenliveSettings::rmd_path().isEmpty()) video_frame->setPixmap(mergeSideBySide(KIcon("video-display").pixmap(QSize(50, 50)), i18n("Press record button\nto start screen capture\nFiles will be saved in:\n%1", m_capturePath))); //video_frame->setText(i18n("Press record button\nto start screen capture")); break; case VIDEO4LINUX: @@ -218,7 +219,7 @@ void RecMonitor::slotVideoDeviceChanged(int ix) else KdenliveSettings::setDvgrab_path(dvgrabpath); } else { // Show capture info - QString capturefile = KdenliveSettings::capturefolder(); + QString capturefile = m_capturePath; if (!capturefile.endsWith("/")) capturefile.append("/"); QString capturename = KdenliveSettings::dvgrabfilename(); if (capturename.isEmpty()) capturename = "capture"; @@ -270,7 +271,7 @@ void RecMonitor::checkDeviceAvailability() video_frame->setPixmap(mergeSideBySide(KIcon("camera-web").pixmap(QSize(50, 50)), i18n("Cannot read from device %1\nPlease check drivers and access rights.", KdenliveSettings::video4vdevice()))); //video_frame->setText(i18n("Cannot read from device %1\nPlease check drivers and access rights.", KdenliveSettings::video4vdevice())); } else //video_frame->setText(i18n("Press play or record button\nto start video capture")); - video_frame->setPixmap(mergeSideBySide(KIcon("camera-web").pixmap(QSize(50, 50)), i18n("Press play or record button\nto start video capture\nFiles will be saved in:\n%1", KdenliveSettings::capturefolder()))); + video_frame->setPixmap(mergeSideBySide(KIcon("camera-web").pixmap(QSize(50, 50)), i18n("Press play or record button\nto start video capture\nFiles will be saved in:\n%1", m_capturePath))); } void RecMonitor::slotDisconnect() @@ -383,7 +384,7 @@ void RecMonitor::slotStartCapture(bool play) m_displayArgs << "-x" << QString::number(video_frame->width()) << "-y" << QString::number(video_frame->height()) << "-"; m_captureProcess->setStandardOutputProcess(m_displayProcess); - m_captureProcess->setWorkingDirectory(KdenliveSettings::capturefolder()); + m_captureProcess->setWorkingDirectory(m_capturePath); kDebug() << "Capture: Running dvgrab " << m_captureArgs.join(" "); m_captureProcess->start(KdenliveSettings::dvgrab_path(), m_captureArgs); @@ -453,11 +454,11 @@ void RecMonitor::slotRecord() QString extension = "mp4"; if (device_selector->currentIndex() == SCREENGRAB) extension = "ogv"; //KdenliveSettings::screengrabextension(); else if (device_selector->currentIndex() == VIDEO4LINUX) extension = KdenliveSettings::video4extension(); - QString path = KdenliveSettings::capturefolder() + "/capture0000." + extension; + QString path = m_capturePath + "/capture0000." + extension; int i = 1; while (QFile::exists(path)) { QString num = QString::number(i).rightJustified(4, '0', false); - path = KdenliveSettings::capturefolder() + "/capture" + num + '.' + extension; + path = m_capturePath + "/capture" + num + '.' + extension; i++; } m_captureFile = KUrl(path); @@ -597,7 +598,7 @@ void RecMonitor::slotProcessStatus(QProcess::ProcessState status) if (m_captureProcess->exitCode() != 0) { video_frame->setText(i18n("Capture crashed, please check your parameters\nRecordMyDesktop exit code: %1", QString::number(m_captureProcess->exitCode()))); } else { - video_frame->setPixmap(mergeSideBySide(KIcon("video-display").pixmap(QSize(50, 50)), i18n("Press record button\nto start screen capture\nFiles will be saved in:\n%1", KdenliveSettings::capturefolder()))); + video_frame->setPixmap(mergeSideBySide(KIcon("video-display").pixmap(QSize(50, 50)), i18n("Press record button\nto start screen capture\nFiles will be saved in:\n%1", m_capturePath))); } } } @@ -630,14 +631,14 @@ void RecMonitor::manageCapturedFiles() extension = ".m2t"; break; } - QDir dir(KdenliveSettings::capturefolder()); + QDir dir(m_capturePath); QStringList filters; QString capturename = KdenliveSettings::dvgrabfilename(); if (capturename.isEmpty()) capturename = "capture"; filters << capturename + "*" + extension; const QStringList result = dir.entryList(filters, QDir::Files, QDir::Time); KUrl::List capturedFiles; - foreach(const QString &name, result) { + foreach(const QString & name, result) { KUrl url = KUrl(dir.filePath(name)); if (KIO::NetAccess::exists(url, KIO::NetAccess::SourceSide, this)) { KFileItem file(KFileItem::Unknown, KFileItem::Unknown, url, true); @@ -651,7 +652,7 @@ void RecMonitor::manageCapturedFiles() ManageCapturesDialog *d = new ManageCapturesDialog(capturedFiles, this); if (d->exec() == QDialog::Accepted) { capturedFiles = d->importFiles(); - foreach(const KUrl &url, capturedFiles) { + foreach(const KUrl & url, capturedFiles) { emit addProjectClip(url); } } @@ -670,7 +671,7 @@ void RecMonitor::mousePressEvent(QMouseEvent * /*event*/) void RecMonitor::slotUpdateFreeSpace() { #if KDE_IS_VERSION(4,2,0) - KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo(KdenliveSettings::capturefolder()); + KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo(m_capturePath); if (info.isValid()) { m_freeSpace->setValue(100 * info.used() / info.size()); m_freeSpace->setText(i18n("Free space: %1", KIO::convertSize(info.available()))); diff --git a/src/recmonitor.h b/src/recmonitor.h index 1ab5b6e4..ad41b0ca 100644 --- a/src/recmonitor.h +++ b/src/recmonitor.h @@ -63,6 +63,7 @@ private: bool m_isActive; KDateTime m_captureTime; QLabel m_dvinfo; + QString m_capturePath; #if KDE_IS_VERSION(4,2,0) KCapacityBar *m_freeSpace; @@ -111,7 +112,7 @@ public slots: void start(); void activateRecMonitor(); void slotPlay(); - void slotUpdateCaptureFolder(); + void slotUpdateCaptureFolder(const QString currentProjectFolder); signals: void renderPosition(int); diff --git a/src/widgets/configenv_ui.ui b/src/widgets/configenv_ui.ui index 2b448004..b582b06c 100644 --- a/src/widgets/configenv_ui.ui +++ b/src/widgets/configenv_ui.ui @@ -1,58 +1,59 @@ - + + ConfigEnv_UI - - + + 0 0 - 365 - 240 + 380 + 225 - - - - + + + + Desktop search integration - - - + + + 0 - - + + MLT environment - - - - + + + + MLT profiles folder - - + + - - - + + + Melt path - - + + - - - + + + Qt::Vertical - + 20 40 @@ -62,47 +63,44 @@ - - + + Default folders - - - - + + + + Project folder - - + + - - - + + + Temporary files - - + + - - - + + + Capture folder - - - - - - + + + Qt::Vertical - + 20 40 @@ -110,82 +108,92 @@ + + + + Use project folder + + + + + + - - + + Default apps - - - - + + + + Image editing - - - + + + true - - - + + + Change - - - + + + Audio editing - - - + + + true - - - + + + Change - - - + + + Video player - - - + + + true - - - + + + Change - - - + + + Qt::Vertical - + 20 40 @@ -201,9 +209,9 @@ - KLineEdit - QLineEdit -
klineedit.h
+ KUrlRequester + QFrame +
kurlrequester.h
KPushButton @@ -211,9 +219,9 @@
kpushbutton.h
- KUrlRequester - QFrame -
kurlrequester.h
+ KLineEdit + QLineEdit +
klineedit.h