]> git.sesse.net Git - kdenlive/commitdiff
Correctly use plural in i18n calls, add warning message when user wants to change...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 12 Sep 2009 21:48:27 +0000 (21:48 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 12 Sep 2009 21:48:27 +0000 (21:48 +0000)
svn path=/trunk/kdenlive/; revision=3888

src/clipproperties.cpp
src/customtrackview.cpp
src/documentchecker.cpp
src/mainwindow.cpp
src/projectlist.cpp
src/projectsettings.cpp
src/projectsettings.h
src/renderer.cpp
src/slideshowclip.cpp

index a050aa76768d7c7d22eeba713fb3cbf029894ae6..728f6bd0c0666f4f1222e050b4e54b6c36eb8502 100644 (file)
@@ -499,7 +499,7 @@ void ClipProperties::parseFolder()
     dir.setNameFilters(filters);
     QStringList result = dir.entryList(QDir::Files);
     m_count = result.count();
-    m_view.slide_info->setText(i18n("%1 images found", m_count));
+    m_view.slide_info->setText(i18np("1 image found", "%1 images found", m_count));
     QDomElement xml = m_clip->toXML();
     xml.setAttribute("resource", m_view.clip_path->text() + extension);
     int width = 180.0 * KdenliveSettings::project_display_ratio();
index 4e09e1bb316e2a0dc7ce51dde2cdb419ee1b5228..c262c9cdc1dd0aa0f37c3254ab8e27feec04cf83 100644 (file)
@@ -2197,7 +2197,7 @@ void CustomTrackView::slotRemoveSpace()
     int length = m_document->renderer()->mltGetSpaceLength(pos, m_document->tracksCount() - track, true);
     //kDebug() << "// GOT LENGT; " << length;
     if (length <= 0) {
-        emit displayMessage(i18n("You must be in an empty space to remove space (time=%1, track:%2)", m_document->timecode().getTimecodeFromFrames(mapToScene(m_menuPosition).x()), track), ErrorMessage);
+        emit displayMessage(i18n("You must be in an empty space to remove space (time%1, track:%2)", m_document->timecode().getTimecodeFromFrames(mapToScene(m_menuPosition).x()), track), ErrorMessage);
         return;
     }
 
@@ -2343,7 +2343,6 @@ void CustomTrackView::deleteClip(const QString &clipId)
     resetSelectionGroup();
     QList<QGraphicsItem *> itemList = items();
     QUndoCommand *deleteCommand = new QUndoCommand();
-    deleteCommand->setText(i18n("Delete timeline clips"));
     int count = 0;
     for (int i = 0; i < itemList.count(); i++) {
         if (itemList.at(i)->type() == AVWIDGET) {
@@ -2358,6 +2357,7 @@ void CustomTrackView::deleteClip(const QString &clipId)
             }
         }
     }
+    deleteCommand->setText(i18np("Delete timeline clip", "Delete timeline clips", count));
     if (count == 0) delete deleteCommand;
     else m_commandStack->push(deleteCommand);
 }
@@ -3030,12 +3030,15 @@ void CustomTrackView::deleteSelectedClips()
     }
     scene()->clearSelection();
     QUndoCommand *deleteSelected = new QUndoCommand();
-    deleteSelected->setText(i18n("Delete selected items"));
-    bool resetGroup = false;
 
+    bool resetGroup = false;
+    int groupCount = 0;
+    int clipCount = 0;
+    int transitionCount = 0;
     // expand & destroy groups
     for (int i = 0; i < itemList.count(); i++) {
         if (itemList.at(i)->type() == GROUPWIDGET) {
+            groupCount++;
             QList<QGraphicsItem *> children = itemList.at(i)->childItems();
             itemList += children;
             QList <ItemInfo> clipInfos;
@@ -3058,12 +3061,14 @@ void CustomTrackView::deleteSelectedClips()
 
     for (int i = 0; i < itemList.count(); i++) {
         if (itemList.at(i)->type() == AVWIDGET) {
+            clipCount++;
             ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
             if (item->parentItem()) resetGroup = true;
             //kDebug()<<"// DELETE CLP AT: "<<item->info().startPos.frames(25);
             new AddTimelineClipCommand(this, item->xml(), item->clipProducer(), item->info(), item->effectList(), true, true, deleteSelected);
             emit clipItemSelected(NULL);
         } else if (itemList.at(i)->type() == TRANSITIONWIDGET) {
+            transitionCount++;
             Transition *item = static_cast <Transition *>(itemList.at(i));
             //kDebug()<<"// DELETE TRANS AT: "<<item->info().startPos.frames(25);
             if (item->parentItem()) resetGroup = true;
@@ -3071,7 +3076,13 @@ void CustomTrackView::deleteSelectedClips()
             emit transitionItemSelected(NULL);
         }
     }
-
+    if (groupCount > 0 && clipCount == transitionCount == 0)
+        deleteSelected->setText(i18np("Delete selected group", "Delete selected groups", groupCount));
+    else if (clipCount > 0 && groupCount == transitionCount == 0)
+        deleteSelected->setText(i18np("Delete selected clip", "Delete selected clips", clipCount));
+    else if (transitionCount > 0 && groupCount == clipCount == 0)
+        deleteSelected->setText(i18np("Delete selected transition", "Delete selected transitions", transitionCount));
+    else deleteSelected->setText(i18n("Delete selected items"));
     m_commandStack->push(deleteSelected);
 }
 
index ef8e5bb54a590d95c2370ea5343730cf1cc6fbac..96af5e687d751ab33915dcfea4366fa3109a3a4c 100644 (file)
@@ -347,7 +347,7 @@ void DocumentChecker::checkStatus()
 
 void DocumentChecker::slotDeleteSelected()
 {
-    if (KMessageBox::warningContinueCancel(this, i18n("This will remove the selected clips from this project"), i18n("Remove clips")) == KMessageBox::Cancel) return;
+    if (KMessageBox::warningContinueCancel(this, i18np("This will remove the selected clip from this project", "This will remove the selected clips from this project", treeWidget->selectedItems().count()), i18n("Remove clips")) == KMessageBox::Cancel) return;
     int ix = 0;
     QStringList deletedIds;
     QTreeWidgetItem *child = treeWidget->topLevelItem(ix);
index 005ed0e61a625f444038803c6a7f692c11c5d21d..ad836cad8081c29c4a4b0494a4238b69cff9e431 100644 (file)
@@ -412,7 +412,7 @@ bool MainWindow::queryClose()
     if (m_renderWidget) {
         int waitingJobs = m_renderWidget->waitingJobsCount();
         if (waitingJobs > 0) {
-            switch (KMessageBox::warningYesNoCancel(this, i18n("You have %1 rendering jobs waiting in the queue.\nWhat do you want to do with these jobs?", waitingJobs), QString(), KGuiItem(i18n("Start them now")), KGuiItem(i18n("Delete them")))) {
+            switch (KMessageBox::warningYesNoCancel(this, i18np("You have 1 rendering job waiting in the queue.\nWhat do you want to do with this job?", "You have %1 rendering jobs waiting in the queue.\nWhat do you want to do with these jobs?", waitingJobs), QString(), KGuiItem(i18n("Start them now")), KGuiItem(i18n("Delete them")))) {
             case KMessageBox::Yes :
                 // create script with waiting jobs and start it
                 if (m_renderWidget->startWaitingRenderJobs() == false) return false;
@@ -1255,7 +1255,7 @@ void MainWindow::newFile(bool showProjectSettings)
         profileName = KdenliveSettings::default_profile();
         projectFolder = KdenliveSettings::defaultprojectfolder();
     } else {
-        ProjectSettings *w = new ProjectSettings(projectTracks.x(), projectTracks.y(), KdenliveSettings::defaultprojectfolder(), false, this);
+        ProjectSettings *w = new ProjectSettings(projectTracks.x(), projectTracks.y(), KdenliveSettings::defaultprojectfolder(), false, true, this);
         if (w->exec() != QDialog::Accepted) return;
         if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
         KdenliveSettings::setVideothumbnails(w->enableVideoThumbs());
@@ -1613,7 +1613,7 @@ void MainWindow::slotDetectAudioDriver()
 void MainWindow::slotEditProjectSettings()
 {
     QPoint p = m_activeDocument->getTracksCount();
-    ProjectSettings *w = new ProjectSettings(p.x(), p.y(), m_activeDocument->projectFolder().path(), true, this);
+    ProjectSettings *w = new ProjectSettings(p.x(), p.y(), m_activeDocument->projectFolder().path(), true, !m_activeDocument->isModified(), this);
 
     if (w->exec() == QDialog::Accepted) {
         QString profile = w->selectedProfile();
@@ -1642,7 +1642,8 @@ void MainWindow::slotEditProjectSettings()
             //m_activeDocument->clipManager()->resetProducersList(m_projectMonitor->render->producersList());
             if (dar != m_activeDocument->dar()) m_projectList->reloadClipThumbnails();
             if (updateFps) m_activeTimeline->updateProjectFps();
-
+            m_activeDocument->setModified(true);
+            m_commandStack->activeStack()->clear();
             // We need to desactivate & reactivate monitors to get a refresh
             //m_monitorManager->switchMonitors();
         }
index 1f173bef57a7f4986aa7db0261fb3eb3bf748557..44583f763c1ed9a25c422abe875ea258bd744013 100644 (file)
@@ -395,7 +395,7 @@ void ProjectList::slotRemoveClip()
             if (KMessageBox::questionYesNo(this, i18np("Delete clip <b>%2</b>?<br>This will also remove the clip in timeline", "Delete clip <b>%2</b>?<br>This will also remove its %1 clips in timeline", item->numReferences(), item->names().at(1)), i18n("Delete Clip")) != KMessageBox::Yes) return;
         } else if (item->isGroup() && item->childCount() > 0) {
             int children = item->childCount();
-            if (KMessageBox::questionYesNo(this, i18n("Delete folder <b>%2</b>?<br>This will also remove the %1 clips in that folder", children, item->names().at(1)), i18n("Delete Folder")) != KMessageBox::Yes) return;
+            if (KMessageBox::questionYesNo(this, i18np("Delete folder <b>%2</b>?<br>This will also remove the clip in that folder", "Delete folder <b>%2</b>?<br>This will also remove the %1 clips in that folder",  children, item->names().at(1)), i18n("Delete Folder")) != KMessageBox::Yes) return;
             for (int i = 0; i < children; ++i) {
                 ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
                 ids << child->clipId();
index c27f5398f4cde32adf96f4f9274d3fb762e09a91..bfd839da1ff3fada1bb2e874f6332623d66a1c6e 100644 (file)
 #include "profilesdialog.h"
 
 #include <KStandardDirs>
+#include <KMessageBox>
 #include <KDebug>
 
 #include <QDir>
+#include <kmessagebox.h>
 
-ProjectSettings::ProjectSettings(int videotracks, int audiotracks, const QString projectPath, bool readOnlyTracks, QWidget * parent) :
-        QDialog(parent)
+ProjectSettings::ProjectSettings(int videotracks, int audiotracks, const QString projectPath, bool readOnlyTracks, bool savedProject, QWidget * parent) :
+        QDialog(parent), m_savedProject(savedProject)
 {
-    m_view.setupUi(this);
+    setupUi(this);
 
     QMap <QString, QString> profilesInfo = ProfilesDialog::getProfilesInfo();
     QMapIterator<QString, QString> i(profilesInfo);
     while (i.hasNext()) {
         i.next();
-        m_view.profiles_list->addItem(i.key(), i.value());
+        profiles_list->addItem(i.key(), i.value());
     }
-    m_view.project_folder->setMode(KFile::Directory);
-    m_view.project_folder->setPath(projectPath);
+    project_folder->setMode(KFile::Directory);
+    project_folder->setUrl(KUrl(projectPath));
     QString currentProf = KdenliveSettings::current_profile();
 
-    for (int i = 0; i < m_view.profiles_list->count(); i++) {
-        if (m_view.profiles_list->itemData(i).toString() == currentProf) {
-            m_view.profiles_list->setCurrentIndex(i);
+    for (int i = 0; i < profiles_list->count(); i++) {
+        if (profiles_list->itemData(i).toString() == currentProf) {
+            profiles_list->setCurrentIndex(i);
             break;
         }
     }
 
-    m_buttonOk = m_view.buttonBox->button(QDialogButtonBox::Ok);
+    m_buttonOk = buttonBox->button(QDialogButtonBox::Ok);
     //buttonOk->setEnabled(false);
-    m_view.audio_thumbs->setChecked(KdenliveSettings::audiothumbnails());
-    m_view.video_thumbs->setChecked(KdenliveSettings::videothumbnails());
-    m_view.audio_tracks->setValue(audiotracks);
-    m_view.video_tracks->setValue(videotracks);
+    audio_thumbs->setChecked(KdenliveSettings::audiothumbnails());
+    video_thumbs->setChecked(KdenliveSettings::videothumbnails());
+    audio_tracks->setValue(audiotracks);
+    video_tracks->setValue(videotracks);
     if (readOnlyTracks) {
-        m_view.video_tracks->setEnabled(false);
-        m_view.audio_tracks->setEnabled(false);
+        video_tracks->setEnabled(false);
+        audio_tracks->setEnabled(false);
     }
     slotUpdateDisplay();
-    connect(m_view.profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
-    connect(m_view.project_folder, SIGNAL(textChanged(const QString &)), this, SLOT(slotUpdateButton(const QString &)));
+    connect(profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
+    connect(project_folder, SIGNAL(textChanged(const QString &)), this, SLOT(slotUpdateButton(const QString &)));
 }
 
+void ProjectSettings::accept()
+{
+    if (!m_savedProject && selectedProfile() != KdenliveSettings::current_profile())
+        if (KMessageBox::warningContinueCancel(this, i18n("Changing the profile of your project cannot be undone.\nIt is recommended to save your project before attempting this operation that might cause some corruption in transitions.\n Are you sure you want to proceed?"), i18n("Confirm profile change")) == KMessageBox::Cancel) return;
+    QDialog::accept();
+}
 
 void ProjectSettings::slotUpdateDisplay()
 {
-    QString currentProfile = m_view.profiles_list->itemData(m_view.profiles_list->currentIndex()).toString();
+    QString currentProfile = profiles_list->itemData(profiles_list->currentIndex()).toString();
     QMap< QString, QString > values = ProfilesDialog::getSettingsFromFile(currentProfile);
-    m_view.p_size->setText(values.value("width") + 'x' + values.value("height"));
-    m_view.p_fps->setText(values.value("frame_rate_num") + '/' + values.value("frame_rate_den"));
-    m_view.p_aspect->setText(values.value("sample_aspect_num") + '/' + values.value("sample_aspect_den"));
-    m_view.p_display->setText(values.value("display_aspect_num") + '/' + values.value("display_aspect_den"));
-    if (values.value("progressive").toInt() == 0) m_view.p_progressive->setText(i18n("Interlaced"));
-    else m_view.p_progressive->setText(i18n("Progressive"));
+    p_size->setText(values.value("width") + 'x' + values.value("height"));
+    p_fps->setText(values.value("frame_rate_num") + '/' + values.value("frame_rate_den"));
+    p_aspect->setText(values.value("sample_aspect_num") + '/' + values.value("sample_aspect_den"));
+    p_display->setText(values.value("display_aspect_num") + '/' + values.value("display_aspect_den"));
+    if (values.value("progressive").toInt() == 0) p_progressive->setText(i18n("Interlaced"));
+    else p_progressive->setText(i18n("Progressive"));
 }
 
 void ProjectSettings::slotUpdateButton(const QString &path)
@@ -84,30 +92,30 @@ void ProjectSettings::slotUpdateButton(const QString &path)
 
 QString ProjectSettings::selectedProfile() const
 {
-    return m_view.profiles_list->itemData(m_view.profiles_list->currentIndex()).toString();
+    return profiles_list->itemData(profiles_list->currentIndex()).toString();
 }
 
 KUrl ProjectSettings::selectedFolder() const
 {
-    return m_view.project_folder->url();
+    return project_folder->url();
 }
 
 QPoint ProjectSettings::tracks()
 {
     QPoint p;
-    p.setX(m_view.video_tracks->value());
-    p.setY(m_view.audio_tracks->value());
+    p.setX(video_tracks->value());
+    p.setY(audio_tracks->value());
     return p;
 }
 
 bool ProjectSettings::enableVideoThumbs() const
 {
-    return m_view.video_thumbs->isChecked();
+    return video_thumbs->isChecked();
 }
 
 bool ProjectSettings::enableAudioThumbs() const
 {
-    return m_view.audio_thumbs->isChecked();
+    return audio_thumbs->isChecked();
 }
 
 #include "projectsettings.moc"
index 28053ba32c0f2b2d7b333345a4cf8bf2b63dd802..b86e2a737e3200ec360d8f0560c03288c0a623f4 100644 (file)
 
 #include "ui_projectsettings_ui.h"
 
-class ProjectSettings : public QDialog
+class ProjectSettings : public QDialog, public Ui::ProjectSettings_UI
 {
     Q_OBJECT
 
 public:
-    ProjectSettings(int videotracks, int audiotracks, const QString projectPath, bool readOnlyTracks, QWidget * parent = 0);
+    ProjectSettings(int videotracks, int audiotracks, const QString projectPath, bool readOnlyTracks, bool unsavedProject, QWidget * parent = 0);
     QString selectedProfile() const;
     KUrl selectedFolder() const;
     QPoint tracks();
     bool enableVideoThumbs() const;
     bool enableAudioThumbs() const;
 
+public slots:
+    virtual void accept();
+
 private slots:
     void slotUpdateDisplay();
     void slotUpdateButton(const QString &path);
 
 private:
-    Ui::ProjectSettings_UI m_view;
     QPushButton *m_buttonOk;
+    bool m_savedProject;
 };
 
 
index 7d535b855d0589d523abe500117e9b03775593b4..153ff140f9f789c013fe850eeb3d3fab81ae6465 100644 (file)
@@ -3451,7 +3451,7 @@ QString Render::updateSceneListFps(double current_fps, double new_fps, QString s
     tractor.setAttribute("out", out);
     emit durationChanged(out);
 
-    kDebug() << "///////////////////////////// " << out << " \n" << doc.toString() << "\n-------------------------";
+    //kDebug() << "///////////////////////////// " << out << " \n" << doc.toString() << "\n-------------------------";
     return doc.toString();
 }
 
index 6a674af2bf2b3af9ccc9809dac115251191d7e0a..26028f2abc6cad1c194bceb5c362ad93441c3bd5 100644 (file)
@@ -127,7 +127,7 @@ void SlideshowClip::parseFolder()
     m_count = result.count();
     if (m_count == 0) m_view.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
     else m_view.buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
-    m_view.label_info->setText(i18n("%1 images found", m_count));
+    m_view.label_info->setText(i18np("1 image found", "%1 images found", m_count));
     QListWidgetItem *item;
     int i = 0;
     KIcon unknownicon("unknown");