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()));
|
||||
}
|
||||
|
||||
QString FileWizardDialog::name() const
|
||||
QString FileWizardDialog::fileName() const
|
||||
{
|
||||
return m_filePage->name();
|
||||
return m_filePage->fileName();
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
@@ -49,12 +49,12 @@ class QTCREATOR_UTILS_EXPORT FileWizardDialog : public QWizard {
|
||||
public:
|
||||
explicit FileWizardDialog(QWidget *parent = 0);
|
||||
|
||||
QString name() const;
|
||||
QString fileName() const;
|
||||
QString path() const;
|
||||
|
||||
public slots:
|
||||
void setPath(const QString &path);
|
||||
void setName(const QString &name);
|
||||
void setFileName(const QString &name);
|
||||
|
||||
private:
|
||||
FileWizardPage *m_filePage;
|
||||
|
||||
@@ -61,7 +61,7 @@ FileWizardPage::~FileWizardPage()
|
||||
delete m_d;
|
||||
}
|
||||
|
||||
QString FileWizardPage::name() const
|
||||
QString FileWizardPage::fileName() const
|
||||
{
|
||||
return m_d->m_ui.nameLineEdit->text();
|
||||
}
|
||||
@@ -76,7 +76,7 @@ void FileWizardPage::setPath(const QString &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);
|
||||
}
|
||||
@@ -98,7 +98,7 @@ bool FileWizardPage::isComplete() const
|
||||
return m_d->m_complete;
|
||||
}
|
||||
|
||||
void FileWizardPage::setNameLabel(const QString &label)
|
||||
void FileWizardPage::setFileNameLabel(const QString &label)
|
||||
{
|
||||
m_d->m_ui.nameLabel->setText(label);
|
||||
}
|
||||
|
||||
@@ -50,17 +50,17 @@ class QTCREATOR_UTILS_EXPORT FileWizardPage : public QWizardPage
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(FileWizardPage)
|
||||
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:
|
||||
explicit FileWizardPage(QWidget *parent = 0);
|
||||
virtual ~FileWizardPage();
|
||||
|
||||
QString name() const;
|
||||
QString fileName() const;
|
||||
QString path() const;
|
||||
|
||||
virtual bool isComplete() const;
|
||||
|
||||
void setNameLabel(const QString &label);
|
||||
void setFileNameLabel(const QString &label);
|
||||
void setPathLabel(const QString &label);
|
||||
|
||||
// Validate a base name entry field (potentially containing extension)
|
||||
@@ -72,7 +72,7 @@ signals:
|
||||
|
||||
public slots:
|
||||
void setPath(const QString &path);
|
||||
void setName(const QString &name);
|
||||
void setFileName(const QString &name);
|
||||
|
||||
private slots:
|
||||
void slotValidChanged();
|
||||
|
||||
@@ -80,7 +80,7 @@ ProjectIntroPage::~ProjectIntroPage()
|
||||
delete m_d;
|
||||
}
|
||||
|
||||
QString ProjectIntroPage::name() const
|
||||
QString ProjectIntroPage::projectName() const
|
||||
{
|
||||
return m_d->m_ui.nameLineEdit->text();
|
||||
}
|
||||
@@ -95,7 +95,7 @@ void ProjectIntroPage::setPath(const QString &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->selectAll();
|
||||
|
||||
@@ -57,13 +57,13 @@ class QTCREATOR_UTILS_EXPORT ProjectIntroPage : public QWizardPage
|
||||
Q_DISABLE_COPY(ProjectIntroPage)
|
||||
Q_PROPERTY(QString description READ description 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)
|
||||
public:
|
||||
explicit ProjectIntroPage(QWidget *parent = 0);
|
||||
virtual ~ProjectIntroPage();
|
||||
|
||||
QString name() const;
|
||||
QString projectName() const;
|
||||
QString path() const;
|
||||
QString description() const;
|
||||
bool useAsDefaultPath() const;
|
||||
@@ -81,7 +81,7 @@ signals:
|
||||
|
||||
public slots:
|
||||
void setPath(const QString &path);
|
||||
void setName(const QString &name);
|
||||
void setProjectName(const QString &name);
|
||||
void setDescription(const QString &description);
|
||||
void setUseAsDefaultPath(bool u);
|
||||
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
namespace BINEditor {
|
||||
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";
|
||||
|
||||
} // namespace Constants
|
||||
|
||||
@@ -303,8 +303,8 @@ public:
|
||||
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
|
||||
m_editor = parent;
|
||||
m_file = new BinEditorFile(parent);
|
||||
m_context << uidm->uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR);
|
||||
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR);
|
||||
m_context << uidm->uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
|
||||
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR_ID);
|
||||
m_cursorPositionLabel = new Utils::LineColumnLabel;
|
||||
|
||||
QHBoxLayout *l = new QHBoxLayout;
|
||||
@@ -336,7 +336,7 @@ public:
|
||||
return m_file->open(fileName);
|
||||
}
|
||||
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; }
|
||||
void setDisplayName(const QString &title) { m_displayName = title; emit changed(); }
|
||||
|
||||
@@ -371,21 +371,25 @@ private:
|
||||
///////////////////////////////// BinEditorFactory //////////////////////////////////
|
||||
|
||||
BinEditorFactory::BinEditorFactory(BinEditorPlugin *owner) :
|
||||
m_kind(QLatin1String(Core::Constants::K_DEFAULT_BINARY_EDITOR)),
|
||||
m_mimeTypes(QLatin1String(BINEditor::Constants::C_BINEDITOR_MIMETYPE)),
|
||||
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::EditorManager *em = Core::EditorManager::instance();
|
||||
Core::IEditor *iface = em->openEditor(fileName, kind());
|
||||
Core::IEditor *iface = em->openEditor(fileName, id());
|
||||
return iface ? iface->file() : 0;
|
||||
}
|
||||
|
||||
@@ -439,7 +443,7 @@ void BinEditorPlugin::initializeEditor(BinEditor *editor)
|
||||
editor->setEditorInterface(editorInterface);
|
||||
|
||||
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
|
||||
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR);
|
||||
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR_ID);
|
||||
if (!m_undoAction) {
|
||||
m_undoAction = registerNewAction(QLatin1String(Core::Constants::UNDO),
|
||||
this, SLOT(undoAction()),
|
||||
|
||||
@@ -95,11 +95,11 @@ public:
|
||||
virtual QStringList mimeTypes() const;
|
||||
|
||||
Core::IEditor *createEditor(QWidget *parent);
|
||||
QString kind() const;
|
||||
QString id() const;
|
||||
QString displayName() const;
|
||||
Core::IFile *open(const QString &fileName);
|
||||
|
||||
private:
|
||||
const QString m_kind;
|
||||
const QStringList m_mimeTypes;
|
||||
BinEditorPlugin *m_owner;
|
||||
};
|
||||
|
||||
@@ -28,8 +28,14 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "cmakebuildconfiguration.h"
|
||||
|
||||
#include "cmakeopenprojectwizard.h"
|
||||
#include "cmakeproject.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtGui/QInputDialog>
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace Internal;
|
||||
@@ -202,3 +208,84 @@ void CMakeBuildConfiguration::setMsvcVersion(const QString &msvcVersion)
|
||||
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;
|
||||
};
|
||||
|
||||
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 CMakeProjectManager
|
||||
|
||||
@@ -66,87 +66,6 @@ using ProjectExplorer::EnvironmentItem;
|
||||
// Open Questions
|
||||
// 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
|
||||
*/
|
||||
@@ -504,7 +423,7 @@ ProjectExplorer::FolderNode *CMakeProject::findOrCreateFolder(CMakeProjectNode *
|
||||
return parent;
|
||||
}
|
||||
|
||||
QString CMakeProject::name() const
|
||||
QString CMakeProject::displayName() const
|
||||
{
|
||||
return m_projectName;
|
||||
}
|
||||
|
||||
@@ -63,25 +63,6 @@ struct CMakeTarget
|
||||
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
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -93,7 +74,7 @@ public:
|
||||
|
||||
CMakeBuildConfiguration *activeCMakeBuildConfiguration() const;
|
||||
|
||||
virtual QString name() const;
|
||||
virtual QString displayName() const;
|
||||
virtual Core::IFile *file() const;
|
||||
virtual ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
|
||||
virtual CMakeManager *projectManager() const;
|
||||
|
||||
@@ -244,7 +244,7 @@ QString CMakeSettingsPage::id() const
|
||||
return QLatin1String("CMake");
|
||||
}
|
||||
|
||||
QString CMakeSettingsPage::trName() const
|
||||
QString CMakeSettingsPage::displayName() const
|
||||
{
|
||||
return tr("CMake");
|
||||
}
|
||||
@@ -254,7 +254,7 @@ QString CMakeSettingsPage::category() const
|
||||
return QLatin1String("M.CMake");
|
||||
}
|
||||
|
||||
QString CMakeSettingsPage::trCategory() const
|
||||
QString CMakeSettingsPage::displayCategory() const
|
||||
{
|
||||
return tr("CMake");
|
||||
}
|
||||
|
||||
@@ -88,9 +88,9 @@ public:
|
||||
CMakeSettingsPage();
|
||||
virtual ~CMakeSettingsPage();
|
||||
virtual QString id() const;
|
||||
virtual QString trName() const;
|
||||
virtual QString displayName() const;
|
||||
virtual QString category() const;
|
||||
virtual QString trCategory() const;
|
||||
virtual QString displayCategory() const;
|
||||
|
||||
virtual QWidget *createPage(QWidget *parent);
|
||||
virtual void apply();
|
||||
|
||||
@@ -54,7 +54,7 @@ CMakeRunConfiguration::CMakeRunConfiguration(CMakeProject *pro, const QString &t
|
||||
, m_title(title)
|
||||
, m_baseEnvironmentBase(CMakeRunConfiguration::BuildEnvironmentBase)
|
||||
{
|
||||
setName(title);
|
||||
setDisplayName(title);
|
||||
|
||||
connect(pro, SIGNAL(environmentChanged()),
|
||||
this, SIGNAL(baseEnvironmentChanged()));
|
||||
@@ -70,7 +70,7 @@ CMakeProject *CMakeRunConfiguration::cmakeProject() const
|
||||
return static_cast<CMakeProject *>(project());
|
||||
}
|
||||
|
||||
QString CMakeRunConfiguration::type() const
|
||||
QString CMakeRunConfiguration::id() const
|
||||
{
|
||||
return Constants::CMAKERUNCONFIGURATION;
|
||||
}
|
||||
@@ -417,15 +417,15 @@ CMakeRunConfigurationFactory::~CMakeRunConfigurationFactory()
|
||||
}
|
||||
|
||||
// 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 false;
|
||||
}
|
||||
|
||||
// used to show the list of possible additons to a project, returns a list of types
|
||||
QStringList CMakeRunConfigurationFactory::availableCreationTypes(ProjectExplorer::Project *project) const
|
||||
// used to show the list of possible additons to a project, returns a list of ids
|
||||
QStringList CMakeRunConfigurationFactory::availableCreationIds(ProjectExplorer::Project *project) const
|
||||
{
|
||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||
if (!pro)
|
||||
@@ -437,28 +437,28 @@ QStringList CMakeRunConfigurationFactory::availableCreationTypes(ProjectExplorer
|
||||
return allTargets;
|
||||
}
|
||||
|
||||
// used to translate the types to names to display to the user
|
||||
QString CMakeRunConfigurationFactory::displayNameForType(const QString &type) const
|
||||
// used to translate the ids to names to display to the user
|
||||
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
|
||||
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);
|
||||
Q_ASSERT(pro);
|
||||
if (type == Constants::CMAKERUNCONFIGURATION) {
|
||||
if (id == Constants::CMAKERUNCONFIGURATION) {
|
||||
// Restoring, filename will be added by restoreSettings
|
||||
ProjectExplorer::RunConfiguration* rc = new CMakeRunConfiguration(pro, QString::null, QString::null, QString::null);
|
||||
return rc;
|
||||
} else {
|
||||
// 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);
|
||||
ProjectExplorer::RunConfiguration * rc = new CMakeRunConfiguration(pro, ct.executable, ct.workingDirectory, ct.title);
|
||||
return rc;
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
virtual ~CMakeRunConfiguration();
|
||||
CMakeProject *cmakeProject() const;
|
||||
|
||||
virtual QString type() const;
|
||||
virtual QString id() const;
|
||||
virtual QString executable() const;
|
||||
virtual RunMode runMode() const;
|
||||
virtual QString workingDirectory() const;
|
||||
@@ -137,12 +137,12 @@ public:
|
||||
CMakeRunConfigurationFactory();
|
||||
virtual ~CMakeRunConfigurationFactory();
|
||||
// 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
|
||||
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
|
||||
virtual QString displayNameForType(const QString &type) const;
|
||||
virtual ProjectExplorer::RunConfiguration* create(ProjectExplorer::Project *project, const QString &type);
|
||||
virtual QString displayNameForId(const QString &id) const;
|
||||
virtual ProjectExplorer::RunConfiguration* create(ProjectExplorer::Project *project, const QString &id);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ void MakeStep::run(QFutureInterface<bool> &fi)
|
||||
m_futureInterface = 0;
|
||||
}
|
||||
|
||||
QString MakeStep::name()
|
||||
QString MakeStep::id()
|
||||
{
|
||||
return Constants::MAKESTEP;
|
||||
}
|
||||
@@ -298,14 +298,14 @@ QString MakeStepConfigWidget::summaryText() const
|
||||
// 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);
|
||||
}
|
||||
|
||||
@@ -314,13 +314,15 @@ BuildStep *MakeStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) const
|
||||
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();
|
||||
}
|
||||
|
||||
QString MakeStepFactory::displayNameForName(const QString & /* name */) const
|
||||
QString MakeStepFactory::displayNameForId(const QString &id) const
|
||||
{
|
||||
Q_UNUSED(id);
|
||||
return "Make";
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
|
||||
virtual void run(QFutureInterface<bool> &fi);
|
||||
|
||||
virtual QString name();
|
||||
virtual QString id();
|
||||
virtual QString displayName();
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
@@ -108,11 +108,11 @@ private:
|
||||
|
||||
class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
{
|
||||
virtual bool canCreate(const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc, const QString &name) const;
|
||||
virtual bool canCreate(const QString &id) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc, const QString &id) const;
|
||||
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs, 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
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
explicit GeneratedFilePrivate(const QString &p);
|
||||
QString path;
|
||||
QByteArray contents;
|
||||
QString editorKind;
|
||||
QString editorId;
|
||||
bool binary;
|
||||
};
|
||||
|
||||
@@ -139,14 +139,14 @@ void GeneratedFile::setBinary(bool 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
|
||||
@@ -189,10 +189,10 @@ public:
|
||||
IWizard::Kind kind;
|
||||
QIcon icon;
|
||||
QString description;
|
||||
QString name;
|
||||
QString displayName;
|
||||
QString id;
|
||||
QString category;
|
||||
QString trCategory;
|
||||
QString displayCategory;
|
||||
};
|
||||
|
||||
BaseFileWizardParameterData::BaseFileWizardParameterData(IWizard::Kind k) :
|
||||
@@ -251,14 +251,14 @@ void BaseFileWizardParameters::setDescription(const QString &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
|
||||
@@ -281,14 +281,14 @@ void BaseFileWizardParameters::setCategory(const QString &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.
|
||||
@@ -416,9 +416,9 @@ QString BaseFileWizard::description() const
|
||||
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
|
||||
@@ -431,9 +431,9 @@ QString BaseFileWizard::category() const
|
||||
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)
|
||||
@@ -553,7 +553,7 @@ bool BaseFileWizard::postGenerateFiles(const GeneratedFiles &l, QString *errorMe
|
||||
const Core::GeneratedFiles::const_iterator cend = l.constEnd();
|
||||
Core::EditorManager *em = Core::EditorManager::instance();
|
||||
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());
|
||||
return false;
|
||||
}
|
||||
@@ -665,7 +665,7 @@ QWizard *StandardFileWizard::createWizardDialog(QWidget *parent,
|
||||
const WizardPageList &extensionPages) const
|
||||
{
|
||||
Utils::FileWizardDialog *standardWizardDialog = new Utils::FileWizardDialog(parent);
|
||||
standardWizardDialog->setWindowTitle(tr("New %1").arg(name()));
|
||||
standardWizardDialog->setWindowTitle(tr("New %1").arg(displayName()));
|
||||
setupWizard(standardWizardDialog);
|
||||
standardWizardDialog->setPath(defaultPath);
|
||||
foreach (QWizardPage *p, extensionPages)
|
||||
@@ -678,7 +678,7 @@ GeneratedFiles StandardFileWizard::generateFiles(const QWizard *w,
|
||||
{
|
||||
const Utils::FileWizardDialog *standardWizardDialog = qobject_cast<const Utils::FileWizardDialog *>(w);
|
||||
return generateFilesFromPath(standardWizardDialog->path(),
|
||||
standardWizardDialog->name(),
|
||||
standardWizardDialog->fileName(),
|
||||
errorMessage);
|
||||
}
|
||||
|
||||
|
||||
@@ -82,9 +82,9 @@ public:
|
||||
bool isBinary() const;
|
||||
void setBinary(bool b);
|
||||
|
||||
// Kind of editor to open the file with
|
||||
QString editorKind() const;
|
||||
void setEditorKind(const QString &k);
|
||||
// Id of editor to open the file with
|
||||
QString editorId() const;
|
||||
void setEditorId(const QString &k);
|
||||
|
||||
bool write(QString *errorMessage) const;
|
||||
|
||||
@@ -114,8 +114,8 @@ public:
|
||||
QString description() const;
|
||||
void setDescription(const QString &description);
|
||||
|
||||
QString name() const;
|
||||
void setName(const QString &name);
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &name);
|
||||
|
||||
QString id() const;
|
||||
void setId(const QString &id);
|
||||
@@ -123,8 +123,8 @@ public:
|
||||
QString category() const;
|
||||
void setCategory(const QString &category);
|
||||
|
||||
QString trCategory() const;
|
||||
void setTrCategory(const QString &trCategory);
|
||||
QString displayCategory() const;
|
||||
void setDisplayCategory(const QString &trCategory);
|
||||
|
||||
private:
|
||||
QSharedDataPointer<BaseFileWizardParameterData> m_d;
|
||||
@@ -154,11 +154,11 @@ public:
|
||||
virtual Kind kind() const;
|
||||
virtual QIcon icon() const;
|
||||
virtual QString description() const;
|
||||
virtual QString name() const;
|
||||
virtual QString displayName() const;
|
||||
virtual QString id() const;
|
||||
|
||||
virtual QString category() const;
|
||||
virtual QString trCategory() const;
|
||||
virtual QString displayCategory() const;
|
||||
|
||||
virtual QStringList runWizard(const QString &path, QWidget *parent);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ using namespace Core;
|
||||
{
|
||||
[...]
|
||||
addObject(new Core::BaseMode("mymode",
|
||||
"MyPlugin.UniqueModeName",
|
||||
"MyPlugin.Id",
|
||||
icon,
|
||||
50, // priority
|
||||
new MyWidget));
|
||||
@@ -65,7 +65,7 @@ using namespace Core;
|
||||
/*!
|
||||
\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.
|
||||
|
||||
\a parent
|
||||
|
||||
@@ -49,26 +49,26 @@ public:
|
||||
~BaseMode();
|
||||
|
||||
// IMode
|
||||
QString name() const { return m_name; }
|
||||
QString displayName() const { return m_displayName; }
|
||||
QIcon icon() const { return m_icon; }
|
||||
int priority() const { return m_priority; }
|
||||
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; }
|
||||
|
||||
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 setPriority(int priority) { m_priority = priority; }
|
||||
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; }
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
QString m_displayName;
|
||||
QIcon m_icon;
|
||||
int m_priority;
|
||||
QWidget *m_widget;
|
||||
const char * m_uniqueModeName;
|
||||
QString m_id;
|
||||
QList<int> m_context;
|
||||
};
|
||||
|
||||
|
||||
@@ -92,8 +92,9 @@ const char * const C_NAVIGATION_PANE = "Core.NavigationPane";
|
||||
const char * const C_PROBLEM_PANE = "Core.ProblemPane";
|
||||
|
||||
//default editor kind
|
||||
const char * const K_DEFAULT_TEXT_EDITOR = 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_DISPLAY_NAME = QT_TRANSLATE_NOOP("OpenWith::Editors", "Plain Text Editor");
|
||||
const char * const K_DEFAULT_TEXT_EDITOR_ID = "Core.PlainTextEditor";
|
||||
const char * const K_DEFAULT_BINARY_EDITOR_ID = "Core.BinaryEditor";
|
||||
|
||||
//actions
|
||||
const char * const UNDO = "QtCreator.Undo";
|
||||
|
||||
@@ -37,9 +37,9 @@
|
||||
Guidelines for implementing:
|
||||
\list
|
||||
\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 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
|
||||
made and store those.
|
||||
\o matches() is used for the options dialog search filter.
|
||||
|
||||
@@ -48,9 +48,9 @@ public:
|
||||
virtual ~IOptionsPage() {}
|
||||
|
||||
virtual QString id() const = 0;
|
||||
virtual QString trName() const = 0;
|
||||
virtual QString displayName() 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 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
|
||||
in the dialog.
|
||||
*/
|
||||
|
||||
@@ -56,11 +56,11 @@ public:
|
||||
virtual Kind kind() const = 0;
|
||||
virtual QIcon icon() const = 0;
|
||||
virtual QString description() const = 0;
|
||||
virtual QString name() const = 0;
|
||||
virtual QString displayName() const = 0;
|
||||
virtual QString id() 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;
|
||||
|
||||
|
||||
@@ -96,13 +96,13 @@ void NewDialog::setWizards(QList<IWizard*> wizards)
|
||||
if (cit == categories.end()) {
|
||||
QTreeWidgetItem *categoryItem = new QTreeWidgetItem(m_ui->templatesTree);
|
||||
categoryItem->setFlags(Qt::ItemIsEnabled);
|
||||
categoryItem->setText(0, wizard->trCategory());
|
||||
categoryItem->setText(0, wizard->displayCategory());
|
||||
qVariantSetValue<IWizard*>(wizardPtr, 0);
|
||||
categoryItem->setData(0, Qt::UserRole, wizardPtr);
|
||||
cit = categories.insert(categoryName, categoryItem);
|
||||
}
|
||||
// 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());
|
||||
qVariantSetValue<IWizard*>(wizardPtr, wizard);
|
||||
wizardItem->setData(0, Qt::UserRole, wizardPtr);
|
||||
|
||||
@@ -132,7 +132,7 @@ bool PageFilterModel::filterAcceptsRow(int source_row, const QModelIndex &source
|
||||
return true;
|
||||
if (const IOptionsPage *page = pageOfItem(sourceModel(), source_parent.child(source_row, 0))) {
|
||||
const QString pattern = filterRegExp().pattern();
|
||||
return page->trCategory().contains(pattern, Qt::CaseInsensitive) ||
|
||||
return page->displayCategory().contains(pattern, Qt::CaseInsensitive) ||
|
||||
page->matches(pattern);
|
||||
}
|
||||
return false;
|
||||
@@ -151,9 +151,9 @@ static QStandardItemModel *pageModel(const QList<IOptionsPage*> &pages,
|
||||
QMap<QString, QStandardItem *> categories;
|
||||
foreach (IOptionsPage *page, pages) {
|
||||
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();
|
||||
if (categoryDepth != trCategories.size()) {
|
||||
if (categoryDepth != displayCategories.size()) {
|
||||
qWarning("Internal error: Hierarchy mismatch in settings page %s.", qPrintable(page->id()));
|
||||
continue;
|
||||
}
|
||||
@@ -162,7 +162,7 @@ static QStandardItemModel *pageModel(const QList<IOptionsPage*> &pages,
|
||||
QString currentCategory = categoriesId.at(0);
|
||||
QStandardItem *treeItem = categories.value(currentCategory, 0);
|
||||
if (!treeItem) {
|
||||
treeItem = createStandardItem(model, trCategories.at(0), CategoryItem);
|
||||
treeItem = createStandardItem(model, displayCategories.at(0), CategoryItem);
|
||||
categories.insert(currentCategory, treeItem);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ static QStandardItemModel *pageModel(const QList<IOptionsPage*> &pages,
|
||||
if (!treeItem) {
|
||||
QStandardItem *parentItem = categories.value(currentCategory);
|
||||
QTC_ASSERT(parentItem, return model)
|
||||
treeItem = createStandardItem(parentItem, trCategories.at(cat), CategoryItem);
|
||||
treeItem = createStandardItem(parentItem, displayCategories.at(cat), CategoryItem);
|
||||
categories.insert(fullCategory, treeItem);
|
||||
}
|
||||
currentCategory = fullCategory;
|
||||
@@ -180,7 +180,7 @@ static QStandardItemModel *pageModel(const QList<IOptionsPage*> &pages,
|
||||
|
||||
// Append page item
|
||||
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) {
|
||||
*initialIndex = model->indexFromItem(item);
|
||||
}
|
||||
@@ -339,7 +339,7 @@ void SettingsDialog::showPage(const QStandardItem *item)
|
||||
m_currentPage = page->id();
|
||||
m_stackedLayout->setCurrentIndex(indexOfItem(item));
|
||||
m_visitedPages.insert(page);
|
||||
m_headerLabel->setText(page->trName());
|
||||
m_headerLabel->setText(page->displayName());
|
||||
}
|
||||
break;
|
||||
case CategoryItem:
|
||||
|
||||
@@ -69,7 +69,7 @@ QString ShortcutSettings::id() const
|
||||
return QLatin1String("D.Keyboard");
|
||||
}
|
||||
|
||||
QString ShortcutSettings::trName() const
|
||||
QString ShortcutSettings::displayName() const
|
||||
{
|
||||
return tr("Keyboard");
|
||||
}
|
||||
@@ -79,7 +79,7 @@ QString ShortcutSettings::category() const
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -68,9 +68,9 @@ public:
|
||||
|
||||
// IOptionsPage
|
||||
QString id() const;
|
||||
QString trName() const;
|
||||
QString displayName() const;
|
||||
QString category() const;
|
||||
QString trCategory() const;
|
||||
QString displayCategory() const;
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
|
||||
@@ -90,7 +90,7 @@ EditMode::~EditMode()
|
||||
delete m_splitter;
|
||||
}
|
||||
|
||||
QString EditMode::name() const
|
||||
QString EditMode::displayName() const
|
||||
{
|
||||
return tr("Edit");
|
||||
}
|
||||
@@ -110,9 +110,9 @@ QWidget* EditMode::widget()
|
||||
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
|
||||
|
||||
@@ -55,11 +55,11 @@ public:
|
||||
~EditMode();
|
||||
|
||||
// IMode
|
||||
QString name() const;
|
||||
QString displayName() const;
|
||||
QIcon icon() const;
|
||||
int priority() const;
|
||||
QWidget* widget();
|
||||
const char* uniqueModeName() const;
|
||||
QString id() const;
|
||||
QList<int> context() const;
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -841,8 +841,8 @@ Core::IEditor *EditorManager::activateEditor(const QModelIndex &index, Internal:
|
||||
}
|
||||
|
||||
QString fileName = index.data(Qt::UserRole + 1).toString();
|
||||
QByteArray kind = index.data(Qt::UserRole + 2).toByteArray();
|
||||
return openEditor(view, fileName, kind, flags);
|
||||
QString id = index.data(Qt::UserRole + 2).toString();
|
||||
return openEditor(view, fileName, id, flags);
|
||||
}
|
||||
|
||||
Core::IEditor *EditorManager::placeEditor(Core::Internal::EditorView *view, Core::IEditor *editor)
|
||||
@@ -970,45 +970,44 @@ EditorManager::ExternalEditorList
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* For something that has a 'QString kind' (IEditorFactory
|
||||
* or IExternalEditor), find the one matching a kind. */
|
||||
/* For something that has a 'QString id' (IEditorFactory
|
||||
* or IExternalEditor), find the one matching a id. */
|
||||
template <class EditorFactoryLike>
|
||||
inline EditorFactoryLike *findByKind(ExtensionSystem::PluginManager *pm,
|
||||
const QString &kind)
|
||||
inline EditorFactoryLike *findById(ExtensionSystem::PluginManager *pm,
|
||||
const QString &id)
|
||||
{
|
||||
const QList<EditorFactoryLike *> factories = pm->template getObjects<EditorFactoryLike>();
|
||||
foreach(EditorFactoryLike *efl, factories)
|
||||
if (kind == efl->kind())
|
||||
if (id == efl->id())
|
||||
return efl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
IEditor *EditorManager::createEditor(const QString &editorKind,
|
||||
IEditor *EditorManager::createEditor(const QString &editorId,
|
||||
const QString &fileName)
|
||||
{
|
||||
typedef QList<IEditorFactory*> FactoryList;
|
||||
if (debugEditorManager)
|
||||
qDebug() << Q_FUNC_INFO << editorKind << fileName;
|
||||
|
||||
qDebug() << Q_FUNC_INFO << editorId << fileName;
|
||||
|
||||
EditorFactoryList factories;
|
||||
if (editorKind.isEmpty()) {
|
||||
if (editorId.isEmpty()) {
|
||||
// Find by mime type
|
||||
MimeType mimeType = m_d->m_core->mimeDatabase()->findByFile(QFileInfo(fileName));
|
||||
if (!mimeType) {
|
||||
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"));
|
||||
}
|
||||
factories = editorFactories(mimeType, true);
|
||||
} else {
|
||||
// Find by editor kind
|
||||
if (IEditorFactory *factory = findByKind<IEditorFactory>(pluginManager(), editorKind))
|
||||
// Find by editor id
|
||||
if (IEditorFactory *factory = findById<IEditorFactory>(pluginManager(), editorId))
|
||||
factories.push_back(factory);
|
||||
}
|
||||
if (factories.empty()) {
|
||||
qWarning("%s: unable to find an editor factory for the file '%s', editor kind '%s'.",
|
||||
Q_FUNC_INFO, fileName.toUtf8().constData(), editorKind.toUtf8().constData());
|
||||
qWarning("%s: unable to find an editor factory for the file '%s', editor Id '%s'.",
|
||||
Q_FUNC_INFO, fileName.toUtf8().constData(), editorId.toUtf8().constData());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1036,42 +1035,42 @@ void EditorManager::addEditor(IEditor *editor, bool isDuplicate)
|
||||
emit editorOpened(editor);
|
||||
}
|
||||
|
||||
// Run the OpenWithDialog and return the editor kind
|
||||
// Run the OpenWithDialog and return the editor id
|
||||
// selected by the user.
|
||||
QString EditorManager::getOpenWithEditorKind(const QString &fileName,
|
||||
QString EditorManager::getOpenWithEditorId(const QString &fileName,
|
||||
bool *isExternalEditor) const
|
||||
{
|
||||
// Collect editors that can open the file
|
||||
const MimeType mt = m_d->m_core->mimeDatabase()->findByFile(fileName);
|
||||
if (!mt)
|
||||
return QString();
|
||||
QStringList allEditorKinds;
|
||||
QStringList externalEditorKinds;
|
||||
QStringList allEditorIds;
|
||||
QStringList externalEditorIds;
|
||||
// Built-in
|
||||
const EditorFactoryList editors = editorFactories(mt, false);
|
||||
const int size = editors.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
allEditorKinds.push_back(editors.at(i)->kind());
|
||||
allEditorIds.push_back(editors.at(i)->id());
|
||||
}
|
||||
// External editors
|
||||
const ExternalEditorList exEditors = externalEditors(mt, false);
|
||||
const int esize = exEditors.size();
|
||||
for (int i = 0; i < esize; i++) {
|
||||
externalEditorKinds.push_back(exEditors.at(i)->kind());
|
||||
allEditorKinds.push_back(exEditors.at(i)->kind());
|
||||
externalEditorIds.push_back(exEditors.at(i)->id());
|
||||
allEditorIds.push_back(exEditors.at(i)->id());
|
||||
}
|
||||
if (allEditorKinds.empty())
|
||||
if (allEditorIds.empty())
|
||||
return QString();
|
||||
// Run dialog.
|
||||
OpenWithDialog dialog(fileName, m_d->m_core->mainWindow());
|
||||
dialog.setEditors(allEditorKinds);
|
||||
dialog.setEditors(allEditorIds);
|
||||
dialog.setCurrentEditor(0);
|
||||
if (dialog.exec() != QDialog::Accepted)
|
||||
return QString();
|
||||
const QString selectedKind = dialog.editor();
|
||||
const QString selectedId = dialog.editor();
|
||||
if (isExternalEditor)
|
||||
*isExternalEditor = externalEditorKinds.contains(selectedKind);
|
||||
return selectedKind;
|
||||
*isExternalEditor = externalEditorIds.contains(selectedId);
|
||||
return selectedId;
|
||||
}
|
||||
|
||||
static QString formatFileFilters(const Core::ICore *core, QString *selectedFilter)
|
||||
@@ -1111,17 +1110,17 @@ static QString formatFileFilters(const Core::ICore *core, QString *selectedFilte
|
||||
return rc;
|
||||
}
|
||||
|
||||
IEditor *EditorManager::openEditor(const QString &fileName, const QString &editorKind,
|
||||
IEditor *EditorManager::openEditor(const QString &fileName, const QString &editorId,
|
||||
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,
|
||||
const QString &editorKind, EditorManager::OpenEditorFlags flags)
|
||||
const QString &editorId, EditorManager::OpenEditorFlags flags)
|
||||
{
|
||||
if (debugEditorManager)
|
||||
qDebug() << Q_FUNC_INFO << fileName << editorKind;
|
||||
qDebug() << Q_FUNC_INFO << fileName << editorId;
|
||||
|
||||
if (fileName.isEmpty())
|
||||
return 0;
|
||||
@@ -1131,7 +1130,7 @@ IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QStri
|
||||
return activateEditor(view, editors.first(), flags);
|
||||
}
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
IEditor *editor = createEditor(editorKind, fileName);
|
||||
IEditor *editor = createEditor(editorId, fileName);
|
||||
if (!editor || !editor->open(fileName)) {
|
||||
QApplication::restoreOverrideCursor();
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
return false;
|
||||
QString errorMessage;
|
||||
@@ -1176,18 +1175,18 @@ void EditorManager::ensureEditorManagerVisible()
|
||||
m_d->m_core->modeManager()->activateMode(Constants::MODE_EDIT);
|
||||
}
|
||||
|
||||
IEditor *EditorManager::openEditorWithContents(const QString &editorKind,
|
||||
IEditor *EditorManager::openEditorWithContents(const QString &editorId,
|
||||
QString *titlePattern,
|
||||
const QString &contents)
|
||||
{
|
||||
if (debugEditorManager)
|
||||
qDebug() << Q_FUNC_INFO << editorKind << titlePattern << contents;
|
||||
qDebug() << Q_FUNC_INFO << editorId << titlePattern << contents;
|
||||
|
||||
if (editorKind.isEmpty())
|
||||
if (editorId.isEmpty())
|
||||
return 0;
|
||||
|
||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||
IEditor *edt = createEditor(editorKind);
|
||||
IEditor *edt = createEditor(editorId);
|
||||
if (!edt) {
|
||||
QApplication::restoreOverrideCursor();
|
||||
return 0;
|
||||
@@ -1311,7 +1310,7 @@ EditorManager::ReadOnlyAction
|
||||
|
||||
QPushButton *sccButton = 0;
|
||||
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);
|
||||
|
||||
@@ -1556,7 +1555,7 @@ QByteArray EditorManager::saveState() const
|
||||
stream << entries.count();
|
||||
|
||||
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();
|
||||
@@ -1595,11 +1594,11 @@ bool EditorManager::restoreState(const QByteArray &state)
|
||||
stream >> fileName;
|
||||
QString displayName;
|
||||
stream >> displayName;
|
||||
QByteArray kind;
|
||||
stream >> kind;
|
||||
QString id;
|
||||
stream >> id;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
void EditorManager::showEditorInfoBar(const QString &kind,
|
||||
void EditorManager::showEditorInfoBar(const QString &id,
|
||||
const QString &infoText,
|
||||
const QString &buttonText,
|
||||
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();
|
||||
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 &buttonText,
|
||||
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
|
||||
|
||||
@@ -113,16 +113,16 @@ public:
|
||||
Q_DECLARE_FLAGS(OpenEditorFlags, OpenEditorFlag)
|
||||
|
||||
IEditor *openEditor(const QString &fileName,
|
||||
const QString &editorKind = QString(),
|
||||
const QString &editorId = QString(),
|
||||
OpenEditorFlags flags = 0);
|
||||
IEditor *openEditorWithContents(const QString &editorKind,
|
||||
IEditor *openEditorWithContents(const QString &editorId,
|
||||
QString *titlePattern = 0,
|
||||
const QString &contents = QString());
|
||||
|
||||
bool openExternalEditor(const QString &fileName, const QString &editorKind);
|
||||
bool openExternalEditor(const QString &fileName, const QString &editorId);
|
||||
|
||||
QStringList getOpenFileNames() const;
|
||||
QString getOpenWithEditorKind(const QString &fileName, bool *isExternalEditor = 0) const;
|
||||
QString getOpenWithEditorId(const QString &fileName, bool *isExternalEditor = 0) const;
|
||||
|
||||
void ensureEditorManagerVisible();
|
||||
bool hasEditor(const QString &fileName) const;
|
||||
@@ -153,7 +153,7 @@ public:
|
||||
QByteArray saveState() const;
|
||||
bool restoreState(const QByteArray &state);
|
||||
|
||||
IEditor *restoreEditor(QString fileName, QString editorKind, EditorGroup *group);
|
||||
IEditor *restoreEditor(QString fileName, QString editorId, EditorGroup *group);
|
||||
|
||||
void saveSettings();
|
||||
void readSettings();
|
||||
@@ -161,19 +161,19 @@ public:
|
||||
Internal::OpenEditorsWindow *windowPopup() const;
|
||||
void showPopupOrSelectDocument() const;
|
||||
|
||||
void showEditorInfoBar(const QString &kind,
|
||||
void showEditorInfoBar(const QString &id,
|
||||
const QString &infoText,
|
||||
const QString &buttonText = QString(),
|
||||
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 &buttonText = QString(),
|
||||
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;
|
||||
ExternalEditorList externalEditors(const MimeType &mimeType, bool bestMatchOnly = true) const;
|
||||
@@ -244,7 +244,7 @@ private:
|
||||
void setCurrentView(Core::Internal::SplitterOrView *view);
|
||||
IEditor *activateEditor(Core::Internal::EditorView *view, Core::IEditor *editor, OpenEditorFlags flags = 0);
|
||||
IEditor *openEditor(Core::Internal::EditorView *view, const QString &fileName,
|
||||
const QString &editorKind = QString(),
|
||||
const QString &editorId = QString(),
|
||||
OpenEditorFlags flags = 0);
|
||||
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 &buttonText,
|
||||
QObject *object, const char *member)
|
||||
{
|
||||
m_infoWidgetKind = kind;
|
||||
m_infoWidgetId = id;
|
||||
m_infoWidgetLabel->setText(infoText);
|
||||
m_infoWidgetButton->setText(buttonText);
|
||||
m_infoWidgetButton->disconnect();
|
||||
@@ -239,18 +239,18 @@ void EditorView::showEditorInfoBar(const QString &kind,
|
||||
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);
|
||||
}
|
||||
|
||||
void EditorView::showEditorStatusBar(const QString &kind,
|
||||
void EditorView::showEditorStatusBar(const QString &id,
|
||||
const QString &infoText,
|
||||
const QString &buttonText,
|
||||
QObject *object, const char *member)
|
||||
{
|
||||
m_statusWidgetKind = kind;
|
||||
m_statusWidgetId = id;
|
||||
m_statusWidgetLabel->setText(infoText);
|
||||
m_statusWidgetButton->setText(buttonText);
|
||||
m_statusWidgetButton->disconnect();
|
||||
@@ -261,9 +261,9 @@ void EditorView::showEditorStatusBar(const QString &kind,
|
||||
//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_statusHLine->setVisible(false);
|
||||
}
|
||||
@@ -470,7 +470,7 @@ void EditorView::updateEditorHistory(IEditor *editor)
|
||||
EditLocation location;
|
||||
location.file = file;
|
||||
location.fileName = file->fileName();
|
||||
location.kind = editor->kind();
|
||||
location.id = editor->id();
|
||||
location.state = QVariant(state);
|
||||
|
||||
for(int i = 0; i < m_editorHistory.size(); ++i) {
|
||||
@@ -510,7 +510,7 @@ void EditorView::addCurrentPositionToNavigationHistory(IEditor *editor, const QB
|
||||
EditLocation location;
|
||||
location.file = file;
|
||||
location.fileName = file->fileName();
|
||||
location.kind = editor->kind();
|
||||
location.id = editor->id();
|
||||
location.state = QVariant(state);
|
||||
m_currentNavigationHistoryPosition = qMin(m_currentNavigationHistoryPosition, m_navigationHistory.size()); // paranoia
|
||||
m_navigationHistory.insert(m_currentNavigationHistoryPosition, location);
|
||||
@@ -567,7 +567,7 @@ void EditorView::updateCurrentPositionInNavigationHistory()
|
||||
}
|
||||
location->file = file;
|
||||
location->fileName = file->fileName();
|
||||
location->kind = editor->kind();
|
||||
location->id = editor->id();
|
||||
location->state = QVariant(editor->saveState());
|
||||
}
|
||||
|
||||
@@ -582,7 +582,7 @@ void EditorView::goBackInNavigationHistory()
|
||||
if (location.file) {
|
||||
editor = em->activateEditor(this, location.file, EditorManager::IgnoreNavigationHistory);
|
||||
} else {
|
||||
editor = em->openEditor(this, location.fileName, location.kind, EditorManager::IgnoreNavigationHistory);
|
||||
editor = em->openEditor(this, location.fileName, location.id, EditorManager::IgnoreNavigationHistory);
|
||||
if (!editor) {
|
||||
m_navigationHistory.removeAt(m_currentNavigationHistoryPosition);
|
||||
continue;
|
||||
@@ -606,7 +606,7 @@ void EditorView::goForwardInNavigationHistory()
|
||||
if (location.file) {
|
||||
editor = em->activateEditor(this, location.file, EditorManager::IgnoreNavigationHistory);
|
||||
} else {
|
||||
editor = em->openEditor(this, location.fileName, location.kind, EditorManager::IgnoreNavigationHistory);
|
||||
editor = em->openEditor(this, location.fileName, location.id, EditorManager::IgnoreNavigationHistory);
|
||||
if (!editor) {
|
||||
//TODO
|
||||
qDebug() << Q_FUNC_INFO << "can't open file" << location.fileName;
|
||||
@@ -963,10 +963,10 @@ QByteArray SplitterOrView::saveState() const
|
||||
|
||||
if (e && e == em->currentEditor()) {
|
||||
stream << QByteArray("currenteditor")
|
||||
<< e->file()->fileName() << e->kind() << e->saveState();
|
||||
<< e->file()->fileName() << e->id() << e->saveState();
|
||||
} else if (e) {
|
||||
stream << QByteArray("editor")
|
||||
<< e->file()->fileName() << e->kind() << e->saveState();
|
||||
<< e->file()->fileName() << e->id() << e->saveState();
|
||||
} else {
|
||||
stream << QByteArray("empty");
|
||||
}
|
||||
@@ -990,10 +990,10 @@ void SplitterOrView::restoreState(const QByteArray &state)
|
||||
} else if (mode == "editor" || mode == "currenteditor") {
|
||||
EditorManager *em = CoreImpl::instance()->editorManager();
|
||||
QString fileName;
|
||||
QByteArray kind;
|
||||
QByteArray id;
|
||||
QByteArray editorState;
|
||||
stream >> fileName >> kind >> editorState;
|
||||
IEditor *e = em->openEditor(view(), fileName, kind, Core::EditorManager::IgnoreNavigationHistory
|
||||
stream >> fileName >> id >> editorState;
|
||||
IEditor *e = em->openEditor(view(), fileName, id, Core::EditorManager::IgnoreNavigationHistory
|
||||
| Core::EditorManager::NoActivate);
|
||||
|
||||
if (!e) {
|
||||
|
||||
@@ -60,12 +60,12 @@ class OpenEditorsModel;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
struct EditLocation {
|
||||
struct EditLocation {
|
||||
QPointer<IFile> file;
|
||||
QString fileName;
|
||||
QString kind;
|
||||
QString id;
|
||||
QVariant state;
|
||||
};
|
||||
};
|
||||
|
||||
class EditorView : public QWidget
|
||||
{
|
||||
@@ -84,17 +84,17 @@ public:
|
||||
bool hasEditor(IEditor *editor) const;
|
||||
|
||||
QList<IEditor *> editors() const;
|
||||
void showEditorInfoBar(const QString &kind,
|
||||
void showEditorInfoBar(const QString &id,
|
||||
const QString &infoText,
|
||||
const QString &buttonText,
|
||||
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 &buttonText,
|
||||
QObject *object, const char *member);
|
||||
void hideEditorStatusBar(const QString &kind);
|
||||
void hideEditorStatusBar(const QString &id);
|
||||
|
||||
public slots:
|
||||
void closeView();
|
||||
@@ -118,12 +118,12 @@ private:
|
||||
QToolButton *m_closeButton;
|
||||
QToolButton *m_lockButton;
|
||||
QWidget *m_defaultToolBar;
|
||||
QString m_infoWidgetKind;
|
||||
QString m_infoWidgetId;
|
||||
QFrame *m_infoWidget;
|
||||
QLabel *m_infoWidgetLabel;
|
||||
QToolButton *m_infoWidgetButton;
|
||||
IEditor *m_editorForInfoWidget;
|
||||
QString m_statusWidgetKind;
|
||||
QString m_statusWidgetId;
|
||||
QFrame *m_statusHLine;
|
||||
QFrame *m_statusWidget;
|
||||
QLabel *m_statusWidgetLabel;
|
||||
|
||||
@@ -48,7 +48,7 @@ public:
|
||||
virtual bool createNew(const QString &contents = QString()) = 0;
|
||||
virtual bool open(const QString &fileName = QString()) = 0;
|
||||
virtual IFile *file() = 0;
|
||||
virtual const char *kind() const = 0;
|
||||
virtual QString id() const = 0;
|
||||
virtual QString displayName() const = 0;
|
||||
virtual void setDisplayName(const QString &title) = 0;
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@ public:
|
||||
virtual ~IExternalEditor() {}
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
@@ -41,12 +41,14 @@ namespace Core {
|
||||
QString OpenEditorsModel::Entry::fileName() const {
|
||||
return editor ? editor->file()->fileName() : m_fileName;
|
||||
}
|
||||
|
||||
QString OpenEditorsModel::Entry::displayName() const {
|
||||
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
|
||||
@@ -86,12 +88,12 @@ void OpenEditorsModel::addEditor(IEditor *editor, bool isDuplicate)
|
||||
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.m_fileName = fileName;
|
||||
entry.m_displayName = displayName;
|
||||
entry.m_kind = kind;
|
||||
entry.m_id = id;
|
||||
addEntry(entry);
|
||||
}
|
||||
|
||||
@@ -259,7 +261,7 @@ QVariant OpenEditorsModel::data(const QModelIndex &index, int role) const
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
return (e.editor && e.editor->file()->isModified())
|
||||
? e.displayName() + QLatin1String("*")
|
||||
? e.displayName() + QLatin1Char('*')
|
||||
: e.displayName();
|
||||
case Qt::DecorationRole:
|
||||
return (e.editor && e.editor->file()->isReadOnly())
|
||||
@@ -274,7 +276,7 @@ QVariant OpenEditorsModel::data(const QModelIndex &index, int role) const
|
||||
case Qt::UserRole + 1:
|
||||
return e.fileName();
|
||||
case Qt::UserRole + 2:
|
||||
return e.editor ? QByteArray(e.editor->kind()) : e.kind();
|
||||
return e.editor ? e.editor->id() : e.id();
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const;
|
||||
|
||||
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;
|
||||
|
||||
struct Entry {
|
||||
@@ -59,10 +59,10 @@ public:
|
||||
IEditor *editor;
|
||||
QString fileName() const;
|
||||
QString displayName() const;
|
||||
QByteArray kind() const;
|
||||
QString id() const;
|
||||
QString m_fileName;
|
||||
QString m_displayName;
|
||||
QByteArray m_kind;
|
||||
QString m_id;
|
||||
};
|
||||
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->setData(0, Qt::UserRole, QVariant::fromValue(hi.file.data()));
|
||||
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);
|
||||
|
||||
m_editorList->addTopLevelItem(item);
|
||||
@@ -252,7 +252,7 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE
|
||||
item->setIcon(0, emptyIcon);
|
||||
item->setText(0, title);
|
||||
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);
|
||||
|
||||
m_editorList->addTopLevelItem(item);
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
|
||||
namespace Core {
|
||||
|
||||
class IMode;
|
||||
|
||||
class CORE_EXPORT FindToolBarPlaceHolder : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -62,7 +62,7 @@ QString GeneralSettings::id() const
|
||||
return QLatin1String("A.General");
|
||||
}
|
||||
|
||||
QString GeneralSettings::trName() const
|
||||
QString GeneralSettings::displayName() const
|
||||
{
|
||||
return tr("General");
|
||||
}
|
||||
@@ -72,7 +72,7 @@ QString GeneralSettings::category() const
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -49,9 +49,9 @@ public:
|
||||
GeneralSettings();
|
||||
|
||||
QString id() const;
|
||||
QString trName() const;
|
||||
QString displayName() const;
|
||||
QString category() const;
|
||||
QString trCategory() const;
|
||||
QString displayCategory() const;
|
||||
QWidget* createPage(QWidget *parent);
|
||||
void apply();
|
||||
void finish();
|
||||
|
||||
@@ -51,7 +51,9 @@ public:
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
@@ -47,10 +47,10 @@ public:
|
||||
IMode(QObject *parent = 0) : IContext(parent) {}
|
||||
virtual ~IMode() {}
|
||||
|
||||
virtual QString name() const = 0;
|
||||
virtual QString displayName() const = 0;
|
||||
virtual QIcon icon() const = 0;
|
||||
virtual int priority() const = 0;
|
||||
virtual const char *uniqueModeName() const = 0;
|
||||
virtual QString id() const = 0;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
IVersionControl(QObject *parent = 0) : QObject(parent) {}
|
||||
virtual ~IVersionControl() {}
|
||||
|
||||
virtual QString name() const = 0;
|
||||
virtual QString displayName() const = 0;
|
||||
|
||||
/*!
|
||||
* Returns whether files in this directory should be managed with this
|
||||
|
||||
@@ -910,13 +910,13 @@ void MainWindow::openFileWith()
|
||||
QStringList fileNames = editorManager()->getOpenFileNames();
|
||||
foreach (const QString &fileName, fileNames) {
|
||||
bool isExternal;
|
||||
const QString editorKind = editorManager()->getOpenWithEditorKind(fileName, &isExternal);
|
||||
if (editorKind.isEmpty())
|
||||
const QString editorId = editorManager()->getOpenWithEditorId(fileName, &isExternal);
|
||||
if (editorId.isEmpty())
|
||||
continue;
|
||||
if (isExternal) {
|
||||
editorManager()->openExternalEditor(fileName, editorKind);
|
||||
editorManager()->openExternalEditor(fileName, editorId);
|
||||
} else {
|
||||
editorManager()->openEditor(fileName, editorKind);
|
||||
editorManager()->openEditor(fileName, editorId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ class SettingsDatabase;
|
||||
class UniqueIDManager;
|
||||
class VariableManager;
|
||||
class VCSManager;
|
||||
class IMode;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ IMode *ModeManager::currentMode() const
|
||||
int ModeManager::indexOf(const QString &id) const
|
||||
{
|
||||
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;
|
||||
}
|
||||
qDebug() << "Warning, no such mode:" << id;
|
||||
@@ -139,13 +139,13 @@ void ModeManager::objectAdded(QObject *obj)
|
||||
++index;
|
||||
|
||||
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
|
||||
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);
|
||||
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);
|
||||
|
||||
m_modeShortcuts.insert(index, cmd);
|
||||
@@ -163,7 +163,7 @@ void ModeManager::objectAdded(QObject *obj)
|
||||
currentCmd->setKeySequence(currentCmd->defaultKeySequence());
|
||||
}
|
||||
|
||||
m_signalMapper->setMapping(shortcut, mode->uniqueModeName());
|
||||
m_signalMapper->setMapping(shortcut, mode->id());
|
||||
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);
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -310,9 +310,9 @@ void EditorPrototype::setDisplayName(const QString &title)
|
||||
callee()->setDisplayName(title);
|
||||
}
|
||||
|
||||
QString EditorPrototype::kind() const
|
||||
QString EditorPrototype::id() const
|
||||
{
|
||||
return QLatin1String(callee()->kind());
|
||||
return callee()->id();
|
||||
}
|
||||
|
||||
bool EditorPrototype::duplicateSupported() const
|
||||
|
||||
@@ -178,8 +178,8 @@ public:
|
||||
public slots:
|
||||
QList<Core::IEditor*> editorsForFiles(QList<Core::IFile*> files) const;
|
||||
bool closeEditors(const QList<Core::IEditor*> editorsToClose, bool askAboutModifiedEditors);
|
||||
Core::IEditor *openEditor(const QString &fileName, const QString &editorKind);
|
||||
Core::IEditor *newFile(const QString &editorKind, QString titlePattern, const QString &contents);
|
||||
Core::IEditor *openEditor(const QString &fileName, const QString &editorId);
|
||||
Core::IEditor *newFile(const QString &editorId, QString titlePattern, const QString &contents);
|
||||
int makeEditorWritable(Core::IEditor *editor);
|
||||
|
||||
QString toString() const;
|
||||
@@ -194,7 +194,7 @@ class EditorPrototype : public QObject, public QScriptable
|
||||
{
|
||||
Q_OBJECT
|
||||
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(Core::IFile* file READ file 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;
|
||||
void setDisplayName(const QString &title);
|
||||
|
||||
QString kind() const;
|
||||
QString id() const;
|
||||
bool duplicateSupported() 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 msg = QCoreApplication::translate("VCSManager",
|
||||
"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 =
|
||||
QMessageBox::question(0, title, msg, QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
|
||||
if (button != QMessageBox::Yes)
|
||||
@@ -154,7 +154,7 @@ CORE_EXPORT QDebug operator<<(QDebug in, const VCSManager &v)
|
||||
QDebug nospace = in.nospace();
|
||||
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)
|
||||
nospace << "Directory: " << it.key() << ' ' << it.value()->name() << '\n';
|
||||
nospace << "Directory: " << it.key() << ' ' << it.value()->displayName() << '\n';
|
||||
nospace << '\n';
|
||||
return in;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ QString CodePasterSettingsPage::id() const
|
||||
return QLatin1String("C.CodePaster");
|
||||
}
|
||||
|
||||
QString CodePasterSettingsPage::trName() const
|
||||
QString CodePasterSettingsPage::displayName() const
|
||||
{
|
||||
return tr("CodePaster");
|
||||
}
|
||||
@@ -69,7 +69,7 @@ QString CodePasterSettingsPage::category() const
|
||||
return QLatin1String(Constants::CPASTER_SETTINGS_CATEGORY);
|
||||
}
|
||||
|
||||
QString CodePasterSettingsPage::trCategory() const
|
||||
QString CodePasterSettingsPage::displayCategory() const
|
||||
{
|
||||
return QCoreApplication::translate("CodePaster", Constants::CPASTER_SETTINGS_TR_CATEGORY);
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ public:
|
||||
CodePasterSettingsPage();
|
||||
|
||||
QString id() const;
|
||||
QString trName() const;
|
||||
QString displayName() const;
|
||||
QString category() const;
|
||||
QString trCategory() const;
|
||||
QString displayCategory() const;
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
|
||||
@@ -260,7 +260,7 @@ void CodepasterPlugin::finishFetch(const QString &titleDescription,
|
||||
ICore::instance()->messageManager()->printToOutputPane(content, true);
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ QString PasteBinDotComSettings::id() const
|
||||
return QLatin1String("B.Pastebin.com");
|
||||
}
|
||||
|
||||
QString PasteBinDotComSettings::trName() const
|
||||
QString PasteBinDotComSettings::displayName() const
|
||||
{
|
||||
return tr("Pastebin.com");
|
||||
}
|
||||
@@ -60,7 +60,7 @@ QString PasteBinDotComSettings::category() const
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -48,9 +48,9 @@ public:
|
||||
PasteBinDotComSettings();
|
||||
|
||||
QString id() const;
|
||||
QString trName() const;
|
||||
QString displayName() const;
|
||||
QString category() const;
|
||||
QString trCategory() const;
|
||||
QString displayCategory() const;
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
|
||||
@@ -66,7 +66,7 @@ QString SettingsPage::id() const
|
||||
return QLatin1String("A.General");
|
||||
}
|
||||
|
||||
QString SettingsPage::trName() const
|
||||
QString SettingsPage::displayName() const
|
||||
{
|
||||
return tr("General");
|
||||
}
|
||||
@@ -76,7 +76,7 @@ QString SettingsPage::category() const
|
||||
return QLatin1String(Constants::CPASTER_SETTINGS_CATEGORY);
|
||||
}
|
||||
|
||||
QString SettingsPage::trCategory() const
|
||||
QString SettingsPage::displayCategory() const
|
||||
{
|
||||
return QCoreApplication::translate("CodePaster", Constants::CPASTER_SETTINGS_TR_CATEGORY);
|
||||
}
|
||||
|
||||
@@ -52,9 +52,9 @@ public:
|
||||
SettingsPage();
|
||||
|
||||
QString id() const;
|
||||
QString trName() const;
|
||||
QString displayName() const;
|
||||
QString category() const;
|
||||
QString trCategory() const;
|
||||
QString displayCategory() const;
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
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());
|
||||
|
||||
Core::GeneratedFile sourceFile(sourceFileName);
|
||||
sourceFile.setEditorKind(QLatin1String(Constants::CPPEDITOR_KIND));
|
||||
sourceFile.setEditorId(QLatin1String(Constants::CPPEDITOR_ID));
|
||||
|
||||
Core::GeneratedFile headerFile(headerFileName);
|
||||
headerFile.setEditorKind(QLatin1String(Constants::CPPEDITOR_KIND));
|
||||
headerFile.setEditorId(QLatin1String(Constants::CPPEDITOR_ID));
|
||||
|
||||
QString header, source;
|
||||
if (!generateHeaderAndSource(params, &header, &source)) {
|
||||
|
||||
@@ -596,9 +596,11 @@ CPPEditorEditable::CPPEditorEditable(CPPEditor *editor)
|
||||
: BaseTextEditorEditable(editor)
|
||||
{
|
||||
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(TextEditor::Constants::C_TEXTEDITOR);
|
||||
|
||||
setDisplayName(tr(CppEditor::Constants::CPPEDITOR_DISPLAY_NAME));
|
||||
}
|
||||
|
||||
CPPEditor::CPPEditor(QWidget *parent)
|
||||
@@ -2007,9 +2009,9 @@ Core::IEditor *CPPEditorEditable::duplicate(QWidget *parent)
|
||||
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)
|
||||
@@ -2095,7 +2097,7 @@ bool CPPEditor::openCppEditorAt(const Link &link)
|
||||
return TextEditor::BaseTextEditor::openEditorAt(link.fileName,
|
||||
link.line,
|
||||
link.column,
|
||||
Constants::C_CPPEDITOR);
|
||||
Constants::CPPEDITOR_ID);
|
||||
}
|
||||
|
||||
void CPPEditor::semanticRehighlight()
|
||||
|
||||
@@ -166,7 +166,7 @@ public:
|
||||
|
||||
bool duplicateSupported() const { return true; }
|
||||
Core::IEditor *duplicate(QWidget *parent);
|
||||
const char *kind() const;
|
||||
QString id() const;
|
||||
|
||||
bool isTemporary() const { return false; }
|
||||
virtual bool open(const QString & fileName);
|
||||
|
||||
@@ -35,8 +35,8 @@ namespace Constants {
|
||||
|
||||
const char * const FORMATCODE = "CppEditor.FormatCode";
|
||||
const char * const M_CONTEXT = "CppEditor.ContextMenu";
|
||||
const char * const C_CPPEDITOR = "C++ Editor";
|
||||
const char * const CPPEDITOR_KIND = QT_TRANSLATE_NOOP("OpenWith::Editors", "C++ Editor");
|
||||
const char * const CPPEDITOR_ID = "CppPlugin.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 RENAME_SYMBOL_UNDER_CURSOR = "CppEditor.RenameSymbolUnderCursor";
|
||||
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));
|
||||
|
||||
Core::GeneratedFile file(fileName);
|
||||
file.setEditorKind(QLatin1String(Constants::C_CPPEDITOR));
|
||||
file.setEditorId(QLatin1String(Constants::CPPEDITOR_ID));
|
||||
file.setContents(fileContents(m_type, fileName));
|
||||
|
||||
return Core::GeneratedFiles() << file;
|
||||
|
||||
@@ -68,7 +68,6 @@ enum { QUICKFIX_INTERVAL = 20 };
|
||||
//////////////////////////// CppEditorFactory /////////////////////////////
|
||||
|
||||
CppEditorFactory::CppEditorFactory(CppPlugin *owner) :
|
||||
m_kind(QLatin1String(CppEditor::Constants::CPPEDITOR_KIND)),
|
||||
m_owner(owner)
|
||||
{
|
||||
m_mimeTypes << QLatin1String(CppEditor::Constants::C_SOURCE_MIMETYPE)
|
||||
@@ -88,14 +87,19 @@ CppEditorFactory::CppEditorFactory(CppPlugin *owner) :
|
||||
#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::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, kind());
|
||||
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, id());
|
||||
return iface ? iface->file() : 0;
|
||||
}
|
||||
|
||||
@@ -204,8 +208,8 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
|
||||
CppFileWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
|
||||
|
||||
wizardParameters.setCategory(QLatin1String("C.C++"));
|
||||
wizardParameters.setTrCategory(tr("C++"));
|
||||
wizardParameters.setName(tr("C++ Class"));
|
||||
wizardParameters.setDisplayCategory(tr("C++"));
|
||||
wizardParameters.setDisplayName(tr("C++ Class"));
|
||||
wizardParameters.setId(QLatin1String("A.Class"));
|
||||
wizardParameters.setKind(Core::IWizard::ClassWizard);
|
||||
wizardParameters.setDescription(tr("Creates a header and a source file for a new class."));
|
||||
@@ -213,17 +217,17 @@ bool CppPlugin::initialize(const QStringList & /*arguments*/, QString *errorMess
|
||||
|
||||
wizardParameters.setKind(Core::IWizard::FileWizard);
|
||||
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"));
|
||||
addAutoReleasedObject(new CppFileWizard(wizardParameters, Source, core));
|
||||
|
||||
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"));
|
||||
addAutoReleasedObject(new CppFileWizard(wizardParameters, Header, core));
|
||||
|
||||
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::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()));
|
||||
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::UnCommentSelection
|
||||
| TextEditor::TextEditorActionHandler::UnCollapseAll);
|
||||
|
||||
@@ -115,11 +115,11 @@ public:
|
||||
|
||||
Core::IEditor *createEditor(QWidget *parent);
|
||||
|
||||
virtual QString kind() const;
|
||||
virtual QString id() const;
|
||||
virtual QString displayName() const;
|
||||
Core::IFile *open(const QString &fileName);
|
||||
|
||||
private:
|
||||
const QString m_kind;
|
||||
CppPlugin *m_owner;
|
||||
QStringList m_mimeTypes;
|
||||
};
|
||||
|
||||
@@ -55,7 +55,7 @@ QString CompletionSettingsPage::id() const
|
||||
return QLatin1String("P.Completion");
|
||||
}
|
||||
|
||||
QString CompletionSettingsPage::trName() const
|
||||
QString CompletionSettingsPage::displayName() const
|
||||
{
|
||||
return tr("Completion");
|
||||
}
|
||||
@@ -65,7 +65,7 @@ QString CompletionSettingsPage::category() const
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -50,9 +50,9 @@ public:
|
||||
~CompletionSettingsPage();
|
||||
|
||||
QString id() const;
|
||||
QString trName() const;
|
||||
QString displayName() const;
|
||||
QString category() const;
|
||||
QString trCategory() const;
|
||||
QString displayCategory() const;
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
|
||||
@@ -43,8 +43,8 @@ public:
|
||||
CppClassesFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
||||
~CppClassesFilter();
|
||||
|
||||
QString trName() const { return tr("Classes"); }
|
||||
QString name() const { return QLatin1String("Classes"); }
|
||||
QString displayName() const { return tr("Classes"); }
|
||||
QString id() const { return QLatin1String("Classes"); }
|
||||
Priority priority() const { return Medium; }
|
||||
};
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ public:
|
||||
CppCurrentDocumentFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
||||
~CppCurrentDocumentFilter() {}
|
||||
|
||||
QString trName() const { return tr("Methods in current Document"); }
|
||||
QString name() const { return QLatin1String("Methods in current Document"); }
|
||||
QString displayName() const { return tr("Methods in current Document"); }
|
||||
QString id() const { return QLatin1String("Methods in current Document"); }
|
||||
Priority priority() const { return Medium; }
|
||||
QList<Locator::FilterEntry> matchesFor(const QString &entry);
|
||||
void accept(Locator::FilterEntry selection) const;
|
||||
|
||||
@@ -268,7 +268,7 @@ void CppFileSettingsWidget::slotEdit()
|
||||
QString path = licenseTemplatePath();
|
||||
// Edit existing file with C++
|
||||
if (!path.isEmpty()) {
|
||||
Core::EditorManager::instance()->openEditor(path, QLatin1String(CppEditor::Constants::CPPEDITOR_KIND));
|
||||
Core::EditorManager::instance()->openEditor(path, QLatin1String(CppEditor::Constants::CPPEDITOR_ID));
|
||||
return;
|
||||
}
|
||||
// Pick a file name and write new template, edit with C++
|
||||
@@ -284,7 +284,7 @@ void CppFileSettingsWidget::slotEdit()
|
||||
file.write(tr(licenseTemplateTemplate).toUtf8());
|
||||
file.close();
|
||||
setLicenseTemplatePath(path);
|
||||
Core::EditorManager::instance()->openEditor(path, QLatin1String(CppEditor::Constants::CPPEDITOR_KIND));
|
||||
Core::EditorManager::instance()->openEditor(path, QLatin1String(CppEditor::Constants::CPPEDITOR_ID));
|
||||
}
|
||||
|
||||
// --------------- CppFileSettingsPage
|
||||
@@ -304,7 +304,7 @@ QString CppFileSettingsPage::id() const
|
||||
return QLatin1String(Constants::CPP_SETTINGS_ID);
|
||||
}
|
||||
|
||||
QString CppFileSettingsPage::trName() const
|
||||
QString CppFileSettingsPage::displayName() const
|
||||
{
|
||||
return QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_NAME);
|
||||
}
|
||||
@@ -314,7 +314,7 @@ QString CppFileSettingsPage::category() const
|
||||
return QLatin1String(Constants::CPP_SETTINGS_CATEGORY);
|
||||
}
|
||||
|
||||
QString CppFileSettingsPage::trCategory() const
|
||||
QString CppFileSettingsPage::displayCategory() const
|
||||
{
|
||||
return QCoreApplication::translate("CppTools", Constants::CPP_SETTINGS_TR_CATEGORY);
|
||||
}
|
||||
|
||||
@@ -98,9 +98,9 @@ public:
|
||||
virtual ~CppFileSettingsPage();
|
||||
|
||||
virtual QString id() const;
|
||||
virtual QString trName() const;
|
||||
virtual QString displayName() const;
|
||||
virtual QString category() const;
|
||||
virtual QString trCategory() const;
|
||||
virtual QString displayCategory() const;
|
||||
|
||||
virtual QWidget *createPage(QWidget *parent);
|
||||
virtual void apply();
|
||||
|
||||
@@ -43,8 +43,8 @@ public:
|
||||
CppFunctionsFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
||||
~CppFunctionsFilter();
|
||||
|
||||
QString trName() const { return tr("Methods"); }
|
||||
QString name() const { return QLatin1String("Methods"); }
|
||||
QString displayName() const { return tr("Methods"); }
|
||||
QString id() const { return QLatin1String("Methods"); }
|
||||
Priority priority() const { return Medium; }
|
||||
};
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ public:
|
||||
CppLocatorFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
||||
~CppLocatorFilter();
|
||||
|
||||
QString trName() const { return tr("Classes and Methods"); }
|
||||
QString name() const { return QLatin1String("Classes and Methods"); }
|
||||
QString displayName() const { return tr("Classes and Methods"); }
|
||||
QString id() const { return QLatin1String("Classes and Methods"); }
|
||||
Priority priority() const { return Medium; }
|
||||
QList<Locator::FilterEntry> matchesFor(const QString &entry);
|
||||
void accept(Locator::FilterEntry selection) const;
|
||||
|
||||
@@ -128,7 +128,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
mtools->addMenu(mcpptools);
|
||||
|
||||
// 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;
|
||||
|
||||
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.");
|
||||
}
|
||||
|
||||
QString CheckoutWizard::name() const
|
||||
QString CheckoutWizard::displayName() const
|
||||
{
|
||||
return tr("CVS Checkout");
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
// IWizard
|
||||
virtual QIcon icon() const;
|
||||
virtual QString description() const;
|
||||
virtual QString name() const;
|
||||
virtual QString displayName() const;
|
||||
|
||||
protected:
|
||||
// BaseCheckoutWizard
|
||||
|
||||
@@ -41,7 +41,7 @@ CVSControl::CVSControl(CVSPlugin *plugin) :
|
||||
{
|
||||
}
|
||||
|
||||
QString CVSControl::name() const
|
||||
QString CVSControl::displayName() const
|
||||
{
|
||||
return QLatin1String("cvs");
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ class CVSControl : public Core::IVersionControl
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CVSControl(CVSPlugin *plugin);
|
||||
virtual QString name() const;
|
||||
virtual QString displayName() const;
|
||||
|
||||
virtual bool managesDirectory(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);
|
||||
QTC_ASSERT(params, return 0);
|
||||
const QString kind = QLatin1String(params->kind);
|
||||
const QString id = params->id;
|
||||
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;
|
||||
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)),
|
||||
this, SLOT(annotateVersion(QString,QString,int)));
|
||||
CVSEditor *e = qobject_cast<CVSEditor*>(editor->widget());
|
||||
|
||||
@@ -93,7 +93,7 @@ QString SettingsPage::id() const
|
||||
return QLatin1String(VCSBase::Constants::VCS_ID_CVS);
|
||||
}
|
||||
|
||||
QString SettingsPage::trName() const
|
||||
QString SettingsPage::displayName() const
|
||||
{
|
||||
return tr("CVS");
|
||||
}
|
||||
@@ -103,7 +103,7 @@ QString SettingsPage::category() const
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -70,9 +70,9 @@ public:
|
||||
SettingsPage();
|
||||
|
||||
QString id() const;
|
||||
QString trName() const;
|
||||
QString displayName() const;
|
||||
QString category() const;
|
||||
QString trCategory() const;
|
||||
QString displayCategory() const;
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
void apply();
|
||||
|
||||
@@ -151,7 +151,7 @@ QString CdbOptionsPage::settingsId()
|
||||
return QLatin1String("F.Cdb");
|
||||
}
|
||||
|
||||
QString CdbOptionsPage::trName() const
|
||||
QString CdbOptionsPage::displayName() const
|
||||
{
|
||||
return tr("Cdb");
|
||||
}
|
||||
@@ -161,7 +161,7 @@ QString CdbOptionsPage::category() const
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -73,9 +73,9 @@ public:
|
||||
|
||||
// IOptionsPage
|
||||
virtual QString id() const { return settingsId(); }
|
||||
virtual QString trName() const;
|
||||
virtual QString displayName() const;
|
||||
virtual QString category() const;
|
||||
virtual QString trCategory() const;
|
||||
virtual QString displayCategory() const;
|
||||
|
||||
virtual QWidget *createPage(QWidget *parent);
|
||||
virtual void apply();
|
||||
|
||||
@@ -94,7 +94,7 @@ void MemoryViewAgent::init(quint64 addr)
|
||||
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
||||
QString titlePattern = tr("Memory $");
|
||||
m_editor = editorManager->openEditorWithContents(
|
||||
Core::Constants::K_DEFAULT_BINARY_EDITOR,
|
||||
Core::Constants::K_DEFAULT_BINARY_EDITOR_ID,
|
||||
&titlePattern);
|
||||
if (m_editor) {
|
||||
connect(m_editor->widget(), SIGNAL(lazyDataRequested(quint64,bool)),
|
||||
@@ -261,7 +261,7 @@ void DisassemblerViewAgent::setContents(const QString &contents)
|
||||
QString titlePattern = "Disassembler";
|
||||
d->editor = qobject_cast<ITextEditor *>(
|
||||
editorManager->openEditorWithContents(
|
||||
Core::Constants::K_DEFAULT_TEXT_EDITOR,
|
||||
Core::Constants::K_DEFAULT_TEXT_EDITOR_ID,
|
||||
&titlePattern));
|
||||
QTC_ASSERT(d->editor, return);
|
||||
if ((plainTextEdit = qobject_cast<QPlainTextEdit *>(d->editor->widget())))
|
||||
|
||||
@@ -195,8 +195,8 @@ public:
|
||||
DebugMode::DebugMode(QObject *parent)
|
||||
: BaseMode(parent)
|
||||
{
|
||||
setName(tr("Debug"));
|
||||
setUniqueModeName(Constants::MODE_DEBUG);
|
||||
setDisplayName(tr("Debug"));
|
||||
setId(Constants::MODE_DEBUG);
|
||||
setIcon(QIcon(":/fancyactionbar/images/mode_Debug.png"));
|
||||
setPriority(Constants::P_MODE_DEBUG);
|
||||
}
|
||||
@@ -320,11 +320,11 @@ public:
|
||||
// IOptionsPage
|
||||
QString id() const
|
||||
{ return QLatin1String(Debugger::Constants::DEBUGGER_COMMON_SETTINGS_ID); }
|
||||
QString trName() const
|
||||
QString displayName() const
|
||||
{ return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_COMMON_SETTINGS_NAME); }
|
||||
QString category() const
|
||||
{ return QLatin1String(Debugger::Constants::DEBUGGER_SETTINGS_CATEGORY); }
|
||||
QString trCategory() const
|
||||
QString displayCategory() const
|
||||
{ return QCoreApplication::translate("Debugger", Debugger::Constants::DEBUGGER_SETTINGS_TR_CATEGORY); }
|
||||
|
||||
QWidget *createPage(QWidget *parent);
|
||||
@@ -421,9 +421,9 @@ public:
|
||||
|
||||
// IOptionsPage
|
||||
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 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);
|
||||
void apply() { m_group.apply(settings()); }
|
||||
@@ -678,7 +678,7 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
|
||||
debuggercontext << uidm->uniqueIdentifier(C_GDBDEBUGGER);
|
||||
|
||||
QList<int> cppeditorcontext;
|
||||
cppeditorcontext << uidm->uniqueIdentifier(CppEditor::Constants::C_CPPEDITOR);
|
||||
cppeditorcontext << uidm->uniqueIdentifier(CppEditor::Constants::CPPEDITOR_ID);
|
||||
|
||||
QList<int> texteditorcontext;
|
||||
texteditorcontext << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
|
||||
@@ -1057,7 +1057,7 @@ void DebuggerPlugin::activatePreviousMode()
|
||||
void DebuggerPlugin::activateDebugMode()
|
||||
{
|
||||
ModeManager *modeManager = ModeManager::instance();
|
||||
m_previousMode = QLatin1String(modeManager->currentMode()->uniqueModeName());
|
||||
m_previousMode = modeManager->currentMode()->id();
|
||||
modeManager->activateMode(QLatin1String(MODE_DEBUG));
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ QString GdbOptionsPage::settingsId()
|
||||
return QLatin1String("M.Gdb");
|
||||
}
|
||||
|
||||
QString GdbOptionsPage::trName() const
|
||||
QString GdbOptionsPage::displayName() const
|
||||
{
|
||||
return tr("Gdb");
|
||||
}
|
||||
@@ -57,7 +57,7 @@ QString GdbOptionsPage::category() const
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ public:
|
||||
GdbOptionsPage();
|
||||
|
||||
virtual QString id() const { return settingsId(); }
|
||||
virtual QString trName() const;
|
||||
virtual QString displayName() const;
|
||||
virtual QString category() const;
|
||||
virtual QString trCategory() const;
|
||||
virtual QString displayCategory() const;
|
||||
|
||||
virtual QWidget *createPage(QWidget *parent);
|
||||
virtual void apply();
|
||||
|
||||
@@ -54,7 +54,7 @@ QString TrkOptionsPage::settingsId()
|
||||
return QLatin1String("S.Trk");
|
||||
}
|
||||
|
||||
QString TrkOptionsPage::trName() const
|
||||
QString TrkOptionsPage::displayName() const
|
||||
{
|
||||
return tr("Symbian TRK");
|
||||
}
|
||||
@@ -64,7 +64,7 @@ QString TrkOptionsPage::category() const
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -53,9 +53,9 @@ public:
|
||||
virtual ~TrkOptionsPage();
|
||||
|
||||
virtual QString id() const { return settingsId(); }
|
||||
virtual QString trName() const;
|
||||
virtual QString displayName() const;
|
||||
virtual QString category() const;
|
||||
virtual QString trCategory() const;
|
||||
virtual QString displayCategory() const;
|
||||
|
||||
virtual QWidget *createPage(QWidget *parent);
|
||||
virtual void apply();
|
||||
|
||||
@@ -108,7 +108,7 @@ QString CppSettingsPage::id() const
|
||||
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);
|
||||
}
|
||||
@@ -118,7 +118,7 @@ QString CppSettingsPage::category() const
|
||||
return QLatin1String(Designer::Constants::SETTINGS_CATEGORY);
|
||||
}
|
||||
|
||||
QString CppSettingsPage::trCategory() const
|
||||
QString CppSettingsPage::displayCategory() const
|
||||
{
|
||||
return QCoreApplication::translate("Designer", Designer::Constants::SETTINGS_TR_CATEGORY);
|
||||
}
|
||||
|
||||
@@ -64,9 +64,9 @@ public:
|
||||
explicit CppSettingsPage(QObject *parent = 0);
|
||||
|
||||
virtual QString id() const;
|
||||
virtual QString trName() const;
|
||||
virtual QString displayName() const;
|
||||
virtual QString category() const;
|
||||
virtual QString trCategory() const;
|
||||
virtual QString displayCategory() const;
|
||||
|
||||
virtual QWidget *createPage(QWidget *parent);
|
||||
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());
|
||||
|
||||
Core::GeneratedFile headerFile(headerFileName);
|
||||
headerFile.setEditorKind(QLatin1String(CppEditor::Constants::CPPEDITOR_KIND));
|
||||
headerFile.setEditorId(QLatin1String(CppEditor::Constants::CPPEDITOR_ID));
|
||||
|
||||
// Source
|
||||
Core::GeneratedFile sourceFile(sourceFileName);
|
||||
sourceFile.setEditorKind(QLatin1String(CppEditor::Constants::CPPEDITOR_KIND));
|
||||
sourceFile.setEditorId(QLatin1String(CppEditor::Constants::CPPEDITOR_ID));
|
||||
|
||||
// UI
|
||||
Core::GeneratedFile uiFile(formFileName);
|
||||
uiFile.setContents(params.uiTemplate());
|
||||
uiFile.setEditorKind(QLatin1String(Constants::C_FORMEDITOR));
|
||||
uiFile.setEditorId(QLatin1String(Constants::C_FORMEDITOR_ID));
|
||||
|
||||
QString source, header;
|
||||
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");
|
||||
|
||||
// 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 M_FORMEDITOR = "FormEditor.Menu";
|
||||
const char * const M_FORMEDITOR_VIEWS = "FormEditor.Menu.Views";
|
||||
|
||||
@@ -44,7 +44,6 @@ using namespace Designer::Constants;
|
||||
|
||||
FormEditorFactory::FormEditorFactory()
|
||||
: Core::IEditorFactory(Core::ICore::instance()),
|
||||
m_kind(QLatin1String(C_FORMEDITOR)),
|
||||
m_mimeTypes(QLatin1String(FORM_MIMETYPE))
|
||||
{
|
||||
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
||||
@@ -52,14 +51,19 @@ FormEditorFactory::FormEditorFactory()
|
||||
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::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, kind());
|
||||
Core::IEditor *iface = Core::EditorManager::instance()->openEditor(fileName, id());
|
||||
return iface ? iface->file() : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,12 +52,12 @@ public:
|
||||
virtual QStringList mimeTypes() const;
|
||||
|
||||
// IEditorFactory
|
||||
virtual QString kind() const;
|
||||
virtual QString id() const;
|
||||
virtual QString displayName() const;
|
||||
Core::IFile *open(const QString &fileName);
|
||||
Core::IEditor *createEditor(QWidget *parent);
|
||||
|
||||
private:
|
||||
const QString m_kind;
|
||||
const QStringList m_mimeTypes;
|
||||
};
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ bool FormEditorPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
|
||||
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;
|
||||
|
||||
addAutoReleasedObject(new FormEditorFactory);
|
||||
@@ -135,16 +135,16 @@ void FormEditorPlugin::initializeTemplates()
|
||||
{
|
||||
FormWizard::BaseFileWizardParameters wizardParameters(Core::IWizard::FileWizard);
|
||||
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);
|
||||
wizardParameters.setName(tr("Qt Designer Form"));
|
||||
wizardParameters.setDisplayName(tr("Qt Designer Form"));
|
||||
wizardParameters.setId(QLatin1String("D.Form"));
|
||||
wizardParameters.setDescription(tr("Creates a Qt Designer form file (.ui)."));
|
||||
addAutoReleasedObject(new FormWizard(wizardParameters, this));
|
||||
|
||||
#ifdef CPP_ENABLED
|
||||
wizardParameters.setKind(Core::IWizard::ClassWizard);
|
||||
wizardParameters.setName(tr("Qt Designer Form Class"));
|
||||
wizardParameters.setDisplayName(tr("Qt Designer Form Class"));
|
||||
wizardParameters.setId(QLatin1String("C.FormClass"));
|
||||
wizardParameters.setDescription(tr("Creates a Qt Designer form file (.ui) with a matching class."));
|
||||
addAutoReleasedObject(new FormClassWizard(wizardParameters, this));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user