Browse Source

La gestion de la mémoire des projets est maintenant délégué.

master
Ulrich Van Den Hekke 12 years ago
parent
commit
14c9192fc8
  1. 11
      framework/application/mainformimpl.cpp
  2. 3
      framework/application/welcomdlgimpl.cpp
  3. 6
      framework/contentview3/cache.cpp
  4. 2
      framework/contentview3/cache.h
  5. 2
      framework/contentview3/dockwidget.cpp
  6. 8
      framework/contentview3/dockwidget.h
  7. 22
      framework/contentview3/file.cpp
  8. 14
      framework/contentview3/file.h
  9. 2
      framework/contentview3/parser.cpp
  10. 4
      framework/contentview3/treemodel.cpp
  11. 2
      framework/contentview3/treemodel_p.h
  12. 21
      framework/editors/abstracteditor.cpp
  13. 9
      framework/editors/abstracteditor.h
  14. 4
      framework/editors/editorfactory.cpp
  15. 9
      framework/editors/editorfactory.h
  16. 8
      framework/editors/editormanager.cpp
  17. 11
      framework/editors/editormanager.h
  18. 9
      framework/editors/newfilewizardimpl.cpp
  19. 12
      framework/editors/newfilewizardimpl.h
  20. 4
      framework/editors/textfileeditor.cpp
  21. 2
      framework/editors/textfileeditor.h
  22. 7
      framework/plugins/interfaces/files.h
  23. 7
      framework/plugins/interfaces/gui.h
  24. 10
      framework/plugins/interfaces/resolver.h
  25. 7
      framework/project/externalfileresolver.cpp
  26. 9
      framework/project/externalfileresolver.h
  27. 12
      framework/project/newprojectwizard.cpp
  28. 15
      framework/project/newprojectwizard.h
  29. 18
      framework/project/projectdirectorywidgetimpl.cpp
  30. 7
      framework/project/projectdirectorywidgetimpl.h
  31. 53
      framework/project/projectlistmodel.cpp
  32. 6
      framework/project/projectlistmodel.h
  33. 22
      framework/project/projectlistmodel_p.h
  34. 4
      framework/project/projectpropertyimpl.cpp
  35. 10
      framework/project/projectpropertyimpl.h
  36. 2
      framework/project/templatedialogimpl.cpp
  37. 2
      framework/project/templatedialogimpl.h
  38. 89
      framework/project/xinxprojectmanager.cpp
  39. 28
      framework/project/xinxprojectmanager.h
  40. 8
      framework/project/xinxprojectmanager_p.h
  41. 70
      framework/project/xinxprojectproject.cpp
  42. 23
      framework/project/xinxprojectproject.h
  43. 12
      framework/search/replacedialogimpl.cpp
  44. 13
      framework/session/sessioneditor.cpp
  45. 9
      framework/session/sessioneditor.h
  46. 2
      framework/utils/xsltparser.cpp
  47. 8
      framework/versioncontrol/commitmessagedialogimpl.cpp
  48. 4
      framework/versioncontrol/commitmessagedialogimpl.h
  49. 13
      framework/versioncontrol/rcsproxy.cpp
  50. 4
      framework/versioncontrol/rcsproxy.h
  51. 10
      framework/versioncontrol/versioncontrolmanager.cpp
  52. 5
      framework/versioncontrol/versioncontrolmanager.h
  53. 10
      plugins/core/docks/datastream/xmlpresentationdockthread.cpp
  54. 2
      plugins/core/editors/models/xsl/itemmodelfactory.cpp
  55. 4
      plugins/core/pluginproperty/parserprojectpropertyimpl.cpp
  56. 6
      plugins/core/pluginproperty/parserprojectpropertyimpl.h
  57. 2
      plugins/core/pluginproperty/searchpathlistprjpageform.cpp
  58. 4
      plugins/core/pluginproperty/searchpathlistprjpageform.h
  59. 4
      plugins/core/pluginresolver/manualfileresolver.cpp
  60. 4
      plugins/core/pluginresolver/manualfileresolver.h
  61. 16
      plugins/generix/configuration/configurationmanager.cpp
  62. 6
      plugins/generix/configuration/configurationmanager.h
  63. 3
      plugins/generix/configuration/gceconfigurationparser.cpp
  64. 17
      plugins/generix/configuration/gcepropertiesparser.cpp
  65. 24
      plugins/generix/docks/dictionary/dictionarymodel.cpp
  66. 4
      plugins/generix/docks/dictionary/dictionarymodel.h
  67. 2
      plugins/generix/docks/dictionary/itemmodelfactory.cpp
  68. 47
      plugins/generix/docks/project/generixprojectdock.cpp
  69. 4
      plugins/generix/docks/project/generixprojectdock.h
  70. 14
      plugins/generix/plugindefinition/generix.cpp
  71. 4
      plugins/generix/plugindefinition/generix.h
  72. 4
      plugins/generix/pluginresolver/gce150fileresolver.cpp
  73. 2
      plugins/generix/pluginresolver/gce150fileresolver.h
  74. 6
      plugins/generix/projectproperty/std/generixderivationoptionspage.cpp
  75. 4
      plugins/generix/projectproperty/std/generixderivationoptionspage.h
  76. 8
      plugins/generix/projectproperty/std/generixderivationpage.cpp
  77. 4
      plugins/generix/projectproperty/std/generixderivationpage.h
  78. 2
      plugins/generix/projectproperty/std/generixprojectpageform.cpp
  79. 4
      plugins/generix/projectproperty/std/generixprojectpageform.h
  80. 2
      plugins/generix/projectproperty/wizard/newgenerixderivation1page.cpp
  81. 2
      plugins/generix/projectproperty/wizard/newgenerixderivation1page.h
  82. 6
      plugins/generix/projectproperty/wizard/newgenerixderivation2page.cpp
  83. 2
      plugins/generix/projectproperty/wizard/newgenerixderivation2page.h
  84. 10
      plugins/generix/projectproperty/wizard/newgenerixderivation3page.cpp
  85. 2
      plugins/generix/projectproperty/wizard/newgenerixderivation3page.h
  86. 2
      plugins/generix/projectproperty/wizard/newgenerixinformationpageimpl.cpp
  87. 2
      plugins/generix/projectproperty/wizard/newgenerixinformationpageimpl.h
  88. 10
      plugins/generix/savedialog/derivationdialogimpl.cpp
  89. 6
      plugins/generix/savedialog/derivationdialogimpl.h
  90. 8
      plugins/services/servicesplugin.cpp
  91. 4
      plugins/services/servicesplugin.h
  92. 2
      plugins/services/servicesprojectpropertyimpl.cpp
  93. 4
      plugins/services/servicesprojectpropertyimpl.h
  94. 2
      plugins/services/servicesprojectwizard.cpp
  95. 2
      plugins/services/servicesprojectwizard.h
  96. 28
      plugins/services/webservices.cpp
  97. 8
      plugins/services/webservices.h
  98. 2
      plugins/services/webservicesaction.cpp
  99. 4
      plugins/services/webserviceseditor.cpp
  100. 2
      plugins/services/webserviceseditor.h

11
framework/application/mainformimpl.cpp

@ -387,7 +387,7 @@ void MainformImpl::createDockWidget()
QAction * action = view->toggleViewAction();
action->setShortcut(QKeySequence("Alt+1"));
m_menus["windows"]->addAction(action);
connect(m_projectDock, SIGNAL(open(QString,IFileTypePlugin*,XinxProject::Project*)), EditorManager::self (), SLOT(openFile(QString,IFileTypePlugin*,XinxProject::Project*)));
connect(m_projectDock, SIGNAL(open(QString,IFileTypePlugin*,XinxProject::ProjectPtr)), EditorManager::self (), SLOT(openFile(QString,IFileTypePlugin*,XinxProject::ProjectPtr)));
/* Content */
m_contentDock = new ContentView3::DockWidget(this);
@ -396,7 +396,7 @@ void MainformImpl::createDockWidget()
action = view->toggleViewAction();
action->setShortcut(QKeySequence("Alt+2"));
m_menus["windows"]->addAction(action);
connect(m_contentDock, SIGNAL(open(QString,int,IFileTypePlugin*,XinxProject::Project*)), EditorManager::self (), SLOT(openFile(QString,int,IFileTypePlugin*,XinxProject::Project*)));
connect(m_contentDock, SIGNAL(open(QString,int,IFileTypePlugin*,XinxProject::ProjectPtr)), EditorManager::self (), SLOT(openFile(QString,int,IFileTypePlugin*,XinxProject::ProjectPtr)));
/* Snipets */
m_snipetsDock = new SnipetDockWidget(this);
@ -830,9 +830,12 @@ void MainformImpl::updateTitle()
{
title = "[" + EditorManager::self()->currentEditor()->lastFileName() + "] - " + title;
}
if (XinxProject::Manager::self()->selectedProject())
XinxProject::ProjectPtr selectedProject = XinxProject::Manager::self()->selectedProject().toStrongRef();
if (selectedProject)
{
title = XinxProject::Manager::self()->selectedProject()->projectName() + " - " + title;
title = selectedProject->projectName() + " - " + title;
}
setWindowTitle(title);

3
framework/application/welcomdlgimpl.cpp

@ -96,7 +96,8 @@ void WelcomDialogImpl::addProjectFile(const QString & filename)
{
try
{
m_projectWidget->addItem(XinxProject::Project(filename).projectName(), filename);
XinxProject::ProjectPtr ptr = XinxProject::Project::create(filename);
m_projectWidget->addItem(ptr->projectName(), filename);
}
catch (XinxProject::ProjectException e)
{

6
framework/contentview3/cache.cpp

@ -62,7 +62,7 @@ public:
QHash<QString,CacheInformation> _files;
FilesWatcher * _watcher;
XinxProject::Project * _project;
XinxProject::ProjectPtrWeak _project;
QMutex _cache_mutex;
void importOf(QList< FilePtr > & result, FilePtr file);
@ -95,7 +95,7 @@ void PrivateCache::importOf(QList< ContentView3::FilePtr >& result, ContentView3
/* Cache */
Cache::Cache(XinxProject::Project* project)
Cache::Cache(XinxProject::ProjectPtrWeak project)
{
qRegisterMetaType<ContentView3::FilePtr>("ContentView3::FilePtr");
@ -237,7 +237,7 @@ FilePtr Cache::cachedFile(const QString & filename)
}
else
{
file = File::create (absoluteFilename, d->_project);
file = File::create (absoluteFilename, d->_project.toStrongRef());
}
return file;

2
framework/contentview3/cache.h

@ -59,7 +59,7 @@ public:
PROJECT = 10
};
explicit Cache(XinxProject::Project * project);
explicit Cache(XinxProject::ProjectPtrWeak project);
~Cache();
QStringList cachedFiles() const;

2
framework/contentview3/dockwidget.cpp

@ -58,7 +58,7 @@ void DockWidget::doubleClicked(QModelIndex index)
emit open(index.data (Qt::UserRole + 1).toString (),
index.data (Qt::UserRole + 2).toInt (),
0,
index.data (Qt::UserRole + 3).value<XinxProject::Project*>());
index.data (Qt::UserRole + 3).value<XinxProject::ProjectPtrWeak>().toStrongRef());
}
}

8
framework/contentview3/dockwidget.h

@ -22,16 +22,12 @@
#include <QWidget>
#include <QModelIndex>
#include <project/xinxprojectproject.h>
class QAbstractItemModel;
class QTreeView;
class IFileTypePlugin;
namespace XinxProject
{
class Project;
}
namespace ContentView3 {
class DockWidget : public QWidget
@ -41,7 +37,7 @@ public:
DockWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
virtual ~DockWidget();
signals:
void open(const QString & filename, int line, IFileTypePlugin * interface, XinxProject::Project * project);
void open(const QString & filename, int line, IFileTypePlugin * interface, XinxProject::ProjectPtr project);
private slots:
void showModelOfEditor(int editorIndex);
void doubleClicked(QModelIndex index);

22
framework/contentview3/file.cpp

@ -37,7 +37,7 @@ public:
PrivateFile();
~PrivateFile();
XinxProject::Project * _project;
XinxProject::ProjectPtrWeak _project;
QString _filename;
QStringList _imports;
QList<File::Symbole> _symbols;
@ -57,28 +57,28 @@ PrivateFile::~PrivateFile()
/* File */
FilePtr File::create(XinxProject::Project * project)
FilePtr File::create(XinxProject::ProjectPtr project)
{
FilePtr ptr(new File(project));
ptr->d->_this = ptr.toWeakRef ();
return ptr;
}
File::File(XinxProject::Project* project) : d(new PrivateFile)
File::File(XinxProject::ProjectPtr project) : d(new PrivateFile)
{
d->_project = project;
d->_project = project.toWeakRef();
//qDebug() << "Create the file" << this << "with noname";
}
FilePtr File::create(const QString & filename, XinxProject::Project * project)
FilePtr File::create(const QString & filename, XinxProject::ProjectPtr project)
{
FilePtr ptr(new File(filename, project));
ptr->d->_this = ptr.toWeakRef ();
return ptr;
}
File::File(const QString& filename, XinxProject::Project* project) : d(new PrivateFile)
File::File(const QString& filename, XinxProject::ProjectPtr project) : d(new PrivateFile)
{
d->_filename = filename;
d->_project = project;
@ -101,14 +101,14 @@ const QString & File::filename() const
return d->_filename;
}
void File::setProject(XinxProject::Project* project)
void File::setProject(XinxProject::ProjectPtr project)
{
d->_project = project;
d->_project = project.toWeakRef();
}
XinxProject::Project* File::project() const
XinxProject::ProjectPtr File::project() const
{
return d->_project;
return d->_project.toStrongRef();
}
void File::addImport ( const QString& import )
@ -118,7 +118,7 @@ void File::addImport ( const QString& import )
try
{
d->_imports.append(import);
d->_project->cache()->addFileToCache(import);
d->_project.toStrongRef()->cache()->addFileToCache(import);
}
catch(CacheParserNotFoundException e)
{

14
framework/contentview3/file.h

@ -24,6 +24,7 @@
// Xinx header
#include <core/lib-config.h>
#include <contentview3/definitions.h>
#include <project/xinxprojectproject.h>
// Qt header
#include <QApplication>
@ -31,6 +32,7 @@
namespace XinxProject {
class Project;
typedef QSharedPointer<Project> ProjectPtr;
}
namespace ContentView3
@ -48,15 +50,15 @@ public:
QString type, name;
};
static FilePtr create(XinxProject::Project * project = 0);
static FilePtr create(const QString & filename, XinxProject::Project * project = 0);
static FilePtr create(XinxProject::ProjectPtr project = XinxProject::ProjectPtr());
static FilePtr create(const QString& filename, XinxProject::ProjectPtr project);
~File();
void setFilename(const QString & filename);
const QString & filename() const;
void setProject(XinxProject::Project * project);
XinxProject::Project * project() const;
void setProject(XinxProject::ProjectPtr project);
XinxProject::ProjectPtr project() const;
const QStringList & imports() const;
void clearImports();
@ -69,8 +71,8 @@ public:
void setRootNode(FileNodePtr node);
FileNodePtr rootNode() const;
private:
explicit File(XinxProject::Project * project = 0);
explicit File(const QString & filename, XinxProject::Project * project = 0);
explicit File(XinxProject::ProjectPtr project);
explicit File(const QString& filename, XinxProject::ProjectPtr project);
QScopedPointer<PrivateFile> d;
};

2
framework/contentview3/parser.cpp

@ -292,7 +292,7 @@ void Parser::run()
if (d->_file && d->_file->project ())
{
XinxProject::Project * project = d->_file->project ();
XinxProject::ProjectPtr project = d->_file->project ();
QMetaObject::invokeMethod(project->cache (), "parsed", Qt::QueuedConnection, Q_ARG(ContentView3::FilePtr, d->_file));
}

4
framework/contentview3/treemodel.cpp

@ -22,7 +22,7 @@
namespace ContentView3
{
TreeNode::TreeNode(NodePtr node) : QStandardItem(QIcon(node->icon ()), node->displayName ()), _project(0)
TreeNode::TreeNode(NodePtr node) : QStandardItem(QIcon(node->icon ()), node->displayName ())
{
_is_children_populate = node->type () != "IMPORT";
setEditable (false);
@ -36,7 +36,7 @@ void TreeNode::updateFromNode(NodePtr node)
setToolTip (node->tips ());
_name = node->name ();
_key = node->keyString ();
_project = file->project ();
_project = file->project ().toWeakRef();
if (node->type() != "IMPORT")
{

2
framework/contentview3/treemodel_p.h

@ -38,7 +38,7 @@ public:
virtual QVariant data (int role = Qt::UserRole + 1) const;
bool _is_children_populate;
XinxProject::Project * _project;
XinxProject::ProjectPtrWeak _project;
QString _key;
QString _filename, _name;
int _line;

21
framework/editors/abstracteditor.cpp

@ -138,7 +138,7 @@
* \brief Create an objects of type AbstractEditor.
* \param parent Parent and containers of the editor.
*/
AbstractEditor::AbstractEditor(QWidget* parent): QFrame(parent), _project(0), m_fileTypePlugin(0), m_isSaving(false), m_modified(false), m_neverModified(true)
AbstractEditor::AbstractEditor(QWidget* parent): QFrame(parent), m_fileTypePlugin(0), m_isSaving(false), m_modified(false), m_neverModified(true)
{
initObjects();
}
@ -152,7 +152,7 @@ AbstractEditor::AbstractEditor(QWidget* parent): QFrame(parent), _project(0), m_
*
* \param editor The original editor used for copy.
*/
AbstractEditor::AbstractEditor(const AbstractEditor & editor) : QFrame(qobject_cast<QWidget*>(editor.parent())), m_isSaving(false), m_modified(false), m_neverModified(true)
AbstractEditor::AbstractEditor(const AbstractEditor & editor) : QFrame(qobject_cast<QWidget*>(editor.parent())), m_fileTypePlugin(0), m_isSaving(false), m_modified(false), m_neverModified(true)
{
initObjects();
}
@ -608,10 +608,11 @@ void AbstractEditor::serialize(XinxSession::SessionEditor * data, bool content)
{
Q_UNUSED(content);
const QString projectPath = _project ? _project.toStrongRef()->projectPath () : QString();
data->writeProperty ("ClassName", m_fileTypePlugin->name());
data->writeProperty ("FileName", _project ? QDir(_project->projectPath ()).relativeFilePath (m_lastFileName) : m_lastFileName);
data->writeProperty ("FileName", projectPath.isEmpty() ? m_lastFileName : QDir(_project.toStrongRef()->projectPath ()).relativeFilePath (m_lastFileName));
data->writeProperty ("Modified", QVariant(m_modified));
data->writeProperty ("Project", _project ? _project->projectPath () : QString());
data->writeProperty ("Project", projectPath);
data->writeProperty ("Informations", m_fileTypePlugin ? m_fileTypePlugin->name () : QString());
}
@ -632,12 +633,12 @@ void AbstractEditor::deserialize(XinxSession::SessionEditor * data)
const bool modified = data->readProperty ("Modified").toBool ();
m_fileTypePlugin = EditorFactory::self()->interfaceOfName(file_type_name);
XinxProject::Project * project = XinxProject::Manager::self ()->projectOfPath(project_path);
XinxProject::ProjectPtr project = XinxProject::Manager::self ()->projectOfPath(project_path);
setProject (project);
if (QFileInfo(relative_file_name).isRelative() && !relative_file_name.isEmpty())
m_lastFileName = QDir(_project->projectPath ()).absoluteFilePath(relative_file_name);
m_lastFileName = QDir(project->projectPath ()).absoluteFilePath(relative_file_name);
else
m_lastFileName = relative_file_name;
@ -698,14 +699,14 @@ IFileTypePlugin * AbstractEditor::fileTypePluginInterface() const
return m_fileTypePlugin;
}
void AbstractEditor::setProject(XinxProject::Project * project)
void AbstractEditor::setProject(XinxProject::ProjectPtr project)
{
_project = project;
_project = project.toWeakRef();
}
XinxProject::Project * AbstractEditor::project() const
XinxProject::ProjectPtr AbstractEditor::project() const
{
return _project;
return _project.toStrongRef();
}
void AbstractEditor::fileChanged()

9
framework/editors/abstracteditor.h

@ -43,7 +43,6 @@ class LIBEXPORT AbstractEditor : public QFrame
Q_PROPERTY(QString title READ getTitle STORED false)
Q_PROPERTY(bool isModified READ isModified WRITE setModified)
Q_PROPERTY(QString filename READ lastFileName WRITE setWatcher)
Q_PROPERTY(XinxProject::Project* project READ project)
public:
enum SearchOption
{
@ -93,9 +92,9 @@ public:
virtual void setFileTypePluginInterface(IFileTypePlugin * value);
virtual IFileTypePlugin * fileTypePluginInterface() const;
virtual void setProject(XinxProject::Project * project);
virtual XinxProject::Project * project() const;
virtual void setProject(XinxProject::ProjectPtr project);
virtual XinxProject::ProjectPtr project() const;
public slots :
virtual void initSearch(AbstractEditor::SearchOptions & options) = 0;
virtual bool find(const QString & text, AbstractEditor::SearchOptions options) = 0;
@ -135,7 +134,7 @@ private:
void activateWatcher();
void setWatcher(const QString & path);
XinxProject::Project * _project;
XinxProject::ProjectPtrWeak _project;
IFileTypePlugin * m_fileTypePlugin;
bool m_isSaving, m_modified, m_neverModified;
QPointer<FileWatcher> m_watcher;

4
framework/editors/editorfactory.cpp

@ -69,7 +69,7 @@ AbstractEditor * EditorFactory::createEditor(IFileTypePlugin * interface)
return editor;
}
AbstractEditor * EditorFactory::createEditor(const QString& filename, IFileTypePlugin* interface, XinxProject::Project* project)
AbstractEditor * EditorFactory::createEditor(const QString& filename, IFileTypePlugin* interface, XinxProject::ProjectPtr project)
{
Q_ASSERT(! filename.isEmpty());
@ -89,7 +89,7 @@ AbstractEditor * EditorFactory::createEditor(const QString& filename, IFileTypeP
}
/* If no project is defined we must find one */
if (!project)
if (project.isNull())
{
project = XinxProject::Manager::self ()->projectOfFile(filename);
}

9
framework/editors/editorfactory.h

@ -23,18 +23,15 @@
// Xinx header
#include <core/lib-config.h>
#include <core/xinxsingleton.h>
#include <project/xinxprojectproject.h>
// Qt header
#include <QObject>
#include <QSharedPointer>
class AbstractEditor;
class IFileTypePlugin;
namespace XinxProject
{
class Project;
};
namespace XinxSession
{
class SessionEditor;
@ -47,7 +44,7 @@ public:
virtual ~EditorFactory();
IFileTypePlugin * interfaceOfName(const QString & name);
AbstractEditor * createEditor(const QString & filename, IFileTypePlugin * interface = 0, XinxProject::Project * project = 0);
AbstractEditor * createEditor(const QString & filename, IFileTypePlugin * interface = 0, XinxProject::ProjectPtr project = XinxProject::ProjectPtr());
AbstractEditor * createEditor(XinxSession::SessionEditor * session = 0);
private:
EditorFactory();

8
framework/editors/editormanager.cpp

@ -588,7 +588,7 @@ void EditorManager::openFile ()
d->tabWidget()->setUpdatesEnabled(true);
}
void EditorManager::openFile(const QString& filename, IFileTypePlugin* interface, XinxProject::Project* project)
void EditorManager::openFile(const QString& filename, IFileTypePlugin* interface, XinxProject::ProjectPtr project)
{
Q_ASSERT(! filename.isEmpty());
@ -615,7 +615,7 @@ void EditorManager::openFile(const QString& filename, IFileTypePlugin* interface
setCurrentEditor (openingEditor);
}
void EditorManager::openFile(const QString& filename, int line, IFileTypePlugin* interface, XinxProject::Project* project)
void EditorManager::openFile(const QString& filename, int line, IFileTypePlugin* interface, XinxProject::ProjectPtr project)
{
if (! filename.isEmpty())
{
@ -843,14 +843,14 @@ void EditorManager::closeFile(bool confirm)
closeFile(item, confirm);
}
bool EditorManager::closeAllFile(XinxProject::Project* project)
bool EditorManager::closeAllFile(XinxProject::ProjectPtr project)
{
d->tabWidget()->setUpdatesEnabled(false);
QList<AbstractEditor*> editors;
for (int i = d->tabWidget()->count() - 1; i >= 0; i--)
{
if ((!project) || (editor(i)->project() == project))
if ((!project) || (editor(i)->project().data() == project.data()))
{
editors << editor(i);
}

11
framework/editors/editormanager.h

@ -29,6 +29,7 @@
// Xinx header
#include <core/lib-config.h>
#include <core/xinxsingleton.h>
#include <project/xinxprojectproject.h>
// Qt header
#include <QObject>
@ -39,10 +40,6 @@
class IFileTypePlugin;
class AbstractEditor;
class PrivateEditorManager;
namespace XinxProject
{
class Project;
}
namespace XinxSession
{
@ -91,8 +88,8 @@ public slots:
void changeToPreviousEditor();
void openFile();
void openFile(const QString & filename, IFileTypePlugin * interface = 0, XinxProject::Project * project = 0);
void openFile(const QString & filename, int line, IFileTypePlugin * interface = 0, XinxProject::Project * project = 0);
void openFile(const QString & filename, IFileTypePlugin * interface = 0, XinxProject::ProjectPtr project = XinxProject::ProjectPtr());
void openFile(const QString & filename, int line, IFileTypePlugin * interface = 0, XinxProject::ProjectPtr project = XinxProject::ProjectPtr());
void saveFile(bool saveAs = false);
void saveFile(int index, bool saveAs = false);
void saveFile(AbstractEditor * editor, bool saveAs = false);
@ -109,7 +106,7 @@ public slots:
void closeFile(int index, bool confirm = true);
void closeFile(AbstractEditor * editor, bool confirm = true);
void closeFile(bool confirm = true);
bool closeAllFile(XinxProject::Project * project = 0);
bool closeAllFile(XinxProject::ProjectPtr project = XinxProject::ProjectPtr());
void copyFileNameToClipboard();
void copyPathToClipboard();

9
framework/editors/newfilewizardimpl.cpp

@ -60,9 +60,10 @@ void NewFileWizardImpl::setFileName(const QString& value)
{
if (path().isEmpty())
{
if (XinxProject::Manager::self()->selectedProject())
XinxProject::ProjectPtr selectedProject = XinxProject::Manager::self()->selectedProject().toStrongRef();
if (selectedProject)
{
filename = QDir(XinxProject::Manager::self()->selectedProject()->projectPath()).absoluteFilePath(tr("noname.txt"));
filename = QDir(selectedProject->projectPath()).absoluteFilePath(tr("noname.txt"));
}
else
{
@ -117,12 +118,12 @@ IFileTypePlugin * NewFileWizardImpl::selectedType() const
return _interface ? _interface : _file_type_selector->selectedType();
}
void NewFileWizardImpl::setProject(XinxProject::Project * project)
void NewFileWizardImpl::setProject(XinxProject::ProjectPtr project)
{
_project = project;
}
XinxProject::Project * NewFileWizardImpl::project() const
XinxProject::ProjectPtr NewFileWizardImpl::project() const
{
return _project ? _project : XinxProject::Manager::self()->projectOfFile(filename());
}

12
framework/editors/newfilewizardimpl.h

@ -22,11 +22,7 @@
#include "ui_newfilewizard.h"
#include <QWizard>
namespace XinxProject
{
class Project;
}
#include <project/xinxprojectproject.h>
/*!
* \internal
@ -44,8 +40,8 @@ public:
void setFileName(const QString & value);
QString filename() const;
void setProject(XinxProject::Project * project);
XinxProject::Project * project() const;
void setProject(XinxProject::ProjectPtr project);
XinxProject::ProjectPtr project() const;
void setSelectedType(IFileTypePlugin * plugin);
IFileTypePlugin * selectedType() const;
@ -55,7 +51,7 @@ protected:
private slots:
void slotTextChanged (const QString & text);
private:
XinxProject::Project * _project;
XinxProject::ProjectPtr _project;
IFileTypePlugin * _interface;
};

4
framework/editors/textfileeditor.cpp

@ -196,9 +196,9 @@ void TextFileEditor::initObjects()
setFile(ContentView3::File::create ());
}
void TextFileEditor::setProject(XinxProject::Project* project)
void TextFileEditor::setProject(XinxProject::ProjectPtr project)
{
if (AbstractEditor::project() != project)
if (AbstractEditor::project().data() != project.data())
{
AbstractEditor::setProject(project);
_file->setProject(project);

2
framework/editors/textfileeditor.h

@ -100,7 +100,7 @@ public:
virtual BookmarkEditorInterface * bookmarkInterface();
virtual BookmarkTextEditorInterface * bookmarkTextInterface();
virtual void setProject(XinxProject::Project * project);
virtual void setProject(XinxProject::ProjectPtr project);
public slots :
virtual void initSearch(SearchOptions & options);
virtual bool find(const QString & text, SearchOptions options);

7
framework/plugins/interfaces/files.h

@ -25,10 +25,13 @@
#include <QtPlugin>
#include <QMetaType>
#include <QStringList>
#include <QSharedPointer>
namespace XinxProject
{
class Project;
typedef QSharedPointer<Project> ProjectPtr;
}
namespace ContentView3
{
@ -139,9 +142,9 @@ public:
virtual ~IXinxInputOutputPlugin() {}
//! List of step of initialisation of XINX project
virtual QList<IProjectInitialisationStep*> loadProjectStep(XinxProject::Project * project) = 0;
virtual QList<IProjectInitialisationStep*> loadProjectStep(XinxProject::ProjectPtr project) = 0;
//! List of step of deinitialisation of XINX project
virtual QList<IProjectInitialisationStep*> closeProjectStep(XinxProject::Project * project) = 0;
virtual QList<IProjectInitialisationStep*> closeProjectStep(XinxProject::ProjectPtr project) = 0;
//! Call when a file is loaded
virtual QIODevice * loadFile(AbstractEditor * editor, const QString & filename) = 0;

7
framework/plugins/interfaces/gui.h

@ -23,10 +23,13 @@
#include <QWizardPage>
#include <QtPlugin>
#include <QSharedPointer>
namespace XinxProject
{
class Project;
typedef QSharedPointer<Project> ProjectPtr;
}
/*!
@ -66,7 +69,7 @@ public:
virtual ~IXinxPluginProjectConfigurationPage() {}
//! Set the project to use in the dialog to load and save settings.
virtual void setProject(XinxProject::Project * project) = 0;
virtual void setProject(XinxProject::ProjectPtr project) = 0;
};
/*!
@ -80,7 +83,7 @@ public:
//! Return true if this page can be the next page
virtual bool pageIsVisible() const = 0;
//! Save the wizard settings page in the project
virtual bool saveSettingsDialog(XinxProject::Project * project) = 0;
virtual bool saveSettingsDialog(XinxProject::ProjectPtr project) = 0;
private:
};

10
framework/plugins/interfaces/resolver.h

@ -21,14 +21,12 @@
#ifndef _RESOLVER_INTERFACES_H_
#define _RESOLVER_INTERFACES_H_
// Xinx header
#include <project/xinxprojectproject.h>
// Qt Plugin
#include <QtPlugin>
namespace XinxProject
{
class Project;
}
/*!
* Define a filename resolver object used to find the import, and find file in parsing of stylesheet
*/
@ -43,7 +41,7 @@ public:
//! Resolver id
virtual QString id() = 0;
//! Resolve the file \e nameToResolve. The \e currentPath, can be used to find the file relatively of the current open editor.
virtual bool resolveFileName(const QString & nameToResolve, QString & resolvedName, const QString & currentPath = QString(), XinxProject::Project * project = 0) = 0;
virtual bool resolveFileName(const QString & nameToResolve, QString & resolvedName, const QString & currentPath = QString(), XinxProject::ProjectPtr project = XinxProject::ProjectPtr()) = 0;
};
/*!

7
framework/project/externalfileresolver.cpp

@ -23,6 +23,7 @@
#include "plugins/xinxpluginsloader.h"
#include <plugins/xinxpluginelement.h>
#include <plugins/interfaces/resolver.h>
#include <project/xinxprojectproject.h>
// Qt header
#include <QDir>
@ -30,7 +31,7 @@
/* ExternalFileResolver */
ExternalFileResolver::ExternalFileResolver(XinxProject::Project * project) : _project(project)
ExternalFileResolver::ExternalFileResolver(XinxProject::ProjectPtrWeak project) : _project(project)
{
}
@ -92,6 +93,8 @@ IFileResolverPlugin * ExternalFileResolver::externalFileResover(const QString &
QString ExternalFileResolver::resolveFileName(const QString & nameToResolve, const QString & currentPath)
{
XinxProject::ProjectPtr project = _project.toStrongRef();
QString resolvedName = m_externalFileResolverCache.value(qMakePair(nameToResolve,currentPath));
if (! resolvedName.isEmpty() && QFile::exists(resolvedName))
return resolvedName;
@ -104,7 +107,7 @@ QString ExternalFileResolver::resolveFileName(const QString & nameToResolve, con
foreach(IFileResolverPlugin * resolver, resolverPlugin->fileResolvers())
{
resolvedName = nameToResolve;
bool hasResolve = resolver->resolveFileName(nameToResolve, resolvedName, currentPath, _project);
bool hasResolve = resolver->resolveFileName(nameToResolve, resolvedName, currentPath, project);
if (hasResolve && QFile::exists(resolvedName))
{
m_externalFileResolverCache.insert(qMakePair(nameToResolve, currentPath), resolvedName);

9
framework/project/externalfileresolver.h

@ -27,12 +27,15 @@
// Qt header
#include <QObject>
#include <QHash>
#include <QSharedPointer>
class IFileResolverPlugin;
namespace XinxProject
{
class Project;
typedef QSharedPointer<Project> ProjectPtr;
typedef QWeakPointer<Project> ProjectPtrWeak;
}
/* ExternalFileResolver */
@ -41,7 +44,7 @@ class LIBEXPORT ExternalFileResolver : public QObject
{
Q_OBJECT
public:
explicit ExternalFileResolver(XinxProject::Project * project);
explicit ExternalFileResolver(XinxProject::ProjectPtrWeak project);
virtual ~ExternalFileResolver();
QStringList externalFileResoverIds() const;
@ -53,8 +56,8 @@ public slots:
void clearCache();
private:
QHash< QPair<QString,QString> ,QString> m_externalFileResolverCache;
XinxProject::Project * _project;
XinxProject::ProjectPtrWeak _project;
};
#endif // EXTERNALFILERESOLVER_H

12
framework/project/newprojectwizard.cpp

@ -36,7 +36,7 @@
/* NewProjectWizard */
#include <versioncontrol/versioncontrolmanager.h>
NewProjectWizard::NewProjectWizard(QWidget * widget, Qt::WFlags f) : QWizard(widget, f), m_project(0)
NewProjectWizard::NewProjectWizard(QWidget * widget, Qt::WFlags f) : QWizard(widget, f)
{
m_templateDialog = new TemplateDialogImpl;
m_projectPage = new ProjectPageImpl;
@ -84,13 +84,13 @@ NewProjectWizard::NewProjectWizard(QWidget * widget, Qt::WFlags f) : QWizard(wid
adjustSize();
}
XinxProject::Project * NewProjectWizard::createProject()
XinxProject::ProjectPtr NewProjectWizard::createProject()
{
if (! m_project)
{
const QString projectPath = QDir::fromNativeSeparators(field("project.path").toString());
m_project = new XinxProject::Project(projectPath, true);
m_project = XinxProject::Project::create(projectPath, true);
m_project->setActivatedPlugin(m_plugins);
NewProjectTemplate * templateProject = m_templateDialog->currentTemplate();
@ -184,7 +184,7 @@ bool ProjectPageImpl::pageIsVisible() const
return true;
}
bool ProjectPageImpl::saveSettingsDialog(XinxProject::Project* project)
bool ProjectPageImpl::saveSettingsDialog(XinxProject::ProjectPtr project)
{
project->setProjectName(field("project.name").toString());
@ -230,7 +230,7 @@ bool VersionsPageImpl::pageIsVisible() const
return true;
}
bool VersionsPageImpl::saveSettingsDialog(XinxProject::Project* project)
bool VersionsPageImpl::saveSettingsDialog(XinxProject::ProjectPtr project)
{
QString rcs = QString();
if (! m_noRevisionControl->isChecked())
@ -275,7 +275,7 @@ bool LastPageImpl::pageIsVisible() const
return true;
}
bool LastPageImpl::saveSettingsDialog(XinxProject::Project* project)
bool LastPageImpl::saveSettingsDialog(XinxProject::ProjectPtr project)
{
Q_UNUSED(project);
return true;

15
framework/project/newprojectwizard.h

@ -28,13 +28,10 @@
// Xinx header
#include "ui_newprojectwizard_project.h"
#include <plugins/interfaces/gui.h>
#include "xinxprojectproject.h"
class NewProjectWizard;
class TemplateDialogImpl;
namespace XinxProject
{
class Project;
};
class ProjectPageImpl : public IXinxPluginNewProjectConfigurationPage, private Ui::ProjectPage
{
@ -46,7 +43,7 @@ public:
virtual QString pagePluginId() const;
virtual bool pageIsVisible() const;
virtual bool saveSettingsDialog(XinxProject::Project * project);
virtual bool saveSettingsDialog(XinxProject::ProjectPtr project);
private slots:
void on_m_projectPathBtn_clicked();
@ -61,7 +58,7 @@ public:
virtual QString pagePluginId() const;
virtual bool pageIsVisible() const;
virtual bool saveSettingsDialog(XinxProject::Project * project);
virtual bool saveSettingsDialog(XinxProject::ProjectPtr project);
private:
QRadioButton * m_noRevisionControl;
QList< QPair<QRadioButton*, QString> > m_revisionBtn;
@ -77,7 +74,7 @@ public:
virtual QString pagePluginId() const;
virtual bool pageIsVisible() const;
virtual bool saveSettingsDialog(XinxProject::Project * project);
virtual bool saveSettingsDialog(XinxProject::ProjectPtr project);
private:
};
@ -87,11 +84,11 @@ class NewProjectWizard : public QWizard
public:
NewProjectWizard(QWidget * widget = 0, Qt::WFlags f = 0);
XinxProject::Project * createProject();
XinxProject::ProjectPtr createProject();
virtual int nextId() const;
private:
XinxProject::Project * m_project;
XinxProject::ProjectPtr m_project;
mutable QHash<int,QString> m_nextId;
mutable QStringList m_plugins;

18
framework/project/projectdirectorywidgetimpl.cpp

@ -110,13 +110,13 @@ PrivateProjectDirectoryWidgetImpl::~PrivateProjectDirectoryWidgetImpl()
void PrivateProjectDirectoryWidgetImpl::updateActions(QModelIndexList selectedRows)
{
const int nb_selected = selectedRows.size ();
XinxProject::Project * project = _model->fileProject(selectedRows.at(0));
XinxProject::ProjectPtr project = _model->fileProject(selectedRows.at(0));
bool is_directory = true;
bool is_file = true;
bool is_project = true;
bool is_mutli_project = false;
bool is_selected = project == XinxProject::Manager::self()->selectedProject();
bool is_selected = project.data() == XinxProject::Manager::self()->selectedProject().data();
bool is_rcs_actived = project && project->rcsProxy() && ! project->projectRCS().isEmpty();
bool is_rcs_enabled = is_rcs_actived && ! VersionControl::Manager::self ()->isExecuting ();
bool is_rcs_modified = true;
@ -134,7 +134,7 @@ void PrivateProjectDirectoryWidgetImpl::updateActions(QModelIndexList selectedRo
is_directory = false;
}
if (!_model->isProject(index)) is_project = false;
if (_model->fileProject(index) != project) is_mutli_project = true;
if (_model->fileProject(index).data() != project.data()) is_mutli_project = true;
switch (_model->fileState(index))
{
@ -246,7 +246,7 @@ void PrivateProjectDirectoryWidgetImpl::openFile(const QModelIndex & index)
{
const QFileInfo file_info = _model->fileInfo(index);
const QString file_path = _model->filePath(index);
XinxProject::Project * project = _model->fileProject(index);
XinxProject::ProjectPtr project = _model->fileProject(index);
if (! file_info.isDir())
{
@ -327,7 +327,7 @@ void PrivateProjectDirectoryWidgetImpl::compareWithVersionControlTriggered()
QModelIndexList rows = _parent->_directory_view->selectionModel()->selectedRows();
if (rows.size() != 1) return;
XinxProject::Project * project = _model->fileProject(rows.at(0));
XinxProject::ProjectPtr project = _model->fileProject(rows.at(0));
Q_ASSERT(! project->projectRCS().isEmpty() && project->rcsProxy());
@ -361,7 +361,7 @@ void PrivateProjectDirectoryWidgetImpl::updateFromVersionControlTriggered()
QModelIndexList rows = _parent->_directory_view->selectionModel()->selectedRows();
if (rows.size() != 1) return;
XinxProject::Project * project = _model->fileProject(rows.at(0));
XinxProject::ProjectPtr project = _model->fileProject(rows.at(0));
Q_ASSERT(! project->projectRCS().isEmpty() && project->rcsProxy());
@ -375,7 +375,7 @@ void PrivateProjectDirectoryWidgetImpl::commitToVersionControlTriggered()
QModelIndexList rows = _parent->_directory_view->selectionModel()->selectedRows();
if (rows.size() != 1) return;
XinxProject::Project * project = _model->fileProject(rows.at(0));
XinxProject::ProjectPtr project = _model->fileProject(rows.at(0));
Q_ASSERT(! project->projectRCS().isEmpty() && project->rcsProxy());
@ -389,7 +389,7 @@ void PrivateProjectDirectoryWidgetImpl::addToVersionControlTriggered()
QModelIndexList rows = _parent->_directory_view->selectionModel()->selectedRows();
if (rows.size() != 1) return;
XinxProject::Project * project = _model->fileProject(rows.at(0));
XinxProject::ProjectPtr project = _model->fileProject(rows.at(0));
Q_ASSERT(! project->projectRCS().isEmpty() && project->rcsProxy());
@ -406,7 +406,7 @@ void PrivateProjectDirectoryWidgetImpl::removeFromVersionControlTriggered()
QModelIndexList rows = _parent->_directory_view->selectionModel()->selectedRows();
if (rows.size() != 1) return;
XinxProject::Project * project = _model->fileProject(rows.at(0));
XinxProject::ProjectPtr project = _model->fileProject(rows.at(0));
Q_ASSERT(! project->projectRCS().isEmpty() && project->rcsProxy());

7
framework/project/projectdirectorywidgetimpl.h

@ -21,14 +21,11 @@
#define PROJECTDIRECTORYWIDGETIMPL_H
#include "ui_projectdirectorywidget.h"
#include "xinxprojectproject.h"
class IFileTypePlugin;
class QDockWidget;
class PrivateProjectDirectoryWidgetImpl;
namespace XinxProject
{
class Project;
}
class ProjectDirectoryWidgetImpl : public QWidget, public Ui::ProjectDirectoryWidget
{
@ -43,7 +40,7 @@ public:
QStringList selectedFiles() const;
signals:
void open(const QString & filename, IFileTypePlugin* interface, XinxProject::Project * project);
void open(const QString & filename, IFileTypePlugin* interface, XinxProject::ProjectPtr project);
private:
PrivateProjectDirectoryWidgetImpl * d;
friend class PrivateProjectDirectoryWidgetImpl;

53
framework/project/projectlistmodel.cpp

@ -58,12 +58,12 @@ const QString & DirectoryFetcher::directory() const
return _directory;
}
void DirectoryFetcher::setProject(Project * project)
void DirectoryFetcher::setProject(ProjectPtr project)
{
_project = project;
}
Project * DirectoryFetcher::project() const
ProjectPtr DirectoryFetcher::project() const
{
return _project;
}
@ -125,7 +125,7 @@ void DirectoryFetcher::startJob()
/* ModelFileNode */
ModelFileNode::ModelFileNode(PrivateProjectListModel * p) : _private_model(p), _is_project(false), _project(0), _parent(0), _is_children_populated(false)
ModelFileNode::ModelFileNode(PrivateProjectListModel * p) : _private_model(p), _is_project(false), _parent(0), _is_children_populated(false)
{
_rcs_info.state = RCS::Unknown;
}
@ -166,26 +166,29 @@ QIcon ModelFileNode::icon() const
QString ModelFileNode::displayText() const
{
XinxProject::ProjectPtr project = _project.toStrongRef();
if (! project) return QString();
if (_is_project)
{
return QString("%1 [%2]").arg(_project->projectName()).arg(_project->projectPath());
return QString("%1 [%2]").arg(project->projectName()).arg(project->projectPath());
}
else
{
if (_private_model->_long_directory_name)
{
return QDir(_project->projectPath ()).relativeFilePath (_info.absoluteFilePath ());
return QDir(project->projectPath ()).relativeFilePath (_info.absoluteFilePath ());
}
return _info.fileName();
}
}
void ModelFileNode::add(XinxProject::Project * project)
void ModelFileNode::add(ProjectPtr project)
{
ModelFileNode * node = new ModelFileNode (_private_model);
node->_is_project = true;
node->_project = project;
node->_project = project.toWeakRef();
node->_info = QFileInfo(project->projectPath());
add(node);
}
@ -228,7 +231,7 @@ void ModelFileNode::add(ModelFileNode * node)
_children.insert(node->_filename, node);
}
ModelFileNode * ModelFileNode::remove(XinxProject::Project * project)
ModelFileNode * ModelFileNode::remove(ProjectPtr project)
{
return remove(project->projectPath());
}
@ -267,7 +270,7 @@ void ModelFileNode::removeVisibleChildren(const QString & filename)