
--- XmlParser/XmlParser.pro => GScribo/GScribo.pro | 29 ++----- .../GScribo.pro.user | 50 +++++----- XmlParser/configs.h => GScribo/config.h | 0 {XmlParser => GScribo}/dir.h | 0 {XmlParser => GScribo}/main.cpp | 7 +- GScribo/mainwindow.cpp | 97 ++++++++++++++++++++ GScribo/mainwindow.h | 51 ++++++++++ Test/test.ui => GScribo/mainwindow.ui | 38 +++----- GScribo/pageswidget.cpp | 30 ++++++ GScribo/pageswidget.h | 27 ++++++ {XmlParser => GScribo}/polygonitem.cpp | 0 {XmlParser => GScribo}/polygonitem.h | 0 {XmlParser => GScribo}/preprocess.cpp | 0 {XmlParser => GScribo}/preprocess.h | 0 {XmlParser => GScribo}/process.cpp | 0 {XmlParser => GScribo}/process.h | 0 {XmlParser => GScribo}/progressdialog.cpp | 0 {XmlParser => GScribo}/progressdialog.h | 0 {XmlParser => GScribo}/runner.cpp | 0 {XmlParser => GScribo}/runner.h | 0 {XmlParser => GScribo}/scene.cpp | 12 +-- {XmlParser => GScribo}/scene.h | 8 +- {XmlParser => GScribo}/selection.cpp | 4 +- {XmlParser => GScribo}/selection.h | 1 - {XmlParser => GScribo}/xml.cpp | 0 {XmlParser => GScribo}/xml.h | 0 .../XmlParser.pro => TestInterface/GScribo.pro | 31 ++----- .../GScribo.pro.user | 46 +++++----- XmlParser/configs.h => TestInterface/config.h | 0 {XmlParser => TestInterface}/dir.h | 0 {XmlParser => TestInterface}/main.cpp | 9 +- TestInterface/mainwindow.cpp | 75 +++++++++++++++ TestInterface/mainwindow.h | 40 ++++++++ Test/test.ui => TestInterface/mainwindow.ui | 35 ++----- {XmlParser => TestInterface}/polygonitem.cpp | 0 {XmlParser => TestInterface}/polygonitem.h | 0 {XmlParser => TestInterface}/preprocess.cpp | 0 {XmlParser => TestInterface}/preprocess.h | 0 {XmlParser => TestInterface}/process.cpp | 0 {XmlParser => TestInterface}/process.h | 0 {XmlParser => TestInterface}/progressdialog.cpp | 0 {XmlParser => TestInterface}/progressdialog.h | 0 {XmlParser => TestInterface}/runner.cpp | 0 {XmlParser => TestInterface}/runner.h | 0 {XmlParser => TestInterface}/scene.cpp | 10 +-- {XmlParser => TestInterface}/scene.h | 5 +- {XmlParser => TestInterface}/selection.cpp | 2 +- {XmlParser => TestInterface}/selection.h | 1 - {XmlParser => TestInterface}/xml.cpp | 0 {XmlParser => TestInterface}/xml.h | 0 XmlParser/XmlParser.pro | 3 +- XmlParser/XmlParser.pro.user | 36 ++++---- XmlParser/main.cpp | 5 + XmlParser/mainwindow.cpp | 1 + XmlParser/mainwindow.h | 1 + XmlParser/scene.cpp | 2 + 56 files changed, 460 insertions(+), 196 deletions(-) copy XmlParser/XmlParser.pro => GScribo/GScribo.pro (59%) copy XmlParser/XmlParser.pro.user.1.3 => GScribo/GScribo.pro.user (85%) copy XmlParser/configs.h => GScribo/config.h (100%) copy {XmlParser => GScribo}/dir.h (100%) copy {XmlParser => GScribo}/main.cpp (72%) create mode 100644 GScribo/mainwindow.cpp create mode 100644 GScribo/mainwindow.h copy Test/test.ui => GScribo/mainwindow.ui (60%) create mode 100644 GScribo/pageswidget.cpp create mode 100644 GScribo/pageswidget.h copy {XmlParser => GScribo}/polygonitem.cpp (100%) copy {XmlParser => GScribo}/polygonitem.h (100%) copy {XmlParser => GScribo}/preprocess.cpp (100%) copy {XmlParser => GScribo}/preprocess.h (100%) copy {XmlParser => GScribo}/process.cpp (100%) copy {XmlParser => GScribo}/process.h (100%) copy {XmlParser => GScribo}/progressdialog.cpp (100%) copy {XmlParser => GScribo}/progressdialog.h (100%) copy {XmlParser => GScribo}/runner.cpp (100%) copy {XmlParser => GScribo}/runner.h (100%) copy {XmlParser => GScribo}/scene.cpp (86%) copy {XmlParser => GScribo}/scene.h (86%) copy {XmlParser => GScribo}/selection.cpp (88%) copy {XmlParser => GScribo}/selection.h (99%) copy {XmlParser => GScribo}/xml.cpp (100%) copy {XmlParser => GScribo}/xml.h (100%) copy XmlParser/XmlParser.pro => TestInterface/GScribo.pro (55%) copy XmlParser/XmlParser.pro.user.1.3 => TestInterface/GScribo.pro.user (86%) copy XmlParser/configs.h => TestInterface/config.h (100%) copy {XmlParser => TestInterface}/dir.h (100%) copy {XmlParser => TestInterface}/main.cpp (70%) create mode 100644 TestInterface/mainwindow.cpp create mode 100644 TestInterface/mainwindow.h copy Test/test.ui => TestInterface/mainwindow.ui (60%) copy {XmlParser => TestInterface}/polygonitem.cpp (100%) copy {XmlParser => TestInterface}/polygonitem.h (100%) copy {XmlParser => TestInterface}/preprocess.cpp (100%) copy {XmlParser => TestInterface}/preprocess.h (100%) copy {XmlParser => TestInterface}/process.cpp (100%) copy {XmlParser => TestInterface}/process.h (100%) copy {XmlParser => TestInterface}/progressdialog.cpp (100%) copy {XmlParser => TestInterface}/progressdialog.h (100%) copy {XmlParser => TestInterface}/runner.cpp (100%) copy {XmlParser => TestInterface}/runner.h (100%) copy {XmlParser => TestInterface}/scene.cpp (86%) copy {XmlParser => TestInterface}/scene.h (86%) copy {XmlParser => TestInterface}/selection.cpp (96%) copy {XmlParser => TestInterface}/selection.h (99%) copy {XmlParser => TestInterface}/xml.cpp (100%) copy {XmlParser => TestInterface}/xml.h (100%) diff --git a/XmlParser/XmlParser.pro b/GScribo/GScribo.pro similarity index 59% copy from XmlParser/XmlParser.pro copy to GScribo/GScribo.pro index 597fc47..ad4abe0 100644 --- a/XmlParser/XmlParser.pro +++ b/GScribo/GScribo.pro @@ -1,9 +1,8 @@ # ------------------------------------------------- -# Project created by QtCreator 2013-01-11T14:21:43 +# Project created by QtCreator 2013-01-21T09:20:54 # ------------------------------------------------- -QT += xml -TARGET = XmlParser -TEMPLATE = app +QT += opengl \ + 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/ @@ -12,29 +11,15 @@ QMAKE_CXXFLAGS += -DNDEBUG \ LIBS += -I/usr/include/graphicsImage \ -lGraphicsMagick++ \ -ltesseract_full +TARGET = GScribo +TEMPLATE = app SOURCES += main.cpp \ mainwindow.cpp \ - xml.cpp \ scene.cpp \ selection.cpp \ - polygonitem.cpp \ - runner.cpp \ - toolbar.cpp \ - process.cpp \ - preprocess.cpp \ - configs.cpp \ - progressdialog.cpp + pageswidget.cpp HEADERS += mainwindow.h \ - region.h \ - xml.h \ scene.h \ selection.h \ - polygonitem.h \ - runner.h \ - toolbar.h \ - process.h \ - preprocess.h \ - configs.h \ - dir.h \ - progressdialog.h + pageswidget.h FORMS += mainwindow.ui diff --git a/XmlParser/XmlParser.pro.user.1.3 b/GScribo/GScribo.pro.user similarity index 85% copy from XmlParser/XmlParser.pro.user.1.3 copy to GScribo/GScribo.pro.user index 29f9b56..6f863ff 100644 --- a/XmlParser/XmlParser.pro.user.1.3 +++ b/GScribo/GScribo.pro.user @@ -10,11 +10,11 @@ </data> <data> <variable>RunConfiguration0-ProFile</variable> - <value type="QString">XmlParser.pro</value> + <value type="QString">GScribo.pro</value> </data> <data> <variable>RunConfiguration0-RunConfiguration.name</variable> - <value type="QString">XmlParser</value> + <value type="QString">GScribo</value> </data> <data> <variable>RunConfiguration0-UseDyldImageSuffix</variable> @@ -76,35 +76,35 @@ <valuemap type="QVariantMap"> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <valuelist key="abstractProcess.Environment" type="QVariantList"> - <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-YjhocK9Z3d,guid=e9e5f2da71aeced554355e6f00596ece</value> + <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Si71aPButo,guid=4a5769b30d2b16bfbff191ee00669e72</value> <value type="QString">DESKTOP_SESSION=fluxbox</value> <value type="QString">DISPLAY=:0.0</value> <value type="QString">GDMSESSION=fluxbox</value> <value type="QString">GDM_LANG=fr_FR.UTF-8</value> <value type="QString">GDM_XSERVER_LOCATION=local</value> - <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-INUHb2</value> - <value type="QString">GNOME_KEYRING_PID=27655</value> + <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-xqG91k</value> + <value type="QString">GNOME_KEYRING_PID=24747</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">OLDPWD=/lrde/home/stage/froger_a/qt</value> + <value type="QString">OLDPWD=/lrde/home/stage/froger_a</value> <value type="QString">PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games</value> - <value type="QString">PWD=/lrde/home/stage/froger_a/qt/XmlParser</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=27730</value> - <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-aIvoE27664/agent.27664</value> + <value type="QString">SSH_AGENT_PID=24822</value> + <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-ViaPN24756/agent.24756</value> <value type="QString">TERM=xterm</value> <value type="QString">USER=froger_a</value> <value type="QString">USERNAME=froger_a</value> <value type="QString">WINDOWID=10485796</value> - <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8</value> - <value type="QString">XAUTHORITY=/tmp/.gdmJEZ7QW</value> + <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> + <value type="QString">XAUTHORITY=/tmp/.gdmDMHCRW</value> <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> - <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1357908881.805303-96205090</value> + <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358773046.159332-2135577617</value> <value type="QString">XPSERVERLIST=:64 </value> <value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value> <value type="QString">XTERM_SHELL=/bin/bash</value> @@ -112,7 +112,7 @@ <value type="QString">_=/usr/bin/qtcreator</value> </valuelist> <valuelist key="abstractProcess.arguments" type="QVariantList"> - <value type="QString">/amd/nfs/volume1/home/stage/froger_a/qt/XmlParser/XmlParser.pro</value> + <value type="QString">/amd/nfs/volume1/home/stage/froger_a/qt/GScribo/GScribo.pro</value> <value type="QString">-spec</value> <value type="QString">linux-g++</value> <value type="QString">-r</value> @@ -120,7 +120,7 @@ </valuelist> <value key="abstractProcess.command" type="QString">/usr/bin/qmake-qt4</value> <value key="abstractProcess.enabled" type="bool">false</value> - <value key="abstractProcess.workingDirectory" type="QString">/amd/nfs/volume1/home/stage/froger_a/qt/XmlParser</value> + <value key="abstractProcess.workingDirectory" type="QString">/amd/nfs/volume1/home/stage/froger_a/qt/GScribo</value> </valuemap> </data> <data> @@ -128,35 +128,35 @@ <valuemap type="QVariantMap"> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <valuelist key="abstractProcess.Environment" type="QVariantList"> - <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-YjhocK9Z3d,guid=e9e5f2da71aeced554355e6f00596ece</value> + <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Si71aPButo,guid=4a5769b30d2b16bfbff191ee00669e72</value> <value type="QString">DESKTOP_SESSION=fluxbox</value> <value type="QString">DISPLAY=:0.0</value> <value type="QString">GDMSESSION=fluxbox</value> <value type="QString">GDM_LANG=fr_FR.UTF-8</value> <value type="QString">GDM_XSERVER_LOCATION=local</value> - <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-INUHb2</value> - <value type="QString">GNOME_KEYRING_PID=27655</value> + <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-xqG91k</value> + <value type="QString">GNOME_KEYRING_PID=24747</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">OLDPWD=/lrde/home/stage/froger_a/qt</value> + <value type="QString">OLDPWD=/lrde/home/stage/froger_a</value> <value type="QString">PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games</value> - <value type="QString">PWD=/lrde/home/stage/froger_a/qt/XmlParser</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=27730</value> - <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-aIvoE27664/agent.27664</value> + <value type="QString">SSH_AGENT_PID=24822</value> + <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-ViaPN24756/agent.24756</value> <value type="QString">TERM=xterm</value> <value type="QString">USER=froger_a</value> <value type="QString">USERNAME=froger_a</value> <value type="QString">WINDOWID=10485796</value> - <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8</value> - <value type="QString">XAUTHORITY=/tmp/.gdmJEZ7QW</value> + <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> + <value type="QString">XAUTHORITY=/tmp/.gdmDMHCRW</value> <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> - <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1357908881.805303-96205090</value> + <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358773046.159332-2135577617</value> <value type="QString">XPSERVERLIST=:64 </value> <value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value> <value type="QString">XTERM_SHELL=/bin/bash</value> @@ -169,7 +169,7 @@ </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/XmlParser</value> + <value key="abstractProcess.workingDirectory" type="QString">/amd/nfs/volume1/home/stage/froger_a/qt/GScribo</value> </valuemap> </data> <data> diff --git a/XmlParser/configs.h b/GScribo/config.h similarity index 100% copy from XmlParser/configs.h copy to GScribo/config.h diff --git a/XmlParser/dir.h b/GScribo/dir.h similarity index 100% copy from XmlParser/dir.h copy to GScribo/dir.h diff --git a/XmlParser/main.cpp b/GScribo/main.cpp similarity index 72% copy from XmlParser/main.cpp copy to GScribo/main.cpp index aecf5cd..b8f57bd 100644 --- a/XmlParser/main.cpp +++ b/GScribo/main.cpp @@ -1,5 +1,3 @@ -#undef MLN_WO_GLOBAL_VARS - #include <mln/labeling/colorize.hh> #include <mln/math/pi.hh> #include <mln/io/magick/load.hh> @@ -7,11 +5,14 @@ #include <mln/debug/filename.hh> #include <scribo/make/debug_filename.hh> #include <QtGui/QApplication> + #include "mainwindow.h" -int main(int argc, char **argv) +int main(int argc, char *argv[]) { Magick::InitializeMagick(*argv); + //On Linux, we NEED to use the raster graphics system. + //Linux don't really support X11 graphics system (the default one). QApplication::setGraphicsSystem("raster"); QApplication a(argc, argv); MainWindow w; diff --git a/GScribo/mainwindow.cpp b/GScribo/mainwindow.cpp new file mode 100644 index 0000000..4ef2aa1 --- /dev/null +++ b/GScribo/mainwindow.cpp @@ -0,0 +1,97 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); + + initGraphicsRegion(); + initTextRegion(); + initTablePage(); + initToolBar(); +} + +MainWindow::~MainWindow() +{ + delete dockText; + delete dockPages; + delete scene; + delete graphicsView; + delete textEdit; + delete ui; +} + +void MainWindow::initGraphicsRegion() +{ + graphicsView = new QGraphicsView; + // Cache backgroud to speed up its repaint. + graphicsView->setCacheMode(QGraphicsView::CacheBackground); + graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate); + + scene = new Scene(); + // Disable scroll bar extend with a non-null rectangle. + scene->setSceneRect(0, 0, 0, 1); + graphicsView->setScene(scene); + + setCentralWidget(graphicsView); +} + +void MainWindow::initTablePage() +{ + dockPages = new QDockWidget(tr("Pages")); + dockPages->setAllowedAreas(Qt::AllDockWidgetAreas); + dockPages->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable); + + pagesWidget = new PagesWidget; + dockPages->setWidget(pagesWidget); + + addDockWidget(Qt::LeftDockWidgetArea, dockPages); +} + +void MainWindow::initTextRegion() +{ + dockText = new QDockWidget(tr("Previsualization")); + dockText->setAllowedAreas(Qt::AllDockWidgetAreas); + dockText->setFeatures(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable); + + textEdit = new QPlainTextEdit; + dockText->setWidget(textEdit); + + addDockWidget(Qt::RightDockWidgetArea, dockText); + dockText->hide(); +} + +void MainWindow::initToolBar() +{ + QAction *open = ui->mainToolBar->addAction(tr("Open")); + connect(open, SIGNAL(triggered()), this, SLOT(onOpen())); +} + +void MainWindow::onOpen() +{ + QString path = QFileDialog::getOpenFileName(this); + if(path != "") + { + QPixmap pixmap(path); + + scene->setSceneRect(pixmap.rect()); + scene->setBackgroundBrush(QBrush(pixmap)); + + pagesWidget->addPicture(path, pixmap); + } +} + +void MainWindow::changeEvent(QEvent *e) +{ + QMainWindow::changeEvent(e); + switch (e->type()) + { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/GScribo/mainwindow.h b/GScribo/mainwindow.h new file mode 100644 index 0000000..aa80b72 --- /dev/null +++ b/GScribo/mainwindow.h @@ -0,0 +1,51 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QMainWindow> +#include <QHBoxLayout> +#include <QDockWidget> +#include <QGraphicsView> +#include <QGLWidget> +#include <QPlainTextEdit> +#include <QGroupBox> +#include <QFileDialog> + +#include "scene.h" +#include "pageswidget.h" + +namespace Ui +{ + class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + + public: + MainWindow(QWidget *parent = 0); + ~MainWindow(); + + protected: + void changeEvent(QEvent *e); + + private: + void initGraphicsRegion(); + void initTextRegion(); + void initToolBar(); + void initTablePage(); + + Ui::MainWindow *ui; + QDockWidget *dockText; + QDockWidget *dockPages; + Scene *scene; + QGraphicsView *graphicsView; + QPlainTextEdit *textEdit; + PagesWidget *pagesWidget; + QString imagePath; + + private slots: + void onOpen(); +}; + +#endif // MAINWINDOW_H diff --git a/Test/test.ui b/GScribo/mainwindow.ui similarity index 60% copy from Test/test.ui copy to GScribo/mainwindow.ui index 5fb0299..3a174ec 100644 --- a/Test/test.ui +++ b/GScribo/mainwindow.ui @@ -1,57 +1,45 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Test</class> - <widget class="QMainWindow" name="Test"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>919</width> - <height>562</height> + <width>671</width> + <height>436</height> </rect> </property> <property name="windowTitle"> - <string>Test</string> + <string>MainWindow</string> </property> <widget class="QWidget" name="centralWidget"> - <widget class="QLabel" name="label"> - <property name="geometry"> - <rect> - <x>250</x> - <y>130</y> - <width>341</width> - <height>181</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - </widget> + <property name="enabled"> + <bool>true</bool> + </property> </widget> <widget class="QMenuBar" name="menuBar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>919</width> + <width>671</width> <height>23</height> </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>true</bool> + <bool>false</bool> </attribute> </widget> <widget class="QStatusBar" name="statusBar"/> - <action name="actionLoad"> - <property name="text"> - <string>Load</string> - </property> - </action> </widget> <layoutdefault spacing="6" margin="11"/> <resources/> diff --git a/GScribo/pageswidget.cpp b/GScribo/pageswidget.cpp new file mode 100644 index 0000000..2f23d9d --- /dev/null +++ b/GScribo/pageswidget.cpp @@ -0,0 +1,30 @@ +#include "pageswidget.h" + +PagesWidget::PagesWidget(QWidget *parent): + QWidget(parent) +{ + filenames = new QStringList; + scrollArea = new QScrollArea(this); + scrollArea->setGeometry(0, 0, 1000, 1000); + layout = new QHBoxLayout; + QWidget *widget = new QWidget; + widget->setLayout(layout); + scrollArea->setWidget(widget); +} + +PagesWidget::~PagesWidget() +{ + delete filenames; + delete layout; + delete scrollArea; +} + +void PagesWidget::addPicture(const QString& filename, const QPixmap& pixmap) +{ + *filenames << filename; + QPixmap pix = pixmap.scaled(100, 100, Qt::IgnoreAspectRatio); + QLabel *label = new QLabel(this); + label->setPixmap(pix); + layout->addWidget(label, 0, Qt::AlignHCenter | Qt::AlignTop); + scrollArea->update(scrollArea->geometry()); +} diff --git a/GScribo/pageswidget.h b/GScribo/pageswidget.h new file mode 100644 index 0000000..3747d20 --- /dev/null +++ b/GScribo/pageswidget.h @@ -0,0 +1,27 @@ +#ifndef PAGESWIDGET_H +#define PAGESWIDGET_H + +#include <QWidget> +#include <QScrollArea> +#include <QVBoxLayout> +#include <QListWidget> +#include <QLabel> + +class PagesWidget: + public QWidget +{ + Q_OBJECT + + public: + explicit PagesWidget(QWidget *parent = 0); + explicit PagesWidget(QWidgetPrivate &d, QWidget *parent = 0); + ~PagesWidget(); + void addPicture(const QString& filename, const QPixmap& pixmap); + + private: + QScrollArea *scrollArea; + QHBoxLayout *layout; + QStringList *filenames; +}; + +#endif // PAGESWIDGET_H diff --git a/XmlParser/polygonitem.cpp b/GScribo/polygonitem.cpp similarity index 100% copy from XmlParser/polygonitem.cpp copy to GScribo/polygonitem.cpp diff --git a/XmlParser/polygonitem.h b/GScribo/polygonitem.h similarity index 100% copy from XmlParser/polygonitem.h copy to GScribo/polygonitem.h diff --git a/XmlParser/preprocess.cpp b/GScribo/preprocess.cpp similarity index 100% copy from XmlParser/preprocess.cpp copy to GScribo/preprocess.cpp diff --git a/XmlParser/preprocess.h b/GScribo/preprocess.h similarity index 100% copy from XmlParser/preprocess.h copy to GScribo/preprocess.h diff --git a/XmlParser/process.cpp b/GScribo/process.cpp similarity index 100% copy from XmlParser/process.cpp copy to GScribo/process.cpp diff --git a/XmlParser/process.h b/GScribo/process.h similarity index 100% copy from XmlParser/process.h copy to GScribo/process.h diff --git a/XmlParser/progressdialog.cpp b/GScribo/progressdialog.cpp similarity index 100% copy from XmlParser/progressdialog.cpp copy to GScribo/progressdialog.cpp diff --git a/XmlParser/progressdialog.h b/GScribo/progressdialog.h similarity index 100% copy from XmlParser/progressdialog.h copy to GScribo/progressdialog.h diff --git a/XmlParser/runner.cpp b/GScribo/runner.cpp similarity index 100% copy from XmlParser/runner.cpp copy to GScribo/runner.cpp diff --git a/XmlParser/runner.h b/GScribo/runner.h similarity index 100% copy from XmlParser/runner.h copy to GScribo/runner.h diff --git a/XmlParser/scene.cpp b/GScribo/scene.cpp similarity index 86% copy from XmlParser/scene.cpp copy to GScribo/scene.cpp index 612d2bd..ee2007a 100644 --- a/XmlParser/scene.cpp +++ b/GScribo/scene.cpp @@ -28,7 +28,7 @@ void Scene::init() isPressing = false; clic = false; selection = new Selection(this); -} +} void Scene::removeItems() { @@ -48,6 +48,7 @@ void Scene::mousePressEvent(QGraphicsSceneMouseEvent *event) isPressing = true; clic = true; pressPos = event->scenePos(); + selection->show(); } } @@ -74,13 +75,8 @@ void Scene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) isPressing = false; if(clic) selection->setRect(QRectF(QPointF(0, 0), event->scenePos())); - emit repaintItems(selection->rect(), clic); + emit repaintItem(selection->rect(), clic); selection->setRect(0, 0, 0, 0); + selection->hide(); } } - -QString Scene::debug(QRect &rect) -{ - return "Position : " + QString::number(rect.x()) + ", " + QString::number(rect.y()) + "\n" + - "Size : " + QString::number(rect.width()) + ", " + QString::number(rect.height()); -} diff --git a/XmlParser/scene.h b/GScribo/scene.h similarity index 86% copy from XmlParser/scene.h copy to GScribo/scene.h index b7294c6..86ca8c7 100644 --- a/XmlParser/scene.h +++ b/GScribo/scene.h @@ -1,8 +1,10 @@ #ifndef SCENE_H #define SCENE_H +#include <QFileDialog> #include <QGraphicsScene> #include <QGraphicsSceneMouseEvent> + #include "selection.h" #include "polygonitem.h" @@ -25,7 +27,6 @@ class Scene : private: void init(); - QString debug(QRect &rect); Selection *selection; QPointF pressPos; @@ -33,8 +34,7 @@ class Scene : bool clic; signals: - void repaintItems(const QRectF& rect, bool clic); - void sendString(QString& string); -}; + void repaintItem(const QRectF& rect, bool clic); + }; #endif // SCENE_H diff --git a/XmlParser/selection.cpp b/GScribo/selection.cpp similarity index 88% copy from XmlParser/selection.cpp copy to GScribo/selection.cpp index 51e3fe5..6020312 100644 --- a/XmlParser/selection.cpp +++ b/GScribo/selection.cpp @@ -24,10 +24,10 @@ void Selection::init() QPen pen; pen.setStyle(Qt::DashLine); pen.setCapStyle(Qt::SquareCap); - pen.setWidth(1); + pen.setCosmetic(true); setPen(pen); QBrush brush; brush.setStyle(Qt::Dense4Pattern); - brush.setColor(QColor::fromRgb(100, 200, 60, 100)); + brush.setColor(QColor::fromRgb(80, 200, 10, 100)); setBrush(brush); } diff --git a/XmlParser/selection.h b/GScribo/selection.h similarity index 99% copy from XmlParser/selection.h copy to GScribo/selection.h index dad1038..4864e15 100644 --- a/XmlParser/selection.h +++ b/GScribo/selection.h @@ -5,7 +5,6 @@ #include <QPen> #include <climits> - class Selection : public QGraphicsRectItem { diff --git a/XmlParser/xml.cpp b/GScribo/xml.cpp similarity index 100% copy from XmlParser/xml.cpp copy to GScribo/xml.cpp diff --git a/XmlParser/xml.h b/GScribo/xml.h similarity index 100% copy from XmlParser/xml.h copy to GScribo/xml.h diff --git a/XmlParser/XmlParser.pro b/TestInterface/GScribo.pro similarity index 55% copy from XmlParser/XmlParser.pro copy to TestInterface/GScribo.pro index 597fc47..db83ffa 100644 --- a/XmlParser/XmlParser.pro +++ b/TestInterface/GScribo.pro @@ -1,9 +1,8 @@ # ------------------------------------------------- -# Project created by QtCreator 2013-01-11T14:21:43 +# Project created by QtCreator 2013-01-21T09:20:54 # ------------------------------------------------- -QT += xml -TARGET = XmlParser -TEMPLATE = app +QT += opengl \ + 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/ @@ -12,29 +11,13 @@ QMAKE_CXXFLAGS += -DNDEBUG \ LIBS += -I/usr/include/graphicsImage \ -lGraphicsMagick++ \ -ltesseract_full +TARGET = GScribo +TEMPLATE = app SOURCES += main.cpp \ mainwindow.cpp \ - xml.cpp \ scene.cpp \ - selection.cpp \ - polygonitem.cpp \ - runner.cpp \ - toolbar.cpp \ - process.cpp \ - preprocess.cpp \ - configs.cpp \ - progressdialog.cpp + selection.cpp HEADERS += mainwindow.h \ - region.h \ - xml.h \ scene.h \ - selection.h \ - polygonitem.h \ - runner.h \ - toolbar.h \ - process.h \ - preprocess.h \ - configs.h \ - dir.h \ - progressdialog.h + selection.h FORMS += mainwindow.ui diff --git a/XmlParser/XmlParser.pro.user.1.3 b/TestInterface/GScribo.pro.user similarity index 86% copy from XmlParser/XmlParser.pro.user.1.3 copy to TestInterface/GScribo.pro.user index 29f9b56..4b00d43 100644 --- a/XmlParser/XmlParser.pro.user.1.3 +++ b/TestInterface/GScribo.pro.user @@ -10,11 +10,11 @@ </data> <data> <variable>RunConfiguration0-ProFile</variable> - <value type="QString">XmlParser.pro</value> + <value type="QString">GScribo.pro</value> </data> <data> <variable>RunConfiguration0-RunConfiguration.name</variable> - <value type="QString">XmlParser</value> + <value type="QString">GScribo</value> </data> <data> <variable>RunConfiguration0-UseDyldImageSuffix</variable> @@ -76,14 +76,14 @@ <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-YjhocK9Z3d,guid=e9e5f2da71aeced554355e6f00596ece</value> + <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-dwXmVzGpRA,guid=2e4bb3ce70c39fa5e5288771006655e3</value> <value type="QString">DESKTOP_SESSION=fluxbox</value> <value type="QString">DISPLAY=:0.0</value> <value type="QString">GDMSESSION=fluxbox</value> <value type="QString">GDM_LANG=fr_FR.UTF-8</value> <value type="QString">GDM_XSERVER_LOCATION=local</value> - <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-INUHb2</value> - <value type="QString">GNOME_KEYRING_PID=27655</value> + <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-9aAGCJ</value> + <value type="QString">GNOME_KEYRING_PID=19876</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> @@ -91,20 +91,20 @@ <value type="QString">LOGNAME=froger_a</value> <value type="QString">OLDPWD=/lrde/home/stage/froger_a/qt</value> <value type="QString">PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games</value> - <value type="QString">PWD=/lrde/home/stage/froger_a/qt/XmlParser</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=27730</value> - <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-aIvoE27664/agent.27664</value> + <value type="QString">SSH_AGENT_PID=19951</value> + <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-kVrax19885/agent.19885</value> <value type="QString">TERM=xterm</value> <value type="QString">USER=froger_a</value> <value type="QString">USERNAME=froger_a</value> <value type="QString">WINDOWID=10485796</value> - <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8</value> - <value type="QString">XAUTHORITY=/tmp/.gdmJEZ7QW</value> + <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> + <value type="QString">XAUTHORITY=/tmp/.gdm0ICXQW</value> <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> - <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1357908881.805303-96205090</value> + <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358754471.558659-246518931</value> <value type="QString">XPSERVERLIST=:64 </value> <value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value> <value type="QString">XTERM_SHELL=/bin/bash</value> @@ -112,7 +112,7 @@ <value type="QString">_=/usr/bin/qtcreator</value> </valuelist> <valuelist key="abstractProcess.arguments" type="QVariantList"> - <value type="QString">/amd/nfs/volume1/home/stage/froger_a/qt/XmlParser/XmlParser.pro</value> + <value type="QString">/amd/nfs/volume1/home/stage/froger_a/qt/GScribo/GScribo.pro</value> <value type="QString">-spec</value> <value type="QString">linux-g++</value> <value type="QString">-r</value> @@ -120,7 +120,7 @@ </valuelist> <value key="abstractProcess.command" type="QString">/usr/bin/qmake-qt4</value> <value key="abstractProcess.enabled" type="bool">false</value> - <value key="abstractProcess.workingDirectory" type="QString">/amd/nfs/volume1/home/stage/froger_a/qt/XmlParser</value> + <value key="abstractProcess.workingDirectory" type="QString">/amd/nfs/volume1/home/stage/froger_a/qt/GScribo</value> </valuemap> </data> <data> @@ -128,14 +128,14 @@ <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-YjhocK9Z3d,guid=e9e5f2da71aeced554355e6f00596ece</value> + <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-dwXmVzGpRA,guid=2e4bb3ce70c39fa5e5288771006655e3</value> <value type="QString">DESKTOP_SESSION=fluxbox</value> <value type="QString">DISPLAY=:0.0</value> <value type="QString">GDMSESSION=fluxbox</value> <value type="QString">GDM_LANG=fr_FR.UTF-8</value> <value type="QString">GDM_XSERVER_LOCATION=local</value> - <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-INUHb2</value> - <value type="QString">GNOME_KEYRING_PID=27655</value> + <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-9aAGCJ</value> + <value type="QString">GNOME_KEYRING_PID=19876</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> @@ -143,20 +143,20 @@ <value type="QString">LOGNAME=froger_a</value> <value type="QString">OLDPWD=/lrde/home/stage/froger_a/qt</value> <value type="QString">PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games</value> - <value type="QString">PWD=/lrde/home/stage/froger_a/qt/XmlParser</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=27730</value> - <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-aIvoE27664/agent.27664</value> + <value type="QString">SSH_AGENT_PID=19951</value> + <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-kVrax19885/agent.19885</value> <value type="QString">TERM=xterm</value> <value type="QString">USER=froger_a</value> <value type="QString">USERNAME=froger_a</value> <value type="QString">WINDOWID=10485796</value> - <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8</value> - <value type="QString">XAUTHORITY=/tmp/.gdmJEZ7QW</value> + <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> + <value type="QString">XAUTHORITY=/tmp/.gdm0ICXQW</value> <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> - <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1357908881.805303-96205090</value> + <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358754471.558659-246518931</value> <value type="QString">XPSERVERLIST=:64 </value> <value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value> <value type="QString">XTERM_SHELL=/bin/bash</value> @@ -169,7 +169,7 @@ </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/XmlParser</value> + <value key="abstractProcess.workingDirectory" type="QString">/amd/nfs/volume1/home/stage/froger_a/qt/GScribo</value> </valuemap> </data> <data> diff --git a/XmlParser/configs.h b/TestInterface/config.h similarity index 100% copy from XmlParser/configs.h copy to TestInterface/config.h diff --git a/XmlParser/dir.h b/TestInterface/dir.h similarity index 100% copy from XmlParser/dir.h copy to TestInterface/dir.h diff --git a/XmlParser/main.cpp b/TestInterface/main.cpp similarity index 70% copy from XmlParser/main.cpp copy to TestInterface/main.cpp index aecf5cd..4636dff 100644 --- a/XmlParser/main.cpp +++ b/TestInterface/main.cpp @@ -1,5 +1,3 @@ -#undef MLN_WO_GLOBAL_VARS - #include <mln/labeling/colorize.hh> #include <mln/math/pi.hh> #include <mln/io/magick/load.hh> @@ -7,11 +5,16 @@ #include <mln/debug/filename.hh> #include <scribo/make/debug_filename.hh> #include <QtGui/QApplication> + #include "mainwindow.h" -int main(int argc, char **argv) +int main(int argc, char *argv[]) { Magick::InitializeMagick(*argv); + /* + On Linux, we NEED to use the raster graphics system. + Linux don't really support X11 graphics system (the default one). + */ QApplication::setGraphicsSystem("raster"); QApplication a(argc, argv); MainWindow w; diff --git a/TestInterface/mainwindow.cpp b/TestInterface/mainwindow.cpp new file mode 100644 index 0000000..89634e3 --- /dev/null +++ b/TestInterface/mainwindow.cpp @@ -0,0 +1,75 @@ +#include "mainwindow.h" +#include "ui_mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::MainWindow) +{ + ui->setupUi(this); + + + /* Central window to adjust all widgets's size inside it. */ + QWidget *window = new QWidget(); + QHBoxLayout *mainLayout = new QHBoxLayout(window); + mainLayout->setSpacing(8); + setCentralWidget(window); + // + + initGraphicsRegion(window, mainLayout); + initTextRegion(window, mainLayout); +} + +MainWindow::~MainWindow() +{ + delete scene; + delete graphicsView; + delete textEdit; + delete ui; +} + +void MainWindow::initGraphicsRegion(QWidget *parent, QLayout *layout) +{ + QGroupBox *graphicsBox = new QGroupBox(tr("Image"), parent); + graphicsBox->setFlat(true); + graphicsBox->setAlignment(Qt::AlignHCenter); + + graphicsView = new QGraphicsView(); + // Cache backgroud to speed up its repaint. + graphicsView->setCacheMode(QGraphicsView::CacheBackground); + graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate); + + scene = new Scene(); + // Disable scroll bar extend with a non-null rectangle. + scene->setSceneRect(0, 0, 0, 1); + graphicsView->setScene(scene); + + QHBoxLayout *graphicsLayout = new QHBoxLayout(graphicsBox); + graphicsLayout->addWidget(graphicsView); + layout->addWidget(graphicsBox); +} + +void MainWindow::initTextRegion(QWidget *parent, QLayout *layout) +{ + QGroupBox *textBox = new QGroupBox(tr("Previsualization"), parent); + textBox->setFlat(true); + textBox->setAlignment(Qt::AlignHCenter); + + textEdit = new QPlainTextEdit(textBox); + + QHBoxLayout *textLayout = new QHBoxLayout(textBox); + textLayout->addWidget(textEdit); + layout->addWidget(textBox); +} + +void MainWindow::changeEvent(QEvent *e) +{ + QMainWindow::changeEvent(e); + switch (e->type()) + { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/TestInterface/mainwindow.h b/TestInterface/mainwindow.h new file mode 100644 index 0000000..b4728ad --- /dev/null +++ b/TestInterface/mainwindow.h @@ -0,0 +1,40 @@ +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include <QMainWindow> +#include <QHBoxLayout> +#include <QDockWidget> +#include <QGraphicsView> +#include <QGLWidget> +#include <QPlainTextEdit> +#include <QGroupBox> + +#include "scene.h" + +namespace Ui +{ + class MainWindow; +} + +class MainWindow : public QMainWindow +{ + Q_OBJECT + + public: + MainWindow(QWidget *parent = 0); + ~MainWindow(); + + protected: + void changeEvent(QEvent *e); + + private: + void initGraphicsRegion(QWidget *parent, QLayout *layout); + void initTextRegion(QWidget *parent, QLayout *layout); + + Ui::MainWindow *ui; + Scene *scene; + QGraphicsView *graphicsView; + QPlainTextEdit *textEdit; +}; + +#endif // MAINWINDOW_H diff --git a/Test/test.ui b/TestInterface/mainwindow.ui similarity index 60% copy from Test/test.ui copy to TestInterface/mainwindow.ui index 5fb0299..0c25302 100644 --- a/Test/test.ui +++ b/TestInterface/mainwindow.ui @@ -1,39 +1,29 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Test</class> - <widget class="QMainWindow" name="Test"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>919</width> - <height>562</height> + <width>600</width> + <height>400</height> </rect> </property> <property name="windowTitle"> - <string>Test</string> + <string>MainWindow</string> </property> <widget class="QWidget" name="centralWidget"> - <widget class="QLabel" name="label"> - <property name="geometry"> - <rect> - <x>250</x> - <y>130</y> - <width>341</width> - <height>181</height> - </rect> - </property> - <property name="text"> - <string/> - </property> - </widget> + <property name="enabled"> + <bool>true</bool> + </property> </widget> <widget class="QMenuBar" name="menuBar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>919</width> + <width>600</width> <height>23</height> </rect> </property> @@ -43,15 +33,10 @@ <enum>TopToolBarArea</enum> </attribute> <attribute name="toolBarBreak"> - <bool>true</bool> + <bool>false</bool> </attribute> </widget> <widget class="QStatusBar" name="statusBar"/> - <action name="actionLoad"> - <property name="text"> - <string>Load</string> - </property> - </action> </widget> <layoutdefault spacing="6" margin="11"/> <resources/> diff --git a/XmlParser/polygonitem.cpp b/TestInterface/polygonitem.cpp similarity index 100% copy from XmlParser/polygonitem.cpp copy to TestInterface/polygonitem.cpp diff --git a/XmlParser/polygonitem.h b/TestInterface/polygonitem.h similarity index 100% copy from XmlParser/polygonitem.h copy to TestInterface/polygonitem.h diff --git a/XmlParser/preprocess.cpp b/TestInterface/preprocess.cpp similarity index 100% copy from XmlParser/preprocess.cpp copy to TestInterface/preprocess.cpp diff --git a/XmlParser/preprocess.h b/TestInterface/preprocess.h similarity index 100% copy from XmlParser/preprocess.h copy to TestInterface/preprocess.h diff --git a/XmlParser/process.cpp b/TestInterface/process.cpp similarity index 100% copy from XmlParser/process.cpp copy to TestInterface/process.cpp diff --git a/XmlParser/process.h b/TestInterface/process.h similarity index 100% copy from XmlParser/process.h copy to TestInterface/process.h diff --git a/XmlParser/progressdialog.cpp b/TestInterface/progressdialog.cpp similarity index 100% copy from XmlParser/progressdialog.cpp copy to TestInterface/progressdialog.cpp diff --git a/XmlParser/progressdialog.h b/TestInterface/progressdialog.h similarity index 100% copy from XmlParser/progressdialog.h copy to TestInterface/progressdialog.h diff --git a/XmlParser/runner.cpp b/TestInterface/runner.cpp similarity index 100% copy from XmlParser/runner.cpp copy to TestInterface/runner.cpp diff --git a/XmlParser/runner.h b/TestInterface/runner.h similarity index 100% copy from XmlParser/runner.h copy to TestInterface/runner.h diff --git a/XmlParser/scene.cpp b/TestInterface/scene.cpp similarity index 86% copy from XmlParser/scene.cpp copy to TestInterface/scene.cpp index 612d2bd..d65b85a 100644 --- a/XmlParser/scene.cpp +++ b/TestInterface/scene.cpp @@ -48,6 +48,7 @@ void Scene::mousePressEvent(QGraphicsSceneMouseEvent *event) isPressing = true; clic = true; pressPos = event->scenePos(); + selection->show(); } } @@ -74,13 +75,8 @@ void Scene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) isPressing = false; if(clic) selection->setRect(QRectF(QPointF(0, 0), event->scenePos())); - emit repaintItems(selection->rect(), clic); + emit repaintItem(selection->rect(), clic); selection->setRect(0, 0, 0, 0); + selection->hide(); } } - -QString Scene::debug(QRect &rect) -{ - return "Position : " + QString::number(rect.x()) + ", " + QString::number(rect.y()) + "\n" + - "Size : " + QString::number(rect.width()) + ", " + QString::number(rect.height()); -} diff --git a/XmlParser/scene.h b/TestInterface/scene.h similarity index 86% copy from XmlParser/scene.h copy to TestInterface/scene.h index b7294c6..0560cbd 100644 --- a/XmlParser/scene.h +++ b/TestInterface/scene.h @@ -3,6 +3,7 @@ #include <QGraphicsScene> #include <QGraphicsSceneMouseEvent> + #include "selection.h" #include "polygonitem.h" @@ -25,7 +26,6 @@ class Scene : private: void init(); - QString debug(QRect &rect); Selection *selection; QPointF pressPos; @@ -33,8 +33,7 @@ class Scene : bool clic; signals: - void repaintItems(const QRectF& rect, bool clic); - void sendString(QString& string); + void repaintItem(const QRectF& rect, bool clic); }; #endif // SCENE_H diff --git a/XmlParser/selection.cpp b/TestInterface/selection.cpp similarity index 96% copy from XmlParser/selection.cpp copy to TestInterface/selection.cpp index 51e3fe5..1f696ce 100644 --- a/XmlParser/selection.cpp +++ b/TestInterface/selection.cpp @@ -24,7 +24,7 @@ void Selection::init() QPen pen; pen.setStyle(Qt::DashLine); pen.setCapStyle(Qt::SquareCap); - pen.setWidth(1); + pen.setCosmetic(true); setPen(pen); QBrush brush; brush.setStyle(Qt::Dense4Pattern); diff --git a/XmlParser/selection.h b/TestInterface/selection.h similarity index 99% copy from XmlParser/selection.h copy to TestInterface/selection.h index dad1038..4864e15 100644 --- a/XmlParser/selection.h +++ b/TestInterface/selection.h @@ -5,7 +5,6 @@ #include <QPen> #include <climits> - class Selection : public QGraphicsRectItem { diff --git a/XmlParser/xml.cpp b/TestInterface/xml.cpp similarity index 100% copy from XmlParser/xml.cpp copy to TestInterface/xml.cpp diff --git a/XmlParser/xml.h b/TestInterface/xml.h similarity index 100% copy from XmlParser/xml.h copy to TestInterface/xml.h diff --git a/XmlParser/XmlParser.pro b/XmlParser/XmlParser.pro index 597fc47..e673c8e 100644 --- a/XmlParser/XmlParser.pro +++ b/XmlParser/XmlParser.pro @@ -1,7 +1,8 @@ # ------------------------------------------------- # Project created by QtCreator 2013-01-11T14:21:43 # ------------------------------------------------- -QT += xml +QT += xml \ + opengl TARGET = XmlParser TEMPLATE = app INCLUDEPATH += /lrde/home/stage/froger_a/olena/milena/ \ diff --git a/XmlParser/XmlParser.pro.user b/XmlParser/XmlParser.pro.user index 9eea455..4041e71 100644 --- a/XmlParser/XmlParser.pro.user +++ b/XmlParser/XmlParser.pro.user @@ -188,14 +188,14 @@ <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-E5D7SPzCvM,guid=d599357c9b4b11459397a7040062a9e9</value> + <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-dwXmVzGpRA,guid=2e4bb3ce70c39fa5e5288771006655e3</value> <value type="QString">DESKTOP_SESSION=fluxbox</value> <value type="QString">DISPLAY=:0.0</value> <value type="QString">GDMSESSION=fluxbox</value> <value type="QString">GDM_LANG=fr_FR.UTF-8</value> <value type="QString">GDM_XSERVER_LOCATION=local</value> - <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-IhfkdE</value> - <value type="QString">GNOME_KEYRING_PID=8615</value> + <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-9aAGCJ</value> + <value type="QString">GNOME_KEYRING_PID=19876</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> @@ -207,16 +207,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=8690</value> - <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-znXRds8624/agent.8624</value> + <value type="QString">SSH_AGENT_PID=19951</value> + <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-kVrax19885/agent.19885</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=16777252</value> - <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> - <value type="QString">XAUTHORITY=/tmp/.gdmLS4BRW</value> + <value type="QString">WINDOWID=10485796</value> + <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> + <value type="QString">XAUTHORITY=/tmp/.gdm0ICXQW</value> <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> - <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358513837.420735-2094239602</value> + <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358754471.558659-246518931</value> <value type="QString">XPSERVERLIST=:64 </value> <value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value> <value type="QString">XTERM_SHELL=/bin/bash</value> @@ -239,14 +239,14 @@ <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-E5D7SPzCvM,guid=d599357c9b4b11459397a7040062a9e9</value> + <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-dwXmVzGpRA,guid=2e4bb3ce70c39fa5e5288771006655e3</value> <value type="QString">DESKTOP_SESSION=fluxbox</value> <value type="QString">DISPLAY=:0.0</value> <value type="QString">GDMSESSION=fluxbox</value> <value type="QString">GDM_LANG=fr_FR.UTF-8</value> <value type="QString">GDM_XSERVER_LOCATION=local</value> - <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-IhfkdE</value> - <value type="QString">GNOME_KEYRING_PID=8615</value> + <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-9aAGCJ</value> + <value type="QString">GNOME_KEYRING_PID=19876</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> @@ -258,16 +258,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=8690</value> - <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-znXRds8624/agent.8624</value> + <value type="QString">SSH_AGENT_PID=19951</value> + <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-kVrax19885/agent.19885</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=16777252</value> - <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> - <value type="QString">XAUTHORITY=/tmp/.gdmLS4BRW</value> + <value type="QString">WINDOWID=10485796</value> + <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> + <value type="QString">XAUTHORITY=/tmp/.gdm0ICXQW</value> <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> - <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358513837.420735-2094239602</value> + <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358754471.558659-246518931</value> <value type="QString">XPSERVERLIST=:64 </value> <value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value> <value type="QString">XTERM_SHELL=/bin/bash</value> diff --git a/XmlParser/main.cpp b/XmlParser/main.cpp index aecf5cd..f9678ac 100644 --- a/XmlParser/main.cpp +++ b/XmlParser/main.cpp @@ -12,6 +12,11 @@ int main(int argc, char **argv) { Magick::InitializeMagick(*argv); + /******************************************************************* + On Linux, we NEED to use the raster graphics system. + Linux don't really support X11 graphics system (the default one). + VERY IMPORTANT. + ********************************************************************/ QApplication::setGraphicsSystem("raster"); QApplication a(argc, argv); MainWindow w; diff --git a/XmlParser/mainwindow.cpp b/XmlParser/mainwindow.cpp index a9415cf..323b74a 100644 --- a/XmlParser/mainwindow.cpp +++ b/XmlParser/mainwindow.cpp @@ -10,6 +10,7 @@ MainWindow::MainWindow(QWidget *parent): QVBoxLayout *gBLayout = new QVBoxLayout; gBLayout->addWidget(ui->graphicsView); ui->groupBox->setLayout(gBLayout); + // Cache the background for repaint optimization. ui->graphicsView->setCacheMode(QGraphicsView::CacheBackground); scene = new Scene(ui->graphicsView); scene->setSceneRect(ui->graphicsView->geometry()); diff --git a/XmlParser/mainwindow.h b/XmlParser/mainwindow.h index e8e899a..f6c7fb5 100644 --- a/XmlParser/mainwindow.h +++ b/XmlParser/mainwindow.h @@ -6,6 +6,7 @@ #include <QVBoxLayout> #include <QFileDialog> #include <QProgressDialog> +#include <QGLWidget> #include "scene.h" #include "toolbar.h" #include "xml.h" diff --git a/XmlParser/scene.cpp b/XmlParser/scene.cpp index 612d2bd..1d8aaf6 100644 --- a/XmlParser/scene.cpp +++ b/XmlParser/scene.cpp @@ -48,6 +48,7 @@ void Scene::mousePressEvent(QGraphicsSceneMouseEvent *event) isPressing = true; clic = true; pressPos = event->scenePos(); + selection->show(); } } @@ -76,6 +77,7 @@ void Scene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) selection->setRect(QRectF(QPointF(0, 0), event->scenePos())); emit repaintItems(selection->rect(), clic); selection->setRect(0, 0, 0, 0); + selection->hide(); } } -- 1.7.2.5