Merge remote-tracking branch 'origin/3.2'

Conflicts:
	src/plugins/git/changeselectiondialog.cpp
	src/plugins/git/changeselectiondialog.h
	src/plugins/git/gerrit/gerritplugin.cpp
	src/plugins/git/gitclient.cpp
	src/plugins/git/gitclient.h
	src/plugins/git/gitsettings.cpp
	src/plugins/git/gitsettings.h
	src/plugins/git/mergetool.cpp

Change-Id: Icd1b2741da96395ed1b41903f453049a303e4791
This commit is contained in:
Eike Ziller
2014-07-18 14:04:51 +02:00
75 changed files with 801 additions and 452 deletions

View File

@@ -167,12 +167,17 @@
\section1 Applying QML Changes at Runtime \section1 Applying QML Changes at Runtime
\omit
// currently broken & disabled
If you change property values or add properties in the code editor, the If you change property values or add properties in the code editor, the
debugger can update the properties in the running application when you save debugger can update the properties in the running application when you save
the file. This is enabled by default. To disable it, click the the file. This is enabled by default. To disable it, click the
\inlineimage qml-observer-bar-reload.png "Apply Changes on Save button" \inlineimage qml-observer-bar-reload.png "Apply Changes on Save button"
(\gui {Apply Changes on Save}) button on the toolbar. (\gui {Apply Changes on Save}) button on the toolbar.
\endomit
When you change property values in the \gui {QML/JS Console} or in the When you change property values in the \gui {QML/JS Console} or in the
\gui {Locals and Expressions} view, they are immediately updated in the running \gui {Locals and Expressions} view, they are immediately updated in the running
application, but not in the source code. application, but not in the source code.

View File

@@ -5,6 +5,7 @@ import QtcProduct
QtcProduct { QtcProduct {
type: "application" type: "application"
Depends { name: "Qt.test" } Depends { name: "Qt.test" }
Depends { name: "copyable_resource" }
targetName: "tst_" + name.split(' ').join("") targetName: "tst_" + name.split(' ').join("")
// This needs to be absolute, because it is passed to one of the source files. // This needs to be absolute, because it is passed to one of the source files.

View File

@@ -0,0 +1,32 @@
import qbs
import qbs.File
import qbs.FileInfo
Module {
property path targetDirectory
additionalProductTypes: "copied_resource"
Rule {
inputs: ["copyable_resource"]
outputFileTags: ["copied_resource"]
outputArtifacts: {
var destinationDir = input.moduleProperty("copyable_resource", "targetDirectory");
if (!destinationDir) {
// If the destination directory has not been explicitly set, replicate the
// structure from the source directory in the build directory.
destinationDir = project.buildDirectory + '/'
+ FileInfo.relativePath(project.sourceDirectory, input.filePath);
}
return [{
filePath: destinationDir + '/' + input.fileName,
fileTags: ["copied_resource"]
}];
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "Copying " + FileInfo.fileName(input.fileName);
cmd.highlight = "codegen";
cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); };
return cmd;
}
}
}

View File

@@ -91,7 +91,7 @@ QmlJS::Snapshot Context::snapshot() const
return _snapshot; return _snapshot;
} }
ViewerContext Context::vContext() const ViewerContext Context::viewerContext() const
{ {
return _vContext; return _vContext;
} }

View File

@@ -52,14 +52,14 @@ public:
// Context takes ownership of valueOwner // Context takes ownership of valueOwner
static ContextPtr create(const Snapshot &snapshot, ValueOwner *valueOwner, static ContextPtr create(const Snapshot &snapshot, ValueOwner *valueOwner,
const ImportsPerDocument &imports, const ViewerContext &vContext); const ImportsPerDocument &imports, const ViewerContext &viewerContext);
~Context(); ~Context();
ContextPtr ptr() const; ContextPtr ptr() const;
ValueOwner *valueOwner() const; ValueOwner *valueOwner() const;
Snapshot snapshot() const; Snapshot snapshot() const;
ViewerContext vContext() const; ViewerContext viewerContext() const;
const Imports *imports(const Document *doc) const; const Imports *imports(const Document *doc) const;
@@ -73,7 +73,7 @@ public:
private: private:
// Context takes ownership of valueOwner // Context takes ownership of valueOwner
Context(const Snapshot &snapshot, ValueOwner *valueOwner, const ImportsPerDocument &imports, Context(const Snapshot &snapshot, ValueOwner *valueOwner, const ImportsPerDocument &imports,
const ViewerContext &vContext); const ViewerContext &viewerContext);
Snapshot _snapshot; Snapshot _snapshot;
QSharedPointer<ValueOwner> _valueOwner; QSharedPointer<ValueOwner> _valueOwner;

View File

@@ -198,7 +198,7 @@ ImportKey ImportKey::flatKey() const {
return res; return res;
} }
QString ImportKey::libPath() const QString ImportKey::libraryQualifiedPath() const
{ {
QString res = splitPath.join(QString::fromLatin1(".")); QString res = splitPath.join(QString::fromLatin1("."));
if (res.isEmpty() && !splitPath.isEmpty()) if (res.isEmpty() && !splitPath.isEmpty())

View File

@@ -108,7 +108,7 @@ public:
int minorVersion; int minorVersion;
QString path() const; QString path() const;
QString libPath() const; QString libraryQualifiedPath() const;
void addToHash(QCryptographicHash &hash) const; void addToHash(QCryptographicHash &hash) const;
ImportKey flatKey() const; ImportKey flatKey() const;

View File

@@ -181,9 +181,9 @@ bool FakeMetaObjectWithOrigin::operator ==(const FakeMetaObjectWithOrigin &o) co
return fakeMetaObject == o.fakeMetaObject; return fakeMetaObject == o.fakeMetaObject;
} }
uint qHash(const FakeMetaObjectWithOrigin &fmoo, int seed) uint qHash(const FakeMetaObjectWithOrigin &fmoo)
{ {
return qHash(fmoo.fakeMetaObject, seed); return qHash(fmoo.fakeMetaObject);
} }
} // namespace QmlJS } // namespace QmlJS

View File

@@ -687,7 +687,7 @@ public:
bool operator ==(const FakeMetaObjectWithOrigin &o) const; bool operator ==(const FakeMetaObjectWithOrigin &o) const;
}; };
QMLJS_EXPORT uint qHash(const FakeMetaObjectWithOrigin &fmoo, int seed = 0); QMLJS_EXPORT uint qHash(const FakeMetaObjectWithOrigin &fmoo);
class QMLJS_EXPORT CppQmlTypes class QMLJS_EXPORT CppQmlTypes
{ {

View File

@@ -29,16 +29,188 @@
#include "basetreeview.h" #include "basetreeview.h"
#include <utils/qtcassert.h>
#include <QDebug> #include <QDebug>
#include <QFontMetrics> #include <QFontMetrics>
#include <QHeaderView> #include <QHeaderView>
#include <QItemDelegate> #include <QItemDelegate>
#include <QLabel> #include <QLabel>
#include <QMap>
#include <QMenu> #include <QMenu>
#include <QMouseEvent> #include <QMouseEvent>
#include <QSettings>
#include <QTimer> #include <QTimer>
namespace Utils { namespace Utils {
namespace Internal {
const char ColumnKey[] = "Columns";
class BaseTreeViewPrivate : public QObject
{
Q_OBJECT
public:
explicit BaseTreeViewPrivate(BaseTreeView *parent)
: q(parent), m_settings(0), m_expectUserChanges(false)
{}
bool eventFilter(QObject *, QEvent *event)
{
if (event->type() == QEvent::MouseMove) {
// At this time we don't know which section will get which size.
// But we know that a resizedSection() will be emitted later.
QMouseEvent *me = static_cast<QMouseEvent *>(event);
if (me->buttons() & Qt::LeftButton)
m_expectUserChanges = true;
}
return false;
}
void readSettings()
{
// This only reads setting, does not restore state.
// Storage format is a flat list of column numbers and width.
// Columns not mentioned are resized to content////
m_userHandled.clear();
if (m_settings && !m_settingsKey.isEmpty()) {
m_settings->beginGroup(m_settingsKey);
QVariantList l = m_settings->value(QLatin1String(ColumnKey)).toList();
QTC_ASSERT(l.size() % 2 == 0, qDebug() << m_settingsKey; l.append(0));
for (int i = 0; i < l.size(); i += 2) {
int column = l.at(i).toInt();
int width = l.at(i + 1).toInt();
QTC_ASSERT(column >= 0 && column < 20, qDebug() << m_settingsKey << column; continue);
QTC_ASSERT(width > 0 && width < 10000, qDebug() << m_settingsKey << width; continue);
m_userHandled[column] = width;
}
m_settings->endGroup();
}
}
void restoreState()
{
if (m_settings && !m_settingsKey.isEmpty()) {
QHeaderView *h = q->header();
for (auto it = m_userHandled.constBegin(), et = m_userHandled.constEnd(); it != et; ++it) {
const int column = it.key();
const int targetSize = it.value();
const int currentSize = h->sectionSize(column);
if (targetSize > 0 && targetSize != currentSize)
h->resizeSection(column, targetSize);
}
}
}
void saveState()
{
if (m_settings && !m_settingsKey.isEmpty()) {
m_settings->beginGroup(m_settingsKey);
QVariantList l;
for (auto it = m_userHandled.constBegin(), et = m_userHandled.constEnd(); it != et; ++it) {
const int column = it.key();
const int width = it.value();
QTC_ASSERT(column >= 0 && column < q->model()->columnCount(), continue);
QTC_ASSERT(width > 0 && width < 10000, continue);
l.append(column);
l.append(width);
}
m_settings->setValue(QLatin1String(ColumnKey), l);
m_settings->endGroup();
}
}
Q_SLOT void handleSectionResized(int logicalIndex, int /*oldSize*/, int newSize)
{
if (m_expectUserChanges) {
m_userHandled[logicalIndex] = newSize;
saveState();
m_expectUserChanges = false;
}
}
int suggestedColumnSize(int column) const
{
QHeaderView *h = q->header();
QTC_ASSERT(h, return -1);
QAbstractItemModel *m = q->model();
QTC_ASSERT(m, return -1);
QModelIndex a = q->indexAt(QPoint(1, 1));
a = a.sibling(a.row(), column);
QFontMetrics fm = q->fontMetrics();
int minimum = fm.width(m->headerData(column, Qt::Horizontal).toString());
const int ind = q->indentation();
for (int i = 0; i < 100 && a.isValid(); ++i) {
const QString s = m->data(a).toString();
int w = fm.width(s) + 10;
if (column == 0) {
for (QModelIndex b = a.parent(); b.isValid(); b = b.parent())
w += ind;
}
if (w > minimum)
minimum = w;
a = q->indexBelow(a);
}
return minimum;
}
Q_SLOT void resizeColumns()
{
QHeaderView *h = q->header();
QTC_ASSERT(h, return);
if (m_settings && !m_settingsKey.isEmpty()) {
for (int i = 0, n = h->count(); i != n; ++i) {
int targetSize;
if (m_userHandled.contains(i))
targetSize = m_userHandled.value(i);
else
targetSize = suggestedColumnSize(i);
const int currentSize = h->sectionSize(i);
if (targetSize > 0 && targetSize != currentSize)
h->resizeSection(i, targetSize);
}
}
}
Q_SLOT void rowActivatedHelper(const QModelIndex &index)
{
q->rowActivated(index);
}
Q_SLOT void rowClickedHelper(const QModelIndex &index)
{
q->rowClicked(index);
}
Q_SLOT void toggleColumnWidth(int logicalIndex)
{
QHeaderView *h = q->header();
const int currentSize = h->sectionSize(logicalIndex);
const int suggestedSize = suggestedColumnSize(logicalIndex);
int targetSize = suggestedSize;
// We switch to the size suggested by the contents, except
// when we have that size already, in that case minimize.
if (currentSize == suggestedSize) {
QFontMetrics fm = q->fontMetrics();
int headerSize = fm.width(q->model()->headerData(logicalIndex, Qt::Horizontal).toString());
int minSize = 10 * fm.width(QLatin1Char('x'));
targetSize = qMax(minSize, headerSize);
}
h->resizeSection(logicalIndex, targetSize);
m_userHandled.remove(logicalIndex); // Reset.
saveState();
}
public:
BaseTreeView *q;
QMap<int, int> m_userHandled; // column -> width, "not present" means "automatic"
QSettings *m_settings;
QString m_settingsKey;
bool m_expectUserChanges;
};
class BaseTreeViewDelegate : public QItemDelegate class BaseTreeViewDelegate : public QItemDelegate
{ {
@@ -58,8 +230,12 @@ public:
} }
}; };
} // namespace Internal
using namespace Internal;
BaseTreeView::BaseTreeView(QWidget *parent) BaseTreeView::BaseTreeView(QWidget *parent)
: TreeView(parent) : TreeView(parent), d(new BaseTreeViewPrivate(this))
{ {
setAttribute(Qt::WA_MacShowFocusRect, false); setAttribute(Qt::WA_MacShowFocusRect, false);
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
@@ -68,30 +244,42 @@ BaseTreeView::BaseTreeView(QWidget *parent)
setSelectionMode(QAbstractItemView::ExtendedSelection); setSelectionMode(QAbstractItemView::ExtendedSelection);
setUniformRowHeights(true); setUniformRowHeights(true);
setItemDelegate(new BaseTreeViewDelegate(this)); setItemDelegate(new BaseTreeViewDelegate(this));
header()->setDefaultAlignment(Qt::AlignLeft);
header()->setClickable(true); QHeaderView *h = header();
h->setDefaultAlignment(Qt::AlignLeft);
h->setClickable(true);
h->viewport()->installEventFilter(d);
connect(this, SIGNAL(activated(QModelIndex)), connect(this, SIGNAL(activated(QModelIndex)),
SLOT(rowActivatedHelper(QModelIndex))); d, SLOT(rowActivatedHelper(QModelIndex)));
connect(this, SIGNAL(clicked(QModelIndex)), connect(this, SIGNAL(clicked(QModelIndex)),
SLOT(rowClickedHelper(QModelIndex))); d, SLOT(rowClickedHelper(QModelIndex)));
connect(header(), SIGNAL(sectionClicked(int)), connect(h, SIGNAL(sectionClicked(int)),
SLOT(toggleColumnWidth(int))); d, SLOT(toggleColumnWidth(int)));
connect(h, SIGNAL(sectionResized(int,int,int)),
d, SLOT(handleSectionResized(int,int,int)));
}
BaseTreeView::~BaseTreeView()
{
delete d;
} }
void BaseTreeView::setModel(QAbstractItemModel *m) void BaseTreeView::setModel(QAbstractItemModel *m)
{ {
QAbstractItemModel *oldModel = model();
const char *sig = "columnAdjustmentRequested()"; const char *sig = "columnAdjustmentRequested()";
if (model()) { if (oldModel) {
int index = model()->metaObject()->indexOfSignal(sig); int index = model()->metaObject()->indexOfSignal(sig);
if (index != -1) if (index != -1)
disconnect(model(), SIGNAL(columnAdjustmentRequested()), this, SLOT(resizeColumns())); disconnect(model(), SIGNAL(columnAdjustmentRequested()), d, SLOT(resizeColumns()));
} }
TreeView::setModel(m); TreeView::setModel(m);
if (m) { if (m) {
int index = m->metaObject()->indexOfSignal(sig); int index = m->metaObject()->indexOfSignal(sig);
if (index != -1) if (index != -1)
connect(m, SIGNAL(columnAdjustmentRequested()), this, SLOT(resizeColumns())); connect(m, SIGNAL(columnAdjustmentRequested()), d, SLOT(resizeColumns()));
d->restoreState();
} }
} }
@@ -100,60 +288,15 @@ void BaseTreeView::mousePressEvent(QMouseEvent *ev)
TreeView::mousePressEvent(ev); TreeView::mousePressEvent(ev);
const QModelIndex mi = indexAt(ev->pos()); const QModelIndex mi = indexAt(ev->pos());
if (!mi.isValid()) if (!mi.isValid())
toggleColumnWidth(columnAt(ev->x())); d->toggleColumnWidth(columnAt(ev->x()));
} }
void BaseTreeView::resizeColumns() void BaseTreeView::setSettings(QSettings *settings, const QByteArray &key)
{ {
QHeaderView *h = header(); QTC_ASSERT(!d->m_settings, qDebug() << "DUPLICATED setSettings" << key);
if (!h) d->m_settings = settings;
return; d->m_settingsKey = QString::fromLatin1(key);
d->readSettings();
for (int i = 0, n = h->count(); i != n; ++i) {
int targetSize = suggestedColumnSize(i);
if (targetSize > 0)
h->resizeSection(i, targetSize);
}
}
int BaseTreeView::suggestedColumnSize(int column) const
{
QHeaderView *h = header();
if (!h)
return -1;
QModelIndex a = indexAt(QPoint(1, 1));
a = a.sibling(a.row(), column);
QFontMetrics fm(font());
int m = fm.width(model()->headerData(column, Qt::Horizontal).toString());
const int ind = indentation();
for (int i = 0; i < 100 && a.isValid(); ++i) {
const QString s = model()->data(a).toString();
int w = fm.width(s) + 10;
if (column == 0) {
for (QModelIndex b = a.parent(); b.isValid(); b = b.parent())
w += ind;
}
if (w > m)
m = w;
a = indexBelow(a);
}
return m;
}
void BaseTreeView::toggleColumnWidth(int logicalIndex)
{
QHeaderView *h = header();
const int currentSize = h->sectionSize(logicalIndex);
const int suggestedSize = suggestedColumnSize(logicalIndex);
if (currentSize == suggestedSize) {
QFontMetrics fm(font());
int headerSize = fm.width(model()->headerData(logicalIndex, Qt::Horizontal).toString());
int minSize = 10 * fm.width(QLatin1Char('x'));
h->resizeSection(logicalIndex, qMax(minSize, headerSize));
} else {
h->resizeSection(logicalIndex, suggestedSize);
}
} }
QModelIndexList BaseTreeView::activeRows() const QModelIndexList BaseTreeView::activeRows() const
@@ -169,3 +312,5 @@ QModelIndexList BaseTreeView::activeRows() const
} }
} // namespace Utils } // namespace Utils
#include "basetreeview.moc"

View File

@@ -34,15 +34,23 @@
#include "itemviews.h" #include "itemviews.h"
QT_BEGIN_NAMESPACE
class QSettings;
QT_END_NAMESPACE
namespace Utils { namespace Utils {
namespace Internal { class BaseTreeViewPrivate; }
class QTCREATOR_UTILS_EXPORT BaseTreeView : public TreeView class QTCREATOR_UTILS_EXPORT BaseTreeView : public TreeView
{ {
Q_OBJECT Q_OBJECT
public: public:
BaseTreeView(QWidget *parent = 0); BaseTreeView(QWidget *parent = 0);
~BaseTreeView();
void setSettings(QSettings *settings, const QByteArray &key);
QModelIndexList activeRows() const; QModelIndexList activeRows() const;
void setModel(QAbstractItemModel *model); void setModel(QAbstractItemModel *model);
@@ -51,16 +59,10 @@ public:
void mousePressEvent(QMouseEvent *ev); void mousePressEvent(QMouseEvent *ev);
public slots: public slots:
void resizeColumns();
void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); } void setAlternatingRowColorsHelper(bool on) { setAlternatingRowColors(on); }
private slots:
void rowActivatedHelper(const QModelIndex &index) { rowActivated(index); }
void rowClickedHelper(const QModelIndex &index) { rowClicked(index); }
void toggleColumnWidth(int logicalIndex);
private: private:
int suggestedColumnSize(int column) const; Internal::BaseTreeViewPrivate *d;
}; };
} // namespace Utils } // namespace Utils

View File

@@ -31,6 +31,7 @@
#include "qtcassert.h" #include "qtcassert.h"
#include <QApplication>
#include <QContextMenuEvent> #include <QContextMenuEvent>
#include <QDebug> #include <QDebug>
#include <QDockWidget> #include <QDockWidget>
@@ -42,6 +43,7 @@
#include <QSettings> #include <QSettings>
#include <QStyle> #include <QStyle>
#include <QStyleOption> #include <QStyleOption>
#include <QTimer>
#include <QToolButton> #include <QToolButton>
static const char stateKeyC[] = "State"; static const char stateKeyC[] = "State";
@@ -131,7 +133,7 @@ public:
const int minWidth = 10; const int minWidth = 10;
const int maxWidth = 10000; const int maxWidth = 10000;
const int inactiveHeight = 3; const int inactiveHeight = 0;
const int activeHeight = m_closeButton->sizeHint().height() + 2; const int activeHeight = m_closeButton->sizeHint().height() + 2;
m_minimumInactiveSize = QSize(minWidth, inactiveHeight); m_minimumInactiveSize = QSize(minWidth, inactiveHeight);
@@ -150,12 +152,6 @@ public:
setLayout(layout); setLayout(layout);
} }
void enterEvent(QEvent *event)
{
setActive(true);
QWidget::enterEvent(event);
}
void leaveEvent(QEvent *event) void leaveEvent(QEvent *event)
{ {
if (!q->isFloating()) if (!q->isFloating())
@@ -202,27 +198,84 @@ public:
class DockWidget : public QDockWidget class DockWidget : public QDockWidget
{ {
Q_OBJECT
public: public:
DockWidget(QWidget *inner, QWidget *parent) DockWidget(QWidget *inner, QWidget *parent)
: QDockWidget(parent) : QDockWidget(parent), m_inner(inner)
{ {
setWidget(inner); setWidget(inner);
setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable); setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable);
setObjectName(inner->objectName() + QLatin1String("DockWidget")); setObjectName(inner->objectName() + QLatin1String("DockWidget"));
setWindowTitle(inner->windowTitle()); setWindowTitle(inner->windowTitle());
setMouseTracking(true);
QStyleOptionDockWidget opt; QStyleOptionDockWidget opt;
initStyleOption(&opt); initStyleOption(&opt);
auto titleBar = new TitleBarWidget(this, opt); m_titleBar = new TitleBarWidget(this, opt);
titleBar->m_titleLabel->setText(inner->windowTitle()); m_titleBar->m_titleLabel->setText(inner->windowTitle());
setTitleBarWidget(titleBar); setTitleBarWidget(m_titleBar);
m_timer.setSingleShot(true);
m_timer.setInterval(500);
connect(&m_timer, SIGNAL(timeout()), this, SLOT(handleMouseTimeout()));
connect(this, SIGNAL(topLevelChanged(bool)), this, SLOT(handleToplevelChanged(bool)));
auto origFloatButton = findChild<QAbstractButton *>(QLatin1String("qt_dockwidget_floatbutton")); auto origFloatButton = findChild<QAbstractButton *>(QLatin1String("qt_dockwidget_floatbutton"));
connect(titleBar->m_floatButton, SIGNAL(clicked()), origFloatButton, SIGNAL(clicked())); connect(m_titleBar->m_floatButton, SIGNAL(clicked()), origFloatButton, SIGNAL(clicked()));
auto origCloseButton = findChild<QAbstractButton *>(QLatin1String("qt_dockwidget_closebutton")); auto origCloseButton = findChild<QAbstractButton *>(QLatin1String("qt_dockwidget_closebutton"));
connect(titleBar->m_closeButton, SIGNAL(clicked()), origCloseButton, SIGNAL(clicked())); connect(m_titleBar->m_closeButton, SIGNAL(clicked()), origCloseButton, SIGNAL(clicked()));
} }
bool eventFilter(QObject *, QEvent *event)
{
if (event->type() == QEvent::MouseMove) {
QMouseEvent *me = static_cast<QMouseEvent *>(event);
int y = me->pos().y();
int x = me->pos().x();
int h = m_titleBar->m_floatButton->height();
if (!isFloating() && 0 <= x && x < m_inner->width() && 0 <= y && y <= h) {
m_timer.start();
m_startPos = mapToGlobal(me->pos());
}
}
return false;
}
void enterEvent(QEvent *event)
{
QApplication::instance()->installEventFilter(this);
QDockWidget::leaveEvent(event);
}
void leaveEvent(QEvent *event)
{
QApplication::instance()->removeEventFilter(this);
QDockWidget::leaveEvent(event);
}
Q_SLOT void handleMouseTimeout()
{
QPoint dist = m_startPos - QCursor::pos();
if (!isFloating() && dist.manhattanLength() < 4) {
m_titleBar->setActive(true);
}
}
Q_SLOT void handleToplevelChanged(bool floating)
{
if (!floating)
m_titleBar->setActive(false);
}
private:
QPoint m_startPos;
QWidget *m_inner;
TitleBarWidget *m_titleBar;
QTimer m_timer;
}; };
/*! \class Utils::FancyMainWindow /*! \class Utils::FancyMainWindow
@@ -324,9 +377,9 @@ void FancyMainWindow::showEvent(QShowEvent *event)
void FancyMainWindow::contextMenuEvent(QContextMenuEvent *event) void FancyMainWindow::contextMenuEvent(QContextMenuEvent *event)
{ {
QMenu *menu = createPopupMenu(); QMenu menu;
menu->exec(event->globalPos()); addDockActionsToMenu(&menu);
delete menu; menu.exec(event->globalPos());
} }
void FancyMainWindow::handleVisibilityChanged(bool visible) void FancyMainWindow::handleVisibilityChanged(bool visible)
@@ -395,7 +448,7 @@ static bool actionLessThan(const QAction *action1, const QAction *action2)
return action1->text().toLower() < action2->text().toLower(); return action1->text().toLower() < action2->text().toLower();
} }
QMenu *FancyMainWindow::createPopupMenu() void FancyMainWindow::addDockActionsToMenu(QMenu *menu)
{ {
QList<QAction *> actions; QList<QAction *> actions;
QList<QDockWidget *> dockwidgets = findChildren<QDockWidget *>(); QList<QDockWidget *> dockwidgets = findChildren<QDockWidget *>();
@@ -407,12 +460,10 @@ QMenu *FancyMainWindow::createPopupMenu()
} }
} }
qSort(actions.begin(), actions.end(), actionLessThan); qSort(actions.begin(), actions.end(), actionLessThan);
QMenu *menu = new QMenu(this);
foreach (QAction *action, actions) foreach (QAction *action, actions)
menu->addAction(action); menu->addAction(action);
menu->addAction(&d->m_menuSeparator); menu->addAction(&d->m_menuSeparator);
menu->addAction(&d->m_resetLayoutAction); menu->addAction(&d->m_resetLayoutAction);
return menu;
} }
QAction *FancyMainWindow::menuSeparator() const QAction *FancyMainWindow::menuSeparator() const
@@ -444,3 +495,5 @@ void FancyMainWindow::setToolBarDockWidget(QDockWidget *dock)
} }
} // namespace Utils } // namespace Utils
#include "fancymainwindow.moc"

View File

@@ -67,7 +67,7 @@ public:
QAction *resetLayoutAction() const; QAction *resetLayoutAction() const;
// Overwritten to add locked/reset. // Overwritten to add locked/reset.
virtual QMenu *createPopupMenu(); void addDockActionsToMenu(QMenu *menu);
QDockWidget *toolBarDockWidget() const; QDockWidget *toolBarDockWidget() const;
void setToolBarDockWidget(QDockWidget *dock); void setToolBarDockWidget(QDockWidget *dock);

View File

@@ -102,12 +102,12 @@ void AvdDialog::updateApiLevelComboBox()
m_avdDialog.warningIcon->setVisible(true); m_avdDialog.warningIcon->setVisible(true);
m_avdDialog.warningText->setVisible(true); m_avdDialog.warningText->setVisible(true);
m_avdDialog.warningText->setText(tr("Cannot create a new AVD. No sufficiently recent Android SDK available.\n" m_avdDialog.warningText->setText(tr("Cannot create a new AVD. No sufficiently recent Android SDK available.\n"
"Please install an SDK of at least API version %1.") "Install an SDK of at least API version %1.")
.arg(m_minApiLevel)); .arg(m_minApiLevel));
} else if (filteredList.isEmpty()) { } else if (filteredList.isEmpty()) {
m_avdDialog.warningIcon->setVisible(true); m_avdDialog.warningIcon->setVisible(true);
m_avdDialog.warningText->setVisible(true); m_avdDialog.warningText->setVisible(true);
m_avdDialog.warningText->setText(tr("Cannot create a AVD for ABI %1. Please install a image for it.") m_avdDialog.warningText->setText(tr("Cannot create a AVD for ABI %1. Install an image for it.")
.arg(abi())); .arg(abi()));
} else { } else {
m_avdDialog.warningIcon->setVisible(false); m_avdDialog.warningIcon->setVisible(false);

View File

@@ -3,7 +3,11 @@
<mime-type type="text/x-cmake"> <mime-type type="text/x-cmake">
<sub-class-of type="text/plain"/> <sub-class-of type="text/plain"/>
<comment>CMake Project file</comment> <comment>CMake Project file</comment>
<glob pattern="CMakeLists.txt"/>
<glob pattern="*.cmake"/> <glob pattern="*.cmake"/>
</mime-type> </mime-type>
<mime-type type="text/x-cmake-project">
<sub-class-of type="text/plain"/>
<comment>CMake Project file</comment>
<glob pattern="CMakeLists.txt"/>
</mime-type>
</mime-info> </mime-info>

View File

@@ -140,7 +140,7 @@ QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableBui
int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
{ {
return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath)) return (k && Core::MimeDatabase::findByFile(QFileInfo(projectPath))
.matchesType(QLatin1String(Constants::CMAKEMIMETYPE))) ? 0 : -1; .matchesType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE))) ? 0 : -1;
} }
QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k, QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSetups(const ProjectExplorer::Kit *k,

View File

@@ -51,6 +51,7 @@ CMakeEditorFactory::CMakeEditorFactory(CMakeManager *manager)
setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID); setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
setDisplayName(tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME)); setDisplayName(tr(CMakeProjectManager::Constants::CMAKE_EDITOR_DISPLAY_NAME));
addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE); addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE);
addMimeType(CMakeProjectManager::Constants::CMAKEPROJECTMIMETYPE);
new TextEditorActionHandler(this, Constants::C_CMAKEEDITOR, new TextEditorActionHandler(this, Constants::C_CMAKEEDITOR,
TextEditorActionHandler::UnCommentSelection TextEditorActionHandler::UnCommentSelection

View File

@@ -774,7 +774,7 @@ CMakeFile::CMakeFile(CMakeProject *parent, QString fileName)
: Core::IDocument(parent), m_project(parent) : Core::IDocument(parent), m_project(parent)
{ {
setId("Cmake.ProjectFile"); setId("Cmake.ProjectFile");
setMimeType(QLatin1String(Constants::CMAKEMIMETYPE)); setMimeType(QLatin1String(Constants::CMAKEPROJECTMIMETYPE));
setFilePath(fileName); setFilePath(fileName);
} }
@@ -830,7 +830,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
setLayout(fl); setLayout(fl);
QPushButton *runCmakeButton = new QPushButton(tr("Run cmake...")); QPushButton *runCmakeButton = new QPushButton(tr("Run CMake..."));
connect(runCmakeButton, SIGNAL(clicked()), connect(runCmakeButton, SIGNAL(clicked()),
this, SLOT(runCMake())); this, SLOT(runCMake()));
fl->addRow(tr("Reconfigure project:"), runCmakeButton); fl->addRow(tr("Reconfigure project:"), runCmakeButton);

View File

@@ -35,6 +35,7 @@ namespace Constants {
const char PROJECTCONTEXT[] = "CMakeProject.ProjectContext"; const char PROJECTCONTEXT[] = "CMakeProject.ProjectContext";
const char CMAKEMIMETYPE[] = "text/x-cmake"; const char CMAKEMIMETYPE[] = "text/x-cmake";
const char CMAKEPROJECTMIMETYPE[] = "text/x-cmake-project";
const char CMAKE_EDITOR_ID[] = "CMakeProject.CMakeEditor"; const char CMAKE_EDITOR_ID[] = "CMakeProject.CMakeEditor";
const char CMAKE_EDITOR_DISPLAY_NAME[] = "CMake Editor"; const char CMAKE_EDITOR_DISPLAY_NAME[] = "CMake Editor";
const char C_CMAKEEDITOR[] = "CMakeProject.Context.CMakeEditor"; const char C_CMAKEEDITOR[] = "CMakeProject.Context.CMakeEditor";

View File

@@ -135,7 +135,7 @@ ProjectExplorer::Project *CMakeManager::openProject(const QString &fileName, QSt
QString CMakeManager::mimeType() const QString CMakeManager::mimeType() const
{ {
return QLatin1String(Constants::CMAKEMIMETYPE); return QLatin1String(Constants::CMAKEPROJECTMIMETYPE);
} }
QString CMakeManager::cmakeExecutable() const QString CMakeManager::cmakeExecutable() const

View File

@@ -88,6 +88,7 @@ bool CMakeProjectPlugin::initialize(const QStringList & /*arguments*/, QString *
hf->setProductType<CMakeHighlighter>(); hf->setProductType<CMakeHighlighter>();
hf->setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID); hf->setId(CMakeProjectManager::Constants::CMAKE_EDITOR_ID);
hf->addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE); hf->addMimeType(CMakeProjectManager::Constants::CMAKEMIMETYPE);
hf->addMimeType(CMakeProjectManager::Constants::CMAKEPROJECTMIMETYPE);
addAutoReleasedObject(hf); addAutoReleasedObject(hf);
return true; return true;

View File

@@ -103,6 +103,7 @@ const char TOGGLE_FULLSCREEN[] = "QtCreator.ToggleFullScreen";
const char MINIMIZE_WINDOW[] = "QtCreator.MinimizeWindow"; const char MINIMIZE_WINDOW[] = "QtCreator.MinimizeWindow";
const char ZOOM_WINDOW[] = "QtCreator.ZoomWindow"; const char ZOOM_WINDOW[] = "QtCreator.ZoomWindow";
const char CLOSE_WINDOW[] = "QtCreator.CloseWindow";
const char SPLIT[] = "QtCreator.Split"; const char SPLIT[] = "QtCreator.Split";
const char SPLIT_SIDE_BY_SIDE[] = "QtCreator.SplitSideBySide"; const char SPLIT_SIDE_BY_SIDE[] = "QtCreator.SplitSideBySide";

View File

@@ -100,7 +100,8 @@ SOURCES += mainwindow.cpp \
dialogs/addtovcsdialog.cpp \ dialogs/addtovcsdialog.cpp \
icorelistener.cpp \ icorelistener.cpp \
ioutputpane.cpp \ ioutputpane.cpp \
patchtool.cpp patchtool.cpp \
windowsupport.cpp
HEADERS += mainwindow.h \ HEADERS += mainwindow.h \
editmode.h \ editmode.h \
@@ -199,7 +200,8 @@ HEADERS += mainwindow.h \
documentmanager.h \ documentmanager.h \
removefiledialog.h \ removefiledialog.h \
dialogs/addtovcsdialog.h \ dialogs/addtovcsdialog.h \
patchtool.h patchtool.h \
windowsupport.h
FORMS += dialogs/newdialog.ui \ FORMS += dialogs/newdialog.ui \
dialogs/saveitemsdialog.ui \ dialogs/saveitemsdialog.ui \

View File

@@ -100,6 +100,7 @@ QtcPlugin {
"variablemanager.cpp", "variablemanager.h", "variablemanager.cpp", "variablemanager.h",
"vcsmanager.cpp", "vcsmanager.h", "vcsmanager.cpp", "vcsmanager.h",
"versiondialog.cpp", "versiondialog.h", "versiondialog.cpp", "versiondialog.h",
"windowsupport.cpp", "windowsupport.h"
] ]
} }

View File

@@ -687,9 +687,18 @@ void EditorManager::splitNewWindow(Internal::EditorView *view)
else else
newEditor = editor; // move to the new view newEditor = editor; // move to the new view
splitter = new SplitterOrView; splitter = new SplitterOrView;
splitter->setAttribute(Qt::WA_DeleteOnClose); QWidget *win = new QWidget;
splitter->setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing QVBoxLayout *layout = new QVBoxLayout;
splitter->resize(QSize(800, 600)); layout->setMargin(0);
layout->setSpacing(0);
win->setLayout(layout);
layout->addWidget(splitter);
win->setFocusProxy(splitter);
win->setAttribute(Qt::WA_DeleteOnClose);
win->setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing
win->resize(QSize(800, 600));
static int windowId = 0;
ICore::registerWindow(win, Context(Id("EditorManager.ExternalWindow.").withSuffix(++windowId)));
IContext *context = new IContext; IContext *context = new IContext;
context->setContext(Context(Constants::C_EDITORMANAGER)); context->setContext(Context(Constants::C_EDITORMANAGER));
context->setWidget(splitter); context->setWidget(splitter);
@@ -697,8 +706,8 @@ void EditorManager::splitNewWindow(Internal::EditorView *view)
d->m_root.append(splitter); d->m_root.append(splitter);
d->m_rootContext.append(context); d->m_rootContext.append(context);
connect(splitter, SIGNAL(destroyed(QObject*)), m_instance, SLOT(rootDestroyed(QObject*))); connect(splitter, SIGNAL(destroyed(QObject*)), m_instance, SLOT(rootDestroyed(QObject*)));
splitter->show(); win->show();
ICore::raiseWindow(splitter); ICore::raiseWindow(win);
if (newEditor) if (newEditor)
m_instance->activateEditor(splitter->view(), newEditor, IgnoreNavigationHistory); m_instance->activateEditor(splitter->view(), newEditor, IgnoreNavigationHistory);
else else

View File

@@ -148,7 +148,7 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
m_ui.advancedButton->setDefaultAction(Core::ActionManager::command(Constants::ADVANCED_FIND)->action()); m_ui.advancedButton->setDefaultAction(Core::ActionManager::command(Constants::ADVANCED_FIND)->action());
m_goToCurrentFindAction = new QAction(tr("Go to Current Document Find"), this); m_goToCurrentFindAction = new QAction(this);
Core::ActionManager::registerAction(m_goToCurrentFindAction, Constants::S_RETURNTOEDITOR, Core::ActionManager::registerAction(m_goToCurrentFindAction, Constants::S_RETURNTOEDITOR,
Context(Constants::C_FINDTOOLBAR)); Context(Constants::C_FINDTOOLBAR));
connect(m_goToCurrentFindAction, SIGNAL(triggered()), this, SLOT(setFocusToCurrentFindSupport())); connect(m_goToCurrentFindAction, SIGNAL(triggered()), this, SLOT(setFocusToCurrentFindSupport()));

View File

@@ -28,6 +28,7 @@
****************************************************************************/ ****************************************************************************/
#include "icore.h" #include "icore.h"
#include "windowsupport.h"
#include <app/app_version.h> #include <app/app_version.h>
#include <extensionsystem/pluginmanager.h> #include <extensionsystem/pluginmanager.h>
@@ -523,6 +524,11 @@ void ICore::removeContextObject(IContext *context)
m_mainwindow->removeContextObject(context); m_mainwindow->removeContextObject(context);
} }
void ICore::registerWindow(QWidget *window, const Context &context)
{
new WindowSupport(window, context); // deletes itself when widget is destroyed
}
void ICore::openFiles(const QStringList &arguments, ICore::OpenFilesFlags flags) void ICore::openFiles(const QStringList &arguments, ICore::OpenFilesFlags flags)
{ {
m_mainwindow->openFiles(arguments, flags); m_mainwindow->openFiles(arguments, flags);

View File

@@ -109,6 +109,9 @@ public:
static void addContextObject(IContext *context); static void addContextObject(IContext *context);
static void removeContextObject(IContext *context); static void removeContextObject(IContext *context);
// manages the minimize, zoom and fullscreen actions for the window
static void registerWindow(QWidget *window, const Context &context);
enum OpenFilesFlags { enum OpenFilesFlags {
None = 0, None = 0,
SwitchMode = 1, SwitchMode = 1,

View File

@@ -54,6 +54,7 @@
#include "statusbarwidget.h" #include "statusbarwidget.h"
#include "externaltoolmanager.h" #include "externaltoolmanager.h"
#include "editormanager/systemeditor.h" #include "editormanager/systemeditor.h"
#include "windowsupport.h"
#include <app/app_version.h> #include <app/app_version.h>
#include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actioncontainer.h>
@@ -111,6 +112,7 @@ MainWindow::MainWindow() :
QLatin1String("QtCreator"), QLatin1String("QtCreator"),
this)), this)),
m_printer(0), m_printer(0),
m_windowSupport(0),
m_actionManager(new ActionManager(this)), m_actionManager(new ActionManager(this)),
m_editorManager(0), m_editorManager(0),
m_externalToolManager(0), m_externalToolManager(0),
@@ -138,9 +140,6 @@ MainWindow::MainWindow() :
m_exitAction(0), m_exitAction(0),
m_optionsAction(0), m_optionsAction(0),
m_toggleSideBarAction(0), m_toggleSideBarAction(0),
m_toggleFullScreenAction(0),
m_minimizeAction(0),
m_zoomAction(0),
m_toggleSideBarButton(new QToolButton) m_toggleSideBarButton(new QToolButton)
{ {
ActionManager::initialize(); // must be done before registering any actions ActionManager::initialize(); // must be done before registering any actions
@@ -236,21 +235,6 @@ void MainWindow::setOverrideColor(const QColor &color)
m_overrideColor = color; m_overrideColor = color;
} }
void MainWindow::updateFullScreenAction()
{
if (isFullScreen()) {
if (Utils::HostOsInfo::isMacHost())
m_toggleFullScreenAction->setText(tr("Exit Full Screen"));
else
m_toggleFullScreenAction->setChecked(true);
} else {
if (Utils::HostOsInfo::isMacHost())
m_toggleFullScreenAction->setText(tr("Enter Full Screen"));
else
m_toggleFullScreenAction->setChecked(false);
}
}
bool MainWindow::isNewItemDialogRunning() const bool MainWindow::isNewItemDialogRunning() const
{ {
return !m_newDialog.isNull(); return !m_newDialog.isNull();
@@ -345,6 +329,8 @@ bool MainWindow::init(QString *errorMessage)
void MainWindow::extensionsInitialized() void MainWindow::extensionsInitialized()
{ {
m_windowSupport = new WindowSupport(this, Context("Core.MainWindow"));
m_windowSupport->setCloseActionEnabled(false);
m_editorManager->init(); m_editorManager->init();
m_statusBarManager->extensionsInitalized(); m_statusBarManager->extensionsInitalized();
OutputPaneManager::instance()->init(); OutputPaneManager::instance()->init();
@@ -386,6 +372,11 @@ void MainWindow::closeEvent(QCloseEvent *event)
m_navigationWidget->closeSubWidgets(); m_navigationWidget->closeSubWidgets();
event->accept(); event->accept();
// explicitly delete window support, because that calls methods from ICore that call methods
// from mainwindow, so mainwindow still needs to be alive
delete m_windowSupport;
m_windowSupport = 0;
} }
void MainWindow::openDroppedFiles(const QStringList &files) void MainWindow::openDroppedFiles(const QStringList &files)
@@ -640,34 +631,42 @@ void MainWindow::registerDefaultActions()
if (UseMacShortcuts) { if (UseMacShortcuts) {
// Minimize Action // Minimize Action
m_minimizeAction = new QAction(tr("Minimize"), this); QAction *minimizeAction = new QAction(tr("Minimize"), this);
cmd = ActionManager::registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, globalContext); minimizeAction->setEnabled(false); // actual implementation in WindowSupport
cmd = ActionManager::registerAction(minimizeAction, Constants::MINIMIZE_WINDOW, globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M"))); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+M")));
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_minimizeAction, SIGNAL(triggered()), this, SLOT(showMinimized()));
// Zoom Action // Zoom Action
m_zoomAction = new QAction(tr("Zoom"), this); QAction *zoomAction = new QAction(tr("Zoom"), this);
cmd = ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, globalContext); zoomAction->setEnabled(false); // actual implementation in WindowSupport
cmd = ActionManager::registerAction(zoomAction, Constants::ZOOM_WINDOW, globalContext);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_zoomAction, SIGNAL(triggered()), this, SLOT(showMaximized()));
} }
// Full Screen Action // Full Screen Action
m_toggleFullScreenAction = new QAction(this); QAction *toggleFullScreenAction = new QAction(tr("Full Screen"), this);
m_toggleFullScreenAction->setMenuRole(QAction::NoRole); toggleFullScreenAction->setMenuRole(QAction::NoRole);
m_toggleFullScreenAction->setCheckable(!Utils::HostOsInfo::isMacHost()); toggleFullScreenAction->setCheckable(!Utils::HostOsInfo::isMacHost());
updateFullScreenAction(); toggleFullScreenAction->setEnabled(false); // actual implementation in WindowSupport
cmd = ActionManager::registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext); cmd = ActionManager::registerAction(toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, globalContext);
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11"))); cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Ctrl+Meta+F") : tr("Ctrl+Shift+F11")));
if (Utils::HostOsInfo::isMacHost()) if (Utils::HostOsInfo::isMacHost())
cmd->setAttribute(Command::CA_UpdateText); cmd->setAttribute(Command::CA_UpdateText);
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE); mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
connect(m_toggleFullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
if (UseMacShortcuts) if (UseMacShortcuts) {
mwindow->addSeparator(globalContext, Constants::G_WINDOW_SIZE); mwindow->addSeparator(globalContext, Constants::G_WINDOW_SIZE);
QAction *closeAction = new QAction(tr("Close Window"), this);
closeAction->setEnabled(false);
cmd = ActionManager::registerAction(closeAction, Constants::CLOSE_WINDOW, globalContext);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Meta+W")));
mwindow->addAction(cmd, Constants::G_WINDOW_SIZE);
mwindow->addSeparator(globalContext, Constants::G_WINDOW_SIZE);
}
// Show Sidebar Action // Show Sidebar Action
m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)), m_toggleSideBarAction = new QAction(QIcon(QLatin1String(Constants::ICON_TOGGLE_SIDEBAR)),
tr("Show Sidebar"), this); tr("Show Sidebar"), this);
@@ -898,15 +897,6 @@ void MainWindow::changeEvent(QEvent *e)
qDebug() << "main window activated"; qDebug() << "main window activated";
emit windowActivated(); emit windowActivated();
} }
} else if (e->type() == QEvent::WindowStateChange) {
if (Utils::HostOsInfo::isMacHost()) {
bool minimized = isMinimized();
if (debugMainWindow)
qDebug() << "main window state changed to minimized=" << minimized;
m_minimizeAction->setEnabled(!minimized);
m_zoomAction->setEnabled(!minimized);
}
updateFullScreenAction();
} }
} }
@@ -1113,15 +1103,6 @@ QPrinter *MainWindow::printer() const
return m_printer; return m_printer;
} }
void MainWindow::toggleFullScreen()
{
if (isFullScreen()) {
setWindowState(windowState() & ~Qt::WindowFullScreen);
} else {
setWindowState(windowState() | Qt::WindowFullScreen);
}
}
// Display a warning with an additional button to open // Display a warning with an additional button to open
// the debugger settings dialog if settingsId is nonempty. // the debugger settings dialog if settingsId is nonempty.

View File

@@ -76,6 +76,7 @@ class ToolSettings;
class MimeTypeSettings; class MimeTypeSettings;
class StatusBarManager; class StatusBarManager;
class VersionDialog; class VersionDialog;
class WindowSupport;
class SystemEditor; class SystemEditor;
class MainWindow : public Utils::AppMainWindow class MainWindow : public Utils::AppMainWindow
@@ -107,8 +108,6 @@ public:
void setOverrideColor(const QColor &color); void setOverrideColor(const QColor &color);
void updateFullScreenAction();
bool isNewItemDialogRunning() const; bool isNewItemDialogRunning() const;
signals: signals:
@@ -119,7 +118,6 @@ public slots:
void newFile(); void newFile();
void openFileWith(); void openFileWith();
void exit(); void exit();
void toggleFullScreen();
void showNewItemDialog(const QString &title, void showNewItemDialog(const QString &title,
const QList<IWizardFactory *> &factories, const QList<IWizardFactory *> &factories,
@@ -167,6 +165,7 @@ private:
Context m_additionalContexts; Context m_additionalContexts;
SettingsDatabase *m_settingsDatabase; SettingsDatabase *m_settingsDatabase;
mutable QPrinter *m_printer; mutable QPrinter *m_printer;
WindowSupport *m_windowSupport;
ActionManager *m_actionManager; ActionManager *m_actionManager;
EditorManager *m_editorManager; EditorManager *m_editorManager;
ExternalToolManager *m_externalToolManager; ExternalToolManager *m_externalToolManager;
@@ -205,9 +204,6 @@ private:
QAction *m_optionsAction; QAction *m_optionsAction;
QAction *m_toggleSideBarAction; QAction *m_toggleSideBarAction;
QAction *m_toggleModeSelectorAction; QAction *m_toggleModeSelectorAction;
QAction *m_toggleFullScreenAction;
QAction *m_minimizeAction;
QAction *m_zoomAction;
QToolButton *m_toggleSideBarButton; QToolButton *m_toggleSideBarButton;
QColor m_overrideColor; QColor m_overrideColor;

View File

@@ -0,0 +1,128 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "windowsupport.h"
#include "actionmanager/actionmanager.h"
#include "coreconstants.h"
#include "icore.h"
#include <utils/hostosinfo.h>
#include <QAction>
#include <QWidget>
#include <QEvent>
namespace Core {
namespace Internal {
WindowSupport::WindowSupport(QWidget *window, const Context &context)
: QObject(window),
m_window(window)
{
m_window->installEventFilter(this);
m_contextObject = new IContext(this);
m_contextObject->setWidget(window);
m_contextObject->setContext(context);
ICore::addContextObject(m_contextObject);
if (UseMacShortcuts) {
m_minimizeAction = new QAction(this);
ActionManager::registerAction(m_minimizeAction, Constants::MINIMIZE_WINDOW, context);
connect(m_minimizeAction, SIGNAL(triggered()), m_window, SLOT(showMinimized()));
m_zoomAction = new QAction(this);
ActionManager::registerAction(m_zoomAction, Constants::ZOOM_WINDOW, context);
connect(m_zoomAction, SIGNAL(triggered()), m_window, SLOT(showMaximized()));
m_closeAction = new QAction(this);
ActionManager::registerAction(m_closeAction, Constants::CLOSE_WINDOW, context);
connect(m_closeAction, SIGNAL(triggered()), m_window, SLOT(close()), Qt::QueuedConnection);
}
m_toggleFullScreenAction = new QAction(this);
updateFullScreenAction();
ActionManager::registerAction(m_toggleFullScreenAction, Constants::TOGGLE_FULLSCREEN, context);
connect(m_toggleFullScreenAction, SIGNAL(triggered()), this, SLOT(toggleFullScreen()));
}
WindowSupport::~WindowSupport()
{
ICore::removeContextObject(m_contextObject);
}
void WindowSupport::setCloseActionEnabled(bool enabled)
{
if (UseMacShortcuts)
m_closeAction->setEnabled(enabled);
}
bool WindowSupport::eventFilter(QObject *obj, QEvent *event)
{
if (obj != m_window)
return false;
if (event->type() == QEvent::WindowStateChange) {
if (Utils::HostOsInfo::isMacHost()) {
bool minimized = m_window->isMinimized();
m_minimizeAction->setEnabled(!minimized);
m_zoomAction->setEnabled(!minimized);
}
updateFullScreenAction();
}
return false;
}
void WindowSupport::toggleFullScreen()
{
if (m_window->isFullScreen()) {
m_window->setWindowState(m_window->windowState() & ~Qt::WindowFullScreen);
} else {
m_window->setWindowState(m_window->windowState() | Qt::WindowFullScreen);
}
}
void WindowSupport::updateFullScreenAction()
{
if (m_window->isFullScreen()) {
if (Utils::HostOsInfo::isMacHost())
m_toggleFullScreenAction->setText(tr("Exit Full Screen"));
else
m_toggleFullScreenAction->setChecked(true);
} else {
if (Utils::HostOsInfo::isMacHost())
m_toggleFullScreenAction->setText(tr("Enter Full Screen"));
else
m_toggleFullScreenAction->setChecked(false);
}
}
} // Internal
} // Core

View File

@@ -0,0 +1,73 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef WINDOWSUPPORT_H
#define WINDOWSUPPORT_H
#include "icontext.h"
#include <QObject>
QT_BEGIN_NAMESPACE
class QAction;
class QWidget;
QT_END_NAMESPACE
namespace Core {
namespace Internal {
class WindowSupport : public QObject
{
Q_OBJECT
public:
WindowSupport(QWidget *window, const Context &context);
~WindowSupport();
void setCloseActionEnabled(bool enabled);
protected:
bool eventFilter(QObject *obj, QEvent *event);
private slots:
void toggleFullScreen();
void updateFullScreenAction();
private:
QWidget *m_window;
IContext *m_contextObject;
QAction *m_minimizeAction;
QAction *m_zoomAction;
QAction *m_closeAction;
QAction *m_toggleFullScreenAction;
};
} // Internal
} // Core
#endif // WINDOWSUPPORT_H

View File

@@ -128,7 +128,6 @@ public:
DebuggerLanguages m_engineDebugLanguages; DebuggerLanguages m_engineDebugLanguages;
ActionContainer *m_viewsMenu; ActionContainer *m_viewsMenu;
QList<Command *> m_menuCommandsToAdd;
Project *m_previousProject; Project *m_previousProject;
Target *m_previousTarget; Target *m_previousTarget;
@@ -319,10 +318,6 @@ void DebuggerMainWindowPrivate::createViewsMenuItems()
"Debugger.Views.Separator", debugcontext); "Debugger.Views.Separator", debugcontext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE); m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
cmd = Core::ActionManager::registerAction(q->resetLayoutAction(),
"Debugger.Views.ResetSimple", debugcontext);
cmd->setAttribute(Command::CA_Hide);
m_viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
} }
void DebuggerMainWindowPrivate::addLanguage(DebuggerLanguage languageId, void DebuggerMainWindowPrivate::addLanguage(DebuggerLanguage languageId,
@@ -410,7 +405,6 @@ QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &langua
Command *cmd = Core::ActionManager::registerAction(toggleViewAction, Command *cmd = Core::ActionManager::registerAction(toggleViewAction,
Core::Id("Debugger.").withSuffix(widget->objectName()), globalContext); Core::Id("Debugger.").withSuffix(widget->objectName()), globalContext);
cmd->setAttribute(Command::CA_Hide); cmd->setAttribute(Command::CA_Hide);
d->m_menuCommandsToAdd.append(cmd);
dockWidget->installEventFilter(&d->m_resizeEventFilter); dockWidget->installEventFilter(&d->m_resizeEventFilter);
@@ -426,12 +420,7 @@ QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &langua
void DebuggerMainWindow::addStagedMenuEntries() void DebuggerMainWindow::addStagedMenuEntries()
{ {
Utils::sort(d->m_menuCommandsToAdd, [](Command *cmd1, Command *cmd2) { addDockActionsToMenu(d->m_viewsMenu->menu());
return cmd1->action()->text() < cmd2->action()->text();
});
foreach (Command *cmd, d->m_menuCommandsToAdd)
d->m_viewsMenu->addAction(cmd);
d->m_menuCommandsToAdd.clear();
} }
QWidget *DebuggerMainWindow::createContents(IMode *mode) QWidget *DebuggerMainWindow::createContents(IMode *mode)
@@ -543,9 +532,9 @@ void DebuggerMainWindow::writeSettings() const
void DebuggerMainWindow::showViewsMenu() void DebuggerMainWindow::showViewsMenu()
{ {
QMenu *menu = createPopupMenu(); QMenu menu;
menu->exec(d->m_viewButton->mapToGlobal(QPoint())); addDockActionsToMenu(&menu);
delete menu; menu.exec(d->m_viewButton->mapToGlobal(QPoint()));
} }
void DebuggerMainWindow::readSettings() void DebuggerMainWindow::readSettings()
@@ -613,11 +602,6 @@ bool DebuggerMainWindowPrivate::isQmlActive() const
return (m_activeDebugLanguages & QmlLanguage); return (m_activeDebugLanguages & QmlLanguage);
} }
QMenu *DebuggerMainWindow::createPopupMenu()
{
return FancyMainWindow::createPopupMenu();
}
void DebuggerMainWindowPrivate::setSimpleDockWidgetArrangement() void DebuggerMainWindowPrivate::setSimpleDockWidgetArrangement()
{ {
using namespace Constants; using namespace Constants;

View File

@@ -86,7 +86,6 @@ public:
void addStagedMenuEntries(); void addStagedMenuEntries();
QWidget *createContents(Core::IMode *mode); QWidget *createContents(Core::IMode *mode);
QMenu *createPopupMenu();
void readSettings(); void readSettings();
void writeSettings() const; void writeSettings() const;

View File

@@ -834,7 +834,6 @@ public slots:
m_returnView->header()->resizeSection(section, newSize); m_returnView->header()->resizeSection(section, newSize);
} }
void sourceFilesDockToggled(bool on) void sourceFilesDockToggled(bool on)
{ {
if (on && m_currentEngine->state() == InferiorStopOk) if (on && m_currentEngine->state() == InferiorStopOk)
@@ -2762,6 +2761,8 @@ void DebuggerPluginPrivate::extensionsInitialized()
{ {
const QKeySequence debugKey = QKeySequence(UseMacShortcuts ? tr("Ctrl+Y") : tr("F5")); const QKeySequence debugKey = QKeySequence(UseMacShortcuts ? tr("Ctrl+Y") : tr("F5"));
QSettings *settings = Core::ICore::settings();
m_debuggerSettings = new DebuggerSettings; m_debuggerSettings = new DebuggerSettings;
m_debuggerSettings->readSettings(); m_debuggerSettings->readSettings();
@@ -2794,39 +2795,48 @@ void DebuggerPluginPrivate::extensionsInitialized()
m_breakHandler = new BreakHandler; m_breakHandler = new BreakHandler;
m_breakView = new BreakTreeView; m_breakView = new BreakTreeView;
m_breakView->setSettings(settings, "Debugger.BreakWindow");
m_breakView->setModel(m_breakHandler->model()); m_breakView->setModel(m_breakHandler->model());
m_breakWindow = addSearch(m_breakView, tr("Breakpoints"), DOCKWIDGET_BREAK); m_breakWindow = addSearch(m_breakView, tr("Breakpoints"), DOCKWIDGET_BREAK);
m_modulesView = new ModulesTreeView; m_modulesView = new ModulesTreeView;
m_modulesView->setSettings(settings, "Debugger.ModulesView");
m_modulesWindow = addSearch(m_modulesView, tr("Modules"), DOCKWIDGET_MODULES); m_modulesWindow = addSearch(m_modulesView, tr("Modules"), DOCKWIDGET_MODULES);
m_registerView = new RegisterTreeView; m_registerView = new RegisterTreeView;
m_registerView->setSettings(settings, "Debugger.RegisterView");
m_registerWindow = addSearch(m_registerView, tr("Registers"), DOCKWIDGET_REGISTER); m_registerWindow = addSearch(m_registerView, tr("Registers"), DOCKWIDGET_REGISTER);
m_stackView = new StackTreeView; m_stackView = new StackTreeView;
m_stackView->setSettings(settings, "Debugger.StackView");
m_stackWindow = addSearch(m_stackView, tr("Stack"), DOCKWIDGET_STACK); m_stackWindow = addSearch(m_stackView, tr("Stack"), DOCKWIDGET_STACK);
m_sourceFilesView = new SourceFilesTreeView; m_sourceFilesView = new SourceFilesTreeView;
m_sourceFilesView->setSettings(settings, "Debugger.SourceFilesView");
m_sourceFilesWindow = addSearch(m_sourceFilesView, tr("Source Files"), DOCKWIDGET_SOURCE_FILES); m_sourceFilesWindow = addSearch(m_sourceFilesView, tr("Source Files"), DOCKWIDGET_SOURCE_FILES);
m_threadsView = new ThreadsTreeView; m_threadsView = new ThreadsTreeView;
m_threadsView->setSettings(settings, "Debugger.ThreadsView");
m_threadsWindow = addSearch(m_threadsView, tr("Threads"), DOCKWIDGET_THREADS); m_threadsWindow = addSearch(m_threadsView, tr("Threads"), DOCKWIDGET_THREADS);
m_returnView = new WatchTreeView(ReturnType); m_returnView = new WatchTreeView(ReturnType); // No settings.
m_returnWindow = addSearch(m_returnView, tr("Locals and Expressions"), "CppDebugReturn"); m_returnWindow = addSearch(m_returnView, tr("Locals and Expressions"), "CppDebugReturn");
m_localsView = new WatchTreeView(LocalsType); m_localsView = new WatchTreeView(LocalsType);
m_localsView->setSettings(settings, "Debugger.LocalsView");
m_localsWindow = addSearch(m_localsView, tr("Locals and Expressions"), "CppDebugLocals"); m_localsWindow = addSearch(m_localsView, tr("Locals and Expressions"), "CppDebugLocals");
m_watchersView = new WatchTreeView(WatchersType); m_watchersView = new WatchTreeView(WatchersType); // No settings.
m_watchersWindow = addSearch(m_watchersView, tr("Locals and Expressions"), "CppDebugWatchers"); m_watchersWindow = addSearch(m_watchersView, tr("Locals and Expressions"), "CppDebugWatchers");
m_inspectorView = new WatchTreeView(InspectType); m_inspectorView = new WatchTreeView(InspectType);
m_inspectorView->setSettings(settings, "Debugger.LocalsView"); // sic! same as locals view.
m_inspectorWindow = addSearch(m_inspectorView, tr("Locals and Expressions"), "Inspector"); m_inspectorWindow = addSearch(m_inspectorView, tr("Locals and Expressions"), "Inspector");
// Snapshot // Snapshot
m_snapshotHandler = new SnapshotHandler; m_snapshotHandler = new SnapshotHandler;
m_snapshotView = new SnapshotTreeView(m_snapshotHandler); m_snapshotView = new SnapshotTreeView(m_snapshotHandler);
m_snapshotView->setSettings(settings, "Debugger.SnapshotView");
m_snapshotView->setModel(m_snapshotHandler->model()); m_snapshotView->setModel(m_snapshotHandler->model());
m_snapshotWindow = addSearch(m_snapshotView, tr("Snapshots"), DOCKWIDGET_SNAPSHOTS); m_snapshotWindow = addSearch(m_snapshotView, tr("Snapshots"), DOCKWIDGET_SNAPSHOTS);
@@ -3197,13 +3207,14 @@ void DebuggerPluginPrivate::extensionsInitialized()
debugMenu->addSeparator(globalcontext); debugMenu->addSeparator(globalcontext);
QAction *qmlUpdateOnSaveDummyAction = new QAction(tr("Apply Changes on Save"), this); // currently broken
qmlUpdateOnSaveDummyAction->setCheckable(true); // QAction *qmlUpdateOnSaveDummyAction = new QAction(tr("Apply Changes on Save"), this);
qmlUpdateOnSaveDummyAction->setIcon(QIcon(_(":/debugger/images/qml/apply-on-save.png"))); // qmlUpdateOnSaveDummyAction->setCheckable(true);
qmlUpdateOnSaveDummyAction->setEnabled(false); // qmlUpdateOnSaveDummyAction->setIcon(QIcon(_(":/debugger/images/qml/apply-on-save.png")));
cmd = ActionManager::registerAction(qmlUpdateOnSaveDummyAction, Constants::QML_UPDATE_ON_SAVE, // qmlUpdateOnSaveDummyAction->setEnabled(false);
globalcontext); // cmd = ActionManager::registerAction(qmlUpdateOnSaveDummyAction, Constants::QML_UPDATE_ON_SAVE,
debugMenu->addAction(cmd); // globalcontext);
// debugMenu->addAction(cmd);
QAction *qmlShowAppOnTopDummyAction = new QAction(tr("Show Application on Top"), this); QAction *qmlShowAppOnTopDummyAction = new QAction(tr("Show Application on Top"), this);
qmlShowAppOnTopDummyAction->setCheckable(true); qmlShowAppOnTopDummyAction->setCheckable(true);
@@ -3358,7 +3369,8 @@ void DebuggerPluginPrivate::extensionsInitialized()
hbox = new QHBoxLayout(qmlToolbar); hbox = new QHBoxLayout(qmlToolbar);
hbox->setMargin(0); hbox->setMargin(0);
hbox->setSpacing(0); hbox->setSpacing(0);
hbox->addWidget(toolButton(Constants::QML_UPDATE_ON_SAVE)); // currently broken
//hbox->addWidget(toolButton(Constants::QML_UPDATE_ON_SAVE));
hbox->addWidget(toolButton(Constants::QML_SHOW_APP_ON_TOP)); hbox->addWidget(toolButton(Constants::QML_SHOW_APP_ON_TOP));
hbox->addWidget(new StyledSeparator); hbox->addWidget(new StyledSeparator);
hbox->addWidget(toolButton(Constants::QML_SELECTTOOL)); hbox->addWidget(toolButton(Constants::QML_SELECTTOOL));

View File

@@ -999,14 +999,14 @@ int DebuggerToolTipTreeView::computeHeight(const QModelIndex &index) const
void DebuggerToolTipTreeView::computeSize() void DebuggerToolTipTreeView::computeSize()
{ {
WatchTreeView::reexpand(this, model()->index(0, 0));
int columns = 30; // Decoration int columns = 30; // Decoration
int rows = 0; int rows = 0;
bool rootDecorated = false; bool rootDecorated = false;
if (model()) { if (QAbstractItemModel *m = model()) {
const int columnCount = model()->columnCount(); WatchTreeView::reexpand(this, m->index(0, 0));
rootDecorated = model()->rowCount() > 0; const int columnCount = m->columnCount();
rootDecorated = m->rowCount() > 0;
if (rootDecorated) if (rootDecorated)
for (int i = 0; i < columnCount; ++i) { for (int i = 0; i < columnCount; ++i) {
resizeColumnToContents(i); resizeColumnToContents(i);
@@ -1020,6 +1020,7 @@ void DebuggerToolTipTreeView::computeSize()
// Add a bit of space to account for tooltip border, and not // Add a bit of space to account for tooltip border, and not
// touch the border of the screen. // touch the border of the screen.
QPoint pos(x(), y()); QPoint pos(x(), y());
QTC_ASSERT(QApplication::desktop(), return);
QRect desktopRect = QApplication::desktop()->availableGeometry(pos); QRect desktopRect = QApplication::desktop()->availableGeometry(pos);
const int maxWidth = desktopRect.right() - pos.x() - 5 - 5; const int maxWidth = desktopRect.right() - pos.x() - 5 - 5;
const int maxHeight = desktopRect.bottom() - pos.y() - 5 - 5; const int maxHeight = desktopRect.bottom() - pos.y() - 5 - 5;

View File

@@ -226,37 +226,37 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent)
setWindowTitle(tr("Load Core File")); setWindowTitle(tr("Load Core File"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
d->buttonBox = new QDialogButtonBox(this);
d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
d->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
d->kitChooser = new DebuggerKitChooser(DebuggerKitChooser::RemoteDebugging, this); d->kitChooser = new DebuggerKitChooser(DebuggerKitChooser::RemoteDebugging, this);
d->kitChooser->populate(); d->kitChooser->populate();
d->selectRemoteCoreButton = new QPushButton(tr("Browse..."), this);
d->remoteCoreFileName = new QLineEdit(this);
d->forceLocalCheckBox = new QCheckBox(this); d->forceLocalCheckBox = new QCheckBox(this);
d->forceLocalLabel = new QLabel(this); d->forceLocalLabel = new QLabel(this);
d->forceLocalLabel->setText(tr("Use local core file:")); d->forceLocalLabel->setText(tr("Use local core file:"));
d->forceLocalLabel->setBuddy(d->forceLocalCheckBox); d->forceLocalLabel->setBuddy(d->forceLocalCheckBox);
d->localExecFileName = new PathChooser(this); d->remoteCoreFileName = new QLineEdit(this);
d->localExecFileName->setHistoryCompleter(QLatin1String("LocalExecutable")); d->selectRemoteCoreButton = new QPushButton(tr("Browse..."), this);
d->localExecFileName->setExpectedKind(PathChooser::File);
d->localExecFileName->setPromptDialogTitle(tr("Select Executable"));
d->localCoreFileName = new PathChooser(this); d->localCoreFileName = new PathChooser(this);
d->localCoreFileName->setHistoryCompleter(QLatin1String("Debugger.CoreFile.History")); d->localCoreFileName->setHistoryCompleter(QLatin1String("Debugger.CoreFile.History"));
d->localCoreFileName->setExpectedKind(PathChooser::File); d->localCoreFileName->setExpectedKind(PathChooser::File);
d->localCoreFileName->setPromptDialogTitle(tr("Select Core File")); d->localCoreFileName->setPromptDialogTitle(tr("Select Core File"));
d->localExecFileName = new PathChooser(this);
d->localExecFileName->setHistoryCompleter(QLatin1String("LocalExecutable"));
d->localExecFileName->setExpectedKind(PathChooser::File);
d->localExecFileName->setPromptDialogTitle(tr("Select Executable"));
d->overrideStartScriptFileName = new PathChooser(this); d->overrideStartScriptFileName = new PathChooser(this);
d->overrideStartScriptFileName->setHistoryCompleter(QLatin1String("Debugger.StartupScript.History")); d->overrideStartScriptFileName->setHistoryCompleter(QLatin1String("Debugger.StartupScript.History"));
d->overrideStartScriptFileName->setExpectedKind(PathChooser::File); d->overrideStartScriptFileName->setExpectedKind(PathChooser::File);
d->overrideStartScriptFileName->setPromptDialogTitle(tr("Select Startup Script")); d->overrideStartScriptFileName->setPromptDialogTitle(tr("Select Startup Script"));
d->buttonBox = new QDialogButtonBox(this);
d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
d->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
QHBoxLayout *coreLayout = new QHBoxLayout; QHBoxLayout *coreLayout = new QHBoxLayout;
coreLayout->addWidget(d->localCoreFileName); coreLayout->addWidget(d->localCoreFileName);
coreLayout->addWidget(d->remoteCoreFileName); coreLayout->addWidget(d->remoteCoreFileName);

View File

@@ -36,6 +36,7 @@
#include <debugger/watchhandler.h> #include <debugger/watchhandler.h>
#include <qmldebug/qmldebugconstants.h> #include <qmldebug/qmldebugconstants.h>
#include <utils/logging.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
#include <utils/savedaction.h> #include <utils/savedaction.h>
#include <QElapsedTimer> #include <QElapsedTimer>
@@ -47,9 +48,7 @@ using namespace QmlDebug::Constants;
namespace Debugger { namespace Debugger {
namespace Internal { namespace Internal {
enum { Q_LOGGING_CATEGORY(qmlInspectorLog, "qtc.dbg.qmlinspector")
debug = false
};
/*! /*!
* DebuggerAgent updates the watchhandler with the object tree data. * DebuggerAgent updates the watchhandler with the object tree data.
@@ -76,8 +75,8 @@ quint32 QmlInspectorAgent::queryExpressionResult(int debugId,
if (!m_engineClient) if (!m_engineClient)
return 0; return 0;
if (debug) qCDebug(qmlInspectorLog)
qDebug() << __FUNCTION__ << '(' << debugId << expression << __FUNCTION__ << '(' << debugId << expression
<< m_engine.debugId() << ')'; << m_engine.debugId() << ')';
return m_engineClient->queryExpressionResult(debugId, expression, return m_engineClient->queryExpressionResult(debugId, expression,
@@ -87,8 +86,8 @@ quint32 QmlInspectorAgent::queryExpressionResult(int debugId,
void QmlInspectorAgent::assignValue(const WatchData *data, void QmlInspectorAgent::assignValue(const WatchData *data,
const QString &expr, const QVariant &valueV) const QString &expr, const QVariant &valueV)
{ {
if (debug) qCDebug(qmlInspectorLog)
qDebug() << __FUNCTION__ << '(' << data->id << ')' << data->iname; << __FUNCTION__ << '(' << data->id << ')' << data->iname;
if (data->id) { if (data->id) {
QString val(valueV.toString()); QString val(valueV.toString());
@@ -114,8 +113,7 @@ int parentIdForIname(const QByteArray &iname)
void QmlInspectorAgent::updateWatchData(const WatchData &data) void QmlInspectorAgent::updateWatchData(const WatchData &data)
{ {
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << data.id << ')';
qDebug() << __FUNCTION__ << '(' << data.id << ')';
if (data.id && !m_fetchDataIds.contains(data.id)) { if (data.id && !m_fetchDataIds.contains(data.id)) {
// objects // objects
@@ -126,8 +124,7 @@ void QmlInspectorAgent::updateWatchData(const WatchData &data)
void QmlInspectorAgent::watchDataSelected(const WatchData *data) void QmlInspectorAgent::watchDataSelected(const WatchData *data)
{ {
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << data->id << ')';
qDebug() << __FUNCTION__ << '(' << data->id << ')';
if (data->id) { if (data->id) {
QTC_ASSERT(m_debugIdLocations.keys().contains(data->id), return); QTC_ASSERT(m_debugIdLocations.keys().contains(data->id), return);
@@ -137,17 +134,14 @@ void QmlInspectorAgent::watchDataSelected(const WatchData *data)
bool QmlInspectorAgent::selectObjectInTree(int debugId) bool QmlInspectorAgent::selectObjectInTree(int debugId)
{ {
if (debug) { qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << debugId << ')' << endl
qDebug() << __FUNCTION__ << '(' << debugId << ')'; << " " << debugId << "already fetched? "
qDebug() << " " << debugId << "already fetched? "
<< m_debugIdToIname.contains(debugId); << m_debugIdToIname.contains(debugId);
}
if (m_debugIdToIname.contains(debugId)) { if (m_debugIdToIname.contains(debugId)) {
QByteArray iname = m_debugIdToIname.value(debugId); QByteArray iname = m_debugIdToIname.value(debugId);
QTC_ASSERT(iname.startsWith("inspect."), qDebug() << iname); QTC_ASSERT(iname.startsWith("inspect."), qDebug() << iname);
if (debug) qCDebug(qmlInspectorLog) << " selecting" << iname << "in tree";
qDebug() << " selecting" << iname << "in tree";
m_debuggerEngine->watchHandler()->setCurrentItem(iname); m_debuggerEngine->watchHandler()->setCurrentItem(iname);
m_objectToSelect = 0; m_objectToSelect = 0;
return true; return true;
@@ -173,8 +167,8 @@ quint32 QmlInspectorAgent::setBindingForObject(int objectDebugId,
QString source, QString source,
int line) int line)
{ {
if (debug) qCDebug(qmlInspectorLog)
qDebug() << __FUNCTION__ << '(' << objectDebugId << propertyName << __FUNCTION__ << '(' << objectDebugId << propertyName
<< value.toString() << isLiteralValue << source << line << ')'; << value.toString() << isLiteralValue << source << line << ')';
if (objectDebugId == -1) if (objectDebugId == -1)
@@ -205,9 +199,9 @@ quint32 QmlInspectorAgent::setMethodBodyForObject(int objectDebugId,
const QString &methodName, const QString &methodName,
const QString &methodBody) const QString &methodBody)
{ {
if (debug) qCDebug(qmlInspectorLog)
qDebug() << __FUNCTION__ << '(' << objectDebugId << __FUNCTION__ << '(' << objectDebugId << methodName << methodBody
<< methodName << methodBody << ')'; << ')';
if (objectDebugId == -1) if (objectDebugId == -1)
return 0; return 0;
@@ -231,8 +225,8 @@ quint32 QmlInspectorAgent::setMethodBodyForObject(int objectDebugId,
quint32 QmlInspectorAgent::resetBindingForObject(int objectDebugId, quint32 QmlInspectorAgent::resetBindingForObject(int objectDebugId,
const QString &propertyName) const QString &propertyName)
{ {
if (debug) qCDebug(qmlInspectorLog)
qDebug() << __FUNCTION__ << '(' << objectDebugId << __FUNCTION__ << '(' << objectDebugId
<< propertyName << ')'; << propertyName << ')';
if (objectDebugId == -1) if (objectDebugId == -1)
@@ -332,8 +326,7 @@ QHash<int,QString> QmlInspectorAgent::rootObjectIds() const
bool QmlInspectorAgent::addObjectWatch(int objectDebugId) bool QmlInspectorAgent::addObjectWatch(int objectDebugId)
{ {
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << objectDebugId << ')';
qDebug() << __FUNCTION__ << '(' << objectDebugId << ')';
if (objectDebugId == -1) if (objectDebugId == -1)
return false; return false;
@@ -362,8 +355,7 @@ bool QmlInspectorAgent::isObjectBeingWatched(int objectDebugId)
bool QmlInspectorAgent::removeObjectWatch(int objectDebugId) bool QmlInspectorAgent::removeObjectWatch(int objectDebugId)
{ {
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << objectDebugId << ')';
qDebug() << __FUNCTION__ << '(' << objectDebugId << ')';
if (objectDebugId == -1) if (objectDebugId == -1)
return false; return false;
@@ -380,8 +372,7 @@ bool QmlInspectorAgent::removeObjectWatch(int objectDebugId)
void QmlInspectorAgent::removeAllObjectWatches() void QmlInspectorAgent::removeAllObjectWatches()
{ {
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << "()";
qDebug() << __FUNCTION__ << "()";
foreach (int watchedObject, m_objectWatches) foreach (int watchedObject, m_objectWatches)
removeObjectWatch(watchedObject); removeObjectWatch(watchedObject);
@@ -448,8 +439,7 @@ void QmlInspectorAgent::updateState()
void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value, void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value,
const QByteArray &type) const QByteArray &type)
{ {
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << "() ...";
qDebug() << __FUNCTION__ << "() ...";
if (type == "FETCH_OBJECT_R") { if (type == "FETCH_OBJECT_R") {
log(LogReceive, _("FETCH_OBJECT_R %1").arg( log(LogReceive, _("FETCH_OBJECT_R %1").arg(
@@ -494,15 +484,13 @@ void QmlInspectorAgent::onResult(quint32 queryId, const QVariant &value,
emit expressionResult(queryId, value); emit expressionResult(queryId, value);
} }
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << "done";
qDebug() << __FUNCTION__ << "done";
} }
void QmlInspectorAgent::newObject(int engineId, int /*objectId*/, int /*parentId*/) void QmlInspectorAgent::newObject(int engineId, int /*objectId*/, int /*parentId*/)
{ {
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << "()";
qDebug() << __FUNCTION__ << "()";
log(LogReceive, QLatin1String("OBJECT_CREATED")); log(LogReceive, QLatin1String("OBJECT_CREATED"));
@@ -520,8 +508,9 @@ void QmlInspectorAgent::onValueChanged(int debugId, const QByteArray &propertyNa
".[properties]." + propertyName; ".[properties]." + propertyName;
WatchHandler *watchHandler = m_debuggerEngine->watchHandler(); WatchHandler *watchHandler = m_debuggerEngine->watchHandler();
const WatchData *data = watchHandler->findData(iname); const WatchData *data = watchHandler->findData(iname);
if (debug) qCDebug(qmlInspectorLog)
qDebug() << __FUNCTION__ << '(' << debugId << ')' << iname << value.toString(); << __FUNCTION__ << '(' << debugId << ')' << iname
<< value.toString();
if (data) { if (data) {
WatchData d(*data); WatchData d(*data);
d.value = value.toString(); d.value = value.toString();
@@ -531,8 +520,7 @@ void QmlInspectorAgent::onValueChanged(int debugId, const QByteArray &propertyNa
void QmlInspectorAgent::reloadEngines() void QmlInspectorAgent::reloadEngines()
{ {
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << "()";
qDebug() << __FUNCTION__ << "()";
if (!isConnected()) if (!isConnected())
return; return;
@@ -560,8 +548,7 @@ int QmlInspectorAgent::parentIdForObject(int objectDebugId)
void QmlInspectorAgent::queryEngineContext() void QmlInspectorAgent::queryEngineContext()
{ {
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__;
qDebug() << __FUNCTION__;
if (!isConnected() if (!isConnected()
|| !debuggerCore()->boolSetting(ShowQmlObjectTree)) || !debuggerCore()->boolSetting(ShowQmlObjectTree))
@@ -575,8 +562,7 @@ void QmlInspectorAgent::queryEngineContext()
void QmlInspectorAgent::fetchObject(int debugId) void QmlInspectorAgent::fetchObject(int debugId)
{ {
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << debugId << ')';
qDebug() << __FUNCTION__ << '(' << debugId << ')';
if (!isConnected() if (!isConnected()
|| !debuggerCore()->boolSetting(ShowQmlObjectTree)) || !debuggerCore()->boolSetting(ShowQmlObjectTree))
@@ -584,8 +570,7 @@ void QmlInspectorAgent::fetchObject(int debugId)
log(LogSend, QLatin1String("FETCH_OBJECT ") + QString::number(debugId)); log(LogSend, QLatin1String("FETCH_OBJECT ") + QString::number(debugId));
quint32 queryId = m_engineClient->queryObject(debugId); quint32 queryId = m_engineClient->queryObject(debugId);
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << debugId << ')'
qDebug() << __FUNCTION__ << '(' << debugId << ')'
<< " - query id" << queryId; << " - query id" << queryId;
m_objectTreeQueryIds << queryId; m_objectTreeQueryIds << queryId;
} }
@@ -595,8 +580,7 @@ void QmlInspectorAgent::fetchContextObjectsForLocation(const QString &file,
{ {
// This can be an expensive operation as it may return multiple // This can be an expensive operation as it may return multiple
// objects. Use fetchContextObject() where possible. // objects. Use fetchContextObject() where possible.
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << file << ':' << lineNumber
qDebug() << __FUNCTION__ << '(' << file << ':' << lineNumber
<< ':' << columnNumber << ')'; << ':' << columnNumber << ')';
if (!isConnected() if (!isConnected()
@@ -607,8 +591,7 @@ void QmlInspectorAgent::fetchContextObjectsForLocation(const QString &file,
.arg(QString::number(lineNumber)).arg(QString::number(columnNumber))); .arg(QString::number(lineNumber)).arg(QString::number(columnNumber)));
quint32 queryId = m_engineClient->queryObjectsForLocation(QFileInfo(file).fileName(), quint32 queryId = m_engineClient->queryObjectsForLocation(QFileInfo(file).fileName(),
lineNumber, columnNumber); lineNumber, columnNumber);
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << file << ':' << lineNumber
qDebug() << __FUNCTION__ << '(' << file << ':' << lineNumber
<< ':' << columnNumber << ')' << " - query id" << queryId; << ':' << columnNumber << ')' << " - query id" << queryId;
m_objectTreeQueryIds << queryId; m_objectTreeQueryIds << queryId;
@@ -616,8 +599,7 @@ void QmlInspectorAgent::fetchContextObjectsForLocation(const QString &file,
void QmlInspectorAgent::updateObjectTree(const ContextReference &context) void QmlInspectorAgent::updateObjectTree(const ContextReference &context)
{ {
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << context << ')';
qDebug() << __FUNCTION__ << '(' << context << ')';
if (!isConnected() if (!isConnected()
|| !debuggerCore()->boolSetting(ShowQmlObjectTree)) || !debuggerCore()->boolSetting(ShowQmlObjectTree))
@@ -632,8 +614,7 @@ void QmlInspectorAgent::updateObjectTree(const ContextReference &context)
void QmlInspectorAgent::verifyAndInsertObjectInTree(const ObjectReference &object) void QmlInspectorAgent::verifyAndInsertObjectInTree(const ObjectReference &object)
{ {
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << object << ')';
qDebug() << __FUNCTION__ << '(' << object << ')';
if (!object.isValid()) if (!object.isValid())
return; return;
@@ -680,33 +661,32 @@ void QmlInspectorAgent::verifyAndInsertObjectInTree(const ObjectReference &objec
void QmlInspectorAgent::insertObjectInTree(const ObjectReference &object) void QmlInspectorAgent::insertObjectInTree(const ObjectReference &object)
{ {
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << object << ')';
qDebug() << __FUNCTION__ << '(' << object << ')';
const int objectDebugId = object.debugId(); const int objectDebugId = object.debugId();
const int parentId = parentIdForIname(m_debugIdToIname.value(objectDebugId)); const int parentId = parentIdForIname(m_debugIdToIname.value(objectDebugId));
QElapsedTimer timeElapsed; QElapsedTimer timeElapsed;
QList<WatchData> watchData; QList<WatchData> watchData;
if (debug)
bool printTime = qmlInspectorLog().isDebugEnabled();
if (printTime)
timeElapsed.start(); timeElapsed.start();
watchData.append(buildWatchData(object, m_debugIdToIname.value(parentId), true)); watchData.append(buildWatchData(object, m_debugIdToIname.value(parentId), true));
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << "Time: Build Watch Data took "
qDebug() << __FUNCTION__ << "Time: Build Watch Data took "
<< timeElapsed.elapsed() << " ms"; << timeElapsed.elapsed() << " ms";
if (debug) if (printTime)
timeElapsed.start(); timeElapsed.start();
buildDebugIdHashRecursive(object); buildDebugIdHashRecursive(object);
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << "Time: Build Debug Id Hash took "
qDebug() << __FUNCTION__ << "Time: Build Debug Id Hash took "
<< timeElapsed.elapsed() << " ms"; << timeElapsed.elapsed() << " ms";
WatchHandler *watchHandler = m_debuggerEngine->watchHandler(); WatchHandler *watchHandler = m_debuggerEngine->watchHandler();
if (debug) if (printTime)
timeElapsed.start(); timeElapsed.start();
watchHandler->insertData(watchData); watchHandler->insertData(watchData);
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << "Time: Insertion took "
qDebug() << __FUNCTION__ << "Time: Insertion took " << timeElapsed.elapsed() << " ms"; << timeElapsed.elapsed() << " ms";
emit objectTreeUpdated(); emit objectTreeUpdated();
emit objectFetched(object); emit objectFetched(object);
@@ -714,8 +694,7 @@ void QmlInspectorAgent::insertObjectInTree(const ObjectReference &object)
if (m_debugIdToIname.contains(m_objectToSelect)) { if (m_debugIdToIname.contains(m_objectToSelect)) {
// select item in view // select item in view
QByteArray iname = m_debugIdToIname.value(m_objectToSelect); QByteArray iname = m_debugIdToIname.value(m_objectToSelect);
if (debug) qCDebug(qmlInspectorLog) << " selecting" << iname << "in tree";
qDebug() << " selecting" << iname << "in tree";
watchHandler->setCurrentItem(iname); watchHandler->setCurrentItem(iname);
m_objectToSelect = -1; m_objectToSelect = -1;
} }
@@ -723,8 +702,7 @@ void QmlInspectorAgent::insertObjectInTree(const ObjectReference &object)
void QmlInspectorAgent::buildDebugIdHashRecursive(const ObjectReference &ref) void QmlInspectorAgent::buildDebugIdHashRecursive(const ObjectReference &ref)
{ {
if (debug) qCDebug(qmlInspectorLog) << __FUNCTION__ << '(' << ref << ')';
qDebug() << __FUNCTION__ << '(' << ref << ')';
QUrl fileUrl = ref.source().url(); QUrl fileUrl = ref.source().url();
int lineNum = ref.source().lineNumber(); int lineNum = ref.source().lineNumber();
@@ -770,8 +748,7 @@ QList<WatchData> QmlInspectorAgent::buildWatchData(const ObjectReference &obj,
const QByteArray &parentIname, const QByteArray &parentIname,
bool append) bool append)
{ {
if (debug) qCDebug(qmlInspectorLog) << '(' << obj << parentIname << ')';
qDebug() << __FUNCTION__ << '(' << obj << parentIname << ')';
QList<WatchData> list; QList<WatchData> list;

View File

@@ -58,7 +58,7 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, Co
, m_command(NoCommand) , m_command(NoCommand)
{ {
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
m_gitBinaryPath = GitPlugin::instance()->gitClient()->gitBinaryPath(); m_gitExecutable = GitPlugin::instance()->gitClient()->gitExecutable();
m_ui->setupUi(this); m_ui->setupUi(this);
m_ui->workingDirectoryEdit->setText(workingDirectory); m_ui->workingDirectoryEdit->setText(workingDirectory);
m_gitEnvironment = GitPlugin::instance()->gitClient()->processEnvironment(); m_gitEnvironment = GitPlugin::instance()->gitClient()->processEnvironment();
@@ -257,7 +257,7 @@ void ChangeSelectionDialog::recalculateDetails()
connect(m_process, SIGNAL(finished(int)), this, SLOT(setDetails(int))); connect(m_process, SIGNAL(finished(int)), this, SLOT(setDetails(int)));
m_process->start(m_gitBinaryPath.toString(), args); m_process->start(m_gitExecutable.toString(), args);
m_process->closeWriteChannel(); m_process->closeWriteChannel();
if (!m_process->waitForStarted()) if (!m_process->waitForStarted())
m_ui->detailsText->setPlainText(tr("Error: Could not start Git.")); m_ui->detailsText->setPlainText(tr("Error: Could not start Git."));

View File

@@ -89,7 +89,7 @@ private:
Ui::ChangeSelectionDialog *m_ui; Ui::ChangeSelectionDialog *m_ui;
QProcess *m_process; QProcess *m_process;
Utils::FileName m_gitBinaryPath; Utils::FileName m_gitExecutable;
QProcessEnvironment m_gitEnvironment; QProcessEnvironment m_gitEnvironment;
ChangeCommand m_command; ChangeCommand m_command;
QStringListModel *m_changeModel; QStringListModel *m_changeModel;

View File

@@ -119,7 +119,7 @@ VcsBase::Command *CloneWizardPage::createCheckoutJob(Utils::FileName *checkoutPa
if (d->recursiveCheckBox->isChecked()) if (d->recursiveCheckBox->isChecked())
args << QLatin1String("--recursive"); args << QLatin1String("--recursive");
args << QLatin1String("--progress") << repository() << checkoutDir; args << QLatin1String("--progress") << repository() << checkoutDir;
VcsBase::Command *command = new VcsBase::Command(client->gitBinaryPath(), workingDirectory, VcsBase::Command *command = new VcsBase::Command(client->gitExecutable(), workingDirectory,
client->processEnvironment()); client->processEnvironment());
command->addFlags(VcsBase::VcsBasePlugin::MergeOutputChannels); command->addFlags(VcsBase::VcsBasePlugin::MergeOutputChannels);
command->addJob(args, -1); command->addJob(args, -1);

View File

@@ -391,7 +391,7 @@ void GerritPlugin::push()
Utils::FileName GerritPlugin::gitBinary() Utils::FileName GerritPlugin::gitBinary()
{ {
bool ok; bool ok;
const Utils::FileName git = gitClient()->gitBinaryPath(&ok); const Utils::FileName git = gitClient()->gitExecutable(&ok);
if (!ok) { if (!ok) {
VcsBase::VcsBaseOutputWindow::instance()->appendError(tr("Git is not available.")); VcsBase::VcsBaseOutputWindow::instance()->appendError(tr("Git is not available."));
return Utils::FileName(); return Utils::FileName();

View File

@@ -305,7 +305,7 @@ QProcessEnvironment GitDiffHandler::processEnvironment() const
Utils::FileName GitDiffHandler::gitPath() const Utils::FileName GitDiffHandler::gitPath() const
{ {
return m_gitClient->gitBinaryPath(); return m_gitClient->gitExecutable();
} }
///////////////////////////////////// /////////////////////////////////////
@@ -1753,7 +1753,7 @@ void GitClient::branchesForCommit(const QString &revision)
DiffEditor::DiffEditorController *controller DiffEditor::DiffEditorController *controller
= qobject_cast<DiffEditor::DiffEditorController *>(sender()); = qobject_cast<DiffEditor::DiffEditorController *>(sender());
QString workingDirectory = controller->workingDirectory(); QString workingDirectory = controller->workingDirectory();
VcsBase::Command *command = new VcsBase::Command(gitBinaryPath(), workingDirectory, VcsBase::Command *command = new VcsBase::Command(gitExecutable(), workingDirectory,
processEnvironment()); processEnvironment());
command->setCodec(getSourceCodec(currentDocumentPath())); command->setCodec(getSourceCodec(currentDocumentPath()));
@@ -2157,7 +2157,7 @@ VcsBase::Command *GitClient::createCommand(const QString &workingDirectory,
bool useOutputToWindow, bool useOutputToWindow,
int editorLineNumber) int editorLineNumber)
{ {
VcsBase::Command *command = new VcsBase::Command(gitBinaryPath(), workingDirectory, processEnvironment()); VcsBase::Command *command = new VcsBase::Command(gitExecutable(), workingDirectory, processEnvironment());
command->setCodec(getSourceCodec(currentDocumentPath())); command->setCodec(getSourceCodec(currentDocumentPath()));
command->setCookie(QVariant(editorLineNumber)); command->setCookie(QVariant(editorLineNumber));
if (editor) { if (editor) {
@@ -2254,7 +2254,7 @@ Utils::SynchronousProcessResponse GitClient::synchronousGit(const QString &worki
unsigned flags, unsigned flags,
QTextCodec *outputCodec) QTextCodec *outputCodec)
{ {
return VcsBasePlugin::runVcs(workingDirectory, gitBinaryPath(), gitArguments, return VcsBasePlugin::runVcs(workingDirectory, gitExecutable(), gitArguments,
settings()->intValue(GitSettings::timeoutKey) * 1000, settings()->intValue(GitSettings::timeoutKey) * 1000,
flags, outputCodec, processEnvironment()); flags, outputCodec, processEnvironment());
} }
@@ -2265,7 +2265,7 @@ bool GitClient::fullySynchronousGit(const QString &workingDirectory,
QByteArray* errorText, QByteArray* errorText,
unsigned flags) const unsigned flags) const
{ {
VcsBase::Command command(gitBinaryPath(), workingDirectory, processEnvironment()); VcsBase::Command command(gitExecutable(), workingDirectory, processEnvironment());
command.addFlags(flags); command.addFlags(flags);
return command.runFullySynchronous(gitArguments, return command.runFullySynchronous(gitArguments,
settings()->intValue(GitSettings::timeoutKey) * 1000, settings()->intValue(GitSettings::timeoutKey) * 1000,
@@ -2545,7 +2545,7 @@ QStringList GitClient::synchronousRepositoryBranches(const QString &repositoryUR
void GitClient::launchGitK(const QString &workingDirectory, const QString &fileName) void GitClient::launchGitK(const QString &workingDirectory, const QString &fileName)
{ {
const QFileInfo binaryInfo = gitBinaryPath().toFileInfo(); const QFileInfo binaryInfo = gitExecutable().toFileInfo();
QDir foundBinDir(binaryInfo.dir()); QDir foundBinDir(binaryInfo.dir());
const bool foundBinDirIsCmdDir = foundBinDir.dirName() == QLatin1String("cmd"); const bool foundBinDirIsCmdDir = foundBinDir.dirName() == QLatin1String("cmd");
QProcessEnvironment env = processEnvironment(); QProcessEnvironment env = processEnvironment();
@@ -2627,7 +2627,7 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
bool GitClient::launchGitGui(const QString &workingDirectory) { bool GitClient::launchGitGui(const QString &workingDirectory) {
bool success; bool success;
Utils::FileName gitBinary = gitBinaryPath(&success); Utils::FileName gitBinary = gitExecutable(&success);
if (success) { if (success) {
success = QProcess::startDetached(gitBinary.toString(), QStringList(QLatin1String("gui")), success = QProcess::startDetached(gitBinary.toString(), QStringList(QLatin1String("gui")),
workingDirectory); workingDirectory);
@@ -2641,7 +2641,7 @@ bool GitClient::launchGitGui(const QString &workingDirectory) {
Utils::FileName GitClient::gitBinDirectory() Utils::FileName GitClient::gitBinDirectory()
{ {
const QString git = gitBinaryPath().toString(); const QString git = gitExecutable().toString();
if (git.isEmpty()) if (git.isEmpty())
return Utils::FileName(); return Utils::FileName();
@@ -2657,9 +2657,9 @@ Utils::FileName GitClient::gitBinDirectory()
return Utils::FileName::fromString(path); return Utils::FileName::fromString(path);
} }
Utils::FileName GitClient::gitBinaryPath(bool *ok, QString *errorMessage) const Utils::FileName GitClient::gitExecutable(bool *ok, QString *errorMessage) const
{ {
return settings()->gitBinaryPath(ok, errorMessage); return settings()->gitExecutable(ok, errorMessage);
} }
QTextCodec *GitClient::encoding(const QString &workingDirectory, const QByteArray &configVar) const QTextCodec *GitClient::encoding(const QString &workingDirectory, const QByteArray &configVar) const
@@ -3525,7 +3525,7 @@ GitSettings *GitClient::settings() const
// determine version as '(major << 16) + (minor << 8) + patch' or 0. // determine version as '(major << 16) + (minor << 8) + patch' or 0.
unsigned GitClient::gitVersion(QString *errorMessage) const unsigned GitClient::gitVersion(QString *errorMessage) const
{ {
const Utils::FileName newGitBinary = gitBinaryPath(); const Utils::FileName newGitBinary = gitExecutable();
if (m_gitVersionForBinary != newGitBinary && !newGitBinary.isEmpty()) { if (m_gitVersionForBinary != newGitBinary && !newGitBinary.isEmpty()) {
// Do not execute repeatedly if that fails (due to git // Do not execute repeatedly if that fails (due to git
// not being installed) until settings are changed. // not being installed) until settings are changed.
@@ -3538,7 +3538,7 @@ unsigned GitClient::gitVersion(QString *errorMessage) const
// determine version as '(major << 16) + (minor << 8) + patch' or 0. // determine version as '(major << 16) + (minor << 8) + patch' or 0.
unsigned GitClient::synchronousGitVersion(QString *errorMessage) const unsigned GitClient::synchronousGitVersion(QString *errorMessage) const
{ {
if (gitBinaryPath().isEmpty()) if (gitExecutable().isEmpty())
return 0; return 0;
// run git --version // run git --version

View File

@@ -136,7 +136,7 @@ public:
explicit GitClient(GitSettings *settings); explicit GitClient(GitSettings *settings);
~GitClient(); ~GitClient();
Utils::FileName gitBinaryPath(bool *ok = 0, QString *errorMessage = 0) const; Utils::FileName gitExecutable(bool *ok = 0, QString *errorMessage = 0) const;
unsigned gitVersion(QString *errorMessage = 0) const; unsigned gitVersion(QString *errorMessage = 0) const;
QString findRepositoryForDirectory(const QString &dir); QString findRepositoryForDirectory(const QString &dir);

View File

@@ -70,7 +70,7 @@ GitSettings::GitSettings()
declareKey(lastResetIndexKey, 0); declareKey(lastResetIndexKey, 0);
} }
Utils::FileName GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const Utils::FileName GitSettings::gitExecutable(bool *ok, QString *errorMessage) const
{ {
// Locate binary in path if one is specified, otherwise default // Locate binary in path if one is specified, otherwise default
// to pathless binary // to pathless binary

View File

@@ -62,7 +62,7 @@ public:
static const QLatin1String graphLogKey; static const QLatin1String graphLogKey;
static const QLatin1String lastResetIndexKey; static const QLatin1String lastResetIndexKey;
Utils::FileName gitBinaryPath(bool *ok = 0, QString *errorMessage = 0) const; Utils::FileName gitExecutable(bool *ok = 0, QString *errorMessage = 0) const;
GitSettings &operator = (const GitSettings &s); GitSettings &operator = (const GitSettings &s);
}; };

View File

@@ -81,7 +81,7 @@ Core::Id GitVersionControl::id() const
bool GitVersionControl::isConfigured() const bool GitVersionControl::isConfigured() const
{ {
bool ok = false; bool ok = false;
m_client->gitBinaryPath(&ok); m_client->gitExecutable(&ok);
return ok; return ok;
} }

View File

@@ -98,7 +98,7 @@ bool MergeTool::start(const QString &workingDirectory, const QStringList &files)
} }
m_process = new MergeToolProcess(this); m_process = new MergeToolProcess(this);
m_process->setWorkingDirectory(workingDirectory); m_process->setWorkingDirectory(workingDirectory);
const Utils::FileName binary = m_gitClient->gitBinaryPath(); const Utils::FileName binary = m_gitClient->gitExecutable();
VcsBase::VcsBaseOutputWindow::instance()->appendCommand(workingDirectory, binary, arguments); VcsBase::VcsBaseOutputWindow::instance()->appendCommand(workingDirectory, binary, arguments);
m_process->start(binary.toString(), arguments); m_process->start(binary.toString(), arguments);
if (m_process->waitForStarted()) { if (m_process->waitForStarted()) {

View File

@@ -144,7 +144,7 @@ QVariant RemoteModel::headerData(int section, Qt::Orientation orientation, int r
if (role != Qt::DisplayRole || orientation != Qt::Horizontal) if (role != Qt::DisplayRole || orientation != Qt::Horizontal)
return QVariant(); return QVariant();
return (section == 0) ? tr("Name") : tr("Url"); return (section == 0) ? tr("Name") : tr("URL");
} }
bool RemoteModel::setData(const QModelIndex &index, const QVariant &value, int role) bool RemoteModel::setData(const QModelIndex &index, const QVariant &value, int role)

View File

@@ -115,7 +115,7 @@ void SettingsPage::apply()
if (m_widget->isVisible()) { if (m_widget->isVisible()) {
bool gitFoundOk; bool gitFoundOk;
QString errorMessage; QString errorMessage;
newSettings.gitBinaryPath(&gitFoundOk, &errorMessage); newSettings.gitExecutable(&gitFoundOk, &errorMessage);
if (!gitFoundOk) if (!gitFoundOk)
QMessageBox::warning(m_widget, tr("Git Settings"), errorMessage); QMessageBox::warning(m_widget, tr("Git Settings"), errorMessage);
} }

View File

@@ -158,6 +158,9 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
layout->addWidget(toolButton(close)); layout->addWidget(toolButton(close));
m_viewer->setOpenInNewWindowActionVisible(false); m_viewer->setOpenInNewWindowActionVisible(false);
} else if (style == ExternalWindow) { } else if (style == ExternalWindow) {
static int windowId = 0;
Core::ICore::registerWindow(this,
Core::Context(Core::Id("Help.Window.").withSuffix(++windowId)));
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing
connect(m_viewer, SIGNAL(titleChanged()), this, SLOT(updateWindowTitle())); connect(m_viewer, SIGNAL(titleChanged()), this, SLOT(updateWindowTitle()));

View File

@@ -48,12 +48,12 @@
<widget class="QComboBox" name="deviceTypeComboBox"> <widget class="QComboBox" name="deviceTypeComboBox">
<item> <item>
<property name="text"> <property name="text">
<string>iPhone 3.5-inch Retina display</string> <string>iPhone 3.5-inch Retina Display</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>iPhone 4-inch Retina display</string> <string>iPhone 4-inch Retina Display</string>
</property> </property>
</item> </item>
<item> <item>
@@ -63,7 +63,7 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>iPad Retina display</string> <string>iPad Retina Display</string>
</property> </property>
</item> </item>
</widget> </widget>
@@ -71,7 +71,7 @@
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="deviceTypeLabel"> <widget class="QLabel" name="deviceTypeLabel">
<property name="text"> <property name="text">
<string>Device Type:</string> <string>Device type:</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -365,7 +365,7 @@ void QbsBuildStep::parseProject()
{ {
m_parsingProject = true; m_parsingProject = true;
connect(qbsProject(), SIGNAL(projectParsingDone(bool)), SLOT(reparsingDone(bool))); connect(qbsProject(), SIGNAL(projectParsingDone(bool)), SLOT(reparsingDone(bool)));
qbsProject()->parseCurrentBuildConfiguration(true); qbsProject()->parseCurrentBuildConfiguration();
} }
void QbsBuildStep::build() void QbsBuildStep::build()

View File

@@ -100,7 +100,6 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) :
m_rootProjectNode(0), m_rootProjectNode(0),
m_qbsProjectParser(0), m_qbsProjectParser(0),
m_qbsUpdateFutureInterface(0), m_qbsUpdateFutureInterface(0),
m_forceParsing(false),
m_parsingScheduled(false), m_parsingScheduled(false),
m_cancelStatus(CancelStatusNone), m_cancelStatus(CancelStatusNone),
m_currentBc(0) m_currentBc(0)
@@ -283,7 +282,7 @@ void QbsProject::handleQbsParsingDone(bool success)
if (cancelStatus == CancelStatusCancelingForReparse) { if (cancelStatus == CancelStatusCancelingForReparse) {
m_qbsProjectParser->deleteLater(); m_qbsProjectParser->deleteLater();
m_qbsProjectParser = 0; m_qbsProjectParser = 0;
parseCurrentBuildConfiguration(m_forceParsing); parseCurrentBuildConfiguration();
return; return;
} }
@@ -291,8 +290,12 @@ void QbsProject::handleQbsParsingDone(bool success)
if (success) { if (success) {
m_qbsProject = m_qbsProjectParser->qbsProject(); m_qbsProject = m_qbsProjectParser->qbsProject();
const qbs::ProjectData &projectData = m_qbsProject.projectData();
QTC_CHECK(m_qbsProject.isValid()); QTC_CHECK(m_qbsProject.isValid());
if (projectData != m_projectData) {
m_projectData = projectData;
readQbsData(); readQbsData();
}
} else { } else {
m_qbsUpdateFutureInterface->reportCanceled(); m_qbsUpdateFutureInterface->reportCanceled();
} }
@@ -312,8 +315,8 @@ void QbsProject::handleQbsParsingDone(bool success)
void QbsProject::targetWasAdded(Target *t) void QbsProject::targetWasAdded(Target *t)
{ {
connect(t, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)), connect(t, SIGNAL(activeBuildConfigurationChanged(ProjectExplorer::BuildConfiguration*)),
this, SLOT(delayForcedParsing())); this, SLOT(delayParsing()));
connect(t, SIGNAL(buildDirectoryChanged()), this, SLOT(delayForcedParsing())); connect(t, SIGNAL(buildDirectoryChanged()), this, SLOT(delayParsing()));
} }
void QbsProject::changeActiveTarget(Target *t) void QbsProject::changeActiveTarget(Target *t)
@@ -347,7 +350,7 @@ void QbsProject::startParsing()
return; return;
} }
parseCurrentBuildConfiguration(false); parseCurrentBuildConfiguration();
} }
void QbsProject::delayParsing() void QbsProject::delayParsing()
@@ -355,12 +358,6 @@ void QbsProject::delayParsing()
m_parsingDelay.start(); m_parsingDelay.start();
} }
void QbsProject::delayForcedParsing()
{
m_forceParsing = true;
delayParsing();
}
// Qbs may change its data // Qbs may change its data
void QbsProject::readQbsData() void QbsProject::readQbsData()
{ {
@@ -379,11 +376,9 @@ void QbsProject::readQbsData()
emit fileListChanged(); emit fileListChanged();
} }
void QbsProject::parseCurrentBuildConfiguration(bool force) void QbsProject::parseCurrentBuildConfiguration()
{ {
m_parsingScheduled = false; m_parsingScheduled = false;
if (!m_forceParsing)
m_forceParsing = force;
if (m_cancelStatus == CancelStatusCancelingForReparse) if (m_cancelStatus == CancelStatusCancelingForReparse)
return; return;
@@ -436,14 +431,10 @@ void QbsProject::registerQbsProjectParser(QbsProjectParser *p)
m_qbsProjectParser = p; m_qbsProjectParser = p;
if (p) { if (p)
p->setForced(m_forceParsing);
connect(m_qbsProjectParser, SIGNAL(done(bool)), this, SLOT(handleQbsParsingDone(bool))); connect(m_qbsProjectParser, SIGNAL(done(bool)), this, SLOT(handleQbsParsingDone(bool)));
} }
m_forceParsing = false;
}
bool QbsProject::fromMap(const QVariantMap &map) bool QbsProject::fromMap(const QVariantMap &map)
{ {
if (!Project::fromMap(map)) if (!Project::fromMap(map))
@@ -478,7 +469,7 @@ void QbsProject::parse(const QVariantMap &config, const Environment &env, const
registerQbsProjectParser(new QbsProjectParser(this, m_qbsUpdateFutureInterface)); registerQbsProjectParser(new QbsProjectParser(this, m_qbsUpdateFutureInterface));
if (m_qbsProjectParser->parse(config, env, dir)) m_qbsProjectParser->parse(config, env, dir);
emit projectParsingStarted(); emit projectParsingStarted();
} }

View File

@@ -93,7 +93,7 @@ public:
QString profileForTarget(const ProjectExplorer::Target *t) const; QString profileForTarget(const ProjectExplorer::Target *t) const;
bool isParsing() const; bool isParsing() const;
bool hasParseResult() const; bool hasParseResult() const;
void parseCurrentBuildConfiguration(bool force); void parseCurrentBuildConfiguration();
void scheduleParsing() { m_parsingScheduled = true; } void scheduleParsing() { m_parsingScheduled = true; }
bool parsingScheduled() const { return m_parsingScheduled; } bool parsingScheduled() const { return m_parsingScheduled; }
void cancelParsing(); void cancelParsing();
@@ -114,7 +114,6 @@ public:
public slots: public slots:
void invalidate(); void invalidate();
void delayParsing(); void delayParsing();
void delayForcedParsing();
void readQbsData(); void readQbsData();
signals: signals:
@@ -146,13 +145,13 @@ private:
const QString m_projectName; const QString m_projectName;
const QString m_fileName; const QString m_fileName;
qbs::Project m_qbsProject; qbs::Project m_qbsProject;
qbs::ProjectData m_projectData;
QSet<Core::IDocument *> m_qbsDocuments; QSet<Core::IDocument *> m_qbsDocuments;
QbsRootProjectNode *m_rootProjectNode; QbsRootProjectNode *m_rootProjectNode;
QbsProjectParser *m_qbsProjectParser; QbsProjectParser *m_qbsProjectParser;
QFutureInterface<bool> *m_qbsUpdateFutureInterface; QFutureInterface<bool> *m_qbsUpdateFutureInterface;
bool m_forceParsing;
bool m_parsingScheduled; bool m_parsingScheduled;
enum CancelStatus { enum CancelStatus {

View File

@@ -89,7 +89,7 @@ bool QbsProjectFile::reload(QString *errorString, ReloadFlag flag, ChangeType ty
Q_UNUSED(flag) Q_UNUSED(flag)
if (type == TypePermissions) if (type == TypePermissions)
return true; return true;
m_project->delayForcedParsing(); m_project->delayParsing();
return true; return true;
} }

View File

@@ -522,7 +522,7 @@ void QbsProjectManagerPlugin::reparseProject(QbsProject *project)
if (BuildManager::isBuilding(project)) if (BuildManager::isBuilding(project))
project->scheduleParsing(); project->scheduleParsing();
else else
project->parseCurrentBuildConfiguration(true); project->parseCurrentBuildConfiguration();
} }
} // namespace Internal } // namespace Internal

View File

@@ -71,15 +71,10 @@ QbsProjectParser::~QbsProjectParser()
m_fi = 0; // we do not own m_fi, do not delete m_fi = 0; // we do not own m_fi, do not delete
} }
void QbsProjectParser::setForced(bool f) void QbsProjectParser::parse(const QVariantMap &config, const Environment &env, const QString &dir)
{ {
m_wasForced = f; QTC_ASSERT(!m_qbsSetupProjectJob, return);
} QTC_ASSERT(!dir.isEmpty(), return);
bool QbsProjectParser::parse(const QVariantMap &config, const Environment &env, const QString &dir)
{
QTC_ASSERT(!m_qbsSetupProjectJob, return false);
QTC_ASSERT(!dir.isNull(), return false);
m_currentProgressBase = 0; m_currentProgressBase = 0;
@@ -92,25 +87,6 @@ bool QbsProjectParser::parse(const QVariantMap &config, const Environment &env,
params.setBuildVariant(userConfig.take(specialKey).toString()); params.setBuildVariant(userConfig.take(specialKey).toString());
params.setSettingsDirectory(QbsManager::settings()->baseDirectoy()); params.setSettingsDirectory(QbsManager::settings()->baseDirectoy());
params.setOverriddenValues(userConfig); params.setOverriddenValues(userConfig);
m_error = params.expandBuildConfiguration();
if (m_error.hasError()) {
emit done(false);
return false;
}
// Avoid useless reparsing:
if (!m_wasForced
&& m_project.isValid()
&& m_project.projectConfiguration() == params.finalBuildConfigurationTree()) {
QHash<QString, QString> usedEnv = m_project.usedEnvironment();
for (QHash<QString, QString>::const_iterator i = usedEnv.constBegin();
i != usedEnv.constEnd(); ++i) {
if (env.value(i.key()) != i.value()) {
emit done(true);
return true;
}
}
}
// Some people don't like it when files are created as a side effect of opening a project, // Some people don't like it when files are created as a side effect of opening a project,
// so do not store the build graph if the build directory does not exist yet. // so do not store the build graph if the build directory does not exist yet.
@@ -132,8 +108,6 @@ bool QbsProjectParser::parse(const QVariantMap &config, const Environment &env,
this, SLOT(handleQbsParsingTaskSetup(QString,int))); this, SLOT(handleQbsParsingTaskSetup(QString,int)));
connect(m_qbsSetupProjectJob, SIGNAL(taskProgress(int,qbs::AbstractJob*)), connect(m_qbsSetupProjectJob, SIGNAL(taskProgress(int,qbs::AbstractJob*)),
this, SLOT(handleQbsParsingProgress(int))); this, SLOT(handleQbsParsingProgress(int)));
return true;
} }
void QbsProjectParser::cancel() void QbsProjectParser::cancel()

View File

@@ -51,9 +51,7 @@ public:
QFutureInterface<bool> *fi); QFutureInterface<bool> *fi);
~QbsProjectParser(); ~QbsProjectParser();
void setForced(bool); void parse(const QVariantMap &config, const Utils::Environment &env, const QString &dir);
bool parse(const QVariantMap &config, const Utils::Environment &env, const QString &dir);
void cancel(); void cancel();
qbs::Project qbsProject() const; qbs::Project qbsProject() const;
@@ -71,7 +69,6 @@ private:
QString pluginsBaseDirectory() const; QString pluginsBaseDirectory() const;
QString resourcesBaseDirectory() const; QString resourcesBaseDirectory() const;
bool m_wasForced;
QString m_projectFilePath; QString m_projectFilePath;
qbs::SetupProjectJob *m_qbsSetupProjectJob; qbs::SetupProjectJob *m_qbsSetupProjectJob;
qbs::ErrorInfo m_error; qbs::ErrorInfo m_error;

View File

@@ -161,7 +161,8 @@ QProcess *PuppetCreator::puppetProcess(const QString &puppetPath,
if (!qgetenv("DEBUG_QML_PUPPET").isEmpty()) if (!qgetenv("DEBUG_QML_PUPPET").isEmpty())
QMessageBox::information(Core::ICore::dialogParent(), QMessageBox::information(Core::ICore::dialogParent(),
QStringLiteral("Puppet is starting ..."), QStringLiteral("Puppet is starting ..."),
QStringLiteral("You can now attach your debugger to the puppet.")); QStringLiteral("You can now attach your debugger to the %1 puppet with process id: %2.").arg(
puppetMode, QString::number(puppetProcess->processId())));
return puppetProcess; return puppetProcess;
} }

View File

@@ -163,10 +163,10 @@ static QString qualifiedTypeNameForContext(const ObjectValue *objectValue,
<< " vs " << typeName << " vs " << typeName
<< " for " << e.exportName.toString(); << " for " << e.exportName.toString();
} }
if (packages.isEmpty() || packages.contains(e.exportName.libPath())) { if (packages.isEmpty() || packages.contains(e.exportName.libraryQualifiedPath())) {
if (e.exportName.splitPath.value(0) == QLatin1String("QtQuick")) if (e.exportName.splitPath.value(0) == QLatin1String("QtQuick"))
hasQtQuick = true; hasQtQuick = true;
possibleLibraries.append(e.exportName.libPath() + '.' + typeName); possibleLibraries.append(e.exportName.libraryQualifiedPath() + '.' + typeName);
} }
break; break;
} }
@@ -298,7 +298,7 @@ public:
if (const CppComponentValue * cppComponentValue = value_cast<CppComponentValue>(value)) { if (const CppComponentValue * cppComponentValue = value_cast<CppComponentValue>(value)) {
TypeName qualifiedTypeName = qualifiedTypeNameForContext(cppComponentValue, TypeName qualifiedTypeName = qualifiedTypeNameForContext(cppComponentValue,
m_context->vContext(), *m_context->snapshot().importDependencies()).toUtf8(); m_context->viewerContext(), *m_context->snapshot().importDependencies()).toUtf8();
m_properties.append(qMakePair(propertyName, qualifiedTypeName)); m_properties.append(qMakePair(propertyName, qualifiedTypeName));
} else { } else {
TypeId typeId; TypeId typeId;

View File

@@ -91,7 +91,7 @@
<item> <item>
<widget class="QPushButton" name="cleanUpButton"> <widget class="QPushButton" name="cleanUpButton">
<property name="text"> <property name="text">
<string>Clean up</string> <string>Clean Up</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -17,7 +17,7 @@
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="localExeLabel"> <widget class="QLabel" name="localExeLabel">
<property name="text"> <property name="text">
<string>Local Executable:</string> <string>Local executable:</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -27,7 +27,7 @@
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="remoteExeLabel"> <widget class="QLabel" name="remoteExeLabel">
<property name="text"> <property name="text">
<string>Remote Executable:</string> <string>Remote executable:</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -47,7 +47,7 @@
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="workingDirLabel"> <widget class="QLabel" name="workingDirLabel">
<property name="text"> <property name="text">
<string>Working Directory:</string> <string>Working directory:</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@@ -587,6 +587,8 @@ QWidget *CallgrindToolPrivate::createWidgets()
{ {
QTC_ASSERT(!m_visualisation, return 0); QTC_ASSERT(!m_visualisation, return 0);
QSettings *coreSettings = ICore::settings();
// //
// DockWidgets // DockWidgets
// //
@@ -600,6 +602,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
m_callersView = new CostView(mw); m_callersView = new CostView(mw);
m_callersView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CallersView")); m_callersView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CallersView"));
m_callersView->setSettings(coreSettings, "Valgrind.CallgrindTool.CallersView");
m_callersView->sortByColumn(CallModel::CostColumn); m_callersView->sortByColumn(CallModel::CostColumn);
m_callersView->setFrameStyle(QFrame::NoFrame); m_callersView->setFrameStyle(QFrame::NoFrame);
// enable sorting // enable sorting
@@ -612,6 +615,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
m_calleesView = new CostView(mw); m_calleesView = new CostView(mw);
m_calleesView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CalleesView")); m_calleesView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CalleesView"));
m_calleesView->setSettings(coreSettings, "Valgrind.CallgrindTool.CalleesView");
m_calleesView->sortByColumn(CallModel::CostColumn); m_calleesView->sortByColumn(CallModel::CostColumn);
m_calleesView->setFrameStyle(QFrame::NoFrame); m_calleesView->setFrameStyle(QFrame::NoFrame);
// enable sorting // enable sorting
@@ -624,6 +628,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
m_flatView = new CostView(mw); m_flatView = new CostView(mw);
m_flatView->setObjectName(QLatin1String("Valgrind.CallgrindTool.FlatView")); m_flatView->setObjectName(QLatin1String("Valgrind.CallgrindTool.FlatView"));
m_flatView->setSettings(coreSettings, "Valgrind.CallgrindTool.FlatView");
m_flatView->sortByColumn(DataModel::SelfCostColumn); m_flatView->sortByColumn(DataModel::SelfCostColumn);
m_flatView->setFrameStyle(QFrame::NoFrame); m_flatView->setFrameStyle(QFrame::NoFrame);
m_flatView->setAttribute(Qt::WA_MacShowFocusRect, false); m_flatView->setAttribute(Qt::WA_MacShowFocusRect, false);

View File

@@ -1,26 +0,0 @@
import qbs
import qbs.File
import qbs.FileInfo
Transformer {
property pathList sourceFiles
property path targetDirectory
inputs: sourceFiles
Artifact { fileName: targetDirectory }
prepare: {
var commands = []
for (var tag in inputs) {
for (var index in inputs[tag]) {
var artifact = inputs[tag][index];
var cmd = new JavaScriptCommand();
cmd.sourceFile = artifact.filePath;
cmd.description = "Copying '" + cmd.sourceFile + "' to '" + output.filePath + "/'.";
cmd.highlight = "codegen";
cmd.targetFilePath = output.filePath + '/' + FileInfo.fileName(cmd.sourceFile);
cmd.sourceCode = function() { File.copy(sourceFile, targetFilePath); }
commands.push(cmd);
}
}
return commands;
}
}

View File

@@ -1,6 +1,5 @@
import qbs import qbs
import qbs.FileInfo import qbs.FileInfo
import "./copytransformer.qbs" as CopyTransformer
import QtcFunctions import QtcFunctions
DynamicLibrary { DynamicLibrary {
@@ -8,6 +7,7 @@ DynamicLibrary {
Depends { name: "ExtensionSystem" } Depends { name: "ExtensionSystem" }
Depends { name: "cpp" } Depends { name: "cpp" }
Depends { name: "Qt.core" } Depends { name: "Qt.core" }
Depends { name: "copyable_resource" }
targetName: QtcFunctions.qtLibraryName(qbs, name.split('_')[1]) targetName: QtcFunctions.qtLibraryName(qbs, name.split('_')[1])
destinationDirectory: project.buildDirectory + '/' destinationDirectory: project.buildDirectory + '/'
+ FileInfo.relativePath(project.ide_source_tree, sourceDirectory) + FileInfo.relativePath(project.ide_source_tree, sourceDirectory)
@@ -17,8 +17,10 @@ DynamicLibrary {
].concat(additionalRPaths) ].concat(additionalRPaths)
property pathList filesToCopy property pathList filesToCopy
property pathList additionalRPaths: [] property pathList additionalRPaths: []
CopyTransformer { Group {
sourceFiles: product.filesToCopy name: "resources"
targetDirectory: product.destinationDirectory fileTags: "copyable_resource"
copyable_resource.targetDirectory: product.destinationDirectory
files: product.filesToCopy
} }
} }

View File

@@ -4,6 +4,6 @@ import "../../../plugin.qbs" as Plugin
Plugin { Plugin {
name: "circular_plugin1" name: "circular_plugin1"
filesToCopy: "plugin.xml" filesToCopy: "plugin.xml"
files: ["plugin1.h", "plugin1.cpp"].concat(filesToCopy) files: ["plugin1.h", "plugin1.cpp"]
cpp.defines: base.concat(["PLUGIN1_LIBRARY"]) cpp.defines: base.concat(["PLUGIN1_LIBRARY"])
} }

View File

@@ -4,6 +4,6 @@ import "../../../plugin.qbs" as Plugin
Plugin { Plugin {
name: "circular_plugin2" name: "circular_plugin2"
filesToCopy: "plugin.xml" filesToCopy: "plugin.xml"
files: ["plugin2.h", "plugin2.cpp"].concat(filesToCopy) files: ["plugin2.h", "plugin2.cpp"]
cpp.defines: base.concat(["PLUGIN2_LIBRARY"]) cpp.defines: base.concat(["PLUGIN2_LIBRARY"])
} }

View File

@@ -4,6 +4,6 @@ import "../../../plugin.qbs" as Plugin
Plugin { Plugin {
name: "circular_plugin3" name: "circular_plugin3"
filesToCopy: "plugin.xml" filesToCopy: "plugin.xml"
files: ["plugin3.h", "plugin3.cpp"].concat(filesToCopy) files: ["plugin3.h", "plugin3.cpp"]
cpp.defines: base.concat(["PLUGIN3_LIBRARY"]) cpp.defines: base.concat(["PLUGIN3_LIBRARY"])
} }

View File

@@ -10,6 +10,6 @@ Plugin {
destinationDirectory + "/../plugin2", destinationDirectory + "/../plugin2",
destinationDirectory + "/../plugin3" destinationDirectory + "/../plugin3"
] ]
files: ["plugin1.h", "plugin1.cpp"].concat(filesToCopy) files: ["plugin1.h", "plugin1.cpp"]
cpp.defines: base.concat(["PLUGIN1_LIBRARY"]) cpp.defines: base.concat(["PLUGIN1_LIBRARY"])
} }

View File

@@ -4,6 +4,6 @@ import "../../../plugin.qbs" as Plugin
Plugin { Plugin {
name: "correct_plugin2" name: "correct_plugin2"
filesToCopy: "plugin.spec" filesToCopy: "plugin.spec"
files: ["plugin2.h", "plugin2.cpp"].concat(filesToCopy) files: ["plugin2.h", "plugin2.cpp"]
cpp.defines: base.concat(["PLUGIN2_LIBRARY"]) cpp.defines: base.concat(["PLUGIN2_LIBRARY"])
} }

View File

@@ -6,6 +6,6 @@ Plugin {
Depends { name: "correct_plugin2" } Depends { name: "correct_plugin2" }
filesToCopy: "plugin.spec" filesToCopy: "plugin.spec"
additionalRPaths: [destinationDirectory + "/../plugin2"] additionalRPaths: [destinationDirectory + "/../plugin2"]
files: ["plugin3.h", "plugin3.cpp"].concat(filesToCopy) files: ["plugin3.h", "plugin3.cpp"]
cpp.defines: base.concat(["PLUGIN3_LIBRARY"]) cpp.defines: base.concat(["PLUGIN3_LIBRARY"])
} }

View File

@@ -1,6 +1,5 @@
import qbs import qbs
import QtcAutotest import QtcAutotest
import "../copytransformer.qbs" as CopyTransformer
QtcAutotest { QtcAutotest {
name: "PluginManager autotest" name: "PluginManager autotest"
@@ -15,6 +14,8 @@ QtcAutotest {
Group { Group {
id: pluginGroup id: pluginGroup
name: "plugins" name: "plugins"
fileTags: "copyable_resource"
copyable_resource.targetDirectory: product.destinationDirectory + "/plugins"
files: [ files: [
"plugins/otherplugin.xml", "plugins/otherplugin.xml",
"plugins/plugin1.xml", "plugins/plugin1.xml",
@@ -22,11 +23,6 @@ QtcAutotest {
] ]
} }
CopyTransformer {
sourceFiles: pluginGroup.files
targetDirectory: product.destinationDirectory + "/plugins"
}
files: "tst_pluginmanager.cpp" files: "tst_pluginmanager.cpp"
cpp.defines: base.concat(['PLUGINMANAGER_TESTS_DIR="' + destinationDirectory + '"']) cpp.defines: base.concat(['PLUGINMANAGER_TESTS_DIR="' + destinationDirectory + '"'])
} }

View File

@@ -1,7 +1,5 @@
import qbs import qbs
import QtcAutotest import QtcAutotest
import "../copytransformer.qbs" as CopyTransformer
QtcAutotest { QtcAutotest {
name: "ExtensionSystem pluginspec autotest" name: "ExtensionSystem pluginspec autotest"
@@ -13,6 +11,8 @@ QtcAutotest {
Group { Group {
id: testSpecsGroup id: testSpecsGroup
name: "test specs" name: "test specs"
fileTags: "copyable_resource"
copyable_resource.targetDirectory: product.destinationDirectory + "/testspecs"
files: [ files: [
"testspecs/simplespec.xml", "testspecs/simplespec.xml",
"testspecs/simplespec_experimental.xml", "testspecs/simplespec_experimental.xml",
@@ -28,6 +28,8 @@ QtcAutotest {
Group { Group {
id: testDependenciesGroup id: testDependenciesGroup
name: "test dependencies" name: "test dependencies"
fileTags: "copyable_resource"
copyable_resource.targetDirectory: product.destinationDirectory + "/testdependencies"
files: [ files: [
"testdependencies/spec1.xml", "testdependencies/spec1.xml",
"testdependencies/spec2.xml", "testdependencies/spec2.xml",
@@ -39,21 +41,8 @@ QtcAutotest {
Group { Group {
id: specGroup id: specGroup
name: "spec" name: "spec"
fileTags: "copyable_resource"
copyable_resource.targetDirectory: product.destinationDirectory + "/testdir"
files: ["testdir/spec.xml"] files: ["testdir/spec.xml"]
} }
CopyTransformer {
sourceFiles: testSpecsGroup.files
targetDirectory: product.destinationDirectory + "/testspecs"
}
CopyTransformer {
sourceFiles: testDependenciesGroup.files
targetDirectory: product.destinationDirectory + "/testdependencies"
}
CopyTransformer {
sourceFiles: specGroup.files
targetDirectory: product.destinationDirectory + "/testdir"
}
} }

View File

@@ -6,7 +6,7 @@ Plugin {
files: [ files: [
"testplugin.h", "testplugin.cpp", "testplugin.h", "testplugin.cpp",
"testplugin_global.h" "testplugin_global.h"
].concat(filesToCopy) ]
filesToCopy: "testplugin.xml" filesToCopy: "testplugin.xml"
cpp.defines: base.concat(["MYPLUGIN_LIBRARY"]) cpp.defines: base.concat(["MYPLUGIN_LIBRARY"])
} }