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