* demo/viewer/README,
* demo/viewer/browser_widget.cc,
* demo/viewer/browser_widget.hh,
* demo/viewer/common.hh,
* demo/viewer/help_dialog.cc,
* demo/viewer/help_dialog.hh,
* demo/viewer/image_region.cc,
* demo/viewer/image_region.hh,
* demo/viewer/image_region.hxx,
* demo/viewer/image_scene.cc,
* demo/viewer/image_scene.hh,
* demo/viewer/image_view.cc,
* demo/viewer/image_view.hh,
* demo/viewer/image_widget.cc,
* demo/viewer/image_widget.hh,
* demo/viewer/key_widget.cc,
* demo/viewer/key_widget.hh,
* demo/viewer/main.cc,
* demo/viewer/xml_widget.cc,
* demo/viewer/xml_widget.hh: Here.
---
scribo/ChangeLog | 25 +++++++++++++++++++++++++
scribo/demo/viewer/README | 9 ---------
scribo/demo/viewer/browser_widget.cc | 9 ---------
scribo/demo/viewer/browser_widget.hh | 17 ++++-------------
scribo/demo/viewer/common.hh | 17 ++++-------------
scribo/demo/viewer/help_dialog.cc | 9 ---------
scribo/demo/viewer/help_dialog.hh | 15 +++------------
scribo/demo/viewer/image_region.cc | 9 ---------
scribo/demo/viewer/image_region.hh | 15 +++------------
scribo/demo/viewer/image_region.hxx | 34 +++++++++++++++++++++++-----------
scribo/demo/viewer/image_scene.cc | 10 +---------
scribo/demo/viewer/image_scene.hh | 18 ++++--------------
scribo/demo/viewer/image_view.cc | 9 ---------
scribo/demo/viewer/image_view.hh | 17 ++++-------------
scribo/demo/viewer/image_widget.cc | 9 ---------
scribo/demo/viewer/image_widget.hh | 17 ++++-------------
scribo/demo/viewer/key_widget.cc | 9 ---------
scribo/demo/viewer/key_widget.hh | 15 +++------------
scribo/demo/viewer/main.cc | 14 +++++---------
scribo/demo/viewer/xml_widget.cc | 9 ---------
scribo/demo/viewer/xml_widget.hh | 17 ++++-------------
21 files changed, 87 insertions(+), 216 deletions(-)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 7829717..f12eb4f 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,30 @@
2010-12-10 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Fix guards and license.
+
+ * demo/viewer/README,
+ * demo/viewer/browser_widget.cc,
+ * demo/viewer/browser_widget.hh,
+ * demo/viewer/common.hh,
+ * demo/viewer/help_dialog.cc,
+ * demo/viewer/help_dialog.hh,
+ * demo/viewer/image_region.cc,
+ * demo/viewer/image_region.hh,
+ * demo/viewer/image_region.hxx,
+ * demo/viewer/image_scene.cc,
+ * demo/viewer/image_scene.hh,
+ * demo/viewer/image_view.cc,
+ * demo/viewer/image_view.hh,
+ * demo/viewer/image_widget.cc,
+ * demo/viewer/image_widget.hh,
+ * demo/viewer/key_widget.cc,
+ * demo/viewer/key_widget.hh,
+ * demo/viewer/main.cc,
+ * demo/viewer/xml_widget.cc,
+ * demo/viewer/xml_widget.hh: Here.
+
+2010-12-10 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add configuration widgets in Scribo viewer.
* demo/viewer/config.cc,
diff --git a/scribo/demo/viewer/README b/scribo/demo/viewer/README
index fa37cd6..31c66aa 100644
--- a/scribo/demo/viewer/README
+++ b/scribo/demo/viewer/README
@@ -14,15 +14,6 @@ General Public License for more details.
You should have received a copy of the GNU General Public License
along with Olena. If not, see <http:www.gnu.org/licenses/>.
-As a special exception, you may use this file as part of a free
-software project without restriction. Specifically, if other files
-instantiate templates or use macros or inline functions from this
-file, or you compile this file and link it with other files to produce
-an executable, this file does not by itself cause the resulting
-executable to be covered by the GNU General Public License. This
-exception does not however invalidate any other reasons why the
-executable file might be covered by the GNU General Public License.
-
__________________________________________________________________
diff --git a/scribo/demo/viewer/browser_widget.cc b/scribo/demo/viewer/browser_widget.cc
index 7e01789..5a67d1e 100644
--- a/scribo/demo/viewer/browser_widget.cc
+++ b/scribo/demo/viewer/browser_widget.cc
@@ -13,15 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
#include "browser_widget.hh"
diff --git a/scribo/demo/viewer/browser_widget.hh b/scribo/demo/viewer/browser_widget.hh
index 964dc47..bbed1ac 100644
--- a/scribo/demo/viewer/browser_widget.hh
+++ b/scribo/demo/viewer/browser_widget.hh
@@ -13,18 +13,9 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-#ifndef BROWSER_WIDGET_HH_
-# define BROWSER_WIDGET_HH_
+
+#ifndef SCRIBO_DEMO_VIEWER_BROWSER_WIDGET_HH
+# define SCRIBO_DEMO_VIEWER_BROWSER_WIDGET_HH
# include <QtGui>
@@ -54,4 +45,4 @@ private:
bool first_time_;
};
-#endif /* !BROWSER_WIDGET_HH_ */
+#endif // ! SCRIBO_DEMO_VIEWER_BROWSER_WIDGET_HH
diff --git a/scribo/demo/viewer/common.hh b/scribo/demo/viewer/common.hh
index 4dee676..7f67f82 100644
--- a/scribo/demo/viewer/common.hh
+++ b/scribo/demo/viewer/common.hh
@@ -13,18 +13,9 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-#ifndef COMMON_HH_
-# define COMMON_HH_
+#ifndef SCRIBO_DEMO_VIEWER_COMMON_HH
+# define SCRIBO_DEMO_VIEWER_COMMON_HH
namespace region
{
@@ -35,7 +26,7 @@ namespace region
Text = 0,
Paragraph,
Line,
- Image,
+ Image,
Noise,
Separator,
Table,
@@ -46,4 +37,4 @@ namespace region
};
}
-#endif /* !COMMON_HH_ */
+#endif // ! SCRIBO_DEMO_VIEWER_COMMON_HH
diff --git a/scribo/demo/viewer/help_dialog.cc b/scribo/demo/viewer/help_dialog.cc
index 836413a..1f4a775 100644
--- a/scribo/demo/viewer/help_dialog.cc
+++ b/scribo/demo/viewer/help_dialog.cc
@@ -13,15 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
#include "help_dialog.hh"
diff --git a/scribo/demo/viewer/help_dialog.hh b/scribo/demo/viewer/help_dialog.hh
index 2b4adcf..41be95d 100644
--- a/scribo/demo/viewer/help_dialog.hh
+++ b/scribo/demo/viewer/help_dialog.hh
@@ -13,18 +13,9 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-#ifndef HELP_DIALOG_HH_
-# define HELP_DIALOG_HH_
+#ifndef SCRIBO_DEMO_VIEWER_HELP_DIALOG_HH
+# define SCRIBO_DEMO_VIEWER_HELP_DIALOG_HH
# include <QtGui>
@@ -40,4 +31,4 @@ public slots:
void done();
};
-#endif /* !HELP_DIALOG_HH_ */
+#endif // ! SCRIBO_DEMO_VIEWER_HELP_DIALOG_HH
diff --git a/scribo/demo/viewer/image_region.cc b/scribo/demo/viewer/image_region.cc
index 037ed56..19ca872 100644
--- a/scribo/demo/viewer/image_region.cc
+++ b/scribo/demo/viewer/image_region.cc
@@ -13,15 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
#include "image_region.hh"
diff --git a/scribo/demo/viewer/image_region.hh b/scribo/demo/viewer/image_region.hh
index a492b44..41141f7 100644
--- a/scribo/demo/viewer/image_region.hh
+++ b/scribo/demo/viewer/image_region.hh
@@ -13,18 +13,9 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-#ifndef IMAGE_REGION_HH_
-# define IMAGE_REGION_HH_
+#ifndef SCRIBO_DEMO_VIEWER_IMAGE_REGION_HH
+# define SCRIBO_DEMO_VIEWER_IMAGE_REGION_HH
# include <QtGui>
# include "common.hh"
@@ -85,4 +76,4 @@ private:
#include "image_region.hxx"
-#endif /* !IMAGE_REGION_HH_ */
+#endif // ! SCRIBO_DEMO_VIEWER_IMAGE_REGION_HH
diff --git a/scribo/demo/viewer/image_region.hxx b/scribo/demo/viewer/image_region.hxx
index 0d23426..5ddd7de 100644
--- a/scribo/demo/viewer/image_region.hxx
+++ b/scribo/demo/viewer/image_region.hxx
@@ -1,19 +1,31 @@
+// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
+// (LRDE)
//
-// Document layout viewer.
+// This file is part of Olena.
//
-// Copyright (C) 2009 Florent D'Halluin.
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
//
-// The complete GNU General Public Licence Notice can be found as the
-// `COPYING' file in the root directory.
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
-#ifndef IMAGE_REGION_HXX_
-# define IMAGE_REGION_HXX_
+#ifndef IMAGE_REGION_HXX_
+# define IMAGE_REGION_HXX_
# include "image_region.hh"
@@ -91,4 +103,4 @@ ImageRegion::shape() const
return shape_;
}
-#endif /* !IMAGE_REGION_HXX_ */
+#endif /* !IMAGE_REGION_HXX_ */
diff --git a/scribo/demo/viewer/image_scene.cc b/scribo/demo/viewer/image_scene.cc
index 850647f..2c56113 100644
--- a/scribo/demo/viewer/image_scene.cc
+++ b/scribo/demo/viewer/image_scene.cc
@@ -13,15 +13,7 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
+
#include "image_scene.hh"
#include "image_region.hh"
diff --git a/scribo/demo/viewer/image_scene.hh b/scribo/demo/viewer/image_scene.hh
index 4c417b0..136f1a2 100644
--- a/scribo/demo/viewer/image_scene.hh
+++ b/scribo/demo/viewer/image_scene.hh
@@ -1,4 +1,3 @@
-
// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
@@ -14,18 +13,9 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-#ifndef IMAGE_SCENE_HH_
-# define IMAGE_SCENE_HH_
+
+#ifndef SCRIBO_DEMO_VIEWER_IMAGE_SCENE_HH
+# define SCRIBO_DEMO_VIEWER_IMAGE_SCENE_HH
# include <QtGui>
@@ -52,4 +42,4 @@ private:
QVector<ImageRegion*> region_vector_;
};
-#endif /* !IMAGE_SCENE_HH_ */
+#endif // ! SCRIBO_DEMO_VIEWER_IMAGE_SCENE_HH
diff --git a/scribo/demo/viewer/image_view.cc b/scribo/demo/viewer/image_view.cc
index 05a85e8..bb34eb7 100644
--- a/scribo/demo/viewer/image_view.cc
+++ b/scribo/demo/viewer/image_view.cc
@@ -13,15 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
#include "image_view.hh"
diff --git a/scribo/demo/viewer/image_view.hh b/scribo/demo/viewer/image_view.hh
index ab48a36..622999b 100644
--- a/scribo/demo/viewer/image_view.hh
+++ b/scribo/demo/viewer/image_view.hh
@@ -13,18 +13,9 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-#ifndef IMAGE_VIEW_HH_
-# define IMAGE_VIEW_HH_
+
+#ifndef SCRIBO_DEMO_VIEWER_IMAGE_VIEW_HH
+# define SCRIBO_DEMO_VIEWER_IMAGE_VIEW_HH
# include <QtGui>
@@ -48,4 +39,4 @@ signals:
void scaleUpdated(qreal scale);
};
-#endif /* !IMAGE_VIEW_HH_ */
+#endif // ! SCRIBO_DEMO_VIEWER_IMAGE_VIEW_HH
diff --git a/scribo/demo/viewer/image_widget.cc b/scribo/demo/viewer/image_widget.cc
index 3e3f241..e9e5e79 100644
--- a/scribo/demo/viewer/image_widget.cc
+++ b/scribo/demo/viewer/image_widget.cc
@@ -13,15 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
#include "image_widget.hh"
#include "image_view.hh"
diff --git a/scribo/demo/viewer/image_widget.hh b/scribo/demo/viewer/image_widget.hh
index a3f51e4..826b873 100644
--- a/scribo/demo/viewer/image_widget.hh
+++ b/scribo/demo/viewer/image_widget.hh
@@ -13,18 +13,9 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-#ifndef IMAGE_WIDGET_HH_
-# define IMAGE_WIDGET_HH_
+
+#ifndef SCRIBO_DEMO_VIEWER_IMAGE_WIDGET_HH
+# define SCRIBO_DEMO_VIEWER_IMAGE_WIDGET_HH
# include <QtGui>
@@ -49,4 +40,4 @@ private:
ImageView* view_;
};
-#endif /* !IMAGE_WIDGET_HH_ */
+#endif // ! SCRIBO_DEMO_VIEWER_IMAGE_WIDGET_HH
diff --git a/scribo/demo/viewer/key_widget.cc b/scribo/demo/viewer/key_widget.cc
index f567992..47cfbcf 100644
--- a/scribo/demo/viewer/key_widget.cc
+++ b/scribo/demo/viewer/key_widget.cc
@@ -13,15 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
#include "key_widget.hh"
#include "common.hh"
diff --git a/scribo/demo/viewer/key_widget.hh b/scribo/demo/viewer/key_widget.hh
index d261ec6..fd0b514 100644
--- a/scribo/demo/viewer/key_widget.hh
+++ b/scribo/demo/viewer/key_widget.hh
@@ -13,18 +13,9 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-#ifndef KEY_WIDGET_HH_
-# define KEY_WIDGET_HH_
+#ifndef SCRIBO_DEMO_VIEWER_KEY_WIDGET_HH
+# define SCRIBO_DEMO_VIEWER_KEY_WIDGET_HH
# include <QtGui>
# include "common.hh"
@@ -61,4 +52,4 @@ private:
QTreeWidgetItem* regions_;
};
-#endif /* !KEY_WIDGET_HH_ */
+#endif // ! SCRIBO_DEMO_VIEWER_KEY_WIDGET_HH
diff --git a/scribo/demo/viewer/main.cc b/scribo/demo/viewer/main.cc
index b55ad84..76d4494 100644
--- a/scribo/demo/viewer/main.cc
+++ b/scribo/demo/viewer/main.cc
@@ -13,20 +13,16 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
#include <QtGui>
#include <iostream>
+#undef MLN_WO_GLOBAL_VARS
#include "viewer.hh"
+#include <mln/labeling/colorize.hh>
+#include <mln/math/pi.hh>
+#include <mln/io/magick/load.hh>
+#include <scribo/make/debug_filename.hh>
int main(int argc, char** argv)
{
diff --git a/scribo/demo/viewer/xml_widget.cc b/scribo/demo/viewer/xml_widget.cc
index 2d10bd7..df68960 100644
--- a/scribo/demo/viewer/xml_widget.cc
+++ b/scribo/demo/viewer/xml_widget.cc
@@ -13,15 +13,6 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
#include "xml_widget.hh"
diff --git a/scribo/demo/viewer/xml_widget.hh b/scribo/demo/viewer/xml_widget.hh
index b80835b..b7cd868 100644
--- a/scribo/demo/viewer/xml_widget.hh
+++ b/scribo/demo/viewer/xml_widget.hh
@@ -13,18 +13,9 @@
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
-//
-// As a special exception, you may use this file as part of a free
-// software project without restriction. Specifically, if other files
-// instantiate templates or use macros or inline functions from this
-// file, or you compile this file and link it with other files to produce
-// an executable, this file does not by itself cause the resulting
-// executable to be covered by the GNU General Public License. This
-// exception does not however invalidate any other reasons why the
-// executable file might be covered by the GNU General Public License.
-
-#ifndef XML_WIDGET_HH_
-# define XML_WIDGET_HH_
+
+#ifndef SCRIBO_DEMO_VIEWER_XML_WIDGET_HH
+# define SCRIBO_DEMO_VIEWER_XML_WIDGET_HH
# include <QtGui>
# include <QDomNode>
@@ -54,4 +45,4 @@ private:
QMap<QTreeWidgetItem*, QDomNode> node_map_;
};
-#endif /* !XML_WIDGET_HH_ */
+#endif // ! SCRIBO_DEMO_VIEWER_XML_WIDGET_HH
--
1.5.6.5
* demo/viewer/config.cc,
* demo/viewer/config.hh,
* demo/viewer/defs.hh,
* demo/viewer/general_options.cc,
* demo/viewer/general_options.hh,
* demo/viewer/general_options.ui,
* demo/viewer/option_widget.cc,
* demo/viewer/option_widget.hh,
* demo/viewer/preferences_dialog.cc,
* demo/viewer/preferences_dialog.hh,
* demo/viewer/preferences_dialog.ui,
* demo/viewer/toolchain_options.cc,
* demo/viewer/toolchain_options.hh,
* demo/viewer/toolchain_options.ui: New.
---
scribo/ChangeLog | 19 ++++
scribo/demo/viewer/config.cc | 156 ++++++++++++++++++++++++++++++
scribo/demo/viewer/config.hh | 69 +++++++++++++
scribo/demo/viewer/defs.hh | 31 ++++++
scribo/demo/viewer/general_options.cc | 60 ++++++++++++
scribo/demo/viewer/general_options.hh | 40 ++++++++
scribo/demo/viewer/general_options.ui | 100 +++++++++++++++++++
scribo/demo/viewer/option_widget.cc | 30 ++++++
scribo/demo/viewer/option_widget.hh | 30 ++++++
scribo/demo/viewer/preferences_dialog.cc | 113 +++++++++++++++++++++
scribo/demo/viewer/preferences_dialog.hh | 45 +++++++++
scribo/demo/viewer/preferences_dialog.ui | 121 +++++++++++++++++++++++
scribo/demo/viewer/toolchain_options.cc | 75 ++++++++++++++
scribo/demo/viewer/toolchain_options.hh | 37 +++++++
scribo/demo/viewer/toolchain_options.ui | 121 +++++++++++++++++++++++
15 files changed, 1047 insertions(+), 0 deletions(-)
create mode 100644 scribo/demo/viewer/config.cc
create mode 100644 scribo/demo/viewer/config.hh
create mode 100644 scribo/demo/viewer/defs.hh
create mode 100644 scribo/demo/viewer/general_options.cc
create mode 100644 scribo/demo/viewer/general_options.hh
create mode 100644 scribo/demo/viewer/general_options.ui
create mode 100644 scribo/demo/viewer/option_widget.cc
create mode 100644 scribo/demo/viewer/option_widget.hh
create mode 100644 scribo/demo/viewer/preferences_dialog.cc
create mode 100644 scribo/demo/viewer/preferences_dialog.hh
create mode 100644 scribo/demo/viewer/preferences_dialog.ui
create mode 100644 scribo/demo/viewer/toolchain_options.cc
create mode 100644 scribo/demo/viewer/toolchain_options.hh
create mode 100644 scribo/demo/viewer/toolchain_options.ui
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index e730400..7829717 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,24 @@
2010-12-10 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add configuration widgets in Scribo viewer.
+
+ * demo/viewer/config.cc,
+ * demo/viewer/config.hh,
+ * demo/viewer/defs.hh,
+ * demo/viewer/general_options.cc,
+ * demo/viewer/general_options.hh,
+ * demo/viewer/general_options.ui,
+ * demo/viewer/option_widget.cc,
+ * demo/viewer/option_widget.hh,
+ * demo/viewer/preferences_dialog.cc,
+ * demo/viewer/preferences_dialog.hh,
+ * demo/viewer/preferences_dialog.ui,
+ * demo/viewer/toolchain_options.cc,
+ * demo/viewer/toolchain_options.hh,
+ * demo/viewer/toolchain_options.ui: New.
+
+2010-12-10 Guillaume Lazzara <z(a)lrde.epita.fr>
+
* src/scribo-cli.in: Add a call to xml2doc.
2010-12-10 Guillaume Lazzara <z(a)lrde.epita.fr>
diff --git a/scribo/demo/viewer/config.cc b/scribo/demo/viewer/config.cc
new file mode 100644
index 0000000..bf12e95
--- /dev/null
+++ b/scribo/demo/viewer/config.cc
@@ -0,0 +1,156 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#include <QDir>
+
+#include "config.hh"
+#include "defs.hh"
+
+// Defines enum of binarization algorithms
+# include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
+
+
+config::config()
+ : QSettings("Olena-Scribo", "viewer")
+{
+
+}
+
+config* config::get_instance()
+{
+ static config * conf = new config();
+ return conf;
+}
+
+
+// Preprocessing
+
+bool config::preprocessing_subsample()
+{
+ return value("preprocessing/subsample", false).toBool();
+}
+
+void config::set_preprocessing_subsample(bool b)
+{
+ setValue("preprocessing/subsample", b);
+}
+
+
+bool config::preprocessing_remove_bg()
+{
+ return value("preprocessing/remove_bg", false).toBool();
+}
+
+void config::set_preprocessing_remove_bg(bool b)
+{
+ setValue("preprocessing/remove_bg", b);
+}
+
+
+bool config::preprocessing_deskew()
+{
+ return value("preprocessing/deskew", false).toBool();
+}
+
+void config::set_preprocessing_deskew(bool b)
+{
+ setValue("preprocessing/deskew", b);
+}
+
+
+bool config::preprocessing_remove_noise()
+{
+ return value("preprocessing/remove_noise", true).toBool();
+}
+
+void config::set_preprocessing_remove_noise(bool b)
+{
+ setValue("preprocessing/remove_noise", b);
+}
+
+
+int config::preprocessing_bin_algo()
+{
+ return value("preprocessing/bin_algo",
+ scribo::toolchain::internal::SauvolaMs).toInt();
+}
+
+void config::set_preprocessing_bin_algo(int algo)
+{
+ setValue("preprocessing/bin_algo", algo);
+}
+
+
+
+// Segmentation
+
+int config::segmentation_find_seps()
+{
+ return value("segmentation/find_seps", defs::LinesAndWhitespaces).toInt();
+}
+
+void config::set_segmentation_find_seps(int seps)
+{
+ setValue("segmentation/find_seps", seps);
+}
+
+
+
+// General options
+
+bool config::general_save_xml_enabled()
+{
+ return value("general/save_xml/enabled", true).toBool();
+}
+
+void config::set_general_save_xml_enabled(bool b)
+{
+ setValue("general/save_xml/enabled", b);
+}
+
+
+bool config::general_save_xml_same_dir()
+{
+ return value("general/save_xml/same_dir", true).toBool();
+}
+
+void config::set_general_save_xml_same_dir(bool b)
+{
+ setValue("general/save_xml/same_dir", b);
+}
+
+
+bool config::general_save_xml_custom_dir()
+{
+ return value("general/save_xml/custom_dir", false).toBool();
+}
+
+void config::set_general_save_xml_custom_dir(bool b)
+{
+ setValue("general/save_xml/custom_dir", b);
+}
+
+
+QString config::general_save_xml_custom_dir_path()
+{
+ return value("general/save_xml/custom_dir_path", QDir::tempPath()).toString();
+}
+
+void config::set_general_save_xml_custom_dir_path(const QString& path)
+{
+ setValue("general/save_xml/custom_dir_path", path);
+}
+
diff --git a/scribo/demo/viewer/config.hh b/scribo/demo/viewer/config.hh
new file mode 100644
index 0000000..07d193c
--- /dev/null
+++ b/scribo/demo/viewer/config.hh
@@ -0,0 +1,69 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef SCRIBO_DEMO_VIEWER_CONFIG_HH
+# define SCRIBO_DEMO_VIEWER_CONFIG_HH
+
+# include <QSettings>
+
+class config : public QSettings
+{
+public:
+
+ config();
+
+ static config* get_instance();
+
+ // Preprocessing
+ bool preprocessing_subsample();
+ void set_preprocessing_subsample(bool b);
+
+ bool preprocessing_remove_bg();
+ void set_preprocessing_remove_bg(bool b);
+
+ bool preprocessing_deskew();
+ void set_preprocessing_deskew(bool b);
+
+ bool preprocessing_remove_noise();
+ void set_preprocessing_remove_noise(bool b);
+
+ int preprocessing_bin_algo();
+ void set_preprocessing_bin_algo(int algo);
+
+
+ // Segmentation
+ int segmentation_find_seps();
+ void set_segmentation_find_seps(int seps);
+
+
+ // General options
+ bool general_save_xml_enabled();
+ void set_general_save_xml_enabled(bool b);
+
+ bool general_save_xml_same_dir();
+ void set_general_save_xml_same_dir(bool b);
+
+ bool general_save_xml_custom_dir();
+ void set_general_save_xml_custom_dir(bool b);
+
+ QString general_save_xml_custom_dir_path();
+ void set_general_save_xml_custom_dir_path(const QString& path);
+
+
+};
+
+
+#endif // ! SCRIBO_DEMO_VIEWER_CONFIG_HH
diff --git a/scribo/demo/viewer/defs.hh b/scribo/demo/viewer/defs.hh
new file mode 100644
index 0000000..ada4441
--- /dev/null
+++ b/scribo/demo/viewer/defs.hh
@@ -0,0 +1,31 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef SCRIBO_DEMO_VIEWER_DEFS_HH
+# define SCRIBO_DEMO_VIEWER_DEFS_HH
+
+namespace defs
+{
+ enum FindSeparators
+ {
+ Lines,
+ Whitespaces,
+ LinesAndWhitespaces
+ };
+
+} // end of namespace defs
+
+#endif // ! SCRIBO_DEMO_VIEWER_DEFS_HH
diff --git a/scribo/demo/viewer/general_options.cc b/scribo/demo/viewer/general_options.cc
new file mode 100644
index 0000000..50201ff
--- /dev/null
+++ b/scribo/demo/viewer/general_options.cc
@@ -0,0 +1,60 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#include "general_options.hh"
+#include "config.hh"
+
+
+general_options::general_options(QWidget *parent)
+ : OptionWidget(parent)
+{
+ setupUi(this);
+
+ load_config();
+}
+
+general_options::~general_options()
+{
+}
+
+
+void general_options::load_config()
+{
+ config * const conf = config::get_instance();
+
+ saveXml->setChecked(conf->general_save_xml_enabled());
+ sameDir->setChecked(conf->general_save_xml_same_dir());
+ customDir->setChecked(conf->general_save_xml_custom_dir());
+ customDirValue->setText(conf->general_save_xml_custom_dir_path());
+}
+
+
+void general_options::save_config()
+{
+ config * const conf = config::get_instance();
+
+ conf->set_general_save_xml_enabled(saveXml->isChecked());
+ conf->set_general_save_xml_same_dir(sameDir->isChecked());
+ conf->set_general_save_xml_custom_dir(customDir->isChecked());
+ conf->set_general_save_xml_custom_dir_path(customDirValue->text());
+}
+
+void general_options::on_customDirBrowseBtn_clicked()
+{
+ QString dir = QFileDialog::getExistingDirectory(0, "Choose a directory");
+ if (!dir.isEmpty())
+ customDirValue->setText(dir);
+}
diff --git a/scribo/demo/viewer/general_options.hh b/scribo/demo/viewer/general_options.hh
new file mode 100644
index 0000000..e2fcaae
--- /dev/null
+++ b/scribo/demo/viewer/general_options.hh
@@ -0,0 +1,40 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef SCRIBO_DEMO_VIEWER_GENERAL_OPTIONS_HH
+# define SCRIBO_DEMO_VIEWER_GENERAL_OPTIONS_HH
+
+# include <QtGui>
+# include <general_options.ui.h>
+# include "option_widget.hh"
+
+class general_options : public OptionWidget, private Ui::GeneralOptions
+{
+ Q_OBJECT;
+
+public:
+ general_options(QWidget *parent = 0);
+ ~general_options();
+
+ virtual void load_config();
+ virtual void save_config();
+
+private slots:
+ void on_customDirBrowseBtn_clicked();
+
+};
+
+#endif // ! SCRIBO_DEMO_VIEWER_GENERAL_OPTIONS_HH
diff --git a/scribo/demo/viewer/general_options.ui b/scribo/demo/viewer/general_options.ui
new file mode 100644
index 0000000..5839c27
--- /dev/null
+++ b/scribo/demo/viewer/general_options.ui
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>GeneralOptions</class>
+ <widget class="QWidget" name="GeneralOptions">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QGroupBox" name="saveXml">
+ <property name="title">
+ <string>Save segmentation results</string>
+ </property>
+ <property name="flat">
+ <bool>true</bool>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QRadioButton" name="sameDir">
+ <property name="text">
+ <string>In the same directory as the input image</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QRadioButton" name="customDir">
+ <property name="text">
+ <string>In the following directory</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Maximum</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="customDirValue"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="customDirBrowseBtn">
+ <property name="text">
+ <string>Browse</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/scribo/demo/viewer/option_widget.cc b/scribo/demo/viewer/option_widget.cc
new file mode 100644
index 0000000..4557749
--- /dev/null
+++ b/scribo/demo/viewer/option_widget.cc
@@ -0,0 +1,30 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+# include "option_widget.hh"
+
+OptionWidget::OptionWidget(QWidget * parent)
+ : QWidget(parent)
+{
+}
+
+void OptionWidget::save_config()
+{
+}
+
+void OptionWidget::load_config()
+{
+}
diff --git a/scribo/demo/viewer/option_widget.hh b/scribo/demo/viewer/option_widget.hh
new file mode 100644
index 0000000..6b24e90
--- /dev/null
+++ b/scribo/demo/viewer/option_widget.hh
@@ -0,0 +1,30 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef SCRIBO_DEMO_VIEWER_OPTION_WIDGET_HH
+# define SCRIBO_DEMO_VIEWER_OPTION_WIDGET_HH
+
+#include <QWidget>
+
+struct OptionWidget : public QWidget
+{
+ OptionWidget(QWidget * parent);
+
+ virtual void load_config();
+ virtual void save_config();
+};
+
+#endif // ! SCRIBO_DEMO_VIEWER_OPTION_WIDGET_HH
diff --git a/scribo/demo/viewer/preferences_dialog.cc b/scribo/demo/viewer/preferences_dialog.cc
new file mode 100644
index 0000000..dfd6061
--- /dev/null
+++ b/scribo/demo/viewer/preferences_dialog.cc
@@ -0,0 +1,113 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#include "preferences_dialog.hh"
+#include "toolchain_options.hh"
+#include "general_options.hh"
+
+
+
+preferences_dialog::preferences_dialog(QWidget *parent)
+ : QDialog(parent)
+{
+ setupUi(this);
+
+ // We may want to remove this useless object in the ui file.
+ delete widget;
+
+ setAttribute(Qt::WA_DeleteOnClose);
+
+ load_option_list();
+ optionList->setCurrentRow(0);
+}
+
+preferences_dialog::~preferences_dialog()
+{
+}
+
+
+void preferences_dialog::load_option_list()
+{
+ static const char *options[] = { "General", "Toolchain", 0 };
+
+ int i;
+ for (i = 0; options[i]; ++i)
+ optionList->insertItem(i, options[i]);
+
+ widgets_.fill(0, i);
+}
+
+void preferences_dialog::on_optionList_currentRowChanged(int row)
+{
+ select_option_widget(row);
+}
+
+
+void preferences_dialog::select_option_widget(int row)
+{
+ if (row >= widgets_.size())
+ {
+ qDebug() << "select_option_widget - Hu? Something wrong... Invalid row";
+ return;
+ }
+
+ if (!widgets_[row])
+ {
+ switch (row)
+ {
+ case 0:
+ widgets_[0] = new general_options(this);
+ break;
+
+ case 1:
+ widgets_[1] = new toolchain_options(this);
+ break;
+
+ default:
+ qDebug() << "select_option_widget - Hu? Something wrong...";
+ }
+ }
+
+ if (horizontalLayout_2->count() == 2)
+ {
+ QWidget *current_widget = horizontalLayout_2->itemAt(1)->widget();
+ horizontalLayout_2->removeWidget(current_widget);
+ current_widget->hide();
+ }
+
+ horizontalLayout_2->insertWidget(1, widgets_[row]);
+ widgets_[row]->show();
+}
+
+
+void preferences_dialog::accept()
+{
+ for (int i = 0; i < widgets_.size(); ++i)
+ if (widgets_[i])
+ {
+ static_cast<OptionWidget *>(widgets_[i])->save_config();
+ delete widgets_[i];
+ }
+ QDialog::accept();
+}
+
+
+void preferences_dialog::reject()
+{
+ for (int i = 0; i < widgets_.size(); ++i)
+ delete widgets_[i];
+ QDialog::reject();
+}
diff --git a/scribo/demo/viewer/preferences_dialog.hh b/scribo/demo/viewer/preferences_dialog.hh
new file mode 100644
index 0000000..0368bbe
--- /dev/null
+++ b/scribo/demo/viewer/preferences_dialog.hh
@@ -0,0 +1,45 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef SCRIBO_DEMO_VIEWER_PREFERENCES_DIALOG_HH
+# define SCRIBO_DEMO_VIEWER_PREFERENCES_DIALOG_HH
+
+# include <QtGui>
+# include <preferences_dialog.ui.h>
+
+class preferences_dialog : public QDialog, private Ui::PreferencesDialog
+{
+ Q_OBJECT;
+
+public:
+ preferences_dialog(QWidget *parent = 0);
+ ~preferences_dialog();
+
+private slots:
+ void on_optionList_currentRowChanged(int row);
+ virtual void accept();
+ virtual void reject();
+
+private: // Methods
+ void load_option_list();
+ void select_option_widget(int row);
+
+private: // Attributes
+ QVector<QWidget *> widgets_;
+
+};
+
+#endif // ! SCRIBO_DEMO_VIEWER_PREFERENCES_DIALOG_HH
diff --git a/scribo/demo/viewer/preferences_dialog.ui b/scribo/demo/viewer/preferences_dialog.ui
new file mode 100644
index 0000000..1d40563
--- /dev/null
+++ b/scribo/demo/viewer/preferences_dialog.ui
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PreferencesDialog</class>
+ <widget class="QDialog" name="PreferencesDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>668</width>
+ <height>418</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Preferences</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <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;">Preferences</span></p></body></html></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QListWidget" name="optionList">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Maximum" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>200</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="baseSize">
+ <size>
+ <width>100</width>
+ <height>0</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="widget" native="true"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>PreferencesDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>PreferencesDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/scribo/demo/viewer/toolchain_options.cc b/scribo/demo/viewer/toolchain_options.cc
new file mode 100644
index 0000000..6024ff3
--- /dev/null
+++ b/scribo/demo/viewer/toolchain_options.cc
@@ -0,0 +1,75 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#include "defs.hh"
+#include "toolchain_options.hh"
+#include "config.hh"
+
+// Defines enum of binarization algorithms
+# include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh>
+
+using namespace scribo::toolchain::internal;
+
+toolchain_options::toolchain_options(QWidget *parent)
+ : OptionWidget(parent)
+{
+ setupUi(this);
+
+ bin_algoCbox->insertItem(Convert, "Violent convert");
+ bin_algoCbox->insertItem(Sauvola, "Local threshold");
+ bin_algoCbox->insertItem(SauvolaMs,
+ "Local threshold multiscale");
+
+ find_sepsCbox->insertItem(defs::Lines, "Lines");
+ find_sepsCbox->insertItem(defs::Whitespaces, "Whitespaces");
+ find_sepsCbox->insertItem(defs::LinesAndWhitespaces, "Lines and whitespaces");
+
+ load_config();
+}
+
+toolchain_options::~toolchain_options()
+{
+}
+
+
+void toolchain_options::load_config()
+{
+ config * const conf = config::get_instance();
+
+ // Preprocessing
+ subsampleCb->setChecked(conf->preprocessing_subsample());
+ remove_bgCb->setChecked(conf->preprocessing_remove_bg());
+ deskewCb->setChecked(conf->preprocessing_deskew());
+ remove_noiseCb->setChecked(conf->preprocessing_remove_noise());
+ bin_algoCbox->setCurrentIndex(conf->preprocessing_bin_algo());
+
+ // Page segmentation
+ find_sepsCbox->setCurrentIndex(conf->segmentation_find_seps());
+}
+
+
+void toolchain_options::save_config()
+{
+ config * const conf = config::get_instance();
+
+ conf->set_preprocessing_subsample(subsampleCb->isChecked());
+ conf->set_preprocessing_remove_bg(remove_bgCb->isChecked());
+ conf->set_preprocessing_deskew(deskewCb->isChecked());
+ conf->set_preprocessing_remove_noise(remove_noiseCb->isChecked());
+ conf->set_preprocessing_bin_algo(bin_algoCbox->currentIndex());
+
+ conf->set_segmentation_find_seps(find_sepsCbox->currentIndex());
+}
diff --git a/scribo/demo/viewer/toolchain_options.hh b/scribo/demo/viewer/toolchain_options.hh
new file mode 100644
index 0000000..afad3e7
--- /dev/null
+++ b/scribo/demo/viewer/toolchain_options.hh
@@ -0,0 +1,37 @@
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+
+#ifndef SCRIBO_DEMO_VIEWER_TOOLCHAIN_OPTIONS_HH
+# define SCRIBO_DEMO_VIEWER_TOOLCHAIN_OPTIONS_HH
+
+# include <QtGui>
+# include <toolchain_options.ui.h>
+# include "option_widget.hh"
+
+class toolchain_options : public OptionWidget, private Ui::ToolchainOptions
+{
+ Q_OBJECT;
+
+public:
+ toolchain_options(QWidget *parent = 0);
+ ~toolchain_options();
+
+ void load_config();
+ void save_config();
+
+};
+
+#endif // ! SCRIBO_DEMO_VIEWER_TOOLCHAIN_OPTIONS_HH
diff --git a/scribo/demo/viewer/toolchain_options.ui b/scribo/demo/viewer/toolchain_options.ui
new file mode 100644
index 0000000..748696d
--- /dev/null
+++ b/scribo/demo/viewer/toolchain_options.ui
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ToolchainOptions</class>
+ <widget class="QWidget" name="ToolchainOptions">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>492</width>
+ <height>264</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Configure toolchain</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Preprocessing</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QCheckBox" name="subsampleCb">
+ <property name="text">
+ <string>Run on subsampled image</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="remove_bgCb">
+ <property name="text">
+ <string>Remove background (slow)</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="deskewCb">
+ <property name="text">
+ <string>Deskew</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="remove_noiseCb">
+ <property name="text">
+ <string>Remove noise</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Binarization method:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="bin_algoCbox"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Page segmentation</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Find separators</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="find_sepsCbox"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
--
1.5.6.5