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)
|
||||
{
|
||||
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);
|
||||
explicit ScriptManagerPrivate(QObject *parent);
|
||||
|
||||
virtual QScriptEngine &scriptEngine();
|
||||
|
||||
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->setFontFamily(QWebSettings::StandardFont, fontFamily);
|
||||
}
|
||||
#endif
|
||||
|
||||
connectSignals();
|
||||
}
|
||||
@@ -492,7 +511,7 @@ void CentralWidget::currentPageChanged(int index)
|
||||
bool enabled = false;
|
||||
if (viewer)
|
||||
enabled = tabWidget->count() > 1;
|
||||
|
||||
|
||||
tabWidget->setTabsClosable(enabled);
|
||||
tabWidget->cornerWidget(Qt::TopLeftCorner)->setEnabled(true);
|
||||
|
||||
@@ -595,6 +614,7 @@ bool CentralWidget::eventFilter(QObject *object, QEvent *e)
|
||||
|
||||
void CentralWidget::updateBrowserFont()
|
||||
{
|
||||
#if defined(QT_NO_WEBKIT)
|
||||
QFont font = qApp->font();
|
||||
if (helpEngine->customValue(QLatin1String("useBrowserFont")).toBool())
|
||||
font = qVariantValue<QFont>(helpEngine->customValue(QLatin1String("browserFont")));
|
||||
@@ -605,9 +625,25 @@ void CentralWidget::updateBrowserFont()
|
||||
if (widget->font() != 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();
|
||||
|
||||
@@ -666,7 +702,7 @@ bool CentralWidget::find(const QString &txt, QTextDocument::FindFlags findFlags,
|
||||
}
|
||||
|
||||
void CentralWidget::showTopicChooser(const QMap<QString, QUrl> &links,
|
||||
const QString &keyword)
|
||||
const QString &keyword)
|
||||
{
|
||||
TopicChooser tc(this, keyword, links);
|
||||
if (tc.exec() == QDialog::Accepted)
|
||||
|
@@ -136,5 +136,11 @@ bool DocSettingsPage::applyChanges()
|
||||
}
|
||||
++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();
|
||||
}
|
||||
|
||||
void HelpPlugin::activateHelpMode()
|
||||
{
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
}
|
||||
|
||||
void HelpPlugin::switchToHelpMode()
|
||||
{
|
||||
switchToHelpMode(m_helpViewerForSideBar->source());
|
||||
@@ -403,14 +408,14 @@ void HelpPlugin::switchToHelpMode()
|
||||
|
||||
void HelpPlugin::switchToHelpMode(const QUrl &source)
|
||||
{
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
activateHelpMode();
|
||||
m_centralWidget->setSource(source);
|
||||
m_centralWidget->setFocus();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -561,7 +566,7 @@ void HelpPlugin::activateContext()
|
||||
viewer = m_helpViewerForSideBar;
|
||||
} else {
|
||||
viewer = m_centralWidget->currentHelpViewer();
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
activateHelpMode();
|
||||
}
|
||||
|
||||
if (viewer) {
|
||||
@@ -579,7 +584,7 @@ void HelpPlugin::activateContext()
|
||||
viewer = m_helpViewerForSideBar;
|
||||
} else {
|
||||
viewer = m_centralWidget->currentHelpViewer();
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
activateHelpMode();
|
||||
}
|
||||
|
||||
if (viewer) {
|
||||
@@ -593,19 +598,19 @@ void HelpPlugin::activateContext()
|
||||
|
||||
void HelpPlugin::activateIndex()
|
||||
{
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
activateHelpMode();
|
||||
m_sideBar->activateItem(m_indexItem);
|
||||
}
|
||||
|
||||
void HelpPlugin::activateContents()
|
||||
{
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
activateHelpMode();
|
||||
m_sideBar->activateItem(m_contentItem);
|
||||
}
|
||||
|
||||
void HelpPlugin::activateSearch()
|
||||
{
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
activateHelpMode();
|
||||
m_sideBar->activateItem(m_searchItem);
|
||||
}
|
||||
|
||||
@@ -680,7 +685,7 @@ void HelpPlugin::addNewBookmark(const QString &title, const QString &url)
|
||||
|
||||
void HelpPlugin::openGettingStarted()
|
||||
{
|
||||
m_core->modeManager()->activateMode(QLatin1String(Constants::ID_MODE_HELP));
|
||||
activateHelpMode();
|
||||
m_centralWidget->setSource(
|
||||
QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html")
|
||||
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
|
||||
|
@@ -134,6 +134,7 @@ private slots:
|
||||
private:
|
||||
QToolBar *createToolBar();
|
||||
void createRightPaneSideBar();
|
||||
void activateHelpMode();
|
||||
|
||||
Core::ICore *m_core;
|
||||
QHelpEngine *m_helpEngine;
|
||||
|
@@ -33,8 +33,8 @@
|
||||
|
||||
#include "qtestlibplugin.h"
|
||||
|
||||
//#include <Qt4IProjectManagers>
|
||||
//#include <texteditor/TextEditorInterfaces>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <texteditor/itexteditor.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
@@ -116,28 +116,27 @@ static QTestFunction::MessageType stringToMessageType(const QString &str)
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
QTestLibPlugin::QTestLibPlugin() :
|
||||
m_projectExplorer(0),
|
||||
m_core(0),
|
||||
m_outputPane(0)
|
||||
QTestLibPlugin::QTestLibPlugin()
|
||||
: m_projectExplorer(0), m_outputPane(0)
|
||||
{
|
||||
}
|
||||
|
||||
QTestLibPlugin::~QTestLibPlugin()
|
||||
{
|
||||
if (m_core && m_outputPane)
|
||||
m_core->pluginManager()->removeObject(m_outputPane);
|
||||
if (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);
|
||||
m_projectExplorer = app->getObject<ProjectExplorer::ProjectExplorerPlugin>();
|
||||
connect(m_projectExplorer->qObject(), SIGNAL(aboutToExecuteProject(ProjectExplorer::Project *)),
|
||||
m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
|
||||
connect(m_projectExplorer, SIGNAL(aboutToExecuteProject(ProjectExplorer::Project *)),
|
||||
this, SLOT(projectRunHook(ProjectExplorer::Project *)));
|
||||
|
||||
m_outputPane = new QTestOutputPane(this);
|
||||
app->addObject(m_outputPane);
|
||||
ExtensionSystem::PluginManager::instance()->addObject(m_outputPane);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -169,10 +168,10 @@ void QTestLibPlugin::projectRunHook(ProjectExplorer::Project *proj)
|
||||
|
||||
//NBS proj->setCustomApplicationOutputHandler(this);
|
||||
//NBS proj->setExtraApplicationRunArguments(QStringList() << QLatin1String("-xml") << QLatin1String("-o") << m_outputFile);
|
||||
const QString proFile = proj->fileName();
|
||||
const QFileInfo fi(proFile);
|
||||
if (QFile::exists(fi.absolutePath()))
|
||||
m_projectDirectory = fi.absolutePath();
|
||||
// const QString proFile = proj->fileName();
|
||||
// const QFileInfo fi(proFile);
|
||||
// if (QFile::exists(fi.absolutePath()))
|
||||
// m_projectDirectory = fi.absolutePath();
|
||||
}
|
||||
|
||||
void QTestLibPlugin::clear()
|
||||
@@ -319,9 +318,11 @@ bool QTestFunction::indexHasIncidents(const QModelIndex &function, IncidentType
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// -------------- QTestOutputPane
|
||||
QTestOutputPane::QTestOutputPane(QTestLibPlugin *plugin) :
|
||||
QObject(plugin),
|
||||
|
||||
QTestOutputPane::QTestOutputPane(QTestLibPlugin *plugin)
|
||||
: QObject(plugin),
|
||||
m_plugin(plugin),
|
||||
m_widget(0),
|
||||
m_model(new QStandardItemModel(this))
|
||||
@@ -485,8 +486,8 @@ void QTestOutputWidget::gotoLocation(QModelIndex index)
|
||||
|
||||
QTestLocation loc = tag.value<QTestLocation>();
|
||||
|
||||
m_coreInterface->editorManager()->openEditor(loc.file);
|
||||
Core::EditorInterface *edtIface = m_coreInterface->editorManager()->currentEditor();
|
||||
Core::ICore::instance()->editorManager()->openEditor(loc.file);
|
||||
Core::EditorInterface *edtIface = Core::ICore::instance()->editorManager()->currentEditor();
|
||||
if (!edtIface)
|
||||
return;
|
||||
TextEditor::ITextEditor *editor =
|
||||
|
@@ -35,18 +35,19 @@
|
||||
#define QTESTLIBPLUGIN_H
|
||||
|
||||
#include <coreplugin/ioutputpane.h>
|
||||
//#include <projectexplorer/ProjectExplorerInterfaces>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
|
||||
#include <QtGui/QPixmap>
|
||||
#include <QtGui/QSortFilterProxyModel>
|
||||
#include <QtGui/QStandardItem>
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QSortFilterProxyModel>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QStandardItemModel;
|
||||
class QTreeView;
|
||||
class QTextEdit;
|
||||
class QComboBox;
|
||||
class QStandardItemModel;
|
||||
class QTextEdit;
|
||||
class QTreeView;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace QTestLib {
|
||||
@@ -101,7 +102,7 @@ public:
|
||||
class QTestOutputPane : public Core::IOutputPane
|
||||
{
|
||||
Q_OBJECT
|
||||
//Q_INTERFACES(Core::IOutputPane)
|
||||
|
||||
public:
|
||||
QTestOutputPane(QTestLibPlugin *plugin);
|
||||
|
||||
@@ -116,8 +117,13 @@ public:
|
||||
|
||||
void show();
|
||||
|
||||
Q_SIGNALS:
|
||||
//signals
|
||||
// FIXME:
|
||||
virtual int priorityInStatusBar() const { return 0;}
|
||||
virtual void setFocus() {}
|
||||
virtual bool hasFocus() { return false;}
|
||||
virtual bool canFocus() { return false;}
|
||||
|
||||
signals:
|
||||
void showPage();
|
||||
|
||||
private:
|
||||
@@ -165,19 +171,15 @@ private:
|
||||
QTestOutputFilter *m_filterModel;
|
||||
};
|
||||
|
||||
class QTestLibPlugin : public QObject,
|
||||
public ExtensionSystem::PluginInterface,
|
||||
public ProjectExplorer::IApplicationOutput
|
||||
class QTestLibPlugin : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(ExtensionSystem::PluginInterface
|
||||
ProjectExplorer::IApplicationOutput)
|
||||
|
||||
public:
|
||||
QTestLibPlugin();
|
||||
virtual ~QTestLibPlugin();
|
||||
|
||||
bool init(ExtensionSystem::PluginManagerInterface *app, QString *error_message);
|
||||
bool init(const QStringList &args, QString *error_message);
|
||||
void extensionsInitialized();
|
||||
|
||||
// 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)
|
||||
: ICompletionCollector(parent)
|
||||
{
|
||||
m_core = SnippetsPlugin::core();
|
||||
m_snippetsWnd = SnippetsPlugin::snippetsWindow();
|
||||
m_snippetsWindow = SnippetsPlugin::snippetsWindow();
|
||||
|
||||
updateCompletions();
|
||||
}
|
||||
@@ -66,9 +65,9 @@ void SnippetsCompletion::updateCompletions()
|
||||
{
|
||||
qDeleteAll(m_autoCompletions.values());
|
||||
m_autoCompletions.clear();
|
||||
|
||||
#if 0
|
||||
int index = 0;
|
||||
foreach (SnippetSpec *spec, m_snippetsWnd->snippets()) {
|
||||
foreach (SnippetSpec *spec, m_snippetsWindow->snippets()) {
|
||||
if (!spec->completionShortcut().isEmpty()) {
|
||||
TextEditor::CompletionItem *item = new TextEditor::CompletionItem;
|
||||
item->m_key = spec->name();
|
||||
@@ -79,6 +78,7 @@ void SnippetsCompletion::updateCompletions()
|
||||
++index;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool SnippetsCompletion::triggersCompletion(TextEditor::ITextEditable *editor)
|
||||
@@ -96,29 +96,36 @@ int SnippetsCompletion::startCompletion(TextEditor::ITextEditable *editor)
|
||||
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;
|
||||
if (length >= 2) {
|
||||
QString key = m_editor->textAt(m_startPosition, length);
|
||||
foreach (TextEditor::CompletionItem* item, m_autoCompletions.values()) {
|
||||
if (item->m_key.startsWith(key, Qt::CaseInsensitive)) {
|
||||
(*completions) << item;
|
||||
}
|
||||
if (item->m_key.startsWith(key, Qt::CaseInsensitive))
|
||||
completions->append(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
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();
|
||||
#endif
|
||||
return QString();
|
||||
}
|
||||
|
||||
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();
|
||||
#endif
|
||||
return QString();
|
||||
}
|
||||
|
||||
QIcon SnippetsCompletion::icon(TextEditor::CompletionItem *) const
|
||||
@@ -126,18 +133,20 @@ QIcon SnippetsCompletion::icon(TextEditor::CompletionItem *) const
|
||||
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;
|
||||
m_editor->setCurPos(m_startPosition);
|
||||
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;
|
||||
}
|
||||
|
@@ -36,15 +36,11 @@
|
||||
|
||||
#include <texteditor/icompletioncollector.h>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
namespace Core {
|
||||
class ICore;
|
||||
}
|
||||
|
||||
namespace TextEditor {
|
||||
class ITextEditable;
|
||||
class ITextEditor;
|
||||
@@ -72,10 +68,12 @@ public:
|
||||
QString details(TextEditor::CompletionItem *item) const;
|
||||
QIcon icon(TextEditor::CompletionItem *item) const;
|
||||
|
||||
void complete(TextEditor::CompletionItem *item);
|
||||
bool partiallyComplete();
|
||||
void complete(const TextEditor::CompletionItem &item);
|
||||
bool partiallyComplete(const QList<TextEditor::CompletionItem> &);
|
||||
void cleanup();
|
||||
|
||||
void completions(QList<TextEditor::CompletionItem>*);
|
||||
|
||||
private slots:
|
||||
void updateCompletions();
|
||||
|
||||
@@ -83,10 +81,9 @@ private:
|
||||
static int findStartOfName(const TextEditor::ITextEditor *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;
|
||||
Core::ICore *m_core;
|
||||
SnippetsWindow *m_snippetsWindow;
|
||||
|
||||
QMultiMap<QString, TextEditor::CompletionItem *> m_autoCompletions;
|
||||
|
||||
|
@@ -36,16 +36,18 @@
|
||||
#include "snippetsplugin.h"
|
||||
#include "snippetspec.h"
|
||||
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtGui/QShortcut>
|
||||
#include <QtCore/QtPlugin>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QShortcut>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
#include <coreplugin/actionmanager/actionmanagerinterface.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.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/texteditorconstants.h>
|
||||
|
||||
@@ -56,6 +58,7 @@ SnippetsPlugin *SnippetsPlugin::m_instance = 0;
|
||||
SnippetsPlugin::SnippetsPlugin()
|
||||
{
|
||||
m_instance = this;
|
||||
m_snippetsCompletion = 0;
|
||||
}
|
||||
|
||||
SnippetsPlugin::~SnippetsPlugin()
|
||||
@@ -78,17 +81,20 @@ bool SnippetsPlugin::initialize(const QStringList &arguments, QString *)
|
||||
context << core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
|
||||
|
||||
m_snippetWnd = new SnippetsWindow();
|
||||
addAutoReleasedObject(new Core::BaseView("Snippets.SnippetsTree",
|
||||
m_snippetWnd,
|
||||
QList<int>() << core->uniqueIDManager()->uniqueIdentifier(QLatin1String("Snippets Window"))
|
||||
<< core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR),
|
||||
Qt::RightDockWidgetArea));
|
||||
Core::BaseView *view = new Core::BaseView;
|
||||
view->setUniqueViewName("Snippets.SnippetsTree");
|
||||
view->setWidget(m_snippetWnd);
|
||||
view->setContext(QList<int>()
|
||||
<< core->uniqueIDManager()->uniqueIdentifier(QLatin1String("Snippets Window"))
|
||||
<< core->uniqueIDManager()->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR));
|
||||
//view->setDefaultPosition(Qt::RightDockWidgetArea));
|
||||
addAutoReleasedObject(view);
|
||||
m_snippetsCompletion = new SnippetsCompletion(this);
|
||||
addObject(m_snippetsCompletion);
|
||||
|
||||
foreach (SnippetSpec *snippet, m_snippetWnd->snippets()) {
|
||||
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"));
|
||||
connect(sc, SIGNAL(activated()), this, SLOT(snippetActivated()));
|
||||
m_shortcuts.insert(sc, snippet);
|
||||
|
@@ -59,8 +59,6 @@ Q_DECLARE_METATYPE(Snippets::Internal::SnippetSpec *)
|
||||
|
||||
SnippetsWindow::SnippetsWindow()
|
||||
{
|
||||
m_core = SnippetsPlugin::core();
|
||||
|
||||
setWindowTitle(tr("Snippets"));
|
||||
setWindowIcon(QIcon(":/snippets/images/snippets.png"));
|
||||
setOrientation(Qt::Vertical);
|
||||
@@ -79,7 +77,7 @@ SnippetsWindow::SnippetsWindow()
|
||||
if (!initSnippetsDir())
|
||||
setDisabled(true);
|
||||
else {
|
||||
QDir defaultDir(m_core->resourcePath() + QLatin1String("/snippets"));
|
||||
QDir defaultDir(Core::ICore::instance()->resourcePath() + QLatin1String("/snippets"));
|
||||
if (defaultDir.exists())
|
||||
initSnippets(defaultDir);
|
||||
initSnippets(m_snippetsDir);
|
||||
@@ -110,9 +108,9 @@ void SnippetsWindow::activateSnippet(QTreeWidgetItem *item, int column)
|
||||
return;
|
||||
|
||||
TextEditor::ITextEditable *editor = 0;
|
||||
if (m_core->editorManager()->currentEditor())
|
||||
if (Core::ICore::instance()->editorManager()->currentEditor())
|
||||
editor = qobject_cast<TextEditor::ITextEditable *>(
|
||||
m_core->editorManager()->currentEditor());
|
||||
Core::ICore::instance()->editorManager()->currentEditor());
|
||||
if (editor) {
|
||||
SnippetSpec* spec = qVariantValue<SnippetSpec*>(item->data(0, Qt::UserRole));
|
||||
insertSnippet(editor, spec);
|
||||
@@ -229,9 +227,9 @@ void SnippetsWindow::showInputWidget(bool canceled, const QString &value)
|
||||
return;
|
||||
|
||||
TextEditor::ITextEditor *te = 0;
|
||||
if (m_core->editorManager()->currentEditor())
|
||||
if (Core::ICore::instance()->editorManager()->currentEditor())
|
||||
te = qobject_cast<TextEditor::ITextEditor*>(
|
||||
m_core->editorManager()->currentEditor());
|
||||
Core::ICore::instance()->editorManager()->currentEditor());
|
||||
|
||||
int arg = m_requiredArgs.takeFirst();
|
||||
if (arg != -1)
|
||||
|
@@ -44,10 +44,6 @@ class QDir;
|
||||
class QLabel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Core {
|
||||
class ICore;
|
||||
}
|
||||
|
||||
namespace TextEditor {
|
||||
class ITextEditable;
|
||||
class ITextEditor;
|
||||
@@ -97,7 +93,6 @@ private:
|
||||
SnippetSpec *m_currentSnippet;
|
||||
TextEditor::ITextEditable *m_currentEditor;
|
||||
|
||||
Core::ICore *m_core;
|
||||
QDir m_snippetsDir;
|
||||
|
||||
SnippetsTree *m_snippetsTree;
|
||||
|
@@ -151,21 +151,28 @@ void QrcEditor::updateCurrent()
|
||||
const bool isValid = m_treeview->currentIndex().isValid();
|
||||
const bool isPrefix = m_treeview->isPrefix(m_treeview->currentIndex()) && isValid;
|
||||
const bool isFile = !isPrefix && isValid;
|
||||
int cursorPosition;
|
||||
|
||||
m_ui.aliasLabel->setEnabled(isFile);
|
||||
m_ui.aliasText->setEnabled(isFile);
|
||||
m_currentAlias = m_treeview->currentAlias();
|
||||
cursorPosition = m_ui.aliasText->cursorPosition();
|
||||
m_ui.aliasText->setText(m_currentAlias);
|
||||
m_ui.aliasText->setCursorPosition(cursorPosition);
|
||||
|
||||
m_ui.prefixLabel->setEnabled(isPrefix);
|
||||
m_ui.prefixText->setEnabled(isPrefix);
|
||||
m_currentPrefix = m_treeview->currentPrefix();
|
||||
cursorPosition = m_ui.prefixText->cursorPosition();
|
||||
m_ui.prefixText->setText(m_currentPrefix);
|
||||
m_ui.prefixText->setCursorPosition(cursorPosition);
|
||||
|
||||
m_ui.languageLabel->setEnabled(isPrefix);
|
||||
m_ui.languageText->setEnabled(isPrefix);
|
||||
m_currentLanguage = m_treeview->currentLanguage();
|
||||
cursorPosition = m_ui.languageText->cursorPosition();
|
||||
m_ui.languageText->setText(m_currentLanguage);
|
||||
m_ui.languageText->setCursorPosition(cursorPosition);
|
||||
|
||||
m_ui.addButton->setEnabled(true);
|
||||
m_addFileAction->setEnabled(isValid);
|
||||
|
Reference in New Issue
Block a user