Commit 6d7c9cb8 authored by con's avatar con
Browse files

Merge commit 'origin/0.9.1-beta'

parents 238b81cc 47c9f22f
......@@ -123,14 +123,13 @@ int qtGhVersion = QT_VERSION;
#endif
#include <list>
#include <map>
#include <string>
#include <vector>
#include <ctype.h>
#include <stdio.h>
//#include <sys/types.h>
#ifdef Q_OS_WIN
# include <windows.h>
#endif
......@@ -172,9 +171,6 @@ public:
// id of the thread that owns the object
QThreadData *threadData;
void moveToThread_helper();
void setThreadData_helper(QThreadData *currentData, QThreadData *targetData);
void _q_reregisterTimers(void *pointer);
struct Sender
{
......@@ -188,20 +184,12 @@ public:
QList<QPointer<QObject> > eventFilters;
struct ExtraData
{
#ifndef QT_NO_USERDATA
QVector<QObjectUserData *> userData;
#endif
QList<QByteArray> propertyNames;
QList<QVariant> propertyValues;
};
struct ExtraData;
ExtraData *extraData;
mutable quint32 connectedSignals;
QString objectName;
// Note: you must hold the signalSlotLock() before accessing the lists below or calling the functions
struct Connection
{
QObject *receiver;
......@@ -214,8 +202,6 @@ public:
QObjectConnectionListVector *connectionLists;
QList<Sender> senders;
int *deleteWatch;
static QObjectPrivate *get(QObject *o) { return o->d_func(); }
};
#if defined(QT_BEGIN_NAMESPACE)
......@@ -291,7 +277,7 @@ static bool startsWith(const char *s, const char *t)
#define qCheckAccess(d) do { qProvokeSegFaultHelper = *(char*)d; } while (0)
#define qCheckPointer(d) do { if (d) qProvokeSegFaultHelper = *(char*)d; } while (0)
// provoke segfault unconditionally
#define qCheck(b) do { if (!b) qProvokeSegFaultHelper = *(char*)0; } while (0)
#define qCheck(b) do { if (!(b)) qProvokeSegFaultHelper = *(char*)0; } while (0)
const char *stripNamespace(const char *type)
{
......@@ -2146,6 +2132,61 @@ static void qDumpStdList(QDumper &d)
d.disarm();
}
static void qDumpStdMap(QDumper &d)
{
typedef std::map<int, int> DummyType;
const DummyType &map = *reinterpret_cast<const DummyType*>(d.data);
const char *keyType = d.templateParameters[0];
const char *valueType = d.templateParameters[1];
const void *p = d.data;
qCheckAccess(p);
p = deref(p);
int nn = map.size();
qCheck(nn >= 0);
DummyType::const_iterator it = map.begin();
for (int i = 0; i < nn && i < 10 && it != map.end(); ++i, ++it)
qCheckAccess(it.operator->());
QByteArray strippedInnerType = stripPointerType(d.innertype);
P(d, "numchild", nn);
P(d, "value", "<" << nn << " items>");
P(d, "valuedisabled", "true");
P(d, "valueoffset", d.extraInt[2]);
if (d.dumpChildren) {
bool simpleKey = isSimpleType(keyType);
bool simpleValue = isShortKey(valueType);
int valueOffset = d.extraInt[2];
d << ",children=[";
it = map.begin();
for (int i = 0; i < 1000 && it != map.end(); ++i, ++it) {
const void *node = it.operator->();
if (simpleKey) {
d.beginHash();
P(d, "type", valueType);
qDumpInnerValueHelper(d, keyType, node, "name");
P(d, "nameisindex", "1");
if (simpleValue)
qDumpInnerValueHelper(d, valueType, addOffset(node, valueOffset));
P(d, "addr", addOffset(node, valueOffset));
d.endHash();
} else {
d.beginHash();
P(d, "name", "[" << i << "]");
P(d, "addr", it.operator->());
P(d, "type", "std::pair<const " << keyType << "," << valueType << " >");
d.endHash();
}
}
if (it != map.end())
d.putEllipsis();
d << "]";
}
d.disarm();
}
static void qDumpStdString(QDumper &d)
{
const std::string &str = *reinterpret_cast<const std::string *>(d.data);
......@@ -2356,9 +2397,9 @@ static void handleProtocolVersion2and3(QDumper & d)
qDumpStdVectorBool(d);
else if (isEqual(type, "std::list"))
qDumpStdList(d);
else if (isEqual(type, "string"))
qDumpStdString(d);
else if (isEqual(type, "std::string"))
else if (isEqual(type, "std::map"))
qDumpStdMap(d);
else if (isEqual(type, "std::string") || isEqual(type, "string"))
qDumpStdString(d);
else if (isEqual(type, "std::wstring"))
qDumpStdWString(d);
......@@ -2383,34 +2424,7 @@ void qDumpObjectData440(
int extraInt2,
int extraInt3)
{
if (protocolVersion == -2) {
// close socket
QDumper d;
d.protocolVersion = protocolVersion;
d.token = token;
d.flush();
d.disarm();
}
else if (protocolVersion == -1) {
// finalize Startup
QDumper d;
d.protocolVersion = protocolVersion;
d.token = token;
d.disarm();
}
else if (protocolVersion == 0) {
QDumper d;
d.protocolVersion = protocolVersion;
d.token = token;
// used to test whether error output gets through
//fprintf(stderr, "using stderr, qDebug follows: %d\n", token);
//qDebug() << "using qDebug, stderr already used: " << token;
d.disarm();
}
else if (protocolVersion == 1) {
if (protocolVersion == 1) {
QDumper d;
d.protocolVersion = protocolVersion;
d.token = token;
......
......@@ -871,6 +871,7 @@ IEditor *EditorManager::openEditor(const QString &fileName, const QString &edito
restoreEditorState(editor);
QApplication::restoreOverrideCursor();
ensureEditorManagerVisible();
setCurrentEditor(editor);
return editor;
}
......@@ -1351,6 +1352,8 @@ bool EditorManager::restoreState(const QByteArray &state)
if (!success)
return false;
QApplication::setOverrideCursor(Qt::WaitCursor);
bool editorChangesSuppressed = m_d->m_suppressEditorChanges;
m_d->m_suppressEditorChanges = true;
......@@ -1366,6 +1369,8 @@ bool EditorManager::restoreState(const QByteArray &state)
m_d->m_suppressEditorChanges = editorChangesSuppressed;
if (currentEditor())
setCurrentEditor(currentEditor());// looks like a null-op but is not
QApplication::restoreOverrideCursor();
return true;
}
......
......@@ -157,6 +157,7 @@ StackedEditorGroup::StackedEditorGroup(QWidget *parent) :
hbox->addWidget(closeButton);
m_infoWidget->setVisible(false);
tl->addWidget(m_infoWidget);
}
tl->addWidget(m_container);
......@@ -166,8 +167,6 @@ StackedEditorGroup::StackedEditorGroup(QWidget *parent) :
l->setMargin(0);
l->addWidget(m_toplevel);
setLayout(l);
m_toplevel->setVisible(false);
}
void StackedEditorGroup::showEditorInfoBar(const QString &kind,
......@@ -226,12 +225,11 @@ void StackedEditorGroup::insertEditor(int index, IEditor *editor)
m_widgetEditorMap.insert(editor->widget(), editor);
QToolBar *toolBar = editor->toolBar();
if (toolBar)
if (toolBar) {
toolBar->setVisible(false); // will be made visible in setCurrentEditor
m_toolBar->layout()->addWidget(toolBar);
connect(editor, SIGNAL(changed()), this, SLOT(updateEditorStatus()));
updateEditorStatus(editor);
updateToolBar(editor);
}
connect(editor, SIGNAL(changed()), this, SLOT(checkEditorStatus()));
emit editorAdded(editor);
}
......@@ -261,10 +259,6 @@ void StackedEditorGroup::removeEditor(IEditor *editor)
toolBar->setVisible(false);
toolBar->setParent(0);
}
if (m_container->count() == 0) {
m_toplevel->setVisible(false);
setFocus();
}
emit editorRemoved(editor);
}
}
......@@ -281,7 +275,6 @@ void StackedEditorGroup::setCurrentEditor(IEditor *editor)
if (!editor || m_container->count() <= 0
|| m_container->indexOf(editor->widget()) == -1)
return;
m_toplevel->setVisible(true);
const int idx = m_container->indexOf(editor->widget());
QTC_ASSERT(idx >= 0, return);
if (m_container->currentIndex() != idx) {
......@@ -290,23 +283,26 @@ void StackedEditorGroup::setCurrentEditor(IEditor *editor)
const bool block = m_editorList->blockSignals(true);
m_editorList->setCurrentIndex(indexOf(editor));
m_editorList->blockSignals(block);
updateEditorStatus(editor);
updateToolBar(editor);
}
setEditorFocus(idx);
updateEditorStatus(editor);
updateToolBar(editor);
if (editor != m_editorForInfoWidget) {
m_infoWidget->hide();
m_editorForInfoWidget = 0;
}
}
void StackedEditorGroup::updateEditorStatus(IEditor *editor)
void StackedEditorGroup::checkEditorStatus()
{
if (!editor)
editor = qobject_cast<IEditor *>(sender());
QTC_ASSERT(editor, return);
IEditor *editor = qobject_cast<IEditor *>(sender());
if (editor == currentEditor())
updateEditorStatus(editor);
}
void StackedEditorGroup::updateEditorStatus(IEditor *editor)
{
static const QIcon lockedIcon(QLatin1String(":/qworkbench/images/locked.png"));
static const QIcon unlockedIcon(QLatin1String(":/qworkbench/images/unlocked.png"));
......@@ -331,8 +327,8 @@ void StackedEditorGroup::updateToolBar(IEditor *editor)
toolBar = m_defaultToolBar;
if (m_activeToolBar == toolBar)
return;
m_activeToolBar->setVisible(false);
toolBar->setVisible(true);
m_activeToolBar->setVisible(false);
m_activeToolBar = toolBar;
}
......
......@@ -80,6 +80,7 @@ protected:
private slots:
void sendCloseRequest();
void updateEditorStatus(Core::IEditor *editor = 0);
void checkEditorStatus();
void setEditorFocus(int index);
void makeEditorWritable();
void listSelectionChanged(int index);
......
......@@ -48,3 +48,13 @@ QKeySequence INavigationWidgetFactory::activationSequence()
return QKeySequence();
}
void INavigationWidgetFactory::saveSettings(int position, QWidget *widget)
{
}
void INavigationWidgetFactory::restoreSettings(int position, QWidget *widget)
{
}
......@@ -65,6 +65,12 @@ public:
// and the docktoolbar widgets
// Similar to how IView
virtual NavigationView createWidget() = 0;
// Read and store settings for the widget, created by this factory
// and beeing at position position. (The position is important since
// a certain type of widget could exist multiple times.)
virtual void saveSettings(int position, QWidget *widget);
virtual void restoreSettings(int position, QWidget *widget);
};
} // namespace Core
......
......@@ -997,7 +997,7 @@ void MainWindow::readSettings()
m_settings->endGroup();
m_editorManager->readSettings(m_settings);
m_navigationWidget->readSettings(m_settings);
m_navigationWidget->restoreSettings(m_settings);
m_rightPaneWidget->readSettings(m_settings);
}
......
......@@ -220,6 +220,8 @@ void NavigationWidget::close()
}
}
void NavigationWidget::saveSettings(QSettings *settings)
{
QStringList views;
......@@ -230,9 +232,12 @@ void NavigationWidget::saveSettings(QSettings *settings)
settings->setValue("Navigation/Visible", isShown());
settings->setValue("Navigation/VerticalPosition", saveState());
settings->setValue("Navigation/Width", m_width);
for (int i=0; i<m_subWidgets.count(); ++i)
m_subWidgets.at(i)->saveSettings(i);
}
void NavigationWidget::readSettings(QSettings *settings)
void NavigationWidget::restoreSettings(QSettings *settings)
{
if (settings->contains("Navigation/Views")) {
QStringList views = settings->value("Navigation/Views").toStringList();
......@@ -266,6 +271,9 @@ void NavigationWidget::readSettings(QSettings *settings)
if (NavigationWidgetPlaceHolder::m_current) {
NavigationWidgetPlaceHolder::m_current->applyStoredSize(m_width);
}
for (int i=0; i<m_subWidgets.count(); ++i)
m_subWidgets.at(i)->restoreSettings(i);
}
void NavigationWidget::setShown(bool b)
......@@ -469,6 +477,16 @@ INavigationWidgetFactory *NavigationSubWidget::factory()
return m_navigationComboBox->itemData(index).value<INavigationWidgetFactory *>();
}
void NavigationSubWidget::saveSettings(int position)
{
factory()->saveSettings(position, m_navigationWidget);
}
void NavigationSubWidget::restoreSettings(int position)
{
factory()->restoreSettings(position, m_navigationWidget);
}
Core::ICommand *NavigationSubWidget::command(const QString &title) const
{
const QHash<QString, Core::ICommand*> commandMap = m_parentWidget->commandMap();
......
......@@ -84,7 +84,7 @@ public:
~NavigationWidget();
void saveSettings(QSettings *settings);
void readSettings(QSettings *settings);
void restoreSettings(QSettings *settings);
bool isShown() const;
void setShown(bool b);
......@@ -133,6 +133,9 @@ public:
void setFactory(const QString &name);
void setFocusWidget();
void saveSettings(int position);
void restoreSettings(int position);
Core::ICommand *command(const QString &title) const;
signals:
......
......@@ -177,14 +177,14 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in
break;
}
}
}
if (m_toolTip.isEmpty()) {
unsigned lineno = tc.blockNumber() + 1;
foreach (const Document::Include &incl, doc->includes()) {
if (lineno == incl.line()) {
m_toolTip = incl.fileName();
break;
if (m_toolTip.isEmpty()) {
unsigned lineno = tc.blockNumber() + 1;
foreach (const Document::Include &incl, doc->includes()) {
if (lineno == incl.line()) {
m_toolTip = incl.fileName();
break;
}
}
}
}
......
......@@ -2941,6 +2941,8 @@ bool GdbEngine::isCustomValueDumperAvailable(const QString &type) const
}
if (tmplate == "std::list")
return true;
if (tmplate == "std::map")
return true;
if (tmplate == "std::vector" && inner != "bool")
return true;
if (tmplate == "std::basic_string") {
......@@ -2962,6 +2964,8 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
QStringList inners = inner.split('@');
if (inners.at(0).isEmpty())
inners.clear();
for (int i = 0; i != inners.size(); ++i)
inners[i] = inners[i].simplified();
QString outertype = isTemplate ? tmplate : data.type;
......@@ -3015,6 +3019,12 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
//extraArgs[extraArgCount++] = sizeofTypeExpression(data.type);
//extraArgs[extraArgCount++] = "(size_t)&(('" + data.type + "'*)0)->value";
}
} else if (outertype == "std::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.
extraArgs[2] = "(size_t)&(('std::pair<const " + inners.at(0)
+ "," + inners.at(1) + ">'*)0)->second";
extraArgs[3] = "0";
} else if (outertype == "std::basic_string") {
//qDebug() << "EXTRACT TEMPLATE: " << outertype << inners;
if (inners.at(0) == "char") {
......@@ -3064,6 +3074,8 @@ void GdbEngine::runCustomDumper(const WatchData & data0, bool dumpChildren)
+ ',' + extraArgs[2]
+ ',' + extraArgs[3] + ')';
//qDebug() << "CMD: " << cmd;
sendSynchronizedCommand(cmd, WatchDumpCustomValue1, QVariant::fromValue(data));
q->showStatusMessage(
......
......@@ -481,3 +481,16 @@ void FindToolBar::openFind()
m_currentDocumentFind->highlightAll(getFindText(), m_plugin->findFlags());
selectFindText();
}
bool FindToolBar::focusNextPrevChild(bool next)
{
// close tab order change
if (next && m_ui.replaceAllButton->hasFocus())
m_ui.findEdit->setFocus(Qt::TabFocusReason);
else if (!next && m_ui.findEdit->hasFocus())
m_ui.replaceAllButton->setFocus(Qt::TabFocusReason);
else
return QToolBar::focusNextPrevChild(next);
return true;
}
......@@ -79,6 +79,9 @@ private slots:
void updateActions();
void findFlagsChanged();
protected:
bool focusNextPrevChild(bool next);
private:
bool setFocusToCurrentFindSupport();
......
......@@ -55,8 +55,8 @@ class AllProjectsFilter : public QuickOpen::BaseFileFilter
public:
AllProjectsFilter(ProjectExplorerPlugin *pe, Core::ICore *core);
QString trName() const { return tr("File in any project"); }
QString name() const { return "File in any project"; }
QString trName() const { return tr("Files in any project"); }
QString name() const { return "Files in any project"; }
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; }
void refresh(QFutureInterface<void> &future);
......
......@@ -55,8 +55,8 @@ class CurrentProjectFilter : public QuickOpen::BaseFileFilter
public:
CurrentProjectFilter(ProjectExplorerPlugin *pe, Core::ICore *core);
QString trName() const { return tr("File in current project"); }
QString name() const { return "File in current project"; }
QString trName() const { return tr("Files in current project"); }
QString name() const { return "Files in current project"; }
QuickOpen::IQuickOpenFilter::Priority priority() const { return QuickOpen::IQuickOpenFilter::Low; }
void refresh(QFutureInterface<void> &future);
......
......@@ -926,6 +926,16 @@ void FlatModel::setGeneratedFilesFilterEnabled(bool filter)
reset();
}
bool FlatModel::projectFilterEnabled()
{
return m_filterProjects;
}
bool FlatModel::generatedFilesFilterEnabled()
{
return m_filterGeneratedFiles;
}
Node *FlatModel::nodeForIndex(const QModelIndex &index) const
{
if (index.isValid())
......
......@@ -136,6 +136,9 @@ public:
ProjectExplorer::Node *nodeForIndex(const QModelIndex &index) const;
QModelIndex indexForNode(const Node *node);
bool projectFilterEnabled();
bool generatedFilesFilterEnabled();
public slots:
void setProjectFilterEnabled(bool filter);
void setGeneratedFilesFilterEnabled(bool filter);
......
......@@ -42,6 +42,7 @@
#include <utils/qtcassert.h>
#include <QtCore/QDebug>
#include <QtCore/QSettings>
#include <QtGui/QHeaderView>
#include <QtGui/QVBoxLayout>
......@@ -156,7 +157,20 @@ ProjectTreeWidget::ProjectTreeWidget(Core::ICore *core, QWidget *parent)
connect(m_explorer->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project *)),
this, SLOT(startupProjectChanged(ProjectExplorer::Project *)));
setAutoSynchronization(true);
m_toggleSync = new QToolButton;
m_toggleSync->setProperty("type", "dockbutton");
m_toggleSync->setIcon(QIcon(":/qworkbench/images/linkicon.png"));
m_toggleSync->setCheckable(true);
m_toggleSync->setChecked(autoSynchronization());
m_toggleSync->setToolTip(tr("Synchronize with Editor"));
connect(m_toggleSync, SIGNAL(clicked(bool)), this, SLOT(toggleAutoSynchronization()));
//setAutoSynchronization(true);
}
QToolButton *ProjectTreeWidget::toggleSync()
{
return m_toggleSync;
}
void ProjectTreeWidget::toggleAutoSynchronization()
......@@ -171,6 +185,7 @@ bool ProjectTreeWidget::autoSynchronization() const
void ProjectTreeWidget::setAutoSynchronization(bool sync, bool syncNow)
{
m_toggleSync->setChecked(sync);
if (sync == m_autoSync)
return;
......@@ -296,6 +311,17 @@ void ProjectTreeWidget::setGeneratedFilesFilter(bool filter)
m_filterGeneratedFilesAction->setChecked(filter);
}
bool ProjectTreeWidget::generatedFilesFilter()
{
return m_model->generatedFilesFilterEnabled();
}
bool ProjectTreeWidget::projectFilter()
{
return m_model->projectFilterEnabled();