Skip to content

Commit

Permalink
Merge branch 'release-0.4.7'
Browse files Browse the repository at this point in the history
0.4.7 (2014_10_22)
o feature89 : splitters' sizes are now stored in settings' file.
o feature85 : added style sheets to SourceZoneToolBar and CommentaryToolBar
+ feature91, feature90, feature88, feature87, feature86
code quality : 2 errors, according to cpplint.py
  • Loading branch information
suizokukan committed Oct 22, 2014
2 parents 2386a77 + fa9ed88 commit 66f4fcd
Show file tree
Hide file tree
Showing 17 changed files with 169 additions and 30 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Expand Up @@ -6,5 +6,4 @@ moc_*.cpp
builds/
cppdipylon/temp__*/
cppdipylon/tests/Makefile
cppdipylon/tests/tests
todo
cppdipylon/tests/tests
65 changes: 65 additions & 0 deletions README
@@ -1 +1,66 @@
(C++/Qt5) front-end used to read texts with some annotations

TODO

[ui]
- ouvrir le(s) dernier(s) fichier(s) ouverts
- (ui)menu contextuel avec espace
- (ui)ouvrir la liste des documents disponibles dès le lancement.
- (ui)icône hidetoolbar : reprendre les couleurs de la toolbar.
- créer une entrée dans les menus où le splashscreen est autorisé/interdit, afin de modifier : this->display_splashscreen == true
- [ui] flèche gauche, flèche droite : passer d'un segment à l'autre (+first pos, +last pos)
- [ui] Menu : informations sur le dipydoc
- [ui] faire pivoter les fenêtres : bouton ou dragable (cf QDockWidget)
- [ui] si zone de traduction horizontale, placer la traduction à la même hauteur que le le texte traduit.
- [ui/tablette] bouton Menu (en haut à gauche ? un gros point ?)
- [ui] mute/volume slider (http://qt-project.org/doc/qt-5/qtwidgets-widgets-sliders-example.html)
- [ui] -/+ taille du texte
- [ui] interface jeunes enfants : grosses icônes + gros curseur souris.
- [ui] menu contextuel click droit
- [ui] si pas de traduction, update icônes
- [ui] justify ne fonctionne pas (au moins sur Linux)

[+]
- afficher correctement le mode AMODE
- doc. achetés : Fichier>télécharger doc. acheté avec le n° du doc. acheté.
- permettre des variantes dans le texte.
- vector of DipyDocTranslation + current_translation (plusieurs traductions possibles, ...)
- variantes d'un texe
- document image (http://qt-project.org/doc/qt-5/qpixmap.html#details)

[code]
- que faire de bool MainWindow::saveMainFileOfADipyDocAs() ??// READ_AND_WRITE n'est nulle part utilisé.
- réfléchir à la question : le ~/dipydocs est-il complètement nettoyé après un download ? Documenter ce comportement.
- memory leaks : regarder valgrind + g++ -g
- pointeurs const par sécurité partout où c'est possible.
- DebugMsg() sur une seule ligne pour facilement les remplacer par //DebugMsg() pour une version optimisée.
- relire le code : les include sont-ils nécessaires ?
- et si on clique dans l'intro ? comment réagissent les _contains() ?
- réécrire les .sh en script python + inclure un numéro de build.
- dans ... , vérifier que "number", "name" existent :

if( name == "level" ) {
current_division = DIPYDOCDIV_INSIDE_LEVEL;
int level_number = xmlreader.attributes().value("number").toString().toInt();
QString level_name = xmlreader.attributes().value("name").toString();
this->levels[ level_number ] = level_name;
continue;
}

[doc]
- (doc)numéroter toutes les connexions (TOUS LES connect()) et faire un dessin.
- (doc)friend class/include/ à relire : sont-ils nécessaires ?
- this->setParent()+this->setName() -> doc.

[crossplaform]
- renommer MXE MXE_Qt5_1
- build : Linux_static/Linux_dynamique/Win32static/Win64static/OSXstatic/IPadStatic/AndroidStatic
- [win] installateur Windows (cf mail de ~)
- java :
rpm -ivh jdk-<version>-linux-x64.rpm

~/.bashrc
export JAVA_HOME=/usr/java/default/
export PATH=$JAVA_HOME/bin:$PATH


2 changes: 1 addition & 1 deletion cppdipylon/2win32_static/dipylonreader.pro
Expand Up @@ -61,7 +61,7 @@ HEADERS += ./fixedparameters.h \
qt/commentaryeditor.h \
qt/commentarytoolbar.h \
qt/commentaryzone.h \
qt/downloaddemodipydocs.h
qt/downloaddemodipydocs.h \
qt/icons.h \
qt/mainwindow.h \
qt/posintextframeformat.h \
Expand Down
5 changes: 2 additions & 3 deletions cppdipylon/dipydoc/dipydoc.cpp
Expand Up @@ -26,10 +26,9 @@
*******************************************************************************/

#include "dipydoc/dipydoc.h"
#include "debugmsg/debugmsg.h"

const int DipyDoc::min_dipydocformat_version = 33;
const int DipyDoc::max_dipydocformat_version = 33;
const int DipyDoc::min_dipydocformat_version = fixedparameters::min_dipydocformat_version;
const int DipyDoc::max_dipydocformat_version = fixedparameters::min_dipydocformat_version;
const int DipyDoc::condensed_extracts_length = 30;
const QString DipyDoc::condensed_extracts_separator = "//";

Expand Down
1 change: 1 addition & 0 deletions cppdipylon/dipydoc/dipydoc.h
Expand Up @@ -43,6 +43,7 @@
#include <utility>

#include "./fixedparameters.h"
#include "debugmsg/debugmsg.h"
#include "dipydoc/menunames.h"
#include "dipydoc/dipydocnotes.h"
#include "languages/languagefromto.h"
Expand Down
12 changes: 11 additions & 1 deletion cppdipylon/fixedparameters.h
Expand Up @@ -43,6 +43,12 @@ const QString CODESOURCE_LICENSE = "GPLv3";
// license's address :
const QString CODESOURCE_LICENSE_ADDRESS= "http://www.gnu.org/copyleft/gpl.html";

/*
minimal/maximal DipyDoc's versions allowed :
*/
const int min_dipydocformat_version = 33;
const int max_dipydocformat_version = 33;

/*
data used to initialize the QApplication object.
Expand All @@ -52,7 +58,7 @@ const QString organization_name = "suizokukanfactory";
const QString organization_domain = "94.23.197.37";
const QString application_name = "dipylonreader";
const QString application_name_for_the_user = "Dipylon-R";
const QString application_version = "0.4.6";
const QString application_version = "0.4.7";
const QString application_style = "CleanLooks";

/*
Expand Down Expand Up @@ -89,6 +95,10 @@ const QString default__commentaryeditor_stylesheet = "color: white;"
"selection-color: yellow;"
"selection-background-color: red;";

const QString default__sourcetoolbar_stylesheet = "background-color: #efebe7;";

const QString default__commentarytoolbar_stylesheet = "background-color: #efebe7;";

const QStringList known_doctypes = { QString("text"), };

// default zoom value for both editors :
Expand Down
1 change: 1 addition & 0 deletions cppdipylon/qt/commentaryeditor.cpp
Expand Up @@ -42,6 +42,7 @@ CommentaryEditor::CommentaryEditor(const QString & splitter_name,
this->setObjectName(object_name);

this->setReadOnly(true);
this->set_zoom_value(this->zoom_value);
this->update_aspect_from_dipydoc_aspect_informations();
}

Expand Down
2 changes: 2 additions & 0 deletions cppdipylon/qt/commentarytoolbar.cpp
Expand Up @@ -41,5 +41,7 @@ CommentaryToolBar::CommentaryToolBar(const QString & _splitter_name,

this->setOrientation(Qt::Vertical);

this->setStyleSheet(fixedparameters::default__commentarytoolbar_stylesheet);

DebugMsg() << "CommentaryToolBar::CommentaryToolBar : exit point";
}
1 change: 1 addition & 0 deletions cppdipylon/qt/commentarytoolbar.h
Expand Up @@ -30,6 +30,7 @@

#include <QToolBar>

#include "./fixedparameters.h"
#include "debugmsg/debugmsg.h"

/*______________________________________________________________________________
Expand Down
81 changes: 64 additions & 17 deletions cppdipylon/qt/scsplitter.cpp
Expand Up @@ -89,7 +89,6 @@ SCSplitter::SCSplitter(const int index_in_scbar,
<< QString("#%1::handle:vertical {height: 5px;}").arg(this->objectName());
this->setStyleSheet(QString("#%1::handle:vertical {height: 5px;}").arg(this->objectName()));
this->setOrientation(Qt::Vertical);
this->setSizes(fixedparameters::default__editors_size_in_main_splitter);

this->source_zone = new SourceZone(this->objectName(),
this->dipydoc,
Expand All @@ -106,7 +105,16 @@ SCSplitter::SCSplitter(const int index_in_scbar,
this->addWidget(this->commentary_zone);

/*
(3) signals
(3) settings' value for the current text; apply these values to te UI.
*/
this->read_settings();

this->setSizes(this->splittersizes);
this->source_zone->editor->set_zoom_value(this->source_zone->editor->zoom_value);
this->commentary_zone->editor->set_zoom_value(this->commentary_zone->editor->zoom_value);

/*
(4) signals
*/

// (confer doc.) connection #C001
Expand All @@ -129,15 +137,6 @@ SCSplitter::SCSplitter(const int index_in_scbar,
QObject::connect(this->source_zone, &SourceZone::signal__update_icons,
this, &SCSplitter::update_icons);

/*
(4) zoom value of the current text
*/
QSettings settings;
settings.setValue(QString("text/%1/sourceeditor/zoomvalue").arg(this->dipydoc.qsettings_name),
this->source_zone->editor->zoom_value);
settings.setValue(QString("text/%1/commentaryeditor/zoomvalue").arg(this->dipydoc.qsettings_name),
this->commentary_zone->editor->zoom_value);

/*
(5) update icons
*/
Expand All @@ -164,6 +163,34 @@ QString SCSplitter::get_object_name(const int index_in_scbar) const {
QString().setNum(index_in_scbar));
}

/*______________________________________________________________________________
SCSplitter::read_settings()
Read the settings value from the settings' file.
________________________________________________________________________________*/
void SCSplitter::read_settings(void) {
DebugMsg() << "SCSplitter::read_settings()";

QSettings settings;
this->source_zone->editor->zoom_value = \
settings.value(QString("text/%1/sourceeditor/zoomvalue").arg(this->dipydoc.qsettings_name),
fixedparameters::default__zoom_value).toInt();

this->commentary_zone->editor->zoom_value = \
settings.value(QString("text/%1/commentaryeditor/zoomvalue").arg(this->dipydoc.qsettings_name),
fixedparameters::default__zoom_value).toInt();

/*
see SCSplitter::write_settings for the explanations.
*/
this->splittersizes.clear();
foreach(QVariant v,
settings.value(QString("text/%1/splittersizes").arg(this->dipydoc.qsettings_name)).toList()) {
this->splittersizes << v.toInt();
}
}

/*______________________________________________________________________________
SCSplitter::update_icons()
Expand All @@ -190,13 +217,23 @@ void SCSplitter::update_icons(void) {
this->source_zone->update_icons();
}

/*______________________________________________________________________________
SCSplitter::well_initialized
______________________________________________________________________________*/
bool SCSplitter::well_initialized(void) const {
return this->_well_initialized;
}

/*______________________________________________________________________________
SCSplitter::write_settings()
Write the settings specific to the DipyDoc linked to "this".
________________________________________________________________________________*/
void SCSplitter::write_settings(void) {
DebugMsg() << "SCSplitter::write_settings()";

QSettings settings;

/*
Expand All @@ -206,12 +243,22 @@ void SCSplitter::write_settings(void) {
this->source_zone->editor->zoom_value);
settings.setValue(QString("text/%1/commentaryeditor/zoomvalue").arg(this->dipydoc.qsettings_name),
this->commentary_zone->editor->zoom_value);
}
/*
splitter's sizes :
/*______________________________________________________________________________
About the trick used here :
The normal way to store a QList<int> is described here [1] and here [2] but this
method leads to difficulties, at least on Linux system. Hence this work around
described here [3].
SCSplitter::well_initialized
______________________________________________________________________________*/
bool SCSplitter::well_initialized(void) const {
return this->_well_initialized;
[1] http://qt-project.org/doc/qt-5/qsettings.html#details
[2] http://stackoverflow.com/questions/2452893/save-qlistint-to-qsettings
[3] http://stackoverflow.com/questions/21923016
*/
QVariantList splittersizes_variant;
for (int & v : this->sizes()) {
splittersizes_variant << v;
}
settings.setValue(QString("text/%1/splittersizes").arg(this->dipydoc.qsettings_name),
splittersizes_variant);
}
6 changes: 3 additions & 3 deletions cppdipylon/qt/scsplitter.h
Expand Up @@ -30,6 +30,7 @@

#include <QApplication>
#include <QMessageBox>
#include <QMetaType>
#include <QSettings>
#include <QSplitter>
#include <QString>
Expand Down Expand Up @@ -58,15 +59,14 @@ friend class MainWindow;
bool & visible_toolbars;
bool _well_initialized = false; // object state
bool blocked_commentaries = false;

DipyDoc dipydoc = DipyDoc();

SourceZone* source_zone = nullptr; // (ui) source zone
CommentaryZone* commentary_zone = nullptr; // (ui) commentary zone

ReadingMode readingmode = READINGMODE::READINGMODE_UNDEFINED;
ReadingModeDetails readingmode_details = READINGMODEDETAILS::READINGMODEDETAIL_UNDEFINED;
QList<int> splittersizes = fixedparameters::default__editors_size_in_main_splitter;

void read_settings(void);
void write_settings(void);

private slots: // NOLINT(whitespace/indent)
Expand Down
2 changes: 1 addition & 1 deletion cppdipylon/qt/sourceeditor.cpp
Expand Up @@ -394,7 +394,7 @@ void SourceEditor::mouseReleaseEvent(QMouseEvent* mouse_event) {

// where are the characters in the translations linked to "x0-x1" ?
PosInTextRanges pos_in_text = this->dipydoc.translation_contains(x0, x1);
DebugMsg() << "... pos_in_text=" << pos_in_text.repr();
DebugMsg() << x0 << "-" << x1 << "; pos_in_text=" << pos_in_text.repr();

/*
we refresh the ui :
Expand Down
2 changes: 2 additions & 0 deletions cppdipylon/qt/sourcetoolbar.cpp
Expand Up @@ -40,5 +40,7 @@ SourceToolBar::SourceToolBar(const QString & splitter_name,

this->setOrientation(Qt::Vertical);

this->setStyleSheet(fixedparameters::default__sourcetoolbar_stylesheet);

DebugMsg() << "SourceToolBar::SourceToolBar : exit point";
}
1 change: 1 addition & 0 deletions cppdipylon/qt/sourcetoolbar.h
Expand Up @@ -30,6 +30,7 @@

#include <QToolBar>

#include "./fixedparameters.h"
#include "debugmsg/debugmsg.h"

/*______________________________________________________________________________
Expand Down
3 changes: 3 additions & 0 deletions cppdipylon/qt/texteditor.cpp
Expand Up @@ -34,6 +34,7 @@
class constructor
______________________________________________________________________________*/
TextEditor::TextEditor(QWidget *_parent) : QTextEdit(_parent) {
this->set_zoom_value(this->zoom_value);
}

/*______________________________________________________________________________
Expand Down Expand Up @@ -85,4 +86,6 @@ void TextEditor::wheelEvent(QWheelEvent * e) {
this->zoomOut(1);
}
}

QTextEdit::wheelEvent(e);
}
5 changes: 3 additions & 2 deletions cppdipylon/qt/texteditor.h
Expand Up @@ -50,12 +50,13 @@ friend class SCSplitter;
public:
explicit TextEditor(QWidget *_parent);

private:
protected:
int zoom_value = 0;
void set_zoom_value(const signed int value);

private:
void zoom_in(void);
void zoom_out(void);
void set_zoom_value(const signed int value);

protected:
void wheelEvent(QWheelEvent* e);
Expand Down
7 changes: 7 additions & 0 deletions dipylonreader.project
Expand Up @@ -66,8 +66,15 @@ SUMMARY
[0] roadmap
################################################################################

0.4.7 (2014_10_22)
o feature89 : splitters' sizes are now stored in settings' file.
o feature85 : added style sheets to SourceZoneToolBar and CommentaryToolBar
+ feature91, feature90, feature88, feature87, feature86
code quality : 2 errors, according to cpplint.py

0.4.6 (2014_10_22)
o feature84 : added tabs to the UI
code quality : 9 errors, according to cpplint.py

0.4.5 (2014_10_08)
o feature79 : Dipydocs format #33 (RECORD_EXT, summary files)
Expand Down

0 comments on commit 66f4fcd

Please sign in to comment.