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
|
# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
|
||||||
# will append .docset to the name.
|
# 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
|
# 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
|
# 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/QMap>
|
||||||
#include <QtCore/QSet>
|
#include <QtCore/QSet>
|
||||||
#include <QtCore/QVariant>
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
|
#include <QtCore/QCoreApplication>
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -51,6 +53,7 @@ bool optTestUninitialized = false;
|
|||||||
bool optTestAll = false;
|
bool optTestAll = false;
|
||||||
bool optEmptyContainers = false;
|
bool optEmptyContainers = false;
|
||||||
unsigned optVerbose = 0;
|
unsigned optVerbose = 0;
|
||||||
|
const char *appPath = 0;
|
||||||
|
|
||||||
// Provide address of type of be tested.
|
// Provide address of type of be tested.
|
||||||
// When testing unitialized memory, allocate at random.
|
// When testing unitialized memory, allocate at random.
|
||||||
@@ -482,7 +485,6 @@ static int dumpStdMapStringString()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int dumpQObject()
|
static int dumpQObject()
|
||||||
{
|
{
|
||||||
// Requires the childOffset to be know, but that is not critical
|
// Requires the childOffset to be know, but that is not critical
|
||||||
@@ -517,6 +519,16 @@ static int dumpQObject()
|
|||||||
return 0;
|
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()
|
static int dumpQObjectList()
|
||||||
{
|
{
|
||||||
// Requires the childOffset to be know, but that is not critical
|
// 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("set<QString>", dumpStdQStringSet);
|
||||||
rc.insert("map<int,string>", dumpStdMapIntString);
|
rc.insert("map<int,string>", dumpStdMapIntString);
|
||||||
rc.insert("map<string,string>", dumpStdMapStringString);
|
rc.insert("map<string,string>", dumpStdMapStringString);
|
||||||
|
rc.insert("QFileInfo", dumpQFileInfo);
|
||||||
rc.insert("QObject", dumpQObject);
|
rc.insert("QObject", dumpQObject);
|
||||||
rc.insert("QObjectList", dumpQObjectList);
|
rc.insert("QObjectList", dumpQObjectList);
|
||||||
rc.insert("QVariant", dumpQVariant);
|
rc.insert("QVariant", dumpQVariant);
|
||||||
@@ -592,6 +605,7 @@ static void usage(const char *b, const TypeDumpFunctionMap &tdm)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
appPath = argv[0];
|
||||||
printf("\nQt Creator Debugging Helper testing tool\n\n");
|
printf("\nQt Creator Debugging Helper testing tool\n\n");
|
||||||
printf("Running query protocol\n");
|
printf("Running query protocol\n");
|
||||||
qDumpObjectData440(1, 42, 0, 1, 0, 0, 0, 0);
|
qDumpObjectData440(1, 42, 0, 1, 0, 0, 0, 0);
|
||||||
|
@@ -65,7 +65,7 @@ void CheckUndefinedSymbols::operator()(AST *ast)
|
|||||||
QByteArray CheckUndefinedSymbols::templateParameterName(NameAST *ast) const
|
QByteArray CheckUndefinedSymbols::templateParameterName(NameAST *ast) const
|
||||||
{
|
{
|
||||||
if (ast && ast->name) {
|
if (ast && ast->name) {
|
||||||
if (Identifier *id = ast->name->identifier())
|
if (const Identifier *id = ast->name->identifier())
|
||||||
return QByteArray::fromRawData(id->chars(), id->size());
|
return QByteArray::fromRawData(id->chars(), id->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ bool CheckUndefinedSymbols::isType(const QByteArray &name) const
|
|||||||
Symbol *member = members->symbolAt(m);
|
Symbol *member = members->symbolAt(m);
|
||||||
|
|
||||||
if (member->isTypedef() && member->isDeclaration()) {
|
if (member->isTypedef() && member->isDeclaration()) {
|
||||||
if (Identifier *id = member->identifier()) {
|
if (const Identifier *id = member->identifier()) {
|
||||||
if (name == id->chars())
|
if (name == id->chars())
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ bool CheckUndefinedSymbols::isType(const QByteArray &name) const
|
|||||||
return _types.contains(name);
|
return _types.contains(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckUndefinedSymbols::isType(Identifier *id) const
|
bool CheckUndefinedSymbols::isType(const Identifier *id) const
|
||||||
{
|
{
|
||||||
if (! id)
|
if (! id)
|
||||||
return false;
|
return false;
|
||||||
@@ -122,21 +122,21 @@ bool CheckUndefinedSymbols::isType(Identifier *id) const
|
|||||||
return isType(QByteArray::fromRawData(id->chars(), id->size()));
|
return isType(QByteArray::fromRawData(id->chars(), id->size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckUndefinedSymbols::addType(Name *name)
|
void CheckUndefinedSymbols::addType(const Name *name)
|
||||||
{
|
{
|
||||||
if (! name)
|
if (! name)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Identifier *id = name->identifier())
|
if (const Identifier *id = name->identifier())
|
||||||
_types.insert(QByteArray(id->chars(), id->size()));
|
_types.insert(QByteArray(id->chars(), id->size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckUndefinedSymbols::addProtocol(Name *name)
|
void CheckUndefinedSymbols::addProtocol(const Name *name)
|
||||||
{
|
{
|
||||||
if (!name)
|
if (!name)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Identifier *id = name->identifier())
|
if (const Identifier *id = name->identifier())
|
||||||
_protocols.insert(QByteArray(id->chars(), id->size()));
|
_protocols.insert(QByteArray(id->chars(), id->size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,7 +176,7 @@ void CheckUndefinedSymbols::buildTypeMap(NamespaceBinding *binding, QSet<Namespa
|
|||||||
if (! processed->contains(binding)) {
|
if (! processed->contains(binding)) {
|
||||||
processed->insert(binding);
|
processed->insert(binding);
|
||||||
|
|
||||||
if (Identifier *id = binding->identifier()) {
|
if (const Identifier *id = binding->identifier()) {
|
||||||
_namespaceNames.insert(QByteArray(id->chars(), id->size()));
|
_namespaceNames.insert(QByteArray(id->chars(), id->size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +256,7 @@ bool CheckUndefinedSymbols::visit(NamedTypeSpecifierAST *ast)
|
|||||||
unsigned line, col;
|
unsigned line, col;
|
||||||
getTokenStartPosition(ast->firstToken(), &line, &col);
|
getTokenStartPosition(ast->firstToken(), &line, &col);
|
||||||
// qWarning() << _doc->fileName() << 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 (! isType(id)) {
|
||||||
if (FunctionDeclaratorAST *functionDeclarator = currentFunctionDeclarator()) {
|
if (FunctionDeclaratorAST *functionDeclarator = currentFunctionDeclarator()) {
|
||||||
if (functionDeclarator->as_cpp_initializer)
|
if (functionDeclarator->as_cpp_initializer)
|
||||||
@@ -294,7 +294,7 @@ bool CheckUndefinedSymbols::visit(ClassSpecifierAST *ast)
|
|||||||
Symbol *symbol = klass->memberAt(i);
|
Symbol *symbol = klass->memberAt(i);
|
||||||
|
|
||||||
if (symbol->name() && symbol->name()->isNameId()) {
|
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")) {
|
if (! qstrcmp(nameId->identifier()->chars(), "qt_check_for_QOBJECT_macro")) {
|
||||||
hasQ_OBJECT_CHECK = true;
|
hasQ_OBJECT_CHECK = true;
|
||||||
@@ -367,8 +367,8 @@ bool CheckUndefinedSymbols::visit(BaseSpecifierAST *base)
|
|||||||
if (NameAST *nameAST = base->name) {
|
if (NameAST *nameAST = base->name) {
|
||||||
bool resolvedBaseClassName = false;
|
bool resolvedBaseClassName = false;
|
||||||
|
|
||||||
if (Name *name = nameAST->name) {
|
if (const Name *name = nameAST->name) {
|
||||||
Identifier *id = name->identifier();
|
const Identifier *id = name->identifier();
|
||||||
const QByteArray spell = QByteArray::fromRawData(id->chars(), id->size());
|
const QByteArray spell = QByteArray::fromRawData(id->chars(), id->size());
|
||||||
if (isType(spell))
|
if (isType(spell))
|
||||||
resolvedBaseClassName = true;
|
resolvedBaseClassName = true;
|
||||||
@@ -403,10 +403,10 @@ bool CheckUndefinedSymbols::visit(UsingDirectiveAST *ast)
|
|||||||
bool CheckUndefinedSymbols::visit(QualifiedNameAST *ast)
|
bool CheckUndefinedSymbols::visit(QualifiedNameAST *ast)
|
||||||
{
|
{
|
||||||
if (ast->name) {
|
if (ast->name) {
|
||||||
QualifiedNameId *q = ast->name->asQualifiedNameId();
|
const QualifiedNameId *q = ast->name->asQualifiedNameId();
|
||||||
for (unsigned i = 0; i < q->nameCount() - 1; ++i) {
|
for (unsigned i = 0; i < q->nameCount() - 1; ++i) {
|
||||||
Name *name = q->nameAt(i);
|
const Name *name = q->nameAt(i);
|
||||||
if (Identifier *id = name->identifier()) {
|
if (const Identifier *id = name->identifier()) {
|
||||||
const QByteArray spell = QByteArray::fromRawData(id->chars(), id->size());
|
const QByteArray spell = QByteArray::fromRawData(id->chars(), id->size());
|
||||||
if (! (_namespaceNames.contains(spell) || isType(id))) {
|
if (! (_namespaceNames.contains(spell) || isType(id))) {
|
||||||
translationUnit()->warning(ast->firstToken(),
|
translationUnit()->warning(ast->firstToken(),
|
||||||
@@ -474,8 +474,8 @@ bool CheckUndefinedSymbols::visit(ObjCClassDeclarationAST *ast)
|
|||||||
if (NameAST *nameAST = ast->superclass) {
|
if (NameAST *nameAST = ast->superclass) {
|
||||||
bool resolvedSuperClassName = false;
|
bool resolvedSuperClassName = false;
|
||||||
|
|
||||||
if (Name *name = nameAST->name) {
|
if (const Name *name = nameAST->name) {
|
||||||
Identifier *id = name->identifier();
|
const Identifier *id = name->identifier();
|
||||||
const QByteArray spell = QByteArray::fromRawData(id->chars(), id->size());
|
const QByteArray spell = QByteArray::fromRawData(id->chars(), id->size());
|
||||||
if (isType(spell))
|
if (isType(spell))
|
||||||
resolvedSuperClassName = true;
|
resolvedSuperClassName = true;
|
||||||
@@ -496,8 +496,8 @@ bool CheckUndefinedSymbols::visit(ObjCProtocolRefsAST *ast)
|
|||||||
if (NameAST *nameAST = iter->value) {
|
if (NameAST *nameAST = iter->value) {
|
||||||
bool resolvedProtocolName = false;
|
bool resolvedProtocolName = false;
|
||||||
|
|
||||||
if (Name *name = nameAST->name) {
|
if (const Name *name = nameAST->name) {
|
||||||
Identifier *id = name->identifier();
|
const Identifier *id = name->identifier();
|
||||||
const QByteArray spell = QByteArray::fromRawData(id->chars(), id->size());
|
const QByteArray spell = QByteArray::fromRawData(id->chars(), id->size());
|
||||||
if (isProtocol(spell))
|
if (isProtocol(spell))
|
||||||
resolvedProtocolName = true;
|
resolvedProtocolName = true;
|
||||||
@@ -522,11 +522,11 @@ bool CheckUndefinedSymbols::visit(ObjCProtocolRefsAST *ast)
|
|||||||
bool CheckUndefinedSymbols::visit(ObjCPropertyDeclarationAST *ast)
|
bool CheckUndefinedSymbols::visit(ObjCPropertyDeclarationAST *ast)
|
||||||
{
|
{
|
||||||
for (List<ObjCPropertyDeclaration *> *iter = ast->symbols; iter; iter = iter->next) {
|
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.
|
// 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.
|
// FIXME: resolve the symbol for the name, and check its signature.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,14 +52,14 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
using ASTVisitor::visit;
|
using ASTVisitor::visit;
|
||||||
|
|
||||||
bool isType(Identifier *id) const;
|
bool isType(const Identifier *id) const;
|
||||||
bool isType(const QByteArray &name) const;
|
bool isType(const QByteArray &name) const;
|
||||||
|
|
||||||
void addType(Name *name);
|
void addType(const Name *name);
|
||||||
void buildTypeMap(Class *klass);
|
void buildTypeMap(Class *klass);
|
||||||
void buildMemberTypeMap(Symbol *member);
|
void buildMemberTypeMap(Symbol *member);
|
||||||
void buildTypeMap(NamespaceBinding *binding, QSet<NamespaceBinding *> *processed);
|
void buildTypeMap(NamespaceBinding *binding, QSet<NamespaceBinding *> *processed);
|
||||||
void addProtocol(Name *name);
|
void addProtocol(const Name *name);
|
||||||
bool isProtocol(const QByteArray &name) const;
|
bool isProtocol(const QByteArray &name) const;
|
||||||
|
|
||||||
FunctionDeclaratorAST *currentFunctionDeclarator() const;
|
FunctionDeclaratorAST *currentFunctionDeclarator() const;
|
||||||
|
@@ -57,7 +57,7 @@ Location::Location(Symbol *symbol)
|
|||||||
_sourceLocation(symbol->sourceLocation())
|
_sourceLocation(symbol->sourceLocation())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
Location::Location(StringLiteral *fileId, unsigned sourceLocation)
|
Location::Location(const StringLiteral *fileId, unsigned sourceLocation)
|
||||||
: _fileId(fileId), _sourceLocation(sourceLocation)
|
: _fileId(fileId), _sourceLocation(sourceLocation)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -79,11 +79,11 @@ NamespaceBinding::~NamespaceBinding()
|
|||||||
qDeleteAll(classBindings);
|
qDeleteAll(classBindings);
|
||||||
}
|
}
|
||||||
|
|
||||||
NameId *NamespaceBinding::name() const
|
const NameId *NamespaceBinding::name() const
|
||||||
{
|
{
|
||||||
if (symbols.size()) {
|
if (symbols.size()) {
|
||||||
if (Name *name = symbols.first()->name()) {
|
if (const Name *name = symbols.first()->name()) {
|
||||||
NameId *nameId = name->asNameId();
|
const NameId *nameId = name->asNameId();
|
||||||
Q_ASSERT(nameId != 0);
|
Q_ASSERT(nameId != 0);
|
||||||
|
|
||||||
return nameId;
|
return nameId;
|
||||||
@@ -93,9 +93,9 @@ NameId *NamespaceBinding::name() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Identifier *NamespaceBinding::identifier() const
|
const Identifier *NamespaceBinding::identifier() const
|
||||||
{
|
{
|
||||||
if (NameId *nameId = name())
|
if (const NameId *nameId = name())
|
||||||
return nameId->identifier();
|
return nameId->identifier();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -113,7 +113,7 @@ NamespaceBinding *NamespaceBinding::globalNamespaceBinding()
|
|||||||
return it;
|
return it;
|
||||||
}
|
}
|
||||||
|
|
||||||
Binding *NamespaceBinding::findClassOrNamespaceBinding(Identifier *id, QSet<Binding *> *processed)
|
Binding *NamespaceBinding::findClassOrNamespaceBinding(const Identifier *id, QSet<Binding *> *processed)
|
||||||
{
|
{
|
||||||
if (processed->contains(this))
|
if (processed->contains(this))
|
||||||
return 0;
|
return 0;
|
||||||
@@ -144,7 +144,7 @@ Binding *NamespaceBinding::findClassOrNamespaceBinding(Identifier *id, QSet<Bind
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassBinding *NamespaceBinding::findClassBinding(Name *name, QSet<Binding *> *processed)
|
ClassBinding *NamespaceBinding::findClassBinding(const Name *name, QSet<Binding *> *processed)
|
||||||
{
|
{
|
||||||
if (! name)
|
if (! name)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -156,7 +156,7 @@ ClassBinding *NamespaceBinding::findClassBinding(Name *name, QSet<Binding *> *pr
|
|||||||
Binding *current = this;
|
Binding *current = this;
|
||||||
|
|
||||||
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||||
Identifier *nameId = q->nameAt(i)->identifier();
|
const Identifier *nameId = q->nameAt(i)->identifier();
|
||||||
if (! nameId)
|
if (! nameId)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ ClassBinding *NamespaceBinding::findClassBinding(Name *name, QSet<Binding *> *pr
|
|||||||
|
|
||||||
processed->insert(this);
|
processed->insert(this);
|
||||||
|
|
||||||
Identifier *id = name->identifier();
|
const Identifier *id = name->identifier();
|
||||||
|
|
||||||
foreach (ClassBinding *classBinding, classBindings) {
|
foreach (ClassBinding *classBinding, classBindings) {
|
||||||
if (id->isEqualTo(classBinding->identifier()))
|
if (id->isEqualTo(classBinding->identifier()))
|
||||||
@@ -191,19 +191,19 @@ ClassBinding *NamespaceBinding::findClassBinding(Name *name, QSet<Binding *> *pr
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NamespaceBinding *NamespaceBinding::findNamespaceBinding(Name *name)
|
NamespaceBinding *NamespaceBinding::findNamespaceBinding(const Name *name)
|
||||||
{
|
{
|
||||||
if (! name)
|
if (! name)
|
||||||
return anonymousNamespaceBinding;
|
return anonymousNamespaceBinding;
|
||||||
|
|
||||||
else if (NameId *nameId = name->asNameId())
|
else if (const NameId *nameId = name->asNameId())
|
||||||
return findNamespaceBindingForNameId(nameId, /*lookAtParent = */ true);
|
return findNamespaceBindingForNameId(nameId, /*lookAtParent = */ true);
|
||||||
|
|
||||||
else if (const QualifiedNameId *q = name->asQualifiedNameId()) {
|
else if (const QualifiedNameId *q = name->asQualifiedNameId()) {
|
||||||
NamespaceBinding *current = this;
|
NamespaceBinding *current = this;
|
||||||
|
|
||||||
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||||
NameId *namespaceName = q->nameAt(i)->asNameId();
|
const NameId *namespaceName = q->nameAt(i)->asNameId();
|
||||||
if (! namespaceName)
|
if (! namespaceName)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -225,14 +225,14 @@ NamespaceBinding *NamespaceBinding::findNamespaceBinding(Name *name)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NamespaceBinding *NamespaceBinding::findNamespaceBindingForNameId(NameId *name,
|
NamespaceBinding *NamespaceBinding::findNamespaceBindingForNameId(const NameId *name,
|
||||||
bool lookAtParentNamespace)
|
bool lookAtParentNamespace)
|
||||||
{
|
{
|
||||||
QSet<NamespaceBinding *> processed;
|
QSet<NamespaceBinding *> processed;
|
||||||
return findNamespaceBindingForNameId_helper(name, lookAtParentNamespace, &processed);
|
return findNamespaceBindingForNameId_helper(name, lookAtParentNamespace, &processed);
|
||||||
}
|
}
|
||||||
|
|
||||||
NamespaceBinding *NamespaceBinding::findNamespaceBindingForNameId_helper(NameId *name,
|
NamespaceBinding *NamespaceBinding::findNamespaceBindingForNameId_helper(const NameId *name,
|
||||||
bool lookAtParentNamespace,
|
bool lookAtParentNamespace,
|
||||||
QSet<NamespaceBinding *> *processed)
|
QSet<NamespaceBinding *> *processed)
|
||||||
{
|
{
|
||||||
@@ -242,12 +242,12 @@ NamespaceBinding *NamespaceBinding::findNamespaceBindingForNameId_helper(NameId
|
|||||||
processed->insert(this);
|
processed->insert(this);
|
||||||
|
|
||||||
foreach (NamespaceBinding *binding, children) {
|
foreach (NamespaceBinding *binding, children) {
|
||||||
Name *bindingName = binding->name();
|
const Name *bindingName = binding->name();
|
||||||
|
|
||||||
if (! bindingName)
|
if (! bindingName)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (NameId *bindingNameId = bindingName->asNameId()) {
|
if (const NameId *bindingNameId = bindingName->asNameId()) {
|
||||||
if (name->isEqualTo(bindingNameId))
|
if (name->isEqualTo(bindingNameId))
|
||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
@@ -296,7 +296,7 @@ NamespaceBinding *NamespaceBinding::findOrCreateNamespaceBinding(Namespace *symb
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void closure(const Location &loc,
|
static void closure(const Location &loc,
|
||||||
NamespaceBinding *binding, Name *name,
|
NamespaceBinding *binding, const Name *name,
|
||||||
QList<NamespaceBinding *> *bindings)
|
QList<NamespaceBinding *> *bindings)
|
||||||
{
|
{
|
||||||
if (bindings->contains(binding))
|
if (bindings->contains(binding))
|
||||||
@@ -306,7 +306,7 @@ static void closure(const Location &loc,
|
|||||||
|
|
||||||
Q_ASSERT(name->isNameId());
|
Q_ASSERT(name->isNameId());
|
||||||
|
|
||||||
Identifier *id = name->asNameId()->identifier();
|
const Identifier *id = name->asNameId()->identifier();
|
||||||
bool ignoreUsingDirectives = false;
|
bool ignoreUsingDirectives = false;
|
||||||
|
|
||||||
foreach (Namespace *symbol, binding->symbols) {
|
foreach (Namespace *symbol, binding->symbols) {
|
||||||
@@ -334,13 +334,13 @@ static void closure(const Location &loc,
|
|||||||
|
|
||||||
|
|
||||||
NamespaceBinding *NamespaceBinding::resolveNamespace(const Location &loc,
|
NamespaceBinding *NamespaceBinding::resolveNamespace(const Location &loc,
|
||||||
Name *name,
|
const Name *name,
|
||||||
bool lookAtParent)
|
bool lookAtParent)
|
||||||
{
|
{
|
||||||
if (! name)
|
if (! name)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
else if (NameId *nameId = name->asNameId()) {
|
else if (const NameId *nameId = name->asNameId()) {
|
||||||
QList<NamespaceBinding *> bindings;
|
QList<NamespaceBinding *> bindings;
|
||||||
closure(loc, this, nameId, &bindings);
|
closure(loc, this, nameId, &bindings);
|
||||||
|
|
||||||
@@ -394,7 +394,7 @@ QByteArray NamespaceBinding::qualifiedId() const
|
|||||||
s.append(parent->qualifiedId());
|
s.append(parent->qualifiedId());
|
||||||
s.append("::");
|
s.append("::");
|
||||||
|
|
||||||
if (Identifier *id = identifier())
|
if (const Identifier *id = identifier())
|
||||||
s.append(id->chars(), id->size());
|
s.append(id->chars(), id->size());
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -409,7 +409,7 @@ QByteArray ClassBinding::qualifiedId() const
|
|||||||
QByteArray s = parent->qualifiedId();
|
QByteArray s = parent->qualifiedId();
|
||||||
s += "::";
|
s += "::";
|
||||||
|
|
||||||
if (Identifier *id = identifier())
|
if (const Identifier *id = identifier())
|
||||||
s.append(id->chars(), id->size());
|
s.append(id->chars(), id->size());
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -418,7 +418,7 @@ QByteArray ClassBinding::qualifiedId() const
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
Binding *ClassBinding::findClassOrNamespaceBinding(Identifier *id, QSet<Binding *> *processed)
|
Binding *ClassBinding::findClassOrNamespaceBinding(const Identifier *id, QSet<Binding *> *processed)
|
||||||
{
|
{
|
||||||
if (id->isEqualTo(identifier()))
|
if (id->isEqualTo(identifier()))
|
||||||
return this;
|
return this;
|
||||||
@@ -447,7 +447,7 @@ Binding *ClassBinding::findClassOrNamespaceBinding(Identifier *id, QSet<Binding
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassBinding *ClassBinding::findClassBinding(Name *name, QSet<Binding *> *processed)
|
ClassBinding *ClassBinding::findClassBinding(const Name *name, QSet<Binding *> *processed)
|
||||||
{
|
{
|
||||||
if (! name)
|
if (! name)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -461,7 +461,7 @@ ClassBinding *ClassBinding::findClassBinding(Name *name, QSet<Binding *> *proces
|
|||||||
Binding *currentBinding = this;
|
Binding *currentBinding = this;
|
||||||
|
|
||||||
for (unsigned i = 0; i < q->nameCount() - 1; ++i) {
|
for (unsigned i = 0; i < q->nameCount() - 1; ++i) {
|
||||||
Identifier *id = q->nameAt(i)->identifier();
|
const Identifier *id = q->nameAt(i)->identifier();
|
||||||
if (! id)
|
if (! id)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -479,12 +479,12 @@ ClassBinding *ClassBinding::findClassBinding(Name *name, QSet<Binding *> *proces
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Identifier *id = name->identifier()) {
|
if (const Identifier *id = name->identifier()) {
|
||||||
if (id->isEqualTo(identifier()))
|
if (id->isEqualTo(identifier()))
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
foreach (ClassBinding *nestedClassBinding, children) {
|
foreach (ClassBinding *nestedClassBinding, children) {
|
||||||
if (Identifier *nestedClassId = nestedClassBinding->identifier()) {
|
if (const Identifier *nestedClassId = nestedClassBinding->identifier()) {
|
||||||
if (nestedClassId->isEqualTo(id))
|
if (nestedClassId->isEqualTo(id))
|
||||||
return nestedClassBinding;
|
return nestedClassBinding;
|
||||||
}
|
}
|
||||||
@@ -549,7 +549,7 @@ ClassBinding::ClassBinding(ClassBinding *parentClass)
|
|||||||
ClassBinding::~ClassBinding()
|
ClassBinding::~ClassBinding()
|
||||||
{ qDeleteAll(children); }
|
{ qDeleteAll(children); }
|
||||||
|
|
||||||
Name *ClassBinding::name() const
|
const Name *ClassBinding::name() const
|
||||||
{
|
{
|
||||||
if (symbols.isEmpty())
|
if (symbols.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
@@ -557,9 +557,9 @@ Name *ClassBinding::name() const
|
|||||||
return symbols.first()->name();
|
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 n->identifier();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -623,12 +623,12 @@ protected:
|
|||||||
|
|
||||||
NamespaceBinding *bind(Symbol *symbol, NamespaceBinding *binding);
|
NamespaceBinding *bind(Symbol *symbol, NamespaceBinding *binding);
|
||||||
NamespaceBinding *findOrCreateNamespaceBinding(Namespace *symbol);
|
NamespaceBinding *findOrCreateNamespaceBinding(Namespace *symbol);
|
||||||
NamespaceBinding *resolveNamespace(const Location &loc, Name *name);
|
NamespaceBinding *resolveNamespace(const Location &loc, const Name *name);
|
||||||
|
|
||||||
NamespaceBinding *switchNamespaceBinding(NamespaceBinding *binding);
|
NamespaceBinding *switchNamespaceBinding(NamespaceBinding *binding);
|
||||||
|
|
||||||
ClassBinding *findOrCreateClassBinding(Class *classSymbol);
|
ClassBinding *findOrCreateClassBinding(Class *classSymbol);
|
||||||
ClassBinding *findClassBinding(Name *name);
|
ClassBinding *findClassBinding(const Name *name);
|
||||||
|
|
||||||
ClassBinding *switchClassBinding(ClassBinding *binding);
|
ClassBinding *switchClassBinding(ClassBinding *binding);
|
||||||
|
|
||||||
@@ -665,7 +665,7 @@ NamespaceBinding *Binder::bind(Symbol *symbol, NamespaceBinding *binding)
|
|||||||
NamespaceBinding *Binder::findOrCreateNamespaceBinding(Namespace *symbol)
|
NamespaceBinding *Binder::findOrCreateNamespaceBinding(Namespace *symbol)
|
||||||
{ return namespaceBinding->findOrCreateNamespaceBinding(symbol); }
|
{ return namespaceBinding->findOrCreateNamespaceBinding(symbol); }
|
||||||
|
|
||||||
NamespaceBinding *Binder::resolveNamespace(const Location &loc, Name *name)
|
NamespaceBinding *Binder::resolveNamespace(const Location &loc, const Name *name)
|
||||||
{
|
{
|
||||||
if (! namespaceBinding)
|
if (! namespaceBinding)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -694,7 +694,7 @@ ClassBinding *Binder::findOrCreateClassBinding(Class *classSymbol)
|
|||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClassBinding *Binder::findClassBinding(Name *name)
|
ClassBinding *Binder::findClassBinding(const Name *name)
|
||||||
{
|
{
|
||||||
QSet<Binding *> processed;
|
QSet<Binding *> processed;
|
||||||
|
|
||||||
|
@@ -53,7 +53,7 @@ class CPLUSPLUS_EXPORT Location
|
|||||||
public:
|
public:
|
||||||
Location();
|
Location();
|
||||||
Location(Symbol *symbol);
|
Location(Symbol *symbol);
|
||||||
Location(StringLiteral *fileId, unsigned sourceLocation);
|
Location(const StringLiteral *fileId, unsigned sourceLocation);
|
||||||
|
|
||||||
inline bool isValid() const
|
inline bool isValid() const
|
||||||
{ return _fileId != 0; }
|
{ return _fileId != 0; }
|
||||||
@@ -61,14 +61,14 @@ public:
|
|||||||
inline operator bool() const
|
inline operator bool() const
|
||||||
{ return _fileId != 0; }
|
{ return _fileId != 0; }
|
||||||
|
|
||||||
inline StringLiteral *fileId() const
|
inline const StringLiteral *fileId() const
|
||||||
{ return _fileId; }
|
{ return _fileId; }
|
||||||
|
|
||||||
inline unsigned sourceLocation() const
|
inline unsigned sourceLocation() const
|
||||||
{ return _sourceLocation; }
|
{ return _sourceLocation; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
StringLiteral *_fileId;
|
const StringLiteral *_fileId;
|
||||||
unsigned _sourceLocation;
|
unsigned _sourceLocation;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -84,8 +84,8 @@ public:
|
|||||||
virtual NamespaceBinding *asNamespaceBinding() { return 0; }
|
virtual NamespaceBinding *asNamespaceBinding() { return 0; }
|
||||||
virtual ClassBinding *asClassBinding() { return 0; }
|
virtual ClassBinding *asClassBinding() { return 0; }
|
||||||
|
|
||||||
virtual ClassBinding *findClassBinding(Name *name, QSet<Binding *> *processed) = 0;
|
virtual ClassBinding *findClassBinding(const Name *name, QSet<Binding *> *processed) = 0;
|
||||||
virtual Binding *findClassOrNamespaceBinding(Identifier *id, QSet<Binding *> *processed) = 0;
|
virtual Binding *findClassOrNamespaceBinding(const Identifier *id, QSet<Binding *> *processed) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CPLUSPLUS_EXPORT NamespaceBinding: public Binding
|
class CPLUSPLUS_EXPORT NamespaceBinding: public Binding
|
||||||
@@ -98,26 +98,26 @@ public:
|
|||||||
virtual ~NamespaceBinding();
|
virtual ~NamespaceBinding();
|
||||||
|
|
||||||
/// Returns this binding's name.
|
/// Returns this binding's name.
|
||||||
NameId *name() const;
|
const NameId *name() const;
|
||||||
|
|
||||||
/// Returns this binding's identifier.
|
/// Returns this binding's identifier.
|
||||||
Identifier *identifier() const;
|
const Identifier *identifier() const;
|
||||||
|
|
||||||
/// Returns the binding for the global namespace (aka ::).
|
/// Returns the binding for the global namespace (aka ::).
|
||||||
NamespaceBinding *globalNamespaceBinding();
|
NamespaceBinding *globalNamespaceBinding();
|
||||||
|
|
||||||
/// Returns the binding for the given namespace symbol.
|
/// 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.
|
/// Returns the binding associated with the given symbol.
|
||||||
NamespaceBinding *findOrCreateNamespaceBinding(Namespace *symbol);
|
NamespaceBinding *findOrCreateNamespaceBinding(Namespace *symbol);
|
||||||
|
|
||||||
NamespaceBinding *resolveNamespace(const Location &loc,
|
NamespaceBinding *resolveNamespace(const Location &loc,
|
||||||
Name *name,
|
const Name *name,
|
||||||
bool lookAtParent = true);
|
bool lookAtParent = true);
|
||||||
|
|
||||||
virtual ClassBinding *findClassBinding(Name *name, QSet<Binding *> *processed);
|
virtual ClassBinding *findClassBinding(const Name *name, QSet<Binding *> *processed);
|
||||||
virtual Binding *findClassOrNamespaceBinding(Identifier *id, QSet<Binding *> *processed);
|
virtual Binding *findClassOrNamespaceBinding(const Identifier *id, QSet<Binding *> *processed);
|
||||||
|
|
||||||
/// Helpers.
|
/// Helpers.
|
||||||
virtual QByteArray qualifiedId() const;
|
virtual QByteArray qualifiedId() const;
|
||||||
@@ -129,10 +129,10 @@ public:
|
|||||||
static ClassBinding *find(Class *symbol, NamespaceBinding *binding);
|
static ClassBinding *find(Class *symbol, NamespaceBinding *binding);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NamespaceBinding *findNamespaceBindingForNameId(NameId *name,
|
NamespaceBinding *findNamespaceBindingForNameId(const NameId *name,
|
||||||
bool lookAtParentNamespace);
|
bool lookAtParentNamespace);
|
||||||
|
|
||||||
NamespaceBinding *findNamespaceBindingForNameId_helper(NameId *name,
|
NamespaceBinding *findNamespaceBindingForNameId_helper(const NameId *name,
|
||||||
bool lookAtParentNamespace,
|
bool lookAtParentNamespace,
|
||||||
QSet<NamespaceBinding *> *processed);
|
QSet<NamespaceBinding *> *processed);
|
||||||
|
|
||||||
@@ -165,14 +165,14 @@ public:
|
|||||||
virtual ClassBinding *asClassBinding() { return this; }
|
virtual ClassBinding *asClassBinding() { return this; }
|
||||||
|
|
||||||
/// Returns this binding's name.
|
/// Returns this binding's name.
|
||||||
Name *name() const;
|
const Name *name() const;
|
||||||
|
|
||||||
/// Returns this binding's identifier.
|
/// Returns this binding's identifier.
|
||||||
Identifier *identifier() const;
|
const Identifier *identifier() const;
|
||||||
virtual QByteArray qualifiedId() const;
|
virtual QByteArray qualifiedId() const;
|
||||||
|
|
||||||
virtual ClassBinding *findClassBinding(Name *name, QSet<Binding *> *processed);
|
virtual ClassBinding *findClassBinding(const Name *name, QSet<Binding *> *processed);
|
||||||
virtual Binding *findClassOrNamespaceBinding(Identifier *id, QSet<Binding *> *processed);
|
virtual Binding *findClassOrNamespaceBinding(const Identifier *id, QSet<Binding *> *processed);
|
||||||
|
|
||||||
void dump();
|
void dump();
|
||||||
|
|
||||||
|
@@ -66,7 +66,7 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual void report(int level,
|
virtual void report(int level,
|
||||||
StringLiteral *fileId,
|
const StringLiteral *fileId,
|
||||||
unsigned line, unsigned column,
|
unsigned line, unsigned column,
|
||||||
const char *format, va_list ap)
|
const char *format, va_list ap)
|
||||||
{
|
{
|
||||||
@@ -118,8 +118,8 @@ Document::Document(const QString &fileName)
|
|||||||
_control->setDiagnosticClient(new DocumentDiagnosticClient(this, &_diagnosticMessages));
|
_control->setDiagnosticClient(new DocumentDiagnosticClient(this, &_diagnosticMessages));
|
||||||
|
|
||||||
const QByteArray localFileName = fileName.toUtf8();
|
const QByteArray localFileName = fileName.toUtf8();
|
||||||
StringLiteral *fileId = _control->findOrInsertStringLiteral(localFileName.constData(),
|
const StringLiteral *fileId = _control->findOrInsertStringLiteral(localFileName.constData(),
|
||||||
localFileName.size());
|
localFileName.size());
|
||||||
_translationUnit = new TranslationUnit(_control, fileId);
|
_translationUnit = new TranslationUnit(_control, fileId);
|
||||||
_translationUnit->setQtMocRunEnabled(true);
|
_translationUnit->setQtMocRunEnabled(true);
|
||||||
_translationUnit->setObjCEnabled(true);
|
_translationUnit->setObjCEnabled(true);
|
||||||
|
@@ -57,7 +57,7 @@ void FindUsages::setGlobalNamespaceBinding(NamespaceBindingPtr globalNamespaceBi
|
|||||||
_globalNamespaceBinding = globalNamespaceBinding;
|
_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();
|
_processed.clear();
|
||||||
_references.clear();
|
_references.clear();
|
||||||
@@ -344,7 +344,7 @@ bool FindUsages::visit(QualifiedNameAST *ast)
|
|||||||
|
|
||||||
bool FindUsages::visit(EnumeratorAST *ast)
|
bool FindUsages::visit(EnumeratorAST *ast)
|
||||||
{
|
{
|
||||||
Identifier *id = identifier(ast->identifier_token);
|
const Identifier *id = identifier(ast->identifier_token);
|
||||||
if (id == _id) {
|
if (id == _id) {
|
||||||
LookupContext context = currentContext(ast);
|
LookupContext context = currentContext(ast);
|
||||||
const QList<Symbol *> candidates = context.resolve(control()->nameId(id));
|
const QList<Symbol *> candidates = context.resolve(control()->nameId(id));
|
||||||
@@ -358,7 +358,7 @@ bool FindUsages::visit(EnumeratorAST *ast)
|
|||||||
|
|
||||||
bool FindUsages::visit(SimpleNameAST *ast)
|
bool FindUsages::visit(SimpleNameAST *ast)
|
||||||
{
|
{
|
||||||
Identifier *id = identifier(ast->identifier_token);
|
const Identifier *id = identifier(ast->identifier_token);
|
||||||
if (id == _id) {
|
if (id == _id) {
|
||||||
LookupContext context = currentContext(ast);
|
LookupContext context = currentContext(ast);
|
||||||
const QList<Symbol *> candidates = context.resolve(ast->name);
|
const QList<Symbol *> candidates = context.resolve(ast->name);
|
||||||
@@ -370,7 +370,7 @@ bool FindUsages::visit(SimpleNameAST *ast)
|
|||||||
|
|
||||||
bool FindUsages::visit(DestructorNameAST *ast)
|
bool FindUsages::visit(DestructorNameAST *ast)
|
||||||
{
|
{
|
||||||
Identifier *id = identifier(ast->identifier_token);
|
const Identifier *id = identifier(ast->identifier_token);
|
||||||
if (id == _id) {
|
if (id == _id) {
|
||||||
LookupContext context = currentContext(ast);
|
LookupContext context = currentContext(ast);
|
||||||
const QList<Symbol *> candidates = context.resolve(ast->name);
|
const QList<Symbol *> candidates = context.resolve(ast->name);
|
||||||
|
@@ -64,7 +64,7 @@ public:
|
|||||||
|
|
||||||
void setGlobalNamespaceBinding(NamespaceBindingPtr globalNamespaceBinding);
|
void setGlobalNamespaceBinding(NamespaceBindingPtr globalNamespaceBinding);
|
||||||
|
|
||||||
QList<int> operator()(Symbol *symbol, Identifier *id, AST *ast);
|
QList<int> operator()(Symbol *symbol, const Identifier *id, AST *ast);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
using ASTVisitor::visit;
|
using ASTVisitor::visit;
|
||||||
@@ -101,7 +101,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QFutureInterface<Usage> *_future;
|
QFutureInterface<Usage> *_future;
|
||||||
Identifier *_id;
|
const Identifier *_id;
|
||||||
Symbol *_declSymbol;
|
Symbol *_declSymbol;
|
||||||
Document::Ptr _doc;
|
Document::Ptr _doc;
|
||||||
Snapshot _snapshot;
|
Snapshot _snapshot;
|
||||||
|
@@ -52,10 +52,10 @@ public:
|
|||||||
|
|
||||||
Control *control() const { return context.control(); }
|
Control *control() const { return context.control(); }
|
||||||
|
|
||||||
FullySpecifiedType apply(Name *name);
|
FullySpecifiedType apply(const Name *name);
|
||||||
FullySpecifiedType apply(const FullySpecifiedType &type);
|
FullySpecifiedType apply(const FullySpecifiedType &type);
|
||||||
|
|
||||||
int findSubstitution(Identifier *id) const;
|
int findSubstitution(const Identifier *id) const;
|
||||||
FullySpecifiedType applySubstitution(int index) const;
|
FullySpecifiedType applySubstitution(int index) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -207,7 +207,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
ApplyToName(ApplySubstitution *q): q(q) {}
|
ApplyToName(ApplySubstitution *q): q(q) {}
|
||||||
|
|
||||||
FullySpecifiedType operator()(Name *name)
|
FullySpecifiedType operator()(const Name *name)
|
||||||
{
|
{
|
||||||
FullySpecifiedType previousType = switchType(FullySpecifiedType());
|
FullySpecifiedType previousType = switchType(FullySpecifiedType());
|
||||||
accept(name);
|
accept(name);
|
||||||
@@ -218,7 +218,7 @@ private:
|
|||||||
Control *control() const
|
Control *control() const
|
||||||
{ return q->control(); }
|
{ return q->control(); }
|
||||||
|
|
||||||
int findSubstitution(Identifier *id) const
|
int findSubstitution(const Identifier *id) const
|
||||||
{ return q->findSubstitution(id); }
|
{ return q->findSubstitution(id); }
|
||||||
|
|
||||||
FullySpecifiedType applySubstitution(int index) const
|
FullySpecifiedType applySubstitution(int index) const
|
||||||
@@ -231,7 +231,7 @@ private:
|
|||||||
return previousType;
|
return previousType;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(NameId *name)
|
virtual void visit(const NameId *name)
|
||||||
{
|
{
|
||||||
int index = findSubstitution(name->identifier());
|
int index = findSubstitution(name->identifier());
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ private:
|
|||||||
_type = control()->namedType(name);
|
_type = control()->namedType(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(TemplateNameId *name)
|
virtual void visit(const TemplateNameId *name)
|
||||||
{
|
{
|
||||||
QVarLengthArray<FullySpecifiedType, 8> arguments(name->templateArgumentCount());
|
QVarLengthArray<FullySpecifiedType, 8> arguments(name->templateArgumentCount());
|
||||||
for (unsigned i = 0; i < name->templateArgumentCount(); ++i) {
|
for (unsigned i = 0; i < name->templateArgumentCount(); ++i) {
|
||||||
@@ -250,17 +250,19 @@ private:
|
|||||||
arguments[i] = q->apply(argTy);
|
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);
|
_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) {
|
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());
|
QVarLengthArray<FullySpecifiedType, 8> arguments(templId->templateArgumentCount());
|
||||||
for (unsigned templateArgIndex = 0; templateArgIndex < templId->templateArgumentCount(); ++templateArgIndex) {
|
for (unsigned templateArgIndex = 0; templateArgIndex < templId->templateArgumentCount(); ++templateArgIndex) {
|
||||||
FullySpecifiedType argTy = templId->templateArgumentAt(templateArgIndex);
|
FullySpecifiedType argTy = templId->templateArgumentAt(templateArgIndex);
|
||||||
@@ -273,29 +275,29 @@ private:
|
|||||||
names[i] = n;
|
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);
|
_type = control()->namedType(q);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(DestructorNameId *name)
|
virtual void visit(const DestructorNameId *name)
|
||||||
{
|
{
|
||||||
Overview oo;
|
Overview oo;
|
||||||
qWarning() << "ignored name:" << oo(name);
|
qWarning() << "ignored name:" << oo(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(OperatorNameId *name)
|
virtual void visit(const OperatorNameId *name)
|
||||||
{
|
{
|
||||||
Overview oo;
|
Overview oo;
|
||||||
qWarning() << "ignored name:" << oo(name);
|
qWarning() << "ignored name:" << oo(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(ConversionNameId *name)
|
virtual void visit(const ConversionNameId *name)
|
||||||
{
|
{
|
||||||
Overview oo;
|
Overview oo;
|
||||||
qWarning() << "ignored name:" << oo(name);
|
qWarning() << "ignored name:" << oo(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(SelectorNameId *name)
|
virtual void visit(const SelectorNameId *name)
|
||||||
{
|
{
|
||||||
Overview oo;
|
Overview oo;
|
||||||
qWarning() << "ignored name:" << oo(name);
|
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);
|
FullySpecifiedType ty = applyToName(name);
|
||||||
return ty;
|
return ty;
|
||||||
@@ -337,12 +339,12 @@ FullySpecifiedType ApplySubstitution::apply(const FullySpecifiedType &type)
|
|||||||
return ty;
|
return ty;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ApplySubstitution::findSubstitution(Identifier *id) const
|
int ApplySubstitution::findSubstitution(const Identifier *id) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(id != 0);
|
Q_ASSERT(id != 0);
|
||||||
|
|
||||||
for (int index = 0; index < substitution.size(); ++index) {
|
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))
|
if (id->isEqualTo(s.first))
|
||||||
return index;
|
return index;
|
||||||
|
@@ -44,7 +44,7 @@ namespace CPlusPlus {
|
|||||||
class CPLUSPLUS_EXPORT GenTemplateInstance
|
class CPLUSPLUS_EXPORT GenTemplateInstance
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef QList< QPair<Identifier *, FullySpecifiedType> > Substitution;
|
typedef QList< QPair<const Identifier *, FullySpecifiedType> > Substitution;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GenTemplateInstance(const LookupContext &context, const Substitution &substitution);
|
GenTemplateInstance(const LookupContext &context, const Substitution &substitution);
|
||||||
|
@@ -109,14 +109,14 @@ bool LookupContext::maybeValidSymbol(Symbol *symbol,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Scope *> LookupContext::resolveNestedNameSpecifier(QualifiedNameId *q,
|
QList<Scope *> LookupContext::resolveNestedNameSpecifier(const QualifiedNameId *q,
|
||||||
const QList<Scope *> &visibleScopes) const
|
const QList<Scope *> &visibleScopes) const
|
||||||
{
|
{
|
||||||
QList<Symbol *> candidates;
|
QList<Symbol *> candidates;
|
||||||
QList<Scope *> scopes = visibleScopes;
|
QList<Scope *> scopes = visibleScopes;
|
||||||
|
|
||||||
for (unsigned i = 0; i < q->nameCount() - 1; ++i) {
|
for (unsigned i = 0; i < q->nameCount() - 1; ++i) {
|
||||||
Name *name = q->nameAt(i);
|
const Name *name = q->nameAt(i);
|
||||||
|
|
||||||
candidates = resolveClassOrNamespace(name, scopes);
|
candidates = resolveClassOrNamespace(name, scopes);
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ QList<Scope *> LookupContext::resolveNestedNameSpecifier(QualifiedNameId *q,
|
|||||||
return scopes;
|
return scopes;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Symbol *> LookupContext::resolveQualifiedNameId(QualifiedNameId *q,
|
QList<Symbol *> LookupContext::resolveQualifiedNameId(const QualifiedNameId *q,
|
||||||
const QList<Scope *> &visibleScopes,
|
const QList<Scope *> &visibleScopes,
|
||||||
ResolveMode mode) const
|
ResolveMode mode) const
|
||||||
{
|
{
|
||||||
@@ -153,7 +153,7 @@ QList<Symbol *> LookupContext::resolveQualifiedNameId(QualifiedNameId *q,
|
|||||||
else if (! symbol->isClass())
|
else if (! symbol->isClass())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
QualifiedNameId *qq = symbol->name()->asQualifiedNameId();
|
const QualifiedNameId *qq = symbol->name()->asQualifiedNameId();
|
||||||
|
|
||||||
if (! qq)
|
if (! qq)
|
||||||
continue;
|
continue;
|
||||||
@@ -167,8 +167,8 @@ QList<Symbol *> LookupContext::resolveQualifiedNameId(QualifiedNameId *q,
|
|||||||
unsigned j = 0;
|
unsigned j = 0;
|
||||||
|
|
||||||
for (; j < q->nameCount(); ++j) {
|
for (; j < q->nameCount(); ++j) {
|
||||||
Name *classOrNamespaceName1 = q->nameAt(j);
|
const Name *classOrNamespaceName1 = q->nameAt(j);
|
||||||
Name *classOrNamespaceName2 = qq->nameAt(j);
|
const Name *classOrNamespaceName2 = qq->nameAt(j);
|
||||||
|
|
||||||
if (! classOrNamespaceName1->isEqualTo(classOrNamespaceName2))
|
if (! classOrNamespaceName1->isEqualTo(classOrNamespaceName2))
|
||||||
break;
|
break;
|
||||||
@@ -205,7 +205,7 @@ QList<Symbol *> LookupContext::resolveQualifiedNameId(QualifiedNameId *q,
|
|||||||
return candidates;
|
return candidates;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Symbol *> LookupContext::resolveOperatorNameId(OperatorNameId *opId,
|
QList<Symbol *> LookupContext::resolveOperatorNameId(const OperatorNameId *opId,
|
||||||
const QList<Scope *> &visibleScopes,
|
const QList<Scope *> &visibleScopes,
|
||||||
ResolveMode) const
|
ResolveMode) const
|
||||||
{
|
{
|
||||||
@@ -226,7 +226,7 @@ QList<Symbol *> LookupContext::resolveOperatorNameId(OperatorNameId *opId,
|
|||||||
return candidates;
|
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
|
ResolveMode mode) const
|
||||||
{
|
{
|
||||||
QList<Symbol *> candidates;
|
QList<Symbol *> candidates;
|
||||||
@@ -234,13 +234,13 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
|
|||||||
if (!name)
|
if (!name)
|
||||||
return candidates; // nothing to do, the symbol is anonymous.
|
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);
|
return resolveQualifiedNameId(q, visibleScopes, mode);
|
||||||
|
|
||||||
else if (OperatorNameId *opId = name->asOperatorNameId())
|
else if (const OperatorNameId *opId = name->asOperatorNameId())
|
||||||
return resolveOperatorNameId(opId, visibleScopes, mode);
|
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) {
|
for (int scopeIndex = 0; scopeIndex < visibleScopes.size(); ++scopeIndex) {
|
||||||
Scope *scope = visibleScopes.at(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))
|
else if (! maybeValidSymbol(symbol, mode, candidates))
|
||||||
continue; // skip it, we're not looking for this kind of symbols
|
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))
|
if (! symbolId->isEqualTo(id))
|
||||||
continue; // skip it, the symbol's id is not compatible with this lookup.
|
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())
|
if (name->isDestructorNameId() != q->unqualifiedNameId()->isDestructorNameId())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
else if (q->nameCount() > 1) {
|
else if (q->nameCount() > 1) {
|
||||||
Name *classOrNamespaceName = control()->qualifiedNameId(q->names(),
|
const Name *classOrNamespaceName = control()->qualifiedNameId(q->names(),
|
||||||
q->nameCount() - 1);
|
q->nameCount() - 1);
|
||||||
|
|
||||||
if (Identifier *classOrNamespaceNameId = identifier(classOrNamespaceName)) {
|
if (const Identifier *classOrNamespaceNameId = identifier(classOrNamespaceName)) {
|
||||||
if (classOrNamespaceNameId->isEqualTo(id))
|
if (classOrNamespaceNameId->isEqualTo(id))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -299,7 +299,7 @@ QList<Symbol *> LookupContext::resolve(Name *name, const QList<Scope *> &visible
|
|||||||
return candidates;
|
return candidates;
|
||||||
}
|
}
|
||||||
|
|
||||||
Identifier *LookupContext::identifier(const Name *name) const
|
const Identifier *LookupContext::identifier(const Name *name) const
|
||||||
{
|
{
|
||||||
if (name)
|
if (name)
|
||||||
return name->identifier();
|
return name->identifier();
|
||||||
@@ -418,7 +418,7 @@ void LookupContext::expandNamespace(Namespace *ns,
|
|||||||
if (Scope *encl = ns->enclosingNamespaceScope())
|
if (Scope *encl = ns->enclosingNamespaceScope())
|
||||||
expand(encl, visibleScopes, expandedScopes);
|
expand(encl, visibleScopes, expandedScopes);
|
||||||
|
|
||||||
if (Name *nsName = ns->name()) {
|
if (const Name *nsName = ns->name()) {
|
||||||
const QList<Symbol *> namespaceList = resolveNamespace(nsName, visibleScopes);
|
const QList<Symbol *> namespaceList = resolveNamespace(nsName, visibleScopes);
|
||||||
foreach (Symbol *otherNs, namespaceList) {
|
foreach (Symbol *otherNs, namespaceList) {
|
||||||
if (otherNs == ns)
|
if (otherNs == ns)
|
||||||
@@ -478,7 +478,7 @@ void LookupContext::expandClass(Class *klass,
|
|||||||
|
|
||||||
for (unsigned i = 0; i < klass->baseClassCount(); ++i) {
|
for (unsigned i = 0; i < klass->baseClassCount(); ++i) {
|
||||||
BaseClass *baseClass = klass->baseClassAt(i);
|
BaseClass *baseClass = klass->baseClassAt(i);
|
||||||
Name *baseClassName = baseClass->name();
|
const Name *baseClassName = baseClass->name();
|
||||||
const QList<Symbol *> baseClassCandidates = resolveClass(baseClassName,
|
const QList<Symbol *> baseClassCandidates = resolveClass(baseClassName,
|
||||||
classVisibleScopes);
|
classVisibleScopes);
|
||||||
|
|
||||||
@@ -515,8 +515,8 @@ void LookupContext::expandFunction(Function *function,
|
|||||||
if (! expandedScopes->contains(function->arguments()))
|
if (! expandedScopes->contains(function->arguments()))
|
||||||
expandedScopes->append(function->arguments());
|
expandedScopes->append(function->arguments());
|
||||||
|
|
||||||
if (QualifiedNameId *q = function->name()->asQualifiedNameId()) {
|
if (const QualifiedNameId *q = function->name()->asQualifiedNameId()) {
|
||||||
Name *nestedNameSpec = 0;
|
const Name *nestedNameSpec = 0;
|
||||||
if (q->nameCount() == 1)
|
if (q->nameCount() == 1)
|
||||||
nestedNameSpec = q->nameAt(0);
|
nestedNameSpec = q->nameAt(0);
|
||||||
else
|
else
|
||||||
@@ -565,7 +565,7 @@ void LookupContext::expandObjCClass(ObjCClass *klass,
|
|||||||
|
|
||||||
// expand the base class:
|
// expand the base class:
|
||||||
if (ObjCBaseClass *baseClass = klass->baseClass()) {
|
if (ObjCBaseClass *baseClass = klass->baseClass()) {
|
||||||
Name *baseClassName = baseClass->name();
|
const Name *baseClassName = baseClass->name();
|
||||||
const QList<Symbol *> baseClassCandidates = resolveObjCClass(baseClassName,
|
const QList<Symbol *> baseClassCandidates = resolveObjCClass(baseClassName,
|
||||||
visibleScopes);
|
visibleScopes);
|
||||||
|
|
||||||
@@ -577,7 +577,7 @@ void LookupContext::expandObjCClass(ObjCClass *klass,
|
|||||||
|
|
||||||
// expand the protocols:
|
// expand the protocols:
|
||||||
for (unsigned i = 0; i < klass->protocolCount(); ++i) {
|
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);
|
const QList<Symbol *> protocolCandidates = resolveObjCProtocol(protocolName, visibleScopes);
|
||||||
for (int j = 0; j < protocolCandidates.size(); ++j) {
|
for (int j = 0; j < protocolCandidates.size(); ++j) {
|
||||||
if (ObjCProtocol *protocolSymbol = protocolCandidates.at(j)->asObjCProtocol())
|
if (ObjCProtocol *protocolSymbol = protocolCandidates.at(j)->asObjCProtocol())
|
||||||
@@ -667,7 +667,7 @@ Symbol *LookupContext::canonicalSymbol(Symbol *symbol,
|
|||||||
if (! canonicalSymbol)
|
if (! canonicalSymbol)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (Identifier *symbolId = canonicalSymbol->identifier()) {
|
if (const Identifier *symbolId = canonicalSymbol->identifier()) {
|
||||||
if (symbolId && canonicalSymbol->type()->isFunctionType()) {
|
if (symbolId && canonicalSymbol->type()->isFunctionType()) {
|
||||||
Class *enclosingClass = canonicalSymbol->scope()->owner()->asClass();
|
Class *enclosingClass = canonicalSymbol->scope()->owner()->asClass();
|
||||||
const QList<ClassBinding *> classBindings = visibleClassBindings(enclosingClass, globalNamespace);
|
const QList<ClassBinding *> classBindings = visibleClassBindings(enclosingClass, globalNamespace);
|
||||||
|
@@ -94,22 +94,22 @@ public:
|
|||||||
static Symbol *canonicalSymbol(const QList<LookupItem> &candidates,
|
static Symbol *canonicalSymbol(const QList<LookupItem> &candidates,
|
||||||
NamespaceBinding *globalNamespaceBinding);
|
NamespaceBinding *globalNamespaceBinding);
|
||||||
|
|
||||||
QList<Symbol *> resolve(Name *name) const
|
QList<Symbol *> resolve(const Name *name) const
|
||||||
{ return resolve(name, visibleScopes()); }
|
{ return resolve(name, visibleScopes()); }
|
||||||
|
|
||||||
QList<Symbol *> resolveNamespace(Name *name) const
|
QList<Symbol *> resolveNamespace(const Name *name) const
|
||||||
{ return resolveNamespace(name, visibleScopes()); }
|
{ return resolveNamespace(name, visibleScopes()); }
|
||||||
|
|
||||||
QList<Symbol *> resolveClass(Name *name) const
|
QList<Symbol *> resolveClass(const Name *name) const
|
||||||
{ return resolveClass(name, visibleScopes()); }
|
{ return resolveClass(name, visibleScopes()); }
|
||||||
|
|
||||||
QList<Symbol *> resolveClassOrNamespace(Name *name) const
|
QList<Symbol *> resolveClassOrNamespace(const Name *name) const
|
||||||
{ return resolveClassOrNamespace(name, visibleScopes()); }
|
{ return resolveClassOrNamespace(name, visibleScopes()); }
|
||||||
|
|
||||||
QList<Symbol *> resolveObjCClass(Name *name) const
|
QList<Symbol *> resolveObjCClass(const Name *name) const
|
||||||
{ return resolveObjCClass(name, visibleScopes()); }
|
{ return resolveObjCClass(name, visibleScopes()); }
|
||||||
|
|
||||||
QList<Symbol *> resolveObjCProtocol(Name *name) const
|
QList<Symbol *> resolveObjCProtocol(const Name *name) const
|
||||||
{ return resolveObjCProtocol(name, visibleScopes()); }
|
{ return resolveObjCProtocol(name, visibleScopes()); }
|
||||||
|
|
||||||
enum ResolveMode {
|
enum ResolveMode {
|
||||||
@@ -122,22 +122,22 @@ public:
|
|||||||
ResolveAll = ResolveSymbol | ResolveClassOrNamespace | ResolveObjCClass | ResolveObjCProtocol
|
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;
|
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); }
|
{ 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); }
|
{ 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); }
|
{ 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); }
|
{ 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); }
|
{ return resolve(name, visibleScopes, ResolveObjCProtocol); }
|
||||||
|
|
||||||
QList<Scope *> visibleScopes() const
|
QList<Scope *> visibleScopes() const
|
||||||
@@ -187,18 +187,18 @@ public:
|
|||||||
private:
|
private:
|
||||||
static Symbol *canonicalSymbol(Symbol *symbol);
|
static Symbol *canonicalSymbol(Symbol *symbol);
|
||||||
|
|
||||||
QList<Symbol *> resolveQualifiedNameId(QualifiedNameId *q,
|
QList<Symbol *> resolveQualifiedNameId(const QualifiedNameId *q,
|
||||||
const QList<Scope *> &visibleScopes,
|
const QList<Scope *> &visibleScopes,
|
||||||
ResolveMode mode) const;
|
ResolveMode mode) const;
|
||||||
|
|
||||||
QList<Symbol *> resolveOperatorNameId(OperatorNameId *opId,
|
QList<Symbol *> resolveOperatorNameId(const OperatorNameId *opId,
|
||||||
const QList<Scope *> &visibleScopes,
|
const QList<Scope *> &visibleScopes,
|
||||||
ResolveMode mode) const;
|
ResolveMode mode) const;
|
||||||
|
|
||||||
QList<Scope *> resolveNestedNameSpecifier(QualifiedNameId *q,
|
QList<Scope *> resolveNestedNameSpecifier(const QualifiedNameId *q,
|
||||||
const QList<Scope *> &visibleScopes) const;
|
const QList<Scope *> &visibleScopes) const;
|
||||||
|
|
||||||
Identifier *identifier(const Name *name) const;
|
const Identifier *identifier(const Name *name) const;
|
||||||
|
|
||||||
QList<Scope *> buildVisibleScopes();
|
QList<Scope *> buildVisibleScopes();
|
||||||
|
|
||||||
|
@@ -48,7 +48,7 @@ const Overview *NamePrettyPrinter::overview() const
|
|||||||
return _overview;
|
return _overview;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString NamePrettyPrinter::operator()(Name *name)
|
QString NamePrettyPrinter::operator()(const Name *name)
|
||||||
{
|
{
|
||||||
QString previousName = switchName();
|
QString previousName = switchName();
|
||||||
accept(name);
|
accept(name);
|
||||||
@@ -62,18 +62,18 @@ QString NamePrettyPrinter::switchName(const QString &name)
|
|||||||
return previousName;
|
return previousName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NamePrettyPrinter::visit(NameId *name)
|
void NamePrettyPrinter::visit(const NameId *name)
|
||||||
{
|
{
|
||||||
Identifier *id = name->identifier();
|
const Identifier *id = name->identifier();
|
||||||
if (id)
|
if (id)
|
||||||
_name = QString::fromLatin1(id->chars(), id->size());
|
_name = QString::fromLatin1(id->chars(), id->size());
|
||||||
else
|
else
|
||||||
_name = QLatin1String("anonymous");
|
_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)
|
if (id)
|
||||||
_name = QString::fromLatin1(id->chars(), id->size());
|
_name = QString::fromLatin1(id->chars(), id->size());
|
||||||
else
|
else
|
||||||
@@ -93,14 +93,14 @@ void NamePrettyPrinter::visit(TemplateNameId *name)
|
|||||||
_name += QLatin1Char('>');
|
_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 += QLatin1Char('~');
|
||||||
_name += QString::fromLatin1(id->chars(), id->size());
|
_name += QString::fromLatin1(id->chars(), id->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NamePrettyPrinter::visit(OperatorNameId *name)
|
void NamePrettyPrinter::visit(const OperatorNameId *name)
|
||||||
{
|
{
|
||||||
_name += QLatin1String("operator ");
|
_name += QLatin1String("operator ");
|
||||||
switch (name->kind()) { // ### i should probably do this in OperatorNameId
|
switch (name->kind()) { // ### i should probably do this in OperatorNameId
|
||||||
@@ -236,13 +236,13 @@ void NamePrettyPrinter::visit(OperatorNameId *name)
|
|||||||
} // switch
|
} // switch
|
||||||
}
|
}
|
||||||
|
|
||||||
void NamePrettyPrinter::visit(ConversionNameId *name)
|
void NamePrettyPrinter::visit(const ConversionNameId *name)
|
||||||
{
|
{
|
||||||
_name += QLatin1String("operator ");
|
_name += QLatin1String("operator ");
|
||||||
_name += overview()->prettyType(name->type());
|
_name += overview()->prettyType(name->type());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NamePrettyPrinter::visit(QualifiedNameId *name)
|
void NamePrettyPrinter::visit(const QualifiedNameId *name)
|
||||||
{
|
{
|
||||||
if (name->isGlobal())
|
if (name->isGlobal())
|
||||||
_name += QLatin1String("::");
|
_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) {
|
for (unsigned i = 0; i < name->nameCount(); ++i) {
|
||||||
Name *n = name->nameAt(i);
|
const Name *n = name->nameAt(i);
|
||||||
if (!n)
|
if (!n)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Identifier *id = n->identifier();
|
if (const Identifier *id = n->identifier()) {
|
||||||
if (id) {
|
|
||||||
_name += QString::fromLatin1(id->chars(), id->size());
|
_name += QString::fromLatin1(id->chars(), id->size());
|
||||||
|
|
||||||
if (name->hasArguments() || name->nameCount() > 1)
|
if (name->hasArguments() || name->nameCount() > 1)
|
||||||
|
@@ -44,18 +44,18 @@ public:
|
|||||||
virtual ~NamePrettyPrinter();
|
virtual ~NamePrettyPrinter();
|
||||||
|
|
||||||
const Overview *overview() const;
|
const Overview *overview() const;
|
||||||
QString operator()(Name *name);
|
QString operator()(const Name *name);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString switchName(const QString &name = QString());
|
QString switchName(const QString &name = QString());
|
||||||
|
|
||||||
virtual void visit(NameId *name);
|
virtual void visit(const NameId *name);
|
||||||
virtual void visit(TemplateNameId *name);
|
virtual void visit(const TemplateNameId *name);
|
||||||
virtual void visit(DestructorNameId *name);
|
virtual void visit(const DestructorNameId *name);
|
||||||
virtual void visit(OperatorNameId *name);
|
virtual void visit(const OperatorNameId *name);
|
||||||
virtual void visit(ConversionNameId *name);
|
virtual void visit(const ConversionNameId *name);
|
||||||
virtual void visit(QualifiedNameId *name);
|
virtual void visit(const QualifiedNameId *name);
|
||||||
virtual void visit(SelectorNameId *name);
|
virtual void visit(const SelectorNameId *name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const Overview *_overview;
|
const Overview *_overview;
|
||||||
|
@@ -117,13 +117,13 @@ void Overview::setShowFullyQualifiedNamed(bool showFullyQualifiedNames)
|
|||||||
_showFullyQualifiedNames = showFullyQualifiedNames;
|
_showFullyQualifiedNames = showFullyQualifiedNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Overview::prettyName(Name *name) const
|
QString Overview::prettyName(const Name *name) const
|
||||||
{
|
{
|
||||||
NamePrettyPrinter pp(this);
|
NamePrettyPrinter pp(this);
|
||||||
return pp(name);
|
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));
|
return prettyType(ty, prettyName(name));
|
||||||
}
|
}
|
||||||
|
@@ -66,14 +66,14 @@ public:
|
|||||||
int markedArgumentEnd() const;
|
int markedArgumentEnd() const;
|
||||||
void setMarkedArgumentEnd(int end);
|
void setMarkedArgumentEnd(int end);
|
||||||
|
|
||||||
QString operator()(Name *name) const
|
QString operator()(const Name *name) const
|
||||||
{ return prettyName(name); }
|
{ 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); }
|
{ return prettyType(type, name); }
|
||||||
|
|
||||||
QString prettyName(Name *name) const;
|
QString prettyName(const Name *name) const;
|
||||||
QString prettyType(const FullySpecifiedType &type, Name *name = 0) const;
|
QString prettyType(const FullySpecifiedType &type, const Name *name = 0) const;
|
||||||
QString prettyType(const FullySpecifiedType &type, const QString &name) const;
|
QString prettyType(const FullySpecifiedType &type, const QString &name) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -181,11 +181,11 @@ bool ResolveExpression::visit(NewExpressionAST *ast)
|
|||||||
|
|
||||||
bool ResolveExpression::visit(TypeidExpressionAST *)
|
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[0] = control()->nameId(control()->findOrInsertIdentifier("std"));
|
||||||
std_type_info[1] = control()->nameId(control()->findOrInsertIdentifier("type_info"));
|
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));
|
FullySpecifiedType ty(control()->namedType(q));
|
||||||
addResult(ty);
|
addResult(ty);
|
||||||
|
|
||||||
@@ -226,7 +226,7 @@ bool ResolveExpression::visit(SizeofExpressionAST *)
|
|||||||
bool ResolveExpression::visit(NumericLiteralAST *ast)
|
bool ResolveExpression::visit(NumericLiteralAST *ast)
|
||||||
{
|
{
|
||||||
Type *type = 0;
|
Type *type = 0;
|
||||||
NumericLiteral *literal = numericLiteral(ast->literal_token);
|
const NumericLiteral *literal = numericLiteral(ast->literal_token);
|
||||||
|
|
||||||
if (literal->isChar())
|
if (literal->isChar())
|
||||||
type = control()->integerType(IntegerType::Char);
|
type = control()->integerType(IntegerType::Char);
|
||||||
@@ -277,8 +277,8 @@ bool ResolveExpression::visit(ThisExpressionAST *)
|
|||||||
FullySpecifiedType ptrTy(control()->pointerType(classTy));
|
FullySpecifiedType ptrTy(control()->pointerType(classTy));
|
||||||
addResult(ptrTy, fun);
|
addResult(ptrTy, fun);
|
||||||
break;
|
break;
|
||||||
} else if (QualifiedNameId *q = fun->name()->asQualifiedNameId()) {
|
} else if (const QualifiedNameId *q = fun->name()->asQualifiedNameId()) {
|
||||||
Name *nestedNameSpecifier = 0;
|
const Name *nestedNameSpecifier = 0;
|
||||||
if (q->nameCount() == 1 && q->isGlobal())
|
if (q->nameCount() == 1 && q->isGlobal())
|
||||||
nestedNameSpecifier = q->nameAt(0);
|
nestedNameSpecifier = q->nameAt(0);
|
||||||
else
|
else
|
||||||
@@ -355,7 +355,7 @@ bool ResolveExpression::visit(CompoundLiteralAST *ast)
|
|||||||
bool ResolveExpression::visit(QualifiedNameAST *ast)
|
bool ResolveExpression::visit(QualifiedNameAST *ast)
|
||||||
{
|
{
|
||||||
ResolveClass resolveClass;
|
ResolveClass resolveClass;
|
||||||
Name *name = ast->name;
|
const Name *name = ast->name;
|
||||||
|
|
||||||
QList<Symbol *> symbols = _context.resolve(name);
|
QList<Symbol *> symbols = _context.resolve(name);
|
||||||
foreach (Symbol *symbol, symbols) {
|
foreach (Symbol *symbol, symbols) {
|
||||||
@@ -451,7 +451,7 @@ bool ResolveExpression::visit(CallAST *ast)
|
|||||||
++actualArgumentCount;
|
++actualArgumentCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
Name *functionCallOp = control()->operatorNameId(OperatorNameId::FunctionCallOp);
|
const Name *functionCallOp = control()->operatorNameId(OperatorNameId::FunctionCallOp);
|
||||||
|
|
||||||
foreach (const LookupItem &result, baseResults) {
|
foreach (const LookupItem &result, baseResults) {
|
||||||
FullySpecifiedType ty = result.type().simplified();
|
FullySpecifiedType ty = result.type().simplified();
|
||||||
@@ -495,7 +495,7 @@ bool ResolveExpression::visit(ArrayAccessAST *ast)
|
|||||||
const QList<LookupItem> indexResults = operator()(ast->expression);
|
const QList<LookupItem> indexResults = operator()(ast->expression);
|
||||||
ResolveClass resolveClass;
|
ResolveClass resolveClass;
|
||||||
|
|
||||||
Name *arrayAccessOp = control()->operatorNameId(OperatorNameId::ArrayAccessOp);
|
const Name *arrayAccessOp = control()->operatorNameId(OperatorNameId::ArrayAccessOp);
|
||||||
|
|
||||||
foreach (const LookupItem &result, baseResults) {
|
foreach (const LookupItem &result, baseResults) {
|
||||||
FullySpecifiedType ty = result.type().simplified();
|
FullySpecifiedType ty = result.type().simplified();
|
||||||
@@ -537,7 +537,7 @@ bool ResolveExpression::visit(MemberAccessAST *ast)
|
|||||||
QList<LookupItem> baseResults = _results;
|
QList<LookupItem> baseResults = _results;
|
||||||
|
|
||||||
// Evaluate the expression-id that follows the access operator.
|
// Evaluate the expression-id that follows the access operator.
|
||||||
Name *memberName = 0;
|
const Name *memberName = 0;
|
||||||
if (ast->member_name)
|
if (ast->member_name)
|
||||||
memberName = ast->member_name->name;
|
memberName = ast->member_name->name;
|
||||||
|
|
||||||
@@ -594,7 +594,7 @@ ResolveExpression::resolveBaseExpression(const QList<LookupItem> &baseResults, i
|
|||||||
|
|
||||||
if (NamedType *namedTy = ty->asNamedType()) {
|
if (NamedType *namedTy = ty->asNamedType()) {
|
||||||
ResolveClass resolveClass;
|
ResolveClass resolveClass;
|
||||||
Name *arrowAccessOp = control()->operatorNameId(OperatorNameId::ArrowOp);
|
const Name *arrowAccessOp = control()->operatorNameId(OperatorNameId::ArrowOp);
|
||||||
const QList<Symbol *> candidates = resolveClass(namedTy->name(), result, _context);
|
const QList<Symbol *> candidates = resolveClass(namedTy->name(), result, _context);
|
||||||
|
|
||||||
foreach (Symbol *classObject, candidates) {
|
foreach (Symbol *classObject, candidates) {
|
||||||
@@ -663,7 +663,7 @@ ResolveExpression::resolveBaseExpression(const QList<LookupItem> &baseResults, i
|
|||||||
QList<LookupItem>
|
QList<LookupItem>
|
||||||
ResolveExpression::resolveMemberExpression(const QList<LookupItem> &baseResults,
|
ResolveExpression::resolveMemberExpression(const QList<LookupItem> &baseResults,
|
||||||
unsigned accessOp,
|
unsigned accessOp,
|
||||||
Name *memberName,
|
const Name *memberName,
|
||||||
bool *replacedDotOperator) const
|
bool *replacedDotOperator) const
|
||||||
{
|
{
|
||||||
ResolveClass resolveClass;
|
ResolveClass resolveClass;
|
||||||
@@ -677,7 +677,7 @@ ResolveExpression::resolveMemberExpression(const QList<LookupItem> &baseResults,
|
|||||||
results += resolveMember(memberName, klass);
|
results += resolveMember(memberName, klass);
|
||||||
|
|
||||||
else if (NamedType *namedTy = ty->asNamedType()) {
|
else if (NamedType *namedTy = ty->asNamedType()) {
|
||||||
Name *className = namedTy->name();
|
const Name *className = namedTy->name();
|
||||||
const QList<Symbol *> classes = resolveClass(className, r, _context);
|
const QList<Symbol *> classes = resolveClass(className, r, _context);
|
||||||
|
|
||||||
foreach (Symbol *c, classes) {
|
foreach (Symbol *c, classes) {
|
||||||
@@ -691,8 +691,8 @@ ResolveExpression::resolveMemberExpression(const QList<LookupItem> &baseResults,
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<LookupItem>
|
QList<LookupItem>
|
||||||
ResolveExpression::resolveMember(Name *memberName, Class *klass,
|
ResolveExpression::resolveMember(const Name *memberName, Class *klass,
|
||||||
Name *className) const
|
const Name *className) const
|
||||||
{
|
{
|
||||||
QList<LookupItem> results;
|
QList<LookupItem> results;
|
||||||
|
|
||||||
@@ -709,21 +709,21 @@ ResolveExpression::resolveMember(Name *memberName, Class *klass,
|
|||||||
|
|
||||||
foreach (Symbol *candidate, candidates) {
|
foreach (Symbol *candidate, candidates) {
|
||||||
FullySpecifiedType ty = candidate->type();
|
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();
|
unqualifiedNameId = q->unqualifiedNameId();
|
||||||
|
|
||||||
if (TemplateNameId *templId = unqualifiedNameId->asTemplateNameId()) {
|
if (const TemplateNameId *templId = unqualifiedNameId->asTemplateNameId()) {
|
||||||
GenTemplateInstance::Substitution subst;
|
GenTemplateInstance::Substitution subst;
|
||||||
|
|
||||||
for (unsigned i = 0; i < templId->templateArgumentCount(); ++i) {
|
for (unsigned i = 0; i < templId->templateArgumentCount(); ++i) {
|
||||||
FullySpecifiedType templArgTy = templId->templateArgumentAt(i);
|
FullySpecifiedType templArgTy = templId->templateArgumentAt(i);
|
||||||
|
|
||||||
if (i < klass->templateParameterCount()) {
|
if (i < klass->templateParameterCount()) {
|
||||||
Name *templArgName = klass->templateParameterAt(i)->name();
|
const Name *templArgName = klass->templateParameterAt(i)->name();
|
||||||
if (templArgName && templArgName->identifier()) {
|
if (templArgName && templArgName->identifier()) {
|
||||||
Identifier *templArgId = templArgName->identifier();
|
const Identifier *templArgId = templArgName->identifier();
|
||||||
subst.append(qMakePair(templArgId, templArgTy));
|
subst.append(qMakePair(templArgId, templArgTy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -741,7 +741,7 @@ ResolveExpression::resolveMember(Name *memberName, Class *klass,
|
|||||||
|
|
||||||
|
|
||||||
QList<LookupItem>
|
QList<LookupItem>
|
||||||
ResolveExpression::resolveMember(Name *memberName, ObjCClass *klass) const
|
ResolveExpression::resolveMember(const Name *memberName, ObjCClass *klass) const
|
||||||
{
|
{
|
||||||
QList<LookupItem> results;
|
QList<LookupItem> results;
|
||||||
|
|
||||||
@@ -774,7 +774,7 @@ bool ResolveExpression::visit(ObjCMessageExpressionAST *ast)
|
|||||||
if (!receiverResults.isEmpty()) {
|
if (!receiverResults.isEmpty()) {
|
||||||
LookupItem result = receiverResults.first();
|
LookupItem result = receiverResults.first();
|
||||||
FullySpecifiedType ty = result.type().simplified();
|
FullySpecifiedType ty = result.type().simplified();
|
||||||
Name *klassName = 0;
|
const Name *klassName = 0;
|
||||||
|
|
||||||
if (const ObjCClass *classTy = ty->asObjCClassType()) {
|
if (const ObjCClass *classTy = ty->asObjCClassType()) {
|
||||||
// static access, e.g.:
|
// static access, e.g.:
|
||||||
@@ -805,7 +805,7 @@ bool ResolveExpression::visit(ObjCMessageExpressionAST *ast)
|
|||||||
ResolveClass::ResolveClass()
|
ResolveClass::ResolveClass()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
QList<Symbol *> ResolveClass::operator()(Name *name,
|
QList<Symbol *> ResolveClass::operator()(const Name *name,
|
||||||
const LookupItem &p,
|
const LookupItem &p,
|
||||||
const LookupContext &context)
|
const LookupContext &context)
|
||||||
{
|
{
|
||||||
@@ -815,7 +815,7 @@ QList<Symbol *> ResolveClass::operator()(Name *name,
|
|||||||
return symbols;
|
return symbols;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Symbol *> ResolveClass::resolveClass(Name *name,
|
QList<Symbol *> ResolveClass::resolveClass(const Name *name,
|
||||||
const LookupItem &p,
|
const LookupItem &p,
|
||||||
const LookupContext &context)
|
const LookupContext &context)
|
||||||
{
|
{
|
||||||
@@ -873,7 +873,7 @@ QList<Symbol *> ResolveClass::resolveClass(Name *name,
|
|||||||
ResolveObjCClass::ResolveObjCClass()
|
ResolveObjCClass::ResolveObjCClass()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
QList<Symbol *> ResolveObjCClass::operator ()(Name *name,
|
QList<Symbol *> ResolveObjCClass::operator ()(const Name *name,
|
||||||
const LookupItem &p,
|
const LookupItem &p,
|
||||||
const LookupContext &context)
|
const LookupContext &context)
|
||||||
{
|
{
|
||||||
|
@@ -48,17 +48,17 @@ public:
|
|||||||
|
|
||||||
QList<LookupItem> resolveMemberExpression(const QList<LookupItem> &baseResults,
|
QList<LookupItem> resolveMemberExpression(const QList<LookupItem> &baseResults,
|
||||||
unsigned accessOp,
|
unsigned accessOp,
|
||||||
Name *memberName,
|
const Name *memberName,
|
||||||
bool *replacedDotOperator = 0) const;
|
bool *replacedDotOperator = 0) const;
|
||||||
|
|
||||||
QList<LookupItem> resolveBaseExpression(const QList<LookupItem> &baseResults,
|
QList<LookupItem> resolveBaseExpression(const QList<LookupItem> &baseResults,
|
||||||
int accessOp,
|
int accessOp,
|
||||||
bool *replacedDotOperator = 0) const;
|
bool *replacedDotOperator = 0) const;
|
||||||
|
|
||||||
QList<LookupItem> resolveMember(Name *memberName, Class *klass,
|
QList<LookupItem> resolveMember(const Name *memberName, Class *klass,
|
||||||
Name *className = 0) const;
|
const Name *className = 0) const;
|
||||||
|
|
||||||
QList<LookupItem> resolveMember(Name *memberName, ObjCClass *klass) const;
|
QList<LookupItem> resolveMember(const Name *memberName, ObjCClass *klass) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QList<LookupItem> switchResults(const QList<LookupItem> &symbols);
|
QList<LookupItem> switchResults(const QList<LookupItem> &symbols);
|
||||||
@@ -125,12 +125,12 @@ class CPLUSPLUS_EXPORT ResolveClass
|
|||||||
public:
|
public:
|
||||||
ResolveClass();
|
ResolveClass();
|
||||||
|
|
||||||
QList<Symbol *> operator()(Name *name,
|
QList<Symbol *> operator()(const Name *name,
|
||||||
const LookupItem &p,
|
const LookupItem &p,
|
||||||
const LookupContext &context);
|
const LookupContext &context);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<Symbol *> resolveClass(Name *name,
|
QList<Symbol *> resolveClass(const Name *name,
|
||||||
const LookupItem &p,
|
const LookupItem &p,
|
||||||
const LookupContext &context);
|
const LookupContext &context);
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ class CPLUSPLUS_EXPORT ResolveObjCClass
|
|||||||
public:
|
public:
|
||||||
ResolveObjCClass();
|
ResolveObjCClass();
|
||||||
|
|
||||||
QList<Symbol *> operator()(Name *name,
|
QList<Symbol *> operator()(const Name *name,
|
||||||
const LookupItem &p,
|
const LookupItem &p,
|
||||||
const LookupContext &context);
|
const LookupContext &context);
|
||||||
};
|
};
|
||||||
|
@@ -327,7 +327,7 @@ void TypePrettyPrinter::visit(Function *type)
|
|||||||
if (index + 1 == _overview->markedArgument())
|
if (index + 1 == _overview->markedArgument())
|
||||||
const_cast<Overview*>(_overview)->setMarkedArgumentBegin(_text.length());
|
const_cast<Overview*>(_overview)->setMarkedArgumentBegin(_text.length());
|
||||||
|
|
||||||
Name *name = 0;
|
const Name *name = 0;
|
||||||
|
|
||||||
if (_overview->showArgumentNames())
|
if (_overview->showArgumentNames())
|
||||||
name = arg->name();
|
name = arg->name();
|
||||||
|
@@ -1462,6 +1462,10 @@ bool Preprocessor::isQtReservedWord(const QByteArray ¯oId) const
|
|||||||
return true;
|
return true;
|
||||||
else if (size == 6 && macroId.at(0) == 'Q' && macroId == "Q_SLOT")
|
else if (size == 6 && macroId.at(0) == 'Q' && macroId == "Q_SLOT")
|
||||||
return true;
|
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")
|
else if (size == 6 && macroId.at(0) == 'S' && macroId == "SIGNAL")
|
||||||
return true;
|
return true;
|
||||||
else if (size == 4 && macroId.at(0) == 'S' && macroId == "SLOT")
|
else if (size == 4 && macroId.at(0) == 'S' && macroId == "SLOT")
|
||||||
|
@@ -9,31 +9,41 @@
|
|||||||
|
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
DetailsWidget::DetailsWidget(QWidget *parent)
|
namespace {
|
||||||
: QWidget(parent),
|
const int MARGIN=8;
|
||||||
m_summaryLabel(new QLabel(this)),
|
}
|
||||||
m_detailsButton(new DetailsButton(this)),
|
|
||||||
m_widget(0),
|
|
||||||
m_toolWidget(0),
|
|
||||||
m_grid(new QGridLayout(this))
|
|
||||||
|
|
||||||
|
// 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->setTextInteractionFlags(Qt::TextSelectableByMouse);
|
||||||
m_summaryLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
m_summaryLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
|
m_summaryLabel->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
|
||||||
|
|
||||||
m_grid->addWidget(m_summaryLabel, 0, 0);
|
m_grid->setContentsMargins(0, 0, 0, 0);
|
||||||
m_grid->addWidget(m_detailsButton, 0, 2, 1, 1, Qt::AlignBottom);
|
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_detailsButton->setEnabled(false);
|
||||||
m_dummyWidget->setMaximumHeight(4);
|
|
||||||
m_dummyWidget->setMaximumHeight(4);
|
|
||||||
m_dummyWidget->setVisible(false);
|
|
||||||
m_grid->addWidget(m_dummyWidget, 2, 0, 1, 1);
|
|
||||||
|
|
||||||
connect(m_detailsButton, SIGNAL(clicked()),
|
connect(m_detailsButton, SIGNAL(toggled(bool)),
|
||||||
this, SLOT(detailsButtonClicked()));
|
this, SLOT(setExpanded(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
DetailsWidget::~DetailsWidget()
|
DetailsWidget::~DetailsWidget()
|
||||||
@@ -43,53 +53,36 @@ DetailsWidget::~DetailsWidget()
|
|||||||
|
|
||||||
void DetailsWidget::paintEvent(QPaintEvent *paintEvent)
|
void DetailsWidget::paintEvent(QPaintEvent *paintEvent)
|
||||||
{
|
{
|
||||||
//TL--> ___________ <-- TR
|
|
||||||
// | |
|
|
||||||
//ML-> ______________| <--MM | <--MR
|
|
||||||
// | |
|
|
||||||
//BL-> |_________________________| <-- BR
|
|
||||||
|
|
||||||
|
|
||||||
QWidget::paintEvent(paintEvent);
|
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);
|
QPainter p(this);
|
||||||
p.setRenderHint(QPainter::Antialiasing);
|
|
||||||
p.setPen(Qt::NoPen);
|
|
||||||
|
|
||||||
p.setBrush(palette().dark());
|
const QRect paintArea(m_summaryLabel->geometry().topLeft(),
|
||||||
p.drawRoundedRect(QRect(tl, br), 5, 5);
|
contentsRect().bottomRight());
|
||||||
p.drawRoundedRect(QRect(ml, br), 5, 5);
|
|
||||||
|
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();
|
QWidget::enterEvent(event);
|
||||||
if (m_widget)
|
changeHoverState(true);
|
||||||
m_widget->setVisible(visible);
|
}
|
||||||
m_dummyWidget->setVisible(visible);
|
|
||||||
fixUpLayout();
|
void DetailsWidget::leaveEvent(QEvent * event)
|
||||||
|
{
|
||||||
|
QWidget::leaveEvent(event);
|
||||||
|
changeHoverState(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetailsWidget::setSummaryText(const QString &text)
|
void DetailsWidget::setSummaryText(const QString &text)
|
||||||
@@ -102,15 +95,21 @@ QString DetailsWidget::summaryText() const
|
|||||||
return m_summaryLabel->text();
|
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)
|
if (!m_widget)
|
||||||
m_detailsButton->animateClick();
|
return;
|
||||||
|
|
||||||
|
m_summaryLabel->setEnabled(!visible);
|
||||||
|
m_widget->setVisible(visible);
|
||||||
|
m_detailsButton->setChecked(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *DetailsWidget::widget() const
|
QWidget *DetailsWidget::widget() const
|
||||||
@@ -122,31 +121,40 @@ void DetailsWidget::setWidget(QWidget *widget)
|
|||||||
{
|
{
|
||||||
if (m_widget == widget)
|
if (m_widget == widget)
|
||||||
return;
|
return;
|
||||||
if (m_widget) {
|
|
||||||
|
const bool wasExpanded(isExpanded());
|
||||||
|
|
||||||
|
if (m_widget)
|
||||||
m_grid->removeWidget(m_widget);
|
m_grid->removeWidget(m_widget);
|
||||||
m_widget = 0;
|
m_widget = widget;
|
||||||
}
|
|
||||||
if (widget) {
|
if (widget) {
|
||||||
m_grid->addWidget(widget, 1, 0, 1, 3);
|
m_widget->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
|
||||||
m_widget = widget;
|
m_grid->addWidget(widget, 1, 1, 1, 2);
|
||||||
bool visible = m_detailsButton->isToggled();
|
setExpanded(wasExpanded);
|
||||||
m_widget->setVisible(visible);
|
} else {
|
||||||
m_dummyWidget->setVisible(visible);
|
m_detailsButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
m_detailsButton->setEnabled(0 != m_widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DetailsWidget::setToolWidget(QWidget *widget)
|
void DetailsWidget::setToolWidget(QWidget *widget)
|
||||||
{
|
{
|
||||||
if (m_toolWidget == widget)
|
if (m_toolWidget == widget)
|
||||||
return;
|
return;
|
||||||
if (m_toolWidget) {
|
|
||||||
m_grid->removeWidget(m_toolWidget);
|
m_toolWidget = widget;
|
||||||
m_toolWidget = 0;
|
|
||||||
}
|
if (!m_toolWidget)
|
||||||
if (widget) {
|
return;
|
||||||
m_grid->addWidget(widget, 0, 1, 1, 1, Qt::AlignBottom);
|
|
||||||
m_toolWidget = widget;
|
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
|
QWidget *DetailsWidget::toolWidget() const
|
||||||
@@ -154,25 +162,35 @@ QWidget *DetailsWidget::toolWidget() const
|
|||||||
return m_toolWidget;
|
return m_toolWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function works around a qt limitation.
|
QPixmap DetailsWidget::cacheBackground(const QSize &size, bool expanded)
|
||||||
// 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()
|
|
||||||
{
|
{
|
||||||
if (!m_widget)
|
QLinearGradient lg;
|
||||||
return;
|
lg.setCoordinateMode(QGradient::ObjectBoundingMode);
|
||||||
QWidget *parent = m_widget;
|
lg.setFinalStop(0, 1);
|
||||||
QStack<QWidget *> widgets;
|
|
||||||
while((parent = parent->parentWidget()) && parent && parent->layout()) {
|
lg.setColorAt(0, palette().color(QPalette::Midlight));
|
||||||
widgets.push(parent);
|
lg.setColorAt(1, palette().color(QPalette::Button));
|
||||||
parent->layout()->update();
|
|
||||||
|
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()) {
|
return pixmap;
|
||||||
widgets.pop()->layout()->activate();
|
}
|
||||||
}
|
|
||||||
|
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 "utils_global.h"
|
||||||
|
|
||||||
|
#include <QtGui/QPixmap>
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -17,7 +18,8 @@ class QTCREATOR_UTILS_EXPORT DetailsWidget : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(QString summaryText READ summaryText WRITE setSummaryText DESIGNABLE true)
|
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:
|
public:
|
||||||
DetailsWidget(QWidget *parent = 0);
|
DetailsWidget(QWidget *parent = 0);
|
||||||
~DetailsWidget();
|
~DetailsWidget();
|
||||||
@@ -25,8 +27,7 @@ public:
|
|||||||
void setSummaryText(const QString &text);
|
void setSummaryText(const QString &text);
|
||||||
QString summaryText() const;
|
QString summaryText() const;
|
||||||
|
|
||||||
bool expanded() const;
|
bool isExpanded() const;
|
||||||
void setExpanded(bool);
|
|
||||||
|
|
||||||
void setWidget(QWidget *widget);
|
void setWidget(QWidget *widget);
|
||||||
QWidget *widget() const;
|
QWidget *widget() const;
|
||||||
@@ -34,21 +35,28 @@ public:
|
|||||||
void setToolWidget(QWidget *widget);
|
void setToolWidget(QWidget *widget);
|
||||||
QWidget *toolWidget() const;
|
QWidget *toolWidget() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setExpanded(bool);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *paintEvent);
|
void paintEvent(QPaintEvent *paintEvent);
|
||||||
|
void enterEvent(QEvent *event);
|
||||||
private slots:
|
void leaveEvent(QEvent *event);
|
||||||
void detailsButtonClicked();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void fixUpLayout();
|
QPixmap cacheBackground(const QSize &size, bool expanded);
|
||||||
QLabel *m_summaryLabel;
|
void changeHoverState(bool hovered);
|
||||||
DetailsButton *m_detailsButton;
|
|
||||||
|
|
||||||
QWidget *m_widget;
|
DetailsButton *m_detailsButton;
|
||||||
QWidget *m_toolWidget;
|
|
||||||
QWidget *m_dummyWidget;
|
|
||||||
QGridLayout *m_grid;
|
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);
|
m_d->m_ui.setupUi(this);
|
||||||
hideStatusLabel();
|
hideStatusLabel();
|
||||||
m_d->m_ui.nameLineEdit->setInitialText(tr("<Enter_Name>"));
|
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.pathChooser, SIGNAL(changed(QString)), this, SLOT(slotChanged()));
|
||||||
connect(m_d->m_ui.nameLineEdit, SIGNAL(textChanged(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()));
|
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)
|
void ProjectIntroPage::setName(const QString &name)
|
||||||
{
|
{
|
||||||
m_d->m_ui.nameLineEdit->setText(name);
|
m_d->m_ui.nameLineEdit->setText(name);
|
||||||
|
m_d->m_ui.nameLineEdit->selectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ProjectIntroPage::description() const
|
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 "cmakebuildenvironmentwidget.h"
|
||||||
#include "cmakeproject.h"
|
#include "cmakeproject.h"
|
||||||
|
#include "cmakebuildconfiguration.h"
|
||||||
#include <projectexplorer/environmenteditmodel.h>
|
#include <projectexplorer/environmenteditmodel.h>
|
||||||
#include <QtGui/QVBoxLayout>
|
#include <QtGui/QVBoxLayout>
|
||||||
#include <QtGui/QCheckBox>
|
#include <QtGui/QCheckBox>
|
||||||
@@ -41,7 +42,7 @@ using namespace CMakeProjectManager;
|
|||||||
using namespace CMakeProjectManager::Internal;
|
using namespace CMakeProjectManager::Internal;
|
||||||
|
|
||||||
CMakeBuildEnvironmentWidget::CMakeBuildEnvironmentWidget(CMakeProject *project)
|
CMakeBuildEnvironmentWidget::CMakeBuildEnvironmentWidget(CMakeProject *project)
|
||||||
: BuildConfigWidget(), m_pro(project)
|
: BuildConfigWidget(), m_pro(project), m_buildConfiguration(0)
|
||||||
{
|
{
|
||||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||||
vbox->setMargin(0);
|
vbox->setMargin(0);
|
||||||
@@ -63,29 +64,26 @@ QString CMakeBuildEnvironmentWidget::displayName() const
|
|||||||
return tr("Build Environment");
|
return tr("Build Environment");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildEnvironmentWidget::init(const QString &buildConfigurationName)
|
void CMakeBuildEnvironmentWidget::init(ProjectExplorer::BuildConfiguration *bc)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "Qt4BuildConfigWidget::init()";
|
qDebug() << "Qt4BuildConfigWidget::init()";
|
||||||
|
|
||||||
m_buildConfiguration = buildConfigurationName;
|
m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
|
||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(buildConfigurationName);
|
m_clearSystemEnvironmentCheckBox->setChecked(!m_buildConfiguration->useSystemEnvironment());
|
||||||
m_clearSystemEnvironmentCheckBox->setChecked(!m_pro->useSystemEnvironment(bc));
|
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
||||||
m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(bc));
|
m_buildEnvironmentWidget->setUserChanges(m_buildConfiguration->userEnvironmentChanges());
|
||||||
m_buildEnvironmentWidget->setUserChanges(m_pro->userEnvironmentChanges(bc));
|
|
||||||
m_buildEnvironmentWidget->updateButtons();
|
m_buildEnvironmentWidget->updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildEnvironmentWidget::environmentModelUserChangesUpdated()
|
void CMakeBuildEnvironmentWidget::environmentModelUserChangesUpdated()
|
||||||
{
|
{
|
||||||
m_pro->setUserEnvironmentChanges(
|
m_buildConfiguration->setUserEnvironmentChanges(m_buildEnvironmentWidget->userChanges());
|
||||||
m_pro->buildConfiguration(m_buildConfiguration), m_buildEnvironmentWidget->userChanges());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked)
|
void CMakeBuildEnvironmentWidget::clearSystemEnvironmentCheckBoxClicked(bool checked)
|
||||||
{
|
{
|
||||||
ProjectExplorer::BuildConfiguration *bc = m_pro->buildConfiguration(m_buildConfiguration);
|
m_buildConfiguration->setUseSystemEnvironment(!checked);
|
||||||
m_pro->setUseSystemEnvironment(bc, !checked);
|
m_buildEnvironmentWidget->setBaseEnvironment(m_buildConfiguration->baseEnvironment());
|
||||||
m_buildEnvironmentWidget->setBaseEnvironment(m_pro->baseEnvironment(bc));
|
|
||||||
}
|
}
|
||||||
|
@@ -42,6 +42,7 @@ class EnvironmentWidget;
|
|||||||
namespace CMakeProjectManager {
|
namespace CMakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class CMakeProject;
|
class CMakeProject;
|
||||||
|
class CMakeBuildConfiguration;
|
||||||
|
|
||||||
class CMakeBuildEnvironmentWidget : public ProjectExplorer::BuildConfigWidget
|
class CMakeBuildEnvironmentWidget : public ProjectExplorer::BuildConfigWidget
|
||||||
{
|
{
|
||||||
@@ -51,7 +52,7 @@ public:
|
|||||||
CMakeBuildEnvironmentWidget(CMakeProject *project);
|
CMakeBuildEnvironmentWidget(CMakeProject *project);
|
||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
void init(const QString &buildConfiguration);
|
void init(ProjectExplorer::BuildConfiguration *bc);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void environmentModelUserChangesUpdated();
|
void environmentModelUserChangesUpdated();
|
||||||
@@ -61,7 +62,7 @@ private:
|
|||||||
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
|
ProjectExplorer::EnvironmentWidget *m_buildEnvironmentWidget;
|
||||||
QCheckBox *m_clearSystemEnvironmentCheckBox;
|
QCheckBox *m_clearSystemEnvironmentCheckBox;
|
||||||
CMakeProject *m_pro;
|
CMakeProject *m_pro;
|
||||||
QString m_buildConfiguration;
|
CMakeBuildConfiguration *m_buildConfiguration;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include "makestep.h"
|
#include "makestep.h"
|
||||||
#include "cmakeopenprojectwizard.h"
|
#include "cmakeopenprojectwizard.h"
|
||||||
#include "cmakebuildenvironmentwidget.h"
|
#include "cmakebuildenvironmentwidget.h"
|
||||||
|
#include "cmakebuildconfiguration.h"
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <cpptools/cppmodelmanagerinterface.h>
|
#include <cpptools/cppmodelmanagerinterface.h>
|
||||||
@@ -89,7 +90,7 @@ QString CMakeBuildConfigurationFactory::displayNameForType(const QString & /* ty
|
|||||||
return tr("Create");
|
return tr("Create");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMakeBuildConfigurationFactory::create(const QString &type) const
|
BuildConfiguration *CMakeBuildConfigurationFactory::create(const QString &type) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(type == "Create", return false);
|
QTC_ASSERT(type == "Create", return false);
|
||||||
|
|
||||||
@@ -103,19 +104,20 @@ bool CMakeBuildConfigurationFactory::create(const QString &type) const
|
|||||||
&ok);
|
&ok);
|
||||||
if (!ok || buildConfigurationName.isEmpty())
|
if (!ok || buildConfigurationName.isEmpty())
|
||||||
return false;
|
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);
|
bc->insertBuildStep(0, makeStep);
|
||||||
|
|
||||||
MakeStep *cleanMakeStep = new MakeStep(m_project, bc);
|
MakeStep *cleanMakeStep = new MakeStep(bc);
|
||||||
bc->insertCleanStep(0, cleanMakeStep);
|
bc->insertCleanStep(0, cleanMakeStep);
|
||||||
cleanMakeStep->setClean(true);
|
cleanMakeStep->setClean(true);
|
||||||
|
|
||||||
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
||||||
m_project->sourceDirectory(),
|
m_project->sourceDirectory(),
|
||||||
m_project->buildDirectory(bc),
|
bc->buildDirectory(),
|
||||||
m_project->environment(bc));
|
bc->environment());
|
||||||
if (copw.exec() != QDialog::Accepted) {
|
if (copw.exec() != QDialog::Accepted) {
|
||||||
delete bc;
|
delete bc;
|
||||||
return false;
|
return false;
|
||||||
@@ -129,7 +131,20 @@ bool CMakeBuildConfigurationFactory::create(const QString &type) const
|
|||||||
// Default to all
|
// Default to all
|
||||||
if (m_project->targets().contains("all"))
|
if (m_project->targets().contains("all"))
|
||||||
makeStep->setBuildTarget("all", true);
|
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_fileName(fileName),
|
||||||
m_buildConfigurationFactory(new CMakeBuildConfigurationFactory(this)),
|
m_buildConfigurationFactory(new CMakeBuildConfigurationFactory(this)),
|
||||||
m_rootNode(new CMakeProjectNode(m_fileName)),
|
m_rootNode(new CMakeProjectNode(m_fileName)),
|
||||||
m_toolChain(0),
|
|
||||||
m_insideFileChanged(false)
|
m_insideFileChanged(false)
|
||||||
{
|
{
|
||||||
m_file = new CMakeFile(this, fileName);
|
m_file = new CMakeFile(this, fileName);
|
||||||
@@ -149,7 +163,11 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
|||||||
CMakeProject::~CMakeProject()
|
CMakeProject::~CMakeProject()
|
||||||
{
|
{
|
||||||
delete m_rootNode;
|
delete m_rootNode;
|
||||||
delete m_toolChain;
|
}
|
||||||
|
|
||||||
|
CMakeBuildConfiguration *CMakeProject::activeCMakeBuildConfiguration() const
|
||||||
|
{
|
||||||
|
return static_cast<CMakeBuildConfiguration *>(activeBuildConfiguration());
|
||||||
}
|
}
|
||||||
|
|
||||||
IBuildConfigurationFactory *CMakeProject::buildConfigurationFactory() const
|
IBuildConfigurationFactory *CMakeProject::buildConfigurationFactory() const
|
||||||
@@ -163,7 +181,7 @@ void CMakeProject::slotActiveBuildConfiguration()
|
|||||||
// Pop up a dialog asking the user to rerun cmake
|
// Pop up a dialog asking the user to rerun cmake
|
||||||
QFileInfo sourceFileInfo(m_fileName);
|
QFileInfo sourceFileInfo(m_fileName);
|
||||||
|
|
||||||
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBC)));
|
QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
|
||||||
QFileInfo cbpFileFi(cbpFile);
|
QFileInfo cbpFileFi(cbpFile);
|
||||||
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
|
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
|
||||||
if (!cbpFileFi.exists()) {
|
if (!cbpFileFi.exists()) {
|
||||||
@@ -180,9 +198,9 @@ void CMakeProject::slotActiveBuildConfiguration()
|
|||||||
if (mode != CMakeOpenProjectWizard::Nothing) {
|
if (mode != CMakeOpenProjectWizard::Nothing) {
|
||||||
CMakeOpenProjectWizard copw(m_manager,
|
CMakeOpenProjectWizard copw(m_manager,
|
||||||
sourceFileInfo.absolutePath(),
|
sourceFileInfo.absolutePath(),
|
||||||
buildDirectory(activeBC),
|
activeBC->buildDirectory(),
|
||||||
mode,
|
mode,
|
||||||
environment(activeBC));
|
activeBC->environment());
|
||||||
copw.exec();
|
copw.exec();
|
||||||
activeBC->setValue("msvcVersion", copw.msvcVersion());
|
activeBC->setValue("msvcVersion", copw.msvcVersion());
|
||||||
}
|
}
|
||||||
@@ -200,39 +218,6 @@ void CMakeProject::fileChanged(const QString &fileName)
|
|||||||
m_insideFileChanged = false;
|
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)
|
void CMakeProject::changeBuildDirectory(BuildConfiguration *configuration, const QString &newBuildDirectory)
|
||||||
{
|
{
|
||||||
configuration->setValue("buildDirectory", newBuildDirectory);
|
configuration->setValue("buildDirectory", newBuildDirectory);
|
||||||
@@ -247,7 +232,8 @@ QString CMakeProject::sourceDirectory() const
|
|||||||
bool CMakeProject::parseCMakeLists()
|
bool CMakeProject::parseCMakeLists()
|
||||||
{
|
{
|
||||||
// Find cbp file
|
// Find cbp file
|
||||||
QString cbpFile = CMakeManager::findCbpFile(buildDirectory(activeBuildConfiguration()));
|
CMakeBuildConfiguration *activeBC = activeCMakeBuildConfiguration();
|
||||||
|
QString cbpFile = CMakeManager::findCbpFile(activeBC->buildDirectory());
|
||||||
|
|
||||||
// setFolderName
|
// setFolderName
|
||||||
m_rootNode->setFolderName(QFileInfo(cbpFile).completeBaseName());
|
m_rootNode->setFolderName(QFileInfo(cbpFile).completeBaseName());
|
||||||
@@ -256,7 +242,7 @@ bool CMakeProject::parseCMakeLists()
|
|||||||
//qDebug()<<"Parsing file "<<cbpFile;
|
//qDebug()<<"Parsing file "<<cbpFile;
|
||||||
if (cbpparser.parseCbpFile(cbpFile)) {
|
if (cbpparser.parseCbpFile(cbpFile)) {
|
||||||
// ToolChain
|
// ToolChain
|
||||||
updateToolChain(cbpparser.compilerName());
|
activeBC->updateToolChain(cbpparser.compilerName());
|
||||||
|
|
||||||
m_projectName = cbpparser.projectName();
|
m_projectName = cbpparser.projectName();
|
||||||
m_rootNode->setFolderName(cbpparser.projectName());
|
m_rootNode->setFolderName(cbpparser.projectName());
|
||||||
@@ -309,7 +295,7 @@ bool CMakeProject::parseCMakeLists()
|
|||||||
|
|
||||||
QStringList allIncludePaths;
|
QStringList allIncludePaths;
|
||||||
QStringList allFrameworkPaths;
|
QStringList allFrameworkPaths;
|
||||||
QList<ProjectExplorer::HeaderPath> allHeaderPaths = m_toolChain->systemHeaderPaths();
|
QList<ProjectExplorer::HeaderPath> allHeaderPaths = activeBC->toolChain()->systemHeaderPaths();
|
||||||
foreach (ProjectExplorer::HeaderPath headerPath, allHeaderPaths) {
|
foreach (ProjectExplorer::HeaderPath headerPath, allHeaderPaths) {
|
||||||
if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath)
|
if (headerPath.kind() == ProjectExplorer::HeaderPath::FrameworkHeaderPath)
|
||||||
allFrameworkPaths.append(headerPath.path());
|
allFrameworkPaths.append(headerPath.path());
|
||||||
@@ -325,12 +311,12 @@ bool CMakeProject::parseCMakeLists()
|
|||||||
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||||
if (pinfo.includePaths != allIncludePaths
|
if (pinfo.includePaths != allIncludePaths
|
||||||
|| pinfo.sourceFiles != m_files
|
|| pinfo.sourceFiles != m_files
|
||||||
|| pinfo.defines != m_toolChain->predefinedMacros()
|
|| pinfo.defines != activeBC->toolChain()->predefinedMacros()
|
||||||
|| pinfo.frameworkPaths != allFrameworkPaths) {
|
|| pinfo.frameworkPaths != allFrameworkPaths) {
|
||||||
pinfo.includePaths = allIncludePaths;
|
pinfo.includePaths = allIncludePaths;
|
||||||
// TODO we only want C++ files, not all other stuff that might be in the project
|
// TODO we only want C++ files, not all other stuff that might be in the project
|
||||||
pinfo.sourceFiles = m_files;
|
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;
|
pinfo.frameworkPaths = allFrameworkPaths;
|
||||||
modelmanager->updateProjectInfo(pinfo);
|
modelmanager->updateProjectInfo(pinfo);
|
||||||
modelmanager->updateSourceFiles(pinfo.sourceFiles);
|
modelmanager->updateSourceFiles(pinfo.sourceFiles);
|
||||||
@@ -388,31 +374,12 @@ bool CMakeProject::parseCMakeLists()
|
|||||||
} else {
|
} else {
|
||||||
// TODO report error
|
// TODO report error
|
||||||
qDebug()<<"Parsing failed";
|
qDebug()<<"Parsing failed";
|
||||||
delete m_toolChain;
|
activeBC->updateToolChain(QString::null);
|
||||||
m_toolChain = 0;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
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 CMakeProject::targets() const
|
||||||
{
|
{
|
||||||
QStringList results;
|
QStringList results;
|
||||||
@@ -535,8 +502,6 @@ QString CMakeProject::name() const
|
|||||||
return m_projectName;
|
return m_projectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Core::IFile *CMakeProject::file() const
|
Core::IFile *CMakeProject::file() const
|
||||||
{
|
{
|
||||||
return m_file;
|
return m_file;
|
||||||
@@ -557,56 +522,6 @@ bool CMakeProject::isApplication() const
|
|||||||
return true;
|
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()
|
ProjectExplorer::BuildConfigWidget *CMakeProject::createConfigWidget()
|
||||||
{
|
{
|
||||||
return new CMakeBuildSettingsWidget(this);
|
return new CMakeBuildSettingsWidget(this);
|
||||||
@@ -649,18 +564,19 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
|||||||
if (copw.exec() != QDialog::Accepted)
|
if (copw.exec() != QDialog::Accepted)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ProjectExplorer::BuildConfiguration *bc = new ProjectExplorer::BuildConfiguration("all");
|
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(this);
|
||||||
|
bc->setDisplayName("all");
|
||||||
addBuildConfiguration(bc);
|
addBuildConfiguration(bc);
|
||||||
bc->setValue("msvcVersion", copw.msvcVersion());
|
bc->setValue("msvcVersion", copw.msvcVersion());
|
||||||
if (!copw.buildDirectory().isEmpty())
|
if (!copw.buildDirectory().isEmpty())
|
||||||
bc->setValue("buildDirectory", copw.buildDirectory());
|
bc->setValue("buildDirectory", copw.buildDirectory());
|
||||||
|
|
||||||
// Now create a standard build configuration
|
// Now create a standard build configuration
|
||||||
makeStep = new MakeStep(this, bc);
|
makeStep = new MakeStep(bc);
|
||||||
bc->insertBuildStep(0, makeStep);
|
bc->insertBuildStep(0, makeStep);
|
||||||
|
|
||||||
//TODO save arguments somewhere copw.arguments()
|
//TODO save arguments somewhere copw.arguments()
|
||||||
MakeStep *cleanMakeStep = new MakeStep(this, bc);
|
MakeStep *cleanMakeStep = new MakeStep(bc);
|
||||||
bc->insertCleanStep(0, cleanMakeStep);
|
bc->insertCleanStep(0, cleanMakeStep);
|
||||||
cleanMakeStep->setClean(true);
|
cleanMakeStep->setClean(true);
|
||||||
setActiveBuildConfiguration(bc);
|
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
|
// We have a user file, but we could still be missing the cbp file
|
||||||
// or simply run createXml with the saved settings
|
// or simply run createXml with the saved settings
|
||||||
QFileInfo sourceFileInfo(m_fileName);
|
QFileInfo sourceFileInfo(m_fileName);
|
||||||
QStringList needToCreate;
|
|
||||||
QStringList needToUpdate;
|
|
||||||
BuildConfiguration *activeBC = activeBuildConfiguration();
|
BuildConfiguration *activeBC = activeBuildConfiguration();
|
||||||
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBC)));
|
QString cbpFile = CMakeManager::findCbpFile(QDir(activeBC->buildDirectory()));
|
||||||
QFileInfo cbpFileFi(cbpFile);
|
QFileInfo cbpFileFi(cbpFile);
|
||||||
|
|
||||||
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
|
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
|
||||||
@@ -683,9 +597,9 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
|||||||
if (mode != CMakeOpenProjectWizard::Nothing) {
|
if (mode != CMakeOpenProjectWizard::Nothing) {
|
||||||
CMakeOpenProjectWizard copw(m_manager,
|
CMakeOpenProjectWizard copw(m_manager,
|
||||||
sourceFileInfo.absolutePath(),
|
sourceFileInfo.absolutePath(),
|
||||||
buildDirectory(activeBC),
|
activeBC->buildDirectory(),
|
||||||
mode,
|
mode,
|
||||||
environment(activeBC));
|
activeBC->environment());
|
||||||
if (copw.exec() != QDialog::Accepted)
|
if (copw.exec() != QDialog::Accepted)
|
||||||
return false;
|
return false;
|
||||||
activeBC->setValue("msvcVersion", copw.msvcVersion());
|
activeBC->setValue("msvcVersion", copw.msvcVersion());
|
||||||
@@ -714,13 +628,6 @@ CMakeTarget CMakeProject::targetForTitle(const QString &title)
|
|||||||
return CMakeTarget();
|
return CMakeTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::ToolChain::ToolChainType CMakeProject::toolChainType() const
|
|
||||||
{
|
|
||||||
if (m_toolChain)
|
|
||||||
return m_toolChain->type();
|
|
||||||
return ProjectExplorer::ToolChain::UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
// CMakeFile
|
// CMakeFile
|
||||||
|
|
||||||
CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
|
CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
|
||||||
@@ -779,7 +686,7 @@ void CMakeFile::modified(ReloadBehavior *behavior)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeProject *project)
|
CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeProject *project)
|
||||||
: m_project(project)
|
: m_project(project), m_buildConfiguration(0)
|
||||||
{
|
{
|
||||||
QFormLayout *fl = new QFormLayout(this);
|
QFormLayout *fl = new QFormLayout(this);
|
||||||
fl->setContentsMargins(20, -1, 0, -1);
|
fl->setContentsMargins(20, -1, 0, -1);
|
||||||
@@ -808,12 +715,11 @@ QString CMakeBuildSettingsWidget::displayName() const
|
|||||||
return "CMake";
|
return "CMake";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeBuildSettingsWidget::init(const QString &buildConfigurationName)
|
void CMakeBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||||
{
|
{
|
||||||
m_buildConfiguration = buildConfigurationName;
|
m_buildConfiguration = static_cast<CMakeBuildConfiguration *>(bc);
|
||||||
BuildConfiguration *bc = m_project->buildConfiguration(buildConfigurationName);
|
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
|
||||||
m_pathLineEdit->setText(m_project->buildDirectory(bc));
|
if (m_buildConfiguration->buildDirectory() == m_project->sourceDirectory())
|
||||||
if (m_project->buildDirectory(bc) == m_project->sourceDirectory())
|
|
||||||
m_changeButton->setEnabled(false);
|
m_changeButton->setEnabled(false);
|
||||||
else
|
else
|
||||||
m_changeButton->setEnabled(true);
|
m_changeButton->setEnabled(true);
|
||||||
@@ -821,14 +727,13 @@ void CMakeBuildSettingsWidget::init(const QString &buildConfigurationName)
|
|||||||
|
|
||||||
void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
|
void CMakeBuildSettingsWidget::openChangeBuildDirectoryDialog()
|
||||||
{
|
{
|
||||||
BuildConfiguration *bc = m_project->buildConfiguration(m_buildConfiguration);
|
|
||||||
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
CMakeOpenProjectWizard copw(m_project->projectManager(),
|
||||||
m_project->sourceDirectory(),
|
m_project->sourceDirectory(),
|
||||||
m_project->buildDirectory(bc),
|
m_buildConfiguration->buildDirectory(),
|
||||||
m_project->environment(bc));
|
m_buildConfiguration->environment());
|
||||||
if (copw.exec() == QDialog::Accepted) {
|
if (copw.exec() == QDialog::Accepted) {
|
||||||
m_project->changeBuildDirectory(bc, copw.buildDirectory());
|
m_project->changeBuildDirectory(m_buildConfiguration, copw.buildDirectory());
|
||||||
m_pathLineEdit->setText(m_project->buildDirectory(bc));
|
m_pathLineEdit->setText(m_buildConfiguration->buildDirectory());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
#include "cmakeprojectmanager.h"
|
#include "cmakeprojectmanager.h"
|
||||||
#include "cmakeprojectnodes.h"
|
#include "cmakeprojectnodes.h"
|
||||||
|
#include "cmakebuildconfiguration.h"
|
||||||
#include "makestep.h"
|
#include "makestep.h"
|
||||||
|
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
@@ -73,7 +74,9 @@ public:
|
|||||||
QStringList availableCreationTypes() const;
|
QStringList availableCreationTypes() const;
|
||||||
QString displayNameForType(const QString &type) 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:
|
private:
|
||||||
CMakeProject *m_project;
|
CMakeProject *m_project;
|
||||||
@@ -88,6 +91,8 @@ public:
|
|||||||
CMakeProject(CMakeManager *manager, const QString &filename);
|
CMakeProject(CMakeManager *manager, const QString &filename);
|
||||||
~CMakeProject();
|
~CMakeProject();
|
||||||
|
|
||||||
|
CMakeBuildConfiguration *activeCMakeBuildConfiguration() const;
|
||||||
|
|
||||||
virtual QString name() const;
|
virtual QString name() const;
|
||||||
virtual Core::IFile *file() const;
|
virtual Core::IFile *file() const;
|
||||||
virtual ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
|
virtual ProjectExplorer::IBuildConfigurationFactory *buildConfigurationFactory() const;
|
||||||
@@ -97,16 +102,6 @@ public:
|
|||||||
|
|
||||||
virtual bool isApplication() const;
|
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 ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||||
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
||||||
|
|
||||||
@@ -114,12 +109,10 @@ public:
|
|||||||
|
|
||||||
virtual QStringList files(FilesMode fileMode) const;
|
virtual QStringList files(FilesMode fileMode) const;
|
||||||
QStringList targets() const;
|
QStringList targets() const;
|
||||||
QString buildParser(ProjectExplorer::BuildConfiguration *configuration) const;
|
|
||||||
CMakeTarget targetForTitle(const QString &title);
|
CMakeTarget targetForTitle(const QString &title);
|
||||||
|
|
||||||
QString sourceDirectory() const;
|
QString sourceDirectory() const;
|
||||||
ProjectExplorer::ToolChain::ToolChainType toolChainType() const;
|
|
||||||
ProjectExplorer::ToolChain *toolChain(ProjectExplorer::BuildConfiguration *configuration) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
||||||
@@ -134,7 +127,6 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool parseCMakeLists();
|
bool parseCMakeLists();
|
||||||
void updateToolChain(const QString &compiler);
|
|
||||||
|
|
||||||
void buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list);
|
void buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list);
|
||||||
void gatherFileNodes(ProjectExplorer::FolderNode *parent, QList<ProjectExplorer::FileNode *> &list);
|
void gatherFileNodes(ProjectExplorer::FolderNode *parent, QList<ProjectExplorer::FileNode *> &list);
|
||||||
@@ -150,7 +142,6 @@ private:
|
|||||||
CMakeProjectNode *m_rootNode;
|
CMakeProjectNode *m_rootNode;
|
||||||
QStringList m_files;
|
QStringList m_files;
|
||||||
QList<CMakeTarget> m_targets;
|
QList<CMakeTarget> m_targets;
|
||||||
ProjectExplorer::ToolChain *m_toolChain;
|
|
||||||
ProjectExplorer::FileWatcher *m_watcher;
|
ProjectExplorer::FileWatcher *m_watcher;
|
||||||
bool m_insideFileChanged;
|
bool m_insideFileChanged;
|
||||||
QSet<QString> m_watchedFiles;
|
QSet<QString> m_watchedFiles;
|
||||||
@@ -230,14 +221,14 @@ public:
|
|||||||
|
|
||||||
// This is called to set up the config widget before showing it
|
// This is called to set up the config widget before showing it
|
||||||
// buildConfiguration is QString::null for the non buildConfiguration specific page
|
// buildConfiguration is QString::null for the non buildConfiguration specific page
|
||||||
virtual void init(const QString &buildConfiguration);
|
virtual void init(ProjectExplorer::BuildConfiguration *bc);
|
||||||
private slots:
|
private slots:
|
||||||
void openChangeBuildDirectoryDialog();
|
void openChangeBuildDirectoryDialog();
|
||||||
private:
|
private:
|
||||||
CMakeProject *m_project;
|
CMakeProject *m_project;
|
||||||
QLineEdit *m_pathLineEdit;
|
QLineEdit *m_pathLineEdit;
|
||||||
QPushButton *m_changeButton;
|
QPushButton *m_changeButton;
|
||||||
QString m_buildConfiguration;
|
CMakeBuildConfiguration *m_buildConfiguration;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -10,7 +10,8 @@ HEADERS = cmakeproject.h \
|
|||||||
makestep.h \
|
makestep.h \
|
||||||
cmakerunconfiguration.h \
|
cmakerunconfiguration.h \
|
||||||
cmakeopenprojectwizard.h \
|
cmakeopenprojectwizard.h \
|
||||||
cmakebuildenvironmentwidget.h
|
cmakebuildenvironmentwidget.h \
|
||||||
|
cmakebuildconfiguration.h
|
||||||
SOURCES = cmakeproject.cpp \
|
SOURCES = cmakeproject.cpp \
|
||||||
cmakeprojectplugin.cpp \
|
cmakeprojectplugin.cpp \
|
||||||
cmakeprojectmanager.cpp \
|
cmakeprojectmanager.cpp \
|
||||||
@@ -18,7 +19,8 @@ SOURCES = cmakeproject.cpp \
|
|||||||
makestep.cpp \
|
makestep.cpp \
|
||||||
cmakerunconfiguration.cpp \
|
cmakerunconfiguration.cpp \
|
||||||
cmakeopenprojectwizard.cpp \
|
cmakeopenprojectwizard.cpp \
|
||||||
cmakebuildenvironmentwidget.cpp
|
cmakebuildenvironmentwidget.cpp \
|
||||||
|
cmakebuildconfiguration.cpp
|
||||||
RESOURCES += cmakeproject.qrc
|
RESOURCES += cmakeproject.qrc
|
||||||
FORMS +=
|
FORMS +=
|
||||||
|
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
#include "cmakerunconfiguration.h"
|
#include "cmakerunconfiguration.h"
|
||||||
|
|
||||||
#include "cmakeproject.h"
|
#include "cmakeproject.h"
|
||||||
|
#include "cmakebuildconfiguration.h"
|
||||||
#include "cmakeprojectconstants.h"
|
#include "cmakeprojectconstants.h"
|
||||||
|
|
||||||
#include <projectexplorer/environment.h>
|
#include <projectexplorer/environment.h>
|
||||||
@@ -58,12 +59,19 @@ CMakeRunConfiguration::CMakeRunConfiguration(CMakeProject *pro, const QString &t
|
|||||||
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
|
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
|
||||||
this, SIGNAL(baseEnvironmentChanged()));
|
this, SIGNAL(baseEnvironmentChanged()));
|
||||||
|
|
||||||
connect(pro, SIGNAL(environmentChanged(QString)),
|
// TODO
|
||||||
this, SIGNAL(baseEnvironmentChanged()));
|
// connect(pro, SIGNAL(environmentChanged(ProjectExplorer::BuildConfiguration *)),
|
||||||
|
// this, SIGNAL(baseEnvironmentChanged()));
|
||||||
}
|
}
|
||||||
|
|
||||||
CMakeRunConfiguration::~CMakeRunConfiguration()
|
CMakeRunConfiguration::~CMakeRunConfiguration()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CMakeProject *CMakeRunConfiguration::cmakeProject() const
|
||||||
|
{
|
||||||
|
return static_cast<CMakeProject *>(project());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeRunConfiguration::type() const
|
QString CMakeRunConfiguration::type() const
|
||||||
@@ -186,7 +194,7 @@ ProjectExplorer::Environment CMakeRunConfiguration::baseEnvironment() const
|
|||||||
} else if (m_baseEnvironmentBase == CMakeRunConfiguration::SystemEnvironmentBase) {
|
} else if (m_baseEnvironmentBase == CMakeRunConfiguration::SystemEnvironmentBase) {
|
||||||
env = ProjectExplorer::Environment::systemEnvironment();
|
env = ProjectExplorer::Environment::systemEnvironment();
|
||||||
} else if (m_baseEnvironmentBase == CMakeRunConfiguration::BuildEnvironmentBase) {
|
} else if (m_baseEnvironmentBase == CMakeRunConfiguration::BuildEnvironmentBase) {
|
||||||
env = project()->environment(project()->activeBuildConfiguration());
|
env = project()->activeBuildConfiguration()->environment();
|
||||||
}
|
}
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
@@ -226,8 +234,8 @@ void CMakeRunConfiguration::setUserEnvironmentChanges(const QList<ProjectExplore
|
|||||||
|
|
||||||
ProjectExplorer::ToolChain::ToolChainType CMakeRunConfiguration::toolChainType() const
|
ProjectExplorer::ToolChain::ToolChainType CMakeRunConfiguration::toolChainType() const
|
||||||
{
|
{
|
||||||
CMakeProject *pro = static_cast<CMakeProject *>(project());
|
CMakeBuildConfiguration *bc = cmakeProject()->activeCMakeBuildConfiguration();
|
||||||
return pro->toolChainType();
|
return bc->toolChainType();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configuration widget
|
// Configuration widget
|
||||||
|
@@ -53,6 +53,8 @@ class CMakeRunConfiguration : public ProjectExplorer::LocalApplicationRunConfigu
|
|||||||
public:
|
public:
|
||||||
CMakeRunConfiguration(CMakeProject *pro, const QString &target, const QString &workingDirectory, const QString &title);
|
CMakeRunConfiguration(CMakeProject *pro, const QString &target, const QString &workingDirectory, const QString &title);
|
||||||
virtual ~CMakeRunConfiguration();
|
virtual ~CMakeRunConfiguration();
|
||||||
|
CMakeProject *cmakeProject() const;
|
||||||
|
|
||||||
virtual QString type() const;
|
virtual QString type() const;
|
||||||
virtual QString executable() const;
|
virtual QString executable() const;
|
||||||
virtual RunMode runMode() const;
|
virtual RunMode runMode() const;
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "makestep.h"
|
#include "makestep.h"
|
||||||
#include "cmakeprojectconstants.h"
|
#include "cmakeprojectconstants.h"
|
||||||
#include "cmakeproject.h"
|
#include "cmakeproject.h"
|
||||||
|
#include "cmakebuildconfiguration.h"
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
|
||||||
@@ -42,15 +43,14 @@ using namespace CMakeProjectManager;
|
|||||||
using namespace CMakeProjectManager::Internal;
|
using namespace CMakeProjectManager::Internal;
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
MakeStep::MakeStep(CMakeProject *pro, BuildConfiguration *bc)
|
MakeStep::MakeStep(BuildConfiguration *bc)
|
||||||
: AbstractMakeStep(pro, bc), m_pro(pro), m_clean(false), m_futureInterface(0)
|
: AbstractMakeStep(bc), m_clean(false), m_futureInterface(0)
|
||||||
{
|
{
|
||||||
m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
|
m_percentProgress = QRegExp("^\\[\\s*(\\d*)%\\]");
|
||||||
}
|
}
|
||||||
|
|
||||||
MakeStep::MakeStep(MakeStep *bs, BuildConfiguration *bc)
|
MakeStep::MakeStep(MakeStep *bs, BuildConfiguration *bc)
|
||||||
: AbstractMakeStep(bs, bc),
|
: AbstractMakeStep(bs, bc),
|
||||||
m_pro(bs->m_pro),
|
|
||||||
m_clean(bs->m_clean),
|
m_clean(bs->m_clean),
|
||||||
m_futureInterface(0),
|
m_futureInterface(0),
|
||||||
m_buildTargets(bs->m_buildTargets),
|
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)
|
void MakeStep::setClean(bool clean)
|
||||||
{
|
{
|
||||||
m_clean = clean;
|
m_clean = clean;
|
||||||
@@ -96,18 +101,18 @@ void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
|||||||
|
|
||||||
bool MakeStep::init()
|
bool MakeStep::init()
|
||||||
{
|
{
|
||||||
BuildConfiguration *bc = buildConfiguration();
|
CMakeBuildConfiguration *bc = cmakeBuildConfiguration();
|
||||||
setBuildParser(m_pro->buildParser(bc));
|
setBuildParser(bc->buildParser());
|
||||||
|
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
setWorkingDirectory(m_pro->buildDirectory(bc));
|
setWorkingDirectory(bc->buildDirectory());
|
||||||
|
|
||||||
setCommand(m_pro->toolChain(bc)->makeCommand());
|
setCommand(bc->toolChain()->makeCommand());
|
||||||
|
|
||||||
QStringList arguments = m_buildTargets;
|
QStringList arguments = m_buildTargets;
|
||||||
arguments << additionalArguments();
|
arguments << additionalArguments();
|
||||||
setArguments(arguments);
|
setArguments(arguments);
|
||||||
setEnvironment(m_pro->environment(bc));
|
setEnvironment(bc->environment());
|
||||||
setIgnoreReturnValue(m_clean);
|
setIgnoreReturnValue(m_clean);
|
||||||
|
|
||||||
return AbstractMakeStep::init();
|
return AbstractMakeStep::init();
|
||||||
@@ -154,11 +159,6 @@ void MakeStep::stdOut(const QString &line)
|
|||||||
AbstractMakeStep::stdOut(line);
|
AbstractMakeStep::stdOut(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMakeProject *MakeStep::project() const
|
|
||||||
{
|
|
||||||
return m_pro;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool MakeStep::buildsTarget(const QString &target) const
|
bool MakeStep::buildsTarget(const QString &target) const
|
||||||
{
|
{
|
||||||
return m_buildTargets.contains(target);
|
return m_buildTargets.contains(target);
|
||||||
@@ -206,7 +206,8 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
|||||||
fl->addRow(tr("Targets:"), m_targetsList);
|
fl->addRow(tr("Targets:"), m_targetsList);
|
||||||
|
|
||||||
// TODO update this list also on rescans of the CMakeLists.txt
|
// 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()) {
|
foreach(const QString& target, pro->targets()) {
|
||||||
QListWidgetItem *item = new QListWidgetItem(target, m_targetsList);
|
QListWidgetItem *item = new QListWidgetItem(target, m_targetsList);
|
||||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||||
@@ -255,11 +256,13 @@ void MakeStepConfigWidget::updateDetails()
|
|||||||
{
|
{
|
||||||
QStringList arguments = m_makeStep->m_buildTargets;
|
QStringList arguments = m_makeStep->m_buildTargets;
|
||||||
arguments << m_makeStep->additionalArguments();
|
arguments << m_makeStep->additionalArguments();
|
||||||
m_summaryText = tr("<b>Make:</b> %1 %2")
|
|
||||||
.arg(m_makeStep->project()->toolChain(
|
CMakeBuildConfiguration *bc = m_makeStep->cmakeBuildConfiguration();
|
||||||
m_makeStep->buildConfiguration())
|
ProjectExplorer::ToolChain *tc = bc->toolChain();
|
||||||
->makeCommand(),
|
if (tc)
|
||||||
arguments.join(" "));
|
m_summaryText = tr("<b>Make:</b> %1 %2").arg(tc->makeCommand(), arguments.join(" "));
|
||||||
|
else
|
||||||
|
m_summaryText = tr("<b>Unknown Toolchain</b>");
|
||||||
emit updateSummary();
|
emit updateSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,12 +280,10 @@ bool MakeStepFactory::canCreate(const QString &name) const
|
|||||||
return (Constants::MAKESTEP == name);
|
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);
|
Q_ASSERT(name == Constants::MAKESTEP);
|
||||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
return new MakeStep(bc);
|
||||||
Q_ASSERT(pro);
|
|
||||||
return new MakeStep(pro, bc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStep *MakeStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) const
|
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);
|
return new MakeStep(static_cast<MakeStep *>(bs), bc);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList MakeStepFactory::canCreateForProject(Project * /* pro */) const
|
QStringList MakeStepFactory::canCreateForBuildConfiguration(BuildConfiguration * /* pro */) const
|
||||||
{
|
{
|
||||||
return QStringList();
|
return QStringList();
|
||||||
}
|
}
|
||||||
|
@@ -41,7 +41,7 @@ QT_END_NAMESPACE
|
|||||||
namespace CMakeProjectManager {
|
namespace CMakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class CMakeProject;
|
class CMakeBuildConfiguration;
|
||||||
|
|
||||||
class MakeStep : public ProjectExplorer::AbstractMakeStep
|
class MakeStep : public ProjectExplorer::AbstractMakeStep
|
||||||
{
|
{
|
||||||
@@ -49,9 +49,12 @@ class MakeStep : public ProjectExplorer::AbstractMakeStep
|
|||||||
friend class MakeStepConfigWidget; // TODO remove
|
friend class MakeStepConfigWidget; // TODO remove
|
||||||
// This is for modifying internal data
|
// This is for modifying internal data
|
||||||
public:
|
public:
|
||||||
MakeStep(CMakeProject *pro, ProjectExplorer::BuildConfiguration *bc);
|
MakeStep(ProjectExplorer::BuildConfiguration *bc);
|
||||||
MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
||||||
~MakeStep();
|
~MakeStep();
|
||||||
|
|
||||||
|
CMakeBuildConfiguration *cmakeBuildConfiguration() const;
|
||||||
|
|
||||||
virtual bool init();
|
virtual bool init();
|
||||||
|
|
||||||
virtual void run(QFutureInterface<bool> &fi);
|
virtual void run(QFutureInterface<bool> &fi);
|
||||||
@@ -60,7 +63,6 @@ public:
|
|||||||
virtual QString displayName();
|
virtual QString displayName();
|
||||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||||
virtual bool immutable() const;
|
virtual bool immutable() const;
|
||||||
CMakeProject *project() const;
|
|
||||||
bool buildsTarget(const QString &target) const;
|
bool buildsTarget(const QString &target) const;
|
||||||
void setBuildTarget(const QString &target, bool on);
|
void setBuildTarget(const QString &target, bool on);
|
||||||
QStringList additionalArguments() const;
|
QStringList additionalArguments() const;
|
||||||
@@ -77,7 +79,6 @@ protected:
|
|||||||
// For parsing [ 76%]
|
// For parsing [ 76%]
|
||||||
virtual void stdOut(const QString &line);
|
virtual void stdOut(const QString &line);
|
||||||
private:
|
private:
|
||||||
CMakeProject *m_pro;
|
|
||||||
bool m_clean;
|
bool m_clean;
|
||||||
QRegExp m_percentProgress;
|
QRegExp m_percentProgress;
|
||||||
QFutureInterface<bool> *m_futureInterface;
|
QFutureInterface<bool> *m_futureInterface;
|
||||||
@@ -107,9 +108,9 @@ private:
|
|||||||
class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
class MakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||||
{
|
{
|
||||||
virtual bool canCreate(const QString &name) const;
|
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 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;
|
virtual QString displayNameForName(const QString &name) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -168,6 +168,7 @@ RESOURCES += core.qrc \
|
|||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
SOURCES += progressmanager/progressmanager_win.cpp
|
SOURCES += progressmanager/progressmanager_win.cpp
|
||||||
|
LIBS += -lole32
|
||||||
}
|
}
|
||||||
else:macx {
|
else:macx {
|
||||||
OBJECTIVE_SOURCES += progressmanager/progressmanager_mac.mm
|
OBJECTIVE_SOURCES += progressmanager/progressmanager_mac.mm
|
||||||
|
@@ -50,10 +50,7 @@ ProgressManagerPrivate::ProgressManagerPrivate(QObject *parent)
|
|||||||
|
|
||||||
ProgressManagerPrivate::~ProgressManagerPrivate()
|
ProgressManagerPrivate::~ProgressManagerPrivate()
|
||||||
{
|
{
|
||||||
}
|
cleanup();
|
||||||
|
|
||||||
void ProgressManagerPrivate::init()
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgressManagerPrivate::cancelTasks(const QString &type)
|
void ProgressManagerPrivate::cancelTasks(const QString &type)
|
||||||
|
@@ -29,6 +29,14 @@
|
|||||||
|
|
||||||
#include "progressmanager_p.h"
|
#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
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||||
#import <AppKit/NSDockTile.h>
|
#import <AppKit/NSDockTile.h>
|
||||||
#import <AppKit/NSApplication.h>
|
#import <AppKit/NSApplication.h>
|
||||||
|
@@ -48,6 +48,7 @@ public:
|
|||||||
ProgressManagerPrivate(QObject *parent = 0);
|
ProgressManagerPrivate(QObject *parent = 0);
|
||||||
~ProgressManagerPrivate();
|
~ProgressManagerPrivate();
|
||||||
void init();
|
void init();
|
||||||
|
void cleanup();
|
||||||
|
|
||||||
FutureProgress *addTask(const QFuture<void> &future, const QString &title, const QString &type,
|
FutureProgress *addTask(const QFuture<void> &future, const QString &title, const QString &type,
|
||||||
ProgressFlags flags);
|
ProgressFlags flags);
|
||||||
|
@@ -27,8 +27,93 @@
|
|||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtGui/QMainWindow>
|
||||||
|
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
#include "progressmanager_p.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)
|
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
|
||||||
{
|
{
|
||||||
Q_UNUSED(text)
|
Q_UNUSED(text)
|
||||||
@@ -49,3 +134,6 @@ void Core::Internal::ProgressManagerPrivate::setApplicationProgressVisible(bool
|
|||||||
{
|
{
|
||||||
Q_UNUSED(visible)
|
Q_UNUSED(visible)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif // __ITaskbarList2_INTERFACE_DEFINED__
|
||||||
|
@@ -29,6 +29,14 @@
|
|||||||
|
|
||||||
#include "progressmanager_p.h"
|
#include "progressmanager_p.h"
|
||||||
|
|
||||||
|
void Core::Internal::ProgressManagerPrivate::init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::Internal::ProgressManagerPrivate::cleanup()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
|
void Core::Internal::ProgressManagerPrivate::setApplicationLabel(const QString &text)
|
||||||
{
|
{
|
||||||
Q_UNUSED(text)
|
Q_UNUSED(text)
|
||||||
|
@@ -186,19 +186,20 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class FindUses: protected ASTVisitor
|
class FindLocalUses: protected ASTVisitor
|
||||||
{
|
{
|
||||||
Scope *_functionScope;
|
Scope *_functionScope;
|
||||||
|
|
||||||
FindScope findScope;
|
FindScope findScope;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FindUses(TranslationUnit *translationUnit)
|
FindLocalUses(TranslationUnit *translationUnit)
|
||||||
: ASTVisitor(translationUnit)
|
: ASTVisitor(translationUnit), hasD(false), hasQ(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
// local and external uses.
|
// local and external uses.
|
||||||
SemanticInfo::LocalUseMap localUses;
|
SemanticInfo::LocalUseMap localUses;
|
||||||
|
bool hasD;
|
||||||
|
bool hasQ;
|
||||||
|
|
||||||
void operator()(FunctionDefinitionAST *ast)
|
void operator()(FunctionDefinitionAST *ast)
|
||||||
{
|
{
|
||||||
@@ -218,7 +219,7 @@ protected:
|
|||||||
if (! (ast && ast->name))
|
if (! (ast && ast->name))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Identifier *id = ast->name->identifier();
|
const Identifier *id = ast->name->identifier();
|
||||||
|
|
||||||
if (scope) {
|
if (scope) {
|
||||||
for (Symbol *member = scope->lookat(id); member; member = member->next()) {
|
for (Symbol *member = scope->lookat(id); member; member = member->next()) {
|
||||||
@@ -357,6 +358,16 @@ protected:
|
|||||||
return false;
|
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)
|
virtual bool visit(ExpressionOrDeclarationStatementAST *ast)
|
||||||
{
|
{
|
||||||
accept(ast->declaration);
|
accept(ast->declaration);
|
||||||
@@ -466,7 +477,7 @@ protected:
|
|||||||
|
|
||||||
class FindFunctionDefinitions: protected SymbolVisitor
|
class FindFunctionDefinitions: protected SymbolVisitor
|
||||||
{
|
{
|
||||||
Name *_declarationName;
|
const Name *_declarationName;
|
||||||
QList<Function *> *_functions;
|
QList<Function *> *_functions;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -475,7 +486,7 @@ public:
|
|||||||
_functions(0)
|
_functions(0)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
void operator()(Name *declarationName, Scope *globals,
|
void operator()(const Name *declarationName, Scope *globals,
|
||||||
QList<Function *> *functions)
|
QList<Function *> *functions)
|
||||||
{
|
{
|
||||||
_declarationName = declarationName;
|
_declarationName = declarationName;
|
||||||
@@ -491,8 +502,8 @@ protected:
|
|||||||
|
|
||||||
virtual bool visit(Function *function)
|
virtual bool visit(Function *function)
|
||||||
{
|
{
|
||||||
Name *name = function->name();
|
const Name *name = function->name();
|
||||||
if (QualifiedNameId *q = name->asQualifiedNameId())
|
if (const QualifiedNameId *q = name->asQualifiedNameId())
|
||||||
name = q->unqualifiedNameId();
|
name = q->unqualifiedNameId();
|
||||||
|
|
||||||
if (_declarationName->isEqualTo(name))
|
if (_declarationName->isEqualTo(name))
|
||||||
@@ -504,19 +515,19 @@ protected:
|
|||||||
|
|
||||||
} // end of anonymous namespace
|
} // 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)
|
if (! symbolName)
|
||||||
return 0; // nothing to do.
|
return 0; // nothing to do.
|
||||||
|
|
||||||
QVector<Name *> names;
|
QVector<const Name *> names;
|
||||||
|
|
||||||
for (Scope *scope = s->scope(); scope; scope = scope->enclosingScope()) {
|
for (Scope *scope = s->scope(); scope; scope = scope->enclosingScope()) {
|
||||||
if (scope->isClassScope() || scope->isNamespaceScope()) {
|
if (scope->isClassScope() || scope->isNamespaceScope()) {
|
||||||
if (scope->owner() && scope->owner()->name()) {
|
if (scope->owner() && scope->owner()->name()) {
|
||||||
Name *ownerName = scope->owner()->name();
|
const Name *ownerName = scope->owner()->name();
|
||||||
if (QualifiedNameId *q = ownerName->asQualifiedNameId()) {
|
if (const QualifiedNameId *q = ownerName->asQualifiedNameId()) {
|
||||||
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||||
names.prepend(q->nameAt(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) {
|
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||||
names.append(q->nameAt(i));
|
names.append(q->nameAt(i));
|
||||||
}
|
}
|
||||||
@@ -929,6 +940,7 @@ void CPPEditor::updateMethodBoxIndex()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CPPEditor::highlightUses(const QList<SemanticInfo::Use> &uses,
|
void CPPEditor::highlightUses(const QList<SemanticInfo::Use> &uses,
|
||||||
|
const SemanticInfo &semanticInfo,
|
||||||
QList<QTextEdit::ExtraSelection> *selections)
|
QList<QTextEdit::ExtraSelection> *selections)
|
||||||
{
|
{
|
||||||
bool isUnused = false;
|
bool isUnused = false;
|
||||||
@@ -951,6 +963,14 @@ void CPPEditor::highlightUses(const QList<SemanticInfo::Use> &uses,
|
|||||||
sel.cursor.setPosition(anchor);
|
sel.cursor.setPosition(anchor);
|
||||||
sel.cursor.setPosition(position, QTextCursor::KeepAnchor);
|
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);
|
selections->append(sel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1001,27 +1021,28 @@ void CPPEditor::updateUsesNow()
|
|||||||
semanticRehighlight();
|
semanticRehighlight();
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isCompatible(Name *name, Name *otherName)
|
static bool isCompatible(const Name *name, const Name *otherName)
|
||||||
{
|
{
|
||||||
if (NameId *nameId = name->asNameId()) {
|
if (const NameId *nameId = name->asNameId()) {
|
||||||
if (TemplateNameId *otherTemplId = otherName->asTemplateNameId())
|
if (const TemplateNameId *otherTemplId = otherName->asTemplateNameId())
|
||||||
return nameId->identifier()->isEqualTo(otherTemplId->identifier());
|
return nameId->identifier()->isEqualTo(otherTemplId->identifier());
|
||||||
} else if (TemplateNameId *templId = name->asTemplateNameId()) {
|
} else if (const TemplateNameId *templId = name->asTemplateNameId()) {
|
||||||
if (NameId *otherNameId = otherName->asNameId())
|
if (const NameId *otherNameId = otherName->asNameId())
|
||||||
return templId->identifier()->isEqualTo(otherNameId->identifier());
|
return templId->identifier()->isEqualTo(otherNameId->identifier());
|
||||||
}
|
}
|
||||||
|
|
||||||
return name->isEqualTo(otherName);
|
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();
|
Function *declTy = declaration->type()->asFunctionType();
|
||||||
if (! declTy)
|
if (! declTy)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Name *definitionName = definition->name();
|
const Name *definitionName = definition->name();
|
||||||
if (QualifiedNameId *q = definitionName->asQualifiedNameId()) {
|
if (const QualifiedNameId *q = definitionName->asQualifiedNameId()) {
|
||||||
if (! isCompatible(q->unqualifiedNameId(), declaration->name()))
|
if (! isCompatible(q->unqualifiedNameId(), declaration->name()))
|
||||||
return false;
|
return false;
|
||||||
else if (q->nameCount() > declarationName->nameCount())
|
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) {
|
for (unsigned i = 0; i != q->nameCount(); ++i) {
|
||||||
Name *n = q->nameAt(q->nameCount() - i - 1);
|
const Name *n = q->nameAt(q->nameCount() - i - 1);
|
||||||
Name *m = declarationName->nameAt(declarationName->nameCount() - i - 1);
|
const Name *m = declarationName->nameAt(declarationName->nameCount() - i - 1);
|
||||||
if (! isCompatible(n, m))
|
if (! isCompatible(n, m))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1085,7 +1106,7 @@ void CPPEditor::switchDeclarationDefinition()
|
|||||||
QList<LookupItem> resolvedSymbols = typeOfExpression(QString(), doc, lastSymbol);
|
QList<LookupItem> resolvedSymbols = typeOfExpression(QString(), doc, lastSymbol);
|
||||||
const LookupContext &context = typeOfExpression.lookupContext();
|
const LookupContext &context = typeOfExpression.lookupContext();
|
||||||
|
|
||||||
QualifiedNameId *q = qualifiedNameIdForSymbol(f, context);
|
const QualifiedNameId *q = qualifiedNameIdForSymbol(f, context);
|
||||||
QList<Symbol *> symbols = context.resolve(q);
|
QList<Symbol *> symbols = context.resolve(q);
|
||||||
|
|
||||||
Symbol *declaration = 0;
|
Symbol *declaration = 0;
|
||||||
@@ -1258,11 +1279,11 @@ Symbol *CPPEditor::findDefinition(Symbol *symbol)
|
|||||||
if (! funTy)
|
if (! funTy)
|
||||||
return 0; // symbol does not have function type.
|
return 0; // symbol does not have function type.
|
||||||
|
|
||||||
Name *name = symbol->name();
|
const Name *name = symbol->name();
|
||||||
if (! name)
|
if (! name)
|
||||||
return 0; // skip anonymous functions!
|
return 0; // skip anonymous functions!
|
||||||
|
|
||||||
if (QualifiedNameId *q = name->asQualifiedNameId())
|
if (const QualifiedNameId *q = name->asQualifiedNameId())
|
||||||
name = q->unqualifiedNameId();
|
name = q->unqualifiedNameId();
|
||||||
|
|
||||||
// map from file names to function definitions.
|
// map from file names to function definitions.
|
||||||
@@ -1681,9 +1702,9 @@ void CPPEditor::performQuickFix(int index)
|
|||||||
{
|
{
|
||||||
CPPQuickFixCollector *quickFixCollector = CppPlugin::instance()->quickFixCollector();
|
CPPQuickFixCollector *quickFixCollector = CppPlugin::instance()->quickFixCollector();
|
||||||
QuickFixOperationPtr op = m_quickFixes.at(index);
|
QuickFixOperationPtr op = m_quickFixes.at(index);
|
||||||
//quickFixCollector->perform(op);
|
quickFixCollector->perform(op);
|
||||||
op->createChangeSet();
|
//op->createChangeSet();
|
||||||
setChangeSet(op->changeSet());
|
//setChangeSet(op->changeSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPPEditor::contextMenuEvent(QContextMenuEvent *e)
|
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_occurrencesFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES));
|
||||||
m_occurrencesUnusedFormat = fs.toTextCharFormat(QLatin1String(TextEditor::Constants::C_OCCURRENCES_UNUSED));
|
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));
|
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
|
// 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;
|
int line = 0, column = 0;
|
||||||
convertPosition(position(), &line, &column);
|
convertPosition(position(), &line, &column);
|
||||||
|
|
||||||
QList<QTextEdit::ExtraSelection> allSelections;
|
QList<QTextEdit::ExtraSelection> unusedSelections;
|
||||||
|
|
||||||
m_renameSelections.clear();
|
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
|
// it's an unused declaration
|
||||||
// highlightUses(uses, &allSelections);
|
highlightUses(uses, semanticInfo, &unusedSelections);
|
||||||
} else if (good) {
|
|
||||||
QList<QTextEdit::ExtraSelection> selections;
|
else if (good && m_renameSelections.isEmpty())
|
||||||
highlightUses(uses, &selections);
|
highlightUses(uses, semanticInfo, &m_renameSelections);
|
||||||
m_renameSelections += selections;
|
|
||||||
allSelections += selections;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setExtraSelections(CodeSemanticsSelection, allSelections);
|
setExtraSelections(UnusedSymbolSelection, unusedSelections);
|
||||||
|
setExtraSelections(CodeSemanticsSelection, m_renameSelections);
|
||||||
}
|
}
|
||||||
|
|
||||||
SemanticHighlighter::Source CPPEditor::currentSource(bool force)
|
SemanticHighlighter::Source CPPEditor::currentSource(bool force)
|
||||||
@@ -2078,7 +2101,7 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
|
|||||||
FunctionDefinitionUnderCursor functionDefinitionUnderCursor(translationUnit);
|
FunctionDefinitionUnderCursor functionDefinitionUnderCursor(translationUnit);
|
||||||
FunctionDefinitionAST *currentFunctionDefinition = functionDefinitionUnderCursor(ast, source.line, source.column);
|
FunctionDefinitionAST *currentFunctionDefinition = functionDefinitionUnderCursor(ast, source.line, source.column);
|
||||||
|
|
||||||
FindUses useTable(translationUnit);
|
FindLocalUses useTable(translationUnit);
|
||||||
useTable(currentFunctionDefinition);
|
useTable(currentFunctionDefinition);
|
||||||
|
|
||||||
SemanticInfo semanticInfo;
|
SemanticInfo semanticInfo;
|
||||||
@@ -2086,6 +2109,8 @@ SemanticInfo SemanticHighlighter::semanticInfo(const Source &source)
|
|||||||
semanticInfo.snapshot = snapshot;
|
semanticInfo.snapshot = snapshot;
|
||||||
semanticInfo.doc = doc;
|
semanticInfo.doc = doc;
|
||||||
semanticInfo.localUses = useTable.localUses;
|
semanticInfo.localUses = useTable.localUses;
|
||||||
|
semanticInfo.hasQ = useTable.hasQ;
|
||||||
|
semanticInfo.hasD = useTable.hasD;
|
||||||
|
|
||||||
return semanticInfo;
|
return semanticInfo;
|
||||||
}
|
}
|
||||||
|
@@ -79,10 +79,12 @@ public:
|
|||||||
typedef QHashIterator<CPlusPlus::Symbol *, QList<Use> > LocalUseIterator;
|
typedef QHashIterator<CPlusPlus::Symbol *, QList<Use> > LocalUseIterator;
|
||||||
|
|
||||||
SemanticInfo()
|
SemanticInfo()
|
||||||
: revision(-1)
|
: revision(-1), hasQ(false), hasD(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
int revision;
|
int revision;
|
||||||
|
bool hasQ: 1;
|
||||||
|
bool hasD: 1;
|
||||||
CPlusPlus::Snapshot snapshot;
|
CPlusPlus::Snapshot snapshot;
|
||||||
CPlusPlus::Document::Ptr doc;
|
CPlusPlus::Document::Ptr doc;
|
||||||
LocalUseMap localUses;
|
LocalUseMap localUses;
|
||||||
@@ -253,6 +255,7 @@ private:
|
|||||||
SemanticHighlighter::Source currentSource(bool force = false);
|
SemanticHighlighter::Source currentSource(bool force = false);
|
||||||
|
|
||||||
void highlightUses(const QList<SemanticInfo::Use> &uses,
|
void highlightUses(const QList<SemanticInfo::Use> &uses,
|
||||||
|
const SemanticInfo &semanticInfo,
|
||||||
QList<QTextEdit::ExtraSelection> *selections);
|
QList<QTextEdit::ExtraSelection> *selections);
|
||||||
|
|
||||||
void createToolBar(CPPEditorEditable *editable);
|
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;
|
Scope *scope = 0;
|
||||||
|
|
||||||
@@ -161,13 +161,13 @@ static QString buildHelpId(Symbol *symbol, Name *name)
|
|||||||
Symbol *owner = scope->owner();
|
Symbol *owner = scope->owner();
|
||||||
|
|
||||||
if (owner && owner->name() && ! scope->isEnumScope()) {
|
if (owner && owner->name() && ! scope->isEnumScope()) {
|
||||||
Name *name = owner->name();
|
const Name *name = owner->name();
|
||||||
Identifier *id = 0;
|
const Identifier *id = 0;
|
||||||
|
|
||||||
if (NameId *nameId = name->asNameId())
|
if (const NameId *nameId = name->asNameId())
|
||||||
id = nameId->identifier();
|
id = nameId->identifier();
|
||||||
|
|
||||||
else if (TemplateNameId *nameId = name->asTemplateNameId())
|
else if (const TemplateNameId *nameId = name->asTemplateNameId())
|
||||||
id = nameId->identifier();
|
id = nameId->identifier();
|
||||||
|
|
||||||
if (id)
|
if (id)
|
||||||
@@ -182,7 +182,7 @@ static QString buildHelpId(Symbol *symbol, Name *name)
|
|||||||
static FullySpecifiedType resolve(const FullySpecifiedType &ty,
|
static FullySpecifiedType resolve(const FullySpecifiedType &ty,
|
||||||
const LookupContext &context,
|
const LookupContext &context,
|
||||||
Symbol **resolvedSymbol,
|
Symbol **resolvedSymbol,
|
||||||
Name **resolvedName)
|
const Name **resolvedName)
|
||||||
{
|
{
|
||||||
Control *control = context.control();
|
Control *control = context.control();
|
||||||
|
|
||||||
@@ -272,8 +272,10 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
|||||||
if (!doc)
|
if (!doc)
|
||||||
return; // nothing to do
|
return; // nothing to do
|
||||||
|
|
||||||
|
QString formatTooltip = edit->extraSelectionTooltip(pos);
|
||||||
QTextCursor tc(edit->document());
|
QTextCursor tc(edit->document());
|
||||||
tc.setPosition(pos);
|
tc.setPosition(pos);
|
||||||
|
|
||||||
const unsigned lineNumber = tc.block().blockNumber() + 1;
|
const unsigned lineNumber = tc.block().blockNumber() + 1;
|
||||||
|
|
||||||
// Find the last symbol up to the cursor position
|
// 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 *lookupSymbol = result.lastVisibleSymbol(); // lookup symbol
|
||||||
|
|
||||||
Symbol *resolvedSymbol = lookupSymbol;
|
Symbol *resolvedSymbol = lookupSymbol;
|
||||||
Name *resolvedName = lookupSymbol ? lookupSymbol->name() : 0;
|
const Name *resolvedName = lookupSymbol ? lookupSymbol->name() : 0;
|
||||||
firstType = resolve(firstType, typeOfExpression.lookupContext(),
|
firstType = resolve(firstType, typeOfExpression.lookupContext(),
|
||||||
&resolvedSymbol, &resolvedName);
|
&resolvedSymbol, &resolvedName);
|
||||||
|
|
||||||
if (resolvedSymbol && resolvedSymbol->scope()
|
if (resolvedSymbol && resolvedSymbol->scope()
|
||||||
&& resolvedSymbol->scope()->isClassScope()) {
|
&& resolvedSymbol->scope()->isClassScope()) {
|
||||||
Class *enclosingClass = resolvedSymbol->scope()->owner()->asClass();
|
Class *enclosingClass = resolvedSymbol->scope()->owner()->asClass();
|
||||||
if (Identifier *id = enclosingClass->identifier()) {
|
if (const Identifier *id = enclosingClass->identifier()) {
|
||||||
if (id->isEqualTo(resolvedSymbol->identifier()))
|
if (id->isEqualTo(resolvedSymbol->identifier()))
|
||||||
resolvedSymbol = enclosingClass;
|
resolvedSymbol = enclosingClass;
|
||||||
}
|
}
|
||||||
@@ -392,6 +394,11 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
|||||||
m_helpEngineNeedsSetup = false;
|
m_helpEngineNeedsSetup = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!formatTooltip.isEmpty()) {
|
||||||
|
m_toolTip = formatTooltip;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_toolTip.isEmpty())
|
if (!m_toolTip.isEmpty())
|
||||||
m_toolTip = Qt::escape(m_toolTip);
|
m_toolTip = Qt::escape(m_toolTip);
|
||||||
|
|
||||||
|
@@ -192,7 +192,7 @@ protected:
|
|||||||
return previousItem;
|
return previousItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditor::CompletionItem newCompletionItem(Name *name)
|
TextEditor::CompletionItem newCompletionItem(const Name *name)
|
||||||
{
|
{
|
||||||
TextEditor::CompletionItem item(_collector);
|
TextEditor::CompletionItem item(_collector);
|
||||||
item.text = overview.prettyName(name);
|
item.text = overview.prettyName(name);
|
||||||
@@ -200,25 +200,25 @@ protected:
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(NameId *name)
|
virtual void visit(const NameId *name)
|
||||||
{ _item = newCompletionItem(name); }
|
{ _item = newCompletionItem(name); }
|
||||||
|
|
||||||
virtual void visit(TemplateNameId *name)
|
virtual void visit(const TemplateNameId *name)
|
||||||
{
|
{
|
||||||
_item = newCompletionItem(name);
|
_item = newCompletionItem(name);
|
||||||
_item.text = QLatin1String(name->identifier()->chars());
|
_item.text = QLatin1String(name->identifier()->chars());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(DestructorNameId *name)
|
virtual void visit(const DestructorNameId *name)
|
||||||
{ _item = newCompletionItem(name); }
|
{ _item = newCompletionItem(name); }
|
||||||
|
|
||||||
virtual void visit(OperatorNameId *name)
|
virtual void visit(const OperatorNameId *name)
|
||||||
{ _item = newCompletionItem(name); }
|
{ _item = newCompletionItem(name); }
|
||||||
|
|
||||||
virtual void visit(ConversionNameId *name)
|
virtual void visit(const ConversionNameId *name)
|
||||||
{ _item = newCompletionItem(name); }
|
{ _item = newCompletionItem(name); }
|
||||||
|
|
||||||
virtual void visit(QualifiedNameId *name)
|
virtual void visit(const QualifiedNameId *name)
|
||||||
{ _item = newCompletionItem(name->unqualifiedNameId()); }
|
{ _item = newCompletionItem(name->unqualifiedNameId()); }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -890,13 +890,13 @@ bool CppCodeCompletion::completeConstructorOrFunction(const QList<LookupItem> &r
|
|||||||
FullySpecifiedType exprTy = result.type().simplified();
|
FullySpecifiedType exprTy = result.type().simplified();
|
||||||
|
|
||||||
if (Class *klass = exprTy->asClassType()) {
|
if (Class *klass = exprTy->asClassType()) {
|
||||||
Name *className = klass->name();
|
const Name *className = klass->name();
|
||||||
if (! className)
|
if (! className)
|
||||||
continue; // nothing to do for anonymoous classes.
|
continue; // nothing to do for anonymoous classes.
|
||||||
|
|
||||||
for (unsigned i = 0; i < klass->memberCount(); ++i) {
|
for (unsigned i = 0; i < klass->memberCount(); ++i) {
|
||||||
Symbol *member = klass->memberAt(i);
|
Symbol *member = klass->memberAt(i);
|
||||||
Name *memberName = member->name();
|
const Name *memberName = member->name();
|
||||||
|
|
||||||
if (! memberName)
|
if (! memberName)
|
||||||
continue; // skip anonymous member.
|
continue; // skip anonymous member.
|
||||||
@@ -945,7 +945,7 @@ bool CppCodeCompletion::completeConstructorOrFunction(const QList<LookupItem> &r
|
|||||||
if (functions.isEmpty()) {
|
if (functions.isEmpty()) {
|
||||||
ResolveExpression resolveExpression(context);
|
ResolveExpression resolveExpression(context);
|
||||||
ResolveClass resolveClass;
|
ResolveClass resolveClass;
|
||||||
Name *functionCallOp = context.control()->operatorNameId(OperatorNameId::FunctionCallOp);
|
const Name *functionCallOp = context.control()->operatorNameId(OperatorNameId::FunctionCallOp);
|
||||||
|
|
||||||
foreach (const LookupItem &result, results) {
|
foreach (const LookupItem &result, results) {
|
||||||
FullySpecifiedType ty = result.type().simplified();
|
FullySpecifiedType ty = result.type().simplified();
|
||||||
@@ -1092,7 +1092,7 @@ bool CppCodeCompletion::completeMember(const QList<LookupItem> &baseResults,
|
|||||||
classObjectCandidates.append(klass);
|
classObjectCandidates.append(klass);
|
||||||
|
|
||||||
else if (NamedType *namedTy = ty->asNamedType()) {
|
else if (NamedType *namedTy = ty->asNamedType()) {
|
||||||
Name *className = namedTy->name();
|
const Name *className = namedTy->name();
|
||||||
const QList<Symbol *> classes = resolveClass(className, r, context);
|
const QList<Symbol *> classes = resolveClass(className, r, context);
|
||||||
|
|
||||||
foreach (Symbol *c, classes) {
|
foreach (Symbol *c, classes) {
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
** 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
|
** 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,
|
Document::Ptr doc,
|
||||||
const Snapshot& snapshot) const
|
const Snapshot& snapshot) const
|
||||||
{
|
{
|
||||||
Identifier *id = 0;
|
const Identifier *id = 0;
|
||||||
if (Identifier *symbolId = symbol->identifier())
|
if (const Identifier *symbolId = symbol->identifier())
|
||||||
id = doc->control()->findIdentifier(symbolId->chars(), symbolId->size());
|
id = doc->control()->findIdentifier(symbolId->chars(), symbolId->size());
|
||||||
|
|
||||||
QList<int> references;
|
QList<int> references;
|
||||||
@@ -106,7 +106,7 @@ static void find_helper(QFutureInterface<Usage> &future,
|
|||||||
QTime tm;
|
QTime tm;
|
||||||
tm.start();
|
tm.start();
|
||||||
|
|
||||||
Identifier *symbolId = symbol->identifier();
|
const Identifier *symbolId = symbol->identifier();
|
||||||
Q_ASSERT(symbolId != 0);
|
Q_ASSERT(symbolId != 0);
|
||||||
|
|
||||||
const QString sourceFile = QString::fromUtf8(symbol->fileName(), symbol->fileNameLength());
|
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)) {
|
if (Document::Ptr previousDoc = snapshot.value(fileName)) {
|
||||||
Control *control = previousDoc->control();
|
Control *control = previousDoc->control();
|
||||||
Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size());
|
const Identifier *id = control->findIdentifier(symbolId->chars(), symbolId->size());
|
||||||
if (! id)
|
if (! id)
|
||||||
continue; // skip this document, it's not using symbolId.
|
continue; // skip this document, it's not using symbolId.
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ static void find_helper(QFutureInterface<Usage> &future,
|
|||||||
doc->tokenize();
|
doc->tokenize();
|
||||||
|
|
||||||
Control *control = doc->control();
|
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;
|
QTime tm;
|
||||||
tm.start();
|
tm.start();
|
||||||
doc->parse();
|
doc->parse();
|
||||||
@@ -202,7 +202,7 @@ void CppFindReferences::findUsages(Symbol *symbol)
|
|||||||
|
|
||||||
void CppFindReferences::renameUsages(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());
|
const QString textToReplace = QString::fromUtf8(id->chars(), id->size());
|
||||||
|
|
||||||
Find::SearchResult *search = _resultWindow->startNewSearch(Find::SearchResultWindow::SearchAndReplace);
|
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.
|
** 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
|
** 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;
|
return false;
|
||||||
|
|
||||||
QString extraScope;
|
QString extraScope;
|
||||||
if (Name *name = symbol->name()) {
|
if (const Name *name = symbol->name()) {
|
||||||
if (QualifiedNameId *nameId = name->asQualifiedNameId()) {
|
if (const QualifiedNameId *nameId = name->asQualifiedNameId()) {
|
||||||
if (nameId->nameCount() > 1) {
|
if (nameId->nameCount() > 1) {
|
||||||
extraScope = overview.prettyName(nameId->nameAt(nameId->nameCount() - 2));
|
extraScope = overview.prettyName(nameId->nameAt(nameId->nameCount() - 2));
|
||||||
}
|
}
|
||||||
|
@@ -1588,6 +1588,8 @@ QList<Symbol> CdbDebugEngine::moduleSymbols(const QString &moduleName)
|
|||||||
|
|
||||||
void CdbDebugEngine::reloadRegisters()
|
void CdbDebugEngine::reloadRegisters()
|
||||||
{
|
{
|
||||||
|
if (state() != InferiorStopped)
|
||||||
|
return;
|
||||||
const int intBase = 10;
|
const int intBase = 10;
|
||||||
if (debugCDB)
|
if (debugCDB)
|
||||||
qDebug() << Q_FUNC_INFO << intBase;
|
qDebug() << Q_FUNC_INFO << intBase;
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#include <projectexplorer/environment.h>
|
#include <projectexplorer/environment.h>
|
||||||
#include <projectexplorer/project.h>
|
#include <projectexplorer/project.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
@@ -131,7 +132,7 @@ DebuggerRunControl::DebuggerRunControl(DebuggerManager *manager,
|
|||||||
}
|
}
|
||||||
if (const ProjectExplorer::Project *project = runConfiguration->project()) {
|
if (const ProjectExplorer::Project *project = runConfiguration->project()) {
|
||||||
m_startParameters->buildDir =
|
m_startParameters->buildDir =
|
||||||
project->buildDirectory(project->activeBuildConfiguration());
|
project->activeBuildConfiguration()->buildDirectory();
|
||||||
}
|
}
|
||||||
m_startParameters->useTerminal =
|
m_startParameters->useTerminal =
|
||||||
runConfiguration->runMode() == LocalApplicationRunConfiguration::Console;
|
runConfiguration->runMode() == LocalApplicationRunConfiguration::Console;
|
||||||
|
@@ -155,9 +155,8 @@ static bool parseConsoleStream(const GdbResponse &response, GdbMi *contents)
|
|||||||
out = out.left(out.lastIndexOf('"'));
|
out = out.left(out.lastIndexOf('"'));
|
||||||
// optimization: dumper output never needs real C unquoting
|
// optimization: dumper output never needs real C unquoting
|
||||||
out.replace('\\', "");
|
out.replace('\\', "");
|
||||||
out = "dummy={" + out + "}";
|
|
||||||
|
|
||||||
contents->fromString(out);
|
contents->fromStringMultiple(out);
|
||||||
//qDebug() << "CONTENTS" << contents->toString(true);
|
//qDebug() << "CONTENTS" << contents->toString(true);
|
||||||
return contents->isValid();
|
return contents->isValid();
|
||||||
}
|
}
|
||||||
@@ -2569,6 +2568,8 @@ void GdbEngine::handleStackListThreads(const GdbResponse &response)
|
|||||||
|
|
||||||
void GdbEngine::reloadRegisters()
|
void GdbEngine::reloadRegisters()
|
||||||
{
|
{
|
||||||
|
if (state() != InferiorStopped)
|
||||||
|
return;
|
||||||
if (!m_registerNamesListed) {
|
if (!m_registerNamesListed) {
|
||||||
postCommand(_("-data-list-register-names"), CB(handleRegisterListNames));
|
postCommand(_("-data-list-register-names"), CB(handleRegisterListNames));
|
||||||
m_registerNamesListed = true;
|
m_registerNamesListed = true;
|
||||||
@@ -3584,8 +3585,8 @@ void GdbEngine::handleStackFrame(const GdbResponse &response)
|
|||||||
<< out.left(pos);
|
<< out.left(pos);
|
||||||
out = out.mid(pos);
|
out = out.mid(pos);
|
||||||
}
|
}
|
||||||
GdbMi all("[" + out + "]");
|
GdbMi all;
|
||||||
//GdbMi all(out);
|
all.fromStringMultiple(out);
|
||||||
|
|
||||||
//qDebug() << "\n\n\nALL: " << all.toString() << "\n";
|
//qDebug() << "\n\n\nALL: " << all.toString() << "\n";
|
||||||
GdbMi locals = all.findChild("locals");
|
GdbMi locals = all.findChild("locals");
|
||||||
|
@@ -348,6 +348,13 @@ void GdbMi::fromString(const QByteArray &ba)
|
|||||||
parseResultOrValue(from, to);
|
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
|
GdbMi GdbMi::findChild(const char *name) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_children.size(); ++i)
|
for (int i = 0; i < m_children.size(); ++i)
|
||||||
|
@@ -91,7 +91,6 @@ class GdbMi
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GdbMi() : m_type(Invalid) {}
|
GdbMi() : m_type(Invalid) {}
|
||||||
explicit GdbMi(const QByteArray &str) { fromString(str); }
|
|
||||||
|
|
||||||
QByteArray m_name;
|
QByteArray m_name;
|
||||||
QByteArray m_data;
|
QByteArray m_data;
|
||||||
@@ -126,6 +125,7 @@ public:
|
|||||||
|
|
||||||
QByteArray toString(bool multiline = false, int indent = 0) const;
|
QByteArray toString(bool multiline = false, int indent = 0) const;
|
||||||
void fromString(const QByteArray &str);
|
void fromString(const QByteArray &str);
|
||||||
|
void fromStringMultiple(const QByteArray &str);
|
||||||
void setStreamOutput(const QByteArray &name, const QByteArray &content);
|
void setStreamOutput(const QByteArray &name, const QByteArray &content);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -975,11 +975,8 @@ bool QtDumperHelper::parseQuery(const GdbMi &contents, Debugger debugger)
|
|||||||
// parse a query
|
// parse a query
|
||||||
bool QtDumperHelper::parseQuery(const char *data, Debugger debugger)
|
bool QtDumperHelper::parseQuery(const char *data, Debugger debugger)
|
||||||
{
|
{
|
||||||
QByteArray fullData = data;
|
GdbMi root;
|
||||||
fullData.insert(0, '{');
|
root.fromStringMultiple(QByteArray(data));
|
||||||
fullData.append(data);
|
|
||||||
fullData.append('}');
|
|
||||||
GdbMi root(fullData);
|
|
||||||
if (!root.isValid())
|
if (!root.isValid())
|
||||||
return false;
|
return false;
|
||||||
return parseQuery(root, debugger);
|
return parseQuery(root, debugger);
|
||||||
@@ -1475,11 +1472,8 @@ bool QtDumperHelper::parseValue(const char *data,
|
|||||||
QList<WatchData> *l)
|
QList<WatchData> *l)
|
||||||
{
|
{
|
||||||
l->clear();
|
l->clear();
|
||||||
QByteArray fullData = data;
|
GdbMi root;
|
||||||
fullData.insert(0, '{');
|
root.fromStringMultiple(QByteArray(data));
|
||||||
fullData.append(data);
|
|
||||||
fullData.append('}');
|
|
||||||
GdbMi root(fullData);
|
|
||||||
if (!root.isValid())
|
if (!root.isValid())
|
||||||
return false;
|
return false;
|
||||||
gbdMiToWatchData(root, GdbMiRecursionContext(), l);
|
gbdMiToWatchData(root, GdbMiRecursionContext(), l);
|
||||||
|
@@ -251,8 +251,8 @@ static bool isCompatible(const Function *definition, const Symbol *declaration,
|
|||||||
if (! declTy)
|
if (! declTy)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Name *definitionName = definition->name();
|
const Name *definitionName = definition->name();
|
||||||
if (QualifiedNameId *q = definitionName->asQualifiedNameId()) {
|
if (const QualifiedNameId *q = definitionName->asQualifiedNameId()) {
|
||||||
if (! isCompatible(q->unqualifiedNameId(), declaration->name()))
|
if (! isCompatible(q->unqualifiedNameId(), declaration->name()))
|
||||||
return false;
|
return false;
|
||||||
else if (q->nameCount() > declarationName->nameCount())
|
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) {
|
for (unsigned i = 0; i != q->nameCount(); ++i) {
|
||||||
Name *n = q->nameAt(q->nameCount() - i - 1);
|
const Name *n = q->nameAt(q->nameCount() - i - 1);
|
||||||
Name *m = declarationName->nameAt(declarationName->nameCount() - i - 1);
|
const Name *m = declarationName->nameAt(declarationName->nameCount() - i - 1);
|
||||||
if (! isCompatible(n, m))
|
if (! isCompatible(n, m))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -291,13 +291,13 @@ static Document::Ptr findDefinition(const Function *functionDeclaration, int *li
|
|||||||
if (!cppModelManager)
|
if (!cppModelManager)
|
||||||
return Document::Ptr();
|
return Document::Ptr();
|
||||||
|
|
||||||
QVector<Name *> qualifiedName;
|
QVector<const Name *> qualifiedName;
|
||||||
Scope *scope = functionDeclaration->scope();
|
Scope *scope = functionDeclaration->scope();
|
||||||
for (; scope; scope = scope->enclosingScope()) {
|
for (; scope; scope = scope->enclosingScope()) {
|
||||||
if (scope->isClassScope() || scope->isNamespaceScope()) {
|
if (scope->isClassScope() || scope->isNamespaceScope()) {
|
||||||
if (scope->owner() && scope->owner()->name()) {
|
if (scope->owner() && scope->owner()->name()) {
|
||||||
Name *scopeOwnerName = scope->owner()->name();
|
const Name *scopeOwnerName = scope->owner()->name();
|
||||||
if (QualifiedNameId *q = scopeOwnerName->asQualifiedNameId()) {
|
if (const QualifiedNameId *q = scopeOwnerName->asQualifiedNameId()) {
|
||||||
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
for (unsigned i = 0; i < q->nameCount(); ++i) {
|
||||||
qualifiedName.prepend(q->nameAt(i));
|
qualifiedName.prepend(q->nameAt(i));
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ static Document::Ptr findDefinition(const Function *functionDeclaration, int *li
|
|||||||
qualifiedName.append(functionDeclaration->name());
|
qualifiedName.append(functionDeclaration->name());
|
||||||
|
|
||||||
Control control;
|
Control control;
|
||||||
QualifiedNameId *q = control.qualifiedNameId(&qualifiedName[0], qualifiedName.size());
|
const QualifiedNameId *q = control.qualifiedNameId(&qualifiedName[0], qualifiedName.size());
|
||||||
LookupContext context(&control);
|
LookupContext context(&control);
|
||||||
const Snapshot documents = cppModelManager->snapshot();
|
const Snapshot documents = cppModelManager->snapshot();
|
||||||
foreach (Document::Ptr doc, documents) {
|
foreach (Document::Ptr doc, documents) {
|
||||||
@@ -321,13 +321,13 @@ static Document::Ptr findDefinition(const Function *functionDeclaration, int *li
|
|||||||
visibleScopes = context.expand(visibleScopes);
|
visibleScopes = context.expand(visibleScopes);
|
||||||
foreach (Scope *visibleScope, visibleScopes) {
|
foreach (Scope *visibleScope, visibleScopes) {
|
||||||
Symbol *symbol = 0;
|
Symbol *symbol = 0;
|
||||||
if (NameId *nameId = q->unqualifiedNameId()->asNameId())
|
if (const NameId *nameId = q->unqualifiedNameId()->asNameId())
|
||||||
symbol = visibleScope->lookat(nameId->identifier());
|
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());
|
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());
|
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());
|
symbol = visibleScope->lookat(opId->kind());
|
||||||
// ### cast operators
|
// ### cast operators
|
||||||
for (; symbol; symbol = symbol->next()) {
|
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
|
#ifndef GENERICBUILDCONFIGURATION_H
|
||||||
#define EMBEDDEDPROPERTIESPAGE_H
|
#define GENERICBUILDCONFIGURATION_H
|
||||||
|
|
||||||
#include "ui_embeddedpropertiespage.h"
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
|
|
||||||
#include <projectexplorer/iprojectproperties.h>
|
|
||||||
|
|
||||||
#include <QtCore/QModelIndex>
|
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
|
||||||
class Project;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
|
||||||
|
|
||||||
|
namespace GenericProjectManager {
|
||||||
namespace Internal {
|
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
|
class GenericBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||||
{
|
|
||||||
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
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
EmbeddedPropertiesWidget(ProjectExplorer::Project *project);
|
GenericBuildConfiguration(GenericProject *pro);
|
||||||
virtual ~EmbeddedPropertiesWidget();
|
GenericBuildConfiguration(GenericBuildConfiguration *source);
|
||||||
private:
|
|
||||||
Ui_EmbeddedPropertiesPage m_ui;
|
GenericProject *genericProject() const;
|
||||||
ProjectExplorer::Project *m_pro;
|
|
||||||
|
virtual ProjectExplorer::Environment environment() const;
|
||||||
|
virtual QString buildDirectory() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace GenericProjectManager
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Qt4ProjectManager
|
#endif // GENERICBUILDCONFIGURATION_H
|
||||||
|
|
||||||
#endif // EMBEDDEDPROPERTIESPAGE_H
|
|
@@ -31,6 +31,7 @@
|
|||||||
#include "genericprojectconstants.h"
|
#include "genericprojectconstants.h"
|
||||||
#include "genericproject.h"
|
#include "genericproject.h"
|
||||||
#include "ui_genericmakestep.h"
|
#include "ui_genericmakestep.h"
|
||||||
|
#include "genericbuildconfiguration.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
@@ -47,13 +48,13 @@
|
|||||||
using namespace GenericProjectManager;
|
using namespace GenericProjectManager;
|
||||||
using namespace GenericProjectManager::Internal;
|
using namespace GenericProjectManager::Internal;
|
||||||
|
|
||||||
GenericMakeStep::GenericMakeStep(GenericProject *pro, ProjectExplorer::BuildConfiguration *bc)
|
GenericMakeStep::GenericMakeStep(ProjectExplorer::BuildConfiguration *bc)
|
||||||
: AbstractMakeStep(pro, bc), m_pro(pro)
|
: AbstractMakeStep(bc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericMakeStep::GenericMakeStep(GenericMakeStep *bs, ProjectExplorer::BuildConfiguration *bc)
|
GenericMakeStep::GenericMakeStep(GenericMakeStep *bs, ProjectExplorer::BuildConfiguration *bc)
|
||||||
: AbstractMakeStep(bs, bc), m_pro(bs->project())
|
: AbstractMakeStep(bs, bc)
|
||||||
{
|
{
|
||||||
m_buildTargets = bs->m_buildTargets;
|
m_buildTargets = bs->m_buildTargets;
|
||||||
m_makeArguments = bs->m_makeArguments;
|
m_makeArguments = bs->m_makeArguments;
|
||||||
@@ -64,23 +65,28 @@ GenericMakeStep::~GenericMakeStep()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GenericBuildConfiguration *GenericMakeStep::genericBuildConfiguration() const
|
||||||
|
{
|
||||||
|
return static_cast<GenericBuildConfiguration *>(buildConfiguration());
|
||||||
|
}
|
||||||
|
|
||||||
bool GenericMakeStep::init()
|
bool GenericMakeStep::init()
|
||||||
{
|
{
|
||||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
GenericBuildConfiguration *bc = genericBuildConfiguration();
|
||||||
const QString buildParser = m_pro->buildParser(bc);
|
//TODO
|
||||||
|
const QString buildParser = genericBuildConfiguration()->genericProject()->buildParser(bc);
|
||||||
setBuildParser(buildParser);
|
setBuildParser(buildParser);
|
||||||
qDebug() << "*** build parser:" << buildParser;
|
|
||||||
|
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
Core::VariableManager *vm = Core::VariableManager::instance();
|
Core::VariableManager *vm = Core::VariableManager::instance();
|
||||||
const QString rawBuildDir = m_pro->buildDirectory(bc);
|
const QString rawBuildDir = bc->buildDirectory();
|
||||||
const QString buildDir = vm->resolve(rawBuildDir);
|
const QString buildDir = vm->resolve(rawBuildDir);
|
||||||
setWorkingDirectory(buildDir);
|
setWorkingDirectory(buildDir);
|
||||||
|
|
||||||
setCommand(makeCommand());
|
setCommand(makeCommand());
|
||||||
setArguments(replacedArguments());
|
setArguments(replacedArguments());
|
||||||
|
|
||||||
setEnvironment(m_pro->environment(bc));
|
setEnvironment(bc->environment());
|
||||||
return AbstractMakeStep::init();
|
return AbstractMakeStep::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,7 +125,8 @@ QString GenericMakeStep::makeCommand() const
|
|||||||
{
|
{
|
||||||
QString command = m_makeCommand;
|
QString command = m_makeCommand;
|
||||||
if (command.isEmpty()) {
|
if (command.isEmpty()) {
|
||||||
if (ProjectExplorer::ToolChain *toolChain = m_pro->toolChain())
|
GenericProject *pro = genericBuildConfiguration()->genericProject();
|
||||||
|
if (ProjectExplorer::ToolChain *toolChain = pro->toolChain())
|
||||||
command = toolChain->makeCommand();
|
command = toolChain->makeCommand();
|
||||||
else
|
else
|
||||||
command = QLatin1String("make");
|
command = QLatin1String("make");
|
||||||
@@ -152,11 +159,6 @@ bool GenericMakeStep::immutable() const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericProject *GenericMakeStep::project() const
|
|
||||||
{
|
|
||||||
return m_pro;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool GenericMakeStep::buildsTarget(const QString &target) const
|
bool GenericMakeStep::buildsTarget(const QString &target) const
|
||||||
{
|
{
|
||||||
return m_buildTargets.contains(target);
|
return m_buildTargets.contains(target);
|
||||||
@@ -184,7 +186,7 @@ GenericMakeStepConfigWidget::GenericMakeStepConfigWidget(GenericMakeStep *makeSt
|
|||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
|
|
||||||
// TODO update this list also on rescans of the GenericLists.txt
|
// 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()) {
|
foreach (const QString &target, pro->targets()) {
|
||||||
QListWidgetItem *item = new QListWidgetItem(target, m_ui->targetsList);
|
QListWidgetItem *item = new QListWidgetItem(target, m_ui->targetsList);
|
||||||
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
|
||||||
@@ -280,14 +282,11 @@ bool GenericMakeStepFactory::canCreate(const QString &name) const
|
|||||||
return (Constants::MAKESTEP == name);
|
return (Constants::MAKESTEP == name);
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *GenericMakeStepFactory::create(ProjectExplorer::Project *project,
|
ProjectExplorer::BuildStep *GenericMakeStepFactory::create(ProjectExplorer::BuildConfiguration *bc,
|
||||||
ProjectExplorer::BuildConfiguration *bc,
|
|
||||||
const QString &name) const
|
const QString &name) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(name == Constants::MAKESTEP);
|
Q_ASSERT(name == Constants::MAKESTEP);
|
||||||
GenericProject *pro = qobject_cast<GenericProject *>(project);
|
return new GenericMakeStep(bc);
|
||||||
Q_ASSERT(pro);
|
|
||||||
return new GenericMakeStep(pro, bc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ProjectExplorer::BuildStep *GenericMakeStepFactory::clone(ProjectExplorer::BuildStep *bs,
|
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);
|
return new GenericMakeStep(static_cast<GenericMakeStep*>(bs), bc);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList GenericMakeStepFactory::canCreateForProject(ProjectExplorer::Project * /* pro */) const
|
QStringList GenericMakeStepFactory::canCreateForBuildConfiguration(ProjectExplorer::BuildConfiguration * /* pro */) const
|
||||||
{
|
{
|
||||||
return QStringList();
|
return QStringList();
|
||||||
}
|
}
|
||||||
|
@@ -43,7 +43,7 @@ QT_END_NAMESPACE
|
|||||||
namespace GenericProjectManager {
|
namespace GenericProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class GenericProject;
|
class GenericBuildConfiguration;
|
||||||
class GenericMakeStepConfigWidget;
|
class GenericMakeStepConfigWidget;
|
||||||
|
|
||||||
struct GenericMakeStepSettings
|
struct GenericMakeStepSettings
|
||||||
@@ -56,9 +56,11 @@ class GenericMakeStep : public ProjectExplorer::AbstractMakeStep
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class GenericMakeStepConfigWidget; // TODO remove again?
|
friend class GenericMakeStepConfigWidget; // TODO remove again?
|
||||||
public:
|
public:
|
||||||
GenericMakeStep(GenericProject *pro, ProjectExplorer::BuildConfiguration *bc);
|
GenericMakeStep(ProjectExplorer::BuildConfiguration *bc);
|
||||||
GenericMakeStep(GenericMakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
GenericMakeStep(GenericMakeStep *bs, ProjectExplorer::BuildConfiguration *bc);
|
||||||
~GenericMakeStep();
|
~GenericMakeStep();
|
||||||
|
GenericBuildConfiguration *genericBuildConfiguration() const;
|
||||||
|
|
||||||
virtual bool init();
|
virtual bool init();
|
||||||
|
|
||||||
virtual void run(QFutureInterface<bool> &fi);
|
virtual void run(QFutureInterface<bool> &fi);
|
||||||
@@ -67,7 +69,6 @@ public:
|
|||||||
virtual QString displayName();
|
virtual QString displayName();
|
||||||
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
virtual ProjectExplorer::BuildStepConfigWidget *createConfigWidget();
|
||||||
virtual bool immutable() const;
|
virtual bool immutable() const;
|
||||||
GenericProject *project() const;
|
|
||||||
bool buildsTarget(const QString &target) const;
|
bool buildsTarget(const QString &target) const;
|
||||||
void setBuildTarget(const QString &target, bool on);
|
void setBuildTarget(const QString &target, bool on);
|
||||||
QStringList replacedArguments() const;
|
QStringList replacedArguments() const;
|
||||||
@@ -76,7 +77,6 @@ public:
|
|||||||
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
||||||
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
||||||
private:
|
private:
|
||||||
GenericProject *m_pro;
|
|
||||||
QStringList m_buildTargets;
|
QStringList m_buildTargets;
|
||||||
QStringList m_makeArguments;
|
QStringList m_makeArguments;
|
||||||
QString m_makeCommand;
|
QString m_makeCommand;
|
||||||
@@ -105,12 +105,11 @@ private:
|
|||||||
class GenericMakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
class GenericMakeStepFactory : public ProjectExplorer::IBuildStepFactory
|
||||||
{
|
{
|
||||||
virtual bool canCreate(const QString &name) const;
|
virtual bool canCreate(const QString &name) const;
|
||||||
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::Project *pro,
|
virtual ProjectExplorer::BuildStep *create(ProjectExplorer::BuildConfiguration *bc,
|
||||||
ProjectExplorer::BuildConfiguration *bc,
|
|
||||||
const QString &name) const;
|
const QString &name) const;
|
||||||
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs,
|
virtual ProjectExplorer::BuildStep *clone(ProjectExplorer::BuildStep *bs,
|
||||||
ProjectExplorer::BuildConfiguration *bc) const;
|
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;
|
virtual QString displayNameForName(const QString &name) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
#include "genericproject.h"
|
#include "genericproject.h"
|
||||||
#include "genericprojectconstants.h"
|
#include "genericprojectconstants.h"
|
||||||
#include "genericmakestep.h"
|
#include "genericmakestep.h"
|
||||||
|
#include "genericbuildconfiguration.h"
|
||||||
|
|
||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
@@ -131,7 +132,7 @@ QString GenericBuildConfigurationFactory::displayNameForType(const QString & /*
|
|||||||
return tr("Create");
|
return tr("Create");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GenericBuildConfigurationFactory::create(const QString &type) const
|
BuildConfiguration *GenericBuildConfigurationFactory::create(const QString &type) const
|
||||||
{
|
{
|
||||||
QTC_ASSERT(type == "Create", return false);
|
QTC_ASSERT(type == "Create", return false);
|
||||||
//TODO asking for name is duplicated everywhere, but maybe more
|
//TODO asking for name is duplicated everywhere, but maybe more
|
||||||
@@ -145,13 +146,26 @@ bool GenericBuildConfigurationFactory::create(const QString &type) const
|
|||||||
&ok);
|
&ok);
|
||||||
if (!ok || buildConfigurationName.isEmpty())
|
if (!ok || buildConfigurationName.isEmpty())
|
||||||
return false;
|
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...
|
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);
|
bc->insertBuildStep(0, makeStep);
|
||||||
makeStep->setBuildTarget("all", /* on = */ true);
|
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;
|
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()
|
ProjectExplorer::BuildConfigWidget *GenericProject::createConfigWidget()
|
||||||
{
|
{
|
||||||
return new GenericBuildSettingsWidget(this);
|
return new GenericBuildSettingsWidget(this);
|
||||||
@@ -518,10 +513,11 @@ bool GenericProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsRead
|
|||||||
Project::restoreSettingsImpl(reader);
|
Project::restoreSettingsImpl(reader);
|
||||||
|
|
||||||
if (buildConfigurations().isEmpty()) {
|
if (buildConfigurations().isEmpty()) {
|
||||||
ProjectExplorer::BuildConfiguration *bc = new BuildConfiguration("all");
|
GenericBuildConfiguration *bc = new GenericBuildConfiguration(this);
|
||||||
|
bc->setDisplayName("all");
|
||||||
addBuildConfiguration(bc);
|
addBuildConfiguration(bc);
|
||||||
|
|
||||||
GenericMakeStep *makeStep = new GenericMakeStep(this, bc);
|
GenericMakeStep *makeStep = new GenericMakeStep(bc);
|
||||||
bc->insertBuildStep(0, makeStep);
|
bc->insertBuildStep(0, makeStep);
|
||||||
|
|
||||||
makeStep->setBuildTarget("all", /* on = */ true);
|
makeStep->setBuildTarget("all", /* on = */ true);
|
||||||
@@ -574,7 +570,7 @@ void GenericProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter
|
|||||||
////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericProject *project)
|
GenericBuildSettingsWidget::GenericBuildSettingsWidget(GenericProject *project)
|
||||||
: m_project(project)
|
: m_project(project), m_buildConfiguration(0)
|
||||||
{
|
{
|
||||||
QFormLayout *fl = new QFormLayout(this);
|
QFormLayout *fl = new QFormLayout(this);
|
||||||
fl->setContentsMargins(0, -1, 0, -1);
|
fl->setContentsMargins(0, -1, 0, -1);
|
||||||
@@ -610,15 +606,15 @@ GenericBuildSettingsWidget::~GenericBuildSettingsWidget()
|
|||||||
QString GenericBuildSettingsWidget::displayName() const
|
QString GenericBuildSettingsWidget::displayName() const
|
||||||
{ return tr("Generic Manager"); }
|
{ return tr("Generic Manager"); }
|
||||||
|
|
||||||
void GenericBuildSettingsWidget::init(const QString &buildConfigurationName)
|
void GenericBuildSettingsWidget::init(BuildConfiguration *bc)
|
||||||
{
|
{
|
||||||
m_buildConfiguration = buildConfigurationName;
|
m_buildConfiguration = static_cast<GenericBuildConfiguration *>(bc);
|
||||||
m_pathChooser->setPath(m_project->buildDirectory(m_project->buildConfiguration(buildConfigurationName)));
|
m_pathChooser->setPath(m_buildConfiguration->buildDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericBuildSettingsWidget::buildDirectoryChanged()
|
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)
|
void GenericBuildSettingsWidget::toolChainSelected(int index)
|
||||||
|
@@ -54,6 +54,7 @@ namespace Internal {
|
|||||||
class GenericProject;
|
class GenericProject;
|
||||||
class GenericMakeStep;
|
class GenericMakeStep;
|
||||||
class GenericProjectFile;
|
class GenericProjectFile;
|
||||||
|
class GenericBuildConfiguration;
|
||||||
|
|
||||||
class GenericBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
class GenericBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory
|
||||||
{
|
{
|
||||||
@@ -66,7 +67,9 @@ public:
|
|||||||
QStringList availableCreationTypes() const;
|
QStringList availableCreationTypes() const;
|
||||||
QString displayNameForType(const QString &type) 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:
|
private:
|
||||||
GenericProject *m_project;
|
GenericProject *m_project;
|
||||||
@@ -93,9 +96,6 @@ public:
|
|||||||
|
|
||||||
virtual bool isApplication() const;
|
virtual bool isApplication() const;
|
||||||
|
|
||||||
virtual ProjectExplorer::Environment environment(ProjectExplorer::BuildConfiguration *configuration) const;
|
|
||||||
virtual QString buildDirectory(ProjectExplorer::BuildConfiguration *configuration) const;
|
|
||||||
|
|
||||||
virtual ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
virtual ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||||
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ public:
|
|||||||
|
|
||||||
virtual QString displayName() const;
|
virtual QString displayName() const;
|
||||||
|
|
||||||
virtual void init(const QString &buildConfiguration);
|
virtual void init(ProjectExplorer::BuildConfiguration *bc);
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void buildDirectoryChanged();
|
void buildDirectoryChanged();
|
||||||
@@ -202,7 +202,7 @@ private Q_SLOTS:
|
|||||||
private:
|
private:
|
||||||
GenericProject *m_project;
|
GenericProject *m_project;
|
||||||
Utils::PathChooser *m_pathChooser;
|
Utils::PathChooser *m_pathChooser;
|
||||||
QString m_buildConfiguration;
|
GenericBuildConfiguration *m_buildConfiguration;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -10,7 +10,8 @@ HEADERS = genericproject.h \
|
|||||||
genericprojectwizard.h \
|
genericprojectwizard.h \
|
||||||
genericprojectfileseditor.h \
|
genericprojectfileseditor.h \
|
||||||
pkgconfigtool.h \
|
pkgconfigtool.h \
|
||||||
genericmakestep.h
|
genericmakestep.h \
|
||||||
|
genericbuildconfiguration.h
|
||||||
SOURCES = genericproject.cpp \
|
SOURCES = genericproject.cpp \
|
||||||
genericprojectplugin.cpp \
|
genericprojectplugin.cpp \
|
||||||
genericprojectmanager.cpp \
|
genericprojectmanager.cpp \
|
||||||
@@ -18,8 +19,8 @@ SOURCES = genericproject.cpp \
|
|||||||
genericprojectwizard.cpp \
|
genericprojectwizard.cpp \
|
||||||
genericprojectfileseditor.cpp \
|
genericprojectfileseditor.cpp \
|
||||||
pkgconfigtool.cpp \
|
pkgconfigtool.cpp \
|
||||||
genericmakestep.cpp
|
genericmakestep.cpp \
|
||||||
|
genericbuildconfiguration.cpp
|
||||||
RESOURCES += genericproject.qrc
|
RESOURCES += genericproject.qrc
|
||||||
FORMS += genericmakestep.ui
|
FORMS += genericmakestep.ui
|
||||||
|
|
||||||
OTHER_FILES += GenericProjectManager.pluginspec
|
OTHER_FILES += GenericProjectManager.pluginspec
|
||||||
|
@@ -427,7 +427,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
|
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
|
||||||
|
|
||||||
a = new QAction(tr("Reset Font Size"), this);
|
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);
|
modecontext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+0")));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+0")));
|
||||||
connect(a, SIGNAL(triggered()), m_centralWidget, SLOT(resetZoom()));
|
connect(a, SIGNAL(triggered()), m_centralWidget, SLOT(resetZoom()));
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
|
#include "buildconfiguration.h"
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
@@ -46,8 +47,8 @@ namespace {
|
|||||||
bool debug = false;
|
bool debug = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractMakeStep::AbstractMakeStep(Project *project, BuildConfiguration *bc)
|
AbstractMakeStep::AbstractMakeStep(BuildConfiguration *bc)
|
||||||
: AbstractProcessStep(project, bc),
|
: AbstractProcessStep(bc),
|
||||||
m_buildParser(0)
|
m_buildParser(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -144,7 +145,7 @@ void AbstractMakeStep::slotAddToTaskWindow(const TaskWindow::Task &task)
|
|||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "No success. Trying all files in project ...";
|
qDebug() << "No success. Trying all files in project ...";
|
||||||
QString fileName = QFileInfo(filePath).fileName();
|
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);
|
QFileInfo candidate(file);
|
||||||
if (candidate.fileName() == fileName) {
|
if (candidate.fileName() == fileName) {
|
||||||
if (debug)
|
if (debug)
|
||||||
|
@@ -46,7 +46,7 @@ class PROJECTEXPLORER_EXPORT AbstractMakeStep : public ProjectExplorer::Abstract
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AbstractMakeStep(Project * project, BuildConfiguration *bc);
|
AbstractMakeStep(BuildConfiguration *bc);
|
||||||
AbstractMakeStep(AbstractMakeStep *bs, BuildConfiguration *bc);
|
AbstractMakeStep(AbstractMakeStep *bs, BuildConfiguration *bc);
|
||||||
~AbstractMakeStep();
|
~AbstractMakeStep();
|
||||||
virtual bool init();
|
virtual bool init();
|
||||||
|
@@ -39,8 +39,8 @@
|
|||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
AbstractProcessStep::AbstractProcessStep(Project *pro, BuildConfiguration *bc)
|
AbstractProcessStep::AbstractProcessStep(BuildConfiguration *bc)
|
||||||
: BuildStep(pro, bc), m_timer(0), m_futureInterface(0), m_process(0), m_eventLoop(0)
|
: 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
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AbstractProcessStep(Project *pro, BuildConfiguration *bc);
|
AbstractProcessStep(BuildConfiguration *bc);
|
||||||
AbstractProcessStep(AbstractProcessStep *bs, BuildConfiguration *bc);
|
AbstractProcessStep(AbstractProcessStep *bs, BuildConfiguration *bc);
|
||||||
/// reimplemented from BuildStep::init()
|
/// reimplemented from BuildStep::init()
|
||||||
/// You need to call this from YourBuildStep::init()
|
/// You need to call this from YourBuildStep::init()
|
||||||
|
@@ -44,14 +44,14 @@ IBuildStepFactory *findFactory(const QString &name)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildConfiguration::BuildConfiguration(const QString &name)
|
BuildConfiguration::BuildConfiguration(Project *pro)
|
||||||
: m_name(name)
|
: m_project(pro)
|
||||||
{
|
{
|
||||||
setDisplayName(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildConfiguration::BuildConfiguration(const QString &name, BuildConfiguration *source)
|
BuildConfiguration::BuildConfiguration(BuildConfiguration *source)
|
||||||
: m_values(source->m_values), m_name(name)
|
: m_values(source->m_values), m_project(source->m_project)
|
||||||
{
|
{
|
||||||
foreach(BuildStep *originalbs, source->buildSteps()) {
|
foreach(BuildStep *originalbs, source->buildSteps()) {
|
||||||
IBuildStepFactory *factory = findFactory(originalbs->name());
|
IBuildStepFactory *factory = findFactory(originalbs->name());
|
||||||
@@ -71,16 +71,6 @@ BuildConfiguration::~BuildConfiguration()
|
|||||||
qDeleteAll(m_cleanSteps);
|
qDeleteAll(m_cleanSteps);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildConfiguration::setName(const QString &name)
|
|
||||||
{
|
|
||||||
m_name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BuildConfiguration::name() const
|
|
||||||
{
|
|
||||||
return m_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString BuildConfiguration::displayName() const
|
QString BuildConfiguration::displayName() const
|
||||||
{
|
{
|
||||||
QVariant v = value("ProjectExplorer.BuildConfiguration.DisplayName");
|
QVariant v = value("ProjectExplorer.BuildConfiguration.DisplayName");
|
||||||
@@ -90,7 +80,10 @@ QString BuildConfiguration::displayName() const
|
|||||||
|
|
||||||
void BuildConfiguration::setDisplayName(const QString &name)
|
void BuildConfiguration::setDisplayName(const QString &name)
|
||||||
{
|
{
|
||||||
|
if (value("ProjectExplorer.BuildConfiguration.DisplayName").toString() == name)
|
||||||
|
return;
|
||||||
setValue("ProjectExplorer.BuildConfiguration.DisplayName", name);
|
setValue("ProjectExplorer.BuildConfiguration.DisplayName", name);
|
||||||
|
emit displayNameChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant BuildConfiguration::value(const QString & key) const
|
QVariant BuildConfiguration::value(const QString & key) const
|
||||||
@@ -172,6 +165,12 @@ void BuildConfiguration::moveCleanStepUp(int position)
|
|||||||
m_cleanSteps.swap(position - 1, position);
|
m_cleanSteps.swap(position - 1, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Project *BuildConfiguration::project() const
|
||||||
|
{
|
||||||
|
return m_project;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// IBuildConfigurationFactory
|
// IBuildConfigurationFactory
|
||||||
///
|
///
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#define BUILDCONFIGURATION_H
|
#define BUILDCONFIGURATION_H
|
||||||
|
|
||||||
#include "projectexplorer_export.h"
|
#include "projectexplorer_export.h"
|
||||||
|
#include "environment.h"
|
||||||
|
|
||||||
#include <QtCore/QHash>
|
#include <QtCore/QHash>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
@@ -50,13 +51,13 @@ class PROJECTEXPLORER_EXPORT BuildConfiguration : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BuildConfiguration(const QString &name);
|
// ctors are protected
|
||||||
BuildConfiguration(const QString &name, BuildConfiguration *source);
|
virtual ~BuildConfiguration();
|
||||||
~BuildConfiguration();
|
|
||||||
QString name() const;
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
void setDisplayName(const QString &name);
|
void setDisplayName(const QString &name);
|
||||||
|
|
||||||
|
// TODO remove those
|
||||||
QVariant value(const QString &key) const;
|
QVariant value(const QString &key) const;
|
||||||
void setValue(const QString &key, QVariant value);
|
void setValue(const QString &key, QVariant value);
|
||||||
|
|
||||||
@@ -73,15 +74,26 @@ public:
|
|||||||
void removeCleanStep(int position);
|
void removeCleanStep(int position);
|
||||||
void moveCleanStepUp(int position);
|
void moveCleanStepUp(int position);
|
||||||
|
|
||||||
private:
|
Project *project() const;
|
||||||
void setName(const QString &name);
|
|
||||||
|
|
||||||
|
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_buildSteps;
|
||||||
QList<BuildStep *> m_cleanSteps;
|
QList<BuildStep *> m_cleanSteps;
|
||||||
|
|
||||||
QHash<QString, QVariant> m_values;
|
QHash<QString, QVariant> m_values;
|
||||||
QString m_name;
|
Project *m_project;
|
||||||
friend class Project; // for setName
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT IBuildConfigurationFactory : public QObject
|
class PROJECTEXPLORER_EXPORT IBuildConfigurationFactory : public QObject
|
||||||
@@ -98,12 +110,15 @@ public:
|
|||||||
virtual QString displayNameForType(const QString &type) const = 0;
|
virtual QString displayNameForType(const QString &type) const = 0;
|
||||||
|
|
||||||
// creates build configuration(s) for given type and adds them to project
|
// creates build configuration(s) for given type and adds them to project
|
||||||
// returns true if build configuration(s) actually have been added
|
// if successfull returns the BuildConfiguration that should be shown in the
|
||||||
virtual bool create(const QString &type) const = 0;
|
// project mode for editing
|
||||||
|
virtual BuildConfiguration *create(const QString &type) const = 0;
|
||||||
|
|
||||||
// to come:
|
// clones a given BuildConfiguration, should not add it to the project
|
||||||
// restore
|
virtual BuildConfiguration *clone(BuildConfiguration *source) const = 0;
|
||||||
// clone
|
|
||||||
|
// restores a BuildConfiguration with the name and adds it to the project
|
||||||
|
virtual BuildConfiguration *restore() const = 0;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void availableCreationTypesChanged();
|
void availableCreationTypesChanged();
|
||||||
@@ -111,4 +126,6 @@ signals:
|
|||||||
|
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(ProjectExplorer::BuildConfiguration *);
|
||||||
|
|
||||||
#endif // BUILDCONFIGURATION_H
|
#endif // BUILDCONFIGURATION_H
|
||||||
|
@@ -136,7 +136,7 @@ void BuildManager::cancel()
|
|||||||
this, SLOT(addToTaskWindow(ProjectExplorer::TaskWindow::Task)));
|
this, SLOT(addToTaskWindow(ProjectExplorer::TaskWindow::Task)));
|
||||||
disconnect(m_currentBuildStep, SIGNAL(addToOutputWindow(QString)),
|
disconnect(m_currentBuildStep, SIGNAL(addToOutputWindow(QString)),
|
||||||
this, SLOT(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
|
m_progressFutureInterface->setProgressValueAndText(m_progress*100, "Build canceled"); //TODO NBS fix in qtconcurrent
|
||||||
clearBuildQueue();
|
clearBuildQueue();
|
||||||
@@ -169,7 +169,7 @@ void BuildManager::emitCancelMessage()
|
|||||||
void BuildManager::clearBuildQueue()
|
void BuildManager::clearBuildQueue()
|
||||||
{
|
{
|
||||||
foreach (BuildStep * bs, m_buildQueue)
|
foreach (BuildStep * bs, m_buildQueue)
|
||||||
decrementActiveBuildSteps(bs->project());
|
decrementActiveBuildSteps(bs->buildConfiguration()->project());
|
||||||
|
|
||||||
m_buildQueue.clear();
|
m_buildQueue.clear();
|
||||||
m_running = false;
|
m_running = false;
|
||||||
@@ -280,13 +280,14 @@ void BuildManager::nextBuildQueue()
|
|||||||
bool result = m_watcher.result();
|
bool result = m_watcher.result();
|
||||||
if (!result) {
|
if (!result) {
|
||||||
// Build Failure
|
// 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()));
|
addToOutputWindow(tr("<font color=\"#ff0000\">When executing build step '%1'</font>").arg(m_currentBuildStep->displayName()));
|
||||||
// NBS TODO fix in qtconcurrent
|
// 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)
|
if (result)
|
||||||
nextStep();
|
nextStep();
|
||||||
else
|
else
|
||||||
@@ -317,17 +318,18 @@ void BuildManager::nextStep()
|
|||||||
|
|
||||||
bool init = m_currentBuildStep->init();
|
bool init = m_currentBuildStep->init();
|
||||||
if (!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()));
|
addToOutputWindow(tr("<font color=\"#ff0000\">When executing build step '%1'</font>").arg(m_currentBuildStep->displayName()));
|
||||||
cancel();
|
cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_currentBuildStep->project() != m_previousBuildStepProject) {
|
if (m_currentBuildStep->buildConfiguration()->project() != m_previousBuildStepProject) {
|
||||||
const QString projectName = m_currentBuildStep->project()->name();
|
const QString projectName = m_currentBuildStep->buildConfiguration()->project()->name();
|
||||||
addToOutputWindow(tr("<b>Running build steps for project %2...</b>")
|
addToOutputWindow(tr("<b>Running build steps for project %2...</b>")
|
||||||
.arg(projectName));
|
.arg(projectName));
|
||||||
m_previousBuildStepProject = m_currentBuildStep->project();
|
m_previousBuildStepProject = m_currentBuildStep->buildConfiguration()->project();
|
||||||
}
|
}
|
||||||
m_watcher.setFuture(QtConcurrent::run(&BuildStep::run, m_currentBuildStep));
|
m_watcher.setFuture(QtConcurrent::run(&BuildStep::run, m_currentBuildStep));
|
||||||
} else {
|
} else {
|
||||||
@@ -346,23 +348,15 @@ void BuildManager::buildQueueAppend(BuildStep * bs)
|
|||||||
{
|
{
|
||||||
m_buildQueue.append(bs);
|
m_buildQueue.append(bs);
|
||||||
++m_maxProgress;
|
++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());
|
foreach(BuildConfiguration *bc, configurations) {
|
||||||
QList<QString>::const_iterator cit = configurations.constBegin();
|
QList<BuildStep *> buildSteps = bc->buildSteps();
|
||||||
QList<Project *>::const_iterator it, end;
|
foreach (BuildStep *bs, buildSteps) {
|
||||||
end = projects.constEnd();
|
buildQueueAppend(bs);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput)
|
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput)
|
||||||
@@ -370,20 +364,12 @@ void BuildManager::buildProjects(const QList<Project *> &projects, const QList<Q
|
|||||||
startBuildQueue();
|
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());
|
foreach(BuildConfiguration *bc, configurations) {
|
||||||
QList<QString>::const_iterator cit = configurations.constBegin();
|
QList<BuildStep *> cleanSteps = bc->cleanSteps();
|
||||||
QList<Project *>::const_iterator it, end;
|
foreach (BuildStep *bs, cleanSteps) {
|
||||||
end = projects.constEnd();
|
buildQueueAppend(bs);
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput)
|
if (ProjectExplorerPlugin::instance()->projectExplorerSettings().showCompilerOutput)
|
||||||
@@ -391,14 +377,14 @@ void BuildManager::cleanProjects(const QList<Project *> &projects, const QList<Q
|
|||||||
startBuildQueue();
|
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)
|
void BuildManager::appendStep(BuildStep *step)
|
||||||
|
@@ -49,6 +49,7 @@ namespace Internal {
|
|||||||
class BuildStep;
|
class BuildStep;
|
||||||
class Project;
|
class Project;
|
||||||
class ProjectExplorerPlugin;
|
class ProjectExplorerPlugin;
|
||||||
|
class BuildConfiguration;
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT BuildManager
|
class PROJECTEXPLORER_EXPORT BuildManager
|
||||||
: public QObject
|
: public QObject
|
||||||
@@ -70,10 +71,10 @@ public:
|
|||||||
void gotoTaskWindow();
|
void gotoTaskWindow();
|
||||||
|
|
||||||
//TODO these should take buildconfiguration object
|
//TODO these should take buildconfiguration object
|
||||||
void buildProject(Project *p, const QString &configuration);
|
void buildProject(BuildConfiguration *bc);
|
||||||
void buildProjects(const QList<Project *> &projects, const QList<QString> &configurations);
|
void buildProjects(const QList<BuildConfiguration *> &configurations);
|
||||||
void cleanProject(Project *p, const QString &configuration);
|
void cleanProject(BuildConfiguration *configuration);
|
||||||
void cleanProjects(const QList<Project *> &projects, const QList<QString> &configurations);
|
void cleanProjects(const QList<BuildConfiguration *> &configurations);
|
||||||
bool isBuilding(Project *p);
|
bool isBuilding(Project *p);
|
||||||
|
|
||||||
// Append any build step to the list of build steps (currently only used to add the QMakeStep)
|
// 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 "projectexplorerconstants.h"
|
||||||
#include "gccparser.h"
|
#include "gccparser.h"
|
||||||
#include "msvcparser.h"
|
#include "msvcparser.h"
|
||||||
#include "qmakeparser.h"
|
|
||||||
|
|
||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
|
|
||||||
@@ -65,18 +64,3 @@ ProjectExplorer::IBuildParser * MsvcParserFactory::create(const QString & name)
|
|||||||
Q_UNUSED(name)
|
Q_UNUSED(name)
|
||||||
return new MsvcParser();
|
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;
|
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 Internal
|
||||||
} // namespace ProjectExplorer
|
} // namespace ProjectExplorer
|
||||||
|
|
||||||
|
@@ -37,18 +37,21 @@
|
|||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QtCore/QPair>
|
#include <QtCore/QMargins>
|
||||||
|
#include <QtCore/QTimer>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QInputDialog>
|
#include <QtGui/QInputDialog>
|
||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
#include <QtGui/QVBoxLayout>
|
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
|
#include <QtGui/QPushButton>
|
||||||
|
#include <QtGui/QVBoxLayout>
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// BuildSettingsPanelFactory
|
// BuildSettingsPanelFactory
|
||||||
///
|
///
|
||||||
|
|
||||||
bool BuildSettingsPanelFactory::supports(Project *project)
|
bool BuildSettingsPanelFactory::supports(Project *project)
|
||||||
@@ -62,7 +65,7 @@ IPropertiesPanel *BuildSettingsPanelFactory::createPanel(Project *project)
|
|||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
/// BuildSettingsPanel
|
// BuildSettingsPanel
|
||||||
///
|
///
|
||||||
|
|
||||||
BuildSettingsPanel::BuildSettingsPanel(Project *project) :
|
BuildSettingsPanel::BuildSettingsPanel(Project *project) :
|
||||||
@@ -92,74 +95,36 @@ QIcon BuildSettingsPanel::icon() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
// BuildSettingsSubWidgets
|
// BuildSettingsWidget
|
||||||
///
|
|
||||||
|
|
||||||
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::~BuildSettingsWidget()
|
||||||
{
|
{
|
||||||
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
BuildSettingsWidget::BuildSettingsWidget(Project *project) :
|
||||||
: m_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);
|
QVBoxLayout *vbox = new QVBoxLayout(this);
|
||||||
vbox->setContentsMargins(0, -1, 0, -1);
|
vbox->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
{ // Edit Build Configuration row
|
{ // Edit Build Configuration row
|
||||||
QHBoxLayout *hbox = new QHBoxLayout();
|
QHBoxLayout *hbox = new QHBoxLayout();
|
||||||
|
hbox->setContentsMargins(m_leftMargin, 0, 0, 0);
|
||||||
hbox->addWidget(new QLabel(tr("Edit Build Configuration:"), this));
|
hbox->addWidget(new QLabel(tr("Edit Build Configuration:"), this));
|
||||||
m_buildConfigurationComboBox = new QComboBox(this);
|
m_buildConfigurationComboBox = new QComboBox(this);
|
||||||
m_buildConfigurationComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
m_buildConfigurationComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
@@ -169,6 +134,8 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
|||||||
m_addButton->setText(tr("Add"));
|
m_addButton->setText(tr("Add"));
|
||||||
m_addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
m_addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
hbox->addWidget(m_addButton);
|
hbox->addWidget(m_addButton);
|
||||||
|
m_addButtonMenu = new QMenu(this);
|
||||||
|
m_addButton->setMenu(m_addButtonMenu);
|
||||||
|
|
||||||
m_removeButton = new QPushButton(this);
|
m_removeButton = new QPushButton(this);
|
||||||
m_removeButton->setText(tr("Remove"));
|
m_removeButton->setText(tr("Remove"));
|
||||||
@@ -182,14 +149,7 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
|||||||
m_makeActiveLabel->setVisible(false);
|
m_makeActiveLabel->setVisible(false);
|
||||||
vbox->addWidget(m_makeActiveLabel);
|
vbox->addWidget(m_makeActiveLabel);
|
||||||
|
|
||||||
m_subWidgets = new BuildSettingsSubWidgets(this);
|
m_buildConfiguration = m_project->activeBuildConfiguration();
|
||||||
vbox->addWidget(m_subWidgets);
|
|
||||||
|
|
||||||
m_addButtonMenu = new QMenu(this);
|
|
||||||
m_addButton->setMenu(m_addButtonMenu);
|
|
||||||
updateAddButtonMenu();
|
|
||||||
|
|
||||||
m_buildConfiguration = m_project->activeBuildConfiguration()->name();
|
|
||||||
|
|
||||||
connect(m_makeActiveLabel, SIGNAL(linkActivated(QString)),
|
connect(m_makeActiveLabel, SIGNAL(linkActivated(QString)),
|
||||||
this, SLOT(makeActive()));
|
this, SLOT(makeActive()));
|
||||||
@@ -200,8 +160,9 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
|||||||
connect(m_removeButton, SIGNAL(clicked()),
|
connect(m_removeButton, SIGNAL(clicked()),
|
||||||
this, SLOT(deleteConfiguration()));
|
this, SLOT(deleteConfiguration()));
|
||||||
|
|
||||||
connect(m_project, SIGNAL(buildConfigurationDisplayNameChanged(const QString &)),
|
// TODO update on displayNameChange
|
||||||
this, SLOT(buildConfigurationDisplayNameChanged(const QString &)));
|
// connect(m_project, SIGNAL(buildConfigurationDisplayNameChanged(const QString &)),
|
||||||
|
// this, SLOT(buildConfigurationDisplayNameChanged(const QString &)));
|
||||||
|
|
||||||
connect(m_project, SIGNAL(activeBuildConfigurationChanged()),
|
connect(m_project, SIGNAL(activeBuildConfigurationChanged()),
|
||||||
this, SLOT(checkMakeActiveLabel()));
|
this, SLOT(checkMakeActiveLabel()));
|
||||||
@@ -209,19 +170,54 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
|||||||
if (m_project->buildConfigurationFactory())
|
if (m_project->buildConfigurationFactory())
|
||||||
connect(m_project->buildConfigurationFactory(), SIGNAL(availableCreationTypesChanged()), SLOT(updateAddButtonMenu()));
|
connect(m_project->buildConfigurationFactory(), SIGNAL(availableCreationTypesChanged()), SLOT(updateAddButtonMenu()));
|
||||||
|
|
||||||
|
updateAddButtonMenu();
|
||||||
updateBuildSettings();
|
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()
|
void BuildSettingsWidget::makeActive()
|
||||||
{
|
{
|
||||||
m_project->setActiveBuildConfiguration(m_project->buildConfiguration(m_buildConfiguration));
|
m_project->setActiveBuildConfiguration(m_buildConfiguration);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildSettingsWidget::updateAddButtonMenu()
|
void BuildSettingsWidget::updateAddButtonMenu()
|
||||||
{
|
{
|
||||||
m_addButtonMenu->clear();
|
m_addButtonMenu->clear();
|
||||||
m_addButtonMenu->addAction(tr("&Clone Selected"),
|
m_addButtonMenu->addAction(tr("&Clone Selected"),
|
||||||
this, SLOT(cloneConfiguration()));
|
this, SLOT(cloneConfiguration()));
|
||||||
IBuildConfigurationFactory *factory = m_project->buildConfigurationFactory();
|
IBuildConfigurationFactory *factory = m_project->buildConfigurationFactory();
|
||||||
if (factory) {
|
if (factory) {
|
||||||
foreach (const QString &type, factory->availableCreationTypes()) {
|
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()
|
void BuildSettingsWidget::updateBuildSettings()
|
||||||
{
|
{
|
||||||
// TODO save position, entry from combbox
|
// TODO save position, entry from combbox
|
||||||
@@ -249,26 +234,26 @@ void BuildSettingsWidget::updateBuildSettings()
|
|||||||
// Delete old tree items
|
// Delete old tree items
|
||||||
bool blocked = m_buildConfigurationComboBox->blockSignals(true);
|
bool blocked = m_buildConfigurationComboBox->blockSignals(true);
|
||||||
m_buildConfigurationComboBox->clear();
|
m_buildConfigurationComboBox->clear();
|
||||||
m_subWidgets->clear();
|
clear();
|
||||||
|
|
||||||
// update buttons
|
// update buttons
|
||||||
m_removeButton->setEnabled(m_project->buildConfigurations().size() > 1);
|
m_removeButton->setEnabled(m_project->buildConfigurations().size() > 1);
|
||||||
|
|
||||||
// Add pages
|
// Add pages
|
||||||
BuildConfigWidget *generalConfigWidget = m_project->createConfigWidget();
|
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));
|
addSubWidget(tr("Build Steps"), new BuildStepsPage(m_project, false));
|
||||||
m_subWidgets->addWidget(tr("Clean Steps"), new BuildStepsPage(m_project, true));
|
addSubWidget(tr("Clean Steps"), new BuildStepsPage(m_project, true));
|
||||||
|
|
||||||
QList<BuildConfigWidget *> subConfigWidgets = m_project->subConfigWidgets();
|
QList<BuildConfigWidget *> subConfigWidgets = m_project->subConfigWidgets();
|
||||||
foreach (BuildConfigWidget *subConfigWidget, subConfigWidgets)
|
foreach (BuildConfigWidget *subConfigWidget, subConfigWidgets)
|
||||||
m_subWidgets->addWidget(subConfigWidget->displayName(), subConfigWidget);
|
addSubWidget(subConfigWidget->displayName(), subConfigWidget);
|
||||||
|
|
||||||
// Add tree items
|
// Add tree items
|
||||||
foreach (const BuildConfiguration *bc, m_project->buildConfigurations()) {
|
foreach (BuildConfiguration *bc, m_project->buildConfigurations()) {
|
||||||
m_buildConfigurationComboBox->addItem(bc->displayName(), bc->name());
|
m_buildConfigurationComboBox->addItem(bc->displayName(), QVariant::fromValue<BuildConfiguration *>(bc));
|
||||||
if (bc->name() == m_buildConfiguration)
|
if (bc == m_buildConfiguration)
|
||||||
m_buildConfigurationComboBox->setCurrentIndex(m_buildConfigurationComboBox->count() - 1);
|
m_buildConfigurationComboBox->setCurrentIndex(m_buildConfigurationComboBox->count() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,24 +261,25 @@ void BuildSettingsWidget::updateBuildSettings()
|
|||||||
|
|
||||||
// TODO Restore position, entry from combbox
|
// TODO Restore position, entry from combbox
|
||||||
// TODO? select entry from combobox ?
|
// TODO? select entry from combobox ?
|
||||||
|
|
||||||
activeBuildConfigurationChanged();
|
activeBuildConfigurationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildSettingsWidget::currentIndexChanged(int index)
|
void BuildSettingsWidget::currentIndexChanged(int index)
|
||||||
{
|
{
|
||||||
m_buildConfiguration = m_buildConfigurationComboBox->itemData(index).toString();
|
m_buildConfiguration = m_buildConfigurationComboBox->itemData(index).value<BuildConfiguration *>();
|
||||||
activeBuildConfigurationChanged();
|
activeBuildConfigurationChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildSettingsWidget::activeBuildConfigurationChanged()
|
void BuildSettingsWidget::activeBuildConfigurationChanged()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_buildConfigurationComboBox->count(); ++i) {
|
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);
|
m_buildConfigurationComboBox->setCurrentIndex(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach (QWidget *widget, m_subWidgets->widgets()) {
|
foreach (QWidget *widget, subWidgets()) {
|
||||||
if (BuildConfigWidget *buildStepWidget = qobject_cast<BuildConfigWidget*>(widget)) {
|
if (BuildConfigWidget *buildStepWidget = qobject_cast<BuildConfigWidget*>(widget)) {
|
||||||
buildStepWidget->init(m_buildConfiguration);
|
buildStepWidget->init(m_buildConfiguration);
|
||||||
}
|
}
|
||||||
@@ -304,10 +290,8 @@ void BuildSettingsWidget::activeBuildConfigurationChanged()
|
|||||||
void BuildSettingsWidget::checkMakeActiveLabel()
|
void BuildSettingsWidget::checkMakeActiveLabel()
|
||||||
{
|
{
|
||||||
m_makeActiveLabel->setVisible(false);
|
m_makeActiveLabel->setVisible(false);
|
||||||
if (!m_project->activeBuildConfiguration() || m_project->activeBuildConfiguration()->name() != m_buildConfiguration) {
|
if (!m_project->activeBuildConfiguration() || m_project->activeBuildConfiguration() != m_buildConfiguration) {
|
||||||
BuildConfiguration *bc = m_project->buildConfiguration(m_buildConfiguration);
|
m_makeActiveLabel->setText(tr("<a href=\"#\">Make %1 active.</a>").arg(m_buildConfiguration->displayName()));
|
||||||
QTC_ASSERT(bc, return);
|
|
||||||
m_makeActiveLabel->setText(tr("<a href=\"#\">Make %1 active.</a>").arg(bc->displayName()));
|
|
||||||
m_makeActiveLabel->setVisible(true);
|
m_makeActiveLabel->setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -316,61 +300,56 @@ void BuildSettingsWidget::createConfiguration()
|
|||||||
{
|
{
|
||||||
QAction *action = qobject_cast<QAction *>(sender());
|
QAction *action = qobject_cast<QAction *>(sender());
|
||||||
const QString &type = action->data().toString();
|
const QString &type = action->data().toString();
|
||||||
if (m_project->buildConfigurationFactory()->create(type)) {
|
BuildConfiguration *bc = m_project->buildConfigurationFactory()->create(type);
|
||||||
// TODO switching to last buildconfiguration in list might not be what we want
|
if (bc) {
|
||||||
m_buildConfiguration = m_project->buildConfigurations().last()->name();
|
m_buildConfiguration = bc;
|
||||||
updateBuildSettings();
|
updateBuildSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildSettingsWidget::cloneConfiguration()
|
void BuildSettingsWidget::cloneConfiguration()
|
||||||
{
|
{
|
||||||
const QString configuration = m_buildConfigurationComboBox->itemData(m_buildConfigurationComboBox->currentIndex()).toString();
|
const int index = m_buildConfigurationComboBox->currentIndex();
|
||||||
cloneConfiguration(configuration);
|
BuildConfiguration *bc = m_buildConfigurationComboBox->itemData(index).value<BuildConfiguration *>();
|
||||||
|
cloneConfiguration(bc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildSettingsWidget::deleteConfiguration()
|
void BuildSettingsWidget::deleteConfiguration()
|
||||||
{
|
{
|
||||||
const QString configuration = m_buildConfigurationComboBox->itemData(m_buildConfigurationComboBox->currentIndex()).toString();
|
const int index = m_buildConfigurationComboBox->currentIndex();
|
||||||
deleteConfiguration(configuration);
|
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;
|
return;
|
||||||
|
|
||||||
QString newBuildConfiguration = QInputDialog::getText(this, tr("Clone configuration"), tr("New Configuration Name:"));
|
QString newDisplayName(QInputDialog::getText(this, tr("Clone configuration"), tr("New Configuration Name:")));
|
||||||
if (newBuildConfiguration.isEmpty())
|
if (newDisplayName.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString newDisplayName = newBuildConfiguration;
|
|
||||||
QStringList buildConfigurationDisplayNames;
|
QStringList buildConfigurationDisplayNames;
|
||||||
foreach(BuildConfiguration *bc, m_project->buildConfigurations())
|
foreach(BuildConfiguration *bc, m_project->buildConfigurations())
|
||||||
buildConfigurationDisplayNames << bc->displayName();
|
buildConfigurationDisplayNames << bc->displayName();
|
||||||
newDisplayName = Project::makeUnique(newDisplayName, buildConfigurationDisplayNames);
|
newDisplayName = Project::makeUnique(newDisplayName, buildConfigurationDisplayNames);
|
||||||
|
|
||||||
QStringList buildConfigurationNames;
|
m_buildConfiguration = m_project->buildConfigurationFactory()->clone(sourceConfiguration);
|
||||||
foreach(BuildConfiguration *bc, m_project->buildConfigurations())
|
m_buildConfiguration->setDisplayName(newDisplayName);
|
||||||
buildConfigurationNames << bc->name();
|
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();
|
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;
|
return;
|
||||||
|
|
||||||
if (m_project->activeBuildConfiguration()->name() == deleteConfiguration) {
|
if (m_project->activeBuildConfiguration() == deleteConfiguration) {
|
||||||
foreach (BuildConfiguration *bc, m_project->buildConfigurations()) {
|
foreach (BuildConfiguration *bc, m_project->buildConfigurations()) {
|
||||||
if (bc->name() != deleteConfiguration) {
|
if (bc != deleteConfiguration) {
|
||||||
m_project->setActiveBuildConfiguration(bc);
|
m_project->setActiveBuildConfiguration(bc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -378,15 +357,15 @@ void BuildSettingsWidget::deleteConfiguration(const QString &deleteConfiguration
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_buildConfiguration == deleteConfiguration) {
|
if (m_buildConfiguration == deleteConfiguration) {
|
||||||
foreach (const BuildConfiguration *bc, m_project->buildConfigurations()) {
|
foreach (BuildConfiguration *bc, m_project->buildConfigurations()) {
|
||||||
if (bc->name() != deleteConfiguration) {
|
if (bc != deleteConfiguration) {
|
||||||
m_buildConfiguration = bc->name();
|
m_buildConfiguration = bc;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_project->removeBuildConfiguration(m_project->buildConfiguration(deleteConfiguration));
|
m_project->removeBuildConfiguration(deleteConfiguration);
|
||||||
|
|
||||||
updateBuildSettings();
|
updateBuildSettings();
|
||||||
}
|
}
|
||||||
|
@@ -32,34 +32,22 @@
|
|||||||
|
|
||||||
#include "iprojectproperties.h"
|
#include "iprojectproperties.h"
|
||||||
|
|
||||||
#include <QtCore/QHash>
|
#include <QtGui/QWidget>
|
||||||
#include <QtGui/QComboBox>
|
|
||||||
#include <QtGui/QPushButton>
|
QT_BEGIN_NAMESPACE
|
||||||
#include <QtGui/QLabel>
|
class QComboBox;
|
||||||
#include <QtGui/QGroupBox>
|
class QLabel;
|
||||||
#include <QtGui/QSpacerItem>
|
class QMenu;
|
||||||
|
class QPushButton;
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
|
class BuildConfiguration;
|
||||||
class IBuildStepFactory;
|
class IBuildStepFactory;
|
||||||
|
|
||||||
namespace Internal {
|
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
|
class BuildSettingsPanelFactory : public IPanelFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -92,8 +80,11 @@ public:
|
|||||||
BuildSettingsWidget(Project *project);
|
BuildSettingsWidget(Project *project);
|
||||||
~BuildSettingsWidget();
|
~BuildSettingsWidget();
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
void addSubWidget(const QString &name, QWidget *widget);
|
||||||
|
QList<QWidget *> subWidgets() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void buildConfigurationDisplayNameChanged(const QString &buildConfiguration);
|
|
||||||
void updateBuildSettings();
|
void updateBuildSettings();
|
||||||
void currentIndexChanged(int index);
|
void currentIndexChanged(int index);
|
||||||
void activeBuildConfigurationChanged();
|
void activeBuildConfigurationChanged();
|
||||||
@@ -105,18 +96,25 @@ private slots:
|
|||||||
void checkMakeActiveLabel();
|
void checkMakeActiveLabel();
|
||||||
void makeActive();
|
void makeActive();
|
||||||
|
|
||||||
|
void init();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void cloneConfiguration(const QString &toClone);
|
void cloneConfiguration(BuildConfiguration *toClone);
|
||||||
void deleteConfiguration(const QString &toDelete);
|
void deleteConfiguration(BuildConfiguration *toDelete);
|
||||||
|
|
||||||
Project *m_project;
|
Project *m_project;
|
||||||
|
BuildConfiguration *m_buildConfiguration;
|
||||||
|
|
||||||
QPushButton *m_addButton;
|
QPushButton *m_addButton;
|
||||||
QPushButton *m_removeButton;
|
QPushButton *m_removeButton;
|
||||||
QComboBox *m_buildConfigurationComboBox;
|
QComboBox *m_buildConfigurationComboBox;
|
||||||
BuildSettingsSubWidgets *m_subWidgets;
|
|
||||||
QString m_buildConfiguration;
|
|
||||||
QMenu *m_addButtonMenu;
|
QMenu *m_addButtonMenu;
|
||||||
QLabel *m_makeActiveLabel;
|
QLabel *m_makeActiveLabel;
|
||||||
|
|
||||||
|
QList<QWidget *> m_subWidgets;
|
||||||
|
QList<QLabel *> m_labels;
|
||||||
|
|
||||||
|
int m_leftMargin;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
@@ -36,15 +36,15 @@
|
|||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
BuildStep::BuildStep(Project * pro, BuildConfiguration *bc)
|
BuildStep::BuildStep(BuildConfiguration *bc)
|
||||||
: m_project(pro), m_buildConfiguration(bc)
|
: m_buildConfiguration(bc)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStep::BuildStep(BuildStep *bs, BuildConfiguration *bc)
|
BuildStep::BuildStep(BuildStep *bs, BuildConfiguration *bc)
|
||||||
: m_project(bs->m_project), m_buildConfiguration(bc)
|
: m_buildConfiguration(bc)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStep::~BuildStep()
|
BuildStep::~BuildStep()
|
||||||
@@ -68,11 +68,6 @@ void BuildStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
|||||||
Q_UNUSED(map)
|
Q_UNUSED(map)
|
||||||
}
|
}
|
||||||
|
|
||||||
Project *BuildStep::project() const
|
|
||||||
{
|
|
||||||
return m_project;
|
|
||||||
}
|
|
||||||
|
|
||||||
BuildConfiguration *BuildStep::buildConfiguration() const
|
BuildConfiguration *BuildStep::buildConfiguration() const
|
||||||
{
|
{
|
||||||
return m_buildConfiguration;
|
return m_buildConfiguration;
|
||||||
|
@@ -37,8 +37,6 @@
|
|||||||
#include <QtCore/QFutureInterface>
|
#include <QtCore/QFutureInterface>
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class Project;
|
|
||||||
class BuildConfiguration;
|
class BuildConfiguration;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -71,9 +69,8 @@ class BuildStepConfigWidget;
|
|||||||
class PROJECTEXPLORER_EXPORT BuildStep : public QObject
|
class PROJECTEXPLORER_EXPORT BuildStep : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
friend class Project; //for managing BuildConfigurations
|
|
||||||
protected:
|
protected:
|
||||||
BuildStep(Project *p, BuildConfiguration *bc);
|
BuildStep(BuildConfiguration *bc);
|
||||||
BuildStep(BuildStep *bs, BuildConfiguration *bc);
|
BuildStep(BuildStep *bs, BuildConfiguration *bc);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -110,7 +107,6 @@ public:
|
|||||||
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
virtual void restoreFromLocalMap(const QMap<QString, QVariant> &map);
|
||||||
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
virtual void storeIntoLocalMap(QMap<QString, QVariant> &map);
|
||||||
|
|
||||||
Project *project() const;
|
|
||||||
BuildConfiguration *buildConfiguration() const;
|
BuildConfiguration *buildConfiguration() const;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
@@ -120,7 +116,6 @@ Q_SIGNALS:
|
|||||||
void addToOutputWindow(const QString &string);
|
void addToOutputWindow(const QString &string);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Project *m_project;
|
|
||||||
BuildConfiguration *m_buildConfiguration;
|
BuildConfiguration *m_buildConfiguration;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -135,10 +130,10 @@ public:
|
|||||||
/// Called to check wheter this factory can restore the named BuildStep
|
/// Called to check wheter this factory can restore the named BuildStep
|
||||||
virtual bool canCreate(const QString &name) const = 0;
|
virtual bool canCreate(const QString &name) const = 0;
|
||||||
/// Called to restore a buildstep
|
/// 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
|
/// 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
|
/// 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 convert an internal name to a displayName
|
||||||
|
|
||||||
/// Called to clone a BuildStep
|
/// Called to clone a BuildStep
|
||||||
@@ -158,7 +153,7 @@ public:
|
|||||||
virtual QString displayName() const = 0;
|
virtual QString displayName() const = 0;
|
||||||
|
|
||||||
// This is called to set up the config widget before showing it
|
// 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
|
class PROJECTEXPLORER_EXPORT BuildStepConfigWidget
|
||||||
|
@@ -28,13 +28,14 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "buildstepspage.h"
|
#include "buildstepspage.h"
|
||||||
#include "project.h"
|
|
||||||
#include "buildconfiguration.h"
|
#include "buildconfiguration.h"
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <QtCore/QSignalMapper>
|
||||||
|
|
||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
#include <QtGui/QPushButton>
|
#include <QtGui/QPushButton>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
@@ -47,40 +48,11 @@ using namespace ProjectExplorer::Internal;
|
|||||||
|
|
||||||
BuildStepsPage::BuildStepsPage(Project *project, bool clean) :
|
BuildStepsPage::BuildStepsPage(Project *project, bool clean) :
|
||||||
BuildConfigWidget(),
|
BuildConfigWidget(),
|
||||||
m_pro(project),
|
m_clean(clean),
|
||||||
m_clean(clean)
|
m_addButton(0),
|
||||||
|
m_leftMargin(-1)
|
||||||
{
|
{
|
||||||
m_vbox = new QVBoxLayout(this);
|
Q_UNUSED(project);
|
||||||
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()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStepsPage::~BuildStepsPage()
|
BuildStepsPage::~BuildStepsPage()
|
||||||
@@ -110,18 +82,21 @@ QString BuildStepsPage::displayName() const
|
|||||||
return m_clean ? tr("Clean Steps") : tr("Build Steps");
|
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) {
|
foreach(BuildStepsWidgetStruct s, m_buildSteps) {
|
||||||
delete s.widget;
|
delete s.widget;
|
||||||
delete s.detailsWidget;
|
delete s.detailsWidget;
|
||||||
}
|
}
|
||||||
m_buildSteps.clear();
|
m_buildSteps.clear();
|
||||||
|
|
||||||
m_configuration = buildConfiguration;
|
m_configuration = bc;
|
||||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
|
||||||
|
|
||||||
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;
|
int i = 0;
|
||||||
foreach (BuildStep *bs, steps) {
|
foreach (BuildStep *bs, steps) {
|
||||||
addBuildStepWidget(i, bs);
|
addBuildStepWidget(i, bs);
|
||||||
@@ -143,8 +118,8 @@ void BuildStepsPage::updateAddBuildStepMenu()
|
|||||||
QMap<QString, QPair<QString, IBuildStepFactory *> > map;
|
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.
|
//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>();
|
QList<IBuildStepFactory *> factories = ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>();
|
||||||
foreach (IBuildStepFactory * factory, factories) {
|
foreach (IBuildStepFactory *factory, factories) {
|
||||||
QStringList names = factory->canCreateForProject(m_pro);
|
QStringList names = factory->canCreateForBuildConfiguration(m_configuration);
|
||||||
foreach (const QString &name, names) {
|
foreach (const QString &name, names) {
|
||||||
map.insert(factory->displayNameForName(name), QPair<QString, IBuildStepFactory *>(name, factory));
|
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.upButton->setIconSize(QSize(10, 10));
|
||||||
s.downButton->setIconSize(QSize(10, 10));
|
s.downButton->setIconSize(QSize(10, 10));
|
||||||
#endif
|
#endif
|
||||||
|
s.removeButton = new QPushButton(this);
|
||||||
|
s.removeButton->setText(QChar('X'));
|
||||||
|
s.removeButton->setMaximumHeight(22);
|
||||||
|
s.removeButton->setMaximumWidth(22);
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
QWidget *toolWidget = new QWidget(s.detailsWidget);
|
QWidget *toolWidget = new QWidget(s.detailsWidget);
|
||||||
toolWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
toolWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||||
s.hbox = new QHBoxLayout(toolWidget);
|
QHBoxLayout *hbox = new QHBoxLayout();
|
||||||
s.hbox->setMargin(0);
|
toolWidget->setLayout(hbox);
|
||||||
s.hbox->setSpacing(0);
|
hbox->setMargin(0);
|
||||||
s.hbox->addWidget(s.upButton);
|
hbox->setSpacing(0);
|
||||||
s.hbox->addWidget(s.downButton);
|
hbox->addWidget(s.upButton);
|
||||||
|
hbox->addWidget(s.downButton);
|
||||||
|
hbox->addWidget(s.removeButton);
|
||||||
|
|
||||||
s.detailsWidget->setToolWidget(toolWidget);
|
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_buildSteps.insert(pos, s);
|
||||||
|
|
||||||
m_vbox->insertWidget(pos, s.detailsWidget);
|
m_vbox->insertWidget(pos, s.detailsWidget);
|
||||||
|
|
||||||
connect(s.widget, SIGNAL(updateSummary()),
|
connect(s.widget, SIGNAL(updateSummary()),
|
||||||
this, SLOT(updateSummary()));
|
this, SLOT(updateSummary()));
|
||||||
|
|
||||||
connect(s.upButton, SIGNAL(clicked()),
|
connect(s.upButton, SIGNAL(clicked()),
|
||||||
this, SLOT(upBuildStep()));
|
m_upMapper, SLOT(map()));
|
||||||
connect(s.downButton, SIGNAL(clicked()),
|
connect(s.downButton, SIGNAL(clicked()),
|
||||||
this, SLOT(downBuildStep()));
|
m_downMapper, SLOT(map()));
|
||||||
|
connect(s.removeButton, SIGNAL(clicked()),
|
||||||
|
m_removeMapper, SLOT(map()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildStepsPage::addBuildStep()
|
void BuildStepsPage::addBuildStep()
|
||||||
{
|
{
|
||||||
if (QAction *action = qobject_cast<QAction *>(sender())) {
|
if (QAction *action = qobject_cast<QAction *>(sender())) {
|
||||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
|
||||||
QPair<QString, IBuildStepFactory *> pair = m_addBuildStepHash.value(action);
|
QPair<QString, IBuildStepFactory *> pair = m_addBuildStepHash.value(action);
|
||||||
BuildStep *newStep = pair.second->create(m_pro, bc, pair.first);
|
BuildStep *newStep = pair.second->create(m_configuration, pair.first);
|
||||||
int pos = m_clean ? bc->cleanSteps().count() : bc->buildSteps().count();
|
int pos = m_clean ? m_configuration->cleanSteps().count() : m_configuration->buildSteps().count();
|
||||||
m_clean ? bc->insertCleanStep(pos, newStep) : bc->insertBuildStep(pos, newStep);
|
m_clean ? m_configuration->insertCleanStep(pos, newStep) : m_configuration->insertBuildStep(pos, newStep);
|
||||||
|
|
||||||
addBuildStepWidget(pos, newStep);
|
addBuildStepWidget(pos, newStep);
|
||||||
const BuildStepsWidgetStruct s = m_buildSteps.at(pos);
|
const BuildStepsWidgetStruct s = m_buildSteps.at(pos);
|
||||||
s.widget->init();
|
s.widget->init();
|
||||||
s.detailsWidget->setSummaryText(s.widget->summaryText());
|
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();
|
updateBuildStepButtonsState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildStepsPage::stepMoveUp(int pos)
|
void BuildStepsPage::stepMoveUp(int pos)
|
||||||
{
|
{
|
||||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
m_clean ? m_configuration->moveCleanStepUp(pos) : m_configuration->moveBuildStepUp(pos);
|
||||||
m_clean ? bc->moveCleanStepUp(pos) : bc->moveBuildStepUp(pos);
|
|
||||||
|
|
||||||
m_vbox->insertWidget(pos - 1, m_buildSteps.at(pos).detailsWidget);
|
m_vbox->insertWidget(pos - 1, m_buildSteps.at(pos).detailsWidget);
|
||||||
|
|
||||||
BuildStepsWidgetStruct tmp = m_buildSteps.at(pos -1);
|
m_buildSteps.swap(pos - 1, pos);
|
||||||
m_buildSteps[pos -1] = m_buildSteps.at(pos);
|
|
||||||
m_buildSteps[pos] = tmp;
|
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()
|
void BuildStepsPage::updateBuildStepButtonsState()
|
||||||
{
|
{
|
||||||
BuildConfiguration *bc = m_pro->buildConfiguration(m_configuration);
|
const QList<BuildStep *> &steps = m_clean ? m_configuration->cleanSteps() : m_configuration->buildSteps();
|
||||||
const QList<BuildStep *> &steps = m_clean ? bc->cleanSteps() : bc->buildSteps();
|
for(int i = 0; i < m_buildSteps.count(); ++i) {
|
||||||
for(int i=0; i<m_buildSteps.count(); ++i) {
|
|
||||||
BuildStepsWidgetStruct s = m_buildSteps.at(i);
|
BuildStepsWidgetStruct s = m_buildSteps.at(i);
|
||||||
s.upButton->setEnabled((i>0) && !(steps.at(i)->immutable() && steps.at(i - 1)));
|
s.removeButton->setEnabled(!steps.at(i)->immutable());
|
||||||
s.downButton->setEnabled((i + 1< steps.count()) && !(steps.at(i)->immutable() && steps.at(i + 1)->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>
|
#include <utils/detailswidget.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QTreeWidgetItem;
|
|
||||||
class QHBoxLayout;
|
|
||||||
class QPushButton;
|
class QPushButton;
|
||||||
class QAbstractButton;
|
|
||||||
class QToolButton;
|
class QToolButton;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QVBoxLayout;
|
class QVBoxLayout;
|
||||||
|
class QSignalMapper;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class Project;
|
class Project;
|
||||||
|
class BuildConfiguration;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -59,7 +58,7 @@ struct BuildStepsWidgetStruct
|
|||||||
Utils::DetailsWidget *detailsWidget;
|
Utils::DetailsWidget *detailsWidget;
|
||||||
QToolButton *upButton;
|
QToolButton *upButton;
|
||||||
QToolButton *downButton;
|
QToolButton *downButton;
|
||||||
QHBoxLayout *hbox;
|
QPushButton *removeButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
class BuildStepsPage : public BuildConfigWidget
|
class BuildStepsPage : public BuildConfigWidget
|
||||||
@@ -71,35 +70,37 @@ public:
|
|||||||
virtual ~BuildStepsPage();
|
virtual ~BuildStepsPage();
|
||||||
|
|
||||||
QString displayName() const;
|
QString displayName() const;
|
||||||
void init(const QString &buildConfiguration);
|
void init(BuildConfiguration *bc);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateAddBuildStepMenu();
|
void updateAddBuildStepMenu();
|
||||||
void addBuildStep();
|
void addBuildStep();
|
||||||
void updateRemoveBuildStepMenu();
|
|
||||||
void removeBuildStep();
|
|
||||||
void upBuildStep();
|
|
||||||
void downBuildStep();
|
|
||||||
void updateSummary();
|
void updateSummary();
|
||||||
|
void stepMoveUp(int pos);
|
||||||
|
void stepMoveDown(int pos);
|
||||||
|
void stepRemove(int pos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void stepMoveUp(int pos);
|
void setupUi();
|
||||||
void updateBuildStepButtonsState();
|
void updateBuildStepButtonsState();
|
||||||
void addBuildStepWidget(int pos, BuildStep *step);
|
void addBuildStepWidget(int pos, BuildStep *step);
|
||||||
|
|
||||||
Project *m_pro;
|
BuildConfiguration * m_configuration;
|
||||||
QString m_configuration;
|
|
||||||
QHash<QAction *, QPair<QString, ProjectExplorer::IBuildStepFactory *> > m_addBuildStepHash;
|
QHash<QAction *, QPair<QString, ProjectExplorer::IBuildStepFactory *> > m_addBuildStepHash;
|
||||||
bool m_clean;
|
bool m_clean;
|
||||||
|
|
||||||
QList<QHBoxLayout *> m_titleLayouts;
|
|
||||||
QList<BuildStepsWidgetStruct> m_buildSteps;
|
QList<BuildStepsWidgetStruct> m_buildSteps;
|
||||||
|
|
||||||
QVBoxLayout *m_vbox;
|
QVBoxLayout *m_vbox;
|
||||||
|
|
||||||
QLabel *m_noStepsLabel;
|
QLabel *m_noStepsLabel;
|
||||||
QPushButton *m_addButton;
|
QPushButton *m_addButton;
|
||||||
QPushButton *m_removeButton;
|
|
||||||
|
QSignalMapper *m_upMapper;
|
||||||
|
QSignalMapper *m_downMapper;
|
||||||
|
QSignalMapper *m_removeMapper;
|
||||||
|
|
||||||
|
int m_leftMargin;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Internal
|
} // Internal
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <projectexplorer/debugginghelper.h>
|
#include <projectexplorer/debugginghelper.h>
|
||||||
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <utils/detailswidget.h>
|
#include <utils/detailswidget.h>
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
|
|
||||||
@@ -251,8 +252,9 @@ CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Project *pro)
|
|||||||
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
|
connect(pro, SIGNAL(activeBuildConfigurationChanged()),
|
||||||
this, SIGNAL(baseEnvironmentChanged()));
|
this, SIGNAL(baseEnvironmentChanged()));
|
||||||
|
|
||||||
connect(pro, SIGNAL(environmentChanged(QString)),
|
// TODO
|
||||||
this, SIGNAL(baseEnvironmentChanged()));
|
// connect(pro, SIGNAL(environmentChanged(ProjectExplorer::BuildConfiguration *)),
|
||||||
|
// this, SIGNAL(baseEnvironmentChanged()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,7 +281,7 @@ QString CustomExecutableRunConfiguration::executable() const
|
|||||||
{
|
{
|
||||||
QString exec;
|
QString exec;
|
||||||
if (QDir::isRelativePath(m_executable)) {
|
if (QDir::isRelativePath(m_executable)) {
|
||||||
Environment env = project()->environment(project()->activeBuildConfiguration());
|
Environment env = project()->activeBuildConfiguration()->environment();
|
||||||
exec = env.searchInPath(m_executable);
|
exec = env.searchInPath(m_executable);
|
||||||
} else {
|
} else {
|
||||||
exec = m_executable;
|
exec = m_executable;
|
||||||
@@ -328,7 +330,7 @@ QString CustomExecutableRunConfiguration::baseWorkingDirectory() const
|
|||||||
QString CustomExecutableRunConfiguration::workingDirectory() const
|
QString CustomExecutableRunConfiguration::workingDirectory() const
|
||||||
{
|
{
|
||||||
QString wd = m_workingDirectory;
|
QString wd = m_workingDirectory;
|
||||||
QString bd = project()->buildDirectory(project()->activeBuildConfiguration());
|
QString bd = project()->activeBuildConfiguration()->buildDirectory();
|
||||||
return wd.replace("$BUILDDIR", QDir::cleanPath(bd));
|
return wd.replace("$BUILDDIR", QDir::cleanPath(bd));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -345,7 +347,7 @@ ProjectExplorer::Environment CustomExecutableRunConfiguration::baseEnvironment()
|
|||||||
} else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::SystemEnvironmentBase) {
|
} else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::SystemEnvironmentBase) {
|
||||||
env = ProjectExplorer::Environment::systemEnvironment();
|
env = ProjectExplorer::Environment::systemEnvironment();
|
||||||
} else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::BuildEnvironmentBase) {
|
} else if (m_baseEnvironmentBase == CustomExecutableRunConfiguration::BuildEnvironmentBase) {
|
||||||
env = project()->environment(project()->activeBuildConfiguration());
|
env = project()->activeBuildConfiguration()->environment();
|
||||||
}
|
}
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
#include "processstep.h"
|
#include "processstep.h"
|
||||||
#include "buildstep.h"
|
#include "buildstep.h"
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
|
#include "buildconfiguration.h"
|
||||||
|
|
||||||
#include <coreplugin/ifile.h>
|
#include <coreplugin/ifile.h>
|
||||||
#include <utils/qtcassert.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_ARGUMENTS = "abstractProcess.arguments";
|
||||||
static const char * const PROCESS_ENABLED = "abstractProcess.enabled";
|
static const char * const PROCESS_ENABLED = "abstractProcess.enabled";
|
||||||
|
|
||||||
ProcessStep::ProcessStep(Project *pro, BuildConfiguration *bc)
|
ProcessStep::ProcessStep(BuildConfiguration *bc)
|
||||||
: AbstractProcessStep(pro, bc)
|
: AbstractProcessStep(bc)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -64,12 +65,12 @@ ProcessStep::ProcessStep(ProcessStep *bs, BuildConfiguration *bc)
|
|||||||
|
|
||||||
bool ProcessStep::init()
|
bool ProcessStep::init()
|
||||||
{
|
{
|
||||||
setEnvironment(project()->environment(buildConfiguration()));
|
setEnvironment(buildConfiguration()->environment());
|
||||||
QString wd = workingDirectory();
|
QString wd = workingDirectory();
|
||||||
if (wd.isEmpty())
|
if (wd.isEmpty())
|
||||||
wd = "$BUILDDIR";
|
wd = "$BUILDDIR";
|
||||||
|
|
||||||
AbstractProcessStep::setWorkingDirectory(wd.replace("$BUILDDIR", project()->buildDirectory(buildConfiguration())));
|
AbstractProcessStep::setWorkingDirectory(wd.replace("$BUILDDIR", buildConfiguration()->buildDirectory()));
|
||||||
AbstractProcessStep::setCommand(m_command);
|
AbstractProcessStep::setCommand(m_command);
|
||||||
AbstractProcessStep::setEnabled(m_enabled);
|
AbstractProcessStep::setEnabled(m_enabled);
|
||||||
AbstractProcessStep::setArguments(m_arguments);
|
AbstractProcessStep::setArguments(m_arguments);
|
||||||
@@ -200,10 +201,10 @@ bool ProcessStepFactory::canCreate(const QString &name) const
|
|||||||
return name == "projectexplorer.processstep";
|
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)
|
Q_UNUSED(name)
|
||||||
return new ProcessStep(pro, bc);
|
return new ProcessStep(bc);
|
||||||
}
|
}
|
||||||
|
|
||||||
BuildStep *ProcessStepFactory::clone(BuildStep *bs, BuildConfiguration *bc) const
|
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);
|
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";
|
return QStringList()<<"projectexplorer.processstep";
|
||||||
}
|
}
|
||||||
QString ProcessStepFactory::displayNameForName(const QString &name) const
|
QString ProcessStepFactory::displayNameForName(const QString &name) const
|
||||||
|
@@ -45,9 +45,9 @@ class ProcessStepFactory : public IBuildStepFactory
|
|||||||
public:
|
public:
|
||||||
ProcessStepFactory();
|
ProcessStepFactory();
|
||||||
virtual bool canCreate(const QString &name) const;
|
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 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;
|
virtual QString displayNameForName(const QString &name) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ class ProcessStep : public ProjectExplorer::AbstractProcessStep
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ProcessStep(Project *pro, BuildConfiguration *bc);
|
ProcessStep(BuildConfiguration *bc);
|
||||||
ProcessStep(ProcessStep *bs, BuildConfiguration *bc);
|
ProcessStep(ProcessStep *bs, BuildConfiguration *bc);
|
||||||
virtual bool init();
|
virtual bool init();
|
||||||
virtual void run(QFutureInterface<bool> &);
|
virtual void run(QFutureInterface<bool> &);
|
||||||
|
@@ -74,15 +74,6 @@ QString Project::makeUnique(const QString &preferedName, const QStringList &used
|
|||||||
|
|
||||||
void Project::addBuildConfiguration(BuildConfiguration *configuration)
|
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
|
// Check that we don't have a configuration with the same displayName
|
||||||
QString configurationDisplayName = configuration->displayName();
|
QString configurationDisplayName = configuration->displayName();
|
||||||
QStringList displayNames;
|
QStringList displayNames;
|
||||||
@@ -94,7 +85,7 @@ void Project::addBuildConfiguration(BuildConfiguration *configuration)
|
|||||||
// add it
|
// add it
|
||||||
m_buildConfigurationValues.push_back(configuration);
|
m_buildConfigurationValues.push_back(configuration);
|
||||||
|
|
||||||
emit addedBuildConfiguration(this, configuration->name());
|
emit addedBuildConfiguration(this, configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::removeBuildConfiguration(BuildConfiguration *configuration)
|
void Project::removeBuildConfiguration(BuildConfiguration *configuration)
|
||||||
@@ -105,21 +96,10 @@ void Project::removeBuildConfiguration(BuildConfiguration *configuration)
|
|||||||
|
|
||||||
m_buildConfigurationValues.removeOne(configuration);
|
m_buildConfigurationValues.removeOne(configuration);
|
||||||
|
|
||||||
emit removedBuildConfiguration(this, configuration->name());
|
emit removedBuildConfiguration(this, configuration);
|
||||||
delete 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
|
QList<BuildConfiguration *> Project::buildConfigurations() const
|
||||||
{
|
{
|
||||||
return m_buildConfigurationValues;
|
return m_buildConfigurationValues;
|
||||||
@@ -144,7 +124,7 @@ bool Project::restoreSettings()
|
|||||||
if (!restoreSettingsImpl(reader))
|
if (!restoreSettingsImpl(reader))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_activeBuildConfiguration.isEmpty() && !m_buildConfigurationValues.isEmpty())
|
if (m_activeBuildConfiguration && !m_buildConfigurationValues.isEmpty())
|
||||||
setActiveBuildConfiguration(m_buildConfigurationValues.at(0));
|
setActiveBuildConfiguration(m_buildConfigurationValues.at(0));
|
||||||
|
|
||||||
if (!m_activeRunConfiguration && !m_runConfigurations.isEmpty())
|
if (!m_activeRunConfiguration && !m_runConfigurations.isEmpty())
|
||||||
@@ -159,47 +139,48 @@ QList<BuildConfigWidget*> Project::subConfigWidgets()
|
|||||||
|
|
||||||
void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
|
void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
|
||||||
{
|
{
|
||||||
writer.saveValue("activebuildconfiguration", m_activeBuildConfiguration);
|
const QList<BuildConfiguration *> bcs = buildConfigurations();
|
||||||
//save m_values
|
|
||||||
writer.saveValue("project", m_values);
|
// 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
|
//save buildsettings
|
||||||
QStringList buildConfigurationNames;
|
QStringList buildConfigurationNames;
|
||||||
foreach (const BuildConfiguration *bc, buildConfigurations()) {
|
for(int i=0; i < bcs.size(); ++i) {
|
||||||
QMap<QString, QVariant> temp = bc->toMap();
|
QMap<QString, QVariant> temp = bcs.at(i)->toMap();
|
||||||
writer.saveValue("buildConfiguration-" + bc->name(), temp);
|
writer.saveValue("buildConfiguration-" + QString::number(i), temp);
|
||||||
buildConfigurationNames << bc->name();
|
buildConfigurationNames << QString::number(i);
|
||||||
}
|
}
|
||||||
writer.saveValue("buildconfigurations", buildConfigurationNames);
|
writer.saveValue("buildconfigurations", buildConfigurationNames);
|
||||||
|
|
||||||
// save each buildstep/buildConfiguration combination
|
// save each buildstep/buildConfiguration combination
|
||||||
foreach (const BuildConfiguration *bc, buildConfigurations()) {
|
for(int i=0; i < bcs.size(); ++i) {
|
||||||
QStringList buildStepNames;
|
QStringList buildStepNames;
|
||||||
foreach (BuildStep *buildStep, bc->buildSteps())
|
foreach (BuildStep *buildStep, bcs.at(i)->buildSteps())
|
||||||
buildStepNames << buildStep->name();
|
buildStepNames << buildStep->name();
|
||||||
writer.saveValue("buildconfiguration-" + bc->name() + "-buildsteps", buildStepNames);
|
writer.saveValue("buildconfiguration-" + QString::number(i) + "-buildsteps", buildStepNames);
|
||||||
|
|
||||||
int buildstepnr = 0;
|
int buildstepnr = 0;
|
||||||
foreach (BuildStep *buildStep, bc->buildSteps()) {
|
foreach (BuildStep *buildStep, bcs.at(i)->buildSteps()) {
|
||||||
QMap<QString, QVariant> temp;
|
QMap<QString, QVariant> temp;
|
||||||
buildStep->storeIntoLocalMap(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;
|
++buildstepnr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// save each cleanstep/buildConfiguration combination
|
// save each cleanstep/buildConfiguration combination
|
||||||
foreach (const BuildConfiguration *bc, buildConfigurations()) {
|
for(int i=0; i < bcs.size(); ++i) {
|
||||||
QStringList cleanStepNames;
|
QStringList cleanStepNames;
|
||||||
foreach (BuildStep *cleanStep, bc->cleanSteps())
|
foreach (BuildStep *cleanStep, bcs.at(i)->cleanSteps())
|
||||||
cleanStepNames << cleanStep->name();
|
cleanStepNames << cleanStep->name();
|
||||||
writer.saveValue("buildconfiguration-" + bc->name() + "-cleansteps", cleanStepNames);
|
writer.saveValue("buildconfiguration-" + QString::number(i) + "-cleansteps", cleanStepNames);
|
||||||
|
|
||||||
int cleanstepnr = 0;
|
int cleanstepnr = 0;
|
||||||
foreach (BuildStep *cleanStep, bc->cleanSteps()) {
|
foreach (BuildStep *cleanStep, bcs.at(i)->cleanSteps()) {
|
||||||
QMap<QString, QVariant> temp;
|
QMap<QString, QVariant> temp;
|
||||||
cleanStep->storeIntoLocalMap(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;
|
++cleanstepnr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,24 +204,21 @@ void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
|
|||||||
|
|
||||||
bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||||
{
|
{
|
||||||
m_activeBuildConfiguration = reader.restoreValue("activebuildconfiguration").toString();
|
|
||||||
|
|
||||||
m_values = reader.restoreValue("project").toMap();
|
|
||||||
|
|
||||||
const QList<IBuildStepFactory *> buildStepFactories =
|
const QList<IBuildStepFactory *> buildStepFactories =
|
||||||
ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>();
|
ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>();
|
||||||
|
|
||||||
// restoring BuldConfigurations from settings
|
// restoring BuldConfigurations from settings
|
||||||
const QStringList buildConfigurationNames = reader.restoreValue("buildconfigurations").toStringList();
|
const QStringList buildConfigurationNames = reader.restoreValue("buildconfigurations").toStringList();
|
||||||
|
|
||||||
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
||||||
BuildConfiguration *bc = new BuildConfiguration(buildConfigurationName);
|
BuildConfiguration *bc = buildConfigurationFactory()->restore();
|
||||||
addBuildConfiguration(bc);
|
|
||||||
QMap<QString, QVariant> temp =
|
QMap<QString, QVariant> temp =
|
||||||
reader.restoreValue("buildConfiguration-" + buildConfigurationName).toMap();
|
reader.restoreValue("buildConfiguration-" + buildConfigurationName).toMap();
|
||||||
bc->setValuesFromMap(temp);
|
bc->setValuesFromMap(temp);
|
||||||
|
|
||||||
// Restore build steps
|
// Restore build steps
|
||||||
QVariant buildStepsValueVariant = reader.restoreValue("buildconfiguration-" + bc->name() + "-buildsteps");
|
QVariant buildStepsValueVariant = reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-buildsteps");
|
||||||
if(buildStepsValueVariant.isValid()) {
|
if(buildStepsValueVariant.isValid()) {
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
QStringList buildStepNames = buildStepsValueVariant.toStringList();
|
QStringList buildStepNames = buildStepsValueVariant.toStringList();
|
||||||
@@ -249,7 +227,7 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
|||||||
BuildStep *buildStep = 0;
|
BuildStep *buildStep = 0;
|
||||||
foreach (IBuildStepFactory *factory, buildStepFactories) {
|
foreach (IBuildStepFactory *factory, buildStepFactories) {
|
||||||
if (factory->canCreate(buildStepName)) {
|
if (factory->canCreate(buildStepName)) {
|
||||||
buildStep = factory->create(this, bc, buildStepName);
|
buildStep = factory->create(bc, buildStepName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -259,7 +237,7 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
|||||||
QMap<QString, QVariant> buildStepValues = reader.restoreValue("buildstep" + QString().setNum(buildstepnr)).toMap();
|
QMap<QString, QVariant> buildStepValues = reader.restoreValue("buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||||
buildStep->restoreFromGlobalMap(buildStepValues);
|
buildStep->restoreFromGlobalMap(buildStepValues);
|
||||||
buildStepValues =
|
buildStepValues =
|
||||||
reader.restoreValue("buildconfiguration-" + bc->name() + "-buildstep" + QString().setNum(buildstepnr)).toMap();
|
reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||||
buildStep->restoreFromLocalMap(buildStepValues);
|
buildStep->restoreFromLocalMap(buildStepValues);
|
||||||
bc->insertBuildStep(pos, buildStep);
|
bc->insertBuildStep(pos, buildStep);
|
||||||
++pos;
|
++pos;
|
||||||
@@ -267,7 +245,7 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Restore clean steps
|
// Restore clean steps
|
||||||
QVariant cleanStepsValueVariant = reader.restoreValue("buildconfiguration-" + bc->name() + "-cleansteps");
|
QVariant cleanStepsValueVariant = reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-cleansteps");
|
||||||
if(cleanStepsValueVariant.isValid()) {
|
if(cleanStepsValueVariant.isValid()) {
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
QStringList cleanStepNames = cleanStepsValueVariant.toStringList();
|
QStringList cleanStepNames = cleanStepsValueVariant.toStringList();
|
||||||
@@ -276,7 +254,7 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
|||||||
BuildStep *cleanStep = 0;
|
BuildStep *cleanStep = 0;
|
||||||
foreach (IBuildStepFactory *factory, buildStepFactories) {
|
foreach (IBuildStepFactory *factory, buildStepFactories) {
|
||||||
if (factory->canCreate(cleanStepName)) {
|
if (factory->canCreate(cleanStepName)) {
|
||||||
cleanStep = factory->create(this, bc, cleanStepName);
|
cleanStep = factory->create(bc, cleanStepName);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,13 +264,26 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
|||||||
QMap<QString, QVariant> buildStepValues = reader.restoreValue("cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
QMap<QString, QVariant> buildStepValues = reader.restoreValue("cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||||
cleanStep->restoreFromGlobalMap(buildStepValues);
|
cleanStep->restoreFromGlobalMap(buildStepValues);
|
||||||
buildStepValues =
|
buildStepValues =
|
||||||
reader.restoreValue("buildconfiguration-" + bc->name() + "-cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||||
cleanStep->restoreFromLocalMap(buildStepValues);
|
cleanStep->restoreFromLocalMap(buildStepValues);
|
||||||
bc->insertCleanStep(pos, cleanStep);
|
bc->insertCleanStep(pos, cleanStep);
|
||||||
++pos;
|
++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
|
//Build Settings
|
||||||
@@ -313,13 +304,14 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (factory) {
|
if (factory) {
|
||||||
foreach(BuildConfiguration *bc, buildConfigurations()) {
|
const QList<BuildConfiguration *> &bcs = buildConfigurations();
|
||||||
buildStep = factory->create(this, bc, buildStepName);
|
for(int i = 0; i < bcs.size(); ++i) {
|
||||||
bc->insertBuildStep(pos, buildStep);
|
buildStep = factory->create(bcs.at(i), buildStepName);
|
||||||
|
bcs.at(i)->insertBuildStep(pos, buildStep);
|
||||||
QMap<QString, QVariant> buildStepValues = reader.restoreValue("buildstep" + QString().setNum(buildstepnr)).toMap();
|
QMap<QString, QVariant> buildStepValues = reader.restoreValue("buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||||
buildStep->restoreFromGlobalMap(buildStepValues);
|
buildStep->restoreFromGlobalMap(buildStepValues);
|
||||||
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);
|
buildStep->restoreFromLocalMap(buildStepValues);
|
||||||
}
|
}
|
||||||
++pos;
|
++pos;
|
||||||
@@ -345,13 +337,14 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (factory) {
|
if (factory) {
|
||||||
foreach(BuildConfiguration *bc, buildConfigurations()) {
|
const QList<BuildConfiguration *> &bcs = buildConfigurations();
|
||||||
cleanStep = factory->create(this, bc, cleanStepName);
|
for (int i = 0; i < bcs.size(); ++i) {
|
||||||
bc->insertCleanStep(pos, cleanStep);
|
cleanStep = factory->create(bcs.at(i), cleanStepName);
|
||||||
|
bcs.at(i)->insertCleanStep(pos, cleanStep);
|
||||||
QMap<QString, QVariant> cleanStepValues = reader.restoreValue("cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
QMap<QString, QVariant> cleanStepValues = reader.restoreValue("cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||||
cleanStep->restoreFromGlobalMap(cleanStepValues);
|
cleanStep->restoreFromGlobalMap(cleanStepValues);
|
||||||
QMap<QString, QVariant> buildStepValues =
|
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);
|
cleanStep->restoreFromLocalMap(buildStepValues);
|
||||||
}
|
}
|
||||||
++pos;
|
++pos;
|
||||||
@@ -392,38 +385,15 @@ bool Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
|||||||
return true;
|
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
|
BuildConfiguration *Project::activeBuildConfiguration() const
|
||||||
{
|
{
|
||||||
return buildConfiguration(m_activeBuildConfiguration); //TODO
|
return m_activeBuildConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::setActiveBuildConfiguration(BuildConfiguration *configuration)
|
void Project::setActiveBuildConfiguration(BuildConfiguration *configuration)
|
||||||
{
|
{
|
||||||
if (m_activeBuildConfiguration != configuration->name() && m_buildConfigurationValues.contains(configuration)) {
|
if (m_activeBuildConfiguration != configuration && m_buildConfigurationValues.contains(configuration)) {
|
||||||
m_activeBuildConfiguration = configuration->name();
|
m_activeBuildConfiguration = configuration;
|
||||||
emit activeBuildConfigurationChanged();
|
emit activeBuildConfigurationChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -483,23 +453,6 @@ EditorConfiguration *Project::editorConfiguration() const
|
|||||||
return m_editorConfiguration;
|
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
|
QByteArray Project::predefinedMacros(const QString &) const
|
||||||
{
|
{
|
||||||
return QByteArray();
|
return QByteArray();
|
||||||
|
@@ -86,19 +86,13 @@ public:
|
|||||||
// Build configuration
|
// Build configuration
|
||||||
void addBuildConfiguration(BuildConfiguration *configuration);
|
void addBuildConfiguration(BuildConfiguration *configuration);
|
||||||
void removeBuildConfiguration(BuildConfiguration *configuration);
|
void removeBuildConfiguration(BuildConfiguration *configuration);
|
||||||
void copyBuildConfiguration(const QString &source, const QString &dest);
|
|
||||||
BuildConfiguration *buildConfiguration(const QString & name) const;
|
|
||||||
QList<BuildConfiguration *> buildConfigurations() 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;
|
BuildConfiguration *activeBuildConfiguration() const;
|
||||||
void setActiveBuildConfiguration(BuildConfiguration *configuration);
|
void setActiveBuildConfiguration(BuildConfiguration *configuration);
|
||||||
|
|
||||||
virtual IBuildConfigurationFactory *buildConfigurationFactory() const = 0;
|
virtual IBuildConfigurationFactory *buildConfigurationFactory() const = 0;
|
||||||
|
|
||||||
void setValue(const QString &name, const QVariant &value);
|
|
||||||
QVariant value(const QString &name) const;
|
|
||||||
|
|
||||||
// Running
|
// Running
|
||||||
QList<RunConfiguration *> runConfigurations() const;
|
QList<RunConfiguration *> runConfigurations() const;
|
||||||
void addRunConfiguration(RunConfiguration* runConfiguration);
|
void addRunConfiguration(RunConfiguration* runConfiguration);
|
||||||
@@ -109,9 +103,6 @@ public:
|
|||||||
|
|
||||||
EditorConfiguration *editorConfiguration() const;
|
EditorConfiguration *editorConfiguration() const;
|
||||||
|
|
||||||
virtual Environment environment(BuildConfiguration *configuration) const = 0;
|
|
||||||
virtual QString buildDirectory(BuildConfiguration *configuration) const = 0;
|
|
||||||
|
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
bool restoreSettings();
|
bool restoreSettings();
|
||||||
|
|
||||||
@@ -132,7 +123,6 @@ public:
|
|||||||
static QString makeUnique(const QString &preferedName, const QStringList &usedNames);
|
static QString makeUnique(const QString &preferedName, const QStringList &usedNames);
|
||||||
signals:
|
signals:
|
||||||
void fileListChanged();
|
void fileListChanged();
|
||||||
void buildDirectoryChanged();
|
|
||||||
|
|
||||||
// TODO clean up signal names
|
// TODO clean up signal names
|
||||||
// might be better to also have
|
// might be better to also have
|
||||||
@@ -146,12 +136,8 @@ signals:
|
|||||||
void removedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
|
void removedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
|
||||||
void addedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
|
void addedRunConfiguration(ProjectExplorer::Project *p, const QString &name);
|
||||||
|
|
||||||
void removedBuildConfiguration(ProjectExplorer::Project *p, const QString &name);
|
void removedBuildConfiguration(ProjectExplorer::Project *p, ProjectExplorer::BuildConfiguration *bc);
|
||||||
void addedBuildConfiguration(ProjectExplorer::Project *p, const QString &name);
|
void addedBuildConfiguration(ProjectExplorer::Project *p, ProjectExplorer::BuildConfiguration *bc);
|
||||||
|
|
||||||
// This signal is jut there for updating the tree list in the buildsettings wizard
|
|
||||||
void buildConfigurationDisplayNameChanged(const QString &buildConfiguration);
|
|
||||||
void environmentChanged(const QString &buildConfiguration);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* This method is called when the project .user file is saved. Simply call
|
/* This method is called when the project .user file is saved. Simply call
|
||||||
@@ -173,9 +159,8 @@ protected:
|
|||||||
virtual bool restoreSettingsImpl(PersistentSettingsReader &reader);
|
virtual bool restoreSettingsImpl(PersistentSettingsReader &reader);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<QString, QVariant> m_values;
|
|
||||||
QList<BuildConfiguration *> m_buildConfigurationValues;
|
QList<BuildConfiguration *> m_buildConfigurationValues;
|
||||||
QString m_activeBuildConfiguration;
|
BuildConfiguration *m_activeBuildConfiguration;
|
||||||
QList<RunConfiguration *> m_runConfigurations;
|
QList<RunConfiguration *> m_runConfigurations;
|
||||||
RunConfiguration* m_activeRunConfiguration;
|
RunConfiguration* m_activeRunConfiguration;
|
||||||
EditorConfiguration *m_editorConfiguration;
|
EditorConfiguration *m_editorConfiguration;
|
||||||
|
@@ -307,7 +307,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
|
|||||||
// Build parsers
|
// Build parsers
|
||||||
addAutoReleasedObject(new GccParserFactory);
|
addAutoReleasedObject(new GccParserFactory);
|
||||||
addAutoReleasedObject(new MsvcParserFactory);
|
addAutoReleasedObject(new MsvcParserFactory);
|
||||||
addAutoReleasedObject(new QMakeParserFactory);
|
|
||||||
|
|
||||||
// Settings page
|
// Settings page
|
||||||
addAutoReleasedObject(new ProjectExplorerSettingsPage);
|
addAutoReleasedObject(new ProjectExplorerSettingsPage);
|
||||||
@@ -1424,20 +1423,7 @@ void ProjectExplorerPlugin::buildProjectOnly()
|
|||||||
qDebug() << "ProjectExplorerPlugin::buildProjectOnly";
|
qDebug() << "ProjectExplorerPlugin::buildProjectOnly";
|
||||||
|
|
||||||
if (saveModifiedFiles())
|
if (saveModifiedFiles())
|
||||||
buildManager()->buildProject(d->m_currentProject, d->m_currentProject->activeBuildConfiguration()->name());
|
buildManager()->buildProject(d->m_currentProject->activeBuildConfiguration());
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::buildProject()
|
void ProjectExplorerPlugin::buildProject()
|
||||||
@@ -1446,8 +1432,11 @@ void ProjectExplorerPlugin::buildProject()
|
|||||||
qDebug() << "ProjectExplorerPlugin::buildProject";
|
qDebug() << "ProjectExplorerPlugin::buildProject";
|
||||||
|
|
||||||
if (saveModifiedFiles()) {
|
if (saveModifiedFiles()) {
|
||||||
const QList<Project *> & projects = d->m_session->projectOrder(d->m_currentProject);
|
QList<BuildConfiguration *> configurations;
|
||||||
d->m_buildManager->buildProjects(projects, configurations(projects));
|
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";
|
qDebug() << "ProjectExplorerPlugin::buildSession";
|
||||||
|
|
||||||
if (saveModifiedFiles()) {
|
if (saveModifiedFiles()) {
|
||||||
const QList<Project *> & projects = d->m_session->projectOrder();
|
QList<BuildConfiguration *> configurations;
|
||||||
d->m_buildManager->buildProjects(projects, configurations(projects));
|
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";
|
qDebug() << "ProjectExplorerPlugin::rebuildProjectOnly";
|
||||||
|
|
||||||
if (saveModifiedFiles()) {
|
if (saveModifiedFiles()) {
|
||||||
d->m_buildManager->cleanProject(d->m_currentProject, d->m_currentProject->activeBuildConfiguration()->name());
|
d->m_buildManager->cleanProject(d->m_currentProject->activeBuildConfiguration());
|
||||||
d->m_buildManager->buildProject(d->m_currentProject, d->m_currentProject->activeBuildConfiguration()->name());
|
d->m_buildManager->buildProject(d->m_currentProject->activeBuildConfiguration());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1479,11 +1470,13 @@ void ProjectExplorerPlugin::rebuildProject()
|
|||||||
qDebug() << "ProjectExplorerPlugin::rebuildProject";
|
qDebug() << "ProjectExplorerPlugin::rebuildProject";
|
||||||
|
|
||||||
if (saveModifiedFiles()) {
|
if (saveModifiedFiles()) {
|
||||||
const QList<Project *> & projects = d->m_session->projectOrder(d->m_currentProject);
|
const QList<Project *> &projects = d->m_session->projectOrder(d->m_currentProject);
|
||||||
const QStringList configs = configurations(projects);
|
QList<BuildConfiguration *> configurations;
|
||||||
|
foreach (Project *pro, projects)
|
||||||
|
configurations << pro->activeBuildConfiguration();
|
||||||
|
|
||||||
d->m_buildManager->cleanProjects(projects, configs);
|
d->m_buildManager->cleanProjects(configurations);
|
||||||
d->m_buildManager->buildProjects(projects, configs);
|
d->m_buildManager->buildProjects(configurations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1494,10 +1487,12 @@ void ProjectExplorerPlugin::rebuildSession()
|
|||||||
|
|
||||||
if (saveModifiedFiles()) {
|
if (saveModifiedFiles()) {
|
||||||
const QList<Project *> & projects = d->m_session->projectOrder();
|
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->cleanProjects(configurations);
|
||||||
d->m_buildManager->buildProjects(projects, configs);
|
d->m_buildManager->buildProjects(configurations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1507,7 +1502,7 @@ void ProjectExplorerPlugin::cleanProjectOnly()
|
|||||||
qDebug() << "ProjectExplorerPlugin::cleanProjectOnly";
|
qDebug() << "ProjectExplorerPlugin::cleanProjectOnly";
|
||||||
|
|
||||||
if (saveModifiedFiles())
|
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()
|
void ProjectExplorerPlugin::cleanProject()
|
||||||
@@ -1517,7 +1512,10 @@ void ProjectExplorerPlugin::cleanProject()
|
|||||||
|
|
||||||
if (saveModifiedFiles()) {
|
if (saveModifiedFiles()) {
|
||||||
const QList<Project *> & projects = d->m_session->projectOrder(d->m_currentProject);
|
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()) {
|
if (saveModifiedFiles()) {
|
||||||
const QList<Project *> & projects = d->m_session->projectOrder();
|
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()
|
void ProjectExplorerPlugin::runProject()
|
||||||
{
|
{
|
||||||
runProjectImpl(startupProject());
|
runProjectImpl(startupProject(), ProjectExplorer::Constants::RUNMODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::runProjectContextMenu()
|
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)
|
if (!pro)
|
||||||
return;
|
return;
|
||||||
@@ -1553,16 +1554,21 @@ void ProjectExplorerPlugin::runProjectImpl(Project *pro)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (saveModifiedFiles()) {
|
if (saveModifiedFiles()) {
|
||||||
d->m_runMode = ProjectExplorer::Constants::RUNMODE;
|
d->m_runMode = mode;
|
||||||
d->m_delayedRunConfiguration = pro->activeRunConfiguration();
|
d->m_delayedRunConfiguration = pro->activeRunConfiguration();
|
||||||
|
|
||||||
const QList<Project *> & projects = d->m_session->projectOrder(pro);
|
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 {
|
} else {
|
||||||
// TODO this ignores RunConfiguration::isEnabled()
|
// TODO this ignores RunConfiguration::isEnabled()
|
||||||
if (saveModifiedFiles())
|
if (saveModifiedFiles())
|
||||||
executeRunConfiguration(pro->activeRunConfiguration(), ProjectExplorer::Constants::RUNMODE);
|
executeRunConfiguration(pro->activeRunConfiguration(), mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1572,25 +1578,7 @@ void ProjectExplorerPlugin::debugProject()
|
|||||||
if (!pro || d->m_debuggingRunControl )
|
if (!pro || d->m_debuggingRunControl )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (d->m_projectExplorerSettings.buildBeforeRun && pro->hasBuildSettings()) {
|
runProjectImpl(pro, ProjectExplorer::Constants::DEBUGMODE);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProjectExplorerPlugin::showBuildConfigDialog()
|
bool ProjectExplorerPlugin::showBuildConfigDialog()
|
||||||
@@ -1965,14 +1953,14 @@ void ProjectExplorerPlugin::populateBuildConfigurationMenu()
|
|||||||
d->m_buildConfigurationMenu->clear();
|
d->m_buildConfigurationMenu->clear();
|
||||||
if (Project *pro = d->m_currentProject) {
|
if (Project *pro = d->m_currentProject) {
|
||||||
const BuildConfiguration *activeBC = pro->activeBuildConfiguration();
|
const BuildConfiguration *activeBC = pro->activeBuildConfiguration();
|
||||||
foreach (const BuildConfiguration *bc, pro->buildConfigurations()) {
|
foreach (BuildConfiguration *bc, pro->buildConfigurations()) {
|
||||||
QString displayName = bc->displayName();
|
QString displayName = bc->displayName();
|
||||||
QAction *act = new QAction(displayName, d->m_buildConfigurationActionGroup);
|
QAction *act = new QAction(displayName, d->m_buildConfigurationActionGroup);
|
||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "BuildConfiguration " << bc->name() << "active: " << activeBC->name();
|
qDebug() << "BuildConfiguration " << bc->displayName() << "active: " << activeBC->displayName();
|
||||||
act->setCheckable(true);
|
act->setCheckable(true);
|
||||||
act->setChecked(bc == activeBC);
|
act->setChecked(bc == activeBC);
|
||||||
act->setData(bc->name());
|
act->setData(QVariant::fromValue(bc));
|
||||||
d->m_buildConfigurationMenu->addAction(act);
|
d->m_buildConfigurationMenu->addAction(act);
|
||||||
}
|
}
|
||||||
d->m_buildConfigurationMenu->setEnabled(true);
|
d->m_buildConfigurationMenu->setEnabled(true);
|
||||||
@@ -1986,8 +1974,7 @@ void ProjectExplorerPlugin::buildConfigurationMenuTriggered(QAction *action)
|
|||||||
if (debug)
|
if (debug)
|
||||||
qDebug() << "ProjectExplorerPlugin::buildConfigurationMenuTriggered";
|
qDebug() << "ProjectExplorerPlugin::buildConfigurationMenuTriggered";
|
||||||
|
|
||||||
d->m_currentProject->setActiveBuildConfiguration(d->m_currentProject->buildConfiguration(
|
d->m_currentProject->setActiveBuildConfiguration(action->data().value<BuildConfiguration *>());
|
||||||
action->data().toString()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProjectExplorerPlugin::populateRunConfigurationMenu()
|
void ProjectExplorerPlugin::populateRunConfigurationMenu()
|
||||||
@@ -2136,9 +2123,6 @@ Internal::ProjectExplorerSettings ProjectExplorerPlugin::projectExplorerSettings
|
|||||||
return d->m_projectExplorerSettings;
|
return d->m_projectExplorerSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- BuildConfigDialog -----------
|
|
||||||
Q_DECLARE_METATYPE(BuildConfiguration*);
|
|
||||||
|
|
||||||
BuildConfigDialog::BuildConfigDialog(Project *project, QWidget *parent)
|
BuildConfigDialog::BuildConfigDialog(Project *project, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
m_project(project)
|
m_project(project)
|
||||||
@@ -2173,7 +2157,7 @@ BuildConfigDialog::BuildConfigDialog(Project *project, QWidget *parent)
|
|||||||
RunConfiguration *activeRun = m_project->activeRunConfiguration();
|
RunConfiguration *activeRun = m_project->activeRunConfiguration();
|
||||||
foreach (BuildConfiguration *config, m_project->buildConfigurations()) {
|
foreach (BuildConfiguration *config, m_project->buildConfigurations()) {
|
||||||
if (activeRun->isEnabled(config)) {
|
if (activeRun->isEnabled(config)) {
|
||||||
m_configCombo->addItem(config->name(), qVariantFromValue(config));
|
m_configCombo->addItem(config->displayName(), QVariant::fromValue(config));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_configCombo->count() == 0) {
|
if (m_configCombo->count() == 0) {
|
||||||
|
@@ -215,7 +215,7 @@ private slots:
|
|||||||
void currentModeChanged(Core::IMode *mode);
|
void currentModeChanged(Core::IMode *mode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void runProjectImpl(Project *pro);
|
void runProjectImpl(Project *pro, QString mode);
|
||||||
void executeRunConfiguration(RunConfiguration *, const QString &mode);
|
void executeRunConfiguration(RunConfiguration *, const QString &mode);
|
||||||
bool showBuildConfigDialog();
|
bool showBuildConfigDialog();
|
||||||
|
|
||||||
|
@@ -66,7 +66,6 @@ HEADERS += projectexplorer.h \
|
|||||||
projectexplorersettingspage.h \
|
projectexplorersettingspage.h \
|
||||||
projectwelcomepage.h \
|
projectwelcomepage.h \
|
||||||
projectwelcomepagewidget.h \
|
projectwelcomepagewidget.h \
|
||||||
qmakeparser.h \
|
|
||||||
baseprojectwizarddialog.h
|
baseprojectwizarddialog.h
|
||||||
SOURCES += projectexplorer.cpp \
|
SOURCES += projectexplorer.cpp \
|
||||||
projectwindow.cpp \
|
projectwindow.cpp \
|
||||||
@@ -121,7 +120,6 @@ SOURCES += projectexplorer.cpp \
|
|||||||
projectwelcomepage.cpp \
|
projectwelcomepage.cpp \
|
||||||
projectwelcomepagewidget.cpp \
|
projectwelcomepagewidget.cpp \
|
||||||
corelistenercheckingforrunningbuild.cpp \
|
corelistenercheckingforrunningbuild.cpp \
|
||||||
qmakeparser.cpp \
|
|
||||||
baseprojectwizarddialog.cpp
|
baseprojectwizarddialog.cpp
|
||||||
FORMS += processstep.ui \
|
FORMS += processstep.ui \
|
||||||
editorsettingspropertiespage.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";
|
const char * const RESOURCE_MIMETYPE = "application/vnd.nokia.xml.qt.resource";
|
||||||
|
|
||||||
// build parsers
|
// build parsers
|
||||||
const char * const BUILD_PARSER_QMAKE = "BuildParser.QMake";
|
|
||||||
const char * const BUILD_PARSER_MSVC = "BuildParser.MSVC";
|
const char * const BUILD_PARSER_MSVC = "BuildParser.MSVC";
|
||||||
const char * const BUILD_PARSER_GCC = "BuildParser.Gcc";
|
const char * const BUILD_PARSER_GCC = "BuildParser.Gcc";
|
||||||
const char * const BUILD_PARSER_RVCT = "BuildParser.Rvct";
|
const char * const BUILD_PARSER_RVCT = "BuildParser.Rvct";
|
||||||
|
@@ -44,28 +44,28 @@
|
|||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/ifile.h>
|
#include <coreplugin/ifile.h>
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/styledbar.h>
|
#include <utils/styledbar.h>
|
||||||
#include <utils/stylehelper.h>
|
#include <utils/stylehelper.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QBoxLayout>
|
#include <QtGui/QBoxLayout>
|
||||||
#include <QtGui/QComboBox>
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QScrollArea>
|
#include <QtGui/QScrollArea>
|
||||||
#include <QtGui/QTabWidget>
|
|
||||||
#include <QtGui/QTreeWidget>
|
|
||||||
#include <QtGui/QHeaderView>
|
|
||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
#include <QtGui/QPainter>
|
#include <QtGui/QPainter>
|
||||||
#include <QtGui/QPaintEvent>
|
#include <QtGui/QPaintEvent>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
|
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
using namespace ProjectExplorer::Internal;
|
using namespace ProjectExplorer::Internal;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
const int ICON_SIZE(64);
|
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)
|
void paintEvent(QPaintEvent *e)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(e);
|
||||||
QPainter p(this);
|
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) :
|
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()
|
PanelsWidget::Panel::~Panel()
|
||||||
@@ -103,7 +104,6 @@ PanelsWidget::Panel::~Panel()
|
|||||||
delete lineWidget;
|
delete lineWidget;
|
||||||
delete nameLabel;
|
delete nameLabel;
|
||||||
// do not delete panelWidget, we do not own it!
|
// do not delete panelWidget, we do not own it!
|
||||||
delete spacer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -118,16 +118,10 @@ PanelsWidget::PanelsWidget(QWidget *parent) :
|
|||||||
// side of the screen.
|
// side of the screen.
|
||||||
m_root->setMaximumWidth(800);
|
m_root->setMaximumWidth(800);
|
||||||
// The layout holding the individual panels:
|
// The layout holding the individual panels:
|
||||||
m_layout = new QGridLayout;
|
m_layout = new QGridLayout(m_root);
|
||||||
m_layout->setColumnMinimumWidth(0, ICON_SIZE);
|
m_layout->setColumnMinimumWidth(0, ICON_SIZE + 4);
|
||||||
|
m_layout->setSpacing(0);
|
||||||
// A helper layout to glue some stretch to the button of
|
m_layout->setRowStretch(0, 10);
|
||||||
// the panel layout:
|
|
||||||
QVBoxLayout * vbox = new QVBoxLayout;
|
|
||||||
vbox->addLayout(m_layout);
|
|
||||||
vbox->addStretch(10);
|
|
||||||
|
|
||||||
m_root->setLayout(vbox);
|
|
||||||
|
|
||||||
// Add horizontal space to the left of our widget:
|
// Add horizontal space to the left of our widget:
|
||||||
QHBoxLayout *hbox = new QHBoxLayout;
|
QHBoxLayout *hbox = new QHBoxLayout;
|
||||||
@@ -155,15 +149,17 @@ PanelsWidget::~PanelsWidget()
|
|||||||
* Add a widget into the grid layout of the PanelsWidget.
|
* Add a widget into the grid layout of the PanelsWidget.
|
||||||
*
|
*
|
||||||
* ...
|
* ...
|
||||||
* +--------+-------------------------------------------+
|
* +--------+-------------------------------------------+ ABOVE_CONTENTS_MARGIN
|
||||||
* | | widget |
|
* | widget (with contentsmargins adjusted!) |
|
||||||
* +--------+-------------------------------------------+
|
* +--------+-------------------------------------------+ BELOW_CONTENTS_MARGIN
|
||||||
*/
|
*/
|
||||||
void PanelsWidget::addWidget(QWidget *widget)
|
void PanelsWidget::addWidget(QWidget *widget)
|
||||||
{
|
{
|
||||||
Panel *p = new Panel(widget);
|
QTC_ASSERT(widget, return);
|
||||||
m_layout->addWidget(widget, m_layout->rowCount(), 1);
|
|
||||||
m_panels.append(p);
|
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.
|
* layout of the PanelsWidget.
|
||||||
*
|
*
|
||||||
* ...
|
* ...
|
||||||
* +--------+-------------------------------------------+
|
* +--------+-------------------------------------------+ ABOVE_HEADING_MARGIN
|
||||||
* | | spacer |
|
|
||||||
* +--------+-------------------------------------------+
|
|
||||||
* | icon | name |
|
* | icon | name |
|
||||||
* + +-------------------------------------------+
|
* + +-------------------------------------------+
|
||||||
* | | Line |
|
* | | line |
|
||||||
* + +-------------------------------------------+
|
* +--------+-------------------------------------------+ ABOVE_CONTENTS_MARGIN
|
||||||
* | | widget |
|
* | widget (with contentsmargins adjusted!) |
|
||||||
* +--------+-------------------------------------------+
|
* +--------+-------------------------------------------+ BELOW_CONTENTS_MARGIN
|
||||||
*/
|
*/
|
||||||
void PanelsWidget::addWidget(const QString &name, QWidget *widget, const QIcon & icon)
|
void PanelsWidget::addWidget(const QString &name, QWidget *widget, const QIcon & icon)
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(widget, return);
|
||||||
|
|
||||||
Panel *p = new Panel(widget);
|
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:
|
// icon:
|
||||||
const int headerRow(spacerRow + 1);
|
const int headerRow(m_layout->rowCount() - 1);
|
||||||
|
m_layout->setRowStretch(headerRow, 0);
|
||||||
|
|
||||||
if (!icon.isNull()) {
|
if (!icon.isNull()) {
|
||||||
p->iconLabel = new QLabel(m_root);
|
p->iconLabel = new QLabel(m_root);
|
||||||
p->iconLabel->setPixmap(icon.pixmap(ICON_SIZE, ICON_SIZE));
|
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:
|
// name:
|
||||||
p->nameLabel = new QLabel(m_root);
|
p->nameLabel = new QLabel(m_root);
|
||||||
p->nameLabel->setText(name);
|
p->nameLabel->setText(name);
|
||||||
|
p->nameLabel->setContentsMargins(0, ABOVE_HEADING_MARGIN, 0, 0);
|
||||||
QFont f = p->nameLabel->font();
|
QFont f = p->nameLabel->font();
|
||||||
f.setBold(true);
|
f.setBold(true);
|
||||||
f.setPointSizeF(f.pointSizeF() * 1.4);
|
f.setPointSizeF(f.pointSizeF() * 1.4);
|
||||||
p->nameLabel->setFont(f);
|
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:
|
// line:
|
||||||
const int lineRow(headerRow + 1);
|
const int lineRow(headerRow + 1);
|
||||||
p->lineWidget = new OnePixelBlackLine(m_root);
|
p->lineWidget = new OnePixelBlackLine(m_root);
|
||||||
m_layout->addWidget(p->lineWidget, lineRow, 1);
|
m_layout->addWidget(p->lineWidget, lineRow, 1);
|
||||||
|
|
||||||
// widget:
|
// add the widget:
|
||||||
const int widgetRow(lineRow + 1);
|
const int widgetRow(lineRow + 1);
|
||||||
m_layout->addWidget(p->panelWidget, widgetRow, 1);
|
addPanelWidget(p, widgetRow);
|
||||||
|
|
||||||
m_panels.append(p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *PanelsWidget::rootWidget() const
|
QWidget *PanelsWidget::rootWidget() const
|
||||||
@@ -235,13 +228,24 @@ void PanelsWidget::clear()
|
|||||||
m_layout->removeWidget(p->nameLabel);
|
m_layout->removeWidget(p->nameLabel);
|
||||||
if (p->panelWidget)
|
if (p->panelWidget)
|
||||||
m_layout->removeWidget(p->panelWidget);
|
m_layout->removeWidget(p->panelWidget);
|
||||||
if (p->spacer)
|
|
||||||
m_layout->removeItem(p->spacer);
|
|
||||||
delete p;
|
delete p;
|
||||||
}
|
}
|
||||||
m_panels.clear();
|
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
|
// ActiveConfigurationWidget
|
||||||
////
|
////
|
||||||
@@ -512,7 +516,7 @@ BuildConfigurationComboBox::BuildConfigurationComboBox(Project *p, QWidget *pare
|
|||||||
|
|
||||||
//m_comboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
//m_comboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
||||||
foreach(const BuildConfiguration *buildConfiguration, p->buildConfigurations())
|
foreach(const BuildConfiguration *buildConfiguration, p->buildConfigurations())
|
||||||
m_comboBox->addItem(buildConfiguration->displayName(), buildConfiguration->name());
|
m_comboBox->addItem(buildConfiguration->displayName(), buildConfiguration);
|
||||||
if (p->buildConfigurations().count() == 1) {
|
if (p->buildConfigurations().count() == 1) {
|
||||||
m_label->setText(m_comboBox->itemText(0));
|
m_label->setText(m_comboBox->itemText(0));
|
||||||
setCurrentWidget(m_label);
|
setCurrentWidget(m_label);
|
||||||
@@ -522,14 +526,15 @@ BuildConfigurationComboBox::BuildConfigurationComboBox(Project *p, QWidget *pare
|
|||||||
if (index != -1)
|
if (index != -1)
|
||||||
m_comboBox->setCurrentIndex(index);
|
m_comboBox->setCurrentIndex(index);
|
||||||
|
|
||||||
connect(p, SIGNAL(buildConfigurationDisplayNameChanged(QString)),
|
// TODO
|
||||||
this, SLOT(nameChanged(QString)));
|
// connect(p, SIGNAL(buildConfigurationDisplayNameChanged(QString)),
|
||||||
|
// this, SLOT(nameChanged(ProjectExplorer::BuildConfiguration *)));
|
||||||
connect(p, SIGNAL(activeBuildConfigurationChanged()),
|
connect(p, SIGNAL(activeBuildConfigurationChanged()),
|
||||||
this, SLOT(activeConfigurationChanged()));
|
this, SLOT(activeConfigurationChanged()));
|
||||||
connect(p, SIGNAL(addedBuildConfiguration(ProjectExplorer::Project *, QString)),
|
connect(p, SIGNAL(addedBuildConfiguration(ProjectExplorer::Project *, ProjectExplorer::BuildConfiguration *)),
|
||||||
this, SLOT(addedBuildConfiguration(ProjectExplorer::Project *, QString)));
|
this, SLOT(addedBuildConfiguration(ProjectExplorer::Project *, ProjectExplorer::BuildConfiguration *)));
|
||||||
connect(p, SIGNAL(removedBuildConfiguration(ProjectExplorer::Project *, QString)),
|
connect(p, SIGNAL(removedBuildConfiguration(ProjectExplorer::Project *, ProjectExplorer::BuildConfiguration *)),
|
||||||
this, SLOT(removedBuildConfiguration(ProjectExplorer::Project *, QString)));
|
this, SLOT(removedBuildConfiguration(ProjectExplorer::Project *, ProjectExplorer::BuildConfiguration *)));
|
||||||
connect(m_comboBox, SIGNAL(activated(int)),
|
connect(m_comboBox, SIGNAL(activated(int)),
|
||||||
this, SLOT(changedIndex(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)
|
if (index == -1)
|
||||||
return;
|
return;
|
||||||
const QString &displayName = m_project->buildConfiguration(buildConfiguration)->displayName();
|
const QString &displayName = bc->displayName();
|
||||||
m_comboBox->setItemText(index, displayName);
|
m_comboBox->setItemText(index, displayName);
|
||||||
if (m_comboBox->count() == 1)
|
if (m_comboBox->count() == 1)
|
||||||
m_label->setText(displayName);
|
m_label->setText(displayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
int BuildConfigurationComboBox::nameToIndex(const QString &buildConfiguration)
|
int BuildConfigurationComboBox::buildConfigurationToIndex(BuildConfiguration *bc)
|
||||||
{
|
{
|
||||||
for (int i=0; i < m_comboBox->count(); ++i)
|
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 i;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildConfigurationComboBox::activeConfigurationChanged()
|
void BuildConfigurationComboBox::activeConfigurationChanged()
|
||||||
{
|
{
|
||||||
int index = nameToIndex(m_project->activeBuildConfiguration()->name());
|
const int index(buildConfigurationToIndex(m_project->activeBuildConfiguration()));
|
||||||
if (index == -1)
|
if (index == -1)
|
||||||
return;
|
return;
|
||||||
ignoreIndexChange = true;
|
ignoreIndexChange = true;
|
||||||
@@ -568,20 +573,26 @@ void BuildConfigurationComboBox::activeConfigurationChanged()
|
|||||||
ignoreIndexChange = false;
|
ignoreIndexChange = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildConfigurationComboBox::addedBuildConfiguration(ProjectExplorer::Project *,const QString &buildConfiguration)
|
void BuildConfigurationComboBox::addedBuildConfiguration(ProjectExplorer::Project *project,
|
||||||
|
BuildConfiguration *bc)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(project);
|
||||||
ignoreIndexChange = true;
|
ignoreIndexChange = true;
|
||||||
m_comboBox->addItem(m_project->buildConfiguration(buildConfiguration)->displayName(), buildConfiguration);
|
m_comboBox->addItem(bc->displayName(), QVariant::fromValue(bc));
|
||||||
|
|
||||||
if (m_comboBox->count() == 2)
|
if (m_comboBox->count() == 2)
|
||||||
setCurrentWidget(m_comboBox);
|
setCurrentWidget(m_comboBox);
|
||||||
ignoreIndexChange = false;
|
ignoreIndexChange = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BuildConfigurationComboBox::removedBuildConfiguration(ProjectExplorer::Project *, const QString &buildConfiguration)
|
void BuildConfigurationComboBox::removedBuildConfiguration(ProjectExplorer::Project *project,
|
||||||
|
BuildConfiguration * bc)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(project);
|
||||||
ignoreIndexChange = true;
|
ignoreIndexChange = true;
|
||||||
int index = nameToIndex(buildConfiguration);
|
const int index(buildConfigurationToIndex(bc));
|
||||||
|
if (index == -1)
|
||||||
|
return;
|
||||||
m_comboBox->removeItem(index);
|
m_comboBox->removeItem(index);
|
||||||
if (m_comboBox->count() == 1) {
|
if (m_comboBox->count() == 1) {
|
||||||
m_label->setText(m_comboBox->itemText(0));
|
m_label->setText(m_comboBox->itemText(0));
|
||||||
@@ -594,8 +605,7 @@ void BuildConfigurationComboBox::changedIndex(int newIndex)
|
|||||||
{
|
{
|
||||||
if (newIndex == -1)
|
if (newIndex == -1)
|
||||||
return;
|
return;
|
||||||
m_project->setActiveBuildConfiguration(
|
m_project->setActiveBuildConfiguration(m_comboBox->itemData(newIndex).value<BuildConfiguration *>());
|
||||||
m_project->buildConfiguration(m_comboBox->itemData(newIndex).toString()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -719,19 +729,13 @@ ProjectWindow::ProjectWindow(QWidget *parent)
|
|||||||
m_panelsWidget = new PanelsWidget(this);
|
m_panelsWidget = new PanelsWidget(this);
|
||||||
viewLayout->addWidget(m_panelsWidget);
|
viewLayout->addWidget(m_panelsWidget);
|
||||||
|
|
||||||
// Run and build configuration selection area:
|
// Run and build configuration selection panel:
|
||||||
m_activeConfigurationWidget = new ActiveConfigurationWidget(m_panelsWidget->rootWidget());
|
m_activeConfigurationWidget = new ActiveConfigurationWidget(m_panelsWidget->rootWidget());
|
||||||
|
|
||||||
// Spacer and line:
|
// Spacer and line panel:
|
||||||
m_spacerBetween = new QWidget(m_panelsWidget->rootWidget());
|
m_spacerBetween = new OnePixelBlackLine(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));
|
|
||||||
|
|
||||||
// Project chooser:
|
// Project chooser panel:
|
||||||
m_projectChooser = new QWidget(m_panelsWidget->rootWidget());
|
m_projectChooser = new QWidget(m_panelsWidget->rootWidget());
|
||||||
QHBoxLayout *hbox = new QHBoxLayout(m_projectChooser);
|
QHBoxLayout *hbox = new QHBoxLayout(m_projectChooser);
|
||||||
hbox->setMargin(0);
|
hbox->setMargin(0);
|
||||||
|
@@ -30,32 +30,26 @@
|
|||||||
#ifndef PROJECTWINDOW_H
|
#ifndef PROJECTWINDOW_H
|
||||||
#define PROJECTWINDOW_H
|
#define PROJECTWINDOW_H
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
|
||||||
#include <QtGui/QScrollArea>
|
|
||||||
#include <QtGui/QComboBox>
|
|
||||||
#include <QtCore/QPair>
|
#include <QtCore/QPair>
|
||||||
#include <QtGui/QStackedWidget>
|
#include <QtCore/QMap>
|
||||||
#include <QtGui/QPushButton>
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QToolButton>
|
|
||||||
#include <QtGui/QLabel>
|
#include <QtGui/QLabel>
|
||||||
|
#include <QtGui/QPushButton>
|
||||||
|
#include <QtGui/QScrollArea>
|
||||||
|
#include <QtGui/QStackedWidget>
|
||||||
|
#include <QtGui/QWidget>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QGridLayout;
|
class QGridLayout;
|
||||||
class QModelIndex;
|
|
||||||
class QTabWidget;
|
|
||||||
class QHBoxLayout;
|
|
||||||
class QComboBox;
|
|
||||||
class QMenu;
|
class QMenu;
|
||||||
class QSpacerItem;
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
namespace ProjectExplorer {
|
||||||
|
|
||||||
class IPropertiesPanel;
|
class IPropertiesPanel;
|
||||||
class Project;
|
class Project;
|
||||||
class ProjectExplorerPlugin;
|
class BuildConfiguration;
|
||||||
class SessionManager;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -78,17 +72,18 @@ private:
|
|||||||
struct Panel
|
struct Panel
|
||||||
{
|
{
|
||||||
// This does not take ownership of widget!
|
// This does not take ownership of widget!
|
||||||
explicit Panel(QWidget * widget);
|
explicit Panel(QWidget *widget);
|
||||||
~Panel();
|
~Panel();
|
||||||
|
|
||||||
QLabel *iconLabel;
|
QLabel *iconLabel;
|
||||||
QWidget *lineWidget;
|
QWidget *lineWidget;
|
||||||
QLabel *nameLabel;
|
QLabel *nameLabel;
|
||||||
QWidget *panelWidget;
|
QWidget *panelWidget;
|
||||||
QSpacerItem *spacer;
|
|
||||||
};
|
};
|
||||||
QList<Panel *> m_panels;
|
QList<Panel *> m_panels;
|
||||||
|
|
||||||
|
void addPanelWidget(Panel *panel, int row);
|
||||||
|
|
||||||
QGridLayout *m_layout;
|
QGridLayout *m_layout;
|
||||||
QWidget *m_root;
|
QWidget *m_root;
|
||||||
};
|
};
|
||||||
@@ -100,13 +95,15 @@ public:
|
|||||||
BuildConfigurationComboBox(ProjectExplorer::Project *p, QWidget *parent = 0);
|
BuildConfigurationComboBox(ProjectExplorer::Project *p, QWidget *parent = 0);
|
||||||
~BuildConfigurationComboBox();
|
~BuildConfigurationComboBox();
|
||||||
private slots:
|
private slots:
|
||||||
void nameChanged(const QString &buildConfiguration);
|
void nameChanged(BuildConfiguration *bc);
|
||||||
void activeConfigurationChanged();
|
void activeConfigurationChanged();
|
||||||
void addedBuildConfiguration(ProjectExplorer::Project *, const QString &buildConfiguration);
|
void addedBuildConfiguration(ProjectExplorer::Project *project,
|
||||||
void removedBuildConfiguration(ProjectExplorer::Project *, const QString &buildConfiguration);
|
BuildConfiguration *bc);
|
||||||
|
void removedBuildConfiguration(ProjectExplorer::Project *project,
|
||||||
|
BuildConfiguration *bc);
|
||||||
void changedIndex(int newIndex);
|
void changedIndex(int newIndex);
|
||||||
private:
|
private:
|
||||||
int nameToIndex(const QString &buildConfiguration);
|
int buildConfigurationToIndex(BuildConfiguration *bc);
|
||||||
bool ignoreIndexChange;
|
bool ignoreIndexChange;
|
||||||
ProjectExplorer::Project *m_project;
|
ProjectExplorer::Project *m_project;
|
||||||
QComboBox *m_comboBox;
|
QComboBox *m_comboBox;
|
||||||
|
@@ -853,7 +853,6 @@ Project *SessionManager::projectForFile(const QString &fileName) const
|
|||||||
foreach (Project *p, projectList)
|
foreach (Project *p, projectList)
|
||||||
if (p != currentProject && projectContainsFile(p, fileName))
|
if (p != currentProject && projectContainsFile(p, fileName))
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -666,7 +666,7 @@ static int blockStartState(const QTextBlock &block)
|
|||||||
return state & 0xff;
|
return state & 0xff;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar typedChar)
|
void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar /*typedChar*/)
|
||||||
{
|
{
|
||||||
TextEditor::TabSettings ts = tabSettings();
|
TextEditor::TabSettings ts = tabSettings();
|
||||||
|
|
||||||
|
@@ -104,7 +104,7 @@ namespace QmlEditor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool visit(Block *ast)
|
virtual bool visit(Block * /*ast*/)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
// if (_pos > ast->lbraceToken.end() && _pos < ast->rbraceToken.offset) {
|
// if (_pos > ast->lbraceToken.end() && _pos < ast->rbraceToken.offset) {
|
||||||
|
@@ -162,12 +162,6 @@ QStringList QmlProject::convertToAbsoluteFiles(const QStringList &paths) const
|
|||||||
QStringList QmlProject::files() const
|
QStringList QmlProject::files() const
|
||||||
{ return m_files; }
|
{ return m_files; }
|
||||||
|
|
||||||
QString QmlProject::buildParser(BuildConfiguration *configuration) const
|
|
||||||
{
|
|
||||||
Q_UNUSED(configuration)
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QmlProject::name() const
|
QString QmlProject::name() const
|
||||||
{
|
{
|
||||||
return m_projectName;
|
return m_projectName;
|
||||||
@@ -198,18 +192,6 @@ bool QmlProject::hasBuildSettings() const
|
|||||||
return false;
|
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()
|
ProjectExplorer::BuildConfigWidget *QmlProject::createConfigWidget()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -71,9 +71,6 @@ public:
|
|||||||
virtual bool isApplication() const;
|
virtual bool isApplication() const;
|
||||||
virtual bool hasBuildSettings() 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 ProjectExplorer::BuildConfigWidget *createConfigWidget();
|
||||||
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
virtual QList<ProjectExplorer::BuildConfigWidget*> subConfigWidgets();
|
||||||
|
|
||||||
@@ -81,7 +78,6 @@ public:
|
|||||||
virtual QStringList files(FilesMode fileMode) const;
|
virtual QStringList files(FilesMode fileMode) const;
|
||||||
|
|
||||||
QStringList targets() const;
|
QStringList targets() const;
|
||||||
QString buildParser(ProjectExplorer::BuildConfiguration *configuration) const;
|
|
||||||
|
|
||||||
enum RefreshOptions {
|
enum RefreshOptions {
|
||||||
Files = 0x01,
|
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 "qt4project.h"
|
||||||
#include "qt4projectmanagerconstants.h"
|
#include "qt4projectmanagerconstants.h"
|
||||||
#include "qtversionmanager.h"
|
#include "qtversionmanager.h"
|
||||||
|
#include "qt4buildconfiguration.h"
|
||||||
|
|
||||||
#include <utils/synchronousprocess.h>
|
#include <utils/synchronousprocess.h>
|
||||||
#include <projectexplorer/projectexplorer.h>
|
#include <projectexplorer/projectexplorer.h>
|
||||||
@@ -99,7 +100,8 @@ bool ExternalQtEditor::getEditorLaunchData(const QString &fileName,
|
|||||||
const Qt4Project *project = qt4ProjectFor(fileName);
|
const Qt4Project *project = qt4ProjectFor(fileName);
|
||||||
// Get the binary either from the current Qt version of the project or Path
|
// Get the binary either from the current Qt version of the project or Path
|
||||||
if (project) {
|
if (project) {
|
||||||
const QtVersion *qtVersion= project->qtVersion(project->activeBuildConfiguration());
|
Qt4BuildConfiguration *qt4bc = project->activeQt4BuildConfiguration();
|
||||||
|
const QtVersion *qtVersion= qt4bc->qtVersion();
|
||||||
data->binary = (qtVersion->*commandAccessor)();
|
data->binary = (qtVersion->*commandAccessor)();
|
||||||
data->workingDirectory = QFileInfo(project->file()->fileName()).absolutePath();
|
data->workingDirectory = QFileInfo(project->file()->fileName()).absolutePath();
|
||||||
} else {
|
} else {
|
||||||
|
@@ -30,6 +30,7 @@
|
|||||||
#include "makestep.h"
|
#include "makestep.h"
|
||||||
|
|
||||||
#include "qt4project.h"
|
#include "qt4project.h"
|
||||||
|
#include "qt4buildconfiguration.h"
|
||||||
#include "qt4projectmanagerconstants.h"
|
#include "qt4projectmanagerconstants.h"
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
@@ -44,8 +45,8 @@ using ExtensionSystem::PluginManager;
|
|||||||
using namespace Qt4ProjectManager;
|
using namespace Qt4ProjectManager;
|
||||||
using namespace Qt4ProjectManager::Internal;
|
using namespace Qt4ProjectManager::Internal;
|
||||||
|
|
||||||
MakeStep::MakeStep(Qt4Project * project, ProjectExplorer::BuildConfiguration *bc)
|
MakeStep::MakeStep(ProjectExplorer::BuildConfiguration *bc)
|
||||||
: AbstractMakeStep(project, bc), m_clean(false)
|
: AbstractMakeStep(bc), m_clean(false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -53,7 +54,7 @@ MakeStep::MakeStep(Qt4Project * project, ProjectExplorer::BuildConfiguration *bc
|
|||||||
MakeStep::MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc)
|
MakeStep::MakeStep(MakeStep *bs, ProjectExplorer::BuildConfiguration *bc)
|
||||||
: AbstractMakeStep(bs, bc),
|
: AbstractMakeStep(bs, bc),
|
||||||
m_clean(bs->m_clean),
|
m_clean(bs->m_clean),
|
||||||
m_makeargs(bs->m_makeargs),
|
m_userArgs(bs->m_userArgs),
|
||||||
m_makeCmd(bs->m_makeCmd)
|
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)
|
void MakeStep::setClean(bool clean)
|
||||||
{
|
{
|
||||||
m_clean = clean;
|
m_clean = clean;
|
||||||
@@ -78,7 +84,7 @@ void MakeStep::restoreFromGlobalMap(const QMap<QString, QVariant> &map)
|
|||||||
|
|
||||||
void MakeStep::restoreFromLocalMap(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();
|
m_makeCmd = map.value("makeCmd").toString();
|
||||||
if (map.value("clean").isValid() && map.value("clean").toBool())
|
if (map.value("clean").isValid() && map.value("clean").toBool())
|
||||||
m_clean = true;
|
m_clean = true;
|
||||||
@@ -87,7 +93,7 @@ void MakeStep::restoreFromLocalMap(const QMap<QString, QVariant> &map)
|
|||||||
|
|
||||||
void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
||||||
{
|
{
|
||||||
map["makeargs"] = m_makeargs;
|
map["makeargs"] = m_userArgs;
|
||||||
map["makeCmd"] = m_makeCmd;
|
map["makeCmd"] = m_makeCmd;
|
||||||
if (m_clean)
|
if (m_clean)
|
||||||
map["clean"] = true;
|
map["clean"] = true;
|
||||||
@@ -96,15 +102,14 @@ void MakeStep::storeIntoLocalMap(QMap<QString, QVariant> &map)
|
|||||||
|
|
||||||
bool MakeStep::init()
|
bool MakeStep::init()
|
||||||
{
|
{
|
||||||
ProjectExplorer::BuildConfiguration *bc = buildConfiguration();
|
Qt4BuildConfiguration *bc = qt4BuildConfiguration();
|
||||||
Environment environment = project()->environment(bc);
|
Environment environment = bc->environment();
|
||||||
setEnvironment(environment);
|
setEnvironment(environment);
|
||||||
|
|
||||||
Qt4Project *qt4project = qobject_cast<Qt4Project *>(project());
|
QString workingDirectory = bc->buildDirectory();
|
||||||
QString workingDirectory = qt4project->buildDirectory(bc);
|
|
||||||
setWorkingDirectory(workingDirectory);
|
setWorkingDirectory(workingDirectory);
|
||||||
|
|
||||||
QString makeCmd = qt4project->makeCommand(bc);
|
QString makeCmd = bc->makeCommand();
|
||||||
if (!m_makeCmd.isEmpty())
|
if (!m_makeCmd.isEmpty())
|
||||||
makeCmd = m_makeCmd;
|
makeCmd = m_makeCmd;
|
||||||
if (!QFileInfo(makeCmd).isAbsolute()) {
|
if (!QFileInfo(makeCmd).isAbsolute()) {
|
||||||
@@ -123,17 +128,17 @@ bool MakeStep::init()
|
|||||||
// we should stop the clean queue
|
// we should stop the clean queue
|
||||||
// That is mostly so that rebuild works on a alrady clean project
|
// That is mostly so that rebuild works on a alrady clean project
|
||||||
setIgnoreReturnValue(m_clean);
|
setIgnoreReturnValue(m_clean);
|
||||||
QStringList args = m_makeargs;
|
QStringList args = m_userArgs;
|
||||||
if (!m_clean) {
|
if (!m_clean) {
|
||||||
if (!qt4project->defaultMakeTarget(bc).isEmpty())
|
if (!bc->defaultMakeTarget().isEmpty())
|
||||||
args << qt4project->defaultMakeTarget(bc);
|
args << bc->defaultMakeTarget();
|
||||||
}
|
}
|
||||||
// -w option enables "Enter"/"Leaving directory" messages, which we need for detecting the
|
// -w option enables "Enter"/"Leaving directory" messages, which we need for detecting the
|
||||||
// absolute file path
|
// absolute file path
|
||||||
// FIXME doing this without the user having a way to override this is rather bad
|
// 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
|
// 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
|
// 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;
|
ProjectExplorer::ToolChain::ToolChainType type = ProjectExplorer::ToolChain::UNKNOWN;
|
||||||
if (toolchain)
|
if (toolchain)
|
||||||
@@ -163,7 +168,7 @@ bool MakeStep::init()
|
|||||||
|
|
||||||
void MakeStep::run(QFutureInterface<bool> & fi)
|
void MakeStep::run(QFutureInterface<bool> & fi)
|
||||||
{
|
{
|
||||||
if (qobject_cast<Qt4Project *>(project())->rootProjectNode()->projectType() == ScriptTemplate) {
|
if (qt4BuildConfiguration()->qt4Project()->rootProjectNode()->projectType() == ScriptTemplate) {
|
||||||
fi.reportResult(true);
|
fi.reportResult(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -191,19 +196,19 @@ ProjectExplorer::BuildStepConfigWidget *MakeStep::createConfigWidget()
|
|||||||
return new MakeStepConfigWidget(this);
|
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;
|
m_userArgs = arguments;
|
||||||
emit changed();
|
emit userArgumentsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
||||||
: BuildStepConfigWidget(), m_makeStep(makeStep)
|
: BuildStepConfigWidget(), m_makeStep(makeStep), m_ignoreChange(false)
|
||||||
{
|
{
|
||||||
m_ui.setupUi(this);
|
m_ui.setupUi(this);
|
||||||
connect(m_ui.makeLineEdit, SIGNAL(textEdited(QString)),
|
connect(m_ui.makeLineEdit, SIGNAL(textEdited(QString)),
|
||||||
@@ -211,9 +216,9 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
|||||||
connect(m_ui.makeArgumentsLineEdit, SIGNAL(textEdited(QString)),
|
connect(m_ui.makeArgumentsLineEdit, SIGNAL(textEdited(QString)),
|
||||||
this, SLOT(makeArgumentsLineEditTextEdited()));
|
this, SLOT(makeArgumentsLineEditTextEdited()));
|
||||||
|
|
||||||
connect(makeStep, SIGNAL(changed()),
|
connect(makeStep, SIGNAL(userArgumentsChanged()),
|
||||||
this, SLOT(update()));
|
this, SLOT(userArgumentsChanged()));
|
||||||
connect(makeStep->project(), SIGNAL(buildDirectoryChanged()),
|
connect(makeStep->buildConfiguration(), SIGNAL(buildDirectoryChanged()),
|
||||||
this, SLOT(updateDetails()));
|
this, SLOT(updateDetails()));
|
||||||
|
|
||||||
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
|
connect(ProjectExplorer::ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
|
||||||
@@ -224,22 +229,20 @@ MakeStepConfigWidget::MakeStepConfigWidget(MakeStep *makeStep)
|
|||||||
|
|
||||||
void MakeStepConfigWidget::updateMakeOverrideLabel()
|
void MakeStepConfigWidget::updateMakeOverrideLabel()
|
||||||
{
|
{
|
||||||
Qt4Project *qt4project = qobject_cast<Qt4Project *>(m_makeStep->project());
|
Qt4BuildConfiguration *qt4bc = m_makeStep->qt4BuildConfiguration();
|
||||||
m_ui.makeLabel->setText(tr("Override %1:").arg(qt4project->
|
m_ui.makeLabel->setText(tr("Override %1:").arg(qt4bc->makeCommand()));
|
||||||
makeCommand(m_makeStep->buildConfiguration())));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeStepConfigWidget::updateDetails()
|
void MakeStepConfigWidget::updateDetails()
|
||||||
{
|
{
|
||||||
Qt4Project *pro = static_cast<Qt4Project *>(m_makeStep->project());
|
Qt4BuildConfiguration *bc = m_makeStep->qt4BuildConfiguration();
|
||||||
ProjectExplorer::BuildConfiguration *bc = m_makeStep->buildConfiguration();
|
QString workingDirectory = bc->buildDirectory();
|
||||||
QString workingDirectory = pro->buildDirectory(bc);
|
|
||||||
|
|
||||||
QString makeCmd = pro->makeCommand(bc);
|
QString makeCmd = bc->makeCommand();
|
||||||
if (!m_makeStep->m_makeCmd.isEmpty())
|
if (!m_makeStep->m_makeCmd.isEmpty())
|
||||||
makeCmd = m_makeStep->m_makeCmd;
|
makeCmd = m_makeStep->m_makeCmd;
|
||||||
if (!QFileInfo(makeCmd).isAbsolute()) {
|
if (!QFileInfo(makeCmd).isAbsolute()) {
|
||||||
Environment environment = pro->environment(bc);
|
Environment environment = bc->environment();
|
||||||
// Try to detect command in environment
|
// Try to detect command in environment
|
||||||
QString tmp = environment.searchInPath(makeCmd);
|
QString tmp = environment.searchInPath(makeCmd);
|
||||||
if (tmp == QString::null) {
|
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
|
// 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
|
// 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
|
// 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::ToolChainType t = ProjectExplorer::ToolChain::UNKNOWN;
|
||||||
ProjectExplorer::ToolChain *toolChain = pro->toolChain(bc);
|
ProjectExplorer::ToolChain *toolChain = bc->toolChain();
|
||||||
if (toolChain)
|
if (toolChain)
|
||||||
t = toolChain->type();
|
t = toolChain->type();
|
||||||
if (t != ProjectExplorer::ToolChain::MSVC && t != ProjectExplorer::ToolChain::WINCE) {
|
if (t != ProjectExplorer::ToolChain::MSVC && t != ProjectExplorer::ToolChain::WINCE) {
|
||||||
@@ -278,9 +281,11 @@ QString MakeStepConfigWidget::displayName() const
|
|||||||
return m_makeStep->displayName();
|
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()
|
void MakeStepConfigWidget::init()
|
||||||
@@ -290,7 +295,7 @@ void MakeStepConfigWidget::init()
|
|||||||
const QString &makeCmd = m_makeStep->m_makeCmd;
|
const QString &makeCmd = m_makeStep->m_makeCmd;
|
||||||
m_ui.makeLineEdit->setText(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));
|
m_ui.makeArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(makeArguments));
|
||||||
updateDetails();
|
updateDetails();
|
||||||
}
|
}
|
||||||
@@ -303,8 +308,10 @@ void MakeStepConfigWidget::makeLineEditTextEdited()
|
|||||||
|
|
||||||
void MakeStepConfigWidget::makeArgumentsLineEditTextEdited()
|
void MakeStepConfigWidget::makeArgumentsLineEditTextEdited()
|
||||||
{
|
{
|
||||||
m_makeStep->setMakeArguments(
|
m_ignoreChange = true;
|
||||||
|
m_makeStep->setUserArguments(
|
||||||
ProjectExplorer::Environment::parseCombinedArgString(m_ui.makeArgumentsLineEdit->text()));
|
ProjectExplorer::Environment::parseCombinedArgString(m_ui.makeArgumentsLineEdit->text()));
|
||||||
|
m_ignoreChange = false;
|
||||||
updateDetails();
|
updateDetails();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -325,10 +332,10 @@ bool MakeStepFactory::canCreate(const QString & name) const
|
|||||||
return (name == Constants::MAKESTEP);
|
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)
|
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
|
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);
|
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;
|
return QStringList() << Constants::MAKESTEP;
|
||||||
else
|
else
|
||||||
return QStringList();
|
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