* mainwindow.cpp: Set all temporary windows (such like progress dialog) as Qt::Dialog to
avoid the title main window changement,
Disable/ Enable the exportation if the xml file has been recognized or not,
Exportation do not work due to the source program.
* xml.cpp: Create a function "recognized" which check if the current xml file
has been recognized by the OCR.
* graphicsview.cpp: Enlarge the zoom.
---
GScribo/BUGS | 1 +
GScribo/GScribo.pro.user | 112 ++++++++++++++++++--------
GScribo/Preferences/preferencesdialog.cpp | 2 +-
GScribo/Preferences/preprocessingoptions.cpp | 10 +-
GScribo/Preferences/preprocessingoptions.h | 2 +-
GScribo/Processing/progressdialog.cpp | 11 +--
GScribo/Processing/progressdialog.h | 7 +-
GScribo/Processing/runner.cpp | 27 +++----
GScribo/Rendering/graphicsview.cpp | 4 +-
GScribo/TODO | 15 +++-
GScribo/aboutdialog.h | 3 +-
GScribo/aboutdialog.ui | 36 ++++----
GScribo/dir.h | 2 +-
GScribo/mainwindow.cpp | 65 ++++++++-------
GScribo/mainwindow.h | 16 +++-
GScribo/mainwindow.ui | 12 ---
GScribo/xml.cpp | 12 +++
GScribo/xml.h | 29 ++++---
18 files changed, 216 insertions(+), 150 deletions(-)
create mode 100644 GScribo/BUGS
diff --git a/GScribo/BUGS b/GScribo/BUGS
new file mode 100644
index 0000000..48af52e
--- /dev/null
+++ b/GScribo/BUGS
@@ -0,0 +1 @@
+- In release compilation, when the first text region is selected in the xml widget, the
program crashs.
diff --git a/GScribo/GScribo.pro.user b/GScribo/GScribo.pro.user
index 27b49eb..d765506 100644
--- a/GScribo/GScribo.pro.user
+++ b/GScribo/GScribo.pro.user
@@ -77,7 +77,7 @@
<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-CpLYiAxYxd,guid=7696c32902b91e2834ddfd270002800f</value>
+ <value
type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-YPw0beHDmH,guid=e1ea388d8198abba427530de0006165b</value>
<value type="QString">DESKTOP_SESSION=fluxbox</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=fluxbox</value>
@@ -93,16 +93,16 @@
<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=15822</value>
- <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-OPYeW15762/agent.15762</value>
+ <value type="QString">SSH_AGENT_PID=23527</value>
+ <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-rIfho23467/agent.23467</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=18874392</value>
- <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8</value>
- <value type="QString">XAUTHORITY=/tmp/.gdmWKEBSW</value>
+ <value type="QString">WINDOWID=12582936</value>
+ <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8</value>
+ <value type="QString">XAUTHORITY=/tmp/.gdmS2P7SW</value>
<value
type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value>
- <value
type="QString">XDG_SESSION_COOKIE=9a5c41ad78622411b8e25b00459a554f-1360938269.426603-816256819</value>
+ <value
type="QString">XDG_SESSION_COOKIE=9a5c41ad78622411b8e25b00459a554f-1361173353.46260-1384018529</value>
<value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value>
<value type="QString">XTERM_SHELL=/bin/bash</value>
<value type="QString">XTERM_VERSION=XTerm(261)</value>
@@ -124,7 +124,7 @@
<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-CpLYiAxYxd,guid=7696c32902b91e2834ddfd270002800f</value>
+ <value
type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-YPw0beHDmH,guid=e1ea388d8198abba427530de0006165b</value>
<value type="QString">DESKTOP_SESSION=fluxbox</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=fluxbox</value>
@@ -140,16 +140,16 @@
<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=15822</value>
- <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-OPYeW15762/agent.15762</value>
+ <value type="QString">SSH_AGENT_PID=23527</value>
+ <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-rIfho23467/agent.23467</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=18874392</value>
- <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8</value>
- <value type="QString">XAUTHORITY=/tmp/.gdmWKEBSW</value>
+ <value type="QString">WINDOWID=12582936</value>
+ <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8</value>
+ <value type="QString">XAUTHORITY=/tmp/.gdmS2P7SW</value>
<value
type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value>
- <value
type="QString">XDG_SESSION_COOKIE=9a5c41ad78622411b8e25b00459a554f-1360938269.426603-816256819</value>
+ <value
type="QString">XDG_SESSION_COOKIE=9a5c41ad78622411b8e25b00459a554f-1361173353.46260-1384018529</value>
<value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value>
<value type="QString">XTERM_SHELL=/bin/bash</value>
<value type="QString">XTERM_VERSION=XTerm(261)</value>
@@ -167,6 +167,45 @@
<variable>buildconfiguration-Debug-cleanstep0</variable>
<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-YPw0beHDmH,guid=e1ea388d8198abba427530de0006165b</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">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">LD_LIBRARY_PATH=/usr/lib/qtcreator</value>
+ <value type="QString">LOGNAME=froger_a</value>
+ <value
type="QString">PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/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=23527</value>
+ <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-rIfho23467/agent.23467</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=12582936</value>
+ <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8</value>
+ <value type="QString">XAUTHORITY=/tmp/.gdmS2P7SW</value>
+ <value
type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value>
+ <value
type="QString">XDG_SESSION_COOKIE=9a5c41ad78622411b8e25b00459a554f-1361173353.46260-1384018529</value>
+ <value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value>
+ <value type="QString">XTERM_SHELL=/bin/bash</value>
+ <value type="QString">XTERM_VERSION=XTerm(261)</value>
+ </valuelist>
+ <value key="abstractProcess.IgnoreReturnValue"
type="bool">true</value>
+ <valuelist key="abstractProcess.arguments"
type="QVariantList">
+ <value type="QString">clean</value>
+ <value type="QString">-w</value>
+ </valuelist>
+ <value key="abstractProcess.command"
type="QString">/usr/bin/make</value>
+ <value key="abstractProcess.enabled"
type="bool">true</value>
+ <value key="abstractProcess.workingDirectory"
type="QString">/amd/nfs/volume1/home/stage/froger_a/qt/GScribo</value>
<value key="cleanConfig" type="bool">true</value>
<valuelist key="makeargs" type="QVariantList">
<value type="QString">clean</value>
@@ -178,7 +217,7 @@
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Release</value>
<valuelist key="abstractProcess.Environment"
type="QVariantList">
- <value
type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-CpLYiAxYxd,guid=7696c32902b91e2834ddfd270002800f</value>
+ <value
type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-YPw0beHDmH,guid=e1ea388d8198abba427530de0006165b</value>
<value type="QString">DESKTOP_SESSION=fluxbox</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=fluxbox</value>
@@ -187,6 +226,7 @@
<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">PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/games</value>
@@ -194,16 +234,16 @@
<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=15822</value>
- <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-OPYeW15762/agent.15762</value>
+ <value type="QString">SSH_AGENT_PID=23527</value>
+ <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-rIfho23467/agent.23467</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=18874392</value>
- <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8</value>
- <value type="QString">XAUTHORITY=/tmp/.gdmWKEBSW</value>
+ <value type="QString">WINDOWID=10485784</value>
+ <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8</value>
+ <value type="QString">XAUTHORITY=/tmp/.gdmS2P7SW</value>
<value
type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value>
- <value
type="QString">XDG_SESSION_COOKIE=9a5c41ad78622411b8e25b00459a554f-1360938269.426603-816256819</value>
+ <value
type="QString">XDG_SESSION_COOKIE=9a5c41ad78622411b8e25b00459a554f-1361173353.46260-1384018529</value>
<value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value>
<value type="QString">XTERM_SHELL=/bin/bash</value>
<value type="QString">XTERM_VERSION=XTerm(261)</value>
@@ -224,7 +264,7 @@
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Release</value>
<valuelist key="abstractProcess.Environment"
type="QVariantList">
- <value
type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-CpLYiAxYxd,guid=7696c32902b91e2834ddfd270002800f</value>
+ <value
type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-YPw0beHDmH,guid=e1ea388d8198abba427530de0006165b</value>
<value type="QString">DESKTOP_SESSION=fluxbox</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=fluxbox</value>
@@ -233,6 +273,7 @@
<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">PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/games</value>
@@ -240,16 +281,16 @@
<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=15822</value>
- <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-OPYeW15762/agent.15762</value>
+ <value type="QString">SSH_AGENT_PID=23527</value>
+ <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-rIfho23467/agent.23467</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=18874392</value>
- <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8</value>
- <value type="QString">XAUTHORITY=/tmp/.gdmWKEBSW</value>
+ <value type="QString">WINDOWID=10485784</value>
+ <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8</value>
+ <value type="QString">XAUTHORITY=/tmp/.gdmS2P7SW</value>
<value
type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value>
- <value
type="QString">XDG_SESSION_COOKIE=9a5c41ad78622411b8e25b00459a554f-1360938269.426603-816256819</value>
+ <value
type="QString">XDG_SESSION_COOKIE=9a5c41ad78622411b8e25b00459a554f-1361173353.46260-1384018529</value>
<value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value>
<value type="QString">XTERM_SHELL=/bin/bash</value>
<value type="QString">XTERM_VERSION=XTerm(261)</value>
@@ -268,7 +309,7 @@
<valuemap type="QVariantMap">
<value key="ProjectExplorer.BuildConfiguration.DisplayName"
type="QString">Release</value>
<valuelist key="abstractProcess.Environment"
type="QVariantList">
- <value
type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-CpLYiAxYxd,guid=7696c32902b91e2834ddfd270002800f</value>
+ <value
type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-YPw0beHDmH,guid=e1ea388d8198abba427530de0006165b</value>
<value type="QString">DESKTOP_SESSION=fluxbox</value>
<value type="QString">DISPLAY=:0.0</value>
<value type="QString">GDMSESSION=fluxbox</value>
@@ -277,6 +318,7 @@
<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">PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/games</value>
@@ -284,16 +326,16 @@
<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=15822</value>
- <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-OPYeW15762/agent.15762</value>
+ <value type="QString">SSH_AGENT_PID=23527</value>
+ <value
type="QString">SSH_AUTH_SOCK=/tmp/ssh-rIfho23467/agent.23467</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=18874392</value>
- <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8</value>
- <value type="QString">XAUTHORITY=/tmp/.gdmWKEBSW</value>
+ <value type="QString">WINDOWID=10485784</value>
+ <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8</value>
+ <value type="QString">XAUTHORITY=/tmp/.gdmS2P7SW</value>
<value
type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value>
- <value
type="QString">XDG_SESSION_COOKIE=9a5c41ad78622411b8e25b00459a554f-1360938269.426603-816256819</value>
+ <value
type="QString">XDG_SESSION_COOKIE=9a5c41ad78622411b8e25b00459a554f-1361173353.46260-1384018529</value>
<value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value>
<value type="QString">XTERM_SHELL=/bin/bash</value>
<value type="QString">XTERM_VERSION=XTerm(261)</value>
diff --git a/GScribo/Preferences/preferencesdialog.cpp
b/GScribo/Preferences/preferencesdialog.cpp
index 6855698..23a0dd6 100644
--- a/GScribo/Preferences/preferencesdialog.cpp
+++ b/GScribo/Preferences/preferencesdialog.cpp
@@ -2,7 +2,7 @@
#include "ui_preferencesdialog.h"
PreferencesDialog::PreferencesDialog(QWidget *parent) :
- QDialog(parent),
+ QDialog(parent, Qt::Dialog),
ui(new Ui::PreferencesDialog)
{
ui->setupUi(this);
diff --git a/GScribo/Preferences/preprocessingoptions.cpp
b/GScribo/Preferences/preprocessingoptions.cpp
index 640ad32..6639bae 100644
--- a/GScribo/Preferences/preprocessingoptions.cpp
+++ b/GScribo/Preferences/preprocessingoptions.cpp
@@ -1,7 +1,7 @@
#include "preprocessingoptions.h"
#include "ui_preprocessingoptions.h"
-//using namespace scribo::toolchain::internal;
+using namespace scribo::toolchain::internal;
PreprocessingOptions::PreprocessingOptions(QWidget *parent) :
OptionWidget(parent),
@@ -9,9 +9,9 @@ PreprocessingOptions::PreprocessingOptions(QWidget *parent) :
{
ui->setupUi(this);
- /*ui->bin_algoCbox->insertItem(Convert, "Violent convert");
+ ui->bin_algoCbox->insertItem(Convert, "Violent convert");
ui->bin_algoCbox->insertItem(Sauvola, "Local threshold");
- ui->bin_algoCbox->insertItem(SauvolaMs, "Local threshold
multiscale");*/
+ ui->bin_algoCbox->insertItem(SauvolaMs, "Local threshold
multiscale");
loadConfig();
}
@@ -29,7 +29,7 @@ void PreprocessingOptions::loadConfig()
ui->remove_bgCb->setChecked(conf->preprocessingRemoveBg());
ui->deskewCb->setChecked(conf->preprocessingDeskew());
ui->remove_noiseCb->setChecked(conf->preprocessingRemoveNoise());
- //ui->bin_algoCbox->setCurrentIndex(conf->preprocessingBinAlgo());
+ ui->bin_algoCbox->setCurrentIndex(conf->preprocessingBinAlgo());
}
@@ -41,5 +41,5 @@ void PreprocessingOptions::saveConfig()
conf->setPreprocessingRemoveBg(ui->remove_bgCb->isChecked());
conf->setPreprocessingDeskew(ui->deskewCb->isChecked());
conf->setPreprocessingRemoveNoise(ui->remove_noiseCb->isChecked());
- //conf->setPreprocessingBinAlgo(ui->bin_algoCbox->currentIndex());
+ conf->setPreprocessingBinAlgo(ui->bin_algoCbox->currentIndex());
}
diff --git a/GScribo/Preferences/preprocessingoptions.h
b/GScribo/Preferences/preprocessingoptions.h
index 1818322..6cc0081 100644
--- a/GScribo/Preferences/preprocessingoptions.h
+++ b/GScribo/Preferences/preprocessingoptions.h
@@ -1,7 +1,7 @@
#ifndef PREPROCESSINGOPTIONS_H
#define PREPROCESSINGOPTIONS_H
-//#include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
+#include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
#include "optionwidget.h"
#include "region.h"
diff --git a/GScribo/Processing/progressdialog.cpp
b/GScribo/Processing/progressdialog.cpp
index 1ae876f..7f9d833 100644
--- a/GScribo/Processing/progressdialog.cpp
+++ b/GScribo/Processing/progressdialog.cpp
@@ -1,20 +1,13 @@
#include "progressdialog.h"
-ProgressDialog::ProgressDialog(QWidget *parent, Qt::WindowFlags flags):
- QProgressDialog(parent, flags)
+ProgressDialog::ProgressDialog(QWidget *parent):
+ QProgressDialog(parent, Qt::Dialog)
{
- setWindowFlags(Qt::Dialog);
- setModal(true);
setAutoClose(false);
setCancelButton(0);
hide();
}
-void ProgressDialog::run()
-{
- setValue(value()+1);
-}
-
void ProgressDialog::reset()
{
setValue(0);
diff --git a/GScribo/Processing/progressdialog.h b/GScribo/Processing/progressdialog.h
index d1d1a20..822d9ba 100644
--- a/GScribo/Processing/progressdialog.h
+++ b/GScribo/Processing/progressdialog.h
@@ -9,11 +9,14 @@ class ProgressDialog :
Q_OBJECT
public:
- explicit ProgressDialog(QWidget *parent = 0, Qt::WindowFlags flags = 0);
+ explicit ProgressDialog(QWidget *parent = 0);
void reset();
public slots:
- void run();
+ inline void run();
};
+void ProgressDialog::run()
+{ setValue(value()+1); }
+
#endif // PROGRESSDIALOG_H
diff --git a/GScribo/Processing/runner.cpp b/GScribo/Processing/runner.cpp
index 00348a5..c02223c 100644
--- a/GScribo/Processing/runner.cpp
+++ b/GScribo/Processing/runner.cpp
@@ -23,26 +23,21 @@ Runner::Runner(QObject *parent) :
void Runner::run()
{
- switch(mode_)
+ if(mode_ == Demat)
{
- default:
- case Demat:
+ image2d<value::rgb8> ima;
+ for(int i = 0; i < args_.count(); i++)
{
- image2d<value::rgb8> 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();
+ io::magick::load(ima, args_.at(i).toUtf8().constData());
+ image2d<bool> bin_ima = preprocess(ima);
+ process(ima, bin_ima, i);
}
- break;
-
- case Export:
- export_as();
- break;
}
+
+ else if(mode_ == Export)
+ export_as();
+
+ emit finished();
}
void Runner::stop()
diff --git a/GScribo/Rendering/graphicsview.cpp b/GScribo/Rendering/graphicsview.cpp
index ea846e9..336d5c2 100644
--- a/GScribo/Rendering/graphicsview.cpp
+++ b/GScribo/Rendering/graphicsview.cpp
@@ -61,7 +61,7 @@ void GraphicsView::wheelEvent(QWheelEvent *event)
scaleRatio_.height();
if(event->delta() > 0)
{
- if(nextScaleRatio <= 15)
+ if(nextScaleRatio <= 20)
{
scaleRatio_ *= degrees;
scale(degrees, degrees);
@@ -95,7 +95,7 @@ void GraphicsView::keyPressEvent(QKeyEvent* event)
{
nextScaleRatio = 1.2 * isWidthGreater_ ? scaleRatio_.width() :
scaleRatio_.height();
- if(nextScaleRatio <= 15)
+ if(nextScaleRatio <= 19)
{
scaleRatio_ *= 1.2;
scale(1.2, 1.2);
diff --git a/GScribo/TODO b/GScribo/TODO
index 1c6c89a..8e7b556 100644
--- a/GScribo/TODO
+++ b/GScribo/TODO
@@ -1,3 +1,11 @@
+* Concerning the configurations :
+ - Register the location of the different widget and if they are visible/ invisible to
restore it on the next utilisation of the gui.
+
+
+* Concerning the menu bar :
+ - Assign shortcuts for each buttons.
+
+
* Concerning the xml widget :
- Can modify in real time the proxy with a regular expression. When the user click on a
check box in the region widget, a new regular expression is created an sent to the xml
widget but the proxy is not modified by this regular expression.
- In the table tree (the attributes tree), set the max of the header splitter. Currently
it can be moved indefinitely to the right.
@@ -25,13 +33,18 @@
- Load less thumbnails (just the necessary to draw it on the widget) because sometimes,
pictures are heavy.
- May be use a progress dialog during the loading where a large number of pictures are
loaded.
- Offer the possibility to down/ upscale thumbnails.
+ - Allow the user to move ine the widget with arrow keys.
- Create also a button to delete selected items (rather than the key 'delete').
- During the segmentation, give the possibility to segment selected thumbnails, all
thumbnails or juste the current.
- For each thumbnails, paint at his bottom a little progress dialog to check if the
picture has already been segmented, not segmented or ongoing segmentation.
+* Concerning the progress dialog :
+ - Center on the main window.
+
* Concerning the xml file :
- Stop using the static array representation of the internal data structure for graphics
region.
+ - Change the way we check if the user allows OCR to recognize the text or just segment.
- Find a better way to run through all node representing a graphics item without knowing
it in advance. For exemple, the xml file looks like this :
@@ -84,4 +97,4 @@
* For other idea of interfaces using Qt :
- - gwenview (picture visionnary, good idea here).
+ - gwenview (picture visionnary, good ideas here).
diff --git a/GScribo/aboutdialog.h b/GScribo/aboutdialog.h
index 31f6239..fa91ada 100644
--- a/GScribo/aboutdialog.h
+++ b/GScribo/aboutdialog.h
@@ -14,7 +14,8 @@ class AboutDialog :
public QDialog
{
public:
- explicit AboutDialog() { ui = new Ui::AboutDialog; ui->setupUi(this); }
+ explicit AboutDialog(QWidget *parent = 0) : QDialog(parent, Qt::Dialog)
+ { ui = new Ui::AboutDialog; ui->setupUi(this); }
~AboutDialog() { delete ui; }
private:
diff --git a/GScribo/aboutdialog.ui b/GScribo/aboutdialog.ui
index 275e4ae..d16b076 100644
--- a/GScribo/aboutdialog.ui
+++ b/GScribo/aboutdialog.ui
@@ -78,24 +78,24 @@
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext"
content="1" /><style
type="text/css">
p, li { white-space: pre-wrap; }
-</style></head><body style="
font-family:'DejaVu Sans'; font-size:9pt; font-weight:400;
font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-size:12pt; font-weight:600;">Document Image Analysis
Tool</span></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;
font-weight:600;"></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0;
text-indent:0px;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;">This project is
powered by <span style=" font-weight:600;
font-style:italic;">Milena</span>, a generic image
processing library.</p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0;
text-indent:0px;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;">It is part of
<span style=" font-weight:600;
font-style:italic;">Olena</span>, an Image Processing
Platform and its module <span style=" font-weight:600;
font-style:italic;">Scribo</span>, a set of tools for
Document Image Analysis.</p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0;
text-indent:0px;"></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0;
text-indent:0px;"></p>
-<p align="center" style=" margin-top:0px;
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0;
text-indent:0px;"><a
href="http://olena.lrde.epita.fr"><span style="
text-decoration: underline;
color:#0057ae;">http://olena.lrde.epita.fr</span></a></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0;
text-indent:0px;"></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0;
text-indent:0px;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-size:8pt;">Thanks to Arthur Crépin-Leblond, Samuel
Da Mota, Loic Denuziere, </span><span style="
font-size:8pt;">Jérôme Galtier,</span><span
style=" font-size:8pt;"> </span><span
style=" font-size:8pt;">Florent d'Halluin,
</span><span style=" font-size:8pt;">Alex
Hamelin, </span><span style="
font-size:8pt;">Damien Lefortier, </span><span
style=" font-size:8pt;">Vincent Ordy,
</span><span style="
font-size:8pt;">Guillaume Sadegh and</span><span
style=" font-size:8pt;"> </span><span
style=" font-size:8pt;">Warren Seine
</span><span style=" font-size:8pt;">for
their contribution.</span></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;
font-size:8pt;"></p>
-<p align="justify" style="-qt-paragraph-type:empty;
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0;
text-indent:0px; font-size:8pt;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-size:7pt;">This application has been developed in
the context of the SCRIBO project of the Free Software Thematic Group, part of the
&quot;System@tic Paris-Région&quot; Cluster (France). This project is
partially funded by the French Government, its economic development agencies, and by the
Paris-Région institutions.</span></p>
-<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;
font-size:7pt;"></p>
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-size:7pt;">Copyright (C) 2010, 2011 EPITA Research
and Development Laboratory
(LRDE)</span></p></body></html></string>
+</style></head><body style="
font-family:'Sans Serif'; font-size:9pt; font-weight:400;
font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-family:'DejaVu Sans'; font-size:12pt;
font-weight:600;">Document Image Analysis
Tool</span></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;
font-family:'DejaVu Sans'; font-size:12pt;
font-weight:600;"></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;
font-family:'DejaVu Sans';"></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-family:'DejaVu Sans';">This project is
powered by </span><span style=" font-family:'DejaVu
Sans'; font-weight:600;
font-style:italic;">Milena</span><span
style=" font-family:'DejaVu Sans';">, a generic image
processing library.</span></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;
font-family:'DejaVu Sans';"></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-family:'DejaVu Sans';">It is part of
</span><span style=" font-family:'DejaVu Sans';
font-weight:600;
font-style:italic;">Olena</span><span
style=" font-family:'DejaVu Sans';">, an Image Processing
Platform and its module </span><span style="
font-family:'DejaVu Sans'; font-weight:600;
font-style:italic;">Scribo</span><span
style=" font-family:'DejaVu Sans';">, a set of tools for
Document Image Analysis.</span></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;
font-family:'DejaVu Sans';"></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;
font-family:'DejaVu Sans';"></p>
+<p align="center" style=" margin-top:0px;
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0;
text-indent:0px;"><a
href="http://olena.lrde.epita.fr"><span style="
font-family:'DejaVu Sans'; text-decoration: underline;
color:#0057ae;">http://olena.lrde.epita.fr</span></a></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;
font-family:'DejaVu Sans';"></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;
font-family:'DejaVu Sans';"></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-family:'DejaVu Sans'; font-size:8pt;">Thanks
to Arthur Crépin-Leblond, Samuel Da Mota, Loic Denuziere, Jérôme Galtier, Florent
d'Halluin, Alex Hamelin, Damien Lefortier, Vincent Ordy, Guillaume Sadegh and Warren
Seine for their contribution.</span></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;
font-family:'DejaVu Sans'; font-size:8pt;"></p>
+<p align="justify" style="-qt-paragraph-type:empty;
margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0;
text-indent:0px; font-family:'DejaVu Sans';
font-size:8pt;"></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-family:'DejaVu Sans'; font-size:7pt;">This
application has been developed in the context of the SCRIBO project of the Free Software
Thematic Group, part of the &quot;System@tic Paris-Région&quot; Cluster
(France). This project is partially funded by the French Government, its economic
development agencies, and by the Paris-Région
institutions.</span></p>
+<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;
font-family:'DejaVu Sans'; font-size:7pt;"></p>
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span
style=" font-family:'DejaVu Sans';
font-size:7pt;">Copyright (C) 2012, 2013 EPITA Research and Development
Laboratory
(LRDE)</span></p></body></html></string>
</property>
<property name="wordWrap">
<bool>true</bool>
diff --git a/GScribo/dir.h b/GScribo/dir.h
index bf088f8..a6c036b 100644
--- a/GScribo/dir.h
+++ b/GScribo/dir.h
@@ -1,7 +1,7 @@
#ifndef DIR_H
#define DIR_H
-#define SCRIBO_LOCAL_DEMODIR "/home/onix/froger_a/olena/_build/scribo/demo"
+#define SCRIBO_LOCAL_DEMODIR
"/lrde/home/stage/froger_a/olena/_build/scribo/demo"
#define SCRIBO_PREFIX_BINDIR "/usr/local/bin"
#endif // DIR_H
diff --git a/GScribo/mainwindow.cpp b/GScribo/mainwindow.cpp
index 8682bec..4bb5c74 100644
--- a/GScribo/mainwindow.cpp
+++ b/GScribo/mainwindow.cpp
@@ -8,10 +8,10 @@ MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this);
setWindowTitle(tr("GScribo"));
- statusBar()->hide();
- ui->mainToolBar->hide();
+ showMaximized();
initGraphicsRegion();
+ initDialogsWidget();
initXmlWidget();
initRegionWidget();
initPageWidget();
@@ -27,6 +27,9 @@ MainWindow::MainWindow(QWidget *parent) :
MainWindow::~MainWindow()
{
+ delete preferencesDialog_;
+ delete aboutDialog_;
+ delete progressDialog_;
delete ui;
}
@@ -51,6 +54,13 @@ void MainWindow::initGraphicsRegion()
setCentralWidget(&graphicsView_);
}
+void MainWindow::initDialogsWidget()
+{
+ preferencesDialog_ = new PreferencesDialog(this);
+ aboutDialog_ = new AboutDialog(this);
+ progressDialog_ = new ProgressDialog(this);
+}
+
void MainWindow::initPageWidget()
{
dockPages_.setWindowTitle("Pages");
@@ -85,7 +95,7 @@ void MainWindow::initMenuBar()
QMenu *menuFile = ui->menuBar->addMenu(tr("File"));
QAction *open = menuFile->addAction(tr("Open"));
- connect(open, SIGNAL(triggered()), SLOT(onOpen()));
+ connect(open, SIGNAL(triggered()), this, SLOT(onOpen()));
segment_ = menuFile->addAction(tr("Segment"));
segment_->setEnabled(false);
@@ -130,10 +140,10 @@ void MainWindow::initMenuBar()
connect(xml, SIGNAL(triggered()), &dockXml_, SLOT(switchVisibility()));
QAction *preferences = ui->menuBar->addAction(tr("Preferences"));
- connect(preferences, SIGNAL(triggered()), SLOT(onPreferences()));
+ connect(preferences, SIGNAL(triggered()), this, SLOT(onPreferences()));
QAction *about = ui->menuBar->addAction(tr("About"));
- connect(about, SIGNAL(triggered()), SLOT(onAbout()));
+ connect(about, SIGNAL(triggered()), this, SLOT(onAbout()));
}
void MainWindow::setActionsEnabled(bool isSegmented)
@@ -141,7 +151,6 @@ void MainWindow::setActionsEnabled(bool isSegmented)
segment_->setEnabled(!isSegmented);
print_->setEnabled(isSegmented);
previewPrinting_->setEnabled(isSegmented);
- export_->setEnabled(isSegmented);
}
void MainWindow::disableActions()
@@ -176,16 +185,18 @@ void MainWindow::connectWidgets()
// Connect the xml widget with the region widget.
connect(®ionWidget_, SIGNAL(checkStateChanged(QString)), xmlWidget_.view(),
SLOT(setFilterString(QString)));
- connect(&runner_, SIGNAL(progress()), &progressDialog_, SLOT(run()));
- connect(&runner_, SIGNAL(new_progress_max_value(int)), &progressDialog_,
SLOT(setMaximum(int)));
- connect(&runner_, SIGNAL(new_progress_label(QString)), &progressDialog_,
SLOT(setLabelText(QString)));
- connect(&runner_, SIGNAL(finished()), &progressDialog_, SLOT(close()));
+ 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()));
connect(&runner_, SIGNAL(xml_saved(QString)), this, SLOT(onXmlSaved(QString)));
}
void MainWindow::onOpen()
{
- QStringList paths = QFileDialog::getOpenFileNames(&graphicsView_, "Open
Image(s)", QDir::homePath(), "Images (*.png *.jpg *.ppm *.bmp)");
+ QStringList paths = QFileDialog::getOpenFileNames(this, "Open Image(s)",
QDir::homePath(),
+ "Images (*.png *.jpg *.ppm
*.bmp)");
+ setWindowTitle(tr("GScribo"));
if(paths.count() > 0)
{
@@ -233,7 +244,7 @@ void MainWindow::onSegment()
filenames << scene_.backgroundPath();
// Run segmentation of page(s).
- progressDialog_.reset();
+ progressDialog_->reset();
runner_.start_demat(filenames);
}
@@ -243,7 +254,7 @@ void MainWindow::onPreviewPrint()
printer.setPaperSize(QPrinter::A4);
printer.setResolution(300);
- QPrintPreviewDialog preview(&printer);
+ QPrintPreviewDialog preview(&printer, this);
connect(&preview, SIGNAL(paintRequested(QPrinter*)), this,
SLOT(printScene(QPrinter*)));
preview.exec();
@@ -255,7 +266,7 @@ void MainWindow::onPrint()
printer.setPaperSize(QPrinter::A4);
printer.setResolution(300);
- QPrintDialog dialog(&printer);
+ QPrintDialog dialog(&printer, this);
dialog.setWindowTitle("Print Document");
if(dialog.exec() != QDialog::Accepted)
@@ -266,8 +277,6 @@ void MainWindow::onPrint()
void MainWindow::printScene(QPrinter *printer)
{
- scene_.selectAll();
-
QPainter painter(printer);
QStyleOptionGraphicsItem options;
@@ -282,8 +291,6 @@ void MainWindow::printScene(QPrinter *printer)
for(int i = GraphicsRegion::Noise; i <= GraphicsRegion::Meanline; i++)
printItems(&painter,
scene_.root()->childsFrom(static_cast<GraphicsRegion::Id>(i)), &options);
-
- scene_.clearSelection();
}
void MainWindow::printItems(QPainter *painter, const QList<QGraphicsItem *>&
items, QStyleOptionGraphicsItem *options)
@@ -303,6 +310,12 @@ void MainWindow::printItems(QPainter *painter, const
QList<QGraphicsItem *>& ite
void MainWindow::onExportation()
{
+ QMessageBox messageBox(this);
+ messageBox.setWindowTitle("Information");
+ messageBox.setText("This feature is not available yet");
+ messageBox.exec();
+ return;
+
QFileInfo fileInfo(scene_.backgroundPath());
QString outputSuggestion = fileInfo.baseName() + ".pdf";
QString output = QFileDialog::getSaveFileName(0, tr("Export Document As
..."), outputSuggestion,
@@ -310,23 +323,11 @@ void MainWindow::onExportation()
if(!output.isEmpty())
{
- progressDialog_.reset();
+ progressDialog_->reset();
runner_.start_export(scene_.backgroundPath(), xml_.filename(), output);
}
}
-void MainWindow::onPreferences()
-{
- PreferencesDialog *preferenceDialog = new PreferencesDialog(this);
- preferenceDialog->show();
-}
-
-void MainWindow::onAbout()
-{
- AboutDialog *about = new AboutDialog;
- about->show();
-}
-
void MainWindow::onXmlSaved(const QString& filename)
{
xml_.load(filename);
@@ -334,6 +335,7 @@ void MainWindow::onXmlSaved(const QString& filename)
scene_.setRoot(xml_.graphicsItem());
setActionsEnabled(true);
+ export_->setEnabled(xml_.recognized());
}
void MainWindow::onFileChanged(const QString& filename)
@@ -360,6 +362,7 @@ void MainWindow::onFileChanged(const QString& filename)
xml_.load(xmlPath);
scene_.changeScene(filename, xml_.graphicsItem());
xmlWidget_.changeView(xml_.xmlItem());
+ export_->setEnabled(xml_.recognized());
}
}
diff --git a/GScribo/mainwindow.h b/GScribo/mainwindow.h
index 919314f..0637f44 100644
--- a/GScribo/mainwindow.h
+++ b/GScribo/mainwindow.h
@@ -42,6 +42,7 @@ class MainWindow:
private:
void initGraphicsRegion();
+ void initDialogsWidget();
void initPageWidget();
void initRegionWidget();
void initXmlWidget();
@@ -69,11 +70,13 @@ class MainWindow:
PagesWidget pagesWidget_;
RegionWidget regionWidget_;
- ProgressDialog progressDialog_;
- Runner runner_;
+ AboutDialog *aboutDialog_;
+ ProgressDialog *progressDialog_;
+ PreferencesDialog *preferencesDialog_;
XmlWidget xmlWidget_;
Xml xml_;
+ Runner runner_;
QAction *segment_;
QAction *previewPrinting_;
@@ -89,8 +92,8 @@ class MainWindow:
void onPreviewPrint();
void onPrint();
void onExportation();
- void onPreferences();
- void onAbout();
+ inline void onPreferences();
+ inline void onAbout();
void onXmlSaved(const QString& filename);
void onFileChanged(const QString& filename);
@@ -102,6 +105,11 @@ class MainWindow:
inline void onXmlUnselect(QList<XmlItem *> xmlItems);
};
+inline void MainWindow::onPreferences()
+{ preferencesDialog_->show(); }
+
+inline void MainWindow::onAbout()
+{ aboutDialog_->show(); }
inline void MainWindow::onXmlSelect(QList<XmlItem *> xmlItems)
{ onXmlChangeSelection(xmlItems, true); }
diff --git a/GScribo/mainwindow.ui b/GScribo/mainwindow.ui
index 0d91002..0512da9 100644
--- a/GScribo/mainwindow.ui
+++ b/GScribo/mainwindow.ui
@@ -28,18 +28,6 @@
</rect>
</property>
</widget>
- <widget class="QToolBar" name="mainToolBar">
- <property name="floatable">
- <bool>false</bool>
- </property>
- <attribute name="toolBarArea">
- <enum>TopToolBarArea</enum>
- </attribute>
- <attribute name="toolBarBreak">
- <bool>false</bool>
- </attribute>
- </widget>
- <widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
diff --git a/GScribo/xml.cpp b/GScribo/xml.cpp
index 05dfe7f..9b0334d 100644
--- a/GScribo/xml.cpp
+++ b/GScribo/xml.cpp
@@ -20,6 +20,14 @@ QString Xml::getPath(const QString& filename)
return configs->generalSaveXmlCustomDirPath() + "/" + xmlPath;
}
+void Xml::isRecognized(const QDomElement& textElement)
+{
+ QDomElement lineElement =
textElement.firstChild().nextSiblingElement("Line");
+
+ // Check if the attributes "text" exists in the attributes of line in the
xml file.
+ isRecognized_ = lineElement.attributeNode("text").isNull() ? false : true;
+}
+
void Xml::load(const QString& filename)
{
if(filename.isEmpty())
@@ -27,6 +35,7 @@ void Xml::load(const QString& filename)
xmlItem_ = 0;
graphicsItem_ = 0;
filename_ = QString();
+ isRecognized_ = false;
return;
}
@@ -53,6 +62,9 @@ void Xml::load(const QString& filename)
// Run through the xml file structure by structure.
root = root.nextSibling().firstChild().toElement();
+ // Check if the xml file has been recognized by the ocr or not.
+ isRecognized(root);
+
processNode(root, datas_[0], parentTreeItem);
for(int i = 2; i < 11; i++)
processNode(root.nextSiblingElement(datas_[i].name), datas_[i], parentTreeItem);
diff --git a/GScribo/xml.h b/GScribo/xml.h
index 5f3575a..f9274ed 100644
--- a/GScribo/xml.h
+++ b/GScribo/xml.h
@@ -5,6 +5,7 @@
#include <QGraphicsItem>
#include <QStringList>
#include <QDomElement>
+#include <QDomAttr>
#include <climits>
#include <QFile>
@@ -19,17 +20,17 @@
static const GraphicsRegion::Data datas_[] =
{
/* COLOR | NAME |
REGION | PARENT | Z */
- { QColor::fromRgb(0, 100, 0, 90), "TextRegion",
GraphicsRegion::TextRegion, GraphicsRegion::Text, 1 },
- { QColor::fromRgb(255, 0, 0, 90), "Line",
GraphicsRegion::Line, GraphicsRegion::Text, 2 },
- { QColor::fromRgb(0, 0, 255, 90), "VerticalSeparatorRegion",
GraphicsRegion::VerticalSeparator, GraphicsRegion::Separators, 2 },
- { QColor::fromRgb(0, 0, 255, 90), "HorizontalSeparatorRegion",
GraphicsRegion::HorizontalSeparator, GraphicsRegion::Separators, 2 },
- { QColor::fromRgb(0, 0, 128, 90), "WhitespaceSeparatorRegion",
GraphicsRegion::WhiteSpaceSeparator, GraphicsRegion::Separators, 2 },
- { QColor::fromRgb(255, 120, 0, 90), "ImageRegion",
GraphicsRegion::Image, GraphicsRegion::Miscellaneous, 1 },
- { QColor::fromRgb(43, 39, 128, 90), "NoiseRegion",
GraphicsRegion::Noise, GraphicsRegion::Miscellaneous, 2 },
- { QColor::fromRgb(220, 246, 0, 90), "TableRegion",
GraphicsRegion::Table, GraphicsRegion::Miscellaneous, 2 },
- { QColor::fromRgb(170, 0, 255, 90), "MathsRegion",
GraphicsRegion::Maths, GraphicsRegion::Miscellaneous, 2 },
- { QColor::fromRgb(255, 0, 144, 90), "GraphicsRegion",
GraphicsRegion::Graphic, GraphicsRegion::Miscellaneous, 2 },
- { QColor::fromRgb(0, 204, 255, 90), "ChartRegion",
GraphicsRegion::Chart, GraphicsRegion::Miscellaneous, 2 },
+ { QColor::fromRgb(0, 100, 0, 110), "TextRegion",
GraphicsRegion::TextRegion, GraphicsRegion::Text, 1 },
+ { QColor::fromRgb(255, 0, 0, 110), "Line",
GraphicsRegion::Line, GraphicsRegion::Text, 2 },
+ { QColor::fromRgb(0, 0, 255, 110), "VerticalSeparatorRegion",
GraphicsRegion::VerticalSeparator, GraphicsRegion::Separators, 2 },
+ { QColor::fromRgb(0, 0, 255, 110), "HorizontalSeparatorRegion",
GraphicsRegion::HorizontalSeparator, GraphicsRegion::Separators, 2 },
+ { QColor::fromRgb(0, 0, 128, 110), "WhitespaceSeparatorRegion",
GraphicsRegion::WhiteSpaceSeparator, GraphicsRegion::Separators, 2 },
+ { QColor::fromRgb(255, 120, 0, 110), "ImageRegion",
GraphicsRegion::Image, GraphicsRegion::Miscellaneous, 1 },
+ { QColor::fromRgb(43, 39, 128, 110), "NoiseRegion",
GraphicsRegion::Noise, GraphicsRegion::Miscellaneous, 2 },
+ { QColor::fromRgb(220, 246, 0, 110), "TableRegion",
GraphicsRegion::Table, GraphicsRegion::Miscellaneous, 2 },
+ { QColor::fromRgb(170, 0, 255, 110), "MathsRegion",
GraphicsRegion::Maths, GraphicsRegion::Miscellaneous, 2 },
+ { QColor::fromRgb(255, 0, 144, 110), "GraphicsRegion",
GraphicsRegion::Graphic, GraphicsRegion::Miscellaneous, 2 },
+ { QColor::fromRgb(0, 204, 255, 110), "ChartRegion",
GraphicsRegion::Chart, GraphicsRegion::Miscellaneous, 2 },
{ QColor::fromRgb(128, 0, 255), "Baseline",
GraphicsRegion::Baseline, GraphicsRegion::Typology, 3 },
{ QColor::fromRgb(128, 0, 255), "Meanline",
GraphicsRegion::Meanline, GraphicsRegion::Typology, 3 },
{ QColor::fromRgb(255, 255, 255), "Text",
GraphicsRegion::Text, GraphicsRegion::None, 0 },
@@ -48,6 +49,7 @@ class Xml
inline QDomDocument document() const;
inline QString filename() const;
+ inline bool recognized() const;
static QString getPath(const QString& filename);
@@ -56,6 +58,7 @@ class Xml
private:
XmlItem *init(const QDomElement& root, XmlItem *rootTreeItem);
+ void isRecognized(const QDomElement& element);
void processNode(const QDomElement& root, const GraphicsRegion::Data&
data, XmlItem *rootTreeItem);
void processLineNode(const QDomElement& root, XmlItem *rootTreeItem);
@@ -66,6 +69,7 @@ class Xml
QDomDocument xml_;
QString filename_;
+ bool isRecognized_;
};
inline XmlItem *Xml::xmlItem()
@@ -83,4 +87,7 @@ inline QString Xml::filename() const
inline GraphicsRegion::Data Xml::dataFromRegion(GraphicsRegion::Id region)
{ return datas_[region]; }
+inline bool Xml::recognized() const
+{ return isRecognized_; }
+
#endif // XML_H
--
1.7.2.5