CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const Utils::Environment &env)
    : m_cmakeManager(cmakeManager),
      m_sourceDirectory(sourceDirectory),
      m_creatingCbpFiles(false),
      m_environment(env)
{
    int startid;
    if (hasInSourceBuild()) {
        startid = InSourcePageId;
        m_buildDirectory = m_sourceDirectory;
    } else {
        startid = ShadowBuildPageId;
        m_buildDirectory = m_sourceDirectory + QLatin1String("-build");
    }

    setPage(InSourcePageId, new InSourceBuildPage(this));
    setPage(ShadowBuildPageId, new ShadowBuildPage(this));
    setPage(CMakeRunPageId, new CMakeRunPage(this));

    Utils::WizardProgress *wp = wizardProgress();
    Utils::WizardProgressItem *inSourceItem = wp->item(InSourcePageId);
    Utils::WizardProgressItem *shadowBuildItem = wp->item(ShadowBuildPageId);
    Utils::WizardProgressItem *cmakeRunItem = wp->item(CMakeRunPageId);
    inSourceItem->setNextItems(QList<Utils::WizardProgressItem *>() << cmakeRunItem);
    shadowBuildItem->setNextItems(QList<Utils::WizardProgressItem *>() << cmakeRunItem);

    setStartId(startid);
    init();
}
void LibraryWizardDialog::cleanupPage(int id)
{
    if (m_targetPageId != -1 && (id == m_targetPageId || id == m_mobilePageId)) {
        Utils::WizardProgressItem *mobileItem = wizardProgress()->item(m_mobilePageId);
        mobileItem->setNextShownItem(0);
    }
    BaseQt4ProjectWizardDialog::cleanupPage(id);
}
void LibraryWizardDialog::cleanupPage(int id)
{
    if (m_targetPageId != -1 && id == m_targetPageId) {
        Utils::WizardProgressItem *targetsItem = wizardProgress()->item(m_targetPageId);
        targetsItem->setNextShownItem(0);
    }
    BaseQmakeProjectWizardDialog::cleanupPage(id);
}
void LibraryWizardDialog::initializePage(int id)
{
    if (m_targetPageId != -1 && (id == m_targetPageId || id == m_mobilePageId)) {
        Utils::WizardProgressItem *mobileItem = wizardProgress()->item(m_mobilePageId);
        Utils::WizardProgressItem *modulesItem = wizardProgress()->item(m_modulesPageId);
        Utils::WizardProgressItem *filesItem = wizardProgress()->item(m_filesPageId);
        if (isModulesPageSkipped())
            mobileItem->setNextShownItem(filesItem);
        else
            mobileItem->setNextShownItem(modulesItem);

    }
    BaseQt4ProjectWizardDialog::initializePage(id);
}
// ------------------- LibraryWizardDialog
LibraryWizardDialog::LibraryWizardDialog(const QString &templateName,
                                         const QIcon &icon,
                                         bool showModulesPage,
                                         QWidget *parent,
                                         const Core::WizardDialogParameters &parameters) :
    BaseQmakeProjectWizardDialog(showModulesPage, new LibraryIntroPage, -1, parent, parameters),
    m_filesPage(new FilesPage),
    m_pluginBaseClassesInitialized(false),
    m_filesPageId(-1), m_modulesPageId(-1), m_targetPageId(-1)
{
    setWindowIcon(icon);
    setWindowTitle(templateName);
    setSelectedModules(QLatin1String("core"));

    // Note that QWizard::currentIdChanged() is emitted at strange times.
    // Use the intro page instead, set up initially
    setIntroDescription(tr("This wizard generates a C++ Library project."));

    if (!parameters.extraValues().contains(QLatin1String(ProjectExplorer::Constants::PROJECT_KIT_IDS)))
        m_targetPageId = addTargetSetupPage();

    m_modulesPageId = addModulesPage();

    m_filesPage->setNamespacesEnabled(true);
    m_filesPage->setFormFileInputVisible(false);
    m_filesPage->setClassTypeComboVisible(false);

    m_filesPageId = addPage(m_filesPage);

    Utils::WizardProgressItem *introItem = wizardProgress()->item(startId());
    Utils::WizardProgressItem *targetItem = 0;
    if (m_targetPageId != -1)
        targetItem = wizardProgress()->item(m_targetPageId);
    Utils::WizardProgressItem *modulesItem = wizardProgress()->item(m_modulesPageId);
    Utils::WizardProgressItem *filesItem = wizardProgress()->item(m_filesPageId);
    filesItem->setTitle(tr("Details"));

    if (targetItem) {
        if (m_targetPageId != -1) {
            targetItem->setNextItems(QList<Utils::WizardProgressItem *>()
                                     << modulesItem << filesItem);
            targetItem->setNextShownItem(0);
        } else {
            introItem->setNextItems(QList<Utils::WizardProgressItem *>()
                                    << modulesItem << filesItem);
            introItem->setNextShownItem(0);
        }
    }

    connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));

    addExtensionPages(parameters.extensionPages());
}
Exemple #6
0
// ------------------- LibraryWizardDialog
LibraryWizardDialog::LibraryWizardDialog(const QString &templateName,
                                         const QIcon &icon,
                                         const QList<QWizardPage*> &extensionPages,
                                         bool showModulesPage,
                                         QWidget *parent) :
    BaseQt4ProjectWizardDialog(showModulesPage, new LibraryIntroPage, -1, parent),
    m_filesPage(new FilesPage),
    m_mobilePage(new MobileLibraryWizardOptionPage),
    m_pluginBaseClassesInitialized(false),
    m_filesPageId(-1), m_modulesPageId(-1), m_targetPageId(-1),
    m_mobilePageId(-1)
{
    setWindowIcon(icon);
    setWindowTitle(templateName);
    setSelectedModules(QLatin1String("core"));

    // Note that QWizard::currentIdChanged() is emitted at strange times.
    // Use the intro page instead, set up initially
    setIntroDescription(tr("This wizard generates a C++ library project."));

    m_targetPageId = addTargetSetupPage();

    if (m_targetPageId != -1)
        m_mobilePageId = addPage(m_mobilePage);

    m_modulesPageId = addModulesPage();

    m_filesPage->setNamespacesEnabled(true);
    m_filesPage->setFormFileInputVisible(false);
    m_filesPage->setClassTypeComboVisible(false);

    m_filesPageId = addPage(m_filesPage);

    Utils::WizardProgressItem *introItem = wizardProgress()->item(startId());
    Utils::WizardProgressItem *targetItem;
    if (m_targetPageId != -1)
        targetItem = wizardProgress()->item(m_targetPageId);
    Utils::WizardProgressItem *mobileItem = wizardProgress()->item(m_mobilePageId);
    mobileItem->setTitle(QLatin1String("    ") + tr("Symbian Specific"));
    Utils::WizardProgressItem *modulesItem = wizardProgress()->item(m_modulesPageId);
    Utils::WizardProgressItem *filesItem = wizardProgress()->item(m_filesPageId);
    filesItem->setTitle(tr("Details"));

    if (m_targetPageId != -1) {
        targetItem->setNextItems(QList<Utils::WizardProgressItem *>()
                                 << mobileItem << modulesItem << filesItem);
        targetItem->setNextShownItem(0);
        mobileItem->setNextItems(QList<Utils::WizardProgressItem *>()
                                 << modulesItem << filesItem);
        mobileItem->setNextShownItem(0);
    } else {
        introItem->setNextItems(QList<Utils::WizardProgressItem *>()
                                << modulesItem << filesItem);
        introItem->setNextShownItem(0);
    }


    connect(this, SIGNAL(currentIdChanged(int)), this, SLOT(slotCurrentIdChanged(int)));

    foreach (QWizardPage *p, extensionPages)
        Core::BaseFileWizard::applyExtensionPageShortTitle(this, addPage(p));
}