summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2010-01-08 17:16:33 +0100
committerKai Koehne <kai.koehne@nokia.com>2010-01-08 17:16:33 +0100
commit2e5ce0ae75735e3f54fd617dd44cc73307350e64 (patch)
tree90027b3bb5bb25a008e825b744e53fb220cf3edc /src
parent2a425c7cfaf338b1c0c00a1200f07fc63f7ec07e (diff)
parenteca7744e0a6afc492a0f387ab5456173b39d017a (diff)
downloadqt-creator-2e5ce0ae75735e3f54fd617dd44cc73307350e64.tar.gz
Merge branch 'master' of scm.dev.nokia.troll.no:creator/mainline
Diffstat (limited to 'src')
-rw-r--r--src/libs/cplusplus/FindUsages.cpp2
-rw-r--r--src/libs/cplusplus/SimpleLexer.cpp3
-rw-r--r--src/libs/cplusplus/TypePrettyPrinter.cpp3
-rw-r--r--src/libs/cplusplus/pp-engine.cpp1
-rw-r--r--src/libs/cplusplus/pp-macro-expander.cpp3
-rw-r--r--src/libs/cplusplus/pp-macro-expander.h1
-rw-r--r--src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp1
-rw-r--r--src/plugins/cmakeprojectmanager/cmakeproject.cpp1
-rw-r--r--src/plugins/coreplugin/actionmanager/command.cpp12
-rw-r--r--src/plugins/coreplugin/actionmanager/command_p.h1
-rw-r--r--src/plugins/coreplugin/outputpane.cpp4
-rw-r--r--src/plugins/cppeditor/cppquickfix.cpp167
-rw-r--r--src/plugins/cvs/cvsconstants.h3
-rw-r--r--src/plugins/cvs/cvsplugin.cpp19
-rw-r--r--src/plugins/designer/formeditorw.cpp125
-rw-r--r--src/plugins/designer/formeditorw.h22
-rw-r--r--src/plugins/git/gitclient.cpp47
-rw-r--r--src/plugins/git/gitclient.h1
-rw-r--r--src/plugins/git/gitconstants.h17
-rw-r--r--src/plugins/git/giteditor.cpp2
-rw-r--r--src/plugins/git/gitplugin.cpp36
-rw-r--r--src/plugins/git/gitplugin.h3
-rw-r--r--src/plugins/git/gitsettings.cpp2
-rw-r--r--src/plugins/mercurial/constants.h11
-rw-r--r--src/plugins/mercurial/mercurialplugin.cpp23
-rw-r--r--src/plugins/perforce/perforceconstants.h7
-rw-r--r--src/plugins/perforce/perforceplugin.cpp5
-rw-r--r--src/plugins/projectexplorer/buildsettingspropertiespage.cpp35
-rw-r--r--src/plugins/projectexplorer/buildsettingspropertiespage.h3
-rw-r--r--src/plugins/projectexplorer/outputwindow.cpp7
-rw-r--r--src/plugins/projectexplorer/project.cpp10
-rw-r--r--src/plugins/projectexplorer/project.h8
-rw-r--r--src/plugins/projectexplorer/projectexplorer.cpp1
-rw-r--r--src/plugins/projectexplorer/projecttreewidget.cpp9
-rw-r--r--src/plugins/projectexplorer/projecttreewidget.h2
-rw-r--r--src/plugins/projectexplorer/projectwindow.cpp40
-rw-r--r--src/plugins/projectexplorer/projectwindow.h8
-rw-r--r--src/plugins/projectexplorer/taskwindow.cpp5
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/stateslist.qml47
-rw-r--r--src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp2
-rw-r--r--src/plugins/qtscripteditor/qtscripteditor.cpp10
-rw-r--r--src/plugins/qtscripteditor/qtscripteditor.pro5
-rw-r--r--src/plugins/subversion/subversionconstants.h8
-rw-r--r--src/plugins/subversion/subversionplugin.cpp59
-rw-r--r--src/plugins/subversion/subversionplugin.h2
-rw-r--r--src/plugins/vcsbase/basevcseditorfactory.cpp6
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.cpp5
-rw-r--r--src/plugins/vcsbase/vcsbaseeditor.h4
-rw-r--r--src/plugins/vcsbase/vcsbasesubmiteditor.cpp2
-rw-r--r--src/plugins/vcsbase/vcsbasesubmiteditor.h4
-rw-r--r--src/shared/qscripthighlighter/qscripthighlighter.pri4
-rw-r--r--src/shared/qscripthighlighter/qscriptindenter.cpp (renamed from src/plugins/qtscripteditor/qtscriptindenter.cpp)132
-rw-r--r--src/shared/qscripthighlighter/qscriptindenter.h (renamed from src/plugins/qtscripteditor/qtscriptindenter.h)59
53 files changed, 715 insertions, 284 deletions
diff --git a/src/libs/cplusplus/FindUsages.cpp b/src/libs/cplusplus/FindUsages.cpp
index 8acb021473..31d75c346f 100644
--- a/src/libs/cplusplus/FindUsages.cpp
+++ b/src/libs/cplusplus/FindUsages.cpp
@@ -71,7 +71,7 @@ void FindUsages::operator()(Symbol *symbol)
_declSymbol = symbol;
_id = 0;
- if (_declSymbol && 0 != & (_id = _declSymbol->identifier()))
+ if (_declSymbol && 0 != (_id = _declSymbol->identifier()))
_id = _doc->control()->findOrInsertIdentifier(_id->chars(), _id->size());
if (_id) {
diff --git a/src/libs/cplusplus/SimpleLexer.cpp b/src/libs/cplusplus/SimpleLexer.cpp
index f9549d3ca1..d6afc72e2b 100644
--- a/src/libs/cplusplus/SimpleLexer.cpp
+++ b/src/libs/cplusplus/SimpleLexer.cpp
@@ -27,9 +27,10 @@
**
**************************************************************************/
-#include "ObjectiveCTypeQualifiers.h"
#include "SimpleLexer.h"
+#include "ObjectiveCTypeQualifiers.h"
+
#include <Lexer.h>
#include <Token.h>
#include <QtDebug>
diff --git a/src/libs/cplusplus/TypePrettyPrinter.cpp b/src/libs/cplusplus/TypePrettyPrinter.cpp
index 4d08bd7109..07717905f9 100644
--- a/src/libs/cplusplus/TypePrettyPrinter.cpp
+++ b/src/libs/cplusplus/TypePrettyPrinter.cpp
@@ -27,8 +27,9 @@
**
**************************************************************************/
-#include "Overview.h"
#include "TypePrettyPrinter.h"
+
+#include "Overview.h"
#include <FullySpecifiedType.h>
#include <Literals.h>
#include <CoreTypes.h>
diff --git a/src/libs/cplusplus/pp-engine.cpp b/src/libs/cplusplus/pp-engine.cpp
index 39b40a397b..4ad7854d77 100644
--- a/src/libs/cplusplus/pp-engine.cpp
+++ b/src/libs/cplusplus/pp-engine.cpp
@@ -56,7 +56,6 @@
#include <QtDebug>
#include <algorithm>
-#include <cctype>
namespace CPlusPlus {
diff --git a/src/libs/cplusplus/pp-macro-expander.cpp b/src/libs/cplusplus/pp-macro-expander.cpp
index 1c7a872689..3d34ed26ef 100644
--- a/src/libs/cplusplus/pp-macro-expander.cpp
+++ b/src/libs/cplusplus/pp-macro-expander.cpp
@@ -27,9 +27,10 @@
**
**************************************************************************/
+#include "pp-macro-expander.h"
+
#include "pp.h"
#include "pp-cctype.h"
-#include "pp-macro-expander.h"
#include <QDateTime>
namespace CPlusPlus {
diff --git a/src/libs/cplusplus/pp-macro-expander.h b/src/libs/cplusplus/pp-macro-expander.h
index 4f8730d2db..a14a545d9a 100644
--- a/src/libs/cplusplus/pp-macro-expander.h
+++ b/src/libs/cplusplus/pp-macro-expander.h
@@ -49,6 +49,7 @@
#ifndef PP_MACRO_EXPANDER_H
#define PP_MACRO_EXPANDER_H
+#include "Macro.h"
#include "pp-scanner.h"
#include <QVector>
#include <QByteArray>
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
index 1224a8751e..3097e118d3 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
@@ -255,6 +255,7 @@ ProjectExplorer::BuildConfiguration *CMakeBuildConfigurationFactory::create(cons
MakeStep *cleanMakeStep = new MakeStep(bc);
bc->insertCleanStep(0, cleanMakeStep);
+ cleanMakeStep->setAdditionalArguments(QStringList() << "clean");
cleanMakeStep->setClean(true);
CMakeOpenProjectWizard copw(m_project->projectManager(),
diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
index 79a81eee8f..111da656f8 100644
--- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp
@@ -503,6 +503,7 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
//TODO save arguments somewhere copw.arguments()
MakeStep *cleanMakeStep = new MakeStep(bc);
bc->insertCleanStep(0, cleanMakeStep);
+ cleanMakeStep->setAdditionalArguments(QStringList() << "clean");
cleanMakeStep->setClean(true);
addBuildConfiguration(bc);
diff --git a/src/plugins/coreplugin/actionmanager/command.cpp b/src/plugins/coreplugin/actionmanager/command.cpp
index b92720f4cd..6e84d29c55 100644
--- a/src/plugins/coreplugin/actionmanager/command.cpp
+++ b/src/plugins/coreplugin/actionmanager/command.cpp
@@ -500,7 +500,6 @@ void OverrideableAction::addOverrideAction(QAction *action, const QList<int> &co
m_contextActionMap.insert(k, action);
}
}
- action->setShortcut(OverrideableAction::action()->shortcut());
}
void OverrideableAction::actionChanged()
@@ -530,14 +529,3 @@ bool OverrideableAction::isActive() const
{
return m_active;
}
-
-void OverrideableAction::setKeySequence(const QKeySequence &key)
-{
- QMap<int, QPointer<QAction> >::const_iterator it = m_contextActionMap.constBegin();
- QMap<int, QPointer<QAction> >::const_iterator itEnd = m_contextActionMap.constEnd();
- while (it != itEnd) {
- it.value()->setShortcut(key);
- ++it;
- }
- Action::setKeySequence(key);
-}
diff --git a/src/plugins/coreplugin/actionmanager/command_p.h b/src/plugins/coreplugin/actionmanager/command_p.h
index accb15e4ac..176866dfee 100644
--- a/src/plugins/coreplugin/actionmanager/command_p.h
+++ b/src/plugins/coreplugin/actionmanager/command_p.h
@@ -143,7 +143,6 @@ public:
bool setCurrentContext(const QList<int> &context);
void addOverrideAction(QAction *action, const QList<int> &context);
bool isActive() const;
- void setKeySequence(const QKeySequence &key);
private slots:
void actionChanged();
diff --git a/src/plugins/coreplugin/outputpane.cpp b/src/plugins/coreplugin/outputpane.cpp
index 0984934ce3..01cbaca2b5 100644
--- a/src/plugins/coreplugin/outputpane.cpp
+++ b/src/plugins/coreplugin/outputpane.cpp
@@ -304,7 +304,11 @@ void OutputPaneManager::init()
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
cmd = am->registerAction(m_minMaxAction, "Coreplugin.OutputPane.minmax", globalcontext);
+#ifdef Q_WS_MAC
cmd->setDefaultKeySequence(QKeySequence("Ctrl+9"));
+#else
+ cmd->setDefaultKeySequence(QKeySequence("Alt+9"));
+#endif
mpanes->addAction(cmd, "Coreplugin.OutputPane.ActionsGroup");
m_minMaxButton->setDefaultAction(cmd->action());
connect(m_minMaxAction, SIGNAL(triggered()), this, SLOT(slotMinMax()));
diff --git a/src/plugins/cppeditor/cppquickfix.cpp b/src/plugins/cppeditor/cppquickfix.cpp
index 82c122033a..4be8afe773 100644
--- a/src/plugins/cppeditor/cppquickfix.cpp
+++ b/src/plugins/cppeditor/cppquickfix.cpp
@@ -39,6 +39,12 @@
#include <ASTPatternBuilder.h>
#include <ASTMatcher.h>
#include <Token.h>
+#include <Type.h>
+#include <CoreTypes.h>
+#include <Symbol.h>
+#include <Symbols.h>
+#include <Name.h>
+#include <Literals.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <QtDebug>
@@ -899,6 +905,165 @@ private:
PostfixExpressionAST *qlatin1Call;
};
+/*
+ Replace
+ a + b
+ With
+ a % b
+ If a and b are of string type.
+*/
+class UseFastStringConcatenation: public QuickFixOperation
+{
+public:
+ UseFastStringConcatenation()
+ {}
+
+ virtual QString description() const
+ {
+ return QLatin1String("Use fast string concatenation with %"); // ### tr?
+ }
+
+ virtual int match(const QList<AST *> &path)
+ {
+ if (path.isEmpty())
+ return -1;
+
+ // need to search 'up' too
+ int index = path.size() - 1;
+ if (BinaryExpressionAST *binary = asPlusNode(path[index])) {
+ while (0 != (binary = asPlusNode(binary->left_expression)))
+ _binaryExpressions.prepend(binary);
+ }
+
+ // search 'down'
+ for (index = path.size() - 1; index != -1; --index) {
+ AST *node = path.at(index);
+ if (BinaryExpressionAST *binary = asPlusNode(node)) {
+ _binaryExpressions.append(binary);
+ } else if (! _binaryExpressions.isEmpty()) {
+ break;
+ }
+ }
+
+ if (_binaryExpressions.isEmpty())
+ return -1;
+
+ // verify types of arguments
+ BinaryExpressionAST *prevBinary = 0;
+ foreach (BinaryExpressionAST *binary, _binaryExpressions) {
+ if (binary->left_expression != prevBinary) {
+ if (!hasCorrectType(binary->left_expression))
+ return -1;
+ }
+ if (binary->right_expression != prevBinary) {
+ if (!hasCorrectType(binary->right_expression))
+ return -1;
+ }
+ prevBinary = binary;
+ }
+
+ return index + _binaryExpressions.size();
+ }
+
+ virtual void createChangeSet()
+ {
+ // replace + -> %
+ foreach (BinaryExpressionAST *binary, _binaryExpressions)
+ replace(binary->binary_op_token, "%");
+
+ // wrap literals in QLatin1Literal
+ foreach (StringLiteralAST *literal, _stringLiterals) {
+ insert(startOf(literal), "QLatin1Literal(");
+ insert(endOf(literal), ")");
+ }
+
+ // replace QLatin1String/QString/QByteArray(literal) -> QLatin1Literal(literal)
+ foreach (PostfixExpressionAST *postfix, _incorrectlyWrappedLiterals) {
+ replace(postfix->base_expression, "QLatin1Literal");
+ }
+ }
+
+ BinaryExpressionAST *asPlusNode(AST *ast)
+ {
+ BinaryExpressionAST *binary = ast->asBinaryExpression();
+ if (binary && tokenAt(binary->binary_op_token).kind() == T_PLUS)
+ return binary;
+ return 0;
+ }
+
+ bool hasCorrectType(ExpressionAST *ast)
+ {
+ if (StringLiteralAST *literal = ast->asStringLiteral()) {
+ _stringLiterals += literal;
+ return true;
+ }
+
+ if (PostfixExpressionAST *postfix = ast->asPostfixExpression()) {
+ if (postfix->base_expression && postfix->postfix_expression_list
+ && postfix->postfix_expression_list->value
+ && !postfix->postfix_expression_list->next)
+ {
+ NameAST *name = postfix->base_expression->asName();
+ CallAST *call = postfix->postfix_expression_list->value->asCall();
+ if (name && call) {
+ QByteArray nameStr(name->name->identifier()->chars());
+ if ((nameStr == "QLatin1String"
+ || nameStr == "QString"
+ || nameStr == "QByteArray")
+ && call->expression_list
+ && call->expression_list->value
+ && call->expression_list->value->asStringLiteral()
+ && !call->expression_list->next)
+ {
+ _incorrectlyWrappedLiterals += postfix;
+ return true;
+ }
+ }
+ }
+ }
+
+ const QList<LookupItem> &lookup = typeOf(ast);
+ if (lookup.isEmpty())
+ return false;
+ return isQtStringType(lookup[0].type());
+ }
+
+ bool isBuiltinStringType(FullySpecifiedType type)
+ {
+ // char*
+ if (PointerType *ptrTy = type->asPointerType())
+ if (IntegerType *intTy = ptrTy->elementType()->asIntegerType())
+ if (intTy->kind() == IntegerType::Char)
+ return true;
+ return false;
+ }
+
+ bool isQtStringType(FullySpecifiedType type)
+ {
+ if (NamedType *nameTy = type->asNamedType()) {
+ if (!nameTy->name() || !nameTy->name()->identifier())
+ return false;
+
+ QByteArray name(nameTy->name()->identifier()->chars());
+ if (name == "QString"
+ || name == "QByteArray"
+ || name == "QLatin1String"
+ || name == "QLatin1Literal"
+ || name == "QStringRef"
+ || name == "QChar"
+ )
+ return true;
+ }
+
+ return false;
+ }
+
+private:
+ QList<BinaryExpressionAST *> _binaryExpressions;
+ QList<StringLiteralAST *> _stringLiterals;
+ QList<PostfixExpressionAST *> _incorrectlyWrappedLiterals;
+};
+
} // end of anonymous namespace
@@ -1211,6 +1376,7 @@ int CPPQuickFixCollector::startCompletion(TextEditor::ITextEditable *editable)
QSharedPointer<FlipBinaryOp> flipBinaryOp(new FlipBinaryOp());
QSharedPointer<WrapStringLiteral> wrapStringLiteral(new WrapStringLiteral());
QSharedPointer<CStringToNSString> wrapCString(new CStringToNSString());
+ QSharedPointer<UseFastStringConcatenation> useFastStringConcat(new UseFastStringConcatenation());
QList<QuickFixOperationPtr> candidates;
candidates.append(rewriteLogicalAndOp);
@@ -1223,6 +1389,7 @@ int CPPQuickFixCollector::startCompletion(TextEditor::ITextEditable *editable)
candidates.append(flipBinaryOp);
candidates.append(wrapStringLiteral);
candidates.append(wrapCString);
+ candidates.append(useFastStringConcat);
QMap<int, QList<QuickFixOperationPtr> > matchedOps;
diff --git a/src/plugins/cvs/cvsconstants.h b/src/plugins/cvs/cvsconstants.h
index d2ae95e331..d661553c2e 100644
--- a/src/plugins/cvs/cvsconstants.h
+++ b/src/plugins/cvs/cvsconstants.h
@@ -37,7 +37,8 @@ const char * const CVS_SUBMIT_MIMETYPE = "application/vnd.nokia.text.cvs.submit"
const char * const CVSEDITOR = "CVS Editor";
const char * const CVSEDITOR_KIND = "CVS Editor";
const char * const CVSCOMMITEDITOR = "CVS Commit Editor";
-const char * const CVSCOMMITEDITOR_KIND = "CVS Commit Editor";
+const char * const CVSCOMMITEDITOR_ID = "CVS Commit Editor";
+const char * const CVSCOMMITEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "CVS Commit Editor");
const char * const SUBMIT_CURRENT = "CVS.SubmitCurrentLog";
const char * const DIFF_SELECTED = "CVS.DiffSelectedFilesInLog";
enum { debug = 0 };
diff --git a/src/plugins/cvs/cvsplugin.cpp b/src/plugins/cvs/cvsplugin.cpp
index 4a1bd30d70..929bd41b60 100644
--- a/src/plugins/cvs/cvsplugin.cpp
+++ b/src/plugins/cvs/cvsplugin.cpp
@@ -102,22 +102,26 @@ static const char * const CMD_ID_SEPARATOR4 = "CVS.Separator4";
static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{
VCSBase::RegularCommandOutput,
- "CVS Command Log Editor", // kind
+ "CVS Command Log Editor", // id
+ QT_TRANSLATE_NOOP("VCS", "CVS Command Log Editor"), // display name
"CVS Command Log Editor", // context
"application/vnd.nokia.text.scs_cvs_commandlog",
"scslog"},
{ VCSBase::LogOutput,
- "CVS File Log Editor", // kind
+ "CVS File Log Editor", // id
+ QT_TRANSLATE_NOOP("VCS", "CVS File Log Editor"), // display name
"CVS File Log Editor", // context
"application/vnd.nokia.text.scs_cvs_filelog",
"scsfilelog"},
{ VCSBase::AnnotateOutput,
- "CVS Annotation Editor", // kind
+ "CVS Annotation Editor", // id
+ QT_TRANSLATE_NOOP("VCS", "CVS Annotation Editor"), // display name
"CVS Annotation Editor", // context
"application/vnd.nokia.text.scs_cvs_annotation",
"scsannotate"},
{ VCSBase::DiffOutput,
- "CVS Diff Editor", // kind
+ "CVS Diff Editor", // id
+ QT_TRANSLATE_NOOP("VCS", "CVS Diff Editor"), // display name
"CVS Diff Editor", // context
"text/x-patch","diff"}
};
@@ -146,7 +150,7 @@ Core::IEditor* locateEditor(const char *property, const QString &entry)
CVSPlugin *CVSPlugin::m_cvsPluginInstance = 0;
CVSPlugin::CVSPlugin() :
- VCSBase::VCSBasePlugin(QLatin1String(CVS::Constants::CVSCOMMITEDITOR_KIND)),
+ VCSBase::VCSBasePlugin(QLatin1String(CVS::Constants::CVSCOMMITEDITOR_ID)),
m_addAction(0),
m_deleteAction(0),
m_revertAction(0),
@@ -189,7 +193,8 @@ bool CVSPlugin::isCommitEditorOpen() const
static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = {
CVS::Constants::CVS_SUBMIT_MIMETYPE,
- CVS::Constants::CVSCOMMITEDITOR_KIND,
+ CVS::Constants::CVSCOMMITEDITOR_ID,
+ CVS::Constants::CVSCOMMITEDITOR_DISPLAY_NAME,
CVS::Constants::CVSCOMMITEDITOR
};
@@ -478,7 +483,7 @@ void CVSPlugin::cvsDiff(const QString &workingDir, const QStringList &files)
CVSSubmitEditor *CVSPlugin::openCVSSubmitEditor(const QString &fileName)
{
- Core::IEditor *editor = Core::EditorManager::instance()->openEditor(fileName, QLatin1String(Constants::CVSCOMMITEDITOR_KIND));
+ Core::IEditor *editor = Core::EditorManager::instance()->openEditor(fileName, QLatin1String(Constants::CVSCOMMITEDITOR_ID));
CVSSubmitEditor *submitEditor = qobject_cast<CVSSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, /**/);
submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction);
diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp
index 72b92d2ef6..5761513bdd 100644
--- a/src/plugins/designer/formeditorw.cpp
+++ b/src/plugins/designer/formeditorw.cpp
@@ -105,33 +105,8 @@ static inline QIcon designerIcon(const QString &iconName)
return icon;
}
-// Create an action to activate a designer tool
-static inline QAction *createEditModeAction(QActionGroup *ag,
- const QList<int> &context,
- Core::ActionManager *am,
- Core::ActionContainer *medit,
- const QString &actionName,
- const QString &name,
- int toolNumber,
- const QString &iconName = QString(),
- const QString &keySequence = QString())
-{
- QAction *rc = new QAction(actionName, ag);
- rc->setCheckable(true);
- if (!iconName.isEmpty())
- rc->setIcon(designerIcon(iconName));
- Core::Command *command = am->registerAction(rc, name, context);
- if (!keySequence.isEmpty())
- command->setDefaultKeySequence(QKeySequence(keySequence));
- medit->addAction(command, Core::Constants::G_EDIT_OTHER);
- rc->setData(toolNumber);
- ag->addAction(rc);
- return rc;
-}
-
-
-// Create a menu separato
-static inline QAction * createSeparator(QObject *parent,
+// Create a menu separator
+static inline QAction *createSeparator(QObject *parent,
Core::ActionManager *am,
const QList<int> &context,
Core::ActionContainer *container,
@@ -145,20 +120,6 @@ static inline QAction * createSeparator(QObject *parent,
return actSeparator;
}
-// Create a tool action
-static inline void addToolAction(QAction *a,
- Core::ActionManager *am,
- const QList<int> &context,
- const QString &name,
- Core::ActionContainer *c1,
- const QString &keySequence = QString())
-{
- Core::Command *command = am->registerAction(a, name, context);
- if (!keySequence.isEmpty())
- command->setDefaultKeySequence(QKeySequence(keySequence));
- c1->addAction(command);
-}
-
using namespace Designer;
using namespace Designer::Internal;
using namespace Designer::Constants;
@@ -237,7 +198,8 @@ FormEditorW::FormEditorW() :
m_actionPrint(0),
m_actionPreview(0),
m_actionGroupPreviewInStyle(0),
- m_actionAboutPlugins(0)
+ m_actionAboutPlugins(0),
+ m_shortcutMapper(new QSignalMapper(this))
{
if (Designer::Constants::Internal::debug)
qDebug() << Q_FUNC_INFO;
@@ -270,6 +232,8 @@ FormEditorW::FormEditorW() :
connect(m_core->editorManager(), SIGNAL(currentEditorChanged(Core::IEditor *)),
this, SLOT(currentEditorChanged(Core::IEditor *)));
+ connect(m_shortcutMapper, SIGNAL(mapped(QObject *)),
+ this, SLOT(updateShortcut(QObject *)));
}
FormEditorW::~FormEditorW()
@@ -397,20 +361,21 @@ void FormEditorW::setupActions()
mtools->addMenu(mformtools);
//overridden actions
- am->registerAction(m_fwm->actionUndo(), Core::Constants::UNDO, m_context);
- am->registerAction(m_fwm->actionRedo(), Core::Constants::REDO, m_context);
- am->registerAction(m_fwm->actionCut(), Core::Constants::CUT, m_context);
- am->registerAction(m_fwm->actionCopy(), Core::Constants::COPY, m_context);
- am->registerAction(m_fwm->actionPaste(), Core::Constants::PASTE, m_context);
- am->registerAction(m_fwm->actionSelectAll(), Core::Constants::SELECTALL, m_context);
+ bindShortcut(am->registerAction(m_fwm->actionUndo(), Core::Constants::UNDO, m_context), m_fwm->actionUndo());
+ bindShortcut(am->registerAction(m_fwm->actionRedo(), Core::Constants::REDO, m_context), m_fwm->actionRedo());
+ bindShortcut(am->registerAction(m_fwm->actionCut(), Core::Constants::CUT, m_context), m_fwm->actionCut());
+ bindShortcut(am->registerAction(m_fwm->actionCopy(), Core::Constants::COPY, m_context), m_fwm->actionCopy());
+ bindShortcut(am->registerAction(m_fwm->actionPaste(), Core::Constants::PASTE, m_context), m_fwm->actionPaste());
+ bindShortcut(am->registerAction(m_fwm->actionSelectAll(), Core::Constants::SELECTALL, m_context), m_fwm->actionSelectAll());
m_actionPrint = new QAction(this);
- am->registerAction(m_actionPrint, Core::Constants::PRINT, m_context);
+ bindShortcut(am->registerAction(m_actionPrint, Core::Constants::PRINT, m_context), m_actionPrint);
connect(m_actionPrint, SIGNAL(triggered()), this, SLOT(print()));
//'delete' action
command = am->registerAction(m_fwm->actionDelete(), QLatin1String("FormEditor.Edit.Delete"), m_context);
command->setDefaultKeySequence(QKeySequence::Delete);
+ bindShortcut(command, m_fwm->actionDelete());
command->setAttribute(Core::Command::CA_Hide);
medit->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
@@ -613,6 +578,7 @@ Core::ActionContainer *FormEditorW::createPreviewStyleMenu(Core::ActionManager *
}
name += data.toString();
Core::Command *command = am->registerAction(a, name, m_context);
+ bindShortcut(command, a);
if (isDeviceProfile) {
command->setAttribute(Core::Command::CA_UpdateText);
command->setAttribute(Core::Command::CA_NonConfigureable);
@@ -642,6 +608,56 @@ void FormEditorW::critical(const QString &errorMessage)
QMessageBox::critical(m_core->mainWindow(), tr("Designer"), errorMessage);
}
+// Apply the command shortcut to the action and connects to the command's keySequenceChanged signal
+void FormEditorW::bindShortcut(Core::Command *command, QAction *action)
+{
+ m_commandToDesignerAction.insert(command, action);
+ connect(command, SIGNAL(keySequenceChanged()),
+ m_shortcutMapper, SLOT(map()));
+ m_shortcutMapper->setMapping(command, command);
+ updateShortcut(command);
+}
+
+// Create an action to activate a designer tool
+QAction *FormEditorW::createEditModeAction(QActionGroup *ag,
+ const QList<int> &context,
+ Core::ActionManager *am,
+ Core::ActionContainer *medit,
+ const QString &actionName,
+ const QString &name,
+ int toolNumber,
+ const QString &iconName,
+ const QString &keySequence)
+{
+ QAction *rc = new QAction(actionName, ag);
+ rc->setCheckable(true);
+ if (!iconName.isEmpty())
+ rc->setIcon(designerIcon(iconName));
+ Core::Command *command = am->registerAction(rc, name, context);
+ if (!keySequence.isEmpty())
+ command->setDefaultKeySequence(QKeySequence(keySequence));
+ bindShortcut(command, rc);
+ medit->addAction(command, Core::Constants::G_EDIT_OTHER);
+ rc->setData(toolNumber);
+ ag->addAction(rc);
+ return rc;
+}
+
+// Create a tool action
+void FormEditorW::addToolAction(QAction *a,
+ Core::ActionManager *am,
+ const QList<int> &context,
+ const QString &name,
+ Core::ActionContainer *c1,
+ const QString &keySequence)
+{
+ Core::Command *command = am->registerAction(a, name, context);
+ if (!keySequence.isEmpty())
+ command->setDefaultKeySequence(QKeySequence(keySequence));
+ bindShortcut(command, a);
+ c1->addAction(command);
+}
+
FormWindowEditor *FormEditorW::createFormWindowEditor(QWidget* parentWidget)
{
m_fwm->closeAllPreviews();
@@ -673,6 +689,17 @@ void FormEditorW::editorDestroyed()
}
}
+void FormEditorW::updateShortcut(QObject *command)
+{
+ Core::Command *c = qobject_cast<Core::Command *>(command);
+ if (!c)
+ return;
+ QAction *a = m_commandToDesignerAction.value(c);
+ if (!a)
+ return;
+ a->setShortcut(c->action()->shortcut());
+}
+
void FormEditorW::currentEditorChanged(Core::IEditor *editor)
{
if (Designer::Constants::Internal::debug)
diff --git a/src/plugins/designer/formeditorw.h b/src/plugins/designer/formeditorw.h
index e592cfacf2..b3293b5207 100644
--- a/src/plugins/designer/formeditorw.h
+++ b/src/plugins/designer/formeditorw.h
@@ -36,6 +36,7 @@
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <QtCore/QStringList>
+#include <QtCore/QSignalMapper>
#include <QtGui/QAction>
#include "designerconstants.h"
@@ -65,6 +66,7 @@ class ActionManager;
class ActionContainer;
class ICore;
class IEditor;
+class Command;
}
namespace Designer {
@@ -141,6 +143,7 @@ private slots:
void resetToDefaultLayout();
void editorDestroyed();
+ void updateShortcut(QObject *command);
private:
FormEditorW();
@@ -158,6 +161,23 @@ private:
QActionGroup *actionGroup);
void critical(const QString &errorMessage);
+ void bindShortcut(Core::Command *command, QAction *action);
+ QAction *createEditModeAction(QActionGroup *ag,
+ const QList<int> &context,
+ Core::ActionManager *am,
+ Core::ActionContainer *medit,
+ const QString &actionName,
+ const QString &name,
+ int toolNumber,
+ const QString &iconName = QString(),
+ const QString &keySequence = QString());
+ void addToolAction(QAction *a,
+ Core::ActionManager *am,
+ const QList<int> &context,
+ const QString &name,
+ Core::ActionContainer *c1,
+ const QString &keySequence = QString());
+
static FormEditorW *m_self;
@@ -184,6 +204,8 @@ private:
EditorList m_formWindows;
QStringList m_toolActionIds;
+ QSignalMapper *m_shortcutMapper;
+ QMap<Core::Command *, QAction *> m_commandToDesignerAction;
};
} // namespace Internal
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index ff152c5b1b..04d5b473c4 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -152,7 +152,7 @@ QString GitClient::findRepositoryForDirectory(const QString &dir)
* existing instance and to reuse it (in case, say, 'git diff foo' is
* already open). */
VCSBase::VCSBaseEditor
- *GitClient::createVCSEditor(const QString &kind,
+ *GitClient::createVCSEditor(const QString &id,
QString title,
// Source file or directory
const QString &source,
@@ -170,7 +170,7 @@ VCSBase::VCSBaseEditor
QTC_ASSERT(rc, return 0);
} else {
// Create new, set wait message, set up with source and codec
- outputEditor = m_core->editorManager()->openEditorWithContents(kind, &title, m_msgWait);
+ outputEditor = m_core->editorManager()->openEditorWithContents(id, &title, m_msgWait);
outputEditor->file()->setProperty(registerDynamicProperty, dynamicPropertyValue);
rc = VCSBase::VCSBaseEditor::getVcsBaseEditor(outputEditor);
connect(rc, SIGNAL(annotateRevisionRequested(QString,QString,int)),
@@ -194,10 +194,10 @@ void GitClient::diff(const QString &workingDirectory,
qDebug() << "diff" << workingDirectory << unstagedFileNames << stagedFileNames;
const QString binary = QLatin1String(Constants::GIT_BINARY);
- const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND);
+ const QString editorId = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_ID);
const QString title = tr("Git Diff");
- VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, workingDirectory, true, "originalFileName", workingDirectory);
+ VCSBase::VCSBaseEditor *editor = createVCSEditor(editorId, title, workingDirectory, true, "originalFileName", workingDirectory);
editor->setDiffBaseDirectory(workingDirectory);
// Create a batch of 2 commands to be run after each other in case
@@ -241,10 +241,10 @@ void GitClient::diff(const QString &workingDirectory,
if (!fileName.isEmpty())
arguments << diffArgs << QLatin1String("--") << fileName;
- const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND);
+ const QString editorId = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_ID);
const QString title = tr("Git Diff %1").arg(fileName);
const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, fileName);
- VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, true, "originalFileName", sourceFile);
+ VCSBase::VCSBaseEditor *editor = createVCSEditor(editorId, title, sourceFile, true, "originalFileName", sourceFile);
executeGit(workingDirectory, arguments, editor);
}
@@ -260,6 +260,29 @@ void GitClient::status(const QString &workingDirectory)
Qt::QueuedConnection);
}
+static const char graphLogFormatC[] = "%h %an %s %ci";
+
+// Create a graphical log.
+void GitClient::graphLog(const QString &workingDirectory)
+{
+ if (Git::Constants::debug)
+ qDebug() << "log" << workingDirectory;
+
+ QStringList arguments;
+ arguments << QLatin1String("log") << QLatin1String(noColorOption);
+
+ if (m_settings.logCount > 0)
+ arguments << QLatin1String("-n") << QString::number(m_settings.logCount);
+ arguments << (QLatin1String("--pretty=format:") + QLatin1String(graphLogFormatC))
+ << QLatin1String("--topo-order") << QLatin1String("--graph");
+
+ const QString title = tr("Git Log");
+ const QString editorId = QLatin1String(Git::Constants::GIT_LOG_EDITOR_ID);
+ const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, QStringList());
+ VCSBase::VCSBaseEditor *editor = createVCSEditor(editorId, title, sourceFile, false, "logFileName", sourceFile);
+ executeGit(workingDirectory, arguments, editor);
+}
+
void GitClient::log(const QString &workingDirectory, const QStringList &fileNames, bool enableAnnotationContextMenu)
{
if (Git::Constants::debug)
@@ -277,9 +300,9 @@ void GitClient::log(const QString &workingDirectory, const QStringList &fileName
const QString msgArg = fileNames.empty() ? workingDirectory :
fileNames.join(QString(", "));
const QString title = tr("Git Log %1").arg(msgArg);
- const QString kind = QLatin1String(Git::Constants::GIT_LOG_EDITOR_KIND);
+ const QString editorId = QLatin1String(Git::Constants::GIT_LOG_EDITOR_ID);
const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, fileNames);
- VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, false, "logFileName", sourceFile);
+ VCSBase::VCSBaseEditor *editor = createVCSEditor(editorId, title, sourceFile, false, "logFileName", sourceFile);
editor->setFileLogAnnotateEnabled(enableAnnotationContextMenu);
executeGit(workingDirectory, arguments, editor);
}
@@ -292,8 +315,8 @@ void GitClient::show(const QString &source, const QString &id)
arguments << QLatin1String("show") << QLatin1String(noColorOption) << id;
const QString title = tr("Git Show %1").arg(id);
- const QString kind = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_KIND);
- VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, source, true, "show", id);
+ const QString editorId = QLatin1String(Git::Constants::GIT_DIFF_EDITOR_ID);
+ VCSBase::VCSBaseEditor *editor = createVCSEditor(editorId, title, source, true, "show", id);
const QFileInfo sourceFi(source);
const QString workDir = sourceFi.isDir() ? sourceFi.absoluteFilePath() : sourceFi.absolutePath();
@@ -325,12 +348,12 @@ void GitClient::blame(const QString &workingDirectory,
arguments << QLatin1String("--") << fileName;
if (!revision.isEmpty())
arguments << revision;
- const QString kind = QLatin1String(Git::Constants::GIT_BLAME_EDITOR_KIND);
+ const QString editorId = QLatin1String(Git::Constants::GIT_BLAME_EDITOR_ID);
const QString id = VCSBase::VCSBaseEditor::getTitleId(workingDirectory, QStringList(fileName), revision);
const QString title = tr("Git Blame %1").arg(id);
const QString sourceFile = VCSBase::VCSBaseEditor::getSource(workingDirectory, fileName);
- VCSBase::VCSBaseEditor *editor = createVCSEditor(kind, title, sourceFile, true, "blameFileName", id);
+ VCSBase::VCSBaseEditor *editor = createVCSEditor(editorId, title, sourceFile, true, "blameFileName", id);
executeGit(workingDirectory, arguments, editor, false, GitCommand::NoReport, lineNumber);
}
diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h
index c086e88a24..54be3a2e38 100644
--- a/src/plugins/git/gitclient.h
+++ b/src/plugins/git/gitclient.h
@@ -79,6 +79,7 @@ public:
const QStringList &unstagedFileNames, const QStringList &stagedFileNames= QStringList());
void status(const QString &workingDirectory);
+ void graphLog(const QString &workingDirectory);
void log(const QString &workingDirectory, const QStringList &fileNames,
bool enableAnnotationContextMenu = false);
void blame(const QString &workingDirectory, const QString &fileName,
diff --git a/src/plugins/git/gitconstants.h b/src/plugins/git/gitconstants.h
index eb4086f017..d03832fe06 100644
--- a/src/plugins/git/gitconstants.h
+++ b/src/plugins/git/gitconstants.h
@@ -30,20 +30,27 @@
#ifndef GIT_CONSTANTS_H
#define GIT_CONSTANTS_H
+#include <QtCore/QtGlobal>
+
namespace Git {
namespace Constants {
-const char * const GIT_COMMAND_LOG_EDITOR_KIND = "Git Command Log Editor";
+const char * const GIT_COMMAND_LOG_EDITOR_ID = "Git Command Log Editor";
+const char * const GIT_COMMAND_LOG_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "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_ID = "Git File Log Editor";
+const char * const GIT_LOG_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "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_ID = "Git Annotation Editor";
+const char * const GIT_BLAME_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "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_ID = "Git Diff Editor";
+const char * const GIT_DIFF_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Git Diff Editor");
const char * const C_GIT_DIFF_EDITOR = "Git Diff Editor";
const char * const C_GITSUBMITEDITOR = "Git Submit Editor";
-const char * const GITSUBMITEDITOR_KIND = "Git Submit Editor";
+const char * const GITSUBMITEDITOR_ID = "Git Submit Editor";
+const char * const GITSUBMITEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Git Submit Editor");
const char * const SUBMIT_CURRENT = "Git.SubmitCurrentLog";
const char * const DIFF_SELECTED = "Git.DiffSelectedFilesInLog";
const char * const SUBMIT_MIMETYPE = "application/vnd.nokia.text.git.submit";
diff --git a/src/plugins/git/giteditor.cpp b/src/plugins/git/giteditor.cpp
index db10366140..b50b1dfe74 100644
--- a/src/plugins/git/giteditor.cpp
+++ b/src/plugins/git/giteditor.cpp
@@ -50,7 +50,7 @@
#include <QtGui/QTextCursor>
#include <QtGui/QTextEdit>
-#define CHANGE_PATTERN_8C "[a-f0-9]{8,8}"
+#define CHANGE_PATTERN_8C "[a-f0-9]{7,8}"
#define CHANGE_PATTERN_40C "[a-f0-9]{40,40}"
namespace Git {
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index eb1d835026..7227085a36 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -71,22 +71,26 @@
static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{
VCSBase::RegularCommandOutput,
- Git::Constants::GIT_COMMAND_LOG_EDITOR_KIND,
+ Git::Constants::GIT_COMMAND_LOG_EDITOR_ID,
+ Git::Constants::GIT_COMMAND_LOG_EDITOR_DISPLAY_NAME,
Git::Constants::C_GIT_COMMAND_LOG_EDITOR,
"application/vnd.nokia.text.scs_git_commandlog",
"gitlog"},
{ VCSBase::LogOutput,
- Git::Constants::GIT_LOG_EDITOR_KIND,
+ Git::Constants::GIT_LOG_EDITOR_ID,
+ Git::Constants::GIT_LOG_EDITOR_DISPLAY_NAME,
Git::Constants::C_GIT_LOG_EDITOR,
"application/vnd.nokia.text.scs_git_filelog",
"gitfilelog"},
{ VCSBase::AnnotateOutput,
- Git::Constants::GIT_BLAME_EDITOR_KIND,
+ Git::Constants::GIT_BLAME_EDITOR_ID,
+ Git::Constants::GIT_BLAME_EDITOR_DISPLAY_NAME,
Git::Constants::C_GIT_BLAME_EDITOR,
"application/vnd.nokia.text.scs_git_annotation",
"gitsannotate"},
{ VCSBase::DiffOutput,
- Git::Constants::GIT_DIFF_EDITOR_KIND,
+ Git::Constants::GIT_DIFF_EDITOR_ID,
+ Git::Constants::GIT_DIFF_EDITOR_DISPLAY_NAME,
Git::Constants::C_GIT_DIFF_EDITOR,
"text/x-patch","diff"}
};
@@ -106,7 +110,7 @@ using namespace Git::Internal;
GitPlugin *GitPlugin::m_instance = 0;
GitPlugin::GitPlugin() :
- VCSBase::VCSBasePlugin(QLatin1String(Git::Constants::GITSUBMITEDITOR_KIND)),
+ VCSBase::VCSBasePlugin(QLatin1String(Git::Constants::GITSUBMITEDITOR_ID)),
m_core(0),
m_diffAction(0),
m_diffProjectAction(0),
@@ -116,6 +120,7 @@ GitPlugin::GitPlugin() :
m_blameAction(0),
m_logProjectAction(0),
m_undoFileAction(0),
+ m_logRepositoryAction(0),
m_undoRepositoryAction(0),
m_showAction(0),
m_stageAction(0),
@@ -166,7 +171,8 @@ GitPlugin *GitPlugin::instance()
static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = {
Git::Constants::SUBMIT_MIMETYPE,
- Git::Constants::GITSUBMITEDITOR_KIND,
+ Git::Constants::GITSUBMITEDITOR_ID,
+ Git::Constants::GITSUBMITEDITOR_DISPLAY_NAME,
Git::Constants::C_GITSUBMITEDITOR
};
@@ -290,9 +296,13 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage)
connect(m_statusRepositoryAction, SIGNAL(triggered()), this, SLOT(statusRepository()));
gitContainer->addAction(command);
+ m_logRepositoryAction = new QAction(tr("Log Repository"), this);
+ command = actionManager->registerAction(m_logRepositoryAction, "Git.LogRepository", globalcontext);
+ connect(m_logRepositoryAction, SIGNAL(triggered()), this, SLOT(logRepository()));
+ gitContainer->addAction(command);
+
m_undoRepositoryAction = new QAction(tr("Undo Repository Changes"), this);
command = actionManager->registerAction(m_undoRepositoryAction, "Git.UndoRepository", globalcontext);
- command->setAttribute(Core::Command::CA_UpdateText);
connect(m_undoRepositoryAction, SIGNAL(triggered()), this, SLOT(undoRepositoryChanges()));
gitContainer->addAction(command);
@@ -443,6 +453,13 @@ void GitPlugin::undoFileChanges()
m_gitClient->revert(QStringList(state.currentFile()));
}
+void GitPlugin::logRepository()
+{
+ const VCSBase::VCSBasePluginState state = currentState();
+ QTC_ASSERT(state.hasTopLevel(), return)
+ m_gitClient->graphLog(state.topLevel());
+}
+
void GitPlugin::undoRepositoryChanges()
{
const VCSBase::VCSBasePluginState state = currentState();
@@ -518,7 +535,7 @@ void GitPlugin::startCommit()
Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &cd)
{
- Core::IEditor *editor = m_core->editorManager()->openEditor(fileName, QLatin1String(Constants::GITSUBMITEDITOR_KIND));
+ Core::IEditor *editor = m_core->editorManager()->openEditor(fileName, QLatin1String(Constants::GITSUBMITEDITOR_ID));
if (Git::Constants::debug)
qDebug() << Q_FUNC_INFO << fileName << editor;
m_core->editorManager()->ensureEditorManagerVisible();
@@ -685,7 +702,6 @@ void GitPlugin::updateActions(VCSBase::VCSBasePlugin::ActionState as)
m_diffProjectAction->setParameter(projectName);
m_logProjectAction->setEnabled(projectEnabled);
m_logProjectAction->setParameter(projectName);
- m_undoRepositoryAction->setEnabled(projectEnabled);
const bool repositoryEnabled = currentState().hasTopLevel();
m_diffRepositoryAction->setEnabled(repositoryEnabled);
@@ -693,6 +709,8 @@ void GitPlugin::updateActions(VCSBase::VCSBasePlugin::ActionState as)
m_branchListAction->setEnabled(repositoryEnabled);
m_stashListAction->setEnabled(repositoryEnabled);
m_stashPopAction->setEnabled(repositoryEnabled);
+ m_logRepositoryAction->setEnabled(repositoryEnabled);
+ m_undoRepositoryAction->setEnabled(repositoryEnabled);
// Prompts for repo.
m_showAction->setEnabled(true);
diff --git a/src/plugins/git/gitplugin.h b/src/plugins/git/gitplugin.h
index 924ccf9f29..d89290841d 100644
--- a/src/plugins/git/gitplugin.h
+++ b/src/plugins/git/gitplugin.h
@@ -96,6 +96,7 @@ private slots:
void blameFile();
void logProject();
void undoFileChanges();
+ void logRepository();
void undoRepositoryChanges();
void stageFile();
void unstageFile();
@@ -128,7 +129,9 @@ private:
Utils::ParameterAction *m_blameAction;
Utils::ParameterAction *m_logProjectAction;
Utils::ParameterAction *m_undoFileAction;
+ QAction *m_logRepositoryAction;
QAction *m_undoRepositoryAction;
+
QAction *m_showAction;
Utils::ParameterAction *m_stageAction;
Utils::ParameterAction *m_unstageAction;
diff --git a/src/plugins/git/gitsettings.cpp b/src/plugins/git/gitsettings.cpp
index 0e302d098a..13277d225d 100644
--- a/src/plugins/git/gitsettings.cpp
+++ b/src/plugins/git/gitsettings.cpp
@@ -45,7 +45,7 @@ static const char *promptToSubmitKeyC = "PromptForSubmit";
static const char *omitAnnotationDateKeyC = "OmitAnnotationDate";
static const char *spaceIgnorantBlameKeyC = "SpaceIgnorantBlame";
-enum { defaultLogCount = 10 , defaultTimeOut = 30};
+enum { defaultLogCount = 100 , defaultTimeOut = 30};
namespace Git {
namespace Internal {
diff --git a/src/plugins/mercurial/constants.h b/src/plugins/mercurial/constants.h
index 5e8c8879eb..aa6b1fc333 100644
--- a/src/plugins/mercurial/constants.h
+++ b/src/plugins/mercurial/constants.h
@@ -54,24 +54,33 @@ const char * const CHANGEIDEXACT40 = "[a-f0-9]{40,40}";
const char * const DIFFIDENTIFIER = "^[-+]{3,3} [ab]{1,1}.*"; // match e.g. +++ b/filename
//BaseEditorParameters
+const char * const COMMANDLOG_ID = "Mercurial Command Log Editor";
+const char * const COMMANDLOG_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Mercurial Command Log Editor");
const char * const COMMANDLOG = "Mercurial Command Log Editor";
const char * const COMMANDAPP = "application/vnd.nokia.text.scs_mercurial_commandlog";
const char * const COMMANDEXT = "vcsMercurialCommand";
+const char * const FILELOG_ID = "Mercurial File Log Editor";
+const char * const FILELOG_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Mercurial File Log Editor");
const char * const FILELOG = "Mercurial File Log Editor";
const char * const LOGAPP = "application/vnd.nokia.text.scs_mercurial_log";
const char * const LOGEXT = "vcsMercurialLog";
+const char * const ANNOTATELOG_ID = "Mercurial Annotation Editor";
+const char * const ANNOTATELOG_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Mercurial Annotation Editor");
const char * const ANNOTATELOG = "Mercurial Annotation Editor";
const char * const ANNOTATEAPP = "application/vnd.nokia.text.scs_mercurial_annotatelog";
const char * const ANNOTATEEXT = "vcsMercurialAnnotate";
+const char * const DIFFLOG_ID = "Mercurial Diff Editor";
+const char * const DIFFLOG_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Mercurial Diff Editor");
const char * const DIFFLOG = "Mercurial Diff Editor";
const char * const DIFFAPP = "text/x-patch";
const char * const DIFFEXT = "diff";
//SubmitEditorParameters
-const char * const COMMITKIND = "Mercurial Commit Log Editor";
+const char * const COMMIT_ID = "Mercurial Commit Log Editor";
+const char * const COMMIT_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Mercurial Commit Log Editor");
const char * const COMMITMIMETYPE = "application/vnd.nokia.text.scs_mercurial_commitlog";
//menu items
diff --git a/src/plugins/mercurial/mercurialplugin.cpp b/src/plugins/mercurial/mercurialplugin.cpp
index 29c9f0f8d2..a0cc330953 100644
--- a/src/plugins/mercurial/mercurialplugin.cpp
+++ b/src/plugins/mercurial/mercurialplugin.cpp
@@ -74,25 +74,29 @@ using namespace Mercurial;
static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{
VCSBase::RegularCommandOutput, //type
- Constants::COMMANDLOG, // kind
+ Constants::COMMANDLOG_ID, // id
+ Constants::COMMANDLOG_DISPLAY_NAME, // display name
Constants::COMMANDLOG, // context
Constants::COMMANDAPP, // mime type
Constants::COMMANDEXT}, //extension
{ VCSBase::LogOutput,
- Constants::FILELOG,
+ Constants::FILELOG_ID,
+ Constants::FILELOG_DISPLAY_NAME,
Constants::FILELOG,
Constants::LOGAPP,
Constants::LOGEXT},
{ VCSBase::AnnotateOutput,
- Constants::ANNOTATELOG,
+ Constants::ANNOTATELOG_ID,
+ Constants::ANNOTATELOG_DISPLAY_NAME,
Constants::ANNOTATELOG,
Constants::ANNOTATEAPP,
Constants::ANNOTATEEXT},
{ VCSBase::DiffOutput,
- Constants::DIFFLOG,
+ Constants::DIFFLOG_ID,
+ Constants::DIFFLOG_DISPLAY_NAME,
Constants::DIFFLOG,
Constants::DIFFAPP,
Constants::DIFFEXT}
@@ -100,8 +104,9 @@ static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
static const VCSBase::VCSBaseSubmitEditorParameters submitEditorParameters = {
Constants::COMMITMIMETYPE,
- Constants::COMMITKIND,
- Constants::COMMITKIND
+ Constants::COMMIT_ID,
+ Constants::COMMIT_DISPLAY_NAME,
+ Constants::COMMIT_ID
};
// Utility to find a parameter set by type
@@ -115,7 +120,7 @@ static inline const VCSBase::VCSBaseEditorParameters *findType(int ie)
MercurialPlugin *MercurialPlugin::m_instance = 0;
MercurialPlugin::MercurialPlugin() :
- VCSBase::VCSBasePlugin(QLatin1String(Constants::COMMITKIND)),
+ VCSBase::VCSBasePlugin(QLatin1String(Constants::COMMIT_ID)),
optionsPage(0),
m_client(0),
changeLog(0),
@@ -475,7 +480,7 @@ void MercurialPlugin::outgoing()
void MercurialPlugin::createSubmitEditorActions()
{
- QList<int> context = QList<int>()<< core->uniqueIDManager()->uniqueIdentifier(QLatin1String(Constants::COMMITKIND));
+ QList<int> context = QList<int>()<< core->uniqueIDManager()->uniqueIdentifier(QLatin1String(Constants::COMMIT_ID));
Core::Command *command;
editorCommit = new QAction(VCSBase::VCSBaseSubmitEditor::submitIcon(), tr("Commit"), this);
@@ -529,7 +534,7 @@ void MercurialPlugin::showCommitWidget(const QList<QPair<QString, QString> > &st
}
Core::IEditor *editor = core->editorManager()->openEditor(changeLog->fileName(),
- QLatin1String(Constants::COMMITKIND));
+ QLatin1String(Constants::COMMIT_ID));
if (!editor) {
outputWindow->appendError(tr("Unable to create an editor for the commit."));
return;
diff --git a/src/plugins/perforce/perforceconstants.h b/src/plugins/perforce/perforceconstants.h
index 0da66fd2af..43b1c2a064 100644
--- a/src/plugins/perforce/perforceconstants.h
+++ b/src/plugins/perforce/perforceconstants.h
@@ -30,24 +30,31 @@
#ifndef PERFORCE_CONSTANTS_H
#define PERFORCE_CONSTANTS_H
+#include <QtCore/QtGlobal>
+
namespace Perforce {
namespace Constants {
const char * const PERFORCEEDITOR_CONTEXT = "Perforce Editor";
const char * const PERFORCE_SUBMIT_EDITOR_ID = "Perforce.SubmitEditor";
+const char * const PERFORCE_SUBMIT_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Perforce.SubmitEditor");
const char * const PERFORCESUBMITEDITOR_CONTEXT = "Perforce Submit Editor";
const char * const PERFORCE_COMMANDLOG_EDITOR_ID = "Perfoirce.CommandLogEditor";
+const char * const PERFORCE_COMMANDLOG_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Perforce CommandLog Editor");
const char * const PERFORCE_COMMANDLOG_EDITOR_CONTEXT = "Perforce Command Log Editor";
const char * const PERFORCE_LOG_EDITOR_ID = "Perforce.LogEditor";
+const char * const PERFORCE_LOG_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Perforce Log Editor");
const char * const PERFORCE_LOG_EDITOR_CONTEXT = "Perforce Log Editor";
const char * const PERFORCE_DIFF_EDITOR_ID = "Perforce.DiffEditor";
+const char * const PERFORCE_DIFF_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Perforce Diff Editor");
const char * const PERFORCE_DIFF_EDITOR_CONTEXT = "Perforce Diff Editor";
const char * const PERFORCE_ANNOTATION_EDITOR_ID = "Perforce.AnnotationEditor";
+const char * const PERFORCE_ANNOTATION_EDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Perforce Annotation Editor");
const char * const PERFORCE_ANNOTATION_EDITOR_CONTEXT = "Perforce Annotation Editor";
const char * const SUBMIT_CURRENT = "Perforce.SubmitCurrentLog";
diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp
index e7f05c3c76..d2a37da631 100644
--- a/src/plugins/perforce/perforceplugin.cpp
+++ b/src/plugins/perforce/perforceplugin.cpp
@@ -72,21 +72,25 @@ static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{
VCSBase::RegularCommandOutput,
Perforce::Constants::PERFORCE_COMMANDLOG_EDITOR_ID,
+ Perforce::Constants::PERFORCE_COMMANDLOG_EDITOR_DISPLAY_NAME,
Perforce::Constants::PERFORCE_COMMANDLOG_EDITOR_CONTEXT,
"application/vnd.nokia.text.scs_commandlog",
"scslog"},
{ VCSBase::LogOutput,
Perforce::Constants::PERFORCE_LOG_EDITOR_ID,
+ Perforce::Constants::PERFORCE_LOG_EDITOR_DISPLAY_NAME,
Perforce::Constants::PERFORCE_LOG_EDITOR_CONTEXT,
"application/vnd.nokia.text.scs_filelog",
"scsfilelog"},
{ VCSBase::AnnotateOutput,
Perforce::Constants::PERFORCE_ANNOTATION_EDITOR_ID,
+ Perforce::Constants::PERFORCE_ANNOTATION_EDITOR_DISPLAY_NAME,
Perforce::Constants::PERFORCE_ANNOTATION_EDITOR_CONTEXT,
"application/vnd.nokia.text.scs_annotation",
"scsannotate"},
{ VCSBase::DiffOutput,
Perforce::Constants::PERFORCE_DIFF_EDITOR_ID,
+ Perforce::Constants::PERFORCE_DIFF_EDITOR_DISPLAY_NAME,
Perforce::Constants::PERFORCE_DIFF_EDITOR_CONTEXT,
"text/x-patch","diff"}
};
@@ -205,6 +209,7 @@ PerforcePlugin::PerforcePlugin() :
static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = {
Perforce::Constants::SUBMIT_MIMETYPE,
Perforce::Constants::PERFORCE_SUBMIT_EDITOR_ID,
+ Perforce::Constants::PERFORCE_SUBMIT_EDITOR_DISPLAY_NAME,
Perforce::Constants::PERFORCESUBMITEDITOR_CONTEXT
};
diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
index ac03deb646..70f84584fd 100644
--- a/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
+++ b/src/plugins/projectexplorer/buildsettingspropertiespage.cpp
@@ -168,6 +168,17 @@ void BuildSettingsWidget::setupUi()
connect(m_project, SIGNAL(activeBuildConfigurationChanged()),
this, SLOT(checkMakeActiveLabel()));
+ connect(m_project, SIGNAL(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
+ this, SLOT(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
+
+ connect(m_project, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
+ this, SLOT(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
+
+ foreach (BuildConfiguration *bc, m_project->buildConfigurations()) {
+ connect(bc, SIGNAL(displayNameChanged()),
+ this, SLOT(buildConfigurationDisplayNameChanged()));
+ }
+
if (m_project->buildConfigurationFactory())
connect(m_project->buildConfigurationFactory(), SIGNAL(availableCreationIdsChanged()), SLOT(updateAddButtonMenu()));
@@ -175,6 +186,27 @@ void BuildSettingsWidget::setupUi()
updateBuildSettings();
}
+void BuildSettingsWidget::addedBuildConfiguration(BuildConfiguration *bc)
+{
+ connect(bc, SIGNAL(displayNameChanged()),
+ this, SLOT(buildConfigurationDisplayNameChanged()));
+}
+
+void BuildSettingsWidget::removedBuildConfiguration(BuildConfiguration *bc)
+{
+ disconnect(bc, SIGNAL(displayNameChanged()),
+ this, SLOT(buildConfigurationDisplayNameChanged()));
+}
+
+void BuildSettingsWidget::buildConfigurationDisplayNameChanged()
+{
+ for (int i = 0; i < m_buildConfigurationComboBox->count(); ++i) {
+ BuildConfiguration *bc = m_buildConfigurationComboBox->itemData(i).value<BuildConfiguration *>();
+ m_buildConfigurationComboBox->setItemText(i, bc->displayName());
+ }
+ checkMakeActiveLabel();
+}
+
void BuildSettingsWidget::addSubWidget(const QString &name, QWidget *widget)
{
widget->setContentsMargins(m_leftMargin, 10, 0, 0);
@@ -260,9 +292,6 @@ void BuildSettingsWidget::updateBuildSettings()
m_buildConfigurationComboBox->blockSignals(blocked);
- // TODO Restore position, entry from combbox
- // TODO? select entry from combobox ?
-
activeBuildConfigurationChanged();
}
diff --git a/src/plugins/projectexplorer/buildsettingspropertiespage.h b/src/plugins/projectexplorer/buildsettingspropertiespage.h
index 5a805f3e77..9b1321edcc 100644
--- a/src/plugins/projectexplorer/buildsettingspropertiespage.h
+++ b/src/plugins/projectexplorer/buildsettingspropertiespage.h
@@ -98,6 +98,9 @@ private slots:
void setupUi();
+ void addedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
+ void removedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
+ void buildConfigurationDisplayNameChanged();
private:
void cloneConfiguration(BuildConfiguration *toClone);
void deleteConfiguration(BuildConfiguration *toDelete);
diff --git a/src/plugins/projectexplorer/outputwindow.cpp b/src/plugins/projectexplorer/outputwindow.cpp
index 9c0dc008e9..875594e68a 100644
--- a/src/plugins/projectexplorer/outputwindow.cpp
+++ b/src/plugins/projectexplorer/outputwindow.cpp
@@ -415,6 +415,10 @@ void OutputWindow::appendOutput(const QString &out)
s.chop(1);
}
setMaximumBlockCount(MaxBlockCount);
+
+ QTextCharFormat format;
+ format.setForeground(palette().text().color());
+ setCurrentCharFormat(format);
appendPlainText(out);
enableUndoRedo();
}
@@ -447,6 +451,9 @@ void OutputWindow::appendOutputInline(const QString &out)
m_enforceNewline = true;
s.chop(1);
}
+ QTextCharFormat format;
+ format.setForeground(palette().text().color());
+ setCurrentCharFormat(format);
appendPlainText(s);
}
diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index f246b09d99..bb70b2d113 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -85,7 +85,7 @@ void Project::addBuildConfiguration(BuildConfiguration *configuration)
// add it
m_buildConfigurationValues.push_back(configuration);
- emit addedBuildConfiguration(this, configuration);
+ emit addedBuildConfiguration(configuration);
}
void Project::removeBuildConfiguration(BuildConfiguration *configuration)
@@ -96,7 +96,7 @@ void Project::removeBuildConfiguration(BuildConfiguration *configuration)
m_buildConfigurationValues.removeOne(configuration);
- emit removedBuildConfiguration(this, configuration);
+ emit removedBuildConfiguration(configuration);
delete configuration;
}
@@ -124,7 +124,7 @@ bool Project::restoreSettings()
if (!restoreSettingsImpl(reader))
return false;
- if (m_activeBuildConfiguration && !m_buildConfigurationValues.isEmpty())
+ if (!m_activeBuildConfiguration && !m_buildConfigurationValues.isEmpty())
setActiveBuildConfiguration(m_buildConfigurationValues.at(0));
if (!m_activeRunConfiguration && !m_runConfigurations.isEmpty())
@@ -158,7 +158,7 @@ void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
for(int i=0; i < bcs.size(); ++i) {
QStringList buildStepNames;
foreach (BuildStep *buildStep, bcs.at(i)->buildSteps())
- buildStepNames << buildStep->displayName();
+ buildStepNames << buildStep->id();
writer.saveValue("buildconfiguration-" + QString::number(i) + "-buildsteps", buildStepNames);
int buildstepnr = 0;
@@ -174,7 +174,7 @@ void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
for(int i=0; i < bcs.size(); ++i) {
QStringList cleanStepNames;
foreach (BuildStep *cleanStep, bcs.at(i)->cleanSteps())
- cleanStepNames << cleanStep->displayName();
+ cleanStepNames << cleanStep->id();
writer.saveValue("buildconfiguration-" + QString::number(i) + "-cleansteps", cleanStepNames);
int cleanstepnr = 0;
diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h
index 730c1762db..18e1617506 100644
--- a/src/plugins/projectexplorer/project.h
+++ b/src/plugins/projectexplorer/project.h
@@ -127,9 +127,7 @@ signals:
void fileListChanged();
// TODO clean up signal names
-// might be better to also have
-// a aboutToRemoveRunConfiguration
-// and a removedBuildConfiguration
+// might be better to also have aboutToRemove signals
// a runconfiguration display name changed is missing
void activeBuildConfigurationChanged();
void activeRunConfigurationChanged();
@@ -138,8 +136,8 @@ signals:
void removedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
void addedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
- void removedBuildConfiguration(ProjectExplorer::Project *p, ProjectExplorer::BuildConfiguration *bc);
- void addedBuildConfiguration(ProjectExplorer::Project *p, ProjectExplorer::BuildConfiguration *bc);
+ void removedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
+ void addedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
protected:
/* This method is called when the project .user file is saved. Simply call
diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp
index 48d526e6dd..ff419e65be 100644
--- a/src/plugins/projectexplorer/projectexplorer.cpp
+++ b/src/plugins/projectexplorer/projectexplorer.cpp
@@ -836,7 +836,6 @@ void ProjectExplorerPlugin::unloadProject()
QList<Core::IFile*> filesToSave;
filesToSave << fi;
- // FIXME: What we want here is to check whether we need to safe any of the pro/pri files in this project
// check the number of modified files
int readonlycount = 0;
diff --git a/src/plugins/projectexplorer/projecttreewidget.cpp b/src/plugins/projectexplorer/projecttreewidget.cpp
index 72a5561dc7..bd9e0b658f 100644
--- a/src/plugins/projectexplorer/projecttreewidget.cpp
+++ b/src/plugins/projectexplorer/projecttreewidget.cpp
@@ -120,7 +120,8 @@ ProjectTreeWidget::ProjectTreeWidget(QWidget *parent)
m_view(0),
m_model(0),
m_filterProjectsAction(0),
- m_autoSync(false)
+ m_autoSync(false),
+ m_currentItemLocked(false)
{
m_model = new FlatModel(m_explorer->session()->sessionNode(), this);
NodesWatcher *watcher = new NodesWatcher(this);
@@ -249,6 +250,10 @@ void ProjectTreeWidget::setCurrentItem(Node *node, Project *project)
if (debug)
qDebug() << "ProjectTreeWidget::setCurrentItem(" << (project ? project->displayName() : "0")
<< ", " << (node ? node->path() : "0") << ")";
+ if (m_currentItemLocked) {
+ m_currentItemLocked = false;
+ return;
+ }
if (!project) {
return;
}
@@ -288,6 +293,8 @@ void ProjectTreeWidget::handleProjectAdded(ProjectExplorer::Project *project)
Node *node = project->rootProjectNode();
QModelIndex idx = m_model->indexForNode(node);
m_view->setExpanded(idx, true);
+ m_view->setCurrentIndex(idx);
+ m_currentItemLocked = true;
}
void ProjectTreeWidget::startupProjectChanged(ProjectExplorer::Project *project)
diff --git a/src/plugins/projectexplorer/projecttreewidget.h b/src/plugins/projectexplorer/projecttreewidget.h
index 732035f4c4..2413bd9549 100644
--- a/src/plugins/projectexplorer/projecttreewidget.h
+++ b/src/plugins/projectexplorer/projecttreewidget.h
@@ -89,7 +89,7 @@ private:
QModelIndex m_subIndex;
QString m_modelId;
bool m_autoSync;
-
+ bool m_currentItemLocked;
friend class ProjectTreeWidgetFactory;
};
diff --git a/src/plugins/projectexplorer/projectwindow.cpp b/src/plugins/projectexplorer/projectwindow.cpp
index 1812a5e9fd..09780c1c8f 100644
--- a/src/plugins/projectexplorer/projectwindow.cpp
+++ b/src/plugins/projectexplorer/projectwindow.cpp
@@ -502,8 +502,11 @@ BuildConfigurationComboBox::BuildConfigurationComboBox(Project *p, QWidget *pare
addWidget(m_label);
//m_comboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
- foreach(BuildConfiguration *buildConfiguration, p->buildConfigurations())
+ foreach(BuildConfiguration *buildConfiguration, p->buildConfigurations()) {
m_comboBox->addItem(buildConfiguration->displayName(), QVariant::fromValue(buildConfiguration));
+ connect(buildConfiguration, SIGNAL(displayNameChanged()),
+ this, SLOT(displayNameChanged()));
+ }
if (p->buildConfigurations().count() == 1) {
m_label->setText(m_comboBox->itemText(0));
setCurrentWidget(m_label);
@@ -518,10 +521,10 @@ BuildConfigurationComboBox::BuildConfigurationComboBox(Project *p, QWidget *pare
// this, SLOT(nameChanged(ProjectExplorer::BuildConfiguration *)));
connect(p, SIGNAL(activeBuildConfigurationChanged()),
this, SLOT(activeConfigurationChanged()));
- connect(p, SIGNAL(addedBuildConfiguration(ProjectExplorer::Project*,ProjectExplorer::BuildConfiguration*)),
- this, SLOT(addedBuildConfiguration(ProjectExplorer::Project*,ProjectExplorer::BuildConfiguration*)));
- connect(p, SIGNAL(removedBuildConfiguration(ProjectExplorer::Project*,ProjectExplorer::BuildConfiguration*)),
- this, SLOT(removedBuildConfiguration(ProjectExplorer::Project*,ProjectExplorer::BuildConfiguration*)));
+ connect(p, SIGNAL(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
+ this, SLOT(addedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
+ connect(p, SIGNAL(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)),
+ this, SLOT(removedBuildConfiguration(ProjectExplorer::BuildConfiguration*)));
connect(m_comboBox, SIGNAL(activated(int)),
this, SLOT(changedIndex(int)));
}
@@ -531,15 +534,16 @@ BuildConfigurationComboBox::~BuildConfigurationComboBox()
}
-void BuildConfigurationComboBox::nameChanged(BuildConfiguration *bc)
+void BuildConfigurationComboBox::displayNameChanged()
{
- const int index(buildConfigurationToIndex(bc));
- if (index == -1)
- return;
- const QString &displayName = bc->displayName();
- m_comboBox->setItemText(index, displayName);
+ for (int i=0; i < m_comboBox->count(); ++i) {
+ BuildConfiguration *bc = m_comboBox->itemData(i).value<BuildConfiguration *>();
+ const QString &displayName = bc->displayName();
+ m_comboBox->setItemText(i, displayName);
+ }
+
if (m_comboBox->count() == 1)
- m_label->setText(displayName);
+ m_label->setText(m_comboBox->itemText(0));
}
int BuildConfigurationComboBox::buildConfigurationToIndex(BuildConfiguration *bc)
@@ -560,22 +564,20 @@ void BuildConfigurationComboBox::activeConfigurationChanged()
ignoreIndexChange = false;
}
-void BuildConfigurationComboBox::addedBuildConfiguration(ProjectExplorer::Project *project,
- ProjectExplorer::BuildConfiguration *bc)
+void BuildConfigurationComboBox::addedBuildConfiguration(BuildConfiguration *bc)
{
- Q_UNUSED(project);
ignoreIndexChange = true;
m_comboBox->addItem(bc->displayName(), QVariant::fromValue(bc));
if (m_comboBox->count() == 2)
setCurrentWidget(m_comboBox);
ignoreIndexChange = false;
+ connect(bc, SIGNAL(displayNameChanged()),
+ this, SLOT(displayNameChanged()));
}
-void BuildConfigurationComboBox::removedBuildConfiguration(ProjectExplorer::Project *project,
- BuildConfiguration * bc)
+void BuildConfigurationComboBox::removedBuildConfiguration(BuildConfiguration * bc)
{
- Q_UNUSED(project);
ignoreIndexChange = true;
const int index(buildConfigurationToIndex(bc));
if (index == -1)
@@ -586,6 +588,8 @@ void BuildConfigurationComboBox::removedBuildConfiguration(ProjectExplorer::Proj
setCurrentWidget(m_label);
}
ignoreIndexChange = false;
+ connect(bc, SIGNAL(displayNameChanged()),
+ this, SLOT(displayNameChanged()));
}
void BuildConfigurationComboBox::changedIndex(int newIndex)
diff --git a/src/plugins/projectexplorer/projectwindow.h b/src/plugins/projectexplorer/projectwindow.h
index aec941d766..42532a65a1 100644
--- a/src/plugins/projectexplorer/projectwindow.h
+++ b/src/plugins/projectexplorer/projectwindow.h
@@ -95,12 +95,10 @@ public:
BuildConfigurationComboBox(ProjectExplorer::Project *p, QWidget *parent = 0);
~BuildConfigurationComboBox();
private slots:
- void nameChanged(BuildConfiguration *bc);
+ void displayNameChanged();
void activeConfigurationChanged();
- void addedBuildConfiguration(ProjectExplorer::Project *project,
- ProjectExplorer::BuildConfiguration *bc);
- void removedBuildConfiguration(ProjectExplorer::Project *project,
- ProjectExplorer::BuildConfiguration *bc);
+ void addedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
+ void removedBuildConfiguration(ProjectExplorer::BuildConfiguration *bc);
void changedIndex(int newIndex);
private:
int buildConfigurationToIndex(BuildConfiguration *bc);
diff --git a/src/plugins/projectexplorer/taskwindow.cpp b/src/plugins/projectexplorer/taskwindow.cpp
index 5134035a00..271bc15ea2 100644
--- a/src/plugins/projectexplorer/taskwindow.cpp
+++ b/src/plugins/projectexplorer/taskwindow.cpp
@@ -34,6 +34,7 @@
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/uniqueidmanager.h>
+#include <coreplugin/actionmanager/command.h>
#include <texteditor/basetexteditor.h>
#include <texteditor/itexteditor.h>
@@ -456,9 +457,9 @@ TaskWindow::TaskWindow()
core->addContextObject(m_taskWindowContext);
m_copyAction = new QAction(QIcon(Core::Constants::ICON_COPY), tr("&Copy"), this);
- core->actionManager()->
+ Core::Command *command = core->actionManager()->
registerAction(m_copyAction, Core::Constants::COPY, m_taskWindowContext->context());
- m_listview->addAction(m_copyAction);
+ m_listview->addAction(command->action());
connect(m_listview->selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
tld, SLOT(currentChanged(const QModelIndex &, const QModelIndex &)));
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateslist.qml b/src/plugins/qmldesigner/components/stateseditor/stateslist.qml
index 112dce5b14..9d5464cbaa 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateslist.qml
+++ b/src/plugins/qmldesigner/components/stateseditor/stateslist.qml
@@ -27,8 +27,10 @@ Rectangle {
signal: "changedToState(n)"
script: {root.currentStateIndex = n}
}
-
- Item { id:focusStealer }
+
+ // TextInputs don't loose focus automatically when user clicks away, have to be done explicitly
+ signal unFocus
+ Item { id:focusStealer }
Flickable {
id: listView
@@ -94,34 +96,38 @@ Rectangle {
anchors.fill: container
onClicked: {
root.currentStateIndex = index
- focusStealer.focus=true; // steal focus from textinput
+ root.unFocus();
}
}
+ Connection {
+ sender: root
+ signal: "unFocus()"
+ script: txt.unFocus()
+ }
+
TextInput {
anchors.top: img.bottom
anchors.horizontalCenter: img.horizontalCenter
id: txt
text: stateName
color: "#E1E1E1";
- onAccepted: {
- // force focus to move to another item, otherwise this one will be reactivated at mode change
+ function unFocus() {
focus=false;
- itemRegion.focus=true;
- }
- onFocusChanged: if (!focus) {
- txtRegion.enabled=true
- statesEditorModel.renameState(index, text)
+ focusStealer.focus=true;
+ txtRegion.enabled=true;
+ if (index!=0)
+ statesEditorModel.renameState(index,text);
}
+ onAccepted: unFocus();
MouseRegion {
id: txtRegion
anchors.fill:parent
- property bool wasDoubleClicked:false
onClicked: {
root.currentStateIndex = index;
- itemRegion.focus=true;
+ root.unFocus();
}
- onDoubleClicked: if (index!=0) { // base state not editable
+ onDoubleClicked: if (index!=0) {
parent.focus=true;
enabled=false;
}
@@ -172,19 +178,18 @@ Rectangle {
height:2
color:"black"
anchors.centerIn:parent
- effect: Blur { blurRadius: 1; }
}
Rectangle {
width:2
height:12
color:"black"
anchors.centerIn:parent
- effect: Blur { blurRadius: 1; }
}
MouseRegion {
anchors.fill:parent
onClicked: {
+ root.unFocus();
if (root.currentStateIndex == 0)
root.createNewState(); //create new state
else
@@ -241,7 +246,6 @@ Rectangle {
height:2
color:"black"
anchors.centerIn:parent
- effect: Blur { blurRadius: 1; }
}
visible: { root.currentStateIndex != 0 }
@@ -249,6 +253,7 @@ Rectangle {
MouseRegion {
anchors.fill:parent
onClicked: {
+ root.unFocus();
root.deleteCurrentState();
if (root.currentStateIndex >= statesEditorModel.count)
root.currentStateIndex = root.currentStateIndex-1;
@@ -291,10 +296,12 @@ Rectangle {
// the bar itself
Item {
id: draggableBar
- width: if (horizontalScrollbar.viewLength>horizontalScrollbar.totalLength) parent.width;
- else horizontalScrollbar.viewLength/horizontalScrollbar.totalLength * parent.width;
+ width: if (horizontalScrollbar.totalLength>0) {
+ if (horizontalScrollbar.viewLength>horizontalScrollbar.totalLength) parent.width;
+ else horizontalScrollbar.viewLength/horizontalScrollbar.totalLength * parent.width;
+ } else 0;
height: parent.height;
- x: horizontalScrollbar.viewPosition*horizontalScrollbar.width/horizontalScrollbar.totalLength;
+ x: (horizontalScrollbar.totalLength>0?horizontalScrollbar.viewPosition*horizontalScrollbar.width/horizontalScrollbar.totalLength:0);
Rectangle {
@@ -312,7 +319,7 @@ Rectangle {
anchors.fill:parent
property int dragging:0;
property int originalX:0;
- onPressed: { dragging = 1; originalX = mouse.x; }
+ onPressed: { dragging = 1; originalX = mouse.x;root.unFocus(); }
onReleased: { dragging = 0; }
onPositionChanged: if (dragging)
{
diff --git a/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp b/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp
index fe022ea55d..564c3e6175 100644
--- a/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp
+++ b/src/plugins/qt4projectmanager/qt4buildenvironmentwidget.cpp
@@ -72,7 +72,7 @@ void Qt4BuildEnvironmentWidget::init(ProjectExplorer::BuildConfiguration *bc)
qDebug() << "Qt4BuildConfigWidget::init()";
if (m_buildConfiguration) {
- disconnect(this, SIGNAL(environmentChanged()),
+ disconnect(m_buildConfiguration, SIGNAL(environmentChanged()),
this, SLOT(environmentChanged()));
}
diff --git a/src/plugins/qtscripteditor/qtscripteditor.cpp b/src/plugins/qtscripteditor/qtscripteditor.cpp
index 8b38d97e7f..837f8d4920 100644
--- a/src/plugins/qtscripteditor/qtscripteditor.cpp
+++ b/src/plugins/qtscripteditor/qtscripteditor.cpp
@@ -31,7 +31,8 @@
#include "qtscripteditorconstants.h"
#include "qtscripthighlighter.h"
#include "qtscripteditorplugin.h"
-#include "qtscriptindenter.h"
+
+#include <qscripthighlighter/qscriptindenter.h>
#include "parser/javascriptengine_p.h"
#include "parser/javascriptparser_p.h"
@@ -340,15 +341,12 @@ bool ScriptEditor::isElectricCharacter(const QChar &ch) const
void ScriptEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar typedChar)
{
- const TextEditor::TextBlockIterator begin(doc->begin());
- const TextEditor::TextBlockIterator end(block.next());
-
TextEditor::TabSettings ts = tabSettings();
- QtScriptIndenter indenter;
+ SharedTools::QScriptIndenter indenter;
indenter.setTabSize(ts.m_tabSize);
indenter.setIndentSize(ts.m_indentSize);
- const int indent = indenter.indentForBottomLine(begin, end, typedChar);
+ const int indent = indenter.indentForBottomLine(doc->begin(), block.next(), typedChar);
ts.indentLine(block, indent);
}
diff --git a/src/plugins/qtscripteditor/qtscripteditor.pro b/src/plugins/qtscripteditor/qtscripteditor.pro
index f3257a52a7..301bc47b60 100644
--- a/src/plugins/qtscripteditor/qtscripteditor.pro
+++ b/src/plugins/qtscripteditor/qtscripteditor.pro
@@ -6,21 +6,20 @@ include(../../qtcreatorplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(../../plugins/texteditor/texteditor.pri)
include(../../shared/qscripthighlighter/qscripthighlighter.pri)
-include(../../shared/indenter/indenter.pri)
include(parser/parser.pri)
+DEPENDPATH += ../../shared/qscripthighlighter
+
HEADERS += qtscripteditor.h \
qtscripteditorfactory.h \
qtscripteditorplugin.h \
qtscripthighlighter.h \
-qtscriptindenter.h \
qtscriptcodecompletion.h
SOURCES += qtscripteditor.cpp \
qtscripteditorfactory.cpp \
qtscripteditorplugin.cpp \
qtscripthighlighter.cpp \
-qtscriptindenter.cpp \
qtscriptcodecompletion.cpp
RESOURCES += qtscripteditor.qrc
diff --git a/src/plugins/subversion/subversionconstants.h b/src/plugins/subversion/subversionconstants.h
index 03afbc3e8a..e6f2880a38 100644
--- a/src/plugins/subversion/subversionconstants.h
+++ b/src/plugins/subversion/subversionconstants.h
@@ -30,14 +30,18 @@
#ifndef SUBVERSION_CONSTANTS_H
#define SUBVERSION_CONSTANTS_H
+#include <QtCore/QtGlobal>
+
namespace Subversion {
namespace Constants {
const char * const SUBVERSION_SUBMIT_MIMETYPE = "application/vnd.nokia.text.subversion.submit";
const char * const SUBVERSIONEDITOR = "Subversion Editor";
-const char * const SUBVERSIONEDITOR_KIND = "Subversion Editor";
+const char * const SUBVERSIONEDITOR_ID = "Subversion Editor";
+const char * const SUBVERSIONEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Subversion Editor");
const char * const SUBVERSIONCOMMITEDITOR = "Subversion Commit Editor";
-const char * const SUBVERSIONCOMMITEDITOR_KIND = "Subversion Commit Editor";
+const char * const SUBVERSIONCOMMITEDITOR_ID = "Subversion Commit Editor";
+const char * const SUBVERSIONCOMMITEDITOR_DISPLAY_NAME = QT_TRANSLATE_NOOP("VCS", "Subversion Commit Editor");
const char * const SUBMIT_CURRENT = "Subversion.SubmitCurrentLog";
const char * const DIFF_SELECTED = "Subversion.DiffSelectedFilesInLog";
enum { debug = 0 };
diff --git a/src/plugins/subversion/subversionplugin.cpp b/src/plugins/subversion/subversionplugin.cpp
index a0c3212907..e83d3262c0 100644
--- a/src/plugins/subversion/subversionplugin.cpp
+++ b/src/plugins/subversion/subversionplugin.cpp
@@ -97,22 +97,26 @@ static const char *nonInteractiveOptionC = "--non-interactive";
static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
{
VCSBase::RegularCommandOutput,
- "Subversion Command Log Editor", // kind
+ "Subversion Command Log Editor", // id
+ QT_TRANSLATE_NOOP("VCS", "Subversion Command Log Editor"), // display name
"Subversion Command Log Editor", // context
"application/vnd.nokia.text.scs_svn_commandlog",
"scslog"},
{ VCSBase::LogOutput,
- "Subversion File Log Editor", // kind
+ "Subversion File Log Editor", // id
+ QT_TRANSLATE_NOOP("VCS", "Subversion File Log Editor"), // display_name
"Subversion File Log Editor", // context
"application/vnd.nokia.text.scs_svn_filelog",
"scsfilelog"},
{ VCSBase::AnnotateOutput,
- "Subversion Annotation Editor", // kind
+ "Subversion Annotation Editor", // id
+ QT_TRANSLATE_NOOP("VCS", "Subversion Annotation Editor"), // display_name
"Subversion Annotation Editor", // context
"application/vnd.nokia.text.scs_svn_annotation",
"scsannotate"},
{ VCSBase::DiffOutput,
- "Subversion Diff Editor", // kind
+ "Subversion Diff Editor", // id
+ QT_TRANSLATE_NOOP("VCS", "Subversion Diff Editor"), // display_name
"Subversion Diff Editor", // context
"text/x-patch","diff"}
};
@@ -175,7 +179,7 @@ static inline QStringList svnDirectories()
SubversionPlugin *SubversionPlugin::m_subversionPluginInstance = 0;
SubversionPlugin::SubversionPlugin() :
- VCSBase::VCSBasePlugin(QLatin1String(Subversion::Constants::SUBVERSIONCOMMITEDITOR_KIND)),
+ VCSBase::VCSBasePlugin(QLatin1String(Subversion::Constants::SUBVERSIONCOMMITEDITOR_ID)),
m_svnDirectories(svnDirectories()),
m_addAction(0),
m_deleteAction(0),
@@ -221,7 +225,8 @@ bool SubversionPlugin::isCommitEditorOpen() const
static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = {
Subversion::Constants::SUBVERSION_SUBMIT_MIMETYPE,
- Subversion::Constants::SUBVERSIONCOMMITEDITOR_KIND,
+ Subversion::Constants::SUBVERSIONCOMMITEDITOR_ID,
+ Subversion::Constants::SUBVERSIONCOMMITEDITOR_DISPLAY_NAME,
Subversion::Constants::SUBVERSIONCOMMITEDITOR
};
@@ -506,7 +511,7 @@ void SubversionPlugin::svnDiff(const QString &workingDir, const QStringList &fil
SubversionSubmitEditor *SubversionPlugin::openSubversionSubmitEditor(const QString &fileName)
{
- Core::IEditor *editor = Core::EditorManager::instance()->openEditor(fileName, QLatin1String(Constants::SUBVERSIONCOMMITEDITOR_KIND));
+ Core::IEditor *editor = Core::EditorManager::instance()->openEditor(fileName, QLatin1String(Constants::SUBVERSIONCOMMITEDITOR_ID));
SubversionSubmitEditor *submitEditor = qobject_cast<SubversionSubmitEditor*>(editor);
QTC_ASSERT(submitEditor, /**/);
submitEditor->registerActions(m_submitUndoAction, m_submitRedoAction, m_submitCurrentLogAction, m_submitDiffAction);
@@ -1015,6 +1020,16 @@ SubversionPlugin *SubversionPlugin::subversionPluginInstance()
bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileName)
{
+#ifdef Q_OS_MAC // See below.
+ return vcsAdd14(workingDir, rawFileName);
+#else
+ return vcsAdd15(workingDir, rawFileName);
+#endif
+}
+
+// Post 1.4 add: Use "--parents" to add directories
+bool SubversionPlugin::vcsAdd15(const QString &workingDir, const QString &rawFileName)
+{
const QString file = QDir::toNativeSeparators(rawFileName);
QStringList args;
args << QLatin1String("add") << QLatin1String("--parents") << file;
@@ -1022,6 +1037,36 @@ bool SubversionPlugin::vcsAdd(const QString &workingDir, const QString &rawFileN
return !response.error;
}
+// Pre 1.5 add: Add directories in a loop. To be deprecated
+// once Mac ships newer svn-versions
+bool SubversionPlugin::vcsAdd14(const QString &workingDir, const QString &rawFileName)
+{
+ const QChar slash = QLatin1Char('/');
+ const QStringList relativePath = rawFileName.split(slash);
+ // Add directories (dir1/dir2/file.cpp) in a loop.
+ if (relativePath.size() > 1) {
+ QString path;
+ const int lastDir = relativePath.size() - 1;
+ for (int p = 0; p < lastDir; p++) {
+ if (!path.isEmpty())
+ path += slash;
+ path += relativePath.at(p);
+ if (!managesDirectory(QDir(path))) {
+ QStringList addDirArgs;
+ addDirArgs << QLatin1String("add") << QLatin1String("--non-recursive") << QDir::toNativeSeparators(path);
+ const SubversionResponse addDirResponse = runSvn(workingDir, addDirArgs, m_settings.timeOutMS(), true);
+ if (addDirResponse.error)
+ return false;
+ }
+ }
+ }
+ // Add file
+ QStringList args;
+ args << QLatin1String("add") << QDir::toNativeSeparators(rawFileName);
+ const SubversionResponse response = runSvn(workingDir, args, m_settings.timeOutMS(), true);
+ return !response.error;
+}
+
bool SubversionPlugin::vcsDelete(const QString &workingDir, const QString &rawFileName)
{
const QString file = QDir::toNativeSeparators(rawFileName);
diff --git a/src/plugins/subversion/subversionplugin.h b/src/plugins/subversion/subversionplugin.h
index 3a7e3bfb48..d8ca80810b 100644
--- a/src/plugins/subversion/subversionplugin.h
+++ b/src/plugins/subversion/subversionplugin.h
@@ -88,6 +88,8 @@ public:
// IVersionControl
bool vcsAdd(const QString &workingDir, const QString &fileName);
+ bool vcsAdd14(const QString &workingDir, const QString &fileName);
+ bool vcsAdd15(const QString &workingDir, const QString &fileName);
bool vcsDelete(const QString &workingDir, const QString &fileName);
bool managesDirectory(const QString &directory) const;
QString findTopLevelForDirectory(const QString &directory) const;
diff --git a/src/plugins/vcsbase/basevcseditorfactory.cpp b/src/plugins/vcsbase/basevcseditorfactory.cpp
index 0751a59878..7eba5c7f3e 100644
--- a/src/plugins/vcsbase/basevcseditorfactory.cpp
+++ b/src/plugins/vcsbase/basevcseditorfactory.cpp
@@ -35,6 +35,8 @@
#include <texteditor/texteditoractionhandler.h>
#include <texteditor/texteditorsettings.h>
+#include <QtCore/QCoreApplication>
+
namespace VCSBase {
struct BaseVCSEditorFactoryPrivate
@@ -43,6 +45,7 @@ struct BaseVCSEditorFactoryPrivate
const VCSBaseEditorParameters *m_type;
const QString m_id;
+ QString m_displayName;
const QStringList m_mimeTypes;
TextEditor::TextEditorActionHandler *m_editorHandler;
};
@@ -58,6 +61,7 @@ BaseVCSEditorFactoryPrivate::BaseVCSEditorFactoryPrivate(const VCSBaseEditorPara
BaseVCSEditorFactory::BaseVCSEditorFactory(const VCSBaseEditorParameters *t)
: m_d(new BaseVCSEditorFactoryPrivate(t))
{
+ m_d->m_displayName = QCoreApplication::translate("VCS", t->displayName);
}
BaseVCSEditorFactory::~BaseVCSEditorFactory()
@@ -77,7 +81,7 @@ QString BaseVCSEditorFactory::id() const
QString BaseVCSEditorFactory::displayName() const
{
- return tr("Base VCS Editor", "VCSBase BaseVCSEditorFactory display name.");
+ return m_d->m_displayName;
}
Core::IFile *BaseVCSEditorFactory::open(const QString &fileName)
diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index 8f65b8bd2c..fd3f38dcf6 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -82,6 +82,7 @@ public:
bool duplicateSupported() const { return false; }
Core::IEditor *duplicate(QWidget * /*parent*/) { return 0; }
QString id() const { return m_id; }
+ QString displayName() const { return m_displayName; }
bool isTemporary() const { return true; }
@@ -91,13 +92,15 @@ signals:
private:
QString m_id;
+ QString m_displayName;
QList<int> m_context;
};
VCSBaseEditorEditable::VCSBaseEditorEditable(VCSBaseEditor *editor,
const VCSBaseEditorParameters *type) :
BaseTextEditorEditable(editor),
- m_id(type->id)
+ m_id(type->id),
+ m_displayName(QCoreApplication::translate("VCS", type->displayName))
{
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_context << uidm->uniqueIdentifier(QLatin1String(type->context))
diff --git a/src/plugins/vcsbase/vcsbaseeditor.h b/src/plugins/vcsbase/vcsbaseeditor.h
index a47461bee7..c2b3c157fd 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.h
+++ b/src/plugins/vcsbase/vcsbaseeditor.h
@@ -74,8 +74,8 @@ enum EditorContentType {
// VCS commands with redirection.
struct VCSBASE_EXPORT VCSBaseEditorParameters {
EditorContentType type;
- QString id;
- QString displayName;
+ const char *id;
+ const char *displayName;
const char *context;
const char *mimeType;
const char *extension;
diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
index c7edea0628..f38a0a231a 100644
--- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
+++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
@@ -308,6 +308,8 @@ Core::IFile *VCSBaseSubmitEditor::file()
QString VCSBaseSubmitEditor::displayName() const
{
+ if (m_d->m_displayName.isEmpty())
+ m_d->m_displayName = QCoreApplication::translate("VCS", m_d->m_parameters->displayName);
return m_d->m_displayName;
}
diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.h b/src/plugins/vcsbase/vcsbasesubmiteditor.h
index 78ca4e9993..69c2b630ba 100644
--- a/src/plugins/vcsbase/vcsbasesubmiteditor.h
+++ b/src/plugins/vcsbase/vcsbasesubmiteditor.h
@@ -56,8 +56,8 @@ struct VCSBaseSubmitEditorPrivate;
/* Utility struct to parametrize a VCSBaseSubmitEditor. */
struct VCSBASE_EXPORT VCSBaseSubmitEditorParameters {
const char *mimeType;
- QString id;
- QString displayName;
+ const char *id;
+ const char *displayName;
const char *context;
};
diff --git a/src/shared/qscripthighlighter/qscripthighlighter.pri b/src/shared/qscripthighlighter/qscripthighlighter.pri
index a6c88c508f..0a4112e352 100644
--- a/src/shared/qscripthighlighter/qscripthighlighter.pri
+++ b/src/shared/qscripthighlighter/qscripthighlighter.pri
@@ -6,6 +6,6 @@ SOURCES += $$PWD/qscriptincrementalscanner.cpp
HEADERS += $$PWD/qscriptincrementalscanner.h $$PWD/qscripthighlighter_global.h
contains(QT, gui) {
- SOURCES += $$PWD/qscripthighlighter.cpp
- HEADERS += $$PWD/qscripthighlighter.h
+ SOURCES += $$PWD/qscripthighlighter.cpp $$PWD/qscriptindenter.cpp
+ HEADERS += $$PWD/qscripthighlighter.h $$PWD/qscriptindenter.h
}
diff --git a/src/plugins/qtscripteditor/qtscriptindenter.cpp b/src/shared/qscripthighlighter/qscriptindenter.cpp
index 7f6bb1ae60..45f4fa2235 100644
--- a/src/plugins/qtscripteditor/qtscriptindenter.cpp
+++ b/src/shared/qscripthighlighter/qscriptindenter.cpp
@@ -65,9 +65,10 @@
as comments and string literals are removed beforehand.
*/
-#include "qtscriptindenter.h"
+#include "qscriptindenter.h"
+#include <QtDebug>
-using namespace QtScriptEditor::Internal;
+using namespace SharedTools;
/*
The indenter avoids getting stuck in almost infinite loops by
@@ -77,15 +78,16 @@ using namespace QtScriptEditor::Internal;
For example, the indenter never considers more than BigRoof lines
backwards when looking for the start of a C-style comment.
*/
-const int QtScriptIndenter::SmallRoof = 40;
-const int QtScriptIndenter::BigRoof = 400;
+const int QScriptIndenter::SmallRoof = 40;
+const int QScriptIndenter::BigRoof = 400;
-QtScriptIndenter::QtScriptIndenter()
+QScriptIndenter::QScriptIndenter()
: literal(QRegExp(QLatin1String("([\"'])(?:\\\\.|[^\\\\])*\\1"))),
- label(QRegExp(QLatin1String("^\\s*((?:case\\b([^:]|::)+|[a-zA-Z_0-9]+)(?:\\s+slots)?:)(?!:)"))),
+ label(QRegExp(QLatin1String("^\\s*((?:case\\b([^:])+|[a-zA-Z_0-9.]+)(?:\\s+)?:)(?!:)"))),
inlineCComment(QRegExp(QLatin1String("/\\*.*\\*/"))),
braceX(QRegExp(QLatin1String("^\\s*\\}\\s*(?:else|catch)\\b"))),
- iflikeKeyword(QRegExp(QLatin1String("\\b(?:catch|do|for|if|while|with)\\b")))
+ iflikeKeyword(QRegExp(QLatin1String("\\b(?:catch|do|for|if|while|with)\\b"))),
+ propertylikeKeyword(QRegExp(QLatin1String("^\\s*\\b(?:property|signal|import)\\b")))
{
/*
@@ -123,16 +125,16 @@ QtScriptIndenter::QtScriptIndenter()
inlineCComment.setMinimal(true);
}
-QtScriptIndenter::~QtScriptIndenter()
+QScriptIndenter::~QScriptIndenter()
{
}
-void QtScriptIndenter::setTabSize(int size)
+void QScriptIndenter::setTabSize(int size)
{
ppHardwareTabSize = size;
}
-void QtScriptIndenter::setIndentSize(int size)
+void QScriptIndenter::setIndentSize(int size)
{
ppIndentSize = size;
ppContinuationIndentSize = 2 * size;
@@ -142,7 +144,7 @@ void QtScriptIndenter::setIndentSize(int size)
Returns the first non-space character in the string t, or
QChar() if the string is made only of white space.
*/
-QChar QtScriptIndenter::firstNonWhiteSpace(const QString &t)
+QChar QScriptIndenter::firstNonWhiteSpace(const QString &t) const
{
int i = 0;
while (i < t.length()) {
@@ -157,7 +159,7 @@ QChar QtScriptIndenter::firstNonWhiteSpace(const QString &t)
Returns true if string t is made only of white space; otherwise
returns false.
*/
-bool QtScriptIndenter::isOnlyWhiteSpace(const QString &t)
+bool QScriptIndenter::isOnlyWhiteSpace(const QString &t) const
{
return firstNonWhiteSpace(t).isNull();
}
@@ -167,7 +169,7 @@ bool QtScriptIndenter::isOnlyWhiteSpace(const QString &t)
index. Column numbers and index are identical for strings that don't
contain '\t's.
*/
-int QtScriptIndenter::columnForIndex(const QString &t, int index)
+int QScriptIndenter::columnForIndex(const QString &t, int index) const
{
int col = 0;
if (index > t.length())
@@ -186,7 +188,7 @@ int QtScriptIndenter::columnForIndex(const QString &t, int index)
/*
Returns the indentation size of string t.
*/
-int QtScriptIndenter::indentOfLine(const QString &t)
+int QScriptIndenter::indentOfLine(const QString &t) const
{
return columnForIndex(t, t.indexOf(firstNonWhiteSpace(t)));
}
@@ -197,7 +199,7 @@ int QtScriptIndenter::indentOfLine(const QString &t)
provisions are taken against '\n' or '\r', which shouldn't occur in
t anyway.
*/
-inline void QtScriptIndenter::eraseChar(QString &t, int k, QChar ch)
+void QScriptIndenter::eraseChar(QString &t, int k, QChar ch) const
{
if (t.at(k) != QLatin1Char('\t'))
t[k] = ch;
@@ -207,7 +209,7 @@ inline void QtScriptIndenter::eraseChar(QString &t, int k, QChar ch)
Removes some nefast constructs from a code line and returns the
resulting line.
*/
-QString QtScriptIndenter::trimmedCodeLine(const QString &t)
+QString QScriptIndenter::trimmedCodeLine(const QString &t) const
{
QString trimmed = t;
int k;
@@ -220,7 +222,7 @@ QString QtScriptIndenter::trimmedCodeLine(const QString &t)
continuation lines.
*/
k = 0;
- while ((k = trimmed.indexOf(literal, k)) != -1) {
+ while ((k = literal.indexIn(trimmed, k)) != -1) {
for (int i = 0; i < literal.matchedLength(); i++)
eraseChar(trimmed, k + i, QLatin1Char('X'));
k += literal.matchedLength();
@@ -231,7 +233,7 @@ QString QtScriptIndenter::trimmedCodeLine(const QString &t)
handled elsewhere.
*/
k = 0;
- while ((k = trimmed.indexOf(inlineCComment, k)) != -1) {
+ while ((k = inlineCComment.indexIn(trimmed, k)) != -1) {
for (int i = 0; i < inlineCComment.matchedLength(); i++)
eraseChar(trimmed, k + i, QLatin1Char(' '));
k += inlineCComment.matchedLength();
@@ -242,9 +244,13 @@ QString QtScriptIndenter::trimmedCodeLine(const QString &t)
with this case:
foo1: bar1;
- bar2;
+ bar2;
*/
- while (trimmed.lastIndexOf(QLatin1Char(':')) != -1 && trimmed.indexOf(label) != -1) {
+
+ bool insertSemicolon = false;
+ while (trimmed.lastIndexOf(QLatin1Char(':')) != -1 && label.indexIn(trimmed) != -1) {
+ insertSemicolon = true;
+
const QString cap1 = label.cap(1);
int pos1 = label.pos(1);
int stop = cap1.length();
@@ -254,7 +260,7 @@ QString QtScriptIndenter::trimmedCodeLine(const QString &t)
int i = 0;
while (i < stop) {
- eraseChar(trimmed, pos1 + i, QLatin1Char(' '));
+ eraseChar(trimmed, pos1 + i, QLatin1Char(';'));
i++;
}
while (i < cap1.length()) {
@@ -270,6 +276,16 @@ QString QtScriptIndenter::trimmedCodeLine(const QString &t)
if (k != -1)
trimmed.truncate(k);
+ const QString e = trimmed.trimmed();
+
+ if (insertSemicolon
+ || e.endsWith(QLatin1Char(','))
+ || e.endsWith(QLatin1Char(']'))
+ || trimmed.indexOf(propertylikeKeyword) != -1)
+ trimmed.append(QLatin1Char(';'));
+
+ //qDebug() << trimmed;
+
return trimmed;
}
@@ -277,7 +293,7 @@ QString QtScriptIndenter::trimmedCodeLine(const QString &t)
Returns '(' if the last parenthesis is opening, ')' if it is
closing, and QChar() if there are no parentheses in t.
*/
-inline QChar QtScriptIndenter::lastParen(const QString &t)
+QChar QScriptIndenter::lastParen(const QString &t) const
{
int i = t.length();
while (i > 0) {
@@ -292,7 +308,7 @@ inline QChar QtScriptIndenter::lastParen(const QString &t)
Returns true if typedIn the same as okayCh or is null; otherwise
returns false.
*/
-inline bool QtScriptIndenter::okay(QChar typedIn, QChar okayCh)
+bool QScriptIndenter::okay(QChar typedIn, QChar okayCh) const
{
return typedIn == QChar() || typedIn == okayCh;
}
@@ -309,7 +325,7 @@ inline bool QtScriptIndenter::okay(QChar typedIn, QChar okayCh)
accordingly. yyLine is cleaned from comments and other damageable
constructs. Empty lines are skipped.
*/
-bool QtScriptIndenter::readLine()
+bool QScriptIndenter::readLine()
{
int k;
@@ -317,13 +333,13 @@ bool QtScriptIndenter::readLine()
(firstNonWhiteSpace(yyLinizerState.line) == QLatin1Char('{'));
do {
- if (yyLinizerState.iter == yyProgram.constBegin()) {
+ if (yyLinizerState.iter == yyProgram.firstBlock()) {
yyLinizerState.line.clear();
return false;
}
- --yyLinizerState.iter;
- yyLinizerState.line = *yyLinizerState.iter;
+ yyLinizerState.iter = yyLinizerState.iter.previous();
+ yyLinizerState.line = yyLinizerState.iter.text();
yyLinizerState.line = trimmedCodeLine(yyLinizerState.line);
@@ -416,7 +432,7 @@ bool QtScriptIndenter::readLine()
Resets the linizer to its initial state, with yyLine containing the
line above the bottom line of the program.
*/
-void QtScriptIndenter::startLinizer()
+void QScriptIndenter::startLinizer()
{
yyLinizerState.braceDepth = 0;
yyLinizerState.inCComment = false;
@@ -426,9 +442,9 @@ void QtScriptIndenter::startLinizer()
yyBraceDepth = &yyLinizerState.braceDepth;
yyLeftBraceFollows = &yyLinizerState.leftBraceFollows;
- yyLinizerState.iter = yyProgram.constEnd();
- --yyLinizerState.iter;
- yyLinizerState.line = *yyLinizerState.iter;
+ yyLinizerState.iter = yyProgram.lastBlock();
+ yyLinizerState.iter = yyLinizerState.iter.previous();
+ yyLinizerState.line = yyLinizerState.iter.text();
readLine();
}
@@ -437,7 +453,7 @@ void QtScriptIndenter::startLinizer()
potentially the whole line) is part of a C-style comment;
otherwise returns false.
*/
-bool QtScriptIndenter::bottomLineStartsInCComment()
+bool QScriptIndenter::bottomLineStartsInCComment()
{
const QLatin1String slashAster("/*");
const QLatin1String asterSlash("*/");
@@ -446,15 +462,15 @@ bool QtScriptIndenter::bottomLineStartsInCComment()
We could use the linizer here, but that would slow us down
terribly. We are better to trim only the code lines we need.
*/
- Program::const_iterator p = yyProgram.constEnd();
- --p; // skip bottom line
+ QTextBlock p = yyProgram.lastBlock();
+ p = p.previous(); // skip bottom line
for (int i = 0; i < BigRoof; i++) {
- if (p == yyProgram.constBegin())
+ if (p == yyProgram.firstBlock())
return false;
- --p;
+ p = p.previous();
- const QString blockText = *p;
+ const QString blockText = p.text();
if (blockText.indexOf(slashAster) != -1 || blockText.indexOf(asterSlash) != -1) {
const QString trimmed = trimmedCodeLine(blockText);
@@ -477,7 +493,7 @@ bool QtScriptIndenter::bottomLineStartsInCComment()
Essentially, we're trying to align against some text on the
previous line.
*/
-int QtScriptIndenter::indentWhenBottomLineStartsInCComment()
+int QScriptIndenter::indentWhenBottomLineStartsInCComment()
{
int k = yyLine->lastIndexOf(QLatin1String("/*"));
if (k == -1) {
@@ -521,7 +537,7 @@ int QtScriptIndenter::indentWhenBottomLineStartsInCComment()
if (x)
y;
*/
-bool QtScriptIndenter::matchBracelessControlStatement()
+bool QScriptIndenter::matchBracelessControlStatement()
{
int delimDepth = 0;
@@ -606,7 +622,7 @@ bool QtScriptIndenter::matchBracelessControlStatement()
f + // unfinished continuation line
g; // continuation line
*/
-bool QtScriptIndenter::isUnfinishedLine()
+bool QScriptIndenter::isUnfinishedLine()
{
bool unf = false;
@@ -651,7 +667,7 @@ bool QtScriptIndenter::isUnfinishedLine()
Returns true if yyLine is a continuation line; otherwise returns
false.
*/
-bool QtScriptIndenter::isContinuationLine()
+bool QScriptIndenter::isContinuationLine()
{
bool cont = false;
@@ -670,7 +686,7 @@ bool QtScriptIndenter::isContinuationLine()
or other bracked left opened on a previous line, or some interesting
operator such as '='.
*/
-int QtScriptIndenter::indentForContinuationLine()
+int QScriptIndenter::indentForContinuationLine()
{
int braceDepth = 0;
int delimDepth = 0;
@@ -687,14 +703,15 @@ int QtScriptIndenter::indentForContinuationLine()
switch (ch.unicode()) {
case ')':
- case ']':
delimDepth++;
break;
+ case ']':
+ braceDepth++;
+ break;
case '}':
braceDepth++;
break;
case '(':
- case '[':
delimDepth--;
/*
An unclosed delimiter is a good place to align at,
@@ -703,6 +720,16 @@ int QtScriptIndenter::indentForContinuationLine()
if (delimDepth == -1)
hook = j;
break;
+
+ case '[':
+ braceDepth--;
+ /*
+ An unclosed delimiter is a good place to align at,
+ at least for some styles (including Qt's).
+ */
+ if (braceDepth == -1)
+ hook = j;
+ break;
case '{':
braceDepth--;
/*
@@ -903,7 +930,7 @@ int QtScriptIndenter::indentForContinuationLine()
accommodate people with irregular indentation schemes. A hook line
near at hand is much more reliable than a remote one.
*/
-int QtScriptIndenter::indentForStandaloneLine()
+int QScriptIndenter::indentForStandaloneLine()
{
for (int i = 0; i < SmallRoof; i++) {
if (!*yyLeftBraceFollows) {
@@ -988,7 +1015,7 @@ int QtScriptIndenter::indentForStandaloneLine()
slighly more liberal if typedIn is always null. The user might be
annoyed by the liberal behavior.
*/
-int QtScriptIndenter::indentForBottomLine(TextEditor::TextBlockIterator begin, TextEditor::TextBlockIterator end, QChar typedIn)
+int QScriptIndenter::indentForBottomLine(QTextBlock begin, QTextBlock end, QChar typedIn)
{
if (begin == end)
return 0;
@@ -996,12 +1023,11 @@ int QtScriptIndenter::indentForBottomLine(TextEditor::TextBlockIterator begin, T
yyProgram = Program(begin, end);
startLinizer();
- TextEditor::TextBlockIterator last = end;
- --last;
+ const QTextBlock last = end.previous();
- const QString &bottomLine = *last;
+ QString bottomLine = last.text();
QChar firstCh = firstNonWhiteSpace(bottomLine);
- int indent;
+ int indent = 0;
if (bottomLineStartsInCComment()) {
/*
@@ -1034,9 +1060,9 @@ int QtScriptIndenter::indentForBottomLine(TextEditor::TextBlockIterator begin, T
indent -= ppIndentSize;
} else if (okay(typedIn, QLatin1Char(':'))) {
QRegExp caseLabel(
- "\\s*(?:case\\b(?:[^:]|::)+"
- "|(?:default)\\s*"
- ")?:.*");
+ QLatin1String("\\s*(?:case\\b(?:[^:]|::)+"
+ "|(?:default)\\s*"
+ ")?:.*"));
if (caseLabel.exactMatch(bottomLine)) {
/*
diff --git a/src/plugins/qtscripteditor/qtscriptindenter.h b/src/shared/qscripthighlighter/qscriptindenter.h
index 215d15152b..985387cfb7 100644
--- a/src/plugins/qtscripteditor/qtscriptindenter.h
+++ b/src/shared/qscripthighlighter/qscriptindenter.h
@@ -30,39 +30,40 @@
#ifndef QTSCRIPTINDENTER_H
#define QTSCRIPTINDENTER_H
+#include <qscripthighlighter/qscripthighlighter_global.h>
+
#include <QtCore/QRegExp>
#include <QtCore/QStringList>
-#include <texteditor/textblockiterator.h>
+#include <QtGui/QTextBlock>
-namespace QtScriptEditor {
-namespace Internal {
+namespace SharedTools {
-class QtScriptIndenter
+class QSCRIPTHIGHLIGHTER_EXPORT QScriptIndenter
{
- Q_DISABLE_COPY(QtScriptIndenter)
+ Q_DISABLE_COPY(QScriptIndenter)
public:
- QtScriptIndenter();
- ~QtScriptIndenter();
+ QScriptIndenter();
+ ~QScriptIndenter();
void setTabSize(int size);
void setIndentSize(int size);
- int indentForBottomLine(TextEditor::TextBlockIterator begin, TextEditor::TextBlockIterator end, QChar typedIn);
- QChar firstNonWhiteSpace(const QString &t);
+ int indentForBottomLine(QTextBlock firstBlock, QTextBlock lastBlock, QChar typedIn);
+ QChar firstNonWhiteSpace(const QString &t) const;
private:
static const int SmallRoof;
static const int BigRoof;
- bool isOnlyWhiteSpace(const QString &t);
- int columnForIndex(const QString &t, int index);
- int indentOfLine(const QString &t);
- QString trimmedCodeLine(const QString &t);
+ bool isOnlyWhiteSpace(const QString &t) const;
+ int columnForIndex(const QString &t, int index) const;
+ int indentOfLine(const QString &t) const;
+ QString trimmedCodeLine(const QString &t) const;
- inline void eraseChar(QString &t, int k, QChar ch);
- inline QChar lastParen(const QString &t);
- inline bool okay(QChar typedIn, QChar okayCh);
+ void eraseChar(QString &t, int k, QChar ch) const;
+ QChar lastParen(const QString &t) const;
+ bool okay(QChar typedIn, QChar okayCh) const;
/*
The "linizer" is a group of functions and variables to iterate
@@ -103,23 +104,21 @@ private:
bool inCComment;
bool pendingRightBrace;
QString line;
- TextEditor::TextBlockIterator iter;
+ QTextBlock iter;
};
- struct Program {
- TextEditor::TextBlockIterator b, e;
- typedef TextEditor::TextBlockIterator iterator;
- typedef TextEditor::TextBlockIterator const_iterator;
-
+ class Program
+ {
+ public:
Program() {}
- Program(TextEditor::TextBlockIterator begin, TextEditor::TextBlockIterator end)
- : b(begin), e(end) {}
+ Program(QTextBlock begin, QTextBlock end)
+ : begin(begin), end(end) {}
- iterator begin() const { return b; }
- iterator end() const { return e; }
+ QTextBlock firstBlock() const { return begin; }
+ QTextBlock lastBlock() const { return end; }
- const_iterator constBegin() const { return b; }
- const_iterator constEnd() const { return e; }
+ private:
+ QTextBlock begin, end;
};
Program yyProgram;
@@ -135,10 +134,10 @@ private:
QRegExp inlineCComment;
QRegExp braceX;
QRegExp iflikeKeyword;
+ QRegExp propertylikeKeyword;
};
-} // namespace Internal
-} // namespace QtScriptEditor
+} // namespace SharedTools
#endif // QTSCRIPTINDENTER_H