]> git.sesse.net Git - kdenlive/blob - src/wizard.h
Show Config wizard if Kdenlive version changed
[kdenlive] / src / wizard.h
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
21 #ifndef WIZARD_H
22 #define WIZARD_H
23
24 #include <QWizard>
25 #include <QVBoxLayout>
26 #include <QItemDelegate>
27 #include <QPainter>
28
29 #include <KIcon>
30 #include <KDebug>
31
32 #include "ui_wizardstandard_ui.h"
33 #include "ui_wizardextra_ui.h"
34 #include "ui_wizardcheck_ui.h"
35 #include "ui_wizardmltcheck_ui.h"
36
37 class WizardDelegate: public QItemDelegate {
38 public:
39     WizardDelegate(QAbstractItemView* parent = 0): QItemDelegate(parent) {
40     }
41     void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
42         if (index.column() == 1) {
43             const bool hover = option.state & (QStyle::State_Selected);
44             QRect r1 = option.rect;
45             painter->save();
46             if (hover) {
47                 painter->setPen(option.palette.color(QPalette::HighlightedText));
48                 QColor backgroundColor = option.palette.color(QPalette::Highlight);
49                 painter->setBrush(QBrush(backgroundColor));
50                 painter->fillRect(r1, QBrush(backgroundColor));
51             }
52             QFont font = painter->font();
53             font.setBold(true);
54             painter->setFont(font);
55             int mid = (int)((r1.height() / 2));
56             r1.setBottom(r1.y() + mid);
57             QRect r2 = option.rect;
58             r2.setTop(r2.y() + mid);
59             painter->drawText(r1, Qt::AlignLeft | Qt::AlignBottom , index.data().toString());
60             font.setBold(false);
61             painter->setFont(font);
62             QString subText = index.data(Qt::UserRole).toString();
63             painter->setPen(option.palette.color(QPalette::Mid));
64             painter->drawText(r2, Qt::AlignLeft | Qt::AlignVCenter , subText);
65             painter->restore();
66         } else {
67             QItemDelegate::paint(painter, option, index);
68         }
69     }
70 };
71
72
73 class Wizard : public QWizard {
74     Q_OBJECT
75 public:
76     Wizard(bool upgrade, QWidget * parent = 0);
77     void installExtraMimes(QString baseName, QStringList globs);
78     void runUpdateMimeDatabase();
79     void adjustSettings();
80     bool isOk() const;
81
82 private:
83     Ui::WizardStandard_UI m_standard;
84     Ui::WizardExtra_UI m_extra;
85     Ui::WizardMltCheck_UI m_mltCheck;
86     Ui::WizardCheck_UI m_check;
87     QVBoxLayout *m_startLayout;
88     bool m_systemCheckIsOk;
89     QStringList m_dvProfiles;
90     QStringList m_hdvProfiles;
91     QStringList m_otherProfiles;
92     QMap <QString, QString> m_profilesInfo;
93     void slotCheckPrograms();
94     void checkMltComponents();
95     KIcon m_okIcon;
96     KIcon m_badIcon;
97
98 private slots:
99     void slotCheckThumbs();
100     void slotCheckStandard();
101     void slotCheckSelectedItem();
102     void slotCheckMlt();
103 };
104
105 #endif
106