Browse Source

fixes #395 : Split files if it's usefull. Removing wrong header will be made with time.

master
Ulrich Van Den Hekke 10 years ago
parent
commit
c317fa7f3f
  1. 6
      .hgignore
  2. 7
      Doxyfile
  3. 1
      components/borderlayout.cpp
  4. 1
      components/checkcombobox.cpp
  5. 1
      components/checkcombobox.h
  6. 2
      framework/application/mainformimpl.cpp
  7. 65
      framework/application/xinxdockwidget.cpp
  8. 41
      framework/application/xinxprojectwizard/conclusionwizardpage.cpp
  9. 37
      framework/application/xinxprojectwizard/conclusionwizardpage.h
  10. 71
      framework/application/xinxprojectwizard/filewizardpage.cpp
  11. 41
      framework/application/xinxprojectwizard/filewizardpage.h
  12. 59
      framework/application/xinxprojectwizard/progresswizardpage.cpp
  13. 41
      framework/application/xinxprojectwizard/progresswizardpage.h
  14. 117
      framework/application/xinxprojectwizard/projectwizard.cpp
  15. 50
      framework/application/xinxprojectwizard/projectwizard.h
  16. 56
      framework/application/xinxprojectwizard/versionwizardpage.cpp
  17. 39
      framework/application/xinxprojectwizard/versionwizardpage.h
  18. 60
      framework/codecompletion/actionitem.cpp
  19. 42
      framework/codecompletion/actionitem.h
  20. 57
      framework/codecompletion/completer.cpp
  21. 58
      framework/codecompletion/contentviewnodeitem.cpp
  22. 45
      framework/codecompletion/contentviewnodeitem.h
  23. 21
      framework/codecompletion/context.cpp
  24. 13
      framework/codecompletion/context.h
  25. 46
      framework/codecompletion/contexttype.cpp
  26. 45
      framework/codecompletion/contexttype.h
  27. 151
      framework/codecompletion/item.cpp
  28. 72
      framework/codecompletion/item.h
  29. 44
      framework/codecompletion/iteminterface.h
  30. 1
      framework/codecompletion/itemmodelfactory.h
  31. 171
      framework/codecompletion/model.cpp
  32. 59
      framework/codecompletion/model.h
  33. 1
      framework/codecompletion/pool.cpp
  34. 1
      framework/codecompletion/snipets/snipetcontexttype.h
  35. 1
      framework/codecompletion/snipets/snipetitem.h
  36. 1
      framework/codecompletion/snipets/snipetitemmodelfactory.cpp
  37. 24
      framework/contentview3/cache.cpp
  38. 9
      framework/contentview3/cache.h
  39. 37
      framework/contentview3/cacheexception.cpp
  40. 41
      framework/contentview3/cacheexception.h
  41. 21
      framework/contentview3/dockwidget.cpp
  42. 1
      framework/contentview3/file.cpp
  43. 49
      framework/contentview3/parser.cpp
  44. 12
      framework/contentview3/parser.h
  45. 67
      framework/contentview3/parserexception.cpp
  46. 46
      framework/contentview3/parserexception.h
  47. 55
      framework/core/abstractmesssagedockwidget.cpp
  48. 1
      framework/core/errordockimpl.cpp
  49. 99
      framework/core/errormanager.cpp
  50. 71
      framework/core/errormanager.h
  51. 258
      framework/core/exceptionmanager.cpp
  52. 61
      framework/core/exceptionmanager.h
  53. 316
      framework/core/exceptions.cpp
  54. 65
      framework/core/exceptions.h
  55. 1
      framework/core/uniqueapplication.cpp
  56. 1
      framework/core/xinxconfig.h
  57. 1
      framework/core/xinxthread.cpp
  58. 32
      framework/editors/abstracteditor.cpp
  59. 6
      framework/editors/bookmarkeditorinterface.cpp
  60. 17
      framework/editors/editortabdockwidget.cpp
  61. 1
      framework/editors/textfileeditor.cpp
  62. 5
      framework/jobs/xinxjob.cpp
  63. 13
      framework/jobs/xinxjobprogressdock.cpp
  64. 26
      framework/project/projectdirectorywidgetimpl.cpp
  65. 44
      framework/scripts/documentsearch.cpp
  66. 25
      framework/scripts/documentsearch.h
  67. 64
      framework/scripts/documentsearchoption.cpp
  68. 55
      framework/scripts/documentsearchoption.h
  69. 1
      framework/scripts/scriptmanager.cpp
  70. 17
      framework/search/findedfile.cpp
  71. 12
      framework/search/findedfile.h
  72. 17
      framework/search/findedline.cpp
  73. 12
      framework/search/findedline.h
  74. 2
      framework/search/findedmodel.h
  75. 1
      framework/search/searchdockimpl.cpp
  76. 4
      framework/snipets/basesnipetitemmodel.cpp
  77. 18
      framework/snipets/snipetdockwidget.cpp
  78. 7
      framework/snipets/snipetlist.cpp
  79. 16
      framework/snipets/snipetlist.h
  80. 28
      framework/snipets/snipetlistexception.cpp
  81. 45
      framework/snipets/snipetlistexception.h
  82. 1
      framework/snipets/snipetmanager.cpp
  83. 47
      framework/snipets/snipetmenu.cpp
  84. 13
      framework/snipets/snipetmenu.h
  85. 70
      framework/snipets/snipetmenumodel.cpp
  86. 40
      framework/snipets/snipetmenumodel.h
  87. 117
      framework/utils/actiongroup.cpp
  88. 4
      framework/utils/actiongroup.h
  89. 46
      framework/utils/actiongroup_p.h
  90. 1
      plugins/core/editors/models/css/csscontexttype.h
  91. 1
      plugins/core/editors/models/html_xsl_base/itemmodelfactory.cpp
  92. 1
      plugins/core/editors/models/html_xsl_base/itemmodelfactory.h
  93. 1
      plugins/core/editors/models/html_xsl_base/xmlcompletionparser.cpp
  94. 1
      plugins/core/editors/models/html_xsl_base/xmlcontexttype.h
  95. 1
      plugins/core/editors/models/js/jscontentviewparser.cpp
  96. 1
      plugins/core/editors/models/js/jscontexttype.h
  97. 2
      plugins/core/editors/models/xsl/importitemmodelfactory.cpp
  98. 1
      plugins/core/editors/models/xsl/itemmodelfactory.h
  99. 1
      plugins/core/editors/models/xsl/stylesheet_parser.cpp
  100. 1
      plugins/core/editors/widgeteditor/html/htmlfileeditor.cpp

6
.hgignore

@ -2,11 +2,13 @@ syntax: glob
build/
CMakeLists.txt.user
*.kdev4
.directory
doc/manual/*.aux
doc/manual/*.log
doc/manual/*.out
doc/manual/*.pdf
doc/manual/*.toc
doc/html/*
*.orig
*~
doc/manual/*.toc
.directory
*.bak

7
Doxyfile

@ -31,7 +31,7 @@ PROJECT_NAME = "XINX Library"
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 0.10.1
PROJECT_NUMBER = 0.10
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
@ -681,7 +681,8 @@ EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = ui_*.h \
moc_*.cpp \
qrc_*.cpp \
.svn
.svn \
.hg
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@ -689,7 +690,7 @@ EXCLUDE_PATTERNS = ui_*.h \
# wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test
EXCLUDE_SYMBOLS =
EXCLUDE_SYMBOLS = .hg
# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see

1
components/borderlayout.cpp

@ -47,7 +47,6 @@
// Components header
#include "borderlayout_p.h"
/* BorderLayoutPrivate */
QSize BorderLayoutPrivate::calculateSize(SizeType sizeType) const

1
components/checkcombobox.cpp

@ -202,6 +202,7 @@ CheckComboBox::~CheckComboBox()
}
/*!
* \brief Hides the list of items in the combobox if it is currently visible.
* \reimp for internal use
*/
void CheckComboBox::hidePopup()

1
components/checkcombobox.h

@ -60,7 +60,6 @@ public:
QStringList checkedItems() const;
QStringList items() const;
public slots:
void setCheckedItems(const QStringList& items);

2
framework/application/mainformimpl.cpp

@ -32,6 +32,8 @@
#include <core/uniqueapplication.h>
#include <search/searchfilethread.h>
#include <core/exceptions.h>
#include <core/exceptionmanager.h>
#include <core/errormanager.h>
#include <scripts/scriptmanager.h>
#include <snipets/snipetmanager.h>
#include <snipets/snipetmenu.h>

65
framework/application/xinxdockwidget.cpp

@ -22,17 +22,59 @@
#include <dviewbutton.h>
#include <core/xinxconfig.h>
/*!
* \defgroup gui Application's class
*/
/*!
* \ingroup gui
* \class XinxDockWidget
* \since 0.10.2
*
* \brief Abstract class to use to make a dock widget.
*
* You must subclass this class when you want to make a new dock for XINX. This class contains method to show
* title and to show shortcut.
*
* This class propose also two methods to get and set the dock.
*
* If you want add an information in the title, you must subclass the method windowTitle().
*/
/*!
* \fn void XinxDockWidget::dockChanged()
* \brief The signal is emited when DTooView is changed.
*
*/
/*!
* \fn void XinxDockWidget::windowChanged()
* \brief The signal is emited when the title is changed (the shortcut or notification is modified)
*/
//! Create a new dock for XINX.
XinxDockWidget::XinxDockWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f), _dock(0)
{
connect(this, SIGNAL(dockChanged()), this, SLOT(updateDockTitle()));
connect(this, SIGNAL(windowChanged()), this, SLOT(updateDockTitle()));
}
//! Destroy the dock.
XinxDockWidget::~XinxDockWidget()
{
}
/*!
* \brief Return the title of the dock.
*
* The title is shown in the button, that you can see below the dock. This button is used
* to show or hide the dock.
*
* This default method show the shortcut in the toolbar.
*
* This method must be subclassed to show a more detailled title.
*/
QString XinxDockWidget::windowTitle() const
{
if (!_shortcut.isEmpty() && XINXConfig::self()->config().dock.showShortcut)
@ -42,6 +84,13 @@ QString XinxDockWidget::windowTitle() const
return QWidget::windowTitle();
}
/*!
* \brief Set the DToolView dock to \p dock
*
* When the dock is changed the signal dockChanged() is emited.
*
* \sa dock(), dockChanged()
*/
void XinxDockWidget::setDock(DToolView* dock)
{
if (_dock != dock)
@ -52,11 +101,22 @@ void XinxDockWidget::setDock(DToolView* dock)
}
}
/*!
* \brief Return the dock of type DToolView of the class.
* \sa setDock()
*/
DToolView* XinxDockWidget::dock()
{
return _dock;
}
/*!
* \brief Set the shortcut for the dock to show in the title
*
* When the shortcut is changed the signal windowChanged() is emited.
*
* \sa getShortcut(), windowChanged()
*/
void XinxDockWidget::setShortcut(const QKeySequence & shortcut)
{
if (_shortcut != shortcut)
@ -67,11 +127,16 @@ void XinxDockWidget::setShortcut(const QKeySequence & shortcut)
}
}
/*!
* \brief Return the current shortcut of the dock.
* \sa setShortcut()
*/
const QKeySequence & XinxDockWidget::getShortcut() const
{
return _shortcut;
}
//! This method is called when the title is modified to update the button title.
void XinxDockWidget::updateDockTitle()
{
if (_dock && _dock->button())

41
framework/application/xinxprojectwizard/conclusionwizardpage.cpp

@ -0,0 +1,41 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Xinx header
#include "conclusionwizardpage.h"
// Qt header
#include <QVBoxLayout>
#include <QLabel>
/* ConclusionWizardPage */
ConclusionWizardPage::ConclusionWizardPage(QWidget * parent) : QWizardPage(parent)
{
setTitle(tr("Conversion finished"));
setSubTitle(tr("The conversion is terminated, you can now reopen the project."));
QVBoxLayout * layout = new QVBoxLayout(this);
layout->addWidget(new QLabel(tr("The project is now converted. XINX can now open the project file normally."), this));
// layout->addWidget( m_openCheck = new QCheckBox( tr("Re-open the project with XINX automatically"), this ) );
// m_openCheck->setChecked( true );
// registerField( "project.open", m_openCheck );
}

37
framework/application/xinxprojectwizard/conclusionwizardpage.h

@ -0,0 +1,37 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PROJECTWIZARDCONCLUSION_H_
#define PROJECTWIZARDCONCLUSION_H_
// Qt header
#include <QWizardPage>
class QCheckBox;
class ConclusionWizardPage : public QWizardPage
{
Q_OBJECT
public:
ConclusionWizardPage(QWidget * parent = 0);
private:
QCheckBox * m_openCheck;
};
#endif // PROJECTWIZARDCONCLUSION_H_

71
framework/application/xinxprojectwizard/filewizardpage.cpp

@ -0,0 +1,71 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Xinx header
#include "filewizardpage.h"
#include <directoryedit.h>
#include <directoryeditwidget.h>
#include "projectconverter.h"
#include "projectwizard.h"
// Qt header
#include <QLabel>
#include <QVBoxLayout>
#include <QMessageBox>
#include <QVariant>
/* FileWizardPage */
FileWizardPage::FileWizardPage(QString filename, QWidget * parent) : QWizardPage(parent), m_filename(filename)
{
setTitle(tr("Project file selection"));
setSubTitle(tr("This wizard will help you to migrate your project file to "
"the current version of XINX. Please fill all fields."));
QLabel * directoryLabel;
QVBoxLayout * layout = new QVBoxLayout(this);
layout->addWidget(directoryLabel = new QLabel(tr("&Project file : "), this));
layout->addWidget(m_projectEdit = new DirectoryEditWidget(false, this));
directoryLabel->setBuddy(m_projectEdit->lineEdit());
registerField("project.name*", m_projectEdit->lineEdit());
}
void FileWizardPage::initializePage()
{
m_projectEdit->lineEdit()->setText(m_filename);
}
bool FileWizardPage::validatePage()
{
try
{
ProjectConverter * converter = dynamic_cast<ProjectWizard*>(wizard())->converter();
delete converter;
converter = new ProjectConverter(field("project.name").toString());
dynamic_cast<ProjectWizard*>(wizard())->setConverter(converter);
}
catch (XinxException & e)
{
QMessageBox::critical(this, tr("Project Wizard"), e.getMessage());
return false;
}
return true;
}

41
framework/application/xinxprojectwizard/filewizardpage.h

@ -0,0 +1,41 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PROJECTWIZARDFILE_H_
#define PROJECTWIZARDFILE_H_
// Qt header
#include <QWizardPage>
class DirectoryEditWidget;
class FileWizardPage : public QWizardPage
{
Q_OBJECT
public:
FileWizardPage(QString filename, QWidget * parent = 0);
virtual void initializePage();
virtual bool validatePage();
private:
QString m_filename;
DirectoryEditWidget * m_projectEdit;
};
#endif // PROJECTWIZARDFILE_H_

59
framework/application/xinxprojectwizard/progresswizardpage.cpp

@ -0,0 +1,59 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Xinx header
#include "progresswizardpage.h"
#include "projectconverter.h"
#include "projectwizard.h"
// Qt header
#include <QApplication>
#include <QVBoxLayout>
#include <QProgressBar>
/* ProgressWizardPage */
ProgressWizardPage::ProgressWizardPage(QWidget * parent) : QWizardPage(parent)
{
setTitle(tr("Progress of the conversion"));
setSubTitle(tr("Please wait ..."));
QVBoxLayout * layout = new QVBoxLayout(this);
m_progressBar = new QProgressBar(this);
layout->addWidget(m_progressBar);
}
void ProgressWizardPage::initializePage()
{
if (dynamic_cast<ProjectWizard*>(wizard())->converter())
{
ProjectConverter * converter = dynamic_cast<ProjectWizard*>(wizard())->converter();
connect(converter, SIGNAL(setValue(int)), m_progressBar, SLOT(setValue(int)));
connect(converter, SIGNAL(setValue(int)), this, SLOT(processMessages()));
connect(converter, SIGNAL(setMaximum(int)), m_progressBar, SLOT(setMaximum(int)));
converter->process();
m_progressBar->setMaximum(converter->nbSession() + XINX_PROJECT_VERSION - converter->version());
}
}
void ProgressWizardPage::processMessages()
{
qApp->processEvents();
}

41
framework/application/xinxprojectwizard/progresswizardpage.h

@ -0,0 +1,41 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PROJECTWIZARDPROGRESS_H_
#define PROJECTWIZARDPROGRESS_H_
// Qt header
#include <QWizardPage>
class QProgressBar;
class ProgressWizardPage : public QWizardPage
{
Q_OBJECT
public:
ProgressWizardPage(QWidget * parent = 0);
virtual void initializePage();
private slots:
void processMessages();
private:
QProgressBar * m_progressBar;
};
#endif // PROJECTWIZARDPROGRESS_H_

117
framework/application/xinxprojectwizard/projectwizard.cpp

@ -22,6 +22,10 @@
#include <directoryeditwidget.h>
#include <directoryedit.h>
#include "projectconverter.h"
#include "filewizardpage.h"
#include "versionwizardpage.h"
#include "progresswizardpage.h"
#include "conclusionwizardpage.h"
// Qt header
#include <QApplication>
@ -72,116 +76,3 @@ void ProjectWizard::accept()
QWizard::accept();
}
/* FileWizardPage */
FileWizardPage::FileWizardPage(QString filename, QWidget * parent) : QWizardPage(parent), m_filename(filename)
{
setTitle(tr("Project file selection"));
setSubTitle(tr("This wizard will help you to migrate your project file to "
"the current version of XINX. Please fill all fields."));
QLabel * directoryLabel;
QVBoxLayout * layout = new QVBoxLayout(this);
layout->addWidget(directoryLabel = new QLabel(tr("&Project file : "), this));
layout->addWidget(m_projectEdit = new DirectoryEditWidget(false, this));
directoryLabel->setBuddy(m_projectEdit->lineEdit());
registerField("project.name*", m_projectEdit->lineEdit());
}
void FileWizardPage::initializePage()
{
m_projectEdit->lineEdit()->setText(m_filename);
}
bool FileWizardPage::validatePage()
{
try
{
ProjectConverter * converter = dynamic_cast<ProjectWizard*>(wizard())->converter();
delete converter;
converter = new ProjectConverter(field("project.name").toString());
dynamic_cast<ProjectWizard*>(wizard())->setConverter(converter);
}
catch (XinxException & e)
{
QMessageBox::critical(this, tr("Project Wizard"), e.getMessage());
return false;
}
return true;
}
/* VersionWizardPage */
VersionWizardPage::VersionWizardPage(QWidget * parent) : QWizardPage(parent)
{
setTitle(tr("Version informations"));
setSubTitle(tr("This page show you some informations about the selected project file."));
setCommitPage(true);
QVBoxLayout * layout = new QVBoxLayout(this);
m_resume = new QLabel(this);
m_resume->setWordWrap(true);
layout->addWidget(m_resume);
}
void VersionWizardPage::initializePage()
{
if (dynamic_cast<ProjectWizard*>(wizard())->converter())
{
m_resume->setText(
tr("You want convert a %1 (version %2).\nThis wizard will convert the project to the last version of XINX. Wizard must convert %3 opened file.")
.arg(dynamic_cast<ProjectWizard*>(wizard())->converter()->type())
.arg(dynamic_cast<ProjectWizard*>(wizard())->converter()->version())
.arg(dynamic_cast<ProjectWizard*>(wizard())->converter()->nbSession())
);
}
}
/* ProgressWizardPage */
ProgressWizardPage::ProgressWizardPage(QWidget * parent) : QWizardPage(parent)
{
setTitle(tr("Progress of the conversion"));
setSubTitle(tr("Please wait ..."));
QVBoxLayout * layout = new QVBoxLayout(this);
m_progressBar = new QProgressBar(this);
layout->addWidget(m_progressBar);
}
void ProgressWizardPage::initializePage()
{
if (dynamic_cast<ProjectWizard*>(wizard())->converter())
{
ProjectConverter * converter = dynamic_cast<ProjectWizard*>(wizard())->converter();
connect(converter, SIGNAL(setValue(int)), m_progressBar, SLOT(setValue(int)));
connect(converter, SIGNAL(setValue(int)), this, SLOT(processMessages()));
connect(converter, SIGNAL(setMaximum(int)), m_progressBar, SLOT(setMaximum(int)));
converter->process();
m_progressBar->setMaximum(converter->nbSession() + XINX_PROJECT_VERSION - converter->version());
}
}
void ProgressWizardPage::processMessages()
{
qApp->processEvents();
}
/* ConclusionWizardPage */
ConclusionWizardPage::ConclusionWizardPage(QWidget * parent) : QWizardPage(parent)
{
setTitle(tr("Conversion finished"));
setSubTitle(tr("The conversion is terminated, you can now reopen the project."));
QVBoxLayout * layout = new QVBoxLayout(this);
layout->addWidget(new QLabel(tr("The project is now converted. XINX can now open the project file normally."), this));
// layout->addWidget( m_openCheck = new QCheckBox( tr("Re-open the project with XINX automatically"), this ) );
// m_openCheck->setChecked( true );
// registerField( "project.open", m_openCheck );
}

50
framework/application/xinxprojectwizard/projectwizard.h

@ -23,10 +23,6 @@
// Qt header
#include <QWizard>
class QLabel;
class QProgressBar;
class QCheckBox;
class DirectoryEditWidget;
class ProjectConverter;
class ProjectWizard : public QWizard
@ -44,50 +40,4 @@ private:
QString m_filename;
};
class FileWizardPage : public QWizardPage
{
Q_OBJECT
public:
FileWizardPage(QString filename, QWidget * parent = 0);
virtual void initializePage();
virtual bool validatePage();
private:
QString m_filename;
DirectoryEditWidget * m_projectEdit;
};
class VersionWizardPage : public QWizardPage
{
Q_OBJECT
public:
VersionWizardPage(QWidget * parent = 0);
virtual void initializePage();
private:
QLabel * m_resume;
};
class ProgressWizardPage : public QWizardPage
{
Q_OBJECT
public:
ProgressWizardPage(QWidget * parent = 0);
virtual void initializePage();
private slots:
void processMessages();
private:
QProgressBar * m_progressBar;
};
class ConclusionWizardPage : public QWizardPage
{
Q_OBJECT
public:
ConclusionWizardPage(QWidget * parent = 0);
private:
QCheckBox * m_openCheck;
};
#endif /*PROJECTWIZARD_H_*/

56
framework/application/xinxprojectwizard/versionwizardpage.cpp

@ -0,0 +1,56 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Xinx header
#include "versionwizardpage.h"
#include "projectwizard.h"
#include "projectconverter.h"
// Qt header
#include <QVBoxLayout>
#include <QLabel>
/* VersionWizardPage */
VersionWizardPage::VersionWizardPage(QWidget * parent) : QWizardPage(parent)
{
setTitle(tr("Version informations"));
setSubTitle(tr("This page show you some informations about the selected project file."));
setCommitPage(true);
QVBoxLayout * layout = new QVBoxLayout(this);
m_resume = new QLabel(this);
m_resume->setWordWrap(true);
layout->addWidget(m_resume);
}
void VersionWizardPage::initializePage()
{
if (dynamic_cast<ProjectWizard*>(wizard())->converter())
{
m_resume->setText(
tr("You want convert a %1 (version %2).\nThis wizard will convert the project to the last version of XINX. Wizard must convert %3 opened file.")
.arg(dynamic_cast<ProjectWizard*>(wizard())->converter()->type())
.arg(dynamic_cast<ProjectWizard*>(wizard())->converter()->version())
.arg(dynamic_cast<ProjectWizard*>(wizard())->converter()->nbSession())
);
}
}

39
framework/application/xinxprojectwizard/versionwizardpage.h

@ -0,0 +1,39 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PROJECTWIZARDVERSION_H_
#define PROJECTWIZARDVERSION_H_
// Qt header
#include <QWizardPage>
class QLabel;
class VersionWizardPage : public QWizardPage
{
Q_OBJECT
public:
VersionWizardPage(QWidget * parent = 0);
virtual void initializePage();
private:
QLabel * m_resume;
};
#endif // PROJECTWIZARDVERSION_H_

60
framework/codecompletion/actionitem.cpp

@ -0,0 +1,60 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "actionitem.h"
namespace CodeCompletion
{
/* ActionItem */
/*!
* \class ActionItem
* \ingroup codecompletion
* \since 0.10.1
*
* \brief Item of a code completion list used for action.
*
* Item in a code completion list, that call an action. This can be the case of
* calling snipet, or other type of action (like adding a new template at the end
* of the stylesheet ...)
*/
/*!
* \brief Create a new action item
*
* \param libelle The libelle of the action (show in the completion list)
* \param code The code to write in the editor to show this action.
*/
ActionItem::ActionItem(const QString& libelle, const QString & code)
{
setCompletionText(code);
setText(libelle);
setForeground(Qt::gray);
setKeyString(code);
setCompletionType(tr("Action"));
}
//! Destroy the action item
ActionItem::~ActionItem()
{
}
}

42
framework/codecompletion/actionitem.h

@ -0,0 +1,42 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CODECOMPLETION_ACTIONITEM_H
#define CODECOMPLETION_ACTIONITEM_H
// Xinx header
#include <codecompletion/item.h>
// Qt header
#include <QApplication>
namespace CodeCompletion
{
class LIBEXPORT ActionItem : public Item
{
Q_DECLARE_TR_FUNCTIONS(ActionItem)
public:
explicit ActionItem(const QString & libelle, const QString & code);
virtual ~ActionItem();
};
}
#endif // CODECOMPLETION_ACTIONITEM_H

57
framework/codecompletion/completer.cpp

@ -28,6 +28,7 @@
#include <QStyledItemDelegate>
#include <QTreeView>
#include <QHeaderView>
#include <codecompletion/item.h>
namespace CodeCompletion
{
@ -94,6 +95,23 @@ QModelIndex PrivateCompleter::findNextSelectableIndex(QModelIndex index, bool up
/* Completer */
/*!
* \class Completer
* \ingroup codecompletion
* \since 0.10.1
*
* \brief This class is used to make code completion in TextFileEditor
*
* This class is used to provide a completer to complete in the TextFileEditor. This class is based on the new
* framework CodeCompletion.
*
* This class re-implemente the QTreeView and eventFilter() to provide usability to the user.
*/
/*!
* \brief Create a new completer.
* \param parent The text file editor where to attach the completer
*/
Completer::Completer(TextFileEditor* parent): QCompleter(parent), d(new PrivateCompleter)
{
d->_completer = this;
@ -118,11 +136,13 @@ Completer::Completer(TextFileEditor* parent): QCompleter(parent), d(new PrivateC
setCompletionColumn(1);
}
//! Destroy the completer
Completer::~Completer()
{
}
//! Method to resize the last column when the number of column change.
void Completer::resizeColumns(int oldSize, int newSize)
{
if (newSize == 2)
@ -133,6 +153,18 @@ void Completer::resizeColumns(int oldSize, int newSize)
}
}
/*!
* \brief Method to call to launch the completion
*
* This method show the completion widget at the position of the cursor in the editor. In some case, instead of showing the completion
* widget, we call directly the completion (if the completion is asked by the user with Ctrl+SPACE).
*
* The completion update the model (with method CodeCompletion::Model::updateModel()) to refresh the list with the new prefix (set in
* the context). This can be slow if there are many item, so updateModel() must be coding with attention.
*
* \param automaticCall Set this param to true if the completion is asked by the program or false if the completion is asked by the user
* \param prefix Prefix to use for the selection of Item to propose to user.
*/
void Completer::complete(bool automaticCall, const QString & prefix)
{
QTime _complete_timer;
@ -177,6 +209,9 @@ void Completer::complete(bool automaticCall, const QString & prefix)
qDebug() << "Complete in " << _complete_timer.elapsed() << " ms";
}
/*!
* \brief Replace the text in the editor by the completion of the \p row-nth item of the list.
*/
void Completer::complete(int row)
{
if (d->_model)
@ -192,6 +227,9 @@ void Completer::complete(int row)
}
}
/*!
* \brief Replace the text in the editor by the completion of the given \p index.
*/
void Completer::complete(const QModelIndex& index)
{
if (index.isValid())
@ -207,6 +245,9 @@ void Completer::complete(const QModelIndex& index)
}
}
/*!
* \brief Replace the text in the editor with the completion of the given \p item.
*/
void Completer::complete(CodeCompletion::Item* item)
{
if (item)
@ -220,17 +261,29 @@ void Completer::complete(CodeCompletion::Item* item)
}
}
/*!
* \brief Set the current context to \p context.
*
* This method set the \p context for this and for the current model. So the model
* must be set before (else we can have Segfault).
*/
void Completer::setContext(Context context)
{
d->_context = context;
d->_model->setContext(context);
}
//! Return the current context
Context Completer::context() const
{
return d->_context;
}
/*!
* \brief Set the \p editor of the completer.
*
* This normally already be made in the constructor.
*/
void Completer::setEditor(TextFileEditor* editor)
{
if (d->_editor != editor)
@ -244,22 +297,26 @@ void Completer::setEditor(TextFileEditor* editor)
}
}
//! Return the current editor of the completer.
TextFileEditor* Completer::editor() const
{
return d->_editor;
}
//! Set the model used for completion. The model must be of type CodeCompletion::Model.
void Completer::setModel(Model* model)
{
d->_model = model;
QCompleter::setModel(model);
}
//! Return the model used for completion
Model* Completer::model() const
{
return d->_model;
}
//! Redefine some event (key press) to made this completer more usable for user.
bool Completer::eventFilter(QObject *o, QEvent *e)
{
if ((e->type() == QEvent::KeyPress) && popup()->isVisible())

58
framework/codecompletion/contentviewnodeitem.cpp

@ -0,0 +1,58 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "contentviewnodeitem.h"
#include <contentview3/node.h>
namespace CodeCompletion
{
/* PrivateContentViewNodeItem */
class PrivateContentViewNodeItem
{
public:
ContentView3::NodePtr _node;
};
/* ContentViewNodeItem */
ContentViewNodeItem::ContentViewNodeItem(const ContentView3::NodePtr & node) : d(new PrivateContentViewNodeItem)
{
d->_node = node;
setIcon(QIcon(node->icon()));
setText(node->displayName());
setCompletionText(node->name());
setCompletionHelper(node->completionString());
setCompletionType(node->type());
setKeyString(node->keyString());
}
ContentViewNodeItem::~ContentViewNodeItem()
{
}
const ContentView3::NodePtr & ContentViewNodeItem::node() const
{
return d->_node;
}
}

45
framework/codecompletion/contentviewnodeitem.h

@ -0,0 +1,45 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CODECOMPLETION_CONTENTVIEWNODEITEM_H
#define CODECOMPLETION_CONTENTVIEWNODEITEM_H
// Xinx header
#include <codecompletion/item.h>
#include <contentview3/definitions.h>
namespace CodeCompletion
{
class PrivateContentViewNodeItem;
class LIBEXPORT ContentViewNodeItem : public Item
{
public:
ContentViewNodeItem(const ContentView3::NodePtr & node);
virtual ~ContentViewNodeItem();
const ContentView3::NodePtr & node() const;
private:
QScopedPointer<PrivateContentViewNodeItem> d;
};
}
#endif // CODECOMPLETION_CONTENTVIEWNODEITEM_H

21
framework/codecompletion/context.cpp

@ -19,34 +19,15 @@
// Xinx header
#include "context.h"
#include <codecompletion/contexttype.h>
#include <contentview3/file.h>
// Qt header
#include <QHash>
// Std header
#include <typeinfo>
namespace CodeCompletion
{
/* ContextType */
ContextType::ContextType()
{
}
ContextType::~ContextType()
{
}
bool ContextType::operator==(const CodeCompletion::ContextType& other) const
{
return typeid(*this) == typeid(other);
}
/* PrivateContext */
class PrivateContext : public QSharedData

13
framework/codecompletion/context.h

@ -34,18 +34,7 @@ namespace CodeCompletion
{
class PrivateContext;
class LIBEXPORT ContextType
{
public:
ContextType();
virtual ~ContextType();
virtual QString type() const = 0;
virtual bool operator==(const ContextType & other) const;
private:
Q_DISABLE_COPY(ContextType)
};
class ContextType;
class LIBEXPORT Context
{

46
framework/codecompletion/contexttype.cpp

@ -0,0 +1,46 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Xinx header
#include "contexttype.h"
// Std header
#include <typeinfo>
namespace CodeCompletion
{
/* ContextType */
ContextType::ContextType()
{
}
ContextType::~ContextType()
{
}
bool ContextType::operator==(const CodeCompletion::ContextType& other) const
{
return typeid(*this) == typeid(other);
}
}

45
framework/codecompletion/contexttype.h

@ -0,0 +1,45 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CODECOMPLETION_CONTEXTTYPE_H
#define CODECOMPLETION_CONTEXTTYPE_H
// Xinx header
#include <core/lib-config.h>
namespace CodeCompletion
{
class PrivateContext;
class LIBEXPORT ContextType
{
public:
ContextType();
virtual ~ContextType();
virtual QString type() const = 0;
virtual bool operator==(const ContextType & other) const;
private:
Q_DISABLE_COPY(ContextType)
};
}
#endif // CODECOMPLETION_CONTEXTTYPE_H

151
framework/codecompletion/item.cpp

@ -0,0 +1,151 @@
/*
XINX
Copyright (C) 2007-2011 by Ulrich Van Den Hekke
xinx@shadoware.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful.
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "item.h"
#include <codecompletion/context.h>
#include <qdocumentcursor.h>
#include <editors/textfileeditor.h>
#include <editors/xinxcodeedit.h>
namespace CodeCompletion
{
/* PrivateItem */
class PrivateItem
{
public:
QString _contextType, _keyString;
};
/* Item */
Item::Item() : d(new PrivateItem)
{
}
Item::~Item()
{
}
void Item::setCompletionText(const QString & value)
{
setData(value, Qt::UserRole + 1);
if (text().isEmpty())
{
setText(value);
}
}
QString Item::completionText() const
{
return data(Qt::UserRole + 1).toString();
}
void Item::setCompletionType(const QString & value)
{
setData(value, Qt::UserRole + 2);
}
QString Item::completionType()
{
return data(Qt::UserRole + 2).toString();
}
void Item::setCompletionHelper(const QString & value)
{
setData(value, Qt::UserRole + 3);
}
QString Item::completionHelper() const
{
return data(Qt::UserRole + 3).toString();
}
void Item::setContextType(const QString& value)
{
d->_contextType = value;
}
const QString& Item::contextType() const
{
return d->_contextType;
}
const QString & Item::keyString() const
{
return d->_keyString;
}
void Item::setKeyString(const QString & value)
{
d->_keyString = value;
}
void Item::insertCompletionStart(Context context, TextFileEditor* editor, QDocumentCursor & cursor)
{
Q_UNUSED(cursor);
// The default implementation do nothing
}
void Item::insertCompletionEnd(Context context, TextFileEditor* editor, QDocumentCursor & cursor)
{
Q_UNUSED(cursor);
// The default implementation do nothing
}
void Item::execute(Context context, TextFileEditor* editor)
{
const QString completionForm = completionHelper();
const QString completionFormStart = completionForm.section("%1",0, 0);
const QString completionFormEnd = completionForm.section("%1",1, 1);
const QString value = completionText();
QDocumentCursor tc = editor->textEdit()->textCursor();
tc.setAutoUpdated(true);
bool insertCompletion = true;
QDocumentCursor completionStartCursor(tc);
completionStartCursor.movePosition(completionFormStart.length(), QDocumentCursor::PreviousCharacter, QDocumentCursor::KeepAnchor);
if (completionStartCursor.selectedText() == completionFormStart)
{
QDocumentCursor tc2(tc);
tc2.movePosition(completionFormStart.length(), QDocumentCursor::PreviousCharacter);
insertCompletionStart(context, editor, tc2);
insertCompletion = false;
}
else
{
insertCompletionStart(context, editor, tc);
tc.insertText(completionFormStart);
}
tc.insertText(value);
if (insertCompletion)
{
tc.insertText(completionFormEnd);
insertCompletionEnd(context, editor, tc);
}
editor->textEdit()->setTextCursor(tc);
}
}

72
framework/codecompletion/item.h