Commit 4e2937bf authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

Merge remote-tracking branch 'origin/2.2'

Conflicts:
	src/plugins/debugger/debuggersourcepathmappingwidget.cpp
parents f67e9a54 b756d30c
......@@ -12,6 +12,8 @@ General
* Moved toolchain definitions out of Qt versions.
* You can now define toolchains in Tools->Options->ToolChains
* Creator now supports more than one instance of each kind of toolchain
* Support for MIME type customization through editing of patterns and
magic matchers.
Editing
* Add new Inkpot color scheme
......@@ -23,6 +25,8 @@ Editing
- code completion
* Add 'expand/collapse all' context menu entry to Outline pane
* Support for user defined macros was contributed by Nicolas Arnaud-Cormos
* Snippet editor with syntax highlighting, indentation, and basic auto
completion for C++ and QML.
Project Support
* QMake project support should be more robust against syntax errors
......@@ -36,6 +40,7 @@ Project Support
* CMake: Add Ui completion, changes in .ui files are picked up without
a rebuild.
* Syntax highlighting and completion for QMake project files
* Text editor behavior settings now avaiable on a per-project basis.
Debugging
* Rewrote debugging engine using the Microsoft Console Debugger (CDB)
......@@ -89,7 +94,6 @@ C++ Support
* Fix indentation of labels
* Highlighting for virtual functions
* Navigate to correct overloaded function/method
* Snippets for class/struct/loops
QML/JS Support
* Add wizard for creating JavaScript files, QTCREATORBUG-3070
......
......@@ -977,7 +977,7 @@
Otherwise, instantiate a QDataStream object, \c in, set its version as
above and read the serialized data into hte \c contacts data structure. The
\c contacs object is emptied before data is read into it to simplify the
\c contacts object is emptied before data is read into it to simplify the
file reading process. A more advanced method would be to read the contacts
into a temporary QMap object, and copy over non-duplicate contacts into
\c contacts.
......
......@@ -7266,7 +7266,7 @@
\l{http://www.microsoft.com/whdc/devtools/debugging/installx86.Mspx}
or
\l{http://www.microsoft.com/whdc/devtools/debugging/install64bit.Mspx}
package (Version 6.11.1.404 for the 32-bit or the 64-bit version
package (Version 6.12 for the 32-bit or the 64-bit version
of Qt Creator, respectively),
which are freely available for download from the
\l{http://msdn.microsoft.com/en-us/default.aspx}{Microsoft Developer Network}.
......
......@@ -46,9 +46,8 @@ namespace QmlJSDebugger {
QmlToolBar::QmlToolBar(QWidget *parent)
: QToolBar(parent)
, m_emitSignals(true)
, m_isRunning(false)
, m_paused(false)
, m_animationSpeed(1.0f)
, m_previousAnimationSpeed(0.0f)
, ui(new Ui)
{
ui->playIcon = QIcon(QLatin1String(":/qml/images/play-24.png"));
......@@ -99,40 +98,35 @@ QmlToolBar::QmlToolBar(QWidget *parent)
setWindowFlags(Qt::Tool);
QMenu *playSpeedMenu = new QMenu(this);
QActionGroup *playSpeedMenuActions = new QActionGroup(this);
playSpeedMenuActions->setExclusive(true);
playSpeedMenu->addAction(tr("Animation Speed"));
playSpeedMenu->addSeparator();
ui->defaultAnimSpeedAction = playSpeedMenu->addAction(tr("1x"), this,
SLOT(changeToDefaultAnimSpeed()));
ui->defaultAnimSpeedAction->setCheckable(true);
ui->defaultAnimSpeedAction->setChecked(true);
playSpeedMenuActions->addAction(ui->defaultAnimSpeedAction);
ui->halfAnimSpeedAction = playSpeedMenu->addAction(tr("0.5x"), this,
SLOT(changeToHalfAnimSpeed()));
ui->halfAnimSpeedAction->setCheckable(true);
playSpeedMenuActions->addAction(ui->halfAnimSpeedAction);
ui->fourthAnimSpeedAction = playSpeedMenu->addAction(tr("0.25x"), this,
SLOT(changeToFourthAnimSpeed()));
ui->fourthAnimSpeedAction->setCheckable(true);
playSpeedMenuActions->addAction(ui->fourthAnimSpeedAction);
ui->eighthAnimSpeedAction = playSpeedMenu->addAction(tr("0.125x"), this,
SLOT(changeToEighthAnimSpeed()));
ui->eighthAnimSpeedAction->setCheckable(true);
playSpeedMenuActions->addAction(ui->eighthAnimSpeedAction);
ui->tenthAnimSpeedAction = playSpeedMenu->addAction(tr("0.1x"), this,
SLOT(changeToTenthAnimSpeed()));
ui->tenthAnimSpeedAction->setCheckable(true);
playSpeedMenuActions->addAction(ui->tenthAnimSpeedAction);
ui->menuPauseAction = playSpeedMenu->addAction(tr("Pause"), this, SLOT(updatePauseAction()));
ui->menuPauseAction->setCheckable(true);
ui->menuPauseAction->setIcon(ui->pauseIcon);
playSpeedMenuActions->addAction(ui->menuPauseAction);
ui->playSpeedMenuActions = new QActionGroup(this);
ui->playSpeedMenuActions->setExclusive(true);
QAction *speedAction = playSpeedMenu->addAction(tr("1x"), this, SLOT(changeAnimationSpeed()));
speedAction->setCheckable(true);
speedAction->setChecked(true);
speedAction->setData(1.0f);
ui->playSpeedMenuActions->addAction(speedAction);
speedAction = playSpeedMenu->addAction(tr("0.5x"), this, SLOT(changeAnimationSpeed()));
speedAction->setCheckable(true);
speedAction->setData(2.0f);
ui->playSpeedMenuActions->addAction(speedAction);
speedAction = playSpeedMenu->addAction(tr("0.25x"), this, SLOT(changeAnimationSpeed()));
speedAction->setCheckable(true);
speedAction->setData(4.0f);
ui->playSpeedMenuActions->addAction(speedAction);
speedAction = playSpeedMenu->addAction(tr("0.125x"), this, SLOT(changeAnimationSpeed()));
speedAction->setCheckable(true);
speedAction->setData(8.0f);
ui->playSpeedMenuActions->addAction(speedAction);
speedAction = playSpeedMenu->addAction(tr("0.1x"), this, SLOT(changeAnimationSpeed()));
speedAction->setCheckable(true);
speedAction->setData(10.0f);
ui->playSpeedMenuActions->addAction(speedAction);
ui->play->setMenu(playSpeedMenu);
connect(ui->designmode, SIGNAL(toggled(bool)), SLOT(setDesignModeBehaviorOnClick(bool)));
......@@ -183,63 +177,40 @@ void QmlToolBar::activateZoom()
m_emitSignals = true;
}
void QmlToolBar::setAnimationSpeed(qreal slowdownFactor)
void QmlToolBar::setAnimationSpeed(qreal slowDownFactor)
{
if (m_animationSpeed == slowDownFactor)
return;
m_emitSignals = false;
if (slowdownFactor != 0) {
m_animationSpeed = slowdownFactor;
if (slowdownFactor == 1.0f) {
ui->defaultAnimSpeedAction->setChecked(true);
} else if (slowdownFactor == 2.0f) {
ui->halfAnimSpeedAction->setChecked(true);
} else if (slowdownFactor == 4.0f) {
ui->fourthAnimSpeedAction->setChecked(true);
} else if (slowdownFactor == 8.0f) {
ui->eighthAnimSpeedAction->setChecked(true);
} else if (slowdownFactor == 10.0f) {
ui->tenthAnimSpeedAction->setChecked(true);
m_animationSpeed = slowDownFactor;
foreach (QAction *action, ui->playSpeedMenuActions->actions()) {
if (action->data().toReal() == slowDownFactor) {
action->setChecked(true);
break;
}
updatePlayAction();
} else {
ui->menuPauseAction->setChecked(true);
updatePauseAction();
}
m_emitSignals = true;
}
void QmlToolBar::changeToDefaultAnimSpeed()
{
m_animationSpeed = 1.0f;
updatePlayAction();
}
void QmlToolBar::changeToHalfAnimSpeed()
{
m_animationSpeed = 2.0f;
updatePlayAction();
}
void QmlToolBar::changeToFourthAnimSpeed()
void QmlToolBar::setAnimationPaused(bool paused)
{
m_animationSpeed = 4.0f;
updatePlayAction();
}
if (m_paused == paused)
return;
void QmlToolBar::changeToEighthAnimSpeed()
{
m_animationSpeed = 8.0f;
m_paused = paused;
updatePlayAction();
}
void QmlToolBar::changeToTenthAnimSpeed()
void QmlToolBar::changeAnimationSpeed()
{
m_animationSpeed = 10.0f;
updatePlayAction();
QAction *action = qobject_cast<QAction*>(sender());
m_animationSpeed = action->data().toReal();
emit animationSpeedChanged(m_animationSpeed);
}
void QmlToolBar::setDesignModeBehavior(bool inDesignMode)
{
m_emitSignals = false;
......@@ -268,30 +239,14 @@ void QmlToolBar::setColorBoxColor(const QColor &color)
void QmlToolBar::activatePlayOnClick()
{
if (m_isRunning) {
updatePauseAction();
} else {
updatePlayAction();
}
m_paused = !m_paused;
emit animationPausedChanged(m_paused);
updatePlayAction();
}
void QmlToolBar::updatePlayAction()
{
m_isRunning = true;
ui->play->setIcon(ui->pauseIcon);
if (m_animationSpeed != m_previousAnimationSpeed)
m_previousAnimationSpeed = m_animationSpeed;
if (m_emitSignals)
emit animationSpeedChanged(m_animationSpeed);
}
void QmlToolBar::updatePauseAction()
{
m_isRunning = false;
ui->play->setIcon(ui->playIcon);
if (m_emitSignals)
emit animationSpeedChanged(0.0f);
ui->play->setIcon(m_paused ? ui->playIcon : ui->pauseIcon);
}
void QmlToolBar::activateColorPickerOnClick()
......
......@@ -39,6 +39,8 @@
#include "qmlobserverconstants.h"
QT_FORWARD_DECLARE_CLASS(QActionGroup)
namespace QmlJSDebugger {
class ToolBarColorBox;
......@@ -58,10 +60,13 @@ public slots:
void activateSelectTool();
void activateMarqueeSelectTool();
void activateZoom();
void setAnimationSpeed(qreal slowdownFactor = 0.0f);
void setAnimationSpeed(qreal slowDownFactor);
void setAnimationPaused(bool paused);
signals:
void animationSpeedChanged(qreal slowdownFactor = 1.0f);
void animationSpeedChanged(qreal factor);
void animationPausedChanged(bool paused);
void designModeBehaviorChanged(bool inDesignMode);
void colorPickerSelected();
......@@ -83,14 +88,9 @@ private slots:
void activateFromQml();
void activateToQml();
void changeToDefaultAnimSpeed();
void changeToHalfAnimSpeed();
void changeToFourthAnimSpeed();
void changeToEighthAnimSpeed();
void changeToTenthAnimSpeed();
void changeAnimationSpeed();
void updatePlayAction();
void updatePauseAction();
private:
class Ui {
......@@ -107,18 +107,12 @@ private:
QIcon pauseIcon;
ToolBarColorBox *colorBox;
QAction *defaultAnimSpeedAction;
QAction *halfAnimSpeedAction;
QAction *fourthAnimSpeedAction;
QAction *eighthAnimSpeedAction;
QAction *tenthAnimSpeedAction;
QAction *menuPauseAction;
QActionGroup *playSpeedMenuActions;
};
bool m_emitSignals;
bool m_isRunning;
bool m_paused;
qreal m_animationSpeed;
qreal m_previousAnimationSpeed;
Constants::DesignTool m_activeTool;
......
......@@ -65,7 +65,8 @@ public:
void setDesignModeBehavior(bool inDesignMode);
void setCurrentObjects(QList<QObject*> items);
void setAnimationSpeed(qreal slowdownFactor);
void setAnimationSpeed(qreal slowDownFactor);
void setAnimationPaused(bool paused);
void setCurrentTool(QmlJSDebugger::Constants::DesignTool toolId);
void reloaded();
void setShowAppOnTop(bool showAppOnTop);
......@@ -95,9 +96,9 @@ Q_SIGNALS:
void objectReparentRequested(QObject *object, QObject *newParent);
// 1 = normal speed,
// 0 = paused,
// 1 < x < 16 = slowdown by some factor
void animationSpeedChangeRequested(qreal speedFactor);
void executionPauseChangeRequested(bool paused);
void contextPathIndexChanged(int contextPathIndex);
void clearComponentCacheRequested();
......
......@@ -73,9 +73,8 @@ public Q_SLOTS:
void setShowAppOnTop(bool appOnTop);
void changeAnimationSpeed(qreal slowdownFactor);
void continueExecution(qreal slowdownFactor = 1.0f);
void pauseExecution();
void setAnimationSpeed(qreal factor);
void setAnimationPaused(bool paused);
void setObserverContext(int contextIndex);
......@@ -89,8 +88,8 @@ Q_SIGNALS:
void colorPickerActivated();
void selectedColorChanged(const QColor &color);
void executionStarted(qreal slowdownFactor);
void executionPaused();
void animationSpeedChanged(qreal factor);
void animationPausedChanged(bool paused);
void inspectorContextCleared();
void inspectorContextPushed(const QString &contextTitle);
......@@ -110,6 +109,10 @@ protected:
void setSelectedItemsForTools(QList<QGraphicsItem *> items);
private slots:
void animationSpeedChangeRequested(qreal factor);
void animationPausedChangeRequested(bool paused);
private:
Q_DISABLE_COPY(QDeclarativeViewObserver)
......
......@@ -48,24 +48,26 @@ class ObserverProtocol : public QObject
public:
enum Message {
AnimationSpeedChanged,
ChangeTool,
ClearComponentCache,
ColorChanged,
ContextPathUpdated,
CreateObject,
CurrentObjectsChanged,
DestroyObject,
MoveObject,
ObjectIdList,
Reload,
Reloaded,
SetAnimationSpeed,
SetContextPathIdx,
SetCurrentObjects,
SetDesignMode,
ShowAppOnTop,
ToolChanged
AnimationSpeedChanged = 0,
AnimationPausedChanged = 19, // highest value
ChangeTool = 1,
ClearComponentCache = 2,
ColorChanged = 3,
ContextPathUpdated = 4,
CreateObject = 5,
CurrentObjectsChanged = 6,
DestroyObject = 7,
MoveObject = 8,
ObjectIdList = 9,
Reload = 10,
Reloaded = 11,
SetAnimationSpeed = 12,
SetAnimationPaused = 18,
SetContextPathIdx = 13,
SetCurrentObjects = 14,
SetDesignMode = 15,
ShowAppOnTop = 16,
ToolChanged = 17
};
enum Tool {
......@@ -77,12 +79,12 @@ public:
static inline QString toString(Message message)
{
return staticMetaObject.enumerator(0).key(message);
return staticMetaObject.enumerator(0).valueToKey(message);
}
static inline QString toString(Tool tool)
{
return staticMetaObject.enumerator(1).key(tool);
return staticMetaObject.enumerator(1).valueToKey(tool);
}
};
......
......@@ -100,6 +100,12 @@ void QDeclarativeObserverService::messageReceived(const QByteArray &message)
emit animationSpeedChangeRequested(speed);
break;
}
case ObserverProtocol::SetAnimationPaused: {
bool paused;
ds >> paused;
emit executionPauseChangeRequested(paused);
break;
}
case ObserverProtocol::ChangeTool: {
ObserverProtocol::Tool tool;
ds >> tool;
......@@ -222,14 +228,24 @@ void QDeclarativeObserverService::setCurrentTool(QmlJSDebugger::Constants::Desig
sendMessage(message);
}
void QDeclarativeObserverService::setAnimationSpeed(qreal slowdownFactor)
void QDeclarativeObserverService::setAnimationSpeed(qreal slowDownFactor)
{
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ds << ObserverProtocol::AnimationSpeedChanged
<< slowdownFactor;
<< slowDownFactor;
sendMessage(message);
}
void QDeclarativeObserverService::setAnimationPaused(bool paused)
{
QByteArray message;
QDataStream ds(&message, QIODevice::WriteOnly);
ds << ObserverProtocol::AnimationPausedChanged
<< paused;
sendMessage(message);
}
......
......@@ -105,8 +105,8 @@ QDeclarativeViewObserverPrivate::QDeclarativeViewObserverPrivate(QDeclarativeVie
q(q),
designModeBehavior(false),
showAppOnTop(false),
executionPaused(false),
slowdownFactor(1.0f),
animationPaused(false),
slowDownFactor(1.0f),
toolBox(0)
{
}
......@@ -147,7 +147,9 @@ QDeclarativeViewObserver::QDeclarativeViewObserver(QDeclarativeView *view, QObje
connect(data->debugService, SIGNAL(currentObjectsChanged(QList<QObject*>)),
data.data(), SLOT(_q_onCurrentObjectsChanged(QList<QObject*>)));
connect(data->debugService, SIGNAL(animationSpeedChangeRequested(qreal)),
SLOT(changeAnimationSpeed(qreal)));
SLOT(animationSpeedChangeRequested(qreal)));
connect(data->debugService, SIGNAL(executionPauseChangeRequested(bool)),
SLOT(animationPausedChangeRequested(bool)));
connect(data->debugService, SIGNAL(colorPickerToolRequested()),
data.data(), SLOT(_q_changeToColorPickerTool()));
connect(data->debugService, SIGNAL(selectMarqueeToolRequested()),
......@@ -384,11 +386,7 @@ bool QDeclarativeViewObserver::keyReleaseEvent(QKeyEvent *event)
data->subcomponentEditorTool->setCurrentItem(data->selectedItems().first());
break;
case Qt::Key_Space:
if (data->executionPaused) {
continueExecution(data->slowdownFactor);
} else {
pauseExecution();
}
setAnimationPaused(!data->animationPaused);
break;
default:
break;
......@@ -757,44 +755,48 @@ void QDeclarativeViewObserverPrivate::_q_changeContextPathIndex(int index)
subcomponentEditorTool->setContext(index);
}
void QDeclarativeViewObserver::changeAnimationSpeed(qreal slowdownFactor)
void QDeclarativeViewObserver::setAnimationSpeed(qreal slowDownFactor)
{
data->slowdownFactor = slowdownFactor;
Q_ASSERT(slowDownFactor > 0);
if (data->slowDownFactor == slowDownFactor)
return;
if (data->slowdownFactor != 0)
continueExecution(data->slowdownFactor);
else
pauseExecution();
animationSpeedChangeRequested(slowDownFactor);
data->debugService->setAnimationSpeed(slowDownFactor);
}
void QDeclarativeViewObserver::continueExecution(qreal slowdownFactor)
void QDeclarativeViewObserver::setAnimationPaused(bool paused)
{
Q_ASSERT(slowdownFactor > 0);
if (data->animationPaused == paused)
return;
data->slowdownFactor = slowdownFactor;
static const qreal animSpeedSnapDelta = 0.01f;
animationPausedChangeRequested(paused);
data->debugService->setAnimationPaused(paused);
}
qreal slowDownFactor = data->slowdownFactor;
if (qAbs(1.0f - slowDownFactor) < animSpeedSnapDelta) {
slowDownFactor = 1.0f;
void QDeclarativeViewObserver::animationSpeedChangeRequested(qreal factor)
{
if (data->slowDownFactor != factor) {
data->slowDownFactor = factor;
emit animationSpeedChanged(factor);
}
QDeclarativeDebugHelper::setAnimationSlowDownFactor(slowDownFactor);
data->executionPaused = false;
emit executionStarted(data->slowdownFactor);
data->debugService->setAnimationSpeed(data->slowdownFactor);
const float effectiveFactor = data->animationPaused ? 0 : factor;
QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor);
}
void QDeclarativeViewObserver::pauseExecution()
void QDeclarativeViewObserver::animationPausedChangeRequested(bool paused)
{
QDeclarativeDebugHelper::setAnimationSlowDownFactor(0.0f);
data->executionPaused = true;
if (data->animationPaused != paused) {
data->animationPaused = paused;
emit animationPausedChanged(paused);
}
emit executionPaused();
data->debugService->setAnimationSpeed(0);
const float effectiveFactor = paused ? 0 : data->slowDownFactor;
QDeclarativeDebugHelper::setAnimationSlowDownFactor(effectiveFactor);
}
void QDeclarativeViewObserverPrivate::_q_applyChangesFromClient()
{
}
......@@ -850,8 +852,6 @@ void QDeclarativeViewObserverPrivate::_q_onStatusChanged(QDeclarativeView::Statu
if (subcomponentEditorTool->contextIndex() != -1)
subcomponentEditorTool->clear();
subcomponentEditorTool->pushContext(view->rootObject());
emit q->executionStarted(1.0f);
}
debugService->reloaded();
}
......@@ -917,8 +917,8 @@ void QDeclarativeViewObserverPrivate::createToolBox()
QObject::connect(toolBar, SIGNAL(designModeBehaviorChanged(bool)),
q, SLOT(setDesignModeBehavior(bool)));
QObject::connect(toolBar, SIGNAL(animationSpeedChanged(qreal)),
q, SLOT(changeAnimationSpeed(qreal)));
QObject::connect(toolBar, SIGNAL(animationSpeedChanged(qreal)), q, SLOT(setAnimationSpeed(qreal)));