forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.10' into 4.11
Conflicts: src/plugins/projectexplorer/projectnodes.h Change-Id: Ibd255105a01c53a1f81a1ec7b30495dfef1877a9
This commit is contained in:
@@ -174,7 +174,7 @@ CMakeTargetNode::CMakeTargetNode(const Utils::FilePath &directory, const QString
|
|||||||
setPriority(Node::DefaultProjectPriority + 900);
|
setPriority(Node::DefaultProjectPriority + 900);
|
||||||
setIcon(QIcon(":/projectexplorer/images/build.png")); // TODO: Use proper icon!
|
setIcon(QIcon(":/projectexplorer/images/build.png")); // TODO: Use proper icon!
|
||||||
setListInProject(false);
|
setListInProject(false);
|
||||||
setProductType(ProductType::Other);
|
setIsProduct();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeTargetNode::tooltip() const
|
QString CMakeTargetNode::tooltip() const
|
||||||
|
|||||||
@@ -103,37 +103,26 @@ void ResourceHandler::updateResourcesHelper(bool updateProjectResources)
|
|||||||
|
|
||||||
// Find the (sub-)project the file belongs to. We don't want to find resources
|
// Find the (sub-)project the file belongs to. We don't want to find resources
|
||||||
// from other parts of the project tree, e.g. via a qmake subdirs project.
|
// from other parts of the project tree, e.g. via a qmake subdirs project.
|
||||||
Node * const fileNode = project->rootProjectNode()->findNode([&fileName](const Node *n) {
|
ProjectNode *projectNode = project->rootProjectNode();
|
||||||
|
Node * const fileNode = projectNode->findNode([&fileName](const Node *n) {
|
||||||
return n->filePath().toString() == fileName;
|
return n->filePath().toString() == fileName;
|
||||||
});
|
});
|
||||||
ProjectNode *projectNodeForUiFile = nullptr;
|
|
||||||
if (fileNode) {
|
if (fileNode) {
|
||||||
// We do not want qbs groups or qmake .pri files here, as they contain only a subset
|
// We do not want qbs groups or qmake .pri files here, as they contain only a subset
|
||||||
// of the relevant files.
|
// of the relevant files.
|
||||||
projectNodeForUiFile = fileNode->parentProjectNode();
|
projectNode = fileNode->parentProjectNode();
|
||||||
while (projectNodeForUiFile && !projectNodeForUiFile->isProduct())
|
while (projectNode && !projectNode->isProduct())
|
||||||
projectNodeForUiFile = projectNodeForUiFile->parentProjectNode();
|
projectNode = projectNode->parentProjectNode();
|
||||||
}
|
}
|
||||||
if (!projectNodeForUiFile)
|
if (!projectNode)
|
||||||
projectNodeForUiFile = project->rootProjectNode();
|
projectNode = project->rootProjectNode();
|
||||||
|
|
||||||
const auto useQrcFile = [projectNodeForUiFile, project](const Node *qrcNode) {
|
|
||||||
if (projectNodeForUiFile == project->rootProjectNode())
|
|
||||||
return true;
|
|
||||||
ProjectNode *projectNodeForQrcFile = qrcNode->parentProjectNode();
|
|
||||||
while (projectNodeForQrcFile && !projectNodeForQrcFile->isProduct())
|
|
||||||
projectNodeForQrcFile = projectNodeForQrcFile->parentProjectNode();
|
|
||||||
return !projectNodeForQrcFile
|
|
||||||
|| projectNodeForQrcFile == projectNodeForUiFile
|
|
||||||
|| projectNodeForQrcFile->productType() != ProductType::App;
|
|
||||||
};
|
|
||||||
|
|
||||||
QStringList projectQrcFiles;
|
QStringList projectQrcFiles;
|
||||||
project->rootProjectNode()->forEachNode([&](FileNode *node) {
|
projectNode->forEachNode([&](FileNode *node) {
|
||||||
if (node->fileType() == FileType::Resource && useQrcFile(node))
|
if (node->fileType() == FileType::Resource)
|
||||||
projectQrcFiles.append(node->filePath().toString());
|
projectQrcFiles.append(node->filePath().toString());
|
||||||
}, [&](FolderNode *node) {
|
}, [&](FolderNode *node) {
|
||||||
if (dynamic_cast<ResourceEditor::ResourceTopLevelNode *>(node) && useQrcFile(node))
|
if (dynamic_cast<ResourceEditor::ResourceTopLevelNode *>(node))
|
||||||
projectQrcFiles.append(node->filePath().toString());
|
projectQrcFiles.append(node->filePath().toString());
|
||||||
});
|
});
|
||||||
// Check if the user has chosen to update the lacking resource inside designer
|
// Check if the user has chosen to update the lacking resource inside designer
|
||||||
@@ -145,7 +134,7 @@ void ResourceHandler::updateResourcesHelper(bool updateProjectResources)
|
|||||||
}
|
}
|
||||||
if (!qrcPathsToBeAdded.isEmpty()) {
|
if (!qrcPathsToBeAdded.isEmpty()) {
|
||||||
m_handlingResources = true;
|
m_handlingResources = true;
|
||||||
projectNodeForUiFile->addFiles(qrcPathsToBeAdded);
|
projectNode->addFiles(qrcPathsToBeAdded);
|
||||||
m_handlingResources = false;
|
m_handlingResources = false;
|
||||||
projectQrcFiles += qrcPathsToBeAdded;
|
projectQrcFiles += qrcPathsToBeAdded;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ enum class FileType : quint16 {
|
|||||||
FileTypeSize
|
FileTypeSize
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ProductType { App, Lib, Other, None };
|
|
||||||
|
|
||||||
enum ProjectAction {
|
enum ProjectAction {
|
||||||
// Special value to indicate that the actions are handled by the parent
|
// Special value to indicate that the actions are handled by the parent
|
||||||
InheritedFromParent,
|
InheritedFromParent,
|
||||||
@@ -381,8 +379,7 @@ public:
|
|||||||
virtual QVariant data(Core::Id role) const;
|
virtual QVariant data(Core::Id role) const;
|
||||||
virtual bool setData(Core::Id role, const QVariant &value) const;
|
virtual bool setData(Core::Id role, const QVariant &value) const;
|
||||||
|
|
||||||
bool isProduct() const { return m_productType != ProductType::None; }
|
bool isProduct() const { return m_isProduct; }
|
||||||
ProductType productType() const { return m_productType; }
|
|
||||||
|
|
||||||
// TODO: Currently used only for "Build for current run config" functionality, but we should
|
// TODO: Currently used only for "Build for current run config" functionality, but we should
|
||||||
// probably use it to centralize the node-specific "Build" functionality that
|
// probably use it to centralize the node-specific "Build" functionality that
|
||||||
@@ -394,13 +391,13 @@ public:
|
|||||||
void setFallbackData(Core::Id key, const QVariant &value);
|
void setFallbackData(Core::Id key, const QVariant &value);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setProductType(ProductType type) { m_productType = type; }
|
void setIsProduct() { m_isProduct = true; }
|
||||||
|
|
||||||
QString m_target;
|
QString m_target;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QHash<Core::Id, QVariant> m_fallbackData; // Used in data(), unless overridden.
|
QHash<Core::Id, QVariant> m_fallbackData; // Used in data(), unless overridden.
|
||||||
ProductType m_productType = ProductType::None;
|
bool m_isProduct = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT ContainerNode : public FolderNode
|
class PROJECTEXPLORER_EXPORT ContainerNode : public FolderNode
|
||||||
|
|||||||
@@ -328,14 +328,7 @@ QbsProductNode::QbsProductNode(const qbs::ProductData &prd) :
|
|||||||
{
|
{
|
||||||
static QIcon productIcon = Core::FileIconProvider::directoryIcon(Constants::QBS_PRODUCT_OVERLAY_ICON);
|
static QIcon productIcon = Core::FileIconProvider::directoryIcon(Constants::QBS_PRODUCT_OVERLAY_ICON);
|
||||||
setIcon(productIcon);
|
setIcon(productIcon);
|
||||||
if (m_qbsProductData.isRunnable()) {
|
setIsProduct();
|
||||||
setProductType(ProductType::App);
|
|
||||||
} else if (m_qbsProductData.type().contains("dynamiclibrary")
|
|
||||||
|| m_qbsProductData.type().contains("staticlibrary")) {
|
|
||||||
setProductType(ProductType::Lib);
|
|
||||||
} else {
|
|
||||||
setProductType(ProductType::Other);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QbsProductNode::supportsAction(ProjectAction action, const Node *node) const
|
bool QbsProductNode::supportsAction(ProjectAction action, const Node *node) const
|
||||||
|
|||||||
@@ -257,14 +257,7 @@ FolderNode::AddNewInformation QmakePriFileNode::addNewInformation(const QStringL
|
|||||||
QmakeProFileNode::QmakeProFileNode(QmakeProject *project, const FilePath &filePath, QmakeProFile *pf) :
|
QmakeProFileNode::QmakeProFileNode(QmakeProject *project, const FilePath &filePath, QmakeProFile *pf) :
|
||||||
QmakePriFileNode(project, this, filePath, pf)
|
QmakePriFileNode(project, this, filePath, pf)
|
||||||
{
|
{
|
||||||
if (projectType() == ProjectType::ApplicationTemplate) {
|
setIsProduct();
|
||||||
setProductType(ProductType::App);
|
|
||||||
} else if (projectType() == ProjectType::SharedLibraryTemplate
|
|
||||||
|| projectType() == ProjectType::StaticLibraryTemplate) {
|
|
||||||
setProductType(ProductType::Lib);
|
|
||||||
} else if (projectType() != ProjectType::SubDirsTemplate) {
|
|
||||||
setProductType(ProductType::Other);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QmakeProFileNode::showInSimpleTree() const
|
bool QmakeProFileNode::showInSimpleTree() const
|
||||||
|
|||||||
@@ -235,6 +235,11 @@ def getOutputFromCmdline(cmdline, environment=None, acceptedError=0):
|
|||||||
return e.output
|
return e.output
|
||||||
|
|
||||||
def selectFromFileDialog(fileName, waitForFile=False, ignoreFinalSnooze=False):
|
def selectFromFileDialog(fileName, waitForFile=False, ignoreFinalSnooze=False):
|
||||||
|
def __closePopupIfNecessary__():
|
||||||
|
if not isNull(QApplication.activePopupWidget()):
|
||||||
|
test.log("Closing active popup widget")
|
||||||
|
QApplication.activePopupWidget().close()
|
||||||
|
|
||||||
if platform.system() == "Darwin":
|
if platform.system() == "Darwin":
|
||||||
snooze(1)
|
snooze(1)
|
||||||
nativeType("<Command+Shift+g>")
|
nativeType("<Command+Shift+g>")
|
||||||
@@ -252,12 +257,13 @@ def selectFromFileDialog(fileName, waitForFile=False, ignoreFinalSnooze=False):
|
|||||||
try:
|
try:
|
||||||
waitForObject("{name='QFileDialog' type='QFileDialog' visible='1'}", 5000)
|
waitForObject("{name='QFileDialog' type='QFileDialog' visible='1'}", 5000)
|
||||||
pathLine = waitForObject("{name='fileNameEdit' type='QLineEdit' visible='1'}")
|
pathLine = waitForObject("{name='fileNameEdit' type='QLineEdit' visible='1'}")
|
||||||
snooze(1)
|
|
||||||
replaceEditorContent(pathLine, pName)
|
replaceEditorContent(pathLine, pName)
|
||||||
|
snooze(1)
|
||||||
clickButton(waitForObject("{text='Open' type='QPushButton'}"))
|
clickButton(waitForObject("{text='Open' type='QPushButton'}"))
|
||||||
waitFor("str(pathLine.text)==''")
|
waitFor("str(pathLine.text)==''")
|
||||||
snooze(1)
|
|
||||||
replaceEditorContent(pathLine, fName)
|
replaceEditorContent(pathLine, fName)
|
||||||
|
snooze(1)
|
||||||
|
__closePopupIfNecessary__()
|
||||||
clickButton(waitForObject("{text='Open' type='QPushButton'}"))
|
clickButton(waitForObject("{text='Open' type='QPushButton'}"))
|
||||||
except:
|
except:
|
||||||
nativeType("<Ctrl+a>")
|
nativeType("<Ctrl+a>")
|
||||||
|
|||||||
Reference in New Issue
Block a user