---
GScribo/GScribo.pro | 8 +-
GScribo/GScribo.pro.user | 62 +++++-----
GScribo/PagesViewer/listmodel.cpp | 21 +++-
GScribo/PagesViewer/listmodel.h | 6 +-
GScribo/PagesViewer/pageswidget.cpp | 33 +++++-
GScribo/PagesViewer/pageswidget.h | 9 +-
GScribo/Processing/progressdialog.cpp | 2 +-
GScribo/Processing/runner.cpp | 28 ++--
GScribo/Processing/runner.h | 4 +-
GScribo/Rendering/scene.cpp | 9 +-
GScribo/Rendering/scene.h | 7 +-
GScribo/Rendering/selection.h | 2 +-
GScribo/main.cpp | 6 +-
GScribo/mainwindow.cpp | 151 +++++++++++++++++++++++
GScribo/mainwindow.h | 60 +++++++++
GScribo/xml.cpp | 2 +-
GScribo/xml.h | 24 +++-
XmlTree/XmlTree.pro | 14 ++
XmlTree/XmlTree.pro.user | 160 +++++++++++++++++++++++++
{Test => XmlTree}/main.cpp | 4 +-
NotePad/notepad.cpp => XmlTree/mainwindow.cpp | 12 +-
XmlTree/mainwindow.h | 27 ++++
XmlTree/mainwindow.ui | 24 ++++
XmlTree/xml.cpp | 24 ++++
XmlTree/xml.h | 23 ++++
XmlTree/xmlwidget.cpp | 5 +
XmlTree/xmlwidget.h | 14 ++
27 files changed, 655 insertions(+), 86 deletions(-)
create mode 100644 GScribo/mainwindow.cpp
create mode 100644 GScribo/mainwindow.h
create mode 100644 XmlTree/XmlTree.pro
create mode 100644 XmlTree/XmlTree.pro.user
copy {Test => XmlTree}/main.cpp (76%)
copy NotePad/notepad.cpp => XmlTree/mainwindow.cpp (59%)
create mode 100644 XmlTree/mainwindow.h
create mode 100644 XmlTree/mainwindow.ui
create mode 100644 XmlTree/xml.cpp
create mode 100644 XmlTree/xml.h
create mode 100644 XmlTree/xmlwidget.cpp
create mode 100644 XmlTree/xmlwidget.h
diff --git a/GScribo/GScribo.pro b/GScribo/GScribo.pro
index 9ca65f6..4175a7f 100644
--- a/GScribo/GScribo.pro
+++ b/GScribo/GScribo.pro
@@ -28,7 +28,9 @@ SOURCES += main.cpp \
Rendering/polygonitem.cpp \
Processing/progressdialog.cpp \
Processing/process.cpp \
- Processing/preprocess.cpp
+ Processing/preprocess.cpp \
+ Processing/runner.cpp \
+ xml.cpp
HEADERS += mainwindow.h \
configs.h \
region.h \
@@ -46,7 +48,9 @@ HEADERS += mainwindow.h \
Processing/preprocess.h \
Processing/progressdialog.h \
Processing/process.h \
- dir.h
+ dir.h \
+ Processing/runner.h \
+ xml.h
FORMS += mainwindow.ui \
Preferences/preferencesdialog.ui \
Preferences/ocroptions.ui \
diff --git a/GScribo/GScribo.pro.user b/GScribo/GScribo.pro.user
index e3df61a..2415250 100644
--- a/GScribo/GScribo.pro.user
+++ b/GScribo/GScribo.pro.user
@@ -58,6 +58,7 @@
<value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Debug</value>
<value key="QtVersionId" type="int">2</value>
<value key="ToolChain" type="int">0</value>
+ <value key="addQDumper" type=""></value>
<value key="buildConfiguration" type="int">2</value>
</valuemap>
</data>
@@ -66,36 +67,35 @@
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Debug</value>
<valuelist key="abstractProcess.Environment"
type="QVariantList">
- <value
type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Rm9H5yDUD5,guid=00a0d6b325751c50c00c26e2006a9203</value>
+ <value
type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-P80XV4IXzt,guid=a5409515b0d4b55f3087c5ac006be134</value>
<value type="QString">DESKTOP_SESSION=fluxbox</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=fluxbox</value>
<value type="QString">GDM_LANG=fr_FR.UTF-8</value>
<value type="QString">GDM_XSERVER_LOCATION=local</value>
- <value
type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-kTB4J7</value>
- <value type="QString">GNOME_KEYRING_PID=27564</value>
+ <value
type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-hNSqJb</value>
+ <value type="QString">GNOME_KEYRING_PID=26128</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/lrde/home/stage/froger_a</value>
<value type="QString">LANG=fr_FR.UTF-8</value>
- <value type="QString">LANGUAGE=</value>
<value
type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
<value type="QString">LOGNAME=froger_a</value>
- <value
type="QString">OLDPWD=/lrde/home/stage/froger_a/qt/GScribo/Preferences</value>
+ <value
type="QString">OLDPWD=/lrde/home/stage/froger_a/qt</value>
<value
type="QString">PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games</value>
<value
type="QString">PWD=/lrde/home/stage/froger_a/qt/GScribo</value>
<value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SHELL=/bin/bash</value>
<value type="QString">SHLVL=2</value>
- <value type="QString">SSH_AGENT_PID=27639</value>
- <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-qeVjd27573/agent.27573</value>
+ <value type="QString">SSH_AGENT_PID=26203</value>
+ <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-JCcKD26137/agent.26137</value>
<value type="QString">TERM=xterm</value>
<value type="QString">USER=froger_a</value>
<value type="QString">USERNAME=froger_a</value>
- <value type="QString">WINDOWID=10485796</value>
- <value
type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value>
- <value type="QString">XAUTHORITY=/tmp/.gdm9DVURW</value>
+ <value type="QString">WINDOWID=16777252</value>
+ <value
type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value>
+ <value type="QString">XAUTHORITY=/tmp/.gdmDXEURW</value>
<value
type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value>
- <value
type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1359032006.901905-2088645706</value>
+ <value
type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1359117815.965216-788943747</value>
<value type="QString">XPSERVERLIST=:64 </value>
<value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value>
<value type="QString">XTERM_SHELL=/bin/bash</value>
@@ -119,36 +119,35 @@
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Debug</value>
<valuelist key="abstractProcess.Environment"
type="QVariantList">
- <value
type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Rm9H5yDUD5,guid=00a0d6b325751c50c00c26e2006a9203</value>
+ <value
type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-P80XV4IXzt,guid=a5409515b0d4b55f3087c5ac006be134</value>
<value type="QString">DESKTOP_SESSION=fluxbox</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=fluxbox</value>
<value type="QString">GDM_LANG=fr_FR.UTF-8</value>
<value type="QString">GDM_XSERVER_LOCATION=local</value>
- <value
type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-kTB4J7</value>
- <value type="QString">GNOME_KEYRING_PID=27564</value>
+ <value
type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-hNSqJb</value>
+ <value type="QString">GNOME_KEYRING_PID=26128</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/lrde/home/stage/froger_a</value>
<value type="QString">LANG=fr_FR.UTF-8</value>
- <value type="QString">LANGUAGE=</value>
<value
type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
<value type="QString">LOGNAME=froger_a</value>
- <value
type="QString">OLDPWD=/lrde/home/stage/froger_a/qt/GScribo/Preferences</value>
+ <value
type="QString">OLDPWD=/lrde/home/stage/froger_a/qt</value>
<value
type="QString">PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games</value>
<value
type="QString">PWD=/lrde/home/stage/froger_a/qt/GScribo</value>
<value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SHELL=/bin/bash</value>
<value type="QString">SHLVL=2</value>
- <value type="QString">SSH_AGENT_PID=27639</value>
- <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-qeVjd27573/agent.27573</value>
+ <value type="QString">SSH_AGENT_PID=26203</value>
+ <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-JCcKD26137/agent.26137</value>
<value type="QString">TERM=xterm</value>
<value type="QString">USER=froger_a</value>
<value type="QString">USERNAME=froger_a</value>
- <value type="QString">WINDOWID=10485796</value>
- <value
type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value>
- <value type="QString">XAUTHORITY=/tmp/.gdm9DVURW</value>
+ <value type="QString">WINDOWID=16777252</value>
+ <value
type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value>
+ <value type="QString">XAUTHORITY=/tmp/.gdmDXEURW</value>
<value
type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value>
- <value
type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1359032006.901905-2088645706</value>
+ <value
type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1359117815.965216-788943747</value>
<value type="QString">XPSERVERLIST=:64 </value>
<value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value>
<value type="QString">XTERM_SHELL=/bin/bash</value>
@@ -169,35 +168,36 @@
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Debug</value>
<valuelist key="abstractProcess.Environment"
type="QVariantList">
- <value
type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Rm9H5yDUD5,guid=00a0d6b325751c50c00c26e2006a9203</value>
+ <value
type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-E725PGjN72,guid=03a3a01426a1915469d93b2f006b9a87</value>
<value type="QString">DESKTOP_SESSION=fluxbox</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=fluxbox</value>
<value type="QString">GDM_LANG=fr_FR.UTF-8</value>
<value type="QString">GDM_XSERVER_LOCATION=local</value>
- <value
type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-kTB4J7</value>
- <value type="QString">GNOME_KEYRING_PID=27564</value>
+ <value
type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-qpwUT9</value>
+ <value type="QString">GNOME_KEYRING_PID=23170</value>
<value type="QString">GTK_MODULES=canberra-gtk-module</value>
<value type="QString">HOME=/lrde/home/stage/froger_a</value>
<value type="QString">LANG=fr_FR.UTF-8</value>
+ <value type="QString">LANGUAGE=</value>
<value
type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
<value type="QString">LOGNAME=froger_a</value>
- <value
type="QString">OLDPWD=/lrde/home/stage/froger_a/qt/GScribo/Preferences</value>
+ <value
type="QString">OLDPWD=/lrde/home/stage/froger_a/qt</value>
<value
type="QString">PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games</value>
<value
type="QString">PWD=/lrde/home/stage/froger_a/qt/GScribo</value>
<value type="QString">QTDIR=/usr/share/qt4</value>
<value type="QString">SHELL=/bin/bash</value>
<value type="QString">SHLVL=2</value>
- <value type="QString">SSH_AGENT_PID=27639</value>
- <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-qeVjd27573/agent.27573</value>
+ <value type="QString">SSH_AGENT_PID=23245</value>
+ <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-CQzeO23179/agent.23179</value>
<value type="QString">TERM=xterm</value>
<value type="QString">USER=froger_a</value>
<value type="QString">USERNAME=froger_a</value>
<value type="QString">WINDOWID=10485796</value>
- <value
type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value>
- <value type="QString">XAUTHORITY=/tmp/.gdm9DVURW</value>
+ <value
type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value>
+ <value type="QString">XAUTHORITY=/tmp/.gdm87KZRW</value>
<value
type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value>
- <value
type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1359032006.901905-2088645706</value>
+ <value
type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1359099722.931858-1143452610</value>
<value type="QString">XPSERVERLIST=:64 </value>
<value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value>
<value type="QString">XTERM_SHELL=/bin/bash</value>
diff --git a/GScribo/PagesViewer/listmodel.cpp b/GScribo/PagesViewer/listmodel.cpp
index 6fd60db..9748e76 100644
--- a/GScribo/PagesViewer/listmodel.cpp
+++ b/GScribo/PagesViewer/listmodel.cpp
@@ -5,6 +5,11 @@ ListModel::ListModel(QObject *parent):
{
}
+QStringList ListModel::filenames() const
+{
+ return paths;
+}
+
int ListModel::rowCount(const QModelIndex&) const
{
return pixmaps.size();
@@ -24,7 +29,7 @@ QVariant ListModel::data(const QModelIndex& index, int role) const
// Store the path of the pixmap in an other custom place.
if(role == Qt::UserRole+1)
- return filenames.value(index.row());
+ return paths.value(index.row());
return QVariant();
}
@@ -36,7 +41,19 @@ void ListModel::addPixmap(const QString& filename, const
QPixmap& pixmap)
beginInsertRows(QModelIndex(), row, row);
pixmaps.insert(row, pixmap);
- filenames.insert(row, filename);
+ paths.insert(row, filename);
endInsertRows();
}
+
+void ListModel::removePixmap(const QModelIndex &parent)
+{
+ int row = parent.row();
+
+ beginRemoveRows(parent, row, row);
+
+ pixmaps.removeAt(row);
+ paths.removeAt(row);
+
+ endRemoveRows();
+}
diff --git a/GScribo/PagesViewer/listmodel.h b/GScribo/PagesViewer/listmodel.h
index 2f0350e..328d3ca 100644
--- a/GScribo/PagesViewer/listmodel.h
+++ b/GScribo/PagesViewer/listmodel.h
@@ -12,13 +12,17 @@ class ListModel:
public:
explicit ListModel(QObject *parent = 0);
+ QStringList filenames() const;
int rowCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role = Qt::DecorationRole)
const;
void addPixmap(const QString& filename, const QPixmap& pixmap);
private:
QList<QPixmap> pixmaps;
- QList<QString> filenames;
+ QStringList paths;
+
+ public slots:
+ void removePixmap(const QModelIndex &parent);
};
#endif // LISTMODEL_H
diff --git a/GScribo/PagesViewer/pageswidget.cpp b/GScribo/PagesViewer/pageswidget.cpp
index 712f5eb..3f975b4 100644
--- a/GScribo/PagesViewer/pageswidget.cpp
+++ b/GScribo/PagesViewer/pageswidget.cpp
@@ -4,6 +4,8 @@ PagesWidget::PagesWidget(QWidget *parent):
QListView(parent)
{
setUniformItemSizes(true);
+ setSelectionMode(QAbstractItemView::ExtendedSelection);
+ setSelectionRectVisible(false);
setViewMode(QListView::IconMode);
setIconSize(QSize(200, 200));
setFlow(QListView::TopToBottom);
@@ -12,15 +14,15 @@ PagesWidget::PagesWidget(QWidget *parent):
setWrapping(false);
setModel(&model);
- connect(this, SIGNAL(doubleClicked(QModelIndex)), this,
SLOT(getSelection(QModelIndex)));
+ connect(this, SIGNAL(doubleClicked(QModelIndex)), this,
SLOT(getPixmap(QModelIndex)));
}
-void PagesWidget::addPixmap(const QString& filename, const QPixmap &pixmap)
+QStringList PagesWidget::filenames() const
{
- model.addPixmap(filename, pixmap);
+ return model.filenames();
}
-void PagesWidget::getSelection(const QModelIndex &index)
+void PagesWidget::getPixmap(const QModelIndex &index)
{
// Get the pixmap and the path of the icon to send it to the scene and draw it.
QPixmap pixmap = index.data(Qt::UserRole).value<QPixmap>();
@@ -28,3 +30,26 @@ void PagesWidget::getSelection(const QModelIndex &index)
emit selectionClicked(filename, pixmap);
}
+
+void PagesWidget::addPixmap(const QString& filename, const QPixmap &pixmap)
+{
+ model.addPixmap(filename, pixmap);
+}
+
+void PagesWidget::removeSelection()
+{
+ QModelIndexList indexes = selectedIndexes();
+
+ if(indexes.count() > 0)
+ {
+ // We have to sort the list because after the first removal, the second row index
may not be the good one.
+ qSort(indexes.begin(), indexes.end());
+
+ // From the highest row value to the smallest to be sure to remove the good
index.
+ for(int i = indexes.count()-1; i > -1; i--)
+ model.removePixmap(indexes[i]);
+
+ getPixmap(model.index(indexes[0].row()));
+ clearSelection();
+ }
+}
diff --git a/GScribo/PagesViewer/pageswidget.h b/GScribo/PagesViewer/pageswidget.h
index ae17a4a..07d32ac 100644
--- a/GScribo/PagesViewer/pageswidget.h
+++ b/GScribo/PagesViewer/pageswidget.h
@@ -1,11 +1,8 @@
#ifndef PAGESWIDGET_H
#define PAGESWIDGET_H
-#include <QPushButton>
-#include <QScrollBar>
#include <QListView>
-#include <QPainter>
-#include <QWidget>
+#include <QShortcut>
#include "listmodel.h"
@@ -17,12 +14,14 @@ class PagesWidget:
public:
explicit PagesWidget(QWidget *parent = 0);
void addPixmap(const QString& filename, const QPixmap& pixmap);
+ QStringList filenames() const;
private:
ListModel model;
public slots:
- void getSelection(const QModelIndex &index);
+ void getPixmap(const QModelIndex &index);
+ void removeSelection();
signals:
void clicked(const QModelIndex &index);
diff --git a/GScribo/Processing/progressdialog.cpp
b/GScribo/Processing/progressdialog.cpp
index 386aaa6..c4ae96f 100644
--- a/GScribo/Processing/progressdialog.cpp
+++ b/GScribo/Processing/progressdialog.cpp
@@ -17,6 +17,6 @@ void ProgressDialog::run()
void ProgressDialog::reset()
{
setValue(0);
- setLabelText("");
+ setLabelText("Initilization");
show();
}
diff --git a/GScribo/Processing/runner.cpp b/GScribo/Processing/runner.cpp
index ebde288..5024acd 100644
--- a/GScribo/Processing/runner.cpp
+++ b/GScribo/Processing/runner.cpp
@@ -29,9 +29,12 @@ void Runner::run()
case Demat:
{
image2d<value::rgb8> ima;
- io::magick::load(ima, args_.at(0).toUtf8().constData());
- image2d<bool> bin_ima = preprocess(ima);
- process(ima, bin_ima);
+ for(int i = 0; i < args_.count(); i++)
+ {
+ io::magick::load(ima, args_.at(i).toUtf8().constData());
+ image2d<bool> bin_ima = preprocess(ima);
+ process(ima, bin_ima, i);
+ }
emit finished();
}
break;
@@ -48,10 +51,10 @@ void Runner::stop()
}
// Demat related stuff
-void Runner::start_demat(const QString& filename)
+void Runner::start_demat(const QStringList& filenames)
{
args_.clear();
- args_ << filename;
+ args_ = filenames;
mode_ = Demat;
QThread::start();
}
@@ -86,11 +89,11 @@ image2d<bool> Runner::preprocess(const
image2d<value::rgb8>& ima)
void Runner::process(const image2d<value::rgb8>& original_ima,
- const image2d<bool>& processed_ima)
+ const image2d<bool>& processed_ima, int arg)
{
emit new_step("Page segmentation");
- Process f(args_.at(0).toUtf8().constData());
+ Process f(args_.at(arg).toUtf8().constData());
connect(&f, SIGNAL(progress()), this, SIGNAL(progress()));
connect(&f, SIGNAL(newProgressLabel(QString)),
@@ -112,7 +115,7 @@ void Runner::process(const image2d<value::rgb8>&
original_ima,
f.save_doc_as_xml = true;
- QFileInfo file(args_.at(0));
+ QFileInfo file(args_.at(arg));
QString output_dir = QDir::tempPath();
if (conf->generalSaveXmlEnabled())
{
@@ -134,8 +137,6 @@ void Runner::process(const image2d<value::rgb8>&
original_ima,
emit xml_saved(filename);
}
-
-
// Export related stuff
void Runner::start_export(const QString& imgfile,
const QString& xmlfile, const QString& outfile)
@@ -147,10 +148,9 @@ void Runner::start_export(const QString& imgfile,
QThread::start();
}
-
void Runner::export_as()
{
- emit new_step("Exporting document...");
+ emit new_step("Exporting document");
emit new_progress_max_value(2);
// Checking output format
@@ -169,14 +169,14 @@ void Runner::export_as()
int rvalue = 0;
if (f.suffix() == "pdf")
{
- emit new_step("Exporting as PDF...");
+ emit new_step("Exporting as PDF");
rvalue = system(QString("%1/scribo-xml2doc --pdf %2 %3 %4")
.arg(pathto_xml2doc).arg(args_.at(1)).arg(args_.at(0))
.arg(args_.at(2)).toAscii().constData());
}
else if (f.suffix() == "html" || f.suffix() == "htm")
{
- emit new_step("Exporting as HTML...");
+ emit new_step("Exporting as HTML");
rvalue = system(QString("%1/scribo-xml2doc --html %2 %3 %4")
.arg(pathto_xml2doc).arg(args_.at(1)).arg(args_.at(0))
.arg(args_.at(2)).toAscii().constData());
diff --git a/GScribo/Processing/runner.h b/GScribo/Processing/runner.h
index 51969e3..721086a 100644
--- a/GScribo/Processing/runner.h
+++ b/GScribo/Processing/runner.h
@@ -30,12 +30,12 @@ class Runner :
public:
explicit Runner(QObject *parent = 0);
- void start_demat(const QString& filename);
+ void start_demat(const QStringList& filenames);
void start_export(const QString& imgfile, const QString& xmlfile, const
QString& outfile);
private:
image2d<bool> preprocess(const image2d<value::rgb8>& ima);
- void process(const image2d<value::rgb8>& original_ima, const
image2d<bool>& processed_ima);
+ void process(const image2d<value::rgb8>& original_ima, const
image2d<bool>& processed_ima, int arg);
void export_as();
virtual void run();
template <typename V> unsigned find_best_scale(const
mln::image2d<V>& ima);
diff --git a/GScribo/Rendering/scene.cpp b/GScribo/Rendering/scene.cpp
index 5035b28..695a4f1 100644
--- a/GScribo/Rendering/scene.cpp
+++ b/GScribo/Rendering/scene.cpp
@@ -28,6 +28,11 @@ void Scene::init()
addItem(&selection);
}
+QString Scene::backgroundPath() const
+{
+ return path;
+}
+
void Scene::removeItems()
{
QList<QGraphicsItem *> itemsList = items();
@@ -91,9 +96,9 @@ void Scene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
void Scene::setBackground(const QString& filename, const QPixmap& pixmap)
{
- if(backgroundPath != filename)
+ if(path != filename)
{
- backgroundPath = filename;
+ path = filename;
setSceneRect(pixmap.rect());
setBackgroundBrush(QBrush(pixmap));
diff --git a/GScribo/Rendering/scene.h b/GScribo/Rendering/scene.h
index c4a627a..6aa7668 100644
--- a/GScribo/Rendering/scene.h
+++ b/GScribo/Rendering/scene.h
@@ -1,9 +1,9 @@
#ifndef SCENE_H
#define SCENE_H
-#include <QFileDialog>
-#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
+#include <QGraphicsScene>
+#include <QFileDialog>
#include "selection.h"
#include "polygonitem.h"
@@ -17,6 +17,7 @@ class Scene :
explicit Scene(QObject *parent = 0);
explicit Scene(const QRectF &sceneRect, QObject *parent = 0);
explicit Scene(qreal x, qreal y, qreal width, qreal height, QObject *parent =
0);
+ QString backgroundPath() const;
void removeItems();
protected:
@@ -27,7 +28,7 @@ class Scene :
private:
void init();
- QString backgroundPath;
+ QString path;
Selection selection;
QPointF pressPos;
bool isPressing;
diff --git a/GScribo/Rendering/selection.h b/GScribo/Rendering/selection.h
index 4864e15..ace8f01 100644
--- a/GScribo/Rendering/selection.h
+++ b/GScribo/Rendering/selection.h
@@ -2,8 +2,8 @@
#define SELECTION_H
#include <QGraphicsRectItem>
-#include <QPen>
#include <climits>
+#include <QPen>
class Selection :
public QGraphicsRectItem
diff --git a/GScribo/main.cpp b/GScribo/main.cpp
index b8f57bd..bd76409 100644
--- a/GScribo/main.cpp
+++ b/GScribo/main.cpp
@@ -1,10 +1,12 @@
+#undef MLN_WO_GLOBAL_VARS
+
+#include <scribo/make/debug_filename.hh>
#include <mln/labeling/colorize.hh>
-#include <mln/math/pi.hh>
#include <mln/io/magick/load.hh>
#include <mln/literal/colors.hh>
#include <mln/debug/filename.hh>
-#include <scribo/make/debug_filename.hh>
#include <QtGui/QApplication>
+#include <mln/math/pi.hh>
#include "mainwindow.h"
diff --git a/GScribo/mainwindow.cpp b/GScribo/mainwindow.cpp
new file mode 100644
index 0000000..4b2a4d3
--- /dev/null
+++ b/GScribo/mainwindow.cpp
@@ -0,0 +1,151 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent),
+ ui(new Ui::MainWindow)
+{
+ ui->setupUi(this);
+
+ setWindowTitle(tr("GScribo"));
+ //progressDialog.setParent(this);
+
+ initGraphicsRegion();
+ initTextRegion();
+ initPageWidget();
+ initToolBar();
+ initMenuBar();
+
+ connectWidgets();
+ connectShortcuts();
+}
+
+MainWindow::~MainWindow()
+{
+ delete ui;
+}
+
+void MainWindow::initGraphicsRegion()
+{
+ // Cache backgroud to speed up its repaint.
+ graphicsView.setCacheMode(QGraphicsView::CacheBackground);
+ graphicsView.setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
+ graphicsView.setScene(&scene);
+
+ setCentralWidget(&graphicsView);
+}
+
+void MainWindow::initPageWidget()
+{
+ dockPages.setWindowTitle(tr("Pages"));
+ dockPages.setFeatures(QDockWidget::DockWidgetClosable);
+ dockPages.setMaximumWidth(190);
+ dockPages.setMinimumWidth(190);
+ dockPages.setWidget(&pagesWidget);
+
+ addDockWidget(Qt::LeftDockWidgetArea, &dockPages);
+}
+
+void MainWindow::initTextRegion()
+{
+ dockText.setWindowTitle(tr("Text"));
+ dockText.setAllowedAreas(Qt::AllDockWidgetAreas);
+ dockText.setFeatures(QDockWidget::DockWidgetFloatable |
QDockWidget::DockWidgetMovable);
+ dockText.setWidget(&textEdit);
+
+ addDockWidget(Qt::RightDockWidgetArea, &dockText);
+ dockText.hide();
+}
+
+void MainWindow::initToolBar()
+{
+ QAction *open = ui->mainToolBar->addAction(tr("Open"));
+ connect(open, SIGNAL(triggered()), this, SLOT(onOpen()));
+
+ QAction *segment = ui->mainToolBar->addAction(tr("Segment"));
+ connect(segment, SIGNAL(triggered()), this, SLOT(onSegment()));
+
+ QAction *del = ui->mainToolBar->addAction(tr("Delete"));
+ connect(del, SIGNAL(triggered()), &pagesWidget, SLOT(removeSelection()));
+}
+
+void MainWindow::initMenuBar()
+{
+ QAction *preferences = ui->menuBar->addAction(tr("Preferences"));
+ connect(preferences, SIGNAL(triggered()), SLOT(onPreferences()));
+}
+
+void MainWindow::onOpen()
+{
+ QStringList paths = QFileDialog::getOpenFileNames(this, "Open Image(s)",
QDir::homePath(), "Images (*.png *.jpg *.ppm *.bmp)");
+
+ if(paths.count() > 0)
+ {
+ QString path = paths[0];
+ QPixmap pixmap(path);
+
+ scene.setBackground(path, pixmap);
+ pagesWidget.addPixmap(path, pixmap);
+
+ // If more than one file, we store it in the page widget.
+ for(int i = 1; i < paths.count(); i++)
+ {
+ path = paths[i];
+ pixmap.load(path);
+ pagesWidget.addPixmap(path, pixmap);
+ }
+ }
+}
+
+void MainWindow::onSegment()
+{
+ if(scene.backgroundPath() != "")
+ {
+ QStringList filenames;
+
+ if(!pagesWidget.isVisible())
+ filenames << scene.backgroundPath();
+
+ else
+ filenames = pagesWidget.filenames();
+
+ progressDialog.reset();
+ runner.start_demat(filenames);
+ }
+}
+
+void MainWindow::onPreferences()
+{
+ PreferencesDialog *preferenceDialog = new PreferencesDialog(this);
+ preferenceDialog->show();
+}
+
+void MainWindow::connectWidgets()
+{
+ // If double click on a picture of the page widget -> draw it on background
scene.
+ connect(&pagesWidget, SIGNAL(selectionClicked(QString,QPixmap)), &scene,
SLOT(setBackground(QString,QPixmap)));
+
+ connect(&runner, SIGNAL(progress()), &progressDialog, SLOT(run()));
+ connect(&runner, SIGNAL(new_progress_max_value(int)), &progressDialog,
SLOT(setMaximum(int)));
+ connect(&runner, SIGNAL(new_progress_label(QString)), &progressDialog,
SLOT(setLabelText(QString)));
+ connect(&runner, SIGNAL(finished()), &progressDialog, SLOT(close()));
+}
+
+void MainWindow::connectShortcuts()
+{
+ QShortcut *del = new QShortcut(Qt::Key_Delete, &pagesWidget);
+ connect(del, SIGNAL(activated()), &pagesWidget, SLOT(removeSelection()));
+}
+
+void MainWindow::changeEvent(QEvent *e)
+{
+ QMainWindow::changeEvent(e);
+ switch (e->type())
+ {
+ case QEvent::LanguageChange:
+ ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
diff --git a/GScribo/mainwindow.h b/GScribo/mainwindow.h
new file mode 100644
index 0000000..708a4f6
--- /dev/null
+++ b/GScribo/mainwindow.h
@@ -0,0 +1,60 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QGraphicsView>
+#include <QPlainTextEdit>
+#include <QMainWindow>
+#include <QHBoxLayout>
+#include <QDockWidget>
+#include <QFileDialog>
+#include <QGroupBox>
+
+#include "Preferences/preferencesdialog.h"
+#include "Processing/progressdialog.h"
+#include "PagesViewer/pageswidget.h"
+#include "Processing/runner.h"
+#include "Rendering/scene.h"
+
+namespace Ui
+{
+ class MainWindow;
+}
+
+class MainWindow:
+ public QMainWindow
+{
+ Q_OBJECT
+
+ public:
+ MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
+ protected:
+ void changeEvent(QEvent *e);
+
+ private:
+ void initGraphicsRegion();
+ void initTextRegion();
+ void initToolBar();
+ void initPageWidget();
+ void initMenuBar();
+ void connectWidgets();
+ void connectShortcuts();
+
+ Ui::MainWindow *ui;
+ QDockWidget dockText;
+ QDockWidget dockPages;
+ QGraphicsView graphicsView;
+ Scene scene;
+ QPlainTextEdit textEdit;
+ PagesWidget pagesWidget;
+ Runner runner;
+ ProgressDialog progressDialog;
+
+ private slots:
+ void onOpen();
+ void onSegment();
+ void onPreferences();
+};
+
+#endif // MAINWINDOW_H
diff --git a/GScribo/xml.cpp b/GScribo/xml.cpp
index 67c5451..c213728 100644
--- a/GScribo/xml.cpp
+++ b/GScribo/xml.cpp
@@ -1,5 +1,4 @@
#include "xml.h"
-#include "region.h"
static const GraphicRegion::Data itemsData[] =
{
@@ -16,6 +15,7 @@ static const GraphicRegion::Data itemsData[] =
Xml::Xml()
{
+
}
void Xml::graphicsRegion(const QDomElement& element, const GraphicRegion::Data&
data, Scene *scene)
diff --git a/GScribo/xml.h b/GScribo/xml.h
index c694a95..840f73a 100644
--- a/GScribo/xml.h
+++ b/GScribo/xml.h
@@ -1,16 +1,24 @@
#ifndef XML_H
#define XML_H
-#include <QString>
#include <QGraphicsItem>
#include <QDomElement>
-#include <QFile>
-#include <climits>
#include <QTextEdit>
+#include <climits>
+#include <QString>
+#include <QFile>
+
#include "polygonitem.h"
#include "region.h"
+#include "region.h"
#include "scene.h"
+struct Node
+{
+ QDomElement root;
+ QDomElement
+};
+
class Xml:
QObject
{
@@ -19,10 +27,12 @@ class Xml:
static void parseItems(const QString &filename, Scene *scene);
private:
- static void graphicsRegion(const QDomElement& element, const
GraphicRegion::Data& data, Scene *scene);
- static void graphicsTypoRegion(const QDomElement& element, const QPoint&
xPos, Scene *scene);
- static void graphicsLineRegion(const QDomElement& element, Scene *scene);
- static void graphicsTextRegion(const QDomElement& element, Scene *scene);
+ void graphicsRegion(const QDomElement& element, const
GraphicRegion::Data& data, Scene *scene);
+ void graphicsTypoRegion(const QDomElement& element, const QPoint& xPos,
Scene *scene);
+ void graphicsLineRegion(const QDomElement& element, Scene *scene);
+ void graphicsTextRegion(const QDomElement& element, Scene *scene);
+
+ QDomElement root;
};
#endif // XML_H
diff --git a/XmlTree/XmlTree.pro b/XmlTree/XmlTree.pro
new file mode 100644
index 0000000..c3fcab9
--- /dev/null
+++ b/XmlTree/XmlTree.pro
@@ -0,0 +1,14 @@
+# -------------------------------------------------
+# Project created by QtCreator 2013-01-25T17:20:25
+# -------------------------------------------------
+QT += xml
+TARGET = XmlTree
+TEMPLATE = app
+SOURCES += main.cpp \
+ mainwindow.cpp \
+ xmlwidget.cpp \
+ xml.cpp
+HEADERS += mainwindow.h \
+ xmlwidget.h \
+ xml.h
+FORMS += mainwindow.ui
diff --git a/XmlTree/XmlTree.pro.user b/XmlTree/XmlTree.pro.user
new file mode 100644
index 0000000..eef8a12
--- /dev/null
+++ b/XmlTree/XmlTree.pro.user
@@ -0,0 +1,160 @@
+<!DOCTYPE QtCreatorProject>
+<qtcreator>
+ <data>
+ <variable>RunConfiguration0-BaseEnvironmentBase</variable>
+ <value type="int">2</value>
+ </data>
+ <data>
+ <variable>RunConfiguration0-CommandLineArguments</variable>
+ <valuelist type="QVariantList"/>
+ </data>
+ <data>
+ <variable>RunConfiguration0-ProFile</variable>
+ <value type="QString">XmlTree.pro</value>
+ </data>
+ <data>
+ <variable>RunConfiguration0-RunConfiguration.name</variable>
+ <value type="QString">XmlTree</value>
+ </data>
+ <data>
+ <variable>RunConfiguration0-UseDyldImageSuffix</variable>
+ <value type="bool">false</value>
+ </data>
+ <data>
+ <variable>RunConfiguration0-UseTerminal</variable>
+ <value type="bool">false</value>
+ </data>
+ <data>
+ <variable>RunConfiguration0-UserEnvironmentChanges</variable>
+ <valuelist type="QVariantList"/>
+ </data>
+ <data>
+ <variable>RunConfiguration0-UserSetName</variable>
+ <value type="bool">false</value>
+ </data>
+ <data>
+ <variable>RunConfiguration0-UserSetWorkingDirectory</variable>
+ <value type="bool">false</value>
+ </data>
+ <data>
+ <variable>RunConfiguration0-UserWorkingDirectory</variable>
+ <value type="QString"></value>
+ </data>
+ <data>
+ <variable>RunConfiguration0-type</variable>
+ <value
type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
+ </data>
+ <data>
+ <variable>activeRunConfiguration</variable>
+ <value type="int">0</value>
+ </data>
+ <data>
+ <variable>activebuildconfiguration</variable>
+ <value type="QString">Debug</value>
+ </data>
+ <data>
+ <variable>buildConfiguration-Debug</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Debug</value>
+ <value key="QtVersionId" type="int">0</value>
+ <value key="ToolChain" type="int">0</value>
+ <value key="buildConfiguration" type="int">2</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>buildConfiguration-Release</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Release</value>
+ <value key="QtVersionId" type="int">0</value>
+ <value key="buildConfiguration" type="int">0</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>buildconfiguration-Debug-buildstep0</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Debug</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>buildconfiguration-Debug-buildstep1</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Debug</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>buildconfiguration-Debug-cleanstep0</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Debug</value>
+ <value key="cleanConfig" type="bool">true</value>
+ <valuelist key="makeargs" type="QVariantList">
+ <value type="QString">clean</value>
+ </valuelist>
+ </valuemap>
+ </data>
+ <data>
+ <variable>buildconfiguration-Release-buildstep0</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Release</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>buildconfiguration-Release-buildstep1</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Release</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>buildconfiguration-Release-cleanstep0</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Release</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>buildconfigurations</variable>
+ <valuelist type="QVariantList">
+ <value type="QString">Debug</value>
+ <value type="QString">Release</value>
+ </valuelist>
+ </data>
+ <data>
+ <variable>buildstep0</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString"></value>
+ <value key="mkspec" type="QString"></value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>buildstep1</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString"></value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>buildsteps</variable>
+ <valuelist type="QVariantList">
+ <value type="QString">trolltech.qt4projectmanager.qmake</value>
+ <value type="QString">trolltech.qt4projectmanager.make</value>
+ </valuelist>
+ </data>
+ <data>
+ <variable>cleanstep0</variable>
+ <valuemap type="QVariantMap">
+ <value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString"></value>
+ <value key="clean" type="bool">true</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>cleansteps</variable>
+ <valuelist type="QVariantList">
+ <value type="QString">trolltech.qt4projectmanager.make</value>
+ </valuelist>
+ </data>
+ <data>
+ <variable>defaultFileEncoding</variable>
+ <value type="QByteArray">System</value>
+ </data>
+ <data>
+ <variable>project</variable>
+ <valuemap type="QVariantMap"/>
+ </data>
+</qtcreator>
diff --git a/Test/main.cpp b/XmlTree/main.cpp
similarity index 76%
copy from Test/main.cpp
copy to XmlTree/main.cpp
index 9f16ac8..6e7efd9 100644
--- a/Test/main.cpp
+++ b/XmlTree/main.cpp
@@ -1,10 +1,10 @@
#include <QtGui/QApplication>
-#include "test.h"
+#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
- Test w;
+ MainWindow w;
w.show();
return a.exec();
}
diff --git a/NotePad/notepad.cpp b/XmlTree/mainwindow.cpp
similarity index 59%
copy from NotePad/notepad.cpp
copy to XmlTree/mainwindow.cpp
index 57fc04f..7a8cf0a 100644
--- a/NotePad/notepad.cpp
+++ b/XmlTree/mainwindow.cpp
@@ -1,19 +1,19 @@
-#include "notepad.h"
-#include "ui_notepad.h"
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
-NotePad::NotePad(QWidget *parent) :
+MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
- ui(new Ui::NotePad)
+ ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
-NotePad::~NotePad()
+MainWindow::~MainWindow()
{
delete ui;
}
-void NotePad::changeEvent(QEvent *e)
+void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type())
diff --git a/XmlTree/mainwindow.h b/XmlTree/mainwindow.h
new file mode 100644
index 0000000..fb82901
--- /dev/null
+++ b/XmlTree/mainwindow.h
@@ -0,0 +1,27 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+namespace Ui
+{
+ class MainWindow;
+}
+
+class MainWindow :
+ public QMainWindow
+{
+ Q_OBJECT
+
+ public:
+ MainWindow(QWidget *parent = 0);
+ ~MainWindow();
+
+ protected:
+ void changeEvent(QEvent *e);
+
+ private:
+ Ui::MainWindow *ui;
+};
+
+#endif // MAINWINDOW_H
diff --git a/XmlTree/mainwindow.ui b/XmlTree/mainwindow.ui
new file mode 100644
index 0000000..97c03be
--- /dev/null
+++ b/XmlTree/mainwindow.ui
@@ -0,0 +1,24 @@
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>600</width>
+ <height>400</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>MainWindow</string>
+ </property>
+ <widget class="QMenuBar" name="menuBar" />
+ <widget class="QToolBar" name="mainToolBar" />
+ <widget class="QWidget" name="centralWidget" />
+ <widget class="QStatusBar" name="statusBar" />
+ </widget>
+ <layoutDefault spacing="6" margin="11" />
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/XmlTree/xml.cpp b/XmlTree/xml.cpp
new file mode 100644
index 0000000..febcd69
--- /dev/null
+++ b/XmlTree/xml.cpp
@@ -0,0 +1,24 @@
+#include "xml.h"
+
+Xml::Xml()
+{
+}
+
+Xml::Xml(const QString &filename)
+{
+ load(filename);
+}
+
+void Xml::load(const QString &filename)
+{
+ QFile xmlFile(filename);
+ xmlFile.open(QIODevice::ReadOnly);
+
+ QDomDocument xml;
+ xml.setContent(&xmlFile);
+
+ xmlFile.close();
+
+ QDomElement root = xml.documentElement();
+ tItems.setText(0, QStringList(root.tagName()));
+}
diff --git a/XmlTree/xml.h b/XmlTree/xml.h
new file mode 100644
index 0000000..1353c62
--- /dev/null
+++ b/XmlTree/xml.h
@@ -0,0 +1,23 @@
+#ifndef XML_H
+#define XML_H
+
+#include <QTreeWidgetItem>
+#include <QGraphicsItem>
+#include <QDomElement>
+#include <QFile>
+
+class Xml
+{
+ public:
+ Xml();
+ explicit Xml(const QString& filename);
+ void load(const QString& filename);
+ QList<QGraphicsItem *> graphicsItems() const;
+ QTreeWidgetItem * treeItem() const;
+
+ private:
+ QList<QGraphicsItem *> gItems;
+ QTreeWidgetItem tItems;
+};
+
+#endif // XML_H
diff --git a/XmlTree/xmlwidget.cpp b/XmlTree/xmlwidget.cpp
new file mode 100644
index 0000000..e9d7a60
--- /dev/null
+++ b/XmlTree/xmlwidget.cpp
@@ -0,0 +1,5 @@
+#include "xmlwidget.h"
+
+XmlWidget::XmlWidget()
+{
+}
diff --git a/XmlTree/xmlwidget.h b/XmlTree/xmlwidget.h
new file mode 100644
index 0000000..906c1d0
--- /dev/null
+++ b/XmlTree/xmlwidget.h
@@ -0,0 +1,14 @@
+#ifndef XMLWIDGET_H
+#define XMLWIDGET_H
+
+#include <QDomElement>
+#include <QWidget>
+
+class XmlWidget :
+ public QWidget
+{
+ public:
+ explicit XmlWidget(const QString& filename);
+};
+
+#endif // XMLWIDGET_H
--
1.7.2.5