]> git.sesse.net Git - kdenlive/blob - src/kdenlivesettingsdialog.cpp
improve Kdenlive Settings dialog
[kdenlive] / src / kdenlivesettingsdialog.cpp
1 /***************************************************************************
2  *   Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20 #include <QDir>
21
22 #include <KStandardDirs>
23 #include <KDebug>
24
25 #include "profilesdialog.h"
26 #include "kdenlivesettings.h"
27 #include "kdenlivesettingsdialog.h"
28
29 KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent): KConfigDialog(parent, "settings", KdenliveSettings::self())
30 {
31
32   QWidget *page1 = new QWidget;
33   m_configMisc = new Ui::ConfigMisc_UI( );
34   m_configMisc->setupUi(page1);
35   addPage( page1, i18n("Misc"), "misc" );
36
37   QWidget *page2 = new QWidget;
38   m_configEnv = new Ui::ConfigEnv_UI( );
39   m_configEnv->setupUi(page2);
40   m_configEnv->kcfg_mltpath->setMode(KFile::Directory);
41
42   //WARNING: the 2 lines below should not be necessary, but does not work without it...
43   m_configEnv->kcfg_mltpath->setPath(KdenliveSettings::mltpath());
44   m_configEnv->kcfg_rendererpath->setPath(KdenliveSettings::rendererpath());
45   addPage( page2, i18n("Environnement"), "env" );
46
47   QStringList profilesNames = ProfilesDialog::getProfileNames();
48   m_configMisc->profiles_list->addItems(profilesNames);
49
50   //User edited the configuration - update your local copies of the
51   //configuration data
52
53   slotUpdateDisplay();
54   connect(m_configMisc->profiles_list, SIGNAL(currentIndexChanged( int )), this, SLOT(slotUpdateDisplay()));
55 }
56
57
58 void KdenliveSettingsDialog::slotUpdateDisplay()
59 {
60   QString currentProfile = m_configMisc->profiles_list->currentText();
61   QMap< QString, QString > values = ProfilesDialog::getSettingsForProfile(currentProfile);
62   m_configMisc->p_size->setText(values.value("width") + "x" + values.value("height"));
63   m_configMisc->p_fps->setText(values.value("frame_rate_num") + "/" + values.value("frame_rate_den"));
64   m_configMisc->p_aspect->setText(values.value("sample_aspect_num") + "/" + values.value("sample_aspect_den"));
65   m_configMisc->p_display->setText(values.value("display_aspect_num") + "/" + values.value("display_aspect_den"));
66   if (values.value("progressive").toInt() == 0) m_configMisc->p_progressive->setText(i18n("Interlaced"));
67   else m_configMisc->p_progressive->setText(i18n("Progressive"));
68 }
69
70
71 #include "kdenlivesettingsdialog.moc"
72
73