forked from qt-creator/qt-creator
Merge branch 'master' of scm.dev.nokia.troll.no:creator/mainline
Conflicts: src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp
This commit is contained in:
@@ -843,7 +843,7 @@ DOCSET_FEEDNAME = "Qt Creator API"
|
||||
# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
|
||||
# will append .docset to the name.
|
||||
|
||||
DOCSET_BUNDLE_ID = com.qtsoftware.qt-creator
|
||||
DOCSET_BUNDLE_ID = com.nokia.qt-creator
|
||||
|
||||
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
|
||||
# will be generated that can be used as input for tools like the
|
||||
|
@@ -1,138 +0,0 @@
|
||||
diff --git a/doc/addressbook-sdk.qdoc b/doc/addressbook-sdk.qdoc
|
||||
index 0441666..7012ea6 100644
|
||||
--- a/doc/addressbook-sdk.qdoc
|
||||
+++ b/doc/addressbook-sdk.qdoc
|
||||
@@ -139,7 +139,7 @@
|
||||
\section1 Placing Widgets on The Form
|
||||
|
||||
In the \gui{Project Sidebar}, double-click on the \c{addressbook.ui} file.
|
||||
- The \QD plugin will be launched, allowing you to design your program's user
|
||||
+ The \QD form editor will be launched, allowing you to design your program's user
|
||||
interface.
|
||||
|
||||
We require two \l{QLabel}s to label the input fields as well as a QLineEdit
|
||||
@@ -156,6 +156,7 @@
|
||||
diagram below shows the layout cells and the position of our widgets. Place
|
||||
your widgets accordingly and save the form by choosing
|
||||
\gui{File | Save} or using the \key{Ctrl+S} shortcut.
|
||||
+ (We have to actually layout the widgets in a grid layout, this step seems to be missing to me?)
|
||||
|
||||
\image addressbook-tutorial-part1-labeled-screenshot.png
|
||||
|
||||
@@ -311,7 +312,7 @@
|
||||
\snippet examples/addressbook-sdk/part2/addressbook.h slot definition
|
||||
|
||||
Since the \c AddressBook class is a subclass of QWidget, Qt Creator
|
||||
- includes QWidget in the hedaer file.
|
||||
+ includes QWidget in the header file.
|
||||
|
||||
\snippet examples/addressbook-sdk/part2/addressbook.h include
|
||||
|
||||
@@ -323,7 +324,7 @@
|
||||
\snippet examples/addressbook-sdk/part2/addressbook.h members
|
||||
|
||||
We also declare two private QString objects, \c oldName and \c oldAddress.
|
||||
- These objects are needed to hold the name and address of hte contact that
|
||||
+ These objects are needed to hold the name and address of the contact that
|
||||
was last displayed, before the user clicked \gui Add. So, when the user
|
||||
clicks \gui Cancel, we can revert to displaying the details of the last
|
||||
contact.
|
||||
@@ -499,7 +500,7 @@
|
||||
|
||||
\snippet examples/addressbook-sdk/part3/addressbook.cpp enable navigation
|
||||
|
||||
- We also include these lins of code in the \c cancel() function.
|
||||
+ We also include these lines of code in the \c cancel() function.
|
||||
|
||||
Recall that we intend to emulate a circularly-linked list with our QMap
|
||||
object, \c contacts. So in the \c next() function, we obtain an iterator
|
||||
@@ -722,11 +723,12 @@
|
||||
|
||||
#image
|
||||
|
||||
- We begin by adding a new \c{.ui} file to our project. Right click on your
|
||||
+ We begin by adding a new \c{.ui} file and a corresponding class to our project. Right click on your
|
||||
project and select \gui{Add New...}. In the \gui{New File} dialog, select
|
||||
- \gui{Qt Designer Form}. In the \gui{Qt Designer Form} dialog, select
|
||||
- \e{Dialog without buttons}. Name it \c{finddialog.ui} and add it to your
|
||||
- project. The \QD plugin within Qt Creator will now display your new form.
|
||||
+ \gui{Qt Designer Form Class}. In the \gui{Qt Designer Form Class} dialog, select
|
||||
+ \e{Dialog without buttons}. Name the class \c{FindDialog} and add the files it to your
|
||||
+ project. Open your new form in the \QD form editor within Qt Creator by
|
||||
+ double-clicking on the \c{finddialog.ui} file in the \gui{Project Sidebar}.
|
||||
|
||||
To replicate the screenshot above, we need a label, a line edit, and a push
|
||||
button. Drag these onto your form. Set their text accordingly and name them
|
||||
@@ -759,6 +761,9 @@
|
||||
\c findContact() function know when the \c FindDialog object has been
|
||||
closed. We will explain this logic in further detail when discussing the
|
||||
\c findContact() function.
|
||||
+ (The above paragraph is not up to date, since clicked() is not connected
|
||||
+ to accept(). The description of accept() can move below to the implementation
|
||||
+ of findClicked().)
|
||||
|
||||
\image addressbook-tutorial-part5-signals-and-slots.png
|
||||
|
||||
@@ -766,17 +771,17 @@
|
||||
\gui Find button without entering a contact's name. Then, we set
|
||||
\c findText to the search string, extracted from \c lineEdit. After that,
|
||||
we clear the contents of \c lineEdit and hide the dialog.
|
||||
+ (There is no findText member. The description of accept() should move here, together
|
||||
+ with words about reject.)
|
||||
|
||||
\snippet examples/addressbook-sdk/part5/finddialog.cpp findClicked
|
||||
|
||||
- The \c findText variable has a public getter function, \c getFindText(),
|
||||
- associated with it. Since we only ever set \c findText directly in both
|
||||
- the constructor and in hte \c findClicked() function, we do not create a
|
||||
- setter function to accompany \c getFindText(). Because \c getFindText() is
|
||||
+ The \c text of the find dialog's line edit has a public getter function, \c findText(),
|
||||
+ associated with it. Because \c findText() is
|
||||
public, classes instantiating and using \c FindDialog can always access the
|
||||
search string that the user has entered and accepted.
|
||||
|
||||
- \snippet examples/addressbook-sdk/part5/finddialog.cpp getFindText
|
||||
+ \snippet examples/addressbook-sdk/part5/finddialog.cpp findText
|
||||
|
||||
|
||||
\section1 The AddressBook Class
|
||||
@@ -788,23 +793,9 @@
|
||||
|
||||
So far, all our address book features have a QPushButton and a
|
||||
corresponding slot. Similarly, for the \gui Find feature, we have
|
||||
- \c findButton and \c findContact().
|
||||
+ \c {ui->findButton} and \c findContact().
|
||||
|
||||
\snippet examples/addressbook-sdk/part5/addressbook.h slot definition
|
||||
- \dots
|
||||
- \snippet examples/addressbook-sdk/part5/addressbook.h private members
|
||||
-
|
||||
- Lastly, we declare the private variable, \c dialog, which we will use to
|
||||
- refer to an instance of \c FindDialog.
|
||||
-
|
||||
- Once we have instantiated a dialog, we might want to use it more than once;
|
||||
- using a private variable allows us to refer to it from more than one place
|
||||
- in the class.
|
||||
-
|
||||
- Within the \c AddressBook class's constructor, we insantiate our private
|
||||
- objects, \c findButton and \c dialog:
|
||||
-
|
||||
- \snippet examples/addressbook-sdk/part5/addressbook.cpp private members
|
||||
|
||||
Next, we connect the \c{findButton}'s \l{QPushButton::}{clicked()} signal
|
||||
to \c findContact().
|
||||
@@ -818,10 +809,12 @@
|
||||
We start out by displaying the \c FindDialog instance, \c dialog. This is
|
||||
when the user enters a contact name to look up. Once the user clicks the
|
||||
dialog's \c findButton, the dialog is hidden and the result code is set to
|
||||
- QDialog::Accepted. THis ensures that our \c if statement is always true.
|
||||
+ either QDialog::Accepted or QDialog::Rejected by the FindDialog's
|
||||
+ \c findClicked() method. This ensures that we only search for a contact
|
||||
+ if the user typed something in the FindDialog's line edit.
|
||||
|
||||
We then proceed to extract the search string, which in this case is
|
||||
- \c contactName, using \c{FindDialog}'s \c getFindText() function. If the
|
||||
+ \c contactName, using \c{FindDialog}'s \c findText() function. If the
|
||||
contact exists in our address book, we display it immediately. Otherwise,
|
||||
we display the QMessageBox shown below to indicate that their search
|
||||
failed.
|
@@ -35,6 +35,8 @@
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtGui/QAction>
|
||||
|
||||
#include <string>
|
||||
@@ -51,6 +53,7 @@ bool optTestUninitialized = false;
|
||||
bool optTestAll = false;
|
||||
bool optEmptyContainers = false;
|
||||
unsigned optVerbose = 0;
|
||||
const char *appPath = 0;
|
||||
|
||||
// Provide address of type of be tested.
|
||||
// When testing unitialized memory, allocate at random.
|
||||
@@ -482,7 +485,6 @@ static int dumpStdMapStringString()
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int dumpQObject()
|
||||
{
|
||||
// Requires the childOffset to be know, but that is not critical
|
||||
@@ -517,6 +519,16 @@ static int dumpQObject()
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpQFileInfo()
|
||||
{
|
||||
QFileInfo test(QString::fromLatin1(appPath));
|
||||
prepareInBuffer("QFileInfo", "local.qfileinfo", "local.qfileinfo","");
|
||||
qDumpObjectData440(2, 42, testAddress(&test), 1, 0, 0, 0, 0);
|
||||
fputs(qDumpOutBuffer, stdout);
|
||||
fputc('\n', stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dumpQObjectList()
|
||||
{
|
||||
// Requires the childOffset to be know, but that is not critical
|
||||
@@ -566,6 +578,7 @@ static TypeDumpFunctionMap registerTypes()
|
||||
rc.insert("set<QString>", dumpStdQStringSet);
|
||||
rc.insert("map<int,string>", dumpStdMapIntString);
|
||||
rc.insert("map<string,string>", dumpStdMapStringString);
|
||||
rc.insert("QFileInfo", dumpQFileInfo);
|
||||
rc.insert("QObject", dumpQObject);
|
||||
rc.insert("QObjectList", dumpQObjectList);
|
||||
rc.insert("QVariant", dumpQVariant);
|
||||
@@ -592,6 +605,7 @@ static void usage(const char *b, const TypeDumpFunctionMap &tdm)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
appPath = argv[0];
|
||||
printf("\nQt Creator Debugging Helper testing tool\n\n");
|
||||
printf("Running query protocol\n");
|
||||
qDumpObjectData440(1, 42, 0, 1, 0, 0, 0, 0);
|
||||
|
@@ -65,7 +65,7 @@ void CheckUndefinedSymbols::operator()(AST *ast)
|
||||
QByteArray CheckUndefinedSymbols::templateParameterName(NameAST *ast) const
|
||||
{
|
||||
if (ast && ast->name) {
|
||||
if (Identifier *id = ast->name->identifier())
|
||||
if (const Identifier *id = ast->name->identifier())
|
||||
return QByteArray::fromRawData(id->chars(), id->size());
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ bool CheckUndefinedSymbols::isType(const QByteArray &name) const
|
||||
Symbol *member = members->symbolAt(m);
|
||||
|
||||
if (member->isTypedef() && member->isDeclaration()) {
|
||||
if (Identifier *id = member->identifier()) {
|
||||
if (const Identifier *id = member->identifier()) {
|
||||
if (name == id->chars())
|
||||
return true;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ bool CheckUndefinedSymbols::isType(const QByteArray &name) const
|
||||
return _types.contains(name);
|
||||
}
|
||||
|
||||
bool CheckUndefinedSymbols::isType(Identifier *id) const
|
||||
bool CheckUndefinedSymbols::isType(const Identifier *id) const
|
||||
{
|
||||
if (! id)
|
||||
return false;
|
||||
@@ -122,21 +122,21 @@ bool CheckUndefinedSymbols::isType(Identifier *id) const
|
||||
return isType(QByteArray::fromRawData(id->chars(), id->size()));
|
||||
}
|
||||
|
||||
void CheckUndefinedSymbols::addType(Name *name)
|
||||
void CheckUndefinedSymbols::addType(const Name *name)
|
||||
{
|
||||
if (! name)
|
||||
return;
|
||||
|
||||
if (Identifier *id = name->identifier())
|
||||
if (const Identifier *id = name->identifier())
|
||||
_types.insert(QByteArray(id->chars(), id->size()));
|
||||
}
|
||||
|
||||
void CheckUndefinedSymbols::addProtocol(Name *name)
|
||||
void CheckUndefinedSymbols::addProtocol(const Name *name)
|
||||
{
|
||||
if (!name)
|
||||
return;
|
||||
|
||||
if (Identifier *id = name->identifier())
|
||||
if (const Identifier *id = name->identifier())
|
||||
_protocols.insert(QByteArray(id->chars(), id->size()));
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ void CheckUndefinedSymbols::buildTypeMap(NamespaceBinding *binding, QSet<Namespa
|
||||
if (! processed->contains(binding)) {
|
||||
processed->insert(binding);
|
||||
|
||||
if (Identifier *id = binding->identifier()) {
|
||||
if (const Identifier *id = binding->identifier()) {
|
||||
_namespaceNames.insert(QByteArray(id->chars(), id->size()));
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ bool CheckUndefinedSymbols::visit(NamedTypeSpecifierAST *ast)
|
||||
unsigned line, col;
|
||||
getTokenStartPosition(ast->firstToken(), &line, &col);
|
||||
// qWarning() << _doc->fileName() << line << col;
|
||||
} else if (Identifier *id = ast->name->name->identifier()) {
|
||||
} else if (const Identifier *id = ast->name->name->identifier()) {
|
||||
if (! isType(id)) {
|
||||
if (FunctionDeclaratorAST *functionDeclarator = currentFunctionDeclarator()) {
|
||||
if (functionDeclarator->as_cpp_initializer)
|
||||
@@ -294,7 +294,7 @@ bool CheckUndefinedSymbols::visit(ClassSpecifierAST *ast)
|
||||
Symbol *symbol = klass->memberAt(i);
|
||||
|
||||
if (symbol->name() && symbol->name()->isNameId()) {
|
||||
NameId *nameId = symbol->name()->asNameId();
|
||||
const NameId *nameId = symbol->name()->asNameId();
|
||||
|
||||
if (! qstrcmp(nameId->identifier()->chars(), "qt_check_for_QOBJECT_macro")) {
|
||||
hasQ_OBJECT_CHECK = true;
|
||||
@@ -367,8 +367,8 @@ bool CheckUndefinedSymbols::visit(BaseSpecifierAST *base)
|
||||
if (NameAST *nameAST = base->name) {
|
||||
bool resolvedBaseClassName = false;
|
||||
|
||||
if (Name *name = nameAST->name) {
|
||||
Identifier *id = name->identifier();
|
||||
if (const Name *name = nameAST->name) {
|
||||
const Identifier *id = name->identifier();
|
||||
const QByteArray spell = QByteArray::fromRawData(id->chars(), id->size());
|
||||
if (isType(spell))
|
||||
resolvedBaseClassName = true;
|
||||
@@ -403,10 +403,10 @@ bool CheckUndefinedSymbols::visit(UsingDirectiveAST *ast)
|
||||
bool CheckUndefinedSymbols::visit(QualifiedNameAST *ast)
|
||||
{
|
||||
if (ast->name) {
|
||||
QualifiedNameId *q = ast->name->asQualifiedNameId();
|
||||
const QualifiedNameId *q = ast->name->asQualifiedNameId();
|
||||
for (unsigned i = 0; i < q->nameCount() - 1; ++i) {
|
||||
Name *name = q->nameAt(i);
|
||||
if (Identifier *id = name->identifier()) {
|
||||
const Name *name = q->nameAt(i);
|
||||
if (const Identifier *id = name->identifier()) {
|
||||
const QByteArray spell = QByteArray::fromRawData(id->chars(), id->size());
|
||||
if (! (_namespaceNames.contains(spell) || isType(id))) {
|
||||
translationUnit()->warning(ast->firstToken(),
|
||||
@@ -474,8 +474,8 @@ bool CheckUndefinedSymbols::visit(ObjCClassDeclarationAST *ast)
|
||||
if (NameAST *nameAST = ast->superclass) {
|
||||
bool resolvedSuperClassName = false;
|
||||
|
||||
if (Name *name = nameAST->name) {
|
||||
Identifier *id = name->identifier();
|
||||
if (const Name *name = nameAST->name) {
|
||||
const Identifier *id = name->identifier();
|
||||
const QByteArray spell = QByteArray::fromRawData(id->chars(), id->size());
|
||||
if (isType(spell))
|
||||
resolvedSuperClassName = true;
|
||||
@@ -496,8 +496,8 @@ bool CheckUndefinedSymbols::visit(ObjCProtocolRefsAST *ast)
|
||||
if (NameAST *nameAST = iter->value) {
|
||||
bool resolvedProtocolName = false;
|
||||
|
||||
if (Name *name = nameAST->name) {
|
||||
Identifier *id = name->identifier();
|
||||
if (const Name *name = nameAST->name) {
|
||||
const Identifier *id = name->identifier();
|
||||
const QByteArray spell = QByteArray::fromRawData(id->chars(), id->size());
|
||||
if (isProtocol(spell))
|
||||
resolvedProtocolName = true;
|
||||
@@ -522,11 +522,11 @@ bool CheckUndefinedSymbols::visit(ObjCProtocolRefsAST *ast)
|
||||
bool CheckUndefinedSymbols::visit(ObjCPropertyDeclarationAST *ast)
|
||||
{
|
||||
for (List<ObjCPropertyDeclaration *> *iter = ast->symbols; iter; iter = iter->next) {
|
||||
if (Name *getterName = iter->value->getterName()) {
|
||||
if (/*Name *getterName = */ iter->value->getterName()) {
|
||||
// FIXME: resolve the symbol for the name, and check its signature.
|
||||
}
|
||||
|
||||
if (Name *setterName = iter->value->setterName()) {
|
||||
if (/*Name *setterName = */ iter->value->setterName()) {
|
||||
// FIXME: resolve the symbol for the name, and check its signature.
|
||||
}
|
||||
}
|
||||
|
@@ -52,14 +52,14 @@ public:
|
||||
protected:
|
||||
using ASTVisitor::visit;
|
||||
|
||||
bool isType(Identifier *id) const;
|
||||
bool isType(const Identifier *id) const;
|
||||
bool isType(const QByteArray &name) const;
|
||||
|
||||
void addType(Name *name);
|
||||
void addType(const Name *name);
|
||||
void buildTypeMap(Class *klass);
|
||||
void buildMemberTypeMap(Symbol *member);
|
||||
void buildTypeMap(NamespaceBinding *binding, QSet<NamespaceBinding *> *processed);
|
||||
void addProtocol(Name *name);
|
||||
void addProtocol(const Name *name);
|
||||
bool isProtocol(const QByteArray &name) const;
|
||||
|
||||
FunctionDeclaratorAST *currentFunctionDeclarator() const;
|
||||
|
@@ -57,7 +57,7 @@ Location::Location(Symbol *symbol)
|
||||
_sourceLocation(symbol->sourceLocation())
|
||||
{ }
|
||||
|
||||
Location::Location(StringLiteral *fileId, unsigned sourceLocation)
|
||||
Location::Location(const StringLiteral *fileId, unsigned sourceLocation)
|
||||
: _fileId(fileId), _sourceLocation(sourceLocation)
|
||||
{ }
|
||||
|
||||
@@ -79,11 +79,11 @@ NamespaceBinding::~NamespaceBinding()
|
||||
qDeleteAll(classBindings);
|
||||
}
|
||||
|
||||
NameId *NamespaceBinding::name() const
|
||||
const NameId *NamespaceBinding::name() const
|
||||
{
|
||||
if (symbols.size()) {
|
||||
if (Name *name = symbols.first()->name()) {
|
||||
NameId *nameId = name->asNameId();
|
||||
if (const Name *name = symbols.first()->name()) {
|
||||
const NameId *nameId = name->asNameId();
|
||||
Q_ASSERT(nameId != 0);
|
||||
|
||||
return nameId;
|
||||
@@ -93,9 +93,9 @@ NameId *NamespaceBinding::name() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
Identifier *NamespaceBinding::identifier() const
|
||||
const Identifier *NamespaceBinding::identifier() const
|
||||
{
|
||||
if (NameId *nameId = name())
|
||||
if (const NameId *nameId = name())
|
||||
return nameId->identifier();
|
||||
|
||||
return 0;
|
||||
@@ -113,7 +113,7 @@ NamespaceBinding *NamespaceBinding::globalNamespaceBinding()
|
||||
return it;
|
||||
}
|
||||
|
||||
Binding *NamespaceBinding::findClassOrNamespaceBinding(Identifier *id, QSet<Binding *> *processed)
|
||||
Binding *NamespaceBinding::findClassOrNamespaceBinding(const Identifier *id, QSet<Binding *> *processed)
|
||||
{
|
||||
if (processed->contains(this))
|
||||
return 0;
|
||||
@@ -144,7 +144,7 @@ Binding *NamespaceBinding::findClassOrNamespaceBinding(Identifier *id, QSet<Bind
|
||||
return 0;
|
||||
}
|
||||
|
||||
ClassBinding *NamespaceBinding::findClassBinding(Name *name, QSet<Binding *> *processed)
|
||||
ClassBinding *NamespaceBinding::findClassBinding(const Name *name, QSet<Binding *> *processed)
|
||||
{
|
||||
if (! name)
|
||||
return 0;
|
||||
@@ -156,7 +156,7 @@ ClassBinding *NamespaceBinding::findClassBinding(Name *name, QSet<Binding *> *pr
|
||||
Binding *current = this;
|
||||
|
||||
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||
Identifier *nameId = q->nameAt(i)->identifier();
|
||||
const Identifier *nameId = q->nameAt(i)->identifier();
|
||||
if (! nameId)
|
||||
return 0;
|
||||
|
||||
@@ -173,7 +173,7 @@ ClassBinding *NamespaceBinding::findClassBinding(Name *name, QSet<Binding *> *pr
|
||||
|
||||
processed->insert(this);
|
||||
|
||||
Identifier *id = name->identifier();
|
||||
const Identifier *id = name->identifier();
|
||||
|
||||
foreach (ClassBinding *classBinding, classBindings) {
|
||||
if (id->isEqualTo(classBinding->identifier()))
|
||||
@@ -191,19 +191,19 @@ ClassBinding *NamespaceBinding::findClassBinding(Name *name, QSet<Binding *> *pr
|
||||
return 0;
|
||||
}
|
||||
|
||||
NamespaceBinding *NamespaceBinding::findNamespaceBinding(Name *name)
|
||||
NamespaceBinding *NamespaceBinding::findNamespaceBinding(const Name *name)
|
||||
{
|
||||
if (! name)
|
||||
return anonymousNamespaceBinding;
|
||||
|
||||
else if (NameId *nameId = name->asNameId())
|
||||
else if (const NameId *nameId = name->asNameId())
|
||||
return findNamespaceBindingForNameId(nameId, /*lookAtParent = */ true);
|
||||
|
||||
else if (const QualifiedNameId *q = name->asQualifiedNameId()) {
|
||||
NamespaceBinding *current = this;
|
||||
|
||||
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||
NameId *namespaceName = q->nameAt(i)->asNameId();
|
||||
const NameId *namespaceName = q->nameAt(i)->asNameId();
|
||||
if (! namespaceName)
|
||||
return 0;
|
||||
|
||||
@@ -225,14 +225,14 @@ NamespaceBinding *NamespaceBinding::findNamespaceBinding(Name *name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
NamespaceBinding *NamespaceBinding::findNamespaceBindingForNameId(NameId *name,
|
||||
NamespaceBinding *NamespaceBinding::findNamespaceBindingForNameId(const NameId *name,
|
||||
bool lookAtParentNamespace)
|
||||
{
|
||||
QSet<NamespaceBinding *> processed;
|
||||
return findNamespaceBindingForNameId_helper(name, lookAtParentNamespace, &processed);
|
||||
}
|
||||
|
||||
NamespaceBinding *NamespaceBinding::findNamespaceBindingForNameId_helper(NameId *name,
|
||||
NamespaceBinding *NamespaceBinding::findNamespaceBindingForNameId_helper(const NameId *name,
|
||||
bool lookAtParentNamespace,
|
||||
QSet<NamespaceBinding *> *processed)
|
||||
{
|
||||
@@ -242,12 +242,12 @@ NamespaceBinding *NamespaceBinding::findNamespaceBindingForNameId_helper(NameId
|
||||
processed->insert(this);
|
||||
|
||||
foreach (NamespaceBinding *binding, children) {
|
||||
Name *bindingName = binding->name();
|
||||
const Name *bindingName = binding->name();
|
||||
|
||||
if (! bindingName)
|
||||
continue;
|
||||
|
||||
if (NameId *bindingNameId = bindingName->asNameId()) {
|
||||
if (const NameId *bindingNameId = bindingName->asNameId()) {
|
||||
if (name->isEqualTo(bindingNameId))
|
||||
return binding;
|
||||
}
|
||||
@@ -296,7 +296,7 @@ NamespaceBinding *NamespaceBinding::findOrCreateNamespaceBinding(Namespace *symb
|
||||
}
|
||||
|
||||
static void closure(const Location &loc,
|
||||
NamespaceBinding *binding, Name *name,
|
||||
NamespaceBinding *binding, const Name *name,
|
||||
QList<NamespaceBinding *> *bindings)
|
||||
{
|
||||
if (bindings->contains(binding))
|
||||
@@ -306,7 +306,7 @@ static void closure(const Location &loc,
|
||||
|
||||
Q_ASSERT(name->isNameId());
|
||||
|
||||
Identifier *id = name->asNameId()->identifier();
|
||||
const Identifier *id = name->asNameId()->identifier();
|
||||
bool ignoreUsingDirectives = false;
|
||||
|
||||
foreach (Namespace *symbol, binding->symbols) {
|
||||
@@ -334,13 +334,13 @@ static void closure(const Location &loc,
|
||||
|
||||
|
||||
NamespaceBinding *NamespaceBinding::resolveNamespace(const Location &loc,
|
||||
Name *name,
|
||||
const Name *name,
|
||||
bool lookAtParent)
|
||||
{
|
||||
if (! name)
|
||||
return 0;
|
||||
|
||||
else if (NameId *nameId = name->asNameId()) {
|
||||
else if (const NameId *nameId = name->asNameId()) {
|
||||
QList<NamespaceBinding *> bindings;
|
||||
closure(loc, this, nameId, &bindings);
|
||||
|
||||
@@ -394,7 +394,7 @@ QByteArray NamespaceBinding::qualifiedId() const
|
||||
s.append(parent->qualifiedId());
|
||||
s.append("::");
|
||||
|
||||
if (Identifier *id = identifier())
|
||||
if (const Identifier *id = identifier())
|
||||
s.append(id->chars(), id->size());
|
||||
|
||||
else
|
||||
@@ -409,7 +409,7 @@ QByteArray ClassBinding::qualifiedId() const
|
||||
QByteArray s = parent->qualifiedId();
|
||||
s += "::";
|
||||
|
||||
if (Identifier *id = identifier())
|
||||
if (const Identifier *id = identifier())
|
||||
s.append(id->chars(), id->size());
|
||||
|
||||
else
|
||||
@@ -418,7 +418,7 @@ QByteArray ClassBinding::qualifiedId() const
|
||||
return s;
|
||||
}
|
||||
|
||||
Binding *ClassBinding::findClassOrNamespaceBinding(Identifier *id, QSet<Binding *> *processed)
|
||||
Binding *ClassBinding::findClassOrNamespaceBinding(const Identifier *id, QSet<Binding *> *processed)
|
||||
{
|
||||
if (id->isEqualTo(identifier()))
|
||||
return this;
|
||||
@@ -447,7 +447,7 @@ Binding *ClassBinding::findClassOrNamespaceBinding(Identifier *id, QSet<Binding
|
||||
return 0;
|
||||
}
|
||||
|
||||
ClassBinding *ClassBinding::findClassBinding(Name *name, QSet<Binding *> *processed)
|
||||
ClassBinding *ClassBinding::findClassBinding(const Name *name, QSet<Binding *> *processed)
|
||||
{
|
||||
if (! name)
|
||||
return 0;
|
||||
@@ -461,7 +461,7 @@ ClassBinding *ClassBinding::findClassBinding(Name *name, QSet<Binding *> *proces
|
||||
Binding *currentBinding = this;
|
||||
|
||||
for (unsigned i = 0; i < q->nameCount() - 1; ++i) {
|
||||
Identifier *id = q->nameAt(i)->identifier();
|
||||
const Identifier *id = q->nameAt(i)->identifier();
|
||||
if (! id)
|
||||
return 0;
|
||||
|
||||
@@ -479,12 +479,12 @@ ClassBinding *ClassBinding::findClassBinding(Name *name, QSet<Binding *> *proces
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (Identifier *id = name->identifier()) {
|
||||
if (const Identifier *id = name->identifier()) {
|
||||
if (id->isEqualTo(identifier()))
|
||||
return this;
|
||||
|
||||
foreach (ClassBinding *nestedClassBinding, children) {
|
||||
if (Identifier *nestedClassId = nestedClassBinding->identifier()) {
|
||||
if (const Identifier *nestedClassId = nestedClassBinding->identifier()) {
|
||||
if (nestedClassId->isEqualTo(id))
|
||||
return nestedClassBinding;
|
||||
}
|
||||
@@ -549,7 +549,7 @@ ClassBinding::ClassBinding(ClassBinding *parentClass)
|
||||
ClassBinding::~ClassBinding()
|
||||
{ qDeleteAll(children); }
|
||||
|
||||
Name *ClassBinding::name() const
|
||||
const Name *ClassBinding::name() const
|
||||
{
|
||||
if (symbols.isEmpty())
|
||||
return 0;
|
||||
@@ -557,9 +557,9 @@ Name *ClassBinding::name() const
|
||||
return symbols.first()->name();
|
||||
}
|
||||
|
||||
Identifier *ClassBinding::identifier() const
|
||||
const Identifier *ClassBinding::identifier() const
|
||||
{
|
||||
if (Name *n = name())
|
||||
if (const Name *n = name())
|
||||
return n->identifier();
|
||||
|
||||
return 0;
|
||||
@@ -623,12 +623,12 @@ protected:
|
||||
|
||||
NamespaceBinding *bind(Symbol *symbol, NamespaceBinding *binding);
|
||||
NamespaceBinding *findOrCreateNamespaceBinding(Namespace *symbol);
|
||||
NamespaceBinding *resolveNamespace(const Location &loc, Name *name);
|
||||
NamespaceBinding *resolveNamespace(const Location &loc, const Name *name);
|
||||
|
||||
NamespaceBinding *switchNamespaceBinding(NamespaceBinding *binding);
|
||||
|
||||
ClassBinding *findOrCreateClassBinding(Class *classSymbol);
|
||||
ClassBinding *findClassBinding(Name *name);
|
||||
ClassBinding *findClassBinding(const Name *name);
|
||||
|
||||
ClassBinding *switchClassBinding(ClassBinding *binding);
|
||||
|
||||
@@ -665,7 +665,7 @@ NamespaceBinding *Binder::bind(Symbol *symbol, NamespaceBinding *binding)
|
||||
NamespaceBinding *Binder::findOrCreateNamespaceBinding(Namespace *symbol)
|
||||
{ return namespaceBinding->findOrCreateNamespaceBinding(symbol); }
|
||||
|
||||
NamespaceBinding *Binder::resolveNamespace(const Location &loc, Name *name)
|
||||
NamespaceBinding *Binder::resolveNamespace(const Location &loc, const Name *name)
|
||||
{
|
||||
if (! namespaceBinding)
|
||||
return 0;
|
||||
@@ -694,7 +694,7 @@ ClassBinding *Binder::findOrCreateClassBinding(Class *classSymbol)
|
||||
return binding;
|
||||
}
|
||||
|
||||
ClassBinding *Binder::findClassBinding(Name *name)
|
||||
ClassBinding *Binder::findClassBinding(const Name *name)
|
||||
{
|
||||
QSet<Binding *> processed;
|
||||
|
||||
|
@@ -53,7 +53,7 @@ class CPLUSPLUS_EXPORT Location
|
||||
public:
|
||||
Location();
|
||||
Location(Symbol *symbol);
|
||||
Location(StringLiteral *fileId, unsigned sourceLocation);
|
||||
Location(const StringLiteral *fileId, unsigned sourceLocation);
|
||||
|
||||
inline bool isValid() const
|
||||
{ return _fileId != 0; }
|
||||
@@ -61,14 +61,14 @@ public:
|
||||
inline operator bool() const
|
||||
{ return _fileId != 0; }
|
||||
|
||||
inline StringLiteral *fileId() const
|
||||
inline const StringLiteral *fileId() const
|
||||
{ return _fileId; }
|
||||
|
||||
inline unsigned sourceLocation() const
|
||||
{ return _sourceLocation; }
|
||||
|
||||
private:
|
||||
StringLiteral *_fileId;
|
||||
const StringLiteral *_fileId;
|
||||
unsigned _sourceLocation;
|
||||
};
|
||||
|
||||
@@ -84,8 +84,8 @@ public:
|
||||
virtual NamespaceBinding *asNamespaceBinding() { return 0; }
|
||||
virtual ClassBinding *asClassBinding() { return 0; }
|
||||
|
||||
virtual ClassBinding *findClassBinding(Name *name, QSet<Binding *> *processed) = 0;
|
||||
virtual Binding *findClassOrNamespaceBinding(Identifier *id, QSet<Binding *> *processed) = 0;
|
||||
virtual ClassBinding *findClassBinding(const Name *name, QSet<Binding *> *processed) = 0;
|
||||
virtual Binding *findClassOrNamespaceBinding(const Identifier *id, QSet<Binding *> *processed) = 0;
|
||||
};
|
||||
|
||||
class CPLUSPLUS_EXPORT NamespaceBinding: public Binding
|
||||
@@ -98,26 +98,26 @@ public:
|
||||
virtual ~NamespaceBinding();
|
||||
|
||||
/// Returns this binding's name.
|
||||
NameId *name() const;
|
||||
const NameId *name() const;
|
||||
|
||||
/// Returns this binding's identifier.
|
||||
Identifier *identifier() const;
|
||||
const Identifier *identifier() const;
|
||||
|
||||
/// Returns the binding for the global namespace (aka ::).
|
||||
NamespaceBinding *globalNamespaceBinding();
|
||||
|
||||
/// Returns the binding for the given namespace symbol.
|
||||
NamespaceBinding *findNamespaceBinding(Name *name);
|
||||
NamespaceBinding *findNamespaceBinding(const Name *name);
|
||||
|
||||
/// Returns the binding associated with the given symbol.
|
||||
NamespaceBinding *findOrCreateNamespaceBinding(Namespace *symbol);
|
||||
|
||||
NamespaceBinding *resolveNamespace(const Location &loc,
|
||||
Name *name,
|
||||
const Name *name,
|
||||
bool lookAtParent = true);
|
||||
|
||||
virtual ClassBinding *findClassBinding(Name *name, QSet<Binding *> *processed);
|
||||
virtual Binding *findClassOrNamespaceBinding(Identifier *id, QSet<Binding *> *processed);
|
||||
virtual ClassBinding *findClassBinding(const Name *name, QSet<Binding *> *processed);
|
||||
virtual Binding *findClassOrNamespaceBinding(const Identifier *id, QSet<Binding *> *processed);
|
||||
|
||||
/// Helpers.
|
||||
virtual QByteArray qualifiedId() const;
|
||||
@@ -129,10 +129,10 @@ public:
|
||||
static ClassBinding *find(Class *symbol, NamespaceBinding *binding);
|
||||
|
||||
private:
|
||||
NamespaceBinding *findNamespaceBindingForNameId(NameId *name,
|
||||
NamespaceBinding *findNamespaceBindingForNameId(const NameId *name,
|
||||
bool lookAtParentNamespace);
|
||||
|
||||
NamespaceBinding *findNamespaceBindingForNameId_helper(NameId *name,
|
||||
NamespaceBinding *findNamespaceBindingForNameId_helper(const NameId *name,
|
||||
bool lookAtParentNamespace,
|
||||
QSet<NamespaceBinding *> *processed);
|
||||
|
||||
@@ -165,14 +165,14 @@ public:
|
||||
virtual ClassBinding *asClassBinding() { return this; }
|
||||
|
||||
/// Returns this binding's name.
|
||||
Name *name() const;
|
||||
const Name *name() const;
|
||||
|
||||
/// Returns this binding's identifier.
|
||||
Identifier *identifier() const;
|
||||
const Identifier *identifier() const;
|
||||
virtual QByteArray qualifiedId() const;
|
||||
|
||||
virtual ClassBinding *findClassBinding(Name *name, QSet<Binding *> *processed);
|
||||
virtual Binding *findClassOrNamespaceBinding(Identifier *id, QSet<Binding *> *processed);
|
||||
virtual ClassBinding *findClassBinding(const Name *name, QSet<Binding *> *processed);
|
||||
virtual Binding *findClassOrNamespaceBinding(const Identifier *id, QSet<Binding *> *processed);
|
||||
|
||||
void dump();
|
||||
|
||||
|
@@ -66,7 +66,7 @@ public:
|
||||
{ }
|
||||
|
||||
virtual void report(int level,
|
||||
StringLiteral *fileId,
|
||||
const StringLiteral *fileId,
|
||||
unsigned line, unsigned column,
|
||||
const char *format, va_list ap)
|
||||
{
|
||||
@@ -118,8 +118,8 @@ Document::Document(const QString &fileName)
|
||||
_control->setDiagnosticClient(new DocumentDiagnosticClient(this, &_diagnosticMessages));
|
||||
|
||||
const QByteArray localFileName = fileName.toUtf8();
|
||||
StringLiteral *fileId = _control->findOrInsertStringLiteral(localFileName.constData(),
|
||||
localFileName.size());
|
||||
const StringLiteral *fileId = _control->findOrInsertStringLiteral(localFileName.constData(),
|
||||
localFileName.size());
|
||||
_translationUnit = new TranslationUnit(_control, fileId);
|
||||
_translationUnit->setQtMocRunEnabled(true);
|
||||
_translationUnit->setObjCEnabled(true);
|
||||
|
@@ -57,7 +57,7 @@ void FindUsages::setGlobalNamespaceBinding(NamespaceBindingPtr globalNamespaceBi
|
||||
_globalNamespaceBinding = globalNamespaceBinding;
|
||||
}
|
||||
|
||||
QList<int> FindUsages::operator()(Symbol *symbol, Identifier *id, AST *ast)
|
||||
QList<int> FindUsages::operator()(Symbol *symbol, const Identifier *id, AST *ast)
|
||||
{
|
||||
_processed.clear();
|
||||
_references.clear();
|
||||
@@ -344,7 +344,7 @@ bool FindUsages::visit(QualifiedNameAST *ast)
|
||||
|
||||
bool FindUsages::visit(EnumeratorAST *ast)
|
||||
{
|
||||
Identifier *id = identifier(ast->identifier_token);
|
||||
const Identifier *id = identifier(ast->identifier_token);
|
||||
if (id == _id) {
|
||||
LookupContext context = currentContext(ast);
|
||||
const QList<Symbol *> candidates = context.resolve(control()->nameId(id));
|
||||
@@ -358,7 +358,7 @@ bool FindUsages::visit(EnumeratorAST *ast)
|
||||
|
||||
bool FindUsages::visit(SimpleNameAST *ast)
|
||||
{
|
||||
Identifier *id = identifier(ast->identifier_token);
|
||||
const Identifier *id = identifier(ast->identifier_token);
|
||||
if (id == _id) {
|
||||
LookupContext context = currentContext(ast);
|
||||
const QList<Symbol *> candidates = context.resolve(ast->name);
|
||||
@@ -370,7 +370,7 @@ bool FindUsages::visit(SimpleNameAST *ast)
|
||||
|
||||
bool FindUsages::visit(DestructorNameAST *ast)
|
||||
{
|
||||
Identifier *id = identifier(ast->identifier_token);
|
||||
const Identifier *id = identifier(ast->identifier_token);
|
||||
if (id == _id) {
|
||||
LookupContext context = currentContext(ast);
|
||||
const QList<Symbol *> candidates = context.resolve(ast->name);
|
||||
|
@@ -64,7 +64,7 @@ public:
|
||||
|
||||
void setGlobalNamespaceBinding(NamespaceBindingPtr globalNamespaceBinding);
|
||||
|
||||
QList<int> operator()(Symbol *symbol, Identifier *id, AST *ast);
|
||||
QList<int> operator()(Symbol *symbol, const Identifier *id, AST *ast);
|
||||
|
||||
protected:
|
||||
using ASTVisitor::visit;
|
||||
@@ -101,7 +101,7 @@ protected:
|
||||
|
||||
private:
|
||||
QFutureInterface<Usage> *_future;
|
||||
Identifier *_id;
|
||||
const Identifier *_id;
|
||||
Symbol *_declSymbol;
|
||||
Document::Ptr _doc;
|
||||
Snapshot _snapshot;
|
||||
|
@@ -52,10 +52,10 @@ public:
|
||||
|
||||
Control *control() const { return context.control(); }
|
||||
|
||||
FullySpecifiedType apply(Name *name);
|
||||
FullySpecifiedType apply(const Name *name);
|
||||
FullySpecifiedType apply(const FullySpecifiedType &type);
|
||||
|
||||
int findSubstitution(Identifier *id) const;
|
||||
int findSubstitution(const Identifier *id) const;
|
||||
FullySpecifiedType applySubstitution(int index) const;
|
||||
|
||||
private:
|
||||
@@ -207,7 +207,7 @@ private:
|
||||
public:
|
||||
ApplyToName(ApplySubstitution *q): q(q) {}
|
||||
|
||||
FullySpecifiedType operator()(Name *name)
|
||||
FullySpecifiedType operator()(const Name *name)
|
||||
{
|
||||
FullySpecifiedType previousType = switchType(FullySpecifiedType());
|
||||
accept(name);
|
||||
@@ -218,7 +218,7 @@ private:
|
||||
Control *control() const
|
||||
{ return q->control(); }
|
||||
|
||||
int findSubstitution(Identifier *id) const
|
||||
int findSubstitution(const Identifier *id) const
|
||||
{ return q->findSubstitution(id); }
|
||||
|
||||
FullySpecifiedType applySubstitution(int index) const
|
||||
@@ -231,7 +231,7 @@ private:
|
||||
return previousType;
|
||||
}
|
||||
|
||||
virtual void visit(NameId *name)
|
||||
virtual void visit(const NameId *name)
|
||||
{
|
||||
int index = findSubstitution(name->identifier());
|
||||
|
||||
@@ -242,7 +242,7 @@ private:
|
||||
_type = control()->namedType(name);
|
||||
}
|
||||
|
||||
virtual void visit(TemplateNameId *name)
|
||||
virtual void visit(const TemplateNameId *name)
|
||||
{
|
||||
QVarLengthArray<FullySpecifiedType, 8> arguments(name->templateArgumentCount());
|
||||
for (unsigned i = 0; i < name->templateArgumentCount(); ++i) {
|
||||
@@ -250,17 +250,19 @@ private:
|
||||
arguments[i] = q->apply(argTy);
|
||||
}
|
||||
|
||||
TemplateNameId *templId = control()->templateNameId(name->identifier(), arguments.data(), arguments.size());
|
||||
const TemplateNameId *templId = control()->templateNameId(name->identifier(),
|
||||
arguments.data(),
|
||||
arguments.size());
|
||||
_type = control()->namedType(templId);
|
||||
}
|
||||
|
||||
virtual void visit(QualifiedNameId *name)
|
||||
virtual void visit(const QualifiedNameId *name)
|
||||
{
|
||||
QVarLengthArray<Name *, 8> names(name->nameCount());
|
||||
QVarLengthArray<const Name *, 8> names(name->nameCount());
|
||||
for (unsigned i = 0; i < name->nameCount(); ++i) {
|
||||
Name *n = name->nameAt(i);
|
||||
const Name *n = name->nameAt(i);
|
||||
|
||||
if (TemplateNameId *templId = n->asTemplateNameId()) {
|
||||
if (const TemplateNameId *templId = n->asTemplateNameId()) {
|
||||
QVarLengthArray<FullySpecifiedType, 8> arguments(templId->templateArgumentCount());
|
||||
for (unsigned templateArgIndex = 0; templateArgIndex < templId->templateArgumentCount(); ++templateArgIndex) {
|
||||
FullySpecifiedType argTy = templId->templateArgumentAt(templateArgIndex);
|
||||
@@ -273,29 +275,29 @@ private:
|
||||
names[i] = n;
|
||||
}
|
||||
|
||||
QualifiedNameId *q = control()->qualifiedNameId(names.data(), names.size(), name->isGlobal());
|
||||
const QualifiedNameId *q = control()->qualifiedNameId(names.data(), names.size(), name->isGlobal());
|
||||
_type = control()->namedType(q);
|
||||
}
|
||||
|
||||
virtual void visit(DestructorNameId *name)
|
||||
virtual void visit(const DestructorNameId *name)
|
||||
{
|
||||
Overview oo;
|
||||
qWarning() << "ignored name:" << oo(name);
|
||||
}
|
||||
|
||||
virtual void visit(OperatorNameId *name)
|
||||
virtual void visit(const OperatorNameId *name)
|
||||
{
|
||||
Overview oo;
|
||||
qWarning() << "ignored name:" << oo(name);
|
||||
}
|
||||
|
||||
virtual void visit(ConversionNameId *name)
|
||||
virtual void visit(const ConversionNameId *name)
|
||||
{
|
||||
Overview oo;
|
||||
qWarning() << "ignored name:" << oo(name);
|
||||
}
|
||||
|
||||
virtual void visit(SelectorNameId *name)
|
||||
virtual void visit(const SelectorNameId *name)
|
||||
{
|
||||
Overview oo;
|
||||
qWarning() << "ignored name:" << oo(name);
|
||||
@@ -325,7 +327,7 @@ ApplySubstitution::~ApplySubstitution()
|
||||
{
|
||||
}
|
||||
|
||||
FullySpecifiedType ApplySubstitution::apply(Name *name)
|
||||
FullySpecifiedType ApplySubstitution::apply(const Name *name)
|
||||
{
|
||||
FullySpecifiedType ty = applyToName(name);
|
||||
return ty;
|
||||
@@ -337,12 +339,12 @@ FullySpecifiedType ApplySubstitution::apply(const FullySpecifiedType &type)
|
||||
return ty;
|
||||
}
|
||||
|
||||
int ApplySubstitution::findSubstitution(Identifier *id) const
|
||||
int ApplySubstitution::findSubstitution(const Identifier *id) const
|
||||
{
|
||||
Q_ASSERT(id != 0);
|
||||
|
||||
for (int index = 0; index < substitution.size(); ++index) {
|
||||
QPair<Identifier *, FullySpecifiedType> s = substitution.at(index);
|
||||
QPair<const Identifier *, FullySpecifiedType> s = substitution.at(index);
|
||||
|
||||
if (id->isEqualTo(s.first))
|
||||
return index;
|
||||
|
@@ -44,7 +44,7 @@ namespace CPlusPlus {
|
||||
class CPLUSPLUS_EXPORT GenTemplateInstance
|
||||
{
|
||||
public:
|
||||
typedef QList< QPair<Identifier *, FullySpecifiedType> > Substitution;
|
||||
typedef QList< QPair<const Identifier *, FullySpecifiedType> > Substitution;
|
||||
|
||||
public:
|
||||
GenTemplateInstance(const LookupContext &context, const Substitution &substitution);
|
||||
|
@@ -109,14 +109,14 @@ bool LookupContext::maybeValidSymbol(Symbol *symbol,
|
||||
return false;
|
||||
}
|
||||
|
||||
QList<Scope *> LookupContext::resolveNestedNameSpecifier(QualifiedNameId *q,
|
||||
const QList<Scope *> &visibleScopes) const
|
||||
QList<Scope *> LookupContext::resolveNestedNameSpecifier(const QualifiedNameId *q,
|
||||
const QList<Scope *> &visibleScopes) const
|
||||
{
|
||||
QList<Symbol *> candidates;
|
||||
QList<Scope *> scopes = visibleScopes;
|
||||
|
||||
for (unsigned i = 0; i < q->nameCount() - 1; ++i) {
|
||||
Name *name = q->nameAt(i);
|
||||
const Name *name = q->nameAt(i);
|
||||
|
||||
candidates = resolveClassOrNamespace(name, scopes);
|
||||
|
||||
@@ -137,7 +137,7 @@ QList<Scope *> LookupContext::resolveNestedNameSpecifier(QualifiedNameId *q,
|
||||
return scopes;
|
||||
}
|
||||
|
||||
QList<Symbol *> LookupContext::resolveQualifiedNameId(QualifiedNameId *q,
|
||||
QList<Symbol *> LookupContext::resolveQualifiedNameId(const QualifiedNameId *q,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
ResolveMode mode) const
|
||||
{
|
||||
@@ -153,7 +153,7 @@ QList<Symbol *> LookupContext::resolveQualifiedNameId(QualifiedNameId *q,
|
||||
else if (! symbol->isClass())
|
||||
continue;
|
||||
|
||||
QualifiedNameId *qq = symbol->name()->asQualifiedNameId();
|
||||
const QualifiedNameId *qq = symbol->name()->asQualifiedNameId();
|
||||
|
||||
if (! qq)
|
||||
continue;
|
||||
@@ -167,8 +167,8 @@ QList<Symbol *> LookupContext::resolveQualifiedNameId(QualifiedNameId *q,
|
||||
unsigned j = 0;
|
||||
|
||||
for (; j < q->nameCount(); ++j) {
|
||||
Name *classOrNamespaceName1 = q->nameAt(j);
|
||||
Name *classOrNamespaceName2 = qq->nameAt(j);
|
||||
const Name *classOrNamespaceName1 = q->nameAt(j);
|
||||
const Name *classOrNamespaceName2 = qq->nameAt(j);
|
||||
|
||||
if (! classOrNamespaceName1->isEqualTo(classOrNamespaceName2))
|
||||
break;
|
||||
@@ -205,7 +205,7 @@ QList<Symbol *> LookupContext::resolveQualifiedNameId(QualifiedNameId *q,
|
||||
return candidates;
|
||||
}
|
||||
|
||||
QList<Symbol *> LookupContext::resolveOperatorNameId(OperatorNameId *opId,
|
||||
QList<Symbol *> LookupContext::resolveOperatorNameId(const OperatorNameId *opId,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
ResolveMode) const
|
||||
{
|
||||
@@ -226,7 +226,7 @@ QList<Symbol *> LookupContext::resolveOperatorNameId(OperatorNameId *opId,
|
||||
return candidates;
|
||||
}
|
||||
|
||||
QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visibleScopes,
|
||||
QList<Symbol *> LookupContext::resolve(const Name *name, const QList<Scope *> &visibleScopes,
|
||||
ResolveMode mode) const
|
||||
{
|
||||
QList<Symbol *> candidates;
|
||||
@@ -234,13 +234,13 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
|
||||
if (!name)
|
||||
return candidates; // nothing to do, the symbol is anonymous.
|
||||
|
||||
else if (QualifiedNameId *q = name->asQualifiedNameId())
|
||||
else if (const QualifiedNameId *q = name->asQualifiedNameId())
|
||||
return resolveQualifiedNameId(q, visibleScopes, mode);
|
||||
|
||||
else if (OperatorNameId *opId = name->asOperatorNameId())
|
||||
else if (const OperatorNameId *opId = name->asOperatorNameId())
|
||||
return resolveOperatorNameId(opId, visibleScopes, mode);
|
||||
|
||||
else if (Identifier *id = name->identifier()) {
|
||||
else if (const Identifier *id = name->identifier()) {
|
||||
for (int scopeIndex = 0; scopeIndex < visibleScopes.size(); ++scopeIndex) {
|
||||
Scope *scope = visibleScopes.at(scopeIndex);
|
||||
|
||||
@@ -251,21 +251,21 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
|
||||
else if (! maybeValidSymbol(symbol, mode, candidates))
|
||||
continue; // skip it, we're not looking for this kind of symbols
|
||||
|
||||
else if (Identifier *symbolId = symbol->identifier()) {
|
||||
else if (const Identifier *symbolId = symbol->identifier()) {
|
||||
if (! symbolId->isEqualTo(id))
|
||||
continue; // skip it, the symbol's id is not compatible with this lookup.
|
||||
}
|
||||
|
||||
if (QualifiedNameId *q = symbol->name()->asQualifiedNameId()) {
|
||||
if (const QualifiedNameId *q = symbol->name()->asQualifiedNameId()) {
|
||||
|
||||
if (name->isDestructorNameId() != q->unqualifiedNameId()->isDestructorNameId())
|
||||
continue;
|
||||
|
||||
else if (q->nameCount() > 1) {
|
||||
Name *classOrNamespaceName = control()->qualifiedNameId(q->names(),
|
||||
q->nameCount() - 1);
|
||||
const Name *classOrNamespaceName = control()->qualifiedNameId(q->names(),
|
||||
q->nameCount() - 1);
|
||||
|
||||
if (Identifier *classOrNamespaceNameId = identifier(classOrNamespaceName)) {
|
||||
if (const Identifier *classOrNamespaceNameId = identifier(classOrNamespaceName)) {
|
||||
if (classOrNamespaceNameId->isEqualTo(id))
|
||||
continue;
|
||||
}
|
||||
@@ -299,7 +299,7 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
|
||||
return candidates;
|
||||
}
|
||||
|
||||
Identifier *LookupContext::identifier(const Name *name) const
|
||||
const Identifier *LookupContext::identifier(const Name *name) const
|
||||
{
|
||||
if (name)
|
||||
return name->identifier();
|
||||
@@ -418,7 +418,7 @@ void LookupContext::expandNamespace(Namespace *ns,
|
||||
if (Scope *encl = ns->enclosingNamespaceScope())
|
||||
expand(encl, visibleScopes, expandedScopes);
|
||||
|
||||
if (Name *nsName = ns->name()) {
|
||||
if (const Name *nsName = ns->name()) {
|
||||
const QList<Symbol *> namespaceList = resolveNamespace(nsName, visibleScopes);
|
||||
foreach (Symbol *otherNs, namespaceList) {
|
||||
if (otherNs == ns)
|
||||
@@ -478,7 +478,7 @@ void LookupContext::expandClass(Class *klass,
|
||||
|
||||
for (unsigned i = 0; i < klass->baseClassCount(); ++i) {
|
||||
BaseClass *baseClass = klass->baseClassAt(i);
|
||||
Name *baseClassName = baseClass->name();
|
||||
const Name *baseClassName = baseClass->name();
|
||||
const QList<Symbol *> baseClassCandidates = resolveClass(baseClassName,
|
||||
classVisibleScopes);
|
||||
|
||||
@@ -515,8 +515,8 @@ void LookupContext::expandFunction(Function *function,
|
||||
if (! expandedScopes->contains(function->arguments()))
|
||||
expandedScopes->append(function->arguments());
|
||||
|
||||
if (QualifiedNameId *q = function->name()->asQualifiedNameId()) {
|
||||
Name *nestedNameSpec = 0;
|
||||
if (const QualifiedNameId *q = function->name()->asQualifiedNameId()) {
|
||||
const Name *nestedNameSpec = 0;
|
||||
if (q->nameCount() == 1)
|
||||
nestedNameSpec = q->nameAt(0);
|
||||
else
|
||||
@@ -565,7 +565,7 @@ void LookupContext::expandObjCClass(ObjCClass *klass,
|
||||
|
||||
// expand the base class:
|
||||
if (ObjCBaseClass *baseClass = klass->baseClass()) {
|
||||
Name *baseClassName = baseClass->name();
|
||||
const Name *baseClassName = baseClass->name();
|
||||
const QList<Symbol *> baseClassCandidates = resolveObjCClass(baseClassName,
|
||||
visibleScopes);
|
||||
|
||||
@@ -577,7 +577,7 @@ void LookupContext::expandObjCClass(ObjCClass *klass,
|
||||
|
||||
// expand the protocols:
|
||||
for (unsigned i = 0; i < klass->protocolCount(); ++i) {
|
||||
Name *protocolName = klass->protocolAt(i)->name();
|
||||
const Name *protocolName = klass->protocolAt(i)->name();
|
||||
const QList<Symbol *> protocolCandidates = resolveObjCProtocol(protocolName, visibleScopes);
|
||||
for (int j = 0; j < protocolCandidates.size(); ++j) {
|
||||
if (ObjCProtocol *protocolSymbol = protocolCandidates.at(j)->asObjCProtocol())
|
||||
@@ -667,7 +667,7 @@ Symbol *LookupContext::canonicalSymbol(Symbol *symbol,
|
||||
if (! canonicalSymbol)
|
||||
return 0;
|
||||
|
||||
if (Identifier *symbolId = canonicalSymbol->identifier()) {
|
||||
if (const Identifier *symbolId = canonicalSymbol->identifier()) {
|
||||
if (symbolId && canonicalSymbol->type()->isFunctionType()) {
|
||||
Class *enclosingClass = canonicalSymbol->scope()->owner()->asClass();
|
||||
const QList<ClassBinding *> classBindings = visibleClassBindings(enclosingClass, globalNamespace);
|
||||
|
@@ -94,22 +94,22 @@ public:
|
||||
static Symbol *canonicalSymbol(const QList<LookupItem> &candidates,
|
||||
NamespaceBinding *globalNamespaceBinding);
|
||||
|
||||
QList<Symbol *> resolve(Name *name) const
|
||||
QList<Symbol *> resolve(const Name *name) const
|
||||
{ return resolve(name, visibleScopes()); }
|
||||
|
||||
QList<Symbol *> resolveNamespace(Name *name) const
|
||||
QList<Symbol *> resolveNamespace(const Name *name) const
|
||||
{ return resolveNamespace(name, visibleScopes()); }
|
||||
|
||||
QList<Symbol *> resolveClass(Name *name) const
|
||||
QList<Symbol *> resolveClass(const Name *name) const
|
||||
{ return resolveClass(name, visibleScopes()); }
|
||||
|
||||
QList<Symbol *> resolveClassOrNamespace(Name *name) const
|
||||
QList<Symbol *> resolveClassOrNamespace(const Name *name) const
|
||||
{ return resolveClassOrNamespace(name, visibleScopes()); }
|
||||
|
||||
QList<Symbol *> resolveObjCClass(Name *name) const
|
||||
QList<Symbol *> resolveObjCClass(const Name *name) const
|
||||
{ return resolveObjCClass(name, visibleScopes()); }
|
||||
|
||||
QList<Symbol *> resolveObjCProtocol(Name *name) const
|
||||
QList<Symbol *> resolveObjCProtocol(const Name *name) const
|
||||
{ return resolveObjCProtocol(name, visibleScopes()); }
|
||||
|
||||
enum ResolveMode {
|
||||
@@ -122,22 +122,22 @@ public:
|
||||
ResolveAll = ResolveSymbol | ResolveClassOrNamespace | ResolveObjCClass | ResolveObjCProtocol
|
||||
};
|
||||
|
||||
QList<Symbol *> resolve(Name *name, const QList<Scope *> &visibleScopes,
|
||||
QList<Symbol *> resolve(const Name *name, const QList<Scope *> &visibleScopes,
|
||||
ResolveMode mode = ResolveAll) const;
|
||||
|
||||
QList<Symbol *> resolveNamespace(Name *name, const QList<Scope *> &visibleScopes) const
|
||||
QList<Symbol *> resolveNamespace(const Name *name, const QList<Scope *> &visibleScopes) const
|
||||
{ return resolve(name, visibleScopes, ResolveNamespace); }
|
||||
|
||||
QList<Symbol *> resolveClass(Name *name, const QList<Scope *> &visibleScopes) const
|
||||
QList<Symbol *> resolveClass(const Name *name, const QList<Scope *> &visibleScopes) const
|
||||
{ return resolve(name, visibleScopes, ResolveClass); }
|
||||
|
||||
QList<Symbol *> resolveClassOrNamespace(Name *name, const QList<Scope *> &visibleScopes) const
|
||||
QList<Symbol *> resolveClassOrNamespace(const Name *name, const QList<Scope *> &visibleScopes) const
|
||||
{ return resolve(name, visibleScopes, ResolveClassOrNamespace); }
|
||||
|
||||
QList<Symbol *> resolveObjCClass(Name *name, const QList<Scope *> &visibleScopes) const
|
||||
QList<Symbol *> resolveObjCClass(const Name *name, const QList<Scope *> &visibleScopes) const
|
||||
{ return resolve(name, visibleScopes, ResolveObjCClass); }
|
||||
|
||||
QList<Symbol *> resolveObjCProtocol(Name *name, const QList<Scope *> &visibleScopes) const
|
||||
QList<Symbol *> resolveObjCProtocol(const Name *name, const QList<Scope *> &visibleScopes) const
|
||||
{ return resolve(name, visibleScopes, ResolveObjCProtocol); }
|
||||
|
||||
QList<Scope *> visibleScopes() const
|
||||
@@ -187,18 +187,18 @@ public:
|
||||
private:
|
||||
static Symbol *canonicalSymbol(Symbol *symbol);
|
||||
|
||||
QList<Symbol *> resolveQualifiedNameId(QualifiedNameId *q,
|
||||
QList<Symbol *> resolveQualifiedNameId(const QualifiedNameId *q,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
ResolveMode mode) const;
|
||||
|
||||
QList<Symbol *> resolveOperatorNameId(OperatorNameId *opId,
|
||||
QList<Symbol *> resolveOperatorNameId(const OperatorNameId *opId,
|
||||
const QList<Scope *> &visibleScopes,
|
||||
ResolveMode mode) const;
|
||||
|
||||
QList<Scope *> resolveNestedNameSpecifier(QualifiedNameId *q,
|
||||
QList<Scope *> resolveNestedNameSpecifier(const QualifiedNameId *q,
|
||||
const QList<Scope *> &visibleScopes) const;
|
||||
|
||||
Identifier *identifier(const Name *name) const;
|
||||
const Identifier *identifier(const Name *name) const;
|
||||
|
||||
QList<Scope *> buildVisibleScopes();
|
||||
|
||||
|
@@ -48,7 +48,7 @@ const Overview *NamePrettyPrinter::overview() const
|
||||
return _overview;
|
||||
}
|
||||
|
||||
QString NamePrettyPrinter::operator()(Name *name)
|
||||
QString NamePrettyPrinter::operator()(const Name *name)
|
||||
{
|
||||
QString previousName = switchName();
|
||||
accept(name);
|
||||
@@ -62,18 +62,18 @@ QString NamePrettyPrinter::switchName(const QString &name)
|
||||
return previousName;
|
||||
}
|
||||
|
||||
void NamePrettyPrinter::visit(NameId *name)
|
||||
void NamePrettyPrinter::visit(const NameId *name)
|
||||
{
|
||||
Identifier *id = name->identifier();
|
||||
const Identifier *id = name->identifier();
|
||||
if (id)
|
||||
_name = QString::fromLatin1(id->chars(), id->size());
|
||||
else
|
||||
_name = QLatin1String("anonymous");
|
||||
}
|
||||
|
||||
void NamePrettyPrinter::visit(TemplateNameId *name)
|
||||
void NamePrettyPrinter::visit(const TemplateNameId *name)
|
||||
{
|
||||
Identifier *id = name->identifier();
|
||||
const Identifier *id = name->identifier();
|
||||
if (id)
|
||||
_name = QString::fromLatin1(id->chars(), id->size());
|
||||
else
|
||||
@@ -93,14 +93,14 @@ void NamePrettyPrinter::visit(TemplateNameId *name)
|
||||
_name += QLatin1Char('>');
|
||||
}
|
||||
|
||||
void NamePrettyPrinter::visit(DestructorNameId *name)
|
||||
void NamePrettyPrinter::visit(const DestructorNameId *name)
|
||||
{
|
||||
Identifier *id = name->identifier();
|
||||
const Identifier *id = name->identifier();
|
||||
_name += QLatin1Char('~');
|
||||
_name += QString::fromLatin1(id->chars(), id->size());
|
||||
}
|
||||
|
||||
void NamePrettyPrinter::visit(OperatorNameId *name)
|
||||
void NamePrettyPrinter::visit(const OperatorNameId *name)
|
||||
{
|
||||
_name += QLatin1String("operator ");
|
||||
switch (name->kind()) { // ### i should probably do this in OperatorNameId
|
||||
@@ -236,13 +236,13 @@ void NamePrettyPrinter::visit(OperatorNameId *name)
|
||||
} // switch
|
||||
}
|
||||
|
||||
void NamePrettyPrinter::visit(ConversionNameId *name)
|
||||
void NamePrettyPrinter::visit(const ConversionNameId *name)
|
||||
{
|
||||
_name += QLatin1String("operator ");
|
||||
_name += overview()->prettyType(name->type());
|
||||
}
|
||||
|
||||
void NamePrettyPrinter::visit(QualifiedNameId *name)
|
||||
void NamePrettyPrinter::visit(const QualifiedNameId *name)
|
||||
{
|
||||
if (name->isGlobal())
|
||||
_name += QLatin1String("::");
|
||||
@@ -254,15 +254,14 @@ void NamePrettyPrinter::visit(QualifiedNameId *name)
|
||||
}
|
||||
}
|
||||
|
||||
void NamePrettyPrinter::visit(SelectorNameId *name)
|
||||
void NamePrettyPrinter::visit(const SelectorNameId *name)
|
||||
{
|
||||
for (unsigned i = 0; i < name->nameCount(); ++i) {
|
||||
Name *n = name->nameAt(i);
|
||||
const Name *n = name->nameAt(i);
|
||||
if (!n)
|
||||
continue;
|
||||
|
||||
Identifier *id = n->identifier();
|
||||
if (id) {
|
||||
if (const Identifier *id = n->identifier()) {
|
||||
_name += QString::fromLatin1(id->chars(), id->size());
|
||||
|
||||
if (name->hasArguments() || name->nameCount() > 1)
|
||||
|
@@ -44,18 +44,18 @@ public:
|
||||
virtual ~NamePrettyPrinter();
|
||||
|
||||
const Overview *overview() const;
|
||||
QString operator()(Name *name);
|
||||
QString operator()(const Name *name);
|
||||
|
||||
protected:
|
||||
QString switchName(const QString &name = QString());
|
||||
|
||||
virtual void visit(NameId *name);
|
||||
virtual void visit(TemplateNameId *name);
|
||||
virtual void visit(DestructorNameId *name);
|
||||
virtual void visit(OperatorNameId *name);
|
||||
virtual void visit(ConversionNameId *name);
|
||||
virtual void visit(QualifiedNameId *name);
|
||||
virtual void visit(SelectorNameId *name);
|
||||
virtual void visit(const NameId *name);
|
||||
virtual void visit(const TemplateNameId *name);
|
||||
virtual void visit(const DestructorNameId *name);
|
||||
virtual void visit(const OperatorNameId *name);
|
||||
virtual void visit(const ConversionNameId *name);
|
||||
virtual void visit(const QualifiedNameId *name);
|
||||
virtual void visit(const SelectorNameId *name);
|
||||
|
||||
private:
|
||||
const Overview *_overview;
|
||||
|
@@ -117,13 +117,13 @@ void Overview::setShowFullyQualifiedNamed(bool showFullyQualifiedNames)
|
||||
_showFullyQualifiedNames = showFullyQualifiedNames;
|
||||
}
|
||||
|
||||
QString Overview::prettyName(Name *name) const
|
||||
QString Overview::prettyName(const Name *name) const
|
||||
{
|
||||
NamePrettyPrinter pp(this);
|
||||
return pp(name);
|
||||
}
|
||||
|
||||
QString Overview::prettyType(const FullySpecifiedType &ty, Name *name) const
|
||||
QString Overview::prettyType(const FullySpecifiedType &ty, const Name *name) const
|
||||
{
|
||||
return prettyType(ty, prettyName(name));
|
||||
}
|
||||
|
@@ -66,14 +66,14 @@ public:
|
||||
int markedArgumentEnd() const;
|
||||
void setMarkedArgumentEnd(int end);
|
||||
|
||||
QString operator()(Name *name) const
|
||||
QString operator()(const Name *name) const
|
||||
{ return prettyName(name); }
|
||||
|
||||
QString operator()(const FullySpecifiedType &type, Name *name = 0) const
|
||||
QString operator()(const FullySpecifiedType &type, const Name *name = 0) const
|
||||
{ return prettyType(type, name); }
|
||||
|
||||
QString prettyName(Name *name) const;
|
||||
QString prettyType(const FullySpecifiedType &type, Name *name = 0) const;
|
||||
QString prettyName(const Name *name) const;
|
||||
QString prettyType(const FullySpecifiedType &type, const Name *name = 0) const;
|
||||
QString prettyType(const FullySpecifiedType &type, const QString &name) const;
|
||||
|
||||
private:
|
||||
|
@@ -181,11 +181,11 @@ bool ResolveExpression::visit(NewExpressionAST *ast)
|
||||
|
||||
bool ResolveExpression::visit(TypeidExpressionAST *)
|
||||
{
|
||||
Name *std_type_info[2];
|
||||
const Name *std_type_info[2];
|
||||
std_type_info[0] = control()->nameId(control()->findOrInsertIdentifier("std"));
|
||||
std_type_info[1] = control()->nameId(control()->findOrInsertIdentifier("type_info"));
|
||||
|
||||
Name *q = control()->qualifiedNameId(std_type_info, 2, /*global=*/ true);
|
||||
const Name *q = control()->qualifiedNameId(std_type_info, 2, /*global=*/ true);
|
||||
FullySpecifiedType ty(control()->namedType(q));
|
||||
addResult(ty);
|
||||
|
||||
@@ -226,7 +226,7 @@ bool ResolveExpression::visit(SizeofExpressionAST *)
|
||||
bool ResolveExpression::visit(NumericLiteralAST *ast)
|
||||
{
|
||||
Type *type = 0;
|
||||
NumericLiteral *literal = numericLiteral(ast->literal_token);
|
||||
const NumericLiteral *literal = numericLiteral(ast->literal_token);
|
||||
|
||||
if (literal->isChar())
|
||||
type = control()->integerType(IntegerType::Char);
|
||||
@@ -277,8 +277,8 @@ bool ResolveExpression::visit(ThisExpressionAST *)
|
||||
FullySpecifiedType ptrTy(control()->pointerType(classTy));
|
||||
addResult(ptrTy, fun);
|
||||
break;
|
||||
} else if (QualifiedNameId *q = fun->name()->asQualifiedNameId()) {
|
||||
Name *nestedNameSpecifier = 0;
|
||||
} else if (const QualifiedNameId *q = fun->name()->asQualifiedNameId()) {
|
||||
const Name *nestedNameSpecifier = 0;
|
||||
if (q->nameCount() == 1 && q->isGlobal())
|
||||
nestedNameSpecifier = q->nameAt(0);
|
||||
else
|
||||
@@ -355,7 +355,7 @@ bool ResolveExpression::visit(CompoundLiteralAST *ast)
|
||||
bool ResolveExpression::visit(QualifiedNameAST *ast)
|
||||
{
|
||||
ResolveClass resolveClass;
|
||||
Name *name = ast->name;
|
||||
const Name *name = ast->name;
|
||||
|
||||
QList<Symbol *> symbols = _context.resolve(name);
|
||||
foreach (Symbol *symbol, symbols) {
|
||||
@@ -451,7 +451,7 @@ bool ResolveExpression::visit(CallAST *ast)
|
||||
++actualArgumentCount;
|
||||
}
|
||||
|
||||
Name *functionCallOp = control()->operatorNameId(OperatorNameId::FunctionCallOp);
|
||||
const Name *functionCallOp = control()->operatorNameId(OperatorNameId::FunctionCallOp);
|
||||
|
||||
foreach (const LookupItem &result, baseResults) {
|
||||
FullySpecifiedType ty = result.type().simplified();
|
||||
@@ -495,7 +495,7 @@ bool ResolveExpression::visit(ArrayAccessAST *ast)
|
||||
const QList<LookupItem> indexResults = operator()(ast->expression);
|
||||
ResolveClass resolveClass;
|
||||
|
||||
Name *arrayAccessOp = control()->operatorNameId(OperatorNameId::ArrayAccessOp);
|
||||
const Name *arrayAccessOp = control()->operatorNameId(OperatorNameId::ArrayAccessOp);
|
||||
|
||||
foreach (const LookupItem &result, baseResults) {
|
||||
FullySpecifiedType ty = result.type().simplified();
|
||||
@@ -537,7 +537,7 @@ bool ResolveExpression::visit(MemberAccessAST *ast)
|
||||
QList<LookupItem> baseResults = _results;
|
||||
|
||||
// Evaluate the expression-id that follows the access operator.
|
||||
Name *memberName = 0;
|
||||
const Name *memberName = 0;
|
||||
if (ast->member_name)
|
||||
memberName = ast->member_name->name;
|
||||
|
||||
@@ -594,7 +594,7 @@ ResolveExpression::resolveBaseExpression(const QList<LookupItem> &baseResults, i
|
||||
|
||||
if (NamedType *namedTy = ty->asNamedType()) {
|
||||
ResolveClass resolveClass;
|
||||
Name *arrowAccessOp = control()->operatorNameId(OperatorNameId::ArrowOp);
|
||||
const Name *arrowAccessOp = control()->operatorNameId(OperatorNameId::ArrowOp);
|
||||
const QList<Symbol *> candidates = resolveClass(namedTy->name(), result, _context);
|
||||
|
||||
foreach (Symbol *classObject, candidates) {
|
||||
@@ -663,7 +663,7 @@ ResolveExpression::resolveBaseExpression(const QList<LookupItem> &baseResults, i
|
||||
QList<LookupItem>
|
||||
ResolveExpression::resolveMemberExpression(const QList<LookupItem> &baseResults,
|
||||
unsigned accessOp,
|
||||
Name *memberName,
|
||||
const Name *memberName,
|
||||
bool *replacedDotOperator) const
|
||||
{
|
||||
ResolveClass resolveClass;
|
||||
@@ -677,7 +677,7 @@ ResolveExpression::resolveMemberExpression(const QList<LookupItem> &baseResults,
|
||||
results += resolveMember(memberName, klass);
|
||||
|
||||
else if (NamedType *namedTy = ty->asNamedType()) {
|
||||
Name *className = namedTy->name();
|
||||
const Name *className = namedTy->name();
|
||||
const QList<Symbol *> classes = resolveClass(className, r, _context);
|
||||
|
||||
foreach (Symbol *c, classes) {
|
||||
@@ -691,8 +691,8 @@ ResolveExpression::resolveMemberExpression(const QList<LookupItem> &baseResults,
|
||||
}
|
||||
|
||||
QList<LookupItem>
|
||||
ResolveExpression::resolveMember(Name *memberName, Class *klass,
|
||||
Name *className) const
|
||||
ResolveExpression::resolveMember(const Name *memberName, Class *klass,
|
||||
const Name *className) const
|
||||
{
|
||||
QList<LookupItem> results;
|
||||
|
||||
@@ -709,21 +709,21 @@ ResolveExpression::resolveMember(Name *memberName, Class *klass,
|
||||
|
||||
foreach (Symbol *candidate, candidates) {
|
||||
FullySpecifiedType ty = candidate->type();
|
||||
Name *unqualifiedNameId = className;
|
||||
const Name *unqualifiedNameId = className;
|
||||
|
||||
if (QualifiedNameId *q = className->asQualifiedNameId())
|
||||
if (const QualifiedNameId *q = className->asQualifiedNameId())
|
||||
unqualifiedNameId = q->unqualifiedNameId();
|
||||
|
||||
if (TemplateNameId *templId = unqualifiedNameId->asTemplateNameId()) {
|
||||
if (const TemplateNameId *templId = unqualifiedNameId->asTemplateNameId()) {
|
||||
GenTemplateInstance::Substitution subst;
|
||||
|
||||
for (unsigned i = 0; i < templId->templateArgumentCount(); ++i) {
|
||||
FullySpecifiedType templArgTy = templId->templateArgumentAt(i);
|
||||
|
||||
if (i < klass->templateParameterCount()) {
|
||||
Name *templArgName = klass->templateParameterAt(i)->name();
|
||||
const Name *templArgName = klass->templateParameterAt(i)->name();
|
||||
if (templArgName && templArgName->identifier()) {
|
||||
Identifier *templArgId = templArgName->identifier();
|
||||
const Identifier *templArgId = templArgName->identifier();
|
||||
subst.append(qMakePair(templArgId, templArgTy));
|
||||
}
|
||||
}
|
||||
@@ -741,7 +741,7 @@ ResolveExpression::resolveMember(Name *memberName, Class *klass,
|
||||
|
||||
|
||||
QList<LookupItem>
|
||||
ResolveExpression::resolveMember(Name *memberName, ObjCClass *klass) const
|
||||
ResolveExpression::resolveMember(const Name *memberName, ObjCClass *klass) const
|
||||
{
|
||||
QList<LookupItem> results;
|
||||
|
||||
@@ -774,7 +774,7 @@ bool ResolveExpression::visit(ObjCMessageExpressionAST *ast)
|
||||
if (!receiverResults.isEmpty()) {
|
||||
LookupItem result = receiverResults.first();
|
||||
FullySpecifiedType ty = result.type().simplified();
|
||||
Name *klassName = 0;
|
||||
const Name *klassName = 0;
|
||||
|
||||
if (const ObjCClass *classTy = ty->asObjCClassType()) {
|
||||
// static access, e.g.:
|
||||
@@ -805,7 +805,7 @@ bool ResolveExpression::visit(ObjCMessageExpressionAST *ast)
|
||||
ResolveClass::ResolveClass()
|
||||
{ }
|
||||
|
||||
QList<Symbol *> ResolveClass::operator()(Name *name,
|
||||
QList<Symbol *> ResolveClass::operator()(const Name *name,
|
||||
const LookupItem &p,
|
||||
const LookupContext &context)
|
||||
{
|
||||
@@ -815,7 +815,7 @@ QList<Symbol *> ResolveClass::operator()(Name *name,
|
||||
return symbols;
|
||||
}
|
||||
|
||||
QList<Symbol *> ResolveClass::resolveClass(Name *name,
|
||||
QList<Symbol *> ResolveClass::resolveClass(const Name *name,
|
||||
const LookupItem &p,
|
||||
const LookupContext &context)
|
||||
{
|
||||
@@ -873,7 +873,7 @@ QList<Symbol *> ResolveClass::resolveClass(Name *name,
|
||||
ResolveObjCClass::ResolveObjCClass()
|
||||
{}
|
||||
|
||||
QList<Symbol *> ResolveObjCClass::operator ()(Name *name,
|
||||
QList<Symbol *> ResolveObjCClass::operator ()(const Name *name,
|
||||
const LookupItem &p,
|
||||
const LookupContext &context)
|
||||
{
|
||||
|
@@ -48,17 +48,17 @@ public:
|
||||
|
||||
QList<LookupItem> resolveMemberExpression(const QList<LookupItem> &baseResults,
|
||||
unsigned accessOp,
|
||||
Name *memberName,
|
||||
const Name *memberName,
|
||||
bool *replacedDotOperator = 0) const;
|
||||
|
||||
QList<LookupItem> resolveBaseExpression(const QList<LookupItem> &baseResults,
|
||||
int accessOp,
|
||||
bool *replacedDotOperator = 0) const;
|
||||
|
||||
QList<LookupItem> resolveMember(Name *memberName, Class *klass,
|
||||
Name *className = 0) const;
|
||||
QList<LookupItem> resolveMember(const Name *memberName, Class *klass,
|
||||
const Name *className = 0) const;
|
||||
|
||||
QList<LookupItem> resolveMember(Name *memberName, ObjCClass *klass) const;
|
||||
QList<LookupItem> resolveMember(const Name *memberName, ObjCClass *klass) const;
|
||||
|
||||
protected:
|
||||
QList<LookupItem> switchResults(const QList<LookupItem> &symbols);
|
||||
@@ -125,12 +125,12 @@ class CPLUSPLUS_EXPORT ResolveClass
|
||||
public:
|
||||
ResolveClass();
|
||||
|
||||
QList<Symbol *> operator()(Name *name,
|
||||
QList<Symbol *> operator()(const Name *name,
|
||||
const LookupItem &p,
|
||||
const LookupContext &context);
|
||||
|
||||
private:
|
||||
QList<Symbol *> resolveClass(Name *name,
|
||||
QList<Symbol *> resolveClass(const Name *name,
|
||||
const LookupItem &p,
|
||||
const LookupContext &context);
|
||||
|
||||
@@ -143,7 +143,7 @@ class CPLUSPLUS_EXPORT ResolveObjCClass
|
||||
public:
|
||||
ResolveObjCClass();
|
||||
|
||||
QList<Symbol *> operator()(Name *name,
|
||||
QList<Symbol *> operator()(const Name *name,
|
||||
const LookupItem &p,
|
||||
const LookupContext &context);
|
||||
};
|
||||
|
@@ -327,7 +327,7 @@ void TypePrettyPrinter::visit(Function *type)
|
||||
if (index + 1 == _overview->markedArgument())
|
||||
const_cast<Overview*>(_overview)->setMarkedArgumentBegin(_text.length());
|
||||
|
||||
Name *name = 0;
|
||||
const Name *name = 0;
|
||||
|
||||
if (_overview->showArgumentNames())
|
||||
name = arg->name();
|
||||
|
@@ -1462,6 +1462,10 @@ bool Preprocessor::isQtReservedWord(const QByteArray ¯oId) const
|
||||
return true;
|
||||
else if (size == 6 && macroId.at(0) == 'Q' && macroId == "Q_SLOT")
|
||||
return true;
|
||||
else if (size == 3 && macroId.at(0) == 'Q' && macroId == "Q_D")
|
||||
return true;
|
||||
else if (size == 3 && macroId.at(0) == 'Q' && macroId == "Q_Q")
|
||||
return true;
|
||||
else if (size == 6 && macroId.at(0) == 'S' && macroId == "SIGNAL")
|
||||
return true;
|
||||
else if (size == 4 && macroId.at(0) == 'S' && macroId == "SLOT")
|
||||
|
@@ -9,31 +9,41 @@
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
DetailsWidget::DetailsWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_summaryLabel(new QLabel(this)),
|
||||
m_detailsButton(new DetailsButton(this)),
|
||||
m_widget(0),
|
||||
m_toolWidget(0),
|
||||
m_grid(new QGridLayout(this))
|
||||
namespace {
|
||||
const int MARGIN=8;
|
||||
}
|
||||
|
||||
// This widget is using a grid layout and places the items
|
||||
// in the following way:
|
||||
//
|
||||
// +------------+-------------------------+---------------+
|
||||
// + toolWidget | summaryLabel | detailsButton |
|
||||
// +------------+-------------------------+---------------+
|
||||
// | | widget |
|
||||
// +------------+-------------------------+---------------+
|
||||
|
||||
DetailsWidget::DetailsWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
m_detailsButton(new DetailsButton(this)),
|
||||
m_grid(new QGridLayout(this)),
|
||||
m_summaryLabel(new QLabel(this)),
|
||||
m_toolWidget(0),
|
||||
m_widget(0),
|
||||
m_hovered(false)
|
||||
{
|
||||
m_grid->setContentsMargins(4, 3, 4, 3);
|
||||
|
||||
m_summaryLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||
m_summaryLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
m_summaryLabel->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
|
||||
|
||||
m_grid->addWidget(m_summaryLabel, 0, 0);
|
||||
m_grid->addWidget(m_detailsButton, 0, 2, 1, 1, Qt::AlignBottom);
|
||||
m_grid->setContentsMargins(0, 0, 0, 0);
|
||||
m_grid->setSpacing(0);
|
||||
m_grid->addWidget(m_summaryLabel, 0, 1);
|
||||
m_grid->addWidget(m_detailsButton, 0, 2, 1, 1, Qt::AlignCenter);
|
||||
|
||||
m_dummyWidget = new QWidget(this);
|
||||
m_dummyWidget->setMaximumHeight(4);
|
||||
m_dummyWidget->setMaximumHeight(4);
|
||||
m_dummyWidget->setVisible(false);
|
||||
m_grid->addWidget(m_dummyWidget, 2, 0, 1, 1);
|
||||
m_detailsButton->setEnabled(false);
|
||||
|
||||
connect(m_detailsButton, SIGNAL(clicked()),
|
||||
this, SLOT(detailsButtonClicked()));
|
||||
connect(m_detailsButton, SIGNAL(toggled(bool)),
|
||||
this, SLOT(setExpanded(bool)));
|
||||
}
|
||||
|
||||
DetailsWidget::~DetailsWidget()
|
||||
@@ -43,53 +53,36 @@ DetailsWidget::~DetailsWidget()
|
||||
|
||||
void DetailsWidget::paintEvent(QPaintEvent *paintEvent)
|
||||
{
|
||||
//TL--> ___________ <-- TR
|
||||
// | |
|
||||
//ML-> ______________| <--MM | <--MR
|
||||
// | |
|
||||
//BL-> |_________________________| <-- BR
|
||||
|
||||
|
||||
QWidget::paintEvent(paintEvent);
|
||||
|
||||
if (!m_detailsButton->isToggled())
|
||||
return;
|
||||
|
||||
const QRect detailsGeometry = m_detailsButton->geometry();
|
||||
const QRect widgetGeometry = m_widget ? m_widget->geometry() : QRect(x(), y() + height(), width(), 0);
|
||||
|
||||
QPoint tl(detailsGeometry.topLeft());
|
||||
tl += QPoint(-3, -3);
|
||||
|
||||
QPoint tr(detailsGeometry.topRight());
|
||||
tr += QPoint(3, -3);
|
||||
|
||||
QPoint mm(detailsGeometry.left() - 3, widgetGeometry.top() - 3);
|
||||
|
||||
QPoint ml(1, mm.y());
|
||||
|
||||
QPoint mr(tr.x(), mm.y());
|
||||
|
||||
int bottom = geometry().height() - 3;
|
||||
QPoint bl(1, bottom);
|
||||
QPoint br(tr.x(), bottom);
|
||||
|
||||
QPainter p(this);
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
p.setPen(Qt::NoPen);
|
||||
|
||||
p.setBrush(palette().dark());
|
||||
p.drawRoundedRect(QRect(tl, br), 5, 5);
|
||||
p.drawRoundedRect(QRect(ml, br), 5, 5);
|
||||
const QRect paintArea(m_summaryLabel->geometry().topLeft(),
|
||||
contentsRect().bottomRight());
|
||||
|
||||
if (!isExpanded()) {
|
||||
if (m_collapsedPixmap.isNull() ||
|
||||
m_collapsedPixmap.size() != size())
|
||||
m_collapsedPixmap = cacheBackground(paintArea.size(), false);
|
||||
p.drawPixmap(paintArea, m_collapsedPixmap);
|
||||
} else {
|
||||
if (m_expandedPixmap.isNull() ||
|
||||
m_expandedPixmap.size() != size())
|
||||
m_expandedPixmap = cacheBackground(paintArea.size(), true);
|
||||
p.drawPixmap(paintArea, m_expandedPixmap);
|
||||
}
|
||||
}
|
||||
|
||||
void DetailsWidget::detailsButtonClicked()
|
||||
void DetailsWidget::enterEvent(QEvent * event)
|
||||
{
|
||||
bool visible = m_detailsButton->isToggled();
|
||||
if (m_widget)
|
||||
m_widget->setVisible(visible);
|
||||
m_dummyWidget->setVisible(visible);
|
||||
fixUpLayout();
|
||||
QWidget::enterEvent(event);
|
||||
changeHoverState(true);
|
||||
}
|
||||
|
||||
void DetailsWidget::leaveEvent(QEvent * event)
|
||||
{
|
||||
QWidget::leaveEvent(event);
|
||||
changeHoverState(false);
|
||||
}
|
||||
|
||||
void DetailsWidget::setSummaryText(const QString &text)
|
||||
@@ -102,15 +95,21 @@ QString DetailsWidget::summaryText() const
|
||||
return m_summaryLabel->text();
|
||||
}
|
||||
|
||||
bool DetailsWidget::expanded() const
|
||||
bool DetailsWidget::isExpanded() const
|
||||
{
|
||||
return m_detailsButton->isToggled();
|
||||
if (!m_widget)
|
||||
return false;
|
||||
return m_widget->isVisible();
|
||||
}
|
||||
|
||||
void DetailsWidget::setExpanded(bool v)
|
||||
void DetailsWidget::setExpanded(bool visible)
|
||||
{
|
||||
if (expanded() != v)
|
||||
m_detailsButton->animateClick();
|
||||
if (!m_widget)
|
||||
return;
|
||||
|
||||
m_summaryLabel->setEnabled(!visible);
|
||||
m_widget->setVisible(visible);
|
||||
m_detailsButton->setChecked(visible);
|
||||
}
|
||||
|
||||
QWidget *DetailsWidget::widget() const
|
||||
@@ -122,31 +121,40 @@ void DetailsWidget::setWidget(QWidget *widget)
|
||||
{
|
||||
if (m_widget == widget)
|
||||
return;
|
||||
if (m_widget) {
|
||||
|
||||
const bool wasExpanded(isExpanded());
|
||||
|
||||
if (m_widget)
|
||||
m_grid->removeWidget(m_widget);
|
||||
m_widget = 0;
|
||||
}
|
||||
m_widget = widget;
|
||||
|
||||
if (widget) {
|
||||
m_grid->addWidget(widget, 1, 0, 1, 3);
|
||||
m_widget = widget;
|
||||
bool visible = m_detailsButton->isToggled();
|
||||
m_widget->setVisible(visible);
|
||||
m_dummyWidget->setVisible(visible);
|
||||
m_widget->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
|
||||
m_grid->addWidget(widget, 1, 1, 1, 2);
|
||||
setExpanded(wasExpanded);
|
||||
} else {
|
||||
m_detailsButton->setEnabled(false);
|
||||
}
|
||||
m_detailsButton->setEnabled(0 != m_widget);
|
||||
}
|
||||
|
||||
void DetailsWidget::setToolWidget(QWidget *widget)
|
||||
{
|
||||
if (m_toolWidget == widget)
|
||||
return;
|
||||
if (m_toolWidget) {
|
||||
m_grid->removeWidget(m_toolWidget);
|
||||
m_toolWidget = 0;
|
||||
}
|
||||
if (widget) {
|
||||
m_grid->addWidget(widget, 0, 1, 1, 1, Qt::AlignBottom);
|
||||
m_toolWidget = widget;
|
||||
}
|
||||
|
||||
m_toolWidget = widget;
|
||||
|
||||
if (!m_toolWidget)
|
||||
return;
|
||||
|
||||
m_toolWidget->adjustSize();
|
||||
m_grid->addWidget(m_toolWidget, 0, 0, 1, 1, Qt::AlignCenter);
|
||||
|
||||
m_grid->setColumnMinimumWidth(0, m_toolWidget->width());
|
||||
m_grid->setRowMinimumHeight(0, m_toolWidget->height());
|
||||
|
||||
changeHoverState(m_hovered);
|
||||
}
|
||||
|
||||
QWidget *DetailsWidget::toolWidget() const
|
||||
@@ -154,25 +162,35 @@ QWidget *DetailsWidget::toolWidget() const
|
||||
return m_toolWidget;
|
||||
}
|
||||
|
||||
// This function works around a qt limitation.
|
||||
// In a deeply nested widget structure, nested layouts
|
||||
// tell their parents per a delayed invocation that they
|
||||
// need to repaint. Thus hiding a widget triggers
|
||||
// one relayout (and repaint) for each level of widget
|
||||
// nesting. We circumvent that, by forcing a update()
|
||||
// activate() on the widget after hiding.
|
||||
void DetailsWidget::fixUpLayout()
|
||||
QPixmap DetailsWidget::cacheBackground(const QSize &size, bool expanded)
|
||||
{
|
||||
if (!m_widget)
|
||||
return;
|
||||
QWidget *parent = m_widget;
|
||||
QStack<QWidget *> widgets;
|
||||
while((parent = parent->parentWidget()) && parent && parent->layout()) {
|
||||
widgets.push(parent);
|
||||
parent->layout()->update();
|
||||
QLinearGradient lg;
|
||||
lg.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||
lg.setFinalStop(0, 1);
|
||||
|
||||
lg.setColorAt(0, palette().color(QPalette::Midlight));
|
||||
lg.setColorAt(1, palette().color(QPalette::Button));
|
||||
|
||||
QPixmap pixmap(size);
|
||||
QPainter p(&pixmap);
|
||||
p.setBrush(lg);
|
||||
p.setPen(QPen(palette().color(QPalette::Mid)));
|
||||
|
||||
p.drawRect(0, 0, size.width() - 1, size.height() - 1);
|
||||
|
||||
if (expanded) {
|
||||
p.drawLine(0, m_summaryLabel->height(),
|
||||
size.width(), m_summaryLabel->height());
|
||||
}
|
||||
|
||||
while(!widgets.isEmpty()) {
|
||||
widgets.pop()->layout()->activate();
|
||||
}
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
void DetailsWidget::changeHoverState(bool hovered)
|
||||
{
|
||||
m_hovered = hovered;
|
||||
if (!m_toolWidget)
|
||||
return;
|
||||
|
||||
m_toolWidget->setVisible(m_hovered);
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "utils_global.h"
|
||||
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -17,7 +18,8 @@ class QTCREATOR_UTILS_EXPORT DetailsWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString summaryText READ summaryText WRITE setSummaryText DESIGNABLE true)
|
||||
Q_PROPERTY(bool expanded READ expanded WRITE setExpanded DESIGNABLE true)
|
||||
Q_PROPERTY(bool expanded READ isExpanded WRITE setExpanded DESIGNABLE true)
|
||||
|
||||
public:
|
||||
DetailsWidget(QWidget *parent = 0);
|
||||
~DetailsWidget();
|
||||
@@ -25,8 +27,7 @@ public:
|
||||
void setSummaryText(const QString &text);
|
||||
QString summaryText() const;
|
||||
|
||||
bool expanded() const;
|
||||
void setExpanded(bool);
|
||||
bool isExpanded() const;
|
||||
|
||||
void setWidget(QWidget *widget);
|
||||
QWidget *widget() const;
|
||||
@@ -34,21 +35,28 @@ public:
|
||||
void setToolWidget(QWidget *widget);
|
||||
QWidget *toolWidget() const;
|
||||
|
||||
public slots:
|
||||
void setExpanded(bool);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *paintEvent);
|
||||
|
||||
private slots:
|
||||
void detailsButtonClicked();
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
|
||||
private:
|
||||
void fixUpLayout();
|
||||
QLabel *m_summaryLabel;
|
||||
DetailsButton *m_detailsButton;
|
||||
QPixmap cacheBackground(const QSize &size, bool expanded);
|
||||
void changeHoverState(bool hovered);
|
||||
|
||||
QWidget *m_widget;
|
||||
QWidget *m_toolWidget;
|
||||
QWidget *m_dummyWidget;
|
||||
DetailsButton *m_detailsButton;
|
||||
QGridLayout *m_grid;
|
||||
QLabel *m_summaryLabel;
|
||||
QWidget *m_toolWidget;
|
||||
QWidget *m_widget;
|
||||
|
||||
QPixmap m_collapsedPixmap;
|
||||
QPixmap m_expandedPixmap;
|
||||
|
||||
bool m_hovered;
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -63,7 +63,7 @@ ProjectIntroPage::ProjectIntroPage(QWidget *parent) :
|
||||
m_d->m_ui.setupUi(this);
|
||||
hideStatusLabel();
|
||||
m_d->m_ui.nameLineEdit->setInitialText(tr("<Enter_Name>"));
|
||||
m_d->m_ui.nameLineEdit->setFocus(Qt::TabFocusReason);
|
||||
m_d->m_ui.nameLineEdit->setFocus();
|
||||
connect(m_d->m_ui.pathChooser, SIGNAL(changed(QString)), this, SLOT(slotChanged()));
|
||||
connect(m_d->m_ui.nameLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotChanged()));
|
||||
connect(m_d->m_ui.pathChooser, SIGNAL(returnPressed()), this, SLOT(slotActivated()));
|
||||
@@ -98,6 +98,7 @@ void ProjectIntroPage::setPath(const QString &path)
|
||||
void ProjectIntroPage::setName(const QString &name)
|
||||
{
|
||||
m_d->m_ui.nameLineEdit->setText(name);
|
||||
m_d->m_ui.nameLineEdit->selectAll();
|
||||
}
|
||||
|
||||
QString ProjectIntroPage::description() const
|
||||
|
165
src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
Normal file
165
src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
Normal file
@@ -0,0 +1,165 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "cmakeproject.h"
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace Internal;
|
||||
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeProject *pro)
|
||||
: BuildConfiguration(pro), m_toolChain(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(BuildConfiguration *source)
|
||||
: BuildConfiguration(source), m_toolChain(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration::~CMakeBuildConfiguration()
|
||||
{
|
||||
delete m_toolChain;
|
||||
}
|
||||
|
||||
CMakeProject *CMakeBuildConfiguration::cmakeProject() const
|
||||
{
|
||||
return static_cast<CMakeProject *>(project());
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment CMakeBuildConfiguration::baseEnvironment() const
|
||||
{
|
||||
ProjectExplorer::Environment env = useSystemEnvironment() ?
|
||||
ProjectExplorer::Environment(QProcess::systemEnvironment()) :
|
||||
ProjectExplorer::Environment();
|
||||
return env;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment CMakeBuildConfiguration::environment() const
|
||||
{
|
||||
ProjectExplorer::Environment env = baseEnvironment();
|
||||
env.modify(userEnvironmentChanges());
|
||||
return env;
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::setUseSystemEnvironment(bool b)
|
||||
{
|
||||
if (b == useSystemEnvironment())
|
||||
return;
|
||||
setValue("clearSystemEnvironment", !b);
|
||||
emit environmentChanged();
|
||||
}
|
||||
|
||||
bool CMakeBuildConfiguration::useSystemEnvironment() const
|
||||
{
|
||||
bool b = !(value("clearSystemEnvironment").isValid() &&
|
||||
value("clearSystemEnvironment").toBool());
|
||||
return b;
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::EnvironmentItem> CMakeBuildConfiguration::userEnvironmentChanges() const
|
||||
{
|
||||
return ProjectExplorer::EnvironmentItem::fromStringList(value("userEnvironmentChanges").toStringList());
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff)
|
||||
{
|
||||
QStringList list = ProjectExplorer::EnvironmentItem::toStringList(diff);
|
||||
if (list == value("userEnvironmentChanges"))
|
||||
return;
|
||||
setValue("userEnvironmentChanges", list);
|
||||
emit environmentChanged();
|
||||
}
|
||||
|
||||
QString CMakeBuildConfiguration::buildDirectory() const
|
||||
{
|
||||
QString buildDirectory = value("buildDirectory").toString();
|
||||
if (buildDirectory.isEmpty())
|
||||
buildDirectory = cmakeProject()->sourceDirectory() + "/qtcreator-build";
|
||||
return buildDirectory;
|
||||
}
|
||||
|
||||
QString CMakeBuildConfiguration::buildParser() const
|
||||
{
|
||||
// TODO this is actually slightly wrong, but do i care?
|
||||
// this should call toolchain(configuration)
|
||||
if (!m_toolChain)
|
||||
return QString::null;
|
||||
if (m_toolChain->type() == ProjectExplorer::ToolChain::GCC
|
||||
//|| m_toolChain->type() == ProjectExplorer::ToolChain::LinuxICC
|
||||
|| m_toolChain->type() == ProjectExplorer::ToolChain::MinGW) {
|
||||
return ProjectExplorer::Constants::BUILD_PARSER_GCC;
|
||||
} else if (m_toolChain->type() == ProjectExplorer::ToolChain::MSVC
|
||||
|| m_toolChain->type() == ProjectExplorer::ToolChain::WINCE) {
|
||||
return ProjectExplorer::Constants::BUILD_PARSER_MSVC;
|
||||
}
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType CMakeBuildConfiguration::toolChainType() const
|
||||
{
|
||||
if (m_toolChain)
|
||||
return m_toolChain->type();
|
||||
return ProjectExplorer::ToolChain::UNKNOWN;
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain *CMakeBuildConfiguration::toolChain() const
|
||||
{
|
||||
return m_toolChain;
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::updateToolChain(const QString &compiler)
|
||||
{
|
||||
//qDebug()<<"CodeBlocks Compilername"<<compiler
|
||||
ProjectExplorer::ToolChain *newToolChain = 0;
|
||||
if (compiler == "gcc") {
|
||||
#ifdef Q_OS_WIN
|
||||
newToolChain = ProjectExplorer::ToolChain::createMinGWToolChain("gcc", QString());
|
||||
#else
|
||||
newToolChain = ProjectExplorer::ToolChain::createGccToolChain("gcc");
|
||||
#endif
|
||||
} else if (compiler == "msvc8") {
|
||||
newToolChain = ProjectExplorer::ToolChain::createMSVCToolChain(value("msvcVersion").toString(), false);
|
||||
} else {
|
||||
}
|
||||
|
||||
if (ProjectExplorer::ToolChain::equals(newToolChain, m_toolChain)) {
|
||||
delete newToolChain;
|
||||
newToolChain = 0;
|
||||
} else {
|
||||
delete m_toolChain;
|
||||
m_toolChain = newToolChain;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
73
src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
Normal file
73
src/plugins/cmakeprojectmanager/cmakebuildconfiguration.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef CMAKEBUILDCONFIGURATION_H
|
||||
#define CMAKEBUILDCONFIGURATION_H
|
||||
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class CMakeProject;
|
||||
|
||||
class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CMakeBuildConfiguration(CMakeProject *pro);
|
||||
CMakeBuildConfiguration(BuildConfiguration *source);
|
||||
~CMakeBuildConfiguration();
|
||||
|
||||
CMakeProject *cmakeProject() const;
|
||||
|
||||
ProjectExplorer::Environment environment() const;
|
||||
ProjectExplorer::Environment baseEnvironment() const;
|
||||
void setUserEnvironmentChanges(const QList<ProjectExplorer::EnvironmentItem> &diff);
|
||||
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges() const;
|
||||
bool useSystemEnvironment() const;
|
||||
void setUseSystemEnvironment(bool b);
|
||||
|
||||
virtual QString buildDirectory() const;
|
||||
QString buildParser() const;
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
||||
ProjectExplorer::ToolChain *toolChain() const;
|
||||
|
||||
void updateToolChain(const QString &compiler);
|
||||
private:
|
||||
ProjectExplorer::ToolChain *m_toolChain;
|
||||
};
|
||||
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
|
||||
#endif // CMAKEBUILDCONFIGURATION_H
|
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "cmakebuildenvironmentwidget.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include <projectexplorer/environmenteditmodel.h>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QCheckBox>
|
||||
@@ -41,7 +42,7 @@ using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
|
||||
CMakeBuildEnvironmentWidget::CMakeBuildEnvironmentWidget(CMakeProject *project)
|
||||
: BuildConfigWidget(), m_pro(project)
|
||||
: BuildConfigWidget(), m_pro(project), m_buildConfiguration(0)
|
||||
{
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
vbox->setMargin(0);
|
||||
@@ -63,29 +64,26 @@ QString CMakeBuildEnvironmentWidget::displayName() const
|
||||
return tr("Build Environment");
|
||||
}
|
||||
|
||||
void CMakeBuildEnvironmentWidget::init(const QString &buildConfigurationName)
|
||||
void CMakeBuildEnvironmentWidget::init(ProjectExplorer::BuildConfiguration *bc)
|
||||
{
|
||||
if (debug)
|
||||
qDebug() << "Qt4BuildConfigWidget::init()";
|
||||
|
||||
m_buildConfiguration = buildConfigurationName;
|
||||
m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
|
||||
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(buildConfigurationName);
|
||||
m_clearSystemEnvironmentCheckBox->setChecked(!m_pro->useSystemEnvironment(bc));
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(bc));
|
||||
m_buildEnvironmentWidget->setUserChanges(m_pro->userEnvironmentChanges(bc));
|
||||
m_clearSystemEnvironmentCheckBox->setChecked(!m_buildConfiguration->useSystemEnvironment());
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
||||
m_buildEnvironmentWidget->setUserChanges(m_buildConfiguration->userEnvironmentChanges());
|
||||
m_buildEnvironmentWidget->updateButtons();
|
||||
}
|
||||
|
||||
void CMakeBuildEnvironmentWidget::environmentModelUserChangesUpdated()
|
||||
{
|
||||
m_pro->setUserEnvironmentChanges(
|
||||
m_pro->buildConfiguration(m_buildConfiguration), m_buildEnvironmentWidget->userChanges());
|
||||
m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges());
|
||||
}
|
||||
|
||||
void CMakeBuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked)
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
|
||||
m_pro->setUseSystemEnvironment(bc, !checked);
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(bc));
|
||||
m_buildConfiguration->setUseSystemEnvironment(!checked);
|
||||
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
||||
}
|
||||
|
@@ -42,6 +42,7 @@ class EnvironmentWidget;
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
class CMakeProject;
|
||||
class CMakeBuildConfiguration;
|
||||
|
||||
class CMakeBuildEnvironmentWidget : public ProjectExplorer::BuildConfigWidget
|
||||
{
|
||||
@@ -51,7 +52,7 @@ public:
|
||||
CMakeBuildEnvironmentWidget(CMakeProject *project);
|
||||
|
||||
QString displayName() const;
|
||||
void init(const QString &buildConfiguration);
|
||||
void init(ProjectExplorer::BuildConfiguration *bc);
|
||||
|
||||
private slots:
|
||||
void environmentModelUserChangesUpdated();
|
||||
@@ -61,7 +62,7 @@ private:
|
||||
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
|
||||
QCheckBox *m_clearSystemEnvironmentCheckBox;
|
||||
CMakeProject *m_pro;
|
||||
QString m_buildConfiguration;
|
||||
CMakeBuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include "makestep.h"
|
||||
#include "cmakeopenprojectwizard.h"
|
||||
#include "cmakebuildenvironmentwidget.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <cpptools/cppmodelmanagerinterface.h>
|
||||
@@ -89,7 +90,7 @@ QString CMakeBuildConfigurationFactory::displayNameForType(const QString & /* ty
|
||||
return tr("Create");
|
||||
}
|
||||
|
||||
bool CMakeBuildConfigurationFactory::create(const QString &type) const
|
||||
BuildConfiguration *CMakeBuildConfigurationFactory::create(const QString &type) const
|
||||
{
|
||||
QTC_ASSERT(type == "Create", return false);
|
||||
|
||||
@@ -103,19 +104,20 @@ bool CMakeBuildConfigurationFactory::create(const QString &type) const
|
||||
&ok);
|
||||
if (!ok || buildConfigurationName.isEmpty())
|
||||
return false;
|
||||
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
|
||||
BuildConfiguration *bc = new CMakeBuildConfiguration(m_project);
|
||||
bc->setDisplayName(buildConfigurationName);
|
||||
|
||||
MakeStep *makeStep = new MakeStep(m_project, bc);
|
||||
MakeStep *makeStep = new MakeStep(bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
|
||||
MakeStep *cleanMakeStep = new MakeStep(m_project, bc);
|
||||
MakeStep *cleanMakeStep = new MakeStep(bc);
|
||||
bc->insertCleanStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setClean(true);
|
||||
|
||||
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
||||
m_project->sourceDirectory(),
|
||||
m_project->buildDirectory(bc),
|
||||
m_project->environment(bc));
|
||||
bc->buildDirectory(),
|
||||
bc->environment());
|
||||
if (copw.exec() != QDialog::Accepted) {
|
||||
delete bc;
|
||||
return false;
|
||||
@@ -129,7 +131,20 @@ bool CMakeBuildConfigurationFactory::create(const QString &type) const
|
||||
// Default to all
|
||||
if (m_project->targets().contains("all"))
|
||||
makeStep->setBuildTarget("all", true);
|
||||
return true;
|
||||
return bc;
|
||||
}
|
||||
|
||||
BuildConfiguration *CMakeBuildConfigurationFactory::clone(ProjectExplorer::BuildConfiguration *source) const
|
||||
{
|
||||
CMakeBuildConfiguration *old = static_cast<CMakeBuildConfiguration *>(source);
|
||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(old);
|
||||
return bc;
|
||||
}
|
||||
|
||||
BuildConfiguration *CMakeBuildConfigurationFactory::restore() const
|
||||
{
|
||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(m_project);
|
||||
return bc;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -140,7 +155,6 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
||||
m_fileName(fileName),
|
||||
m_buildConfigurationFactory(new CMakeBuildConfigurationFactory(this)),
|
||||
m_rootNode(new CMakeProjectNode(m_fileName)),
|
||||
m_toolChain(0),
|
||||
m_insideFileChanged(false)
|
||||
{
|
||||
m_file = new CMakeFile(this, fileName);
|
||||
@@ -149,7 +163,11 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
||||
CMakeProject::~CMakeProject()
|
||||
{
|
||||
delete m_rootNode;
|
||||
delete m_toolChain;
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration *CMakeProject::activeCMakeBuildConfiguration() const
|
||||
{
|
||||
return static_cast<CMakeBuildConfiguration *>(activeBuildConfiguration());
|
||||
}
|
||||
|
||||
IBuildConfigurationFactory *CMakeProject::buildConfigurationFactory() const
|
||||
@@ -163,7 +181,7 @@ void CMakeProject::slotActiveBuildConfiguration()
|
||||
// Pop up a dialog asking the user to rerun cmake
|
||||
QFileInfo sourceFileInfo(m_fileName);
|
||||
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBC)));
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
|
||||
QFileInfo cbpFileFi(cbpFile);
|
||||
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
|
||||
if (!cbpFileFi.exists()) {
|
||||
@@ -180,9 +198,9 @@ void CMakeProject::slotActiveBuildConfiguration()
|
||||
if (mode != CMakeOpenProjectWizard::Nothing) {
|
||||
CMakeOpenProjectWizard copw(m_manager,
|
||||
sourceFileInfo.absolutePath(),
|
||||
buildDirectory(activeBC),
|
||||
activeBC->buildDirectory(),
|
||||
mode,
|
||||
environment(activeBC));
|
||||
activeBC->environment());
|
||||
copw.exec();
|
||||
activeBC->setValue("msvcVersion", copw.msvcVersion());
|
||||
}
|
||||
@@ -200,39 +218,6 @@ void CMakeProject::fileChanged(const QString &fileName)
|
||||
m_insideFileChanged = false;
|
||||
}
|
||||
|
||||
void CMakeProject::updateToolChain(const QString &compiler)
|
||||
{
|
||||
//qDebug()<<"CodeBlocks Compilername"<<compiler
|
||||
ProjectExplorer::ToolChain *newToolChain = 0;
|
||||
if (compiler == "gcc") {
|
||||
#ifdef Q_OS_WIN
|
||||
newToolChain = ProjectExplorer::ToolChain::createMinGWToolChain("gcc", QString());
|
||||
#else
|
||||
newToolChain = ProjectExplorer::ToolChain::createGccToolChain("gcc");
|
||||
#endif
|
||||
} else if (compiler == "msvc8") {
|
||||
newToolChain = ProjectExplorer::ToolChain::createMSVCToolChain(activeBuildConfiguration()->value("msvcVersion").toString(), false);
|
||||
} else {
|
||||
// TODO other toolchains
|
||||
qDebug()<<"Not implemented yet!!! Qt Creator doesn't know which toolchain to use for"<<compiler;
|
||||
}
|
||||
|
||||
if (ProjectExplorer::ToolChain::equals(newToolChain, m_toolChain)) {
|
||||
delete newToolChain;
|
||||
newToolChain = 0;
|
||||
} else {
|
||||
delete m_toolChain;
|
||||
m_toolChain = newToolChain;
|
||||
}
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain *CMakeProject::toolChain(BuildConfiguration *configuration) const
|
||||
{
|
||||
if (configuration != activeBuildConfiguration())
|
||||
qWarning()<<"CMakeProject asked for toolchain of a not active buildconfiguration";
|
||||
return m_toolChain;
|
||||
}
|
||||
|
||||
void CMakeProject::changeBuildDirectory(BuildConfiguration *configuration, const QString &newBuildDirectory)
|
||||
{
|
||||
configuration->setValue("buildDirectory", newBuildDirectory);
|
||||
@@ -247,7 +232,8 @@ QString CMakeProject::sourceDirectory() const
|
||||
bool CMakeProject::parseCMakeLists()
|
||||
{
|
||||
// Find cbp file
|
||||
QString cbpFile = CMakeManager::findCbpFile(buildDirectory(activeBuildConfiguration()));
|
||||
CMakeBuildConfiguration *activeBC = activeCMakeBuildConfiguration();
|
||||
QString cbpFile = CMakeManager::findCbpFile(activeBC->buildDirectory());
|
||||
|
||||
// setFolderName
|
||||
m_rootNode->setFolderName(QFileInfo(cbpFile).completeBaseName());
|
||||
@@ -256,7 +242,7 @@ bool CMakeProject::parseCMakeLists()
|
||||
//qDebug()<<"Parsing file "<<cbpFile;
|
||||
if (cbpparser.parseCbpFile(cbpFile)) {
|
||||
// ToolChain
|
||||
updateToolChain(cbpparser.compilerName());
|
||||
activeBC->updateToolChain(cbpparser.compilerName());
|
||||
|
||||
m_projectName = cbpparser.projectName();
|
||||
m_rootNode->setFolderName(cbpparser.projectName());
|
||||
@@ -309,7 +295,7 @@ bool CMakeProject::parseCMakeLists()
|
||||
|
||||
QStringList allIncludePaths;
|
||||
QStringList allFrameworkPaths;
|
||||
QList<ProjectExplorer::HeaderPath> allHeaderPaths = m_toolChain->systemHeaderPaths();
|
||||
QList<ProjectExplorer::HeaderPath> allHeaderPaths = activeBC->toolChain()->systemHeaderPaths();
|
||||
foreach (ProjectExplorer::HeaderPath headerPath, allHeaderPaths) {
|
||||
if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath)
|
||||
allFrameworkPaths.append(headerPath.path());
|
||||
@@ -325,12 +311,12 @@ bool CMakeProject::parseCMakeLists()
|
||||
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||
if (pinfo.includePaths != allIncludePaths
|
||||
|| pinfo.sourceFiles != m_files
|
||||
|| pinfo.defines != m_toolChain->predefinedMacros()
|
||||
|| pinfo.defines != activeBC->toolChain()->predefinedMacros()
|
||||
|| pinfo.frameworkPaths != allFrameworkPaths) {
|
||||
pinfo.includePaths = allIncludePaths;
|
||||
// TODO we only want C++ files, not all other stuff that might be in the project
|
||||
pinfo.sourceFiles = m_files;
|
||||
pinfo.defines = m_toolChain->predefinedMacros(); // TODO this is to simplistic
|
||||
pinfo.defines = activeBC->toolChain()->predefinedMacros(); // TODO this is to simplistic
|
||||
pinfo.frameworkPaths = allFrameworkPaths;
|
||||
modelmanager->updateProjectInfo(pinfo);
|
||||
modelmanager->updateSourceFiles(pinfo.sourceFiles);
|
||||
@@ -388,31 +374,12 @@ bool CMakeProject::parseCMakeLists()
|
||||
} else {
|
||||
// TODO report error
|
||||
qDebug()<<"Parsing failed";
|
||||
delete m_toolChain;
|
||||
m_toolChain = 0;
|
||||
activeBC->updateToolChain(QString::null);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QString CMakeProject::buildParser(BuildConfiguration *configuration) const
|
||||
{
|
||||
Q_UNUSED(configuration)
|
||||
// TODO this is actually slightly wrong, but do i care?
|
||||
// this should call toolchain(configuration)
|
||||
if (!m_toolChain)
|
||||
return QString::null;
|
||||
if (m_toolChain->type() == ProjectExplorer::ToolChain::GCC
|
||||
//|| m_toolChain->type() == ProjectExplorer::ToolChain::LinuxICC
|
||||
|| m_toolChain->type() == ProjectExplorer::ToolChain::MinGW) {
|
||||
return ProjectExplorer::Constants::BUILD_PARSER_GCC;
|
||||
} else if (m_toolChain->type() == ProjectExplorer::ToolChain::MSVC
|
||||
|| m_toolChain->type() == ProjectExplorer::ToolChain::WINCE) {
|
||||
return ProjectExplorer::Constants::BUILD_PARSER_MSVC;
|
||||
}
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
QStringList CMakeProject::targets() const
|
||||
{
|
||||
QStringList results;
|
||||
@@ -535,8 +502,6 @@ QString CMakeProject::name() const
|
||||
return m_projectName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Core::IFile *CMakeProject::file() const
|
||||
{
|
||||
return m_file;
|
||||
@@ -557,56 +522,6 @@ bool CMakeProject::isApplication() const
|
||||
return true;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment CMakeProject::baseEnvironment(BuildConfiguration *configuration) const
|
||||
{
|
||||
Environment env = useSystemEnvironment(configuration) ? Environment(QProcess::systemEnvironment()) : Environment();
|
||||
return env;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment CMakeProject::environment(BuildConfiguration *configuration) const
|
||||
{
|
||||
Environment env = baseEnvironment(configuration);
|
||||
env.modify(userEnvironmentChanges(configuration));
|
||||
return env;
|
||||
}
|
||||
|
||||
void CMakeProject::setUseSystemEnvironment(BuildConfiguration *configuration, bool b)
|
||||
{
|
||||
if (b == useSystemEnvironment(configuration))
|
||||
return;
|
||||
configuration->setValue("clearSystemEnvironment", !b);
|
||||
emit environmentChanged(configuration->name());
|
||||
}
|
||||
|
||||
bool CMakeProject::useSystemEnvironment(BuildConfiguration *configuration) const
|
||||
{
|
||||
bool b = !(configuration->value("clearSystemEnvironment").isValid() &&
|
||||
configuration->value("clearSystemEnvironment").toBool());
|
||||
return b;
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::EnvironmentItem> CMakeProject::userEnvironmentChanges(BuildConfiguration *configuration) const
|
||||
{
|
||||
return EnvironmentItem::fromStringList(configuration->value("userEnvironmentChanges").toStringList());
|
||||
}
|
||||
|
||||
void CMakeProject::setUserEnvironmentChanges(BuildConfiguration *configuration, const QList<ProjectExplorer::EnvironmentItem> &diff)
|
||||
{
|
||||
QStringList list = EnvironmentItem::toStringList(diff);
|
||||
if (list == configuration->value("userEnvironmentChanges"))
|
||||
return;
|
||||
configuration->setValue("userEnvironmentChanges", list);
|
||||
emit environmentChanged(configuration->name());
|
||||
}
|
||||
|
||||
QString CMakeProject::buildDirectory(BuildConfiguration *configuration) const
|
||||
{
|
||||
QString buildDirectory = configuration->value("buildDirectory").toString();
|
||||
if (buildDirectory.isEmpty())
|
||||
buildDirectory = sourceDirectory() + "/qtcreator-build";
|
||||
return buildDirectory;
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *CMakeProject::createConfigWidget()
|
||||
{
|
||||
return new CMakeBuildSettingsWidget(this);
|
||||
@@ -649,18 +564,19 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
if (copw.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
|
||||
ProjectExplorer::BuildConfiguration *bc = new ProjectExplorer::BuildConfiguration("all");
|
||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(this);
|
||||
bc->setDisplayName("all");
|
||||
addBuildConfiguration(bc);
|
||||
bc->setValue("msvcVersion", copw.msvcVersion());
|
||||
if (!copw.buildDirectory().isEmpty())
|
||||
bc->setValue("buildDirectory", copw.buildDirectory());
|
||||
|
||||
// Now create a standard build configuration
|
||||
makeStep = new MakeStep(this, bc);
|
||||
makeStep = new MakeStep(bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
|
||||
//TODO save arguments somewhere copw.arguments()
|
||||
MakeStep *cleanMakeStep = new MakeStep(this, bc);
|
||||
MakeStep *cleanMakeStep = new MakeStep(bc);
|
||||
bc->insertCleanStep(0, cleanMakeStep);
|
||||
cleanMakeStep->setClean(true);
|
||||
setActiveBuildConfiguration(bc);
|
||||
@@ -668,10 +584,8 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
// We have a user file, but we could still be missing the cbp file
|
||||
// or simply run createXml with the saved settings
|
||||
QFileInfo sourceFileInfo(m_fileName);
|
||||
QStringList needToCreate;
|
||||
QStringList needToUpdate;
|
||||
BuildConfiguration *activeBC = activeBuildConfiguration();
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBC)));
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
|
||||
QFileInfo cbpFileFi(cbpFile);
|
||||
|
||||
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
|
||||
@@ -683,9 +597,9 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
if (mode != CMakeOpenProjectWizard::Nothing) {
|
||||
CMakeOpenProjectWizard copw(m_manager,
|
||||
sourceFileInfo.absolutePath(),
|
||||
buildDirectory(activeBC),
|
||||
activeBC->buildDirectory(),
|
||||
mode,
|
||||
environment(activeBC));
|
||||
activeBC->environment());
|
||||
if (copw.exec() != QDialog::Accepted)
|
||||
return false;
|
||||
activeBC->setValue("msvcVersion", copw.msvcVersion());
|
||||
@@ -714,13 +628,6 @@ CMakeTarget CMakeProject::targetForTitle(const QString &title)
|
||||
return CMakeTarget();
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType CMakeProject::toolChainType() const
|
||||
{
|
||||
if (m_toolChain)
|
||||
return m_toolChain->type();
|
||||
return ProjectExplorer::ToolChain::UNKNOWN;
|
||||
}
|
||||
|
||||
// CMakeFile
|
||||
|
||||
CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
|
||||
@@ -779,7 +686,7 @@ void CMakeFile::modified(ReloadBehavior *behavior)
|
||||
}
|
||||
|
||||
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeProject *project)
|
||||
: m_project(project)
|
||||
: m_project(project), m_buildConfiguration(0)
|
||||
{
|
||||
QFormLayout *fl = new QFormLayout(this);
|
||||
fl->setContentsMargins(20, -1, 0, -1);
|
||||
@@ -808,12 +715,11 @@ QString CMakeBuildSettingsWidget::displayName() const
|
||||
return "CMake";
|
||||
}
|
||||
|
||||
void CMakeBuildSettingsWidget::init(const QString &buildConfigurationName)
|
||||
void CMakeBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||
{
|
||||
m_buildConfiguration = buildConfigurationName;
|
||||
BuildConfiguration *bc = m_project->buildConfiguration(buildConfigurationName);
|
||||
m_pathLineEdit->setText(m_project->buildDirectory(bc));
|
||||
if (m_project->buildDirectory(bc) == m_project->sourceDirectory())
|
||||
m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
|
||||
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
|
||||
if (m_buildConfiguration->buildDirectory() == m_project->sourceDirectory())
|
||||
m_changeButton->setEnabled(false);
|
||||
else
|
||||
m_changeButton->setEnabled(true);
|
||||
@@ -821,14 +727,13 @@ void CMakeBuildSettingsWidget::init(const QString &buildConfigurationName)
|
||||
|
||||
void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
|
||||
{
|
||||
BuildConfiguration *bc = m_project->buildConfiguration(m_buildConfiguration);
|
||||
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
||||
m_project->sourceDirectory(),
|
||||
m_project->buildDirectory(bc),
|
||||
m_project->environment(bc));
|
||||
m_buildConfiguration->buildDirectory(),
|
||||
m_buildConfiguration->environment());
|
||||
if (copw.exec() == QDialog::Accepted) {
|
||||
m_project->changeBuildDirectory(bc, copw.buildDirectory());
|
||||
m_pathLineEdit->setText(m_project->buildDirectory(bc));
|
||||
m_project->changeBuildDirectory(m_buildConfiguration, copw.buildDirectory());
|
||||
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "cmakeprojectmanager.h"
|
||||
#include "cmakeprojectnodes.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "makestep.h"
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
@@ -73,7 +74,9 @@ public:
|
||||
QStringList availableCreationTypes() const;
|
||||
QString displayNameForType(const QString &type) const;
|
||||
|
||||
bool create(const QString &type) const;
|
||||
ProjectExplorer::BuildConfiguration *create(const QString &type) const;
|
||||
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::BuildConfiguration *source) const;
|
||||
ProjectExplorer::BuildConfiguration *restore() const;
|
||||
|
||||
private:
|
||||
CMakeProject *m_project;
|
||||
@@ -88,6 +91,8 @@ public:
|
||||
CMakeProject(CMakeManager *manager, const QString &filename);
|
||||
~CMakeProject();
|
||||
|
||||
CMakeBuildConfiguration *activeCMakeBuildConfiguration() const;
|
||||
|
||||
virtual QString name() const;
|
||||
virtual Core::IFile *file() const;
|
||||
virtual ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
|
||||
@@ -97,16 +102,6 @@ public:
|
||||
|
||||
virtual bool isApplication() const;
|
||||
|
||||
//building environment
|
||||
ProjectExplorer::Environment environment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
ProjectExplorer::Environment baseEnvironment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
void setUserEnvironmentChanges(ProjectExplorer::BuildConfiguration *configuration, const QList<ProjectExplorer::EnvironmentItem> &diff);
|
||||
QList<ProjectExplorer::EnvironmentItem> userEnvironmentChanges(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
bool useSystemEnvironment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
void setUseSystemEnvironment(ProjectExplorer::BuildConfiguration *configuration, bool b);
|
||||
|
||||
virtual QString buildDirectory(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
virtual ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
||||
|
||||
@@ -114,12 +109,10 @@ public:
|
||||
|
||||
virtual QStringList files(FilesMode fileMode) const;
|
||||
QStringList targets() const;
|
||||
QString buildParser(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
CMakeTarget targetForTitle(const QString &title);
|
||||
|
||||
QString sourceDirectory() const;
|
||||
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
||||
ProjectExplorer::ToolChain *toolChain(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
protected:
|
||||
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
||||
@@ -134,7 +127,6 @@ private slots:
|
||||
|
||||
private:
|
||||
bool parseCMakeLists();
|
||||
void updateToolChain(const QString &compiler);
|
||||
|
||||
void buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list);
|
||||
void gatherFileNodes(ProjectExplorer::FolderNode *parent, QList<ProjectExplorer::FileNode *> &list);
|
||||
@@ -150,7 +142,6 @@ private:
|
||||
CMakeProjectNode *m_rootNode;
|
||||
QStringList m_files;
|
||||
QList<CMakeTarget> m_targets;
|
||||
ProjectExplorer::ToolChain *m_toolChain;
|
||||
ProjectExplorer::FileWatcher *m_watcher;
|
||||
bool m_insideFileChanged;
|
||||
QSet<QString> m_watchedFiles;
|
||||
@@ -230,14 +221,14 @@ public:
|
||||
|
||||
// This is called to set up the config widget before showing it
|
||||
// buildConfiguration is QString::null for the non buildConfiguration specific page
|
||||
virtual void init(const QString &buildConfiguration);
|
||||
virtual void init(ProjectExplorer::BuildConfiguration *bc);
|
||||
private slots:
|
||||
void openChangeBuildDirectoryDialog();
|
||||
private:
|
||||
CMakeProject *m_project;
|
||||
QLineEdit *m_pathLineEdit;
|
||||
QPushButton *m_changeButton;
|
||||
QString m_buildConfiguration;
|
||||
CMakeBuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -10,7 +10,8 @@ HEADERS = cmakeproject.h \
|
||||
makestep.h \
|
||||
cmakerunconfiguration.h \
|
||||
cmakeopenprojectwizard.h \
|
||||
cmakebuildenvironmentwidget.h
|
||||
cmakebuildenvironmentwidget.h \
|
||||
cmakebuildconfiguration.h
|
||||
SOURCES = cmakeproject.cpp \
|
||||
cmakeprojectplugin.cpp \
|
||||
cmakeprojectmanager.cpp \
|
||||
@@ -18,7 +19,8 @@ SOURCES = cmakeproject.cpp \
|
||||
makestep.cpp \
|
||||
cmakerunconfiguration.cpp \
|
||||
cmakeopenprojectwizard.cpp \
|
||||
cmakebuildenvironmentwidget.cpp
|
||||
cmakebuildenvironmentwidget.cpp \
|
||||
cmakebuildconfiguration.cpp
|
||||
RESOURCES += cmakeproject.qrc
|
||||
FORMS +=
|
||||
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "cmakerunconfiguration.h"
|
||||
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
|
||||
#include <projectexplorer/environment.h>
|
||||
@@ -58,12 +59,19 @@ CMakeRunConfiguration::CMakeRunConfiguration(CMakeProject *pro, const QString &t
|
||||
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
|
||||
this, SIGNAL(baseEnvironmentChanged()));
|
||||
|
||||
connect(pro, SIGNAL(environmentChanged(QString)),
|
||||
this, SIGNAL(baseEnvironmentChanged()));
|
||||
// TODO
|
||||
// connect(pro, SIGNAL(environmentChanged(ProjectExplorer::BuildConfiguration *)),
|
||||
// this, SIGNAL(baseEnvironmentChanged()));
|
||||
}
|
||||
|
||||
CMakeRunConfiguration::~CMakeRunConfiguration()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CMakeProject *CMakeRunConfiguration::cmakeProject() const
|
||||
{
|
||||
return static_cast<CMakeProject *>(project());
|
||||
}
|
||||
|
||||
QString CMakeRunConfiguration::type() const
|
||||
@@ -186,7 +194,7 @@ ProjectExplorer::Environment CMakeRunConfiguration::baseEnvironment() const
|
||||
} else if (m_baseEnvironmentBase == CMakeRunConfiguration::SystemEnvironmentBase) {
|
||||
env = ProjectExplorer::Environment::systemEnvironment();
|
||||
} else if (m_baseEnvironmentBase == CMakeRunConfiguration::BuildEnvironmentBase) {
|
||||
env = project()->environment(project()->activeBuildConfiguration());
|
||||
env = project()->activeBuildConfiguration()->environment();
|
||||
}
|
||||
return env;
|
||||
}
|
||||
@@ -226,8 +234,8 @@ void CMakeRunConfiguration::setUserEnvironmentChanges(const QList<ProjectExplore
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType CMakeRunConfiguration::toolChainType() const
|
||||
{
|
||||
CMakeProject *pro = static_cast<CMakeProject *>(project());
|
||||
return pro->toolChainType();
|
||||
CMakeBuildConfiguration *bc = cmakeProject()->activeCMakeBuildConfiguration();
|
||||
return bc->toolChainType();
|
||||
}
|
||||
|
||||
// Configuration widget
|
||||
|
@@ -53,6 +53,8 @@ class CMakeRunConfiguration : public ProjectExplorer::LocalApplicationRunConfigu
|
||||
public:
|
||||
CMakeRunConfiguration(CMakeProject *pro, const QString &target, const QString &workingDirectory, const QString &title);
|
||||
virtual ~CMakeRunConfiguration();
|
||||
CMakeProject *cmakeProject() const;
|
||||
|
||||
virtual QString type() const;
|
||||
virtual QString executable() const;
|
||||
virtual RunMode runMode() const;
|
||||
|
@@ -29,6 +29,7 @@
|
||||
#include "makestep.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
|
||||
@@ -42,15 +43,14 @@ using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
MakeStep::MakeStep(CMakeProject *pro, BuildConfiguration *bc)
|
||||
: AbstractMakeStep(pro, bc), m_pro(pro), m_clean(false), m_futureInterface(0)
|
||||
MakeStep::MakeStep(BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bc), m_clean(false), m_futureInterface(0)
|
||||
{
|
||||
m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
|
||||
}
|
||||
|
||||
MakeStep::MakeStep(MakeStep *bs, BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bs, bc),
|
||||
m_pro(bs->m_pro),
|
||||
m_clean(bs->m_clean),
|
||||
m_futureInterface(0),
|
||||
m_buildTargets(bs->m_buildTargets),
|
||||
@@ -64,6 +64,11 @@ MakeStep::~MakeStep()
|
||||
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration *MakeStep::cmakeBuildConfiguration() const
|
||||
{
|
||||
return static_cast<CMakeBuildConfiguration *>(buildConfiguration());
|
||||
}
|
||||
|
||||
void MakeStep::setClean(bool clean)
|
||||
{
|
||||
m_clean = clean;
|
||||
@@ -96,18 +101,18 @@ void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
|
||||
bool MakeStep::init()
|
||||
{
|
||||
BuildConfiguration *bc = buildConfiguration();
|
||||
setBuildParser(m_pro->buildParser(bc));
|
||||
CMakeBuildConfiguration *bc = cmakeBuildConfiguration();
|
||||
setBuildParser(bc->buildParser());
|
||||
|
||||
setEnabled(true);
|
||||
setWorkingDirectory(m_pro->buildDirectory(bc));
|
||||
setWorkingDirectory(bc->buildDirectory());
|
||||
|
||||
setCommand(m_pro->toolChain(bc)->makeCommand());
|
||||
setCommand(bc->toolChain()->makeCommand());
|
||||
|
||||
QStringList arguments = m_buildTargets;
|
||||
arguments << additionalArguments();
|
||||
setArguments(arguments);
|
||||
setEnvironment(m_pro->environment(bc));
|
||||
setEnvironment(bc->environment());
|
||||
setIgnoreReturnValue(m_clean);
|
||||
|
||||
return AbstractMakeStep::init();
|
||||
@@ -154,11 +159,6 @@ void MakeStep::stdOut(const QString &line)
|
||||
AbstractMakeStep::stdOut(line);
|
||||
}
|
||||
|
||||
CMakeProject *MakeStep::project() const
|
||||
{
|
||||
return m_pro;
|
||||
}
|
||||
|
||||
bool MakeStep::buildsTarget(const QString &target) const
|
||||
{
|
||||
return m_buildTargets.contains(target);
|
||||
@@ -206,7 +206,8 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
||||
fl->addRow(tr("Targets:"), m_targetsList);
|
||||
|
||||
// TODO update this list also on rescans of the CMakeLists.txt
|
||||
CMakeProject *pro = m_makeStep->project();
|
||||
// TODO shouldn't be accessing project
|
||||
CMakeProject *pro = m_makeStep->cmakeBuildConfiguration()->cmakeProject();
|
||||
foreach(const QString& target, pro->targets()) {
|
||||
QListWidgetItem *item = new QListWidgetItem(target, m_targetsList);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
@@ -255,11 +256,13 @@ void MakeStepConfigWidget::updateDetails()
|
||||
{
|
||||
QStringList arguments = m_makeStep->m_buildTargets;
|
||||
arguments << m_makeStep->additionalArguments();
|
||||
m_summaryText = tr("<b>Make:</b> %1 %2")
|
||||
.arg(m_makeStep->project()->toolChain(
|
||||
m_makeStep->buildConfiguration())
|
||||
->makeCommand(),
|
||||
arguments.join(" "));
|
||||
|
||||
CMakeBuildConfiguration *bc = m_makeStep->cmakeBuildConfiguration();
|
||||
ProjectExplorer::ToolChain *tc = bc->toolChain();
|
||||
if (tc)
|
||||
m_summaryText = tr("<b>Make:</b> %1 %2").arg(tc->makeCommand(), arguments.join(" "));
|
||||
else
|
||||
m_summaryText = tr("<b>Unknown Toolchain</b>");
|
||||
emit updateSummary();
|
||||
}
|
||||
|
||||
@@ -277,12 +280,10 @@ bool MakeStepFactory::canCreate(const QString &name) const
|
||||
return (Constants::MAKESTEP == name);
|
||||
}
|
||||
|
||||
BuildStep *MakeStepFactory::create(Project *project, BuildConfiguration *bc, const QString &name) const
|
||||
BuildStep *MakeStepFactory::create(BuildConfiguration *bc, const QString &name) const
|
||||
{
|
||||
Q_ASSERT(name == Constants::MAKESTEP);
|
||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||
Q_ASSERT(pro);
|
||||
return new MakeStep(pro, bc);
|
||||
return new MakeStep(bc);
|
||||
}
|
||||
|
||||
BuildStep *MakeStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) const
|
||||
@@ -290,7 +291,7 @@ BuildStep *MakeStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) const
|
||||
return new MakeStep(static_cast<MakeStep *>(bs), bc);
|
||||
}
|
||||
|
||||
QStringList MakeStepFactory::canCreateForProject(Project * /* pro */) const
|
||||
QStringList MakeStepFactory::canCreateForBuildConfiguration(BuildConfiguration * /* pro */) const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ QT_END_NAMESPACE
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class CMakeProject;
|
||||
class CMakeBuildConfiguration;
|
||||
|
||||
class MakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
{
|
||||
@@ -49,9 +49,12 @@ class MakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
friend class MakeStepConfigWidget; // TODO remove
|
||||
// This is for modifying internal data
|
||||
public:
|
||||
MakeStep(CMakeProject *pro, ProjectExplorer::BuildConfiguration *bc);
|
||||
MakeStep(ProjectExplorer::BuildConfiguration *bc);
|
||||
MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
||||
~MakeStep();
|
||||
|
||||
CMakeBuildConfiguration *cmakeBuildConfiguration() const;
|
||||
|
||||
virtual bool init();
|
||||
|
||||
virtual void run(QFutureInterface<bool> &fi);
|
||||
@@ -60,7 +63,6 @@ public:
|
||||
virtual QString displayName();
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
CMakeProject *project() const;
|
||||
bool buildsTarget(const QString &target) const;
|
||||
void setBuildTarget(const QString &target, bool on);
|
||||
QStringList additionalArguments() const;
|
||||
@@ -77,7 +79,6 @@ protected:
|
||||
// For parsing [ 76%]
|
||||
virtual void stdOut(const QString &line);
|
||||
private:
|
||||
CMakeProject *m_pro;
|
||||
bool m_clean;
|
||||
QRegExp m_percentProgress;
|
||||
QFutureInterface<bool> *m_futureInterface;
|
||||
@@ -107,9 +108,9 @@ private:
|
||||
class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
{
|
||||
virtual bool canCreate(const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro, ProjectExplorer::BuildConfiguration *bc, const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc, const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const;
|
||||
virtual QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
|
||||
virtual QStringList canCreateForBuildConfiguration(ProjectExplorer::BuildConfiguration *bc) const;
|
||||
virtual QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
|
||||
|
@@ -168,6 +168,7 @@ RESOURCES += core.qrc \
|
||||
|
||||
win32 {
|
||||
SOURCES += progressmanager/progressmanager_win.cpp
|
||||
LIBS += -lole32
|
||||
}
|
||||
else:macx {
|
||||
OBJECTIVE_SOURCES += progressmanager/progressmanager_mac.mm
|
||||
|
@@ -50,10 +50,7 @@ ProgressManagerPrivate::ProgressManagerPrivate(QObject *parent)
|
||||
|
||||
ProgressManagerPrivate::~ProgressManagerPrivate()
|
||||
{
|
||||
}
|
||||
|
||||
void ProgressManagerPrivate::init()
|
||||
{
|
||||
cleanup();
|
||||
}
|
||||
|
||||
void ProgressManagerPrivate::cancelTasks(const QString &type)
|
||||
|
@@ -29,6 +29,14 @@
|
||||
|
||||
#include "progressmanager_p.h"
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::init()
|
||||
{
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||
#import <AppKit/NSDockTile.h>
|
||||
#import <AppKit/NSApplication.h>
|
||||
|
@@ -48,6 +48,7 @@ public:
|
||||
ProgressManagerPrivate(QObject *parent = 0);
|
||||
~ProgressManagerPrivate();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
FutureProgress *addTask(const QFuture<void> &future, const QString &title, const QString &type,
|
||||
ProgressFlags flags);
|
||||
|
@@ -27,8 +27,93 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtGui/QMainWindow>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include "progressmanager_p.h"
|
||||
|
||||
// for windows progress bar
|
||||
#ifndef __GNUC__
|
||||
# include <shobjidl.h>
|
||||
#endif
|
||||
|
||||
// Windows 7 SDK required
|
||||
#ifdef __ITaskbarList3_INTERFACE_DEFINED__
|
||||
|
||||
namespace {
|
||||
int total = 0;
|
||||
ITaskbarList3* pITask = 0;
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::init()
|
||||
{
|
||||
CoInitialize(NULL);
|
||||
HRESULT hRes = CoCreateInstance(CLSID_TaskbarList,
|
||||
NULL,CLSCTX_INPROC_SERVER,
|
||||
IID_ITaskbarList3,(LPVOID*) &pITask);
|
||||
if (FAILED(hRes))
|
||||
{
|
||||
pITask = 0;
|
||||
CoUninitialize();
|
||||
return;
|
||||
}
|
||||
|
||||
pITask->HrInit();
|
||||
return;
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::cleanup()
|
||||
{
|
||||
if (pITask) {
|
||||
pITask->Release();
|
||||
pITask = NULL;
|
||||
CoUninitialize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
|
||||
{
|
||||
Q_UNUSED(text)
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::setApplicationProgressRange(int min, int max)
|
||||
{
|
||||
total = max-min;
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::setApplicationProgressValue(int value)
|
||||
{
|
||||
if (pITask) {
|
||||
WId winId = Core::ICore::instance()->mainWindow()->winId();
|
||||
pITask->SetProgressValue(winId, value, total);
|
||||
}
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::setApplicationProgressVisible(bool visible)
|
||||
{
|
||||
if (!pITask)
|
||||
return;
|
||||
|
||||
WId winId = Core::ICore::instance()->mainWindow()->winId();
|
||||
if (visible)
|
||||
pITask->SetProgressState(winId, TBPF_NORMAL);
|
||||
else
|
||||
pITask->SetProgressState(winId, TBPF_NOPROGRESS);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::init()
|
||||
{
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
|
||||
{
|
||||
Q_UNUSED(text)
|
||||
@@ -49,3 +134,6 @@ void Core::Internal::ProgressManagerPrivate::setApplicationProgressVisible(bool
|
||||
{
|
||||
Q_UNUSED(visible)
|
||||
}
|
||||
|
||||
|
||||
#endif // __ITaskbarList2_INTERFACE_DEFINED__
|
||||
|
@@ -29,6 +29,14 @@
|
||||
|
||||
#include "progressmanager_p.h"
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::init()
|
||||
{
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::cleanup()
|
||||
{
|
||||
}
|
||||
|
||||
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
|
||||
{
|
||||
Q_UNUSED(text)
|
||||
|
@@ -186,19 +186,20 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
class FindUses: protected ASTVisitor
|
||||
class FindLocalUses: protected ASTVisitor
|
||||
{
|
||||
Scope *_functionScope;
|
||||
|
||||
FindScope findScope;
|
||||
|
||||
public:
|
||||
FindUses(TranslationUnit *translationUnit)
|
||||
: ASTVisitor(translationUnit)
|
||||
FindLocalUses(TranslationUnit *translationUnit)
|
||||
: ASTVisitor(translationUnit), hasD(false), hasQ(false)
|
||||
{ }
|
||||
|
||||
// local and external uses.
|
||||
SemanticInfo::LocalUseMap localUses;
|
||||
bool hasD;
|
||||
bool hasQ;
|
||||
|
||||
void operator()(FunctionDefinitionAST *ast)
|
||||
{
|
||||
@@ -218,7 +219,7 @@ protected:
|
||||
if (! (ast && ast->name))
|
||||
return false;
|
||||
|
||||
Identifier *id = ast->name->identifier();
|
||||
const Identifier *id = ast->name->identifier();
|
||||
|
||||
if (scope) {
|
||||
for (Symbol *member = scope->lookat(id); member; member = member->next()) {
|
||||
@@ -357,6 +358,16 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool visit(QtMemberDeclarationAST *ast)
|
||||
{
|
||||
if (tokenKind(ast->q_token) == T_Q_D)
|
||||
hasD = true;
|
||||
else
|
||||
hasQ = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool visit(ExpressionOrDeclarationStatementAST *ast)
|
||||
{
|
||||
accept(ast->declaration);
|
||||
@@ -466,7 +477,7 @@ protected:
|
||||
|
||||
class FindFunctionDefinitions: protected SymbolVisitor
|
||||
{
|
||||
Name *_declarationName;
|
||||
const Name *_declarationName;
|
||||
QList<Function *> *_functions;
|
||||
|
||||
public:
|
||||
@@ -475,7 +486,7 @@ public:
|
||||
_functions(0)
|
||||
{ }
|
||||
|
||||
void operator()(Name *declarationName, Scope *globals,
|
||||
void operator()(const Name *declarationName, Scope *globals,
|
||||
QList<Function *> *functions)
|
||||
{
|
||||
_declarationName = declarationName;
|
||||
@@ -491,8 +502,8 @@ protected:
|
||||
|
||||
virtual bool visit(Function *function)
|
||||
{
|
||||
Name *name = function->name();
|
||||
if (QualifiedNameId *q = name->asQualifiedNameId())
|
||||
const Name *name = function->name();
|
||||
if (const QualifiedNameId *q = name->asQualifiedNameId())
|
||||
name = q->unqualifiedNameId();
|
||||
|
||||
if (_declarationName->isEqualTo(name))
|
||||
@@ -504,19 +515,19 @@ protected:
|
||||
|
||||
} // end of anonymous namespace
|
||||
|
||||
static QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const LookupContext &context)
|
||||
static const QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const LookupContext &context)
|
||||
{
|
||||
Name *symbolName = s->name();
|
||||
const Name *symbolName = s->name();
|
||||
if (! symbolName)
|
||||
return 0; // nothing to do.
|
||||
|
||||
QVector<Name *> names;
|
||||
QVector<const Name *> names;
|
||||
|
||||
for (Scope *scope = s->scope(); scope; scope = scope->enclosingScope()) {
|
||||
if (scope->isClassScope() || scope->isNamespaceScope()) {
|
||||
if (scope->owner() && scope->owner()->name()) {
|
||||
Name *ownerName = scope->owner()->name();
|
||||
if (QualifiedNameId *q = ownerName->asQualifiedNameId()) {
|
||||
const Name *ownerName = scope->owner()->name();
|
||||
if (const QualifiedNameId *q = ownerName->asQualifiedNameId()) {
|
||||
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||
names.prepend(q->nameAt(i));
|
||||
}
|
||||
@@ -527,7 +538,7 @@ static QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const LookupContext
|
||||
}
|
||||
}
|
||||
|
||||
if (QualifiedNameId *q = symbolName->asQualifiedNameId()) {
|
||||
if (const QualifiedNameId *q = symbolName->asQualifiedNameId()) {
|
||||
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||
names.append(q->nameAt(i));
|
||||
}
|
||||
@@ -929,6 +940,7 @@ void CPPEditor::updateMethodBoxIndex()
|
||||
}
|
||||
|
||||
void CPPEditor::highlightUses(const QList<SemanticInfo::Use> &uses,
|
||||
const SemanticInfo &semanticInfo,
|
||||
QList<QTextEdit::ExtraSelection> *selections)
|
||||
{
|
||||
bool isUnused = false;
|
||||
@@ -951,6 +963,14 @@ void CPPEditor::highlightUses(const QList<SemanticInfo::Use> &uses,
|
||||
sel.cursor.setPosition(anchor);
|
||||
sel.cursor.setPosition(position, QTextCursor::KeepAnchor);
|
||||
|
||||
if (isUnused) {
|
||||
if (semanticInfo.hasQ && sel.cursor.selectedText() == QLatin1String("q"))
|
||||
continue; // skip q
|
||||
|
||||
else if (semanticInfo.hasD && sel.cursor.selectedText() == QLatin1String("d"))
|
||||
continue; // skip d
|
||||
}
|
||||
|
||||
selections->append(sel);
|
||||
}
|
||||
}
|
||||
@@ -1001,27 +1021,28 @@ void CPPEditor::updateUsesNow()
|
||||
semanticRehighlight();
|
||||
}
|
||||
|
||||
static bool isCompatible(Name *name, Name *otherName)
|
||||
static bool isCompatible(const Name *name, const Name *otherName)
|
||||
{
|
||||
if (NameId *nameId = name->asNameId()) {
|
||||
if (TemplateNameId *otherTemplId = otherName->asTemplateNameId())
|
||||
if (const NameId *nameId = name->asNameId()) {
|
||||
if (const TemplateNameId *otherTemplId = otherName->asTemplateNameId())
|
||||
return nameId->identifier()->isEqualTo(otherTemplId->identifier());
|
||||
} else if (TemplateNameId *templId = name->asTemplateNameId()) {
|
||||
if (NameId *otherNameId = otherName->asNameId())
|
||||
} else if (const TemplateNameId *templId = name->asTemplateNameId()) {
|
||||
if (const NameId *otherNameId = otherName->asNameId())
|
||||
return templId->identifier()->isEqualTo(otherNameId->identifier());
|
||||
}
|
||||
|
||||
return name->isEqualTo(otherName);
|
||||
}
|
||||
|
||||
static bool isCompatible(Function *definition, Symbol *declaration, QualifiedNameId *declarationName)
|
||||
static bool isCompatible(Function *definition, Symbol *declaration,
|
||||
const QualifiedNameId *declarationName)
|
||||
{
|
||||
Function *declTy = declaration->type()->asFunctionType();
|
||||
if (! declTy)
|
||||
return false;
|
||||
|
||||
Name *definitionName = definition->name();
|
||||
if (QualifiedNameId *q = definitionName->asQualifiedNameId()) {
|
||||
const Name *definitionName = definition->name();
|
||||
if (const QualifiedNameId *q = definitionName->asQualifiedNameId()) {
|
||||
if (! isCompatible(q->unqualifiedNameId(), declaration->name()))
|
||||
return false;
|
||||
else if (q->nameCount() > declarationName->nameCount())
|
||||
@@ -1041,8 +1062,8 @@ static bool isCompatible(Function *definition, Symbol *declaration, QualifiedNam
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i != q->nameCount(); ++i) {
|
||||
Name *n = q->nameAt(q->nameCount() - i - 1);
|
||||
Name *m = declarationName->nameAt(declarationName->nameCount() - i - 1);
|
||||
const Name *n = q->nameAt(q->nameCount() - i - 1);
|
||||
const Name *m = declarationName->nameAt(declarationName->nameCount() - i - 1);
|
||||
if (! isCompatible(n, m))
|
||||
return false;
|
||||
}
|
||||
@@ -1085,7 +1106,7 @@ void CPPEditor::switchDeclarationDefinition()
|
||||
QList<LookupItem> resolvedSymbols = typeOfExpression(QString(), doc, lastSymbol);
|
||||
const LookupContext &context = typeOfExpression.lookupContext();
|
||||
|
||||
QualifiedNameId *q = qualifiedNameIdForSymbol(f, context);
|
||||
const QualifiedNameId *q = qualifiedNameIdForSymbol(f, context);
|
||||
QList<Symbol *> symbols = context.resolve(q);
|
||||
|
||||
Symbol *declaration = 0;
|
||||
@@ -1258,11 +1279,11 @@ Symbol *CPPEditor::findDefinition(Symbol *symbol)
|
||||
if (! funTy)
|
||||
return 0; // symbol does not have function type.
|
||||
|
||||
Name *name = symbol->name();
|
||||
const Name *name = symbol->name();
|
||||
if (! name)
|
||||
return 0; // skip anonymous functions!
|
||||
|
||||
if (QualifiedNameId *q = name->asQualifiedNameId())
|
||||
if (const QualifiedNameId *q = name->asQualifiedNameId())
|
||||
name = q->unqualifiedNameId();
|
||||
|
||||
// map from file names to function definitions.
|
||||
@@ -1681,9 +1702,9 @@ void CPPEditor::performQuickFix(int index)
|
||||
{
|
||||
CPPQuickFixCollector *quickFixCollector = CppPlugin::instance()->quickFixCollector();
|
||||
QuickFixOperationPtr op = m_quickFixes.at(index);
|
||||
//quickFixCollector->perform(op);
|
||||
op->createChangeSet();
|
||||
setChangeSet(op->changeSet());
|
||||
quickFixCollector->perform(op);
|
||||
//op->createChangeSet();
|
||||
//setChangeSet(op->changeSet());
|
||||
}
|
||||
|
||||
void CPPEditor::contextMenuEvent(QContextMenuEvent *e)
|
||||
@@ -1869,6 +1890,10 @@ void CPPEditor::setFontSettings(const TextEditor::FontSettings &fs)
|
||||
|
||||
m_occurrencesFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES));
|
||||
m_occurrencesUnusedFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES_UNUSED));
|
||||
m_occurrencesUnusedFormat.setUnderlineStyle(QTextCharFormat::WaveUnderline);
|
||||
m_occurrencesUnusedFormat.setUnderlineColor(m_occurrencesUnusedFormat.foreground().color());
|
||||
m_occurrencesUnusedFormat.clearForeground();
|
||||
m_occurrencesUnusedFormat.setToolTip(tr("Unused variable"));
|
||||
m_occurrenceRenameFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES_RENAME));
|
||||
|
||||
// only set the background, we do not want to modify foreground properties set by the syntax highlighter or the link
|
||||
@@ -1934,7 +1959,7 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
|
||||
int line = 0, column = 0;
|
||||
convertPosition(position(), &line, &column);
|
||||
|
||||
QList<QTextEdit::ExtraSelection> allSelections;
|
||||
QList<QTextEdit::ExtraSelection> unusedSelections;
|
||||
|
||||
m_renameSelections.clear();
|
||||
|
||||
@@ -1953,18 +1978,16 @@ void CPPEditor::updateSemanticInfo(const SemanticInfo &semanticInfo)
|
||||
}
|
||||
}
|
||||
|
||||
if (uses.size() == 1) {
|
||||
if (uses.size() == 1)
|
||||
// it's an unused declaration
|
||||
// highlightUses(uses, &allSelections);
|
||||
} else if (good) {
|
||||
QList<QTextEdit::ExtraSelection> selections;
|
||||
highlightUses(uses, &selections);
|
||||
m_renameSelections += selections;
|
||||
allSelections += selections;
|
||||
}
|
||||
highlightUses(uses, semanticInfo, &unusedSelections);
|
||||
|
||||
else if (good && m_renameSelections.isEmpty())
|
||||
highlightUses(uses, semanticInfo, &m_renameSelections);
|
||||
}
|
||||
|
||||
setExtraSelections(CodeSemanticsSelection, allSelections);
|
||||
setExtraSelections(UnusedSymbolSelection, unusedSelections);
|
||||
setExtraSelections(CodeSemanticsSelection, m_renameSelections);
|
||||
}
|
||||
|
||||
SemanticHighlighter::Source CPPEditor::currentSource(bool force)
|
||||
@@ -2078,7 +2101,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
|
||||
FunctionDefinitionUnderCursor functionDefinitionUnderCursor(translationUnit);
|
||||
FunctionDefinitionAST *currentFunctionDefinition = functionDefinitionUnderCursor(ast, source.line, source.column);
|
||||
|
||||
FindUses useTable(translationUnit);
|
||||
FindLocalUses useTable(translationUnit);
|
||||
useTable(currentFunctionDefinition);
|
||||
|
||||
SemanticInfo semanticInfo;
|
||||
@@ -2086,6 +2109,8 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
|
||||
semanticInfo.snapshot = snapshot;
|
||||
semanticInfo.doc = doc;
|
||||
semanticInfo.localUses = useTable.localUses;
|
||||
semanticInfo.hasQ = useTable.hasQ;
|
||||
semanticInfo.hasD = useTable.hasD;
|
||||
|
||||
return semanticInfo;
|
||||
}
|
||||
|
@@ -79,10 +79,12 @@ public:
|
||||
typedef QHashIterator<CPlusPlus::Symbol *, QList<Use> > LocalUseIterator;
|
||||
|
||||
SemanticInfo()
|
||||
: revision(-1)
|
||||
: revision(-1), hasQ(false), hasD(false)
|
||||
{ }
|
||||
|
||||
int revision;
|
||||
bool hasQ: 1;
|
||||
bool hasD: 1;
|
||||
CPlusPlus::Snapshot snapshot;
|
||||
CPlusPlus::Document::Ptr doc;
|
||||
LocalUseMap localUses;
|
||||
@@ -253,6 +255,7 @@ private:
|
||||
SemanticHighlighter::Source currentSource(bool force = false);
|
||||
|
||||
void highlightUses(const QList<SemanticInfo::Use> &uses,
|
||||
const SemanticInfo &semanticInfo,
|
||||
QList<QTextEdit::ExtraSelection> *selections);
|
||||
|
||||
void createToolBar(CPPEditorEditable *editable);
|
||||
|
@@ -138,7 +138,7 @@ void CppHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint
|
||||
}
|
||||
}
|
||||
|
||||
static QString buildHelpId(Symbol *symbol, Name *name)
|
||||
static QString buildHelpId(Symbol *symbol, const Name *name)
|
||||
{
|
||||
Scope *scope = 0;
|
||||
|
||||
@@ -161,13 +161,13 @@ static QString buildHelpId(Symbol *symbol, Name *name)
|
||||
Symbol *owner = scope->owner();
|
||||
|
||||
if (owner && owner->name() && ! scope->isEnumScope()) {
|
||||
Name *name = owner->name();
|
||||
Identifier *id = 0;
|
||||
const Name *name = owner->name();
|
||||
const Identifier *id = 0;
|
||||
|
||||
if (NameId *nameId = name->asNameId())
|
||||
if (const NameId *nameId = name->asNameId())
|
||||
id = nameId->identifier();
|
||||
|
||||
else if (TemplateNameId *nameId = name->asTemplateNameId())
|
||||
else if (const TemplateNameId *nameId = name->asTemplateNameId())
|
||||
id = nameId->identifier();
|
||||
|
||||
if (id)
|
||||
@@ -182,7 +182,7 @@ static QString buildHelpId(Symbol *symbol, Name *name)
|
||||
static FullySpecifiedType resolve(const FullySpecifiedType &ty,
|
||||
const LookupContext &context,
|
||||
Symbol **resolvedSymbol,
|
||||
Name **resolvedName)
|
||||
const Name **resolvedName)
|
||||
{
|
||||
Control *control = context.control();
|
||||
|
||||
@@ -272,8 +272,10 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
||||
if (!doc)
|
||||
return; // nothing to do
|
||||
|
||||
QString formatTooltip = edit->extraSelectionTooltip(pos);
|
||||
QTextCursor tc(edit->document());
|
||||
tc.setPosition(pos);
|
||||
|
||||
const unsigned lineNumber = tc.block().blockNumber() + 1;
|
||||
|
||||
// Find the last symbol up to the cursor position
|
||||
@@ -332,14 +334,14 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
||||
Symbol *lookupSymbol = result.lastVisibleSymbol(); // lookup symbol
|
||||
|
||||
Symbol *resolvedSymbol = lookupSymbol;
|
||||
Name *resolvedName = lookupSymbol ? lookupSymbol->name() : 0;
|
||||
const Name *resolvedName = lookupSymbol ? lookupSymbol->name() : 0;
|
||||
firstType = resolve(firstType, typeOfExpression.lookupContext(),
|
||||
&resolvedSymbol, &resolvedName);
|
||||
|
||||
if (resolvedSymbol && resolvedSymbol->scope()
|
||||
&& resolvedSymbol->scope()->isClassScope()) {
|
||||
Class *enclosingClass = resolvedSymbol->scope()->owner()->asClass();
|
||||
if (Identifier *id = enclosingClass->identifier()) {
|
||||
if (const Identifier *id = enclosingClass->identifier()) {
|
||||
if (id->isEqualTo(resolvedSymbol->identifier()))
|
||||
resolvedSymbol = enclosingClass;
|
||||
}
|
||||
@@ -392,6 +394,11 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
||||
m_helpEngineNeedsSetup = false;
|
||||
}
|
||||
|
||||
|
||||
if (!formatTooltip.isEmpty()) {
|
||||
m_toolTip = formatTooltip;
|
||||
}
|
||||
|
||||
if (!m_toolTip.isEmpty())
|
||||
m_toolTip = Qt::escape(m_toolTip);
|
||||
|
||||
|
@@ -192,7 +192,7 @@ protected:
|
||||
return previousItem;
|
||||
}
|
||||
|
||||
TextEditor::CompletionItem newCompletionItem(Name *name)
|
||||
TextEditor::CompletionItem newCompletionItem(const Name *name)
|
||||
{
|
||||
TextEditor::CompletionItem item(_collector);
|
||||
item.text = overview.prettyName(name);
|
||||
@@ -200,25 +200,25 @@ protected:
|
||||
return item;
|
||||
}
|
||||
|
||||
virtual void visit(NameId *name)
|
||||
virtual void visit(const NameId *name)
|
||||
{ _item = newCompletionItem(name); }
|
||||
|
||||
virtual void visit(TemplateNameId *name)
|
||||
virtual void visit(const TemplateNameId *name)
|
||||
{
|
||||
_item = newCompletionItem(name);
|
||||
_item.text = QLatin1String(name->identifier()->chars());
|
||||
}
|
||||
|
||||
virtual void visit(DestructorNameId *name)
|
||||
virtual void visit(const DestructorNameId *name)
|
||||
{ _item = newCompletionItem(name); }
|
||||
|
||||
virtual void visit(OperatorNameId *name)
|
||||
virtual void visit(const OperatorNameId *name)
|
||||
{ _item = newCompletionItem(name); }
|
||||
|
||||
virtual void visit(ConversionNameId *name)
|
||||
virtual void visit(const ConversionNameId *name)
|
||||
{ _item = newCompletionItem(name); }
|
||||
|
||||
virtual void visit(QualifiedNameId *name)
|
||||
virtual void visit(const QualifiedNameId *name)
|
||||
{ _item = newCompletionItem(name->unqualifiedNameId()); }
|
||||
};
|
||||
|
||||
@@ -890,13 +890,13 @@ bool CppCodeCompletion::completeConstructorOrFunction(const QList<LookupItem> &r
|
||||
FullySpecifiedType exprTy = result.type().simplified();
|
||||
|
||||
if (Class *klass = exprTy->asClassType()) {
|
||||
Name *className = klass->name();
|
||||
const Name *className = klass->name();
|
||||
if (! className)
|
||||
continue; // nothing to do for anonymoous classes.
|
||||
|
||||
for (unsigned i = 0; i < klass->memberCount(); ++i) {
|
||||
Symbol *member = klass->memberAt(i);
|
||||
Name *memberName = member->name();
|
||||
const Name *memberName = member->name();
|
||||
|
||||
if (! memberName)
|
||||
continue; // skip anonymous member.
|
||||
@@ -945,7 +945,7 @@ bool CppCodeCompletion::completeConstructorOrFunction(const QList<LookupItem> &r
|
||||
if (functions.isEmpty()) {
|
||||
ResolveExpression resolveExpression(context);
|
||||
ResolveClass resolveClass;
|
||||
Name *functionCallOp = context.control()->operatorNameId(OperatorNameId::FunctionCallOp);
|
||||
const Name *functionCallOp = context.control()->operatorNameId(OperatorNameId::FunctionCallOp);
|
||||
|
||||
foreach (const LookupItem &result, results) {
|
||||
FullySpecifiedType ty = result.type().simplified();
|
||||
@@ -1092,7 +1092,7 @@ bool CppCodeCompletion::completeMember(const QList<LookupItem> &baseResults,
|
||||
classObjectCandidates.append(klass);
|
||||
|
||||
else if (NamedType *namedTy = ty->asNamedType()) {
|
||||
Name *className = namedTy->name();
|
||||
const Name *className = namedTy->name();
|
||||
const QList<Symbol *> classes = resolveClass(className, r, context);
|
||||
|
||||
foreach (Symbol *c, classes) {
|
||||
|
@@ -23,7 +23,7 @@
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://www.qtsoftware.com/contact.
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
@@ -79,8 +79,8 @@ QList<int> CppFindReferences::references(Symbol *symbol,
|
||||
Document::Ptr doc,
|
||||
const Snapshot& snapshot) const
|
||||
{
|
||||
Identifier *id = 0;
|
||||
if (Identifier *symbolId = symbol->identifier())
|
||||
const Identifier *id = 0;
|
||||
if (const Identifier *symbolId = symbol->identifier())
|
||||
id = doc->control()->findIdentifier(symbolId->chars(), symbolId->size());
|
||||
|
||||
QList<int> references;
|
||||
@@ -106,7 +106,7 @@ static void find_helper(QFutureInterface<Usage> &future,
|
||||
QTime tm;
|
||||
tm.start();
|
||||
|
||||
Identifier *symbolId = symbol->identifier();
|
||||
const Identifier *symbolId = symbol->identifier();
|
||||
Q_ASSERT(symbolId != 0);
|
||||
|
||||
const QString sourceFile = QString::fromUtf8(symbol->fileName(), symbol->fileNameLength());
|
||||
@@ -142,7 +142,7 @@ static void find_helper(QFutureInterface<Usage> &future,
|
||||
|
||||
if (Document::Ptr previousDoc = snapshot.value(fileName)) {
|
||||
Control *control = previousDoc->control();
|
||||
Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size());
|
||||
const Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size());
|
||||
if (! id)
|
||||
continue; // skip this document, it's not using symbolId.
|
||||
}
|
||||
@@ -164,7 +164,7 @@ static void find_helper(QFutureInterface<Usage> &future,
|
||||
doc->tokenize();
|
||||
|
||||
Control *control = doc->control();
|
||||
if (Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size())) {
|
||||
if (const Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size())) {
|
||||
QTime tm;
|
||||
tm.start();
|
||||
doc->parse();
|
||||
@@ -202,7 +202,7 @@ void CppFindReferences::findUsages(Symbol *symbol)
|
||||
|
||||
void CppFindReferences::renameUsages(Symbol *symbol)
|
||||
{
|
||||
if (Identifier *id = symbol->identifier()) {
|
||||
if (const Identifier *id = symbol->identifier()) {
|
||||
const QString textToReplace = QString::fromUtf8(id->chars(), id->size());
|
||||
|
||||
Find::SearchResult *search = _resultWindow->startNewSearch(Find::SearchResultWindow::SearchAndReplace);
|
||||
|
@@ -23,7 +23,7 @@
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://www.qtsoftware.com/contact.
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
|
@@ -95,8 +95,8 @@ bool SearchSymbols::visit(Function *symbol)
|
||||
return false;
|
||||
|
||||
QString extraScope;
|
||||
if (Name *name = symbol->name()) {
|
||||
if (QualifiedNameId *nameId = name->asQualifiedNameId()) {
|
||||
if (const Name *name = symbol->name()) {
|
||||
if (const QualifiedNameId *nameId = name->asQualifiedNameId()) {
|
||||
if (nameId->nameCount() > 1) {
|
||||
extraScope = overview.prettyName(nameId->nameAt(nameId->nameCount() - 2));
|
||||
}
|
||||
|
@@ -1588,6 +1588,8 @@ QList<Symbol> CdbDebugEngine::moduleSymbols(const QString &moduleName)
|
||||
|
||||
void CdbDebugEngine::reloadRegisters()
|
||||
{
|
||||
if (state() != InferiorStopped)
|
||||
return;
|
||||
const int intBase = 10;
|
||||
if (debugCDB)
|
||||
qDebug() << Q_FUNC_INFO << intBase;
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include <projectexplorer/environment.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -131,7 +132,7 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
|
||||
}
|
||||
if (const ProjectExplorer::Project *project = runConfiguration->project()) {
|
||||
m_startParameters->buildDir =
|
||||
project->buildDirectory(project->activeBuildConfiguration());
|
||||
project->activeBuildConfiguration()->buildDirectory();
|
||||
}
|
||||
m_startParameters->useTerminal =
|
||||
runConfiguration->runMode() == LocalApplicationRunConfiguration::Console;
|
||||
|
@@ -155,9 +155,8 @@ static bool parseConsoleStream(const GdbResponse &response, GdbMi *contents)
|
||||
out = out.left(out.lastIndexOf('"'));
|
||||
// optimization: dumper output never needs real C unquoting
|
||||
out.replace('\\', "");
|
||||
out = "dummy={" + out + "}";
|
||||
|
||||
contents->fromString(out);
|
||||
contents->fromStringMultiple(out);
|
||||
//qDebug() << "CONTENTS" << contents->toString(true);
|
||||
return contents->isValid();
|
||||
}
|
||||
@@ -2569,6 +2568,8 @@ void GdbEngine::handleStackListThreads(const GdbResponse &response)
|
||||
|
||||
void GdbEngine::reloadRegisters()
|
||||
{
|
||||
if (state() != InferiorStopped)
|
||||
return;
|
||||
if (!m_registerNamesListed) {
|
||||
postCommand(_("-data-list-register-names"), CB(handleRegisterListNames));
|
||||
m_registerNamesListed = true;
|
||||
@@ -3584,8 +3585,8 @@ void GdbEngine::handleStackFrame(const GdbResponse &response)
|
||||
<< out.left(pos);
|
||||
out = out.mid(pos);
|
||||
}
|
||||
GdbMi all("[" + out + "]");
|
||||
//GdbMi all(out);
|
||||
GdbMi all;
|
||||
all.fromStringMultiple(out);
|
||||
|
||||
//qDebug() << "\n\n\nALL: " << all.toString() << "\n";
|
||||
GdbMi locals = all.findChild("locals");
|
||||
|
@@ -348,6 +348,13 @@ void GdbMi::fromString(const QByteArray &ba)
|
||||
parseResultOrValue(from, to);
|
||||
}
|
||||
|
||||
void GdbMi::fromStringMultiple(const QByteArray &ba)
|
||||
{
|
||||
const char *from = ba.constBegin();
|
||||
const char *to = ba.constEnd();
|
||||
parseTuple_helper(from, to);
|
||||
}
|
||||
|
||||
GdbMi GdbMi::findChild(const char *name) const
|
||||
{
|
||||
for (int i = 0; i < m_children.size(); ++i)
|
||||
|
@@ -91,7 +91,6 @@ class GdbMi
|
||||
{
|
||||
public:
|
||||
GdbMi() : m_type(Invalid) {}
|
||||
explicit GdbMi(const QByteArray &str) { fromString(str); }
|
||||
|
||||
QByteArray m_name;
|
||||
QByteArray m_data;
|
||||
@@ -126,6 +125,7 @@ public:
|
||||
|
||||
QByteArray toString(bool multiline = false, int indent = 0) const;
|
||||
void fromString(const QByteArray &str);
|
||||
void fromStringMultiple(const QByteArray &str);
|
||||
void setStreamOutput(const QByteArray &name, const QByteArray &content);
|
||||
|
||||
private:
|
||||
|
@@ -975,11 +975,8 @@ bool QtDumperHelper::parseQuery(const GdbMi &contents, Debugger debugger)
|
||||
// parse a query
|
||||
bool QtDumperHelper::parseQuery(const char *data, Debugger debugger)
|
||||
{
|
||||
QByteArray fullData = data;
|
||||
fullData.insert(0, '{');
|
||||
fullData.append(data);
|
||||
fullData.append('}');
|
||||
GdbMi root(fullData);
|
||||
GdbMi root;
|
||||
root.fromStringMultiple(QByteArray(data));
|
||||
if (!root.isValid())
|
||||
return false;
|
||||
return parseQuery(root, debugger);
|
||||
@@ -1475,11 +1472,8 @@ bool QtDumperHelper::parseValue(const char *data,
|
||||
QList<WatchData> *l)
|
||||
{
|
||||
l->clear();
|
||||
QByteArray fullData = data;
|
||||
fullData.insert(0, '{');
|
||||
fullData.append(data);
|
||||
fullData.append('}');
|
||||
GdbMi root(fullData);
|
||||
GdbMi root;
|
||||
root.fromStringMultiple(QByteArray(data));
|
||||
if (!root.isValid())
|
||||
return false;
|
||||
gbdMiToWatchData(root, GdbMiRecursionContext(), l);
|
||||
|
@@ -251,8 +251,8 @@ static bool isCompatible(const Function *definition, const Symbol *declaration,
|
||||
if (! declTy)
|
||||
return false;
|
||||
|
||||
Name *definitionName = definition->name();
|
||||
if (QualifiedNameId *q = definitionName->asQualifiedNameId()) {
|
||||
const Name *definitionName = definition->name();
|
||||
if (const QualifiedNameId *q = definitionName->asQualifiedNameId()) {
|
||||
if (! isCompatible(q->unqualifiedNameId(), declaration->name()))
|
||||
return false;
|
||||
else if (q->nameCount() > declarationName->nameCount())
|
||||
@@ -272,8 +272,8 @@ static bool isCompatible(const Function *definition, const Symbol *declaration,
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i != q->nameCount(); ++i) {
|
||||
Name *n = q->nameAt(q->nameCount() - i - 1);
|
||||
Name *m = declarationName->nameAt(declarationName->nameCount() - i - 1);
|
||||
const Name *n = q->nameAt(q->nameCount() - i - 1);
|
||||
const Name *m = declarationName->nameAt(declarationName->nameCount() - i - 1);
|
||||
if (! isCompatible(n, m))
|
||||
return false;
|
||||
}
|
||||
@@ -291,13 +291,13 @@ static Document::Ptr findDefinition(const Function *functionDeclaration, int *li
|
||||
if (!cppModelManager)
|
||||
return Document::Ptr();
|
||||
|
||||
QVector<Name *> qualifiedName;
|
||||
QVector<const Name *> qualifiedName;
|
||||
Scope *scope = functionDeclaration->scope();
|
||||
for (; scope; scope = scope->enclosingScope()) {
|
||||
if (scope->isClassScope() || scope->isNamespaceScope()) {
|
||||
if (scope->owner() && scope->owner()->name()) {
|
||||
Name *scopeOwnerName = scope->owner()->name();
|
||||
if (QualifiedNameId *q = scopeOwnerName->asQualifiedNameId()) {
|
||||
const Name *scopeOwnerName = scope->owner()->name();
|
||||
if (const QualifiedNameId *q = scopeOwnerName->asQualifiedNameId()) {
|
||||
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||
qualifiedName.prepend(q->nameAt(i));
|
||||
|
||||
@@ -312,7 +312,7 @@ static Document::Ptr findDefinition(const Function *functionDeclaration, int *li
|
||||
qualifiedName.append(functionDeclaration->name());
|
||||
|
||||
Control control;
|
||||
QualifiedNameId *q = control.qualifiedNameId(&qualifiedName[0], qualifiedName.size());
|
||||
const QualifiedNameId *q = control.qualifiedNameId(&qualifiedName[0], qualifiedName.size());
|
||||
LookupContext context(&control);
|
||||
const Snapshot documents = cppModelManager->snapshot();
|
||||
foreach (Document::Ptr doc, documents) {
|
||||
@@ -321,13 +321,13 @@ static Document::Ptr findDefinition(const Function *functionDeclaration, int *li
|
||||
visibleScopes = context.expand(visibleScopes);
|
||||
foreach (Scope *visibleScope, visibleScopes) {
|
||||
Symbol *symbol = 0;
|
||||
if (NameId *nameId = q->unqualifiedNameId()->asNameId())
|
||||
if (const NameId *nameId = q->unqualifiedNameId()->asNameId())
|
||||
symbol = visibleScope->lookat(nameId->identifier());
|
||||
else if (DestructorNameId *dtorId = q->unqualifiedNameId()->asDestructorNameId())
|
||||
else if (const DestructorNameId *dtorId = q->unqualifiedNameId()->asDestructorNameId())
|
||||
symbol = visibleScope->lookat(dtorId->identifier());
|
||||
else if (TemplateNameId *templNameId = q->unqualifiedNameId()->asTemplateNameId())
|
||||
else if (const TemplateNameId *templNameId = q->unqualifiedNameId()->asTemplateNameId())
|
||||
symbol = visibleScope->lookat(templNameId->identifier());
|
||||
else if (OperatorNameId *opId = q->unqualifiedNameId()->asOperatorNameId())
|
||||
else if (const OperatorNameId *opId = q->unqualifiedNameId()->asOperatorNameId())
|
||||
symbol = visibleScope->lookat(opId->kind());
|
||||
// ### cast operators
|
||||
for (; symbol; symbol = symbol->next()) {
|
||||
|
@@ -0,0 +1,71 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "genericbuildconfiguration.h"
|
||||
#include "genericproject.h"
|
||||
|
||||
using namespace GenericProjectManager;
|
||||
using namespace GenericProjectManager::Internal;
|
||||
using ProjectExplorer::BuildConfiguration;
|
||||
|
||||
GenericBuildConfiguration::GenericBuildConfiguration(GenericProject *pro)
|
||||
: BuildConfiguration(pro)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
GenericBuildConfiguration::GenericBuildConfiguration(GenericBuildConfiguration *source)
|
||||
: BuildConfiguration(source)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment GenericBuildConfiguration::environment() const
|
||||
{
|
||||
return ProjectExplorer::Environment::systemEnvironment();
|
||||
}
|
||||
|
||||
QString GenericBuildConfiguration::buildDirectory() const
|
||||
{
|
||||
QString buildDirectory = value("buildDirectory").toString();
|
||||
|
||||
if (buildDirectory.isEmpty()) {
|
||||
QFileInfo fileInfo(project()->file()->fileName());
|
||||
|
||||
buildDirectory = fileInfo.absolutePath();
|
||||
}
|
||||
|
||||
return buildDirectory;
|
||||
}
|
||||
|
||||
GenericProject *GenericBuildConfiguration::genericProject() const
|
||||
{
|
||||
return static_cast<GenericProject *>(project());
|
||||
}
|
||||
|
@@ -27,59 +27,30 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef EMBEDDEDPROPERTIESPAGE_H
|
||||
#define EMBEDDEDPROPERTIESPAGE_H
|
||||
#ifndef GENERICBUILDCONFIGURATION_H
|
||||
#define GENERICBUILDCONFIGURATION_H
|
||||
|
||||
#include "ui_embeddedpropertiespage.h"
|
||||
|
||||
#include <projectexplorer/iprojectproperties.h>
|
||||
|
||||
#include <QtCore/QModelIndex>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class Project;
|
||||
}
|
||||
|
||||
namespace Qt4ProjectManager {
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
|
||||
namespace GenericProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class EmbeddedPropertiesWidget;
|
||||
class GenericProject;
|
||||
|
||||
class EmbeddedPropertiesPanelFactory : public ProjectExplorer::IPanelFactory
|
||||
{
|
||||
public:
|
||||
virtual bool supports(ProjectExplorer::Project *project);
|
||||
ProjectExplorer::IPropertiesPanel *createPanel(ProjectExplorer::Project *project);
|
||||
};
|
||||
|
||||
class EmbeddedPropertiesPanel : public ProjectExplorer::IPropertiesPanel
|
||||
{
|
||||
public:
|
||||
EmbeddedPropertiesPanel(ProjectExplorer::Project *project);
|
||||
~EmbeddedPropertiesPanel();
|
||||
|
||||
QString name() const;
|
||||
QWidget *widget() const;
|
||||
QIcon icon() const;
|
||||
|
||||
private:
|
||||
EmbeddedPropertiesWidget *m_widget;
|
||||
QIcon m_icon;
|
||||
};
|
||||
|
||||
class EmbeddedPropertiesWidget : public QWidget
|
||||
class GenericBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EmbeddedPropertiesWidget(ProjectExplorer::Project *project);
|
||||
virtual ~EmbeddedPropertiesWidget();
|
||||
private:
|
||||
Ui_EmbeddedPropertiesPage m_ui;
|
||||
ProjectExplorer::Project *m_pro;
|
||||
GenericBuildConfiguration(GenericProject *pro);
|
||||
GenericBuildConfiguration(GenericBuildConfiguration *source);
|
||||
|
||||
GenericProject *genericProject() const;
|
||||
|
||||
virtual ProjectExplorer::Environment environment() const;
|
||||
virtual QString buildDirectory() const;
|
||||
};
|
||||
|
||||
} // namespace GenericProjectManager
|
||||
} // namespace Internal
|
||||
} // namespace Qt4ProjectManager
|
||||
|
||||
#endif // EMBEDDEDPROPERTIESPAGE_H
|
||||
#endif // GENERICBUILDCONFIGURATION_H
|
@@ -31,6 +31,7 @@
|
||||
#include "genericprojectconstants.h"
|
||||
#include "genericproject.h"
|
||||
#include "ui_genericmakestep.h"
|
||||
#include "genericbuildconfiguration.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <projectexplorer/toolchain.h>
|
||||
@@ -47,13 +48,13 @@
|
||||
using namespace GenericProjectManager;
|
||||
using namespace GenericProjectManager::Internal;
|
||||
|
||||
GenericMakeStep::GenericMakeStep(GenericProject *pro, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(pro, bc), m_pro(pro)
|
||||
GenericMakeStep::GenericMakeStep(ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bc)
|
||||
{
|
||||
}
|
||||
|
||||
GenericMakeStep::GenericMakeStep(GenericMakeStep *bs, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bs, bc), m_pro(bs->project())
|
||||
: AbstractMakeStep(bs, bc)
|
||||
{
|
||||
m_buildTargets = bs->m_buildTargets;
|
||||
m_makeArguments = bs->m_makeArguments;
|
||||
@@ -64,23 +65,28 @@ GenericMakeStep::~GenericMakeStep()
|
||||
{
|
||||
}
|
||||
|
||||
GenericBuildConfiguration *GenericMakeStep::genericBuildConfiguration() const
|
||||
{
|
||||
return static_cast<GenericBuildConfiguration *>(buildConfiguration());
|
||||
}
|
||||
|
||||
bool GenericMakeStep::init()
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
||||
const QString buildParser = m_pro->buildParser(bc);
|
||||
GenericBuildConfiguration *bc = genericBuildConfiguration();
|
||||
//TODO
|
||||
const QString buildParser = genericBuildConfiguration()->genericProject()->buildParser(bc);
|
||||
setBuildParser(buildParser);
|
||||
qDebug() << "*** build parser:" << buildParser;
|
||||
|
||||
setEnabled(true);
|
||||
Core::VariableManager *vm = Core::VariableManager::instance();
|
||||
const QString rawBuildDir = m_pro->buildDirectory(bc);
|
||||
const QString rawBuildDir = bc->buildDirectory();
|
||||
const QString buildDir = vm->resolve(rawBuildDir);
|
||||
setWorkingDirectory(buildDir);
|
||||
|
||||
setCommand(makeCommand());
|
||||
setArguments(replacedArguments());
|
||||
|
||||
setEnvironment(m_pro->environment(bc));
|
||||
setEnvironment(bc->environment());
|
||||
return AbstractMakeStep::init();
|
||||
}
|
||||
|
||||
@@ -119,7 +125,8 @@ QString GenericMakeStep::makeCommand() const
|
||||
{
|
||||
QString command = m_makeCommand;
|
||||
if (command.isEmpty()) {
|
||||
if (ProjectExplorer::ToolChain *toolChain = m_pro->toolChain())
|
||||
GenericProject *pro = genericBuildConfiguration()->genericProject();
|
||||
if (ProjectExplorer::ToolChain *toolChain = pro->toolChain())
|
||||
command = toolChain->makeCommand();
|
||||
else
|
||||
command = QLatin1String("make");
|
||||
@@ -152,11 +159,6 @@ bool GenericMakeStep::immutable() const
|
||||
return true;
|
||||
}
|
||||
|
||||
GenericProject *GenericMakeStep::project() const
|
||||
{
|
||||
return m_pro;
|
||||
}
|
||||
|
||||
bool GenericMakeStep::buildsTarget(const QString &target) const
|
||||
{
|
||||
return m_buildTargets.contains(target);
|
||||
@@ -184,7 +186,7 @@ GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeSt
|
||||
m_ui->setupUi(this);
|
||||
|
||||
// TODO update this list also on rescans of the GenericLists.txt
|
||||
GenericProject *pro = m_makeStep->project();
|
||||
GenericProject *pro = m_makeStep->genericBuildConfiguration()->genericProject();
|
||||
foreach (const QString &target, pro->targets()) {
|
||||
QListWidgetItem *item = new QListWidgetItem(target, m_ui->targetsList);
|
||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||
@@ -280,14 +282,11 @@ bool GenericMakeStepFactory::canCreate(const QString &name) const
|
||||
return (Constants::MAKESTEP == name);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *GenericMakeStepFactory::create(ProjectExplorer::Project *project,
|
||||
ProjectExplorer::BuildConfiguration *bc,
|
||||
ProjectExplorer::BuildStep *GenericMakeStepFactory::create(ProjectExplorer::BuildConfiguration *bc,
|
||||
const QString &name) const
|
||||
{
|
||||
Q_ASSERT(name == Constants::MAKESTEP);
|
||||
GenericProject *pro = qobject_cast<GenericProject *>(project);
|
||||
Q_ASSERT(pro);
|
||||
return new GenericMakeStep(pro, bc);
|
||||
return new GenericMakeStep(bc);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *GenericMakeStepFactory::clone(ProjectExplorer::BuildStep *bs,
|
||||
@@ -296,7 +295,7 @@ ProjectExplorer::BuildStep *GenericMakeStepFactory::clone(ProjectExplorer::Build
|
||||
return new GenericMakeStep(static_cast<GenericMakeStep*>(bs), bc);
|
||||
}
|
||||
|
||||
QStringList GenericMakeStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const
|
||||
QStringList GenericMakeStepFactory::canCreateForBuildConfiguration(ProjectExplorer::BuildConfiguration * /* pro */) const
|
||||
{
|
||||
return QStringList();
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ QT_END_NAMESPACE
|
||||
namespace GenericProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class GenericProject;
|
||||
class GenericBuildConfiguration;
|
||||
class GenericMakeStepConfigWidget;
|
||||
|
||||
struct GenericMakeStepSettings
|
||||
@@ -56,9 +56,11 @@ class GenericMakeStep : public ProjectExplorer::AbstractMakeStep
|
||||
Q_OBJECT
|
||||
friend class GenericMakeStepConfigWidget; // TODO remove again?
|
||||
public:
|
||||
GenericMakeStep(GenericProject *pro, ProjectExplorer::BuildConfiguration *bc);
|
||||
GenericMakeStep(ProjectExplorer::BuildConfiguration *bc);
|
||||
GenericMakeStep(GenericMakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
||||
~GenericMakeStep();
|
||||
GenericBuildConfiguration *genericBuildConfiguration() const;
|
||||
|
||||
virtual bool init();
|
||||
|
||||
virtual void run(QFutureInterface<bool> &fi);
|
||||
@@ -67,7 +69,6 @@ public:
|
||||
virtual QString displayName();
|
||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||
virtual bool immutable() const;
|
||||
GenericProject *project() const;
|
||||
bool buildsTarget(const QString &target) const;
|
||||
void setBuildTarget(const QString &target, bool on);
|
||||
QStringList replacedArguments() const;
|
||||
@@ -76,7 +77,6 @@ public:
|
||||
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
||||
private:
|
||||
GenericProject *m_pro;
|
||||
QStringList m_buildTargets;
|
||||
QStringList m_makeArguments;
|
||||
QString m_makeCommand;
|
||||
@@ -105,12 +105,11 @@ private:
|
||||
class GenericMakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||
{
|
||||
virtual bool canCreate(const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro,
|
||||
ProjectExplorer::BuildConfiguration *bc,
|
||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc,
|
||||
const QString &name) const;
|
||||
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs,
|
||||
ProjectExplorer::BuildConfiguration *bc) const;
|
||||
virtual QStringList canCreateForProject(ProjectExplorer::Project *pro) const;
|
||||
virtual QStringList canCreateForBuildConfiguration(ProjectExplorer::BuildConfiguration *bc) const;
|
||||
virtual QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "genericproject.h"
|
||||
#include "genericprojectconstants.h"
|
||||
#include "genericmakestep.h"
|
||||
#include "genericbuildconfiguration.h"
|
||||
|
||||
#include <projectexplorer/toolchain.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -131,7 +132,7 @@ QString GenericBuildConfigurationFactory::displayNameForType(const QString & /*
|
||||
return tr("Create");
|
||||
}
|
||||
|
||||
bool GenericBuildConfigurationFactory::create(const QString &type) const
|
||||
BuildConfiguration *GenericBuildConfigurationFactory::create(const QString &type) const
|
||||
{
|
||||
QTC_ASSERT(type == "Create", return false);
|
||||
//TODO asking for name is duplicated everywhere, but maybe more
|
||||
@@ -145,13 +146,26 @@ bool GenericBuildConfigurationFactory::create(const QString &type) const
|
||||
&ok);
|
||||
if (!ok || buildConfigurationName.isEmpty())
|
||||
return false;
|
||||
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
|
||||
GenericBuildConfiguration *bc = new GenericBuildConfiguration(m_project);
|
||||
bc->setDisplayName(buildConfigurationName);
|
||||
m_project->addBuildConfiguration(bc); // also makes the name unique...
|
||||
|
||||
GenericMakeStep *makeStep = new GenericMakeStep(m_project, bc);
|
||||
GenericMakeStep *makeStep = new GenericMakeStep(bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
makeStep->setBuildTarget("all", /* on = */ true);
|
||||
return true;
|
||||
return bc;
|
||||
}
|
||||
|
||||
BuildConfiguration *GenericBuildConfigurationFactory::clone(BuildConfiguration *source) const
|
||||
{
|
||||
GenericBuildConfiguration *bc = new GenericBuildConfiguration(static_cast<GenericBuildConfiguration *>(source));
|
||||
return bc;
|
||||
}
|
||||
|
||||
BuildConfiguration *GenericBuildConfigurationFactory::restore() const
|
||||
{
|
||||
GenericBuildConfiguration *bc = new GenericBuildConfiguration(m_project);
|
||||
return bc;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -465,25 +479,6 @@ bool GenericProject::isApplication() const
|
||||
return true;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment GenericProject::environment(BuildConfiguration *configuration) const
|
||||
{
|
||||
Q_UNUSED(configuration)
|
||||
return ProjectExplorer::Environment::systemEnvironment();
|
||||
}
|
||||
|
||||
QString GenericProject::buildDirectory(BuildConfiguration *configuration) const
|
||||
{
|
||||
QString buildDirectory = configuration->value("buildDirectory").toString();
|
||||
|
||||
if (buildDirectory.isEmpty()) {
|
||||
QFileInfo fileInfo(m_fileName);
|
||||
|
||||
buildDirectory = fileInfo.absolutePath();
|
||||
}
|
||||
|
||||
return buildDirectory;
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *GenericProject::createConfigWidget()
|
||||
{
|
||||
return new GenericBuildSettingsWidget(this);
|
||||
@@ -518,10 +513,11 @@ bool GenericProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsRead
|
||||
Project::restoreSettingsImpl(reader);
|
||||
|
||||
if (buildConfigurations().isEmpty()) {
|
||||
ProjectExplorer::BuildConfiguration *bc = new BuildConfiguration("all");
|
||||
GenericBuildConfiguration *bc = new GenericBuildConfiguration(this);
|
||||
bc->setDisplayName("all");
|
||||
addBuildConfiguration(bc);
|
||||
|
||||
GenericMakeStep *makeStep = new GenericMakeStep(this, bc);
|
||||
GenericMakeStep *makeStep = new GenericMakeStep(bc);
|
||||
bc->insertBuildStep(0, makeStep);
|
||||
|
||||
makeStep->setBuildTarget("all", /* on = */ true);
|
||||
@@ -574,7 +570,7 @@ void GenericProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericProject *project)
|
||||
: m_project(project)
|
||||
: m_project(project), m_buildConfiguration(0)
|
||||
{
|
||||
QFormLayout *fl = new QFormLayout(this);
|
||||
fl->setContentsMargins(0, -1, 0, -1);
|
||||
@@ -610,15 +606,15 @@ GenericBuildSettingsWidget::~GenericBuildSettingsWidget()
|
||||
QString GenericBuildSettingsWidget::displayName() const
|
||||
{ return tr("Generic Manager"); }
|
||||
|
||||
void GenericBuildSettingsWidget::init(const QString &buildConfigurationName)
|
||||
void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||
{
|
||||
m_buildConfiguration = buildConfigurationName;
|
||||
m_pathChooser->setPath(m_project->buildDirectory(m_project->buildConfiguration(buildConfigurationName)));
|
||||
m_buildConfiguration = static_cast<GenericBuildConfiguration *>(bc);
|
||||
m_pathChooser->setPath(m_buildConfiguration->buildDirectory());
|
||||
}
|
||||
|
||||
void GenericBuildSettingsWidget::buildDirectoryChanged()
|
||||
{
|
||||
m_project->buildConfiguration(m_buildConfiguration)->setValue("buildDirectory", m_pathChooser->path());
|
||||
m_buildConfiguration->setValue("buildDirectory", m_pathChooser->path());
|
||||
}
|
||||
|
||||
void GenericBuildSettingsWidget::toolChainSelected(int index)
|
||||
|
@@ -54,6 +54,7 @@ namespace Internal {
|
||||
class GenericProject;
|
||||
class GenericMakeStep;
|
||||
class GenericProjectFile;
|
||||
class GenericBuildConfiguration;
|
||||
|
||||
class GenericBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
||||
{
|
||||
@@ -66,7 +67,9 @@ public:
|
||||
QStringList availableCreationTypes() const;
|
||||
QString displayNameForType(const QString &type) const;
|
||||
|
||||
bool create(const QString &type) const;
|
||||
ProjectExplorer::BuildConfiguration *create(const QString &type) const;
|
||||
ProjectExplorer::BuildConfiguration *clone(ProjectExplorer::BuildConfiguration *source) const;
|
||||
ProjectExplorer::BuildConfiguration *restore() const;
|
||||
|
||||
private:
|
||||
GenericProject *m_project;
|
||||
@@ -93,9 +96,6 @@ public:
|
||||
|
||||
virtual bool isApplication() const;
|
||||
|
||||
virtual ProjectExplorer::Environment environment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
virtual QString buildDirectory(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
virtual ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
||||
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
|
||||
virtual QString displayName() const;
|
||||
|
||||
virtual void init(const QString &buildConfiguration);
|
||||
virtual void init(ProjectExplorer::BuildConfiguration *bc);
|
||||
|
||||
private Q_SLOTS:
|
||||
void buildDirectoryChanged();
|
||||
@@ -202,7 +202,7 @@ private Q_SLOTS:
|
||||
private:
|
||||
GenericProject *m_project;
|
||||
Utils::PathChooser *m_pathChooser;
|
||||
QString m_buildConfiguration;
|
||||
GenericBuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -10,7 +10,8 @@ HEADERS = genericproject.h \
|
||||
genericprojectwizard.h \
|
||||
genericprojectfileseditor.h \
|
||||
pkgconfigtool.h \
|
||||
genericmakestep.h
|
||||
genericmakestep.h \
|
||||
genericbuildconfiguration.h
|
||||
SOURCES = genericproject.cpp \
|
||||
genericprojectplugin.cpp \
|
||||
genericprojectmanager.cpp \
|
||||
@@ -18,8 +19,8 @@ SOURCES = genericproject.cpp \
|
||||
genericprojectwizard.cpp \
|
||||
genericprojectfileseditor.cpp \
|
||||
pkgconfigtool.cpp \
|
||||
genericmakestep.cpp
|
||||
genericmakestep.cpp \
|
||||
genericbuildconfiguration.cpp
|
||||
RESOURCES += genericproject.qrc
|
||||
FORMS += genericmakestep.ui
|
||||
|
||||
OTHER_FILES += GenericProjectManager.pluginspec
|
||||
|
@@ -427,7 +427,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
|
||||
|
||||
a = new QAction(tr("Reset Font Size"), this);
|
||||
cmd = am->registerAction(a, QLatin1String("Help.ResetFontSize"),
|
||||
cmd = am->registerAction(a, TextEditor::Constants::RESET_FONT_SIZE,
|
||||
modecontext);
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+0")));
|
||||
connect(a, SIGNAL(triggered()), m_centralWidget, SLOT(resetZoom()));
|
||||
|
@@ -31,6 +31,7 @@
|
||||
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "project.h"
|
||||
#include "buildconfiguration.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -46,8 +47,8 @@ namespace {
|
||||
bool debug = false;
|
||||
}
|
||||
|
||||
AbstractMakeStep::AbstractMakeStep(Project *project, BuildConfiguration *bc)
|
||||
: AbstractProcessStep(project, bc),
|
||||
AbstractMakeStep::AbstractMakeStep(BuildConfiguration *bc)
|
||||
: AbstractProcessStep(bc),
|
||||
m_buildParser(0)
|
||||
{
|
||||
}
|
||||
@@ -144,7 +145,7 @@ void AbstractMakeStep::slotAddToTaskWindow(const TaskWindow::Task &task)
|
||||
if (debug)
|
||||
qDebug() << "No success. Trying all files in project ...";
|
||||
QString fileName = QFileInfo(filePath).fileName();
|
||||
foreach (const QString &file, project()->files(ProjectExplorer::Project::AllFiles)) {
|
||||
foreach (const QString &file, buildConfiguration()->project()->files(ProjectExplorer::Project::AllFiles)) {
|
||||
QFileInfo candidate(file);
|
||||
if (candidate.fileName() == fileName) {
|
||||
if (debug)
|
||||
|
@@ -46,7 +46,7 @@ class PROJECTEXPLORER_EXPORT AbstractMakeStep : public ProjectExplorer::Abstract
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AbstractMakeStep(Project * project, BuildConfiguration *bc);
|
||||
AbstractMakeStep(BuildConfiguration *bc);
|
||||
AbstractMakeStep(AbstractMakeStep *bs, BuildConfiguration *bc);
|
||||
~AbstractMakeStep();
|
||||
virtual bool init();
|
||||
|
@@ -39,8 +39,8 @@
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
AbstractProcessStep::AbstractProcessStep(Project *pro, BuildConfiguration *bc)
|
||||
: BuildStep(pro, bc), m_timer(0), m_futureInterface(0), m_process(0), m_eventLoop(0)
|
||||
AbstractProcessStep::AbstractProcessStep(BuildConfiguration *bc)
|
||||
: BuildStep(bc), m_timer(0), m_futureInterface(0), m_process(0), m_eventLoop(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
@@ -65,7 +65,7 @@ class PROJECTEXPLORER_EXPORT AbstractProcessStep : public BuildStep
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AbstractProcessStep(Project *pro, BuildConfiguration *bc);
|
||||
AbstractProcessStep(BuildConfiguration *bc);
|
||||
AbstractProcessStep(AbstractProcessStep *bs, BuildConfiguration *bc);
|
||||
/// reimplemented from BuildStep::init()
|
||||
/// You need to call this from YourBuildStep::init()
|
||||
|
@@ -44,14 +44,14 @@ IBuildStepFactory *findFactory(const QString &name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
BuildConfiguration::BuildConfiguration(const QString &name)
|
||||
: m_name(name)
|
||||
BuildConfiguration::BuildConfiguration(Project *pro)
|
||||
: m_project(pro)
|
||||
{
|
||||
setDisplayName(name);
|
||||
|
||||
}
|
||||
|
||||
BuildConfiguration::BuildConfiguration(const QString &name, BuildConfiguration *source)
|
||||
: m_values(source->m_values), m_name(name)
|
||||
BuildConfiguration::BuildConfiguration(BuildConfiguration *source)
|
||||
: m_values(source->m_values), m_project(source->m_project)
|
||||
{
|
||||
foreach(BuildStep *originalbs, source->buildSteps()) {
|
||||
IBuildStepFactory *factory = findFactory(originalbs->name());
|
||||
@@ -71,16 +71,6 @@ BuildConfiguration::~BuildConfiguration()
|
||||
qDeleteAll(m_cleanSteps);
|
||||
}
|
||||
|
||||
void BuildConfiguration::setName(const QString &name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
QString BuildConfiguration::name() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
QString BuildConfiguration::displayName() const
|
||||
{
|
||||
QVariant v = value("ProjectExplorer.BuildConfiguration.DisplayName");
|
||||
@@ -90,7 +80,10 @@ QString BuildConfiguration::displayName() const
|
||||
|
||||
void BuildConfiguration::setDisplayName(const QString &name)
|
||||
{
|
||||
if (value("ProjectExplorer.BuildConfiguration.DisplayName").toString() == name)
|
||||
return;
|
||||
setValue("ProjectExplorer.BuildConfiguration.DisplayName", name);
|
||||
emit displayNameChanged();
|
||||
}
|
||||
|
||||
QVariant BuildConfiguration::value(const QString & key) const
|
||||
@@ -172,6 +165,12 @@ void BuildConfiguration::moveCleanStepUp(int position)
|
||||
m_cleanSteps.swap(position - 1, position);
|
||||
}
|
||||
|
||||
Project *BuildConfiguration::project() const
|
||||
{
|
||||
return m_project;
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
// IBuildConfigurationFactory
|
||||
///
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#define BUILDCONFIGURATION_H
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
#include "environment.h"
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QString>
|
||||
@@ -50,13 +51,13 @@ class PROJECTEXPLORER_EXPORT BuildConfiguration : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BuildConfiguration(const QString &name);
|
||||
BuildConfiguration(const QString &name, BuildConfiguration *source);
|
||||
~BuildConfiguration();
|
||||
QString name() const;
|
||||
// ctors are protected
|
||||
virtual ~BuildConfiguration();
|
||||
|
||||
QString displayName() const;
|
||||
void setDisplayName(const QString &name);
|
||||
|
||||
// TODO remove those
|
||||
QVariant value(const QString &key) const;
|
||||
void setValue(const QString &key, QVariant value);
|
||||
|
||||
@@ -73,15 +74,26 @@ public:
|
||||
void removeCleanStep(int position);
|
||||
void moveCleanStepUp(int position);
|
||||
|
||||
private:
|
||||
void setName(const QString &name);
|
||||
Project *project() const;
|
||||
|
||||
virtual Environment environment() const = 0;
|
||||
virtual QString buildDirectory() const = 0;
|
||||
|
||||
signals:
|
||||
void environmentChanged();
|
||||
void buildDirectoryChanged();
|
||||
void displayNameChanged();
|
||||
|
||||
protected:
|
||||
BuildConfiguration(Project * project);
|
||||
BuildConfiguration(BuildConfiguration *source);
|
||||
|
||||
private:
|
||||
QList<BuildStep *> m_buildSteps;
|
||||
QList<BuildStep *> m_cleanSteps;
|
||||
|
||||
QHash<QString, QVariant> m_values;
|
||||
QString m_name;
|
||||
friend class Project; // for setName
|
||||
Project *m_project;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT IBuildConfigurationFactory : public QObject
|
||||
@@ -98,12 +110,15 @@ public:
|
||||
virtual QString displayNameForType(const QString &type) const = 0;
|
||||
|
||||
// creates build configuration(s) for given type and adds them to project
|
||||
// returns true if build configuration(s) actually have been added
|
||||
virtual bool create(const QString &type) const = 0;
|
||||
// if successfull returns the BuildConfiguration that should be shown in the
|
||||
// project mode for editing
|
||||
virtual BuildConfiguration *create(const QString &type) const = 0;
|
||||
|
||||
// to come:
|
||||
// restore
|
||||
// clone
|
||||
// clones a given BuildConfiguration, should not add it to the project
|
||||
virtual BuildConfiguration *clone(BuildConfiguration *source) const = 0;
|
||||
|
||||
// restores a BuildConfiguration with the name and adds it to the project
|
||||
virtual BuildConfiguration *restore() const = 0;
|
||||
|
||||
signals:
|
||||
void availableCreationTypesChanged();
|
||||
@@ -111,4 +126,6 @@ signals:
|
||||
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
Q_DECLARE_METATYPE(ProjectExplorer::BuildConfiguration *);
|
||||
|
||||
#endif // BUILDCONFIGURATION_H
|
||||
|
@@ -136,7 +136,7 @@ void BuildManager::cancel()
|
||||
this, SLOT(addToTaskWindow(ProjectExplorer::TaskWindow::Task)));
|
||||
disconnect(m_currentBuildStep, SIGNAL(addToOutputWindow(QString)),
|
||||
this, SLOT(addToOutputWindow(QString)));
|
||||
decrementActiveBuildSteps(m_currentBuildStep->project());
|
||||
decrementActiveBuildSteps(m_currentBuildStep->buildConfiguration()->project());
|
||||
|
||||
m_progressFutureInterface->setProgressValueAndText(m_progress*100, "Build canceled"); //TODO NBS fix in qtconcurrent
|
||||
clearBuildQueue();
|
||||
@@ -169,7 +169,7 @@ void BuildManager::emitCancelMessage()
|
||||
void BuildManager::clearBuildQueue()
|
||||
{
|
||||
foreach (BuildStep * bs, m_buildQueue)
|
||||
decrementActiveBuildSteps(bs->project());
|
||||
decrementActiveBuildSteps(bs->buildConfiguration()->project());
|
||||
|
||||
m_buildQueue.clear();
|
||||
m_running = false;
|
||||
@@ -280,13 +280,14 @@ void BuildManager::nextBuildQueue()
|
||||
bool result = m_watcher.result();
|
||||
if (!result) {
|
||||
// Build Failure
|
||||
addToOutputWindow(tr("<font color=\"#ff0000\">Error while building project %1</font>").arg(m_currentBuildStep->project()->name()));
|
||||
const QString projectName = m_currentBuildStep->buildConfiguration()->project()->name();
|
||||
addToOutputWindow(tr("<font color=\"#ff0000\">Error while building project %1</font>").arg(projectName));
|
||||
addToOutputWindow(tr("<font color=\"#ff0000\">When executing build step '%1'</font>").arg(m_currentBuildStep->displayName()));
|
||||
// NBS TODO fix in qtconcurrent
|
||||
m_progressFutureInterface->setProgressValueAndText(m_progress*100, tr("Error while building project %1").arg(m_currentBuildStep->project()->name()));
|
||||
m_progressFutureInterface->setProgressValueAndText(m_progress*100, tr("Error while building project %1").arg(projectName));
|
||||
}
|
||||
|
||||
decrementActiveBuildSteps(m_currentBuildStep->project());
|
||||
decrementActiveBuildSteps(m_currentBuildStep->buildConfiguration()->project());
|
||||
if (result)
|
||||
nextStep();
|
||||
else
|
||||
@@ -317,17 +318,18 @@ void BuildManager::nextStep()
|
||||
|
||||
bool init = m_currentBuildStep->init();
|
||||
if (!init) {
|
||||
addToOutputWindow(tr("<font color=\"#ff0000\">Error while building project %1</font>").arg(m_currentBuildStep->project()->name()));
|
||||
const QString projectName = m_currentBuildStep->buildConfiguration()->project()->name();
|
||||
addToOutputWindow(tr("<font color=\"#ff0000\">Error while building project %1</font>").arg(projectName));
|
||||
addToOutputWindow(tr("<font color=\"#ff0000\">When executing build step '%1'</font>").arg(m_currentBuildStep->displayName()));
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_currentBuildStep->project() != m_previousBuildStepProject) {
|
||||
const QString projectName = m_currentBuildStep->project()->name();
|
||||
if (m_currentBuildStep->buildConfiguration()->project() != m_previousBuildStepProject) {
|
||||
const QString projectName = m_currentBuildStep->buildConfiguration()->project()->name();
|
||||
addToOutputWindow(tr("<b>Running build steps for project %2...</b>")
|
||||
.arg(projectName));
|
||||
m_previousBuildStepProject = m_currentBuildStep->project();
|
||||
m_previousBuildStepProject = m_currentBuildStep->buildConfiguration()->project();
|
||||
}
|
||||
m_watcher.setFuture(QtConcurrent::run(&BuildStep::run, m_currentBuildStep));
|
||||
} else {
|
||||
@@ -346,23 +348,15 @@ void BuildManager::buildQueueAppend(BuildStep * bs)
|
||||
{
|
||||
m_buildQueue.append(bs);
|
||||
++m_maxProgress;
|
||||
incrementActiveBuildSteps(bs->project());
|
||||
incrementActiveBuildSteps(bs->buildConfiguration()->project());
|
||||
}
|
||||
|
||||
void BuildManager::buildProjects(const QList<Project *> &projects, const QList<QString> &configurations)
|
||||
void BuildManager::buildProjects(const QList<BuildConfiguration *> &configurations)
|
||||
{
|
||||
Q_ASSERT(projects.count() == configurations.count());
|
||||
QList<QString>::const_iterator cit = configurations.constBegin();
|
||||
QList<Project *>::const_iterator it, end;
|
||||
end = projects.constEnd();
|
||||
|
||||
for (it = projects.constBegin(); it != end; ++it, ++cit) {
|
||||
if (*cit != QString::null) {
|
||||
BuildConfiguration *bc = (*it)->buildConfiguration(*cit);
|
||||
QList<BuildStep *> buildSteps = bc->buildSteps();
|
||||
foreach (BuildStep *bs, buildSteps) {
|
||||
buildQueueAppend(bs);
|
||||
}
|
||||
foreach(BuildConfiguration *bc, configurations) {
|
||||
QList<BuildStep *> buildSteps = bc->buildSteps();
|
||||
foreach (BuildStep *bs, buildSteps) {
|
||||
buildQueueAppend(bs);
|
||||
}
|
||||
}
|
||||
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput)
|
||||
@@ -370,20 +364,12 @@ void BuildManager::buildProjects(const QList<Project *> &projects, const QList<Q
|
||||
startBuildQueue();
|
||||
}
|
||||
|
||||
void BuildManager::cleanProjects(const QList<Project *> &projects, const QList<QString> &configurations)
|
||||
void BuildManager::cleanProjects(const QList<BuildConfiguration *> &configurations)
|
||||
{
|
||||
Q_ASSERT(projects.count() == configurations.count());
|
||||
QList<QString>::const_iterator cit = configurations.constBegin();
|
||||
QList<Project *>::const_iterator it, end;
|
||||
end = projects.constEnd();
|
||||
|
||||
for (it = projects.constBegin(); it != end; ++it, ++cit) {
|
||||
if (*cit != QString::null) {
|
||||
BuildConfiguration *bc = (*it)->buildConfiguration(*cit);
|
||||
QList<BuildStep *> cleanSteps = bc->cleanSteps();
|
||||
foreach (BuildStep *bs, cleanSteps) {
|
||||
buildQueueAppend(bs);
|
||||
}
|
||||
foreach(BuildConfiguration *bc, configurations) {
|
||||
QList<BuildStep *> cleanSteps = bc->cleanSteps();
|
||||
foreach (BuildStep *bs, cleanSteps) {
|
||||
buildQueueAppend(bs);
|
||||
}
|
||||
}
|
||||
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput)
|
||||
@@ -391,14 +377,14 @@ void BuildManager::cleanProjects(const QList<Project *> &projects, const QList<Q
|
||||
startBuildQueue();
|
||||
}
|
||||
|
||||
void BuildManager::buildProject(Project *p, const QString &configuration)
|
||||
void BuildManager::buildProject(BuildConfiguration *configuration)
|
||||
{
|
||||
buildProjects(QList<Project *>() << p, QList<QString>() << configuration);
|
||||
buildProjects(QList<BuildConfiguration *>() << configuration);
|
||||
}
|
||||
|
||||
void BuildManager::cleanProject(Project *p, const QString &configuration)
|
||||
void BuildManager::cleanProject(BuildConfiguration *configuration)
|
||||
{
|
||||
cleanProjects(QList<Project *>() << p, QList<QString>() << configuration);
|
||||
cleanProjects(QList<BuildConfiguration *>() << configuration);
|
||||
}
|
||||
|
||||
void BuildManager::appendStep(BuildStep *step)
|
||||
|
@@ -49,6 +49,7 @@ namespace Internal {
|
||||
class BuildStep;
|
||||
class Project;
|
||||
class ProjectExplorerPlugin;
|
||||
class BuildConfiguration;
|
||||
|
||||
class PROJECTEXPLORER_EXPORT BuildManager
|
||||
: public QObject
|
||||
@@ -70,10 +71,10 @@ public:
|
||||
void gotoTaskWindow();
|
||||
|
||||
//TODO these should take buildconfiguration object
|
||||
void buildProject(Project *p, const QString &configuration);
|
||||
void buildProjects(const QList<Project *> &projects, const QList<QString> &configurations);
|
||||
void cleanProject(Project *p, const QString &configuration);
|
||||
void cleanProjects(const QList<Project *> &projects, const QList<QString> &configurations);
|
||||
void buildProject(BuildConfiguration *bc);
|
||||
void buildProjects(const QList<BuildConfiguration *> &configurations);
|
||||
void cleanProject(BuildConfiguration *configuration);
|
||||
void cleanProjects(const QList<BuildConfiguration *> &configurations);
|
||||
bool isBuilding(Project *p);
|
||||
|
||||
// Append any build step to the list of build steps (currently only used to add the QMakeStep)
|
||||
|
@@ -32,7 +32,6 @@
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "gccparser.h"
|
||||
#include "msvcparser.h"
|
||||
#include "qmakeparser.h"
|
||||
|
||||
using namespace ProjectExplorer::Internal;
|
||||
|
||||
@@ -65,18 +64,3 @@ ProjectExplorer::IBuildParser * MsvcParserFactory::create(const QString & name)
|
||||
Q_UNUSED(name)
|
||||
return new MsvcParser();
|
||||
}
|
||||
|
||||
QMakeParserFactory::~QMakeParserFactory()
|
||||
{
|
||||
}
|
||||
|
||||
bool QMakeParserFactory::canCreate(const QString & name) const
|
||||
{
|
||||
return (name == Constants::BUILD_PARSER_QMAKE);
|
||||
}
|
||||
|
||||
ProjectExplorer::IBuildParser * QMakeParserFactory::create(const QString & name) const
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
return new QMakeParser();
|
||||
}
|
||||
|
@@ -55,16 +55,6 @@ public:
|
||||
virtual ProjectExplorer::IBuildParser * create(const QString & name) const;
|
||||
};
|
||||
|
||||
class QMakeParserFactory : public ProjectExplorer::IBuildParserFactory
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QMakeParserFactory() {}
|
||||
virtual ~QMakeParserFactory();
|
||||
virtual bool canCreate(const QString & name) const;
|
||||
virtual ProjectExplorer::IBuildParser * create(const QString & name) const;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
|
||||
|
@@ -37,18 +37,21 @@
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QPair>
|
||||
#include <QtCore/QMargins>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QInputDialog>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace ProjectExplorer::Internal;
|
||||
|
||||
///
|
||||
/// BuildSettingsPanelFactory
|
||||
// BuildSettingsPanelFactory
|
||||
///
|
||||
|
||||
bool BuildSettingsPanelFactory::supports(Project *project)
|
||||
@@ -62,7 +65,7 @@ IPropertiesPanel *BuildSettingsPanelFactory::createPanel(Project *project)
|
||||
}
|
||||
|
||||
///
|
||||
/// BuildSettingsPanel
|
||||
// BuildSettingsPanel
|
||||
///
|
||||
|
||||
BuildSettingsPanel::BuildSettingsPanel(Project *project) :
|
||||
@@ -92,74 +95,36 @@ QIcon BuildSettingsPanel::icon() const
|
||||
}
|
||||
|
||||
///
|
||||
// BuildSettingsSubWidgets
|
||||
///
|
||||
|
||||
BuildSettingsSubWidgets::~BuildSettingsSubWidgets()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
void BuildSettingsSubWidgets::addWidget(const QString &name, QWidget *widget)
|
||||
{
|
||||
QSpacerItem *item = new QSpacerItem(1, 10, QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
QLabel *label = new QLabel(this);
|
||||
label->setText(name);
|
||||
QFont f = label->font();
|
||||
f.setBold(true);
|
||||
f.setPointSizeF(f.pointSizeF() *1.2);
|
||||
label->setFont(f);
|
||||
|
||||
layout()->addItem(item);
|
||||
layout()->addWidget(label);
|
||||
layout()->addWidget(widget);
|
||||
|
||||
m_spacerItems.append(item);
|
||||
m_labels.append(label);
|
||||
m_widgets.append(widget);
|
||||
}
|
||||
|
||||
void BuildSettingsSubWidgets::clear()
|
||||
{
|
||||
foreach(QSpacerItem *item, m_spacerItems)
|
||||
layout()->removeItem(item);
|
||||
qDeleteAll(m_spacerItems);
|
||||
qDeleteAll(m_widgets);
|
||||
qDeleteAll(m_labels);
|
||||
m_widgets.clear();
|
||||
m_labels.clear();
|
||||
m_spacerItems.clear();
|
||||
}
|
||||
|
||||
QList<QWidget *> BuildSettingsSubWidgets::widgets() const
|
||||
{
|
||||
return m_widgets;
|
||||
}
|
||||
|
||||
BuildSettingsSubWidgets::BuildSettingsSubWidgets(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
new QVBoxLayout(this);
|
||||
layout()->setMargin(0);
|
||||
}
|
||||
|
||||
///
|
||||
/// BuildSettingsWidget
|
||||
// BuildSettingsWidget
|
||||
///
|
||||
|
||||
BuildSettingsWidget::~BuildSettingsWidget()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
||||
: m_project(project)
|
||||
BuildSettingsWidget::BuildSettingsWidget(Project *project) :
|
||||
m_project(project),
|
||||
m_buildConfiguration(0),
|
||||
m_leftMargin(0)
|
||||
{
|
||||
// Provide some time for our contentsmargins to get updated:
|
||||
QTimer::singleShot(0, this, SLOT(init()));
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::init()
|
||||
{
|
||||
QMargins margins(contentsMargins());
|
||||
m_leftMargin = margins.left();
|
||||
margins.setLeft(0);
|
||||
setContentsMargins(margins);
|
||||
|
||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||
vbox->setContentsMargins(0, -1, 0, -1);
|
||||
vbox->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
{ // Edit Build Configuration row
|
||||
QHBoxLayout *hbox = new QHBoxLayout();
|
||||
hbox->setContentsMargins(m_leftMargin, 0, 0, 0);
|
||||
hbox->addWidget(new QLabel(tr("Edit Build Configuration:"), this));
|
||||
m_buildConfigurationComboBox = new QComboBox(this);
|
||||
m_buildConfigurationComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
@@ -169,6 +134,8 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
||||
m_addButton->setText(tr("Add"));
|
||||
m_addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
hbox->addWidget(m_addButton);
|
||||
m_addButtonMenu = new QMenu(this);
|
||||
m_addButton->setMenu(m_addButtonMenu);
|
||||
|
||||
m_removeButton = new QPushButton(this);
|
||||
m_removeButton->setText(tr("Remove"));
|
||||
@@ -182,14 +149,7 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
||||
m_makeActiveLabel->setVisible(false);
|
||||
vbox->addWidget(m_makeActiveLabel);
|
||||
|
||||
m_subWidgets = new BuildSettingsSubWidgets(this);
|
||||
vbox->addWidget(m_subWidgets);
|
||||
|
||||
m_addButtonMenu = new QMenu(this);
|
||||
m_addButton->setMenu(m_addButtonMenu);
|
||||
updateAddButtonMenu();
|
||||
|
||||
m_buildConfiguration = m_project->activeBuildConfiguration()->name();
|
||||
m_buildConfiguration = m_project->activeBuildConfiguration();
|
||||
|
||||
connect(m_makeActiveLabel, SIGNAL(linkActivated(QString)),
|
||||
this, SLOT(makeActive()));
|
||||
@@ -200,8 +160,9 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
||||
connect(m_removeButton, SIGNAL(clicked()),
|
||||
this, SLOT(deleteConfiguration()));
|
||||
|
||||
connect(m_project, SIGNAL(buildConfigurationDisplayNameChanged(const QString &)),
|
||||
this, SLOT(buildConfigurationDisplayNameChanged(const QString &)));
|
||||
// TODO update on displayNameChange
|
||||
// connect(m_project, SIGNAL(buildConfigurationDisplayNameChanged(const QString &)),
|
||||
// this, SLOT(buildConfigurationDisplayNameChanged(const QString &)));
|
||||
|
||||
connect(m_project, SIGNAL(activeBuildConfigurationChanged()),
|
||||
this, SLOT(checkMakeActiveLabel()));
|
||||
@@ -209,19 +170,54 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
||||
if (m_project->buildConfigurationFactory())
|
||||
connect(m_project->buildConfigurationFactory(), SIGNAL(availableCreationTypesChanged()), SLOT(updateAddButtonMenu()));
|
||||
|
||||
updateAddButtonMenu();
|
||||
updateBuildSettings();
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::addSubWidget(const QString &name, QWidget *widget)
|
||||
{
|
||||
widget->setContentsMargins(m_leftMargin, 10, 0, 0);
|
||||
|
||||
QLabel *label = new QLabel(this);
|
||||
label->setText(name);
|
||||
QFont f = label->font();
|
||||
f.setBold(true);
|
||||
f.setPointSizeF(f.pointSizeF() * 1.2);
|
||||
label->setFont(f);
|
||||
|
||||
label->setContentsMargins(m_leftMargin, 10, 0, 0);
|
||||
|
||||
layout()->addWidget(label);
|
||||
layout()->addWidget(widget);
|
||||
|
||||
m_labels.append(label);
|
||||
m_subWidgets.append(widget);
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::clear()
|
||||
{
|
||||
qDeleteAll(m_subWidgets);
|
||||
m_subWidgets.clear();
|
||||
qDeleteAll(m_labels);
|
||||
m_labels.clear();
|
||||
|
||||
}
|
||||
|
||||
QList<QWidget *> BuildSettingsWidget::subWidgets() const
|
||||
{
|
||||
return m_subWidgets;
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::makeActive()
|
||||
{
|
||||
m_project->setActiveBuildConfiguration(m_project->buildConfiguration(m_buildConfiguration));
|
||||
m_project->setActiveBuildConfiguration(m_buildConfiguration);
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::updateAddButtonMenu()
|
||||
{
|
||||
m_addButtonMenu->clear();
|
||||
m_addButtonMenu->addAction(tr("&Clone Selected"),
|
||||
this, SLOT(cloneConfiguration()));
|
||||
this, SLOT(cloneConfiguration()));
|
||||
IBuildConfigurationFactory *factory = m_project->buildConfigurationFactory();
|
||||
if (factory) {
|
||||
foreach (const QString &type, factory->availableCreationTypes()) {
|
||||
@@ -231,17 +227,6 @@ void BuildSettingsWidget::updateAddButtonMenu()
|
||||
}
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::buildConfigurationDisplayNameChanged(const QString &buildConfiguration)
|
||||
{
|
||||
for (int i=0; i<m_buildConfigurationComboBox->count(); ++i) {
|
||||
if (m_buildConfigurationComboBox->itemData(i).toString() == buildConfiguration) {
|
||||
m_buildConfigurationComboBox->setItemText(i, m_project->buildConfiguration(buildConfiguration)->displayName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void BuildSettingsWidget::updateBuildSettings()
|
||||
{
|
||||
// TODO save position, entry from combbox
|
||||
@@ -249,26 +234,26 @@ void BuildSettingsWidget::updateBuildSettings()
|
||||
// Delete old tree items
|
||||
bool blocked = m_buildConfigurationComboBox->blockSignals(true);
|
||||
m_buildConfigurationComboBox->clear();
|
||||
m_subWidgets->clear();
|
||||
clear();
|
||||
|
||||
// update buttons
|
||||
m_removeButton->setEnabled(m_project->buildConfigurations().size() > 1);
|
||||
|
||||
// Add pages
|
||||
BuildConfigWidget *generalConfigWidget = m_project->createConfigWidget();
|
||||
m_subWidgets->addWidget(generalConfigWidget->displayName(), generalConfigWidget);
|
||||
addSubWidget(generalConfigWidget->displayName(), generalConfigWidget);
|
||||
|
||||
m_subWidgets->addWidget(tr("Build Steps"), new BuildStepsPage(m_project));
|
||||
m_subWidgets->addWidget(tr("Clean Steps"), new BuildStepsPage(m_project, true));
|
||||
addSubWidget(tr("Build Steps"), new BuildStepsPage(m_project, false));
|
||||
addSubWidget(tr("Clean Steps"), new BuildStepsPage(m_project, true));
|
||||
|
||||
QList<BuildConfigWidget *> subConfigWidgets = m_project->subConfigWidgets();
|
||||
foreach (BuildConfigWidget *subConfigWidget, subConfigWidgets)
|
||||
m_subWidgets->addWidget(subConfigWidget->displayName(), subConfigWidget);
|
||||
addSubWidget(subConfigWidget->displayName(), subConfigWidget);
|
||||
|
||||
// Add tree items
|
||||
foreach (const BuildConfiguration *bc, m_project->buildConfigurations()) {
|
||||
m_buildConfigurationComboBox->addItem(bc->displayName(), bc->name());
|
||||
if (bc->name() == m_buildConfiguration)
|
||||
foreach (BuildConfiguration *bc, m_project->buildConfigurations()) {
|
||||
m_buildConfigurationComboBox->addItem(bc->displayName(), QVariant::fromValue<BuildConfiguration *>(bc));
|
||||
if (bc == m_buildConfiguration)
|
||||
m_buildConfigurationComboBox->setCurrentIndex(m_buildConfigurationComboBox->count() - 1);
|
||||
}
|
||||
|
||||
@@ -276,24 +261,25 @@ void BuildSettingsWidget::updateBuildSettings()
|
||||
|
||||
// TODO Restore position, entry from combbox
|
||||
// TODO? select entry from combobox ?
|
||||
|
||||
activeBuildConfigurationChanged();
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::currentIndexChanged(int index)
|
||||
{
|
||||
m_buildConfiguration = m_buildConfigurationComboBox->itemData(index).toString();
|
||||
m_buildConfiguration = m_buildConfigurationComboBox->itemData(index).value<BuildConfiguration *>();
|
||||
activeBuildConfigurationChanged();
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::activeBuildConfigurationChanged()
|
||||
{
|
||||
for (int i = 0; i < m_buildConfigurationComboBox->count(); ++i) {
|
||||
if (m_buildConfigurationComboBox->itemData(i).toString() == m_buildConfiguration) {
|
||||
if (m_buildConfigurationComboBox->itemData(i).value<BuildConfiguration *>() == m_buildConfiguration) {
|
||||
m_buildConfigurationComboBox->setCurrentIndex(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (QWidget *widget, m_subWidgets->widgets()) {
|
||||
foreach (QWidget *widget, subWidgets()) {
|
||||
if (BuildConfigWidget *buildStepWidget = qobject_cast<BuildConfigWidget*>(widget)) {
|
||||
buildStepWidget->init(m_buildConfiguration);
|
||||
}
|
||||
@@ -304,10 +290,8 @@ void BuildSettingsWidget::activeBuildConfigurationChanged()
|
||||
void BuildSettingsWidget::checkMakeActiveLabel()
|
||||
{
|
||||
m_makeActiveLabel->setVisible(false);
|
||||
if (!m_project->activeBuildConfiguration() || m_project->activeBuildConfiguration()->name() != m_buildConfiguration) {
|
||||
BuildConfiguration *bc = m_project->buildConfiguration(m_buildConfiguration);
|
||||
QTC_ASSERT(bc, return);
|
||||
m_makeActiveLabel->setText(tr("<a href=\"#\">Make %1 active.</a>").arg(bc->displayName()));
|
||||
if (!m_project->activeBuildConfiguration() || m_project->activeBuildConfiguration() != m_buildConfiguration) {
|
||||
m_makeActiveLabel->setText(tr("<a href=\"#\">Make %1 active.</a>").arg(m_buildConfiguration->displayName()));
|
||||
m_makeActiveLabel->setVisible(true);
|
||||
}
|
||||
}
|
||||
@@ -316,61 +300,56 @@ void BuildSettingsWidget::createConfiguration()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
const QString &type = action->data().toString();
|
||||
if (m_project->buildConfigurationFactory()->create(type)) {
|
||||
// TODO switching to last buildconfiguration in list might not be what we want
|
||||
m_buildConfiguration = m_project->buildConfigurations().last()->name();
|
||||
BuildConfiguration *bc = m_project->buildConfigurationFactory()->create(type);
|
||||
if (bc) {
|
||||
m_buildConfiguration = bc;
|
||||
updateBuildSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::cloneConfiguration()
|
||||
{
|
||||
const QString configuration = m_buildConfigurationComboBox->itemData(m_buildConfigurationComboBox->currentIndex()).toString();
|
||||
cloneConfiguration(configuration);
|
||||
const int index = m_buildConfigurationComboBox->currentIndex();
|
||||
BuildConfiguration *bc = m_buildConfigurationComboBox->itemData(index).value<BuildConfiguration *>();
|
||||
cloneConfiguration(bc);
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::deleteConfiguration()
|
||||
{
|
||||
const QString configuration = m_buildConfigurationComboBox->itemData(m_buildConfigurationComboBox->currentIndex()).toString();
|
||||
deleteConfiguration(configuration);
|
||||
const int index = m_buildConfigurationComboBox->currentIndex();
|
||||
BuildConfiguration *bc = m_buildConfigurationComboBox->itemData(index).value<BuildConfiguration *>();
|
||||
deleteConfiguration(bc);
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::cloneConfiguration(const QString &sourceConfiguration)
|
||||
void BuildSettingsWidget::cloneConfiguration(BuildConfiguration *sourceConfiguration)
|
||||
{
|
||||
if (sourceConfiguration.isEmpty())
|
||||
if (!sourceConfiguration)
|
||||
return;
|
||||
|
||||
QString newBuildConfiguration = QInputDialog::getText(this, tr("Clone configuration"), tr("New Configuration Name:"));
|
||||
if (newBuildConfiguration.isEmpty())
|
||||
QString newDisplayName(QInputDialog::getText(this, tr("Clone configuration"), tr("New Configuration Name:")));
|
||||
if (newDisplayName.isEmpty())
|
||||
return;
|
||||
|
||||
QString newDisplayName = newBuildConfiguration;
|
||||
QStringList buildConfigurationDisplayNames;
|
||||
foreach(BuildConfiguration *bc, m_project->buildConfigurations())
|
||||
buildConfigurationDisplayNames << bc->displayName();
|
||||
newDisplayName = Project::makeUnique(newDisplayName, buildConfigurationDisplayNames);
|
||||
|
||||
QStringList buildConfigurationNames;
|
||||
foreach(BuildConfiguration *bc, m_project->buildConfigurations())
|
||||
buildConfigurationNames << bc->name();
|
||||
m_buildConfiguration = m_project->buildConfigurationFactory()->clone(sourceConfiguration);
|
||||
m_buildConfiguration->setDisplayName(newDisplayName);
|
||||
m_project->addBuildConfiguration(m_buildConfiguration);
|
||||
|
||||
newBuildConfiguration = Project::makeUnique(newBuildConfiguration, buildConfigurationNames);
|
||||
|
||||
m_project->copyBuildConfiguration(sourceConfiguration, newBuildConfiguration);
|
||||
m_project->setDisplayNameFor(m_project->buildConfiguration(newBuildConfiguration), newDisplayName);
|
||||
|
||||
m_buildConfiguration = newBuildConfiguration;
|
||||
updateBuildSettings();
|
||||
}
|
||||
|
||||
void BuildSettingsWidget::deleteConfiguration(const QString &deleteConfiguration)
|
||||
void BuildSettingsWidget::deleteConfiguration(BuildConfiguration *deleteConfiguration)
|
||||
{
|
||||
if (deleteConfiguration.isEmpty() || m_project->buildConfigurations().size() <= 1)
|
||||
if (!deleteConfiguration || m_project->buildConfigurations().size() <= 1)
|
||||
return;
|
||||
|
||||
if (m_project->activeBuildConfiguration()->name() == deleteConfiguration) {
|
||||
if (m_project->activeBuildConfiguration() == deleteConfiguration) {
|
||||
foreach (BuildConfiguration *bc, m_project->buildConfigurations()) {
|
||||
if (bc->name() != deleteConfiguration) {
|
||||
if (bc != deleteConfiguration) {
|
||||
m_project->setActiveBuildConfiguration(bc);
|
||||
break;
|
||||
}
|
||||
@@ -378,15 +357,15 @@ void BuildSettingsWidget::deleteConfiguration(const QString &deleteConfiguration
|
||||
}
|
||||
|
||||
if (m_buildConfiguration == deleteConfiguration) {
|
||||
foreach (const BuildConfiguration *bc, m_project->buildConfigurations()) {
|
||||
if (bc->name() != deleteConfiguration) {
|
||||
m_buildConfiguration = bc->name();
|
||||
foreach (BuildConfiguration *bc, m_project->buildConfigurations()) {
|
||||
if (bc != deleteConfiguration) {
|
||||
m_buildConfiguration = bc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_project->removeBuildConfiguration(m_project->buildConfiguration(deleteConfiguration));
|
||||
m_project->removeBuildConfiguration(deleteConfiguration);
|
||||
|
||||
updateBuildSettings();
|
||||
}
|
||||
|
@@ -32,34 +32,22 @@
|
||||
|
||||
#include "iprojectproperties.h"
|
||||
|
||||
#include <QtCore/QHash>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QGroupBox>
|
||||
#include <QtGui/QSpacerItem>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QComboBox;
|
||||
class QLabel;
|
||||
class QMenu;
|
||||
class QPushButton;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class BuildConfiguration;
|
||||
class IBuildStepFactory;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class BuildSettingsSubWidgets : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
BuildSettingsSubWidgets(QWidget *parent);
|
||||
~BuildSettingsSubWidgets();
|
||||
void clear();
|
||||
void addWidget(const QString &name, QWidget *widget);
|
||||
QList<QWidget *> widgets() const;
|
||||
private:
|
||||
QList<QWidget *> m_widgets;
|
||||
QList<QLabel *> m_labels;
|
||||
QList<QSpacerItem *> m_spacerItems;
|
||||
};
|
||||
|
||||
class BuildSettingsPanelFactory : public IPanelFactory
|
||||
{
|
||||
public:
|
||||
@@ -92,8 +80,11 @@ public:
|
||||
BuildSettingsWidget(Project *project);
|
||||
~BuildSettingsWidget();
|
||||
|
||||
void clear();
|
||||
void addSubWidget(const QString &name, QWidget *widget);
|
||||
QList<QWidget *> subWidgets() const;
|
||||
|
||||
private slots:
|
||||
void buildConfigurationDisplayNameChanged(const QString &buildConfiguration);
|
||||
void updateBuildSettings();
|
||||
void currentIndexChanged(int index);
|
||||
void activeBuildConfigurationChanged();
|
||||
@@ -105,18 +96,25 @@ private slots:
|
||||
void checkMakeActiveLabel();
|
||||
void makeActive();
|
||||
|
||||
void init();
|
||||
|
||||
private:
|
||||
void cloneConfiguration(const QString &toClone);
|
||||
void deleteConfiguration(const QString &toDelete);
|
||||
void cloneConfiguration(BuildConfiguration *toClone);
|
||||
void deleteConfiguration(BuildConfiguration *toDelete);
|
||||
|
||||
Project *m_project;
|
||||
BuildConfiguration *m_buildConfiguration;
|
||||
|
||||
QPushButton *m_addButton;
|
||||
QPushButton *m_removeButton;
|
||||
QComboBox *m_buildConfigurationComboBox;
|
||||
BuildSettingsSubWidgets *m_subWidgets;
|
||||
QString m_buildConfiguration;
|
||||
QMenu *m_addButtonMenu;
|
||||
QLabel *m_makeActiveLabel;
|
||||
|
||||
QList<QWidget *> m_subWidgets;
|
||||
QList<QLabel *> m_labels;
|
||||
|
||||
int m_leftMargin;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -36,15 +36,15 @@
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
BuildStep::BuildStep(Project * pro, BuildConfiguration *bc)
|
||||
: m_project(pro), m_buildConfiguration(bc)
|
||||
BuildStep::BuildStep(BuildConfiguration *bc)
|
||||
: m_buildConfiguration(bc)
|
||||
{
|
||||
}
|
||||
|
||||
BuildStep::BuildStep(BuildStep *bs, BuildConfiguration *bc)
|
||||
: m_project(bs->m_project), m_buildConfiguration(bc)
|
||||
: m_buildConfiguration(bc)
|
||||
{
|
||||
|
||||
Q_UNUSED(bs);
|
||||
}
|
||||
|
||||
BuildStep::~BuildStep()
|
||||
@@ -68,11 +68,6 @@ void BuildStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
Q_UNUSED(map)
|
||||
}
|
||||
|
||||
Project *BuildStep::project() const
|
||||
{
|
||||
return m_project;
|
||||
}
|
||||
|
||||
BuildConfiguration *BuildStep::buildConfiguration() const
|
||||
{
|
||||
return m_buildConfiguration;
|
||||
|
@@ -37,8 +37,6 @@
|
||||
#include <QtCore/QFutureInterface>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class Project;
|
||||
class BuildConfiguration;
|
||||
|
||||
/*
|
||||
@@ -71,9 +69,8 @@ class BuildStepConfigWidget;
|
||||
class PROJECTEXPLORER_EXPORT BuildStep : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class Project; //for managing BuildConfigurations
|
||||
protected:
|
||||
BuildStep(Project *p, BuildConfiguration *bc);
|
||||
BuildStep(BuildConfiguration *bc);
|
||||
BuildStep(BuildStep *bs, BuildConfiguration *bc);
|
||||
|
||||
public:
|
||||
@@ -110,7 +107,6 @@ public:
|
||||
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
||||
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
||||
|
||||
Project *project() const;
|
||||
BuildConfiguration *buildConfiguration() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
@@ -120,7 +116,6 @@ Q_SIGNALS:
|
||||
void addToOutputWindow(const QString &string);
|
||||
|
||||
private:
|
||||
Project *m_project;
|
||||
BuildConfiguration *m_buildConfiguration;
|
||||
};
|
||||
|
||||
@@ -135,10 +130,10 @@ public:
|
||||
/// Called to check wheter this factory can restore the named BuildStep
|
||||
virtual bool canCreate(const QString &name) const = 0;
|
||||
/// Called to restore a buildstep
|
||||
virtual BuildStep *create(Project *pro, BuildConfiguration *bc, const QString &name) const = 0;
|
||||
virtual BuildStep *create(BuildConfiguration *bc, const QString &name) const = 0;
|
||||
/// Called by the add BuildStep action to check which BuildSteps could be added
|
||||
/// to the project by this factory, should return a list of names
|
||||
virtual QStringList canCreateForProject(Project *pro) const = 0;
|
||||
virtual QStringList canCreateForBuildConfiguration(BuildConfiguration *bc) const = 0;
|
||||
/// Called to convert an internal name to a displayName
|
||||
|
||||
/// Called to clone a BuildStep
|
||||
@@ -158,7 +153,7 @@ public:
|
||||
virtual QString displayName() const = 0;
|
||||
|
||||
// This is called to set up the config widget before showing it
|
||||
virtual void init(const QString &buildConfiguration) = 0;
|
||||
virtual void init(BuildConfiguration *bc) = 0;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT BuildStepConfigWidget
|
||||
|
@@ -28,13 +28,14 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "buildstepspage.h"
|
||||
#include "project.h"
|
||||
#include "buildconfiguration.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QSignalMapper>
|
||||
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QMenu>
|
||||
@@ -47,40 +48,11 @@ using namespace ProjectExplorer::Internal;
|
||||
|
||||
BuildStepsPage::BuildStepsPage(Project *project, bool clean) :
|
||||
BuildConfigWidget(),
|
||||
m_pro(project),
|
||||
m_clean(clean)
|
||||
m_clean(clean),
|
||||
m_addButton(0),
|
||||
m_leftMargin(-1)
|
||||
{
|
||||
m_vbox = new QVBoxLayout(this);
|
||||
m_vbox->setContentsMargins(0, 0, 0, 0);
|
||||
m_vbox->setSpacing(0);
|
||||
|
||||
m_noStepsLabel = new QLabel(tr("No Build Steps"), this);
|
||||
m_vbox->addWidget(m_noStepsLabel);
|
||||
|
||||
QHBoxLayout *hboxLayout = new QHBoxLayout();
|
||||
m_addButton = new QPushButton(this);
|
||||
m_addButton->setText(clean ? tr("Add clean step") : tr("Add build step"));
|
||||
m_addButton->setMenu(new QMenu(this));
|
||||
hboxLayout->addWidget(m_addButton);
|
||||
|
||||
m_removeButton = new QPushButton(this);
|
||||
m_removeButton->setText(clean ? tr("Remove clean step") : tr("Remove build step"));
|
||||
m_removeButton->setMenu(new QMenu(this));
|
||||
hboxLayout->addWidget(m_removeButton);
|
||||
hboxLayout->addStretch(10);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
m_addButton->setAttribute(Qt::WA_MacSmallSize);
|
||||
m_removeButton->setAttribute(Qt::WA_MacSmallSize);
|
||||
#endif
|
||||
|
||||
m_vbox->addLayout(hboxLayout);
|
||||
|
||||
connect(m_addButton->menu(), SIGNAL(aboutToShow()),
|
||||
this, SLOT(updateAddBuildStepMenu()));
|
||||
|
||||
connect(m_removeButton->menu(), SIGNAL(aboutToShow()),
|
||||
this, SLOT(updateRemoveBuildStepMenu()));
|
||||
Q_UNUSED(project);
|
||||
}
|
||||
|
||||
BuildStepsPage::~BuildStepsPage()
|
||||
@@ -110,18 +82,21 @@ QString BuildStepsPage::displayName() const
|
||||
return m_clean ? tr("Clean Steps") : tr("Build Steps");
|
||||
}
|
||||
|
||||
void BuildStepsPage::init(const QString &buildConfiguration)
|
||||
void BuildStepsPage::init(BuildConfiguration *bc)
|
||||
{
|
||||
QTC_ASSERT(bc, return);
|
||||
|
||||
setupUi();
|
||||
|
||||
foreach(BuildStepsWidgetStruct s, m_buildSteps) {
|
||||
delete s.widget;
|
||||
delete s.detailsWidget;
|
||||
}
|
||||
m_buildSteps.clear();
|
||||
|
||||
m_configuration = buildConfiguration;
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
m_configuration = bc;
|
||||
|
||||
const QList<BuildStep *> &steps = m_clean ? bc->cleanSteps() : bc->buildSteps();
|
||||
const QList<BuildStep *> &steps = m_clean ? m_configuration->cleanSteps() : m_configuration->buildSteps();
|
||||
int i = 0;
|
||||
foreach (BuildStep *bs, steps) {
|
||||
addBuildStepWidget(i, bs);
|
||||
@@ -143,8 +118,8 @@ void BuildStepsPage::updateAddBuildStepMenu()
|
||||
QMap<QString, QPair<QString, IBuildStepFactory *> > map;
|
||||
//Build up a list of possible steps and save map the display names to the (internal) name and factories.
|
||||
QList<IBuildStepFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>();
|
||||
foreach (IBuildStepFactory * factory, factories) {
|
||||
QStringList names = factory->canCreateForProject(m_pro);
|
||||
foreach (IBuildStepFactory *factory, factories) {
|
||||
QStringList names = factory->canCreateForBuildConfiguration(m_configuration);
|
||||
foreach (const QString &name, names) {
|
||||
map.insert(factory->displayNameForName(name), QPair<QString, IBuildStepFactory *>(name, factory));
|
||||
}
|
||||
@@ -188,138 +163,144 @@ void BuildStepsPage::addBuildStepWidget(int pos, BuildStep *step)
|
||||
s.upButton->setIconSize(QSize(10, 10));
|
||||
s.downButton->setIconSize(QSize(10, 10));
|
||||
#endif
|
||||
s.removeButton = new QPushButton(this);
|
||||
s.removeButton->setText(QChar('X'));
|
||||
s.removeButton->setMaximumHeight(22);
|
||||
s.removeButton->setMaximumWidth(22);
|
||||
|
||||
// layout
|
||||
QWidget *toolWidget = new QWidget(s.detailsWidget);
|
||||
toolWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
s.hbox = new QHBoxLayout(toolWidget);
|
||||
s.hbox->setMargin(0);
|
||||
s.hbox->setSpacing(0);
|
||||
s.hbox->addWidget(s.upButton);
|
||||
s.hbox->addWidget(s.downButton);
|
||||
QHBoxLayout *hbox = new QHBoxLayout();
|
||||
toolWidget->setLayout(hbox);
|
||||
hbox->setMargin(0);
|
||||
hbox->setSpacing(0);
|
||||
hbox->addWidget(s.upButton);
|
||||
hbox->addWidget(s.downButton);
|
||||
hbox->addWidget(s.removeButton);
|
||||
|
||||
s.detailsWidget->setToolWidget(toolWidget);
|
||||
|
||||
const int leftMargin(qMax(m_leftMargin - toolWidget->width(), 0));
|
||||
s.detailsWidget->setContentsMargins(leftMargin, 0, 0, 1);
|
||||
|
||||
m_buildSteps.insert(pos, s);
|
||||
|
||||
m_vbox->insertWidget(pos, s.detailsWidget);
|
||||
|
||||
connect(s.widget, SIGNAL(updateSummary()),
|
||||
this, SLOT(updateSummary()));
|
||||
|
||||
connect(s.upButton, SIGNAL(clicked()),
|
||||
this, SLOT(upBuildStep()));
|
||||
m_upMapper, SLOT(map()));
|
||||
connect(s.downButton, SIGNAL(clicked()),
|
||||
this, SLOT(downBuildStep()));
|
||||
m_downMapper, SLOT(map()));
|
||||
connect(s.removeButton, SIGNAL(clicked()),
|
||||
m_removeMapper, SLOT(map()));
|
||||
}
|
||||
|
||||
void BuildStepsPage::addBuildStep()
|
||||
{
|
||||
if (QAction *action = qobject_cast<QAction *>(sender())) {
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
QPair<QString, IBuildStepFactory *> pair = m_addBuildStepHash.value(action);
|
||||
BuildStep *newStep = pair.second->create(m_pro, bc, pair.first);
|
||||
int pos = m_clean ? bc->cleanSteps().count() : bc->buildSteps().count();
|
||||
m_clean ? bc->insertCleanStep(pos, newStep) : bc->insertBuildStep(pos, newStep);
|
||||
BuildStep *newStep = pair.second->create(m_configuration, pair.first);
|
||||
int pos = m_clean ? m_configuration->cleanSteps().count() : m_configuration->buildSteps().count();
|
||||
m_clean ? m_configuration->insertCleanStep(pos, newStep) : m_configuration->insertBuildStep(pos, newStep);
|
||||
|
||||
addBuildStepWidget(pos, newStep);
|
||||
const BuildStepsWidgetStruct s = m_buildSteps.at(pos);
|
||||
s.widget->init();
|
||||
s.detailsWidget->setSummaryText(s.widget->summaryText());
|
||||
s.detailsWidget->setExpanded(true);
|
||||
}
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
|
||||
void BuildStepsPage::updateRemoveBuildStepMenu()
|
||||
{
|
||||
QMenu *menu = m_removeButton->menu();
|
||||
menu->clear();
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
const QList<BuildStep *> &steps = m_clean ? bc->cleanSteps() : bc->buildSteps();
|
||||
foreach(BuildStep *step, steps) {
|
||||
QAction *action = menu->addAction(step->displayName());
|
||||
if (step->immutable())
|
||||
action->setEnabled(false);
|
||||
connect(action, SIGNAL(triggered()),
|
||||
this, SLOT(removeBuildStep()));
|
||||
}
|
||||
}
|
||||
|
||||
void BuildStepsPage::removeBuildStep()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
if (action) {
|
||||
int pos = m_removeButton->menu()->actions().indexOf(action);
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
const QList<BuildStep *> &steps = m_clean ? bc->cleanSteps() : bc->buildSteps();
|
||||
if (steps.at(pos)->immutable())
|
||||
return;
|
||||
|
||||
BuildStepsWidgetStruct s = m_buildSteps.at(pos);
|
||||
delete s.widget;
|
||||
delete s.detailsWidget;
|
||||
m_buildSteps.removeAt(pos);
|
||||
m_clean ? bc->removeCleanStep(pos) : bc->removeBuildStep(pos);
|
||||
}
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
|
||||
void BuildStepsPage::upBuildStep()
|
||||
{
|
||||
int pos = -1;
|
||||
QToolButton *tb = qobject_cast<QToolButton *>(sender());
|
||||
if (!tb)
|
||||
return;
|
||||
|
||||
for (int i=0; i<m_buildSteps.count(); ++i) {
|
||||
if (m_buildSteps.at(i).upButton == tb) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pos == -1)
|
||||
return;
|
||||
|
||||
stepMoveUp(pos);
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
|
||||
void BuildStepsPage::downBuildStep()
|
||||
{
|
||||
int pos = -1;
|
||||
QToolButton *tb = qobject_cast<QToolButton *>(sender());
|
||||
if (!tb)
|
||||
return;
|
||||
|
||||
for (int i=0; i<m_buildSteps.count(); ++i) {
|
||||
if (m_buildSteps.at(i).downButton == tb) {
|
||||
pos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pos == -1)
|
||||
return;
|
||||
|
||||
stepMoveUp(pos + 1);
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
|
||||
void BuildStepsPage::stepMoveUp(int pos)
|
||||
{
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
m_clean ? bc->moveCleanStepUp(pos) : bc->moveBuildStepUp(pos);
|
||||
m_clean ? m_configuration->moveCleanStepUp(pos) : m_configuration->moveBuildStepUp(pos);
|
||||
|
||||
m_vbox->insertWidget(pos - 1, m_buildSteps.at(pos).detailsWidget);
|
||||
|
||||
BuildStepsWidgetStruct tmp = m_buildSteps.at(pos -1);
|
||||
m_buildSteps[pos -1] = m_buildSteps.at(pos);
|
||||
m_buildSteps[pos] = tmp;
|
||||
m_buildSteps.swap(pos - 1, pos);
|
||||
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
|
||||
void BuildStepsPage::stepMoveDown(int pos)
|
||||
{
|
||||
stepMoveUp(pos + 1);
|
||||
}
|
||||
|
||||
void BuildStepsPage::stepRemove(int pos)
|
||||
{
|
||||
BuildStepsWidgetStruct s = m_buildSteps.at(pos);
|
||||
delete s.widget;
|
||||
delete s.detailsWidget;
|
||||
m_buildSteps.removeAt(pos);
|
||||
m_clean ? m_configuration->removeCleanStep(pos) : m_configuration->removeBuildStep(pos);
|
||||
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
|
||||
void BuildStepsPage::setupUi()
|
||||
{
|
||||
if (0 != m_addButton)
|
||||
return;
|
||||
|
||||
QMargins margins(contentsMargins());
|
||||
m_leftMargin = margins.left();
|
||||
margins.setLeft(0);
|
||||
setContentsMargins(margins);
|
||||
|
||||
m_upMapper = new QSignalMapper(this);
|
||||
connect(m_upMapper, SIGNAL(mapped(int)),
|
||||
this, SLOT(stepMoveUp(int)));
|
||||
m_downMapper = new QSignalMapper(this);
|
||||
connect(m_downMapper, SIGNAL(mapped(int)),
|
||||
this, SLOT(stepMoveDown(int)));
|
||||
m_removeMapper = new QSignalMapper(this);
|
||||
connect(m_removeMapper, SIGNAL(mapped(int)),
|
||||
this, SLOT(stepRemove(int)));
|
||||
|
||||
m_vbox = new QVBoxLayout(this);
|
||||
m_vbox->setContentsMargins(0, 0, 0, 0);
|
||||
m_vbox->setSpacing(0);
|
||||
|
||||
m_noStepsLabel = new QLabel(tr("No Build Steps"), this);
|
||||
m_noStepsLabel->setContentsMargins(m_leftMargin, 0, 0, 0);
|
||||
m_vbox->addWidget(m_noStepsLabel);
|
||||
|
||||
QHBoxLayout *hboxLayout = new QHBoxLayout();
|
||||
hboxLayout->setContentsMargins(m_leftMargin, 4, 0, 0);
|
||||
m_addButton = new QPushButton(this);
|
||||
m_addButton->setText(m_clean ? tr("Add clean step") : tr("Add build step"));
|
||||
m_addButton->setMenu(new QMenu(this));
|
||||
hboxLayout->addWidget(m_addButton);
|
||||
|
||||
hboxLayout->addStretch(10);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
m_addButton->setAttribute(Qt::WA_MacSmallSize);
|
||||
#endif
|
||||
|
||||
m_vbox->addLayout(hboxLayout);
|
||||
|
||||
connect(m_addButton->menu(), SIGNAL(aboutToShow()),
|
||||
this, SLOT(updateAddBuildStepMenu()));
|
||||
}
|
||||
|
||||
void BuildStepsPage::updateBuildStepButtonsState()
|
||||
{
|
||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
||||
const QList<BuildStep *> &steps = m_clean ? bc->cleanSteps() : bc->buildSteps();
|
||||
for(int i=0; i<m_buildSteps.count(); ++i) {
|
||||
const QList<BuildStep *> &steps = m_clean ? m_configuration->cleanSteps() : m_configuration->buildSteps();
|
||||
for(int i = 0; i < m_buildSteps.count(); ++i) {
|
||||
BuildStepsWidgetStruct s = m_buildSteps.at(i);
|
||||
s.upButton->setEnabled((i>0) && !(steps.at(i)->immutable() && steps.at(i - 1)));
|
||||
s.downButton->setEnabled((i + 1< steps.count()) && !(steps.at(i)->immutable() && steps.at(i + 1)->immutable()));
|
||||
s.removeButton->setEnabled(!steps.at(i)->immutable());
|
||||
m_removeMapper->setMapping(s.removeButton, i);
|
||||
s.upButton->setEnabled((i > 0) && !(steps.at(i)->immutable() && steps.at(i - 1)));
|
||||
m_upMapper->setMapping(s.upButton, i);
|
||||
s.downButton->setEnabled((i + 1 < steps.count()) && !(steps.at(i)->immutable() && steps.at(i + 1)->immutable()));
|
||||
m_downMapper->setMapping(s.downButton, i);
|
||||
}
|
||||
}
|
||||
|
@@ -34,18 +34,17 @@
|
||||
#include <utils/detailswidget.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QTreeWidgetItem;
|
||||
class QHBoxLayout;
|
||||
class QPushButton;
|
||||
class QAbstractButton;
|
||||
class QToolButton;
|
||||
class QLabel;
|
||||
class QVBoxLayout;
|
||||
class QSignalMapper;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class Project;
|
||||
class BuildConfiguration;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
@@ -59,7 +58,7 @@ struct BuildStepsWidgetStruct
|
||||
Utils::DetailsWidget *detailsWidget;
|
||||
QToolButton *upButton;
|
||||
QToolButton *downButton;
|
||||
QHBoxLayout *hbox;
|
||||
QPushButton *removeButton;
|
||||
};
|
||||
|
||||
class BuildStepsPage : public BuildConfigWidget
|
||||
@@ -71,35 +70,37 @@ public:
|
||||
virtual ~BuildStepsPage();
|
||||
|
||||
QString displayName() const;
|
||||
void init(const QString &buildConfiguration);
|
||||
void init(BuildConfiguration *bc);
|
||||
|
||||
private slots:
|
||||
void updateAddBuildStepMenu();
|
||||
void addBuildStep();
|
||||
void updateRemoveBuildStepMenu();
|
||||
void removeBuildStep();
|
||||
void upBuildStep();
|
||||
void downBuildStep();
|
||||
void updateSummary();
|
||||
void stepMoveUp(int pos);
|
||||
void stepMoveDown(int pos);
|
||||
void stepRemove(int pos);
|
||||
|
||||
private:
|
||||
void stepMoveUp(int pos);
|
||||
void setupUi();
|
||||
void updateBuildStepButtonsState();
|
||||
void addBuildStepWidget(int pos, BuildStep *step);
|
||||
|
||||
Project *m_pro;
|
||||
QString m_configuration;
|
||||
BuildConfiguration * m_configuration;
|
||||
QHash<QAction *, QPair<QString, ProjectExplorer::IBuildStepFactory *> > m_addBuildStepHash;
|
||||
bool m_clean;
|
||||
|
||||
QList<QHBoxLayout *> m_titleLayouts;
|
||||
QList<BuildStepsWidgetStruct> m_buildSteps;
|
||||
|
||||
QVBoxLayout *m_vbox;
|
||||
|
||||
QLabel *m_noStepsLabel;
|
||||
QPushButton *m_addButton;
|
||||
QPushButton *m_removeButton;
|
||||
|
||||
QSignalMapper *m_upMapper;
|
||||
QSignalMapper *m_downMapper;
|
||||
QSignalMapper *m_removeMapper;
|
||||
|
||||
int m_leftMargin;
|
||||
};
|
||||
|
||||
} // Internal
|
||||
|
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/debugginghelper.h>
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/pathchooser.h>
|
||||
|
||||
@@ -251,8 +252,9 @@ CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Project *pro)
|
||||
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
|
||||
this, SIGNAL(baseEnvironmentChanged()));
|
||||
|
||||
connect(pro, SIGNAL(environmentChanged(QString)),
|
||||
this, SIGNAL(baseEnvironmentChanged()));
|
||||
// TODO
|
||||
// connect(pro, SIGNAL(environmentChanged(ProjectExplorer::BuildConfiguration *)),
|
||||
// this, SIGNAL(baseEnvironmentChanged()));
|
||||
|
||||
}
|
||||
|
||||
@@ -279,7 +281,7 @@ QString CustomExecutableRunConfiguration::executable() const
|
||||
{
|
||||
QString exec;
|
||||
if (QDir::isRelativePath(m_executable)) {
|
||||
Environment env = project()->environment(project()->activeBuildConfiguration());
|
||||
Environment env = project()->activeBuildConfiguration()->environment();
|
||||
exec = env.searchInPath(m_executable);
|
||||
} else {
|
||||
exec = m_executable;
|
||||
@@ -328,7 +330,7 @@ QString CustomExecutableRunConfiguration::baseWorkingDirectory() const
|
||||
QString CustomExecutableRunConfiguration::workingDirectory() const
|
||||
{
|
||||
QString wd = m_workingDirectory;
|
||||
QString bd = project()->buildDirectory(project()->activeBuildConfiguration());
|
||||
QString bd = project()->activeBuildConfiguration()->buildDirectory();
|
||||
return wd.replace("$BUILDDIR", QDir::cleanPath(bd));
|
||||
}
|
||||
|
||||
@@ -345,7 +347,7 @@ ProjectExplorer::Environment CustomExecutableRunConfiguration::baseEnvironment()
|
||||
} else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::SystemEnvironmentBase) {
|
||||
env = ProjectExplorer::Environment::systemEnvironment();
|
||||
} else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::BuildEnvironmentBase) {
|
||||
env = project()->environment(project()->activeBuildConfiguration());
|
||||
env = project()->activeBuildConfiguration()->environment();
|
||||
}
|
||||
return env;
|
||||
}
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "processstep.h"
|
||||
#include "buildstep.h"
|
||||
#include "project.h"
|
||||
#include "buildconfiguration.h"
|
||||
|
||||
#include <coreplugin/ifile.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -45,8 +46,8 @@ static const char * const PROCESS_WORKINGDIRECTORY = "abstractProcess.workingDir
|
||||
static const char * const PROCESS_ARGUMENTS = "abstractProcess.arguments";
|
||||
static const char * const PROCESS_ENABLED = "abstractProcess.enabled";
|
||||
|
||||
ProcessStep::ProcessStep(Project *pro, BuildConfiguration *bc)
|
||||
: AbstractProcessStep(pro, bc)
|
||||
ProcessStep::ProcessStep(BuildConfiguration *bc)
|
||||
: AbstractProcessStep(bc)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -64,12 +65,12 @@ ProcessStep::ProcessStep(ProcessStep *bs, BuildConfiguration *bc)
|
||||
|
||||
bool ProcessStep::init()
|
||||
{
|
||||
setEnvironment(project()->environment(buildConfiguration()));
|
||||
setEnvironment(buildConfiguration()->environment());
|
||||
QString wd = workingDirectory();
|
||||
if (wd.isEmpty())
|
||||
wd = "$BUILDDIR";
|
||||
|
||||
AbstractProcessStep::setWorkingDirectory(wd.replace("$BUILDDIR", project()->buildDirectory(buildConfiguration())));
|
||||
AbstractProcessStep::setWorkingDirectory(wd.replace("$BUILDDIR", buildConfiguration()->buildDirectory()));
|
||||
AbstractProcessStep::setCommand(m_command);
|
||||
AbstractProcessStep::setEnabled(m_enabled);
|
||||
AbstractProcessStep::setArguments(m_arguments);
|
||||
@@ -200,10 +201,10 @@ bool ProcessStepFactory::canCreate(const QString &name) const
|
||||
return name == "projectexplorer.processstep";
|
||||
}
|
||||
|
||||
BuildStep *ProcessStepFactory::create(Project *pro, BuildConfiguration *bc, const QString &name) const
|
||||
BuildStep *ProcessStepFactory::create(BuildConfiguration *bc, const QString &name) const
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
return new ProcessStep(pro, bc);
|
||||
return new ProcessStep(bc);
|
||||
}
|
||||
|
||||
BuildStep *ProcessStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) const
|
||||
@@ -211,9 +212,9 @@ BuildStep *ProcessStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) cons
|
||||
return new ProcessStep(static_cast<ProcessStep *>(bs), bc);
|
||||
}
|
||||
|
||||
QStringList ProcessStepFactory::canCreateForProject(Project *pro) const
|
||||
QStringList ProcessStepFactory::canCreateForBuildConfiguration(BuildConfiguration *bc) const
|
||||
{
|
||||
Q_UNUSED(pro)
|
||||
Q_UNUSED(bc)
|
||||
return QStringList()<<"projectexplorer.processstep";
|
||||
}
|
||||
QString ProcessStepFactory::displayNameForName(const QString &name) const
|
||||
|
@@ -45,9 +45,9 @@ class ProcessStepFactory : public IBuildStepFactory
|
||||
public:
|
||||
ProcessStepFactory();
|
||||
virtual bool canCreate(const QString &name) const;
|
||||
virtual BuildStep *create(Project *pro, BuildConfiguration *bc, const QString &name) const;
|
||||
virtual BuildStep *create(BuildConfiguration *bc, const QString &name) const;
|
||||
virtual BuildStep *clone(BuildStep *bs, BuildConfiguration *bc) const;
|
||||
virtual QStringList canCreateForProject(Project *pro) const;
|
||||
virtual QStringList canCreateForBuildConfiguration(BuildConfiguration *pro) const;
|
||||
virtual QString displayNameForName(const QString &name) const;
|
||||
};
|
||||
|
||||
@@ -55,7 +55,7 @@ class ProcessStep : public ProjectExplorer::AbstractProcessStep
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ProcessStep(Project *pro, BuildConfiguration *bc);
|
||||
ProcessStep(BuildConfiguration *bc);
|
||||
ProcessStep(ProcessStep *bs, BuildConfiguration *bc);
|
||||
virtual bool init();
|
||||
virtual void run(QFutureInterface<bool> &);
|
||||
|
@@ -74,15 +74,6 @@ QString Project::makeUnique(const QString &preferedName, const QStringList &used
|
||||
|
||||
void Project::addBuildConfiguration(BuildConfiguration *configuration)
|
||||
{
|
||||
QStringList buildConfigurationNames;
|
||||
foreach (const BuildConfiguration *bc, buildConfigurations())
|
||||
buildConfigurationNames << bc->name();
|
||||
|
||||
// Check that the internal name is not taken and use a different one otherwise
|
||||
QString configurationName = configuration->name();
|
||||
configurationName = makeUnique(configurationName, buildConfigurationNames);
|
||||
configuration->setName(configurationName);
|
||||
|
||||
// Check that we don't have a configuration with the same displayName
|
||||
QString configurationDisplayName = configuration->displayName();
|
||||
QStringList displayNames;
|
||||
@@ -94,7 +85,7 @@ void Project::addBuildConfiguration(BuildConfiguration *configuration)
|
||||
// add it
|
||||
m_buildConfigurationValues.push_back(configuration);
|
||||
|
||||
emit addedBuildConfiguration(this, configuration->name());
|
||||
emit addedBuildConfiguration(this, configuration);
|
||||
}
|
||||
|
||||
void Project::removeBuildConfiguration(BuildConfiguration *configuration)
|
||||
@@ -105,21 +96,10 @@ void Project::removeBuildConfiguration(BuildConfiguration *configuration)
|
||||
|
||||
m_buildConfigurationValues.removeOne(configuration);
|
||||
|
||||
emit removedBuildConfiguration(this, configuration->name());
|
||||
emit removedBuildConfiguration(this, configuration);
|
||||
delete configuration;
|
||||
}
|
||||
|
||||
void Project::copyBuildConfiguration(const QString &source, const QString &dest)
|
||||
{
|
||||
BuildConfiguration *sourceConfiguration = buildConfiguration(source);
|
||||
if (!sourceConfiguration)
|
||||
return;
|
||||
|
||||
m_buildConfigurationValues.push_back(new BuildConfiguration(dest, sourceConfiguration));
|
||||
|
||||
emit addedBuildConfiguration(this, dest);
|
||||
}
|
||||
|
||||
QList<BuildConfiguration *> Project::buildConfigurations() const
|
||||
{
|
||||
return m_buildConfigurationValues;
|
||||
@@ -144,7 +124,7 @@ bool Project::restoreSettings()
|
||||
if (!restoreSettingsImpl(reader))
|
||||
return false;
|
||||
|
||||
if (m_activeBuildConfiguration.isEmpty() && !m_buildConfigurationValues.isEmpty())
|
||||
if (m_activeBuildConfiguration && !m_buildConfigurationValues.isEmpty())
|
||||
setActiveBuildConfiguration(m_buildConfigurationValues.at(0));
|
||||
|
||||
if (!m_activeRunConfiguration && !m_runConfigurations.isEmpty())
|
||||
@@ -159,47 +139,48 @@ QList<BuildConfigWidget*> Project::subConfigWidgets()
|
||||
|
||||
void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
|
||||
{
|
||||
writer.saveValue("activebuildconfiguration", m_activeBuildConfiguration);
|
||||
//save m_values
|
||||
writer.saveValue("project", m_values);
|
||||
const QList<BuildConfiguration *> bcs = buildConfigurations();
|
||||
|
||||
// For compability with older versions the "name" is saved as a string instead of a number
|
||||
writer.saveValue("activebuildconfiguration", QString::number(bcs.indexOf(m_activeBuildConfiguration)));
|
||||
|
||||
//save buildsettings
|
||||
QStringList buildConfigurationNames;
|
||||
foreach (const BuildConfiguration *bc, buildConfigurations()) {
|
||||
QMap<QString, QVariant> temp = bc->toMap();
|
||||
writer.saveValue("buildConfiguration-" + bc->name(), temp);
|
||||
buildConfigurationNames << bc->name();
|
||||
for(int i=0; i < bcs.size(); ++i) {
|
||||
QMap<QString, QVariant> temp = bcs.at(i)->toMap();
|
||||
writer.saveValue("buildConfiguration-" + QString::number(i), temp);
|
||||
buildConfigurationNames << QString::number(i);
|
||||
}
|
||||
writer.saveValue("buildconfigurations", buildConfigurationNames);
|
||||
|
||||
// save each buildstep/buildConfiguration combination
|
||||
foreach (const BuildConfiguration *bc, buildConfigurations()) {
|
||||
for(int i=0; i < bcs.size(); ++i) {
|
||||
QStringList buildStepNames;
|
||||
foreach (BuildStep *buildStep, bc->buildSteps())
|
||||
foreach (BuildStep *buildStep, bcs.at(i)->buildSteps())
|
||||
buildStepNames << buildStep->name();
|
||||
writer.saveValue("buildconfiguration-" + bc->name() + "-buildsteps", buildStepNames);
|
||||
writer.saveValue("buildconfiguration-" + QString::number(i) + "-buildsteps", buildStepNames);
|
||||
|
||||
int buildstepnr = 0;
|
||||
foreach (BuildStep *buildStep, bc->buildSteps()) {
|
||||
foreach (BuildStep *buildStep, bcs.at(i)->buildSteps()) {
|
||||
QMap<QString, QVariant> temp;
|
||||
buildStep->storeIntoLocalMap(temp);
|
||||
writer.saveValue("buildconfiguration-" + bc->name() + "-buildstep" + QString().setNum(buildstepnr), temp);
|
||||
writer.saveValue("buildconfiguration-" + QString::number(i) + "-buildstep" + QString().setNum(buildstepnr), temp);
|
||||
++buildstepnr;
|
||||
}
|
||||
}
|
||||
|
||||
// save each cleanstep/buildConfiguration combination
|
||||
foreach (const BuildConfiguration *bc, buildConfigurations()) {
|
||||
for(int i=0; i < bcs.size(); ++i) {
|
||||
QStringList cleanStepNames;
|
||||
foreach (BuildStep *cleanStep, bc->cleanSteps())
|
||||
foreach (BuildStep *cleanStep, bcs.at(i)->cleanSteps())
|
||||
cleanStepNames << cleanStep->name();
|
||||
writer.saveValue("buildconfiguration-" + bc->name() + "-cleansteps", cleanStepNames);
|
||||
writer.saveValue("buildconfiguration-" + QString::number(i) + "-cleansteps", cleanStepNames);
|
||||
|
||||
int cleanstepnr = 0;
|
||||
foreach (BuildStep *cleanStep, bc->cleanSteps()) {
|
||||
foreach (BuildStep *cleanStep, bcs.at(i)->cleanSteps()) {
|
||||
QMap<QString, QVariant> temp;
|
||||
cleanStep->storeIntoLocalMap(temp);
|
||||
writer.saveValue("buildconfiguration-" + bc->name() + "-cleanstep" + QString().setNum(cleanstepnr), temp);
|
||||
writer.saveValue("buildconfiguration-" + QString::number(i) + "-cleanstep" + QString().setNum(cleanstepnr), temp);
|
||||
++cleanstepnr;
|
||||
}
|
||||
}
|
||||
@@ -223,24 +204,21 @@ void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
|
||||
|
||||
bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
{
|
||||
m_activeBuildConfiguration = reader.restoreValue("activebuildconfiguration").toString();
|
||||
|
||||
m_values = reader.restoreValue("project").toMap();
|
||||
|
||||
const QList<IBuildStepFactory *> buildStepFactories =
|
||||
ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>();
|
||||
|
||||
// restoring BuldConfigurations from settings
|
||||
const QStringList buildConfigurationNames = reader.restoreValue("buildconfigurations").toStringList();
|
||||
|
||||
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
||||
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
|
||||
addBuildConfiguration(bc);
|
||||
BuildConfiguration *bc = buildConfigurationFactory()->restore();
|
||||
|
||||
QMap<QString, QVariant> temp =
|
||||
reader.restoreValue("buildConfiguration-" + buildConfigurationName).toMap();
|
||||
bc->setValuesFromMap(temp);
|
||||
|
||||
// Restore build steps
|
||||
QVariant buildStepsValueVariant = reader.restoreValue("buildconfiguration-" + bc->name() + "-buildsteps");
|
||||
QVariant buildStepsValueVariant = reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-buildsteps");
|
||||
if(buildStepsValueVariant.isValid()) {
|
||||
int pos = 0;
|
||||
QStringList buildStepNames = buildStepsValueVariant.toStringList();
|
||||
@@ -249,7 +227,7 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
BuildStep *buildStep = 0;
|
||||
foreach (IBuildStepFactory *factory, buildStepFactories) {
|
||||
if (factory->canCreate(buildStepName)) {
|
||||
buildStep = factory->create(this, bc, buildStepName);
|
||||
buildStep = factory->create(bc, buildStepName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -259,7 +237,7 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
QMap<QString, QVariant> buildStepValues = reader.restoreValue("buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->restoreFromGlobalMap(buildStepValues);
|
||||
buildStepValues =
|
||||
reader.restoreValue("buildconfiguration-" + bc->name() + "-buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->restoreFromLocalMap(buildStepValues);
|
||||
bc->insertBuildStep(pos, buildStep);
|
||||
++pos;
|
||||
@@ -267,7 +245,7 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
}
|
||||
}
|
||||
// Restore clean steps
|
||||
QVariant cleanStepsValueVariant = reader.restoreValue("buildconfiguration-" + bc->name() + "-cleansteps");
|
||||
QVariant cleanStepsValueVariant = reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-cleansteps");
|
||||
if(cleanStepsValueVariant.isValid()) {
|
||||
int pos = 0;
|
||||
QStringList cleanStepNames = cleanStepsValueVariant.toStringList();
|
||||
@@ -276,7 +254,7 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
BuildStep *cleanStep = 0;
|
||||
foreach (IBuildStepFactory *factory, buildStepFactories) {
|
||||
if (factory->canCreate(cleanStepName)) {
|
||||
cleanStep = factory->create(this, bc, cleanStepName);
|
||||
cleanStep = factory->create(bc, cleanStepName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -286,13 +264,26 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
QMap<QString, QVariant> buildStepValues = reader.restoreValue("cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->restoreFromGlobalMap(buildStepValues);
|
||||
buildStepValues =
|
||||
reader.restoreValue("buildconfiguration-" + bc->name() + "-cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->restoreFromLocalMap(buildStepValues);
|
||||
bc->insertCleanStep(pos, cleanStep);
|
||||
++pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
addBuildConfiguration(bc);
|
||||
}
|
||||
|
||||
// Set Active Configuration
|
||||
{ // Try restoring the active configuration
|
||||
QString activeConfigurationName = reader.restoreValue("activebuildconfiguration").toString();
|
||||
int index = buildConfigurationNames.indexOf(activeConfigurationName);
|
||||
if (index != -1)
|
||||
m_activeBuildConfiguration = buildConfigurations().at(index);
|
||||
else if (!buildConfigurations().isEmpty())
|
||||
m_activeBuildConfiguration = buildConfigurations().at(0);
|
||||
else
|
||||
m_activeBuildConfiguration = 0;
|
||||
}
|
||||
|
||||
//Build Settings
|
||||
@@ -313,13 +304,14 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
}
|
||||
}
|
||||
if (factory) {
|
||||
foreach(BuildConfiguration *bc, buildConfigurations()) {
|
||||
buildStep = factory->create(this, bc, buildStepName);
|
||||
bc->insertBuildStep(pos, buildStep);
|
||||
const QList<BuildConfiguration *> &bcs = buildConfigurations();
|
||||
for(int i = 0; i < bcs.size(); ++i) {
|
||||
buildStep = factory->create(bcs.at(i), buildStepName);
|
||||
bcs.at(i)->insertBuildStep(pos, buildStep);
|
||||
QMap<QString, QVariant> buildStepValues = reader.restoreValue("buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->restoreFromGlobalMap(buildStepValues);
|
||||
buildStepValues =
|
||||
reader.restoreValue("buildconfiguration-" + bc->name() + "-buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
reader.restoreValue("buildconfiguration-" + QString::number(i) + "-buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->restoreFromLocalMap(buildStepValues);
|
||||
}
|
||||
++pos;
|
||||
@@ -345,13 +337,14 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
}
|
||||
|
||||
if (factory) {
|
||||
foreach(BuildConfiguration *bc, buildConfigurations()) {
|
||||
cleanStep = factory->create(this, bc, cleanStepName);
|
||||
bc->insertCleanStep(pos, cleanStep);
|
||||
const QList<BuildConfiguration *> &bcs = buildConfigurations();
|
||||
for (int i = 0; i < bcs.size(); ++i) {
|
||||
cleanStep = factory->create(bcs.at(i), cleanStepName);
|
||||
bcs.at(i)->insertCleanStep(pos, cleanStep);
|
||||
QMap<QString, QVariant> cleanStepValues = reader.restoreValue("cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->restoreFromGlobalMap(cleanStepValues);
|
||||
QMap<QString, QVariant> buildStepValues =
|
||||
reader.restoreValue("buildconfiguration-" + bc->name() + "-cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
reader.restoreValue("buildconfiguration-" + QString::number(i) + "-cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->restoreFromLocalMap(buildStepValues);
|
||||
}
|
||||
++pos;
|
||||
@@ -392,38 +385,15 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
return true;
|
||||
}
|
||||
|
||||
void Project::setValue(const QString &name, const QVariant & value)
|
||||
{
|
||||
m_values.insert(name, value);
|
||||
}
|
||||
|
||||
QVariant Project::value(const QString &name) const
|
||||
{
|
||||
QMap<QString, QVariant>::const_iterator it =
|
||||
m_values.find(name);
|
||||
if (it != m_values.constEnd())
|
||||
return it.value();
|
||||
else
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
BuildConfiguration *Project::buildConfiguration(const QString &name) const
|
||||
{
|
||||
for (int i = 0; i != m_buildConfigurationValues.size(); ++i)
|
||||
if (m_buildConfigurationValues.at(i)->name() == name)
|
||||
return m_buildConfigurationValues.at(i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
BuildConfiguration *Project::activeBuildConfiguration() const
|
||||
{
|
||||
return buildConfiguration(m_activeBuildConfiguration); //TODO
|
||||
return m_activeBuildConfiguration;
|
||||
}
|
||||
|
||||
void Project::setActiveBuildConfiguration(BuildConfiguration *configuration)
|
||||
{
|
||||
if (m_activeBuildConfiguration != configuration->name() && m_buildConfigurationValues.contains(configuration)) {
|
||||
m_activeBuildConfiguration = configuration->name();
|
||||
if (m_activeBuildConfiguration != configuration && m_buildConfigurationValues.contains(configuration)) {
|
||||
m_activeBuildConfiguration = configuration;
|
||||
emit activeBuildConfigurationChanged();
|
||||
}
|
||||
}
|
||||
@@ -483,23 +453,6 @@ EditorConfiguration *Project::editorConfiguration() const
|
||||
return m_editorConfiguration;
|
||||
}
|
||||
|
||||
void Project::setDisplayNameFor(BuildConfiguration *configuration, const QString &displayName)
|
||||
{
|
||||
if (configuration->displayName() == displayName)
|
||||
return;
|
||||
QString dn = displayName;
|
||||
QStringList displayNames;
|
||||
foreach (BuildConfiguration *bc, m_buildConfigurationValues) {
|
||||
if (bc != configuration)
|
||||
displayNames << bc->displayName();
|
||||
}
|
||||
dn = makeUnique(displayName, displayNames);
|
||||
|
||||
configuration->setDisplayName(displayName);
|
||||
|
||||
emit buildConfigurationDisplayNameChanged(configuration->name());
|
||||
}
|
||||
|
||||
QByteArray Project::predefinedMacros(const QString &) const
|
||||
{
|
||||
return QByteArray();
|
||||
|
@@ -86,19 +86,13 @@ public:
|
||||
// Build configuration
|
||||
void addBuildConfiguration(BuildConfiguration *configuration);
|
||||
void removeBuildConfiguration(BuildConfiguration *configuration);
|
||||
void copyBuildConfiguration(const QString &source, const QString &dest);
|
||||
BuildConfiguration *buildConfiguration(const QString & name) const;
|
||||
|
||||
QList<BuildConfiguration *> buildConfigurations() const;
|
||||
// remove and add "QString uniqueConfigurationDisplayName(const QString &proposedName) const" instead
|
||||
void setDisplayNameFor(BuildConfiguration *configuration, const QString &displayName);
|
||||
BuildConfiguration *activeBuildConfiguration() const;
|
||||
void setActiveBuildConfiguration(BuildConfiguration *configuration);
|
||||
|
||||
virtual IBuildConfigurationFactory *buildConfigurationFactory() const = 0;
|
||||
|
||||
void setValue(const QString &name, const QVariant &value);
|
||||
QVariant value(const QString &name) const;
|
||||
|
||||
// Running
|
||||
QList<RunConfiguration *> runConfigurations() const;
|
||||
void addRunConfiguration(RunConfiguration* runConfiguration);
|
||||
@@ -109,9 +103,6 @@ public:
|
||||
|
||||
EditorConfiguration *editorConfiguration() const;
|
||||
|
||||
virtual Environment environment(BuildConfiguration *configuration) const = 0;
|
||||
virtual QString buildDirectory(BuildConfiguration *configuration) const = 0;
|
||||
|
||||
void saveSettings();
|
||||
bool restoreSettings();
|
||||
|
||||
@@ -132,7 +123,6 @@ public:
|
||||
static QString makeUnique(const QString &preferedName, const QStringList &usedNames);
|
||||
signals:
|
||||
void fileListChanged();
|
||||
void buildDirectoryChanged();
|
||||
|
||||
// TODO clean up signal names
|
||||
// might be better to also have
|
||||
@@ -146,12 +136,8 @@ signals:
|
||||
void removedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
|
||||
void addedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
|
||||
|
||||
void removedBuildConfiguration(ProjectExplorer::Project *p, const QString &name);
|
||||
void addedBuildConfiguration(ProjectExplorer::Project *p, const QString &name);
|
||||
|
||||
// This signal is jut there for updating the tree list in the buildsettings wizard
|
||||
void buildConfigurationDisplayNameChanged(const QString &buildConfiguration);
|
||||
void environmentChanged(const QString &buildConfiguration);
|
||||
void removedBuildConfiguration(ProjectExplorer::Project *p, ProjectExplorer::BuildConfiguration *bc);
|
||||
void addedBuildConfiguration(ProjectExplorer::Project *p, ProjectExplorer::BuildConfiguration *bc);
|
||||
|
||||
protected:
|
||||
/* This method is called when the project .user file is saved. Simply call
|
||||
@@ -173,9 +159,8 @@ protected:
|
||||
virtual bool restoreSettingsImpl(PersistentSettingsReader &reader);
|
||||
|
||||
private:
|
||||
QMap<QString, QVariant> m_values;
|
||||
QList<BuildConfiguration *> m_buildConfigurationValues;
|
||||
QString m_activeBuildConfiguration;
|
||||
BuildConfiguration *m_activeBuildConfiguration;
|
||||
QList<RunConfiguration *> m_runConfigurations;
|
||||
RunConfiguration* m_activeRunConfiguration;
|
||||
EditorConfiguration *m_editorConfiguration;
|
||||
|
@@ -307,7 +307,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
||||
// Build parsers
|
||||
addAutoReleasedObject(new GccParserFactory);
|
||||
addAutoReleasedObject(new MsvcParserFactory);
|
||||
addAutoReleasedObject(new QMakeParserFactory);
|
||||
|
||||
// Settings page
|
||||
addAutoReleasedObject(new ProjectExplorerSettingsPage);
|
||||
@@ -1424,20 +1423,7 @@ void ProjectExplorerPlugin::buildProjectOnly()
|
||||
qDebug() << "ProjectExplorerPlugin::buildProjectOnly";
|
||||
|
||||
if (saveModifiedFiles())
|
||||
buildManager()->buildProject(d->m_currentProject, d->m_currentProject->activeBuildConfiguration()->name());
|
||||
}
|
||||
|
||||
static QStringList configurations(const QList<Project *> &projects)
|
||||
{
|
||||
QStringList result;
|
||||
foreach (const Project * pro, projects) {
|
||||
if (BuildConfiguration *bc = pro->activeBuildConfiguration()) {
|
||||
result << bc->name();
|
||||
} else {
|
||||
result << QString::null;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
buildManager()->buildProject(d->m_currentProject->activeBuildConfiguration());
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::buildProject()
|
||||
@@ -1446,8 +1432,11 @@ void ProjectExplorerPlugin::buildProject()
|
||||
qDebug() << "ProjectExplorerPlugin::buildProject";
|
||||
|
||||
if (saveModifiedFiles()) {
|
||||
const QList<Project *> & projects = d->m_session->projectOrder(d->m_currentProject);
|
||||
d->m_buildManager->buildProjects(projects, configurations(projects));
|
||||
QList<BuildConfiguration *> configurations;
|
||||
foreach (Project *pro, d->m_session->projectOrder(d->m_currentProject))
|
||||
configurations << pro->activeBuildConfiguration();
|
||||
|
||||
d->m_buildManager->buildProjects(configurations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1457,8 +1446,10 @@ void ProjectExplorerPlugin::buildSession()
|
||||
qDebug() << "ProjectExplorerPlugin::buildSession";
|
||||
|
||||
if (saveModifiedFiles()) {
|
||||
const QList<Project *> & projects = d->m_session->projectOrder();
|
||||
d->m_buildManager->buildProjects(projects, configurations(projects));
|
||||
QList<BuildConfiguration *> configurations;
|
||||
foreach (Project *pro, d->m_session->projectOrder())
|
||||
configurations << pro->activeBuildConfiguration();
|
||||
d->m_buildManager->buildProjects(configurations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1468,8 +1459,8 @@ void ProjectExplorerPlugin::rebuildProjectOnly()
|
||||
qDebug() << "ProjectExplorerPlugin::rebuildProjectOnly";
|
||||
|
||||
if (saveModifiedFiles()) {
|
||||
d->m_buildManager->cleanProject(d->m_currentProject, d->m_currentProject->activeBuildConfiguration()->name());
|
||||
d->m_buildManager->buildProject(d->m_currentProject, d->m_currentProject->activeBuildConfiguration()->name());
|
||||
d->m_buildManager->cleanProject(d->m_currentProject->activeBuildConfiguration());
|
||||
d->m_buildManager->buildProject(d->m_currentProject->activeBuildConfiguration());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1479,11 +1470,13 @@ void ProjectExplorerPlugin::rebuildProject()
|
||||
qDebug() << "ProjectExplorerPlugin::rebuildProject";
|
||||
|
||||
if (saveModifiedFiles()) {
|
||||
const QList<Project *> & projects = d->m_session->projectOrder(d->m_currentProject);
|
||||
const QStringList configs = configurations(projects);
|
||||
const QList<Project *> &projects = d->m_session->projectOrder(d->m_currentProject);
|
||||
QList<BuildConfiguration *> configurations;
|
||||
foreach (Project *pro, projects)
|
||||
configurations << pro->activeBuildConfiguration();
|
||||
|
||||
d->m_buildManager->cleanProjects(projects, configs);
|
||||
d->m_buildManager->buildProjects(projects, configs);
|
||||
d->m_buildManager->cleanProjects(configurations);
|
||||
d->m_buildManager->buildProjects(configurations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1494,10 +1487,12 @@ void ProjectExplorerPlugin::rebuildSession()
|
||||
|
||||
if (saveModifiedFiles()) {
|
||||
const QList<Project *> & projects = d->m_session->projectOrder();
|
||||
const QStringList configs = configurations(projects);
|
||||
QList<BuildConfiguration *> configurations;
|
||||
foreach (Project *pro, projects)
|
||||
configurations << pro->activeBuildConfiguration();
|
||||
|
||||
d->m_buildManager->cleanProjects(projects, configs);
|
||||
d->m_buildManager->buildProjects(projects, configs);
|
||||
d->m_buildManager->cleanProjects(configurations);
|
||||
d->m_buildManager->buildProjects(configurations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1507,7 +1502,7 @@ void ProjectExplorerPlugin::cleanProjectOnly()
|
||||
qDebug() << "ProjectExplorerPlugin::cleanProjectOnly";
|
||||
|
||||
if (saveModifiedFiles())
|
||||
d->m_buildManager->cleanProject(d->m_currentProject, d->m_currentProject->activeBuildConfiguration()->name());
|
||||
d->m_buildManager->cleanProject(d->m_currentProject->activeBuildConfiguration());
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::cleanProject()
|
||||
@@ -1517,7 +1512,10 @@ void ProjectExplorerPlugin::cleanProject()
|
||||
|
||||
if (saveModifiedFiles()) {
|
||||
const QList<Project *> & projects = d->m_session->projectOrder(d->m_currentProject);
|
||||
d->m_buildManager->cleanProjects(projects, configurations(projects));
|
||||
QList<BuildConfiguration *> configurations;
|
||||
foreach (Project *pro, projects)
|
||||
configurations << pro->activeBuildConfiguration();
|
||||
d->m_buildManager->cleanProjects(configurations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1528,21 +1526,24 @@ void ProjectExplorerPlugin::cleanSession()
|
||||
|
||||
if (saveModifiedFiles()) {
|
||||
const QList<Project *> & projects = d->m_session->projectOrder();
|
||||
d->m_buildManager->cleanProjects(projects, configurations(projects));
|
||||
QList<BuildConfiguration *> configurations;
|
||||
foreach (Project *pro, projects)
|
||||
configurations << pro->activeBuildConfiguration();
|
||||
d->m_buildManager->cleanProjects(configurations);
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::runProject()
|
||||
{
|
||||
runProjectImpl(startupProject());
|
||||
runProjectImpl(startupProject(), ProjectExplorer::Constants::RUNMODE);
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::runProjectContextMenu()
|
||||
{
|
||||
runProjectImpl(d->m_currentProject);
|
||||
runProjectImpl(d->m_currentProject, ProjectExplorer::Constants::RUNMODE);
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::runProjectImpl(Project *pro)
|
||||
void ProjectExplorerPlugin::runProjectImpl(Project *pro, QString mode)
|
||||
{
|
||||
if (!pro)
|
||||
return;
|
||||
@@ -1553,16 +1554,21 @@ void ProjectExplorerPlugin::runProjectImpl(Project *pro)
|
||||
return;
|
||||
}
|
||||
if (saveModifiedFiles()) {
|
||||
d->m_runMode = ProjectExplorer::Constants::RUNMODE;
|
||||
d->m_runMode = mode;
|
||||
d->m_delayedRunConfiguration = pro->activeRunConfiguration();
|
||||
|
||||
const QList<Project *> & projects = d->m_session->projectOrder(pro);
|
||||
d->m_buildManager->buildProjects(projects, configurations(projects));
|
||||
QList<BuildConfiguration *> configurations;
|
||||
foreach(Project *pro, projects)
|
||||
configurations << pro->activeBuildConfiguration();
|
||||
d->m_buildManager->buildProjects(configurations);
|
||||
|
||||
updateRunAction();
|
||||
}
|
||||
} else {
|
||||
// TODO this ignores RunConfiguration::isEnabled()
|
||||
if (saveModifiedFiles())
|
||||
executeRunConfiguration(pro->activeRunConfiguration(), ProjectExplorer::Constants::RUNMODE);
|
||||
executeRunConfiguration(pro->activeRunConfiguration(), mode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1572,25 +1578,7 @@ void ProjectExplorerPlugin::debugProject()
|
||||
if (!pro || d->m_debuggingRunControl )
|
||||
return;
|
||||
|
||||
if (d->m_projectExplorerSettings.buildBeforeRun && pro->hasBuildSettings()) {
|
||||
if (!pro->activeRunConfiguration()->isEnabled()) {
|
||||
if (!showBuildConfigDialog())
|
||||
return;
|
||||
}
|
||||
if (saveModifiedFiles()) {
|
||||
d->m_runMode = ProjectExplorer::Constants::DEBUGMODE;
|
||||
d->m_delayedRunConfiguration = pro->activeRunConfiguration();
|
||||
|
||||
const QList<Project *> & projects = d->m_session->projectOrder(pro);
|
||||
d->m_buildManager->buildProjects(projects, configurations(projects));
|
||||
|
||||
updateRunAction();
|
||||
}
|
||||
} else {
|
||||
// TODO this ignores RunConfiguration::isEnabled()
|
||||
if (saveModifiedFiles())
|
||||
executeRunConfiguration(pro->activeRunConfiguration(), ProjectExplorer::Constants::DEBUGMODE);
|
||||
}
|
||||
runProjectImpl(pro, ProjectExplorer::Constants::DEBUGMODE);
|
||||
}
|
||||
|
||||
bool ProjectExplorerPlugin::showBuildConfigDialog()
|
||||
@@ -1965,14 +1953,14 @@ void ProjectExplorerPlugin::populateBuildConfigurationMenu()
|
||||
d->m_buildConfigurationMenu->clear();
|
||||
if (Project *pro = d->m_currentProject) {
|
||||
const BuildConfiguration *activeBC = pro->activeBuildConfiguration();
|
||||
foreach (const BuildConfiguration *bc, pro->buildConfigurations()) {
|
||||
foreach (BuildConfiguration *bc, pro->buildConfigurations()) {
|
||||
QString displayName = bc->displayName();
|
||||
QAction *act = new QAction(displayName, d->m_buildConfigurationActionGroup);
|
||||
if (debug)
|
||||
qDebug() << "BuildConfiguration " << bc->name() << "active: " << activeBC->name();
|
||||
qDebug() << "BuildConfiguration " << bc->displayName() << "active: " << activeBC->displayName();
|
||||
act->setCheckable(true);
|
||||
act->setChecked(bc == activeBC);
|
||||
act->setData(bc->name());
|
||||
act->setData(QVariant::fromValue(bc));
|
||||
d->m_buildConfigurationMenu->addAction(act);
|
||||
}
|
||||
d->m_buildConfigurationMenu->setEnabled(true);
|
||||
@@ -1986,8 +1974,7 @@ void ProjectExplorerPlugin::buildConfigurationMenuTriggered(QAction *action)
|
||||
if (debug)
|
||||
qDebug() << "ProjectExplorerPlugin::buildConfigurationMenuTriggered";
|
||||
|
||||
d->m_currentProject->setActiveBuildConfiguration(d->m_currentProject->buildConfiguration(
|
||||
action->data().toString()));
|
||||
d->m_currentProject->setActiveBuildConfiguration(action->data().value<BuildConfiguration *>());
|
||||
}
|
||||
|
||||
void ProjectExplorerPlugin::populateRunConfigurationMenu()
|
||||
@@ -2136,9 +2123,6 @@ Internal::ProjectExplorerSettings ProjectExplorerPlugin::projectExplorerSettings
|
||||
return d->m_projectExplorerSettings;
|
||||
}
|
||||
|
||||
// ---------- BuildConfigDialog -----------
|
||||
Q_DECLARE_METATYPE(BuildConfiguration*);
|
||||
|
||||
BuildConfigDialog::BuildConfigDialog(Project *project, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
m_project(project)
|
||||
@@ -2173,7 +2157,7 @@ BuildConfigDialog::BuildConfigDialog(Project *project, QWidget *parent)
|
||||
RunConfiguration *activeRun = m_project->activeRunConfiguration();
|
||||
foreach (BuildConfiguration *config, m_project->buildConfigurations()) {
|
||||
if (activeRun->isEnabled(config)) {
|
||||
m_configCombo->addItem(config->name(), qVariantFromValue(config));
|
||||
m_configCombo->addItem(config->displayName(), QVariant::fromValue(config));
|
||||
}
|
||||
}
|
||||
if (m_configCombo->count() == 0) {
|
||||
|
@@ -215,7 +215,7 @@ private slots:
|
||||
void currentModeChanged(Core::IMode *mode);
|
||||
|
||||
private:
|
||||
void runProjectImpl(Project *pro);
|
||||
void runProjectImpl(Project *pro, QString mode);
|
||||
void executeRunConfiguration(RunConfiguration *, const QString &mode);
|
||||
bool showBuildConfigDialog();
|
||||
|
||||
|
@@ -66,7 +66,6 @@ HEADERS += projectexplorer.h \
|
||||
projectexplorersettingspage.h \
|
||||
projectwelcomepage.h \
|
||||
projectwelcomepagewidget.h \
|
||||
qmakeparser.h \
|
||||
baseprojectwizarddialog.h
|
||||
SOURCES += projectexplorer.cpp \
|
||||
projectwindow.cpp \
|
||||
@@ -121,7 +120,6 @@ SOURCES += projectexplorer.cpp \
|
||||
projectwelcomepage.cpp \
|
||||
projectwelcomepagewidget.cpp \
|
||||
corelistenercheckingforrunningbuild.cpp \
|
||||
qmakeparser.cpp \
|
||||
baseprojectwizarddialog.cpp
|
||||
FORMS += processstep.ui \
|
||||
editorsettingspropertiespage.ui \
|
||||
|
@@ -179,7 +179,6 @@ const char * const FORM_MIMETYPE = "application/x-designer";
|
||||
const char * const RESOURCE_MIMETYPE = "application/vnd.nokia.xml.qt.resource";
|
||||
|
||||
// build parsers
|
||||
const char * const BUILD_PARSER_QMAKE = "BuildParser.QMake";
|
||||
const char * const BUILD_PARSER_MSVC = "BuildParser.MSVC";
|
||||
const char * const BUILD_PARSER_GCC = "BuildParser.Gcc";
|
||||
const char * const BUILD_PARSER_RVCT = "BuildParser.Rvct";
|
||||
|
@@ -44,28 +44,28 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/ifile.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/styledbar.h>
|
||||
#include <utils/stylehelper.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QBoxLayout>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QScrollArea>
|
||||
#include <QtGui/QTabWidget>
|
||||
#include <QtGui/QTreeWidget>
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QPaintEvent>
|
||||
#include <QtGui/QMenu>
|
||||
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace ProjectExplorer::Internal;
|
||||
|
||||
namespace {
|
||||
const int ICON_SIZE(64);
|
||||
|
||||
const int ABOVE_HEADING_MARGIN(10);
|
||||
const int ABOVE_CONTENTS_MARGIN(4);
|
||||
const int BELOW_CONTENTS_MARGIN(16);
|
||||
}
|
||||
|
||||
///
|
||||
@@ -84,8 +84,9 @@ public:
|
||||
}
|
||||
void paintEvent(QPaintEvent *e)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
QPainter p(this);
|
||||
p.fillRect(e->rect(), QBrush(Utils::StyleHelper::borderColor()));
|
||||
p.fillRect(contentsRect(), QBrush(Utils::StyleHelper::borderColor()));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -94,7 +95,7 @@ public:
|
||||
///
|
||||
|
||||
PanelsWidget::Panel::Panel(QWidget * w) :
|
||||
iconLabel(0), lineWidget(0), nameLabel(0), panelWidget(w), spacer(0)
|
||||
iconLabel(0), lineWidget(0), nameLabel(0), panelWidget(w)
|
||||
{ }
|
||||
|
||||
PanelsWidget::Panel::~Panel()
|
||||
@@ -103,7 +104,6 @@ PanelsWidget::Panel::~Panel()
|
||||
delete lineWidget;
|
||||
delete nameLabel;
|
||||
// do not delete panelWidget, we do not own it!
|
||||
delete spacer;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -118,16 +118,10 @@ PanelsWidget::PanelsWidget(QWidget *parent) :
|
||||
// side of the screen.
|
||||
m_root->setMaximumWidth(800);
|
||||
// The layout holding the individual panels:
|
||||
m_layout = new QGridLayout;
|
||||
m_layout->setColumnMinimumWidth(0, ICON_SIZE);
|
||||
|
||||
// A helper layout to glue some stretch to the button of
|
||||
// the panel layout:
|
||||
QVBoxLayout * vbox = new QVBoxLayout;
|
||||
vbox->addLayout(m_layout);
|
||||
vbox->addStretch(10);
|
||||
|
||||
m_root->setLayout(vbox);
|
||||
m_layout = new QGridLayout(m_root);
|
||||
m_layout->setColumnMinimumWidth(0, ICON_SIZE + 4);
|
||||
m_layout->setSpacing(0);
|
||||
m_layout->setRowStretch(0, 10);
|
||||
|
||||
// Add horizontal space to the left of our widget:
|
||||
QHBoxLayout *hbox = new QHBoxLayout;
|
||||
@@ -155,15 +149,17 @@ PanelsWidget::~PanelsWidget()
|
||||
* Add a widget into the grid layout of the PanelsWidget.
|
||||
*
|
||||
* ...
|
||||
* +--------+-------------------------------------------+
|
||||
* | | widget |
|
||||
* +--------+-------------------------------------------+
|
||||
* +--------+-------------------------------------------+ ABOVE_CONTENTS_MARGIN
|
||||
* | widget (with contentsmargins adjusted!) |
|
||||
* +--------+-------------------------------------------+ BELOW_CONTENTS_MARGIN
|
||||
*/
|
||||
void PanelsWidget::addWidget(QWidget *widget)
|
||||
{
|
||||
Panel *p = new Panel(widget);
|
||||
m_layout->addWidget(widget, m_layout->rowCount(), 1);
|
||||
m_panels.append(p);
|
||||
QTC_ASSERT(widget, return);
|
||||
|
||||
const int row(m_layout->rowCount() - 1);
|
||||
m_layout->setRowStretch(row, 0);
|
||||
addPanelWidget(new Panel(widget), row);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -171,52 +167,49 @@ void PanelsWidget::addWidget(QWidget *widget)
|
||||
* layout of the PanelsWidget.
|
||||
*
|
||||
* ...
|
||||
* +--------+-------------------------------------------+
|
||||
* | | spacer |
|
||||
* +--------+-------------------------------------------+
|
||||
* +--------+-------------------------------------------+ ABOVE_HEADING_MARGIN
|
||||
* | icon | name |
|
||||
* + +-------------------------------------------+
|
||||
* | | Line |
|
||||
* + +-------------------------------------------+
|
||||
* | | widget |
|
||||
* +--------+-------------------------------------------+
|
||||
* | | line |
|
||||
* +--------+-------------------------------------------+ ABOVE_CONTENTS_MARGIN
|
||||
* | widget (with contentsmargins adjusted!) |
|
||||
* +--------+-------------------------------------------+ BELOW_CONTENTS_MARGIN
|
||||
*/
|
||||
void PanelsWidget::addWidget(const QString &name, QWidget *widget, const QIcon & icon)
|
||||
{
|
||||
QTC_ASSERT(widget, return);
|
||||
|
||||
Panel *p = new Panel(widget);
|
||||
|
||||
// spacer:
|
||||
const int spacerRow(m_layout->rowCount());
|
||||
p->spacer = new QSpacerItem(1, 10, QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
m_layout->addItem(p->spacer, spacerRow, 1);
|
||||
|
||||
// icon:
|
||||
const int headerRow(spacerRow + 1);
|
||||
const int headerRow(m_layout->rowCount() - 1);
|
||||
m_layout->setRowStretch(headerRow, 0);
|
||||
|
||||
if (!icon.isNull()) {
|
||||
p->iconLabel = new QLabel(m_root);
|
||||
p->iconLabel->setPixmap(icon.pixmap(ICON_SIZE, ICON_SIZE));
|
||||
m_layout->addWidget(p->iconLabel, headerRow, 0, 3, 1, Qt::AlignTop | Qt::AlignHCenter);
|
||||
p->iconLabel->setContentsMargins(0, ABOVE_HEADING_MARGIN, 0, 0);
|
||||
m_layout->addWidget(p->iconLabel, headerRow, 0, 2, 1, Qt::AlignTop | Qt::AlignHCenter);
|
||||
}
|
||||
|
||||
// name:
|
||||
p->nameLabel = new QLabel(m_root);
|
||||
p->nameLabel->setText(name);
|
||||
p->nameLabel->setContentsMargins(0, ABOVE_HEADING_MARGIN, 0, 0);
|
||||
QFont f = p->nameLabel->font();
|
||||
f.setBold(true);
|
||||
f.setPointSizeF(f.pointSizeF() * 1.4);
|
||||
p->nameLabel->setFont(f);
|
||||
m_layout->addWidget(p->nameLabel, headerRow, 1);
|
||||
m_layout->addWidget(p->nameLabel, headerRow, 1, 1, 1, Qt::AlignBottom | Qt::AlignLeft);
|
||||
|
||||
// line:
|
||||
const int lineRow(headerRow + 1);
|
||||
p->lineWidget = new OnePixelBlackLine(m_root);
|
||||
m_layout->addWidget(p->lineWidget, lineRow, 1);
|
||||
|
||||
// widget:
|
||||
// add the widget:
|
||||
const int widgetRow(lineRow + 1);
|
||||
m_layout->addWidget(p->panelWidget, widgetRow, 1);
|
||||
|
||||
m_panels.append(p);
|
||||
addPanelWidget(p, widgetRow);
|
||||
}
|
||||
|
||||
QWidget *PanelsWidget::rootWidget() const
|
||||
@@ -235,13 +228,24 @@ void PanelsWidget::clear()
|
||||
m_layout->removeWidget(p->nameLabel);
|
||||
if (p->panelWidget)
|
||||
m_layout->removeWidget(p->panelWidget);
|
||||
if (p->spacer)
|
||||
m_layout->removeItem(p->spacer);
|
||||
delete p;
|
||||
}
|
||||
m_panels.clear();
|
||||
}
|
||||
|
||||
void PanelsWidget::addPanelWidget(Panel *panel, int row)
|
||||
{
|
||||
panel->panelWidget->setContentsMargins(m_layout->columnMinimumWidth(0),
|
||||
ABOVE_CONTENTS_MARGIN, 0,
|
||||
BELOW_CONTENTS_MARGIN);
|
||||
m_layout->addWidget(panel->panelWidget, row, 0, 1, 2);
|
||||
|
||||
const int stretchRow(row + 1);
|
||||
m_layout->setRowStretch(stretchRow, 10);
|
||||
|
||||
m_panels.append(panel);
|
||||
}
|
||||
|
||||
////
|
||||
// ActiveConfigurationWidget
|
||||
////
|
||||
@@ -512,7 +516,7 @@ BuildConfigurationComboBox::BuildConfigurationComboBox(Project *p, QWidget *pare
|
||||
|
||||
//m_comboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||
foreach(const BuildConfiguration *buildConfiguration, p->buildConfigurations())
|
||||
m_comboBox->addItem(buildConfiguration->displayName(), buildConfiguration->name());
|
||||
m_comboBox->addItem(buildConfiguration->displayName(), buildConfiguration);
|
||||
if (p->buildConfigurations().count() == 1) {
|
||||
m_label->setText(m_comboBox->itemText(0));
|
||||
setCurrentWidget(m_label);
|
||||
@@ -522,14 +526,15 @@ BuildConfigurationComboBox::BuildConfigurationComboBox(Project *p, QWidget *pare
|
||||
if (index != -1)
|
||||
m_comboBox->setCurrentIndex(index);
|
||||
|
||||
connect(p, SIGNAL(buildConfigurationDisplayNameChanged(QString)),
|
||||
this, SLOT(nameChanged(QString)));
|
||||
// TODO
|
||||
// connect(p, SIGNAL(buildConfigurationDisplayNameChanged(QString)),
|
||||
// this, SLOT(nameChanged(ProjectExplorer::BuildConfiguration *)));
|
||||
connect(p, SIGNAL(activeBuildConfigurationChanged()),
|
||||
this, SLOT(activeConfigurationChanged()));
|
||||
connect(p, SIGNAL(addedBuildConfiguration(ProjectExplorer::Project *, QString)),
|
||||
this, SLOT(addedBuildConfiguration(ProjectExplorer::Project *, QString)));
|
||||
connect(p, SIGNAL(removedBuildConfiguration(ProjectExplorer::Project *, QString)),
|
||||
this, SLOT(removedBuildConfiguration(ProjectExplorer::Project *, QString)));
|
||||
connect(p, SIGNAL(addedBuildConfiguration(ProjectExplorer::Project *, ProjectExplorer::BuildConfiguration *)),
|
||||
this, SLOT(addedBuildConfiguration(ProjectExplorer::Project *, ProjectExplorer::BuildConfiguration *)));
|
||||
connect(p, SIGNAL(removedBuildConfiguration(ProjectExplorer::Project *, ProjectExplorer::BuildConfiguration *)),
|
||||
this, SLOT(removedBuildConfiguration(ProjectExplorer::Project *, ProjectExplorer::BuildConfiguration *)));
|
||||
connect(m_comboBox, SIGNAL(activated(int)),
|
||||
this, SLOT(changedIndex(int)));
|
||||
}
|
||||
@@ -539,28 +544,28 @@ BuildConfigurationComboBox::~BuildConfigurationComboBox()
|
||||
|
||||
}
|
||||
|
||||
void BuildConfigurationComboBox::nameChanged(const QString &buildConfiguration)
|
||||
void BuildConfigurationComboBox::nameChanged(BuildConfiguration *bc)
|
||||
{
|
||||
int index = nameToIndex(buildConfiguration);
|
||||
const int index(buildConfigurationToIndex(bc));
|
||||
if (index == -1)
|
||||
return;
|
||||
const QString &displayName = m_project->buildConfiguration(buildConfiguration)->displayName();
|
||||
const QString &displayName = bc->displayName();
|
||||
m_comboBox->setItemText(index, displayName);
|
||||
if (m_comboBox->count() == 1)
|
||||
m_label->setText(displayName);
|
||||
}
|
||||
|
||||
int BuildConfigurationComboBox::nameToIndex(const QString &buildConfiguration)
|
||||
int BuildConfigurationComboBox::buildConfigurationToIndex(BuildConfiguration *bc)
|
||||
{
|
||||
for (int i=0; i < m_comboBox->count(); ++i)
|
||||
if (m_comboBox->itemData(i) == buildConfiguration)
|
||||
if (m_comboBox->itemData(i).value<BuildConfiguration *>() == bc)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void BuildConfigurationComboBox::activeConfigurationChanged()
|
||||
{
|
||||
int index = nameToIndex(m_project->activeBuildConfiguration()->name());
|
||||
const int index(buildConfigurationToIndex(m_project->activeBuildConfiguration()));
|
||||
if (index == -1)
|
||||
return;
|
||||
ignoreIndexChange = true;
|
||||
@@ -568,20 +573,26 @@ void BuildConfigurationComboBox::activeConfigurationChanged()
|
||||
ignoreIndexChange = false;
|
||||
}
|
||||
|
||||
void BuildConfigurationComboBox::addedBuildConfiguration(ProjectExplorer::Project *,const QString &buildConfiguration)
|
||||
void BuildConfigurationComboBox::addedBuildConfiguration(ProjectExplorer::Project *project,
|
||||
BuildConfiguration *bc)
|
||||
{
|
||||
Q_UNUSED(project);
|
||||
ignoreIndexChange = true;
|
||||
m_comboBox->addItem(m_project->buildConfiguration(buildConfiguration)->displayName(), buildConfiguration);
|
||||
m_comboBox->addItem(bc->displayName(), QVariant::fromValue(bc));
|
||||
|
||||
if (m_comboBox->count() == 2)
|
||||
setCurrentWidget(m_comboBox);
|
||||
ignoreIndexChange = false;
|
||||
}
|
||||
|
||||
void BuildConfigurationComboBox::removedBuildConfiguration(ProjectExplorer::Project *, const QString &buildConfiguration)
|
||||
void BuildConfigurationComboBox::removedBuildConfiguration(ProjectExplorer::Project *project,
|
||||
BuildConfiguration * bc)
|
||||
{
|
||||
Q_UNUSED(project);
|
||||
ignoreIndexChange = true;
|
||||
int index = nameToIndex(buildConfiguration);
|
||||
const int index(buildConfigurationToIndex(bc));
|
||||
if (index == -1)
|
||||
return;
|
||||
m_comboBox->removeItem(index);
|
||||
if (m_comboBox->count() == 1) {
|
||||
m_label->setText(m_comboBox->itemText(0));
|
||||
@@ -594,8 +605,7 @@ void BuildConfigurationComboBox::changedIndex(int newIndex)
|
||||
{
|
||||
if (newIndex == -1)
|
||||
return;
|
||||
m_project->setActiveBuildConfiguration(
|
||||
m_project->buildConfiguration(m_comboBox->itemData(newIndex).toString()));
|
||||
m_project->setActiveBuildConfiguration(m_comboBox->itemData(newIndex).value<BuildConfiguration *>());
|
||||
}
|
||||
|
||||
///
|
||||
@@ -719,19 +729,13 @@ ProjectWindow::ProjectWindow(QWidget *parent)
|
||||
m_panelsWidget = new PanelsWidget(this);
|
||||
viewLayout->addWidget(m_panelsWidget);
|
||||
|
||||
// Run and build configuration selection area:
|
||||
// Run and build configuration selection panel:
|
||||
m_activeConfigurationWidget = new ActiveConfigurationWidget(m_panelsWidget->rootWidget());
|
||||
|
||||
// Spacer and line:
|
||||
m_spacerBetween = new QWidget(m_panelsWidget->rootWidget());
|
||||
QVBoxLayout *spacerVbox = new QVBoxLayout(m_spacerBetween);
|
||||
spacerVbox->setMargin(0);
|
||||
m_spacerBetween->setLayout(spacerVbox);
|
||||
spacerVbox->addSpacerItem(new QSpacerItem(10, 15, QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
spacerVbox->addWidget(new OnePixelBlackLine(m_spacerBetween));
|
||||
spacerVbox->addSpacerItem(new QSpacerItem(10, 15, QSizePolicy::Fixed, QSizePolicy::Fixed));
|
||||
// Spacer and line panel:
|
||||
m_spacerBetween = new OnePixelBlackLine(m_panelsWidget->rootWidget());
|
||||
|
||||
// Project chooser:
|
||||
// Project chooser panel:
|
||||
m_projectChooser = new QWidget(m_panelsWidget->rootWidget());
|
||||
QHBoxLayout *hbox = new QHBoxLayout(m_projectChooser);
|
||||
hbox->setMargin(0);
|
||||
|
@@ -30,32 +30,26 @@
|
||||
#ifndef PROJECTWINDOW_H
|
||||
#define PROJECTWINDOW_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QScrollArea>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtCore/QPair>
|
||||
#include <QtGui/QStackedWidget>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QScrollArea>
|
||||
#include <QtGui/QStackedWidget>
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLabel;
|
||||
class QGridLayout;
|
||||
class QModelIndex;
|
||||
class QTabWidget;
|
||||
class QHBoxLayout;
|
||||
class QComboBox;
|
||||
class QMenu;
|
||||
class QSpacerItem;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
class IPropertiesPanel;
|
||||
class Project;
|
||||
class ProjectExplorerPlugin;
|
||||
class SessionManager;
|
||||
class BuildConfiguration;
|
||||
|
||||
namespace Internal {
|
||||
|
||||
@@ -78,17 +72,18 @@ private:
|
||||
struct Panel
|
||||
{
|
||||
// This does not take ownership of widget!
|
||||
explicit Panel(QWidget * widget);
|
||||
explicit Panel(QWidget *widget);
|
||||
~Panel();
|
||||
|
||||
QLabel *iconLabel;
|
||||
QWidget *lineWidget;
|
||||
QLabel *nameLabel;
|
||||
QWidget *panelWidget;
|
||||
QSpacerItem *spacer;
|
||||
};
|
||||
QList<Panel *> m_panels;
|
||||
|
||||
void addPanelWidget(Panel *panel, int row);
|
||||
|
||||
QGridLayout *m_layout;
|
||||
QWidget *m_root;
|
||||
};
|
||||
@@ -100,13 +95,15 @@ public:
|
||||
BuildConfigurationComboBox(ProjectExplorer::Project *p, QWidget *parent = 0);
|
||||
~BuildConfigurationComboBox();
|
||||
private slots:
|
||||
void nameChanged(const QString &buildConfiguration);
|
||||
void nameChanged(BuildConfiguration *bc);
|
||||
void activeConfigurationChanged();
|
||||
void addedBuildConfiguration(ProjectExplorer::Project *, const QString &buildConfiguration);
|
||||
void removedBuildConfiguration(ProjectExplorer::Project *, const QString &buildConfiguration);
|
||||
void addedBuildConfiguration(ProjectExplorer::Project *project,
|
||||
BuildConfiguration *bc);
|
||||
void removedBuildConfiguration(ProjectExplorer::Project *project,
|
||||
BuildConfiguration *bc);
|
||||
void changedIndex(int newIndex);
|
||||
private:
|
||||
int nameToIndex(const QString &buildConfiguration);
|
||||
int buildConfigurationToIndex(BuildConfiguration *bc);
|
||||
bool ignoreIndexChange;
|
||||
ProjectExplorer::Project *m_project;
|
||||
QComboBox *m_comboBox;
|
||||
|
@@ -853,7 +853,6 @@ Project *SessionManager::projectForFile(const QString &fileName) const
|
||||
foreach (Project *p, projectList)
|
||||
if (p != currentProject && projectContainsFile(p, fileName))
|
||||
return p;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -666,7 +666,7 @@ static int blockStartState(const QTextBlock &block)
|
||||
return state & 0xff;
|
||||
}
|
||||
|
||||
void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar typedChar)
|
||||
void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar /*typedChar*/)
|
||||
{
|
||||
TextEditor::TabSettings ts = tabSettings();
|
||||
|
||||
|
@@ -104,7 +104,7 @@ namespace QmlEditor {
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool visit(Block *ast)
|
||||
virtual bool visit(Block * /*ast*/)
|
||||
{
|
||||
// TODO
|
||||
// if (_pos > ast->lbraceToken.end() && _pos < ast->rbraceToken.offset) {
|
||||
|
@@ -162,12 +162,6 @@ QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const
|
||||
QStringList QmlProject::files() const
|
||||
{ return m_files; }
|
||||
|
||||
QString QmlProject::buildParser(BuildConfiguration *configuration) const
|
||||
{
|
||||
Q_UNUSED(configuration)
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString QmlProject::name() const
|
||||
{
|
||||
return m_projectName;
|
||||
@@ -198,18 +192,6 @@ bool QmlProject::hasBuildSettings() const
|
||||
return false;
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment QmlProject::environment(BuildConfiguration *configuration) const
|
||||
{
|
||||
Q_UNUSED(configuration)
|
||||
return ProjectExplorer::Environment::systemEnvironment();
|
||||
}
|
||||
|
||||
QString QmlProject::buildDirectory(BuildConfiguration *configuration) const
|
||||
{
|
||||
Q_UNUSED(configuration)
|
||||
return QString();
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildConfigWidget *QmlProject::createConfigWidget()
|
||||
{
|
||||
return 0;
|
||||
|
@@ -71,9 +71,6 @@ public:
|
||||
virtual bool isApplication() const;
|
||||
virtual bool hasBuildSettings() const;
|
||||
|
||||
virtual ProjectExplorer::Environment environment(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
virtual QString buildDirectory(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
virtual ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
||||
|
||||
@@ -81,7 +78,6 @@ public:
|
||||
virtual QStringList files(FilesMode fileMode) const;
|
||||
|
||||
QStringList targets() const;
|
||||
QString buildParser(ProjectExplorer::BuildConfiguration *configuration) const;
|
||||
|
||||
enum RefreshOptions {
|
||||
Files = 0x01,
|
||||
|
@@ -1,141 +0,0 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "embeddedpropertiespage.h"
|
||||
#include "qt4project.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
///
|
||||
/// EmbeddedPropertiesPanelFactory
|
||||
///
|
||||
|
||||
bool EmbeddedPropertiesPanelFactory::supports(Project *project)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
Qt4Project *pro = qobject_cast<Qt4Project *>(project);
|
||||
if (pro) {
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(project)
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
ProjectExplorer::IPropertiesPanel *EmbeddedPropertiesPanelFactory::createPanel(
|
||||
ProjectExplorer::Project *project)
|
||||
{
|
||||
return new EmbeddedPropertiesPanel(project);
|
||||
}
|
||||
|
||||
///
|
||||
/// EmbeddedPropertiesPanel
|
||||
///
|
||||
|
||||
EmbeddedPropertiesPanel::EmbeddedPropertiesPanel(ProjectExplorer::Project *project) :
|
||||
m_widget(new EmbeddedPropertiesWidget(project)),
|
||||
m_icon(":/projectexplorer/images/rebuild.png")
|
||||
{
|
||||
}
|
||||
|
||||
EmbeddedPropertiesPanel::~EmbeddedPropertiesPanel()
|
||||
{
|
||||
delete m_widget;
|
||||
}
|
||||
|
||||
QString EmbeddedPropertiesPanel::name() const
|
||||
{
|
||||
return QApplication::tr("Embedded Linux");
|
||||
}
|
||||
|
||||
QWidget *EmbeddedPropertiesPanel::widget() const
|
||||
{
|
||||
return m_widget;
|
||||
}
|
||||
|
||||
QIcon EmbeddedPropertiesPanel::icon() const
|
||||
{
|
||||
return m_icon;
|
||||
}
|
||||
|
||||
///
|
||||
/// EmbeddedPropertiesWidget
|
||||
///
|
||||
|
||||
EmbeddedPropertiesWidget::EmbeddedPropertiesWidget(ProjectExplorer::Project *project)
|
||||
: QWidget()
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
m_ui.virtualBoxCheckbox->setChecked(project->value("useVBOX").toBool());
|
||||
|
||||
// Find all skins
|
||||
QString skin = QFileInfo(project->value("VNCSkin").toString()).fileName();
|
||||
QStringList skins;
|
||||
|
||||
QDir skinDir = QApplication::applicationDirPath();
|
||||
skinDir.cdUp();
|
||||
if (skinDir.cd("qtembeddedtools") && skinDir.cd("qsimplevnc")) {
|
||||
skins = skinDir.entryList( QDir::Dirs | QDir::NoDotAndDotDot );
|
||||
}
|
||||
m_ui.skinComboBox->clear();
|
||||
m_ui.skinComboBox->addItems(skins);
|
||||
if (!skin.isEmpty()) {
|
||||
int index = m_ui.skinComboBox->findText(skin);
|
||||
if (index != -1)
|
||||
m_ui.skinComboBox->setCurrentIndex(index);
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(project)
|
||||
#endif
|
||||
//TODO readd finish code
|
||||
/*
|
||||
project->setValue("useVBOX", m_ui.virtualBoxCheckbox->isChecked());
|
||||
|
||||
//Skin
|
||||
QDir skinDir = QApplication::applicationDirPath();
|
||||
skinDir.cdUp();
|
||||
skinDir.cd("qtembeddedtools");
|
||||
skinDir.cd("qsimplevnc");
|
||||
project->setValue("VNCSkin", skinDir.absolutePath() + "/" + m_ui.skinComboBox->currentText() + "/" + m_ui.skinComboBox->currentText());
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
EmbeddedPropertiesWidget::~EmbeddedPropertiesWidget()
|
||||
{
|
||||
}
|
||||
|
@@ -1,46 +0,0 @@
|
||||
<ui version="4.0" >
|
||||
<class>EmbeddedPropertiesPage</class>
|
||||
<widget class="QWidget" name="EmbeddedPropertiesPage" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>649</width>
|
||||
<height>302</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout" >
|
||||
<property name="fieldGrowthPolicy" >
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QCheckBox" name="virtualBoxCheckbox" >
|
||||
<property name="text" >
|
||||
<string>Use Virtual Box
|
||||
Note: This adds the toolchain to the build environment and runs the program inside a virtual machine.
|
||||
It also automatically sets the correct Qt version.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="skinLabel" >
|
||||
<property name="text" >
|
||||
<string>Skin:</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QComboBox" name="skinComboBox" />
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@@ -2,6 +2,7 @@
|
||||
#include "qt4project.h"
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
#include "qtversionmanager.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
|
||||
#include <utils/synchronousprocess.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
@@ -99,7 +100,8 @@ bool ExternalQtEditor::getEditorLaunchData(const QString &fileName,
|
||||
const Qt4Project *project = qt4ProjectFor(fileName);
|
||||
// Get the binary either from the current Qt version of the project or Path
|
||||
if (project) {
|
||||
const QtVersion *qtVersion= project->qtVersion(project->activeBuildConfiguration());
|
||||
Qt4BuildConfiguration *qt4bc = project->activeQt4BuildConfiguration();
|
||||
const QtVersion *qtVersion= qt4bc->qtVersion();
|
||||
data->binary = (qtVersion->*commandAccessor)();
|
||||
data->workingDirectory = QFileInfo(project->file()->fileName()).absolutePath();
|
||||
} else {
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include "makestep.h"
|
||||
|
||||
#include "qt4project.h"
|
||||
#include "qt4buildconfiguration.h"
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
@@ -44,8 +45,8 @@ using ExtensionSystem::PluginManager;
|
||||
using namespace Qt4ProjectManager;
|
||||
using namespace Qt4ProjectManager::Internal;
|
||||
|
||||
MakeStep::MakeStep(Qt4Project * project, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(project, bc), m_clean(false)
|
||||
MakeStep::MakeStep(ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bc), m_clean(false)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -53,7 +54,7 @@ MakeStep::MakeStep(Qt4Project * project, ProjectExplorer::BuildConfiguration *bc
|
||||
MakeStep::MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc)
|
||||
: AbstractMakeStep(bs, bc),
|
||||
m_clean(bs->m_clean),
|
||||
m_makeargs(bs->m_makeargs),
|
||||
m_userArgs(bs->m_userArgs),
|
||||
m_makeCmd(bs->m_makeCmd)
|
||||
{
|
||||
|
||||
@@ -64,6 +65,11 @@ MakeStep::~MakeStep()
|
||||
|
||||
}
|
||||
|
||||
Qt4BuildConfiguration *MakeStep::qt4BuildConfiguration() const
|
||||
{
|
||||
return static_cast<Qt4BuildConfiguration *>(buildConfiguration());
|
||||
}
|
||||
|
||||
void MakeStep::setClean(bool clean)
|
||||
{
|
||||
m_clean = clean;
|
||||
@@ -78,7 +84,7 @@ void MakeStep::restoreFromGlobalMap(const QMap<QString, QVariant> &map)
|
||||
|
||||
void MakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map)
|
||||
{
|
||||
m_makeargs = map.value("makeargs").toStringList();
|
||||
m_userArgs = map.value("makeargs").toStringList();
|
||||
m_makeCmd = map.value("makeCmd").toString();
|
||||
if (map.value("clean").isValid() && map.value("clean").toBool())
|
||||
m_clean = true;
|
||||
@@ -87,7 +93,7 @@ void MakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map)
|
||||
|
||||
void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
{
|
||||
map["makeargs"] = m_makeargs;
|
||||
map["makeargs"] = m_userArgs;
|
||||
map["makeCmd"] = m_makeCmd;
|
||||
if (m_clean)
|
||||
map["clean"] = true;
|
||||
@@ -96,15 +102,14 @@ void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||
|
||||
bool MakeStep::init()
|
||||
{
|
||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
||||
Environment environment = project()->environment(bc);
|
||||
Qt4BuildConfiguration *bc = qt4BuildConfiguration();
|
||||
Environment environment = bc->environment();
|
||||
setEnvironment(environment);
|
||||
|
||||
Qt4Project *qt4project = qobject_cast<Qt4Project *>(project());
|
||||
QString workingDirectory = qt4project->buildDirectory(bc);
|
||||
QString workingDirectory = bc->buildDirectory();
|
||||
setWorkingDirectory(workingDirectory);
|
||||
|
||||
QString makeCmd = qt4project->makeCommand(bc);
|
||||
QString makeCmd = bc->makeCommand();
|
||||
if (!m_makeCmd.isEmpty())
|
||||
makeCmd = m_makeCmd;
|
||||
if (!QFileInfo(makeCmd).isAbsolute()) {
|
||||
@@ -123,17 +128,17 @@ bool MakeStep::init()
|
||||
// we should stop the clean queue
|
||||
// That is mostly so that rebuild works on a alrady clean project
|
||||
setIgnoreReturnValue(m_clean);
|
||||
QStringList args = m_makeargs;
|
||||
QStringList args = m_userArgs;
|
||||
if (!m_clean) {
|
||||
if (!qt4project->defaultMakeTarget(bc).isEmpty())
|
||||
args << qt4project->defaultMakeTarget(bc);
|
||||
if (!bc->defaultMakeTarget().isEmpty())
|
||||
args << bc->defaultMakeTarget();
|
||||
}
|
||||
// -w option enables "Enter"/"Leaving directory" messages, which we need for detecting the
|
||||
// absolute file path
|
||||
// FIXME doing this without the user having a way to override this is rather bad
|
||||
// so we only do it for unix and if the user didn't override the make command
|
||||
// but for now this is the least invasive change
|
||||
ProjectExplorer::ToolChain *toolchain = qt4project->toolChain(bc);
|
||||
ProjectExplorer::ToolChain *toolchain = bc->toolChain();
|
||||
|
||||
ProjectExplorer::ToolChain::ToolChainType type = ProjectExplorer::ToolChain::UNKNOWN;
|
||||
if (toolchain)
|
||||
@@ -163,7 +168,7 @@ bool MakeStep::init()
|
||||
|
||||
void MakeStep::run(QFutureInterface<bool> & fi)
|
||||
{
|
||||
if (qobject_cast<Qt4Project *>(project())->rootProjectNode()->projectType() == ScriptTemplate) {
|
||||
if (qt4BuildConfiguration()->qt4Project()->rootProjectNode()->projectType() == ScriptTemplate) {
|
||||
fi.reportResult(true);
|
||||
return;
|
||||
}
|
||||
@@ -191,19 +196,19 @@ ProjectExplorer::BuildStepConfigWidget *MakeStep::createConfigWidget()
|
||||
return new MakeStepConfigWidget(this);
|
||||
}
|
||||
|
||||
QStringList MakeStep::makeArguments()
|
||||
QStringList MakeStep::userArguments()
|
||||
{
|
||||
return m_makeargs;
|
||||
return m_userArgs;
|
||||
}
|
||||
|
||||
void MakeStep::setMakeArguments(const QStringList &arguments)
|
||||
void MakeStep::setUserArguments(const QStringList &arguments)
|
||||
{
|
||||
m_makeargs = arguments;
|
||||
emit changed();
|
||||
m_userArgs = arguments;
|
||||
emit userArgumentsChanged();
|
||||
}
|
||||
|
||||
MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
||||
: BuildStepConfigWidget(), m_makeStep(makeStep)
|
||||
: BuildStepConfigWidget(), m_makeStep(makeStep), m_ignoreChange(false)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
connect(m_ui.makeLineEdit, SIGNAL(textEdited(QString)),
|
||||
@@ -211,9 +216,9 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
||||
connect(m_ui.makeArgumentsLineEdit, SIGNAL(textEdited(QString)),
|
||||
this, SLOT(makeArgumentsLineEditTextEdited()));
|
||||
|
||||
connect(makeStep, SIGNAL(changed()),
|
||||
this, SLOT(update()));
|
||||
connect(makeStep->project(), SIGNAL(buildDirectoryChanged()),
|
||||
connect(makeStep, SIGNAL(userArgumentsChanged()),
|
||||
this, SLOT(userArgumentsChanged()));
|
||||
connect(makeStep->buildConfiguration(), SIGNAL(buildDirectoryChanged()),
|
||||
this, SLOT(updateDetails()));
|
||||
|
||||
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
|
||||
@@ -224,22 +229,20 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
||||
|
||||
void MakeStepConfigWidget::updateMakeOverrideLabel()
|
||||
{
|
||||
Qt4Project *qt4project = qobject_cast<Qt4Project *>(m_makeStep->project());
|
||||
m_ui.makeLabel->setText(tr("Override %1:").arg(qt4project->
|
||||
makeCommand(m_makeStep->buildConfiguration())));
|
||||
Qt4BuildConfiguration *qt4bc = m_makeStep->qt4BuildConfiguration();
|
||||
m_ui.makeLabel->setText(tr("Override %1:").arg(qt4bc->makeCommand()));
|
||||
}
|
||||
|
||||
void MakeStepConfigWidget::updateDetails()
|
||||
{
|
||||
Qt4Project *pro = static_cast<Qt4Project *>(m_makeStep->project());
|
||||
ProjectExplorer::BuildConfiguration *bc = m_makeStep->buildConfiguration();
|
||||
QString workingDirectory = pro->buildDirectory(bc);
|
||||
Qt4BuildConfiguration *bc = m_makeStep->qt4BuildConfiguration();
|
||||
QString workingDirectory = bc->buildDirectory();
|
||||
|
||||
QString makeCmd = pro->makeCommand(bc);
|
||||
QString makeCmd = bc->makeCommand();
|
||||
if (!m_makeStep->m_makeCmd.isEmpty())
|
||||
makeCmd = m_makeStep->m_makeCmd;
|
||||
if (!QFileInfo(makeCmd).isAbsolute()) {
|
||||
Environment environment = pro->environment(bc);
|
||||
Environment environment = bc->environment();
|
||||
// Try to detect command in environment
|
||||
QString tmp = environment.searchInPath(makeCmd);
|
||||
if (tmp == QString::null) {
|
||||
@@ -254,9 +257,9 @@ void MakeStepConfigWidget::updateDetails()
|
||||
// FIXME doing this without the user having a way to override this is rather bad
|
||||
// so we only do it for unix and if the user didn't override the make command
|
||||
// but for now this is the least invasive change
|
||||
QStringList args = m_makeStep->makeArguments();
|
||||
QStringList args = m_makeStep->userArguments();
|
||||
ProjectExplorer::ToolChain::ToolChainType t = ProjectExplorer::ToolChain::UNKNOWN;
|
||||
ProjectExplorer::ToolChain *toolChain = pro->toolChain(bc);
|
||||
ProjectExplorer::ToolChain *toolChain = bc->toolChain();
|
||||
if (toolChain)
|
||||
t = toolChain->type();
|
||||
if (t != ProjectExplorer::ToolChain::MSVC && t != ProjectExplorer::ToolChain::WINCE) {
|
||||
@@ -278,9 +281,11 @@ QString MakeStepConfigWidget::displayName() const
|
||||
return m_makeStep->displayName();
|
||||
}
|
||||
|
||||
void MakeStepConfigWidget::update()
|
||||
void MakeStepConfigWidget::userArgumentsChanged()
|
||||
{
|
||||
init();
|
||||
const QStringList &makeArguments = m_makeStep->userArguments();
|
||||
m_ui.makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
void MakeStepConfigWidget::init()
|
||||
@@ -290,7 +295,7 @@ void MakeStepConfigWidget::init()
|
||||
const QString &makeCmd = m_makeStep->m_makeCmd;
|
||||
m_ui.makeLineEdit->setText(makeCmd);
|
||||
|
||||
const QStringList &makeArguments = m_makeStep->makeArguments();
|
||||
const QStringList &makeArguments = m_makeStep->userArguments();
|
||||
m_ui.makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
|
||||
updateDetails();
|
||||
}
|
||||
@@ -303,8 +308,10 @@ void MakeStepConfigWidget::makeLineEditTextEdited()
|
||||
|
||||
void MakeStepConfigWidget::makeArgumentsLineEditTextEdited()
|
||||
{
|
||||
m_makeStep->setMakeArguments(
|
||||
m_ignoreChange = true;
|
||||
m_makeStep->setUserArguments(
|
||||
ProjectExplorer::Environment::parseCombinedArgString(m_ui.makeArgumentsLineEdit->text()));
|
||||
m_ignoreChange = false;
|
||||
updateDetails();
|
||||
}
|
||||
|
||||
@@ -325,10 +332,10 @@ bool MakeStepFactory::canCreate(const QString & name) const
|
||||
return (name == Constants::MAKESTEP);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *MakeStepFactory::create(ProjectExplorer::Project *pro, ProjectExplorer::BuildConfiguration *bc, const QString & name) const
|
||||
ProjectExplorer::BuildStep *MakeStepFactory::create(ProjectExplorer::BuildConfiguration *bc, const QString & name) const
|
||||
{
|
||||
Q_UNUSED(name)
|
||||
return new MakeStep(static_cast<Qt4Project *>(pro), bc);
|
||||
return new MakeStep(bc);
|
||||
}
|
||||
|
||||
ProjectExplorer::BuildStep *MakeStepFactory::clone(ProjectExplorer::BuildStep *bs, ProjectExplorer::BuildConfiguration *bc) const
|
||||
@@ -336,9 +343,9 @@ ProjectExplorer::BuildStep *MakeStepFactory::clone(ProjectExplorer::BuildStep *b
|
||||
return new MakeStep(static_cast<MakeStep *>(bs), bc);
|
||||
}
|
||||
|
||||
QStringList MakeStepFactory::canCreateForProject(ProjectExplorer::Project *pro) const
|
||||
QStringList MakeStepFactory::canCreateForBuildConfiguration(ProjectExplorer::BuildConfiguration *pro) const
|
||||
{
|
||||
if (qobject_cast<Qt4Project *>(pro))
|
||||
if (qobject_cast<Qt4BuildConfiguration *>(pro))
|
||||
return QStringList() << Constants::MAKESTEP;
|
||||
else
|
||||
return QStringList();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user