From 814b36f2ff3ba833ee684b21de9f4697a8419b4e Mon Sep 17 00:00:00 2001 From: con Date: Thu, 9 Apr 2009 12:44:12 +0200 Subject: [PATCH 01/34] Sorry, still can't embed videos, crashes too often. --- doc/qtcreator.qdoc | 32 -------------------------------- src/shared/help/helpviewer.cpp | 5 ++--- 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/doc/qtcreator.qdoc b/doc/qtcreator.qdoc index dc9672eb60b..c2129ea57ab 100644 --- a/doc/qtcreator.qdoc +++ b/doc/qtcreator.qdoc @@ -43,21 +43,6 @@ \endlist \endtable - \raw HTML -
- - - - - - - -
- \endraw - To learn more about the Qt Creator, click on one of the links below: \list @@ -1395,23 +1380,6 @@ \title Keyboard Shortcuts - \raw HTML -
- - - - - - - - -
- \endraw - - Qt Creator provides various keyboard shortcuts to aid in the development process. These shortcuts are listed in the table below: diff --git a/src/shared/help/helpviewer.cpp b/src/shared/help/helpviewer.cpp index 5aaf78ee9af..89a13358352 100644 --- a/src/shared/help/helpviewer.cpp +++ b/src/shared/help/helpviewer.cpp @@ -213,9 +213,8 @@ HelpViewer::HelpViewer(QHelpEngine *engine, CentralWidget *parent) : QWebView(parent), helpEngine(engine), parentWidget(parent) { setPage(new HelpPage(parent, helpEngine, this)); - // Enable JavaScript and Plugins for embedded videos - settings()->setAttribute(QWebSettings::PluginsEnabled, true); - settings()->setAttribute(QWebSettings::JavaEnabled, true); + settings()->setAttribute(QWebSettings::PluginsEnabled, false); + settings()->setAttribute(QWebSettings::JavaEnabled, false); page()->setNetworkAccessManager(new HelpNetworkAccessManager(engine, this)); From 353025f37fcc1730b428a2871fa49d1a805f65c7 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 9 Apr 2009 13:47:54 +0200 Subject: [PATCH 02/34] debugger: potential fix for cases where the std:: namespace is not reported properly --- share/qtcreator/gdbmacros/gdbmacros.cpp | 29 +++++++-- src/plugins/debugger/gdbengine.cpp | 12 ++-- src/plugins/debugger/watchhandler.cpp | 83 +++++++++++++++++++------ 3 files changed, 96 insertions(+), 28 deletions(-) diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index 80ab420c5fa..e688fa3fa28 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -2396,6 +2396,10 @@ static void handleProtocolVersion2and3(QDumper & d) const char *type = stripNamespace(d.outertype); // type[0] is usally 'Q', so don't use it switch (type[1]) { + case 'a': + if (isEqual(type, "map")) + qDumpStdMap(d); + break; case 'B': if (isEqual(type, "QByteArray")) qDumpQByteArray(d); @@ -2406,6 +2410,12 @@ static void handleProtocolVersion2and3(QDumper & d) else if (isEqual(type, "QDir")) qDumpQDir(d); break; + case 'e': + if (isEqual(type, "vector")) + qDumpStdVector(d); + else if (isEqual(type, "set")) + qDumpStdSet(d); + break; case 'F': if (isEqual(type, "QFile")) qDumpQFile(d); @@ -2418,6 +2428,10 @@ static void handleProtocolVersion2and3(QDumper & d) else if (isEqual(type, "QHashNode")) qDumpQHashNode(d); break; + case 'i': + if (isEqual(type, "list")) + qDumpStdList(d); + break; case 'I': if (isEqual(type, "QImage")) qDumpQImage(d); @@ -2545,18 +2559,18 @@ void qDumpObjectData440( "\""NS"QMap\"," "\""NS"QMapNode\"," "\""NS"QModelIndex\"," - #if QT_VERSION >= 0x040500 +#if QT_VERSION >= 0x040500 "\""NS"QMultiMap\"," - #endif +#endif "\""NS"QObject\"," "\""NS"QObjectMethodList\"," // hack to get nested properties display "\""NS"QObjectPropertyList\"," - #if PRIVATE_OBJECT_ALLOWED +#if PRIVATE_OBJECT_ALLOWED "\""NS"QObjectSignal\"," "\""NS"QObjectSignalList\"," "\""NS"QObjectSlot\"," "\""NS"QObjectSlotList\"," - #endif // PRIVATE_OBJECT_ALLOWED +#endif // PRIVATE_OBJECT_ALLOWED // << "\""NS"QRegion\"," "\""NS"QSet\"," "\""NS"QString\"," @@ -2565,8 +2579,15 @@ void qDumpObjectData440( "\""NS"QVariant\"," "\""NS"QVector\"," "\""NS"QWidget\"," +#ifdef Q_OS_WIN + "\"basic_string\"," + "\"list\"," + "\"map\"," + "\"set\"," "\"string\"," + "\"vector\"," "\"wstring\"," +#endif "\"std::basic_string\"," "\"std::list\"," "\"std::map\"," diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 906b38a72b1..9d2d69220a7 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -3027,7 +3027,7 @@ void GdbEngine::runDebuggingHelper(const WatchData &data0, bool dumpChildren) } else if (outertype == m_namespace + "QMapNode") { extraArgs[2] = sizeofTypeExpression(data.type); extraArgs[3] = "(size_t)&(('" + data.type + "'*)0)->value"; - } else if (outertype == "std::vector") { + } else if (outertype == "std::vector" || outertype == "vector") { //qDebug() << "EXTRACT TEMPLATE: " << outertype << inners; if (inners.at(0) == "bool") { outertype = "std::vector::bool"; @@ -3035,18 +3035,18 @@ void GdbEngine::runDebuggingHelper(const WatchData &data0, bool dumpChildren) //extraArgs[extraArgCount++] = sizeofTypeExpression(data.type); //extraArgs[extraArgCount++] = "(size_t)&(('" + data.type + "'*)0)->value"; } - } else if (outertype == "std::deque") { + } else if (outertype == "std::deque" || outertype == "deque") { // remove 'std::allocator<...>': extraArgs[1] = "0"; - } else if (outertype == "std::stack") { + } else if (outertype == "std::stack" || outertype == "stack") { // remove 'std::allocator<...>': extraArgs[1] = "0"; - } else if (outertype == "std::set") { + } else if (outertype == "std::set" || outertype == "set") { // remove 'std::less<...>': extraArgs[1] = "0"; // remove 'std::allocator<...>': extraArgs[2] = "0"; - } else if (outertype == "std::map") { + } else if (outertype == "std::map" || outertype == "map") { // We don't want the comparator and the allocator confuse gdb. // But we need the offset of the second item in the value pair. // We read the type of the pair from the allocator argument because @@ -3057,7 +3057,7 @@ void GdbEngine::runDebuggingHelper(const WatchData &data0, bool dumpChildren) pairType = pairType.mid(15, pairType.size() - 15 - 2); extraArgs[2] = "(size_t)&(('" + pairType + "'*)0)->second"; extraArgs[3] = "0"; - } else if (outertype == "std::basic_string") { + } else if (outertype == "std::basic_string" || outertype == "basic_string") { //qDebug() << "EXTRACT TEMPLATE: " << outertype << inners; if (inners.at(0) == "char") { outertype = "std::string"; diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 9ccfb791d62..bd5b799049e 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -356,54 +356,101 @@ WatchHandler::WatchHandler() SIGNAL(triggered()), this, SLOT(collapseChildren())); } +static QString chopConst(QString type) +{ + while (1) { + if (type.startsWith("const")) + type = type.mid(5); + else if (type.startsWith(' ')) + type = type.mid(1); + else if (type.endsWith("const")) + type.chop(5); + else if (type.endsWith(' ')) + type.chop(1); + else + break; + } + return type; +} + static QString niceType(QString type) { if (type.contains(QLatin1String("std::"))) { // std::string - type.replace(QLatin1String("std::basic_string, " - "std::allocator >"), QLatin1String("std::string")); + type.replace(QLatin1String("basic_string, " + "std::allocator >"), QLatin1String("string")); // std::wstring - type.replace(QLatin1String("std::basic_string, " - "std::allocator >"), QLatin1String("std::wstring")); + type.replace(QLatin1String("basic_string, " + "std::allocator >"), QLatin1String("wstring")); // std::vector - static QRegExp re1(QLatin1String("std::vector<(.*), std::allocator<(.*)>\\s*>")); + static QRegExp re1(QLatin1String("vector<(.*), std::allocator<(.*)>\\s*>")); re1.setMinimal(true); for (int i = 0; i != 10; ++i) { if (re1.indexIn(type) == -1 || re1.cap(1) != re1.cap(2)) break; - type.replace(re1.cap(0), QLatin1String("std::vector<") + re1.cap(1) + QLatin1Char('>')); + type.replace(re1.cap(0), QLatin1String("vector<") + re1.cap(1) + QLatin1Char('>')); + } + + // std::deque + static QRegExp re5(QLatin1String("deque<(.*), std::allocator<(.*)>\\s*>")); + re5.setMinimal(true); + for (int i = 0; i != 10; ++i) { + if (re5.indexIn(type) == -1 || re5.cap(1) != re5.cap(2)) + break; + type.replace(re5.cap(0), QLatin1String("deque<") + re5.cap(1) + QLatin1Char('>')); + } + + // std::stack + static QRegExp re6(QLatin1String("stack<(.*), std::deque<(.*), std::allocator<(.*)>\\s*> >")); + re6.setMinimal(true); + for (int i = 0; i != 10; ++i) { + if (re6.indexIn(type) == -1 || re6.cap(1) != re6.cap(2) + || re6.cap(1) != re6.cap(2)) + break; + type.replace(re6.cap(0), QLatin1String("stack<") + re6.cap(1) + QLatin1Char('>')); } // std::list - static QRegExp re2(QLatin1String("std::list<(.*), std::allocator<(.*)>\\s*>")); + static QRegExp re2(QLatin1String("list<(.*), std::allocator<(.*)>\\s*>")); re2.setMinimal(true); for (int i = 0; i != 10; ++i) { if (re2.indexIn(type) == -1 || re2.cap(1) != re2.cap(2)) break; - type.replace(re2.cap(0), QLatin1String("std::list<") + re2.cap(1) + QLatin1Char('>')); + type.replace(re2.cap(0), QLatin1String("list<") + re2.cap(1) + QLatin1Char('>')); } // std::map - static QRegExp re3(QLatin1String("std::map<(.*), (.*), std::less<(.*)\\s*>, " - "std::allocator > >")); - re3.setMinimal(true); - for (int i = 0; i != 10; ++i) { - if (re3.indexIn(type) == -1 || re3.cap(1) != re3.cap(3) - || re3.cap(1) != re3.cap(4) || re3.cap(2) != re3.cap(5)) - break; - type.replace(re3.cap(0), QLatin1String("std::map<") + re3.cap(1) + QLatin1String(", ") + re3.cap(2) + QLatin1Char('>')); + { + static QRegExp re(QLatin1String("map<(.*), (.*), std::less<(.*)>, " + "std::allocator > >")); + re.setMinimal(true); + for (int i = 0; i != 10; ++i) { + if (re.indexIn(type) == -1) + break; + QString key = chopConst(re.cap(1)); + QString value = chopConst(re.cap(2)); + QString key1 = chopConst(re.cap(3)); + QString key2 = chopConst(re.cap(4)); + QString value2 = chopConst(re.cap(5)); + if (value != value2 || key != key1 || key != key2) { + qDebug() << key << key1 << key2 << value << value2 + << (key == key1) << (key == key2) << (value == value2); + break; + } + type.replace(re.cap(0), QString("map<%1, %2>").arg(key).arg(value)); + } } // std::set - static QRegExp re4(QLatin1String("std::set<(.*), std::less<(.*)>, std::allocator<(.*)>\\s*>")); + static QRegExp re4(QLatin1String("set<(.*), std::less<(.*)>, std::allocator<(.*)>\\s*>")); re1.setMinimal(true); for (int i = 0; i != 10; ++i) { if (re4.indexIn(type) == -1 || re4.cap(1) != re4.cap(2) || re4.cap(1) != re4.cap(3)) break; - type.replace(re4.cap(0), QLatin1String("std::set<") + re4.cap(1) + QLatin1Char('>')); + type.replace(re4.cap(0), QLatin1String("set<") + re4.cap(1) + QLatin1Char('>')); } type.replace(QLatin1String(" >"), QString(QLatin1Char('>'))); From 57aad474601859c49297c6841356fe6c0f922014 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 9 Apr 2009 13:48:59 +0200 Subject: [PATCH 03/34] fakevim: work on autotests --- src/plugins/fakevim/fakevimhandler.cpp | 14 ++++++++++---- tests/auto/fakevim/main.cpp | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index f26d0ffcff4..0b440dc1b33 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -607,22 +607,28 @@ EventResult FakeVimHandler::Private::handleKey(int key, int unmodified, void FakeVimHandler::Private::moveDown(int n) { - // m_tc.movePosition(Down, MoveAnchor, n); does not work for "hidden" - // documents like in the autotests +#if 0 + // does not work for "hidden" documents like in the autotests + m_tc.movePosition(Down, MoveAnchor, n); +#else const QTextBlock &block = m_tc.block(); const int col = m_tc.position() - block.position(); const int line = block.blockNumber(); const int pos = m_tc.document()->findBlockByNumber(line + n).position(); setPosition(pos + qMin(block.length(), col)); setPosition(pos); +#endif } void FakeVimHandler::Private::moveToEndOfLine() { - // m_tc.movePosition(EndOfLine, MoveAnchor) does not work for "hidden" - // documents like in the autotests +#if 0 + // does not work for "hidden" documents like in the autotests + m_tc.movePosition(EndOfLine, MoveAnchor); +#else const QTextBlock &block = m_tc.block(); setPosition(block.position() + block.length() - 1); +#endif } void FakeVimHandler::Private::finishMovement(const QString &dotCommand) diff --git a/tests/auto/fakevim/main.cpp b/tests/auto/fakevim/main.cpp index b82f1a13bcb..d6b124f3716 100644 --- a/tests/auto/fakevim/main.cpp +++ b/tests/auto/fakevim/main.cpp @@ -30,6 +30,8 @@ #include "fakevimhandler.h" #include + +#include #include #include @@ -66,6 +68,7 @@ private: const char* file, int line); QString insertCursor(const QString &needle0); + //QTextEdit m_editor; QPlainTextEdit m_editor; FakeVimHandler m_handler; QList m_selection; From 407ebe69b3f7bd69e8a684dd291b514f46bd7530 Mon Sep 17 00:00:00 2001 From: con Date: Thu, 9 Apr 2009 18:15:10 +0200 Subject: [PATCH 04/34] Remove duplicates. --- dist/changes-1.1.0 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dist/changes-1.1.0 b/dist/changes-1.1.0 index 28e9f0c9b61..3fa27a9763c 100644 --- a/dist/changes-1.1.0 +++ b/dist/changes-1.1.0 @@ -18,9 +18,6 @@ Editing * Improved function argument hint. * More checkpoints in editor history. * Ctrl-click for jumping to a symbol definition. - * Context help for form editor widgets. - * Goto slot from form editor now works with multiple inheritance. - * 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. @@ -36,7 +33,7 @@ Debugging no dumper buildstep anymore. * New dumper for std::set. Improved QString, QVariant, std::wstring * Make strategy to load shared objects configurable (auto-solib-add). - * Maximum stack depth configurable. + * Increase number of shown stack frames on request instead of loading them all. * Improved interaction in the Locals&Watchers view. Wizards @@ -48,6 +45,7 @@ Wizards Designer * Added signal/slot editor. * Fixed "Goto slot" (formatting/multiple inheritance). + * Context help for form editor widgets. Version control plugins * Fixed handling of colored git output. From 268f460f7d458e87213f5c2bb93b551f338d762b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Fri, 10 Apr 2009 02:40:16 +0200 Subject: [PATCH 05/34] Fixed dialog title for selecting core file --- src/plugins/debugger/debuggerdialogs.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index c4c517327e7..483ad82a1e6 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -131,7 +131,7 @@ AttachCoreDialog::AttachCoreDialog(QWidget *parent) m_ui->execFileName->setPromptDialogTitle(tr("Select Executable")); m_ui->coreFileName->setExpectedKind(Core::Utils::PathChooser::File); - m_ui->coreFileName->setPromptDialogTitle(tr("Select Executable")); + m_ui->coreFileName->setPromptDialogTitle(tr("Select Core File")); m_ui->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); From 04e2fc1217398350a9ccd696eb02e45ce6ed8e70 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 9 Apr 2009 14:43:04 +0200 Subject: [PATCH 06/34] fakevim: work on tests --- tests/auto/fakevim/main.cpp | 78 ++++++++++++++++++++++++++----------- 1 file changed, 55 insertions(+), 23 deletions(-) diff --git a/tests/auto/fakevim/main.cpp b/tests/auto/fakevim/main.cpp index d6b124f3716..e18bd839176 100644 --- a/tests/auto/fakevim/main.cpp +++ b/tests/auto/fakevim/main.cpp @@ -39,13 +39,15 @@ using namespace FakeVim; using namespace FakeVim::Internal; +#define EDITOR(s) (m_textedit ? m_textedit->s : m_plaintextedit->s) class tst_FakeVim : public QObject { Q_OBJECT public: - tst_FakeVim(); + tst_FakeVim(bool); + ~tst_FakeVim(); public slots: void changeStatusData(const QString &info) { m_statusData = info; } @@ -68,9 +70,9 @@ private: const char* file, int line); QString insertCursor(const QString &needle0); - //QTextEdit m_editor; - QPlainTextEdit m_editor; - FakeVimHandler m_handler; + QTextEdit *m_textedit; + QPlainTextEdit *m_plaintextedit; + FakeVimHandler *m_handler; QList m_selection; QString m_statusMessage; @@ -95,46 +97,68 @@ const QString tst_FakeVim::lines = const QString tst_FakeVim::escape = QChar(27); -tst_FakeVim::tst_FakeVim() - : m_handler(&m_editor, this) +tst_FakeVim::tst_FakeVim(bool usePlainTextEdit) { - QObject::connect(&m_handler, SIGNAL(commandBufferChanged(QString)), + if (usePlainTextEdit) { + m_textedit = 0; + m_plaintextedit = new QPlainTextEdit; + m_handler = new FakeVimHandler(m_plaintextedit); + } else { + m_textedit = new QTextEdit; + m_plaintextedit = 0; + m_handler = new FakeVimHandler(m_textedit); + } + + QObject::connect(m_handler, SIGNAL(commandBufferChanged(QString)), this, SLOT(changeStatusMessage(QString))); - QObject::connect(&m_handler, SIGNAL(extraInformationChanged(QString)), + QObject::connect(m_handler, SIGNAL(extraInformationChanged(QString)), this, SLOT(changeExtraInformation(QString))); - QObject::connect(&m_handler, SIGNAL(statusDataChanged(QString)), + QObject::connect(m_handler, SIGNAL(statusDataChanged(QString)), this, SLOT(changeStatusData(QString))); } +tst_FakeVim::~tst_FakeVim() +{ + delete m_handler; + delete m_textedit; + delete m_plaintextedit; +} + void tst_FakeVim::setup() { m_statusMessage.clear(); m_statusData.clear(); m_infoMessage.clear(); - m_editor.setPlainText(lines); - QTextCursor tc = m_editor.textCursor(); - tc.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor); - m_editor.setTextCursor(tc); - m_editor.setPlainText(lines); - //m_editor.show(); - //qApp->exec(); - QCOMPARE(m_editor.toPlainText(), lines); + if (m_textedit) { + m_textedit->setPlainText(lines); + QTextCursor tc = m_textedit->textCursor(); + tc.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor); + m_textedit->setTextCursor(tc); + m_textedit->setPlainText(lines); + } else { + m_plaintextedit->setPlainText(lines); + QTextCursor tc = m_plaintextedit->textCursor(); + tc.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor); + m_plaintextedit->setTextCursor(tc); + m_plaintextedit->setPlainText(lines); + } + QCOMPARE(EDITOR(toPlainText()), lines); } void tst_FakeVim::send(const QString &command) { - m_handler.handleCommand("normal " + command); + m_handler->handleCommand("normal " + command); } void tst_FakeVim::sendEx(const QString &command) { - m_handler.handleCommand(command); + m_handler->handleCommand(command); } bool tst_FakeVim::checkContentsHelper(QString want, const char* file, int line) { - QString got = m_editor.toPlainText(); - int pos = m_editor.textCursor().position(); + QString got = EDITOR(toPlainText()); + int pos = EDITOR(textCursor().position()); got = got.left(pos) + "@" + got.mid(pos); QStringList wantlist = want.split('\n'); QStringList gotlist = got.split('\n'); @@ -242,8 +266,16 @@ void tst_FakeVim::commandUp() check("4j", insertCursor("@ return app.exec()")); } +int main(int argc, char *argv[]) \ +{ + int res = 0; + QApplication app(argc, argv); \ + tst_FakeVim plaintextedit(true); + res += QTest::qExec(&plaintextedit, argc, argv); + tst_FakeVim textedit(false); + res += QTest::qExec(&textedit, argc, argv); + return res; +} -QTEST_MAIN(tst_FakeVim) - #include "main.moc" From e76ba64f6873810d3bec236824a3551f9fbde32b Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 9 Apr 2009 15:44:51 +0200 Subject: [PATCH 07/34] fakevim: work on autotests --- src/plugins/fakevim/fakevimhandler.cpp | 21 +++++---- tests/auto/fakevim/main.cpp | 65 ++++++++++++++++++-------- 2 files changed, 56 insertions(+), 30 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 0b440dc1b33..9907ce5c36a 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -611,12 +611,12 @@ void FakeVimHandler::Private::moveDown(int n) // does not work for "hidden" documents like in the autotests m_tc.movePosition(Down, MoveAnchor, n); #else - const QTextBlock &block = m_tc.block(); - const int col = m_tc.position() - block.position(); - const int line = block.blockNumber(); - const int pos = m_tc.document()->findBlockByNumber(line + n).position(); - setPosition(pos + qMin(block.length(), col)); - setPosition(pos); + const int col = m_tc.position() - m_tc.block().position(); + const int line = m_tc.block().blockNumber(); + const QTextBlock &block = m_tc.document()->findBlockByNumber(line + n); + const int pos = block.position(); + setPosition(pos + qMin(block.length() - 1, col)); + moveToTargetColumn(); #endif } @@ -1675,7 +1675,6 @@ void FakeVimHandler::Private::selectRange(int beginLine, int endLine) void FakeVimHandler::Private::handleCommand(const QString &cmd) { m_tc = EDITOR(textCursor()); - init(); handleExCommand(cmd); EDITOR(setTextCursor(m_tc)); } @@ -2042,10 +2041,12 @@ void FakeVimHandler::Private::shiftRegionLeft(int repeat) void FakeVimHandler::Private::moveToTargetColumn() { - if (m_targetColumn == -1 || m_tc.block().length() <= m_targetColumn) - m_tc.movePosition(EndOfLine, KeepAnchor); - else + if (m_targetColumn == -1 || m_tc.block().length() <= m_targetColumn) { + const QTextBlock &block = m_tc.block(); + m_tc.setPosition(block.position() + block.length() - 1, KeepAnchor); + } else { m_tc.setPosition(m_tc.block().position() + m_targetColumn, KeepAnchor); + } } static int charClass(QChar c, bool simple) diff --git a/tests/auto/fakevim/main.cpp b/tests/auto/fakevim/main.cpp index e18bd839176..9003da818c1 100644 --- a/tests/auto/fakevim/main.cpp +++ b/tests/auto/fakevim/main.cpp @@ -62,7 +62,7 @@ private slots: private: void setup(); - void send(const QString &command); // send a normal command + void send(const QString &command) { sendEx("normal " + command); } void sendEx(const QString &command); // send an ex command bool checkContentsHelper(QString expected, const char* file, int line); @@ -84,6 +84,8 @@ private: }; const QString tst_FakeVim::lines = + /* 0 1 2 3 4 */ + /* 0123456789012345678901234567890123457890 */ "\n" "#include \n" "#include \n" @@ -102,19 +104,11 @@ tst_FakeVim::tst_FakeVim(bool usePlainTextEdit) if (usePlainTextEdit) { m_textedit = 0; m_plaintextedit = new QPlainTextEdit; - m_handler = new FakeVimHandler(m_plaintextedit); } else { m_textedit = new QTextEdit; m_plaintextedit = 0; - m_handler = new FakeVimHandler(m_textedit); } - - QObject::connect(m_handler, SIGNAL(commandBufferChanged(QString)), - this, SLOT(changeStatusMessage(QString))); - QObject::connect(m_handler, SIGNAL(extraInformationChanged(QString)), - this, SLOT(changeExtraInformation(QString))); - QObject::connect(m_handler, SIGNAL(statusDataChanged(QString)), - this, SLOT(changeStatusData(QString))); + m_handler = 0; } tst_FakeVim::~tst_FakeVim() @@ -126,6 +120,8 @@ tst_FakeVim::~tst_FakeVim() void tst_FakeVim::setup() { + delete m_handler; + m_handler = 0; m_statusMessage.clear(); m_statusData.clear(); m_infoMessage.clear(); @@ -135,24 +131,32 @@ void tst_FakeVim::setup() tc.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor); m_textedit->setTextCursor(tc); m_textedit->setPlainText(lines); + m_handler = new FakeVimHandler(m_textedit); } else { m_plaintextedit->setPlainText(lines); QTextCursor tc = m_plaintextedit->textCursor(); tc.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor); m_plaintextedit->setTextCursor(tc); m_plaintextedit->setPlainText(lines); + m_handler = new FakeVimHandler(m_plaintextedit); } - QCOMPARE(EDITOR(toPlainText()), lines); -} -void tst_FakeVim::send(const QString &command) -{ - m_handler->handleCommand("normal " + command); + QObject::connect(m_handler, SIGNAL(commandBufferChanged(QString)), + this, SLOT(changeStatusMessage(QString))); + QObject::connect(m_handler, SIGNAL(extraInformationChanged(QString)), + this, SLOT(changeExtraInformation(QString))); + QObject::connect(m_handler, SIGNAL(statusDataChanged(QString)), + this, SLOT(changeStatusData(QString))); + + QCOMPARE(EDITOR(toPlainText()), lines); } void tst_FakeVim::sendEx(const QString &command) { - m_handler->handleCommand(command); + if (m_handler) + m_handler->handleCommand(command); + else + qDebug() << "NO HANDLER YET"; } bool tst_FakeVim::checkContentsHelper(QString want, const char* file, int line) @@ -210,14 +214,13 @@ QString tst_FakeVim::insertCursor(const QString &needle0) QString needle = needle0; needle.remove('@'); QString lines0 = lines; - lines0.replace(needle, needle0); - //qDebug() << "LINES: " << lines0; + int pos = lines0.indexOf(needle); + lines0.replace(pos, needle.size(), needle0); return lines0; } void tst_FakeVim::commandI() { - return; setup(); // empty insertion at start of document @@ -232,6 +235,8 @@ void tst_FakeVim::commandI() check("ixxx" + escape, "xx@x" + lines); check("u", "@" + lines); + return; + // combine insertions check("ia" + escape, "@a" + lines); check("ibx" + escape, "b@xa" + lines); @@ -247,7 +252,8 @@ void tst_FakeVim::commandDollar() { setup(); check("j$", insertCursor("@")); - //check("j", insertCursor("@")); + check("j$", insertCursor("@")); + check("2j", insertCursor(")@")); } void tst_FakeVim::commandDown() @@ -266,14 +272,33 @@ void tst_FakeVim::commandUp() check("4j", insertCursor("@ return app.exec()")); } +/* +#include +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + return app.exec(); +} +*/ + int main(int argc, char *argv[]) \ { int res = 0; QApplication app(argc, argv); \ + + // Test with QPlainTextEdit. tst_FakeVim plaintextedit(true); res += QTest::qExec(&plaintextedit, argc, argv); + +#if 0 + // Test with QTextEdit, too. tst_FakeVim textedit(false); res += QTest::qExec(&textedit, argc, argv); +#endif + return res; } From 3e6285358dea02b8b449f0b0c578f69ea131175c Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 9 Apr 2009 16:20:49 +0200 Subject: [PATCH 08/34] fakevim: fix positioning after 'w' was broken during the changes to the "target column" logic --- src/plugins/fakevim/fakevimhandler.cpp | 14 ++++++ tests/auto/fakevim/main.cpp | 59 +++++++++++++++++++++----- 2 files changed, 62 insertions(+), 11 deletions(-) diff --git a/src/plugins/fakevim/fakevimhandler.cpp b/src/plugins/fakevim/fakevimhandler.cpp index 9907ce5c36a..50385d9c6ac 100644 --- a/src/plugins/fakevim/fakevimhandler.cpp +++ b/src/plugins/fakevim/fakevimhandler.cpp @@ -50,6 +50,7 @@ #include + #include #include #include @@ -2049,6 +2050,14 @@ void FakeVimHandler::Private::moveToTargetColumn() } } +/* if simple is given: + * class 0: spaces + * class 1: non-spaces + * else + * class 0: spaces + * class 1: non-space-or-letter-or-number + * class 2: letter-or-number + */ static int charClass(QChar c, bool simple) { if (simple) @@ -2066,6 +2075,7 @@ void FakeVimHandler::Private::moveToWordBoundary(bool simple, bool forward) int lastClass = -1; while (true) { QChar c = doc->characterAt(m_tc.position() + (forward ? 1 : -1)); + qDebug() << "EXAMINING: " << c << " AT " << position(); int thisClass = charClass(c, simple); if (thisClass != lastClass && lastClass != 0) --repeat; @@ -2076,6 +2086,7 @@ void FakeVimHandler::Private::moveToWordBoundary(bool simple, bool forward) break; forward ? moveRight() : moveLeft(); } + setTargetColumn(); } void FakeVimHandler::Private::handleFfTt(int key) @@ -2111,6 +2122,7 @@ void FakeVimHandler::Private::handleFfTt(int key) break; } } + setTargetColumn(); } void FakeVimHandler::Private::moveToNextWord(bool simple) @@ -2131,6 +2143,7 @@ void FakeVimHandler::Private::moveToNextWord(bool simple) if (m_tc.position() == n) break; } + setTargetColumn(); } void FakeVimHandler::Private::moveToMatchingParanthesis() @@ -2144,6 +2157,7 @@ void FakeVimHandler::Private::moveToMatchingParanthesis() if (m_submode == NoSubMode || m_submode == ZSubMode || m_submode == RegisterSubMode) m_tc.movePosition(Left, KeepAnchor, 1); } + setTargetColumn(); } int FakeVimHandler::Private::cursorLineOnScreen() const diff --git a/tests/auto/fakevim/main.cpp b/tests/auto/fakevim/main.cpp index 9003da818c1..a1ac3be7826 100644 --- a/tests/auto/fakevim/main.cpp +++ b/tests/auto/fakevim/main.cpp @@ -55,10 +55,13 @@ public slots: void changeExtraInformation(const QString &info) { m_infoMessage = info; } private slots: - void commandI(); void commandDollar(); void commandDown(); + void commandLeft(); + void commandRight(); + void commandI(); void commandUp(); + void commandW(); private: void setup(); @@ -203,6 +206,10 @@ bool tst_FakeVim::checkHelper(bool ex, QString cmd, QString expected, do { if (!checkHelper(false, cmd, expected, __FILE__, __LINE__)) \ return; } while (0) +#define move(cmd, expected) \ + do { if (!checkHelper(false, cmd, insertCursor(expected), __FILE__, __LINE__)) \ + return; } while (0) + // Runs an ex command and checks the result. // Cursor position is marked by a '@' in the expected contents. #define checkEx(cmd, expected) \ @@ -235,7 +242,7 @@ void tst_FakeVim::commandI() check("ixxx" + escape, "xx@x" + lines); check("u", "@" + lines); - return; +return; // combine insertions check("ia" + escape, "@a" + lines); @@ -251,27 +258,57 @@ void tst_FakeVim::commandI() void tst_FakeVim::commandDollar() { setup(); - check("j$", insertCursor("@")); - check("j$", insertCursor("@")); - check("2j", insertCursor(")@")); + move("j$", "@"); + move("j$", "@"); + move("2j", ")@"); } void tst_FakeVim::commandDown() { setup(); - check("j", insertCursor("@#include #include From 570884931b5500153085c3e803789de2a535176b Mon Sep 17 00:00:00 2001 From: con Date: Tue, 14 Apr 2009 09:43:39 +0200 Subject: [PATCH 09/34] Ignore qtcreator_process_stub. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2c79a07b759..e0c76e75e46 100644 --- a/.gitignore +++ b/.gitignore @@ -74,6 +74,7 @@ src/xml/lib/ # -------- bin/*.dll bin/qtcreator.bin +bin/qtcreator_process_stub bin/qtcreator.exe doc/qtcreator.qch tests/manual/cplusplus/cplusplus0 From 9ec1737db15c12f71992211606dc66d338917108 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 14 Apr 2009 10:08:40 +0200 Subject: [PATCH 10/34] disambiguate IContext for vc9 --- src/plugins/coreplugin/editormanager/editormanager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index dbfcc44c801..17d46349d55 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -462,7 +462,7 @@ void EditorManager::removeEditor(IEditor *editor) } -void EditorManager::handleContextChange(IContext *context) +void EditorManager::handleContextChange(Core::IContext *context) { if (debugEditorManager) qDebug() << Q_FUNC_INFO; From c8c183f6b4327baf3ba8fa5c28a04fc4777b8082 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 9 Apr 2009 19:13:40 +0200 Subject: [PATCH 11/34] use temp file to pass env on unix as well the linux command line can be 32k long ... which might still be not enough. well, in fact, it just makes the 'ps' output unreadable. --- src/libs/utils/consoleprocess.h | 7 ++-- src/libs/utils/consoleprocess_unix.cpp | 27 ++++++++++++++- src/libs/utils/process_stub_unix.c | 46 ++++++++++++++++++++------ 3 files changed, 67 insertions(+), 13 deletions(-) diff --git a/src/libs/utils/consoleprocess.h b/src/libs/utils/consoleprocess.h index 53c69c91af7..821e8cb7c87 100644 --- a/src/libs/utils/consoleprocess.h +++ b/src/libs/utils/consoleprocess.h @@ -43,10 +43,13 @@ #include QT_BEGIN_NAMESPACE class QWinEventNotifier; -class QTemporaryFile; QT_END_NAMESPACE #endif +QT_BEGIN_NAMESPACE +class QTemporaryFile; +QT_END_NAMESPACE + namespace Core { namespace Utils { @@ -102,12 +105,12 @@ private: QProcess::ExitStatus m_appStatus; QLocalServer m_stubServer; QLocalSocket *m_stubSocket; + QTemporaryFile *m_tempFile; #ifdef Q_OS_WIN PROCESS_INFORMATION *m_pid; HANDLE m_hInferior; QWinEventNotifier *inferiorFinishedNotifier; QWinEventNotifier *processFinishedNotifier; - QTemporaryFile *m_tempFile; #else QProcess m_process; QByteArray m_stubServerDir; diff --git a/src/libs/utils/consoleprocess_unix.cpp b/src/libs/utils/consoleprocess_unix.cpp index 2e20ac0c37a..276d6c77f23 100644 --- a/src/libs/utils/consoleprocess_unix.cpp +++ b/src/libs/utils/consoleprocess_unix.cpp @@ -72,6 +72,22 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args) return false; } + if (!environment().isEmpty()) { + m_tempFile = new QTemporaryFile(); + if (!m_tempFile->open()) { + stubServerShutdown(); + emit processError(tr("Cannot create temp file: %1").arg(m_tempFile->errorString())); + delete m_tempFile; + m_tempFile = 0; + return false; + } + foreach (const QString &var, environment()) { + m_tempFile->write(var.toLocal8Bit()); + m_tempFile->write("", 1); + } + m_tempFile->flush(); + } + QStringList xtermArgs; xtermArgs << "-e" #ifdef Q_OS_MAC @@ -82,13 +98,16 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args) << (m_debug ? "debug" : "exec") << m_stubServer.fullServerName() << tr("Press to close this window...") - << workingDirectory() << environment() << "" + << workingDirectory() + << (m_tempFile ? m_tempFile->fileName() : 0) << program << args; m_process.start(QLatin1String("xterm"), xtermArgs); if (!m_process.waitForStarted()) { stubServerShutdown(); emit processError(tr("Cannot start console emulator xterm.")); + delete m_tempFile; + m_tempFile = 0; return false; } m_executable = program; @@ -173,6 +192,10 @@ void ConsoleProcess::readStubOutput() emit processError(tr("Cannot execute %1: %2") .arg(m_executable, errorMsg(out.mid(9).toInt()))); } else if (out.startsWith("pid ")) { + // Will not need it any more + delete m_tempFile; + m_tempFile = 0; + m_appPid = out.mid(4).toInt(); emit processStarted(); } else if (out.startsWith("exit ")) { @@ -199,6 +222,8 @@ void ConsoleProcess::stubExited() if (m_stubSocket && m_stubSocket->state() == QLocalSocket::ConnectedState) m_stubSocket->waitForDisconnected(); stubServerShutdown(); + delete m_tempFile; + m_tempFile = 0; if (m_appPid) { m_appStatus = QProcess::CrashExit; m_appCode = -1; diff --git a/src/libs/utils/process_stub_unix.c b/src/libs/utils/process_stub_unix.c index 92c38bb5f0d..9a319403821 100644 --- a/src/libs/utils/process_stub_unix.c +++ b/src/libs/utils/process_stub_unix.c @@ -73,18 +73,19 @@ enum { ArgSocket, ArgMsg, ArgDir, - ArgEnv + ArgEnv, + ArgExe }; -/* syntax: $0 {"run"|"debug"} "" */ +/* syntax: $0 {"run"|"debug"} */ /* exit codes: 0 = ok, 1 = invocation error, 3 = internal error */ int main(int argc, char *argv[]) { - int envIdx = ArgEnv; int errNo; int chldPid; int chldStatus; int chldPipe[2]; + char **env = 0; struct sockaddr_un sau; if (argc < ArgEnv) { @@ -111,6 +112,35 @@ int main(int argc, char *argv[]) return 1; } + if (*argv[ArgEnv]) { + FILE *envFd; + char *envdata, *edp; + long size; + int count; + if (!(envFd = fopen(argv[ArgEnv], "r"))) { + fprintf(stderr, "Cannot read creator env file %s: %s\n", + argv[ArgEnv], strerror(errno)); + doExit(1); + } + fseek(envFd, 0, SEEK_END); + size = ftell(envFd); + rewind(envFd); + envdata = malloc(size); + if (fread(envdata, 1, size, envFd) != (size_t)size) { + perror("Failed to read env file"); + doExit(1); + } + fclose(envFd); + for (count = 0, edp = envdata; edp < envdata + size; ++count) + edp += strlen(edp) + 1; + env = malloc((count + 1) * sizeof(char *)); + for (count = 0, edp = envdata; edp < envdata + size; ++count) { + env[count] = edp; + edp += strlen(edp) + 1; + } + env[count] = 0; + } + /* Create execution result notification pipe. */ if (pipe(chldPipe)) { perror("Cannot create status pipe"); @@ -142,14 +172,10 @@ int main(int argc, char *argv[]) ptrace(PT_TRACE_ME, 0, 0, 0); #endif - for (envIdx = ArgEnv; *argv[envIdx]; ++envIdx) ; - if (envIdx != ArgEnv) { - argv[envIdx] = 0; - environ = argv + ArgEnv; - } - ++envIdx; + if (env) + environ = env; - execvp(argv[envIdx], argv + envIdx); + execvp(argv[ArgExe], argv + ArgExe); /* Only expected error: no such file or direcotry, i.e. executable not found */ errNo = errno; write(chldPipe[1], &errNo, sizeof(errNo)); /* Only realistic error case is SIGPIPE */ From 894ee04ee0618df6684d4fcb0b4eb2aebb9f4a4c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 9 Apr 2009 20:09:10 +0200 Subject: [PATCH 12/34] make terminal emulator configurable centrally this includes changing the runInTerminal.command command line. the terminal setting mock from the debugger plugin is gone again. --- share/qtcreator/runInTerminal.command | 51 ++++++++++++++++--- src/libs/utils/consoleprocess.h | 9 ++++ src/libs/utils/consoleprocess_unix.cpp | 36 +++++++++++-- .../editormanager/editormanager.cpp | 17 ++++--- src/plugins/coreplugin/generalsettings.cpp | 25 +++++++++ src/plugins/coreplugin/generalsettings.h | 3 ++ src/plugins/coreplugin/generalsettings.ui | 28 ++++++++++ src/plugins/debugger/debuggeractions.cpp | 5 -- src/plugins/debugger/debuggeractions.h | 1 - src/plugins/debugger/debuggerplugin.cpp | 4 -- src/plugins/debugger/gdboptionpage.ui | 14 ----- .../applicationlauncher_x11.cpp | 3 ++ 12 files changed, 154 insertions(+), 42 deletions(-) diff --git a/share/qtcreator/runInTerminal.command b/share/qtcreator/runInTerminal.command index 372820c1b11..3cc5baa050d 100755 --- a/share/qtcreator/runInTerminal.command +++ b/share/qtcreator/runInTerminal.command @@ -1,11 +1,50 @@ -#!/bin/bash -osascript >/dev/null 2>&1 <&2 + exit 1;; + esac +done +args= +for i in "$@"; do + i=${i//\\/\\\\\\\\} + i=${i//\"/\\\\\\\"} + i=${i//\$/\\\\\\\$} + i=${i//\`/\\\\\\\`} + args="$args \\\"$i\\\"" +done +osascript < +#include +#include #include #include @@ -48,6 +50,7 @@ ConsoleProcess::ConsoleProcess(QObject *parent) m_debug = false; m_appPid = 0; m_stubSocket = 0; + m_settings = 0; connect(&m_stubServer, SIGNAL(newConnection()), SLOT(stubConnectionAvailable())); @@ -88,8 +91,8 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args) m_tempFile->flush(); } - QStringList xtermArgs; - xtermArgs << "-e" + QStringList xtermArgs = terminalEmulator(m_settings).split(QLatin1Char(' ')); // FIXME: quoting + xtermArgs #ifdef Q_OS_MAC << (QCoreApplication::applicationDirPath() + "/../Resources/qtcreator_process_stub") #else @@ -102,10 +105,11 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args) << (m_tempFile ? m_tempFile->fileName() : 0) << program << args; - m_process.start(QLatin1String("xterm"), xtermArgs); + QString xterm = xtermArgs.takeFirst(); + m_process.start(xterm, xtermArgs); if (!m_process.waitForStarted()) { stubServerShutdown(); - emit processError(tr("Cannot start console emulator xterm.")); + emit processError(tr("Cannot start terminal emulator %1.").arg(xterm)); delete m_tempFile; m_tempFile = 0; return false; @@ -232,3 +236,27 @@ void ConsoleProcess::stubExited() } emit wrapperStopped(); } + +QString ConsoleProcess::defaultTerminalEmulator() +{ +// FIXME: enable this once runInTerminal works nicely +#if 0 //def Q_OS_MAC + return QDir::cleanPath(QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/runInTerminal.command")); +#else + return QLatin1String("xterm"); +#endif +} + +QString ConsoleProcess::terminalEmulator(const QSettings *settings) +{ + QString dflt = defaultTerminalEmulator() + QLatin1String(" -e"); + if (!settings) + return dflt; + return settings->value(QLatin1String("General/TerminalEmulator"), dflt).toString(); +} + +void ConsoleProcess::setTerminalEmulator(QSettings *settings, const QString &term) +{ + return settings->setValue(QLatin1String("General/TerminalEmulator"), term); +} diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 17d46349d55..49fedc4dcb6 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -49,6 +49,7 @@ #include +#include #include #include @@ -73,6 +74,7 @@ Q_DECLARE_METATYPE(Core::IEditor*) using namespace Core; using namespace Core::Internal; +using namespace Core::Utils; enum { debugEditorManager=0 }; @@ -429,15 +431,14 @@ void EditorManager::init() QString EditorManager::defaultExternalEditor() const { -#ifdef Q_OS_MAC - return m_d->m_core->resourcePath() - +QLatin1String("/runInTerminal.command vi %f %l %c %W %H %x %y"); -#elif defined(Q_OS_UNIX) - return QLatin1String("xterm -geom %Wx%H+%x+%y -e vi %f +%l +\"normal %c|\""); -#elif defined (Q_OS_WIN) - return QLatin1String("notepad %f"); +#ifdef Q_OS_UNIX + return ConsoleProcess::defaultTerminalEmulator() + QLatin1String( +# ifdef Q_OS_MAC + " -async" +# endif + " -geom %Wx%H+%x+%y -e vi %f +%l +\"normal %c|\""); #else - return QString(); + return QLatin1String("notepad %f"); #endif } diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp index 969599b2d8a..ff0f73f3302 100644 --- a/src/plugins/coreplugin/generalsettings.cpp +++ b/src/plugins/coreplugin/generalsettings.cpp @@ -31,11 +31,14 @@ #include "stylehelper.h" #include "utils/qtcolorbutton.h" +#include #include +#include #include #include "ui_generalsettings.h" +using namespace Core::Utils; using namespace Core::Internal; GeneralSettings::GeneralSettings(): @@ -71,6 +74,13 @@ QWidget *GeneralSettings::createPage(QWidget *parent) m_page->colorButton->setColor(StyleHelper::baseColor()); m_page->externalEditorEdit->setText(EditorManager::instance()->externalEditor()); +#ifdef Q_OS_UNIX + m_page->terminalEdit->setText(ConsoleProcess::terminalEmulator(Core::ICore::instance()->settings())); +#else + m_page->terminalLabel->hide(); + m_page->terminalEdit->hide(); + m_page->resetTerminalButton->hide(); +#endif connect(m_page->resetButton, SIGNAL(clicked()), this, SLOT(resetInterfaceColor())); @@ -78,6 +88,10 @@ QWidget *GeneralSettings::createPage(QWidget *parent) this, SLOT(resetExternalEditor())); connect(m_page->helpExternalEditorButton, SIGNAL(clicked()), this, SLOT(showHelpForExternalEditor())); +#ifdef Q_OS_UNIX + connect(m_page->resetTerminalButton, SIGNAL(clicked()), + this, SLOT(resetTerminal())); +#endif return w; } @@ -87,6 +101,10 @@ void GeneralSettings::apply() // Apply the new base color if accepted StyleHelper::setBaseColor(m_page->colorButton->color()); EditorManager::instance()->setExternalEditor(m_page->externalEditorEdit->text()); +#ifdef Q_OS_UNIX + ConsoleProcess::setTerminalEmulator(Core::ICore::instance()->settings(), + m_page->terminalEdit->text()); +#endif } void GeneralSettings::finish() @@ -104,6 +122,13 @@ void GeneralSettings::resetExternalEditor() m_page->externalEditorEdit->setText(EditorManager::instance()->defaultExternalEditor()); } +#ifdef Q_OS_UNIX +void GeneralSettings::resetTerminal() +{ + m_page->terminalEdit->setText(ConsoleProcess::defaultTerminalEmulator() + QLatin1String(" -e")); +} +#endif + void GeneralSettings::showHelpForExternalEditor() { if (m_dialog) { diff --git a/src/plugins/coreplugin/generalsettings.h b/src/plugins/coreplugin/generalsettings.h index 9135df7f4a3..d75cd2d8a39 100644 --- a/src/plugins/coreplugin/generalsettings.h +++ b/src/plugins/coreplugin/generalsettings.h @@ -59,6 +59,9 @@ private slots: void resetInterfaceColor(); void resetExternalEditor(); void showHelpForExternalEditor(); +#ifdef Q_OS_UNIX + void resetTerminal(); +#endif private: Ui_GeneralSettings *m_page; diff --git a/src/plugins/coreplugin/generalsettings.ui b/src/plugins/coreplugin/generalsettings.ui index c014fae607b..826c45ae6bc 100644 --- a/src/plugins/coreplugin/generalsettings.ui +++ b/src/plugins/coreplugin/generalsettings.ui @@ -96,6 +96,34 @@ + + + + + + Terminal: + + + + + + + + + + Reset to default + + + R + + + + :/core/images/reset.png:/core/images/reset.png + + + + + diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index a2e2b6f0614..9ca31151232 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -267,11 +267,6 @@ DebuggerSettings *DebuggerSettings::instance() item->setCheckable(true); instance->insertItem(UseToolTips, item); - item = new SavedAction(instance); - item->setDefaultValue("xterm"); - item->setSettingsKey("DebugMode", "Terminal"); - instance->insertItem(TerminalApplication, item); - item = new SavedAction(instance); item->setSettingsKey("DebugMode", "ListSourceFiles"); item->setText(tr("List source files")); diff --git a/src/plugins/debugger/debuggeractions.h b/src/plugins/debugger/debuggeractions.h index 4b0ebd66c86..7b93ad3c3e4 100644 --- a/src/plugins/debugger/debuggeractions.h +++ b/src/plugins/debugger/debuggeractions.h @@ -70,7 +70,6 @@ enum DebuggerActionCode AdjustColumnWidths, AlwaysAdjustColumnWidths, AutoQuit, - TerminalApplication, LockView, // Gdb diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index ea41b9854ea..430141716d9 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -269,8 +269,6 @@ QWidget *GdbOptionPage::createPage(QWidget *parent) m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location")); m_ui.scriptFileChooser->setExpectedKind(Core::Utils::PathChooser::File); m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File")); - m_ui.terminalChooser->setExpectedKind(Core::Utils::PathChooser::Command); - m_ui.terminalChooser->setPromptDialogTitle(tr("Choose Location of Terminal Application")); m_group.clear(); m_group.insert(theDebuggerAction(GdbLocation), @@ -279,8 +277,6 @@ QWidget *GdbOptionPage::createPage(QWidget *parent) m_ui.scriptFileChooser); m_group.insert(theDebuggerAction(GdbEnvironment), m_ui.environmentEdit); - m_group.insert(theDebuggerAction(TerminalApplication), - m_ui.terminalChooser); m_group.insert(theDebuggerAction(AllPluginBreakpoints), m_ui.radioButtonAllPluginBreakpoints); diff --git a/src/plugins/debugger/gdboptionpage.ui b/src/plugins/debugger/gdboptionpage.ui index c3994e7b8e9..baf91e4667d 100644 --- a/src/plugins/debugger/gdboptionpage.ui +++ b/src/plugins/debugger/gdboptionpage.ui @@ -39,17 +39,6 @@ - - - - This is either a full abolute path leading to the terminal -you indent to use or the name of a terminal that will be searched in your PATH. - - - Terminal: - - - @@ -76,9 +65,6 @@ you indent to use or the name of a terminal that will be searched in your PATH.< - - - diff --git a/src/plugins/projectexplorer/applicationlauncher_x11.cpp b/src/plugins/projectexplorer/applicationlauncher_x11.cpp index b82db98a416..b79c25ff82c 100644 --- a/src/plugins/projectexplorer/applicationlauncher_x11.cpp +++ b/src/plugins/projectexplorer/applicationlauncher_x11.cpp @@ -30,6 +30,8 @@ #include "applicationlauncher.h" #include "consoleprocess.h" +#include + #include using namespace ProjectExplorer::Internal; @@ -52,6 +54,7 @@ ApplicationLauncher::ApplicationLauncher(QObject *parent) this, SLOT(bringToForeground())); m_consoleProcess = new ConsoleProcess(this); + m_consoleProcess->setSettings(Core::ICore::instance()->settings()); connect(m_consoleProcess, SIGNAL(processError(const QString&)), this, SIGNAL(applicationError(const QString&))); connect(m_consoleProcess, SIGNAL(processStopped()), From 84a43310a7f00f6011354596cc663b5a9197bdf6 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 14 Apr 2009 09:55:21 +0200 Subject: [PATCH 13/34] debugger: use break-insert -f to insert pending breakpoints --- src/plugins/debugger/gdbengine.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 9d2d69220a7..c88fde5fad7 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -1943,7 +1943,10 @@ void GdbEngine::breakpointDataFromOutput(BreakpointData *data, const GdbMi &bkpt if (pos > 0) { data->bpLineNumber = child.data().mid(pos + 1); data->markerLineNumber = child.data().mid(pos + 1).toInt(); - files.prepend(child.data().left(pos)); + QString file = child.data().left(pos); + if (file.startsWith('"') && file.endsWith('"')) + file = file.mid(1, file.size() - 2); + files.prepend(file); } else { files.prepend(child.data()); } @@ -1991,7 +1994,7 @@ void GdbEngine::sendInsertBreakpoint(int index) // set up fallback in case of pending breakpoints which aren't handled // by the MI interface #ifdef Q_OS_LINUX - QString cmd = "-break-insert "; + QString cmd = "-break-insert -f "; //if (!data->condition.isEmpty()) // cmd += "-c " + data->condition + " "; cmd += where; From 73a2dc6f84ebe04f72d813b03e786bc43b0ab2b0 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 14 Apr 2009 11:11:51 +0200 Subject: [PATCH 14/34] debugger: make some noise if we still can't set pending breakpoints on Linux --- src/plugins/debugger/gdbengine.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index c88fde5fad7..0db41193eb1 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -2149,6 +2149,8 @@ void GdbEngine::handleBreakInsert(const GdbResultRecord &record, int index) // + data->lineNumber + "\""; QString where = "\"" + data->fileName + "\":" + data->lineNumber; + // Should not happen with -break-insert -f. gdb older than 6.8? + QTC_ASSERT(false, /**/); sendCommand("break " + where, BreakInsert1, index); #endif #ifdef Q_OS_MAC From 163705b8798372e307401aabe0c94dadb83469dc Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 14 Apr 2009 12:14:01 +0200 Subject: [PATCH 15/34] debugger: less debug output in cases we know what's missing --- src/plugins/debugger/gdbengine.cpp | 17 +++++++++++++++-- tests/auto/debugger/main.cpp | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 0db41193eb1..5a07ab9af72 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -1870,8 +1870,21 @@ void GdbEngine::jumpToLineExec(const QString &fileName, int lineNumber) void GdbEngine::setTokenBarrier() { - foreach (const GdbCookie &ck, m_cookieForToken) - QTC_ASSERT(ck.synchronized || ck.type == GdbInvalidCommand, return); + foreach (const GdbCookie &cookie, m_cookieForToken) { + QTC_ASSERT( + cookie.synchronized + || cookie.type == GdbInvalidCommand + // FIXME: use something like "command classes" for these cases: + || cookie.type == GdbInfoProc + || cookie.type == GdbStubAttached + || cookie.type == ModulesList + || cookie.type == WatchDebuggingHelperSetup + || cookie.type == GdbQueryDebuggingHelper, + qDebug() << "CMD: " << cookie.command << "TYPE: " << cookie.type + << "SYNC: " << cookie.synchronized; + return + ); + } PENDING_DEBUG("\n--- token barrier ---\n"); emit gdbInputAvailable(QString(), "--- token barrier ---"); m_oldestAcceptableToken = currentToken(); diff --git a/tests/auto/debugger/main.cpp b/tests/auto/debugger/main.cpp index f59a54a6790..13ece24e546 100644 --- a/tests/auto/debugger/main.cpp +++ b/tests/auto/debugger/main.cpp @@ -142,6 +142,7 @@ int main(int argc, char *argv[]) if (args.size() == 2 && args.at(1) == "--run-debuggee") { runDebuggee(); + app.exec(); return 0; } From fcfd3ae58af7e81eea0f7da487fbd4bef79ff510 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 14 Apr 2009 12:28:17 +0200 Subject: [PATCH 16/34] make the startup script work with directories containing spaces. Thanks to "catanzag" on the labs blog. --- bin/qtcreator | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/qtcreator b/bin/qtcreator index d00cfa0f582..f66b08778a6 100755 --- a/bin/qtcreator +++ b/bin/qtcreator @@ -1,9 +1,9 @@ #!/bin/sh -bindir=$(dirname $(readlink -nf $0)) +bindir=$(dirname "$(readlink -nf $0)") if test "$(uname -m)" = "x86_64" ; then - libdir=$(cd ${bindir}/../lib64 ; pwd) + libdir=$(cd "${bindir}/../lib64" ; pwd) else - libdir=$(cd ${bindir}/../lib ; pwd) + libdir=$(cd "${bindir}/../lib" ; pwd) fi LD_LIBRARY_PATH="${libdir}/qtcreator:${LD_LIBRARY_PATH}" exec "${bindir}/qtcreator.bin" ${1+"$@"} From 1898c4dbff69683cbe6510e9b0fec0ff580a4108 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Thu, 9 Apr 2009 15:54:30 +0200 Subject: [PATCH 17/34] bugfix for windows: trying to open files stored on network drives relied on QFileInfo::isWritable() without using the real filesystem checks --- src/plugins/texteditor/basetextdocument.cpp | 27 +++++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) mode change 100644 => 100755 src/plugins/texteditor/basetextdocument.cpp diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp old mode 100644 new mode 100755 index 07f0ce46260..92b7f2a4cdb --- a/src/plugins/texteditor/basetextdocument.cpp +++ b/src/plugins/texteditor/basetextdocument.cpp @@ -47,6 +47,8 @@ using namespace TextEditor; +extern Q_CORE_EXPORT int qt_ntfs_permission_lookup; + #if defined (Q_OS_WIN) # define NATIVE_LINE_TERMINATOR CRLFLineTerminator #else @@ -140,8 +142,21 @@ bool BaseTextDocument::isReadOnly() const return true; if (m_fileName.isEmpty()) //have no corresponding file, so editing is ok return false; + const QFileInfo fi(m_fileName); - return !fi.isWritable(); + +#ifdef Q_OS_WIN32 + // be careful when getting info from files on network drives + int old_ntfs_permission_lookup = qt_ntfs_permission_lookup; + qt_ntfs_permission_lookup = 1; +#endif + + const int ro = !fi.isWritable(); + +#ifdef Q_OS_WIN32 + qt_ntfs_permission_lookup = old_ntfs_permission_lookup; +#endif + return ro; } bool BaseTextDocument::isModified() const @@ -163,13 +178,9 @@ bool BaseTextDocument::open(const QString &fileName) if (!fi.isReadable()) return false; - if (!fi.isWritable()) { - if (!file.open(QIODevice::ReadOnly)) - return false; - } else { - if (!file.open(QIODevice::ReadWrite)) - return false; - } + if (!file.open(QIODevice::ReadWrite) && !file.open(QIODevice::ReadOnly)) + return false; + title = fi.fileName(); QByteArray buf = file.readAll(); From c3a3ab96641087e21974782a1d99f4cdc9c24efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Tue, 14 Apr 2009 12:18:23 +0200 Subject: [PATCH 18/34] Small tweaks to NTFS writable check fix --- .../coreplugin/editormanager/editormanager.cpp | 3 +-- src/plugins/texteditor/basetextdocument.cpp | 12 ++++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 49fedc4dcb6..f9b2cde57b2 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1173,9 +1173,8 @@ bool EditorManager::saveFile(IEditor *editor) return true; } - if (file->isReadOnly() || fileName.isEmpty()) { + if (file->isReadOnly() || fileName.isEmpty()) return saveFileAs(editor); - } m_d->m_core->fileManager()->blockFileChange(file); const bool success = file->save(fileName); diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp index 92b7f2a4cdb..7106b03550e 100755 --- a/src/plugins/texteditor/basetextdocument.cpp +++ b/src/plugins/texteditor/basetextdocument.cpp @@ -146,15 +146,14 @@ bool BaseTextDocument::isReadOnly() const const QFileInfo fi(m_fileName); #ifdef Q_OS_WIN32 - // be careful when getting info from files on network drives - int old_ntfs_permission_lookup = qt_ntfs_permission_lookup; - qt_ntfs_permission_lookup = 1; + // Check for permissions on NTFS file systems + qt_ntfs_permission_lookup++; #endif - const int ro = !fi.isWritable(); + const bool ro = !fi.isWritable(); #ifdef Q_OS_WIN32 - qt_ntfs_permission_lookup = old_ntfs_permission_lookup; + qt_ntfs_permission_lookup--; #endif return ro; } @@ -175,9 +174,6 @@ bool BaseTextDocument::open(const QString &fileName) if (!file.exists()) return false; - if (!fi.isReadable()) - return false; - if (!file.open(QIODevice::ReadWrite) && !file.open(QIODevice::ReadOnly)) return false; From 1c9714305e6fe8b173fb5c93ef27b420bde7f5b6 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 14 Apr 2009 12:58:05 +0200 Subject: [PATCH 19/34] debugger: don't kill gdb the hard way if it is still in a known state --- src/plugins/debugger/gdbengine.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 5a07ab9af72..20c56002587 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -1153,9 +1153,7 @@ void GdbEngine::handleAsyncOutput(const GdbMi &data) + data.findChild("signal-name").toString(); } q->showStatusMessage(msg); - // FIXME: shouldn't this use a statis change? - debugMessage("CALLING PARENT EXITDEBUGGER"); - q->exitDebugger(); + sendCommand("-gdb-exit"); return; } From 254aa303ff4351c029902ec039d1b717c9fcdb28 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 14 Apr 2009 14:24:45 +0200 Subject: [PATCH 20/34] debugger: use 'gdb' as default debugger --- src/plugins/debugger/debuggeractions.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/debugger/debuggeractions.cpp b/src/plugins/debugger/debuggeractions.cpp index 9ca31151232..43dc44ce7a1 100644 --- a/src/plugins/debugger/debuggeractions.cpp +++ b/src/plugins/debugger/debuggeractions.cpp @@ -245,6 +245,7 @@ DebuggerSettings *DebuggerSettings::instance() // item = new SavedAction(instance); item->setSettingsKey("DebugMode", "Location"); + item->setDefaultValue("gdb"); instance->insertItem(GdbLocation, item); item = new SavedAction(instance); @@ -281,6 +282,7 @@ DebuggerSettings *DebuggerSettings::instance() item = new SavedAction(instance); item->setSettingsKey("DebugMode", "AllPluginBreakpoints"); + item->setDefaultValue(true); instance->insertItem(AllPluginBreakpoints, item); item = new SavedAction(instance); From 883a7ffdbcd4ae26fae26313bb913bba9155b53e Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 14 Apr 2009 14:42:46 +0200 Subject: [PATCH 21/34] fakevim: fix the "Quit FakeVim" handler --- src/plugins/fakevim/fakevimplugin.cpp | 2 +- tests/manual/gdbdebugger/simple/plugin.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index 7f4e3eeada7..0ab92d82639 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -543,7 +543,7 @@ void FakeVimPluginPrivate::indentRegion(int *amount, int beginLine, int endLine, void FakeVimPluginPrivate::quitFakeVim() { - setUseFakeVim(false); + theFakeVimSetting(ConfigUseFakeVim)->setValue(false); } void FakeVimPluginPrivate::showCommandBuffer(const QString &contents) diff --git a/tests/manual/gdbdebugger/simple/plugin.cpp b/tests/manual/gdbdebugger/simple/plugin.cpp index df4c6c00ac6..2942ab3c7da 100644 --- a/tests/manual/gdbdebugger/simple/plugin.cpp +++ b/tests/manual/gdbdebugger/simple/plugin.cpp @@ -30,6 +30,7 @@ #include #include + extern "C" Q_DECL_EXPORT int pluginTest() { int s = 0; From e39d006ffb2223ff42bdfd32e561cdf09268a2eb Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 15 Apr 2009 10:06:31 +0200 Subject: [PATCH 22/34] debugger: fix re-initialization of watch item inames --- src/plugins/debugger/watchhandler.cpp | 24 ++++++++++++++++-------- src/plugins/debugger/watchhandler.h | 3 ++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index bd5b799049e..42e42f5f0b6 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -66,6 +66,8 @@ using namespace Debugger::Internal; static const QString strNotInScope = QLatin1String(""); +static int watcherCounter = 0; + //////////////////////////////////////////////////////////////////// // // WatchData @@ -922,17 +924,21 @@ void WatchHandler::watchExpression() watchExpression(action->data().toString()); } +QString WatchHandler::watcherName(const QString &exp) +{ + return QLatin1String("watch.") + QString::number(m_watchers[exp]); +} + void WatchHandler::watchExpression(const QString &exp) { // FIXME: 'exp' can contain illegal characters //MODEL_DEBUG("WATCH: " << exp); - static int counter = 0; + m_watchers[exp] = watcherCounter++; WatchData data; data.exp = exp; data.name = exp; - data.iname = QLatin1String("watch.") + QString::number(counter++); + data.iname = watcherName(exp); insertData(data); - m_watchers.append(exp); saveWatchers(); emit watchModelUpdateRequested(); } @@ -1017,7 +1023,7 @@ void WatchHandler::removeWatchExpression() void WatchHandler::removeWatchExpression(const QString &exp) { MODEL_DEBUG("REMOVE WATCH: " << exp); - m_watchers.removeOne(exp); + m_watchers.remove(exp); for (int i = m_completeSet.size(); --i >= 0;) { const WatchData & data = m_completeSet.at(i); if (data.iname.startsWith(QLatin1String("watch.")) && data.exp == exp) { @@ -1041,8 +1047,9 @@ void WatchHandler::reinitializeWatchersHelper() { // copy over all watchers and mark all watchers as incomplete int i = 0; - foreach (const QString &exp, m_watchers) { + foreach (const QString &exp, m_watchers.keys()) { WatchData data; + data.iname = watcherName(exp); data.level = -1; data.row = -1; data.parentIndex = -1; @@ -1252,15 +1259,16 @@ void WatchHandler::loadWatchers() { QVariant value; sessionValueRequested("Watchers", &value); - m_watchers = value.toStringList(); + foreach (const QString &exp, value.toStringList()) + m_watchers[exp] = watcherCounter++; //qDebug() << "LOAD WATCHERS: " << m_watchers; reinitializeWatchersHelper(); } void WatchHandler::saveWatchers() { - //qDebug() << "SAVE WATCHERS: " << m_watchers; - setSessionValueRequested("Watchers", m_watchers); + //qDebug() << "SAVE WATCHERS: " << m_watchers.keys(); + setSessionValueRequested("Watchers", QVariant(m_watchers.keys())); } void WatchHandler::saveSessionData() diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index 3f773ac1df3..13f37dabf49 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -216,7 +216,8 @@ private: QList m_completeSet; QList m_oldSet; QList m_displaySet; - QStringList m_watchers; + QHash m_watchers; + QString watcherName(const QString &exp); void setDisplayedIName(const QString &iname, bool on); QSet m_expandedINames; // those expanded in the treeview From 1e0561e8e5781c61fa884e61132ac573db842170 Mon Sep 17 00:00:00 2001 From: dt Date: Wed, 15 Apr 2009 14:52:31 +0200 Subject: [PATCH 23/34] Crash on removing RunConfigurations by editing the pro file Task: 250759 --- src/plugins/projectexplorer/project.cpp | 12 +++++++++--- src/plugins/projectexplorer/project.h | 2 ++ .../runsettingspropertiespage.cpp | 17 +++++++++++++++++ .../projectexplorer/runsettingspropertiespage.h | 4 ++-- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index 7106ac1383c..3f83f4763e7 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -453,6 +453,7 @@ void Project::addRunConfiguration(QSharedPointer runConfigurat return; } m_runConfigurations.push_back(runConfiguration); + emit addedRunConfiguration(runConfiguration->name()); } void Project::removeRunConfiguration(QSharedPointer runConfiguration) @@ -460,14 +461,19 @@ void Project::removeRunConfiguration(QSharedPointer runConfigu if(!m_runConfigurations.contains(runConfiguration)) { qWarning()<<"Not removing runConfiguration"<name()<<"becasue it doesn't exist"; return; - } - m_runConfigurations.removeOne(runConfiguration); + } + if (m_activeRunConfiguration == runConfiguration) { - if (m_runConfigurations.isEmpty()) + if (m_runConfigurations.size() <= 1) setActiveRunConfiguration(QSharedPointer(0)); + else if (m_runConfigurations.at(0) == m_activeRunConfiguration) + setActiveRunConfiguration(m_runConfigurations.at(1)); else setActiveRunConfiguration(m_runConfigurations.at(0)); } + + m_runConfigurations.removeOne(runConfiguration); + emit removedRunConfiguration(runConfiguration->name()); } QSharedPointer Project::activeRunConfiguration() const diff --git a/src/plugins/projectexplorer/project.h b/src/plugins/projectexplorer/project.h index fc8b9960a6b..bfe5872e781 100644 --- a/src/plugins/projectexplorer/project.h +++ b/src/plugins/projectexplorer/project.h @@ -140,6 +140,8 @@ signals: void fileListChanged(); void activeBuildConfigurationChanged(); void activeRunConfigurationChanged(); + void removedRunConfiguration(const QString &name); + void addedRunConfiguration(const QString &name); // This signal is jut there for updating the tree list in the buildsettings wizard void buildConfigurationDisplayNameChanged(const QString &buildConfiguraiton); diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.cpp b/src/plugins/projectexplorer/runsettingspropertiespage.cpp index bf4c5646376..b8c42716872 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.cpp +++ b/src/plugins/projectexplorer/runsettingspropertiespage.cpp @@ -189,6 +189,15 @@ RunSettingsWidget::RunSettingsWidget(Project *project) connect(m_ui->removeToolButton, SIGNAL(clicked(bool)), this, SLOT(removeRunConfiguration())); + connect(m_project, SIGNAL(removedRunConfiguration(QString)), + this, SLOT(initRunConfigurationComboBox())); + + connect(m_project, SIGNAL(addedRunConfiguration(QString)), + this, SLOT(initRunConfigurationComboBox())); + + connect(m_project, SIGNAL(activeRunConfigurationChanged()), + this, SLOT(activeRunConfigurationChanged())); + initRunConfigurationComboBox(); const QList > runConfigurations = m_project->runConfigurations(); for (int i=0; igroupBox->layout()->addWidget(m_runConfigurationWidget); } +void RunSettingsWidget::activeRunConfigurationChanged() +{ + QSharedPointer active = m_project->activeRunConfiguration(); + delete m_runConfigurationWidget; + m_runConfigurationWidget = active->configurationWidget(); + m_ui->groupBox->layout()->addWidget(m_runConfigurationWidget); +} + void RunSettingsWidget::nameChanged() { RunConfiguration *rc = qobject_cast(sender()); diff --git a/src/plugins/projectexplorer/runsettingspropertiespage.h b/src/plugins/projectexplorer/runsettingspropertiespage.h index 9caab4e4ac2..1412ad71271 100644 --- a/src/plugins/projectexplorer/runsettingspropertiespage.h +++ b/src/plugins/projectexplorer/runsettingspropertiespage.h @@ -77,9 +77,9 @@ private slots: void addRunConfiguration(); void removeRunConfiguration(); void nameChanged(); - -private: void initRunConfigurationComboBox(); + void activeRunConfigurationChanged(); +private: Project *m_project; RunConfigurationsModel *m_runConfigurationsModel; Ui::RunSettingsPropertiesPage *m_ui; From e61fa399ed1a2b8c418ad7c80683d20d67621abc Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 15 Apr 2009 15:41:21 +0200 Subject: [PATCH 24/34] debugger: also parse PID if the program starts without breakpoints --- src/plugins/debugger/gdbengine.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 20c56002587..31718958102 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -163,6 +163,20 @@ static int ¤tToken() return token; } +static bool isSkippable(int type) +{ + return type == RegisterListValues + && type == StackListThreads + && type == StackListFrames + && type == StackListLocals + && type == StackListArguments + && type == WatchVarAssign + && type == WatchVarListChildren + && type == WatchVarCreate + && type == WatchEvaluateExpression + && type == WatchToolTip; +} + /////////////////////////////////////////////////////////////////////// // // GdbEngine @@ -680,7 +694,7 @@ void GdbEngine::handleResultRecord(const GdbResultRecord &record) GdbCookie cmd = m_cookieForToken.take(token); - if (record.token < m_oldestAcceptableToken) { + if (record.token < m_oldestAcceptableToken && isSkippable(cmd.type)) { //qDebug() << "### SKIPPING OLD RESULT " << record.toString(); //QMessageBox::information(m_mainWindow, tr("Skipped"), "xxx"); return; From 500b5e20b5796b9ea018afd8b53e5ec62f962c64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Wed, 15 Apr 2009 16:06:49 +0200 Subject: [PATCH 25/34] No need to open file ReadWrite for just reading its contents Pointed out by Mathias Gumz. --- src/plugins/coreplugin/filemanager.cpp | 2 +- src/plugins/texteditor/basetextdocument.cpp | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/plugins/coreplugin/filemanager.cpp b/src/plugins/coreplugin/filemanager.cpp index b996ed50407..a13c72accc3 100644 --- a/src/plugins/coreplugin/filemanager.cpp +++ b/src/plugins/coreplugin/filemanager.cpp @@ -453,7 +453,7 @@ void FileManager::changedFile(const QString &file) foreach (IFile *fileinterface, managedFiles(file)) m_changedFiles << fileinterface; if (wasempty && !m_changedFiles.isEmpty()) { - QTimer::singleShot (200, this, SLOT(checkForReload())); + QTimer::singleShot(200, this, SLOT(checkForReload())); } } diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp index 7106b03550e..f22bc2a8385 100755 --- a/src/plugins/texteditor/basetextdocument.cpp +++ b/src/plugins/texteditor/basetextdocument.cpp @@ -171,10 +171,7 @@ bool BaseTextDocument::open(const QString &fileName) m_fileName = fi.absoluteFilePath(); QFile file(fileName); - if (!file.exists()) - return false; - - if (!file.open(QIODevice::ReadWrite) && !file.open(QIODevice::ReadOnly)) + if (!file.open(QIODevice::ReadOnly)) return false; title = fi.fileName(); From 5cb0a3cb724e6b41d555ea54e13b0dd52d772a87 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 15 Apr 2009 16:48:06 +0200 Subject: [PATCH 26/34] debugger: put the address of the loaded helpers into the debugger log --- share/qtcreator/gdbmacros/gdbmacros.cpp | 11 ++++++----- src/plugins/debugger/gdbengine.cpp | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index e688fa3fa28..b452b0ce811 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -202,11 +202,12 @@ QT_END_NAMESPACE #endif // PRIVATE_OBJECT_ALLOWED -// this can be mangled typenames of nested templates, each char-by-char -// comma-separated integer list -static char qDumpInBuffer[10000]; -static char qDumpOutBuffer[100000]; -//static char qDumpSize[20]; +// This can be mangled typenames of nested templates, each char-by-char +// comma-separated integer list... +char qDumpInBuffer[10000]; + +// The output buffer. +char qDumpOutBuffer[100000]; namespace { diff --git a/src/plugins/debugger/gdbengine.cpp b/src/plugins/debugger/gdbengine.cpp index 31718958102..c2d2c4b4c3f 100644 --- a/src/plugins/debugger/gdbengine.cpp +++ b/src/plugins/debugger/gdbengine.cpp @@ -4151,10 +4151,10 @@ void GdbEngine::tryLoadDebuggingHelpers() QString flag = QString::number(RTLD_NOW); sendCommand("sharedlibrary libc"); // for malloc sendCommand("sharedlibrary libdl"); // for dlopen - sendCommand("call (void)dlopen(\"" + lib + "\", " + flag + ")", + sendCommand("call (void*)dlopen(\"" + lib + "\", " + flag + ")", WatchDebuggingHelperSetup); // some older systems like CentOS 4.6 prefer this: - sendCommand("call (void)__dlopen(\"" + lib + "\", " + flag + ")", + sendCommand("call (void*)__dlopen(\"" + lib + "\", " + flag + ")", WatchDebuggingHelperSetup); sendCommand("sharedlibrary " + dotEscape(lib)); #endif From b1ea36bc47fefba9faac714e0cfc172221f9be58 Mon Sep 17 00:00:00 2001 From: kh Date: Wed, 15 Apr 2009 17:36:38 +0200 Subject: [PATCH 27/34] Fix build with namespaced Qt Reviewed-by: Thorbjorn Lindeijer --- src/plugins/texteditor/basetextdocument.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/texteditor/basetextdocument.cpp b/src/plugins/texteditor/basetextdocument.cpp index f22bc2a8385..665dd5617aa 100755 --- a/src/plugins/texteditor/basetextdocument.cpp +++ b/src/plugins/texteditor/basetextdocument.cpp @@ -47,7 +47,11 @@ using namespace TextEditor; +#if defined (Q_OS_WIN) +QT_BEGIN_NAMESPACE extern Q_CORE_EXPORT int qt_ntfs_permission_lookup; +QT_END_NAMESPACE +#endif #if defined (Q_OS_WIN) # define NATIVE_LINE_TERMINATOR CRLFLineTerminator @@ -145,14 +149,14 @@ bool BaseTextDocument::isReadOnly() const const QFileInfo fi(m_fileName); -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN // Check for permissions on NTFS file systems qt_ntfs_permission_lookup++; #endif const bool ro = !fi.isWritable(); -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN qt_ntfs_permission_lookup--; #endif return ro; From 99fccb6d37283224a7f50c2e27af2f711a60e5fe Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 14 Apr 2009 14:35:32 +0200 Subject: [PATCH 28/34] do not crash on lines starting with an equal sign --- src/shared/proparser/profileevaluator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 19041d7bb77..bb0a752eda0 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -357,6 +357,9 @@ void ProFileEvaluator::Private::insertVariable(const QString &line, int *i) { ProVariable::VariableOperator opkind; + if (m_proitem.isEmpty()) // Line starting with '=', like a conflict marker + return; + switch (m_proitem.at(m_proitem.length() - 1).unicode()) { case '+': m_proitem.chop(1); From 870a3b3903f1c136defcec1d82d6089ca33e4dc6 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 14 Apr 2009 15:31:07 +0200 Subject: [PATCH 29/34] protect against circular inclusion of pro/pri files Task-number: 250574 --- src/shared/proparser/profileevaluator.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index bb0a752eda0..1b75e12385d 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -2024,7 +2024,13 @@ ProFile *ProFileEvaluator::parsedProFile(const QString &fileName) { QFileInfo fi(fileName); if (fi.exists()) { - ProFile *pro = new ProFile(fi.absoluteFilePath()); + QString fn = QDir::cleanPath(fi.absoluteFilePath()); + foreach (const ProFile *pf, d->m_profileStack) + if (pf->fileName() == fn) { + errorMessage(d->format("circular inclusion of %1").arg(fn)); + return 0; + } + ProFile *pro = new ProFile(fn); if (d->read(pro)) return pro; delete pro; From 031c7c16585c77b85f06c56cbf02eec6b997af74 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 15 Apr 2009 20:19:37 +0200 Subject: [PATCH 30/34] QT_NO_CAST_FROM_ASCII safety --- src/shared/proparser/profileevaluator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 1b75e12385d..676506b4550 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -639,11 +639,11 @@ bool ProFileEvaluator::Private::visitBeginProFile(ProFile * pro) evaluateFile(mkspecDirectory + QLatin1String("/default/qmake.conf"), &ok); evaluateFile(mkspecDirectory + QLatin1String("/features/default_pre.prf"), &ok); - QStringList tmp = m_valuemap.value("CONFIG"); + QStringList tmp = m_valuemap.value(QLatin1String("CONFIG")); tmp.append(m_addUserConfigCmdArgs); foreach(const QString &remove, m_removeUserConfigCmdArgs) tmp.removeAll(remove); - m_valuemap.insert("CONFIG", tmp); + m_valuemap.insert(QLatin1String("CONFIG"), tmp); m_cumulative = cumulative; } From cc09453cb106d160679dce3d5624f5f094c55497 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 15 Apr 2009 20:20:17 +0200 Subject: [PATCH 31/34] make quote/escape parsing more qmake-compatible --- src/shared/proparser/profileevaluator.cpp | 122 ++++++++++++---------- 1 file changed, 69 insertions(+), 53 deletions(-) diff --git a/src/shared/proparser/profileevaluator.cpp b/src/shared/proparser/profileevaluator.cpp index 676506b4550..1313f7c0306 100644 --- a/src/shared/proparser/profileevaluator.cpp +++ b/src/shared/proparser/profileevaluator.cpp @@ -151,6 +151,8 @@ public: QString m_pendingComment; bool m_syntaxError; bool m_contNextLine; + bool m_inQuote; + int m_parens; /////////////// Evaluating pro file contents @@ -251,6 +253,8 @@ bool ProFileEvaluator::Private::read(ProFile *pro) // Parser state m_block = 0; m_commentItem = 0; + m_inQuote = false; + m_parens = 0; m_contNextLine = false; m_syntaxError = false; m_lineNo = 1; @@ -274,71 +278,83 @@ bool ProFileEvaluator::Private::parseLine(const QString &line0) if (m_blockstack.isEmpty()) return false; - ushort quote = 0; - int parens = 0; - bool contNextLine = false; + int parens = m_parens; + bool inQuote = m_inQuote; + bool escaped = false; QString line = line0.simplified(); for (int i = 0; !m_syntaxError && i < line.length(); ++i) { ushort c = line.at(i).unicode(); - if (quote && c == quote) - quote = 0; - else if (c == '(') - ++parens; - else if (c == ')') - --parens; - else if (c == '"' && (i == 0 || line.at(i - 1).unicode() != '\\')) - quote = c; - else if (!parens && !quote) { - if (c == '#') { - insertComment(line.mid(i + 1)); - contNextLine = m_contNextLine; - break; - } - if (c == '\\' && i >= line.count() - 1) { - updateItem(); - contNextLine = true; + if (c == '#') { // Yep - no escaping possible + insertComment(line.mid(i + 1)); + escaped = m_contNextLine; + break; + } + if (!escaped) { + if (c == '\\') { + escaped = true; + m_proitem += c; + continue; + } else if (c == '"') { + inQuote = !inQuote; + m_proitem += c; continue; } - if (m_block && (m_block->blockKind() & ProBlock::VariableKind)) { - if (c == ' ') - updateItem(); - else - m_proitem += c; - continue; - } - if (c == ':') { - enterScope(false); - continue; - } - if (c == '{') { - enterScope(true); - continue; - } - if (c == '}') { - leaveScope(); - continue; - } - if (c == '=') { - insertVariable(line, &i); - continue; - } - if (c == '|' || c == '!') { - insertOperator(c); - continue; + } else { + escaped = false; + } + if (!inQuote) { + if (c == '(') { + ++parens; + } else if (c == ')') { + --parens; + } else if (!parens) { + if (m_block && (m_block->blockKind() & ProBlock::VariableKind)) { + if (c == ' ') + updateItem(); + else + m_proitem += c; + continue; + } + if (c == ':') { + enterScope(false); + continue; + } + if (c == '{') { + enterScope(true); + continue; + } + if (c == '}') { + leaveScope(); + continue; + } + if (c == '=') { + insertVariable(line, &i); + continue; + } + if (c == '|' || c == '!') { + insertOperator(c); + continue; + } } } m_proitem += c; } - m_contNextLine = contNextLine; - - if (!m_syntaxError) { - updateItem(); - if (!m_contNextLine) - finalizeBlock(); + m_inQuote = inQuote; + m_parens = parens; + m_contNextLine = escaped; + if (escaped) { + m_proitem.chop(1); + return true; + } else { + if (!m_syntaxError) { + updateItem(); + if (!m_contNextLine) + finalizeBlock(); + } + return !m_syntaxError; } - return !m_syntaxError; } void ProFileEvaluator::Private::finalizeBlock() From 6f56ad0ac3ae1a59a541767c28a03a21b3867d87 Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 15 Apr 2009 17:26:43 +0200 Subject: [PATCH 32/34] projectmanager: proper name for build log dialog --- src/plugins/qt4projectmanager/showbuildlog.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qt4projectmanager/showbuildlog.ui b/src/plugins/qt4projectmanager/showbuildlog.ui index 98c61b360e7..5b31a76861c 100644 --- a/src/plugins/qt4projectmanager/showbuildlog.ui +++ b/src/plugins/qt4projectmanager/showbuildlog.ui @@ -11,7 +11,7 @@ - Dialog + Debugging Helper Build Log From 3c7b1f4a80311a6a64a5528be0f14ec50f6bc8c9 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 16 Apr 2009 08:43:00 +0200 Subject: [PATCH 33/34] debugger: return the address of the output buffer from the dumpers --- share/qtcreator/gdbmacros/gdbmacros.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/share/qtcreator/gdbmacros/gdbmacros.cpp b/share/qtcreator/gdbmacros/gdbmacros.cpp index b452b0ce811..06c1e1ae1cf 100644 --- a/share/qtcreator/gdbmacros/gdbmacros.cpp +++ b/share/qtcreator/gdbmacros/gdbmacros.cpp @@ -204,10 +204,10 @@ QT_END_NAMESPACE // This can be mangled typenames of nested templates, each char-by-char // comma-separated integer list... -char qDumpInBuffer[10000]; +Q_DECL_EXPORT char qDumpInBuffer[10000]; // The output buffer. -char qDumpOutBuffer[100000]; +Q_DECL_EXPORT char qDumpOutBuffer[100000]; namespace { @@ -2525,7 +2525,7 @@ static void handleProtocolVersion2and3(QDumper & d) extern "C" Q_DECL_EXPORT -void qDumpObjectData440( +void *qDumpObjectData440( int protocolVersion, int token, void *data, @@ -2630,4 +2630,5 @@ void qDumpObjectData440( else { qDebug() << "Unsupported protocol version" << protocolVersion; } + return qDumpOutBuffer; } From ef1311d05403025f31ad45bc8b6e86c28f958de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Thu, 16 Apr 2009 10:27:25 +0200 Subject: [PATCH 34/34] Fixed restoring of full screen window state Task-number: 247123 --- src/plugins/coreplugin/mainwindow.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/plugins/coreplugin/mainwindow.cpp b/src/plugins/coreplugin/mainwindow.cpp index 543111816b1..446b7544bb3 100644 --- a/src/plugins/coreplugin/mainwindow.cpp +++ b/src/plugins/coreplugin/mainwindow.cpp @@ -1070,11 +1070,14 @@ static const char *settingsGroup = "MainWindow"; static const char *geometryKey = "Geometry"; static const char *colorKey = "Color"; static const char *maxKey = "Maximized"; +static const char *fullScreenKey = "FullScreen"; void MainWindow::readSettings() { m_settings->beginGroup(QLatin1String(settingsGroup)); + StyleHelper::setBaseColor(m_settings->value(QLatin1String(colorKey)).value()); + const QVariant geom = m_settings->value(QLatin1String(geometryKey)); if (geom.isValid()) { setGeometry(geom.toRect()); @@ -1083,8 +1086,10 @@ void MainWindow::readSettings() } if (m_settings->value(QLatin1String(maxKey), false).toBool()) setWindowState(Qt::WindowMaximized); + setFullScreen(m_settings->value(QLatin1String(fullScreenKey), false).toBool()); m_settings->endGroup(); + m_editorManager->readSettings(m_settings); m_navigationWidget->restoreSettings(m_settings); m_rightPaneWidget->readSettings(m_settings); @@ -1093,14 +1098,18 @@ void MainWindow::readSettings() void MainWindow::writeSettings() { m_settings->beginGroup(QLatin1String(settingsGroup)); - m_settings->setValue(colorKey, StyleHelper::baseColor()); - const QString maxSettingsKey = QLatin1String(maxKey); - if (windowState() & Qt::WindowMaximized) { - m_settings->setValue(maxSettingsKey, true); + + m_settings->setValue(QLatin1String(colorKey), StyleHelper::baseColor()); + + if (windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen)) { + m_settings->setValue(QLatin1String(maxKey), (bool) (windowState() & Qt::WindowMaximized)); + m_settings->setValue(QLatin1String(fullScreenKey), (bool) (windowState() & Qt::WindowFullScreen)); } else { - m_settings->setValue(maxSettingsKey, false); + m_settings->setValue(QLatin1String(maxKey), false); + m_settings->setValue(QLatin1String(fullScreenKey), false); m_settings->setValue(QLatin1String(geometryKey), geometry()); } + m_settings->endGroup(); m_fileManager->saveRecentFiles(); @@ -1209,7 +1218,7 @@ QPrinter *MainWindow::printer() const { if (!m_printer) m_printer = new QPrinter(QPrinter::HighResolution); - return m_printer; + return m_printer; } void MainWindow::setFullScreen(bool on)