m_view.buttonInfo->setIcon(KIcon("help-about"));
m_view.hide_log->setIcon(KIcon("go-down"));
+ m_view.buttonFavorite->setIcon(KIcon("favorites"));
+ m_view.buttonFavorite->setToolTip(i18n("Copy profile to favorites"));
+
if (KdenliveSettings::showrenderparams()) {
m_view.buttonInfo->setDown(true);
} else m_view.advanced_params->hide();
connect(m_view.buttonSave, SIGNAL(clicked()), this, SLOT(slotSaveProfile()));
connect(m_view.buttonEdit, SIGNAL(clicked()), this, SLOT(slotEditProfile()));
connect(m_view.buttonDelete, SIGNAL(clicked()), this, SLOT(slotDeleteProfile()));
+ connect(m_view.buttonFavorite, SIGNAL(clicked()), this, SLOT(slotCopyToFavorites()));
+
connect(m_view.abort_job, SIGNAL(clicked()), this, SLOT(slotAbortCurrentJob()));
connect(m_view.start_job, SIGNAL(clicked()), this, SLOT(slotStartCurrentJob()));
connect(m_view.clean_up, SIGNAL(clicked()), this, SLOT(slotCLeanUpJobs()));
ui.profile_name->setFocus();
if (d->exec() == QDialog::Accepted && !ui.profile_name->text().simplified().isEmpty()) {
- QString exportFile = KStandardDirs::locateLocal("appdata", "export/customprofiles.xml");
+ QString newProfileName = ui.profile_name->text().simplified();
+ QString newGroupName = ui.group_name->text().simplified();
+ if (newGroupName.isEmpty()) newGroupName = i18n("Custom");
+ QString newMetaGroupId = ui.destination_list->itemData(ui.destination_list->currentIndex(), Qt::UserRole).toString();
+
+ QDomDocument doc;
+ QDomElement profileElement = doc.createElement("profile");
+ profileElement.setAttribute("name", newProfileName);
+ profileElement.setAttribute("category", newGroupName);
+ profileElement.setAttribute("destinationid", newMetaGroupId);
+ profileElement.setAttribute("extension", ui.extension->text().simplified());
+ profileElement.setAttribute("args", ui.parameters->toPlainText().simplified());
+ doc.appendChild(profileElement);
+ saveProfile(doc.documentElement());
+
+ parseProfiles(newMetaGroupId, newGroupName, newProfileName);
+ }
+ delete d;
+}
+
+
+void RenderWidget::saveProfile(QDomElement newprofile)
+{
+ QString exportFile = KStandardDirs::locateLocal("appdata", "export/customprofiles.xml");
QDomDocument doc;
QFile file(exportFile);
doc.setContent(&file, false);
doc.appendChild(profiles);
}
- QString newProfileName = ui.profile_name->text().simplified();
- QString newGroupName = ui.group_name->text().simplified();
- if (newGroupName.isEmpty()) newGroupName = i18n("Custom");
- QString newMetaGroupId = ui.destination_list->itemData(ui.destination_list->currentIndex(), Qt::UserRole).toString();
+
QDomNodeList profilelist = doc.elementsByTagName("profile");
int i = 0;
while (!profilelist.item(i).isNull()) {
// make sure a profile with same name doesn't exist
documentElement = profilelist.item(i).toElement();
QString profileName = documentElement.attribute("name");
- if (profileName == newProfileName) {
+ if (profileName == newprofile.attribute("name")) {
// a profile with that same name already exists
bool ok;
- newProfileName = QInputDialog::getText(this, i18n("Profile already exists"), i18n("This profile name already exists. Change the name if you don't want to overwrite it."), QLineEdit::Normal, newProfileName, &ok);
+ QString newProfileName = QInputDialog::getText(this, i18n("Profile already exists"), i18n("This profile name already exists. Change the name if you don't want to overwrite it."), QLineEdit::Normal, profileName, &ok);
if (!ok) return;
if (profileName == newProfileName) {
profiles.removeChild(profilelist.item(i));
i++;
}
- QDomElement profileElement = doc.createElement("profile");
- profileElement.setAttribute("name", newProfileName);
- profileElement.setAttribute("category", newGroupName);
- profileElement.setAttribute("destinationid", newMetaGroupId);
- profileElement.setAttribute("extension", ui.extension->text().simplified());
- profileElement.setAttribute("args", ui.parameters->toPlainText().simplified());
- profiles.appendChild(profileElement);
+ profiles.appendChild(newprofile);
//QCString save = doc.toString().utf8();
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) {
KMessageBox::sorry(this, i18n("Unable to write to file %1", exportFile));
- delete d;
return;
}
QTextStream out(&file);
if (file.error() != QFile::NoError) {
KMessageBox::error(this, i18n("Cannot write to file %1", exportFile));
file.close();
- delete d;
return;
}
file.close();
- parseProfiles(newMetaGroupId, newGroupName, newProfileName);
- }
- delete d;
+}
+
+void RenderWidget::slotCopyToFavorites()
+{
+ QListWidgetItem *item = m_view.size_list->currentItem();
+ if (!item) return;
+ QString currentGroup = m_view.format_list->currentItem()->text();
+
+ QString params = item->data(ParamsRole).toString();
+ QString extension = item->data(ExtensionRole).toString();
+ QString currentProfile = item->text();
+ QDomDocument doc;
+ QDomElement profileElement = doc.createElement("profile");
+ profileElement.setAttribute("name", currentProfile);
+ profileElement.setAttribute("category", i18n("Custom"));
+ profileElement.setAttribute("destinationid", "favorites");
+ profileElement.setAttribute("extension", extension);
+ profileElement.setAttribute("args", params);
+ doc.appendChild(profileElement);
+ saveProfile(doc.documentElement());
+ parseProfiles(m_view.destination_list->itemData(m_view.destination_list->currentIndex(), Qt::UserRole).toString(), currentGroup, currentProfile);
}
void RenderWidget::slotEditProfile()
if (item->data(1, Qt::UserRole + 2).toInt() == WAITINGJOB) {
item->setData(1, Qt::UserRole + 1, QTime::currentTime());
waitingJob = true;
- startRendering(item);
+ startRendering(item);
break;
}
item = m_view.running_jobs->itemBelow(item);
void RenderWidget::startRendering(QTreeWidgetItem *item)
{
if (item->data(1, Qt::UserRole + 4).isNull()) {
- // Normal render process
- if (QProcess::startDetached(m_renderer, item->data(1, Qt::UserRole + 3).toStringList()) == false) {
- item->setData(1, Qt::UserRole + 2, FINISHEDJOB);
- item->setData(1, Qt::UserRole, i18n("Rendering crashed"));
- item->setIcon(0, KIcon("dialog-close"));
- item->setData(2, Qt::UserRole, 100);
+ // Normal render process
+ if (QProcess::startDetached(m_renderer, item->data(1, Qt::UserRole + 3).toStringList()) == false) {
+ item->setData(1, Qt::UserRole + 2, FINISHEDJOB);
+ item->setData(1, Qt::UserRole, i18n("Rendering crashed"));
+ item->setIcon(0, KIcon("dialog-close"));
+ item->setData(2, Qt::UserRole, 100);
} else KNotification::event("RenderStarted", i18n("Rendering <i>%1</i> started", item->text(1)), QPixmap(), this);
} else {
- // Script item
+ // Script item
if (QProcess::startDetached(item->data(1, Qt::UserRole + 3).toString()) == false) {
- item->setData(1, Qt::UserRole + 2, FINISHEDJOB);
+ item->setData(1, Qt::UserRole + 2, FINISHEDJOB);
item->setData(1, Qt::UserRole, i18n("Rendering crashed"));
item->setIcon(0, KIcon("dialog-close"));
item->setData(2, Qt::UserRole, 100);
m_view.format_list->clear();
m_view.destination_list->clear();
m_view.destination_list->addItem(KIcon("video-x-generic"), i18n("File rendering"));
+ m_view.destination_list->addItem(KIcon("favorites"), i18n("Favorites"), "favorites");
m_view.destination_list->addItem(KIcon("media-optical"), i18n("DVD"), "dvd");
m_view.destination_list->addItem(KIcon("audio-x-generic"), i18n("Audio only"), "audioonly");
m_view.destination_list->addItem(KIcon("applications-internet"), i18n("Web sites"), "websites");
{
QTreeWidgetItem *current = m_view.running_jobs->currentItem();
if (current && current->data(1, Qt::UserRole + 2).toInt() == WAITINGJOB)
- startRendering(current);
+ startRendering(current);
m_view.start_job->setEnabled(false);
}
if (current) {
if (current->data(1, Qt::UserRole + 2).toInt() == RUNNINGJOB) {
m_view.abort_job->setText(i18n("Abort Job"));
- m_view.start_job->setEnabled(false);
- }
- else {
- m_view.abort_job->setText(i18n("Remove Job"));
- m_view.start_job->setEnabled(current->data(1, Qt::UserRole + 2).toInt() == WAITINGJOB);
- }
+ m_view.start_job->setEnabled(false);
+ } else {
+ m_view.abort_job->setText(i18n("Remove Job"));
+ m_view.start_job->setEnabled(current->data(1, Qt::UserRole + 2).toInt() == WAITINGJOB);
+ }
activate = true;
}
m_view.abort_job->setEnabled(activate);