forked from qt-creator/qt-creator
Merge remote branch 'origin/2.0'
Conflicts: src/plugins/projectexplorer/miniprojecttargetselector.cpp src/plugins/qmldesigner/designercore/model/modeltotextmerger.cpp src/plugins/qmldesigner/designercore/model/rewriteactioncompressor.cpp src/plugins/qt4projectmanager/qt-maemo/maemosshthread.cpp src/plugins/qt4projectmanager/qt-maemo/maemosshthread.h tests/manual/gdbdebugger/simple/app.cpp
This commit is contained in:
@@ -7,8 +7,8 @@ equals(QMAKE_DIR_SEP, /) { # unix, mingw+msys
|
||||
# The lack of spaces in front of the && is necessary!
|
||||
QDOC = set SRCDIR=$$PWD&& set OUTDIR=$$OUT_PWD/doc/html&& $$QDOC_BIN
|
||||
} else { # nmake
|
||||
QDOC = set SRCDIR=$$PWD $$escape_expand(\n\t) \
|
||||
set OUTDIR=$$OUT_PWD/doc/html $$escape_expand(\n\t) \
|
||||
QDOC = set SRCDIR=$$PWD $$escape_expand(\\n\\t) \
|
||||
set OUTDIR=$$OUT_PWD/doc/html $$escape_expand(\\n\\t) \
|
||||
$$QDOC_BIN
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#version check qt
|
||||
contains(QT_VERSION, ^4\.[0-6]\..*) {
|
||||
contains(QT_VERSION, ^4\\.[0-6]\\..*) {
|
||||
message("Cannot build Qt Creator with Qt version $${QT_VERSION}.")
|
||||
error("Use at least Qt 4.7.")
|
||||
}
|
||||
|
||||
@@ -1384,7 +1384,8 @@ class Dumper:
|
||||
if len(fields) == 1 and fields[0].name is None:
|
||||
innerType = value.type.target()
|
||||
with Children(self, 1, innerType):
|
||||
self.putFields(item)
|
||||
child = Item(value, item.iname, None, item.name)
|
||||
self.putFields(child)
|
||||
|
||||
def putFields(self, item, innerType = None):
|
||||
value = item.value
|
||||
|
||||
@@ -2053,7 +2053,7 @@ Sollen sie überschrieben werden?</translation>
|
||||
<message>
|
||||
<location line="+5"/>
|
||||
<source>&Options...</source>
|
||||
<translation>&Einstellungen</translation>
|
||||
<translation>&Einstellungen...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+11"/>
|
||||
@@ -2433,7 +2433,7 @@ Sollen sie überschrieben werden?</translation>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source><h3>Qt Creator %1 %8</h3>Based on Qt %2 (%3 bit)<br/><br/>Built on %4 at %5<br /><br/>%9<br/>Copyright 2008-%6 %7. All rights reserved.<br/><br/>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.<br/></source>
|
||||
<translation><h3>Qt Creator %1</h3>Basierend auf Qt %2 (%3 bit)<br/><br/>Erstellt am %4 um %5<br /><br/>%8<br/>Copyright 2008-%6 %7. Alle Rechte vorbehalten.<br/><br/>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.<br/></translation>
|
||||
<translation><h3>Qt Creator %1 %8</h3>Basierend auf Qt %2 (%3 bit)<br/><br/>Erstellt am %4 um %5<br /><br/>%9<br/>Copyright 2008-%6 %7. Alle Rechte vorbehalten.<br/><br/>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.<br/></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,26 +14,22 @@ LRELEASE = $$targetPath($$[QT_INSTALL_BINS]/lrelease)
|
||||
|
||||
TRANSLATIONS = $$prependAll(LANGUAGES, $$PWD/qtcreator_,.ts)
|
||||
|
||||
MIME_TR_H = $$IDE_DATA_PATH/translations/mime_tr.h
|
||||
CUSTOMWIZARD_TR_H = $$IDE_DATA_PATH/translations/customwizard_tr.h
|
||||
MIME_TR_H = $$OUT_PWD/mime_tr.h
|
||||
CUSTOMWIZARD_TR_H = $$OUT_PWD/customwizard_tr.h
|
||||
|
||||
contains(QT_VERSION, ^4\.[0-6]\..*) {
|
||||
ts.commands = @echo This Qt version is too old for the ts target. Need Qt 4.7+.
|
||||
} else {
|
||||
for(dir, $$list($$files($$IDE_SOURCE_TREE/src/plugins/*))):MIMETYPES_FILES += $$files($$dir/*.mimetypes.xml)
|
||||
MIMETYPES_FILES = \"$$join(MIMETYPES_FILES, \", \")\"
|
||||
for(dir, $$list($$files($$IDE_SOURCE_TREE/src/plugins/*))):MIMETYPES_FILES += $$files($$dir/*.mimetypes.xml)
|
||||
MIMETYPES_FILES = \"$$join(MIMETYPES_FILES, \", \")\"
|
||||
|
||||
for(dir, $$list($$files($$IDE_SOURCE_TREE/share/qtcreator/templates/wizards/*))):CUSTOMWIZARD_FILES += $$files($$dir/wizard.xml)
|
||||
CUSTOMWIZARD_FILES = \"$$join(CUSTOMWIZARD_FILES, \", \")\"
|
||||
for(dir, $$list($$files($$IDE_SOURCE_TREE/share/qtcreator/templates/wizards/*))):CUSTOMWIZARD_FILES += $$files($$dir/wizard.xml)
|
||||
CUSTOMWIZARD_FILES = \"$$join(CUSTOMWIZARD_FILES, \", \")\"
|
||||
|
||||
QMAKE_SUBSTITUTES += extract-mimetypes.xq.in
|
||||
QMAKE_SUBSTITUTES += extract-customwizards.xq.in
|
||||
ts.commands += \
|
||||
QMAKE_SUBSTITUTES += extract-mimetypes.xq.in
|
||||
QMAKE_SUBSTITUTES += extract-customwizards.xq.in
|
||||
ts.commands += \
|
||||
$$XMLPATTERNS -output $$MIME_TR_H $$PWD/extract-mimetypes.xq && \
|
||||
$$XMLPATTERNS -output $$CUSTOMWIZARD_TR_H $$PWD/extract-customwizards.xq && \
|
||||
(cd $$IDE_SOURCE_TREE && $$LUPDATE src share/qtcreator/qmldesigner $$MIME_TR_H $$CUSTOMWIZARD_TR_H -ts $$TRANSLATIONS) && \
|
||||
$$QMAKE_DEL_FILE $$MIME_TR_H
|
||||
}
|
||||
QMAKE_EXTRA_TARGETS += ts
|
||||
|
||||
TEMPLATE = app
|
||||
|
||||
@@ -81,6 +81,8 @@ void GdbEngine::updateLocalsPython(const QByteArray &varList)
|
||||
options += "fancy,";
|
||||
if (theDebuggerBoolSetting(AutoDerefPointers))
|
||||
options += "autoderef,";
|
||||
if (!qgetenv("QTC_DEBUGGER_PYTHON_VERBOSE").isEmpty())
|
||||
options += "pe,";
|
||||
if (options.isEmpty())
|
||||
options += "defaults,";
|
||||
options.chop(1);
|
||||
|
||||
@@ -260,15 +260,19 @@ MiniTargetWidget::MiniTargetWidget(Target *target, QWidget *parent) :
|
||||
QFormLayout *formLayout = new QFormLayout;
|
||||
formLayout->setLabelAlignment(Qt::AlignRight);
|
||||
QLabel *lbl;
|
||||
int indent = 10;
|
||||
if (hasBuildConfiguration()) {
|
||||
lbl = new QLabel(tr("Build:"));
|
||||
lbl->setObjectName(QString::fromUtf8("buildLabel"));
|
||||
lbl->setIndent(10);
|
||||
lbl->setMinimumWidth(lbl->fontMetrics().width(lbl->text()) + indent + 4);
|
||||
lbl->setIndent(indent);
|
||||
|
||||
formLayout->addRow(lbl, buildHelperLayout);
|
||||
}
|
||||
lbl = new QLabel(tr("Run:"));
|
||||
lbl->setObjectName(QString::fromUtf8("runLabel"));
|
||||
lbl->setIndent(10);
|
||||
lbl->setMinimumWidth(lbl->fontMetrics().width(lbl->text()) + indent + 4);
|
||||
lbl->setIndent(indent);
|
||||
formLayout->addRow(lbl, runHelperLayout);
|
||||
|
||||
gridLayout->addWidget(m_targetName, 0, 0);
|
||||
@@ -316,8 +320,14 @@ void MiniTargetWidget::setActiveRunConfiguration()
|
||||
|
||||
void MiniTargetWidget::addRunConfiguration(ProjectExplorer::RunConfiguration* rc)
|
||||
{
|
||||
Q_UNUSED(rc);
|
||||
m_runComboBox->setEnabled(m_target->runConfigurations().count()>1);
|
||||
connect(rc, SIGNAL(displayNameChanged()), SLOT(updateDisplayName()));
|
||||
m_runComboBox->addItem(rc->displayName(), QVariant::fromValue(rc));
|
||||
m_runComboBox->setItemData(m_runComboBox->findText(rc->displayName()),
|
||||
rc->displayName(), Qt::ToolTipRole);
|
||||
if (m_target->activeRunConfiguration() == rc)
|
||||
m_runComboBox->setCurrentIndex(m_runComboBox->count()-1);
|
||||
|
||||
m_runComboBox->setEnabled(m_runComboBox->count()>1);
|
||||
}
|
||||
|
||||
void MiniTargetWidget::removeRunConfiguration(ProjectExplorer::RunConfiguration* rc)
|
||||
@@ -330,8 +340,14 @@ void MiniTargetWidget::addBuildConfiguration(ProjectExplorer::BuildConfiguration
|
||||
{
|
||||
Q_UNUSED(bc);
|
||||
QTC_ASSERT(m_buildComboBox, return);
|
||||
connect(bc, SIGNAL(displayNameChanged()), SIGNAL(changed()), Qt::UniqueConnection);
|
||||
m_buildComboBox->setEnabled(m_target->buildConfigurations().count() > 1);
|
||||
connect(bc, SIGNAL(displayNameChanged()), SLOT(updateDisplayName()));
|
||||
m_buildComboBox->addItem(bc->displayName(), QVariant::fromValue(bc));
|
||||
m_buildComboBox->setItemData(m_buildComboBox->findText(bc->displayName()),
|
||||
bc->displayName(), Qt::ToolTipRole);
|
||||
if (m_target->activeBuildConfiguration() == bc)
|
||||
m_buildComboBox->setCurrentIndex(m_buildComboBox->count()-1);
|
||||
|
||||
m_buildComboBox->setEnabled(m_buildComboBox->count() > 1);
|
||||
}
|
||||
|
||||
void MiniTargetWidget::removeBuildConfiguration(ProjectExplorer::BuildConfiguration* bc)
|
||||
@@ -387,7 +403,6 @@ MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorActi
|
||||
m_projectsBox->setProperty("hideborder", true);
|
||||
m_projectsBox->setObjectName(QString::fromUtf8("ProjectsBox"));
|
||||
m_projectsBox->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
|
||||
m_projectsBox->setMaximumWidth(200);
|
||||
|
||||
toolLayout->addWidget(lbl);
|
||||
toolLayout->addWidget(new Utils::StyledSeparator);
|
||||
@@ -562,6 +577,10 @@ void MiniProjectTargetSelector::updateAction()
|
||||
QString runConfig;
|
||||
QIcon targetIcon = style()->standardIcon(QStyle::SP_ComputerIcon);
|
||||
|
||||
const int extrawidth = 110; // Size of margins + icon width
|
||||
// Some fudge numbers to ensure the menu doesnt grow unbounded
|
||||
int maxLength = fontMetrics().averageCharWidth() * 140;
|
||||
|
||||
if (project) {
|
||||
projectName = project->displayName();
|
||||
|
||||
@@ -571,10 +590,14 @@ void MiniProjectTargetSelector::updateAction()
|
||||
}
|
||||
if (BuildConfiguration *bc = target->activeBuildConfiguration()) {
|
||||
buildConfig = bc->displayName();
|
||||
int minimumWidth = fontMetrics().width(bc->displayName() + tr("Build:")) + extrawidth;
|
||||
m_widgetStack->setMinimumWidth(qMin(maxLength, qMax(minimumWidth, m_widgetStack->minimumWidth())));
|
||||
}
|
||||
|
||||
if (RunConfiguration *rc = target->activeRunConfiguration()) {
|
||||
runConfig = rc->displayName();
|
||||
int minimumWidth = fontMetrics().width(rc->displayName() + tr("Run:")) + extrawidth;
|
||||
m_widgetStack->setMinimumWidth(qMin(maxLength, qMax(minimumWidth, m_widgetStack->minimumWidth())));
|
||||
}
|
||||
targetToolTipText = target->toolTip();
|
||||
targetIcon = createCenteredIcon(target->icon(), target->overlayIcon());
|
||||
|
||||
@@ -53,27 +53,12 @@
|
||||
#include <QtGui/QMenu>
|
||||
|
||||
namespace {
|
||||
|
||||
const int TASK_ICON_SIZE = 16;
|
||||
const int TASK_ICON_MARGIN = 2;
|
||||
|
||||
const QIcon ERROR_ICON(":/projectexplorer/images/compile_error.png");
|
||||
const QIcon WARNING_ICON(":/projectexplorer/images/compile_warning.png");
|
||||
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
|
||||
QIcon Task::icon() const
|
||||
{
|
||||
if (type == ProjectExplorer::Task::Error)
|
||||
return ERROR_ICON;
|
||||
else if (type == ProjectExplorer::Task::Warning)
|
||||
return WARNING_ICON;
|
||||
else
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class TaskView : public QListView
|
||||
@@ -141,6 +126,8 @@ public:
|
||||
|
||||
enum Roles { File = Qt::UserRole, Line, Description, FileNotFound, Type, Category, Icon, Task_t };
|
||||
|
||||
QIcon taskTypeIcon(Task::TaskType t) const;
|
||||
|
||||
private:
|
||||
QHash<QString,QString> m_categories; // category id -> display name
|
||||
QList<Task> m_tasks; // all tasks (in order of insertion)
|
||||
@@ -148,8 +135,8 @@ private:
|
||||
|
||||
QHash<QString,bool> m_fileNotFound;
|
||||
int m_maxSizeOfFileName;
|
||||
QIcon m_errorIcon;
|
||||
QIcon m_warningIcon;
|
||||
const QIcon m_errorIcon;
|
||||
const QIcon m_warningIcon;
|
||||
};
|
||||
|
||||
class TaskFilterModel : public QSortFilterProxyModel
|
||||
@@ -224,11 +211,24 @@ void TaskView::keyPressEvent(QKeyEvent *e)
|
||||
// TaskModel
|
||||
/////
|
||||
|
||||
TaskModel::TaskModel()
|
||||
TaskModel::TaskModel() :
|
||||
m_maxSizeOfFileName(0),
|
||||
m_errorIcon(QLatin1String(":/projectexplorer/images/compile_error.png")),
|
||||
m_warningIcon(QLatin1String(":/projectexplorer/images/compile_warning.png"))
|
||||
{
|
||||
m_maxSizeOfFileName = 0;
|
||||
m_errorIcon = QIcon(":/projectexplorer/images/compile_error.png");
|
||||
m_warningIcon = QIcon(":/projectexplorer/images/compile_warning.png");
|
||||
}
|
||||
|
||||
QIcon TaskModel::taskTypeIcon(Task::TaskType t) const
|
||||
{
|
||||
switch (t) {
|
||||
case Task::Warning:
|
||||
return m_warningIcon;
|
||||
case Task::Error:
|
||||
return m_errorIcon;
|
||||
case Task::Unknown:
|
||||
break;
|
||||
}
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
void TaskModel::addCategory(const QString &categoryId, const QString &categoryName)
|
||||
@@ -353,7 +353,7 @@ QVariant TaskModel::data(const QModelIndex &index, int role) const
|
||||
} else if (role == TaskModel::Category) {
|
||||
return m_tasks.at(index.row()).category;
|
||||
} else if (role == TaskModel::Icon) {
|
||||
return m_tasks.at(index.row()).icon();
|
||||
return taskTypeIcon(m_tasks.at(index.row()).type);
|
||||
} else if (role == TaskModel::Task_t) {
|
||||
return QVariant::fromValue(m_tasks.at(index.row()));
|
||||
}
|
||||
@@ -495,7 +495,7 @@ TaskWindow::TaskWindow()
|
||||
connect(m_listview, SIGNAL(clicked(QModelIndex)),
|
||||
this, SLOT(showTaskInFile(QModelIndex)));
|
||||
|
||||
m_filterWarningsButton = createFilterButton(WARNING_ICON,
|
||||
m_filterWarningsButton = createFilterButton(taskTypeIcon(Task::Warning),
|
||||
tr("Show Warnings"),
|
||||
this, SLOT(setShowWarnings(bool)));
|
||||
|
||||
@@ -771,6 +771,11 @@ void TaskWindow::updateActions()
|
||||
m_copyAction->setEnabled(m_model->tasks().count() > 0);
|
||||
}
|
||||
|
||||
QIcon TaskWindow::taskTypeIcon(Task::TaskType t) const
|
||||
{
|
||||
return m_model->taskTypeIcon(t);
|
||||
}
|
||||
|
||||
/////
|
||||
// Delegate
|
||||
/////
|
||||
|
||||
@@ -86,9 +86,6 @@ struct PROJECTEXPLORER_EXPORT Task {
|
||||
// doesn't work if you split it up, nor are our parsers
|
||||
// anywhere near being that good
|
||||
QList<QTextLayout::FormatRange> formats;
|
||||
|
||||
/// Get the icon used to represent this task
|
||||
QIcon icon() const;
|
||||
};
|
||||
|
||||
class PROJECTEXPLORER_EXPORT TaskWindow : public Core::IOutputPane
|
||||
@@ -128,6 +125,8 @@ public:
|
||||
void goToNext();
|
||||
void goToPrev();
|
||||
|
||||
QIcon taskTypeIcon(Task::TaskType t) const;
|
||||
|
||||
signals:
|
||||
void tasksChanged();
|
||||
|
||||
|
||||
@@ -94,7 +94,10 @@ void FormEditorGraphicsView::mouseMoveEvent(QMouseEvent *event)
|
||||
delete mouseEvent;
|
||||
}
|
||||
|
||||
m_feedbackOriginPoint = event->pos() + QPoint(50, -80);
|
||||
// Keeps the feedback bubble within screen boundraries
|
||||
int tx = qMin(width() - 114, qMax(16, event->pos().x() + 50));
|
||||
int ty = qMin(height() - 45, qMax(10, event->pos().y() - 70));
|
||||
m_feedbackOriginPoint = QPoint(tx, ty);
|
||||
}
|
||||
|
||||
void FormEditorGraphicsView::keyPressEvent(QKeyEvent *event)
|
||||
@@ -127,6 +130,30 @@ void FormEditorGraphicsView::leaveEvent(QEvent *event)
|
||||
{
|
||||
m_feedbackOriginPoint = QPoint();
|
||||
QGraphicsView::leaveEvent(event);
|
||||
}
|
||||
|
||||
static QPixmap createBubblePixmap()
|
||||
{
|
||||
QPixmap pixmap(124, 48);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter pmPainter(&pixmap);
|
||||
pmPainter.setRenderHint(QPainter::Antialiasing);
|
||||
pmPainter.setOpacity(0.85);
|
||||
pmPainter.translate(0.5, 0.5);
|
||||
pmPainter.setPen(Qt::NoPen);
|
||||
pmPainter.setBrush(QColor(0, 0, 0, 40));
|
||||
pmPainter.drawRoundedRect(QRect(0, 0, 124, 48), 8, 8);
|
||||
QLinearGradient gradient(QPoint(0, 0), QPoint(0, 44));
|
||||
gradient.setColorAt(0.0, QColor(70, 70, 70));
|
||||
gradient.setColorAt(1.0, QColor(10, 10, 10));
|
||||
pmPainter.setBrush(gradient);
|
||||
pmPainter.setPen(QColor(60, 60, 60));
|
||||
pmPainter.drawRoundedRect(QRect(2, 1, 120, 45), 5, 5);
|
||||
pmPainter.setBrush(Qt::NoBrush);
|
||||
pmPainter.setPen(QColor(255, 255, 255, 140));
|
||||
pmPainter.drawRoundedRect(QRect(3, 2, 118, 43), 5, 5);
|
||||
pmPainter.end();
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*rect*/ )
|
||||
@@ -138,7 +165,6 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
|
||||
return;
|
||||
|
||||
painter->save();
|
||||
|
||||
painter->resetTransform();
|
||||
painter->translate(m_feedbackOriginPoint);
|
||||
|
||||
@@ -150,18 +176,9 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
|
||||
font.setPixelSize(12);
|
||||
painter->setFont(font);
|
||||
|
||||
painter->save();
|
||||
painter->setOpacity(0.85);
|
||||
|
||||
QLinearGradient gradient(QPoint(0, 0), QPoint(120, 45));
|
||||
gradient.setColorAt(0.0, Qt::black);
|
||||
gradient.setColorAt(1.0, Qt::darkGray);
|
||||
painter->setBrush(gradient);
|
||||
|
||||
painter->setPen(Qt::black);
|
||||
painter->drawRoundedRect(QRect(-1, -1, 120, 45), 5, 5);
|
||||
painter->restore();
|
||||
|
||||
if (m_bubblePixmap.isNull())
|
||||
m_bubblePixmap = createBubblePixmap();
|
||||
painter->drawPixmap(-13, -7, m_bubblePixmap);
|
||||
|
||||
if (m_beginXHasExpression) {
|
||||
if(m_feedbackNode.hasBindingProperty("x"))
|
||||
@@ -175,8 +192,8 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
|
||||
painter->setPen(defaultColor);
|
||||
}
|
||||
|
||||
painter->drawText(QPoint(2.0, 13.0), QString("x:"));
|
||||
painter->drawText(QPoint(14.0, 13.0), m_feedbackNode.instanceValue("x").toString());
|
||||
painter->drawText(QPoint(8.0, 13.0), QString("x:"));
|
||||
painter->drawText(QPoint(22.0, 13.0), m_feedbackNode.instanceValue("x").toString());
|
||||
|
||||
|
||||
if (m_beginYHasExpression) {
|
||||
@@ -192,7 +209,7 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
|
||||
}
|
||||
|
||||
painter->drawText(QPoint(60.0, 13.0), QString("y:"));
|
||||
painter->drawText(QPoint(70.0, 13.0), m_feedbackNode.instanceValue("y").toString());
|
||||
painter->drawText(QPoint(72.0, 13.0), m_feedbackNode.instanceValue("y").toString());
|
||||
|
||||
|
||||
if (m_beginWidthHasExpression) {
|
||||
@@ -207,8 +224,8 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
|
||||
painter->setPen(defaultColor);
|
||||
}
|
||||
|
||||
painter->drawText(QPoint(2.0, 26.0), QString("w:"));
|
||||
painter->drawText(QPoint(14.0, 26.0), m_feedbackNode.instanceValue("width").toString());
|
||||
painter->drawText(QPoint(8.0, 29.0), QString("w:"));
|
||||
painter->drawText(QPoint(22.0, 29.0), m_feedbackNode.instanceValue("width").toString());
|
||||
|
||||
|
||||
if (m_beginHeightHasExpression) {
|
||||
@@ -223,8 +240,8 @@ void FormEditorGraphicsView::drawForeground(QPainter *painter, const QRectF &/*r
|
||||
painter->setPen(defaultColor);
|
||||
}
|
||||
|
||||
painter->drawText(QPoint(60.0, 26.0), QString("h:"));
|
||||
painter->drawText(QPoint(70.0, 26.0), m_feedbackNode.instanceValue("height").toString());
|
||||
painter->drawText(QPoint(60.0, 29.0), QString("h:"));
|
||||
painter->drawText(QPoint(72.0, 29.0), m_feedbackNode.instanceValue("height").toString());
|
||||
|
||||
if (m_parentNode != m_feedbackNode.instanceParent()) {
|
||||
painter->setPen(changeColor);
|
||||
|
||||
@@ -67,6 +67,7 @@ private:
|
||||
bool m_beginWidthHasExpression;
|
||||
bool m_beginHeightHasExpression;
|
||||
QPoint m_feedbackOriginPoint;
|
||||
QPixmap m_bubblePixmap;
|
||||
};
|
||||
|
||||
} // namespace QmlDesigner
|
||||
|
||||
@@ -43,7 +43,7 @@ NavigatorTreeModel::NavigatorTreeModel(QObject *parent)
|
||||
: QStandardItemModel(parent),
|
||||
m_blockItemChangedSignal(false)
|
||||
{
|
||||
invisibleRootItem()->setFlags(Qt::NoItemFlags);
|
||||
invisibleRootItem()->setFlags(Qt::ItemIsDropEnabled);
|
||||
|
||||
#ifdef _LOCK_ITEMS_
|
||||
setColumnCount(3);
|
||||
|
||||
@@ -39,6 +39,8 @@ namespace QmlDesigner {
|
||||
class ModelNode;
|
||||
class NodeState;
|
||||
|
||||
const QString auxDataString = QLatin1String("anchors_");
|
||||
|
||||
namespace Internal {
|
||||
|
||||
QmlAnchorBindingProxy::QmlAnchorBindingProxy(QObject *parent) :
|
||||
@@ -269,6 +271,15 @@ void QmlAnchorBindingProxy::resetLayout() {
|
||||
m_fxItemNode.anchors().removeAnchors();
|
||||
m_fxItemNode.anchors().removeMargins();
|
||||
|
||||
if (qFuzzyCompare(m_fxItemNode.instancePosition().x(), 0.0))
|
||||
m_fxItemNode.setVariantProperty("x", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "x"));
|
||||
if (qFuzzyCompare(m_fxItemNode.instancePosition().y(), 0.0))
|
||||
m_fxItemNode.setVariantProperty("y", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "y"));
|
||||
if (qFuzzyCompare(m_fxItemNode.instanceSize().width(), 0.0))
|
||||
m_fxItemNode.setVariantProperty("width", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "width"));
|
||||
if (qFuzzyCompare(m_fxItemNode.instanceSize().height(), 0.0))
|
||||
m_fxItemNode.setVariantProperty("height", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "height"));
|
||||
|
||||
emit topAnchorChanged();
|
||||
emit bottomAnchorChanged();
|
||||
emit leftAnchorChanged();
|
||||
@@ -290,6 +301,7 @@ void QmlAnchorBindingProxy::setBottomAnchor(bool anchor)
|
||||
removeBottomAnchor();
|
||||
} else {
|
||||
calcBottomMargin();
|
||||
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "height", m_fxItemNode.instanceSize().height());
|
||||
m_fxItemNode.removeVariantProperty("height");
|
||||
}
|
||||
emit bottomAnchorChanged();
|
||||
@@ -312,7 +324,8 @@ void QmlAnchorBindingProxy::setLeftAnchor(bool anchor)
|
||||
removeLeftAnchor();
|
||||
} else {
|
||||
calcLeftMargin();
|
||||
m_fxItemNode.removeVariantProperty("width");
|
||||
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "x", m_fxItemNode.instancePosition().x());
|
||||
m_fxItemNode.removeVariantProperty("x");
|
||||
}
|
||||
emit leftAnchorChanged();
|
||||
if (hasAnchors() != anchor)
|
||||
@@ -333,7 +346,8 @@ void QmlAnchorBindingProxy::setRightAnchor(bool anchor)
|
||||
removeRightAnchor();
|
||||
} else {
|
||||
calcRightMargin();
|
||||
m_fxItemNode.removeVariantProperty("x");
|
||||
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "width", m_fxItemNode.instanceSize().width());
|
||||
m_fxItemNode.removeVariantProperty("width");
|
||||
}
|
||||
emit rightAnchorChanged();
|
||||
if (hasAnchors() != anchor)
|
||||
@@ -364,13 +378,11 @@ void QmlAnchorBindingProxy::calcTopMargin()
|
||||
{
|
||||
m_locked = true;
|
||||
|
||||
if (m_topTarget == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
|
||||
if (m_topTarget.modelNode() == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
|
||||
qreal topMargin = transformedBoundingBox().top() - parentBoundingBox().top();
|
||||
m_fxItemNode.anchors().setMargin( AnchorLine::Top, topMargin);
|
||||
m_fxItemNode.anchors().setAnchor(AnchorLine::Top, m_topTarget, AnchorLine::Top);
|
||||
} else {
|
||||
qDebug() << boundingBox(m_fxItemNode).top();
|
||||
qDebug() << boundingBox(m_topTarget).bottom();
|
||||
qreal topMargin = boundingBox(m_fxItemNode).top() - boundingBox(m_topTarget).bottom();
|
||||
m_fxItemNode.anchors().setMargin( AnchorLine::Top, topMargin);
|
||||
m_fxItemNode.anchors().setAnchor(AnchorLine::Top, m_topTarget, AnchorLine::Bottom);
|
||||
@@ -383,7 +395,7 @@ void QmlAnchorBindingProxy::calcBottomMargin()
|
||||
{
|
||||
m_locked = true;
|
||||
|
||||
if (m_bottomTarget == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
|
||||
if (m_bottomTarget.modelNode() == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
|
||||
qreal bottomMargin = parentBoundingBox().bottom() - transformedBoundingBox().bottom();
|
||||
m_fxItemNode.anchors().setMargin( AnchorLine::Bottom, bottomMargin);
|
||||
m_fxItemNode.anchors().setAnchor(AnchorLine::Bottom, m_bottomTarget, AnchorLine::Bottom);
|
||||
@@ -400,7 +412,7 @@ void QmlAnchorBindingProxy::calcLeftMargin()
|
||||
{
|
||||
m_locked = true;
|
||||
|
||||
if (m_leftTarget == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
|
||||
if (m_leftTarget.modelNode() == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
|
||||
qreal leftMargin = transformedBoundingBox().left() - parentBoundingBox().left();
|
||||
m_fxItemNode.anchors().setMargin(AnchorLine::Left, leftMargin);
|
||||
m_fxItemNode.anchors().setAnchor(AnchorLine::Left, m_leftTarget, AnchorLine::Left);
|
||||
@@ -417,7 +429,7 @@ void QmlAnchorBindingProxy::calcRightMargin()
|
||||
{
|
||||
m_locked = true;
|
||||
|
||||
if (m_rightTarget == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
|
||||
if (m_rightTarget.modelNode() == m_fxItemNode.modelNode().parentProperty().parentModelNode()) {
|
||||
qreal rightMargin = parentBoundingBox().right() - transformedBoundingBox().right();
|
||||
m_fxItemNode.anchors().setMargin( AnchorLine::Right, rightMargin);
|
||||
m_fxItemNode.anchors().setAnchor(AnchorLine::Right, m_rightTarget, AnchorLine::Right);
|
||||
@@ -444,6 +456,7 @@ void QmlAnchorBindingProxy::setTopAnchor(bool anchor)
|
||||
removeTopAnchor();
|
||||
} else {
|
||||
calcTopMargin();
|
||||
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "y", m_fxItemNode.instancePosition().y());
|
||||
m_fxItemNode.removeVariantProperty("y");
|
||||
}
|
||||
emit topAnchorChanged();
|
||||
@@ -456,6 +469,10 @@ void QmlAnchorBindingProxy::removeTopAnchor() {
|
||||
|
||||
m_fxItemNode.anchors().removeAnchor(AnchorLine::Top);
|
||||
m_fxItemNode.anchors().removeMargin(AnchorLine::Top);
|
||||
|
||||
if (qFuzzyCompare(m_fxItemNode.instancePosition().y(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + "y"))
|
||||
m_fxItemNode.setVariantProperty("y", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "y"));
|
||||
|
||||
}
|
||||
|
||||
void QmlAnchorBindingProxy::removeBottomAnchor() {
|
||||
@@ -463,6 +480,9 @@ void QmlAnchorBindingProxy::removeBottomAnchor() {
|
||||
|
||||
m_fxItemNode.anchors().removeAnchor(AnchorLine::Bottom);
|
||||
m_fxItemNode.anchors().removeMargin(AnchorLine::Bottom);
|
||||
|
||||
if (qFuzzyCompare(m_fxItemNode.instanceSize().height(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + "height"))
|
||||
m_fxItemNode.setVariantProperty("height", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "height"));
|
||||
}
|
||||
|
||||
void QmlAnchorBindingProxy::removeLeftAnchor() {
|
||||
@@ -470,6 +490,9 @@ void QmlAnchorBindingProxy::removeLeftAnchor() {
|
||||
|
||||
m_fxItemNode.anchors().removeAnchor(AnchorLine::Left);
|
||||
m_fxItemNode.anchors().removeMargin(AnchorLine::Left);
|
||||
|
||||
if (qFuzzyCompare(m_fxItemNode.instancePosition().x(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + "x"))
|
||||
m_fxItemNode.setVariantProperty("x", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "x"));
|
||||
}
|
||||
|
||||
void QmlAnchorBindingProxy::removeRightAnchor() {
|
||||
@@ -477,6 +500,9 @@ void QmlAnchorBindingProxy::removeRightAnchor() {
|
||||
|
||||
m_fxItemNode.anchors().removeAnchor(AnchorLine::Right);
|
||||
m_fxItemNode.anchors().removeMargin(AnchorLine::Right);
|
||||
|
||||
if (qFuzzyCompare(m_fxItemNode.instanceSize().width(), 0.0) && m_fxItemNode.modelNode().hasAuxiliaryData(auxDataString + "width"))
|
||||
m_fxItemNode.setVariantProperty("width", m_fxItemNode.modelNode().auxiliaryData(auxDataString + "width"));
|
||||
}
|
||||
|
||||
void QmlAnchorBindingProxy::setVerticalCentered(bool centered)
|
||||
@@ -487,6 +513,8 @@ void QmlAnchorBindingProxy::setVerticalCentered(bool centered)
|
||||
if (verticalCentered() == centered)
|
||||
return;
|
||||
|
||||
m_locked = true;
|
||||
|
||||
RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
|
||||
|
||||
if (!centered) {
|
||||
@@ -495,6 +523,9 @@ void QmlAnchorBindingProxy::setVerticalCentered(bool centered)
|
||||
} else {
|
||||
m_fxItemNode.anchors().setAnchor(AnchorLine::VerticalCenter, m_fxItemNode.modelNode().parentProperty().parentModelNode(), AnchorLine::VerticalCenter);
|
||||
}
|
||||
|
||||
m_locked = false;
|
||||
|
||||
emit centeredVChanged();
|
||||
}
|
||||
|
||||
@@ -506,6 +537,8 @@ void QmlAnchorBindingProxy::setHorizontalCentered(bool centered)
|
||||
if (horizontalCentered() == centered)
|
||||
return;
|
||||
|
||||
m_locked = true;
|
||||
|
||||
RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
|
||||
|
||||
if (!centered) {
|
||||
@@ -514,6 +547,9 @@ void QmlAnchorBindingProxy::setHorizontalCentered(bool centered)
|
||||
} else {
|
||||
m_fxItemNode.anchors().setAnchor(AnchorLine::HorizontalCenter, m_fxItemNode.modelNode().parentProperty().parentModelNode(), AnchorLine::HorizontalCenter);
|
||||
}
|
||||
|
||||
m_locked = false;
|
||||
|
||||
emit centeredHChanged();
|
||||
}
|
||||
|
||||
@@ -532,6 +568,15 @@ void QmlAnchorBindingProxy::fill()
|
||||
|
||||
RewriterTransaction transaction = m_fxItemNode.modelNode().view()->beginRewriterTransaction();
|
||||
|
||||
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "x", m_fxItemNode.instancePosition().x());
|
||||
m_fxItemNode.removeVariantProperty("x");
|
||||
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "y", m_fxItemNode.instancePosition().y());
|
||||
m_fxItemNode.removeVariantProperty("y");
|
||||
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "width", m_fxItemNode.instanceSize().width());
|
||||
m_fxItemNode.removeVariantProperty("width");
|
||||
m_fxItemNode.modelNode().setAuxiliaryData(auxDataString + "height", m_fxItemNode.instanceSize().height());
|
||||
m_fxItemNode.removeVariantProperty("height");
|
||||
|
||||
m_fxItemNode.anchors().fill();
|
||||
|
||||
setHorizontalCentered(false);
|
||||
@@ -542,11 +587,6 @@ void QmlAnchorBindingProxy::fill()
|
||||
m_fxItemNode.anchors().removeMargin(AnchorLine::Top);
|
||||
m_fxItemNode.anchors().removeMargin(AnchorLine::Bottom);
|
||||
|
||||
m_fxItemNode.removeVariantProperty("x");
|
||||
m_fxItemNode.removeVariantProperty("y");
|
||||
m_fxItemNode.removeVariantProperty("width");
|
||||
m_fxItemNode.removeVariantProperty("height");
|
||||
|
||||
emit topAnchorChanged();
|
||||
emit bottomAnchorChanged();
|
||||
emit leftAnchorChanged();
|
||||
|
||||
@@ -103,6 +103,7 @@ public:
|
||||
|
||||
protected:
|
||||
QmlItemNode qmlItemNode() const;
|
||||
void beautify();
|
||||
|
||||
private:
|
||||
QmlItemNode m_qmlItemNode;
|
||||
|
||||
@@ -101,7 +101,7 @@ void ModelToTextMerger::propertiesChanged(const QList<AbstractProperty>& propert
|
||||
|
||||
schedule(new AddPropertyRewriteAction(property,
|
||||
propertyTextValue,
|
||||
propertyType(property),
|
||||
propertyType(property, propertyTextValue),
|
||||
containedModelNode));
|
||||
break;
|
||||
|
||||
@@ -111,7 +111,7 @@ void ModelToTextMerger::propertiesChanged(const QList<AbstractProperty>& propert
|
||||
|
||||
schedule(new ChangePropertyRewriteAction(property,
|
||||
propertyTextValue,
|
||||
propertyType(property),
|
||||
propertyType(property, propertyTextValue),
|
||||
containedModelNode));
|
||||
break;
|
||||
|
||||
@@ -149,7 +149,10 @@ void ModelToTextMerger::removeImport(const Import &import)
|
||||
void ModelToTextMerger::nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange)
|
||||
{
|
||||
if (isInHierarchy(oldPropertyParent) && isInHierarchy(newPropertyParent)) { // the node is moved
|
||||
schedule(new ReparentNodeRewriteAction(node, oldPropertyParent.parentModelNode(), newPropertyParent, propertyType(newPropertyParent)));
|
||||
schedule(new ReparentNodeRewriteAction(node,
|
||||
oldPropertyParent.parentModelNode(),
|
||||
newPropertyParent,
|
||||
propertyType(newPropertyParent)));
|
||||
} else if (isInHierarchy(oldPropertyParent) && !isInHierarchy(newPropertyParent)) { // the node is removed from hierarchy
|
||||
if (oldPropertyParent.isNodeProperty()) {
|
||||
// ignore, the subsequent remove property will take care of all
|
||||
@@ -165,11 +168,17 @@ void ModelToTextMerger::nodeReparented(const ModelNode &node, const NodeAbstract
|
||||
} else if (!isInHierarchy(oldPropertyParent) && isInHierarchy(newPropertyParent)) { // the node is inserted into to hierarchy
|
||||
switch (propertyChange) {
|
||||
case AbstractView::PropertiesAdded:
|
||||
schedule(new AddPropertyRewriteAction(newPropertyParent, QmlTextGenerator(getPropertyOrder())(node), propertyType(newPropertyParent), node));
|
||||
schedule(new AddPropertyRewriteAction(newPropertyParent,
|
||||
QmlTextGenerator(getPropertyOrder())(node),
|
||||
propertyType(newPropertyParent),
|
||||
node));
|
||||
break;
|
||||
|
||||
case AbstractView::NoAdditionalChanges:
|
||||
schedule(new ChangePropertyRewriteAction(newPropertyParent, QmlTextGenerator(getPropertyOrder())(node), propertyType(newPropertyParent), node));
|
||||
schedule(new ChangePropertyRewriteAction(newPropertyParent,
|
||||
QmlTextGenerator(getPropertyOrder())(node),
|
||||
propertyType(newPropertyParent),
|
||||
node));
|
||||
break;
|
||||
|
||||
case AbstractView::EmptyPropertiesRemoved:
|
||||
@@ -307,11 +316,18 @@ void ModelToTextMerger::schedule(RewriteAction *action)
|
||||
m_rewriteActions.append(action);
|
||||
}
|
||||
|
||||
QmlDesigner::QmlRefactoring::PropertyType ModelToTextMerger::propertyType(const AbstractProperty &property)
|
||||
QmlDesigner::QmlRefactoring::PropertyType ModelToTextMerger::propertyType(const AbstractProperty &property, const QString &textValue)
|
||||
{
|
||||
if (property.isBindingProperty())
|
||||
if (property.isBindingProperty()) {
|
||||
QString val = textValue.trimmed();
|
||||
if (val.isEmpty())
|
||||
return QmlDesigner::QmlRefactoring::ObjectBinding;
|
||||
else if (property.isNodeListProperty())
|
||||
const QChar lastChar = val.at(val.size() - 1);
|
||||
if (lastChar == '}' || lastChar == ';')
|
||||
return QmlDesigner::QmlRefactoring::ObjectBinding;
|
||||
else
|
||||
return QmlDesigner::QmlRefactoring::ScriptBinding;
|
||||
} else if (property.isNodeListProperty())
|
||||
return QmlDesigner::QmlRefactoring::ArrayBinding;
|
||||
else if (property.isNodeProperty())
|
||||
return QmlDesigner::QmlRefactoring::ObjectBinding;
|
||||
|
||||
@@ -89,7 +89,7 @@ protected:
|
||||
QList<RewriteAction *> scheduledRewriteActions() const
|
||||
{ return m_rewriteActions; }
|
||||
|
||||
static QmlDesigner::QmlRefactoring::PropertyType propertyType(const AbstractProperty &property);
|
||||
static QmlDesigner::QmlRefactoring::PropertyType propertyType(const AbstractProperty &property, const QString &textValue = QString());
|
||||
static QStringList getPropertyOrder();
|
||||
|
||||
static bool isInHierarchy(const AbstractProperty &property);
|
||||
|
||||
@@ -130,6 +130,52 @@ bool QmlAnchors::isValid() const
|
||||
return m_qmlItemNode.isValid();
|
||||
}
|
||||
|
||||
void QmlAnchors::beautify()
|
||||
{
|
||||
|
||||
if ((instanceHasAnchor(AnchorLine::Left) &&
|
||||
instanceHasAnchor(AnchorLine::Right) &&
|
||||
instanceHasAnchor(AnchorLine::Top) &&
|
||||
instanceHasAnchor(AnchorLine::Bottom)) &&
|
||||
|
||||
(instanceAnchor(AnchorLine::Left).type() == AnchorLine::Left &&
|
||||
instanceAnchor(AnchorLine::Right).type() == AnchorLine::Right &&
|
||||
instanceAnchor(AnchorLine::Top).type() == AnchorLine::Top &&
|
||||
instanceAnchor(AnchorLine::Bottom).type() == AnchorLine::Bottom) &&
|
||||
|
||||
(instanceAnchor(AnchorLine::Left).qmlItemNode() ==
|
||||
instanceAnchor(AnchorLine::Right).qmlItemNode() &&
|
||||
instanceAnchor(AnchorLine::Top).qmlItemNode() ==
|
||||
instanceAnchor(AnchorLine::Bottom).qmlItemNode()) &&
|
||||
(instanceAnchor(AnchorLine::Left).qmlItemNode() ==
|
||||
instanceAnchor(AnchorLine::Bottom).qmlItemNode())) {
|
||||
|
||||
if (instanceHasAnchor(AnchorLine::Fill))
|
||||
return; //avoid recursion
|
||||
|
||||
QmlItemNode targetNode(instanceAnchor(AnchorLine::Left).qmlItemNode());
|
||||
removeAnchors();
|
||||
setAnchor(AnchorLine::Fill, targetNode, AnchorLine::Fill);
|
||||
}
|
||||
|
||||
if ((instanceHasAnchor(AnchorLine::VerticalCenter) &&
|
||||
instanceHasAnchor(AnchorLine::HorizontalCenter)) &&
|
||||
|
||||
(instanceAnchor(AnchorLine::VerticalCenter).type() == AnchorLine::VerticalCenter &&
|
||||
instanceAnchor(AnchorLine::HorizontalCenter).type() == AnchorLine::HorizontalCenter) &&
|
||||
|
||||
(instanceAnchor(AnchorLine::VerticalCenter).qmlItemNode() ==
|
||||
instanceAnchor(AnchorLine::HorizontalCenter).qmlItemNode())) {
|
||||
|
||||
if (instanceHasAnchor(AnchorLine::Center))
|
||||
return; //avoid recursion
|
||||
|
||||
QmlItemNode targetNode(instanceAnchor(AnchorLine::VerticalCenter).qmlItemNode());
|
||||
removeAnchors();
|
||||
setAnchor(AnchorLine::Center, targetNode, AnchorLine::Center);
|
||||
}
|
||||
}
|
||||
|
||||
void QmlAnchors::setAnchor(AnchorLine::Type sourceAnchorLine,
|
||||
const QmlItemNode &targetQmlItemNode,
|
||||
AnchorLine::Type targetAnchorLine)
|
||||
@@ -145,9 +191,11 @@ void QmlAnchors::setAnchor(AnchorLine::Type sourceAnchorLine,
|
||||
QString targetExpression = targetQmlItemNode.modelNode().validId();
|
||||
if (targetQmlItemNode.modelNode() == qmlItemNode().modelNode().parentProperty().parentModelNode())
|
||||
targetExpression = "parent";
|
||||
if (sourceAnchorLine != AnchorLine::Center && sourceAnchorLine != AnchorLine::Fill)
|
||||
targetExpression = targetExpression + QLatin1Char('.') + lineTypeToString(targetAnchorLine);
|
||||
qmlItemNode().modelNode().bindingProperty(propertyName).setExpression(targetExpression);
|
||||
}
|
||||
beautify();
|
||||
}
|
||||
|
||||
bool detectHorizontalCycle(const ModelNode &node, QList<ModelNode> knownNodeList)
|
||||
|
||||
@@ -67,6 +67,7 @@ void RewriteActionCompressor::operator()(QList<RewriteAction *> &actions) const
|
||||
|
||||
void RewriteActionCompressor::compressImports(QList<RewriteAction *> &actions) const
|
||||
{
|
||||
QList<RewriteAction *> actionsToRemove;
|
||||
QHash<Import, RewriteAction *> addedImports;
|
||||
QHash<Import, RewriteAction *> removedImports;
|
||||
|
||||
@@ -78,36 +79,42 @@ void RewriteActionCompressor::compressImports(QList<RewriteAction *> &actions) c
|
||||
if (RemoveImportRewriteAction *removeImportAction = action->asRemoveImportRewriteAction()) {
|
||||
const Import import = removeImportAction->import();
|
||||
if (removedImports.contains(import)) {
|
||||
remove(iter);
|
||||
actionsToRemove.append(action);
|
||||
} else if (RewriteAction *addImportAction = addedImports.value(import, 0)) {
|
||||
actions.removeOne(addImportAction);
|
||||
actionsToRemove.append(action);
|
||||
actionsToRemove.append(addImportAction);
|
||||
addedImports.remove(import);
|
||||
delete addImportAction;
|
||||
remove(iter);
|
||||
} else {
|
||||
removedImports.insert(import, action);
|
||||
}
|
||||
} else if (AddImportRewriteAction *addImportAction = action->asAddImportRewriteAction()) {
|
||||
const Import import = addImportAction->import();
|
||||
if (RewriteAction *duplicateAction = addedImports.value(import, 0)) {
|
||||
actions.removeOne(duplicateAction);
|
||||
actionsToRemove.append(duplicateAction);
|
||||
addedImports.remove(import);
|
||||
delete duplicateAction;
|
||||
addedImports.insert(import, action);
|
||||
} else if (RewriteAction *removeAction = removedImports.value(import, 0)) {
|
||||
actions.removeOne(removeAction);
|
||||
actionsToRemove.append(action);
|
||||
actionsToRemove.append(removeAction);
|
||||
removedImports.remove(import);
|
||||
delete removeAction;
|
||||
remove(iter);
|
||||
} else {
|
||||
addedImports.insert(import, action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (RewriteAction *action, actionsToRemove) {
|
||||
actions.removeOne(action);
|
||||
delete action;
|
||||
}
|
||||
}
|
||||
|
||||
void RewriteActionCompressor::compressRereparentActions(QList<RewriteAction *> &actions) const
|
||||
{
|
||||
QList<RewriteAction *> actionsToRemove;
|
||||
QHash<ModelNode, ReparentNodeRewriteAction *> reparentedNodes;
|
||||
|
||||
QMutableListIterator<RewriteAction*> iter(actions);
|
||||
@@ -120,16 +127,22 @@ void RewriteActionCompressor::compressRereparentActions(QList<RewriteAction *> &
|
||||
|
||||
if (ReparentNodeRewriteAction *otherAction = reparentedNodes.value(reparentedNode, 0)) {
|
||||
otherAction->setOldParent(reparentAction->oldParent());
|
||||
remove(iter);
|
||||
actionsToRemove.append(action);
|
||||
} else {
|
||||
reparentedNodes.insert(reparentedNode, reparentAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (RewriteAction *action, actionsToRemove) {
|
||||
actions.removeOne(action);
|
||||
delete action;
|
||||
}
|
||||
}
|
||||
|
||||
void RewriteActionCompressor::compressReparentIntoSameParentActions(QList<RewriteAction *> &actions) const
|
||||
{
|
||||
QList<RewriteAction *> actionsToRemove;
|
||||
QMutableListIterator<RewriteAction *> iter(actions);
|
||||
iter.toBack();
|
||||
while (iter.hasPrevious()) {
|
||||
@@ -139,15 +152,20 @@ void RewriteActionCompressor::compressReparentIntoSameParentActions(QList<Rewrit
|
||||
const ModelNode targetNode = reparentAction->targetProperty().parentModelNode();
|
||||
const ModelNode oldParent = reparentAction->oldParent();
|
||||
if (targetNode == oldParent)
|
||||
remove(iter);
|
||||
actionsToRemove.append(action);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (RewriteAction *action, actionsToRemove) {
|
||||
actions.removeOne(action);
|
||||
delete action;
|
||||
}
|
||||
}
|
||||
|
||||
void RewriteActionCompressor::compressAddEditRemoveNodeActions(QList<RewriteAction *> &actions) const
|
||||
{
|
||||
QList<RewriteAction *> actionsToRemove;
|
||||
QHash<ModelNode, RewriteAction *> removedNodes;
|
||||
QSet<RewriteAction *> removeActionsToRemove;
|
||||
|
||||
QMutableListIterator<RewriteAction*> iter(actions);
|
||||
iter.toBack();
|
||||
@@ -158,7 +176,7 @@ void RewriteActionCompressor::compressAddEditRemoveNodeActions(QList<RewriteActi
|
||||
const ModelNode modelNode = removeNodeAction->node();
|
||||
|
||||
if (removedNodes.contains(modelNode))
|
||||
remove(iter);
|
||||
actionsToRemove.append(action);
|
||||
else
|
||||
removedNodes.insert(modelNode, action);
|
||||
} else if (action->asAddPropertyRewriteAction() || action->asChangePropertyRewriteAction()) {
|
||||
@@ -172,30 +190,30 @@ void RewriteActionCompressor::compressAddEditRemoveNodeActions(QList<RewriteActi
|
||||
containedModelNode = action->asChangePropertyRewriteAction()->containedModelNode();
|
||||
}
|
||||
|
||||
if (removedNodes.contains(property.parentModelNode()))
|
||||
remove(iter);
|
||||
else if (removedNodes.contains(containedModelNode)) {
|
||||
remove(iter);
|
||||
removeActionsToRemove.insert(removedNodes[containedModelNode]);
|
||||
if (removedNodes.contains(property.parentModelNode())) {
|
||||
actionsToRemove.append(action);
|
||||
} else if (RewriteAction *removeAction = removedNodes.value(containedModelNode, 0)) {
|
||||
actionsToRemove.append(action);
|
||||
actionsToRemove.append(removeAction);
|
||||
}
|
||||
} else if (RemovePropertyRewriteAction *removePropertyAction = action->asRemovePropertyRewriteAction()) {
|
||||
const AbstractProperty property = removePropertyAction->property();
|
||||
|
||||
if (removedNodes.contains(property.parentModelNode()))
|
||||
remove(iter);
|
||||
actionsToRemove.append(action);
|
||||
} else if (ChangeIdRewriteAction *changeIdAction = action->asChangeIdRewriteAction()) {
|
||||
if (removedNodes.contains(changeIdAction->node()))
|
||||
remove(iter);
|
||||
actionsToRemove.append(action);
|
||||
} else if (ChangeTypeRewriteAction *changeTypeAction = action->asChangeTypeRewriteAction()) {
|
||||
if (removedNodes.contains(changeTypeAction->node()))
|
||||
remove(iter);
|
||||
actionsToRemove.append(action);
|
||||
} else if (ReparentNodeRewriteAction *reparentAction = action->asReparentNodeRewriteAction()) {
|
||||
if (removedNodes.contains(reparentAction->reparentedNode()))
|
||||
remove(iter);
|
||||
actionsToRemove.append(action);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (RewriteAction *action, removeActionsToRemove) {
|
||||
foreach (RewriteAction *action, actionsToRemove) {
|
||||
actions.removeOne(action);
|
||||
delete action;
|
||||
}
|
||||
@@ -203,6 +221,7 @@ void RewriteActionCompressor::compressAddEditRemoveNodeActions(QList<RewriteActi
|
||||
|
||||
void RewriteActionCompressor::compressPropertyActions(QList<RewriteAction *> &actions) const
|
||||
{
|
||||
QList<RewriteAction *> actionsToRemove;
|
||||
QHash<AbstractProperty, RewriteAction *> removedProperties;
|
||||
QHash<AbstractProperty, ChangePropertyRewriteAction *> changedProperties;
|
||||
QSet<AbstractProperty> addedProperties;
|
||||
@@ -218,10 +237,10 @@ void RewriteActionCompressor::compressPropertyActions(QList<RewriteAction *> &ac
|
||||
const AbstractProperty property = changeAction->property();
|
||||
|
||||
if (removedProperties.contains(property)) {
|
||||
remove(iter);
|
||||
actionsToRemove.append(action);
|
||||
} else if (changedProperties.contains(property)) {
|
||||
if (!property.isValid() || !property.isDefaultProperty())
|
||||
remove(iter);
|
||||
actionsToRemove.append(action);
|
||||
} else {
|
||||
changedProperties.insert(property, changeAction);
|
||||
}
|
||||
@@ -229,10 +248,9 @@ void RewriteActionCompressor::compressPropertyActions(QList<RewriteAction *> &ac
|
||||
const AbstractProperty property = addAction->property();
|
||||
|
||||
if (RewriteAction *removeAction = removedProperties.value(property, 0)) {
|
||||
actions.removeOne(removeAction);
|
||||
actionsToRemove.append(action);
|
||||
actionsToRemove.append(removeAction);
|
||||
removedProperties.remove(property);
|
||||
delete removeAction;
|
||||
remove(iter);
|
||||
} else {
|
||||
if (changedProperties.contains(property))
|
||||
changedProperties.remove(property);
|
||||
@@ -241,10 +259,16 @@ void RewriteActionCompressor::compressPropertyActions(QList<RewriteAction *> &ac
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (RewriteAction *action, actionsToRemove){
|
||||
actions.removeOne(action);
|
||||
delete action;
|
||||
}
|
||||
}
|
||||
|
||||
void RewriteActionCompressor::compressAddEditActions(QList<RewriteAction *> &actions) const
|
||||
{
|
||||
QList<RewriteAction *> actionsToRemove;
|
||||
QSet<ModelNode> addedNodes;
|
||||
QSet<RewriteAction *> dirtyActions;
|
||||
|
||||
@@ -265,7 +289,7 @@ void RewriteActionCompressor::compressAddEditActions(QList<RewriteAction *> &act
|
||||
}
|
||||
|
||||
if (property.isValid() && addedNodes.contains(property.parentModelNode())) {
|
||||
remove(iter);
|
||||
actionsToRemove.append(action);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -273,22 +297,27 @@ void RewriteActionCompressor::compressAddEditActions(QList<RewriteAction *> &act
|
||||
continue;
|
||||
|
||||
if (nodeOrParentInSet(containedNode, addedNodes)) {
|
||||
remove(iter);
|
||||
actionsToRemove.append(action);
|
||||
} else {
|
||||
addedNodes.insert(containedNode);
|
||||
dirtyActions.insert(action);
|
||||
}
|
||||
} else if (ChangeIdRewriteAction *changeIdAction = action->asChangeIdRewriteAction()) {
|
||||
if (nodeOrParentInSet(changeIdAction->node(), addedNodes)) {
|
||||
remove(iter);
|
||||
actionsToRemove.append(action);
|
||||
}
|
||||
} else if (ChangeTypeRewriteAction *changeTypeAction = action->asChangeTypeRewriteAction()) {
|
||||
if (nodeOrParentInSet(changeTypeAction->node(), addedNodes)) {
|
||||
remove(iter);
|
||||
actionsToRemove.append(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (RewriteAction *action, actionsToRemove){
|
||||
actions.removeOne(action);
|
||||
delete action;
|
||||
}
|
||||
|
||||
QmlTextGenerator gen(m_propertyOrder);
|
||||
foreach (RewriteAction *action, dirtyActions) {
|
||||
RewriteAction *newAction = 0;
|
||||
@@ -313,6 +342,7 @@ void RewriteActionCompressor::compressAddEditActions(QList<RewriteAction *> &act
|
||||
|
||||
void RewriteActionCompressor::compressAddReparentActions(QList<RewriteAction *> &actions) const
|
||||
{
|
||||
QList<RewriteAction *> actionsToRemove;
|
||||
QMap<ModelNode, RewriteAction*> addedNodes;
|
||||
|
||||
QMutableListIterator<RewriteAction*> iter(actions);
|
||||
@@ -335,7 +365,7 @@ void RewriteActionCompressor::compressAddReparentActions(QList<RewriteAction *>
|
||||
} else if (ReparentNodeRewriteAction *reparentAction = action->asReparentNodeRewriteAction()) {
|
||||
if (addedNodes.contains(reparentAction->reparentedNode())) {
|
||||
RewriteAction *previousAction = addedNodes[reparentAction->reparentedNode()];
|
||||
actions.removeOne(previousAction);
|
||||
actionsToRemove.append(previousAction);
|
||||
|
||||
RewriteAction *replacementAction = 0;
|
||||
if (AddPropertyRewriteAction *addAction = previousAction->asAddPropertyRewriteAction()) {
|
||||
@@ -351,15 +381,13 @@ void RewriteActionCompressor::compressAddReparentActions(QList<RewriteAction *>
|
||||
}
|
||||
|
||||
iter.setValue(replacementAction);
|
||||
delete previousAction;
|
||||
delete action;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RewriteActionCompressor::remove(QMutableListIterator<RewriteAction*> &iter) const
|
||||
{
|
||||
delete iter.value();
|
||||
iter.remove();
|
||||
foreach (RewriteAction *action, actionsToRemove){
|
||||
actions.removeOne(action);
|
||||
delete action;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,8 +54,6 @@ private:
|
||||
void compressAddEditActions(QList<RewriteAction *> &actions) const;
|
||||
void compressAddReparentActions(QList<RewriteAction *> &actions) const;
|
||||
|
||||
void remove(QMutableListIterator<RewriteAction*> &iter) const;
|
||||
|
||||
private:
|
||||
QStringList m_propertyOrder;
|
||||
};
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QStringBuilder>
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QXmlStreamReader>
|
||||
#include <QtGui/QDialogButtonBox>
|
||||
@@ -94,6 +95,7 @@ GettingStartedWelcomePageWidget::GettingStartedWelcomePageWidget(QWidget *parent
|
||||
QIcon::fromTheme("document-new", ui->createNewProjectButton->icon()));
|
||||
ui->openProjectButton->setIcon(
|
||||
QIcon::fromTheme("document-open", ui->openProjectButton->icon()));
|
||||
QTimer::singleShot(0, this, SLOT(slotSetPrivateQmlExamples()));
|
||||
}
|
||||
|
||||
GettingStartedWelcomePageWidget::~GettingStartedWelcomePageWidget()
|
||||
@@ -101,6 +103,14 @@ GettingStartedWelcomePageWidget::~GettingStartedWelcomePageWidget()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void GettingStartedWelcomePageWidget::slotSetPrivateQmlExamples()
|
||||
{
|
||||
if (!ui->qmlExamplesButton->menu()) {
|
||||
const QString resPath = Core::ICore::instance()->resourcePath();
|
||||
updateQmlExamples(resPath, resPath);
|
||||
}
|
||||
}
|
||||
|
||||
void GettingStartedWelcomePageWidget::updateCppExamples(const QString &examplePath,
|
||||
const QString &sourcePath,
|
||||
const QString &demoXml)
|
||||
|
||||
@@ -58,6 +58,7 @@ private slots:
|
||||
void slotNextTip();
|
||||
void slotPrevTip();
|
||||
void slotCreateNewProject();
|
||||
void slotSetPrivateQmlExamples();
|
||||
|
||||
private:
|
||||
QStringList tipsOfTheDay();
|
||||
@@ -66,7 +67,6 @@ private:
|
||||
const QString &demoXml);
|
||||
void updateQmlExamples(const QString &examplePath,
|
||||
const QString &sourcePath);
|
||||
|
||||
Ui::GettingStartedWelcomePageWidget *ui;
|
||||
int m_currentTip;
|
||||
};
|
||||
|
||||
@@ -102,8 +102,8 @@ MaemoSshRunner::MaemoSshRunner(const Core::SshServerInfo &server,
|
||||
bool MaemoSshRunner::runInternal()
|
||||
{
|
||||
createConnection();
|
||||
connect(m_connection.data(), SIGNAL(remoteOutputAvailable()),
|
||||
this, SLOT(handleRemoteOutput()));
|
||||
connect(m_connection.data(), SIGNAL(remoteOutput(QByteArray)),
|
||||
this, SLOT(handleRemoteOutput(QByteArray)));
|
||||
initState();
|
||||
if (!m_connection->start())
|
||||
return false;
|
||||
@@ -121,7 +121,7 @@ void MaemoSshRunner::initState()
|
||||
m_potentialEndMarkerPrefix.clear();
|
||||
}
|
||||
|
||||
void MaemoSshRunner::handleRemoteOutput()
|
||||
void MaemoSshRunner::handleRemoteOutput(const QByteArray &curOutput)
|
||||
{
|
||||
const QByteArray output
|
||||
= m_potentialEndMarkerPrefix + m_connection->waitForRemoteOutput(0);
|
||||
|
||||
@@ -96,7 +96,7 @@ signals:
|
||||
|
||||
private:
|
||||
virtual bool runInternal();
|
||||
Q_SLOT void handleRemoteOutput();
|
||||
Q_SLOT void handleRemoteOutput(const QByteArray &output);
|
||||
void initState();
|
||||
|
||||
static const QByteArray EndMarker;
|
||||
|
||||
@@ -228,23 +228,30 @@ void QtVersionManager::updateDocumentation()
|
||||
|
||||
void QtVersionManager::updateExamples()
|
||||
{
|
||||
QList<QtVersion *> versions;
|
||||
versions.append(m_versions);
|
||||
|
||||
QString examplesPath;
|
||||
QString demosPath;
|
||||
QtVersion *version = 0;
|
||||
QList<QtVersion*> candidates;
|
||||
|
||||
// try to find a version which has both, demos and examples
|
||||
foreach (version, versions) {
|
||||
if (version->hasExamples())
|
||||
examplesPath = version->examplesPath();
|
||||
if (version->hasDemos())
|
||||
demosPath = version->demosPath();
|
||||
if (!examplesPath.isEmpty() && !demosPath.isEmpty()) {
|
||||
emit updateExamples(examplesPath, demosPath, version->sourcePath());
|
||||
foreach (version, m_versions) {
|
||||
if (version->hasExamples() && version->hasDemos())
|
||||
candidates.append(version);
|
||||
}
|
||||
|
||||
// prefer versions with declarative examples
|
||||
foreach (version, candidates) {
|
||||
if (QDir(version->examplesPath()+"/declarative").exists()) {
|
||||
emit updateExamples(version->examplesPath(), version->demosPath(), version->sourcePath());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!candidates.isEmpty()) {
|
||||
version = candidates.first();
|
||||
emit updateExamples(version->examplesPath(), version->demosPath(), version->sourcePath());
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
int QtVersionManager::getUniqueId()
|
||||
|
||||
@@ -35,6 +35,9 @@
|
||||
#include "qt4projectmanagerconstants.h"
|
||||
#include "qt4target.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QHeaderView>
|
||||
#include <QtGui/QLabel>
|
||||
@@ -442,21 +445,26 @@ QPair<QIcon, QString> TargetSetupPage::reportIssues(Qt4ProjectManager::QtVersion
|
||||
if (m_proFilePath.isEmpty())
|
||||
return qMakePair(QIcon(), QString());
|
||||
|
||||
const ProjectExplorer::TaskWindow *taskWindow = ExtensionSystem::PluginManager::instance()
|
||||
->getObject<ProjectExplorer::TaskWindow>();
|
||||
QTC_ASSERT(taskWindow, return qMakePair(QIcon(), QString()));
|
||||
|
||||
QList<ProjectExplorer::Task> issues = version->reportIssues(m_proFilePath);
|
||||
|
||||
|
||||
QString text;
|
||||
QIcon icon;
|
||||
foreach (const ProjectExplorer::Task t, issues) {
|
||||
foreach (const ProjectExplorer::Task &t, issues) {
|
||||
if (!text.isEmpty())
|
||||
text.append(QLatin1String("<br>"));
|
||||
// set severity:
|
||||
QString severity;
|
||||
if (t.type == ProjectExplorer::Task::Error) {
|
||||
icon = t.icon();
|
||||
icon = taskWindow->taskTypeIcon(t.type);
|
||||
severity = tr("<b>Error:</b> ", "Severity is Task::Error");
|
||||
} else if (t.type == ProjectExplorer::Task::Warning) {
|
||||
if (icon.isNull())
|
||||
icon = t.icon();
|
||||
icon = taskWindow->taskTypeIcon(t.type);
|
||||
severity = tr("<b>Warning:</b> ", "Severity is Task::Warning");
|
||||
}
|
||||
text.append(severity + t.description);
|
||||
|
||||
@@ -425,7 +425,7 @@ void VCSBaseOutputWindow::appendData(const QByteArray &data)
|
||||
|
||||
void VCSBaseOutputWindow::appendDataSilently(const QByteArray &data)
|
||||
{
|
||||
append(QTextCodec::codecForLocale()->toUnicode(data));
|
||||
appendSilently(QTextCodec::codecForLocale()->toUnicode(data));
|
||||
}
|
||||
|
||||
VCSBaseOutputWindow *VCSBaseOutputWindow::instance()
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <QtGui/QScrollArea>
|
||||
#include <QtGui/QDesktopServices>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QtGui/QPainter>
|
||||
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QDebug>
|
||||
@@ -56,6 +57,24 @@ static const char currentPageSettingsKeyC[] = "General/WelcomeTab";
|
||||
|
||||
namespace Welcome {
|
||||
|
||||
// Helper class introduced to cache the scaled background image
|
||||
// so we avoid re-scaling for every repaint.
|
||||
class ImageWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
ImageWidget(const QPixmap &bg, QWidget *parent) : QWidget(parent), m_bg(bg) {}
|
||||
void paintEvent(QPaintEvent *e) {
|
||||
QPainter painter(this);
|
||||
if (m_stretch.size() != size())
|
||||
m_stretch = m_bg.scaled(size(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
painter.drawPixmap(rect(), m_stretch);
|
||||
QWidget::paintEvent(e);
|
||||
}
|
||||
private:
|
||||
QPixmap m_bg;
|
||||
QPixmap m_stretch;
|
||||
};
|
||||
|
||||
struct WelcomeModePrivate
|
||||
{
|
||||
typedef QMap<QToolButton*, QWidget*> ToolButtonWidgetMap;
|
||||
@@ -64,7 +83,7 @@ struct WelcomeModePrivate
|
||||
|
||||
QScrollArea *m_scrollArea;
|
||||
QWidget *m_widget;
|
||||
QWidget *m_welcomePage;
|
||||
ImageWidget *m_welcomePage;
|
||||
ToolButtonWidgetMap buttonMap;
|
||||
QHBoxLayout * buttonLayout;
|
||||
Ui::WelcomeMode ui;
|
||||
@@ -79,7 +98,7 @@ WelcomeMode::WelcomeMode() :
|
||||
l->setMargin(0);
|
||||
l->setSpacing(0);
|
||||
l->addWidget(new Utils::StyledBar(m_d->m_widget));
|
||||
m_d->m_welcomePage = new QWidget(m_d->m_widget);
|
||||
m_d->m_welcomePage = new ImageWidget(QPixmap(":/welcome/images/welcomebg.png"), m_d->m_widget);
|
||||
m_d->ui.setupUi(m_d->m_welcomePage);
|
||||
m_d->ui.helpUsLabel->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
m_d->ui.feedbackButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
|
||||
@@ -75,12 +75,6 @@ QToolButton:pressed, QPushButton:pressed{
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="gradientWidget" native="true">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">#gradientWidget {
|
||||
border-image: url(:/welcome/images/welcomebg.png) 0;
|
||||
}
|
||||
</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
|
||||
@@ -4,4 +4,4 @@ TARGET = qtcdebugger
|
||||
TEMPLATE = app
|
||||
SOURCES += main.cpp
|
||||
|
||||
DESTDIR=..\..\..\bin
|
||||
DESTDIR=../../../bin
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#define private public // Give us access to private 'backward' member of QMapNode.
|
||||
# include <QtCore/QMap>
|
||||
#undef private
|
||||
|
||||
#include "gdb/gdbmi.h"
|
||||
#include "tcf/json.h"
|
||||
#include "gdbmacros.h"
|
||||
@@ -1256,9 +1260,8 @@ template <typename T>
|
||||
const QString typeStr = stripPtrType(typeToString<T>());
|
||||
const QByteArray addrStr = valToString(curElem);
|
||||
if (curElem != 0) {
|
||||
expected.append("addr='").append(addrStr).append("',saddr='").
|
||||
append(addrStr).append("',type='").append(typeStr).
|
||||
append("',value='").
|
||||
expected.append("addr='").append(addrStr).append("',type='").
|
||||
append(typeStr).append("',value='").
|
||||
append(derefValToString(curElem)).append("'");
|
||||
} else {
|
||||
expected.append("addr='").append(ptrToBa(&curElem)).append("',type='").
|
||||
@@ -1426,9 +1429,9 @@ void tst_Debugger::dumpQList_int_star()
|
||||
ilist.append(0);
|
||||
testDumper("value='<2 items>',valueeditable='false',numchild='2',"
|
||||
"internal='1',childtype='int*',childnumchild='1',children=["
|
||||
"{saddr='" + str(&ilist.at(0)) + "',addr='" + str(deref(&ilist.at(0))) +
|
||||
"{addr='" + str(deref(&ilist.at(0))) +
|
||||
"',type='int',value='1'},"
|
||||
"{saddr='" + str(&ilist.at(1)) + "',value='<null>',numchild='0'}]",
|
||||
"{value='<null>',numchild='0'}]",
|
||||
&ilist, NS"QList", true, "int*");
|
||||
}
|
||||
|
||||
@@ -2327,15 +2330,13 @@ void tst_Debugger::dumpStdVector()
|
||||
vector.push_back(new std::list<int>(list));
|
||||
testDumper("value='<1 items>',valueeditable='false',numchild='1',"
|
||||
"childtype='" + inner + "',childnumchild='1',"
|
||||
"children=[{addr='" + str(deref(&vector[0])) + "',"
|
||||
"saddr='" + str(deref(&vector[0])) + "',type='" + innerp + "'}]",
|
||||
"children=[{addr='" + str(deref(&vector[0])) + "',type='" + innerp + "'}]",
|
||||
&vector, "std::vector", true, inner, "", sizeof(std::list<int> *));
|
||||
vector.push_back(0);
|
||||
list.push_back(45);
|
||||
testDumper("value='<2 items>',valueeditable='false',numchild='2',"
|
||||
"childtype='" + inner + "',childnumchild='1',"
|
||||
"children=[{addr='" + str(deref(&vector[0])) + "',"
|
||||
"saddr='" + str(deref(&vector[0])) + "',type='" + innerp + "'},"
|
||||
"children=[{addr='" + str(deref(&vector[0])) + "',type='" + innerp + "'},"
|
||||
"{addr='" + str(&vector[1]) + "',"
|
||||
"type='" + innerp + "',value='<null>',numchild='0'}]",
|
||||
&vector, "std::vector", true, inner, "", sizeof(std::list<int> *));
|
||||
|
||||
@@ -3343,6 +3343,117 @@ void TestCore::testSubComponentManager()
|
||||
QVERIFY(myButtonMetaInfo.property("border.width", true).isValid());
|
||||
}
|
||||
|
||||
void TestCore::testAnchorsAndRewriting()
|
||||
{
|
||||
const QString qmlString("import Qt 4.7\n"
|
||||
"Rectangle {\n"
|
||||
" id: root\n"
|
||||
" x: 10;\n"
|
||||
" y: 10;\n"
|
||||
" Rectangle {\n"
|
||||
" id: rectangle1\n"
|
||||
" x: 10;\n"
|
||||
" y: 10;\n"
|
||||
" }\n"
|
||||
" Component {\n"
|
||||
" id: rectangleComponent\n"
|
||||
" Rectangle {\n"
|
||||
" x: 100;\n"
|
||||
" y: 100;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}");
|
||||
|
||||
QPlainTextEdit textEdit;
|
||||
textEdit.setPlainText(qmlString);
|
||||
NotIndentingTextEditModifier textModifier(&textEdit);
|
||||
|
||||
QScopedPointer<Model> model(Model::create("Qt/Item", 4, 7));
|
||||
QVERIFY(model.data());
|
||||
|
||||
QScopedPointer<TestView> view(new TestView);
|
||||
model->attachView(view.data());
|
||||
|
||||
// read in
|
||||
QScopedPointer<TestRewriterView> testRewriterView(new TestRewriterView());
|
||||
testRewriterView->setTextModifier(&textModifier);
|
||||
model->attachView(testRewriterView.data());
|
||||
|
||||
ModelNode rootNode = view->rootModelNode();
|
||||
QVERIFY(rootNode.isValid());
|
||||
QCOMPARE(rootNode.type(), QLatin1String("Qt/Rectangle"));
|
||||
|
||||
QmlItemNode rootItemNode = view->rootQmlItemNode();
|
||||
QVERIFY(rootItemNode.isValid());
|
||||
|
||||
QmlItemNode childNode = rootItemNode.allDirectSubModelNodes().first();
|
||||
QVERIFY(childNode.isValid());
|
||||
|
||||
childNode.anchors().setMargin(AnchorLine::Left, 280);
|
||||
childNode.anchors().setAnchor(AnchorLine::Left, rootItemNode, AnchorLine::Left);
|
||||
childNode.anchors().setMargin(AnchorLine::Right, 200);
|
||||
childNode.anchors().setAnchor(AnchorLine::Right, rootItemNode, AnchorLine::Right);
|
||||
childNode.anchors().setMargin(AnchorLine::Bottom, 50);
|
||||
childNode.anchors().setAnchor(AnchorLine::Bottom, rootItemNode, AnchorLine::Bottom);
|
||||
|
||||
{
|
||||
RewriterTransaction transaction = view->beginRewriterTransaction();
|
||||
|
||||
childNode.anchors().setMargin(AnchorLine::Top, 100);
|
||||
childNode.anchors().setAnchor(AnchorLine::Top, rootItemNode, AnchorLine::Top);
|
||||
}
|
||||
}
|
||||
|
||||
void TestCore::testAnchorsAndRewritingCenter()
|
||||
{
|
||||
const QString qmlString("import Qt 4.7\n"
|
||||
"Rectangle {\n"
|
||||
" id: root\n"
|
||||
" x: 10;\n"
|
||||
" y: 10;\n"
|
||||
" Rectangle {\n"
|
||||
" id: rectangle1\n"
|
||||
" x: 10;\n"
|
||||
" y: 10;\n"
|
||||
" }\n"
|
||||
" Component {\n"
|
||||
" id: rectangleComponent\n"
|
||||
" Rectangle {\n"
|
||||
" x: 100;\n"
|
||||
" y: 100;\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}");
|
||||
|
||||
QPlainTextEdit textEdit;
|
||||
textEdit.setPlainText(qmlString);
|
||||
NotIndentingTextEditModifier textModifier(&textEdit);
|
||||
|
||||
QScopedPointer<Model> model(Model::create("Qt/Item", 4, 7));
|
||||
QVERIFY(model.data());
|
||||
|
||||
QScopedPointer<TestView> view(new TestView);
|
||||
model->attachView(view.data());
|
||||
|
||||
// read in
|
||||
QScopedPointer<TestRewriterView> testRewriterView(new TestRewriterView());
|
||||
testRewriterView->setTextModifier(&textModifier);
|
||||
model->attachView(testRewriterView.data());
|
||||
|
||||
ModelNode rootNode = view->rootModelNode();
|
||||
QVERIFY(rootNode.isValid());
|
||||
QCOMPARE(rootNode.type(), QLatin1String("Qt/Rectangle"));
|
||||
|
||||
QmlItemNode rootItemNode = view->rootQmlItemNode();
|
||||
QVERIFY(rootItemNode.isValid());
|
||||
|
||||
QmlItemNode childNode = rootItemNode.allDirectSubModelNodes().first();
|
||||
QVERIFY(childNode.isValid());
|
||||
|
||||
childNode.anchors().setAnchor(AnchorLine::VerticalCenter, rootItemNode, AnchorLine::VerticalCenter);
|
||||
childNode.anchors().setAnchor(AnchorLine::HorizontalCenter, rootItemNode, AnchorLine::HorizontalCenter);
|
||||
}
|
||||
|
||||
void TestCore::loadQml()
|
||||
{
|
||||
char qmlString[] = "import Qt 4.7\n"
|
||||
|
||||
@@ -164,6 +164,8 @@ private slots:
|
||||
void testCopyModelRewriter1();
|
||||
void testCopyModelRewriter2();
|
||||
void testSubComponentManager();
|
||||
void testAnchorsAndRewriting();
|
||||
void testAnchorsAndRewritingCenter();
|
||||
|
||||
//
|
||||
// regression tests
|
||||
|
||||
@@ -1652,6 +1652,17 @@ void testStuff()
|
||||
++*p;
|
||||
}
|
||||
|
||||
void testPassByReferenceHelper(Foo &f)
|
||||
{
|
||||
++f.a;
|
||||
}
|
||||
|
||||
void testPassByReference()
|
||||
{
|
||||
Foo f(12);
|
||||
testPassByReferenceHelper(f);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
testColor();
|
||||
@@ -1701,6 +1712,7 @@ int main(int argc, char *argv[])
|
||||
testStdString();
|
||||
testStdVector();
|
||||
|
||||
testPassByReference();
|
||||
testPlugin();
|
||||
testQList();
|
||||
testQLinkedList();
|
||||
|
||||
Reference in New Issue
Block a user