Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

This commit is contained in:
mae
2009-02-02 21:58:54 +01:00
54 changed files with 586 additions and 514 deletions

View File

@@ -216,7 +216,7 @@ QT_END_NAMESPACE
// comma-separated integer list
static char qDumpInBuffer[10000];
static char qDumpOutBuffer[100000];
static char qDumpSize[20];
//static char qDumpSize[20];
namespace {
@@ -309,10 +309,16 @@ static bool isSimpleType(const char *type)
return false;
}
static bool isShortKey(const char *type)
#if 0
static bool isStringType(const char *type)
{
return isSimpleType(type) || isEqual(type, NS"QString");
return isEqual(type, NS"QString")
|| isEqual(type, NS"QByteArray")
|| isEqual(type, "std::string")
|| isEqual(type, "std::wstring")
|| isEqual(type, "wstring");
}
#endif
static bool isMovableType(const char *type)
{
@@ -555,7 +561,7 @@ void QDumper::addCommaIfNeeded()
put(',');
}
void QDumper::putBase64Encoded(const char *buf, int n, char delim)
void QDumper::putBase64Encoded(const char *buf, int n)
{
const char alphabet[] = "ABCDEFGH" "IJKLMNOP" "QRSTUVWX" "YZabcdef"
"ghijklmn" "opqrstuv" "wxyz0123" "456789+/";
@@ -740,6 +746,7 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr
return;
case 'B':
if (isEqual(type, "QByteArray")) {
d.addCommaIfNeeded();
d << field << "encoded=\"1\",";
P(d, field, *(QByteArray*)addr);
}
@@ -769,6 +776,7 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr
return;
case 'S':
if (isEqual(type, "QString")) {
d.addCommaIfNeeded();
d << field << "encoded=\"1\",";
P(d, field, *(QString*)addr);
}
@@ -1086,13 +1094,15 @@ static void qDumpQHash(QDumper &d)
if (d.dumpChildren) {
if (n > 1000)
n = 1000;
bool simpleKey = isShortKey(keyType);
bool simpleValue = isShortKey(valueType);
bool isSimpleKey = isSimpleType(keyType);
bool isSimpleValue = isSimpleType(valueType);
bool opt = isOptimizedIntKey(keyType);
int keyOffset = hashOffset(opt, true, keySize, valueSize);
int valueOffset = hashOffset(opt, false, keySize, valueSize);
P(d, "extra", "simplekey: " << simpleKey << " simpleValue: " << simpleValue
P(d, "extra", "isSimpleKey: " << isSimpleKey
<< " isSimpleValue: " << isSimpleValue
<< " valueType: '" << isSimpleValue
<< " keySize: " << keyOffset << " valueOffset: " << valueOffset
<< " opt: " << opt);
@@ -1103,18 +1113,17 @@ static void qDumpQHash(QDumper &d)
d << ",children=[";
while (node != end) {
d.beginHash();
if (simpleKey) {
P(d, "name", i);
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
if (simpleValue)
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
P(d, "name", i);
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
if (isSimpleKey && isSimpleValue) {
P(d, "type", valueType);
P(d, "addr", addOffset(node, valueOffset));
} else {
P(d, "name", i);
//P(d, "exp", "*(char*)" << node);
P(d, "exp", "*('"NS"QHashNode<" << keyType << "," << valueType << " >'*)" << node);
P(d, "type", "'"NS"QHashNode<" << keyType << "," << valueType << " >'");
P(d, "exp", "*('"NS"QHashNode<" << keyType << ","
<< valueType << " >'*)" << node);
P(d, "type", "'"NS"QHashNode<" << keyType << ","
<< valueType << " >'");
}
d.endHash();
++i;
@@ -1131,15 +1140,18 @@ static void qDumpQHashNode(QDumper &d)
const char *keyType = d.templateParameters[0];
const char *valueType = d.templateParameters[1];
P(d, "value", "");
unsigned keySize = d.extraInt[0];
unsigned valueSize = d.extraInt[1];
bool opt = isOptimizedIntKey(keyType);
int keyOffset = hashOffset(opt, true, keySize, valueSize);
int valueOffset = hashOffset(opt, false, keySize, valueSize);
if (isSimpleType(valueType))
qDumpInnerValueHelper(d, valueType, addOffset(h, valueOffset));
else
P(d, "value", "");
P(d, "numchild", 2);
if (d.dumpChildren) {
unsigned keySize = d.extraInt[0];
unsigned valueSize = d.extraInt[1];
bool opt = isOptimizedIntKey(keyType);
int keyOffset = hashOffset(opt, true, keySize, valueSize);
int valueOffset = hashOffset(opt, false, keySize, valueSize);
// there is a hash specialization in cast the key are integers or shorts
d << ",children=[";
d.beginHash();
@@ -1262,8 +1274,8 @@ static void qDumpQLinkedList(QDumper &d)
P(d, "numchild", n);
P(d, "childtype", d.innertype);
if (d.dumpChildren) {
unsigned innerSize = d.extraInt[0];
bool innerTypeIsPointer = isPointerType(d.innertype);
//unsigned innerSize = d.extraInt[0];
//bool innerTypeIsPointer = isPointerType(d.innertype);
QByteArray strippedInnerType = stripPointerType(d.innertype);
const char *stripped =
isPointerType(d.innertype) ? strippedInnerType.data() : 0;
@@ -1397,13 +1409,13 @@ static void qDumpQMap(QDumper &d)
unsigned mapnodesize = d.extraInt[2];
unsigned valueOff = d.extraInt[3];
bool simpleKey = isShortKey(keyType);
bool simpleValue = isShortKey(valueType);
bool isSimpleKey = isSimpleType(keyType);
bool isSimpleValue = isSimpleType(valueType);
// both negative:
int keyOffset = 2 * sizeof(void*) - int(mapnodesize);
int valueOffset = 2 * sizeof(void*) - int(mapnodesize) + valueOff;
P(d, "extra", "simplekey: " << simpleKey << " simpleValue: " << simpleValue
P(d, "extra", "simplekey: " << isSimpleKey << " isSimpleValue: " << isSimpleValue
<< " keyOffset: " << keyOffset << " valueOffset: " << valueOffset
<< " mapnodesize: " << mapnodesize);
d << ",children=[";
@@ -1415,12 +1427,9 @@ static void qDumpQMap(QDumper &d)
while (node != end) {
d.beginHash();
P(d, "name", i);
if (simpleKey) {
P(d, "type", valueType);
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
if (simpleValue)
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
qDumpInnerValueHelper(d, keyType, addOffset(node, keyOffset), "key");
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
if (isSimpleKey && isSimpleValue) {
P(d, "type", valueType);
P(d, "addr", addOffset(node, valueOffset));
} else {
@@ -2194,35 +2203,38 @@ static void qDumpStdMap(QDumper &d)
// (#4, "std::allocator<std::pair<key, value> >")
// as it is there, and, equally importantly, in an order that
// gdb accepts when fed with it.
char *pairType = (char *)(d.templateParameters[3]) + 16;
char *pairType = (char *)(d.templateParameters[3]) + 15;
pairType[strlen(pairType) - 2] = 0;
P(d, "pairtype", pairType);
if (d.dumpChildren) {
bool simpleKey = isSimpleType(keyType);
bool simpleValue = isShortKey(valueType);
bool isSimpleKey = isSimpleType(keyType);
bool isSimpleValue = isSimpleType(valueType);
int valueOffset = d.extraInt[2];
P(d, "extra", "isSimpleKey: " << isSimpleKey
<< " isSimpleValue: " << isSimpleValue
<< " valueType: '" << valueType
<< " valueOffset: " << valueOffset);
d << ",children=[";
it = map.begin();
for (int i = 0; i < 1000 && it != map.end(); ++i, ++it) {
const void *node = it.operator->();
if (simpleKey) {
d.beginHash();
P(d, "type", valueType);
qDumpInnerValueHelper(d, keyType, node, "name");
P(d, "nameisindex", "1");
if (simpleValue)
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
P(d, "addr", addOffset(node, valueOffset));
d.endHash();
} else {
d.beginHash();
d.beginHash();
const void *node = it.operator->();
P(d, "name", i);
P(d, "addr", it.operator->());
P(d, "type", pairType);
d.endHash();
}
qDumpInnerValueHelper(d, keyType, node, "key");
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
if (isSimpleKey && isSimpleValue) {
P(d, "type", valueType);
P(d, "addr", addOffset(node, valueOffset));
P(d, "numchild", 0);
} else {
P(d, "addr", node);
P(d, "type", pairType);
P(d, "numchild", 2);
}
d.endHash();
}
if (it != map.end())
d.putEllipsis();

View File

@@ -110,7 +110,7 @@ PathChooser::PathChooser(QWidget *parent) :
connect(m_d->m_lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(changed()));
connect(m_d->m_lineEdit, SIGNAL(validChanged()), this, SIGNAL(validChanged()));
m_d->m_lineEdit->setMinimumWidth(260);
m_d->m_lineEdit->setMinimumWidth(200);
hLayout->addWidget(m_d->m_lineEdit);
hLayout->setSizeConstraint(QLayout::SetMinimumSize);

View File

@@ -291,7 +291,7 @@ void BookmarkView::gotoBookmark(const QModelIndex &index)
////
BookmarkContext::BookmarkContext(BookmarkView *widget)
: m_bookmarkView(widget)
: Core::IContext(widget), m_bookmarkView(widget)
{
m_context << UniqueIDManager::instance()->uniqueIdentifier(Constants::BOOKMARKS_CONTEXT);
}

View File

@@ -116,6 +116,8 @@ QWidget *ShortcutSettings::createPage(QWidget *parent)
commandChanged(0);
delete m_page;
return w;
}

View File

@@ -1249,6 +1249,8 @@ void EditorManager::addCurrentPositionToNavigationHistory(bool compress)
if ((previousLocation->editor && editor == previousLocation->editor)
|| (!fileName.isEmpty() && previousLocation->fileName == fileName)) {
firstIndexToRemove = m_d->currentNavigationHistoryPosition;
} else {
firstIndexToRemove = m_d->currentNavigationHistoryPosition+1;
}
} else {
firstIndexToRemove = m_d->currentNavigationHistoryPosition+1;

View File

@@ -69,6 +69,7 @@ OpenEditorsWidget::OpenEditorsWidget()
m_ui.editorList->setTextElideMode(Qt::ElideMiddle);
m_ui.editorList->installEventFilter(this);
m_ui.editorList->setFrameStyle(QFrame::NoFrame);
m_ui.editorList->setAttribute(Qt::WA_MacShowFocusRect, false);
EditorManager *em = EditorManager::instance();
m_ui.editorList->setModel(em->openedEditorsModel());
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)),

View File

@@ -74,7 +74,7 @@ QIcon FileIconProvider::icon(const QFileInfo &fileInfo)
// Disabled since for now we'll make sure that all icons fit with our
// own custom icons by returning an empty one if we don't know it.
#if 0
#ifdef Q_OS_WIN
// This is incorrect if the OS does not always return the same icon for the
// same suffix (Mac OS X), but should speed up the retrieval a lot ...
icon = m_systemIconProvider.icon(fileInfo);
@@ -127,7 +127,7 @@ void FileIconProvider::registerIconOverlayForSuffix(const QIcon &icon, const QSt
QIcon FileIconProvider::iconForSuffix(const QString &suffix) const
{
QIcon icon;
#ifndef Q_OS_WIN // On windows we use the file system icons
if (suffix.isEmpty())
return icon;
@@ -138,7 +138,7 @@ QIcon FileIconProvider::iconForSuffix(const QString &suffix) const
break;
}
}
#endif
return icon;
}

View File

@@ -64,7 +64,7 @@ QString GeneralSettings::trCategory() const
QWidget *GeneralSettings::createPage(QWidget *parent)
{
m_page = new Ui_GeneralSettings;
m_page = new Ui_GeneralSettings();
QWidget *w = new QWidget(parent);
m_page->setupUi(w);
@@ -77,7 +77,7 @@ QWidget *GeneralSettings::createPage(QWidget *parent)
this, SLOT(resetExternalEditor()));
connect(m_page->helpExternalEditorButton, SIGNAL(clicked()),
this, SLOT(showHelpForExternalEditor()));
delete m_page;
return w;
}

View File

@@ -1054,3 +1054,11 @@ void ManhattanStyle::drawComplexControl(ComplexControl control, const QStyleOpti
break;
}
}
// Mac style reimplements this to control the
// focus widget among other things
bool ManhattanStyle::event(QEvent *e)
{
Q_ASSERT(d->style);
return d->style->event(e);
}

View File

@@ -78,6 +78,9 @@ public:
void unpolish(QWidget *widget);
void unpolish(QApplication *app);
protected:
bool event(QEvent *e);
protected Q_SLOTS:
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget) const;
int layoutSpacingImplementation(QSizePolicy::ControlType control1,

View File

@@ -45,6 +45,7 @@
#include <CoreTypes.h>
#include <Literals.h>
#include <Semantic.h>
#include <SymbolVisitor.h>
#include <cplusplus/ExpressionUnderCursor.h>
#include <cplusplus/LookupContext.h>
#include <cplusplus/Overview.h>
@@ -100,6 +101,44 @@ public:
}
};
class FindFunctionDefinitions: protected SymbolVisitor
{
Name *_declarationName;
QList<Function *> *_functions;
public:
FindFunctionDefinitions()
: _declarationName(0),
_functions(0)
{ }
void operator()(Name *declarationName, Scope *globals,
QList<Function *> *functions)
{
_declarationName = declarationName;
_functions = functions;
for (unsigned i = 0; i < globals->symbolCount(); ++i) {
accept(globals->symbolAt(i));
}
}
protected:
using SymbolVisitor::visit;
virtual bool visit(Function *function)
{
Name *name = function->name();
if (QualifiedNameId *q = name->asQualifiedNameId())
name = q->unqualifiedNameId();
if (_declarationName->isEqualTo(name))
_functions->append(function);
return false;
}
};
} // end of anonymous namespace
QualifiedNameId *qualifiedNameIdForSymbol(Symbol *s, const LookupContext &context)
@@ -550,58 +589,60 @@ void CPPEditor::jumpToDefinition()
}
}
Symbol *CPPEditor::findDefinition(Symbol *lastSymbol)
Symbol *CPPEditor::findDefinition(Symbol *symbol)
{
// Currently only functions are supported
if (!lastSymbol->type()->isFunction())
return 0;
if (symbol->isFunction())
return 0; // symbol is a function definition.
QVector<Name *> qualifiedName;
Scope *scope = lastSymbol->scope();
for (; scope; scope = scope->enclosingScope()) {
if (scope->isClassScope() || scope->isNamespaceScope()) {
if (scope->owner() && scope->owner()->name()) {
Name *scopeOwnerName = scope->owner()->name();
if (QualifiedNameId *q = scopeOwnerName->asQualifiedNameId()) {
for (unsigned i = 0; i < q->nameCount(); ++i) {
qualifiedName.prepend(q->nameAt(i));
}
} else {
qualifiedName.prepend(scopeOwnerName);
}
}
Function *funTy = symbol->type()->asFunction();
if (! funTy)
return 0; // symbol does not have function type.
Name *name = symbol->name();
if (! name)
return 0; // skip anonymous functions!
if (QualifiedNameId *q = name->asQualifiedNameId())
name = q->unqualifiedNameId();
// map from file names to function definitions.
QMap<QString, QList<Function *> > functionDefinitions;
// find function definitions.
FindFunctionDefinitions findFunctionDefinitions;
// save the current snapshot
const Snapshot snapshot = m_modelManager->snapshot();
foreach (Document::Ptr doc, snapshot) {
if (Scope *globals = doc->globalSymbols()) {
QList<Function *> *localFunctionDefinitions =
&functionDefinitions[doc->fileName()];
findFunctionDefinitions(name, globals,
localFunctionDefinitions);
}
}
qualifiedName.append(lastSymbol->name());
// a dummy document.
Document::Ptr expressionDocument = Document::create("<empty>");
Control control;
QualifiedNameId *q = control.qualifiedNameId(&qualifiedName[0], qualifiedName.size());
LookupContext context(&control);
QMapIterator<QString, QList<Function *> > it(functionDefinitions);
while (it.hasNext()) {
it.next();
const Snapshot documents = m_modelManager->snapshot();
foreach (Document::Ptr doc, documents) {
QList<Scope *> visibleScopes;
visibleScopes.append(doc->globalSymbols());
visibleScopes = context.expand(visibleScopes);
//qDebug() << "** doc:" << doc->fileName() << "visible scopes:" << visibleScopes.count();
foreach (Scope *visibleScope, visibleScopes) {
Symbol *symbol = 0;
if (NameId *nameId = q->unqualifiedNameId()->asNameId())
symbol = visibleScope->lookat(nameId->identifier());
else if (DestructorNameId *dtorId = q->unqualifiedNameId()->asDestructorNameId())
symbol = visibleScope->lookat(dtorId->identifier());
else if (TemplateNameId *templNameId = q->unqualifiedNameId()->asTemplateNameId())
symbol = visibleScope->lookat(templNameId->identifier());
else if (OperatorNameId *opId = q->unqualifiedNameId()->asOperatorNameId())
symbol = visibleScope->lookat(opId->kind());
// ### cast operators
for (; symbol; symbol = symbol->next()) {
if (! symbol->isFunction())
continue;
else if (! isCompatible(symbol->asFunction(), lastSymbol, q))
continue;
return symbol;
// get the instance of the document.
Document::Ptr thisDocument = snapshot.value(it.key());
foreach (Function *f, it.value()) {
// create a lookup context
const LookupContext context(f, expressionDocument,
thisDocument, snapshot);
// search the matching definition for the function declaration `symbol'.
foreach (Symbol *s, context.resolve(f->name())) {
if (s == symbol)
return f;
}
}
}

View File

@@ -94,7 +94,6 @@ DebuggerSettings::DebuggerSettings()
m_skipKnownFrames = false;
m_debugDumpers = false;
m_useToolTips = false;
m_useTerminal = false;
m_useCustomDumpers = true;
}

View File

@@ -198,7 +198,6 @@ public:
bool m_debugDumpers;
bool m_useFastStart;
bool m_useToolTips;
bool m_useTerminal;
QString m_scriptFile;
};

View File

@@ -282,7 +282,6 @@ QWidget *GdbOptionPage::createPage(QWidget *parent)
m_ui.checkBoxUseCustomDumpers->setChecked(m_settings.m_useCustomDumpers);
m_ui.checkBoxFastStart->setChecked(m_settings.m_useFastStart);
m_ui.checkBoxUseToolTips->setChecked(m_settings.m_useToolTips);
m_ui.checkBoxUseTerminal->setChecked(m_settings.m_useTerminal);
#ifndef QT_DEBUG
#if 0
@@ -325,7 +324,6 @@ void GdbOptionPage::apply()
m_settings.m_useCustomDumpers = m_ui.checkBoxUseCustomDumpers->isChecked();
m_settings.m_useFastStart = m_ui.checkBoxFastStart->isChecked();
m_settings.m_useToolTips = m_ui.checkBoxUseToolTips->isChecked();
m_settings.m_useTerminal = m_ui.checkBoxUseTerminal->isChecked();
*m_plugin->m_manager->settings() = m_settings;
m_plugin->writeSettings();
@@ -892,7 +890,6 @@ void DebuggerPlugin::writeSettings() const
s->setValue("UseFastStart", m->m_useFastStart);
s->setValue("UseToolTips", m->m_useToolTips);
s->setValue("UseTerminal", m->m_useTerminal);
s->setValue("UseCustomDumpers", m->m_useCustomDumpers);
s->setValue("SkipKnowFrames", m->m_skipKnownFrames);
s->setValue("DebugDumpers", m->m_debugDumpers);
@@ -926,7 +923,6 @@ void DebuggerPlugin::readSettings()
m->m_useCustomDumpers = s->value("UseCustomDumpers", true).toBool();
m->m_useFastStart = s->value("UseFastStart", false).toBool();
m->m_useToolTips = s->value("UseToolTips", false).toBool();
m->m_useTerminal = s->value("UseTerminal", false).toBool();
s->endGroup();
m_manager->mainWindow()->restoreState(ba);

View File

@@ -2833,9 +2833,12 @@ static bool extractTemplate(const QString &type, QString *tmplate, QString *inne
// 'tmplate' and "Inner1@Inner2@..." etc in 'inner'. Result indicates
// whether parsing was successful
int level = 0;
bool skipSpace = false;
for (int i = 0; i != type.size(); ++i) {
QChar c = type[i];
if (c == '<') {
if (c == ' ' && skipSpace) {
skipSpace = false;
} else if (c == '<') {
*(level == 0 ? tmplate : inner) += c;
++level;
} else if (c == '>') {
@@ -2843,6 +2846,7 @@ static bool extractTemplate(const QString &type, QString *tmplate, QString *inne
*(level == 0 ? tmplate : inner) += c;
} else if (c == ',') {
*inner += (level == 1) ? '@' : ',';
skipSpace = true;
} else {
*(level == 0 ? tmplate : inner) += c;
}
@@ -2850,7 +2854,7 @@ static bool extractTemplate(const QString &type, QString *tmplate, QString *inne
*tmplate = tmplate->trimmed();
*tmplate = tmplate->remove("<>");
*inner = inner->trimmed();
//qDebug() << "EXTRACT TEMPLATE: " << *tmplate << *inner;
//qDebug() << "EXTRACT TEMPLATE: " << *tmplate << *inner << " FROM " << type;
return !inner->isEmpty();
}
@@ -3555,9 +3559,15 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
data1.name = '[' + data1.name + ']';
QString key = item.findChild("key").data();
if (!key.isEmpty()) {
if (item.findChild("keyencoded").data()[0] == '1')
if (item.findChild("keyencoded").data()[0] == '1') {
key = '"' + QByteArray::fromBase64(key.toUtf8()) + '"';
data1.name += " (" + key + ")";
if (key.size() > 13) {
key = key.left(12);
key += "...";
}
}
//data1.name += " (" + key + ")";
data1.name = key;
}
setWatchDataType(data1, item.findChild("type"));
setWatchDataExpression(data1, item.findChild("exp"));

View File

@@ -84,16 +84,6 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxUseTerminal">
<property name="toolTip">
<string>Start debugged process in a separte terminal.</string>
</property>
<property name="text">
<string>Start in terminal</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxFastStart">
<property name="toolTip">
@@ -107,9 +97,8 @@
<item>
<widget class="QCheckBox" name="checkBoxSkipKnownFrames">
<property name="toolTip">
<string>fter checking this option 'Step Into' combines in certain situations several steps, leading to 'less noisy' debugging. So will, e.g., the atomic
reference counting code be skipped, and a single 'Step Into' for a signal emission will end up directly in the slot connected to it.
</string>
<string>When this option is checked, 'Step Into' compresses several steps into one in certain situations, leading to 'less noisy' debugging. So will, e.g., the atomic
reference counting code be skipped, and a single 'Step Into' for a signal emission will end up directly in the slot connected to it.</string>
</property>
<property name="text">
<string>Skip known frames when stepping</string>
@@ -173,8 +162,6 @@ reference counting code be skipped, and a single 'Step Into' for a signal emissi
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../coreplugin/core.qrc"/>
</resources>
<resources/>
<connections/>
</ui>

View File

@@ -55,8 +55,8 @@ enum { INameRole = Qt::UserRole, VisualRole, ExpandedRole };
/////////////////////////////////////////////////////////////////////
WatchWindow::WatchWindow(Type type, QWidget *parent)
: QTreeView(parent), m_type(type)
, m_alwaysResizeColumnsToContents(true)
: QTreeView(parent)
, m_alwaysResizeColumnsToContents(true), m_type(type)
{
setWindowTitle(tr("Locals and Watchers"));
setAlternatingRowColors(true);

View File

@@ -348,6 +348,10 @@ public:
QPointer<QObject> m_extraData;
int m_cursorWidth;
void recordJump();
QList<int> m_jumpListUndo;
QList<int> m_jumpListRedo;
};
FakeVimHandler::Private::Private(FakeVimHandler *parent, QWidget *widget)
@@ -483,16 +487,18 @@ void FakeVimHandler::Private::finishMovement(const QString &dotCommand)
m_marks['>'] = m_tc.position();
if (m_submode == ChangeSubMode) {
if (m_moveType == MoveInclusive)
moveRight(); // correction
if (!dotCommand.isEmpty())
m_dotCommand = "c" + dotCommand;
QString text = recordRemoveSelectedText();
qDebug() << "CHANGING TO INSERT MODE" << text;
//qDebug() << "CHANGING TO INSERT MODE" << text;
m_registers[m_register] = text;
m_mode = InsertMode;
m_submode = NoSubMode;
} else if (m_submode == DeleteSubMode) {
if (m_moveType == MoveInclusive)
moveRight(); // correct
moveRight(); // correction
if (!dotCommand.isEmpty())
m_dotCommand = "d" + dotCommand;
m_registers[m_register] = recordRemoveSelectedText();
@@ -669,16 +675,13 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
moveToStartOfLine();
setAnchor();
moveDown(count());
moveLeft();
m_registers[m_register] = recordRemoveSelectedText();
m_submode = NoSubMode;
m_mode = InsertMode;
m_moveType = MoveLineWise;
finishMovement("c");
} else if (m_submode == DeleteSubMode && key == 'd') {
moveToStartOfLine();
setAnchor();
moveDown(count());
m_registers[m_register] = recordRemoveSelectedText();
m_moveType = MoveLineWise;
finishMovement("d");
} else if (m_submode == YankSubMode && key == 'y') {
moveToStartOfLine();
@@ -798,6 +801,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
m_lastSearchForward = (key == '*');
updateMiniBuffer();
search(needle, m_lastSearchForward);
recordJump();
} else if (key == '\'') {
m_subsubmode = TickSubSubMode;
} else if (key == '|') {
@@ -947,6 +951,11 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
moveToStartOfLine();
else
moveToFirstNonBlankOnLine();
} else if (key == control('i')) {
if (!m_jumpListRedo.isEmpty()) {
m_jumpListUndo.append(position());
m_tc.setPosition(m_jumpListRedo.takeLast());
}
} else if (key == 'j' || key == Key_Down) {
int savedColumn = m_desiredColumn;
if (m_submode == NoSubMode || m_submode == ZSubMode
@@ -986,6 +995,7 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
finishMovement();
m_desiredColumn = savedColumn;
} else if (key == 'l' || key == Key_Right) {
m_moveType = MoveExclusive;
moveRight(qMin(count(), rightDist()));
finishMovement();
} else if (key == 'L') {
@@ -1001,8 +1011,10 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
finishMovement();
} else if (key == 'n') {
search(lastSearchString(), m_lastSearchForward);
recordJump();
} else if (key == 'N') {
search(lastSearchString(), !m_lastSearchForward);
recordJump();
} else if (key == 'o' || key == 'O') {
recordBeginGroup();
recordMove();
@@ -1018,6 +1030,11 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
recordInsertText(QString(indentDist(), ' '));
else
recordInsertText(QString(numSpaces, ' '));
} else if (key == control('o')) {
if (!m_jumpListUndo.isEmpty()) {
m_jumpListRedo.append(position());
m_tc.setPosition(m_jumpListUndo.takeLast());
}
} else if (key == 'p' || key == 'P') {
recordBeginGroup();
QString text = m_registers[m_register];
@@ -1089,16 +1106,25 @@ bool FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
} else if (key == 'w') {
// Special case: "cw" and "cW" work the same as "ce" and "cE" if the
// cursor is on a non-blank.
if (m_submode == ChangeSubMode)
if (m_submode == ChangeSubMode) {
moveToWordBoundary(false, true);
else
m_moveType = MoveInclusive;
} else {
moveToNextWord(false);
m_moveType = MoveExclusive;
m_moveType = MoveExclusive;
}
finishMovement("w");
} else if (key == 'W') {
moveToNextWord(true);
if (m_submode == ChangeSubMode) {
moveToWordBoundary(true, true);
m_moveType = MoveInclusive;
} else {
moveToNextWord(true);
m_moveType = MoveExclusive;
}
finishMovement("W");
} else if (key == 'x') { // = "dl"
m_moveType = MoveExclusive;
if (atEndOfLine())
moveLeft();
recordBeginGroup();
@@ -1289,6 +1315,7 @@ bool FakeVimHandler::Private::handleMiniBufferModes(int key, int unmodified,
m_searchHistory.append(m_commandBuffer);
m_lastSearchForward = (m_mode == SearchForwardMode);
search(lastSearchString(), m_lastSearchForward);
recordJump();
}
enterCommandMode();
updateMiniBuffer();
@@ -2097,6 +2124,13 @@ void FakeVimHandler::Private::quit()
}
void FakeVimHandler::Private::recordJump()
{
m_jumpListUndo.append(position());
m_jumpListRedo.clear();
//qDebug() << m_jumpListUndo;
}
///////////////////////////////////////////////////////////////////////
//
// FakeVimHandler

View File

@@ -38,6 +38,7 @@
#include <coreplugin/coreconstants.h>
#include <coreplugin/findplaceholder.h>
#include <coreplugin/icore.h>
#include <coreplugin/stylehelper.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/command.h>
@@ -224,6 +225,16 @@ FindToolBar::~FindToolBar()
{
}
void FindToolBar::paintEvent(QPaintEvent *event)
{
QToolBar::paintEvent(event);
QPainter p(this);
const QRect r = rect();
p.setPen(StyleHelper::borderColor());
p.drawLine(r.topLeft(), r.topRight());
}
bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
{
if ((obj == m_ui.findEdit || obj == m_findCompleter->popup())

View File

@@ -58,6 +58,8 @@ public:
void invokeClearResults();
void paintEvent(QPaintEvent *event);
private slots:
void invokeFindNext();
void invokeFindPrevious();

View File

@@ -56,6 +56,7 @@ SearchResultWindow::SearchResultWindow()
m_searchResultTreeView = new SearchResultTreeView(m_widget);
m_searchResultTreeView->setUniformRowHeights(true);
m_searchResultTreeView->setFrameStyle(QFrame::NoFrame);
m_searchResultTreeView->setAttribute(Qt::WA_MacShowFocusRect, false);
m_widget->addWidget(m_searchResultTreeView);
m_noMatchesFoundDisplay = new QListWidget(m_widget);

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>389</width>
<width>403</width>
<height>183</height>
</rect>
</property>
@@ -25,16 +25,16 @@
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="pathlabel">
<property name="text">
<string>PATH:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="pathlabel">
<property name="text">
<string>PATH:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="pathLineEdit"/>
</item>
@@ -47,19 +47,23 @@
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="noteLabel">
<property name="text">
<string>&lt;b&gt;Note:&lt;/b&gt;</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="noteFieldlabel">
<property name="text">
<string>Git needs to find Perl in the environment as well.</string>
</property>
</widget>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="noteLabel">
<property name="text">
<string>&lt;b&gt;Note:&lt;/b&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="noteFieldlabel">
<property name="text">
<string>Git needs to find Perl in the environment as well.</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>

View File

@@ -248,8 +248,6 @@ void CentralWidget::setLastShownPages()
}
setSource(url);
}
updateBrowserFont();
}
bool CentralWidget::hasSelection() const
@@ -407,24 +405,6 @@ void CentralWidget::setSourceInNewTab(const QUrl &url)
tabWidget->setCurrentIndex(tabWidget->addTab(viewer,
quoteTabTitle(viewer->documentTitle())));
#if defined(QT_NO_WEBIT)
QFont font = qApp->font();
if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool())
font = qVariantValue<QFont>(helpEngine->customValue(QLatin1String("browserFont")));
viewer->setFont(font);
#else
QWebView* view = qobject_cast<QWebView*> (viewer);
if (view) {
QWebSettings* settings = QWebSettings::globalSettings();
int fontSize = settings->fontSize(QWebSettings::DefaultFontSize);
QString fontFamily = settings->fontFamily(QWebSettings::StandardFont);
settings = view->settings();
settings->setFontSize(QWebSettings::DefaultFontSize, fontSize);
settings->setFontFamily(QWebSettings::StandardFont, fontFamily);
}
#endif
connectSignals();
}
@@ -612,36 +592,6 @@ bool CentralWidget::eventFilter(QObject *object, QEvent *e)
return QWidget::eventFilter(object, e);
}
void CentralWidget::updateBrowserFont()
{
#if defined(QT_NO_WEBKIT)
QFont font = qApp->font();
if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool())
font = qVariantValue<QFont>(helpEngine->customValue(QLatin1String("browserFont")));
QWidget* widget = 0;
for (int i = 0; i < tabWidget->count(); ++i) {
widget = tabWidget->widget(i);
if (widget->font() != font)
widget->setFont(font);
}
#else
QWebSettings* settings = QWebSettings::globalSettings();
int fontSize = settings->fontSize(QWebSettings::DefaultFontSize);
QString fontFamily = settings->fontFamily(QWebSettings::StandardFont);
QWebView* widget = 0;
for (int i = 0; i < tabWidget->count(); ++i) {
widget = qobject_cast<QWebView*> (tabWidget->widget(i));
if (widget) {
settings = widget->settings();
settings->setFontSize(QWebSettings::DefaultFontSize, fontSize);
settings->setFontFamily(QWebSettings::StandardFont, fontFamily);
}
}
#endif
}
bool CentralWidget::find(const QString &txt, QTextDocument::FindFlags findFlags,
bool incremental)
{

View File

@@ -98,7 +98,6 @@ public slots:
void print();
void pageSetup();
void printPreview();
void updateBrowserFont();
void setSource(const QUrl &url);
void setSourceInNewTab(const QUrl &url);
HelpViewer *newEmptyTab();

View File

@@ -51,9 +51,9 @@ namespace ProjectExplorer {
It should be used as a base class if your buildstep just needs to run a process.
Usage:
Use setCommand(), setArguments(), setWorkingDirectory() to specify the process you want to run.
(You need to do that before calling AbstractProcess::init())
Inside YourBuildStep::init() call AbstractProcessStep::init()
Use setCommand(), setArguments(), setWorkingDirectory() to specify the process you want to run
(you need to do that before calling AbstractProcessStep::init()).
Inside YourBuildStep::init() call AbstractProcessStep::init().
Inside YourBuildStep::run() call AbstractProcessStep::run(), which automatically starts the proces
and by default adds the output on stdOut and stdErr to the OutputWindow.
If you need to process the process output override stdOut() and/or stdErr.

View File

@@ -46,29 +46,36 @@ ConsoleProcess::~ConsoleProcess()
{
}
static QString shellEscape(const QString &in)
{
QString out = in;
out.replace('\'', "'\''");
out.prepend('\'');
out.append('\'');
return out;
}
bool ConsoleProcess::start(const QString &program, const QStringList &args)
{
if (m_process->state() != QProcess::NotRunning)
return false;
QString shellArgs;
shellArgs += QLatin1String("cd ");
shellArgs += workingDirectory();
shellArgs += shellEscape(workingDirectory());
shellArgs += QLatin1Char(';');
shellArgs += program;
shellArgs += shellEscape(program);
foreach (const QString &arg, args) {
shellArgs += QLatin1Char(' ');
shellArgs += QLatin1Char('\'');
shellArgs += arg;
shellArgs += QLatin1Char('\'');
shellArgs += shellEscape(arg);
}
shellArgs += QLatin1String("; echo; echo \"Press enter to close this window\"; read");
shellArgs += QLatin1String("; echo; echo \"Press enter to close this window\"; read DUMMY");
m_process->setEnvironment(environment());
connect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(processFinished(int, QProcess::ExitStatus)));
m_process->start(QLatin1String("xterm"), QStringList() << QLatin1String("-e") << shellArgs);
m_process->start(QLatin1String("xterm"), QStringList() << QLatin1String("-e") << "/bin/sh" << "-c" << shellArgs);
if (!m_process->waitForStarted())
return false;
emit processStarted();

View File

@@ -54,46 +54,34 @@ CustomExecutableConfigurationWidget::CustomExecutableConfigurationWidget(CustomE
QFormLayout *layout = new QFormLayout();
layout->setMargin(0);
m_executableLineEdit = new QLineEdit;
QToolButton *exectuableToolButton = new QToolButton();
exectuableToolButton->setText("...");
QHBoxLayout *hl = new QHBoxLayout;
hl->addWidget(m_executableLineEdit);
hl->addWidget(exectuableToolButton);
layout->addRow("Executable", hl);
m_executableChooser = new Core::Utils::PathChooser();
m_executableChooser->setExpectedKind(Core::Utils::PathChooser::File);
layout->addRow("Executable:", m_executableChooser);
m_commandLineArgumentsLineEdit = new QLineEdit;
layout->addRow("Arguments", m_commandLineArgumentsLineEdit);
m_commandLineArgumentsLineEdit->setMinimumWidth(200); // this shouldn't be fixed here...
layout->addRow("Arguments:", m_commandLineArgumentsLineEdit);
m_workingDirectoryLineEdit = new QLineEdit();
QToolButton *workingDirectoryToolButton = new QToolButton();
workingDirectoryToolButton->setText("...");
hl = new QHBoxLayout;
hl->addWidget(m_workingDirectoryLineEdit);
hl->addWidget(workingDirectoryToolButton);
layout->addRow("Working Directory", hl);
m_workingDirectory = new Core::Utils::PathChooser();
layout->addRow("Working Directory:", m_workingDirectory);
setLayout(layout);
changed();
connect(m_executableLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(setExecutable(const QString&)));
connect(m_executableChooser, SIGNAL(changed()),
this, SLOT(setExecutable()));
connect(m_commandLineArgumentsLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(setCommandLineArguments(const QString&)));
connect(m_workingDirectoryLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(setWorkingDirectory(const QString&)));
connect(exectuableToolButton, SIGNAL(clicked(bool)),
this, SLOT(executableToolButtonClicked()));
connect(workingDirectoryToolButton, SIGNAL(clicked(bool)),
this, SLOT(workingDirectoryToolButtonClicked()));
connect(m_workingDirectory, SIGNAL(changed()),
this, SLOT(setWorkingDirectory()));
connect(m_runConfiguration, SIGNAL(changed()), this, SLOT(changed()));
}
void CustomExecutableConfigurationWidget::setExecutable(const QString &executable)
void CustomExecutableConfigurationWidget::setExecutable()
{
m_ignoreChange = true;
m_runConfiguration->setExecutable(executable);
m_runConfiguration->setExecutable(m_executableChooser->path());
m_ignoreChange = false;
}
void CustomExecutableConfigurationWidget::setCommandLineArguments(const QString &commandLineArguments)
@@ -102,47 +90,21 @@ void CustomExecutableConfigurationWidget::setCommandLineArguments(const QString
m_runConfiguration->setCommandLineArguments(commandLineArguments);
m_ignoreChange = false;
}
void CustomExecutableConfigurationWidget::setWorkingDirectory(const QString &workingDirectory)
void CustomExecutableConfigurationWidget::setWorkingDirectory()
{
m_ignoreChange = true;
m_runConfiguration->setWorkingDirectory(workingDirectory);
m_runConfiguration->setWorkingDirectory(m_workingDirectory->path());
m_ignoreChange = false;
}
void CustomExecutableConfigurationWidget::executableToolButtonClicked()
{
QString newValue;
QString executableFilter;
#ifdef Q_OS_WIN
executableFilter = "Executable (*.exe)";
#endif
newValue = QFileDialog::getOpenFileName(this, "Executable", "", executableFilter);
if (!newValue.isEmpty()) {
m_executableLineEdit->setText(newValue);
setExecutable(newValue);
}
}
void CustomExecutableConfigurationWidget::workingDirectoryToolButtonClicked()
{
QString newValue;
QString executableFilter;
newValue = QFileDialog::getExistingDirectory(this, "Directory", m_workingDirectoryLineEdit->text());
if (newValue.isEmpty()) {
m_workingDirectoryLineEdit->setText(newValue);
setWorkingDirectory(newValue);
}
}
void CustomExecutableConfigurationWidget::changed()
{
// We triggered the change, don't update us
if (m_ignoreChange)
return;
m_executableLineEdit->setText(m_runConfiguration->baseExecutable());
m_executableChooser->setPath(m_runConfiguration->baseExecutable());
m_commandLineArgumentsLineEdit->setText(ProjectExplorer::Environment::joinArgumentList(m_runConfiguration->commandLineArguments()));
m_workingDirectoryLineEdit->setText(m_runConfiguration->baseWorkingDirectory());
m_workingDirectory->setPath(m_runConfiguration->baseWorkingDirectory());
}
CustomExecutableRunConfiguration::CustomExecutableRunConfiguration(Project *pro)

View File

@@ -36,6 +36,8 @@
#include "applicationrunconfiguration.h"
#include <utils/pathchooser.h>
#include <QtGui/QToolButton>
QT_BEGIN_NAMESPACE
@@ -108,18 +110,16 @@ public:
CustomExecutableConfigurationWidget(CustomExecutableRunConfiguration *rc);
private slots:
void changed();
void executableToolButtonClicked();
void workingDirectoryToolButtonClicked();
void setExecutable(const QString &executable);
void setExecutable();
void setCommandLineArguments(const QString &commandLineArguments);
void setWorkingDirectory(const QString &workingDirectory);
void setWorkingDirectory();
private:
bool m_ignoreChange;
CustomExecutableRunConfiguration *m_runConfiguration;
QLineEdit *m_executableLineEdit;
Core::Utils::PathChooser *m_executableChooser;
QLineEdit *m_commandLineArgumentsLineEdit;
QLineEdit *m_workingDirectoryLineEdit;
Core::Utils::PathChooser *m_workingDirectory;
};
}
}

View File

@@ -89,6 +89,7 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent)
m_filter->setSourceModel(m_dirModel);
m_view->setModel(m_filter);
m_view->setFrameStyle(QFrame::NoFrame);
m_view->setAttribute(Qt::WA_MacShowFocusRect, false);
setFocusProxy(m_view);
QVBoxLayout *layout = new QVBoxLayout();

View File

@@ -136,17 +136,14 @@ ProcessStepConfigWidget::ProcessStepConfigWidget(ProcessStep *step)
: m_step(step)
{
m_ui.setupUi(this);
connect(m_ui.commandBrowseButton, SIGNAL(clicked(bool)),
this, SLOT(commandBrowseButtonClicked()));
connect(m_ui.workingDirBrowseButton, SIGNAL(clicked(bool)),
this, SLOT(workingDirBrowseButtonClicked()));
m_ui.command->setExpectedKind(Core::Utils::PathChooser::File);
connect(m_ui.command, SIGNAL(changed()),
this, SLOT(commandLineEditTextEdited()));
connect(m_ui.workingDirectory, SIGNAL(changed()),
this, SLOT(workingDirectoryLineEditTextEdited()));
connect(m_ui.nameLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(nameLineEditTextEdited()));
connect(m_ui.commandLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(commandLineEditTextEdited()));
connect(m_ui.workingDirectoryLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(workingDirectoryLineEditTextEdited()));
connect(m_ui.commandArgumentsLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(commandArgumentsLineEditTextEdited()));
connect(m_ui.enabledGroupBox, SIGNAL(clicked(bool)),
@@ -158,34 +155,16 @@ QString ProcessStepConfigWidget::displayName() const
return m_step->name();
}
void ProcessStepConfigWidget::workingDirBrowseButtonClicked()
{
QString workingDirectory = QFileDialog::getExistingDirectory(this, "Select the working directory", m_ui.workingDirectoryLineEdit->text());
if (workingDirectory.isEmpty())
return;
m_ui.workingDirectoryLineEdit->setText(workingDirectory);
workingDirectoryLineEditTextEdited();
}
void ProcessStepConfigWidget::commandBrowseButtonClicked()
{
QString filename = QFileDialog::getOpenFileName(this, "Select the executable");
if (filename.isEmpty())
return;
m_ui.commandLineEdit->setText(filename);
commandLineEditTextEdited();
}
void ProcessStepConfigWidget::init(const QString &buildConfiguration)
{
m_buildConfiguration = buildConfiguration;
if (buildConfiguration != QString::null) {
m_ui.commandLineEdit->setText(m_step->command(buildConfiguration));
m_ui.command->setPath(m_step->command(buildConfiguration));
QString workingDirectory = m_step->value(buildConfiguration, "workingDirectory").toString();
if (workingDirectory.isEmpty())
workingDirectory = "$BUILDDIR";
m_ui.workingDirectoryLineEdit->setText(workingDirectory);
m_ui.workingDirectory->setPath(workingDirectory);
m_ui.commandArgumentsLineEdit->setText(m_step->arguments(buildConfiguration).join(" "));
m_ui.enabledGroupBox->setChecked(m_step->enabled(buildConfiguration));
@@ -200,12 +179,12 @@ void ProcessStepConfigWidget::nameLineEditTextEdited()
void ProcessStepConfigWidget::commandLineEditTextEdited()
{
m_step->setCommand(m_buildConfiguration, m_ui.commandLineEdit->text());
m_step->setCommand(m_buildConfiguration, m_ui.command->path());
}
void ProcessStepConfigWidget::workingDirectoryLineEditTextEdited()
{
QString wd = m_ui.workingDirectoryLineEdit->text();
QString wd = m_ui.workingDirectory->path();
m_step->setValue(m_buildConfiguration, "workingDirectory", wd);
}

View File

@@ -84,8 +84,6 @@ private slots:
void workingDirectoryLineEditTextEdited();
void commandArgumentsLineEditTextEdited();
void enabledGroupBoxClicked(bool);
void workingDirBrowseButtonClicked();
void commandBrowseButtonClicked();
private:
QString m_buildConfiguration;
ProcessStep *m_step;

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>428</width>
<height>222</height>
<width>505</width>
<height>271</height>
</rect>
</property>
<property name="windowTitle">
@@ -22,61 +22,50 @@
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="nameLineEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="commandLabel">
<property name="text">
<string>Command</string>
<string>Command:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="commandLineEdit"/>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="commandBrowseButton">
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="Core::Utils::PathChooser" name="command"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="workingDirecoryLabel">
<property name="text">
<string>Working Directory</string>
<string>Working Directory:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="workingDirectoryLineEdit"/>
</item>
<item row="2" column="2">
<widget class="QToolButton" name="workingDirBrowseButton">
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="Core::Utils::PathChooser" name="workingDirectory"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="commandArgumentsLabel">
<property name="text">
<string>command arguments</string>
<string>Command Arguments:</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<item row="3" column="1">
<widget class="QLineEdit" name="commandArgumentsLineEdit"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="nameLineEdit"/>
</item>
</layout>
</widget>
</item>
@@ -95,6 +84,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Core::Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -75,6 +75,7 @@ public:
setUniformRowHeights(true);
setTextElideMode(Qt::ElideNone);
// setExpandsOnDoubleClick(false);
setAttribute(Qt::WA_MacShowFocusRect, false);
}
protected:

View File

@@ -34,11 +34,17 @@
</item>
<item>
<widget class="QComboBox" name="runConfigurationCombo">
<property name="maximumSize">
<size>
<width>500</width>
<height>16777215</height>
</size>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContents</enum>
</property>
<property name="minimumContentsLength">
<number>30</number>
<number>15</number>
</property>
</widget>
</item>

View File

@@ -265,6 +265,7 @@ TaskWindow::TaskWindow()
m_listview->setItemDelegate(tld);
m_listview->setWindowIcon(QIcon(":/qt4projectmanager/images/window.png"));
m_listview->setContextMenuPolicy(Qt::ActionsContextMenu);
m_listview->setAttribute(Qt::WA_MacShowFocusRect, false);
m_taskWindowContext = new TaskWindowContext(m_listview);
core->addContextObject(m_taskWindowContext);
@@ -577,7 +578,7 @@ void TaskDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
}
TaskWindowContext::TaskWindowContext(QWidget *widget)
: m_taskList(widget)
: Core::IContext(widget), m_taskList(widget)
{
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_context << uidm->uniqueIdentifier(Core::Constants::C_PROBLEM_PANE);

View File

@@ -22,7 +22,7 @@
<item row="0" column="0">
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Configuration Name</string>
<string>Configuration Name:</string>
</property>
</widget>
</item>
@@ -45,7 +45,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Qt Version</string>
<string>Qt Version:</string>
</property>
</widget>
</item>
@@ -93,7 +93,7 @@
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Shadow Build</string>
<string>Shadow Build:</string>
</property>
</widget>
</item>
@@ -113,7 +113,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Build Directory</string>
<string>Build Directory:</string>
</property>
</widget>
</item>

View File

@@ -845,7 +845,7 @@ void Qt4ProFileNode::updateUiFiles()
}
addFileNodes(toAdd, this);
}
modelManager->updateSourceFiles(toUpdate);
m_project->addUiFilesToCodeModel(toUpdate);
}
ProFileReader *Qt4PriFileNode::createProFileReader() const

View File

@@ -255,6 +255,10 @@ Qt4Project::Qt4Project(Qt4Manager *manager, const QString& fileName) :
m_updateCodeModelTimer.setSingleShot(true);
m_updateCodeModelTimer.setInterval(20);
connect(&m_updateCodeModelTimer, SIGNAL(timeout()), this, SLOT(updateCodeModel()));
m_addUiFilesTimer.setSingleShot(true);
m_addUiFilesTimer.setInterval(20);
connect(&m_addUiFilesTimer, SIGNAL(timeout()), this, SLOT(addUiFiles()));
}
Qt4Project::~Qt4Project()
@@ -370,6 +374,27 @@ namespace {
};
}
void Qt4Project::addUiFilesToCodeModel(const QStringList &files)
{
// if we already have a full updateCodeModel() scheduled
// then we don't need to this seperately
// since that one will add also all the ui files
if (m_updateCodeModelTimer.isActive())
return;
m_addUiFilesTimer.start();
m_uiFilesToAdd << files;
}
void Qt4Project::addUiFiles()
{
if (m_updateCodeModelTimer.isActive())
return;
CppTools::CppModelManagerInterface *modelManager =
ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>();
modelManager->updateSourceFiles(m_uiFilesToAdd);
m_uiFilesToAdd.clear();
}
void Qt4Project::scheduleUpdateCodeModel()
{
m_updateCodeModelTimer.start();

View File

@@ -182,6 +182,9 @@ public:
void notifyChanged(const QString &name);
// called by qt4ProjectNode to add ui_*.h files to the codemodel
void addUiFilesToCodeModel(const QStringList &files);
public slots:
void update();
void proFileParseError(const QString &errorMessage);
@@ -200,6 +203,7 @@ private slots:
const Qt4ProjectManager::Internal::Qt4ProjectType oldType,
const Qt4ProjectManager::Internal::Qt4ProjectType newType);
void proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode *node);
void addUiFiles();
protected:
virtual void restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader &settingsReader);
@@ -232,6 +236,8 @@ private:
Internal::Qt4ProjectFiles *m_projectFiles;
QTimer m_updateCodeModelTimer;
QTimer m_addUiFilesTimer;
QStringList m_uiFilesToAdd;
Internal::GCCPreprocessor m_preproc;
friend class Qt4ProjectFile;

View File

@@ -247,6 +247,7 @@ QString Qt4RunConfiguration::proFilePath() const
void Qt4RunConfiguration::updateCachedValues()
{
ProFileReader *reader = static_cast<Qt4Project *>(project())->createProFileReader();
reader->setCumulative(false);
if (!reader->readProFile(m_proFilePath)) {
delete reader;
Core::ICore::instance()->messageManager()->printToOutputPane(QString("Could not parse %1. The Qt4 run configuration %2 can not be started.").arg(m_proFilePath).arg(name()));

View File

@@ -56,9 +56,7 @@ QT_END_NAMESPACE
#include <QtCore/QFileInfo>
#include <QtCore/QFile>
#include <QtCore/QTimer>
#include <QtCore/QRegExp>
#include <QtCore/QSettings>
#include <QtCore/QDebug>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QContextMenuEvent>

View File

@@ -38,7 +38,6 @@ namespace ResourceEditor {
namespace Constants {
const char * const C_RESOURCEEDITOR = "Resource Editor";
const char * const C_RESOURCEWINDOW = "Resourcewindow";
const char * const C_RESOURCE_MIMETYPE = "application/vnd.nokia.xml.qt.resource";
} // namespace Constants

View File

@@ -161,7 +161,7 @@ bool ResourceEditorFile::save(const QString &name /*= QString()*/)
}
const char *ResourceEditorW::kind() const {
return ResourceEditor::Constants::C_RESOURCEWINDOW;
return ResourceEditor::Constants::C_RESOURCEEDITOR;
}
QString ResourceEditorFile::fileName() const

View File

@@ -215,9 +215,9 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QHBoxLayout" name="cleanIndentationLayout">
<item>
<spacer name="horizontalSpacer_3">
<spacer name="cleanIndentationSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>

View File

@@ -2508,7 +2508,8 @@ bool Parser::parseBoolLiteral(ExpressionAST *&node)
bool Parser::parseNumericLiteral(ExpressionAST *&node)
{
if (LA() == T_INT_LITERAL || LA() == T_FLOAT_LITERAL || LA() == T_CHAR_LITERAL) {
if (LA() == T_INT_LITERAL || LA() == T_FLOAT_LITERAL ||
LA() == T_CHAR_LITERAL || LA() == T_WIDE_CHAR_LITERAL) {
NumericLiteralAST *ast = new (_pool) NumericLiteralAST;
ast->token = consumeToken();
node = ast;

View File

@@ -39,7 +39,7 @@
#include <QtGui/QFileDialog>
#include <QtGui/QMessageBox>
namespace SharedTools {
using namespace SharedTools;
QrcEditor::QrcEditor(QWidget *parent)
: QWidget(parent),
@@ -96,8 +96,6 @@ QrcEditor::QrcEditor(QWidget *parent)
connect(&m_history, SIGNAL(canRedoChanged(bool)), this, SLOT(updateHistoryControls()));
connect(&m_history, SIGNAL(canUndoChanged(bool)), this, SLOT(updateHistoryControls()));
connect(&m_history, SIGNAL(canRedoChanged(bool)), this, SLOT(updateCurrent()));
connect(&m_history, SIGNAL(canUndoChanged(bool)), this, SLOT(updateCurrent()));
updateHistoryControls();
updateCurrent();
}
@@ -151,28 +149,21 @@ void QrcEditor::updateCurrent()
const bool isValid = m_treeview->currentIndex().isValid();
const bool isPrefix = m_treeview->isPrefix(m_treeview->currentIndex()) && isValid;
const bool isFile = !isPrefix && isValid;
int cursorPosition;
m_ui.aliasLabel->setEnabled(isFile);
m_ui.aliasText->setEnabled(isFile);
m_currentAlias = m_treeview->currentAlias();
cursorPosition = m_ui.aliasText->cursorPosition();
m_ui.aliasText->setText(m_currentAlias);
m_ui.aliasText->setCursorPosition(cursorPosition);
m_ui.prefixLabel->setEnabled(isPrefix);
m_ui.prefixText->setEnabled(isPrefix);
m_currentPrefix = m_treeview->currentPrefix();
cursorPosition = m_ui.prefixText->cursorPosition();
m_ui.prefixText->setText(m_currentPrefix);
m_ui.prefixText->setCursorPosition(cursorPosition);
m_ui.languageLabel->setEnabled(isPrefix);
m_ui.languageText->setEnabled(isPrefix);
m_currentLanguage = m_treeview->currentLanguage();
cursorPosition = m_ui.languageText->cursorPosition();
m_ui.languageText->setText(m_currentLanguage);
m_ui.languageText->setCursorPosition(cursorPosition);
m_ui.addButton->setEnabled(true);
m_addFileAction->setEnabled(isValid);
@@ -225,7 +216,6 @@ void QrcEditor::resolveLocationIssues(QStringList &files)
QMessageBox message(this);
message.setWindowTitle(tr("Invalid file"));
message.setIcon(QMessageBox::Warning);
QPushButton * const continueButton = message.addButton(tr("Add anyway"), QMessageBox::AcceptRole);
QPushButton * const copyButton = message.addButton(tr("Copy"), QMessageBox::ActionRole);
QPushButton * const skipButton = message.addButton(tr("Don't add"), QMessageBox::DestructiveRole);
QPushButton * const abortButton = message.addButton(tr("Abort"), QMessageBox::RejectRole);
@@ -234,9 +224,7 @@ void QrcEditor::resolveLocationIssues(QStringList &files)
message.setText(tr("The file %1 is not in a subdirectory of the resource file. Continuing will result in an invalid resource file.")
.arg(QDir::toNativeSeparators(file)));
message.exec();
if (message.clickedButton() == continueButton) {
continue;
} else if (message.clickedButton() == skipButton) {
if (message.clickedButton() == skipButton) {
files.removeAt(i);
count--;
i--; // Compensate i++
@@ -246,6 +234,11 @@ void QrcEditor::resolveLocationIssues(QStringList &files)
const QString copyName = QFileDialog::getSaveFileName(this, tr("Choose copy location"),
suggestion.absoluteFilePath());
if (!copyName.isEmpty()) {
QString relPath = dir.relativeFilePath(copyName);
if (relPath.startsWith(dotdotSlash)) { // directory is still invalid
i--; // Compensate i++ and try again
continue;
}
if (QFile::exists(copyName)) {
if (!QFile::remove(copyName)) {
QMessageBox::critical(this, tr("Overwrite failed"),
@@ -405,5 +398,3 @@ void QrcEditor::onRedo()
updateCurrent();
updateHistoryControls();
}
} // namespace SharedTools

View File

@@ -54,6 +54,19 @@ TRANSLATOR qdesigner_internal::ResourceModel
namespace qdesigner_internal {
/******************************************************************************
** FileList
*/
bool FileList::containsFile(File *file)
{
foreach (const File *tmpFile, *this)
if (tmpFile->name == file->name && tmpFile->prefix() == file->prefix())
return true;
return false;
}
/******************************************************************************
** ResourceFile
*/
@@ -155,7 +168,7 @@ bool ResourceFile::save()
foreach (const QString &name, name_list) {
FileList file_list;
QString lang;
foreach (Prefix *pref, m_prefix_list) {
foreach (const Prefix *pref, m_prefix_list) {
if (pref->name == name){
file_list += pref->file_list;
lang = pref->lang;
@@ -375,7 +388,7 @@ bool ResourceFile::contains(const QString &prefix, const QString &file) const
Prefix * const p = m_prefix_list.at(pref_idx);
Q_ASSERT(p);
File equalFile(p, absolutePath(file));
return p->file_list.contains(&equalFile);
return p->file_list.containsFile(&equalFile);
}
bool ResourceFile::contains(int pref_idx, const QString &file) const
@@ -383,7 +396,7 @@ bool ResourceFile::contains(int pref_idx, const QString &file) const
Q_ASSERT(pref_idx >= 0 && pref_idx < m_prefix_list.count());
Prefix * const p = m_prefix_list.at(pref_idx);
File equalFile(p, absolutePath(file));
return p->file_list.contains(&equalFile);
return p->file_list.containsFile(&equalFile);
}
/*static*/ QString ResourceFile::fixPrefix(const QString &prefix)
@@ -586,7 +599,7 @@ bool ResourceModel::iconFileExtension(const QString &path)
}
}
foreach (QString ext, ext_list) {
foreach (const QString &ext, ext_list) {
if (path.endsWith(ext, Qt::CaseInsensitive))
return true;
}
@@ -606,12 +619,12 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
if (!index.isValid())
return QVariant();
void * const internalPointer = index.internalPointer();
Node * const node = reinterpret_cast<Node *>(internalPointer);
Prefix const * const prefix = node->prefix();
File const * const file = node->file();
const void *internalPointer = index.internalPointer();
const Node *node = reinterpret_cast<const Node *>(internalPointer);
const Prefix *prefix = node->prefix();
File *file = node->file();
Q_ASSERT(prefix);
bool const isFileNode = (prefix != node);
const bool isFileNode = (prefix != node);
QVariant result;
@@ -628,7 +641,8 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
} else {
// File node
Q_ASSERT(file);
stringRes = QFileInfo(file->name).fileName();
QString conv_file = m_resource_file.relativePath(file->name);
stringRes = conv_file.replace(QDir::separator(), QLatin1Char('/'));
const QString alias = file->alias;
if (!alias.isEmpty())
appendParenthesized(alias, stringRes);
@@ -640,29 +654,15 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const
if (isFileNode) {
// File node
Q_ASSERT(file);
const QString path = m_resource_file.absolutePath(file->name);
if (iconFileExtension(path)) {
const QIcon icon(path);
if (!icon.isNull())
result = icon;
if (file->icon.isNull()) {
const QString path = m_resource_file.absolutePath(file->name);
if (iconFileExtension(path))
file->icon = QIcon(path);
}
if (!file->icon.isNull())
result = file->icon;
}
break;
case Qt::ToolTipRole:
if (isFileNode) {
// File node
Q_ASSERT(file);
QString conv_file = m_resource_file.relativePath(file->name);
QString stringRes = conv_file.replace(QDir::separator(), QLatin1Char('/'));
const QString &alias_file = file->alias;
if (!alias_file.isEmpty())
appendParenthesized(alias_file, stringRes);
result = stringRes;
result = "Qt::ToolTipRole " + stringRes;
}
break;
default:
break;
}
@@ -677,14 +677,14 @@ void ResourceModel::getItem(const QModelIndex &index, QString &prefix, QString &
if (!index.isValid())
return;
void * const internalPointer = index.internalPointer();
Node * const node = reinterpret_cast<Node *>(internalPointer);
Prefix * const p = node->prefix();
const void *internalPointer = index.internalPointer();
const Node *node = reinterpret_cast<const Node *>(internalPointer);
const Prefix *p = node->prefix();
Q_ASSERT(p);
bool const isFileNode = (p != node);
const bool isFileNode = (p != node);
if (isFileNode) {
File *const f = node->file();
const File *f = node->file();
Q_ASSERT(f);
if (!f->alias.isEmpty())
file = f->alias;
@@ -797,7 +797,7 @@ void ResourceModel::addFiles(int prefixIndex, const QStringList &fileNames, int
const int prefix_idx = prefixIndex;
QStringList unique_list;
foreach (QString file, file_list) {
foreach (const QString &file, file_list) {
if (!m_resource_file.contains(prefix_idx, file) && !unique_list.contains(file))
unique_list.append(file);
}
@@ -808,7 +808,7 @@ void ResourceModel::addFiles(int prefixIndex, const QStringList &fileNames, int
const int cnt = m_resource_file.fileCount(prefix_idx);
beginInsertRows(prefix_model_idx, cnt, cnt + unique_list.count() - 1); // ### FIXME
foreach (QString file, file_list)
foreach (const QString &file, unique_list)
m_resource_file.addFile(prefix_idx, file);
const QFileInfo fi(file_list.last());

View File

@@ -40,6 +40,7 @@
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtGui/QIcon>
#include "shared_global_p.h"
@@ -69,8 +70,8 @@ protected:
Q_ASSERT(m_prefix);
}
public:
File *file() { return m_file; }
Prefix *prefix() { return m_prefix; }
File *file() const { return m_file; }
Prefix *prefix() const { return m_prefix; }
private:
File *m_file;
Prefix *m_prefix;
@@ -89,8 +90,14 @@ struct File : public Node {
bool operator != (const File &other) const { return name != other.name; }
QString name;
QString alias;
QIcon icon;
};
class FileList : public QList<File *>
{
public:
bool containsFile(File *file);
};
typedef QList<File *> FileList;
/*!
\class Prefix

View File

@@ -382,6 +382,14 @@ void ResourceView::mouseReleaseEvent(QMouseEvent *e)
QTreeView::mouseReleaseEvent(e);
}
void ResourceView::keyPressEvent(QKeyEvent *e)
{
if (e->key() == Qt::Key_Delete)
removeItem();
else
QTreeView::keyPressEvent(e);
}
void ResourceView::popupMenu(const QModelIndex &index)
{
if (!m_releasePos.isNull()) {

View File

@@ -138,6 +138,7 @@ protected:
void changeLang(const QModelIndex &index);
void changeAlias(const QModelIndex &index);
void mouseReleaseEvent(QMouseEvent *e);
void keyPressEvent(QKeyEvent *e);
signals:
void removeItem();

View File

@@ -9,7 +9,7 @@ SOURCES = customwidgets.cpp
# Link against the qtcreator utils lib
unix {
linux-* {
# form abs path to qtcreator lib dir
GH_LIB=$$dirname(PWD)
GH_LIB=$$dirname(GH_LIB)
@@ -19,7 +19,13 @@ unix {
}
INCLUDEPATH += ../../../src/libs
LIBS += -L../../../lib -lUtils
macx {
LIBS += -L../../../bin/QtCreator.app/Contents/PlugIns
CONFIG(debug, debug|release):LIBS += -lUtils_debug
else:LIBS += -lUtils
} else {
LIBS += -L../../../lib -lUtils
}
DESTDIR= $$[QT_INSTALL_PLUGINS]/designer

View File

@@ -35,8 +35,15 @@
#include <cstring>
#include <locale>
#include <qglobal.h>
#include "binpatch.h"
#ifdef Q_OS_WIN
# define strcasecmp _stricmp
# define strncasecmp _strnicmp
#endif
// returns positive value if it finds a null termination inside the buffer
long BinPatch::getBufferStringLength(char *data, char *end)
{
@@ -181,7 +188,7 @@ bool BinPatch::patch(const char *oldstr, const char *newstr)
if (!(input = fopen(fileName, "r+b")))
{
fprintf(stderr, "Cannot open file %s!\n", fileName);
fprintf(stderr, "Warning: Could not open file %s\n", fileName);
return false;
}

View File

@@ -42,8 +42,10 @@
#include <QtCore/QDebug>
#ifdef Q_OS_WIN
const char * const oldInstallBase = "C:/qt-greenhouse/Trolltech/Code_less_create_more/"
"Trolltech/Code_less_create_more/Troll/4.4.3";
# define QT_INSTALL_DIR "C:/qt-greenhouse/Trolltech/Code_less_create_more/Trolltech/Code_less_create_more/Troll/4.4.3";
const char * const oldInstallBase = QT_INSTALL_DIR;
const char * const oldSourceBase = QT_INSTALL_DIR;
#else
const char * const oldSourceBase = "/home/berlin/dev/qt-4.4.3-temp/qt-x11-opensource-src-4.4.3";
const char * const oldInstallBase = "/home/berlin/dev/qt-4.4.3-shipping/qt";
@@ -85,13 +87,13 @@ bool patchBinaryWithQtPathes(const char *fileName, const char *baseQtPath)
logFileName(fileName);
for (int i = 0; i < (int)(sizeof(variables) / sizeof(variables[0])); i++) {
const char * const newStr = allocFileNameCopyAppend(variables[i].variable, baseQtPath, variables[i].subDirectory);
const char * const newStr = allocFileNameCopyAppend(
variables[i].variable, baseQtPath, variables[i].subDirectory);
BinPatch binFile(fileName);
const bool success = binFile.patch(variables[i].variable, newStr);
delete[] newStr;
if (!success) {
result = false;
break;
}
}
@@ -119,7 +121,6 @@ bool patchBinariesWithQtPathes(const char *baseQtPath)
delete[] fileName;
if (!success) {
result = false;
break;
}
}
@@ -602,9 +603,6 @@ bool patchDebugLibrariesWithQtPath(const char *baseQtPath)
delete[] fileName;
delete[] oldSourcePath;
delete[] newSourcePath;
if (!result)
break;
}
return result;
@@ -631,83 +629,83 @@ void patchQMakeSpec(const char *path)
out << all;
}
#ifndef Q_OS_WIN
const char * const textFileFileNames[] =
{
#ifndef Q_OS_WIN
// *.la
"lib/libQtCore.la",
"lib/libQt3Support.la",
"lib/libQtCLucene.la",
"lib/libQtDBus.la",
"lib/libQtGui.la",
"lib/libQtHelp.la",
"lib/libQtNetwork.la",
"lib/libQtOpenGL.la",
"lib/libQtScript.la",
"lib/libQtSql.la",
"lib/libQtSvg.la",
"lib/libQtTest.la",
"lib/libQtWebKit.la",
"lib/libQtXml.la",
"lib/libQtXmlPatterns.la",
"/lib/libQtCore.la",
"/lib/libQt3Support.la",
"/lib/libQtCLucene.la",
"/lib/libQtDBus.la",
"/lib/libQtGui.la",
"/lib/libQtHelp.la",
"/lib/libQtNetwork.la",
"/lib/libQtOpenGL.la",
"/lib/libQtScript.la",
"/lib/libQtSql.la",
"/lib/libQtSvg.la",
"/lib/libQtTest.la",
"/lib/libQtWebKit.la",
"/lib/libQtXml.la",
"/lib/libQtXmlPatterns.la",
// *.prl
"demos/shared/libdemo_shared.prl",
"lib/libQt3Support.prl",
"lib/libQtAssistantClient.prl",
"lib/libQtCLucene.prl",
"lib/libQtCore.prl",
"lib/libQtDBus.prl",
"lib/libQtDesignerComponents.prl",
"lib/libQtDesigner.prl",
"lib/libQtGui.prl",
"lib/libQtHelp.prl",
"lib/libQtNetwork.prl",
"lib/libQtOpenGL.prl",
"lib/libQtScript.prl",
"lib/libQtSql.prl",
"lib/libQtSvg.prl",
"lib/libQtTest.prl",
"lib/libQtUiTools.prl",
"lib/libQtWebKit.prl",
"lib/libQtXmlPatterns.prl",
"lib/libQtXml.prl",
"/demos/shared/libdemo_shared.prl",
"/lib/libQt3Support.prl",
"/lib/libQtAssistantClient.prl",
"/lib/libQtCLucene.prl",
"/lib/libQtCore.prl",
"/lib/libQtDBus.prl",
"/lib/libQtDesignerComponents.prl",
"/lib/libQtDesigner.prl",
"/lib/libQtGui.prl",
"/lib/libQtHelp.prl",
"/lib/libQtNetwork.prl",
"/lib/libQtOpenGL.prl",
"/lib/libQtScript.prl",
"/lib/libQtSql.prl",
"/lib/libQtSvg.prl",
"/lib/libQtTest.prl",
"/lib/libQtUiTools.prl",
"/lib/libQtWebKit.prl",
"/lib/libQtXmlPatterns.prl",
"/lib/libQtXml.prl",
// *.pc
"lib/pkgconfig/Qt3Support.pc",
"lib/pkgconfig/QtAssistantClient.pc",
"lib/pkgconfig/QtCLucene.pc",
"lib/pkgconfig/QtCore.pc",
"lib/pkgconfig/QtDBus.pc",
"lib/pkgconfig/QtDesignerComponents.pc",
"lib/pkgconfig/QtDesigner.pc",
"lib/pkgconfig/QtGui.pc",
"lib/pkgconfig/QtHelp.pc",
"lib/pkgconfig/QtNetwork.pc",
"lib/pkgconfig/QtOpenGL.pc",
"lib/pkgconfig/QtScript.pc",
"lib/pkgconfig/QtSql.pc",
"lib/pkgconfig/QtSvg.pc",
"lib/pkgconfig/QtTest.pc",
"lib/pkgconfig/QtUiTools.pc",
"lib/pkgconfig/QtWebKit.pc",
"lib/pkgconfig/QtXmlPatterns.pc",
"lib/pkgconfig/QtXml.pc",
"/lib/pkgconfig/Qt3Support.pc",
"/lib/pkgconfig/QtAssistantClient.pc",
"/lib/pkgconfig/QtCLucene.pc",
"/lib/pkgconfig/QtCore.pc",
"/lib/pkgconfig/QtDBus.pc",
"/lib/pkgconfig/QtDesignerComponents.pc",
"/lib/pkgconfig/QtDesigner.pc",
"/lib/pkgconfig/QtGui.pc",
"/lib/pkgconfig/QtHelp.pc",
"/lib/pkgconfig/QtNetwork.pc",
"/lib/pkgconfig/QtOpenGL.pc",
"/lib/pkgconfig/QtScript.pc",
"/lib/pkgconfig/QtSql.pc",
"/lib/pkgconfig/QtSvg.pc",
"/lib/pkgconfig/QtTest.pc",
"/lib/pkgconfig/QtUiTools.pc",
"/lib/pkgconfig/QtWebKit.pc",
"/lib/pkgconfig/QtXmlPatterns.pc",
"/lib/pkgconfig/QtXml.pc",
// misc
"mkspecs/qconfig.pri"
#endif
"/mkspecs/qconfig.pri"
};
#endif
void replaceInTextFile(const char * fileName,
const char * oldText, const char * newText,
const char * oldText2 = NULL, const char * newText2 = NULL)
{
const QString errorMessage = QString("Could not patch file ") + fileName;
const QString errorMessage = QString("Warning: Could not patch file ") + fileName;
QFile f(fileName);
if (!f.open(QIODevice::ReadOnly)) {
std::cout << qPrintable(errorMessage) << std::endl;
std::cerr << qPrintable(errorMessage) << std::endl;
return;
}
QTextStream in(&f);
@@ -720,7 +718,7 @@ void replaceInTextFile(const char * fileName,
}
if (!f.open(QIODevice::WriteOnly)) {
std::cout << qPrintable(errorMessage) << std::endl;
std::cerr << qPrintable(errorMessage) << std::endl;
return;
}
QTextStream out(&f);
@@ -730,20 +728,21 @@ void replaceInTextFile(const char * fileName,
void patchTextFiles(const char *newInstallBase)
{
#ifndef Q_OS_WIN
const char * const baseQtPath = newInstallBase;
const char * const newSourceBase = newInstallBase;
const int fileCount = sizeof(textFileFileNames) / sizeof(const char *);
for (int i = 0; i < fileCount; i++) {
logFileName(textFileFileNames[i]);
char * const fileName = allocFileNameCopyAppend(baseQtPath, textFileFileNames[i]);
logFileName(fileName);
logDiff(oldSourceBase, newSourceBase);
#ifndef Q_OS_WIN
logDiff(oldInstallBase, newInstallBase);
#endif
replaceInTextFile(textFileFileNames[i],
#ifndef Q_OS_WIN
replaceInTextFile(fileName,
oldSourceBase, newSourceBase,
#endif
oldInstallBase, newInstallBase);
delete[] fileName;
}
#endif
patchQMakeSpec(newInstallBase);
}
@@ -774,8 +773,8 @@ int main(int argc, char *args[])
break;
patchTextFiles(baseQtPath);
const bool success = patchBinariesWithQtPathes(baseQtPath)
&& patchDebugLibrariesWithQtPath(baseQtPath);
patchBinariesWithQtPathes(baseQtPath);
patchDebugLibrariesWithQtPath(baseQtPath);
delete[] baseQtPath;
return success ? 0 : 1;
return 0;
}

View File

@@ -159,16 +159,27 @@ void testQHash()
#if 1
QHash<QString, float> hgg1;
QHash<QString, int> hgg1;
hgg1["22.0"] = 22.0;
hgg1["23.0"] = 22.0;
hgg1["24.0"] = 22.0;
hgg1["25.0"] = 22.0;
hgg1["26.0"] = 22.0;
hgg1["27.0"] = 27.0;
hgg1["28.0"] = 28.0;
hgg1["29.0"] = 29.0;
hgg1["123.0"] = 22.0;
hgg1["111111ss111128.0"] = 28.0;
hgg1["11124.0"] = 22.0;
hgg1["1111125.0"] = 22.0;
hgg1["11111126.0"] = 22.0;
hgg1["111111127.0"] = 27.0;
hgg1["111111111128.0"] = 28.0;
hgg1["111111111111111111129.0"] = 29.0;
QHash<QByteArray, float> hgx1;
hgx1["22.0"] = 22.0;
hgx1["123.0"] = 22.0;
hgx1["111111ss111128.0"] = 28.0;
hgx1["11124.0"] = 22.0;
hgx1["1111125.0"] = 22.0;
hgx1["11111126.0"] = 22.0;
hgx1["111111127.0"] = 27.0;
hgx1["111111111128.0"] = 28.0;
hgx1["111111111111111111129.0"] = 29.0;
#endif
#if 1