Skip to content

Commit

Permalink
Merge branch 'release-0.4.6'
Browse files Browse the repository at this point in the history
0.4.6 (2014_10_22)
o feature84 : added tabs to the UI
  • Loading branch information
suizokukan committed Oct 22, 2014
2 parents c983b86 + 998401a commit 2386a77
Show file tree
Hide file tree
Showing 76 changed files with 3,803 additions and 1,274 deletions.
Binary file modified art/readingmode_amode_on.xcf
Binary file not shown.
Binary file modified art/readingmode_lmode_on.xcf
Binary file not shown.
Binary file modified art/readingmode_rmode_on.xcf
Binary file not shown.
Binary file added art/screenshot_0_4_5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 12 additions & 4 deletions cppdipylon/2win32_static/dipylonreader.pro
Expand Up @@ -61,16 +61,21 @@ HEADERS += ./fixedparameters.h \
qt/commentaryeditor.h \
qt/commentarytoolbar.h \
qt/commentaryzone.h \
qt/ui.h \
qt/downloaddemodipydocs.h
qt/icons.h \
qt/mainwindow.h \
qt/posintextframeformat.h \
qt/presentationscreen.h \
qt/readingmodes.h \
qt/scsplitter.h \
qt/sourceeditor.h \
qt/sourcetoolbar.h \
qt/sourcezone.h \
qt/sctabs.h \
qt/texteditor.h \
qt/textformat.h \
qt/downloaddemodipydocs.h
qt/ui.h


SOURCES += ./main.cpp \
debugmsg/debugmsg.cpp \
Expand All @@ -88,16 +93,19 @@ SOURCES += ./main.cpp \
qt/commentaryeditor.cpp \
qt/commentarytoolbar.cpp \
qt/commentaryzone.cpp \
qt/ui.cpp \
qt/downloaddemodipydocs.cpp \
qt/icons.cpp \
qt/mainwindow.cpp \
qt/posintextframeformat.cpp \
qt/presentationscreen.cpp \
qt/scsplitter.cpp \
qt/sourceeditor.cpp \
qt/sourcetoolbar.cpp \
qt/sourcezone.cpp \
qt/sctabs.cpp \
qt/texteditor.cpp \
qt/textformat.cpp \
qt/downloaddemodipydocs.cpp
qt/ui.cpp

DESTDIR = build/
OBJECTS_DIR = build/
Expand Down
2 changes: 1 addition & 1 deletion cppdipylon/cpplint.py
Expand Up @@ -19,7 +19,7 @@

import os

invoking_cpplint = "python2 ~/projets/cpplint.py --linelength=120"
invoking_cpplint = "python2 ~/projets/cpplint.py --linelength=120 --filter=-runtime/references"

output_filename = 'cpplint_py__output'

Expand Down
35 changes: 21 additions & 14 deletions cppdipylon/cpplint_py__output
Expand Up @@ -60,40 +60,44 @@ Done processing ./qt/commentaryeditor.cpp
Total errors found: 0
Done processing ./qt/arrowformat.cpp
Total errors found: 0
Done processing ./qt/scsplitter.cpp
Total errors found: 0
Done processing ./qt/textformat.cpp
Total errors found: 0
./qt/commentaryeditor.h:49: Is this a non-const reference? If so, make const or use a pointer: UI& _ui [runtime/references] [2]
Done processing ./qt/commentaryeditor.h
Total errors found: 1
./qt/sourcezone.h:57: Is this a non-const reference? If so, make const or use a pointer: UI& _ui [runtime/references] [2]
Total errors found: 0
Done processing ./qt/sourcezone.h
Total errors found: 1
./qt/sourcetoolbar.h:48: Is this a non-const reference? If so, make const or use a pointer: UI& _ui [runtime/references] [2]
Total errors found: 0
Done processing ./qt/sourcetoolbar.h
Total errors found: 1
Total errors found: 0
Done processing ./qt/downloaddemodipydocs.cpp
Total errors found: 0
./qt/sourceeditor.h:58: Is this a non-const reference? If so, make const or use a pointer: UI& _ui [runtime/references] [2]
Done processing ./qt/readingmodes.h
Total errors found: 0
Done processing ./qt/icons.h
Total errors found: 0
Done processing ./qt/sourceeditor.h
Total errors found: 1
Total errors found: 0
Done processing ./qt/posintextframeformat.h
Total errors found: 0
Done processing ./qt/scsplitter.h
Total errors found: 0
Done processing ./qt/ui.h
Total errors found: 0
./qt/commentaryzone.h:57: Is this a non-const reference? If so, make const or use a pointer: UI& _ui [runtime/references] [2]
Done processing ./qt/commentaryzone.h
Total errors found: 1
Total errors found: 0
Done processing ./qt/downloaddemodipydocs.h
Total errors found: 0
Done processing ./qt/sourceeditor.cpp
Total errors found: 0
./qt/texteditor.h:49: Is this a non-const reference? If so, make const or use a pointer: UI& _ui [runtime/references] [2]
Done processing ./qt/texteditor.h
Total errors found: 1
Total errors found: 0
Done processing ./qt/commentarytoolbar.cpp
Total errors found: 0
Done processing ./qt/arrowformat.h
Total errors found: 0
Done processing ./qt/sctabs.cpp
Total errors found: 0
Done processing ./qt/texteditor.cpp
Total errors found: 0
Done processing ./qt/blockformat.h
Expand All @@ -102,13 +106,16 @@ Done processing ./qt/textformat.h
Total errors found: 0
Done processing ./qt/sourcetoolbar.cpp
Total errors found: 0
./qt/mainwindow.h:69: Is this a non-const reference? If so, make const or use a pointer: UI& _ui [runtime/references] [2]
Done processing ./qt/sctabs.h
Total errors found: 0
Done processing ./qt/mainwindow.h
Total errors found: 1
Total errors found: 0
Done processing ./qt/mainwindow.cpp
Total errors found: 0
Done processing ./qt/presentationscreen.cpp
Total errors found: 0
Done processing ./qt/icons.cpp
Total errors found: 0
Done processing ./qt/posintextframeformat.cpp
Total errors found: 0
Done processing ./qt/commentaryzone.cpp
Expand Down
7 changes: 4 additions & 3 deletions cppdipylon/debugmsg/debugmsg.h
Expand Up @@ -50,8 +50,8 @@
______________________________________________________________________________*/
class DebugMsg {
public:
DebugMsg(void);
~DebugMsg(void);
DebugMsg(void);
~DebugMsg(void);

DebugMsg& operator<<(const int& argument);
DebugMsg& operator<<(const QString& argument);
Expand All @@ -63,7 +63,7 @@ class DebugMsg {
static QStringList messages;

private:
std::ostringstream stream;
std::ostringstream stream;
};

/*______________________________________________________________________________
Expand All @@ -72,6 +72,7 @@ class DebugMsg {
______________________________________________________________________________*/
inline DebugMsg::DebugMsg() {
DebugMsg::messages << "*** ";
}

/*______________________________________________________________________________
Expand Down
93 changes: 65 additions & 28 deletions cppdipylon/dipydoc/dipydoc.cpp
Expand Up @@ -28,10 +28,15 @@
#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::condensed_extracts_length = 30;
const QString DipyDoc::condensed_extracts_separator = "//";

/*______________________________________________________________________________
DipyDoc::constructor from a "_path" : initialize "this" from the files
stored in "_path"
stored in "_path"
See above for a description of the expected files.
Expand Down Expand Up @@ -59,6 +64,8 @@ DipyDoc::DipyDoc(const QString& _path) {

// let's initialize the qsettings' name :
this->set_qsettings_name();
// let's initialize the internal name :
this->set_internal_name();

// let's open the main file :
this->read_mainfile(_path);
Expand Down Expand Up @@ -285,14 +292,14 @@ QString DipyDoc::get_condensed_extracts_from_the_source_text(PosInTextRanges pos

for (auto &textrange : positions) {
QString substring = this->source_text.text.mid(static_cast<int>(textrange.first),
static_cast<int>(textrange.second - textrange.first));
static_cast<int>(textrange.second - textrange.first));
res += substring;
res += condensed_extracts_separator;
}

// removing the last '//', if necessary :
if (positions.size() != 0) {
res.chop(strlen(condensed_extracts_separator));
res.chop(condensed_extracts_separator.size());
}

if (res.length() > maxlength) {
Expand All @@ -304,6 +311,20 @@ QString DipyDoc::get_condensed_extracts_from_the_source_text(PosInTextRanges pos
return res;
}

/*______________________________________________________________________________
DipyDoc::get_tab_name()
Return a name convenient to tabs' display.
________________________________________________________________________________*/
QString DipyDoc::get_tab_name(void) {
if (this->menu_name.size() <= fixedparameters::maxlen_in_tab_name) {
return this->menu_name;
} else {
return "" + this->menu_name.right(fixedparameters::maxlen_in_tab_name-1);
}
}

/*______________________________________________________________________________
DipyDoc::get_xml_repr
Expand Down Expand Up @@ -774,7 +795,9 @@ bool DipyDoc::read_mainfile__first_token(QXmlStreamReader* xmlreader) {
let's read and check the languages :
*/
this->languagefromto = LanguageFromTo(xmlreader->attributes().value("languages").toString());
bool languagesfromto_ok = !this->error(this->languagefromto, this->error_string(xmlreader), "dipydoc:first token");
bool languagesfromto_ok = !this->error(this->languagefromto,
this->error_string(xmlreader),
"dipydoc:first token");
ok &= languagesfromto_ok;

/*
Expand Down Expand Up @@ -1225,7 +1248,6 @@ bool DipyDoc::read_mainfile__text(QXmlStreamReader* xmlreader) {
(1) secondary initializations
(1.1) initialization of "audiorecord.audio2text"
(1.2) "number_of_chars_before_source_text" is not initialized here
(2) checks
(2.1) is audiorecord.text2audio correctly initialized ?
(2.2) is audiorecord.audio2text correctly initialized ?
Expand Down Expand Up @@ -1255,29 +1277,6 @@ bool DipyDoc::read_mainfile__text__init_and_check(void) {
this->audiorecord.audio2text.clear();
}

/*............................................................................
(1.2) "number_of_chars_before_source_text" is not initialized here
The first attempt to compute "number_of_chars_before_source_text was doubtfull :
this->source_text.number_of_chars_before_source_text = 0;
if (this->title.found == true) {
this->source_text.number_of_chars_before_source_text += this->title.text.length();
}
if (this->introduction.found == true) {
this->source_text.number_of_chars_before_source_text += this->introduction.text.length();
}
if (this->lettrine.found == true) {
this->source_text.number_of_chars_before_source_text += 1;
}
... the main problem was that it's difficult to know how is the lettrine's
image coded into the text. The result was ok but I could not trust this
code : how will Qt work on different architectures ? So I decided to ask
SourceEditor::load_text() to initialize "number_of_chars_before_source_text"
by simply incrementing a cursor's position as the document is filled.
............................................................................*/

/*............................................................................
(2) checks
............................................................................*/
Expand Down Expand Up @@ -1453,6 +1452,24 @@ PTRangesAND2PosAudio DipyDoc::text2audio_contains(PosInText x0) const {
}
}

/*______________________________________________________________________________
DipyDoc::set_internal_name()
Initialize this->internal_name from this->menu_name
This function created name that can be used whin calls to setStyleSheet() :
the only characters accepted are "n_" + 0-9 + a-f.
________________________________________________________________________________*/
void DipyDoc::set_internal_name(void) {
QCryptographicHash hash(QCryptographicHash::Md5);
hash.addData("n_");
hash.addData(this->menu_name.toUtf8());
this->internal_name = hash.result().toHex();

DebugMsg() << "DipyDoc::set_internal_name = " << this->internal_name;
}

/*______________________________________________________________________________
DipyDoc::set_qsettings_name()
Expand All @@ -1466,6 +1483,8 @@ void DipyDoc::set_qsettings_name(void) {
this->qsettings_name = this->menu_name;
this->qsettings_name.replace("\\", "_");
this->qsettings_name.replace("/", "_");

DebugMsg() << "DipyDoc::set_qsettings_name = " << this->qsettings_name;
}

/*______________________________________________________________________________
Expand All @@ -1488,3 +1507,21 @@ ________________________________________________________________________________
PosInTextRanges DipyDoc::translation_contains(PosInText x0, PosInText x1) const {
return this->translation.translations.contains(x0, x1).toPosInTextRanges();
}

/*______________________________________________________________________________
DipyDoc::get_translations_for() : return a QString with the translations
matching the positions x0 to x1 in the
source text.
______________________________________________________________________________*/
QString DipyDoc::get_translations_for(PosInText x0, PosInText x1) const {
VectorPosInTextRanges vector_posintextranges = this->translation.translations.contains(x0, x1);

QStringList strlist_of_translations;

for (auto &posintextranges : vector_posintextranges) {
strlist_of_translations.append(this->translation.translations[posintextranges]);
}

return strlist_of_translations.join(" ");
}

0 comments on commit 2386a77

Please sign in to comment.