Commit 5849db08 authored by mae's avatar mae
Browse files

Merge branch '1.1' of git@scm.dev.nokia.troll.no:creator/mainline into 1.1

parents fa634748 085dcd7d
......@@ -25,7 +25,6 @@ Editing
* Add signal/slot editor to form editor.
* Improved open documents view (sorted, single-click, close buttons).
* Copying text from the context help browser and output windows didn't work.
* Fixed "Go to slot..." functionality in the integrated QDesigner
Building, Running and Debugging
* Experimental support for generic Makefile based projects.
......@@ -36,6 +35,23 @@ Building, Running and Debugging
* Possibility to attach debugger to core files.
* Debugger understands std::set now.
Wizards
* It is now possible to choose file suffixes in the options dialog.
* Code of language change event is now generated correctly (added call
to base class).
Designer
* Added signal/slot editor.
* Fixed "Goto slot" (formatting/multiple inheritance).
Version control plugins
* Fixed handling of colored git output.
* Made svn 1.6 work.
* Added syntax highlighting to the git submit editor.
* Made git submit editor remove comment lines.
* Added configuration options for submit editors (user fields, word
wrapping).
Platform Specific
Mac
......
......@@ -179,7 +179,7 @@ static inline QStringList getPluginPaths()
// 1) "plugins" (Win/Linux)
QString pluginPath = rootDirPath;
pluginPath += QDir::separator();
#ifdef QT_ARCH_X86_64
#if defined(QT_ARCH_X86_64) && defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
pluginPath += QLatin1String("lib64");
#else
pluginPath += QLatin1String("lib");
......
......@@ -272,7 +272,7 @@ void NavigationWidget::restoreSettings(QSettings *settings)
} else {
QList<int> sizes;
sizes += 256;
for (int i = views.size()-1; i; --i)
for (int i = views.size()-1; i > 0; --i)
sizes.prepend(512);
setSizes(sizes);
}
......
......@@ -149,6 +149,9 @@ DebuggerSettings *theDebuggerSettings()
item = new SavedAction(instance);
instance->insertItem(AssignValue, item);
item = new SavedAction(instance);
instance->insertItem(AssignType, item);
item = new SavedAction(instance);
instance->insertItem(ExpandItem, item);
item->setText(QObject::tr("Expand item"));
......
......@@ -86,6 +86,7 @@ enum DebuggerActionCode
WatchModelUpdate,
UseToolTips,
AssignValue,
AssignType,
ExpandItem,
CollapseItem,
......
......@@ -520,9 +520,11 @@ Qt::ItemFlags WatchHandler::flags(const QModelIndex &idx) const
const WatchData &data = m_displaySet.at(node);
if (data.isWatcher() && idx.column() == 0)
return editable; // watcher names are
if (idx.column() == 1)
return editable; // values are editable
return editable; // watcher names are editable
if (data.isWatcher() && idx.column() == 2)
return editable; // watcher types are
if (idx.column() == 1)
return editable; // locals and watcher values are editable
return notEditable;
}
......
......@@ -87,6 +87,9 @@ public:
if (index.column() == 1) {
// the value column
theDebuggerAction(AssignValue)->trigger(exp + '=' + value);
} else if (index.column() == 2) {
// the type column
theDebuggerAction(AssignType)->trigger(exp + '=' + value);
} else if (index.column() == 0) {
// the watcher name column
theDebuggerAction(RemoveWatchExpression)->trigger(exp);
......@@ -139,11 +142,16 @@ void WatchWindow::collapseNode(const QModelIndex &idx)
void WatchWindow::keyPressEvent(QKeyEvent *ev)
{
if (ev->key() == Qt::Key_Delete) {
if (ev->key() == Qt::Key_Delete && m_type == WatchersType) {
QModelIndex idx = currentIndex();
QModelIndex idx1 = idx.sibling(idx.row(), 0);
QString exp = model()->data(idx1).toString();
theDebuggerAction(RemoveWatchExpression)->setValue(exp);
theDebuggerAction(RemoveWatchExpression)->trigger(exp);
} else if (ev->key() == Qt::Key_Return && m_type == LocalsType) {
QModelIndex idx = currentIndex();
QModelIndex idx1 = idx.sibling(idx.row(), 0);
QString exp = model()->data(idx1).toString();
theDebuggerAction(WatchExpression)->trigger(exp);
}
QTreeView::keyPressEvent(ev);
}
......
......@@ -260,7 +260,6 @@ public:
// helper functions for indenting
bool isElectricCharacter(QChar c) const
{ return c == '{' || c == '}' || c == '#'; }
int indentDist() const;
void indentRegion(QChar lastTyped = QChar());
void shiftRegionLeft(int repeat = 1);
void shiftRegionRight(int repeat = 1);
......@@ -386,6 +385,12 @@ public:
int m_cursorWidth;
// auto-indent
void insertAutomaticIndentation(bool goingDown);
bool removeAutomaticIndentation(); // true if something removed
// number of autoindented characters
int m_justAutoIndented;
void recordJump();
void recordNewUndo();
QList<int> m_jumpListUndo;
......@@ -419,7 +424,7 @@ FakeVimHandler::Private::Private(FakeVimHandler *parent, QWidget *widget)
m_savedYankPosition = 0;
m_cursorWidth = EDITOR(cursorWidth());
m_inReplay = false;
m_justAutoIndented = 0;
}
bool FakeVimHandler::Private::wantsOverride(QKeyEvent *ev)
......@@ -492,7 +497,7 @@ EventResult FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
key += 32;
}
m_undoCursorPosition[EDITOR(document())->revision()] = m_tc.position();
m_undoCursorPosition[m_tc.document()->revision()] = m_tc.position();
if (m_mode == InsertMode)
m_tc.joinPreviousEditBlock();
else
......@@ -1218,16 +1223,11 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
m_dotCommand = QString("%1o").arg(count());
enterInsertMode();
moveToFirstNonBlankOnLine();
int numSpaces = leftDist();
if (key == 'O')
moveUp();
moveToEndOfLine();
m_tc.insertText("\n");
moveToStartOfLine();
if (0 && hasConfig(ConfigAutoIndent))
m_tc.insertText(QString(indentDist(), ' '));
else
m_tc.insertText(QString(numSpaces, ' '));
insertAutomaticIndentation(key == 'o');
} else if (key == control('o')) {
if (!m_jumpListUndo.isEmpty()) {
m_jumpListRedo.append(position());
......@@ -1423,10 +1423,12 @@ EventResult FakeVimHandler::Private::handleInsertMode(int key, int,
moveLeft(count());
m_lastInsertion.clear();
} else if (key == Key_Down) {
removeAutomaticIndentation();
m_submode = NoSubMode;
moveDown(count());
m_lastInsertion.clear();
} else if (key == Key_Up) {
removeAutomaticIndentation();
m_submode = NoSubMode;
moveUp(count());
m_lastInsertion.clear();
......@@ -1437,20 +1439,22 @@ EventResult FakeVimHandler::Private::handleInsertMode(int key, int,
m_submode = NoSubMode;
m_tc.insertBlock();
m_lastInsertion += "\n";
if (0 && hasConfig(ConfigAutoIndent))
indentRegion('\n');
insertAutomaticIndentation(true);
} else if (key == Key_Backspace || key == control('h')) {
if (!m_lastInsertion.isEmpty() || hasConfig(ConfigBackspace, "start")) {
m_tc.deletePreviousChar();
m_lastInsertion = m_lastInsertion.left(m_lastInsertion.size() - 1);
}
if (!removeAutomaticIndentation())
if (!m_lastInsertion.isEmpty() || hasConfig(ConfigBackspace, "start")) {
m_tc.deletePreviousChar();
m_lastInsertion.chop(1);
}
} else if (key == Key_Delete) {
m_tc.deleteChar();
m_lastInsertion.clear();
} else if (key == Key_PageDown || key == control('f')) {
removeAutomaticIndentation();
moveDown(count() * (linesOnScreen() - 2));
m_lastInsertion.clear();
} else if (key == Key_PageUp || key == control('b')) {
removeAutomaticIndentation();
moveUp(count() * (linesOnScreen() - 2));
m_lastInsertion.clear();
} else if (key == Key_Tab && hasConfig(ConfigExpandTab)) {
......@@ -1914,14 +1918,6 @@ void FakeVimHandler::Private::moveToFirstNonBlankOnLine()
}
}
int FakeVimHandler::Private::indentDist() const
{
int amount = 0;
int line = cursorLineInDocument();
emit q->indentRegion(&amount, line, line, QChar(' '));
return amount;
}
void FakeVimHandler::Private::indentRegion(QChar typedChar)
{
//int savedPos = anchor();
......@@ -2153,7 +2149,7 @@ void FakeVimHandler::Private::scrollUp(int count)
int FakeVimHandler::Private::lastPositionInDocument() const
{
QTextBlock block = m_tc.block().document()->lastBlock();
QTextBlock block = m_tc.document()->lastBlock();
return block.position() + block.length();
}
......@@ -2171,12 +2167,12 @@ QString FakeVimHandler::Private::selectedText() const
int FakeVimHandler::Private::firstPositionInLine(int line) const
{
return m_tc.block().document()->findBlockByNumber(line - 1).position();
return m_tc.document()->findBlockByNumber(line - 1).position();
}
int FakeVimHandler::Private::lastPositionInLine(int line) const
{
QTextBlock block = m_tc.block().document()->findBlockByNumber(line - 1);
QTextBlock block = m_tc.document()->findBlockByNumber(line - 1);
return block.position() + block.length() - 1;
}
......@@ -2213,14 +2209,14 @@ QWidget *FakeVimHandler::Private::editor() const
void FakeVimHandler::Private::undo()
{
int current = EDITOR(document())->revision();
int current = m_tc.document()->revision();
m_tc.endEditBlock();
m_needMoreUndo = false;
EDITOR(undo());
if (m_needMoreUndo)
EDITOR(undo());
m_tc.beginEditBlock();
int rev = EDITOR(document())->revision();
int rev = m_tc.document()->revision();
if (current == rev)
showBlackMessage(tr("Already at oldest change"));
else
......@@ -2231,14 +2227,14 @@ void FakeVimHandler::Private::undo()
void FakeVimHandler::Private::redo()
{
int current = EDITOR(document())->revision();
int current = m_tc.document()->revision();
m_tc.endEditBlock();
m_needMoreUndo = false;
EDITOR(redo());
if (m_needMoreUndo)
EDITOR(redo());
m_tc.beginEditBlock();
int rev = EDITOR(document())->revision();
int rev = m_tc.document()->revision();
if (rev == current)
showBlackMessage(tr("Already at newest change"));
else
......@@ -2304,6 +2300,32 @@ void FakeVimHandler::Private::recordNewUndo()
m_tc.beginEditBlock();
}
void FakeVimHandler::Private::insertAutomaticIndentation(bool goingDown)
{
if (!hasConfig(ConfigAutoIndent))
return;
QTextBlock block = goingDown ? m_tc.block().previous() : m_tc.block().next();
QString text = block.text();
int pos = 0, n = text.size();
while (pos < n && text.at(pos).isSpace())
++pos;
text.truncate(pos);
// FIXME: handle 'smartindent' and 'cindent'
m_tc.insertText(text);
m_justAutoIndented = text.size();
}
bool FakeVimHandler::Private::removeAutomaticIndentation()
{
if (!hasConfig(ConfigAutoIndent) || m_justAutoIndented == 0)
return false;
m_tc.movePosition(StartOfLine, KeepAnchor);
m_tc.removeSelectedText();
m_lastInsertion.chop(m_justAutoIndented);
m_justAutoIndented = 0;
return true;
}
///////////////////////////////////////////////////////////////////////
//
......
......@@ -152,8 +152,8 @@ StatusList parseStatusOutput(const QString &output)
if (line.size() > 8) {
const QChar state = line.at(0);
if (state == QLatin1Char('A') || state == QLatin1Char('D') || state == QLatin1Char('M')) {
const QString fileName = line.mid(7);
changeSet.push_back(SubversionSubmitEditor::StatusFilePair(QString(state), fileName));
const QString fileName = line.mid(7); // Column 8 starting from svn 1.6
changeSet.push_back(SubversionSubmitEditor::StatusFilePair(QString(state), fileName.trimmed()));
}
}
......
......@@ -116,6 +116,12 @@ private:
void testArray()
{
char c[20];
c[0] = 'a';
c[1] = 'b';
c[2] = 'c';
c[3] = 'd';
QString x[20];
x[0] = "a";
x[1] = "b";
......@@ -135,6 +141,14 @@ void testQByteArray()
QByteArray ba = "Hello";
ba += '"';
ba += "World";
const char *str1 = "\356";
const char *str2 = "\xee";
const char *str3 = "\\ee";
QByteArray buf1( str1 );
QByteArray buf2( str2 );
QByteArray buf3( str3 );
ba += char(0);
ba += 1;
ba += 2;
......@@ -399,6 +413,10 @@ void testQObject(int &argc, char *argv[])
QAction act("xxx", &app);
QString t = act.text();
t += "y";
t += "y";
t += "y";
t += "y";
t += "y";
/*
QObject ob(&app);
......
......@@ -8,4 +8,4 @@ DESTDIR = ..
SOURCES += ../app.cpp
QT += network
mesage("this says <foo & bar>")
message("this says <foo & bar>")
Supports Markdown
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