Commit e2f5a873 authored by Christiaan Janssen's avatar Christiaan Janssen
Browse files

QmlDesigner.PropertyEditor: fixing merge conflict

parents bbdceed3 c56b56be
......@@ -17,6 +17,7 @@ General
of Qt creator
* Added option to set interface language explicitly, overriding the locale
setting
* New "Design" mode for visual editors (.ui & .qml files)
Editing
* Text based search and replace in multiple files
......@@ -55,6 +56,13 @@ QML/JS Support
* Extended code navigation and completion
* Added initial semantic checks
* New qml based .qmlproject file format (replaces old format)
* New QmlDesigner
* Allows visual manipulation of .qml files
* Supports changing top-level states
* Integrates tighly with text editor, e.g. shared history, navigation facilities ...
Platform Specific
Mac
......
......@@ -1023,9 +1023,17 @@ class Dumper:
elif type.code == gdb.TYPE_CODE_PTR:
isHandled = False
#warn("A POINTER: %s" % value.type)
if self.useFancy:
isHandled = False
if str(type.strip_typedefs()).find("(") != -1:
self.putValue(str(item.value))
self.put('addr="%s",' % cleanAddress(value.address))
self.putType(item.value.type)
self.putNumChild(0)
isHandled = True
if (not isHandled) and self.useFancy:
if isNull(value):
self.putValue("0x0")
self.putType(item.value.type)
......
......@@ -8,14 +8,27 @@ QExtGroupBox {
property var backendColor
property var oldMaximumHeight;
property var startupCollapse: selectionChanged;
property var firstTime: true;
onFinishedChanged: {
oldMaximumHeight = maximumHeight;
visible = false;
visible = true;
if (finished)
collapsed = true;
//visible = false;
//visible = true;
//if (finished)
//collapsed = true;
}
onStartupCollapseChanged: {
oldMaximumHeight = maximumHeight;
if (!collapsed && firstTime) {
collapsed = true;
colorButton.checked = false;
firstTime = false;
}
}
property var baseStateFlag: isBaseState
onBaseStateFlagChanged: {
evaluate();
......@@ -70,7 +83,6 @@ QExtGroupBox {
ColorScheme { id:scheme; }
QWidget {
id: colorButtonWidget
height: 32
......@@ -89,6 +101,7 @@ QExtGroupBox {
}
ColorButton {
id: colorButton
color: colorGroupBox.backendColor.value;
checkable: true;
checked: false;
......
......@@ -16,8 +16,11 @@ QScrollArea {
bottomMargin: 0;
leftMargin: 0;
rightMargin: 0;
spacing: 0;
Modifiers {
spacing: 0;
WidgetLoader {
id: specificsOne;
source: specificsUrl;
}
QScrollArea {
......
......@@ -15,7 +15,7 @@ QFrame {
opacity: Behavior {
NumberAnimation {
easing: "easeInSine"
easing.type: "InSine"
duration: 200
}
}
......
......@@ -17,15 +17,10 @@ PropertyFrame {
Switches {
}
ExtendedSwitches {
id: extendedSwitches;
}
HorizontalWhiteLine {
}
ScrollArea {
styleSheetFile: ":/qmldesigner/scrollbar.css";
......@@ -55,16 +50,9 @@ PropertyFrame {
}
/*Modifiers {
}*/
WidgetLoader {
id: specificsOne;
source: specificsUrl;
}
Modifiers {
}
QScrollArea {
}
......
......@@ -35,31 +35,15 @@ GroupBox {
}
}
}
QWidget {
layout: HorizontalLayout {
Label {
text: "Alignment"
}
ComboBox {
baseStateFlag: isBaseState;
items : { ["AlignLeft", "AlignRight", "AlignHCenter"] }
backendValue: backendValues.horizontalAlignment;
currentText: backendValues.horizontalAlignment.value;
onItemsChanged: {
currentText = backendValues.horizontalAlignment.value;
}
}
ComboBox {
baseStateFlag: isBaseState;
items : { ["AlignTop", "AlignBottom", "AlignVCenter"] }
backendValue: backendValues.verticalAlignment;
currentText: backendValues.verticalAlignment.value;
onItemsChanged: {
currentText = backendValues.verticalAlignment.value;
}
}
AlignmentHorizontalButtons {}
AlignmentVerticalButtons {}
}
}
......
......@@ -39,7 +39,7 @@
#include <QtGui/QApplication>
#ifndef NO_DECLARATIVE_BACKEND
# include <QtDeclarative/private/qmlstringconverters_p.h> // ### remove me
# include <QtDeclarative/private/qdeclarativestringconverters_p.h> // ### remove me
#endif
namespace QmlJS {
......@@ -141,7 +141,7 @@ public:
#ifndef NO_DECLARATIVE_BACKEND
bool ok = false;
QmlStringConverters::colorFromString(colorString, &ok);
QDeclarativeStringConverters::colorFromString(colorString, &ok);
if (!ok)
_message.message = QCoreApplication::translate("QmlJS::Check", "not a valid color");
#endif
......
......@@ -36,12 +36,11 @@
#include <QtCore/QDebug>
#ifndef NO_DECLARATIVE_BACKEND
# include <QtDeclarative/QmlType>
# include <QtDeclarative/QmlMetaType>
# include <QtDeclarative/private/qmlgraphicsanchors_p.h> // ### remove me
# include <QtDeclarative/private/qmlgraphicsrectangle_p.h> // ### remove me
# include <QtDeclarative/private/qmlvaluetype_p.h> // ### remove me
# include <QtDeclarative/private/qmlanimation_p.h> // ### remove me
# include <QtDeclarative/private/qdeclarativemetatype_p.h>
# include <QtDeclarative/private/qdeclarativeanchors_p.h> // ### remove me
# include <QtDeclarative/private/qdeclarativerectangle_p.h> // ### remove me
# include <QtDeclarative/private/qdeclarativevaluetype_p.h> // ### remove me
# include <QtDeclarative/private/qdeclarativeanimation_p.h> // ### remove me
#endif
using namespace QmlJS::Interpreter;
......@@ -232,8 +231,8 @@ void QmlObjectValue::processMembers(MemberProcessor *processor) const
const Value *QmlObjectValue::propertyValue(const QMetaProperty &prop) const
{
if (QmlMetaType::isQObject(prop.userType())) {
QmlType *qmlPropertyType = QmlMetaType::qmlType(prop.userType());
if (QDeclarativeMetaType::isQObject(prop.userType())) {
QDeclarativeType *qmlPropertyType = QDeclarativeMetaType::qmlType(prop.userType());
if (qmlPropertyType && !qmlPropertyType->qmlTypeName().isEmpty()) {
QString typeName = qmlPropertyType->qmlTypeName();
......@@ -254,7 +253,7 @@ const Value *QmlObjectValue::propertyValue(const QMetaProperty &prop) const
typeName.replace(QLatin1Char('.'), QLatin1Char('/'));
if (const ObjectValue *objectValue = engine()->newQmlObject(typeName, "", -1, -1)) // ### we should extend this to lookup the property types in the QmlType object, instead of the QMetaProperty.
if (const ObjectValue *objectValue = engine()->newQmlObject(typeName, "", -1, -1)) // ### we should extend this to lookup the property types in the QDeclarativeType object, instead of the QMetaProperty.
return objectValue;
}
}
......@@ -335,11 +334,11 @@ const Value *QmlObjectValue::propertyValue(const QMetaProperty &prop) const
} // end of switch
const QString typeName = prop.typeName();
if (typeName == QLatin1String("QmlGraphicsAnchorLine")) {
if (typeName == QLatin1String("QDeclarativeAnchorLine")) {
value = engine()->anchorLineValue();
}
if (value->asStringValue() && prop.name() == QLatin1String("easing")
&& isDerivedFrom(&QmlPropertyAnimation::staticMetaObject)) {
&& isDerivedFrom(&QDeclarativePropertyAnimation::staticMetaObject)) {
value = engine()->easingCurveNameValue();
}
......@@ -2156,13 +2155,13 @@ const Value *Engine::defaultValueForBuiltinType(const QString &typeName) const
#ifndef NO_DECLARATIVE_BACKEND
QmlObjectValue *Engine::newQmlObject(const QString &name, const QString &prefix, int majorVersion, int minorVersion)
{
if (name == QLatin1String("QmlGraphicsAnchors")) {
QmlObjectValue *object = new QmlObjectValue(&QmlGraphicsAnchors::staticMetaObject, QLatin1String("Anchors"), -1, -1, this);
if (name == QLatin1String("QDeclarativeAnchors")) {
QmlObjectValue *object = new QmlObjectValue(&QDeclarativeAnchors::staticMetaObject, QLatin1String("Anchors"), -1, -1, this);
return object;
} else if (name == QLatin1String("QmlGraphicsPen")) {
QmlObjectValue *object = new QmlObjectValue(&QmlGraphicsPen::staticMetaObject, QLatin1String("Pen"), -1, -1, this);
} else if (name == QLatin1String("QDeclarativePen")) {
QmlObjectValue *object = new QmlObjectValue(&QDeclarativePen::staticMetaObject, QLatin1String("Pen"), -1, -1, this);
return object;
} else if (name == QLatin1String("QmlGraphicsScaleGrid")) {
} else if (name == QLatin1String("QDeclarativeScaleGrid")) {
QmlObjectValue *object = new QmlObjectValue(&QObject::staticMetaObject, QLatin1String("ScaleGrid"), -1, -1, this);
object->setProperty("left", numberValue());
object->setProperty("top", numberValue());
......@@ -2174,7 +2173,7 @@ QmlObjectValue *Engine::newQmlObject(const QString &name, const QString &prefix,
// ### TODO: add support for QML packages
const QString componentName = prefix + QLatin1Char('/') + name;
if (QmlType *qmlType = QmlMetaType::qmlType(componentName.toUtf8(), majorVersion, minorVersion)) {
if (QDeclarativeType *qmlType = QDeclarativeMetaType::qmlType(componentName.toUtf8(), majorVersion, minorVersion)) {
const QString typeName = qmlType->qmlTypeName();
const QString strippedTypeName = typeName.mid(typeName.lastIndexOf('/') + 1);
QmlObjectValue *object = new QmlObjectValue(qmlType->metaObject(), strippedTypeName, majorVersion, minorVersion, this);
......
......@@ -31,8 +31,7 @@
#include "qmljsmetatypesystem.h"
#ifndef NO_DECLARATIVE_BACKEND
#include <QtDeclarative/QmlType>
#include <QtDeclarative/QmlMetaType>
#include <QtDeclarative/private/qdeclarativemetatype_p.h>
#endif // NO_DECLARATIVE_BACKEND
using namespace QmlJS;
......@@ -43,7 +42,7 @@ void MetaTypeSystem::reload(Interpreter::Engine *interpreter)
_importedTypes.clear();
#ifndef NO_DECLARATIVE_BACKEND
foreach (QmlType *type, QmlMetaType::qmlTypes()) {
foreach (QDeclarativeType *type, QDeclarativeMetaType::qmlTypes()) {
const QString fqType = type->qmlTypeName();
const int sepIdx = fqType.lastIndexOf(QLatin1Char('/'));
QString typeName;
......
......@@ -121,7 +121,8 @@ NewClassWidget::NewClassWidget(QWidget *parent) :
connect(m_d->m_ui.generateFormCheckBox, SIGNAL(stateChanged(int)),
this, SLOT(slotFormInputChecked()));
connect(m_d->m_ui.baseClassComboBox, SIGNAL(editTextChanged(QString)),
this, SLOT(slotBaseClassEdited(QString)));
m_d->m_ui.generateFormCheckBox->setChecked(true);
setFormInputCheckable(false, true);
setClassType(NoClassType);
......@@ -393,6 +394,31 @@ void NewClassWidget::setClassTypeComboVisible(bool v)
m_d->m_ui.classTypeComboBox->setVisible(v);
}
// Guess suitable type information with some smartness
static inline NewClassWidget::ClassType classTypeForBaseClass(const QString &baseClass)
{
if (!baseClass.startsWith(QLatin1Char('Q')))
return NewClassWidget::NoClassType;
// QObject types: QObject as such and models.
if (baseClass == QLatin1String("QObject") ||
(baseClass.startsWith(QLatin1String("QAbstract")) && baseClass.endsWith(QLatin1String("Model"))))
return NewClassWidget::ClassInheritsQObject;
// Widgets.
if (baseClass == QLatin1String("QWidget") || baseClass == QLatin1String("QMainWindow")
|| baseClass == QLatin1String("QDialog"))
return NewClassWidget::ClassInheritsQWidget;
return NewClassWidget::NoClassType;
}
void NewClassWidget::slotBaseClassEdited(const QString &baseClass)
{
// Set type information with some smartness.
const ClassType currentClassType = classType();
const ClassType recommendedClassType = classTypeForBaseClass(baseClass);
if (recommendedClassType != NoClassType && currentClassType != recommendedClassType)
setClassType(recommendedClassType);
}
void NewClassWidget::slotValidChanged()
{
const bool newValid = isValid();
......
......@@ -156,6 +156,7 @@ private slots:
void slotActivated();
void classNameEdited();
void slotFormInputChecked();
void slotBaseClassEdited(const QString &);
private:
void setFormInputCheckable(bool checkable, bool force);
......
......@@ -69,7 +69,7 @@ QColor StyleHelper::mergedColors(const QColor &colorA, const QColor &colorB, int
qreal StyleHelper::sidebarFontSize()
{
#if defined(Q_WS_MAC)
return 9;
return 10;
#else
return 7.5;
#endif
......
......@@ -288,7 +288,7 @@ void SynchronousProcess::slotTimeout()
if (++m_d->m_hangTimerCount > m_d->m_maxHangTimerCount) {
if (debug)
qDebug() << Q_FUNC_INFO << "HANG detected, killing";
m_d->m_process.kill();
SynchronousProcess::stopProcess(m_d->m_process);
m_d->m_result.result = SynchronousProcessResponse::Hang;
} else {
if (debug)
......@@ -399,6 +399,43 @@ void SynchronousProcess::processStdErr(bool emitSignals)
}
}
// Static utilities: Keep running as long as it gets data.
bool SynchronousProcess::readDataFromProcess(QProcess &p, int timeOutMS,
QByteArray *stdOut, QByteArray *stdErr)
{
if (p.state() != QProcess::Running) {
qWarning("readDataFromProcess: Process in non-running state passed in.");
return false;
}
// Keep the process running until it has no longer has data
bool finished = false;
bool hasData = false;
do {
finished = p.waitForFinished(timeOutMS);
if ( (hasData = p.bytesAvailable()) ) {
const QByteArray newStdOut = p.readAllStandardOutput();
const QByteArray newStdErr = p.readAllStandardError();
if (stdOut)
stdOut->append(newStdOut);
if (stdErr)
stdErr->append(newStdErr);
}
} while (hasData && !finished);
return finished;
}
bool SynchronousProcess::stopProcess(QProcess &p)
{
if (p.state() != QProcess::Running)
return true;
p.terminate();
if (p.waitForFinished(300))
return true;
p.kill();
return p.waitForFinished(300);
}
// Path utilities
enum OS_Type { OS_Mac, OS_Windows, OS_Unix };
......
......@@ -82,7 +82,12 @@ QTCREATOR_UTILS_EXPORT QDebug operator<<(QDebug str, const SynchronousProcessRes
* The stdOutBuffered(), stdErrBuffered() signals are emitted with complete
* lines based on the '\n' marker if they are enabled using
* stdOutBufferedSignalsEnabled()/setStdErrBufferedSignalsEnabled().
* They would typically be used for log windows. */
* They would typically be used for log windows.
*
* There is a timeout handling that takes effect after the last data have been
* read from stdout/stdin (as opposed to waitForFinished(), which measures time
* since it was invoked). It is thus also suitable for slow processes that continously
* output data (like version system operations). */
class QTCREATOR_UTILS_EXPORT SynchronousProcess : public QObject
{
......@@ -91,7 +96,8 @@ public:
SynchronousProcess();
virtual ~SynchronousProcess();
/* Timeout for hanging processes (no reaction on stderr/stdout)*/
/* Timeout for hanging processes (triggers after no more output
* occurs on stderr/stdout). */
void setTimeout(int timeoutMS);
int timeout() const;
......@@ -118,6 +124,16 @@ public:
SynchronousProcessResponse run(const QString &binary, const QStringList &args);
// Static helper for running a process synchronously in the foreground with timeout
// detection similar SynchronousProcess' handling (taking effect after no more output
// occurs on stderr/stdout as opposed to waitForFinished()). Returns false if a timeout
// occurs. Checking of the process' exit state/code still has to be done.
static bool readDataFromProcess(QProcess &p, int timeOutMS,
QByteArray *stdOut = 0, QByteArray *stdErr = 0);
// Stop a process by first calling terminate() (allowing for signal handling) and
// then kill().
static bool stopProcess(QProcess &p);
// Helpers to find binaries. Do not use it for other path variables
// and file types.
static QString locateBinary(const QString &binary);
......
......@@ -109,7 +109,7 @@ QWidget *DesignMode::widget()
QString DesignMode::displayName() const
{
return tr(Constants::MODE_DESIGN);
return tr("Design");
}
QIcon DesignMode::icon() const
......@@ -186,10 +186,9 @@ void DesignMode::currentEditorChanged(Core::IEditor *editor)
if (!mimeEditorAvailable)
setEnabled(false);
if ((!mimeEditorAvailable && core->modeManager()->currentMode() == this)
|| !modeActivated)
if (!mimeEditorAvailable && core->modeManager()->currentMode() == this)
{
// switch back to edit mode
// switch back to edit mode - we don't want to be here
core->modeManager()->activateMode(Constants::MODE_EDIT);
}
......
......@@ -1047,10 +1047,11 @@ void EditorManager::addEditor(IEditor *editor, bool isDuplicate)
m_d->m_editorModel->addEditor(editor, isDuplicate);
if (!isDuplicate) {
m_d->m_core->fileManager()->addFile(editor->file());
if (!editor->isTemporary()) {
const bool isTemporary = editor->isTemporary();
const bool addWatcher = !isTemporary;
m_d->m_core->fileManager()->addFile(editor->file(), addWatcher);
if (!isTemporary)
m_d->m_core->fileManager()->addToRecentFiles(editor->file()->fileName());
}
}
emit editorOpened(editor);
}
......
......@@ -176,7 +176,7 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
painter.drawText(r, textFlags, ellidedBuildConfiguration);
QStyleOption opt;
opt.initFrom(this);
opt.rect = rect().adjusted(rect().width() - 18, 0, -10, 0);
opt.rect = rect().adjusted(rect().width() - 16, 0, -8, 0);
Utils::StyleHelper::drawArrow(QStyle::PE_IndicatorArrowRight, &painter, &opt);
}
......
......@@ -270,7 +270,7 @@ void FancyTabBar::paintTab(QPainter *painter, int tabIndex) const
boldFont.setPointSizeF(Utils::StyleHelper::sidebarFontSize());
boldFont.setBold(true);
painter->setFont(boldFont);
painter->setPen(selected ? QColor(255, 255, 255, 160) : QColor(30, 30, 30, 80));
painter->setPen(selected ? QColor(255, 255, 255, 160) : QColor(0, 0, 0, 110));
int textFlags = Qt::AlignCenter | Qt::AlignBottom | Qt::ElideRight | Qt::TextWordWrap;
if (enabled) {
painter->drawText(tabTextRect, textFlags, tabText);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment