Commit 6503099b authored by con's avatar con

Merge remote branch 'origin/2.0'

Conflicts:
	doc/qtcreator.qdoc
	src/plugins/bineditor/bineditorplugin.cpp
parents d209bd72 4245b4ab
doc/images/qmldesigner-helloworld.png

18.9 KB | W: | H:

doc/images/qmldesigner-helloworld.png

9.73 KB | W: | H:

doc/images/qmldesigner-helloworld.png
doc/images/qmldesigner-helloworld.png
doc/images/qmldesigner-helloworld.png
doc/images/qmldesigner-helloworld.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
......@@ -57,6 +57,11 @@ qhp.QtCreator.extraFiles = \
images/qt-logo.png \
images/sprites-combined.png
qhp.QtCreator.subprojects = manual
qhp.QtCreator.subprojects.manual.title = Qt Creator Manual
qhp.QtCreator.subprojects.manual.indexTitle = Qt Creator Manual
qhp.QtCreator.subprojects.manual.type = manual
# macros.qdocconf
macro.aring.HTML = "å"
......
......@@ -150,6 +150,7 @@ void BinEditor::init()
horizontalScrollBar()->setPageStep(viewport()->width());
verticalScrollBar()->setRange(0, m_numLines - m_numVisibleLines);
verticalScrollBar()->setPageStep(m_numVisibleLines);
ensureCursorVisible();
}
......@@ -393,7 +394,10 @@ bool BinEditor::save(const QString &oldFileName, const QString &newFileName)
if (output.write(it.value()) < m_blockSize)
return false;
}
if (size % m_blockSize != 0 && !output.resize(size))
// We may have padded the displayed data, so we have to make sure
// changes to that area are not actually written back to disk.
if (!output.resize(size))
return false;
} else {
QFile output(newFileName);
......@@ -435,6 +439,7 @@ void BinEditor::setLazyData(quint64 startAddr, int range, int blockSize)
init();
setCursorPosition(startAddr - m_baseAddr);
viewport()->update();
}
void BinEditor::resizeEvent(QResizeEvent *)
......@@ -445,6 +450,15 @@ void BinEditor::resizeEvent(QResizeEvent *)
void BinEditor::scrollContentsBy(int dx, int dy)
{
viewport()->scroll(isRightToLeft() ? -dx : dx, dy * m_lineHeight);
if (m_inLazyMode) {
const QScrollBar * const scrollBar = verticalScrollBar();
const int scrollPos = scrollBar->value();
if (dy <= 0 && scrollPos == scrollBar->maximum())
emit newRangeRequested(editorInterface(),
baseAddress() + dataSize());
else if (dy >= 0 && scrollPos == scrollBar->minimum())
emit newRangeRequested(editorInterface(), baseAddress());
}
}
void BinEditor::changeEvent(QEvent *e)
......@@ -913,11 +927,6 @@ int BinEditor::cursorPosition() const
void BinEditor::setCursorPosition(int pos, MoveMode moveMode)
{
pos = qMin(m_size-1, qMax(0, pos));
if (pos == m_cursorPosition
&& (m_anchorPosition == m_cursorPosition || moveMode == KeepAnchor)
&& !m_lowNibble)
return;
int oldCursorPosition = m_cursorPosition;
bool hasSelection = m_anchorPosition != m_cursorPosition;
......@@ -1009,6 +1018,16 @@ bool BinEditor::event(QEvent *e) {
ensureCursorVisible();
e->accept();
return true;
case Qt::Key_Down:
if (m_inLazyMode) {
const QScrollBar * const scrollBar = verticalScrollBar();
if (scrollBar->value() >= scrollBar->maximum() - 1) {
emit newRangeRequested(editorInterface(),
baseAddress() + dataSize());
return true;
}
}
break;
default:;
}
}
......@@ -1282,9 +1301,9 @@ void BinEditor::contextMenuEvent(QContextMenuEvent *event)
else if (action == &copyHexAction)
copy(false);
else if (action == &jumpToBeAddressHere)
setCursorPosition(beAddress - m_baseAddr);
jumpToAddress(beAddress);
else if (action == &jumpToLeAddressHere)
setCursorPosition(leAddress - m_baseAddr);
jumpToAddress(leAddress);
else if (action == &jumpToBeAddressNewWindow)
emit newWindowRequested(beAddress);
else if (action == &jumpToLeAddressNewWindow)
......@@ -1300,12 +1319,18 @@ void BinEditor::setupJumpToMenuAction(QMenu *menu, QAction *actionHere,
.arg(QString::number(addr, 16)));
menu->addAction(actionHere);
menu->addAction(actionNew);
if (addr < m_baseAddr || addr >= m_baseAddr + m_size)
actionHere->setEnabled(false);
if (!m_canRequestNewWindow)
actionNew->setEnabled(false);
}
void BinEditor::jumpToAddress(quint64 address)
{
if (address >= m_baseAddr && address < m_baseAddr + m_data.size())
setCursorPosition(address - m_baseAddr);
else
emit newRangeRequested(editorInterface(), address);
}
void BinEditor::setNewWindowRequestAllowed()
{
m_canRequestNewWindow = true;
......
......@@ -66,6 +66,7 @@ public:
QByteArray data() const;
inline int dataSize() const { return m_size; }
quint64 baseAddress() const { return m_baseAddr; }
inline bool inLazyMode() const { return m_inLazyMode; }
Q_INVOKABLE void setLazyData(quint64 startAddr, int range, int blockSize = 4096);
......@@ -84,6 +85,7 @@ public:
int cursorPosition() const;
void setCursorPosition(int pos, MoveMode moveMode = MoveAnchor);
void jumpToAddress(quint64 address);
void setModified(bool);
bool isModified() const;
......@@ -130,6 +132,7 @@ Q_SIGNALS:
void lazyDataRequested(Core::IEditor *editor, quint64 block, bool synchronous);
void newWindowRequested(quint64 address);
void newRangeRequested(Core::IEditor *, quint64 address);
protected:
void scrollContentsBy(int dx, int dy);
......
......@@ -34,10 +34,13 @@
#include <QtCore/QFile>
#include <QtCore/QFileInfo>
#include <QtCore/QDebug>
#include <QtCore/QRegExp>
#include <QtGui/QMenu>
#include <QtGui/QAction>
#include <QtGui/QMainWindow>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLineEdit>
#include <QtGui/QRegExpValidator>
#include <QtGui/QToolBar>
#include <coreplugin/actionmanager/actionmanager.h>
......@@ -51,7 +54,6 @@
#include <find/ifindsupport.h>
#include <texteditor/fontsettings.h>
#include <texteditor/texteditorsettings.h>
#include <utils/linecolumnlabel.h>
#include <utils/reloadpromptutils.h>
using namespace BINEditor;
......@@ -176,6 +178,8 @@ public:
m_editor = parent;
connect(m_editor, SIGNAL(lazyDataRequested(Core::IEditor *, quint64, bool)),
this, SLOT(provideData(Core::IEditor *, quint64)));
connect(m_editor, SIGNAL(newRangeRequested(Core::IEditor*,quint64)),
this, SLOT(provideNewRange(Core::IEditor*,quint64)));
}
~BinEditorFile() {}
......@@ -199,15 +203,16 @@ public:
emit changed();
}
bool open(const QString &fileName) {
bool open(const QString &fileName, quint64 offset = 0) {
QFile file(fileName);
if (file.open(QIODevice::ReadOnly)) {
if (offset < static_cast<quint64>(file.size())
&& file.open(QIODevice::ReadOnly)) {
m_fileName = fileName;
if (file.isSequential() && file.size() <= 64 * 1024 * 1024) {
qint64 maxRange = 64 * 1024 * 1024;
if (file.isSequential() && file.size() <= maxRange) {
m_editor->setData(file.readAll());
} else {
m_editor->setLazyData(0, qMin(file.size(),
static_cast<qint64>(INT_MAX-16)));
m_editor->setLazyData(offset, maxRange);
m_editor->editorInterface()->
setDisplayName(QFileInfo(fileName).fileName());
}
......@@ -224,12 +229,18 @@ private slots:
int blockSize = m_editor->lazyDataBlockSize();
file.seek(block * blockSize);
QByteArray data = file.read(blockSize);
if (data.size() != blockSize)
data.resize(blockSize);
const int dataSize = data.size();
if (dataSize != blockSize)
data += QByteArray(blockSize - dataSize, 0);
m_editor->addLazyData(block, data);
file.close();
}
}
void provideNewRange(Core::IEditor *, quint64 offset) {
open(m_fileName, offset);
}
public:
void setFilename(const QString &filename) {
......@@ -294,22 +305,30 @@ public:
m_file = new BinEditorFile(m_editor);
m_context.add(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
m_context.add(Constants::C_BINEDITOR);
m_cursorPositionLabel = new Utils::LineColumnLabel;
m_addressEdit = new QLineEdit;
QRegExpValidator * const addressValidator
= new QRegExpValidator(QRegExp(QLatin1String("[0-9a-fA-F]{1,16}")),
m_addressEdit);
m_addressEdit->setValidator(addressValidator);
QHBoxLayout *l = new QHBoxLayout;
QWidget *w = new QWidget;
l->setMargin(0);
l->setContentsMargins(0, 0, 5, 0);
l->addStretch(1);
l->addWidget(m_cursorPositionLabel);
l->addWidget(m_addressEdit);
w->setLayout(l);
m_toolBar = new QToolBar;
m_toolBar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
m_toolBar->addWidget(w);
connect(m_editor, SIGNAL(cursorPositionChanged(int)), this, SLOT(updateCursorPosition(int)));
connect(m_editor, SIGNAL(cursorPositionChanged(int)), this,
SLOT(updateCursorPosition(int)));
connect(m_file, SIGNAL(changed()), this, SIGNAL(changed()));
connect(m_addressEdit, SIGNAL(editingFinished()), this,
SLOT(jumpToAddress()));
updateCursorPosition(m_editor->cursorPosition());
}
~BinEditorInterface() {
delete m_editor;
......@@ -342,10 +361,14 @@ public:
bool isTemporary() const { return false; }
public slots:
private slots:
void updateCursorPosition(int position) {
m_cursorPositionLabel->setText(m_editor->addressString((uint)position),
m_editor->addressString((uint)m_editor->data().size()));
m_addressEdit->setText(QString::number(m_editor->baseAddress() + position, 16));
}
void jumpToAddress() {
m_editor->jumpToAddress(m_addressEdit->text().toULongLong(0, 16));
updateCursorPosition(m_editor->cursorPosition());
}
private:
......@@ -354,7 +377,7 @@ private:
BinEditorFile *m_file;
Core::Context m_context;
QToolBar *m_toolBar;
Utils::LineColumnLabel *m_cursorPositionLabel;
QLineEdit *m_addressEdit;
};
......
......@@ -110,6 +110,9 @@ void MemoryViewAgent::createBinEditor(quint64 addr)
this, SLOT(fetchLazyData(Core::IEditor *, quint64,bool)));
connect(editor->widget(), SIGNAL(newWindowRequested(quint64)),
this, SLOT(createBinEditor(quint64)));
connect(editor->widget(),
SIGNAL(newRangeRequested(Core::IEditor *, quint64)), this,
SLOT(provideNewRange(Core::IEditor*,quint64)));
m_editors << editor;
editorManager->activateEditor(editor);
QMetaObject::invokeMethod(editor->widget(), "setNewWindowRequestAllowed");
......@@ -141,6 +144,13 @@ void MemoryViewAgent::addLazyData(QObject *editorToken, quint64 addr,
}
}
void MemoryViewAgent::provideNewRange(Core::IEditor *editor, quint64 address)
{
QMetaObject::invokeMethod(editor->widget(), "setLazyData",
Q_ARG(quint64, address), Q_ARG(int, 1024 * 1024),
Q_ARG(int, BinBlockSize));
}
///////////////////////////////////////////////////////////////////////
//
......
......@@ -58,11 +58,11 @@ public:
public slots:
// Called from Engine
void addLazyData(QObject *editorToken, quint64 addr, const QByteArray &data);
// Called from Editor
void fetchLazyData(Core::IEditor *, quint64 block, bool sync);
private:
Q_SLOT void createBinEditor(quint64 startAddr);
Q_SLOT void fetchLazyData(Core::IEditor *, quint64 block, bool sync);
Q_SLOT void provideNewRange(Core::IEditor *editor, quint64 address);
QList<QPointer<Core::IEditor> > m_editors;
QPointer<DebuggerEngine> m_engine;
......
......@@ -245,12 +245,12 @@ const char * const NEXT_KEY = "F6";
const char * const REVERSE_KEY = "";
const char * const RUN_TO_LINE_KEY = "Shift+F8";
const char * const RUN_TO_FUNCTION_KEY = "Ctrl+F6";
const char * const JUMP_TO_LINE_KEY = "Alt+D,Alt+L";
const char * const JUMP_TO_LINE_KEY = "Ctrl+D,Ctrl+L";
const char * const TOGGLE_BREAK_KEY = "F8";
const char * const BREAK_BY_FUNCTION_KEY = "Alt+D,Alt+F";
const char * const BREAK_AT_MAIN_KEY = "Alt+D,Alt+M";
const char * const ADD_TO_WATCH_KEY = "Alt+D,Alt+W";
const char * const SNAPSHOT_KEY = "Alt+D,Alt+S";
const char * const BREAK_BY_FUNCTION_KEY = "Ctrl+D,Ctrl+F";
const char * const BREAK_AT_MAIN_KEY = "Ctrl+D,Ctrl+M";
const char * const ADD_TO_WATCH_KEY = "Ctrl+D,Ctrl+W";
const char * const SNAPSHOT_KEY = "Ctrl+D,Ctrl+S";
#else
const char * const INTERRUPT_KEY = "Shift+F5";
const char * const RESET_KEY = "Ctrl+Shift+F5";
......@@ -265,7 +265,7 @@ const char * const TOGGLE_BREAK_KEY = "F9";
const char * const BREAK_BY_FUNCTION_KEY = "";
const char * const BREAK_AT_MAIN_KEY = "";
const char * const ADD_TO_WATCH_KEY = "Ctrl+Alt+Q";
const char * const SNAPSHOT_KEY = "Alt+D,Alt+S";
const char * const SNAPSHOT_KEY = "Ctrl+D,Ctrl+S";
#endif
} // namespace Constants
......@@ -1400,7 +1400,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
cmd = am->registerAction(m_actions.watchAction1,
Constants::ADD_TO_WATCH1, cppeditorcontext);
cmd->action()->setEnabled(true);
//cmd->setDefaultKeySequence(QKeySequence(tr("ALT+D,ALT+W")));
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+W")));
m_uiSwitcher->addMenuAction(cmd, Constants::LANG_CPP);
......
......@@ -189,7 +189,7 @@ void GitCommand::run()
// Special hack: Always produce output for diff
if (ok && stdOut.isEmpty() && m_jobs.front().arguments.at(0) == QLatin1String("diff")) {
stdOut += "The file does not differ from HEAD";
stdOut += "No difference to HEAD";
} else {
// @TODO: Remove, see below
if (ok && m_jobs.front().arguments.at(0) == QLatin1String("status"))
......
......@@ -116,20 +116,25 @@ QString DebuggingHelperLibrary::debuggingHelperLibraryByInstallData(const QStrin
if (!Core::ICore::instance())
return QString();
const QString dumperSourcePath = Core::ICore::instance()->resourcePath() + QLatin1String("/gdbmacros/");
QDateTime lastModified = QFileInfo(dumperSourcePath + "gdbmacros.cpp").lastModified();
QDateTime sourcesModified = QFileInfo(dumperSourcePath + "gdbmacros.cpp").lastModified();
// We pretend that the lastmodified of gdbmacros.cpp is 5 minutes before what the file system says
// Because afer a installation from the package the modified dates of gdbmacros.cpp
// and the actual library are close to each other, but not deterministic in one direction
lastModified = lastModified.addSecs(-300);
sourcesModified = sourcesModified.addSecs(-300);
// look for the newest helper library in the different locations
QString newestHelper;
QDateTime newestHelperModified = sourcesModified; // prevent using one that's older than the sources
QFileInfo fileInfo;
foreach(const QString &directory, debuggingHelperLibraryDirectories(qtInstallData)) {
if (getHelperFileInfoFor(directory, &fileInfo)) {
if (fileInfo.lastModified() >= lastModified)
return fileInfo.filePath();
if (fileInfo.lastModified() > newestHelperModified) {
newestHelper = fileInfo.filePath();
newestHelperModified = fileInfo.lastModified();
}
}
}
return QString();
return newestHelper;
}
// Copy helper source files to a target directory, replacing older files.
......
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