Commit e7cd1e23 authored by dt's avatar dt
Browse files

Merge commit 'origin/master'

parents 7ff8d61a 49b245af
......@@ -311,7 +311,7 @@ static bool isSimpleType(const char *type)
static bool isShortKey(const char *type)
{
return isSimpleType(type) || isEqual(type, "QString");
return isSimpleType(type) || isEqual(type, NS"QString");
}
static bool isMovableType(const char *type)
......@@ -555,7 +555,7 @@ void QDumper::addCommaIfNeeded()
put(',');
}
void QDumper::putBase64Encoded(const char *buf, int n)
void QDumper::putBase64Encoded(const char *buf, int n, char delim)
{
const char alphabet[] = "ABCDEFGH" "IJKLMNOP" "QRSTUVWX" "YZabcdef"
"ghijklmn" "opqrstuv" "wxyz0123" "456789+/";
......@@ -704,44 +704,44 @@ static void qDumpUnknown(QDumper &d)
}
static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr,
const char *key = "value")
const char *field = "value")
{
type = stripNamespace(type);
switch (type[1]) {
case 'l':
if (isEqual(type, "float"))
P(d, key, *(float*)addr);
P(d, field, *(float*)addr);
return;
case 'n':
if (isEqual(type, "int"))
P(d, key, *(int*)addr);
P(d, field, *(int*)addr);
else if (isEqual(type, "unsigned"))
P(d, key, *(unsigned int*)addr);
P(d, field, *(unsigned int*)addr);
else if (isEqual(type, "unsigned int"))
P(d, key, *(unsigned int*)addr);
P(d, field, *(unsigned int*)addr);
else if (isEqual(type, "unsigned long"))
P(d, key, *(unsigned long*)addr);
P(d, field, *(unsigned long*)addr);
else if (isEqual(type, "unsigned long long"))
P(d, key, *(qulonglong*)addr);
P(d, field, *(qulonglong*)addr);
return;
case 'o':
if (isEqual(type, "bool"))
switch (*(bool*)addr) {
case 0: P(d, key, "false"); break;
case 1: P(d, key, "true"); break;
default: P(d, key, *(bool*)addr); break;
case 0: P(d, field, "false"); break;
case 1: P(d, field, "true"); break;
default: P(d, field, *(bool*)addr); break;
}
else if (isEqual(type, "double"))
P(d, key, *(double*)addr);
P(d, field, *(double*)addr);
else if (isEqual(type, "long"))
P(d, key, *(long*)addr);
P(d, field, *(long*)addr);
else if (isEqual(type, "long long"))
P(d, key, *(qulonglong*)addr);
P(d, field, *(qulonglong*)addr);
return;
case 'B':
if (isEqual(type, "QByteArray")) {
d << key << "encoded=\"1\",";
P(d, key, *(QByteArray*)addr);
d << field << "encoded=\"1\",";
P(d, field, *(QByteArray*)addr);
}
return;
case 'L':
......@@ -769,8 +769,8 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr
return;
case 'S':
if (isEqual(type, "QString")) {
d << key << "encoded=\"1\",";
P(d, key, *(QString*)addr);
d << field << "encoded=\"1\",";
P(d, field, *(QString*)addr);
}
return;
default:
......
......@@ -361,7 +361,7 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
this, SLOT(updateActions()));
connect(this, SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(updateEditorHistory()));
m_d->m_splitter = new EditorSplitter(m_d->m_core);
m_d->m_splitter = new EditorSplitter;
connect(m_d->m_splitter, SIGNAL(closeRequested(Core::IEditor *)),
this, SLOT(closeEditor(Core::IEditor *)));
connect(m_d->m_splitter, SIGNAL(editorGroupsChanged()),
......
......@@ -51,10 +51,9 @@
using namespace Core;
using namespace Core::Internal;
EditorSplitter::EditorSplitter(ICore *core, QWidget *parent)
EditorSplitter::EditorSplitter(QWidget *parent)
: QWidget(parent),
m_curGroup(0),
m_core(core)
m_curGroup(0)
{
registerActions();
createRootGroup();
......@@ -69,9 +68,9 @@ void EditorSplitter::registerActions()
{
QList<int> gc = QList<int>() << Constants::C_GLOBAL_ID;
const QList<int> editorManagerContext =
QList<int>() << m_core->uniqueIDManager()->uniqueIdentifier(Constants::C_EDITORMANAGER);
QList<int>() << ICore::instance()->uniqueIDManager()->uniqueIdentifier(Constants::C_EDITORMANAGER);
ActionManager *am = m_core->actionManager();
ActionManager *am = ICore::instance()->actionManager();
ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW);
Command *cmd;
......@@ -538,13 +537,13 @@ QWidget *EditorSplitter::recreateGroupTree(QWidget *node)
void EditorSplitter::saveCurrentLayout()
{
QSettings *settings = m_core->settings();
QSettings *settings = ICore::instance()->settings();
settings->setValue("EditorManager/Splitting", saveState());
}
void EditorSplitter::restoreDefaultLayout()
{
QSettings *settings = m_core->settings();
QSettings *settings = ICore::instance()->settings();
if (settings->contains("EditorManager/Splitting"))
restoreState(settings->value("EditorManager/Splitting").toByteArray());
}
......@@ -656,12 +655,12 @@ EditorGroup *EditorSplitter::createGroup()
this, SLOT(updateActions()));
connect(group, SIGNAL(editorAdded(Core::IEditor *)),
this, SLOT(updateActions()));
m_core->addContextObject(group->contextObject());
ICore::instance()->addContextObject(group->contextObject());
return group;
}
void EditorSplitter::deleteGroup(EditorGroup *group)
{
m_core->removeContextObject(group->contextObject());
ICore::instance()->removeContextObject(group->contextObject());
delete group;
}
......@@ -45,7 +45,6 @@
namespace Core {
class EditorGroup;
class ICore;
class IEditor;
namespace Internal {
......@@ -55,7 +54,7 @@ class EditorSplitter : public QWidget
Q_OBJECT
public:
EditorSplitter(ICore *core, QWidget *parent = 0);
explicit EditorSplitter(QWidget *parent = 0);
~EditorSplitter();
void setCurrentGroup(Core::EditorGroup *group);
......@@ -114,7 +113,6 @@ private:
QWidget *m_root;
EditorGroup *m_curGroup;
ICore *m_core;
QAction *m_horizontalSplitAction;
QAction *m_verticalSplitAction;
......
......@@ -120,7 +120,7 @@ MainWindow::MainWindow() :
m_editorManager(0),
m_fileManager(new FileManager(this)),
m_progressManager(new ProgressManagerPrivate()),
m_scriptManager(new ScriptManagerPrivate(this, m_coreImpl)),
m_scriptManager(new ScriptManagerPrivate(this)),
m_variableManager(new VariableManager(this)),
m_vcsManager(new VCSManager()),
m_viewManager(0),
......
......@@ -181,10 +181,8 @@ static QScriptValue fileBox(QScriptContext *context, QScriptEngine *engine)
namespace Core {
namespace Internal {
ScriptManagerPrivate::ScriptManagerPrivate(QObject *parent, ICore *core) :
ScriptManager(parent),
m_core(core),
m_initialized(false)
ScriptManagerPrivate::ScriptManagerPrivate(QObject *parent)
: ScriptManager(parent), m_initialized(false)
{
}
......@@ -250,7 +248,6 @@ void ScriptManagerPrivate::ensureEngineInitialized()
{
if (m_initialized)
return;
QTC_ASSERT(m_core, return);
// register QObjects that occur as properties
SharedTools::registerQObject<QMainWindow>(m_engine);
SharedTools::registerQObject<QStatusBar>(m_engine);
......@@ -274,7 +271,7 @@ void ScriptManagerPrivate::ensureEngineInitialized()
// SharedTools::registerQObjectInterface<Core::ICore, CorePrototype>(m_engine);
// Make "core" available
m_engine.globalObject().setProperty(QLatin1String("core"), qScriptValueFromValue(&m_engine, m_core));
m_engine.globalObject().setProperty(QLatin1String("core"), qScriptValueFromValue(&m_engine, Core::ICore::instance()));
// CLASSIC: registerInterfaceWithDefaultPrototype<Core::MessageManager, MessageManagerPrototype>(m_engine);
......
......@@ -37,13 +37,9 @@
#include <coreplugin/scriptmanager/scriptmanager.h>
#include <QtCore/QObject>
#include <QtCore/QList>
#include <QtScript/QScriptEngine>
namespace Core {
class ICore;
namespace Internal {
class ScriptManagerPrivate : public Core::ScriptManager
......@@ -51,12 +47,11 @@ class ScriptManagerPrivate : public Core::ScriptManager
Q_OBJECT
public:
ScriptManagerPrivate(QObject *parent, ICore *core);
virtual QScriptEngine &scriptEngine();
explicit ScriptManagerPrivate(QObject *parent);
virtual bool runScript(const QString &script, QString *errorMessage, Stack *stack);
virtual bool runScript(const QString &script, QString *errorMessage);
QScriptEngine &scriptEngine();
bool runScript(const QString &script, QString *errorMessage, Stack *stack);
bool runScript(const QString &script, QString *errorMessage);
static QString engineError(QScriptEngine &scriptEngine);
......@@ -64,7 +59,6 @@ private:
void ensureEngineInitialized();
QScriptEngine m_engine;
ICore *m_core;
bool m_initialized;
};
......
......@@ -74,9 +74,10 @@ using namespace CPlusPlus;
namespace CppTools {
namespace Internal {
class FunctionArgumentWidget : public QLabel {
class FunctionArgumentWidget : public QLabel
{
public:
FunctionArgumentWidget(Core::ICore *core);
FunctionArgumentWidget();
void showFunctionHint(Function *functionSymbol, const Snapshot &snapshot);
protected:
......@@ -183,10 +184,10 @@ protected:
using namespace CppTools::Internal;
FunctionArgumentWidget::FunctionArgumentWidget(Core::ICore *core)
FunctionArgumentWidget::FunctionArgumentWidget()
: m_item(0)
{
QObject *editorObject = core->editorManager()->currentEditor();
QObject *editorObject = Core::ICore::instance()->editorManager()->currentEditor();
m_editor = qobject_cast<TextEditor::ITextEditor *>(editorObject);
m_popupFrame = new QFrame(0, Qt::ToolTip|Qt::WindowStaysOnTopHint);
......@@ -311,9 +312,8 @@ void FunctionArgumentWidget::updateHintText()
setText(text);
}
CppCodeCompletion::CppCodeCompletion(CppModelManager *manager, Core::ICore *core)
CppCodeCompletion::CppCodeCompletion(CppModelManager *manager)
: ICompletionCollector(manager),
m_core(core),
m_manager(manager),
m_caseSensitivity(Qt::CaseSensitive),
m_autoInsertBraces(true),
......@@ -1030,7 +1030,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
Function *function = symbol->type()->asFunction();
QTC_ASSERT(function, return);
m_functionArgumentWidget = new FunctionArgumentWidget(m_core);
m_functionArgumentWidget = new FunctionArgumentWidget();
m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.snapshot());
}
} else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) {
......
......@@ -34,23 +34,17 @@
#ifndef CPPCODECOMPLETION_H
#define CPPCODECOMPLETION_H
// C++ front-end
#include <ASTfwd.h>
#include <FullySpecifiedType.h>
#include <cplusplus/Icons.h>
#include <cplusplus/Overview.h>
#include <cplusplus/TypeOfExpression.h>
// Qt Creator
#include <texteditor/icompletioncollector.h>
// Qt
#include <QtCore/QObject>
#include <QtCore/QPointer>
namespace Core {
class ICore;
}
namespace TextEditor {
class ITextEditor;
......@@ -66,7 +60,7 @@ class CppCodeCompletion : public TextEditor::ICompletionCollector
{
Q_OBJECT
public:
CppCodeCompletion(CppModelManager *manager, Core::ICore *core);
explicit CppCodeCompletion(CppModelManager *manager);
bool triggersCompletion(TextEditor::ITextEditable *editor);
int startCompletion(TextEditor::ITextEditable *editor);
......@@ -131,7 +125,6 @@ private:
TextEditor::ITextEditable *m_editor;
int m_startPosition; // Position of the cursor from which completion started
Core::ICore *m_core;
CppModelManager *m_manager;
Qt::CaseSensitivity m_caseSensitivity;
bool m_autoInsertBraces;
......
......@@ -87,7 +87,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
// Objects
m_modelManager = new CppModelManager(this);
addAutoReleasedObject(m_modelManager);
m_completion = new CppCodeCompletion(m_modelManager, core);
m_completion = new CppCodeCompletion(m_modelManager);
addAutoReleasedObject(m_completion);
CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager,
core->editorManager());
......
......@@ -61,6 +61,7 @@
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/session.h>
......@@ -85,8 +86,6 @@
#include <QtGui/QTextCursor>
namespace ExtensionSystem { class PluginManager; }
using namespace Core;
using namespace Debugger::Constants;
using namespace Debugger::Internal;
......@@ -144,6 +143,11 @@ const char * const ADD_TO_WATCH_KEY = "Ctrl+Alt+Q";
} // namespace Debugger
static ProjectExplorer::SessionManager *sessionManager()
{
return ProjectExplorer::ProjectExplorerPlugin::instance()->session();
}
///////////////////////////////////////////////////////////////////////
//
// DebugMode
......@@ -339,7 +343,6 @@ void GdbOptionPage::apply()
DebuggerPlugin::DebuggerPlugin()
{
m_pm = 0;
m_generalOptionPage = 0;
m_locationMark = 0;
m_manager = 0;
......@@ -390,8 +393,6 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
m_manager = new DebuggerManager;
m_pm = ExtensionSystem::PluginManager::instance();
ICore *core = ICore::instance();
QTC_ASSERT(core, return false);
......@@ -663,9 +664,9 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
//
// ProjectExplorer
connect(projectExplorer()->session(), SIGNAL(sessionLoaded()),
connect(sessionManager(), SIGNAL(sessionLoaded()),
m_manager, SLOT(sessionLoaded()));
connect(projectExplorer()->session(), SIGNAL(aboutToSaveSession()),
connect(sessionManager(), SIGNAL(aboutToSaveSession()),
m_manager, SLOT(aboutToSaveSession()));
// EditorManager
......@@ -706,11 +707,6 @@ void DebuggerPlugin::extensionsInitialized()
{
}
ProjectExplorer::ProjectExplorerPlugin *DebuggerPlugin::projectExplorer() const
{
return m_pm->getObject<ProjectExplorer::ProjectExplorerPlugin>();
}
/*! Activates the previous mode when the current mode is the debug mode. */
void DebuggerPlugin::activatePreviousMode()
{
......@@ -822,17 +818,14 @@ void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor,
void DebuggerPlugin::setSessionValue(const QString &name, const QVariant &value)
{
//qDebug() << "SET SESSION VALUE" << name << value;
ProjectExplorerPlugin *pe = projectExplorer();
if (pe->session())
pe->session()->setValue(name, value);
else
qDebug() << "FIXME: Session does not exist yet";
QTC_ASSERT(sessionManager(), return);
sessionManager()->setValue(name, value);
}
void DebuggerPlugin::querySessionValue(const QString &name, QVariant *value)
{
ProjectExplorerPlugin *pe = projectExplorer();
*value = pe->session()->value(name);
QTC_ASSERT(sessionManager(), return);
*value = sessionManager()->value(name);
//qDebug() << "GET SESSION VALUE: " << name << value;
}
......
......@@ -34,19 +34,26 @@
#ifndef DEBUGGERPLUGIN_H
#define DEBUGGERPLUGIN_H
#include <projectexplorer/projectexplorer.h>
#include <extensionsystem/iplugin.h>
#include <QtCore/QObject>
QT_BEGIN_NAMESPACE
class QAbstractItemView;
class QAction;
class QCursor;
class QAbstractItemView;
class QMenu;
class QPoint;
QT_END_NAMESPACE
namespace Core { class IEditor; }
namespace TextEditor { class ITextEditor; }
namespace Core {
class IEditor;
class IMode;
}
namespace TextEditor {
class ITextEditor;
}
namespace Debugger {
namespace Internal {
......@@ -99,12 +106,9 @@ private:
friend class GdbOptionPage;
friend class DebugMode; // FIXME: Just a hack now so that it can access the views
ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const;
DebuggerManager *m_manager;
DebugMode *m_debugMode;
ExtensionSystem::PluginManager *m_pm;
GdbOptionPage *m_generalOptionPage;
QString m_previousMode;
......
......@@ -2761,14 +2761,17 @@ static void setWatchDataValue(WatchData &data, const GdbMi &mi,
break;
case 1: // base64 encoded 8 bit data
ba = QByteArray::fromBase64(mi.data());
ba = '"' + ba + '"';
break;
case 2: // base64 encoded 16 bit data
ba = QByteArray::fromBase64(mi.data());
ba = QString::fromUtf16((ushort *)ba.data(), ba.size() / 2).toUtf8();
ba = '"' + ba + '"';
break;
case 3: // base64 encoded 32 bit data
ba = QByteArray::fromBase64(mi.data());
ba = QString::fromUcs4((uint *)ba.data(), ba.size() / 4).toUtf8();
ba = '"' + ba + '"';
break;
}
data.setValue(ba);
......@@ -3550,13 +3553,12 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
data1.iname = data.iname + "." + data1.name;
if (!data1.name.isEmpty() && data1.name.at(0).isDigit())
data1.name = '[' + data1.name + ']';
//qDebug() << "NAMEENCODED: " << item.findChild("nameencoded").data()
// << item.findChild("nameencoded").data()[1];
if (item.findChild("nameencoded").data()[0] == '1')
data1.name = QByteArray::fromBase64(data1.name.toUtf8());
QString key = item.findChild("key").data();
if (!key.isEmpty())
if (!key.isEmpty()) {
if (item.findChild("keyencoded").data()[0] == '1')
key = '"' + QByteArray::fromBase64(key.toUtf8()) + '"';
data1.name += " (" + key + ")";
}
setWatchDataType(data1, item.findChild("type"));
setWatchDataExpression(data1, item.findChild("exp"));
setWatchDataChildCount(data1, item.findChild("numchild"));
......
......@@ -61,6 +61,8 @@
#include <QtHelp/QHelpEngine>
#include <coreplugin/coreconstants.h>
using namespace Help::Internal;
namespace {
......@@ -228,20 +230,23 @@ void CentralWidget::setSource(const QUrl &url)
void CentralWidget::setLastShownPages()
{
const QStringList lastShownPageList = helpEngine->customValue(QLatin1String("LastShownPages")).
toString().split(QLatin1Char('|'), QString::SkipEmptyParts);
const QStringList lastShownPageList =
helpEngine->customValue(QLatin1String("LastShownPages")). toString().
split(QLatin1Char('|'), QString::SkipEmptyParts);
if (!lastShownPageList.isEmpty()) {
foreach (const QString page, lastShownPageList)
foreach (const QString& page, lastShownPageList)
setSourceInNewTab(page);
tabWidget->setCurrentIndex(helpEngine->customValue(QLatin1String("LastTabPage"), 0).toInt());
tabWidget->setCurrentIndex(helpEngine->
customValue(QLatin1String("LastTabPage"), 0).toInt());
} else {
QUrl url = helpEngine->findFile(QUrl("qthelp://com.trolltech.qt.440/qdoc/index.html"));
if (url.isValid())
setSource(url);
else
setSource(QUrl("qthelp://com.trolltech.qt.440/qdoc/index.html"));
QUrl url(helpEngine->findFile(QUrl("qthelp://com.trolltech.qt.440/qdoc/index.html")));
if (!url.isValid()) {
url.setUrl(QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html").
arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
}
setSource(url);
}
updateBrowserFont();
......@@ -392,19 +397,33 @@ void CentralWidget::setGlobalActions(const QList<QAction*> &actions)
{
globalActionList = actions;
}
void CentralWidget::setSourceInNewTab(const QUrl &url)
{
HelpViewer* viewer = new HelpViewer(helpEngine, this);
viewer->installEventFilter(this);
viewer->setSource(url);
viewer->setFocus(Qt::OtherFocusReason);
tabWidget->setCurrentIndex(tabWidget->addTab(viewer, viewer->documentTitle()));
tabWidget->setCurrentIndex(tabWidget->addTab(viewer,
quoteTabTitle(viewer->documentTitle())));
#if defined(QT_NO_WEBIT)
QFont font = qApp->font();
if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool())
font = qVariantValue<QFont>(helpEngine->customValue(QLatin1String("browserFont")));
viewer->setFont(font);
#else
QWebView* view = qobject_cast<QWebView*> (viewer);
if (view) {
QWebSettings* settings = QWebSettings::globalSettings();
int fontSize = settings->fontSize(QWebSettings::DefaultFontSize);
QString fontFamily = settings->fontFamily(QWebSettings::StandardFont);
settings = view->settings();
settings->setFontSize(QWebSettings::DefaultFontSize, fontSize);
settings->setFon