Browse Source

fixes crash on saving customdialog relatif on dev [1846:0e89aa6ff169]

master
Ulrich Van Den Hekke 11 years ago
parent
commit
9592cb1cc6
  1. 4
      framework/application/customdialog/customsyntaximpl.cpp
  2. 3
      framework/application/xinxdockwidget.cpp
  3. 4
      framework/codecompletion/model.cpp
  4. 15
      framework/codecompletion/pool.cpp
  5. 7
      framework/codecompletion/pool.h
  6. 2
      framework/contentview3/parserfactory.cpp
  7. 2
      framework/core/errordockimpl.cpp
  8. 32
      framework/core/xinxconfig.cpp
  9. 7
      framework/core/xinxconfig.h
  10. 2
      framework/core/xinxsingleton.h
  11. 2
      framework/editors/abstracteditor.cpp
  12. 2
      framework/editors/editorfactory.cpp
  13. 8
      framework/editors/editormanager.cpp
  14. 37
      framework/editors/filetypepool.cpp
  15. 9
      framework/editors/filetypepool.h
  16. 4
      framework/editors/filetypeselector.cpp
  17. 2
      framework/editors/textfileeditor.cpp
  18. 6
      framework/editors/xinxformatscheme.cpp
  19. 46
      framework/plugins/xinxpluginsloader.cpp
  20. 13
      framework/plugins/xinxpluginsloader.h
  21. 2
      framework/project/iconprojectprovider.cpp
  22. 4
      framework/project/projectlistmodel.cpp
  23. 2
      framework/project/projectpropertyimpl.cpp
  24. 2
      framework/search/replacedialogimpl.cpp
  25. 4
      framework/snipets/snipetpropertydlgimpl.cpp
  26. 2
      plugins/core/editors/models/xsl/importitemmodelfactory.cpp
  27. 2
      plugins/core/editors/models/xsl/stylesheet_importnode.cpp
  28. 2
      plugins/core/editors/models/xsl/stylesheet_parser.cpp
  29. 2
      plugins/cvsplugin/rcs_cvs.cpp
  30. 2
      plugins/svnpluginwrapper/rcs_svn.cpp
  31. 1
      xinx/main.cpp

4
framework/application/customdialog/customsyntaximpl.cpp

@ -64,7 +64,9 @@ bool CustomSyntaxImpl::loadSettingsDialog() @@ -64,7 +64,9 @@ bool CustomSyntaxImpl::loadSettingsDialog()
m_highlighterComboBox->addItem(lang);
XinxFormatScheme * scheme;
if (m_formatScheme.value(lang))
{
scheme = m_formatScheme.value(lang);
}
else
{
scheme = new XinxFormatScheme();
@ -99,7 +101,7 @@ void CustomSyntaxImpl::on_m_highlighterComboBox_activated(QString text) @@ -99,7 +101,7 @@ void CustomSyntaxImpl::on_m_highlighterComboBox_activated(QString text)
m_customScheme->setFormatScheme(m_formatScheme.value(text));
m_customScheme->setLanguageFactory(XINXConfig::self()->languageFactory());
m_customScheme->setLanguageDefinition(text);
m_customScheme->setExample(FileTypePool::self()->exampleOfHighlighter(text));
m_customScheme->setExample(XinxPluginsLoader::self()->fileTypePool()->exampleOfHighlighter(text));
}
bool CustomSyntaxImpl::cancelSettingsDialog()

3
framework/application/xinxdockwidget.cpp

@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@
#include "xinxdockwidget.h"
#include <dtoolview.h>
#include <dviewbutton.h>
#include <core/xinxconfig.h>
XinxDockWidget::XinxDockWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f), _dock(0)
{
@ -34,7 +35,7 @@ XinxDockWidget::~XinxDockWidget() @@ -34,7 +35,7 @@ XinxDockWidget::~XinxDockWidget()
QString XinxDockWidget::windowTitle() const
{
if (!_shortcut.isEmpty())
if (!_shortcut.isEmpty() && XINXConfig::self()->config().dock.showShortcut)
{
return QWidget::windowTitle() + QString(" (%1)").arg(_shortcut.toString());
}

4
framework/codecompletion/model.cpp

@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
#include "itemmodelfactory.h"
#include <editors/textfileeditor.h>
#include <editors/xinxcodeedit.h>
#include <codecompletion/pool.h>
#include <plugins/xinxpluginsloader.h>
namespace CodeCompletion
{
@ -387,7 +387,7 @@ Context Model::context() const @@ -387,7 +387,7 @@ Context Model::context() const
void Model::updateModel()
{
Pool::self()->generate(d.data(), d->_context);
XinxPluginsLoader::self()->codeCompletionPool()->generate(d.data(), d->_context);
}
}

15
framework/codecompletion/pool.cpp

@ -38,6 +38,7 @@ namespace CodeCompletion @@ -38,6 +38,7 @@ namespace CodeCompletion
class PrivatePool
{
public:
XinxPluginsLoader * _loader;
QMultiHash<QString,ContextParser*> _parsers;
QMultiHash<QString,ItemModelFactory*> _factories;
};
@ -48,8 +49,9 @@ public: @@ -48,8 +49,9 @@ public:
* \note This class doesn't use lock on resource, for performance reason. Methods are normally called once at once. If this is bug generator, we add lock in this class.
*/
Pool::Pool() : d(new PrivatePool)
Pool::Pool(XinxPluginsLoader * loader) : d(new PrivatePool)
{
d->_loader = loader;
connect(XINXConfig::self(), SIGNAL(changed()), this, SLOT(updateParsers()));
}
@ -66,7 +68,7 @@ void Pool::updateParsers() @@ -66,7 +68,7 @@ void Pool::updateParsers()
qDeleteAll(d->_parsers.values());
d->_parsers.clear();
foreach(XinxPluginElement * element, XinxPluginsLoader::self()->plugins())
foreach(XinxPluginElement * element, d->_loader->plugins())
{
ICodeCompletionPlugin * interface = qobject_cast<ICodeCompletionPlugin*> (element->plugin());
if (element->isActivated() && interface)
@ -89,10 +91,6 @@ void Pool::updateParsers() @@ -89,10 +91,6 @@ void Pool::updateParsers()
void Pool::generate(ItemInterface * interface, CodeCompletion::Context context)
{
Q_ASSERT_X(interface, "Pool::generate", "ItemInterface to populate model must not be null");
if (d->_factories.isEmpty())
{
updateParsers();
}
QStringList contextsType = interface->contextsType();
foreach(const QString & contextType, contextsType)
@ -121,11 +119,6 @@ void Pool::generate(ItemInterface * interface, CodeCompletion::Context context) @@ -121,11 +119,6 @@ void Pool::generate(ItemInterface * interface, CodeCompletion::Context context)
void Pool::updateContext(TextFileEditor * editor, CodeCompletion::Context context)
{
if (d->_parsers.isEmpty())
{
updateParsers();
}
context.setPrefix(editor->textEdit()->textUnderCursor(editor->textEdit()->textCursor()));
QHashIterator<QString, ContextParser*> i(d->_parsers);

7
framework/codecompletion/pool.h

@ -26,6 +26,7 @@ @@ -26,6 +26,7 @@
#include <codecompletion/context.h>
class TextFileEditor;
class XinxPluginsLoader;
namespace CodeCompletion
{
@ -33,10 +34,11 @@ namespace CodeCompletion @@ -33,10 +34,11 @@ namespace CodeCompletion
class PrivatePool;
class ItemInterface;
class Pool : public XinxLibSingleton<Pool>
class Pool : public QObject
{
Q_OBJECT
public:
Pool(XinxPluginsLoader * loader);
virtual ~Pool();
public slots:
@ -46,9 +48,6 @@ public slots: @@ -46,9 +48,6 @@ public slots:
private:
Q_DISABLE_COPY(Pool)
Pool();
friend class XinxLibSingleton<Pool>;
QScopedPointer<PrivatePool> d;
};

2
framework/contentview3/parserfactory.cpp

@ -52,7 +52,7 @@ QString ParserFactory::getParserTypeByFilename(const QString & filename) @@ -52,7 +52,7 @@ QString ParserFactory::getParserTypeByFilename(const QString & filename)
if (! QFileInfo(filename).exists()) return QString();
QStringList parserTypes;
QList<IFileTypePluginPtr> fileTypes = FileTypePool::self()->matchedFileType(filename);
QList<IFileTypePluginPtr> fileTypes = XinxPluginsLoader::self()->fileTypePool()->matchedFileType(filename);
foreach(IFileTypePluginPtr fileType, fileTypes)
{
QString parserType = fileType->parserType();

2
framework/core/errordockimpl.cpp

@ -84,7 +84,7 @@ void ErrorDockWidgetImpl::updateErrors() @@ -84,7 +84,7 @@ void ErrorDockWidgetImpl::updateErrors()
{
QTreeWidgetItem * fileItem = new QTreeWidgetItem(_widget->m_messagesWidget);
fileItem->setText(0, context);
QList<IFileTypePluginPtr> fileTypes = FileTypePool::self()->matchedFileType(context);
QList<IFileTypePluginPtr> fileTypes = XinxPluginsLoader::self()->fileTypePool()->matchedFileType(context);
if (fileTypes.size())
{
fileItem->setIcon(0, QIcon(fileTypes.at(0)->icon()));

32
framework/core/xinxconfig.cpp

@ -64,7 +64,6 @@ XINXConfig& XINXConfig::operator=(const XINXConfig& p) @@ -64,7 +64,6 @@ XINXConfig& XINXConfig::operator=(const XINXConfig& p)
void XINXConfig::load()
{
AppSettings::load();
updateActivatedPlugin();
updateFormatsSchemeFromConfig();
}
@ -72,39 +71,16 @@ void XINXConfig::save() @@ -72,39 +71,16 @@ void XINXConfig::save()
{
putFormatsSchemeToConfig();
AppSettings::save();
updateActivatedPlugin();
emit changed();
}
void XINXConfig::updateActivatedPlugin()
{
/* Update activated list of plugin */
_activatedPlugin.clear();
QHashIterator<QString,bool> it(config().plugins);
while (it.hasNext())
{
it.next();
const QString key = it.key();
const bool activated = it.value();
if (activated && ! _activatedPlugin.contains(key))
{
_activatedPlugin.append(key);
emit pluginActivated(key);
}
else if (! activated && _activatedPlugin.contains(key))
{
_activatedPlugin.removeAll(key);
emit pluginDesactivated(key);
}
}
}
XinxLanguageFactory * XINXConfig::languageFactory()
{
if (! m_languages)
{
m_languages = new XinxLanguageFactory(new XinxFormatScheme(this), this);
XinxFormatScheme * scheme = new XinxFormatScheme(this);
scheme->setObjectName("default");
m_languages = new XinxLanguageFactory(scheme, this);
}
return m_languages;
}
@ -119,7 +95,7 @@ XinxFormatScheme* XINXConfig::scheme(const QString & highlighter) @@ -119,7 +95,7 @@ XinxFormatScheme* XINXConfig::scheme(const QString & highlighter)
{
if (! m_formatScheme.contains(highlighter))
{
XinxFormatScheme* scheme = FileTypePool::self()->scheme(highlighter);
XinxFormatScheme* scheme = XinxPluginsLoader::self()->fileTypePool()->scheme(highlighter);
if (scheme)
{
scheme->updateFormatsFromConfig();

7
framework/core/xinxconfig.h

@ -95,23 +95,16 @@ public: @@ -95,23 +95,16 @@ public:
signals:
/*! Signal emited when the configuration is changed */
void changed();
/*! Signal emited when a plugin is activated */
void pluginActivated(const QString & name);
/*! Signal emited when a plugin is desactivated */
void pluginDesactivated(const QString & name);
public slots:
//! Update the list of format (can't delete existing format)
void updateFormatsSchemeFromConfig();
//! Put format to config
void putFormatsSchemeToConfig();
//! Update activated plugin
void updateActivatedPlugin();
protected:
virtual struct_globals getDefaultGlobals();
virtual struct_editor getDefaultEditor();
private:
QStringList _activatedPlugin;
QPointer<XinxLanguageFactory> m_languages;
QHash<QString,XinxFormatScheme*> m_formatScheme;
};

2
framework/core/xinxsingleton.h

@ -66,6 +66,7 @@ public: @@ -66,6 +66,7 @@ public:
protected:
XinxLibSingleton()
{
setObjectName(typeid(T).name());
XINXStaticDeleter::self()->addObject(this);
}
@ -116,6 +117,7 @@ public: @@ -116,6 +117,7 @@ public:
protected:
XinxSingleton()
{
setObjectName(typeid(T).name());
XINXStaticDeleter::self()->addObject(this);
}

2
framework/editors/abstracteditor.cpp

@ -678,7 +678,7 @@ void AbstractEditor::deserialize(XinxSession::SessionEditor * data) @@ -678,7 +678,7 @@ void AbstractEditor::deserialize(XinxSession::SessionEditor * data)
AbstractEditor * AbstractEditor::deserializeEditor(XinxSession::SessionEditor * data)
{
QString name = data->readProperty("ClassName").toString();
IFileTypePluginPtr plugin = FileTypePool::self()->fileType(name);
IFileTypePluginPtr plugin = XinxPluginsLoader::self()->fileTypePool()->fileType(name);
if (plugin)
{
AbstractEditor * editor = plugin->createEditor();

2
framework/editors/editorfactory.cpp

@ -44,7 +44,7 @@ EditorFactory::~EditorFactory() @@ -44,7 +44,7 @@ EditorFactory::~EditorFactory()
IFileTypePluginPtr EditorFactory::interfaceOfName(const QString & name)
{
QList<IFileTypePluginPtr> interfaces = FileTypePool::self()->fileTypes();
QList<IFileTypePluginPtr> interfaces = XinxPluginsLoader::self()->fileTypePool()->fileTypes();
foreach(const IFileTypePluginPtr & interface, interfaces)
{
if (interface->name() == name)

8
framework/editors/editormanager.cpp

@ -213,8 +213,8 @@ void PrivateEditorManager::updateRecentFiles() @@ -213,8 +213,8 @@ void PrivateEditorManager::updateRecentFiles()
for (int i = 0; i < numRecentFiles; i++)
{
QString text = QString("&%1 %2").arg(i + 1).arg(QFileInfo(XinxSession::SessionManager::self()->currentSession()->lastClosedFile()[i]).fileName());
if (FileTypePool::self()->matchedFileType(QFileInfo(text).fileName()).size())
_recent_actions[i]->setIcon(QIcon(FileTypePool::self()->matchedFileType(QFileInfo(text).fileName()).at(0)->icon()));
if (XinxPluginsLoader::self()->fileTypePool()->matchedFileType(QFileInfo(text).fileName()).size())
_recent_actions[i]->setIcon(QIcon(XinxPluginsLoader::self()->fileTypePool()->matchedFileType(QFileInfo(text).fileName()).at(0)->icon()));
_recent_actions[i]->setText(text);
_recent_actions[i]->setData(XinxSession::SessionManager::self()->currentSession()->lastClosedFile()[i]);
_recent_actions[i]->setVisible(true);
@ -579,7 +579,7 @@ void EditorManager::changeToPreviousEditor() @@ -579,7 +579,7 @@ void EditorManager::changeToPreviousEditor()
void EditorManager::openFile()
{
QStringList selectedFiles = QFileDialog::getOpenFileNames(qApp->activeWindow(), tr("Open text file"), d->m_lastOpenedFileName, FileTypePool::self()->openDialogBoxFilters().join(";;"));
QStringList selectedFiles = QFileDialog::getOpenFileNames(qApp->activeWindow(), tr("Open text file"), d->m_lastOpenedFileName, XinxPluginsLoader::self()->fileTypePool()->openDialogBoxFilters().join(";;"));
d->tabWidget()->setUpdatesEnabled(false);
foreach(const QString & filename, selectedFiles)
@ -668,7 +668,7 @@ void EditorManager::saveFile(AbstractEditor* editor, bool saveAs) @@ -668,7 +668,7 @@ void EditorManager::saveFile(AbstractEditor* editor, bool saveAs)
const QString filename = editor->lastFileName();
const QString deffilename = editor->defaultFileName();
const QString filter = FileTypePool::self()->matchedFileType(filename.isEmpty() ? deffilename : filename).size() ? FileTypePool::self()->fileTypeFilter(FileTypePool::self()->matchedFileType(filename.isEmpty() ? deffilename : filename).at(0)) : "";
const QString filter = XinxPluginsLoader::self()->fileTypePool()->matchedFileType(filename.isEmpty() ? deffilename : filename).size() ? XinxPluginsLoader::self()->fileTypePool()->fileTypeFilter(XinxPluginsLoader::self()->fileTypePool()->matchedFileType(filename.isEmpty() ? deffilename : filename).at(0)) : "";
const bool emptyname = filename.isEmpty();
bool accept = false;

37
framework/editors/filetypepool.cpp

@ -32,19 +32,22 @@ @@ -32,19 +32,22 @@
class PrivateFileTypePool
{
public:
XinxPluginsLoader * _loader;
QMultiHash<QString,IFileTypePluginPtr> _filetypes;
QMultiHash<QString,QString> _highlighter;
QHash<QString,XinxFormatScheme*> _formatschemes;
QStringList _documents_schemes;
};
/* FileTypePool */
FileTypePool::FileTypePool() : d(new PrivateFileTypePool)
FileTypePool::FileTypePool(XinxPluginsLoader * loader) : d(new PrivateFileTypePool)
{
updateFileTypes();
d->_loader = loader;
connect(XinxPluginsLoader::self(), SIGNAL(pluginActivated(QString)), this, SLOT(activatePlugin(QString)));
connect(XinxPluginsLoader::self(), SIGNAL(pluginDesactivated(QString)), this, SLOT(desactivatePlugin(QString)));
connect(d->_loader, SIGNAL(pluginActivated(QString)), this, SLOT(activatePlugin(QString)));
connect(d->_loader, SIGNAL(pluginDesactivated(QString)), this, SLOT(desactivatePlugin(QString)));
}
FileTypePool::~FileTypePool()
@ -56,7 +59,7 @@ void FileTypePool::updateFileTypes() @@ -56,7 +59,7 @@ void FileTypePool::updateFileTypes()
{
d->_filetypes.clear();
foreach(XinxPluginElement * element, XinxPluginsLoader::self()->plugins())
foreach(XinxPluginElement * element, d->_loader->plugins())
{
activatePlugin(element->plugin()->metaObject()->className());
}
@ -158,7 +161,8 @@ XinxFormatScheme* FileTypePool::scheme(const QString & highlighter) const @@ -158,7 +161,8 @@ XinxFormatScheme* FileTypePool::scheme(const QString & highlighter) const
void FileTypePool::activatePlugin(const QString& name)
{
XinxPluginElement* element = XinxPluginsLoader::self()->plugin(name);
XinxPluginElement* element = d->_loader->plugin(name);
Q_ASSERT_X(element, "FileTypePool::activatePlugin", qPrintable(QString("The plugin %1 doesn't exist.").arg(name)));
IFilePlugin * interface = qobject_cast<IFilePlugin*>(element->plugin());
if (element->isActivated() && interface)
@ -173,7 +177,7 @@ void FileTypePool::activatePlugin(const QString& name) @@ -173,7 +177,7 @@ void FileTypePool::activatePlugin(const QString& name)
if (textPlugin)
{
// Format
XinxFormatScheme* scheme(textPlugin->createFormatScheme(XINXConfig::self()));
XinxFormatScheme* scheme = textPlugin->createFormatScheme(XINXConfig::self());
if (scheme)
{
XINXConfig::self()->addFormatScheme(textPlugin->highlighterId(), scheme);
@ -181,13 +185,18 @@ void FileTypePool::activatePlugin(const QString& name) @@ -181,13 +185,18 @@ void FileTypePool::activatePlugin(const QString& name)
d->_highlighter.insert(textPlugin->name(), textPlugin->highlighterId());
d->_formatschemes.insert(textPlugin->highlighterId(), scheme);
// Language
QDomDocument doc;
QLanguageFactory::LangData data;
doc.setContent(textPlugin->createLanguageDescription());
// Can't unload is it a problem ?
QNFADefinition::load(doc, &data, scheme);
XINXConfig::self()->languageFactory()->addLanguage(data);
if (! d->_documents_schemes.contains(textPlugin->highlighterId()))
{
d->_documents_schemes.append(textPlugin->highlighterId());
// Language
QDomDocument doc;
QLanguageFactory::LangData data;
doc.setContent(textPlugin->createLanguageDescription());
// Can't unload is it a problem ?
QNFADefinition::load(doc, &data, scheme);
XINXConfig::self()->languageFactory()->addLanguage(data);
}
}
}
}

9
framework/editors/filetypepool.h

@ -33,14 +33,16 @@ class XINXConfig; @@ -33,14 +33,16 @@ class XINXConfig;
class PrivateFileTypePool;
class IFileTypePlugin;
class XinxFormatScheme;
class XinxPluginsLoader;
typedef QSharedPointer<IFileTypePlugin> IFileTypePluginPtr;
typedef QSharedPointer<IFileTextPlugin> IFileTextPluginPtr;
class LIBEXPORT FileTypePool : public XinxLibSingleton<FileTypePool>
class LIBEXPORT FileTypePool : public QObject
{
Q_OBJECT
public:
FileTypePool(XinxPluginsLoader * loader);
virtual ~FileTypePool();
/*! Return all the file type knew by XINX. */
@ -68,12 +70,7 @@ private slots: @@ -68,12 +70,7 @@ private slots:
void activatePlugin(const QString & name);
void desactivatePlugin(const QString & name);
private:
Q_DISABLE_COPY(FileTypePool)
FileTypePool();
QString allManagedFileFilter() const;
friend class XinxLibSingleton<FileTypePool>;
QScopedPointer<PrivateFileTypePool> d;
};

4
framework/editors/filetypeselector.cpp

@ -63,12 +63,12 @@ bool FileTypeSelector::isShowFileName() const @@ -63,12 +63,12 @@ bool FileTypeSelector::isShowFileName() const
void FileTypeSelector::setFileName(const QString & filename)
{
_file_name_label->setText(QFileInfo(filename).fileName());
QList<IFileTypePluginPtr> interfaces = FileTypePool::self()->matchedFileType(filename);
QList<IFileTypePluginPtr> interfaces = XinxPluginsLoader::self()->fileTypePool()->matchedFileType(filename);
_show_all->setVisible(interfaces.size());
if (! interfaces.size() || _show_all->isChecked())
{
setFileTypes(FileTypePool::self()->fileTypes());
setFileTypes(XinxPluginsLoader::self()->fileTypePool()->fileTypes());
}
else
{

2
framework/editors/textfileeditor.cpp

@ -593,7 +593,7 @@ void TextFileEditor::updateContext() @@ -593,7 +593,7 @@ void TextFileEditor::updateContext()
{
_move_timer->stop();
_context.setFilename(lastFileName());
CodeCompletion::Pool::self()->updateContext(this, _context);
XinxPluginsLoader::self()->codeCompletionPool()->updateContext(this, _context);
}
/*!

6
framework/editors/xinxformatscheme.cpp

@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
/* XinxFormatScheme */
XinxFormatScheme::XinxFormatScheme(XINXConfig * parent) : QFormatScheme(parent), m_config(parent)
XinxFormatScheme::XinxFormatScheme(XINXConfig * parent) : m_config(parent)
{
createStandardFormat();
}
@ -122,6 +122,7 @@ void XinxFormatScheme::putFormatsToConfig() @@ -122,6 +122,7 @@ void XinxFormatScheme::putFormatsToConfig()
void XinxFormatScheme::setNameSpace(const QString & value)
{
setObjectName(value);
m_nameSpace = value;
}
@ -132,7 +133,8 @@ const QString & XinxFormatScheme::nameSpace() const @@ -132,7 +133,8 @@ const QString & XinxFormatScheme::nameSpace() const
XinxFormatScheme& XinxFormatScheme::operator=(const XinxFormatScheme& p)
{
this->m_nameSpace = m_nameSpace;
setObjectName(p.m_nameSpace);
this->m_nameSpace = p.m_nameSpace;
foreach(const QString & f, p.formats())
{
this->setFormat(f, p.format(f));

46
framework/plugins/xinxpluginsloader.cpp

@ -314,8 +314,10 @@ static bool pluginsLessThan(XinxPluginElement * s1, XinxPluginElement * s2) @@ -314,8 +314,10 @@ static bool pluginsLessThan(XinxPluginElement * s1, XinxPluginElement * s2)
XinxPluginsLoader::XinxPluginsLoader()
{
connect(XINXConfig::self(), SIGNAL(pluginActivated(QString)), this, SIGNAL(pluginActivated(QString)));
connect(XINXConfig::self(), SIGNAL(pluginDesactivated(QString)), this, SIGNAL(pluginDesactivated(QString)));
_codeCompletionPool.reset(new CodeCompletion::Pool(this));
_fileTypePool.reset(new FileTypePool(this));
connect(XINXConfig::self(), SIGNAL(changed()), this, SLOT(updateActivatedPlugin()));
}
XinxPluginsLoader::~XinxPluginsLoader()
@ -323,6 +325,16 @@ XinxPluginsLoader::~XinxPluginsLoader() @@ -323,6 +325,16 @@ XinxPluginsLoader::~XinxPluginsLoader()
qDeleteAll(plugins());
}
CodeCompletion::Pool * XinxPluginsLoader::codeCompletionPool() const
{
return _codeCompletionPool.data();
}
FileTypePool * XinxPluginsLoader::fileTypePool() const
{
return _fileTypePool.data();
}
QList<XinxPluginElement*> XinxPluginsLoader::plugins() const
{
QList<XinxPluginElement*> result = m_plugins.values();
@ -364,6 +376,30 @@ void XinxPluginsLoader::addPlugin(QObject * plugin, bool staticLoaded) @@ -364,6 +376,30 @@ void XinxPluginsLoader::addPlugin(QObject * plugin, bool staticLoaded)
XINXConfig::self()->addDefaultTool(tools.first, tools.second);
}
void XinxPluginsLoader::updateActivatedPlugin()
{
/* Update activated list of plugin */
QListIterator<XinxPluginElement*> it(plugins());
while (it.hasNext())
{
XinxPluginElement * element = it.next();
const QString key = element->plugin()->metaObject()->className();
const bool activated = element->isActivated();
if (activated && ! _activatedPlugin.contains(key))
{
_activatedPlugin.append(key);
emit pluginActivated(key);
}
else if (! activated && _activatedPlugin.contains(key))
{
_activatedPlugin.removeAll(key);
emit pluginDesactivated(key);
}
}
}
void XinxPluginsLoader::loadPlugins()
{
foreach(QObject * plugin, QPluginLoader::staticInstances())
@ -385,6 +421,12 @@ void XinxPluginsLoader::loadPlugins() @@ -385,6 +421,12 @@ void XinxPluginsLoader::loadPlugins()
qDebug() << loader.errorString();
}
}
updateActivatedPlugin();
/*
_fileTypePool->updateFileTypes();
_codeCompletionPool->updateParsers();
*/
}

13
framework/plugins/xinxpluginsloader.h

@ -25,6 +25,8 @@ @@ -25,6 +25,8 @@
#include <core/lib-config.h>
#include <core/xinxcore.h>
#include <core/xinxsingleton.h>
#include <editors/filetypepool.h>
#include <codecompletion/pool.h>
// Qt header
#include <QHash>
@ -54,14 +56,25 @@ public: @@ -54,14 +56,25 @@ public:
QList<XinxPluginElement*> plugins() const;
/*! Plugin of name \e name. */
XinxPluginElement * plugin(const QString & name);
/// Pool de code completion
CodeCompletion::Pool * codeCompletionPool() const;
/// Pool de file type
FileTypePool * fileTypePool() const;
signals:
void pluginActivated(const QString & name);
void pluginDesactivated(const QString & name);
private slots:
//! Update activated plugin
void updateActivatedPlugin();
private:
XinxPluginsLoader();
void addPlugin(QObject * plugin, bool staticLoaded = false);
QStringList _activatedPlugin;
QScopedPointer<CodeCompletion::Pool> _codeCompletionPool;
QScopedPointer<FileTypePool> _fileTypePool;
QMap<QString, XinxPluginElement*> m_plugins;
friend class XinxLibSingleton<XinxPluginsLoader>;
};

2
framework/project/iconprojectprovider.cpp

@ -35,7 +35,7 @@ IconProjectProvider::~IconProjectProvider() @@ -35,7 +35,7 @@ IconProjectProvider::~IconProjectProvider()
QIcon IconProjectProvider::icon(const QFileInfo & info) const
{
QList<IFileTypePluginPtr> plugin = FileTypePool::self()->matchedFileType(info.fileName());
QList<IFileTypePluginPtr> plugin = XinxPluginsLoader::self()->fileTypePool()->matchedFileType(info.fileName());
if (plugin.size() > 0)
{
QIcon icon = QIcon(plugin.at(0)->icon());

4
framework/project/projectlistmodel.cpp

@ -42,7 +42,7 @@ bool caseInsensitiveLessThan(const QString &s1, const QString &s2) @@ -42,7 +42,7 @@ bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
DirectoryFetcher::DirectoryFetcher() : _retrieveRcsInfos(true)
{
setPriority(-100);
_matchedFileList = FileTypePool::self()->managedFilters();
_matchedFileList = XinxPluginsLoader::self()->fileTypePool()->managedFilters();
}
DirectoryFetcher::~DirectoryFetcher()
@ -664,7 +664,7 @@ void PrivateProjectListModel::_updateFiles(const QString & directory, QList<RCS: @@ -664,7 +664,7 @@ void PrivateProjectListModel::_updateFiles(const QString & directory, QList<RCS:
// In this case the file exist in Version Control but not in the project list.
// We add it if the file match managed file;
QStringList managed_files = FileTypePool::self()->managedFilters();
QStringList managed_files = XinxPluginsLoader::self()->fileTypePool()->managedFilters();
foreach(const QString & filetype, managed_files)
{
QRegExp expr(filetype, Qt::CaseSensitive, QRegExp::WildcardUnix);

2
framework/project/projectpropertyimpl.cpp

@ -130,7 +130,7 @@ void ProjectPropertyImpl::loadFromProject(XinxProject::ProjectPtr project) @@ -130,7 +130,7 @@ void ProjectPropertyImpl::loadFromProject(XinxProject::ProjectPtr project)
foreach(QString filename, project->cache()->cachedFiles())
{
QList<IFileTypePluginPtr> fileTypes = FileTypePool::self()->matchedFileType(filename);
QList<IFileTypePluginPtr> fileTypes = XinxPluginsLoader::self()->fileTypePool()->matchedFileType(filename);
QString fn = QDir(project->projectPath()).relativeFilePath(filename);
if (fileTypes.size())
new QListWidgetItem(QIcon(fileTypes.at(0)->icon()), fn, m_preloadedFiles);

2
framework/search/replacedialogimpl.cpp

@ -72,7 +72,7 @@ void ReplaceDialogImpl::initialize(bool hasEditor) @@ -72,7 +72,7 @@ void ReplaceDialogImpl::initialize(bool hasEditor)
m_directoryWidget->lineEdit()->setText(QString());
}
QStringList filters = FileTypePool::self()->managedFilters();
QStringList filters = XinxPluginsLoader::self()->fileTypePool()->managedFilters();
filters.removeDuplicates ();
m_comboExt->clear ();
m_comboExt->addItems(filters);

4
framework/snipets/snipetpropertydlgimpl.cpp

@ -190,9 +190,9 @@ void SnipetPropertyDlgImpl::setupUi() @@ -190,9 +190,9 @@ void SnipetPropertyDlgImpl::setupUi()
}
// Extentions
foreach(IFileTypePluginPtr fileType, FileTypePool::self()->fileTypes())
foreach(IFileTypePluginPtr fileType, XinxPluginsLoader::self()->fileTypePool()->fileTypes())
{
QListWidgetItem * item = new QListWidgetItem(FileTypePool::self()->fileTypeFilter(fileType), m_extentionListWidget);
QListWidgetItem * item = new QListWidgetItem(XinxPluginsLoader::self()->fileTypePool()->fileTypeFilter(fileType), m_extentionListWidget);
item->setData(Qt::UserRole, fileType->match());
}

2
plugins/core/editors/models/xsl/importitemmodelfactory.cpp

@ -67,7 +67,7 @@ void ImportItemModelFactory::addNode(const QString & path) @@ -67,7 +67,7 @@ void ImportItemModelFactory::addNode(const QString & path)
qDebug() << pathPart;
qDebug() << filePart;
QDirIterator iterator(pathPart, FileTypePool::self()->managedFilters(), QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Files);
QDirIterator iterator(pathPart, XinxPluginsLoader::self()->fileTypePool()->managedFilters(), QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Files);
while (iterator.hasNext())
{
iterator.next();

2
plugins/core/editors/models/xsl/stylesheet_importnode.cpp

@ -56,7 +56,7 @@ void ImportNode::setName(const QString& name) @@ -56,7 +56,7 @@ void ImportNode::setName(const QString& name)
{
ContentView3::Node::setName(name);
QList<IFileTypePluginPtr> fileTypes = FileTypePool::self()->matchedFileType(name);
QList<IFileTypePluginPtr> fileTypes = XinxPluginsLoader::self()->fileTypePool()->matchedFileType(name);
if (fileTypes.size() > 0)
{
setIcon(fileTypes.at(0)->icon());

2
plugins/core/editors/models/xsl/stylesheet_parser.cpp

@ -262,7 +262,7 @@ void Parser::readTemplate(ContentView3::NodePtr & n) @@ -262,7 +262,7 @@ void Parser::readTemplate(ContentView3::NodePtr & n)
import->setType("internal");
import->setTips(tr("Element at line : %1").arg(line));
QList<IFileTypePluginPtr> ft = FileTypePool::self()->matchedFileType(s.src);
QList<IFileTypePluginPtr> ft = XinxPluginsLoader::self()->fileTypePool()->matchedFileType(s.src);
QScopedPointer<ContentView3::Parser> parser(ContentView3::ParserFactory::getParserByFilename(s.src));
if (ft.size() && parser)
{

2
plugins/cvsplugin/rcs_cvs.cpp

@ -135,7 +135,7 @@ RCS::FilesOperation RCS_CVS::operationOf(const QString & path) @@ -135,7 +135,7 @@ RCS::FilesOperation RCS_CVS::operationOf(const QString & path)
{
RCS::FilesOperation operations;
QStringList files = QDir(path).entryList(FileTypePool::self()->managedFilters(), QDir::Files);
QStringList files = QDir(path).entryList(XinxPluginsLoader::self()->fileTypePool()->managedFilters(), QDir::Files);
foreach(const QString & filename, files)
{
QString filepath = QDir(path).absoluteFilePath(filename);

2
plugins/svnpluginwrapper/rcs_svn.cpp

@ -182,7 +182,7 @@ RCS::FilesOperation RCS_SVN::operations(const QString & path) @@ -182,7 +182,7 @@ RCS::FilesOperation RCS_SVN::operations(const QString & path)
if (pr.isEmpty()) continue;
QString filename = QDir(path).absoluteFilePath(pr.mid(7).trimmed());
bool hasWilcard = false;
foreach(const QString & wilcard, FileTypePool::self()->managedFilters())
foreach(const QString & wilcard, XinxPluginsLoader::self()->fileTypePool()->managedFilters())
{
QRegExp projectWilcard(wilcard, Qt::CaseInsensitive, QRegExp::Wildcard);
if (projectWilcard.exactMatch(filename))

1
xinx/main.cpp

@ -209,6 +209,7 @@ int main(int argc, char *argv[]) @@ -209,6 +209,7 @@ int main(int argc, char *argv[])
app.processEvents();
XinxPluginsLoader::self()->loadPlugins();
// Load main window
splash.showMessage(QApplication::translate("SplashScreen", "Load main window ..."));
app.processEvents();
app.attachMainWindow(mainWin = new MainformImpl());

Loading…
Cancel
Save