Commit 2a4a56b2 authored by Eike Ziller's avatar Eike Ziller

Load plugins from user config directory too.

Also adapt the Qt Creator plugin template to make it
possible to choose between deploying locally or into
Qt Creator's build directory.

Change-Id: Ia8566a5034443bc9574a1593eddf0a89eb4d80b2
Rubber-stamped-by: Daniel Molkentin
Reviewed-on: http://codereview.qt-project.org/4178Reviewed-by: default avatarEike Ziller <eike.ziller@nokia.com>
parent c6a9de72
......@@ -24,6 +24,14 @@ isEmpty(QTCREATOR_SOURCES):QTCREATOR_SOURCES=%QtCreatorSources%
IDE_BUILD_TREE = $$(QTC_BUILD)
isEmpty(IDE_BUILD_TREE):IDE_BUILD_TREE=%QtCreatorBuild%
## uncomment to build plugin into user config directory
## <localappdata>/plugins/<ideversion>
## where <localappdata> is e.g.
## <drive>:\Users\<username>\AppData\Local\Nokia\QtCreator on Windows Vista and later
## $XDG_DATA_HOME/Nokia/QtCreator or ~/.local/share/Nokia/QtCreator on Linux
## ~/Library/Application Support/Nokia/QtCreator on Mac
%DestDir%USE_USER_DESTDIR = yes
PROVIDER = %VendorName%
include($$QTCREATOR_SOURCES/src/qtcreatorplugin.pri)
......
......@@ -95,5 +95,18 @@ leave room for the Qt 4 target page.
defaulttext="" />
<fielddescription>Qt Creator build:</fielddescription>
</field>
<field name="DestDir">
<fieldcontrol class="QComboBox" defaultindex="0">
<comboentries>
<comboentry value="# ">
<comboentrytext>Qt Creator build</comboentrytext>
</comboentry>
<comboentry value="">
<comboentrytext>Local user settings</comboentrytext>
</comboentry>
</comboentries>
</fieldcontrol>
<fielddescription>Deploy into:</fielddescription>
</field>
</fields>
</wizard>
......@@ -32,6 +32,7 @@
#include "qtsingleapplication.h"
#include <app/app_version.h>
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginspec.h>
#include <extensionsystem/iplugin.h>
......@@ -51,9 +52,10 @@
#include <QtNetwork/QNetworkProxyFactory>
#include <QtGui/QMessageBox>
#include <QtGui/QApplication>
#include <QtGui/QDesktopServices>
#include <QtGui/QMainWindow>
#include <QtGui/QMessageBox>
#ifdef ENABLE_QT_BREAKPAD
#include <qtsystemexceptionhandler.h>
......@@ -153,7 +155,7 @@ static inline int askMsgSendFailed()
QMessageBox::Retry);
}
static inline QStringList getPluginPaths()
static inline QStringList getPluginPaths(QSettings *settings)
{
QStringList rc;
// Figure out root: Up one from 'bin'
......@@ -177,6 +179,17 @@ static inline QStringList getPluginPaths()
pluginPath += QLatin1String("PlugIns");
rc.push_back(pluginPath);
#endif
// 3) <localappdata>/plugins/<ideversion>
// where <localappdata> is e.g.
// <drive>:\Users\<username>\AppData\Local\Nokia\QtCreator on Windows Vista and later
// $XDG_DATA_HOME or ~/.local/share/Nokia/QtCreator on Linux
// ~/Library/Application Support/Nokia/QtCreator on Mac
pluginPath = QDesktopServices::storageLocation(QDesktopServices::DataLocation);
pluginPath += QLatin1Char('/');
pluginPath += QLatin1String("plugins");
pluginPath += QLatin1Char('/');
pluginPath += QLatin1String(Core::Constants::IDE_VERSION_LONG);
rc.push_back(pluginPath);
return rc;
}
......@@ -276,7 +289,7 @@ int main(int argc, char **argv)
#endif
#endif
// Load
const QStringList pluginPaths = getPluginPaths();
const QStringList pluginPaths = getPluginPaths(settings);
pluginManager.setPluginPaths(pluginPaths);
QMap<QString, QString> foundAppOptions;
......
......@@ -7,7 +7,17 @@ isEmpty(PROVIDER) {
PROVIDER = Nokia
}
DESTDIR = $$IDE_PLUGIN_PATH/$$PROVIDER
isEmpty(USE_USER_DESTDIR) {
DESTDIR = $$IDE_PLUGIN_PATH/$$PROVIDER
} else {
win32:DESTDIRBASE = "$$(LOCALAPPDATA)"
else:macx: DESTDIRBASE = "$$(HOME)/Library/Application Support"
else:unix {
DESTDIRBASE = "$$(XDG_DATA_HOME)"
isEmpty(DESTDIRBASE):DESTDIRBASE = "$$(HOME)/.local/share"
}
DESTDIR = "$$DESTDIRBASE/Nokia/QtCreator/plugins/$$QTCREATOR_VERSION/$$PROVIDER"
}
LIBS += -L$$DESTDIR
# copy the plugin spec
......@@ -44,7 +54,7 @@ macx {
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../PlugIns/$${PROVIDER}/
} else {
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/PlugIns/$${PROVIDER}/
QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../../
QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../../,-rpath,@executable_path/../
}
} else:linux-* {
#do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR
......
......@@ -3,7 +3,7 @@ macx {
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../PlugIns/
} else {
QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/PlugIns/
QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../
QMAKE_LFLAGS += -Wl,-rpath,@loader_path/../,-rpath,@executable_path/../
}
} else:linux-* {
#do the rpath by hand since it's not possible to use ORIGIN in QMAKE_RPATHDIR
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment