Olena-patches
Threads by month
- ----- 2025 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- 9625 discussions
16 Nov '10
* demo/viewer/property_widget.cc,
* demo/viewer/property_widget.hh,
* demo/viewer/domitem.cc,
* demo/viewer/domitem.hh,
* demo/viewer/dommodel.cc,
* demo/viewer/dommodel.hh: Delete.
* demo/viewer/Makefile.am
* demo/viewer/browser_widget.cc: Fix, xmlc extension instead of xmle.
* demo/viewer/key_widget.cc,
* demo/viewer/step_widget.cc,
* demo/viewer/step_widget.hh,
* demo/viewer/image_scene.cc,
* demo/viewer/image_scene.hh,
* demo/viewer/help_dialog.cc,
* demo/viewer/image_region.cc,
* demo/viewer/image_region.hh,
* demo/viewer/image_region.hxx: Small changes.
* demo/viewer/viewer.cc,
* demo/viewer/viewer.hh: Add base 64 cropped pictures support, text viewer
and change XML parsing.
* demo/viewer/xml_widget.cc,
* demo/viewer/xml_widget.hh: Change widget, tree and attributes are together.
---
scribo/ChangeLog | 33 ++
scribo/demo/viewer/Makefile.am | 5 +-
scribo/demo/viewer/browser_widget.cc | 2 +-
scribo/demo/viewer/domitem.cc | 98 ------
scribo/demo/viewer/domitem.hh | 75 -----
scribo/demo/viewer/dommodel.cc | 198 ------------
scribo/demo/viewer/dommodel.hh | 85 -----
scribo/demo/viewer/help_dialog.cc | 6 +-
scribo/demo/viewer/image_region.cc | 6 +-
scribo/demo/viewer/image_region.hh | 9 +-
scribo/demo/viewer/image_region.hxx | 7 -
scribo/demo/viewer/image_scene.cc | 20 +-
scribo/demo/viewer/image_scene.hh | 4 +-
scribo/demo/viewer/key_widget.cc | 2 +-
scribo/demo/viewer/property_widget.cc | 73 -----
scribo/demo/viewer/property_widget.hh | 41 ---
scribo/demo/viewer/step_widget.cc | 4 +-
scribo/demo/viewer/step_widget.hh | 1 +
scribo/demo/viewer/viewer.cc | 547 +++++++++++++++++++--------------
scribo/demo/viewer/viewer.hh | 15 +-
scribo/demo/viewer/xml_widget.cc | 143 ++++++++-
scribo/demo/viewer/xml_widget.hh | 15 +-
22 files changed, 545 insertions(+), 844 deletions(-)
delete mode 100644 scribo/demo/viewer/domitem.cc
delete mode 100644 scribo/demo/viewer/domitem.hh
delete mode 100644 scribo/demo/viewer/dommodel.cc
delete mode 100644 scribo/demo/viewer/dommodel.hh
delete mode 100644 scribo/demo/viewer/property_widget.cc
delete mode 100644 scribo/demo/viewer/property_widget.hh
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 1c9bdbd..0d78dc7 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,36 @@
+2010-07-20 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
+
+ Some changes in XML interface.
+
+ * demo/viewer/property_widget.cc,
+ * demo/viewer/property_widget.hh,
+ * demo/viewer/domitem.cc,
+ * demo/viewer/domitem.hh,
+ * demo/viewer/dommodel.cc,
+ * demo/viewer/dommodel.hh: Delete.
+
+ * demo/viewer/Makefile.am
+
+ * demo/viewer/browser_widget.cc: Fix, xmlc extension instead of xmle.
+
+ * demo/viewer/key_widget.cc,
+ * demo/viewer/step_widget.cc,
+ * demo/viewer/step_widget.hh,
+ * demo/viewer/image_scene.cc,
+ * demo/viewer/image_scene.hh,
+ * demo/viewer/help_dialog.cc,
+ * demo/viewer/image_region.cc,
+ * demo/viewer/image_region.hh,
+ * demo/viewer/image_region.hxx: Small changes.
+
+ * demo/viewer/viewer.cc,
+ * demo/viewer/viewer.hh: Add base 64 cropped pictures support, text viewer
+ and change XML parsing.
+
+ * demo/viewer/xml_widget.cc,
+ * demo/viewer/xml_widget.hh: Change widget, tree and attributes are together.
+
+
2010-07-16 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
Base 64 support in Qt interface (xmlc extension)
diff --git a/scribo/demo/viewer/Makefile.am b/scribo/demo/viewer/Makefile.am
index eec19b9..d0f0d6f 100644
--- a/scribo/demo/viewer/Makefile.am
+++ b/scribo/demo/viewer/Makefile.am
@@ -14,6 +14,7 @@
include $(top_srcdir)/build-aux/autotroll.mk
+
bin_PROGRAMS = scribo-viewer
scribo_viewer_SOURCES = $(BUILT_SOURCES) \
viewer.cc \
@@ -40,16 +41,14 @@ BUILT_SOURCES = viewer.moc.cc \
image_widget.moc.cc \
xml_widget.moc.cc \
key_widget.moc.cc \
- property_widget.moc.cc \
browser_widget.moc.cc \
image_scene.moc.cc \
image_view.moc.cc \
- dommodel.moc.cc \
- domitem.moc.cc \
image_region.moc.cc \
help_dialog.moc.cc \
step_widget.moc.cc
+
noinst_HEADERS = viewer.hh \
viewer.hxx \
image_widget.hh \
diff --git a/scribo/demo/viewer/browser_widget.cc b/scribo/demo/viewer/browser_widget.cc
index 220a719..43de1e2 100644
--- a/scribo/demo/viewer/browser_widget.cc
+++ b/scribo/demo/viewer/browser_widget.cc
@@ -68,7 +68,7 @@ BrowserWidget::BrowserWidget(QDirModel* files, QString dir)
files_filters << "*.png" << "*.jpg"
<< "*.tif" << "*.ppm"
<< "*.pgm" << "*.pbm"
- << "*.pnm" << "*.xmle";
+ << "*.pnm" << "*.xmlc";
files->setNameFilters(files_filters);
}
diff --git a/scribo/demo/viewer/domitem.cc b/scribo/demo/viewer/domitem.cc
deleted file mode 100644
index 66e989a..0000000
--- a/scribo/demo/viewer/domitem.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
- ** Contact: Qt Software Information (qt-info(a)nokia.com)
- **
- ** This file is part of the example classes of the Qt Toolkit.
- **
- ** Commercial Usage
- ** Licensees holding valid Qt Commercial licenses may use this file in
- ** accordance with the Qt Commercial License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Nokia.
- **
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License versions 2.0 or 3.0 as published by the Free
- ** Software Foundation and appearing in the file LICENSE.GPL included in
- ** the packaging of this file. Please review the following information
- ** to ensure GNU General Public Licensing requirements will be met:
- ** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
- ** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
- ** exception, Nokia gives you certain additional rights. These rights
- ** are described in the Nokia Qt GPL Exception version 1.3, included in
- ** the file GPL_EXCEPTION.txt in this package.
- **
- ** Qt for Windows(R) Licensees
- ** As a special exception, Nokia, as the sole copyright holder for Qt
- ** Designer, grants users of the Qt/Eclipse Integration plug-in the
- ** right for the Qt/Eclipse Integration to link to functionality
- ** provided by Qt Designer and its related libraries.
- **
- ** If you are unsure which license is appropriate for your use, please
- ** contact the sales department at qt-sales(a)nokia.com.
- **
- ****************************************************************************/
-
-//
-// Document layout viewer.
-//
-// Copyright (C) 2009 Florent D'Halluin.
-//
-// 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 2
-// of the License, or (at your option) any later version.
-//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
-//
-
-#include <QtXml>
-
-#include "domitem.hh"
-
-DomItem::DomItem(QDomNode &node, int row, DomItem *parent)
-{
- domNode = node;
- // Record the item's location within its parent.
- rowNumber = row;
- parentItem = parent;
-}
-
-DomItem::~DomItem()
-{
- QHash<int,DomItem*>::iterator it;
- for (it = childItems.begin(); it != childItems.end(); ++it)
- delete it.value();
-}
-
-QDomNode DomItem::node() const
-{
- return domNode;
-}
-
-DomItem *DomItem::parent()
-{
- return parentItem;
-}
-
-DomItem *DomItem::child(int i)
-{
- if (childItems.contains(i))
- return childItems[i];
-
- if (i >= 0 && i < domNode.childNodes().count()) {
- QDomNode childNode = domNode.childNodes().item(i);
- DomItem *childItem = new DomItem(childNode, i, this);
- childItems[i] = childItem;
- return childItem;
- }
- return 0;
-}
-
-int DomItem::row()
-{
- return rowNumber;
-}
diff --git a/scribo/demo/viewer/domitem.hh b/scribo/demo/viewer/domitem.hh
deleted file mode 100644
index a5c22cc..0000000
--- a/scribo/demo/viewer/domitem.hh
+++ /dev/null
@@ -1,75 +0,0 @@
- /****************************************************************************
- **
- ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
- ** Contact: Qt Software Information (qt-info(a)nokia.com)
- **
- ** This file is part of the example classes of the Qt Toolkit.
- **
- ** Commercial Usage
- ** Licensees holding valid Qt Commercial licenses may use this file in
- ** accordance with the Qt Commercial License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Nokia.
- **
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License versions 2.0 or 3.0 as published by the Free
- ** Software Foundation and appearing in the file LICENSE.GPL included in
- ** the packaging of this file. Please review the following information
- ** to ensure GNU General Public Licensing requirements will be met:
- ** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
- ** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
- ** exception, Nokia gives you certain additional rights. These rights
- ** are described in the Nokia Qt GPL Exception version 1.3, included in
- ** the file GPL_EXCEPTION.txt in this package.
- **
- ** Qt for Windows(R) Licensees
- ** As a special exception, Nokia, as the sole copyright holder for Qt
- ** Designer, grants users of the Qt/Eclipse Integration plug-in the
- ** right for the Qt/Eclipse Integration to link to functionality
- ** provided by Qt Designer and its related libraries.
- **
- ** If you are unsure which license is appropriate for your use, please
- ** contact the sales department at qt-sales(a)nokia.com.
- **
- ****************************************************************************/
-
-//
-// Document layout viewer.
-//
-// Copyright (C) 2009 Florent D'Halluin.
-//
-// 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 2
-// of the License, or (at your option) any later version.
-//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
-//
-
-#ifndef DOMITEM_H
-#define DOMITEM_H
-
-#include <QDomNode>
-#include <QHash>
-
-class DomItem
-{
-public:
- DomItem(QDomNode &node, int row, DomItem *parent = 0);
- ~DomItem();
- DomItem *child(int i);
- DomItem *parent();
- QDomNode node() const;
- int row();
-
-private:
- QDomNode domNode;
- QHash<int,DomItem*> childItems;
- DomItem *parentItem;
- int rowNumber;
-};
-
-#endif
diff --git a/scribo/demo/viewer/dommodel.cc b/scribo/demo/viewer/dommodel.cc
deleted file mode 100644
index baaf9a7..0000000
--- a/scribo/demo/viewer/dommodel.cc
+++ /dev/null
@@ -1,198 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
- ** Contact: Qt Software Information (qt-info(a)nokia.com)
- **
- ** This file is part of the example classes of the Qt Toolkit.
- **
- ** Commercial Usage
- ** Licensees holding valid Qt Commercial licenses may use this file in
- ** accordance with the Qt Commercial License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Nokia.
- **
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License versions 2.0 or 3.0 as published by the Free
- ** Software Foundation and appearing in the file LICENSE.GPL included in
- ** the packaging of this file. Please review the following information
- ** to ensure GNU General Public Licensing requirements will be met:
- ** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
- ** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
- ** exception, Nokia gives you certain additional rights. These rights
- ** are described in the Nokia Qt GPL Exception version 1.3, included in
- ** the file GPL_EXCEPTION.txt in this package.
- **
- ** Qt for Windows(R) Licensees
- ** As a special exception, Nokia, as the sole copyright holder for Qt
- ** Designer, grants users of the Qt/Eclipse Integration plug-in the
- ** right for the Qt/Eclipse Integration to link to functionality
- ** provided by Qt Designer and its related libraries.
- **
- ** If you are unsure which license is appropriate for your use, please
- ** contact the sales department at qt-sales(a)nokia.com.
- **
- ****************************************************************************/
-
-//
-// Document layout viewer.
-//
-// Copyright (C) 2009 Florent D'Halluin.
-//
-// 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 2
-// of the License, or (at your option) any later version.
-//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
-//
-
-#include <QtGui>
-#include <QtXml>
-
-#include "domitem.hh"
-#include "dommodel.hh"
-
-DomModel::DomModel(QDomDocument document, QObject *parent)
- : QAbstractItemModel(parent), domDocument(document)
-{
- rootItem = new DomItem(domDocument, 0);
-}
-
-DomModel::~DomModel()
-{
- delete rootItem;
-}
-
-int DomModel::columnCount(const QModelIndex &/*parent*/) const
-{
- return 3;
-}
-
-QVariant DomModel::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid())
- return QVariant();
-
- DomItem *item = static_cast<DomItem*>(index.internalPointer());
- QDomNode node = item->node();
- QDomNamedNodeMap attributeMap = node.attributes();
-
- if (role == Qt::DisplayRole)
- {
- QStringList attributes;
-
- switch (index.column())
- {
- case 0:
- return node.nodeName();
- case 1:
- for (int i = 0; i < attributeMap.count(); ++i)
- {
- QDomNode attribute = attributeMap.item(i);
- attributes << attribute.nodeName() + "=\""
- + attribute.nodeValue() + "\"";
- }
- return attributes.join(" ");
- case 2:
- return node.nodeValue().split("\n").join(" ");
- default:
- return QVariant();
- }
- }
- else if (role == Qt::UserRole)
- {
- QMap<QString, QVariant> attributes;
- switch (index.column())
- {
- case 1:
- for (int i = 0; i < attributeMap.count(); ++i)
- {
- QDomNode attribute = attributeMap.item(i);
- attributes[attribute.nodeName()] = attribute.nodeValue();
- }
- return attributes;
- default:
- return QVariant();
- }
- }
- return QVariant();
-}
-
-Qt::ItemFlags DomModel::flags(const QModelIndex &index) const
-{
- if (!index.isValid())
- return 0;
-
- return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
-}
-
-QVariant DomModel::headerData(int section, Qt::Orientation orientation,
- int role) const
-{
- if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
- switch (section) {
- case 0:
- return tr("Name");
- case 1:
- return tr("Attributes");
- case 2:
- return tr("Value");
- default:
- return QVariant();
- }
- }
-
- return QVariant();
-}
-
-QModelIndex DomModel::index(int row, int column, const QModelIndex &parent)
- const
-{
- if (!hasIndex(row, column, parent))
- return QModelIndex();
-
- DomItem *parentItem;
-
- if (!parent.isValid())
- parentItem = rootItem;
- else
- parentItem = static_cast<DomItem*>(parent.internalPointer());
-
- DomItem *childItem = parentItem->child(row);
- if (childItem)
- return createIndex(row, column, childItem);
- else
- return QModelIndex();
-}
-
-QModelIndex DomModel::parent(const QModelIndex &child) const
-{
- if (!child.isValid())
- return QModelIndex();
-
- DomItem *childItem = static_cast<DomItem*>(child.internalPointer());
- DomItem *parentItem = childItem->parent();
-
- if (!parentItem || parentItem == rootItem)
- return QModelIndex();
-
- return createIndex(parentItem->row(), 0, parentItem);
-}
-
-int DomModel::rowCount(const QModelIndex &parent) const
-{
- if (parent.column() > 0)
- return 0;
-
- DomItem *parentItem;
-
- if (!parent.isValid())
- parentItem = rootItem;
- else
- parentItem = static_cast<DomItem*>(parent.internalPointer());
-
- return parentItem->node().childNodes().count();
-}
diff --git a/scribo/demo/viewer/dommodel.hh b/scribo/demo/viewer/dommodel.hh
deleted file mode 100644
index 16c5a23..0000000
--- a/scribo/demo/viewer/dommodel.hh
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
- ** Contact: Qt Software Information (qt-info(a)nokia.com)
- **
- ** This file is part of the example classes of the Qt Toolkit.
- **
- ** Commercial Usage
- ** Licensees holding valid Qt Commercial licenses may use this file in
- ** accordance with the Qt Commercial License Agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Nokia.
- **
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License versions 2.0 or 3.0 as published by the Free
- ** Software Foundation and appearing in the file LICENSE.GPL included in
- ** the packaging of this file. Please review the following information
- ** to ensure GNU General Public Licensing requirements will be met:
- ** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
- ** http://www.gnu.org/copyleft/gpl.html. In addition, as a special
- ** exception, Nokia gives you certain additional rights. These rights
- ** are described in the Nokia Qt GPL Exception version 1.3, included in
- ** the file GPL_EXCEPTION.txt in this package.
- **
- ** Qt for Windows(R) Licensees
- ** As a special exception, Nokia, as the sole copyright holder for Qt
- ** Designer, grants users of the Qt/Eclipse Integration plug-in the
- ** right for the Qt/Eclipse Integration to link to functionality
- ** provided by Qt Designer and its related libraries.
- **
- ** If you are unsure which license is appropriate for your use, please
- ** contact the sales department at qt-sales(a)nokia.com.
- **
- ****************************************************************************/
-
-//
-// Document layout viewer.
-//
-// Copyright (C) 2009 Florent D'Halluin.
-//
-// 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 2
-// of the License, or (at your option) any later version.
-//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
-//
-
-#ifndef DOMMODEL_H
-#define DOMMODEL_H
-
-#include <QAbstractItemModel>
-#include <QDomDocument>
-#include <QModelIndex>
-#include <QVariant>
-
-class DomItem;
-
-class DomModel : public QAbstractItemModel
-{
- Q_OBJECT
-
- public:
- DomModel(QDomDocument document, QObject *parent = 0);
- ~DomModel();
-
- QVariant data(const QModelIndex &index, int role) const;
- Qt::ItemFlags flags(const QModelIndex &index) const;
- QVariant headerData(int section, Qt::Orientation orientation,
- int role = Qt::DisplayRole) const;
- QModelIndex index(int row, int column,
- const QModelIndex &parent = QModelIndex()) const;
- QModelIndex parent(const QModelIndex &child) const;
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- int columnCount(const QModelIndex &parent = QModelIndex()) const;
-
-private:
- QDomDocument domDocument;
- DomItem *rootItem;
-};
-
-#endif
diff --git a/scribo/demo/viewer/help_dialog.cc b/scribo/demo/viewer/help_dialog.cc
index fe59d93..3ac5614 100644
--- a/scribo/demo/viewer/help_dialog.cc
+++ b/scribo/demo/viewer/help_dialog.cc
@@ -35,10 +35,8 @@ HelpDialog::HelpDialog()
" select regions to display their properties.\n"
" - Use the mouse or keyboard to move and zoom\n"
" (Arrows, PageUp, PageDown, Home, End).\n"
- "\n"
- "Contact: d-halluin(a)lrde.epita.fr\n"
- "\n"
- "Copyright Florent D'Halluin, 2009.\n");
+ "\n");
+
QLabel* label = new QLabel(help);
diff --git a/scribo/demo/viewer/image_region.cc b/scribo/demo/viewer/image_region.cc
index 04e3c9b..78b636c 100644
--- a/scribo/demo/viewer/image_region.cc
+++ b/scribo/demo/viewer/image_region.cc
@@ -17,7 +17,7 @@
ImageRegion::ImageRegion(region::RegionId id,
QString name,
QColor color,
- QModelIndex index,
+ QString attr_id,
const QVector<QPoint>& points,
bool outline,
bool fill,
@@ -27,7 +27,7 @@ ImageRegion::ImageRegion(region::RegionId id,
id_(id),
name_(name),
color_(color),
- index_(index),
+ attr_id_(attr_id),
shape_(),
rect_(),
outline_(outline),
@@ -65,7 +65,7 @@ ImageRegion::~ImageRegion()
region::RegionId ImageRegion::id()
{
return id_;
-}
+}
void
ImageRegion::paint(QPainter* painter,
diff --git a/scribo/demo/viewer/image_region.hh b/scribo/demo/viewer/image_region.hh
index 38aecb4..be1003d 100644
--- a/scribo/demo/viewer/image_region.hh
+++ b/scribo/demo/viewer/image_region.hh
@@ -27,7 +27,7 @@ public:
ImageRegion(region::RegionId id,
QString name,
QColor color,
- QModelIndex index,
+ QString attr_id,
const QVector<QPoint>& points,
bool outline,
bool fill,
@@ -36,15 +36,16 @@ public:
~ImageRegion();
- region::RegionId id();
+ region::RegionId id();
void paint(QPainter* painter,
const QStyleOptionGraphicsItem* option,
QWidget* widget = 0);
- const QModelIndex& index() const;
QRectF boundingRect() const;
QPainterPath shape() const;
QString name() { return name_; }
+ QRectF rect() { return rect_; }
+ QString attr_id() { return attr_id_; }
public slots:
void setOutline(bool outline);
@@ -60,7 +61,7 @@ private:
region::RegionId id_;
QString name_;
QColor color_;
- QModelIndex index_;
+ QString attr_id_;
QPainterPath shape_;
QRectF rect_;
bool outline_;
diff --git a/scribo/demo/viewer/image_region.hxx b/scribo/demo/viewer/image_region.hxx
index efcf493..0d23426 100644
--- a/scribo/demo/viewer/image_region.hxx
+++ b/scribo/demo/viewer/image_region.hxx
@@ -91,11 +91,4 @@ ImageRegion::shape() const
return shape_;
}
-inline
-const QModelIndex&
-ImageRegion::index() const
-{
- return index_;
-}
-
#endif /* !IMAGE_REGION_HXX_ */
diff --git a/scribo/demo/viewer/image_scene.cc b/scribo/demo/viewer/image_scene.cc
index 62b4b46..dd9d67e 100644
--- a/scribo/demo/viewer/image_scene.cc
+++ b/scribo/demo/viewer/image_scene.cc
@@ -31,7 +31,17 @@ void
ImageScene::mousePressEvent(QGraphicsSceneMouseEvent* event)
{
QGraphicsScene::mousePressEvent(event);
- QList<QGraphicsItem *> items_list = items(event->pos()); // includes both ImageRegions and the picture.
+ QList<QGraphicsItem *> items_list = items(event->scenePos()); // includes both ImageRegions and the picture.
+
+ if (items_list.isEmpty())
+ {
+ if (selected_)
+ {
+ selected_->deselect();
+ emit deselected();
+ selected_ = 0;
+ }
+ }
// Selection is under the mouse click (at event->pos()).
bool selection_is_clicked = items_list.contains(selected_);
@@ -55,20 +65,20 @@ ImageScene::mousePressEvent(QGraphicsSceneMouseEvent* event)
else
{
selected_->deselect();
- emit deselected(selected_->index());
+ emit deselected();
selected_ = 0;
}
}
else
{
selected_->deselect();
- emit deselected(selected_->index());
+ emit deselected();
selected_ = 0;
}
}
selected_ = item;
item->select();
- emit selected(item->index());
+ emit selected(item->attr_id(), item->name());
return;
}
}
@@ -78,7 +88,7 @@ ImageScene::mousePressEvent(QGraphicsSceneMouseEvent* event)
&& (items_list.size() == 1) )// no ImageRegion, only the picture
{
selected_->deselect();
- emit deselected(selected_->index());
+ emit deselected();
selected_ = 0;
}
}
diff --git a/scribo/demo/viewer/image_scene.hh b/scribo/demo/viewer/image_scene.hh
index 64ab590..6fb2c1f 100644
--- a/scribo/demo/viewer/image_scene.hh
+++ b/scribo/demo/viewer/image_scene.hh
@@ -33,8 +33,8 @@ public:
void clear();
signals:
- void selected(const QModelIndex& index);
- void deselected(const QModelIndex& index);
+ void selected(QString, QString);
+ void deselected();
private:
ImageRegion* selected_;
diff --git a/scribo/demo/viewer/key_widget.cc b/scribo/demo/viewer/key_widget.cc
index 47203c3..171c811 100644
--- a/scribo/demo/viewer/key_widget.cc
+++ b/scribo/demo/viewer/key_widget.cc
@@ -128,7 +128,7 @@ KeyWidget::update(QTreeWidgetItem* item)
int id;
id = text_->indexOfChild(item);
if (id == -1)
- id = regions_->indexOfChild(item) + 3;
+ id = regions_->indexOfChild(item) + 4;
emit updated(id, item->checkState(0) == Qt::Checked);
diff --git a/scribo/demo/viewer/property_widget.cc b/scribo/demo/viewer/property_widget.cc
deleted file mode 100644
index 3d2f4d5..0000000
--- a/scribo/demo/viewer/property_widget.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// Document layout viewer.
-//
-// Copyright (C) 2009 Florent D'Halluin.
-//
-// 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 2
-// of the License, or (at your option) any later version.
-//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
-//
-
-#include "property_widget.hh"
-
-#include "dommodel.hh"
-
-PropertyWidget::PropertyWidget()
- : view_(new QTreeWidget()),
- model_(0)
-{
- QLabel* title = new QLabel(tr("Properties"));
- title->setAlignment(Qt::AlignHCenter);
-
- QVBoxLayout* layout = new QVBoxLayout;
- layout->addWidget(title);
- layout->addWidget(view_);
-
- view_->setColumnCount(2);
- view_->setSortingEnabled(true);
- view_->setRootIsDecorated(false);
- QStringList header_names;
- header_names << tr("Name") << tr("Value");
- view_->setHeaderItem(new QTreeWidgetItem(header_names));
-
- setLayout(layout);
-}
-
-void
-PropertyWidget::update(DomModel* model)
-{
- model_ = model;
-}
-
-void
-PropertyWidget::select(const QModelIndex& index)
-{
- if (!index.isValid())
- return;
-
- QMap<QString, QVariant> data =
- model_->data(index, Qt::UserRole).toMap();
-
- for (QMap<QString, QVariant>::iterator i = data.begin();
- i != data.end();
- ++i)
- {
- QStringList values;
- values << i.key() << i.value().toString();
- view_->addTopLevelItem(new QTreeWidgetItem(values));
- }
-}
-
-void
-PropertyWidget::deselect(const QModelIndex&)
-{
- view_->clear();
-}
-
-PropertyWidget::~PropertyWidget()
-{
-}
diff --git a/scribo/demo/viewer/property_widget.hh b/scribo/demo/viewer/property_widget.hh
deleted file mode 100644
index fc4c755..0000000
--- a/scribo/demo/viewer/property_widget.hh
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Document layout viewer.
-//
-// Copyright (C) 2009 Florent D'Halluin.
-//
-// 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 2
-// of the License, or (at your option) any later version.
-//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
-//
-
-#ifndef PROPERTY_WIDGET_HH_
-# define PROPERTY_WIDGET_HH_
-
-# include <QtGui>
-
-class DomModel;
-
-class PropertyWidget
- : public QWidget
-{
- Q_OBJECT
-
-public:
- PropertyWidget();
- ~PropertyWidget();
-
-public slots:
- void update(DomModel* model);
- void select(const QModelIndex& index);
- void deselect(const QModelIndex& index);
-
-private:
- QTreeWidget* view_;
- DomModel* model_;
-};
-
-#endif /* !PROPERTY_WIDGET_HH_ */
diff --git a/scribo/demo/viewer/step_widget.cc b/scribo/demo/viewer/step_widget.cc
index 207796d..010b270 100644
--- a/scribo/demo/viewer/step_widget.cc
+++ b/scribo/demo/viewer/step_widget.cc
@@ -75,11 +75,13 @@ void StepWidget::fill_steps(QString file, bool step, bool container)
if (container)
{
- emit load_image(file, true);
+ emit change_base(true);
+ // emit load_image(file, true);
emit load_xml(file);
}
else
{
+ emit change_base(false);
// image is loaded once
emit load_image(file, false);
diff --git a/scribo/demo/viewer/step_widget.hh b/scribo/demo/viewer/step_widget.hh
index 32602b0..c5d77df 100644
--- a/scribo/demo/viewer/step_widget.hh
+++ b/scribo/demo/viewer/step_widget.hh
@@ -45,6 +45,7 @@ signals:
void load_image(QString, bool);
void load_xml(QString);
void activated(QListWidgetItem*);
+ void change_base(bool);
public slots:
void fill_steps(QString file, bool step = false, bool container = false);
diff --git a/scribo/demo/viewer/viewer.cc b/scribo/demo/viewer/viewer.cc
index e5ec717..090bb1b 100644
--- a/scribo/demo/viewer/viewer.cc
+++ b/scribo/demo/viewer/viewer.cc
@@ -1,19 +1,29 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#include "viewer.hh"
-#include "property_widget.hh"
#include "key_widget.hh"
#include "browser_widget.hh"
#include "image_widget.hh"
@@ -22,8 +32,7 @@
#include "image_scene.hh"
#include "image_region.hh"
#include "help_dialog.hh"
-
-#include "dommodel.hh"
+#include <limits.h>
#include "common.hh"
@@ -37,7 +46,10 @@ Viewer::Viewer(int &argc, char** argv)
key_map_(11),
no_cache_(false),
extended_mode_(false),
- xml_file_(QString(""))
+ xml_file_(QString::Null()),
+ base64_(false),
+ text_(true),
+ use_image_(true)
{
// Key map
@@ -123,6 +135,23 @@ Viewer::Viewer(int &argc, char** argv)
this, SLOT(useExtended(bool)));
option_menu->addAction(extended_action);
+ QAction* show_image_action = new QAction(tr("Show pictures"), file_menu);
+ //show_image_action->setStatusTip(tr(""));
+
+ show_image_action->setCheckable(true);
+ show_image_action->setChecked(true);
+ connect(show_image_action, SIGNAL(toggled(bool)),
+ this, SLOT(useImage(bool)));
+ option_menu->addAction(show_image_action);
+
+ QAction* show_text_action = new QAction(tr("Show text"), file_menu);
+ show_text_action->setStatusTip(tr("Show detected text inside boxes."));
+ show_text_action->setCheckable(true);
+ show_text_action->setChecked(true);
+ connect(show_text_action, SIGNAL(toggled(bool)),
+ this, SLOT(useText(bool)));
+ option_menu->addAction(show_text_action);
+
QMenu* help_menu = win_->menuBar()->addMenu(tr("Help"));
QAction* about_action = new QAction(tr("About"), help_menu);
about_action->setStatusTip(tr("About this program."));
@@ -135,7 +164,6 @@ Viewer::Viewer(int &argc, char** argv)
QSplitter* v_splitter2 = new QSplitter(Qt::Vertical);
StepWidget* step_widget = new StepWidget();
- PropertyWidget* property_wgt = new PropertyWidget();
XmlWidget* xml_wgt = new XmlWidget();
BrowserWidget* browser_wgt =
new BrowserWidget(files_, argc != 2 ? QString() : argv[1]);
@@ -144,7 +172,6 @@ Viewer::Viewer(int &argc, char** argv)
scene_->setBackgroundBrush(scene_->palette().window());
- v_splitter->addWidget(property_wgt);
v_splitter->addWidget(step_widget);
v_splitter->addWidget(key_wgt_);
v_splitter->addWidget(browser_wgt);
@@ -158,280 +185,302 @@ Viewer::Viewer(int &argc, char** argv)
win_->setCentralWidget(h_splitter);
QList<int> v_sizes;
- v_sizes << 200 << 200 << 300 << 400;
+ v_sizes << 200 << 300 << 300;
v_splitter->setSizes(v_sizes);
QList<int> v_sizes2;
- v_sizes2 << 500 << 100;
+ v_sizes2 << 650 << 150;
v_splitter2->setSizes(v_sizes2);
QList<int> h_sizes;
- h_sizes << 200 << 700;
+ h_sizes << 200 << 900;
h_splitter->setSizes(h_sizes);
connect(browser_wgt, SIGNAL(activated(QString, bool, bool)),
step_widget, SLOT(fill_steps(QString, bool, bool)));
+ connect(step_widget, SIGNAL(change_base(bool)),
+ this, SLOT(change_base(bool)));
connect(step_widget, SIGNAL(load_image(QString, bool)),
this, SLOT(load(QString, bool)));
connect(step_widget, SIGNAL(load_xml(QString)),
this, SLOT(load_xml(QString)));
- connect(this, SIGNAL(updated(DomModel*)),
- property_wgt, SLOT(update(DomModel*)));
connect(this, SIGNAL(mode_changed(bool)),
key_wgt_, SLOT(change_mode(bool)));
- connect(this, SIGNAL(updated(DomModel*)),
- xml_wgt, SLOT(update(DomModel*)));
- connect(this, SIGNAL(updated(DomModel*)),
+ connect(this, SIGNAL(updated()),
image_wgt, SLOT(update()));
+ connect(this, SIGNAL(fill_xml(QString)),
+ xml_wgt, SLOT(fill_widget(QString)));
connect(key_wgt_, SIGNAL(updated(int, bool)),
this, SIGNAL(key_updated(int, bool)));
- connect(scene_, SIGNAL(selected(QModelIndex)),
- property_wgt, SLOT(select(QModelIndex)));
- connect(scene_, SIGNAL(deselected(QModelIndex)),
- property_wgt, SLOT(deselect(QModelIndex)));
- connect(scene_, SIGNAL(selected(QModelIndex)),
- xml_wgt, SLOT(select(QModelIndex)));
- connect(scene_, SIGNAL(deselected(QModelIndex)),
- xml_wgt, SLOT(deselect(QModelIndex)));
+ connect(scene_, SIGNAL(selected(QString, QString)),
+ xml_wgt, SLOT(select(QString, QString)));
+ connect(scene_, SIGNAL(deselected()),
+ xml_wgt, SLOT(deselect()));
connect(image_wgt, SIGNAL(scaleUpdated(qreal)),
this, SLOT(maybeChangeCacheMode(qreal)));
}
+
void
-Viewer::load_xml(QString filename)
+Viewer::add_text(QDomNode line, QDomNode region)
{
- QString xml_file = filename;
- xml_file_ = filename;
- app_->setOverrideCursor(QCursor(Qt::WaitCursor));
+ int a_height = region.toElement().attribute("a_height", "0").toInt();
+ int d_height = region.toElement().attribute("d_height", "0").toInt();
+ int x_height = region.toElement().attribute("x_height", "0").toInt();
- scene_->removeItem(image_);
- scene_->clear();
- scene_->addItem(image_);
+ if (d_height < 0)
+ d_height = -d_height;
- scene_->update();
+ if ( (a_height - x_height) < (d_height))
+ a_height = x_height + d_height;
+
+ if ( (a_height - x_height) > (d_height))
+ d_height = a_height - x_height;
+
+ QDomNode coords = region.firstChild();
+
+ while (!coords.isNull() && !coords.toElement().tagName().contains("coords"))
+ coords = coords.nextSibling();
+
+ if (coords.isNull())
+ return;
+
+ QDomNode point = coords.firstChild();
- if (doc_layout_)
+ int x_min = INT_MAX;
+ int y_min = INT_MAX;
+
+ while (!point.isNull())
{
- doc_layout_->deleteLater();
- doc_layout_ = 0;
+ int x = point.toElement().attribute("x", "0").toInt();
+ int y = point.toElement().attribute("y", "0").toInt();
+
+ if (x < x_min)
+ x_min = x;
+
+ if (y < y_min)
+ y_min = y;
+
+ point = point.nextSibling();
}
- emit updated(doc_layout_);
+ QString text = line.toElement().attribute("text", "none");
+ QFont font("Times");
+ font.setPixelSize(a_height + d_height);
+ QGraphicsTextItem* text_item = scene_->addText(text, font);
+ text_item->setPos(x_min, y_min);
+ text_vector_ << text_item;
+ if (!text_)
+ scene_->removeItem(text_item);
- if (QFile::exists(xml_file))
- {
- QFile file(xml_file);
- if (file.open(QIODevice::ReadOnly))
+}
+
+void
+Viewer::add_region(QDomNode father, QString attr_id)
+{
+ QDomNode coords = father.firstChild();
+ QString name = father.toElement().tagName();
+ region::RegionId id = static_cast<region::RegionId>(region_ids_[name]);
+
+ while (!coords.isNull() && !coords.toElement().tagName().contains("coords"))
+ coords = coords.nextSibling();
+
+ if (coords.isNull())
+ return;
+
+ QDomNode point = coords.firstChild();
+ QVector<QPoint> points;
+
+ while (!point.isNull())
{
- QDomDocument document;
- if (document.setContent(&file))
- {
- doc_layout_ = new DomModel(document, this);
- }
- else
- {
- app_->restoreOverrideCursor();
- QMessageBox msgBox;
- msgBox.setText("Error while loading the XML file, please choose another.");
- msgBox.exec();
- }
- file.close();
- }
- }
+ int x = point.toElement().attribute("x", "0").toInt();
+ int y = point.toElement().attribute("y", "0").toInt();
- xml_to_layout();
+ points << QPoint(x, y);
+ point = point.nextSibling();
+ }
- app_->restoreOverrideCursor();
+ ImageRegion* r = new ImageRegion(id,
+ key_map_[id].first,
+ key_map_[id].second,
+ attr_id, points,
+ outline_action_->isChecked(),
+ fill_action_->isChecked(),
+ precise_action_->isChecked(),
+ key_wgt_->isChecked(id));
+
+ connect(this, SIGNAL(key_updated(int, bool)),
+ r, SLOT(setDrawIfSameId(int, bool)));
+ connect(this, SIGNAL(setOutline(bool)),
+ r, SLOT(setOutline(bool)));
+ connect(this, SIGNAL(setPrecise(bool)),
+ r, SLOT(setPrecise(bool)));
+ connect(this, SIGNAL(setFill(bool)),
+ r, SLOT(setFill(bool)));
+
+ scene_->addItem(r);
}
void
-Viewer::xml_to_layout()
+Viewer::load_xml(QString filename)
{
+ text_vector_.clear();
+ image_vector_.clear();
- /* /!\ XML parsing is VERY UGLY /!\
- TO DO: use same parsing as xml_transfrom. */
+ app_->setOverrideCursor(QCursor(Qt::WaitCursor));
+ emit fill_xml(filename);
+
+ if (image_ && image_->scene() && image_->scene() == scene_)
+ scene_->removeItem(image_);
+
+ scene_->clear();
+ if (!base64_ && use_image_)
+ scene_->addItem(image_);
- // Add layout info to the scene.
- if (doc_layout_)
+ scene_->update();
+
+ xml_file_ = filename;
+ QFile f_in(xml_file_);
+ f_in.open(QIODevice::ReadOnly);
+
+ QDomDocument doc;
+ doc.setContent(&f_in);
+ f_in.close();
+
+ QDomElement root = doc.documentElement();
+ QDomNode page = root.firstChild();
+
+ while (!page.isNull() && !page.toElement().tagName().contains("page"))
+ page = page.nextSibling();
+
+ if (page.isNull())
+ return;
+
+ int width = page.toElement().attribute("image_width", "none").toInt();
+ int height = page.toElement().attribute("image_height", "none").toInt();
+
+ scene_->setSceneRect(0, 0, width, height);
+
+ QDomNode region = page.firstChild();
+
+ while (!region.isNull())
{
- QModelIndex pgGts = doc_layout_->index(1, 0);
- QModelIndex page = doc_layout_->index(1, 0, pgGts);
- QModelIndex region;
- QModelIndex attributes;
- QModelIndex coords;
- QModelIndex point;
- for (int i = 0; true; ++i)
- {
- region = doc_layout_->index(i, 0, page);
- attributes = doc_layout_->index(i, 1, page);
- QString name = doc_layout_->data(region, Qt::DisplayRole).toString();
- region::RegionId id = static_cast<region::RegionId>(region_ids_[name]);
-
- coords = doc_layout_->index(0, 0, region);
- if (!region.isValid() || !coords.isValid())
- break;
-
- QVector<QPoint> points;
- for (int j = 0; true; ++j)
+ if (region.toElement().tagName().contains(QRegExp("(image|graphic|chart|separator|table|text)_region")))
+ {
+ QString attr_id = region.toElement().attribute("id", "none");
+ add_region(region, attr_id);
+
+ if ( base64_ &&
+ region.toElement().tagName().contains(QRegExp("(image|graphic|chart|separator|table)_region")))
{
- // Navigate to the coordinate list
- point = doc_layout_->index(j, 1, coords);
- if (!point.isValid())
- break;
+ QDomNode container = region.firstChild();
- QMap<QString, QVariant> data =
- doc_layout_->data(point, Qt::UserRole).toMap();
- int x = data["x"].toInt();
- int y = data["y"].toInt();
+ while (!container.isNull() && !container.toElement().tagName().contains("container"))
+ container = container.nextSibling();
- points << QPoint(x, y);
- }
+ QDomNode coords = region.firstChild();
- // Create region
- ImageRegion* r = new ImageRegion(id,
- key_map_[id].first,
- key_map_[id].second,
- attributes, points,
- outline_action_->isChecked(),
- fill_action_->isChecked(),
- precise_action_->isChecked(),
- key_wgt_->isChecked(id));
-
- connect(this, SIGNAL(key_updated(int, bool)),
- r, SLOT(setDrawIfSameId(int, bool)));
- connect(this, SIGNAL(setOutline(bool)),
- r, SLOT(setOutline(bool)));
- connect(this, SIGNAL(setPrecise(bool)),
- r, SLOT(setPrecise(bool)));
- connect(this, SIGNAL(setFill(bool)),
- r, SLOT(setFill(bool)));
-
- scene_->addItem(r);
-
- // EXTENDED MODE
- if (extended_mode_)
- {
- for (int k = 1; true; ++k)
+ while (!coords.isNull() && !coords.toElement().tagName().contains("coords"))
+ coords = coords.nextSibling();
+
+ if (!container.isNull() && !coords.isNull())
{
- QModelIndex paragraph = doc_layout_->index(k, 0, region);
- QModelIndex attributes_par = doc_layout_->index(k, 1, region);
- if (!paragraph.isValid())
- break;
+ QDomNode child = container.firstChild();
- QString name_par = doc_layout_->data(paragraph, Qt::DisplayRole).toString();
- region::RegionId id_par = static_cast<region::RegionId>(region_ids_[name_par]);
+ while (!child.isNull() && !child.toElement().tagName().contains("data"))
+ child = child.nextSibling();
- QDebug(&name_par) << name_par;
+ QPixmap pix;
+ QString data = child.toElement().text();
+ QByteArray ba;
+ ba = ba.append(data);
+ QByteArray out_ba = QByteArray::fromBase64(ba);
+ pix.loadFromData(out_ba);
- QModelIndex par_coords = doc_layout_->index(0, 0, paragraph);
- QModelIndex point_par;
+ QGraphicsPixmapItem* image = new QGraphicsPixmapItem(pix);
- QVector<QPoint> points_par;
- for (int m = 0; true; ++m)
+ QDomNode point = coords.firstChild();
+
+ int x_min = INT_MAX;
+ int y_min = INT_MAX;
+
+ while (!point.isNull())
{
- // Navigate to the coordinate list
- point_par = doc_layout_->index(m, 1, par_coords);
- if (!point_par.isValid())
- break;
-
- QMap<QString, QVariant> data_par =
- doc_layout_->data(point_par, Qt::UserRole).toMap();
- int x = data_par["x"].toInt();
- int y = data_par["y"].toInt();
- points_par << QPoint(x, y);
+ int x = point.toElement().attribute("x", "0").toInt();
+ int y = point.toElement().attribute("y", "0").toInt();
+
+ if (x < x_min)
+ x_min = x;
+
+ if (y < y_min)
+ y_min = y;
+
+ point = point.nextSibling();
}
- // Create region
- ImageRegion* r_par = new ImageRegion(id_par,
- key_map_[id_par].first,
- key_map_[id_par].second,
- attributes_par, points_par,
- outline_action_->isChecked(),
- fill_action_->isChecked(),
- precise_action_->isChecked(),
- key_wgt_->isChecked(id_par));
-
- connect(this, SIGNAL(key_updated(int, bool)),
- r_par, SLOT(setDrawIfSameId(int, bool)));
- connect(this, SIGNAL(setOutline(bool)),
- r_par, SLOT(setOutline(bool)));
- connect(this, SIGNAL(setPrecise(bool)),
- r_par, SLOT(setPrecise(bool)));
- connect(this, SIGNAL(setFill(bool)),
- r_par, SLOT(setFill(bool)));
-
- scene_->addItem(r_par);
-
- for (int l = 1; true; ++l)
+ image->setShapeMode(QGraphicsPixmapItem::BoundingRectShape);
+ image->setZValue(0);
+ image->setOffset(x_min, y_min);
+ if (use_image_)
+ scene_->addItem(image);
+ image_vector_ << image;
+
+ if (no_cache_)
+ image->setCacheMode(QGraphicsItem::NoCache);
+ else
+ image->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
+
+ child = child.nextSibling();
+ }
+ }
+
+ if (extended_mode_ &&
+ region.toElement().tagName().contains("text_region"))
+ {
+ QDomNode para = region.firstChild();
+ while (!para.isNull() && !para.toElement().tagName().contains("paragraph"))
+ para = para.nextSibling();
+
+ if (!para.isNull())
+ {
+ add_region(para, attr_id);
+
+ QDomNode line = para.firstChild();
+ while (!line.isNull() && !line.toElement().tagName().contains("line"))
+ line = line.nextSibling();
+
+ if (!line.isNull())
{
- QModelIndex line = doc_layout_->index(l, 0, paragraph);
- QModelIndex attributes_line = doc_layout_->index(l, 1, paragraph);
- if (!line.isValid())
- break;
-
- QString name_line = doc_layout_->data(line, Qt::DisplayRole).toString();
- region::RegionId id_line = static_cast<region::RegionId>(region_ids_[name_line]);
-
- QModelIndex line_coords = doc_layout_->index(0, 0, line);
- QModelIndex point_line;
- QVector<QPoint> points_line;
- for (int n = 0; true; ++n)
- {
- // Navigate to the coordinate list
- point_line = doc_layout_->index(n, 1, line_coords);
- if (!point_line.isValid())
- break;
-
- QMap<QString, QVariant> data_line =
- doc_layout_->data(point_line, Qt::UserRole).toMap();
- int x = data_line["x"].toInt();
- int y = data_line["y"].toInt();
- points_line << QPoint(x, y);
- }
-
- // Create region
- ImageRegion* r_line = new ImageRegion(id_line,
- key_map_[id_line].first,
- key_map_[id_line].second,
- attributes_line, points_line,
- outline_action_->isChecked(),
- fill_action_->isChecked(),
- precise_action_->isChecked(),
- key_wgt_->isChecked(id_line));
-
- connect(this, SIGNAL(key_updated(int, bool)),
- r_line, SLOT(setDrawIfSameId(int, bool)));
- connect(this, SIGNAL(setOutline(bool)),
- r_line, SLOT(setOutline(bool)));
- connect(this, SIGNAL(setPrecise(bool)),
- r_line, SLOT(setPrecise(bool)));
- connect(this, SIGNAL(setFill(bool)),
- r_line, SLOT(setFill(bool)));
-
- scene_->addItem(r_line);
+ add_region(line, attr_id);
+ add_text(line, region);
}
}
}
- // END OF EXTENDED MODE
- }
+ }
- emit updated(doc_layout_);
- key_wgt_->update_all();
+ region = region.nextSibling();
}
+
+ emit updated();
+ scene_->update();
+ key_wgt_->update_all();
+
+ app_->restoreOverrideCursor();
}
void
Viewer::load(QString filename, bool b)
{
app_->setOverrideCursor(QCursor(Qt::WaitCursor));
+
scene_->clear();
scene_->update();
image_ = 0;
@@ -443,24 +492,21 @@ Viewer::load(QString filename, bool b)
image_ = new QGraphicsPixmapItem(load_base64(filename));
else
image_ = new QGraphicsPixmapItem(QPixmap(filename));
+
image_->setShapeMode(QGraphicsPixmapItem::BoundingRectShape);
image_->setZValue(0);
- scene_->addItem(image_);
+ if (use_image_)
+ scene_->addItem(image_);
if (no_cache_)
image_->setCacheMode(QGraphicsItem::NoCache);
else
image_->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
- if (doc_layout_)
- {
- doc_layout_->deleteLater();
- doc_layout_ = 0;
- }
-
app_->restoreOverrideCursor();
+ emit updated();
- emit updated(doc_layout_);
+ app_->restoreOverrideCursor();
}
int
@@ -493,10 +539,11 @@ void Viewer::useExtended(bool b)
{
extended_mode_ = b;
key_wgt_->update_all();
- if (xml_file_ != QString(""))
+
+ if (xml_file_ != QString::Null())
load_xml(xml_file_);
- emit mode_changed (b);
+ emit mode_changed(b);
}
void
@@ -557,4 +604,54 @@ QPixmap Viewer::load_base64(QString xml)
return pix;
}
-// LocalWords: hh
+void
+Viewer::useText(bool b)
+{
+ text_ = b;
+ if (!b)
+ {
+ for (int i = 0; i < text_vector_.size(); ++i)
+ scene_->removeItem(text_vector_[i]);
+ }
+ else
+ {
+ for (int i = 0; i < text_vector_.size(); ++i)
+ scene_->addItem(text_vector_[i]);
+ }
+
+ emit updated();
+ scene_->update();
+}
+
+void
+Viewer::useImage(bool b)
+{
+ use_image_ = b;
+ if (!b)
+ {
+ if (image_ && image_->scene() && image_->scene() == scene_)
+ scene_->removeItem(image_);
+
+ for (int i = 0; i < image_vector_.size(); ++i)
+ scene_->removeItem(image_vector_[i]);
+ }
+ else
+ {
+ if (image_ && image_->scene() == 0)
+ scene_->addItem(image_);
+
+ for (int i = 0; i < image_vector_.size(); ++i)
+ scene_->addItem(image_vector_[i]);
+ }
+
+
+
+ emit updated();
+ scene_->update();
+}
+
+void
+Viewer::change_base(bool b)
+{
+ base64_ = b;
+}
diff --git a/scribo/demo/viewer/viewer.hh b/scribo/demo/viewer/viewer.hh
index 7093da8..800bdd5 100644
--- a/scribo/demo/viewer/viewer.hh
+++ b/scribo/demo/viewer/viewer.hh
@@ -17,6 +17,7 @@
# include <QtGui>
# include "common.hh"
+# include <QDomNode>
class ImageScene;
class DomModel;
@@ -44,15 +45,18 @@ public slots:
void maybeChangeCacheMode(qreal scale);
void useCache(bool b);
void useExtended(bool b);
+ void useText(bool b);
+ void useImage(bool b);
+ void change_base(bool b);
signals:
- void updated(DomModel* model);
- void loaded(DomModel* model);
+ void updated();
void key_updated(int key, bool checked);
void setOutline(bool b);
void setPrecise(bool b);
void setFill(bool b);
void mode_changed(bool b);
+ void fill_xml(QString);
private:
Viewer(int &argc, char** argv);
@@ -60,6 +64,8 @@ private:
void xml_to_layout();
QPixmap load_base64(QString xml);
+ void add_region(QDomNode father, QString attr_id);
+ void add_text(QDomNode line, QDomNode region);
QApplication* app_;
QMainWindow* win_;
@@ -82,6 +88,11 @@ private:
bool no_cache_;
bool extended_mode_;
QString xml_file_;
+ bool base64_;
+ bool text_;
+ bool use_image_;
+ QVector<QGraphicsTextItem *> text_vector_;
+ QVector<QGraphicsPixmapItem*> image_vector_;
};
#include "viewer.hxx"
diff --git a/scribo/demo/viewer/xml_widget.cc b/scribo/demo/viewer/xml_widget.cc
index 36f0406..a4ef2f6 100644
--- a/scribo/demo/viewer/xml_widget.cc
+++ b/scribo/demo/viewer/xml_widget.cc
@@ -14,39 +14,160 @@
#include "xml_widget.hh"
-#include "dommodel.hh"
-
XmlWidget::XmlWidget()
- : view_(new QTreeView()),
- model_(0)
+ : tree_(new QTreeWidget()),
+ property_(new QTreeWidget())
{
QLabel* title = new QLabel(tr("XML"));
title->setAlignment(Qt::AlignHCenter);
+ tree_->setHeaderHidden(true);
+
QVBoxLayout* layout = new QVBoxLayout;
+ QHBoxLayout *hlayout = new QHBoxLayout;
+
+ QStringList header_names;
+ header_names << tr("Name") << tr("Value");
+ property_->setHeaderItem(new QTreeWidgetItem(header_names));
+
+ hlayout->addWidget(tree_);
+ hlayout->addWidget(property_);
layout->addWidget(title);
- layout->addWidget(view_);
+ layout->addLayout(hlayout);
setLayout(layout);
+
+ connect(tree_, SIGNAL(itemDoubleClicked (QTreeWidgetItem*, int)),
+ this, SLOT(check_item (QTreeWidgetItem*) ) );
}
void
-XmlWidget::update(DomModel* model)
+XmlWidget::select(QString id, QString name)
{
- view_->setModel(model);
- // view_->resizeColumnToContents(2);
+ QDomNode n = node_map_[item_map_[id]];
+
+ if (name.contains("Paragraph"))
+ {
+ n = n.firstChild();
+ while (!n.isNull() && !n.toElement().tagName().contains("paragraph"))
+ n = n.nextSibling();
+ }
+
+ if (name.contains("Text line"))
+ {
+ n = n.firstChild();
+ while (!n.isNull() && !n.toElement().tagName().contains("paragraph"))
+ n = n.nextSibling();
+
+ if (!n.isNull())
+ {
+ n = n.firstChild();
+ while (!n.isNull() && !n.toElement().tagName().contains("line"))
+ n = n.nextSibling();
+ }
+ }
+
+ if (!n.isNull())
+ {
+ QTreeWidgetItem* item = node_map_.key(n);
+
+ tree_->setCurrentItem(item, 0);
+ item->setExpanded(true);
+ check_item(item);
+ }
}
void
-XmlWidget::select(const QModelIndex& index)
+XmlWidget::check_item (QTreeWidgetItem* item)
{
- view_->setCurrentIndex(index);
+ QDomNode node = node_map_[item];
+
+ if (node.hasAttributes())
+ {
+ property_->clear();
+ QDomNamedNodeMap attributes = node.toElement().attributes();
+
+ for (int i = 0; i < attributes.count(); ++i)
+ {
+ QStringList values;
+ values << attributes.item(i).toAttr().name() << attributes.item(i).toAttr().value();
+ property_->addTopLevelItem(new QTreeWidgetItem(values));
+ }
+ }
+
+ property_->resizeColumnToContents(0);
+}
+
+void XmlWidget::NFS(QDomNode node, QTreeWidgetItem* item)
+{
+ if (!node.isNull())
+ {
+ QString append;
+ if (node.toElement().tagName().contains("point"))
+ {
+ QString x = node.toElement().attribute("x", "0");
+ QString y = node.toElement().attribute("y", "0");
+ append.append(" = (" + x + ", " + y + ")");
+ }
+
+ QTreeWidgetItem* child =
+ new QTreeWidgetItem(QStringList(node.toElement().tagName() + node.nodeValue() + append));
+
+ if (node.hasAttributes())
+ {
+ QString id = node.toElement().attribute("id", "none");
+ item_map_[id] = child;
+ }
+
+ node_map_[child] = node;
+ item->addChild(child);
+
+ QDomNode sibling = node.firstChild();
+ while (!sibling.isNull())
+ {
+ if (!sibling.toElement().tagName().contains("data"))
+ NFS(sibling, child);
+ sibling = sibling.nextSibling();
+ }
+ }
+}
+
+void XmlWidget::fill_widget(QString xml)
+{
+ node_map_.clear();
+ item_map_.clear();
+
+ tree_->clear();
+ property_->clear();
+ QFile f_in(xml);
+ f_in.open(QIODevice::ReadOnly);
+
+ QDomDocument doc;
+ doc.setContent(&f_in);
+ f_in.close();
+
+ int i = 0;
+
+ QDomElement root = doc.documentElement();
+ QTreeWidgetItem* root_item=
+ new QTreeWidgetItem(QStringList(root.tagName()));
+
+ tree_->addTopLevelItem(root_item);
+ root = root.firstChild().toElement();
+
+ while (!root.isNull())
+ {
+ ++i;
+ NFS(root, root_item);
+ root = root.nextSibling().toElement();
+ }
}
void
-XmlWidget::deselect(const QModelIndex&)
+XmlWidget::deselect()
{
+ property_->clear();
}
XmlWidget::~XmlWidget()
diff --git a/scribo/demo/viewer/xml_widget.hh b/scribo/demo/viewer/xml_widget.hh
index b3de3fa..c56a736 100644
--- a/scribo/demo/viewer/xml_widget.hh
+++ b/scribo/demo/viewer/xml_widget.hh
@@ -16,6 +16,7 @@
# define XML_WIDGET_HH_
# include <QtGui>
+# include <QDomNode>
class DomModel;
@@ -29,13 +30,17 @@ public:
~XmlWidget();
public slots:
- void update(DomModel* model);
- void select(const QModelIndex& index);
- void deselect(const QModelIndex& index);
+ void select(QString id, QString name);
+ void deselect();
+ void fill_widget(QString xml);
+ void check_item (QTreeWidgetItem* item);
private:
- QTreeView* view_;
- DomModel* model_;
+ void NFS(QDomNode node, QTreeWidgetItem* item);
+ QTreeWidget* tree_;
+ QTreeWidget* property_;
+ QMap<QString, QTreeWidgetItem*> item_map_;
+ QMap<QTreeWidgetItem*, QDomNode> node_map_;
};
#endif /* !XML_WIDGET_HH_ */
--
1.5.6.5
1
0
16 Nov '10
* scribo/demo/viewer/viewer.cc
---
scribo/ChangeLog | 52 +++++++++++++++++++++++------------------
scribo/demo/viewer/viewer.cc | 5 +---
2 files changed, 30 insertions(+), 27 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 0d78dc7..da06873 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,34 +1,40 @@
2010-07-20 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
+ Text selectable in Qt interface.
+
+ * scribo/demo/viewer/viewer.cc
+
+2010-07-20 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
+
Some changes in XML interface.
- * demo/viewer/property_widget.cc,
- * demo/viewer/property_widget.hh,
- * demo/viewer/domitem.cc,
- * demo/viewer/domitem.hh,
- * demo/viewer/dommodel.cc,
- * demo/viewer/dommodel.hh: Delete.
+ * scribo/demo/viewer/property_widget.cc,
+ * scribo/demo/viewer/property_widget.hh,
+ * scribo/demo/viewer/domitem.cc,
+ * scribo/demo/viewer/domitem.hh,
+ * scribo/demo/viewer/dommodel.cc,
+ * scribo/demo/viewer/dommodel.hh: Delete.
- * demo/viewer/Makefile.am
+ * scribo/demo/viewer/Makefile.am
- * demo/viewer/browser_widget.cc: Fix, xmlc extension instead of xmle.
+ * scribo/demo/viewer/browser_widget.cc: Fix, xmlc extension instead of xmle.
- * demo/viewer/key_widget.cc,
- * demo/viewer/step_widget.cc,
- * demo/viewer/step_widget.hh,
- * demo/viewer/image_scene.cc,
- * demo/viewer/image_scene.hh,
- * demo/viewer/help_dialog.cc,
- * demo/viewer/image_region.cc,
- * demo/viewer/image_region.hh,
- * demo/viewer/image_region.hxx: Small changes.
+ * scribo/demo/viewer/key_widget.cc,
+ * scribo/demo/viewer/step_widget.cc,
+ * scribo/demo/viewer/step_widget.hh,
+ * scribo/demo/viewer/image_scene.cc,
+ * scribo/demo/viewer/image_scene.hh,
+ * scribo/demo/viewer/help_dialog.cc,
+ * scribo/demo/viewer/image_region.cc,
+ * scribo/demo/viewer/image_region.hh,
+ * scribo/demo/viewer/image_region.hxx: Small changes.
- * demo/viewer/viewer.cc,
- * demo/viewer/viewer.hh: Add base 64 cropped pictures support, text viewer
+ * scribo/demo/viewer/viewer.cc,
+ * scribo/demo/viewer/viewer.hh: Add base 64 cropped pictures support, text viewer
and change XML parsing.
- * demo/viewer/xml_widget.cc,
- * demo/viewer/xml_widget.hh: Change widget, tree and attributes are together.
+ * scribo/demo/viewer/xml_widget.cc,
+ * scribo/demo/viewer/xml_widget.hh: Change widget, tree and attributes are together.
2010-07-16 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
diff --git a/scribo/demo/viewer/viewer.cc b/scribo/demo/viewer/viewer.cc
index 090bb1b..f93177e 100644
--- a/scribo/demo/viewer/viewer.cc
+++ b/scribo/demo/viewer/viewer.cc
@@ -275,6 +275,7 @@ Viewer::add_text(QDomNode line, QDomNode region)
font.setPixelSize(a_height + d_height);
QGraphicsTextItem* text_item = scene_->addText(text, font);
text_item->setPos(x_min, y_min);
+ text_item->setTextInteractionFlags(Qt::TextSelectableByMouse);
text_vector_ << text_item;
if (!text_)
scene_->removeItem(text_item);
@@ -619,7 +620,6 @@ Viewer::useText(bool b)
scene_->addItem(text_vector_[i]);
}
- emit updated();
scene_->update();
}
@@ -644,9 +644,6 @@ Viewer::useImage(bool b)
scene_->addItem(image_vector_[i]);
}
-
-
- emit updated();
scene_->update();
}
--
1.5.6.5
1
0
last-svn-commit-566-ge3767ee Files headers change + base64 data hide in xml tree.
by Arthur Crepin-Leblond 16 Nov '10
by Arthur Crepin-Leblond 16 Nov '10
16 Nov '10
* scribo/demo/viewer/README,
* scribo/demo/viewer/browser_widget.cc,
* scribo/demo/viewer/browser_widget.hh,
* scribo/demo/viewer/common.hh,
* scribo/demo/viewer/help_dialog.cc,
* scribo/demo/viewer/help_dialog.hh,
* scribo/demo/viewer/image_region.cc,
* scribo/demo/viewer/image_region.hh,
* scribo/demo/viewer/image_scene.cc,
* scribo/demo/viewer/image_scene.hh,
* scribo/demo/viewer/image_view.cc,
* scribo/demo/viewer/image_view.hh,
* scribo/demo/viewer/image_widget.cc,
* scribo/demo/viewer/image_widget.hh,
* scribo/demo/viewer/key_widget.cc,
* scribo/demo/viewer/key_widget.hh,
* scribo/demo/viewer/main.cc,
* scribo/demo/viewer/viewer.cc,
* scribo/demo/viewer/viewer.hh,
* scribo/demo/viewer/viewer.hxx,
* scribo/demo/viewer/xml_widget.cc: Change header (add LRDE copyright)
* scribo/demo/viewer/xml_widget.hh: Hide data in base 64 to improve loading speed.
---
scribo/ChangeLog | 28 ++++++++++++++++++++++++++++
scribo/demo/viewer/README | 32 ++++++++++++++++++++------------
scribo/demo/viewer/browser_widget.cc | 27 +++++++++++++++++++--------
scribo/demo/viewer/browser_widget.hh | 27 +++++++++++++++++++--------
scribo/demo/viewer/common.hh | 27 +++++++++++++++++++--------
scribo/demo/viewer/help_dialog.cc | 27 +++++++++++++++++++--------
scribo/demo/viewer/help_dialog.hh | 27 +++++++++++++++++++--------
scribo/demo/viewer/image_region.cc | 27 +++++++++++++++++++--------
scribo/demo/viewer/image_region.hh | 27 +++++++++++++++++++--------
scribo/demo/viewer/image_scene.cc | 27 +++++++++++++++++++--------
scribo/demo/viewer/image_scene.hh | 27 +++++++++++++++++++--------
scribo/demo/viewer/image_view.cc | 27 +++++++++++++++++++--------
scribo/demo/viewer/image_view.hh | 27 +++++++++++++++++++--------
scribo/demo/viewer/image_widget.cc | 27 +++++++++++++++++++--------
scribo/demo/viewer/image_widget.hh | 27 +++++++++++++++++++--------
scribo/demo/viewer/key_widget.cc | 27 +++++++++++++++++++--------
scribo/demo/viewer/key_widget.hh | 27 +++++++++++++++++++--------
scribo/demo/viewer/main.cc | 27 +++++++++++++++++++--------
scribo/demo/viewer/viewer.cc | 4 ++--
scribo/demo/viewer/viewer.hh | 27 +++++++++++++++++++--------
scribo/demo/viewer/viewer.hxx | 27 +++++++++++++++++++--------
scribo/demo/viewer/xml_widget.cc | 34 ++++++++++++++++++++++++++--------
scribo/demo/viewer/xml_widget.hh | 27 +++++++++++++++++++--------
23 files changed, 437 insertions(+), 174 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index da06873..ddd6a10 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,31 @@
+2010-07-21 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
+
+ Files headers change + base64 data hide in xml tree.
+
+ * scribo/demo/viewer/README,
+ * scribo/demo/viewer/browser_widget.cc,
+ * scribo/demo/viewer/browser_widget.hh,
+ * scribo/demo/viewer/common.hh,
+ * scribo/demo/viewer/help_dialog.cc,
+ * scribo/demo/viewer/help_dialog.hh,
+ * scribo/demo/viewer/image_region.cc,
+ * scribo/demo/viewer/image_region.hh,
+ * scribo/demo/viewer/image_scene.cc,
+ * scribo/demo/viewer/image_scene.hh,
+ * scribo/demo/viewer/image_view.cc,
+ * scribo/demo/viewer/image_view.hh,
+ * scribo/demo/viewer/image_widget.cc,
+ * scribo/demo/viewer/image_widget.hh,
+ * scribo/demo/viewer/key_widget.cc,
+ * scribo/demo/viewer/key_widget.hh,
+ * scribo/demo/viewer/main.cc,
+ * scribo/demo/viewer/viewer.cc,
+ * scribo/demo/viewer/viewer.hh,
+ * scribo/demo/viewer/viewer.hxx,
+ * scribo/demo/viewer/xml_widget.cc: Change header (add LRDE copyright)
+
+ * scribo/demo/viewer/xml_widget.hh: Hide data in base 64 to improve loading speed.
+
2010-07-20 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
Text selectable in Qt interface.
diff --git a/scribo/demo/viewer/README b/scribo/demo/viewer/README
index 6032a41..fa37cd6 100644
--- a/scribo/demo/viewer/README
+++ b/scribo/demo/viewer/README
@@ -1,15 +1,27 @@
+Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
-Document layout viewer.
+This file is part of Olena.
-Copyright (C) 2009 Florent D'Halluin.
+Olena 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, version 2 of the License.
-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 2
-of the License, or (at your option) any later version.
+Olena 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.
-The complete GNU General Public Licence Notice can be found as the
-`COPYING' file in the root directory.
+You should have received a copy of the GNU General Public License
+along with Olena. If not, see <http:www.gnu.org/licenses/>.
+
+As a special exception, you may use this file as part of a free
+software project without restriction. Specifically, if other files
+instantiate templates or use macros or inline functions from this
+file, or you compile this file and link it with other files to produce
+an executable, this file does not by itself cause the resulting
+executable to be covered by the GNU General Public License. This
+exception does not however invalidate any other reasons why the
+executable file might be covered by the GNU General Public License.
__________________________________________________________________
@@ -19,9 +31,6 @@ Document Layout Viewer
Purpose:
- Display layout information about image documents.
-Contact:
-d-halluin(a)lrde.epita.fr
-
Usage:
- Get XML layout descriptions (PAGE format, ICDAR2009).
- Put XML and image files in the same directory, with the same name.
@@ -30,4 +39,3 @@ Usage:
Infos:
- Everything is read-only.
-- The DOM Model classes are a slightly modified Qt example.
diff --git a/scribo/demo/viewer/browser_widget.cc b/scribo/demo/viewer/browser_widget.cc
index 43de1e2..b9ccbec 100644
--- a/scribo/demo/viewer/browser_widget.cc
+++ b/scribo/demo/viewer/browser_widget.cc
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#include "browser_widget.hh"
diff --git a/scribo/demo/viewer/browser_widget.hh b/scribo/demo/viewer/browser_widget.hh
index 9266832..964dc47 100644
--- a/scribo/demo/viewer/browser_widget.hh
+++ b/scribo/demo/viewer/browser_widget.hh
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#ifndef BROWSER_WIDGET_HH_
# define BROWSER_WIDGET_HH_
diff --git a/scribo/demo/viewer/common.hh b/scribo/demo/viewer/common.hh
index 346ea51..4dee676 100644
--- a/scribo/demo/viewer/common.hh
+++ b/scribo/demo/viewer/common.hh
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#ifndef COMMON_HH_
# define COMMON_HH_
diff --git a/scribo/demo/viewer/help_dialog.cc b/scribo/demo/viewer/help_dialog.cc
index 3ac5614..932d66f 100644
--- a/scribo/demo/viewer/help_dialog.cc
+++ b/scribo/demo/viewer/help_dialog.cc
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#include "help_dialog.hh"
diff --git a/scribo/demo/viewer/help_dialog.hh b/scribo/demo/viewer/help_dialog.hh
index 114d8f5..2b4adcf 100644
--- a/scribo/demo/viewer/help_dialog.hh
+++ b/scribo/demo/viewer/help_dialog.hh
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#ifndef HELP_DIALOG_HH_
# define HELP_DIALOG_HH_
diff --git a/scribo/demo/viewer/image_region.cc b/scribo/demo/viewer/image_region.cc
index 78b636c..037ed56 100644
--- a/scribo/demo/viewer/image_region.cc
+++ b/scribo/demo/viewer/image_region.cc
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#include "image_region.hh"
diff --git a/scribo/demo/viewer/image_region.hh b/scribo/demo/viewer/image_region.hh
index be1003d..a492b44 100644
--- a/scribo/demo/viewer/image_region.hh
+++ b/scribo/demo/viewer/image_region.hh
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#ifndef IMAGE_REGION_HH_
# define IMAGE_REGION_HH_
diff --git a/scribo/demo/viewer/image_scene.cc b/scribo/demo/viewer/image_scene.cc
index dd9d67e..850647f 100644
--- a/scribo/demo/viewer/image_scene.cc
+++ b/scribo/demo/viewer/image_scene.cc
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#include "image_scene.hh"
#include "image_region.hh"
diff --git a/scribo/demo/viewer/image_scene.hh b/scribo/demo/viewer/image_scene.hh
index 6fb2c1f..4c417b0 100644
--- a/scribo/demo/viewer/image_scene.hh
+++ b/scribo/demo/viewer/image_scene.hh
@@ -1,17 +1,28 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#ifndef IMAGE_SCENE_HH_
# define IMAGE_SCENE_HH_
diff --git a/scribo/demo/viewer/image_view.cc b/scribo/demo/viewer/image_view.cc
index 9182c1b..05a85e8 100644
--- a/scribo/demo/viewer/image_view.cc
+++ b/scribo/demo/viewer/image_view.cc
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#include "image_view.hh"
diff --git a/scribo/demo/viewer/image_view.hh b/scribo/demo/viewer/image_view.hh
index 84f722f..ab48a36 100644
--- a/scribo/demo/viewer/image_view.hh
+++ b/scribo/demo/viewer/image_view.hh
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#ifndef IMAGE_VIEW_HH_
# define IMAGE_VIEW_HH_
diff --git a/scribo/demo/viewer/image_widget.cc b/scribo/demo/viewer/image_widget.cc
index b4bee72..3e3f241 100644
--- a/scribo/demo/viewer/image_widget.cc
+++ b/scribo/demo/viewer/image_widget.cc
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#include "image_widget.hh"
#include "image_view.hh"
diff --git a/scribo/demo/viewer/image_widget.hh b/scribo/demo/viewer/image_widget.hh
index 87259b0..a3f51e4 100644
--- a/scribo/demo/viewer/image_widget.hh
+++ b/scribo/demo/viewer/image_widget.hh
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#ifndef IMAGE_WIDGET_HH_
# define IMAGE_WIDGET_HH_
diff --git a/scribo/demo/viewer/key_widget.cc b/scribo/demo/viewer/key_widget.cc
index 171c811..44839c5 100644
--- a/scribo/demo/viewer/key_widget.cc
+++ b/scribo/demo/viewer/key_widget.cc
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#include "key_widget.hh"
#include "common.hh"
diff --git a/scribo/demo/viewer/key_widget.hh b/scribo/demo/viewer/key_widget.hh
index d7767b0..113835d 100644
--- a/scribo/demo/viewer/key_widget.hh
+++ b/scribo/demo/viewer/key_widget.hh
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#ifndef KEY_WIDGET_HH_
# define KEY_WIDGET_HH_
diff --git a/scribo/demo/viewer/main.cc b/scribo/demo/viewer/main.cc
index 640ea0f..b55ad84 100644
--- a/scribo/demo/viewer/main.cc
+++ b/scribo/demo/viewer/main.cc
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#include <QtGui>
#include <iostream>
diff --git a/scribo/demo/viewer/viewer.cc b/scribo/demo/viewer/viewer.cc
index f93177e..10c1a43 100644
--- a/scribo/demo/viewer/viewer.cc
+++ b/scribo/demo/viewer/viewer.cc
@@ -185,11 +185,11 @@ Viewer::Viewer(int &argc, char** argv)
win_->setCentralWidget(h_splitter);
QList<int> v_sizes;
- v_sizes << 200 << 300 << 300;
+ v_sizes << 200 << 250 << 350;
v_splitter->setSizes(v_sizes);
QList<int> v_sizes2;
- v_sizes2 << 650 << 150;
+ v_sizes2 << 725 << 175;
v_splitter2->setSizes(v_sizes2);
QList<int> h_sizes;
diff --git a/scribo/demo/viewer/viewer.hh b/scribo/demo/viewer/viewer.hh
index 800bdd5..b1f406d 100644
--- a/scribo/demo/viewer/viewer.hh
+++ b/scribo/demo/viewer/viewer.hh
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#ifndef VIEWER_HH_
# define VIEWER_HH_
diff --git a/scribo/demo/viewer/viewer.hxx b/scribo/demo/viewer/viewer.hxx
index 72ee1f2..b72eaff 100644
--- a/scribo/demo/viewer/viewer.hxx
+++ b/scribo/demo/viewer/viewer.hxx
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#ifndef VIEWER_HXX_
# define VIEWER_HXX_
diff --git a/scribo/demo/viewer/xml_widget.cc b/scribo/demo/viewer/xml_widget.cc
index a4ef2f6..2d10bd7 100644
--- a/scribo/demo/viewer/xml_widget.cc
+++ b/scribo/demo/viewer/xml_widget.cc
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#include "xml_widget.hh"
@@ -128,6 +139,13 @@ void XmlWidget::NFS(QDomNode node, QTreeWidgetItem* item)
{
if (!sibling.toElement().tagName().contains("data"))
NFS(sibling, child);
+ else
+ {
+ QTreeWidgetItem* child_son =
+ new QTreeWidgetItem(QStringList("data = base64-encoded"));
+
+ child->addChild(child_son);
+ }
sibling = sibling.nextSibling();
}
}
diff --git a/scribo/demo/viewer/xml_widget.hh b/scribo/demo/viewer/xml_widget.hh
index c56a736..b80835b 100644
--- a/scribo/demo/viewer/xml_widget.hh
+++ b/scribo/demo/viewer/xml_widget.hh
@@ -1,16 +1,27 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena 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, version 2 of the License.
//
-// 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 2
-// of the License, or (at your option) any later version.
+// Olena 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.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
#ifndef XML_WIDGET_HH_
# define XML_WIDGET_HH_
--
1.5.6.5
1
0
16 Nov '10
* scribo/sandbox/arthur/xml_transform/README
* scribo/sandbox/arthur/xml_transform/image_crop.cc: Delete verbose mode.
* scribo/sandbox/arthur/xml_transform/main.cc: Small fix.
---
scribo/ChangeLog | 9 +++++++++
scribo/sandbox/arthur/xml_transform/README | 7 ++++++-
scribo/sandbox/arthur/xml_transform/image_crop.cc | 8 ++++----
scribo/sandbox/arthur/xml_transform/main.cc | 6 +++---
4 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index ddd6a10..1462eb2 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,14 @@
2010-07-21 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
+ Small changes in xml_transform.
+
+ * scribo/sandbox/arthur/xml_transform/README
+
+ * scribo/sandbox/arthur/xml_transform/image_crop.cc: Delete verbose mode.
+ * scribo/sandbox/arthur/xml_transform/main.cc: Small fix.
+
+2010-07-21 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
+
Files headers change + base64 data hide in xml tree.
* scribo/demo/viewer/README,
diff --git a/scribo/sandbox/arthur/xml_transform/README b/scribo/sandbox/arthur/xml_transform/README
index 1f358e3..aedf220 100644
--- a/scribo/sandbox/arthur/xml_transform/README
+++ b/scribo/sandbox/arthur/xml_transform/README
@@ -21,4 +21,9 @@ Base 64 operations:
BUILD:
-Chnage the environment variable QMAKE_CXXFLAGS to indicate the correct paths to milena and olena in the .pro file then, just type qmake and make.
\ No newline at end of file
+Chnage the environment variable QMAKE_CXXFLAGS in xml_transfrom.pro then
+
+mkdir _build
+cd _build
+qmake ../xml_transfrom.pro
+make
\ No newline at end of file
diff --git a/scribo/sandbox/arthur/xml_transform/image_crop.cc b/scribo/sandbox/arthur/xml_transform/image_crop.cc
index 8aafe45..ffe2b44 100644
--- a/scribo/sandbox/arthur/xml_transform/image_crop.cc
+++ b/scribo/sandbox/arthur/xml_transform/image_crop.cc
@@ -61,10 +61,10 @@ void ImageCrop::save_image(QString file)
else
filename = file;
- std::cout << "Saving " << image_.toStdString() << " to "
- << output_dir_.toStdString() << "img/"
- << filename.toStdString() << ".png"
- << std::endl;
+ // std::cout << "Saving " << image_.toStdString() << " to "
+ // << output_dir_.toStdString() << "img/"
+ // << filename.toStdString() << ".png"
+ // << std::endl;
io::magick::save(ima, output_dir_.toStdString() + "img/" + filename.toStdString() + ".png");
}
diff --git a/scribo/sandbox/arthur/xml_transform/main.cc b/scribo/sandbox/arthur/xml_transform/main.cc
index e097430..c259c76 100644
--- a/scribo/sandbox/arthur/xml_transform/main.cc
+++ b/scribo/sandbox/arthur/xml_transform/main.cc
@@ -9,15 +9,15 @@ int main(int argc, char **argv)
man = "xml_transform\n";
man += "OPTIONS:\n\n";
man += "HTML output:\n";
- man += "\t--html <xml> <ppm> <out_dir> : HTML output with non-text regions croped into many png files.\n";
+ man += "\t--html <xml> <ppm> <out_dir> : HTML output with non-text regions cropped into many png files.\n";
man += "\t--html-base64 <xml> <out_dir> : HTML output from a container XML file.\n\n";
man += "PDF output:\n";
- man += "\t--pdf <xml> <ppm> <out_dir> : PDF output with non-text regions croped into many png files.\n";
+ man += "\t--pdf <xml> <ppm> <out_dir> : PDF output with non-text regions cropped into many png files.\n";
man += "\t--pdf-no-crop <xml> <ppm> <out_dir>: PDF output with the entire picture displayed over the text.\n";
man += "\t--pdf-base64 <xml> <out_dir> : PDF output from a container XML file.\n";
man += "\t--pdf-base64-no-crop <xml> <ppm> <out_dir> : PDF with the entire picture displayed over the text, the picture is loaded from a container XML file.\n\n";
man += "Base 64 operations:\n";
- man += "\t--to-base64 <xml> <ppm> <out_xml> : Produces a container XML file by converting croped pictures into base 64 format.\n";
+ man += "\t--to-base64 <xml> <ppm> <out_xml> : Produces a container XML file by converting cropped pictures into base 64 format.\n";
man += "\t--to-base64-no-crop <xml> <ppm> <out_xml> : Same as to-base64 but only the picture is converted in base 64.\n";
man += "\t--from-base64 <xml> <out_dir> : Decodes a XML container file to produce original image files.\n";
--
1.5.6.5
1
0
16 Nov '10
* demo/viewer/viewer.cc: Clean vectors when load new picture.
---
scribo/ChangeLog | 6 ++++++
scribo/demo/viewer/viewer.cc | 12 +++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 1462eb2..69d6306 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,11 @@
2010-07-21 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
+ Fix Segfault bug in Qt interface.
+
+ * demo/viewer/viewer.cc: Clean vectors when load new picture.
+
+2010-07-21 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
+
Small changes in xml_transform.
* scribo/sandbox/arthur/xml_transform/README
diff --git a/scribo/demo/viewer/viewer.cc b/scribo/demo/viewer/viewer.cc
index 10c1a43..36b8d82 100644
--- a/scribo/demo/viewer/viewer.cc
+++ b/scribo/demo/viewer/viewer.cc
@@ -331,18 +331,17 @@ Viewer::add_region(QDomNode father, QString attr_id)
void
Viewer::load_xml(QString filename)
{
- text_vector_.clear();
- image_vector_.clear();
-
app_->setOverrideCursor(QCursor(Qt::WaitCursor));
emit fill_xml(filename);
if (image_ && image_->scene() && image_->scene() == scene_)
scene_->removeItem(image_);
+ text_vector_.clear();
+ image_vector_.clear();
scene_->clear();
- if (!base64_ && use_image_)
+ if (!base64_ && use_image_ && image_)
scene_->addItem(image_);
scene_->update();
@@ -470,7 +469,7 @@ Viewer::load_xml(QString filename)
region = region.nextSibling();
}
- emit updated();
+ //emit updated();
scene_->update();
key_wgt_->update_all();
@@ -483,8 +482,11 @@ Viewer::load(QString filename, bool b)
app_->setOverrideCursor(QCursor(Qt::WaitCursor));
scene_->clear();
+ text_vector_.clear();
+ image_vector_.clear();
scene_->update();
image_ = 0;
+ xml_file_ = QString::Null();
// Load the image in a pixmap that is directly shown on screen.
// This is very slow when used with the normal rendering system.
--
1.5.6.5
1
0
* arthur/xml_transform/README
* arthur/xml_transform/loader.cc
* arthur/xml_transform/loader.hh
* arthur/xml_transform/main.cc
* arthur/xml_transform/xml_transform.cc
* arthur/xml_transform/xml_transform.hh
* arthur/xml_transform/templates/pdf/regions_svg.xsl,
* arthur/xml_transform/templates/pdf/svg_generator.sh: New.
---
scribo/sandbox/ChangeLog | 15 +++
scribo/sandbox/arthur/xml_transform/README | 25 ++++--
scribo/sandbox/arthur/xml_transform/loader.cc | 15 +++
scribo/sandbox/arthur/xml_transform/loader.hh | 1 +
scribo/sandbox/arthur/xml_transform/main.cc | 41 ++++++---
.../xml_transform/templates/pdf/regions_svg.xsl | 98 ++++++++++++++++++++
.../xml_transform/templates/pdf/svg_generator.sh | 3 +
.../sandbox/arthur/xml_transform/xml_transform.cc | 10 ++
.../sandbox/arthur/xml_transform/xml_transform.hh | 1 +
9 files changed, 188 insertions(+), 21 deletions(-)
create mode 100644 scribo/sandbox/arthur/xml_transform/templates/pdf/regions_svg.xsl
create mode 100644 scribo/sandbox/arthur/xml_transform/templates/pdf/svg_generator.sh
diff --git a/scribo/sandbox/ChangeLog b/scribo/sandbox/ChangeLog
index 8d7b3e9..7c53037 100644
--- a/scribo/sandbox/ChangeLog
+++ b/scribo/sandbox/ChangeLog
@@ -1,3 +1,18 @@
+2010-07-22 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
+
+ SVG output.
+
+ * arthur/xml_transform/README
+ * arthur/xml_transform/loader.cc
+ * arthur/xml_transform/loader.hh
+ * arthur/xml_transform/main.cc
+ * arthur/xml_transform/xml_transform.cc
+ * arthur/xml_transform/xml_transform.hh
+
+ * arthur/xml_transform/templates/pdf/regions_svg.xsl,
+ * arthur/xml_transform/templates/pdf/svg_generator.sh: New.
+
+
2010-07-15 Arthur Crepin-Leblond <crepin(a)stockholm.lrde.epita.fr>
XML Tranform.
diff --git a/scribo/sandbox/arthur/xml_transform/README b/scribo/sandbox/arthur/xml_transform/README
index aedf220..4e98a76 100644
--- a/scribo/sandbox/arthur/xml_transform/README
+++ b/scribo/sandbox/arthur/xml_transform/README
@@ -1,23 +1,29 @@
xml_transform
-
OPTIONS:
HTML output:
- --html <xml> <ppm> <out_dir> : HTML output with non-text regions croped into many png files.
+ --html <xml> <ppm> <out_dir> : HTML output with non-text regions cropped into many png files.
--html-base64 <xml> <out_dir> : HTML output from a container XML file.
PDF output:
- --pdf <xml> <ppm> <out_dir> : PDF output with non-text regions croped into many png files.
+ --pdf <xml> <ppm> <out_dir> : PDF output with non-text regions cropped into many png files.
--pdf-no-crop <xml> <ppm> <out_dir>: PDF output with the entire picture displayed over the text.
--pdf-base64 <xml> <out_dir> : PDF output from a container XML file.
- --pdf-base64-no-crop <xml> <ppm> <out_dir> : PDF with the entire picture displayed over the text,
- the picture is loaded from a container XML file.
+ --pdf-base64-no-crop <xml> <ppm> <out_dir> : PDF with the entire picture displayed over the text, the picture is loaded from a container XML file.
+
+SVG output:
+ --svg <xml> <out_dir> : SVG output (works only with base 64 xml encoded.
Base 64 operations:
- --to-base64 <xml> <ppm> <out_xml> : Produces a container XML file by converting croped pictures into base 64 format.
+ --to-base64 <xml> <ppm> <out_xml> : Produces a container XML file by converting cropped pictures into base 64 format.
--to-base64-no-crop <xml> <ppm> <out_xml> : Same as to-base64 but only the picture is converted in base 64.
--from-base64 <xml> <out_dir> : Decodes a XML container file to produce original image files.
+For PDF/HTML/SVG output, Bourne shell scripts are provided to produce the outputs, just run sh *_generator.sh
+Requirements:
+PDF : fop >= 0.95
+HTML : xsltproc
+SVG : trunk version of fop
BUILD:
@@ -25,5 +31,10 @@ Chnage the environment variable QMAKE_CXXFLAGS in xml_transfrom.pro then
mkdir _build
cd _build
+cp -r ../templates .
qmake ../xml_transfrom.pro
-make
\ No newline at end of file
+make
+
+/!\ IMPORTANT NOTE /!\
+
+xml_transfrom uses a templates directory, binary and this folder should be in the same place.
\ No newline at end of file
diff --git a/scribo/sandbox/arthur/xml_transform/loader.cc b/scribo/sandbox/arthur/xml_transform/loader.cc
index 2b64337..1698899 100644
--- a/scribo/sandbox/arthur/xml_transform/loader.cc
+++ b/scribo/sandbox/arthur/xml_transform/loader.cc
@@ -126,6 +126,21 @@ void Loader::add_pdf_templates(bool crop, bool base64, QString output)
}
}
+void Loader::add_svg_templates(QString output)
+{
+ QFile regions("templates/pdf/regions_svg.xsl");
+ regions.copy(output + "regions.xsl");
+
+ QFile gen("templates/pdf/svg_generator.sh");
+ gen.copy(output + "svg_generator.sh");
+
+ QFile line("templates/pdf/line.xsl");
+ line.copy(output + "line.xsl");
+
+ QFile xsl("templates/pdf/main_crop.xsl");
+ xsl.copy(output + "main.xsl");
+}
+
bool Loader::xml_output(QString xml_file, bool html, QString output)
{
QFile file(xml_file);
diff --git a/scribo/sandbox/arthur/xml_transform/loader.hh b/scribo/sandbox/arthur/xml_transform/loader.hh
index fadceed..3cbae5c 100644
--- a/scribo/sandbox/arthur/xml_transform/loader.hh
+++ b/scribo/sandbox/arthur/xml_transform/loader.hh
@@ -42,6 +42,7 @@ class Loader : public QObject
QDomDocument* xml_to_dom(QString xml_file);
bool set_output(QString& output);
void add_pdf_templates(bool crop, bool base64, QString output);
+ void add_svg_templates(QString output);
void add_html_templates(bool base64, QString output);
};
diff --git a/scribo/sandbox/arthur/xml_transform/main.cc b/scribo/sandbox/arthur/xml_transform/main.cc
index c259c76..d1c789d 100644
--- a/scribo/sandbox/arthur/xml_transform/main.cc
+++ b/scribo/sandbox/arthur/xml_transform/main.cc
@@ -6,20 +6,27 @@ int main(int argc, char **argv)
{
std::string man;
- man = "xml_transform\n";
- man += "OPTIONS:\n\n";
- man += "HTML output:\n";
- man += "\t--html <xml> <ppm> <out_dir> : HTML output with non-text regions cropped into many png files.\n";
- man += "\t--html-base64 <xml> <out_dir> : HTML output from a container XML file.\n\n";
- man += "PDF output:\n";
- man += "\t--pdf <xml> <ppm> <out_dir> : PDF output with non-text regions cropped into many png files.\n";
- man += "\t--pdf-no-crop <xml> <ppm> <out_dir>: PDF output with the entire picture displayed over the text.\n";
- man += "\t--pdf-base64 <xml> <out_dir> : PDF output from a container XML file.\n";
- man += "\t--pdf-base64-no-crop <xml> <ppm> <out_dir> : PDF with the entire picture displayed over the text, the picture is loaded from a container XML file.\n\n";
- man += "Base 64 operations:\n";
- man += "\t--to-base64 <xml> <ppm> <out_xml> : Produces a container XML file by converting cropped pictures into base 64 format.\n";
- man += "\t--to-base64-no-crop <xml> <ppm> <out_xml> : Same as to-base64 but only the picture is converted in base 64.\n";
- man += "\t--from-base64 <xml> <out_dir> : Decodes a XML container file to produce original image files.\n";
+ man = "xml_transform\n"
+ "OPTIONS:\n\n"
+ "HTML output:\n"
+ "\t--html <xml> <ppm> <out_dir> : HTML output with non-text regions cropped into many png files.\n"
+ "\t--html-base64 <xml> <out_dir> : HTML output from a container XML file.\n\n"
+ "PDF output:\n"
+ "\t--pdf <xml> <ppm> <out_dir> : PDF output with non-text regions cropped into many png files.\n"
+ "\t--pdf-no-crop <xml> <ppm> <out_dir>: PDF output with the entire picture displayed over the text.\n"
+ "\t--pdf-base64 <xml> <out_dir> : PDF output from a container XML file.\n"
+ "\t--pdf-base64-no-crop <xml> <ppm> <out_dir> : PDF with the entire picture displayed over the text, the picture is loaded from a container XML file.\n\n"
+ "SVG output:\n"
+ "\t--svg <xml> <out_dir> : SVG output (works only with base 64 xml encoded.\n\n"
+ "Base 64 operations:\n"
+ "\t--to-base64 <xml> <ppm> <out_xml> : Produces a container XML file by converting cropped pictures into base 64 format.\n"
+ "\t--to-base64-no-crop <xml> <ppm> <out_xml> : Same as to-base64 but only the picture is converted in base 64.\n"
+ "\t--from-base64 <xml> <out_dir> : Decodes a XML container file to produce original image files.\n\n"
+ "For PDF/HTML/SVG output, Bourne shell scripts are provided to produce the outputs, just run sh *_generator.sh \n"
+ "Requirements:\n"
+ "PDF : fop >= 0.95\n"
+ "HTML : xsltproc\n"
+ "SVG : trunk version of fop\n";
if (argc > 4)
{
@@ -60,6 +67,7 @@ int main(int argc, char **argv)
else if (argc > 3)
{
std::string pdfbase64 = "--pdf-base64";
+ std::string svg = "--svg";
std::string pdfbase64nocrop = "--pdf-base64-no-crop";
std::string htmlbase64 = "--html-base64";
std::string from_base64 = "--from-base64";
@@ -69,6 +77,11 @@ int main(int argc, char **argv)
XmlTransform xmlt(argv[2], QString::Null(), argv[3]);
xmlt.createPDF(true, true);
}
+ else if (svg.compare(argv[1]) == 0)
+ {
+ XmlTransform xmlt(argv[2], QString::Null(), argv[3]);
+ xmlt.createSVG();
+ }
else if (pdfbase64nocrop.compare(argv[1]) == 0)
{
XmlTransform xmlt(argv[2], QString::Null(), argv[3]);
diff --git a/scribo/sandbox/arthur/xml_transform/templates/pdf/regions_svg.xsl b/scribo/sandbox/arthur/xml_transform/templates/pdf/regions_svg.xsl
new file mode 100644
index 0000000..86b5f51
--- /dev/null
+++ b/scribo/sandbox/arthur/xml_transform/templates/pdf/regions_svg.xsl
@@ -0,0 +1,98 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
+
+ <!-- FILE: regions.xsl
+ DESCRIPTION: Match all regions that are not text to display them -->
+
+ <xsl:template match="pcGts/page/image_region|
+ pcGts/page/graphic_region|
+ pcGts/page/chart_region|
+ pcGts/page/table_region|
+ pcGts/page/separator_region">
+
+ <!-- ID of the region, used to display id.png -->
+ <xsl:variable name="data">
+ <xsl:value-of select="container/data" />
+ </xsl:variable>
+
+ <!-- Regions coordinates -->
+ <xsl:variable name="y1">
+ <xsl:for-each select="coords/point">
+ <xsl:sort select="@y" order="ascending" data-type="number"/>
+ <xsl:if test="position() = 1">
+ <xsl:value-of select="@y" />
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:variable name="x1">
+ <xsl:for-each select="coords/point">
+ <xsl:sort select="@x" order="ascending" data-type="number"/>
+ <xsl:if test="position() = 1">
+ <xsl:value-of select="@x" />
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:variable name="y2">
+ <xsl:for-each select="coords/point">
+ <xsl:sort select="@y" order="descending" data-type="number"/>
+ <xsl:if test="position() = 1">
+ <xsl:value-of select="@y" />
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+
+ <xsl:variable name="x2">
+ <xsl:for-each select="coords/point">
+ <xsl:sort select="@x" order="descending" data-type="number"/>
+ <xsl:if test="position() = 1">
+ <xsl:value-of select="@x" />
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:variable>
+ <!-- END OF regions coordinates -->
+
+ <fo:block-container>
+
+ <fo:block>
+ <fo:instream-foreign-object>
+ <svg:svg xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ Version="1.1">
+
+ <xsl:attribute name="viewBox">
+ <xsl:value-of select="$x1" /> <xsl:value-of select="$y1" /> <xsl:value-of select="$x2" /> <xsl:value-of select="$y2" />
+ </xsl:attribute>
+
+ <svg:image position="absolute">
+
+ <xsl:attribute name="y">
+ <xsl:value-of select="$y1" />
+ </xsl:attribute>
+
+ <xsl:attribute name="x">
+ <xsl:value-of select="$x1" />
+ </xsl:attribute>
+
+ <xsl:attribute name="width">
+ <xsl:value-of select="$x2 - $x1" />
+ </xsl:attribute>
+
+ <xsl:attribute name="height">
+ <xsl:value-of select="$y2 - $y1" />
+ </xsl:attribute>
+
+ <xsl:attribute name="xlink:href">data:image/png;base64,<xsl:value-of select="$data" /></xsl:attribute>
+ </svg:image>
+
+ </svg:svg>
+
+ </fo:instream-foreign-object>
+
+ </fo:block>
+ </fo:block-container>
+
+ </xsl:template>
+
+</xsl:stylesheet>
diff --git a/scribo/sandbox/arthur/xml_transform/templates/pdf/svg_generator.sh b/scribo/sandbox/arthur/xml_transform/templates/pdf/svg_generator.sh
new file mode 100644
index 0000000..0d4907c
--- /dev/null
+++ b/scribo/sandbox/arthur/xml_transform/templates/pdf/svg_generator.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+fop -xsl main.xsl -xml output.xml -svg output.svg
\ No newline at end of file
diff --git a/scribo/sandbox/arthur/xml_transform/xml_transform.cc b/scribo/sandbox/arthur/xml_transform/xml_transform.cc
index ebfbed8..c40366a 100644
--- a/scribo/sandbox/arthur/xml_transform/xml_transform.cc
+++ b/scribo/sandbox/arthur/xml_transform/xml_transform.cc
@@ -117,6 +117,16 @@ void XmlTransform::createPDF (bool crop, bool base64)
abort();
}
+void XmlTransform::createSVG ()
+{
+ if (loader_->xml_output(xml_file_, false, output_dir_))
+ {
+ loader_->add_svg_templates(output_dir_);
+ }
+ else
+ abort();
+}
+
void XmlTransform::createHTML(bool base64)
{
if (loader_->xml_output(xml_file_, true, output_dir_))
diff --git a/scribo/sandbox/arthur/xml_transform/xml_transform.hh b/scribo/sandbox/arthur/xml_transform/xml_transform.hh
index 172bddb..30d5c6c 100644
--- a/scribo/sandbox/arthur/xml_transform/xml_transform.hh
+++ b/scribo/sandbox/arthur/xml_transform/xml_transform.hh
@@ -42,6 +42,7 @@ class XmlTransform : public QObject
void createHTML(bool base64);
void createPDF(bool crop, bool base64);
+ void createSVG();
void toBase64(bool crop);
void fromBase64();
--
1.5.6.5
1
0
16 Nov '10
* arthur/xml_transform/templates/opendoc/css.css,
* arthur/xml_transform/templates/opendoc/opendoc_generator.sh,
* arthur/xml_transform/templates/opendoc/xsl.xsl: New.
* arthur/xml_transform/README
* arthur/xml_transform/loader.cc
* arthur/xml_transform/loader.hh
* arthur/xml_transform/main.cc
* arthur/xml_transform/xml_transform.cc
* arthur/xml_transform/xml_transform.hh
---
scribo/sandbox/ChangeLog | 15 ++++++++++++
scribo/sandbox/arthur/xml_transform/README | 9 ++++++-
scribo/sandbox/arthur/xml_transform/loader.cc | 12 ++++++++++
scribo/sandbox/arthur/xml_transform/loader.hh | 1 +
scribo/sandbox/arthur/xml_transform/main.cc | 18 ++++++++++++--
.../templates/{html => opendoc}/css.css | 1 -
.../templates/opendoc/opendoc_generator.sh | 24 ++++++++++++++++++++
.../templates/{html => opendoc}/xsl.xsl | 6 +----
.../sandbox/arthur/xml_transform/xml_transform.cc | 19 +++++++++++++++
.../sandbox/arthur/xml_transform/xml_transform.hh | 1 +
10 files changed, 96 insertions(+), 10 deletions(-)
copy scribo/sandbox/arthur/xml_transform/templates/{html => opendoc}/css.css (93%)
mode change 100644 => 100755
create mode 100755 scribo/sandbox/arthur/xml_transform/templates/opendoc/opendoc_generator.sh
copy scribo/sandbox/arthur/xml_transform/templates/{html => opendoc}/xsl.xsl (95%)
mode change 100644 => 100755
diff --git a/scribo/sandbox/ChangeLog b/scribo/sandbox/ChangeLog
index 7c53037..176e809 100644
--- a/scribo/sandbox/ChangeLog
+++ b/scribo/sandbox/ChangeLog
@@ -1,3 +1,18 @@
+2010-07-23 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
+
+ OpenDocument output (odt and odf).
+
+ * arthur/xml_transform/templates/opendoc/css.css,
+ * arthur/xml_transform/templates/opendoc/opendoc_generator.sh,
+ * arthur/xml_transform/templates/opendoc/xsl.xsl: New.
+
+ * arthur/xml_transform/README
+ * arthur/xml_transform/loader.cc
+ * arthur/xml_transform/loader.hh
+ * arthur/xml_transform/main.cc
+ * arthur/xml_transform/xml_transform.cc
+ * arthur/xml_transform/xml_transform.hh
+
2010-07-22 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
SVG output.
diff --git a/scribo/sandbox/arthur/xml_transform/README b/scribo/sandbox/arthur/xml_transform/README
index 4e98a76..9ac4973 100644
--- a/scribo/sandbox/arthur/xml_transform/README
+++ b/scribo/sandbox/arthur/xml_transform/README
@@ -16,14 +16,21 @@ SVG output:
Base 64 operations:
--to-base64 <xml> <ppm> <out_xml> : Produces a container XML file by converting cropped pictures into base 64 format.
+
+OpenDocument output:
+ --open <xml> <ppm> <out_dir> : OpenDocument output (odt, odf).
+
+Base 64 operations:
+ --to-base64 <xml> <ppm> <out_xml> : Produces a container XML file by converting cropped pictures into base 64 format.
--to-base64-no-crop <xml> <ppm> <out_xml> : Same as to-base64 but only the picture is converted in base 64.
--from-base64 <xml> <out_dir> : Decodes a XML container file to produce original image files.
-For PDF/HTML/SVG output, Bourne shell scripts are provided to produce the outputs, just run sh *_generator.sh
+For PDF/HTML/SVG/OD output, Bourne shell scripts are provided to produce the outputs, just run sh *_generator.sh
Requirements:
PDF : fop >= 0.95
HTML : xsltproc
SVG : trunk version of fop
+OpenDocument : ooconvert
BUILD:
diff --git a/scribo/sandbox/arthur/xml_transform/loader.cc b/scribo/sandbox/arthur/xml_transform/loader.cc
index 1698899..d4778a9 100644
--- a/scribo/sandbox/arthur/xml_transform/loader.cc
+++ b/scribo/sandbox/arthur/xml_transform/loader.cc
@@ -141,6 +141,18 @@ void Loader::add_svg_templates(QString output)
xsl.copy(output + "main.xsl");
}
+void Loader::add_open_templates(QString output)
+{
+ QFile css("templates/opendoc/css.css");
+ css.copy(output + "css.css");
+
+ QFile gen("templates/opendoc/opendoc_generator.sh");
+ gen.copy(output + "opendoc_generator.sh");
+
+ QFile xsl("templates/opendoc/xsl.xsl");
+ xsl.copy(output + "xsl.xsl");
+}
+
bool Loader::xml_output(QString xml_file, bool html, QString output)
{
QFile file(xml_file);
diff --git a/scribo/sandbox/arthur/xml_transform/loader.hh b/scribo/sandbox/arthur/xml_transform/loader.hh
index 3cbae5c..a5c3637 100644
--- a/scribo/sandbox/arthur/xml_transform/loader.hh
+++ b/scribo/sandbox/arthur/xml_transform/loader.hh
@@ -43,6 +43,7 @@ class Loader : public QObject
bool set_output(QString& output);
void add_pdf_templates(bool crop, bool base64, QString output);
void add_svg_templates(QString output);
+ void add_open_templates(QString output);
void add_html_templates(bool base64, QString output);
};
diff --git a/scribo/sandbox/arthur/xml_transform/main.cc b/scribo/sandbox/arthur/xml_transform/main.cc
index d1c789d..34a1b6e 100644
--- a/scribo/sandbox/arthur/xml_transform/main.cc
+++ b/scribo/sandbox/arthur/xml_transform/main.cc
@@ -19,18 +19,25 @@ int main(int argc, char **argv)
"SVG output:\n"
"\t--svg <xml> <out_dir> : SVG output (works only with base 64 xml encoded.\n\n"
"Base 64 operations:\n"
+ "\t--to-base64 <xml> <ppm> <out_xml> : Produces a container XML file by converting cropped pictures into base 64 format.\n\n"
+
+ "OpenDocument output:\n"
+ "\t--open <xml> <ppm> <out_dir> : OpenDocument output (odt, odf).\n\n"
+ "Base 64 operations:\n"
"\t--to-base64 <xml> <ppm> <out_xml> : Produces a container XML file by converting cropped pictures into base 64 format.\n"
"\t--to-base64-no-crop <xml> <ppm> <out_xml> : Same as to-base64 but only the picture is converted in base 64.\n"
"\t--from-base64 <xml> <out_dir> : Decodes a XML container file to produce original image files.\n\n"
- "For PDF/HTML/SVG output, Bourne shell scripts are provided to produce the outputs, just run sh *_generator.sh \n"
+ "For PDF/HTML/SVG/OD output, Bourne shell scripts are provided to produce the outputs, just run sh *_generator.sh \n"
"Requirements:\n"
"PDF : fop >= 0.95\n"
"HTML : xsltproc\n"
- "SVG : trunk version of fop\n";
+ "SVG : trunk version of fop\n"
+ "OpenDocument : ooconvert";
if (argc > 4)
{
std::string html = "--html";
+ std::string open = "--open";
std::string pdf = "--pdf";
std::string pdf_no_crop = "--pdf-no-crop";
std::string to_base64 = "--to-base64";
@@ -41,11 +48,16 @@ int main(int argc, char **argv)
XmlTransform xmlt(argv[2], argv[3], argv[4]);
xmlt.createHTML(false);
}
- if (pdf.compare(argv[1]) == 0)
+ else if (pdf.compare(argv[1]) == 0)
{
XmlTransform xmlt(argv[2], argv[3], argv[4]);
xmlt.createPDF(true, false);
}
+ else if (open.compare(argv[1]) == 0)
+ {
+ XmlTransform xmlt(argv[2], argv[3], argv[4]);
+ xmlt.createOpen();
+ }
else if (pdf_no_crop.compare(argv[1]) == 0)
{
XmlTransform xmlt(argv[2], argv[3], argv[4]);
diff --git a/scribo/sandbox/arthur/xml_transform/templates/html/css.css b/scribo/sandbox/arthur/xml_transform/templates/opendoc/css.css
old mode 100644
new mode 100755
similarity index 93%
copy from scribo/sandbox/arthur/xml_transform/templates/html/css.css
copy to scribo/sandbox/arthur/xml_transform/templates/opendoc/css.css
index 0443390..1559149
--- a/scribo/sandbox/arthur/xml_transform/templates/html/css.css
+++ b/scribo/sandbox/arthur/xml_transform/templates/opendoc/css.css
@@ -1,7 +1,6 @@
.line
{
position:absolute;
- background-color:white;
z-index:7;
display:inline;
white-space:pre;
diff --git a/scribo/sandbox/arthur/xml_transform/templates/opendoc/opendoc_generator.sh b/scribo/sandbox/arthur/xml_transform/templates/opendoc/opendoc_generator.sh
new file mode 100755
index 0000000..c2d9e6f
--- /dev/null
+++ b/scribo/sandbox/arthur/xml_transform/templates/opendoc/opendoc_generator.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+if [ -z "$1" ]
+then
+ echo "opendoc_generator <odt|odf>";
+else
+ if [ "$1" == "odt" ]
+ then
+ echo "saving to output.odt";
+ xsltproc xsl.xsl output.xml > output.html
+ ooconvert output.html output.odt
+ rm output.html
+ elif [ "$1" == "odf" ]
+ then
+ echo "saving to output.odf";
+ xsltproc xsl.xsl output.xml > output.html
+ ooconvert output.html output.odf;
+ rm output.html
+ else
+ echo "opendoc_generator <odt|odf>";
+ fi
+fi
+
+#rm output.html
\ No newline at end of file
diff --git a/scribo/sandbox/arthur/xml_transform/templates/html/xsl.xsl b/scribo/sandbox/arthur/xml_transform/templates/opendoc/xsl.xsl
old mode 100644
new mode 100755
similarity index 95%
copy from scribo/sandbox/arthur/xml_transform/templates/html/xsl.xsl
copy to scribo/sandbox/arthur/xml_transform/templates/opendoc/xsl.xsl
index 1f29044..bf1cc30
--- a/scribo/sandbox/arthur/xml_transform/templates/html/xsl.xsl
+++ b/scribo/sandbox/arthur/xml_transform/templates/opendoc/xsl.xsl
@@ -15,8 +15,6 @@
pcGts/page/chart_region|
pcGts/page/table_region|
pcGts/page/separator_region|
- pcGts/page/text_region|
- pcGts/page/text_region/paragraph|
pcGts/page/text_region/paragraph/line">
<!-- Regions Coordinates -->
@@ -129,10 +127,8 @@
</xsl:choose>
</xsl:variable>
- <div class="line" onmouseover="this.style.opacity=0.2;this.filters.alpha.opacity=20"
- onmouseout="this.style.opacity=1;this.filters.alpha.opacity=100">
+ <div class="line">
<xsl:attribute name="style">
- opacity:1;
height:auto;
font-size:<xsl:value-of select="$a+$d" />px;
width:<xsl:value-of select="$x2 - $x1" />px;
diff --git a/scribo/sandbox/arthur/xml_transform/xml_transform.cc b/scribo/sandbox/arthur/xml_transform/xml_transform.cc
index c40366a..90af5a5 100644
--- a/scribo/sandbox/arthur/xml_transform/xml_transform.cc
+++ b/scribo/sandbox/arthur/xml_transform/xml_transform.cc
@@ -117,6 +117,25 @@ void XmlTransform::createPDF (bool crop, bool base64)
abort();
}
+void XmlTransform::createOpen ()
+{
+ if (loader_->xml_output(xml_file_, false, output_dir_))
+ {
+ QString output = output_dir_;
+ output.append("img");
+
+ if (loader_->set_output(output))
+ {
+ crop_->crop_regions();
+ loader_->add_open_templates(output_dir_);
+ }
+ else
+ abort();
+ }
+ else
+ abort();
+}
+
void XmlTransform::createSVG ()
{
if (loader_->xml_output(xml_file_, false, output_dir_))
diff --git a/scribo/sandbox/arthur/xml_transform/xml_transform.hh b/scribo/sandbox/arthur/xml_transform/xml_transform.hh
index 30d5c6c..ad83fd5 100644
--- a/scribo/sandbox/arthur/xml_transform/xml_transform.hh
+++ b/scribo/sandbox/arthur/xml_transform/xml_transform.hh
@@ -43,6 +43,7 @@ class XmlTransform : public QObject
void createHTML(bool base64);
void createPDF(bool crop, bool base64);
void createSVG();
+ void createOpen();
void toBase64(bool crop);
void fromBase64();
--
1.5.6.5
1
0
16 Nov '10
* scribo/demo/viewer/key_widget.cc
* scribo/demo/viewer/viewer.cc
---
scribo/ChangeLog | 7 +++++++
scribo/demo/viewer/key_widget.cc | 8 ++++----
scribo/demo/viewer/viewer.cc | 8 +++++---
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 69d6306..1417b40 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,10 @@
+2010-08-04 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
+
+ Fix bug in Qt interface.
+
+ * scribo/demo/viewer/key_widget.cc
+ * scribo/demo/viewer/viewer.cc
+
2010-07-21 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
Fix Segfault bug in Qt interface.
diff --git a/scribo/demo/viewer/key_widget.cc b/scribo/demo/viewer/key_widget.cc
index 44839c5..228ad67 100644
--- a/scribo/demo/viewer/key_widget.cc
+++ b/scribo/demo/viewer/key_widget.cc
@@ -90,16 +90,16 @@ KeyWidget::change_mode(bool b)
if (b)
{
- text_->child(id_region)->setCheckState(0, Qt::Checked);
+ //text_->child(id_region)->setCheckState(0, Qt::Checked);
text_->child(id_region)->setHidden(false);
- text_->child(id_line)->setCheckState(0, Qt::Checked);
+ // text_->child(id_line)->setCheckState(0, Qt::Checked);
text_->child(id_line)->setHidden(false);
}
else
{
- text_->child(id_region)->setCheckState(0, Qt::Unchecked);
+ //text_->child(id_region)->setCheckState(0, Qt::Unchecked);
text_->child(id_region)->setHidden(true);
- text_->child(id_line)->setCheckState(0, Qt::Unchecked);
+ // text_->child(id_line)->setCheckState(0, Qt::Unchecked);
text_->child(id_line)->setHidden(true);
}
}
diff --git a/scribo/demo/viewer/viewer.cc b/scribo/demo/viewer/viewer.cc
index 36b8d82..38ca8b1 100644
--- a/scribo/demo/viewer/viewer.cc
+++ b/scribo/demo/viewer/viewer.cc
@@ -441,7 +441,7 @@ Viewer::load_xml(QString filename)
}
}
- if (extended_mode_ &&
+ if ((extended_mode_ || text_) &&
region.toElement().tagName().contains("text_region"))
{
QDomNode para = region.firstChild();
@@ -450,7 +450,8 @@ Viewer::load_xml(QString filename)
if (!para.isNull())
{
- add_region(para, attr_id);
+ if (extended_mode_)
+ add_region(para, attr_id);
QDomNode line = para.firstChild();
while (!line.isNull() && !line.toElement().tagName().contains("line"))
@@ -458,7 +459,8 @@ Viewer::load_xml(QString filename)
if (!line.isNull())
{
- add_region(line, attr_id);
+ if (extended_mode_)
+ add_region(line, attr_id);
add_text(line, region);
}
}
--
1.5.6.5
1
0
16 Nov '10
* demo/viewer/browser_widget.cc: Change arrows icon.
* demo/viewer/help_dialog.cc: Add more informations.
* demo/viewer/key_widget.cc,
* demo/viewer/key_widget.hh: Add setAll(bool).
* demo/viewer/viewer.cc,
* demo/viewer/viewer.hh: Add shortcuts.
---
scribo/ChangeLog | 11 ++++
scribo/demo/viewer/browser_widget.cc | 5 +-
scribo/demo/viewer/help_dialog.cc | 13 ++++--
scribo/demo/viewer/key_widget.cc | 15 ++++++-
scribo/demo/viewer/key_widget.hh | 3 +
scribo/demo/viewer/viewer.cc | 85 +++++++++++++++++++++++-----------
scribo/demo/viewer/viewer.hh | 1 +
7 files changed, 99 insertions(+), 34 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 1417b40..f2160fa 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,3 +1,14 @@
+2010-08-06 Arthur Crepin-Leblond <crepin(a)lrde.epita.fr>
+
+ Add shortcuts in Qt interface.
+
+ * demo/viewer/browser_widget.cc: Change arrows icon.
+ * demo/viewer/help_dialog.cc: Add more informations.
+ * demo/viewer/key_widget.cc,
+ * demo/viewer/key_widget.hh: Add setAll(bool).
+ * demo/viewer/viewer.cc,
+ * demo/viewer/viewer.hh: Add shortcuts.
+
2010-08-04 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
Fix bug in Qt interface.
diff --git a/scribo/demo/viewer/browser_widget.cc b/scribo/demo/viewer/browser_widget.cc
index b9ccbec..dd0bc1c 100644
--- a/scribo/demo/viewer/browser_widget.cc
+++ b/scribo/demo/viewer/browser_widget.cc
@@ -33,8 +33,9 @@ BrowserWidget::BrowserWidget(QDirModel* files, QString dir)
{
QToolButton* next= new QToolButton();
QToolButton* prev= new QToolButton();
- next->setArrowType(Qt::RightArrow);
- prev->setArrowType(Qt::LeftArrow);
+
+ prev->setIcon(style()->standardIcon(QStyle::SP_ArrowLeft));
+ next->setIcon(style()->standardIcon(QStyle::SP_ArrowRight));
QLabel* title = new QLabel(tr("Images"));
title->setAlignment(Qt::AlignHCenter);
diff --git a/scribo/demo/viewer/help_dialog.cc b/scribo/demo/viewer/help_dialog.cc
index 932d66f..836413a 100644
--- a/scribo/demo/viewer/help_dialog.cc
+++ b/scribo/demo/viewer/help_dialog.cc
@@ -40,10 +40,15 @@ HelpDialog::HelpDialog()
"Document layout viewer:\n"
"\n"
"Usage:\n"
- " - Choose an image file in the file browser\n"
- " - If the document layout is present\n"
- " (XML file with the same name),\n"
- " select regions to display their properties.\n"
+ " - Choose an image file in the file browser,\n"
+ "if XML file(s) whose prefix name is the same as\n"
+ "the image name (i.e.image _name(_ .*)?.xml) is present\n"
+ "then you can choose the one you want in the step\n"
+ "chooser to display it on the scene.\n"
+ "- To load a base 64 encoded XML file,\n"
+ "its extension has to be .xmlc otherwise \n"
+ "the program won't recognize it !\n"
+ " - Select regions to display their properties.\n"
" - Use the mouse or keyboard to move and zoom\n"
" (Arrows, PageUp, PageDown, Home, End).\n"
"\n");
diff --git a/scribo/demo/viewer/key_widget.cc b/scribo/demo/viewer/key_widget.cc
index 228ad67..f567992 100644
--- a/scribo/demo/viewer/key_widget.cc
+++ b/scribo/demo/viewer/key_widget.cc
@@ -39,9 +39,10 @@ KeyWidget::KeyWidget(const region::KeyMap& key_map)
items_->setHeaderHidden(true);
text_->setCheckState(0, Qt::Checked);
+ text_->setExpanded(true);
+
regions_->setCheckState(0, Qt::Checked);
regions_->setExpanded(true);
- text_->setExpanded(true);
for (int i = 0; i < 3; ++i)
add_item_(key_map.at(i).first, key_map.at(i).second,
@@ -70,6 +71,18 @@ void KeyWidget::update_all()
update(regions_->child(i));
}
+void KeyWidget::setAll(bool b)
+{
+ Qt::CheckState state;
+ if (b)
+ state = Qt::Checked;
+ else
+ state = Qt::Unchecked;
+
+ text_->setCheckState(0, state);
+ regions_->setCheckState(0, state);
+}
+
void KeyWidget::setAllCheck(QTreeWidgetItem* parent)
{
for (int i = 0; i < parent->childCount(); ++i)
diff --git a/scribo/demo/viewer/key_widget.hh b/scribo/demo/viewer/key_widget.hh
index 113835d..d261ec6 100644
--- a/scribo/demo/viewer/key_widget.hh
+++ b/scribo/demo/viewer/key_widget.hh
@@ -45,6 +45,9 @@ public:
signals:
void updated(int key, bool checked);
+public slots:
+ void setAll(bool b);
+
private slots:
void change_mode(bool b);
void update(QTreeWidgetItem* item);
diff --git a/scribo/demo/viewer/viewer.cc b/scribo/demo/viewer/viewer.cc
index 38ca8b1..41434ba 100644
--- a/scribo/demo/viewer/viewer.cc
+++ b/scribo/demo/viewer/viewer.cc
@@ -87,74 +87,94 @@ Viewer::Viewer(int &argc, char** argv)
win_->statusBar();
QMenu* file_menu = win_->menuBar()->addMenu(tr("File"));
- QAction* quit_action = new QAction(tr("Quit"), file_menu);
+ QMenu* option_menu = win_->menuBar()->addMenu(tr("Options"));
+ QMenu* help_menu = win_->menuBar()->addMenu(tr("Help"));
+
+ QAction* quit_action = create_action("Quit", file_menu,
+ "Exit the program.", "Ctrl+q");
connect(quit_action, SIGNAL(triggered()),
app_, SLOT(quit()));
- quit_action->setStatusTip(tr("Exit the program."));
file_menu->addAction(quit_action);
- QMenu* option_menu = win_->menuBar()->addMenu(tr("Options"));
- outline_action_ = new QAction(tr("Draw outline"), option_menu);
- outline_action_->setStatusTip(tr("Draw region outlines."));
+ outline_action_ = create_action("Draw outline", option_menu,
+ "Draw region outlines.", "Ctrl+o");
outline_action_->setCheckable(true);
outline_action_->setChecked(true);
connect(outline_action_, SIGNAL(toggled(bool)),
this, SIGNAL(setOutline(bool)));
option_menu->addAction(outline_action_);
- precise_action_ = new QAction(tr("Precise outline"), option_menu);
- precise_action_->setStatusTip(tr("1px outline relative to the image "
- "(1px relative to the view if off)."));
+
+ precise_action_ = create_action("Precise outline", option_menu,
+ "1px outline relative to the image "
+ "(1px relative to the view if off).",
+ "Ctrl+p");
precise_action_->setCheckable(true);
precise_action_->setChecked(false);
connect(precise_action_, SIGNAL(toggled(bool)),
this, SIGNAL(setPrecise(bool)));
option_menu->addAction(precise_action_);
- fill_action_ = new QAction(tr("Fill regions"), option_menu);
- fill_action_->setStatusTip(tr("Color the inside of regions."));
+
+ fill_action_ = create_action("Fill regions", option_menu,
+ "Color the inside of regions.", "Ctrl+f");
fill_action_->setCheckable(true);
fill_action_->setChecked(true);
connect(fill_action_, SIGNAL(toggled(bool)),
this, SIGNAL(setFill(bool)));
option_menu->addAction(fill_action_);
- QAction* cache_action = new QAction(tr("Disable cache"), file_menu);
- cache_action->setStatusTip(tr("Disable the image cache (useful for"
- " large images)."));
+ QAction* cache_action = create_action("Disable cache", option_menu,
+ "Disable the image cache (useful for"
+ " large images).", "Ctrl+c");
cache_action->setCheckable(true);
cache_action->setChecked(false);
connect(cache_action, SIGNAL(toggled(bool)),
this, SLOT(useCache(bool)));
option_menu->addAction(cache_action);
- QAction* extended_action = new QAction(tr("Extended mode"), file_menu);
- extended_action->setStatusTip(tr("If enabled, some features not supported by ICDAR"
- " are added such as text regions or text lines"));
+
+ QAction* extended_action = create_action("Extended mode", option_menu,
+ "If enabled, some features "
+ "not supported by ICDAR"
+ " are added such as text regions"
+ "or text lines", "Ctrl+e");
extended_action->setCheckable(true);
extended_action->setChecked(false);
connect(extended_action, SIGNAL(toggled(bool)),
this, SLOT(useExtended(bool)));
option_menu->addAction(extended_action);
- QAction* show_image_action = new QAction(tr("Show pictures"), file_menu);
- //show_image_action->setStatusTip(tr(""));
-
+ QAction* show_image_action = create_action("Show pictures", option_menu,
+ "Display pictures on the scene or not",
+ "Ctrl+i");
show_image_action->setCheckable(true);
show_image_action->setChecked(true);
connect(show_image_action, SIGNAL(toggled(bool)),
this, SLOT(useImage(bool)));
option_menu->addAction(show_image_action);
- QAction* show_text_action = new QAction(tr("Show text"), file_menu);
- show_text_action->setStatusTip(tr("Show detected text inside boxes."));
+ QAction* show_text_action = create_action("Show text", option_menu,
+ "Show detected text inside boxes.",
+ "Ctrl+t");
show_text_action->setCheckable(true);
show_text_action->setChecked(true);
connect(show_text_action, SIGNAL(toggled(bool)),
this, SLOT(useText(bool)));
option_menu->addAction(show_text_action);
- QMenu* help_menu = win_->menuBar()->addMenu(tr("Help"));
- QAction* about_action = new QAction(tr("About"), help_menu);
- about_action->setStatusTip(tr("About this program."));
+ key_wgt_ = new KeyWidget(key_map_);
+ QAction *show_region_action = create_action("Show regions", option_menu,
+ "Display regions that are present in"
+ " the XML file.",
+ "Ctrl+r");
+ show_region_action->setCheckable(true);
+ show_region_action->setChecked(true);
+ connect(show_region_action, SIGNAL(toggled(bool)),
+ key_wgt_, SLOT(setAll(bool)));
+ option_menu->addAction(show_region_action);
+
+ QAction* about_action = create_action("About", help_menu,
+ "About this program",
+ "Ctrl+h");
connect(about_action, SIGNAL(triggered()),
this, SLOT(help()));
help_menu->addAction(about_action);
@@ -167,7 +187,6 @@ Viewer::Viewer(int &argc, char** argv)
XmlWidget* xml_wgt = new XmlWidget();
BrowserWidget* browser_wgt =
new BrowserWidget(files_, argc != 2 ? QString() : argv[1]);
- key_wgt_ = new KeyWidget(key_map_);
ImageWidget* image_wgt = new ImageWidget(scene_);
scene_->setBackgroundBrush(scene_->palette().window());
@@ -276,6 +295,7 @@ Viewer::add_text(QDomNode line, QDomNode region)
QGraphicsTextItem* text_item = scene_->addText(text, font);
text_item->setPos(x_min, y_min);
text_item->setTextInteractionFlags(Qt::TextSelectableByMouse);
+ text_item->setZValue(5);
text_vector_ << text_item;
if (!text_)
scene_->removeItem(text_item);
@@ -441,8 +461,8 @@ Viewer::load_xml(QString filename)
}
}
- if ((extended_mode_ || text_) &&
- region.toElement().tagName().contains("text_region"))
+ // if ((extended_mode_ || text_) &&
+ if (region.toElement().tagName().contains("text_region"))
{
QDomNode para = region.firstChild();
while (!para.isNull() && !para.toElement().tagName().contains("paragraph"))
@@ -656,3 +676,14 @@ Viewer::change_base(bool b)
{
base64_ = b;
}
+
+
+QAction
+*Viewer::create_action(QString name, QMenu *menu, QString status, QString shortcut)
+{
+ QAction* action = new QAction(name, menu);
+ action->setStatusTip(status);
+ action->setShortcut(QKeySequence(shortcut));
+
+ return (action);
+}
diff --git a/scribo/demo/viewer/viewer.hh b/scribo/demo/viewer/viewer.hh
index b1f406d..30e01bb 100644
--- a/scribo/demo/viewer/viewer.hh
+++ b/scribo/demo/viewer/viewer.hh
@@ -77,6 +77,7 @@ private:
QPixmap load_base64(QString xml);
void add_region(QDomNode father, QString attr_id);
void add_text(QDomNode line, QDomNode region);
+ QAction *create_action(QString name, QMenu* menu, QString status, QString shortcut);
QApplication* app_;
QMainWindow* win_;
--
1.5.6.5
1
0
* arthur/xml_transform/_build/common.o,
* arthur/xml_transform/_build/image_crop.o: Delete.
---
scribo/sandbox/ChangeLog | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/scribo/sandbox/ChangeLog b/scribo/sandbox/ChangeLog
index 176e809..7f2e9a1 100644
--- a/scribo/sandbox/ChangeLog
+++ b/scribo/sandbox/ChangeLog
@@ -1,3 +1,46 @@
+2010-08-05 Arthur Crepin-Leblond <crepin(a)lrde.epita.fr>
+
+ Output change in xml_tranform.
+
+ * arthur/xml_transform/README
+ * arthur/xml_transform/templates/opendoc/xsl.xsl
+ * arthur/xml_transform/templates/pdf/main.xsl
+ * arthur/xml_transform/templates/pdf/regions.xsl
+
+ * arthur/xml_transform/image_crop.cc,
+ * arthur/xml_transform/image_crop.hh: Change ppm loader to magick loader.
+ * arthur/xml_transform/main.cc: Change man.
+
+ * arthur/xml_transform/templates/pdf/main_crop_64.xsl,
+ * arthur/xml_transform/templates/pdf/regions_base64.xsl,
+ * arthur/xml_transform/templates/pdf/regions_png.xsl,
+ * arthur/xml_transform/templates/html/html_generator.sh,
+ * arthur/xml_transform/templates/pdf/svg_generator.sh,
+ * arthur/xml_transform/templates/pdf/pdf_generator.sh: Delete.
+
+ * arthur/xml_transform/templates/html/xsl.xsl: Rename as...
+ * thur/xml_transform/templates/html/main.xsl: ...This.
+ * arthur/xml_transform/templates/html/xsl_base64.xsl: Rename as...
+ * arthur/xml_transform/templates/html/main.xsl: ...This.
+ * arthur/xml_transform/templates/pdf/regions_svg.xsl: Rename as...
+ * arthur/xml_transform/templates/svg/regions.xsl: ...This.
+
+ * arthur/xml_transform/templates/xml_transform.sh,
+ * arthur/xml_transform/templates/svg/line.xsl,
+ * arthur/xml_transform/templates/ooconvert,
+ * arthur/xml_transform/templates/pdf/full/line.xsl: New.
+
+ * arthur/xml_transform/xml_transform.cc,
+ * arthur/xml_transform/xml_transform.hh: Change output.
+ * arthur/xml_transform/xml_transform.pro: Add QMAKE_POST_LINK.
+
+2010-08-06 Arthur Crepin-Leblond <crepin(a)lrde.epita.fr>
+
+ Delete two build files.
+
+ * arthur/xml_transform/_build/common.o,
+ * arthur/xml_transform/_build/image_crop.o: Delete.
+
2010-07-23 Arthur Crepin-Leblond <crepin(a)ptaouchnok.lrde.epita.fr>
OpenDocument output (odt and odf).
--
1.5.6.5
1
0