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
\omit
// currently broken & disabled
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
the file. This is enabled by default. To disable it, click the
\inlineimage qml-observer-bar-reload.png "Apply Changes on Save button"
(\gui {Apply Changes on Save}) button on the toolbar.
\endomit
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
application, but not in the source code.

View File

@@ -5,6 +5,7 @@ import QtcProduct
QtcProduct {
type: "application"
Depends { name: "Qt.test" }
Depends { name: "copyable_resource" }
targetName: "tst_" + name.split(' ').join("")
// 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;
}
ViewerContext Context::vContext() const
ViewerContext Context::viewerContext() const
{
return _vContext;
}

View File

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

View File

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

View File

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

View File

@@ -181,9 +181,9 @@ bool FakeMetaObjectWithOrigin::operator ==(const FakeMetaObjectWithOrigin &o) co
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

View File

@@ -687,7 +687,7 @@ public:
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
{

View File

@@ -29,16 +29,188 @@
#include "basetreeview.h"
#include <utils/qtcassert.h>
#include <QDebug>
#include <QFontMetrics>
#include <QHeaderView>
#include <QItemDelegate>
#include <QLabel>
#include <QMap>
#include <QMenu>
#include <QMouseEvent>
#include <QSettings>
#include <QTimer>
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
{
@@ -58,8 +230,12 @@ public:
}
};
} // namespace Internal
using namespace Internal;
BaseTreeView::BaseTreeView(QWidget *parent)
: TreeView(parent)
: TreeView(parent), d(new BaseTreeViewPrivate(this))
{
setAttribute(Qt::WA_MacShowFocusRect, false);
setFrameStyle(QFrame::NoFrame);
@@ -68,30 +244,42 @@ BaseTreeView::BaseTreeView(QWidget *parent)
setSelectionMode(QAbstractItemView::ExtendedSelection);
setUniformRowHeights(true);
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)),
SLOT(rowActivatedHelper(QModelIndex)));
d, SLOT(rowActivatedHelper(QModelIndex)));
connect(this, SIGNAL(clicked(QModelIndex)),
SLOT(rowClickedHelper(QModelIndex)));
connect(header(), SIGNAL(sectionClicked(int)),
SLOT(toggleColumnWidth(int)));
d, SLOT(rowClickedHelper(QModelIndex)));
connect(h, SIGNAL(sectionClicked(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)
{
QAbstractItemModel *oldModel = model();
const char *sig = "columnAdjustmentRequested()";
if (model()) {
if (oldModel) {
int index = model()->metaObject()->indexOfSignal(sig);
if (index != -1)
disconnect(model(), SIGNAL(columnAdjustmentRequested()), this, SLOT(resizeColumns()));
disconnect(model(), SIGNAL(columnAdjustmentRequested()), d, SLOT(resizeColumns()));
}
TreeView::setModel(m);
if (m) {
int index = m->metaObject()->indexOfSignal(sig);
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);
const QModelIndex mi = indexAt(ev->pos());
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();
if (!h)
return;
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);
}
QTC_ASSERT(!d->m_settings, qDebug() << "DUPLICATED setSettings" << key);
d->m_settings = settings;
d->m_settingsKey = QString::fromLatin1(key);
d->readSettings();
}
QModelIndexList BaseTreeView::activeRows() const
@@ -169,3 +312,5 @@ QModelIndexList BaseTreeView::activeRows() const
}
} // namespace Utils
#include "basetreeview.moc"

View File

@@ -34,15 +34,23 @@
#include "itemviews.h"
QT_BEGIN_NAMESPACE
class QSettings;
QT_END_NAMESPACE
namespace Utils {
namespace Internal { class BaseTreeViewPrivate; }
class QTCREATOR_UTILS_EXPORT BaseTreeView : public TreeView
{
Q_OBJECT
public:
BaseTreeView(QWidget *parent = 0);
~BaseTreeView();
void setSettings(QSettings *settings, const QByteArray &key);
QModelIndexList activeRows() const;
void setModel(QAbstractItemModel *model);
@@ -51,16 +59,10 @@ public:
void mousePressEvent(QMouseEvent *ev);
public slots:
void resizeColumns();
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:
int suggestedColumnSize(int column) const;
Internal::BaseTreeViewPrivate *d;
};
} // namespace Utils

View File

@@ -31,6 +31,7 @@
#include "qtcassert.h"
#include <QApplication>
#include <QContextMenuEvent>
#include <QDebug>
#include <QDockWidget>
@@ -42,6 +43,7 @@
#include <QSettings>
#include <QStyle>
#include <QStyleOption>
#include <QTimer>
#include <QToolButton>
static const char stateKeyC[] = "State";
@@ -131,7 +133,7 @@ public:
const int minWidth = 10;
const int maxWidth = 10000;
const int inactiveHeight = 3;
const int inactiveHeight = 0;
const int activeHeight = m_closeButton->sizeHint().height() + 2;
m_minimumInactiveSize = QSize(minWidth, inactiveHeight);
@@ -150,12 +152,6 @@ public:
setLayout(layout);
}
void enterEvent(QEvent *event)
{
setActive(true);
QWidget::enterEvent(event);
}
void leaveEvent(QEvent *event)
{
if (!q->isFloating())
@@ -202,27 +198,84 @@ public:
class DockWidget : public QDockWidget
{
Q_OBJECT
public:
DockWidget(QWidget *inner, QWidget *parent)
: QDockWidget(parent)
: QDockWidget(parent), m_inner(inner)
{
setWidget(inner);
setFeatures(QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetFloatable);
setObjectName(inner->objectName() + QLatin1String("DockWidget"));
setWindowTitle(inner->windowTitle());
setMouseTracking(true);
QStyleOptionDockWidget opt;
initStyleOption(&opt);
auto titleBar = new TitleBarWidget(this, opt);
titleBar->m_titleLabel->setText(inner->windowTitle());
setTitleBarWidget(titleBar);
m_titleBar = new TitleBarWidget(this, opt);
m_titleBar->m_titleLabel->setText(inner->windowTitle());
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"));
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"));
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
@@ -324,9 +377,9 @@ void FancyMainWindow::showEvent(QShowEvent *event)
void FancyMainWindow::contextMenuEvent(QContextMenuEvent *event)
{
QMenu *menu = createPopupMenu();
menu->exec(event->globalPos());
delete menu;
QMenu menu;
addDockActionsToMenu(&menu);
menu.exec(event->globalPos());
}
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();
}
QMenu *FancyMainWindow::createPopupMenu()
void FancyMainWindow::addDockActionsToMenu(QMenu *menu)
{
QList<QAction *> actions;
QList<QDockWidget *> dockwidgets = findChildren<QDockWidget *>();
@@ -407,12 +460,10 @@ QMenu *FancyMainWindow::createPopupMenu()
}
}
qSort(actions.begin(), actions.end(), actionLessThan);
QMenu *menu = new QMenu(this);
foreach (QAction *action, actions)
menu->addAction(action);
menu->addAction(&d->m_menuSeparator);
menu->addAction(&d->m_resetLayoutAction);
return menu;
}
QAction *FancyMainWindow::menuSeparator() const
@@ -444,3 +495,5 @@ void FancyMainWindow::setToolBarDockWidget(QDockWidget *dock)
}
} // namespace Utils
#include "fancymainwindow.moc"

View File

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

View File

@@ -102,12 +102,12 @@ void AvdDialog::updateApiLevelComboBox()
m_avdDialog.warningIcon->setVisible(true);
m_avdDialog.warningText->setVisible(true);
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));
} else if (filteredList.isEmpty()) {
m_avdDialog.warningIcon->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()));
} else {
m_avdDialog.warningIcon->setVisible(false);

View File

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

View File

@@ -140,7 +140,7 @@ QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableBui
int CMakeBuildConfigurationFactory::priority(const ProjectExplorer::Kit *k, const QString &projectPath) const
{
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,

View File

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

View File

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

View File

@@ -35,6 +35,7 @@ namespace Constants {
const char PROJECTCONTEXT[] = "CMakeProject.ProjectContext";
const char CMAKEMIMETYPE[] = "text/x-cmake";
const char CMAKEPROJECTMIMETYPE[] = "text/x-cmake-project";
const char CMAKE_EDITOR_ID[] = "CMakeProject.CMakeEditor";
const char CMAKE_EDITOR_DISPLAY_NAME[] = "CMake Editor";
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
{
return QLatin1String(Constants::CMAKEMIMETYPE);
return QLatin1String(Constants::CMAKEPROJECTMIMETYPE);
}
QString CMakeManager::cmakeExecutable() const

View File

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

View File

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

View File

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

View File

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

View File

@@ -687,9 +687,18 @@ void EditorManager::splitNewWindow(Internal::EditorView *view)
else
newEditor = editor; // move to the new view
splitter = new SplitterOrView;
splitter->setAttribute(Qt::WA_DeleteOnClose);
splitter->setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing
splitter->resize(QSize(800, 600));
QWidget *win = new QWidget;
QVBoxLayout *layout = new QVBoxLayout;
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;
context->setContext(Context(Constants::C_EDITORMANAGER));
context->setWidget(splitter);
@@ -697,8 +706,8 @@ void EditorManager::splitNewWindow(Internal::EditorView *view)
d->m_root.append(splitter);
d->m_rootContext.append(context);
connect(splitter, SIGNAL(destroyed(QObject*)), m_instance, SLOT(rootDestroyed(QObject*)));
splitter->show();
ICore::raiseWindow(splitter);
win->show();
ICore::raiseWindow(win);
if (newEditor)
m_instance->activateEditor(splitter->view(), newEditor, IgnoreNavigationHistory);
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_goToCurrentFindAction = new QAction(tr("Go to Current Document Find"), this);
m_goToCurrentFindAction = new QAction(this);
Core::ActionManager::registerAction(m_goToCurrentFindAction, Constants::S_RETURNTOEDITOR,
Context(Constants::C_FINDTOOLBAR));
connect(m_goToCurrentFindAction, SIGNAL(triggered()), this, SLOT(setFocusToCurrentFindSupport()));

View File

@@ -28,6 +28,7 @@
****************************************************************************/
#include "icore.h"
#include "windowsupport.h"
#include <app/app_version.h>
#include <extensionsystem/pluginmanager.h>
@@ -523,6 +524,11 @@ void ICore::removeContextObject(IContext *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)
{
m_mainwindow->openFiles(arguments, flags);

View File

@@ -109,6 +109,9 @@ public:
static void addContextObject(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 {
None = 0,
SwitchMode = 1,

View File

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

View File

@@ -76,6 +76,7 @@ class ToolSettings;
class MimeTypeSettings;
class StatusBarManager;
class VersionDialog;
class WindowSupport;
class SystemEditor;
class MainWindow : public Utils::AppMainWindow
@@ -107,8 +108,6 @@ public:
void setOverrideColor(const QColor &color);
void updateFullScreenAction();
bool isNewItemDialogRunning() const;
signals:
@@ -119,7 +118,6 @@ public slots:
void newFile();
void openFileWith();
void exit();
void toggleFullScreen();
void showNewItemDialog(const QString &title,
const QList<IWizardFactory *> &factories,
@@ -167,6 +165,7 @@ private:
Context m_additionalContexts;
SettingsDatabase *m_settingsDatabase;
mutable QPrinter *m_printer;
WindowSupport *m_windowSupport;
ActionManager *m_actionManager;
EditorManager *m_editorManager;
ExternalToolManager *m_externalToolManager;
@@ -205,9 +204,6 @@ private:
QAction *m_optionsAction;
QAction *m_toggleSideBarAction;
QAction *m_toggleModeSelectorAction;
QAction *m_toggleFullScreenAction;
QAction *m_minimizeAction;
QAction *m_zoomAction;
QToolButton *m_toggleSideBarButton;
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;
ActionContainer *m_viewsMenu;
QList<Command *> m_menuCommandsToAdd;
Project *m_previousProject;
Target *m_previousTarget;
@@ -319,10 +318,6 @@ void DebuggerMainWindowPrivate::createViewsMenuItems()
"Debugger.Views.Separator", debugcontext);
cmd->setAttribute(Command::CA_Hide);
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,
@@ -410,7 +405,6 @@ QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &langua
Command *cmd = Core::ActionManager::registerAction(toggleViewAction,
Core::Id("Debugger.").withSuffix(widget->objectName()), globalContext);
cmd->setAttribute(Command::CA_Hide);
d->m_menuCommandsToAdd.append(cmd);
dockWidget->installEventFilter(&d->m_resizeEventFilter);
@@ -426,12 +420,7 @@ QDockWidget *DebuggerMainWindow::createDockWidget(const DebuggerLanguage &langua
void DebuggerMainWindow::addStagedMenuEntries()
{
Utils::sort(d->m_menuCommandsToAdd, [](Command *cmd1, Command *cmd2) {
return cmd1->action()->text() < cmd2->action()->text();
});
foreach (Command *cmd, d->m_menuCommandsToAdd)
d->m_viewsMenu->addAction(cmd);
d->m_menuCommandsToAdd.clear();
addDockActionsToMenu(d->m_viewsMenu->menu());
}
QWidget *DebuggerMainWindow::createContents(IMode *mode)
@@ -543,9 +532,9 @@ void DebuggerMainWindow::writeSettings() const
void DebuggerMainWindow::showViewsMenu()
{
QMenu *menu = createPopupMenu();
menu->exec(d->m_viewButton->mapToGlobal(QPoint()));
delete menu;
QMenu menu;
addDockActionsToMenu(&menu);
menu.exec(d->m_viewButton->mapToGlobal(QPoint()));
}
void DebuggerMainWindow::readSettings()
@@ -613,11 +602,6 @@ bool DebuggerMainWindowPrivate::isQmlActive() const
return (m_activeDebugLanguages & QmlLanguage);
}
QMenu *DebuggerMainWindow::createPopupMenu()
{
return FancyMainWindow::createPopupMenu();
}
void DebuggerMainWindowPrivate::setSimpleDockWidgetArrangement()
{
using namespace Constants;

View File

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

View File

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

View File

@@ -999,14 +999,14 @@ int DebuggerToolTipTreeView::computeHeight(const QModelIndex &index) const
void DebuggerToolTipTreeView::computeSize()
{
WatchTreeView::reexpand(this, model()->index(0, 0));
int columns = 30; // Decoration
int rows = 0;
bool rootDecorated = false;
if (model()) {
const int columnCount = model()->columnCount();
rootDecorated = model()->rowCount() > 0;
if (QAbstractItemModel *m = model()) {
WatchTreeView::reexpand(this, m->index(0, 0));
const int columnCount = m->columnCount();
rootDecorated = m->rowCount() > 0;
if (rootDecorated)
for (int i = 0; i < columnCount; ++i) {
resizeColumnToContents(i);
@@ -1020,6 +1020,7 @@ void DebuggerToolTipTreeView::computeSize()
// Add a bit of space to account for tooltip border, and not
// touch the border of the screen.
QPoint pos(x(), y());
QTC_ASSERT(QApplication::desktop(), return);
QRect desktopRect = QApplication::desktop()->availableGeometry(pos);
const int maxWidth = desktopRect.right() - pos.x() - 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"));
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->populate();
d->selectRemoteCoreButton = new QPushButton(tr("Browse..."), this);
d->remoteCoreFileName = new QLineEdit(this);
d->forceLocalCheckBox = new QCheckBox(this);
d->forceLocalLabel = new QLabel(this);
d->forceLocalLabel->setText(tr("Use local core file:"));
d->forceLocalLabel->setBuddy(d->forceLocalCheckBox);
d->localExecFileName = new PathChooser(this);
d->localExecFileName->setHistoryCompleter(QLatin1String("LocalExecutable"));
d->localExecFileName->setExpectedKind(PathChooser::File);
d->localExecFileName->setPromptDialogTitle(tr("Select Executable"));
d->remoteCoreFileName = new QLineEdit(this);
d->selectRemoteCoreButton = new QPushButton(tr("Browse..."), this);
d->localCoreFileName = new PathChooser(this);
d->localCoreFileName->setHistoryCompleter(QLatin1String("Debugger.CoreFile.History"));
d->localCoreFileName->setExpectedKind(PathChooser::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->setHistoryCompleter(QLatin1String("Debugger.StartupScript.History"));
d->overrideStartScriptFileName->setExpectedKind(PathChooser::File);
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;
coreLayout->addWidget(d->localCoreFileName);
coreLayout->addWidget(d->remoteCoreFileName);

View File

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

View File

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

View File

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

View File

@@ -119,7 +119,7 @@ VcsBase::Command *CloneWizardPage::createCheckoutJob(Utils::FileName *checkoutPa
if (d->recursiveCheckBox->isChecked())
args << QLatin1String("--recursive");
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());
command->addFlags(VcsBase::VcsBasePlugin::MergeOutputChannels);
command->addJob(args, -1);

View File

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

View File

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

View File

@@ -136,7 +136,7 @@ public:
explicit GitClient(GitSettings *settings);
~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;
QString findRepositoryForDirectory(const QString &dir);

View File

@@ -70,7 +70,7 @@ GitSettings::GitSettings()
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
// to pathless binary

View File

@@ -62,7 +62,7 @@ public:
static const QLatin1String graphLogKey;
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);
};

View File

@@ -81,7 +81,7 @@ Core::Id GitVersionControl::id() const
bool GitVersionControl::isConfigured() const
{
bool ok = false;
m_client->gitBinaryPath(&ok);
m_client->gitExecutable(&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->setWorkingDirectory(workingDirectory);
const Utils::FileName binary = m_gitClient->gitBinaryPath();
const Utils::FileName binary = m_gitClient->gitExecutable();
VcsBase::VcsBaseOutputWindow::instance()->appendCommand(workingDirectory, binary, arguments);
m_process->start(binary.toString(), arguments);
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)
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)

View File

@@ -115,7 +115,7 @@ void SettingsPage::apply()
if (m_widget->isVisible()) {
bool gitFoundOk;
QString errorMessage;
newSettings.gitBinaryPath(&gitFoundOk, &errorMessage);
newSettings.gitExecutable(&gitFoundOk, &errorMessage);
if (!gitFoundOk)
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));
m_viewer->setOpenInNewWindowActionVisible(false);
} 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_QuitOnClose, false); // don't prevent Qt Creator from closing
connect(m_viewer, SIGNAL(titleChanged()), this, SLOT(updateWindowTitle()));

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -71,15 +71,10 @@ QbsProjectParser::~QbsProjectParser()
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;
}
bool QbsProjectParser::parse(const QVariantMap &config, const Environment &env, const QString &dir)
{
QTC_ASSERT(!m_qbsSetupProjectJob, return false);
QTC_ASSERT(!dir.isNull(), return false);
QTC_ASSERT(!m_qbsSetupProjectJob, return);
QTC_ASSERT(!dir.isEmpty(), return);
m_currentProgressBase = 0;
@@ -92,25 +87,6 @@ bool QbsProjectParser::parse(const QVariantMap &config, const Environment &env,
params.setBuildVariant(userConfig.take(specialKey).toString());
params.setSettingsDirectory(QbsManager::settings()->baseDirectoy());
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,
// 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)));
connect(m_qbsSetupProjectJob, SIGNAL(taskProgress(int,qbs::AbstractJob*)),
this, SLOT(handleQbsParsingProgress(int)));
return true;
}
void QbsProjectParser::cancel()

View File

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

View File

@@ -161,7 +161,8 @@ QProcess *PuppetCreator::puppetProcess(const QString &puppetPath,
if (!qgetenv("DEBUG_QML_PUPPET").isEmpty())
QMessageBox::information(Core::ICore::dialogParent(),
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;
}

View File

@@ -163,10 +163,10 @@ static QString qualifiedTypeNameForContext(const ObjectValue *objectValue,
<< " vs " << typeName
<< " 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"))
hasQtQuick = true;
possibleLibraries.append(e.exportName.libPath() + '.' + typeName);
possibleLibraries.append(e.exportName.libraryQualifiedPath() + '.' + typeName);
}
break;
}
@@ -298,7 +298,7 @@ public:
if (const CppComponentValue * cppComponentValue = value_cast<CppComponentValue>(value)) {
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));
} else {
TypeId typeId;

View File

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

View File

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

View File

@@ -587,6 +587,8 @@ QWidget *CallgrindToolPrivate::createWidgets()
{
QTC_ASSERT(!m_visualisation, return 0);
QSettings *coreSettings = ICore::settings();
//
// DockWidgets
//
@@ -600,6 +602,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
m_callersView = new CostView(mw);
m_callersView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CallersView"));
m_callersView->setSettings(coreSettings, "Valgrind.CallgrindTool.CallersView");
m_callersView->sortByColumn(CallModel::CostColumn);
m_callersView->setFrameStyle(QFrame::NoFrame);
// enable sorting
@@ -612,6 +615,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
m_calleesView = new CostView(mw);
m_calleesView->setObjectName(QLatin1String("Valgrind.CallgrindTool.CalleesView"));
m_calleesView->setSettings(coreSettings, "Valgrind.CallgrindTool.CalleesView");
m_calleesView->sortByColumn(CallModel::CostColumn);
m_calleesView->setFrameStyle(QFrame::NoFrame);
// enable sorting
@@ -624,6 +628,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
m_flatView = new CostView(mw);
m_flatView->setObjectName(QLatin1String("Valgrind.CallgrindTool.FlatView"));
m_flatView->setSettings(coreSettings, "Valgrind.CallgrindTool.FlatView");
m_flatView->sortByColumn(DataModel::SelfCostColumn);
m_flatView->setFrameStyle(QFrame::NoFrame);
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.FileInfo
import "./copytransformer.qbs" as CopyTransformer
import QtcFunctions
DynamicLibrary {
@@ -8,6 +7,7 @@ DynamicLibrary {
Depends { name: "ExtensionSystem" }
Depends { name: "cpp" }
Depends { name: "Qt.core" }
Depends { name: "copyable_resource" }
targetName: QtcFunctions.qtLibraryName(qbs, name.split('_')[1])
destinationDirectory: project.buildDirectory + '/'
+ FileInfo.relativePath(project.ide_source_tree, sourceDirectory)
@@ -17,8 +17,10 @@ DynamicLibrary {
].concat(additionalRPaths)
property pathList filesToCopy
property pathList additionalRPaths: []
CopyTransformer {
sourceFiles: product.filesToCopy
targetDirectory: product.destinationDirectory
Group {
name: "resources"
fileTags: "copyable_resource"
copyable_resource.targetDirectory: product.destinationDirectory
files: product.filesToCopy
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,7 +1,5 @@
import qbs
import QtcAutotest
import "../copytransformer.qbs" as CopyTransformer
QtcAutotest {
name: "ExtensionSystem pluginspec autotest"
@@ -13,6 +11,8 @@ QtcAutotest {
Group {
id: testSpecsGroup
name: "test specs"
fileTags: "copyable_resource"
copyable_resource.targetDirectory: product.destinationDirectory + "/testspecs"
files: [
"testspecs/simplespec.xml",
"testspecs/simplespec_experimental.xml",
@@ -28,6 +28,8 @@ QtcAutotest {
Group {
id: testDependenciesGroup
name: "test dependencies"
fileTags: "copyable_resource"
copyable_resource.targetDirectory: product.destinationDirectory + "/testdependencies"
files: [
"testdependencies/spec1.xml",
"testdependencies/spec2.xml",
@@ -39,21 +41,8 @@ QtcAutotest {
Group {
id: specGroup
name: "spec"
fileTags: "copyable_resource"
copyable_resource.targetDirectory: product.destinationDirectory + "/testdir"
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: [
"testplugin.h", "testplugin.cpp",
"testplugin_global.h"
].concat(filesToCopy)
]
filesToCopy: "testplugin.xml"
cpp.defines: base.concat(["MYPLUGIN_LIBRARY"])
}