forked from qt-creator/qt-creator
Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline
This commit is contained in:
@@ -4,6 +4,10 @@
|
|||||||
|
|
||||||
Qt Creator is Qt Software's crossplatform IDE. The core of Qt Creator is
|
Qt Creator is Qt Software's crossplatform IDE. The core of Qt Creator is
|
||||||
basically only a \l{ExtensionSystem}{plugin loader}.
|
basically only a \l{ExtensionSystem}{plugin loader}.
|
||||||
|
All functionality is implemented in plugins, the basis of Qt Creator is
|
||||||
|
implemented in the \l{Core} {Core} Plugin. The plugin manager provides
|
||||||
|
simple means for plugin cooperation that allow plugins to provide
|
||||||
|
hooks for other plugin's extensions.
|
||||||
|
|
||||||
\section1 Core Libraries
|
\section1 Core Libraries
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ language = Cpp
|
|||||||
headerdirs = . \
|
headerdirs = . \
|
||||||
../../src/libs/aggregation \
|
../../src/libs/aggregation \
|
||||||
../../src/libs/extensionsystem \
|
../../src/libs/extensionsystem \
|
||||||
../../src/plugins/core \
|
../../src/plugins/coreplugin \
|
||||||
../../src/plugins/core/actionmanager
|
../../src/plugins/coreplugin/actionmanager
|
||||||
|
|
||||||
sourcedirs = . \
|
sourcedirs = . \
|
||||||
../../src/libs/aggregation \
|
../../src/libs/aggregation \
|
||||||
../../src/libs/extensionsystem \
|
../../src/libs/extensionsystem \
|
||||||
../../src/plugins/core \
|
../../src/plugins/coreplugin \
|
||||||
../../src/plugins/core/actionmanager
|
../../src/plugins/coreplugin/actionmanager
|
||||||
|
|
||||||
headers.fileextesnions = "*.h"
|
headers.fileextesnions = "*.h"
|
||||||
sources.fileextensions = "*.cpp *.qdoc"
|
sources.fileextensions = "*.cpp *.qdoc"
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
\o \l{Navigating Quickly Around Your Code with Locator}
|
\o \l{Navigating Quickly Around Your Code with Locator}
|
||||||
\o \l{Debugging with Qt Creator}
|
\o \l{Debugging with Qt Creator}
|
||||||
\o \l{Tips and Tricks}
|
\o \l{Tips and Tricks}
|
||||||
|
\o \l{Keyboard Shortcuts}
|
||||||
\o \l{Glossary}
|
\o \l{Glossary}
|
||||||
\o \l{Known Issues of Version 0.9.1 (Beta)}
|
\o \l{Known Issues of Version 0.9.1 (Beta)}
|
||||||
\endlist
|
\endlist
|
||||||
@@ -150,6 +151,26 @@
|
|||||||
|
|
||||||
\image qtcreator-compile-pane.png
|
\image qtcreator-compile-pane.png
|
||||||
|
|
||||||
|
|
||||||
|
\section1 Session Management in Qt Creator
|
||||||
|
|
||||||
|
### screenshot
|
||||||
|
|
||||||
|
In Qt Creator, a session is a collection of loaded projects, opened files,
|
||||||
|
editor settings, and so on. When you run Qt Creator, you have a default
|
||||||
|
session. You can create a new session using the \gui{Session Manager...},
|
||||||
|
available in the \gui{File -> Session} menu.
|
||||||
|
|
||||||
|
To switch between sessions, select \gui{File -> Session}. If you do not
|
||||||
|
create and select any session, Qt Creator will always use the default
|
||||||
|
session.
|
||||||
|
|
||||||
|
\omit
|
||||||
|
session management can also store project dependencies, thorbjorn is
|
||||||
|
currently working on it
|
||||||
|
\endomit
|
||||||
|
|
||||||
|
|
||||||
\section1 Qt Help Integration
|
\section1 Qt Help Integration
|
||||||
|
|
||||||
Qt Creator comes fully integrated with all of Qt's documentation and
|
Qt Creator comes fully integrated with all of Qt's documentation and
|
||||||
@@ -380,9 +401,11 @@
|
|||||||
|
|
||||||
We begin with a Qt4 Gui Application project generated by Qt Creator. The
|
We begin with a Qt4 Gui Application project generated by Qt Creator. The
|
||||||
\l{Creating a Project in Qt Creator} document describes this process in
|
\l{Creating a Project in Qt Creator} document describes this process in
|
||||||
detail. Remember to select QWidget as the Text Finder's base class.
|
detail. Remember to select QWidget as the Text Finder's base class. If
|
||||||
|
your project is not yet loaded, you can load it by selecting \gui{Open}
|
||||||
|
from the \gui{File} menu.
|
||||||
|
|
||||||
Once your project is generated, you will have the following files:
|
In your project you will have the following files:
|
||||||
|
|
||||||
\list
|
\list
|
||||||
\o \c{textfinder.h}
|
\o \c{textfinder.h}
|
||||||
|
|||||||
@@ -3898,6 +3898,8 @@ void IdentifierListAST::accept0(ASTVisitor *visitor)
|
|||||||
|
|
||||||
unsigned ObjCClassDeclarationAST::firstToken() const
|
unsigned ObjCClassDeclarationAST::firstToken() const
|
||||||
{
|
{
|
||||||
|
if (attributes)
|
||||||
|
return attributes->firstToken();
|
||||||
return class_token;
|
return class_token;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3911,12 +3913,19 @@ unsigned ObjCClassDeclarationAST::lastToken() const
|
|||||||
return it->identifier_token + 1;
|
return it->identifier_token + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (SpecifierAST *it = attributes; it; it = it->next) {
|
||||||
|
if (! it->next)
|
||||||
|
return it->lastToken();
|
||||||
|
}
|
||||||
|
|
||||||
return class_token + 1;
|
return class_token + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCClassDeclarationAST *ObjCClassDeclarationAST::clone(MemoryPool *pool) const
|
ObjCClassDeclarationAST *ObjCClassDeclarationAST::clone(MemoryPool *pool) const
|
||||||
{
|
{
|
||||||
ObjCClassDeclarationAST *ast = new (pool) ObjCClassDeclarationAST;
|
ObjCClassDeclarationAST *ast = new (pool) ObjCClassDeclarationAST;
|
||||||
|
if (attributes)
|
||||||
|
ast->attributes = attributes->clone(pool);
|
||||||
ast->class_token = class_token;
|
ast->class_token = class_token;
|
||||||
if (identifier_list)
|
if (identifier_list)
|
||||||
ast->identifier_list = identifier_list->clone(pool);
|
ast->identifier_list = identifier_list->clone(pool);
|
||||||
@@ -3927,6 +3936,9 @@ ObjCClassDeclarationAST *ObjCClassDeclarationAST::clone(MemoryPool *pool) const
|
|||||||
void ObjCClassDeclarationAST::accept0(ASTVisitor *visitor)
|
void ObjCClassDeclarationAST::accept0(ASTVisitor *visitor)
|
||||||
{
|
{
|
||||||
if (visitor->visit(this)) {
|
if (visitor->visit(this)) {
|
||||||
|
for (SpecifierAST *it = attributes; it; it = it->next) {
|
||||||
|
accept(it, visitor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1949,6 +1949,7 @@ protected:
|
|||||||
class CPLUSPLUS_EXPORT ObjCClassDeclarationAST: public DeclarationAST
|
class CPLUSPLUS_EXPORT ObjCClassDeclarationAST: public DeclarationAST
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
SpecifierAST *attributes;
|
||||||
unsigned class_token;
|
unsigned class_token;
|
||||||
IdentifierListAST *identifier_list;
|
IdentifierListAST *identifier_list;
|
||||||
unsigned semicolon_token;
|
unsigned semicolon_token;
|
||||||
|
|||||||
@@ -403,39 +403,48 @@ bool Parser::parseDeclaration(DeclarationAST *&node)
|
|||||||
case T_EXPORT:
|
case T_EXPORT:
|
||||||
return parseTemplateDeclaration(node);
|
return parseTemplateDeclaration(node);
|
||||||
|
|
||||||
// objc++
|
// ObjcC++
|
||||||
case T_AT_IMPLEMENTATION:
|
|
||||||
return parseObjCClassImplementation(node);
|
|
||||||
|
|
||||||
case T_AT_CLASS:
|
case T_AT_CLASS:
|
||||||
return parseObjCClassDeclaration(node);
|
return parseObjCClassDeclaration(node);
|
||||||
|
|
||||||
case T_AT_INTERFACE:
|
case T_AT_INTERFACE:
|
||||||
return parseObjCInterfaceDeclaration(node);
|
return parseObjCInterface(node);
|
||||||
|
|
||||||
case T_AT_PROTOCOL:
|
case T_AT_PROTOCOL:
|
||||||
return parseObjCProtocolDeclaration(node);
|
return parseObjCProtocol(node);
|
||||||
|
|
||||||
|
case T_AT_IMPLEMENTATION:
|
||||||
|
return parseObjCImplementation(node);
|
||||||
|
|
||||||
case T_AT_END:
|
case T_AT_END:
|
||||||
return parseObjCEndDeclaration(node);
|
return parseObjCEnd(node);
|
||||||
|
|
||||||
case T_AT_COMPATIBILITY_ALIAS:
|
default: {
|
||||||
return parseObjCAliasDeclaration(node);
|
if (_objCEnabled && LA() == T___ATTRIBUTE__) {
|
||||||
|
const unsigned start = cursor();
|
||||||
|
SpecifierAST *attributes = 0, **attr = &attributes;
|
||||||
|
while (parseAttributeSpecifier(*attr))
|
||||||
|
attr = &(*attr)->next;
|
||||||
|
if (LA() == T_AT_INTERFACE)
|
||||||
|
return parseObjCInterface(node, attributes);
|
||||||
|
else if (LA() == T_AT_PROTOCOL)
|
||||||
|
return parseObjCProtocol(node, attributes);
|
||||||
|
else if (LA() == T_AT_PROPERTY)
|
||||||
|
return parseObjCPropertyDeclaration(node, attributes);
|
||||||
|
rewind(start);
|
||||||
|
}
|
||||||
|
|
||||||
case T_AT_SYNTHESIZE:
|
|
||||||
return parseObjCPropertySynthesize(node);
|
|
||||||
|
|
||||||
case T_AT_DYNAMIC:
|
|
||||||
return parseObjCPropertyDynamic(node);
|
|
||||||
|
|
||||||
default:
|
|
||||||
if (LA() == T_EXTERN && LA(2) == T_TEMPLATE)
|
if (LA() == T_EXTERN && LA(2) == T_TEMPLATE)
|
||||||
return parseTemplateDeclaration(node);
|
return parseTemplateDeclaration(node);
|
||||||
else if (LA() == T_EXTERN && LA(2) == T_STRING_LITERAL)
|
else if (LA() == T_EXTERN && LA(2) == T_STRING_LITERAL)
|
||||||
return parseLinkageSpecification(node);
|
return parseLinkageSpecification(node);
|
||||||
else
|
else
|
||||||
return parseSimpleDeclaration(node);
|
return parseSimpleDeclaration(node);
|
||||||
|
} break; // default
|
||||||
|
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Parser::parseLinkageSpecification(DeclarationAST *&node)
|
bool Parser::parseLinkageSpecification(DeclarationAST *&node)
|
||||||
@@ -2543,16 +2552,7 @@ bool Parser::parsePrimaryExpression(ExpressionAST *&node)
|
|||||||
case T_SLOT:
|
case T_SLOT:
|
||||||
return parseQtMethod(node);
|
return parseQtMethod(node);
|
||||||
|
|
||||||
case T_AT_ENCODE:
|
|
||||||
case T_AT_PROTOCOL:
|
|
||||||
case T_AT_SELECTOR:
|
|
||||||
case T_AT_STRING_LITERAL:
|
|
||||||
return parseObjCExpression(node);
|
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
if (_objCEnabled && LA() == T_LBRACKET)
|
|
||||||
return parseObjCExpression(node);
|
|
||||||
|
|
||||||
unsigned startOfName = cursor();
|
unsigned startOfName = cursor();
|
||||||
NameAST *name = 0;
|
NameAST *name = 0;
|
||||||
if (parseName(name)) {
|
if (parseName(name)) {
|
||||||
@@ -3303,491 +3303,6 @@ bool Parser::parseThrowExpression(ExpressionAST *&node)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Parser::parseObjCClassImplementation(DeclarationAST *&)
|
|
||||||
{
|
|
||||||
if (LA() != T_AT_IMPLEMENTATION)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/*unsigned implementation_token = */ consumeToken();
|
|
||||||
unsigned identifier_token = 0;
|
|
||||||
match(T_IDENTIFIER, &identifier_token);
|
|
||||||
|
|
||||||
if (LA() == T_COLON) {
|
|
||||||
/*unsigned colon_token = */ consumeToken();
|
|
||||||
unsigned superclass_name_token = 0;
|
|
||||||
match(T_IDENTIFIER, &superclass_name_token);
|
|
||||||
} else if (LA() == T_LPAREN) {
|
|
||||||
/*unsigned lparen_token = */ consumeToken();
|
|
||||||
unsigned category_name_token = 0;
|
|
||||||
if (LA() == T_IDENTIFIER)
|
|
||||||
category_name_token = consumeToken();
|
|
||||||
unsigned rparen_token = 0;
|
|
||||||
match(T_RPAREN, &rparen_token);
|
|
||||||
}
|
|
||||||
|
|
||||||
_inObjCImplementationContext = true;
|
|
||||||
parseObjCMethodDefinitionList();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCClassDeclaration(DeclarationAST *&node)
|
|
||||||
{
|
|
||||||
if (LA() != T_AT_CLASS)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
ObjCClassDeclarationAST *ast = new (_pool) ObjCClassDeclarationAST;
|
|
||||||
ast->class_token = consumeToken();
|
|
||||||
parseObjCIdentifierList(ast->identifier_list);
|
|
||||||
match(T_SEMICOLON, &ast->semicolon_token);
|
|
||||||
node = ast;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCInterfaceDeclaration(DeclarationAST *&)
|
|
||||||
{
|
|
||||||
if (LA() != T_AT_INTERFACE)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/*unsigned interface_token = */ consumeToken();
|
|
||||||
unsigned interface_name_token = 0;
|
|
||||||
match(T_IDENTIFIER, &interface_name_token);
|
|
||||||
if (LA() == T_LPAREN) {
|
|
||||||
// category interface
|
|
||||||
/*unsigned lparen_token = */ consumeToken();
|
|
||||||
unsigned catagory_name_token = 0;
|
|
||||||
if (LA() == T_IDENTIFIER)
|
|
||||||
catagory_name_token = consumeToken();
|
|
||||||
unsigned rparen_token = 0;
|
|
||||||
match(T_RPAREN, &rparen_token);
|
|
||||||
parseObjCProtocolRefs();
|
|
||||||
parseObjCClassInstanceVariables();
|
|
||||||
parseObjCInterfaceDeclList();
|
|
||||||
unsigned end_token = 0;
|
|
||||||
match(T_AT_END, &end_token);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
// class interface
|
|
||||||
unsigned colon_token = 0;
|
|
||||||
unsigned super_class_token = 0;
|
|
||||||
if (LA() == T_COLON) {
|
|
||||||
colon_token = consumeToken();
|
|
||||||
match(T_IDENTIFIER, &super_class_token);
|
|
||||||
}
|
|
||||||
parseObjCProtocolRefs();
|
|
||||||
parseObjCInterfaceDeclList();
|
|
||||||
unsigned end_token = 0;
|
|
||||||
match(T_AT_END, &end_token);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCProtocolDeclaration(DeclarationAST *&)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCEndDeclaration(DeclarationAST *&)
|
|
||||||
{
|
|
||||||
if (LA() != T_AT_END)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
unsigned end_token = consumeToken();
|
|
||||||
|
|
||||||
if (! _inObjCImplementationContext) {
|
|
||||||
_translationUnit->warning(end_token,
|
|
||||||
"@end must appear in an @implementation context");
|
|
||||||
}
|
|
||||||
|
|
||||||
_inObjCImplementationContext = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCAliasDeclaration(DeclarationAST *&)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCPropertySynthesize(DeclarationAST *&)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCPropertyDynamic(DeclarationAST *&)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCIdentifierList(IdentifierListAST *&node)
|
|
||||||
{
|
|
||||||
if (LA() == T_IDENTIFIER) {
|
|
||||||
IdentifierListAST **it = &node;
|
|
||||||
IdentifierListAST *id = new (_pool) IdentifierListAST;
|
|
||||||
id->identifier_token = consumeToken();
|
|
||||||
*it = id;
|
|
||||||
while (LA() == T_COMMA) {
|
|
||||||
consumeToken();
|
|
||||||
if (LA() == T_IDENTIFIER) {
|
|
||||||
it = &(*it)->next;
|
|
||||||
IdentifierListAST *id = new (_pool) IdentifierListAST;
|
|
||||||
id->identifier_token = consumeToken();
|
|
||||||
*it = id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCProtocolRefs()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCClassInstanceVariables()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCInterfaceDeclList()
|
|
||||||
{
|
|
||||||
unsigned saved = cursor();
|
|
||||||
while (LA() != T_AT_END && parseObjCInterfaceMemberDeclaration()) {
|
|
||||||
if (saved == cursor())
|
|
||||||
consumeToken(); // skip a token
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCInterfaceMemberDeclaration()
|
|
||||||
{
|
|
||||||
switch (LA()) {
|
|
||||||
case T_SEMICOLON:
|
|
||||||
consumeToken();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case T_AT_REQUIRED:
|
|
||||||
case T_AT_OPTIONAL:
|
|
||||||
consumeToken();
|
|
||||||
return true;
|
|
||||||
|
|
||||||
case T_PLUS:
|
|
||||||
case T_MINUS:
|
|
||||||
return parseObjCMethodPrototype();
|
|
||||||
|
|
||||||
default: {
|
|
||||||
DeclarationAST *declaration = 0;
|
|
||||||
if (parseDeclaration(declaration))
|
|
||||||
return true;
|
|
||||||
} // default
|
|
||||||
|
|
||||||
} // switch
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCPropertyDeclaration(DeclarationAST *&)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCMethodPrototype()
|
|
||||||
{
|
|
||||||
if (LA() != T_PLUS && LA() != T_MINUS)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// instance or class method?
|
|
||||||
/*unsigned method_type_token = */ consumeToken();
|
|
||||||
|
|
||||||
SpecifierAST *attributes = 0, **attr = &attributes;
|
|
||||||
while (parseAttributeSpecifier(*attr))
|
|
||||||
attr = &(*attr)->next;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCExpression(ExpressionAST *&node)
|
|
||||||
{
|
|
||||||
switch (LA()) {
|
|
||||||
case T_LBRACKET:
|
|
||||||
return parseObjCMessageExpression(node);
|
|
||||||
|
|
||||||
case T_AT_STRING_LITERAL:
|
|
||||||
return parseObjCStringLiteral(node);
|
|
||||||
|
|
||||||
case T_AT_ENCODE:
|
|
||||||
return parseObjCEncodeExpression(node);
|
|
||||||
|
|
||||||
case T_AT_PROTOCOL:
|
|
||||||
return parseObjCProtocolExpression(node);
|
|
||||||
|
|
||||||
case T_AT_SELECTOR:
|
|
||||||
return parseObjCSelectorExpression(node);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCMessageExpression(ExpressionAST *&)
|
|
||||||
{
|
|
||||||
if (LA() != T_LBRACKET)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/*unsigned lbracket_token = */ consumeToken();
|
|
||||||
ExpressionAST *receiver = 0;
|
|
||||||
parseObjCMessageReceiver(receiver);
|
|
||||||
parseObjCMessageArguments();
|
|
||||||
unsigned rbracket_token = 0;
|
|
||||||
match(T_RBRACKET, &rbracket_token);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCStringLiteral(ExpressionAST *&)
|
|
||||||
{
|
|
||||||
if (LA() != T_AT_STRING_LITERAL)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
do {
|
|
||||||
consumeToken();
|
|
||||||
} while (LA() == T_AT_STRING_LITERAL);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCEncodeExpression(ExpressionAST *&)
|
|
||||||
{
|
|
||||||
if (LA() != T_AT_ENCODE)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/*unsigned encode_token = */ consumeToken();
|
|
||||||
unsigned lparen_token = 0, rparen_token = 0;
|
|
||||||
match(T_LPAREN, &lparen_token);
|
|
||||||
SpecifierAST *type_specifier = 0;
|
|
||||||
parseSimpleTypeSpecifier(type_specifier);
|
|
||||||
match(T_RPAREN, &rparen_token);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCProtocolExpression(ExpressionAST *&)
|
|
||||||
{
|
|
||||||
if (LA() != T_AT_PROTOCOL)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/*unsigned protocol_token = */ consumeToken();
|
|
||||||
unsigned protocol_name_token = 0, lparen_token = 0, rparen_token = 0;
|
|
||||||
match(T_LPAREN, &lparen_token);
|
|
||||||
match(T_IDENTIFIER, &protocol_name_token);
|
|
||||||
match(T_RPAREN, &rparen_token);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCSelectorExpression(ExpressionAST *&)
|
|
||||||
{
|
|
||||||
if (LA() != T_AT_SELECTOR)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/*unsigned selector_token = */ consumeToken();
|
|
||||||
unsigned lparen_token = 0, rparen_token = 0;
|
|
||||||
match(T_LPAREN, &lparen_token);
|
|
||||||
while (LA(1) == T_IDENTIFIER && LA(2) == T_COLON) {
|
|
||||||
/*unsigned identifier_token = */ consumeToken();
|
|
||||||
/*unsigned colon_token = */ consumeToken();
|
|
||||||
}
|
|
||||||
match(T_RPAREN, &rparen_token);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCMessageReceiver(ExpressionAST *&node)
|
|
||||||
{
|
|
||||||
// ### expression or simple-type-specifier.
|
|
||||||
return parseExpression(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCMessageArguments()
|
|
||||||
{
|
|
||||||
if (LA() != T_IDENTIFIER && LA() != T_COLON)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
unsigned selector_name_token = 0;
|
|
||||||
|
|
||||||
if (LA() == T_IDENTIFIER)
|
|
||||||
selector_name_token = consumeToken();
|
|
||||||
|
|
||||||
if (LA() == T_COLON) {
|
|
||||||
/*unsigned colon_token = */ consumeToken();
|
|
||||||
|
|
||||||
ExpressionAST *expr = 0;
|
|
||||||
parseAssignmentExpression(expr);
|
|
||||||
|
|
||||||
while ((LA() == T_IDENTIFIER && LA(2) == T_COLON) || LA() == T_COLON) {
|
|
||||||
if (LA() == T_IDENTIFIER)
|
|
||||||
consumeToken();
|
|
||||||
|
|
||||||
if (LA() == T_COLON)
|
|
||||||
consumeToken();
|
|
||||||
|
|
||||||
parseAssignmentExpression(expr);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (LA() == T_COMMA) {
|
|
||||||
consumeToken();
|
|
||||||
parseAssignmentExpression(expr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCMethodDefinitionList()
|
|
||||||
{
|
|
||||||
bool done = false;
|
|
||||||
while (! done) {
|
|
||||||
switch (LA()) {
|
|
||||||
case T_EOF_SYMBOL:
|
|
||||||
case T_AT_END:
|
|
||||||
done = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_PLUS:
|
|
||||||
case T_MINUS:
|
|
||||||
parseObjCMethodSignature();
|
|
||||||
if (LA() == T_SEMICOLON)
|
|
||||||
consumeToken();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_AT_PROPERTY:
|
|
||||||
parseObjCAtProperty();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_SEMICOLON:
|
|
||||||
consumeToken();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_AT_OPTIONAL:
|
|
||||||
consumeToken();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_AT_REQUIRED:
|
|
||||||
consumeToken();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case T_TEMPLATE:
|
|
||||||
case T_NAMESPACE: {
|
|
||||||
DeclarationAST *declaration = 0;
|
|
||||||
parseDeclaration(declaration);
|
|
||||||
} break;
|
|
||||||
|
|
||||||
default: {
|
|
||||||
unsigned start = cursor();
|
|
||||||
DeclarationAST *declaration = 0;
|
|
||||||
if (LA(1) == T_EXTERN && LA(2) == T_STRING_LITERAL) {
|
|
||||||
parseLinkageSpecification(declaration);
|
|
||||||
} else if (parseBlockDeclaration(declaration)) {
|
|
||||||
// ### accept the declaration.
|
|
||||||
} else {
|
|
||||||
if (cursor() == start) {
|
|
||||||
_translationUnit->error(cursor(),
|
|
||||||
"stray `%s' between Objective-C++ methods",
|
|
||||||
tok().spell());
|
|
||||||
consumeToken();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} break; // default
|
|
||||||
|
|
||||||
} // switch
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCMethodSignature()
|
|
||||||
{
|
|
||||||
if (LA() != T_PLUS && LA() != T_MINUS)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/*unsigned method_type_token = */ consumeToken();
|
|
||||||
parseObjCTypeName();
|
|
||||||
|
|
||||||
bool first = true;
|
|
||||||
|
|
||||||
while (lookAtObjCSelector() || LA() == T_COLON) {
|
|
||||||
if (LA() != T_COLON)
|
|
||||||
/*selector_name_token = */ consumeToken();
|
|
||||||
|
|
||||||
SpecifierAST *attributes = 0, **attr = &attributes;
|
|
||||||
while (parseAttributeSpecifier(*attr))
|
|
||||||
attr = &(*attr)->next;
|
|
||||||
|
|
||||||
if (first) {
|
|
||||||
first = false;
|
|
||||||
|
|
||||||
if (LA() != T_COLON)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned colon_token = 0;
|
|
||||||
match(T_COLON, &colon_token);
|
|
||||||
|
|
||||||
parseObjCTypeName();
|
|
||||||
|
|
||||||
unsigned identifier_token = 0;
|
|
||||||
match(T_IDENTIFIER, &identifier_token);
|
|
||||||
|
|
||||||
while (parseAttributeSpecifier(*attr))
|
|
||||||
attr = &(*attr)->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse the method tail parameters.
|
|
||||||
while (LA() == T_COMMA) {
|
|
||||||
consumeToken();
|
|
||||||
|
|
||||||
if (LA() == T_DOT_DOT_DOT) {
|
|
||||||
consumeToken();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
DeclarationAST *parameter_declaration = 0;
|
|
||||||
parseParameterDeclaration(parameter_declaration);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCTypeName()
|
|
||||||
{
|
|
||||||
if (LA() != T_LPAREN)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/*unsigned lparen_token = */ consumeToken();
|
|
||||||
|
|
||||||
parseObjCProtocolQualifiers();
|
|
||||||
|
|
||||||
ExpressionAST *type_id = 0;
|
|
||||||
if (LA() != T_RPAREN)
|
|
||||||
parseTypeId(type_id);
|
|
||||||
|
|
||||||
SpecifierAST *attributes = 0, **attr = &attributes;
|
|
||||||
while (parseAttributeSpecifier(*attr))
|
|
||||||
attr = &(*attr)->next;
|
|
||||||
|
|
||||||
unsigned rparen_token = 0;
|
|
||||||
match(T_RPAREN, &rparen_token);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCAtProperty()
|
|
||||||
{
|
|
||||||
if (LA() != T_AT_PROPERTY)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/*unsigned property_token = */ consumeToken();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::parseObjCProtocolQualifiers()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Parser::lookAtObjCSelector() const
|
bool Parser::lookAtObjCSelector() const
|
||||||
{
|
{
|
||||||
switch (LA()) {
|
switch (LA()) {
|
||||||
@@ -3812,4 +3327,427 @@ bool Parser::lookAtObjCSelector() const
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// objc-class-declaraton ::= T_AT_CLASS (T_IDENTIFIER @ T_COMMA) T_SEMICOLON
|
||||||
|
//
|
||||||
|
bool Parser::parseObjCClassDeclaration(DeclarationAST *&)
|
||||||
|
{
|
||||||
|
if (LA() != T_AT_CLASS)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/*unsigned objc_class_token = */ consumeToken();
|
||||||
|
unsigned identifier_token = 0;
|
||||||
|
match(T_IDENTIFIER, &identifier_token);
|
||||||
|
while (LA() == T_COMMA) {
|
||||||
|
consumeToken(); // skip T_COMMA
|
||||||
|
match(T_IDENTIFIER, &identifier_token);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned semicolon_token = 0;
|
||||||
|
match(T_SEMICOLON, &semicolon_token);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// objc-interface ::= attribute-specifier-list-opt objc-class-interface
|
||||||
|
// objc-interface ::= objc-category-interface
|
||||||
|
//
|
||||||
|
// objc-class-interface ::= T_AT_INTERFACE T_IDENTIFIER (T_COLON T_IDENTIFIER)?
|
||||||
|
// objc-protocol-refs-opt
|
||||||
|
// objc-class-instance-variables-opt
|
||||||
|
// objc-interface-declaration-list
|
||||||
|
// T_AT_END
|
||||||
|
//
|
||||||
|
// objc-category-interface ::= T_AT_INTERFACE T_IDENTIFIER
|
||||||
|
// T_LPAREN T_IDENTIFIER? T_RPAREN
|
||||||
|
// objc-protocol-refs-opt
|
||||||
|
// objc-interface-declaration-list
|
||||||
|
// T_AT_END
|
||||||
|
//
|
||||||
|
bool Parser::parseObjCInterface(DeclarationAST *&,
|
||||||
|
SpecifierAST *attributes)
|
||||||
|
{
|
||||||
|
if (! attributes && LA() == T___ATTRIBUTE__) {
|
||||||
|
SpecifierAST **attr = &attributes;
|
||||||
|
while (parseAttributeSpecifier(*attr))
|
||||||
|
attr = &(*attr)->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LA() != T_AT_INTERFACE)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/*unsigned objc_interface_token = */ consumeToken();
|
||||||
|
unsigned identifier_token = 0;
|
||||||
|
match(T_IDENTIFIER, &identifier_token);
|
||||||
|
|
||||||
|
if (LA() == T_LPAREN) {
|
||||||
|
// a category interface
|
||||||
|
|
||||||
|
if (attributes)
|
||||||
|
_translationUnit->error(attributes->firstToken(),
|
||||||
|
"invalid attributes for category interface declaration");
|
||||||
|
|
||||||
|
unsigned lparen_token = 0, rparen_token = 0;
|
||||||
|
match(T_LPAREN, &lparen_token);
|
||||||
|
if (LA() == T_IDENTIFIER)
|
||||||
|
consumeToken();
|
||||||
|
|
||||||
|
match(T_RPAREN, &rparen_token);
|
||||||
|
|
||||||
|
parseObjCProtocolRefs();
|
||||||
|
while (parseObjCInterfaceMemberDeclaration()) {
|
||||||
|
}
|
||||||
|
unsigned objc_end_token = 0;
|
||||||
|
match(T_AT_END, &objc_end_token);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// a class interface declaration
|
||||||
|
if (LA() == T_COLON) {
|
||||||
|
consumeToken();
|
||||||
|
unsigned identifier_token = 0;
|
||||||
|
match(T_IDENTIFIER, &identifier_token);
|
||||||
|
}
|
||||||
|
|
||||||
|
parseObjCProtocolRefs();
|
||||||
|
parseObjClassInstanceVariables();
|
||||||
|
while (parseObjCInterfaceMemberDeclaration()) {
|
||||||
|
}
|
||||||
|
unsigned objc_end_token = 0;
|
||||||
|
match(T_AT_END, &objc_end_token);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// objc-protocol ::= T_AT_PROTOCOL (T_IDENTIFIER @ T_COMMA) T_SEMICOLON
|
||||||
|
//
|
||||||
|
bool Parser::parseObjCProtocol(DeclarationAST *&,
|
||||||
|
SpecifierAST *attributes)
|
||||||
|
{
|
||||||
|
if (! attributes && LA() == T___ATTRIBUTE__) {
|
||||||
|
SpecifierAST **attr = &attributes;
|
||||||
|
while (parseAttributeSpecifier(*attr))
|
||||||
|
attr = &(*attr)->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LA() != T_AT_PROTOCOL)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/*unsigned objc_protocol_token = */ consumeToken();
|
||||||
|
unsigned identifier_token = 0;
|
||||||
|
match(T_IDENTIFIER, &identifier_token);
|
||||||
|
|
||||||
|
if (LA() == T_COMMA || LA() == T_SEMICOLON) {
|
||||||
|
// a protocol forward declaration
|
||||||
|
|
||||||
|
while (LA() == T_COMMA) {
|
||||||
|
consumeToken();
|
||||||
|
match(T_IDENTIFIER, &identifier_token);
|
||||||
|
}
|
||||||
|
unsigned semicolon_token = 0;
|
||||||
|
match(T_SEMICOLON, &semicolon_token);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// a protocol definition
|
||||||
|
parseObjCProtocolRefs();
|
||||||
|
|
||||||
|
while (parseObjCInterfaceMemberDeclaration()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned objc_end_token = 0;
|
||||||
|
match(T_AT_END, &objc_end_token);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// objc-implementation ::= T_AT_IMPLEMENTAION T_IDENTIFIER (T_COLON T_IDENTIFIER)?
|
||||||
|
// objc-class-instance-variables-opt
|
||||||
|
// objc-implementation ::= T_AT_IMPLEMENTAION T_IDENTIFIER T_LPAREN T_IDENTIFIER T_RPAREN
|
||||||
|
//
|
||||||
|
bool Parser::parseObjCImplementation(DeclarationAST *&)
|
||||||
|
{
|
||||||
|
if (LA() != T_AT_IMPLEMENTATION)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
consumeToken();
|
||||||
|
|
||||||
|
unsigned identifier_token = 0;
|
||||||
|
match(T_IDENTIFIER, &identifier_token);
|
||||||
|
|
||||||
|
if (LA() == T_LPAREN) {
|
||||||
|
// a category implementation
|
||||||
|
unsigned lparen_token = 0, rparen_token = 0;
|
||||||
|
unsigned category_name_token = 0;
|
||||||
|
match(T_LPAREN, &lparen_token);
|
||||||
|
match(T_IDENTIFIER, &category_name_token);
|
||||||
|
match(T_RPAREN, &rparen_token);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// a class implementation
|
||||||
|
if (LA() == T_COLON) {
|
||||||
|
consumeToken();
|
||||||
|
unsigned super_class_name_token = 0;
|
||||||
|
match(T_IDENTIFIER, &super_class_name_token);
|
||||||
|
}
|
||||||
|
|
||||||
|
parseObjClassInstanceVariables();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// objc-protocol-refs ::= T_LESS (T_IDENTIFIER @ T_COMMA) T_GREATER
|
||||||
|
//
|
||||||
|
bool Parser::parseObjCProtocolRefs()
|
||||||
|
{
|
||||||
|
if (LA() != T_LESS)
|
||||||
|
return false;
|
||||||
|
unsigned less_token = 0, greater_token = 0;
|
||||||
|
unsigned identifier_token = 0;
|
||||||
|
match(T_LESS, &less_token);
|
||||||
|
match(T_IDENTIFIER, &identifier_token);
|
||||||
|
while (LA() == T_COMMA) {
|
||||||
|
consumeToken();
|
||||||
|
match(T_IDENTIFIER, &identifier_token);
|
||||||
|
}
|
||||||
|
match(T_GREATER, &greater_token);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// objc-class-instance-variables ::= T_LBRACE
|
||||||
|
// objc-instance-variable-decl-list-opt
|
||||||
|
// T_RBRACE
|
||||||
|
//
|
||||||
|
bool Parser::parseObjClassInstanceVariables()
|
||||||
|
{
|
||||||
|
if (LA() != T_LBRACE)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unsigned lbrace_token = 0, rbrace_token = 0;
|
||||||
|
|
||||||
|
match(T_LBRACE, &lbrace_token);
|
||||||
|
while (LA()) {
|
||||||
|
if (LA() == T_RBRACE)
|
||||||
|
break;
|
||||||
|
|
||||||
|
const unsigned start = cursor();
|
||||||
|
|
||||||
|
DeclarationAST *declaration = 0;
|
||||||
|
parseObjCInstanceVariableDeclaration(declaration);
|
||||||
|
|
||||||
|
if (start == cursor()) {
|
||||||
|
// skip stray token.
|
||||||
|
_translationUnit->error(cursor(), "skip stray token `%s'", tok().spell());
|
||||||
|
consumeToken();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
match(T_RBRACE, &rbrace_token);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// objc-interface-declaration ::= T_AT_REQUIRED
|
||||||
|
// objc-interface-declaration ::= T_AT_OPTIONAL
|
||||||
|
// objc-interface-declaration ::= T_SEMICOLON
|
||||||
|
// objc-interface-declaration ::= objc-property-declaration
|
||||||
|
// objc-interface-declaration ::= objc-method-prototype
|
||||||
|
bool Parser::parseObjCInterfaceMemberDeclaration()
|
||||||
|
{
|
||||||
|
switch (LA()) {
|
||||||
|
case T_AT_REQUIRED:
|
||||||
|
case T_AT_OPTIONAL:
|
||||||
|
consumeToken();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case T_SEMICOLON:
|
||||||
|
consumeToken();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case T_AT_PROPERTY: {
|
||||||
|
DeclarationAST *declaration = 0;
|
||||||
|
return parseObjCPropertyDeclaration(declaration);
|
||||||
|
}
|
||||||
|
|
||||||
|
case T_PLUS:
|
||||||
|
case T_MINUS:
|
||||||
|
return parseObjCMethodPrototype();
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// objc-instance-variable-declaration ::= objc-visibility-specifier
|
||||||
|
// objc-instance-variable-declaration ::= block-declaration
|
||||||
|
//
|
||||||
|
bool Parser::parseObjCInstanceVariableDeclaration(DeclarationAST *&node)
|
||||||
|
{
|
||||||
|
switch (LA()) {
|
||||||
|
case T_AT_PRIVATE:
|
||||||
|
case T_AT_PROTECTED:
|
||||||
|
case T_AT_PUBLIC:
|
||||||
|
case T_AT_PACKAGE:
|
||||||
|
consumeToken();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return parseBlockDeclaration(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// objc-property-declaration ::=
|
||||||
|
// T_AT_PROPERTY T_LPAREN (property-attribute @ T_COMMA) T_RPAREN simple-declaration
|
||||||
|
//
|
||||||
|
bool Parser::parseObjCPropertyDeclaration(DeclarationAST *&, SpecifierAST *)
|
||||||
|
{
|
||||||
|
if (LA() != T_AT_PROPERTY)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/*unsigned objc_property_token = */ consumeToken();
|
||||||
|
|
||||||
|
if (LA() == T_LPAREN) {
|
||||||
|
unsigned lparen_token = 0, rparen_token = 0;
|
||||||
|
match(T_LPAREN, &lparen_token);
|
||||||
|
while (parseObjCPropertyAttribute()) {
|
||||||
|
}
|
||||||
|
match(T_RPAREN, &rparen_token);
|
||||||
|
}
|
||||||
|
|
||||||
|
DeclarationAST *simple_declaration = 0;
|
||||||
|
parseSimpleDeclaration(simple_declaration, /*accept-struct-declarators = */ false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// objc-method-prototype ::= (T_PLUS | T_MINUS) objc-method-decl objc-method-attrs-opt
|
||||||
|
//
|
||||||
|
// objc-method-decl ::= objc-type-name? objc-selector
|
||||||
|
// objc-method-decl ::= objc-type-name? objc-keyword-decl-list objc-parmlist-opt
|
||||||
|
//
|
||||||
|
bool Parser::parseObjCMethodPrototype()
|
||||||
|
{
|
||||||
|
if (LA() != T_PLUS && LA() != T_MINUS)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/*unsigned method_type_token = */ consumeToken();
|
||||||
|
|
||||||
|
parseObjCTypeName();
|
||||||
|
|
||||||
|
if ((lookAtObjCSelector() && LA(2) == T_COLON) || LA() == T_COLON) {
|
||||||
|
while (parseObjCKeywordDeclaration()) {
|
||||||
|
}
|
||||||
|
|
||||||
|
while (LA() == T_COMMA) {
|
||||||
|
consumeToken();
|
||||||
|
|
||||||
|
if (LA() == T_DOT_DOT_DOT) {
|
||||||
|
consumeToken();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
DeclarationAST *parameter_declaration = 0;
|
||||||
|
parseParameterDeclaration(parameter_declaration);
|
||||||
|
}
|
||||||
|
} else if (lookAtObjCSelector()) {
|
||||||
|
parseObjCSelector();
|
||||||
|
} else {
|
||||||
|
_translationUnit->error(cursor(), "expected a selector");
|
||||||
|
}
|
||||||
|
|
||||||
|
SpecifierAST *attributes = 0, **attr = &attributes;
|
||||||
|
while (parseAttributeSpecifier(*attr))
|
||||||
|
attr = &(*attr)->next;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// objc-property-attribute ::= getter '=' identifier
|
||||||
|
// objc-property-attribute ::= setter '=' identifier ':'
|
||||||
|
// objc-property-attribute ::= readonly
|
||||||
|
// objc-property-attribute ::= readwrite
|
||||||
|
// objc-property-attribute ::= assign
|
||||||
|
// objc-property-attribute ::= retain
|
||||||
|
// objc-property-attribute ::= copy
|
||||||
|
// objc-property-attribute ::= nonatomic
|
||||||
|
bool Parser::parseObjCPropertyAttribute()
|
||||||
|
{
|
||||||
|
if (LA() != T_IDENTIFIER)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unsigned identifier_token = 0;
|
||||||
|
match(T_IDENTIFIER, &identifier_token);
|
||||||
|
if (LA() == T_EQUAL) {
|
||||||
|
consumeToken();
|
||||||
|
match(T_IDENTIFIER, &identifier_token);
|
||||||
|
if (LA() == T_COLON)
|
||||||
|
consumeToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// objc-type-name ::= T_LPAREN objc-type-qualifiers-opt type-id T_RPAREN
|
||||||
|
//
|
||||||
|
bool Parser::parseObjCTypeName()
|
||||||
|
{
|
||||||
|
if (LA() != T_LPAREN)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unsigned lparen_token = 0, rparen_token = 0;
|
||||||
|
match(T_LPAREN, &lparen_token);
|
||||||
|
parseObjCTypeQualifiers();
|
||||||
|
ExpressionAST *type_id = 0;
|
||||||
|
parseTypeId(type_id);
|
||||||
|
match(T_RPAREN, &rparen_token);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// objc-selector ::= T_IDENTIFIER | keyword
|
||||||
|
//
|
||||||
|
bool Parser::parseObjCSelector()
|
||||||
|
{
|
||||||
|
if (! lookAtObjCSelector())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
consumeToken();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// objc-keyword-decl ::= objc-selector? T_COLON objc-type-name? objc-keyword-attributes-opt T_IDENTIFIER
|
||||||
|
//
|
||||||
|
bool Parser::parseObjCKeywordDeclaration()
|
||||||
|
{
|
||||||
|
if (! (LA() == T_COLON || (lookAtObjCSelector() && LA(2) == T_COLON)))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
parseObjCSelector();
|
||||||
|
|
||||||
|
unsigned colon_token = 0;
|
||||||
|
match(T_COLON, &colon_token);
|
||||||
|
|
||||||
|
parseObjCTypeName();
|
||||||
|
|
||||||
|
SpecifierAST *attributes = 0, **attr = &attributes;
|
||||||
|
while (parseAttributeSpecifier(*attr))
|
||||||
|
attr = &(*attr)->next;
|
||||||
|
|
||||||
|
unsigned identifier_token = 0;
|
||||||
|
match(T_IDENTIFIER, &identifier_token);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Parser::parseObjCTypeQualifiers()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// objc-end: T_AT_END
|
||||||
|
bool Parser::parseObjCEnd(DeclarationAST *&)
|
||||||
|
{
|
||||||
|
if (LA() != T_AT_END)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
consumeToken();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
CPLUSPLUS_END_NAMESPACE
|
CPLUSPLUS_END_NAMESPACE
|
||||||
|
|||||||
@@ -206,46 +206,33 @@ public:
|
|||||||
bool parseUsingDirective(DeclarationAST *&node);
|
bool parseUsingDirective(DeclarationAST *&node);
|
||||||
bool parseWhileStatement(StatementAST *&node);
|
bool parseWhileStatement(StatementAST *&node);
|
||||||
|
|
||||||
// ObjC++
|
|
||||||
bool parseObjCClassImplementation(DeclarationAST *&node);
|
|
||||||
bool parseObjCClassDeclaration(DeclarationAST *&node);
|
|
||||||
bool parseObjCInterfaceDeclaration(DeclarationAST *&node);
|
|
||||||
bool parseObjCProtocolDeclaration(DeclarationAST *&node);
|
|
||||||
bool parseObjCEndDeclaration(DeclarationAST *&node);
|
|
||||||
bool parseObjCAliasDeclaration(DeclarationAST *&node);
|
|
||||||
bool parseObjCPropertySynthesize(DeclarationAST *&node);
|
|
||||||
bool parseObjCPropertyDynamic(DeclarationAST *&node);
|
|
||||||
|
|
||||||
bool parseObjCIdentifierList(IdentifierListAST *&node);
|
|
||||||
|
|
||||||
bool parseObjCPropertyDeclaration(DeclarationAST *&node);
|
|
||||||
bool parseObjCProtocolRefs();
|
|
||||||
bool parseObjCClassInstanceVariables();
|
|
||||||
bool parseObjCInterfaceMemberDeclaration();
|
|
||||||
bool parseObjCInterfaceDeclList();
|
|
||||||
bool parseObjCMethodPrototype();
|
|
||||||
|
|
||||||
bool parseObjCExpression(ExpressionAST *&node);
|
|
||||||
bool parseObjCMessageExpression(ExpressionAST *&node);
|
|
||||||
bool parseObjCStringLiteral(ExpressionAST *&node);
|
|
||||||
bool parseObjCEncodeExpression(ExpressionAST *&node);
|
|
||||||
bool parseObjCProtocolExpression(ExpressionAST *&node);
|
|
||||||
bool parseObjCSelectorExpression(ExpressionAST *&node);
|
|
||||||
|
|
||||||
bool parseObjCMessageReceiver(ExpressionAST *&node);
|
|
||||||
bool parseObjCMessageArguments();
|
|
||||||
|
|
||||||
bool parseObjCMethodSignature();
|
|
||||||
bool parseObjCMethodDefinitionList();
|
|
||||||
bool parseObjCAtProperty();
|
|
||||||
bool parseObjCTypeName();
|
|
||||||
bool parseObjCProtocolQualifiers();
|
|
||||||
|
|
||||||
bool lookAtObjCSelector() const;
|
|
||||||
|
|
||||||
// Qt MOC run
|
// Qt MOC run
|
||||||
bool parseQtMethod(ExpressionAST *&node);
|
bool parseQtMethod(ExpressionAST *&node);
|
||||||
|
|
||||||
|
// ObjC++
|
||||||
|
bool parseObjCClassDeclaration(DeclarationAST *&node);
|
||||||
|
bool parseObjCInterface(DeclarationAST *&node,
|
||||||
|
SpecifierAST *attributes = 0);
|
||||||
|
bool parseObjCProtocol(DeclarationAST *&node,
|
||||||
|
SpecifierAST *attributes = 0);
|
||||||
|
|
||||||
|
bool parseObjCProtocolRefs();
|
||||||
|
bool parseObjClassInstanceVariables();
|
||||||
|
bool parseObjCInterfaceMemberDeclaration();
|
||||||
|
bool parseObjCInstanceVariableDeclaration(DeclarationAST *&node);
|
||||||
|
bool parseObjCPropertyDeclaration(DeclarationAST *&node,
|
||||||
|
SpecifierAST *attributes = 0);
|
||||||
|
bool parseObjCImplementation(DeclarationAST *&node);
|
||||||
|
bool parseObjCMethodPrototype();
|
||||||
|
bool parseObjCPropertyAttribute();
|
||||||
|
bool parseObjCTypeName();
|
||||||
|
bool parseObjCSelector();
|
||||||
|
bool parseObjCKeywordDeclaration();
|
||||||
|
bool parseObjCTypeQualifiers();
|
||||||
|
bool parseObjCEnd(DeclarationAST *&node);
|
||||||
|
|
||||||
|
bool lookAtObjCSelector() const;
|
||||||
|
|
||||||
bool skipUntil(int token);
|
bool skipUntil(int token);
|
||||||
bool skipUntilDeclaration();
|
bool skipUntilDeclaration();
|
||||||
bool skipUntilStatement();
|
bool skipUntilStatement();
|
||||||
|
|||||||
@@ -201,9 +201,9 @@ enum Kind {
|
|||||||
T___TYPEOF__,
|
T___TYPEOF__,
|
||||||
|
|
||||||
// obj c++ @ keywords
|
// obj c++ @ keywords
|
||||||
T_FIRST_OBJC_KEYWORD,
|
T_FIRST_OBJC_AT_KEYWORD,
|
||||||
|
|
||||||
T_AT_CATCH = T_FIRST_OBJC_KEYWORD,
|
T_AT_CATCH = T_FIRST_OBJC_AT_KEYWORD,
|
||||||
T_AT_CLASS,
|
T_AT_CLASS,
|
||||||
T_AT_COMPATIBILITY_ALIAS,
|
T_AT_COMPATIBILITY_ALIAS,
|
||||||
T_AT_DEFS,
|
T_AT_DEFS,
|
||||||
@@ -228,7 +228,9 @@ enum Kind {
|
|||||||
T_AT_THROW,
|
T_AT_THROW,
|
||||||
T_AT_TRY,
|
T_AT_TRY,
|
||||||
|
|
||||||
T_FIRST_QT_KEYWORD,
|
T_LAST_OBJC_AT_KEYWORD,
|
||||||
|
|
||||||
|
T_FIRST_QT_KEYWORD = T_LAST_OBJC_AT_KEYWORD,
|
||||||
|
|
||||||
// Qt keywords
|
// Qt keywords
|
||||||
T_SIGNAL = T_FIRST_QT_KEYWORD,
|
T_SIGNAL = T_FIRST_QT_KEYWORD,
|
||||||
@@ -295,6 +297,9 @@ public:
|
|||||||
inline bool isKeyword() const
|
inline bool isKeyword() const
|
||||||
{ return kind >= T_FIRST_KEYWORD && kind < T_FIRST_QT_KEYWORD; }
|
{ return kind >= T_FIRST_KEYWORD && kind < T_FIRST_QT_KEYWORD; }
|
||||||
|
|
||||||
|
inline bool isObjCAtKeyword() const
|
||||||
|
{ return kind >= T_FIRST_OBJC_AT_KEYWORD && kind < T_LAST_OBJC_AT_KEYWORD; }
|
||||||
|
|
||||||
static const char *name(int kind);
|
static const char *name(int kind);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -54,8 +54,7 @@ enum { debugLeaks = 0 };
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
\namespace ExtensionSystem
|
\namespace ExtensionSystem
|
||||||
\brief The ExtensionSystem namespace provides
|
\brief The ExtensionSystem namespace provides classes that belong to the core plugin system.
|
||||||
classes that belong to the core plugin system.
|
|
||||||
|
|
||||||
The basic extension system contains of the plugin manager and its supporting classes,
|
The basic extension system contains of the plugin manager and its supporting classes,
|
||||||
and the IPlugin interface that must be implemented by plugin providers.
|
and the IPlugin interface that must be implemented by plugin providers.
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ FileWizardDialog::FileWizardDialog(QWidget *parent) :
|
|||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
setOption(QWizard::NoCancelButton, false);
|
setOption(QWizard::NoCancelButton, false);
|
||||||
setOption(QWizard::NoDefaultButton, false);
|
setOption(QWizard::NoDefaultButton, false);
|
||||||
setPixmap(QWizard::WatermarkPixmap, QPixmap(QLatin1String(":/qworkbench/images/qtwatermark.png")));
|
setPixmap(QWizard::WatermarkPixmap, QPixmap(QLatin1String(":/core/images/qtwatermark.png")));
|
||||||
addPage(m_filePage);
|
addPage(m_filePage);
|
||||||
connect(m_filePage, SIGNAL(activated()), button(QWizard::FinishButton), SLOT(animateClick()));
|
connect(m_filePage, SIGNAL(activated()), button(QWizard::FinishButton), SLOT(animateClick()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
|
#include <QtCore/QTimer>
|
||||||
|
|
||||||
#include <QtGui/QPushButton>
|
#include <QtGui/QPushButton>
|
||||||
|
|
||||||
@@ -70,6 +71,42 @@ void QActionPushButton::actionChanged()
|
|||||||
setEnabled(a->isEnabled());
|
setEnabled(a->isEnabled());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helpers to retrieve model data
|
||||||
|
static inline bool listModelChecked(const QAbstractItemModel *model, int row, int column = 0)
|
||||||
|
{
|
||||||
|
const QModelIndex checkableIndex = model->index(row, column, QModelIndex());
|
||||||
|
return model->data(checkableIndex, Qt::CheckStateRole).toInt() == Qt::Checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline QString listModelText(const QAbstractItemModel *model, int row, int column)
|
||||||
|
{
|
||||||
|
const QModelIndex index = model->index(row, column, QModelIndex());
|
||||||
|
return model->data(index, Qt::DisplayRole).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find a check item in a model
|
||||||
|
static bool listModelContainsCheckedItem(const QAbstractItemModel *model)
|
||||||
|
{
|
||||||
|
const int count = model->rowCount();
|
||||||
|
for (int i = 0; i < count; i++)
|
||||||
|
if (listModelChecked(model, i, 0))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convenience to extract a list of selected indexes
|
||||||
|
QList<int> selectedRows(const QAbstractItemView *view)
|
||||||
|
{
|
||||||
|
const QModelIndexList indexList = view->selectionModel()->selectedRows(0);
|
||||||
|
if (indexList.empty())
|
||||||
|
return QList<int>();
|
||||||
|
QList<int> rc;
|
||||||
|
const QModelIndexList::const_iterator cend = indexList.constEnd();
|
||||||
|
for (QModelIndexList::const_iterator it = indexList.constBegin(); it != cend; ++it)
|
||||||
|
rc.push_back(it->row());
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
// ----------- SubmitEditorWidgetPrivate
|
// ----------- SubmitEditorWidgetPrivate
|
||||||
struct SubmitEditorWidgetPrivate
|
struct SubmitEditorWidgetPrivate
|
||||||
{
|
{
|
||||||
@@ -78,11 +115,15 @@ struct SubmitEditorWidgetPrivate
|
|||||||
Ui::SubmitEditorWidget m_ui;
|
Ui::SubmitEditorWidget m_ui;
|
||||||
bool m_filesSelected;
|
bool m_filesSelected;
|
||||||
bool m_filesChecked;
|
bool m_filesChecked;
|
||||||
|
int m_fileNameColumn;
|
||||||
|
int m_activatedRow;
|
||||||
};
|
};
|
||||||
|
|
||||||
SubmitEditorWidgetPrivate::SubmitEditorWidgetPrivate() :
|
SubmitEditorWidgetPrivate::SubmitEditorWidgetPrivate() :
|
||||||
m_filesSelected(false),
|
m_filesSelected(false),
|
||||||
m_filesChecked(false)
|
m_filesChecked(false),
|
||||||
|
m_fileNameColumn(1),
|
||||||
|
m_activatedRow(-1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,10 +133,10 @@ SubmitEditorWidget::SubmitEditorWidget(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
m_d->m_ui.setupUi(this);
|
m_d->m_ui.setupUi(this);
|
||||||
// File List
|
// File List
|
||||||
m_d->m_ui.fileList->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
m_d->m_ui.fileView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
connect(m_d->m_ui.fileList, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(triggerDiffSelected()));
|
m_d->m_ui.fileView->setRootIsDecorated(false);
|
||||||
connect(m_d->m_ui.fileList, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(fileItemChanged(QListWidgetItem*)));
|
connect(m_d->m_ui.fileView, SIGNAL(doubleClicked(QModelIndex)),
|
||||||
connect(m_d->m_ui.fileList, SIGNAL(itemSelectionChanged()), this, SLOT(fileSelectionChanged()));
|
this, SLOT(diffActivated(QModelIndex)));
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
m_d->m_ui.description->setFont(QFont(QLatin1String("Courier")));
|
m_d->m_ui.description->setFont(QFont(QLatin1String("Courier")));
|
||||||
@@ -124,8 +165,12 @@ void SubmitEditorWidget::registerActions(QAction *editorUndoAction, QAction *ed
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (submitAction) {
|
if (submitAction) {
|
||||||
if (debug)
|
if (debug) {
|
||||||
qDebug() << submitAction << m_d->m_ui.fileList->count() << "items" << m_d->m_filesChecked;
|
int count = 0;
|
||||||
|
if (const QAbstractItemModel *model = m_d->m_ui.fileView->model())
|
||||||
|
count = model->rowCount();
|
||||||
|
qDebug() << submitAction << count << "items" << m_d->m_filesChecked;
|
||||||
|
}
|
||||||
submitAction->setEnabled(m_d->m_filesChecked);
|
submitAction->setEnabled(m_d->m_filesChecked);
|
||||||
connect(this, SIGNAL(fileCheckStateChanged(bool)), submitAction, SLOT(setEnabled(bool)));
|
connect(this, SIGNAL(fileCheckStateChanged(bool)), submitAction, SLOT(setEnabled(bool)));
|
||||||
m_d->m_ui.buttonLayout->addWidget(new QActionPushButton(submitAction));
|
m_d->m_ui.buttonLayout->addWidget(new QActionPushButton(submitAction));
|
||||||
@@ -161,7 +206,6 @@ void SubmitEditorWidget::unregisterActions(QAction *editorUndoAction, QAction *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString SubmitEditorWidget::trimmedDescriptionText() const
|
QString SubmitEditorWidget::trimmedDescriptionText() const
|
||||||
{
|
{
|
||||||
// Make sure we have one terminating NL
|
// Make sure we have one terminating NL
|
||||||
@@ -180,91 +224,70 @@ void SubmitEditorWidget::setDescriptionText(const QString &text)
|
|||||||
m_d->m_ui.description->setPlainText(text);
|
m_d->m_ui.description->setPlainText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList SubmitEditorWidget::fileList() const
|
int SubmitEditorWidget::fileNameColumn() const
|
||||||
{
|
{
|
||||||
QStringList rc;
|
return m_d->m_fileNameColumn;
|
||||||
const int count = m_d->m_ui.fileList->count();
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
rc.push_back(m_d->m_ui.fileList->item(i)->text());
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubmitEditorWidget::addFilesUnblocked(const QStringList &list, bool checked, bool userCheckable)
|
void SubmitEditorWidget::setFileNameColumn(int c)
|
||||||
{
|
{
|
||||||
if (debug)
|
m_d->m_fileNameColumn = c;
|
||||||
qDebug() << Q_FUNC_INFO << list << checked << userCheckable;
|
}
|
||||||
foreach (const QString &f, list) {
|
|
||||||
QListWidgetItem *item = new QListWidgetItem(f);
|
void SubmitEditorWidget::setFileModel(QAbstractItemModel *model)
|
||||||
item->setCheckState(checked ? Qt::Checked : Qt::Unchecked);
|
{
|
||||||
if (!userCheckable)
|
m_d->m_ui.fileView->clearSelection(); // trigger the change signals
|
||||||
item->setFlags(item->flags() & ~Qt::ItemIsUserCheckable);
|
|
||||||
m_d->m_ui.fileList->addItem(item);
|
m_d->m_ui.fileView->setModel(model);
|
||||||
|
|
||||||
|
if (model->rowCount()) {
|
||||||
|
const int columnCount = model->columnCount();
|
||||||
|
for (int c = 0; c < columnCount; c++)
|
||||||
|
m_d->m_ui.fileView->resizeColumnToContents(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
|
||||||
|
this, SLOT(updateSubmitAction()));
|
||||||
|
connect(model, SIGNAL(modelReset()),
|
||||||
|
this, SLOT(updateSubmitAction()));
|
||||||
|
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
|
||||||
|
this, SLOT(updateSubmitAction()));
|
||||||
|
connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
|
||||||
|
this, SLOT(updateSubmitAction()));
|
||||||
|
connect(m_d->m_ui.fileView->selectionModel(), SIGNAL(selectionChanged(QItemSelection, QItemSelection)),
|
||||||
|
this, SLOT(updateDiffAction()));
|
||||||
|
updateActions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubmitEditorWidget::addFiles(const QStringList &list, bool checked, bool userCheckable)
|
QAbstractItemModel *SubmitEditorWidget::fileModel() const
|
||||||
{
|
{
|
||||||
if (list.empty())
|
return m_d->m_ui.fileView->model();
|
||||||
return;
|
|
||||||
|
|
||||||
const bool blocked = m_d->m_ui.fileList->blockSignals(true);
|
|
||||||
addFilesUnblocked(list, checked, userCheckable);
|
|
||||||
m_d->m_ui.fileList->blockSignals(blocked);
|
|
||||||
// Did we gain any checked files..update action accordingly
|
|
||||||
if (!m_d->m_filesChecked && checked) {
|
|
||||||
m_d->m_filesChecked = true;
|
|
||||||
emit fileCheckStateChanged(m_d->m_filesChecked);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SubmitEditorWidget::setFileList(const QStringList &list)
|
|
||||||
{
|
|
||||||
// Trigger enabling of menu action
|
|
||||||
m_d->m_ui.fileList->clearSelection();
|
|
||||||
|
|
||||||
const bool blocked = m_d->m_ui.fileList->blockSignals(true);
|
|
||||||
m_d->m_ui.fileList->clear();
|
|
||||||
if (!list.empty()) {
|
|
||||||
addFilesUnblocked(list, true, true);
|
|
||||||
// Checked files added?
|
|
||||||
if (!m_d->m_filesChecked) {
|
|
||||||
m_d->m_filesChecked = true;
|
|
||||||
emit fileCheckStateChanged(m_d->m_filesChecked);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_d->m_ui.fileList->blockSignals(blocked);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool containsCheckState(const QListWidget *lw, Qt::CheckState cs)
|
|
||||||
{
|
|
||||||
const int count = lw->count();
|
|
||||||
for (int i = 0; i < count; i++)
|
|
||||||
if (lw->item(i)->checkState() == cs)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList SubmitEditorWidget::selectedFiles() const
|
QStringList SubmitEditorWidget::selectedFiles() const
|
||||||
{
|
{
|
||||||
|
const QList<int> selection = selectedRows(m_d->m_ui.fileView);
|
||||||
|
if (selection.empty())
|
||||||
|
return QStringList();
|
||||||
|
|
||||||
QStringList rc;
|
QStringList rc;
|
||||||
const int count = m_d->m_ui.fileList->count();
|
const QAbstractItemModel *model = m_d->m_ui.fileView->model();
|
||||||
for (int i = 0; i < count; i++) {
|
const int count = selection.size();
|
||||||
const QListWidgetItem *item = m_d->m_ui.fileList->item(i);
|
for (int i = 0; i < count; i++)
|
||||||
if (item->isSelected())
|
rc.push_back(listModelText(model, selection.at(i), fileNameColumn()));
|
||||||
rc.push_back(item->text());
|
|
||||||
}
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList SubmitEditorWidget::checkedFiles() const
|
QStringList SubmitEditorWidget::checkedFiles() const
|
||||||
{
|
{
|
||||||
QStringList rc;
|
QStringList rc;
|
||||||
const int count = m_d->m_ui.fileList->count();
|
const QAbstractItemModel *model = m_d->m_ui.fileView->model();
|
||||||
for (int i = 0; i < count; i++) {
|
if (!model)
|
||||||
const QListWidgetItem *item = m_d->m_ui.fileList->item(i);
|
return rc;
|
||||||
if (item->checkState() == Qt::Checked)
|
const int count = model->rowCount();
|
||||||
rc.push_back(item->text());
|
for (int i = 0; i < count; i++)
|
||||||
}
|
if (listModelChecked(model, i, 0))
|
||||||
|
rc.push_back(listModelText(model, i, fileNameColumn()));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,44 +303,61 @@ void SubmitEditorWidget::triggerDiffSelected()
|
|||||||
emit diffSelected(sel);
|
emit diffSelected(sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubmitEditorWidget::fileItemChanged(QListWidgetItem *item)
|
void SubmitEditorWidget::diffActivatedDelayed()
|
||||||
{
|
{
|
||||||
const Qt::CheckState st = item->checkState();
|
const QStringList files = QStringList(listModelText(m_d->m_ui.fileView->model(), m_d->m_activatedRow, fileNameColumn()));
|
||||||
if (debug)
|
emit diffSelected(files);
|
||||||
qDebug() << Q_FUNC_INFO << st << item->text() << m_d->m_filesChecked;
|
}
|
||||||
// Enable the actions according to check state
|
|
||||||
switch (st) {
|
void SubmitEditorWidget::diffActivated(const QModelIndex &index)
|
||||||
case Qt::Unchecked: // Item was unchecked: Any checked items left?
|
{
|
||||||
if (m_d->m_filesChecked && !containsCheckState(m_d->m_ui.fileList, Qt::Checked)) {
|
// We need to delay the signal, otherwise, the diff editor will not
|
||||||
m_d->m_filesChecked = false;
|
// be in the foreground.
|
||||||
emit fileCheckStateChanged(m_d->m_filesChecked);
|
m_d->m_activatedRow = index.row();
|
||||||
}
|
QTimer::singleShot(0, this, SLOT(diffActivatedDelayed()));
|
||||||
break;
|
}
|
||||||
case Qt::Checked:
|
|
||||||
// Item was Checked. First one?
|
void SubmitEditorWidget::updateActions()
|
||||||
if (!m_d->m_filesChecked) {
|
{
|
||||||
m_d->m_filesChecked = true;
|
updateSubmitAction();
|
||||||
emit fileCheckStateChanged(m_d->m_filesChecked);
|
updateDiffAction();
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case Qt::PartiallyChecked: // Errm?
|
// Enable submit depending on having checked files
|
||||||
break;
|
void SubmitEditorWidget::updateSubmitAction()
|
||||||
|
{
|
||||||
|
const bool newFilesCheckedState = hasCheckedFiles();
|
||||||
|
if (m_d->m_filesChecked != newFilesCheckedState) {
|
||||||
|
m_d->m_filesChecked = newFilesCheckedState;
|
||||||
|
emit fileCheckStateChanged(m_d->m_filesChecked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubmitEditorWidget::fileSelectionChanged()
|
// Enable diff depending on selected files
|
||||||
|
void SubmitEditorWidget::updateDiffAction()
|
||||||
{
|
{
|
||||||
const bool newFilesSelected = !m_d->m_ui.fileList->selectedItems().empty();
|
const bool filesSelected = hasSelection();
|
||||||
if (debug)
|
if (m_d->m_filesSelected != filesSelected) {
|
||||||
qDebug() << Q_FUNC_INFO << newFilesSelected;
|
m_d->m_filesSelected = filesSelected;
|
||||||
if (m_d->m_filesSelected != newFilesSelected) {
|
|
||||||
m_d->m_filesSelected = newFilesSelected;
|
|
||||||
emit fileSelectionChanged(m_d->m_filesSelected);
|
emit fileSelectionChanged(m_d->m_filesSelected);
|
||||||
if (debug)
|
|
||||||
qDebug() << Q_FUNC_INFO << m_d->m_filesSelected;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SubmitEditorWidget::hasSelection() const
|
||||||
|
{
|
||||||
|
// Not present until model is set
|
||||||
|
if (const QItemSelectionModel *sm = m_d->m_ui.fileView->selectionModel())
|
||||||
|
return sm->hasSelection();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SubmitEditorWidget::hasCheckedFiles() const
|
||||||
|
{
|
||||||
|
if (const QAbstractItemModel *model = m_d->m_ui.fileView->model())
|
||||||
|
return listModelContainsCheckedItem(model);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void SubmitEditorWidget::changeEvent(QEvent *e)
|
void SubmitEditorWidget::changeEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
switch (e->type()) {
|
switch (e->type()) {
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ QT_BEGIN_NAMESPACE
|
|||||||
class QPlainTextEdit;
|
class QPlainTextEdit;
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
class QAction;
|
class QAction;
|
||||||
|
class QAbstractItemModel;
|
||||||
|
class QModelIndex;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
@@ -51,8 +53,9 @@ struct SubmitEditorWidgetPrivate;
|
|||||||
|
|
||||||
/* The submit editor presents the commit message in a text editor and an
|
/* The submit editor presents the commit message in a text editor and an
|
||||||
* checkable list of modified files in a list window. The user can delete
|
* checkable list of modified files in a list window. The user can delete
|
||||||
* files from the list by pressing unchecking them or diff the selection
|
* files from the list by unchecking them or diff the selection
|
||||||
* by doubleclicking.
|
* by doubleclicking. A list model which contains the file in a column
|
||||||
|
* specified by fileNameColumn should be set using setFileModel().
|
||||||
*
|
*
|
||||||
* Additionally, standard creator actions can be registered:
|
* Additionally, standard creator actions can be registered:
|
||||||
* Undo/redo will be set up to work with the description editor.
|
* Undo/redo will be set up to work with the description editor.
|
||||||
@@ -71,7 +74,7 @@ class QWORKBENCH_UTILS_EXPORT SubmitEditorWidget : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DISABLE_COPY(SubmitEditorWidget)
|
Q_DISABLE_COPY(SubmitEditorWidget)
|
||||||
Q_PROPERTY(QString descriptionText READ descriptionText WRITE setDescriptionText DESIGNABLE true)
|
Q_PROPERTY(QString descriptionText READ descriptionText WRITE setDescriptionText DESIGNABLE true)
|
||||||
Q_PROPERTY(QStringList fileList READ fileList WRITE setFileList DESIGNABLE true)
|
Q_PROPERTY(int fileNameColumn READ fileNameColumn WRITE setFileNameColumn DESIGNABLE false)
|
||||||
public:
|
public:
|
||||||
explicit SubmitEditorWidget(QWidget *parent = 0);
|
explicit SubmitEditorWidget(QWidget *parent = 0);
|
||||||
virtual ~SubmitEditorWidget();
|
virtual ~SubmitEditorWidget();
|
||||||
@@ -86,10 +89,11 @@ public:
|
|||||||
// Should be used to normalize newlines.
|
// Should be used to normalize newlines.
|
||||||
QString trimmedDescriptionText() const;
|
QString trimmedDescriptionText() const;
|
||||||
|
|
||||||
// The raw file list
|
int fileNameColumn() const;
|
||||||
QStringList fileList() const;
|
void setFileNameColumn(int c);
|
||||||
void addFiles(const QStringList&, bool checked = true, bool userCheckable = true);
|
|
||||||
void setFileList(const QStringList&);
|
void setFileModel(QAbstractItemModel *model);
|
||||||
|
QAbstractItemModel *fileModel() const;
|
||||||
|
|
||||||
// Files to be included in submit
|
// Files to be included in submit
|
||||||
QStringList checkedFiles() const;
|
QStringList checkedFiles() const;
|
||||||
@@ -110,11 +114,15 @@ protected:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void triggerDiffSelected();
|
void triggerDiffSelected();
|
||||||
void fileItemChanged(QListWidgetItem *);
|
void diffActivated(const QModelIndex &index);
|
||||||
void fileSelectionChanged();
|
void diffActivatedDelayed();
|
||||||
|
void updateActions();
|
||||||
|
void updateSubmitAction();
|
||||||
|
void updateDiffAction();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void addFilesUnblocked(const QStringList &list, bool checked, bool userCheckable);
|
bool hasSelection() const;
|
||||||
|
bool hasCheckedFiles() const;
|
||||||
|
|
||||||
SubmitEditorWidgetPrivate *m_d;
|
SubmitEditorWidgetPrivate *m_d;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -39,14 +39,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="fileList">
|
<widget class="QTreeView" name="fileView"/>
|
||||||
<property name="font">
|
|
||||||
<font/>
|
|
||||||
</property>
|
|
||||||
<property name="textElideMode">
|
|
||||||
<enum>Qt::ElideNone</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
@@ -503,7 +503,7 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
|
|||||||
|
|
||||||
QPixmap BaseFileWizard::watermark()
|
QPixmap BaseFileWizard::watermark()
|
||||||
{
|
{
|
||||||
return QPixmap(QLatin1String(":/qworkbench/images/qtwatermark.png"));
|
return QPixmap(QLatin1String(":/core/images/qtwatermark.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseFileWizard::setupWizard(QWizard *w)
|
void BaseFileWizard::setupWizard(QWizard *w)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/qworkbench" >
|
<qresource prefix="/core" >
|
||||||
<file>html/images/bg_site_header_dark_grey.png</file>
|
<file>html/images/bg_site_header_dark_grey.png</file>
|
||||||
<file>html/images/body_bg_circles_bottom_right.png</file>
|
<file>html/images/body_bg_circles_bottom_right.png</file>
|
||||||
<file>html/images/body_bg_gradient.png</file>
|
<file>html/images/body_bg_gradient.png</file>
|
||||||
|
|||||||
@@ -194,27 +194,27 @@ const char * const G_WINDOW_LIST = "QtCreator.Group.Window.List";
|
|||||||
const char * const G_HELP_HELP = "QtCreator.Group.Help.Help";
|
const char * const G_HELP_HELP = "QtCreator.Group.Help.Help";
|
||||||
const char * const G_HELP_ABOUT = "QtCreator.Group.Help.About";
|
const char * const G_HELP_ABOUT = "QtCreator.Group.Help.About";
|
||||||
|
|
||||||
const char * const ICON_MINUS = ":/qworkbench/images/minus.png";
|
const char * const ICON_MINUS = ":/core/images/minus.png";
|
||||||
const char * const ICON_PLUS = ":/qworkbench/images/plus.png";
|
const char * const ICON_PLUS = ":/core/images/plus.png";
|
||||||
const char * const ICON_NEWFILE = ":/qworkbench/images/filenew.png";
|
const char * const ICON_NEWFILE = ":/core/images/filenew.png";
|
||||||
const char * const ICON_OPENFILE = ":/qworkbench/images/fileopen.png";
|
const char * const ICON_OPENFILE = ":/core/images/fileopen.png";
|
||||||
const char * const ICON_SAVEFILE = ":/qworkbench/images/filesave.png";
|
const char * const ICON_SAVEFILE = ":/core/images/filesave.png";
|
||||||
const char * const ICON_UNDO = ":/qworkbench/images/undo.png";
|
const char * const ICON_UNDO = ":/core/images/undo.png";
|
||||||
const char * const ICON_REDO = ":/qworkbench/images/redo.png";
|
const char * const ICON_REDO = ":/core/images/redo.png";
|
||||||
const char * const ICON_COPY = ":/qworkbench/images/editcopy.png";
|
const char * const ICON_COPY = ":/core/images/editcopy.png";
|
||||||
const char * const ICON_PASTE = ":/qworkbench/images/editpaste.png";
|
const char * const ICON_PASTE = ":/core/images/editpaste.png";
|
||||||
const char * const ICON_CUT = ":/qworkbench/images/editcut.png";
|
const char * const ICON_CUT = ":/core/images/editcut.png";
|
||||||
const char * const ICON_NEXT = ":/qworkbench/images/next.png";
|
const char * const ICON_NEXT = ":/core/images/next.png";
|
||||||
const char * const ICON_PREV = ":/qworkbench/images/prev.png";
|
const char * const ICON_PREV = ":/core/images/prev.png";
|
||||||
const char * const ICON_DIR = ":/qworkbench/images/dir.png";
|
const char * const ICON_DIR = ":/core/images/dir.png";
|
||||||
const char * const ICON_CLEAN_PANE = ":/qworkbench/images/clean_pane_small.png";
|
const char * const ICON_CLEAN_PANE = ":/core/images/clean_pane_small.png";
|
||||||
const char * const ICON_CLEAR = ":/qworkbench/images/clear.png";
|
const char * const ICON_CLEAR = ":/core/images/clear.png";
|
||||||
const char * const ICON_FIND = ":/qworkbench/images/find.png";
|
const char * const ICON_FIND = ":/core/images/find.png";
|
||||||
const char * const ICON_FINDNEXT = ":/qworkbench/images/findnext.png";
|
const char * const ICON_FINDNEXT = ":/core/images/findnext.png";
|
||||||
const char * const ICON_REPLACE = ":/qworkbench/images/replace.png";
|
const char * const ICON_REPLACE = ":/core/images/replace.png";
|
||||||
const char * const ICON_RESET = ":/qworkbench/images/reset.png";
|
const char * const ICON_RESET = ":/core/images/reset.png";
|
||||||
const char * const ICON_MAGNIFIER = ":/qworkbench/images/magnifier.png";
|
const char * const ICON_MAGNIFIER = ":/core/images/magnifier.png";
|
||||||
const char * const ICON_TOGGLE_SIDEBAR = ":/qworkbench/images/sidebaricon.png";
|
const char * const ICON_TOGGLE_SIDEBAR = ":/core/images/sidebaricon.png";
|
||||||
|
|
||||||
// wizard kind
|
// wizard kind
|
||||||
const char * const WIZARD_TYPE_FILE = "QtCreator::WizardType::File";
|
const char * const WIZARD_TYPE_FILE = "QtCreator::WizardType::File";
|
||||||
|
|||||||
@@ -84,11 +84,6 @@ MessageManager *CoreImpl::messageManager() const
|
|||||||
return m_mainwindow->messageManager();
|
return m_mainwindow->messageManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewManagerInterface *CoreImpl::viewManager() const
|
|
||||||
{
|
|
||||||
return m_mainwindow->viewManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
ExtensionSystem::PluginManager *CoreImpl::pluginManager() const
|
ExtensionSystem::PluginManager *CoreImpl::pluginManager() const
|
||||||
{
|
{
|
||||||
return m_mainwindow->pluginManager();
|
return m_mainwindow->pluginManager();
|
||||||
@@ -148,15 +143,6 @@ QString CoreImpl::resourcePath() const
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CoreImpl::libraryPath() const
|
|
||||||
{
|
|
||||||
#if defined(Q_OS_MAC)
|
|
||||||
return QDir::cleanPath(QCoreApplication::applicationDirPath()+QLatin1String("/../PlugIns"));
|
|
||||||
#else
|
|
||||||
return QDir::cleanPath(QCoreApplication::applicationDirPath()+QLatin1String("/../lib"));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
IContext *CoreImpl::currentContextObject() const
|
IContext *CoreImpl::currentContextObject() const
|
||||||
{
|
{
|
||||||
return m_mainwindow->currentContextObject();
|
return m_mainwindow->currentContextObject();
|
||||||
@@ -168,12 +154,6 @@ QMainWindow *CoreImpl::mainWindow() const
|
|||||||
return m_mainwindow;
|
return m_mainwindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStatusBar *CoreImpl::statusBar() const
|
|
||||||
{
|
|
||||||
return m_mainwindow->statusBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// adds and removes additional active contexts, this context is appended to the
|
// adds and removes additional active contexts, this context is appended to the
|
||||||
// currently active contexts. call updateContext after changing
|
// currently active contexts. call updateContext after changing
|
||||||
void CoreImpl::addAdditionalContext(int context)
|
void CoreImpl::addAdditionalContext(int context)
|
||||||
|
|||||||
@@ -60,7 +60,6 @@ public:
|
|||||||
FileManager *fileManager() const ;
|
FileManager *fileManager() const ;
|
||||||
UniqueIDManager *uniqueIDManager() const;
|
UniqueIDManager *uniqueIDManager() const;
|
||||||
MessageManager *messageManager() const;
|
MessageManager *messageManager() const;
|
||||||
ViewManagerInterface *viewManager() const;
|
|
||||||
ExtensionSystem::PluginManager *pluginManager() const;
|
ExtensionSystem::PluginManager *pluginManager() const;
|
||||||
EditorManager *editorManager() const;
|
EditorManager *editorManager() const;
|
||||||
ProgressManagerInterface *progressManager() const;
|
ProgressManagerInterface *progressManager() const;
|
||||||
@@ -74,12 +73,10 @@ public:
|
|||||||
QPrinter *printer() const;
|
QPrinter *printer() const;
|
||||||
|
|
||||||
QString resourcePath() const;
|
QString resourcePath() const;
|
||||||
QString libraryPath() const;
|
|
||||||
|
|
||||||
IContext *currentContextObject() const;
|
IContext *currentContextObject() const;
|
||||||
|
|
||||||
QMainWindow *mainWindow() const;
|
QMainWindow *mainWindow() const;
|
||||||
QStatusBar *statusBar() const;
|
|
||||||
|
|
||||||
// adds and removes additional active contexts, this context is appended to the
|
// adds and removes additional active contexts, this context is appended to the
|
||||||
// currently active contexts. call updateContext after changing
|
// currently active contexts. call updateContext after changing
|
||||||
|
|||||||
@@ -37,7 +37,6 @@
|
|||||||
#include "editormanager.h"
|
#include "editormanager.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "modemanager.h"
|
#include "modemanager.h"
|
||||||
#include "viewmanager.h"
|
|
||||||
#include "fileiconprovider.h"
|
#include "fileiconprovider.h"
|
||||||
|
|
||||||
#include <QtCore/qplugin.h>
|
#include <QtCore/qplugin.h>
|
||||||
|
|||||||
@@ -31,8 +31,8 @@
|
|||||||
**
|
**
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#ifndef QWORKBENCHPLUGIN_H
|
#ifndef COREPLUGIN_H
|
||||||
#define QWORKBENCHPLUGIN_H
|
#define COREPLUGIN_H
|
||||||
|
|
||||||
#include <extensionsystem/iplugin.h>
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
@@ -68,4 +68,4 @@ private:
|
|||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Core
|
} // namespace Core
|
||||||
|
|
||||||
#endif // QWORKBENCHPLUGIN_H
|
#endif // COREPLUGIN_H
|
||||||
|
|||||||
@@ -1,3 +1,2 @@
|
|||||||
include(coreplugin_dependencies.pri)
|
include(coreplugin_dependencies.pri)
|
||||||
|
|
||||||
LIBS *= -l$$qtLibraryTarget(Core)
|
LIBS *= -l$$qtLibraryTarget(Core)
|
||||||
|
|||||||
@@ -73,7 +73,8 @@ SOURCES += mainwindow.cpp \
|
|||||||
rightpane.cpp \
|
rightpane.cpp \
|
||||||
sidebar.cpp \
|
sidebar.cpp \
|
||||||
fileiconprovider.cpp \
|
fileiconprovider.cpp \
|
||||||
mimedatabase.cpp
|
mimedatabase.cpp \
|
||||||
|
icore.cpp
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
welcomemode.h \
|
welcomemode.h \
|
||||||
editmode.h \
|
editmode.h \
|
||||||
|
|||||||
@@ -131,7 +131,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../core.qrc">
|
<iconset resource="../core.qrc">
|
||||||
<normaloff>:/qworkbench/images/reset.png</normaloff>:/qworkbench/images/reset.png</iconset>
|
<normaloff>:/core/images/reset.png</normaloff>:/core/images/reset.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../core.qrc">
|
<iconset resource="../core.qrc">
|
||||||
<normaloff>:/qworkbench/images/clear.png</normaloff>:/qworkbench/images/clear.png</iconset>
|
<normaloff>:/core/images/clear.png</normaloff>:/core/images/clear.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ QVariant EditorModel::data(const QModelIndex &index, int role) const
|
|||||||
: editor->displayName();
|
: editor->displayName();
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
return editor->file()->isReadOnly()
|
return editor->file()->isReadOnly()
|
||||||
? QIcon(QLatin1String(":/qworkbench/images/locked.png"))
|
? QIcon(QLatin1String(":/core/images/locked.png"))
|
||||||
: QIcon();
|
: QIcon();
|
||||||
case Qt::ToolTipRole:
|
case Qt::ToolTipRole:
|
||||||
return editor->file()->fileName().isEmpty()
|
return editor->file()->fileName().isEmpty()
|
||||||
|
|||||||
@@ -172,8 +172,8 @@ void OpenEditorsWidget::updateCurrentItem(QTreeWidgetItem *currentItem)
|
|||||||
//todo: this is almost duplicated in openeditorswindow
|
//todo: this is almost duplicated in openeditorswindow
|
||||||
void OpenEditorsWidget::updateItem(QTreeWidgetItem *item, IEditor *editor)
|
void OpenEditorsWidget::updateItem(QTreeWidgetItem *item, IEditor *editor)
|
||||||
{
|
{
|
||||||
static const QIcon lockedIcon(QLatin1String(":/qworkbench/images/locked.png"));
|
static const QIcon lockedIcon(QLatin1String(":/core/images/locked.png"));
|
||||||
static const QIcon emptyIcon(QLatin1String(":/qworkbench/images/empty14.png"));
|
static const QIcon emptyIcon(QLatin1String(":/core/images/empty14.png"));
|
||||||
QString title = editor->displayName();
|
QString title = editor->displayName();
|
||||||
if (editor->file()->isModified())
|
if (editor->file()->isModified())
|
||||||
title += tr("*");
|
title += tr("*");
|
||||||
|
|||||||
@@ -300,8 +300,8 @@ void OpenEditorsWindow::centerOnItem(int selectedIndex)
|
|||||||
|
|
||||||
void OpenEditorsWindow::updateItem(QTreeWidgetItem *item, IEditor *editor)
|
void OpenEditorsWindow::updateItem(QTreeWidgetItem *item, IEditor *editor)
|
||||||
{
|
{
|
||||||
static const QIcon lockedIcon(QLatin1String(":/qworkbench/images/locked.png"));
|
static const QIcon lockedIcon(QLatin1String(":/core/images/locked.png"));
|
||||||
static const QIcon emptyIcon(QLatin1String(":/qworkbench/images/empty14.png"));
|
static const QIcon emptyIcon(QLatin1String(":/core/images/empty14.png"));
|
||||||
|
|
||||||
QString title = editor->displayName();
|
QString title = editor->displayName();
|
||||||
if (editor->file()->isModified())
|
if (editor->file()->isModified())
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ StackedEditorGroup::StackedEditorGroup(QWidget *parent) :
|
|||||||
m_lockButton->setProperty("type", QLatin1String("dockbutton"));
|
m_lockButton->setProperty("type", QLatin1String("dockbutton"));
|
||||||
|
|
||||||
m_closeButton->setAutoRaise(true);
|
m_closeButton->setAutoRaise(true);
|
||||||
m_closeButton->setIcon(QIcon(":/qworkbench/images/closebutton.png"));
|
m_closeButton->setIcon(QIcon(":/core/images/closebutton.png"));
|
||||||
m_closeButton->setProperty("type", QLatin1String("dockbutton"));
|
m_closeButton->setProperty("type", QLatin1String("dockbutton"));
|
||||||
|
|
||||||
QToolBar *rightToolBar = new QToolBar;
|
QToolBar *rightToolBar = new QToolBar;
|
||||||
@@ -150,7 +150,7 @@ StackedEditorGroup::StackedEditorGroup(QWidget *parent) :
|
|||||||
|
|
||||||
QToolButton *closeButton = new QToolButton;
|
QToolButton *closeButton = new QToolButton;
|
||||||
closeButton->setAutoRaise(true);
|
closeButton->setAutoRaise(true);
|
||||||
closeButton->setIcon(QIcon(":/qworkbench/images/clear.png"));
|
closeButton->setIcon(QIcon(":/core/images/clear.png"));
|
||||||
closeButton->setToolTip(tr("Close"));
|
closeButton->setToolTip(tr("Close"));
|
||||||
connect(closeButton, SIGNAL(clicked()), m_infoWidget, SLOT(hide()));
|
connect(closeButton, SIGNAL(clicked()), m_infoWidget, SLOT(hide()));
|
||||||
|
|
||||||
@@ -303,8 +303,8 @@ void StackedEditorGroup::checkEditorStatus()
|
|||||||
|
|
||||||
void StackedEditorGroup::updateEditorStatus(IEditor *editor)
|
void StackedEditorGroup::updateEditorStatus(IEditor *editor)
|
||||||
{
|
{
|
||||||
static const QIcon lockedIcon(QLatin1String(":/qworkbench/images/locked.png"));
|
static const QIcon lockedIcon(QLatin1String(":/core/images/locked.png"));
|
||||||
static const QIcon unlockedIcon(QLatin1String(":/qworkbench/images/unlocked.png"));
|
static const QIcon unlockedIcon(QLatin1String(":/core/images/unlocked.png"));
|
||||||
|
|
||||||
if (editor->file()->isReadOnly()) {
|
if (editor->file()->isReadOnly()) {
|
||||||
m_lockButton->setIcon(lockedIcon);
|
m_lockButton->setIcon(lockedIcon);
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ using namespace Core;
|
|||||||
FileIconProvider *FileIconProvider::m_instance = 0;
|
FileIconProvider *FileIconProvider::m_instance = 0;
|
||||||
|
|
||||||
FileIconProvider::FileIconProvider()
|
FileIconProvider::FileIconProvider()
|
||||||
: m_unknownFileIcon(QLatin1String(":/qworkbench/images/unknownfile.png"))
|
: m_unknownFileIcon(QLatin1String(":/core/images/unknownfile.png"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,8 @@
|
|||||||
|
|
||||||
using namespace Core::Internal;
|
using namespace Core::Internal;
|
||||||
|
|
||||||
GeneralSettings::GeneralSettings()
|
GeneralSettings::GeneralSettings():
|
||||||
|
m_dialog(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +62,7 @@ QString GeneralSettings::trCategory() const
|
|||||||
return tr("Environment");
|
return tr("Environment");
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* GeneralSettings::createPage(QWidget *parent)
|
QWidget *GeneralSettings::createPage(QWidget *parent)
|
||||||
{
|
{
|
||||||
m_page = new Ui_GeneralSettings;
|
m_page = new Ui_GeneralSettings;
|
||||||
QWidget *w = new QWidget(parent);
|
QWidget *w = new QWidget(parent);
|
||||||
|
|||||||
@@ -77,7 +77,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="core.qrc">
|
<iconset resource="core.qrc">
|
||||||
<normaloff>:/qworkbench/images/reset.png</normaloff>:/qworkbench/images/reset.png</iconset>
|
<normaloff>:/core/images/reset.png</normaloff>:/core/images/reset.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="core.qrc">
|
<iconset resource="core.qrc">
|
||||||
<normaloff>:/qworkbench/images/reset.png</normaloff>:/qworkbench/images/reset.png</iconset>
|
<normaloff>:/core/images/reset.png</normaloff>:/core/images/reset.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
308
src/plugins/coreplugin/icore.cpp
Normal file
308
src/plugins/coreplugin/icore.cpp
Normal file
@@ -0,0 +1,308 @@
|
|||||||
|
#include "icore.h"
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\namespace Core
|
||||||
|
\brief The Core namespace contains all classes that make up the Core plugin
|
||||||
|
which constitute the basic functionality of Qt Creator.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\namespace Core::Internal
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\class Core::ICore
|
||||||
|
\brief The ICore class allows access to the different part that make up
|
||||||
|
the basic functionality of Qt Creator.
|
||||||
|
|
||||||
|
You should never create a subclass of this interface. The one and only
|
||||||
|
instance is created by the Core plugin. You can access this instance
|
||||||
|
from your plugin via the plugin manager, e.g.
|
||||||
|
\code
|
||||||
|
ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
\mainclass
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QStringList ICore::showNewItemDialog(const QString &title,
|
||||||
|
const QList<IWizard *> &wizards,
|
||||||
|
const QString &defaultLocation = QString())
|
||||||
|
\brief Opens a dialog where the user can choose from a set of \a wizards that
|
||||||
|
create new files/classes/projects.
|
||||||
|
|
||||||
|
The \a title argument is shown as the dialogs title. The path where the
|
||||||
|
files will be created (if the user doesn't change it) is set
|
||||||
|
in \a defaultLocation. It defaults to the path of the file manager's
|
||||||
|
current file.
|
||||||
|
|
||||||
|
\sa Core::FileManager
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void ICore::showOptionsDialog(const QString &group = QString(),
|
||||||
|
const QString &page = QString())
|
||||||
|
\brief Opens the application options/preferences dialog with preselected
|
||||||
|
\a page in a specified \a group.
|
||||||
|
|
||||||
|
The arguments refer to the string IDs of the corresponding IOptionsPage.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn ActionManagerInterface *ICore::actionManager() const
|
||||||
|
\brief Returns the application's action manager.
|
||||||
|
|
||||||
|
The action manager is responsible for registration of menus and
|
||||||
|
menu items and keyboard shortcuts.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn FileManager *ICore::fileManager() const
|
||||||
|
\brief Returns the application's file manager.
|
||||||
|
|
||||||
|
The file manager keeps track of files for changes outside the application.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn UniqueIDManager *ICore::uniqueIDManager() const
|
||||||
|
\brief Returns the application's id manager.
|
||||||
|
|
||||||
|
The unique ID manager transforms strings in unique integers and the other way round.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn MessageManager *ICore::messageManager() const
|
||||||
|
\brief Returns the application's message manager.
|
||||||
|
|
||||||
|
The message manager is the interface to the "General" output pane for
|
||||||
|
general application debug messages.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn ExtensionSystem::PluginManager *ICore::pluginManager() const
|
||||||
|
\brief Returns the application's plugin manager.
|
||||||
|
|
||||||
|
The plugin manager handles the plugin life cycles and manages
|
||||||
|
the common object pool.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn EditorManager *ICore::editorManager() const
|
||||||
|
\brief Returns the application's editor manager.
|
||||||
|
|
||||||
|
The editor manager handles all editor related tasks like opening
|
||||||
|
documents, the stack of currently open documents and the currently
|
||||||
|
active document.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn ProgressManagerInterface *ICore::progressManager() const
|
||||||
|
\brief Returns the application's progress manager.
|
||||||
|
|
||||||
|
Use the progress manager to register a concurrent task to
|
||||||
|
show a progress bar the way Qt Creator does it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn ScriptManagerInterface *ICore::scriptManager() const
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn VariableManager *ICore::variableManager() const
|
||||||
|
\brief Returns the application's variable manager.
|
||||||
|
|
||||||
|
The variable manager is used to register application wide string variables
|
||||||
|
like \c MY_PROJECT_DIR such that strings like \c{somecommand ${MY_PROJECT_DIR}/sub}
|
||||||
|
can be resolved/expanded from anywhere in the application.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn VCSManager *ICore::vcsManager() const
|
||||||
|
\brief Returns the application's vcs manager.
|
||||||
|
|
||||||
|
The vcs manager can be used to e.g. retrieve information about
|
||||||
|
the version control system used for a directory on hard disk.
|
||||||
|
The actual functionality for a specific version control system
|
||||||
|
must be implemented in a IVersionControl object and registered in
|
||||||
|
the plugin manager's object pool.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn ModeManager *ICore::modeManager() const
|
||||||
|
\brief Returns the application's mode manager.
|
||||||
|
|
||||||
|
The mode manager handles everything related to the instances of IMode
|
||||||
|
that were added to the plugin manager's object pool as well as their
|
||||||
|
buttons and the tool bar with the round buttons in the lower left
|
||||||
|
corner of Qt Creator.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn MimeDatabase *ICore::mimeDatabase() const
|
||||||
|
\brief Returns the application's mime database.
|
||||||
|
|
||||||
|
Use the mime database to manage mime types.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QSettings *ICore::settings() const
|
||||||
|
\brief Returns the application's main settings object.
|
||||||
|
|
||||||
|
You can use it to retrieve or set application wide settings
|
||||||
|
(in contrast to session or project specific settings).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QPrinter *ICore::printer() const
|
||||||
|
\brief Returns the application's printer object.
|
||||||
|
|
||||||
|
Always use this printer object for printing, so the different parts of the
|
||||||
|
application re-use it's settings.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QString ICore::resourcePath() const
|
||||||
|
\brief Returns the absolute path that is used for resources like
|
||||||
|
project templates and the debugger macros.
|
||||||
|
|
||||||
|
This abstraction is needed to avoid platform-specific code all over
|
||||||
|
the place, since e.g. on Mac the resources are part of the application bundle.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QMainWindow *ICore::mainWindow() const
|
||||||
|
\brief Returns the main application window.
|
||||||
|
|
||||||
|
For use as dialog parent etc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn IContext *ICore::currentContextObject() const
|
||||||
|
\brief Returns the context object of the current main context.
|
||||||
|
|
||||||
|
\sa ICore::addAdditionalContext()
|
||||||
|
\sa ICore::addContextObject()
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void ICore::addAdditionalContext(int context)
|
||||||
|
\brief Register additional context to be currently active.
|
||||||
|
|
||||||
|
Appends the additional \a context to the list of currently active
|
||||||
|
contexts. You need to call ICore::updateContext to make that change
|
||||||
|
take effect.
|
||||||
|
|
||||||
|
\sa ICore::removeAdditionalContext()
|
||||||
|
\sa ICore::hasContext()
|
||||||
|
\sa ICore::updateContext()
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void ICore::removeAdditionalContext(int context)
|
||||||
|
\brief Removes the given \a context from the list of currently active contexts.
|
||||||
|
|
||||||
|
You need to call ICore::updateContext to make that change
|
||||||
|
take effect.
|
||||||
|
|
||||||
|
\sa ICore::addAdditionalContext()
|
||||||
|
\sa ICore::hasContext()
|
||||||
|
\sa ICore::updateContext()
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn bool ICore::hasContext(int context) const
|
||||||
|
\brief Returns if the given \a context is currently one of the active contexts.
|
||||||
|
|
||||||
|
\sa ICore::addAdditionalContext()
|
||||||
|
\sa ICore::addContextObject()
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void ICore::addContextObject(IContext *context)
|
||||||
|
\brief Registers an additional \a context object.
|
||||||
|
|
||||||
|
After registration this context object gets automatically the
|
||||||
|
current context object whenever it's widget gets focus.
|
||||||
|
|
||||||
|
\sa ICore::removeContextObject()
|
||||||
|
\sa ICore::addAdditionalContext()
|
||||||
|
\sa ICore::currentContextObject()
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void ICore::removeContextObject(IContext *context)
|
||||||
|
\brief Unregisters a \a context object from the list of know contexts.
|
||||||
|
|
||||||
|
\sa ICore::addContextObject()
|
||||||
|
\sa ICore::addAdditionalContext()
|
||||||
|
\sa ICore::currentContextObject()
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void ICore::updateContext()
|
||||||
|
\brief Update the list of active contexts after adding or removing additional ones.
|
||||||
|
|
||||||
|
\sa ICore::addAdditionalContext()
|
||||||
|
\sa ICore::removeAdditionalContext()
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void ICore::openFiles(const QStringList &fileNames)
|
||||||
|
\brief Open all files from a list of \a fileNames like it would be
|
||||||
|
done if they were given to Qt Creator on the command line, or
|
||||||
|
they were opened via \gui{File|Open}.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn ICore::ICore()
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn ICore::~ICore()
|
||||||
|
\internal
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void ICore::coreOpened()
|
||||||
|
\brief Emitted after all plugins have been loaded and the main window shown.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void ICore::saveSettingsRequested()
|
||||||
|
\brief Emitted to signal that the user has requested that the global settings
|
||||||
|
should be saved to disk.
|
||||||
|
|
||||||
|
At the moment that happens when the application is closed, and on \gui{Save All}.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void ICore::optionsDialogRequested()
|
||||||
|
\brief Signal that allows plugins to perform actions just before the \gui{Tools|Options}
|
||||||
|
dialog is shown.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void ICore::coreAboutToClose()
|
||||||
|
\brief Plugins can do some pre-end-of-life actions when they get this signal.
|
||||||
|
|
||||||
|
The application is guaranteed to shut down after this signal is emitted.
|
||||||
|
It's there as an addition to the usual plugin lifecycle methods, namely
|
||||||
|
IPlugin::shutdown(), just for convenience.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void ICore::contextAboutToChange(Core::IContext *context)
|
||||||
|
\brief Sent just before a new \a context becomes the current context
|
||||||
|
(meaning that it's widget got focus).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn void ICore::contextChanged(Core::IContext *context)
|
||||||
|
\brief Sent just after a new \a context became the current context
|
||||||
|
(meaning that it's widget got focus).
|
||||||
|
*/
|
||||||
@@ -56,7 +56,6 @@ class FileManager;
|
|||||||
class MessageManager;
|
class MessageManager;
|
||||||
class IEditor;
|
class IEditor;
|
||||||
class UniqueIDManager;
|
class UniqueIDManager;
|
||||||
class ViewManagerInterface;
|
|
||||||
class EditorManager;
|
class EditorManager;
|
||||||
class ProgressManagerInterface;
|
class ProgressManagerInterface;
|
||||||
class ScriptManagerInterface;
|
class ScriptManagerInterface;
|
||||||
@@ -86,7 +85,6 @@ public:
|
|||||||
virtual FileManager *fileManager() const = 0;
|
virtual FileManager *fileManager() const = 0;
|
||||||
virtual UniqueIDManager *uniqueIDManager() const = 0;
|
virtual UniqueIDManager *uniqueIDManager() const = 0;
|
||||||
virtual MessageManager *messageManager() const = 0;
|
virtual MessageManager *messageManager() const = 0;
|
||||||
virtual ViewManagerInterface *viewManager() const = 0;
|
|
||||||
virtual ExtensionSystem::PluginManager *pluginManager() const = 0;
|
virtual ExtensionSystem::PluginManager *pluginManager() const = 0;
|
||||||
virtual EditorManager *editorManager() const = 0;
|
virtual EditorManager *editorManager() const = 0;
|
||||||
virtual ProgressManagerInterface *progressManager() const = 0;
|
virtual ProgressManagerInterface *progressManager() const = 0;
|
||||||
@@ -100,20 +98,17 @@ public:
|
|||||||
virtual QPrinter *printer() const = 0;
|
virtual QPrinter *printer() const = 0;
|
||||||
|
|
||||||
virtual QString resourcePath() const = 0;
|
virtual QString resourcePath() const = 0;
|
||||||
virtual QString libraryPath() const = 0;
|
|
||||||
|
|
||||||
virtual IContext *currentContextObject() const = 0;
|
|
||||||
|
|
||||||
virtual QMainWindow *mainWindow() const = 0;
|
virtual QMainWindow *mainWindow() const = 0;
|
||||||
virtual QStatusBar *statusBar() const = 0;
|
|
||||||
|
|
||||||
// adds and removes additional active contexts, this context is appended to the
|
// adds and removes additional active contexts, this context is appended to the
|
||||||
// currently active contexts. call updateContext after changing
|
// currently active contexts. call updateContext after changing
|
||||||
|
virtual IContext *currentContextObject() const = 0;
|
||||||
virtual void addAdditionalContext(int context) = 0;
|
virtual void addAdditionalContext(int context) = 0;
|
||||||
virtual void removeAdditionalContext(int context) = 0;
|
virtual void removeAdditionalContext(int context) = 0;
|
||||||
virtual bool hasContext(int context) const = 0;
|
virtual bool hasContext(int context) const = 0;
|
||||||
virtual void addContextObject(IContext *contex) = 0;
|
virtual void addContextObject(IContext *context) = 0;
|
||||||
virtual void removeContextObject(IContext *contex) = 0;
|
virtual void removeContextObject(IContext *context) = 0;
|
||||||
|
|
||||||
virtual void updateContext() = 0;
|
virtual void updateContext() = 0;
|
||||||
|
|
||||||
@@ -122,7 +117,7 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void coreOpened();
|
void coreOpened();
|
||||||
void saveSettingsRequested();
|
void saveSettingsRequested();
|
||||||
void settingsDialogRequested();
|
void optionsDialogRequested();
|
||||||
void coreAboutToClose();
|
void coreAboutToClose();
|
||||||
void contextAboutToChange(Core::IContext *context);
|
void contextAboutToChange(Core::IContext *context);
|
||||||
void contextChanged(Core::IContext *context);
|
void contextChanged(Core::IContext *context);
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ MainWindow::MainWindow() :
|
|||||||
m_toggleSideBarButton(new QToolButton)
|
m_toggleSideBarButton(new QToolButton)
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Qt Creator"));
|
setWindowTitle(tr("Qt Creator"));
|
||||||
qApp->setWindowIcon(QIcon(":/qworkbench/images/qtcreator_logo_128.png"));
|
qApp->setWindowIcon(QIcon(":/core/images/qtcreator_logo_128.png"));
|
||||||
setDockNestingEnabled(true);
|
setDockNestingEnabled(true);
|
||||||
|
|
||||||
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
||||||
@@ -783,7 +783,7 @@ QStringList MainWindow::showNewItemDialog(const QString &title,
|
|||||||
|
|
||||||
void MainWindow::showOptionsDialog(const QString &category, const QString &page)
|
void MainWindow::showOptionsDialog(const QString &category, const QString &page)
|
||||||
{
|
{
|
||||||
emit m_coreImpl->settingsDialogRequested();
|
emit m_coreImpl->optionsDialogRequested();
|
||||||
SettingsDialog dlg(this, category, page);
|
SettingsDialog dlg(this, category, page);
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
@@ -840,11 +840,6 @@ VCSManager *MainWindow::vcsManager() const
|
|||||||
return m_vcsManager;
|
return m_vcsManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewManagerInterface *MainWindow::viewManager() const
|
|
||||||
{
|
|
||||||
return m_viewManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
EditorManager *MainWindow::editorManager() const
|
EditorManager *MainWindow::editorManager() const
|
||||||
{
|
{
|
||||||
return m_editorManager;
|
return m_editorManager;
|
||||||
|
|||||||
@@ -109,7 +109,6 @@ public:
|
|||||||
Core::FileManager *fileManager() const;
|
Core::FileManager *fileManager() const;
|
||||||
Core::UniqueIDManager *uniqueIDManager() const;
|
Core::UniqueIDManager *uniqueIDManager() const;
|
||||||
Core::MessageManager *messageManager() const;
|
Core::MessageManager *messageManager() const;
|
||||||
Core::ViewManagerInterface *viewManager() const;
|
|
||||||
ExtensionSystem::PluginManager *pluginManager() const;
|
ExtensionSystem::PluginManager *pluginManager() const;
|
||||||
Core::EditorManager *editorManager() const;
|
Core::EditorManager *editorManager() const;
|
||||||
Core::ProgressManagerInterface *progressManager() const;
|
Core::ProgressManagerInterface *progressManager() const;
|
||||||
|
|||||||
@@ -102,11 +102,11 @@ public:
|
|||||||
{
|
{
|
||||||
style = QStyleFactory::create(baseStyleName);
|
style = QStyleFactory::create(baseStyleName);
|
||||||
QTC_ASSERT(style, /**/);
|
QTC_ASSERT(style, /**/);
|
||||||
buttonImage_pressed = QImage(":/qworkbench/images/pushbutton_pressed.png");
|
buttonImage_pressed = QImage(":/core/images/pushbutton_pressed.png");
|
||||||
buttonImage = QImage(":/qworkbench/images/pushbutton.png");
|
buttonImage = QImage(":/core/images/pushbutton.png");
|
||||||
|
|
||||||
lineeditImage = QImage(":/qworkbench/images/inputfield.png");
|
lineeditImage = QImage(":/core/images/inputfield.png");
|
||||||
lineeditImage_disabled = QImage(":/qworkbench/images/inputfield_disabled.png");
|
lineeditImage_disabled = QImage(":/core/images/inputfield_disabled.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
~ManhattanStylePrivate()
|
~ManhattanStylePrivate()
|
||||||
@@ -345,7 +345,7 @@ void ManhattanStyle::polish(QPalette &pal)
|
|||||||
QIcon ManhattanStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option,
|
QIcon ManhattanStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option,
|
||||||
const QWidget *widget) const
|
const QWidget *widget) const
|
||||||
{
|
{
|
||||||
static const QIcon closeButton(":/qworkbench/images/closebutton.png");
|
static const QIcon closeButton(":/core/images/closebutton.png");
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
switch (standardIcon) {
|
switch (standardIcon) {
|
||||||
case QStyle::SP_TitleBarCloseButton:
|
case QStyle::SP_TitleBarCloseButton:
|
||||||
@@ -360,7 +360,7 @@ QIcon ManhattanStyle::standardIconImplementation(StandardPixmap standardIcon, co
|
|||||||
QPixmap ManhattanStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
|
QPixmap ManhattanStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
|
||||||
const QWidget *widget) const
|
const QWidget *widget) const
|
||||||
{
|
{
|
||||||
static const QPixmap closeButton(":/qworkbench/images/closebutton.png");
|
static const QPixmap closeButton(":/core/images/closebutton.png");
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
switch (standardPixmap) {
|
switch (standardPixmap) {
|
||||||
case QStyle::SP_TitleBarCloseButton:
|
case QStyle::SP_TitleBarCloseButton:
|
||||||
|
|||||||
@@ -358,13 +358,13 @@ NavigationSubWidget::NavigationSubWidget(NavigationWidget *parentWidget)
|
|||||||
|
|
||||||
QToolButton *split = new QToolButton;
|
QToolButton *split = new QToolButton;
|
||||||
split->setProperty("type", QLatin1String("dockbutton"));
|
split->setProperty("type", QLatin1String("dockbutton"));
|
||||||
split->setIcon(QIcon(":/qworkbench/images/splitbutton_horizontal.png"));
|
split->setIcon(QIcon(":/core/images/splitbutton_horizontal.png"));
|
||||||
split->setToolTip(tr("Split"));
|
split->setToolTip(tr("Split"));
|
||||||
connect(split, SIGNAL(clicked(bool)), this, SIGNAL(split()));
|
connect(split, SIGNAL(clicked(bool)), this, SIGNAL(split()));
|
||||||
|
|
||||||
QToolButton *close = new QToolButton;
|
QToolButton *close = new QToolButton;
|
||||||
close->setProperty("type", QLatin1String("dockbutton"));
|
close->setProperty("type", QLatin1String("dockbutton"));
|
||||||
close->setIcon(QIcon(":/qworkbench/images/closebutton.png"));
|
close->setIcon(QIcon(":/core/images/closebutton.png"));
|
||||||
close->setToolTip(tr("Close"));
|
close->setToolTip(tr("Close"));
|
||||||
|
|
||||||
connect(close, SIGNAL(clicked(bool)), this, SIGNAL(close()));
|
connect(close, SIGNAL(clicked(bool)), this, SIGNAL(close()));
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ OutputPane::OutputPane(const QList<int> &context, QWidget *parent) :
|
|||||||
m_clearButton->setToolTip(tr("Clear"));
|
m_clearButton->setToolTip(tr("Clear"));
|
||||||
connect(m_clearButton, SIGNAL(clicked()), this, SLOT(clearPage()));
|
connect(m_clearButton, SIGNAL(clicked()), this, SLOT(clearPage()));
|
||||||
|
|
||||||
m_closeButton->setIcon(QIcon(":/qworkbench/images/closebutton.png"));
|
m_closeButton->setIcon(QIcon(":/core/images/closebutton.png"));
|
||||||
m_closeButton->setProperty("type", QLatin1String("dockbutton"));
|
m_closeButton->setProperty("type", QLatin1String("dockbutton"));
|
||||||
connect(m_closeButton, SIGNAL(clicked()), this, SLOT(slotHide()));
|
connect(m_closeButton, SIGNAL(clicked()), this, SLOT(slotHide()));
|
||||||
|
|
||||||
@@ -488,13 +488,13 @@ OutputPaneToggleButton::OutputPaneToggleButton(int number, const QString &text,
|
|||||||
setFocusPolicy(Qt::NoFocus);
|
setFocusPolicy(Qt::NoFocus);
|
||||||
setCheckable(true);
|
setCheckable(true);
|
||||||
setStyleSheet(
|
setStyleSheet(
|
||||||
"QPushButton { border-image: url(:/qworkbench/images/panel_button.png) 2 2 2 19;"
|
"QPushButton { border-image: url(:/core/images/panel_button.png) 2 2 2 19;"
|
||||||
" border-width: 2px 2px 2px 19px; padding-left: -17; padding-right: 4 } "
|
" border-width: 2px 2px 2px 19px; padding-left: -17; padding-right: 4 } "
|
||||||
"QPushButton:checked { border-image: url(:/qworkbench/images/panel_button_checked.png) 2 2 2 19 } "
|
"QPushButton:checked { border-image: url(:/core/images/panel_button_checked.png) 2 2 2 19 } "
|
||||||
#ifndef Q_WS_MAC // Mac UI's dont usually do hover
|
#ifndef Q_WS_MAC // Mac UI's dont usually do hover
|
||||||
"QPushButton:checked:hover { border-image: url(:/qworkbench/images/panel_button_checked_hover.png) 2 2 2 19 } "
|
"QPushButton:checked:hover { border-image: url(:/core/images/panel_button_checked_hover.png) 2 2 2 19 } "
|
||||||
"QPushButton:pressed:hover { border-image: url(:/qworkbench/images/panel_button_pressed.png) 2 2 2 19 } "
|
"QPushButton:pressed:hover { border-image: url(:/core/images/panel_button_pressed.png) 2 2 2 19 } "
|
||||||
"QPushButton:hover { border-image: url(:/qworkbench/images/panel_button_hover.png) 2 2 2 19 } "
|
"QPushButton:hover { border-image: url(:/core/images/panel_button_hover.png) 2 2 2 19 } "
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
|
|
||||||
#include "coreconstants.h"
|
#include "coreconstants.h"
|
||||||
#include "uniqueidmanager.h"
|
#include "uniqueidmanager.h"
|
||||||
#include "viewmanagerinterface.h"
|
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,6 @@
|
|||||||
#include <QtCore/QSettings>
|
#include <QtCore/QSettings>
|
||||||
|
|
||||||
#include <QtGui/QMainWindow>
|
#include <QtGui/QMainWindow>
|
||||||
#include <QtGui/QStatusBar>
|
|
||||||
#include <QtGui/QToolBar>
|
#include <QtGui/QToolBar>
|
||||||
|
|
||||||
#include <QtScript/QScriptEngine>
|
#include <QtScript/QScriptEngine>
|
||||||
@@ -82,11 +81,6 @@ QMainWindow *CorePrototype::mainWindow() const
|
|||||||
return callee()->mainWindow();
|
return callee()->mainWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStatusBar *CorePrototype::statusBar() const
|
|
||||||
{
|
|
||||||
return callee()->statusBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
QSettings *CorePrototype::settings() const
|
QSettings *CorePrototype::settings() const
|
||||||
{
|
{
|
||||||
return callee()->settings();
|
return callee()->settings();
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ class CorePrototype : public QObject, public QScriptable
|
|||||||
Q_PROPERTY(Core::EditorManager* editorManager READ editorManager DESIGNABLE false SCRIPTABLE true STORED false)
|
Q_PROPERTY(Core::EditorManager* editorManager READ editorManager DESIGNABLE false SCRIPTABLE true STORED false)
|
||||||
|
|
||||||
Q_PROPERTY(QMainWindow* mainWindow READ mainWindow DESIGNABLE false SCRIPTABLE true STORED false)
|
Q_PROPERTY(QMainWindow* mainWindow READ mainWindow DESIGNABLE false SCRIPTABLE true STORED false)
|
||||||
Q_PROPERTY(QStatusBar* statusBar READ statusBar DESIGNABLE false SCRIPTABLE true STORED false)
|
|
||||||
Q_PROPERTY(QSettings* settings READ settings DESIGNABLE false SCRIPTABLE true STORED false)
|
Q_PROPERTY(QSettings* settings READ settings DESIGNABLE false SCRIPTABLE true STORED false)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -68,7 +67,6 @@ public:
|
|||||||
Core::EditorManager *editorManager() const;
|
Core::EditorManager *editorManager() const;
|
||||||
|
|
||||||
QMainWindow *mainWindow() const;
|
QMainWindow *mainWindow() const;
|
||||||
QStatusBar *statusBar() const;
|
|
||||||
QSettings *settings() const;
|
QSettings *settings() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace Core {
|
|||||||
|
|
||||||
/* Script Manager.
|
/* Script Manager.
|
||||||
* Provides a script engine that is initialized with
|
* Provides a script engine that is initialized with
|
||||||
* QWorkBenchs interfaces and allows for running scripts.
|
* Qt Creator's interfaces and allows for running scripts.
|
||||||
* @{todo} Should it actually manage script files, too? */
|
* @{todo} Should it actually manage script files, too? */
|
||||||
|
|
||||||
class CORE_EXPORT ScriptManagerInterface : public QObject
|
class CORE_EXPORT ScriptManagerInterface : public QObject
|
||||||
|
|||||||
@@ -231,13 +231,13 @@ SideBarWidget::SideBarWidget(SideBar *sideBar, const QString &title)
|
|||||||
|
|
||||||
m_splitButton = new QToolButton;
|
m_splitButton = new QToolButton;
|
||||||
m_splitButton->setProperty("type", QLatin1String("dockbutton"));
|
m_splitButton->setProperty("type", QLatin1String("dockbutton"));
|
||||||
m_splitButton->setIcon(QIcon(":/qworkbench/images/splitbutton_horizontal.png"));
|
m_splitButton->setIcon(QIcon(":/core/images/splitbutton_horizontal.png"));
|
||||||
m_splitButton->setToolTip(tr("Split"));
|
m_splitButton->setToolTip(tr("Split"));
|
||||||
connect(m_splitButton, SIGNAL(clicked(bool)), this, SIGNAL(split()));
|
connect(m_splitButton, SIGNAL(clicked(bool)), this, SIGNAL(split()));
|
||||||
|
|
||||||
m_closeButton = new QToolButton;
|
m_closeButton = new QToolButton;
|
||||||
m_closeButton->setProperty("type", QLatin1String("dockbutton"));
|
m_closeButton->setProperty("type", QLatin1String("dockbutton"));
|
||||||
m_closeButton->setIcon(QIcon(":/qworkbench/images/closebutton.png"));
|
m_closeButton->setIcon(QIcon(":/core/images/closebutton.png"));
|
||||||
m_closeButton->setToolTip(tr("Close"));
|
m_closeButton->setToolTip(tr("Close"));
|
||||||
|
|
||||||
connect(m_closeButton, SIGNAL(clicked(bool)), this, SIGNAL(close()));
|
connect(m_closeButton, SIGNAL(clicked(bool)), this, SIGNAL(close()));
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ VersionDialog::VersionDialog(QWidget *parent)
|
|||||||
{
|
{
|
||||||
// We need to set the window icon explicitly here since for some reason the
|
// We need to set the window icon explicitly here since for some reason the
|
||||||
// application icon isn't used when the size of the dialog is fixed (at least not on X11/GNOME)
|
// application icon isn't used when the size of the dialog is fixed (at least not on X11/GNOME)
|
||||||
setWindowIcon(QIcon(":/qworkbench/images/qtcreator_logo_128.png"));
|
setWindowIcon(QIcon(":/core/images/qtcreator_logo_128.png"));
|
||||||
|
|
||||||
setWindowTitle(tr("About Qt Creator"));
|
setWindowTitle(tr("About Qt Creator"));
|
||||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||||
@@ -102,7 +102,7 @@ VersionDialog::VersionDialog(QWidget *parent)
|
|||||||
connect(buttonBox , SIGNAL(helpRequested()), this, SLOT(popupLicense()));
|
connect(buttonBox , SIGNAL(helpRequested()), this, SLOT(popupLicense()));
|
||||||
|
|
||||||
QLabel *logoLabel = new QLabel;
|
QLabel *logoLabel = new QLabel;
|
||||||
logoLabel->setPixmap(QPixmap(QLatin1String(":/qworkbench/images/qtcreator_logo_128.png")));
|
logoLabel->setPixmap(QPixmap(QLatin1String(":/core/images/qtcreator_logo_128.png")));
|
||||||
layout->addWidget(logoLabel , 0, 0, 1, 1);
|
layout->addWidget(logoLabel , 0, 0, 1, 1);
|
||||||
layout->addWidget(copyRightLabel, 0, 1, 4, 4);
|
layout->addWidget(copyRightLabel, 0, 1, 4, 4);
|
||||||
layout->addWidget(buttonBox, 4, 0, 1, 5);
|
layout->addWidget(buttonBox, 4, 0, 1, 5);
|
||||||
|
|||||||
@@ -92,16 +92,16 @@ WelcomeModePrivate::WelcomeModePrivate() :
|
|||||||
#else
|
#else
|
||||||
m_label(new QLabel),
|
m_label(new QLabel),
|
||||||
#endif
|
#endif
|
||||||
m_htmlTemplate(readFile(QLatin1String(":/qworkbench/html/welcome.html"))),
|
m_htmlTemplate(readFile(QLatin1String(":/core/html/welcome.html"))),
|
||||||
m_sessionHtmlTemplate(readFile(QLatin1String(":/qworkbench/html/recent_sessions.html"))),
|
m_sessionHtmlTemplate(readFile(QLatin1String(":/core/html/recent_sessions.html"))),
|
||||||
m_projectHtmlTemplate(readFile(QLatin1String(":/qworkbench/html/recent_projects.html"))),
|
m_projectHtmlTemplate(readFile(QLatin1String(":/core/html/recent_projects.html"))),
|
||||||
m_baseUrl(QUrl(QLatin1String("qrc:/qworkbench/html/welcome.html")))
|
m_baseUrl(QUrl(QLatin1String("qrc:/core/html/welcome.html")))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(QT_NO_WEBKIT)
|
#if defined(QT_NO_WEBKIT)
|
||||||
|
|
||||||
const char *LABEL = "<center><table><tr><td><img src=\":/qworkbench/html/images/product_logo.png\"/></td><td width=300>"
|
const char *LABEL = "<center><table><tr><td><img src=\":/core/html/images/product_logo.png\"/></td><td width=300>"
|
||||||
"<h2><br/><br/>Welcome</h2><p> Qt Creator is an intuitive, modern cross platform IDE that enables "
|
"<h2><br/><br/>Welcome</h2><p> Qt Creator is an intuitive, modern cross platform IDE that enables "
|
||||||
"developers to create graphically appealing applications for desktop, "
|
"developers to create graphically appealing applications for desktop, "
|
||||||
"embedded, and mobile devices. "
|
"embedded, and mobile devices. "
|
||||||
@@ -172,7 +172,7 @@ QString WelcomeMode::name() const
|
|||||||
|
|
||||||
QIcon WelcomeMode::icon() const
|
QIcon WelcomeMode::icon() const
|
||||||
{
|
{
|
||||||
return QIcon(QLatin1String(":/qworkbench/images/qtcreator_logo_32.png"));
|
return QIcon(QLatin1String(":/core/images/qtcreator_logo_32.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int WelcomeMode::priority() const
|
int WelcomeMode::priority() const
|
||||||
|
|||||||
@@ -715,7 +715,7 @@ void FormEditorW::print()
|
|||||||
painter.drawPixmap(0, 0, pixmap);
|
painter.drawPixmap(0, 0, pixmap);
|
||||||
m_core->mainWindow()->setCursor(oldCursor);
|
m_core->mainWindow()->setCursor(oldCursor);
|
||||||
|
|
||||||
m_core->statusBar()->showMessage(tr("Printed %1...").arg(QFileInfo(fw->fileName()).fileName()));
|
// m_core->statusBar()->showMessage(tr("Printed %1...").arg(QFileInfo(fw->fileName()).fileName()));
|
||||||
} while (false);
|
} while (false);
|
||||||
m_core->printer()->setFullPage(oldFullPage);
|
m_core->printer()->setFullPage(oldFullPage);
|
||||||
m_core->printer()->setOrientation(oldOrientation);
|
m_core->printer()->setOrientation(oldOrientation);
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class SettingsPage;
|
|||||||
* Requesting an editor via instance() will fully initialize the class.
|
* Requesting an editor via instance() will fully initialize the class.
|
||||||
* This is based on the assumption that the Designer settings work with
|
* This is based on the assumption that the Designer settings work with
|
||||||
* no plugins loaded. If that does not work, full initialization can be
|
* no plugins loaded. If that does not work, full initialization can be
|
||||||
* triggered by connection to the ICore::settingsDialogRequested() signal.
|
* triggered by connection to the ICore::optionsDialogRequested() signal.
|
||||||
*/
|
*/
|
||||||
class FormEditorW : public QObject
|
class FormEditorW : public QObject
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
|
|||||||
addWidget(spacerItem);
|
addWidget(spacerItem);
|
||||||
QToolButton *close = new QToolButton;
|
QToolButton *close = new QToolButton;
|
||||||
close->setProperty("type", QLatin1String("dockbutton"));
|
close->setProperty("type", QLatin1String("dockbutton"));
|
||||||
close->setIcon(QIcon(":/qworkbench/images/closebutton.png"));
|
close->setIcon(QIcon(":/core/images/closebutton.png"));
|
||||||
connect(close, SIGNAL(clicked()), this, SLOT(hideAndResetFocus()));
|
connect(close, SIGNAL(clicked()), this, SLOT(hideAndResetFocus()));
|
||||||
addWidget(close);
|
addWidget(close);
|
||||||
|
|
||||||
|
|||||||
@@ -32,8 +32,12 @@
|
|||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
#include "commitdata.h"
|
#include "commitdata.h"
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QRegExp>
|
||||||
|
|
||||||
|
const char *const kBranchIndicatorC = "# On branch";
|
||||||
|
|
||||||
namespace Git {
|
namespace Git {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -85,6 +89,130 @@ void CommitData::clear()
|
|||||||
untrackedFiles.clear();
|
untrackedFiles.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Split a state/file spec from git status output
|
||||||
|
// '#<tab>modified:<blanks>git .pro'
|
||||||
|
// into state and file ('modified', 'git .pro').
|
||||||
|
CommitData::StateFilePair splitStateFileSpecification(const QString &line)
|
||||||
|
{
|
||||||
|
QPair<QString, QString> rc;
|
||||||
|
const int statePos = 2;
|
||||||
|
const int colonIndex = line.indexOf(QLatin1Char(':'), statePos);
|
||||||
|
if (colonIndex == -1)
|
||||||
|
return rc;
|
||||||
|
rc.first = line.mid(statePos, colonIndex - statePos);
|
||||||
|
int filePos = colonIndex + 1;
|
||||||
|
const QChar blank = QLatin1Char(' ');
|
||||||
|
while (line.at(filePos) == blank)
|
||||||
|
filePos++;
|
||||||
|
if (filePos < line.size())
|
||||||
|
rc.second = line.mid(filePos, line.size() - filePos);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convenience to add a state/file spec to a list
|
||||||
|
static inline bool addStateFileSpecification(const QString &line, QList<CommitData::StateFilePair> *list)
|
||||||
|
{
|
||||||
|
const CommitData::StateFilePair sf = splitStateFileSpecification(line);
|
||||||
|
if (sf.first.isEmpty() || sf.second.isEmpty())
|
||||||
|
return false;
|
||||||
|
list->push_back(sf);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Parse a git status file list:
|
||||||
|
* \code
|
||||||
|
# Changes to be committed:
|
||||||
|
#<tab>modified:<blanks>git.pro
|
||||||
|
# Changed but not updated:
|
||||||
|
#<tab>modified:<blanks>git.pro
|
||||||
|
# Untracked files:
|
||||||
|
#<tab>git.pro
|
||||||
|
\endcode
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool CommitData::parseFilesFromStatus(const QString &output)
|
||||||
|
{
|
||||||
|
enum State { None, CommitFiles, NotUpdatedFiles, UntrackedFiles };
|
||||||
|
|
||||||
|
const QStringList lines = output.split(QLatin1Char('\n'));
|
||||||
|
const QString branchIndicator = QLatin1String(kBranchIndicatorC);
|
||||||
|
const QString commitIndicator = QLatin1String("# Changes to be committed:");
|
||||||
|
const QString notUpdatedIndicator = QLatin1String("# Changed but not updated:");
|
||||||
|
const QString untrackedIndicator = QLatin1String("# Untracked files:");
|
||||||
|
|
||||||
|
State s = None;
|
||||||
|
// Match added/changed-not-updated files: "#<tab>modified: foo.cpp"
|
||||||
|
QRegExp filesPattern(QLatin1String("#\\t[^:]+:\\s+.+"));
|
||||||
|
QTC_ASSERT(filesPattern.isValid(), return false);
|
||||||
|
|
||||||
|
const QStringList::const_iterator cend = lines.constEnd();
|
||||||
|
for (QStringList::const_iterator it = lines.constBegin(); it != cend; ++it) {
|
||||||
|
const QString line = *it;
|
||||||
|
if (line.startsWith(branchIndicator)) {
|
||||||
|
panelInfo.branch = line.mid(branchIndicator.size() + 1);
|
||||||
|
} else {
|
||||||
|
if (line.startsWith(commitIndicator)) {
|
||||||
|
s = CommitFiles;
|
||||||
|
} else {
|
||||||
|
if (line.startsWith(notUpdatedIndicator)) {
|
||||||
|
s = NotUpdatedFiles;
|
||||||
|
} else {
|
||||||
|
if (line.startsWith(untrackedIndicator)) {
|
||||||
|
// Now match untracked: "#<tab>foo.cpp"
|
||||||
|
s = UntrackedFiles;
|
||||||
|
filesPattern = QRegExp(QLatin1String("#\\t.+"));
|
||||||
|
QTC_ASSERT(filesPattern.isValid(), return false);
|
||||||
|
} else {
|
||||||
|
if (filesPattern.exactMatch(line)) {
|
||||||
|
switch (s) {
|
||||||
|
case CommitFiles:
|
||||||
|
addStateFileSpecification(line, &stagedFiles);
|
||||||
|
break;
|
||||||
|
case NotUpdatedFiles:
|
||||||
|
addStateFileSpecification(line, &unstagedFiles);
|
||||||
|
break;
|
||||||
|
case UntrackedFiles:
|
||||||
|
untrackedFiles.push_back(line.mid(2).trimmed());
|
||||||
|
break;
|
||||||
|
case None:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return !stagedFiles.empty() || !unstagedFiles.empty() || !untrackedFiles.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert a spec pair list to a list of file names, optionally
|
||||||
|
// filter for a state
|
||||||
|
static QStringList specToFileNames(const QList<CommitData::StateFilePair> &files,
|
||||||
|
const QString &stateFilter)
|
||||||
|
{
|
||||||
|
typedef QList<CommitData::StateFilePair>::const_iterator ConstIterator;
|
||||||
|
if (files.empty())
|
||||||
|
return QStringList();
|
||||||
|
const bool emptyFilter = stateFilter.isEmpty();
|
||||||
|
QStringList rc;
|
||||||
|
const ConstIterator cend = files.constEnd();
|
||||||
|
for (ConstIterator it = files.constBegin(); it != cend; ++it)
|
||||||
|
if (emptyFilter || stateFilter == it->first)
|
||||||
|
rc.push_back(it->second);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList CommitData::stagedFileNames(const QString &stateFilter) const
|
||||||
|
{
|
||||||
|
return specToFileNames(stagedFiles, stateFilter);
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList CommitData::unstagedFileNames(const QString &stateFilter) const
|
||||||
|
{
|
||||||
|
return specToFileNames(unstagedFiles, stateFilter);
|
||||||
|
}
|
||||||
|
|
||||||
QDebug operator<<(QDebug d, const CommitData &data)
|
QDebug operator<<(QDebug d, const CommitData &data)
|
||||||
{
|
{
|
||||||
d << data.panelInfo << data.panelData;
|
d << data.panelInfo << data.panelData;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#define COMMITDATA_H
|
#define COMMITDATA_H
|
||||||
|
|
||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
|
#include <QtCore/QPair>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QDebug;
|
class QDebug;
|
||||||
@@ -68,11 +69,24 @@ QDebug operator<<(QDebug d, const GitSubmitEditorPanelData &);
|
|||||||
|
|
||||||
struct CommitData
|
struct CommitData
|
||||||
{
|
{
|
||||||
|
// A pair of state string/file name ('modified', 'file.cpp').
|
||||||
|
typedef QPair<QString, QString> StateFilePair;
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
// Parse the files and the branch of panelInfo
|
||||||
|
// from a git status output
|
||||||
|
bool parseFilesFromStatus(const QString &output);
|
||||||
|
|
||||||
|
// Convenience to retrieve the file names from
|
||||||
|
// the specification list. Optionally filter for a certain state
|
||||||
|
QStringList stagedFileNames(const QString &stateFilter = QString()) const;
|
||||||
|
QStringList unstagedFileNames(const QString &stateFilter = QString()) const;
|
||||||
|
|
||||||
GitSubmitEditorPanelInfo panelInfo;
|
GitSubmitEditorPanelInfo panelInfo;
|
||||||
GitSubmitEditorPanelData panelData;
|
GitSubmitEditorPanelData panelData;
|
||||||
QStringList stagedFiles;
|
|
||||||
QStringList unstagedFiles;
|
QList<StateFilePair> stagedFiles;
|
||||||
|
QList<StateFilePair> unstagedFiles;
|
||||||
QStringList untrackedFiles;
|
QStringList untrackedFiles;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -622,73 +622,6 @@ GitClient::StatusResult GitClient::gitStatus(const QString &workingDirectory,
|
|||||||
return StatusChanged;
|
return StatusChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse a git status file list:
|
|
||||||
* \code
|
|
||||||
# Changes to be committed:
|
|
||||||
#<tab>modified:<blanks>git.pro
|
|
||||||
# Changed but not updated:
|
|
||||||
#<tab>modified:<blanks>git.pro
|
|
||||||
# Untracked files:
|
|
||||||
#<tab>git.pro
|
|
||||||
\endcode
|
|
||||||
*/
|
|
||||||
static bool parseFiles(const QString &output, CommitData *d)
|
|
||||||
{
|
|
||||||
enum State { None, CommitFiles, NotUpdatedFiles, UntrackedFiles };
|
|
||||||
|
|
||||||
const QStringList lines = output.split(QLatin1Char('\n'));
|
|
||||||
const QString branchIndicator = QLatin1String(kBranchIndicatorC);
|
|
||||||
const QString commitIndicator = QLatin1String("# Changes to be committed:");
|
|
||||||
const QString notUpdatedIndicator = QLatin1String("# Changed but not updated:");
|
|
||||||
const QString untrackedIndicator = QLatin1String("# Untracked files:");
|
|
||||||
|
|
||||||
State s = None;
|
|
||||||
// Match added/changed-not-updated files: "#<tab>modified: foo.cpp"
|
|
||||||
QRegExp filesPattern(QLatin1String("#\\t[^:]+:\\s+.+"));
|
|
||||||
QTC_ASSERT(filesPattern.isValid(), return false);
|
|
||||||
|
|
||||||
const QStringList::const_iterator cend = lines.constEnd();
|
|
||||||
for (QStringList::const_iterator it = lines.constBegin(); it != cend; ++it) {
|
|
||||||
const QString line = *it;
|
|
||||||
if (line.startsWith(branchIndicator)) {
|
|
||||||
d->panelInfo.branch = line.mid(branchIndicator.size() + 1);
|
|
||||||
} else {
|
|
||||||
if (line.startsWith(commitIndicator)) {
|
|
||||||
s = CommitFiles;
|
|
||||||
} else {
|
|
||||||
if (line.startsWith(notUpdatedIndicator)) {
|
|
||||||
s = NotUpdatedFiles;
|
|
||||||
} else {
|
|
||||||
if (line.startsWith(untrackedIndicator)) {
|
|
||||||
// Now match untracked: "#<tab>foo.cpp"
|
|
||||||
s = UntrackedFiles;
|
|
||||||
filesPattern = QRegExp(QLatin1String("#\\t.+"));
|
|
||||||
QTC_ASSERT(filesPattern.isValid(), return false);
|
|
||||||
} else {
|
|
||||||
if (filesPattern.exactMatch(line)) {
|
|
||||||
const QString fileSpec = line.mid(2).trimmed();
|
|
||||||
switch (s) {
|
|
||||||
case CommitFiles:
|
|
||||||
d->stagedFiles.push_back(trimFileSpecification(fileSpec));
|
|
||||||
break;
|
|
||||||
case NotUpdatedFiles:
|
|
||||||
d->unstagedFiles.push_back(trimFileSpecification(fileSpec));
|
|
||||||
break;
|
|
||||||
case UntrackedFiles:
|
|
||||||
d->untrackedFiles.push_back(fileSpec);
|
|
||||||
break;
|
|
||||||
case None:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return !d->stagedFiles.empty() || !d->unstagedFiles.empty() || !d->untrackedFiles.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter out untracked files that are not part of the project
|
// Filter out untracked files that are not part of the project
|
||||||
static void filterUntrackedFilesOfProject(const QString &repoDir, QStringList *l)
|
static void filterUntrackedFilesOfProject(const QString &repoDir, QStringList *l)
|
||||||
{
|
{
|
||||||
@@ -771,20 +704,12 @@ bool GitClient::getCommitData(const QString &workingDirectory,
|
|||||||
// #
|
// #
|
||||||
// # list of files...
|
// # list of files...
|
||||||
|
|
||||||
if (!parseFiles(output, d)) {
|
if (!d->parseFilesFromStatus(output)) {
|
||||||
*errorMessage = msgParseFilesFailed();
|
*errorMessage = msgParseFilesFailed();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Filter out untracked files that are not part of the project and,
|
// Filter out untracked files that are not part of the project
|
||||||
// for symmetry, insert the prefix "untracked:" (as "added:" or ":modified"
|
|
||||||
// for staged files).
|
|
||||||
filterUntrackedFilesOfProject(repoDirectory, &d->untrackedFiles);
|
filterUntrackedFilesOfProject(repoDirectory, &d->untrackedFiles);
|
||||||
if (!d->untrackedFiles.empty()) {
|
|
||||||
const QString untrackedPrefix = QLatin1String("untracked: ");
|
|
||||||
const QStringList::iterator pend = d->untrackedFiles.end();
|
|
||||||
for (QStringList::iterator it = d->untrackedFiles.begin(); it != pend; ++it)
|
|
||||||
it->insert(0, untrackedPrefix);
|
|
||||||
}
|
|
||||||
|
|
||||||
d->panelData.author = readConfigValue(workingDirectory, QLatin1String("user.name"));
|
d->panelData.author = readConfigValue(workingDirectory, QLatin1String("user.name"));
|
||||||
d->panelData.email = readConfigValue(workingDirectory, QLatin1String("user.email"));
|
d->panelData.email = readConfigValue(workingDirectory, QLatin1String("user.email"));
|
||||||
@@ -881,7 +806,7 @@ GitClient::RevertResult GitClient::revertI(QStringList files, bool *ptrToIsDirec
|
|||||||
return RevertFailed;
|
return RevertFailed;
|
||||||
}
|
}
|
||||||
CommitData data;
|
CommitData data;
|
||||||
if (!parseFiles(output, &data)) {
|
if (!data.parseFilesFromStatus(output)) {
|
||||||
*errorMessage = msgParseFilesFailed();
|
*errorMessage = msgParseFilesFailed();
|
||||||
return RevertFailed;
|
return RevertFailed;
|
||||||
}
|
}
|
||||||
@@ -896,9 +821,9 @@ GitClient::RevertResult GitClient::revertI(QStringList files, bool *ptrToIsDirec
|
|||||||
}
|
}
|
||||||
|
|
||||||
// From the status output, determine all modified [un]staged files.
|
// From the status output, determine all modified [un]staged files.
|
||||||
const QString modifiedPattern = QLatin1String("modified: ");
|
const QString modifiedState = QLatin1String("modified");
|
||||||
const QStringList allStagedFiles = GitSubmitEditor::statusListToFileList(data.stagedFiles.filter(modifiedPattern));
|
const QStringList allStagedFiles = data.stagedFileNames(modifiedState);
|
||||||
const QStringList allUnstagedFiles = GitSubmitEditor::statusListToFileList(data.unstagedFiles.filter(modifiedPattern));
|
const QStringList allUnstagedFiles = data.unstagedFileNames(modifiedState);
|
||||||
// Unless a directory was passed, filter all modified files for the
|
// Unless a directory was passed, filter all modified files for the
|
||||||
// argument file list.
|
// argument file list.
|
||||||
QStringList stagedFiles = allStagedFiles;
|
QStringList stagedFiles = allStagedFiles;
|
||||||
|
|||||||
@@ -602,7 +602,7 @@ void GitPlugin::startCommit()
|
|||||||
// Store repository for diff and the original list of
|
// Store repository for diff and the original list of
|
||||||
// files to be able to unstage files the user unchecks
|
// files to be able to unstage files the user unchecks
|
||||||
m_submitRepository = data.panelInfo.repository;
|
m_submitRepository = data.panelInfo.repository;
|
||||||
m_submitOrigCommitFiles = GitSubmitEditor::statusListToFileList(data.stagedFiles);
|
m_submitOrigCommitFiles = data.stagedFileNames();
|
||||||
|
|
||||||
if (Git::Constants::debug)
|
if (Git::Constants::debug)
|
||||||
qDebug() << Q_FUNC_INFO << data << commitTemplate;
|
qDebug() << Q_FUNC_INFO << data << commitTemplate;
|
||||||
|
|||||||
@@ -36,6 +36,8 @@
|
|||||||
#include "gitconstants.h"
|
#include "gitconstants.h"
|
||||||
#include "commitdata.h"
|
#include "commitdata.h"
|
||||||
|
|
||||||
|
#include <vcsbase/submitfilemodel.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
namespace Git {
|
namespace Git {
|
||||||
@@ -52,14 +54,14 @@ GitSubmitEditorWidget *GitSubmitEditor::submitEditorWidget()
|
|||||||
return static_cast<GitSubmitEditorWidget *>(widget());
|
return static_cast<GitSubmitEditorWidget *>(widget());
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList GitSubmitEditor::statusListToFileList(const QStringList &rawList)
|
static void addStateFileListToModel(const QList<CommitData::StateFilePair> &l,
|
||||||
|
VCSBase::SubmitFileModel *model,
|
||||||
|
bool checked)
|
||||||
{
|
{
|
||||||
if (rawList.empty())
|
typedef QList<CommitData::StateFilePair>::const_iterator ConstIterator;
|
||||||
return rawList;
|
const ConstIterator cend = l.constEnd();
|
||||||
QStringList rc;
|
for (ConstIterator it = l.constBegin(); it != cend; ++it)
|
||||||
foreach (const QString &rf, rawList)
|
model->addFile(it->second, it->first, checked);
|
||||||
rc.push_back(fileFromStatusLine(rf));
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitSubmitEditor::setCommitData(const CommitData &d)
|
void GitSubmitEditor::setCommitData(const CommitData &d)
|
||||||
@@ -67,10 +69,16 @@ void GitSubmitEditor::setCommitData(const CommitData &d)
|
|||||||
submitEditorWidget()->setPanelData(d.panelData);
|
submitEditorWidget()->setPanelData(d.panelData);
|
||||||
submitEditorWidget()->setPanelInfo(d.panelInfo);
|
submitEditorWidget()->setPanelInfo(d.panelInfo);
|
||||||
|
|
||||||
addFiles(d.stagedFiles, true, true);
|
VCSBase::SubmitFileModel *model = new VCSBase::SubmitFileModel(this);
|
||||||
// Not Updated: Initially unchecked
|
addStateFileListToModel(d.stagedFiles, model, true);
|
||||||
addFiles(d.unstagedFiles, false, true);
|
addStateFileListToModel(d.unstagedFiles, model, false);
|
||||||
addFiles(d.untrackedFiles, false, true);
|
if (!d.untrackedFiles.empty()) {
|
||||||
|
const QString untrackedSpec = QLatin1String("untracked");
|
||||||
|
const QStringList::const_iterator cend = d.untrackedFiles.constEnd();
|
||||||
|
for (QStringList::const_iterator it = d.untrackedFiles.constBegin(); it != cend; ++it)
|
||||||
|
model->addFile(*it, untrackedSpec, false);
|
||||||
|
}
|
||||||
|
setFileModel(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
GitSubmitEditorPanelData GitSubmitEditor::panelData() const
|
GitSubmitEditorPanelData GitSubmitEditor::panelData() const
|
||||||
@@ -78,18 +86,5 @@ GitSubmitEditorPanelData GitSubmitEditor::panelData() const
|
|||||||
return const_cast<GitSubmitEditor*>(this)->submitEditorWidget()->panelData();
|
return const_cast<GitSubmitEditor*>(this)->submitEditorWidget()->panelData();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GitSubmitEditor::fileFromStatusLine(const QString &line)
|
|
||||||
{
|
|
||||||
QString rc = line;
|
|
||||||
// "modified: mainwindow.cpp"
|
|
||||||
const int index = rc.indexOf(QLatin1Char(':'));
|
|
||||||
if (index != -1)
|
|
||||||
rc.remove(0, index + 1);
|
|
||||||
const QChar blank(' ');
|
|
||||||
while (rc.startsWith(blank))
|
|
||||||
rc.remove(0, 1);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Git
|
} // namespace Git
|
||||||
|
|||||||
@@ -54,13 +54,6 @@ public:
|
|||||||
void setCommitData(const CommitData &);
|
void setCommitData(const CommitData &);
|
||||||
GitSubmitEditorPanelData panelData() const;
|
GitSubmitEditorPanelData panelData() const;
|
||||||
|
|
||||||
static QString fileFromStatusLine(const QString &line);
|
|
||||||
static QStringList statusListToFileList(const QStringList &);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual QStringList vcsFileListToFileList(const QStringList &l) const
|
|
||||||
{ return statusListToFileList(l); }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline GitSubmitEditorWidget *submitEditorWidget();
|
inline GitSubmitEditorWidget *submitEditorWidget();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ void HelpPlugin::createRightPaneSideBar()
|
|||||||
|
|
||||||
QToolButton *closeButton = new QToolButton();
|
QToolButton *closeButton = new QToolButton();
|
||||||
closeButton->setProperty("type", QLatin1String("dockbutton"));
|
closeButton->setProperty("type", QLatin1String("dockbutton"));
|
||||||
closeButton->setIcon(QIcon(":/qworkbench/images/closebutton.png"));
|
closeButton->setIcon(QIcon(":/core/images/closebutton.png"));
|
||||||
|
|
||||||
// Dummy layout to align the close button to the right
|
// Dummy layout to align the close button to the right
|
||||||
QHBoxLayout *hboxLayout = new QHBoxLayout();
|
QHBoxLayout *hboxLayout = new QHBoxLayout();
|
||||||
|
|||||||
@@ -494,19 +494,19 @@ void PerforcePlugin::submit()
|
|||||||
QTC_ASSERT(m_coreInstance, return);
|
QTC_ASSERT(m_coreInstance, return);
|
||||||
|
|
||||||
if (!checkP4Command()) {
|
if (!checkP4Command()) {
|
||||||
showOutput(tr("No p4 executable specified!"));
|
showOutput(tr("No p4 executable specified!"), true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_changeTmpFile) {
|
if (m_changeTmpFile) {
|
||||||
showOutput(tr("Another submit is currently executed."));
|
showOutput(tr("Another submit is currently executed."), true);
|
||||||
m_perforceOutputWindow->popup(false);
|
m_perforceOutputWindow->popup(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_changeTmpFile = new QTemporaryFile(this);
|
m_changeTmpFile = new QTemporaryFile(this);
|
||||||
if (!m_changeTmpFile->open()) {
|
if (!m_changeTmpFile->open()) {
|
||||||
showOutput(tr("Cannot create temporary file."));
|
showOutput(tr("Cannot create temporary file."), true);
|
||||||
delete m_changeTmpFile;
|
delete m_changeTmpFile;
|
||||||
m_changeTmpFile = 0;
|
m_changeTmpFile = 0;
|
||||||
return;
|
return;
|
||||||
@@ -970,7 +970,7 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor)
|
|||||||
QByteArray change = m_changeTmpFile->readAll();
|
QByteArray change = m_changeTmpFile->readAll();
|
||||||
m_changeTmpFile->close();
|
m_changeTmpFile->close();
|
||||||
if (!checkP4Command()) {
|
if (!checkP4Command()) {
|
||||||
showOutput(tr("No p4 executable specified!"));
|
showOutput(tr("No p4 executable specified!"), true);
|
||||||
delete m_changeTmpFile;
|
delete m_changeTmpFile;
|
||||||
m_changeTmpFile = 0;
|
m_changeTmpFile = 0;
|
||||||
return false;
|
return false;
|
||||||
@@ -981,8 +981,8 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor)
|
|||||||
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||||
proc.start(m_settings.p4Command,
|
proc.start(m_settings.p4Command,
|
||||||
basicP4Args() << QLatin1String("submit") << QLatin1String("-i"));
|
basicP4Args() << QLatin1String("submit") << QLatin1String("-i"));
|
||||||
if (!proc.waitForStarted(3000)) {
|
if (!proc.waitForStarted(p4Timeout)) {
|
||||||
showOutput(tr("Cannot execute p4 submit."));
|
showOutput(tr("Cannot execute p4 submit."), true);
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
delete m_changeTmpFile;
|
delete m_changeTmpFile;
|
||||||
m_changeTmpFile = 0;
|
m_changeTmpFile = 0;
|
||||||
@@ -992,7 +992,7 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor)
|
|||||||
proc.closeWriteChannel();
|
proc.closeWriteChannel();
|
||||||
|
|
||||||
if (!proc.waitForFinished()) {
|
if (!proc.waitForFinished()) {
|
||||||
showOutput(tr("Cannot execute p4 submit."));
|
showOutput(tr("Cannot execute p4 submit."), true);
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
delete m_changeTmpFile;
|
delete m_changeTmpFile;
|
||||||
m_changeTmpFile = 0;
|
m_changeTmpFile = 0;
|
||||||
@@ -1000,7 +1000,7 @@ bool PerforcePlugin::editorAboutToClose(Core::IEditor *editor)
|
|||||||
}
|
}
|
||||||
QString output = QString::fromUtf8(proc.readAll());
|
QString output = QString::fromUtf8(proc.readAll());
|
||||||
showOutput(output);
|
showOutput(output);
|
||||||
if (output.contains("Out of date files must be resolved or reverted")) {
|
if (output.contains("Out of date files must be resolved or reverted"), true) {
|
||||||
QMessageBox::warning(editor->widget(), "Pending change", "Could not submit the change, because your workspace was out of date. Created a pending submit instead.");
|
QMessageBox::warning(editor->widget(), "Pending change", "Could not submit the change, because your workspace was out of date. Created a pending submit instead.");
|
||||||
}
|
}
|
||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include "perforceplugin.h"
|
#include "perforceplugin.h"
|
||||||
#include "perforceconstants.h"
|
#include "perforceconstants.h"
|
||||||
|
|
||||||
|
#include <vcsbase/submitfilemodel.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
@@ -43,10 +44,14 @@
|
|||||||
namespace Perforce {
|
namespace Perforce {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
enum { FileSpecRole = Qt::UserRole + 1 };
|
||||||
|
|
||||||
PerforceSubmitEditor::PerforceSubmitEditor(const VCSBase::VCSBaseSubmitEditorParameters *parameters, QWidget *parent) :
|
PerforceSubmitEditor::PerforceSubmitEditor(const VCSBase::VCSBaseSubmitEditorParameters *parameters, QWidget *parent) :
|
||||||
VCSBaseSubmitEditor(parameters, new PerforceSubmitEditorWidget(parent))
|
VCSBaseSubmitEditor(parameters, new PerforceSubmitEditorWidget(parent)),
|
||||||
|
m_fileModel(new VCSBase::SubmitFileModel(this))
|
||||||
{
|
{
|
||||||
setDisplayName(tr("Perforce Submit"));
|
setDisplayName(tr("Perforce Submit"));
|
||||||
|
setFileModel(m_fileModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
PerforceSubmitEditorWidget *PerforceSubmitEditor::submitEditorWidget()
|
PerforceSubmitEditorWidget *PerforceSubmitEditor::submitEditorWidget()
|
||||||
@@ -54,14 +59,6 @@ PerforceSubmitEditorWidget *PerforceSubmitEditor::submitEditorWidget()
|
|||||||
return static_cast<PerforceSubmitEditorWidget *>(widget());
|
return static_cast<PerforceSubmitEditorWidget *>(widget());
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList PerforceSubmitEditor::vcsFileListToFileList(const QStringList &rawList) const
|
|
||||||
{
|
|
||||||
QStringList rc;
|
|
||||||
foreach (const QString &rf, rawList)
|
|
||||||
rc.push_back(fileFromChangeLine(rf));
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString PerforceSubmitEditor::fileContents() const
|
QString PerforceSubmitEditor::fileContents() const
|
||||||
{
|
{
|
||||||
const_cast<PerforceSubmitEditor*>(this)->updateEntries();
|
const_cast<PerforceSubmitEditor*>(this)->updateEntries();
|
||||||
@@ -121,25 +118,7 @@ bool PerforceSubmitEditor::parseText(QString text)
|
|||||||
|
|
||||||
void PerforceSubmitEditor::restrictToProjectFiles(const QStringList &knownProjectFiles)
|
void PerforceSubmitEditor::restrictToProjectFiles(const QStringList &knownProjectFiles)
|
||||||
{
|
{
|
||||||
QStringList allFiles = submitEditorWidget()->fileList();
|
m_fileModel->filter(knownProjectFiles, fileNameColumn());
|
||||||
const int oldSize = allFiles.size();
|
|
||||||
for (int i = oldSize - 1; i >= 0; i--)
|
|
||||||
if (!knownProjectFiles.contains(fileFromChangeLine(allFiles.at(i))))
|
|
||||||
allFiles.removeAt(i);
|
|
||||||
if (allFiles.size() != oldSize)
|
|
||||||
submitEditorWidget()->setFileList(allFiles);
|
|
||||||
if (Perforce::Constants::debug)
|
|
||||||
qDebug() << Q_FUNC_INFO << oldSize << "->" << allFiles.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString PerforceSubmitEditor::fileFromChangeLine(const QString &line)
|
|
||||||
{
|
|
||||||
QString rc = line;
|
|
||||||
// " foo.cpp#add"
|
|
||||||
const int index = rc.lastIndexOf(QLatin1Char('#'));
|
|
||||||
if (index != -1)
|
|
||||||
rc.truncate(index);
|
|
||||||
return rc.trimmed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerforceSubmitEditor::updateFields()
|
void PerforceSubmitEditor::updateFields()
|
||||||
@@ -161,12 +140,15 @@ void PerforceSubmitEditor::updateFields()
|
|||||||
widget->setDescriptionText(lines.join(newLine));
|
widget->setDescriptionText(lines.join(newLine));
|
||||||
|
|
||||||
lines = m_entries.value(QLatin1String("Files")).split(newLine);
|
lines = m_entries.value(QLatin1String("Files")).split(newLine);
|
||||||
lines.replaceInStrings(leadingTabPattern, QString());
|
// split up "file#add" and store complete spec line as user data
|
||||||
QStringList fileList;
|
foreach (const QString &specLine, lines) {
|
||||||
foreach (const QString &line, lines)
|
const QStringList list = specLine.split(QLatin1Char('#'));
|
||||||
if (!line.isEmpty())
|
if (list.size() == 2) {
|
||||||
fileList.push_back(line);
|
const QString file = list.at(0).trimmed();
|
||||||
widget->setFileList(fileList);
|
const QString state = list.at(1).trimmed();
|
||||||
|
m_fileModel->addFile(file, state).at(0)->setData(specLine, FileSpecRole);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerforceSubmitEditor::updateEntries()
|
void PerforceSubmitEditor::updateEntries()
|
||||||
@@ -181,13 +163,14 @@ void PerforceSubmitEditor::updateEntries()
|
|||||||
lines.replaceInStrings(QRegExp(QLatin1String("^")), tab);
|
lines.replaceInStrings(QRegExp(QLatin1String("^")), tab);
|
||||||
m_entries.insert(QLatin1String("Description"), newLine + lines.join(newLine) + QLatin1String("\n\n"));
|
m_entries.insert(QLatin1String("Description"), newLine + lines.join(newLine) + QLatin1String("\n\n"));
|
||||||
QString files = newLine;
|
QString files = newLine;
|
||||||
// Files
|
// Re-build the file spec '<tab>file#add' from the user data
|
||||||
const QStringList fileList = submitEditorWidget()->fileList();
|
const int count = m_fileModel->rowCount();
|
||||||
const int count = fileList.size();
|
for (int r = 0; r < count; r++) {
|
||||||
for (int i = 0; i < count; i++) {
|
const QStandardItem *item = m_fileModel->item(r, 0);
|
||||||
files += tab;
|
if (item->checkState() == Qt::Checked) {
|
||||||
files += fileList.at(i);
|
files += item->data(FileSpecRole).toString();
|
||||||
files += newLine;
|
files += newLine;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
files += newLine;
|
files += newLine;
|
||||||
m_entries.insert(QLatin1String("Files"), files);
|
m_entries.insert(QLatin1String("Files"), files);
|
||||||
|
|||||||
@@ -39,6 +39,10 @@
|
|||||||
#include <QtCore/QStringList>
|
#include <QtCore/QStringList>
|
||||||
#include <QtCore/QMap>
|
#include <QtCore/QMap>
|
||||||
|
|
||||||
|
namespace VCSBase {
|
||||||
|
class SubmitFileModel;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Perforce {
|
namespace Perforce {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -66,7 +70,6 @@ public:
|
|||||||
static QString fileFromChangeLine(const QString &line);
|
static QString fileFromChangeLine(const QString &line);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual QStringList vcsFileListToFileList(const QStringList &) const;
|
|
||||||
virtual QString fileContents() const;
|
virtual QString fileContents() const;
|
||||||
virtual bool setFileContents(const QString &contents);
|
virtual bool setFileContents(const QString &contents);
|
||||||
|
|
||||||
@@ -77,6 +80,7 @@ private:
|
|||||||
void updateEntries();
|
void updateEntries();
|
||||||
|
|
||||||
QMap<QString, QString> m_entries;
|
QMap<QString, QString> m_entries;
|
||||||
|
VCSBase::SubmitFileModel *m_fileModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include "buildstepspage.h"
|
#include "buildstepspage.h"
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
|
|
||||||
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
@@ -102,9 +103,9 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
|||||||
m_ui.splitter->setStretchFactor(1,10);
|
m_ui.splitter->setStretchFactor(1,10);
|
||||||
m_ui.buildSettingsList->setContextMenuPolicy(Qt::CustomContextMenu);
|
m_ui.buildSettingsList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
|
||||||
m_ui.addButton->setIcon(QIcon(":/qworkbench/images/plus.png"));
|
m_ui.addButton->setIcon(QIcon(Core::Constants::ICON_PLUS));
|
||||||
m_ui.addButton->setText("");
|
m_ui.addButton->setText("");
|
||||||
m_ui.removeButton->setIcon(QIcon(":/qworkbench/images/minus.png"));
|
m_ui.removeButton->setIcon(QIcon(Core::Constants::ICON_MINUS));
|
||||||
m_ui.removeButton->setText("");
|
m_ui.removeButton->setText("");
|
||||||
|
|
||||||
QMenu *addButtonMenu = new QMenu(this);
|
QMenu *addButtonMenu = new QMenu(this);
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include "ui_buildstepspage.h"
|
#include "ui_buildstepspage.h"
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
|
|
||||||
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -50,8 +51,8 @@ BuildStepsPage::BuildStepsPage(Project *project) :
|
|||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
m_ui->buildStepAddButton->setMenu(new QMenu(this));
|
m_ui->buildStepAddButton->setMenu(new QMenu(this));
|
||||||
m_ui->buildStepAddButton->setIcon(QIcon(":/qworkbench/images/plus.png"));
|
m_ui->buildStepAddButton->setIcon(QIcon(Core::Constants::ICON_PLUS));
|
||||||
m_ui->buildStepRemoveToolButton->setIcon(QIcon(":/qworkbench/images/minus.png"));
|
m_ui->buildStepRemoveToolButton->setIcon(QIcon(Core::Constants::ICON_MINUS));
|
||||||
m_ui->buildStepUpToolButton->setArrowType(Qt::UpArrow);
|
m_ui->buildStepUpToolButton->setArrowType(Qt::UpArrow);
|
||||||
m_ui->buildStepDownToolButton->setArrowType(Qt::DownArrow);
|
m_ui->buildStepDownToolButton->setArrowType(Qt::DownArrow);
|
||||||
|
|
||||||
|
|||||||
@@ -1,59 +1,45 @@
|
|||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
<class>ProjectExplorer::Internal::DependenciesDialog</class>
|
<class>ProjectExplorer::Internal::DependenciesDialog</class>
|
||||||
<widget class="QDialog" name="ProjectExplorer::Internal::DependenciesDialog" >
|
<widget class="QDialog" name="ProjectExplorer::Internal::DependenciesDialog">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>618</width>
|
<width>492</width>
|
||||||
<height>660</height>
|
<height>435</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>Project Dependencies</string>
|
<string>Project Dependencies</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout">
|
||||||
<property name="spacing" >
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin" >
|
<property name="margin">
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin" >
|
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableView" name="dependencyTable" >
|
<widget class="QTableView" name="dependencyTable">
|
||||||
<property name="minimumSize" >
|
<property name="selectionMode">
|
||||||
<size>
|
|
||||||
<width>600</width>
|
|
||||||
<height>600</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="selectionMode" >
|
|
||||||
<enum>QAbstractItemView::SingleSelection</enum>
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line" >
|
<widget class="Line" name="line">
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons" >
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
@@ -68,11 +54,11 @@
|
|||||||
<receiver>ProjectExplorer::Internal::DependenciesDialog</receiver>
|
<receiver>ProjectExplorer::Internal::DependenciesDialog</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>142</x>
|
<x>142</x>
|
||||||
<y>285</y>
|
<y>285</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>142</x>
|
<x>142</x>
|
||||||
<y>155</y>
|
<y>155</y>
|
||||||
</hint>
|
</hint>
|
||||||
@@ -84,11 +70,11 @@
|
|||||||
<receiver>ProjectExplorer::Internal::DependenciesDialog</receiver>
|
<receiver>ProjectExplorer::Internal::DependenciesDialog</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>142</x>
|
<x>142</x>
|
||||||
<y>285</y>
|
<y>285</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>142</x>
|
<x>142</x>
|
||||||
<y>155</y>
|
<y>155</y>
|
||||||
</hint>
|
</hint>
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ Core::NavigationView FolderNavigationWidgetFactory::createWidget()
|
|||||||
n.widget = ptw;
|
n.widget = ptw;
|
||||||
QToolButton *toggleSync = new QToolButton;
|
QToolButton *toggleSync = new QToolButton;
|
||||||
toggleSync->setProperty("type", "dockbutton");
|
toggleSync->setProperty("type", "dockbutton");
|
||||||
toggleSync->setIcon(QIcon(":/qworkbench/images/linkicon.png"));
|
toggleSync->setIcon(QIcon(":/core/images/linkicon.png"));
|
||||||
toggleSync->setCheckable(true);
|
toggleSync->setCheckable(true);
|
||||||
toggleSync->setChecked(ptw->autoSynchronization());
|
toggleSync->setChecked(ptw->autoSynchronization());
|
||||||
toggleSync->setToolTip(tr("Synchronize with Editor"));
|
toggleSync->setToolTip(tr("Synchronize with Editor"));
|
||||||
|
|||||||
@@ -484,6 +484,10 @@ bool ProjectExplorerPlugin::initialize(const QStringList & /*arguments*/, QStrin
|
|||||||
mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
|
mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
|
||||||
msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);
|
msessionContextMenu->addAction(cmd, Constants::G_SESSION_BUILD);
|
||||||
|
|
||||||
|
// dependencies action
|
||||||
|
m_dependenciesAction = new QAction(tr("Edit Dependencies..."), this);
|
||||||
|
cmd = am->registerAction(m_dependenciesAction, Constants::DEPENDENCIES, globalcontext);
|
||||||
|
mbuild->addAction(cmd, Constants::G_BUILD_SESSION);
|
||||||
|
|
||||||
// build action
|
// build action
|
||||||
m_buildAction = new QAction(tr("Build Project"), this);
|
m_buildAction = new QAction(tr("Build Project"), this);
|
||||||
@@ -555,11 +559,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList & /*arguments*/, QStrin
|
|||||||
mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
|
mdebug->addAction(cmd, Core::Constants::G_DEFAULT_ONE);
|
||||||
modeManager->addAction(cmd, Constants::P_ACTION_DEBUG, m_runConfigurationMenu);
|
modeManager->addAction(cmd, Constants::P_ACTION_DEBUG, m_runConfigurationMenu);
|
||||||
|
|
||||||
// dependencies action
|
|
||||||
m_dependenciesAction = new QAction(tr("Edit Dependencies..."), this);
|
|
||||||
cmd = am->registerAction(m_dependenciesAction, Constants::DEPENDENCIES, pecontext);
|
|
||||||
msessionContextMenu->addAction(cmd, Constants::G_SESSION_CONFIG);
|
|
||||||
|
|
||||||
// add new file action
|
// add new file action
|
||||||
m_addNewFileAction = new QAction(tr("Add New..."), this);
|
m_addNewFileAction = new QAction(tr("Add New..."), this);
|
||||||
cmd = am->registerAction(m_addNewFileAction, ProjectExplorer::Constants::ADDNEWFILE,
|
cmd = am->registerAction(m_addNewFileAction, ProjectExplorer::Constants::ADDNEWFILE,
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ ProjectTreeWidget::ProjectTreeWidget(Core::ICore *core, QWidget *parent)
|
|||||||
|
|
||||||
m_toggleSync = new QToolButton;
|
m_toggleSync = new QToolButton;
|
||||||
m_toggleSync->setProperty("type", "dockbutton");
|
m_toggleSync->setProperty("type", "dockbutton");
|
||||||
m_toggleSync->setIcon(QIcon(":/qworkbench/images/linkicon.png"));
|
m_toggleSync->setIcon(QIcon(":/core/images/linkicon.png"));
|
||||||
m_toggleSync->setCheckable(true);
|
m_toggleSync->setCheckable(true);
|
||||||
m_toggleSync->setChecked(autoSynchronization());
|
m_toggleSync->setChecked(autoSynchronization());
|
||||||
m_toggleSync->setToolTip(tr("Synchronize with Editor"));
|
m_toggleSync->setToolTip(tr("Synchronize with Editor"));
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include "ui_runsettingspropertiespage.h"
|
#include "ui_runsettingspropertiespage.h"
|
||||||
|
|
||||||
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
@@ -180,9 +181,9 @@ RunSettingsWidget::RunSettingsWidget(Project *project)
|
|||||||
m_ui = new Ui::RunSettingsPropertiesPage;
|
m_ui = new Ui::RunSettingsPropertiesPage;
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_addMenu = new QMenu(m_ui->addToolButton);
|
m_addMenu = new QMenu(m_ui->addToolButton);
|
||||||
m_ui->addToolButton->setIcon(QIcon(":/qworkbench/images/plus.png"));
|
m_ui->addToolButton->setIcon(QIcon(Core::Constants::ICON_PLUS));
|
||||||
m_ui->addToolButton->setMenu(m_addMenu);
|
m_ui->addToolButton->setMenu(m_addMenu);
|
||||||
m_ui->removeToolButton->setIcon(QIcon(":/qworkbench/images/minus.png"));
|
m_ui->removeToolButton->setIcon(QIcon(Core::Constants::ICON_MINUS));
|
||||||
m_ui->runConfigurationCombo->setModel(m_runConfigurationsModel);
|
m_ui->runConfigurationCombo->setModel(m_runConfigurationsModel);
|
||||||
|
|
||||||
connect(m_addMenu, SIGNAL(aboutToShow()),
|
connect(m_addMenu, SIGNAL(aboutToShow()),
|
||||||
|
|||||||
@@ -139,6 +139,29 @@ inline Core::IEditor* locateEditor(const Core::ICore *core, const char *property
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse "svn status" output for added/modified/deleted files
|
||||||
|
// "M<7blanks>file"
|
||||||
|
typedef QList<SubversionSubmitEditor::StatusFilePair> StatusList;
|
||||||
|
|
||||||
|
StatusList parseStatusOutput(const QString &output)
|
||||||
|
{
|
||||||
|
StatusList changeSet;
|
||||||
|
const QString newLine = QString(QLatin1Char('\n'));
|
||||||
|
const QStringList list = output.split(newLine, QString::SkipEmptyParts);
|
||||||
|
foreach (const QString &l, list) {
|
||||||
|
const QString line =l.trimmed();
|
||||||
|
if (line.size() > 8) {
|
||||||
|
const QChar state = line.at(0);
|
||||||
|
if (state == QLatin1Char('A') || state == QLatin1Char('D') || state == QLatin1Char('M')) {
|
||||||
|
const QString fileName = line.mid(7);
|
||||||
|
changeSet.push_back(SubversionSubmitEditor::StatusFilePair(QString(state), fileName));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return changeSet;
|
||||||
|
}
|
||||||
|
|
||||||
// ------------- SubversionPlugin
|
// ------------- SubversionPlugin
|
||||||
Core::ICore *SubversionPlugin::m_coreInstance = 0;
|
Core::ICore *SubversionPlugin::m_coreInstance = 0;
|
||||||
SubversionPlugin *SubversionPlugin::m_subversionPluginInstance = 0;
|
SubversionPlugin *SubversionPlugin::m_subversionPluginInstance = 0;
|
||||||
@@ -694,7 +717,7 @@ void SubversionPlugin::startCommit(const QStringList &files)
|
|||||||
if (response.error)
|
if (response.error)
|
||||||
return;
|
return;
|
||||||
// Get list of added/modified/deleted files
|
// Get list of added/modified/deleted files
|
||||||
const QStringList statusOutput = parseStatusOutput(response.stdOut);
|
const StatusList statusOutput = parseStatusOutput(response.stdOut);
|
||||||
if (statusOutput.empty()) {
|
if (statusOutput.empty()) {
|
||||||
showOutput(tr("There are no modified files."), true);
|
showOutput(tr("There are no modified files."), true);
|
||||||
return;
|
return;
|
||||||
@@ -717,22 +740,7 @@ void SubversionPlugin::startCommit(const QStringList &files)
|
|||||||
m_changeTmpFile->seek(0);
|
m_changeTmpFile->seek(0);
|
||||||
// Create a submit editor and set file list
|
// Create a submit editor and set file list
|
||||||
SubversionSubmitEditor *editor = openSubversionSubmitEditor(m_changeTmpFile->fileName());
|
SubversionSubmitEditor *editor = openSubversionSubmitEditor(m_changeTmpFile->fileName());
|
||||||
editor->setFileList(statusOutput);
|
editor->setStatusList(statusOutput);
|
||||||
}
|
|
||||||
|
|
||||||
// Parse "status" output for added/modified/deleted files
|
|
||||||
QStringList SubversionPlugin::parseStatusOutput(const QString &output) const
|
|
||||||
{
|
|
||||||
QStringList changeSet;
|
|
||||||
const QString newLine = QString(QLatin1Char('\n'));
|
|
||||||
const QStringList list = output.split(newLine, QString::SkipEmptyParts);
|
|
||||||
foreach (const QString &l, list) {
|
|
||||||
QString line(l.trimmed());
|
|
||||||
if (line.startsWith(QLatin1Char('A')) || line.startsWith(QLatin1Char('D'))
|
|
||||||
|| line.startsWith(QLatin1Char('M')))
|
|
||||||
changeSet.append(line);
|
|
||||||
}
|
|
||||||
return changeSet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SubversionPlugin::commit(const QString &messageFile,
|
bool SubversionPlugin::commit(const QString &messageFile,
|
||||||
|
|||||||
@@ -133,7 +133,6 @@ private:
|
|||||||
SubversionResponse runSvn(const QStringList &arguments, int timeOut,
|
SubversionResponse runSvn(const QStringList &arguments, int timeOut,
|
||||||
bool showStdOutInOutputWindow, QTextCodec *outputCodec = 0);
|
bool showStdOutInOutputWindow, QTextCodec *outputCodec = 0);
|
||||||
void showOutput(const QString &output, bool bringToForeground = true);
|
void showOutput(const QString &output, bool bringToForeground = true);
|
||||||
QStringList parseStatusOutput(const QString &output) const;
|
|
||||||
void annotate(const QString &file);
|
void annotate(const QString &file);
|
||||||
void filelog(const QString &file);
|
void filelog(const QString &file);
|
||||||
bool managesDirectory(const QDir &directory) const;
|
bool managesDirectory(const QDir &directory) const;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "subversionsubmiteditor.h"
|
#include "subversionsubmiteditor.h"
|
||||||
|
|
||||||
#include <utils/submiteditorwidget.h>
|
#include <utils/submiteditorwidget.h>
|
||||||
|
#include <vcsbase/submitfilemodel.h>
|
||||||
|
|
||||||
using namespace Subversion::Internal;
|
using namespace Subversion::Internal;
|
||||||
|
|
||||||
@@ -45,6 +46,19 @@ SubversionSubmitEditor::SubversionSubmitEditor(const VCSBase::VCSBaseSubmitEdito
|
|||||||
setDisplayName(tr("Subversion Submit"));
|
setDisplayName(tr("Subversion Submit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SubversionSubmitEditor::setStatusList(const QList<StatusFilePair> &statusOutput)
|
||||||
|
{
|
||||||
|
typedef QList<StatusFilePair>::const_iterator ConstIterator;
|
||||||
|
VCSBase::SubmitFileModel *model = new VCSBase::SubmitFileModel(this);
|
||||||
|
|
||||||
|
const ConstIterator cend = statusOutput.constEnd();
|
||||||
|
for (ConstIterator it = statusOutput.constBegin(); it != cend; ++it)
|
||||||
|
model->addFile(it->second, it->first, true);
|
||||||
|
setFileModel(model);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
QStringList SubversionSubmitEditor::vcsFileListToFileList(const QStringList &rl) const
|
QStringList SubversionSubmitEditor::vcsFileListToFileList(const QStringList &rl) const
|
||||||
{
|
{
|
||||||
QStringList files;
|
QStringList files;
|
||||||
@@ -59,3 +73,5 @@ QString SubversionSubmitEditor::fileFromStatusLine(const QString &statusLine)
|
|||||||
enum { filePos = 7 };
|
enum { filePos = 7 };
|
||||||
return statusLine.mid(filePos, statusLine.size() - filePos);
|
return statusLine.mid(filePos, statusLine.size() - filePos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|||||||
@@ -34,6 +34,9 @@
|
|||||||
#ifndef SUBVERSIONSUBMITEDITOR_H
|
#ifndef SUBVERSIONSUBMITEDITOR_H
|
||||||
#define SUBVERSIONSUBMITEDITOR_H
|
#define SUBVERSIONSUBMITEDITOR_H
|
||||||
|
|
||||||
|
#include <QtCore/QPair>
|
||||||
|
#include <QtCore/QStringList>
|
||||||
|
|
||||||
#include <vcsbase/vcsbasesubmiteditor.h>
|
#include <vcsbase/vcsbasesubmiteditor.h>
|
||||||
|
|
||||||
namespace Subversion {
|
namespace Subversion {
|
||||||
@@ -48,8 +51,10 @@ public:
|
|||||||
|
|
||||||
static QString fileFromStatusLine(const QString &statusLine);
|
static QString fileFromStatusLine(const QString &statusLine);
|
||||||
|
|
||||||
private:
|
// A list of ( 'A','M','D') status indicators and file names.
|
||||||
virtual QStringList vcsFileListToFileList(const QStringList &) const;
|
typedef QPair<QString, QString> StatusFilePair;
|
||||||
|
|
||||||
|
void setStatusList(const QList<StatusFilePair> &statusOutput);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -86,10 +86,10 @@ TextEditorSettings::TextEditorSettings(Internal::TextEditorPlugin *plugin,
|
|||||||
formatDescriptions.push_back(FormatDescription(QLatin1String(C_DISABLED_CODE), tr("Disabled Code"), Qt::gray));
|
formatDescriptions.push_back(FormatDescription(QLatin1String(C_DISABLED_CODE), tr("Disabled Code"), Qt::gray));
|
||||||
|
|
||||||
// Diff categories
|
// Diff categories
|
||||||
formatDescriptions.push_back(FormatDescription(QLatin1String(C_ADDED_LINE), tr("Added Line"), Qt::blue));
|
formatDescriptions.push_back(FormatDescription(QLatin1String(C_ADDED_LINE), tr("Added Line"), QColor(0, 170, 0)));
|
||||||
formatDescriptions.push_back(FormatDescription(QLatin1String(C_REMOVED_LINE), tr("Removed Line"), Qt::red));
|
formatDescriptions.push_back(FormatDescription(QLatin1String(C_REMOVED_LINE), tr("Removed Line"), Qt::red));
|
||||||
formatDescriptions.push_back(FormatDescription(QLatin1String(C_DIFF_FILE), tr("Diff File"), Qt::black));
|
formatDescriptions.push_back(FormatDescription(QLatin1String(C_DIFF_FILE), tr("Diff File"), Qt::darkBlue));
|
||||||
formatDescriptions.push_back(FormatDescription(QLatin1String(C_DIFF_LOCATION), tr("Diff Location"), Qt::green));
|
formatDescriptions.push_back(FormatDescription(QLatin1String(C_DIFF_LOCATION), tr("Diff Location"), Qt::blue));
|
||||||
|
|
||||||
m_fontSettingsPage = new FontSettingsPage(formatDescriptions,
|
m_fontSettingsPage = new FontSettingsPage(formatDescriptions,
|
||||||
QLatin1String("TextEditor"),
|
QLatin1String("TextEditor"),
|
||||||
|
|||||||
78
src/plugins/vcsbase/submitfilemodel.cpp
Normal file
78
src/plugins/vcsbase/submitfilemodel.cpp
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** Non-Open Source Usage
|
||||||
|
**
|
||||||
|
** Licensees may use this file in accordance with the Qt Beta Version
|
||||||
|
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||||
|
** alternatively, in accordance with the terms contained in a written
|
||||||
|
** agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU General
|
||||||
|
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||||
|
** of this file. Please review the following information to ensure GNU
|
||||||
|
** General Public Licensing requirements will be met:
|
||||||
|
**
|
||||||
|
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||||
|
** http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||||
|
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "submitfilemodel.h"
|
||||||
|
#include "vcsbaseconstants.h"
|
||||||
|
|
||||||
|
#include <QtGui/QStandardItem>
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
|
namespace VCSBase {
|
||||||
|
|
||||||
|
SubmitFileModel::SubmitFileModel(QObject *parent) :
|
||||||
|
QStandardItemModel(0, 2, parent)
|
||||||
|
{
|
||||||
|
// setColumnCount(2);
|
||||||
|
QStringList headerLabels;
|
||||||
|
headerLabels << tr("State") << tr("File");
|
||||||
|
setHorizontalHeaderLabels(headerLabels);
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<QStandardItem *> SubmitFileModel::addFile(const QString &fileName, const QString &status, bool checked)
|
||||||
|
{
|
||||||
|
if (VCSBase::Constants::Internal::debug)
|
||||||
|
qDebug() << Q_FUNC_INFO << fileName << status << checked;
|
||||||
|
QStandardItem *statusItem = new QStandardItem(status);
|
||||||
|
statusItem->setCheckable(true);
|
||||||
|
statusItem->setCheckState(checked ? Qt::Checked : Qt::Unchecked);
|
||||||
|
QStandardItem *fileItem = new QStandardItem(fileName);
|
||||||
|
QList<QStandardItem *> row;
|
||||||
|
row << statusItem << fileItem;
|
||||||
|
appendRow(row);
|
||||||
|
return row;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned SubmitFileModel::filter(const QStringList &filter, int column)
|
||||||
|
{
|
||||||
|
unsigned rc = 0;
|
||||||
|
for (int r = rowCount() - 1; r >= 0; r--)
|
||||||
|
if (const QStandardItem *i = item(r, column))
|
||||||
|
if (!filter.contains(i->text())) {
|
||||||
|
qDeleteAll(takeRow(r));
|
||||||
|
rc++;
|
||||||
|
}
|
||||||
|
if (VCSBase::Constants::Internal::debug)
|
||||||
|
qDebug() << Q_FUNC_INFO << " deleted " << rc << " items using " << filter << " , remaining " << rowCount();
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
62
src/plugins/vcsbase/submitfilemodel.h
Normal file
62
src/plugins/vcsbase/submitfilemodel.h
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
**
|
||||||
|
** This file is part of Qt Creator
|
||||||
|
**
|
||||||
|
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||||
|
**
|
||||||
|
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** Non-Open Source Usage
|
||||||
|
**
|
||||||
|
** Licensees may use this file in accordance with the Qt Beta Version
|
||||||
|
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||||
|
** alternatively, in accordance with the terms contained in a written
|
||||||
|
** agreement between you and Nokia.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
**
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU General
|
||||||
|
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||||
|
** of this file. Please review the following information to ensure GNU
|
||||||
|
** General Public Licensing requirements will be met:
|
||||||
|
**
|
||||||
|
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||||
|
** http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
** In addition, as a special exception, Nokia gives you certain additional
|
||||||
|
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||||
|
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef SUBMITMODEL_H
|
||||||
|
#define SUBMITMODEL_H
|
||||||
|
|
||||||
|
#include "vcsbase_global.h"
|
||||||
|
|
||||||
|
#include <QtGui/QStandardItemModel>
|
||||||
|
|
||||||
|
namespace VCSBase {
|
||||||
|
|
||||||
|
/* A 2-column (checkable, state, file name) model to be used to list the files-
|
||||||
|
* in the submit editor. Provides header items and a convience to add files. */
|
||||||
|
|
||||||
|
class VCSBASE_EXPORT SubmitFileModel : public QStandardItemModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit SubmitFileModel(QObject *parent = 0);
|
||||||
|
|
||||||
|
// Convenience to add a file plus status text.
|
||||||
|
QList<QStandardItem *> addFile(const QString &fileName, const QString &status = QString(), bool checked = true);
|
||||||
|
|
||||||
|
// Filter for entries contained in the filter list. Returns the
|
||||||
|
// number of deleted entries.
|
||||||
|
unsigned filter(const QStringList &filter, int column);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // SUBMITMODEL_H
|
||||||
@@ -1,31 +1,28 @@
|
|||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
TARGET = VCSBase
|
TARGET = VCSBase
|
||||||
|
|
||||||
DEFINES += VCSBASE_LIBRARY
|
DEFINES += VCSBASE_LIBRARY
|
||||||
|
|
||||||
include(../../qworkbenchplugin.pri)
|
include(../../qworkbenchplugin.pri)
|
||||||
include(vcsbase_dependencies.pri)
|
include(vcsbase_dependencies.pri)
|
||||||
|
|
||||||
HEADERS += vcsbase_global.h \
|
HEADERS += vcsbase_global.h \
|
||||||
vcsbaseconstants.h \
|
vcsbaseconstants.h \
|
||||||
vcsbaseplugin.h \
|
vcsbaseplugin.h \
|
||||||
baseannotationhighlighter.h \
|
baseannotationhighlighter.h \
|
||||||
diffhighlighter.h \
|
diffhighlighter.h \
|
||||||
vcsbasetextdocument.h \
|
vcsbasetextdocument.h \
|
||||||
vcsbaseeditor.h \
|
vcsbaseeditor.h \
|
||||||
vcsbasesubmiteditor.h \
|
vcsbasesubmiteditor.h \
|
||||||
basevcseditorfactory.h \
|
basevcseditorfactory.h \
|
||||||
submiteditorfile.h \
|
submiteditorfile.h \
|
||||||
basevcssubmiteditorfactory.h
|
basevcssubmiteditorfactory.h \
|
||||||
|
submitfilemodel.h
|
||||||
SOURCES += vcsbaseplugin.cpp \
|
SOURCES += vcsbaseplugin.cpp \
|
||||||
baseannotationhighlighter.cpp \
|
baseannotationhighlighter.cpp \
|
||||||
diffhighlighter.cpp \
|
diffhighlighter.cpp \
|
||||||
vcsbasetextdocument.cpp \
|
vcsbasetextdocument.cpp \
|
||||||
vcsbaseeditor.cpp \
|
vcsbaseeditor.cpp \
|
||||||
vcsbasesubmiteditor.cpp \
|
vcsbasesubmiteditor.cpp \
|
||||||
basevcseditorfactory.cpp \
|
basevcseditorfactory.cpp \
|
||||||
submiteditorfile.cpp \
|
submiteditorfile.cpp \
|
||||||
basevcssubmiteditorfactory.cpp
|
basevcssubmiteditorfactory.cpp \
|
||||||
|
submitfilemodel.cpp
|
||||||
RESOURCES=vcsbase.qrc
|
RESOURCES = vcsbase.qrc
|
||||||
|
|||||||
@@ -129,6 +129,16 @@ VCSBaseSubmitEditor::~VCSBaseSubmitEditor()
|
|||||||
delete m_d;
|
delete m_d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int VCSBaseSubmitEditor::fileNameColumn() const
|
||||||
|
{
|
||||||
|
return m_d->m_widget->fileNameColumn();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VCSBaseSubmitEditor::setFileNameColumn(int c)
|
||||||
|
{
|
||||||
|
m_d->m_widget->setFileNameColumn(c);
|
||||||
|
}
|
||||||
|
|
||||||
void VCSBaseSubmitEditor::slotDescriptionChanged()
|
void VCSBaseSubmitEditor::slotDescriptionChanged()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -246,22 +256,22 @@ bool VCSBaseSubmitEditor::restoreState(const QByteArray &/*state*/)
|
|||||||
|
|
||||||
QStringList VCSBaseSubmitEditor::checkedFiles() const
|
QStringList VCSBaseSubmitEditor::checkedFiles() const
|
||||||
{
|
{
|
||||||
return vcsFileListToFileList(m_d->m_widget->checkedFiles());
|
return m_d->m_widget->checkedFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VCSBaseSubmitEditor::setFileList(const QStringList &l)
|
void VCSBaseSubmitEditor::setFileModel(QAbstractItemModel *m)
|
||||||
{
|
{
|
||||||
m_d->m_widget->setFileList(l);
|
m_d->m_widget->setFileModel(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VCSBaseSubmitEditor::addFiles(const QStringList& list, bool checked, bool userCheckable)
|
QAbstractItemModel *VCSBaseSubmitEditor::fileModel() const
|
||||||
{
|
{
|
||||||
m_d->m_widget->addFiles(list, checked, userCheckable);
|
return m_d->m_widget->fileModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VCSBaseSubmitEditor::slotDiffSelectedVCSFiles(const QStringList &rawList)
|
void VCSBaseSubmitEditor::slotDiffSelectedVCSFiles(const QStringList &rawList)
|
||||||
{
|
{
|
||||||
emit diffSelectedFiles(vcsFileListToFileList(rawList));
|
emit diffSelectedFiles(rawList);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VCSBaseSubmitEditor::save(const QString &fileName)
|
bool VCSBaseSubmitEditor::save(const QString &fileName)
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QIcon;
|
class QIcon;
|
||||||
|
class QAbstractItemModel;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
@@ -90,6 +91,7 @@ struct VCSBASE_EXPORT VCSBaseSubmitEditorParameters {
|
|||||||
class VCSBASE_EXPORT VCSBaseSubmitEditor : public Core::IEditor
|
class VCSBASE_EXPORT VCSBaseSubmitEditor : public Core::IEditor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(int fileNameColumn READ fileNameColumn WRITE setFileNameColumn DESIGNABLE false)
|
||||||
public:
|
public:
|
||||||
typedef QList<int> Context;
|
typedef QList<int> Context;
|
||||||
|
|
||||||
@@ -100,6 +102,9 @@ protected:
|
|||||||
public:
|
public:
|
||||||
virtual ~VCSBaseSubmitEditor();
|
virtual ~VCSBaseSubmitEditor();
|
||||||
|
|
||||||
|
int fileNameColumn() const;
|
||||||
|
void setFileNameColumn(int c);
|
||||||
|
|
||||||
// Core::IEditor
|
// Core::IEditor
|
||||||
virtual bool createNew(const QString &contents);
|
virtual bool createNew(const QString &contents);
|
||||||
virtual bool open(const QString &fileName);
|
virtual bool open(const QString &fileName);
|
||||||
@@ -119,8 +124,8 @@ public:
|
|||||||
|
|
||||||
QStringList checkedFiles() const;
|
QStringList checkedFiles() const;
|
||||||
|
|
||||||
void setFileList(const QStringList&);
|
void setFileModel(QAbstractItemModel *m);
|
||||||
void addFiles(const QStringList&, bool checked = true, bool userCheckable = true);
|
QAbstractItemModel *fileModel() const;
|
||||||
|
|
||||||
// Utilities returning some predefined icons for actions
|
// Utilities returning some predefined icons for actions
|
||||||
static QIcon diffIcon();
|
static QIcon diffIcon();
|
||||||
@@ -139,11 +144,6 @@ private slots:
|
|||||||
void slotDescriptionChanged();
|
void slotDescriptionChanged();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* Implemented this to extract the real file list from the status
|
|
||||||
* output of the versioning system as displayed in the file list
|
|
||||||
* for example "M foo.cpp" -> "foo.cpp". */
|
|
||||||
virtual QStringList vcsFileListToFileList(const QStringList &) const = 0;
|
|
||||||
|
|
||||||
/* These hooks allow for modifying the contents that goes to
|
/* These hooks allow for modifying the contents that goes to
|
||||||
* the file. The default implementation uses the text
|
* the file. The default implementation uses the text
|
||||||
* of the description editor. */
|
* of the description editor. */
|
||||||
|
|||||||
@@ -20,11 +20,15 @@ public:
|
|||||||
{
|
{
|
||||||
StringLiteral *fileId = control.findOrInsertFileName("<stdin>");
|
StringLiteral *fileId = control.findOrInsertFileName("<stdin>");
|
||||||
TranslationUnit *unit = new TranslationUnit(&control, fileId);
|
TranslationUnit *unit = new TranslationUnit(&control, fileId);
|
||||||
|
unit->setObjCEnabled(true);
|
||||||
unit->setSource(source.constData(), source.length());
|
unit->setSource(source.constData(), source.length());
|
||||||
unit->parse(mode);
|
unit->parse(mode);
|
||||||
return unit;
|
return unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TranslationUnit *parseDeclaration(const QByteArray &source)
|
||||||
|
{ return parse(source, TranslationUnit::ParseDeclaration); }
|
||||||
|
|
||||||
TranslationUnit *parseExpression(const QByteArray &source)
|
TranslationUnit *parseExpression(const QByteArray &source)
|
||||||
{ return parse(source, TranslationUnit::ParseExpression); }
|
{ return parse(source, TranslationUnit::ParseExpression); }
|
||||||
|
|
||||||
@@ -43,6 +47,11 @@ private slots:
|
|||||||
void while_condition_statement();
|
void while_condition_statement();
|
||||||
void for_statement();
|
void for_statement();
|
||||||
void cpp_initializer_or_function_declaration();
|
void cpp_initializer_or_function_declaration();
|
||||||
|
|
||||||
|
// objc++
|
||||||
|
void objc_attributes_followed_by_at_keyword();
|
||||||
|
void objc_protocol_forward_declaration_1();
|
||||||
|
void objc_protocol_definition_1();
|
||||||
};
|
};
|
||||||
|
|
||||||
void tst_AST::simple_name()
|
void tst_AST::simple_name()
|
||||||
@@ -293,6 +302,31 @@ void tst_AST::cpp_initializer_or_function_declaration()
|
|||||||
QCOMPARE(param->type_specifier->asNamedTypeSpecifier()->name->asSimpleName()->identifier_token, 4U);
|
QCOMPARE(param->type_specifier->asNamedTypeSpecifier()->name->asSimpleName()->identifier_token, 4U);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_AST::objc_attributes_followed_by_at_keyword()
|
||||||
|
{
|
||||||
|
QSharedPointer<TranslationUnit> unit(parseDeclaration("\n"
|
||||||
|
"__attribute__((deprecated)) @interface foo <bar>\n"
|
||||||
|
"{\n"
|
||||||
|
" int a, b;\n"
|
||||||
|
"}\n"
|
||||||
|
"+ (id) init;\n"
|
||||||
|
"- (id) init:(int)a foo:(int)b, c;\n"
|
||||||
|
"@end\n"
|
||||||
|
));
|
||||||
|
AST *ast = unit->ast();
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_AST::objc_protocol_forward_declaration_1()
|
||||||
|
{
|
||||||
|
QSharedPointer<TranslationUnit> unit(parseDeclaration("\n@protocol foo;"));
|
||||||
|
AST *ast = unit->ast();
|
||||||
|
}
|
||||||
|
|
||||||
|
void tst_AST::objc_protocol_definition_1()
|
||||||
|
{
|
||||||
|
QSharedPointer<TranslationUnit> unit(parseDeclaration("\n@protocol foo <ciao, bar> @end"));
|
||||||
|
AST *ast = unit->ast();
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_APPLESS_MAIN(tst_AST)
|
QTEST_APPLESS_MAIN(tst_AST)
|
||||||
#include "tst_ast.moc"
|
#include "tst_ast.moc"
|
||||||
|
|||||||
@@ -248,6 +248,7 @@ int main(int argc, char *argv[])
|
|||||||
Control control;
|
Control control;
|
||||||
StringLiteral *fileId = control.findOrInsertFileName("<stdin>");
|
StringLiteral *fileId = control.findOrInsertFileName("<stdin>");
|
||||||
TranslationUnit unit(&control, fileId);
|
TranslationUnit unit(&control, fileId);
|
||||||
|
unit.setObjCEnabled(true);
|
||||||
unit.setSource(source.constData(), source.size());
|
unit.setSource(source.constData(), source.size());
|
||||||
unit.parse();
|
unit.parse();
|
||||||
if (! unit.ast())
|
if (! unit.ast())
|
||||||
|
|||||||
Reference in New Issue
Block a user