forked from qt-creator/qt-creator
Make method naming more consistent.
* Use id() for methods returning a string used to represent
some type of object.
* Use displayName() for strings that are meant to be user
visible.
* Quieten some warnings while touching the files anyway.
* Move Factories to their products in the plugins where that
was not done before.
Reviewed-by: dt
This commit is contained in:
@@ -46,9 +46,9 @@ FileWizardDialog::FileWizardDialog(QWidget *parent) :
|
|||||||
connect(m_filePage, SIGNAL(activated()), button(QWizard::FinishButton), SLOT(animateClick()));
|
connect(m_filePage, SIGNAL(activated()), button(QWizard::FinishButton), SLOT(animateClick()));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FileWizardDialog::name() const
|
QString FileWizardDialog::fileName() const
|
||||||
{
|
{
|
||||||
return m_filePage->name();
|
return m_filePage->fileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FileWizardDialog::path() const
|
QString FileWizardDialog::path() const
|
||||||
@@ -62,9 +62,9 @@ void FileWizardDialog::setPath(const QString &path)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileWizardDialog::setName(const QString &name)
|
void FileWizardDialog::setFileName(const QString &name)
|
||||||
{
|
{
|
||||||
m_filePage->setName(name);
|
m_filePage->setFileName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Utils
|
} // namespace Utils
|
||||||
|
|||||||
@@ -49,12 +49,12 @@ class QTCREATOR_UTILS_EXPORT FileWizardDialog : public QWizard {
|
|||||||
public:
|
public:
|
||||||
explicit FileWizardDialog(QWidget *parent = 0);
|
explicit FileWizardDialog(QWidget *parent = 0);
|
||||||
|
|
||||||
QString name() const;
|
QString fileName() const;
|
||||||
QString path() const;
|
QString path() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setPath(const QString &path);
|
void setPath(const QString &path);
|
||||||
void setName(const QString &name);
|
void setFileName(const QString &name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FileWizardPage *m_filePage;
|
FileWizardPage *m_filePage;
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ FileWizardPage::~FileWizardPage()
|
|||||||
delete m_d;
|
delete m_d;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FileWizardPage::name() const
|
QString FileWizardPage::fileName() const
|
||||||
{
|
{
|
||||||
return m_d->m_ui.nameLineEdit->text();
|
return m_d->m_ui.nameLineEdit->text();
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ void FileWizardPage::setPath(const QString &path)
|
|||||||
m_d->m_ui.pathChooser->setPath(path);
|
m_d->m_ui.pathChooser->setPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileWizardPage::setName(const QString &name)
|
void FileWizardPage::setFileName(const QString &name)
|
||||||
{
|
{
|
||||||
m_d->m_ui.nameLineEdit->setText(name);
|
m_d->m_ui.nameLineEdit->setText(name);
|
||||||
}
|
}
|
||||||
@@ -98,7 +98,7 @@ bool FileWizardPage::isComplete() const
|
|||||||
return m_d->m_complete;
|
return m_d->m_complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileWizardPage::setNameLabel(const QString &label)
|
void FileWizardPage::setFileNameLabel(const QString &label)
|
||||||
{
|
{
|
||||||
m_d->m_ui.nameLabel->setText(label);
|
m_d->m_ui.nameLabel->setText(label);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,17 +50,17 @@ class QTCREATOR_UTILS_EXPORT FileWizardPage : public QWizardPage
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DISABLE_COPY(FileWizardPage)
|
Q_DISABLE_COPY(FileWizardPage)
|
||||||
Q_PROPERTY(QString path READ path WRITE setPath DESIGNABLE true)
|
Q_PROPERTY(QString path READ path WRITE setPath DESIGNABLE true)
|
||||||
Q_PROPERTY(QString name READ name WRITE setName DESIGNABLE true)
|
Q_PROPERTY(QString fileName READ fileName WRITE setFileName DESIGNABLE true)
|
||||||
public:
|
public:
|
||||||
explicit FileWizardPage(QWidget *parent = 0);
|
explicit FileWizardPage(QWidget *parent = 0);
|
||||||
virtual ~FileWizardPage();
|
virtual ~FileWizardPage();
|
||||||
|
|
||||||
QString name() const;
|
QString fileName() const;
|
||||||
QString path() const;
|
QString path() const;
|
||||||
|
|
||||||
virtual bool isComplete() const;
|
virtual bool isComplete() const;
|
||||||
|
|
||||||
void setNameLabel(const QString &label);
|
void setFileNameLabel(const QString &label);
|
||||||
void setPathLabel(const QString &label);
|
void setPathLabel(const QString &label);
|
||||||
|
|
||||||
// Validate a base name entry field (potentially containing extension)
|
// Validate a base name entry field (potentially containing extension)
|
||||||
@@ -72,7 +72,7 @@ signals:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setPath(const QString &path);
|
void setPath(const QString &path);
|
||||||
void setName(const QString &name);
|
void setFileName(const QString &name);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotValidChanged();
|
void slotValidChanged();
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ ProjectIntroPage::~ProjectIntroPage()
|
|||||||
delete m_d;
|
delete m_d;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ProjectIntroPage::name() const
|
QString ProjectIntroPage::projectName() const
|
||||||
{
|
{
|
||||||
return m_d->m_ui.nameLineEdit->text();
|
return m_d->m_ui.nameLineEdit->text();
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ void ProjectIntroPage::setPath(const QString &path)
|
|||||||
m_d->m_ui.pathChooser->setPath(path);
|
m_d->m_ui.pathChooser->setPath(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectIntroPage::setName(const QString &name)
|
void ProjectIntroPage::setProjectName(const QString &name)
|
||||||
{
|
{
|
||||||
m_d->m_ui.nameLineEdit->setText(name);
|
m_d->m_ui.nameLineEdit->setText(name);
|
||||||
m_d->m_ui.nameLineEdit->selectAll();
|
m_d->m_ui.nameLineEdit->selectAll();
|
||||||
|
|||||||
@@ -57,13 +57,13 @@ class QTCREATOR_UTILS_EXPORT ProjectIntroPage : public QWizardPage
|
|||||||
Q_DISABLE_COPY(ProjectIntroPage)
|
Q_DISABLE_COPY(ProjectIntroPage)
|
||||||
Q_PROPERTY(QString description READ description WRITE setPath DESIGNABLE true)
|
Q_PROPERTY(QString description READ description WRITE setPath DESIGNABLE true)
|
||||||
Q_PROPERTY(QString path READ path WRITE setPath DESIGNABLE true)
|
Q_PROPERTY(QString path READ path WRITE setPath DESIGNABLE true)
|
||||||
Q_PROPERTY(QString name READ name WRITE setName DESIGNABLE true)
|
Q_PROPERTY(QString projectName READ projectName WRITE setProjectName DESIGNABLE true)
|
||||||
Q_PROPERTY(bool useAsDefaultPath READ useAsDefaultPath WRITE setUseAsDefaultPath DESIGNABLE true)
|
Q_PROPERTY(bool useAsDefaultPath READ useAsDefaultPath WRITE setUseAsDefaultPath DESIGNABLE true)
|
||||||
public:
|
public:
|
||||||
explicit ProjectIntroPage(QWidget *parent = 0);
|
explicit ProjectIntroPage(QWidget *parent = 0);
|
||||||
virtual ~ProjectIntroPage();
|
virtual ~ProjectIntroPage();
|
||||||
|
|
||||||
QString name() const;
|
QString projectName() const;
|
||||||
QString path() const;
|
QString path() const;
|
||||||
QString description() const;
|
QString description() const;
|
||||||
bool useAsDefaultPath() const;
|
bool useAsDefaultPath() const;
|
||||||
@@ -81,7 +81,7 @@ signals:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setPath(const QString &path);
|
void setPath(const QString &path);
|
||||||
void setName(const QString &name);
|
void setProjectName(const QString &name);
|
||||||
void setDescription(const QString &description);
|
void setDescription(const QString &description);
|
||||||
void setUseAsDefaultPath(bool u);
|
void setUseAsDefaultPath(bool u);
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,8 @@
|
|||||||
namespace BINEditor {
|
namespace BINEditor {
|
||||||
namespace Constants {
|
namespace Constants {
|
||||||
|
|
||||||
const char * const C_BINEDITOR = "Binary Editor";
|
const char * const C_BINEDITOR_ID = "BinEditor.BinaryEditor";
|
||||||
|
const char * const C_BINEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("OpenWith::Editors", "Binary Editor");
|
||||||
const char * const C_BINEDITOR_MIMETYPE = "application/octet-stream";
|
const char * const C_BINEDITOR_MIMETYPE = "application/octet-stream";
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
|
|||||||
@@ -303,8 +303,8 @@ public:
|
|||||||
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
|
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
|
||||||
m_editor = parent;
|
m_editor = parent;
|
||||||
m_file = new BinEditorFile(parent);
|
m_file = new BinEditorFile(parent);
|
||||||
m_context << uidm->uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR);
|
m_context << uidm->uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
|
||||||
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR);
|
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR_ID);
|
||||||
m_cursorPositionLabel = new Utils::LineColumnLabel;
|
m_cursorPositionLabel = new Utils::LineColumnLabel;
|
||||||
|
|
||||||
QHBoxLayout *l = new QHBoxLayout;
|
QHBoxLayout *l = new QHBoxLayout;
|
||||||
@@ -336,7 +336,7 @@ public:
|
|||||||
return m_file->open(fileName);
|
return m_file->open(fileName);
|
||||||
}
|
}
|
||||||
Core::IFile *file() { return m_file; }
|
Core::IFile *file() { return m_file; }
|
||||||
const char *kind() const { return Core::Constants::K_DEFAULT_BINARY_EDITOR; }
|
QString id() const { return QLatin1String(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID); }
|
||||||
QString displayName() const { return m_displayName; }
|
QString displayName() const { return m_displayName; }
|
||||||
void setDisplayName(const QString &title) { m_displayName = title; emit changed(); }
|
void setDisplayName(const QString &title) { m_displayName = title; emit changed(); }
|
||||||
|
|
||||||
@@ -371,21 +371,25 @@ private:
|
|||||||
///////////////////////////////// BinEditorFactory //////////////////////////////////
|
///////////////////////////////// BinEditorFactory //////////////////////////////////
|
||||||
|
|
||||||
BinEditorFactory::BinEditorFactory(BinEditorPlugin *owner) :
|
BinEditorFactory::BinEditorFactory(BinEditorPlugin *owner) :
|
||||||
m_kind(QLatin1String(Core::Constants::K_DEFAULT_BINARY_EDITOR)),
|
|
||||||
m_mimeTypes(QLatin1String(BINEditor::Constants::C_BINEDITOR_MIMETYPE)),
|
m_mimeTypes(QLatin1String(BINEditor::Constants::C_BINEDITOR_MIMETYPE)),
|
||||||
m_owner(owner)
|
m_owner(owner)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BinEditorFactory::kind() const
|
QString BinEditorFactory::id() const
|
||||||
{
|
{
|
||||||
return m_kind;
|
return QLatin1String(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString BinEditorFactory::displayName() const
|
||||||
|
{
|
||||||
|
return tr(Constants::C_BINEDITOR_DISPLAY_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IFile *BinEditorFactory::open(const QString &fileName)
|
Core::IFile *BinEditorFactory::open(const QString &fileName)
|
||||||
{
|
{
|
||||||
Core::EditorManager *em = Core::EditorManager::instance();
|
Core::EditorManager *em = Core::EditorManager::instance();
|
||||||
Core::IEditor *iface = em->openEditor(fileName, kind());
|
Core::IEditor *iface = em->openEditor(fileName, id());
|
||||||
return iface ? iface->file() : 0;
|
return iface ? iface->file() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,7 +443,7 @@ void BinEditorPlugin::initializeEditor(BinEditor *editor)
|
|||||||
editor->setEditorInterface(editorInterface);
|
editor->setEditorInterface(editorInterface);
|
||||||
|
|
||||||
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
|
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
|
||||||
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR);
|
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR_ID);
|
||||||
if (!m_undoAction) {
|
if (!m_undoAction) {
|
||||||
m_undoAction = registerNewAction(QLatin1String(Core::Constants::UNDO),
|
m_undoAction = registerNewAction(QLatin1String(Core::Constants::UNDO),
|
||||||
this, SLOT(undoAction()),
|
this, SLOT(undoAction()),
|
||||||
|
|||||||
@@ -95,11 +95,11 @@ public:
|
|||||||
virtual QStringList mimeTypes() const;
|
virtual QStringList mimeTypes() const;
|
||||||
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
QString kind() const;
|
QString id() const;
|
||||||
|
QString displayName() const;
|
||||||
Core::IFile *open(const QString &fileName);
|
Core::IFile *open(const QString &fileName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_kind;
|
|
||||||
const QStringList m_mimeTypes;
|
const QStringList m_mimeTypes;
|
||||||
BinEditorPlugin *m_owner;
|
BinEditorPlugin *m_owner;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,8 +28,14 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "cmakebuildconfiguration.h"
|
#include "cmakebuildconfiguration.h"
|
||||||
|
|
||||||
|
#include "cmakeopenprojectwizard.h"
|
||||||
#include "cmakeproject.h"
|
#include "cmakeproject.h"
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <QtGui/QInputDialog>
|
||||||
|
|
||||||
using namespace CMakeProjectManager;
|
using namespace CMakeProjectManager;
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
@@ -202,3 +208,84 @@ void CMakeBuildConfiguration::setMsvcVersion(const QString &msvcVersion)
|
|||||||
emit msvcVersionChanged();
|
emit msvcVersionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class CMakeBuildConfigurationFactory
|
||||||
|
*/
|
||||||
|
|
||||||
|
CMakeBuildConfigurationFactory::CMakeBuildConfigurationFactory(CMakeProject *project)
|
||||||
|
: IBuildConfigurationFactory(project),
|
||||||
|
m_project(project)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CMakeBuildConfigurationFactory::~CMakeBuildConfigurationFactory()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList CMakeBuildConfigurationFactory::availableCreationIds() const
|
||||||
|
{
|
||||||
|
return QStringList() << "Create";
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CMakeBuildConfigurationFactory::displayNameForId(const QString &id) const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(id == "Create", return QString());
|
||||||
|
return tr("Create");
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::BuildConfiguration *CMakeBuildConfigurationFactory::create(const QString &id) const
|
||||||
|
{
|
||||||
|
QTC_ASSERT(id == "Create", return 0);
|
||||||
|
|
||||||
|
//TODO configuration name should be part of the cmakeopenprojectwizard
|
||||||
|
bool ok;
|
||||||
|
QString buildConfigurationName = QInputDialog::getText(0,
|
||||||
|
tr("New configuration"),
|
||||||
|
tr("New Configuration Name:"),
|
||||||
|
QLineEdit::Normal,
|
||||||
|
QString(),
|
||||||
|
&ok);
|
||||||
|
if (!ok || buildConfigurationName.isEmpty())
|
||||||
|
return false;
|
||||||
|
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(m_project);
|
||||||
|
bc->setDisplayName(buildConfigurationName);
|
||||||
|
|
||||||
|
MakeStep *makeStep = new MakeStep(bc);
|
||||||
|
bc->insertBuildStep(0, makeStep);
|
||||||
|
|
||||||
|
MakeStep *cleanMakeStep = new MakeStep(bc);
|
||||||
|
bc->insertCleanStep(0, cleanMakeStep);
|
||||||
|
cleanMakeStep->setClean(true);
|
||||||
|
|
||||||
|
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
||||||
|
m_project->sourceDirectory(),
|
||||||
|
bc->buildDirectory(),
|
||||||
|
bc->environment());
|
||||||
|
if (copw.exec() != QDialog::Accepted) {
|
||||||
|
delete bc;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
m_project->addBuildConfiguration(bc); // this also makes the name unique
|
||||||
|
|
||||||
|
bc->setBuildDirectory(copw.buildDirectory());
|
||||||
|
bc->setMsvcVersion(copw.msvcVersion());
|
||||||
|
m_project->parseCMakeLists();
|
||||||
|
|
||||||
|
// Default to all
|
||||||
|
if (m_project->targets().contains("all"))
|
||||||
|
makeStep->setBuildTarget("all", true);
|
||||||
|
return bc;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::BuildConfiguration *CMakeBuildConfigurationFactory::clone(ProjectExplorer::BuildConfiguration *source) const
|
||||||
|
{
|
||||||
|
CMakeBuildConfiguration *old = static_cast<CMakeBuildConfiguration *>(source);
|
||||||
|
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(old);
|
||||||
|
return bc;
|
||||||
|
}
|
||||||
|
|
||||||
|
ProjectExplorer::BuildConfiguration *CMakeBuildConfigurationFactory::restore(const QVariantMap &map) const
|
||||||
|
{
|
||||||
|
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(m_project, map);
|
||||||
|
return bc;
|
||||||
|
}
|
||||||
|
|||||||
@@ -82,6 +82,24 @@ private:
|
|||||||
QString m_msvcVersion;
|
QString m_msvcVersion;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CMakeBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
CMakeBuildConfigurationFactory(CMakeProject *project);
|
||||||
|
~CMakeBuildConfigurationFactory();
|
||||||
|
|
||||||
|
QStringList availableCreationIds() const;
|
||||||
|
QString displayNameForId(const QString &id) const;
|
||||||
|
|
||||||
|
ProjectExplorer::BuildConfiguration *create(const QString &id) const;
|
||||||
|
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::BuildConfiguration *source) const;
|
||||||
|
ProjectExplorer::BuildConfiguration *restore(const QVariantMap &map) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CMakeProject *m_project;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace CMakeProjectManager
|
} // namespace CMakeProjectManager
|
||||||
|
|||||||
@@ -66,87 +66,6 @@ using ProjectExplorer::EnvironmentItem;
|
|||||||
// Open Questions
|
// Open Questions
|
||||||
// Who sets up the environment for cl.exe ? INCLUDEPATH and so on
|
// Who sets up the environment for cl.exe ? INCLUDEPATH and so on
|
||||||
|
|
||||||
/*!
|
|
||||||
\class CMakeBuildConfigurationFactory
|
|
||||||
*/
|
|
||||||
|
|
||||||
CMakeBuildConfigurationFactory::CMakeBuildConfigurationFactory(CMakeProject *project)
|
|
||||||
: IBuildConfigurationFactory(project),
|
|
||||||
m_project(project)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CMakeBuildConfigurationFactory::~CMakeBuildConfigurationFactory()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList CMakeBuildConfigurationFactory::availableCreationTypes() const
|
|
||||||
{
|
|
||||||
return QStringList() << "Create";
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CMakeBuildConfigurationFactory::displayNameForType(const QString & /* type */) const
|
|
||||||
{
|
|
||||||
return tr("Create");
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration *CMakeBuildConfigurationFactory::create(const QString &type) const
|
|
||||||
{
|
|
||||||
QTC_ASSERT(type == "Create", return false);
|
|
||||||
|
|
||||||
//TODO configuration name should be part of the cmakeopenprojectwizard
|
|
||||||
bool ok;
|
|
||||||
QString buildConfigurationName = QInputDialog::getText(0,
|
|
||||||
tr("New configuration"),
|
|
||||||
tr("New Configuration Name:"),
|
|
||||||
QLineEdit::Normal,
|
|
||||||
QString(),
|
|
||||||
&ok);
|
|
||||||
if (!ok || buildConfigurationName.isEmpty())
|
|
||||||
return false;
|
|
||||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(m_project);
|
|
||||||
bc->setDisplayName(buildConfigurationName);
|
|
||||||
|
|
||||||
MakeStep *makeStep = new MakeStep(bc);
|
|
||||||
bc->insertBuildStep(0, makeStep);
|
|
||||||
|
|
||||||
MakeStep *cleanMakeStep = new MakeStep(bc);
|
|
||||||
bc->insertCleanStep(0, cleanMakeStep);
|
|
||||||
cleanMakeStep->setClean(true);
|
|
||||||
|
|
||||||
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
|
||||||
m_project->sourceDirectory(),
|
|
||||||
bc->buildDirectory(),
|
|
||||||
bc->environment());
|
|
||||||
if (copw.exec() != QDialog::Accepted) {
|
|
||||||
delete bc;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
m_project->addBuildConfiguration(bc); // this also makes the name unique
|
|
||||||
|
|
||||||
bc->setBuildDirectory(copw.buildDirectory());
|
|
||||||
bc->setMsvcVersion(copw.msvcVersion());
|
|
||||||
m_project->parseCMakeLists();
|
|
||||||
|
|
||||||
// Default to all
|
|
||||||
if (m_project->targets().contains("all"))
|
|
||||||
makeStep->setBuildTarget("all", true);
|
|
||||||
return bc;
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration *CMakeBuildConfigurationFactory::clone(ProjectExplorer::BuildConfiguration *source) const
|
|
||||||
{
|
|
||||||
CMakeBuildConfiguration *old = static_cast<CMakeBuildConfiguration *>(source);
|
|
||||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(old);
|
|
||||||
return bc;
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration *CMakeBuildConfigurationFactory::restore(const QMap<QString, QVariant> &map) const
|
|
||||||
{
|
|
||||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(m_project, map);
|
|
||||||
return bc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class CMakeProject
|
\class CMakeProject
|
||||||
*/
|
*/
|
||||||
@@ -504,7 +423,7 @@ ProjectExplorer::FolderNode *CMakeProject::findOrCreateFolder(CMakeProjectNode *
|
|||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeProject::name() const
|
QString CMakeProject::displayName() const
|
||||||
{
|
{
|
||||||
return m_projectName;
|
return m_projectName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,25 +63,6 @@ struct CMakeTarget
|
|||||||
void clear();
|
void clear();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMakeBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
CMakeBuildConfigurationFactory(CMakeProject *project);
|
|
||||||
~CMakeBuildConfigurationFactory();
|
|
||||||
|
|
||||||
QStringList availableCreationTypes() const;
|
|
||||||
QString displayNameForType(const QString &type) const;
|
|
||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *create(const QString &type) const;
|
|
||||||
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::BuildConfiguration *source) const;
|
|
||||||
ProjectExplorer::BuildConfiguration *restore(const QMap<QString, QVariant> &map) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
CMakeProject *m_project;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CMakeProject : public ProjectExplorer::Project
|
class CMakeProject : public ProjectExplorer::Project
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -93,7 +74,7 @@ public:
|
|||||||
|
|
||||||
CMakeBuildConfiguration *activeCMakeBuildConfiguration() const;
|
CMakeBuildConfiguration *activeCMakeBuildConfiguration() const;
|
||||||
|
|
||||||
virtual QString name() const;
|
virtual QString displayName() const;
|
||||||
virtual Core::IFile *file() const;
|
virtual Core::IFile *file() const;
|
||||||
virtual ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
|
virtual ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
|
||||||
virtual CMakeManager *projectManager() const;
|
virtual CMakeManager *projectManager() const;
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ QString CMakeSettingsPage::id() const
|
|||||||
return QLatin1String("CMake");
|
return QLatin1String("CMake");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeSettingsPage::trName() const
|
QString CMakeSettingsPage::displayName() const
|
||||||
{
|
{
|
||||||
return tr("CMake");
|
return tr("CMake");
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ QString CMakeSettingsPage::category() const
|
|||||||
return QLatin1String("M.CMake");
|
return QLatin1String("M.CMake");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeSettingsPage::trCategory() const
|
QString CMakeSettingsPage::displayCategory() const
|
||||||
{
|
{
|
||||||
return tr("CMake");
|
return tr("CMake");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,9 +88,9 @@ public:
|
|||||||
CMakeSettingsPage();
|
CMakeSettingsPage();
|
||||||
virtual ~CMakeSettingsPage();
|
virtual ~CMakeSettingsPage();
|
||||||
virtual QString id() const;
|
virtual QString id() const;
|
||||||
virtual QString trName() const;
|
virtual QString displayName() const;
|
||||||
virtual QString category() const;
|
virtual QString category() const;
|
||||||
virtual QString trCategory() const;
|
virtual QString displayCategory() const;
|
||||||
|
|
||||||
virtual QWidget *createPage(QWidget *parent);
|
virtual QWidget *createPage(QWidget *parent);
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ CMakeRunConfiguration::CMakeRunConfiguration(CMakeProject *pro, const QString &t
|
|||||||
, m_title(title)
|
, m_title(title)
|
||||||
, m_baseEnvironmentBase(CMakeRunConfiguration::BuildEnvironmentBase)
|
, m_baseEnvironmentBase(CMakeRunConfiguration::BuildEnvironmentBase)
|
||||||
{
|
{
|
||||||
setName(title);
|
setDisplayName(title);
|
||||||
|
|
||||||
connect(pro, SIGNAL(environmentChanged()),
|
connect(pro, SIGNAL(environmentChanged()),
|
||||||
this, SIGNAL(baseEnvironmentChanged()));
|
this, SIGNAL(baseEnvironmentChanged()));
|
||||||
@@ -70,7 +70,7 @@ CMakeProject *CMakeRunConfiguration::cmakeProject() const
|
|||||||
return static_cast<CMakeProject *>(project());
|
return static_cast<CMakeProject *>(project());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeRunConfiguration::type() const
|
QString CMakeRunConfiguration::id() const
|
||||||
{
|
{
|
||||||
return Constants::CMAKERUNCONFIGURATION;
|
return Constants::CMAKERUNCONFIGURATION;
|
||||||
}
|
}
|
||||||
@@ -417,15 +417,15 @@ CMakeRunConfigurationFactory::~CMakeRunConfigurationFactory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// used to recreate the runConfigurations when restoring settings
|
// used to recreate the runConfigurations when restoring settings
|
||||||
bool CMakeRunConfigurationFactory::canRestore(const QString &type) const
|
bool CMakeRunConfigurationFactory::canRestore(const QString &id) const
|
||||||
{
|
{
|
||||||
if (type.startsWith(Constants::CMAKERUNCONFIGURATION))
|
if (id.startsWith(Constants::CMAKERUNCONFIGURATION))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// used to show the list of possible additons to a project, returns a list of types
|
// used to show the list of possible additons to a project, returns a list of ids
|
||||||
QStringList CMakeRunConfigurationFactory::availableCreationTypes(ProjectExplorer::Project *project) const
|
QStringList CMakeRunConfigurationFactory::availableCreationIds(ProjectExplorer::Project *project) const
|
||||||
{
|
{
|
||||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||||
if (!pro)
|
if (!pro)
|
||||||
@@ -437,28 +437,28 @@ QStringList CMakeRunConfigurationFactory::availableCreationTypes(ProjectExplorer
|
|||||||
return allTargets;
|
return allTargets;
|
||||||
}
|
}
|
||||||
|
|
||||||
// used to translate the types to names to display to the user
|
// used to translate the ids to names to display to the user
|
||||||
QString CMakeRunConfigurationFactory::displayNameForType(const QString &type) const
|
QString CMakeRunConfigurationFactory::displayNameForId(const QString &id) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(type.startsWith(Constants::CMAKERUNCONFIGURATION));
|
Q_ASSERT(id.startsWith(Constants::CMAKERUNCONFIGURATION));
|
||||||
|
|
||||||
if (type == Constants::CMAKERUNCONFIGURATION)
|
if (id == Constants::CMAKERUNCONFIGURATION)
|
||||||
return "CMake"; // Doesn't happen
|
return "CMake"; // Doesn't happen
|
||||||
else
|
else
|
||||||
return type.mid(QString(Constants::CMAKERUNCONFIGURATION).length());
|
return id.mid(QString(Constants::CMAKERUNCONFIGURATION).length());
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::RunConfiguration* CMakeRunConfigurationFactory::create(ProjectExplorer::Project *project, const QString &type)
|
ProjectExplorer::RunConfiguration* CMakeRunConfigurationFactory::create(ProjectExplorer::Project *project, const QString &id)
|
||||||
{
|
{
|
||||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||||
Q_ASSERT(pro);
|
Q_ASSERT(pro);
|
||||||
if (type == Constants::CMAKERUNCONFIGURATION) {
|
if (id == Constants::CMAKERUNCONFIGURATION) {
|
||||||
// Restoring, filename will be added by restoreSettings
|
// Restoring, filename will be added by restoreSettings
|
||||||
ProjectExplorer::RunConfiguration* rc = new CMakeRunConfiguration(pro, QString::null, QString::null, QString::null);
|
ProjectExplorer::RunConfiguration* rc = new CMakeRunConfiguration(pro, QString::null, QString::null, QString::null);
|
||||||
return rc;
|
return rc;
|
||||||
} else {
|
} else {
|
||||||
// Adding new
|
// Adding new
|
||||||
const QString title = type.mid(QString(Constants::CMAKERUNCONFIGURATION).length());
|
const QString title = id.mid(QString(Constants::CMAKERUNCONFIGURATION).length());
|
||||||
const CMakeTarget &ct = pro->targetForTitle(title);
|
const CMakeTarget &ct = pro->targetForTitle(title);
|
||||||
ProjectExplorer::RunConfiguration * rc = new CMakeRunConfiguration(pro, ct.executable, ct.workingDirectory, ct.title);
|
ProjectExplorer::RunConfiguration * rc = new CMakeRunConfiguration(pro, ct.executable, ct.workingDirectory, ct.title);
|
||||||
return rc;
|
return rc;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
virtual ~CMakeRunConfiguration();
|
virtual ~CMakeRunConfiguration();
|
||||||
CMakeProject *cmakeProject() const;
|
CMakeProject *cmakeProject() const;
|
||||||
|
|
||||||
virtual QString type() const;
|
virtual QString id() const;
|
||||||
virtual QString executable() const;
|
virtual QString executable() const;
|
||||||
virtual RunMode runMode() const;
|
virtual RunMode runMode() const;
|
||||||
virtual QString workingDirectory() const;
|
virtual QString workingDirectory() const;
|
||||||
@@ -137,12 +137,12 @@ public:
|
|||||||
CMakeRunConfigurationFactory();
|
CMakeRunConfigurationFactory();
|
||||||
virtual ~CMakeRunConfigurationFactory();
|
virtual ~CMakeRunConfigurationFactory();
|
||||||
// used to recreate the runConfigurations when restoring settings
|
// used to recreate the runConfigurations when restoring settings
|
||||||
virtual bool canRestore(const QString &type) const;
|
virtual bool canRestore(const QString &id) const;
|
||||||
// used to show the list of possible additons to a project, returns a list of types
|
// used to show the list of possible additons to a project, returns a list of types
|
||||||
virtual QStringList availableCreationTypes(ProjectExplorer::Project *pro) const;
|
virtual QStringList availableCreationIds(ProjectExplorer::Project *pro) const;
|
||||||
// used to translate the types to names to display to the user
|
// used to translate the types to names to display to the user
|
||||||
virtual QString displayNameForType(const QString &type) const;
|
virtual QString displayNameForId(const QString &id) const;
|
||||||
virtual ProjectExplorer::RunConfiguration* create(ProjectExplorer::Project *project, const QString &type);
|
virtual ProjectExplorer::RunConfiguration* create(ProjectExplorer::Project *project, const QString &id);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ void MakeStep::run(QFutureInterface<bool> &fi)
|
|||||||
m_futureInterface = 0;
|
m_futureInterface = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MakeStep::name()
|
QString MakeStep::id()
|
||||||
{
|
{
|
||||||
return Constants::MAKESTEP;
|
return Constants::MAKESTEP;
|
||||||
}
|
}
|
||||||
@@ -298,14 +298,14 @@ QString MakeStepConfigWidget::summaryText() const
|
|||||||
// MakeStepFactory
|
// MakeStepFactory
|
||||||
//
|
//
|
||||||
|
|
||||||
bool MakeStepFactory::canCreate(const QString &name) const
|
bool MakeStepFactory::canCreate(const QString &id) const
|
||||||
{
|
{
|
||||||
return (Constants::MAKESTEP == name);
|
return (Constants::MAKESTEP == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStep *MakeStepFactory::create(BuildConfiguration *bc, const QString &name) const
|
BuildStep *MakeStepFactory::create(BuildConfiguration *bc, const QString &id) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(name == Constants::MAKESTEP);
|
Q_ASSERT(id == Constants::MAKESTEP);
|
||||||
return new MakeStep(bc);
|
return new MakeStep(bc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,13 +314,15 @@ BuildStep *MakeStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) const
|
|||||||
return new MakeStep(static_cast<MakeStep *>(bs), bc);
|
return new MakeStep(static_cast<MakeStep *>(bs), bc);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList MakeStepFactory::canCreateForBuildConfiguration(BuildConfiguration * /* pro */) const
|
QStringList MakeStepFactory::canCreateForBuildConfiguration(BuildConfiguration *bc) const
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(bc);
|
||||||
return QStringList();
|
return QStringList();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MakeStepFactory::displayNameForName(const QString & /* name */) const
|
QString MakeStepFactory::displayNameForId(const QString &id) const
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(id);
|
||||||
return "Make";
|
return "Make";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
|
|
||||||
virtual void run(QFutureInterface<bool> &fi);
|
virtual void run(QFutureInterface<bool> &fi);
|
||||||
|
|
||||||
virtual QString name();
|
virtual QString id();
|
||||||
virtual QString displayName();
|
virtual QString displayName();
|
||||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||||
virtual bool immutable() const;
|
virtual bool immutable() const;
|
||||||
@@ -108,11 +108,11 @@ private:
|
|||||||
|
|
||||||
class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||||
{
|
{
|
||||||
virtual bool canCreate(const QString &name) const;
|
virtual bool canCreate(const QString &id) const;
|
||||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc, const QString &name) const;
|
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc, const QString &id) const;
|
||||||
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const;
|
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const;
|
||||||
virtual QStringList canCreateForBuildConfiguration(ProjectExplorer::BuildConfiguration *bc) const;
|
virtual QStringList canCreateForBuildConfiguration(ProjectExplorer::BuildConfiguration *bc) const;
|
||||||
virtual QString displayNameForName(const QString &name) const;
|
virtual QString displayNameForId(const QString &id) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
explicit GeneratedFilePrivate(const QString &p);
|
explicit GeneratedFilePrivate(const QString &p);
|
||||||
QString path;
|
QString path;
|
||||||
QByteArray contents;
|
QByteArray contents;
|
||||||
QString editorKind;
|
QString editorId;
|
||||||
bool binary;
|
bool binary;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -139,14 +139,14 @@ void GeneratedFile::setBinary(bool b)
|
|||||||
m_d->binary = b;
|
m_d->binary = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GeneratedFile::editorKind() const
|
QString GeneratedFile::editorId() const
|
||||||
{
|
{
|
||||||
return m_d->editorKind;
|
return m_d->editorId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneratedFile::setEditorKind(const QString &k)
|
void GeneratedFile::setEditorId(const QString &k)
|
||||||
{
|
{
|
||||||
m_d->editorKind = k;
|
m_d->editorId = k;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GeneratedFile::write(QString *errorMessage) const
|
bool GeneratedFile::write(QString *errorMessage) const
|
||||||
@@ -189,10 +189,10 @@ public:
|
|||||||
IWizard::Kind kind;
|
IWizard::Kind kind;
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
QString description;
|
QString description;
|
||||||
QString name;
|
QString displayName;
|
||||||
QString id;
|
QString id;
|
||||||
QString category;
|
QString category;
|
||||||
QString trCategory;
|
QString displayCategory;
|
||||||
};
|
};
|
||||||
|
|
||||||
BaseFileWizardParameterData::BaseFileWizardParameterData(IWizard::Kind k) :
|
BaseFileWizardParameterData::BaseFileWizardParameterData(IWizard::Kind k) :
|
||||||
@@ -251,14 +251,14 @@ void BaseFileWizardParameters::setDescription(const QString &v)
|
|||||||
m_d->description = v;
|
m_d->description = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BaseFileWizardParameters::name() const
|
QString BaseFileWizardParameters::displayName() const
|
||||||
{
|
{
|
||||||
return m_d->name;
|
return m_d->displayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseFileWizardParameters::setName(const QString &v)
|
void BaseFileWizardParameters::setDisplayName(const QString &v)
|
||||||
{
|
{
|
||||||
m_d->name = v;
|
m_d->displayName = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BaseFileWizardParameters::id() const
|
QString BaseFileWizardParameters::id() const
|
||||||
@@ -281,14 +281,14 @@ void BaseFileWizardParameters::setCategory(const QString &v)
|
|||||||
m_d->category = v;
|
m_d->category = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BaseFileWizardParameters::trCategory() const
|
QString BaseFileWizardParameters::displayCategory() const
|
||||||
{
|
{
|
||||||
return m_d->trCategory;
|
return m_d->displayCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseFileWizardParameters::setTrCategory(const QString &v)
|
void BaseFileWizardParameters::setDisplayCategory(const QString &v)
|
||||||
{
|
{
|
||||||
m_d->trCategory = v;
|
m_d->displayCategory = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* WizardEventLoop: Special event loop that runs a QWizard and terminates if the page changes.
|
/* WizardEventLoop: Special event loop that runs a QWizard and terminates if the page changes.
|
||||||
@@ -416,9 +416,9 @@ QString BaseFileWizard::description() const
|
|||||||
return m_d->m_parameters.description();
|
return m_d->m_parameters.description();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BaseFileWizard::name() const
|
QString BaseFileWizard::displayName() const
|
||||||
{
|
{
|
||||||
return m_d->m_parameters.name();
|
return m_d->m_parameters.displayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BaseFileWizard::id() const
|
QString BaseFileWizard::id() const
|
||||||
@@ -431,9 +431,9 @@ QString BaseFileWizard::category() const
|
|||||||
return m_d->m_parameters.category();
|
return m_d->m_parameters.category();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BaseFileWizard::trCategory() const
|
QString BaseFileWizard::displayCategory() const
|
||||||
{
|
{
|
||||||
return m_d->m_parameters.trCategory();
|
return m_d->m_parameters.displayCategory();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
|
QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
|
||||||
@@ -553,7 +553,7 @@ bool BaseFileWizard::postGenerateFiles(const GeneratedFiles &l, QString *errorMe
|
|||||||
const Core::GeneratedFiles::const_iterator cend = l.constEnd();
|
const Core::GeneratedFiles::const_iterator cend = l.constEnd();
|
||||||
Core::EditorManager *em = Core::EditorManager::instance();
|
Core::EditorManager *em = Core::EditorManager::instance();
|
||||||
for (Core::GeneratedFiles::const_iterator it = l.constBegin(); it != cend; ++it) {
|
for (Core::GeneratedFiles::const_iterator it = l.constBegin(); it != cend; ++it) {
|
||||||
if (!em->openEditor(it->path(), it->editorKind())) {
|
if (!em->openEditor(it->path(), it->editorId())) {
|
||||||
*errorMessage = tr("Failed to open an editor for '%1'.").arg(it->path());
|
*errorMessage = tr("Failed to open an editor for '%1'.").arg(it->path());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -665,7 +665,7 @@ QWizard *StandardFileWizard::createWizardDialog(QWidget *parent,
|
|||||||
const WizardPageList &extensionPages) const
|
const WizardPageList &extensionPages) const
|
||||||
{
|
{
|
||||||
Utils::FileWizardDialog *standardWizardDialog = new Utils::FileWizardDialog(parent);
|
Utils::FileWizardDialog *standardWizardDialog = new Utils::FileWizardDialog(parent);
|
||||||
standardWizardDialog->setWindowTitle(tr("New %1").arg(name()));
|
standardWizardDialog->setWindowTitle(tr("New %1").arg(displayName()));
|
||||||
setupWizard(standardWizardDialog);
|
setupWizard(standardWizardDialog);
|
||||||
standardWizardDialog->setPath(defaultPath);
|
standardWizardDialog->setPath(defaultPath);
|
||||||
foreach (QWizardPage *p, extensionPages)
|
foreach (QWizardPage *p, extensionPages)
|
||||||
@@ -678,7 +678,7 @@ GeneratedFiles StandardFileWizard::generateFiles(const QWizard *w,
|
|||||||
{
|
{
|
||||||
const Utils::FileWizardDialog *standardWizardDialog = qobject_cast<const Utils::FileWizardDialog *>(w);
|
const Utils::FileWizardDialog *standardWizardDialog = qobject_cast<const Utils::FileWizardDialog *>(w);
|
||||||
return generateFilesFromPath(standardWizardDialog->path(),
|
return generateFilesFromPath(standardWizardDialog->path(),
|
||||||
standardWizardDialog->name(),
|
standardWizardDialog->fileName(),
|
||||||
errorMessage);
|
errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,9 +82,9 @@ public:
|
|||||||
bool isBinary() const;
|
bool isBinary() const;
|
||||||
void setBinary(bool b);
|
void setBinary(bool b);
|
||||||
|
|
||||||
// Kind of editor to open the file with
|
// Id of editor to open the file with
|
||||||
QString editorKind() const;
|
QString editorId() const;
|
||||||
void setEditorKind(const QString &k);
|
void setEditorId(const QString &k);
|
||||||
|
|
||||||
bool write(QString *errorMessage) const;
|
bool write(QString *errorMessage) const;
|
||||||
|
|
||||||
@@ -114,8 +114,8 @@ public:
|
|||||||
QString description() const;
|
QString description() const;
|
||||||
void setDescription(const QString &description);
|
void setDescription(const QString &description);
|
||||||
|
|
||||||
QString name() const;
|
QString displayName() const;
|
||||||
void setName(const QString &name);
|
void setDisplayName(const QString &name);
|
||||||
|
|
||||||
QString id() const;
|
QString id() const;
|
||||||
void setId(const QString &id);
|
void setId(const QString &id);
|
||||||
@@ -123,8 +123,8 @@ public:
|
|||||||
QString category() const;
|
QString category() const;
|
||||||
void setCategory(const QString &category);
|
void setCategory(const QString &category);
|
||||||
|
|
||||||
QString trCategory() const;
|
QString displayCategory() const;
|
||||||
void setTrCategory(const QString &trCategory);
|
void setDisplayCategory(const QString &trCategory);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSharedDataPointer<BaseFileWizardParameterData> m_d;
|
QSharedDataPointer<BaseFileWizardParameterData> m_d;
|
||||||
@@ -154,11 +154,11 @@ public:
|
|||||||
virtual Kind kind() const;
|
virtual Kind kind() const;
|
||||||
virtual QIcon icon() const;
|
virtual QIcon icon() const;
|
||||||
virtual QString description() const;
|
virtual QString description() const;
|
||||||
virtual QString name() const;
|
virtual QString displayName() const;
|
||||||
virtual QString id() const;
|
virtual QString id() const;
|
||||||
|
|
||||||
virtual QString category() const;
|
virtual QString category() const;
|
||||||
virtual QString trCategory() const;
|
virtual QString displayCategory() const;
|
||||||
|
|
||||||
virtual QStringList runWizard(const QString &path, QWidget *parent);
|
virtual QStringList runWizard(const QString &path, QWidget *parent);
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ using namespace Core;
|
|||||||
{
|
{
|
||||||
[...]
|
[...]
|
||||||
addObject(new Core::BaseMode("mymode",
|
addObject(new Core::BaseMode("mymode",
|
||||||
"MyPlugin.UniqueModeName",
|
"MyPlugin.Id",
|
||||||
icon,
|
icon,
|
||||||
50, // priority
|
50, // priority
|
||||||
new MyWidget));
|
new MyWidget));
|
||||||
@@ -65,7 +65,7 @@ using namespace Core;
|
|||||||
/*!
|
/*!
|
||||||
\fn BaseMode::BaseMode(QObject *parent)
|
\fn BaseMode::BaseMode(QObject *parent)
|
||||||
|
|
||||||
Creates a mode with empty name, no icon, lowest priority and no widget. You should use the
|
Creates a mode with empty display name, no icon, lowest priority and no widget. You should use the
|
||||||
setter functions to give the mode a meaning.
|
setter functions to give the mode a meaning.
|
||||||
|
|
||||||
\a parent
|
\a parent
|
||||||
|
|||||||
@@ -49,26 +49,26 @@ public:
|
|||||||
~BaseMode();
|
~BaseMode();
|
||||||
|
|
||||||
// IMode
|
// IMode
|
||||||
QString name() const { return m_name; }
|
QString displayName() const { return m_displayName; }
|
||||||
QIcon icon() const { return m_icon; }
|
QIcon icon() const { return m_icon; }
|
||||||
int priority() const { return m_priority; }
|
int priority() const { return m_priority; }
|
||||||
QWidget *widget() { return m_widget; }
|
QWidget *widget() { return m_widget; }
|
||||||
const char *uniqueModeName() const { return m_uniqueModeName; }
|
QString id() const { return m_id; }
|
||||||
QList<int> context() const { return m_context; }
|
QList<int> context() const { return m_context; }
|
||||||
|
|
||||||
void setName(const QString &name) { m_name = name; }
|
void setDisplayName(const QString &name) { m_displayName = name; }
|
||||||
void setIcon(const QIcon &icon) { m_icon = icon; }
|
void setIcon(const QIcon &icon) { m_icon = icon; }
|
||||||
void setPriority(int priority) { m_priority = priority; }
|
void setPriority(int priority) { m_priority = priority; }
|
||||||
void setWidget(QWidget *widget) { m_widget = widget; }
|
void setWidget(QWidget *widget) { m_widget = widget; }
|
||||||
void setUniqueModeName(const char *uniqueModeName) { m_uniqueModeName = uniqueModeName; }
|
void setId(const QString &id) { m_id = id; }
|
||||||
void setContext(const QList<int> &context) { m_context = context; }
|
void setContext(const QList<int> &context) { m_context = context; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_name;
|
QString m_displayName;
|
||||||
QIcon m_icon;
|
QIcon m_icon;
|
||||||
int m_priority;
|
int m_priority;
|
||||||
QWidget *m_widget;
|
QWidget *m_widget;
|
||||||
const char * m_uniqueModeName;
|
QString m_id;
|
||||||
QList<int> m_context;
|
QList<int> m_context;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -92,8 +92,9 @@ const char * const C_NAVIGATION_PANE = "Core.NavigationPane";
|
|||||||
const char * const C_PROBLEM_PANE = "Core.ProblemPane";
|
const char * const C_PROBLEM_PANE = "Core.ProblemPane";
|
||||||
|
|
||||||
//default editor kind
|
//default editor kind
|
||||||
const char * const K_DEFAULT_TEXT_EDITOR = QT_TRANSLATE_NOOP("OpenWith::Editors", "Plain Text Editor");
|
const char * const K_DEFAULT_TEXT_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("OpenWith::Editors", "Plain Text Editor");
|
||||||
const char * const K_DEFAULT_BINARY_EDITOR = QT_TRANSLATE_NOOP("OpenWith::Editors", "Binary Editor");
|
const char * const K_DEFAULT_TEXT_EDITOR_ID = "Core.PlainTextEditor";
|
||||||
|
const char * const K_DEFAULT_BINARY_EDITOR_ID = "Core.BinaryEditor";
|
||||||
|
|
||||||
//actions
|
//actions
|
||||||
const char * const UNDO = "QtCreator.Undo";
|
const char * const UNDO = "QtCreator.Undo";
|
||||||
|
|||||||
@@ -37,9 +37,9 @@
|
|||||||
Guidelines for implementing:
|
Guidelines for implementing:
|
||||||
\list
|
\list
|
||||||
\o id() is an id used for filtering when calling ICore:: showOptionsDialog()
|
\o id() is an id used for filtering when calling ICore:: showOptionsDialog()
|
||||||
\o trName() is the (translated) name for display.
|
\o displayName() is the (translated) name for display.
|
||||||
\o category() is the category used for filtering when calling ICore:: showOptionsDialog()
|
\o category() is the category used for filtering when calling ICore:: showOptionsDialog()
|
||||||
\o trCategory() is the translated category
|
\o displayCategory() is the translated category
|
||||||
\o apply() is called to store the settings. It should detect if any changes have been
|
\o apply() is called to store the settings. It should detect if any changes have been
|
||||||
made and store those.
|
made and store those.
|
||||||
\o matches() is used for the options dialog search filter.
|
\o matches() is used for the options dialog search filter.
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ public:
|
|||||||
virtual ~IOptionsPage() {}
|
virtual ~IOptionsPage() {}
|
||||||
|
|
||||||
virtual QString id() const = 0;
|
virtual QString id() const = 0;
|
||||||
virtual QString trName() const = 0;
|
virtual QString displayName() const = 0;
|
||||||
virtual QString category() const = 0;
|
virtual QString category() const = 0;
|
||||||
virtual QString trCategory() const = 0;
|
virtual QString displayCategory() const = 0;
|
||||||
virtual bool matches(const QString & /* searchKeyWord*/) const { return false; }
|
virtual bool matches(const QString & /* searchKeyWord*/) const { return false; }
|
||||||
|
|
||||||
virtual QWidget *createPage(QWidget *parent) = 0;
|
virtual QWidget *createPage(QWidget *parent) = 0;
|
||||||
|
|||||||
@@ -118,7 +118,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QString IWizard::trCategory() const
|
\fn QString IWizard::displayCategory() const
|
||||||
Returns the translated string of the category, how it should appear
|
Returns the translated string of the category, how it should appear
|
||||||
in the dialog.
|
in the dialog.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -56,11 +56,11 @@ public:
|
|||||||
virtual Kind kind() const = 0;
|
virtual Kind kind() const = 0;
|
||||||
virtual QIcon icon() const = 0;
|
virtual QIcon icon() const = 0;
|
||||||
virtual QString description() const = 0;
|
virtual QString description() const = 0;
|
||||||
virtual QString name() const = 0;
|
virtual QString displayName() const = 0;
|
||||||
virtual QString id() const = 0;
|
virtual QString id() const = 0;
|
||||||
|
|
||||||
virtual QString category() const = 0;
|
virtual QString category() const = 0;
|
||||||
virtual QString trCategory() const = 0;
|
virtual QString displayCategory() const = 0;
|
||||||
|
|
||||||
virtual QStringList runWizard(const QString &path, QWidget *parent) = 0;
|
virtual QStringList runWizard(const QString &path, QWidget *parent) = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -96,13 +96,13 @@ void NewDialog::setWizards(QList<IWizard*> wizards)
|
|||||||
if (cit == categories.end()) {
|
if (cit == categories.end()) {
|
||||||
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(m_ui->templatesTree);
|
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(m_ui->templatesTree);
|
||||||
categoryItem->setFlags(Qt::ItemIsEnabled);
|
categoryItem->setFlags(Qt::ItemIsEnabled);
|
||||||
categoryItem->setText(0, wizard->trCategory());
|
categoryItem->setText(0, wizard->displayCategory());
|
||||||
qVariantSetValue<IWizard*>(wizardPtr, 0);
|
qVariantSetValue<IWizard*>(wizardPtr, 0);
|
||||||
categoryItem->setData(0, Qt::UserRole, wizardPtr);
|
categoryItem->setData(0, Qt::UserRole, wizardPtr);
|
||||||
cit = categories.insert(categoryName, categoryItem);
|
cit = categories.insert(categoryName, categoryItem);
|
||||||
}
|
}
|
||||||
// add item
|
// add item
|
||||||
QTreeWidgetItem *wizardItem = new QTreeWidgetItem(cit.value(), QStringList(wizard->name()));
|
QTreeWidgetItem *wizardItem = new QTreeWidgetItem(cit.value(), QStringList(wizard->displayName()));
|
||||||
wizardItem->setIcon(0, wizard->icon());
|
wizardItem->setIcon(0, wizard->icon());
|
||||||
qVariantSetValue<IWizard*>(wizardPtr, wizard);
|
qVariantSetValue<IWizard*>(wizardPtr, wizard);
|
||||||
wizardItem->setData(0, Qt::UserRole, wizardPtr);
|
wizardItem->setData(0, Qt::UserRole, wizardPtr);
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ bool PageFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source
|
|||||||
return true;
|
return true;
|
||||||
if (const IOptionsPage *page = pageOfItem(sourceModel(), source_parent.child(source_row, 0))) {
|
if (const IOptionsPage *page = pageOfItem(sourceModel(), source_parent.child(source_row, 0))) {
|
||||||
const QString pattern = filterRegExp().pattern();
|
const QString pattern = filterRegExp().pattern();
|
||||||
return page->trCategory().contains(pattern, Qt::CaseInsensitive) ||
|
return page->displayCategory().contains(pattern, Qt::CaseInsensitive) ||
|
||||||
page->matches(pattern);
|
page->matches(pattern);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -151,9 +151,9 @@ static QStandardItemModel *pageModel(const QList<IOptionsPage*> &pages,
|
|||||||
QMap<QString, QStandardItem *> categories;
|
QMap<QString, QStandardItem *> categories;
|
||||||
foreach (IOptionsPage *page, pages) {
|
foreach (IOptionsPage *page, pages) {
|
||||||
const QStringList categoriesId = page->category().split(hierarchySeparator);
|
const QStringList categoriesId = page->category().split(hierarchySeparator);
|
||||||
const QStringList trCategories = page->trCategory().split(hierarchySeparator);
|
const QStringList displayCategories = page->displayCategory().split(hierarchySeparator);
|
||||||
const int categoryDepth = categoriesId.size();
|
const int categoryDepth = categoriesId.size();
|
||||||
if (categoryDepth != trCategories.size()) {
|
if (categoryDepth != displayCategories.size()) {
|
||||||
qWarning("Internal error: Hierarchy mismatch in settings page %s.", qPrintable(page->id()));
|
qWarning("Internal error: Hierarchy mismatch in settings page %s.", qPrintable(page->id()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ static QStandardItemModel *pageModel(const QList<IOptionsPage*> &pages,
|
|||||||
QString currentCategory = categoriesId.at(0);
|
QString currentCategory = categoriesId.at(0);
|
||||||
QStandardItem *treeItem = categories.value(currentCategory, 0);
|
QStandardItem *treeItem = categories.value(currentCategory, 0);
|
||||||
if (!treeItem) {
|
if (!treeItem) {
|
||||||
treeItem = createStandardItem(model, trCategories.at(0), CategoryItem);
|
treeItem = createStandardItem(model, displayCategories.at(0), CategoryItem);
|
||||||
categories.insert(currentCategory, treeItem);
|
categories.insert(currentCategory, treeItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ static QStandardItemModel *pageModel(const QList<IOptionsPage*> &pages,
|
|||||||
if (!treeItem) {
|
if (!treeItem) {
|
||||||
QStandardItem *parentItem = categories.value(currentCategory);
|
QStandardItem *parentItem = categories.value(currentCategory);
|
||||||
QTC_ASSERT(parentItem, return model)
|
QTC_ASSERT(parentItem, return model)
|
||||||
treeItem = createStandardItem(parentItem, trCategories.at(cat), CategoryItem);
|
treeItem = createStandardItem(parentItem, displayCategories.at(cat), CategoryItem);
|
||||||
categories.insert(fullCategory, treeItem);
|
categories.insert(fullCategory, treeItem);
|
||||||
}
|
}
|
||||||
currentCategory = fullCategory;
|
currentCategory = fullCategory;
|
||||||
@@ -180,7 +180,7 @@ static QStandardItemModel *pageModel(const QList<IOptionsPage*> &pages,
|
|||||||
|
|
||||||
// Append page item
|
// Append page item
|
||||||
QTC_ASSERT(treeItem, return model)
|
QTC_ASSERT(treeItem, return model)
|
||||||
QStandardItem *item = createStandardItem(treeItem, page->trName(), PageItem, index, page);
|
QStandardItem *item = createStandardItem(treeItem, page->displayName(), PageItem, index, page);
|
||||||
if (currentCategory == initialCategory && page->id() == initialPageId) {
|
if (currentCategory == initialCategory && page->id() == initialPageId) {
|
||||||
*initialIndex = model->indexFromItem(item);
|
*initialIndex = model->indexFromItem(item);
|
||||||
}
|
}
|
||||||
@@ -339,7 +339,7 @@ void SettingsDialog::showPage(const QStandardItem *item)
|
|||||||
m_currentPage = page->id();
|
m_currentPage = page->id();
|
||||||
m_stackedLayout->setCurrentIndex(indexOfItem(item));
|
m_stackedLayout->setCurrentIndex(indexOfItem(item));
|
||||||
m_visitedPages.insert(page);
|
m_visitedPages.insert(page);
|
||||||
m_headerLabel->setText(page->trName());
|
m_headerLabel->setText(page->displayName());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CategoryItem:
|
case CategoryItem:
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ QString ShortcutSettings::id() const
|
|||||||
return QLatin1String("D.Keyboard");
|
return QLatin1String("D.Keyboard");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ShortcutSettings::trName() const
|
QString ShortcutSettings::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Keyboard");
|
return tr("Keyboard");
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ QString ShortcutSettings::category() const
|
|||||||
return QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE);
|
return QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ShortcutSettings::trCategory() const
|
QString ShortcutSettings::displayCategory() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE);
|
return QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,9 +68,9 @@ public:
|
|||||||
|
|
||||||
// IOptionsPage
|
// IOptionsPage
|
||||||
QString id() const;
|
QString id() const;
|
||||||
QString trName() const;
|
QString displayName() const;
|
||||||
QString category() const;
|
QString category() const;
|
||||||
QString trCategory() const;
|
QString displayCategory() const;
|
||||||
|
|
||||||
QWidget *createPage(QWidget *parent);
|
QWidget *createPage(QWidget *parent);
|
||||||
void apply();
|
void apply();
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ EditMode::~EditMode()
|
|||||||
delete m_splitter;
|
delete m_splitter;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString EditMode::name() const
|
QString EditMode::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Edit");
|
return tr("Edit");
|
||||||
}
|
}
|
||||||
@@ -110,9 +110,9 @@ QWidget* EditMode::widget()
|
|||||||
return m_splitter;
|
return m_splitter;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* EditMode::uniqueModeName() const
|
QString EditMode::id() const
|
||||||
{
|
{
|
||||||
return Constants::MODE_EDIT;
|
return QLatin1String(Constants::MODE_EDIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<int> EditMode::context() const
|
QList<int> EditMode::context() const
|
||||||
|
|||||||
@@ -55,11 +55,11 @@ public:
|
|||||||
~EditMode();
|
~EditMode();
|
||||||
|
|
||||||
// IMode
|
// IMode
|
||||||
QString name() const;
|
QString displayName() const;
|
||||||
QIcon icon() const;
|
QIcon icon() const;
|
||||||
int priority() const;
|
int priority() const;
|
||||||
QWidget* widget();
|
QWidget* widget();
|
||||||
const char* uniqueModeName() const;
|
QString id() const;
|
||||||
QList<int> context() const;
|
QList<int> context() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
@@ -841,8 +841,8 @@ Core::IEditor *EditorManager::activateEditor(const QModelIndex &index, Internal:
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString fileName = index.data(Qt::UserRole + 1).toString();
|
QString fileName = index.data(Qt::UserRole + 1).toString();
|
||||||
QByteArray kind = index.data(Qt::UserRole + 2).toByteArray();
|
QString id = index.data(Qt::UserRole + 2).toString();
|
||||||
return openEditor(view, fileName, kind, flags);
|
return openEditor(view, fileName, id, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core::IEditor *editor)
|
Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core::IEditor *editor)
|
||||||
@@ -970,45 +970,44 @@ EditorManager::ExternalEditorList
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For something that has a 'QString kind' (IEditorFactory
|
/* For something that has a 'QString id' (IEditorFactory
|
||||||
* or IExternalEditor), find the one matching a kind. */
|
* or IExternalEditor), find the one matching a id. */
|
||||||
template <class EditorFactoryLike>
|
template <class EditorFactoryLike>
|
||||||
inline EditorFactoryLike *findByKind(ExtensionSystem::PluginManager *pm,
|
inline EditorFactoryLike *findById(ExtensionSystem::PluginManager *pm,
|
||||||
const QString &kind)
|
const QString &id)
|
||||||
{
|
{
|
||||||
const QList<EditorFactoryLike *> factories = pm->template getObjects<EditorFactoryLike>();
|
const QList<EditorFactoryLike *> factories = pm->template getObjects<EditorFactoryLike>();
|
||||||
foreach(EditorFactoryLike *efl, factories)
|
foreach(EditorFactoryLike *efl, factories)
|
||||||
if (kind == efl->kind())
|
if (id == efl->id())
|
||||||
return efl;
|
return efl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
IEditor *EditorManager::createEditor(const QString &editorKind,
|
IEditor *EditorManager::createEditor(const QString &editorId,
|
||||||
const QString &fileName)
|
const QString &fileName)
|
||||||
{
|
{
|
||||||
typedef QList<IEditorFactory*> FactoryList;
|
typedef QList<IEditorFactory*> FactoryList;
|
||||||
if (debugEditorManager)
|
if (debugEditorManager)
|
||||||
qDebug() << Q_FUNC_INFO << editorKind << fileName;
|
qDebug() << Q_FUNC_INFO << editorId << fileName;
|
||||||
|
|
||||||
|
|
||||||
EditorFactoryList factories;
|
EditorFactoryList factories;
|
||||||
if (editorKind.isEmpty()) {
|
if (editorId.isEmpty()) {
|
||||||
// Find by mime type
|
// Find by mime type
|
||||||
MimeType mimeType = m_d->m_core->mimeDatabase()->findByFile(QFileInfo(fileName));
|
MimeType mimeType = m_d->m_core->mimeDatabase()->findByFile(QFileInfo(fileName));
|
||||||
if (!mimeType) {
|
if (!mimeType) {
|
||||||
qWarning("%s unable to determine mime type of %s/%s. Falling back to text/plain",
|
qWarning("%s unable to determine mime type of %s/%s. Falling back to text/plain",
|
||||||
Q_FUNC_INFO, fileName.toUtf8().constData(), editorKind.toUtf8().constData());
|
Q_FUNC_INFO, fileName.toUtf8().constData(), editorId.toUtf8().constData());
|
||||||
mimeType = m_d->m_core->mimeDatabase()->findByType(QLatin1String("text/plain"));
|
mimeType = m_d->m_core->mimeDatabase()->findByType(QLatin1String("text/plain"));
|
||||||
}
|
}
|
||||||
factories = editorFactories(mimeType, true);
|
factories = editorFactories(mimeType, true);
|
||||||
} else {
|
} else {
|
||||||
// Find by editor kind
|
// Find by editor id
|
||||||
if (IEditorFactory *factory = findByKind<IEditorFactory>(pluginManager(), editorKind))
|
if (IEditorFactory *factory = findById<IEditorFactory>(pluginManager(), editorId))
|
||||||
factories.push_back(factory);
|
factories.push_back(factory);
|
||||||
}
|
}
|
||||||
if (factories.empty()) {
|
if (factories.empty()) {
|
||||||
qWarning("%s: unable to find an editor factory for the file '%s', editor kind '%s'.",
|
qWarning("%s: unable to find an editor factory for the file '%s', editor Id '%s'.",
|
||||||
Q_FUNC_INFO, fileName.toUtf8().constData(), editorKind.toUtf8().constData());
|
Q_FUNC_INFO, fileName.toUtf8().constData(), editorId.toUtf8().constData());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1036,42 +1035,42 @@ void EditorManager::addEditor(IEditor *editor, bool isDuplicate)
|
|||||||
emit editorOpened(editor);
|
emit editorOpened(editor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run the OpenWithDialog and return the editor kind
|
// Run the OpenWithDialog and return the editor id
|
||||||
// selected by the user.
|
// selected by the user.
|
||||||
QString EditorManager::getOpenWithEditorKind(const QString &fileName,
|
QString EditorManager::getOpenWithEditorId(const QString &fileName,
|
||||||
bool *isExternalEditor) const
|
bool *isExternalEditor) const
|
||||||
{
|
{
|
||||||
// Collect editors that can open the file
|
// Collect editors that can open the file
|
||||||
const MimeType mt = m_d->m_core->mimeDatabase()->findByFile(fileName);
|
const MimeType mt = m_d->m_core->mimeDatabase()->findByFile(fileName);
|
||||||
if (!mt)
|
if (!mt)
|
||||||
return QString();
|
return QString();
|
||||||
QStringList allEditorKinds;
|
QStringList allEditorIds;
|
||||||
QStringList externalEditorKinds;
|
QStringList externalEditorIds;
|
||||||
// Built-in
|
// Built-in
|
||||||
const EditorFactoryList editors = editorFactories(mt, false);
|
const EditorFactoryList editors = editorFactories(mt, false);
|
||||||
const int size = editors.size();
|
const int size = editors.size();
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
allEditorKinds.push_back(editors.at(i)->kind());
|
allEditorIds.push_back(editors.at(i)->id());
|
||||||
}
|
}
|
||||||
// External editors
|
// External editors
|
||||||
const ExternalEditorList exEditors = externalEditors(mt, false);
|
const ExternalEditorList exEditors = externalEditors(mt, false);
|
||||||
const int esize = exEditors.size();
|
const int esize = exEditors.size();
|
||||||
for (int i = 0; i < esize; i++) {
|
for (int i = 0; i < esize; i++) {
|
||||||
externalEditorKinds.push_back(exEditors.at(i)->kind());
|
externalEditorIds.push_back(exEditors.at(i)->id());
|
||||||
allEditorKinds.push_back(exEditors.at(i)->kind());
|
allEditorIds.push_back(exEditors.at(i)->id());
|
||||||
}
|
}
|
||||||
if (allEditorKinds.empty())
|
if (allEditorIds.empty())
|
||||||
return QString();
|
return QString();
|
||||||
// Run dialog.
|
// Run dialog.
|
||||||
OpenWithDialog dialog(fileName, m_d->m_core->mainWindow());
|
OpenWithDialog dialog(fileName, m_d->m_core->mainWindow());
|
||||||
dialog.setEditors(allEditorKinds);
|
dialog.setEditors(allEditorIds);
|
||||||
dialog.setCurrentEditor(0);
|
dialog.setCurrentEditor(0);
|
||||||
if (dialog.exec() != QDialog::Accepted)
|
if (dialog.exec() != QDialog::Accepted)
|
||||||
return QString();
|
return QString();
|
||||||
const QString selectedKind = dialog.editor();
|
const QString selectedId = dialog.editor();
|
||||||
if (isExternalEditor)
|
if (isExternalEditor)
|
||||||
*isExternalEditor = externalEditorKinds.contains(selectedKind);
|
*isExternalEditor = externalEditorIds.contains(selectedId);
|
||||||
return selectedKind;
|
return selectedId;
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString formatFileFilters(const Core::ICore *core, QString *selectedFilter)
|
static QString formatFileFilters(const Core::ICore *core, QString *selectedFilter)
|
||||||
@@ -1111,17 +1110,17 @@ static QString formatFileFilters(const Core::ICore *core, QString *selectedFilte
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
IEditor *EditorManager::openEditor(const QString &fileName, const QString &editorKind,
|
IEditor *EditorManager::openEditor(const QString &fileName, const QString &editorId,
|
||||||
EditorManager::OpenEditorFlags flags)
|
EditorManager::OpenEditorFlags flags)
|
||||||
{
|
{
|
||||||
return openEditor(0, fileName, editorKind, flags);
|
return openEditor(0, fileName, editorId, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QString &fileName,
|
IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QString &fileName,
|
||||||
const QString &editorKind, EditorManager::OpenEditorFlags flags)
|
const QString &editorId, EditorManager::OpenEditorFlags flags)
|
||||||
{
|
{
|
||||||
if (debugEditorManager)
|
if (debugEditorManager)
|
||||||
qDebug() << Q_FUNC_INFO << fileName << editorKind;
|
qDebug() << Q_FUNC_INFO << fileName << editorId;
|
||||||
|
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1131,7 +1130,7 @@ IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QStri
|
|||||||
return activateEditor(view, editors.first(), flags);
|
return activateEditor(view, editors.first(), flags);
|
||||||
}
|
}
|
||||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||||
IEditor *editor = createEditor(editorKind, fileName);
|
IEditor *editor = createEditor(editorId, fileName);
|
||||||
if (!editor || !editor->open(fileName)) {
|
if (!editor || !editor->open(fileName)) {
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
QMessageBox::critical(m_d->m_core->mainWindow(), tr("Opening File"), tr("Cannot open file %1!").arg(QDir::toNativeSeparators(fileName)));
|
QMessageBox::critical(m_d->m_core->mainWindow(), tr("Opening File"), tr("Cannot open file %1!").arg(QDir::toNativeSeparators(fileName)));
|
||||||
@@ -1148,9 +1147,9 @@ IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QStri
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditorManager::openExternalEditor(const QString &fileName, const QString &editorKind)
|
bool EditorManager::openExternalEditor(const QString &fileName, const QString &editorId)
|
||||||
{
|
{
|
||||||
IExternalEditor *ee = findByKind<IExternalEditor>(pluginManager(), editorKind);
|
IExternalEditor *ee = findById<IExternalEditor>(pluginManager(), editorId);
|
||||||
if (!ee)
|
if (!ee)
|
||||||
return false;
|
return false;
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
@@ -1176,18 +1175,18 @@ void EditorManager::ensureEditorManagerVisible()
|
|||||||
m_d->m_core->modeManager()->activateMode(Constants::MODE_EDIT);
|
m_d->m_core->modeManager()->activateMode(Constants::MODE_EDIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
IEditor *EditorManager::openEditorWithContents(const QString &editorKind,
|
IEditor *EditorManager::openEditorWithContents(const QString &editorId,
|
||||||
QString *titlePattern,
|
QString *titlePattern,
|
||||||
const QString &contents)
|
const QString &contents)
|
||||||
{
|
{
|
||||||
if (debugEditorManager)
|
if (debugEditorManager)
|
||||||
qDebug() << Q_FUNC_INFO << editorKind << titlePattern << contents;
|
qDebug() << Q_FUNC_INFO << editorId << titlePattern << contents;
|
||||||
|
|
||||||
if (editorKind.isEmpty())
|
if (editorId.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||||
IEditor *edt = createEditor(editorKind);
|
IEditor *edt = createEditor(editorId);
|
||||||
if (!edt) {
|
if (!edt) {
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1311,7 +1310,7 @@ EditorManager::ReadOnlyAction
|
|||||||
|
|
||||||
QPushButton *sccButton = 0;
|
QPushButton *sccButton = 0;
|
||||||
if (versionControl && versionControl->supportsOperation(IVersionControl::OpenOperation))
|
if (versionControl && versionControl->supportsOperation(IVersionControl::OpenOperation))
|
||||||
sccButton = msgBox.addButton(tr("Open with VCS (%1)").arg(versionControl->name()), QMessageBox::AcceptRole);
|
sccButton = msgBox.addButton(tr("Open with VCS (%1)").arg(versionControl->displayName()), QMessageBox::AcceptRole);
|
||||||
|
|
||||||
QPushButton *makeWritableButton = msgBox.addButton(tr("Make writable"), QMessageBox::AcceptRole);
|
QPushButton *makeWritableButton = msgBox.addButton(tr("Make writable"), QMessageBox::AcceptRole);
|
||||||
|
|
||||||
@@ -1556,7 +1555,7 @@ QByteArray EditorManager::saveState() const
|
|||||||
stream << entries.count();
|
stream << entries.count();
|
||||||
|
|
||||||
foreach (OpenEditorsModel::Entry entry, entries) {
|
foreach (OpenEditorsModel::Entry entry, entries) {
|
||||||
stream << entry.fileName() << entry.displayName() << entry.kind();
|
stream << entry.fileName() << entry.displayName() << entry.id();
|
||||||
}
|
}
|
||||||
|
|
||||||
stream << m_d->m_splitter->saveState();
|
stream << m_d->m_splitter->saveState();
|
||||||
@@ -1595,11 +1594,11 @@ bool EditorManager::restoreState(const QByteArray &state)
|
|||||||
stream >> fileName;
|
stream >> fileName;
|
||||||
QString displayName;
|
QString displayName;
|
||||||
stream >> displayName;
|
stream >> displayName;
|
||||||
QByteArray kind;
|
QString id;
|
||||||
stream >> kind;
|
stream >> id;
|
||||||
|
|
||||||
if (!fileName.isEmpty() && !displayName.isEmpty()){
|
if (!fileName.isEmpty() && !displayName.isEmpty()){
|
||||||
m_d->m_editorModel->addRestoredEditor(fileName, displayName, kind);
|
m_d->m_editorModel->addRestoredEditor(fileName, displayName, id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1685,35 +1684,35 @@ void EditorManager::revertToSaved()
|
|||||||
currEditor->file()->modified(&temp);
|
currEditor->file()->modified(&temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorManager::showEditorInfoBar(const QString &kind,
|
void EditorManager::showEditorInfoBar(const QString &id,
|
||||||
const QString &infoText,
|
const QString &infoText,
|
||||||
const QString &buttonText,
|
const QString &buttonText,
|
||||||
QObject *object, const char *member)
|
QObject *object, const char *member)
|
||||||
{
|
{
|
||||||
|
|
||||||
currentEditorView()->showEditorInfoBar(kind, infoText, buttonText, object, member);
|
currentEditorView()->showEditorInfoBar(id, infoText, buttonText, object, member);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EditorManager::hideEditorInfoBar(const QString &kind)
|
void EditorManager::hideEditorInfoBar(const QString &id)
|
||||||
{
|
{
|
||||||
Core::Internal::EditorView *cev = currentEditorView();
|
Core::Internal::EditorView *cev = currentEditorView();
|
||||||
if (cev)
|
if (cev)
|
||||||
cev->hideEditorInfoBar(kind);
|
cev->hideEditorInfoBar(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorManager::showEditorStatusBar(const QString &kind,
|
void EditorManager::showEditorStatusBar(const QString &id,
|
||||||
const QString &infoText,
|
const QString &infoText,
|
||||||
const QString &buttonText,
|
const QString &buttonText,
|
||||||
QObject *object, const char *member)
|
QObject *object, const char *member)
|
||||||
{
|
{
|
||||||
|
|
||||||
currentEditorView()->showEditorStatusBar(kind, infoText, buttonText, object, member);
|
currentEditorView()->showEditorStatusBar(id, infoText, buttonText, object, member);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorManager::hideEditorStatusBar(const QString &kind)
|
void EditorManager::hideEditorStatusBar(const QString &id)
|
||||||
{
|
{
|
||||||
currentEditorView()->hideEditorStatusBar(kind);
|
currentEditorView()->hideEditorStatusBar(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString EditorManager::externalEditorHelpText() const
|
QString EditorManager::externalEditorHelpText() const
|
||||||
|
|||||||
@@ -113,16 +113,16 @@ public:
|
|||||||
Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag)
|
Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag)
|
||||||
|
|
||||||
IEditor *openEditor(const QString &fileName,
|
IEditor *openEditor(const QString &fileName,
|
||||||
const QString &editorKind = QString(),
|
const QString &editorId = QString(),
|
||||||
OpenEditorFlags flags = 0);
|
OpenEditorFlags flags = 0);
|
||||||
IEditor *openEditorWithContents(const QString &editorKind,
|
IEditor *openEditorWithContents(const QString &editorId,
|
||||||
QString *titlePattern = 0,
|
QString *titlePattern = 0,
|
||||||
const QString &contents = QString());
|
const QString &contents = QString());
|
||||||
|
|
||||||
bool openExternalEditor(const QString &fileName, const QString &editorKind);
|
bool openExternalEditor(const QString &fileName, const QString &editorId);
|
||||||
|
|
||||||
QStringList getOpenFileNames() const;
|
QStringList getOpenFileNames() const;
|
||||||
QString getOpenWithEditorKind(const QString &fileName, bool *isExternalEditor = 0) const;
|
QString getOpenWithEditorId(const QString &fileName, bool *isExternalEditor = 0) const;
|
||||||
|
|
||||||
void ensureEditorManagerVisible();
|
void ensureEditorManagerVisible();
|
||||||
bool hasEditor(const QString &fileName) const;
|
bool hasEditor(const QString &fileName) const;
|
||||||
@@ -153,7 +153,7 @@ public:
|
|||||||
QByteArray saveState() const;
|
QByteArray saveState() const;
|
||||||
bool restoreState(const QByteArray &state);
|
bool restoreState(const QByteArray &state);
|
||||||
|
|
||||||
IEditor *restoreEditor(QString fileName, QString editorKind, EditorGroup *group);
|
IEditor *restoreEditor(QString fileName, QString editorId, EditorGroup *group);
|
||||||
|
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
void readSettings();
|
void readSettings();
|
||||||
@@ -161,19 +161,19 @@ public:
|
|||||||
Internal::OpenEditorsWindow *windowPopup() const;
|
Internal::OpenEditorsWindow *windowPopup() const;
|
||||||
void showPopupOrSelectDocument() const;
|
void showPopupOrSelectDocument() const;
|
||||||
|
|
||||||
void showEditorInfoBar(const QString &kind,
|
void showEditorInfoBar(const QString &id,
|
||||||
const QString &infoText,
|
const QString &infoText,
|
||||||
const QString &buttonText = QString(),
|
const QString &buttonText = QString(),
|
||||||
QObject *object = 0, const char *member = 0);
|
QObject *object = 0, const char *member = 0);
|
||||||
|
|
||||||
void hideEditorInfoBar(const QString &kind);
|
void hideEditorInfoBar(const QString &id);
|
||||||
|
|
||||||
void showEditorStatusBar(const QString &kind,
|
void showEditorStatusBar(const QString &id,
|
||||||
const QString &infoText,
|
const QString &infoText,
|
||||||
const QString &buttonText = QString(),
|
const QString &buttonText = QString(),
|
||||||
QObject *object = 0, const char *member = 0);
|
QObject *object = 0, const char *member = 0);
|
||||||
|
|
||||||
void hideEditorStatusBar(const QString &kind);
|
void hideEditorStatusBar(const QString &id);
|
||||||
|
|
||||||
EditorFactoryList editorFactories(const MimeType &mimeType, bool bestMatchOnly = true) const;
|
EditorFactoryList editorFactories(const MimeType &mimeType, bool bestMatchOnly = true) const;
|
||||||
ExternalEditorList externalEditors(const MimeType &mimeType, bool bestMatchOnly = true) const;
|
ExternalEditorList externalEditors(const MimeType &mimeType, bool bestMatchOnly = true) const;
|
||||||
@@ -244,7 +244,7 @@ private:
|
|||||||
void setCurrentView(Core::Internal::SplitterOrView *view);
|
void setCurrentView(Core::Internal::SplitterOrView *view);
|
||||||
IEditor *activateEditor(Core::Internal::EditorView *view, Core::IEditor *editor, OpenEditorFlags flags = 0);
|
IEditor *activateEditor(Core::Internal::EditorView *view, Core::IEditor *editor, OpenEditorFlags flags = 0);
|
||||||
IEditor *openEditor(Core::Internal::EditorView *view, const QString &fileName,
|
IEditor *openEditor(Core::Internal::EditorView *view, const QString &fileName,
|
||||||
const QString &editorKind = QString(),
|
const QString &editorId = QString(),
|
||||||
OpenEditorFlags flags = 0);
|
OpenEditorFlags flags = 0);
|
||||||
Core::Internal::SplitterOrView *currentSplitterOrView() const;
|
Core::Internal::SplitterOrView *currentSplitterOrView() const;
|
||||||
|
|
||||||
|
|||||||
@@ -224,12 +224,12 @@ EditorView::~EditorView()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorView::showEditorInfoBar(const QString &kind,
|
void EditorView::showEditorInfoBar(const QString &id,
|
||||||
const QString &infoText,
|
const QString &infoText,
|
||||||
const QString &buttonText,
|
const QString &buttonText,
|
||||||
QObject *object, const char *member)
|
QObject *object, const char *member)
|
||||||
{
|
{
|
||||||
m_infoWidgetKind = kind;
|
m_infoWidgetId = id;
|
||||||
m_infoWidgetLabel->setText(infoText);
|
m_infoWidgetLabel->setText(infoText);
|
||||||
m_infoWidgetButton->setText(buttonText);
|
m_infoWidgetButton->setText(buttonText);
|
||||||
m_infoWidgetButton->disconnect();
|
m_infoWidgetButton->disconnect();
|
||||||
@@ -239,18 +239,18 @@ void EditorView::showEditorInfoBar(const QString &kind,
|
|||||||
m_editorForInfoWidget = currentEditor();
|
m_editorForInfoWidget = currentEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorView::hideEditorInfoBar(const QString &kind)
|
void EditorView::hideEditorInfoBar(const QString &id)
|
||||||
{
|
{
|
||||||
if (kind == m_infoWidgetKind)
|
if (id == m_infoWidgetId)
|
||||||
m_infoWidget->setVisible(false);
|
m_infoWidget->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorView::showEditorStatusBar(const QString &kind,
|
void EditorView::showEditorStatusBar(const QString &id,
|
||||||
const QString &infoText,
|
const QString &infoText,
|
||||||
const QString &buttonText,
|
const QString &buttonText,
|
||||||
QObject *object, const char *member)
|
QObject *object, const char *member)
|
||||||
{
|
{
|
||||||
m_statusWidgetKind = kind;
|
m_statusWidgetId = id;
|
||||||
m_statusWidgetLabel->setText(infoText);
|
m_statusWidgetLabel->setText(infoText);
|
||||||
m_statusWidgetButton->setText(buttonText);
|
m_statusWidgetButton->setText(buttonText);
|
||||||
m_statusWidgetButton->disconnect();
|
m_statusWidgetButton->disconnect();
|
||||||
@@ -261,9 +261,9 @@ void EditorView::showEditorStatusBar(const QString &kind,
|
|||||||
//m_editorForInfoWidget = currentEditor();
|
//m_editorForInfoWidget = currentEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorView::hideEditorStatusBar(const QString &kind)
|
void EditorView::hideEditorStatusBar(const QString &id)
|
||||||
{
|
{
|
||||||
if (kind == m_statusWidgetKind) {
|
if (id == m_statusWidgetId) {
|
||||||
m_statusWidget->setVisible(false);
|
m_statusWidget->setVisible(false);
|
||||||
m_statusHLine->setVisible(false);
|
m_statusHLine->setVisible(false);
|
||||||
}
|
}
|
||||||
@@ -470,7 +470,7 @@ void EditorView::updateEditorHistory(IEditor *editor)
|
|||||||
EditLocation location;
|
EditLocation location;
|
||||||
location.file = file;
|
location.file = file;
|
||||||
location.fileName = file->fileName();
|
location.fileName = file->fileName();
|
||||||
location.kind = editor->kind();
|
location.id = editor->id();
|
||||||
location.state = QVariant(state);
|
location.state = QVariant(state);
|
||||||
|
|
||||||
for(int i = 0; i < m_editorHistory.size(); ++i) {
|
for(int i = 0; i < m_editorHistory.size(); ++i) {
|
||||||
@@ -510,7 +510,7 @@ void EditorView::addCurrentPositionToNavigationHistory(IEditor *editor, const QB
|
|||||||
EditLocation location;
|
EditLocation location;
|
||||||
location.file = file;
|
location.file = file;
|
||||||
location.fileName = file->fileName();
|
location.fileName = file->fileName();
|
||||||
location.kind = editor->kind();
|
location.id = editor->id();
|
||||||
location.state = QVariant(state);
|
location.state = QVariant(state);
|
||||||
m_currentNavigationHistoryPosition = qMin(m_currentNavigationHistoryPosition, m_navigationHistory.size()); // paranoia
|
m_currentNavigationHistoryPosition = qMin(m_currentNavigationHistoryPosition, m_navigationHistory.size()); // paranoia
|
||||||
m_navigationHistory.insert(m_currentNavigationHistoryPosition, location);
|
m_navigationHistory.insert(m_currentNavigationHistoryPosition, location);
|
||||||
@@ -567,7 +567,7 @@ void EditorView::updateCurrentPositionInNavigationHistory()
|
|||||||
}
|
}
|
||||||
location->file = file;
|
location->file = file;
|
||||||
location->fileName = file->fileName();
|
location->fileName = file->fileName();
|
||||||
location->kind = editor->kind();
|
location->id = editor->id();
|
||||||
location->state = QVariant(editor->saveState());
|
location->state = QVariant(editor->saveState());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,7 +582,7 @@ void EditorView::goBackInNavigationHistory()
|
|||||||
if (location.file) {
|
if (location.file) {
|
||||||
editor = em->activateEditor(this, location.file, EditorManager::IgnoreNavigationHistory);
|
editor = em->activateEditor(this, location.file, EditorManager::IgnoreNavigationHistory);
|
||||||
} else {
|
} else {
|
||||||
editor = em->openEditor(this, location.fileName, location.kind, EditorManager::IgnoreNavigationHistory);
|
editor = em->openEditor(this, location.fileName, location.id, EditorManager::IgnoreNavigationHistory);
|
||||||
if (!editor) {
|
if (!editor) {
|
||||||
m_navigationHistory.removeAt(m_currentNavigationHistoryPosition);
|
m_navigationHistory.removeAt(m_currentNavigationHistoryPosition);
|
||||||
continue;
|
continue;
|
||||||
@@ -606,7 +606,7 @@ void EditorView::goForwardInNavigationHistory()
|
|||||||
if (location.file) {
|
if (location.file) {
|
||||||
editor = em->activateEditor(this, location.file, EditorManager::IgnoreNavigationHistory);
|
editor = em->activateEditor(this, location.file, EditorManager::IgnoreNavigationHistory);
|
||||||
} else {
|
} else {
|
||||||
editor = em->openEditor(this, location.fileName, location.kind, EditorManager::IgnoreNavigationHistory);
|
editor = em->openEditor(this, location.fileName, location.id, EditorManager::IgnoreNavigationHistory);
|
||||||
if (!editor) {
|
if (!editor) {
|
||||||
//TODO
|
//TODO
|
||||||
qDebug() << Q_FUNC_INFO << "can't open file" << location.fileName;
|
qDebug() << Q_FUNC_INFO << "can't open file" << location.fileName;
|
||||||
@@ -963,10 +963,10 @@ QByteArray SplitterOrView::saveState() const
|
|||||||
|
|
||||||
if (e && e == em->currentEditor()) {
|
if (e && e == em->currentEditor()) {
|
||||||
stream << QByteArray("currenteditor")
|
stream << QByteArray("currenteditor")
|
||||||
<< e->file()->fileName() << e->kind() << e->saveState();
|
<< e->file()->fileName() << e->id() << e->saveState();
|
||||||
} else if (e) {
|
} else if (e) {
|
||||||
stream << QByteArray("editor")
|
stream << QByteArray("editor")
|
||||||
<< e->file()->fileName() << e->kind() << e->saveState();
|
<< e->file()->fileName() << e->id() << e->saveState();
|
||||||
} else {
|
} else {
|
||||||
stream << QByteArray("empty");
|
stream << QByteArray("empty");
|
||||||
}
|
}
|
||||||
@@ -990,10 +990,10 @@ void SplitterOrView::restoreState(const QByteArray &state)
|
|||||||
} else if (mode == "editor" || mode == "currenteditor") {
|
} else if (mode == "editor" || mode == "currenteditor") {
|
||||||
EditorManager *em = CoreImpl::instance()->editorManager();
|
EditorManager *em = CoreImpl::instance()->editorManager();
|
||||||
QString fileName;
|
QString fileName;
|
||||||
QByteArray kind;
|
QByteArray id;
|
||||||
QByteArray editorState;
|
QByteArray editorState;
|
||||||
stream >> fileName >> kind >> editorState;
|
stream >> fileName >> id >> editorState;
|
||||||
IEditor *e = em->openEditor(view(), fileName, kind, Core::EditorManager::IgnoreNavigationHistory
|
IEditor *e = em->openEditor(view(), fileName, id, Core::EditorManager::IgnoreNavigationHistory
|
||||||
| Core::EditorManager::NoActivate);
|
| Core::EditorManager::NoActivate);
|
||||||
|
|
||||||
if (!e) {
|
if (!e) {
|
||||||
|
|||||||
@@ -60,12 +60,12 @@ class OpenEditorsModel;
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
struct EditLocation {
|
struct EditLocation {
|
||||||
QPointer<IFile> file;
|
QPointer<IFile> file;
|
||||||
QString fileName;
|
QString fileName;
|
||||||
QString kind;
|
QString id;
|
||||||
QVariant state;
|
QVariant state;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EditorView : public QWidget
|
class EditorView : public QWidget
|
||||||
{
|
{
|
||||||
@@ -84,17 +84,17 @@ public:
|
|||||||
bool hasEditor(IEditor *editor) const;
|
bool hasEditor(IEditor *editor) const;
|
||||||
|
|
||||||
QList<IEditor *> editors() const;
|
QList<IEditor *> editors() const;
|
||||||
void showEditorInfoBar(const QString &kind,
|
void showEditorInfoBar(const QString &id,
|
||||||
const QString &infoText,
|
const QString &infoText,
|
||||||
const QString &buttonText,
|
const QString &buttonText,
|
||||||
QObject *object, const char *member);
|
QObject *object, const char *member);
|
||||||
void hideEditorInfoBar(const QString &kind);
|
void hideEditorInfoBar(const QString &id);
|
||||||
|
|
||||||
void showEditorStatusBar(const QString &kind,
|
void showEditorStatusBar(const QString &id,
|
||||||
const QString &infoText,
|
const QString &infoText,
|
||||||
const QString &buttonText,
|
const QString &buttonText,
|
||||||
QObject *object, const char *member);
|
QObject *object, const char *member);
|
||||||
void hideEditorStatusBar(const QString &kind);
|
void hideEditorStatusBar(const QString &id);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void closeView();
|
void closeView();
|
||||||
@@ -118,12 +118,12 @@ private:
|
|||||||
QToolButton *m_closeButton;
|
QToolButton *m_closeButton;
|
||||||
QToolButton *m_lockButton;
|
QToolButton *m_lockButton;
|
||||||
QWidget *m_defaultToolBar;
|
QWidget *m_defaultToolBar;
|
||||||
QString m_infoWidgetKind;
|
QString m_infoWidgetId;
|
||||||
QFrame *m_infoWidget;
|
QFrame *m_infoWidget;
|
||||||
QLabel *m_infoWidgetLabel;
|
QLabel *m_infoWidgetLabel;
|
||||||
QToolButton *m_infoWidgetButton;
|
QToolButton *m_infoWidgetButton;
|
||||||
IEditor *m_editorForInfoWidget;
|
IEditor *m_editorForInfoWidget;
|
||||||
QString m_statusWidgetKind;
|
QString m_statusWidgetId;
|
||||||
QFrame *m_statusHLine;
|
QFrame *m_statusHLine;
|
||||||
QFrame *m_statusWidget;
|
QFrame *m_statusWidget;
|
||||||
QLabel *m_statusWidgetLabel;
|
QLabel *m_statusWidgetLabel;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
virtual bool createNew(const QString &contents = QString()) = 0;
|
virtual bool createNew(const QString &contents = QString()) = 0;
|
||||||
virtual bool open(const QString &fileName = QString()) = 0;
|
virtual bool open(const QString &fileName = QString()) = 0;
|
||||||
virtual IFile *file() = 0;
|
virtual IFile *file() = 0;
|
||||||
virtual const char *kind() const = 0;
|
virtual QString id() const = 0;
|
||||||
virtual QString displayName() const = 0;
|
virtual QString displayName() const = 0;
|
||||||
virtual void setDisplayName(const QString &title) = 0;
|
virtual void setDisplayName(const QString &title) = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ public:
|
|||||||
virtual ~IExternalEditor() {}
|
virtual ~IExternalEditor() {}
|
||||||
|
|
||||||
virtual QStringList mimeTypes() const = 0;
|
virtual QStringList mimeTypes() const = 0;
|
||||||
virtual QString kind() const = 0;
|
virtual QString id() const = 0;
|
||||||
|
virtual QString displayName() const = 0;
|
||||||
|
|
||||||
virtual bool startEditor(const QString &fileName, QString *errorMessage) = 0;
|
virtual bool startEditor(const QString &fileName, QString *errorMessage) = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -41,12 +41,14 @@ namespace Core {
|
|||||||
QString OpenEditorsModel::Entry::fileName() const {
|
QString OpenEditorsModel::Entry::fileName() const {
|
||||||
return editor ? editor->file()->fileName() : m_fileName;
|
return editor ? editor->file()->fileName() : m_fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString OpenEditorsModel::Entry::displayName() const {
|
QString OpenEditorsModel::Entry::displayName() const {
|
||||||
return editor ? editor->displayName() : m_displayName;
|
return editor ? editor->displayName() : m_displayName;
|
||||||
}
|
}
|
||||||
QByteArray OpenEditorsModel::Entry::kind() const
|
|
||||||
|
QString OpenEditorsModel::Entry::id() const
|
||||||
{
|
{
|
||||||
return editor ? QByteArray(editor->kind()) : m_kind;
|
return editor ? editor->id() : m_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
int OpenEditorsModel::columnCount(const QModelIndex &parent) const
|
int OpenEditorsModel::columnCount(const QModelIndex &parent) const
|
||||||
@@ -86,12 +88,12 @@ void OpenEditorsModel::addEditor(IEditor *editor, bool isDuplicate)
|
|||||||
addEntry(entry);
|
addEntry(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenEditorsModel::addRestoredEditor(const QString &fileName, const QString &displayName, const QByteArray &kind)
|
void OpenEditorsModel::addRestoredEditor(const QString &fileName, const QString &displayName, const QString &id)
|
||||||
{
|
{
|
||||||
Entry entry;
|
Entry entry;
|
||||||
entry.m_fileName = fileName;
|
entry.m_fileName = fileName;
|
||||||
entry.m_displayName = displayName;
|
entry.m_displayName = displayName;
|
||||||
entry.m_kind = kind;
|
entry.m_id = id;
|
||||||
addEntry(entry);
|
addEntry(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,7 +261,7 @@ QVariant OpenEditorsModel::data(const QModelIndex &index, int role) const
|
|||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::DisplayRole:
|
case Qt::DisplayRole:
|
||||||
return (e.editor && e.editor->file()->isModified())
|
return (e.editor && e.editor->file()->isModified())
|
||||||
? e.displayName() + QLatin1String("*")
|
? e.displayName() + QLatin1Char('*')
|
||||||
: e.displayName();
|
: e.displayName();
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
return (e.editor && e.editor->file()->isReadOnly())
|
return (e.editor && e.editor->file()->isReadOnly())
|
||||||
@@ -274,7 +276,7 @@ QVariant OpenEditorsModel::data(const QModelIndex &index, int role) const
|
|||||||
case Qt::UserRole + 1:
|
case Qt::UserRole + 1:
|
||||||
return e.fileName();
|
return e.fileName();
|
||||||
case Qt::UserRole + 2:
|
case Qt::UserRole + 2:
|
||||||
return e.editor ? QByteArray(e.editor->kind()) : e.kind();
|
return e.editor ? e.editor->id() : e.id();
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
|
QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
|
||||||
|
|
||||||
void addEditor(IEditor *editor, bool isDuplicate = false);
|
void addEditor(IEditor *editor, bool isDuplicate = false);
|
||||||
void addRestoredEditor(const QString &fileName, const QString &displayName, const QByteArray &kind);
|
void addRestoredEditor(const QString &fileName, const QString &displayName, const QString &id);
|
||||||
QModelIndex firstRestoredEditor() const;
|
QModelIndex firstRestoredEditor() const;
|
||||||
|
|
||||||
struct Entry {
|
struct Entry {
|
||||||
@@ -59,10 +59,10 @@ public:
|
|||||||
IEditor *editor;
|
IEditor *editor;
|
||||||
QString fileName() const;
|
QString fileName() const;
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
QByteArray kind() const;
|
QString id() const;
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
QString m_displayName;
|
QString m_displayName;
|
||||||
QByteArray m_kind;
|
QString m_id;
|
||||||
};
|
};
|
||||||
QList<Entry> entries() const { return m_editors; }
|
QList<Entry> entries() const { return m_editors; }
|
||||||
|
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE
|
|||||||
item->setToolTip(0, hi.file->fileName());
|
item->setToolTip(0, hi.file->fileName());
|
||||||
item->setData(0, Qt::UserRole, QVariant::fromValue(hi.file.data()));
|
item->setData(0, Qt::UserRole, QVariant::fromValue(hi.file.data()));
|
||||||
item->setData(0, Qt::UserRole+1, QVariant::fromValue(view));
|
item->setData(0, Qt::UserRole+1, QVariant::fromValue(view));
|
||||||
item->setData(0, Qt::UserRole+2, QVariant::fromValue(hi.kind));
|
item->setData(0, Qt::UserRole+2, QVariant::fromValue(hi.id));
|
||||||
item->setTextAlignment(0, Qt::AlignLeft);
|
item->setTextAlignment(0, Qt::AlignLeft);
|
||||||
|
|
||||||
m_editorList->addTopLevelItem(item);
|
m_editorList->addTopLevelItem(item);
|
||||||
@@ -252,7 +252,7 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE
|
|||||||
item->setIcon(0, emptyIcon);
|
item->setIcon(0, emptyIcon);
|
||||||
item->setText(0, title);
|
item->setText(0, title);
|
||||||
item->setToolTip(0, entry.fileName());
|
item->setToolTip(0, entry.fileName());
|
||||||
item->setData(0, Qt::UserRole+2, QVariant::fromValue(entry.kind()));
|
item->setData(0, Qt::UserRole+2, QVariant::fromValue(entry.id()));
|
||||||
item->setTextAlignment(0, Qt::AlignLeft);
|
item->setTextAlignment(0, Qt::AlignLeft);
|
||||||
|
|
||||||
m_editorList->addTopLevelItem(item);
|
m_editorList->addTopLevelItem(item);
|
||||||
|
|||||||
@@ -37,8 +37,6 @@
|
|||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
class IMode;
|
|
||||||
|
|
||||||
class CORE_EXPORT FindToolBarPlaceHolder : public QWidget
|
class CORE_EXPORT FindToolBarPlaceHolder : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ QString GeneralSettings::id() const
|
|||||||
return QLatin1String("A.General");
|
return QLatin1String("A.General");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GeneralSettings::trName() const
|
QString GeneralSettings::displayName() const
|
||||||
{
|
{
|
||||||
return tr("General");
|
return tr("General");
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ QString GeneralSettings::category() const
|
|||||||
return QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE);
|
return QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GeneralSettings::trCategory() const
|
QString GeneralSettings::displayCategory() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE);
|
return QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ public:
|
|||||||
GeneralSettings();
|
GeneralSettings();
|
||||||
|
|
||||||
QString id() const;
|
QString id() const;
|
||||||
QString trName() const;
|
QString displayName() const;
|
||||||
QString category() const;
|
QString category() const;
|
||||||
QString trCategory() const;
|
QString displayCategory() const;
|
||||||
QWidget* createPage(QWidget *parent);
|
QWidget* createPage(QWidget *parent);
|
||||||
void apply();
|
void apply();
|
||||||
void finish();
|
void finish();
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ public:
|
|||||||
|
|
||||||
virtual QStringList mimeTypes() const = 0;
|
virtual QStringList mimeTypes() const = 0;
|
||||||
|
|
||||||
virtual QString kind() const = 0;
|
virtual QString id() const = 0;
|
||||||
|
virtual QString displayName() const = 0;
|
||||||
|
|
||||||
virtual Core::IFile *open(const QString &fileName) = 0;
|
virtual Core::IFile *open(const QString &fileName) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -47,10 +47,10 @@ public:
|
|||||||
IMode(QObject *parent = 0) : IContext(parent) {}
|
IMode(QObject *parent = 0) : IContext(parent) {}
|
||||||
virtual ~IMode() {}
|
virtual ~IMode() {}
|
||||||
|
|
||||||
virtual QString name() const = 0;
|
virtual QString displayName() const = 0;
|
||||||
virtual QIcon icon() const = 0;
|
virtual QIcon icon() const = 0;
|
||||||
virtual int priority() const = 0;
|
virtual int priority() const = 0;
|
||||||
virtual const char *uniqueModeName() const = 0;
|
virtual QString id() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
IVersionControl(QObject *parent = 0) : QObject(parent) {}
|
IVersionControl(QObject *parent = 0) : QObject(parent) {}
|
||||||
virtual ~IVersionControl() {}
|
virtual ~IVersionControl() {}
|
||||||
|
|
||||||
virtual QString name() const = 0;
|
virtual QString displayName() const = 0;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Returns whether files in this directory should be managed with this
|
* Returns whether files in this directory should be managed with this
|
||||||
|
|||||||
@@ -910,13 +910,13 @@ void MainWindow::openFileWith()
|
|||||||
QStringList fileNames = editorManager()->getOpenFileNames();
|
QStringList fileNames = editorManager()->getOpenFileNames();
|
||||||
foreach (const QString &fileName, fileNames) {
|
foreach (const QString &fileName, fileNames) {
|
||||||
bool isExternal;
|
bool isExternal;
|
||||||
const QString editorKind = editorManager()->getOpenWithEditorKind(fileName, &isExternal);
|
const QString editorId = editorManager()->getOpenWithEditorId(fileName, &isExternal);
|
||||||
if (editorKind.isEmpty())
|
if (editorId.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
if (isExternal) {
|
if (isExternal) {
|
||||||
editorManager()->openExternalEditor(fileName, editorKind);
|
editorManager()->openExternalEditor(fileName, editorId);
|
||||||
} else {
|
} else {
|
||||||
editorManager()->openEditor(fileName, editorKind);
|
editorManager()->openEditor(fileName, editorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ class SettingsDatabase;
|
|||||||
class UniqueIDManager;
|
class UniqueIDManager;
|
||||||
class VariableManager;
|
class VariableManager;
|
||||||
class VCSManager;
|
class VCSManager;
|
||||||
class IMode;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ IMode *ModeManager::currentMode() const
|
|||||||
int ModeManager::indexOf(const QString &id) const
|
int ModeManager::indexOf(const QString &id) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_modes.count(); ++i) {
|
for (int i = 0; i < m_modes.count(); ++i) {
|
||||||
if (m_modes.at(i)->uniqueModeName() == id)
|
if (m_modes.at(i)->id() == id)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
qDebug() << "Warning, no such mode:" << id;
|
qDebug() << "Warning, no such mode:" << id;
|
||||||
@@ -139,13 +139,13 @@ void ModeManager::objectAdded(QObject *obj)
|
|||||||
++index;
|
++index;
|
||||||
|
|
||||||
m_modes.insert(index, mode);
|
m_modes.insert(index, mode);
|
||||||
m_modeStack->insertTab(index, mode->widget(), mode->icon(), mode->name());
|
m_modeStack->insertTab(index, mode->widget(), mode->icon(), mode->displayName());
|
||||||
|
|
||||||
// Register mode shortcut
|
// Register mode shortcut
|
||||||
ActionManager *am = m_mainWindow->actionManager();
|
ActionManager *am = m_mainWindow->actionManager();
|
||||||
const QString shortcutId = QLatin1String("QtCreator.Mode.") + mode->uniqueModeName();
|
const QString shortcutId = QLatin1String("QtCreator.Mode.") + mode->id();
|
||||||
QShortcut *shortcut = new QShortcut(m_mainWindow);
|
QShortcut *shortcut = new QShortcut(m_mainWindow);
|
||||||
shortcut->setWhatsThis(tr("Switch to %1 mode").arg(mode->name()));
|
shortcut->setWhatsThis(tr("Switch to %1 mode").arg(mode->displayName()));
|
||||||
Command *cmd = am->registerShortcut(shortcut, shortcutId, QList<int>() << Constants::C_GLOBAL_ID);
|
Command *cmd = am->registerShortcut(shortcut, shortcutId, QList<int>() << Constants::C_GLOBAL_ID);
|
||||||
|
|
||||||
m_modeShortcuts.insert(index, cmd);
|
m_modeShortcuts.insert(index, cmd);
|
||||||
@@ -163,7 +163,7 @@ void ModeManager::objectAdded(QObject *obj)
|
|||||||
currentCmd->setKeySequence(currentCmd->defaultKeySequence());
|
currentCmd->setKeySequence(currentCmd->defaultKeySequence());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_signalMapper->setMapping(shortcut, mode->uniqueModeName());
|
m_signalMapper->setMapping(shortcut, mode->id());
|
||||||
connect(shortcut, SIGNAL(activated()), m_signalMapper, SLOT(map()));
|
connect(shortcut, SIGNAL(activated()), m_signalMapper, SLOT(map()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -266,14 +266,14 @@ bool EditorManagerPrototype::closeEditors(const QList<Core::IEditor*> editorsToC
|
|||||||
return callee()->closeEditors(editorsToClose, askAboutModifiedEditors);
|
return callee()->closeEditors(editorsToClose, askAboutModifiedEditors);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IEditor *EditorManagerPrototype::openEditor(const QString &fileName, const QString &editorKind)
|
Core::IEditor *EditorManagerPrototype::openEditor(const QString &fileName, const QString &editorId)
|
||||||
{
|
{
|
||||||
return callee()->openEditor(fileName, editorKind);
|
return callee()->openEditor(fileName, editorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IEditor *EditorManagerPrototype::newFile(const QString &editorKind, QString titlePattern, const QString &contents)
|
Core::IEditor *EditorManagerPrototype::newFile(const QString &editorId, QString titlePattern, const QString &contents)
|
||||||
{
|
{
|
||||||
return callee()->openEditorWithContents(editorKind, &titlePattern, contents);
|
return callee()->openEditorWithContents(editorId, &titlePattern, contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
int EditorManagerPrototype::makeEditorWritable(Core::IEditor *editor)
|
int EditorManagerPrototype::makeEditorWritable(Core::IEditor *editor)
|
||||||
@@ -310,9 +310,9 @@ void EditorPrototype::setDisplayName(const QString &title)
|
|||||||
callee()->setDisplayName(title);
|
callee()->setDisplayName(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString EditorPrototype::kind() const
|
QString EditorPrototype::id() const
|
||||||
{
|
{
|
||||||
return QLatin1String(callee()->kind());
|
return callee()->id();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditorPrototype::duplicateSupported() const
|
bool EditorPrototype::duplicateSupported() const
|
||||||
|
|||||||
@@ -178,8 +178,8 @@ public:
|
|||||||
public slots:
|
public slots:
|
||||||
QList<Core::IEditor*> editorsForFiles(QList<Core::IFile*> files) const;
|
QList<Core::IEditor*> editorsForFiles(QList<Core::IFile*> files) const;
|
||||||
bool closeEditors(const QList<Core::IEditor*> editorsToClose, bool askAboutModifiedEditors);
|
bool closeEditors(const QList<Core::IEditor*> editorsToClose, bool askAboutModifiedEditors);
|
||||||
Core::IEditor *openEditor(const QString &fileName, const QString &editorKind);
|
Core::IEditor *openEditor(const QString &fileName, const QString &editorId);
|
||||||
Core::IEditor *newFile(const QString &editorKind, QString titlePattern, const QString &contents);
|
Core::IEditor *newFile(const QString &editorId, QString titlePattern, const QString &contents);
|
||||||
int makeEditorWritable(Core::IEditor *editor);
|
int makeEditorWritable(Core::IEditor *editor);
|
||||||
|
|
||||||
QString toString() const;
|
QString toString() const;
|
||||||
@@ -194,7 +194,7 @@ class EditorPrototype : public QObject, public QScriptable
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName DESIGNABLE false SCRIPTABLE true STORED false)
|
Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName DESIGNABLE false SCRIPTABLE true STORED false)
|
||||||
Q_PROPERTY(QString kind READ kind DESIGNABLE false SCRIPTABLE true STORED false)
|
Q_PROPERTY(QString id READ id DESIGNABLE false SCRIPTABLE true STORED false)
|
||||||
Q_PROPERTY(bool duplicateSupported READ duplicateSupported DESIGNABLE false SCRIPTABLE true STORED false)
|
Q_PROPERTY(bool duplicateSupported READ duplicateSupported DESIGNABLE false SCRIPTABLE true STORED false)
|
||||||
Q_PROPERTY(Core::IFile* file READ file DESIGNABLE false SCRIPTABLE true STORED false)
|
Q_PROPERTY(Core::IFile* file READ file DESIGNABLE false SCRIPTABLE true STORED false)
|
||||||
Q_PROPERTY(QWidget* toolBar READ toolBar DESIGNABLE false SCRIPTABLE true STORED false)
|
Q_PROPERTY(QWidget* toolBar READ toolBar DESIGNABLE false SCRIPTABLE true STORED false)
|
||||||
@@ -205,7 +205,7 @@ public:
|
|||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
void setDisplayName(const QString &title);
|
void setDisplayName(const QString &title);
|
||||||
|
|
||||||
QString kind() const;
|
QString id() const;
|
||||||
bool duplicateSupported() const;
|
bool duplicateSupported() const;
|
||||||
|
|
||||||
Core::IFile *file() const;
|
Core::IFile *file() const;
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ bool VCSManager::showDeleteDialog(const QString &fileName)
|
|||||||
const QString title = QCoreApplication::translate("VCSManager", "Version Control");
|
const QString title = QCoreApplication::translate("VCSManager", "Version Control");
|
||||||
const QString msg = QCoreApplication::translate("VCSManager",
|
const QString msg = QCoreApplication::translate("VCSManager",
|
||||||
"Would you like to remove this file from the version control system (%1)?\n"
|
"Would you like to remove this file from the version control system (%1)?\n"
|
||||||
"Note: This might remove the local file.").arg(vc->name());
|
"Note: This might remove the local file.").arg(vc->displayName());
|
||||||
const QMessageBox::StandardButton button =
|
const QMessageBox::StandardButton button =
|
||||||
QMessageBox::question(0, title, msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
QMessageBox::question(0, title, msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||||
if (button != QMessageBox::Yes)
|
if (button != QMessageBox::Yes)
|
||||||
@@ -154,7 +154,7 @@ CORE_EXPORT QDebug operator<<(QDebug in, const VCSManager &v)
|
|||||||
QDebug nospace = in.nospace();
|
QDebug nospace = in.nospace();
|
||||||
const VersionControlCache::const_iterator cend = v.m_d->m_cachedMatches.constEnd();
|
const VersionControlCache::const_iterator cend = v.m_d->m_cachedMatches.constEnd();
|
||||||
for (VersionControlCache::const_iterator it = v.m_d->m_cachedMatches.constBegin(); it != cend; ++it)
|
for (VersionControlCache::const_iterator it = v.m_d->m_cachedMatches.constBegin(); it != cend; ++it)
|
||||||
nospace << "Directory: " << it.key() << ' ' << it.value()->name() << '\n';
|
nospace << "Directory: " << it.key() << ' ' << it.value()->displayName() << '\n';
|
||||||
nospace << '\n';
|
nospace << '\n';
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ QString CodePasterSettingsPage::id() const
|
|||||||
return QLatin1String("C.CodePaster");
|
return QLatin1String("C.CodePaster");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CodePasterSettingsPage::trName() const
|
QString CodePasterSettingsPage::displayName() const
|
||||||
{
|
{
|
||||||
return tr("CodePaster");
|
return tr("CodePaster");
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ QString CodePasterSettingsPage::category() const
|
|||||||
return QLatin1String(Constants::CPASTER_SETTINGS_CATEGORY);
|
return QLatin1String(Constants::CPASTER_SETTINGS_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CodePasterSettingsPage::trCategory() const
|
QString CodePasterSettingsPage::displayCategory() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("CodePaster", Constants::CPASTER_SETTINGS_TR_CATEGORY);
|
return QCoreApplication::translate("CodePaster", Constants::CPASTER_SETTINGS_TR_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ public:
|
|||||||
CodePasterSettingsPage();
|
CodePasterSettingsPage();
|
||||||
|
|
||||||
QString id() const;
|
QString id() const;
|
||||||
QString trName() const;
|
QString displayName() const;
|
||||||
QString category() const;
|
QString category() const;
|
||||||
QString trCategory() const;
|
QString displayCategory() const;
|
||||||
|
|
||||||
QWidget *createPage(QWidget *parent);
|
QWidget *createPage(QWidget *parent);
|
||||||
void apply();
|
void apply();
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ void CodepasterPlugin::finishFetch(const QString &titleDescription,
|
|||||||
ICore::instance()->messageManager()->printToOutputPane(content, true);
|
ICore::instance()->messageManager()->printToOutputPane(content, true);
|
||||||
} else {
|
} else {
|
||||||
EditorManager* manager = EditorManager::instance();
|
EditorManager* manager = EditorManager::instance();
|
||||||
IEditor* editor = manager->openEditorWithContents(Core::Constants::K_DEFAULT_TEXT_EDITOR, &title, content);
|
IEditor* editor = manager->openEditorWithContents(Core::Constants::K_DEFAULT_TEXT_EDITOR_ID, &title, content);
|
||||||
manager->activateEditor(editor);
|
manager->activateEditor(editor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ QString PasteBinDotComSettings::id() const
|
|||||||
return QLatin1String("B.Pastebin.com");
|
return QLatin1String("B.Pastebin.com");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PasteBinDotComSettings::trName() const
|
QString PasteBinDotComSettings::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Pastebin.com");
|
return tr("Pastebin.com");
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ QString PasteBinDotComSettings::category() const
|
|||||||
return QLatin1String(CodePaster::Constants::CPASTER_SETTINGS_CATEGORY);
|
return QLatin1String(CodePaster::Constants::CPASTER_SETTINGS_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PasteBinDotComSettings::trCategory() const
|
QString PasteBinDotComSettings::displayCategory() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("CodePaster", CodePaster::Constants::CPASTER_SETTINGS_TR_CATEGORY);
|
return QCoreApplication::translate("CodePaster", CodePaster::Constants::CPASTER_SETTINGS_TR_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ public:
|
|||||||
PasteBinDotComSettings();
|
PasteBinDotComSettings();
|
||||||
|
|
||||||
QString id() const;
|
QString id() const;
|
||||||
QString trName() const;
|
QString displayName() const;
|
||||||
QString category() const;
|
QString category() const;
|
||||||
QString trCategory() const;
|
QString displayCategory() const;
|
||||||
|
|
||||||
QWidget *createPage(QWidget *parent);
|
QWidget *createPage(QWidget *parent);
|
||||||
void apply();
|
void apply();
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ QString SettingsPage::id() const
|
|||||||
return QLatin1String("A.General");
|
return QLatin1String("A.General");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SettingsPage::trName() const
|
QString SettingsPage::displayName() const
|
||||||
{
|
{
|
||||||
return tr("General");
|
return tr("General");
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ QString SettingsPage::category() const
|
|||||||
return QLatin1String(Constants::CPASTER_SETTINGS_CATEGORY);
|
return QLatin1String(Constants::CPASTER_SETTINGS_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SettingsPage::trCategory() const
|
QString SettingsPage::displayCategory() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("CodePaster", Constants::CPASTER_SETTINGS_TR_CATEGORY);
|
return QCoreApplication::translate("CodePaster", Constants::CPASTER_SETTINGS_TR_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ public:
|
|||||||
SettingsPage();
|
SettingsPage();
|
||||||
|
|
||||||
QString id() const;
|
QString id() const;
|
||||||
QString trName() const;
|
QString displayName() const;
|
||||||
QString category() const;
|
QString category() const;
|
||||||
QString trCategory() const;
|
QString displayCategory() const;
|
||||||
|
|
||||||
QWidget *createPage(QWidget *parent);
|
QWidget *createPage(QWidget *parent);
|
||||||
void apply();
|
void apply();
|
||||||
|
|||||||
@@ -197,10 +197,10 @@ Core::GeneratedFiles CppClassWizard::generateFiles(const QWizard *w, QString *er
|
|||||||
const QString headerFileName = Core::BaseFileWizard::buildFileName(params.path, params.headerFile, headerSuffix());
|
const QString headerFileName = Core::BaseFileWizard::buildFileName(params.path, params.headerFile, headerSuffix());
|
||||||
|
|
||||||
Core::GeneratedFile sourceFile(sourceFileName);
|
Core::GeneratedFile sourceFile(sourceFileName);
|
||||||
sourceFile.setEditorKind(QLatin1String(Constants::CPPEDITOR_KIND));
|
sourceFile.setEditorId(QLatin1String(Constants::CPPEDITOR_ID));
|
||||||
|
|
||||||
Core::GeneratedFile headerFile(headerFileName);
|
Core::GeneratedFile headerFile(headerFileName);
|
||||||
headerFile.setEditorKind(QLatin1String(Constants::CPPEDITOR_KIND));
|
headerFile.setEditorId(QLatin1String(Constants::CPPEDITOR_ID));
|
||||||
|
|
||||||
QString header, source;
|
QString header, source;
|
||||||
if (!generateHeaderAndSource(params, &header, &source)) {
|
if (!generateHeaderAndSource(params, &header, &source)) {
|
||||||
|
|||||||
@@ -596,9 +596,11 @@ CPPEditorEditable::CPPEditorEditable(CPPEditor *editor)
|
|||||||
: BaseTextEditorEditable(editor)
|
: BaseTextEditorEditable(editor)
|
||||||
{
|
{
|
||||||
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
|
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
|
||||||
m_context << uidm->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
|
m_context << uidm->uniqueIdentifier(CppEditor::Constants::CPPEDITOR_ID);
|
||||||
m_context << uidm->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
|
m_context << uidm->uniqueIdentifier(ProjectExplorer::Constants::LANG_CXX);
|
||||||
m_context << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
|
m_context << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
|
||||||
|
|
||||||
|
setDisplayName(tr(CppEditor::Constants::CPPEDITOR_DISPLAY_NAME));
|
||||||
}
|
}
|
||||||
|
|
||||||
CPPEditor::CPPEditor(QWidget *parent)
|
CPPEditor::CPPEditor(QWidget *parent)
|
||||||
@@ -2007,9 +2009,9 @@ Core::IEditor *CPPEditorEditable::duplicate(QWidget *parent)
|
|||||||
return newEditor->editableInterface();
|
return newEditor->editableInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *CPPEditorEditable::kind() const
|
QString CPPEditorEditable::id() const
|
||||||
{
|
{
|
||||||
return CppEditor::Constants::CPPEDITOR_KIND;
|
return QLatin1String(CppEditor::Constants::CPPEDITOR_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPPEditorEditable::open(const QString & fileName)
|
bool CPPEditorEditable::open(const QString & fileName)
|
||||||
@@ -2095,7 +2097,7 @@ bool CPPEditor::openCppEditorAt(const Link &link)
|
|||||||
return TextEditor::BaseTextEditor::openEditorAt(link.fileName,
|
return TextEditor::BaseTextEditor::openEditorAt(link.fileName,
|
||||||
link.line,
|
link.line,
|
||||||
link.column,
|
link.column,
|
||||||
Constants::C_CPPEDITOR);
|
Constants::CPPEDITOR_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPPEditor::semanticRehighlight()
|
void CPPEditor::semanticRehighlight()
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ public:
|
|||||||
|
|
||||||
bool duplicateSupported() const { return true; }
|
bool duplicateSupported() const { return true; }
|
||||||
Core::IEditor *duplicate(QWidget *parent);
|
Core::IEditor *duplicate(QWidget *parent);
|
||||||
const char *kind() const;
|
QString id() const;
|
||||||
|
|
||||||
bool isTemporary() const { return false; }
|
bool isTemporary() const { return false; }
|
||||||
virtual bool open(const QString & fileName);
|
virtual bool open(const QString & fileName);
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ namespace Constants {
|
|||||||
|
|
||||||
const char * const FORMATCODE = "CppEditor.FormatCode";
|
const char * const FORMATCODE = "CppEditor.FormatCode";
|
||||||
const char * const M_CONTEXT = "CppEditor.ContextMenu";
|
const char * const M_CONTEXT = "CppEditor.ContextMenu";
|
||||||
const char * const C_CPPEDITOR = "C++ Editor";
|
const char * const CPPEDITOR_ID = "CppPlugin.C++Editor";
|
||||||
const char * const CPPEDITOR_KIND = QT_TRANSLATE_NOOP("OpenWith::Editors", "C++ Editor");
|
const char * const CPPEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("OpenWith::Editors", "C++ Editor");
|
||||||
const char * const SWITCH_DECLARATION_DEFINITION = "CppEditor.SwitchDeclarationDefinition";
|
const char * const SWITCH_DECLARATION_DEFINITION = "CppEditor.SwitchDeclarationDefinition";
|
||||||
const char * const RENAME_SYMBOL_UNDER_CURSOR = "CppEditor.RenameSymbolUnderCursor";
|
const char * const RENAME_SYMBOL_UNDER_CURSOR = "CppEditor.RenameSymbolUnderCursor";
|
||||||
const char * const FIND_USAGES = "CppEditor.FindUsages";
|
const char * const FIND_USAGES = "CppEditor.FindUsages";
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ Core::GeneratedFiles CppFileWizard::generateFilesFromPath(const QString &path,
|
|||||||
const QString fileName = Core::BaseFileWizard::buildFileName(path, name, preferredSuffix(mimeType));
|
const QString fileName = Core::BaseFileWizard::buildFileName(path, name, preferredSuffix(mimeType));
|
||||||
|
|
||||||
Core::GeneratedFile file(fileName);
|
Core::GeneratedFile file(fileName);
|
||||||
file.setEditorKind(QLatin1String(Constants::C_CPPEDITOR));
|
file.setEditorId(QLatin1String(Constants::CPPEDITOR_ID));
|
||||||
file.setContents(fileContents(m_type, fileName));
|
file.setContents(fileContents(m_type, fileName));
|
||||||
|
|
||||||
return Core::GeneratedFiles() << file;
|
return Core::GeneratedFiles() << file;
|
||||||
|
|||||||
@@ -68,7 +68,6 @@ enum { QUICKFIX_INTERVAL = 20 };
|
|||||||
//////////////////////////// CppEditorFactory /////////////////////////////
|
//////////////////////////// CppEditorFactory /////////////////////////////
|
||||||
|
|
||||||
CppEditorFactory::CppEditorFactory(CppPlugin *owner) :
|
CppEditorFactory::CppEditorFactory(CppPlugin *owner) :
|
||||||
m_kind(QLatin1String(CppEditor::Constants::CPPEDITOR_KIND)),
|
|
||||||
m_owner(owner)
|
m_owner(owner)
|
||||||
{
|
{
|
||||||
m_mimeTypes << QLatin1String(CppEditor::Constants::C_SOURCE_MIMETYPE)
|
m_mimeTypes << QLatin1String(CppEditor::Constants::C_SOURCE_MIMETYPE)
|
||||||
@@ -88,14 +87,19 @@ CppEditorFactory::CppEditorFactory(CppPlugin *owner) :
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CppEditorFactory::kind() const
|
QString CppEditorFactory::id() const
|
||||||
{
|
{
|
||||||
return m_kind;
|
return QLatin1String(QLatin1String(CppEditor::Constants::CPPEDITOR_ID));
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CppEditorFactory::displayName() const
|
||||||
|
{
|
||||||
|
return tr(CppEditor::Constants::CPPEDITOR_DISPLAY_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IFile *CppEditorFactory::open(const QString &fileName)
|
Core::IFile *CppEditorFactory::open(const QString &fileName)
|
||||||
{
|
{
|
||||||
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, kind());
|
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, id());
|
||||||
return iface ? iface->file() : 0;
|
return iface ? iface->file() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,8 +208,8 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
|
|||||||
CppFileWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
|
CppFileWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
|
||||||
|
|
||||||
wizardParameters.setCategory(QLatin1String("C.C++"));
|
wizardParameters.setCategory(QLatin1String("C.C++"));
|
||||||
wizardParameters.setTrCategory(tr("C++"));
|
wizardParameters.setDisplayCategory(tr("C++"));
|
||||||
wizardParameters.setName(tr("C++ Class"));
|
wizardParameters.setDisplayName(tr("C++ Class"));
|
||||||
wizardParameters.setId(QLatin1String("A.Class"));
|
wizardParameters.setId(QLatin1String("A.Class"));
|
||||||
wizardParameters.setKind(Core::IWizard::ClassWizard);
|
wizardParameters.setKind(Core::IWizard::ClassWizard);
|
||||||
wizardParameters.setDescription(tr("Creates a header and a source file for a new class."));
|
wizardParameters.setDescription(tr("Creates a header and a source file for a new class."));
|
||||||
@@ -213,17 +217,17 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
|
|||||||
|
|
||||||
wizardParameters.setKind(Core::IWizard::FileWizard);
|
wizardParameters.setKind(Core::IWizard::FileWizard);
|
||||||
wizardParameters.setDescription(tr("Creates a C++ source file."));
|
wizardParameters.setDescription(tr("Creates a C++ source file."));
|
||||||
wizardParameters.setName(tr("C++ Source File"));
|
wizardParameters.setDisplayName(tr("C++ Source File"));
|
||||||
wizardParameters.setId(QLatin1String("B.Source"));
|
wizardParameters.setId(QLatin1String("B.Source"));
|
||||||
addAutoReleasedObject(new CppFileWizard(wizardParameters, Source, core));
|
addAutoReleasedObject(new CppFileWizard(wizardParameters, Source, core));
|
||||||
|
|
||||||
wizardParameters.setDescription(tr("Creates a C++ header file."));
|
wizardParameters.setDescription(tr("Creates a C++ header file."));
|
||||||
wizardParameters.setName(tr("C++ Header File"));
|
wizardParameters.setDisplayName(tr("C++ Header File"));
|
||||||
wizardParameters.setId(QLatin1String("C.Header"));
|
wizardParameters.setId(QLatin1String("C.Header"));
|
||||||
addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, core));
|
addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, core));
|
||||||
|
|
||||||
QList<int> context;
|
QList<int> context;
|
||||||
context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
|
context << core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::CPPEDITOR_ID);
|
||||||
|
|
||||||
Core::ActionManager *am = core->actionManager();
|
Core::ActionManager *am = core->actionManager();
|
||||||
Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT);
|
Core::ActionContainer *contextMenu= am->createMenu(CppEditor::Constants::M_CONTEXT);
|
||||||
@@ -274,7 +278,7 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
|
|||||||
connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles()));
|
connect(m_updateCodeModelAction, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles()));
|
||||||
cppToolsMenu->addAction(cmd);
|
cppToolsMenu->addAction(cmd);
|
||||||
|
|
||||||
m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::C_CPPEDITOR,
|
m_actionHandler = new TextEditor::TextEditorActionHandler(CppEditor::Constants::CPPEDITOR_ID,
|
||||||
TextEditor::TextEditorActionHandler::Format
|
TextEditor::TextEditorActionHandler::Format
|
||||||
| TextEditor::TextEditorActionHandler::UnCommentSelection
|
| TextEditor::TextEditorActionHandler::UnCommentSelection
|
||||||
| TextEditor::TextEditorActionHandler::UnCollapseAll);
|
| TextEditor::TextEditorActionHandler::UnCollapseAll);
|
||||||
|
|||||||
@@ -115,11 +115,11 @@ public:
|
|||||||
|
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
virtual QString kind() const;
|
virtual QString id() const;
|
||||||
|
virtual QString displayName() const;
|
||||||
Core::IFile *open(const QString &fileName);
|
Core::IFile *open(const QString &fileName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_kind;
|
|
||||||
CppPlugin *m_owner;
|
CppPlugin *m_owner;
|
||||||
QStringList m_mimeTypes;
|
QStringList m_mimeTypes;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ QString CompletionSettingsPage::id() const
|
|||||||
return QLatin1String("P.Completion");
|
return QLatin1String("P.Completion");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CompletionSettingsPage::trName() const
|
QString CompletionSettingsPage::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Completion");
|
return tr("Completion");
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ QString CompletionSettingsPage::category() const
|
|||||||
return QLatin1String(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY);
|
return QLatin1String(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CompletionSettingsPage::trCategory() const
|
QString CompletionSettingsPage::displayCategory() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("Text Editor", TextEditor::Constants::TEXT_EDITOR_SETTINGS_TR_CATEGORY);
|
return QCoreApplication::translate("Text Editor", TextEditor::Constants::TEXT_EDITOR_SETTINGS_TR_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ public:
|
|||||||
~CompletionSettingsPage();
|
~CompletionSettingsPage();
|
||||||
|
|
||||||
QString id() const;
|
QString id() const;
|
||||||
QString trName() const;
|
QString displayName() const;
|
||||||
QString category() const;
|
QString category() const;
|
||||||
QString trCategory() const;
|
QString displayCategory() const;
|
||||||
|
|
||||||
QWidget *createPage(QWidget *parent);
|
QWidget *createPage(QWidget *parent);
|
||||||
void apply();
|
void apply();
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public:
|
|||||||
CppClassesFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
CppClassesFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
||||||
~CppClassesFilter();
|
~CppClassesFilter();
|
||||||
|
|
||||||
QString trName() const { return tr("Classes"); }
|
QString displayName() const { return tr("Classes"); }
|
||||||
QString name() const { return QLatin1String("Classes"); }
|
QString id() const { return QLatin1String("Classes"); }
|
||||||
Priority priority() const { return Medium; }
|
Priority priority() const { return Medium; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ public:
|
|||||||
CppCurrentDocumentFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
CppCurrentDocumentFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
||||||
~CppCurrentDocumentFilter() {}
|
~CppCurrentDocumentFilter() {}
|
||||||
|
|
||||||
QString trName() const { return tr("Methods in current Document"); }
|
QString displayName() const { return tr("Methods in current Document"); }
|
||||||
QString name() const { return QLatin1String("Methods in current Document"); }
|
QString id() const { return QLatin1String("Methods in current Document"); }
|
||||||
Priority priority() const { return Medium; }
|
Priority priority() const { return Medium; }
|
||||||
QList<Locator::FilterEntry> matchesFor(const QString &entry);
|
QList<Locator::FilterEntry> matchesFor(const QString &entry);
|
||||||
void accept(Locator::FilterEntry selection) const;
|
void accept(Locator::FilterEntry selection) const;
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ void CppFileSettingsWidget::slotEdit()
|
|||||||
QString path = licenseTemplatePath();
|
QString path = licenseTemplatePath();
|
||||||
// Edit existing file with C++
|
// Edit existing file with C++
|
||||||
if (!path.isEmpty()) {
|
if (!path.isEmpty()) {
|
||||||
Core::EditorManager::instance()->openEditor(path, QLatin1String(CppEditor::Constants::CPPEDITOR_KIND));
|
Core::EditorManager::instance()->openEditor(path, QLatin1String(CppEditor::Constants::CPPEDITOR_ID));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Pick a file name and write new template, edit with C++
|
// Pick a file name and write new template, edit with C++
|
||||||
@@ -284,7 +284,7 @@ void CppFileSettingsWidget::slotEdit()
|
|||||||
file.write(tr(licenseTemplateTemplate).toUtf8());
|
file.write(tr(licenseTemplateTemplate).toUtf8());
|
||||||
file.close();
|
file.close();
|
||||||
setLicenseTemplatePath(path);
|
setLicenseTemplatePath(path);
|
||||||
Core::EditorManager::instance()->openEditor(path, QLatin1String(CppEditor::Constants::CPPEDITOR_KIND));
|
Core::EditorManager::instance()->openEditor(path, QLatin1String(CppEditor::Constants::CPPEDITOR_ID));
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------- CppFileSettingsPage
|
// --------------- CppFileSettingsPage
|
||||||
@@ -304,7 +304,7 @@ QString CppFileSettingsPage::id() const
|
|||||||
return QLatin1String(Constants::CPP_SETTINGS_ID);
|
return QLatin1String(Constants::CPP_SETTINGS_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CppFileSettingsPage::trName() const
|
QString CppFileSettingsPage::displayName() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_NAME);
|
return QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_NAME);
|
||||||
}
|
}
|
||||||
@@ -314,7 +314,7 @@ QString CppFileSettingsPage::category() const
|
|||||||
return QLatin1String(Constants::CPP_SETTINGS_CATEGORY);
|
return QLatin1String(Constants::CPP_SETTINGS_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CppFileSettingsPage::trCategory() const
|
QString CppFileSettingsPage::displayCategory() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_TR_CATEGORY);
|
return QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_TR_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,9 +98,9 @@ public:
|
|||||||
virtual ~CppFileSettingsPage();
|
virtual ~CppFileSettingsPage();
|
||||||
|
|
||||||
virtual QString id() const;
|
virtual QString id() const;
|
||||||
virtual QString trName() const;
|
virtual QString displayName() const;
|
||||||
virtual QString category() const;
|
virtual QString category() const;
|
||||||
virtual QString trCategory() const;
|
virtual QString displayCategory() const;
|
||||||
|
|
||||||
virtual QWidget *createPage(QWidget *parent);
|
virtual QWidget *createPage(QWidget *parent);
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public:
|
|||||||
CppFunctionsFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
CppFunctionsFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
||||||
~CppFunctionsFilter();
|
~CppFunctionsFilter();
|
||||||
|
|
||||||
QString trName() const { return tr("Methods"); }
|
QString displayName() const { return tr("Methods"); }
|
||||||
QString name() const { return QLatin1String("Methods"); }
|
QString id() const { return QLatin1String("Methods"); }
|
||||||
Priority priority() const { return Medium; }
|
Priority priority() const { return Medium; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ public:
|
|||||||
CppLocatorFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
CppLocatorFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
||||||
~CppLocatorFilter();
|
~CppLocatorFilter();
|
||||||
|
|
||||||
QString trName() const { return tr("Classes and Methods"); }
|
QString displayName() const { return tr("Classes and Methods"); }
|
||||||
QString name() const { return QLatin1String("Classes and Methods"); }
|
QString id() const { return QLatin1String("Classes and Methods"); }
|
||||||
Priority priority() const { return Medium; }
|
Priority priority() const { return Medium; }
|
||||||
QList<Locator::FilterEntry> matchesFor(const QString &entry);
|
QList<Locator::FilterEntry> matchesFor(const QString &entry);
|
||||||
void accept(Locator::FilterEntry selection) const;
|
void accept(Locator::FilterEntry selection) const;
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
mtools->addMenu(mcpptools);
|
mtools->addMenu(mcpptools);
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
m_context = core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
|
m_context = core->uniqueIDManager()->uniqueIdentifier(CppEditor::Constants::CPPEDITOR_ID);
|
||||||
QList<int> context = QList<int>() << m_context;
|
QList<int> context = QList<int>() << m_context;
|
||||||
|
|
||||||
QAction *switchAction = new QAction(tr("Switch Header/Source"), this);
|
QAction *switchAction = new QAction(tr("Switch Header/Source"), this);
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ QString CheckoutWizard::description() const
|
|||||||
return tr("Checks out a project from a CVS repository.");
|
return tr("Checks out a project from a CVS repository.");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CheckoutWizard::name() const
|
QString CheckoutWizard::displayName() const
|
||||||
{
|
{
|
||||||
return tr("CVS Checkout");
|
return tr("CVS Checkout");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
// IWizard
|
// IWizard
|
||||||
virtual QIcon icon() const;
|
virtual QIcon icon() const;
|
||||||
virtual QString description() const;
|
virtual QString description() const;
|
||||||
virtual QString name() const;
|
virtual QString displayName() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// BaseCheckoutWizard
|
// BaseCheckoutWizard
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ CVSControl::CVSControl(CVSPlugin *plugin) :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CVSControl::name() const
|
QString CVSControl::displayName() const
|
||||||
{
|
{
|
||||||
return QLatin1String("cvs");
|
return QLatin1String("cvs");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class CVSControl : public Core::IVersionControl
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit CVSControl(CVSPlugin *plugin);
|
explicit CVSControl(CVSPlugin *plugin);
|
||||||
virtual QString name() const;
|
virtual QString displayName() const;
|
||||||
|
|
||||||
virtual bool managesDirectory(const QString &directory) const;
|
virtual bool managesDirectory(const QString &directory) const;
|
||||||
virtual QString findTopLevelForDirectory(const QString &directory) const;
|
virtual QString findTopLevelForDirectory(const QString &directory) const;
|
||||||
|
|||||||
@@ -1022,11 +1022,11 @@ Core::IEditor * CVSPlugin::showOutputInEditor(const QString& title, const QStrin
|
|||||||
{
|
{
|
||||||
const VCSBase::VCSBaseEditorParameters *params = findType(editorType);
|
const VCSBase::VCSBaseEditorParameters *params = findType(editorType);
|
||||||
QTC_ASSERT(params, return 0);
|
QTC_ASSERT(params, return 0);
|
||||||
const QString kind = QLatin1String(params->kind);
|
const QString id = params->id;
|
||||||
if (CVS::Constants::debug)
|
if (CVS::Constants::debug)
|
||||||
qDebug() << "CVSPlugin::showOutputInEditor" << title << kind << "source=" << source << "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
|
qDebug() << "CVSPlugin::showOutputInEditor" << title << id << "source=" << source << "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
|
||||||
QString s = title;
|
QString s = title;
|
||||||
Core::IEditor *editor = Core::EditorManager::instance()->openEditorWithContents(kind, &s, output.toLocal8Bit());
|
Core::IEditor *editor = Core::EditorManager::instance()->openEditorWithContents(id, &s, output.toLocal8Bit());
|
||||||
connect(editor, SIGNAL(annotateRevisionRequested(QString,QString,int)),
|
connect(editor, SIGNAL(annotateRevisionRequested(QString,QString,int)),
|
||||||
this, SLOT(annotateVersion(QString,QString,int)));
|
this, SLOT(annotateVersion(QString,QString,int)));
|
||||||
CVSEditor *e = qobject_cast<CVSEditor*>(editor->widget());
|
CVSEditor *e = qobject_cast<CVSEditor*>(editor->widget());
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ QString SettingsPage::id() const
|
|||||||
return QLatin1String(VCSBase::Constants::VCS_ID_CVS);
|
return QLatin1String(VCSBase::Constants::VCS_ID_CVS);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SettingsPage::trName() const
|
QString SettingsPage::displayName() const
|
||||||
{
|
{
|
||||||
return tr("CVS");
|
return tr("CVS");
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,7 @@ QString SettingsPage::category() const
|
|||||||
return QLatin1String(VCSBase::Constants::VCS_SETTINGS_CATEGORY);
|
return QLatin1String(VCSBase::Constants::VCS_SETTINGS_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SettingsPage::trCategory() const
|
QString SettingsPage::displayCategory() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_SETTINGS_TR_CATEGORY);
|
return QCoreApplication::translate("VCSBase", VCSBase::Constants::VCS_SETTINGS_TR_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,9 +70,9 @@ public:
|
|||||||
SettingsPage();
|
SettingsPage();
|
||||||
|
|
||||||
QString id() const;
|
QString id() const;
|
||||||
QString trName() const;
|
QString displayName() const;
|
||||||
QString category() const;
|
QString category() const;
|
||||||
QString trCategory() const;
|
QString displayCategory() const;
|
||||||
|
|
||||||
QWidget *createPage(QWidget *parent);
|
QWidget *createPage(QWidget *parent);
|
||||||
void apply();
|
void apply();
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ QString CdbOptionsPage::settingsId()
|
|||||||
return QLatin1String("F.Cdb");
|
return QLatin1String("F.Cdb");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CdbOptionsPage::trName() const
|
QString CdbOptionsPage::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Cdb");
|
return tr("Cdb");
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ QString CdbOptionsPage::category() const
|
|||||||
return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
|
return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CdbOptionsPage::trCategory() const
|
QString CdbOptionsPage::displayCategory() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY);
|
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ public:
|
|||||||
|
|
||||||
// IOptionsPage
|
// IOptionsPage
|
||||||
virtual QString id() const { return settingsId(); }
|
virtual QString id() const { return settingsId(); }
|
||||||
virtual QString trName() const;
|
virtual QString displayName() const;
|
||||||
virtual QString category() const;
|
virtual QString category() const;
|
||||||
virtual QString trCategory() const;
|
virtual QString displayCategory() const;
|
||||||
|
|
||||||
virtual QWidget *createPage(QWidget *parent);
|
virtual QWidget *createPage(QWidget *parent);
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ void MemoryViewAgent::init(quint64 addr)
|
|||||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||||
QString titlePattern = tr("Memory $");
|
QString titlePattern = tr("Memory $");
|
||||||
m_editor = editorManager->openEditorWithContents(
|
m_editor = editorManager->openEditorWithContents(
|
||||||
Core::Constants::K_DEFAULT_BINARY_EDITOR,
|
Core::Constants::K_DEFAULT_BINARY_EDITOR_ID,
|
||||||
&titlePattern);
|
&titlePattern);
|
||||||
if (m_editor) {
|
if (m_editor) {
|
||||||
connect(m_editor->widget(), SIGNAL(lazyDataRequested(quint64,bool)),
|
connect(m_editor->widget(), SIGNAL(lazyDataRequested(quint64,bool)),
|
||||||
@@ -261,7 +261,7 @@ void DisassemblerViewAgent::setContents(const QString &contents)
|
|||||||
QString titlePattern = "Disassembler";
|
QString titlePattern = "Disassembler";
|
||||||
d->editor = qobject_cast<ITextEditor *>(
|
d->editor = qobject_cast<ITextEditor *>(
|
||||||
editorManager->openEditorWithContents(
|
editorManager->openEditorWithContents(
|
||||||
Core::Constants::K_DEFAULT_TEXT_EDITOR,
|
Core::Constants::K_DEFAULT_TEXT_EDITOR_ID,
|
||||||
&titlePattern));
|
&titlePattern));
|
||||||
QTC_ASSERT(d->editor, return);
|
QTC_ASSERT(d->editor, return);
|
||||||
if ((plainTextEdit = qobject_cast<QPlainTextEdit *>(d->editor->widget())))
|
if ((plainTextEdit = qobject_cast<QPlainTextEdit *>(d->editor->widget())))
|
||||||
|
|||||||
@@ -195,8 +195,8 @@ public:
|
|||||||
DebugMode::DebugMode(QObject *parent)
|
DebugMode::DebugMode(QObject *parent)
|
||||||
: BaseMode(parent)
|
: BaseMode(parent)
|
||||||
{
|
{
|
||||||
setName(tr("Debug"));
|
setDisplayName(tr("Debug"));
|
||||||
setUniqueModeName(Constants::MODE_DEBUG);
|
setId(Constants::MODE_DEBUG);
|
||||||
setIcon(QIcon(":/fancyactionbar/images/mode_Debug.png"));
|
setIcon(QIcon(":/fancyactionbar/images/mode_Debug.png"));
|
||||||
setPriority(Constants::P_MODE_DEBUG);
|
setPriority(Constants::P_MODE_DEBUG);
|
||||||
}
|
}
|
||||||
@@ -320,11 +320,11 @@ public:
|
|||||||
// IOptionsPage
|
// IOptionsPage
|
||||||
QString id() const
|
QString id() const
|
||||||
{ return QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_ID); }
|
{ return QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_ID); }
|
||||||
QString trName() const
|
QString displayName() const
|
||||||
{ return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_COMMON_SETTINGS_NAME); }
|
{ return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_COMMON_SETTINGS_NAME); }
|
||||||
QString category() const
|
QString category() const
|
||||||
{ return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); }
|
{ return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); }
|
||||||
QString trCategory() const
|
QString displayCategory() const
|
||||||
{ return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY); }
|
{ return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY); }
|
||||||
|
|
||||||
QWidget *createPage(QWidget *parent);
|
QWidget *createPage(QWidget *parent);
|
||||||
@@ -421,9 +421,9 @@ public:
|
|||||||
|
|
||||||
// IOptionsPage
|
// IOptionsPage
|
||||||
QString id() const { return QLatin1String("B.DebuggingHelper"); }
|
QString id() const { return QLatin1String("B.DebuggingHelper"); }
|
||||||
QString trName() const { return tr("Debugging Helper"); }
|
QString displayName() const { return tr("Debugging Helper"); }
|
||||||
QString category() const { return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); }
|
QString category() const { return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); }
|
||||||
QString trCategory() const { return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY); }
|
QString displayCategory() const { return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY); }
|
||||||
|
|
||||||
QWidget *createPage(QWidget *parent);
|
QWidget *createPage(QWidget *parent);
|
||||||
void apply() { m_group.apply(settings()); }
|
void apply() { m_group.apply(settings()); }
|
||||||
@@ -678,7 +678,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
|
|||||||
debuggercontext << uidm->uniqueIdentifier(C_GDBDEBUGGER);
|
debuggercontext << uidm->uniqueIdentifier(C_GDBDEBUGGER);
|
||||||
|
|
||||||
QList<int> cppeditorcontext;
|
QList<int> cppeditorcontext;
|
||||||
cppeditorcontext << uidm->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
|
cppeditorcontext << uidm->uniqueIdentifier(CppEditor::Constants::CPPEDITOR_ID);
|
||||||
|
|
||||||
QList<int> texteditorcontext;
|
QList<int> texteditorcontext;
|
||||||
texteditorcontext << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
|
texteditorcontext << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
|
||||||
@@ -1057,7 +1057,7 @@ void DebuggerPlugin::activatePreviousMode()
|
|||||||
void DebuggerPlugin::activateDebugMode()
|
void DebuggerPlugin::activateDebugMode()
|
||||||
{
|
{
|
||||||
ModeManager *modeManager = ModeManager::instance();
|
ModeManager *modeManager = ModeManager::instance();
|
||||||
m_previousMode = QLatin1String(modeManager->currentMode()->uniqueModeName());
|
m_previousMode = modeManager->currentMode()->id();
|
||||||
modeManager->activateMode(QLatin1String(MODE_DEBUG));
|
modeManager->activateMode(QLatin1String(MODE_DEBUG));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ QString GdbOptionsPage::settingsId()
|
|||||||
return QLatin1String("M.Gdb");
|
return QLatin1String("M.Gdb");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GdbOptionsPage::trName() const
|
QString GdbOptionsPage::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Gdb");
|
return tr("Gdb");
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ QString GdbOptionsPage::category() const
|
|||||||
return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
|
return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GdbOptionsPage::trCategory() const
|
QString GdbOptionsPage::displayCategory() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY);
|
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ public:
|
|||||||
GdbOptionsPage();
|
GdbOptionsPage();
|
||||||
|
|
||||||
virtual QString id() const { return settingsId(); }
|
virtual QString id() const { return settingsId(); }
|
||||||
virtual QString trName() const;
|
virtual QString displayName() const;
|
||||||
virtual QString category() const;
|
virtual QString category() const;
|
||||||
virtual QString trCategory() const;
|
virtual QString displayCategory() const;
|
||||||
|
|
||||||
virtual QWidget *createPage(QWidget *parent);
|
virtual QWidget *createPage(QWidget *parent);
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ QString TrkOptionsPage::settingsId()
|
|||||||
return QLatin1String("S.Trk");
|
return QLatin1String("S.Trk");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TrkOptionsPage::trName() const
|
QString TrkOptionsPage::displayName() const
|
||||||
{
|
{
|
||||||
return tr("Symbian TRK");
|
return tr("Symbian TRK");
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ QString TrkOptionsPage::category() const
|
|||||||
return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
|
return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString TrkOptionsPage::trCategory() const
|
QString TrkOptionsPage::displayCategory() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY);
|
return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ public:
|
|||||||
virtual ~TrkOptionsPage();
|
virtual ~TrkOptionsPage();
|
||||||
|
|
||||||
virtual QString id() const { return settingsId(); }
|
virtual QString id() const { return settingsId(); }
|
||||||
virtual QString trName() const;
|
virtual QString displayName() const;
|
||||||
virtual QString category() const;
|
virtual QString category() const;
|
||||||
virtual QString trCategory() const;
|
virtual QString displayCategory() const;
|
||||||
|
|
||||||
virtual QWidget *createPage(QWidget *parent);
|
virtual QWidget *createPage(QWidget *parent);
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ QString CppSettingsPage::id() const
|
|||||||
return QLatin1String(Designer::Constants::SETTINGS_CPP_SETTINGS_ID);
|
return QLatin1String(Designer::Constants::SETTINGS_CPP_SETTINGS_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CppSettingsPage::trName() const
|
QString CppSettingsPage::displayName() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("Designer", Designer::Constants::SETTINGS_CPP_SETTINGS_NAME);
|
return QCoreApplication::translate("Designer", Designer::Constants::SETTINGS_CPP_SETTINGS_NAME);
|
||||||
}
|
}
|
||||||
@@ -118,7 +118,7 @@ QString CppSettingsPage::category() const
|
|||||||
return QLatin1String(Designer::Constants::SETTINGS_CATEGORY);
|
return QLatin1String(Designer::Constants::SETTINGS_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CppSettingsPage::trCategory() const
|
QString CppSettingsPage::displayCategory() const
|
||||||
{
|
{
|
||||||
return QCoreApplication::translate("Designer", Designer::Constants::SETTINGS_TR_CATEGORY);
|
return QCoreApplication::translate("Designer", Designer::Constants::SETTINGS_TR_CATEGORY);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,9 +64,9 @@ public:
|
|||||||
explicit CppSettingsPage(QObject *parent = 0);
|
explicit CppSettingsPage(QObject *parent = 0);
|
||||||
|
|
||||||
virtual QString id() const;
|
virtual QString id() const;
|
||||||
virtual QString trName() const;
|
virtual QString displayName() const;
|
||||||
virtual QString category() const;
|
virtual QString category() const;
|
||||||
virtual QString trCategory() const;
|
virtual QString displayCategory() const;
|
||||||
|
|
||||||
virtual QWidget *createPage(QWidget *parent);
|
virtual QWidget *createPage(QWidget *parent);
|
||||||
virtual void apply();
|
virtual void apply();
|
||||||
|
|||||||
@@ -87,16 +87,16 @@ Core::GeneratedFiles FormClassWizard::generateFiles(const QWizard *w, QString *e
|
|||||||
const QString sourceFileName = buildFileName(params.path(), params.sourceFile(), sourceSuffix());
|
const QString sourceFileName = buildFileName(params.path(), params.sourceFile(), sourceSuffix());
|
||||||
|
|
||||||
Core::GeneratedFile headerFile(headerFileName);
|
Core::GeneratedFile headerFile(headerFileName);
|
||||||
headerFile.setEditorKind(QLatin1String(CppEditor::Constants::CPPEDITOR_KIND));
|
headerFile.setEditorId(QLatin1String(CppEditor::Constants::CPPEDITOR_ID));
|
||||||
|
|
||||||
// Source
|
// Source
|
||||||
Core::GeneratedFile sourceFile(sourceFileName);
|
Core::GeneratedFile sourceFile(sourceFileName);
|
||||||
sourceFile.setEditorKind(QLatin1String(CppEditor::Constants::CPPEDITOR_KIND));
|
sourceFile.setEditorId(QLatin1String(CppEditor::Constants::CPPEDITOR_ID));
|
||||||
|
|
||||||
// UI
|
// UI
|
||||||
Core::GeneratedFile uiFile(formFileName);
|
Core::GeneratedFile uiFile(formFileName);
|
||||||
uiFile.setContents(params.uiTemplate());
|
uiFile.setContents(params.uiTemplate());
|
||||||
uiFile.setEditorKind(QLatin1String(Constants::C_FORMEDITOR));
|
uiFile.setEditorId(QLatin1String(Constants::C_FORMEDITOR_ID));
|
||||||
|
|
||||||
QString source, header;
|
QString source, header;
|
||||||
Designer::FormClassWizardGenerationParameters generationParameters;
|
Designer::FormClassWizardGenerationParameters generationParameters;
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ const char * const SETTINGS_CPP_SETTINGS_ID = "Class Generation";
|
|||||||
const char * const SETTINGS_CPP_SETTINGS_NAME = QT_TRANSLATE_NOOP("Designer", "Class Generation");
|
const char * const SETTINGS_CPP_SETTINGS_NAME = QT_TRANSLATE_NOOP("Designer", "Class Generation");
|
||||||
|
|
||||||
// context
|
// context
|
||||||
const char * const C_FORMEDITOR = "FormEditor";
|
const char * const C_FORMEDITOR_ID = "FormEditor";
|
||||||
|
const char * const C_FORMEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("Designer", "Form Editor");
|
||||||
const char * const T_FORMEDITOR = "FormEditor.Toolbar";
|
const char * const T_FORMEDITOR = "FormEditor.Toolbar";
|
||||||
const char * const M_FORMEDITOR = "FormEditor.Menu";
|
const char * const M_FORMEDITOR = "FormEditor.Menu";
|
||||||
const char * const M_FORMEDITOR_VIEWS = "FormEditor.Menu.Views";
|
const char * const M_FORMEDITOR_VIEWS = "FormEditor.Menu.Views";
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ using namespace Designer::Constants;
|
|||||||
|
|
||||||
FormEditorFactory::FormEditorFactory()
|
FormEditorFactory::FormEditorFactory()
|
||||||
: Core::IEditorFactory(Core::ICore::instance()),
|
: Core::IEditorFactory(Core::ICore::instance()),
|
||||||
m_kind(QLatin1String(C_FORMEDITOR)),
|
|
||||||
m_mimeTypes(QLatin1String(FORM_MIMETYPE))
|
m_mimeTypes(QLatin1String(FORM_MIMETYPE))
|
||||||
{
|
{
|
||||||
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
||||||
@@ -52,14 +51,19 @@ FormEditorFactory::FormEditorFactory()
|
|||||||
QLatin1String("ui"));
|
QLatin1String("ui"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString FormEditorFactory::kind() const
|
QString FormEditorFactory::id() const
|
||||||
{
|
{
|
||||||
return C_FORMEDITOR;
|
return QLatin1String(C_FORMEDITOR_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString FormEditorFactory::displayName() const
|
||||||
|
{
|
||||||
|
return tr(C_FORMEDITOR_DISPLAY_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::IFile *FormEditorFactory::open(const QString &fileName)
|
Core::IFile *FormEditorFactory::open(const QString &fileName)
|
||||||
{
|
{
|
||||||
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, kind());
|
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, id());
|
||||||
return iface ? iface->file() : 0;
|
return iface ? iface->file() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ public:
|
|||||||
virtual QStringList mimeTypes() const;
|
virtual QStringList mimeTypes() const;
|
||||||
|
|
||||||
// IEditorFactory
|
// IEditorFactory
|
||||||
virtual QString kind() const;
|
virtual QString id() const;
|
||||||
|
virtual QString displayName() const;
|
||||||
Core::IFile *open(const QString &fileName);
|
Core::IFile *open(const QString &fileName);
|
||||||
Core::IEditor *createEditor(QWidget *parent);
|
Core::IEditor *createEditor(QWidget *parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QString m_kind;
|
|
||||||
const QStringList m_mimeTypes;
|
const QStringList m_mimeTypes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
|
|
||||||
initializeTemplates();
|
initializeTemplates();
|
||||||
|
|
||||||
const int uid = core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR));
|
const int uid = core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR_ID));
|
||||||
const QList<int> context = QList<int>() << uid;
|
const QList<int> context = QList<int>() << uid;
|
||||||
|
|
||||||
addAutoReleasedObject(new FormEditorFactory);
|
addAutoReleasedObject(new FormEditorFactory);
|
||||||
@@ -135,16 +135,16 @@ void FormEditorPlugin::initializeTemplates()
|
|||||||
{
|
{
|
||||||
FormWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
|
FormWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
|
||||||
wizardParameters.setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
wizardParameters.setCategory(QLatin1String(Core::Constants::WIZARD_CATEGORY_QT));
|
||||||
wizardParameters.setTrCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
wizardParameters.setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::WIZARD_TR_CATEGORY_QT));
|
||||||
const QString formFileType = QLatin1String(Constants::FORM_FILE_TYPE);
|
const QString formFileType = QLatin1String(Constants::FORM_FILE_TYPE);
|
||||||
wizardParameters.setName(tr("Qt Designer Form"));
|
wizardParameters.setDisplayName(tr("Qt Designer Form"));
|
||||||
wizardParameters.setId(QLatin1String("D.Form"));
|
wizardParameters.setId(QLatin1String("D.Form"));
|
||||||
wizardParameters.setDescription(tr("Creates a Qt Designer form file (.ui)."));
|
wizardParameters.setDescription(tr("Creates a Qt Designer form file (.ui)."));
|
||||||
addAutoReleasedObject(new FormWizard(wizardParameters, this));
|
addAutoReleasedObject(new FormWizard(wizardParameters, this));
|
||||||
|
|
||||||
#ifdef CPP_ENABLED
|
#ifdef CPP_ENABLED
|
||||||
wizardParameters.setKind(Core::IWizard::ClassWizard);
|
wizardParameters.setKind(Core::IWizard::ClassWizard);
|
||||||
wizardParameters.setName(tr("Qt Designer Form Class"));
|
wizardParameters.setDisplayName(tr("Qt Designer Form Class"));
|
||||||
wizardParameters.setId(QLatin1String("C.FormClass"));
|
wizardParameters.setId(QLatin1String("C.FormClass"));
|
||||||
wizardParameters.setDescription(tr("Creates a Qt Designer form file (.ui) with a matching class."));
|
wizardParameters.setDescription(tr("Creates a Qt Designer form file (.ui) with a matching class."));
|
||||||
addAutoReleasedObject(new FormClassWizard(wizardParameters, this));
|
addAutoReleasedObject(new FormClassWizard(wizardParameters, this));
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user