]> git.sesse.net Git - kdenlive/blob - src/wizard.h
Use const'ref.
[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 #include "ui_wizardcapture_ui.h"
37
38 class WizardDelegate: public QItemDelegate
39 {
40 public:
41     WizardDelegate(QAbstractItemView* parent = 0): QItemDelegate(parent) {
42     }
43     void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
44         if (index.column() == 1) {
45             painter->save();
46             QStyleOptionViewItemV4 opt(option);
47             QStyle *style = opt.widget ? opt.widget->style() : QApplication::style();
48             const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin) + 1;
49             style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget);
50             
51             QFont font = painter->font();
52             font.setBold(true);
53             painter->setFont(font);
54             QRect r1 = option.rect;
55             r1.adjust(0, textMargin, 0, - textMargin);
56             int mid = (int)((r1.height() / 2));
57             r1.setBottom(r1.y() + mid);
58             QRect r2 = option.rect;
59             r2.setTop(r2.y() + mid);
60             painter->drawText(r1, Qt::AlignLeft | Qt::AlignBottom , index.data().toString());
61             font.setBold(false);
62             painter->setFont(font);
63             QString subText = index.data(Qt::UserRole).toString();
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 {
75     Q_OBJECT
76 public:
77     explicit Wizard(bool upgrade, QWidget * parent = 0);
78     void installExtraMimes(QString baseName, QStringList globs);
79     void runUpdateMimeDatabase();
80     void adjustSettings();
81     bool isOk() const;
82
83 private:
84     Ui::WizardStandard_UI m_standard;
85     Ui::WizardExtra_UI m_extra;
86     Ui::WizardMltCheck_UI m_mltCheck;
87     Ui::WizardCapture_UI m_capture;
88     Ui::WizardCheck_UI m_check;
89     QVBoxLayout *m_startLayout;
90     bool m_systemCheckIsOk;
91     QLabel *m_welcomeLabel;
92     QMap <QString, QString> m_dvProfiles;
93     QMap <QString, QString> m_hdvProfiles;
94     QMap <QString, QString> m_otherProfiles;
95     void slotCheckPrograms();
96     void checkMltComponents();
97     void checkMissingCodecs();
98     KIcon m_okIcon;
99     KIcon m_badIcon;
100
101 private slots:
102     void slotCheckThumbs();
103     void slotCheckStandard();
104     void slotCheckSelectedItem();
105     void slotCheckMlt();
106     void slotShowWebInfos();
107     void slotDetectWebcam();
108     void slotUpdateCaptureParameters();
109     void slotSaveCaptureFormat();
110     void slotUpdateDecklinkDevice(int captureCard);
111     void slotOpenManual();
112 };
113
114 #endif
115