Merge remote-tracking branch 'origin/2.5'

This commit is contained in:
Eike Ziller
2012-03-12 15:10:32 +01:00
37 changed files with 1074 additions and 232 deletions

View File

@@ -4,7 +4,7 @@
//! [0] //! [0]
import QtQuick 1.0 import QtQuick 1.1
Rectangle { Rectangle {
id: page id: page

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 599 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 349 B

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 562 B

After

Width:  |  Height:  |  Size: 550 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -35,7 +35,7 @@
\note To complete this tutorial, you must have Qt 4.7 or later installed. \note To complete this tutorial, you must have Qt 4.7 or later installed.
This tutorial uses basic elements and illustrates basic concepts of This tutorial uses built-in QML elements and illustrates basic concepts of
\l {http://doc.qt.nokia.com/4.7/qtquick.html}{Qt Quick}. \l {http://doc.qt.nokia.com/4.7/qtquick.html}{Qt Quick}.
This tutorial describes how to use the \QC to implement the This tutorial describes how to use the \QC to implement the
@@ -53,8 +53,8 @@
\list 1 \list 1
\o Select \gui{File > New File or Project > Qt Quick Project > Qt Quick \o Select \gui{File > New File or Project > Applications >
Application > Choose}. Qt Quick Application (Built-in Elements) > Choose}.
\o In the \gui{Name} field, type \bold {Transitions}. \o In the \gui{Name} field, type \bold {Transitions}.
@@ -150,7 +150,7 @@
\o In the \gui Colors group, \gui Rectangle field, click the \o In the \gui Colors group, \gui Rectangle field, click the
\inlineimage qmldesigner-transparent-button.png \inlineimage qmldesigner-transparent-button.png
button to make the rectangle transparent. (\gui Transparent) button to make the rectangle transparent.
\o In the \gui Border field, set the border color to #808080. \o In the \gui Border field, set the border color to #808080.
@@ -161,7 +161,7 @@
border color, try setting the border color to solid by clicking border color, try setting the border color to solid by clicking
the the
\inlineimage qmldesigner-solid-color-button.png \inlineimage qmldesigner-solid-color-button.png
button. (\gui {Solid Color}) button.
\o In the \gui Radius field, select 6 to create rounded corners for \o In the \gui Radius field, select 6 to create rounded corners for
the rectangle. the rectangle.
@@ -187,7 +187,8 @@
\o Click \gui {Layout}, and then click the \o Click \gui {Layout}, and then click the
\inlineimage qmldesigner-anchor-fill-screen.png \inlineimage qmldesigner-anchor-fill-screen.png
button to anchor the mouse area to the rectangle. (\gui {Fill to Parent}) button to anchor the mouse area to the
rectangle.
\o In the code editor, edit the pointer to the clicked expression \o In the code editor, edit the pointer to the clicked expression
in the mouse area element, as illustrated by the following code in the mouse area element, as illustrated by the following code

File diff suppressed because it is too large Load Diff

View File

@@ -37,6 +37,12 @@ Item {
width: 480 width: 480
height: 32 height: 32
Rectangle {
anchors.fill: parent
color: "#f9f9f9"
opacity: projectNameText.hovered ? 1 : 0
}
property alias projectName: projectNameText.text property alias projectName: projectNameText.text
property alias projectPath: pathText.text property alias projectPath: pathText.text

View File

@@ -49,7 +49,7 @@ ScrollArea {
Column { Column {
id: column id: column
spacing: 2 spacing: 6
Repeater { Repeater {
id: repeater id: repeater

View File

@@ -48,7 +48,7 @@ namespace Constants {
const char * const IDE_VERSION_LONG = IDE_VERSION_STR; const char * const IDE_VERSION_LONG = IDE_VERSION_STR;
const char * const IDE_AUTHOR = \"Nokia Corporation\"; const char * const IDE_AUTHOR = \"Nokia Corporation\";
const char * const IDE_YEAR = \"2011\"; const char * const IDE_YEAR = \"2012\";
#ifdef IDE_VERSION_DESCRIPTION #ifdef IDE_VERSION_DESCRIPTION
const char * const IDE_VERSION_DESCRIPTION_STR = STRINGIFY(IDE_VERSION_DESCRIPTION); const char * const IDE_VERSION_DESCRIPTION_STR = STRINGIFY(IDE_VERSION_DESCRIPTION);

View File

@@ -85,7 +85,8 @@ AnalyzerRunConfigWidget::AnalyzerRunConfigWidget()
globalSettingLayout->addStretch(2); globalSettingLayout->addStretch(2);
m_subConfigWidget = new QWidget(this); m_subConfigWidget = new QWidget(this);
new QVBoxLayout(m_subConfigWidget); QVBoxLayout *subConfigLayout = new QVBoxLayout(m_subConfigWidget);
subConfigLayout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(m_subConfigWidget); layout->addWidget(m_subConfigWidget);
} }

View File

@@ -74,15 +74,11 @@ Qt::DropActions ExternalToolModel::supportedDropActions() const
return Qt::MoveAction; return Qt::MoveAction;
} }
QString ExternalToolModel::uncategorizedDisplayName() const
{
static QString uncategorized = tr("Uncategorized");
return uncategorized;
}
int ExternalToolModel::columnCount(const QModelIndex &parent) const int ExternalToolModel::columnCount(const QModelIndex &parent) const
{ {
if (!parent.isValid() || toolForIndex(parent) || !categoryForIndex(parent).isEmpty()) bool categoryFound;
categoryForIndex(parent, &categoryFound);
if (!parent.isValid() || toolForIndex(parent) || categoryFound)
return 1; return 1;
return 0; return 0;
} }
@@ -91,9 +87,11 @@ QVariant ExternalToolModel::data(const QModelIndex &index, int role) const
{ {
if (ExternalTool *tool = toolForIndex(index)) if (ExternalTool *tool = toolForIndex(index))
return data(tool, role); return data(tool, role);
QString category = categoryForIndex(index); bool found;
QTC_ASSERT(!category.isEmpty(), return QVariant()); QString category = categoryForIndex(index, &found);
return data(category, role); if (found)
return data(category, role);
return QVariant();
} }
QVariant ExternalToolModel::data(ExternalTool *tool, int role) const QVariant ExternalToolModel::data(ExternalTool *tool, int role) const
@@ -113,10 +111,9 @@ QVariant ExternalToolModel::data(const QString &category, int role) const
switch (role) { switch (role) {
case Qt::DisplayRole: case Qt::DisplayRole:
case Qt::EditRole: case Qt::EditRole:
return category; return category.isEmpty() ? tr("Uncategorized") : category;
case Qt::ToolTipRole: case Qt::ToolTipRole:
return category == uncategorizedDisplayName() return category.isEmpty() ? tr("Tools that will appear directly under the External Tools menu.") : QVariant();
? tr("Tools that will appear directly under the External Tools menu.") : QVariant();
default: default:
break; break;
} }
@@ -130,8 +127,9 @@ QMimeData *ExternalToolModel::mimeData(const QModelIndexList &indexes) const
QModelIndex modelIndex = indexes.first(); QModelIndex modelIndex = indexes.first();
ExternalTool *tool = toolForIndex(modelIndex); ExternalTool *tool = toolForIndex(modelIndex);
QTC_ASSERT(tool, return 0); QTC_ASSERT(tool, return 0);
QString category = categoryForIndex(modelIndex.parent()); bool found;
QTC_ASSERT(!category.isEmpty(), return 0); QString category = categoryForIndex(modelIndex.parent(), &found);
QTC_ASSERT(found, return 0);
QMimeData *md = new QMimeData(); QMimeData *md = new QMimeData();
QByteArray ba; QByteArray ba;
QDataStream stream(&ba, QIODevice::WriteOnly); QDataStream stream(&ba, QIODevice::WriteOnly);
@@ -149,8 +147,9 @@ bool ExternalToolModel::dropMimeData(const QMimeData *data,
Q_UNUSED(column) Q_UNUSED(column)
if (action != Qt::MoveAction || !data) if (action != Qt::MoveAction || !data)
return false; return false;
QString toCategory = categoryForIndex(parent); bool found;
QTC_ASSERT(!toCategory.isEmpty(), return false); QString toCategory = categoryForIndex(parent, &found);
QTC_ASSERT(found, return false);
QByteArray ba = data->data(QLatin1String("application/qtcreator-externaltool-config")); QByteArray ba = data->data(QLatin1String("application/qtcreator-externaltool-config"));
if (ba.isEmpty()) if (ba.isEmpty())
return false; return false;
@@ -159,15 +158,14 @@ bool ExternalToolModel::dropMimeData(const QMimeData *data,
int pos = -1; int pos = -1;
stream >> category; stream >> category;
stream >> pos; stream >> pos;
QTC_ASSERT(!category.isEmpty(), return false);
QList<ExternalTool *> &items = m_tools[category]; QList<ExternalTool *> &items = m_tools[category];
QTC_ASSERT(pos >= 0 && pos < items.count(), return false); QTC_ASSERT(pos >= 0 && pos < items.count(), return false);
beginRemoveRows(index(rowForCategory(category), 0), pos, pos); beginRemoveRows(index(m_tools.keys().indexOf(category), 0), pos, pos);
ExternalTool *tool = items.takeAt(pos); ExternalTool *tool = items.takeAt(pos);
endRemoveRows(); endRemoveRows();
if (row < 0) if (row < 0)
row = m_tools.value(toCategory).count(); row = m_tools.value(toCategory).count();
beginInsertRows(index(rowForCategory(toCategory), 0), row, row); beginInsertRows(index(m_tools.keys().indexOf(toCategory), 0), row, row);
m_tools[toCategory].insert(row, tool); m_tools[toCategory].insert(row, tool);
endInsertRows(); endInsertRows();
return true; return true;
@@ -181,8 +179,9 @@ QStringList ExternalToolModel::mimeTypes() const
QModelIndex ExternalToolModel::index(int row, int column, const QModelIndex &parent) const QModelIndex ExternalToolModel::index(int row, int column, const QModelIndex &parent) const
{ {
if (column == 0 && parent.isValid()) { if (column == 0 && parent.isValid()) {
QString category = categoryForIndex(parent); bool found;
if (!category.isEmpty()) { QString category = categoryForIndex(parent, &found);
if (found) {
QList<ExternalTool *> items = m_tools.value(category); QList<ExternalTool *> items = m_tools.value(category);
if (row < items.count()) { if (row < items.count()) {
return createIndex(row, 0, items.at(row)); return createIndex(row, 0, items.at(row));
@@ -197,11 +196,13 @@ QModelIndex ExternalToolModel::index(int row, int column, const QModelIndex &par
QModelIndex ExternalToolModel::parent(const QModelIndex &child) const QModelIndex ExternalToolModel::parent(const QModelIndex &child) const
{ {
if (ExternalTool *tool = toolForIndex(child)) { if (ExternalTool *tool = toolForIndex(child)) {
int categoryIndex = 0;
QMapIterator<QString, QList<ExternalTool *> > it(m_tools); QMapIterator<QString, QList<ExternalTool *> > it(m_tools);
while (it.hasNext()) { while (it.hasNext()) {
it.next(); it.next();
if (it.value().contains(tool)) if (it.value().contains(tool))
return index(rowForCategory(it.key()), 0); return index(categoryIndex, 0);
++categoryIndex;
} }
} }
return QModelIndex(); return QModelIndex();
@@ -214,8 +215,9 @@ int ExternalToolModel::rowCount(const QModelIndex &parent) const
if (toolForIndex(parent)) { if (toolForIndex(parent)) {
return 0; return 0;
} }
QString category = categoryForIndex(parent); bool found;
if (!category.isEmpty()) { QString category = categoryForIndex(parent, &found);
if (found) {
return m_tools.value(category).count(); return m_tools.value(category).count();
} }
@@ -226,9 +228,10 @@ Qt::ItemFlags ExternalToolModel::flags(const QModelIndex &index) const
{ {
if (toolForIndex(index)) if (toolForIndex(index))
return TOOL_ITEM_FLAGS; return TOOL_ITEM_FLAGS;
QString category = categoryForIndex(index); bool found;
if (!category.isEmpty()) { QString category = categoryForIndex(index, &found);
if (category == uncategorizedDisplayName()) if (found) {
if (category.isEmpty())
return TOOLSMENU_ITEM_FLAGS; return TOOLSMENU_ITEM_FLAGS;
return CATEGORY_ITEM_FLAGS; return CATEGORY_ITEM_FLAGS;
} }
@@ -248,18 +251,17 @@ bool ExternalToolModel::setData(const QModelIndex &modelIndex, const QVariant &v
emit dataChanged(modelIndex, modelIndex); emit dataChanged(modelIndex, modelIndex);
return true; return true;
} else { } else {
QString category = categoryForIndex(modelIndex); bool found;
if (!category.isEmpty()) { QString category = categoryForIndex(modelIndex, &found);
if (found) {
if (string.isEmpty() || m_tools.contains(string)) if (string.isEmpty() || m_tools.contains(string))
return false; return false;
// rename category // rename category
QList<QString> categories = m_tools.keys(); QList<QString> categories = m_tools.keys();
int previousIndex = rowForCategory(category); int previousIndex = categories.indexOf(category);
categories.removeAll(uncategorizedDisplayName()); // prepended again after sorting new list
categories.removeAt(previousIndex); categories.removeAt(previousIndex);
categories.append(string); categories.append(string);
qSort(categories); qSort(categories);
categories.prepend(uncategorizedDisplayName()); // prepend, so order is like in view
int newIndex = categories.indexOf(string); int newIndex = categories.indexOf(string);
if (newIndex != previousIndex) { if (newIndex != previousIndex) {
// we have same parent so we have to do special stuff for beginMoveRows... // we have same parent so we have to do special stuff for beginMoveRows...
@@ -293,34 +295,19 @@ ExternalTool *ExternalToolModel::toolForIndex(const QModelIndex &index) const
return static_cast<ExternalTool *>(index.internalPointer()); return static_cast<ExternalTool *>(index.internalPointer());
} }
QString ExternalToolModel::categoryForIndex(const QModelIndex &index) const QString ExternalToolModel::categoryForIndex(const QModelIndex &index, bool *found) const
{ {
if (index.isValid() && !index.parent().isValid() && index.column() == 0 && index.row() >= 0) { if (index.isValid() && !index.parent().isValid() && index.column() == 0 && index.row() >= 0) {
const QList<QString> &keys = m_tools.keys(); const QList<QString> &keys = m_tools.keys();
if (index.row() == 0)
return uncategorizedDisplayName();
if (index.row() < keys.count()) { if (index.row() < keys.count()) {
int uncategorizedIndex = keys.indexOf(uncategorizedDisplayName()); if (found) *found = true;
if (index.row() <= uncategorizedIndex)
return keys.at(index.row() - 1);
return keys.at(index.row()); return keys.at(index.row());
} }
} }
if (found) *found = false;
return QString(); return QString();
} }
int ExternalToolModel::rowForCategory(const QString &category) const
{
if (category == uncategorizedDisplayName())
return 0;
const QList<QString> &keys = m_tools.keys();
int uncategorizedIndex = keys.indexOf(uncategorizedDisplayName());
int index = keys.indexOf(category);
if (index < uncategorizedIndex)
return index + 1;
return index;
}
void ExternalToolModel::revertTool(const QModelIndex &modelIndex) void ExternalToolModel::revertTool(const QModelIndex &modelIndex)
{ {
ExternalTool *tool = toolForIndex(modelIndex); ExternalTool *tool = toolForIndex(modelIndex);
@@ -343,10 +330,8 @@ QModelIndex ExternalToolModel::addCategory()
category = categoryBase + QString::number(count); category = categoryBase + QString::number(count);
} }
QList<QString> categories = m_tools.keys(); QList<QString> categories = m_tools.keys();
categories.removeAll(uncategorizedDisplayName()); // prepended again after sorting new list
categories.append(category); categories.append(category);
qSort(categories); qSort(categories);
categories.prepend(uncategorizedDisplayName()); // prepend, so order is like in view
int pos = categories.indexOf(category); int pos = categories.indexOf(category);
beginInsertRows(QModelIndex(), pos, pos); beginInsertRows(QModelIndex(), pos, pos);
@@ -357,9 +342,10 @@ QModelIndex ExternalToolModel::addCategory()
QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex) QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex)
{ {
QString category = categoryForIndex(atIndex); bool found;
if (category.isEmpty()) QString category = categoryForIndex(atIndex, &found);
category = categoryForIndex(atIndex.parent()); if (!found)
category = categoryForIndex(atIndex.parent(), &found);
ExternalTool *tool = new ExternalTool; ExternalTool *tool = new ExternalTool;
tool->setDisplayCategory(category); tool->setDisplayCategory(category);
@@ -491,8 +477,8 @@ void ExternalToolConfig::setTools(const QMap<QString, QList<ExternalTool *> > &t
itemCopy.append(new ExternalTool(tool)); itemCopy.append(new ExternalTool(tool));
toolsCopy.insert(it.key(), itemCopy); toolsCopy.insert(it.key(), itemCopy);
} }
if (!toolsCopy.contains(m_model->uncategorizedDisplayName())) if (!toolsCopy.contains(QString()))
toolsCopy.insert(m_model->uncategorizedDisplayName(), QList<ExternalTool *>()); toolsCopy.insert(QString(), QList<ExternalTool *>());
m_model->setTools(toolsCopy); m_model->setTools(toolsCopy);
ui->toolTree->expandAll(); ui->toolTree->expandAll();
} }

View File

@@ -73,14 +73,12 @@ public:
QMap<QString, QList<ExternalTool *> > tools() const; QMap<QString, QList<ExternalTool *> > tools() const;
ExternalTool *toolForIndex(const QModelIndex &modelIndex) const; ExternalTool *toolForIndex(const QModelIndex &modelIndex) const;
QString categoryForIndex(const QModelIndex &modelIndex) const; QString categoryForIndex(const QModelIndex &modelIndex, bool *found) const;
int rowForCategory(const QString &category) const;
void revertTool(const QModelIndex &modelIndex); void revertTool(const QModelIndex &modelIndex);
QModelIndex addCategory(); QModelIndex addCategory();
QModelIndex addTool(const QModelIndex &atIndex); QModelIndex addTool(const QModelIndex &atIndex);
void removeTool(const QModelIndex &modelIndex); void removeTool(const QModelIndex &modelIndex);
Qt::DropActions supportedDropActions() const; Qt::DropActions supportedDropActions() const;
QString uncategorizedDisplayName() const;
private: private:
QVariant data(ExternalTool *tool, int role = Qt::DisplayRole) const; QVariant data(ExternalTool *tool, int role = Qt::DisplayRole) const;
QVariant data(const QString &category, int role = Qt::DisplayRole) const; QVariant data(const QString &category, int role = Qt::DisplayRole) const;

View File

@@ -34,6 +34,7 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "vcsmanager.h" #include "vcsmanager.h"
#include <coreplugin/fileiconprovider.h>
#include <coreplugin/idocument.h> #include <coreplugin/idocument.h>
#include <QDir> #include <QDir>
@@ -42,6 +43,7 @@
#include <QTreeWidget> #include <QTreeWidget>
#include <QHeaderView> #include <QHeaderView>
#include <QCheckBox> #include <QCheckBox>
#include <QtDebug>
Q_DECLARE_METATYPE(Core::IDocument*) Q_DECLARE_METATYPE(Core::IDocument*)
@@ -54,10 +56,15 @@ SaveItemsDialog::SaveItemsDialog(QWidget *parent,
{ {
m_ui.setupUi(this); m_ui.setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QPushButton *discardButton = m_ui.buttonBox->addButton(tr("Do not Save"), QDialogButtonBox::DestructiveRole); #ifdef Q_OS_MAC
// QDialogButtonBox's behavior for "destructive" is wrong, the "do not save" should be left-aligned
QDialogButtonBox::ButtonRole discardButtonRole = QDialogButtonBox::ResetRole;
#else
QDialogButtonBox::ButtonRole discardButtonRole = QDialogButtonBox::DestructiveRole;
#endif
QPushButton *discardButton = m_ui.buttonBox->addButton(tr("Do not Save"), discardButtonRole);
m_ui.buttonBox->button(QDialogButtonBox::Save)->setDefault(true); m_ui.buttonBox->button(QDialogButtonBox::Save)->setDefault(true);
m_ui.buttonBox->button(QDialogButtonBox::Save)->setFocus(Qt::TabFocusReason); m_ui.treeWidget->setFocus();
m_ui.buttonBox->button(QDialogButtonBox::Save)->setMinimumWidth(130); // bad magic number to avoid resizing of button
m_ui.saveBeforeBuildCheckBox->setVisible(false); m_ui.saveBeforeBuildCheckBox->setVisible(false);
@@ -74,11 +81,17 @@ SaveItemsDialog::SaveItemsDialog(QWidget *parent,
} }
QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.treeWidget, QStringList() QTreeWidgetItem *item = new QTreeWidgetItem(m_ui.treeWidget, QStringList()
<< visibleName << QDir::toNativeSeparators(directory)); << visibleName << QDir::toNativeSeparators(directory));
if (!fileName.isEmpty())
item->setIcon(0, FileIconProvider::instance()->icon(QFileInfo(fileName)));
item->setData(0, Qt::UserRole, qVariantFromValue(document)); item->setData(0, Qt::UserRole, qVariantFromValue(document));
} }
m_ui.treeWidget->resizeColumnToContents(0); m_ui.treeWidget->resizeColumnToContents(0);
m_ui.treeWidget->selectAll(); m_ui.treeWidget->selectAll();
#ifdef Q_OS_MAC
m_ui.treeWidget->setAlternatingRowColors(true);
#endif
adjustButtonWidths();
updateSaveButton(); updateSaveButton();
connect(m_ui.buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), connect(m_ui.buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()),
@@ -108,6 +121,32 @@ void SaveItemsDialog::updateSaveButton()
} }
} }
void SaveItemsDialog::adjustButtonWidths()
{
// give save button a size that all texts fit in, so it doesn't get resized
// Mac: make cancel + save button same size (work around dialog button box issue)
QStringList possibleTexts;
possibleTexts << tr("Save") << tr("Save All");
if (m_ui.treeWidget->topLevelItemCount() > 1)
possibleTexts << tr("Save Selected");
int maxTextWidth = 0;
QPushButton *saveButton = m_ui.buttonBox->button(QDialogButtonBox::Save);
foreach (const QString &text, possibleTexts) {
saveButton->setText(text);
int hint = saveButton->sizeHint().width();
if (hint > maxTextWidth)
maxTextWidth = hint;
}
#ifdef Q_OS_MAC
QPushButton *cancelButton = m_ui.buttonBox->button(QDialogButtonBox::Cancel);
int cancelButtonWidth = cancelButton->sizeHint().width();
if (cancelButtonWidth > maxTextWidth)
maxTextWidth = cancelButtonWidth;
cancelButton->setMinimumWidth(maxTextWidth);
#endif
saveButton->setMinimumWidth(maxTextWidth);
}
void SaveItemsDialog::collectItemsToSave() void SaveItemsDialog::collectItemsToSave()
{ {
m_itemsToSave.clear(); m_itemsToSave.clear();

View File

@@ -70,6 +70,8 @@ private slots:
void updateSaveButton(); void updateSaveButton();
private: private:
void adjustButtonWidths();
Ui::SaveItemsDialog m_ui; Ui::SaveItemsDialog m_ui;
QList<Core::IDocument*> m_itemsToSave; QList<Core::IDocument*> m_itemsToSave;
}; };

View File

@@ -744,8 +744,7 @@ void BreakHandler::setEnabled(BreakpointModelId id, bool on)
if (it->data.enabled == on) if (it->data.enabled == on)
return; return;
it->data.enabled = on; it->data.enabled = on;
it->destroyMarker(); it->updateMarkerIcon();
it->updateMarker(id);
if (it->engine) { if (it->engine) {
it->state = BreakpointChangeRequested; it->state = BreakpointChangeRequested;
scheduleSynchronization(); scheduleSynchronization();
@@ -780,8 +779,7 @@ void BreakHandler::setTracepoint(BreakpointModelId id, bool on)
if (it->data.tracepoint == on) if (it->data.tracepoint == on)
return; return;
it->data.tracepoint = on; it->data.tracepoint = on;
it->destroyMarker(); it->updateMarkerIcon();
it->updateMarker(id);
if (it->engine) { if (it->engine) {
it->state = BreakpointChangeRequested; it->state = BreakpointChangeRequested;
@@ -1414,6 +1412,12 @@ bool BreakHandler::BreakpointItem::isLocatedAt
|| fileNameMatch(fileName, markerFileName())); || fileNameMatch(fileName, markerFileName()));
} }
void BreakHandler::BreakpointItem::updateMarkerIcon()
{
marker->setIcon(icon());
marker->updateMarker();
}
void BreakHandler::BreakpointItem::updateMarker(BreakpointModelId id) void BreakHandler::BreakpointItem::updateMarker(BreakpointModelId id)
{ {
QString file = markerFileName(); QString file = markerFileName();

View File

@@ -197,6 +197,7 @@ private:
bool isLocatedAt(const QString &fileName, int lineNumber, bool isLocatedAt(const QString &fileName, int lineNumber,
bool useMarkerPosition) const; bool useMarkerPosition) const;
void updateMarker(BreakpointModelId id); void updateMarker(BreakpointModelId id);
void updateMarkerIcon();
QString toToolTip() const; QString toToolTip() const;
QString markerFileName() const; QString markerFileName() const;
int markerLineNumber() const; int markerLineNumber() const;

View File

@@ -67,8 +67,8 @@ void BreakpointMarker::removedFromEditor()
void BreakpointMarker::updateLineNumber(int lineNumber) void BreakpointMarker::updateLineNumber(int lineNumber)
{ {
breakHandler()->updateLineNumberFromMarker(m_id, lineNumber);
BaseTextMark::updateLineNumber(lineNumber); BaseTextMark::updateLineNumber(lineNumber);
breakHandler()->updateLineNumberFromMarker(m_id, lineNumber);
} }
} // namespace Internal } // namespace Internal

View File

@@ -715,7 +715,7 @@ void GdbEngine::interruptInferior()
QTC_ASSERT(state() == InferiorStopRequested, QTC_ASSERT(state() == InferiorStopRequested,
qDebug() << "INTERRUPT INFERIOR: " << state(); return); qDebug() << "INTERRUPT INFERIOR: " << state(); return);
if (0 && debuggerCore()->boolSetting(TargetAsync)) { if (usesExecInterrupt()) {
postCommand("-exec-interrupt"); postCommand("-exec-interrupt");
} else { } else {
showStatusMessage(tr("Stop requested..."), 5000); showStatusMessage(tr("Stop requested..."), 5000);
@@ -1634,7 +1634,7 @@ void GdbEngine::handleStop1(const GdbMi &data)
} else { } else {
showMessage(_("HANDLING SIGNAL " + name)); showMessage(_("HANDLING SIGNAL " + name));
if (debuggerCore()->boolSetting(UseMessageBoxForSignals) if (debuggerCore()->boolSetting(UseMessageBoxForSignals)
&& !isStopperThread) && !isStopperThread && !isAutoTestRunning())
showStoppedBySignalMessageBox(_(meaning), _(name)); showStoppedBySignalMessageBox(_(meaning), _(name));
if (!name.isEmpty() && !meaning.isEmpty()) if (!name.isEmpty() && !meaning.isEmpty())
reasontr = msgStoppedBySignal(_(meaning), _(name)); reasontr = msgStoppedBySignal(_(meaning), _(name));
@@ -1667,7 +1667,7 @@ void GdbEngine::handleStop2()
if (supportsThreads()) { if (supportsThreads()) {
if (m_gdbAdapter->isCodaAdapter()) { if (m_gdbAdapter->isCodaAdapter()) {
m_gdbAdapter->codaReloadThreads(); m_gdbAdapter->codaReloadThreads();
} else if (m_isMacGdb) { } else if (m_isMacGdb || m_gdbVersion < 70100) {
postCommand("-thread-list-ids", Discardable, CB(handleThreadListIds)); postCommand("-thread-list-ids", Discardable, CB(handleThreadListIds));
} else { } else {
// This is only available in gdb 7.1+. // This is only available in gdb 7.1+.
@@ -1715,6 +1715,11 @@ void GdbEngine::handleShowVersion(const GdbResponse &response)
if (m_gdbVersion > 70300) if (m_gdbVersion > 70300)
m_hasBreakpointNotifications = true; m_hasBreakpointNotifications = true;
if (usesExecInterrupt())
postCommand("set target-async on", ConsoleCommand);
else
postCommand("set target-async off", ConsoleCommand);
} }
} }
@@ -4707,11 +4712,7 @@ bool GdbEngine::startGdb(const QStringList &args, const QString &settingsIdHint)
postCommand("set trust-readonly-sections on", ConsoleCommand); postCommand("set trust-readonly-sections on", ConsoleCommand);
postCommand("set auto-solib-add on", ConsoleCommand); postCommand("set auto-solib-add on", ConsoleCommand);
postCommand("set remotecache on", ConsoleCommand); postCommand("set remotecache on", ConsoleCommand);
//postCommand("set non-stop on", ConsoleCommand);
if (0 && debuggerCore()->boolSetting(TargetAsync)) {
postCommand("set target-async on", ConsoleCommand);
postCommand("set non-stop on", ConsoleCommand);
}
// Work around https://bugreports.qt-project.org/browse/QTCREATORBUG-2004 // Work around https://bugreports.qt-project.org/browse/QTCREATORBUG-2004
postCommand("maintenance set internal-warning quit no", ConsoleCommand); postCommand("maintenance set internal-warning quit no", ConsoleCommand);
@@ -5130,6 +5131,17 @@ bool GdbEngine::isHiddenBreakpoint(const BreakpointResponseId &id) const
return isQFatalBreakpoint(id) || isQmlStepBreakpoint(id); return isQFatalBreakpoint(id) || isQmlStepBreakpoint(id);
} }
bool GdbEngine::usesExecInterrupt() const
{
if (m_gdbVersion < 70000)
return false;
// debuggerCore()->boolSetting(TargetAsync)
DebuggerStartMode mode = startParameters().startMode;
return mode == AttachToRemoteServer
|| mode == AttachToRemoteProcess;
}
void GdbEngine::scheduleTestResponse(int testCase, const QByteArray &response) void GdbEngine::scheduleTestResponse(int testCase, const QByteArray &response)
{ {
if (!m_testCases.contains(testCase) && startParameters().testCase != testCase) if (!m_testCases.contains(testCase) && startParameters().testCase != testCase)

View File

@@ -732,6 +732,8 @@ private: ////////// View & Data Stuff //////////
BreakpointResponseId m_qFatalBreakpointResponseId; BreakpointResponseId m_qFatalBreakpointResponseId;
bool m_actingOnExpectedStop; bool m_actingOnExpectedStop;
bool usesExecInterrupt() const;
QHash<int, QByteArray> m_scheduledTestResponses; QHash<int, QByteArray> m_scheduledTestResponses;
QSet<int> m_testCases; QSet<int> m_testCases;
}; };

View File

@@ -154,6 +154,9 @@ public:
bool visit(UiScriptBinding *ast) bool visit(UiScriptBinding *ast)
{ {
if (!ast->statement)
return true;
quint32 sourceStartLine = ast->firstSourceLocation().startLine; quint32 sourceStartLine = ast->firstSourceLocation().startLine;
quint32 statementStartLine; quint32 statementStartLine;
quint32 statementColumn; quint32 statementColumn;
@@ -165,6 +168,8 @@ public:
} else if (ast->statement->kind == Node::Kind_Block) { } else if (ast->statement->kind == Node::Kind_Block) {
Block *block = static_cast<Block *>(ast->statement); Block *block = static_cast<Block *>(ast->statement);
if (!block || !block->statements)
return true;
statementStartLine = block->statements->firstSourceLocation(). statementStartLine = block->statements->firstSourceLocation().
startLine; startLine;
statementColumn = block->statements->firstSourceLocation(). statementColumn = block->statements->firstSourceLocation().

View File

@@ -91,6 +91,8 @@ public:
QmlAdapter *adapter() const; QmlAdapter *adapter() const;
void insertBreakpoint(BreakpointModelId id);
public slots: public slots:
void disconnected(); void disconnected();
void documentUpdated(QmlJS::Document::Ptr doc); void documentUpdated(QmlJS::Document::Ptr doc);
@@ -130,7 +132,6 @@ private:
void selectThread(int index); void selectThread(int index);
void attemptBreakpointSynchronization(); void attemptBreakpointSynchronization();
void insertBreakpoint(BreakpointModelId id);
void removeBreakpoint(BreakpointModelId id); void removeBreakpoint(BreakpointModelId id);
void changeBreakpoint(BreakpointModelId id); void changeBreakpoint(BreakpointModelId id);
bool acceptsBreakpoint(BreakpointModelId id) const; bool acceptsBreakpoint(BreakpointModelId id) const;

View File

@@ -1131,23 +1131,21 @@ void QmlV8DebuggerClient::changeBreakpoint(const BreakpointModelId &id)
BreakHandler *handler = d->engine->breakHandler(); BreakHandler *handler = d->engine->breakHandler();
const BreakpointParameters &params = handler->breakpointData(id); const BreakpointParameters &params = handler->breakpointData(id);
BreakpointResponse br = handler->response(id);
if (params.type == BreakpointAtJavaScriptThrow) { if (params.type == BreakpointAtJavaScriptThrow) {
d->setExceptionBreak(AllExceptions, params.enabled); d->setExceptionBreak(AllExceptions, params.enabled);
br.enabled = params.enabled;
handler->setResponse(id, br);
} else if (params.type == BreakpointOnQmlSignalHandler) { } else if (params.type == BreakpointOnQmlSignalHandler) {
d->setBreakpoint(QString(_(EVENT)), params.functionName, params.enabled); d->setBreakpoint(QString(_(EVENT)), params.functionName, params.enabled);
br.enabled = params.enabled;
handler->setResponse(id, br);
} else { } else {
int breakpoint = d->breakpoints.value(id); //V8 supports only minimalistic changes in breakpoint
d->changeBreakpoint(breakpoint, params.enabled, QLatin1String(params.condition), //Remove the breakpoint and add again
params.ignoreCount); removeBreakpoint(id);
d->engine->insertBreakpoint(id);
} }
BreakpointResponse br = handler->response(id);
br.enabled = params.enabled;
br.condition = params.condition;
br.ignoreCount = params.ignoreCount;
handler->setResponse(id, br);
} }
void QmlV8DebuggerClient::synchronizeBreakpoints() void QmlV8DebuggerClient::synchronizeBreakpoints()

View File

@@ -418,7 +418,7 @@ public:
bool isReturn() const bool isReturn() const
{ {
return m_key == Key_Return; return m_key == Key_Return || m_key == Key_Enter;
} }
bool isEscape() const bool isEscape() const

View File

@@ -163,7 +163,6 @@ void TaskModel::updateTaskLineNumber(unsigned int id, int line)
if (m_tasks.at(i).taskId == id) { if (m_tasks.at(i).taskId == id) {
m_tasks[i].movedLine = line; m_tasks[i].movedLine = line;
emit dataChanged(index(i, 0), index(i, 0)); emit dataChanged(index(i, 0), index(i, 0));
return;
} }
} }

View File

@@ -482,7 +482,8 @@ UnConfiguredSettings Qt4Manager::unconfiguredSettings() const
} }
} }
m_unConfiguredVersionId = version->uniqueId(); m_unConfiguredVersionId = version->uniqueId();
m_unconfiguredToolChainId = toolChain->id(); if (toolChain)
m_unconfiguredToolChainId = toolChain->id();
} }
UnConfiguredSettings us; UnConfiguredSettings us;
us.version = version; us.version = version;

View File

@@ -596,7 +596,9 @@ void QtOptionsPageWidget::addQtDir()
QFileDialog::getOpenFileName(this, QFileDialog::getOpenFileName(this,
tr("Select a qmake executable"), tr("Select a qmake executable"),
QString(), QString(),
filterForQmakeFileDialog())); filterForQmakeFileDialog(),
0,
QFileDialog::DontResolveSymlinks));
if (qtVersion.isNull()) if (qtVersion.isNull())
return; return;
if (QtVersionManager::instance()->qtVersionForQMakeBinary(qtVersion)) { if (QtVersionManager::instance()->qtVersionForQMakeBinary(qtVersion)) {
@@ -642,7 +644,10 @@ void QtOptionsPageWidget::editPath()
Utils::FileName qtVersion = Utils::FileName::fromString( Utils::FileName qtVersion = Utils::FileName::fromString(
QFileDialog::getOpenFileName(this, QFileDialog::getOpenFileName(this,
tr("Select a qmake executable"), tr("Select a qmake executable"),
dir, filterForQmakeFileDialog())); dir,
filterForQmakeFileDialog(),
0,
QFileDialog::DontResolveSymlinks));
if (qtVersion.isNull()) if (qtVersion.isNull())
return; return;
BaseQtVersion *version = QtVersionFactory::createQtVersionFromQMakePath(qtVersion); BaseQtVersion *version = QtVersionFactory::createQtVersionFromQMakePath(qtVersion);

View File

@@ -69,7 +69,7 @@ public:
QString CodeStylePoolPrivate::generateUniqueId(const QString &id) const QString CodeStylePoolPrivate::generateUniqueId(const QString &id) const
{ {
if (!m_idToCodeStyle.contains(id)) if (!id.isEmpty() && !m_idToCodeStyle.contains(id))
return id; return id;
int idx = id.size(); int idx = id.size();
@@ -80,7 +80,7 @@ QString CodeStylePoolPrivate::generateUniqueId(const QString &id) const
} }
const QString baseName = id.left(idx); const QString baseName = id.left(idx);
QString newName = baseName; QString newName = baseName.isEmpty() ? QLatin1String("codestyle") : baseName;
int i = 2; int i = 2;
while (m_idToCodeStyle.contains(newName)) while (m_idToCodeStyle.contains(newName))
newName = baseName + QString::number(i++); newName = baseName + QString::number(i++);

View File

@@ -117,6 +117,7 @@ CodeStyleDialog::CodeStyleDialog(ICodeStylePreferencesFactory *factory,
m_codeStyle = factory->createCodeStyle(); m_codeStyle = factory->createCodeStyle();
m_codeStyle->setTabSettings(codeStyle->tabSettings()); m_codeStyle->setTabSettings(codeStyle->tabSettings());
m_codeStyle->setValue(codeStyle->value()); m_codeStyle->setValue(codeStyle->value());
m_codeStyle->setId(codeStyle->id());
m_codeStyle->setDisplayName(m_originalDisplayName); m_codeStyle->setDisplayName(m_originalDisplayName);
QWidget *editor = factory->createEditor(m_codeStyle, this); QWidget *editor = factory->createEditor(m_codeStyle, this);