* regionwidget.cpp
* xml.cpp
* xmlwidget: Try to filter in real-time but do not work.
---
GScribo/GScribo.pro.user | 2 -
GScribo/TODO | 65 ++++++++++++++++++++++++++++++++++++
GScribo/XmlWidget/selectionproxy.h | 6 +++-
GScribo/XmlWidget/xmlview.cpp | 3 +-
GScribo/XmlWidget/xmlview.h | 6 +++
GScribo/XmlWidget/xmlwidget.cpp | 10 +----
GScribo/XmlWidget/xmlwidget.h | 5 ---
GScribo/mainwindow.cpp | 4 +--
GScribo/region.h | 15 ++++----
GScribo/regionwidget.cpp | 58 ++++++++++++--------------------
GScribo/regionwidget.h | 7 +++-
GScribo/xml.cpp | 62 ----------------------------------
GScribo/xml.h | 28 +++++++++++++++-
13 files changed, 144 insertions(+), 127 deletions(-)
create mode 100644 GScribo/TODO
diff --git a/GScribo/GScribo.pro.user b/GScribo/GScribo.pro.user
index f152178..ab03cea 100644
--- a/GScribo/GScribo.pro.user
+++ b/GScribo/GScribo.pro.user
@@ -85,7 +85,6 @@
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/lrde/home/stage/froger_a</value>
<value type="QString">LANG=fr_FR.UTF-8</value>
- <value type="QString">LANGUAGE=</value>
<value
type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
<value type="QString">LOGNAME=froger_a</value>
<value
type="QString">OLDPWD=/lrde/home/stage/froger_a/qt</value>
@@ -135,7 +134,6 @@
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/lrde/home/stage/froger_a</value>
<value type="QString">LANG=fr_FR.UTF-8</value>
- <value type="QString">LANGUAGE=</value>
<value
type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
<value type="QString">LOGNAME=froger_a</value>
<value
type="QString">OLDPWD=/lrde/home/stage/froger_a/qt</value>
diff --git a/GScribo/TODO b/GScribo/TODO
new file mode 100644
index 0000000..8e5a474
--- /dev/null
+++ b/GScribo/TODO
@@ -0,0 +1,65 @@
+Concerning the xml widget :
+ - Can modify in real time the proxy with a regular expression. When the user click on a
check box in the region widget, a new regular expression is created an sent to the xml
widget but the proxy is not modified by this regular expression.
+ - In the table tree (the attributes tree), set the max of the header splitter. Currently
it can be moved indefinitely to the right.
+ - Fit the splitter to the content of the first column when an attributes node is
loaded.
+ - My be some color corresponding to the graphics item of the scene.
+
+
+Concerning the scene :
+ - Give the possibility to the user to remove some region.
+ - Can create/ fusion some region : sometimes two line regions are splitted but will not
be.
+ - Optimize the collision between the rectangle item and the regions. Currently it do not
take into account if the region is visible by the view before calculating the collision.
+ - Use OpenGL to speed up graphics rendering (the gui has been developped with Qt 4.7,
OpenGL was still experimental so it was really slow when updating the scene).
+ - May be give the possibility to change the color.
+
+
+Concerning the region widget :
+ - As stated bove, connect this widget with the xml widget.
+ - Find a better way to get region names and color.
+
+
+Concerning xml file :
+ - Stop using the static array representation of the internal data structure for graphics
region.
+ - find a better way to run through all node representing a graphics item without knowing
it in advance. For exemple, the xml file looks like this :
+
+
+
+ -Metadata
+ |- ...
+ |- ...
+ |- ... Some informations about the creator etc...
+ -Page
+ |- TextRegion
+
+ |- Coords
+
+ |- Points
+ ... ...
+
+ |- Line
+
+ |- Coords
+
+ |- Points
+ ...
+ ... <---- All the graphical stuff is here.
+ ...
+
+ |- VerticalSeparatorRegion
+
+ |- Coords
+
+ |- Points
+ ...
+ ...
+ ...
+
+
+ Graphical items are after pages and node containing informations looks like : *Region
-> Coords -> Points and is located in the root node named "Page" so there
is a way to find graphical item without knowing their location and name before.
+
+
+
+Concerning tool bar :
+ - Create icons to replace text.
+ - Add new functionnalities.
+
diff --git a/GScribo/XmlWidget/selectionproxy.h b/GScribo/XmlWidget/selectionproxy.h
index 8ee45f8..604c46a 100644
--- a/GScribo/XmlWidget/selectionproxy.h
+++ b/GScribo/XmlWidget/selectionproxy.h
@@ -17,6 +17,7 @@ class SelectionProxy :
inline void beginResetModel();
inline void endResetModel();
+ inline void invalidateFilter();
protected:
inline bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent)
const;
@@ -26,7 +27,7 @@ class SelectionProxy :
};
inline bool SelectionProxy::filterAcceptsRow(int sourceRow, const QModelIndex&
sourceParent) const
-{ return isAllDisplayed_ || sourceModel()->index(sourceRow, 0,
sourceParent).data(filterRole()).value<XmlItem *>()->isVisible(); }
+{ return QSortFilterProxyModel::filterAcceptsRow(sourceRow, sourceParent) &&
(isAllDisplayed_ || sourceModel()->index(sourceRow, 0,
sourceParent).data(Qt::UserRole+2).value<XmlItem *>()->isVisible()); }
inline void SelectionProxy::beginResetModel()
{ isAllDisplayed_ = false; QSortFilterProxyModel::beginResetModel(); }
@@ -40,4 +41,7 @@ inline void SelectionProxy::displayAll()
inline bool SelectionProxy::isAllDisplayed()
{ return isAllDisplayed_; }
+inline void SelectionProxy::invalidateFilter()
+{ QSortFilterProxyModel::invalidateFilter(); }
+
#endif // SELECTIONPROXY_H
diff --git a/GScribo/XmlWidget/xmlview.cpp b/GScribo/XmlWidget/xmlview.cpp
index e92c877..4bd072a 100644
--- a/GScribo/XmlWidget/xmlview.cpp
+++ b/GScribo/XmlWidget/xmlview.cpp
@@ -3,7 +3,8 @@
XmlView::XmlView(QWidget *parent) :
QTreeView(parent)
{
- proxy_.setFilterRole(Qt::UserRole+2);
+ proxy_.setFilterRole(Qt::UserRole);
+ proxy_.setDynamicSortFilter(true);
setUniformRowHeights(true);
setItemDelegate(new XmlDelegate(Qt::UserRole));
diff --git a/GScribo/XmlWidget/xmlview.h b/GScribo/XmlWidget/xmlview.h
index d7f3d1e..fef7386 100644
--- a/GScribo/XmlWidget/xmlview.h
+++ b/GScribo/XmlWidget/xmlview.h
@@ -37,8 +37,11 @@ class XmlView :
public slots:
inline void display(QList<XmlItem *> displayedItems);
inline void displayOnly(QList<XmlItem *> displayedItems);
+
inline void displayAll();
+ inline void setFilterString(const QString& filterString);
+
signals:
void loadAttributes(const XmlAttributes& xmlAttributes);
@@ -67,6 +70,9 @@ inline void XmlView::displayAll()
inline QList<XmlItem *> XmlView::selectedItems() const
{ return transform(selectedIndexes()); }
+inline void XmlView::setFilterString(const QString& filterString)
+{ proxy_.setFilterRegExp(QRegExp(filterString, Qt::CaseSensitive));
proxy_.invalidateFilter(); }
+
inline void XmlView::setModel(QAbstractItemModel *model)
{ proxy_.setSourceModel(model); QTreeView::setModel(&proxy_); }
diff --git a/GScribo/XmlWidget/xmlwidget.cpp b/GScribo/XmlWidget/xmlwidget.cpp
index cc74fe0..8584052 100644
--- a/GScribo/XmlWidget/xmlwidget.cpp
+++ b/GScribo/XmlWidget/xmlwidget.cpp
@@ -3,11 +3,10 @@
XmlWidget::XmlWidget(QWidget *parent) :
QSplitter(Qt::Horizontal, parent)
{
- basePattern_ = "Page";
- proxy_.setFilterFixedString(basePattern_);
+ proxy_.setFilterRegExp(QRegExp("(?:Page|.Region|Line)",
Qt::CaseSensitive));
+ proxy_.setDynamicSortFilter(true);
proxy_.setFilterRole(Qt::UserRole);
proxy_.setSourceModel(&model_);
- proxy_.setDynamicSortFilter(true);
view_.setModel(&proxy_);
@@ -24,11 +23,6 @@ XmlWidget::XmlWidget(QWidget *parent) :
connect(&view_, SIGNAL(loadAttributes(XmlAttributes)), &attributesModel_,
SLOT(load(XmlAttributes)));
}
-void XmlWidget::setFilterString(const QString& filterString)
-{
- proxy_.setFilterFixedString(basePattern_ + '|' + filterString);
-}
-
void XmlWidget::changeView(XmlItem *rootItem)
{
attributesModel_.reset();
diff --git a/GScribo/XmlWidget/xmlwidget.h b/GScribo/XmlWidget/xmlwidget.h
index c9817c8..289b155 100644
--- a/GScribo/XmlWidget/xmlwidget.h
+++ b/GScribo/XmlWidget/xmlwidget.h
@@ -31,8 +31,6 @@ class XmlWidget :
private:
QSortFilterProxyModel proxy_;
- SelectionProxy proxy2_;
- QString basePattern_;
XmlModel model_;
AttributesModel attributesModel_;
@@ -40,9 +38,6 @@ class XmlWidget :
XmlView view_;
QTableView attributes_;
- public slots:
- void setFilterString(const QString& filterString);
-
private slots:
inline void loadAttributes(const QModelIndex& index);
};
diff --git a/GScribo/mainwindow.cpp b/GScribo/mainwindow.cpp
index e939694..bcb52d2 100644
--- a/GScribo/mainwindow.cpp
+++ b/GScribo/mainwindow.cpp
@@ -9,7 +9,6 @@ MainWindow::MainWindow(QWidget *parent) :
setWindowTitle(tr("GScribo"));
- xml_.fillSettings();
initGraphicsRegion();
initTextRegion();
initXmlWidget();
@@ -72,7 +71,6 @@ void MainWindow::initRegionWidget()
void MainWindow::initXmlWidget()
{
- xmlWidget_.setFilterString(regionWidget_.filterString());
dockXml_.setWindowTitle("Xml");
dockXml_.setFeatures(QDockWidget::DockWidgetClosable |
QDockWidget::DockWidgetMovable);
dockXml_.setWidget(&xmlWidget_);
@@ -120,7 +118,7 @@ void MainWindow::connectWidgets()
// Connect the scene with the region widget.
connect(®ionWidget_, SIGNAL(checkStateChanged(GraphicsRegion::Id,bool)),
&scene_, SLOT(setVisible(GraphicsRegion::Id,bool)));
// Connect the xml widget with the region widget.
- connect(®ionWidget_, SIGNAL(checkStateChanged(QString)), &xmlWidget_,
SLOT(setFilterString(QString)));
+ connect(®ionWidget_, SIGNAL(checkStateChanged(QString)), xmlWidget_.view(),
SLOT(setFilterString(QString)));
/*connect(&runner, SIGNAL(progress()), &progressDialog, SLOT(run()));
connect(&runner, SIGNAL(new_progress_max_value(int)), &progressDialog,
SLOT(setMaximum(int)));
diff --git a/GScribo/region.h b/GScribo/region.h
index d1fcee7..ee8d836 100644
--- a/GScribo/region.h
+++ b/GScribo/region.h
@@ -8,18 +8,13 @@ namespace GraphicsRegion
// WARNING : The order is important.
enum Id
{
- None,
-
- Text,
TextRegion,
Line,
- Separators,
VerticalSeparator,
HorizontalSeparator,
WhiteSpaceSeparator,
- Miscellaneous,
Image,
Noise,
Table,
@@ -27,9 +22,15 @@ namespace GraphicsRegion
Graphic,
Chart,
- Typology,
Baseline,
- Meanline
+ Meanline,
+
+ Text,
+ Separators,
+ Miscellaneous,
+ Typology,
+
+ None
};
struct Data
diff --git a/GScribo/regionwidget.cpp b/GScribo/regionwidget.cpp
index b343b3f..107ac80 100644
--- a/GScribo/regionwidget.cpp
+++ b/GScribo/regionwidget.cpp
@@ -1,5 +1,4 @@
#include "regionwidget.h"
-#include <QDebug>
RegionWidget::RegionWidget(QWidget *parent) :
QTreeWidget(parent)
@@ -7,39 +6,34 @@ RegionWidget::RegionWidget(QWidget *parent) :
setHeaderHidden(true);
setSelectionMode(QAbstractItemView::NoSelection);
- Configs *const configs = Configs::getInstance();
-
- configs->beginGroup("region");
-
- foreach(QString group, configs->childGroups())
- {
- configs->beginGroup(group);
- GraphicsRegion::Id region =
static_cast<GraphicsRegion::Id>(group.toInt());
- QTreeWidgetItem *rootItem =
createItem(static_cast<GraphicsRegion::Id>(group.toInt()));
-
- foreach(QString subgroup, configs->childGroups())
-
rootItem->addChild(createItem(static_cast<GraphicsRegion::Id>(subgroup.toInt())));
-
- addTopLevelItem(rootItem);
- configs->endGroup();
- }
-
- configs->endGroup();
+ addTopLevelItem(createRoot("Text", GraphicsRegion::Text,
GraphicsRegion::TextRegion, GraphicsRegion::Line));
+ addTopLevelItem(createRoot("Typological Lines", GraphicsRegion::Typology,
GraphicsRegion::Baseline, GraphicsRegion::Meanline));
+ addTopLevelItem(createRoot("Separators", GraphicsRegion::Separators,
GraphicsRegion::VerticalSeparator, GraphicsRegion::WhiteSpaceSeparator));
+ addTopLevelItem(createRoot("Miscellaneous", GraphicsRegion::Miscellaneous,
GraphicsRegion::Image, GraphicsRegion::Chart));
expandAll();
connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this,
SLOT(checkStateChanged(QTreeWidgetItem*)));
}
-QTreeWidgetItem *RegionWidget::createItem(const GraphicsRegion::Id& region)
+QTreeWidgetItem *RegionWidget::createRoot(const QString& text, const
GraphicsRegion::Id& region, const GraphicsRegion::Id& begin, const
GraphicsRegion::Id& end)
{
- Configs *const configs = Configs::getInstance();
+ // Create root.
+ QTreeWidgetItem *rootItem = createItem(text, region);
- QTreeWidgetItem *item = new QTreeWidgetItem;
+ // Fill root with corresponding childs.
+ for(int region_ = begin; region_ <= end; region_++)
+ fillRoot(rootItem, static_cast<GraphicsRegion::Id>(region_));
- item->setText(0, configs->regionName(region));
- item->setCheckState(0, configs->isRegionChecked(region) ? Qt::Checked :
Qt::Unchecked);
- item->setBackgroundColor(0, configs->regionColor(region));
+ return rootItem;
+}
+
+QTreeWidgetItem *RegionWidget::createItem(const QString& text, const
GraphicsRegion::Id& region, const QColor& color)
+{
+ QTreeWidgetItem *item = new QTreeWidgetItem;
+ item->setText(0, text);
+ item->setCheckState(0, Qt::Checked);
+ item->setBackgroundColor(0, color);
// Store graphical id in the object to recognize it afterward.
item->setData(0, Qt::UserRole, static_cast<int>(region));
@@ -48,14 +42,9 @@ QTreeWidgetItem *RegionWidget::createItem(const GraphicsRegion::Id&
region)
void RegionWidget::checkStateChanged(QTreeWidgetItem *item)
{
- GraphicsRegion::Id region = static_cast<GraphicsRegion::Id>(item->data(0,
Qt::UserRole).toInt());
- bool isChecked;
-
// If it's a root item, go to childs.
if(item->childCount() != 0)
{
- isChecked = item->checkState(0) == Qt::Checked ? true : false;
-
QTreeWidgetItem *child;
for(int i = 0; i < item->childCount(); i++)
{
@@ -68,17 +57,14 @@ void RegionWidget::checkStateChanged(QTreeWidgetItem *item)
if(item->checkState(0) == Qt::Checked)
{
filterString_.append('|' + item->text(0));
- isChecked = true;
+ emit checkStateChanged(static_cast<GraphicsRegion::Id>(item->data(0,
Qt::UserRole).toInt()), true);
}
else
{
filterString_.remove('|' + item->text(0), Qt::CaseSensitive);
- isChecked = false;
+ emit checkStateChanged(static_cast<GraphicsRegion::Id>(item->data(0,
Qt::UserRole).toInt()), false);
}
- emit checkStateChanged(region, isChecked);
- emit checkStateChanged(filterString());
+ //Zemit checkStateChanged(filterString_);
}
-
- Configs::getInstance()->setRegionChecked(region, isChecked);
}
diff --git a/GScribo/regionwidget.h b/GScribo/regionwidget.h
index 5ab955d..aaa6eda 100644
--- a/GScribo/regionwidget.h
+++ b/GScribo/regionwidget.h
@@ -17,7 +17,9 @@ class RegionWidget :
inline QString filterString() const;
private:
- QTreeWidgetItem *createItem(const GraphicsRegion::Id& region);
+ QTreeWidgetItem *createRoot(const QString& text, const
GraphicsRegion::Id& region, const GraphicsRegion::Id& begin, const
GraphicsRegion::Id& end);
+ QTreeWidgetItem *createItem(const QString& text, const
GraphicsRegion::Id& region, const QColor& color = QColor::fromRgb(255, 255,
255));
+ inline void fillRoot(QTreeWidgetItem *rootItem, const GraphicsRegion::Id&
region);
QString filterString_;
@@ -29,6 +31,9 @@ class RegionWidget :
void checkStateChanged(const QString& filterString);
};
+inline void RegionWidget::fillRoot(QTreeWidgetItem *rootItem, const
GraphicsRegion::Id& region)
+{ GraphicsRegion::Data data = Xml::dataFromRegion(region);
filterString_.append('|' + data.name); rootItem->addChild(createItem(data.name,
region, data.color)); }
+
inline QString RegionWidget::filterString() const
{ return filterString_.right(filterString_.count()-1); }
diff --git a/GScribo/xml.cpp b/GScribo/xml.cpp
index 932fdad..00d6c56 100644
--- a/GScribo/xml.cpp
+++ b/GScribo/xml.cpp
@@ -1,28 +1,5 @@
#include "xml.h"
-// WARNING : The order is VERY IMPORTANT (depending on the enum).
-static const GraphicsRegion::Data datas_[] =
-{
- /* COLOR | NAME |
REGION | PARENT | Z */
- { QColor::fromRgb(255, 255, 255), "Text",
GraphicsRegion::Text, GraphicsRegion::None, 0 },
- { QColor::fromRgb(0, 100, 0, 90), "TextRegion",
GraphicsRegion::TextRegion, GraphicsRegion::Text, 1 },
- { QColor::fromRgb(255, 0, 0, 90), "Line",
GraphicsRegion::Line, GraphicsRegion::Text, 2 },
- { QColor::fromRgb(255, 255, 255), "Separators",
GraphicsRegion::Separators, GraphicsRegion::None, 0 },
- { QColor::fromRgb(0, 0, 255, 90), "VerticalSeparatorRegion",
GraphicsRegion::VerticalSeparator, GraphicsRegion::Separators, 2 },
- { QColor::fromRgb(0, 0, 255, 90), "HorizontalSeparatorRegion",
GraphicsRegion::HorizontalSeparator, GraphicsRegion::Separators, 2 },
- { QColor::fromRgb(0, 0, 128, 90), "WhitespaceSeparatorRegion",
GraphicsRegion::WhiteSpaceSeparator, GraphicsRegion::Separators, 2 },
- { QColor::fromRgb(255, 255, 255), "Miscellaneous",
GraphicsRegion::Miscellaneous, GraphicsRegion::None, 0 },
- { QColor::fromRgb(255, 120, 0, 90), "ImageRegion",
GraphicsRegion::Image, GraphicsRegion::Miscellaneous, 1 },
- { QColor::fromRgb(43, 39, 128, 90), "NoiseRegion",
GraphicsRegion::Noise, GraphicsRegion::Miscellaneous, 2 },
- { QColor::fromRgb(220, 246, 0, 90), "TableRegion",
GraphicsRegion::Table, GraphicsRegion::Miscellaneous, 2 },
- { QColor::fromRgb(170, 0, 255, 90), "MathsRegion",
GraphicsRegion::Maths, GraphicsRegion::Miscellaneous, 2 },
- { QColor::fromRgb(255, 0, 144, 90), "GraphicsRegion",
GraphicsRegion::Graphic, GraphicsRegion::Miscellaneous, 2 },
- { QColor::fromRgb(0, 204, 255, 90), "ChartRegion",
GraphicsRegion::Chart, GraphicsRegion::Miscellaneous, 2 },
- { QColor::fromRgb(255, 255, 255), "Typological Lines",
GraphicsRegion::Typology, GraphicsRegion::None, 0 },
- { QColor::fromRgb(128, 0, 255), "Baseline",
GraphicsRegion::Baseline, GraphicsRegion::Typology, 3 },
- { QColor::fromRgb(128, 0, 255), "Meanline",
GraphicsRegion::Meanline, GraphicsRegion::Typology, 3 }
-};
-
Xml::Xml(const QString& filename)
{
filename_ = filename;
@@ -45,45 +22,6 @@ QString Xml::getPath(const QString& filename)
return configs->generalSaveXmlCustomDirPath() + "/" + xmlPath;
}
-void Xml::fillSettings()
-{
- Configs *const configs = Configs::getInstance();
-
- // Check if the configuration file has already been created.
- if(!configs->isRegionInit())
- {
- configs->beginGroup("region");
- configs->setValue("init", true);
-
- for(int i = 0; i < 17; i++)
- {
- // Create group : region\father\current\...
- if(datas_[i].parent != GraphicsRegion::None)
- {
-
configs->beginGroup(QString::number(datas_[datas_[i].parent].region));
- configs->beginGroup(QString::number(datas_[i].region));
-
- configs->setValue("color", datas_[i].color);
- configs->setValue("name", datas_[i].name);
-
- configs->endGroup();
- configs->endGroup();
- }
- else
- {
- configs->beginGroup(QString::number(datas_[i].region));
-
- configs->setValue("color", datas_[i].color);
- configs->setValue("name", datas_[i].name);
-
- configs->endGroup();
- }
- }
-
- configs->endGroup();
- }
-}
-
void Xml::load(const QString& filename)
{
if(filename.isEmpty())
diff --git a/GScribo/xml.h b/GScribo/xml.h
index 844d043..5f3575a 100644
--- a/GScribo/xml.h
+++ b/GScribo/xml.h
@@ -15,6 +15,29 @@
#include "configs.h"
#include "region.h"
+// WARNING : The order is VERY IMPORTANT (depending on the enum).
+static const GraphicsRegion::Data datas_[] =
+{
+ /* COLOR | NAME |
REGION | PARENT | Z */
+ { QColor::fromRgb(0, 100, 0, 90), "TextRegion",
GraphicsRegion::TextRegion, GraphicsRegion::Text, 1 },
+ { QColor::fromRgb(255, 0, 0, 90), "Line",
GraphicsRegion::Line, GraphicsRegion::Text, 2 },
+ { QColor::fromRgb(0, 0, 255, 90), "VerticalSeparatorRegion",
GraphicsRegion::VerticalSeparator, GraphicsRegion::Separators, 2 },
+ { QColor::fromRgb(0, 0, 255, 90), "HorizontalSeparatorRegion",
GraphicsRegion::HorizontalSeparator, GraphicsRegion::Separators, 2 },
+ { QColor::fromRgb(0, 0, 128, 90), "WhitespaceSeparatorRegion",
GraphicsRegion::WhiteSpaceSeparator, GraphicsRegion::Separators, 2 },
+ { QColor::fromRgb(255, 120, 0, 90), "ImageRegion",
GraphicsRegion::Image, GraphicsRegion::Miscellaneous, 1 },
+ { QColor::fromRgb(43, 39, 128, 90), "NoiseRegion",
GraphicsRegion::Noise, GraphicsRegion::Miscellaneous, 2 },
+ { QColor::fromRgb(220, 246, 0, 90), "TableRegion",
GraphicsRegion::Table, GraphicsRegion::Miscellaneous, 2 },
+ { QColor::fromRgb(170, 0, 255, 90), "MathsRegion",
GraphicsRegion::Maths, GraphicsRegion::Miscellaneous, 2 },
+ { QColor::fromRgb(255, 0, 144, 90), "GraphicsRegion",
GraphicsRegion::Graphic, GraphicsRegion::Miscellaneous, 2 },
+ { QColor::fromRgb(0, 204, 255, 90), "ChartRegion",
GraphicsRegion::Chart, GraphicsRegion::Miscellaneous, 2 },
+ { QColor::fromRgb(128, 0, 255), "Baseline",
GraphicsRegion::Baseline, GraphicsRegion::Typology, 3 },
+ { QColor::fromRgb(128, 0, 255), "Meanline",
GraphicsRegion::Meanline, GraphicsRegion::Typology, 3 },
+ { QColor::fromRgb(255, 255, 255), "Text",
GraphicsRegion::Text, GraphicsRegion::None, 0 },
+ { QColor::fromRgb(255, 255, 255), "Separators",
GraphicsRegion::Separators, GraphicsRegion::None, 0 },
+ { QColor::fromRgb(255, 255, 255), "Miscellaneous",
GraphicsRegion::Miscellaneous, GraphicsRegion::None, 0 },
+ { QColor::fromRgb(255, 255, 255), "Typological Lines",
GraphicsRegion::Typology, GraphicsRegion::None, 0 }
+};
+
class Xml
{
public:
@@ -29,7 +52,7 @@ class Xml
static QString getPath(const QString& filename);
void load(const QString& filename);
- void fillSettings();
+ inline static GraphicsRegion::Data dataFromRegion(GraphicsRegion::Id region);
private:
XmlItem *init(const QDomElement& root, XmlItem *rootTreeItem);
@@ -57,4 +80,7 @@ inline QDomDocument Xml::document() const
inline QString Xml::filename() const
{ return filename_; }
+inline GraphicsRegion::Data Xml::dataFromRegion(GraphicsRegion::Id region)
+{ return datas_[region]; }
+
#endif // XML_H
--
1.7.2.5