forked from qt-creator/qt-creator
Merge branch '0.9.1-beta' of git@scm.dev.nokia.troll.no:creator/mainline into 0.9.1-beta
This commit is contained in:
@@ -950,24 +950,23 @@
|
||||
You can start Qt Creator from a command prompt with an existing session or
|
||||
\c{.pro} file by giving the name as argument on the command line.
|
||||
|
||||
\bold{Sidebar}
|
||||
\bold{Show and Hide the Sidebar}
|
||||
|
||||
You can hide/unhide the sidebar in the edit and debug mode
|
||||
by clicking on the corresponding icon on the left bottom.
|
||||
Keyboard shortcut is \key{Alt+0}.
|
||||
You can show and hide the the sidebar in \gui Edit and \gui Debug mode by
|
||||
clicking on the corresponding icon, or by pressing \key{Alt+0}.
|
||||
|
||||
\bold{Display signals and slots}
|
||||
\bold{Display Signals and Slots}
|
||||
|
||||
If you have an instance of a class derived from QObject and
|
||||
want to find all other objects connected to one of its
|
||||
slots by Qt's signals-and-slots mechanism, enable
|
||||
\gui{Debug} and \gui{Use Custom Display for Qt Objects}.
|
||||
In the \gui{Locals and Watchers View}, expand the object's
|
||||
entry and open the wanted slot in the "slots" subitem. The
|
||||
objects connect to this slot are exposed as children of
|
||||
this slot. The same works with signals.
|
||||
If you have an instance of a class that is derived from QObject, and you
|
||||
you would like to find all other objects connected to one of your object's
|
||||
slots using Qt's signals and slots mechanism -- you can enable
|
||||
\gui{Use Custom Display for Qt Objects} feature under the \gui Debug menu.
|
||||
|
||||
\bold{Low level display}
|
||||
In the \gui{Locals and Watchers} view, expand the object's entry and open
|
||||
the slot in the \e slots subitem. The objects connected to this slot are
|
||||
exposed as children of the slot. This method works with signals too.
|
||||
|
||||
\bold{Display Low Level Data}
|
||||
|
||||
If the special debugging of Qt objects fails due to data
|
||||
corruption within the debugged objects, you can switch the
|
||||
@@ -983,33 +982,38 @@
|
||||
|
||||
\title Glossary
|
||||
|
||||
\bold{System Qt}
|
||||
\table
|
||||
\header
|
||||
\o Term
|
||||
\o Meaning
|
||||
|
||||
\target glossary-system-qt
|
||||
The version of Qt installed on your system.
|
||||
This is the one whose \c qmake command is found in the \c PATH.
|
||||
\row
|
||||
\o System Qt \target glossary-system-qt
|
||||
\o The version of Qt installed on your system. This is the Qt
|
||||
version for the \c qmake command found in your \c PATH.
|
||||
|
||||
\bold{Default Qt}
|
||||
\row
|
||||
\o Default Qt \target glossary-default-qt
|
||||
\o The version of Qt configured in \gui{Tools -> Options -> Qt 4
|
||||
-> Default Qt Version}. This is the Qt version used by your
|
||||
new projects. It defaults to System Qt.
|
||||
|
||||
\target glossary-default-qt
|
||||
The version of Qt configured in \gui{Tools
|
||||
-> Options -> Qt 4 -> Default Qt Version}. This is the version
|
||||
used by new projects. It defaults to the System Qt.
|
||||
\row
|
||||
\o Project Qt \target glossary-project-qt
|
||||
\o The version of Qt configured in \gui{Build&Run -> Build
|
||||
Settings -> Build Configurations}. This is the Qt version that
|
||||
is actually used by a particular project. It defaults to
|
||||
Default Qt.
|
||||
|
||||
\bold{Project Qt}
|
||||
|
||||
\target glossary-project-qt
|
||||
The version of Qt configured in \gui{Build&Run
|
||||
-> Build Settings -> Build Configurations}. This is the version
|
||||
actually used by the project. It defaults to the Default Qt.
|
||||
|
||||
\bold{Shadow Build}
|
||||
|
||||
\target glossary-shadow-build
|
||||
Shadow building means building the project not in the source directory,
|
||||
but in a seperate \bold{build directory}. This has the benefit of keeping
|
||||
the source directory clean. It is also considered "best practice" if
|
||||
you need many build configurations for a single set of sources.
|
||||
\row
|
||||
\o Shadow Build \target glossary-shadow-build
|
||||
\o Shadow building means building a project in a separate
|
||||
directory, the \e{build directory}. The build directory is
|
||||
different from the source directory. One of the benefits of
|
||||
shadow building is that it keeps your source directory clean.
|
||||
Shadow building is the best practice if you need many build
|
||||
configurations for a single set of source.
|
||||
\endtable
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@@ -61,11 +61,11 @@ Icons::Icons()
|
||||
{
|
||||
}
|
||||
|
||||
QIcon Icons::iconForSymbol(Symbol *symbol) const
|
||||
QIcon Icons::iconForSymbol(const Symbol *symbol) const
|
||||
{
|
||||
if (symbol->isFunction() || (symbol->isDeclaration() && symbol->type()->isFunction()))
|
||||
{
|
||||
Function *function = symbol->asFunction();
|
||||
const Function *function = symbol->asFunction();
|
||||
if (!function)
|
||||
function = symbol->type()->asFunction();
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class CPLUSPLUS_EXPORT Icons
|
||||
public:
|
||||
Icons();
|
||||
|
||||
QIcon iconForSymbol(Symbol *symbol) const;
|
||||
QIcon iconForSymbol(const Symbol *symbol) const;
|
||||
|
||||
QIcon keywordIcon() const;
|
||||
QIcon macroIcon() const;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
** version 1.2, included in the file GPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef PATHCHOOSER_H
|
||||
#define PATHCHOOSER_H
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QTreeView>
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QStringListModel>
|
||||
|
||||
using namespace CPlusPlus;
|
||||
using namespace CppEditor::Internal;
|
||||
@@ -202,7 +203,9 @@ void CPPEditor::createToolBar(CPPEditorEditable *editable)
|
||||
m_methodCombo->setMaxVisibleItems(20);
|
||||
|
||||
m_overviewModel = new OverviewModel(this);
|
||||
m_methodCombo->setModel(m_overviewModel);
|
||||
m_noSymbolsModel = new QStringListModel(this);
|
||||
m_noSymbolsModel->setStringList(QStringList() << tr("<no symbols>"));
|
||||
m_methodCombo->setModel(m_noSymbolsModel);
|
||||
|
||||
connect(m_methodCombo, SIGNAL(activated(int)), this, SLOT(jumpToMethod(int)));
|
||||
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateMethodBoxIndex()));
|
||||
@@ -315,9 +318,16 @@ void CPPEditor::onDocumentUpdated(Document::Ptr doc)
|
||||
return;
|
||||
|
||||
m_overviewModel->rebuild(doc);
|
||||
if (m_overviewModel->rowCount() > 0) {
|
||||
if (m_methodCombo->model() != m_overviewModel)
|
||||
m_methodCombo->setModel(m_overviewModel);
|
||||
OverviewTreeView *treeView = static_cast<OverviewTreeView *>(m_methodCombo->view());
|
||||
treeView->sync();
|
||||
updateMethodBoxIndex();
|
||||
} else {
|
||||
if (m_methodCombo->model() != m_noSymbolsModel)
|
||||
m_methodCombo->setModel(m_noSymbolsModel);
|
||||
}
|
||||
}
|
||||
|
||||
void CPPEditor::updateFileName()
|
||||
@@ -325,6 +335,8 @@ void CPPEditor::updateFileName()
|
||||
|
||||
void CPPEditor::jumpToMethod(int)
|
||||
{
|
||||
if (m_methodCombo->model() != m_overviewModel)
|
||||
return;
|
||||
QModelIndex index = m_methodCombo->view()->currentIndex();
|
||||
Symbol *symbol = m_overviewModel->symbolFromIndex(index);
|
||||
if (! symbol)
|
||||
@@ -339,12 +351,14 @@ void CPPEditor::jumpToMethod(int)
|
||||
|
||||
void CPPEditor::updateMethodBoxIndex()
|
||||
{
|
||||
if (m_methodCombo->model() != m_overviewModel)
|
||||
return;
|
||||
int line = 0, column = 0;
|
||||
convertPosition(position(), &line, &column);
|
||||
|
||||
QModelIndex lastIndex;
|
||||
|
||||
const int rc = m_overviewModel->rowCount(QModelIndex());
|
||||
const int rc = m_overviewModel->rowCount();
|
||||
for (int row = 0; row < rc; ++row) {
|
||||
const QModelIndex index = m_overviewModel->index(row, 0, QModelIndex());
|
||||
Symbol *symbol = m_overviewModel->symbolFromIndex(index);
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QComboBox;
|
||||
class QStringListModel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
@@ -138,6 +139,7 @@ private:
|
||||
QList<int> m_contexts;
|
||||
QComboBox *m_methodCombo;
|
||||
CPlusPlus::OverviewModel *m_overviewModel;
|
||||
QStringListModel *m_noSymbolsModel;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -42,6 +42,7 @@ CppClassesFilter::CppClassesFilter(CppModelManager *manager, Core::EditorManager
|
||||
setIncludedByDefault(false);
|
||||
|
||||
search.setSymbolsToSearchFor(SearchSymbols::Classes);
|
||||
search.setSeparateScope(true);
|
||||
}
|
||||
|
||||
CppClassesFilter::~CppClassesFilter()
|
||||
|
||||
@@ -683,7 +683,7 @@ void CppModelManager::onDocumentUpdated(Document::Ptr doc)
|
||||
sel.cursor = c;
|
||||
selections.append(sel);
|
||||
}
|
||||
ed->setExtraExtraSelections(selections);
|
||||
ed->setExtraSelections(TextEditor::BaseTextEditor::CodeWarningsSelection, selections);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ using namespace CPlusPlus;
|
||||
using namespace CppTools::Internal;
|
||||
|
||||
SearchSymbols::SearchSymbols():
|
||||
symbolsToSearchFor(Classes | Functions | Enums)
|
||||
symbolsToSearchFor(Classes | Functions | Enums),
|
||||
separateScope(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -49,6 +50,11 @@ void SearchSymbols::setSymbolsToSearchFor(SymbolTypes types)
|
||||
symbolsToSearchFor = types;
|
||||
}
|
||||
|
||||
void SearchSymbols::setSeparateScope(bool separateScope)
|
||||
{
|
||||
this->separateScope = separateScope;
|
||||
}
|
||||
|
||||
QList<ModelItemInfo> SearchSymbols::operator()(Document::Ptr doc, const QString &scope)
|
||||
{
|
||||
QString previousScope = switchScope(scope);
|
||||
@@ -73,13 +79,12 @@ bool SearchSymbols::visit(Enum *symbol)
|
||||
return false;
|
||||
|
||||
QString name = symbolName(symbol);
|
||||
QString previousScope = switchScope(name);
|
||||
QIcon icon = icons.iconForSymbol(symbol);
|
||||
QString scopedName = scopedSymbolName(name);
|
||||
QString previousScope = switchScope(scopedName);
|
||||
appendItem(separateScope ? name : scopedName,
|
||||
separateScope ? previousScope : QString(),
|
||||
ModelItemInfo::Enum, symbol);
|
||||
Scope *members = symbol->members();
|
||||
items.append(ModelItemInfo(name, QString(), ModelItemInfo::Enum,
|
||||
QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()),
|
||||
symbol->line(),
|
||||
icon));
|
||||
for (unsigned i = 0; i < members->symbolCount(); ++i) {
|
||||
accept(members->symbolAt(i));
|
||||
}
|
||||
@@ -93,18 +98,18 @@ bool SearchSymbols::visit(Function *symbol)
|
||||
return false;
|
||||
|
||||
QString name = symbolName(symbol);
|
||||
QString type = overview.prettyType(symbol->type());
|
||||
QIcon icon = icons.iconForSymbol(symbol);
|
||||
items.append(ModelItemInfo(name, type, ModelItemInfo::Method,
|
||||
QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()),
|
||||
symbol->line(),
|
||||
icon));
|
||||
QString scopedName = scopedSymbolName(name);
|
||||
QString type = overview.prettyType(symbol->type(),
|
||||
separateScope ? symbol->name() : 0);
|
||||
appendItem(separateScope ? type : scopedName,
|
||||
separateScope ? _scope : type,
|
||||
ModelItemInfo::Method, symbol);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SearchSymbols::visit(Namespace *symbol)
|
||||
{
|
||||
QString name = symbolName(symbol);
|
||||
QString name = findOrInsert(scopedSymbolName(symbol));
|
||||
QString previousScope = switchScope(name);
|
||||
Scope *members = symbol->members();
|
||||
for (unsigned i = 0; i < members->symbolCount(); ++i) {
|
||||
@@ -118,12 +123,9 @@ bool SearchSymbols::visit(Namespace *symbol)
|
||||
bool SearchSymbols::visit(Declaration *symbol)
|
||||
{
|
||||
if (symbol->type()->isFunction()) {
|
||||
QString name = symbolName(symbol);
|
||||
QString name = scopedSymbolName(symbol);
|
||||
QString type = overview.prettyType(symbol->type());
|
||||
//QIcon icon = ...;
|
||||
items.append(ModelItemInfo(name, type, ModelItemInfo::Method,
|
||||
QString::fromUtf8(symbol->fileName(), symbol->line()),
|
||||
symbol->line()));
|
||||
appendItems(name, type, ModelItemInfo::Method, symbol->fileName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -135,12 +137,11 @@ bool SearchSymbols::visit(Class *symbol)
|
||||
return false;
|
||||
|
||||
QString name = symbolName(symbol);
|
||||
QString previousScope = switchScope(name);
|
||||
QIcon icon = icons.iconForSymbol(symbol);
|
||||
items.append(ModelItemInfo(name, QString(), ModelItemInfo::Class,
|
||||
QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()),
|
||||
symbol->line(),
|
||||
icon));
|
||||
QString scopedName = scopedSymbolName(name);
|
||||
QString previousScope = switchScope(scopedName);
|
||||
appendItem(separateScope ? name : scopedName,
|
||||
separateScope ? previousScope : QString(),
|
||||
ModelItemInfo::Class, symbol);
|
||||
Scope *members = symbol->members();
|
||||
for (unsigned i = 0; i < members->symbolCount(); ++i) {
|
||||
accept(members->symbolAt(i));
|
||||
@@ -149,11 +150,22 @@ bool SearchSymbols::visit(Class *symbol)
|
||||
return false;
|
||||
}
|
||||
|
||||
QString SearchSymbols::symbolName(const Symbol *symbol) const
|
||||
QString SearchSymbols::scopedSymbolName(const QString &symbolName) const
|
||||
{
|
||||
QString name = _scope;
|
||||
if (! name.isEmpty())
|
||||
name += QLatin1String("::");
|
||||
name += symbolName;
|
||||
return name;
|
||||
}
|
||||
|
||||
QString SearchSymbols::scopedSymbolName(const Symbol *symbol) const
|
||||
{
|
||||
return scopedSymbolName(symbolName(symbol));
|
||||
}
|
||||
|
||||
QString SearchSymbols::symbolName(const Symbol *symbol) const
|
||||
{
|
||||
QString symbolName = overview.prettyName(symbol->name());
|
||||
if (symbolName.isEmpty()) {
|
||||
QString type;
|
||||
@@ -176,6 +188,17 @@ QString SearchSymbols::symbolName(const Symbol *symbol) const
|
||||
symbolName += type;
|
||||
symbolName += QLatin1String(">");
|
||||
}
|
||||
name += symbolName;
|
||||
return name;
|
||||
return symbolName;
|
||||
}
|
||||
|
||||
void SearchSymbols::appendItem(const QString &name,
|
||||
const QString &info,
|
||||
ModelItemInfo::ItemType type,
|
||||
const CPlusPlus::Symbol *symbol)
|
||||
{
|
||||
const QIcon icon = icons.iconForSymbol(symbol);
|
||||
items.append(ModelItemInfo(name, info, type,
|
||||
QString::fromUtf8(symbol->fileName(), symbol->fileNameLength()),
|
||||
symbol->line(),
|
||||
icon));
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@ public:
|
||||
SearchSymbols();
|
||||
|
||||
void setSymbolsToSearchFor(SymbolTypes types);
|
||||
void setSeparateScope(bool separateScope);
|
||||
|
||||
QList<ModelItemInfo> operator()(CPlusPlus::Document::Ptr doc)
|
||||
{ return operator()(doc, QString()); }
|
||||
@@ -113,14 +114,27 @@ protected:
|
||||
virtual bool visit(CPlusPlus::Declaration *symbol);
|
||||
#endif
|
||||
virtual bool visit(CPlusPlus::Class *symbol);
|
||||
|
||||
QString scopedSymbolName(const QString &symbolName) const;
|
||||
QString scopedSymbolName(const CPlusPlus::Symbol *symbol) const;
|
||||
QString symbolName(const CPlusPlus::Symbol *symbol) const;
|
||||
void appendItem(const QString &name,
|
||||
const QString &info,
|
||||
ModelItemInfo::ItemType type,
|
||||
const CPlusPlus::Symbol *symbol);
|
||||
|
||||
private:
|
||||
QString findOrInsert(const QString &s)
|
||||
{ return *strings.insert(s); }
|
||||
|
||||
QSet<QString> strings; // Used to avoid QString duplication
|
||||
|
||||
QString _scope;
|
||||
CPlusPlus::Overview overview;
|
||||
CPlusPlus::Icons icons;
|
||||
QList<ModelItemInfo> items;
|
||||
SymbolTypes symbolsToSearchFor;
|
||||
bool separateScope;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(SearchSymbols::SymbolTypes)
|
||||
|
||||
@@ -104,8 +104,9 @@
|
||||
<widget class="QLabel" name="filesLabel">
|
||||
<property name="text">
|
||||
<string>The following files will be added:
|
||||
f1
|
||||
f2
|
||||
|
||||
|
||||
|
||||
</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
|
||||
@@ -61,14 +61,6 @@ void ProFileReader::setQtVersion(QtVersion *qtVersion) {
|
||||
bool ProFileReader::readProFile(const QString &fileName)
|
||||
{
|
||||
//disable caching -> list of include files is not updated otherwise
|
||||
// ProFile *pro = proFileFromCache(fileName);
|
||||
// if (!pro) {
|
||||
// pro = new ProFile(fileName);
|
||||
// if (!queryProFile(pro)) {
|
||||
// delete pro;
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
QString fn = QFileInfo(fileName).filePath();
|
||||
ProFile *pro = new ProFile(fn);
|
||||
if (!queryProFile(pro)) {
|
||||
@@ -82,9 +74,6 @@ bool ProFileReader::readProFile(const QString &fileName)
|
||||
|
||||
ProFile *ProFileReader::parsedProFile(const QString &fileName)
|
||||
{
|
||||
// ProFile *pro = proFileFromCache(fileName);
|
||||
// if (pro)
|
||||
// return pro;
|
||||
QString fn = QFileInfo(fileName).filePath();
|
||||
ProFile *pro = ProFileEvaluator::parsedProFile(fn);
|
||||
if (pro) {
|
||||
@@ -99,16 +88,6 @@ void ProFileReader::releaseParsedProFile(ProFile *)
|
||||
return;
|
||||
}
|
||||
|
||||
ProFile *ProFileReader::proFileFromCache(const QString &fileName) const
|
||||
{
|
||||
|
||||
QString fn = QFileInfo(fileName).filePath();
|
||||
ProFile *pro = 0;
|
||||
if (m_includeFiles.contains(fn))
|
||||
pro = m_includeFiles.value(fn);
|
||||
return pro;
|
||||
}
|
||||
|
||||
QList<ProFile*> ProFileReader::includeFiles() const
|
||||
{
|
||||
QString qmakeMkSpecDir = propertyValue("QMAKE_MKSPECS");
|
||||
@@ -196,3 +175,14 @@ void ProFileReader::errorMessage(const QString &message)
|
||||
{
|
||||
emit errorFound(message);
|
||||
}
|
||||
|
||||
ProFile *ProFileReader::proFileFor(const QString &name)
|
||||
{
|
||||
qDebug()<<"Asking for "<<name;
|
||||
qDebug()<<"in "<<m_includeFiles.keys();
|
||||
QMap<QString, ProFile *>::const_iterator it = m_includeFiles.constFind(name);
|
||||
if (it == m_includeFiles.constEnd())
|
||||
return 0;
|
||||
else
|
||||
return it.value();
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
const QString &baseDirectory,
|
||||
PathValuesMode mode,
|
||||
const ProFile *pro = 0) const;
|
||||
ProFile *proFileFromCache(const QString &fileName) const;
|
||||
ProFile *proFileFor(const QString &name);
|
||||
signals:
|
||||
void errorFound(const QString &error);
|
||||
|
||||
|
||||
@@ -79,35 +79,22 @@ namespace {
|
||||
Implements abstract ProjectNode class
|
||||
*/
|
||||
|
||||
Qt4PriFileNode::Qt4PriFileNode(Qt4Project *project,
|
||||
const QString &filePath)
|
||||
Qt4PriFileNode::Qt4PriFileNode(Qt4Project *project, Qt4ProFileNode* qt4ProFileNode, const QString &filePath)
|
||||
: ProjectNode(filePath),
|
||||
m_core(project->qt4ProjectManager()->core()),
|
||||
m_project(project),
|
||||
m_qt4ProFileNode(qt4ProFileNode),
|
||||
m_projectFilePath(QDir::fromNativeSeparators(filePath)),
|
||||
m_projectDir(QFileInfo(filePath).absolutePath()),
|
||||
m_includeFile(0),
|
||||
m_saveTimer(new QTimer(this)),
|
||||
m_reader(0)
|
||||
m_projectDir(QFileInfo(filePath).absolutePath())
|
||||
{
|
||||
Q_ASSERT(project);
|
||||
setFolderName(QFileInfo(filePath).baseName());
|
||||
setIcon(QIcon(":/qt4projectmanager/images/qt_project.png"));
|
||||
|
||||
// m_saveTimer is used for the delayed saving of the pro file
|
||||
// so that multiple insert/remove calls in one event loop run
|
||||
// trigger just one save call.
|
||||
m_saveTimer->setSingleShot(true);
|
||||
connect(m_saveTimer, SIGNAL(timeout()), this, SLOT(save()));
|
||||
}
|
||||
|
||||
void Qt4PriFileNode::update(ProFile *includeFile, ProFileReader *reader)
|
||||
{
|
||||
Q_ASSERT(includeFile);
|
||||
Q_ASSERT(reader);
|
||||
m_reader = reader;
|
||||
|
||||
m_includeFile = includeFile;
|
||||
|
||||
// add project file node
|
||||
if (m_fileNodes.isEmpty())
|
||||
@@ -175,7 +162,7 @@ void Qt4PriFileNode::update(ProFile *includeFile, ProFileReader *reader)
|
||||
QList<ProjectNode::ProjectAction> Qt4PriFileNode::supportedActions() const
|
||||
{
|
||||
QList<ProjectAction> actions;
|
||||
if (m_includeFile) {
|
||||
|
||||
const FolderNode *folderNode = this;
|
||||
const Qt4ProFileNode *proFileNode;
|
||||
while (!(proFileNode = qobject_cast<const Qt4ProFileNode*>(folderNode)))
|
||||
@@ -193,29 +180,24 @@ QList<ProjectNode::ProjectAction> Qt4PriFileNode::supportedActions() const
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
bool Qt4PriFileNode::addSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
if (!m_includeFile)
|
||||
return false;
|
||||
return changeIncludes(m_includeFile, proFilePaths, AddToProFile);
|
||||
Q_UNUSED(proFilePaths);
|
||||
return false; //changeIncludes(m_includeFile, proFilePaths, AddToProFile);
|
||||
}
|
||||
|
||||
bool Qt4PriFileNode::removeSubProjects(const QStringList &proFilePaths)
|
||||
{
|
||||
if (!m_includeFile)
|
||||
return false;
|
||||
return changeIncludes(m_includeFile, proFilePaths, RemoveFromProFile);
|
||||
Q_UNUSED(proFilePaths);
|
||||
return false; //changeIncludes(m_includeFile, proFilePaths, RemoveFromProFile);
|
||||
}
|
||||
|
||||
bool Qt4PriFileNode::addFiles(const FileType fileType, const QStringList &filePaths,
|
||||
QStringList *notAdded)
|
||||
{
|
||||
if (!m_includeFile)
|
||||
return false;
|
||||
QStringList failedFiles;
|
||||
|
||||
changeFiles(fileType, filePaths, &failedFiles, AddToProFile);
|
||||
@@ -227,8 +209,6 @@ bool Qt4PriFileNode::addFiles(const FileType fileType, const QStringList &filePa
|
||||
bool Qt4PriFileNode::removeFiles(const FileType fileType, const QStringList &filePaths,
|
||||
QStringList *notRemoved)
|
||||
{
|
||||
if (!m_includeFile)
|
||||
return false;
|
||||
QStringList failedFiles;
|
||||
changeFiles(fileType, filePaths, &failedFiles, RemoveFromProFile);
|
||||
if (notRemoved)
|
||||
@@ -239,7 +219,7 @@ bool Qt4PriFileNode::removeFiles(const FileType fileType, const QStringList &fil
|
||||
bool Qt4PriFileNode::renameFile(const FileType fileType, const QString &filePath,
|
||||
const QString &newFilePath)
|
||||
{
|
||||
if (!m_includeFile || newFilePath.isEmpty())
|
||||
if (newFilePath.isEmpty())
|
||||
return false;
|
||||
|
||||
if (!QFile::rename(filePath, newFilePath))
|
||||
@@ -268,18 +248,19 @@ bool Qt4PriFileNode::changeIncludes(ProFile *includeFile, const QStringList &pro
|
||||
bool Qt4PriFileNode::priFileWritable(const QString &path)
|
||||
{
|
||||
const QString dir = QFileInfo(path).dir().path();
|
||||
Core::IVersionControl *versionControl = m_core->vcsManager()->findVersionControlForDirectory(dir);
|
||||
switch (Core::EditorManager::promptReadOnlyFile(path, versionControl, m_core->mainWindow(), false)) {
|
||||
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
|
||||
Core::IVersionControl *versionControl = core->vcsManager()->findVersionControlForDirectory(dir);
|
||||
switch (Core::EditorManager::promptReadOnlyFile(path, versionControl, core->mainWindow(), false)) {
|
||||
case Core::EditorManager::RO_OpenVCS:
|
||||
if (!versionControl->vcsOpen(path)) {
|
||||
QMessageBox::warning(m_core->mainWindow(), tr("Failed!"), tr("Could not open the file for edit with SCC."));
|
||||
QMessageBox::warning(core->mainWindow(), tr("Failed!"), tr("Could not open the file for edit with SCC."));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case Core::EditorManager::RO_MakeWriteable: {
|
||||
const bool permsOk = QFile::setPermissions(path, QFile::permissions(path) | QFile::WriteUser);
|
||||
if (!permsOk) {
|
||||
QMessageBox::warning(m_core->mainWindow(), tr("Failed!"), tr("Could not set permissions to writable."));
|
||||
QMessageBox::warning(core->mainWindow(), tr("Failed!"), tr("Could not set permissions to writable."));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@@ -296,11 +277,13 @@ bool Qt4PriFileNode::saveModifiedEditors(const QString &path)
|
||||
QList<Core::IFile*> allFileHandles;
|
||||
QList<Core::IFile*> modifiedFileHandles;
|
||||
|
||||
foreach (Core::IFile *file, m_core->fileManager()->managedFiles(path)) {
|
||||
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
|
||||
|
||||
foreach (Core::IFile *file, core->fileManager()->managedFiles(path)) {
|
||||
allFileHandles << file;
|
||||
}
|
||||
|
||||
foreach (Core::IEditor *editor, m_core->editorManager()->editorsForFileName(path)) {
|
||||
foreach (Core::IEditor *editor, core->editorManager()->editorsForFileName(path)) {
|
||||
if (Core::IFile *editorFile = editor->file()) {
|
||||
if (editorFile->isModified())
|
||||
modifiedFileHandles << editorFile;
|
||||
@@ -309,7 +292,7 @@ bool Qt4PriFileNode::saveModifiedEditors(const QString &path)
|
||||
|
||||
if (!modifiedFileHandles.isEmpty()) {
|
||||
bool cancelled;
|
||||
m_core->fileManager()->saveModifiedFiles(modifiedFileHandles, &cancelled,
|
||||
core->fileManager()->saveModifiedFiles(modifiedFileHandles, &cancelled,
|
||||
tr("There are unsaved changes for project file %1.").arg(path));
|
||||
if (cancelled)
|
||||
return false;
|
||||
@@ -330,6 +313,18 @@ void Qt4PriFileNode::changeFiles(const FileType fileType,
|
||||
if (filePaths.isEmpty())
|
||||
return;
|
||||
|
||||
ProFileReader *reader = m_qt4ProFileNode->createProFileReader();
|
||||
if (!reader->readProFile(m_qt4ProFileNode->path())) {
|
||||
m_project->proFileParseError(tr("Error while parsing file %1. Giving up.").arg(m_projectFilePath));
|
||||
delete reader;
|
||||
return;
|
||||
}
|
||||
|
||||
ProFile *includeFile = reader->proFileFor(m_projectFilePath);
|
||||
if(!includeFile) {
|
||||
m_project->proFileParseError(tr("Error while changing pro file %1.").arg(m_projectFilePath));
|
||||
}
|
||||
|
||||
*notChanged = filePaths;
|
||||
|
||||
// Check for modified editors
|
||||
@@ -338,7 +333,7 @@ void Qt4PriFileNode::changeFiles(const FileType fileType,
|
||||
|
||||
// Check if file is readonly
|
||||
ProEditorModel proModel;
|
||||
proModel.setProFiles(QList<ProFile*>() << m_includeFile);
|
||||
proModel.setProFiles(QList<ProFile*>() << includeFile);
|
||||
|
||||
const QStringList vars = varNames(fileType);
|
||||
QDir priFileDir = QDir(m_projectDir);
|
||||
@@ -413,26 +408,27 @@ void Qt4PriFileNode::changeFiles(const FileType fileType,
|
||||
}
|
||||
|
||||
// save file
|
||||
if (!m_saveTimer->isActive())
|
||||
m_saveTimer->start();
|
||||
save(includeFile);
|
||||
delete reader;
|
||||
}
|
||||
|
||||
void Qt4PriFileNode::save()
|
||||
void Qt4PriFileNode::save(ProFile *includeFile)
|
||||
{
|
||||
Core::FileManager *fileManager = m_core->fileManager();
|
||||
QList<Core::IFile *> allFileHandles = fileManager->managedFiles(m_includeFile->fileName());
|
||||
Core::ICore *core = ExtensionSystem::PluginManager::instance()->getObject<Core::ICore>();
|
||||
Core::FileManager *fileManager = core->fileManager();
|
||||
QList<Core::IFile *> allFileHandles = fileManager->managedFiles(includeFile->fileName());
|
||||
Core::IFile *modifiedFileHandle = 0;
|
||||
foreach(Core::IFile *file, allFileHandles)
|
||||
if (file->fileName() == m_includeFile->fileName())
|
||||
if (file->fileName() == includeFile->fileName())
|
||||
modifiedFileHandle = file;
|
||||
|
||||
if (modifiedFileHandle)
|
||||
fileManager->blockFileChange(modifiedFileHandle);
|
||||
ProWriter pw;
|
||||
const bool ok = pw.write(m_includeFile, m_includeFile->fileName());
|
||||
const bool ok = pw.write(includeFile, includeFile->fileName());
|
||||
Q_UNUSED(ok)
|
||||
m_includeFile->setModified(false);
|
||||
m_project->qt4ProjectManager()->notifyChanged(m_includeFile->fileName());
|
||||
includeFile->setModified(false);
|
||||
m_project->qt4ProjectManager()->notifyChanged(includeFile->fileName());
|
||||
if (modifiedFileHandle)
|
||||
fileManager->unblockFileChange(modifiedFileHandle);
|
||||
|
||||
@@ -487,12 +483,11 @@ QStringList Qt4PriFileNode::varNames(FileType type)
|
||||
Qt4ProFileNode::Qt4ProFileNode(Qt4Project *project,
|
||||
const QString &filePath,
|
||||
QObject *parent)
|
||||
: Qt4PriFileNode(project, filePath),
|
||||
: Qt4PriFileNode(project, this, filePath),
|
||||
// own stuff
|
||||
m_projectType(InvalidProject),
|
||||
m_isQBuildProject(false),
|
||||
m_dirWatcher(new DirectoryWatcher(this)),
|
||||
m_reader(0)
|
||||
m_dirWatcher(new DirectoryWatcher(this))
|
||||
{
|
||||
if (parent)
|
||||
setParent(parent);
|
||||
@@ -507,7 +502,7 @@ Qt4ProFileNode::Qt4ProFileNode(Qt4Project *project,
|
||||
|
||||
Qt4ProFileNode::~Qt4ProFileNode()
|
||||
{
|
||||
delete m_reader;
|
||||
|
||||
}
|
||||
|
||||
bool Qt4ProFileNode::hasTargets() const
|
||||
@@ -527,11 +522,10 @@ QStringList Qt4ProFileNode::variableValue(const Qt4Variable var) const
|
||||
|
||||
void Qt4ProFileNode::update()
|
||||
{
|
||||
delete m_reader;
|
||||
m_reader = createProFileReader();
|
||||
if (!m_reader->readProFile(m_projectFilePath)) {
|
||||
ProFileReader *reader = createProFileReader();
|
||||
if (!reader->readProFile(m_projectFilePath)) {
|
||||
m_project->proFileParseError(tr("Error while parsing file %1. Giving up.").arg(m_projectFilePath));
|
||||
delete m_reader;
|
||||
delete reader;
|
||||
invalidate();
|
||||
return;
|
||||
}
|
||||
@@ -546,7 +540,7 @@ void Qt4ProFileNode::update()
|
||||
#endif
|
||||
|
||||
Qt4ProjectType projectType = InvalidProject;
|
||||
switch (m_reader->templateType()) {
|
||||
switch (reader->templateType()) {
|
||||
case ProFileEvaluator::TT_Unknown:
|
||||
case ProFileEvaluator::TT_Application: {
|
||||
projectType = ApplicationTemplate;
|
||||
@@ -585,11 +579,11 @@ void Qt4ProFileNode::update()
|
||||
ProFile *fileForCurrentProject = 0;
|
||||
{
|
||||
if (projectType == SubDirsTemplate) {
|
||||
foreach (const QString &subDirProject, subDirsPaths(m_reader))
|
||||
foreach (const QString &subDirProject, subDirsPaths(reader))
|
||||
newProjectFiles << subDirProject;
|
||||
}
|
||||
|
||||
foreach (ProFile *includeFile, m_reader->includeFiles()) {
|
||||
foreach (ProFile *includeFile, reader->includeFiles()) {
|
||||
if (includeFile->fileName() == m_projectFilePath) { // this file
|
||||
fileForCurrentProject = includeFile;
|
||||
} else {
|
||||
@@ -616,9 +610,9 @@ void Qt4ProFileNode::update()
|
||||
} else if ((*existingNodeIter)->path() > *newProjectFileIter) {
|
||||
if (ProFile *file = includeFiles.value(*newProjectFileIter)) {
|
||||
Qt4PriFileNode *priFileNode
|
||||
= new Qt4PriFileNode(m_project,
|
||||
= new Qt4PriFileNode(m_project, this,
|
||||
*newProjectFileIter);
|
||||
priFileNode->update(file, m_reader);
|
||||
priFileNode->update(file, reader);
|
||||
toAdd << priFileNode;
|
||||
} else {
|
||||
toAdd << createSubProFileNode(*newProjectFileIter);
|
||||
@@ -627,7 +621,7 @@ void Qt4ProFileNode::update()
|
||||
} else { // *existingNodeIter->path() == *newProjectFileIter
|
||||
if (ProFile *file = includeFiles.value(*newProjectFileIter)) {
|
||||
Qt4PriFileNode *priFileNode = static_cast<Qt4PriFileNode*>(*existingNodeIter);
|
||||
priFileNode->update(file, m_reader);
|
||||
priFileNode->update(file, reader);
|
||||
}
|
||||
|
||||
++existingNodeIter;
|
||||
@@ -641,9 +635,9 @@ void Qt4ProFileNode::update()
|
||||
while (newProjectFileIter != newProjectFiles.constEnd()) {
|
||||
if (ProFile *file = includeFiles.value(*newProjectFileIter)) {
|
||||
Qt4PriFileNode *priFileNode
|
||||
= new Qt4PriFileNode(m_project,
|
||||
= new Qt4PriFileNode(m_project, this,
|
||||
*newProjectFileIter);
|
||||
priFileNode->update(file, m_reader);
|
||||
priFileNode->update(file, reader);
|
||||
toAdd << priFileNode;
|
||||
} else {
|
||||
toAdd << createSubProFileNode(*newProjectFileIter);
|
||||
@@ -656,15 +650,15 @@ void Qt4ProFileNode::update()
|
||||
if (!toAdd.isEmpty())
|
||||
addProjectNodes(toAdd);
|
||||
|
||||
Qt4PriFileNode::update(fileForCurrentProject, m_reader);
|
||||
Qt4PriFileNode::update(fileForCurrentProject, reader);
|
||||
|
||||
// update other variables
|
||||
QHash<Qt4Variable, QStringList> newVarValues;
|
||||
newVarValues[CxxCompilerVar] << m_reader->value(QLatin1String("QMAKE_CXX"));
|
||||
newVarValues[DefinesVar] = m_reader->values(QLatin1String("DEFINES"));
|
||||
newVarValues[IncludePathVar] = includePaths(m_reader);
|
||||
newVarValues[UiDirVar] = uiDirPaths(m_reader);
|
||||
newVarValues[MocDirVar] = mocDirPaths(m_reader);
|
||||
newVarValues[CxxCompilerVar] << reader->value(QLatin1String("QMAKE_CXX"));
|
||||
newVarValues[DefinesVar] = reader->values(QLatin1String("DEFINES"));
|
||||
newVarValues[IncludePathVar] = includePaths(reader);
|
||||
newVarValues[UiDirVar] = uiDirPaths(reader);
|
||||
newVarValues[MocDirVar] = mocDirPaths(reader);
|
||||
|
||||
if (m_varValues != newVarValues) {
|
||||
m_varValues = newVarValues;
|
||||
@@ -678,12 +672,14 @@ void Qt4ProFileNode::update()
|
||||
foreach (NodesWatcher *watcher, watchers())
|
||||
if (Qt4NodesWatcher *qt4Watcher = qobject_cast<Qt4NodesWatcher*>(watcher))
|
||||
emit qt4Watcher->proFileUpdated(this);
|
||||
|
||||
delete reader;
|
||||
}
|
||||
|
||||
void Qt4ProFileNode::fileChanged(const QString &filePath)
|
||||
{
|
||||
CppTools::CppModelManagerInterface *modelManager =
|
||||
m_core->pluginManager()->getObject<CppTools::CppModelManagerInterface>();
|
||||
ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
|
||||
|
||||
modelManager->updateSourceFiles(QStringList() << filePath);
|
||||
}
|
||||
@@ -789,7 +785,7 @@ void Qt4ProFileNode::updateGeneratedFiles()
|
||||
}
|
||||
}
|
||||
|
||||
ProFileReader *Qt4ProFileNode::createProFileReader() const
|
||||
ProFileReader *Qt4PriFileNode::createProFileReader() const
|
||||
{
|
||||
ProFileReader *reader = new ProFileReader();
|
||||
connect(reader, SIGNAL(errorFound(const QString &)),
|
||||
@@ -801,7 +797,7 @@ ProFileReader *Qt4ProFileNode::createProFileReader() const
|
||||
}
|
||||
|
||||
QHash<QString,QStringList> variables;
|
||||
variables.insert(QLatin1String("OUT_PWD"), QStringList(buildDir()));
|
||||
variables.insert(QLatin1String("OUT_PWD"), QStringList(m_qt4ProFileNode->buildDir()));
|
||||
reader->addVariables(variables);
|
||||
|
||||
return reader;
|
||||
@@ -916,7 +912,7 @@ QStringList Qt4ProFileNode::qBuildSubDirsPaths(const QString &scanDir) const
|
||||
return subProjectPaths;
|
||||
}
|
||||
|
||||
QString Qt4ProFileNode::buildDir() const
|
||||
QString Qt4PriFileNode::buildDir() const
|
||||
{
|
||||
const QDir srcDirRoot = QFileInfo(m_project->rootProjectNode()->path()).absoluteDir();
|
||||
const QString relativeDir = srcDirRoot.relativeFilePath(m_projectDir);
|
||||
@@ -951,11 +947,6 @@ void Qt4ProFileNode::invalidate()
|
||||
}
|
||||
|
||||
|
||||
ProFile *Qt4ProFileNode::proFileFromCache(const QString &fileName)
|
||||
{
|
||||
return m_reader->proFileFromCache(fileName);
|
||||
}
|
||||
|
||||
Qt4NodesWatcher::Qt4NodesWatcher(QObject *parent)
|
||||
: NodesWatcher(parent)
|
||||
{
|
||||
|
||||
@@ -102,8 +102,7 @@ class Qt4PriFileNode : public ProjectExplorer::ProjectNode {
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(Qt4PriFileNode)
|
||||
public:
|
||||
Qt4PriFileNode(Qt4Project *project,
|
||||
const QString &filePath);
|
||||
Qt4PriFileNode(Qt4Project *project, Qt4ProFileNode* qt4ProFileNode, const QString &filePath);
|
||||
|
||||
void update(ProFile *includeFile, ProFileReader *reader);
|
||||
|
||||
@@ -122,9 +121,6 @@ public:
|
||||
bool renameFile(const FileType fileType,
|
||||
const QString &filePath, const QString &newFilePath);
|
||||
|
||||
private slots:
|
||||
void save();
|
||||
|
||||
protected:
|
||||
void clear();
|
||||
static QStringList varNames(FileType type);
|
||||
@@ -143,17 +139,19 @@ protected:
|
||||
QStringList *notChanged,
|
||||
ChangeType change);
|
||||
|
||||
QString buildDir() const;
|
||||
ProFileReader *createProFileReader() const;
|
||||
|
||||
private:
|
||||
void save(ProFile *includeFile);
|
||||
bool priFileWritable(const QString &path);
|
||||
bool saveModifiedEditors(const QString &path);
|
||||
|
||||
Core::ICore *m_core;
|
||||
Qt4Project *m_project;
|
||||
Qt4ProFileNode *m_qt4ProFileNode;
|
||||
QString m_projectFilePath;
|
||||
QString m_projectDir;
|
||||
ProFile *m_includeFile;
|
||||
QTimer *m_saveTimer;
|
||||
ProFileReader *m_reader;
|
||||
|
||||
// managed by Qt4ProFileNode
|
||||
friend class Qt4ProFileNode;
|
||||
@@ -174,7 +172,6 @@ public:
|
||||
Qt4ProjectType projectType() const;
|
||||
|
||||
QStringList variableValue(const Qt4Variable var) const;
|
||||
ProFile *proFileFromCache(const QString &fileName);
|
||||
|
||||
public slots:
|
||||
void update();
|
||||
@@ -185,7 +182,6 @@ private slots:
|
||||
private:
|
||||
void updateGeneratedFiles();
|
||||
|
||||
ProFileReader *createProFileReader() const;
|
||||
Qt4ProFileNode *createSubProFileNode(const QString &path);
|
||||
|
||||
QStringList uiDirPaths(ProFileReader *reader) const;
|
||||
@@ -194,7 +190,7 @@ private:
|
||||
QStringList subDirsPaths(ProFileReader *reader) const;
|
||||
QStringList qBuildSubDirsPaths(const QString &scanDir) const;
|
||||
|
||||
QString buildDir() const;
|
||||
|
||||
|
||||
void invalidate();
|
||||
|
||||
@@ -203,7 +199,6 @@ private:
|
||||
bool m_isQBuildProject;
|
||||
|
||||
DirectoryWatcher *m_dirWatcher;
|
||||
ProFileReader *m_reader;
|
||||
|
||||
friend class Qt4NodeHierarchy;
|
||||
};
|
||||
|
||||
@@ -179,12 +179,8 @@ Qt4ProjectFile::Qt4ProjectFile(Qt4Project *project, const QString &filePath, QOb
|
||||
|
||||
bool Qt4ProjectFile::save(const QString &)
|
||||
{
|
||||
ProFile *file = m_project->proFileFromCache(m_filePath);
|
||||
ProWriter pw;
|
||||
bool ok = pw.write(file, file->fileName());
|
||||
file->setModified(false);
|
||||
m_project->qt4ProjectManager()->notifyChanged(file->fileName());
|
||||
return ok;
|
||||
// This is never used
|
||||
return false;
|
||||
}
|
||||
|
||||
QString Qt4ProjectFile::fileName() const
|
||||
@@ -209,7 +205,7 @@ QString Qt4ProjectFile::mimeType() const
|
||||
|
||||
bool Qt4ProjectFile::isModified() const
|
||||
{
|
||||
return m_project->proFileFromCache(m_filePath)->isModified();
|
||||
return false; // we save after changing anyway
|
||||
}
|
||||
|
||||
bool Qt4ProjectFile::isReadOnly() const
|
||||
@@ -895,16 +891,24 @@ MakeStep *Qt4Project::makeStep() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
ProFile *Qt4Project::proFileFromCache(const QString &fileName)
|
||||
bool Qt4Project::hasSubNode(Qt4PriFileNode *root, const QString &path)
|
||||
{
|
||||
return rootProjectNode()->proFileFromCache(fileName);
|
||||
if (root->path() == path)
|
||||
return true;
|
||||
foreach (FolderNode *fn, root->subFolderNodes()) {
|
||||
if (qobject_cast<Qt4ProFileNode *>(fn)) {
|
||||
// we aren't interested in pro file nodes
|
||||
} else if(Qt4PriFileNode *qt4prifilenode = qobject_cast<Qt4PriFileNode *>(fn)) {
|
||||
if (hasSubNode(qt4prifilenode, path))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Qt4Project::findProFile(const QString& fileName, Qt4ProFileNode *root, QList<Qt4ProFileNode *> &list)
|
||||
{
|
||||
if (root->path() == fileName)
|
||||
list.append(root);
|
||||
else if (root->proFileFromCache(fileName))
|
||||
if (hasSubNode(root, fileName))
|
||||
list.append(root);
|
||||
|
||||
foreach (FolderNode *fn, root->subFolderNodes())
|
||||
@@ -914,9 +918,10 @@ void Qt4Project::findProFile(const QString& fileName, Qt4ProFileNode *root, QLis
|
||||
|
||||
void Qt4Project::notifyChanged(const QString &name)
|
||||
{
|
||||
if (files(Qt4Project::ExcludeGeneratedFiles).contains(name)) {
|
||||
QList<Qt4ProFileNode *> list;
|
||||
findProFile(name, rootProjectNode(), list);
|
||||
foreach(Qt4ProFileNode *node, list)
|
||||
node->update();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,7 +180,6 @@ public:
|
||||
QMakeStep *qmakeStep() const;
|
||||
MakeStep *makeStep() const;
|
||||
|
||||
ProFile *proFileFromCache(const QString &fileName);
|
||||
void notifyChanged(const QString &name);
|
||||
|
||||
public slots:
|
||||
@@ -209,6 +208,7 @@ protected:
|
||||
private:
|
||||
static void collectApplicationProFiles(QList<Internal::Qt4ProFileNode *> &list, Internal::Qt4ProFileNode *node);
|
||||
static void findProFile(const QString& fileName, Internal::Qt4ProFileNode *root, QList<Internal::Qt4ProFileNode *> &list);
|
||||
static bool hasSubNode(Internal::Qt4PriFileNode *root, const QString &path);
|
||||
|
||||
QList<Internal::Qt4ProFileNode *> m_applicationProFileChange;
|
||||
ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const;
|
||||
|
||||
@@ -963,7 +963,7 @@ void QtVersion::updateVersionInfo() const
|
||||
QString line = stream.readLine();
|
||||
int index = line.indexOf(":");
|
||||
if (index != -1)
|
||||
m_versionInfo.insert(line.left(index), line.mid(index+1));
|
||||
m_versionInfo.insert(line.left(index), QDir::fromNativeSeparators(line.mid(index+1)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1035,6 +1035,7 @@ void QtVersion::updateMkSpec() const
|
||||
mkspec = mkspec.mid(QString("$$QT_BUILD_TREE/mkspecs/").length());
|
||||
else if (mkspec.startsWith("$$QT_BUILD_TREE\\mkspecs\\"))
|
||||
mkspec = mkspec.mid(QString("$$QT_BUILD_TREE\\mkspecs\\").length());
|
||||
mkspec = QDir::fromNativeSeparators(mkspec);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1100,7 +1101,8 @@ void QtVersion::updateMkSpec() const
|
||||
int index = mkspec.lastIndexOf('/');
|
||||
if(index == -1)
|
||||
index = mkspec.lastIndexOf('\\');
|
||||
if (index >= 0 && QDir(mkspec.left(index)).canonicalPath() == QDir(m_path + "/mkspecs/").canonicalPath())
|
||||
QString mkspecDir = QDir(m_path + "/mkspecs/").canonicalPath();
|
||||
if (index >= 0 && QDir(mkspec.left(index)).canonicalPath() == mkspecDir)
|
||||
mkspec = mkspec.mid(index+1).trimmed();
|
||||
|
||||
m_mkspec = mkspec;
|
||||
@@ -1112,7 +1114,7 @@ QString QtVersion::makeCommand() const
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
const QString &spec = mkspec();
|
||||
if (spec.startsWith("win32-msvc") || spec == QLatin1String("win32-icc"))
|
||||
if (spec.contains("win32-msvc") || spec.contains(QLatin1String("win32-icc")))
|
||||
return "nmake.exe";
|
||||
else if(spec.startsWith("wince"))
|
||||
return "nmake.exe";
|
||||
@@ -1149,7 +1151,7 @@ QtVersion::ToolchainType QtVersion::toolchainType() const
|
||||
if (!isValid())
|
||||
return INVALID;
|
||||
const QString &spec = mkspec();
|
||||
if(spec.startsWith("win32-msvc") || spec == QLatin1String("win32-icc"))
|
||||
if(spec.contains("win32-msvc") || spec.contains(QLatin1String("win32-icc")))
|
||||
return MSVC;
|
||||
else if(spec == "win32-g++")
|
||||
return MinGW;
|
||||
|
||||
@@ -2477,6 +2477,9 @@ void BaseTextEditor::extraAreaMouseEvent(QMouseEvent *e)
|
||||
void BaseTextEditor::slotCursorPositionChanged()
|
||||
{
|
||||
QList<QTextEdit::ExtraSelection> extraSelections;
|
||||
setExtraSelections(ParenthesesMatchingSelection, extraSelections); // clear
|
||||
if (d->m_parenthesesMatchingEnabled)
|
||||
d->m_parenthesesMatchingTimer->start(50);
|
||||
|
||||
if (d->m_highlightCurrentLine) {
|
||||
QTextEdit::ExtraSelection sel;
|
||||
@@ -2487,11 +2490,7 @@ void BaseTextEditor::slotCursorPositionChanged()
|
||||
extraSelections.append(sel);
|
||||
}
|
||||
|
||||
if (d->m_parenthesesMatchingEnabled)
|
||||
d->m_parenthesesMatchingTimer->start(50);
|
||||
|
||||
d->m_extraSelections = extraSelections;
|
||||
setExtraSelections(d->m_extraSelections + d->m_extraExtraSelections);
|
||||
setExtraSelections(CurrentLineSelection, extraSelections);
|
||||
}
|
||||
|
||||
QTextBlock TextBlockUserData::testCollapse(const QTextBlock& block)
|
||||
@@ -3133,7 +3132,7 @@ void BaseTextEditor::_q_matchParentheses()
|
||||
if (backwardMatchType == TextBlockUserData::NoMatch && forwardMatchType == TextBlockUserData::NoMatch)
|
||||
return;
|
||||
|
||||
QList<QTextEdit::ExtraSelection> extraSelections = d->m_extraSelections;
|
||||
QList<QTextEdit::ExtraSelection> extraSelections;
|
||||
|
||||
if (backwardMatch.hasSelection()) {
|
||||
QTextEdit::ExtraSelection sel;
|
||||
@@ -3186,8 +3185,7 @@ void BaseTextEditor::_q_matchParentheses()
|
||||
}
|
||||
extraSelections.append(sel);
|
||||
}
|
||||
d->m_extraSelections = extraSelections;
|
||||
setExtraSelections(d->m_extraSelections + d->m_extraExtraSelections);
|
||||
setExtraSelections(ParenthesesMatchingSelection, extraSelections);
|
||||
}
|
||||
|
||||
void BaseTextEditor::setActionHack(QObject *hack)
|
||||
@@ -3234,15 +3232,21 @@ void BaseTextEditor::deleteLine()
|
||||
cut();
|
||||
}
|
||||
|
||||
void BaseTextEditor::setExtraExtraSelections(const QList<QTextEdit::ExtraSelection> &selections)
|
||||
void BaseTextEditor::setExtraSelections(ExtraSelectionKind kind, const QList<QTextEdit::ExtraSelection> &selections)
|
||||
{
|
||||
d->m_extraExtraSelections = selections;
|
||||
setExtraSelections(d->m_extraSelections + d->m_extraExtraSelections);
|
||||
if (selections.isEmpty() && d->m_extraSelections[kind].isEmpty())
|
||||
return;
|
||||
d->m_extraSelections[kind] = selections;
|
||||
|
||||
QList<QTextEdit::ExtraSelection> all;
|
||||
for (int i = 0; i < NExtraSelectionKinds; ++i)
|
||||
all += d->m_extraSelections[i];
|
||||
QPlainTextEdit::setExtraSelections(all);
|
||||
}
|
||||
|
||||
QList<QTextEdit::ExtraSelection> BaseTextEditor::extraExtraSelections() const
|
||||
QList<QTextEdit::ExtraSelection> BaseTextEditor::extraSelections(ExtraSelectionKind kind) const
|
||||
{
|
||||
return d->m_extraExtraSelections;
|
||||
return d->m_extraSelections[kind];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -369,7 +369,6 @@ private:
|
||||
Internal::BaseTextEditorPrivate *d;
|
||||
friend class Internal::BaseTextEditorPrivate;
|
||||
|
||||
|
||||
public:
|
||||
QWidget *extraArea() const;
|
||||
virtual int extraAreaWidth(int *markWidthPtr = 0) const;
|
||||
@@ -385,8 +384,16 @@ public:
|
||||
|
||||
void ensureCursorVisible();
|
||||
|
||||
void setExtraExtraSelections(const QList<QTextEdit::ExtraSelection> &selections);
|
||||
QList<QTextEdit::ExtraSelection> extraExtraSelections() const;
|
||||
enum ExtraSelectionKind {
|
||||
CurrentLineSelection,
|
||||
ParenthesesMatchingSelection,
|
||||
CodeWarningsSelection,
|
||||
CodeSemanticsSelection,
|
||||
OtherSelection,
|
||||
NExtraSelectionKinds
|
||||
};
|
||||
void setExtraSelections(ExtraSelectionKind kind, const QList<QTextEdit::ExtraSelection> &selections);
|
||||
QList<QTextEdit::ExtraSelection> extraSelections(ExtraSelectionKind kind) const;
|
||||
|
||||
struct BlockRange {
|
||||
BlockRange():first(0), last(-1){}
|
||||
|
||||
@@ -204,8 +204,7 @@ public:
|
||||
|
||||
QObject *m_actionHack;
|
||||
|
||||
QList<QTextEdit::ExtraSelection> m_extraSelections;
|
||||
QList<QTextEdit::ExtraSelection> m_extraExtraSelections;
|
||||
QList<QTextEdit::ExtraSelection> m_extraSelections[BaseTextEditor::NExtraSelectionKinds];
|
||||
|
||||
// block selection mode
|
||||
bool m_inBlockSelectionMode;
|
||||
|
||||
@@ -225,24 +225,13 @@ void VCSBaseEditor::mouseMoveEvent(QMouseEvent *e)
|
||||
sel.format.setFontUnderline(true);
|
||||
change = changeUnderCursor(cursor);
|
||||
sel.format.setProperty(QTextFormat::UserProperty, change);
|
||||
bool found = false;
|
||||
foreach (QTextEdit::ExtraSelection es, extraSelections()) {
|
||||
if (es.format.stringProperty(QTextFormat::UserProperty) == sel.format.stringProperty(QTextFormat::UserProperty)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
setExtraSelections(QList<QTextEdit::ExtraSelection>() << sel);
|
||||
setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>() << sel);
|
||||
viewport()->setCursor(Qt::PointingHandCursor);
|
||||
}
|
||||
} else {
|
||||
if (!extraSelections().isEmpty()) {
|
||||
setExtraSelections(QList<QTextEdit::ExtraSelection>());
|
||||
setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>());
|
||||
viewport()->setCursor(Qt::IBeamCursor);
|
||||
}
|
||||
}
|
||||
}
|
||||
TextEditor::BaseTextEditor::mouseMoveEvent(e);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user