Skip to content

Commit

Permalink
Merge branch 'release-0.4.3'
Browse files Browse the repository at this point in the history
0.4.3 :
o feature54 : DownloadDemoDipydocs class : download and remove demonstration
              DipyDocs.
o feature53 : Splashscreen is now centered with the main window.
o feature52 : Fixed a bug in the way the UI updated the commentary zone : this
              zone can now be updated only if a specific flag (bool
              UI::selected_text_and_blocked_commentaries) is set to false. This
              flag is set to true if, in RMODE, a portion of text has been
              selected.
o feature51 : The PosInTextRanges class doesn't use an unordered_map anymore but
              a map, allowing to store sorted keys.
o feature50 : (MainWindow::add_open_menu) added a special display to
              "File>Open>" if no Dipydoc could be found.
  • Loading branch information
suizokukan committed Sep 26, 2014
2 parents 8bbaa1a + 692e073 commit b254292
Show file tree
Hide file tree
Showing 27 changed files with 936 additions and 213 deletions.
Binary file added art/downloaddemo.xcf
Binary file not shown.
7 changes: 5 additions & 2 deletions cppdipylon/2win32_static/dipylonreader.pro
Expand Up @@ -23,6 +23,7 @@ DEFINES += MAXIMIZE_MAINWINDOW_TRUE_METHOD
DEFINES += STORE_DEBUG_MESSAGES
DEFINES += QT_NO_DEBUG_OUTPUT
DEFINES += DISPLAY_INTERNAL_MESSAGES_IN_HELP_MENUITEM
DEFINES += DOWNLOAD_MP3_VERSION_OF_DIPYDOCS

#_______________________________________________________________________________
#
Expand Down Expand Up @@ -62,7 +63,8 @@ HEADERS += ./fixedparameters.h \
qt/mainwindow.h \
qt/posintextframeformat.h \
qt/sourceeditor.h \
qt/textformat.h
qt/textformat.h \
qt/downloaddemodipydocs.h

SOURCES += ./main.cpp \
debugmsg/debugmsg.cpp \
Expand All @@ -82,7 +84,8 @@ SOURCES += ./main.cpp \
qt/mainwindow.cpp \
qt/posintextframeformat.cpp \
qt/sourceeditor.cpp \
qt/textformat.cpp
qt/textformat.cpp \
qt/downloaddemodipydocs.cpp

DESTDIR = build/
OBJECTS_DIR = build/
Expand Down
53 changes: 24 additions & 29 deletions cppdipylon/dipydoc/dipydoc.cpp
Expand Up @@ -318,7 +318,6 @@ QString DipyDoc::get_condensed_extracts_from_the_source_text(PosInTextRanges pos
______________________________________________________________________________*/
QString DipyDoc::get_xml_repr(void) const {
QString res;
VectorPosInTextRanges list_of_posintextranges;

/*............................................................................
header
Expand Down Expand Up @@ -412,49 +411,45 @@ QString DipyDoc::get_xml_repr(void) const {
............................................................................*/
if (this->audiorecord.found == true) {
res += "\n";
list_of_posintextranges.clear();

res += " <audiorecord \n"
" description=\"$AUDIORECORDNAME$\" \n"
" filename=\"$AUDIORECORDFILENAME$\" \n"
" informations=\"$AUDIORECORDINFORMATIONS$\" \n"
" >\n";

for (auto &textrange : this->audiorecord.text2audio) {
list_of_posintextranges.vposintextranges.push_back(textrange.first);
}
list_of_posintextranges.sort();
for (auto &textranges : list_of_posintextranges.vposintextranges) {
QString new_line(" <segment "
"textranges=\"$TEXTRANGE$\" "
"audiorange=\"$AUDIORANGE$\" "
"srctext=\"$TEXT$\" "
"/>\n");
new_line.replace("$TEXTRANGE$", textranges.repr());
PosInAudioRange posinaudiorange(this->audiorecord.text2audio[textranges]);
new_line.replace("$AUDIORANGE$", posinaudiorange.repr());
new_line.replace("$TEXT$",
this->get_condensed_extracts_from_the_source_text(textranges,
DipyDoc::condensed_extracts_length));
res += new_line;
}
for (auto &textranges_and_pairofposinaudio : this->audiorecord.text2audio) {
PosInTextRanges textranges = textranges_and_pairofposinaudio.first;

QString new_line(" <segment "
"textranges=\"$TEXTRANGE$\" "
"audiorange=\"$AUDIORANGE$\" "
"srctext=\"$TEXT$\" "
"/>\n");
new_line.replace("$TEXTRANGE$", textranges.repr());
PosInAudioRange posinaudiorange(this->audiorecord.text2audio[textranges]);
new_line.replace("$AUDIORANGE$", posinaudiorange.repr());
new_line.replace("$TEXT$",
this->get_condensed_extracts_from_the_source_text(textranges,
DipyDoc::condensed_extracts_length));
res += new_line;
}
res += " </audiorecord>\n";
}

/*............................................................................
translation : the functions reads through this->translation.translations with sorted keys.
............................................................................*/
res += "\n";
list_of_posintextranges.clear();

res += " <translation \n"
" description=\"$TRANSLATIONNAME$\" \n"
" informations=\"$TRANSLATIONINFORMATIONS$\" \n"
" >\n";
for (auto &textrange : this->translation.translations) {
list_of_posintextranges.vposintextranges.push_back(textrange.first);
}
list_of_posintextranges.sort();

for (auto &textranges : list_of_posintextranges.vposintextranges) {
for (auto &textranges_and_qstring : this->translation.translations) {
PosInTextRanges textranges = textranges_and_qstring.first;

QString new_line(" <segment "
"textranges=\"$TEXTRANGE$\" "
"srctext=\"$TEXT$\""
Expand Down Expand Up @@ -1315,7 +1310,7 @@ bool DipyDoc::read_mainfile__read_the_rest_of_the_file(QXmlStreamReader& xmlread
*/
if (tokenname == "notes") {

UMAPPosNoteI_BOOL last_note;
MAPPosNoteI_BOOL last_note;
bool last_note_ok = false;

while (xmlreader.readNextStartElement()) {
Expand Down Expand Up @@ -1347,7 +1342,7 @@ bool DipyDoc::read_mainfile__read_the_rest_of_the_file(QXmlStreamReader& xmlread

// modifying the last note's text :
if( last_note_ok == true ) {
UMAP_PosNoteI last_note_iterator = last_note.first;
MAP_PosNoteI last_note_iterator = last_note.first;
last_note_iterator->second.text = text;
}
continue;
Expand All @@ -1363,7 +1358,7 @@ bool DipyDoc::read_mainfile__read_the_rest_of_the_file(QXmlStreamReader& xmlread

// adding this arrow to the last note :
if( last_note_ok == true ) {
UMAP_PosNoteI last_note_iterator = last_note.first;
MAP_PosNoteI last_note_iterator = last_note.first;
last_note_iterator->second.arrows.push_back(ArrowTargetInANote(type, target));;
}
continue;
Expand Down
4 changes: 2 additions & 2 deletions cppdipylon/dipydoc/dipydocnotes.cpp
Expand Up @@ -86,9 +86,9 @@ QString DipyDocNotes::repr(void) {
insert in map[level][pos] a 'note'.
______________________________________________________________________________*/
UMAPPosNoteI_BOOL DipyDocNotes::insert(int level, PosInTextRanges pos, DipyDocNote note) {
MAPPosNoteI_BOOL DipyDocNotes::insert(int level, PosInTextRanges pos, DipyDocNote note) {
if (this->map.count(level) == 0) {
UMAP_PosNote empty_map;
MAP_PosNote empty_map;
this->map[level] = empty_map;
return this->map[level].insert( std::pair<PosInTextRanges, DipyDocNote>(pos, note) );
}
Expand Down
11 changes: 5 additions & 6 deletions cppdipylon/dipydoc/dipydocnotes.h
Expand Up @@ -30,7 +30,6 @@

#include <QString>

#include <unordered_map>
#include <map>

#include "pos/posintext/posintextranges.h"
Expand Down Expand Up @@ -94,12 +93,12 @@ inline DipyDocNote& DipyDocNote::operator=(const DipyDocNote& other) {
______________________________________________________________________________*/

typedef std::unordered_map<PosInTextRanges, DipyDocNote, PosInTextRangesHasher> UMAP_PosNote;
typedef UMAP_PosNote::iterator UMAP_PosNoteI;
typedef std::pair<UMAP_PosNoteI, bool> UMAPPosNoteI_BOOL;
typedef std::map<PosInTextRanges, DipyDocNote> MAP_PosNote;
typedef MAP_PosNote::iterator MAP_PosNoteI;
typedef std::pair<MAP_PosNoteI, bool> MAPPosNoteI_BOOL;

// (int)level -> (PosInTextRanges, DipyDocNote)
typedef std::map<int, UMAP_PosNote> MAP_Int2PosNote;
typedef std::map<int, MAP_PosNote> MAP_Int2PosNote;
typedef MAP_Int2PosNote::const_iterator MAP_Int2PosNoteCI;

struct DipyDocNotes {
Expand All @@ -108,7 +107,7 @@ struct DipyDocNotes {

MAP_Int2PosNoteCI begin(void) const;
MAP_Int2PosNoteCI end(void) const;
UMAPPosNoteI_BOOL insert(int level, PosInTextRanges pos, DipyDocNote note);
MAPPosNoteI_BOOL insert(int level, PosInTextRanges pos, DipyDocNote note);

void clear(void);
QString repr(void);
Expand Down
2 changes: 1 addition & 1 deletion cppdipylon/dipydoc/menunames.h
Expand Up @@ -68,7 +68,7 @@ inline MenuNames::MenuNames(const QString& path) {
this->menuname_to_directory.clear();

QDir dipydocs_path(path);
dipydocs_path.setFilter( QDir::AllDirs );
dipydocs_path.setFilter( QDir::Dirs );

for( auto &directory_name: dipydocs_path.entryList()) {
if ( (directory_name != ".") && (directory_name != "..") ) {
Expand Down
8 changes: 6 additions & 2 deletions cppdipylon/dipylonreader.pro
Expand Up @@ -24,7 +24,9 @@ DEFINES += DEBUG_MESSAGES_TO_CERR
DEFINES += STORE_DEBUG_MESSAGES
DEFINES += QT_NO_DEBUG_OUTPUT
DEFINES += DISPLAY_INTERNAL_MESSAGES_IN_HELP_MENUITEM
DEFINES += DOWNLOAD_OGG_VERSION_OF_DIPYDOCS

QT += network
QT += widgets
QT += multimedia

Expand All @@ -51,7 +53,8 @@ HEADERS += ./fixedparameters.h \
qt/mainwindow.h \
qt/posintextframeformat.h \
qt/sourceeditor.h \
qt/textformat.h
qt/textformat.h \
qt/downloaddemodipydocs.h

SOURCES += ./main.cpp \
debugmsg/debugmsg.cpp \
Expand All @@ -71,7 +74,8 @@ SOURCES += ./main.cpp \
qt/mainwindow.cpp \
qt/posintextframeformat.cpp \
qt/sourceeditor.cpp \
qt/textformat.cpp
qt/textformat.cpp \
qt/downloaddemodipydocs.cpp

DESTDIR = build/
OBJECTS_DIR = build/
Expand Down
2 changes: 2 additions & 0 deletions cppdipylon/dipylonreader.qrc
Expand Up @@ -20,5 +20,7 @@
<file>ressources/images/icons/audio_play.png</file>
<file>ressources/images/icons/audio_pause.png</file>
<file>ressources/images/icons/audio_stop.png</file>

<file>ressources/images/icons/downloaddemo.png</file>
</qresource>
</RCC>
22 changes: 21 additions & 1 deletion cppdipylon/fixedparameters.h
Expand Up @@ -42,7 +42,7 @@ namespace fixedparameters {
static const QString organization_name = "suizokukanfactory";
static const QString organization_domain = "94.23.197.37";
static const QString application_name = "dipylonreader";
static const QString application_version = "0.4.2";
static const QString application_version = "0.4.3";
static const QString application_style = "CleanLooks";

/*
Expand Down Expand Up @@ -90,5 +90,25 @@ constexpr static const char* DIPYDOC__MENUNAME_FILENAME = "menuname";

// constant used to limit the number of items displayed in submenu 'open' :
static const int maximum_number_of_items_in_submenu_open = 10;

/*
Demonstration's Dipydocs :
*/

// source site with '%1' for the version string.
#if defined DOWNLOAD_OGG_VERSION_OF_DIPYDOCS
constexpr static const char* DEMODIPYDOCS__SOURCE_SITE = "http://94.23.197.37/dipylonreader/freedipydocs/%1/ogg";
#elif defined DOWNLOAD_MP3_VERSION_OF_DIPYDOCS
constexpr static const char* DEMODIPYDOCS__SOURCE_SITE = "http://94.23.197.37/dipylonreader/freedipydocs/%1/mp3";
#else
constexpr static const char* DEMODIPYDOCS__SOURCE_SITE = "http://94.23.197.37/dipylonreader/freedipydocs/%1/ogg";
#endif

// regex used to detect 'demo' dipydocs's names :
constexpr static const char* DEMODIPYDOCS__REGEX_FOR_DIRECTORIES_NAME = "_demo_*";
// name of the summary file :
constexpr static const char* DEMODIPYDOCS__SUMMARY_FILENAME = "summary";
// separatator characters in the summary file :
constexpr static const char* DEMODIPYDOCS__SUMMARY_SEP = " :: ";
}
#endif
4 changes: 3 additions & 1 deletion cppdipylon/pos/posinaudio2posintext.h
Expand Up @@ -55,9 +55,11 @@
object by reversing the keys and the values.
________________________________________________________________________________*/
typedef std::unordered_map<PosInAudioRange, PosInTextRanges, PosInAudioRangeHasher> UMAP_PosAudio2PosText;

class PosInAudio2PosInText {
private:
std::unordered_map<PosInAudioRange, PosInTextRanges, PosInAudioRangeHasher> map;
UMAP_PosAudio2PosText map;
int _internal_state;
bool _well_initialized;

Expand Down
19 changes: 9 additions & 10 deletions cppdipylon/pos/posintext/posintext2str.h
Expand Up @@ -30,7 +30,7 @@

#include <QString>

#include <unordered_map>
#include <map>
#include <utility>

#include "pos/posintext/posintext.h"
Expand All @@ -57,11 +57,14 @@ struct IntegersAndAString {
PosInText2Str class : basically, a map PosInTextRanges -> QString .
________________________________________________________________________________*/
typedef std::map<PosInTextRanges, QString> MAP_PosText2QString;
typedef MAP_PosText2QString::const_iterator MAP_PosText2QStringCI;

class PosInText2Str {
friend class DipyDoc;

private:
std::unordered_map<PosInTextRanges, QString, PosInTextRangesHasher> map;
MAP_PosText2QString map;
int _internal_state;
bool _well_initialized;

Expand All @@ -77,11 +80,11 @@ class PosInText2Str {
const QString & operator[](const PosInTextRanges key) const;
PosInText2Str& operator=(const PosInText2Str&);

std::unordered_map<PosInTextRanges, QString, PosInTextRangesHasher>::const_iterator begin(void) const;
MAP_PosText2QStringCI begin(void) const;
void clear(void);
PosInTextRanges contains(PosInText x0) const;
VectorPosInTextRanges contains(PosInText x0, PosInText x1) const;
std::unordered_map<PosInTextRanges, QString, PosInTextRangesHasher>::const_iterator end(void) const;
MAP_PosText2QStringCI end(void) const;
int internal_state(void) const;
size_t size(void) const;
bool well_initialized(void) const;
Expand Down Expand Up @@ -145,15 +148,11 @@ inline const QString& PosInText2Str::operator[](const PosInTextRanges key) const
return this->map.at(key);
}

inline std::unordered_map<PosInTextRanges,
QString,
PosInTextRangesHasher>::const_iterator PosInText2Str::begin(void) const {
inline MAP_PosText2QStringCI PosInText2Str::begin(void) const {
return this->map.begin();
}

inline std::unordered_map<PosInTextRanges,
QString,
PosInTextRangesHasher>::const_iterator PosInText2Str::end(void) const {
inline MAP_PosText2QStringCI PosInText2Str::end(void) const {
return this->map.end();
}

Expand Down

0 comments on commit b254292

Please sign in to comment.