summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesper K. Pedersen <jesper.pedersen@kdab.com>2013-05-06 12:58:47 +0200
committerJesper K. Pedersen <jesper.pedersen@kdab.com>2013-05-13 10:16:37 +0200
commite7e1385068f93584b57e384d751af96757f678c6 (patch)
tree88552f46d6e6ba745162d1c7d52b87458e7c38b3
parent372abbc623c4d248950cc5aa925941dbf64471c8 (diff)
ported the work to master
Change-Id: Iadf6b1c031883e085b13e5775662c7a135e1d971 Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
-rw-r--r--objects/console.cpp6
-rw-r--r--objects/cppeditor.cpp5
-rw-r--r--objects/cppfunction.cpp4
-rw-r--r--objects/editors.cpp3
-rw-r--r--plugin-scripting_dependencies.pri6
-rw-r--r--scripting.pro16
-rw-r--r--scriptmanager.cpp12
-rw-r--r--scriptrunner.cpp4
8 files changed, 30 insertions, 26 deletions
diff --git a/objects/console.cpp b/objects/console.cpp
index c9afbac..a33a401 100644
--- a/objects/console.cpp
+++ b/objects/console.cpp
@@ -47,15 +47,15 @@ Console::Console(QObject *parent) :
void Console::error(const QString &text)
{
- Core::MessageManager::instance()->printToOutputPane(text, Utils::ErrorMessageFormat);
+ Core::MessageManager::instance()->printToOutputPane(text, Core::MessageManager::Flash);
}
void Console::log(const QString &text)
{
- Core::MessageManager::instance()->printToOutputPane(text, false);
+ Core::MessageManager::instance()->printToOutputPane(text, Core::MessageManager::NoModeSwitch);
}
void Console::debug(const QString &text)
{
- Core::MessageManager::instance()->printToOutputPane(text, Utils::DebugFormat);
+ Core::MessageManager::instance()->printToOutputPane(text, Core::MessageManager::NoModeSwitch);
}
diff --git a/objects/cppeditor.cpp b/objects/cppeditor.cpp
index 37ef50c..0451772 100644
--- a/objects/cppeditor.cpp
+++ b/objects/cppeditor.cpp
@@ -4,6 +4,7 @@
#include <cppeditor/cppeditorconstants.h>
#include "utils/signalwaiter.h"
#include "cppfunction.h"
+#include <cpptools/cppmodelmanagerinterface.h>
namespace Scripting {
namespace Internal {
@@ -35,12 +36,12 @@ CppFunction* CppEditor::functionAt(int line, int column) const
*/
void CppEditor::waitForInitialized()
{
- CPlusPlus::Snapshot snapshot = CPlusPlus::CppModelManagerInterface::instance()->snapshot();
+ CPlusPlus::Snapshot snapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
if (!snapshot.isEmpty())
return;
SignalWaiter waiter;
- const bool received = waiter.wait(CPlusPlus::CppModelManagerInterface::instance(), SIGNAL(sourceFilesRefreshed(QStringList)), 1000);
+ const bool received = waiter.wait(CppTools::CppModelManagerInterface::instance(), SIGNAL(sourceFilesRefreshed(QStringList)), 1000);
if ( !received )
qWarning("editor did not complete initialization in time");
}
diff --git a/objects/cppfunction.cpp b/objects/cppfunction.cpp
index 611b22c..912337b 100644
--- a/objects/cppfunction.cpp
+++ b/objects/cppfunction.cpp
@@ -1,6 +1,6 @@
#include "cppfunction.h"
#include <cplusplus/Symbol.h>
-#include <cpptools/ModelManagerInterface.h>
+#include <cpptools/cppmodelmanagerinterface.h>
#include <cplusplus/Overview.h>
#include "cppargument.h"
@@ -35,7 +35,7 @@ CppFunction *CppFunction::create(int line, int column, const QString &fileName)
CPlusPlus::Function *CppFunction::function(int line, int column, const QString &fileName)
{
- const CPlusPlus::Snapshot snapshot = CPlusPlus::CppModelManagerInterface::instance()->snapshot();
+ const CPlusPlus::Snapshot snapshot = CppTools::CppModelManagerInterface::instance()->snapshot();
const CPlusPlus::Document::Ptr document = snapshot.document(fileName);
if (!document)
return 0;
diff --git a/objects/editors.cpp b/objects/editors.cpp
index 7d1ed03..85e73c3 100644
--- a/objects/editors.cpp
+++ b/objects/editors.cpp
@@ -39,6 +39,7 @@
#include <texteditor/basetexteditor.h>
#include <coreplugin/idocument.h>
#include <coreplugin/editormanager/ieditor.h>
+#include <cpptools/cppmodelmanagerinterface.h>
using namespace Scripting;
using namespace Scripting::Internal;
@@ -52,7 +53,7 @@ static Editor *wrapEditor(Core::IEditor *editor) {
Editor *wrapper;
const QString fileName = editor->document()->fileName();
- if ( CPlusPlus::CppModelManagerInterface::instance()->isCppEditor(editor) )
+ if ( CppTools::CppModelManagerInterface::instance()->isCppEditor(editor) )
wrapper = new Scripting::Internal::CppEditor;
else if (qobject_cast<TextEditor::BaseTextEditor*>(editor))
wrapper = new BaseTextEditor;
diff --git a/plugin-scripting_dependencies.pri b/plugin-scripting_dependencies.pri
new file mode 100644
index 0000000..121c15d
--- /dev/null
+++ b/plugin-scripting_dependencies.pri
@@ -0,0 +1,6 @@
+QTC_PLUGIN_NAME = Scripting
+
+QTC_PLUGIN_DEPENDS += \
+ coreplugin \
+ projectexplorer \
+ cpptools \
diff --git a/scripting.pro b/scripting.pro
index 69a09f2..413e22c 100644
--- a/scripting.pro
+++ b/scripting.pro
@@ -1,4 +1,3 @@
-TARGET = Scripting
TEMPLATE = lib
QT += script
@@ -49,11 +48,11 @@ HEADERS += scriptingplugin.h \
## set the QTC_SOURCE environment variable to override the setting here
QTCREATOR_SOURCES = $$(QTC_SOURCE)
-isEmpty(QTCREATOR_SOURCES):QTCREATOR_SOURCES=/d/dev/qt-creator/src
+isEmpty(QTCREATOR_SOURCES):error("Please set the environment variable QTC_SOURCE")
## set the QTC_BUILD environment variable to override the setting here
IDE_BUILD_TREE = $$(QTC_BUILD)
-isEmpty(IDE_BUILD_TREE):IDE_BUILD_TREE=/d/dev/qt-creator/build-Debug
+isEmpty(IDE_BUILD_TREE):error("Please set the environment variable QTC_BUILD")
## uncomment to build plugin into user config directory
## <localappdata>/plugins/<ideversion>
@@ -65,15 +64,10 @@ USE_USER_DESTDIR = yes
PROVIDER = KDAB
+# FIXME: Once the qtscripts wrappers has been copied over, remove this.
+INCLUDEPATH += $(QTC_SOURCE)/src/shared
+
include($$QTCREATOR_SOURCES/src/qtcreatorplugin.pri)
-include($$QTCREATOR_SOURCES/src/shared/scriptwrapper/scriptwrapper.pri)
-include($$QTCREATOR_SOURCES/src/plugins/coreplugin/coreplugin.pri)
-include($$QTCREATOR_SOURCES/src/plugins/locator/locator.pri)
-include($$QTCREATOR_SOURCES/src/plugins/projectexplorer/projectexplorer.pri)
-include($$QTCREATOR_SOURCES/src/plugins/texteditor/texteditor.pri)
-include($$QTCREATOR_SOURCES/src/plugins/cppeditor/cppeditor.pri)
-
-LIBS += -L$$IDE_PLUGIN_PATH/Nokia
OTHER_FILES += \
examples/*
diff --git a/scriptmanager.cpp b/scriptmanager.cpp
index be3f780..c71d9d5 100644
--- a/scriptmanager.cpp
+++ b/scriptmanager.cpp
@@ -140,14 +140,14 @@ void ScriptManager::runFile(const QString &fileName)
{
Core::MessageManager::instance()->showOutputPane();
Core::MessageManager::instance()->printToOutputPane(tr("Start %1...").arg(fileName),
- Utils::NormalMessageFormat);
+ Core::MessageManager::NoModeSwitch);
ErrorMessage message = m_runner->runScript(fileName);
if (message.hasError)
Core::MessageManager::instance()->printToOutputPane(tr("Error in %1 at line %3: %4\n").arg(message.fileName).arg(message.line).arg(message.message),
- Utils::ErrorMessageFormat);
+ Core::MessageManager::NoModeSwitch);
else
Core::MessageManager::instance()->printToOutputPane(tr("The script exited normally\n"),
- Utils::NormalMessageFormat);
+ Core::MessageManager::NoModeSwitch);
}
void ScriptManager::directoryChanged(const QString &path, bool initialize)
@@ -228,7 +228,8 @@ void ScriptManager::addScriptShortcut(const ScriptManager::Script &script)
Core::Context globalContext(Core::Constants::C_GLOBAL);
QShortcut *shortcut = new QShortcut(Core::ICore::mainWindow());
- const Core::Id scriptId(makeScriptId(script));
+ // FIXME: fromString should not be used.
+ const Core::Id scriptId = Core::Id::fromString(makeScriptId(script));
Core::ICore::actionManager()->registerShortcut(shortcut, scriptId, globalContext);
connect(shortcut, SIGNAL(activated()), m_mapper, SLOT(map()));
@@ -238,6 +239,7 @@ void ScriptManager::addScriptShortcut(const ScriptManager::Script &script)
void ScriptManager::removeScriptShortcut(const ScriptManager::Script &script)
{
// Remove shortcut
- const Core::Id scriptId(makeScriptId(script));
+ // FIXME: fromString should not be used.
+ const Core::Id scriptId = Core::Id::fromString(makeScriptId(script));
Core::ICore::actionManager()->unregisterShortcut(scriptId);
}
diff --git a/scriptrunner.cpp b/scriptrunner.cpp
index 38ccf39..1426d01 100644
--- a/scriptrunner.cpp
+++ b/scriptrunner.cpp
@@ -40,7 +40,7 @@
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
-#include <wrap_helpers.h>
+#include <scriptwrapper/wrap_helpers.h>
#include "scriptwrappers.h"
#include "enumwappers.h"
#include "utils/dialogs.h"
@@ -100,7 +100,7 @@ static QScriptValue run(QScriptEngine* engine, const QString& fileName, bool rec
}
else {
Core::MessageManager::instance()->printToOutputPane(QObject::tr("Error: %1 doesn't exist.\n").arg(fileName),
- Utils::ErrorMessageFormat);
+ Core::MessageManager::Flash);
engine->abortEvaluation();
return QScriptValue();
}