forked from qt-creator/qt-creator
Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta
This commit is contained in:
@@ -40,6 +40,7 @@ namespace Constants {
|
||||
const char * const PROJECTCONTEXT = "CMakeProject.ProjectContext";
|
||||
const char * const CMAKEMIMETYPE = "text/x-cmake"; // TOOD check that this is correct
|
||||
const char * const CMAKESTEP = "CMakeProjectManager.CMakeStep";
|
||||
const char * const MAKESTEP = "CMakeProjectManager.MakeStep";
|
||||
|
||||
|
||||
} // namespace Constants
|
||||
|
||||
@@ -7,10 +7,12 @@ HEADERS = cmakeproject.h \
|
||||
cmakeprojectmanager.h \
|
||||
cmakeprojectconstants.h \
|
||||
cmakeprojectnodes.h \
|
||||
cmakestep.h
|
||||
cmakestep.h \
|
||||
makestep.h
|
||||
SOURCES = cmakeproject.cpp \
|
||||
cmakeprojectplugin.cpp \
|
||||
cmakeprojectmanager.cpp \
|
||||
cmakeprojectnodes.cpp \
|
||||
cmakestep.cpp
|
||||
cmakestep.cpp \
|
||||
makestep.cpp
|
||||
RESOURCES += cmakeproject.qrc
|
||||
|
||||
@@ -1,3 +1,36 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** 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
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "cmakestep.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeproject.h"
|
||||
@@ -6,7 +39,7 @@ using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
|
||||
CMakeStep::CMakeStep(CMakeProject *pro)
|
||||
: BuildStep(pro), m_pro(pro)
|
||||
: AbstractProcessStep(pro), m_pro(pro)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -18,14 +51,17 @@ CMakeStep::~CMakeStep()
|
||||
|
||||
bool CMakeStep::init(const QString &buildConfiguration)
|
||||
{
|
||||
// TODO
|
||||
return true;
|
||||
setEnabled(buildConfiguration, true);
|
||||
setWorkingDirectory(buildConfiguration, m_pro->buildDirectory(buildConfiguration));
|
||||
setCommand(buildConfiguration, "cmake"); // TODO give full path here?
|
||||
setArguments(buildConfiguration, QStringList()); // TODO
|
||||
setEnvironment(buildConfiguration, m_pro->environment(buildConfiguration));
|
||||
return AbstractProcessStep::init(buildConfiguration);
|
||||
}
|
||||
|
||||
void CMakeStep::run(QFutureInterface<bool> &fi)
|
||||
{
|
||||
// TODO
|
||||
fi.reportResult(true);
|
||||
AbstractProcessStep::run(fi);
|
||||
}
|
||||
|
||||
QString CMakeStep::name()
|
||||
|
||||
@@ -1,7 +1,41 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** 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
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef CMAKESTEP_H
|
||||
#define CMAKESTEP_H
|
||||
|
||||
#include <projectexplorer/buildstep.h>
|
||||
#include <projectexplorer/abstractprocessstep.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
@@ -10,7 +44,7 @@ class CMakeProject;
|
||||
|
||||
class CMakeBuildStepConfigWidget;
|
||||
|
||||
class CMakeStep : public ProjectExplorer::BuildStep
|
||||
class CMakeStep : public ProjectExplorer::AbstractProcessStep
|
||||
{
|
||||
public:
|
||||
CMakeStep(CMakeProject *pro);
|
||||
|
||||
127
src/plugins/cmakeprojectmanager/makestep.cpp
Normal file
127
src/plugins/cmakeprojectmanager/makestep.cpp
Normal file
@@ -0,0 +1,127 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** 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
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "makestep.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeproject.h"
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
|
||||
MakeStep::MakeStep(CMakeProject *pro)
|
||||
: AbstractProcessStep(pro), m_pro(pro)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MakeStep::~MakeStep()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool MakeStep::init(const QString &buildConfiguration)
|
||||
{
|
||||
setEnabled(buildConfiguration, true);
|
||||
setWorkingDirectory(buildConfiguration, m_pro->buildDirectory(buildConfiguration));
|
||||
setCommand(buildConfiguration, "make"); // TODO give full path here?
|
||||
setArguments(buildConfiguration, QStringList()); // TODO
|
||||
setEnvironment(buildConfiguration, m_pro->environment(buildConfiguration));
|
||||
return AbstractProcessStep::init(buildConfiguration);
|
||||
}
|
||||
|
||||
void MakeStep::run(QFutureInterface<bool> &fi)
|
||||
{
|
||||
AbstractProcessStep::run(fi);
|
||||
}
|
||||
|
||||
QString MakeStep::name()
|
||||
{
|
||||
return "Make";
|
||||
}
|
||||
|
||||
QString MakeStep::displayName()
|
||||
{
|
||||
return Constants::CMAKESTEP;
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStepConfigWidget *MakeStep::createConfigWidget()
|
||||
{
|
||||
return new MakeBuildStepConfigWidget();
|
||||
}
|
||||
|
||||
bool MakeStep::immutable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// CMakeBuildStepConfigWidget
|
||||
//
|
||||
|
||||
QString MakeBuildStepConfigWidget::displayName() const
|
||||
{
|
||||
return "Make";
|
||||
}
|
||||
|
||||
void MakeBuildStepConfigWidget::init(const QString &buildConfiguration)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
//
|
||||
// MakeBuildStepFactory
|
||||
//
|
||||
|
||||
bool MakeBuildStepFactory::canCreate(const QString &name) const
|
||||
{
|
||||
return (Constants::MAKESTEP == name);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *MakeBuildStepFactory::create(ProjectExplorer::Project *project, const QString &name) const
|
||||
{
|
||||
Q_ASSERT(name == Constants::MAKESTEP);
|
||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||
Q_ASSERT(pro);
|
||||
return new MakeStep(pro);
|
||||
}
|
||||
|
||||
QStringList MakeBuildStepFactory::canCreateForProject(ProjectExplorer::Project *pro) const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QString MakeBuildStepFactory::displayNameForName(const QString &name) const
|
||||
{
|
||||
return "Make";
|
||||
}
|
||||
|
||||
@@ -31,52 +31,49 @@
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef INDEXWINDOW_H
|
||||
#define INDEXWINDOW_H
|
||||
#ifndef MAKESTEP_H
|
||||
#define MAKESTEP_H
|
||||
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QLineEdit>
|
||||
#include <projectexplorer/abstractprocessstep.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class QHelpIndexWidget;
|
||||
class QHelpEngine;
|
||||
class CMakeProject;
|
||||
|
||||
class IndexWindow : public QWidget
|
||||
class MakeStep : public ProjectExplorer::AbstractProcessStep
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
IndexWindow(QHelpEngine *helpEngine, QWidget *parent = 0);
|
||||
~IndexWindow();
|
||||
MakeStep(CMakeProject *pro);
|
||||
~MakeStep();
|
||||
virtual bool init(const QString &buildConfiguration);
|
||||
|
||||
void setSearchLineEditText(const QString &text);
|
||||
QString searchLineEditText() const
|
||||
{
|
||||
return m_searchLineEdit->text();
|
||||
}
|
||||
|
||||
signals:
|
||||
void linkActivated(const QUrl &link);
|
||||
void linksActivated(const QMap<QString, QUrl> &links,
|
||||
const QString &keyword);
|
||||
void escapePressed();
|
||||
|
||||
private slots:
|
||||
void filterIndices(const QString &filter);
|
||||
void enableSearchLineEdit();
|
||||
void disableSearchLineEdit();
|
||||
virtual void run(QFutureInterface<bool> &fi);
|
||||
|
||||
virtual QString name();
|
||||
virtual QString displayName();
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
private:
|
||||
bool eventFilter(QObject *obj, QEvent *e);
|
||||
void focusInEvent(QFocusEvent *e);
|
||||
|
||||
QLineEdit *m_searchLineEdit;
|
||||
QHelpIndexWidget *m_indexWidget;
|
||||
QHelpEngine *m_helpEngine;
|
||||
CMakeProject *m_pro;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
class MakeBuildStepConfigWidget :public ProjectExplorer::BuildStepConfigWidget
|
||||
{
|
||||
public:
|
||||
virtual QString displayName() const;
|
||||
virtual void init(const QString &buildConfiguration);
|
||||
};
|
||||
|
||||
#endif // INDEXWINDOW_H
|
||||
class MakeBuildStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
{
|
||||
virtual bool canCreate(const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, const QString &name) const;
|
||||
virtual QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
|
||||
virtual QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MAKESTEP_H
|
||||
@@ -60,7 +60,7 @@
|
||||
using namespace CppTools::Internal;
|
||||
|
||||
CppHoverHandler::CppHoverHandler(CppModelManager *manager, QObject *parent)
|
||||
: QObject(parent), m_manager(manager)
|
||||
: QObject(parent), m_manager(manager), m_helpEngineNeedsSetup(false)
|
||||
{
|
||||
QFileInfo fi(ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>()->settings()->fileName());
|
||||
m_helpEngine = new QHelpEngineCore(fi.absolutePath()
|
||||
@@ -68,6 +68,7 @@ CppHoverHandler::CppHoverHandler(CppModelManager *manager, QObject *parent)
|
||||
//m_helpEngine->setAutoSaveFilter(false);
|
||||
m_helpEngine->setupData();
|
||||
m_helpEngine->setCurrentFilter(tr("Unfiltered"));
|
||||
m_helpEngineNeedsSetup = m_helpEngine->registeredDocumentations().count() == 0;
|
||||
}
|
||||
|
||||
void CppHoverHandler::updateContextHelpId(TextEditor::ITextEditor *editor, int pos)
|
||||
@@ -234,6 +235,12 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
||||
}
|
||||
}
|
||||
|
||||
if (m_helpEngineNeedsSetup
|
||||
&& m_helpEngine->registeredDocumentations().count() > 0) {
|
||||
m_helpEngine->setupData();
|
||||
m_helpEngineNeedsSetup = false;
|
||||
}
|
||||
|
||||
if (!m_helpId.isEmpty() && !m_helpEngine->linksForIdentifier(m_helpId).isEmpty()) {
|
||||
m_toolTip = QString(QLatin1String("<table><tr><td valign=middle><nobr>%1</td>"
|
||||
"<td><img src=\":/cpptools/images/f1.svg\"></td></tr></table>")).arg(Qt::escape(m_toolTip));
|
||||
|
||||
@@ -68,6 +68,7 @@ private:
|
||||
QHelpEngineCore *m_helpEngine;
|
||||
QString m_helpId;
|
||||
QString m_toolTip;
|
||||
bool m_helpEngineNeedsSetup;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -253,6 +253,25 @@ protected:
|
||||
m_currentDoc->appendMacro(macroName, macroText);
|
||||
}
|
||||
|
||||
virtual void startExpandingMacro(unsigned offset,
|
||||
const rpp::Macro ¯o,
|
||||
const QByteArray &originalText)
|
||||
{
|
||||
if (! m_currentDoc)
|
||||
return;
|
||||
|
||||
//qDebug() << "start expanding:" << macro.name << "text:" << originalText;
|
||||
m_currentDoc->addMacroUse(offset, originalText.length());
|
||||
}
|
||||
|
||||
virtual void stopExpandingMacro(unsigned offset, const rpp::Macro ¯o)
|
||||
{
|
||||
if (! m_currentDoc)
|
||||
return;
|
||||
|
||||
//qDebug() << "stop expanding:" << macro.name;
|
||||
}
|
||||
|
||||
void mergeEnvironment(Document::Ptr doc)
|
||||
{
|
||||
QSet<QString> processed;
|
||||
@@ -595,6 +614,22 @@ void CppModelManager::onDocumentUpdated(Document::Ptr doc)
|
||||
|
||||
QList<QTextEdit::ExtraSelection> selections;
|
||||
|
||||
#ifdef QTCREATOR_WITH_MACRO_HIGHLIGHTING
|
||||
// set up the format for the macros
|
||||
QTextCharFormat macroFormat;
|
||||
macroFormat.setUnderlineStyle(QTextCharFormat::SingleUnderline);
|
||||
|
||||
QTextCursor c = ed->textCursor();
|
||||
foreach (const Document::Block block, doc->macroUses()) {
|
||||
QTextEdit::ExtraSelection sel;
|
||||
sel.cursor = c;
|
||||
sel.cursor.setPosition(block.begin());
|
||||
sel.cursor.setPosition(block.end(), QTextCursor::KeepAnchor);
|
||||
sel.format = macroFormat;
|
||||
selections.append(sel);
|
||||
}
|
||||
#endif // QTCREATOR_WITH_MACRO_HIGHLIGHTING
|
||||
|
||||
// set up the format for the errors
|
||||
QTextCharFormat errorFormat;
|
||||
errorFormat.setUnderlineStyle(QTextCharFormat::WaveUnderline);
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
|
||||
namespace rpp {
|
||||
|
||||
class Macro;
|
||||
|
||||
class Client
|
||||
{
|
||||
Client(const Client &other);
|
||||
@@ -61,6 +63,13 @@ public:
|
||||
virtual void macroAdded(const QByteArray ¯oId, const QByteArray &text) = 0;
|
||||
virtual void sourceNeeded(QString &fileName, IncludeType mode) = 0; // ### FIX the signature.
|
||||
|
||||
virtual void startExpandingMacro(unsigned offset,
|
||||
const Macro ¯o,
|
||||
const QByteArray &originalTextt) = 0;
|
||||
|
||||
virtual void stopExpandingMacro(unsigned offset,
|
||||
const Macro ¯o) = 0;
|
||||
|
||||
virtual void startSkippingBlocks(unsigned offset) = 0;
|
||||
virtual void stopSkippingBlocks(unsigned offset) = 0;
|
||||
};
|
||||
|
||||
@@ -575,7 +575,17 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
|
||||
|
||||
const QByteArray spell = tokenSpell(*identifierToken);
|
||||
if (env.isBuiltinMacro(spell)) {
|
||||
const Macro trivial;
|
||||
|
||||
if (client)
|
||||
client->startExpandingMacro(identifierToken->offset,
|
||||
trivial, spell);
|
||||
|
||||
expand(spell.constBegin(), spell.constEnd(), result);
|
||||
|
||||
if (client)
|
||||
client->stopExpandingMacro(_dot->offset, trivial);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -585,18 +595,36 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
|
||||
} else {
|
||||
if (! m->function_like) {
|
||||
if (_dot->isNot(T_LPAREN)) {
|
||||
if (client)
|
||||
client->startExpandingMacro(identifierToken->offset,
|
||||
*m, spell);
|
||||
|
||||
m->hidden = true;
|
||||
|
||||
expand(m->definition.constBegin(),
|
||||
m->definition.constEnd(),
|
||||
result);
|
||||
|
||||
if (client)
|
||||
client->stopExpandingMacro(_dot->offset, *m);
|
||||
|
||||
m->hidden = false;
|
||||
continue;
|
||||
} else {
|
||||
QByteArray tmp;
|
||||
m->hidden = true;
|
||||
|
||||
if (client)
|
||||
client->startExpandingMacro(identifierToken->offset,
|
||||
*m, spell);
|
||||
|
||||
expand(m->definition.constBegin(),
|
||||
m->definition.constEnd(),
|
||||
&tmp);
|
||||
|
||||
if (client)
|
||||
client->stopExpandingMacro(_dot->offset, *m);
|
||||
|
||||
m->hidden = false;
|
||||
|
||||
m = 0; // reset the active the macro
|
||||
@@ -640,9 +668,20 @@ void pp::operator()(const QByteArray &source, QByteArray *result)
|
||||
const char *beginOfText = startOfToken(*identifierToken);
|
||||
const char *endOfText = endOfToken(*_dot);
|
||||
++_dot; // skip T_RPAREN
|
||||
//m->hidden = true;
|
||||
|
||||
if (client) {
|
||||
const QByteArray text =
|
||||
QByteArray::fromRawData(beginOfText,
|
||||
endOfText - beginOfText);
|
||||
|
||||
client->startExpandingMacro(identifierToken->offset,
|
||||
*m, text);
|
||||
}
|
||||
|
||||
expand(beginOfText, endOfText, result);
|
||||
//m->hidden = false;
|
||||
|
||||
if (client)
|
||||
client->stopExpandingMacro(_dot->offset, *m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,16 +80,16 @@ void CommitData::clear()
|
||||
panelInfo.clear();
|
||||
panelData.clear();
|
||||
|
||||
commitFiles.clear();
|
||||
notUpdatedFiles.clear();
|
||||
stagedFiles.clear();
|
||||
unstagedFiles.clear();
|
||||
untrackedFiles.clear();
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug d, const CommitData &data)
|
||||
{
|
||||
d << data.panelInfo << data.panelData;
|
||||
d.nospace() << "Commit: " << data.commitFiles << " Not updated: "
|
||||
<< data.notUpdatedFiles << " Untracked: " << data.untrackedFiles;
|
||||
d.nospace() << "Commit: " << data.stagedFiles << " Not updated: "
|
||||
<< data.unstagedFiles << " Untracked: " << data.untrackedFiles;
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,8 +71,8 @@ struct CommitData
|
||||
void clear();
|
||||
GitSubmitEditorPanelInfo panelInfo;
|
||||
GitSubmitEditorPanelData panelData;
|
||||
QStringList commitFiles;
|
||||
QStringList notUpdatedFiles;
|
||||
QStringList stagedFiles;
|
||||
QStringList unstagedFiles;
|
||||
QStringList untrackedFiles;
|
||||
};
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "gitplugin.h"
|
||||
#include "gitconstants.h"
|
||||
#include "commitdata.h"
|
||||
#include "gitsubmiteditor.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@@ -51,7 +52,9 @@
|
||||
#include <QtCore/QFuture>
|
||||
#include <QtCore/QTime>
|
||||
|
||||
#include <QtGui/QErrorMessage>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QMainWindow> // for msg box parent
|
||||
#include <QtGui/QPushButton>
|
||||
|
||||
using namespace Git;
|
||||
using namespace Git::Internal;
|
||||
@@ -77,12 +80,24 @@ inline Core::IEditor* locateEditor(const Core::ICore *core, const char *property
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline QString msgRepositoryNotFound(const QString &dir)
|
||||
{
|
||||
return GitClient::tr("Unable to determine the repository for %1.").arg(dir);
|
||||
}
|
||||
|
||||
static inline QString msgParseFilesFailed()
|
||||
{
|
||||
return GitClient::tr("Unable to parse the file output.");
|
||||
}
|
||||
|
||||
// Format a command for the status window
|
||||
static QString formatCommand(const QString &binary, const QStringList &args)
|
||||
{
|
||||
const QString timeStamp = QTime::currentTime().toString(QLatin1String("HH:mm"));
|
||||
return GitClient::tr("%1 Executing: %2 %3\n").arg(timeStamp, binary, args.join(QString(QLatin1Char(' '))));
|
||||
}
|
||||
|
||||
// ---------------- GitClient
|
||||
GitClient::GitClient(GitPlugin* plugin, Core::ICore *core) :
|
||||
m_msgWait(tr("Waiting for data...")),
|
||||
m_plugin(plugin),
|
||||
@@ -311,6 +326,19 @@ bool GitClient::synchronousAdd(const QString &workingDirectory, const QStringLis
|
||||
|
||||
bool GitClient::synchronousReset(const QString &workingDirectory,
|
||||
const QStringList &files)
|
||||
{
|
||||
QString errorMessage;
|
||||
const bool rc = synchronousReset(workingDirectory, files, &errorMessage);
|
||||
if (!rc) {
|
||||
m_plugin->outputWindow()->append(errorMessage);
|
||||
m_plugin->outputWindow()->popup(false);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool GitClient::synchronousReset(const QString &workingDirectory,
|
||||
const QStringList &files,
|
||||
QString *errorMessage)
|
||||
{
|
||||
if (Git::Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << workingDirectory << files;
|
||||
@@ -325,9 +353,25 @@ bool GitClient::synchronousReset(const QString &workingDirectory,
|
||||
// Note that git exits with 1 even if the operation is successful
|
||||
// Assume real failure if the output does not contain "foo.cpp modified"
|
||||
if (!rc && !output.contains(QLatin1String("modified"))) {
|
||||
const QString errorMessage = tr("Unable to reset %n file(s) in %1: %2", 0, files.size()).
|
||||
arg(workingDirectory, QString::fromLocal8Bit(errorText));
|
||||
m_plugin->outputWindow()->append(errorMessage);
|
||||
*errorMessage = tr("Unable to reset %n file(s) in %1: %2", 0, files.size()).arg(workingDirectory, QString::fromLocal8Bit(errorText));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GitClient::synchronousCheckout(const QString &workingDirectory,
|
||||
const QStringList &files,
|
||||
QString *errorMessage)
|
||||
{
|
||||
if (Git::Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << workingDirectory << files;
|
||||
QByteArray outputText;
|
||||
QByteArray errorText;
|
||||
QStringList arguments;
|
||||
arguments << QLatin1String("checkout") << QLatin1String("--") << files;
|
||||
const bool rc = synchronousGit(workingDirectory, arguments, &outputText, &errorText);
|
||||
if (!rc) {
|
||||
*errorMessage = tr("Unable to checkout %n file(s) in %1: %2", 0, files.size()).arg(workingDirectory, QString::fromLocal8Bit(errorText));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -365,16 +409,18 @@ void GitClient::executeGit(const QString &workingDirectory, const QStringList &a
|
||||
command->execute(arguments, workingDirectory, environment);
|
||||
}
|
||||
|
||||
bool GitClient::synchronousGit(const QString &workingDirectory
|
||||
, const QStringList &arguments
|
||||
, QByteArray* outputText
|
||||
, QByteArray* errorText)
|
||||
bool GitClient::synchronousGit(const QString &workingDirectory,
|
||||
const QStringList &arguments,
|
||||
QByteArray* outputText,
|
||||
QByteArray* errorText,
|
||||
bool logCommandToWindow)
|
||||
{
|
||||
if (Git::Constants::debug)
|
||||
qDebug() << "synchronousGit" << workingDirectory << arguments;
|
||||
const QString binary = QLatin1String(kGitCommand);
|
||||
|
||||
m_plugin->outputWindow()->append(formatCommand(binary, arguments));
|
||||
if (logCommandToWindow)
|
||||
m_plugin->outputWindow()->append(formatCommand(binary, arguments));
|
||||
|
||||
QProcess process;
|
||||
process.setWorkingDirectory(workingDirectory);
|
||||
@@ -456,10 +502,11 @@ GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory,
|
||||
#<tab>modified:<blanks>git.pro
|
||||
\endcode
|
||||
*/
|
||||
static bool parseFiles(const QStringList &lines, CommitData *d)
|
||||
static bool parseFiles(const QString &output, CommitData *d)
|
||||
{
|
||||
enum State { None, CommitFiles, NotUpdatedFiles, UntrackedFiles };
|
||||
|
||||
const QStringList lines = output.split(QLatin1Char('\n'));
|
||||
const QString branchIndicator = QLatin1String(kBranchIndicatorC);
|
||||
const QString commitIndicator = QLatin1String("# Changes to be committed:");
|
||||
const QString notUpdatedIndicator = QLatin1String("# Changed but not updated:");
|
||||
@@ -492,10 +539,10 @@ static bool parseFiles(const QStringList &lines, CommitData *d)
|
||||
const QString fileSpec = line.mid(2).trimmed();
|
||||
switch (s) {
|
||||
case CommitFiles:
|
||||
d->commitFiles.push_back(trimFileSpecification(fileSpec));
|
||||
d->stagedFiles.push_back(trimFileSpecification(fileSpec));
|
||||
break;
|
||||
case NotUpdatedFiles:
|
||||
d->notUpdatedFiles.push_back(trimFileSpecification(fileSpec));
|
||||
d->unstagedFiles.push_back(trimFileSpecification(fileSpec));
|
||||
break;
|
||||
case UntrackedFiles:
|
||||
d->untrackedFiles.push_back(QLatin1String("untracked: ") + fileSpec);
|
||||
@@ -509,7 +556,7 @@ static bool parseFiles(const QStringList &lines, CommitData *d)
|
||||
}
|
||||
}
|
||||
}
|
||||
return !d->commitFiles.empty() || !d->notUpdatedFiles.empty() || !d->untrackedFiles.empty();
|
||||
return !d->stagedFiles.empty() || !d->unstagedFiles.empty() || !d->untrackedFiles.empty();
|
||||
}
|
||||
|
||||
bool GitClient::getCommitData(const QString &workingDirectory,
|
||||
@@ -525,7 +572,7 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
||||
// Find repo
|
||||
const QString repoDirectory = GitClient::findRepositoryForDirectory(workingDirectory);
|
||||
if (repoDirectory.isEmpty()) {
|
||||
*errorMessage = tr("Unable to determine the repository for %1.").arg(workingDirectory);
|
||||
*errorMessage = msgRepositoryNotFound(workingDirectory);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -551,7 +598,7 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
||||
case StatusChanged:
|
||||
break;
|
||||
case StatusUnchanged:
|
||||
*errorMessage = tr("There are no modified files.");
|
||||
*errorMessage = msgNoChangedFiles();
|
||||
return false;
|
||||
case StatusFailed:
|
||||
return false;
|
||||
@@ -575,9 +622,8 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
||||
// #
|
||||
// # list of files...
|
||||
|
||||
const QStringList lines = output.split(QLatin1Char('\n'));
|
||||
if (!parseFiles(lines, d)) {
|
||||
*errorMessage = tr("Unable to parse the file output.");
|
||||
if (!parseFiles(output, d)) {
|
||||
*errorMessage = msgParseFilesFailed();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -638,6 +684,129 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
|
||||
return rc;
|
||||
}
|
||||
|
||||
static inline bool askWithInformativeText(QWidget *parent,
|
||||
const QString &title,
|
||||
const QString &msg,
|
||||
const QString &inf,
|
||||
bool defaultValue)
|
||||
{
|
||||
QMessageBox msgBox(QMessageBox::Question, title, msg, QMessageBox::Yes|QMessageBox::No, parent);
|
||||
msgBox.setInformativeText(inf);
|
||||
msgBox.setDefaultButton(defaultValue ? QMessageBox::Yes : QMessageBox::No);
|
||||
return msgBox.exec() == QMessageBox::Yes;
|
||||
}
|
||||
|
||||
/* Revert: This function can be called with a file list (to revert single
|
||||
* files) or a single directory (revert all). Qt Creator currently has only
|
||||
* 'revert single' in its VCS menus, but the code is prepared to deal with
|
||||
* reverting a directory pending a sophisticated selection dialog in the
|
||||
* VCSBase plugin. */
|
||||
|
||||
GitClient::RevertResult GitClient::revertI(QStringList files, bool *ptrToIsDirectory, QString *errorMessage)
|
||||
{
|
||||
if (Git::Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << files;
|
||||
|
||||
if (files.empty())
|
||||
return RevertCanceled;
|
||||
|
||||
// Figure out the working directory
|
||||
const QFileInfo firstFile(files.front());
|
||||
const bool isDirectory = firstFile.isDir();
|
||||
if (ptrToIsDirectory)
|
||||
*ptrToIsDirectory = isDirectory;
|
||||
const QString workingDirectory = isDirectory ? firstFile.absoluteFilePath() : firstFile.absolutePath();
|
||||
|
||||
const QString repoDirectory = GitClient::findRepositoryForDirectory(workingDirectory);
|
||||
if (repoDirectory.isEmpty()) {
|
||||
*errorMessage = msgRepositoryNotFound(workingDirectory);
|
||||
return RevertFailed;
|
||||
}
|
||||
|
||||
// Check for changes
|
||||
QString output;
|
||||
switch (gitStatus(repoDirectory, false, &output, errorMessage)) {
|
||||
case StatusChanged:
|
||||
break;
|
||||
case StatusUnchanged:
|
||||
return RevertUnchanged;
|
||||
case StatusFailed:
|
||||
return RevertFailed;
|
||||
}
|
||||
CommitData d;
|
||||
if (!parseFiles(output, &d)) {
|
||||
*errorMessage = msgParseFilesFailed();
|
||||
return RevertFailed;
|
||||
}
|
||||
|
||||
// If we are looking at files, make them relative to the repository
|
||||
// directory to match them in the status output list.
|
||||
if (!isDirectory) {
|
||||
const QDir repoDir(repoDirectory);
|
||||
const QStringList::iterator cend = files.end();
|
||||
for (QStringList::iterator it = files.begin(); it != cend; ++it)
|
||||
*it = repoDir.relativeFilePath(*it);
|
||||
}
|
||||
|
||||
// From the status output, determine all modified [un]staged files.
|
||||
const QString modifiedPattern = QLatin1String("modified: ");
|
||||
const QStringList allStagedFiles = GitSubmitEditor::statusListToFileList(d.stagedFiles.filter(modifiedPattern));
|
||||
const QStringList allUnstagedFiles = GitSubmitEditor::statusListToFileList(d.unstagedFiles.filter(modifiedPattern));
|
||||
// Unless a directory was passed, filter all modified files for the
|
||||
// argument file list.
|
||||
QStringList stagedFiles = allStagedFiles;
|
||||
QStringList unstagedFiles = allUnstagedFiles;
|
||||
if (!isDirectory) {
|
||||
const QSet<QString> filesSet = files.toSet();
|
||||
stagedFiles = allStagedFiles.toSet().intersect(filesSet).toList();
|
||||
unstagedFiles = allUnstagedFiles.toSet().intersect(filesSet).toList();
|
||||
}
|
||||
if (Git::Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << d.stagedFiles << d.unstagedFiles << allStagedFiles << allUnstagedFiles << stagedFiles << unstagedFiles;
|
||||
|
||||
if (stagedFiles.empty() && unstagedFiles.empty())
|
||||
return RevertUnchanged;
|
||||
|
||||
// Ask to revert (to do: Handle lists with a selection dialog)
|
||||
const QMessageBox::StandardButton answer
|
||||
= QMessageBox::question(m_core->mainWindow(),
|
||||
tr("Revert"),
|
||||
tr("The file has been changed. Do you want to revert it?"),
|
||||
QMessageBox::Yes|QMessageBox::No,
|
||||
QMessageBox::No);
|
||||
if (answer == QMessageBox::No)
|
||||
return RevertCanceled;
|
||||
|
||||
// Unstage the staged files
|
||||
if (!stagedFiles.empty() && !synchronousReset(repoDirectory, stagedFiles, errorMessage))
|
||||
return RevertFailed;
|
||||
// Finally revert!
|
||||
if (!synchronousCheckout(repoDirectory, stagedFiles + unstagedFiles, errorMessage))
|
||||
return RevertFailed;
|
||||
return RevertOk;
|
||||
}
|
||||
|
||||
void GitClient::revert(const QStringList &files)
|
||||
{
|
||||
bool isDirectory;
|
||||
QString errorMessage;
|
||||
switch (revertI(files, &isDirectory, &errorMessage)) {
|
||||
case RevertOk:
|
||||
case RevertCanceled:
|
||||
break;
|
||||
case RevertUnchanged: {
|
||||
const QString msg = (isDirectory || files.size() > 1) ? msgNoChangedFiles() : tr("The file is not modified.");
|
||||
m_plugin->outputWindow()->append(msg);
|
||||
m_plugin->outputWindow()->popup();
|
||||
}
|
||||
break;
|
||||
case RevertFailed:
|
||||
m_plugin->outputWindow()->append(errorMessage);
|
||||
m_plugin->outputWindow()->popup();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GitClient::pull(const QString &workingDirectory)
|
||||
{
|
||||
executeGit(workingDirectory, QStringList(QLatin1String("pull")), m_plugin->outputWindow(), 0, true);
|
||||
@@ -648,6 +817,11 @@ void GitClient::push(const QString &workingDirectory)
|
||||
executeGit(workingDirectory, QStringList(QLatin1String("push")), m_plugin->outputWindow(), 0, true);
|
||||
}
|
||||
|
||||
QString GitClient::msgNoChangedFiles()
|
||||
{
|
||||
return tr("There are no modified files.");
|
||||
}
|
||||
|
||||
void GitClient::stash(const QString &workingDirectory)
|
||||
{
|
||||
// Check for changes and stash
|
||||
@@ -657,7 +831,7 @@ void GitClient::stash(const QString &workingDirectory)
|
||||
executeGit(workingDirectory, QStringList(QLatin1String("stash")), m_plugin->outputWindow(), 0, true);
|
||||
break;
|
||||
case StatusUnchanged:
|
||||
m_plugin->outputWindow()->append(tr("There are no modified files."));
|
||||
m_plugin->outputWindow()->append(msgNoChangedFiles());
|
||||
m_plugin->outputWindow()->popup();
|
||||
break;
|
||||
case StatusFailed:
|
||||
@@ -694,8 +868,8 @@ QString GitClient::readConfig(const QString &workingDirectory, const QStringList
|
||||
arguments << QLatin1String("config") << configVar;
|
||||
|
||||
QByteArray outputText;
|
||||
if (synchronousGit(workingDirectory, arguments, &outputText))
|
||||
return QString::fromLocal8Bit(outputText);
|
||||
if (synchronousGit(workingDirectory, arguments, &outputText, 0, false))
|
||||
return QString::fromLocal8Bit(outputText).remove(QLatin1Char('\r'));
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
@@ -90,11 +90,14 @@ public:
|
||||
void addFile(const QString &workingDirectory, const QString &fileName);
|
||||
bool synchronousAdd(const QString &workingDirectory, const QStringList &files);
|
||||
bool synchronousReset(const QString &workingDirectory, const QStringList &files);
|
||||
bool synchronousReset(const QString &workingDirectory, const QStringList &files, QString *errorMessage);
|
||||
bool synchronousCheckout(const QString &workingDirectory, const QStringList &files, QString *errorMessage);
|
||||
void pull(const QString &workingDirectory);
|
||||
void push(const QString &workingDirectory);
|
||||
|
||||
void stash(const QString &workingDirectory);
|
||||
void stashPop(const QString &workingDirectory);
|
||||
void revert(const QStringList &files);
|
||||
void branchList(const QString &workingDirectory);
|
||||
void stashList(const QString &workingDirectory);
|
||||
|
||||
@@ -113,19 +116,21 @@ public:
|
||||
const QStringList &checkedFiles,
|
||||
const QStringList &origCommitFiles);
|
||||
|
||||
GitSettings settings() const;
|
||||
void setSettings(const GitSettings &s);
|
||||
|
||||
public slots:
|
||||
void show(const QString &source, const QString &id);
|
||||
|
||||
private:
|
||||
enum StatusResult { StatusChanged, StatusUnchanged, StatusFailed };
|
||||
StatusResult gitStatus(const QString &workingDirectory,
|
||||
bool untracked,
|
||||
QString *output = 0,
|
||||
QString *errorMessage = 0);
|
||||
|
||||
GitSettings settings() const;
|
||||
void setSettings(const GitSettings &s);
|
||||
|
||||
static QString msgNoChangedFiles();
|
||||
|
||||
public slots:
|
||||
void show(const QString &source, const QString &id);
|
||||
|
||||
private:
|
||||
VCSBase::VCSBaseEditor *createVCSEditor(const QString &kind,
|
||||
QString title,
|
||||
const QString &source,
|
||||
@@ -141,9 +146,13 @@ private:
|
||||
bool outputToWindow = false);
|
||||
|
||||
bool synchronousGit(const QString &workingDirectory,
|
||||
const QStringList &arguments,
|
||||
QByteArray* outputText = 0,
|
||||
QByteArray* errorText = 0);
|
||||
const QStringList &arguments,
|
||||
QByteArray* outputText = 0,
|
||||
QByteArray* errorText = 0,
|
||||
bool logCommandToWindow = true);
|
||||
|
||||
enum RevertResult { RevertOk, RevertUnchanged, RevertCanceled, RevertFailed };
|
||||
RevertResult revertI(QStringList files, bool *isDirectory, QString *errorMessage);
|
||||
|
||||
const QString m_msgWait;
|
||||
GitPlugin *m_plugin;
|
||||
|
||||
@@ -118,7 +118,9 @@ GitPlugin::GitPlugin() :
|
||||
m_undoFileAction(0),
|
||||
m_undoProjectAction(0),
|
||||
m_showAction(0),
|
||||
m_addAction(0),
|
||||
m_stageAction(0),
|
||||
m_unstageAction(0),
|
||||
m_revertAction(0),
|
||||
m_commitAction(0),
|
||||
m_pullAction(0),
|
||||
m_pushAction(0),
|
||||
@@ -311,11 +313,23 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *error_message)
|
||||
connect(m_undoFileAction, SIGNAL(triggered()), this, SLOT(undoFileChanges()));
|
||||
gitContainer->addAction(command);
|
||||
|
||||
m_addAction = new QAction(tr("Add File"), this);
|
||||
command = actionManager->registerAction(m_addAction, "Git.Add", globalcontext);
|
||||
m_stageAction = new QAction(tr("Stage file for commit"), this);
|
||||
command = actionManager->registerAction(m_stageAction, "Git.Stage", globalcontext);
|
||||
command->setDefaultKeySequence(QKeySequence(tr("Alt+G,Alt+A")));
|
||||
command->setAttribute(Core::ICommand::CA_UpdateText);
|
||||
connect(m_addAction, SIGNAL(triggered()), this, SLOT(addFile()));
|
||||
connect(m_stageAction, SIGNAL(triggered()), this, SLOT(stageFile()));
|
||||
gitContainer->addAction(command);
|
||||
|
||||
m_unstageAction = new QAction(tr("Unstage file from commit"), this);
|
||||
command = actionManager->registerAction(m_unstageAction, "Git.Unstage", globalcontext);
|
||||
command->setAttribute(Core::ICommand::CA_UpdateText);
|
||||
connect(m_unstageAction, SIGNAL(triggered()), this, SLOT(unstageFile()));
|
||||
gitContainer->addAction(command);
|
||||
|
||||
m_revertAction = new QAction(tr("Revert..."), this);
|
||||
command = actionManager->registerAction(m_revertAction, "Git.Revert", globalcontext);
|
||||
command->setAttribute(Core::ICommand::CA_UpdateText);
|
||||
connect(m_revertAction, SIGNAL(triggered()), this, SLOT(revertFile()));
|
||||
gitContainer->addAction(command);
|
||||
|
||||
gitContainer->addAction(createSeparator(actionManager, globalcontext, QLatin1String("Git.Sep.Project"), this));
|
||||
@@ -537,14 +551,28 @@ void GitPlugin::undoProjectChanges()
|
||||
m_gitClient->hardReset(workingDirectory, QString());
|
||||
}
|
||||
|
||||
void GitPlugin::addFile()
|
||||
void GitPlugin::stageFile()
|
||||
{
|
||||
QFileInfo fileInfo = currentFile();
|
||||
QString fileName = fileInfo.fileName();
|
||||
QString workingDirectory = fileInfo.absolutePath();
|
||||
const QFileInfo fileInfo = currentFile();
|
||||
const QString fileName = fileInfo.fileName();
|
||||
const QString workingDirectory = fileInfo.absolutePath();
|
||||
m_gitClient->addFile(workingDirectory, fileName);
|
||||
}
|
||||
|
||||
void GitPlugin::unstageFile()
|
||||
{
|
||||
const QFileInfo fileInfo = currentFile();
|
||||
const QString fileName = fileInfo.fileName();
|
||||
const QString workingDirectory = fileInfo.absolutePath();
|
||||
m_gitClient->synchronousReset(workingDirectory, QStringList(fileName));
|
||||
}
|
||||
|
||||
void GitPlugin::revertFile()
|
||||
{
|
||||
const QFileInfo fileInfo = currentFile();
|
||||
m_gitClient->revert(QStringList(fileInfo.absoluteFilePath()));
|
||||
}
|
||||
|
||||
void GitPlugin::startCommit()
|
||||
{
|
||||
if (m_changeTmpFile) {
|
||||
@@ -570,7 +598,7 @@ void GitPlugin::startCommit()
|
||||
// Store repository for diff and the original list of
|
||||
// files to be able to unstage files the user unchecks
|
||||
m_submitRepository = data.panelInfo.repository;
|
||||
m_submitOrigCommitFiles = GitSubmitEditor::statusListToFileList(data.commitFiles);
|
||||
m_submitOrigCommitFiles = GitSubmitEditor::statusListToFileList(data.stagedFiles);
|
||||
|
||||
if (Git::Constants::debug)
|
||||
qDebug() << Q_FUNC_INFO << data << commitTemplate;
|
||||
@@ -602,7 +630,7 @@ Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const Commit
|
||||
Q_ASSERT(submitEditor);
|
||||
// The actions are for some reason enabled by the context switching
|
||||
// mechanism. Disable them correctly.
|
||||
m_submitCurrentAction->setEnabled(!cd.commitFiles.empty());
|
||||
m_submitCurrentAction->setEnabled(!cd.stagedFiles.empty());
|
||||
m_diffSelectedFilesAction->setEnabled(false);
|
||||
m_undoAction->setEnabled(false);
|
||||
m_redoAction->setEnabled(false);
|
||||
@@ -722,7 +750,9 @@ void GitPlugin::updateActions()
|
||||
m_logAction->setText(tr("Log %1").arg(fileName));
|
||||
m_blameAction->setText(tr("Blame %1").arg(fileName));
|
||||
m_undoFileAction->setText(tr("Undo changes for %1").arg(fileName));
|
||||
m_addAction->setText(tr("Add %1").arg(fileName));
|
||||
m_stageAction->setText(tr("Stage %1 for commit").arg(fileName));
|
||||
m_unstageAction->setText(tr("Unstage %1 from commit").arg(fileName));
|
||||
m_revertAction->setText(tr("Revert %1...").arg(fileName));
|
||||
if (repository.isEmpty()) {
|
||||
// If the file is not in a repository, the corresponding project will
|
||||
// be neither and we can disable everything and return
|
||||
@@ -731,7 +761,9 @@ void GitPlugin::updateActions()
|
||||
m_logAction->setEnabled(false);
|
||||
m_blameAction->setEnabled(false);
|
||||
m_undoFileAction->setEnabled(false);
|
||||
m_addAction->setEnabled(false);
|
||||
m_stageAction->setEnabled(false);
|
||||
m_unstageAction->setEnabled(false);
|
||||
m_revertAction->setEnabled(false);
|
||||
m_diffProjectAction->setEnabled(false);
|
||||
m_diffProjectAction->setText(tr("Diff Project"));
|
||||
m_statusProjectAction->setText(tr("Status Project"));
|
||||
@@ -747,7 +779,9 @@ void GitPlugin::updateActions()
|
||||
m_logAction->setEnabled(true);
|
||||
m_blameAction->setEnabled(true);
|
||||
m_undoFileAction->setEnabled(true);
|
||||
m_addAction->setEnabled(true);
|
||||
m_stageAction->setEnabled(true);
|
||||
m_unstageAction->setEnabled(true);
|
||||
m_revertAction->setEnabled(true);
|
||||
}
|
||||
|
||||
if (m_projectExplorer && m_projectExplorer->currentNode()
|
||||
|
||||
@@ -116,7 +116,9 @@ private slots:
|
||||
void logProject();
|
||||
void undoFileChanges();
|
||||
void undoProjectChanges();
|
||||
void addFile();
|
||||
void stageFile();
|
||||
void unstageFile();
|
||||
void revertFile();
|
||||
|
||||
void showCommit();
|
||||
void startCommit();
|
||||
@@ -144,7 +146,9 @@ private:
|
||||
QAction *m_undoFileAction;
|
||||
QAction *m_undoProjectAction;
|
||||
QAction *m_showAction;
|
||||
QAction *m_addAction;
|
||||
QAction *m_stageAction;
|
||||
QAction *m_unstageAction;
|
||||
QAction *m_revertAction;
|
||||
QAction *m_commitAction;
|
||||
QAction *m_pullAction;
|
||||
QAction *m_pushAction;
|
||||
|
||||
@@ -67,9 +67,9 @@ void GitSubmitEditor::setCommitData(const CommitData &d)
|
||||
submitEditorWidget()->setPanelData(d.panelData);
|
||||
submitEditorWidget()->setPanelInfo(d.panelInfo);
|
||||
|
||||
addFiles(d.commitFiles, true, true);
|
||||
addFiles(d.stagedFiles, true, true);
|
||||
// Not Updated: Initially unchecked
|
||||
addFiles(d.notUpdatedFiles, false, true);
|
||||
addFiles(d.unstagedFiles, false, true);
|
||||
addFiles(d.untrackedFiles, false, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ HEADERS += helpplugin.h \
|
||||
searchwidget.h \
|
||||
helpfindsupport.h \
|
||||
help_global.h \
|
||||
helpindexfilter.h \
|
||||
indexwindow.h
|
||||
helpindexfilter.h
|
||||
|
||||
SOURCES += helpplugin.cpp \
|
||||
docsettingspage.cpp \
|
||||
filtersettingspage.cpp \
|
||||
@@ -26,6 +26,7 @@ SOURCES += helpplugin.cpp \
|
||||
searchwidget.cpp \
|
||||
helpfindsupport.cpp \
|
||||
helpindexfilter.cpp
|
||||
|
||||
FORMS += docsettingspage.ui \
|
||||
filtersettingspage.ui
|
||||
RESOURCES += help.qrc
|
||||
|
||||
@@ -159,7 +159,6 @@ bool QMakeStep::init(const QString &name)
|
||||
setCommand(name, program);
|
||||
setArguments(name, args);
|
||||
setEnvironment(name, environment);
|
||||
setWorkingDirectory(name, workingDirectory);
|
||||
return AbstractProcessStep::init(name);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ Qt4PriFileNode::Qt4PriFileNode(Qt4Project *project,
|
||||
: ProjectNode(filePath),
|
||||
m_core(project->qt4ProjectManager()->core()),
|
||||
m_project(project),
|
||||
m_projectFilePath(filePath),
|
||||
m_projectFilePath(QDir::fromNativeSeparators(filePath)),
|
||||
m_projectDir(QFileInfo(filePath).absolutePath()),
|
||||
m_includeFile(0),
|
||||
m_saveTimer(new QTimer(this)),
|
||||
|
||||
Reference in New Issue
Block a user