]> git.sesse.net Git - kdenlive/commitdiff
File extension is now added automatically when the user selects a file in the file...
authorSimon A. Eugster <simon.eu@gmail.com>
Mon, 26 Jan 2009 20:38:13 +0000 (20:38 +0000)
committerSimon A. Eugster <simon.eu@gmail.com>
Mon, 26 Jan 2009 20:38:13 +0000 (20:38 +0000)
svn path=/branches/KDE4/; revision=2979

src/renderwidget.cpp
src/renderwidget.h

index 6a4200f369a2794c5df763c177fad0b966109f26..b20557b1cca1d426c8b7b11d303ec3c2e988ac94 100644 (file)
@@ -74,6 +74,7 @@ RenderWidget::RenderWidget(QWidget * parent): QDialog(parent) {
     connect(m_view.rescale, SIGNAL(toggled(bool)), m_view.rescale_size, SLOT(setEnabled(bool)));
     connect(m_view.destination_list, SIGNAL(activated(int)), this, SLOT(refreshView()));
     connect(m_view.out_file, SIGNAL(textChanged(const QString &)), this, SLOT(slotUpdateButtons()));
+    connect(m_view.out_file, SIGNAL(urlSelected(const KUrl &)), this, SLOT(slotUpdateButtons(const KUrl &)));
     connect(m_view.format_list, SIGNAL(currentRowChanged(int)), this, SLOT(refreshView()));
     connect(m_view.size_list, SIGNAL(currentRowChanged(int)), this, SLOT(refreshParams()));
 
@@ -157,16 +158,24 @@ void RenderWidget::setGuides(QDomElement guidesxml, double duration) {
         m_view.guide_end->addItem(i18n("End"), QString::number(duration));
 }
 
+// Will be called when the user selects an output file via the file dialog.
+// File extension will be added automatically.
+void RenderWidget::slotUpdateButtons(KUrl url) {
+    if (m_view.out_file->url().isEmpty()) m_view.buttonStart->setEnabled(false);
+    else m_view.buttonStart->setEnabled(true); 
+    if (url != 0) {
+       QListWidgetItem *item = m_view.size_list->currentItem();
+       QString extension = item->data(ExtensionRole).toString();
+       url = filenameWithExtension(url, extension);
+       m_view.out_file->setUrl(url);
+    }
+}
+
+// Will be called when the user changes the output file path in the text line. 
+// File extension must NOT be added, would make editing impossible!
 void RenderWidget::slotUpdateButtons() {
     if (m_view.out_file->url().isEmpty()) m_view.buttonStart->setEnabled(false);
-    else m_view.buttonStart->setEnabled(true);
-    KUrl url = m_view.out_file->url();
-    QListWidgetItem *item = m_view.size_list->currentItem();
-    QString extension = item->data(ExtensionRole).toString();
-    url = filenameWithExtension(url, extension);
-    kDebug() << "URL SHOULD BE " << url.path();
-    //m_view.out_file->setUrl(url);
-    // not possible here; key input wouldn't be possible anymore
+    else m_view.buttonStart->setEnabled(true); 
 }
 
 void RenderWidget::slotSaveProfile() {
index c3759c87f38fc4b1e7ae061326f1cfa2dafcc6e6..d4a86e3a3746903e40fd7ea970e133a49cec2a2d 100644 (file)
@@ -76,6 +76,7 @@ public:
     void setRenderStatus(const QString &dest, int status, const QString &error);
 
 private slots:
+    void slotUpdateButtons(KUrl url);
     void slotUpdateButtons();
     void slotExport();
     void refreshView();