---
GScribo/GScribo.pro | 60 ++++++++++
GScribo/Preferences/generaloptions.cpp | 44 +++++++
GScribo/Preferences/generaloptions.h | 34 ++++++
GScribo/Preferences/ocroptions.cpp | 55 +++++++++
GScribo/Preferences/ocroptions.h | 33 ++++++
GScribo/Preferences/optionwidget.cpp | 14 ---
GScribo/Preferences/optionwidget.h | 6 +-
GScribo/Preferences/preferencesdialog.cpp | 98 ++++++++++++++++
GScribo/Preferences/preferencesdialog.h | 42 +++++++
GScribo/Preferences/preprocessingoptions.h | 32 +++++
GScribo/Preferences/segmentationoptions.cpp | 35 ++++++
GScribo/Preferences/segmentationoptions.h | 31 +++++
GScribo/configs.cpp | 164 ---------------------------
GScribo/configs.h | 138 ++++++++++++++++++----
14 files changed, 579 insertions(+), 207 deletions(-)
create mode 100644 GScribo/GScribo.pro
create mode 100644 GScribo/Preferences/generaloptions.cpp
create mode 100644 GScribo/Preferences/generaloptions.h
create mode 100644 GScribo/Preferences/ocroptions.cpp
create mode 100644 GScribo/Preferences/ocroptions.h
delete mode 100644 GScribo/Preferences/optionwidget.cpp
create mode 100644 GScribo/Preferences/preferencesdialog.cpp
create mode 100644 GScribo/Preferences/preferencesdialog.h
create mode 100644 GScribo/Preferences/preprocessingoptions.h
create mode 100644 GScribo/Preferences/segmentationoptions.cpp
create mode 100644 GScribo/Preferences/segmentationoptions.h
delete mode 100644 GScribo/configs.cpp
diff --git a/GScribo/GScribo.pro b/GScribo/GScribo.pro
new file mode 100644
index 0000000..42d9e7b
--- /dev/null
+++ b/GScribo/GScribo.pro
@@ -0,0 +1,60 @@
+# -------------------------------------------------
+# Project created by QtCreator 2013-01-21T09:20:54
+# -------------------------------------------------
+QT += xml
+INCLUDEPATH += /lrde/home/stage/froger_a/olena/milena/ \
+ /lrde/home/stage/froger_a/olena/scribo/ \
+ /lrde/home/stage/froger_a/olena/_build/scribo/demo/
+QMAKE_CXXFLAGS += -DNDEBUG \
+ -DMLN_WO_GLOBAL_VARS
+LIBS += -I/usr/include/graphicsImage \
+ -lGraphicsMagick++ \
+ -ltesseract_full
+TARGET = GScribo
+TEMPLATE = app
+SOURCES += main.cpp \
+ mainwindow.cpp \
+ Rendering/scene.cpp \
+ Rendering/selection.cpp \
+ Rendering/polygonitem.cpp \
+ PagesViewer/pageswidget.cpp \
+ PagesViewer/listmodel.cpp \
+ Preferences/segmentationoptions.cpp \
+ Preferences/preprocessingoptions.cpp \
+ Preferences/ocroptions.cpp \
+ Preferences/generaloptions.cpp \
+ Preferences/preferencesdialog.cpp \
+ Processing/progressdialog.cpp \
+ Processing/process.cpp \
+ Processing/preprocess.cpp \
+ Processing/runner.cpp \
+ xml.cpp \
+ xmlwidget.cpp
+HEADERS += mainwindow.h \
+ configs.h \
+ region.h \
+ Rendering/scene.h \
+ Rendering/selection.h \
+ Rendering/polygonitem.h \
+ PagesViewer/pageswidget.h \
+ PagesViewer/listmodel.h \
+ Preferences/segmentationoptions.h \
+ Preferences/preprocessingoptions.h \
+ Preferences/ocroptions.h \
+ Preferences/generaloptions.h \
+ Preferences/optionwidget.h \
+ Preferences/preferencesdialog.h \
+ Processing/preprocess.h \
+ Processing/progressdialog.h \
+ Processing/process.h \
+ dir.h \
+ Processing/runner.h \
+ xml.h \
+ variantpointer.h \
+ xmlwidget.h
+FORMS += mainwindow.ui \
+ Preferences/preferencesdialog.ui \
+ Preferences/ocroptions.ui \
+ Preferences/segmentationoptions.ui \
+ Preferences/generaloptions.ui \
+ Preferences/preprocessingoptions.ui
diff --git a/GScribo/Preferences/generaloptions.cpp
b/GScribo/Preferences/generaloptions.cpp
new file mode 100644
index 0000000..39a0160
--- /dev/null
+++ b/GScribo/Preferences/generaloptions.cpp
@@ -0,0 +1,44 @@
+#include "generaloptions.h"
+#include "ui_generaloptions.h"
+
+GeneralOptions::GeneralOptions(QWidget *parent) :
+ OptionWidget(parent),
+ ui(new Ui::GeneralOptions)
+{
+ ui->setupUi(this);
+ loadConfig();
+}
+
+GeneralOptions::~GeneralOptions()
+{
+ delete ui;
+}
+
+void GeneralOptions::loadConfig()
+{
+ Configs * const conf = Configs::getInstance();
+
+ ui->saveXml->setChecked(conf->generalSaveXmlEnabled());
+ ui->sameDir->setChecked(conf->generalSaveXmlSameDir());
+ ui->customDir->setChecked(conf->generalSaveXmlCustomDir());
+ ui->customDirValue->setText(conf->generalSaveXmlCustomDirPath());
+}
+
+
+void GeneralOptions::saveConfig()
+{
+ Configs * const conf = Configs::getInstance();
+
+ conf->setGeneralSaveXmlEnabled(ui->saveXml->isChecked());
+ conf->setGeneralSaveXmlSameDir(ui->sameDir->isChecked());
+ conf->setGeneralSaveXmlCustomDir(ui->customDir->isChecked());
+ conf->setGeneralSaveXmlCustomDirPath(ui->customDirValue->text());
+}
+
+void GeneralOptions::onCustomDirBrowseBtnClicked()
+{
+ QString dir = QFileDialog::getExistingDirectory(0, "Choose a directory");
+
+ if (!dir.isEmpty())
+ ui->customDirValue->setText(dir);
+}
diff --git a/GScribo/Preferences/generaloptions.h b/GScribo/Preferences/generaloptions.h
new file mode 100644
index 0000000..0c07129
--- /dev/null
+++ b/GScribo/Preferences/generaloptions.h
@@ -0,0 +1,34 @@
+#ifndef GENERALOPTIONS_H
+#define GENERALOPTIONS_H
+
+#include <QFileDialog>
+
+#include "optionwidget.h"
+#include "configs.h"
+
+namespace Ui
+{
+ class GeneralOptions;
+}
+
+class GeneralOptions :
+ public OptionWidget
+{
+ Q_OBJECT
+
+ public:
+ explicit GeneralOptions(QWidget *parent = 0);
+ ~GeneralOptions();
+
+ virtual void loadConfig();
+ virtual void saveConfig();
+
+ private:
+ Ui::GeneralOptions *ui;
+
+ private slots:
+ void onCustomDirBrowseBtnClicked();
+
+};
+
+#endif // GENERAL_OPTIONS_H
diff --git a/GScribo/Preferences/ocroptions.cpp b/GScribo/Preferences/ocroptions.cpp
new file mode 100644
index 0000000..b2137bd
--- /dev/null
+++ b/GScribo/Preferences/ocroptions.cpp
@@ -0,0 +1,55 @@
+#include "ocroptions.h"
+#include "ui_ocroptions.h"
+
+using namespace scribo::toolchain::internal;
+
+static const char *language[][2] =
+{
+ { "English", "eng" },
+ { "French", "fra" },
+ { 0, 0 }
+};
+
+OcrOptions::OcrOptions(QWidget *parent) :
+ OptionWidget(parent),
+ ui(new Ui::OcrOptions)
+{
+ ui->setupUi(this);
+
+ for (unsigned i = 0; language[i][0]; ++i)
+ ui->ocr_language->insertItem(i, language[i][0]);
+
+ loadConfig();
+}
+
+OcrOptions::~OcrOptions()
+{
+ delete ui;
+}
+
+int OcrOptions::findIndex(const QString& lang)
+{
+ for (unsigned i = 0; language[i][0]; ++i)
+ if (lang == language[i][1])
+ return i;
+
+ return 0;
+}
+
+
+void OcrOptions::loadConfig()
+{
+ Configs * const conf = Configs::getInstance();
+
+ ui->enable_ocr->setChecked(conf->ocrEnabled());
+ ui->ocr_language->setCurrentIndex(findIndex(conf->ocrLanguage()));
+}
+
+
+void OcrOptions::saveConfig()
+{
+ Configs * const conf = Configs::getInstance();
+
+ conf->setOcrEnabled(ui->enable_ocr->isChecked());
+ conf->setOcrLanguage(language[ui->ocr_language->currentIndex()][1]);
+}
diff --git a/GScribo/Preferences/ocroptions.h b/GScribo/Preferences/ocroptions.h
new file mode 100644
index 0000000..b45fef6
--- /dev/null
+++ b/GScribo/Preferences/ocroptions.h
@@ -0,0 +1,33 @@
+#ifndef OCR_OPTIONS_H
+#define OCR_OPTIONS_H
+
+#include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
+
+#include "optionwidget.h"
+#include "configs.h"
+#include "region.h"
+
+namespace Ui
+{
+ class OcrOptions;
+}
+
+class OcrOptions :
+ public OptionWidget
+{
+ Q_OBJECT
+
+ public:
+ explicit OcrOptions(QWidget *parent = 0);
+ ~OcrOptions();
+
+ void loadConfig();
+ void saveConfig();
+
+ private:
+ int findIndex(const QString& lang);
+
+ Ui::OcrOptions *ui;
+};
+
+#endif // OCR_OPTIONS_H
diff --git a/GScribo/Preferences/optionwidget.cpp b/GScribo/Preferences/optionwidget.cpp
deleted file mode 100644
index 75ee55d..0000000
--- a/GScribo/Preferences/optionwidget.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "optionwidget.h"
-
-OptionWidget::OptionWidget(QWidget * parent) :
- QWidget(parent)
-{
-}
-
-void OptionWidget::saveConfig()
-{
-}
-
-void OptionWidget::loadConfig()
-{
-}
diff --git a/GScribo/Preferences/optionwidget.h b/GScribo/Preferences/optionwidget.h
index ecdb650..e0979d2 100644
--- a/GScribo/Preferences/optionwidget.h
+++ b/GScribo/Preferences/optionwidget.h
@@ -6,10 +6,10 @@
struct OptionWidget :
public QWidget
{
- explicit OptionWidget(QWidget * parent);
+ explicit OptionWidget(QWidget * parent) : QWidget(parent) {}
- virtual void loadConfig();
- virtual void saveConfig();
+ virtual void loadConfig() {}
+ virtual void saveConfig() {}
};
#endif // OPTIONWIDGET_H
diff --git a/GScribo/Preferences/preferencesdialog.cpp
b/GScribo/Preferences/preferencesdialog.cpp
new file mode 100644
index 0000000..6855698
--- /dev/null
+++ b/GScribo/Preferences/preferencesdialog.cpp
@@ -0,0 +1,98 @@
+#include "preferencesdialog.h"
+#include "ui_preferencesdialog.h"
+
+PreferencesDialog::PreferencesDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::PreferencesDialog)
+{
+ ui->setupUi(this);
+
+ // We may want to remove this useless object in the ui file.
+ delete ui->widget;
+
+ connect(ui->optionList, SIGNAL(currentRowChanged(int)), this,
SLOT(onOptionListCurrentRowChanged(int)));
+ setAttribute(Qt::WA_DeleteOnClose);
+
+ loadOptionList();
+ ui->optionList->setCurrentRow(0);
+}
+
+PreferencesDialog::~PreferencesDialog()
+{
+ delete ui;
+}
+
+void PreferencesDialog::loadOptionList()
+{
+ static const char *options[] = { "General", "Preprocessing",
"Segmentation", "OCR", 0 };
+
+ int i;
+ for (i = 0; options[i]; ++i)
+ ui->optionList->insertItem(i, options[i]);
+
+ widgets.fill(0, i);
+}
+
+void PreferencesDialog::selectOptionWidget(int row)
+{
+ if(!widgets[row])
+ {
+ QWidget *widget = 0;
+
+ switch(row)
+ {
+ case 0:
+ widget = new GeneralOptions(this);
+ break;
+
+ case 1:
+ widget = new PreprocessingOptions(this);
+ break;
+
+ case 2:
+ widget = new SegmentationOptions(this);
+ break;
+
+ case 3:
+ widget = new OcrOptions(this);
+ break;
+ }
+
+ if(widget)
+ widgets[row] = widget;
+ }
+
+ if(ui->horizontalLayout_2->count() == 2)
+ {
+ QWidget *current_widget = ui->horizontalLayout_2->itemAt(1)->widget();
+ ui->horizontalLayout_2->removeWidget(current_widget);
+ current_widget->hide();
+ }
+
+ ui->horizontalLayout_2->insertWidget(1, widgets[row]);
+ widgets[row]->show();
+}
+
+
+void PreferencesDialog::accept()
+{
+ for (int i = 0; i < widgets.size(); ++i)
+ {
+ if (widgets[i])
+ {
+ static_cast<OptionWidget *>(widgets[i])->saveConfig();
+ delete widgets[i];
+ }
+ }
+
+ QDialog::accept();
+}
+
+
+void PreferencesDialog::reject()
+{
+ for (int i = 0; i < widgets.size(); ++i)
+ delete widgets[i];
+
+ QDialog::reject();
+}
diff --git a/GScribo/Preferences/preferencesdialog.h
b/GScribo/Preferences/preferencesdialog.h
new file mode 100644
index 0000000..b0b9b61
--- /dev/null
+++ b/GScribo/Preferences/preferencesdialog.h
@@ -0,0 +1,42 @@
+#ifndef PREFERENCESDIALOG_H
+#define PREFERENCESDIALOG_H
+
+#include <QDialog>
+
+#include "preprocessingoptions.h"
+#include "segmentationoptions.h"
+#include "generaloptions.h"
+#include "ocroptions.h"
+
+namespace Ui
+{
+ class PreferencesDialog;
+}
+
+class PreferencesDialog :
+ public QDialog
+{
+ Q_OBJECT
+
+ public:
+ explicit PreferencesDialog(QWidget *parent = 0);
+ ~PreferencesDialog();
+
+ private:
+ void loadOptionList();
+ void selectOptionWidget(int row);
+
+ Ui::PreferencesDialog *ui;
+ QVector<QWidget *> widgets;
+
+ private slots:
+ inline void onOptionListCurrentRowChanged(int row);
+ virtual void accept();
+ virtual void reject();
+
+};
+
+inline void PreferencesDialog::onOptionListCurrentRowChanged(int row)
+{ selectOptionWidget(row); }
+
+#endif // PREFERENCESDIALOG_H
diff --git a/GScribo/Preferences/preprocessingoptions.h
b/GScribo/Preferences/preprocessingoptions.h
new file mode 100644
index 0000000..6cc0081
--- /dev/null
+++ b/GScribo/Preferences/preprocessingoptions.h
@@ -0,0 +1,32 @@
+#ifndef PREPROCESSINGOPTIONS_H
+#define PREPROCESSINGOPTIONS_H
+
+#include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
+
+#include "optionwidget.h"
+#include "region.h"
+#include "configs.h"
+
+namespace Ui
+{
+ class PreprocessingOptions;
+}
+
+class PreprocessingOptions :
+ public OptionWidget
+{
+ Q_OBJECT
+
+ public:
+ explicit PreprocessingOptions(QWidget *parent = 0);
+ ~PreprocessingOptions();
+
+ void loadConfig();
+ void saveConfig();
+
+ private:
+ Ui::PreprocessingOptions *ui;
+
+};
+
+#endif // PREPROCESSINGOPTIONS_H
diff --git a/GScribo/Preferences/segmentationoptions.cpp
b/GScribo/Preferences/segmentationoptions.cpp
new file mode 100644
index 0000000..21059cd
--- /dev/null
+++ b/GScribo/Preferences/segmentationoptions.cpp
@@ -0,0 +1,35 @@
+#include "segmentationoptions.h"
+#include "ui_segmentationoptions.h"
+
+using namespace scribo::toolchain::internal;
+
+SegmentationOptions::SegmentationOptions(QWidget *parent) :
+ OptionWidget(parent),
+ ui(new Ui::SegmentationOptions)
+{
+ ui->setupUi(this);
+
+ ui->find_sepsCbox->insertItem(Separator::Lines, "Lines");
+ ui->find_sepsCbox->insertItem(Separator::Whitespaces,
"Whitespaces");
+ ui->find_sepsCbox->insertItem(Separator::Both, "Lines and
whitespaces");
+
+ loadConfig();
+}
+
+SegmentationOptions::~SegmentationOptions()
+{
+ delete ui;
+}
+
+void SegmentationOptions::loadConfig()
+{
+ Configs *const conf = Configs::getInstance();
+ ui->find_sepsCbox->setCurrentIndex(conf->segmentationFindSeps());
+}
+
+
+void SegmentationOptions::saveConfig()
+{
+ Configs *const conf = Configs::getInstance();
+ conf->setSegmentationFindSeps(ui->find_sepsCbox->currentIndex());
+}
diff --git a/GScribo/Preferences/segmentationoptions.h
b/GScribo/Preferences/segmentationoptions.h
new file mode 100644
index 0000000..8003397
--- /dev/null
+++ b/GScribo/Preferences/segmentationoptions.h
@@ -0,0 +1,31 @@
+#ifndef SEGMENTATIONOPTIONS_H
+#define SEGMENTATIONOPTIONS_H
+
+#include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
+
+#include "optionwidget.h"
+#include "configs.h"
+#include "region.h"
+
+namespace Ui
+{
+ class SegmentationOptions;
+}
+
+class SegmentationOptions :
+ public OptionWidget
+{
+ Q_OBJECT
+
+ public:
+ explicit SegmentationOptions(QWidget *parent = 0);
+ ~SegmentationOptions();
+
+ void loadConfig();
+ void saveConfig();
+
+ private:
+ Ui::SegmentationOptions *ui;
+};
+
+#endif // SEGMENTATIONOPTIONS_H
diff --git a/GScribo/configs.cpp b/GScribo/configs.cpp
deleted file mode 100644
index 56282d3..0000000
--- a/GScribo/configs.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-#include "configs.h"
-
-Configs::Configs()
- : QSettings("Olena-Scribo", "viewer")
-{
-}
-
-Configs * Configs::getInstance()
-{
- static Configs *conf = new Configs();
- return conf;
-}
-
-// Preprocessing configs.
-bool Configs::preprocessingSubsample()
-{
- return value("preprocessing/subsample", false).toBool();
-}
-
-void Configs::setPreprocessingSubsample(bool b)
-{
- setValue("preprocessing/subsample", b);
-}
-
-
-
-bool Configs::preprocessingRemoveBg()
-{
- return value("preprocessing/remove_bg", false).toBool();
-}
-
-void Configs::setPreprocessingRemoveBg(bool b)
-{
- setValue("preprocessing/remove_bg", b);
-}
-
-
-
-bool Configs::preprocessingDeskew()
-{
- return value("preprocessing/deskew", false).toBool();
-}
-
-void Configs::setPreprocessingDeskew(bool b)
-{
- setValue("preprocessing/deskew", b);
-}
-
-
-
-bool Configs::preprocessingRemoveNoise()
-{
- return value("preprocessing/remove_noise", true).toBool();
-}
-
-void Configs::setPreprocessingRemoveNoise(bool b)
-{
- setValue("preprocessing/remove_noise", b);
-}
-
-
-
-int Configs::preprocessingBinAlgo()
-{
- return value("preprocessing/bin_algo",
scribo::toolchain::internal::SauvolaMs).toInt();
-}
-
-void Configs::setPreprocessingBinAlgo(int algo)
-{
- setValue("preprocessing/bin_algo", algo);
-}
-
-
-
-
-
-// Segmentation configs.
-int Configs::segmentationFindSeps()
-{
- return value("segmentation/find_seps", Separator::Both).toInt();
-}
-
-void Configs::setSegmentationFindSeps(int seps)
-{
- setValue("segmentation/find_seps", seps);
-}
-
-
-
-
-
-// OCR configs.
-bool Configs::ocrEnabled()
-{
- return value("ocr/enabled", true).toBool();
-}
-
-void Configs::setOcrEnabled(bool b)
-{
- setValue("ocr/enabled", b);
-}
-
-
-
-QString Configs::ocrLanguage()
-{
- return value("ocr/language", 0).toString();
-}
-
-void Configs::setOcrLanguage(const QString &lang)
-{
- setValue("ocr/language", lang);
-}
-
-
-
-
-
-// OCR configs.
-bool Configs::generalSaveXmlEnabled()
-{
- return value("general/save_xml/enabled", true).toBool();
-}
-
-void Configs::setGeneralSaveXmlEnabled(bool b)
-{
- setValue("general/save_xml/enabled", b);
-}
-
-
-
-bool Configs::generalSaveXmlSameDir()
-{
- return value("general/save_xml/same_dir", true).toBool();
-}
-
-void Configs::setGeneralSaveXmlSameDir(bool b)
-{
- setValue("general/save_xml/same_dir", b);
-}
-
-
-
-bool Configs::generalSaveXmlCustomDir()
-{
- return value("general/save_xml/custom_dir", false).toBool();
-}
-
-void Configs::setGeneralSaveXmlCustomDir(bool b)
-{
- setValue("general/save_xml/custom_dir", b);
-}
-
-
-
-QString Configs::generalSaveXmlCustomDirPath()
-{
- return value("general/save_xml/custom_dir_path",
QDir::tempPath()).toString();
-}
-
-void Configs::setGeneralSaveXmlCustomDirPath(const QString &path)
-{
- setValue("general/save_xml/custom_dir_path", path);
-}
diff --git a/GScribo/configs.h b/GScribo/configs.h
index aff4889..594650f 100644
--- a/GScribo/configs.h
+++ b/GScribo/configs.h
@@ -11,32 +11,118 @@ class Configs :
public QSettings
{
public:
- Configs();
- static Configs * getInstance();
- bool preprocessingSubsample();
- void setPreprocessingSubsample(bool b);
- bool preprocessingRemoveBg();
- void setPreprocessingRemoveBg(bool b);
- bool preprocessingDeskew();
- void setPreprocessingDeskew(bool b);
- bool preprocessingRemoveNoise();
- void setPreprocessingRemoveNoise(bool b);
- int preprocessingBinAlgo();
- void setPreprocessingBinAlgo(int algo);
- int segmentationFindSeps();
- void setSegmentationFindSeps(int seps);
- bool ocrEnabled();
- void setOcrEnabled(bool b);
- QString ocrLanguage();
- void setOcrLanguage(const QString& lang);
- bool generalSaveXmlEnabled();
- void setGeneralSaveXmlEnabled(bool b);
- bool generalSaveXmlSameDir();
- void setGeneralSaveXmlSameDir(bool b);
- bool generalSaveXmlCustomDir();
- void setGeneralSaveXmlCustomDir(bool b);
- QString generalSaveXmlCustomDirPath();
- void setGeneralSaveXmlCustomDirPath(const QString& path);
+ Configs() : QSettings("olena-scribo", "gui") {}
+
+ static Configs * getInstance()
+ { static Configs *conf = new Configs(); return conf; }
+
+ inline bool preprocessingSubsample();
+ inline void setPreprocessingSubsample(bool b);
+
+ inline bool preprocessingRemoveBg();
+ inline void setPreprocessingRemoveBg(bool b);
+
+ inline bool preprocessingDeskew();
+ inline void setPreprocessingDeskew(bool b);
+
+ inline bool preprocessingRemoveNoise();
+ inline void setPreprocessingRemoveNoise(bool b);
+
+ inline int preprocessingBinAlgo();
+ inline void setPreprocessingBinAlgo(int algo);
+
+ inline int segmentationFindSeps();
+ inline void setSegmentationFindSeps(int seps);
+
+ inline bool ocrEnabled();
+ inline void setOcrEnabled(bool b);
+
+ inline QString ocrLanguage();
+ inline void setOcrLanguage(const QString& lang);
+
+ inline bool generalSaveXmlEnabled();
+ inline void setGeneralSaveXmlEnabled(bool b);
+
+ inline bool generalSaveXmlSameDir();
+ inline void setGeneralSaveXmlSameDir(bool b);
+
+ inline bool generalSaveXmlCustomDir();
+ inline void setGeneralSaveXmlCustomDir(bool b);
+
+ inline QString generalSaveXmlCustomDirPath();
+ inline void setGeneralSaveXmlCustomDirPath(const QString& path);
};
+inline bool Configs::preprocessingSubsample()
+{ return value("preprocessing/subsample", false).toBool(); }
+
+inline void Configs::setPreprocessingSubsample(bool b)
+{ setValue("preprocessing/subsample", b); }
+
+inline bool Configs::preprocessingRemoveBg()
+{ return value("preprocessing/remove_bg", false).toBool(); }
+
+inline void Configs::setPreprocessingRemoveBg(bool b)
+{ setValue("preprocessing/remove_bg", b); }
+
+inline bool Configs::preprocessingDeskew()
+{ return value("preprocessing/deskew", false).toBool(); }
+
+inline void Configs::setPreprocessingDeskew(bool b)
+{ setValue("preprocessing/deskew", b); }
+
+inline bool Configs::preprocessingRemoveNoise()
+{ return value("preprocessing/remove_noise", true).toBool(); }
+
+inline void Configs::setPreprocessingRemoveNoise(bool b)
+{ setValue("preprocessing/remove_noise", b); }
+
+inline int Configs::preprocessingBinAlgo()
+{ return value("preprocessing/bin_algo",
scribo::toolchain::internal::SauvolaMs).toInt(); }
+
+inline void Configs::setPreprocessingBinAlgo(int algo)
+{ setValue("preprocessing/bin_algo", algo); }
+
+inline int Configs::segmentationFindSeps()
+{ return value("segmentation/find_seps", Separator::Both).toInt(); }
+
+inline void Configs::setSegmentationFindSeps(int seps)
+{ setValue("segmentation/find_seps", seps); }
+
+inline bool Configs::ocrEnabled()
+{ return value("ocr/enabled", true).toBool(); }
+
+inline void Configs::setOcrEnabled(bool b)
+{ setValue("ocr/enabled", b); }
+
+inline QString Configs::ocrLanguage()
+{ return value("ocr/language", 0).toString(); }
+
+inline void Configs::setOcrLanguage(const QString& lang)
+{ setValue("ocr/language", lang); }
+
+inline bool Configs::generalSaveXmlEnabled()
+{ return value("general/save_xml/enabled", true).toBool(); }
+
+inline void Configs::setGeneralSaveXmlEnabled(bool b)
+{ setValue("general/save_xml/enabled", b); }
+
+inline bool Configs::generalSaveXmlSameDir()
+{ return value("general/save_xml/same_dir", true).toBool(); }
+
+inline void Configs::setGeneralSaveXmlSameDir(bool b)
+{ setValue("general/save_xml/same_dir", b); }
+
+inline bool Configs::generalSaveXmlCustomDir()
+{ return value("general/save_xml/custom_dir", false).toBool(); }
+
+inline void Configs::setGeneralSaveXmlCustomDir(bool b)
+{ setValue("general/save_xml/custom_dir", b); }
+
+inline QString Configs::generalSaveXmlCustomDirPath()
+{ return value("general/save_xml/custom_dir_path",
QDir::tempPath()).toString(); }
+
+inline void Configs::setGeneralSaveXmlCustomDirPath(const QString& path)
+{ setValue("general/save_xml/custom_dir_path", path); }
+
#endif // CONFIGS_H
--
1.7.2.5