示例#1
0
Wizard::Wizard(bool upgrade, QWidget *parent) :
    QWizard(parent),
    m_systemCheckIsOk(false)
{
    setWindowTitle(i18n("Config Wizard"));
    setPixmap(QWizard::WatermarkPixmap, QPixmap(QStandardPaths::locate(QStandardPaths::DataLocation, "banner.png")));

    QWizardPage *page1 = new QWizardPage;
    page1->setTitle(i18n("Welcome"));
    if (upgrade)
        m_welcomeLabel = new QLabel(i18n("Your Kdenlive version was upgraded to version %1. Please take some time to review the basic settings", QString(kdenlive_version).section(' ', 0, 0)), this);
    else
        m_welcomeLabel = new QLabel(i18n("This is the first time you run Kdenlive. This wizard will let you adjust some basic settings, you will be ready to edit your first movie in a few seconds..."), this);
    m_welcomeLabel->setWordWrap(true);
    m_startLayout = new QVBoxLayout;
    m_startLayout->addWidget(m_welcomeLabel);
    QPushButton *but = new QPushButton(QIcon::fromTheme("help-about"), i18n("Discover the features of this Kdenlive release"), this);
    connect(but, &QPushButton::clicked, this, &Wizard::slotShowWebInfos);
    m_startLayout->addStretch();
    m_startLayout->addWidget(but);


    page1->setLayout(m_startLayout);
    addPage(page1);

    QWizardPage *page4 = new QWizardPage;
    page4->setTitle(i18n("Checking MLT engine"));
    m_mltCheck.setupUi(page4);
    addPage(page4);

    WizardDelegate *listViewDelegate = new WizardDelegate(m_mltCheck.programList);
    m_mltCheck.programList->setItemDelegate(listViewDelegate);

    QWizardPage *page2 = new QWizardPage;
    page2->setTitle(i18n("Video Standard"));
    m_standard.setupUi(page2);

    m_okIcon = QIcon::fromTheme("dialog-ok");
    m_badIcon = QIcon::fromTheme("dialog-close");

    // build profiles lists
    QMap<QString, QString> profilesInfo = ProfilesDialog::getProfilesInfo();
    QMap<QString, QString>::const_iterator i = profilesInfo.constBegin();
    while (i != profilesInfo.constEnd()) {
        QMap< QString, QString > profileData = ProfilesDialog::getSettingsFromFile(i.value());
        if (profileData.value("width") == "720") m_dvProfiles.insert(i.key(), i.value());
        else if (profileData.value("width").toInt() >= 1080) m_hdvProfiles.insert(i.key(), i.value());
        else m_otherProfiles.insert(i.key(), i.value());
        ++i;
    }

    m_standard.button_all->setChecked(true);
    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();
    connect(m_standard.profiles_list, SIGNAL(itemSelectionChanged()), this, SLOT(slotCheckSelectedItem()));

    // select default profile
    if (!KdenliveSettings::default_profile().isEmpty()) {
        for (int i = 0; i < m_standard.profiles_list->count(); ++i) {
            if (m_standard.profiles_list->item(i)->data(Qt::UserRole).toString() == KdenliveSettings::default_profile()) {
                m_standard.profiles_list->setCurrentRow(i);
                m_standard.profiles_list->scrollToItem(m_standard.profiles_list->currentItem());
                break;
            }
        }
    }

    addPage(page2);

    QWizardPage *page3 = new QWizardPage;
    page3->setTitle(i18n("Additional Settings"));
    m_extra.setupUi(page3);
    m_extra.projectfolder->setMode(KFile::Directory);
    m_extra.projectfolder->setUrl(QUrl(KdenliveSettings::defaultprojectfolder()));
    m_extra.videothumbs->setChecked(KdenliveSettings::videothumbnails());
    m_extra.audiothumbs->setChecked(KdenliveSettings::audiothumbnails());
    m_extra.autosave->setChecked(KdenliveSettings::crashrecovery());
    connect(m_extra.videothumbs, SIGNAL(stateChanged(int)), this, SLOT(slotCheckThumbs()));
    connect(m_extra.audiothumbs, SIGNAL(stateChanged(int)), this, SLOT(slotCheckThumbs()));
    slotCheckThumbs();
    addPage(page3);

#ifndef Q_WS_MAC
    QWizardPage *page6 = new QWizardPage;
    page6->setTitle(i18n("Capture device"));
    m_capture.setupUi(page6);
    bool found_decklink = Render::getBlackMagicDeviceList(m_capture.decklink_devices);
    KdenliveSettings::setDecklink_device_found(found_decklink);
    if (found_decklink) m_capture.decklink_status->setText(i18n("Default Blackmagic Decklink card:"));
    else m_capture.decklink_status->setText(i18n("No Blackmagic Decklink device found"));
    connect(m_capture.decklink_devices, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDecklinkDevice(int)));
    connect(m_capture.button_reload, SIGNAL(clicked()), this, SLOT(slotDetectWebcam()));
    connect(m_capture.v4l_devices, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateCaptureParameters()));
    connect(m_capture.v4l_formats, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSaveCaptureFormat()));
    m_capture.button_reload->setIcon(QIcon::fromTheme("view-refresh"));

    addPage(page6);
#endif

    QWizardPage *page5 = new QWizardPage;
    page5->setTitle(i18n("Checking system"));
    m_check.setupUi(page5);
    addPage(page5);

    listViewDelegate = new WizardDelegate(m_check.programList);
    m_check.programList->setItemDelegate(listViewDelegate);
    slotDetectWebcam();
    QTimer::singleShot(500, this, SLOT(slotCheckMlt()));
}
示例#2
0
文件: wizard.cpp 项目: rayl/kdenlive
Wizard::Wizard(bool upgrade, QWidget *parent) :
        QWizard(parent)
{
    setWindowTitle(i18n("Config Wizard"));
    setPixmap(QWizard::WatermarkPixmap, QPixmap(KStandardDirs::locate("appdata", "banner.png")));

    QWizardPage *page1 = new QWizardPage;
    page1->setTitle(i18n("Welcome"));
    QLabel *label;
    if (upgrade)
        label = new QLabel(i18n("Your Kdenlive version was upgraded. Please take some time to review the basic settings"));
    else
        label = new QLabel(i18n("This is the first time you run Kdenlive. This wizard will let you adjust some basic settings, you will be ready to edit your first movie in a few seconds..."));
    label->setWordWrap(true);
    m_startLayout = new QVBoxLayout;
    m_startLayout->addWidget(label);
    page1->setLayout(m_startLayout);
    addPage(page1);

    QWizardPage *page4 = new QWizardPage;
    page4->setTitle(i18n("Checking MLT engine"));
    m_mltCheck.setupUi(page4);
    addPage(page4);

    WizardDelegate *listViewDelegate = new WizardDelegate(m_mltCheck.programList);
    m_mltCheck.programList->setItemDelegate(listViewDelegate);

    QWizardPage *page2 = new QWizardPage;
    page2->setTitle(i18n("Video Standard"));
    m_standard.setupUi(page2);

    m_okIcon = KIcon("dialog-ok");
    m_badIcon = KIcon("dialog-close");

    // build profiles lists
    QMap<QString, QString> profilesInfo = ProfilesDialog::getProfilesInfo();
    QMap<QString, QString>::const_iterator i = profilesInfo.constBegin();
    while (i != profilesInfo.constEnd()) {
        QMap< QString, QString > profileData = ProfilesDialog::getSettingsFromFile(i.value());
        if (profileData.value("width") == "720") m_dvProfiles.insert(i.key(), i.value());
        else if (profileData.value("width").toInt() >= 1080) m_hdvProfiles.insert(i.key(), i.value());
        else m_otherProfiles.insert(i.key(), i.value());
        ++i;
    }

    m_standard.button_all->setChecked(true);
    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();
    connect(m_standard.profiles_list, SIGNAL(itemSelectionChanged()), this, SLOT(slotCheckSelectedItem()));


    if (!KdenliveSettings::default_profile().isEmpty()) {
        for (int i = 0; i < m_standard.profiles_list->count(); i++) {
            if (m_standard.profiles_list->item(i)->data(Qt::UserRole).toString() == KdenliveSettings::default_profile()) {
                m_standard.profiles_list->setCurrentRow(i);
                m_standard.profiles_list->scrollToItem(m_standard.profiles_list->currentItem());
                break;
            }
        }
    }

    // select default profile
    fprintf(stderr, "LOOKING FOR: %s", ProfilesDialog::getProfileDescription(KdenliveSettings::default_profile()).toUtf8().data());
    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));

    fprintf(stderr, "LOOKING FOR: %s // %d", ProfilesDialog::getProfileDescription(KdenliveSettings::default_profile()).toUtf8().data(), profiles.count());
    addPage(page2);

    QWizardPage *page3 = new QWizardPage;
    page3->setTitle(i18n("Additional Settings"));
    m_extra.setupUi(page3);
    m_extra.projectfolder->setMode(KFile::Directory);
    m_extra.projectfolder->setPath(KdenliveSettings::defaultprojectfolder());
    m_extra.videothumbs->setChecked(KdenliveSettings::videothumbnails());
    m_extra.audiothumbs->setChecked(KdenliveSettings::audiothumbnails());
    m_extra.autosave->setChecked(KdenliveSettings::crashrecovery());
    connect(m_extra.videothumbs, SIGNAL(stateChanged(int)), this, SLOT(slotCheckThumbs()));
    connect(m_extra.audiothumbs, SIGNAL(stateChanged(int)), this, SLOT(slotCheckThumbs()));
    slotCheckThumbs();
    addPage(page3);


    QWizardPage *page5 = new QWizardPage;
    page5->setTitle(i18n("Checking system"));
    m_check.setupUi(page5);
    addPage(page5);

    listViewDelegate = new WizardDelegate(m_check.programList);
    m_check.programList->setItemDelegate(listViewDelegate);

    QTimer::singleShot(500, this, SLOT(slotCheckMlt()));
}