]> git.sesse.net Git - kdenlive/blob - src/kdenlivesettingsdialog.cpp
4be8b9ab71945ba07bcbe3ecab1fa7fcc99074ac
[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 *p1 = new QWidget;
33   m_configMisc.setupUi(p1);
34   page1 = addPage( p1, i18n("Misc"), "misc" );
35
36   QWidget *p3 = new QWidget;
37   m_configDisplay.setupUi(p3);
38   page3 = addPage( p3, i18n("Display"), "display" );
39
40   QWidget *p2 = new QWidget;
41   m_configEnv.setupUi(p2);
42   m_configEnv.mltpathurl->setMode(KFile::Directory);
43   m_configEnv.mltpathurl->lineEdit()->setObjectName("kcfg_mltpath");
44   m_configEnv.rendererpathurl->lineEdit()->setObjectName("kcfg_rendererpath");
45   m_configEnv.tmppathurl->setMode(KFile::Directory);
46   m_configEnv.tmppathurl->lineEdit()->setObjectName("kcfg_currenttmpfolder");
47   page2 = addPage( p2, i18n("Environnement"), "env" );
48
49   QStringList profilesNames = ProfilesDialog::getProfileNames();
50   m_configMisc.profiles_list->addItems(profilesNames);
51   m_defaulfProfile = ProfilesDialog::getSettingsFromFile(KdenliveSettings::default_profile()).value("description");
52   if (profilesNames.contains(m_defaulfProfile)) m_configMisc.profiles_list->setCurrentItem(m_defaulfProfile);
53
54   slotUpdateDisplay();
55   connect(m_configMisc.profiles_list, SIGNAL(currentIndexChanged( int )), this, SLOT(slotUpdateDisplay()));
56 }
57
58 KdenliveSettingsDialog::~KdenliveSettingsDialog()
59 {}
60
61
62 bool KdenliveSettingsDialog::hasChanged()
63 {
64   kDebug()<<"// // // KCONFIG hasChanged called";
65   if (m_configMisc.profiles_list->currentText() != m_defaulfProfile) return true;
66   return KConfigDialog::hasChanged();
67 }
68
69 void KdenliveSettingsDialog::slotUpdateDisplay()
70 {
71   QString currentProfile = m_configMisc.profiles_list->currentText();
72   QMap< QString, QString > values = ProfilesDialog::getSettingsForProfile(currentProfile);
73   m_configMisc.p_size->setText(values.value("width") + "x" + values.value("height"));
74   m_configMisc.p_fps->setText(values.value("frame_rate_num") + "/" + values.value("frame_rate_den"));
75   m_configMisc.p_aspect->setText(values.value("sample_aspect_num") + "/" + values.value("sample_aspect_den"));
76   m_configMisc.p_display->setText(values.value("display_aspect_num") + "/" + values.value("display_aspect_den"));
77   if (values.value("progressive").toInt() == 0) m_configMisc.p_progressive->setText(i18n("Interlaced"));
78   else m_configMisc.p_progressive->setText(i18n("Progressive"));
79 }
80
81
82 #include "kdenlivesettingsdialog.moc"
83
84