[Readthebible-svn] SF.net SVN: readthebible:[69] trunk
Status: Beta
Brought to you by:
vanyo_g
From: <va...@us...> - 2010-11-19 06:24:37
|
Revision: 69 http://readthebible.svn.sourceforge.net/readthebible/?rev=69&view=rev Author: vanyo_g Date: 2010-11-19 06:24:31 +0000 (Fri, 19 Nov 2010) Log Message: ----------- Work on File-Import form .txt function Modified Paths: -------------- trunk/bibleWindow.cpp trunk/mainWindow.cpp Modified: trunk/bibleWindow.cpp =================================================================== --- trunk/bibleWindow.cpp 2010-09-08 14:11:52 UTC (rev 68) +++ trunk/bibleWindow.cpp 2010-11-19 06:24:31 UTC (rev 69) @@ -229,7 +229,6 @@ }; void BibleWindow::import(const QString &fn){ - showMessage(tr("This feature is not finished yet. See the source code.")); return; QStringList fc = fileContent(fn).split("\n"); int i = 0; for(int b=1; b<=bookCount(); b++){ // Цикъл за четене на книгите @@ -245,23 +244,31 @@ for(int c=1; c<=chapterCount(b); c++){ // Цикъл за четене на главите for(int v=1; v<=verseCount(b,c); v++){ // Цикъл за четене на стиховете QString r = reference(verseIndex(b,c,v)); - QString vn = QString::number(v)+" "; // Номер на стиха - // Първият стих на всяка глава започва с номера на главата. - if (v==1) vn = QString::number(c)+" "; - QString vt = fc.at(i); i++; // Текст на стиха - // Ако редът текст е празен се търси следващ непразен ред. - while (!vt.trimmed().size()){ vt = fc.at(i); i++; } - + + QString vn = QString::number(v)+" "; // Номер, с който започва реда с поредния стих + if (v==1) vn = QString::number(c)+" ";// Ако стихът е 1 това е номара на главата + + QString vt = ""; // Следващ ред текст + // Взема се следващия непразен ред текст. + do { vt = fc.at(i); i++; } while (!vt.trimmed().size()); + + // Проверява се дали редът не е подзаглавие + if (vt.startsWith("<h")){ + showMessage(vt); + // Взема се следващия непразен ред текст. + do { vt = fc.at(i); i++; } while (!vt.trimmed().size()); + } + // Проверява се дали има паралелен пасаж. if (vt.at(0)==QChar('{')){ QString pp = vt; vt = fc.at(i); i++; // showMessage(pp+"<br>"+vt); } - + if (!vt.startsWith(vn)){ // Ако номерът на стиха е некоректен обработката се прекратява showMessage(tr("%1<br>Incorrect verse number in line<br>%2.<br>Must be %3") - .arg(r).arg(vt).arg(v) + .arg(r).arg(vt).arg(vn) ); return; } Modified: trunk/mainWindow.cpp =================================================================== --- trunk/mainWindow.cpp 2010-09-08 14:11:52 UTC (rev 68) +++ trunk/mainWindow.cpp 2010-11-19 06:24:31 UTC (rev 69) @@ -169,6 +169,7 @@ }; void BMainWindow::onFileImportTxt(){ + showMessage(tr("This feature is not finished yet. See the source code.")); return; BibleWindow *ab = activeBible(); if (!ab) return; QSettings s("VanyoG", "CD Bible 5"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |