Commit 1db3f56d authored by Roberto Raggi's avatar Roberto Raggi
Browse files

Merge branch 'master' of ../mainline into genericprojectmanager

parents c581285c 0c68708c
......@@ -60,6 +60,7 @@ int qtGhVersion = QT_VERSION;
#include <list>
#include <map>
#include <string>
#include <set>
#include <vector>
#include <ctype.h>
......@@ -2236,6 +2237,49 @@ static void qDumpStdMap(QDumper &d)
d.disarm();
}
static void qDumpStdSet(QDumper &d)
{
typedef std::set<int> DummyType;
const DummyType &set = *reinterpret_cast<const DummyType*>(d.data);
const void *p = d.data;
qCheckAccess(p);
p = deref(p);
int nn = set.size();
qCheck(nn >= 0);
DummyType::const_iterator it = set.begin();
for (int i = 0; i < nn && i < 10 && it != set.end(); ++i, ++it)
qCheckAccess(it.operator->());
P(d, "numchild", nn);
P(d, "value", "<" << nn << " items>");
P(d, "valuedisabled", "true");
P(d, "valueoffset", d.extraInt[0]);
if (d.dumpChildren) {
int valueOffset = 0; // d.extraInt[0];
QByteArray strippedInnerType = stripPointerType(d.innertype);
const char *stripped =
isPointerType(d.innertype) ? strippedInnerType.data() : 0;
P(d, "extra"," valueOffset: " << valueOffset);
d << ",children=[";
it = set.begin();
for (int i = 0; i < 1000 && it != set.end(); ++i, ++it) {
const void *node = it.operator->();
d.beginHash();
P(d, "name", i);
qDumpInnerValueOrPointer(d, d.innertype, stripped, node);
d.endHash();
}
if (it != set.end())
d.putEllipsis();
d << "]";
}
d.disarm();
}
static void qDumpStdString(QDumper &d)
{
const std::string &str = *reinterpret_cast<const std::string *>(d.data);
......@@ -2452,6 +2496,8 @@ static void handleProtocolVersion2and3(QDumper & d)
qDumpStdList(d);
else if (isEqual(type, "std::map"))
qDumpStdMap(d);
else if (isEqual(type, "std::set"))
qDumpStdSet(d);
else if (isEqual(type, "std::string") || isEqual(type, "string"))
qDumpStdString(d);
else if (isEqual(type, "std::wstring"))
......@@ -2527,6 +2573,7 @@ void qDumpObjectData440(
"\"std::basic_string\","
"\"std::list\","
"\"std::map\","
"\"std::set\","
"\"std::string\","
"\"std::vector\","
"\"std::wstring\","
......
......@@ -11,7 +11,7 @@ win32 {
CONFIG(debug, debug|release):LIBS *= -lExtensionSystemd -lAggregationd
else:LIBS *= -lExtensionSystem -lAggregation
}
linux-* {
unix:!macx {
LIBS *= -lExtensionSystem -lAggregation
target.path = /bin
......
......@@ -114,8 +114,6 @@ public:
QObject *instance();
static QObjectList staticInstances();
bool load();
bool unload();
bool isLoaded() const;
......@@ -831,9 +829,6 @@ QString PatchedPluginLoader::errorString() const
return (!d || d->errorString.isEmpty()) ? QLibrary::tr("Unknown error") : d->errorString;
}
typedef QList<QtPluginInstanceFunction> StaticInstanceFunctionList;
Q_GLOBAL_STATIC(StaticInstanceFunctionList, staticInstanceFunctionList)
void PatchedPluginLoader::setLoadHints(QLibrary::LoadHints loadHints)
{
if (!d) {
......@@ -853,24 +848,6 @@ QLibrary::LoadHints PatchedPluginLoader::loadHints() const
return d->loadHints;
}
void qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunction function)
{
staticInstanceFunctionList()->append(function);
}
QObjectList PatchedPluginLoader::staticInstances()
{
QObjectList instances;
StaticInstanceFunctionList *functions = staticInstanceFunctionList();
if (functions) {
for (int i = 0; i < functions->count(); ++i)
instances.append((*functions)[i]());
}
return instances;
}
......
......@@ -1138,13 +1138,12 @@ void MainWindow::aboutToShowRecentFiles()
ActionContainer *aci =
m_actionManager->actionContainer(Constants::M_FILE_RECENTFILES);
aci->menu()->clear();
m_recentFilesActions.clear();
bool hasRecentFiles = false;
foreach (QString s, m_fileManager->recentFiles()) {
foreach (const QString &fileName, m_fileManager->recentFiles()) {
hasRecentFiles = true;
QAction *action = aci->menu()->addAction(s);
m_recentFilesActions.insert(action, s);
QAction *action = aci->menu()->addAction(fileName);
action->setData(fileName);
connect(action, SIGNAL(triggered()), this, SLOT(openRecentFile()));
}
aci->menu()->setEnabled(hasRecentFiles);
......@@ -1152,9 +1151,12 @@ void MainWindow::aboutToShowRecentFiles()
void MainWindow::openRecentFile()
{
QAction *a = qobject_cast<QAction*>(sender());
if (m_recentFilesActions.contains(a)) {
editorManager()->openEditor(m_recentFilesActions.value(a));
QAction *action = qobject_cast<QAction*>(sender());
if (!action)
return;
QString fileName = action->data().toString();
if (!fileName.isEmpty()) {
editorManager()->openEditor(fileName);
editorManager()->ensureEditorManagerVisible();
}
}
......
......@@ -191,8 +191,6 @@ private:
GeneralSettings *m_generalSettings;
ShortcutSettings *m_shortcutSettings;
QMap<QAction*, QString> m_recentFilesActions;
// actions
QShortcut *m_focusToEditor;
QAction *m_newAction;
......
......@@ -35,6 +35,7 @@
#include <functional>
#include <QtConcurrentRun>
#include <QFutureSynchronizer>
#include <qtconcurrent/runextensions.h>
#include <texteditor/itexteditor.h>
......@@ -163,6 +164,7 @@ class CppPreprocessor: public CPlusPlus::Client
{
public:
CppPreprocessor(QPointer<CppModelManager> modelManager);
virtual ~CppPreprocessor();
void setWorkingCopy(const QMap<QString, QByteArray> &workingCopy);
void setIncludePaths(const QStringList &includePaths);
......@@ -212,6 +214,7 @@ private:
Document::Ptr m_currentDoc;
QSet<QString> m_todo;
QSet<QString> m_processed;
QFutureSynchronizer<void> m_synchronizer;
};
} // namespace Internal
......@@ -221,6 +224,11 @@ CppPreprocessor::CppPreprocessor(QPointer<CppModelManager> modelManager)
: snapshot(modelManager->snapshot()),
m_modelManager(modelManager),
preprocess(this, &env)
{
m_synchronizer.setCancelOnWait(true);
}
CppPreprocessor::~CppPreprocessor()
{ }
void CppPreprocessor::setWorkingCopy(const QMap<QString, QByteArray> &workingCopy)
......@@ -502,7 +510,7 @@ void CppPreprocessor::sourceNeeded(QString &fileName, IncludeType type,
snapshot.insert(doc->fileName(), doc);
m_todo.remove(fileName);
QtConcurrent::run(Process(m_modelManager), doc);
m_synchronizer.addFuture(QtConcurrent::run(Process(m_modelManager), doc));
(void) switchDocument(previousDoc);
}
......@@ -528,6 +536,8 @@ Document::Ptr CppPreprocessor::switchDocument(Document::Ptr doc)
CppModelManager::CppModelManager(QObject *parent)
: CppModelManagerInterface(parent)
{
m_synchronizer.setCancelOnWait(true);
m_core = Core::ICore::instance(); // FIXME
m_dirty = true;
......@@ -702,6 +712,19 @@ QFuture<void> CppModelManager::refreshSourceFiles(const QStringList &sourceFiles
QFuture<void> result = QtConcurrent::run(&CppModelManager::parse,
preproc, sourceFiles);
if (m_synchronizer.futures().size() > 10) {
QList<QFuture<void> > futures = m_synchronizer.futures();
m_synchronizer.clearFutures();
foreach (QFuture<void> future, futures) {
if (! (future.isFinished() || future.isCanceled()))
m_synchronizer.addFuture(future);
}
}
m_synchronizer.addFuture(result);
if (sourceFiles.count() > 1) {
m_core->progressManager()->addTask(result, tr("Indexing"),
CppTools::Constants::TASK_INDEX,
......
......@@ -38,6 +38,7 @@
#include <QMap>
#include <QFutureInterface>
#include <QFutureSynchronizer>
#include <QMutex>
#include <QTimer>
#include <QTextEdit>
......@@ -174,6 +175,8 @@ private:
QList<Editor> m_todo;
QTimer *m_updateEditorSelectionsTimer;
QFutureSynchronizer<void> m_synchronizer;
};
} // namespace Internal
......
......@@ -60,6 +60,7 @@
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QTextStream>
#include <QtCore/QTime>
#include <QtCore/QTimer>
......@@ -97,6 +98,29 @@ DebuggerSettings::DebuggerSettings()
m_listSourceFiles = false;
}
QString DebuggerSettings::dump()
{
QString out;
QTextStream ts(&out);
ts << "Debugger settings: "
<< " gdbCmd: " << m_gdbCmd
<< " gdbEnv: " << m_gdbEnv
<< " autoRun: " << m_autoRun
<< " autoQuit: " << m_autoQuit
<< " useCustomDumpers: " << m_useCustomDumpers
<< " skipKnownFrames: " << m_skipKnownFrames
<< " debugDumpers: " << m_debugDumpers
<< " useToolTips: " << m_useToolTips
<< " listSourceFiles: " << m_listSourceFiles
<< " scriptFile: " << m_scriptFile
<< " pluginAllBreakpoints: " << m_pluginAllBreakpoints
<< " pluginSelectedBreakpoints: " << m_pluginSelectedBreakpoints
<< " pluginNoBreakpoints: " << m_pluginNoBreakpoints
<< " pluginSelectedBreakpointsPattern: " << m_pluginSelectedBreakpointsPattern;
return out;
}
///////////////////////////////////////////////////////////////////////
//
// BreakByFunctionDialog
......@@ -236,6 +260,8 @@ void DebuggerManager::init()
this, SLOT(loadSymbols(QString)));
connect(modulesView, SIGNAL(loadAllSymbolsRequested()),
this, SLOT(loadAllSymbols()));
connect(modulesView, SIGNAL(fileOpenRequested(QString)),
this, SLOT(fileOpen(QString)));
// Source Files
//m_sourceFilesHandler = new SourceFilesHandler;
......@@ -244,6 +270,8 @@ void DebuggerManager::init()
//sourceFileView->setModel(m_stackHandler->stackModel());
connect(sourceFilesView, SIGNAL(reloadSourceFilesRequested()),
this, SLOT(reloadSourceFiles()));
connect(sourceFilesView, SIGNAL(fileOpenRequested(QString)),
this, SLOT(fileOpen(QString)));
// Registers
QAbstractItemView *registerView =
......@@ -1366,6 +1394,13 @@ void DebuggerManager::gotoLocation(const QString &fileName, int line,
emit gotoLocationRequested(fileName, line, setMarker);
}
void DebuggerManager::fileOpen(const QString &fileName)
{
// connected to the plugin
emit gotoLocationRequested(fileName, 1, false);
}
//////////////////////////////////////////////////////////////////////
//
......
......@@ -185,6 +185,7 @@ class DebuggerSettings
{
public:
DebuggerSettings();
QString dump();
public:
QString m_gdbCmd;
......@@ -195,7 +196,6 @@ public:
bool m_useCustomDumpers;
bool m_skipKnownFrames;
bool m_debugDumpers;
bool m_useFastStart;
bool m_useToolTips;
bool m_listSourceFiles;
......@@ -245,6 +245,7 @@ public slots:
QVariant sessionValue(const QString &name);
void gotoLocation(const QString &file, int line, bool setLocationMarker);
void fileOpen(const QString &file);
void resetLocation();
void interruptDebuggingRequest();
......
......@@ -1558,6 +1558,7 @@ int GdbEngine::currentFrame() const
bool GdbEngine::startDebugger()
{
debugMessage(q->settings()->dump());
QStringList gdbArgs;
if (m_gdbProc.state() != QProcess::NotRunning) {
......@@ -3194,6 +3195,11 @@ void GdbEngine::runCustomDumper(const WatchData &data0, bool dumpChildren)
} else if (outertype == "std::stack") {
// remove 'std::allocator<...>':
extraArgs[1] = "0";
} else if (outertype == "std::set") {
// remove 'std::less<...>':
extraArgs[1] = "0";
// remove 'std::allocator<...>':
extraArgs[2] = "0";
} 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.
......
......@@ -48,6 +48,16 @@ ModulesWindow::ModulesWindow(QWidget *parent)
setAlternatingRowColors(true);
setRootIsDecorated(false);
setIconSize(QSize(10, 10));
connect(this, SIGNAL(activated(QModelIndex)),
this, SLOT(moduleActivated(QModelIndex)));
}
void ModulesWindow::moduleActivated(const QModelIndex &index)
{
qDebug() << "ACTIVATED: " << index.row() << index.column()
<< model()->data(index);
emit fileOpenRequested(model()->data(index).toString());
}
void ModulesWindow::resizeEvent(QResizeEvent *event)
......@@ -73,19 +83,30 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
QString name = model()->data(index).toString();
QMenu menu;
QAction *act0 = new QAction("Update module list", &menu);
QAction *act1 = new QAction("Adjust column widths to contents", &menu);
QAction *act2 = new QAction("Always adjust column widths to contents", &menu);
QAction *act0 = new QAction(tr("Update module list"), &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("Show source files for module " + name, &menu);
QAction *act4 = new QAction("Load symbols for all modules", &menu);
QAction *act5 = new QAction("Load symbols for module " + name, &menu);
QAction *act3 = new QAction(tr("Show source files for module \"%1\"").arg(name),
&menu);
QAction *act4 = new QAction(tr("Load symbols for all modules"), &menu);
QAction *act5 = 0;
QAction *act6 = 0;
if (name.isEmpty()) {
act5 = new QAction(tr("Load symbols for module"), &menu);
act6 = new QAction(tr("Edit file"), &menu);
} else {
act5 = new QAction(tr("Load symbols for module \"%1\"").arg(name), &menu);
act6 = new QAction(tr("Edit file \"%1\"").arg(name), &menu);
}
act5->setDisabled(name.isEmpty());
act6->setDisabled(name.isEmpty());
menu.addAction(act0);
menu.addAction(act4);
menu.addAction(act5);
menu.addAction(act6);
menu.addSeparator();
menu.addAction(act1);
menu.addAction(act2);
......@@ -104,6 +125,8 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev)
emit loadAllSymbolsRequested();
else if (act == act5)
emit loadSymbolsRequested(name);
else if (act == act6)
emit fileOpenRequested(name);
}
void ModulesWindow::resizeColumnsToContents()
......
......@@ -47,17 +47,18 @@ signals:
void displaySourceRequested(const QString &modulesName);
void loadSymbolsRequested(const QString &modulesName);
void loadAllSymbolsRequested();
void fileOpenRequested(QString);
public slots:
void resizeColumnsToContents();
void setAlwaysResizeColumnsToContents(bool on);
void moduleActivated(const QModelIndex &);
protected:
private:
void resizeEvent(QResizeEvent *ev);
void contextMenuEvent(QContextMenuEvent *ev);
void setModel(QAbstractItemModel *model);
private:
bool m_alwaysResizeColumnsToContents;
};
......
......@@ -178,28 +178,40 @@ SourceFilesWindow::SourceFilesWindow(QWidget *parent)
this, SLOT(sourceFileActivated(QModelIndex)));
}
SourceFilesWindow::~SourceFilesWindow()
{
}
void SourceFilesWindow::sourceFileActivated(const QModelIndex &index)
{
qDebug() << "ACTIVATED: " << index.row() << index.column();
qDebug() << "ACTIVATED: " << index.row() << index.column()
<< model()->data(index);
emit fileOpenRequested(model()->data(index).toString());
}
void SourceFilesWindow::contextMenuEvent(QContextMenuEvent *ev)
{
QModelIndex index = indexAt(ev->pos());
index = index.sibling(index.row(), 0);
QString name = model()->data(index).toString();
QMenu menu;
QAction *act1 = new QAction(tr("Reload data"), &menu);
//act1->setCheckable(true);
QAction *act2 = 0;
if (name.isEmpty()) {
act2 = new QAction(tr("Open file"), &menu);
act2->setEnabled(false);
} else {
act2 = new QAction(tr("Open file \"%1\"'").arg(name), &menu);
act2->setEnabled(true);
}
menu.addAction(act1);
menu.addAction(act2);
QAction *act = menu.exec(ev->globalPos());
if (act == act1) {
if (act == act1)
emit reloadSourceFilesRequested();
}
else if (act == act2)
emit fileOpenRequested(name);
}
void SourceFilesWindow::setSourceFiles(const QMap<QString, QString> &sourceFiles)
......
......@@ -50,13 +50,13 @@ class SourceFilesWindow : public QTreeView
public:
SourceFilesWindow(QWidget *parent = 0);
~SourceFilesWindow();
void setSourceFiles(const QMap<QString, QString> &sourceFiles);
void removeAll();
signals:
void reloadSourceFilesRequested();
void fileOpenRequested(QString file);
private slots:
void sourceFileActivated(const QModelIndex &index);
......
......@@ -424,6 +424,16 @@ static QString niceType(QString type)
type.replace(re3.cap(0), "std::map<" + re3.cap(1) + ", " + re3.cap(2) + ">");
}
// std::set
static QRegExp re4("std::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), "std::set<" + re4.cap(1) + ">");
}
type.replace(" >", ">");
}
return type;
......
......@@ -1106,12 +1106,14 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
finishMovement();
} else if (key == 'i') {
recordBeginGroup();
m_dotCommand = "i"; //QString("%1i").arg(count());
enterInsertMode();
updateMiniBuffer();
if (atEndOfLine())
moveLeft();
} else if (key == 'I') {
recordBeginGroup();
m_dotCommand = "I"; //QString("%1I").arg(count());
enterInsertMode();
if (m_gflag)
moveToStartOfLine();
......@@ -1192,6 +1194,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
} else if (key == 'o' || key == 'O') {
recordBeginGroup();
recordPosition();
m_dotCommand = QString("%1o").arg(count());
enterInsertMode();
moveToFirstNonBlankOnLine();
int numSpaces = leftDist();
......@@ -1255,7 +1258,7 @@ EventResult FakeVimHandler::Private::handleCommandMode(int key, int unmodified,
setAnchor();
moveRight(qMin(count(), rightDist()));
m_registers[m_register] = recordRemoveSelectedText();
//m_dotCommand = QString("%1s").arg(count());
m_dotCommand = "s"; //QString("%1s").arg(count());
m_opcount.clear();
m_mvcount.clear();
enterInsertMode();
......
......@@ -77,7 +77,6 @@
#include <coreplugin/iversioncontrol.h>
#include <coreplugin/vcsmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/listutils.h>
#include <utils/qtcassert.h>
#include <QtCore/QtPlugin>
......@@ -1493,7 +1492,6 @@ void ProjectExplorerPlugin::updateRecentProjectMenu()
Core::ICore::instance()->actionManager()->actionContainer(Constants::M_RECENTPROJECTS);
QMenu *menu = aci->menu();
menu->clear();
m_recentProjectsActions.clear();
menu->setEnabled(!m_recentProjects.isEmpty());
......@@ -1502,7 +1500,7 @@ void ProjectExplorerPlugin::updateRecentProjectMenu()
if (s.endsWith(".qws"))
continue;
QAction *action = menu->addAction(s);
m_recentProjectsActions.insert(action, s);
action->setData(s);
connect(action, SIGNAL(triggered()), this, SLOT(openRecentProject()));
}
}
......@@ -1513,10 +1511,11 @@ void ProjectExplorerPlugin::openRecentProject()
qDebug() << "ProjectExplorerPlugin::openRecentProject()";
QAction *a = qobject_cast<QAction*>(sender());