Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

This commit is contained in:
hjk
2009-02-16 13:30:22 +01:00
29 changed files with 267 additions and 147 deletions

View File

@@ -40,6 +40,7 @@
#include "cmakestep.h" #include "cmakestep.h"
#include "makestep.h" #include "makestep.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <cpptools/cppmodelmanagerinterface.h> #include <cpptools/cppmodelmanagerinterface.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -103,7 +104,7 @@ void CMakeProject::parseCMakeLists()
} else { } else {
// TODO hmm? // TODO hmm?
} }
if (newToolChain == m_toolChain) { if (ProjectExplorer::ToolChain::equals(newToolChain, m_toolChain)) {
delete newToolChain; delete newToolChain;
newToolChain = 0; newToolChain = 0;
} else { } else {
@@ -158,6 +159,21 @@ void CMakeProject::parseCMakeLists()
} }
} }
QString CMakeProject::buildParser(const QString &buildConfiguration) const
{
if (!m_toolChain)
return QString::null;
if (m_toolChain->type() == ProjectExplorer::ToolChain::GCC
|| m_toolChain->type() == ProjectExplorer::ToolChain::LinuxICC
|| m_toolChain->type() == ProjectExplorer::ToolChain::MinGW) {
return ProjectExplorer::Constants::BUILD_PARSER_GCC;
} else if (m_toolChain->type() == ProjectExplorer::ToolChain::MSVC
|| m_toolChain->type() == ProjectExplorer::ToolChain::WINCE) {
return ProjectExplorer::Constants::BUILD_PARSER_MSVC;
}
return QString::null;
}
QStringList CMakeProject::targets() const QStringList CMakeProject::targets() const
{ {
QStringList results; QStringList results;

View File

@@ -105,6 +105,7 @@ public:
MakeStep *makeStep() const; MakeStep *makeStep() const;
CMakeStep *cmakeStep() const; CMakeStep *cmakeStep() const;
QStringList targets() const; QStringList targets() const;
QString buildParser(const QString &buildConfiguration) const;
private: private:
void parseCMakeLists(); void parseCMakeLists();

View File

@@ -34,6 +34,7 @@
#include "makestep.h" #include "makestep.h"
#include "cmakeprojectconstants.h" #include "cmakeprojectconstants.h"
#include "cmakeproject.h" #include "cmakeproject.h"
#include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <QtGui/QFormLayout> #include <QtGui/QFormLayout>
@@ -42,6 +43,11 @@
#include <QtGui/QLineEdit> #include <QtGui/QLineEdit>
#include <QtGui/QListWidget> #include <QtGui/QListWidget>
namespace {
bool debug = false;
}
using namespace CMakeProjectManager; using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal; using namespace CMakeProjectManager::Internal;
@@ -52,10 +58,42 @@ MakeStep::MakeStep(CMakeProject *pro)
MakeStep::~MakeStep() MakeStep::~MakeStep()
{ {
delete m_buildParser;
m_buildParser = 0;
} }
bool MakeStep::init(const QString &buildConfiguration) bool MakeStep::init(const QString &buildConfiguration)
{ {
// TODO figure out the correct build parser
delete m_buildParser;
m_buildParser = 0;
QString buildParser = m_pro->buildParser(buildConfiguration);
QList<ProjectExplorer::IBuildParserFactory *> buildParserFactories =
ExtensionSystem::PluginManager::instance()->getObjects<ProjectExplorer::IBuildParserFactory>();
foreach (ProjectExplorer::IBuildParserFactory * factory, buildParserFactories)
if (factory->canCreate(buildParser)) {
m_buildParser = factory->create(buildParser);
break;
}
if (m_buildParser) {
connect(m_buildParser, SIGNAL(addToOutputWindow(const QString &)),
this, SIGNAL(addToOutputWindow(const QString &)),
Qt::DirectConnection);
connect(m_buildParser, SIGNAL(addToTaskWindow(const QString &, int, int, const QString &)),
this, SLOT(slotAddToTaskWindow(const QString &, int, int, const QString &)),
Qt::DirectConnection);
connect(m_buildParser, SIGNAL(enterDirectory(const QString &)),
this, SLOT(addDirectory(const QString &)),
Qt::DirectConnection);
connect(m_buildParser, SIGNAL(leaveDirectory(const QString &)),
this, SLOT(removeDirectory(const QString &)),
Qt::DirectConnection);
}
m_openDirectories.clear();
addDirectory(m_pro->buildDirectory(buildConfiguration));
setEnabled(buildConfiguration, true); setEnabled(buildConfiguration, true);
setWorkingDirectory(buildConfiguration, m_pro->buildDirectory(buildConfiguration)); setWorkingDirectory(buildConfiguration, m_pro->buildDirectory(buildConfiguration));
setCommand(buildConfiguration, "make"); // TODO give full path here? setCommand(buildConfiguration, "make"); // TODO give full path here?
@@ -89,6 +127,79 @@ bool MakeStep::immutable() const
return true; return true;
} }
void MakeStep::stdOut(const QString &line)
{
if (m_buildParser)
m_buildParser->stdOutput(line);
AbstractProcessStep::stdOut(line);
}
void MakeStep::stdError(const QString &line)
{
if (m_buildParser)
m_buildParser->stdError(line);
AbstractProcessStep::stdError(line);
}
void MakeStep::slotAddToTaskWindow(const QString & fn, int type, int linenumber, const QString & description)
{
QString filePath = fn;
if (!filePath.isEmpty() && !QDir::isAbsolutePath(filePath)) {
// We have no save way to decide which file in which subfolder
// is meant. Therefore we apply following heuristics:
// 1. Search for unique file in directories currently indicated as open by GNU make
// (Enter directory xxx, Leave directory xxx...) + current directory
// 3. Check if file is unique in whole project
// 4. Otherwise give up
filePath = filePath.trimmed();
QList<QFileInfo> possibleFiles;
foreach (const QString &dir, m_openDirectories) {
QFileInfo candidate(dir + QLatin1Char('/') + filePath);
if (debug)
qDebug() << "Checking path " << candidate.filePath();
if (candidate.exists()
&& !possibleFiles.contains(candidate)) {
if (debug)
qDebug() << candidate.filePath() << "exists!";
possibleFiles << candidate;
}
}
if (possibleFiles.count() == 0) {
if (debug)
qDebug() << "No success. Trying all files in project ...";
QString fileName = QFileInfo(filePath).fileName();
foreach (const QString &file, project()->files(ProjectExplorer::Project::AllFiles)) {
QFileInfo candidate(file);
if (candidate.fileName() == fileName) {
if (debug)
qDebug() << "Found " << file;
possibleFiles << candidate;
}
}
}
if (possibleFiles.count() == 1)
filePath = possibleFiles.first().filePath();
else
qWarning() << "Could not find absolute location of file " << filePath;
}
emit addToTaskWindow(filePath, type, linenumber, description);
}
void MakeStep::addDirectory(const QString &dir)
{
if (!m_openDirectories.contains(dir))
m_openDirectories.insert(dir);
}
void MakeStep::removeDirectory(const QString &dir)
{
if (m_openDirectories.contains(dir))
m_openDirectories.remove(dir);
}
CMakeProject *MakeStep::project() const CMakeProject *MakeStep::project() const
{ {
return m_pro; return m_pro;
@@ -154,7 +265,6 @@ void MakeBuildStepConfigWidget::init(const QString &buildConfiguration)
} }
// and connect again // and connect again
connect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*))); connect(m_targetsList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
} }
// //

View File

@@ -64,8 +64,17 @@ public:
CMakeProject *project() const; CMakeProject *project() const;
bool buildsTarget(const QString &buildConfiguration, const QString &target) const; bool buildsTarget(const QString &buildConfiguration, const QString &target) const;
void setBuildTarget(const QString &buildConfiguration, const QString &target, bool on); void setBuildTarget(const QString &buildConfiguration, const QString &target, bool on);
private slots:
void slotAddToTaskWindow(const QString & fn, int type, int linenumber, const QString & description);
void addDirectory(const QString &dir);
void removeDirectory(const QString &dir);
protected:
virtual void stdOut(const QString &line);
virtual void stdError(const QString &line);
private: private:
CMakeProject *m_pro; CMakeProject *m_pro;
ProjectExplorer::BuildParserInterface *m_buildParser;
QSet<QString> m_openDirectories;
}; };
class MakeBuildStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget class MakeBuildStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget

View File

@@ -475,10 +475,12 @@ void EditorManager::setCurrentEditor(IEditor *editor, bool ignoreNavigationHisto
setCurrentView(0); setCurrentView(0);
if (m_d->m_currentEditor == editor) if (m_d->m_currentEditor == editor)
return; return;
if (m_d->m_currentEditor)
updateCurrentPositionInNavigationHistory();
m_d->m_currentEditor = editor; m_d->m_currentEditor = editor;
if (editor) { if (editor) {
bool addToHistory = (!ignoreNavigationHistory && editor != currentEditor()); bool addToHistory = (!ignoreNavigationHistory);
if (addToHistory) if (addToHistory)
addCurrentPositionToNavigationHistory(true); addCurrentPositionToNavigationHistory(true);
@@ -678,8 +680,6 @@ bool EditorManager::closeEditors(const QList<IEditor*> editorsToClose, bool askA
QList<EditorView*> currentViews; QList<EditorView*> currentViews;
EditorView *currentView = 0; EditorView *currentView = 0;
if (currentEditor())
addCurrentPositionToNavigationHistory(true);
// remove the editors // remove the editors
foreach (IEditor *editor, acceptedEditors) { foreach (IEditor *editor, acceptedEditors) {
@@ -812,11 +812,7 @@ void EditorManager::activateEditor(Core::Internal::EditorView *view, Core::IEdit
return; return;
} }
bool hasCurrent = (view->currentEditor() != 0);
editor = placeEditor(view, editor); editor = placeEditor(view, editor);
if (!(flags & NoActivate) || !hasCurrent)
view->setCurrentEditor(editor);
if (!(flags & NoActivate)) { if (!(flags & NoActivate)) {
setCurrentEditor(editor, (flags & IgnoreNavigationHistory)); setCurrentEditor(editor, (flags & IgnoreNavigationHistory));
@@ -1349,6 +1345,7 @@ void EditorManager::addCurrentPositionToNavigationHistory(bool compress)
return; return;
if (!editor->file()) if (!editor->file())
return; return;
QString fileName = editor->file()->fileName(); QString fileName = editor->file()->fileName();
QByteArray state = editor->saveState(); QByteArray state = editor->saveState();
// cut existing // cut existing
@@ -1383,8 +1380,18 @@ void EditorManager::addCurrentPositionToNavigationHistory(bool compress)
updateActions(); updateActions();
} }
void EditorManager::updateCurrentPositionInNavigationHistory()
{
if (!m_d->m_currentEditor
|| m_d->currentNavigationHistoryPosition < 0
|| m_d->m_navigationHistory.at(m_d->currentNavigationHistoryPosition)->editor != m_d->m_currentEditor)
return;
m_d->m_navigationHistory.at(m_d->currentNavigationHistoryPosition)->state = m_d->m_currentEditor->saveState();
}
void EditorManager::goBackInNavigationHistory() void EditorManager::goBackInNavigationHistory()
{ {
updateCurrentPositionInNavigationHistory();
while (m_d->currentNavigationHistoryPosition > 0) { while (m_d->currentNavigationHistoryPosition > 0) {
--m_d->currentNavigationHistoryPosition; --m_d->currentNavigationHistoryPosition;
EditorManagerPrivate::EditLocation *location = m_d->m_navigationHistory.at(m_d->currentNavigationHistoryPosition); EditorManagerPrivate::EditLocation *location = m_d->m_navigationHistory.at(m_d->currentNavigationHistoryPosition);
@@ -1408,6 +1415,7 @@ void EditorManager::goBackInNavigationHistory()
void EditorManager::goForwardInNavigationHistory() void EditorManager::goForwardInNavigationHistory()
{ {
updateCurrentPositionInNavigationHistory();
if (m_d->currentNavigationHistoryPosition >= m_d->m_navigationHistory.size()-1) if (m_d->currentNavigationHistoryPosition >= m_d->m_navigationHistory.size()-1)
return; return;
++m_d->currentNavigationHistoryPosition; ++m_d->currentNavigationHistoryPosition;

View File

@@ -229,6 +229,8 @@ private:
void emptyView(Core::Internal::EditorView *view); void emptyView(Core::Internal::EditorView *view);
IEditor *pickUnusedEditor() const; IEditor *pickUnusedEditor() const;
void updateCurrentPositionInNavigationHistory();
static EditorManager *m_instance; static EditorManager *m_instance;
EditorManagerPrivate *m_d; EditorManagerPrivate *m_d;

View File

@@ -329,9 +329,11 @@ EditorView::~EditorView()
void EditorView::addEditor(IEditor *editor) void EditorView::addEditor(IEditor *editor)
{ {
if (m_container->indexOf(editor->widget()) != -1) if (m_editors.contains(editor))
return; return;
m_editors.append(editor);
m_container->addWidget(editor->widget()); m_container->addWidget(editor->widget());
m_widgetEditorMap.insert(editor->widget(), editor); m_widgetEditorMap.insert(editor->widget(), editor);
@@ -348,7 +350,7 @@ void EditorView::addEditor(IEditor *editor)
bool EditorView::hasEditor(IEditor *editor) const bool EditorView::hasEditor(IEditor *editor) const
{ {
return (m_container->indexOf(editor->widget()) != -1); return m_editors.contains(editor);
} }
void EditorView::closeView() void EditorView::closeView()
@@ -360,26 +362,30 @@ void EditorView::closeView()
void EditorView::removeEditor(IEditor *editor) void EditorView::removeEditor(IEditor *editor)
{ {
QTC_ASSERT(editor, return); QTC_ASSERT(editor, return);
if (!m_editors.contains(editor))
return;
const int index = m_container->indexOf(editor->widget()); const int index = m_container->indexOf(editor->widget());
QTC_ASSERT((index != -1), return);
bool wasCurrent = (index == m_container->currentIndex()); bool wasCurrent = (index == m_container->currentIndex());
if (index != -1) { m_editors.removeAll(editor);
m_container->removeWidget(editor->widget());
m_widgetEditorMap.remove(editor->widget()); m_container->removeWidget(editor->widget());
editor->widget()->setParent(0); m_widgetEditorMap.remove(editor->widget());
disconnect(editor, SIGNAL(changed()), this, SLOT(updateEditorStatus())); editor->widget()->setParent(0);
QToolBar *toolBar = editor->toolBar(); disconnect(editor, SIGNAL(changed()), this, SLOT(updateEditorStatus()));
if (toolBar != 0) { QToolBar *toolBar = editor->toolBar();
if (m_activeToolBar == toolBar) { if (toolBar != 0) {
m_activeToolBar = m_defaultToolBar; if (m_activeToolBar == toolBar) {
m_activeToolBar->setVisible(true); m_activeToolBar = m_defaultToolBar;
} m_activeToolBar->setVisible(true);
m_toolBar->layout()->removeWidget(toolBar);
toolBar->setVisible(false);
toolBar->setParent(0);
} }
m_toolBar->layout()->removeWidget(toolBar);
toolBar->setVisible(false);
toolBar->setParent(0);
} }
if (wasCurrent) if (wasCurrent && m_editors.count())
setCurrentEditor(currentEditor()); setCurrentEditor(m_editors.last());
} }
IEditor *EditorView::currentEditor() const IEditor *EditorView::currentEditor() const
@@ -394,6 +400,8 @@ void EditorView::setCurrentEditor(IEditor *editor)
if (!editor || m_container->count() <= 0 if (!editor || m_container->count() <= 0
|| m_container->indexOf(editor->widget()) == -1) || m_container->indexOf(editor->widget()) == -1)
return; return;
m_editors.removeAll(editor);
m_editors.append(editor);
const int idx = m_container->indexOf(editor->widget()); const int idx = m_container->indexOf(editor->widget());
QTC_ASSERT(idx >= 0, return); QTC_ASSERT(idx >= 0, return);

View File

@@ -144,6 +144,7 @@ private:
QToolButton *m_infoWidgetButton; QToolButton *m_infoWidgetButton;
IEditor *m_editorForInfoWidget; IEditor *m_editorForInfoWidget;
QSortFilterProxyModel m_proxyModel; QSortFilterProxyModel m_proxyModel;
QList<IEditor *>m_editors;
QMap<QWidget *, IEditor *> m_widgetEditorMap; QMap<QWidget *, IEditor *> m_widgetEditorMap;
}; };

View File

@@ -38,9 +38,13 @@ namespace Git {
namespace Constants { namespace Constants {
const char * const GIT_COMMAND_LOG_EDITOR_KIND = "Git Command Log Editor"; const char * const GIT_COMMAND_LOG_EDITOR_KIND = "Git Command Log Editor";
const char * const C_GIT_COMMAND_LOG_EDITOR = "Git Command Log Editor";
const char * const GIT_LOG_EDITOR_KIND = "Git File Log Editor"; const char * const GIT_LOG_EDITOR_KIND = "Git File Log Editor";
const char * const C_GIT_LOG_EDITOR = "Git File Log Editor";
const char * const GIT_BLAME_EDITOR_KIND = "Git Annotation Editor"; const char * const GIT_BLAME_EDITOR_KIND = "Git Annotation Editor";
const char * const C_GIT_BLAME_EDITOR = "Git Annotation Editor";
const char * const GIT_DIFF_EDITOR_KIND = "Git Diff Editor"; const char * const GIT_DIFF_EDITOR_KIND = "Git Diff Editor";
const char * const C_GIT_DIFF_EDITOR = "Git Diff Editor";
const char * const C_GITSUBMITEDITOR = "Git Submit Editor"; const char * const C_GITSUBMITEDITOR = "Git Submit Editor";
const char * const GITSUBMITEDITOR_KIND = "Git Submit Editor"; const char * const GITSUBMITEDITOR_KIND = "Git Submit Editor";

View File

@@ -73,22 +73,22 @@ static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{ {
VCSBase::RegularCommandOutput, VCSBase::RegularCommandOutput,
Git::Constants::GIT_COMMAND_LOG_EDITOR_KIND, Git::Constants::GIT_COMMAND_LOG_EDITOR_KIND,
Core::Constants::C_GLOBAL, Git::Constants::C_GIT_COMMAND_LOG_EDITOR,
"application/vnd.nokia.text.scs_git_commandlog", "application/vnd.nokia.text.scs_git_commandlog",
"gitlog"}, "gitlog"},
{ VCSBase::LogOutput, { VCSBase::LogOutput,
Git::Constants::GIT_LOG_EDITOR_KIND, Git::Constants::GIT_LOG_EDITOR_KIND,
Core::Constants::C_GLOBAL, Git::Constants::C_GIT_LOG_EDITOR,
"application/vnd.nokia.text.scs_git_filelog", "application/vnd.nokia.text.scs_git_filelog",
"gitfilelog"}, "gitfilelog"},
{ VCSBase::AnnotateOutput, { VCSBase::AnnotateOutput,
Git::Constants::GIT_BLAME_EDITOR_KIND, Git::Constants::GIT_BLAME_EDITOR_KIND,
Core::Constants::C_GLOBAL, Git::Constants::C_GIT_BLAME_EDITOR,
"application/vnd.nokia.text.scs_git_annotation", "application/vnd.nokia.text.scs_git_annotation",
"gitsannotate"}, "gitsannotate"},
{ VCSBase::DiffOutput, { VCSBase::DiffOutput,
Git::Constants::GIT_DIFF_EDITOR_KIND, Git::Constants::GIT_DIFF_EDITOR_KIND,
Core::Constants::C_GLOBAL, Git::Constants::C_GIT_DIFF_EDITOR,
"text/x-patch","diff"} "text/x-patch","diff"}
}; };

View File

@@ -33,11 +33,11 @@
#include "buildparserfactory.h" #include "buildparserfactory.h"
#include "qt4projectmanagerconstants.h" #include "projectexplorerconstants.h"
#include "gccparser.h" #include "gccparser.h"
#include "msvcparser.h" #include "msvcparser.h"
using namespace Qt4ProjectManager::Internal; using namespace ProjectExplorer::Internal;
GccParserFactory::~GccParserFactory() GccParserFactory::~GccParserFactory()
{ {

View File

@@ -36,14 +36,14 @@
#include <projectexplorer/buildparserinterface.h> #include <projectexplorer/buildparserinterface.h>
namespace Qt4ProjectManager { namespace ProjectExplorer {
namespace Internal { namespace Internal {
class GccParserFactory : public ProjectExplorer::IBuildParserFactory class GccParserFactory : public ProjectExplorer::IBuildParserFactory
{ {
Q_OBJECT Q_OBJECT
public: public:
GccParserFactory() {}; GccParserFactory() {}
virtual ~GccParserFactory(); virtual ~GccParserFactory();
virtual bool canCreate(const QString & name) const; virtual bool canCreate(const QString & name) const;
virtual ProjectExplorer::BuildParserInterface * create(const QString & name) const; virtual ProjectExplorer::BuildParserInterface * create(const QString & name) const;
@@ -53,13 +53,13 @@ class MsvcParserFactory : public ProjectExplorer::IBuildParserFactory
{ {
Q_OBJECT Q_OBJECT
public: public:
MsvcParserFactory() {}; MsvcParserFactory() {}
virtual ~MsvcParserFactory(); virtual ~MsvcParserFactory();
virtual bool canCreate(const QString & name) const; virtual bool canCreate(const QString & name) const;
virtual ProjectExplorer::BuildParserInterface * create(const QString & name) const; virtual ProjectExplorer::BuildParserInterface * create(const QString & name) const;
}; };
} // namespace Internal } // namespace Internal
} // namespace Qt4ProjectManager } // namespace ProjectExplorer
#endif // BUILDPARSERFACTORY_H #endif // BUILDPARSERFACTORY_H

View File

@@ -32,11 +32,11 @@
***************************************************************************/ ***************************************************************************/
#include "gccparser.h" #include "gccparser.h"
#include "qt4projectmanagerconstants.h" #include "projectexplorerconstants.h"
#include <QDebug> #include <QDebug>
using namespace Qt4ProjectManager; using namespace ProjectExplorer;
GccParser::GccParser() GccParser::GccParser()
{ {
@@ -56,7 +56,7 @@ GccParser::GccParser()
QString GccParser::name() const QString GccParser::name() const
{ {
return QLatin1String(Qt4ProjectManager::Constants::BUILD_PARSER_GCC); return QLatin1String(ProjectExplorer::Constants::BUILD_PARSER_GCC);
} }
void GccParser::stdOutput(const QString & line) void GccParser::stdOutput(const QString & line)

View File

@@ -34,11 +34,11 @@
#ifndef GCCPARSER_H #ifndef GCCPARSER_H
#define GCCPARSER_H #define GCCPARSER_H
#include <projectexplorer/buildparserinterface.h> #include "buildparserinterface.h"
#include <QtCore/QRegExp> #include <QtCore/QRegExp>
namespace Qt4ProjectManager { namespace ProjectExplorer {
class GccParser : public ProjectExplorer::BuildParserInterface class GccParser : public ProjectExplorer::BuildParserInterface
{ {

View File

@@ -32,11 +32,11 @@
***************************************************************************/ ***************************************************************************/
#include "msvcparser.h" #include "msvcparser.h"
#include "qt4projectmanagerconstants.h" #include "projectexplorerconstants.h"
#include <QtCore/QStringList> #include <QtCore/QStringList>
using namespace Qt4ProjectManager; using namespace ProjectExplorer;
MsvcParser::MsvcParser() MsvcParser::MsvcParser()
{ {
@@ -48,7 +48,7 @@ MsvcParser::MsvcParser()
QString MsvcParser::name() const QString MsvcParser::name() const
{ {
return QLatin1String(Qt4ProjectManager::Constants::BUILD_PARSER_MSVC); return QLatin1String(ProjectExplorer::Constants::BUILD_PARSER_MSVC);
} }
void MsvcParser::stdError(const QString & line) void MsvcParser::stdError(const QString & line)

View File

@@ -34,11 +34,11 @@
#ifndef MSVCPARSER_H #ifndef MSVCPARSER_H
#define MSVCPARSER_H #define MSVCPARSER_H
#include <projectexplorer/buildparserinterface.h> #include "buildparserinterface.h"
#include <QtCore/QRegExp> #include <QtCore/QRegExp>
namespace Qt4ProjectManager { namespace ProjectExplorer {
class MsvcParser : public ProjectExplorer::BuildParserInterface class MsvcParser : public ProjectExplorer::BuildParserInterface
{ {

View File

@@ -59,6 +59,7 @@
#include "scriptwrappers.h" #include "scriptwrappers.h"
#include "session.h" #include "session.h"
#include "sessiondialog.h" #include "sessiondialog.h"
#include "buildparserfactory.h"
#include <coreplugin/basemode.h> #include <coreplugin/basemode.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
@@ -233,6 +234,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
addAutoReleasedObject(new ProjectFileWizardExtension); addAutoReleasedObject(new ProjectFileWizardExtension);
// Build parsers
addAutoReleasedObject(new GccParserFactory);
addAutoReleasedObject(new MsvcParserFactory);
// context menus // context menus
Core::ActionContainer *msessionContextMenu = Core::ActionContainer *msessionContextMenu =
am->createMenu(Constants::M_SESSIONCONTEXT); am->createMenu(Constants::M_SESSIONCONTEXT);

View File

@@ -54,7 +54,10 @@ HEADERS += projectexplorer.h \
projectmodels.h \ projectmodels.h \
currentprojectfind.h \ currentprojectfind.h \
toolchain.h \ toolchain.h \
cesdkhandler.h cesdkhandler.h\
buildparserfactory.h\
gccparser.h\
msvcparser.h
SOURCES += projectexplorer.cpp \ SOURCES += projectexplorer.cpp \
projectwindow.cpp \ projectwindow.cpp \
buildmanager.cpp \ buildmanager.cpp \
@@ -97,7 +100,10 @@ SOURCES += projectexplorer.cpp \
projectmodels.cpp \ projectmodels.cpp \
currentprojectfind.cpp \ currentprojectfind.cpp \
toolchain.cpp \ toolchain.cpp \
cesdkhandler.cpp cesdkhandler.cpp\
buildparserfactory.cpp \
gccparser.cpp\
msvcparser.cpp
FORMS += dependenciespanel.ui \ FORMS += dependenciespanel.ui \
buildsettingspropertiespage.ui \ buildsettingspropertiespage.ui \
processstep.ui \ processstep.ui \

View File

@@ -176,6 +176,11 @@ const char * const CPP_HEADER_MIMETYPE = "text/x-c++hdr";
const char * const FORM_MIMETYPE = "application/x-designer"; const char * const FORM_MIMETYPE = "application/x-designer";
const char * const RESOURCE_MIMETYPE = "application/vnd.nokia.xml.qt.resource"; const char * const RESOURCE_MIMETYPE = "application/vnd.nokia.xml.qt.resource";
// build parsers
const char * const BUILD_PARSER_MSVC = "BuildParser.MSVC";
const char * const BUILD_PARSER_GCC = "BuildParser.Gcc";
} // namespace Constants } // namespace Constants
} // namespace ProjectExplorer } // namespace ProjectExplorer

View File

@@ -36,6 +36,8 @@
#include "qt4project.h" #include "qt4project.h"
#include "qt4projectmanagerconstants.h" #include "qt4projectmanagerconstants.h"
#include <projectexplorer/projectexplorerconstants.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -71,9 +73,9 @@ ProjectExplorer::BuildParserInterface *MakeStep::buildParser(const QtVersion * c
QString buildParser; QString buildParser;
ProjectExplorer::ToolChain::ToolChainType type = version->toolchainType(); ProjectExplorer::ToolChain::ToolChainType type = version->toolchainType();
if ( type == ProjectExplorer::ToolChain::MSVC || type == ProjectExplorer::ToolChain::WINCE) if ( type == ProjectExplorer::ToolChain::MSVC || type == ProjectExplorer::ToolChain::WINCE)
buildParser = Constants::BUILD_PARSER_MSVC; buildParser = ProjectExplorer::Constants::BUILD_PARSER_MSVC;
else else
buildParser = Constants::BUILD_PARSER_GCC; buildParser = ProjectExplorer::Constants::BUILD_PARSER_GCC;
QList<IBuildParserFactory *> buildParserFactories = QList<IBuildParserFactory *> buildParserFactories =
ExtensionSystem::PluginManager::instance()->getObjects<ProjectExplorer::IBuildParserFactory>(); ExtensionSystem::PluginManager::instance()->getObjects<ProjectExplorer::IBuildParserFactory>();

View File

@@ -28,9 +28,6 @@ HEADERS = qt4projectmanagerplugin.h \
makestep.h \ makestep.h \
qmakestep.h \ qmakestep.h \
qmakebuildstepfactory.h \ qmakebuildstepfactory.h \
gccparser.h \
msvcparser.h \
buildparserfactory.h \
deployhelper.h \ deployhelper.h \
embeddedpropertiespage.h \ embeddedpropertiespage.h \
qt4runconfiguration.h \ qt4runconfiguration.h \
@@ -63,9 +60,6 @@ SOURCES = qt4projectmanagerplugin.cpp \
makestep.cpp \ makestep.cpp \
qmakestep.cpp \ qmakestep.cpp \
qmakebuildstepfactory.cpp \ qmakebuildstepfactory.cpp \
gccparser.cpp \
msvcparser.cpp \
buildparserfactory.cpp \
deployhelper.cpp \ deployhelper.cpp \
embeddedpropertiespage.cpp \ embeddedpropertiespage.cpp \
qt4runconfiguration.cpp \ qt4runconfiguration.cpp \

View File

@@ -79,10 +79,6 @@ const char * const GDBMACROSBUILDSTEP = "trolltech.qt4projectmanager.gdbmaros";
const char * const QT4RUNSTEP = "trolltech.qt4projectmanager.qt4runstep"; const char * const QT4RUNSTEP = "trolltech.qt4projectmanager.qt4runstep";
const char * const DEPLOYHELPERRUNSTEP = "trolltech.qt4projectmanager.deployhelperrunstep"; const char * const DEPLOYHELPERRUNSTEP = "trolltech.qt4projectmanager.deployhelperrunstep";
// build parsers
const char * const BUILD_PARSER_MSVC = "BuildParser.MSVC";
const char * const BUILD_PARSER_GCC = "BuildParser.Gcc";
// views // views
const char * const VIEW_DETAILED = "Qt4.View.Detailed"; const char * const VIEW_DETAILED = "Qt4.View.Detailed";
const char * const VIEW_PROFILESONLY = "Qt4.View.ProjectHierarchy"; const char * const VIEW_PROFILESONLY = "Qt4.View.ProjectHierarchy";

View File

@@ -41,7 +41,6 @@
#include "qt4projectmanagerconstants.h" #include "qt4projectmanagerconstants.h"
#include "qt4project.h" #include "qt4project.h"
#include "qmakebuildstepfactory.h" #include "qmakebuildstepfactory.h"
#include "buildparserfactory.h"
#include "qtversionmanager.h" #include "qtversionmanager.h"
#include "embeddedpropertiespage.h" #include "embeddedpropertiespage.h"
#include "qt4runconfiguration.h" #include "qt4runconfiguration.h"
@@ -133,9 +132,6 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
addAutoReleasedObject(new MakeBuildStepFactory); addAutoReleasedObject(new MakeBuildStepFactory);
addAutoReleasedObject(new GdbMacrosBuildStepFactory); addAutoReleasedObject(new GdbMacrosBuildStepFactory);
addAutoReleasedObject(new GccParserFactory);
addAutoReleasedObject(new MsvcParserFactory);
m_qtVersionManager = new QtVersionManager; m_qtVersionManager = new QtVersionManager;
addObject(m_qtVersionManager); addObject(m_qtVersionManager);

View File

@@ -70,13 +70,6 @@ void QtScriptEditorActionHandler::createActions()
} }
void QtScriptEditorActionHandler::updateActions(UpdateMode um)
{
TextEditor::TextEditorActionHandler::updateActions(um);
if (m_runAction)
m_runAction->setEnabled(um != NoEditor);
}
void QtScriptEditorActionHandler::run() void QtScriptEditorActionHandler::run()
{ {
typedef Core::ScriptManager::Stack Stack; typedef Core::ScriptManager::Stack Stack;

View File

@@ -48,7 +48,6 @@ public:
private: private:
virtual void createActions(); virtual void createActions();
virtual void updateActions(UpdateMode um);
private slots: private slots:
void run(); void run();

View File

@@ -103,23 +103,23 @@ const char * const SubversionPlugin::DESCRIBE = "Subversion.Describe";
static const VCSBase::VCSBaseEditorParameters editorParameters[] = { static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{ {
VCSBase::RegularCommandOutput, VCSBase::RegularCommandOutput,
"Subversion Command Log Editor", "Subversion Command Log Editor", // kind
Core::Constants::C_GLOBAL, "Subversion Command Log Editor", // context
"application/vnd.nokia.text.scs_svn_commandlog", "application/vnd.nokia.text.scs_svn_commandlog",
"scslog"}, "scslog"},
{ VCSBase::LogOutput, { VCSBase::LogOutput,
"Subversion File Log Editor", "Subversion File Log Editor", // kind
Core::Constants::C_GLOBAL, "Subversion File Log Editor", // context
"application/vnd.nokia.text.scs_svn_filelog", "application/vnd.nokia.text.scs_svn_filelog",
"scsfilelog"}, "scsfilelog"},
{ VCSBase::AnnotateOutput, { VCSBase::AnnotateOutput,
"Subversion Annotation Editor", "Subversion Annotation Editor", // kind
Core::Constants::C_GLOBAL, "Subversion Annotation Editor", // context
"application/vnd.nokia.text.scs_svn_annotation", "application/vnd.nokia.text.scs_svn_annotation",
"scsannotate"}, "scsannotate"},
{ VCSBase::DiffOutput, { VCSBase::DiffOutput,
"Subversion Diff Editor", "Subversion Diff Editor", // kind
Core::Constants::C_GLOBAL, "Subversion Diff Editor", // context
"text/x-patch","diff"} "text/x-patch","diff"}
}; };

View File

@@ -18,7 +18,7 @@
** **
** Alternatively, this file may be used under the terms of the GNU General ** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software ** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging ** Foundation and appearing` in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU ** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met: ** General Public Licensing requirements will be met:
** **
@@ -91,8 +91,8 @@ TextEditorActionHandler::TextEditorActionHandler(const QString &context,
m_contextId << Core::UniqueIDManager::instance()->uniqueIdentifier(context); m_contextId << Core::UniqueIDManager::instance()->uniqueIdentifier(context);
connect(Core::ICore::instance(), SIGNAL(contextAboutToChange(Core::IContext *)), connect(Core::ICore::instance()->editorManager(), SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(updateCurrentEditor(Core::IContext *))); this, SLOT(updateCurrentEditor(Core::IEditor *)));
} }
void TextEditorActionHandler::setupActions(BaseTextEditor *editor) void TextEditorActionHandler::setupActions(BaseTextEditor *editor)
@@ -282,49 +282,31 @@ QAction *TextEditorActionHandler::registerNewAction(const QString &id,
TextEditorActionHandler::UpdateMode TextEditorActionHandler::updateMode() const TextEditorActionHandler::UpdateMode TextEditorActionHandler::updateMode() const
{ {
if (!m_currentEditor) Q_ASSERT(m_currentEditor != 0);
return NoEditor;
return m_currentEditor->file()->isReadOnly() ? ReadOnlyMode : WriteMode; return m_currentEditor->file()->isReadOnly() ? ReadOnlyMode : WriteMode;
} }
void TextEditorActionHandler::updateActions() void TextEditorActionHandler::updateActions()
{ {
if (!m_currentEditor || !m_initialized)
return;
updateActions(updateMode()); updateActions(updateMode());
} }
void TextEditorActionHandler::updateActions(UpdateMode um) void TextEditorActionHandler::updateActions(UpdateMode um)
{ {
if (!m_initialized) m_pasteAction->setEnabled(um != ReadOnlyMode);
return; m_formatAction->setEnabled((m_optionalActions & Format) && um != ReadOnlyMode);
m_pasteAction->setEnabled(um != NoEditor); m_unCommentSelectionAction->setEnabled((m_optionalActions & UnCommentSelection) && um != ReadOnlyMode);
m_selectAllAction->setEnabled(um != NoEditor); m_moveLineUpAction->setEnabled(um != ReadOnlyMode);
m_gotoAction->setEnabled(um != NoEditor); m_moveLineDownAction->setEnabled(um != ReadOnlyMode);
m_selectEncodingAction->setEnabled(um != NoEditor);
m_printAction->setEnabled(um != NoEditor);
m_formatAction->setEnabled((m_optionalActions & Format) && um != NoEditor);
m_unCommentSelectionAction->setEnabled((m_optionalActions & UnCommentSelection) && um != NoEditor);
m_collapseAction->setEnabled(um != NoEditor);
m_expandAction->setEnabled(um != NoEditor);
m_unCollapseAllAction->setEnabled((m_optionalActions & UnCollapseAll) && um != NoEditor);
m_decreaseFontSizeAction->setEnabled(um != NoEditor);
m_increaseFontSizeAction->setEnabled(um != NoEditor);
m_gotoBlockStartAction->setEnabled(um != NoEditor);
m_gotoBlockStartWithSelectionAction->setEnabled(um != NoEditor);
m_gotoBlockEndAction->setEnabled(um != NoEditor);
m_gotoBlockEndWithSelectionAction->setEnabled(um != NoEditor);
m_selectBlockUpAction->setEnabled(um != NoEditor);
m_selectBlockDownAction->setEnabled(um != NoEditor);
m_moveLineUpAction->setEnabled(um != NoEditor);
m_moveLineDownAction->setEnabled(um != NoEditor);
m_visualizeWhitespaceAction->setEnabled(um != NoEditor); m_formatAction->setEnabled((m_optionalActions & Format));
if (m_currentEditor) m_unCommentSelectionAction->setEnabled((m_optionalActions & UnCommentSelection));
m_visualizeWhitespaceAction->setChecked(m_currentEditor->displaySettings().m_visualizeWhitespace); m_unCollapseAllAction->setEnabled((m_optionalActions & UnCollapseAll));
m_cleanWhitespaceAction->setEnabled(um != NoEditor); m_visualizeWhitespaceAction->setChecked(m_currentEditor->displaySettings().m_visualizeWhitespace);
if (m_textWrappingAction) { if (m_textWrappingAction) {
m_textWrappingAction->setEnabled(um != NoEditor); m_textWrappingAction->setChecked(m_currentEditor->displaySettings().m_textWrapping);
if (m_currentEditor)
m_textWrappingAction->setChecked(m_currentEditor->displaySettings().m_textWrapping);
} }
updateRedoAction(); updateRedoAction();
@@ -346,11 +328,12 @@ void TextEditorActionHandler::updateUndoAction()
void TextEditorActionHandler::updateCopyAction() void TextEditorActionHandler::updateCopyAction()
{ {
const bool hasCopyableText = m_currentEditor && m_currentEditor->textCursor().hasSelection(); const bool hasCopyableText = m_currentEditor && m_currentEditor->textCursor().hasSelection();
if (m_cutAction) if (m_cutAction)
m_cutAction->setEnabled(hasCopyableText && updateMode() == WriteMode); m_cutAction->setEnabled(hasCopyableText && updateMode() == WriteMode);
if (m_copyAction) if (m_copyAction) {
m_copyAction->setEnabled(hasCopyableText); m_copyAction->setEnabled(hasCopyableText);
}
} }
void TextEditorActionHandler::gotoAction() void TextEditorActionHandler::gotoAction()
@@ -422,37 +405,19 @@ FUNCTION(selectBlockDown)
FUNCTION(moveLineUp) FUNCTION(moveLineUp)
FUNCTION(moveLineDown) FUNCTION(moveLineDown)
void TextEditorActionHandler::updateCurrentEditor(Core::IContext *object) void TextEditorActionHandler::updateCurrentEditor(Core::IEditor *editor)
{ {
do { m_currentEditor = 0;
if (!object) {
if (!m_currentEditor)
return;
m_currentEditor = 0; if (!editor)
break; return;
}
BaseTextEditor *editor = qobject_cast<BaseTextEditor *>(object->widget());
if (!editor) {
if (!m_currentEditor)
return;
m_currentEditor = 0; BaseTextEditor *baseEditor = qobject_cast<BaseTextEditor *>(editor->widget());
break;
}
if (editor == m_currentEditor) if (baseEditor && baseEditor->actionHack() == this) {
return; m_currentEditor = baseEditor;
updateActions();
if (editor->actionHack() != this) { }
m_currentEditor = 0;
break;
}
m_currentEditor = editor;
} while (false);
updateActions();
} }

View File

@@ -78,7 +78,7 @@ protected:
QAction *registerNewAction(const QString &id, QObject *receiver, const char *slot, QAction *registerNewAction(const QString &id, QObject *receiver, const char *slot,
const QString &title = QString()); const QString &title = QString());
enum UpdateMode { NoEditor , ReadOnlyMode, WriteMode }; enum UpdateMode { ReadOnlyMode, WriteMode };
UpdateMode updateMode() const; UpdateMode updateMode() const;
virtual void createActions(); virtual void createActions();
@@ -114,7 +114,7 @@ private slots:
void selectBlockDown(); void selectBlockDown();
void moveLineUp(); void moveLineUp();
void moveLineDown(); void moveLineDown();
void updateCurrentEditor(Core::IContext *object); void updateCurrentEditor(Core::IEditor *editor);
private: private:
QAction *m_undoAction; QAction *m_undoAction;

View File

@@ -56,7 +56,7 @@ BaseVCSEditorFactoryPrivate::BaseVCSEditorFactoryPrivate(const VCSBaseEditorPara
m_type(t), m_type(t),
m_kind(QLatin1String(t->kind)), m_kind(QLatin1String(t->kind)),
m_mimeTypes(QStringList(QLatin1String(t->mimeType))), m_mimeTypes(QStringList(QLatin1String(t->mimeType))),
m_editorHandler(new TextEditor::TextEditorActionHandler(t->kind)) m_editorHandler(new TextEditor::TextEditorActionHandler(t->context))
{ {
} }