forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/3.1'
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -33,6 +33,7 @@ Thumbs.db
|
|||||||
*.rc
|
*.rc
|
||||||
*.embed.manifest
|
*.embed.manifest
|
||||||
/.qmake.cache
|
/.qmake.cache
|
||||||
|
/.qmake.stash
|
||||||
|
|
||||||
# qtcreator generated files
|
# qtcreator generated files
|
||||||
*.pro.user*
|
*.pro.user*
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ exists(src/shared/qbs/qbs.pro) {
|
|||||||
system("echo QBS_LIB_INSTALL_DIR = $${QTC_PREFIX}/$${IDE_LIBRARY_BASENAME}/qtcreator >> $$qmake_cache")
|
system("echo QBS_LIB_INSTALL_DIR = $${QTC_PREFIX}/$${IDE_LIBRARY_BASENAME}/qtcreator >> $$qmake_cache")
|
||||||
system("echo QBS_RESOURCES_BUILD_DIR = $${maybe_backslash}\"$${IDE_DATA_PATH}/qbs$${maybe_backslash}\" >> $$qmake_cache")
|
system("echo QBS_RESOURCES_BUILD_DIR = $${maybe_backslash}\"$${IDE_DATA_PATH}/qbs$${maybe_backslash}\" >> $$qmake_cache")
|
||||||
system("echo QBS_RESOURCES_INSTALL_DIR = $${QTC_PREFIX}/share/qtcreator/qbs >> $$qmake_cache")
|
system("echo QBS_RESOURCES_INSTALL_DIR = $${QTC_PREFIX}/share/qtcreator/qbs >> $$qmake_cache")
|
||||||
|
system("echo QBS_PLUGINS_BUILD_DIR = $${maybe_backslash}\"$${IDE_BUILD_TREE}/lib/qtcreator/$${maybe_backslash}\" >> $$qmake_cache")
|
||||||
|
system("echo QBS_PLUGINS_INSTALL_DIR = $${QTC_PREFIX}/lib/qtcreator >> $$qmake_cache")
|
||||||
system("echo CONFIG += qbs_no_dev_install >> $$qmake_cache")
|
system("echo CONFIG += qbs_no_dev_install >> $$qmake_cache")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -833,47 +833,54 @@ class Dumper(DumperBase):
|
|||||||
def extractByte(self, addr):
|
def extractByte(self, addr):
|
||||||
return struct.unpack("b", self.readRawMemory(addr, 1))[0]
|
return struct.unpack("b", self.readRawMemory(addr, 1))[0]
|
||||||
|
|
||||||
def extractStaticMetaObjectHelper(self, typeobj):
|
|
||||||
|
def extractStaticMetaObjectHelper(self, typeName):
|
||||||
"""
|
"""
|
||||||
Checks whether type has a Q_OBJECT macro.
|
Checks whether type has a Q_OBJECT macro.
|
||||||
Returns the staticMetaObject, or 0.
|
Returns the staticMetaObject, or 0.
|
||||||
"""
|
"""
|
||||||
|
# No templates for now.
|
||||||
|
if typeName.find('<') >= 0:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
staticMetaObjectName = typeName + "::staticMetaObject"
|
||||||
|
if hasattr(gdb, 'lookup_global_symbol'):
|
||||||
|
result = gdb.lookup_global_symbol(staticMetaObjectName)
|
||||||
|
result = result.value() if result else 0
|
||||||
|
else:
|
||||||
|
# Older GDB...
|
||||||
|
try:
|
||||||
|
result = gdb.parse_and_eval(staticMetaObjectName)
|
||||||
|
except:
|
||||||
|
result = 0
|
||||||
|
|
||||||
|
# We need to distinguish Q_OBJECT from Q_GADGET:
|
||||||
|
# a Q_OBJECT SMO has a non-null superdata (unless it's QObject itself),
|
||||||
|
# a Q_GADGET SMO has a null superdata (hopefully)
|
||||||
|
if result and typeName != self.qtNamespace() + "QObject":
|
||||||
|
if not self.extractPointer(result):
|
||||||
|
# This looks like a Q_GADGET
|
||||||
|
result = 0
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
def extractStaticMetaObject(self, typeobj):
|
||||||
|
"""
|
||||||
|
Checks recursively whether a type derives from QObject.
|
||||||
|
"""
|
||||||
typeName = str(typeobj)
|
typeName = str(typeobj)
|
||||||
result = self.knownStaticMetaObjects.get(typeName, None)
|
result = self.knownStaticMetaObjects.get(typeName, None)
|
||||||
if result is not None: # Is 0 or the static metaobject.
|
if result is not None: # Is 0 or the static metaobject.
|
||||||
return result
|
return result
|
||||||
|
|
||||||
staticMetaObjectName = typeName + "::staticMetaObject"
|
result = self.extractStaticMetaObjectHelper(typeName)
|
||||||
try:
|
if not result:
|
||||||
result = gdb.lookup_global_symbol(staticMetaObjectName)
|
|
||||||
result = result.value() if result else 0
|
|
||||||
self.knownStaticMetaObjects[typeName] = result
|
|
||||||
return result
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Older GDB...
|
|
||||||
try:
|
|
||||||
result = gdb.parse_and_eval(staticMetaObjectName)
|
|
||||||
self.knownStaticMetaObjects[typeName] = result
|
|
||||||
return result
|
|
||||||
except:
|
|
||||||
self.knownStaticMetaObjects[typeName] = 0
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def extractStaticMetaObject(self, typeobj):
|
|
||||||
"""
|
|
||||||
Checks recursively whether a type derives from QObject.
|
|
||||||
"""
|
|
||||||
result = self.extractStaticMetaObjectHelper(typeobj)
|
|
||||||
if result:
|
|
||||||
return result
|
|
||||||
fields = typeobj.fields()
|
fields = typeobj.fields()
|
||||||
if not len(fields):
|
if len(fields) and fields[0].is_base_class:
|
||||||
return 0
|
result = self.extractStaticMetaObject(fields[0].type)
|
||||||
if not fields[0].is_base_class:
|
|
||||||
return 0
|
self.knownStaticMetaObjects[typeName] = result
|
||||||
return self.extractStaticMetaObject(fields[0].type)
|
return result
|
||||||
|
|
||||||
|
|
||||||
def put(self, value):
|
def put(self, value):
|
||||||
|
|||||||
@@ -1824,6 +1824,9 @@ def qdump__QTextDocument(d, value):
|
|||||||
d.putCallItem("toPlainText", value, "toPlainText")
|
d.putCallItem("toPlainText", value, "toPlainText")
|
||||||
|
|
||||||
|
|
||||||
|
def qform__QUrl():
|
||||||
|
return "Inline,Separate Window"
|
||||||
|
|
||||||
def qdump__QUrl(d, value):
|
def qdump__QUrl(d, value):
|
||||||
if d.qtVersion() < 0x050000:
|
if d.qtVersion() < 0x050000:
|
||||||
privAddress = d.extractPointer(value)
|
privAddress = d.extractPointer(value)
|
||||||
@@ -1884,6 +1887,14 @@ def qdump__QUrl(d, value):
|
|||||||
url += ''.join(["%02x00" % ord(c) for c in str(port)])
|
url += ''.join(["%02x00" % ord(c) for c in str(port)])
|
||||||
url += path
|
url += path
|
||||||
d.putValue(url, Hex4EncodedLittleEndian)
|
d.putValue(url, Hex4EncodedLittleEndian)
|
||||||
|
|
||||||
|
format = d.currentItemFormat()
|
||||||
|
if format == 1:
|
||||||
|
d.putDisplay(StopDisplay)
|
||||||
|
elif format == 2:
|
||||||
|
d.putField("editformat", DisplayUtf16String)
|
||||||
|
d.putField("editvalue", url)
|
||||||
|
|
||||||
d.putNumChild(8)
|
d.putNumChild(8)
|
||||||
if d.isExpanded():
|
if d.isExpanded():
|
||||||
stringType = d.lookupType(d.qtNamespace() + "QString")
|
stringType = d.lookupType(d.qtNamespace() + "QString")
|
||||||
|
|||||||
@@ -1951,10 +1951,19 @@ void Preprocessor::handleUndefDirective(PPToken *tk)
|
|||||||
lex(tk); // consume "undef" token
|
lex(tk); // consume "undef" token
|
||||||
if (tk->is(T_IDENTIFIER)) {
|
if (tk->is(T_IDENTIFIER)) {
|
||||||
const ByteArrayRef macroName = tk->asByteArrayRef();
|
const ByteArrayRef macroName = tk->asByteArrayRef();
|
||||||
const Macro *macro = m_env->remove(macroName);
|
const unsigned offset = tk->offset + m_state.m_offsetRef;
|
||||||
|
// Track macro use if previously defined
|
||||||
|
if (m_client) {
|
||||||
|
if (const Macro *existingMacro = m_env->resolve(macroName))
|
||||||
|
m_client->notifyMacroReference(offset, tk->lineno, *existingMacro);
|
||||||
|
}
|
||||||
|
synchronizeOutputLines(*tk);
|
||||||
|
Macro *macro = m_env->remove(macroName);
|
||||||
|
|
||||||
if (m_client && macro)
|
if (m_client && macro) {
|
||||||
|
macro->setOffset(offset);
|
||||||
m_client->macroAdded(*macro);
|
m_client->macroAdded(*macro);
|
||||||
|
}
|
||||||
lex(tk); // consume macro name
|
lex(tk); // consume macro name
|
||||||
#ifndef NO_DEBUG
|
#ifndef NO_DEBUG
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -198,6 +198,9 @@ QStringList createClangOptions(const ProjectPart::Ptr &pPart, ProjectFile::Kind
|
|||||||
result << QLatin1String("-fmacro-backtrace-limit=0");
|
result << QLatin1String("-fmacro-backtrace-limit=0");
|
||||||
result << QLatin1String("-fretain-comments-from-system-headers");
|
result << QLatin1String("-fretain-comments-from-system-headers");
|
||||||
|
|
||||||
|
if (!pPart->projectConfigFile.isEmpty())
|
||||||
|
result << QLatin1String("-include") << pPart->projectConfigFile;
|
||||||
|
|
||||||
result << buildDefines(pPart->toolchainDefines, false);
|
result << buildDefines(pPart->toolchainDefines, false);
|
||||||
result << buildDefines(pPart->projectDefines, false);
|
result << buildDefines(pPart->projectDefines, false);
|
||||||
|
|
||||||
|
|||||||
@@ -349,7 +349,22 @@ bool CMakeProject::parseCMakeLists()
|
|||||||
|
|
||||||
// This explicitly adds -I. to the include paths
|
// This explicitly adds -I. to the include paths
|
||||||
part->includePaths += projectDirectory();
|
part->includePaths += projectDirectory();
|
||||||
part->includePaths += cbpparser.includeFiles();
|
|
||||||
|
foreach (const QString &includeFile, cbpparser.includeFiles()) {
|
||||||
|
// CodeBlocks is utterly ignorant of frameworks on Mac, and won't report framework
|
||||||
|
// paths. The work-around is to check if the include path ends in ".framework", and
|
||||||
|
// if so, add the parent directory as framework path.
|
||||||
|
if (includeFile.endsWith(QLatin1String(".framework"))) {
|
||||||
|
const int slashIdx = includeFile.lastIndexOf(QLatin1Char('/'));
|
||||||
|
if (slashIdx != -1) {
|
||||||
|
part->frameworkPaths += includeFile.left(slashIdx);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
part->includePaths += includeFile;
|
||||||
|
}
|
||||||
|
|
||||||
part->projectDefines += cbpparser.defines();
|
part->projectDefines += cbpparser.defines();
|
||||||
|
|
||||||
CppTools::ProjectFileAdder adder(part->files);
|
CppTools::ProjectFileAdder adder(part->files);
|
||||||
|
|||||||
@@ -283,7 +283,6 @@ Command *ActionManager::registerShortcut(QShortcut *shortcut, Id id, const Conte
|
|||||||
} else {
|
} else {
|
||||||
sc = new Shortcut(id);
|
sc = new Shortcut(id);
|
||||||
d->m_idCmdMap.insert(id, sc);
|
d->m_idCmdMap.insert(id, sc);
|
||||||
d->readUserSettings(id, sc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sc->shortcut()) {
|
if (sc->shortcut()) {
|
||||||
@@ -299,6 +298,7 @@ Command *ActionManager::registerShortcut(QShortcut *shortcut, Id id, const Conte
|
|||||||
sc->setShortcut(shortcut);
|
sc->setShortcut(shortcut);
|
||||||
sc->setScriptable(scriptable);
|
sc->setScriptable(scriptable);
|
||||||
sc->setContext(context);
|
sc->setContext(context);
|
||||||
|
d->readUserSettings(id, sc);
|
||||||
|
|
||||||
emit m_instance->commandListChanged();
|
emit m_instance->commandListChanged();
|
||||||
emit m_instance->commandAdded(id.toString());
|
emit m_instance->commandAdded(id.toString());
|
||||||
|
|||||||
@@ -200,6 +200,8 @@ void ShortcutSettings::resetTargetIdentifier()
|
|||||||
if (current && current->data(0, Qt::UserRole).isValid()) {
|
if (current && current->data(0, Qt::UserRole).isValid()) {
|
||||||
ShortcutItem *scitem = qvariant_cast<ShortcutItem *>(current->data(0, Qt::UserRole));
|
ShortcutItem *scitem = qvariant_cast<ShortcutItem *>(current->data(0, Qt::UserRole));
|
||||||
setKeySequence(scitem->m_cmd->defaultKeySequence());
|
setKeySequence(scitem->m_cmd->defaultKeySequence());
|
||||||
|
foreach (ShortcutItem *item, m_scitems)
|
||||||
|
markCollisions(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -351,9 +351,9 @@ void MainWindow::extensionsInitialized()
|
|||||||
|
|
||||||
emit m_coreImpl->coreAboutToOpen();
|
emit m_coreImpl->coreAboutToOpen();
|
||||||
show();
|
show();
|
||||||
emit m_coreImpl->coreOpened();
|
|
||||||
// Delay restoreWindowState, since it is overridden by LayoutRequest event
|
// Delay restoreWindowState, since it is overridden by LayoutRequest event
|
||||||
QTimer::singleShot(0, this, SLOT(restoreWindowState()));
|
QTimer::singleShot(0, this, SLOT(restoreWindowState()));
|
||||||
|
QTimer::singleShot(0, m_coreImpl, SIGNAL(coreOpened()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::closeEvent(QCloseEvent *event)
|
void MainWindow::closeEvent(QCloseEvent *event)
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ static QString getUserFilePath(const QString &proposalFileName)
|
|||||||
static QString idFromDisplayName(const QString &displayName)
|
static QString idFromDisplayName(const QString &displayName)
|
||||||
{
|
{
|
||||||
QString id = displayName;
|
QString id = displayName;
|
||||||
|
id.remove(QRegExp(QLatin1String("&(?!&)")));
|
||||||
QChar *c = id.data();
|
QChar *c = id.data();
|
||||||
while (!c->isNull()) {
|
while (!c->isNull()) {
|
||||||
if (!c->isLetterOrNumber())
|
if (!c->isLetterOrNumber())
|
||||||
|
|||||||
@@ -560,8 +560,10 @@ void CppCodeModelInspectorDumper::dumpProjectInfos(
|
|||||||
projectName = project->displayName();
|
projectName = project->displayName();
|
||||||
projectFilePath = project->projectFilePath();
|
projectFilePath = project->projectFilePath();
|
||||||
}
|
}
|
||||||
|
if (!part->projectConfigFile.isEmpty())
|
||||||
|
m_out << i3 << "Project Config File: " << part->projectConfigFile << "\n";
|
||||||
m_out << i2 << "Project Part \"" << part->projectFile << "\"{{{3\n";
|
m_out << i2 << "Project Part \"" << part->projectFile << "\"{{{3\n";
|
||||||
m_out << i3 << "Project Part Name: " << part->displayName << "\n";
|
m_out << i3 << "Project Part Name : " << part->displayName << "\n";
|
||||||
m_out << i3 << "Project Name : " << projectName << "\n";
|
m_out << i3 << "Project Name : " << projectName << "\n";
|
||||||
m_out << i3 << "Project File : " << projectFilePath << "\n";
|
m_out << i3 << "Project File : " << projectFilePath << "\n";
|
||||||
m_out << i3 << "C Version : " << toString(part->cVersion) << "\n";
|
m_out << i3 << "C Version : " << toString(part->cVersion) << "\n";
|
||||||
@@ -2246,6 +2248,9 @@ void CppCodeModelInspectorDialog::updateProjectPartData(const ProjectPart::Ptr &
|
|||||||
<< qMakePair(QString::fromLatin1("CXX Extensions"), toString(part->cxxExtensions))
|
<< qMakePair(QString::fromLatin1("CXX Extensions"), toString(part->cxxExtensions))
|
||||||
<< qMakePair(QString::fromLatin1("Qt Version"), toString(part->qtVersion))
|
<< qMakePair(QString::fromLatin1("Qt Version"), toString(part->qtVersion))
|
||||||
;
|
;
|
||||||
|
if (!part->projectConfigFile.isEmpty())
|
||||||
|
table.prepend(qMakePair(QString::fromLatin1("Project Config File"),
|
||||||
|
part->projectConfigFile));
|
||||||
m_partGenericInfoModel->configure(table);
|
m_partGenericInfoModel->configure(table);
|
||||||
resizeColumns<KeyValueModel>(m_ui->partGeneralView);
|
resizeColumns<KeyValueModel>(m_ui->partGeneralView);
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,8 @@
|
|||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(QList<QByteArray>)
|
||||||
|
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
using namespace CppEditor::Internal;
|
using namespace CppEditor::Internal;
|
||||||
using namespace CppTools;
|
using namespace CppTools;
|
||||||
|
|||||||
@@ -179,6 +179,9 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block)
|
|||||||
|
|
||||||
case declaration_start:
|
case declaration_start:
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
|
case T_CLASS:
|
||||||
|
case T_STRUCT: turnInto(class_start); continue;
|
||||||
|
case T_ENUM: turnInto(enum_start); continue;
|
||||||
case T_RBRACE: leave(true); continue;
|
case T_RBRACE: leave(true); continue;
|
||||||
case T_SEMICOLON: leave(true); break;
|
case T_SEMICOLON: leave(true); break;
|
||||||
case T_EQUAL: enter(assign_open_or_initializer); break;
|
case T_EQUAL: enter(assign_open_or_initializer); break;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace CppTools {
|
|||||||
uint qHash(const ProjectPart &p)
|
uint qHash(const ProjectPart &p)
|
||||||
{
|
{
|
||||||
uint h = qHash(p.toolchainDefines) ^ qHash(p.projectDefines) ^ p.cVersion ^ p.cxxVersion
|
uint h = qHash(p.toolchainDefines) ^ qHash(p.projectDefines) ^ p.cVersion ^ p.cxxVersion
|
||||||
^ p.cxxExtensions ^ p.qtVersion;
|
^ p.cxxExtensions ^ p.qtVersion ^ qHash(p.projectConfigFile);
|
||||||
|
|
||||||
foreach (const QString &i, p.includePaths)
|
foreach (const QString &i, p.includePaths)
|
||||||
h ^= qHash(i);
|
h ^= qHash(i);
|
||||||
@@ -83,6 +83,8 @@ bool operator==(const ProjectPart &p1,
|
|||||||
return false;
|
return false;
|
||||||
if (p1.projectDefines != p2.projectDefines)
|
if (p1.projectDefines != p2.projectDefines)
|
||||||
return false;
|
return false;
|
||||||
|
if (p1.projectConfigFile != p2.projectConfigFile)
|
||||||
|
return false;
|
||||||
if (p1.cVersion != p2.cVersion)
|
if (p1.cVersion != p2.cVersion)
|
||||||
return false;
|
return false;
|
||||||
if (p1.cxxVersion != p2.cxxVersion)
|
if (p1.cxxVersion != p2.cxxVersion)
|
||||||
@@ -393,6 +395,8 @@ QByteArray CppModelManager::internalDefinedMacros() const
|
|||||||
foreach (const ProjectPart::Ptr &part, pinfo.projectParts()) {
|
foreach (const ProjectPart::Ptr &part, pinfo.projectParts()) {
|
||||||
addUnique(part->toolchainDefines.split('\n'), ¯os, &alreadyIn);
|
addUnique(part->toolchainDefines.split('\n'), ¯os, &alreadyIn);
|
||||||
addUnique(part->projectDefines.split('\n'), ¯os, &alreadyIn);
|
addUnique(part->projectDefines.split('\n'), ¯os, &alreadyIn);
|
||||||
|
if (!part->projectConfigFile.isEmpty())
|
||||||
|
macros += readProjectConfigFile(part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return macros;
|
return macros;
|
||||||
@@ -434,6 +438,7 @@ void CppModelManager::dumpModelManagerConfiguration()
|
|||||||
qDebug() << "cxxVersion:" << cxxVersion;
|
qDebug() << "cxxVersion:" << cxxVersion;
|
||||||
qDebug() << "cxxExtensions:" << cxxExtensions;
|
qDebug() << "cxxExtensions:" << cxxExtensions;
|
||||||
qDebug() << "Qt version:" << part->qtVersion;
|
qDebug() << "Qt version:" << part->qtVersion;
|
||||||
|
qDebug() << "project config file:" << part->projectConfigFile;
|
||||||
qDebug() << "precompiled header:" << part->precompiledHeaders;
|
qDebug() << "precompiled header:" << part->precompiledHeaders;
|
||||||
qDebug() << "toolchain defines:" << part->toolchainDefines;
|
qDebug() << "toolchain defines:" << part->toolchainDefines;
|
||||||
qDebug() << "project defines:" << part->projectDefines;
|
qDebug() << "project defines:" << part->projectDefines;
|
||||||
|
|||||||
@@ -223,4 +223,24 @@ void CppModelManagerInterface::ProjectInfo::appendProjectPart(const ProjectPart:
|
|||||||
m_defines.append('\n');
|
m_defines.append('\n');
|
||||||
m_defines.append(part->toolchainDefines);
|
m_defines.append(part->toolchainDefines);
|
||||||
m_defines.append(part->projectDefines);
|
m_defines.append(part->projectDefines);
|
||||||
|
if (!part->projectConfigFile.isEmpty()) {
|
||||||
|
m_defines.append('\n');
|
||||||
|
m_defines += readProjectConfigFile(part);
|
||||||
|
m_defines.append('\n');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QByteArray CppModelManagerInterface::readProjectConfigFile(const ProjectPart::Ptr &part)
|
||||||
|
{
|
||||||
|
QByteArray result;
|
||||||
|
|
||||||
|
QFile f(part->projectConfigFile);
|
||||||
|
if (f.open(QIODevice::ReadOnly)) {
|
||||||
|
QTextStream is(&f);
|
||||||
|
result = is.readAll().toUtf8();
|
||||||
|
f.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ public:
|
|||||||
QString projectFile;
|
QString projectFile;
|
||||||
ProjectExplorer::Project *project;
|
ProjectExplorer::Project *project;
|
||||||
QList<ProjectFile> files;
|
QList<ProjectFile> files;
|
||||||
|
QString projectConfigFile; // currently only used by the Generic Project Manager
|
||||||
QByteArray projectDefines;
|
QByteArray projectDefines;
|
||||||
QByteArray toolchainDefines;
|
QByteArray toolchainDefines;
|
||||||
QStringList includePaths;
|
QStringList includePaths;
|
||||||
@@ -290,6 +291,9 @@ public slots:
|
|||||||
|
|
||||||
virtual void updateModifiedSourceFiles() = 0;
|
virtual void updateModifiedSourceFiles() = 0;
|
||||||
virtual void GC() = 0;
|
virtual void GC() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static QByteArray readProjectConfigFile(const ProjectPart::Ptr &part);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CppTools
|
} // namespace CppTools
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy)
|
|||||||
QStringList includePaths;
|
QStringList includePaths;
|
||||||
QStringList frameworkPaths;
|
QStringList frameworkPaths;
|
||||||
QStringList precompiledHeaders;
|
QStringList precompiledHeaders;
|
||||||
|
QString projectConfigFile;
|
||||||
|
|
||||||
updateProjectPart();
|
updateProjectPart();
|
||||||
|
|
||||||
@@ -73,6 +74,7 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy)
|
|||||||
configFile += m_projectPart->projectDefines;
|
configFile += m_projectPart->projectDefines;
|
||||||
includePaths = m_projectPart->includePaths;
|
includePaths = m_projectPart->includePaths;
|
||||||
frameworkPaths = m_projectPart->frameworkPaths;
|
frameworkPaths = m_projectPart->frameworkPaths;
|
||||||
|
projectConfigFile = m_projectPart->projectConfigFile;
|
||||||
if (m_usePrecompiledHeaders)
|
if (m_usePrecompiledHeaders)
|
||||||
precompiledHeaders = m_projectPart->precompiledHeaders;
|
precompiledHeaders = m_projectPart->precompiledHeaders;
|
||||||
}
|
}
|
||||||
@@ -99,6 +101,11 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy)
|
|||||||
invalidateSnapshot = true;
|
invalidateSnapshot = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (projectConfigFile != m_projectConfigFile) {
|
||||||
|
m_projectConfigFile = projectConfigFile;
|
||||||
|
invalidateSnapshot = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (precompiledHeaders != m_precompiledHeaders) {
|
if (precompiledHeaders != m_precompiledHeaders) {
|
||||||
m_precompiledHeaders = precompiledHeaders;
|
m_precompiledHeaders = precompiledHeaders;
|
||||||
invalidateSnapshot = true;
|
invalidateSnapshot = true;
|
||||||
@@ -160,6 +167,8 @@ void SnapshotUpdater::update(CppModelManager::WorkingCopy workingCopy)
|
|||||||
preproc.setIncludePaths(m_includePaths);
|
preproc.setIncludePaths(m_includePaths);
|
||||||
preproc.setFrameworkPaths(m_frameworkPaths);
|
preproc.setFrameworkPaths(m_frameworkPaths);
|
||||||
preproc.run(configurationFileName);
|
preproc.run(configurationFileName);
|
||||||
|
if (!m_projectConfigFile.isEmpty())
|
||||||
|
preproc.run(m_projectConfigFile);
|
||||||
if (m_usePrecompiledHeaders) {
|
if (m_usePrecompiledHeaders) {
|
||||||
foreach (const QString &precompiledHeader, m_precompiledHeaders)
|
foreach (const QString &precompiledHeader, m_precompiledHeaders)
|
||||||
preproc.run(precompiledHeader);
|
preproc.run(precompiledHeader);
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ private:
|
|||||||
QByteArray m_editorDefines;
|
QByteArray m_editorDefines;
|
||||||
QStringList m_includePaths;
|
QStringList m_includePaths;
|
||||||
QStringList m_frameworkPaths;
|
QStringList m_frameworkPaths;
|
||||||
|
QString m_projectConfigFile;
|
||||||
QStringList m_precompiledHeaders;
|
QStringList m_precompiledHeaders;
|
||||||
CPlusPlus::Snapshot m_snapshot;
|
CPlusPlus::Snapshot m_snapshot;
|
||||||
CPlusPlus::DependencyTable m_deps;
|
CPlusPlus::DependencyTable m_deps;
|
||||||
|
|||||||
@@ -138,9 +138,9 @@ QString DiffEditorPlugin::getFileContents(const QString &fileName) const
|
|||||||
|
|
||||||
#include "sidebysidediffeditorwidget.h"
|
#include "sidebysidediffeditorwidget.h"
|
||||||
|
|
||||||
void DiffEditor::Internal::DiffEditorPlugin::testAssemblyRows()
|
void DiffEditor::Internal::DiffEditorPlugin::testFixPositions()
|
||||||
{
|
{
|
||||||
SideBySideDiffEditorWidget::testAssemblyRows();
|
SideBySideDiffEditorWidget::testFixPositions();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // WITH_TESTS
|
#endif // WITH_TESTS
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ private slots:
|
|||||||
void diff();
|
void diff();
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
void testAssemblyRows();
|
void testFixPositions();
|
||||||
#endif // WITH_TESTS
|
#endif // WITH_TESTS
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -73,22 +73,23 @@ public:
|
|||||||
Separator,
|
Separator,
|
||||||
Invalid
|
Invalid
|
||||||
};
|
};
|
||||||
TextLineData() : textLineType(Invalid), changed(true) {}
|
TextLineData() : textLineType(Invalid) {}
|
||||||
TextLineData(const QString &txt) : textLineType(TextLine), text(txt), changed(true) {}
|
TextLineData(const QString &txt) : textLineType(TextLine), text(txt) {}
|
||||||
TextLineData(TextLineType t) : textLineType(t), changed(true) {}
|
TextLineData(TextLineType t) : textLineType(t) {}
|
||||||
TextLineType textLineType;
|
TextLineType textLineType;
|
||||||
QString text;
|
QString text;
|
||||||
bool changed; // true if anything was changed in this line (inserted or removed), taking whitespaces into account
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RowData {
|
class RowData {
|
||||||
public:
|
public:
|
||||||
|
RowData() : equal(false) {}
|
||||||
RowData(const TextLineData &l)
|
RowData(const TextLineData &l)
|
||||||
: leftLine(l), rightLine(l) {}
|
: leftLine(l), rightLine(l), equal(true) {}
|
||||||
RowData(const TextLineData &l, const TextLineData &r)
|
RowData(const TextLineData &l, const TextLineData &r)
|
||||||
: leftLine(l), rightLine(r) {}
|
: leftLine(l), rightLine(r), equal(false) {}
|
||||||
TextLineData leftLine;
|
TextLineData leftLine;
|
||||||
TextLineData rightLine;
|
TextLineData rightLine;
|
||||||
|
bool equal;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ChunkData {
|
class ChunkData {
|
||||||
@@ -96,6 +97,7 @@ public:
|
|||||||
ChunkData() : contextChunk(false) {}
|
ChunkData() : contextChunk(false) {}
|
||||||
QList<RowData> rows;
|
QList<RowData> rows;
|
||||||
bool contextChunk;
|
bool contextChunk;
|
||||||
|
// start position, end position, TextLineData::Separator lines not taken into account
|
||||||
QMap<int, int> changedLeftPositions; // counting from the beginning of the chunk
|
QMap<int, int> changedLeftPositions; // counting from the beginning of the chunk
|
||||||
QMap<int, int> changedRightPositions; // counting from the beginning of the chunk
|
QMap<int, int> changedRightPositions; // counting from the beginning of the chunk
|
||||||
};
|
};
|
||||||
@@ -112,52 +114,16 @@ public:
|
|||||||
//////////////////////
|
//////////////////////
|
||||||
|
|
||||||
static QList<TextLineData> assemblyRows(const QStringList &lines,
|
static QList<TextLineData> assemblyRows(const QStringList &lines,
|
||||||
const QMap<int, int> &lineSpans,
|
const QMap<int, int> &lineSpans)
|
||||||
const QMap<int, bool> &equalLines,
|
|
||||||
const QMap<int, int> &changedPositions,
|
|
||||||
QMap<int, int> *outputChangedPositions)
|
|
||||||
{
|
{
|
||||||
QList<TextLineData> data;
|
QList<TextLineData> data;
|
||||||
|
|
||||||
int previousSpanOffset = 0;
|
|
||||||
int spanOffset = 0;
|
|
||||||
int pos = 0;
|
|
||||||
bool usePreviousSpanOffsetForStartPosition = false;
|
|
||||||
QMap<int, int>::ConstIterator changedIt = changedPositions.constBegin();
|
|
||||||
QMap<int, int>::ConstIterator changedEnd = changedPositions.constEnd();
|
|
||||||
const int lineCount = lines.count();
|
const int lineCount = lines.count();
|
||||||
for (int i = 0; i <= lineCount; i++) {
|
for (int i = 0; i <= lineCount; i++) {
|
||||||
for (int j = 0; j < lineSpans.value(i); j++) {
|
for (int j = 0; j < lineSpans.value(i); j++)
|
||||||
data.append(TextLineData(TextLineData::Separator));
|
data.append(TextLineData(TextLineData::Separator));
|
||||||
spanOffset++;
|
if (i < lineCount)
|
||||||
}
|
|
||||||
if (i < lineCount) {
|
|
||||||
const int textLength = lines.at(i).count() + 1;
|
|
||||||
pos += textLength;
|
|
||||||
data.append(lines.at(i));
|
data.append(lines.at(i));
|
||||||
if (equalLines.contains(i))
|
|
||||||
data.last().changed = false;
|
|
||||||
}
|
|
||||||
while (changedIt != changedEnd) {
|
|
||||||
if (changedIt.key() >= pos)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if (changedIt.value() >= pos) {
|
|
||||||
usePreviousSpanOffsetForStartPosition = true;
|
|
||||||
previousSpanOffset = spanOffset;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const int startSpanOffset = usePreviousSpanOffsetForStartPosition
|
|
||||||
? previousSpanOffset : spanOffset;
|
|
||||||
usePreviousSpanOffsetForStartPosition = false;
|
|
||||||
|
|
||||||
const int startPos = changedIt.key() + startSpanOffset;
|
|
||||||
const int endPos = changedIt.value() + spanOffset;
|
|
||||||
if (outputChangedPositions)
|
|
||||||
outputChangedPositions->insert(startPos, endPos);
|
|
||||||
++changedIt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -223,15 +189,11 @@ static ChunkData calculateOriginalData(const QList<Diff> &leftDiffList,
|
|||||||
QStringList leftLines;
|
QStringList leftLines;
|
||||||
QStringList rightLines;
|
QStringList rightLines;
|
||||||
|
|
||||||
// <start position, end position>
|
|
||||||
QMap<int, int> leftChangedPositions;
|
|
||||||
QMap<int, int> rightChangedPositions;
|
|
||||||
// <line number, span count>
|
// <line number, span count>
|
||||||
QMap<int, int> leftSpans;
|
QMap<int, int> leftSpans;
|
||||||
QMap<int, int> rightSpans;
|
QMap<int, int> rightSpans;
|
||||||
// <line number, dummy>
|
// <left line number, right line number>
|
||||||
QMap<int, bool> leftEqualLines;
|
QMap<int, int> equalLines;
|
||||||
QMap<int, bool> rightEqualLines;
|
|
||||||
|
|
||||||
int leftLineNumber = 0;
|
int leftLineNumber = 0;
|
||||||
int rightLineNumber = 0;
|
int rightLineNumber = 0;
|
||||||
@@ -251,13 +213,13 @@ static ChunkData calculateOriginalData(const QList<Diff> &leftDiffList,
|
|||||||
|
|
||||||
if (leftDiff.command == Diff::Delete) {
|
if (leftDiff.command == Diff::Delete) {
|
||||||
// process delete
|
// process delete
|
||||||
handleDifference(leftDiff.text, &leftLines, &leftChangedPositions, &leftLineNumber, &leftCharNumber);
|
handleDifference(leftDiff.text, &leftLines, &chunkData.changedLeftPositions, &leftLineNumber, &leftCharNumber);
|
||||||
lastLineEqual = lastLinesEqual(leftLines, rightLines);
|
lastLineEqual = lastLinesEqual(leftLines, rightLines);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (rightDiff.command == Diff::Insert) {
|
if (rightDiff.command == Diff::Insert) {
|
||||||
// process insert
|
// process insert
|
||||||
handleDifference(rightDiff.text, &rightLines, &rightChangedPositions, &rightLineNumber, &rightCharNumber);
|
handleDifference(rightDiff.text, &rightLines, &chunkData.changedRightPositions, &rightLineNumber, &rightCharNumber);
|
||||||
lastLineEqual = lastLinesEqual(leftLines, rightLines);
|
lastLineEqual = lastLinesEqual(leftLines, rightLines);
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
@@ -310,16 +272,12 @@ static ChunkData calculateOriginalData(const QList<Diff> &leftDiffList,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if lines are equal
|
// check if lines are equal
|
||||||
if (line < newLeftLines.count() - 1 || i == leftDiffList.count()) {
|
if ((line < commonLineCount - 1) // before the last common line in equality
|
||||||
// left line is equal
|
|| (line == commonLineCount - 1 // or the last common line in equality
|
||||||
|
&& i == leftDiffList.count() // and it's the last iteration
|
||||||
|
&& j == rightDiffList.count())) {
|
||||||
if (line > 0 || lastLineEqual)
|
if (line > 0 || lastLineEqual)
|
||||||
leftEqualLines.insert(leftLineNumber, true);
|
equalLines.insert(leftLineNumber, rightLineNumber);
|
||||||
}
|
|
||||||
|
|
||||||
if (line < newRightLines.count() - 1 || j == rightDiffList.count()) {
|
|
||||||
// right line is equal
|
|
||||||
if (line > 0 || lastLineEqual)
|
|
||||||
rightEqualLines.insert(rightLineNumber, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line > 0)
|
if (line > 0)
|
||||||
@@ -333,15 +291,9 @@ static ChunkData calculateOriginalData(const QList<Diff> &leftDiffList,
|
|||||||
}
|
}
|
||||||
|
|
||||||
QList<TextLineData> leftData = assemblyRows(leftLines,
|
QList<TextLineData> leftData = assemblyRows(leftLines,
|
||||||
leftSpans,
|
leftSpans);
|
||||||
leftEqualLines,
|
|
||||||
leftChangedPositions,
|
|
||||||
&chunkData.changedLeftPositions);
|
|
||||||
QList<TextLineData> rightData = assemblyRows(rightLines,
|
QList<TextLineData> rightData = assemblyRows(rightLines,
|
||||||
rightSpans,
|
rightSpans);
|
||||||
rightEqualLines,
|
|
||||||
rightChangedPositions,
|
|
||||||
&chunkData.changedRightPositions);
|
|
||||||
|
|
||||||
// fill ending separators
|
// fill ending separators
|
||||||
for (int i = leftData.count(); i < rightData.count(); i++)
|
for (int i = leftData.count(); i < rightData.count(); i++)
|
||||||
@@ -350,8 +302,22 @@ static ChunkData calculateOriginalData(const QList<Diff> &leftDiffList,
|
|||||||
rightData.append(TextLineData(TextLineData::Separator));
|
rightData.append(TextLineData(TextLineData::Separator));
|
||||||
|
|
||||||
const int visualLineCount = leftData.count();
|
const int visualLineCount = leftData.count();
|
||||||
for (int i = 0; i < visualLineCount; i++)
|
int leftLine = -1;
|
||||||
chunkData.rows.append(RowData(leftData.at(i), rightData.at(i)));
|
int rightLine = -1;
|
||||||
|
for (int i = 0; i < visualLineCount; i++) {
|
||||||
|
const TextLineData &leftTextLine = leftData.at(i);
|
||||||
|
const TextLineData &rightTextLine = rightData.at(i);
|
||||||
|
RowData row(leftTextLine, rightTextLine);
|
||||||
|
|
||||||
|
if (leftTextLine.textLineType == TextLineData::TextLine)
|
||||||
|
++leftLine;
|
||||||
|
if (rightTextLine.textLineType == TextLineData::TextLine)
|
||||||
|
++rightLine;
|
||||||
|
if (equalLines.value(leftLine, -1) == rightLine)
|
||||||
|
row.equal = true;
|
||||||
|
|
||||||
|
chunkData.rows.append(row);
|
||||||
|
}
|
||||||
return chunkData;
|
return chunkData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1194,13 +1160,13 @@ FileData SideBySideDiffEditorWidget::calculateContextData(const ChunkData &origi
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < originalData.rows.count()) {
|
while (i < originalData.rows.count()) {
|
||||||
const RowData &row = originalData.rows[i];
|
const RowData &row = originalData.rows[i];
|
||||||
if (!row.leftLine.changed && !row.rightLine.changed) {
|
if (row.equal) {
|
||||||
// count how many equal
|
// count how many equal
|
||||||
int equalRowStart = i;
|
int equalRowStart = i;
|
||||||
i++;
|
i++;
|
||||||
while (i < originalData.rows.count()) {
|
while (i < originalData.rows.count()) {
|
||||||
const RowData originalRow = originalData.rows.at(i);
|
const RowData originalRow = originalData.rows.at(i);
|
||||||
if (originalRow.leftLine.changed || originalRow.rightLine.changed)
|
if (!originalRow.equal)
|
||||||
break;
|
break;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -1225,6 +1191,8 @@ FileData SideBySideDiffEditorWidget::calculateContextData(const ChunkData &origi
|
|||||||
int rightCharCounter = 0;
|
int rightCharCounter = 0;
|
||||||
QMap<int, int>::ConstIterator leftChangedIt = originalData.changedLeftPositions.constBegin();
|
QMap<int, int>::ConstIterator leftChangedIt = originalData.changedLeftPositions.constBegin();
|
||||||
QMap<int, int>::ConstIterator rightChangedIt = originalData.changedRightPositions.constBegin();
|
QMap<int, int>::ConstIterator rightChangedIt = originalData.changedRightPositions.constBegin();
|
||||||
|
const QMap<int, int>::ConstIterator leftChangedItEnd = originalData.changedLeftPositions.constEnd();
|
||||||
|
const QMap<int, int>::ConstIterator rightChangedItEnd = originalData.changedRightPositions.constEnd();
|
||||||
while (i < originalData.rows.count()) {
|
while (i < originalData.rows.count()) {
|
||||||
if (!hiddenRows.contains(i)) {
|
if (!hiddenRows.contains(i)) {
|
||||||
ChunkData chunkData;
|
ChunkData chunkData;
|
||||||
@@ -1237,11 +1205,13 @@ FileData SideBySideDiffEditorWidget::calculateContextData(const ChunkData &origi
|
|||||||
RowData rowData = originalData.rows.at(i);
|
RowData rowData = originalData.rows.at(i);
|
||||||
chunkData.rows.append(rowData);
|
chunkData.rows.append(rowData);
|
||||||
|
|
||||||
|
if (rowData.leftLine.textLineType == TextLineData::TextLine)
|
||||||
leftCharCounter += rowData.leftLine.text.count() + 1; // +1 for '\n'
|
leftCharCounter += rowData.leftLine.text.count() + 1; // +1 for '\n'
|
||||||
|
if (rowData.rightLine.textLineType == TextLineData::TextLine)
|
||||||
rightCharCounter += rowData.rightLine.text.count() + 1; // +1 for '\n'
|
rightCharCounter += rowData.rightLine.text.count() + 1; // +1 for '\n'
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
while (leftChangedIt != originalData.changedLeftPositions.constEnd()) {
|
while (leftChangedIt != leftChangedItEnd) {
|
||||||
if (leftChangedIt.key() < leftOffset
|
if (leftChangedIt.key() < leftOffset
|
||||||
|| leftChangedIt.key() > leftCharCounter)
|
|| leftChangedIt.key() > leftCharCounter)
|
||||||
break;
|
break;
|
||||||
@@ -1251,7 +1221,7 @@ FileData SideBySideDiffEditorWidget::calculateContextData(const ChunkData &origi
|
|||||||
chunkData.changedLeftPositions.insert(startPos - leftOffset, endPos - leftOffset);
|
chunkData.changedLeftPositions.insert(startPos - leftOffset, endPos - leftOffset);
|
||||||
leftChangedIt++;
|
leftChangedIt++;
|
||||||
}
|
}
|
||||||
while (rightChangedIt != originalData.changedRightPositions.constEnd()) {
|
while (rightChangedIt != rightChangedItEnd) {
|
||||||
if (rightChangedIt.key() < rightOffset
|
if (rightChangedIt.key() < rightOffset
|
||||||
|| rightChangedIt.key() > rightCharCounter)
|
|| rightChangedIt.key() > rightCharCounter)
|
||||||
break;
|
break;
|
||||||
@@ -1271,7 +1241,9 @@ FileData SideBySideDiffEditorWidget::calculateContextData(const ChunkData &origi
|
|||||||
RowData rowData = originalData.rows.at(i);
|
RowData rowData = originalData.rows.at(i);
|
||||||
chunkData.rows.append(rowData);
|
chunkData.rows.append(rowData);
|
||||||
|
|
||||||
|
if (rowData.leftLine.textLineType == TextLineData::TextLine)
|
||||||
leftCharCounter += rowData.leftLine.text.count() + 1; // +1 for '\n'
|
leftCharCounter += rowData.leftLine.text.count() + 1; // +1 for '\n'
|
||||||
|
if (rowData.rightLine.textLineType == TextLineData::TextLine)
|
||||||
rightCharCounter += rowData.rightLine.text.count() + 1; // +1 for '\n'
|
rightCharCounter += rowData.rightLine.text.count() + 1; // +1 for '\n'
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -1441,6 +1413,86 @@ QList<QTextEdit::ExtraSelection> SideBySideDiffEditorWidget::colorPositions(
|
|||||||
return lineSelections;
|
return lineSelections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fixPositions(QMap<int, int>::ConstIterator *it,
|
||||||
|
const QMap<int, int>::ConstIterator &itEnd,
|
||||||
|
int fileOffset,
|
||||||
|
int charCounter,
|
||||||
|
int spanCounter,
|
||||||
|
int *lastSpanCounter,
|
||||||
|
QMap<int, int> *changedPositions)
|
||||||
|
{
|
||||||
|
while (*it != itEnd) {
|
||||||
|
if (it->key() >= charCounter)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (it->value() >= charCounter) {
|
||||||
|
if (*lastSpanCounter != -1)
|
||||||
|
break;
|
||||||
|
|
||||||
|
*lastSpanCounter = spanCounter;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const int startSpanOffset = *lastSpanCounter != -1
|
||||||
|
? *lastSpanCounter : spanCounter;
|
||||||
|
*lastSpanCounter = -1;
|
||||||
|
|
||||||
|
const int startPos = it->key() + startSpanOffset + fileOffset;
|
||||||
|
const int endPos = it->value() + spanCounter + fileOffset;
|
||||||
|
changedPositions->insert(startPos, endPos);
|
||||||
|
++(*it);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void fixPositions(const ChunkData &chunkData,
|
||||||
|
const int leftFileOffset,
|
||||||
|
const int rightFileOffset,
|
||||||
|
QMap<int, int> *leftCharPos,
|
||||||
|
QMap<int, int> *rightCharPos)
|
||||||
|
{
|
||||||
|
QMap<int, int>::ConstIterator leftIt = chunkData.changedLeftPositions.constBegin();
|
||||||
|
const QMap<int, int>::ConstIterator leftItEnd = chunkData.changedLeftPositions.constEnd();
|
||||||
|
QMap<int, int>::ConstIterator rightIt = chunkData.changedRightPositions.constBegin();
|
||||||
|
const QMap<int, int>::ConstIterator rightItEnd = chunkData.changedRightPositions.constEnd();
|
||||||
|
if (leftIt == leftItEnd && rightIt == rightItEnd)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int leftCharCounter = 0;
|
||||||
|
int rightCharCounter = 0;
|
||||||
|
int leftSpanCounter = 0;
|
||||||
|
int rightSpanCounter = 0;
|
||||||
|
int leftLastSpanCounter = -1;
|
||||||
|
int rightLastSpanCounter = -1;
|
||||||
|
for (int i = 0; i < chunkData.rows.count(); i++) {
|
||||||
|
const RowData &row = chunkData.rows.at(i);
|
||||||
|
|
||||||
|
if (row.leftLine.textLineType == TextLineData::TextLine)
|
||||||
|
leftCharCounter += row.leftLine.text.count() + 1; // +1 for '\n'
|
||||||
|
else
|
||||||
|
++leftSpanCounter;
|
||||||
|
|
||||||
|
if (row.rightLine.textLineType == TextLineData::TextLine)
|
||||||
|
rightCharCounter += row.rightLine.text.count() + 1; // +1 for '\n'
|
||||||
|
else
|
||||||
|
++rightSpanCounter;
|
||||||
|
|
||||||
|
fixPositions(&leftIt,
|
||||||
|
leftItEnd,
|
||||||
|
leftFileOffset,
|
||||||
|
leftCharCounter,
|
||||||
|
leftSpanCounter,
|
||||||
|
&leftLastSpanCounter,
|
||||||
|
leftCharPos);
|
||||||
|
fixPositions(&rightIt,
|
||||||
|
rightItEnd,
|
||||||
|
rightFileOffset,
|
||||||
|
rightCharCounter,
|
||||||
|
rightSpanCounter,
|
||||||
|
&rightLastSpanCounter,
|
||||||
|
rightCharPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SideBySideDiffEditorWidget::colorDiff(const QList<FileData> &fileDataList)
|
void SideBySideDiffEditorWidget::colorDiff(const QList<FileData> &fileDataList)
|
||||||
{
|
{
|
||||||
QPalette pal = m_leftEditor->extraArea()->palette();
|
QPalette pal = m_leftEditor->extraArea()->palette();
|
||||||
@@ -1489,19 +1541,7 @@ void SideBySideDiffEditorWidget::colorDiff(const QList<FileData> &fileDataList)
|
|||||||
leftLastSkippedBlockStartPos = leftPos;
|
leftLastSkippedBlockStartPos = leftPos;
|
||||||
rightLastSkippedBlockStartPos = rightPos;
|
rightLastSkippedBlockStartPos = rightPos;
|
||||||
|
|
||||||
QMapIterator<int, int> itLeft(chunkData.changedLeftPositions);
|
fixPositions(chunkData, leftFileOffset, rightFileOffset, &leftCharPos, &rightCharPos);
|
||||||
while (itLeft.hasNext()) {
|
|
||||||
itLeft.next();
|
|
||||||
|
|
||||||
leftCharPos[itLeft.key() + leftFileOffset] = itLeft.value() + leftFileOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMapIterator<int, int> itRight(chunkData.changedRightPositions);
|
|
||||||
while (itRight.hasNext()) {
|
|
||||||
itRight.next();
|
|
||||||
|
|
||||||
rightCharPos[itRight.key() + rightFileOffset] = itRight.value() + rightFileOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int k = 0; k < chunkData.rows.count(); k++) {
|
for (int k = 0; k < chunkData.rows.count(); k++) {
|
||||||
RowData rowData = chunkData.rows.at(k);
|
RowData rowData = chunkData.rows.at(k);
|
||||||
@@ -1509,7 +1549,7 @@ void SideBySideDiffEditorWidget::colorDiff(const QList<FileData> &fileDataList)
|
|||||||
leftPos += rowData.leftLine.text.count() + 1; // +1 for '\n'
|
leftPos += rowData.leftLine.text.count() + 1; // +1 for '\n'
|
||||||
rightPos += rowData.rightLine.text.count() + 1; // +1 for '\n'
|
rightPos += rowData.rightLine.text.count() + 1; // +1 for '\n'
|
||||||
|
|
||||||
if (rowData.leftLine.changed) {
|
if (!rowData.equal) {
|
||||||
if (rowData.leftLine.textLineType == TextLineData::TextLine) {
|
if (rowData.leftLine.textLineType == TextLineData::TextLine) {
|
||||||
leftLinePos[leftLastDiffBlockStartPos] = leftPos;
|
leftLinePos[leftLastDiffBlockStartPos] = leftPos;
|
||||||
leftLastSkippedBlockStartPos = leftPos;
|
leftLastSkippedBlockStartPos = leftPos;
|
||||||
@@ -1517,12 +1557,6 @@ void SideBySideDiffEditorWidget::colorDiff(const QList<FileData> &fileDataList)
|
|||||||
leftSkippedPos[leftLastSkippedBlockStartPos] = leftPos;
|
leftSkippedPos[leftLastSkippedBlockStartPos] = leftPos;
|
||||||
leftLastDiffBlockStartPos = leftPos;
|
leftLastDiffBlockStartPos = leftPos;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
leftLastDiffBlockStartPos = leftPos;
|
|
||||||
leftLastSkippedBlockStartPos = leftPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rowData.rightLine.changed) {
|
|
||||||
if (rowData.rightLine.textLineType == TextLineData::TextLine) {
|
if (rowData.rightLine.textLineType == TextLineData::TextLine) {
|
||||||
rightLinePos[rightLastDiffBlockStartPos] = rightPos;
|
rightLinePos[rightLastDiffBlockStartPos] = rightPos;
|
||||||
rightLastSkippedBlockStartPos = rightPos;
|
rightLastSkippedBlockStartPos = rightPos;
|
||||||
@@ -1531,6 +1565,8 @@ void SideBySideDiffEditorWidget::colorDiff(const QList<FileData> &fileDataList)
|
|||||||
rightLastDiffBlockStartPos = rightPos;
|
rightLastDiffBlockStartPos = rightPos;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
leftLastDiffBlockStartPos = leftPos;
|
||||||
|
leftLastSkippedBlockStartPos = leftPos;
|
||||||
rightLastDiffBlockStartPos = rightPos;
|
rightLastDiffBlockStartPos = rightPos;
|
||||||
rightLastSkippedBlockStartPos = rightPos;
|
rightLastSkippedBlockStartPos = rightPos;
|
||||||
}
|
}
|
||||||
@@ -1616,8 +1652,7 @@ void SideBySideDiffEditorWidget::slotLeftJumpToOriginalFileRequested(int diffFil
|
|||||||
if (rowData.rightLine.textLineType == TextLineData::TextLine)
|
if (rowData.rightLine.textLineType == TextLineData::TextLine)
|
||||||
rightLineNumber++;
|
rightLineNumber++;
|
||||||
if (leftLineNumber == lineNumber) {
|
if (leftLineNumber == lineNumber) {
|
||||||
int colNr = !rowData.leftLine.changed && !rowData.rightLine.changed
|
int colNr = rowData.equal ? columnNumber : 0;
|
||||||
? columnNumber : 0;
|
|
||||||
jumpToOriginalFile(leftFileName, rightLineNumber, colNr);
|
jumpToOriginalFile(leftFileName, rightLineNumber, colNr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1840,27 +1875,36 @@ void SideBySideDiffEditorWidget::synchronizeFoldings(SideDiffEditorWidget *sourc
|
|||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
#include <QTest>
|
#include <QTest>
|
||||||
|
|
||||||
void DiffEditor::SideBySideDiffEditorWidget::testAssemblyRows()
|
void DiffEditor::SideBySideDiffEditorWidget::testFixPositions()
|
||||||
{
|
{
|
||||||
QStringList lines;
|
ChunkData chunkData;
|
||||||
lines << QLatin1String("abcd efgh"); // line 0
|
chunkData.rows.append(RowData(TextLineData(QLatin1String("abcd efgh")), TextLineData(QLatin1String("abcd "))));
|
||||||
lines << QLatin1String("ijkl mnop"); // line 1
|
chunkData.rows.append(RowData(TextLineData(TextLineData::Separator), TextLineData(QLatin1String(""))));
|
||||||
|
chunkData.rows.append(RowData(TextLineData(TextLineData::Separator), TextLineData(QLatin1String(""))));
|
||||||
|
chunkData.rows.append(RowData(TextLineData(TextLineData::Separator), TextLineData(QLatin1String(""))));
|
||||||
|
chunkData.rows.append(RowData(TextLineData(TextLineData::Separator), TextLineData(QLatin1String(""))));
|
||||||
|
chunkData.rows.append(RowData(TextLineData(TextLineData::Separator), TextLineData(QLatin1String(""))));
|
||||||
|
chunkData.rows.append(RowData(TextLineData(TextLineData::Separator), TextLineData(QLatin1String(""))));
|
||||||
|
chunkData.rows.append(RowData(TextLineData(QLatin1String("ijkl mnop")), TextLineData(QLatin1String(" mnop"))));
|
||||||
|
|
||||||
QMap<int, int> lineSpans;
|
chunkData.changedLeftPositions.insert(5, 14); // changed text from position 5 to position 14, occupy 9 characters: "efgh\nijkl"
|
||||||
lineSpans[1] = 6; // before line 1 insert 6 span lines
|
|
||||||
|
|
||||||
QMap<int, int> changedPositions;
|
QMap<int, int> expectedLeftChangedPositions;
|
||||||
changedPositions[5] = 14; // changed text from position 5 to position 14, occupy 9 characters: "efgh\nijkl"
|
expectedLeftChangedPositions[5] = 20; // "efgh\n[\n\n\n\n\n\n]ijkl" - [\n] means inserted span
|
||||||
|
|
||||||
QMap<int, bool> equalLines; // no equal lines
|
QMap<int, int> outputLeftChangedPositions;
|
||||||
|
QMap<int, int> outputRightChangedPositions;
|
||||||
|
|
||||||
QMap<int, int> expectedChangedPositions;
|
fixPositions(chunkData, 0, 0, &outputLeftChangedPositions, &outputRightChangedPositions);
|
||||||
expectedChangedPositions[5] = 20; // "efgh\n[\n\n\n\n\n\n]ijkl" - [\n] means inserted span
|
QVERIFY(outputLeftChangedPositions == expectedLeftChangedPositions);
|
||||||
|
|
||||||
QMap<int, int> outputChangedPositions;
|
QMap<int, int> expectedLeftMovedPositions;
|
||||||
|
expectedLeftMovedPositions[15] = 30; // moved by 10
|
||||||
|
outputLeftChangedPositions.clear();
|
||||||
|
outputRightChangedPositions.clear();
|
||||||
|
|
||||||
assemblyRows(lines, lineSpans, equalLines, changedPositions, &outputChangedPositions);
|
fixPositions(chunkData, 10, 0, &outputLeftChangedPositions, &outputRightChangedPositions);
|
||||||
QVERIFY(outputChangedPositions == expectedChangedPositions);
|
QVERIFY(outputLeftChangedPositions == expectedLeftMovedPositions);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // WITH_TESTS
|
#endif // WITH_TESTS
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
DiffEditorGuiController *diffEditorGuiController() const;
|
DiffEditorGuiController *diffEditorGuiController() const;
|
||||||
|
|
||||||
#ifdef WITH_TESTS
|
#ifdef WITH_TESTS
|
||||||
static void testAssemblyRows();
|
static void testFixPositions();
|
||||||
#endif // WITH_TESTS
|
#endif // WITH_TESTS
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|||||||
@@ -973,7 +973,7 @@ public:
|
|||||||
// cursor keys. This breaks some of the logic later on
|
// cursor keys. This breaks some of the logic later on
|
||||||
// relying on text() being empty for "special" keys.
|
// relying on text() being empty for "special" keys.
|
||||||
// FIXME: Check the real conditions.
|
// FIXME: Check the real conditions.
|
||||||
if (x.unicode() <= ' ')
|
if (x.unicode() < ' ')
|
||||||
m_text.clear();
|
m_text.clear();
|
||||||
else if (x.isLetter())
|
else if (x.isLetter())
|
||||||
m_key = x.toUpper().unicode();
|
m_key = x.toUpper().unicode();
|
||||||
@@ -1061,7 +1061,7 @@ public:
|
|||||||
return m_key < a.m_key;
|
return m_key < a.m_key;
|
||||||
// Text for some mapped key cannot be determined (e.g. <C-J>) so if text is not set for
|
// Text for some mapped key cannot be determined (e.g. <C-J>) so if text is not set for
|
||||||
// one of compared keys ignore it.
|
// one of compared keys ignore it.
|
||||||
if (!m_text.isEmpty() && !a.m_text.isEmpty())
|
if (!m_text.isEmpty() && !a.m_text.isEmpty() && m_text != _(" "))
|
||||||
return m_text < a.m_text;
|
return m_text < a.m_text;
|
||||||
return m_modifiers < a.m_modifiers;
|
return m_modifiers < a.m_modifiers;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,15 +218,6 @@ void GenericProject::parseProject(RefreshOptions options)
|
|||||||
|
|
||||||
// TODO: Possibly load some configuration from the project file
|
// TODO: Possibly load some configuration from the project file
|
||||||
//QSettings projectInfo(m_fileName, QSettings::IniFormat);
|
//QSettings projectInfo(m_fileName, QSettings::IniFormat);
|
||||||
|
|
||||||
m_defines.clear();
|
|
||||||
|
|
||||||
QFile configFile(configFileName());
|
|
||||||
if (configFile.open(QFile::ReadOnly)) {
|
|
||||||
// convert from local/file encoding to UTF-8
|
|
||||||
QTextStream configStream(&configFile);
|
|
||||||
m_defines = configStream.readAll().toUtf8();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options & Files)
|
if (options & Files)
|
||||||
@@ -265,7 +256,7 @@ void GenericProject::refresh(RefreshOptions options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
part->cxxVersion = CppTools::ProjectPart::CXX11; // assume C++11
|
part->cxxVersion = CppTools::ProjectPart::CXX11; // assume C++11
|
||||||
part->projectDefines += m_defines;
|
part->projectConfigFile = configFileName();
|
||||||
|
|
||||||
// ### add _defines.
|
// ### add _defines.
|
||||||
|
|
||||||
@@ -348,11 +339,6 @@ QStringList GenericProject::files() const
|
|||||||
return m_files;
|
return m_files;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray GenericProject::defines() const
|
|
||||||
{
|
|
||||||
return m_defines;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString GenericProject::displayName() const
|
QString GenericProject::displayName() const
|
||||||
{
|
{
|
||||||
return m_projectName;
|
return m_projectName;
|
||||||
|
|||||||
@@ -81,7 +81,6 @@ public:
|
|||||||
|
|
||||||
void refresh(RefreshOptions options);
|
void refresh(RefreshOptions options);
|
||||||
|
|
||||||
QByteArray defines() const;
|
|
||||||
QStringList projectIncludePaths() const;
|
QStringList projectIncludePaths() const;
|
||||||
QStringList files() const;
|
QStringList files() const;
|
||||||
|
|
||||||
@@ -108,7 +107,6 @@ private:
|
|||||||
QStringList m_files;
|
QStringList m_files;
|
||||||
QHash<QString, QString> m_rawListEntries;
|
QHash<QString, QString> m_rawListEntries;
|
||||||
QStringList m_projectIncludePaths;
|
QStringList m_projectIncludePaths;
|
||||||
QByteArray m_defines;
|
|
||||||
|
|
||||||
GenericProjectNode *m_rootNode;
|
GenericProjectNode *m_rootNode;
|
||||||
QFuture<void> m_codeModelFuture;
|
QFuture<void> m_codeModelFuture;
|
||||||
|
|||||||
@@ -48,6 +48,11 @@
|
|||||||
namespace GenericProjectManager {
|
namespace GenericProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
static const char *const ConfigFileTemplate =
|
||||||
|
"// Add predefined macros for your project here. For example:\n"
|
||||||
|
"// #define THE_ANSWER 42\n"
|
||||||
|
;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// GenericProjectWizardDialog
|
// GenericProjectWizardDialog
|
||||||
@@ -189,7 +194,7 @@ Core::GeneratedFiles GenericProjectWizard::generateFiles(const QWizard *w,
|
|||||||
generatedIncludesFile.setContents(includePaths.join(QLatin1String("\n")));
|
generatedIncludesFile.setContents(includePaths.join(QLatin1String("\n")));
|
||||||
|
|
||||||
Core::GeneratedFile generatedConfigFile(configFileName);
|
Core::GeneratedFile generatedConfigFile(configFileName);
|
||||||
generatedConfigFile.setContents(QLatin1String("// ADD PREDEFINED MACROS HERE!\n"));
|
generatedConfigFile.setContents(QLatin1String(ConfigFileTemplate));
|
||||||
|
|
||||||
Core::GeneratedFiles files;
|
Core::GeneratedFiles files;
|
||||||
files.append(generatedFilesFile);
|
files.append(generatedFilesFile);
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ void BranchDialog::enableButtons()
|
|||||||
m_ui->diffButton->setEnabled(hasActions);
|
m_ui->diffButton->setEnabled(hasActions);
|
||||||
m_ui->checkoutButton->setEnabled(hasActions && !currentSelected);
|
m_ui->checkoutButton->setEnabled(hasActions && !currentSelected);
|
||||||
m_ui->rebaseButton->setEnabled(hasActions && !currentSelected);
|
m_ui->rebaseButton->setEnabled(hasActions && !currentSelected);
|
||||||
|
m_ui->resetButton->setEnabled(hasActions && currentLocal && !currentSelected);
|
||||||
m_ui->mergeButton->setEnabled(hasActions && !currentSelected);
|
m_ui->mergeButton->setEnabled(hasActions && !currentSelected);
|
||||||
m_ui->cherryPickButton->setEnabled(hasActions && !currentSelected);
|
m_ui->cherryPickButton->setEnabled(hasActions && !currentSelected);
|
||||||
m_ui->trackButton->setEnabled(hasActions && currentLocal && !currentSelected && !isTag);
|
m_ui->trackButton->setEnabled(hasActions && currentLocal && !currentSelected && !isTag);
|
||||||
@@ -323,8 +324,8 @@ void BranchDialog::log()
|
|||||||
|
|
||||||
void BranchDialog::reset()
|
void BranchDialog::reset()
|
||||||
{
|
{
|
||||||
QString currentName = m_model->fullName(m_model->currentBranch(), true);
|
QString currentName = m_model->fullName(m_model->currentBranch());
|
||||||
QString branchName = m_model->fullName(selectedIndex(), true);
|
QString branchName = m_model->fullName(selectedIndex());
|
||||||
if (currentName.isEmpty() || branchName.isEmpty())
|
if (currentName.isEmpty() || branchName.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -130,13 +130,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="resetButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Reset</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -158,6 +151,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="resetButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Reset</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
@@ -692,14 +692,18 @@ QModelIndex BranchModel::nodeToIndex(BranchNode *node) const
|
|||||||
|
|
||||||
void BranchModel::removeNode(const QModelIndex &idx)
|
void BranchModel::removeNode(const QModelIndex &idx)
|
||||||
{
|
{
|
||||||
QModelIndex tmp = idx; // tmp is a leaf, so count must be 0.
|
QModelIndex nodeIndex = idx; // idx is a leaf, so count must be 0.
|
||||||
while (indexToNode(tmp)->count() == 0) {
|
BranchNode *node = indexToNode(nodeIndex);
|
||||||
QModelIndex tmpParent = parent(tmp);
|
while (node->count() == 0 && node->parent != m_rootNode) {
|
||||||
beginRemoveRows(tmpParent, tmp.row(), tmp.row());
|
BranchNode *parentNode = node->parent;
|
||||||
indexToNode(tmpParent)->children.removeAt(tmp.row());
|
const QModelIndex parentIndex = nodeToIndex(parentNode);
|
||||||
delete indexToNode(tmp);
|
const int nodeRow = nodeIndex.row();
|
||||||
|
beginRemoveRows(parentIndex, nodeRow, nodeRow);
|
||||||
|
parentNode->children.removeAt(nodeRow);
|
||||||
|
delete node;
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
tmp = tmpParent;
|
node = parentNode;
|
||||||
|
nodeIndex = parentIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2001,7 +2001,8 @@ bool GitClient::synchronousHeadRefs(const QString &workingDirectory, QStringList
|
|||||||
<< QLatin1String("--abbrev=10") << QLatin1String("--dereference");
|
<< QLatin1String("--abbrev=10") << QLatin1String("--dereference");
|
||||||
QByteArray outputText;
|
QByteArray outputText;
|
||||||
QByteArray errorText;
|
QByteArray errorText;
|
||||||
const bool rc = fullySynchronousGit(workingDirectory, args, &outputText, &errorText);
|
const bool rc = fullySynchronousGit(workingDirectory, args, &outputText, &errorText,
|
||||||
|
VcsBasePlugin::SuppressCommandLogging);
|
||||||
if (!rc) {
|
if (!rc) {
|
||||||
msgCannotRun(args, workingDirectory, errorText, errorMessage);
|
msgCannotRun(args, workingDirectory, errorText, errorMessage);
|
||||||
return false;
|
return false;
|
||||||
@@ -2051,9 +2052,19 @@ QString GitClient::synchronousTopic(const QString &workingDirectory)
|
|||||||
(derefInd == -1) ? -1 : derefInd - remoteStart.size());
|
(derefInd == -1) ? -1 : derefInd - remoteStart.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!remoteBranch.isEmpty())
|
||||||
|
return remoteBranch;
|
||||||
|
|
||||||
// No tag
|
// No tag or remote branch - try git describe
|
||||||
return remoteBranch.isEmpty() ? tr("Detached HEAD") : remoteBranch;
|
QByteArray output;
|
||||||
|
QStringList arguments;
|
||||||
|
arguments << QLatin1String("describe");
|
||||||
|
if (fullySynchronousGit(workingDirectory, arguments, &output, 0, VcsBasePlugin::NoOutput)) {
|
||||||
|
const QString describeOutput = commandOutputFromLocal8Bit(output.trimmed());
|
||||||
|
if (!describeOutput.isEmpty())
|
||||||
|
return describeOutput;
|
||||||
|
}
|
||||||
|
return tr("Detached HEAD");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitClient::synchronousRevParseCmd(const QString &workingDirectory, const QString &ref,
|
bool GitClient::synchronousRevParseCmd(const QString &workingDirectory, const QString &ref,
|
||||||
|
|||||||
@@ -823,6 +823,9 @@ void FlatModel::removeFromCache(QList<FolderNode *> list)
|
|||||||
|
|
||||||
void FlatModel::changedSortKey(FolderNode *folderNode, Node *node)
|
void FlatModel::changedSortKey(FolderNode *folderNode, Node *node)
|
||||||
{
|
{
|
||||||
|
if (!m_childNodes.contains(folderNode))
|
||||||
|
return; // The directory was not yet mapped, so there is no need to sort it.
|
||||||
|
|
||||||
QList<Node *> nodes = m_childNodes.value(folderNode);
|
QList<Node *> nodes = m_childNodes.value(folderNode);
|
||||||
int oldIndex = nodes.indexOf(node);
|
int oldIndex = nodes.indexOf(node);
|
||||||
|
|
||||||
|
|||||||
@@ -313,24 +313,6 @@ void FolderNode::setIcon(const QIcon &icon)
|
|||||||
m_icon = icon;
|
m_icon = icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileNode *FolderNode::findFile(const QString &path)
|
|
||||||
{
|
|
||||||
foreach (FileNode *n, fileNodes()) {
|
|
||||||
if (n->path() == path)
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
FolderNode *FolderNode::findSubFolder(const QString &path)
|
|
||||||
{
|
|
||||||
foreach (FolderNode *n, subFolderNodes()) {
|
|
||||||
if (n->path() == path)
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FolderNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
|
bool FolderNode::addFiles(const QStringList &filePaths, QStringList *notAdded)
|
||||||
{
|
{
|
||||||
if (projectNode())
|
if (projectNode())
|
||||||
|
|||||||
@@ -174,9 +174,6 @@ public:
|
|||||||
void setDisplayName(const QString &name);
|
void setDisplayName(const QString &name);
|
||||||
void setIcon(const QIcon &icon);
|
void setIcon(const QIcon &icon);
|
||||||
|
|
||||||
FileNode *findFile(const QString &path);
|
|
||||||
FolderNode *findSubFolder(const QString &path);
|
|
||||||
|
|
||||||
virtual bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
|
virtual bool addFiles(const QStringList &filePaths, QStringList *notAdded = 0);
|
||||||
virtual bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
|
virtual bool removeFiles(const QStringList &filePaths, QStringList *notRemoved = 0);
|
||||||
virtual bool deleteFiles(const QStringList &filePaths);
|
virtual bool deleteFiles(const QStringList &filePaths);
|
||||||
|
|||||||
@@ -424,7 +424,14 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root,
|
|||||||
|
|
||||||
// Handle files:
|
// Handle files:
|
||||||
if (c->isFile()) {
|
if (c->isFile()) {
|
||||||
ProjectExplorer::FileNode *fn = root->findFile(path);
|
ProjectExplorer::FileNode *fn = 0;
|
||||||
|
foreach (ProjectExplorer::FileNode *f, root->fileNodes()) {
|
||||||
|
// There can be one match only here!
|
||||||
|
if (f->path() != path)
|
||||||
|
continue;
|
||||||
|
fn = f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (fn) {
|
if (fn) {
|
||||||
filesToRemove.removeOne(fn);
|
filesToRemove.removeOne(fn);
|
||||||
if (updateExisting)
|
if (updateExisting)
|
||||||
@@ -435,7 +442,14 @@ void QbsGroupNode::setupFolder(ProjectExplorer::FolderNode *root,
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
FolderNode *fn = root->findSubFolder(c->path());
|
ProjectExplorer::FolderNode *fn = 0;
|
||||||
|
foreach (ProjectExplorer::FolderNode *f, root->subFolderNodes()) {
|
||||||
|
// There can be one match only here!
|
||||||
|
if (f->path() != path)
|
||||||
|
continue;
|
||||||
|
fn = f;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (!fn) {
|
if (!fn) {
|
||||||
fn = new FolderNode(c->path());
|
fn = new FolderNode(c->path());
|
||||||
root->addFolderNodes(QList<FolderNode *>() << fn);
|
root->addFolderNodes(QList<FolderNode *>() << fn);
|
||||||
|
|||||||
@@ -63,6 +63,8 @@
|
|||||||
|
|
||||||
#include <qbs.h>
|
#include <qbs.h>
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDir>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
@@ -462,9 +464,8 @@ void QbsProject::parse(const QVariantMap &config, const Environment &env, const
|
|||||||
params.setIgnoreDifferentProjectFilePath(false);
|
params.setIgnoreDifferentProjectFilePath(false);
|
||||||
params.setEnvironment(env.toProcessEnvironment());
|
params.setEnvironment(env.toProcessEnvironment());
|
||||||
const qbs::Preferences prefs(QbsManager::settings(), profileName);
|
const qbs::Preferences prefs(QbsManager::settings(), profileName);
|
||||||
const QString qbsDir = qbsDirectory();
|
params.setSearchPaths(prefs.searchPaths(resourcesBaseDirectory()));
|
||||||
params.setSearchPaths(prefs.searchPaths(qbsDir));
|
params.setPluginPaths(prefs.pluginPaths(pluginsBaseDirectory()));
|
||||||
params.setPluginPaths(prefs.pluginPaths(qbsDir));
|
|
||||||
|
|
||||||
// Do the parsing:
|
// Do the parsing:
|
||||||
prepareForParsing();
|
prepareForParsing();
|
||||||
@@ -705,7 +706,7 @@ void QbsProject::updateDeploymentInfo(const qbs::Project &project)
|
|||||||
activeTarget()->setDeploymentData(deploymentData);
|
activeTarget()->setDeploymentData(deploymentData);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QbsProject::qbsDirectory() const
|
QString QbsProject::resourcesBaseDirectory() const
|
||||||
{
|
{
|
||||||
const QString qbsInstallDir = QLatin1String(QBS_INSTALL_DIR);
|
const QString qbsInstallDir = QLatin1String(QBS_INSTALL_DIR);
|
||||||
if (!qbsInstallDir.isEmpty())
|
if (!qbsInstallDir.isEmpty())
|
||||||
@@ -713,5 +714,14 @@ QString QbsProject::qbsDirectory() const
|
|||||||
return ICore::resourcePath() + QLatin1String("/qbs");
|
return ICore::resourcePath() + QLatin1String("/qbs");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QbsProject::pluginsBaseDirectory() const
|
||||||
|
{
|
||||||
|
const QString qbsInstallDir = QLatin1String(QBS_INSTALL_DIR);
|
||||||
|
if (!qbsInstallDir.isEmpty())
|
||||||
|
return qbsInstallDir + QLatin1String("/lib/");
|
||||||
|
return QDir::cleanPath(QCoreApplication::applicationDirPath()
|
||||||
|
+ QLatin1String("/../lib/qtcreator"));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace QbsProjectManager
|
} // namespace QbsProjectManager
|
||||||
|
|||||||
@@ -131,7 +131,8 @@ private:
|
|||||||
void updateQmlJsCodeModel(const qbs::ProjectData &prj);
|
void updateQmlJsCodeModel(const qbs::ProjectData &prj);
|
||||||
void updateApplicationTargets(const qbs::ProjectData &projectData);
|
void updateApplicationTargets(const qbs::ProjectData &projectData);
|
||||||
void updateDeploymentInfo(const qbs::Project &project);
|
void updateDeploymentInfo(const qbs::Project &project);
|
||||||
QString qbsDirectory() const;
|
QString resourcesBaseDirectory() const;
|
||||||
|
QString pluginsBaseDirectory() const;
|
||||||
|
|
||||||
QbsManager *const m_manager;
|
QbsManager *const m_manager;
|
||||||
const QString m_projectName;
|
const QString m_projectName;
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ Rectangle {
|
|||||||
property date recordingStartDate
|
property date recordingStartDate
|
||||||
property real elapsedTime
|
property real elapsedTime
|
||||||
|
|
||||||
|
color: "#dcdcdc"
|
||||||
|
|
||||||
// ***** connections with external objects
|
// ***** connections with external objects
|
||||||
Connections {
|
Connections {
|
||||||
target: zoomControl
|
target: zoomControl
|
||||||
@@ -230,12 +232,51 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Flickable {
|
Flickable {
|
||||||
id: vertflick
|
id: labelsflick
|
||||||
flickableDirection: Flickable.VerticalFlick
|
flickableDirection: Flickable.VerticalFlick
|
||||||
anchors.fill: parent
|
interactive: false
|
||||||
clip: true
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
width: labels.width
|
||||||
|
contentY: flick.contentY
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: labels
|
||||||
|
anchors.left: parent.left
|
||||||
|
width: 150
|
||||||
|
color: root.color
|
||||||
|
height: col.height
|
||||||
|
|
||||||
|
property int rowCount: qmlProfilerModelProxy.categoryCount();
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: col
|
||||||
|
Repeater {
|
||||||
|
model: labels.rowCount
|
||||||
|
delegate: CategoryLabel { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// border between labels and timeline
|
||||||
|
Rectangle {
|
||||||
|
id: labelsborder
|
||||||
|
anchors.left: labelsflick.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
width: 1
|
||||||
|
color: "#858585"
|
||||||
|
}
|
||||||
|
|
||||||
|
Flickable {
|
||||||
|
id: flick
|
||||||
contentHeight: labels.height
|
contentHeight: labels.height
|
||||||
|
contentWidth: 0
|
||||||
|
flickableDirection: Flickable.HorizontalAndVerticalFlick
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
|
clip:true
|
||||||
|
|
||||||
// ScrollView will try to deinteractivate it. We don't want that
|
// ScrollView will try to deinteractivate it. We don't want that
|
||||||
// as the horizontal flickable is interactive, too. We do occasionally
|
// as the horizontal flickable is interactive, too. We do occasionally
|
||||||
@@ -244,41 +285,27 @@ Rectangle {
|
|||||||
onInteractiveChanged: interactive = stayInteractive
|
onInteractiveChanged: interactive = stayInteractive
|
||||||
onStayInteractiveChanged: interactive = stayInteractive
|
onStayInteractiveChanged: interactive = stayInteractive
|
||||||
|
|
||||||
// ***** child items
|
|
||||||
TimeMarks {
|
|
||||||
id: backgroundMarks
|
|
||||||
y: vertflick.contentY
|
|
||||||
height: vertflick.height
|
|
||||||
width: root.width - labels.width
|
|
||||||
anchors.left: labels.right
|
|
||||||
}
|
|
||||||
|
|
||||||
Flickable {
|
|
||||||
function setContentWidth() {
|
function setContentWidth() {
|
||||||
var duration = Math.abs(zoomControl.endTime() - zoomControl.startTime());
|
var duration = Math.abs(zoomControl.endTime() - zoomControl.startTime());
|
||||||
if (duration > 0)
|
if (duration > 0)
|
||||||
contentWidth = qmlProfilerModelProxy.traceDuration() * width / duration;
|
contentWidth = qmlProfilerModelProxy.traceDuration() * width / duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
id: flick
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.topMargin: labels.y
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.left: labels.right
|
|
||||||
contentWidth: 0
|
|
||||||
height: labels.height + labelsTail.height
|
|
||||||
flickableDirection: Flickable.HorizontalFlick
|
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
|
||||||
|
|
||||||
onContentXChanged: view.updateZoomControl()
|
onContentXChanged: view.updateZoomControl()
|
||||||
onWidthChanged: setContentWidth()
|
onWidthChanged: setContentWidth()
|
||||||
|
|
||||||
clip:true
|
// ***** child items
|
||||||
|
TimeMarks {
|
||||||
|
id: backgroundMarks
|
||||||
|
y: flick.contentY
|
||||||
|
x: flick.contentX
|
||||||
|
height: flick.height
|
||||||
|
width: scroller.width
|
||||||
|
}
|
||||||
|
|
||||||
SelectionRange {
|
SelectionRange {
|
||||||
id: selectionRange
|
id: selectionRange
|
||||||
visible: root.selectionRangeMode && creationState !== 0
|
visible: root.selectionRangeMode && creationState !== 0
|
||||||
height: parent.height
|
|
||||||
z: 2
|
z: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -288,9 +315,11 @@ Rectangle {
|
|||||||
profilerModelProxy: qmlProfilerModelProxy
|
profilerModelProxy: qmlProfilerModelProxy
|
||||||
|
|
||||||
x: flick.contentX
|
x: flick.contentX
|
||||||
y: vertflick.contentY
|
y: flick.contentY
|
||||||
width: flick.width
|
|
||||||
height: vertflick.height
|
// paint "under" the vertical scrollbar, so that it always matches with the timemarks
|
||||||
|
width: scroller.width
|
||||||
|
height: flick.height
|
||||||
|
|
||||||
onEndTimeChanged: requestPaint()
|
onEndTimeChanged: requestPaint()
|
||||||
onYChanged: requestPaint()
|
onYChanged: requestPaint()
|
||||||
@@ -360,6 +389,7 @@ Rectangle {
|
|||||||
width: flick.width
|
width: flick.width
|
||||||
height: flick.height
|
height: flick.height
|
||||||
x: flick.contentX
|
x: flick.contentX
|
||||||
|
y: flick.contentY
|
||||||
hoverEnabled: enabled
|
hoverEnabled: enabled
|
||||||
z: 2
|
z: 2
|
||||||
|
|
||||||
@@ -378,44 +408,13 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: labels
|
|
||||||
width: 150
|
|
||||||
color: "#dcdcdc"
|
|
||||||
height: col.height
|
|
||||||
|
|
||||||
property int rowCount: qmlProfilerModelProxy.categoryCount();
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: col
|
|
||||||
Repeater {
|
|
||||||
model: labels.rowCount
|
|
||||||
delegate: CategoryLabel { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: labelsTail
|
|
||||||
anchors.top: labels.bottom
|
|
||||||
height: Math.max(0, vertflick.height - labels.height)
|
|
||||||
width: labels.width
|
|
||||||
color: labels.color
|
|
||||||
}
|
|
||||||
|
|
||||||
// border between labels and timeline
|
|
||||||
Rectangle {
|
|
||||||
anchors.left: labels.right
|
|
||||||
anchors.top: labels.top
|
|
||||||
anchors.bottom: labelsTail.bottom
|
|
||||||
width: 1
|
|
||||||
color: "#858585"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
contentItem: vertflick
|
id: scroller
|
||||||
anchors.fill: parent
|
contentItem: flick
|
||||||
|
anchors.left: labelsborder.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.bottom: parent.bottom
|
||||||
|
anchors.right: parent.right
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionRangeDetails {
|
SelectionRangeDetails {
|
||||||
|
|||||||
@@ -107,8 +107,7 @@ RangeMover {
|
|||||||
// creation control
|
// creation control
|
||||||
function releasedOnCreation() {
|
function releasedOnCreation() {
|
||||||
if (selectionRange.creationState === 2) {
|
if (selectionRange.creationState === 2) {
|
||||||
flick.interactive = true;
|
flick.stayInteractive = true;
|
||||||
vertflick.stayInteractive = true;
|
|
||||||
selectionRange.creationState = 3;
|
selectionRange.creationState = 3;
|
||||||
selectionRangeControl.enabled = false;
|
selectionRangeControl.enabled = false;
|
||||||
}
|
}
|
||||||
@@ -116,8 +115,7 @@ RangeMover {
|
|||||||
|
|
||||||
function pressedOnCreation() {
|
function pressedOnCreation() {
|
||||||
if (selectionRange.creationState === 1) {
|
if (selectionRange.creationState === 1) {
|
||||||
flick.interactive = false;
|
flick.stayInteractive = false;
|
||||||
vertflick.stayInteractive = false;
|
|
||||||
selectionRange.setPos(selectionRangeControl.mouseX + flick.contentX);
|
selectionRange.setPos(selectionRangeControl.mouseX + flick.contentX);
|
||||||
selectionRange.creationState = 2;
|
selectionRange.creationState = 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,17 +54,18 @@ Canvas {
|
|||||||
context.fillStyle = "white";
|
context.fillStyle = "white";
|
||||||
context.fillRect(0, 0, width, height);
|
context.fillRect(0, 0, width, height);
|
||||||
|
|
||||||
|
var realWidth = width - 1; // account for left border
|
||||||
var totalTime = endTime - startTime;
|
var totalTime = endTime - startTime;
|
||||||
var spacing = width / totalTime;
|
var spacing = realWidth / totalTime;
|
||||||
|
|
||||||
var initialBlockLength = 120;
|
var initialBlockLength = 120;
|
||||||
var timePerBlock = Math.pow(2, Math.floor( Math.log( totalTime / width * initialBlockLength ) / Math.LN2 ) );
|
var timePerBlock = Math.pow(2, Math.floor( Math.log( totalTime / realWidth * initialBlockLength ) / Math.LN2 ) );
|
||||||
var pixelsPerBlock = timePerBlock * spacing;
|
var pixelsPerBlock = timePerBlock * spacing;
|
||||||
var pixelsPerSection = pixelsPerBlock / 5;
|
var pixelsPerSection = pixelsPerBlock / 5;
|
||||||
var blockCount = width / pixelsPerBlock;
|
var blockCount = realWidth / pixelsPerBlock;
|
||||||
|
|
||||||
var realStartTime = Math.floor(startTime/timePerBlock) * timePerBlock;
|
var realStartTime = Math.floor(startTime/timePerBlock) * timePerBlock;
|
||||||
var realStartPos = (startTime-realStartTime) * spacing;
|
var realStartPos = (startTime - realStartTime) * spacing - 1;
|
||||||
|
|
||||||
timePerPixel = timePerBlock/pixelsPerBlock;
|
timePerPixel = timePerBlock/pixelsPerBlock;
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ Canvas {
|
|||||||
// bottom
|
// bottom
|
||||||
if (height > labels.height - y) {
|
if (height > labels.height - y) {
|
||||||
context.fillStyle = "#f5f5f5";
|
context.fillStyle = "#f5f5f5";
|
||||||
context.fillRect(0, labels.height - y, width, Math.min(height - labels.height + y, labelsTail.height));
|
context.fillRect(0, labels.height - y, width, height - labels.height + y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ const char VCS_ID_SUBVERSION[] = "J.Subversion";
|
|||||||
const char VCS_ID_PERFORCE[] = "P.Perforce";
|
const char VCS_ID_PERFORCE[] = "P.Perforce";
|
||||||
const char VCS_ID_CVS[] = "Z.CVS";
|
const char VCS_ID_CVS[] = "Z.CVS";
|
||||||
|
|
||||||
|
const char VAR_VCS_NAME[] = "CurrentProject:VcsName";
|
||||||
|
const char VAR_VCS_TOPIC[] = "CurrentProject:VcsTopic";
|
||||||
|
|
||||||
} // namespace Constants
|
} // namespace Constants
|
||||||
} // namespace VcsBase
|
} // namespace VcsBase
|
||||||
|
|
||||||
|
|||||||
@@ -264,13 +264,15 @@ void OutputWindowPlainTextEdit::setFormat(enum VcsBaseOutputWindow::MessageStyle
|
|||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
// ------------------- VcsBaseOutputWindowPrivate
|
// ------------------- VcsBaseOutputWindowPrivate
|
||||||
struct VcsBaseOutputWindowPrivate
|
class VcsBaseOutputWindowPrivate
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
static VcsBaseOutputWindow *instance;
|
static VcsBaseOutputWindow *instance;
|
||||||
Internal::OutputWindowPlainTextEdit *plainTextEdit();
|
Internal::OutputWindowPlainTextEdit *plainTextEdit();
|
||||||
|
|
||||||
QPointer<Internal::OutputWindowPlainTextEdit> m_plainTextEdit;
|
QPointer<Internal::OutputWindowPlainTextEdit> m_plainTextEdit;
|
||||||
QString repository;
|
QString repository;
|
||||||
|
QRegExp passwordRegExp;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create log editor on demand. Some errors might be logged
|
// Create log editor on demand. Some errors might be logged
|
||||||
@@ -288,9 +290,25 @@ VcsBaseOutputWindow *VcsBaseOutputWindowPrivate::instance = 0;
|
|||||||
VcsBaseOutputWindow::VcsBaseOutputWindow() :
|
VcsBaseOutputWindow::VcsBaseOutputWindow() :
|
||||||
d(new VcsBaseOutputWindowPrivate)
|
d(new VcsBaseOutputWindowPrivate)
|
||||||
{
|
{
|
||||||
|
d->passwordRegExp = QRegExp(QLatin1String("://([^@:]+):([^@]+)@"));
|
||||||
|
Q_ASSERT(d->passwordRegExp.isValid());
|
||||||
VcsBaseOutputWindowPrivate::instance = this;
|
VcsBaseOutputWindowPrivate::instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString VcsBaseOutputWindow::filterPasswordFromUrls(const QString &input)
|
||||||
|
{
|
||||||
|
int pos = 0;
|
||||||
|
QString result = input;
|
||||||
|
while ((pos = d->passwordRegExp.indexIn(result, pos)) >= 0) {
|
||||||
|
QString tmp = result.left(pos + 3) + d->passwordRegExp.cap(1) + QLatin1String(":***@");
|
||||||
|
int newStart = tmp.count();
|
||||||
|
tmp += result.mid(pos + d->passwordRegExp.matchedLength());
|
||||||
|
result = tmp;
|
||||||
|
pos = newStart;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
VcsBaseOutputWindow::~VcsBaseOutputWindow()
|
VcsBaseOutputWindow::~VcsBaseOutputWindow()
|
||||||
{
|
{
|
||||||
VcsBaseOutputWindowPrivate::instance = 0;
|
VcsBaseOutputWindowPrivate::instance = 0;
|
||||||
@@ -442,7 +460,7 @@ QString VcsBaseOutputWindow::msgExecutionLogEntry(const QString &workingDir,
|
|||||||
|
|
||||||
void VcsBaseOutputWindow::appendCommand(const QString &text)
|
void VcsBaseOutputWindow::appendCommand(const QString &text)
|
||||||
{
|
{
|
||||||
append(text, Command, true);
|
append(filterPasswordFromUrls(text), Command, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VcsBaseOutputWindow::appendCommand(const QString &workingDirectory,
|
void VcsBaseOutputWindow::appendCommand(const QString &workingDirectory,
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
namespace VcsBase {
|
namespace VcsBase {
|
||||||
|
|
||||||
struct VcsBaseOutputWindowPrivate;
|
class VcsBaseOutputWindowPrivate;
|
||||||
|
|
||||||
class VCSBASE_EXPORT VcsBaseOutputWindow : public Core::IOutputPane
|
class VCSBASE_EXPORT VcsBaseOutputWindow : public Core::IOutputPane
|
||||||
{
|
{
|
||||||
@@ -121,6 +121,8 @@ public slots:
|
|||||||
private:
|
private:
|
||||||
VcsBaseOutputWindow();
|
VcsBaseOutputWindow();
|
||||||
|
|
||||||
|
QString filterPasswordFromUrls(const QString &input);
|
||||||
|
|
||||||
VcsBaseOutputWindowPrivate *d;
|
VcsBaseOutputWindowPrivate *d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -28,12 +28,20 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "vcsplugin.h"
|
#include "vcsplugin.h"
|
||||||
|
|
||||||
|
#include "vcsbaseconstants.h"
|
||||||
|
|
||||||
#include "commonsettingspage.h"
|
#include "commonsettingspage.h"
|
||||||
#include "nicknamedialog.h"
|
#include "nicknamedialog.h"
|
||||||
#include "vcsbaseoutputwindow.h"
|
#include "vcsbaseoutputwindow.h"
|
||||||
#include "corelistener.h"
|
#include "corelistener.h"
|
||||||
|
|
||||||
|
#include <coreplugin/iversioncontrol.h>
|
||||||
#include <coreplugin/mimedatabase.h>
|
#include <coreplugin/mimedatabase.h>
|
||||||
|
#include <coreplugin/variablemanager.h>
|
||||||
|
#include <coreplugin/vcsmanager.h>
|
||||||
|
#include <projectexplorer/project.h>
|
||||||
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
|
||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
@@ -74,6 +82,15 @@ bool VcsPlugin::initialize(const QStringList &arguments, QString *errorMessage)
|
|||||||
connect(m_settingsPage, SIGNAL(settingsChanged(VcsBase::Internal::CommonVcsSettings)),
|
connect(m_settingsPage, SIGNAL(settingsChanged(VcsBase::Internal::CommonVcsSettings)),
|
||||||
this, SLOT(slotSettingsChanged()));
|
this, SLOT(slotSettingsChanged()));
|
||||||
slotSettingsChanged();
|
slotSettingsChanged();
|
||||||
|
|
||||||
|
connect(Core::VariableManager::instance(), SIGNAL(variableUpdateRequested(QByteArray)),
|
||||||
|
this, SLOT(updateVariable(QByteArray)));
|
||||||
|
|
||||||
|
Core::VariableManager::registerVariable(Constants::VAR_VCS_NAME,
|
||||||
|
tr("Name of the version control system in use by the current project."));
|
||||||
|
Core::VariableManager::registerVariable(Constants::VAR_VCS_TOPIC,
|
||||||
|
tr("The current version control topic (branch or tag) identification of the current project."));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,6 +139,32 @@ void VcsPlugin::slotSettingsChanged()
|
|||||||
populateNickNameModel();
|
populateNickNameModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VcsPlugin::updateVariable(const QByteArray &variable)
|
||||||
|
{
|
||||||
|
static ProjectExplorer::Project *cachedProject = 0;
|
||||||
|
static Core::IVersionControl *cachedVc = 0;
|
||||||
|
static QString cachedTopLevel;
|
||||||
|
|
||||||
|
ProjectExplorer::Project *project = ProjectExplorer::ProjectExplorerPlugin::currentProject();
|
||||||
|
if (cachedProject != project) {
|
||||||
|
cachedVc = Core::VcsManager::findVersionControlForDirectory(project->projectDirectory(),
|
||||||
|
&cachedTopLevel);
|
||||||
|
cachedProject = project;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (variable == Constants::VAR_VCS_NAME) {
|
||||||
|
if (cachedVc)
|
||||||
|
Core::VariableManager::insert(variable, cachedVc->displayName());
|
||||||
|
else
|
||||||
|
Core::VariableManager::remove(variable);
|
||||||
|
} else if (variable == Constants::VAR_VCS_TOPIC) {
|
||||||
|
if (cachedVc)
|
||||||
|
Core::VariableManager::insert(variable, cachedVc->vcsTopic(cachedTopLevel));
|
||||||
|
else
|
||||||
|
Core::VariableManager::remove(variable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace VcsBase
|
} // namespace VcsBase
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ signals:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void slotSettingsChanged();
|
void slotSettingsChanged();
|
||||||
|
void updateVariable(const QByteArray &variable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void populateNickNameModel();
|
void populateNickNameModel();
|
||||||
|
|||||||
Submodule src/shared/qbs updated: de8682b7d4...0816b8e476
@@ -27,6 +27,7 @@ Project {
|
|||||||
property path libRPaths: qbs.targetOS.contains("osx")
|
property path libRPaths: qbs.targetOS.contains("osx")
|
||||||
? ["@loader_path/.."] : ["$ORIGIN/.."]
|
? ["@loader_path/.."] : ["$ORIGIN/.."]
|
||||||
property path resourcesInstallDir: project.ide_data_path + "/qbs"
|
property path resourcesInstallDir: project.ide_data_path + "/qbs"
|
||||||
|
property string pluginsInstallDir: "lib/qtcreator"
|
||||||
|
|
||||||
references: [
|
references: [
|
||||||
qbsBaseDir + "/src/lib/libs.qbs",
|
qbsBaseDir + "/src/lib/libs.qbs",
|
||||||
|
|||||||
@@ -127,6 +127,7 @@ private Q_SLOTS:
|
|||||||
void functionDefaultArgument();
|
void functionDefaultArgument();
|
||||||
void attributeInAccessSpecifier();
|
void attributeInAccessSpecifier();
|
||||||
void braceReturn();
|
void braceReturn();
|
||||||
|
void staticVarDeclWithTypeDecl();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Line {
|
struct Line {
|
||||||
@@ -2111,6 +2112,43 @@ void tst_CodeFormatter::braceReturn()
|
|||||||
checkIndent(data);
|
checkIndent(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_CodeFormatter::staticVarDeclWithTypeDecl()
|
||||||
|
{
|
||||||
|
QList<Line> data;
|
||||||
|
data << Line("static class: public Foo {")
|
||||||
|
<< Line("public:")
|
||||||
|
<< Line(" int bar();")
|
||||||
|
<< Line("} mooze;")
|
||||||
|
<< Line("")
|
||||||
|
<< Line("static enum Col {")
|
||||||
|
<< Line(" red,")
|
||||||
|
<< Line(" yellow,")
|
||||||
|
<< Line(" green")
|
||||||
|
<< Line("} Loc;")
|
||||||
|
<< Line("")
|
||||||
|
<< Line("static enum {")
|
||||||
|
<< Line(" red,")
|
||||||
|
<< Line(" yellow,")
|
||||||
|
<< Line(" green")
|
||||||
|
<< Line("} Loc;")
|
||||||
|
<< Line("")
|
||||||
|
<< Line("enum class Col {")
|
||||||
|
<< Line(" red,")
|
||||||
|
<< Line(" yellow,")
|
||||||
|
<< Line(" green")
|
||||||
|
<< Line("};")
|
||||||
|
<< Line("")
|
||||||
|
<< Line("static enum class Col")
|
||||||
|
<< Line("{")
|
||||||
|
<< Line(" red,")
|
||||||
|
<< Line(" yellow,")
|
||||||
|
<< Line(" green")
|
||||||
|
<< Line("} Loc;")
|
||||||
|
<< Line("")
|
||||||
|
;
|
||||||
|
checkIndent(data);
|
||||||
|
}
|
||||||
|
|
||||||
QTEST_MAIN(tst_CodeFormatter)
|
QTEST_MAIN(tst_CodeFormatter)
|
||||||
|
|
||||||
#include "tst_codeformatter.moc"
|
#include "tst_codeformatter.moc"
|
||||||
|
|||||||
@@ -32,6 +32,7 @@
|
|||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
#include <QSet>
|
||||||
|
|
||||||
//TESTED_COMPONENT=src/libs/cplusplus
|
//TESTED_COMPONENT=src/libs/cplusplus
|
||||||
using namespace CPlusPlus;
|
using namespace CPlusPlus;
|
||||||
@@ -116,9 +117,17 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void passedMacroDefinitionCheck(unsigned /*offset*/,
|
virtual void passedMacroDefinitionCheck(unsigned /*offset*/,
|
||||||
unsigned /*line*/,
|
unsigned line,
|
||||||
const Macro &/*macro*/) {}
|
const Macro ¯o)
|
||||||
virtual void failedMacroDefinitionCheck(unsigned /*offset*/, const ByteArrayRef &/*name*/) {}
|
{
|
||||||
|
m_definitionsResolvedFromLines[macro.name()].append(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void failedMacroDefinitionCheck(unsigned /*offset*/,
|
||||||
|
const ByteArrayRef &name)
|
||||||
|
{
|
||||||
|
m_unresolvedDefines.insert(name.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
virtual void notifyMacroReference(unsigned offset, unsigned line, const Macro ¯o)
|
virtual void notifyMacroReference(unsigned offset, unsigned line, const Macro ¯o)
|
||||||
{
|
{
|
||||||
@@ -249,6 +258,12 @@ public:
|
|||||||
QHash<QByteArray, QList<unsigned> > macroUsesLine() const
|
QHash<QByteArray, QList<unsigned> > macroUsesLine() const
|
||||||
{ return m_macroUsesLine; }
|
{ return m_macroUsesLine; }
|
||||||
|
|
||||||
|
QHash<QByteArray, QList<unsigned> > definitionsResolvedFromLines() const
|
||||||
|
{ return m_definitionsResolvedFromLines; }
|
||||||
|
|
||||||
|
QSet<QByteArray> unresolvedDefines() const
|
||||||
|
{ return m_unresolvedDefines; }
|
||||||
|
|
||||||
const QList<int> macroArgsCount() const
|
const QList<int> macroArgsCount() const
|
||||||
{ return m_macroArgsCount; }
|
{ return m_macroArgsCount; }
|
||||||
|
|
||||||
@@ -266,6 +281,8 @@ private:
|
|||||||
QList<QByteArray> m_definedMacros;
|
QList<QByteArray> m_definedMacros;
|
||||||
QList<unsigned> m_definedMacrosLine;
|
QList<unsigned> m_definedMacrosLine;
|
||||||
QHash<QByteArray, QList<unsigned> > m_macroUsesLine;
|
QHash<QByteArray, QList<unsigned> > m_macroUsesLine;
|
||||||
|
QHash<QByteArray, QList<unsigned> > m_definitionsResolvedFromLines;
|
||||||
|
QSet<QByteArray> m_unresolvedDefines;
|
||||||
QList<int> m_macroArgsCount;
|
QList<int> m_macroArgsCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -326,6 +343,7 @@ private slots:
|
|||||||
void extra_va_args();
|
void extra_va_args();
|
||||||
void defined();
|
void defined();
|
||||||
void defined_data();
|
void defined_data();
|
||||||
|
void defined_usage();
|
||||||
void empty_macro_args();
|
void empty_macro_args();
|
||||||
void macro_args_count();
|
void macro_args_count();
|
||||||
void invalid_param_count();
|
void invalid_param_count();
|
||||||
@@ -356,6 +374,7 @@ private slots:
|
|||||||
void include_guard_data();
|
void include_guard_data();
|
||||||
void empty_trailing_lines();
|
void empty_trailing_lines();
|
||||||
void empty_trailing_lines_data();
|
void empty_trailing_lines_data();
|
||||||
|
void undef();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Remove all #... lines, and 'simplify' string, to allow easily comparing the result
|
// Remove all #... lines, and 'simplify' string, to allow easily comparing the result
|
||||||
@@ -1058,6 +1077,36 @@ void tst_Preprocessor::defined_data()
|
|||||||
"#endif\n";
|
"#endif\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_Preprocessor::defined_usage()
|
||||||
|
{
|
||||||
|
QByteArray output;
|
||||||
|
Environment env;
|
||||||
|
MockClient client(&env, &output);
|
||||||
|
Preprocessor pp(&client, &env);
|
||||||
|
QByteArray source =
|
||||||
|
"#define X\n"
|
||||||
|
"#define Y\n"
|
||||||
|
"#ifdef X\n"
|
||||||
|
"#endif\n"
|
||||||
|
"#ifdef Y\n"
|
||||||
|
"#endif\n"
|
||||||
|
"#ifndef X\n"
|
||||||
|
"#endif\n"
|
||||||
|
"#ifndef Y\n"
|
||||||
|
"#endif\n"
|
||||||
|
"#ifdef ABSENT\n"
|
||||||
|
"#endif\n"
|
||||||
|
"#ifndef ABSENT2\n"
|
||||||
|
"#endif\n"
|
||||||
|
;
|
||||||
|
pp.run(QLatin1String("<stdin>"), source);
|
||||||
|
QHash<QByteArray, QList<unsigned> > definitionsResolvedFromLines =
|
||||||
|
client.definitionsResolvedFromLines();
|
||||||
|
QCOMPARE(definitionsResolvedFromLines["X"], QList<unsigned>() << 3 << 7);
|
||||||
|
QCOMPARE(definitionsResolvedFromLines["Y"], QList<unsigned>() << 5 << 9);
|
||||||
|
QCOMPARE(client.unresolvedDefines(), QSet<QByteArray>() << "ABSENT" << "ABSENT2");
|
||||||
|
}
|
||||||
|
|
||||||
void tst_Preprocessor::dont_eagerly_expand_data()
|
void tst_Preprocessor::dont_eagerly_expand_data()
|
||||||
{
|
{
|
||||||
QTest::addColumn<QByteArray>("input");
|
QTest::addColumn<QByteArray>("input");
|
||||||
@@ -1691,6 +1740,46 @@ void tst_Preprocessor::empty_trailing_lines_data()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_Preprocessor::undef()
|
||||||
|
{
|
||||||
|
Environment env;
|
||||||
|
QByteArray output;
|
||||||
|
MockClient client(&env, &output);
|
||||||
|
Preprocessor preprocess(&client, &env);
|
||||||
|
QByteArray input =
|
||||||
|
"#define FOO\n"
|
||||||
|
"#define FOO2\n"
|
||||||
|
"#undef FOO\n"
|
||||||
|
"#undef BAR\n";
|
||||||
|
preprocess.run(QLatin1String("<stdin>"), input);
|
||||||
|
QCOMPARE(env.macroCount(), 4U);
|
||||||
|
Macro *macro = env.macroAt(0);
|
||||||
|
QCOMPARE(macro->name(), QByteArray("FOO"));
|
||||||
|
QCOMPARE(macro->offset(), 8U);
|
||||||
|
QCOMPARE(macro->line(), 1U);
|
||||||
|
QVERIFY(!macro->isHidden());
|
||||||
|
macro = env.macroAt(1);
|
||||||
|
QCOMPARE(macro->name(), QByteArray("FOO2"));
|
||||||
|
QCOMPARE(macro->offset(), 20U);
|
||||||
|
QCOMPARE(macro->line(), 2U);
|
||||||
|
QVERIFY(!macro->isHidden());
|
||||||
|
macro = env.macroAt(2);
|
||||||
|
QCOMPARE(macro->name(), QByteArray("FOO"));
|
||||||
|
QCOMPARE(macro->offset(), 32U);
|
||||||
|
QCOMPARE(macro->line(), 3U);
|
||||||
|
QVERIFY(macro->isHidden());
|
||||||
|
macro = env.macroAt(3);
|
||||||
|
QCOMPARE(macro->name(), QByteArray("BAR"));
|
||||||
|
QCOMPARE(macro->offset(), 43U);
|
||||||
|
QCOMPARE(macro->line(), 4U);
|
||||||
|
QVERIFY(macro->isHidden());
|
||||||
|
QList<QByteArray> macros = client.definedMacros();
|
||||||
|
QVERIFY(macros.contains("FOO"));
|
||||||
|
QVERIFY(macros.contains("FOO2"));
|
||||||
|
QCOMPARE(client.macroUsesLine()["FOO"], (QList<unsigned>() << 3U));
|
||||||
|
QVERIFY(client.macroUsesLine()["BAR"].isEmpty());
|
||||||
|
}
|
||||||
|
|
||||||
void tst_Preprocessor::compare_input_output(bool keepComments)
|
void tst_Preprocessor::compare_input_output(bool keepComments)
|
||||||
{
|
{
|
||||||
QFETCH(QByteArray, input);
|
QFETCH(QByteArray, input);
|
||||||
|
|||||||
@@ -131,6 +131,7 @@
|
|||||||
:Qt Creator.Help_Search for:_QLineEdit {leftWidget=':Qt Creator.Search for:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
:Qt Creator.Help_Search for:_QLineEdit {leftWidget=':Qt Creator.Search for:_QLabel' type='QLineEdit' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||||
:Qt Creator.Issues_QListView {type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'}
|
:Qt Creator.Issues_QListView {type='QListView' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow' windowTitle='Issues'}
|
||||||
:Qt Creator.Project.Menu.File_QMenu {name='Project.Menu.File' type='QMenu'}
|
:Qt Creator.Project.Menu.File_QMenu {name='Project.Menu.File' type='QMenu'}
|
||||||
|
:Qt Creator.Project.Menu.Folder_QMenu {name='Project.Menu.Folder' type='QMenu' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||||
:Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
:Qt Creator.QtCreator.MenuBar_QMenuBar {name='QtCreator.MenuBar' type='QMenuBar' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||||
:Qt Creator.ReRun_QToolButton {toolTip='Re-run this run-configuration' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
:Qt Creator.ReRun_QToolButton {toolTip='Re-run this run-configuration' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||||
:Qt Creator.Replace All_QToolButton {name='replaceAllButton' text='Replace All' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
:Qt Creator.Replace All_QToolButton {name='replaceAllButton' text='Replace All' type='QToolButton' visible='1' window=':Qt Creator_Core::Internal::MainWindow'}
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ def renameFile(projectDir, proFile, branch, oldname, newname):
|
|||||||
openItemContextMenu(treeview, itemText, 5, 5, 0)
|
openItemContextMenu(treeview, itemText, 5, 5, 0)
|
||||||
except:
|
except:
|
||||||
openItemContextMenu(treeview, addBranchWildcardToRoot(itemText), 5, 5, 0)
|
openItemContextMenu(treeview, addBranchWildcardToRoot(itemText), 5, 5, 0)
|
||||||
|
if oldname.endswith(".qrc"):
|
||||||
|
activateItem(waitForObjectItem(":Qt Creator.Project.Menu.Folder_QMenu", "Rename File"))
|
||||||
|
else:
|
||||||
activateItem(waitForObjectItem(":Qt Creator.Project.Menu.File_QMenu", "Rename..."))
|
activateItem(waitForObjectItem(":Qt Creator.Project.Menu.File_QMenu", "Rename..."))
|
||||||
type(waitForObject(":Qt Creator_Utils::NavigationTreeView::QExpandingLineEdit"), newname)
|
type(waitForObject(":Qt Creator_Utils::NavigationTreeView::QExpandingLineEdit"), newname)
|
||||||
type(waitForObject(":Qt Creator_Utils::NavigationTreeView::QExpandingLineEdit"), "<Return>")
|
type(waitForObject(":Qt Creator_Utils::NavigationTreeView::QExpandingLineEdit"), "<Return>")
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ def main():
|
|||||||
for project in projects:
|
for project in projects:
|
||||||
openQmakeProject(project)
|
openQmakeProject(project)
|
||||||
progressBarWait(20000)
|
progressBarWait(20000)
|
||||||
checkNavigator(49, "Verifying whether all projects have been opened.")
|
checkNavigator(68, "Verifying whether all projects have been opened.")
|
||||||
openDocument("propertyanimation.QML.qml.color-animation\\.qml")
|
openDocument("propertyanimation.QML.qml.color-animation\\.qml")
|
||||||
openDocument("declarative-music-browser.Headers.utility\\.h")
|
openDocument("declarative-music-browser.Headers.utility\\.h")
|
||||||
checkOpenDocuments(2, "Verifying whether 2 files are open.")
|
checkOpenDocuments(2, "Verifying whether 2 files are open.")
|
||||||
@@ -57,7 +57,7 @@ def main():
|
|||||||
switchSession(sessionName)
|
switchSession(sessionName)
|
||||||
test.verify(waitFor("sessionName in str(mainWindow.windowTitle)", 2000),
|
test.verify(waitFor("sessionName in str(mainWindow.windowTitle)", 2000),
|
||||||
"Verifying window title contains created session name.")
|
"Verifying window title contains created session name.")
|
||||||
checkNavigator(49, "Verifying whether all projects have been re-opened.")
|
checkNavigator(68, "Verifying whether all projects have been re-opened.")
|
||||||
checkOpenDocuments(2, "Verifying whether 2 files have been re-opened.")
|
checkOpenDocuments(2, "Verifying whether 2 files have been re-opened.")
|
||||||
if test.verify("utility.h" in str(mainWindow.windowTitle),
|
if test.verify("utility.h" in str(mainWindow.windowTitle),
|
||||||
"Verifying whether utility.h has been opened."):
|
"Verifying whether utility.h has been opened."):
|
||||||
|
|||||||
Reference in New Issue
Block a user