Commit 1a2a4f63 authored by con's avatar con
Browse files

Merge remote branch 'origin/2.0'

Conflicts:
	share/qtcreator/gdbmacros/dumper.py
	src/libs/qmljs/qmljs-lib.pri
	src/plugins/fakevim/fakevimhandler.cpp
parents 7feed731 15047f88
......@@ -1164,7 +1164,7 @@ class Dumper:
self.put('{name="<incomplete>",value="",type="",numchild="0"},')
def putType(self, type, priority = 0):
# higher priority values override lower ones
# Higher priority values override lower ones.
if priority >= self.currentTypePriority:
self.currentType = type
self.currentTypePriority = priority
......
......@@ -24,6 +24,7 @@ HEADERS += \
$$PWD/qmljscompletioncontextfinder.h \
$$PWD/qmljscomponentversion.h \
$$PWD/qmljsmodelmanagerinterface.h \
$$PWD/qmljsicontextpane.h \
$$PWD/qmljspropertyreader.h \
$$PWD/qmljsrewriter.h
......
#ifndef QMLJSICONTEXTPANE_H
#define QMLJSICONTEXTPANE_H
#include <QObject>
#include "qmljs_global.h"
#include <qmljs/parser/qmljsastfwd_p.h>
#include <qmljs/qmljsdocument.h>
namespace TextEditor {
class BaseTextEditorEditable;
} //TextEditor
namespace QmlJS {
class QMLJS_EXPORT IContextPane : public QObject
{
Q_OBJECT
public:
IContextPane(QObject *parent = 0) : QObject(parent) {}
virtual ~IContextPane() {}
virtual void apply(TextEditor::BaseTextEditorEditable *editor, Document::Ptr doc, AST::Node *node, bool update) = 0;
virtual void setEnabled(bool) = 0;
};
} // namespace QmlJS
#endif // QMLJSICONTEXTPANE_H
......@@ -40,10 +40,12 @@
#include <QtGui/QAction>
#include <QtGui/QClipboard>
#include <QtGui/QFontMetrics>
#include <QtGui/QHelpEvent>
#include <QtGui/QMenu>
#include <QtGui/QMessageBox>
#include <QtGui/QPainter>
#include <QtGui/QScrollBar>
#include <QtGui/QToolTip>
#include <QtGui/QWheelEvent>
using namespace BINEditor;
......@@ -1030,7 +1032,64 @@ bool BinEditor::event(QEvent *e) {
break;
default:;
}
} else if (e->type() == QEvent::ToolTip) {
bool hide = true;
int selStart = selectionStart();
int selEnd = selectionEnd();
int byteCount = selEnd - selStart;
if (byteCount <= 0) {
selStart = m_cursorPosition;
selEnd = selStart + 1;
byteCount = 1;
}
if (byteCount <= 8) {
const QPoint &startPoint = offsetToPos(selStart);
const QPoint &endPoint = offsetToPos(selEnd);
const QPoint expandedEndPoint
= QPoint(endPoint.x(), endPoint.y() + m_lineHeight);
const QRect selRect(startPoint, expandedEndPoint);
const QHelpEvent * const helpEvent = static_cast<QHelpEvent *>(e);
const QPoint &mousePos = helpEvent->pos();
if (selRect.contains(mousePos)) {
quint64 beValue, leValue;
asIntegers(selStart, byteCount, beValue, leValue);
QString leSigned;
QString beSigned;
switch (byteCount) {
case 8: case 7: case 6: case 5:
leSigned = QString::number(static_cast<qint64>(leValue));
beSigned = QString::number(static_cast<qint64>(beValue));
break;
case 4: case 3:
leSigned = QString::number(static_cast<qint32>(leValue));
beSigned = QString::number(static_cast<qint32>(beValue));
break;
case 2:
leSigned = QString::number(static_cast<qint16>(leValue));
beSigned = QString::number(static_cast<qint16>(beValue));
break;
case 1:
leSigned = QString::number(static_cast<qint8>(leValue));
beSigned = QString::number(static_cast<qint8>(beValue));
break;
}
hide = false;
QToolTip::showText(helpEvent->globalPos(),
tr("Decimal unsigned value (little endian): %1\n"
"Decimal unsigned value (big endian): %2\n"
"Decimal signed value (little endian): %3\n"
"Decimal signed value (big endian): %4")
.arg(QString::number(leValue))
.arg(QString::number(beValue))
.arg(leSigned).arg(beSigned));
}
}
if (hide)
QToolTip::hideText();
e->accept();
return true;
}
return QAbstractScrollArea::event(e);
}
......@@ -1271,13 +1330,7 @@ void BinEditor::contextMenuEvent(QContextMenuEvent *event)
quint64 beAddress = 0;
quint64 leAddress = 0;
if (byteCount <= 8) {
const QByteArray &data = dataMid(selStart, byteCount);
for (int pos = 0; pos < byteCount; ++pos) {
const quint64 val = static_cast<quint64>(data.at(pos)) & 0xff;
beAddress += val << (pos * 8);
leAddress += val << ((byteCount - pos - 1) * 8);
}
asIntegers(selStart, byteCount, beAddress, leAddress);
setupJumpToMenuAction(&contextMenu, &jumpToBeAddressHere,
&jumpToBeAddressNewWindow, beAddress);
......@@ -1335,3 +1388,22 @@ void BinEditor::setNewWindowRequestAllowed()
{
m_canRequestNewWindow = true;
}
QPoint BinEditor::offsetToPos(int offset)
{
const int x = m_labelWidth + (offset % 16) * m_columnWidth;
const int y = (offset / 16) * m_lineHeight;
return QPoint(x, y);
}
void BinEditor::asIntegers(int offset, int count, quint64 &beValue,
quint64 &leValue)
{
beValue = leValue = 0;
const QByteArray &data = dataMid(offset, count);
for (int pos = 0; pos < count; ++pos) {
const quint64 val = static_cast<quint64>(data.at(pos)) & 0xff;
beValue += val << (pos * 8);
leValue += val << ((count - pos - 1) * 8);
}
}
......@@ -169,6 +169,9 @@ private:
QByteArray dataMid(int from, int length) const;
QByteArray blockData(int block) const;
QPoint offsetToPos(int offset);
void asIntegers(int offset, int count, quint64 &beValue, quint64 &leValue);
int m_unmodifiedState;
int m_readOnly;
int m_margin;
......
......@@ -129,8 +129,8 @@ bool FormEditorStack::removeFormWindowEditor(Core::IEditor *xmlEditor)
const int i = indexOf(xmlEditor);
if (i == -1) // Fail silently as this is invoked for all editors.
return false;
removeWidget(m_formEditors[i].widgetHost->widget());
delete m_formEditors[i].widgetHost;
removeWidget(m_formEditors[i].widgetHost);
m_formEditors[i].widgetHost->deleteLater();
m_formEditors.removeAt(i);
return true;
}
......
......@@ -36,6 +36,7 @@
#include <QtGui/QMainWindow>
#include <QtGui/QStringListModel>
#include <QtGui/QCompleter>
#include <QtGui/QKeyEvent>
using namespace Find;
using namespace Find::Internal;
......@@ -56,6 +57,7 @@ FindToolWindow::FindToolWindow(FindPlugin *plugin)
connect(m_ui.searchTerm, SIGNAL(textChanged(QString)), this, SLOT(updateButtonStates()));
m_findCompleter->setModel(m_plugin->findCompletionModel());
m_ui.searchTerm->setCompleter(m_findCompleter);
m_ui.searchTerm->installEventFilter(this);
QVBoxLayout *layout = new QVBoxLayout;
layout->setMargin(0);
layout->setSpacing(0);
......@@ -68,6 +70,17 @@ FindToolWindow::~FindToolWindow()
qDeleteAll(m_configWidgets);
}
bool FindToolWindow::eventFilter(QObject *obj, QEvent *event)
{
if (obj == m_ui.searchTerm && event->type() == QEvent::KeyPress) {
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
if (ke->key() == Qt::Key_Down) {
m_findCompleter->complete();
}
}
return QDialog::eventFilter(obj, event);
}
void FindToolWindow::updateButtonStates()
{
bool enabled = !m_ui.searchTerm->text().isEmpty()
......
......@@ -57,6 +57,9 @@ public:
void readSettings();
void writeSettings();
protected:
bool eventFilter(QObject *obj, QEvent *event);
private slots:
void search();
void replace();
......
......@@ -45,6 +45,7 @@
#include <QtCore/QDebug>
#include <QtCore/QProcess>
#include <QtCore/QSize>
#include <QtGui/QFileSystemModel>
#include <QtGui/QVBoxLayout>
#include <QtGui/QToolButton>
......@@ -143,6 +144,7 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent)
#endif
m_fileSystemModel->setFilter(filters);
m_filterModel->setSourceModel(m_fileSystemModel);
m_listView->setIconSize(QSize(16,16));
m_listView->setModel(m_filterModel);
m_listView->setFrameStyle(QFrame::NoFrame);
m_listView->setAttribute(Qt::WA_MacShowFocusRect, false);
......
......@@ -63,26 +63,24 @@ void OutputFormatter::setPlainTextEdit(QPlainTextEdit *plainText)
void OutputFormatter::appendApplicationOutput(const QString &text, bool onStdErr)
{
gotoEnd();
if (onStdErr)
setFormat(StdErrFormat);
else
setFormat(StdOutFormat);
plainTextEdit()->insertPlainText(text);
append(text, onStdErr ? StdErrFormat : StdOutFormat);
}
void OutputFormatter::appendMessage(const QString &text, bool isError)
{
gotoEnd();
append(text, isError ? ErrorMessageFormat : NormalMessageFormat);
}
if (isError)
setFormat(ErrorMessageFormat);
else
setFormat(NormalMessageFormat);
void OutputFormatter::append(const QString &text, Format format)
{
append(text, m_formats[format]);
}
plainTextEdit()->insertPlainText(text);
void OutputFormatter::append(const QString &text, const QTextCharFormat &format)
{
QTextCursor cursor(m_plainTextEdit->document());
cursor.movePosition(QTextCursor::End);
cursor.insertText(text, format);
}
void OutputFormatter::mousePressEvent(QMouseEvent * /*e*/)
......@@ -119,14 +117,3 @@ void OutputFormatter::initFormats()
m_formats[StdErrFormat].setFont(font);
m_formats[StdErrFormat].setForeground(QColor(200, 0, 0));
}
void OutputFormatter::setFormat(Format theFormat) const
{
if (m_formats)
plainTextEdit()->setCurrentCharFormat(m_formats[theFormat]);
}
void OutputFormatter::gotoEnd() const
{
plainTextEdit()->moveCursor(QTextCursor::End);
}
......@@ -70,9 +70,8 @@ protected:
};
void initFormats();
void setFormat(Format theFormat) const;
void gotoEnd() const;
void append(const QString &text, Format format);
void append(const QString &text, const QTextCharFormat &format);
private:
QPlainTextEdit *m_plainTextEdit;
......
......@@ -507,14 +507,16 @@ void OutputWindow::appendApplicationOutputInline(const QString &out, bool onStdE
void OutputWindow::appendMessage(const QString &out, bool isError)
{
setMaximumBlockCount(MaxBlockCount);
const bool atBottom = isScrollbarAtBottom();
m_formatter->appendMessage(doNewlineEnfocement(out), isError);
if (atBottom)
scrollToBottom();
enableUndoRedo();
}
bool OutputWindow::isScrollbarAtBottom() const
{
return blockBoundingRect(document()->lastBlock()).bottom() + contentOffset().y()
<= viewport()->rect().bottom();
return verticalScrollBar()->value() == verticalScrollBar()->maximum();
}
void OutputWindow::scrollToBottom()
......
......@@ -124,28 +124,29 @@ void ColorButton::paintEvent(QPaintEvent *event)
else
p.setBrush(Qt::transparent);
p.setPen(QColor(0x444444));
p.drawRect(r.translated(1, 1));
p.setPen(QColor(0x101010));
p.drawRect(r);
p.setPen(QColor(255, 255, 255, 40));
p.drawRect(r.adjusted(1, 1, -1, -1));
if (color.value() > 80)
p.setPen(QColor(0x444444));
else
p.setPen(QColor(0x9e9e9e));
p.drawRect(r.translated(1, 1));
p.setRenderHint(QPainter::Antialiasing, true);
QVector<QPointF> points;
if (isChecked()) {
points.append(QPointF(2, 3));
points.append(QPointF(8, 3));
points.append(QPointF(5, 9));
} else {
points.append(QPointF(8, 6));
points.append(QPointF(2, 9));
points.append(QPointF(2, 3));
if (m_showArrow) {
p.setRenderHint(QPainter::Antialiasing, true);
QVector<QPointF> points;
if (isChecked()) {
points.append(QPointF(2, 3));
points.append(QPointF(8, 3));
points.append(QPointF(5, 9));
} else {
points.append(QPointF(8, 6));
points.append(QPointF(2, 9));
points.append(QPointF(2, 3));
}
p.translate(0.5, 0.5);
p.setBrush(QColor(0xaaaaaa));
p.setPen(QColor(0x444444));
p.drawPolygon(points);
}
p.translate(0.5, 0.5);
p.setBrush(QColor(0xaaaaaa));
p.setPen(QColor(0x444444));
p.drawPolygon(points);
}
......@@ -189,24 +190,19 @@ void HueControl::paintEvent(QPaintEvent *event)
}
}
p.setPen(QColor(0x404040));
p.drawRect(QRect(1, 1, width() - 1, height() - 1).adjusted(10, 5, -20, -5));
//p.setPen(QColor(0x404040));
//p.drawRect(QRect(1, 1, width() - 1, height() - 1).adjusted(10, 5, -20, -5));
p.drawPixmap(10, 5, m_cache);
p.drawPixmap(0, 5, m_cache);
QVector<QPointF> points;
int y = m_color.hueF() * 120 + 5;
points.append(QPointF(15, y));
points.append(QPointF(25, y + 5));
points.append(QPointF(25, y - 5));
points.append(QPointF(5, y));
points.append(QPointF(15, y + 5));
points.append(QPointF(15, y - 5));
p.setBrush(Qt::NoBrush);
p.setPen(QColor(0x101010));
p.drawRect(QRect(0, 0, width() - 1, height() - 1).adjusted(10, 5, -20, -5));
p.setPen(QColor(255, 255, 255, 60));
p.drawRect(QRect(1, 1, width() - 3, height() - 3).adjusted(10, 5, -20, -5));
p.setRenderHint(QPainter::Antialiasing, true);
p.translate(0.5, 1.5);
......@@ -364,15 +360,6 @@ void ColorBox::paintEvent(QPaintEvent *event)
chacheP.drawPoint(x ,y);
}
}
p.setBrush(Qt::NoBrush);
p.setPen(QColor(0x505050));
QRect r(0, 0, width() -1, height() - 1);
p.drawRect(r.adjusted(6, 6, -2, -2));
p.setPen(QColor(0x404040));
p.drawRect(r.adjusted(5, 5, -3, -3));
p.setPen(QColor(0x101010));
p.drawRect(r.adjusted(4, 4, -4, -4));
p.drawPixmap(5, 5, m_cache);
int x = clamp(m_color.hsvSaturationF() * 120, 0, 119) + 5;
......@@ -384,8 +371,6 @@ void ColorBox::paintEvent(QPaintEvent *event)
p.drawLine(x, 5, x, y-1);
p.drawLine(x, y+1, x, height()-7);
p.setPen(QColor(255, 255, 255, 60));
p.drawRect(r.adjusted(5, 5, -5, -5));
}
void ColorBox::mousePressEvent(QMouseEvent *e)
......@@ -775,33 +760,59 @@ BauhausColorDialog::BauhausColorDialog(QWidget *parent) : QFrame(parent )
m_hueControl = new HueControl(this);
m_colorBox = new ColorBox(this);
QWidget *colorFrameWidget = new QWidget(this);
QVBoxLayout* vBox = new QVBoxLayout(colorFrameWidget);
colorFrameWidget->setLayout(vBox);
vBox->setSpacing(0);
vBox->setMargin(0);
vBox->setContentsMargins(0,5,0,28);
m_beforeColorWidget = new QFrame(colorFrameWidget);
m_beforeColorWidget->setFixedSize(30, 18);
m_beforeColorWidget->setAutoFillBackground(true);
//m_beforeColorWidget->setFrameShape(QFrame::StyledPanel);
m_currentColorWidget = new QFrame(colorFrameWidget);
m_currentColorWidget->setFixedSize(30, 18);
m_currentColorWidget->setAutoFillBackground(true);
//m_currentColorWidget->setFrameShape(QFrame::StyledPanel);
vBox->addWidget(m_beforeColorWidget);
vBox->addWidget(m_currentColorWidget);
m_rSpinBox = new QDoubleSpinBox(this);
m_gSpinBox = new QDoubleSpinBox(this);
m_bSpinBox = new QDoubleSpinBox(this);
m_alphaSpinBox = new QDoubleSpinBox(this);
QGridLayout *gridLayout = new QGridLayout(this);
gridLayout->setSpacing(4);
gridLayout->setVerticalSpacing(4);
gridLayout->setMargin(4);
setLayout(gridLayout);
gridLayout->addWidget(m_colorBox, 0, 0, 4, 1);
gridLayout->addWidget(m_hueControl, 0, 1, 4, 1);
gridLayout->addWidget(new QLabel("R", this), 0, 2, 1, 1);
gridLayout->addWidget(new QLabel("G", this), 1, 2, 1, 1);
gridLayout->addWidget(new QLabel("B", this), 2, 2, 1, 1);
gridLayout->addWidget(new QLabel("A", this), 3, 2, 1, 1);
gridLayout->addWidget(colorFrameWidget, 0, 2, 2, 1);
gridLayout->addWidget(new QLabel("R", this), 0, 3, 1, 1);
gridLayout->addWidget(new QLabel("G", this), 1, 3, 1, 1);
gridLayout->addWidget(new QLabel("B", this), 2, 3, 1, 1);
gridLayout->addWidget(new QLabel("A", this), 3, 3, 1, 1);
gridLayout->addWidget(m_rSpinBox, 0, 3, 1, 1);
gridLayout->addWidget(m_gSpinBox, 1, 3, 1, 1);
gridLayout->addWidget(m_bSpinBox, 2, 3, 1, 1);
gridLayout->addWidget(m_alphaSpinBox, 3, 3, 1, 1);
gridLayout->addWidget(m_rSpinBox, 0, 4, 1, 1);
gridLayout->addWidget(m_gSpinBox, 1, 4, 1, 1);
gridLayout->addWidget(m_bSpinBox, 2, 4, 1, 1);
gridLayout->addWidget(m_alphaSpinBox, 3, 4, 1, 1);
QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
QPushButton *cancelButton = buttonBox->addButton(QDialogButtonBox::Cancel);
QPushButton *applyButton = buttonBox->addButton(QDialogButtonBox::Apply);
gridLayout->addWidget(buttonBox, 4, 0, 2, 1);
gridLayout->addWidget(buttonBox, 4, 0, 1, 2);
resize(sizeHint());
......@@ -828,6 +839,14 @@ BauhausColorDialog::BauhausColorDialog(QWidget *parent) : QFrame(parent )
}
void BauhausColorDialog::setupColor(const QColor &color)
{
QPalette pal = m_beforeColorWidget->palette();
pal.setColor(QPalette::Background, color);
m_beforeColorWidget->setPalette(pal);
setColor(color);
}
void BauhausColorDialog::spinBoxChanged()
{
if (m_blockUpdate)
......@@ -857,6 +876,9 @@ void BauhausColorDialog::setupWidgets()
m_gSpinBox->setValue(m_color.greenF());
m_bSpinBox->setValue(m_color.blueF());
m_colorBox->setColor(m_color);
QPalette pal = m_currentColorWidget->palette();
pal.setColor(QPalette::Background, m_color);
m_currentColorWidget->setPalette(pal);
m_blockUpdate = false;
}
......
......@@ -55,14 +55,17 @@ Q_OBJECT
Q_PROPERTY(QString color READ color WRITE setColor NOTIFY colorChanged)
Q_PROPERTY(bool noColor READ noColor WRITE setNoColor)
Q_PROPERTY(bool showArrow READ showArrow WRITE setShowArrow)
public:
ColorButton(QWidget *parent = 0) : QToolButton (parent), m_colorString("#ffffff"), m_noColor(false) {}
ColorButton(QWidget *parent = 0) : QToolButton (parent), m_colorString("#ffffff"), m_noColor(false), m_showArrow(true) {}
void setColor(const QString &colorStr);
QString color() const { return m_colorString; }
bool noColor() const { return m_noColor; }
void setNoColor(bool f) { m_noColor = f; update(); }
bool showArrow() const { return m_showArrow; }
void setShowArrow(bool b) { m_showArrow = b; }
signals:
void colorChanged();
......@@ -72,6 +75,7 @@ protected:
private:
QString m_colorString;
bool m_noColor;
bool m_showArrow;
};
class ColorBox : public QWidget
......@@ -138,7 +142,7 @@ public:
HueControl(QWidget *parent = 0) : QWidget(parent), m_color(Qt::white), m_mousePressed(false)
{
setFixedWidth(40);
setFixedWidth(28);
setFixedHeight(130);
}
......@@ -227,6 +231,9 @@ public:
BauhausColorDialog(QWidget *parent = 0);
QColor color() const { return m_color; }
void setupColor(const QColor &color);
void setColor(const QColor &color)
{
if (color == m_color)
......@@ -265,7 +272,9 @@ signals:
protected:
void setupWidgets();