forked from qt-creator/qt-creator
Merge commit 'origin/master'
This commit is contained in:
@@ -311,7 +311,7 @@ static bool isSimpleType(const char *type)
|
|||||||
|
|
||||||
static bool isShortKey(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)
|
static bool isMovableType(const char *type)
|
||||||
@@ -555,7 +555,7 @@ void QDumper::addCommaIfNeeded()
|
|||||||
put(',');
|
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"
|
const char alphabet[] = "ABCDEFGH" "IJKLMNOP" "QRSTUVWX" "YZabcdef"
|
||||||
"ghijklmn" "opqrstuv" "wxyz0123" "456789+/";
|
"ghijklmn" "opqrstuv" "wxyz0123" "456789+/";
|
||||||
@@ -704,44 +704,44 @@ static void qDumpUnknown(QDumper &d)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr,
|
static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr,
|
||||||
const char *key = "value")
|
const char *field = "value")
|
||||||
{
|
{
|
||||||
type = stripNamespace(type);
|
type = stripNamespace(type);
|
||||||
switch (type[1]) {
|
switch (type[1]) {
|
||||||
case 'l':
|
case 'l':
|
||||||
if (isEqual(type, "float"))
|
if (isEqual(type, "float"))
|
||||||
P(d, key, *(float*)addr);
|
P(d, field, *(float*)addr);
|
||||||
return;
|
return;
|
||||||
case 'n':
|
case 'n':
|
||||||
if (isEqual(type, "int"))
|
if (isEqual(type, "int"))
|
||||||
P(d, key, *(int*)addr);
|
P(d, field, *(int*)addr);
|
||||||
else if (isEqual(type, "unsigned"))
|
else if (isEqual(type, "unsigned"))
|
||||||
P(d, key, *(unsigned int*)addr);
|
P(d, field, *(unsigned int*)addr);
|
||||||
else if (isEqual(type, "unsigned int"))
|
else if (isEqual(type, "unsigned int"))
|
||||||
P(d, key, *(unsigned int*)addr);
|
P(d, field, *(unsigned int*)addr);
|
||||||
else if (isEqual(type, "unsigned long"))
|
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"))
|
else if (isEqual(type, "unsigned long long"))
|
||||||
P(d, key, *(qulonglong*)addr);
|
P(d, field, *(qulonglong*)addr);
|
||||||
return;
|
return;
|
||||||
case 'o':
|
case 'o':
|
||||||
if (isEqual(type, "bool"))
|
if (isEqual(type, "bool"))
|
||||||
switch (*(bool*)addr) {
|
switch (*(bool*)addr) {
|
||||||
case 0: P(d, key, "false"); break;
|
case 0: P(d, field, "false"); break;
|
||||||
case 1: P(d, key, "true"); break;
|
case 1: P(d, field, "true"); break;
|
||||||
default: P(d, key, *(bool*)addr); break;
|
default: P(d, field, *(bool*)addr); break;
|
||||||
}
|
}
|
||||||
else if (isEqual(type, "double"))
|
else if (isEqual(type, "double"))
|
||||||
P(d, key, *(double*)addr);
|
P(d, field, *(double*)addr);
|
||||||
else if (isEqual(type, "long"))
|
else if (isEqual(type, "long"))
|
||||||
P(d, key, *(long*)addr);
|
P(d, field, *(long*)addr);
|
||||||
else if (isEqual(type, "long long"))
|
else if (isEqual(type, "long long"))
|
||||||
P(d, key, *(qulonglong*)addr);
|
P(d, field, *(qulonglong*)addr);
|
||||||
return;
|
return;
|
||||||
case 'B':
|
case 'B':
|
||||||
if (isEqual(type, "QByteArray")) {
|
if (isEqual(type, "QByteArray")) {
|
||||||
d << key << "encoded=\"1\",";
|
d << field << "encoded=\"1\",";
|
||||||
P(d, key, *(QByteArray*)addr);
|
P(d, field, *(QByteArray*)addr);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case 'L':
|
case 'L':
|
||||||
@@ -769,8 +769,8 @@ static void qDumpInnerValueHelper(QDumper &d, const char *type, const void *addr
|
|||||||
return;
|
return;
|
||||||
case 'S':
|
case 'S':
|
||||||
if (isEqual(type, "QString")) {
|
if (isEqual(type, "QString")) {
|
||||||
d << key << "encoded=\"1\",";
|
d << field << "encoded=\"1\",";
|
||||||
P(d, key, *(QString*)addr);
|
P(d, field, *(QString*)addr);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
|
@@ -361,7 +361,7 @@ EditorManager::EditorManager(ICore *core, QWidget *parent) :
|
|||||||
this, SLOT(updateActions()));
|
this, SLOT(updateActions()));
|
||||||
connect(this, SIGNAL(currentEditorChanged(Core::IEditor*)),
|
connect(this, SIGNAL(currentEditorChanged(Core::IEditor*)),
|
||||||
this, SLOT(updateEditorHistory()));
|
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 *)),
|
connect(m_d->m_splitter, SIGNAL(closeRequested(Core::IEditor *)),
|
||||||
this, SLOT(closeEditor(Core::IEditor *)));
|
this, SLOT(closeEditor(Core::IEditor *)));
|
||||||
connect(m_d->m_splitter, SIGNAL(editorGroupsChanged()),
|
connect(m_d->m_splitter, SIGNAL(editorGroupsChanged()),
|
||||||
|
@@ -51,10 +51,9 @@
|
|||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Core::Internal;
|
using namespace Core::Internal;
|
||||||
|
|
||||||
EditorSplitter::EditorSplitter(ICore *core, QWidget *parent)
|
EditorSplitter::EditorSplitter(QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
m_curGroup(0),
|
m_curGroup(0)
|
||||||
m_core(core)
|
|
||||||
{
|
{
|
||||||
registerActions();
|
registerActions();
|
||||||
createRootGroup();
|
createRootGroup();
|
||||||
@@ -69,9 +68,9 @@ void EditorSplitter::registerActions()
|
|||||||
{
|
{
|
||||||
QList<int> gc = QList<int>() << Constants::C_GLOBAL_ID;
|
QList<int> gc = QList<int>() << Constants::C_GLOBAL_ID;
|
||||||
const QList<int> editorManagerContext =
|
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);
|
ActionContainer *mwindow = am->actionContainer(Constants::M_WINDOW);
|
||||||
Command *cmd;
|
Command *cmd;
|
||||||
|
|
||||||
@@ -538,13 +537,13 @@ QWidget *EditorSplitter::recreateGroupTree(QWidget *node)
|
|||||||
|
|
||||||
void EditorSplitter::saveCurrentLayout()
|
void EditorSplitter::saveCurrentLayout()
|
||||||
{
|
{
|
||||||
QSettings *settings = m_core->settings();
|
QSettings *settings = ICore::instance()->settings();
|
||||||
settings->setValue("EditorManager/Splitting", saveState());
|
settings->setValue("EditorManager/Splitting", saveState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorSplitter::restoreDefaultLayout()
|
void EditorSplitter::restoreDefaultLayout()
|
||||||
{
|
{
|
||||||
QSettings *settings = m_core->settings();
|
QSettings *settings = ICore::instance()->settings();
|
||||||
if (settings->contains("EditorManager/Splitting"))
|
if (settings->contains("EditorManager/Splitting"))
|
||||||
restoreState(settings->value("EditorManager/Splitting").toByteArray());
|
restoreState(settings->value("EditorManager/Splitting").toByteArray());
|
||||||
}
|
}
|
||||||
@@ -656,12 +655,12 @@ EditorGroup *EditorSplitter::createGroup()
|
|||||||
this, SLOT(updateActions()));
|
this, SLOT(updateActions()));
|
||||||
connect(group, SIGNAL(editorAdded(Core::IEditor *)),
|
connect(group, SIGNAL(editorAdded(Core::IEditor *)),
|
||||||
this, SLOT(updateActions()));
|
this, SLOT(updateActions()));
|
||||||
m_core->addContextObject(group->contextObject());
|
ICore::instance()->addContextObject(group->contextObject());
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorSplitter::deleteGroup(EditorGroup *group)
|
void EditorSplitter::deleteGroup(EditorGroup *group)
|
||||||
{
|
{
|
||||||
m_core->removeContextObject(group->contextObject());
|
ICore::instance()->removeContextObject(group->contextObject());
|
||||||
delete group;
|
delete group;
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,6 @@
|
|||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
class EditorGroup;
|
class EditorGroup;
|
||||||
class ICore;
|
|
||||||
class IEditor;
|
class IEditor;
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -55,7 +54,7 @@ class EditorSplitter : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EditorSplitter(ICore *core, QWidget *parent = 0);
|
explicit EditorSplitter(QWidget *parent = 0);
|
||||||
~EditorSplitter();
|
~EditorSplitter();
|
||||||
|
|
||||||
void setCurrentGroup(Core::EditorGroup *group);
|
void setCurrentGroup(Core::EditorGroup *group);
|
||||||
@@ -114,7 +113,6 @@ private:
|
|||||||
|
|
||||||
QWidget *m_root;
|
QWidget *m_root;
|
||||||
EditorGroup *m_curGroup;
|
EditorGroup *m_curGroup;
|
||||||
ICore *m_core;
|
|
||||||
|
|
||||||
QAction *m_horizontalSplitAction;
|
QAction *m_horizontalSplitAction;
|
||||||
QAction *m_verticalSplitAction;
|
QAction *m_verticalSplitAction;
|
||||||
|
@@ -120,7 +120,7 @@ MainWindow::MainWindow() :
|
|||||||
m_editorManager(0),
|
m_editorManager(0),
|
||||||
m_fileManager(new FileManager(this)),
|
m_fileManager(new FileManager(this)),
|
||||||
m_progressManager(new ProgressManagerPrivate()),
|
m_progressManager(new ProgressManagerPrivate()),
|
||||||
m_scriptManager(new ScriptManagerPrivate(this, m_coreImpl)),
|
m_scriptManager(new ScriptManagerPrivate(this)),
|
||||||
m_variableManager(new VariableManager(this)),
|
m_variableManager(new VariableManager(this)),
|
||||||
m_vcsManager(new VCSManager()),
|
m_vcsManager(new VCSManager()),
|
||||||
m_viewManager(0),
|
m_viewManager(0),
|
||||||
|
@@ -181,10 +181,8 @@ static QScriptValue fileBox(QScriptContext *context, QScriptEngine *engine)
|
|||||||
namespace Core {
|
namespace Core {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
ScriptManagerPrivate::ScriptManagerPrivate(QObject *parent, ICore *core) :
|
ScriptManagerPrivate::ScriptManagerPrivate(QObject *parent)
|
||||||
ScriptManager(parent),
|
: ScriptManager(parent), m_initialized(false)
|
||||||
m_core(core),
|
|
||||||
m_initialized(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,7 +248,6 @@ void ScriptManagerPrivate::ensureEngineInitialized()
|
|||||||
{
|
{
|
||||||
if (m_initialized)
|
if (m_initialized)
|
||||||
return;
|
return;
|
||||||
QTC_ASSERT(m_core, return);
|
|
||||||
// register QObjects that occur as properties
|
// register QObjects that occur as properties
|
||||||
SharedTools::registerQObject<QMainWindow>(m_engine);
|
SharedTools::registerQObject<QMainWindow>(m_engine);
|
||||||
SharedTools::registerQObject<QStatusBar>(m_engine);
|
SharedTools::registerQObject<QStatusBar>(m_engine);
|
||||||
@@ -274,7 +271,7 @@ void ScriptManagerPrivate::ensureEngineInitialized()
|
|||||||
// SharedTools::registerQObjectInterface<Core::ICore, CorePrototype>(m_engine);
|
// SharedTools::registerQObjectInterface<Core::ICore, CorePrototype>(m_engine);
|
||||||
|
|
||||||
// Make "core" available
|
// 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);
|
// CLASSIC: registerInterfaceWithDefaultPrototype<Core::MessageManager, MessageManagerPrototype>(m_engine);
|
||||||
|
|
||||||
|
@@ -37,13 +37,9 @@
|
|||||||
#include <coreplugin/scriptmanager/scriptmanager.h>
|
#include <coreplugin/scriptmanager/scriptmanager.h>
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QList>
|
|
||||||
#include <QtScript/QScriptEngine>
|
#include <QtScript/QScriptEngine>
|
||||||
|
|
||||||
namespace Core {
|
namespace Core {
|
||||||
|
|
||||||
class ICore;
|
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ScriptManagerPrivate : public Core::ScriptManager
|
class ScriptManagerPrivate : public Core::ScriptManager
|
||||||
@@ -51,12 +47,11 @@ class ScriptManagerPrivate : public Core::ScriptManager
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScriptManagerPrivate(QObject *parent, ICore *core);
|
explicit ScriptManagerPrivate(QObject *parent);
|
||||||
|
|
||||||
virtual QScriptEngine &scriptEngine();
|
QScriptEngine &scriptEngine();
|
||||||
|
bool runScript(const QString &script, QString *errorMessage, Stack *stack);
|
||||||
virtual bool runScript(const QString &script, QString *errorMessage, Stack *stack);
|
bool runScript(const QString &script, QString *errorMessage);
|
||||||
virtual bool runScript(const QString &script, QString *errorMessage);
|
|
||||||
|
|
||||||
static QString engineError(QScriptEngine &scriptEngine);
|
static QString engineError(QScriptEngine &scriptEngine);
|
||||||
|
|
||||||
@@ -64,7 +59,6 @@ private:
|
|||||||
void ensureEngineInitialized();
|
void ensureEngineInitialized();
|
||||||
|
|
||||||
QScriptEngine m_engine;
|
QScriptEngine m_engine;
|
||||||
ICore *m_core;
|
|
||||||
bool m_initialized;
|
bool m_initialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -74,9 +74,10 @@ using namespace CPlusPlus;
|
|||||||
namespace CppTools {
|
namespace CppTools {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class FunctionArgumentWidget : public QLabel {
|
class FunctionArgumentWidget : public QLabel
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FunctionArgumentWidget(Core::ICore *core);
|
FunctionArgumentWidget();
|
||||||
void showFunctionHint(Function *functionSymbol, const Snapshot &snapshot);
|
void showFunctionHint(Function *functionSymbol, const Snapshot &snapshot);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -183,10 +184,10 @@ protected:
|
|||||||
|
|
||||||
using namespace CppTools::Internal;
|
using namespace CppTools::Internal;
|
||||||
|
|
||||||
FunctionArgumentWidget::FunctionArgumentWidget(Core::ICore *core)
|
FunctionArgumentWidget::FunctionArgumentWidget()
|
||||||
: m_item(0)
|
: m_item(0)
|
||||||
{
|
{
|
||||||
QObject *editorObject = core->editorManager()->currentEditor();
|
QObject *editorObject = Core::ICore::instance()->editorManager()->currentEditor();
|
||||||
m_editor = qobject_cast<TextEditor::ITextEditor *>(editorObject);
|
m_editor = qobject_cast<TextEditor::ITextEditor *>(editorObject);
|
||||||
|
|
||||||
m_popupFrame = new QFrame(0, Qt::ToolTip|Qt::WindowStaysOnTopHint);
|
m_popupFrame = new QFrame(0, Qt::ToolTip|Qt::WindowStaysOnTopHint);
|
||||||
@@ -311,9 +312,8 @@ void FunctionArgumentWidget::updateHintText()
|
|||||||
setText(text);
|
setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
CppCodeCompletion::CppCodeCompletion(CppModelManager *manager, Core::ICore *core)
|
CppCodeCompletion::CppCodeCompletion(CppModelManager *manager)
|
||||||
: ICompletionCollector(manager),
|
: ICompletionCollector(manager),
|
||||||
m_core(core),
|
|
||||||
m_manager(manager),
|
m_manager(manager),
|
||||||
m_caseSensitivity(Qt::CaseSensitive),
|
m_caseSensitivity(Qt::CaseSensitive),
|
||||||
m_autoInsertBraces(true),
|
m_autoInsertBraces(true),
|
||||||
@@ -1030,7 +1030,7 @@ void CppCodeCompletion::complete(const TextEditor::CompletionItem &item)
|
|||||||
Function *function = symbol->type()->asFunction();
|
Function *function = symbol->type()->asFunction();
|
||||||
QTC_ASSERT(function, return);
|
QTC_ASSERT(function, return);
|
||||||
|
|
||||||
m_functionArgumentWidget = new FunctionArgumentWidget(m_core);
|
m_functionArgumentWidget = new FunctionArgumentWidget();
|
||||||
m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.snapshot());
|
m_functionArgumentWidget->showFunctionHint(function, typeOfExpression.snapshot());
|
||||||
}
|
}
|
||||||
} else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) {
|
} else if (m_completionOperator == T_SIGNAL || m_completionOperator == T_SLOT) {
|
||||||
|
@@ -34,23 +34,17 @@
|
|||||||
#ifndef CPPCODECOMPLETION_H
|
#ifndef CPPCODECOMPLETION_H
|
||||||
#define CPPCODECOMPLETION_H
|
#define CPPCODECOMPLETION_H
|
||||||
|
|
||||||
// C++ front-end
|
|
||||||
#include <ASTfwd.h>
|
#include <ASTfwd.h>
|
||||||
#include <FullySpecifiedType.h>
|
#include <FullySpecifiedType.h>
|
||||||
#include <cplusplus/Icons.h>
|
#include <cplusplus/Icons.h>
|
||||||
#include <cplusplus/Overview.h>
|
#include <cplusplus/Overview.h>
|
||||||
#include <cplusplus/TypeOfExpression.h>
|
#include <cplusplus/TypeOfExpression.h>
|
||||||
|
|
||||||
// Qt Creator
|
|
||||||
#include <texteditor/icompletioncollector.h>
|
#include <texteditor/icompletioncollector.h>
|
||||||
|
|
||||||
// Qt
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
class ICore;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
class ITextEditor;
|
class ITextEditor;
|
||||||
@@ -66,7 +60,7 @@ class CppCodeCompletion : public TextEditor::ICompletionCollector
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CppCodeCompletion(CppModelManager *manager, Core::ICore *core);
|
explicit CppCodeCompletion(CppModelManager *manager);
|
||||||
|
|
||||||
bool triggersCompletion(TextEditor::ITextEditable *editor);
|
bool triggersCompletion(TextEditor::ITextEditable *editor);
|
||||||
int startCompletion(TextEditor::ITextEditable *editor);
|
int startCompletion(TextEditor::ITextEditable *editor);
|
||||||
@@ -131,7 +125,6 @@ private:
|
|||||||
TextEditor::ITextEditable *m_editor;
|
TextEditor::ITextEditable *m_editor;
|
||||||
int m_startPosition; // Position of the cursor from which completion started
|
int m_startPosition; // Position of the cursor from which completion started
|
||||||
|
|
||||||
Core::ICore *m_core;
|
|
||||||
CppModelManager *m_manager;
|
CppModelManager *m_manager;
|
||||||
Qt::CaseSensitivity m_caseSensitivity;
|
Qt::CaseSensitivity m_caseSensitivity;
|
||||||
bool m_autoInsertBraces;
|
bool m_autoInsertBraces;
|
||||||
|
@@ -87,7 +87,7 @@ bool CppToolsPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
// Objects
|
// Objects
|
||||||
m_modelManager = new CppModelManager(this);
|
m_modelManager = new CppModelManager(this);
|
||||||
addAutoReleasedObject(m_modelManager);
|
addAutoReleasedObject(m_modelManager);
|
||||||
m_completion = new CppCodeCompletion(m_modelManager, core);
|
m_completion = new CppCodeCompletion(m_modelManager);
|
||||||
addAutoReleasedObject(m_completion);
|
addAutoReleasedObject(m_completion);
|
||||||
CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager,
|
CppQuickOpenFilter *quickOpenFilter = new CppQuickOpenFilter(m_modelManager,
|
||||||
core->editorManager());
|
core->editorManager());
|
||||||
|
@@ -61,6 +61,7 @@
|
|||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
|
||||||
|
#include <projectexplorer/projectexplorer.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
#include <projectexplorer/session.h>
|
#include <projectexplorer/session.h>
|
||||||
|
|
||||||
@@ -85,8 +86,6 @@
|
|||||||
#include <QtGui/QTextCursor>
|
#include <QtGui/QTextCursor>
|
||||||
|
|
||||||
|
|
||||||
namespace ExtensionSystem { class PluginManager; }
|
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
using namespace Debugger::Constants;
|
using namespace Debugger::Constants;
|
||||||
using namespace Debugger::Internal;
|
using namespace Debugger::Internal;
|
||||||
@@ -144,6 +143,11 @@ const char * const ADD_TO_WATCH_KEY = "Ctrl+Alt+Q";
|
|||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
|
|
||||||
|
static ProjectExplorer::SessionManager *sessionManager()
|
||||||
|
{
|
||||||
|
return ProjectExplorer::ProjectExplorerPlugin::instance()->session();
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// DebugMode
|
// DebugMode
|
||||||
@@ -339,7 +343,6 @@ void GdbOptionPage::apply()
|
|||||||
|
|
||||||
DebuggerPlugin::DebuggerPlugin()
|
DebuggerPlugin::DebuggerPlugin()
|
||||||
{
|
{
|
||||||
m_pm = 0;
|
|
||||||
m_generalOptionPage = 0;
|
m_generalOptionPage = 0;
|
||||||
m_locationMark = 0;
|
m_locationMark = 0;
|
||||||
m_manager = 0;
|
m_manager = 0;
|
||||||
@@ -390,8 +393,6 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
|||||||
|
|
||||||
m_manager = new DebuggerManager;
|
m_manager = new DebuggerManager;
|
||||||
|
|
||||||
m_pm = ExtensionSystem::PluginManager::instance();
|
|
||||||
|
|
||||||
ICore *core = ICore::instance();
|
ICore *core = ICore::instance();
|
||||||
QTC_ASSERT(core, return false);
|
QTC_ASSERT(core, return false);
|
||||||
|
|
||||||
@@ -663,9 +664,9 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *error_mes
|
|||||||
//
|
//
|
||||||
|
|
||||||
// ProjectExplorer
|
// ProjectExplorer
|
||||||
connect(projectExplorer()->session(), SIGNAL(sessionLoaded()),
|
connect(sessionManager(), SIGNAL(sessionLoaded()),
|
||||||
m_manager, SLOT(sessionLoaded()));
|
m_manager, SLOT(sessionLoaded()));
|
||||||
connect(projectExplorer()->session(), SIGNAL(aboutToSaveSession()),
|
connect(sessionManager(), SIGNAL(aboutToSaveSession()),
|
||||||
m_manager, SLOT(aboutToSaveSession()));
|
m_manager, SLOT(aboutToSaveSession()));
|
||||||
|
|
||||||
// EditorManager
|
// 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. */
|
/*! Activates the previous mode when the current mode is the debug mode. */
|
||||||
void DebuggerPlugin::activatePreviousMode()
|
void DebuggerPlugin::activatePreviousMode()
|
||||||
{
|
{
|
||||||
@@ -822,17 +818,14 @@ void DebuggerPlugin::showToolTip(TextEditor::ITextEditor *editor,
|
|||||||
void DebuggerPlugin::setSessionValue(const QString &name, const QVariant &value)
|
void DebuggerPlugin::setSessionValue(const QString &name, const QVariant &value)
|
||||||
{
|
{
|
||||||
//qDebug() << "SET SESSION VALUE" << name << value;
|
//qDebug() << "SET SESSION VALUE" << name << value;
|
||||||
ProjectExplorerPlugin *pe = projectExplorer();
|
QTC_ASSERT(sessionManager(), return);
|
||||||
if (pe->session())
|
sessionManager()->setValue(name, value);
|
||||||
pe->session()->setValue(name, value);
|
|
||||||
else
|
|
||||||
qDebug() << "FIXME: Session does not exist yet";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerPlugin::querySessionValue(const QString &name, QVariant *value)
|
void DebuggerPlugin::querySessionValue(const QString &name, QVariant *value)
|
||||||
{
|
{
|
||||||
ProjectExplorerPlugin *pe = projectExplorer();
|
QTC_ASSERT(sessionManager(), return);
|
||||||
*value = pe->session()->value(name);
|
*value = sessionManager()->value(name);
|
||||||
//qDebug() << "GET SESSION VALUE: " << name << value;
|
//qDebug() << "GET SESSION VALUE: " << name << value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,19 +34,26 @@
|
|||||||
#ifndef DEBUGGERPLUGIN_H
|
#ifndef DEBUGGERPLUGIN_H
|
||||||
#define DEBUGGERPLUGIN_H
|
#define DEBUGGERPLUGIN_H
|
||||||
|
|
||||||
#include <projectexplorer/projectexplorer.h>
|
|
||||||
#include <extensionsystem/iplugin.h>
|
#include <extensionsystem/iplugin.h>
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
class QAbstractItemView;
|
||||||
class QAction;
|
class QAction;
|
||||||
class QCursor;
|
class QCursor;
|
||||||
class QAbstractItemView;
|
class QMenu;
|
||||||
|
class QPoint;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core { class IEditor; }
|
namespace Core {
|
||||||
namespace TextEditor { class ITextEditor; }
|
class IEditor;
|
||||||
|
class IMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace TextEditor {
|
||||||
|
class ITextEditor;
|
||||||
|
}
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -99,12 +106,9 @@ private:
|
|||||||
friend class GdbOptionPage;
|
friend class GdbOptionPage;
|
||||||
friend class DebugMode; // FIXME: Just a hack now so that it can access the views
|
friend class DebugMode; // FIXME: Just a hack now so that it can access the views
|
||||||
|
|
||||||
ProjectExplorer::ProjectExplorerPlugin *projectExplorer() const;
|
|
||||||
|
|
||||||
DebuggerManager *m_manager;
|
DebuggerManager *m_manager;
|
||||||
DebugMode *m_debugMode;
|
DebugMode *m_debugMode;
|
||||||
|
|
||||||
ExtensionSystem::PluginManager *m_pm;
|
|
||||||
GdbOptionPage *m_generalOptionPage;
|
GdbOptionPage *m_generalOptionPage;
|
||||||
|
|
||||||
QString m_previousMode;
|
QString m_previousMode;
|
||||||
|
@@ -2761,14 +2761,17 @@ static void setWatchDataValue(WatchData &data, const GdbMi &mi,
|
|||||||
break;
|
break;
|
||||||
case 1: // base64 encoded 8 bit data
|
case 1: // base64 encoded 8 bit data
|
||||||
ba = QByteArray::fromBase64(mi.data());
|
ba = QByteArray::fromBase64(mi.data());
|
||||||
|
ba = '"' + ba + '"';
|
||||||
break;
|
break;
|
||||||
case 2: // base64 encoded 16 bit data
|
case 2: // base64 encoded 16 bit data
|
||||||
ba = QByteArray::fromBase64(mi.data());
|
ba = QByteArray::fromBase64(mi.data());
|
||||||
ba = QString::fromUtf16((ushort *)ba.data(), ba.size() / 2).toUtf8();
|
ba = QString::fromUtf16((ushort *)ba.data(), ba.size() / 2).toUtf8();
|
||||||
|
ba = '"' + ba + '"';
|
||||||
break;
|
break;
|
||||||
case 3: // base64 encoded 32 bit data
|
case 3: // base64 encoded 32 bit data
|
||||||
ba = QByteArray::fromBase64(mi.data());
|
ba = QByteArray::fromBase64(mi.data());
|
||||||
ba = QString::fromUcs4((uint *)ba.data(), ba.size() / 4).toUtf8();
|
ba = QString::fromUcs4((uint *)ba.data(), ba.size() / 4).toUtf8();
|
||||||
|
ba = '"' + ba + '"';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
data.setValue(ba);
|
data.setValue(ba);
|
||||||
@@ -3550,13 +3553,12 @@ void GdbEngine::handleDumpCustomValue2(const GdbResultRecord &record,
|
|||||||
data1.iname = data.iname + "." + data1.name;
|
data1.iname = data.iname + "." + data1.name;
|
||||||
if (!data1.name.isEmpty() && data1.name.at(0).isDigit())
|
if (!data1.name.isEmpty() && data1.name.at(0).isDigit())
|
||||||
data1.name = '[' + data1.name + ']';
|
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();
|
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 + ")";
|
data1.name += " (" + key + ")";
|
||||||
|
}
|
||||||
setWatchDataType(data1, item.findChild("type"));
|
setWatchDataType(data1, item.findChild("type"));
|
||||||
setWatchDataExpression(data1, item.findChild("exp"));
|
setWatchDataExpression(data1, item.findChild("exp"));
|
||||||
setWatchDataChildCount(data1, item.findChild("numchild"));
|
setWatchDataChildCount(data1, item.findChild("numchild"));
|
||||||
|
@@ -61,6 +61,8 @@
|
|||||||
|
|
||||||
#include <QtHelp/QHelpEngine>
|
#include <QtHelp/QHelpEngine>
|
||||||
|
|
||||||
|
#include <coreplugin/coreconstants.h>
|
||||||
|
|
||||||
using namespace Help::Internal;
|
using namespace Help::Internal;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -228,20 +230,23 @@ void CentralWidget::setSource(const QUrl &url)
|
|||||||
|
|
||||||
void CentralWidget::setLastShownPages()
|
void CentralWidget::setLastShownPages()
|
||||||
{
|
{
|
||||||
const QStringList lastShownPageList = helpEngine->customValue(QLatin1String("LastShownPages")).
|
const QStringList lastShownPageList =
|
||||||
toString().split(QLatin1Char('|'), QString::SkipEmptyParts);
|
helpEngine->customValue(QLatin1String("LastShownPages")). toString().
|
||||||
|
split(QLatin1Char('|'), QString::SkipEmptyParts);
|
||||||
|
|
||||||
if (!lastShownPageList.isEmpty()) {
|
if (!lastShownPageList.isEmpty()) {
|
||||||
foreach (const QString page, lastShownPageList)
|
foreach (const QString& page, lastShownPageList)
|
||||||
setSourceInNewTab(page);
|
setSourceInNewTab(page);
|
||||||
|
|
||||||
tabWidget->setCurrentIndex(helpEngine->customValue(QLatin1String("LastTabPage"), 0).toInt());
|
tabWidget->setCurrentIndex(helpEngine->
|
||||||
|
customValue(QLatin1String("LastTabPage"), 0).toInt());
|
||||||
} else {
|
} else {
|
||||||
QUrl url = helpEngine->findFile(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())
|
if (!url.isValid()) {
|
||||||
setSource(url);
|
url.setUrl(QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html").
|
||||||
else
|
arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
|
||||||
setSource(QUrl("qthelp://com.trolltech.qt.440/qdoc/index.html"));
|
}
|
||||||
|
setSource(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateBrowserFont();
|
updateBrowserFont();
|
||||||
@@ -392,19 +397,33 @@ void CentralWidget::setGlobalActions(const QList<QAction*> &actions)
|
|||||||
{
|
{
|
||||||
globalActionList = actions;
|
globalActionList = actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::setSourceInNewTab(const QUrl &url)
|
void CentralWidget::setSourceInNewTab(const QUrl &url)
|
||||||
{
|
{
|
||||||
HelpViewer* viewer = new HelpViewer(helpEngine, this);
|
HelpViewer* viewer = new HelpViewer(helpEngine, this);
|
||||||
viewer->installEventFilter(this);
|
viewer->installEventFilter(this);
|
||||||
viewer->setSource(url);
|
viewer->setSource(url);
|
||||||
viewer->setFocus(Qt::OtherFocusReason);
|
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();
|
QFont font = qApp->font();
|
||||||
if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool())
|
if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool())
|
||||||
font = qVariantValue<QFont>(helpEngine->customValue(QLatin1String("browserFont")));
|
font = qVariantValue<QFont>(helpEngine->customValue(QLatin1String("browserFont")));
|
||||||
|
|
||||||
viewer->setFont(font);
|
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->setFontFamily(QWebSettings::StandardFont, fontFamily);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
connectSignals();
|
connectSignals();
|
||||||
}
|
}
|
||||||
@@ -492,7 +511,7 @@ void CentralWidget::currentPageChanged(int index)
|
|||||||
bool enabled = false;
|
bool enabled = false;
|
||||||
if (viewer)
|
if (viewer)
|
||||||
enabled = tabWidget->count() > 1;
|
enabled = tabWidget->count() > 1;
|
||||||
|
|
||||||
tabWidget->setTabsClosable(enabled);
|
tabWidget->setTabsClosable(enabled);
|
||||||
tabWidget->cornerWidget(Qt::TopLeftCorner)->setEnabled(true);
|
tabWidget->cornerWidget(Qt::TopLeftCorner)->setEnabled(true);
|
||||||
|
|
||||||
@@ -595,6 +614,7 @@ bool CentralWidget::eventFilter(QObject *object, QEvent *e)
|
|||||||
|
|
||||||
void CentralWidget::updateBrowserFont()
|
void CentralWidget::updateBrowserFont()
|
||||||
{
|
{
|
||||||
|
#if defined(QT_NO_WEBKIT)
|
||||||
QFont font = qApp->font();
|
QFont font = qApp->font();
|
||||||
if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool())
|
if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool())
|
||||||
font = qVariantValue<QFont>(helpEngine->customValue(QLatin1String("browserFont")));
|
font = qVariantValue<QFont>(helpEngine->customValue(QLatin1String("browserFont")));
|
||||||
@@ -605,9 +625,25 @@ void CentralWidget::updateBrowserFont()
|
|||||||
if (widget->font() != font)
|
if (widget->font() != font)
|
||||||
widget->setFont(font);
|
widget->setFont(font);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
QWebSettings* settings = QWebSettings::globalSettings();
|
||||||
|
int fontSize = settings->fontSize(QWebSettings::DefaultFontSize);
|
||||||
|
QString fontFamily = settings->fontFamily(QWebSettings::StandardFont);
|
||||||
|
|
||||||
|
QWebView* widget = 0;
|
||||||
|
for (int i = 0; i < tabWidget->count(); ++i) {
|
||||||
|
widget = qobject_cast<QWebView*> (tabWidget->widget(i));
|
||||||
|
if (widget) {
|
||||||
|
settings = widget->settings();
|
||||||
|
settings->setFontSize(QWebSettings::DefaultFontSize, fontSize);
|
||||||
|
settings->setFontFamily(QWebSettings::StandardFont, fontFamily);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CentralWidget::find(const QString &txt, QTextDocument::FindFlags findFlags, bool incremental)
|
bool CentralWidget::find(const QString &txt, QTextDocument::FindFlags findFlags,
|
||||||
|
bool incremental)
|
||||||
{
|
{
|
||||||
HelpViewer* viewer = currentHelpViewer();
|
HelpViewer* viewer = currentHelpViewer();
|
||||||
|
|
||||||
@@ -666,7 +702,7 @@ bool CentralWidget::find(const QString &txt, QTextDocument::FindFlags findFlags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::showTopicChooser(const QMap<QString, QUrl> &links,
|
void CentralWidget::showTopicChooser(const QMap<QString, QUrl> &links,
|
||||||
const QString &keyword)
|
const QString &keyword)
|
||||||
{
|
{
|
||||||
TopicChooser tc(this, keyword, links);
|
TopicChooser tc(this, keyword, links);
|
||||||
if (tc.exec() == QDialog::Accepted)
|
if (tc.exec() == QDialog::Accepted)
|
||||||
|
@@ -136,5 +136,11 @@ bool DocSettingsPage::applyChanges()
|
|||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
return m_registeredDocs || m_removeDocs.count();
|
|
||||||
|
bool success = m_registeredDocs || m_removeDocs.count();
|
||||||
|
|
||||||
|
m_removeDocs.clear();
|
||||||
|
m_registeredDocs = false;
|
||||||
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
@@ -395,6 +395,11 @@ void HelpPlugin::rightPaneForward()
|
|||||||
m_helpViewerForSideBar->forward();
|
m_helpViewerForSideBar->forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HelpPlugin::activateHelpMode()
|
||||||
|
{
|
||||||
|
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||||
|
}
|
||||||
|
|
||||||
void HelpPlugin::switchToHelpMode()
|
void HelpPlugin::switchToHelpMode()
|
||||||
{
|
{
|
||||||
switchToHelpMode(m_helpViewerForSideBar->source());
|
switchToHelpMode(m_helpViewerForSideBar->source());
|
||||||
@@ -403,14 +408,14 @@ void HelpPlugin::switchToHelpMode()
|
|||||||
|
|
||||||
void HelpPlugin::switchToHelpMode(const QUrl &source)
|
void HelpPlugin::switchToHelpMode(const QUrl &source)
|
||||||
{
|
{
|
||||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
activateHelpMode();
|
||||||
m_centralWidget->setSource(source);
|
m_centralWidget->setSource(source);
|
||||||
m_centralWidget->setFocus();
|
m_centralWidget->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelpPlugin::switchToHelpMode(const QMap<QString, QUrl> &urls, const QString &keyword)
|
void HelpPlugin::switchToHelpMode(const QMap<QString, QUrl> &urls, const QString &keyword)
|
||||||
{
|
{
|
||||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
activateHelpMode();
|
||||||
m_centralWidget->showTopicChooser(urls, keyword);
|
m_centralWidget->showTopicChooser(urls, keyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,7 +566,7 @@ void HelpPlugin::activateContext()
|
|||||||
viewer = m_helpViewerForSideBar;
|
viewer = m_helpViewerForSideBar;
|
||||||
} else {
|
} else {
|
||||||
viewer = m_centralWidget->currentHelpViewer();
|
viewer = m_centralWidget->currentHelpViewer();
|
||||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
activateHelpMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewer) {
|
if (viewer) {
|
||||||
@@ -579,7 +584,7 @@ void HelpPlugin::activateContext()
|
|||||||
viewer = m_helpViewerForSideBar;
|
viewer = m_helpViewerForSideBar;
|
||||||
} else {
|
} else {
|
||||||
viewer = m_centralWidget->currentHelpViewer();
|
viewer = m_centralWidget->currentHelpViewer();
|
||||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
activateHelpMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (viewer) {
|
if (viewer) {
|
||||||
@@ -593,19 +598,19 @@ void HelpPlugin::activateContext()
|
|||||||
|
|
||||||
void HelpPlugin::activateIndex()
|
void HelpPlugin::activateIndex()
|
||||||
{
|
{
|
||||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
activateHelpMode();
|
||||||
m_sideBar->activateItem(m_indexItem);
|
m_sideBar->activateItem(m_indexItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelpPlugin::activateContents()
|
void HelpPlugin::activateContents()
|
||||||
{
|
{
|
||||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
activateHelpMode();
|
||||||
m_sideBar->activateItem(m_contentItem);
|
m_sideBar->activateItem(m_contentItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HelpPlugin::activateSearch()
|
void HelpPlugin::activateSearch()
|
||||||
{
|
{
|
||||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
activateHelpMode();
|
||||||
m_sideBar->activateItem(m_searchItem);
|
m_sideBar->activateItem(m_searchItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -680,7 +685,7 @@ void HelpPlugin::addNewBookmark(const QString &title, const QString &url)
|
|||||||
|
|
||||||
void HelpPlugin::openGettingStarted()
|
void HelpPlugin::openGettingStarted()
|
||||||
{
|
{
|
||||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
activateHelpMode();
|
||||||
m_centralWidget->setSource(
|
m_centralWidget->setSource(
|
||||||
QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html")
|
QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html")
|
||||||
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
|
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
|
||||||
|
@@ -134,6 +134,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
QToolBar *createToolBar();
|
QToolBar *createToolBar();
|
||||||
void createRightPaneSideBar();
|
void createRightPaneSideBar();
|
||||||
|
void activateHelpMode();
|
||||||
|
|
||||||
Core::ICore *m_core;
|
Core::ICore *m_core;
|
||||||
QHelpEngine *m_helpEngine;
|
QHelpEngine *m_helpEngine;
|
||||||
|
@@ -33,8 +33,8 @@
|
|||||||
|
|
||||||
#include "qtestlibplugin.h"
|
#include "qtestlibplugin.h"
|
||||||
|
|
||||||
//#include <Qt4IProjectManagers>
|
#include <coreplugin/icore.h>
|
||||||
//#include <texteditor/TextEditorInterfaces>
|
#include <texteditor/itexteditor.h>
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
@@ -116,28 +116,27 @@ static QTestFunction::MessageType stringToMessageType(const QString &str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
QTestLibPlugin::QTestLibPlugin() :
|
QTestLibPlugin::QTestLibPlugin()
|
||||||
m_projectExplorer(0),
|
: m_projectExplorer(0), m_outputPane(0)
|
||||||
m_core(0),
|
|
||||||
m_outputPane(0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QTestLibPlugin::~QTestLibPlugin()
|
QTestLibPlugin::~QTestLibPlugin()
|
||||||
{
|
{
|
||||||
if (m_core && m_outputPane)
|
if (m_outputPane)
|
||||||
m_core->pluginManager()->removeObject(m_outputPane);
|
ExtensionSystem::PluginManager::instance()->removeObject(m_outputPane);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QTestLibPlugin::init(ExtensionSystem::PluginManagerInterface *app, QString *errorMessage)
|
bool QTestLibPlugin::init(const QStringList &arguments, QString *errorMessage)
|
||||||
{
|
{
|
||||||
|
Q_UNUSED(arguments);
|
||||||
Q_UNUSED(errorMessage);
|
Q_UNUSED(errorMessage);
|
||||||
m_projectExplorer = app->getObject<ProjectExplorer::ProjectExplorerPlugin>();
|
m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
|
||||||
connect(m_projectExplorer->qObject(), SIGNAL(aboutToExecuteProject(ProjectExplorer::Project *)),
|
connect(m_projectExplorer, SIGNAL(aboutToExecuteProject(ProjectExplorer::Project *)),
|
||||||
this, SLOT(projectRunHook(ProjectExplorer::Project *)));
|
this, SLOT(projectRunHook(ProjectExplorer::Project *)));
|
||||||
|
|
||||||
m_outputPane = new QTestOutputPane(this);
|
m_outputPane = new QTestOutputPane(this);
|
||||||
app->addObject(m_outputPane);
|
ExtensionSystem::PluginManager::instance()->addObject(m_outputPane);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -169,10 +168,10 @@ void QTestLibPlugin::projectRunHook(ProjectExplorer::Project *proj)
|
|||||||
|
|
||||||
//NBS proj->setCustomApplicationOutputHandler(this);
|
//NBS proj->setCustomApplicationOutputHandler(this);
|
||||||
//NBS proj->setExtraApplicationRunArguments(QStringList() << QLatin1String("-xml") << QLatin1String("-o") << m_outputFile);
|
//NBS proj->setExtraApplicationRunArguments(QStringList() << QLatin1String("-xml") << QLatin1String("-o") << m_outputFile);
|
||||||
const QString proFile = proj->fileName();
|
// const QString proFile = proj->fileName();
|
||||||
const QFileInfo fi(proFile);
|
// const QFileInfo fi(proFile);
|
||||||
if (QFile::exists(fi.absolutePath()))
|
// if (QFile::exists(fi.absolutePath()))
|
||||||
m_projectDirectory = fi.absolutePath();
|
// m_projectDirectory = fi.absolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QTestLibPlugin::clear()
|
void QTestLibPlugin::clear()
|
||||||
@@ -319,9 +318,11 @@ bool QTestFunction::indexHasIncidents(const QModelIndex &function, IncidentType
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------- QTestOutputPane
|
// -------------- QTestOutputPane
|
||||||
QTestOutputPane::QTestOutputPane(QTestLibPlugin *plugin) :
|
|
||||||
QObject(plugin),
|
QTestOutputPane::QTestOutputPane(QTestLibPlugin *plugin)
|
||||||
|
: QObject(plugin),
|
||||||
m_plugin(plugin),
|
m_plugin(plugin),
|
||||||
m_widget(0),
|
m_widget(0),
|
||||||
m_model(new QStandardItemModel(this))
|
m_model(new QStandardItemModel(this))
|
||||||
@@ -485,8 +486,8 @@ void QTestOutputWidget::gotoLocation(QModelIndex index)
|
|||||||
|
|
||||||
QTestLocation loc = tag.value<QTestLocation>();
|
QTestLocation loc = tag.value<QTestLocation>();
|
||||||
|
|
||||||
m_coreInterface->editorManager()->openEditor(loc.file);
|
Core::ICore::instance()->editorManager()->openEditor(loc.file);
|
||||||
Core::EditorInterface *edtIface = m_coreInterface->editorManager()->currentEditor();
|
Core::EditorInterface *edtIface = Core::ICore::instance()->editorManager()->currentEditor();
|
||||||
if (!edtIface)
|
if (!edtIface)
|
||||||
return;
|
return;
|
||||||
TextEditor::ITextEditor *editor =
|
TextEditor::ITextEditor *editor =
|
||||||
|
@@ -35,18 +35,19 @@
|
|||||||
#define QTESTLIBPLUGIN_H
|
#define QTESTLIBPLUGIN_H
|
||||||
|
|
||||||
#include <coreplugin/ioutputpane.h>
|
#include <coreplugin/ioutputpane.h>
|
||||||
//#include <projectexplorer/ProjectExplorerInterfaces>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
|
#include <projectexplorer/projectexplorer.h>
|
||||||
|
|
||||||
#include <QtGui/QPixmap>
|
#include <QtGui/QPixmap>
|
||||||
|
#include <QtGui/QSortFilterProxyModel>
|
||||||
#include <QtGui/QStandardItem>
|
#include <QtGui/QStandardItem>
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
#include <QtGui/QSortFilterProxyModel>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QStandardItemModel;
|
|
||||||
class QTreeView;
|
|
||||||
class QTextEdit;
|
|
||||||
class QComboBox;
|
class QComboBox;
|
||||||
|
class QStandardItemModel;
|
||||||
|
class QTextEdit;
|
||||||
|
class QTreeView;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace QTestLib {
|
namespace QTestLib {
|
||||||
@@ -101,7 +102,7 @@ public:
|
|||||||
class QTestOutputPane : public Core::IOutputPane
|
class QTestOutputPane : public Core::IOutputPane
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
//Q_INTERFACES(Core::IOutputPane)
|
|
||||||
public:
|
public:
|
||||||
QTestOutputPane(QTestLibPlugin *plugin);
|
QTestOutputPane(QTestLibPlugin *plugin);
|
||||||
|
|
||||||
@@ -116,8 +117,13 @@ public:
|
|||||||
|
|
||||||
void show();
|
void show();
|
||||||
|
|
||||||
Q_SIGNALS:
|
// FIXME:
|
||||||
//signals
|
virtual int priorityInStatusBar() const { return 0;}
|
||||||
|
virtual void setFocus() {}
|
||||||
|
virtual bool hasFocus() { return false;}
|
||||||
|
virtual bool canFocus() { return false;}
|
||||||
|
|
||||||
|
signals:
|
||||||
void showPage();
|
void showPage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -165,19 +171,15 @@ private:
|
|||||||
QTestOutputFilter *m_filterModel;
|
QTestOutputFilter *m_filterModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QTestLibPlugin : public QObject,
|
class QTestLibPlugin : public QObject
|
||||||
public ExtensionSystem::PluginInterface,
|
|
||||||
public ProjectExplorer::IApplicationOutput
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_INTERFACES(ExtensionSystem::PluginInterface
|
|
||||||
ProjectExplorer::IApplicationOutput)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QTestLibPlugin();
|
QTestLibPlugin();
|
||||||
virtual ~QTestLibPlugin();
|
virtual ~QTestLibPlugin();
|
||||||
|
|
||||||
bool init(ExtensionSystem::PluginManagerInterface *app, QString *error_message);
|
bool init(const QStringList &args, QString *error_message);
|
||||||
void extensionsInitialized();
|
void extensionsInitialized();
|
||||||
|
|
||||||
// IApplicationOutput
|
// IApplicationOutput
|
||||||
|
1
src/plugins/snippets/README
Normal file
1
src/plugins/snippets/README
Normal file
@@ -0,0 +1 @@
|
|||||||
|
This is dead code for now.
|
@@ -50,8 +50,7 @@ const QIcon SnippetsCompletion::m_fileIcon = QIcon(":/snippets/images/file.png")
|
|||||||
SnippetsCompletion::SnippetsCompletion(QObject *parent)
|
SnippetsCompletion::SnippetsCompletion(QObject *parent)
|
||||||
: ICompletionCollector(parent)
|
: ICompletionCollector(parent)
|
||||||
{
|
{
|
||||||
m_core = SnippetsPlugin::core();
|
m_snippetsWindow = SnippetsPlugin::snippetsWindow();
|
||||||
m_snippetsWnd = SnippetsPlugin::snippetsWindow();
|
|
||||||
|
|
||||||
updateCompletions();
|
updateCompletions();
|
||||||
}
|
}
|
||||||
@@ -66,9 +65,9 @@ void SnippetsCompletion::updateCompletions()
|
|||||||
{
|
{
|
||||||
qDeleteAll(m_autoCompletions.values());
|
qDeleteAll(m_autoCompletions.values());
|
||||||
m_autoCompletions.clear();
|
m_autoCompletions.clear();
|
||||||
|
#if 0
|
||||||
int index = 0;
|
int index = 0;
|
||||||
foreach (SnippetSpec *spec, m_snippetsWnd->snippets()) {
|
foreach (SnippetSpec *spec, m_snippetsWindow->snippets()) {
|
||||||
if (!spec->completionShortcut().isEmpty()) {
|
if (!spec->completionShortcut().isEmpty()) {
|
||||||
TextEditor::CompletionItem *item = new TextEditor::CompletionItem;
|
TextEditor::CompletionItem *item = new TextEditor::CompletionItem;
|
||||||
item->m_key = spec->name();
|
item->m_key = spec->name();
|
||||||
@@ -79,6 +78,7 @@ void SnippetsCompletion::updateCompletions()
|
|||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SnippetsCompletion::triggersCompletion(TextEditor::ITextEditable *editor)
|
bool SnippetsCompletion::triggersCompletion(TextEditor::ITextEditable *editor)
|
||||||
@@ -96,29 +96,36 @@ int SnippetsCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
|||||||
return m_startPosition;
|
return m_startPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnippetsCompletion::completions(QList<TextEditor::CompletionItem *> *completions)
|
#if 0
|
||||||
|
void SnippetsCompletion::completions(const QList<TextEditor::CompletionItem *> &completions)
|
||||||
{
|
{
|
||||||
const int length = m_editor->position() - m_startPosition;
|
const int length = m_editor->position() - m_startPosition;
|
||||||
if (length >= 2) {
|
if (length >= 2) {
|
||||||
QString key = m_editor->textAt(m_startPosition, length);
|
QString key = m_editor->textAt(m_startPosition, length);
|
||||||
foreach (TextEditor::CompletionItem* item, m_autoCompletions.values()) {
|
foreach (TextEditor::CompletionItem* item, m_autoCompletions.values()) {
|
||||||
if (item->m_key.startsWith(key, Qt::CaseInsensitive)) {
|
if (item->m_key.startsWith(key, Qt::CaseInsensitive))
|
||||||
(*completions) << item;
|
completions->append(item);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
QString SnippetsCompletion::text(TextEditor::CompletionItem *item) const
|
QString SnippetsCompletion::text(TextEditor::CompletionItem *item) const
|
||||||
{
|
{
|
||||||
const SnippetSpec *spec = m_snippetsWnd->snippets().at(item->m_index);
|
#if 0
|
||||||
|
const SnippetSpec *spec = m_snippetsWindow->snippets().at(item->m_index);
|
||||||
return spec->name();
|
return spec->name();
|
||||||
|
#endif
|
||||||
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SnippetsCompletion::details(TextEditor::CompletionItem *item) const
|
QString SnippetsCompletion::details(TextEditor::CompletionItem *item) const
|
||||||
{
|
{
|
||||||
const SnippetSpec *spec = m_snippetsWnd->snippets().at(item->m_index);
|
#if 0
|
||||||
|
const SnippetSpec *spec = m_snippetsWindow->snippets().at(item->m_index);
|
||||||
return spec->description();
|
return spec->description();
|
||||||
|
#endif
|
||||||
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon SnippetsCompletion::icon(TextEditor::CompletionItem *) const
|
QIcon SnippetsCompletion::icon(TextEditor::CompletionItem *) const
|
||||||
@@ -126,18 +133,20 @@ QIcon SnippetsCompletion::icon(TextEditor::CompletionItem *) const
|
|||||||
return m_fileIcon;
|
return m_fileIcon;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnippetsCompletion::complete(TextEditor::CompletionItem *item)
|
void SnippetsCompletion::complete(const TextEditor::CompletionItem &item)
|
||||||
{
|
{
|
||||||
SnippetSpec *spec = m_snippetsWnd->snippets().at(item->m_index);
|
#if 0
|
||||||
|
SnippetSpec *spec = m_snippetsWindow->snippets().at(item->m_index);
|
||||||
|
|
||||||
int length = m_editor->position() - m_startPosition;
|
int length = m_editor->position() - m_startPosition;
|
||||||
m_editor->setCurPos(m_startPosition);
|
m_editor->setCurPos(m_startPosition);
|
||||||
m_editor->remove(length);
|
m_editor->remove(length);
|
||||||
|
|
||||||
m_snippetsWnd->insertSnippet(m_editor, spec);
|
m_snippetsWindow->insertSnippet(m_editor, spec);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SnippetsCompletion::partiallyComplete()
|
bool SnippetsCompletion::partiallyComplete(const myns::QList<TextEditor::CompletionItem>&)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -36,15 +36,11 @@
|
|||||||
|
|
||||||
#include <texteditor/icompletioncollector.h>
|
#include <texteditor/icompletioncollector.h>
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
|
||||||
#include <QtCore/QMap>
|
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QMap>
|
||||||
|
#include <QtCore/QObject>
|
||||||
#include <QtGui/QIcon>
|
#include <QtGui/QIcon>
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
class ICore;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
class ITextEditable;
|
class ITextEditable;
|
||||||
class ITextEditor;
|
class ITextEditor;
|
||||||
@@ -72,10 +68,12 @@ public:
|
|||||||
QString details(TextEditor::CompletionItem *item) const;
|
QString details(TextEditor::CompletionItem *item) const;
|
||||||
QIcon icon(TextEditor::CompletionItem *item) const;
|
QIcon icon(TextEditor::CompletionItem *item) const;
|
||||||
|
|
||||||
void complete(TextEditor::CompletionItem *item);
|
void complete(const TextEditor::CompletionItem &item);
|
||||||
bool partiallyComplete();
|
bool partiallyComplete(const QList<TextEditor::CompletionItem> &);
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
|
||||||
|
void completions(QList<TextEditor::CompletionItem>*);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateCompletions();
|
void updateCompletions();
|
||||||
|
|
||||||
@@ -83,10 +81,9 @@ private:
|
|||||||
static int findStartOfName(const TextEditor::ITextEditor *editor);
|
static int findStartOfName(const TextEditor::ITextEditor *editor);
|
||||||
|
|
||||||
TextEditor::ITextEditable *m_editor;
|
TextEditor::ITextEditable *m_editor;
|
||||||
int m_startPosition; // Position of the cursor from which completion started
|
int m_startPosition; // Position of the cursor from which completion started
|
||||||
|
|
||||||
SnippetsWindow *m_snippetsWnd;
|
SnippetsWindow *m_snippetsWindow;
|
||||||
Core::ICore *m_core;
|
|
||||||
|
|
||||||
QMultiMap<QString, TextEditor::CompletionItem *> m_autoCompletions;
|
QMultiMap<QString, TextEditor::CompletionItem *> m_autoCompletions;
|
||||||
|
|
||||||
|
@@ -36,16 +36,18 @@
|
|||||||
#include "snippetsplugin.h"
|
#include "snippetsplugin.h"
|
||||||
#include "snippetspec.h"
|
#include "snippetspec.h"
|
||||||
|
|
||||||
#include <QtCore/QtPlugin>
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtGui/QShortcut>
|
#include <QtCore/QtPlugin>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
|
#include <QtGui/QShortcut>
|
||||||
|
|
||||||
#include <extensionsystem/pluginmanager.h>
|
#include <extensionsystem/pluginmanager.h>
|
||||||
#include <coreplugin/uniqueidmanager.h>
|
#include <coreplugin/uniqueidmanager.h>
|
||||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
#include <coreplugin/actionmanager/actionmanager.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/CoreTools>
|
#include <coreplugin/baseview.h>
|
||||||
|
#include <coreplugin/icore.h>
|
||||||
|
#include <coreplugin/iview.h>
|
||||||
#include <texteditor/itexteditable.h>
|
#include <texteditor/itexteditable.h>
|
||||||
#include <texteditor/texteditorconstants.h>
|
#include <texteditor/texteditorconstants.h>
|
||||||
|
|
||||||
@@ -56,6 +58,7 @@ SnippetsPlugin *SnippetsPlugin::m_instance = 0;
|
|||||||
SnippetsPlugin::SnippetsPlugin()
|
SnippetsPlugin::SnippetsPlugin()
|
||||||
{
|
{
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
|
m_snippetsCompletion = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SnippetsPlugin::~SnippetsPlugin()
|
SnippetsPlugin::~SnippetsPlugin()
|
||||||
@@ -78,17 +81,20 @@ bool SnippetsPlugin::initialize(const QStringList &arguments, QString *)
|
|||||||
context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
|
context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
|
||||||
|
|
||||||
m_snippetWnd = new SnippetsWindow();
|
m_snippetWnd = new SnippetsWindow();
|
||||||
addAutoReleasedObject(new Core::BaseView("Snippets.SnippetsTree",
|
Core::BaseView *view = new Core::BaseView;
|
||||||
m_snippetWnd,
|
view->setUniqueViewName("Snippets.SnippetsTree");
|
||||||
QList<int>() << core->uniqueIDManager()->uniqueIdentifier(QLatin1String("Snippets Window"))
|
view->setWidget(m_snippetWnd);
|
||||||
<< core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR),
|
view->setContext(QList<int>()
|
||||||
Qt::RightDockWidgetArea));
|
<< core->uniqueIDManager()->uniqueIdentifier(QLatin1String("Snippets Window"))
|
||||||
|
<< core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR));
|
||||||
|
//view->setDefaultPosition(Qt::RightDockWidgetArea));
|
||||||
|
addAutoReleasedObject(view);
|
||||||
m_snippetsCompletion = new SnippetsCompletion(this);
|
m_snippetsCompletion = new SnippetsCompletion(this);
|
||||||
addObject(m_snippetsCompletion);
|
addObject(m_snippetsCompletion);
|
||||||
|
|
||||||
foreach (SnippetSpec *snippet, m_snippetWnd->snippets()) {
|
foreach (SnippetSpec *snippet, m_snippetWnd->snippets()) {
|
||||||
QShortcut *sc = new QShortcut(m_snippetWnd);
|
QShortcut *sc = new QShortcut(m_snippetWnd);
|
||||||
Core::ICommand *cmd = am->registerShortcut(sc, simplifySnippetName(snippet), context);
|
Core::Command *cmd = am->registerShortcut(sc, simplifySnippetName(snippet), context);
|
||||||
cmd->setCategory(tr("Snippets"));
|
cmd->setCategory(tr("Snippets"));
|
||||||
connect(sc, SIGNAL(activated()), this, SLOT(snippetActivated()));
|
connect(sc, SIGNAL(activated()), this, SLOT(snippetActivated()));
|
||||||
m_shortcuts.insert(sc, snippet);
|
m_shortcuts.insert(sc, snippet);
|
||||||
|
@@ -59,8 +59,6 @@ Q_DECLARE_METATYPE(Snippets::Internal::SnippetSpec *)
|
|||||||
|
|
||||||
SnippetsWindow::SnippetsWindow()
|
SnippetsWindow::SnippetsWindow()
|
||||||
{
|
{
|
||||||
m_core = SnippetsPlugin::core();
|
|
||||||
|
|
||||||
setWindowTitle(tr("Snippets"));
|
setWindowTitle(tr("Snippets"));
|
||||||
setWindowIcon(QIcon(":/snippets/images/snippets.png"));
|
setWindowIcon(QIcon(":/snippets/images/snippets.png"));
|
||||||
setOrientation(Qt::Vertical);
|
setOrientation(Qt::Vertical);
|
||||||
@@ -79,7 +77,7 @@ SnippetsWindow::SnippetsWindow()
|
|||||||
if (!initSnippetsDir())
|
if (!initSnippetsDir())
|
||||||
setDisabled(true);
|
setDisabled(true);
|
||||||
else {
|
else {
|
||||||
QDir defaultDir(m_core->resourcePath() + QLatin1String("/snippets"));
|
QDir defaultDir(Core::ICore::instance()->resourcePath() + QLatin1String("/snippets"));
|
||||||
if (defaultDir.exists())
|
if (defaultDir.exists())
|
||||||
initSnippets(defaultDir);
|
initSnippets(defaultDir);
|
||||||
initSnippets(m_snippetsDir);
|
initSnippets(m_snippetsDir);
|
||||||
@@ -110,9 +108,9 @@ void SnippetsWindow::activateSnippet(QTreeWidgetItem *item, int column)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
TextEditor::ITextEditable *editor = 0;
|
TextEditor::ITextEditable *editor = 0;
|
||||||
if (m_core->editorManager()->currentEditor())
|
if (Core::ICore::instance()->editorManager()->currentEditor())
|
||||||
editor = qobject_cast<TextEditor::ITextEditable *>(
|
editor = qobject_cast<TextEditor::ITextEditable *>(
|
||||||
m_core->editorManager()->currentEditor());
|
Core::ICore::instance()->editorManager()->currentEditor());
|
||||||
if (editor) {
|
if (editor) {
|
||||||
SnippetSpec* spec = qVariantValue<SnippetSpec*>(item->data(0, Qt::UserRole));
|
SnippetSpec* spec = qVariantValue<SnippetSpec*>(item->data(0, Qt::UserRole));
|
||||||
insertSnippet(editor, spec);
|
insertSnippet(editor, spec);
|
||||||
@@ -229,9 +227,9 @@ void SnippetsWindow::showInputWidget(bool canceled, const QString &value)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
TextEditor::ITextEditor *te = 0;
|
TextEditor::ITextEditor *te = 0;
|
||||||
if (m_core->editorManager()->currentEditor())
|
if (Core::ICore::instance()->editorManager()->currentEditor())
|
||||||
te = qobject_cast<TextEditor::ITextEditor*>(
|
te = qobject_cast<TextEditor::ITextEditor*>(
|
||||||
m_core->editorManager()->currentEditor());
|
Core::ICore::instance()->editorManager()->currentEditor());
|
||||||
|
|
||||||
int arg = m_requiredArgs.takeFirst();
|
int arg = m_requiredArgs.takeFirst();
|
||||||
if (arg != -1)
|
if (arg != -1)
|
||||||
|
@@ -44,10 +44,6 @@ class QDir;
|
|||||||
class QLabel;
|
class QLabel;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace Core {
|
|
||||||
class ICore;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
class ITextEditable;
|
class ITextEditable;
|
||||||
class ITextEditor;
|
class ITextEditor;
|
||||||
@@ -97,7 +93,6 @@ private:
|
|||||||
SnippetSpec *m_currentSnippet;
|
SnippetSpec *m_currentSnippet;
|
||||||
TextEditor::ITextEditable *m_currentEditor;
|
TextEditor::ITextEditable *m_currentEditor;
|
||||||
|
|
||||||
Core::ICore *m_core;
|
|
||||||
QDir m_snippetsDir;
|
QDir m_snippetsDir;
|
||||||
|
|
||||||
SnippetsTree *m_snippetsTree;
|
SnippetsTree *m_snippetsTree;
|
||||||
|
@@ -151,21 +151,28 @@ void QrcEditor::updateCurrent()
|
|||||||
const bool isValid = m_treeview->currentIndex().isValid();
|
const bool isValid = m_treeview->currentIndex().isValid();
|
||||||
const bool isPrefix = m_treeview->isPrefix(m_treeview->currentIndex()) && isValid;
|
const bool isPrefix = m_treeview->isPrefix(m_treeview->currentIndex()) && isValid;
|
||||||
const bool isFile = !isPrefix && isValid;
|
const bool isFile = !isPrefix && isValid;
|
||||||
|
int cursorPosition;
|
||||||
|
|
||||||
m_ui.aliasLabel->setEnabled(isFile);
|
m_ui.aliasLabel->setEnabled(isFile);
|
||||||
m_ui.aliasText->setEnabled(isFile);
|
m_ui.aliasText->setEnabled(isFile);
|
||||||
m_currentAlias = m_treeview->currentAlias();
|
m_currentAlias = m_treeview->currentAlias();
|
||||||
|
cursorPosition = m_ui.aliasText->cursorPosition();
|
||||||
m_ui.aliasText->setText(m_currentAlias);
|
m_ui.aliasText->setText(m_currentAlias);
|
||||||
|
m_ui.aliasText->setCursorPosition(cursorPosition);
|
||||||
|
|
||||||
m_ui.prefixLabel->setEnabled(isPrefix);
|
m_ui.prefixLabel->setEnabled(isPrefix);
|
||||||
m_ui.prefixText->setEnabled(isPrefix);
|
m_ui.prefixText->setEnabled(isPrefix);
|
||||||
m_currentPrefix = m_treeview->currentPrefix();
|
m_currentPrefix = m_treeview->currentPrefix();
|
||||||
|
cursorPosition = m_ui.prefixText->cursorPosition();
|
||||||
m_ui.prefixText->setText(m_currentPrefix);
|
m_ui.prefixText->setText(m_currentPrefix);
|
||||||
|
m_ui.prefixText->setCursorPosition(cursorPosition);
|
||||||
|
|
||||||
m_ui.languageLabel->setEnabled(isPrefix);
|
m_ui.languageLabel->setEnabled(isPrefix);
|
||||||
m_ui.languageText->setEnabled(isPrefix);
|
m_ui.languageText->setEnabled(isPrefix);
|
||||||
m_currentLanguage = m_treeview->currentLanguage();
|
m_currentLanguage = m_treeview->currentLanguage();
|
||||||
|
cursorPosition = m_ui.languageText->cursorPosition();
|
||||||
m_ui.languageText->setText(m_currentLanguage);
|
m_ui.languageText->setText(m_currentLanguage);
|
||||||
|
m_ui.languageText->setCursorPosition(cursorPosition);
|
||||||
|
|
||||||
m_ui.addButton->setEnabled(true);
|
m_ui.addButton->setEnabled(true);
|
||||||
m_addFileAction->setEnabled(isValid);
|
m_addFileAction->setEnabled(isValid);
|
||||||
|
Reference in New Issue
Block a user