From 6adb3f617e5b89ac300df0530cac58ee78d3a466 Mon Sep 17 00:00:00 2001 From: mae Date: Thu, 11 Dec 2008 13:20:59 +0100 Subject: [PATCH 1/9] connect the parenthesis matcher with the ifdefed out information. --- src/plugins/texteditor/basetexteditor.cpp | 33 ++++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index 8d5bf3ff683..d613db7a294 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -734,12 +734,15 @@ void BaseTextEditor::moveLineUpDown(bool up) move.clearSelection(); move.insertText(text); int end = move.position(); - move.endEditBlock(); + if (hasSelection) { move.setPosition(start); move.setPosition(end, QTextCursor::KeepAnchor); } + indent(document(), move, QChar::Null); + move.endEditBlock(); + setTextCursor(move); } @@ -2951,12 +2954,13 @@ void BaseTextEditor::markBlocksAsChanged(QList blockNumbers) { TextBlockUserData::MatchType TextBlockUserData::checkOpenParenthesis(QTextCursor *cursor, QChar c) { - if (!TextEditDocumentLayout::hasParentheses(cursor->block())) + QTextBlock block = cursor->block(); + if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block)) return NoMatch; - Parentheses parenList = TextEditDocumentLayout::parentheses(cursor->block()); + Parentheses parenList = TextEditDocumentLayout::parentheses(block); Parenthesis openParen, closedParen; - QTextBlock closedParenParag = cursor->block(); + QTextBlock closedParenParag = block; const int cursorPos = cursor->position() - closedParenParag.position(); int i = 0; @@ -2981,7 +2985,8 @@ TextBlockUserData::MatchType TextBlockUserData::checkOpenParenthesis(QTextCursor closedParenParag = closedParenParag.next(); if (!closedParenParag.isValid()) return NoMatch; - if (TextEditDocumentLayout::hasParentheses(closedParenParag)) { + if (TextEditDocumentLayout::hasParentheses(closedParenParag) + && !TextEditDocumentLayout::ifdefedOut(closedParenParag)) { parenList = TextEditDocumentLayout::parentheses(closedParenParag); break; } @@ -3018,12 +3023,13 @@ TextBlockUserData::MatchType TextBlockUserData::checkOpenParenthesis(QTextCursor TextBlockUserData::MatchType TextBlockUserData::checkClosedParenthesis(QTextCursor *cursor, QChar c) { - if (!TextEditDocumentLayout::hasParentheses(cursor->block())) + QTextBlock block = cursor->block(); + if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block)) return NoMatch; - Parentheses parenList = TextEditDocumentLayout::parentheses(cursor->block()); + Parentheses parenList = TextEditDocumentLayout::parentheses(block); Parenthesis openParen, closedParen; - QTextBlock openParenParag = cursor->block(); + QTextBlock openParenParag = block; const int cursorPos = cursor->position() - openParenParag.position(); int i = parenList.count() - 1; @@ -3049,7 +3055,8 @@ TextBlockUserData::MatchType TextBlockUserData::checkClosedParenthesis(QTextCurs if (!openParenParag.isValid()) return NoMatch; - if (TextEditDocumentLayout::hasParentheses(openParenParag)) { + if (TextEditDocumentLayout::hasParentheses(openParenParag) + && !TextEditDocumentLayout::ifdefedOut(openParenParag)) { parenList = TextEditDocumentLayout::parentheses(openParenParag); break; } @@ -3091,7 +3098,7 @@ bool TextBlockUserData::findPreviousOpenParenthesis(QTextCursor *cursor, bool se int ignore = 0; while (block.isValid()) { Parentheses parenList = TextEditDocumentLayout::parentheses(block); - if (!parenList.isEmpty()) { + if (!parenList.isEmpty() && !TextEditDocumentLayout::ifdefedOut(block)) { for (int i = parenList.count()-1; i >= 0; --i) { Parenthesis paren = parenList.at(i); if (block == cursor->block() && position - block.position() <= paren.pos + 1) @@ -3118,7 +3125,7 @@ bool TextBlockUserData::findNextClosingParenthesis(QTextCursor *cursor, bool sel int ignore = 0; while (block.isValid()) { Parentheses parenList = TextEditDocumentLayout::parentheses(block); - if (!parenList.isEmpty()) { + if (!parenList.isEmpty() && !TextEditDocumentLayout::ifdefedOut(block)) { for (int i = 0; i < parenList.count(); ++i) { Parenthesis paren = parenList.at(i); if (block == cursor->block() && position - block.position() >= paren.pos) @@ -3143,7 +3150,7 @@ TextBlockUserData::MatchType TextBlockUserData::matchCursorBackward(QTextCursor cursor->clearSelection(); const QTextBlock block = cursor->block(); - if (!TextEditDocumentLayout::hasParentheses(block)) + if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block)) return NoMatch; const int relPos = cursor->position() - block.position(); @@ -3165,7 +3172,7 @@ TextBlockUserData::MatchType TextBlockUserData::matchCursorForward(QTextCursor * cursor->clearSelection(); const QTextBlock block = cursor->block(); - if (!TextEditDocumentLayout::hasParentheses(block)) + if (!TextEditDocumentLayout::hasParentheses(block) || TextEditDocumentLayout::ifdefedOut(block)) return NoMatch; const int relPos = cursor->position() - block.position(); From fff956db026a4d1fbce96477aeb17cccb126fe3d Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 11 Dec 2008 13:23:03 +0100 Subject: [PATCH 2/9] Add preliminary version of coding convention/style recommnedation. More needed. It was suggested to copy parts from the twiki. --- doc/coding-style.qdoc | 246 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 246 insertions(+) create mode 100644 doc/coding-style.qdoc diff --git a/doc/coding-style.qdoc b/doc/coding-style.qdoc new file mode 100644 index 00000000000..f028e56fe74 --- /dev/null +++ b/doc/coding-style.qdoc @@ -0,0 +1,246 @@ +/*! + +\contentpage{index.html}{Qt Creator} +\page coding-style.html + +\title Qt Creator Coding Rules + +THIS IS PRELIMINARY. + +\section1 Introduction + +The aim of this section is to serve as a guide for the developers, to aid us +to build understandable and maintainable code, to create less confusion and +surprises when working on Qt Creator. + +As usual: Rules are not set in stone. If there's a good reason to break one, +do it, preferably after making sure that there are others agreeing. + +This document is incomplete. + +In general, if you want to contribute to the main source, we expect at least +that you: + +\list 1 +\o The most important rule first: KISS (keep it simple ...): always + use a simple implementation in favor of a more complicated one. + This eases maintenance a lot. +\o Write good C++ code: Readable, well commented when necessary, + and taking advantage of the OO model. Follow the \l{Formatting} guidelines. + There are also certain \l{Code Constructs} that we try to follow. +\o Adapt the code to the structures already existing in Qt Creator, or in + the case that you have better ideas, discuss them with other developers + before writing the code. +\o Take advantage of Qt. Don't re-invent the wheel. Think about what parts + of your code are generic enough that they might be incorporated into + Qt proper. +\o Document interfaces. Right now we use qdoc, but changing to doxygen + is being considered. +\endlist + + + +\section1 Submitting Code + +It is implicitly understood that all patches contributed to The Qt Creator +Project are made under under the Gnu General Public License, version 2 or later +and + +If you have a problem with that, don't contribute code. + +Also please don't just pop up out of the blue with a huge patch (or +small) that changes something substantial in Qt Creator. Always discuss your +ideas with the other developers on mailing list first. + +When you create the patch, please use git or use "diff -up" since we find +that a lot easier to read than the other diff formats. Also please do not +send patches that implements or fixes several different things; several +patches is a much better option. + +We also require you to provide a commit message entry with every patch, +this describes in detail what the patch is doing. + + + +\section1 Code Constructs + +We have several guidelines on code constructs, some of these exist to +make the code faster, others to make the code clearer. Yet others +exist to allow us to take advantage of the strong type checking +in C++. + +\list 1 +\o Declaration of variables should wait as long as possible. The rule + is: "Don't declare it until you need it." In C++ there are a lot of + user defined types, and these can very often be expensive to + initialize. This rule connects to the next rule too. + +\o Make the scope of a variable as small as possible. + +\o Prefer preincrement to postincrement whenever possible. + Preincrement has potential of being faster than postincrement. Just + think about the obvious implementations of pre/post-increment. This + rule applies to decrement too. + +\code + ++T; + --U; + -NOT- + T++; // not used in Qt Creator + U--; // not used in Qt Creator +\endcode + +\o Try to minimize evaluation of the same code over and over. This is + aimed especially at loops. + +\code + + Container::iterator end = large.end(); + for (Container::iterator it = large.begin(); it != end; ++it) { + ...; + } + -NOT- + for (Container::iterator it = large.begin(); + it != large.end(); ++it) { + ...; + } +\endcode + + + +\section1 Formatting + +\section2 Declarations + +Only one declaration on each line. +\code + int a; + int b; + -NOT- + int a, b; // not used in Qt Creator +\endcode + + This is especially important when initialization is done at the same + time. +\code + QString a = "Joe"; + QString b = "Foo"; + -NOT- + QString a = "Joe", b = "Foo"; // not used in Qt Creator +\endcode + [Note that 'QString a = "Joe"' is formally calling a copy constructor + on a temporary constructed from a string literal and therefore has the + potential of being more expensive then direct construction by + 'QString a("joe")'. However the compiler is allowed to elide the copy + (even if it had side effects), and modern compilers typically do so. + Given these equal costs, Qt Creator code favours the '=' idiom as it is in + line with the traditional C-style initialization, _and_ cannot be + mistaken as function declaration, _and_ reduces the level of nested + parantheses in more initializations.] + + +\section2 Pointers and references + +\code + char *p = "flop"; + char &c = *p; + -NOT- + char* p = "flop"; // not used in Qt Creator + char & c = *p; // not used in Qt Creator +\endcode + + This is simply in line with the official Qt guide lines. + + Also note that we will have: +\code + const char *p; + -NOT- + char const * p; // not used in Qt Creator +\endcode + + + Using a plain 0 for Null pointer constants is always correct and least effort + to type. So: +\code + void *p = 0; + -NOT- + void *p = NULL; // not used in Qt Creator + -NOT- + void *p = '\0'; // not used in Qt Creator + -NOT- + void *p = 42 - 7 * 6; // also not used in Qt Creator +\endcode + Note: As an exception, imported third party code as well as code + interfacing the "native" APIs (src/support/os_*) can use NULL. + + +\section2 Operator names and parentheses +\code + operator==(type) + -NOT- + operator == (type) // not used in Qt Creator +\endcode + + The == is part of the function name, separating it makes the + declaration look like an expression. + + +\section2 Function names and parentheses +\code + void mangle() + -NOT- + void mangle () // not used in Qt Creator +\endcode + + + +\section2 Naming rules + + Simply follow the style of Qt proper. As examples: + \list + \o Use descriptive but simple and short names. Do not abbreviate. + + \o Class names are capitalized, and function names lowercased. + Enums are named like Classes, values are in lower-case. +\endlist + + + +\section2 Formatting + + Adapt the formatting of your code to the one used in the + other parts of Qt Creator. In case there is different formatting for + the same construct, use the one used more often. + + +\section2 Declarations + + - Use this order for the access sections of your class: public, + protected, private. The public section is interesting for every + user of the class. The private section is only of interest for the + implementors of the class (you). [Obviously not true since this is + for developers, and we do not want one developer only to be able to + read and understand the implementation of class internals. Lgb] + + - Avoid declaring global objects in the declaration file of the class. + If the same variable is used for all objects, use a static member. + + - Avoid global or static variables. + + +\section2 File headers + + If you create a new file, the top of the file should include a + header comment equal to the one found in other source files of Qt Creator. + +\section2 Documentation + + The documentation is generated from source and header files. + You document for the other developers, not for yourself. + In the header you should document interfaces, i.e. what the function does, + not the implementation. + In the .cpp files you document the implementation if the implementation + in non-obvious. + + +*/ From ddfd46b3224811d0e202e8a44a97150c50856d99 Mon Sep 17 00:00:00 2001 From: mae Date: Thu, 11 Dec 2008 13:35:58 +0100 Subject: [PATCH 3/9] nicer (un)comment selection, avoid C-style selections when you can do C++ style. --- src/plugins/cppeditor/cppeditor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index f233c0121f8..8aec6e39203 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -744,7 +744,8 @@ void CPPEditor::unCommentSelection() QString endText = endBlock.text(); int endPos = end - endBlock.position(); - bool hasTrailingCharacters = !endText.mid(endPos).trimmed().isEmpty(); + bool hasTrailingCharacters = !endText.left(endPos).remove(QLatin1String("//")).trimmed().isEmpty() + && !endText.mid(endPos).trimmed().isEmpty(); if ((endPos <= endText.length() - 2 && endText.at(endPos) == QLatin1Char('*') && endText.at(endPos+1) == QLatin1Char('/'))) { From a556ddada831c97c43d5c74bd1cb975b3da36fbc Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 11 Dec 2008 14:01:53 +0100 Subject: [PATCH 4/9] start sanitizing gdb options dialog --- src/plugins/debugger/debugger.pro | 2 - src/plugins/debugger/debuggerplugin.cpp | 8 -- src/plugins/debugger/debuggerplugin.h | 2 - src/plugins/debugger/gdbengine.h | 2 +- src/plugins/debugger/gdboptionpage.cpp | 47 ++++++-- src/plugins/debugger/gdboptionpage.h | 6 +- src/plugins/debugger/gdboptionpage.ui | 51 +++++++-- src/plugins/debugger/gdbtypemacros.ui | 144 +++++++++--------------- src/plugins/git/settingspage.cpp | 2 +- 9 files changed, 140 insertions(+), 124 deletions(-) diff --git a/src/plugins/debugger/debugger.pro b/src/plugins/debugger/debugger.pro index 3d67e19c6aa..7308fb441c2 100644 --- a/src/plugins/debugger/debugger.pro +++ b/src/plugins/debugger/debugger.pro @@ -58,7 +58,6 @@ SOURCES += attachexternaldialog.cpp \ gdbengine.cpp \ gdbmi.cpp \ gdboptionpage.cpp \ - gdbtypemacros.cpp \ gdbengine.h \ moduleshandler.cpp \ moduleswindow.cpp \ @@ -79,7 +78,6 @@ FORMS += attachexternaldialog.ui \ breakcondition.ui \ mode.ui \ gdboptionpage.ui \ - gdbtypemacros.ui \ startexternaldialog.ui \ RESOURCES += debugger.qrc diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 37406f70cc1..d9217069c68 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -183,7 +183,6 @@ DebuggerPlugin::DebuggerPlugin() { m_pm = 0; m_generalOptionPage = 0; - m_typeMacroPage = 0; m_locationMark = 0; m_manager = 0; } @@ -202,7 +201,6 @@ void DebuggerPlugin::shutdown() //qDebug() << "DebuggerPlugin::~DebuggerPlugin"; removeObject(m_debugMode); removeObject(m_generalOptionPage); - removeObject(m_typeMacroPage); // FIXME: when using the line below, BreakWindow etc gets deleted twice. // so better leak for now... @@ -212,9 +210,6 @@ void DebuggerPlugin::shutdown() delete m_generalOptionPage; m_generalOptionPage = 0; - delete m_typeMacroPage; - m_typeMacroPage = 0; - delete m_locationMark; m_locationMark = 0; @@ -409,13 +404,10 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes mdebug->addAction(cmd); m_generalOptionPage = 0; - m_typeMacroPage = 0; // FIXME: m_generalOptionPage = new GdbOptionPage(&theGdbSettings()); addObject(m_generalOptionPage); - m_typeMacroPage = new TypeMacroPage(&theGdbSettings()); - addObject(m_typeMacroPage); m_locationMark = 0; diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h index 91ffe4dbf77..ebf12b5e123 100644 --- a/src/plugins/debugger/debuggerplugin.h +++ b/src/plugins/debugger/debuggerplugin.h @@ -54,7 +54,6 @@ namespace Internal { class DebuggerManager; class DebugMode; class GdbOptionPage; -class TypeMacroPage; class LocationMark; class DebuggerPlugin : public ExtensionSystem::IPlugin @@ -103,7 +102,6 @@ private: ExtensionSystem::PluginManager *m_pm; GdbOptionPage *m_generalOptionPage; - TypeMacroPage *m_typeMacroPage; QString m_previousMode; LocationMark *m_locationMark; diff --git a/src/plugins/debugger/gdbengine.h b/src/plugins/debugger/gdbengine.h index 56106a75244..6b3cbb15fee 100644 --- a/src/plugins/debugger/gdbengine.h +++ b/src/plugins/debugger/gdbengine.h @@ -80,7 +80,7 @@ enum DataDumperState DataDumperUnavailable, }; -// FIXME: Move to extra file? + class GdbSettings { public: diff --git a/src/plugins/debugger/gdboptionpage.cpp b/src/plugins/debugger/gdboptionpage.cpp index e05b811889a..8bf1b22a0fc 100644 --- a/src/plugins/debugger/gdboptionpage.cpp +++ b/src/plugins/debugger/gdboptionpage.cpp @@ -58,7 +58,11 @@ GdbOptionPage::GdbOptionPage(GdbSettings *settings) #if defined(Q_OS_WIN32) defaultCommand.append(".exe"); #endif + QString defaultScript = coreIFace->resourcePath() + + QLatin1String("/gdb/qt4macros"); + m_settings->m_gdbCmd = s->value("Location", defaultCommand).toString(); + m_settings->m_scriptFile= s->value("ScriptFile", defaultScript).toString(); m_settings->m_gdbEnv = s->value("Environment", "").toString(); m_settings->m_autoRun = s->value("AutoRun", true).toBool(); m_settings->m_autoQuit = s->value("AutoQuit", true).toBool(); @@ -72,36 +76,56 @@ QString GdbOptionPage::name() const QString GdbOptionPage::category() const { - return "Debugger|Gdb"; + return "Debugger"; } QString GdbOptionPage::trCategory() const { - return tr("Debugger|Gdb"); + return tr("Debugger"); } QWidget *GdbOptionPage::createPage(QWidget *parent) { QWidget *w = new QWidget(parent); m_ui.setupUi(w); - m_ui.gdbEdit->setText(m_settings->m_gdbCmd); - m_ui.envEdit->setText(m_settings->m_gdbEnv); + m_ui.gdbLocationEdit->setText(m_settings->m_gdbCmd); + m_ui.environmentEdit->setText(m_settings->m_gdbEnv); m_ui.autoStartBox->setChecked(m_settings->m_autoRun); m_ui.autoQuitBox->setChecked(m_settings->m_autoQuit); - connect(m_ui.pushButtonBrowse, SIGNAL(clicked()), - this, SLOT(browse())); + m_ui.gdbStartupScriptEdit->setText(m_settings->m_scriptFile); + + // FIXME + m_ui.autoStartBox->hide(); + m_ui.autoQuitBox->hide(); + m_ui.environmentEdit->hide(); + m_ui.labelEnvironment->hide(); + + connect(m_ui.browseForGdbButton, SIGNAL(clicked()), + this, SLOT(browseForGdb())); + connect(m_ui.browseForScriptButton, SIGNAL(clicked()), + this, SLOT(browseForScript())); return w; } -void GdbOptionPage::browse() +void GdbOptionPage::browseForGdb() { - QString fileName = QFileDialog::getOpenFileName(m_ui.pushButtonBrowse, + QString fileName = QFileDialog::getOpenFileName(m_ui.browseForGdbButton, "Browse for gdb executable"); if (fileName.isEmpty()) return; m_settings->m_gdbCmd = fileName; - m_ui.gdbEdit->setText(fileName); + m_ui.gdbLocationEdit->setText(fileName); +} + +void GdbOptionPage::browseForScript() +{ + QString fileName = QFileDialog::getOpenFileName(m_ui.browseForGdbButton, + "Browse for gdb startup script"); + if (fileName.isEmpty()) + return; + m_settings->m_scriptFile = fileName; + m_ui.gdbStartupScriptEdit->setText(fileName); } void GdbOptionPage::finished(bool accepted) @@ -109,10 +133,11 @@ void GdbOptionPage::finished(bool accepted) if (!accepted) return; - m_settings->m_gdbCmd = m_ui.gdbEdit->text(); - m_settings->m_gdbEnv = m_ui.envEdit->text(); + m_settings->m_gdbCmd = m_ui.gdbLocationEdit->text(); + m_settings->m_gdbEnv = m_ui.environmentEdit->text(); m_settings->m_autoRun = m_ui.autoStartBox->isChecked(); m_settings->m_autoQuit = m_ui.autoQuitBox->isChecked(); + m_settings->m_scriptFile = m_ui.gdbStartupScriptEdit->text(); Core::ICore *coreIFace = m_pm->getObject(); if (!coreIFace || !coreIFace->settings()) diff --git a/src/plugins/debugger/gdboptionpage.h b/src/plugins/debugger/gdboptionpage.h index 1d71024bac1..684bd789771 100644 --- a/src/plugins/debugger/gdboptionpage.h +++ b/src/plugins/debugger/gdboptionpage.h @@ -35,7 +35,6 @@ #define GDBOPTIONPAGE_H #include "ui_gdboptionpage.h" -#include "ui_gdbtypemacros.h" #include @@ -63,7 +62,8 @@ public: void finished(bool accepted); public slots: - void browse(); + void browseForGdb(); + void browseForScript(); private: ExtensionSystem::PluginManager *m_pm; @@ -72,6 +72,7 @@ private: GdbSettings *m_settings; }; +#if 0 class TypeMacroPage : public Core::IOptionsPage { Q_OBJECT @@ -100,6 +101,7 @@ private: GdbSettings *m_settings; QWidget *m_widget; }; +#endif } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/gdboptionpage.ui b/src/plugins/debugger/gdboptionpage.ui index 4b58d5d7140..a7496851188 100644 --- a/src/plugins/debugger/gdboptionpage.ui +++ b/src/plugins/debugger/gdboptionpage.ui @@ -7,7 +7,7 @@ 0 0 433 - 216 + 233 @@ -23,7 +23,7 @@ - Gdb Debug Options + Locations @@ -33,33 +33,36 @@ 6 - + - + - + + + This is either a full abolute path leading to the gdb binary you intend to use or the name of a gdb binary that wiull be searched in your PATH. + Gdb Location: - gdbEdit + gdbLocationEdit - + Environment: - envEdit + environmentEdit - + @@ -72,6 +75,36 @@ + + + + + + + + 21 + 23 + + + + ... + + + + :/qworkbench/images/fileopen.png:/qworkbench/images/fileopen.png + + + + + + + This is either empty or points to a file containing gdb commands that will be executed immediately after gdb starts up. + + + Gdb Startup Script: + + + diff --git a/src/plugins/debugger/gdbtypemacros.ui b/src/plugins/debugger/gdbtypemacros.ui index aa7215577b4..f42514e4e49 100644 --- a/src/plugins/debugger/gdbtypemacros.ui +++ b/src/plugins/debugger/gdbtypemacros.ui @@ -1,146 +1,115 @@ - - - - + + TypeMacroPage - - + + 0 0 519 - 238 + 263 - + Form - - - 9 - - + + 6 + + 9 + - - - Script File - - - - 9 - - - 6 - - - - - - - - - 21 - 23 - - - - ... - - - - - - - - - + + 0 - + 6 - - - + + + false - + Type - + Macro - - - + + + 21 23 - + + - - :/gdbdebugger/images/newitem.png + + + :/gdbdebugger/images/newitem.png:/gdbdebugger/images/newitem.png - - - + + + Macro Name: - - - + + + Parse as: - - + + - - - + + + 0 - + 0 - - + + 21 23 - + - - - :/gdbdebugger/images/delete.png + + + :/gdbdebugger/images/delete.png:/gdbdebugger/images/delete.png - + Qt::Vertical - + 20 40 @@ -150,25 +119,25 @@ - - + + - - - + + + Type: - - + + - + ASCII (char *) - + Unicode (short) @@ -178,9 +147,8 @@ - - + diff --git a/src/plugins/git/settingspage.cpp b/src/plugins/git/settingspage.cpp index e1b14cb9ccc..7f0581fc3c3 100644 --- a/src/plugins/git/settingspage.cpp +++ b/src/plugins/git/settingspage.cpp @@ -77,7 +77,7 @@ QString SettingsPage::name() const return tr("General"); } - QString SettingsPage::category() const +QString SettingsPage::category() const { return QLatin1String("Git"); } From 9890705295a7dda84507b8969953925ade38169f Mon Sep 17 00:00:00 2001 From: mae Date: Thu, 11 Dec 2008 14:11:28 +0100 Subject: [PATCH 5/9] make the home key jump to column 0 if the caret if before the first non-space --- src/plugins/texteditor/basetexteditor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index d613db7a294..9b4e4254f59 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -2767,6 +2767,8 @@ void BaseTextEditor::handleHomeKey(bool anchor) while (character == tab || character.category() == QChar::Separator_Space) { ++pos; + if (pos == initpos) + break; character = characterAt(pos); } From f149c17d17c2fc86654f770550d43ab98721056e Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Thu, 11 Dec 2008 14:44:24 +0100 Subject: [PATCH 6/9] Fixed possible crash when merging the evironments. --- src/libs/cplusplus/TypeOfExpression.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/cplusplus/TypeOfExpression.cpp b/src/libs/cplusplus/TypeOfExpression.cpp index 53fa7e78396..68732f78ea0 100644 --- a/src/libs/cplusplus/TypeOfExpression.cpp +++ b/src/libs/cplusplus/TypeOfExpression.cpp @@ -107,6 +107,8 @@ void TypeOfExpression::processEnvironment(QMap documents Document::Ptr doc, Environment *env, QSet *processed) const { + if (! doc) + return; if (processed->contains(doc->fileName())) return; processed->insert(doc->fileName()); From 9da7aef44cbeba9a1869b7ce9df3187c3df3432a Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 11 Dec 2008 15:01:22 +0100 Subject: [PATCH 7/9] re-organizize gdb location selection again --- src/plugins/debugger/gdboptionpage.cpp | 38 ++++++++--------- src/plugins/debugger/gdboptionpage.h | 4 +- src/plugins/debugger/gdboptionpage.ui | 56 +++++++------------------- 3 files changed, 33 insertions(+), 65 deletions(-) diff --git a/src/plugins/debugger/gdboptionpage.cpp b/src/plugins/debugger/gdboptionpage.cpp index 8bf1b22a0fc..7d6742e9582 100644 --- a/src/plugins/debugger/gdboptionpage.cpp +++ b/src/plugins/debugger/gdboptionpage.cpp @@ -88,11 +88,15 @@ QWidget *GdbOptionPage::createPage(QWidget *parent) { QWidget *w = new QWidget(parent); m_ui.setupUi(w); - m_ui.gdbLocationEdit->setText(m_settings->m_gdbCmd); + m_ui.gdbLocationChooser->setExpectedKind(Core::Utils::PathChooser::Command); + m_ui.gdbLocationChooser->setPromptDialogTitle(tr("Choose Gdb Location")); + m_ui.gdbLocationChooser->setPath(m_settings->m_gdbCmd); + m_ui.scriptFileChooser->setExpectedKind(Core::Utils::PathChooser::File); + m_ui.scriptFileChooser->setPromptDialogTitle(tr("Choose Location of Startup Script File")); + m_ui.scriptFileChooser->setPath(m_settings->m_scriptFile); m_ui.environmentEdit->setText(m_settings->m_gdbEnv); m_ui.autoStartBox->setChecked(m_settings->m_autoRun); m_ui.autoQuitBox->setChecked(m_settings->m_autoQuit); - m_ui.gdbStartupScriptEdit->setText(m_settings->m_scriptFile); // FIXME m_ui.autoStartBox->hide(); @@ -100,32 +104,22 @@ QWidget *GdbOptionPage::createPage(QWidget *parent) m_ui.environmentEdit->hide(); m_ui.labelEnvironment->hide(); - connect(m_ui.browseForGdbButton, SIGNAL(clicked()), - this, SLOT(browseForGdb())); - connect(m_ui.browseForScriptButton, SIGNAL(clicked()), - this, SLOT(browseForScript())); + connect(m_ui.gdbLocationChooser, SIGNAL(changed()), + this, SLOT(onGdbLocationChanged())); + connect(m_ui.scriptFileChooser, SIGNAL(changed()), + this, SLOT(onScriptFileChanged())); return w; } -void GdbOptionPage::browseForGdb() +void GdbOptionPage::onGdbLocationChanged() { - QString fileName = QFileDialog::getOpenFileName(m_ui.browseForGdbButton, - "Browse for gdb executable"); - if (fileName.isEmpty()) - return; - m_settings->m_gdbCmd = fileName; - m_ui.gdbLocationEdit->setText(fileName); + m_settings->m_gdbCmd = m_ui.gdbLocationChooser->path(); } -void GdbOptionPage::browseForScript() +void GdbOptionPage::onScriptFileChanged() { - QString fileName = QFileDialog::getOpenFileName(m_ui.browseForGdbButton, - "Browse for gdb startup script"); - if (fileName.isEmpty()) - return; - m_settings->m_scriptFile = fileName; - m_ui.gdbStartupScriptEdit->setText(fileName); + m_settings->m_scriptFile = m_ui.scriptFileChooser->path(); } void GdbOptionPage::finished(bool accepted) @@ -133,11 +127,11 @@ void GdbOptionPage::finished(bool accepted) if (!accepted) return; - m_settings->m_gdbCmd = m_ui.gdbLocationEdit->text(); + m_settings->m_gdbCmd = m_ui.gdbLocationChooser->path(); m_settings->m_gdbEnv = m_ui.environmentEdit->text(); m_settings->m_autoRun = m_ui.autoStartBox->isChecked(); m_settings->m_autoQuit = m_ui.autoQuitBox->isChecked(); - m_settings->m_scriptFile = m_ui.gdbStartupScriptEdit->text(); + m_settings->m_scriptFile = m_ui.scriptFileChooser->path(); Core::ICore *coreIFace = m_pm->getObject(); if (!coreIFace || !coreIFace->settings()) diff --git a/src/plugins/debugger/gdboptionpage.h b/src/plugins/debugger/gdboptionpage.h index b9da4ea0111..d306e03e20f 100644 --- a/src/plugins/debugger/gdboptionpage.h +++ b/src/plugins/debugger/gdboptionpage.h @@ -62,8 +62,8 @@ public: void finished(bool accepted); public slots: - void browseForGdb(); - void browseForScript(); + void onGdbLocationChanged(); + void onScriptFileChanged(); private: ExtensionSystem::PluginManager *m_pm; diff --git a/src/plugins/debugger/gdboptionpage.ui b/src/plugins/debugger/gdboptionpage.ui index a7496851188..580f13c0d66 100644 --- a/src/plugins/debugger/gdboptionpage.ui +++ b/src/plugins/debugger/gdboptionpage.ui @@ -32,10 +32,7 @@ 6 - - - - + @@ -46,9 +43,6 @@ Gdb Location: - - gdbLocationEdit - @@ -61,40 +55,6 @@ - - - - - - - - :/qworkbench/images/fileopen.png:/qworkbench/images/fileopen.png - - - false - - - - - - - - - - - 21 - 23 - - - - ... - - - - :/qworkbench/images/fileopen.png:/qworkbench/images/fileopen.png - - - @@ -105,6 +65,12 @@ + + + + + + @@ -137,6 +103,14 @@ + + + Core::Utils::PathChooser + QWidget +
utils/pathchooser.h
+ 1 +
+
From 4f370af4fe38afe904f9edb96fad9771da8078ab Mon Sep 17 00:00:00 2001 From: con Date: Thu, 11 Dec 2008 15:07:14 +0100 Subject: [PATCH 8/9] Fixes: - Avoid ugly toolbar by default on mac --- src/plugins/coreplugin/navigationwidget.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/coreplugin/navigationwidget.cpp b/src/plugins/coreplugin/navigationwidget.cpp index 82ed13a29e8..8e84df39321 100644 --- a/src/plugins/coreplugin/navigationwidget.cpp +++ b/src/plugins/coreplugin/navigationwidget.cpp @@ -334,6 +334,10 @@ NavigationSubWidget::NavigationSubWidget(NavigationWidget *parentWidget) m_navigationComboBox = new NavComboBox(this); m_navigationWidget = 0; +#ifdef Q_OS_MAC + // this is to avoid ugly tool bar behavior + m_navigationComboBox->setMaximumWidth(130); +#endif m_toolbar = new QToolBar(this); m_toolbar->setContentsMargins(0, 0, 0, 0); From c4b222695e30276c6a911eb361721fd3f3ad87ac Mon Sep 17 00:00:00 2001 From: con Date: Thu, 11 Dec 2008 15:11:15 +0100 Subject: [PATCH 9/9] Fixes: - Choose... buttons are push buttons on mac --- src/libs/utils/pathchooser.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index 81a2228e669..100fdbe717f 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -46,11 +46,12 @@ #include #include #include +#include namespace Core { namespace Utils { -#ifdef Q_OS_OSX +#ifdef Q_OS_MAC /*static*/ const char * const PathChooser::browseButtonLabel = "Choose..."; #else /*static*/ const char * const PathChooser::browseButtonLabel = "Browse..."; @@ -112,7 +113,11 @@ PathChooser::PathChooser(QWidget *parent) : hLayout->addWidget(m_d->m_lineEdit); hLayout->setSizeConstraint(QLayout::SetMinimumSize); +#ifdef Q_OS_MAC + QPushButton *browseButton = new QPushButton; +#else QToolButton *browseButton = new QToolButton; +#endif browseButton->setText(tr(browseButtonLabel)); connect(browseButton, SIGNAL(clicked()), this, SLOT(slotBrowse()));