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

This commit is contained in:
goro
2008-12-11 15:40:35 +01:00
15 changed files with 355 additions and 98 deletions

View File

@@ -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);

View File

@@ -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('/'))) {

View File

@@ -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

View File

@@ -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;

View File

@@ -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;

View File

@@ -80,7 +80,7 @@ enum DataDumperState
DataDumperUnavailable,
};
// FIXME: Move to extra file?
class GdbSettings
{
public:

View File

@@ -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,50 @@ 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.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);
connect(m_ui.pushButtonBrowse, SIGNAL(clicked()),
this, SLOT(browse()));
// FIXME
m_ui.autoStartBox->hide();
m_ui.autoQuitBox->hide();
m_ui.environmentEdit->hide();
m_ui.labelEnvironment->hide();
connect(m_ui.gdbLocationChooser, SIGNAL(changed()),
this, SLOT(onGdbLocationChanged()));
connect(m_ui.scriptFileChooser, SIGNAL(changed()),
this, SLOT(onScriptFileChanged()));
return w;
}
void GdbOptionPage::browse()
void GdbOptionPage::onGdbLocationChanged()
{
QString fileName = QFileDialog::getOpenFileName(m_ui.pushButtonBrowse,
"Browse for gdb executable");
if (fileName.isEmpty())
return;
m_settings->m_gdbCmd = fileName;
m_ui.gdbEdit->setText(fileName);
m_settings->m_gdbCmd = m_ui.gdbLocationChooser->path();
}
void GdbOptionPage::onScriptFileChanged()
{
m_settings->m_scriptFile = m_ui.scriptFileChooser->path();
}
void GdbOptionPage::finished(bool accepted)
@@ -109,10 +127,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.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.scriptFileChooser->path();
Core::ICore *coreIFace = m_pm->getObject<Core::ICore>();
if (!coreIFace || !coreIFace->settings())

View File

@@ -35,7 +35,6 @@
#define GDBOPTIONPAGE_H
#include "ui_gdboptionpage.h"
#include "ui_gdbtypemacros.h"
#include <coreplugin/dialogs/ioptionspage.h>
@@ -63,7 +62,8 @@ public:
void finished(bool accepted);
public slots:
void browse();
void onGdbLocationChanged();
void onScriptFileChanged();
private:
ExtensionSystem::PluginManager *m_pm;
@@ -72,6 +72,7 @@ private:
GdbSettings *m_settings;
};
#if 0
class TypeMacroPage : public Core::IOptionsPage
{
Q_OBJECT
@@ -99,6 +100,7 @@ private:
GdbSettings *m_settings;
QWidget *m_widget;
};
#endif
} // namespace Internal
} // namespace Debugger

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>433</width>
<height>216</height>
<height>233</height>
</rect>
</property>
<property name="windowTitle">
@@ -23,7 +23,7 @@
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Gdb Debug Options</string>
<string>Locations</string>
</property>
<layout class="QGridLayout">
<property name="margin">
@@ -32,46 +32,45 @@
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="1">
<widget class="QLineEdit" name="gdbEdit"/>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLineEdit" name="envEdit"/>
<item row="1" column="1">
<widget class="QLineEdit" name="environmentEdit"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<widget class="QLabel" name="labelGdbLocaltion">
<property name="toolTip">
<string>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.</string>
</property>
<property name="text">
<string>Gdb Location:</string>
</property>
<property name="buddy">
<cstring>gdbEdit</cstring>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="labelEnvironment">
<property name="text">
<string>Environment:</string>
</property>
<property name="buddy">
<cstring>envEdit</cstring>
<cstring>environmentEdit</cstring>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pushButtonBrowse">
<item row="2" column="0">
<widget class="QLabel" name="labelGdbStartupScript">
<property name="toolTip">
<string>This is either empty or points to a file containing gdb commands that will be executed immediately after gdb starts up.</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../coreplugin/core.qrc">
<normaloff>:/qworkbench/images/fileopen.png</normaloff>:/qworkbench/images/fileopen.png</iconset>
</property>
<property name="checkable">
<bool>false</bool>
<string>Gdb Startup Script:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Core::Utils::PathChooser" name="scriptFileChooser" native="true"/>
</item>
<item row="0" column="1">
<widget class="Core::Utils::PathChooser" name="gdbLocationChooser" native="true"/>
</item>
</layout>
</widget>
</item>
@@ -104,6 +103,14 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Core::Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../coreplugin/core.qrc"/>
</resources>

View File

@@ -20,24 +20,6 @@
<property name="margin">
<number>9</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Script File</string>
</property>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>9</number>
</property>
<item>
<widget class="Core::Utils::PathChooser" name="scriptFile" native="true"/>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QGridLayout">
<property name="margin">
@@ -75,7 +57,7 @@
<string>+</string>
</property>
<property name="icon">
<iconset resource="debugger.qrc">
<iconset>
<normaloff>:/gdbdebugger/images/newitem.png</normaloff>:/gdbdebugger/images/newitem.png</iconset>
</property>
</widget>
@@ -117,7 +99,7 @@
<string>-</string>
</property>
<property name="icon">
<iconset resource="debugger.qrc">
<iconset>
<normaloff>:/gdbdebugger/images/delete.png</normaloff>:/gdbdebugger/images/delete.png</iconset>
</property>
</widget>
@@ -165,16 +147,8 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Core::Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="debugger.qrc"/>
<include location="gdbdebugger.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -77,7 +77,7 @@ QString SettingsPage::name() const
return tr("General");
}
QString SettingsPage::category() const
QString SettingsPage::category() const
{
return QLatin1String("Git");
}

View File

@@ -735,12 +735,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);
}
@@ -2765,6 +2768,8 @@ void BaseTextEditor::handleHomeKey(bool anchor)
while (character == tab || character.category() == QChar::Separator_Space) {
++pos;
if (pos == initpos)
break;
character = characterAt(pos);
}
@@ -2952,12 +2957,13 @@ void BaseTextEditor::markBlocksAsChanged(QList<int> 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;
@@ -2982,7 +2988,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;
}
@@ -3019,12 +3026,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;
@@ -3050,7 +3058,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;
}
@@ -3092,7 +3101,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)
@@ -3119,7 +3128,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)
@@ -3144,7 +3153,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();
@@ -3166,7 +3175,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();