Commit e6843ff5 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

Merge commit 'origin/1.1'

parents 3a5b6825 7b84e0c9
......@@ -77,5 +77,3 @@ Lots of improvements to
Additional credits go to:
* Martin Aumueller <aumuell@reserv.at> (FakeVim improvements)
* Kris Wong (different patches)
//TODO: this refers to commit c6419ff008bbf1afd2dfa4ed18a09de039cccef6
......@@ -44,6 +44,7 @@ unix:!macx {
}
target.files += $$OUT_PWD/$$DESTDIR/$$IDE_APP_WRAPPER
target.files += $$OUT_PWD/$$DESTDIR/$$IDE_APP_TARGET
target.path = /bin
INSTALLS += target
......
......@@ -265,9 +265,14 @@ int ExpressionUnderCursor::startOfFunctionCall(const QTextCursor &cursor)
break;
else if (tk.is(T_LPAREN))
return startPosition + tk.position();
else if (tk.is(T_RPAREN))
index = startOfMatchingBrace(tokens, index);
else
else if (tk.is(T_RPAREN)) {
int matchingBrace = startOfMatchingBrace(tokens, index);
if (matchingBrace == index) // If no matching brace found
return -1;
index = matchingBrace;
} else
--index;
}
......
......@@ -171,9 +171,16 @@ QString CMakeManager::findQtDir(const ProjectExplorer::Environment &env)
QFileInfo qmake(path + "/" + possibleCommand);
if (qmake.exists()) {
if (!qtVersionForQMake(qmake.absoluteFilePath()).isNull()) {
QDir dir(qmake.absoluteDir());
dir.cdUp();
return dir.absolutePath();
QProcess proc;
proc.start(qmake.absoluteFilePath(), QStringList() << "-query" << "QT_INSTALL_DATA");
if (proc.waitForFinished()) {
return proc.readAll().trimmed();
} else {
proc.kill();
QDir dir(qmake.absoluteDir());
dir.cdUp();
return dir.absolutePath();
}
}
}
}
......
......@@ -835,6 +835,24 @@ QSize SplitterOrView::minimumSizeHint() const
return QSize(64, 64);
}
QSplitter *SplitterOrView::takeSplitter()
{
QSplitter *oldSplitter = m_splitter;
if (m_splitter)
m_layout->removeWidget(m_splitter);
m_splitter = 0;
return oldSplitter;
}
EditorView *SplitterOrView::takeView()
{
EditorView *oldView = m_view;
if (m_view)
m_layout->removeWidget(m_view);
m_view = 0;
return oldView;
}
void SplitterOrView::split(Qt::Orientation orientation)
{
Q_ASSERT(m_view && m_splitter == 0);
......@@ -903,13 +921,12 @@ void SplitterOrView::unsplit()
Q_ASSERT(m_splitter->count() == 1);
EditorManager *em = CoreImpl::instance()->editorManager();
SplitterOrView *childSplitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(0));
QSplitter *oldSplitter = m_splitter;
m_splitter = 0;
if (childSplitterOrView->isSplitter()) {
Q_ASSERT(childSplitterOrView->view() == 0);
m_splitter = childSplitterOrView->splitter();
m_splitter = childSplitterOrView->takeSplitter();
m_layout->addWidget(m_splitter);
m_layout->setCurrentWidget(m_splitter);
} else {
......@@ -923,8 +940,7 @@ void SplitterOrView::unsplit()
}
em->emptyView(childView);
} else {
m_view = childView;
childSplitterOrView->m_layout->removeWidget(m_view);
m_view = childSplitterOrView->takeView();
m_layout->addWidget(m_view);
}
m_layout->setCurrentWidget(m_view);
......
......@@ -197,6 +197,8 @@ public:
inline bool hasEditors() const { return m_view && m_view->editorCount() != 0; }
inline EditorView *view() const { return m_view; }
inline QSplitter *splitter() const { return m_splitter; }
QSplitter *takeSplitter();
EditorView *takeView();
SplitterOrView *findView(Core::IEditor *editor);
......
......@@ -47,7 +47,7 @@ public:
virtual ~IOutputPane() {}
virtual QWidget *outputWidget(QWidget *parent) = 0;
virtual QList<QWidget*> toolBarWidgets(void) const = 0;
virtual QList<QWidget*> toolBarWidgets() const = 0;
virtual QString name() const = 0;
// -1 don't show in statusBar
......
......@@ -48,7 +48,7 @@ public:
~MessageOutputWindow();
QWidget *outputWidget(QWidget *parent);
QList<QWidget*> toolBarWidgets(void) const { return QList<QWidget *>(); }
QList<QWidget*> toolBarWidgets() const { return QList<QWidget *>(); }
QString name() const;
int priorityInStatusBar() const;
......
......@@ -1073,20 +1073,6 @@ void CPPEditor::unCommentSelection()
cursor.endEditBlock();
}
int CPPEditor::endOfNameAtPosition(int pos)
{
if (pos == -1)
pos = position();
QChar chr = characterAt(pos);
// Skip to the start of a name
while (chr.isLetterOrNumber() || chr == QLatin1Char('_'))
chr = characterAt(++pos);
return pos;
}
CPPEditor::Link CPPEditor::linkToSymbol(CPlusPlus::Symbol *symbol)
{
const QString fileName = QString::fromUtf8(symbol->fileName(),
......
......@@ -127,8 +127,6 @@ private:
void createToolBar(CPPEditorEditable *editable);
int endOfNameAtPosition(int pos);
struct Link
{
Link(const QString &fileName = QString(),
......
......@@ -85,15 +85,15 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev)
{
QMenu menu;
QModelIndex index = indexAt(ev->pos());
QAction *act0 = new QAction("Delete breakpoint", &menu);
QAction *act0 = new QAction(tr("Delete breakpoint"), &menu);
act0->setEnabled(index.isValid());
QAction *act1 = new QAction("Adjust column widths to contents", &menu);
QAction *act2 = new QAction("Always adjust column widths to contents", &menu);
QAction *act1 = new QAction(tr("Adjust column widths to contents"), &menu);
QAction *act2 = new QAction(tr("Always adjust column widths to contents"), &menu);
act2->setCheckable(true);
act2->setChecked(m_alwaysResizeColumnsToContents);
QAction *act3 = new QAction("Edit condition...", &menu);
QAction *act3 = new QAction(tr("Edit condition..."), &menu);
act0->setEnabled(index.isValid());
QAction *act4 = new QAction("Syncronize breakpoints", &menu);
QAction *act4 = new QAction(tr("Syncronize breakpoints"), &menu);
menu.addAction(act0);
menu.addAction(act3);
......
......@@ -96,16 +96,7 @@ QString DebuggerSettings::dump()
return out;
}
//////////////////////////////////////////////////////////////////////////
//
// Debugger specific actions and settings
//
//////////////////////////////////////////////////////////////////////////
DebuggerSettings *theDebuggerSettings()
DebuggerSettings *DebuggerSettings::instance()
{
static DebuggerSettings *instance = 0;
if (instance)
......@@ -117,18 +108,18 @@ DebuggerSettings *theDebuggerSettings()
item = new SavedAction(instance);
instance->insertItem(SettingsDialog, item);
item->setText(QObject::tr("Debugger properties..."));
item->setText(tr("Debugger properties..."));
//
// View
//
item = new SavedAction(instance);
instance->insertItem(AdjustColumnWidths, item);
item->setText(QObject::tr("Adjust column widths to contents"));
item->setText(tr("Adjust column widths to contents"));
item = new SavedAction(instance);
instance->insertItem(AlwaysAdjustColumnWidths, item);
item->setText(QObject::tr("Always adjust column widths to contents"));
item->setText(tr("Always adjust column widths to contents"));
item->setCheckable(true);
//
......@@ -136,15 +127,15 @@ DebuggerSettings *theDebuggerSettings()
//
item = new SavedAction(instance);
instance->insertItem(WatchExpression, item);
item->setTextPattern(QObject::tr("Watch expression \"%1\""));
item->setTextPattern(tr("Watch expression \"%1\""));
item = new SavedAction(instance);
instance->insertItem(RemoveWatchExpression, item);
item->setTextPattern(QObject::tr("Remove watch expression \"%1\""));
item->setTextPattern(tr("Remove watch expression \"%1\""));
item = new SavedAction(instance);
instance->insertItem(WatchExpressionInWindow, item);
item->setTextPattern(QObject::tr("Watch expression \"%1\" in separate window"));
item->setTextPattern(tr("Watch expression \"%1\" in separate window"));
item = new SavedAction(instance);
instance->insertItem(AssignValue, item);
......@@ -154,11 +145,11 @@ DebuggerSettings *theDebuggerSettings()
item = new SavedAction(instance);
instance->insertItem(ExpandItem, item);
item->setText(QObject::tr("Expand item"));
item->setText(tr("Expand item"));
item = new SavedAction(instance);
instance->insertItem(CollapseItem, item);
item->setText(QObject::tr("Collapse item"));
item->setText(tr("Collapse item"));
//
// DebuggingHelper
......@@ -167,7 +158,7 @@ DebuggerSettings *theDebuggerSettings()
instance->insertItem(UseDebuggingHelpers, item);
item->setDefaultValue(true);
item->setSettingsKey("DebugMode", "UseDebuggingHelper");
item->setText(QObject::tr("Use Debugging Helper"));
item->setText(tr("Use Debugging Helper"));
item->setCheckable(true);
item->setDefaultValue(true);
......@@ -183,19 +174,19 @@ DebuggerSettings *theDebuggerSettings()
item = new SavedAction(instance);
instance->insertItem(DebugDebuggingHelpers, item);
item->setSettingsKey("DebugMode", "DebugDebuggingHelpers");
item->setText(QObject::tr("Debug debugging helper"));
item->setText(tr("Debug debugging helper"));
item->setCheckable(true);
item = new SavedAction(instance);
item->setText(QObject::tr("Recheck debugging helper availability"));
item->setText(tr("Recheck debugging helper availability"));
instance->insertItem(RecheckDebuggingHelpers, item);
//
// Breakpoints
//
item = new SavedAction(instance);
item->setText(QObject::tr("Syncronize breakpoints"));
item->setText(tr("Syncronize breakpoints"));
instance->insertItem(SynchronizeBreakpoints, item);
//
......@@ -206,7 +197,7 @@ DebuggerSettings *theDebuggerSettings()
registerFormatGroup->setExclusive(true);
item = new SavedAction(instance);
item->setText(QObject::tr("Hexadecimal"));
item->setText(tr("Hexadecimal"));
item->setCheckable(true);
item->setSettingsKey("DebugMode", "FormatHexadecimal");
item->setChecked(true);
......@@ -214,35 +205,35 @@ DebuggerSettings *theDebuggerSettings()
registerFormatGroup->addAction(item);
item = new SavedAction(instance);
item->setText(QObject::tr("Decimal"));
item->setText(tr("Decimal"));
item->setCheckable(true);
item->setSettingsKey("DebugMode", "FormatDecimal");
instance->insertItem(FormatDecimal, item);
registerFormatGroup->addAction(item);
item = new SavedAction(instance);
item->setText(QObject::tr("Octal"));
item->setText(tr("Octal"));
item->setCheckable(true);
item->setSettingsKey("DebugMode", "FormatOctal");
instance->insertItem(FormatOctal, item);
registerFormatGroup->addAction(item);
item = new SavedAction(instance);
item->setText(QObject::tr("Binary"));
item->setText(tr("Binary"));
item->setCheckable(true);
item->setSettingsKey("DebugMode", "FormatBinary");
instance->insertItem(FormatBinary, item);
registerFormatGroup->addAction(item);
item = new SavedAction(instance);
item->setText(QObject::tr("Raw"));
item->setText(tr("Raw"));
item->setCheckable(true);
item->setSettingsKey("DebugMode", "FormatRaw");
instance->insertItem(FormatRaw, item);
registerFormatGroup->addAction(item);
item = new SavedAction(instance);
item->setText(QObject::tr("Natural"));
item->setText(tr("Natural"));
item->setCheckable(true);
item->setSettingsKey("DebugMode", "FormatNatural");
instance->insertItem(FormatNatural, item);
......@@ -266,13 +257,13 @@ DebuggerSettings *theDebuggerSettings()
item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "AutoQuit");
item->setText(QObject::tr("Automatically quit debugger"));
item->setText(tr("Automatically quit debugger"));
item->setCheckable(true);
instance->insertItem(AutoQuit, item);
item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "UseToolTips");
item->setText(QObject::tr("Use tooltips when debugging"));
item->setText(tr("Use tooltips when debugging"));
item->setCheckable(true);
instance->insertItem(UseToolTips, item);
......@@ -283,13 +274,13 @@ DebuggerSettings *theDebuggerSettings()
item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "ListSourceFiles");
item->setText(QObject::tr("List source files"));
item->setText(tr("List source files"));
item->setCheckable(true);
instance->insertItem(ListSourceFiles, item);
item = new SavedAction(instance);
item->setSettingsKey("DebugMode", "SkipKnownFrames");
item->setText(QObject::tr("Skip known frames"));
item->setText(tr("Skip known frames"));
item->setCheckable(true);
instance->insertItem(SkipKnownFrames, item);
......@@ -315,29 +306,35 @@ DebuggerSettings *theDebuggerSettings()
instance->insertItem(MaximalStackDepth, item);
item = new SavedAction(instance);
item->setText(QObject::tr("Reload full stack"));
item->setText(tr("Reload full stack"));
instance->insertItem(ExpandStack, item);
item = new SavedAction(instance);
item->setText(QObject::tr("Execute line"));
item->setText(tr("Execute line"));
instance->insertItem(ExecuteCommand, item);
return instance;
}
//////////////////////////////////////////////////////////////////////////
//
// DebuggerActions
//
//////////////////////////////////////////////////////////////////////////
SavedAction *theDebuggerAction(int code)
{
return theDebuggerSettings()->item(code);
return DebuggerSettings::instance()->item(code);
}
bool theDebuggerBoolSetting(int code)
{
return theDebuggerSettings()->item(code)->value().toBool();
return DebuggerSettings::instance()->item(code)->value().toBool();
}
QString theDebuggerStringSetting(int code)
{
return theDebuggerSettings()->item(code)->value().toString();
return DebuggerSettings::instance()->item(code)->value().toString();
}
} // namespace Internal
......
......@@ -50,6 +50,8 @@ public:
QString dump();
static DebuggerSettings *instance();
public slots:
void readSettings(QSettings *settings);
void writeSettings(QSettings *settings);
......@@ -121,7 +123,6 @@ enum DebuggerActionCode
};
// singleton access
DebuggerSettings *theDebuggerSettings();
Core::Utils::SavedAction *theDebuggerAction(int code);
// convienience
......
......@@ -46,7 +46,7 @@ public:
DebuggerOutputWindow(QWidget *parent = 0);
QWidget *outputWidget(QWidget *) { return this; }
QList<QWidget*> toolBarWidgets(void) const { return QList<QWidget *>(); }
QList<QWidget*> toolBarWidgets() const { return QList<QWidget *>(); }
QString name() const { return windowTitle(); }
void visibilityChanged(bool /*visible*/) {}
......
......@@ -498,8 +498,9 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
m_gdbRunningContext = uidm->uniqueIdentifier(Constants::GDBRUNNING);
// FIXME: make this a global action
m_breakpointMarginAction = new QAction(this);
m_breakpointMarginAction->setText("Toggle Breakpoint");
m_breakpointMarginAction->setText(tr("Toggle Breakpoint"));
//m_breakpointMarginAction->setIcon(QIcon(":/gdbdebugger/images/breakpoint.svg"));
connect(m_breakpointMarginAction, SIGNAL(triggered()),
this, SLOT(breakpointMarginActionTriggered()));
......@@ -976,7 +977,7 @@ void DebuggerPlugin::writeSettings() const
QTC_ASSERT(m_manager->mainWindow(), return);
QSettings *s = settings();
theDebuggerSettings()->writeSettings(s);
DebuggerSettings::instance()->writeSettings(s);
s->beginGroup(QLatin1String("DebugMode"));
s->setValue("State", m_manager->mainWindow()->saveState());
s->setValue("Locked", m_toggleLockedAction->isChecked());
......@@ -986,7 +987,7 @@ void DebuggerPlugin::writeSettings() const
void DebuggerPlugin::readSettings()
{
QSettings *s = settings();
theDebuggerSettings()->readSettings(s);
DebuggerSettings::instance()->readSettings(s);
QString defaultCommand("gdb");
#if defined(Q_OS_WIN32)
......
......@@ -121,13 +121,11 @@ QVariant DisassemblerModel::headerData(int section, Qt::Orientation orientation,
int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
static const char * const headers[] = {
QT_TR_NOOP("Address"),
QT_TR_NOOP("Symbol"),
QT_TR_NOOP("Mnemonic"),
switch (section) {
case 1: return DisassemblerHandler::tr("Address");
case 2: return DisassemblerHandler::tr("Symbol");
case 3: return DisassemblerHandler::tr("Mnemonic");
};
if (section < 3)
return tr(headers[section]);
}
return QVariant();
}
......
......@@ -28,6 +28,7 @@
**************************************************************************/
#include "disassemblerwindow.h"
#include "debuggeractions.h"
#include <QAction>
#include <QDebug>
......@@ -68,24 +69,23 @@ void DisassemblerWindow::resizeEvent(QResizeEvent *ev)
void DisassemblerWindow::contextMenuEvent(QContextMenuEvent *ev)
{
QMenu menu;
//QTreeWidgetItem *item = itemAt(ev->pos());
QAction *act1 = new QAction("Adjust column widths to contents", &menu);
QAction *act2 = new QAction("Always adjust column widths to contents", &menu);
QAction *act1 = new QAction(tr("Adjust column widths to contents"), &menu);
QAction *act2 = new QAction(tr("Always adjust column widths to contents"), &menu);
act2->setCheckable(true);
// FIXME: make this a SavedAction
act2->setChecked(m_alwaysResizeColumnsToContents);
QAction *act3 = new QAction("Reload disassembler listing", &menu);
QAction *act4 = new QAction("Always reload disassembler listing", &menu);
QAction *act3 = new QAction(tr("Reload disassembler listing"), &menu);
QAction *act4 = new QAction(tr("Always reload disassembler listing"), &menu);
act4->setCheckable(true);
act4->setChecked(m_alwaysReloadContents);
//if (item) {
// menu.addAction(act0);
// menu.addSeparator();
//}
menu.addAction(act3);
//menu.addAction(act4);
menu.addSeparator();
menu.addAction(act1);
menu.addAction(act2);
menu.addSeparator();
menu.addAction(theDebuggerAction(SettingsDialog));
QAction *act = menu.exec(ev->globalPos());
......
......@@ -47,6 +47,7 @@
#include "debuggerdialogs.h"
#include <utils/qtcassert.h>
#include <coreplugin/icore.h>
#include <QtCore/QDebug>
#include <QtCore/QDir>
......@@ -60,6 +61,8 @@
#include <QtGui/QMainWindow>
#include <QtGui/QMessageBox>
#include <QtGui/QToolTip>
#include <QtGui/QDialogButtonBox>
#include <QtGui/QPushButton>
#if defined(Q_OS_LINUX) || defined(Q_OS_MAC)
#include <unistd.h>
......@@ -233,6 +236,8 @@ void GdbEngine::initializeConnections()
connect(theDebuggerAction(ExpandStack), SIGNAL(triggered()),
this, SLOT(reloadFullStack()));
connect(theDebuggerAction(MaximalStackDepth), SIGNAL(triggered()),
this, SLOT(reloadFullStack()));
}
void GdbEngine::initializeVariables()
......@@ -1534,7 +1539,7 @@ int GdbEngine::currentFrame() const
bool GdbEngine::startDebugger()
{
debugMessage(theDebuggerSettings()->dump());
debugMessage(DebuggerSettings::instance()->dump());
QStringList gdbArgs;
if (m_gdbProc.state() != QProcess::NotRunning) {
......@@ -2727,7 +2732,7 @@ void GdbEngine::setToolTipExpression(const QPoint &pos, const QString &exp0)
if (!hasLetterOrNumber(exp)) {
QToolTip::showText(m_toolTipPos,
"'" + exp + "' contains no identifier");
tr("'%1' contains no identifier").arg(exp));
return;
}
......@@ -2750,8 +2755,8 @@ void GdbEngine::setToolTipExpression(const QPoint &pos, const QString &exp0)
if (hasSideEffects(exp)) {
QToolTip::showText(m_toolTipPos,
"Cowardly refusing to evaluate expression '" + exp
+ "' with potential side effects");
tr("Cowardly refusing to evaluate expression '%1' "
"with potential side effects").arg(exp));
return;
}
......@@ -2763,7 +2768,7 @@ void GdbEngine::setToolTipExpression(const QPoint &pos, const QString &exp0)
qDebug() << "THIS IN ROW " << i;
if (m_currentLocals.childAt(i).type.startsWith(exp)) {
QToolTip::showText(m_toolTipPos,
exp + ": type of current 'this'");
tr("%1: type of current 'this'").arg(exp));
qDebug() << " TOOLTIP CRASH SUPPRESSED";
return;
}
......@@ -3001,12 +3006,10 @@ void GdbEngine::runDebuggingHelper(const WatchData &data0, bool dumpChildren)
} else if (outertype == m_namespace + "QObjectSlot"
|| outertype == m_namespace + "QObjectSignal") {
// we need the number out of something like