Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Start of project settings dialog

svn path=/branches/KDE4/; revision=1877
parent 577212ad
......@@ -28,6 +28,7 @@ kde4_add_ui_files(kdenlive_UI
widgets/effectlist_ui.ui
widgets/effectstack_ui.ui
widgets/profiledialog_ui.ui
widgets/projectsettings_ui.ui
)
set(kdenlive_SRCS
......@@ -68,7 +69,8 @@ set(kdenlive_SRCS
addeffectcommand.cpp
effectstackview.cpp
parameterplotter.cpp
profilesdialog.cpp
projectsettings.cpp
)
kde4_add_kcfg_files(kdenlive_SRCS GENERATE_MOC kdenlivesettings.kcfgc )
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<gui name="kdenlive" version="7">
<gui name="kdenlive" version="8">
<ToolBar name="extraToolBar" >
<text>Extra Toolbar</text>
<Action name="clear" />
......@@ -12,7 +12,7 @@
</Menu>
<Menu name="project" ><text>Project</text>
<Action name="clear" />
<Action name="project_settings" />
</Menu>
<Menu name="settings" >
......
......@@ -49,7 +49,8 @@
#include "ui_configmisc_ui.h"
#include "ui_configenv_ui.h"
#include "initeffects.h"
#include "ui_profiledialog_ui.h"
#include "profilesdialog.h"
#include "projectsettings.h"
#define ID_STATUS_MSG 1
#define ID_EDITMODE_MSG 2
......@@ -225,6 +226,14 @@ void MainWindow::setupActions()
profilesAction->setIcon(KIcon("document-new"));
actionCollection()->addAction("manage_profiles", profilesAction);
connect(profilesAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProfiles()));
KAction* projectAction = new KAction(this);
projectAction->setText(i18n("Project Settings"));
projectAction->setIcon(KIcon("document-new"));
actionCollection()->addAction("project_settings", projectAction);
connect(projectAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProjectSettings()));
KStandardAction::quit(kapp, SLOT(quit()),
actionCollection());
......@@ -387,31 +396,21 @@ void MainWindow::parseProfiles()
// Parse MLT profiles to build a list of available video formats
if (profilesList.isEmpty()) parseProfiles();
/*
uint i = 0;
for (; i < profilesList.count(); i++) {
KConfig confFile(profilePath + *profilesList.at(i), true);
QString name = confFile.readEntry("description");
int width = confFile.readNumEntry("width");
int height = confFile.readNumEntry("height");
int aspect_num = confFile.readNumEntry("sample_aspect_num");
int aspect_den = confFile.readNumEntry("sample_aspect_den");
int display_num = confFile.readNumEntry("display_aspect_num");
int display_den = confFile.readNumEntry("display_aspect_den");
int fps_num = confFile.readNumEntry("frame_rate_num");
int fps_den = confFile.readNumEntry("frame_rate_den");
int progressive = confFile.readNumEntry("progressive");
if (!name.isEmpty()) m_projectTemplates[name] = formatTemplate(width, height, fps_num, fps_den, aspect_num, aspect_den, display_num, display_den, progressive, *profilesList.at(i));
}*/
}
void MainWindow::slotEditProfiles()
{
QDialog *w = new QDialog;
Ui::ProfilesDialog_UI profilesDialog;
profilesDialog.setupUi(w);
ProfilesDialog *w = new ProfilesDialog;
w->exec();
delete w;
}
void MainWindow::slotEditProjectSettings()
{
ProjectSettings *w = new ProjectSettings;
w->exec();
delete w;
}
......
......@@ -118,6 +118,7 @@ class MainWindow : public KXmlGuiWindow
void slotUpdateMousePosition(int pos);
void slotAddEffect(int effectType, const QString &effectName);
void slotEditProfiles();
void slotEditProjectSettings();
};
#endif
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include <QDir>
#include <KStandardDirs>
#include <KDebug>
#include "kdenlivesettings.h"
#include "profilesdialog.h"
ProfilesDialog::ProfilesDialog(QWidget * parent): QDialog(parent), m_isCustomProfile(false)
{
m_view.setupUi(this);
QStringList profilesFilter;
profilesFilter<<"*";
// List the Mlt profiles
m_mltProfilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
m_view.profiles_list->addItems(m_mltProfilesList);
// List custom profiles
QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "profiles");
for (int i = 0; i < customProfiles.size(); ++i)
m_customProfilesList << QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
m_view.profiles_list->addItems(m_customProfilesList);
if (!KdenliveSettings::default_profile().isEmpty()) {
int ix = m_view.profiles_list->findText(KdenliveSettings::default_profile());
m_view.profiles_list->setCurrentIndex(ix);
}
slotUpdateDisplay();
connect(m_view.profiles_list, SIGNAL(currentIndexChanged( int )), this, SLOT(slotUpdateDisplay()));
}
// static
QStringList ProfilesDialog::getProfileNames()
{
QStringList profilesNames;
QStringList profilesFiles;
QStringList profilesFilter;
profilesFilter<<"*";
// List the Mlt profiles
profilesFiles = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
for (int i = 0; i < profilesFiles.size(); ++i) {
KConfig confFile(KdenliveSettings::mltpath() + "/" + profilesFiles.at(i));
QString desc = confFile.entryMap().value("description");
if (!desc.isEmpty()) profilesNames.append(desc);
}
// List custom profiles
QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "profiles");
for (int i = 0; i < customProfiles.size(); ++i) {
profilesFiles = QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
for (int i = 0; i < profilesFiles.size(); ++i) {
KConfig confFile(customProfiles.at(i) + "/" + profilesFiles.at(i));
QString desc = confFile.entryMap().value("description");
if (!desc.isEmpty()) profilesNames.append(desc);
}
}
return profilesNames;
}
// static
QMap< QString, QString > ProfilesDialog::getSettingsForProfile(const QString path)
{
QStringList profilesNames;
QStringList profilesFiles;
QStringList profilesFilter;
profilesFilter<<"*";
// List the Mlt profiles
profilesFiles = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
for (int i = 0; i < profilesFiles.size(); ++i) {
KConfig confFile(KdenliveSettings::mltpath() + "/" + profilesFiles.at(i));
QMap< QString, QString > values = confFile.entryMap();
if (values.value("description") == path) return values;
}
// List custom profiles
QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "profiles");
for (int i = 0; i < customProfiles.size(); ++i) {
QStringList profiles = QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
for (int i = 0; i < profiles.size(); ++i) {
KConfig confFile(customProfiles.at(i) + "/" + profiles.at(i));
QMap< QString, QString > values = confFile.entryMap();
if (values.value("description") == path) return values;
}
}
return QMap< QString, QString >();
}
void ProfilesDialog::slotUpdateDisplay()
{
QString currentProfile = m_view.profiles_list->currentText();
QString currentProfilePath;
if (m_mltProfilesList.indexOf(currentProfile) != -1) {
currentProfilePath = KdenliveSettings::mltpath() + "/" + currentProfile;
m_isCustomProfile = false;
}
else {
m_isCustomProfile = true;
QStringList customProfiles = KGlobal::dirs()->findDirs("appdata", "mltprofiles");
QStringList profilesFilter;
profilesFilter<<"*";
int i;
for (i = 0; i < customProfiles.size(); ++i) {
QStringList profs = QDir(customProfiles.at(i)).entryList(profilesFilter, QDir::Files);
if (profs.indexOf(currentProfile) != -1) break;
}
currentProfilePath = customProfiles.at(i) + "/" + currentProfile;
}
m_view.button_delete->setEnabled(m_isCustomProfile);
m_view.properties->setEnabled(m_isCustomProfile);
KConfig confFile(currentProfilePath);
QMap< QString, QString > values = confFile.entryMap();
m_view.description->setText(values.value("description"));
m_view.size_w->setValue(values.value("width").toInt());
m_view.size_h->setValue(values.value("height").toInt());
m_view.aspect_num->setValue(values.value("sample_aspect_num").toInt());
m_view.aspect_den->setValue(values.value("sample_aspect_den").toInt());
m_view.display_num->setValue(values.value("display_aspect_num").toInt());
m_view.display_den->setValue(values.value("display_aspect_den").toInt());
m_view.frame_num->setValue(values.value("frame_rate_num").toInt());
m_view.frame_den->setValue(values.value("frame_rate_den").toInt());
m_view.progressive->setChecked(values.value("progressive").toInt());
}
#include "profilesdialog.moc"
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef PROFILESDIALOG_H
#define PROFILESDIALOG_H
#include <QDialog>
#include "ui_profiledialog_ui.h"
class ProfilesDialog : public QDialog
{
Q_OBJECT
public:
ProfilesDialog(QWidget * parent = 0);
static QStringList getProfileNames();
static QMap< QString, QString > getSettingsForProfile(const QString path);
private slots:
void slotUpdateDisplay();
private:
Ui::ProfilesDialog_UI m_view;
QStringList m_mltProfilesList;
QStringList m_customProfilesList;
bool m_isCustomProfile;
};
#endif
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include <QDir>
#include <KStandardDirs>
#include <KDebug>
#include "profilesdialog.h"
#include "projectsettings.h"
ProjectSettings::ProjectSettings(QWidget * parent): QDialog(parent), m_isCustomProfile(false)
{
m_view.setupUi(this);
QStringList profilesNames = ProfilesDialog::getProfileNames();
m_view.profiles_list->addItems(profilesNames);
slotUpdateDisplay();
connect(m_view.profiles_list, SIGNAL(currentIndexChanged( int )), this, SLOT(slotUpdateDisplay()));
}
void ProjectSettings::slotUpdateDisplay()
{
QString currentProfile = m_view.profiles_list->currentText();
QMap< QString, QString > values = ProfilesDialog::getSettingsForProfile(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"));
}
#include "projectsettings.moc"
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef PROJECTSETTINGS_H
#define PROJECTSETTINGS_H
#include <QDialog>
#include "ui_projectsettings_ui.h"
class ProjectSettings : public QDialog
{
Q_OBJECT
public:
ProjectSettings(QWidget * parent = 0);
private slots:
void slotUpdateDisplay();
private:
Ui::ProjectSettings_UI m_view;
QStringList m_mltProfilesList;
QStringList m_customProfilesList;
bool m_isCustomProfile;
};
#endif
......@@ -10,11 +10,11 @@
</rect>
</property>
<property name="windowTitle" >
<string>Dialog</string>
<string>Profiles</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
<item row="0" column="1" >
<widget class="KComboBox" name="kcombobox" />
<widget class="KComboBox" name="profiles_list" />
</item>
<item row="0" column="0" >
<widget class="QLabel" name="label" >
......@@ -24,21 +24,21 @@
</widget>
</item>
<item row="0" column="3" >
<widget class="KPushButton" name="kpushbutton" >
<widget class="KPushButton" name="button_create" >
<property name="text" >
<string>Create</string>
</property>
</widget>
</item>
<item row="0" column="4" >
<widget class="KPushButton" name="kpushbutton_2" >
<widget class="KPushButton" name="button_delete" >
<property name="text" >
<string>Delete</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2" >
<widget class="KPushButton" name="kpushbutton_3" >
<widget class="KPushButton" name="button_default" >
<property name="text" >
<string>Use as default</string>
</property>
......@@ -68,7 +68,7 @@
</spacer>
</item>
<item row="1" column="0" colspan="5" >
<widget class="QGroupBox" name="groupBox" >
<widget class="QGroupBox" name="properties" >
<property name="title" >
<string>Properties</string>
</property>
......@@ -81,7 +81,7 @@
</widget>
</item>
<item row="0" column="1" colspan="3" >
<widget class="KLineEdit" name="klineedit" />
<widget class="KLineEdit" name="description" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_5" >
......@@ -91,7 +91,11 @@
</widget>
</item>
<item row="1" column="1" >
<widget class="KIntSpinBox" name="kintspinbox_3" />
<widget class="KIntSpinBox" name="size_w" >
<property name="maximum" >
<number>10000</number>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QLabel" name="label_6" >
......@@ -107,7 +111,11 @@
</widget>
</item>
<item row="1" column="3" >
<widget class="KIntSpinBox" name="kintspinbox_4" />
<widget class="KIntSpinBox" name="size_h" >
<property name="maximum" >
<number>10000</number>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="label_3" >
......@@ -117,7 +125,11 @@
</widget>
</item>
<item row="2" column="1" >
<widget class="KIntSpinBox" name="kintspinbox" />
<widget class="KIntSpinBox" name="frame_num" >
<property name="maximum" >
<number>10000</number>
</property>
</widget>
</item>
<item row="2" column="2" >
<widget class="QLabel" name="label_4" >
......@@ -133,7 +145,11 @@
</widget>
</item>
<item row="2" column="3" >
<widget class="KIntSpinBox" name="kintspinbox_2" />
<widget class="KIntSpinBox" name="frame_den" >
<property name="maximum" >
<number>10000</number>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="label_9" >
......@@ -143,7 +159,7 @@
</widget>
</item>
<item row="3" column="1" >
<widget class="KIntSpinBox" name="kintspinbox_5" />
<widget class="KIntSpinBox" name="aspect_num" />
</item>
<item row="3" column="2" >
<widget class="QLabel" name="label_7" >
......@@ -159,7 +175,7 @@
</widget>
</item>
<item row="3" column="3" >
<widget class="KIntSpinBox" name="kintspinbox_6" />
<widget class="KIntSpinBox" name="aspect_den" />
</item>
<item row="4" column="0" >
<widget class="QLabel" name="label_10" >
......@@ -169,7 +185,7 @@
</widget>
</item>
<item row="4" column="1" >
<widget class="KIntSpinBox" name="kintspinbox_7" />
<widget class="KIntSpinBox" name="display_num" />
</item>
<item row="4" column="2" >
<widget class="QLabel" name="label_8" >
......@@ -185,7 +201,7 @@
</widget>
</item>
<item row="4" column="3" >
<widget class="KIntSpinBox" name="kintspinbox_8" />
<widget class="KIntSpinBox" name="display_den" />
</item>
<item row="6" column="0" >
<spacer name="verticalSpacer" >
......@@ -201,7 +217,7 @@
</spacer>
</item>
<item row="5" column="0" >
<widget class="QCheckBox" name="checkBox" >
<widget class="QCheckBox" name="progressive" >
<property name="text" >
<string>Progressive</string>
</property>
......@@ -211,14 +227,14 @@
</widget>
</item>
</layout>
<zorder>kcombobox</zorder>
<zorder>profiles_list</zorder>
<zorder>label</zorder>
<zorder>kpushbutton</zorder>
<zorder>kpushbutton_2</zorder>
<zorder>kpushbutton_3</zorder>
<zorder>button_create</zorder>
<zorder>button_delete</zorder>
<zorder>button_default</zorder>
<zorder>buttonBox</zorder>
<zorder>horizontalSpacer</zorder>
<zorder>groupBox</zorder>
<zorder>properties</zorder>
</widget>
<customwidgets>
<customwidget>
......
<ui version="4.0" >
<class>ProjectSettings_UI</class>
<widget class="QDialog" name="ProjectSettings_UI" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>308</width>
<height>250</height>
</rect>
</property>
<property name="windowTitle" >
<string>Project Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout_3" >
<item row="0" column="0" >
<widget class="QLabel" name="label_11" >
<property name="text" >
<string>Project folder</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="KUrlRequester" name="kurlrequester" />
</item>
<item row="1" column="0" colspan="2" >
<widget class="QGroupBox" name="properties" >
<property name="title" >
<string>Video Profile</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Profile</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="KComboBox" name="profiles_list" />
</item>
<item row="1" column="0" colspan="2" >
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Size:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="p_size" >
<property name="text" >
<string>720x576</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Frame rate:</string>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QLabel" name="p_fps" >
<property name="text" >
<string>25/1</string>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_9" >
<property name="text" >
<string>Aspect ratio:</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLabel" name="p_aspect" >
<property name="text" >
<string>59/54</string>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QLabel" name="label_10" >
<property name="text" >
<string>Display ratio:</string>
</property>
</widget>
</item>
<item row="1" column="3" >
<widget class="QLabel" name="p_display" >
<property name="text" >
<string>4/3</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2" >
<widget class="QLabel" name="p_progressive" >
<property name="text" >
<string>Interlaced</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="1" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >