Browse Source

[DOC] Update documentation

master
Ulrich Van Den Hekke 11 years ago
parent
commit
0039693244
  1. 2
      components/borderlayout.cpp
  2. 2
      components/checkcombobox.cpp
  3. 2
      components/completerdirmodel.cpp
  4. 2
      components/customschemeimpl.cpp
  5. 2
      components/directoryedit.cpp
  6. 2
      components/directoryeditwidget.cpp
  7. 2
      components/pluginselector.cpp
  8. 2
      components/qmenuview.cpp
  9. 2
      components/stringcombobox.cpp
  10. 2
      components/xinxcolorcombo.cpp
  11. 2
      components/xinxdirectorylistwidget.cpp
  12. 2
      components/xinxlistwidgetimpl.cpp
  13. 18
      framework/actions/actioninterface.cpp
  14. 4
      framework/actions/actioninterface.h
  15. 197
      framework/actions/actionmanager.cpp
  16. 25
      framework/actions/actionmanager.h
  17. 62
      framework/actions/actionmanager_p.h

2
components/borderlayout.cpp

@ -92,7 +92,7 @@ QSize BorderLayoutPrivate::calculateSize(SizeType sizeType) const
*
* \brief A layout with a central widget.
*
* \bc
* \bc 0.10.0.0
*
* This layout is decomposed with a central widget and four borders. Methods
* add() and addWidget() have a second parameter \p position used to define

2
components/checkcombobox.cpp

@ -145,7 +145,7 @@ bool CheckComboModel::setData(const QModelIndex& index, const QVariant& value, i
* \ingroup Components
* \brief The CheckComboBox widget is an extended QComboBox with checkable items.
*
* \bc
* \bc 0.10.0.0
*
* ComboBox is a specialized combo box with checkable items.
* Checked items are collected together in the line edit.

2
components/completerdirmodel.cpp

@ -32,7 +32,7 @@
*
* \brief Class used by DirectoryEdit to complete on path.
*
* \bc
* \bc 0.10.0.0
*
* Completer model class based on a QDirModel which permit to propose a completion on
* the path.

2
components/customschemeimpl.cpp

@ -161,7 +161,7 @@ void CustomSchemeImplPrivate::updateFormatList()
*
* \brief Class to help the user to customize the QCodeEdit editor.
*
* \bc
* \bc 0.10.0.0
*
* Create a widget that allows to customize the QCodeEdit editor. This program uses
* QLanguageFactory and QFormatScheme to show the list of available formats to

2
components/directoryedit.cpp

@ -115,7 +115,7 @@ void DirectoryEditPrivate::slotTextChanged(QString text)
*
* \brief A line edit to edit, file or path.
*
* \bc
* \bc 0.10.0.0
*
* A line editor using a QCompleter based on the model \p CompleterDirModel to
* help the user to edit the path.

2
components/directoryeditwidget.cpp

@ -54,7 +54,7 @@ PrivateDirectoryEditWidget::PrivateDirectoryEditWidget(QWidget * o)
* \class DirectoryEditWidget
* \since 0.7.0.0
*
* \bc
* \bc 0.10.0.0
*
* \brief A widget to edit a path. This widget has a button attached to open a dialog.
*

2
components/pluginselector.cpp

@ -437,7 +437,7 @@ QSize PluginDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelI
*
* \brief The PluginSelector provides a list of configurable plugin elements.
*
* \bc
* \bc 0.10.0.0
*
* This class shows to the user the list of plugins with for each
* plugins a configure button and a about button.

2
components/qmenuview.cpp

@ -106,7 +106,7 @@ void QMenuViewPrivate::aboutToShow()
*
* \brief The QMenuView provides a menu based view on a QAbstractItemModel class.
*
* \bc
* \bc 0.10.0.0
*
* This class is used to transform a hierarchical model based on the class
* QAbstractItemModel into a menu. It can be used to create an action menu, history,

2
components/stringcombobox.cpp

@ -27,7 +27,7 @@
*
* \brief The class StringComboBox provides a extension of QComboBox to select an item.
*
* \bc
* \bc 0.10.0.0
*
* This special combo box adds a property value that can be used
* to change dynamically the current index with a string value, instead

2
components/xinxcolorcombo.cpp

@ -216,7 +216,7 @@ void XinxColorComboPrivate::addColors()
*
* \brief The XinxColorCombo provides a QComboBox used to select color.
*
* \bc
* \bc 0.10.0.0
*
* Combo box to choose a color. The combo box shows you the color
* and an associated text to the color. The shown color, is standard Qt color.

2
components/xinxdirectorylistwidget.cpp

@ -28,7 +28,7 @@
* \brief This list ask to the user to choose the directory to add to the list.
* \since 0.10.0.0
*
* \bc
* \bc 0.10.0.0
*
*/

2
components/xinxlistwidgetimpl.cpp

@ -151,7 +151,7 @@ void XinxListWidgetImplPrivate::on_m_list_itemChanged(QListWidgetItem * item)
*
* \brief The class XinxListWidgetImpl provides a widget to create, and sort a list.
*
* \bc
* \bc 0.10.0.0
*
* This widget is a list of values (exemple: list of path, list of urls, list of prefix) with
* a button to add an value, a button to delete a value, and a button to make a value the

18
framework/actions/actioninterface.cpp

@ -31,6 +31,18 @@
* \since 0.8.1.0
*
* \brief Interfaces to manage action in XINX
*
* This framework can be used by plugins to add new QAction in all different menu of
* XINX.
*
* There is four place where action can be added :
* - The princpal menu bar of the application
* - The tool bar of the application
* - The popup menu of the editor
* - The popup menu of the project directory dock
*
* The state (visible, enable) of all differentes actions can be updated on different event (as
* a signal emited in the editor, a change in the selection, ...)
*/
/*!
@ -48,7 +60,7 @@ using namespace XinxAction;
*
* \brief This class provide a menu item for ActionList
*
* \bc
* \bc 0.10.0.0
*
* Class represent a menu item. A menu item can be an action or a separator. This used by XINX throw plugin,
* to define the type of the element in the menu.
@ -163,7 +175,7 @@ void Separator::setVisible(bool value)
*
* \brief This class provide an action for ActionList
*
* \bc
* \bc 0.10.0.0
*
* This class is a wrapper of a QAction. This wrapper is used to facilite
* the enable, and visible feature of the action. This class inherits from
@ -305,7 +317,7 @@ void Action::setCurrentEditor(AbstractEditor * editor)
* \brief Represent an action for the project directory dock
* \since 0.10.0.0
*
* \bc
* \bc 0.10.0.0
*
* A project action is not only dependant of the current editor, but is dependant from the
* list of selected element in the project directory dock.

4
framework/actions/actioninterface.h

@ -36,7 +36,7 @@ class AbstractEditor;
namespace XinxAction
{
class ActionManager;
class ActionManagerPrivate;
class MenuItemPrivate;
class SeparatorPrivate;
class ActionPrivate;
@ -99,7 +99,7 @@ protected slots:
private:
QScopedPointer<ActionPrivate> d;
friend class ActionManager;
friend class ActionManagerPrivate;
};
class LIBEXPORT ProjectAction : public Action

197
framework/actions/actionmanager.cpp

@ -17,50 +17,39 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "actionmanager.h"
#include "actioninterface.h"
#include <plugins/xinxpluginsloader.h>
#include <plugins/xinxpluginelement.h>
#include <editors/editormanager.h>
#include <editors/abstracteditor.h>
// Qt header
#include <QMultiHash>
#include <QSet>
#include "actionmanager_p.h"
namespace XinxAction
{
/* PrivateActionManager */
/* ActionManagerPrivate */
class PrivateActionManager
ActionManagerPrivate::ActionManagerPrivate()
{
public:
PrivateActionManager();
~PrivateActionManager();
void updateSeparatorState(const QList<MenuItem*> & items);
QHash<QString,QString> _libelles;
QMultiHash<QString,MenuItem*> _menus;
QMultiHash<QString,MenuItem*> _toolBars;
QList<MenuItem*> _popups;
QList<MenuItem*> _directoryProjectPopup;
QSet<MenuItem*> _items;
};
}
PrivateActionManager::PrivateActionManager()
ActionManagerPrivate::~ActionManagerPrivate()
{
qDeleteAll(_items);
}
PrivateActionManager::~PrivateActionManager()
void ActionManagerPrivate::currentEditorChanged(int index)
{
qDeleteAll(_items);
AbstractEditor * editor = index >= 0 ? EditorManager::self()->editor(index) : NULL;
foreach(MenuItem * item, _items)
{
Action * action = dynamic_cast<Action*>(item);
if (action)
{
action->setCurrentEditor(editor);
}
}
_parent->updateMenuItemState();
}
void PrivateActionManager::updateSeparatorState(const QList<MenuItem*> & items)
void ActionManagerPrivate::updateSeparatorState(const QList<MenuItem*> & items)
{
bool isPreviousSeparator = true;
foreach(MenuItem * item, items)
@ -90,120 +79,195 @@ void PrivateActionManager::updateSeparatorState(const QList<MenuItem*> & items)
/* ActionManager */
ActionManager::ActionManager()
/*!
* \class XinxAction::ActionManager
* \ingroup XinxAction
* \brief Singleton class that provide a way to manage all actions.
* \since 0.10.0.0
*
* \bc 0.10.0.0
*
* This class is used by plugins to add new action to
* - Menu
* - Tool bar
* - Editor popup menu
* - Project directory dock popup menu
*
* Next this class is used by Mainform, Editor, Project directory dock, to
* read actions provide by plugins to add it on the GUI.
*
* When method IXinxPlugin::generateActionMenu() is called, the plugin must use
* add method on the ActionManager singleton.
*
* This method is called by local methode generateMenu()
*
* Action will be destroyed by the application automatically (not the plugin). IXinxPlugin
* musn't be owner of plugins.
*/
/*!
* \fn void ActionManager::changed()
* \brief Signal emited when list of action of ActionManager is updated.
*/
/*!
* \brief Create the ActionManager.
* \intern
*/
ActionManager::ActionManager() : d(new ActionManagerPrivate)
{
d = new PrivateActionManager;
connect(EditorManager::self(), SIGNAL(currentChanged(int)), this, SLOT(currentEditorChanged(int)));
d->_parent = this;
connect(EditorManager::self(), SIGNAL(currentChanged(int)), d.data(), SLOT(currentEditorChanged(int)));
}
//! Destroy the ActionManager
ActionManager::~ActionManager()
{
delete d;
}
//! Retrieve the name to show to the screen for the menu \e menu.
const QString ActionManager::nameOfMenu(const QString & menu) const
{
return d->_libelles.value(menu);
}
/*!
* \brief Insert a name for the menu of id \e menu with the name \e name
*
* \param menu The id of the menu
* \param name The translated name of the menu (the menu must be protected with tr()
* function.
*/
void ActionManager::insertNameOfMenu(const QString & menu, const QString & name)
{
d->_libelles.insert(menu, name);
}
//! Return the list of ID menu to create on the application
QStringList ActionManager::menus() const
{
return d->_menus.uniqueKeys();
}
void ActionManager::addMenuItem(const QString& menu, MenuItem* item)
/*!
* \brief Add the \e item to the menu given by \e menuId
*
* There is several default menu and where there is no need to create the menu with
* insertNameOfMenu() :
*
* - session
* - project
* - file
* - edit
* - search
* - bookmark
* - windows
* - tools
* - help
*
*/
void ActionManager::addMenuItem(const QString& menuId, MenuItem* item)
{
d->_menus.insert(menu, item);
d->_menus.insert(menuId, item);
d->_items.insert(item);
}
void ActionManager::addMenuSeparator(const QString& menu)
/*!
* \brief Add a separator in the menu \e menuId
* \sa addMenuItem()
*/
void ActionManager::addMenuSeparator(const QString& menuId)
{
Separator * separator = new Separator;
addMenuItem(menu, separator);
addMenuItem(menuId, separator);
}
QList< MenuItem* > ActionManager::menu(const QString& menu) const
//! List all item for the given menu (separator included)
QList< MenuItem* > ActionManager::menu(const QString& menuId) const
{
return d->_menus.values(menu);
return d->_menus.values(menuId);
}
//! List all available toolbars ID
QStringList ActionManager::toolBars() const
{
return d->_toolBars.uniqueKeys();
}
void ActionManager::addToolBarItem(const QString& toolbar, MenuItem* item)
/*!
* \brief Add the \e item to the toolbar given by \e toolbarId
*
* There is several default toolbar :
* - project
* - file
* - edit
* - search
*
*/
void ActionManager::addToolBarItem(const QString& toolbarId, MenuItem* item)
{
d->_toolBars.insert(toolbar, item);
d->_toolBars.insert(toolbarId, item);
d->_items.insert(item);
}
void ActionManager::addToolBarSeparator(const QString& toolbar)
/*!
* \brief Add a separator into the toolbar
* \sa addToolBarItem()
*/
void ActionManager::addToolBarSeparator(const QString& toolbarId)
{
Separator * separator = new Separator;
addToolBarItem(toolbar, separator);
addToolBarItem(toolbarId, separator);
}
QList< MenuItem* > ActionManager::toolBar(const QString& toolbar) const
//! List all item for the given toolbar (separator included)
QList< MenuItem* > ActionManager::toolBar(const QString& toolbarId) const
{
return d->_toolBars.values(toolbar);
return d->_toolBars.values(toolbarId);
}
//! List all item for the editor popup menu (separator included)
const QList< MenuItem* >& ActionManager::popup() const
{
return d->_popups;
}
//! Add a new item to the editor's popup menu
void ActionManager::addPopupItem(MenuItem* item)
{
d->_popups.append(item);
d->_items.insert(item);
}
//! Add a separator to the editor's popup menu
void ActionManager::addPopupSeparator()
{
Separator * separator = new Separator;
addPopupItem(separator);
}
//! List all item for the project directory dock popup menu (separator included)
const QList< MenuItem* > ActionManager::projectDirectoryPopup() const
{
return d->_directoryProjectPopup;
}
//! Add a new item in the project directory dock popup menu
void ActionManager::addProjectDirectoryPopupItem(MenuItem* item)
{
d->_directoryProjectPopup.append(item);
d->_items.insert(item);
}
//! Add a new separator in the project directory dock popup menu
void ActionManager::addProjectDirectoryPopupSeparator()
{
Separator * separator = new Separator;
addProjectDirectoryPopupItem(separator);
}
void ActionManager::currentEditorChanged(int index)
{
AbstractEditor * editor = index >= 0 ? EditorManager::self()->editor(index) : NULL;
foreach(MenuItem * item, d->_items)
{
Action * action = dynamic_cast<Action*>(item);
if (action)
{
action->setCurrentEditor(editor);
}
}
updateMenuItemState();
}
//! Clear (and delete) old actions and regenerate actions list by calling IXinxPlugin::generateActionMenu()
void ActionManager::generateMenu()
{
QSet<MenuItem*> backupItem = d->_items;
@ -224,14 +288,16 @@ void ActionManager::generateMenu()
emit changed();
qDeleteAll(backupItem);
// In case the menu item are in use
qDeleteAllLater(backupItem);
updateMenuItemState();
}
//! Update the state (visible, enable) of each action (and separator)
void ActionManager::updateMenuItemState()
{
// Mise à jours des statuts des actions
// Update of state of each action
foreach(MenuItem * item, d->_items)
{
Action * action = dynamic_cast<Action*>(item);
@ -255,6 +321,11 @@ void ActionManager::updateMenuItemState()
d->updateSeparatorState(d->_popups);
}
/*!
* \brief Update the project selection for each XinxAction::ProjectAction with \e rows
*
* Call when the selection change in the project directory dock.
*/
void ActionManager::updateProjectSelection(QList< ProjectAction::RowInfo > rows)
{
foreach(MenuItem * item, d->_directoryProjectPopup)

25
framework/actions/actionmanager.h

@ -30,7 +30,7 @@ namespace XinxAction
{
class MenuItem;
class PrivateActionManager;
class ActionManagerPrivate;
class LIBEXPORT ActionManager : public XinxLibSingleton<ActionManager>
{
@ -42,14 +42,14 @@ public:
void insertNameOfMenu(const QString & menu, const QString & name);
QStringList menus() const;
QList<MenuItem*> menu(const QString & menu) const;
void addMenuItem(const QString & menu, MenuItem * item);
void addMenuSeparator(const QString & menu);
QList<MenuItem*> menu(const QString & menuId) const;
void addMenuItem(const QString & menuId, MenuItem * item);
void addMenuSeparator(const QString & menuId);
QStringList toolBars() const;
QList<MenuItem*> toolBar(const QString & toolbar) const;
void addToolBarItem(const QString & toolbar, MenuItem * item);
void addToolBarSeparator(const QString & toolbar);
QList<MenuItem*> toolBar(const QString & toolbarId) const;
void addToolBarItem(const QString & toolbarId, MenuItem * item);
void addToolBarSeparator(const QString & toolbarId);
const QList<MenuItem*> & popup() const;
void addPopupItem(MenuItem * item);
@ -60,23 +60,16 @@ public:
void addProjectDirectoryPopupSeparator();
public slots:
//! Call when a new selection is made in the projectDirectory dock
void updateProjectSelection(QList<XinxAction::ProjectAction::RowInfo> rows);
//! Call plugins and generate list (erase all). emit changed when finish
void generateMenu();
//! Update the state of menu item and the visibility of separator of different section
void updateMenuItemState();
signals:
void changed();
private slots:
virtual void currentEditorChanged(int index);
private:
ActionManager();
PrivateActionManager * d;
friend class PrivateActionManager;
QScopedPointer<ActionManagerPrivate> d;
friend class ActionManagerPrivate;
friend class XinxLibSingleton<ActionManager>;
};

62
framework/actions/actionmanager_p.h

@ -0,0 +1,62 @@
/*
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 ACTIONMANAGER_P_H
#define ACTIONMANAGER_P_H
#include "actionmanager.h"
#include "actioninterface.h"
#include <plugins/xinxpluginsloader.h>
#include <plugins/xinxpluginelement.h>
#include <editors/editormanager.h>
#include <editors/abstracteditor.h>
// Qt header
#include <QMultiHash>
#include <QSet>
namespace XinxAction
{
//! \private
class ActionManagerPrivate : public QObject
{
Q_OBJECT
public:
ActionManagerPrivate();
~ActionManagerPrivate();
ActionManager * _parent;
QHash<QString,QString> _libelles;
QMultiHash<QString,MenuItem*> _menus;
QMultiHash<QString,MenuItem*> _toolBars;
QList<MenuItem*> _popups;
QList<MenuItem*> _directoryProjectPopup;
QSet<MenuItem*> _items;
public slots:
void updateSeparatorState(const QList<MenuItem*> & items);
void currentEditorChanged(int index);
};
}
#endif // ACTIONMANAGER_P_H
Loading…
Cancel
Save