forked from qt-creator/qt-creator
Wizards: Sort
Introduce new QString id() const-API and sort wizards by [untranslated] category and id. Introduce respective constants. Rubber-stamped-by: con <qtc-committer@nokia.com>
This commit is contained in:
@@ -39,10 +39,6 @@
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtGui/QAction>
|
||||
|
||||
namespace Core {
|
||||
class IWizard;
|
||||
}
|
||||
|
||||
namespace BINEditor {
|
||||
class BinEditor;
|
||||
namespace Internal {
|
||||
@@ -85,8 +81,6 @@ private:
|
||||
friend class BinEditorFactory;
|
||||
Core::IEditor *createEditor(QWidget *parent);
|
||||
|
||||
typedef QList<Core::IWizard *> WizardList;
|
||||
WizardList m_wizards;
|
||||
BinEditorFactory *m_factory;
|
||||
QPointer<BinEditor> m_currentEditor;
|
||||
};
|
||||
|
||||
@@ -190,6 +190,7 @@ public:
|
||||
QIcon icon;
|
||||
QString description;
|
||||
QString name;
|
||||
QString id;
|
||||
QString category;
|
||||
QString trCategory;
|
||||
};
|
||||
@@ -250,7 +251,6 @@ void BaseFileWizardParameters::setDescription(const QString &v)
|
||||
m_d->description = v;
|
||||
}
|
||||
|
||||
|
||||
QString BaseFileWizardParameters::name() const
|
||||
{
|
||||
return m_d->name;
|
||||
@@ -261,6 +261,15 @@ void BaseFileWizardParameters::setName(const QString &v)
|
||||
m_d->name = v;
|
||||
}
|
||||
|
||||
QString BaseFileWizardParameters::id() const
|
||||
{
|
||||
return m_d->id;
|
||||
}
|
||||
|
||||
void BaseFileWizardParameters::setId(const QString &v)
|
||||
{
|
||||
m_d->id = v;
|
||||
}
|
||||
|
||||
QString BaseFileWizardParameters::category() const
|
||||
{
|
||||
@@ -412,6 +421,11 @@ QString BaseFileWizard::name() const
|
||||
return m_d->m_parameters.name();
|
||||
}
|
||||
|
||||
QString BaseFileWizard::id() const
|
||||
{
|
||||
return m_d->m_parameters.id();
|
||||
}
|
||||
|
||||
QString BaseFileWizard::category() const
|
||||
{
|
||||
return m_d->m_parameters.category();
|
||||
|
||||
@@ -117,6 +117,9 @@ public:
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
|
||||
QString id() const;
|
||||
void setId(const QString &id);
|
||||
|
||||
QString category() const;
|
||||
void setCategory(const QString &category);
|
||||
|
||||
@@ -152,6 +155,7 @@ public:
|
||||
virtual QIcon icon() const;
|
||||
virtual QString description() const;
|
||||
virtual QString name() const;
|
||||
virtual QString id() const;
|
||||
|
||||
virtual QString category() const;
|
||||
virtual QString trCategory() const;
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#ifndef CORECONSTANTS_H
|
||||
#define CORECONSTANTS_H
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
namespace Core {
|
||||
namespace Constants {
|
||||
|
||||
@@ -218,9 +220,8 @@ const char * const ICON_RESET = ":/core/images/reset.png";
|
||||
const char * const ICON_MAGNIFIER = ":/core/images/magnifier.png";
|
||||
const char * const ICON_TOGGLE_SIDEBAR = ":/core/images/sidebaricon.png";
|
||||
|
||||
// wizard kind
|
||||
const char * const WIZARD_TYPE_FILE = "QtCreator::WizardType::File";
|
||||
const char * const WIZARD_TYPE_CLASS = "QtCreator::WizardType::Class";
|
||||
const char * const WIZARD_CATEGORY_QT = "M.Qt";
|
||||
const char * const WIZARD_TR_CATEGORY_QT = QT_TRANSLATE_NOOP("Core", "Qt");
|
||||
|
||||
} // namespace Constants
|
||||
} // namespace Core
|
||||
|
||||
@@ -106,6 +106,12 @@
|
||||
dialog.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn QString IWizard::id() const
|
||||
Returns an arbitrary id that is used for sorting within the category.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\fn QString IWizard::category() const
|
||||
Returns a category ID to add the wizard to.
|
||||
|
||||
@@ -57,6 +57,7 @@ public:
|
||||
virtual QIcon icon() const = 0;
|
||||
virtual QString description() const = 0;
|
||||
virtual QString name() const = 0;
|
||||
virtual QString id() const = 0;
|
||||
|
||||
virtual QString category() const = 0;
|
||||
virtual QString trCategory() const = 0;
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
Q_DECLARE_METATYPE(Core::IWizard*)
|
||||
|
||||
@@ -70,10 +71,20 @@ NewDialog::NewDialog(QWidget *parent) :
|
||||
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
|
||||
}
|
||||
|
||||
void NewDialog::setWizards(const QList<IWizard*> wizards)
|
||||
// Sort by category. id
|
||||
bool wizardLessThan(const IWizard *w1, const IWizard *w2)
|
||||
{
|
||||
if (const int cc = w1->category().compare(w2->category()))
|
||||
return cc < 0;
|
||||
return w1->id().compare(w2->id()) < 0;
|
||||
}
|
||||
|
||||
void NewDialog::setWizards(QList<IWizard*> wizards)
|
||||
{
|
||||
typedef QMap<QString, QTreeWidgetItem *> CategoryItemMap;
|
||||
|
||||
qStableSort(wizards.begin(), wizards.end(), wizardLessThan);
|
||||
|
||||
CategoryItemMap categories;
|
||||
QVariant wizardPtr;
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
explicit NewDialog(QWidget *parent);
|
||||
virtual ~NewDialog();
|
||||
|
||||
void setWizards(const QList<IWizard*> wizards);
|
||||
void setWizards(QList<IWizard*> wizards);
|
||||
|
||||
Core::IWizard *showDialog();
|
||||
|
||||
|
||||
@@ -203,21 +203,25 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
|
||||
|
||||
CppFileWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
|
||||
|
||||
wizardParameters.setCategory(QLatin1String("C++"));
|
||||
wizardParameters.setCategory(QLatin1String("C.C++"));
|
||||
wizardParameters.setTrCategory(tr("C++"));
|
||||
wizardParameters.setDescription(tr("Creates a C++ header file."));
|
||||
wizardParameters.setName(tr("C++ Header File"));
|
||||
addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, core));
|
||||
|
||||
wizardParameters.setDescription(tr("Creates a C++ source file."));
|
||||
wizardParameters.setName(tr("C++ Source File"));
|
||||
addAutoReleasedObject(new CppFileWizard(wizardParameters, Source, core));
|
||||
|
||||
wizardParameters.setKind(Core::IWizard::ClassWizard);
|
||||
wizardParameters.setName(tr("C++ Class"));
|
||||
wizardParameters.setId(QLatin1String("A.Class"));
|
||||
wizardParameters.setKind(Core::IWizard::ClassWizard);
|
||||
wizardParameters.setDescription(tr("Creates a header and a source file for a new class."));
|
||||
addAutoReleasedObject(new CppClassWizard(wizardParameters, core));
|
||||
|
||||
wizardParameters.setKind(Core::IWizard::FileWizard);
|
||||
wizardParameters.setDescription(tr("Creates a C++ source file."));
|
||||
wizardParameters.setName(tr("C++ Source File"));
|
||||
wizardParameters.setId(QLatin1String("B.Source"));
|
||||
addAutoReleasedObject(new CppFileWizard(wizardParameters, Source, core));
|
||||
|
||||
wizardParameters.setDescription(tr("Creates a C++ header file."));
|
||||
wizardParameters.setName(tr("C++ Header File"));
|
||||
wizardParameters.setId(QLatin1String("C.Header"));
|
||||
addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, core));
|
||||
|
||||
QList<int> context;
|
||||
context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "cvsplugin.h"
|
||||
|
||||
#include <vcsbase/checkoutjobs.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtGui/QIcon>
|
||||
@@ -42,6 +43,7 @@ namespace Internal {
|
||||
CheckoutWizard::CheckoutWizard(QObject *parent) :
|
||||
VCSBase::BaseCheckoutWizard(parent)
|
||||
{
|
||||
setId(QLatin1String(VCSBase::Constants::VCS_ID_CVS));
|
||||
}
|
||||
|
||||
QIcon CheckoutWizard::icon() const
|
||||
|
||||
@@ -133,16 +133,18 @@ void FormEditorPlugin::extensionsInitialized()
|
||||
void FormEditorPlugin::initializeTemplates()
|
||||
{
|
||||
FormWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
|
||||
wizardParameters.setCategory(QLatin1String("Qt"));
|
||||
wizardParameters.setTrCategory(tr("Qt"));
|
||||
wizardParameters.setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
wizardParameters.setTrCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
const QString formFileType = QLatin1String(Constants::FORM_FILE_TYPE);
|
||||
wizardParameters.setName(tr("Qt Designer Form"));
|
||||
wizardParameters.setId(QLatin1String("D.Form"));
|
||||
wizardParameters.setDescription(tr("Creates a Qt Designer form file (.ui)."));
|
||||
addAutoReleasedObject(new FormWizard(wizardParameters, this));
|
||||
|
||||
#ifdef CPP_ENABLED
|
||||
wizardParameters.setKind(Core::IWizard::ClassWizard);
|
||||
wizardParameters.setName(tr("Qt Designer Form Class"));
|
||||
wizardParameters.setId(QLatin1String("C.FormClass"));
|
||||
wizardParameters.setDescription(tr("Creates a Qt Designer form file (.ui) with a matching class."));
|
||||
addAutoReleasedObject(new FormClassWizard(wizardParameters, this));
|
||||
addAutoReleasedObject(new CppSettingsPage);
|
||||
|
||||
@@ -32,92 +32,22 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/filenamevalidatinglineedit.h>
|
||||
#include <utils/filewizardpage.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QtDebug>
|
||||
|
||||
#include <QtGui/QDirModel>
|
||||
#include <QtGui/QFormLayout>
|
||||
#include <QtGui/QListView>
|
||||
#include <QtGui/QTreeView>
|
||||
#include <QtCore/QCoreApplication>
|
||||
|
||||
using namespace GenericProjectManager::Internal;
|
||||
using namespace Utils;
|
||||
|
||||
namespace {
|
||||
|
||||
class DirModel : public QDirModel
|
||||
{
|
||||
public:
|
||||
DirModel(QObject *parent)
|
||||
: QDirModel(parent)
|
||||
{ setFilter(QDir::Dirs | QDir::NoDotAndDotDot); }
|
||||
|
||||
virtual ~DirModel()
|
||||
{ }
|
||||
|
||||
public:
|
||||
virtual int columnCount(const QModelIndex &) const
|
||||
{ return 1; }
|
||||
|
||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const
|
||||
{ return QDirModel::flags(index) | Qt::ItemIsUserCheckable; }
|
||||
|
||||
virtual QVariant data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (index.column() == 0 && role == Qt::CheckStateRole) {
|
||||
if (m_selectedPaths.contains(index))
|
||||
return Qt::Checked;
|
||||
|
||||
return Qt::Unchecked;
|
||||
}
|
||||
|
||||
return QDirModel::data(index, role);
|
||||
}
|
||||
|
||||
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if (index.column() == 0 && role == Qt::CheckStateRole) {
|
||||
if (value.toBool())
|
||||
m_selectedPaths.insert(index);
|
||||
else
|
||||
m_selectedPaths.remove(index);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return QDirModel::setData(index, value, role);
|
||||
}
|
||||
|
||||
void clearSelectedPaths()
|
||||
{ m_selectedPaths.clear(); }
|
||||
|
||||
QSet<QString> selectedPaths() const
|
||||
{
|
||||
QSet<QString> paths;
|
||||
|
||||
foreach (const QModelIndex &index, m_selectedPaths)
|
||||
paths.insert(filePath(index));
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
private:
|
||||
QSet<QModelIndex> m_selectedPaths;
|
||||
};
|
||||
|
||||
} // end of anonymous namespace
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// GenericProjectWizardDialog
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
GenericProjectWizardDialog::GenericProjectWizardDialog(QWidget *parent)
|
||||
: QWizard(parent)
|
||||
{
|
||||
@@ -130,44 +60,6 @@ GenericProjectWizardDialog::GenericProjectWizardDialog(QWidget *parent)
|
||||
m_firstPage->setPathLabel(tr("Location:"));
|
||||
|
||||
addPage(m_firstPage);
|
||||
|
||||
#if 0
|
||||
// second page
|
||||
QWizardPage *secondPage = new QWizardPage;
|
||||
secondPage->setTitle(tr("Second Page Title"));
|
||||
|
||||
QFormLayout *secondPageLayout = new QFormLayout(secondPage);
|
||||
|
||||
m_dirView = new QTreeView;
|
||||
m_dirModel = new DirModel(this);
|
||||
m_dirView->setModel(_dirModel);
|
||||
|
||||
Core::ICore *core = Core::ICore::instance();
|
||||
Core::MimeDatabase *mimeDatabase = core->mimeDatabase();
|
||||
|
||||
const QStringList suffixes = mimeDatabase->suffixes();
|
||||
|
||||
QStringList nameFilters;
|
||||
foreach (const QString &suffix, suffixes) {
|
||||
QString nameFilter;
|
||||
nameFilter.append(QLatin1String("*."));
|
||||
nameFilter.append(suffix);
|
||||
nameFilters.append(nameFilter);
|
||||
}
|
||||
|
||||
m_filesView = new QListView;
|
||||
m_filesModel = new QDirModel(this);
|
||||
m_filesModel->setNameFilters(nameFilters);
|
||||
m_filesModel->setFilter(QDir::Files);
|
||||
|
||||
connect(_dirView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
|
||||
this, SLOT(updateFilesView(QModelIndex,QModelIndex)));
|
||||
|
||||
secondPageLayout->addRow(_dirView);
|
||||
secondPageLayout->addRow(_filesView);
|
||||
|
||||
m_secondPageId = addPage(secondPage);
|
||||
#endif
|
||||
}
|
||||
|
||||
GenericProjectWizardDialog::~GenericProjectWizardDialog()
|
||||
@@ -188,50 +80,6 @@ QString GenericProjectWizardDialog::projectName() const
|
||||
return m_firstPage->name();
|
||||
}
|
||||
|
||||
void GenericProjectWizardDialog::updateFilesView(const QModelIndex ¤t,
|
||||
const QModelIndex &)
|
||||
{
|
||||
if (! current.isValid())
|
||||
m_filesView->setModel(0);
|
||||
|
||||
else {
|
||||
const QString selectedPath = m_dirModel->filePath(current);
|
||||
|
||||
if (! m_filesView->model())
|
||||
m_filesView->setModel(m_filesModel);
|
||||
|
||||
m_filesView->setRootIndex(m_filesModel->index(selectedPath));
|
||||
}
|
||||
}
|
||||
|
||||
void GenericProjectWizardDialog::initializePage(int id)
|
||||
{
|
||||
Q_UNUSED(id)
|
||||
#if 0
|
||||
if (id == m_secondPageId) {
|
||||
using namespace Utils;
|
||||
|
||||
const QString projectPath = m_pathChooser->path();
|
||||
|
||||
QDirModel *dirModel = qobject_cast<QDirModel *>(_dirView->model());
|
||||
m_dirView->setRootIndex(dirModel->index(projectPath));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool GenericProjectWizardDialog::validateCurrentPage()
|
||||
{
|
||||
using namespace Utils;
|
||||
|
||||
#if 0
|
||||
if (currentId() == m_secondPageId) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
return QWizard::validateCurrentPage();
|
||||
}
|
||||
|
||||
GenericProjectWizard::GenericProjectWizard()
|
||||
: Core::BaseFileWizard(parameters())
|
||||
{ }
|
||||
@@ -244,9 +92,10 @@ Core::BaseFileWizardParameters GenericProjectWizard::parameters()
|
||||
static Core::BaseFileWizardParameters parameters(ProjectWizard);
|
||||
parameters.setIcon(QIcon(":/wizards/images/console.png"));
|
||||
parameters.setName(tr("Import of Makefile-based Project"));
|
||||
parameters.setId(QLatin1String("Z.Makefile"));
|
||||
parameters.setDescription(tr("Creates a generic project, supporting any build system."));
|
||||
parameters.setCategory(QLatin1String("Projects"));
|
||||
parameters.setTrCategory(tr("Projects"));
|
||||
parameters.setCategory(QLatin1String(ProjectExplorer::Constants::PROJECT_WIZARD_CATEGORY));
|
||||
parameters.setTrCategory(QCoreApplication::translate("ProjectExplorer", ProjectExplorer::Constants::PROJECT_WIZARD_TR_CATEGORY));
|
||||
return parameters;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,13 +35,8 @@
|
||||
#include <QtGui/QWizard>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QDir;
|
||||
class QDirModel;
|
||||
class QFileInfo;
|
||||
class QListView;
|
||||
class QModelIndex;
|
||||
class QStringList;
|
||||
class QTreeView;
|
||||
class QDir;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils {
|
||||
@@ -66,24 +61,7 @@ public:
|
||||
|
||||
QString projectName() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void updateFilesView(const QModelIndex ¤t,
|
||||
const QModelIndex &previous);
|
||||
|
||||
protected:
|
||||
virtual void initializePage(int id);
|
||||
virtual bool validateCurrentPage();
|
||||
|
||||
private:
|
||||
int m_secondPageId;
|
||||
|
||||
Utils::FileWizardPage *m_firstPage;
|
||||
|
||||
QTreeView *m_dirView;
|
||||
QDirModel *m_dirModel;
|
||||
|
||||
QListView *m_filesView;
|
||||
QDirModel *m_filesModel;
|
||||
};
|
||||
|
||||
class GenericProjectWizard : public Core::BaseFileWizard
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "clonewizardpage.h"
|
||||
|
||||
#include <vcsbase/checkoutjobs.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtGui/QIcon>
|
||||
@@ -41,6 +42,7 @@ namespace Internal {
|
||||
CloneWizard::CloneWizard(QObject *parent) :
|
||||
VCSBase::BaseCheckoutWizard(parent)
|
||||
{
|
||||
setId(QLatin1String(VCSBase::Constants::VCS_ID_GIT));
|
||||
}
|
||||
|
||||
QIcon CloneWizard::icon() const
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "clonewizardpage.h"
|
||||
|
||||
#include <vcsbase/checkoutjobs.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QUrl>
|
||||
@@ -69,6 +70,7 @@ void GitoriousCloneWizardPage::initializePage()
|
||||
GitoriousCloneWizard::GitoriousCloneWizard(QObject *parent) :
|
||||
VCSBase::BaseCheckoutWizard(parent)
|
||||
{
|
||||
setId(QLatin1String(VCSBase::Constants::VCS_ID_GIT));
|
||||
}
|
||||
|
||||
QIcon GitoriousCloneWizard::icon() const
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "mercurialsettings.h"
|
||||
|
||||
#include <vcsbase/checkoutjobs.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
@@ -42,6 +43,7 @@ CloneWizard::CloneWizard(QObject *parent)
|
||||
: VCSBase::BaseCheckoutWizard(parent),
|
||||
m_icon(QIcon(QLatin1String(":/mercurial/images/hg.png")))
|
||||
{
|
||||
setId(QLatin1String(VCSBase::Constants::VCS_ID_MERCURIAL));
|
||||
}
|
||||
|
||||
QIcon CloneWizard::icon() const
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#ifndef PROJECTEXPLORERCONSTANTS_H
|
||||
#define PROJECTEXPLORERCONSTANTS_H
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Constants {
|
||||
|
||||
@@ -194,6 +196,10 @@ const char * const PROJECTEXPLORER_PAGE = "ProjectExplorer.Projec
|
||||
const char * const TASK_CATEGORY_COMPILE = "Task.Category.Compile";
|
||||
const char * const TASK_CATEGORY_BUILDSYSTEM = "Task.Category.Buildsystem";
|
||||
|
||||
// Wizard category
|
||||
const char * const PROJECT_WIZARD_CATEGORY = "R.Projects"; // (after Qt)
|
||||
const char * const PROJECT_WIZARD_TR_CATEGORY = QT_TRANSLATE_NOOP("ProjectExplorer", "Projects");
|
||||
|
||||
} // namespace Constants
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
|
||||
@@ -102,10 +102,11 @@ bool QmlEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
||||
addObject(m_editor);
|
||||
|
||||
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
|
||||
wizardParameters.setCategory(QLatin1String("Qt"));
|
||||
wizardParameters.setTrCategory(tr("Qt"));
|
||||
wizardParameters.setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
wizardParameters.setTrCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
wizardParameters.setDescription(tr("Creates a Qt QML file."));
|
||||
wizardParameters.setName(tr("Qt QML File"));
|
||||
wizardParameters.setId(QLatin1String("Q.Qml"));
|
||||
addAutoReleasedObject(new QmlFileWizard(wizardParameters, core));
|
||||
|
||||
m_actionHandler = new TextEditor::TextEditorActionHandler(QmlEditor::Constants::C_QMLEDITOR,
|
||||
|
||||
@@ -30,8 +30,10 @@
|
||||
#include "qmlnewprojectwizard.h"
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QCoreApplication>
|
||||
|
||||
using namespace QmlProjectManager::Internal;
|
||||
|
||||
@@ -56,11 +58,12 @@ QmlNewProjectWizard::~QmlNewProjectWizard()
|
||||
Core::BaseFileWizardParameters QmlNewProjectWizard::parameters()
|
||||
{
|
||||
static Core::BaseFileWizardParameters parameters(ProjectWizard);
|
||||
parameters.setIcon(QIcon(":/wizards/images/console.png"));
|
||||
parameters.setIcon(QIcon(QLatin1String(":/wizards/images/console.png")));
|
||||
parameters.setName(tr("QML Application"));
|
||||
parameters.setId(QLatin1String("QA.QML Application"));
|
||||
parameters.setDescription(tr("Creates a QML application."));
|
||||
parameters.setCategory(QLatin1String("Projects"));
|
||||
parameters.setTrCategory(tr("Projects"));
|
||||
parameters.setCategory(QLatin1String(ProjectExplorer::Constants::PROJECT_WIZARD_CATEGORY));
|
||||
parameters.setTrCategory(QCoreApplication::translate("ProjectExplorer", ProjectExplorer::Constants::PROJECT_WIZARD_TR_CATEGORY));
|
||||
return parameters;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,92 +32,22 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/filenamevalidatinglineedit.h>
|
||||
#include <utils/filewizardpage.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QtDebug>
|
||||
|
||||
#include <QtGui/QDirModel>
|
||||
#include <QtGui/QFormLayout>
|
||||
#include <QtGui/QListView>
|
||||
#include <QtGui/QTreeView>
|
||||
#include <QtCore/QCoreApplication>
|
||||
|
||||
using namespace QmlProjectManager::Internal;
|
||||
using namespace Utils;
|
||||
|
||||
namespace {
|
||||
|
||||
class DirModel : public QDirModel
|
||||
{
|
||||
public:
|
||||
DirModel(QObject *parent)
|
||||
: QDirModel(parent)
|
||||
{ setFilter(QDir::Dirs | QDir::NoDotAndDotDot); }
|
||||
|
||||
virtual ~DirModel()
|
||||
{ }
|
||||
|
||||
public:
|
||||
virtual int columnCount(const QModelIndex &) const
|
||||
{ return 1; }
|
||||
|
||||
virtual Qt::ItemFlags flags(const QModelIndex &index) const
|
||||
{ return QDirModel::flags(index) | Qt::ItemIsUserCheckable; }
|
||||
|
||||
virtual QVariant data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (index.column() == 0 && role == Qt::CheckStateRole) {
|
||||
if (m_selectedPaths.contains(index))
|
||||
return Qt::Checked;
|
||||
|
||||
return Qt::Unchecked;
|
||||
}
|
||||
|
||||
return QDirModel::data(index, role);
|
||||
}
|
||||
|
||||
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if (index.column() == 0 && role == Qt::CheckStateRole) {
|
||||
if (value.toBool())
|
||||
m_selectedPaths.insert(index);
|
||||
else
|
||||
m_selectedPaths.remove(index);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return QDirModel::setData(index, value, role);
|
||||
}
|
||||
|
||||
void clearSelectedPaths()
|
||||
{ m_selectedPaths.clear(); }
|
||||
|
||||
QSet<QString> selectedPaths() const
|
||||
{
|
||||
QSet<QString> paths;
|
||||
|
||||
foreach (const QModelIndex &index, m_selectedPaths)
|
||||
paths.insert(filePath(index));
|
||||
|
||||
return paths;
|
||||
}
|
||||
|
||||
private:
|
||||
QSet<QModelIndex> m_selectedPaths;
|
||||
};
|
||||
|
||||
} // end of anonymous namespace
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// QmlProjectWizardDialog
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
QmlProjectWizardDialog::QmlProjectWizardDialog(QWidget *parent)
|
||||
: QWizard(parent)
|
||||
{
|
||||
@@ -150,32 +80,6 @@ QString QmlProjectWizardDialog::projectName() const
|
||||
return m_firstPage->name();
|
||||
}
|
||||
|
||||
void QmlProjectWizardDialog::updateFilesView(const QModelIndex ¤t,
|
||||
const QModelIndex &)
|
||||
{
|
||||
if (! current.isValid())
|
||||
m_filesView->setModel(0);
|
||||
|
||||
else {
|
||||
const QString selectedPath = m_dirModel->filePath(current);
|
||||
|
||||
if (! m_filesView->model())
|
||||
m_filesView->setModel(m_filesModel);
|
||||
|
||||
m_filesView->setRootIndex(m_filesModel->index(selectedPath));
|
||||
}
|
||||
}
|
||||
|
||||
void QmlProjectWizardDialog::initializePage(int id)
|
||||
{
|
||||
Q_UNUSED(id)
|
||||
}
|
||||
|
||||
bool QmlProjectWizardDialog::validateCurrentPage()
|
||||
{
|
||||
return QWizard::validateCurrentPage();
|
||||
}
|
||||
|
||||
QmlProjectWizard::QmlProjectWizard()
|
||||
: Core::BaseFileWizard(parameters())
|
||||
{ }
|
||||
@@ -186,11 +90,12 @@ QmlProjectWizard::~QmlProjectWizard()
|
||||
Core::BaseFileWizardParameters QmlProjectWizard::parameters()
|
||||
{
|
||||
static Core::BaseFileWizardParameters parameters(ProjectWizard);
|
||||
parameters.setIcon(QIcon(":/wizards/images/console.png"));
|
||||
parameters.setIcon(QIcon(QLatin1String(":/wizards/images/console.png")));
|
||||
parameters.setName(tr("Import of existing QML directory"));
|
||||
parameters.setId(QLatin1String("QI.QML Import"));
|
||||
parameters.setDescription(tr("Creates a QML project from an existing directory of QML files."));
|
||||
parameters.setCategory(QLatin1String("Projects"));
|
||||
parameters.setTrCategory(tr("Projects"));
|
||||
parameters.setCategory(QLatin1String(ProjectExplorer::Constants::PROJECT_WIZARD_CATEGORY));
|
||||
parameters.setTrCategory(QCoreApplication::translate("ProjectExplorer", ProjectExplorer::Constants::PROJECT_WIZARD_TR_CATEGORY));
|
||||
return parameters;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,14 +64,6 @@ public:
|
||||
|
||||
QString projectName() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void updateFilesView(const QModelIndex ¤t,
|
||||
const QModelIndex &previous);
|
||||
|
||||
protected:
|
||||
virtual void initializePage(int id);
|
||||
virtual bool validateCurrentPage();
|
||||
|
||||
private:
|
||||
int m_secondPageId;
|
||||
|
||||
|
||||
@@ -39,9 +39,10 @@ namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
CustomWidgetWizard::CustomWidgetWizard() :
|
||||
QtWizard(tr("Qt4 Designer Custom Widget"),
|
||||
QtWizard(QLatin1String("P.Qt4CustomWidget"),
|
||||
tr("Qt4 Designer Custom Widget"),
|
||||
tr("Creates a Qt4 Designer Custom Widget or a Custom Widget Collection."),
|
||||
QIcon(":/wizards/images/gui.png"))
|
||||
QIcon(QLatin1String(":/wizards/images/gui.png")))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -55,9 +55,10 @@ namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
ConsoleAppWizard::ConsoleAppWizard()
|
||||
: QtWizard(tr("Qt4 Console Application"),
|
||||
: QtWizard(QLatin1String("D.Qt4Core"),
|
||||
tr("Qt4 Console Application"),
|
||||
tr("Creates a Qt4 console application."),
|
||||
QIcon(":/wizards/images/console.png"))
|
||||
QIcon(QLatin1String(":/wizards/images/console.png")))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,10 @@ namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
EmptyProjectWizard::EmptyProjectWizard()
|
||||
: QtWizard(tr("Empty Qt4 Project"),
|
||||
: QtWizard(QLatin1String("E.Qt4Empty"),
|
||||
tr("Empty Qt4 Project"),
|
||||
tr("Creates an empty Qt project."),
|
||||
QIcon(":/wizards/images/gui.png"))
|
||||
QIcon(QLatin1String(":/wizards/images/gui.png")))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -72,9 +72,10 @@ namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
GuiAppWizard::GuiAppWizard()
|
||||
: QtWizard(tr("Qt4 Gui Application"),
|
||||
: QtWizard(QLatin1String("C.Qt4Gui"),
|
||||
tr("Qt4 Gui Application"),
|
||||
tr("Creates a Qt4 Gui Application with one form."),
|
||||
QIcon(":/wizards/images/gui.png"))
|
||||
QIcon(QLatin1String(":/wizards/images/gui.png")))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -47,9 +47,10 @@ namespace Qt4ProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
LibraryWizard::LibraryWizard()
|
||||
: QtWizard(tr("C++ Library"),
|
||||
: QtWizard(QLatin1String("Q.Qt4Library"),
|
||||
tr("C++ Library"),
|
||||
tr("Creates a C++ Library."),
|
||||
QIcon(":/wizards/images/lib.png"))
|
||||
QIcon(QLatin1String(":/wizards/images/lib.png")))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <cpptools/cpptoolsconstants.h>
|
||||
|
||||
#include <QtCore/QByteArray>
|
||||
@@ -48,22 +49,25 @@ using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
static inline Core::BaseFileWizardParameters
|
||||
wizardParameters(const QString &name,
|
||||
wizardParameters(const QString &id,
|
||||
const QString &name,
|
||||
const QString &description,
|
||||
const QIcon &icon)
|
||||
{
|
||||
Core::BaseFileWizardParameters rc(Core::IWizard::ProjectWizard);
|
||||
rc.setCategory(QLatin1String("Projects"));
|
||||
rc.setTrCategory("Projects");
|
||||
rc.setCategory(QLatin1String(ProjectExplorer::Constants::PROJECT_WIZARD_CATEGORY));
|
||||
rc.setTrCategory(QCoreApplication::translate("ProjectExplorer", ProjectExplorer::Constants::PROJECT_WIZARD_TR_CATEGORY));
|
||||
rc.setIcon(icon);
|
||||
rc.setName(name);
|
||||
rc.setId(id);
|
||||
rc.setDescription(description);
|
||||
return rc;
|
||||
}
|
||||
|
||||
// -------------------- QtWizard
|
||||
QtWizard::QtWizard(const QString &name, const QString &description, const QIcon &icon) :
|
||||
Core::BaseFileWizard(wizardParameters(name, description, icon))
|
||||
QtWizard::QtWizard(const QString &id, const QString &name,
|
||||
const QString &description, const QIcon &icon) :
|
||||
Core::BaseFileWizard(wizardParameters(id, name, description, icon))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,10 @@ class QtWizard : public Core::BaseFileWizard
|
||||
Q_DISABLE_COPY(QtWizard)
|
||||
|
||||
protected:
|
||||
QtWizard(const QString &name, const QString &description, const QIcon &icon);
|
||||
QtWizard(const QString &id,
|
||||
const QString &name,
|
||||
const QString &description,
|
||||
const QIcon &icon);
|
||||
|
||||
QString templateDir() const;
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtGui/QAction>
|
||||
|
||||
using namespace QtScriptEditor::Internal;
|
||||
@@ -101,8 +102,9 @@ bool QtScriptEditorPlugin::initialize(const QStringList & /*arguments*/, QString
|
||||
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
|
||||
wizardParameters.setDescription(tr("Creates a Qt Script file."));
|
||||
wizardParameters.setName(tr("Qt Script file"));
|
||||
wizardParameters.setCategory(QLatin1String("Qt"));
|
||||
wizardParameters.setTrCategory(tr("Qt"));
|
||||
wizardParameters.setId(QLatin1String("Z.Script"));
|
||||
wizardParameters.setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
wizardParameters.setTrCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
m_wizard = new TextEditor::TextFileWizard(QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR_MIMETYPE),
|
||||
QLatin1String(QtScriptEditor::Constants::C_QTSCRIPTEDITOR),
|
||||
QLatin1String("qtscript$"),
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtGui/QAction>
|
||||
|
||||
using namespace ResourceEditor::Internal;
|
||||
@@ -76,8 +77,9 @@ bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *err
|
||||
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
|
||||
wizardParameters.setDescription(tr("Creates a Qt Resource file (.qrc)."));
|
||||
wizardParameters.setName(tr("Qt Resource file"));
|
||||
wizardParameters.setCategory(QLatin1String("Qt"));
|
||||
wizardParameters.setTrCategory(tr("Qt"));
|
||||
wizardParameters.setId(QLatin1String("F.Resource"));
|
||||
wizardParameters.setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||
wizardParameters.setTrCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||
|
||||
m_wizard = new ResourceWizard(wizardParameters, this);
|
||||
addObject(m_wizard);
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "subversionplugin.h"
|
||||
|
||||
#include <vcsbase/checkoutjobs.h>
|
||||
#include <vcsbase/vcsbaseconstants.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtGui/QIcon>
|
||||
@@ -42,6 +43,7 @@ namespace Internal {
|
||||
CheckoutWizard::CheckoutWizard(QObject *parent) :
|
||||
VCSBase::BaseCheckoutWizard(parent)
|
||||
{
|
||||
setId(QLatin1String(VCSBase::Constants::VCS_ID_SUBVERSION));
|
||||
}
|
||||
|
||||
QIcon CheckoutWizard::icon() const
|
||||
|
||||
@@ -93,7 +93,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
|
||||
Core::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
|
||||
wizardParameters.setDescription(tr("Creates a text file (.txt)."));
|
||||
wizardParameters.setName(tr("Text File"));
|
||||
wizardParameters.setCategory(QLatin1String("General"));
|
||||
wizardParameters.setCategory(QLatin1String("O.General"));
|
||||
wizardParameters.setTrCategory(tr("General"));
|
||||
m_wizard = new TextFileWizard(QLatin1String(TextEditor::Constants::C_TEXTEDITOR_MIMETYPE_TEXT),
|
||||
QLatin1String(Core::Constants::K_DEFAULT_TEXT_EDITOR),
|
||||
|
||||
@@ -49,6 +49,7 @@ struct BaseCheckoutWizardPrivate {
|
||||
Internal::CheckoutWizardDialog *dialog;
|
||||
QList<QWizardPage *> parameterPages;
|
||||
QString checkoutPath;
|
||||
QString id;
|
||||
};
|
||||
|
||||
void BaseCheckoutWizardPrivate::clear()
|
||||
@@ -81,7 +82,17 @@ QString BaseCheckoutWizard::category() const
|
||||
|
||||
QString BaseCheckoutWizard::trCategory() const
|
||||
{
|
||||
return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_WIZARD_CATEGORY);
|
||||
return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_WIZARD_TR_CATEGORY);
|
||||
}
|
||||
|
||||
QString BaseCheckoutWizard::id() const
|
||||
{
|
||||
return d->id;
|
||||
}
|
||||
|
||||
void BaseCheckoutWizard::setId(const QString &id)
|
||||
{
|
||||
d->id = id;
|
||||
}
|
||||
|
||||
QStringList BaseCheckoutWizard::runWizard(const QString &path, QWidget *parent)
|
||||
|
||||
@@ -71,6 +71,7 @@ public:
|
||||
|
||||
virtual QString category() const;
|
||||
virtual QString trCategory() const;
|
||||
virtual QString id() const;
|
||||
|
||||
virtual QStringList runWizard(const QString &path, QWidget *parent);
|
||||
|
||||
@@ -81,6 +82,9 @@ protected:
|
||||
virtual QSharedPointer<AbstractCheckoutJob> createJob(const QList<QWizardPage *> ¶meterPages,
|
||||
QString *checkoutPath) = 0;
|
||||
|
||||
public slots:
|
||||
void setId(const QString &id);
|
||||
|
||||
private slots:
|
||||
void slotProgressPageShown();
|
||||
|
||||
|
||||
@@ -38,7 +38,15 @@ namespace Constants {
|
||||
const char * const VCS_SETTINGS_CATEGORY = QT_TRANSLATE_NOOP("VCSBase", "Version Control");
|
||||
const char * const VCS_COMMON_SETTINGS_ID = QT_TRANSLATE_NOOP("VCSBase", "Common");
|
||||
|
||||
const char * const VCS_WIZARD_CATEGORY = QT_TRANSLATE_NOOP("VCSBase", "Version Control");
|
||||
const char * const VCS_WIZARD_TR_CATEGORY = QT_TRANSLATE_NOOP("VCSBase", "Version Control");
|
||||
const char * const VCS_WIZARD_CATEGORY = "Z.Version Control";
|
||||
|
||||
// Ids for sort order
|
||||
const char * const VCS_ID_GIT = "G.Git";
|
||||
const char * const VCS_ID_MERCURIAL = "H.Mercurial";
|
||||
const char * const VCS_ID_SUBVERSION = "J.Subversion";
|
||||
const char * const VCS_ID_PERFORCE = "P.Perforce";
|
||||
const char * const VCS_ID_CVS = "Z.CVS";
|
||||
|
||||
namespace Internal {
|
||||
enum { debug = 0 };
|
||||
|
||||
Reference in New Issue
Block a user