forked from qt-creator/qt-creator
Merge commit 'origin/0.9.1-beta'
This commit is contained in:
@@ -222,7 +222,7 @@ void BinEditor::scrollContentsBy(int dx, int dy)
|
||||
void BinEditor::changeEvent(QEvent *e)
|
||||
{
|
||||
QAbstractScrollArea::changeEvent(e);
|
||||
if(e->type() == QEvent::ActivationChange) {
|
||||
if (e->type() == QEvent::ActivationChange) {
|
||||
if (!isActiveWindow())
|
||||
m_autoScrollTimer.stop();
|
||||
}
|
||||
@@ -450,7 +450,7 @@ void BinEditor::paintEvent(QPaintEvent *e)
|
||||
for (int c = 0; c < 16; ++c) {
|
||||
int pos = line * 16 + c;
|
||||
if (pos >= m_data.size()) {
|
||||
while(c < 16) {
|
||||
while (c < 16) {
|
||||
itemStringData[c*3] = itemStringData[c*3+1] = ' ';
|
||||
++c;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "bookmarkmanager.h"
|
||||
|
||||
#include "bookmark.h"
|
||||
#include "bookmarksplugin.h"
|
||||
#include "bookmarks_global.h"
|
||||
@@ -41,12 +42,14 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <texteditor/basetexteditor.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QFileInfo>
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QContextMenuEvent>
|
||||
#include <QtGui/QPainter>
|
||||
|
||||
Q_DECLARE_METATYPE(Bookmarks::Internal::Bookmark*)
|
||||
|
||||
@@ -173,7 +176,7 @@ void BookmarkDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
||||
// int idx;
|
||||
// forever {
|
||||
// idx = directory.lastIndexOf("/", pos-1);
|
||||
// if(idx == -1) {
|
||||
// if (idx == -1) {
|
||||
// // Can't happen, this means the string did fit after all?
|
||||
// break;
|
||||
// }
|
||||
@@ -272,7 +275,7 @@ void BookmarkView::removeAll()
|
||||
void BookmarkView::setModel(QAbstractItemModel *model)
|
||||
{
|
||||
BookmarkManager *manager = qobject_cast<BookmarkManager *>(model);
|
||||
Q_ASSERT(manager);
|
||||
QTC_ASSERT(manager, return);
|
||||
QListView::setModel(model);
|
||||
setSelectionModel(manager->selectionModel());
|
||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
|
||||
@@ -32,15 +32,20 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "cmakeproject.h"
|
||||
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeprojectnodes.h"
|
||||
#include "cmakerunconfiguration.h"
|
||||
#include "cmakestep.h"
|
||||
#include "makestep.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <cpptools/cppmodelmanagerinterface.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
@@ -48,20 +53,31 @@ using namespace CMakeProjectManager::Internal;
|
||||
CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
||||
: m_manager(manager), m_fileName(fileName), m_rootNode(new CMakeProjectNode(m_fileName))
|
||||
{
|
||||
//TODO
|
||||
|
||||
m_file = new CMakeFile(this, fileName);
|
||||
QDir dir = QFileInfo(m_fileName).absoluteDir();
|
||||
QString cbpFile = findCbpFile(dir);
|
||||
if (cbpFile.isEmpty())
|
||||
cbpFile = createCbpFile(dir);
|
||||
|
||||
//TODO move this parsing to a seperate method, which is also called if the CMakeList.txt is updated
|
||||
CMakeCbpParser cbpparser;
|
||||
if (cbpparser.parseCbpFile(cbpFile)) {
|
||||
// TODO do a intelligent updating of the tree
|
||||
buildTree(m_rootNode, cbpparser.fileList());
|
||||
foreach(ProjectExplorer::FileNode *fn, cbpparser.fileList())
|
||||
foreach (ProjectExplorer::FileNode *fn, cbpparser.fileList())
|
||||
m_files.append(fn->path());
|
||||
m_files.sort();
|
||||
|
||||
m_targets = cbpparser.targets();
|
||||
qDebug()<<"Printing targets";
|
||||
foreach(CMakeTarget ct, m_targets) {
|
||||
qDebug()<<ct.title<<" with executable:"<<ct.executable;
|
||||
qDebug()<<"WD:"<<ct.workingDirectory;
|
||||
qDebug()<<ct.makeCommand<<ct.makeCleanCommand;
|
||||
qDebug()<<"";
|
||||
}
|
||||
|
||||
CppTools::CppModelManagerInterface *modelmanager = ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
||||
if (modelmanager) {
|
||||
CppTools::CppModelManagerInterface::ProjectInfo pinfo = modelmanager->projectInfo(this);
|
||||
@@ -69,6 +85,7 @@ CMakeProject::CMakeProject(CMakeManager *manager, const QString &fileName)
|
||||
// TODO we only want C++ files, not all other stuff that might be in the project
|
||||
pinfo.sourceFiles = m_files;
|
||||
// TODO defines
|
||||
// TODO gcc preprocessor files
|
||||
modelmanager->updateProjectInfo(pinfo);
|
||||
}
|
||||
} else {
|
||||
@@ -87,25 +104,27 @@ QString CMakeProject::findCbpFile(const QDir &directory)
|
||||
// TODO the cbp file is named like the project() command in the CMakeList.txt file
|
||||
// so this method below could find the wrong cbp file, if the user changes the project()
|
||||
// name
|
||||
foreach(const QString &cbpFile , directory.entryList())
|
||||
{
|
||||
if (cbpFile.endsWith(".cbp")) {
|
||||
foreach (const QString &cbpFile , directory.entryList()) {
|
||||
if (cbpFile.endsWith(".cbp"))
|
||||
return directory.path() + "/" + cbpFile;
|
||||
}
|
||||
}
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
|
||||
QString CMakeProject::createCbpFile(const QDir &)
|
||||
QString CMakeProject::createCbpFile(const QDir &directory)
|
||||
{
|
||||
// TODO create a cbp file.
|
||||
// Issue: Where to create it? We want to do that in the build directory
|
||||
// but at this stage we don't know the build directory yet
|
||||
// So create it in a temp directory?
|
||||
// Issue: We want to reuse whatever CMakeCache.txt that is alread there, which
|
||||
// would indicate, creating it in the build directory
|
||||
// Or we could use a temp directory and use -C builddirectory
|
||||
// We create a cbp file, only if we didn't find a cbp file in the base directory
|
||||
// Yet that can still override cbp files in subdirectories
|
||||
// And we are creating tons of files in the source directories
|
||||
// All of that is not really nice.
|
||||
// The mid term plan is to move away from the CodeBlocks Generator and use our own
|
||||
// QtCreator generator, which actually can be very similar to the CodeBlock Generator
|
||||
|
||||
// TODO we need to pass on the same paremeters as the cmakestep
|
||||
QProcess cmake;
|
||||
cmake.setWorkingDirectory(directory.absolutePath());
|
||||
cmake.start("cmake", QStringList() << "-GCodeBlocks - Unix Makefiles");
|
||||
|
||||
return QString::null;
|
||||
}
|
||||
|
||||
@@ -113,7 +132,7 @@ void CMakeProject::buildTree(CMakeProjectNode *rootNode, QList<ProjectExplorer::
|
||||
{
|
||||
//m_rootNode->addFileNodes(fileList, m_rootNode);
|
||||
qSort(list.begin(), list.end(), ProjectExplorer::ProjectNode::sortNodesByPath);
|
||||
foreach( ProjectExplorer::FileNode *fn, list) {
|
||||
foreach (ProjectExplorer::FileNode *fn, list) {
|
||||
// Get relative path to rootNode
|
||||
QString parentDir = QFileInfo(fn->path()).absolutePath();
|
||||
ProjectExplorer::FolderNode *folder = findOrCreateFolder(rootNode, parentDir);
|
||||
@@ -127,10 +146,10 @@ ProjectExplorer::FolderNode *CMakeProject::findOrCreateFolder(CMakeProjectNode *
|
||||
QString relativePath = QDir(QFileInfo(rootNode->path()).path()).relativeFilePath(directory);
|
||||
QStringList parts = relativePath.split("/");
|
||||
ProjectExplorer::FolderNode *parent = rootNode;
|
||||
foreach(const QString &part, parts) {
|
||||
foreach (const QString &part, parts) {
|
||||
// Find folder in subFolders
|
||||
bool found = false;
|
||||
foreach(ProjectExplorer::FolderNode *folder, parent->subFolderNodes()) {
|
||||
foreach (ProjectExplorer::FolderNode *folder, parent->subFolderNodes()) {
|
||||
if (QFileInfo(folder->path()).fileName() == part) {
|
||||
// yeah found something :)
|
||||
parent = folder;
|
||||
@@ -227,27 +246,35 @@ QStringList CMakeProject::files(FilesMode fileMode) const
|
||||
void CMakeProject::saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer)
|
||||
{
|
||||
// TODO
|
||||
Q_UNUSED(writer);
|
||||
Project::saveSettingsImpl(writer);
|
||||
}
|
||||
|
||||
void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &reader)
|
||||
{
|
||||
// TODO
|
||||
Q_UNUSED(reader);
|
||||
Project::restoreSettingsImpl(reader);
|
||||
if (buildConfigurations().isEmpty()) {
|
||||
// No build configuration, adding those
|
||||
|
||||
// TODO do we want to create one build configuration per target?
|
||||
// or how do we want to handle that?
|
||||
|
||||
CMakeStep *cmakeStep = new CMakeStep(this);
|
||||
MakeStep *makeStep = new MakeStep(this);
|
||||
|
||||
insertBuildStep(0, cmakeStep);
|
||||
insertBuildStep(1, makeStep);
|
||||
|
||||
addBuildConfiguration("all");
|
||||
// Create build configurations of m_targets
|
||||
qDebug()<<"Create build configurations of m_targets";
|
||||
foreach(const CMakeTarget &ct, m_targets) {
|
||||
addBuildConfiguration(ct.title);
|
||||
makeStep->setValue(ct.title, "makeCommand", ct.makeCommand);
|
||||
makeStep->setValue(ct.title, "makeCleanCommand", ct.makeCleanCommand);
|
||||
|
||||
QSharedPointer<ProjectExplorer::RunConfiguration> rc(new CMakeRunConfiguration(this, ct.executable, ct.workingDirectory));
|
||||
// TODO set build configuration to build before it can be run
|
||||
addRunConfiguration(rc);
|
||||
setActiveRunConfiguration(rc); // TODO what exactly shall be the active run configuration?
|
||||
}
|
||||
setActiveBuildConfiguration("all");
|
||||
|
||||
}
|
||||
// Restoring is fine
|
||||
}
|
||||
@@ -332,7 +359,7 @@ bool CMakeCbpParser::parseCbpFile(const QString &fileName)
|
||||
if (fi.exists() && fi.open(QFile::ReadOnly)) {
|
||||
setDevice(&fi);
|
||||
|
||||
while(!atEnd()) {
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (name() == "CodeBlocks_project_file") {
|
||||
parseCodeBlocks_project_file();
|
||||
@@ -350,7 +377,7 @@ bool CMakeCbpParser::parseCbpFile(const QString &fileName)
|
||||
|
||||
void CMakeCbpParser::parseCodeBlocks_project_file()
|
||||
{
|
||||
while(!atEnd()) {
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
return;
|
||||
@@ -364,7 +391,7 @@ void CMakeCbpParser::parseCodeBlocks_project_file()
|
||||
|
||||
void CMakeCbpParser::parseProject()
|
||||
{
|
||||
while(!atEnd()) {
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
return;
|
||||
@@ -380,7 +407,7 @@ void CMakeCbpParser::parseProject()
|
||||
|
||||
void CMakeCbpParser::parseBuild()
|
||||
{
|
||||
while(!atEnd()) {
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
return;
|
||||
@@ -394,14 +421,16 @@ void CMakeCbpParser::parseBuild()
|
||||
|
||||
void CMakeCbpParser::parseTarget()
|
||||
{
|
||||
m_targetOutput.clear();
|
||||
m_targetType = false;
|
||||
while(!atEnd()) {
|
||||
m_target.clear();
|
||||
|
||||
if (attributes().hasAttribute("title"))
|
||||
m_target.title = attributes().value("title").toString();
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
if (m_targetType && !m_targetOutput.isEmpty()) {
|
||||
qDebug()<<"found target "<<m_targetOutput;
|
||||
m_targets.insert(m_targetOutput);
|
||||
if (m_targetType || m_target.title == "all") {
|
||||
m_targets.append(m_target);
|
||||
}
|
||||
return;
|
||||
} else if (name() == "Compiler") {
|
||||
@@ -417,10 +446,58 @@ void CMakeCbpParser::parseTarget()
|
||||
void CMakeCbpParser::parseTargetOption()
|
||||
{
|
||||
if (attributes().hasAttribute("output"))
|
||||
m_targetOutput = attributes().value("output").toString();
|
||||
m_target.executable = attributes().value("output").toString();
|
||||
else if (attributes().hasAttribute("type") && attributes().value("type") == "1")
|
||||
m_targetType = true;
|
||||
while(!atEnd()) {
|
||||
else if (attributes().hasAttribute("working_dir"))
|
||||
m_target.workingDirectory = attributes().value("working_dir").toString();
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
return;
|
||||
} else if (name() == "MakeCommand") {
|
||||
parseMakeCommand();
|
||||
} else if (isStartElement()) {
|
||||
parseUnknownElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMakeCbpParser::parseMakeCommand()
|
||||
{
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
return;
|
||||
} else if (name() == "Build") {
|
||||
parseTargetBuild();
|
||||
} else if (name() == "Clean") {
|
||||
parseTargetClean();
|
||||
} else if (isStartElement()) {
|
||||
parseUnknownElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMakeCbpParser::parseTargetBuild()
|
||||
{
|
||||
if (attributes().hasAttribute("command"))
|
||||
m_target.makeCommand = attributes().value("command").toString();
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
return;
|
||||
} else if (isStartElement()) {
|
||||
parseUnknownElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CMakeCbpParser::parseTargetClean()
|
||||
{
|
||||
if (attributes().hasAttribute("command"))
|
||||
m_target.makeCleanCommand = attributes().value("command").toString();
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
return;
|
||||
@@ -432,7 +509,7 @@ void CMakeCbpParser::parseTargetOption()
|
||||
|
||||
void CMakeCbpParser::parseCompiler()
|
||||
{
|
||||
while(!atEnd()) {
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
return;
|
||||
@@ -447,7 +524,7 @@ void CMakeCbpParser::parseCompiler()
|
||||
void CMakeCbpParser::parseAdd()
|
||||
{
|
||||
m_includeFiles.append(attributes().value("directory").toString());
|
||||
while(!atEnd()) {
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
return;
|
||||
@@ -463,7 +540,7 @@ void CMakeCbpParser::parseUnit()
|
||||
QString fileName = attributes().value("filename").toString();
|
||||
if (!fileName.endsWith(".rule"))
|
||||
m_fileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::SourceType, false));
|
||||
while(!atEnd()) {
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
if (isEndElement()) {
|
||||
return;
|
||||
@@ -475,7 +552,7 @@ void CMakeCbpParser::parseUnit()
|
||||
|
||||
void CMakeCbpParser::parseUnknownElement()
|
||||
{
|
||||
Q_ASSERT(isStartElement());
|
||||
QTC_ASSERT(isStartElement(), /**/);
|
||||
|
||||
while (!atEnd()) {
|
||||
readNext();
|
||||
@@ -497,3 +574,18 @@ QStringList CMakeCbpParser::includeFiles()
|
||||
{
|
||||
return m_includeFiles;
|
||||
}
|
||||
|
||||
QList<CMakeTarget> CMakeCbpParser::targets()
|
||||
{
|
||||
return m_targets;
|
||||
}
|
||||
|
||||
void CMakeTarget::clear()
|
||||
{
|
||||
executable = QString::null;
|
||||
makeCommand = QString::null;
|
||||
makeCleanCommand = QString::null;
|
||||
workingDirectory = QString::null;
|
||||
title = QString::null;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,16 @@ namespace Internal{
|
||||
|
||||
class CMakeFile;
|
||||
|
||||
struct CMakeTarget
|
||||
{
|
||||
QString title;
|
||||
QString executable;
|
||||
QString workingDirectory;
|
||||
QString makeCommand;
|
||||
QString makeCleanCommand;
|
||||
void clear();
|
||||
};
|
||||
|
||||
class CMakeProject : public ProjectExplorer::Project
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -105,6 +115,7 @@ private:
|
||||
// TODO probably need a CMake specific node structure
|
||||
CMakeProjectNode* m_rootNode;
|
||||
QStringList m_files;
|
||||
QList<CMakeTarget> m_targets;
|
||||
|
||||
protected:
|
||||
virtual void saveSettingsImpl(ProjectExplorer::PersistentSettingsWriter &writer);
|
||||
@@ -118,23 +129,27 @@ public:
|
||||
bool parseCbpFile(const QString &fileName);
|
||||
QList<ProjectExplorer::FileNode *> fileList();
|
||||
QStringList includeFiles();
|
||||
QList<CMakeTarget> targets();
|
||||
private:
|
||||
void parseCodeBlocks_project_file();
|
||||
void parseProject();
|
||||
void parseBuild();
|
||||
void parseTarget();
|
||||
void parseTargetOption();
|
||||
void parseMakeCommand();
|
||||
void parseTargetBuild();
|
||||
void parseTargetClean();
|
||||
void parseCompiler();
|
||||
void parseAdd();
|
||||
void parseUnit();
|
||||
void parseUnknownElement();
|
||||
|
||||
QSet<QString> m_targets;
|
||||
QList<ProjectExplorer::FileNode *> m_fileList;
|
||||
QStringList m_includeFiles;
|
||||
|
||||
QString m_targetOutput;
|
||||
CMakeTarget m_target;
|
||||
bool m_targetType;
|
||||
QList<CMakeTarget> m_targets;
|
||||
};
|
||||
|
||||
class CMakeFile : public Core::IFile
|
||||
|
||||
@@ -41,6 +41,7 @@ const char * const PROJECTCONTEXT = "CMakeProject.ProjectContext";
|
||||
const char * const CMAKEMIMETYPE = "text/x-cmake"; // TOOD check that this is correct
|
||||
const char * const CMAKESTEP = "CMakeProjectManager.CMakeStep";
|
||||
const char * const MAKESTEP = "CMakeProjectManager.MakeStep";
|
||||
const char * const CMAKERUNCONFIGURATION = "CMakeProjectManager.CMakeRunConfiguration";
|
||||
|
||||
|
||||
} // namespace Constants
|
||||
|
||||
@@ -8,11 +8,13 @@ HEADERS = cmakeproject.h \
|
||||
cmakeprojectconstants.h \
|
||||
cmakeprojectnodes.h \
|
||||
cmakestep.h \
|
||||
makestep.h
|
||||
makestep.h \
|
||||
cmakerunconfiguration.h
|
||||
SOURCES = cmakeproject.cpp \
|
||||
cmakeprojectplugin.cpp \
|
||||
cmakeprojectmanager.cpp \
|
||||
cmakeprojectnodes.cpp \
|
||||
cmakestep.cpp \
|
||||
makestep.cpp
|
||||
makestep.cpp \
|
||||
cmakerunconfiguration.cpp
|
||||
RESOURCES += cmakeproject.qrc
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "cmakeprojectplugin.h"
|
||||
#include "cmakeprojectmanager.h"
|
||||
#include "cmakerunconfiguration.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
@@ -57,6 +58,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
|
||||
if (!core->mimeDatabase()->addMimeTypes(QLatin1String(":cmakeproject/CMakeProject.mimetypes.xml"), errorMessage))
|
||||
return false;
|
||||
addAutoReleasedObject(new CMakeManager());
|
||||
addAutoReleasedObject(new CMakeRunConfigurationFactory());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
157
src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
Normal file
157
src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp
Normal file
@@ -0,0 +1,157 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "cmakerunconfiguration.h"
|
||||
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
|
||||
#include <projectexplorer/environment.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
|
||||
CMakeRunConfiguration::CMakeRunConfiguration(CMakeProject *pro, const QString &target, const QString &workingDirectory)
|
||||
: ProjectExplorer::ApplicationRunConfiguration(pro), m_target(target), m_workingDirectory(workingDirectory)
|
||||
{
|
||||
setName(target);
|
||||
}
|
||||
|
||||
CMakeRunConfiguration::~CMakeRunConfiguration()
|
||||
{
|
||||
}
|
||||
|
||||
QString CMakeRunConfiguration::type() const
|
||||
{
|
||||
return Constants::CMAKERUNCONFIGURATION;
|
||||
}
|
||||
|
||||
QString CMakeRunConfiguration::executable() const
|
||||
{
|
||||
return m_target;
|
||||
}
|
||||
|
||||
ProjectExplorer::ApplicationRunConfiguration::RunMode CMakeRunConfiguration::runMode() const
|
||||
{
|
||||
return ProjectExplorer::ApplicationRunConfiguration::Gui;
|
||||
}
|
||||
|
||||
QString CMakeRunConfiguration::workingDirectory() const
|
||||
{
|
||||
return m_workingDirectory;
|
||||
}
|
||||
|
||||
QStringList CMakeRunConfiguration::commandLineArguments() const
|
||||
{
|
||||
// TODO
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
ProjectExplorer::Environment CMakeRunConfiguration::environment() const
|
||||
{
|
||||
// TODO
|
||||
return ProjectExplorer::Environment::systemEnvironment();
|
||||
}
|
||||
|
||||
void CMakeRunConfiguration::save(ProjectExplorer::PersistentSettingsWriter &writer) const
|
||||
{
|
||||
ProjectExplorer::ApplicationRunConfiguration::save(writer);
|
||||
}
|
||||
|
||||
void CMakeRunConfiguration::restore(const ProjectExplorer::PersistentSettingsReader &reader)
|
||||
{
|
||||
ProjectExplorer::ApplicationRunConfiguration::restore(reader);
|
||||
}
|
||||
|
||||
QWidget *CMakeRunConfiguration::configurationWidget()
|
||||
{
|
||||
//TODO
|
||||
return new QWidget();
|
||||
}
|
||||
|
||||
// Factory
|
||||
CMakeRunConfigurationFactory::CMakeRunConfigurationFactory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CMakeRunConfigurationFactory::~CMakeRunConfigurationFactory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// used to recreate the runConfigurations when restoring settings
|
||||
bool CMakeRunConfigurationFactory::canCreate(const QString &type) const
|
||||
{
|
||||
if (type.startsWith(Constants::CMAKERUNCONFIGURATION))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// used to show the list of possible additons to a project, returns a list of types
|
||||
QStringList CMakeRunConfigurationFactory::canCreate(ProjectExplorer::Project *project) const
|
||||
{
|
||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||
if (!pro)
|
||||
return QStringList();
|
||||
// TODO gather all targets and return them here
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
// used to translate the types to names to display to the user
|
||||
QString CMakeRunConfigurationFactory::nameForType(const QString &type) const
|
||||
{
|
||||
QTC_ASSERT(type.startsWith(Constants::CMAKERUNCONFIGURATION), /**/);
|
||||
|
||||
if (type == Constants::CMAKERUNCONFIGURATION)
|
||||
return "CMake"; // Doesn't happen
|
||||
else
|
||||
return type.mid(QString(Constants::CMAKERUNCONFIGURATION).length());
|
||||
}
|
||||
|
||||
QSharedPointer<ProjectExplorer::RunConfiguration> CMakeRunConfigurationFactory::create(ProjectExplorer::Project *project, const QString &type)
|
||||
{
|
||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||
QTC_ASSERT(pro, /**/);
|
||||
if (type == Constants::CMAKERUNCONFIGURATION) {
|
||||
// Restoring, filename will be added by restoreSettings
|
||||
QSharedPointer<ProjectExplorer::RunConfiguration> rc(new CMakeRunConfiguration(pro, QString::null, QString::null));
|
||||
return rc;
|
||||
} else {
|
||||
// Adding new
|
||||
QString file = type.mid(QString(Constants::CMAKERUNCONFIGURATION).length());
|
||||
QSharedPointer<ProjectExplorer::RunConfiguration> rc(new CMakeRunConfiguration(pro, file, QString::null));
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
93
src/plugins/cmakeprojectmanager/cmakerunconfiguration.h
Normal file
93
src/plugins/cmakeprojectmanager/cmakerunconfiguration.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef CMAKERUNCONFIGURATION_H
|
||||
#define CMAKERUNCONFIGURATION_H
|
||||
|
||||
#include <projectexplorer/applicationrunconfiguration.h>
|
||||
#include <projectexplorer/environment.h>
|
||||
#include <projectexplorer/persistentsettings.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class CMakeProject;
|
||||
|
||||
class CMakeRunConfiguration : public ProjectExplorer::ApplicationRunConfiguration
|
||||
{
|
||||
public:
|
||||
CMakeRunConfiguration(CMakeProject *pro, const QString &target, const QString &workingDirectory);
|
||||
virtual ~CMakeRunConfiguration();
|
||||
virtual QString type() const;
|
||||
virtual QString executable() const;
|
||||
virtual RunMode runMode() const;
|
||||
virtual QString workingDirectory() const;
|
||||
virtual QStringList commandLineArguments() const;
|
||||
virtual ProjectExplorer::Environment environment() const;
|
||||
virtual QWidget *configurationWidget();
|
||||
|
||||
virtual void save(ProjectExplorer::PersistentSettingsWriter &writer) const;
|
||||
virtual void restore(const ProjectExplorer::PersistentSettingsReader &reader);
|
||||
private:
|
||||
QString m_target;
|
||||
QString m_workingDirectory;
|
||||
};
|
||||
|
||||
/* The run configuration factory is used for restoring run configurations from
|
||||
* settings. And used to create new runconfigurations in the "Run Settings" Dialog.
|
||||
* For the first case bool canCreate(const QString &type) and
|
||||
* QSharedPointer<RunConfiguration> create(Project *project, QString type) are used.
|
||||
* For the second type the functions QStringList canCreate(Project *pro) and
|
||||
* QString nameForType(const QString&) are used to generate a list of creatable
|
||||
* RunConfigurations, and create(..) is used to create it.
|
||||
*/
|
||||
class CMakeRunConfigurationFactory : public QObject
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
CMakeRunConfigurationFactory();
|
||||
virtual ~CMakeRunConfigurationFactory();
|
||||
// used to recreate the runConfigurations when restoring settings
|
||||
virtual bool canCreate(const QString &type) const;
|
||||
// used to show the list of possible additons to a project, returns a list of types
|
||||
virtual QStringList canCreate(ProjectExplorer::Project *pro) const;
|
||||
// used to translate the types to names to display to the user
|
||||
virtual QString nameForType(const QString &type) const;
|
||||
virtual QSharedPointer<ProjectExplorer::RunConfiguration> create(ProjectExplorer::Project *project, const QString &type);
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // CMAKERUNCONFIGURATION_H
|
||||
@@ -32,8 +32,11 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "cmakestep.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
@@ -41,12 +44,10 @@ using namespace CMakeProjectManager::Internal;
|
||||
CMakeStep::CMakeStep(CMakeProject *pro)
|
||||
: AbstractProcessStep(pro), m_pro(pro)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CMakeStep::~CMakeStep()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CMakeStep::init(const QString &buildConfiguration)
|
||||
@@ -61,6 +62,11 @@ bool CMakeStep::init(const QString &buildConfiguration)
|
||||
|
||||
void CMakeStep::run(QFutureInterface<bool> &fi)
|
||||
{
|
||||
// TODO we want to only run cmake if the command line arguments or
|
||||
// the CmakeLists.txt has actually changed
|
||||
// And we want all of them to share the SAME command line arguments
|
||||
// Shadow building ruins this, hmm, hmm
|
||||
//
|
||||
AbstractProcessStep::run(fi);
|
||||
}
|
||||
|
||||
@@ -109,9 +115,9 @@ bool CMakeBuildStepFactory::canCreate(const QString &name) const
|
||||
|
||||
ProjectExplorer::BuildStep *CMakeBuildStepFactory::create(ProjectExplorer::Project *project, const QString &name) const
|
||||
{
|
||||
Q_ASSERT(name == Constants::CMAKESTEP);
|
||||
QTC_ASSERT(name == Constants::CMAKESTEP, /**/);
|
||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||
Q_ASSERT(pro);
|
||||
QTC_ASSERT(pro, /**/);
|
||||
return new CMakeStep(pro);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,18 +35,18 @@
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeproject.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace CMakeProjectManager;
|
||||
using namespace CMakeProjectManager::Internal;
|
||||
|
||||
MakeStep::MakeStep(CMakeProject *pro)
|
||||
: AbstractProcessStep(pro), m_pro(pro)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MakeStep::~MakeStep()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool MakeStep::init(const QString &buildConfiguration)
|
||||
@@ -109,9 +109,9 @@ bool MakeBuildStepFactory::canCreate(const QString &name) const
|
||||
|
||||
ProjectExplorer::BuildStep *MakeBuildStepFactory::create(ProjectExplorer::Project *project, const QString &name) const
|
||||
{
|
||||
Q_ASSERT(name == Constants::MAKESTEP);
|
||||
QTC_ASSERT(name == Constants::MAKESTEP, return 0);
|
||||
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
|
||||
Q_ASSERT(pro);
|
||||
QTC_ASSERT(pro, return 0);
|
||||
return new MakeStep(pro);
|
||||
}
|
||||
|
||||
|
||||
@@ -456,7 +456,7 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
|
||||
}
|
||||
}
|
||||
if (firstExtensionPageHit)
|
||||
foreach(IFileWizardExtension *ex, extensions)
|
||||
foreach (IFileWizardExtension *ex, extensions)
|
||||
ex->firstExtensionPageShown(files);
|
||||
if (accepted)
|
||||
break;
|
||||
@@ -486,7 +486,7 @@ QStringList BaseFileWizard::runWizard(const QString &path, QWidget *parent)
|
||||
}
|
||||
}
|
||||
// Run the extensions
|
||||
foreach(IFileWizardExtension *ex, extensions)
|
||||
foreach (IFileWizardExtension *ex, extensions)
|
||||
if (!ex->process(files, &errorMessage)) {
|
||||
QMessageBox::critical(parent, tr("File Generation Failure"), errorMessage);
|
||||
return QStringList();
|
||||
|
||||
@@ -47,6 +47,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &initialCategory,
|
||||
setupUi(this);
|
||||
buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||
|
||||
splitter->setCollapsible(1, false);
|
||||
pageTree->header()->setVisible(false);
|
||||
|
||||
connect(pageTree, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
|
||||
@@ -58,8 +59,8 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &initialCategory,
|
||||
CoreImpl::instance()->pluginManager()->getObjects<IOptionsPage>();
|
||||
|
||||
int index = 0;
|
||||
foreach(IOptionsPage *page, pages) {
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
foreach (IOptionsPage *page, pages) {
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem;
|
||||
item->setText(0, page->name());
|
||||
item->setData(0, Qt::UserRole, index);
|
||||
|
||||
@@ -77,7 +78,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, const QString &initialCategory,
|
||||
|
||||
int catCount = 1;
|
||||
while (catCount < categoriesId.count()) {
|
||||
if(!categories.contains(currentCategory + QLatin1Char('|') + categoriesId.at(catCount))) {
|
||||
if (!categories.contains(currentCategory + QLatin1Char('|') + categoriesId.at(catCount))) {
|
||||
treeitem = new QTreeWidgetItem(categories.value(currentCategory));
|
||||
currentCategory += QLatin1Char('|') + categoriesId.at(catCount);
|
||||
treeitem->setText(0, trCategories.at(catCount));
|
||||
@@ -123,14 +124,14 @@ void SettingsDialog::pageSelected(QTreeWidgetItem *)
|
||||
|
||||
void SettingsDialog::accept()
|
||||
{
|
||||
foreach(IOptionsPage *page, m_pages)
|
||||
foreach (IOptionsPage *page, m_pages)
|
||||
page->finished(true);
|
||||
done(QDialog::Accepted);
|
||||
}
|
||||
|
||||
void SettingsDialog::reject()
|
||||
{
|
||||
foreach(IOptionsPage *page, m_pages)
|
||||
foreach (IOptionsPage *page, m_pages)
|
||||
page->finished(false);
|
||||
done(QDialog::Rejected);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ QWidget *ShortcutSettings::createPage(QWidget *parent)
|
||||
void ShortcutSettings::finished(bool accepted)
|
||||
{
|
||||
if (accepted) {
|
||||
foreach(ShortcutItem *item, m_scitems) {
|
||||
foreach (ShortcutItem *item, m_scitems) {
|
||||
item->m_cmd->setKeySequence(item->m_key);
|
||||
}
|
||||
}
|
||||
@@ -196,7 +196,7 @@ bool ShortcutSettings::filter(const QString &f, const QTreeWidgetItem *item)
|
||||
if (f.isEmpty())
|
||||
return false;
|
||||
for (int i = 0; i < item->columnCount(); ++i) {
|
||||
if(item->text(i).contains(f, Qt::CaseInsensitive))
|
||||
if (item->text(i).contains(f, Qt::CaseInsensitive))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -242,7 +242,7 @@ void ShortcutSettings::importAction()
|
||||
CommandsFile cf(fileName);
|
||||
QMap<QString, QKeySequence> mapping = cf.importCommands();
|
||||
|
||||
foreach(ShortcutItem *item, m_scitems) {
|
||||
foreach (ShortcutItem *item, m_scitems) {
|
||||
QString sid = uidm->stringForUniqueIdentifier(item->m_cmd->id());
|
||||
if (mapping.contains(sid)) {
|
||||
item->m_key = mapping.value(sid);
|
||||
@@ -256,7 +256,7 @@ void ShortcutSettings::importAction()
|
||||
|
||||
void ShortcutSettings::defaultAction()
|
||||
{
|
||||
foreach(ShortcutItem *item, m_scitems) {
|
||||
foreach (ShortcutItem *item, m_scitems) {
|
||||
item->m_key = item->m_cmd->defaultKeySequence();
|
||||
item->m_item->setText(2, item->m_key);
|
||||
if (item->m_item == m_page->commandList->currentItem())
|
||||
|
||||
@@ -32,15 +32,18 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "editorgroup.h"
|
||||
|
||||
#include "editormanager.h"
|
||||
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QStyle>
|
||||
#include <QtGui/QStyleOption>
|
||||
#include <QtCore/QtDebug>
|
||||
#ifdef Q_WS_MAC
|
||||
#include <QtGui/QMacStyle>
|
||||
#endif
|
||||
@@ -107,20 +110,20 @@ QVariant EditorModel::data(const QModelIndex &index, int role) const
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
IEditor *editor = m_editors.at(index.row());
|
||||
Q_ASSERT(editor);
|
||||
QTC_ASSERT(editor, return QVariant());
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
return editor->file()->isModified()
|
||||
?editor->displayName()+QLatin1String("*")
|
||||
:editor->displayName();
|
||||
? editor->displayName() + QLatin1String("*")
|
||||
: editor->displayName();
|
||||
case Qt::DecorationRole:
|
||||
return editor->file()->isReadOnly()
|
||||
?QIcon(QLatin1String(":/qworkbench/images/locked.png"))
|
||||
:QIcon();
|
||||
? QIcon(QLatin1String(":/qworkbench/images/locked.png"))
|
||||
: QIcon();
|
||||
case Qt::ToolTipRole:
|
||||
return editor->file()->fileName().isEmpty()
|
||||
?editor->displayName()
|
||||
:QDir::toNativeSeparators(editor->file()->fileName());
|
||||
? editor->displayName()
|
||||
: QDir::toNativeSeparators(editor->file()->fileName());
|
||||
case Qt::UserRole:
|
||||
return qVariantFromValue(editor);
|
||||
default:
|
||||
@@ -145,6 +148,7 @@ EditorGroupContext::EditorGroupContext(EditorGroup *editorGroup)
|
||||
m_editorGroup(editorGroup)
|
||||
{
|
||||
}
|
||||
|
||||
QList<int> EditorGroupContext::context() const
|
||||
{
|
||||
return m_context;
|
||||
|
||||
@@ -53,21 +53,23 @@
|
||||
#include <coreplugin/baseview.h>
|
||||
#include <coreplugin/imode.h>
|
||||
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QProcess>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QProcess>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QSplitter>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QSplitter>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
@@ -961,11 +963,10 @@ bool EditorManager::hasEditor(const QString &fileName) const
|
||||
|
||||
void EditorManager::restoreEditorState(IEditor *editor)
|
||||
{
|
||||
Q_ASSERT(editor);
|
||||
QTC_ASSERT(editor, return);
|
||||
QString fileName = editor->file()->fileName();
|
||||
if (m_d->m_editorStates.contains(fileName)) {
|
||||
if (m_d->m_editorStates.contains(fileName))
|
||||
editor->restoreState(m_d->m_editorStates.value(fileName).toByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
bool EditorManager::saveEditor(IEditor *editor)
|
||||
@@ -1089,7 +1090,7 @@ bool EditorManager::saveFileAs(IEditor *editor)
|
||||
const bool success = editor->file()->save(absoluteFilePath);
|
||||
m_d->m_core->fileManager()->unblockFileChange(editor->file());
|
||||
|
||||
if(success)
|
||||
if (success)
|
||||
m_d->m_core->fileManager()->addToRecentFiles(editor->file()->fileName());
|
||||
|
||||
updateActions();
|
||||
|
||||
@@ -32,16 +32,19 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "editorsplitter.h"
|
||||
|
||||
#include "editormanager.h"
|
||||
#include "minisplitter.h"
|
||||
#include "openeditorswindow.h"
|
||||
#include "stackededitorgroup.h"
|
||||
#include "minisplitter.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QApplication>
|
||||
@@ -160,7 +163,7 @@ void EditorSplitter::registerActions()
|
||||
void EditorSplitter::updateActions()
|
||||
{
|
||||
const bool hasMultipleGroups = (qobject_cast<QSplitter*>(m_root) != 0);
|
||||
Q_ASSERT(currentGroup());
|
||||
QTC_ASSERT(currentGroup(), return);
|
||||
const bool hasEditors = (currentGroup()->editorCount() != 0);
|
||||
m_unsplitAction->setEnabled(hasMultipleGroups);
|
||||
#if 0
|
||||
@@ -245,7 +248,7 @@ void EditorSplitter::collectGroups(QWidget *widget, QList<EditorGroup*> &groups)
|
||||
return;
|
||||
}
|
||||
QSplitter *splitter = qobject_cast<QSplitter*>(widget);
|
||||
Q_ASSERT(splitter);
|
||||
QTC_ASSERT(splitter, return);
|
||||
collectGroups(splitter->widget(LEFT), groups);
|
||||
collectGroups(splitter->widget(RIGHT), groups);
|
||||
}
|
||||
@@ -330,7 +333,7 @@ void EditorSplitter::unsplit()
|
||||
if (!curGroup)
|
||||
return;
|
||||
QWidget *curGroupWidget = curGroup->widget();
|
||||
Q_ASSERT(curGroupWidget);
|
||||
QTC_ASSERT(curGroupWidget, return);
|
||||
IEditor *selectedEditor = curGroup->currentEditor();
|
||||
|
||||
QSplitter *parentSplitter = qobject_cast<QSplitter*>(curGroupWidget->parentWidget());
|
||||
@@ -454,25 +457,25 @@ EditorGroup *EditorSplitter::groupFarthestOnSide(QWidget *node, Side side) const
|
||||
void EditorSplitter::selectNextGroup()
|
||||
{
|
||||
EditorGroup *curGroup = currentGroup();
|
||||
Q_ASSERT(curGroup);
|
||||
QTC_ASSERT(curGroup, return);
|
||||
setCurrentGroup(nextGroup(curGroup, RIGHT));
|
||||
}
|
||||
|
||||
void EditorSplitter::selectPreviousGroup()
|
||||
{
|
||||
EditorGroup *curGroup = currentGroup();
|
||||
Q_ASSERT(curGroup);
|
||||
QTC_ASSERT(curGroup, return);
|
||||
setCurrentGroup(nextGroup(curGroup, LEFT));
|
||||
}
|
||||
|
||||
EditorGroup *EditorSplitter::nextGroup(EditorGroup *curGroup, Side side) const
|
||||
{
|
||||
Q_ASSERT(curGroup);
|
||||
QTC_ASSERT(curGroup, return 0);
|
||||
QWidget *curWidget = curGroup->widget();
|
||||
QWidget *parent = curWidget->parentWidget();
|
||||
while (curWidget != m_root) {
|
||||
QSplitter *splitter = qobject_cast<QSplitter *>(parent);
|
||||
Q_ASSERT(splitter);
|
||||
QTC_ASSERT(splitter, return 0);
|
||||
if (splitter->widget(side) != curWidget) {
|
||||
curWidget = splitter->widget(side);
|
||||
break;
|
||||
@@ -486,7 +489,7 @@ EditorGroup *EditorSplitter::nextGroup(EditorGroup *curGroup, Side side) const
|
||||
void EditorSplitter::moveDocToAdjacentGroup(Side side)
|
||||
{
|
||||
EditorGroup *curGroup = currentGroup();
|
||||
Q_ASSERT(curGroup);
|
||||
QTC_ASSERT(curGroup, return);
|
||||
IEditor *editor = curGroup->currentEditor();
|
||||
if (!editor)
|
||||
return;
|
||||
@@ -510,7 +513,7 @@ QWidget *EditorSplitter::recreateGroupTree(QWidget *node)
|
||||
QSplitter *splitter = qobject_cast<QSplitter *>(node);
|
||||
if (!splitter) {
|
||||
EditorGroup *group = qobject_cast<EditorGroup *>(node);
|
||||
Q_ASSERT(group);
|
||||
QTC_ASSERT(group, return 0);
|
||||
IEditor *currentEditor = group->currentEditor();
|
||||
EditorGroup *newGroup = createGroup();
|
||||
bool block = newGroup->widget()->blockSignals(true);
|
||||
@@ -588,7 +591,7 @@ void EditorSplitter::saveState(QWidget *current, QDataStream &stream) const
|
||||
saveState(splitter->widget(1), stream);
|
||||
} else {
|
||||
EditorGroup *group = qobject_cast<EditorGroup *>(current);
|
||||
Q_ASSERT(group);
|
||||
QTC_ASSERT(group, /**/);
|
||||
if (group != currentGroup())
|
||||
type = 1;
|
||||
else
|
||||
@@ -639,7 +642,7 @@ void EditorSplitter::fillPathGroupMap(QWidget *current, QString currentPath,
|
||||
map.insert(currentPath, group);
|
||||
} else {
|
||||
QSplitter *splitter = qobject_cast<QSplitter *>(current);
|
||||
Q_ASSERT(splitter);
|
||||
QTC_ASSERT(splitter, return);
|
||||
fillPathGroupMap(splitter->widget(0), currentPath+"0", map);
|
||||
fillPathGroupMap(splitter->widget(1), currentPath+"1", map);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/filemanager.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QMenu>
|
||||
@@ -70,7 +71,7 @@ OpenEditorsWidget::OpenEditorsWidget()
|
||||
m_ui.editorList->installEventFilter(this);
|
||||
m_ui.editorList->setFrameStyle(QFrame::NoFrame);
|
||||
EditorManager *em = EditorManager::instance();
|
||||
foreach(IEditor *editor, em->openedEditors()) {
|
||||
foreach (IEditor *editor, em->openedEditors()) {
|
||||
registerEditor(editor);
|
||||
}
|
||||
connect(em, SIGNAL(editorOpened(Core::IEditor*)),
|
||||
@@ -197,7 +198,7 @@ void OpenEditorsWidget::selectEditor(QTreeWidgetItem *item)
|
||||
void OpenEditorsWidget::updateEditor()
|
||||
{
|
||||
IEditor *editor = qobject_cast<IEditor *>(sender());
|
||||
Q_ASSERT(editor);
|
||||
QTC_ASSERT(editor, return);
|
||||
int num = m_ui.editorList->topLevelItemCount();
|
||||
for (int i = 0; i < num; ++i) {
|
||||
QTreeWidgetItem *item = m_ui.editorList->topLevelItem(i);
|
||||
|
||||
@@ -35,21 +35,24 @@
|
||||
#include "editormanager.h"
|
||||
#include "coreimpl.h"
|
||||
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QMimeData>
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QMouseEvent>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QStackedWidget>
|
||||
#include <QtGui/QStyle>
|
||||
#include <QtGui/QStyleOption>
|
||||
#include <QtGui/QMouseEvent>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QToolBar>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QStackedWidget>
|
||||
#include <QtDebug>
|
||||
#ifdef Q_WS_MAC
|
||||
#include <qmacstyle_mac.h>
|
||||
#endif
|
||||
@@ -240,7 +243,7 @@ void StackedEditorGroup::sendCloseRequest()
|
||||
|
||||
void StackedEditorGroup::removeEditor(IEditor *editor)
|
||||
{
|
||||
Q_ASSERT(editor);
|
||||
QTC_ASSERT(editor, return);
|
||||
EditorGroup::removeEditor(editor);
|
||||
const int index = m_container->indexOf(editor->widget());
|
||||
if (index != -1) {
|
||||
@@ -280,7 +283,7 @@ void StackedEditorGroup::setCurrentEditor(IEditor *editor)
|
||||
return;
|
||||
m_toplevel->setVisible(true);
|
||||
const int idx = m_container->indexOf(editor->widget());
|
||||
Q_ASSERT(idx >= 0);
|
||||
QTC_ASSERT(idx >= 0, return);
|
||||
if (m_container->currentIndex() != idx) {
|
||||
m_container->setCurrentIndex(idx);
|
||||
|
||||
@@ -298,10 +301,11 @@ void StackedEditorGroup::setCurrentEditor(IEditor *editor)
|
||||
}
|
||||
}
|
||||
|
||||
void StackedEditorGroup::updateEditorStatus(IEditor *editor) {
|
||||
void StackedEditorGroup::updateEditorStatus(IEditor *editor)
|
||||
{
|
||||
if (!editor)
|
||||
editor = qobject_cast<IEditor *>(sender());
|
||||
Q_ASSERT(editor);
|
||||
QTC_ASSERT(editor, return);
|
||||
|
||||
static const QIcon lockedIcon(QLatin1String(":/qworkbench/images/locked.png"));
|
||||
static const QIcon unlockedIcon(QLatin1String(":/qworkbench/images/unlocked.png"));
|
||||
@@ -371,6 +375,6 @@ int StackedEditorGroup::indexOf(IEditor *editor)
|
||||
if (editor == model->data(model->index(i, 0), Qt::UserRole).value<IEditor*>())
|
||||
return i;
|
||||
}
|
||||
Q_ASSERT(false);
|
||||
QTC_ASSERT(false, /**/);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ void FileIconProvider::registerIconForSuffix(const QIcon &icon, const QString &s
|
||||
{
|
||||
// delete old icon, if it exists
|
||||
QList<QPair<QString,QIcon> >::iterator iter = m_cache.begin();
|
||||
for(; iter != m_cache.end(); ++iter) {
|
||||
for (; iter != m_cache.end(); ++iter) {
|
||||
if ((*iter).first == suffix) {
|
||||
iter = m_cache.erase(iter);
|
||||
break;
|
||||
@@ -118,7 +118,7 @@ QIcon FileIconProvider::iconForSuffix(const QString &suffix) const
|
||||
return icon;
|
||||
|
||||
QList<QPair<QString,QIcon> >::const_iterator iter = m_cache.constBegin();
|
||||
for(; iter != m_cache.constEnd(); ++iter) {
|
||||
for (; iter != m_cache.constEnd(); ++iter) {
|
||||
if ((*iter).first == suffix) {
|
||||
icon = (*iter).second;
|
||||
break;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "filemanager.h"
|
||||
|
||||
#include "ifile.h"
|
||||
#include "mainwindow.h"
|
||||
#include "saveitemsdialog.h"
|
||||
@@ -40,6 +41,8 @@
|
||||
#include "mimedatabase.h"
|
||||
#include "iversioncontrol.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QFileInfo>
|
||||
@@ -177,22 +180,20 @@ bool FileManager::removeFile(IFile *file)
|
||||
|
||||
void FileManager::addWatch(const QString &filename)
|
||||
{
|
||||
if (!filename.isEmpty() && managedFiles(filename).isEmpty()) {
|
||||
if (!filename.isEmpty() && managedFiles(filename).isEmpty())
|
||||
m_fileWatcher->addPath(filename);
|
||||
}
|
||||
}
|
||||
|
||||
void FileManager::removeWatch(const QString &filename)
|
||||
{
|
||||
if (!filename.isEmpty() && managedFiles(filename).isEmpty()) {
|
||||
if (!filename.isEmpty() && managedFiles(filename).isEmpty())
|
||||
m_fileWatcher->removePath(filename);
|
||||
}
|
||||
}
|
||||
|
||||
void FileManager::checkForNewFileName()
|
||||
{
|
||||
IFile *file = qobject_cast<IFile *>(sender());
|
||||
Q_ASSERT(file);
|
||||
QTC_ASSERT(file, return);
|
||||
const QString newfilename = fixFileName(file->fileName());
|
||||
const QString oldfilename = m_managedFiles.value(file).fileName;
|
||||
if (!newfilename.isEmpty() && newfilename != oldfilename) {
|
||||
|
||||
@@ -896,7 +896,7 @@ void MainWindow::removeContextObject(IContext *context)
|
||||
return;
|
||||
|
||||
m_contextWidgets.remove(widget);
|
||||
if(m_activeContext == context)
|
||||
if (m_activeContext == context)
|
||||
updateContextObject(0);
|
||||
}
|
||||
|
||||
@@ -957,10 +957,11 @@ void MainWindow::resetContext()
|
||||
updateContextObject(0);
|
||||
}
|
||||
|
||||
QMenu *MainWindow::createPopupMenu() {
|
||||
QMenu *MainWindow::createPopupMenu()
|
||||
{
|
||||
QMenu *menu = new QMenu(this);
|
||||
QList<ActionContainer *> containers = m_actionManager->containers();
|
||||
foreach(ActionContainer *c, containers) {
|
||||
foreach (ActionContainer *c, containers) {
|
||||
if (c->toolBar())
|
||||
menu->addAction(c->toolBar()->toggleViewAction());
|
||||
}
|
||||
|
||||
@@ -33,30 +33,34 @@
|
||||
|
||||
#include "manhattanstyle.h"
|
||||
|
||||
#include <QStyleOption>
|
||||
#include <QPainter>
|
||||
#include <QScrollArea>
|
||||
#include <QMainWindow>
|
||||
#include <QDockWidget>
|
||||
#include <QPixmapCache>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPixmap>
|
||||
#include <QToolBar>
|
||||
#include <QDialog>
|
||||
#include <QLineEdit>
|
||||
#include <QComboBox>
|
||||
#include <QLibrary>
|
||||
#include <QStatusBar>
|
||||
#include <QApplication>
|
||||
#include <QStyleFactory>
|
||||
#include <QToolButton>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QSplitter>
|
||||
#include <QMenuBar>
|
||||
#include "stylehelper.h"
|
||||
#include "styleanimator.h"
|
||||
#include <qdebug.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QLibrary>
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QDialog>
|
||||
#include <QtGui/QDialogButtonBox>
|
||||
#include <QtGui/QDockWidget>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QLineEdit>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMenuBar>
|
||||
#include <QtGui/QPainter>
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QtGui/QPixmapCache>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QScrollArea>
|
||||
#include <QtGui/QSplitter>
|
||||
#include <QtGui/QStatusBar>
|
||||
#include <QtGui/QStyleFactory>
|
||||
#include <QtGui/QStyleOption>
|
||||
#include <QtGui/QToolBar>
|
||||
#include <QtGui/QToolButton>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
// We define a currently unused state for indicating animations
|
||||
#define State_Animating 0x00000040
|
||||
@@ -97,7 +101,7 @@ public:
|
||||
ManhattanStylePrivate(const QString &baseStyleName)
|
||||
{
|
||||
style = QStyleFactory::create(baseStyleName);
|
||||
Q_ASSERT(style);
|
||||
QTC_ASSERT(style, /**/);
|
||||
buttonImage_pressed = QImage(":/qworkbench/images/pushbutton_pressed.png");
|
||||
buttonImage = QImage(":/qworkbench/images/pushbutton.png");
|
||||
|
||||
@@ -105,12 +109,15 @@ public:
|
||||
lineeditImage_disabled = QImage(":/qworkbench/images/inputfield_disabled.png");
|
||||
}
|
||||
|
||||
~ManhattanStylePrivate() {
|
||||
~ManhattanStylePrivate()
|
||||
{
|
||||
delete style;
|
||||
style = 0;
|
||||
}
|
||||
|
||||
void init();
|
||||
|
||||
public:
|
||||
QStyle *style;
|
||||
QImage buttonImage;
|
||||
QImage buttonImage_pressed;
|
||||
@@ -140,7 +147,7 @@ void drawCornerImage(const QImage &img, QPainter *painter, QRect rect,
|
||||
if (top > 0) { //top
|
||||
painter->drawImage(QRect(rect.left() + left, rect.top(), rect.width() -right - left, top), img,
|
||||
QRect(left, 0, size.width() -right - left, top));
|
||||
if(left > 0) //top-left
|
||||
if (left > 0) //top-left
|
||||
painter->drawImage(QRect(rect.left(), rect.top(), left, top), img,
|
||||
QRect(0, 0, left, top));
|
||||
if (right > 0) //top-right
|
||||
|
||||
@@ -33,19 +33,22 @@
|
||||
|
||||
#include "mimedatabase.h"
|
||||
|
||||
#include <QtCore/QStringList>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QLocale>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QMultiHash>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QSharedData>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QLocale>
|
||||
|
||||
#include <QtXml/QXmlStreamReader>
|
||||
|
||||
enum { debugMimeDB = 0 };
|
||||
@@ -299,7 +302,7 @@ void MimeTypeData::debug(QTextStream &str, int indent) const
|
||||
str << indentS << "SubClassesOf: " << subClassesOf.join(comma) << '\n';
|
||||
if (!globPatterns.empty()) {
|
||||
str << indentS << "Glob: ";
|
||||
foreach(const QRegExp &r, globPatterns)
|
||||
foreach (const QRegExp &r, globPatterns)
|
||||
str << r.pattern() << ' ';
|
||||
str << '\n';
|
||||
if (!suffixes.empty()) {
|
||||
@@ -574,7 +577,7 @@ BaseMimeTypeParser:: BaseMimeTypeParser() :
|
||||
// "*.log[1-9]"
|
||||
m_suffixPattern(QLatin1String("^\\*\\.[\\w]+$"))
|
||||
{
|
||||
Q_ASSERT(m_suffixPattern.isValid());
|
||||
QTC_ASSERT(m_suffixPattern.isValid(), /**/);
|
||||
}
|
||||
|
||||
void BaseMimeTypeParser::addGlobPattern(const QString &pattern, MimeTypeData *d) const
|
||||
|
||||
@@ -32,11 +32,13 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "modemanager.h"
|
||||
|
||||
#include "fancytabwidget.h"
|
||||
#include "fancyactionbar.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <aggregation/aggregate.h>
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
#include <coreplugin/actionmanager/icommand.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@@ -44,9 +46,12 @@
|
||||
#include <coreplugin/imode.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QSignalMapper>
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QTabWidget>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
@@ -225,7 +230,7 @@ void ModeManager::currentTabChanged(int index)
|
||||
void ModeManager::setFocusToCurrentMode()
|
||||
{
|
||||
IMode *mode = currentMode();
|
||||
Q_ASSERT(mode);
|
||||
QTC_ASSERT(mode, return);
|
||||
QWidget *widget = mode->widget();
|
||||
if (widget) {
|
||||
QWidget *focusWidget = widget->focusWidget();
|
||||
|
||||
@@ -87,8 +87,8 @@ void NavigationWidgetPlaceHolder::applyStoredSize(int width)
|
||||
QList<int> sizes = splitter->sizes();
|
||||
int index = splitter->indexOf(this);
|
||||
int diff = width - sizes.at(index);
|
||||
int adjust = sizes.count() > 1? ( diff / (sizes.count() - 1)) : 0;
|
||||
for(int i=0; i<sizes.count(); ++i) {
|
||||
int adjust = sizes.count() > 1 ? (diff / (sizes.count() - 1)) : 0;
|
||||
for (int i = 0; i < sizes.count(); ++i) {
|
||||
if (i != index)
|
||||
sizes[i] += adjust;
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ void OutputPane::init(ICore *core, ExtensionSystem::PluginManager *pm)
|
||||
|
||||
connect(cmd->action(), SIGNAL(triggered()), this, SLOT(shortcutTriggered()));
|
||||
connect(cmd->action(), SIGNAL(changed()), this, SLOT(updateToolTip()));
|
||||
} while(it != begin);
|
||||
} while (it != begin);
|
||||
|
||||
changePage();
|
||||
}
|
||||
@@ -293,7 +293,7 @@ void OutputPane::shortcutTriggered()
|
||||
// but the outputpane doesn't have focus
|
||||
// then just give it focus
|
||||
// else do the same as clicking on the button does
|
||||
if(OutputPanePlaceHolder::m_current
|
||||
if (OutputPanePlaceHolder::m_current
|
||||
&& OutputPanePlaceHolder::m_current->isVisible()
|
||||
&& m_widgetComboBox->itemData(m_widgetComboBox->currentIndex()).toInt() == idx) {
|
||||
if (!outputPane->hasFocus() && outputPane->canFocus())
|
||||
|
||||
@@ -40,11 +40,13 @@
|
||||
#include "uniqueidmanager.h"
|
||||
#include "viewmanagerinterface.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
|
||||
ProgressManager::ProgressManager(QObject *parent) :
|
||||
ProgressManagerInterface(parent)
|
||||
ProgressManager::ProgressManager(QObject *parent)
|
||||
: ProgressManagerInterface(parent)
|
||||
{
|
||||
m_progressView = new ProgressView;
|
||||
ICore *core = CoreImpl::instance();
|
||||
@@ -103,7 +105,7 @@ QWidget *ProgressManager::progressView()
|
||||
void ProgressManager::taskFinished()
|
||||
{
|
||||
QObject *taskObject = sender();
|
||||
Q_ASSERT(taskObject);
|
||||
QTC_ASSERT(taskObject, return);
|
||||
QFutureWatcher<void> *task = static_cast<QFutureWatcher<void> *>(taskObject);
|
||||
m_runningTasks.remove(task);
|
||||
delete task;
|
||||
|
||||
@@ -101,9 +101,9 @@ void ProgressBar::paintEvent(QPaintEvent *)
|
||||
double percent = 0.50;
|
||||
if (range != 0)
|
||||
percent = (value() - minimum()) / range;
|
||||
if(percent > 1)
|
||||
if (percent > 1)
|
||||
percent = 1;
|
||||
else if(percent < 0)
|
||||
else if (percent < 0)
|
||||
percent = 0;
|
||||
|
||||
QPainter p(this);
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "progressview.h"
|
||||
#include "futureprogress.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtGui/QHBoxLayout>
|
||||
|
||||
using namespace Core;
|
||||
@@ -136,7 +138,7 @@ void ProgressView::removeTask(FutureProgress *task)
|
||||
void ProgressView::slotFinished()
|
||||
{
|
||||
FutureProgress *progress = qobject_cast<FutureProgress *>(sender());
|
||||
Q_ASSERT(progress);
|
||||
QTC_ASSERT(progress, return);
|
||||
if (m_keep.contains(progress) && !m_keep.value(progress) && !progress->hasError())
|
||||
removeTask(progress);
|
||||
removeOldTasks(m_type.value(progress), true);
|
||||
|
||||
@@ -76,8 +76,8 @@ void RightPanePlaceHolder::applyStoredSize(int width)
|
||||
QList<int> sizes = splitter->sizes();
|
||||
int index = splitter->indexOf(this);
|
||||
int diff = width - sizes.at(index);
|
||||
int adjust = sizes.count() > 1? ( diff / (sizes.count() - 1)) : 0;
|
||||
for(int i=0; i<sizes.count(); ++i) {
|
||||
int adjust = sizes.count() > 1 ? (diff / (sizes.count() - 1)) : 0;
|
||||
for (int i = 0; i < sizes.count(); ++i) {
|
||||
if (i != index)
|
||||
sizes[i] -= adjust;
|
||||
}
|
||||
@@ -125,7 +125,7 @@ void RightPanePlaceHolder::currentModeChanged(Core::IMode *mode)
|
||||
RightPaneWidget *RightPaneWidget::m_instance = 0;
|
||||
|
||||
RightPaneWidget::RightPaneWidget()
|
||||
:m_shown(true), m_width(0)
|
||||
: m_shown(true), m_width(0)
|
||||
{
|
||||
m_instance = this;
|
||||
|
||||
|
||||
@@ -38,12 +38,15 @@
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/editormanager/editorgroup.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QStatusBar>
|
||||
#include <QtGui/QToolBar>
|
||||
|
||||
#include <QtScript/QScriptEngine>
|
||||
|
||||
namespace {
|
||||
@@ -107,7 +110,7 @@ QString CorePrototype::toString() const
|
||||
CorePrototype::ICore *CorePrototype::callee() const
|
||||
{
|
||||
ICore *rc = qscriptvalue_cast<ICore *>(thisObject());
|
||||
Q_ASSERT(rc);
|
||||
QTC_ASSERT(rc, return 0);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -121,14 +124,14 @@ MessageManagerPrototype::MessageManagerPrototype(QObject *parent) :
|
||||
void MessageManagerPrototype::displayStatusBarMessage(const QString &text, int ms)
|
||||
{
|
||||
MessageManager *mm = qscriptvalue_cast<MessageManager *>(thisObject());
|
||||
Q_ASSERT(mm);
|
||||
QTC_ASSERT(mm, return);
|
||||
mm->displayStatusBarMessage(text, ms);
|
||||
}
|
||||
|
||||
void MessageManagerPrototype::printToOutputPane(const QString &text, bool bringToForeground)
|
||||
{
|
||||
MessageManager *mm = qscriptvalue_cast<MessageManager *>(thisObject());
|
||||
Q_ASSERT(mm);
|
||||
QTC_ASSERT(mm, return);
|
||||
mm->printToOutputPane(text, bringToForeground);
|
||||
}
|
||||
|
||||
@@ -147,28 +150,66 @@ FileManagerPrototype::FileManagerPrototype(QObject *parent) :
|
||||
FileManager *FileManagerPrototype::callee() const
|
||||
{
|
||||
FileManager *rc = qscriptvalue_cast<FileManager *>(thisObject());
|
||||
Q_ASSERT(rc);
|
||||
QTC_ASSERT(rc, return 0);
|
||||
return rc;
|
||||
}
|
||||
|
||||
bool FileManagerPrototype::addFiles(const QList<Core::IFile *> &files) { return callee()->addFiles(files); }
|
||||
bool FileManagerPrototype::addFile(Core::IFile *file) { return callee()->addFile(file); }
|
||||
bool FileManagerPrototype::removeFile(Core::IFile *file) { return callee()->removeFile(file); }
|
||||
bool FileManagerPrototype::addFiles(const QList<Core::IFile *> &files)
|
||||
{
|
||||
return callee()->addFiles(files);
|
||||
}
|
||||
|
||||
bool FileManagerPrototype::addFile(Core::IFile *file)
|
||||
{
|
||||
return callee()->addFile(file);
|
||||
}
|
||||
|
||||
bool FileManagerPrototype::removeFile(Core::IFile *file)
|
||||
{
|
||||
return callee()->removeFile(file);
|
||||
}
|
||||
|
||||
QList<Core::IFile*>
|
||||
FileManagerPrototype::saveModifiedFilesSilently(const QList<Core::IFile*> &files) { return callee()->saveModifiedFilesSilently(files); }
|
||||
FileManagerPrototype::saveModifiedFilesSilently(const QList<Core::IFile*> &files)
|
||||
{
|
||||
return callee()->saveModifiedFilesSilently(files);
|
||||
}
|
||||
|
||||
QString FileManagerPrototype::getSaveAsFileName(Core::IFile *file) { return callee()->getSaveAsFileName(file); }
|
||||
QString FileManagerPrototype::getSaveAsFileName(Core::IFile *file)
|
||||
{
|
||||
return callee()->getSaveAsFileName(file);
|
||||
}
|
||||
|
||||
bool FileManagerPrototype::isFileManaged(const QString &fileName) const
|
||||
{
|
||||
return callee()->isFileManaged(fileName);
|
||||
}
|
||||
|
||||
bool FileManagerPrototype::isFileManaged(const QString &fileName) const { return callee()->isFileManaged(fileName); }
|
||||
QList<Core::IFile *>
|
||||
FileManagerPrototype::managedFiles(const QString &fileName) const { return callee()->managedFiles(fileName); }
|
||||
FileManagerPrototype::managedFiles(const QString &fileName) const
|
||||
{
|
||||
return callee()->managedFiles(fileName);
|
||||
}
|
||||
|
||||
void FileManagerPrototype::blockFileChange(Core::IFile *file) { callee()->blockFileChange(file); }
|
||||
void FileManagerPrototype::unblockFileChange(Core::IFile *file) { return callee()->unblockFileChange(file); }
|
||||
void FileManagerPrototype::blockFileChange(Core::IFile *file)
|
||||
{
|
||||
callee()->blockFileChange(file);
|
||||
}
|
||||
|
||||
void FileManagerPrototype::addToRecentFiles(const QString &fileName) { return callee()->addToRecentFiles(fileName); }
|
||||
QStringList FileManagerPrototype::recentFiles() const { return callee()->recentFiles(); }
|
||||
void FileManagerPrototype::unblockFileChange(Core::IFile *file)
|
||||
{
|
||||
return callee()->unblockFileChange(file);
|
||||
}
|
||||
|
||||
void FileManagerPrototype::addToRecentFiles(const QString &fileName)
|
||||
{
|
||||
return callee()->addToRecentFiles(fileName);
|
||||
}
|
||||
|
||||
QStringList FileManagerPrototype::recentFiles() const
|
||||
{
|
||||
return callee()->recentFiles();
|
||||
}
|
||||
|
||||
QString FileManagerPrototype::toString() const
|
||||
{
|
||||
@@ -185,7 +226,7 @@ FilePrototype::FilePrototype(QObject *parent) :
|
||||
IFile *FilePrototype::callee() const
|
||||
{
|
||||
IFile *rc = qscriptvalue_cast<IFile *>(thisObject());
|
||||
Q_ASSERT(rc);
|
||||
QTC_ASSERT(rc, return 0);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -270,39 +311,66 @@ QString EditorManagerPrototype::toString() const
|
||||
EditorManagerPrototype::EditorManager *EditorManagerPrototype::callee() const
|
||||
{
|
||||
EditorManager *rc = qscriptvalue_cast<EditorManager *>(thisObject());
|
||||
Q_ASSERT(rc);
|
||||
QTC_ASSERT(rc, return 0);
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
||||
// ------------- EditorPrototype
|
||||
|
||||
EditorPrototype::EditorPrototype(QObject *parent) :
|
||||
QObject(parent)
|
||||
EditorPrototype::EditorPrototype(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QString EditorPrototype::displayName() const { return callee()->displayName(); }
|
||||
void EditorPrototype::setDisplayName(const QString &title) { callee()->setDisplayName(title); }
|
||||
QString EditorPrototype::displayName() const
|
||||
{
|
||||
return callee()->displayName();
|
||||
}
|
||||
|
||||
QString EditorPrototype::kind() const { return QLatin1String(callee()->kind()); }
|
||||
bool EditorPrototype::duplicateSupported() const { return callee()->duplicateSupported(); }
|
||||
void EditorPrototype::setDisplayName(const QString &title)
|
||||
{
|
||||
callee()->setDisplayName(title);
|
||||
}
|
||||
|
||||
bool EditorPrototype::createNew(const QString &contents) { return callee()->createNew(contents); }
|
||||
bool EditorPrototype::open(const QString &fileName) { return callee()->open(fileName); }
|
||||
QString EditorPrototype::kind() const
|
||||
{
|
||||
return QLatin1String(callee()->kind());
|
||||
}
|
||||
|
||||
bool EditorPrototype::duplicateSupported() const
|
||||
{
|
||||
return callee()->duplicateSupported();
|
||||
}
|
||||
|
||||
bool EditorPrototype::createNew(const QString &contents)
|
||||
{
|
||||
return callee()->createNew(contents);
|
||||
}
|
||||
|
||||
bool EditorPrototype::open(const QString &fileName)
|
||||
{
|
||||
return callee()->open(fileName);
|
||||
}
|
||||
|
||||
Core::IEditor *EditorPrototype::duplicate(QWidget *parent)
|
||||
{
|
||||
return callee()->duplicate(parent);
|
||||
}
|
||||
|
||||
Core::IFile *EditorPrototype::file() const { return callee()->file(); }
|
||||
QToolBar* EditorPrototype::toolBar() const { return callee()->toolBar();}
|
||||
Core::IFile *EditorPrototype::file() const
|
||||
{
|
||||
return callee()->file();
|
||||
}
|
||||
|
||||
QToolBar* EditorPrototype::toolBar() const
|
||||
{
|
||||
return callee()->toolBar();
|
||||
}
|
||||
|
||||
Core::IEditor *EditorPrototype::callee() const
|
||||
{
|
||||
IEditor *rc = qscriptvalue_cast<IEditor *>(thisObject());
|
||||
Q_ASSERT(rc);
|
||||
QTC_ASSERT(rc, return 0);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -375,7 +443,7 @@ QString EditorGroupPrototype::toString() const
|
||||
Core::EditorGroup *EditorGroupPrototype::callee() const
|
||||
{
|
||||
EditorGroup *rc = qscriptvalue_cast<EditorGroup *>(thisObject());
|
||||
Q_ASSERT(rc);
|
||||
QTC_ASSERT(rc, return 0);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,8 +36,10 @@
|
||||
#include "metatypedeclarations.h"
|
||||
|
||||
#include <extensionsystem/ExtensionSystemInterfaces>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <interface_wrap_helpers.h>
|
||||
#include <wrap_helpers.h>
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
@@ -154,7 +156,7 @@ static QScriptValue inputDialogGetItem(QScriptContext *context, QScriptEngine *e
|
||||
// Script function template to pop up a file box
|
||||
// with a certain icon and buttons.
|
||||
template <int TAcceptMode, int TFileMode>
|
||||
static QScriptValue fileBox(QScriptContext *context, QScriptEngine *engine)
|
||||
static QScriptValue fileBox(QScriptContext *context, QScriptEngine *engine)
|
||||
{
|
||||
const int argumentCount = context->argumentCount();
|
||||
if (argumentCount < 2)
|
||||
@@ -170,7 +172,7 @@ template <int TAcceptMode, int TFileMode>
|
||||
if (fileDialog.exec() == QDialog::Rejected)
|
||||
return QScriptValue(engine, QScriptValue::NullValue);
|
||||
const QStringList rc = fileDialog.selectedFiles();
|
||||
Q_ASSERT(!rc.empty());
|
||||
QTC_ASSERT(!rc.empty(), /**/);
|
||||
return TFileMode == QFileDialog::ExistingFiles ?
|
||||
engine->toScriptValue(rc) : engine->toScriptValue(rc.front());
|
||||
}
|
||||
@@ -249,7 +251,7 @@ void ScriptManager::ensureEngineInitialized()
|
||||
{
|
||||
if (m_initialized)
|
||||
return;
|
||||
Q_ASSERT(m_core);
|
||||
QTC_ASSERT(m_core, return);
|
||||
// register QObjects that occur as properties
|
||||
SharedTools::registerQObject<QMainWindow>(m_engine);
|
||||
SharedTools::registerQObject<QStatusBar>(m_engine);
|
||||
|
||||
@@ -52,7 +52,8 @@ void Animation::paint(QPainter *painter, const QStyleOption *option)
|
||||
Q_UNUSED(painter);
|
||||
}
|
||||
|
||||
void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha) {
|
||||
void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha)
|
||||
{
|
||||
if (_secondaryImage.isNull() || _primaryImage.isNull())
|
||||
return;
|
||||
|
||||
@@ -64,7 +65,7 @@ void Animation::drawBlendedImage(QPainter *painter, QRect rect, float alpha) {
|
||||
const int sw = _primaryImage.width();
|
||||
const int sh = _primaryImage.height();
|
||||
const int bpl = _primaryImage.bytesPerLine();
|
||||
switch(_primaryImage.depth()) {
|
||||
switch (_primaryImage.depth()) {
|
||||
case 32:
|
||||
{
|
||||
uchar *mixed_data = _tempImage.bits();
|
||||
|
||||
@@ -77,7 +77,7 @@ void VCSManager::setVCSEnabled(const QString &directory)
|
||||
qDebug() << Q_FUNC_INFO << directory;
|
||||
IVersionControl* managingVCS = findVersionControlForDirectory(directory);
|
||||
const VersionControlList versionControls = allVersionControls();
|
||||
foreach(IVersionControl *versionControl, versionControls) {
|
||||
foreach (IVersionControl *versionControl, versionControls) {
|
||||
const bool newEnabled = versionControl == managingVCS;
|
||||
if (newEnabled != versionControl->isEnabled())
|
||||
versionControl->setEnabled(newEnabled);
|
||||
@@ -89,7 +89,7 @@ void VCSManager::setAllVCSEnabled()
|
||||
if (debug)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
const VersionControlList versionControls = allVersionControls();
|
||||
foreach(IVersionControl *versionControl, versionControls)
|
||||
foreach (IVersionControl *versionControl, versionControls)
|
||||
if (!versionControl->isEnabled())
|
||||
versionControl->setEnabled(true);
|
||||
}
|
||||
@@ -106,7 +106,7 @@ IVersionControl* VCSManager::findVersionControlForDirectory(const QString &direc
|
||||
|
||||
int pos = 0;
|
||||
const QChar slash = QLatin1Char('/');
|
||||
while(true) {
|
||||
while (true) {
|
||||
int index = directory.indexOf(slash, pos);
|
||||
if (index == -1)
|
||||
break;
|
||||
@@ -119,7 +119,7 @@ IVersionControl* VCSManager::findVersionControlForDirectory(const QString &direc
|
||||
|
||||
// ah nothing so ask the IVersionControls directly
|
||||
const VersionControlList versionControls = allVersionControls();
|
||||
foreach(IVersionControl * versionControl, versionControls) {
|
||||
foreach (IVersionControl * versionControl, versionControls) {
|
||||
if (versionControl->managesDirectory(directory)) {
|
||||
m_d->m_cachedMatches.insert(versionControl->findTopLevelForDirectory(directory), versionControl);
|
||||
return versionControl;
|
||||
|
||||
@@ -32,21 +32,25 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "versiondialog.h"
|
||||
|
||||
#include "coreconstants.h"
|
||||
#include "coreimpl.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDate>
|
||||
#include <QtCore/QFile>
|
||||
|
||||
#include <QtGui/QDialogButtonBox>
|
||||
#include <QtGui/QGridLayout>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QTextBrowser>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
using namespace Core::Constants;
|
||||
|
||||
#include <QtCore/QDate>
|
||||
#include <QtCore/QFile>
|
||||
#include <QtGui/QGridLayout>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QDialogButtonBox>
|
||||
#include <QtGui/QTextBrowser>
|
||||
|
||||
VersionDialog::VersionDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
@@ -90,7 +94,7 @@ VersionDialog::VersionDialog(QWidget *parent)
|
||||
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
|
||||
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
|
||||
Q_ASSERT(closeButton);
|
||||
QTC_ASSERT(closeButton, /**/);
|
||||
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
|
||||
connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
|
||||
|
||||
@@ -118,7 +122,7 @@ void VersionDialog::popupLicense()
|
||||
|
||||
// Read file into string
|
||||
ICore * core = CoreImpl::instance();
|
||||
Q_ASSERT(core != NULL);
|
||||
QTC_ASSERT(core, return);
|
||||
QString fileName = core->resourcePath() + "/license.txt";
|
||||
QFile file(fileName);
|
||||
|
||||
|
||||
@@ -36,12 +36,14 @@
|
||||
|
||||
#include <utils/codegeneration.h>
|
||||
#include <utils/newclasswidget.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QTextStream>
|
||||
|
||||
#include <QtGui/QCheckBox>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QtGui/QWizard>
|
||||
@@ -196,7 +198,7 @@ bool CppClassWizard::generateHeaderAndSource(const CppClassWizardParameters &par
|
||||
<< "\n#define " << guard << '\n' << '\n';
|
||||
|
||||
const QRegExp qtClassExpr(QLatin1String("^Q[A-Z3].+"));
|
||||
Q_ASSERT(qtClassExpr.isValid());
|
||||
QTC_ASSERT(qtClassExpr.isValid(), /**/);
|
||||
const bool superIsQtClass = qtClassExpr.exactMatch(params.baseClass);
|
||||
if (superIsQtClass) {
|
||||
Core::Utils::writeIncludeFileDirective(params.baseClass, true, headerStr);
|
||||
|
||||
@@ -520,6 +520,15 @@ void CPPEditor::jumpToDefinition()
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
foreach (const Document::MacroUse use, doc->macroUses()) {
|
||||
if (use.contains(endOfName - 1)) {
|
||||
const Macro ¯o = use.macro();
|
||||
const QString fileName = QString::fromUtf8(macro.fileName);
|
||||
if (TextEditor::BaseTextEditor::openEditorAt(fileName, macro.line, 0))
|
||||
return; // done
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "No results for expression:" << expression;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "cppcodecompletion.h"
|
||||
|
||||
#include "cppmodelmanager.h"
|
||||
|
||||
#include <Control.h>
|
||||
@@ -45,6 +46,7 @@
|
||||
#include <SymbolVisitor.h>
|
||||
#include <Scope.h>
|
||||
#include <TranslationUnit.h>
|
||||
|
||||
#include <cplusplus/ResolveExpression.h>
|
||||
#include <cplusplus/LookupContext.h>
|
||||
#include <cplusplus/Overview.h>
|
||||
@@ -55,6 +57,7 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <texteditor/itexteditor.h>
|
||||
#include <texteditor/itexteditable.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <texteditor/basetexteditor.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
@@ -540,7 +543,7 @@ bool CppCodeCompletion::completeMember(FullySpecifiedType,
|
||||
const QList<TypeOfExpression::Result> &results,
|
||||
const LookupContext &context)
|
||||
{
|
||||
Q_ASSERT(! results.isEmpty());
|
||||
QTC_ASSERT(!results.isEmpty(), return false);
|
||||
|
||||
QList<Symbol *> classObjectCandidates;
|
||||
|
||||
@@ -938,7 +941,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
|
||||
if (m_completionOperator == T_LPAREN) {
|
||||
if (symbol) {
|
||||
Function *function = symbol->type()->asFunction();
|
||||
Q_ASSERT(function != 0);
|
||||
QTC_ASSERT(function, return);
|
||||
|
||||
m_functionArgumentWidget = new FunctionArgumentWidget(m_core);
|
||||
m_functionArgumentWidget->showFunctionHint(function);
|
||||
|
||||
@@ -31,16 +31,20 @@
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef DEBUGGER_QWB_ASSERT_H
|
||||
#define DEBUGGER_QWB_ASSERT_H
|
||||
#include "cppfunctionsfilter.h"
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
#define QWB_ASSERT(cond, action) \
|
||||
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED"<<__FILE__<<__LINE__;action;}
|
||||
#else
|
||||
#define QWB_ASSERT(cond, action) \
|
||||
if(cond){}else{qDebug()<<"ASSERTION"<<#cond<<"FAILED";action;}
|
||||
#endif
|
||||
using namespace CppTools::Internal;
|
||||
|
||||
#endif // DEBUGGER_QWB_ASSERT_H
|
||||
CppFunctionsFilter::CppFunctionsFilter(CppModelManager *manager, Core::EditorManager *editorManager)
|
||||
: CppQuickOpenFilter(manager, editorManager)
|
||||
{
|
||||
setShortcutString("m");
|
||||
setIncludedByDefault(false);
|
||||
|
||||
search.setSymbolsToSearchFor(SearchSymbols::Functions);
|
||||
search.setSeparateScope(true);
|
||||
}
|
||||
|
||||
CppFunctionsFilter::~CppFunctionsFilter()
|
||||
{
|
||||
}
|
||||
58
src/plugins/cpptools/cppfunctionsfilter.h
Normal file
58
src/plugins/cpptools/cppfunctionsfilter.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/***************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Qt Software Information (qt-info@nokia.com)
|
||||
**
|
||||
**
|
||||
** Non-Open Source Usage
|
||||
**
|
||||
** Licensees may use this file in accordance with the Qt Beta Version
|
||||
** License Agreement, Agreement version 2.2 provided with the Software or,
|
||||
** alternatively, in accordance with the terms contained in a written
|
||||
** agreement between you and Nokia.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License versions 2.0 or 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.GPL included in the packaging
|
||||
** of this file. Please review the following information to ensure GNU
|
||||
** General Public Licensing requirements will be met:
|
||||
**
|
||||
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt GPL Exception
|
||||
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef CPPFUNCTIONSFILTER_H
|
||||
#define CPPFUNCTIONSFILTER_H
|
||||
|
||||
#include <cppquickopenfilter.h>
|
||||
|
||||
namespace CppTools {
|
||||
namespace Internal {
|
||||
|
||||
class CppFunctionsFilter : public CppQuickOpenFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CppFunctionsFilter(CppModelManager *manager, Core::EditorManager *editorManager);
|
||||
~CppFunctionsFilter();
|
||||
|
||||
QString trName() const { return tr("Methods"); }
|
||||
QString name() const { return QLatin1String("Methods"); }
|
||||
Priority priority() const { return Medium; }
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CppTools
|
||||
|
||||
#endif // CPPFUNCTIONSFILTER_H
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <texteditor/itexteditor.h>
|
||||
#include <texteditor/basetexteditor.h>
|
||||
#include <debugger/debuggerconstants.h>
|
||||
|
||||
#include <CoreTypes.h>
|
||||
@@ -51,13 +52,13 @@
|
||||
#include <cplusplus/TypeOfExpression.h>
|
||||
|
||||
#include <QtGui/QToolTip>
|
||||
#include <QtGui/QPlainTextEdit>
|
||||
#include <QtGui/QTextCursor>
|
||||
#include <QtGui/QTextBlock>
|
||||
#include <QtHelp/QHelpEngineCore>
|
||||
#include <QtCore/QtCore>
|
||||
|
||||
using namespace CppTools::Internal;
|
||||
using namespace CPlusPlus;
|
||||
|
||||
CppHoverHandler::CppHoverHandler(CppModelManager *manager, QObject *parent)
|
||||
: QObject(parent), m_manager(manager), m_helpEngineNeedsSetup(false)
|
||||
@@ -104,11 +105,9 @@ void CppHoverHandler::showToolTip(TextEditor::ITextEditor *editor, const QPoint
|
||||
}
|
||||
}
|
||||
|
||||
static QString buildHelpId(const CPlusPlus::FullySpecifiedType &type,
|
||||
const CPlusPlus::Symbol *symbol)
|
||||
static QString buildHelpId(const FullySpecifiedType &type,
|
||||
const Symbol *symbol)
|
||||
{
|
||||
using namespace CPlusPlus;
|
||||
|
||||
Name *name = 0;
|
||||
Scope *scope = 0;
|
||||
|
||||
@@ -156,12 +155,10 @@ static QString buildHelpId(const CPlusPlus::FullySpecifiedType &type,
|
||||
|
||||
void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, int pos)
|
||||
{
|
||||
using namespace CPlusPlus;
|
||||
|
||||
m_helpId.clear();
|
||||
m_toolTip.clear();
|
||||
|
||||
QPlainTextEdit *edit = qobject_cast<QPlainTextEdit *>(editor->widget());
|
||||
TextEditor::BaseTextEditor *edit = qobject_cast<TextEditor::BaseTextEditor *>(editor->widget());
|
||||
if (!edit)
|
||||
return;
|
||||
|
||||
@@ -169,8 +166,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
||||
tc.setPosition(pos);
|
||||
|
||||
const int lineNumber = tc.block().blockNumber() + 1;
|
||||
|
||||
QString fileName = editor->file()->fileName();
|
||||
const QString fileName = editor->file()->fileName();
|
||||
Document::Ptr doc = m_manager->document(fileName);
|
||||
if (doc) {
|
||||
foreach (Document::DiagnosticMessage m, doc->diagnosticMessages()) {
|
||||
@@ -235,6 +231,16 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
||||
}
|
||||
}
|
||||
|
||||
if (doc && m_toolTip.isEmpty()) {
|
||||
foreach (const Document::MacroUse &use, doc->macroUses()) {
|
||||
if (use.contains(pos)) {
|
||||
m_toolTip = use.macro().toString();
|
||||
m_helpId = use.macro().name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_helpEngineNeedsSetup
|
||||
&& m_helpEngine->registeredDocumentations().count() > 0) {
|
||||
m_helpEngine->setupData();
|
||||
@@ -243,7 +249,8 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
|
||||
|
||||
if (!m_helpId.isEmpty() && !m_helpEngine->linksForIdentifier(m_helpId).isEmpty()) {
|
||||
m_toolTip = QString(QLatin1String("<table><tr><td valign=middle><nobr>%1</td>"
|
||||
"<td><img src=\":/cpptools/images/f1.svg\"></td></tr></table>")).arg(Qt::escape(m_toolTip));
|
||||
"<td><img src=\":/cpptools/images/f1.svg\"></td></tr></table>"))
|
||||
.arg(Qt::escape(m_toolTip));
|
||||
editor->setContextHelpId(m_helpId);
|
||||
} else if (!m_toolTip.isEmpty()) {
|
||||
m_toolTip = QString(QLatin1String("<nobr>%1")).arg(Qt::escape(m_toolTip));
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/progressmanager/progressmanager.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <TranslationUnit.h>
|
||||
#include <Semantic.h>
|
||||
#include <AST.h>
|
||||
@@ -64,10 +66,11 @@
|
||||
#include <Lexer.h>
|
||||
#include <Token.h>
|
||||
|
||||
#include <QPlainTextEdit>
|
||||
#include <QMutexLocker>
|
||||
#include <QTime>
|
||||
#include <QDebug>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QMutexLocker>
|
||||
#include <QtCore/QTime>
|
||||
|
||||
//#include <QtGui/QPlainTextEdit>
|
||||
|
||||
using namespace CppTools;
|
||||
using namespace CppTools::Internal;
|
||||
@@ -299,14 +302,14 @@ void CppPreprocessor::macroAdded(const Macro ¯o)
|
||||
}
|
||||
|
||||
void CppPreprocessor::startExpandingMacro(unsigned offset,
|
||||
const Macro &,
|
||||
const Macro ¯o,
|
||||
const QByteArray &originalText)
|
||||
{
|
||||
if (! m_currentDoc)
|
||||
return;
|
||||
|
||||
//qDebug() << "start expanding:" << macro.name << "text:" << originalText;
|
||||
m_currentDoc->addMacroUse(offset, originalText.length());
|
||||
m_currentDoc->addMacroUse(macro, offset, originalText.length());
|
||||
}
|
||||
|
||||
void CppPreprocessor::stopExpandingMacro(unsigned, const Macro &)
|
||||
@@ -387,17 +390,17 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type)
|
||||
} else {
|
||||
Document::Ptr previousDoc = switchDocument(Document::create(fileName));
|
||||
|
||||
const QByteArray previousFile = env.current_file;
|
||||
const QByteArray previousFile = env.currentFile;
|
||||
const unsigned previousLine = env.currentLine;
|
||||
|
||||
env.current_file = QByteArray(m_currentDoc->translationUnit()->fileName(),
|
||||
m_currentDoc->translationUnit()->fileNameLength());
|
||||
env.currentFile = QByteArray(m_currentDoc->translationUnit()->fileName(),
|
||||
m_currentDoc->translationUnit()->fileNameLength());
|
||||
|
||||
QByteArray preprocessedCode;
|
||||
m_proc(contents, &preprocessedCode);
|
||||
//qDebug() << preprocessedCode;
|
||||
|
||||
env.current_file = previousFile;
|
||||
env.currentFile = previousFile;
|
||||
env.currentLine = previousLine;
|
||||
|
||||
m_currentDoc->setSource(preprocessedCode);
|
||||
@@ -439,10 +442,10 @@ CppModelManager::CppModelManager(QObject *parent) :
|
||||
m_projectExplorer = ExtensionSystem::PluginManager::instance()
|
||||
->getObject<ProjectExplorer::ProjectExplorerPlugin>();
|
||||
|
||||
Q_ASSERT(m_projectExplorer);
|
||||
QTC_ASSERT(m_projectExplorer, return);
|
||||
|
||||
ProjectExplorer::SessionManager *session = m_projectExplorer->session();
|
||||
Q_ASSERT(session != 0);
|
||||
QTC_ASSERT(session, return);
|
||||
|
||||
connect(session, SIGNAL(projectAdded(ProjectExplorer::Project*)),
|
||||
this, SLOT(onProjectAdded(ProjectExplorer::Project*)));
|
||||
@@ -626,7 +629,7 @@ void CppModelManager::editorOpened(Core::IEditor *editor)
|
||||
{
|
||||
if (isCppEditor(editor)) {
|
||||
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
|
||||
Q_ASSERT(textEditor != 0);
|
||||
QTC_ASSERT(textEditor, return);
|
||||
|
||||
CppEditorSupport *editorSupport = new CppEditorSupport(this);
|
||||
editorSupport->setTextEditor(textEditor);
|
||||
@@ -646,7 +649,7 @@ void CppModelManager::editorAboutToClose(Core::IEditor *editor)
|
||||
{
|
||||
if (isCppEditor(editor)) {
|
||||
TextEditor::ITextEditor *textEditor = qobject_cast<TextEditor::ITextEditor *>(editor);
|
||||
Q_ASSERT(textEditor != 0);
|
||||
QTC_ASSERT(textEditor, return);
|
||||
|
||||
CppEditorSupport *editorSupport = m_editorSupport.value(textEditor);
|
||||
m_editorSupport.remove(textEditor);
|
||||
@@ -785,7 +788,7 @@ void CppModelManager::parse(QFutureInterface<void> &future,
|
||||
CppPreprocessor *preproc,
|
||||
QStringList files)
|
||||
{
|
||||
Q_ASSERT(! files.isEmpty());
|
||||
QTC_ASSERT(!files.isEmpty(), return);
|
||||
|
||||
// Change the priority of the background parser thread to idle.
|
||||
QThread::currentThread()->setPriority(QThread::IdlePriority);
|
||||
|
||||
@@ -75,6 +75,12 @@ void CppQuickOpenFilter::refresh(QFutureInterface<void> &future)
|
||||
Q_UNUSED(future);
|
||||
}
|
||||
|
||||
static bool compareLexigraphically(const QuickOpen::FilterEntry &a,
|
||||
const QuickOpen::FilterEntry &b)
|
||||
{
|
||||
return a.displayName < b.displayName;
|
||||
}
|
||||
|
||||
QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &origEntry)
|
||||
{
|
||||
QString entry = trimWildcards(origEntry);
|
||||
@@ -109,6 +115,9 @@ QList<QuickOpen::FilterEntry> CppQuickOpenFilter::matchesFor(const QString &orig
|
||||
}
|
||||
}
|
||||
|
||||
if (entries.size() < 1000)
|
||||
qSort(entries.begin(), entries.end(), compareLexigraphically);
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "cpptools.h"
|
||||
#include "cppclassesfilter.h"
|
||||
#include "cppcodecompletion.h"
|
||||
#include "cppfunctionsfilter.h"
|
||||
#include "cpphoverhandler.h"
|
||||
#include "cppmodelmanager.h"
|
||||
#include "cpptoolsconstants.h"
|
||||
@@ -89,6 +90,7 @@ bool CppToolsPlugin::initialize(const QStringList & /*arguments*/, QString *)
|
||||
m_core->editorManager());
|
||||
addAutoReleasedObject(quickOpenFilter);
|
||||
addAutoReleasedObject(new CppClassesFilter(m_modelManager, m_core->editorManager()));
|
||||
addAutoReleasedObject(new CppFunctionsFilter(m_modelManager, m_core->editorManager()));
|
||||
|
||||
// Menus
|
||||
Core::IActionContainer *mtools = am->actionContainer(Core::Constants::M_TOOLS);
|
||||
|
||||
@@ -10,15 +10,16 @@ unix:QMAKE_CXXFLAGS_DEBUG += -O3
|
||||
INCLUDEPATH += .
|
||||
DEFINES += CPPTOOLS_LIBRARY
|
||||
CONFIG += help
|
||||
|
||||
HEADERS += cpptools_global.h \
|
||||
cppquickopenfilter.h \
|
||||
cppclassesfilter.h \
|
||||
searchsymbols.h
|
||||
searchsymbols.h \
|
||||
cppfunctionsfilter.h
|
||||
SOURCES += cppquickopenfilter.cpp \
|
||||
cpptoolseditorsupport.cpp \
|
||||
cppclassesfilter.cpp \
|
||||
searchsymbols.cpp
|
||||
searchsymbols.cpp \
|
||||
cppfunctionsfilter.cpp
|
||||
|
||||
# Input
|
||||
SOURCES += cpptools.cpp \
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <Literals.h>
|
||||
#include <Scope.h>
|
||||
#include <Names.h>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
using namespace CppTools::Internal;
|
||||
@@ -97,12 +98,24 @@ bool SearchSymbols::visit(Function *symbol)
|
||||
if (!(symbolsToSearchFor & Functions))
|
||||
return false;
|
||||
|
||||
QString extraScope;
|
||||
if (Name *name = symbol->name()) {
|
||||
if (QualifiedNameId *nameId = name->asQualifiedNameId()) {
|
||||
if (nameId->nameCount() > 1) {
|
||||
extraScope = overview.prettyName(nameId->nameAt(nameId->nameCount() - 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
QString fullScope = _scope;
|
||||
if (!_scope.isEmpty() && !extraScope.isEmpty())
|
||||
fullScope += QLatin1String("::");
|
||||
fullScope += extraScope;
|
||||
QString name = symbolName(symbol);
|
||||
QString scopedName = scopedSymbolName(name);
|
||||
QString type = overview.prettyType(symbol->type(),
|
||||
separateScope ? symbol->name() : 0);
|
||||
separateScope ? symbol->identity() : 0);
|
||||
appendItem(separateScope ? type : scopedName,
|
||||
separateScope ? _scope : type,
|
||||
separateScope ? fullScope : type,
|
||||
ModelItemInfo::Method, symbol);
|
||||
return false;
|
||||
}
|
||||
@@ -153,7 +166,7 @@ bool SearchSymbols::visit(Class *symbol)
|
||||
QString SearchSymbols::scopedSymbolName(const QString &symbolName) const
|
||||
{
|
||||
QString name = _scope;
|
||||
if (! name.isEmpty())
|
||||
if (!name.isEmpty())
|
||||
name += QLatin1String("::");
|
||||
name += symbolName;
|
||||
return name;
|
||||
@@ -196,6 +209,9 @@ void SearchSymbols::appendItem(const QString &name,
|
||||
ModelItemInfo::ItemType type,
|
||||
const Symbol *symbol)
|
||||
{
|
||||
if (!symbol->name())
|
||||
return;
|
||||
|
||||
const QIcon icon = icons.iconForSymbol(symbol);
|
||||
items.append(ModelItemInfo(name, info, type,
|
||||
QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()),
|
||||
|
||||
@@ -152,13 +152,12 @@ void AttachExternalDialog::rebuildProcessList()
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
|
||||
// Forward declarations:
|
||||
BOOL GetProcessList( );
|
||||
BOOL ListProcessModules( DWORD dwPID );
|
||||
BOOL ListProcessThreads( DWORD dwOwnerPID );
|
||||
void printError( TCHAR* msg );
|
||||
BOOL GetProcessList();
|
||||
BOOL ListProcessModules(DWORD dwPID);
|
||||
BOOL ListProcessThreads(DWORD dwOwnerPID);
|
||||
void printError(TCHAR *msg);
|
||||
|
||||
BOOL GetProcessList( )
|
||||
BOOL GetProcessList()
|
||||
{
|
||||
HANDLE hProcessSnap;
|
||||
HANDLE hProcess;
|
||||
@@ -167,7 +166,7 @@ BOOL GetProcessList( )
|
||||
|
||||
// Take a snapshot of all processes in the system.
|
||||
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
|
||||
if( hProcessSnap == INVALID_HANDLE_VALUE )
|
||||
if (hProcessSnap == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printError( TEXT("CreateToolhelp32Snapshot (of processes)") );
|
||||
return( FALSE );
|
||||
@@ -178,7 +177,7 @@ BOOL GetProcessList( )
|
||||
|
||||
// Retrieve information about the first process,
|
||||
// and exit if unsuccessful
|
||||
if( !Process32First( hProcessSnap, &pe32 ) )
|
||||
if (!Process32First( hProcessSnap, &pe32 ))
|
||||
{
|
||||
printError( TEXT("Process32First") ); // show cause of failure
|
||||
CloseHandle( hProcessSnap ); // clean the snapshot object
|
||||
@@ -196,12 +195,12 @@ BOOL GetProcessList( )
|
||||
// Retrieve the priority class.
|
||||
dwPriorityClass = 0;
|
||||
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID );
|
||||
if( hProcess == NULL )
|
||||
if (hProcess == NULL)
|
||||
printError( TEXT("OpenProcess") );
|
||||
else
|
||||
{
|
||||
dwPriorityClass = GetPriorityClass( hProcess );
|
||||
if( !dwPriorityClass )
|
||||
if (!dwPriorityClass)
|
||||
printError( TEXT("GetPriorityClass") );
|
||||
CloseHandle( hProcess );
|
||||
}
|
||||
@@ -210,31 +209,30 @@ BOOL GetProcessList( )
|
||||
printf( "\n Thread count = %d", pe32.cntThreads );
|
||||
printf( "\n Parent process ID = 0x%08X", pe32.th32ParentProcessID );
|
||||
printf( "\n Priority base = %d", pe32.pcPriClassBase );
|
||||
if( dwPriorityClass )
|
||||
if (dwPriorityClass)
|
||||
printf( "\n Priority class = %d", dwPriorityClass );
|
||||
|
||||
// List the modules and threads associated with this process
|
||||
ListProcessModules( pe32.th32ProcessID );
|
||||
ListProcessThreads( pe32.th32ProcessID );
|
||||
|
||||
} while( Process32Next( hProcessSnap, &pe32 ) );
|
||||
} while (Process32Next(hProcessSnap, &pe32));
|
||||
|
||||
CloseHandle( hProcessSnap );
|
||||
return( TRUE );
|
||||
CloseHandle(hProcessSnap);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOL ListProcessModules( DWORD dwPID )
|
||||
BOOL ListProcessModules(DWORD dwPID)
|
||||
{
|
||||
HANDLE hModuleSnap = INVALID_HANDLE_VALUE;
|
||||
MODULEENTRY32 me32;
|
||||
|
||||
// Take a snapshot of all modules in the specified process.
|
||||
hModuleSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPID );
|
||||
if( hModuleSnap == INVALID_HANDLE_VALUE )
|
||||
{
|
||||
printError( TEXT("CreateToolhelp32Snapshot (of modules)") );
|
||||
return( FALSE );
|
||||
if (hModuleSnap == INVALID_HANDLE_VALUE) {
|
||||
printError(TEXT("CreateToolhelp32Snapshot (of modules)"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Set the size of the structure before using it.
|
||||
@@ -242,7 +240,7 @@ BOOL ListProcessModules( DWORD dwPID )
|
||||
|
||||
// Retrieve information about the first module,
|
||||
// and exit if unsuccessful
|
||||
if( !Module32First( hModuleSnap, &me32 ) )
|
||||
if (!Module32First( hModuleSnap, &me32))
|
||||
{
|
||||
printError( TEXT("Module32First") ); // show cause of failure
|
||||
CloseHandle( hModuleSnap ); // clean the snapshot object
|
||||
@@ -261,10 +259,10 @@ BOOL ListProcessModules( DWORD dwPID )
|
||||
printf( "\n Base address = 0x%08X", (DWORD) me32.modBaseAddr );
|
||||
printf( "\n Base size = %d", me32.modBaseSize );
|
||||
|
||||
} while( Module32Next( hModuleSnap, &me32 ) );
|
||||
} while (Module32Next(hModuleSnap, &me32));
|
||||
|
||||
CloseHandle( hModuleSnap );
|
||||
return( TRUE );
|
||||
CloseHandle(hModuleSnap);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL ListProcessThreads( DWORD dwOwnerPID )
|
||||
@@ -274,7 +272,7 @@ BOOL ListProcessThreads( DWORD dwOwnerPID )
|
||||
|
||||
// Take a snapshot of all running threads
|
||||
hThreadSnap = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 );
|
||||
if( hThreadSnap == INVALID_HANDLE_VALUE )
|
||||
if (hThreadSnap == INVALID_HANDLE_VALUE)
|
||||
return( FALSE );
|
||||
|
||||
// Fill in the size of the structure before using it.
|
||||
@@ -282,7 +280,7 @@ BOOL ListProcessThreads( DWORD dwOwnerPID )
|
||||
|
||||
// Retrieve information about the first thread,
|
||||
// and exit if unsuccessful
|
||||
if( !Thread32First( hThreadSnap, &te32 ) )
|
||||
if (!Thread32First( hThreadSnap, &te32 ))
|
||||
{
|
||||
printError( TEXT("Thread32First") ); // show cause of failure
|
||||
CloseHandle( hThreadSnap ); // clean the snapshot object
|
||||
@@ -294,13 +292,13 @@ BOOL ListProcessThreads( DWORD dwOwnerPID )
|
||||
// associated with the specified process
|
||||
do
|
||||
{
|
||||
if( te32.th32OwnerProcessID == dwOwnerPID )
|
||||
if (te32.th32OwnerProcessID == dwOwnerPID)
|
||||
{
|
||||
printf( "\n\n THREAD ID = 0x%08X", te32.th32ThreadID );
|
||||
printf( "\n Base priority = %d", te32.tpBasePri );
|
||||
printf( "\n Delta priority = %d", te32.tpDeltaPri );
|
||||
}
|
||||
} while( Thread32Next(hThreadSnap, &te32 ) );
|
||||
} while (Thread32Next(hThreadSnap, &te32));
|
||||
|
||||
CloseHandle( hThreadSnap );
|
||||
return( TRUE );
|
||||
@@ -308,22 +306,24 @@ BOOL ListProcessThreads( DWORD dwOwnerPID )
|
||||
|
||||
void printError( TCHAR* msg )
|
||||
{
|
||||
DWORD eNum;
|
||||
TCHAR sysMsg[256];
|
||||
TCHAR* p;
|
||||
DWORD eNum;
|
||||
TCHAR sysMsg[256];
|
||||
TCHAR* p;
|
||||
|
||||
eNum = GetLastError( );
|
||||
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
eNum = GetLastError( );
|
||||
FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
NULL, eNum,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
|
||||
sysMsg, 256, NULL );
|
||||
|
||||
// Trim the end of the line and terminate it with a null
|
||||
p = sysMsg;
|
||||
while( ( *p > 31 ) || ( *p == 9 ) )
|
||||
++p;
|
||||
do { *p-- = 0; } while( ( p >= sysMsg ) &&
|
||||
( ( *p == '.' ) || ( *p < 33 ) ) );
|
||||
// Trim the end of the line and terminate it with a null
|
||||
p = sysMsg;
|
||||
while (*p > 31 || *p == 9 )
|
||||
++p;
|
||||
|
||||
do {
|
||||
*p-- = 0;
|
||||
} while( p >= sysMsg && (*p == '.' || *p < 33));
|
||||
|
||||
// Display the message
|
||||
_tprintf( TEXT("\n WARNING: %s failed with error %d (%s)"), msg, eNum, sysMsg );
|
||||
@@ -331,7 +331,6 @@ void printError( TCHAR* msg )
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void AttachExternalDialog::procSelected(const QModelIndex &index0)
|
||||
{
|
||||
QModelIndex index = index0.sibling(index0.row(), 0);
|
||||
|
||||
@@ -150,10 +150,10 @@ void AttachRemoteDialog::rebuildProcessList()
|
||||
#include <stdio.h>
|
||||
|
||||
// Forward declarations:
|
||||
BOOL GetProcessList( );
|
||||
BOOL ListProcessModules( DWORD dwPID );
|
||||
BOOL ListProcessThreads( DWORD dwOwnerPID );
|
||||
void printError( TCHAR* msg );
|
||||
BOOL GetProcessList();
|
||||
BOOL ListProcessModules(DWORD dwPID);
|
||||
BOOL ListProcessThreads(DWORD dwOwnerPID);
|
||||
void printError(TCHAR* msg);
|
||||
|
||||
BOOL GetProcessList( )
|
||||
{
|
||||
@@ -164,7 +164,7 @@ BOOL GetProcessList( )
|
||||
|
||||
// Take a snapshot of all processes in the system.
|
||||
hProcessSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
|
||||
if( hProcessSnap == INVALID_HANDLE_VALUE )
|
||||
if (hProcessSnap == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printError( TEXT("CreateToolhelp32Snapshot (of processes)") );
|
||||
return( FALSE );
|
||||
@@ -175,7 +175,7 @@ BOOL GetProcessList( )
|
||||
|
||||
// Retrieve information about the first process,
|
||||
// and exit if unsuccessful
|
||||
if( !Process32First( hProcessSnap, &pe32 ) )
|
||||
if (!Process32First( hProcessSnap, &pe32 ))
|
||||
{
|
||||
printError( TEXT("Process32First") ); // show cause of failure
|
||||
CloseHandle( hProcessSnap ); // clean the snapshot object
|
||||
@@ -193,12 +193,12 @@ BOOL GetProcessList( )
|
||||
// Retrieve the priority class.
|
||||
dwPriorityClass = 0;
|
||||
hProcess = OpenProcess( PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID );
|
||||
if( hProcess == NULL )
|
||||
if (hProcess == NULL)
|
||||
printError( TEXT("OpenProcess") );
|
||||
else
|
||||
{
|
||||
dwPriorityClass = GetPriorityClass( hProcess );
|
||||
if( !dwPriorityClass )
|
||||
if (!dwPriorityClass)
|
||||
printError( TEXT("GetPriorityClass") );
|
||||
CloseHandle( hProcess );
|
||||
}
|
||||
@@ -207,7 +207,7 @@ BOOL GetProcessList( )
|
||||
printf( "\n Thread count = %d", pe32.cntThreads );
|
||||
printf( "\n Parent process ID = 0x%08X", pe32.th32ParentProcessID );
|
||||
printf( "\n Priority base = %d", pe32.pcPriClassBase );
|
||||
if( dwPriorityClass )
|
||||
if (dwPriorityClass)
|
||||
printf( "\n Priority class = %d", dwPriorityClass );
|
||||
|
||||
// List the modules and threads associated with this process
|
||||
@@ -228,7 +228,7 @@ BOOL ListProcessModules( DWORD dwPID )
|
||||
|
||||
// Take a snapshot of all modules in the specified process.
|
||||
hModuleSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPID );
|
||||
if( hModuleSnap == INVALID_HANDLE_VALUE )
|
||||
if (hModuleSnap == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
printError( TEXT("CreateToolhelp32Snapshot (of modules)") );
|
||||
return( FALSE );
|
||||
@@ -239,7 +239,7 @@ BOOL ListProcessModules( DWORD dwPID )
|
||||
|
||||
// Retrieve information about the first module,
|
||||
// and exit if unsuccessful
|
||||
if( !Module32First( hModuleSnap, &me32 ) )
|
||||
if (!Module32First( hModuleSnap, &me32 ))
|
||||
{
|
||||
printError( TEXT("Module32First") ); // show cause of failure
|
||||
CloseHandle( hModuleSnap ); // clean the snapshot object
|
||||
@@ -271,7 +271,7 @@ BOOL ListProcessThreads( DWORD dwOwnerPID )
|
||||
|
||||
// Take a snapshot of all running threads
|
||||
hThreadSnap = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 );
|
||||
if( hThreadSnap == INVALID_HANDLE_VALUE )
|
||||
if (hThreadSnap == INVALID_HANDLE_VALUE)
|
||||
return( FALSE );
|
||||
|
||||
// Fill in the size of the structure before using it.
|
||||
@@ -279,7 +279,7 @@ BOOL ListProcessThreads( DWORD dwOwnerPID )
|
||||
|
||||
// Retrieve information about the first thread,
|
||||
// and exit if unsuccessful
|
||||
if( !Thread32First( hThreadSnap, &te32 ) )
|
||||
if (!Thread32First( hThreadSnap, &te32 ))
|
||||
{
|
||||
printError( TEXT("Thread32First") ); // show cause of failure
|
||||
CloseHandle( hThreadSnap ); // clean the snapshot object
|
||||
@@ -291,7 +291,7 @@ BOOL ListProcessThreads( DWORD dwOwnerPID )
|
||||
// associated with the specified process
|
||||
do
|
||||
{
|
||||
if( te32.th32OwnerProcessID == dwOwnerPID )
|
||||
if (te32.th32OwnerProcessID == dwOwnerPID)
|
||||
{
|
||||
printf( "\n\n THREAD ID = 0x%08X", te32.th32ThreadID );
|
||||
printf( "\n Base priority = %d", te32.tpBasePri );
|
||||
|
||||
@@ -33,9 +33,10 @@
|
||||
|
||||
#include "breakhandler.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include "imports.h" // TextEditor::BaseTextMark
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QFileInfo>
|
||||
|
||||
@@ -371,7 +372,7 @@ QVariant BreakHandler::data(const QModelIndex &mi, int role) const
|
||||
static const QIcon icon2(":/gdbdebugger/images/breakpoint_pending.svg");
|
||||
static const QString empty = QString(QLatin1Char('-'));
|
||||
|
||||
QWB_ASSERT(mi.isValid(), return QVariant());
|
||||
QTC_ASSERT(mi.isValid(), return QVariant());
|
||||
|
||||
if (mi.row() >= size())
|
||||
return QVariant();
|
||||
@@ -550,7 +551,7 @@ void BreakHandler::breakByFunction(const QString &functionName)
|
||||
// One per function is enough for now
|
||||
for (int index = size(); --index >= 0;) {
|
||||
const BreakpointData *data = at(index);
|
||||
QWB_ASSERT(data, break);
|
||||
QTC_ASSERT(data, break);
|
||||
if (data->funcName == functionName && data->condition.isEmpty()
|
||||
&& data->ignoreCount.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -13,8 +13,7 @@ include(../../libs/cplusplus/cplusplus.pri)
|
||||
# DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
|
||||
QT += gui network script
|
||||
|
||||
HEADERS += assert.h \
|
||||
attachexternaldialog.h \
|
||||
HEADERS += attachexternaldialog.h \
|
||||
attachremotedialog.h \
|
||||
breakhandler.h \
|
||||
breakwindow.h \
|
||||
|
||||
@@ -352,6 +352,15 @@ void DebuggerManager::init()
|
||||
m_useFastStartAction->setCheckable(true);
|
||||
m_useFastStartAction->setChecked(true);
|
||||
|
||||
m_useToolTipsAction = new QAction(this);
|
||||
m_useToolTipsAction->setText(tr("Use Tooltips While Debugging"));
|
||||
m_useToolTipsAction->setToolTip(tr("Checking this will make enable "
|
||||
"tooltips for variable values during debugging. Since this can slow "
|
||||
"down debugging and does not provide reliable information as it does "
|
||||
"not use scope information, it is switched off by default."));
|
||||
m_useToolTipsAction->setCheckable(true);
|
||||
m_useToolTipsAction->setChecked(false);
|
||||
|
||||
// FIXME
|
||||
m_useFastStartAction->setChecked(false);
|
||||
m_useFastStartAction->setEnabled(false);
|
||||
@@ -943,6 +952,8 @@ void DebuggerManager::loadSessionData()
|
||||
QVariant value;
|
||||
querySessionValue(QLatin1String("UseFastStart"), &value);
|
||||
m_useFastStartAction->setChecked(value.toBool());
|
||||
querySessionValue(QLatin1String("UseToolTips"), &value);
|
||||
m_useToolTipsAction->setChecked(value.toBool());
|
||||
querySessionValue(QLatin1String("UseCustomDumpers"), &value);
|
||||
m_useCustomDumpersAction->setChecked(!value.isValid() || value.toBool());
|
||||
querySessionValue(QLatin1String("SkipKnownFrames"), &value);
|
||||
@@ -956,6 +967,8 @@ void DebuggerManager::saveSessionData()
|
||||
|
||||
setSessionValue(QLatin1String("UseFastStart"),
|
||||
m_useFastStartAction->isChecked());
|
||||
setSessionValue(QLatin1String("UseToolTips"),
|
||||
m_useToolTipsAction->isChecked());
|
||||
setSessionValue(QLatin1String("UseCustomDumpers"),
|
||||
m_useCustomDumpersAction->isChecked());
|
||||
setSessionValue(QLatin1String("SkipKnownFrames"),
|
||||
|
||||
@@ -308,6 +308,7 @@ private:
|
||||
ThreadsHandler *threadsHandler() { return m_threadsHandler; }
|
||||
WatchHandler *watchHandler() { return m_watchHandler; }
|
||||
QAction *useCustomDumpersAction() const { return m_useCustomDumpersAction; }
|
||||
QAction *useToolTipsAction() const { return m_useToolTipsAction; }
|
||||
QAction *debugDumpersAction() const { return m_debugDumpersAction; }
|
||||
bool skipKnownFrames() const;
|
||||
bool debugDumpers() const;
|
||||
@@ -431,6 +432,7 @@ private:
|
||||
QAction *m_debugDumpersAction;
|
||||
QAction *m_useCustomDumpersAction;
|
||||
QAction *m_useFastStartAction;
|
||||
QAction *m_useToolTipsAction;
|
||||
QAction *m_dumpLogAction;
|
||||
|
||||
QWidget *m_breakWindow;
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
#include "debuggerplugin.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include "debuggerconstants.h"
|
||||
#include "debuggermanager.h"
|
||||
#include "debuggerrunner.h"
|
||||
@@ -48,20 +47,27 @@
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
|
||||
#include <cplusplus/ExpressionUnderCursor.h>
|
||||
|
||||
#include <cppeditor/cppeditorconstants.h>
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/session.h>
|
||||
|
||||
#include <texteditor/basetexteditor.h>
|
||||
#include <texteditor/basetextmark.h>
|
||||
#include <texteditor/itexteditor.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
#include <texteditor/basetexteditor.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QPoint>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <QtGui/QPlainTextEdit>
|
||||
#include <QtGui/QTextBlock>
|
||||
#include <QtGui/QTextCursor>
|
||||
@@ -91,6 +97,7 @@ const char * const DEBUG_DUMPERS = "Debugger.DebugDumpers";
|
||||
const char * const ADD_TO_WATCH = "Debugger.AddToWatch";
|
||||
const char * const USE_CUSTOM_DUMPERS = "Debugger.UseCustomDumpers";
|
||||
const char * const USE_FAST_START = "Debugger.UseFastStart";
|
||||
const char * const USE_TOOL_TIPS = "Debugger.UseToolTips";
|
||||
const char * const SKIP_KNOWN_FRAMES = "Debugger.SkipKnownFrames";
|
||||
const char * const DUMP_LOG = "Debugger.DumpLog";
|
||||
|
||||
@@ -188,7 +195,7 @@ void DebuggerPlugin::shutdown()
|
||||
{
|
||||
if (m_debugMode)
|
||||
m_debugMode->shutdown(); // saves state including manager information
|
||||
QWB_ASSERT(m_manager, /**/);
|
||||
QTC_ASSERT(m_manager, /**/);
|
||||
if (m_manager)
|
||||
m_manager->shutdown();
|
||||
|
||||
@@ -225,13 +232,13 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
||||
m_pm = ExtensionSystem::PluginManager::instance();
|
||||
|
||||
ICore *core = m_pm->getObject<Core::ICore>();
|
||||
QWB_ASSERT(core, return false);
|
||||
QTC_ASSERT(core, return false);
|
||||
|
||||
Core::ActionManagerInterface *actionManager = core->actionManager();
|
||||
QWB_ASSERT(actionManager, return false);
|
||||
QTC_ASSERT(actionManager, return false);
|
||||
|
||||
Core::UniqueIDManager *uidm = core->uniqueIDManager();
|
||||
QWB_ASSERT(uidm, return false);
|
||||
QTC_ASSERT(uidm, return false);
|
||||
|
||||
QList<int> globalcontext;
|
||||
globalcontext << Core::Constants::C_GLOBAL_ID;
|
||||
@@ -374,13 +381,17 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
||||
Constants::USE_FAST_START, globalcontext);
|
||||
mdebug->addAction(cmd);
|
||||
|
||||
cmd = actionManager->registerAction(m_manager->m_useToolTipsAction,
|
||||
Constants::USE_TOOL_TIPS, globalcontext);
|
||||
mdebug->addAction(cmd);
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
cmd = actionManager->registerAction(m_manager->m_dumpLogAction,
|
||||
Constants::DUMP_LOG, globalcontext);
|
||||
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+L")));
|
||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+F11")));
|
||||
mdebug->addAction(cmd);
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
cmd = actionManager->registerAction(m_manager->m_debugDumpersAction,
|
||||
Constants::DEBUG_DUMPERS, debuggercontext);
|
||||
mdebug->addAction(cmd);
|
||||
@@ -549,6 +560,9 @@ void DebuggerPlugin::requestMark(TextEditor::ITextEditor *editor, int lineNumber
|
||||
void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor,
|
||||
const QPoint &point, int pos)
|
||||
{
|
||||
if (!m_manager->useToolTipsAction()->isChecked())
|
||||
return;
|
||||
|
||||
QPlainTextEdit *plaintext = qobject_cast<QPlainTextEdit*>(editor->widget());
|
||||
if (!plaintext)
|
||||
return;
|
||||
@@ -590,13 +604,13 @@ void DebuggerPlugin::querySessionValue(const QString &name, QVariant *value)
|
||||
|
||||
void DebuggerPlugin::setConfigValue(const QString &name, const QVariant &value)
|
||||
{
|
||||
QWB_ASSERT(m_debugMode, return);
|
||||
QTC_ASSERT(m_debugMode, return);
|
||||
m_debugMode->settings()->setValue(name, value);
|
||||
}
|
||||
|
||||
void DebuggerPlugin::queryConfigValue(const QString &name, QVariant *value)
|
||||
{
|
||||
QWB_ASSERT(m_debugMode, return);
|
||||
QTC_ASSERT(m_debugMode, return);
|
||||
*value = m_debugMode->settings()->value(name);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
#include "debuggerrunner.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include "debuggermanager.h"
|
||||
|
||||
#include <projectexplorer/applicationrunconfiguration.h>
|
||||
@@ -41,9 +40,12 @@
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
|
||||
#include <QtGui/QTextDocument>
|
||||
|
||||
using namespace Debugger::Internal;
|
||||
@@ -76,11 +78,10 @@ QString DebuggerRunner::displayName() const
|
||||
|
||||
RunControl* DebuggerRunner::run(RunConfigurationPtr runConfiguration, const QString &mode)
|
||||
{
|
||||
Q_UNUSED(mode);
|
||||
Q_ASSERT(mode == ProjectExplorer::Constants::DEBUGMODE);
|
||||
QTC_ASSERT(mode == ProjectExplorer::Constants::DEBUGMODE, return 0);
|
||||
ApplicationRunConfigurationPtr rc =
|
||||
qSharedPointerCast<ApplicationRunConfiguration>(runConfiguration);
|
||||
Q_ASSERT(rc);
|
||||
QTC_ASSERT(rc, return 0);
|
||||
//qDebug() << "***** Debugging" << rc->name() << rc->executable();
|
||||
return new DebuggerRunControl(m_manager, rc);
|
||||
}
|
||||
@@ -118,9 +119,9 @@ void DebuggerRunControl::start()
|
||||
m_running = true;
|
||||
ApplicationRunConfigurationPtr rc =
|
||||
qSharedPointerCast<ApplicationRunConfiguration>(runConfiguration());
|
||||
QWB_ASSERT(rc, return);
|
||||
QTC_ASSERT(rc, return);
|
||||
ProjectExplorer::Project *project = rc->project();
|
||||
QWB_ASSERT(project, return);
|
||||
QTC_ASSERT(project, return);
|
||||
|
||||
m_manager->m_executable = rc->executable();
|
||||
m_manager->m_environment = rc->environment().toStringList();
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
#include "gdbengine.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include "debuggerconstants.h"
|
||||
#include "debuggermanager.h"
|
||||
#include "gdbmi.h"
|
||||
@@ -49,6 +48,8 @@
|
||||
#include "startexternaldialog.h"
|
||||
#include "attachexternaldialog.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
@@ -278,25 +279,8 @@ void GdbEngine::init()
|
||||
connect(&m_gdbProc, SIGNAL(finished(int, QProcess::ExitStatus)), q,
|
||||
SLOT(exitDebugger()));
|
||||
|
||||
// Custom dumpers
|
||||
//m_dumperServerConnection = 0;
|
||||
//m_dumperServer = new DumperServer(this);
|
||||
//QString name = "gdb-" +
|
||||
// QDateTime::currentDateTime().toString("yyyy_MM_dd-hh_mm_ss_zzz");
|
||||
//m_dumperServer->listen(name);
|
||||
//connect(m_dumperServer, SIGNAL(newConnection()),
|
||||
// this, SLOT(acceptConnection()));
|
||||
|
||||
//if (!m_dumperServer->isListening()) {
|
||||
// QMessageBox::critical(q->mainWindow(), tr("Dumper Server Setup Failed"),
|
||||
// tr("Unable to create server listening for data: %1.\n"
|
||||
// "Server name: %2").arg(m_dumperServer->errorString(), name),
|
||||
// QMessageBox::Retry | QMessageBox::Cancel);
|
||||
// }
|
||||
|
||||
connect(qq->debugDumpersAction(), SIGNAL(toggled(bool)),
|
||||
this, SLOT(setDebugDumpers(bool)));
|
||||
|
||||
connect(qq->useCustomDumpersAction(), SIGNAL(toggled(bool)),
|
||||
this, SLOT(setCustomDumpersWanted(bool)));
|
||||
|
||||
@@ -442,8 +426,7 @@ void GdbEngine::handleResponse()
|
||||
break;
|
||||
}
|
||||
|
||||
if (token == -1 && *from != '&' && *from != '~' && *from != '*'
|
||||
&& *from != '=') {
|
||||
if (token == -1 && *from != '&' && *from != '~' && *from != '*') {
|
||||
// FIXME: On Linux the application's std::out is merged in here.
|
||||
// High risk of falsely interpreting this as MI output.
|
||||
// We assume that we _always_ use tokens, so not finding a token
|
||||
@@ -452,7 +435,7 @@ void GdbEngine::handleResponse()
|
||||
while (from != to && *from != '\n')
|
||||
s += *from++;
|
||||
//qDebug() << "UNREQUESTED DATA " << s << " TAKEN AS APPLICATION OUTPUT";
|
||||
s += '\n';
|
||||
//s += '\n';
|
||||
|
||||
m_inbuffer = QByteArray(from, to - from);
|
||||
emit applicationOutputAvailable("app-stdout: ", s);
|
||||
@@ -648,7 +631,7 @@ void GdbEngine::readGdbStandardOutput()
|
||||
#endif
|
||||
|
||||
m_inbuffer.append(out);
|
||||
//QWB_ASSERT(!m_inbuffer.isEmpty(), return);
|
||||
//QTC_ASSERT(!m_inbuffer.isEmpty(), return);
|
||||
|
||||
char c = m_inbuffer[m_inbuffer.size() - 1];
|
||||
static const QByteArray termArray("(gdb) ");
|
||||
@@ -1416,7 +1399,7 @@ void GdbEngine::handleFileExecAndSymbols
|
||||
QString msg = response.data.findChild("msg").data();
|
||||
QMessageBox::critical(q->mainWindow(), tr("Error"),
|
||||
tr("Starting executable failed:\n") + msg);
|
||||
QWB_ASSERT(q->status() == DebuggerInferiorRunning, /**/);
|
||||
QTC_ASSERT(q->status() == DebuggerInferiorRunning, /**/);
|
||||
interruptInferior();
|
||||
}
|
||||
}
|
||||
@@ -1437,7 +1420,7 @@ void GdbEngine::handleExecRun(const GdbResultRecord &response)
|
||||
} else {
|
||||
QMessageBox::critical(q->mainWindow(), tr("Error"),
|
||||
tr("Starting executable failed:\n") + msg);
|
||||
QWB_ASSERT(q->status() == DebuggerInferiorRunning, /**/);
|
||||
QTC_ASSERT(q->status() == DebuggerInferiorRunning, /**/);
|
||||
interruptInferior();
|
||||
}
|
||||
}
|
||||
@@ -2432,7 +2415,7 @@ void GdbEngine::selectThread(int index)
|
||||
threadsHandler->setCurrentThread(index);
|
||||
|
||||
QList<ThreadData> threads = threadsHandler->threads();
|
||||
QWB_ASSERT(index < threads.size(), return);
|
||||
QTC_ASSERT(index < threads.size(), return);
|
||||
int id = threads.at(index).id;
|
||||
q->showStatusMessage(tr("Retrieving data for stack view..."), 10000);
|
||||
sendCommand(QLatin1String("-thread-select ") + QString::number(id),
|
||||
@@ -2449,7 +2432,7 @@ void GdbEngine::activateFrame(int frameIndex)
|
||||
//qDebug() << "ACTIVATE FRAME: " << frameIndex << oldIndex
|
||||
// << stackHandler->currentIndex();
|
||||
|
||||
QWB_ASSERT(frameIndex < stackHandler->stackSize(), return);
|
||||
QTC_ASSERT(frameIndex < stackHandler->stackSize(), return);
|
||||
|
||||
if (oldIndex != frameIndex) {
|
||||
// Assuming this always succeeds saves a roundtrip.
|
||||
@@ -2970,7 +2953,7 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
|
||||
void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
|
||||
{
|
||||
WatchData data = data0;
|
||||
QWB_ASSERT(!data.exp.isEmpty(), return);
|
||||
QTC_ASSERT(!data.exp.isEmpty(), return);
|
||||
QString tmplate;
|
||||
QString inner;
|
||||
bool isTemplate = extractTemplate(data.type, &tmplate, &inner);
|
||||
@@ -3111,7 +3094,7 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
||||
#if DEBUG_SUBITEM
|
||||
qDebug() << "UPDATE SUBITEM: " << data.toString();
|
||||
#endif
|
||||
QWB_ASSERT(data.isValid(), return);
|
||||
QTC_ASSERT(data.isValid(), return);
|
||||
|
||||
// in any case we need the type first
|
||||
if (data.isTypeNeeded()) {
|
||||
@@ -3139,7 +3122,7 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
||||
}
|
||||
|
||||
// we should have a type now. this is relied upon further below
|
||||
QWB_ASSERT(!data.type.isEmpty(), return);
|
||||
QTC_ASSERT(!data.type.isEmpty(), return);
|
||||
|
||||
// a common case that can be easily solved
|
||||
if (data.isChildrenNeeded() && isPointerType(data.type)
|
||||
@@ -3197,7 +3180,7 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
||||
}
|
||||
|
||||
if (data.isValueNeeded()) {
|
||||
QWB_ASSERT(!data.variable.isEmpty(), return); // tested above
|
||||
QTC_ASSERT(!data.variable.isEmpty(), return); // tested above
|
||||
#if DEBUG_SUBITEM
|
||||
qDebug() << "UPDATE SUBITEM: VALUE";
|
||||
#endif
|
||||
@@ -3226,7 +3209,7 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
||||
}
|
||||
|
||||
if (data.isChildrenNeeded()) {
|
||||
QWB_ASSERT(!data.variable.isEmpty(), return); // tested above
|
||||
QTC_ASSERT(!data.variable.isEmpty(), return); // tested above
|
||||
QString cmd = "-var-list-children --all-values \"" + data.variable + "\"";
|
||||
sendSynchronizedCommand(cmd, WatchVarListChildren, QVariant::fromValue(data));
|
||||
return;
|
||||
@@ -3251,14 +3234,14 @@ void GdbEngine::updateSubItem(const WatchData &data0)
|
||||
}
|
||||
|
||||
if (data.isChildCountNeeded()) {
|
||||
QWB_ASSERT(!data.variable.isEmpty(), return); // tested above
|
||||
QTC_ASSERT(!data.variable.isEmpty(), return); // tested above
|
||||
QString cmd = "-var-list-children --all-values \"" + data.variable + "\"";
|
||||
sendCommand(cmd, WatchVarListChildren, QVariant::fromValue(data));
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "FIXME: UPDATE SUBITEM: " << data.toString();
|
||||
QWB_ASSERT(false, return);
|
||||
QTC_ASSERT(false, return);
|
||||
}
|
||||
|
||||
void GdbEngine::updateWatchModel()
|
||||
@@ -3272,7 +3255,7 @@ void GdbEngine::updateWatchModel2()
|
||||
{
|
||||
PENDING_DEBUG("UPDATE WATCH MODEL");
|
||||
QList<WatchData> incomplete = qq->watchHandler()->takeCurrentIncompletes();
|
||||
//QWB_ASSERT(incomplete.isEmpty(), /**/);
|
||||
//QTC_ASSERT(incomplete.isEmpty(), /**/);
|
||||
if (!incomplete.isEmpty()) {
|
||||
#if DEBUG_PENDING
|
||||
qDebug() << "##############################################";
|
||||
@@ -3437,7 +3420,7 @@ void GdbEngine::handleEvaluateExpression(const GdbResultRecord &record,
|
||||
const WatchData &data0)
|
||||
{
|
||||
WatchData data = data0;
|
||||
QWB_ASSERT(data.isValid(), qDebug() << "HUH?");
|
||||
QTC_ASSERT(data.isValid(), qDebug() << "HUH?");
|
||||
if (record.resultClass == GdbResultDone) {
|
||||
//if (col == 0)
|
||||
// data.name = record.data.findChild("value").data();
|
||||
@@ -3465,7 +3448,7 @@ void GdbEngine::handleDumpCustomValue1(const GdbResultRecord &record,
|
||||
const WatchData &data0)
|
||||
{
|
||||
WatchData data = data0;
|
||||
QWB_ASSERT(data.isValid(), return);
|
||||
QTC_ASSERT(data.isValid(), return);
|
||||
if (record.resultClass == GdbResultDone) {
|
||||
// ignore this case, data will follow
|
||||
} else if (record.resultClass == GdbResultError) {
|
||||
@@ -3499,7 +3482,7 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
|
||||
const WatchData &data0)
|
||||
{
|
||||
WatchData data = data0;
|
||||
QWB_ASSERT(data.isValid(), return);
|
||||
QTC_ASSERT(data.isValid(), return);
|
||||
//qDebug() << "CUSTOM VALUE RESULT: " << record.toString();
|
||||
//qDebug() << "FOR DATA: " << data.toString() << record.resultClass;
|
||||
if (record.resultClass == GdbResultDone) {
|
||||
@@ -3660,10 +3643,20 @@ void GdbEngine::setLocals(const QList<GdbMi> &locals)
|
||||
QHash<QString, int> seen;
|
||||
|
||||
foreach (const GdbMi &item, locals) {
|
||||
// Local variables of inlined code are reported as
|
||||
// 26^done,locals={varobj={exp="this",value="",name="var4",exp="this",
|
||||
// numchild="1",type="const QtSharedPointer::Basic<CPlusPlus::..."
|
||||
// We do not want these at all. Current hypotheses is that those
|
||||
// "spurious" locals have _two_ "exp" field. Try to filter them:
|
||||
#ifdef Q_OS_MAC
|
||||
QString name = item.findChild("exp").data();
|
||||
int numExps = 0;
|
||||
foreach (const GdbMi &child, item.children())
|
||||
numExps += int(child.name() == "exp");
|
||||
if (numExps > 1)
|
||||
continue;
|
||||
QString name = item.findChild("exp").data();
|
||||
#else
|
||||
QString name = item.findChild("name").data();
|
||||
QString name = item.findChild("name").data();
|
||||
#endif
|
||||
int n = seen.value(name);
|
||||
if (n) {
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
#ifndef DEBUGGER_GDBENGINE_H
|
||||
#define DEBUGGER_GDBENGINE_H
|
||||
|
||||
#include "idebuggerengine.h"
|
||||
#include "gdbmi.h"
|
||||
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QMap>
|
||||
@@ -48,9 +51,6 @@ class QAbstractItemModel;
|
||||
class QWidget;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "idebuggerengine.h"
|
||||
#include "gdbmi.h"
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
|
||||
@@ -32,10 +32,10 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "gdbmi.h"
|
||||
#include "assert.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QTextStream>
|
||||
|
||||
namespace Debugger {
|
||||
@@ -138,7 +138,7 @@ void GdbMi::parseValue(const Char *&from, const Char *to)
|
||||
void GdbMi::parseTuple(const Char *&from, const Char *to)
|
||||
{
|
||||
//qDebug() << "parseTuple: " << QByteArray::fromUtf16(from, to - from);
|
||||
QWB_ASSERT(*from == '{', /**/);
|
||||
QTC_ASSERT(*from == '{', /**/);
|
||||
++from;
|
||||
parseTuple_helper(from, to);
|
||||
}
|
||||
@@ -166,7 +166,7 @@ void GdbMi::parseTuple_helper(const Char *&from, const Char *to)
|
||||
void GdbMi::parseList(const Char *&from, const Char *to)
|
||||
{
|
||||
//qDebug() << "parseList: " << QByteArray::fromUtf16(from, to - from);
|
||||
QWB_ASSERT(*from == '[', /**/);
|
||||
QTC_ASSERT(*from == '[', /**/);
|
||||
++from;
|
||||
m_type = List;
|
||||
while (from < to) {
|
||||
|
||||
@@ -59,10 +59,10 @@ TypeMacroPage::TypeMacroPage(GdbSettings *settings)
|
||||
//insert qt4 defaults
|
||||
m_settings->m_scriptFile = coreIFace->resourcePath() +
|
||||
QLatin1String("/gdb/qt4macros");
|
||||
for (int i=0; i<3; ++i) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
QByteArray data;
|
||||
QDataStream stream(&data, QIODevice::WriteOnly);
|
||||
switch(i) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
stream << QString("printqstring") << (int)1;
|
||||
m_settings->m_typeMacros.insert(QLatin1String("QString"), data);
|
||||
@@ -154,7 +154,7 @@ void TypeMacroPage::finished(bool accepted)
|
||||
m_settings->m_typeMacros.clear();
|
||||
m_settings->m_scriptFile = m_ui.scriptEdit->text();
|
||||
|
||||
for (int i=0; i<m_ui.treeWidget->topLevelItemCount(); ++i) {
|
||||
for (int i = 0; i < m_ui.treeWidget->topLevelItemCount(); ++i) {
|
||||
QTreeWidgetItem *item = m_ui.treeWidget->topLevelItem(i);
|
||||
QByteArray data;
|
||||
QDataStream stream(&data, QIODevice::WriteOnly);
|
||||
|
||||
@@ -36,6 +36,11 @@
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QPoint;
|
||||
class QString;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
|
||||
#include "mode.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include "debuggerconstants.h"
|
||||
#include "debuggermanager.h"
|
||||
|
||||
@@ -48,10 +47,14 @@
|
||||
#include <coreplugin/outputpane.h>
|
||||
#include <coreplugin/navigationwidget.h>
|
||||
#include <coreplugin/rightpane.h>
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
#include <QtGui/QDockWidget>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QMainWindow>
|
||||
@@ -213,8 +216,8 @@ void DebugMode::focusCurrentEditor(IMode *mode)
|
||||
void DebugMode::writeSettings() const
|
||||
{
|
||||
QSettings *s = settings();
|
||||
QWB_ASSERT(m_manager, return);
|
||||
QWB_ASSERT(m_manager->mainWindow(), return);
|
||||
QTC_ASSERT(m_manager, return);
|
||||
QTC_ASSERT(m_manager->mainWindow(), return);
|
||||
s->beginGroup(QLatin1String("DebugMode"));
|
||||
s->setValue(QLatin1String("State"), m_manager->mainWindow()->saveState());
|
||||
s->setValue(QLatin1String("Locked"), m_toggleLockedAction->isChecked());
|
||||
|
||||
@@ -33,19 +33,18 @@
|
||||
|
||||
#include "scriptengine.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include "attachexternaldialog.h"
|
||||
#include "breakhandler.h"
|
||||
#include "debuggerconstants.h"
|
||||
#include "debuggermanager.h"
|
||||
|
||||
#include "disassemblerhandler.h"
|
||||
#include "breakhandler.h"
|
||||
#include "moduleshandler.h"
|
||||
#include "registerhandler.h"
|
||||
#include "stackhandler.h"
|
||||
#include "startexternaldialog.h"
|
||||
#include "watchhandler.h"
|
||||
|
||||
#include "startexternaldialog.h"
|
||||
#include "attachexternaldialog.h"
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QDebug>
|
||||
@@ -574,7 +573,7 @@ void ScriptEngine::updateSubItem(const WatchData &data0)
|
||||
{
|
||||
WatchData data = data0;
|
||||
//qDebug() << "\nUPDATE SUBITEM: " << data.toString();
|
||||
QWB_ASSERT(data.isValid(), return);
|
||||
QTC_ASSERT(data.isValid(), return);
|
||||
|
||||
if (data.isTypeNeeded() || data.isValueNeeded()) {
|
||||
QScriptValue ob = data.scriptValue;
|
||||
@@ -667,7 +666,7 @@ void ScriptEngine::updateSubItem(const WatchData &data0)
|
||||
return;
|
||||
}
|
||||
|
||||
QWB_ASSERT(false, return);
|
||||
QTC_ASSERT(false, return);
|
||||
}
|
||||
|
||||
IDebuggerEngine *createScriptEngine(DebuggerManager *parent)
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
#include "stackhandler.h"
|
||||
|
||||
#include "assert.h"
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QAbstractTableModel>
|
||||
#include <QtCore/QDebug>
|
||||
@@ -128,8 +128,8 @@ Qt::ItemFlags StackHandler::flags(const QModelIndex &index) const
|
||||
|
||||
StackFrame StackHandler::currentFrame() const
|
||||
{
|
||||
QWB_ASSERT(m_currentIndex >= 0, return StackFrame());
|
||||
QWB_ASSERT(m_currentIndex < m_stackFrames.size(), return StackFrame());
|
||||
QTC_ASSERT(m_currentIndex >= 0, return StackFrame());
|
||||
QTC_ASSERT(m_currentIndex < m_stackFrames.size(), return StackFrame());
|
||||
return m_stackFrames.at(m_currentIndex);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ QString StartExternalDialog::executableArguments() const
|
||||
result << QLatin1String("--args");
|
||||
result << execEdit->text();
|
||||
|
||||
for(int i=0; i<args.length(); ++i) {
|
||||
for (int i = 0; i < args.length(); ++i) {
|
||||
current = args.at(i);
|
||||
|
||||
if (current == QLatin1Char('\"') && last != QLatin1Char('\\')) {
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "modeltest.h"
|
||||
#endif
|
||||
|
||||
#include "assert.h"
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QEvent>
|
||||
@@ -118,7 +118,7 @@ static QByteArray quoteUnprintable(const QByteArray &ba)
|
||||
QByteArray res;
|
||||
char buf[10];
|
||||
for (int i = 0, n = ba.size(); i != n; ++i) {
|
||||
char c = ba.at(i);
|
||||
unsigned char c = ba.at(i);
|
||||
if (isprint(c)) {
|
||||
res += c;
|
||||
} else {
|
||||
@@ -426,7 +426,7 @@ QVariant WatchHandler::data(const QModelIndex &idx, int role) const
|
||||
int node = idx.internalId();
|
||||
if (node < 0)
|
||||
return QVariant();
|
||||
QWB_ASSERT(node < m_displaySet.size(), return QVariant());
|
||||
QTC_ASSERT(node < m_displaySet.size(), return QVariant());
|
||||
|
||||
const WatchData &data = m_displaySet.at(node);
|
||||
|
||||
@@ -702,10 +702,10 @@ void WatchHandler::rebuildModel()
|
||||
|
||||
// Possibly append dummy items to prevent empty views
|
||||
bool ok = true;
|
||||
QWB_ASSERT(m_displaySet.size() >= 2, ok = false);
|
||||
QWB_ASSERT(m_displaySet.at(1).iname == "local", ok = false);
|
||||
QWB_ASSERT(m_displaySet.at(2).iname == "tooltip", ok = false);
|
||||
QWB_ASSERT(m_displaySet.at(3).iname == "watch", ok = false);
|
||||
QTC_ASSERT(m_displaySet.size() >= 2, ok = false);
|
||||
QTC_ASSERT(m_displaySet.at(1).iname == "local", ok = false);
|
||||
QTC_ASSERT(m_displaySet.at(2).iname == "tooltip", ok = false);
|
||||
QTC_ASSERT(m_displaySet.at(3).iname == "watch", ok = false);
|
||||
if (ok) {
|
||||
for (int i = 1; i <= 3; ++i) {
|
||||
WatchData &data = m_displaySet[i];
|
||||
@@ -777,7 +777,7 @@ void WatchHandler::collapseChildren(const QModelIndex &idx)
|
||||
qDebug() << "WATCHHANDLER: COLLAPSE IGNORED" << idx;
|
||||
return;
|
||||
}
|
||||
QWB_ASSERT(checkIndex(idx.internalId()), return);
|
||||
QTC_ASSERT(checkIndex(idx.internalId()), return);
|
||||
#if 0
|
||||
QString iname0 = m_displaySet.at(idx.internalId()).iname;
|
||||
MODEL_DEBUG("COLLAPSE NODE" << iname0);
|
||||
@@ -806,11 +806,11 @@ void WatchHandler::expandChildren(const QModelIndex &idx)
|
||||
int index = idx.internalId();
|
||||
if (index == 0)
|
||||
return;
|
||||
QWB_ASSERT(index >= 0, qDebug() << toString() << index; return);
|
||||
QWB_ASSERT(index < m_completeSet.size(), qDebug() << toString() << index; return);
|
||||
QTC_ASSERT(index >= 0, qDebug() << toString() << index; return);
|
||||
QTC_ASSERT(index < m_completeSet.size(), qDebug() << toString() << index; return);
|
||||
const WatchData &display = m_displaySet.at(index);
|
||||
QWB_ASSERT(index >= 0, qDebug() << toString() << index; return);
|
||||
QWB_ASSERT(index < m_completeSet.size(), qDebug() << toString() << index; return);
|
||||
QTC_ASSERT(index >= 0, qDebug() << toString() << index; return);
|
||||
QTC_ASSERT(index < m_completeSet.size(), qDebug() << toString() << index; return);
|
||||
const WatchData &complete = m_completeSet.at(index);
|
||||
MODEL_DEBUG("\n\nEXPAND" << display.iname);
|
||||
if (display.iname.isEmpty()) {
|
||||
@@ -848,7 +848,7 @@ void WatchHandler::expandChildren(const QModelIndex &idx)
|
||||
void WatchHandler::insertData(const WatchData &data)
|
||||
{
|
||||
//MODEL_DEBUG("INSERTDATA: " << data.toString());
|
||||
QWB_ASSERT(data.isValid(), return);
|
||||
QTC_ASSERT(data.isValid(), return);
|
||||
if (data.isSomethingNeeded())
|
||||
insertDataHelper(m_incompleteSet, data);
|
||||
else
|
||||
@@ -977,7 +977,7 @@ bool WatchHandler::canFetchMore(const QModelIndex &parent) const
|
||||
// needs to be made synchronous to be useful. Busy loop is no good.
|
||||
if (!parent.isValid())
|
||||
return false;
|
||||
QWB_ASSERT(checkIndex(parent.internalId()), return false);
|
||||
QTC_ASSERT(checkIndex(parent.internalId()), return false);
|
||||
const WatchData &data = m_displaySet.at(parent.internalId());
|
||||
MODEL_DEBUG("CAN FETCH MORE: " << parent << " children: " << data.childCount
|
||||
<< data.iname);
|
||||
@@ -990,7 +990,7 @@ void WatchHandler::fetchMore(const QModelIndex &parent)
|
||||
MODEL_DEBUG("FETCH MORE: " << parent);
|
||||
return;
|
||||
|
||||
QWB_ASSERT(checkIndex(parent.internalId()), return);
|
||||
QTC_ASSERT(checkIndex(parent.internalId()), return);
|
||||
QString iname = m_displaySet.at(parent.internalId()).iname;
|
||||
|
||||
if (m_inFetchMore) {
|
||||
@@ -1049,15 +1049,15 @@ QModelIndex WatchHandler::index(int row, int col, const QModelIndex &parent) con
|
||||
MODEL_DEBUG(" -> " << QModelIndex() << " (2) ");
|
||||
return QModelIndex();
|
||||
}
|
||||
QWB_ASSERT(checkIndex(parentIndex), return QModelIndex());
|
||||
QTC_ASSERT(checkIndex(parentIndex), return QModelIndex());
|
||||
const WatchData &data = m_displaySet.at(parentIndex);
|
||||
QWB_ASSERT(row >= 0, qDebug() << "ROW: " << row << "PARENT: " << parent
|
||||
QTC_ASSERT(row >= 0, qDebug() << "ROW: " << row << "PARENT: " << parent
|
||||
<< data.toString() << toString(); return QModelIndex());
|
||||
QWB_ASSERT(row < data.childIndex.size(),
|
||||
QTC_ASSERT(row < data.childIndex.size(),
|
||||
MODEL_DEBUG("ROW: " << row << data.toString() << toString());
|
||||
return QModelIndex());
|
||||
QModelIndex idx = createIndex(row, col, data.childIndex.at(row));
|
||||
QWB_ASSERT(idx.row() == m_displaySet.at(idx.internalId()).row,
|
||||
QTC_ASSERT(idx.row() == m_displaySet.at(idx.internalId()).row,
|
||||
return QModelIndex());
|
||||
MODEL_DEBUG(" -> " << idx << " (A) ");
|
||||
return idx;
|
||||
@@ -1071,15 +1071,15 @@ QModelIndex WatchHandler::parent(const QModelIndex &idx) const
|
||||
}
|
||||
MODEL_DEBUG("PARENT " << idx);
|
||||
int currentIndex = idx.internalId();
|
||||
QWB_ASSERT(checkIndex(currentIndex), return QModelIndex());
|
||||
QWB_ASSERT(idx.row() == m_displaySet.at(currentIndex).row,
|
||||
QTC_ASSERT(checkIndex(currentIndex), return QModelIndex());
|
||||
QTC_ASSERT(idx.row() == m_displaySet.at(currentIndex).row,
|
||||
MODEL_DEBUG("IDX: " << idx << toString(); return QModelIndex()));
|
||||
int parentIndex = m_displaySet.at(currentIndex).parentIndex;
|
||||
if (parentIndex < 0) {
|
||||
MODEL_DEBUG(" -> " << QModelIndex() << " (2) ");
|
||||
return QModelIndex();
|
||||
}
|
||||
QWB_ASSERT(checkIndex(parentIndex), return QModelIndex());
|
||||
QTC_ASSERT(checkIndex(parentIndex), return QModelIndex());
|
||||
QModelIndex parent =
|
||||
createIndex(m_displaySet.at(parentIndex).row, 0, parentIndex);
|
||||
MODEL_DEBUG(" -> " << parent);
|
||||
@@ -1094,7 +1094,7 @@ int WatchHandler::rowCount(const QModelIndex &idx) const
|
||||
return 0;
|
||||
}
|
||||
int thisIndex = idx.internalId();
|
||||
QWB_ASSERT(checkIndex(thisIndex), return 0);
|
||||
QTC_ASSERT(checkIndex(thisIndex), return 0);
|
||||
if (idx.row() == -1 && idx.column() == -1) {
|
||||
MODEL_DEBUG(" -> " << 3 << " (B) ");
|
||||
return 1;
|
||||
@@ -1129,7 +1129,7 @@ int WatchHandler::columnCount(const QModelIndex &idx) const
|
||||
return 0;
|
||||
}
|
||||
MODEL_DEBUG(" -> " << 3 << " (B) ");
|
||||
QWB_ASSERT(checkIndex(idx.internalId()), return 3);
|
||||
QTC_ASSERT(checkIndex(idx.internalId()), return 3);
|
||||
return 3;
|
||||
}
|
||||
|
||||
@@ -1139,7 +1139,7 @@ bool WatchHandler::hasChildren(const QModelIndex &idx) const
|
||||
bool base = rowCount(idx) > 0 && columnCount(idx) > 0;
|
||||
MODEL_DEBUG("HAS CHILDREN: " << idx << base);
|
||||
return base;
|
||||
QWB_ASSERT(checkIndex(idx.internalId()), return false);
|
||||
QTC_ASSERT(checkIndex(idx.internalId()), return false);
|
||||
const WatchData &data = m_displaySet.at(idx.internalId());
|
||||
MODEL_DEBUG("HAS CHILDREN: " << idx << data.toString());
|
||||
return data.childCount > 0; // || data.childIndex.size() > 0;
|
||||
|
||||
@@ -156,7 +156,7 @@ bool FormClassWizardParameters::generateCpp(QString *header, QString *source, in
|
||||
if (languageChange) {
|
||||
sourceStr << '\n' << namespaceIndent << "void " << unqualifiedClassName << "::" << "changeEvent(QEvent *e)\n"
|
||||
<< namespaceIndent << "{\n"
|
||||
<< namespaceIndent << indent << "switch(e->type()) {\n" << namespaceIndent << indent << "case QEvent::LanguageChange:\n"
|
||||
<< namespaceIndent << indent << "switch (e->type()) {\n" << namespaceIndent << indent << "case QEvent::LanguageChange:\n"
|
||||
<< namespaceIndent << indent << indent;
|
||||
if (embedding != InheritedUiClass)
|
||||
sourceStr << uiMemberC << (embedding == PointerAggregatedUiClass ? "->" : ".");
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "formeditorw.h"
|
||||
|
||||
#include <coreplugin/minisplitter.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QEvent>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
@@ -54,7 +55,7 @@ SharedSubWindow::SharedSubWindow(QWidget *shared, QWidget *parent) :
|
||||
m_shared(shared),
|
||||
m_layout(new QVBoxLayout)
|
||||
{
|
||||
Q_ASSERT(m_shared);
|
||||
QTC_ASSERT(m_shared, /**/);
|
||||
m_layout->setContentsMargins(0, 0, 0, 0);
|
||||
setLayout(m_layout);
|
||||
}
|
||||
@@ -62,14 +63,14 @@ SharedSubWindow::SharedSubWindow(QWidget *shared, QWidget *parent) :
|
||||
void SharedSubWindow::activate()
|
||||
{
|
||||
// Take the widget off the other parent
|
||||
Q_ASSERT(m_shared);
|
||||
QTC_ASSERT(m_shared, return);
|
||||
QWidget *currentParent = m_shared->parentWidget();
|
||||
if (currentParent == this)
|
||||
return;
|
||||
|
||||
if (currentParent) {
|
||||
QVBoxLayout *lt = qobject_cast<QVBoxLayout *>(currentParent->layout());
|
||||
Q_ASSERT(lt);
|
||||
QTC_ASSERT(lt, return);
|
||||
m_shared->setParent(0);
|
||||
delete lt->takeAt(0);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtDesigner/QDesignerFormEditorPluginInterface>
|
||||
#include <QtDesigner/private/pluginmanager_p.h>
|
||||
@@ -169,9 +170,9 @@ FormEditorW::FormEditorW() :
|
||||
{
|
||||
if (debugFormEditor)
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
Q_ASSERT(!m_self);
|
||||
QTC_ASSERT(!m_self, return);
|
||||
m_self = this;
|
||||
Q_ASSERT(m_core);
|
||||
QTC_ASSERT(m_core, return);
|
||||
|
||||
qFill(m_designerSubWindows, m_designerSubWindows + Designer::Constants::DesignerSubWindowCount,
|
||||
static_cast<QWidget *>(0));
|
||||
@@ -180,7 +181,7 @@ FormEditorW::FormEditorW() :
|
||||
m_formeditor->setSettingsManager(new SettingsManager());
|
||||
|
||||
m_fwm = qobject_cast<qdesigner_internal::QDesignerFormWindowManager*>(m_formeditor->formWindowManager());
|
||||
Q_ASSERT(m_fwm);
|
||||
QTC_ASSERT(m_fwm, return);
|
||||
|
||||
const int uid = m_core->uniqueIDManager()->uniqueIdentifier(QLatin1String(C_FORMEDITOR));
|
||||
m_context << uid;
|
||||
@@ -216,7 +217,7 @@ FormEditorW::~FormEditorW()
|
||||
|
||||
void FormEditorW::fullInit()
|
||||
{
|
||||
Q_ASSERT(m_initStage == RegisterPlugins);
|
||||
QTC_ASSERT(m_initStage == RegisterPlugins, return);
|
||||
QTime *initTime = 0;
|
||||
if (debugFormEditor) {
|
||||
initTime = new QTime;
|
||||
@@ -410,7 +411,7 @@ void FormEditorW::setupActions()
|
||||
createSeparator(this, am, m_context, mformtools, QLatin1String("FormEditor.Menu.Tools.Separator2"));
|
||||
|
||||
m_actionPreview = m_fwm->actionDefaultPreview();
|
||||
Q_ASSERT(m_actionPreview);
|
||||
QTC_ASSERT(m_actionPreview, return);
|
||||
addToolAction(m_actionPreview, am, m_context,
|
||||
QLatin1String("FormEditor.Preview"), mformtools, tr("Ctrl+Alt+R"));
|
||||
|
||||
@@ -445,8 +446,8 @@ QToolBar *FormEditorW::createEditorToolBar() const
|
||||
Core::ActionManagerInterface *am = m_core->actionManager();
|
||||
const QStringList::const_iterator cend = m_toolActionIds.constEnd();
|
||||
for (QStringList::const_iterator it = m_toolActionIds.constBegin(); it != cend; ++it) {
|
||||
Core::ICommand *cmd = am->command(*it);
|
||||
Q_ASSERT(cmd);
|
||||
Core::ICommand *cmd = am->command(*it);
|
||||
QTC_ASSERT(cmd, continue);
|
||||
QAction *action = cmd->action();
|
||||
if (!action->icon().isNull()) // Simplify grid has no action yet
|
||||
rc->addAction(action);
|
||||
@@ -472,7 +473,7 @@ Core::IActionContainer *FormEditorW::createPreviewStyleMenu(Core::ActionManagerI
|
||||
const QString deviceProfilePrefix = QLatin1String("DeviceProfile");
|
||||
const QChar dot = QLatin1Char('.');
|
||||
|
||||
foreach(QAction* a, actions) {
|
||||
foreach (QAction* a, actions) {
|
||||
QString name = menuId;
|
||||
name += dot;
|
||||
const QVariant data = a->data();
|
||||
@@ -591,7 +592,7 @@ void FormEditorW::currentEditorChanged(Core::IEditor *editor)
|
||||
// Deactivate Designer if a non-form is being edited
|
||||
if (editor && !qstrcmp(editor->kind(), Constants::C_FORMWINDOW)) {
|
||||
FormWindowEditor *fw = qobject_cast<FormWindowEditor *>(editor);
|
||||
Q_ASSERT(fw);
|
||||
QTC_ASSERT(fw, return);
|
||||
fw->activate();
|
||||
m_fwm->setActiveFormWindow(fw->formWindow());
|
||||
} else {
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
|
||||
#include "basetextfind.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtGui/QTextBlock>
|
||||
|
||||
using namespace Find;
|
||||
@@ -49,26 +51,26 @@ BaseTextFind::BaseTextFind(QPlainTextEdit *editor)
|
||||
|
||||
QTextCursor BaseTextFind::textCursor() const
|
||||
{
|
||||
Q_ASSERT(m_editor || m_plaineditor);
|
||||
QTC_ASSERT(m_editor || m_plaineditor, return QTextCursor());
|
||||
return m_editor ? m_editor->textCursor() : m_plaineditor->textCursor();
|
||||
|
||||
}
|
||||
|
||||
void BaseTextFind::setTextCursor(const QTextCursor& cursor)
|
||||
{
|
||||
Q_ASSERT(m_editor || m_plaineditor);
|
||||
QTC_ASSERT(m_editor || m_plaineditor, return);
|
||||
m_editor ? m_editor->setTextCursor(cursor) : m_plaineditor->setTextCursor(cursor);
|
||||
}
|
||||
|
||||
QTextDocument *BaseTextFind::document() const
|
||||
{
|
||||
Q_ASSERT(m_editor || m_plaineditor);
|
||||
QTC_ASSERT(m_editor || m_plaineditor, return 0);
|
||||
return m_editor ? m_editor->document() : m_plaineditor->document();
|
||||
}
|
||||
|
||||
bool BaseTextFind::isReadOnly() const
|
||||
{
|
||||
Q_ASSERT(m_editor || m_plaineditor);
|
||||
QTC_ASSERT(m_editor || m_plaineditor, return true);
|
||||
return m_editor ? m_editor->isReadOnly() : m_plaineditor->isReadOnly();
|
||||
}
|
||||
|
||||
@@ -101,7 +103,7 @@ QString BaseTextFind::currentFindString() const
|
||||
cursor.movePosition(QTextCursor::StartOfWord);
|
||||
cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
|
||||
QString s = cursor.selectedText();
|
||||
foreach(QChar c, s) {
|
||||
foreach (QChar c, s) {
|
||||
if (!c.isLetterOrNumber() && c != QLatin1Char('_')) {
|
||||
s.clear();
|
||||
break;
|
||||
|
||||
@@ -36,16 +36,17 @@
|
||||
#include <aggregation/aggregate.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtDebug>
|
||||
|
||||
using namespace Core;
|
||||
using namespace Find;
|
||||
using namespace Find::Internal;
|
||||
|
||||
CurrentDocumentFind::CurrentDocumentFind(ICore *core)
|
||||
: m_core(core), m_currentFind(0)
|
||||
: m_core(core), m_currentFind(0)
|
||||
{
|
||||
connect(qApp, SIGNAL(focusChanged(QWidget*, QWidget*)),
|
||||
this, SLOT(updateCurrentFindFilter(QWidget*,QWidget*)));
|
||||
@@ -59,16 +60,14 @@ void CurrentDocumentFind::removeConnections()
|
||||
|
||||
void CurrentDocumentFind::resetIncrementalSearch()
|
||||
{
|
||||
Q_ASSERT(m_currentFind);
|
||||
if (m_currentFind)
|
||||
m_currentFind->resetIncrementalSearch();
|
||||
QTC_ASSERT(m_currentFind, return);
|
||||
m_currentFind->resetIncrementalSearch();
|
||||
}
|
||||
|
||||
void CurrentDocumentFind::clearResults()
|
||||
{
|
||||
Q_ASSERT(m_currentFind);
|
||||
if (m_currentFind)
|
||||
m_currentFind->clearResults();
|
||||
QTC_ASSERT(m_currentFind, return);
|
||||
m_currentFind->clearResults();
|
||||
}
|
||||
|
||||
bool CurrentDocumentFind::isEnabled() const
|
||||
@@ -78,67 +77,64 @@ bool CurrentDocumentFind::isEnabled() const
|
||||
|
||||
bool CurrentDocumentFind::supportsReplace() const
|
||||
{
|
||||
Q_ASSERT(m_currentFind);
|
||||
return m_currentFind ? m_currentFind->supportsReplace() : false;
|
||||
QTC_ASSERT(m_currentFind, return false);
|
||||
return m_currentFind->supportsReplace();
|
||||
}
|
||||
|
||||
QString CurrentDocumentFind::currentFindString() const
|
||||
{
|
||||
Q_ASSERT(m_currentFind);
|
||||
return m_currentFind ? m_currentFind->currentFindString() : QString();
|
||||
QTC_ASSERT(m_currentFind, return QString());
|
||||
return m_currentFind->currentFindString();
|
||||
}
|
||||
|
||||
QString CurrentDocumentFind::completedFindString() const
|
||||
{
|
||||
Q_ASSERT(m_currentFind);
|
||||
return m_currentFind ? m_currentFind->completedFindString() : QString();
|
||||
QTC_ASSERT(m_currentFind, return QString());
|
||||
return m_currentFind->completedFindString();
|
||||
}
|
||||
|
||||
void CurrentDocumentFind::highlightAll(const QString &txt, QTextDocument::FindFlags findFlags)
|
||||
{
|
||||
Q_ASSERT(m_currentFind);
|
||||
if (m_currentFind)
|
||||
m_currentFind->highlightAll(txt, findFlags);
|
||||
QTC_ASSERT(m_currentFind, return);
|
||||
m_currentFind->highlightAll(txt, findFlags);
|
||||
}
|
||||
|
||||
bool CurrentDocumentFind::findIncremental(const QString &txt, QTextDocument::FindFlags findFlags)
|
||||
{
|
||||
Q_ASSERT(m_currentFind);
|
||||
return (m_currentFind? m_currentFind->findIncremental(txt, findFlags) : false);
|
||||
QTC_ASSERT(m_currentFind, return false);
|
||||
return m_currentFind->findIncremental(txt, findFlags);
|
||||
}
|
||||
|
||||
bool CurrentDocumentFind::findStep(const QString &txt, QTextDocument::FindFlags findFlags)
|
||||
{
|
||||
Q_ASSERT(m_currentFind);
|
||||
return (m_currentFind? m_currentFind->findStep(txt, findFlags) : false);
|
||||
QTC_ASSERT(m_currentFind, return false);
|
||||
return m_currentFind->findStep(txt, findFlags);
|
||||
}
|
||||
|
||||
bool CurrentDocumentFind::replaceStep(const QString &before, const QString &after,
|
||||
QTextDocument::FindFlags findFlags)
|
||||
{
|
||||
Q_ASSERT(m_currentFind);
|
||||
return (m_currentFind? m_currentFind->replaceStep(before, after, findFlags) : false);
|
||||
QTC_ASSERT(m_currentFind, return false);
|
||||
return m_currentFind->replaceStep(before, after, findFlags);
|
||||
}
|
||||
|
||||
int CurrentDocumentFind::replaceAll(const QString &before, const QString &after,
|
||||
QTextDocument::FindFlags findFlags)
|
||||
{
|
||||
Q_ASSERT(m_currentFind);
|
||||
return (m_currentFind? m_currentFind->replaceAll(before, after, findFlags) : 0);
|
||||
QTC_ASSERT(m_currentFind, return 0);
|
||||
return m_currentFind->replaceAll(before, after, findFlags);
|
||||
}
|
||||
|
||||
void CurrentDocumentFind::defineFindScope()
|
||||
{
|
||||
Q_ASSERT(m_currentFind);
|
||||
if (m_currentFind)
|
||||
m_currentFind->defineFindScope();
|
||||
QTC_ASSERT(m_currentFind, return);
|
||||
m_currentFind->defineFindScope();
|
||||
}
|
||||
|
||||
void CurrentDocumentFind::clearFindScope()
|
||||
{
|
||||
Q_ASSERT(m_currentFind);
|
||||
if (m_currentFind)
|
||||
m_currentFind->clearFindScope();
|
||||
QTC_ASSERT(m_currentFind, return);
|
||||
m_currentFind->clearFindScope();
|
||||
}
|
||||
|
||||
void CurrentDocumentFind::updateCurrentFindFilter(QWidget *old, QWidget *now)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "findplugin.h"
|
||||
|
||||
#include "textfindconstants.h"
|
||||
@@ -42,6 +43,8 @@
|
||||
#include <coreplugin/actionmanager/icommand.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtCore/QSettings>
|
||||
|
||||
@@ -102,24 +105,18 @@ void FindPlugin::filterChanged()
|
||||
{
|
||||
IFindFilter *changedFilter = qobject_cast<IFindFilter *>(sender());
|
||||
QAction *action = m_filterActions.value(changedFilter);
|
||||
Q_ASSERT(changedFilter);
|
||||
Q_ASSERT(action);
|
||||
if (!changedFilter || !action)
|
||||
return;
|
||||
QTC_ASSERT(changedFilter, return);
|
||||
QTC_ASSERT(action, return);
|
||||
action->setEnabled(changedFilter->isEnabled());
|
||||
}
|
||||
|
||||
void FindPlugin::openFindFilter()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction*>(sender());
|
||||
Q_ASSERT(action);
|
||||
if (!action)
|
||||
return;
|
||||
QTC_ASSERT(action, return);
|
||||
IFindFilter *filter = action->data().value<IFindFilter *>();
|
||||
Q_ASSERT(filter);
|
||||
Q_ASSERT(filter->isEnabled());
|
||||
if (!filter || !filter->isEnabled())
|
||||
return;
|
||||
QTC_ASSERT(filter, return);
|
||||
QTC_ASSERT(filter->isEnabled(), return);
|
||||
QString currentFindString = (m_currentDocumentFind->isEnabled() ? m_currentDocumentFind->currentFindString() : "");
|
||||
if (!currentFindString.isEmpty())
|
||||
m_findDialog->setFindText(currentFindString);
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="findPreviousButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::LeftArrow</enum>
|
||||
</property>
|
||||
@@ -66,6 +69,9 @@
|
||||
<property name="font">
|
||||
<font/>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::RightArrow</enum>
|
||||
</property>
|
||||
@@ -103,6 +109,9 @@
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="replacePreviousButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::LeftArrow</enum>
|
||||
</property>
|
||||
@@ -113,6 +122,9 @@
|
||||
<property name="font">
|
||||
<font/>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::RightArrow</enum>
|
||||
</property>
|
||||
|
||||
@@ -43,6 +43,7 @@ ChangeSelectionDialog::ChangeSelectionDialog(QWidget *parent)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
connect(m_ui.repositoryButton, SIGNAL(clicked()), this, SLOT(selectWorkingDirectory()));
|
||||
setWindowTitle(tr("Select a Git commit"));
|
||||
}
|
||||
|
||||
void ChangeSelectionDialog::selectWorkingDirectory()
|
||||
@@ -59,7 +60,7 @@ void ChangeSelectionDialog::selectWorkingDirectory()
|
||||
// the head directory of the repository.
|
||||
QDir repository(location);
|
||||
do {
|
||||
if (repository.entryList(QDir::AllDirs).contains(QLatin1String(".git"))) {
|
||||
if (repository.entryList(QDir::AllDirs|QDir::Hidden).contains(QLatin1String(".git"))) {
|
||||
m_ui.repositoryEdit->setText(repository.absolutePath());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -32,36 +32,38 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "gitclient.h"
|
||||
#include "gitplugin.h"
|
||||
#include "gitconstants.h"
|
||||
|
||||
#include "commitdata.h"
|
||||
#include "gitconstants.h"
|
||||
#include "gitplugin.h"
|
||||
#include "gitsubmiteditor.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/progressmanager/progressmanagerinterface.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <texteditor/itexteditor.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
|
||||
#include <QtCore/QFuture>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QTemporaryFile>
|
||||
#include <QtCore/QFuture>
|
||||
#include <QtCore/QTime>
|
||||
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QMainWindow> // for msg box parent
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QPushButton>
|
||||
|
||||
using namespace Git;
|
||||
using namespace Git::Internal;
|
||||
|
||||
const char* const kGitCommand = "git";
|
||||
const char* const kGitDirectoryC = ".git";
|
||||
const char* const kBranchIndicatorC = "# On branch";
|
||||
const char *const kGitCommand = "git";
|
||||
const char *const kGitDirectoryC = ".git";
|
||||
const char *const kBranchIndicatorC = "# On branch";
|
||||
|
||||
enum { untrackedFilesInCommit = 0 };
|
||||
|
||||
@@ -169,14 +171,14 @@ VCSBase::VCSBaseEditor
|
||||
// Exists already
|
||||
outputEditor->createNew(m_msgWait);
|
||||
rc = VCSBase::VCSBaseEditor::getVcsBaseEditor(outputEditor);
|
||||
Q_ASSERT(rc);
|
||||
QTC_ASSERT(rc, return 0);
|
||||
m_core->editorManager()->setCurrentEditor(outputEditor);
|
||||
} else {
|
||||
// Create new, set wait message, set up with source and codec
|
||||
outputEditor = m_core->editorManager()->newFile(kind, &title, m_msgWait);
|
||||
outputEditor->setProperty(registerDynamicProperty, dynamicPropertyValue);
|
||||
rc = VCSBase::VCSBaseEditor::getVcsBaseEditor(outputEditor);
|
||||
Q_ASSERT(rc);
|
||||
QTC_ASSERT(rc, return 0);
|
||||
rc->setSource(source);
|
||||
if (setSourceCodec)
|
||||
rc->setCodec(VCSBase::VCSBaseEditor::getCodec(m_core, source));
|
||||
@@ -394,11 +396,10 @@ void GitClient::executeGit(const QString &workingDirectory, const QStringList &a
|
||||
|
||||
GitCommand* command = new GitCommand();
|
||||
if (outputToWindow) {
|
||||
Q_ASSERT(outputWindow);
|
||||
connect(command, SIGNAL(outputText(QString)), outputWindow, SLOT(append(QString)));
|
||||
connect(command, SIGNAL(outputData(QByteArray)), outputWindow, SLOT(appendData(QByteArray)));
|
||||
} else {
|
||||
Q_ASSERT(editor);
|
||||
QTC_ASSERT(editor, /**/);
|
||||
connect(command, SIGNAL(outputText(QString)), editor, SLOT(setPlainText(QString)));
|
||||
connect(command, SIGNAL(outputData(QByteArray)), editor, SLOT(setPlainTextData(QByteArray)));
|
||||
}
|
||||
@@ -515,7 +516,7 @@ static bool parseFiles(const QString &output, CommitData *d)
|
||||
State s = None;
|
||||
// Match added/changed-not-updated files: "#<tab>modified: foo.cpp"
|
||||
QRegExp filesPattern(QLatin1String("#\\t[^:]+:\\s+.+"));
|
||||
Q_ASSERT(filesPattern.isValid());
|
||||
QTC_ASSERT(filesPattern.isValid(), return false);
|
||||
|
||||
const QStringList::const_iterator cend = lines.constEnd();
|
||||
for (QStringList::const_iterator it = lines.constBegin(); it != cend; ++it) {
|
||||
@@ -533,7 +534,7 @@ static bool parseFiles(const QString &output, CommitData *d)
|
||||
// Now match untracked: "#<tab>foo.cpp"
|
||||
s = UntrackedFiles;
|
||||
filesPattern = QRegExp(QLatin1String("#\\t.+"));
|
||||
Q_ASSERT(filesPattern.isValid());
|
||||
QTC_ASSERT(filesPattern.isValid(), return false);
|
||||
} else {
|
||||
if (filesPattern.exactMatch(line)) {
|
||||
const QString fileSpec = line.mid(2).trimmed();
|
||||
|
||||
@@ -32,22 +32,25 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "giteditor.h"
|
||||
|
||||
#include "annotationhighlighter.h"
|
||||
#include "gitclient.h"
|
||||
#include "gitconstants.h"
|
||||
#include "gitplugin.h"
|
||||
#include "gitclient.h"
|
||||
|
||||
#include <vcsbase/diffhighlighter.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <vcsbase/diffhighlighter.h>
|
||||
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QTextEdit>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QTextStream>
|
||||
|
||||
#include <QtGui/QTextCursor>
|
||||
#include <QtGui/QTextEdit>
|
||||
|
||||
#define CHANGE_PATTERN_8C "[a-f0-9]{8,8}"
|
||||
#define CHANGE_PATTERN_40C "[a-f0-9]{40,40}"
|
||||
@@ -62,8 +65,8 @@ GitEditor::GitEditor(const VCSBase::VCSBaseEditorParameters *type,
|
||||
m_changeNumberPattern8(QLatin1String(CHANGE_PATTERN_8C)),
|
||||
m_changeNumberPattern40(QLatin1String(CHANGE_PATTERN_40C))
|
||||
{
|
||||
Q_ASSERT(m_changeNumberPattern8.isValid());
|
||||
Q_ASSERT(m_changeNumberPattern40.isValid());
|
||||
QTC_ASSERT(m_changeNumberPattern8.isValid(), return);
|
||||
QTC_ASSERT(m_changeNumberPattern40.isValid(), return);
|
||||
if (Git::Constants::debug)
|
||||
qDebug() << "GitEditor::GitEditor" << type->type << type->kind;
|
||||
}
|
||||
@@ -76,11 +79,11 @@ QSet<QString> GitEditor::annotationChanges() const
|
||||
return changes;
|
||||
// Hunt for first change number in annotation: "<change>:"
|
||||
QRegExp r(QLatin1String("^("CHANGE_PATTERN_8C") "));
|
||||
Q_ASSERT(r.isValid());
|
||||
QTC_ASSERT(r.isValid(), return changes);
|
||||
if (r.indexIn(txt) != -1) {
|
||||
changes.insert(r.cap(1));
|
||||
r.setPattern(QLatin1String("\n("CHANGE_PATTERN_8C") "));
|
||||
Q_ASSERT(r.isValid());
|
||||
QTC_ASSERT(r.isValid(), return changes);
|
||||
int pos = 0;
|
||||
while ((pos = r.indexIn(txt, pos)) != -1) {
|
||||
pos += r.matchedLength();
|
||||
|
||||
@@ -32,13 +32,14 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "gitplugin.h"
|
||||
#include "gitclient.h"
|
||||
#include "gitversioncontrol.h"
|
||||
#include "giteditor.h"
|
||||
#include "gitconstants.h"
|
||||
|
||||
#include "changeselectiondialog.h"
|
||||
#include "gitsubmiteditor.h"
|
||||
#include "commitdata.h"
|
||||
#include "gitclient.h"
|
||||
#include "gitconstants.h"
|
||||
#include "giteditor.h"
|
||||
#include "gitsubmiteditor.h"
|
||||
#include "gitversioncontrol.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
@@ -47,20 +48,24 @@
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <vcsbase/basevcseditorfactory.h>
|
||||
#include <vcsbase/vcsbaseeditor.h>
|
||||
#include <vcsbase/basevcssubmiteditorfactory.h>
|
||||
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QTemporaryFile>
|
||||
#include <QtCore/QDir>
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QFileDialog>
|
||||
|
||||
static const VCSBase::VCSBaseEditorParameters editorParameters[] = {
|
||||
{
|
||||
@@ -142,7 +147,6 @@ GitPlugin::GitPlugin() :
|
||||
m_versionControl(0),
|
||||
m_changeTmpFile(0)
|
||||
{
|
||||
Q_ASSERT(m_instance == 0);
|
||||
m_instance = this;
|
||||
}
|
||||
|
||||
@@ -161,7 +165,7 @@ GitPlugin::~GitPlugin()
|
||||
}
|
||||
|
||||
if (!m_editorFactories.empty()) {
|
||||
foreach(Core::IEditorFactory* pf, m_editorFactories)
|
||||
foreach (Core::IEditorFactory* pf, m_editorFactories)
|
||||
removeObject(pf);
|
||||
qDeleteAll(m_editorFactories);
|
||||
}
|
||||
@@ -212,10 +216,10 @@ static const VCSBase::VCSBaseSubmitEditorParameters submitParameters = {
|
||||
Git::Constants::DIFF_SELECTED
|
||||
};
|
||||
|
||||
static inline Core::ICommand *createSeparator(Core::ActionManagerInterface *am,
|
||||
const QList<int> &context,
|
||||
const QString &id,
|
||||
QObject *parent)
|
||||
static Core::ICommand *createSeparator(Core::ActionManagerInterface *am,
|
||||
const QList<int> &context,
|
||||
const QString &id,
|
||||
QObject *parent)
|
||||
{
|
||||
QAction *a = new QAction(parent);
|
||||
a->setSeparator(true);
|
||||
@@ -627,7 +631,7 @@ Core::IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const Commit
|
||||
qDebug() << Q_FUNC_INFO << fileName << editor;
|
||||
m_core->editorManager()->ensureEditorManagerVisible();
|
||||
GitSubmitEditor *submitEditor = qobject_cast<GitSubmitEditor*>(editor);
|
||||
Q_ASSERT(submitEditor);
|
||||
QTC_ASSERT(submitEditor, return 0);
|
||||
// The actions are for some reason enabled by the context switching
|
||||
// mechanism. Disable them correctly.
|
||||
m_submitCurrentAction->setEnabled(!cd.stagedFiles.empty());
|
||||
|
||||
@@ -126,7 +126,7 @@ void ContentsToolWindow::contentsDone()
|
||||
{
|
||||
m_widget->setCursor(QCursor(Qt::WaitCursor));
|
||||
QList<QPair<QString, ContentList> > contentList = helpEngine->contents();
|
||||
for(QList<QPair<QString, ContentList> >::Iterator it = contentList.begin(); it != contentList.end(); ++it) {
|
||||
for (QList<QPair<QString, ContentList> >::Iterator it = contentList.begin(); it != contentList.end(); ++it) {
|
||||
QTreeWidgetItem *newEntry;
|
||||
QTreeWidgetItem *contentEntry;
|
||||
QStack<QTreeWidgetItem*> stack;
|
||||
@@ -135,7 +135,7 @@ void ContentsToolWindow::contentsDone()
|
||||
bool root = false;
|
||||
|
||||
QTreeWidgetItem *lastItem[64];
|
||||
for(int j = 0; j < 64; ++j)
|
||||
for (int j = 0; j < 64; ++j)
|
||||
lastItem[j] = 0;
|
||||
|
||||
ContentList lst = (*it).second;
|
||||
@@ -149,19 +149,18 @@ void ContentsToolWindow::contentsDone()
|
||||
stack.push(newEntry);
|
||||
depth = 1;
|
||||
root = true;
|
||||
}
|
||||
else{
|
||||
if((item.depth > depth) && root) {
|
||||
} else {
|
||||
if (item.depth > depth && root) {
|
||||
depth = item.depth;
|
||||
stack.push(contentEntry);
|
||||
}
|
||||
if(item.depth == depth) {
|
||||
if (item.depth == depth) {
|
||||
contentEntry = new QTreeWidgetItem(stack.top(), lastItem[ depth ]);
|
||||
lastItem[ depth ] = contentEntry;
|
||||
contentEntry->setText(0, item.title);
|
||||
contentEntry->setData(0, LinkRole, item.reference);
|
||||
}
|
||||
else if(item.depth < depth) {
|
||||
else if (item.depth < depth) {
|
||||
stack.pop();
|
||||
depth--;
|
||||
item = *(--it);
|
||||
|
||||
@@ -296,7 +296,7 @@ quint32 HelpEngine::getFileAges()
|
||||
QStringList::const_iterator i = addDocuFiles.begin();
|
||||
|
||||
quint32 fileAges = 0;
|
||||
for(; i != addDocuFiles.end(); ++i) {
|
||||
for (; i != addDocuFiles.end(); ++i) {
|
||||
QFileInfo fi(*i);
|
||||
if (fi.exists())
|
||||
fileAges += fi.lastModified().toTime_t();
|
||||
@@ -364,7 +364,7 @@ void TitleMapThread::run()
|
||||
bool needRebuild = false;
|
||||
if (Config::configuration()->profileName() == QLatin1String("default")) {
|
||||
const QStringList docuFiles = Config::configuration()->docFiles();
|
||||
for(QStringList::ConstIterator it = docuFiles.begin(); it != docuFiles.end(); it++) {
|
||||
for (QStringList::ConstIterator it = docuFiles.begin(); it != docuFiles.end(); it++) {
|
||||
if (!QFile::exists(*it)) {
|
||||
Config::configuration()->saveProfile(Profile::createDefaultProfile());
|
||||
Config::configuration()->loadDefaultProfile();
|
||||
@@ -383,7 +383,7 @@ void TitleMapThread::run()
|
||||
getAllContents();
|
||||
|
||||
titleMap.clear();
|
||||
for(QList<QPair<QString, ContentList> >::Iterator it = contentList.begin(); it != contentList.end(); ++it) {
|
||||
for (QList<QPair<QString, ContentList> >::Iterator it = contentList.begin(); it != contentList.end(); ++it) {
|
||||
ContentList lst = (*it).second;
|
||||
foreach (ContentItem item, lst) {
|
||||
titleMap[item.reference] = item.title.trimmed();
|
||||
@@ -430,7 +430,7 @@ void TitleMapThread::buildContentDict()
|
||||
QStringList docuFiles = Config::configuration()->docFiles();
|
||||
|
||||
quint32 fileAges = 0;
|
||||
for(QStringList::iterator it = docuFiles.begin(); it != docuFiles.end(); it++) {
|
||||
for (QStringList::iterator it = docuFiles.begin(); it != docuFiles.end(); it++) {
|
||||
QFile file(*it);
|
||||
if (!file.exists()) {
|
||||
#ifdef _SHOW_ERRORS_
|
||||
@@ -441,7 +441,7 @@ void TitleMapThread::buildContentDict()
|
||||
}
|
||||
fileAges += QFileInfo(file).lastModified().toTime_t();
|
||||
DocuParser *handler = DocuParser::createParser(*it);
|
||||
if(!handler) {
|
||||
if (!handler) {
|
||||
#ifdef _SHOW_ERRORS_
|
||||
emit errorOccured(tr("Documentation file %1 is not compatible!\n"
|
||||
"Skipping file.").arg(QFileInfo(file).absoluteFilePath()));
|
||||
@@ -450,7 +450,7 @@ void TitleMapThread::buildContentDict()
|
||||
}
|
||||
bool ok = handler->parse(&file);
|
||||
file.close();
|
||||
if(ok) {
|
||||
if (ok) {
|
||||
contentList += qMakePair(*it, QList<ContentItem>(handler->getContentItems()));
|
||||
delete handler;
|
||||
} else {
|
||||
@@ -469,7 +469,7 @@ void TitleMapThread::buildContentDict()
|
||||
if (contentOut.open(QFile::WriteOnly)) {
|
||||
QDataStream s(&contentOut);
|
||||
s << fileAges;
|
||||
for(QList<QPair<QString, ContentList> >::Iterator it = contentList.begin(); it != contentList.end(); ++it) {
|
||||
for (QList<QPair<QString, ContentList> >::Iterator it = contentList.begin(); it != contentList.end(); ++it) {
|
||||
s << *it;
|
||||
}
|
||||
contentOut.close();
|
||||
@@ -542,12 +542,12 @@ void IndexThread::buildKeywordDB()
|
||||
QStringList::iterator i = addDocuFiles.begin();
|
||||
|
||||
int steps = 0;
|
||||
for(; i != addDocuFiles.end(); i++)
|
||||
for (; i != addDocuFiles.end(); i++)
|
||||
steps += QFileInfo(*i).size();
|
||||
|
||||
QList<IndexKeyword> lst;
|
||||
quint32 fileAges = 0;
|
||||
for(i = addDocuFiles.begin(); i != addDocuFiles.end(); i++){
|
||||
for (i = addDocuFiles.begin(); i != addDocuFiles.end(); i++) {
|
||||
QFile file(*i);
|
||||
if (!file.exists()) {
|
||||
#ifdef _SHOW_ERRORS_
|
||||
@@ -560,7 +560,7 @@ void IndexThread::buildKeywordDB()
|
||||
DocuParser *handler = DocuParser::createParser(*i);
|
||||
bool ok = handler->parse(&file);
|
||||
file.close();
|
||||
if(!ok){
|
||||
if (!ok){
|
||||
#ifdef _SHOW_ERRORS_
|
||||
QString msg = QString::fromLatin1("In file %1:\n%2")
|
||||
.arg(QFileInfo(file).absoluteFilePath())
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "helpfindsupport.h"
|
||||
#include "helpviewer.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace Help::Internal;
|
||||
|
||||
HelpFindSupport::HelpFindSupport(CentralWidget *centralWidget)
|
||||
@@ -52,8 +54,8 @@ bool HelpFindSupport::isEnabled() const
|
||||
|
||||
QString HelpFindSupport::currentFindString() const
|
||||
{
|
||||
Q_ASSERT(m_centralWidget);
|
||||
HelpViewer* viewer = m_centralWidget->currentHelpViewer();
|
||||
QTC_ASSERT(m_centralWidget, return QString());
|
||||
HelpViewer *viewer = m_centralWidget->currentHelpViewer();
|
||||
if (!viewer)
|
||||
return QString();
|
||||
#if !defined(QT_NO_WEBKIT)
|
||||
@@ -70,13 +72,13 @@ QString HelpFindSupport::completedFindString() const
|
||||
|
||||
bool HelpFindSupport::findIncremental(const QString &txt, QTextDocument::FindFlags findFlags)
|
||||
{
|
||||
Q_ASSERT(m_centralWidget);
|
||||
QTC_ASSERT(m_centralWidget, return false);
|
||||
findFlags &= ~QTextDocument::FindBackward;
|
||||
return m_centralWidget->find(txt, findFlags, true);
|
||||
}
|
||||
|
||||
bool HelpFindSupport::findStep(const QString &txt, QTextDocument::FindFlags findFlags)
|
||||
{
|
||||
Q_ASSERT(m_centralWidget);
|
||||
QTC_ASSERT(m_centralWidget, return false);
|
||||
return m_centralWidget->find(txt, findFlags, false);
|
||||
}
|
||||
|
||||
@@ -512,7 +512,7 @@ void HelpPlugin::activateContext()
|
||||
// case 1 sidebar shown and has focus, we show whatever we have in the
|
||||
// sidebar in big
|
||||
RightPanePlaceHolder* placeHolder = RightPanePlaceHolder::current();
|
||||
if(placeHolder && Core::RightPaneWidget::instance()->hasFocus()) {
|
||||
if (placeHolder && Core::RightPaneWidget::instance()->hasFocus()) {
|
||||
switchToHelpMode();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -32,26 +32,28 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "perforceeditor.h"
|
||||
|
||||
#include "annotationhighlighter.h"
|
||||
#include "perforceplugin.h"
|
||||
#include "perforceconstants.h"
|
||||
#include "perforceplugin.h"
|
||||
|
||||
#include <vcsbase/diffhighlighter.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <vcsbase/diffhighlighter.h>
|
||||
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QTextStream>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QProcess>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtCore/QTextStream>
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtGui/QLayout>
|
||||
#include <QtGui/QTextEdit>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QTextCursor>
|
||||
#include <QtCore/QProcess>
|
||||
#include <QtGui/QTextEdit>
|
||||
|
||||
namespace Perforce {
|
||||
namespace Internal {
|
||||
@@ -63,7 +65,7 @@ PerforceEditor::PerforceEditor(const VCSBase::VCSBaseEditorParameters *type,
|
||||
m_changeNumberPattern(QLatin1String("^\\d+$")),
|
||||
m_plugin(PerforcePlugin::perforcePluginInstance())
|
||||
{
|
||||
Q_ASSERT(m_changeNumberPattern.isValid());
|
||||
QTC_ASSERT(m_changeNumberPattern.isValid(), /**/);
|
||||
if (Perforce::Constants::debug)
|
||||
qDebug() << "PerforceEditor::PerforceEditor" << type->type << type->kind;
|
||||
}
|
||||
@@ -76,11 +78,11 @@ QSet<QString> PerforceEditor::annotationChanges() const
|
||||
return changes;
|
||||
// Hunt for first change number in annotation: "<change>:"
|
||||
QRegExp r(QLatin1String("^(\\d+):"));
|
||||
Q_ASSERT(r.isValid());
|
||||
QTC_ASSERT(r.isValid(), return changes);
|
||||
if (r.indexIn(txt) != -1) {
|
||||
changes.insert(r.cap(1));
|
||||
r.setPattern(QLatin1String("\n(\\d+):"));
|
||||
Q_ASSERT(r.isValid());
|
||||
QTC_ASSERT(r.isValid(), return changes);
|
||||
int pos = 0;
|
||||
while ((pos = r.indexIn(txt, pos)) != -1) {
|
||||
pos += r.matchedLength();
|
||||
|
||||
@@ -31,25 +31,27 @@
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#include "p4.h"
|
||||
#include "perforceplugin.h"
|
||||
#include "perforceoutputwindow.h"
|
||||
#include "settingspage.h"
|
||||
#include "perforcesubmiteditor.h"
|
||||
#include "changenumberdialog.h"
|
||||
#include "perforceconstants.h"
|
||||
#include "perforceversioncontrol.h"
|
||||
#include "perforceeditor.h"
|
||||
#include "pendingchangesdialog.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
#include <coreplugin/filemanager.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include "changenumberdialog.h"
|
||||
#include "p4.h"
|
||||
#include "pendingchangesdialog.h"
|
||||
#include "perforceconstants.h"
|
||||
#include "perforceeditor.h"
|
||||
#include "perforceoutputwindow.h"
|
||||
#include "perforcesubmiteditor.h"
|
||||
#include "perforceversioncontrol.h"
|
||||
#include "settingspage.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
#include <coreplugin/filemanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <coreplugin/mimedatabase.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/synchronousprocess.h>
|
||||
#include <vcsbase/basevcseditorfactory.h>
|
||||
#include <vcsbase/basevcssubmiteditorfactory.h>
|
||||
@@ -57,16 +59,17 @@
|
||||
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QTemporaryFile>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QTemporaryFile>
|
||||
#include <QtCore/QTextCodec>
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QMainWindow>
|
||||
#include <QtGui/QFileDialog>
|
||||
|
||||
using namespace Perforce::Internal;
|
||||
|
||||
@@ -420,7 +423,7 @@ void PerforcePlugin::deleteCurrentFile()
|
||||
|
||||
void PerforcePlugin::revertCurrentFile()
|
||||
{
|
||||
Q_ASSERT(m_coreInstance);
|
||||
QTC_ASSERT(m_coreInstance, return);
|
||||
|
||||
const QString fileName = currentFileName();
|
||||
QTextCodec *codec = VCSBase::VCSBaseEditor::getCodec(m_coreInstance, fileName);
|
||||
@@ -460,7 +463,7 @@ void PerforcePlugin::diffCurrentFile()
|
||||
|
||||
void PerforcePlugin::diffCurrentProject()
|
||||
{
|
||||
Q_ASSERT(m_projectExplorer);
|
||||
QTC_ASSERT(m_projectExplorer, return);
|
||||
QStringList files;
|
||||
QString name;
|
||||
ProjectExplorer::Project *currentProject = m_projectExplorer->currentProject();
|
||||
@@ -502,7 +505,8 @@ void PerforcePlugin::resolve()
|
||||
|
||||
void PerforcePlugin::submit()
|
||||
{
|
||||
Q_ASSERT(m_coreInstance);
|
||||
QTC_ASSERT(m_coreInstance, return);
|
||||
|
||||
if (!checkP4Command()) {
|
||||
showOutput(tr("No p4 executable specified!"));
|
||||
return;
|
||||
@@ -534,7 +538,7 @@ void PerforcePlugin::submit()
|
||||
m_changeTmpFile->seek(0);
|
||||
|
||||
// Assemble file list of project
|
||||
Q_ASSERT(m_projectExplorer);
|
||||
QTC_ASSERT(m_projectExplorer, return);
|
||||
QStringList files;
|
||||
QString name;
|
||||
ProjectExplorer::Project *currentProject = m_projectExplorer->currentProject();
|
||||
@@ -561,10 +565,9 @@ void PerforcePlugin::submit()
|
||||
|
||||
QStringList stdOutLines = result2.stdOut.split(QLatin1Char('\n'));
|
||||
QStringList depotFileNames;
|
||||
foreach(const QString &line, stdOutLines) {
|
||||
if (line.startsWith("... depotFile")) {
|
||||
foreach (const QString &line, stdOutLines) {
|
||||
if (line.startsWith("... depotFile"))
|
||||
depotFileNames.append(line.mid(14));
|
||||
}
|
||||
}
|
||||
if (depotFileNames.isEmpty()) {
|
||||
showOutput(tr("Project has no files"));
|
||||
@@ -582,7 +585,7 @@ Core::IEditor *PerforcePlugin::openPerforceSubmitEditor(const QString &fileName,
|
||||
m_coreInstance->editorManager()->openEditor(fileName, Constants::PERFORCESUBMITEDITOR_KIND);
|
||||
m_coreInstance->editorManager()->ensureEditorManagerVisible();
|
||||
PerforceSubmitEditor *submitEditor = dynamic_cast<PerforceSubmitEditor*>(editor);
|
||||
Q_ASSERT(submitEditor);
|
||||
QTC_ASSERT(submitEditor, return 0);
|
||||
submitEditor->restrictToProjectFiles(depotFileNames);
|
||||
connect(submitEditor, SIGNAL(diffSelectedFiles(QStringList)), this, SLOT(slotDiff(QStringList)));
|
||||
// The actions are for some reason enabled by the context switching
|
||||
@@ -736,7 +739,7 @@ QString PerforcePlugin::findTopLevelForDirectory(const QString & /* dir */) cons
|
||||
return QString::null;
|
||||
|
||||
QRegExp regExp(QLatin1String("(\\n|\\r\\n|\\r)Root:\\s*(.*)(\\n|\\r\\n|\\r)"));
|
||||
Q_ASSERT(regExp.isValid());
|
||||
QTC_ASSERT(regExp.isValid(), /**/);
|
||||
regExp.setMinimal(true);
|
||||
if (regExp.indexIn(result.stdOut) != -1) {
|
||||
QString file = regExp.cap(2).trimmed();
|
||||
@@ -785,7 +788,7 @@ PerforceResponse PerforcePlugin::runP4Cmd(const QStringList &args,
|
||||
qDebug() << "PerforcePlugin::runP4Cmd" << args << extraArgs << debugCodec(outputCodec);
|
||||
PerforceResponse response;
|
||||
response.error = true;
|
||||
Q_ASSERT(m_coreInstance);
|
||||
QTC_ASSERT(m_coreInstance, return response);
|
||||
if (!checkP4Command()) {
|
||||
response.message = tr("No p4 executable specified!");
|
||||
m_perforceOutputWindow->append(response.message, true);
|
||||
@@ -875,7 +878,7 @@ Core::IEditor * PerforcePlugin::showOutputInEditor(const QString& title, const Q
|
||||
int editorType, QTextCodec *codec)
|
||||
{
|
||||
const VCSBase::VCSBaseEditorParameters *params = findType(editorType);
|
||||
Q_ASSERT(params);
|
||||
QTC_ASSERT(params, return 0);
|
||||
const QString kind = QLatin1String(params->kind);
|
||||
if (Perforce::Constants::debug)
|
||||
qDebug() << "PerforcePlugin::showOutputInEditor" << title << kind << "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
|
||||
@@ -1048,10 +1051,9 @@ void PerforcePlugin::openFiles(const QStringList &files)
|
||||
|
||||
QString PerforcePlugin::clientFilePath(const QString &serverFilePath)
|
||||
{
|
||||
QString path;
|
||||
Q_ASSERT(m_coreInstance);
|
||||
QTC_ASSERT(m_coreInstance, return QString());
|
||||
if (!checkP4Command())
|
||||
return path;
|
||||
return QString();
|
||||
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
QProcess proc;
|
||||
@@ -1059,6 +1061,7 @@ QString PerforcePlugin::clientFilePath(const QString &serverFilePath)
|
||||
proc.start(m_settings.p4Command,
|
||||
basicP4Args() << QLatin1String("fstat") << serverFilePath);
|
||||
|
||||
QString path;
|
||||
if (proc.waitForFinished(3000)) {
|
||||
QString output = QString::fromUtf8(proc.readAllStandardOutput());
|
||||
if (!output.isEmpty()) {
|
||||
@@ -1225,7 +1228,7 @@ PerforcePlugin::~PerforcePlugin()
|
||||
}
|
||||
|
||||
if (!m_editorFactories.empty()) {
|
||||
foreach(Core::IEditorFactory* pf, m_editorFactories)
|
||||
foreach (Core::IEditorFactory *pf, m_editorFactories)
|
||||
removeObject(pf);
|
||||
qDeleteAll(m_editorFactories);
|
||||
m_editorFactories.clear();
|
||||
@@ -1285,5 +1288,17 @@ QString PerforcePlugin::fileNameFromPerforceName(const QString& perforceName,
|
||||
return rc;
|
||||
}
|
||||
|
||||
Core::ICore *PerforcePlugin::coreInstance()
|
||||
{
|
||||
QTC_ASSERT(m_coreInstance, return 0);
|
||||
return m_coreInstance;
|
||||
}
|
||||
|
||||
PerforcePlugin *PerforcePlugin::perforcePluginInstance()
|
||||
{
|
||||
QTC_ASSERT(m_perforcePluginInstance, return 0);
|
||||
return m_perforcePluginInstance;
|
||||
}
|
||||
|
||||
Q_EXPORT_PLUGIN(PerforcePlugin)
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
~PerforcePlugin();
|
||||
|
||||
QStringList basicP4Args() const;
|
||||
inline SettingsPage *settingsPage() const { return m_settingsPage; }
|
||||
SettingsPage *settingsPage() const { return m_settingsPage; }
|
||||
|
||||
bool initialize(const QStringList &arguments, QString *error_message);
|
||||
void extensionsInitialized();
|
||||
@@ -117,8 +117,8 @@ public:
|
||||
|
||||
Core::IEditor *openPerforceSubmitEditor(const QString &fileName, const QStringList &depotFileNames);
|
||||
|
||||
static Core::ICore *coreInstance() {Q_ASSERT(m_coreInstance); return m_coreInstance;}
|
||||
static PerforcePlugin *perforcePluginInstance() {Q_ASSERT(m_perforcePluginInstance); return m_perforcePluginInstance;}
|
||||
static Core::ICore *coreInstance();
|
||||
static PerforcePlugin *perforcePluginInstance();
|
||||
|
||||
PerforceSettings settings() const;
|
||||
void setSettings(const PerforceSettings &s);
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include "perforceplugin.h"
|
||||
#include "perforceconstants.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
namespace Perforce {
|
||||
@@ -153,7 +155,7 @@ void PerforceSubmitEditor::updateFields()
|
||||
lines.removeLast(); // that is the empty line at the end
|
||||
|
||||
const QRegExp leadingTabPattern = QRegExp(QLatin1String("^\\t"));
|
||||
Q_ASSERT(leadingTabPattern.isValid());
|
||||
QTC_ASSERT(leadingTabPattern.isValid(), /**/);
|
||||
|
||||
lines.replaceInStrings(leadingTabPattern, QString());
|
||||
widget->setDescriptionText(lines.join(newLine));
|
||||
|
||||
@@ -112,7 +112,7 @@ bool AbstractProcessStep::init(const QString &name)
|
||||
void AbstractProcessStep::run(QFutureInterface<bool> & fi)
|
||||
{
|
||||
m_futureInterface = &fi;
|
||||
if(!m_enabled) {
|
||||
if (!m_enabled) {
|
||||
fi.reportResult(true);
|
||||
return;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ void AbstractProcessStep::run(QFutureInterface<bool> & fi)
|
||||
Qt::DirectConnection);
|
||||
|
||||
m_process->start(m_command, m_arguments);
|
||||
if(!m_process->waitForStarted()) {
|
||||
if (!m_process->waitForStarted()) {
|
||||
processStartupFailed();
|
||||
delete m_process;
|
||||
m_process = 0;
|
||||
@@ -188,8 +188,7 @@ void AbstractProcessStep::processStartupFailed()
|
||||
void AbstractProcessStep::processReadyReadStdOutput()
|
||||
{
|
||||
m_process->setReadChannel(QProcess::StandardOutput);
|
||||
while(m_process->canReadLine())
|
||||
{
|
||||
while (m_process->canReadLine()) {
|
||||
QString line = QString::fromLocal8Bit(m_process->readLine()).trimmed();
|
||||
stdOut(line);
|
||||
}
|
||||
@@ -203,8 +202,7 @@ void AbstractProcessStep::stdOut(const QString &line)
|
||||
void AbstractProcessStep::processReadyReadStdError()
|
||||
{
|
||||
m_process->setReadChannel(QProcess::StandardError);
|
||||
while (m_process->canReadLine())
|
||||
{
|
||||
while (m_process->canReadLine()) {
|
||||
QString line = QString::fromLocal8Bit(m_process->readLine()).trimmed();
|
||||
stdError(line);
|
||||
}
|
||||
@@ -217,7 +215,7 @@ void AbstractProcessStep::stdError(const QString &line)
|
||||
|
||||
void AbstractProcessStep::checkForCancel()
|
||||
{
|
||||
if(m_futureInterface->isCanceled() && m_timer->isActive()) {
|
||||
if (m_futureInterface->isCanceled() && m_timer->isActive()) {
|
||||
m_timer->stop();
|
||||
m_process->terminate();
|
||||
m_process->waitForFinished(5000);
|
||||
@@ -228,13 +226,12 @@ void AbstractProcessStep::checkForCancel()
|
||||
void AbstractProcessStep::slotProcessFinished(int, QProcess::ExitStatus)
|
||||
{
|
||||
QString line = QString::fromLocal8Bit(m_process->readAllStandardError()).trimmed();
|
||||
if (!line.isEmpty()) {
|
||||
if (!line.isEmpty())
|
||||
stdOut(line);
|
||||
}
|
||||
|
||||
line = QString::fromLocal8Bit(m_process->readAllStandardOutput()).trimmed();
|
||||
if (!line.isEmpty()) {
|
||||
if (!line.isEmpty())
|
||||
stdError(line);
|
||||
}
|
||||
|
||||
m_eventLoop->exit(0);
|
||||
}
|
||||
|
||||
@@ -32,10 +32,13 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "allprojectsfind.h"
|
||||
#include "projectexplorer.h"
|
||||
#include "project.h"
|
||||
|
||||
#include <QtDebug>
|
||||
#include "project.h"
|
||||
#include "projectexplorer.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtGui/QGridLayout>
|
||||
|
||||
@@ -71,9 +74,7 @@ QKeySequence AllProjectsFind::defaultShortcut() const
|
||||
|
||||
QStringList AllProjectsFind::files()
|
||||
{
|
||||
Q_ASSERT(m_plugin->session());
|
||||
if (!m_plugin->session())
|
||||
return QStringList();
|
||||
QTC_ASSERT(m_plugin->session(), return QStringList());
|
||||
QList<QRegExp> filterRegs;
|
||||
QStringList nameFilters = fileNameFilters();
|
||||
foreach (const QString &filter, nameFilters) {
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "environment.h"
|
||||
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QTextDocument>
|
||||
@@ -94,8 +95,8 @@ QString ApplicationRunConfigurationRunner::displayName() const
|
||||
RunControl* ApplicationRunConfigurationRunner::run(QSharedPointer<RunConfiguration> runConfiguration, const QString &mode)
|
||||
{
|
||||
QSharedPointer<ApplicationRunConfiguration> rc = qSharedPointerCast<ApplicationRunConfiguration>(runConfiguration);
|
||||
Q_ASSERT(rc);
|
||||
Q_ASSERT(mode == ProjectExplorer::Constants::RUNMODE);
|
||||
QTC_ASSERT(rc, return 0);
|
||||
QTC_ASSERT(mode == ProjectExplorer::Constants::RUNMODE, return 0);
|
||||
|
||||
ApplicationRunControl *runControl = new ApplicationRunControl(rc);
|
||||
return runControl;
|
||||
@@ -112,10 +113,10 @@ QWidget *ApplicationRunConfigurationRunner::configurationWidget(QSharedPointer<R
|
||||
ApplicationRunControl::ApplicationRunControl(QSharedPointer<ApplicationRunConfiguration> runConfiguration)
|
||||
: RunControl(runConfiguration), m_applicationLauncher()
|
||||
{
|
||||
connect(&m_applicationLauncher, SIGNAL(applicationError(const QString &)),
|
||||
this, SLOT(slotError(const QString &)));
|
||||
connect(&m_applicationLauncher, SIGNAL(appendOutput(const QString &)),
|
||||
this, SLOT(slotAddToOutputWindow(const QString &)));
|
||||
connect(&m_applicationLauncher, SIGNAL(applicationError(QString)),
|
||||
this, SLOT(slotError(QString)));
|
||||
connect(&m_applicationLauncher, SIGNAL(appendOutput(QString)),
|
||||
this, SLOT(slotAddToOutputWindow(QString)));
|
||||
connect(&m_applicationLauncher, SIGNAL(processExited(int)),
|
||||
this, SLOT(processExited(int)));
|
||||
connect(&m_applicationLauncher, SIGNAL(bringToForegroundRequested(qint64)),
|
||||
@@ -129,7 +130,7 @@ ApplicationRunControl::~ApplicationRunControl()
|
||||
void ApplicationRunControl::start()
|
||||
{
|
||||
QSharedPointer<ApplicationRunConfiguration> rc = qSharedPointerCast<ApplicationRunConfiguration>(runConfiguration());
|
||||
Q_ASSERT(rc);
|
||||
QTC_ASSERT(rc, return);
|
||||
|
||||
m_applicationLauncher.setEnvironment(rc->environment().toStringList());
|
||||
m_applicationLauncher.setWorkingDirectory(rc->workingDirectory());
|
||||
|
||||
@@ -42,9 +42,8 @@ BuildConfiguration::BuildConfiguration(const QString &name)
|
||||
}
|
||||
|
||||
BuildConfiguration::BuildConfiguration(const QString &name, BuildConfiguration *source)
|
||||
:m_values(source->m_values), m_name(name)
|
||||
: m_values(source->m_values), m_name(name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString BuildConfiguration::name() const
|
||||
@@ -71,7 +70,7 @@ void BuildConfiguration::setDisplayName(const QString &name)
|
||||
QVariant BuildConfiguration::getValue(const QString & key) const
|
||||
{
|
||||
QHash<QString, QVariant>::const_iterator it = m_values.find(key);
|
||||
if(it != m_values.constEnd())
|
||||
if (it != m_values.constEnd())
|
||||
return *it;
|
||||
else
|
||||
return QVariant();
|
||||
@@ -86,7 +85,7 @@ void BuildConfiguration::setValuesFromMap(QMap<QString, QVariant> map)
|
||||
{
|
||||
QMap<QString, QVariant>::const_iterator it, end;
|
||||
end = map.constEnd();
|
||||
for(it = map.constBegin(); it != end; ++it)
|
||||
for (it = map.constBegin(); it != end; ++it)
|
||||
setValue(it.key(), it.value());
|
||||
}
|
||||
|
||||
@@ -95,7 +94,7 @@ QMap<QString, QVariant> BuildConfiguration::toMap() const
|
||||
QMap<QString, QVariant> result;
|
||||
QHash<QString, QVariant>::const_iterator it, end;
|
||||
end = m_values.constEnd();
|
||||
for(it = m_values.constBegin(); it != end; ++it)
|
||||
for (it = m_values.constBegin(); it != end; ++it)
|
||||
result.insert(it.key(), it.value());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -32,16 +32,18 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "buildmanager.h"
|
||||
|
||||
#include "buildprogress.h"
|
||||
#include "buildstep.h"
|
||||
#include "compileoutputwindow.h"
|
||||
#include "taskwindow.h"
|
||||
#include "projectexplorer.h"
|
||||
#include "projectexplorerconstants.h"
|
||||
#include "buildprogress.h"
|
||||
#include "projectexplorer.h"
|
||||
#include "taskwindow.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/progressmanager/progressmanagerinterface.h>
|
||||
#include <coreplugin/progressmanager/futureprogress.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QTimer>
|
||||
@@ -300,7 +302,7 @@ void BuildManager::buildQueueAppend(BuildStep * bs, const QString &configuration
|
||||
|
||||
void BuildManager::buildProjects(const QList<Project *> &projects, const QList<QString> &configurations)
|
||||
{
|
||||
Q_ASSERT(projects.count() == configurations.count());
|
||||
QTC_ASSERT(projects.count() == configurations.count(), /**/);
|
||||
QList<QString>::const_iterator cit = configurations.constBegin();
|
||||
QList<Project *>::const_iterator it, end;
|
||||
end = projects.constEnd();
|
||||
@@ -316,7 +318,7 @@ void BuildManager::buildProjects(const QList<Project *> &projects, const QList<Q
|
||||
|
||||
void BuildManager::cleanProjects(const QList<Project *> &projects, const QList<QString> &configurations)
|
||||
{
|
||||
Q_ASSERT(projects.count() == configurations.count());
|
||||
QTC_ASSERT(projects.count() == configurations.count(), /**/);
|
||||
QList<QString>::const_iterator cit = configurations.constBegin();
|
||||
QList<Project *>::const_iterator it, end;
|
||||
end = projects.constEnd();
|
||||
@@ -376,7 +378,7 @@ void BuildManager::decrementActiveBuildSteps(Project *pro)
|
||||
QHash<Project *, int>::iterator it = m_activeBuildSteps.find(pro);
|
||||
QHash<Project *, int>::iterator end = m_activeBuildSteps.end();
|
||||
if (it == end) {
|
||||
Q_ASSERT(false && "BuildManager m_activeBuildSteps says project is not building, but apparently a build step was still in the queue.");
|
||||
QTC_ASSERT(false && "BuildManager m_activeBuildSteps says project is not building, but apparently a build step was still in the queue.", return);
|
||||
} else if (*it == 1) {
|
||||
--*it;
|
||||
emit buildStateChanged(pro);
|
||||
|
||||
@@ -142,7 +142,7 @@ BuildSettingsWidget::BuildSettingsWidget(Project *project)
|
||||
void BuildSettingsWidget::buildConfigurationDisplayNameChanged(const QString &buildConfiguration)
|
||||
{
|
||||
QTreeWidgetItem *rootItem = m_ui.buildSettingsList->invisibleRootItem();
|
||||
for(int i = 0; i < rootItem->childCount(); ++i) {
|
||||
for (int i = 0; i < rootItem->childCount(); ++i) {
|
||||
QTreeWidgetItem *child = rootItem->child(i);
|
||||
if (child->data(0, Qt::UserRole).toString() == buildConfiguration) {
|
||||
child->setText(0, m_project->displayNameFor(buildConfiguration));
|
||||
@@ -334,7 +334,7 @@ void BuildSettingsWidget::createConfiguration()
|
||||
{
|
||||
bool ok;
|
||||
QString newBuildConfiguration = QInputDialog::getText(this, tr("New configuration"), tr("New Configuration Name:"), QLineEdit::Normal, QString(), &ok);
|
||||
if(!ok || newBuildConfiguration.isEmpty())
|
||||
if (!ok || newBuildConfiguration.isEmpty())
|
||||
return;
|
||||
|
||||
QString newDisplayName = newBuildConfiguration;
|
||||
@@ -342,22 +342,20 @@ void BuildSettingsWidget::createConfiguration()
|
||||
const QStringList &buildConfigurations = m_project->buildConfigurations();
|
||||
if (buildConfigurations.contains(newBuildConfiguration)) {
|
||||
int i = 2;
|
||||
while(buildConfigurations.contains(newBuildConfiguration + QString::number(i))) {
|
||||
while (buildConfigurations.contains(newBuildConfiguration + QString::number(i)))
|
||||
++i;
|
||||
}
|
||||
newBuildConfiguration += QString::number(i);
|
||||
}
|
||||
|
||||
// Check that we don't have a configuration with the same displayName
|
||||
QStringList displayNames;
|
||||
foreach(const QString &bc, buildConfigurations)
|
||||
foreach (const QString &bc, buildConfigurations)
|
||||
displayNames << m_project->displayNameFor(bc);
|
||||
|
||||
if (displayNames.contains(newDisplayName)) {
|
||||
int i = 2;
|
||||
while(displayNames.contains(newDisplayName + QString::number(i))) {
|
||||
while (displayNames.contains(newDisplayName + QString::number(i)))
|
||||
++i;
|
||||
}
|
||||
newDisplayName += QString::number(i);
|
||||
}
|
||||
|
||||
@@ -407,11 +405,11 @@ void BuildSettingsWidget::setActiveConfiguration(const QString &configuration)
|
||||
|
||||
void BuildSettingsWidget::cloneConfiguration(const QString &sourceConfiguration)
|
||||
{
|
||||
if(sourceConfiguration.isEmpty())
|
||||
if (sourceConfiguration.isEmpty())
|
||||
return;
|
||||
|
||||
QString newBuildConfiguration = QInputDialog::getText(this, tr("Clone configuration"), tr("New Configuration Name:"));
|
||||
if(newBuildConfiguration.isEmpty())
|
||||
if (newBuildConfiguration.isEmpty())
|
||||
return;
|
||||
|
||||
QString newDisplayName = newBuildConfiguration;
|
||||
@@ -419,22 +417,20 @@ void BuildSettingsWidget::cloneConfiguration(const QString &sourceConfiguration)
|
||||
const QStringList &buildConfigurations = m_project->buildConfigurations();
|
||||
if (buildConfigurations.contains(newBuildConfiguration)) {
|
||||
int i = 2;
|
||||
while(buildConfigurations.contains(newBuildConfiguration + QString::number(i))) {
|
||||
while (buildConfigurations.contains(newBuildConfiguration + QString::number(i)))
|
||||
++i;
|
||||
}
|
||||
newBuildConfiguration += QString::number(i);
|
||||
}
|
||||
|
||||
// Check that we don't have a configuration with the same displayName
|
||||
QStringList displayNames;
|
||||
foreach(const QString &bc, buildConfigurations)
|
||||
foreach (const QString &bc, buildConfigurations)
|
||||
displayNames << m_project->displayNameFor(bc);
|
||||
|
||||
if (displayNames.contains(newDisplayName)) {
|
||||
int i = 2;
|
||||
while(displayNames.contains(newDisplayName + QString::number(i))) {
|
||||
while (displayNames.contains(newDisplayName + QString::number(i)))
|
||||
++i;
|
||||
}
|
||||
newDisplayName += QString::number(i);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "buildstep.h"
|
||||
#include "buildconfiguration.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
BuildStep::BuildStep(Project * pro)
|
||||
@@ -60,8 +62,8 @@ void BuildStep::addBuildConfiguration(const QString &name)
|
||||
|
||||
void BuildStep::removeBuildConfiguration(const QString &name)
|
||||
{
|
||||
for(int i = 0; i != m_buildConfigurations.size(); ++i)
|
||||
if(m_buildConfigurations.at(i)->name() == name) {
|
||||
for (int i = 0; i != m_buildConfigurations.size(); ++i)
|
||||
if (m_buildConfigurations.at(i)->name() == name) {
|
||||
delete m_buildConfigurations.at(i);
|
||||
m_buildConfigurations.removeAt(i);
|
||||
break;
|
||||
@@ -70,15 +72,15 @@ void BuildStep::removeBuildConfiguration(const QString &name)
|
||||
|
||||
void BuildStep::copyBuildConfiguration(const QString &source, const QString &dest)
|
||||
{
|
||||
for(int i = 0; i != m_buildConfigurations.size(); ++i)
|
||||
if(m_buildConfigurations.at(i)->name() == source)
|
||||
for (int i = 0; i != m_buildConfigurations.size(); ++i)
|
||||
if (m_buildConfigurations.at(i)->name() == source)
|
||||
m_buildConfigurations.push_back(new BuildConfiguration(dest, m_buildConfigurations.at(i)));
|
||||
}
|
||||
|
||||
void BuildStep::setValue(const QString &buildConfiguration, const QString &name, const QVariant &value)
|
||||
{
|
||||
BuildConfiguration *bc = getBuildConfiguration(buildConfiguration);
|
||||
Q_ASSERT(bc);
|
||||
QTC_ASSERT(bc, return);
|
||||
bc->setValue(name, value);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,10 +32,12 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "buildstepspage.h"
|
||||
|
||||
#include "ui_buildstepspage.h"
|
||||
#include "project.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace ProjectExplorer::Internal;
|
||||
@@ -119,17 +121,16 @@ void BuildStepsPage::init(const QString &buildConfiguration)
|
||||
/* switch from one tree item / build step to another */
|
||||
void BuildStepsPage::updateBuildStepWidget(QTreeWidgetItem *newItem, QTreeWidgetItem *oldItem)
|
||||
{
|
||||
if(oldItem == newItem)
|
||||
if (oldItem == newItem)
|
||||
return;
|
||||
Q_ASSERT(m_pro);
|
||||
QTC_ASSERT(m_pro, return);
|
||||
|
||||
if(newItem) {
|
||||
if (newItem) {
|
||||
int row = m_ui->buildSettingsList->indexOfTopLevelItem(newItem);
|
||||
m_ui->buildSettingsWidget->setCurrentIndex(row);
|
||||
BuildStepConfigWidget *widget = qobject_cast<BuildStepConfigWidget *>(m_ui->buildSettingsWidget->currentWidget());
|
||||
Q_ASSERT(widget);
|
||||
if (widget)
|
||||
widget->init(m_configuration);
|
||||
QTC_ASSERT(widget, return);
|
||||
widget->init(m_configuration);
|
||||
}
|
||||
updateBuildStepButtonsState();
|
||||
}
|
||||
@@ -151,11 +152,11 @@ void BuildStepsPage::updateAddBuildStepMenu()
|
||||
QMenu *menu = m_ui->buildStepAddButton->menu();
|
||||
m_addBuildStepHash.clear();
|
||||
menu->clear();
|
||||
if(!map.isEmpty()) {
|
||||
if (!map.isEmpty()) {
|
||||
QStringList names;
|
||||
QMap<QString, QPair<QString, IBuildStepFactory *> >::const_iterator it, end;
|
||||
end = map.constEnd();
|
||||
for(it = map.constBegin(); it != end; ++it) {
|
||||
for (it = map.constBegin(); it != end; ++it) {
|
||||
QAction *action = menu->addAction(it.key());
|
||||
connect(action, SIGNAL(triggered()),
|
||||
this, SLOT(addBuildStep()));
|
||||
@@ -167,7 +168,7 @@ void BuildStepsPage::updateAddBuildStepMenu()
|
||||
|
||||
void BuildStepsPage::addBuildStep()
|
||||
{
|
||||
if(QAction *action = qobject_cast<QAction *>(sender())) {
|
||||
if (QAction *action = qobject_cast<QAction *>(sender())) {
|
||||
QPair<QString, IBuildStepFactory *> pair = m_addBuildStepHash.value(action);
|
||||
BuildStep *newStep = pair.second->create(m_pro, pair.first);
|
||||
m_pro->insertBuildStep(0, newStep);
|
||||
@@ -182,7 +183,7 @@ void BuildStepsPage::addBuildStep()
|
||||
void BuildStepsPage::removeBuildStep()
|
||||
{
|
||||
int pos = m_ui->buildSettingsList->currentIndex().row();
|
||||
if(m_pro->buildSteps().at(pos)->immutable())
|
||||
if (m_pro->buildSteps().at(pos)->immutable())
|
||||
return;
|
||||
bool blockSignals = m_ui->buildSettingsList->blockSignals(true);
|
||||
delete m_ui->buildSettingsList->invisibleRootItem()->takeChild(pos);
|
||||
@@ -190,7 +191,7 @@ void BuildStepsPage::removeBuildStep()
|
||||
QWidget *widget = m_ui->buildSettingsWidget->widget(pos);
|
||||
m_ui->buildSettingsWidget->removeWidget(widget);
|
||||
delete widget;
|
||||
if(pos < m_ui->buildSettingsList->invisibleRootItem()->childCount())
|
||||
if (pos < m_ui->buildSettingsList->invisibleRootItem()->childCount())
|
||||
m_ui->buildSettingsList->setCurrentItem(m_ui->buildSettingsList->invisibleRootItem()->child(pos));
|
||||
else
|
||||
m_ui->buildSettingsList->setCurrentItem(m_ui->buildSettingsList->invisibleRootItem()->child(pos - 1));
|
||||
@@ -201,11 +202,11 @@ void BuildStepsPage::removeBuildStep()
|
||||
void BuildStepsPage::upBuildStep()
|
||||
{
|
||||
int pos = m_ui->buildSettingsList->currentIndex().row();
|
||||
if(pos < 1)
|
||||
if (pos < 1)
|
||||
return;
|
||||
if(pos > m_ui->buildSettingsList->invisibleRootItem()->childCount()-1)
|
||||
if (pos > m_ui->buildSettingsList->invisibleRootItem()->childCount()-1)
|
||||
return;
|
||||
if(m_pro->buildSteps().at(pos)->immutable() && m_pro->buildSteps().at(pos-1)->immutable())
|
||||
if (m_pro->buildSteps().at(pos)->immutable() && m_pro->buildSteps().at(pos-1)->immutable())
|
||||
return;
|
||||
|
||||
bool blockSignals = m_ui->buildSettingsList->blockSignals(true);
|
||||
@@ -220,11 +221,11 @@ void BuildStepsPage::upBuildStep()
|
||||
void BuildStepsPage::downBuildStep()
|
||||
{
|
||||
int pos = m_ui->buildSettingsList->currentIndex().row() + 1;
|
||||
if(pos < 1)
|
||||
if (pos < 1)
|
||||
return;
|
||||
if(pos > m_ui->buildSettingsList->invisibleRootItem()->childCount() - 1)
|
||||
if (pos > m_ui->buildSettingsList->invisibleRootItem()->childCount() - 1)
|
||||
return;
|
||||
if(m_pro->buildSteps().at(pos)->immutable() && m_pro->buildSteps().at(pos - 1)->immutable())
|
||||
if (m_pro->buildSteps().at(pos)->immutable() && m_pro->buildSteps().at(pos - 1)->immutable())
|
||||
return;
|
||||
|
||||
bool blockSignals = m_ui->buildSettingsList->blockSignals(true);
|
||||
@@ -238,7 +239,7 @@ void BuildStepsPage::downBuildStep()
|
||||
|
||||
void BuildStepsPage::changeEvent(QEvent *e)
|
||||
{
|
||||
switch(e->type()) {
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
m_ui->retranslateUi(this);
|
||||
break;
|
||||
|
||||
@@ -32,10 +32,13 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "currentprojectfind.h"
|
||||
|
||||
#include "projectexplorer.h"
|
||||
#include "project.h"
|
||||
|
||||
#include <QtDebug>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QRegExp>
|
||||
#include <QtGui/QGridLayout>
|
||||
|
||||
@@ -71,9 +74,7 @@ QKeySequence CurrentProjectFind::defaultShortcut() const
|
||||
QStringList CurrentProjectFind::files()
|
||||
{
|
||||
Project *project = m_plugin->currentProject();
|
||||
Q_ASSERT(project);
|
||||
if (!project)
|
||||
return QStringList();
|
||||
QTC_ASSERT(project, return QStringList());
|
||||
QList<QRegExp> filterRegs;
|
||||
QStringList nameFilters = fileNameFilters();
|
||||
foreach (const QString &filter, nameFilters) {
|
||||
|
||||
@@ -45,7 +45,7 @@ QList<EnvironmentItem> EnvironmentItem::fromStringList(QStringList list)
|
||||
QList<EnvironmentItem> result;
|
||||
foreach (const QString &string, list) {
|
||||
int pos = string.indexOf(QLatin1Char('='));
|
||||
if(pos == -1) {
|
||||
if (pos == -1) {
|
||||
EnvironmentItem item(string, "");
|
||||
item.unset = true;
|
||||
result.append(item);
|
||||
@@ -61,7 +61,7 @@ QStringList EnvironmentItem::toStringList(QList<EnvironmentItem> list)
|
||||
{
|
||||
QStringList result;
|
||||
foreach (const EnvironmentItem &item, list) {
|
||||
if(item.unset)
|
||||
if (item.unset)
|
||||
result << QString(item.name);
|
||||
else
|
||||
result << QString(item.name + '=' + item.value);
|
||||
@@ -71,14 +71,13 @@ QStringList EnvironmentItem::toStringList(QList<EnvironmentItem> list)
|
||||
|
||||
Environment::Environment()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Environment::Environment(QStringList env)
|
||||
{
|
||||
foreach(QString s, env) {
|
||||
foreach (const QString &s, env) {
|
||||
int i = s.indexOf("=");
|
||||
if (i >=0 ) {
|
||||
if (i >= 0) {
|
||||
#ifdef Q_OS_WIN
|
||||
m_values.insert(s.left(i).toUpper(), s.mid(i+1));
|
||||
#else
|
||||
@@ -196,13 +195,13 @@ QString Environment::searchInPath(QString executable)
|
||||
executable.append(QLatin1String(".exe"));
|
||||
#endif
|
||||
const QChar slash = QLatin1Char('/');
|
||||
foreach(const QString &p, path()) {
|
||||
foreach (const QString &p, path()) {
|
||||
// qDebug()<<"trying"<<path + '/' + executable;
|
||||
QString fp = p;
|
||||
fp += slash;
|
||||
fp += executable;
|
||||
const QFileInfo fi(fp);
|
||||
if(fi.exists()) {
|
||||
if (fi.exists()) {
|
||||
// qDebug()<<"returning "<<fi.absoluteFilePath();
|
||||
return fi.absoluteFilePath();
|
||||
}
|
||||
@@ -248,7 +247,7 @@ Environment::const_iterator Environment::constEnd() const
|
||||
Environment::const_iterator Environment::find(const QString &name)
|
||||
{
|
||||
QMap<QString, QString>::const_iterator it = m_values.constFind(name);
|
||||
if(it == m_values.constEnd())
|
||||
if (it == m_values.constEnd())
|
||||
return constEnd();
|
||||
else
|
||||
return it;
|
||||
@@ -263,24 +262,24 @@ void Environment::modify(const QList<EnvironmentItem> & list)
|
||||
{
|
||||
Environment resultEnvironment = *this;
|
||||
foreach (const EnvironmentItem &item, list) {
|
||||
if(item.unset) {
|
||||
if (item.unset) {
|
||||
resultEnvironment.unset(item.name);
|
||||
} else {
|
||||
// TODO use variable expansion
|
||||
QString value = item.value;
|
||||
for(int i=0; i < value.size(); ++i) {
|
||||
if(value.at(i) == QLatin1Char('$')) {
|
||||
if((i + 1) < value.size()) {
|
||||
for (int i=0; i < value.size(); ++i) {
|
||||
if (value.at(i) == QLatin1Char('$')) {
|
||||
if ((i + 1) < value.size()) {
|
||||
const QChar &c = value.at(i+1);
|
||||
int end = -1;
|
||||
if (c == '(')
|
||||
end = value.indexOf(')', i);
|
||||
else if (c=='{')
|
||||
else if (c == '{')
|
||||
end = value.indexOf('}', i);
|
||||
if(end != -1) {
|
||||
if (end != -1) {
|
||||
const QString &name = value.mid(i+2, end-i-2);
|
||||
Environment::const_iterator it = find(name);
|
||||
if(it != constEnd())
|
||||
if (it != constEnd())
|
||||
value.replace(i, end-i+1, it.value());
|
||||
}
|
||||
}
|
||||
@@ -334,7 +333,7 @@ QStringList Environment::parseCombinedArgString(const QString &program)
|
||||
QString Environment::joinArgumentList(const QStringList &arguments)
|
||||
{
|
||||
QString result;
|
||||
foreach(QString arg, arguments) {
|
||||
foreach (QString arg, arguments) {
|
||||
if (!result.isEmpty())
|
||||
result += QLatin1Char(' ');
|
||||
arg.replace(QLatin1String("\""), QLatin1String("\"\"\""));
|
||||
|
||||
@@ -38,11 +38,13 @@ using namespace ProjectExplorer;
|
||||
EnvironmentModel::EnvironmentModel()
|
||||
: m_mergedEnvironments(false)
|
||||
{}
|
||||
EnvironmentModel::~EnvironmentModel() {}
|
||||
|
||||
EnvironmentModel::~EnvironmentModel()
|
||||
{}
|
||||
|
||||
QString EnvironmentModel::indexToVariable(const QModelIndex &index) const
|
||||
{
|
||||
if(m_mergedEnvironments)
|
||||
if (m_mergedEnvironments)
|
||||
return m_resultEnvironment.key(m_resultEnvironment.constBegin() + index.row());
|
||||
else
|
||||
return m_items.at(index.row()).name;
|
||||
@@ -53,7 +55,7 @@ void EnvironmentModel::updateResultEnvironment()
|
||||
m_resultEnvironment = m_baseEnvironment;
|
||||
m_resultEnvironment.modify(m_items);
|
||||
foreach (const EnvironmentItem &item, m_items) {
|
||||
if(item.unset) {
|
||||
if (item.unset) {
|
||||
m_resultEnvironment.set(item.name, "<UNSET>");
|
||||
}
|
||||
}
|
||||
@@ -68,10 +70,10 @@ void EnvironmentModel::setBaseEnvironment(const ProjectExplorer::Environment &en
|
||||
|
||||
void EnvironmentModel::setMergedEnvironments(bool b)
|
||||
{
|
||||
if(m_mergedEnvironments == b)
|
||||
if (m_mergedEnvironments == b)
|
||||
return;
|
||||
m_mergedEnvironments = b;
|
||||
if(b)
|
||||
if (b)
|
||||
updateResultEnvironment();
|
||||
reset();
|
||||
}
|
||||
@@ -96,48 +98,46 @@ int EnvironmentModel::columnCount(const QModelIndex &parent) const
|
||||
|
||||
bool EnvironmentModel::changes(const QString &name) const
|
||||
{
|
||||
foreach(const EnvironmentItem& item, m_items) {
|
||||
if(item.name == name) {
|
||||
foreach (const EnvironmentItem& item, m_items)
|
||||
if (item.name == name)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QVariant EnvironmentModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if((role == Qt::DisplayRole || role == Qt::EditRole) && index.isValid()) {
|
||||
if((m_mergedEnvironments && index.row() >= m_resultEnvironment.size()) ||
|
||||
if ((role == Qt::DisplayRole || role == Qt::EditRole) && index.isValid()) {
|
||||
if ((m_mergedEnvironments && index.row() >= m_resultEnvironment.size()) ||
|
||||
(!m_mergedEnvironments && index.row() >= m_items.count())) {
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
if(index.column() == 0) {
|
||||
if(m_mergedEnvironments) {
|
||||
if (index.column() == 0) {
|
||||
if (m_mergedEnvironments) {
|
||||
return m_resultEnvironment.key(m_resultEnvironment.constBegin() + index.row());
|
||||
} else {
|
||||
return m_items.at(index.row()).name;
|
||||
}
|
||||
} else if(index.column() == 1) {
|
||||
if(m_mergedEnvironments) {
|
||||
if(role == Qt::EditRole) {
|
||||
} else if (index.column() == 1) {
|
||||
if (m_mergedEnvironments) {
|
||||
if (role == Qt::EditRole) {
|
||||
int pos = findInChanges(indexToVariable(index));
|
||||
if(pos != -1)
|
||||
if (pos != -1)
|
||||
return m_items.at(pos).value;
|
||||
}
|
||||
return m_resultEnvironment.value(m_resultEnvironment.constBegin() + index.row());
|
||||
} else {
|
||||
if(m_items.at(index.row()).unset)
|
||||
if (m_items.at(index.row()).unset)
|
||||
return "<UNSET>";
|
||||
else
|
||||
return m_items.at(index.row()).value;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(role == Qt::FontRole) {
|
||||
if(m_mergedEnvironments) {
|
||||
if (role == Qt::FontRole) {
|
||||
if (m_mergedEnvironments) {
|
||||
// check wheter this environment variable exists in m_items
|
||||
if(changes(m_resultEnvironment.key(m_resultEnvironment.constBegin() + index.row()))) {
|
||||
if (changes(m_resultEnvironment.key(m_resultEnvironment.constBegin() + index.row()))) {
|
||||
QFont f;
|
||||
f.setBold(true);
|
||||
return QVariant(f);
|
||||
@@ -157,7 +157,7 @@ Qt::ItemFlags EnvironmentModel::flags(const QModelIndex &index) const
|
||||
|
||||
bool EnvironmentModel::hasChildren(const QModelIndex &index) const
|
||||
{
|
||||
if(!index.isValid())
|
||||
if (!index.isValid())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
@@ -165,14 +165,14 @@ bool EnvironmentModel::hasChildren(const QModelIndex &index) const
|
||||
|
||||
QVariant EnvironmentModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if(orientation == Qt::Vertical || role != Qt::DisplayRole)
|
||||
if (orientation == Qt::Vertical || role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
return section == 0 ? tr("Variable") : tr("Value");
|
||||
}
|
||||
|
||||
QModelIndex EnvironmentModel::index(int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
if(!parent.isValid())
|
||||
if (!parent.isValid())
|
||||
return createIndex(row, column, 0);
|
||||
return QModelIndex();
|
||||
}
|
||||
@@ -188,16 +188,16 @@ QModelIndex EnvironmentModel::parent(const QModelIndex &index) const
|
||||
/// *****************
|
||||
int EnvironmentModel::findInChanges(const QString &name) const
|
||||
{
|
||||
for(int i=0; i<m_items.size(); ++i)
|
||||
if(m_items.at(i).name == name)
|
||||
for (int i=0; i<m_items.size(); ++i)
|
||||
if (m_items.at(i).name == name)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int EnvironmentModel::findInChangesInsertPosition(const QString &name) const
|
||||
{
|
||||
for(int i=0; i<m_items.size(); ++i)
|
||||
if(m_items.at(i).name > name)
|
||||
for (int i=0; i<m_items.size(); ++i)
|
||||
if (m_items.at(i).name > name)
|
||||
return i;
|
||||
return m_items.size();
|
||||
}
|
||||
@@ -206,8 +206,8 @@ int EnvironmentModel::findInResult(const QString &name) const
|
||||
{
|
||||
Environment::const_iterator it;
|
||||
int i = 0;
|
||||
for(it = m_resultEnvironment.constBegin(); it != m_resultEnvironment.constEnd(); ++it, ++i)
|
||||
if(m_resultEnvironment.key(it) == name)
|
||||
for (it = m_resultEnvironment.constBegin(); it != m_resultEnvironment.constEnd(); ++it, ++i)
|
||||
if (m_resultEnvironment.key(it) == name)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
@@ -216,28 +216,28 @@ int EnvironmentModel::findInResultInsertPosition(const QString &name) const
|
||||
{
|
||||
Environment::const_iterator it;
|
||||
int i = 0;
|
||||
for(it = m_resultEnvironment.constBegin(); it != m_resultEnvironment.constEnd(); ++it, ++i)
|
||||
if(m_resultEnvironment.key(it) > name)
|
||||
for (it = m_resultEnvironment.constBegin(); it != m_resultEnvironment.constEnd(); ++it, ++i)
|
||||
if (m_resultEnvironment.key(it) > name)
|
||||
return i;
|
||||
return m_resultEnvironment.size();
|
||||
}
|
||||
|
||||
bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if(role == Qt::EditRole && index.isValid()) {
|
||||
if(index.column() == 0) {
|
||||
if (role == Qt::EditRole && index.isValid()) {
|
||||
if (index.column() == 0) {
|
||||
//fail if a variable with the same name already exists
|
||||
#ifdef Q_OS_WIN
|
||||
if(findInChanges(value.toString().toUpper()) != -1)
|
||||
if (findInChanges(value.toString().toUpper()) != -1)
|
||||
return false;
|
||||
#else
|
||||
if(findInChanges(value.toString()) != -1)
|
||||
if (findInChanges(value.toString()) != -1)
|
||||
return false;
|
||||
#endif
|
||||
EnvironmentItem old("", "");
|
||||
if(m_mergedEnvironments) {
|
||||
if (m_mergedEnvironments) {
|
||||
int pos = findInChanges(indexToVariable(index));
|
||||
if(pos != -1) {
|
||||
if (pos != -1) {
|
||||
old = m_items.at(pos);
|
||||
} else {
|
||||
old.name = m_resultEnvironment.key(m_resultEnvironment.constBegin() + index.row());
|
||||
@@ -252,16 +252,16 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
#else
|
||||
const QString &newName = value.toString();
|
||||
#endif
|
||||
if(changes(old.name))
|
||||
if (changes(old.name))
|
||||
removeVariable(old.name);
|
||||
old.name = newName;
|
||||
addVariable(old);
|
||||
return true;
|
||||
} else if(index.column() == 1) {
|
||||
if(m_mergedEnvironments) {
|
||||
} else if (index.column() == 1) {
|
||||
if (m_mergedEnvironments) {
|
||||
const QString &name = indexToVariable(index);
|
||||
int pos = findInChanges(name);
|
||||
if(pos != -1) {
|
||||
if (pos != -1) {
|
||||
m_items[pos].value = value.toString();
|
||||
m_items[pos].unset = false;
|
||||
updateResultEnvironment();
|
||||
@@ -287,13 +287,13 @@ bool EnvironmentModel::setData(const QModelIndex &index, const QVariant &value,
|
||||
QModelIndex EnvironmentModel::addVariable()
|
||||
{
|
||||
const QString &name = "<VARIABLE>";
|
||||
if(m_mergedEnvironments) {
|
||||
if (m_mergedEnvironments) {
|
||||
int i = findInResult(name);
|
||||
if(i != -1)
|
||||
if (i != -1)
|
||||
return index(i, 0, QModelIndex());
|
||||
} else {
|
||||
int i = findInChanges(name);
|
||||
if(i != -1)
|
||||
if (i != -1)
|
||||
return index(i, 0, QModelIndex());
|
||||
}
|
||||
// Don't exist, really add them
|
||||
@@ -302,10 +302,10 @@ QModelIndex EnvironmentModel::addVariable()
|
||||
|
||||
QModelIndex EnvironmentModel::addVariable(const EnvironmentItem &item)
|
||||
{
|
||||
if(m_mergedEnvironments) {
|
||||
if (m_mergedEnvironments) {
|
||||
bool existsInBaseEnvironment = (m_baseEnvironment.find(item.name) != m_baseEnvironment.constEnd());
|
||||
int rowInResult;
|
||||
if(existsInBaseEnvironment)
|
||||
if (existsInBaseEnvironment)
|
||||
rowInResult = findInResult(item.name);
|
||||
else
|
||||
rowInResult = findInResultInsertPosition(item.name);
|
||||
@@ -313,7 +313,7 @@ QModelIndex EnvironmentModel::addVariable(const EnvironmentItem &item)
|
||||
|
||||
qDebug()<<"addVariable "<<item.name<<existsInBaseEnvironment<<rowInResult<<rowInChanges;
|
||||
|
||||
if(existsInBaseEnvironment) {
|
||||
if (existsInBaseEnvironment) {
|
||||
m_items.insert(rowInChanges, item);
|
||||
updateResultEnvironment();
|
||||
emit dataChanged(index(rowInResult, 0, QModelIndex()), index(rowInResult, 1, QModelIndex()));
|
||||
@@ -340,11 +340,11 @@ QModelIndex EnvironmentModel::addVariable(const EnvironmentItem &item)
|
||||
|
||||
void EnvironmentModel::removeVariable(const QString &name)
|
||||
{
|
||||
if(m_mergedEnvironments) {
|
||||
if (m_mergedEnvironments) {
|
||||
int rowInResult = findInResult(name);
|
||||
int rowInChanges = findInChanges(name);
|
||||
bool existsInBaseEnvironment = m_baseEnvironment.find(name) != m_baseEnvironment.constEnd();
|
||||
if(existsInBaseEnvironment) {
|
||||
if (existsInBaseEnvironment) {
|
||||
m_items.removeAt(rowInChanges);
|
||||
updateResultEnvironment();
|
||||
emit dataChanged(index(rowInResult, 0, QModelIndex()), index(rowInResult, 1, QModelIndex()));
|
||||
@@ -368,11 +368,11 @@ void EnvironmentModel::removeVariable(const QString &name)
|
||||
|
||||
void EnvironmentModel::unset(const QString &name)
|
||||
{
|
||||
if(m_mergedEnvironments) {
|
||||
if (m_mergedEnvironments) {
|
||||
int row = findInResult(name);
|
||||
// look in m_items for the variable
|
||||
int pos = findInChanges(name);
|
||||
if(pos != -1) {
|
||||
if (pos != -1) {
|
||||
m_items[pos].unset = true;
|
||||
updateResultEnvironment();
|
||||
emit dataChanged(index(row, 0, QModelIndex()), index(row, 1, QModelIndex()));
|
||||
@@ -398,7 +398,7 @@ void EnvironmentModel::unset(const QString &name)
|
||||
bool EnvironmentModel::isUnset(const QString &name)
|
||||
{
|
||||
int pos = findInChanges(name);
|
||||
if(pos != -1)
|
||||
if (pos != -1)
|
||||
return m_items.at(pos).unset;
|
||||
else
|
||||
return false;
|
||||
|
||||
@@ -64,7 +64,7 @@ bool OutputPane::canFocus()
|
||||
|
||||
void OutputPane::setFocus()
|
||||
{
|
||||
if(m_tabWidget->currentWidget())
|
||||
if (m_tabWidget->currentWidget())
|
||||
m_tabWidget->currentWidget()->setFocus();
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ void OutputPane::createNewOutputWindow(RunControl *rc)
|
||||
|
||||
// First look if we can reuse a tab
|
||||
bool found = false;
|
||||
for(int i=0; i<m_tabWidget->count(); ++i) {
|
||||
for (int i=0; i<m_tabWidget->count(); ++i) {
|
||||
RunControl *old = runControlForTab(i);
|
||||
if (old->runConfiguration() == rc->runConfiguration() && !old->isRunning()) {
|
||||
// Reuse this tab
|
||||
|
||||
@@ -152,7 +152,7 @@ void PersistentSettingsWriter::writeValue(QDomElement &ps, const QVariant &varia
|
||||
QDomElement values = ps.ownerDocument().createElement("valuelist");
|
||||
values.setAttribute("type", QVariant::typeToName(QVariant::List));
|
||||
QList<QVariant> varList = variant.toList();
|
||||
foreach(QVariant var, varList) {
|
||||
foreach (QVariant var, varList) {
|
||||
writeValue(values, var);
|
||||
}
|
||||
ps.appendChild(values);
|
||||
|
||||
@@ -90,7 +90,7 @@ QList<ProjectFileFactory*> ProjectFileFactory::createFactories(const Core::ICore
|
||||
|
||||
const QString filterSeparator = QLatin1String(";;");
|
||||
filterString->clear();
|
||||
foreach(IProjectManager *manager, projectManagers) {
|
||||
foreach (IProjectManager *manager, projectManagers) {
|
||||
rc.push_back(new ProjectFileFactory(core, manager));
|
||||
if (!filterString->isEmpty())
|
||||
*filterString += filterSeparator;
|
||||
|
||||
@@ -54,7 +54,7 @@ bool ProcessStep::init(const QString &buildConfiguration)
|
||||
setEnvironment(buildConfiguration, project()->environment(buildConfiguration));
|
||||
QVariant wd = value(buildConfiguration, "workingDirectory").toString();
|
||||
QString workingDirectory;
|
||||
if(!wd.isValid() || wd.toString().isEmpty())
|
||||
if (!wd.isValid() || wd.toString().isEmpty())
|
||||
workingDirectory = "$BUILDDIR";
|
||||
else
|
||||
workingDirectory = wd.toString();
|
||||
@@ -161,7 +161,7 @@ QString ProcessStepConfigWidget::displayName() const
|
||||
void ProcessStepConfigWidget::workingDirBrowseButtonClicked()
|
||||
{
|
||||
QString workingDirectory = QFileDialog::getExistingDirectory(this, "Select the working directory", m_ui.workingDirectoryLineEdit->text());
|
||||
if(workingDirectory.isEmpty())
|
||||
if (workingDirectory.isEmpty())
|
||||
return;
|
||||
m_ui.workingDirectoryLineEdit->setText(workingDirectory);
|
||||
workingDirectoryLineEditTextEdited();
|
||||
@@ -170,7 +170,7 @@ void ProcessStepConfigWidget::workingDirBrowseButtonClicked()
|
||||
void ProcessStepConfigWidget::commandBrowseButtonClicked()
|
||||
{
|
||||
QString filename = QFileDialog::getOpenFileName(this, "Select the executable");
|
||||
if(filename.isEmpty())
|
||||
if (filename.isEmpty())
|
||||
return;
|
||||
m_ui.commandLineEdit->setText(filename);
|
||||
commandLineEditTextEdited();
|
||||
@@ -179,7 +179,7 @@ void ProcessStepConfigWidget::commandBrowseButtonClicked()
|
||||
void ProcessStepConfigWidget::init(const QString &buildConfiguration)
|
||||
{
|
||||
m_buildConfiguration = buildConfiguration;
|
||||
if(buildConfiguration != QString::null) {
|
||||
if (buildConfiguration != QString::null) {
|
||||
m_ui.commandLineEdit->setText(m_step->command(buildConfiguration));
|
||||
|
||||
QString workingDirectory = m_step->value(buildConfiguration, "workingDirectory").toString();
|
||||
|
||||
@@ -40,9 +40,10 @@
|
||||
|
||||
#include <coreplugin/ifile.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QtCore/QTextCodec>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QTextCodec>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using ExtensionSystem::PluginManager;
|
||||
@@ -57,11 +58,9 @@ void Project::insertBuildStep(int position, BuildStep *step)
|
||||
{
|
||||
m_buildSteps.insert(position, step);
|
||||
// check that the step has all the configurations
|
||||
foreach(const QString & name, buildConfigurations())
|
||||
{
|
||||
foreach (const QString &name, buildConfigurations())
|
||||
if (!step->getBuildConfiguration(name))
|
||||
step->addBuildConfiguration(name);
|
||||
}
|
||||
}
|
||||
|
||||
void Project::removeBuildStep(int position)
|
||||
@@ -80,11 +79,9 @@ void Project::insertCleanStep(int position, BuildStep *step)
|
||||
{
|
||||
m_cleanSteps.insert(position, step);
|
||||
// check that the step has all the configurations
|
||||
foreach(const QString & name, buildConfigurations())
|
||||
{
|
||||
foreach (const QString &name, buildConfigurations())
|
||||
if (!step->getBuildConfiguration(name))
|
||||
step->addBuildConfiguration(name);
|
||||
}
|
||||
}
|
||||
|
||||
void Project::removeCleanStep(int position)
|
||||
@@ -100,10 +97,10 @@ void Project::addBuildConfiguration(const QString &name)
|
||||
|
||||
m_buildConfigurationValues.push_back(new BuildConfiguration(name));
|
||||
|
||||
for (int i = 0; i!=m_buildSteps.size(); ++i)
|
||||
for (int i = 0; i != m_buildSteps.size(); ++i)
|
||||
m_buildSteps.at(i)->addBuildConfiguration(name);
|
||||
|
||||
for (int i = 0; i!=m_cleanSteps.size(); ++i)
|
||||
for (int i = 0; i != m_cleanSteps.size(); ++i)
|
||||
m_cleanSteps.at(i)->addBuildConfiguration(name);
|
||||
}
|
||||
|
||||
@@ -113,15 +110,15 @@ void Project::removeBuildConfiguration(const QString &name)
|
||||
return;
|
||||
|
||||
for (int i = 0; i != m_buildConfigurationValues.size(); ++i)
|
||||
if(m_buildConfigurationValues.at(i)->name() == name) {
|
||||
if (m_buildConfigurationValues.at(i)->name() == name) {
|
||||
delete m_buildConfigurationValues.at(i);
|
||||
m_buildConfigurationValues.removeAt(i);
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i!=m_buildSteps.size(); ++i)
|
||||
for (int i = 0; i != m_buildSteps.size(); ++i)
|
||||
m_buildSteps.at(i)->removeBuildConfiguration(name);
|
||||
for (int i = 0; i!=m_cleanSteps.size(); ++i)
|
||||
for (int i = 0; i != m_cleanSteps.size(); ++i)
|
||||
m_cleanSteps.at(i)->removeBuildConfiguration(name);
|
||||
|
||||
}
|
||||
@@ -132,22 +129,21 @@ void Project::copyBuildConfiguration(const QString &source, const QString &dest)
|
||||
return;
|
||||
|
||||
for (int i = 0; i != m_buildConfigurationValues.size(); ++i)
|
||||
if(m_buildConfigurationValues.at(i)->name() == source)
|
||||
if (m_buildConfigurationValues.at(i)->name() == source)
|
||||
m_buildConfigurationValues.push_back(new BuildConfiguration(dest, m_buildConfigurationValues.at(i)));
|
||||
|
||||
for (int i = 0; i!= m_buildSteps.size(); ++i)
|
||||
for (int i = 0; i != m_buildSteps.size(); ++i)
|
||||
m_buildSteps.at(i)->copyBuildConfiguration(source, dest);
|
||||
|
||||
for (int i = 0; i!= m_cleanSteps.size(); ++i)
|
||||
for (int i = 0; i != m_cleanSteps.size(); ++i)
|
||||
m_cleanSteps.at(i)->copyBuildConfiguration(source, dest);
|
||||
}
|
||||
|
||||
QStringList Project::buildConfigurations() const
|
||||
{
|
||||
QStringList result;
|
||||
foreach (BuildConfiguration *bc, m_buildConfigurationValues) {
|
||||
foreach (BuildConfiguration *bc, m_buildConfigurationValues)
|
||||
result << bc->name();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -195,39 +191,36 @@ void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
|
||||
writer.saveValue("project", m_values);
|
||||
|
||||
//save buildsettings
|
||||
foreach(const QString & buildConfigurationName, buildConfigurations()) {
|
||||
foreach (const QString &buildConfigurationName, buildConfigurations()) {
|
||||
QMap<QString, QVariant> temp =
|
||||
getBuildConfiguration(buildConfigurationName)->toMap();
|
||||
writer.saveValue("buildConfiguration-" + buildConfigurationName, temp);
|
||||
}
|
||||
|
||||
QStringList buildStepNames;
|
||||
foreach(BuildStep * buildStep, buildSteps()) {
|
||||
foreach (BuildStep *buildStep, buildSteps())
|
||||
buildStepNames << buildStep->name();
|
||||
}
|
||||
writer.saveValue("buildsteps", buildStepNames);
|
||||
|
||||
QStringList cleanStepNames;
|
||||
foreach(BuildStep * cleanStep, cleanSteps()) {
|
||||
foreach (BuildStep *cleanStep, cleanSteps())
|
||||
cleanStepNames << cleanStep->name();
|
||||
}
|
||||
writer.saveValue("cleansteps", cleanStepNames);
|
||||
QStringList buildConfigurationNames = buildConfigurations();
|
||||
writer.saveValue("buildconfigurations", buildConfigurationNames );
|
||||
|
||||
//save buildstep configuration
|
||||
int buildstepnr = 0;
|
||||
foreach(BuildStep * buildStep, buildSteps())
|
||||
{
|
||||
foreach (BuildStep *buildStep, buildSteps()) {
|
||||
QMap<QString, QVariant> buildConfiguration = buildStep->valuesToMap();
|
||||
writer.saveValue("buildstep" + QString().setNum(buildstepnr), buildConfiguration);
|
||||
++buildstepnr;
|
||||
}
|
||||
|
||||
// save each buildstep/buildConfiguration combination
|
||||
foreach(const QString & buildConfigurationName, buildConfigurationNames) {
|
||||
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
||||
buildstepnr = 0;
|
||||
foreach(BuildStep * buildStep, buildSteps()) {
|
||||
foreach (BuildStep *buildStep, buildSteps()) {
|
||||
QMap<QString, QVariant> temp =
|
||||
buildStep->valuesToMap(buildConfigurationName);
|
||||
writer.saveValue("buildconfiguration-" + buildConfigurationName + "-buildstep" + QString().setNum(buildstepnr), temp);
|
||||
@@ -237,17 +230,16 @@ void Project::saveSettingsImpl(PersistentSettingsWriter &writer)
|
||||
|
||||
//save cleansteps buildconfiguration
|
||||
int cleanstepnr = 0;
|
||||
foreach(BuildStep * cleanStep, cleanSteps())
|
||||
{
|
||||
foreach (BuildStep *cleanStep, cleanSteps()) {
|
||||
QMap<QString, QVariant> buildConfiguration = cleanStep->valuesToMap();
|
||||
writer.saveValue("cleanstep" + QString().setNum(cleanstepnr), buildConfiguration);
|
||||
++cleanstepnr;
|
||||
}
|
||||
|
||||
// save each cleanstep/buildConfiguration combination
|
||||
foreach(const QString & buildConfigurationName, buildConfigurationNames) {
|
||||
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
||||
cleanstepnr = 0;
|
||||
foreach(BuildStep * cleanStep, cleanSteps()) {
|
||||
foreach (BuildStep *cleanStep, cleanSteps()) {
|
||||
QMap<QString, QVariant> temp = cleanStep->valuesToMap(buildConfigurationName);
|
||||
writer.saveValue("buildconfiguration-" + buildConfigurationName + "-cleanstep" + QString().setNum(cleanstepnr), temp);
|
||||
++cleanstepnr;
|
||||
@@ -279,7 +271,7 @@ void Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
|
||||
//Build Settings
|
||||
const QStringList buildConfigurationNames = reader.restoreValue("buildconfigurations").toStringList();
|
||||
foreach(const QString & buildConfigurationName, buildConfigurationNames) {
|
||||
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
||||
addBuildConfiguration(buildConfigurationName);
|
||||
QMap<QString, QVariant> temp =
|
||||
reader.restoreValue("buildConfiguration-" + buildConfigurationName).toMap();
|
||||
@@ -287,16 +279,16 @@ void Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
}
|
||||
|
||||
QVariant buildStepsVariant = reader.restoreValue("buildsteps");
|
||||
if(buildStepsVariant.isValid()) {
|
||||
if (buildStepsVariant.isValid()) {
|
||||
// restoring BuildSteps from settings
|
||||
int pos = 0;
|
||||
const QList<IBuildStepFactory *> buildStepFactories =
|
||||
ExtensionSystem::PluginManager::instance()->getObjects<IBuildStepFactory>();
|
||||
QStringList buildStepNames = buildStepsVariant.toStringList();
|
||||
foreach(const QString & buildStepName, buildStepNames) {
|
||||
foreach(IBuildStepFactory * factory, buildStepFactories) {
|
||||
if(factory->canCreate(buildStepName)) {
|
||||
BuildStep * buildStep = factory->create(this, buildStepName);
|
||||
foreach (const QString &buildStepName, buildStepNames) {
|
||||
foreach (IBuildStepFactory *factory, buildStepFactories) {
|
||||
if (factory->canCreate(buildStepName)) {
|
||||
BuildStep *buildStep = factory->create(this, buildStepName);
|
||||
insertBuildStep(pos, buildStep);
|
||||
++pos;
|
||||
break;
|
||||
@@ -307,10 +299,10 @@ void Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
QStringList cleanStepNames = reader.restoreValue("cleansteps").toStringList();
|
||||
// restoring BuildSteps from settings
|
||||
pos = 0;
|
||||
foreach(const QString & cleanStepName, cleanStepNames) {
|
||||
foreach(IBuildStepFactory * factory, buildStepFactories) {
|
||||
if(factory->canCreate(cleanStepName)) {
|
||||
BuildStep * cleanStep = factory->create(this, cleanStepName);
|
||||
foreach (const QString &cleanStepName, cleanStepNames) {
|
||||
foreach (IBuildStepFactory *factory, buildStepFactories) {
|
||||
if (factory->canCreate(cleanStepName)) {
|
||||
BuildStep *cleanStep = factory->create(this, cleanStepName);
|
||||
insertCleanStep(pos, cleanStep);
|
||||
++pos;
|
||||
break;
|
||||
@@ -324,15 +316,15 @@ void Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
|
||||
// restore BuildSteps configuration
|
||||
int buildstepnr = 0;
|
||||
foreach(BuildStep * buildStep, buildSteps()) {
|
||||
foreach (BuildStep *buildStep, buildSteps()) {
|
||||
QMap<QString, QVariant> buildConfiguration = reader.restoreValue("buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
buildStep->setValuesFromMap(buildConfiguration);
|
||||
++buildstepnr;
|
||||
}
|
||||
|
||||
foreach(const QString & buildConfigurationName, buildConfigurationNames) {
|
||||
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
||||
buildstepnr = 0;
|
||||
foreach(BuildStep * buildStep, buildSteps()) {
|
||||
foreach (BuildStep *buildStep, buildSteps()) {
|
||||
//get the buildconfiguration for this build step
|
||||
QMap<QString, QVariant> buildConfiguration =
|
||||
reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-buildstep" + QString().setNum(buildstepnr)).toMap();
|
||||
@@ -343,16 +335,15 @@ void Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
|
||||
// restore CleanSteps configuration
|
||||
int cleanstepnr = 0;
|
||||
foreach(BuildStep * cleanStep, cleanSteps())
|
||||
{
|
||||
foreach (BuildStep *cleanStep, cleanSteps()) {
|
||||
QMap<QString, QVariant> buildConfiguration = reader.restoreValue("cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
cleanStep->setValuesFromMap(buildConfiguration);
|
||||
++cleanstepnr;
|
||||
}
|
||||
|
||||
foreach(const QString & buildConfigurationName, buildConfigurationNames) {
|
||||
foreach (const QString &buildConfigurationName, buildConfigurationNames) {
|
||||
cleanstepnr = 0;
|
||||
foreach(BuildStep * cleanStep, cleanSteps()) {
|
||||
foreach (BuildStep *cleanStep, cleanSteps()) {
|
||||
//get the buildconfiguration for this clean step
|
||||
QMap<QString, QVariant> buildConfiguration =
|
||||
reader.restoreValue("buildconfiguration-" + buildConfigurationName + "-cleanstep" + QString().setNum(cleanstepnr)).toMap();
|
||||
@@ -373,7 +364,7 @@ void Project::restoreSettingsImpl(PersistentSettingsReader &reader)
|
||||
if (!typeVariant.isValid())
|
||||
break;
|
||||
const QString &type = typeVariant.toString();
|
||||
foreach (IRunConfigurationFactory * factory, factories) {
|
||||
foreach (IRunConfigurationFactory *factory, factories) {
|
||||
if (factory->canCreate(type)) {
|
||||
QSharedPointer<RunConfiguration> rc = factory->create(this, type);
|
||||
rc->restore(reader);
|
||||
@@ -403,7 +394,7 @@ QVariant Project::value(const QString &name) const
|
||||
{
|
||||
QMap<QString, QVariant>::const_iterator it =
|
||||
m_values.find(name);
|
||||
if(it != m_values.constEnd())
|
||||
if (it != m_values.constEnd())
|
||||
return it.value();
|
||||
else
|
||||
return QVariant();
|
||||
@@ -420,7 +411,7 @@ BuildConfiguration * Project::getBuildConfiguration(const QString &name) const
|
||||
void Project::setValue(const QString &buildConfiguration, const QString &name, const QVariant &value)
|
||||
{
|
||||
BuildConfiguration *bc = getBuildConfiguration(buildConfiguration);
|
||||
Q_ASSERT(bc);
|
||||
QTC_ASSERT(bc, return);
|
||||
bc->setValue(name, value);
|
||||
}
|
||||
|
||||
@@ -454,13 +445,13 @@ QList<QSharedPointer<RunConfiguration> > Project::runConfigurations() const
|
||||
|
||||
void Project::addRunConfiguration(QSharedPointer<RunConfiguration> runConfiguration)
|
||||
{
|
||||
Q_ASSERT(!m_runConfigurations.contains(runConfiguration));
|
||||
QTC_ASSERT(!m_runConfigurations.contains(runConfiguration), return);
|
||||
m_runConfigurations.push_back(runConfiguration);
|
||||
}
|
||||
|
||||
void Project::removeRunConfiguration(QSharedPointer<RunConfiguration> runConfiguration)
|
||||
{
|
||||
Q_ASSERT(m_runConfigurations.contains(runConfiguration));
|
||||
QTC_ASSERT(m_runConfigurations.contains(runConfiguration), /**/);
|
||||
m_runConfigurations.removeOne(runConfiguration);
|
||||
if (m_activeRunConfiguration == runConfiguration) {
|
||||
if (m_runConfigurations.isEmpty())
|
||||
@@ -479,7 +470,7 @@ void Project::setActiveRunConfiguration(QSharedPointer<RunConfiguration> runConf
|
||||
{
|
||||
if (runConfiguration == m_activeRunConfiguration)
|
||||
return;
|
||||
Q_ASSERT(m_runConfigurations.contains(runConfiguration) || runConfiguration == 0);
|
||||
QTC_ASSERT(m_runConfigurations.contains(runConfiguration) || runConfiguration == 0, return);
|
||||
m_activeRunConfiguration = runConfiguration;
|
||||
emit activeRunConfigurationChanged();
|
||||
}
|
||||
@@ -497,7 +488,7 @@ QString Project::displayNameFor(const QString &buildConfiguration)
|
||||
void Project::setDisplayNameFor(const QString &buildConfiguration, const QString &displayName)
|
||||
{
|
||||
QStringList displayNames;
|
||||
foreach(const QString &bc, buildConfigurations()) {
|
||||
foreach (const QString &bc, buildConfigurations()) {
|
||||
if (bc != buildConfiguration)
|
||||
displayNames << displayNameFor(bc);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user