From 4711a4a809d3bde112e697686b8b50ab2f2c836b Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Sat, 12 Sep 2009 21:48:27 +0000 Subject: [PATCH] Correctly use plural in i18n calls, add warning message when user wants to change the project profile svn path=/trunk/kdenlive/; revision=3888 --- src/clipproperties.cpp | 2 +- src/customtrackview.cpp | 21 ++++++++++--- src/documentchecker.cpp | 2 +- src/mainwindow.cpp | 9 +++--- src/projectlist.cpp | 2 +- src/projectsettings.cpp | 70 +++++++++++++++++++++++------------------ src/projectsettings.h | 9 ++++-- src/renderer.cpp | 2 +- src/slideshowclip.cpp | 2 +- 9 files changed, 71 insertions(+), 48 deletions(-) diff --git a/src/clipproperties.cpp b/src/clipproperties.cpp index a050aa76..728f6bd0 100644 --- a/src/clipproperties.cpp +++ b/src/clipproperties.cpp @@ -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(); diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 4e09e1bb..c262c9cd 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -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 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 children = itemList.at(i)->childItems(); itemList += children; QList 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 (itemList.at(i)); if (item->parentItem()) resetGroup = true; //kDebug()<<"// DELETE CLP AT: "<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 (itemList.at(i)); //kDebug()<<"// DELETE TRANS AT: "<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); } diff --git a/src/documentchecker.cpp b/src/documentchecker.cpp index ef8e5bb5..96af5e68 100644 --- a/src/documentchecker.cpp +++ b/src/documentchecker.cpp @@ -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); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 005ed0e6..ad836cad 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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(); } diff --git a/src/projectlist.cpp b/src/projectlist.cpp index 1f173bef..44583f76 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -395,7 +395,7 @@ void ProjectList::slotRemoveClip() if (KMessageBox::questionYesNo(this, i18np("Delete clip %2?
This will also remove the clip in timeline", "Delete clip %2?
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 %2?
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 %2?
This will also remove the clip in that folder", "Delete folder %2?
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 (item->child(i)); ids << child->clipId(); diff --git a/src/projectsettings.cpp b/src/projectsettings.cpp index c27f5398..bfd839da 100644 --- a/src/projectsettings.cpp +++ b/src/projectsettings.cpp @@ -22,58 +22,66 @@ #include "profilesdialog.h" #include +#include #include #include +#include -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 profilesInfo = ProfilesDialog::getProfilesInfo(); QMapIterator 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" diff --git a/src/projectsettings.h b/src/projectsettings.h index 28053ba3..b86e2a73 100644 --- a/src/projectsettings.h +++ b/src/projectsettings.h @@ -26,25 +26,28 @@ #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; }; diff --git a/src/renderer.cpp b/src/renderer.cpp index 7d535b85..153ff140 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -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(); } diff --git a/src/slideshowclip.cpp b/src/slideshowclip.cpp index 6a674af2..26028f2a 100644 --- a/src/slideshowclip.cpp +++ b/src/slideshowclip.cpp @@ -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"); -- 2.39.2