b16ebc4 Finish pages viewer (just one little problem) and add config dialog.

--- GScribo/GScribo.pro | 52 ++++-- GScribo/GScribo.pro.user | 113 +++++++----- GScribo/{ => PagesViewer}/listmodel.cpp | 14 ++- GScribo/{ => PagesViewer}/listmodel.h | 3 +- GScribo/PagesViewer/pageswidget.cpp | 30 ++++ GScribo/{ => PagesViewer}/pageswidget.h | 13 +- GScribo/Preferences/generaloptions.ui | 100 +++++++++++ GScribo/Preferences/ocroptions.ui | 62 +++++++ GScribo/Preferences/optionwidget.cpp | 14 ++ GScribo/Preferences/optionwidget.h | 15 ++ GScribo/Preferences/preferencesdialog.ui | 121 +++++++++++++ GScribo/Preferences/preprocessingoptions.ui | 76 ++++++++ GScribo/Preferences/segmentationoptions.ui | 52 ++++++ GScribo/{ => Processing}/preprocess.cpp | 0 GScribo/{ => Processing}/preprocess.h | 4 +- GScribo/{ => Processing}/process.cpp | 0 GScribo/{ => Processing}/process.h | 4 +- GScribo/{ => Processing}/progressdialog.cpp | 0 GScribo/{ => Processing}/progressdialog.h | 0 GScribo/{ => Processing}/runner.cpp | 8 - GScribo/{ => Processing}/runner.h | 15 +- GScribo/Rendering/polygonitem.cpp | 76 ++++++++ GScribo/{ => Rendering}/polygonitem.h | 9 +- GScribo/Rendering/scene.cpp | 101 +++++++++++ GScribo/{ => Rendering}/scene.h | 7 +- GScribo/{ => Rendering}/selection.cpp | 3 + GScribo/{ => Rendering}/selection.h | 0 {XmlParser => GScribo}/configs.cpp | 34 ++++- GScribo/{config.h => configs.h} | 3 + GScribo/dir.h | 2 +- GScribo/icon.cpp | 26 --- GScribo/icon.h | 21 --- GScribo/mainwindow.ui | 8 +- GScribo/pageswidget.cpp | 19 -- GScribo/polygonitem.cpp | 75 -------- {XmlParser => GScribo}/region.h | 0 GScribo/scene.cpp | 82 --------- GScribo/ui_mainwindow.h | 73 -------- MVC/MVC.pro | 13 -- MVC/MVC.pro.user | 251 --------------------------- MVC/itemdelegate.cpp | 19 -- MVC/itemdelegate.h | 17 -- MVC/listmodel.cpp | 32 ---- MVC/listmodel.h | 24 --- MVC/main.cpp | 11 -- MVC/mainwindow.cpp | 40 ----- MVC/mainwindow.h | 30 ---- MVC/mainwindow.ui | 24 --- MVC/ui_mainwindow.h | 70 -------- XmlParser/XmlParser.pro.user | 38 ++-- gmvc/gmodel.cpp | 162 ----------------- gmvc/gmodel.h | 34 ---- gmvc/gmvc.pro | 13 -- gmvc/gmvc.pro.user | 251 --------------------------- gmvc/main.cpp | 11 -- gmvc/mainwindow.cpp | 51 ------ gmvc/mainwindow.h | 28 --- gmvc/mainwindow.ui | 24 --- gmvc/model.cpp | 37 ---- gmvc/model.h | 20 -- 60 files changed, 860 insertions(+), 1575 deletions(-) rename GScribo/{ => PagesViewer}/listmodel.cpp (62%) rename GScribo/{ => PagesViewer}/listmodel.h (80%) create mode 100644 GScribo/PagesViewer/pageswidget.cpp rename GScribo/{ => PagesViewer}/pageswidget.h (67%) create mode 100644 GScribo/Preferences/generaloptions.ui create mode 100644 GScribo/Preferences/ocroptions.ui create mode 100644 GScribo/Preferences/optionwidget.cpp create mode 100644 GScribo/Preferences/optionwidget.h create mode 100644 GScribo/Preferences/preferencesdialog.ui create mode 100644 GScribo/Preferences/preprocessingoptions.ui create mode 100644 GScribo/Preferences/segmentationoptions.ui rename GScribo/{ => Processing}/preprocess.cpp (100%) rename GScribo/{ => Processing}/preprocess.h (100%) rename GScribo/{ => Processing}/process.cpp (100%) rename GScribo/{ => Processing}/process.h (100%) rename GScribo/{ => Processing}/progressdialog.cpp (100%) rename GScribo/{ => Processing}/progressdialog.h (100%) rename GScribo/{ => Processing}/runner.cpp (95%) rename GScribo/{ => Processing}/runner.h (99%) create mode 100644 GScribo/Rendering/polygonitem.cpp rename GScribo/{ => Rendering}/polygonitem.h (80%) create mode 100644 GScribo/Rendering/scene.cpp rename GScribo/{ => Rendering}/scene.h (85%) rename GScribo/{ => Rendering}/selection.cpp (94%) rename GScribo/{ => Rendering}/selection.h (100%) rename {XmlParser => GScribo}/configs.cpp (95%) rename GScribo/{config.h => configs.h} (93%) delete mode 100644 GScribo/icon.cpp delete mode 100644 GScribo/icon.h delete mode 100644 GScribo/pageswidget.cpp delete mode 100644 GScribo/polygonitem.cpp copy {XmlParser => GScribo}/region.h (100%) delete mode 100644 GScribo/scene.cpp delete mode 100644 GScribo/ui_mainwindow.h delete mode 100644 MVC/MVC.pro delete mode 100644 MVC/MVC.pro.user delete mode 100644 MVC/itemdelegate.cpp delete mode 100644 MVC/itemdelegate.h delete mode 100644 MVC/listmodel.cpp delete mode 100644 MVC/listmodel.h delete mode 100644 MVC/main.cpp delete mode 100644 MVC/mainwindow.cpp delete mode 100644 MVC/mainwindow.h delete mode 100644 MVC/mainwindow.ui delete mode 100644 MVC/ui_mainwindow.h delete mode 100644 gmvc/gmodel.cpp delete mode 100644 gmvc/gmodel.h delete mode 100644 gmvc/gmvc.pro delete mode 100644 gmvc/gmvc.pro.user delete mode 100644 gmvc/main.cpp delete mode 100644 gmvc/mainwindow.cpp delete mode 100644 gmvc/mainwindow.h delete mode 100644 gmvc/mainwindow.ui delete mode 100644 gmvc/model.cpp delete mode 100644 gmvc/model.h diff --git a/GScribo/GScribo.pro b/GScribo/GScribo.pro index 57041dc..9ca65f6 100644 --- a/GScribo/GScribo.pro +++ b/GScribo/GScribo.pro @@ -1,8 +1,7 @@ # ------------------------------------------------- # Project created by QtCreator 2013-01-21T09:20:54 # ------------------------------------------------- -QT += opengl \ - xml +QT += xml INCLUDEPATH += /lrde/home/stage/froger_a/olena/milena/ \ /lrde/home/stage/froger_a/olena/scribo/ \ /lrde/home/stage/froger_a/olena/_build/scribo/demo/ @@ -15,15 +14,42 @@ TARGET = GScribo TEMPLATE = app SOURCES += main.cpp \ mainwindow.cpp \ - scene.cpp \ - selection.cpp \ - pageswidget.cpp \ - listmodel.cpp \ - icon.cpp + configs.cpp \ + Rendering/scene.cpp \ + Rendering/selection.cpp \ + PagesViewer/pageswidget.cpp \ + PagesViewer/listmodel.cpp \ + Preferences/segmentationoptions.cpp \ + Preferences/preprocessingoptions.cpp \ + Preferences/ocroptions.cpp \ + Preferences/generaloptions.cpp \ + Preferences/optionwidget.cpp \ + Preferences/preferencesdialog.cpp \ + Rendering/polygonitem.cpp \ + Processing/progressdialog.cpp \ + Processing/process.cpp \ + Processing/preprocess.cpp HEADERS += mainwindow.h \ - scene.h \ - selection.h \ - pageswidget.h \ - listmodel.h \ - icon.h -FORMS += mainwindow.ui + configs.h \ + region.h \ + Rendering/scene.h \ + Rendering/selection.h \ + PagesViewer/pageswidget.h \ + PagesViewer/listmodel.h \ + Preferences/segmentationoptions.h \ + Preferences/preprocessingoptions.h \ + Preferences/ocroptions.h \ + Preferences/generaloptions.h \ + Preferences/optionwidget.h \ + Preferences/preferencesdialog.h \ + Rendering/polygonitem.h \ + Processing/preprocess.h \ + Processing/progressdialog.h \ + Processing/process.h \ + dir.h +FORMS += mainwindow.ui \ + Preferences/preferencesdialog.ui \ + Preferences/ocroptions.ui \ + Preferences/segmentationoptions.ui \ + Preferences/generaloptions.ui \ + Preferences/preprocessingoptions.ui diff --git a/GScribo/GScribo.pro.user b/GScribo/GScribo.pro.user index 13a97a6..e3df61a 100644 --- a/GScribo/GScribo.pro.user +++ b/GScribo/GScribo.pro.user @@ -56,55 +56,46 @@ <variable>buildConfiguration-Debug</variable> <valuemap type="QVariantMap"> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> - <value key="QtVersionId" type="int">0</value> + <value key="QtVersionId" type="int">2</value> <value key="ToolChain" type="int">0</value> - <value key="addQDumper" type=""></value> <value key="buildConfiguration" type="int">2</value> </valuemap> </data> <data> - <variable>buildConfiguration-Release</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> - <value key="QtVersionId" type="int">0</value> - <value key="addQDumper" type=""></value> - <value key="buildConfiguration" type="int">0</value> - </valuemap> - </data> - <data> <variable>buildconfiguration-Debug-buildstep0</variable> <valuemap type="QVariantMap"> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <valuelist key="abstractProcess.Environment" type="QVariantList"> - <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-0VAN4sEd5T,guid=75a5318e040070f8fcb70ccf006944fa</value> + <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Rm9H5yDUD5,guid=00a0d6b325751c50c00c26e2006a9203</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-nVYZaO</value> - <value type="QString">GNOME_KEYRING_PID=27939</value> + <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-kTB4J7</value> + <value type="QString">GNOME_KEYRING_PID=27564</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">HOME=/lrde/home/stage/froger_a</value> <value type="QString">LANG=fr_FR.UTF-8</value> + <value type="QString">LANGUAGE=</value> <value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value> <value type="QString">LOGNAME=froger_a</value> - <value type="QString">OLDPWD=/lrde/home/stage/froger_a/qt</value> + <value type="QString">OLDPWD=/lrde/home/stage/froger_a/qt/GScribo/Preferences</value> <value type="QString">PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games</value> <value type="QString">PWD=/lrde/home/stage/froger_a/qt/GScribo</value> <value type="QString">QTDIR=/usr/share/qt4</value> <value type="QString">SHELL=/bin/bash</value> <value type="QString">SHLVL=2</value> - <value type="QString">SSH_AGENT_PID=28014</value> - <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-yzfMR27948/agent.27948</value> + <value type="QString">SSH_AGENT_PID=27639</value> + <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-qeVjd27573/agent.27573</value> <value type="QString">TERM=xterm</value> <value type="QString">USER=froger_a</value> <value type="QString">USERNAME=froger_a</value> <value type="QString">WINDOWID=10485796</value> - <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> - <value type="QString">XAUTHORITY=/tmp/.gdmBDX0QW</value> + <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> + <value type="QString">XAUTHORITY=/tmp/.gdm9DVURW</value> <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> - <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358946750.592912-119709926</value> + <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1359032006.901905-2088645706</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> @@ -128,35 +119,36 @@ <valuemap type="QVariantMap"> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> <valuelist key="abstractProcess.Environment" type="QVariantList"> - <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-0VAN4sEd5T,guid=75a5318e040070f8fcb70ccf006944fa</value> + <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Rm9H5yDUD5,guid=00a0d6b325751c50c00c26e2006a9203</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-nVYZaO</value> - <value type="QString">GNOME_KEYRING_PID=27939</value> + <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-kTB4J7</value> + <value type="QString">GNOME_KEYRING_PID=27564</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">HOME=/lrde/home/stage/froger_a</value> <value type="QString">LANG=fr_FR.UTF-8</value> + <value type="QString">LANGUAGE=</value> <value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value> <value type="QString">LOGNAME=froger_a</value> - <value type="QString">OLDPWD=/lrde/home/stage/froger_a/qt</value> + <value type="QString">OLDPWD=/lrde/home/stage/froger_a/qt/GScribo/Preferences</value> <value type="QString">PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games</value> <value type="QString">PWD=/lrde/home/stage/froger_a/qt/GScribo</value> <value type="QString">QTDIR=/usr/share/qt4</value> <value type="QString">SHELL=/bin/bash</value> <value type="QString">SHLVL=2</value> - <value type="QString">SSH_AGENT_PID=28014</value> - <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-yzfMR27948/agent.27948</value> + <value type="QString">SSH_AGENT_PID=27639</value> + <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-qeVjd27573/agent.27573</value> <value type="QString">TERM=xterm</value> <value type="QString">USER=froger_a</value> <value type="QString">USERNAME=froger_a</value> <value type="QString">WINDOWID=10485796</value> - <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> - <value type="QString">XAUTHORITY=/tmp/.gdmBDX0QW</value> + <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> + <value type="QString">XAUTHORITY=/tmp/.gdm9DVURW</value> <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> - <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358946750.592912-119709926</value> + <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1359032006.901905-2088645706</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> @@ -176,6 +168,50 @@ <variable>buildconfiguration-Debug-cleanstep0</variable> <valuemap type="QVariantMap"> <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> + <valuelist key="abstractProcess.Environment" type="QVariantList"> + <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Rm9H5yDUD5,guid=00a0d6b325751c50c00c26e2006a9203</value> + <value type="QString">DESKTOP_SESSION=fluxbox</value> + <value type="QString">DISPLAY=:0.0</value> + <value type="QString">GDMSESSION=fluxbox</value> + <value type="QString">GDM_LANG=fr_FR.UTF-8</value> + <value type="QString">GDM_XSERVER_LOCATION=local</value> + <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-kTB4J7</value> + <value type="QString">GNOME_KEYRING_PID=27564</value> + <value type="QString">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/GScribo/Preferences</value> + <value type="QString">PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games</value> + <value type="QString">PWD=/lrde/home/stage/froger_a/qt/GScribo</value> + <value type="QString">QTDIR=/usr/share/qt4</value> + <value type="QString">SHELL=/bin/bash</value> + <value type="QString">SHLVL=2</value> + <value type="QString">SSH_AGENT_PID=27639</value> + <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-qeVjd27573/agent.27573</value> + <value type="QString">TERM=xterm</value> + <value type="QString">USER=froger_a</value> + <value type="QString">USERNAME=froger_a</value> + <value type="QString">WINDOWID=10485796</value> + <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> + <value type="QString">XAUTHORITY=/tmp/.gdm9DVURW</value> + <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> + <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1359032006.901905-2088645706</value> + <value type="QString">XPSERVERLIST=:64 </value> + <value type="QString">XTERM_LOCALE=fr_FR.UTF-8</value> + <value type="QString">XTERM_SHELL=/bin/bash</value> + <value type="QString">XTERM_VERSION=XTerm(261)</value> + <value type="QString">_=/usr/bin/qtcreator</value> + </valuelist> + <value key="abstractProcess.IgnoreReturnValue" type="bool">true</value> + <valuelist key="abstractProcess.arguments" type="QVariantList"> + <value type="QString">clean</value> + <value type="QString">-w</value> + </valuelist> + <value key="abstractProcess.command" type="QString">/usr/bin/make</value> + <value key="abstractProcess.enabled" type="bool">true</value> + <value key="abstractProcess.workingDirectory" type="QString">/amd/nfs/volume1/home/stage/froger_a/qt/GScribo</value> <value key="cleanConfig" type="bool">true</value> <valuelist key="makeargs" type="QVariantList"> <value type="QString">clean</value> @@ -183,28 +219,9 @@ </valuemap> </data> <data> - <variable>buildconfiguration-Release-buildstep0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> - </valuemap> - </data> - <data> - <variable>buildconfiguration-Release-buildstep1</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> - </valuemap> - </data> - <data> - <variable>buildconfiguration-Release-cleanstep0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> - </valuemap> - </data> - <data> <variable>buildconfigurations</variable> <valuelist type="QVariantList"> <value type="QString">Debug</value> - <value type="QString">Release</value> </valuelist> </data> <data> diff --git a/GScribo/listmodel.cpp b/GScribo/PagesViewer/listmodel.cpp similarity index 62% rename from GScribo/listmodel.cpp rename to GScribo/PagesViewer/listmodel.cpp index de0087a..6fd60db 100644 --- a/GScribo/listmodel.cpp +++ b/GScribo/PagesViewer/listmodel.cpp @@ -18,13 +18,25 @@ QVariant ListModel::data(const QModelIndex& index, int role) const if(role == Qt::DecorationRole) return QIcon(pixmaps.value(index.row()).scaled(QSize(200, 200), Qt::KeepAspectRatio, Qt::SmoothTransformation)); + // Store the original pixmap in a custom place. + if(role == Qt::UserRole) + return pixmaps.value(index.row()); + + // Store the path of the pixmap in an other custom place. + if(role == Qt::UserRole+1) + return filenames.value(index.row()); + return QVariant(); } -void ListModel::addPixmap(const QPixmap& pixmap) +void ListModel::addPixmap(const QString& filename, const QPixmap& pixmap) { int row = pixmaps.size(); + beginInsertRows(QModelIndex(), row, row); + pixmaps.insert(row, pixmap); + filenames.insert(row, filename); + endInsertRows(); } diff --git a/GScribo/listmodel.h b/GScribo/PagesViewer/listmodel.h similarity index 80% rename from GScribo/listmodel.h rename to GScribo/PagesViewer/listmodel.h index 03469b5..2f0350e 100644 --- a/GScribo/listmodel.h +++ b/GScribo/PagesViewer/listmodel.h @@ -14,10 +14,11 @@ class ListModel: explicit ListModel(QObject *parent = 0); int rowCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role = Qt::DecorationRole) const; - void addPixmap(const QPixmap& pixmap); + void addPixmap(const QString& filename, const QPixmap& pixmap); private: QList<QPixmap> pixmaps; + QList<QString> filenames; }; #endif // LISTMODEL_H diff --git a/GScribo/PagesViewer/pageswidget.cpp b/GScribo/PagesViewer/pageswidget.cpp new file mode 100644 index 0000000..712f5eb --- /dev/null +++ b/GScribo/PagesViewer/pageswidget.cpp @@ -0,0 +1,30 @@ +#include "pageswidget.h" + +PagesWidget::PagesWidget(QWidget *parent): + QListView(parent) +{ + setUniformItemSizes(true); + setViewMode(QListView::IconMode); + setIconSize(QSize(200, 200)); + setFlow(QListView::TopToBottom); + setMovement(QListView::Static); + setSpacing(10); + setWrapping(false); + setModel(&model); + + connect(this, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(getSelection(QModelIndex))); +} + +void PagesWidget::addPixmap(const QString& filename, const QPixmap &pixmap) +{ + model.addPixmap(filename, pixmap); +} + +void PagesWidget::getSelection(const QModelIndex &index) +{ + // Get the pixmap and the path of the icon to send it to the scene and draw it. + QPixmap pixmap = index.data(Qt::UserRole).value<QPixmap>(); + QString filename = index.data(Qt::UserRole+1).toString(); + + emit selectionClicked(filename, pixmap); +} diff --git a/GScribo/pageswidget.h b/GScribo/PagesViewer/pageswidget.h similarity index 67% rename from GScribo/pageswidget.h rename to GScribo/PagesViewer/pageswidget.h index fade0d6..ae17a4a 100644 --- a/GScribo/pageswidget.h +++ b/GScribo/PagesViewer/pageswidget.h @@ -1,11 +1,11 @@ #ifndef PAGESWIDGET_H #define PAGESWIDGET_H -#include <QWidget> -#include <QListView> -#include <QPainter> #include <QPushButton> #include <QScrollBar> +#include <QListView> +#include <QPainter> +#include <QWidget> #include "listmodel.h" @@ -20,6 +20,13 @@ class PagesWidget: private: ListModel model; + + public slots: + void getSelection(const QModelIndex &index); + + signals: + void clicked(const QModelIndex &index); + void selectionClicked(const QString& filename, const QPixmap& pixmap); }; #endif // PAGESWIDGET_H diff --git a/GScribo/Preferences/generaloptions.ui b/GScribo/Preferences/generaloptions.ui new file mode 100644 index 0000000..5839c27 --- /dev/null +++ b/GScribo/Preferences/generaloptions.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/GScribo/Preferences/ocroptions.ui b/GScribo/Preferences/ocroptions.ui new file mode 100644 index 0000000..d001c64 --- /dev/null +++ b/GScribo/Preferences/ocroptions.ui @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>OcrOptions</class> + <widget class="QWidget" name="OcrOptions"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>366</width> + <height>112</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QGroupBox" name="enable_ocr"> + <property name="title"> + <string>Enable OCR</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> + </property> + <property name="flat"> + <bool>true</bool> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="1" column="1"> + <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> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Language</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="ocr_language"/> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/GScribo/Preferences/optionwidget.cpp b/GScribo/Preferences/optionwidget.cpp new file mode 100644 index 0000000..75ee55d --- /dev/null +++ b/GScribo/Preferences/optionwidget.cpp @@ -0,0 +1,14 @@ +#include "optionwidget.h" + +OptionWidget::OptionWidget(QWidget * parent) : + QWidget(parent) +{ +} + +void OptionWidget::saveConfig() +{ +} + +void OptionWidget::loadConfig() +{ +} diff --git a/GScribo/Preferences/optionwidget.h b/GScribo/Preferences/optionwidget.h new file mode 100644 index 0000000..ecdb650 --- /dev/null +++ b/GScribo/Preferences/optionwidget.h @@ -0,0 +1,15 @@ +#ifndef OPTIONWIDGET_H +#define OPTIONWIDGET_H + +#include <QWidget> + +struct OptionWidget : + public QWidget +{ + explicit OptionWidget(QWidget * parent); + + virtual void loadConfig(); + virtual void saveConfig(); +}; + +#endif // OPTIONWIDGET_H diff --git a/GScribo/Preferences/preferencesdialog.ui b/GScribo/Preferences/preferencesdialog.ui new file mode 100644 index 0000000..1d40563 --- /dev/null +++ b/GScribo/Preferences/preferencesdialog.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/GScribo/Preferences/preprocessingoptions.ui b/GScribo/Preferences/preprocessingoptions.ui new file mode 100644 index 0000000..962cf49 --- /dev/null +++ b/GScribo/Preferences/preprocessingoptions.ui @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>PreprocessingOptions</class> + <widget class="QWidget" name="PreprocessingOptions"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>466</width> + <height>198</height> + </rect> + </property> + <property name="windowTitle"> + <string>Configure toolchain</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <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 row="1" column="0"> + <widget class="QCheckBox" name="subsampleCb"> + <property name="text"> + <string>Run on subsampled image</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QCheckBox" name="remove_bgCb"> + <property name="text"> + <string>Remove background (slow)</string> + </property> + </widget> + </item> + <item row="3" column="0"> + <widget class="QCheckBox" name="deskewCb"> + <property name="text"> + <string>Deskew</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QCheckBox" name="remove_noiseCb"> + <property name="text"> + <string>Remove noise</string> + </property> + </widget> + </item> + <item row="5" column="0"> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>48</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/GScribo/Preferences/segmentationoptions.ui b/GScribo/Preferences/segmentationoptions.ui new file mode 100644 index 0000000..485e448 --- /dev/null +++ b/GScribo/Preferences/segmentationoptions.ui @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>SegmentationOptions</class> + <widget class="QWidget" name="SegmentationOptions"> + <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="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <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"> + <property name="editable"> + <bool>false</bool> + </property> + </widget> + </item> + </layout> + </item> + <item row="1" column="0"> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>258</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/GScribo/preprocess.cpp b/GScribo/Processing/preprocess.cpp similarity index 100% rename from GScribo/preprocess.cpp rename to GScribo/Processing/preprocess.cpp diff --git a/GScribo/preprocess.h b/GScribo/Processing/preprocess.h similarity index 100% rename from GScribo/preprocess.h rename to GScribo/Processing/preprocess.h index 0ca01d3..d65357f 100644 --- a/GScribo/preprocess.h +++ b/GScribo/Processing/preprocess.h @@ -1,10 +1,10 @@ #ifndef PREPROCESS_H #define PREPROCESS_H -#include <QObject> +#include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh> #include <mln/core/image/image2d.hh> #include <mln/value/rgb8.hh> -#include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh> +#include <QObject> using namespace scribo::toolchain::internal; diff --git a/GScribo/process.cpp b/GScribo/Processing/process.cpp similarity index 100% rename from GScribo/process.cpp rename to GScribo/Processing/process.cpp diff --git a/GScribo/process.h b/GScribo/Processing/process.h similarity index 100% rename from GScribo/process.h rename to GScribo/Processing/process.h index 2759d00..579a988 100644 --- a/GScribo/process.h +++ b/GScribo/Processing/process.h @@ -1,9 +1,9 @@ #ifndef PROCESS_H #define PROCESS_H -#include <QObject> -#include <mln/core/image/image2d.hh> #include <scribo/toolchain/internal/content_in_doc_functor.hh> +#include <mln/core/image/image2d.hh> +#include <QObject> using namespace scribo::toolchain::internal; diff --git a/GScribo/progressdialog.cpp b/GScribo/Processing/progressdialog.cpp similarity index 100% rename from GScribo/progressdialog.cpp rename to GScribo/Processing/progressdialog.cpp diff --git a/GScribo/progressdialog.h b/GScribo/Processing/progressdialog.h similarity index 100% rename from GScribo/progressdialog.h rename to GScribo/Processing/progressdialog.h diff --git a/GScribo/runner.cpp b/GScribo/Processing/runner.cpp similarity index 95% rename from GScribo/runner.cpp rename to GScribo/Processing/runner.cpp index 8dfd8b0..ebde288 100644 --- a/GScribo/runner.cpp +++ b/GScribo/Processing/runner.cpp @@ -12,8 +12,6 @@ static QString get_pathto(const QString& file, const QString localdirsuffix = QS if (f.exists()) return SCRIBO_PREFIX_BINDIR; - //qDebug() << "FATAL ERROR: Can't locate file: " + file; - return ""; } @@ -42,7 +40,6 @@ void Runner::run() export_as(); break; } - //qDebug() << "Done."; } void Runner::stop() @@ -84,7 +81,6 @@ image2d<bool> Runner::preprocess(const image2d<value::rgb8>& ima) // Perform preprocessing. f(ima); - //qDebug() << "Preprocess Done."; return f.output; } @@ -124,8 +120,6 @@ void Runner::process(const image2d<value::rgb8>& original_ima, output_dir = file.absolutePath(); else if (conf->generalSaveXmlCustomDir()) output_dir = conf->generalSaveXmlCustomDirPath(); - //else - //qDebug() << "runner::progress - Invalid xml saving option!"; QDir dir(output_dir); if (!dir.exists() && !dir.mkpath(output_dir)) @@ -138,13 +132,11 @@ void Runner::process(const image2d<value::rgb8>& original_ima, // Perform text detection. f(original_ima, processed_ima); emit xml_saved(filename); - //qDebug() << "Process Done."; } // Export related stuff - void Runner::start_export(const QString& imgfile, const QString& xmlfile, const QString& outfile) { diff --git a/GScribo/runner.h b/GScribo/Processing/runner.h similarity index 99% rename from GScribo/runner.h rename to GScribo/Processing/runner.h index 56a07df..51969e3 100644 --- a/GScribo/runner.h +++ b/GScribo/Processing/runner.h @@ -1,18 +1,19 @@ #ifndef RUNNER_H #define RUNNER_H -#include <QThread> +#include <mln/core/image/image2d.hh> +#include <mln/io/magick/load.hh> +#include <mln/value/rgb8.hh> #include <QStringList> #include <QMessageBox> +#include <QThread> #include <QFile> -#include <mln/core/image/image2d.hh> -#include <mln/value/rgb8.hh> -#include <mln/io/magick/load.hh> -#include "dir.h" -#include "region.h" -#include "process.h" + #include "preprocess.h" +#include "process.h" #include "configs.h" +#include "region.h" +#include "dir.h" using namespace mln; diff --git a/GScribo/Rendering/polygonitem.cpp b/GScribo/Rendering/polygonitem.cpp new file mode 100644 index 0000000..6bdcd3e --- /dev/null +++ b/GScribo/Rendering/polygonitem.cpp @@ -0,0 +1,76 @@ +#include "polygonitem.h" + +PolygonItem::PolygonItem(QGraphicsItem *parent, QGraphicsScene *scene) + : QGraphicsPolygonItem(parent, scene) +{ + init(); +} + +PolygonItem::PolygonItem(const QPolygonF &polygon, QGraphicsItem *parent, QGraphicsScene *scene): + QGraphicsPolygonItem(polygon, parent, scene) +{ + init(); +} + +void PolygonItem::init() +{ + selectedPen.setStyle(Qt::SolidLine); + unselectedPen.setStyle(Qt::SolidLine); + + selectedPen.setWidthF(2); + unselectedPen.setWidth(0); + + selectedPen.setCapStyle(Qt::SquareCap); + unselectedPen.setCapStyle(Qt::SquareCap); + + selectedBrush.setStyle(Qt::SolidPattern); + unselectedBrush.setStyle(Qt::SolidPattern); +} + +void PolygonItem::setColor(const QColor &color) +{ + selectedPen.setColor(QColor::fromRgb(color.red(), color.green(), color.blue(), 200)); + unselectedPen.setColor(color); + + selectedBrush.setColor(color); + unselectedBrush.setColor(QColor::fromRgb(color.red(), color.green(), color.blue(), 30)); + + setPen(selectedPen); + setBrush(selectedBrush); +} + +QColor PolygonItem::color() const +{ + return selectedBrush.color(); +} + +void PolygonItem::repaint(const QRectF& rect, bool clic) +{ + bool sel; + + // For optimization, do first an intersection by bounding rectangle beetween items and selection and then an intersection by shape. + if(clic) + sel = (boundingRect().width() == 0 || boundingRect().height() == 0 || boundingRect().contains(rect.bottomRight())) && shape().contains(rect.bottomRight()); + else + sel = (boundingRect().width() == 0 || boundingRect().height() == 0 || boundingRect().intersects(rect)) && shape().intersects(rect); + + // Change items brush and pen if it's selectionned or not. + if(sel) + { + if(pen() != selectedPen) + { + setPen(selectedPen); + setBrush(selectedBrush); + update(rect); + } + } + else + { + if(pen() != unselectedPen) + { + setPen(unselectedPen); + setBrush(unselectedBrush); + update(rect); + } + } +} diff --git a/GScribo/polygonitem.h b/GScribo/Rendering/polygonitem.h similarity index 80% rename from GScribo/polygonitem.h rename to GScribo/Rendering/polygonitem.h index 50abf61..893bde3 100644 --- a/GScribo/polygonitem.h +++ b/GScribo/Rendering/polygonitem.h @@ -13,17 +13,16 @@ class PolygonItem : public: explicit PolygonItem(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0); explicit PolygonItem(const QPolygonF& path, QGraphicsItem *parent = 0, QGraphicsScene *scene = 0); - ~PolygonItem(); void setColor(const QColor& color); QColor color() const; private: void init(); - QPen *selectedPen; - QPen *unselectedPen; - QBrush *selectedBrush; - QBrush *unselectedBrush; + QPen selectedPen; + QPen unselectedPen; + QBrush selectedBrush; + QBrush unselectedBrush; public slots: void repaint(const QRectF& rect, bool clic); diff --git a/GScribo/Rendering/scene.cpp b/GScribo/Rendering/scene.cpp new file mode 100644 index 0000000..5035b28 --- /dev/null +++ b/GScribo/Rendering/scene.cpp @@ -0,0 +1,101 @@ +#include "scene.h" + +Scene::Scene(QObject *parent): + QGraphicsScene(parent) +{ + init(); +} + +Scene::Scene(const QRectF &sceneRect, QObject *parent): + QGraphicsScene(sceneRect, parent) +{ + init(); +} + +Scene::Scene(qreal x, qreal y, qreal width, qreal height, QObject *parent): + QGraphicsScene(x, y, width, height, parent) +{ + init(); +} + +void Scene::init() +{ + isPressing = false; + clic = false; + + // Disable the scene size adaptation to items rect with a non null rect. + setSceneRect(0, 0, 0, 1); + addItem(&selection); +} + +void Scene::removeItems() +{ + QList<QGraphicsItem *> itemsList = items(); + QGraphicsItem *i; + + // Remove all items on the scene expect the selection. + foreach(i, itemsList) + { + if(i != &selection) + delete i; + } +} + +void Scene::mousePressEvent(QGraphicsSceneMouseEvent *event) +{ + if(event->button() == Qt::LeftButton && !isPressing) + { + isPressing = true; + clic = true; + + pressPos = event->scenePos(); + selection.show(); + } +} + +void Scene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) +{ + if(isPressing) + { + clic = false; + + // Adapt if the selection rectangle has a negative size. + if(pressPos.x() < event->scenePos().x()) + selection.setRect(pressPos.x(), 0, event->scenePos().x()-pressPos.x(), 0); + else + selection.setRect(event->scenePos().x(), 0, pressPos.x()-event->scenePos().x(), 0); + + if(pressPos.y() < event->scenePos().y()) + selection.setRect(selection.rect().x(), pressPos.y(), selection.rect().width(), event->scenePos().y()-pressPos.y()); + else + selection.setRect(selection.rect().x(), event->scenePos().y(), selection.rect().width(), pressPos.y()-event->scenePos().y()); + } +} + +void Scene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +{ + if(event->button() == Qt::LeftButton) + { + isPressing = false; + + // If no selection, store the click position in the selection rectangle. + if(clic) + selection.setRect(QRectF(QPointF(0, 0), event->scenePos())); + + emit repaintItem(selection.rect(), clic); + + selection.setRect(0, 0, 0, 0); + selection.hide(); + } +} + +void Scene::setBackground(const QString& filename, const QPixmap& pixmap) +{ + if(backgroundPath != filename) + { + backgroundPath = filename; + + setSceneRect(pixmap.rect()); + setBackgroundBrush(QBrush(pixmap)); + } +} diff --git a/GScribo/scene.h b/GScribo/Rendering/scene.h similarity index 85% rename from GScribo/scene.h rename to GScribo/Rendering/scene.h index 86ca8c7..c4a627a 100644 --- a/GScribo/scene.h +++ b/GScribo/Rendering/scene.h @@ -17,7 +17,6 @@ class Scene : explicit Scene(QObject *parent = 0); explicit Scene(const QRectF &sceneRect, QObject *parent = 0); explicit Scene(qreal x, qreal y, qreal width, qreal height, QObject *parent = 0); - ~Scene(); void removeItems(); protected: @@ -28,11 +27,15 @@ class Scene : private: void init(); - Selection *selection; + QString backgroundPath; + Selection selection; QPointF pressPos; bool isPressing; bool clic; + public slots: + void setBackground(const QString& filename, const QPixmap& pixmap); + signals: void repaintItem(const QRectF& rect, bool clic); }; diff --git a/GScribo/selection.cpp b/GScribo/Rendering/selection.cpp similarity index 94% rename from GScribo/selection.cpp rename to GScribo/Rendering/selection.cpp index 6020312..438e92e 100644 --- a/GScribo/selection.cpp +++ b/GScribo/Rendering/selection.cpp @@ -20,12 +20,15 @@ Selection::Selection(qreal x, qreal y, qreal width, qreal height, QGraphicsScene void Selection::init() { + // Always drawn on top of the scene. setZValue(INT_MAX); + QPen pen; pen.setStyle(Qt::DashLine); pen.setCapStyle(Qt::SquareCap); pen.setCosmetic(true); setPen(pen); + QBrush brush; brush.setStyle(Qt::Dense4Pattern); brush.setColor(QColor::fromRgb(80, 200, 10, 100)); diff --git a/GScribo/selection.h b/GScribo/Rendering/selection.h similarity index 100% rename from GScribo/selection.h rename to GScribo/Rendering/selection.h diff --git a/XmlParser/configs.cpp b/GScribo/configs.cpp similarity index 95% rename from XmlParser/configs.cpp rename to GScribo/configs.cpp index 59df3db..e003442 100644 --- a/XmlParser/configs.cpp +++ b/GScribo/configs.cpp @@ -1,6 +1,4 @@ -#include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh> #include "configs.h" -#include "region.h" Configs::Configs() : QSettings("Olena-Scribo", "viewer") @@ -13,6 +11,7 @@ Configs * Configs::getInstance() return conf; } +// Preprocessing configs. bool Configs::preprocessingSubsample() { return value("preprocessing/subsample", false).toBool(); @@ -23,6 +22,8 @@ void Configs::setPreprocessingSubsample(bool b) setValue("preprocessing/subsample", b); } + + bool Configs::preprocessingRemoveBg() { return value("preprocessing/remove_bg", false).toBool(); @@ -33,6 +34,8 @@ void Configs::setPreprocessingRemoveBg(bool b) setValue("preprocessing/remove_bg", b); } + + bool Configs::preprocessingDeskew() { return value("preprocessing/deskew", false).toBool(); @@ -43,6 +46,8 @@ void Configs::setPreprocessingDeskew(bool b) setValue("preprocessing/deskew", b); } + + bool Configs::preprocessingRemoveNoise() { return value("preprocessing/remove_noise", true).toBool(); @@ -53,6 +58,8 @@ void Configs::setPreprocessingRemoveNoise(bool b) setValue("preprocessing/remove_noise", b); } + + int Configs::preprocessingBinAlgo() { return value("preprocessing/bin_algo", scribo::toolchain::internal::SauvolaMs).toInt(); @@ -63,6 +70,11 @@ void Configs::setPreprocessingBinAlgo(int algo) setValue("preprocessing/bin_algo", algo); } + + + + +// Segmentation configs. int Configs::segmentationFindSeps() { return value("segmentation/find_seps", Separator::Both).toInt(); @@ -73,6 +85,11 @@ void Configs::setSegmentationFindSeps(int seps) setValue("segmentation/find_seps", seps); } + + + + +// OCR configs. bool Configs::ocrEnabled() { return value("ocr/enabled", true).toBool(); @@ -83,6 +100,8 @@ void Configs::setOcrEnabled(bool b) setValue("ocr/enabled", b); } + + QString Configs::ocrLanguage() { return value("ocr/language", 0).toString(); @@ -93,6 +112,11 @@ void Configs::setOcrLanguage(const QString &lang) setValue("ocr/language", lang); } + + + + +// OCR configs. bool Configs::generalSaveXmlEnabled() { return value("general/save_xml/enabled", true).toBool(); @@ -103,6 +127,8 @@ void Configs::setGeneralSaveXmlEnabled(bool b) setValue("general/save_xml/enabled", b); } + + bool Configs::generalSaveXmlSameDir() { return value("general/save_xml/same_dir", true).toBool(); @@ -113,6 +139,8 @@ void Configs::setGeneralSaveXmlSameDir(bool b) setValue("general/save_xml/same_dir", b); } + + bool Configs::generalSaveXmlCustomDir() { return value("general/save_xml/custom_dir", false).toBool(); @@ -123,6 +151,8 @@ void Configs::setGeneralSaveXmlCustomDir(bool b) setValue("general/save_xml/custom_dir", b); } + + QString Configs::generalSaveXmlCustomDirPath() { return value("general/save_xml/custom_dir_path", QDir::tempPath()).toString(); diff --git a/GScribo/config.h b/GScribo/configs.h similarity index 93% rename from GScribo/config.h rename to GScribo/configs.h index 6677527..aff4889 100644 --- a/GScribo/config.h +++ b/GScribo/configs.h @@ -1,9 +1,12 @@ #ifndef CONFIGS_H #define CONFIGS_H +#include <scribo/toolchain/internal/text_in_doc_preprocess_functor.hh> #include <QSettings> #include <QDir> +#include "region.h" + class Configs : public QSettings { diff --git a/GScribo/dir.h b/GScribo/dir.h index cb951f1..a6c036b 100644 --- a/GScribo/dir.h +++ b/GScribo/dir.h @@ -1,7 +1,7 @@ #ifndef DIR_H #define DIR_H -#define SCRIBO_PREFIX_BINDIR "/usr/local/bin" #define SCRIBO_LOCAL_DEMODIR "/lrde/home/stage/froger_a/olena/_build/scribo/demo" +#define SCRIBO_PREFIX_BINDIR "/usr/local/bin" #endif // DIR_H diff --git a/GScribo/icon.cpp b/GScribo/icon.cpp deleted file mode 100644 index 5aca60f..0000000 --- a/GScribo/icon.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include "icon.h" - -Icon::Icon(const QPixmap &pixmap) : - QIcon(pixmap) -{ -} - -QString Icon::path() const -{ - return filename; -} - -QPixmap * Icon::pixmap() -{ - return pix; -} - -void Icon::setPath(QString path) -{ - filename = path; -} - -void Icon::setPixmap(QPixmap *pixmap) -{ - pix = pixmap; -} diff --git a/GScribo/icon.h b/GScribo/icon.h deleted file mode 100644 index ebedbe7..0000000 --- a/GScribo/icon.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef ICON_H -#define ICON_H - -#include <QIcon> - -class Icon : - QIcon -{ - public: - explicit Icon(const QPixmap& pixmap); - QString path() const; - QPixmap * pixmap(); - void setPath(QString path); - void setPixmap(QPixmap *pixmap); - - private: - QString filename; - QPixmap *pix; -}; - -#endif // ICON_H diff --git a/GScribo/mainwindow.ui b/GScribo/mainwindow.ui index 3a174ec..0d91002 100644 --- a/GScribo/mainwindow.ui +++ b/GScribo/mainwindow.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>671</width> - <height>436</height> + <width>800</width> + <height>600</height> </rect> </property> <property name="windowTitle"> @@ -23,8 +23,8 @@ <rect> <x>0</x> <y>0</y> - <width>671</width> - <height>23</height> + <width>800</width> + <height>21</height> </rect> </property> </widget> diff --git a/GScribo/pageswidget.cpp b/GScribo/pageswidget.cpp deleted file mode 100644 index 1652062..0000000 --- a/GScribo/pageswidget.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "pageswidget.h" - -PagesWidget::PagesWidget(QWidget *parent): - QListView(parent) -{ - setUniformItemSizes(true); - setViewMode(QListView::IconMode); - setIconSize(QSize(200, 200)); - setFlow(QListView::TopToBottom); - setMovement(QListView::Static); - setSpacing(10); - setWrapping(false); - setModel(&model); -} - -void PagesWidget::addPixmap(const QString& filename, const QPixmap &pixmap) -{ - model.addPixmap(pixmap); -} diff --git a/GScribo/polygonitem.cpp b/GScribo/polygonitem.cpp deleted file mode 100644 index 2c20dbf..0000000 --- a/GScribo/polygonitem.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include "polygonitem.h" - -PolygonItem::PolygonItem(QGraphicsItem *parent, QGraphicsScene *scene) - : QGraphicsPolygonItem(parent, scene) -{ - init(); -} - -PolygonItem::PolygonItem(const QPolygonF &polygon, QGraphicsItem *parent, QGraphicsScene *scene): - QGraphicsPolygonItem(polygon, parent, scene) -{ - init(); -} - -PolygonItem::~PolygonItem() -{ - delete selectedPen; - delete unselectedPen; - delete selectedBrush; - delete unselectedBrush; -} - -void PolygonItem::init() -{ - selectedPen = new QPen(Qt::SolidLine); - unselectedPen = new QPen(Qt::SolidLine); - selectedPen->setWidthF(2); - unselectedPen->setWidth(0); - selectedPen->setCapStyle(Qt::SquareCap); - unselectedPen->setCapStyle(Qt::SquareCap); - selectedBrush = new QBrush(Qt::SolidPattern); - unselectedBrush = new QBrush(Qt::SolidPattern); -} - -void PolygonItem::setColor(const QColor &color) -{ - selectedPen->setColor(QColor::fromRgb(color.red(), color.green(), color.blue(), 200)); - unselectedPen->setColor(color); - selectedBrush->setColor(color); - unselectedBrush->setColor(QColor::fromRgb(color.red(), color.green(), color.blue(), 30)); - setPen(*selectedPen); - setBrush(*selectedBrush); -} - -QColor PolygonItem::color() const -{ - return selectedBrush->color(); -} - -void PolygonItem::repaint(const QRectF& rect, bool clic) -{ - bool sel; - if(clic) - sel = (boundingRect().width() == 0 || boundingRect().height() == 0 || boundingRect().contains(rect.bottomRight())) && shape().contains(rect.bottomRight()); - else - sel = (boundingRect().width() == 0 || boundingRect().height() == 0 || boundingRect().intersects(rect)) && shape().intersects(rect); - if(sel) - { - if(pen() != *selectedPen) - { - setPen(*selectedPen); - setBrush(*selectedBrush); - update(rect); - } - } - else - { - if(pen() != *unselectedPen) - { - setPen(*unselectedPen); - setBrush(*unselectedBrush); - update(rect); - } - } -} diff --git a/XmlParser/region.h b/GScribo/region.h similarity index 100% copy from XmlParser/region.h copy to GScribo/region.h diff --git a/GScribo/scene.cpp b/GScribo/scene.cpp deleted file mode 100644 index ee2007a..0000000 --- a/GScribo/scene.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include "scene.h" - -Scene::Scene(QObject *parent): - QGraphicsScene(parent) -{ - init(); -} - -Scene::Scene(const QRectF &sceneRect, QObject *parent): - QGraphicsScene(sceneRect, parent) -{ - init(); -} - -Scene::Scene(qreal x, qreal y, qreal width, qreal height, QObject *parent): - QGraphicsScene(x, y, width, height, parent) -{ - init(); -} - -Scene::~Scene() -{ - delete selection; -} - -void Scene::init() -{ - isPressing = false; - clic = false; - selection = new Selection(this); -} - -void Scene::removeItems() -{ - QList<QGraphicsItem *> itemsList = items(); - QGraphicsItem *i; - foreach(i, itemsList) - { - if(i != selection) - delete i; - } -} - -void Scene::mousePressEvent(QGraphicsSceneMouseEvent *event) -{ - if(event->button() == Qt::LeftButton && !isPressing) - { - isPressing = true; - clic = true; - pressPos = event->scenePos(); - selection->show(); - } -} - -void Scene::mouseMoveEvent(QGraphicsSceneMouseEvent *event) -{ - if(isPressing) - { - clic = false; - if(pressPos.x() < event->scenePos().x()) - selection->setRect(pressPos.x(), 0, event->scenePos().x()-pressPos.x(), 0); - else - selection->setRect(event->scenePos().x(), 0, pressPos.x()-event->scenePos().x(), 0); - if(pressPos.y() < event->scenePos().y()) - selection->setRect(selection->rect().x(), pressPos.y(), selection->rect().width(), event->scenePos().y()-pressPos.y()); - else - selection->setRect(selection->rect().x(), event->scenePos().y(), selection->rect().width(), pressPos.y()-event->scenePos().y()); - } -} - -void Scene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) -{ - if(event->button() == Qt::LeftButton) - { - isPressing = false; - if(clic) - selection->setRect(QRectF(QPointF(0, 0), event->scenePos())); - emit repaintItem(selection->rect(), clic); - selection->setRect(0, 0, 0, 0); - selection->hide(); - } -} diff --git a/GScribo/ui_mainwindow.h b/GScribo/ui_mainwindow.h deleted file mode 100644 index 7ba54a5..0000000 --- a/GScribo/ui_mainwindow.h +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************** -** Form generated from reading UI file 'mainwindow.ui' -** -** Created: Wed Jan 23 15:39:30 2013 -** by: Qt User Interface Compiler version 4.6.3 -** -** WARNING! All changes made in this file will be lost when recompiling UI file! -********************************************************************************/ - -#ifndef UI_MAINWINDOW_H -#define UI_MAINWINDOW_H - -#include <QtCore/QVariant> -#include <QtGui/QAction> -#include <QtGui/QApplication> -#include <QtGui/QButtonGroup> -#include <QtGui/QHeaderView> -#include <QtGui/QMainWindow> -#include <QtGui/QMenuBar> -#include <QtGui/QStatusBar> -#include <QtGui/QToolBar> -#include <QtGui/QWidget> - -QT_BEGIN_NAMESPACE - -class Ui_MainWindow -{ -public: - QWidget *centralWidget; - QMenuBar *menuBar; - QToolBar *mainToolBar; - QStatusBar *statusBar; - - void setupUi(QMainWindow *MainWindow) - { - if (MainWindow->objectName().isEmpty()) - MainWindow->setObjectName(QString::fromUtf8("MainWindow")); - MainWindow->resize(671, 436); - centralWidget = new QWidget(MainWindow); - centralWidget->setObjectName(QString::fromUtf8("centralWidget")); - centralWidget->setEnabled(true); - MainWindow->setCentralWidget(centralWidget); - menuBar = new QMenuBar(MainWindow); - menuBar->setObjectName(QString::fromUtf8("menuBar")); - menuBar->setGeometry(QRect(0, 0, 671, 23)); - MainWindow->setMenuBar(menuBar); - mainToolBar = new QToolBar(MainWindow); - mainToolBar->setObjectName(QString::fromUtf8("mainToolBar")); - mainToolBar->setFloatable(false); - MainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar); - statusBar = new QStatusBar(MainWindow); - statusBar->setObjectName(QString::fromUtf8("statusBar")); - MainWindow->setStatusBar(statusBar); - - retranslateUi(MainWindow); - - QMetaObject::connectSlotsByName(MainWindow); - } // setupUi - - void retranslateUi(QMainWindow *MainWindow) - { - MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8)); - } // retranslateUi - -}; - -namespace Ui { - class MainWindow: public Ui_MainWindow {}; -} // namespace Ui - -QT_END_NAMESPACE - -#endif // UI_MAINWINDOW_H diff --git a/MVC/MVC.pro b/MVC/MVC.pro deleted file mode 100644 index 1a4d48c..0000000 --- a/MVC/MVC.pro +++ /dev/null @@ -1,13 +0,0 @@ -# ------------------------------------------------- -# Project created by QtCreator 2013-01-22T16:00:23 -# ------------------------------------------------- -TARGET = MVC -TEMPLATE = app -SOURCES += main.cpp \ - mainwindow.cpp \ - itemdelegate.cpp \ - listmodel.cpp -HEADERS += mainwindow.h \ - listmodel.h \ - itemdelegate.h -FORMS += mainwindow.ui diff --git a/MVC/MVC.pro.user b/MVC/MVC.pro.user deleted file mode 100644 index 1c6e9ba..0000000 --- a/MVC/MVC.pro.user +++ /dev/null @@ -1,251 +0,0 @@ -<!DOCTYPE QtCreatorProject> -<qtcreator> - <data> - <variable>RunConfiguration0-BaseEnvironmentBase</variable> - <value type="int">2</value> - </data> - <data> - <variable>RunConfiguration0-CommandLineArguments</variable> - <valuelist type="QVariantList"/> - </data> - <data> - <variable>RunConfiguration0-ProFile</variable> - <value type="QString">MVC.pro</value> - </data> - <data> - <variable>RunConfiguration0-RunConfiguration.name</variable> - <value type="QString">MVC</value> - </data> - <data> - <variable>RunConfiguration0-UseDyldImageSuffix</variable> - <value type="bool">false</value> - </data> - <data> - <variable>RunConfiguration0-UseTerminal</variable> - <value type="bool">false</value> - </data> - <data> - <variable>RunConfiguration0-UserEnvironmentChanges</variable> - <valuelist type="QVariantList"/> - </data> - <data> - <variable>RunConfiguration0-UserSetName</variable> - <value type="bool">false</value> - </data> - <data> - <variable>RunConfiguration0-UserSetWorkingDirectory</variable> - <value type="bool">false</value> - </data> - <data> - <variable>RunConfiguration0-UserWorkingDirectory</variable> - <value type="QString"></value> - </data> - <data> - <variable>RunConfiguration0-type</variable> - <value type="QString">Qt4ProjectManager.Qt4RunConfiguration</value> - </data> - <data> - <variable>activeRunConfiguration</variable> - <value type="int">0</value> - </data> - <data> - <variable>activebuildconfiguration</variable> - <value type="QString">Debug</value> - </data> - <data> - <variable>buildConfiguration-Debug</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> - <value key="QtVersionId" type="int">0</value> - <value key="ToolChain" type="int">0</value> - <value key="addQDumper" type=""></value> - <value key="buildConfiguration" type="int">2</value> - </valuemap> - </data> - <data> - <variable>buildConfiguration-Release</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> - <value key="QtVersionId" type="int">0</value> - <value key="addQDumper" type=""></value> - <value key="buildConfiguration" type="int">0</value> - </valuemap> - </data> - <data> - <variable>buildconfiguration-Debug-buildstep0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> - <valuelist key="abstractProcess.Environment" type="QVariantList"> - <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-iL4mXwl7ak,guid=7e9603aab929b1f1fce663d30068f708</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-kN7FtK</value> - <value type="QString">GNOME_KEYRING_PID=25582</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">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/MVC</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=25657</value> - <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-RiFAp25591/agent.25591</value> - <value type="QString">TERM=xterm</value> - <value type="QString">USER=froger_a</value> - <value type="QString">USERNAME=froger_a</value> - <value type="QString">WINDOWID=10485796</value> - <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> - <value type="QString">XAUTHORITY=/tmp/.gdmJKU1QW</value> - <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> - <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358926796.562496-56304996</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> - <value type="QString">XTERM_VERSION=XTerm(261)</value> - <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/MVC/MVC.pro</value> - <value type="QString">-spec</value> - <value type="QString">linux-g++</value> - <value type="QString">-r</value> - <value type="QString">CONFIG+=debug</value> - </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/MVC</value> - </valuemap> - </data> - <data> - <variable>buildconfiguration-Debug-buildstep1</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> - <valuelist key="abstractProcess.Environment" type="QVariantList"> - <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-iL4mXwl7ak,guid=7e9603aab929b1f1fce663d30068f708</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-kN7FtK</value> - <value type="QString">GNOME_KEYRING_PID=25582</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">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/MVC</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=25657</value> - <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-RiFAp25591/agent.25591</value> - <value type="QString">TERM=xterm</value> - <value type="QString">USER=froger_a</value> - <value type="QString">USERNAME=froger_a</value> - <value type="QString">WINDOWID=10485796</value> - <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> - <value type="QString">XAUTHORITY=/tmp/.gdmJKU1QW</value> - <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> - <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358926796.562496-56304996</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> - <value type="QString">XTERM_VERSION=XTerm(261)</value> - <value type="QString">_=/usr/bin/qtcreator</value> - </valuelist> - <value key="abstractProcess.IgnoreReturnValue" type="bool">false</value> - <valuelist key="abstractProcess.arguments" type="QVariantList"> - <value type="QString">-w</value> - </valuelist> - <value key="abstractProcess.command" type="QString">/usr/bin/make</value> - <value key="abstractProcess.enabled" type="bool">true</value> - <value key="abstractProcess.workingDirectory" type="QString">/amd/nfs/volume1/home/stage/froger_a/qt/MVC</value> - </valuemap> - </data> - <data> - <variable>buildconfiguration-Debug-cleanstep0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> - <value key="cleanConfig" type="bool">true</value> - <valuelist key="makeargs" type="QVariantList"> - <value type="QString">clean</value> - </valuelist> - </valuemap> - </data> - <data> - <variable>buildconfiguration-Release-buildstep0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> - </valuemap> - </data> - <data> - <variable>buildconfiguration-Release-buildstep1</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> - </valuemap> - </data> - <data> - <variable>buildconfiguration-Release-cleanstep0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> - </valuemap> - </data> - <data> - <variable>buildconfigurations</variable> - <valuelist type="QVariantList"> - <value type="QString">Debug</value> - <value type="QString">Release</value> - </valuelist> - </data> - <data> - <variable>buildstep0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value> - <value key="mkspec" type="QString"></value> - </valuemap> - </data> - <data> - <variable>buildstep1</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value> - </valuemap> - </data> - <data> - <variable>buildsteps</variable> - <valuelist type="QVariantList"> - <value type="QString">trolltech.qt4projectmanager.qmake</value> - <value type="QString">trolltech.qt4projectmanager.make</value> - </valuelist> - </data> - <data> - <variable>cleanstep0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value> - <value key="clean" type="bool">true</value> - </valuemap> - </data> - <data> - <variable>cleansteps</variable> - <valuelist type="QVariantList"> - <value type="QString">trolltech.qt4projectmanager.make</value> - </valuelist> - </data> - <data> - <variable>defaultFileEncoding</variable> - <value type="QByteArray">System</value> - </data> - <data> - <variable>project</variable> - <valuemap type="QVariantMap"/> - </data> -</qtcreator> diff --git a/MVC/itemdelegate.cpp b/MVC/itemdelegate.cpp deleted file mode 100644 index 5f67a91..0000000 --- a/MVC/itemdelegate.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "itemdelegate.h" - -ItemDelegate::ItemDelegate(QWidget *parent): - QAbstractItemDelegate(parent) -{ -} - -void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const -{ - QString path = index.data(Qt::DecorationRole).toString(); - QPixmap pixmap(path); - - painter->drawPixmap(0, index.row() * 210, 200, 200, pixmap); -} - -QSize ItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const -{ - return QSize(200, 400); -} diff --git a/MVC/itemdelegate.h b/MVC/itemdelegate.h deleted file mode 100644 index 1c653d5..0000000 --- a/MVC/itemdelegate.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef ITEMDELEGATE_H -#define ITEMDELEGATE_H - -#include <QItemDelegate> -#include <QLabel> -#include <QPainter> - -class ItemDelegate: - public QAbstractItemDelegate -{ - public: - explicit ItemDelegate(QWidget *parent = 0); - void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; - QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; -}; - -#endif // ITEMDELEGATE_H diff --git a/MVC/listmodel.cpp b/MVC/listmodel.cpp deleted file mode 100644 index 709853e..0000000 --- a/MVC/listmodel.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "listmodel.h" - -ListModel::ListModel(QStringList list, QObject *parent): - QAbstractListModel(parent) -{ - this->list = list; -} - -ListModel::~ListModel() -{ -} - -int ListModel::rowCount(const QModelIndex &/*parent*/) const -{ - return list.count(); -} - -QVariant ListModel::data(const QModelIndex &index, int role) const -{ - if(index.isValid() && index.row() < list.size() && role == Qt::DecorationRole) - return list.at(index.row()); - else - return QVariant(); -} - -QVariant ListModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if(role != Qt::DecorationRole && orientation == Qt::Horizontal) - return QVariant(); - else - return QString("Row %1").arg(section); -} diff --git a/MVC/listmodel.h b/MVC/listmodel.h deleted file mode 100644 index 35ae99c..0000000 --- a/MVC/listmodel.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef LISTMODEL_H -#define LISTMODEL_H - -#include <QAbstractListModel> -#include <QLabel> -#include <QList> - -class ListModel: - public QAbstractListModel -{ - Q_OBJECT - - public: - explicit ListModel(QStringList list, QObject *parent = 0); - ~ListModel(); - int rowCount(const QModelIndex &parent = QModelIndex()) const; - QVariant data(const QModelIndex &index, int role = Qt::DecorationRole) const; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DecorationRole) const; - - private: - QStringList list; -}; - -#endif // LISTMODEL_H diff --git a/MVC/main.cpp b/MVC/main.cpp deleted file mode 100644 index ab61e7c..0000000 --- a/MVC/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include <QtGui/QApplication> -#include "mainwindow.h" - -int main(int argc, char *argv[]) -{ - QApplication::setGraphicsSystem("raster"); - QApplication a(argc, argv); - MainWindow w; - w.show(); - return a.exec(); -} diff --git a/MVC/mainwindow.cpp b/MVC/mainwindow.cpp deleted file mode 100644 index 72bf823..0000000 --- a/MVC/mainwindow.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "mainwindow.h" -#include "ui_mainwindow.h" - -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::MainWindow) -{ - ui->setupUi(this); - - QStringList list; - list << "/lrde/home/stage/froger_a/ppm/mp00032c.ppm" << "/lrde/home/stage/froger_a/ppm/mp00042.ppm" << "/lrde/home/stage/froger_a/ppm/mp00076.ppm"; - - QAbstractItemModel *model = new ListModel(list); - - ItemDelegate *delegate = new ItemDelegate(); - - QListView *view = new QListView; - view->setModel(model); - view->setItemDelegate(delegate); - setCentralWidget(view); - view->show(); -} - -MainWindow::~MainWindow() -{ - delete ui; -} - -void MainWindow::changeEvent(QEvent *e) -{ - QMainWindow::changeEvent(e); - switch (e->type()) - { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} diff --git a/MVC/mainwindow.h b/MVC/mainwindow.h deleted file mode 100644 index 8bf225d..0000000 --- a/MVC/mainwindow.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include <QMainWindow> -#include <QListView> - -#include "itemdelegate.h" -#include "listmodel.h" - -namespace Ui -{ - class MainWindow; -} - -class MainWindow : public QMainWindow -{ - Q_OBJECT - - public: - MainWindow(QWidget *parent = 0); - ~MainWindow(); - - protected: - void changeEvent(QEvent *e); - - private: - Ui::MainWindow *ui; -}; - -#endif // MAINWINDOW_H diff --git a/MVC/mainwindow.ui b/MVC/mainwindow.ui deleted file mode 100644 index 97c03be..0000000 --- a/MVC/mainwindow.ui +++ /dev/null @@ -1,24 +0,0 @@ -<ui version="4.0"> - <class>MainWindow</class> - <widget class="QMainWindow" name="MainWindow" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>600</width> - <height>400</height> - </rect> - </property> - <property name="windowTitle" > - <string>MainWindow</string> - </property> - <widget class="QMenuBar" name="menuBar" /> - <widget class="QToolBar" name="mainToolBar" /> - <widget class="QWidget" name="centralWidget" /> - <widget class="QStatusBar" name="statusBar" /> - </widget> - <layoutDefault spacing="6" margin="11" /> - <pixmapfunction></pixmapfunction> - <resources/> - <connections/> -</ui> diff --git a/MVC/ui_mainwindow.h b/MVC/ui_mainwindow.h deleted file mode 100644 index 48f2cce..0000000 --- a/MVC/ui_mainwindow.h +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************** -** Form generated from reading UI file 'mainwindow.ui' -** -** Created: Wed Jan 23 08:52:24 2013 -** by: Qt User Interface Compiler version 4.6.3 -** -** WARNING! All changes made in this file will be lost when recompiling UI file! -********************************************************************************/ - -#ifndef UI_MAINWINDOW_H -#define UI_MAINWINDOW_H - -#include <QtCore/QVariant> -#include <QtGui/QAction> -#include <QtGui/QApplication> -#include <QtGui/QButtonGroup> -#include <QtGui/QHeaderView> -#include <QtGui/QMainWindow> -#include <QtGui/QMenuBar> -#include <QtGui/QStatusBar> -#include <QtGui/QToolBar> -#include <QtGui/QWidget> - -QT_BEGIN_NAMESPACE - -class Ui_MainWindow -{ -public: - QMenuBar *menuBar; - QToolBar *mainToolBar; - QWidget *centralWidget; - QStatusBar *statusBar; - - void setupUi(QMainWindow *MainWindow) - { - if (MainWindow->objectName().isEmpty()) - MainWindow->setObjectName(QString::fromUtf8("MainWindow")); - MainWindow->resize(600, 400); - menuBar = new QMenuBar(MainWindow); - menuBar->setObjectName(QString::fromUtf8("menuBar")); - MainWindow->setMenuBar(menuBar); - mainToolBar = new QToolBar(MainWindow); - mainToolBar->setObjectName(QString::fromUtf8("mainToolBar")); - MainWindow->addToolBar(mainToolBar); - centralWidget = new QWidget(MainWindow); - centralWidget->setObjectName(QString::fromUtf8("centralWidget")); - MainWindow->setCentralWidget(centralWidget); - statusBar = new QStatusBar(MainWindow); - statusBar->setObjectName(QString::fromUtf8("statusBar")); - MainWindow->setStatusBar(statusBar); - - retranslateUi(MainWindow); - - QMetaObject::connectSlotsByName(MainWindow); - } // setupUi - - void retranslateUi(QMainWindow *MainWindow) - { - MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8)); - } // retranslateUi - -}; - -namespace Ui { - class MainWindow: public Ui_MainWindow {}; -} // namespace Ui - -QT_END_NAMESPACE - -#endif // UI_MAINWINDOW_H diff --git a/XmlParser/XmlParser.pro.user b/XmlParser/XmlParser.pro.user index 4041e71..d21de52 100644 --- a/XmlParser/XmlParser.pro.user +++ b/XmlParser/XmlParser.pro.user @@ -188,17 +188,18 @@ <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-dwXmVzGpRA,guid=2e4bb3ce70c39fa5e5288771006655e3</value> + <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Rm9H5yDUD5,guid=00a0d6b325751c50c00c26e2006a9203</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-9aAGCJ</value> - <value type="QString">GNOME_KEYRING_PID=19876</value> + <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-kTB4J7</value> + <value type="QString">GNOME_KEYRING_PID=27564</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">HOME=/lrde/home/stage/froger_a</value> <value type="QString">LANG=fr_FR.UTF-8</value> + <value type="QString">LANGUAGE=</value> <value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value> <value type="QString">LOGNAME=froger_a</value> <value type="QString">OLDPWD=/lrde/home/stage/froger_a/qt</value> @@ -207,16 +208,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=19951</value> - <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-kVrax19885/agent.19885</value> + <value type="QString">SSH_AGENT_PID=27639</value> + <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-qeVjd27573/agent.27573</value> <value type="QString">TERM=xterm</value> <value type="QString">USER=froger_a</value> <value type="QString">USERNAME=froger_a</value> - <value type="QString">WINDOWID=10485796</value> - <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> - <value type="QString">XAUTHORITY=/tmp/.gdm0ICXQW</value> + <value type="QString">WINDOWID=12582948</value> + <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> + <value type="QString">XAUTHORITY=/tmp/.gdm9DVURW</value> <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> - <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358754471.558659-246518931</value> + <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1359032006.901905-2088645706</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,17 +240,18 @@ <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-dwXmVzGpRA,guid=2e4bb3ce70c39fa5e5288771006655e3</value> + <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-Rm9H5yDUD5,guid=00a0d6b325751c50c00c26e2006a9203</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-9aAGCJ</value> - <value type="QString">GNOME_KEYRING_PID=19876</value> + <value type="QString">GNOME_KEYRING_CONTROL=/tmp/keyring-kTB4J7</value> + <value type="QString">GNOME_KEYRING_PID=27564</value> <value type="QString">GTK_MODULES=canberra-gtk-module</value> <value type="QString">HOME=/lrde/home/stage/froger_a</value> <value type="QString">LANG=fr_FR.UTF-8</value> + <value type="QString">LANGUAGE=</value> <value type="QString">LD_LIBRARY_PATH=/usr/lib/qtcreator</value> <value type="QString">LOGNAME=froger_a</value> <value type="QString">OLDPWD=/lrde/home/stage/froger_a/qt</value> @@ -258,16 +260,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=19951</value> - <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-kVrax19885/agent.19885</value> + <value type="QString">SSH_AGENT_PID=27639</value> + <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-qeVjd27573/agent.27573</value> <value type="QString">TERM=xterm</value> <value type="QString">USER=froger_a</value> <value type="QString">USERNAME=froger_a</value> - <value type="QString">WINDOWID=10485796</value> - <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> - <value type="QString">XAUTHORITY=/tmp/.gdm0ICXQW</value> + <value type="QString">WINDOWID=12582948</value> + <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> + <value type="QString">XAUTHORITY=/tmp/.gdm9DVURW</value> <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> - <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358754471.558659-246518931</value> + <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1359032006.901905-2088645706</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/gmvc/gmodel.cpp b/gmvc/gmodel.cpp deleted file mode 100644 index 38a2aa3..0000000 --- a/gmvc/gmodel.cpp +++ /dev/null @@ -1,162 +0,0 @@ -#include "gmodel.h" - -gModel::gModel(QObject *parent) : - QAbstractListModel(parent) -{ -} - -QVariant gModel::data(const QModelIndex &index, int role) const - { - if (!index.isValid()) - return QVariant(); - - if (role == Qt::DecorationRole) - return QIcon(pixmaps.value(index.row()).scaled(60, 60, - Qt::KeepAspectRatio, Qt::SmoothTransformation)); - /*else if (role == Qt::UserRole) - return pixmaps.value(index.row()); - else if (role == Qt::UserRole + 1) - return locations.value(index.row());*/ - - return QVariant(); - } - - void gModel::addPiece(const QPixmap &pixmap, const QPoint &location) - { - /*int row; - if (int(2.0*qrand()/(RAND_MAX+1.0)) == 1) - row = 0; - else - row = pixmaps.size();*/ - int row = pixmaps.size(); - - beginInsertRows(QModelIndex(), row, row); - pixmaps.insert(row, pixmap); - //locations.insert(row, location); - endInsertRows(); - } - - /*Qt::ItemFlags gModel::flags(const QModelIndex &index) const - { - if (index.isValid()) - return (Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled); - - return Qt::ItemIsDropEnabled; - }*/ - - /*bool gModel::removeRows(int row, int count, const QModelIndex &parent) - { - if (parent.isValid()) - return false; - - if (row >= pixmaps.size() || row + count <= 0) - return false; - - int beginRow = qMax(0, row); - int endRow = qMin(row + count - 1, pixmaps.size() - 1); - - beginRemoveRows(parent, beginRow, endRow); - - while (beginRow <= endRow) { - pixmaps.removeAt(beginRow); - locations.removeAt(beginRow); - ++beginRow; - } - - endRemoveRows(); - return true; - }*/ - - /*QStringList gModel::mimeTypes() const - { - QStringList types; - types << "image/x-puzzle-piece"; - return types; - }*/ - - /*QMimeData *gModel::mimeData(const QModelIndexList &indexes) const - { - QMimeData *mimeData = new QMimeData(); - QByteArray encodedData; - - QDataStream stream(&encodedData, QIODevice::WriteOnly); - - foreach (QModelIndex index, indexes) { - if (index.isValid()) { - QPixmap pixmap = qVariantValue<QPixmap>(data(index, Qt::UserRole)); - QPoint location = data(index, Qt::UserRole+1).toPoint(); - stream << pixmap << location; - } - } - - mimeData->setData("image/x-puzzle-piece", encodedData); - return mimeData; - }*/ - - /*bool gModel::dropMimeData(const QMimeData *data, Qt::DropAction action, - int row, int column, const QModelIndex &parent) - { - if (!data->hasFormat("image/x-puzzle-piece")) - return false; - - if (action == Qt::IgnoreAction) - return true; - - if (column > 0) - return false; - - int endRow; - - if (!parent.isValid()) { - if (row < 0) - endRow = pixmaps.size(); - else - endRow = qMin(row, pixmaps.size()); - } else - endRow = parent.row(); - - QByteArray encodedData = data->data("image/x-puzzle-piece"); - QDataStream stream(&encodedData, QIODevice::ReadOnly); - - while (!stream.atEnd()) { - QPixmap pixmap; - QPoint location; - stream >> pixmap >> location; - - beginInsertRows(QModelIndex(), endRow, endRow); - pixmaps.insert(endRow, pixmap); - locations.insert(endRow, location); - endInsertRows(); - - ++endRow; - } - - return true; - }*/ - - int gModel::rowCount(const QModelIndex &parent) const - { - if (parent.isValid()) - return 0; - else - return pixmaps.size(); - } - - /*Qt::DropActions gModel::supportedDropActions() const - { - return Qt::CopyAction | Qt::MoveAction; - }*/ - -/* void gModel::addPieces(const QPixmap& pixmap) - { - beginRemoveRows(QModelIndex(), 0, 24); - pixmaps.clear(); - locations.clear(); - endRemoveRows(); - for (int y = 0; y < 5; ++y) { - for (int x = 0; x < 5; ++x) { - QPixmap pieceImage = pixmap.copy(x*80, y*80, 80, 80); - addPiece(pieceImage, QPoint(x, y)); - } - } - }*/ diff --git a/gmvc/gmodel.h b/gmvc/gmodel.h deleted file mode 100644 index 3e5a787..0000000 --- a/gmvc/gmodel.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef GMODEL_H -#define GMODEL_H - -#include <QAbstractListModel> -#include <QPixmap> -#include <QIcon> -#include <QMimeData> - -class gModel : - public QAbstractListModel -{ - public: - gModel(QObject *parent = 0); - - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - //Qt::ItemFlags flags(const QModelIndex &index) const; - //bool removeRows(int row, int count, const QModelIndex &parent); - - //bool dropMimeData(const QMimeData *data, Qt::DropAction action, - // int row, int column, const QModelIndex &parent); - //QMimeData *mimeData(const QModelIndexList &indexes) const; - //QStringList mimeTypes() const; - int rowCount(const QModelIndex &parent) const; - //Qt::DropActions supportedDropActions() const; - - void addPiece(const QPixmap &pixmap, const QPoint &location); - //void addPieces(const QPixmap& pixmap); - - private: - QList<QPoint> locations; - QList<QPixmap> pixmaps; -}; - -#endif // GMODEL_H diff --git a/gmvc/gmvc.pro b/gmvc/gmvc.pro deleted file mode 100644 index 81e49e5..0000000 --- a/gmvc/gmvc.pro +++ /dev/null @@ -1,13 +0,0 @@ -# ------------------------------------------------- -# Project created by QtCreator 2013-01-23T09:31:00 -# ------------------------------------------------- -TARGET = gmvc -TEMPLATE = app -SOURCES += main.cpp \ - mainwindow.cpp \ - model.cpp \ - gmodel.cpp -HEADERS += mainwindow.h \ - model.h \ - gmodel.h -FORMS += mainwindow.ui diff --git a/gmvc/gmvc.pro.user b/gmvc/gmvc.pro.user deleted file mode 100644 index 4a75b91..0000000 --- a/gmvc/gmvc.pro.user +++ /dev/null @@ -1,251 +0,0 @@ -<!DOCTYPE QtCreatorProject> -<qtcreator> - <data> - <variable>RunConfiguration0-BaseEnvironmentBase</variable> - <value type="int">2</value> - </data> - <data> - <variable>RunConfiguration0-CommandLineArguments</variable> - <valuelist type="QVariantList"/> - </data> - <data> - <variable>RunConfiguration0-ProFile</variable> - <value type="QString">gmvc.pro</value> - </data> - <data> - <variable>RunConfiguration0-RunConfiguration.name</variable> - <value type="QString">gmvc</value> - </data> - <data> - <variable>RunConfiguration0-UseDyldImageSuffix</variable> - <value type="bool">false</value> - </data> - <data> - <variable>RunConfiguration0-UseTerminal</variable> - <value type="bool">false</value> - </data> - <data> - <variable>RunConfiguration0-UserEnvironmentChanges</variable> - <valuelist type="QVariantList"/> - </data> - <data> - <variable>RunConfiguration0-UserSetName</variable> - <value type="bool">false</value> - </data> - <data> - <variable>RunConfiguration0-UserSetWorkingDirectory</variable> - <value type="bool">false</value> - </data> - <data> - <variable>RunConfiguration0-UserWorkingDirectory</variable> - <value type="QString"></value> - </data> - <data> - <variable>RunConfiguration0-type</variable> - <value type="QString">Qt4ProjectManager.Qt4RunConfiguration</value> - </data> - <data> - <variable>activeRunConfiguration</variable> - <value type="int">0</value> - </data> - <data> - <variable>activebuildconfiguration</variable> - <value type="QString">Debug</value> - </data> - <data> - <variable>buildConfiguration-Debug</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> - <value key="QtVersionId" type="int">0</value> - <value key="ToolChain" type="int">0</value> - <value key="addQDumper" type=""></value> - <value key="buildConfiguration" type="int">2</value> - </valuemap> - </data> - <data> - <variable>buildConfiguration-Release</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> - <value key="QtVersionId" type="int">0</value> - <value key="addQDumper" type=""></value> - <value key="buildConfiguration" type="int">0</value> - </valuemap> - </data> - <data> - <variable>buildconfiguration-Debug-buildstep0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> - <valuelist key="abstractProcess.Environment" type="QVariantList"> - <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-0VAN4sEd5T,guid=75a5318e040070f8fcb70ccf006944fa</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-nVYZaO</value> - <value type="QString">GNOME_KEYRING_PID=27939</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">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/gmvc</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=28014</value> - <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-yzfMR27948/agent.27948</value> - <value type="QString">TERM=xterm</value> - <value type="QString">USER=froger_a</value> - <value type="QString">USERNAME=froger_a</value> - <value type="QString">WINDOWID=10485796</value> - <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> - <value type="QString">XAUTHORITY=/tmp/.gdmBDX0QW</value> - <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> - <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358946750.592912-119709926</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> - <value type="QString">XTERM_VERSION=XTerm(261)</value> - <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/gmvc/gmvc.pro</value> - <value type="QString">-spec</value> - <value type="QString">linux-g++</value> - <value type="QString">-r</value> - <value type="QString">CONFIG+=debug</value> - </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/gmvc</value> - </valuemap> - </data> - <data> - <variable>buildconfiguration-Debug-buildstep1</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> - <valuelist key="abstractProcess.Environment" type="QVariantList"> - <value type="QString">DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-0VAN4sEd5T,guid=75a5318e040070f8fcb70ccf006944fa</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-nVYZaO</value> - <value type="QString">GNOME_KEYRING_PID=27939</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">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/gmvc</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=28014</value> - <value type="QString">SSH_AUTH_SOCK=/tmp/ssh-yzfMR27948/agent.27948</value> - <value type="QString">TERM=xterm</value> - <value type="QString">USER=froger_a</value> - <value type="QString">USERNAME=froger_a</value> - <value type="QString">WINDOWID=10485796</value> - <value type="QString">WINDOWPATH=7:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8:8</value> - <value type="QString">XAUTHORITY=/tmp/.gdmBDX0QW</value> - <value type="QString">XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/</value> - <value type="QString">XDG_SESSION_COOKIE=b24883b9b4dbfb80ea83575b00000a11-1358946750.592912-119709926</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> - <value type="QString">XTERM_VERSION=XTerm(261)</value> - <value type="QString">_=/usr/bin/qtcreator</value> - </valuelist> - <value key="abstractProcess.IgnoreReturnValue" type="bool">false</value> - <valuelist key="abstractProcess.arguments" type="QVariantList"> - <value type="QString">-w</value> - </valuelist> - <value key="abstractProcess.command" type="QString">/usr/bin/make</value> - <value key="abstractProcess.enabled" type="bool">true</value> - <value key="abstractProcess.workingDirectory" type="QString">/amd/nfs/volume1/home/stage/froger_a/qt/gmvc</value> - </valuemap> - </data> - <data> - <variable>buildconfiguration-Debug-cleanstep0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Debug</value> - <value key="cleanConfig" type="bool">true</value> - <valuelist key="makeargs" type="QVariantList"> - <value type="QString">clean</value> - </valuelist> - </valuemap> - </data> - <data> - <variable>buildconfiguration-Release-buildstep0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> - </valuemap> - </data> - <data> - <variable>buildconfiguration-Release-buildstep1</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> - </valuemap> - </data> - <data> - <variable>buildconfiguration-Release-cleanstep0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString">Release</value> - </valuemap> - </data> - <data> - <variable>buildconfigurations</variable> - <valuelist type="QVariantList"> - <value type="QString">Debug</value> - <value type="QString">Release</value> - </valuelist> - </data> - <data> - <variable>buildstep0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value> - <value key="mkspec" type="QString"></value> - </valuemap> - </data> - <data> - <variable>buildstep1</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value> - </valuemap> - </data> - <data> - <variable>buildsteps</variable> - <valuelist type="QVariantList"> - <value type="QString">trolltech.qt4projectmanager.qmake</value> - <value type="QString">trolltech.qt4projectmanager.make</value> - </valuelist> - </data> - <data> - <variable>cleanstep0</variable> - <valuemap type="QVariantMap"> - <value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString"></value> - <value key="clean" type="bool">true</value> - </valuemap> - </data> - <data> - <variable>cleansteps</variable> - <valuelist type="QVariantList"> - <value type="QString">trolltech.qt4projectmanager.make</value> - </valuelist> - </data> - <data> - <variable>defaultFileEncoding</variable> - <value type="QByteArray">System</value> - </data> - <data> - <variable>project</variable> - <valuemap type="QVariantMap"/> - </data> -</qtcreator> diff --git a/gmvc/main.cpp b/gmvc/main.cpp deleted file mode 100644 index ab61e7c..0000000 --- a/gmvc/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include <QtGui/QApplication> -#include "mainwindow.h" - -int main(int argc, char *argv[]) -{ - QApplication::setGraphicsSystem("raster"); - QApplication a(argc, argv); - MainWindow w; - w.show(); - return a.exec(); -} diff --git a/gmvc/mainwindow.cpp b/gmvc/mainwindow.cpp deleted file mode 100644 index d046226..0000000 --- a/gmvc/mainwindow.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "mainwindow.h" -#include "ui_mainwindow.h" - -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::MainWindow) -{ - ui->setupUi(this); - - QListView *view = new QListView(); - view->setViewMode(QListView::IconMode); - view->setIconSize(QSize(100, 100)); - view->setMovement(QListView::Static); - view->setFlow(QListView::TopToBottom); - //view->setGridSize(QSize(300, 100)); - view->setSpacing(9); - - QList<QPixmap> pixmaps; - QStringList paths; - paths << "/lrde/home/stage/froger_a/ppm/mp00032c.ppm" << "/lrde/home/stage/froger_a/ppm/mp00042.ppm" << "/lrde/home/stage/froger_a/ppm/mp00076.ppm"; - QString path; - Model *model = new Model(this); - foreach(path, paths) - { - QPixmap pixmap(path); - model->addPixmap(pixmap); - } - - view->setModel(model); - //setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); - - setCentralWidget(view); -} - -MainWindow::~MainWindow() -{ - delete ui; -} - -void MainWindow::changeEvent(QEvent *e) -{ - QMainWindow::changeEvent(e); - switch (e->type()) - { - case QEvent::LanguageChange: - ui->retranslateUi(this); - break; - default: - break; - } -} diff --git a/gmvc/mainwindow.h b/gmvc/mainwindow.h deleted file mode 100644 index 822c275..0000000 --- a/gmvc/mainwindow.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include <QMainWindow> -#include <QHBoxLayout> -#include <QListView> - -#include "gmodel.h" -#include "model.h" - -namespace Ui { - class MainWindow; -} - -class MainWindow : public QMainWindow { - Q_OBJECT -public: - MainWindow(QWidget *parent = 0); - ~MainWindow(); - -protected: - void changeEvent(QEvent *e); - -private: - Ui::MainWindow *ui; -}; - -#endif // MAINWINDOW_H diff --git a/gmvc/mainwindow.ui b/gmvc/mainwindow.ui deleted file mode 100644 index 97c03be..0000000 --- a/gmvc/mainwindow.ui +++ /dev/null @@ -1,24 +0,0 @@ -<ui version="4.0"> - <class>MainWindow</class> - <widget class="QMainWindow" name="MainWindow" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>600</width> - <height>400</height> - </rect> - </property> - <property name="windowTitle" > - <string>MainWindow</string> - </property> - <widget class="QMenuBar" name="menuBar" /> - <widget class="QToolBar" name="mainToolBar" /> - <widget class="QWidget" name="centralWidget" /> - <widget class="QStatusBar" name="statusBar" /> - </widget> - <layoutDefault spacing="6" margin="11" /> - <pixmapfunction></pixmapfunction> - <resources/> - <connections/> -</ui> diff --git a/gmvc/model.cpp b/gmvc/model.cpp deleted file mode 100644 index eb20cf8..0000000 --- a/gmvc/model.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "model.h" - -Model::Model(QObject *parent) : - QAbstractListModel(parent) -{ - this->pixmaps = pixmaps; -} - -int Model::rowCount(const QModelIndex& parent) const -{ - if (parent.isValid()) - return 0; - else - return pixmaps.size();; -} - -QVariant Model::data(const QModelIndex& index, int role) const -{ - if(!index.isValid()) - return QVariant(); - - if(role == Qt::DecorationRole) - return QIcon(pixmaps.value(index.row()).scaled(300, 300, Qt::KeepAspectRatio, Qt::SmoothTransformation)); - - if(role == Qt::UserRole) - return pixmaps.value(index.row()); - - return QVariant(); -} - -void Model::addPixmap(const QPixmap& pixmap) -{ - int row = pixmaps.size(); - beginInsertRows(QModelIndex(), row, row); - pixmaps.insert(row, pixmap); - endInsertRows(); -} diff --git a/gmvc/model.h b/gmvc/model.h deleted file mode 100644 index f2247f4..0000000 --- a/gmvc/model.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef MODEL_H -#define MODEL_H - -#include <QAbstractListModel> -#include <QIcon> - -class Model : - public QAbstractListModel -{ - public: - explicit Model(QObject *parent = 0); - QVariant data(const QModelIndex &index, int role) const; - int rowCount(const QModelIndex &parent) const; - void addPixmap(const QPixmap& pixmap); - - private: - QList<QPixmap> pixmaps; -}; - -#endif // MODEL_H -- 1.7.2.5
participants (1)
-
Antoine Froger