Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
9548b91b
Commit
9548b91b
authored
Mar 17, 2009
by
hjk
Browse files
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
parents
fff7187f
437bbd00
Changes
16
Hide whitespace changes
Inline
Side-by-side
share/qtcreator/templates/qt4project/widget.ui
View file @
9548b91b
<ui version="4.0">
<class>%CLASS%
Class
</class>
<class>%CLASS%</class>
<widget class="%BASECLASS%" name="%CLASS%" >
<property name="geometry" >
<rect>
...
...
src/plugins/cpptools/cppcodecompletion.cpp
View file @
9548b91b
...
...
@@ -1128,7 +1128,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
if
(
function
->
argumentCount
()
==
0
)
{
extraChars
+=
QLatin1Char
(
'<'
);
}
}
else
{
}
else
if
(
!
function
->
isAmbiguous
())
{
extraChars
+=
QLatin1Char
(
'('
);
// If the function takes no arguments, automatically place the closing parenthesis
...
...
src/plugins/cpptools/cppmodelmanager.cpp
View file @
9548b91b
...
...
@@ -214,7 +214,6 @@ private:
Document
::
Ptr
m_currentDoc
;
QSet
<
QString
>
m_todo
;
QSet
<
QString
>
m_processed
;
QFutureSynchronizer
<
void
>
m_synchronizer
;
};
}
// namespace Internal
...
...
@@ -224,9 +223,7 @@ CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager)
:
snapshot
(
modelManager
->
snapshot
()),
m_modelManager
(
modelManager
),
preprocess
(
this
,
&
env
)
{
m_synchronizer
.
setCancelOnWait
(
true
);
}
{
}
CppPreprocessor
::~
CppPreprocessor
()
{
}
...
...
@@ -510,7 +507,9 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type,
snapshot
.
insert
(
doc
->
fileName
(),
doc
);
m_todo
.
remove
(
fileName
);
m_synchronizer
.
addFuture
(
QtConcurrent
::
run
(
Process
(
m_modelManager
),
doc
));
Process
process
(
m_modelManager
);
process
(
doc
);
(
void
)
switchDocument
(
previousDoc
);
}
...
...
src/plugins/designer/cpp/formclasswizardparameters.cpp
View file @
9548b91b
...
...
@@ -162,6 +162,7 @@ bool FormClassWizardParameters::generateCpp(QString *header, QString *source, in
if
(
languageChange
)
{
sourceStr
<<
'\n'
<<
namespaceIndent
<<
"void "
<<
unqualifiedClassName
<<
"::"
<<
"changeEvent(QEvent *e)
\n
"
<<
namespaceIndent
<<
"{
\n
"
<<
namespaceIndent
<<
indent
<<
formBaseClass
<<
"::changeEvent(e);
\n
"
<<
namespaceIndent
<<
indent
<<
"switch (e->type()) {
\n
"
<<
namespaceIndent
<<
indent
<<
"case QEvent::LanguageChange:
\n
"
<<
namespaceIndent
<<
indent
<<
indent
;
if
(
embedding
!=
InheritedUiClass
)
...
...
src/plugins/git/branchmodel.cpp
View file @
9548b91b
...
...
@@ -109,7 +109,8 @@ bool RemoteBranchModel::refreshBranches(const QString &workingDirectory, bool re
int
*
currentBranch
,
QString
*
errorMessage
)
{
// Run branch command with verbose.
QStringList
branchArgs
(
QLatin1String
(
"-v"
));
QStringList
branchArgs
;
branchArgs
<<
QLatin1String
(
GitClient
::
noColorOption
)
<<
QLatin1String
(
"-v"
);
QString
output
;
*
currentBranch
=
-
1
;
if
(
remoteBranches
)
...
...
src/plugins/git/gitclient.cpp
View file @
9548b91b
...
...
@@ -57,8 +57,8 @@
using
namespace
Git
;
using
namespace
Git
::
Internal
;
const
char
*
const
kGitDirectoryC
=
".git"
;
const
char
*
const
kBranchIndicatorC
=
"# On branch"
;
static
const
char
*
const
kGitDirectoryC
=
".git"
;
static
const
char
*
const
kBranchIndicatorC
=
"# On branch"
;
static
inline
QString
msgServerFailure
()
{
...
...
@@ -108,6 +108,8 @@ GitClient::~GitClient()
{
}
const
char
*
GitClient
::
noColorOption
=
"--no-color"
;
QString
GitClient
::
findRepositoryForFile
(
const
QString
&
fileName
)
{
const
QString
gitDirectory
=
QLatin1String
(
kGitDirectoryC
);
...
...
@@ -201,22 +203,24 @@ void GitClient::diff(const QString &workingDirectory,
// when using the submit dialog.
GitCommand
*
command
=
createCommand
(
workingDirectory
,
editor
);
// Directory diff?
QStringList
commonDiffArgs
;
commonDiffArgs
<<
QLatin1String
(
"diff"
)
<<
QLatin1String
(
noColorOption
);
if
(
unstagedFileNames
.
empty
()
&&
stagedFileNames
.
empty
())
{
QStringList
arguments
;
arguments
<<
QLatin1String
(
"diff"
)
<<
diffArgs
;
QStringList
arguments
(
commonDiffArgs
)
;
arguments
<<
diffArgs
;
m_plugin
->
outputWindow
()
->
append
(
formatCommand
(
binary
,
arguments
));
command
->
addJob
(
arguments
,
m_settings
.
timeout
);
}
else
{
// Files diff.
if
(
!
unstagedFileNames
.
empty
())
{
QStringList
arguments
;
arguments
<<
QLatin1String
(
"diff"
)
<<
diffArgs
<<
QLatin1String
(
"--"
)
<<
unstagedFileNames
;
QStringList
arguments
(
commonDiffArgs
)
;
arguments
<<
QLatin1String
(
"--"
)
<<
unstagedFileNames
;
m_plugin
->
outputWindow
()
->
append
(
formatCommand
(
binary
,
arguments
));
command
->
addJob
(
arguments
,
m_settings
.
timeout
);
}
if
(
!
stagedFileNames
.
empty
())
{
QStringList
arguments
;
arguments
<<
QLatin1String
(
"diff"
)
<<
QLatin1String
(
"--cached"
)
<<
diffArgs
<<
QLatin1String
(
"--"
)
<<
stagedFileNames
;
QStringList
arguments
(
commonDiffArgs
)
;
arguments
<<
QLatin1String
(
"--cached"
)
<<
diffArgs
<<
QLatin1String
(
"--"
)
<<
stagedFileNames
;
m_plugin
->
outputWindow
()
->
append
(
formatCommand
(
binary
,
arguments
));
command
->
addJob
(
arguments
,
m_settings
.
timeout
);
}
...
...
@@ -231,9 +235,9 @@ void GitClient::diff(const QString &workingDirectory,
if
(
Git
::
Constants
::
debug
)
qDebug
()
<<
"diff"
<<
workingDirectory
<<
fileName
;
QStringList
arguments
;
arguments
<<
QLatin1String
(
"diff"
);
arguments
<<
QLatin1String
(
"diff"
)
<<
QLatin1String
(
noColorOption
)
;
if
(
!
fileName
.
isEmpty
())
arguments
<<
diffArgs
<<
QLatin1String
(
"--"
)
<<
fileName
;
arguments
<<
diffArgs
<<
QLatin1String
(
"--"
)
<<
fileName
;
const
QString
kind
=
QLatin1String
(
Git
::
Constants
::
GIT_DIFF_EDITOR_KIND
);
const
QString
title
=
tr
(
"Git Diff %1"
).
arg
(
fileName
);
...
...
@@ -245,6 +249,7 @@ void GitClient::diff(const QString &workingDirectory,
void
GitClient
::
status
(
const
QString
&
workingDirectory
)
{
// @TODO: Use "--no-color" once it is supported
QStringList
statusArgs
(
QLatin1String
(
"status"
));
statusArgs
<<
QLatin1String
(
"-u"
);
executeGit
(
workingDirectory
,
statusArgs
,
0
,
true
);
...
...
@@ -255,7 +260,8 @@ void GitClient::log(const QString &workingDirectory, const QString &fileName)
if
(
Git
::
Constants
::
debug
)
qDebug
()
<<
"log"
<<
workingDirectory
<<
fileName
;
QStringList
arguments
(
QLatin1String
(
"log"
));
QStringList
arguments
;
arguments
<<
QLatin1String
(
"log"
)
<<
QLatin1String
(
noColorOption
);
if
(
m_settings
.
logCount
>
0
)
arguments
<<
QLatin1String
(
"-n"
)
<<
QString
::
number
(
m_settings
.
logCount
);
...
...
@@ -274,8 +280,8 @@ void GitClient::show(const QString &source, const QString &id)
{
if
(
Git
::
Constants
::
debug
)
qDebug
()
<<
"show"
<<
source
<<
id
;
QStringList
arguments
(
QLatin1String
(
"show"
))
;
arguments
<<
id
;
QStringList
arguments
;
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
);
...
...
@@ -450,7 +456,7 @@ bool GitClient::synchronousShow(const QString &workingDirectory, const QString &
if
(
Git
::
Constants
::
debug
)
qDebug
()
<<
Q_FUNC_INFO
<<
workingDirectory
<<
id
;
QStringList
args
(
QLatin1String
(
"show"
));
args
<<
id
;
args
<<
QLatin1String
(
noColorOption
)
<<
id
;
QByteArray
outputText
;
QByteArray
errorText
;
const
bool
rc
=
synchronousGit
(
workingDirectory
,
args
,
&
outputText
,
&
errorText
);
...
...
@@ -633,10 +639,12 @@ GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory,
// Run 'status'. Note that git returns exitcode 1 if there are no added files.
QByteArray
outputText
;
QByteArray
errorText
;
// @TODO: Use "--no-color" once it is supported
QStringList
statusArgs
(
QLatin1String
(
"status"
));
if
(
untracked
)
statusArgs
<<
QLatin1String
(
"-u"
);
const
bool
statusRc
=
synchronousGit
(
workingDirectory
,
statusArgs
,
&
outputText
,
&
errorText
);
GitCommand
::
removeColorCodes
(
&
outputText
);
if
(
output
)
*
output
=
QString
::
fromLocal8Bit
(
outputText
).
remove
(
QLatin1Char
(
'\r'
));
// Is it something really fatal?
...
...
@@ -958,14 +966,14 @@ void GitClient::stashPop(const QString &workingDirectory)
void
GitClient
::
branchList
(
const
QString
&
workingDirectory
)
{
QStringList
arguments
(
QLatin1String
(
"branch"
));
arguments
<<
QLatin1String
(
"-r"
);
arguments
<<
QLatin1String
(
"-r"
)
<<
QLatin1String
(
noColorOption
)
;
executeGit
(
workingDirectory
,
arguments
,
0
,
true
);
}
void
GitClient
::
stashList
(
const
QString
&
workingDirectory
)
{
QStringList
arguments
(
QLatin1String
(
"stash"
));
arguments
<<
QLatin1String
(
"list"
);
arguments
<<
QLatin1String
(
"list"
)
<<
QLatin1String
(
noColorOption
)
;
executeGit
(
workingDirectory
,
arguments
,
0
,
true
);
}
...
...
src/plugins/git/gitclient.h
View file @
9548b91b
...
...
@@ -135,6 +135,8 @@ public:
static
QString
msgNoChangedFiles
();
static
const
char
*
noColorOption
;
public
slots
:
void
show
(
const
QString
&
source
,
const
QString
&
id
);
...
...
src/plugins/git/gitcommand.cpp
View file @
9548b91b
...
...
@@ -121,6 +121,10 @@ void GitCommand::run()
// Special hack: Always produce output for diff
if
(
ok
&&
output
.
isEmpty
()
&&
m_jobs
.
front
().
arguments
.
at
(
0
)
==
QLatin1String
(
"diff"
))
{
output
+=
"The file does not differ from HEAD"
;
}
else
{
// @TODO: Remove, see below
if
(
ok
&&
m_jobs
.
front
().
arguments
.
at
(
0
)
==
QLatin1String
(
"status"
))
removeColorCodes
(
&
output
);
}
if
(
ok
&&
!
output
.
isEmpty
())
...
...
@@ -133,5 +137,28 @@ void GitCommand::run()
this
->
deleteLater
();
}
// Clean output from carriage return and ANSI color codes.
// @TODO: Remove once all relevant commands support "--no-color",
//("status" is missing it as of git 1.6.2)
void
GitCommand
::
removeColorCodes
(
QByteArray
*
data
)
{
// Remove ansi color codes that look like "ESC[<stuff>m"
const
QByteArray
ansiColorEscape
(
"
\033
["
);
int
escapePos
=
0
;
while
(
true
)
{
const
int
nextEscapePos
=
data
->
indexOf
(
ansiColorEscape
,
escapePos
);
if
(
nextEscapePos
==
-
1
)
break
;
const
int
endEscapePos
=
data
->
indexOf
(
'm'
,
nextEscapePos
+
ansiColorEscape
.
size
());
if
(
endEscapePos
!=
-
1
)
{
data
->
remove
(
nextEscapePos
,
endEscapePos
-
nextEscapePos
+
1
);
escapePos
=
nextEscapePos
;
}
else
{
escapePos
=
nextEscapePos
+
ansiColorEscape
.
size
();
}
}
}
}
// namespace Internal
}
// namespace Git
src/plugins/git/gitcommand.h
View file @
9548b91b
...
...
@@ -50,6 +50,10 @@ public:
void
addJob
(
const
QStringList
&
arguments
,
int
timeout
);
void
execute
();
// Clean output from carriage return and ANSI color codes.
// Workaround until all relevant commands support "--no-color".
static
void
removeColorCodes
(
QByteArray
*
data
);
private:
void
run
();
...
...
src/shared/cplusplus/AST.cpp
View file @
9548b91b
...
...
@@ -1682,6 +1682,10 @@ FunctionDeclaratorAST *FunctionDeclaratorAST::clone(MemoryPool *pool) const
void
FunctionDeclaratorAST
::
accept0
(
ASTVisitor
*
visitor
)
{
if
(
visitor
->
visit
(
this
))
{
accept
(
parameters
,
visitor
);
for
(
SpecifierAST
*
it
=
cv_qualifier_seq
;
it
;
it
=
it
->
next
)
accept
(
it
,
visitor
);
accept
(
exception_specification
,
visitor
);
}
visitor
->
endVisit
(
this
);
}
...
...
src/shared/cplusplus/AST.h
View file @
9548b91b
...
...
@@ -805,6 +805,7 @@ public:
unsigned
rparen_token
;
SpecifierAST
*
cv_qualifier_seq
;
ExceptionSpecificationAST
*
exception_specification
;
ExpressionAST
*
as_cpp_initializer
;
public:
// annotations
Function
*
symbol
;
...
...
src/shared/cplusplus/CheckDeclarator.cpp
View file @
9548b91b
...
...
@@ -157,6 +157,7 @@ bool CheckDeclarator::visit(NestedDeclaratorAST *ast)
bool
CheckDeclarator
::
visit
(
FunctionDeclaratorAST
*
ast
)
{
Function
*
fun
=
control
()
->
newFunction
(
ast
->
firstToken
());
fun
->
setAmbiguous
(
ast
->
as_cpp_initializer
!=
0
);
ast
->
symbol
=
fun
;
fun
->
setReturnType
(
_fullySpecifiedType
);
...
...
src/shared/cplusplus/Parser.cpp
View file @
9548b91b
...
...
@@ -977,7 +977,7 @@ bool Parser::parseCoreDeclarator(DeclaratorAST *&node)
return
false
;
}
bool
Parser
::
parseDeclarator
(
DeclaratorAST
*&
node
)
bool
Parser
::
parseDeclarator
(
DeclaratorAST
*&
node
,
bool
stopAtCppInitializer
)
{
if
(
!
parseCoreDeclarator
(
node
))
return
false
;
...
...
@@ -988,6 +988,47 @@ bool Parser::parseDeclarator(DeclaratorAST *&node)
unsigned
startOfPostDeclarator
=
cursor
();
if
(
LA
()
==
T_LPAREN
)
{
if
(
stopAtCppInitializer
)
{
unsigned
lparen_token
=
cursor
();
ExpressionAST
*
initializer
=
0
;
bool
blocked
=
blockErrors
(
true
);
if
(
parseInitializer
(
initializer
))
{
if
(
NestedExpressionAST
*
expr
=
initializer
->
asNestedExpression
())
{
if
(
expr
->
expression
&&
expr
->
rparen_token
&&
(
LA
()
==
T_COMMA
||
LA
()
==
T_SEMICOLON
))
{
rewind
(
lparen_token
);
// check for ambiguous declarators.
consumeToken
();
ParameterDeclarationClauseAST
*
parameter_declaration_clause
=
0
;
if
(
parseParameterDeclarationClause
(
parameter_declaration_clause
)
&&
LA
()
==
T_RPAREN
)
{
unsigned
rparen_token
=
consumeToken
();
FunctionDeclaratorAST
*
ast
=
new
(
_pool
)
FunctionDeclaratorAST
;
ast
->
lparen_token
=
lparen_token
;
ast
->
parameters
=
parameter_declaration_clause
;
ast
->
as_cpp_initializer
=
initializer
;
ast
->
rparen_token
=
rparen_token
;
*
postfix_ptr
=
ast
;
postfix_ptr
=
&
(
*
postfix_ptr
)
->
next
;
blockErrors
(
blocked
);
return
true
;
}
blockErrors
(
blocked
);
rewind
(
lparen_token
);
return
true
;
}
}
}
blockErrors
(
blocked
);
rewind
(
lparen_token
);
}
FunctionDeclaratorAST
*
ast
=
new
(
_pool
)
FunctionDeclaratorAST
;
ast
->
lparen_token
=
consumeToken
();
parseParameterDeclarationClause
(
ast
->
parameters
);
...
...
@@ -1494,7 +1535,7 @@ bool Parser::parseInitDeclarator(DeclaratorAST *&node,
if
(
acceptStructDeclarator
&&
LA
()
==
T_COLON
)
{
// anonymous bit-field declaration.
// ### TODO create the AST
}
else
if
(
!
parseDeclarator
(
node
))
{
}
else
if
(
!
parseDeclarator
(
node
,
/*stopAtCppInitializer = */
!
acceptStructDeclarator
))
{
return
false
;
}
...
...
src/shared/cplusplus/Parser.h
View file @
9548b91b
...
...
@@ -107,7 +107,7 @@ public:
bool
parseSimpleDeclaration
(
DeclarationAST
*&
node
,
bool
acceptStructDeclarator
=
false
);
bool
parseDeclarationStatement
(
StatementAST
*&
node
);
bool
parseCoreDeclarator
(
DeclaratorAST
*&
node
);
bool
parseDeclarator
(
DeclaratorAST
*&
node
);
bool
parseDeclarator
(
DeclaratorAST
*&
node
,
bool
stopAtCppInitializer
=
false
);
bool
parseDeleteExpression
(
ExpressionAST
*&
node
);
bool
parseDoStatement
(
StatementAST
*&
node
);
bool
parseElaboratedTypeSpecifier
(
SpecifierAST
*&
node
);
...
...
src/shared/cplusplus/Symbols.cpp
View file @
9548b91b
...
...
@@ -255,6 +255,12 @@ bool Function::isPureVirtual() const
void
Function
::
setPureVirtual
(
bool
isPureVirtual
)
{
_isPureVirtual
=
isPureVirtual
;
}
bool
Function
::
isAmbiguous
()
const
{
return
_isAmbiguous
;
}
void
Function
::
setAmbiguous
(
bool
isAmbiguous
)
{
_isAmbiguous
=
isAmbiguous
;
}
void
Function
::
visitSymbol0
(
SymbolVisitor
*
visitor
)
{
if
(
visitor
->
visit
(
this
))
{
...
...
src/shared/cplusplus/Symbols.h
View file @
9548b91b
...
...
@@ -322,6 +322,9 @@ public:
virtual
Function
*
asFunctionType
()
{
return
this
;
}
bool
isAmbiguous
()
const
;
// internal
void
setAmbiguous
(
bool
isAmbiguous
);
// internal
protected:
virtual
void
visitSymbol0
(
SymbolVisitor
*
visitor
);
virtual
void
accept0
(
TypeVisitor
*
visitor
);
...
...
@@ -337,6 +340,7 @@ private:
unsigned
_isPureVirtual
:
1
;
unsigned
_isConst
:
1
;
unsigned
_isVolatile
:
1
;
unsigned
_isAmbiguous
:
1
;
unsigned
_methodKey
:
3
;
};
};
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment