Merge remote branch 'origin/1.3'

Conflicts:
	src/plugins/bineditor/bineditorplugin.cpp
	src/plugins/coreplugin/editormanager/editormanager.cpp
	src/plugins/debugger/gdb/gdbengine.cpp
	src/plugins/debugger/watchhandler.cpp
This commit is contained in:
con
2010-01-14 18:45:35 +01:00
13 changed files with 86 additions and 62 deletions

1
dist/changes-1.3.1 vendored
View File

@@ -36,6 +36,7 @@ Debugging
* Ignore case of file name in breakpoint handling on Windows * Ignore case of file name in breakpoint handling on Windows
* Fixed problems with gdb timing out and debugging sessions unexpectedly finishing * Fixed problems with gdb timing out and debugging sessions unexpectedly finishing
* Improved startup time of gdb sessions by not asking for all files known to gdb * Improved startup time of gdb sessions by not asking for all files known to gdb
* Mac: Fixed problems with locals and watchers not updating correctly on Snow Leopard
Help Help
* Don't switch to Help mode if help side bar is already visible * Don't switch to Help mode if help side bar is already visible

View File

@@ -2961,7 +2961,7 @@ Sollen sie überschrieben werden?</translation>
<message> <message>
<location line="+0"/> <location line="+0"/>
<source>Line</source> <source>Line</source>
<translation>Datei</translation> <translation>Zeile</translation>
</message> </message>
<message> <message>
<location line="+1"/> <location line="+1"/>
@@ -4637,7 +4637,7 @@ Es wird empfohlen, gdb 6.7 oder später zu benutzen.</translation>
<message> <message>
<location line="+1"/> <location line="+1"/>
<source>Line</source> <source>Line</source>
<translation>Datei</translation> <translation>Zeile</translation>
</message> </message>
<message> <message>
<location line="+1"/> <location line="+1"/>

View File

@@ -297,12 +297,11 @@ class BinEditorInterface : public Core::IEditor
{ {
Q_OBJECT Q_OBJECT
public: public:
BinEditorInterface(BinEditor *parent) BinEditorInterface(BinEditor *editor)
: Core::IEditor(parent)
{ {
Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance(); Core::UniqueIDManager *uidm = Core::UniqueIDManager::instance();
m_editor = parent; m_editor = editor;
m_file = new BinEditorFile(parent); m_file = new BinEditorFile(m_editor);
m_context << uidm->uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID); m_context << uidm->uniqueIdentifier(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR); m_context << uidm->uniqueIdentifier(Constants::C_BINEDITOR);
m_cursorPositionLabel = new Utils::LineColumnLabel; m_cursorPositionLabel = new Utils::LineColumnLabel;
@@ -321,7 +320,9 @@ public:
connect(m_editor, SIGNAL(cursorPositionChanged(int)), this, SLOT(updateCursorPosition(int))); connect(m_editor, SIGNAL(cursorPositionChanged(int)), this, SLOT(updateCursorPosition(int)));
} }
~BinEditorInterface() {} ~BinEditorInterface() {
delete m_editor;
}
QWidget *widget() { return m_editor; } QWidget *widget() { return m_editor; }

View File

@@ -1076,48 +1076,40 @@ QString EditorManager::getOpenWithEditorId(const QString &fileName,
static QString formatFileFilters(const Core::ICore *core, QString *selectedFilter) static QString formatFileFilters(const Core::ICore *core, QString *selectedFilter)
{ {
QString rc; QString rc;
// Compile list of filter strings. If we find a glob matching all files,
// put it last and set it as default selectedFilter. // Compile list of filter strings
QStringList filters = core->mimeDatabase()->filterStrings(); QStringList filters = core->mimeDatabase()->filterStrings();
filters.sort(); filters.sort();
selectedFilter->clear(); selectedFilter->clear();
if (filters.empty()) if (filters.empty())
return rc; return rc;
const QString filterSeparator = QLatin1String(";;"); const QString filterSeparator = QLatin1String(";;");
bool hasAllFilter = false; foreach (const QString &filterString, filters) {
const int size = filters.size();
for (int i = 0; i < size; i++) {
const QString &filterString = filters.at(i);
if (filterString.isEmpty()) { // binary editor
hasAllFilter = true;
} else {
if (!rc.isEmpty())
rc += filterSeparator;
rc += filterString;
}
}
if (hasAllFilter) {
// prepend all files filter
// prepending instead of appending to work around a but in Qt/Mac
QString allFilesFilter = EditorManager::tr("All Files (*)");
if (!rc.isEmpty()) if (!rc.isEmpty())
allFilesFilter += filterSeparator; rc += filterSeparator;
rc.prepend(allFilesFilter); rc += filterString;
*selectedFilter = allFilesFilter;
} else {
*selectedFilter = filters.front();
} }
// prepend all files filter
// prepending instead of appending to work around a bug in Qt/Mac
QString allFilesFilter = EditorManager::tr("All Files (*)");
if (!rc.isEmpty())
allFilesFilter += filterSeparator;
rc.prepend(allFilesFilter);
*selectedFilter = allFilesFilter;
return rc; return rc;
} }
IEditor *EditorManager::openEditor(const QString &fileName, const QString &editorId, IEditor *EditorManager::openEditor(const QString &fileName, const QString &editorId,
EditorManager::OpenEditorFlags flags) OpenEditorFlags flags)
{ {
return openEditor(0, fileName, editorId, flags); return openEditor(0, fileName, editorId, flags);
} }
IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QString &fileName, IEditor *EditorManager::openEditor(Core::Internal::EditorView *view, const QString &fileName,
const QString &editorId, EditorManager::OpenEditorFlags flags) const QString &editorId, OpenEditorFlags flags)
{ {
if (debugEditorManager) if (debugEditorManager)
qDebug() << Q_FUNC_INFO << fileName << editorId; qDebug() << Q_FUNC_INFO << fileName << editorId;

View File

@@ -32,6 +32,8 @@
#include "editormanager.h" #include "editormanager.h"
#include "editorview.h" #include "editorview.h"
#include <utils/qtcassert.h>
#include <QtGui/QHeaderView> #include <QtGui/QHeaderView>
Q_DECLARE_METATYPE(Core::Internal::EditorView*) Q_DECLARE_METATYPE(Core::Internal::EditorView*)
@@ -192,11 +194,10 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE
foreach (const EditLocation &hi, view->editorHistory()) { foreach (const EditLocation &hi, view->editorHistory()) {
if (hi.file.isNull() || filesDone.contains(hi.file)) if (hi.file.isNull() || filesDone.contains(hi.file))
continue; continue;
filesDone.insert(hi.file.data());
QTreeWidgetItem *item = new QTreeWidgetItem();
QString title = model->displayNameForFile(hi.file); QString title = model->displayNameForFile(hi.file);
QTC_ASSERT(!title.isEmpty(), continue;)
filesDone.insert(hi.file.data());
QTreeWidgetItem *item = new QTreeWidgetItem();
if (hi.file->isModified()) if (hi.file->isModified())
title += tr("*"); title += tr("*");
item->setIcon(0, hi.file->isReadOnly() ? lockedIcon : emptyIcon); item->setIcon(0, hi.file->isReadOnly() ? lockedIcon : emptyIcon);

View File

@@ -1086,8 +1086,11 @@ QStringList MimeDatabasePrivate::filterStrings() const
{ {
QStringList rc; QStringList rc;
const TypeMimeTypeMap::const_iterator cend = m_typeMimeTypeMap.constEnd(); const TypeMimeTypeMap::const_iterator cend = m_typeMimeTypeMap.constEnd();
for (TypeMimeTypeMap::const_iterator it = m_typeMimeTypeMap.constBegin(); it != cend; ++it) for (TypeMimeTypeMap::const_iterator it = m_typeMimeTypeMap.constBegin(); it != cend; ++it) {
rc += it.value().type.filterString(); const QString filterString = it.value().type.filterString();
if (!filterString.isEmpty())
rc += filterString;
}
return rc; return rc;
} }

View File

@@ -750,9 +750,10 @@ static inline bool getUnsignedHexValue(CIDebugSymbolGroup *sg, int index, quint6
return getUnsignedHexValue(stringValue, value); return getUnsignedHexValue(stringValue, value);
} }
enum { maxStringLength = 4096 };
int CdbSymbolGroupContext::dumpQString(CIDebugDataSpaces *ds, WatchData *wd) int CdbSymbolGroupContext::dumpQString(CIDebugDataSpaces *ds, WatchData *wd)
{ {
const int maxLength = 40;
QString errorMessage; QString errorMessage;
unsigned long stringIndex; unsigned long stringIndex;
if (!lookupPrefix(wd->iname, &stringIndex)) if (!lookupPrefix(wd->iname, &stringIndex))
@@ -774,9 +775,9 @@ int CdbSymbolGroupContext::dumpQString(CIDebugDataSpaces *ds, WatchData *wd)
if (!getUnsignedHexValue(m_symbolGroup, arrayIndex, &array)) if (!getUnsignedHexValue(m_symbolGroup, arrayIndex, &array))
return 5; return 5;
// Fetch // Fetch
const bool truncated = size > maxLength; const bool truncated = size > maxStringLength;
if (truncated) if (truncated)
size = maxLength; size = maxStringLength;
const QChar doubleQuote = QLatin1Char('"'); const QChar doubleQuote = QLatin1Char('"');
QString value; QString value;
if (size > 0) { if (size > 0) {
@@ -808,7 +809,6 @@ int CdbSymbolGroupContext::dumpQString(CIDebugDataSpaces *ds, WatchData *wd)
int CdbSymbolGroupContext::dumpStdString(WatchData *wd) int CdbSymbolGroupContext::dumpStdString(WatchData *wd)
{ {
const int maxLength = 40;
QString errorMessage; QString errorMessage;
unsigned long stringIndex; unsigned long stringIndex;
if (!lookupPrefix(wd->iname, &stringIndex)) if (!lookupPrefix(wd->iname, &stringIndex))
@@ -835,8 +835,8 @@ int CdbSymbolGroupContext::dumpStdString(WatchData *wd)
if (quotePos == -1) if (quotePos == -1)
return 1; return 1;
bufValue.remove(0, quotePos); bufValue.remove(0, quotePos);
if (bufValue.size() > maxLength) { if (bufValue.size() > maxStringLength) {
bufValue.truncate(maxLength); bufValue.truncate(maxStringLength);
bufValue += QLatin1String("...\""); bufValue += QLatin1String("...\"");
} }
wd->setValue(bufValue); wd->setValue(bufValue);

View File

@@ -4664,7 +4664,7 @@ void GdbEngine::handleInferiorPrepared()
qtBuildPath = "C:/iwmake/build_mingw_opensource"; qtBuildPath = "C:/iwmake/build_mingw_opensource";
postCommand("set substitute-path " + qtBuildPath + ' ' + qtInstallPath); postCommand("set substitute-path " + qtBuildPath + ' ' + qtInstallPath);
#elif defined(Q_OS_UNIX) && !defined (Q_OS_MAC) #elif defined(Q_OS_UNIX) && !defined (Q_OS_MAC)
qtBuildPath = "/var/tmp/qt-x11-src-4.6.0"; qtBuildPath = "/var/tmp/qt-x11-src-4.6.1";
postCommand("set substitute-path " + qtBuildPath + ' ' + qtInstallPath); postCommand("set substitute-path " + qtBuildPath + ' ' + qtInstallPath);
#endif #endif
} }

View File

@@ -774,6 +774,18 @@ void WatchModel::emitDataChanged(int column, const QModelIndex &parentIndex)
emitDataChanged(column, index(i, 0, parentIndex)); emitDataChanged(column, index(i, 0, parentIndex));
} }
// Truncate value for item view, maintaining quotes
static inline QString truncateValue(QString v)
{
enum { maxLength = 512 };
if (v.size() < maxLength)
return v;
const bool isQuoted = v.endsWith(QLatin1Char('"')); // check for 'char* "Hallo"'
v.truncate(maxLength);
v += isQuoted ? QLatin1String("...\"") : QLatin1String("...");
return v;
}
QVariant WatchModel::data(const QModelIndex &idx, int role) const QVariant WatchModel::data(const QModelIndex &idx, int role) const
{ {
const WatchItem *item = watchItem(idx); const WatchItem *item = watchItem(idx);
@@ -791,7 +803,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const
if (format == -1) if (format == -1)
format = m_handler->m_typeFormats.value(data.type, -1); format = m_handler->m_typeFormats.value(data.type, -1);
//qDebug() << "FORMATTED: " << format << formattedValue(data, format); //qDebug() << "FORMATTED: " << format << formattedValue(data, format);
return formattedValue(data, format); return truncateValue(formattedValue(data, format));
} }
case 2: { case 2: {
if (!data.displayedType.isEmpty()) if (!data.displayedType.isEmpty())

View File

@@ -145,8 +145,6 @@ bool ColorScheme::save(const QString &fileName) const
if (!m_displayName.isEmpty()) if (!m_displayName.isEmpty())
w.writeAttribute(QLatin1String("name"), m_displayName); w.writeAttribute(QLatin1String("name"), m_displayName);
Format textFormat = formatFor(QLatin1String(Constants::C_TEXT));
QMapIterator<QString, Format> i(m_formats); QMapIterator<QString, Format> i(m_formats);
while (i.hasNext()) { while (i.hasNext()) {
const Format &format = i.next().value(); const Format &format = i.next().value();

View File

@@ -33,6 +33,8 @@
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QSettings> #include <QtCore/QSettings>
#include <QtCore/QCoreApplication> #include <QtCore/QCoreApplication>
#include <QtGui/QTextCharFormat> #include <QtGui/QTextCharFormat>
@@ -121,8 +123,10 @@ bool FontSettings::fromSettings(const QString &category,
if (s->contains(group + QLatin1String(schemeFileNameKey))) { if (s->contains(group + QLatin1String(schemeFileNameKey))) {
// Load the selected color scheme // Load the selected color scheme
loadColorScheme(s->value(group + QLatin1String(schemeFileNameKey), defaultSchemeFileName()).toString(), QString scheme = s->value(group + QLatin1String(schemeFileNameKey)).toString();
descriptions); if (scheme.isEmpty() || !QFile::exists(scheme))
scheme = defaultSchemeFileName(QFileInfo(scheme).fileName());
loadColorScheme(scheme, descriptions);
} else { } else {
// Load color scheme from ini file // Load color scheme from ini file
foreach (const FormatDescription &desc, descriptions) { foreach (const FormatDescription &desc, descriptions) {
@@ -337,11 +341,21 @@ int FontSettings::defaultFontSize()
return DEFAULT_FONT_SIZE; return DEFAULT_FONT_SIZE;
} }
QString FontSettings::defaultSchemeFileName() /**
* Returns the default scheme file name, or the path to a shipped scheme when
* one exists with the given \a fileName.
*/
QString FontSettings::defaultSchemeFileName(const QString &fileName)
{ {
QString fileName = Core::ICore::instance()->resourcePath(); QString defaultScheme = Core::ICore::instance()->resourcePath();
fileName += QLatin1String("/styles/default.xml"); defaultScheme += QLatin1String("/styles/");
return fileName;
if (!fileName.isEmpty() && QFile::exists(defaultScheme + fileName))
defaultScheme += fileName;
else
defaultScheme += QLatin1String("default.xml");
return defaultScheme;
} }
} // namespace TextEditor } // namespace TextEditor

View File

@@ -103,7 +103,7 @@ public:
static int defaultFontSize(); static int defaultFontSize();
private: private:
static QString defaultSchemeFileName(); static QString defaultSchemeFileName(const QString &fileName = QString());
QString m_family; QString m_family;
QString m_schemeFileName; QString m_schemeFileName;

View File

@@ -487,11 +487,12 @@ static bool registerDebuggerKey(const WCHAR *key,
// Save old key, which might be missing // Save old key, which might be missing
QString oldDebugger; QString oldDebugger;
registryReadStringKey(handle, debuggerRegistryValueNameC, &oldDebugger, errorMessage); registryReadStringKey(handle, debuggerRegistryValueNameC, &oldDebugger, errorMessage);
if (oldDebugger.contains(QLatin1String(applicationFileC), Qt::CaseInsensitive)) { if (!oldDebugger.compare(call, Qt::CaseInsensitive)) {
*errorMessage = QLatin1String("The program is already registered as post mortem debugger."); *errorMessage = QLatin1String("The program is already registered as post mortem debugger.");
break; break;
} }
if (!registryWriteStringKey(handle, debuggerRegistryDefaultValueNameC, oldDebugger, errorMessage)) if (!(oldDebugger.contains(QLatin1String(applicationFileC), Qt::CaseInsensitive)
|| registryWriteStringKey(handle, debuggerRegistryDefaultValueNameC, oldDebugger, errorMessage)))
break; break;
if (debug) if (debug)
qDebug() << "registering self as " << call; qDebug() << "registering self as " << call;
@@ -516,7 +517,9 @@ bool install(QString *errorMessage)
} }
// Unregister helper: Restore the original debugger key // Unregister helper: Restore the original debugger key
static bool unregisterDebuggerKey(const WCHAR *key, QString *errorMessage) static bool unregisterDebuggerKey(const WCHAR *key,
const QString &call,
QString *errorMessage)
{ {
HKEY handle = 0; HKEY handle = 0;
bool success = false; bool success = false;
@@ -525,8 +528,7 @@ static bool unregisterDebuggerKey(const WCHAR *key, QString *errorMessage)
break; break;
QString debugger; QString debugger;
registryReadStringKey(handle, debuggerRegistryValueNameC, &debugger, errorMessage); registryReadStringKey(handle, debuggerRegistryValueNameC, &debugger, errorMessage);
if (!(debugger.isEmpty() if (!debugger.isEmpty() && debugger.compare(call, Qt::CaseInsensitive)) {
|| debugger.contains(QLatin1String(applicationFileC), Qt::CaseInsensitive))) {
*errorMessage = QLatin1String("The program is not registered as post mortem debugger."); *errorMessage = QLatin1String("The program is not registered as post mortem debugger.");
break; break;
} }
@@ -553,10 +555,10 @@ static bool unregisterDebuggerKey(const WCHAR *key, QString *errorMessage)
bool uninstall(QString *errorMessage) bool uninstall(QString *errorMessage)
{ {
if (!unregisterDebuggerKey(debuggerRegistryKeyC, errorMessage)) if (!unregisterDebuggerKey(debuggerRegistryKeyC, debuggerCall(), errorMessage))
return false; return false;
#ifdef Q_OS_WIN64 #ifdef Q_OS_WIN64
if (!unregisterDebuggerKey(debuggerWow32RegistryKeyC, errorMessage)) if (!unregisterDebuggerKey(debuggerWow32RegistryKeyC, debuggerCall(QLatin1String("-wow")), errorMessage))
return false; return false;
#endif #endif
return true; return true;