]> git.sesse.net Git - kdenlive/commitdiff
*Add a new page to startup wizard to check presence of important programs (ffplay...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 16 Dec 2008 14:11:34 +0000 (14:11 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 16 Dec 2008 14:11:34 +0000 (14:11 +0000)
*Allow users to run Wizard from Setting menu

svn path=/branches/KDE4/; revision=2791

src/CMakeLists.txt
src/kdenliveui.rc
src/mainwindow.cpp
src/mainwindow.h
src/projectlist.cpp
src/projectlist.h
src/widgets/wizardcheck_ui.ui [new file with mode: 0644]
src/wizard.cpp
src/wizard.h

index c868d10d6b88e329ef6a03cb7174fe3858add0f2..82042a78bb0135dfa1f731f9ca69debfcb346698 100644 (file)
@@ -59,6 +59,7 @@ kde4_add_ui_files(kdenlive_UI
   widgets/geometryval_ui.ui
   widgets/wizardstandard_ui.ui
   widgets/wizardextra_ui.ui
+  widgets/wizardcheck_ui.ui
   widgets/spacerdialog_ui.ui
   widgets/addtrack_ui.ui
 )
index ff23bc6ae322593dd6e5af4a2ea55b23071643c6..6cf97392b135b75222d5fee9f8efcc09f9b954c4 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<gui name="kdenlive" version="26">
+<gui name="kdenlive" version="27">
   <ToolBar name="extraToolBar" >
     <text>Extra Toolbar</text>
        <Action name="project_render" />
@@ -94,6 +94,7 @@
     <Menu name="settings" >
       <Action name="manage_profiles" />
       <Action name="get_new_stuff" />      
-    </Menu>
+      <Action name="run_wizard" />   
+</Menu>
   </MenuBar>
 </gui>
\ No newline at end of file
index 85b948201fd0a76efc229b539784173eaf758239..8dd85e535f2c427f60358526e80ee088dfbcceea 100644 (file)
@@ -696,6 +696,10 @@ void MainWindow::setupActions() {
 
     KAction* fileGHNS = KNS::standardAction(i18n("Download New Lumas..."), this, SLOT(slotGetNewStuff()), actionCollection(), "get_new_stuff");
 
+    KAction* wizAction = new KAction(KIcon("configure"), i18n("Run Config Wizard"), this);
+    collection->addAction("run_wizard", wizAction);
+    connect(wizAction, SIGNAL(triggered(bool)), this, SLOT(slotRunWizard()));
+
     KAction* projectAction = new KAction(KIcon("configure"), i18n("Project Settings"), this);
     collection->addAction("project_settings", projectAction);
     connect(projectAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProjectSettings()));
@@ -924,6 +928,14 @@ void MainWindow::readOptions() {
         m_projectList->setHeaderInfo(state);
 }
 
+void MainWindow::slotRunWizard() {
+    Wizard *w = new Wizard(this);
+    if (w->exec() == QDialog::Accepted && w->isOk()) {
+        w->adjustSettings();
+    }
+    delete w;
+}
+
 void MainWindow::newFile(bool showProjectSettings) {
     QString profileName;
     KUrl projectFolder;
index 941bfdf3abaae9d8880e9ed3e8a2b1c99a2321bf..629b1519e01679724a31a0ceafae02de8a802eae 100644 (file)
@@ -271,6 +271,7 @@ private slots:
     void slotChangeTrack(int ix = 0);
     void slotGetNewStuff();
     void slotAutoTransition();
+    void slotRunWizard();
 };
 
 
index 0bdbba1b97a9808fcb8ae7501808fd57da1e2ecd..a5320031b8c2c0f18b3e52bfdc10e4dd9fa6dd6a 100644 (file)
@@ -120,8 +120,8 @@ ProjectList::ProjectList(QWidget *parent)
     connect(listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemEdited(QTreeWidgetItem *, int)));
     connect(listView, SIGNAL(showProperties(DocClipBase *)), this, SIGNAL(showClipProperties(DocClipBase *)));
 
-    m_listViewDelegate = new ItemDelegate(listView);
-    listView->setItemDelegate(m_listViewDelegate);
+    ItemDelegate *listViewDelegate = new ItemDelegate(listView);
+    listView->setItemDelegate(listViewDelegate);
 }
 
 ProjectList::~ProjectList() {
index 759ac857bbccd7c99b40dd13f5a3626842566160..33a0a597c18b965d4c873e0a6143f2467b10c43f 100644 (file)
@@ -141,7 +141,6 @@ private:
     QAction *m_editAction;
     QAction *m_deleteAction;
     KdenliveDoc *m_doc;
-    ItemDelegate *m_listViewDelegate;
     ProjectItem *m_selectedItem;
     bool m_refreshed;
     QMap <QString, QDomElement> m_infoQueue;
diff --git a/src/widgets/wizardcheck_ui.ui b/src/widgets/wizardcheck_ui.ui
new file mode 100644 (file)
index 0000000..a29e855
--- /dev/null
@@ -0,0 +1,20 @@
+<ui version="4.0" >
+ <class>WizardCheck_UI</class>
+ <widget class="QWidget" name="WizardCheck_UI" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>360</width>
+    <height>236</height>
+   </rect>
+  </property>
+  <layout class="QGridLayout" name="gridLayout" >
+   <item row="0" column="0" >
+    <widget class="QTreeWidget" name="programList" />
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
index dc917a7fd45d5a07fab38a04dc402326fe32a144..f63b26028ca30df1120e5247697dc12fd278e59e 100644 (file)
@@ -47,7 +47,7 @@ Wizard::Wizard(QWidget *parent): QWizard(parent) {
     QWizardPage *page2 = new QWizardPage;
     page2->setTitle(i18n("Video Standard"));
     m_standard.setupUi(page2);
-    //m_standard.profiles_list->setMaximumHeight(100);
+
     // build profiles lists
     m_profilesInfo = ProfilesDialog::getProfilesInfo();
     QMap<QString, QString>::const_iterator i = m_profilesInfo.constBegin();
@@ -62,8 +62,12 @@ Wizard::Wizard(QWidget *parent): QWizard(parent) {
     connect(m_standard.button_all, SIGNAL(toggled(bool)), this, SLOT(slotCheckStandard()));
     connect(m_standard.button_hdv, SIGNAL(toggled(bool)), this, SLOT(slotCheckStandard()));
     connect(m_standard.button_dv, SIGNAL(toggled(bool)), this, SLOT(slotCheckStandard()));
-    slotCheckStandard();
+    m_standard.button_all->setChecked(true);
     connect(m_standard.profiles_list, SIGNAL(itemSelectionChanged()), this, SLOT(slotCheckSelectedItem()));
+
+    // select default profile
+    QList<QListWidgetItem *> profiles = m_standard.profiles_list->findItems(ProfilesDialog::getProfileDescription(KdenliveSettings::default_profile()), Qt::MatchExactly);
+    if (profiles.count() > 0) m_standard.profiles_list->setCurrentItem(profiles.at(0));
     addPage(page2);
 
     QWizardPage *page3 = new QWizardPage;
@@ -78,9 +82,56 @@ Wizard::Wizard(QWidget *parent): QWizard(parent) {
     connect(m_extra.audiothumbs, SIGNAL(stateChanged(int)), this, SLOT(slotCheckThumbs()));
     slotCheckThumbs();
     addPage(page3);
+
+
+    QWizardPage *page4 = new QWizardPage;
+    page4->setTitle(i18n("Checking system"));
+    m_check.setupUi(page4);
+    slotCheckPrograms();
+    addPage(page4);
+
+    WizardDelegate *listViewDelegate = new WizardDelegate(m_check.programList);
+    m_check.programList->setItemDelegate(listViewDelegate);
+
     QTimer::singleShot(500, this, SLOT(slotCheckMlt()));
 }
 
+void Wizard::slotCheckPrograms() {
+    m_check.programList->setColumnCount(2);
+    m_check.programList->setRootIsDecorated(false);
+    m_check.programList->setHeaderHidden(true);
+    QSize itemSize(20, this->fontMetrics().height() * 2.5);
+    KIcon okIcon("dialog-ok");
+    KIcon missingIcon("dialog-close");
+    m_check.programList->setColumnWidth(0, 30);
+    m_check.programList->setIconSize(QSize(24, 24));
+    QTreeWidgetItem *item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << "FFmpeg & ffplay");
+    item->setData(1, Qt::UserRole, QString("Required for webcam capture"));
+    item->setSizeHint(0, itemSize);
+    QString exepath = KStandardDirs::findExe("ffmpeg");
+    if (exepath.isEmpty()) item->setIcon(0, missingIcon);
+    else if (KStandardDirs::findExe("ffplay").isEmpty()) item->setIcon(0, missingIcon);
+    else item->setIcon(0, okIcon);
+
+    item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << "Recordmydesktop");
+    item->setData(1, Qt::UserRole, QString("Required for screen capture"));
+    item->setSizeHint(0, itemSize);
+    if (KStandardDirs::findExe("recordmydesktop").isEmpty()) item->setIcon(0, missingIcon);
+    else item->setIcon(0, okIcon);
+
+    item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << "Dvgrab");
+    item->setData(1, Qt::UserRole, QString("Required for firewire capture"));
+    item->setSizeHint(0, itemSize);
+    if (KStandardDirs::findExe("dvgrab").isEmpty()) item->setIcon(0, missingIcon);
+    else item->setIcon(0, okIcon);
+
+    item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << "Inigo");
+    item->setData(1, Qt::UserRole, QString("Required for rendering (part of MLT package)"));
+    item->setSizeHint(0, itemSize);
+    if (KStandardDirs::findExe("inigo").isEmpty()) item->setIcon(0, missingIcon);
+    else item->setIcon(0, okIcon);
+}
+
 void Wizard::installExtraMimes(QString baseName, QStringList globs) {
     QString mimefile = baseName;
     mimefile.replace('/', '-');
index c874a6944d13adac81a800e9e7085e2d6b2d9d5c..c76b9b9a6fdfd768dcdd268ec1a635a8750cccea 100644 (file)
 
 #include <QWizard>
 #include <QVBoxLayout>
+#include <QItemDelegate>
+#include <QPainter>
+
 #include <KDebug>
 
 #include "ui_wizardstandard_ui.h"
 #include "ui_wizardextra_ui.h"
+#include "ui_wizardcheck_ui.h"
+
+
+class WizardDelegate: public QItemDelegate {
+public:
+    WizardDelegate(QAbstractItemView* parent = 0): QItemDelegate(parent) {
+    }
+    void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
+        if (index.column() == 1) {
+            const bool hover = option.state & (QStyle::State_Selected);
+            QRect r1 = option.rect;
+            painter->save();
+            if (hover) {
+                painter->setPen(option.palette.color(QPalette::HighlightedText));
+                QColor backgroundColor = option.palette.color(QPalette::Highlight);
+                painter->setBrush(QBrush(backgroundColor));
+                painter->fillRect(r1, QBrush(backgroundColor));
+            }
+            QFont font = painter->font();
+            font.setBold(true);
+            painter->setFont(font);
+            int mid = (int)((r1.height() / 2));
+            r1.setBottom(r1.y() + mid);
+            QRect r2 = option.rect;
+            r2.setTop(r2.y() + mid);
+            painter->drawText(r1, Qt::AlignLeft | Qt::AlignBottom , index.data().toString());
+            font.setBold(false);
+            painter->setFont(font);
+            QString subText = index.data(Qt::UserRole).toString();
+            painter->setPen(option.palette.color(QPalette::Mid));
+            painter->drawText(r2, Qt::AlignLeft | Qt::AlignVCenter , subText);
+            painter->restore();
+        } else {
+            QItemDelegate::paint(painter, option, index);
+        }
+    }
+};
 
 
 class Wizard : public QWizard {
@@ -41,12 +81,14 @@ public:
 private:
     Ui::WizardStandard_UI m_standard;
     Ui::WizardExtra_UI m_extra;
+    Ui::WizardCheck_UI m_check;
     QVBoxLayout *m_startLayout;
     bool m_systemCheckIsOk;
     QStringList m_dvProfiles;
     QStringList m_hdvProfiles;
     QStringList m_otherProfiles;
     QMap <QString, QString> m_profilesInfo;
+    void slotCheckPrograms();
 
 private slots:
     void slotCheckThumbs();