Skip to content
This repository has been archived by the owner on Jan 1, 2021. It is now read-only.

Commit

Permalink
GCR 1.5.0.0:
Browse files Browse the repository at this point in the history
-Fixed incomplete Quran databases for translations and arabic.
-Removed Somali language since there were no credible sources.
-Fixed bugs: Bookmark could only be selected if there was no surah
search involved.
-Added search feature.
-Fixed design of SurahPage to be fed less information and only deal with
surah ID.
-Removed english transliteration for now.
  • Loading branch information
ragaeeb committed May 1, 2013
1 parent 73b26a6 commit 641bfdf
Show file tree
Hide file tree
Showing 11 changed files with 627 additions and 409 deletions.
125 changes: 120 additions & 5 deletions Readme.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,121 @@
CREATE TABLE x (database_id INTEGER, surah_id INTEGER, verse_id INTEGER, ayah_text TEXT);
sed -i "" 's/,//g' *.txt;
sed -i "" 's/|/,/g' *.txt;

< ar.muyassar.txt tail -n +0 | tail -r | tail -n +14 | tail -r >temp.txt
mv temp.txt ar.muyassar.txt

< bn.hoque.txt tail -n +0 | tail -r | tail -n +14 | tail -r >temp.txt
mv temp.txt bn.hoque.txt

< de.bubenheim.txt tail -n +0 | tail -r | tail -n +14 | tail -r >temp.txt
mv temp.txt de.bubenheim.txt

< en.hilali.txt tail -n +0 | tail -r | tail -n +14 | tail -r >temp.txt
mv temp.txt en.hilali.txt

< en.transliteration.txt tail -n +0 | tail -r | tail -n +14 | tail -r >temp.txt
mv temp.txt en.transliteration.txt

< es.cortes.txt tail -n +0 | tail -r | tail -n +14 | tail -r >temp.txt
mv temp.txt es.cortes.txt

< fr.hamidullah.txt tail -n +0 | tail -r | tail -n +14 | tail -r >temp.txt
mv temp.txt fr.hamidullah.txt

< id.indonesian.txt tail -n +0 | tail -r | tail -n +14 | tail -r >temp.txt
mv temp.txt id.indonesian.txt

< ms.basmeih.txt tail -n +0 | tail -r | tail -n +14 | tail -r >temp.txt
mv temp.txt ms.basmeih.txt

< ru.kuliev.txt tail -n +0 | tail -r | tail -n +14 | tail -r >temp.txt
mv temp.txt ru.kuliev.txt

< th.thai.txt tail -n +0 | tail -r | tail -n +14 | tail -r >temp.txt
mv temp.txt th.thai.txt

< tr.diyanet.txt tail -n +0 | tail -r | tail -n +14 | tail -r >temp.txt
mv temp.txt tr.diyanet.txt

< ur.jalandhry.txt tail -n +0 | tail -r | tail -n +14 | tail -r >temp.txt
mv temp.txt ur.jalandhry.txt

< zh.majian.txt tail -n +0 | tail -r | tail -n +14 | tail -r >temp.txt
mv temp.txt zh.majian.txt

sqlite3 quran.db
.mode csv
.import English-Shakir-58.csv x
delete from x where rowid=1;
UPDATE quran SET urdu_ahmed_ali=(SELECT ayah_text FROM x WHERE x.surah_id=quran.surah_id AND x.verse_id=quran.verse_id);
DROP TABLE x;

CREATE TABLE arabic (surah_id INTEGER, verse_id INTEGER, text TEXT);
.import ar.muyassar.txt arabic
CREATE INDEX 'fk_arabic_surah_id' ON 'arabic' ('surah_id' ASC);
CREATE INDEX 'fk_arabic_verse_id' ON 'arabic' ('verse_id' ASC);
CREATE INDEX 'fk_arabic_text' ON 'arabic' ('text' ASC);

CREATE TABLE bengali (surah_id INTEGER, verse_id INTEGER, text TEXT);
.import bn.hoque.txt bengali
CREATE INDEX 'fk_bengali_surah_id' ON 'bengali' ('surah_id' ASC);
CREATE INDEX 'fk_bengali_verse_id' ON 'bengali' ('verse_id' ASC);

CREATE TABLE german (surah_id INTEGER, verse_id INTEGER, text TEXT);
.import de.bubenheim.txt german
CREATE INDEX 'fk_german_surah_id' ON 'german' ('surah_id' ASC);
CREATE INDEX 'fk_german_verse_id' ON 'german' ('verse_id' ASC);

CREATE TABLE english (surah_id INTEGER, verse_id INTEGER, text TEXT);
.import en.hilali.txt english
CREATE INDEX 'fk_english_surah_id' ON 'english' ('surah_id' ASC);
CREATE INDEX 'fk_english_text' ON 'english' ('text' ASC);
CREATE INDEX 'fk_english_verse_id' ON 'english' ('verse_id' ASC);

CREATE TABLE transliteration (surah_id INTEGER, verse_id INTEGER, text TEXT);
.import en.transliteration.txt transliteration
CREATE INDEX 'fk_transliteration_surah_id' ON 'transliteration' ('surah_id' ASC);
CREATE INDEX 'fk_transliteration_verse_id' ON 'transliteration' ('verse_id' ASC);

CREATE TABLE spanish (surah_id INTEGER, verse_id INTEGER, text TEXT);
.import es.cortes.txt spanish
CREATE INDEX 'fk_spanish_surah_id' ON 'spanish' ('surah_id' ASC);
CREATE INDEX 'fk_spanish_verse_id' ON 'spanish' ('verse_id' ASC);

CREATE TABLE french (surah_id INTEGER, verse_id INTEGER, text TEXT);
.import fr.hamidullah.txt french
CREATE INDEX 'fk_french_surah_id' ON 'french' ('surah_id' ASC);
CREATE INDEX 'fk_french_verse_id' ON 'french' ('verse_id' ASC);

CREATE TABLE indonesian (surah_id INTEGER, verse_id INTEGER, text TEXT);
.import id.indonesian.txt indonesian
CREATE INDEX 'fk_indonesian_surah_id' ON 'indo' ('surah_id' ASC);
CREATE INDEX 'fk_indonesian_verse_id' ON 'indo' ('verse_id' ASC);

CREATE TABLE malay (surah_id INTEGER, verse_id INTEGER, text TEXT);
.import ms.basmeih.txt malay
CREATE INDEX 'fk_malay_surah_id' ON 'malay' ('surah_id' ASC);
CREATE INDEX 'fk_malay_verse_id' ON 'malay' ('verse_id' ASC);

CREATE TABLE russian (surah_id INTEGER, verse_id INTEGER, text TEXT);
.import ru.kuliev.txt russian
CREATE INDEX 'fk_russian_surah_id' ON 'russian' ('surah_id' ASC);
CREATE INDEX 'fk_russian_verse_id' ON 'russian' ('verse_id' ASC);

CREATE TABLE thai (surah_id INTEGER, verse_id INTEGER, text TEXT);
.import th.thai.txt thai
CREATE INDEX 'fk_thai_surah_id' ON 'thai' ('surah_id' ASC);
CREATE INDEX 'fk_thai_verse_id' ON 'thai' ('verse_id' ASC);

CREATE TABLE turkish (surah_id INTEGER, verse_id INTEGER, text TEXT);
.import tr.vakfi.txt turkish
CREATE INDEX 'fk_turkish_surah_id' ON 'turkish' ('surah_id' ASC);
CREATE INDEX 'fk_turkish_verse_id' ON 'turkish' ('verse_id' ASC);

CREATE TABLE urdu (surah_id INTEGER, verse_id INTEGER, text TEXT);
.import ur.jalandhry.txt urdu
CREATE INDEX 'fk_urdu_surah_id' ON 'urdu' ('surah_id' ASC);
CREATE INDEX 'fk_urdu_verse_id' ON 'urdu' ('verse_id' ASC);

CREATE TABLE chinese (surah_id INTEGER, verse_id INTEGER, text TEXT);
.import zh.majian.txt chinese
CREATE INDEX 'fk_chinese_surah_id' ON 'chinese' ('surah_id' ASC);
CREATE INDEX 'fk_chinese_verse_id' ON 'chinese' ('verse_id' ASC);

vacuum;
2 changes: 1 addition & 1 deletion assets/HelpPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ BasePage
textStyle.textAlign: TextAlign.Center
textStyle.fontSize: FontSize.Small
content.flags: TextContentFlag.ActiveText
text: qsTr("\n\n(c) 2013 %1. All Rights Reserved.\n%2 %3\n\nPlease report all bugs to:\n[email protected]\n\nThis app facilitates the reading of Qu'ran for Muslims using BB10 to get a smooth and fluid native experience. It includes translations in several languages (Bengali, English, French, Indonesian, Malaysian, Somali, Thai, Turkish, Urdu, and more coming) as well as the original Arabic version. There also is a transliteration version to help you with the pronunciation.\n\nThere is built-in support for bookmarking a verse and a surah to quickly pick up where you left off reading. There is also easy access to copying certain verses to make it easy for you to share it with your contacts.\n\nSpecial thanks to: http://www.versebyversequran.com\n\n").arg(packageInfo.author).arg(appInfo.title).arg(appInfo.version)
text: qsTr("\n\n(c) 2013 %1. All Rights Reserved.\n%2 %3\n\nPlease report all bugs to:\n[email protected]\n\nThis app facilitates the reading of Qu'ran for Muslims using BB10 to get a smooth and fluid native experience. It includes translations in several languages (Bengali, English, French, Indonesian, Malaysian, Somali, Thai, Turkish, Urdu, and more coming) as well as the original Arabic version. There also is a transliteration version to help you with the pronunciation.\n\nThere is built-in support for bookmarking a verse and a surah to quickly pick up where you left off reading. There is also easy access to copying certain verses to make it easy for you to share it with your contacts.\n\nSpecial thanks to:\nhttp://www.versebyversequran.com\nhttp://tanzil.ca\n\n").arg(packageInfo.author).arg(appInfo.title).arg(appInfo.version)
}
}
}
Expand Down
122 changes: 95 additions & 27 deletions assets/SearchPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,97 @@ import com.canadainc.data 1.0

BasePage
{
paneProperties: NavigationPaneProperties {
property variant navPane: navigationPane
id: properties
}

contentContainer: Container
{
TextField
{
onCreationCompleted: {
if ( persist.getValueFor("animations") == 1 ) {
translate.play()
} else {
timer.start(250);
}
}

id: searchField
hintText: qsTr("Enter text to search...") + Retranslate.onLanguageChanged
bottomMargin: 0

animations: [
TranslateTransition {
id: translate
fromY: 1000
duration: 500

onEnded: {
searchField.requestFocus()
}
}
]

input {
submitKey: SubmitKey.Submit

onSubmitted: {
var translation = persist.getValueFor("translation")
var translationClause = ""
var translationLike = ""

if (translation != "") {
translationClause = ",quran." + translation + " as translation"
translationLike = " OR quran."+translation+" LIKE '%"+text+"%'"
onSubmitted:
{
var trimmedText = text.replace(/^\s+|\s+$/g,"");

if (trimmedText.length > 1)
{
theDataModel.clear()
sqlDataSource.translationLoaded = sqlDataSource.arabicLoaded = false

busy.running = true

var translation = persist.getValueFor("translation")

if (translation != "") {
sqlDataSource.query = "select %1.surah_id,%1.verse_id,%1.text,chapters.english_name as name, chapters.english_name, chapters.arabic_name, chapters.english_translation from %1 INNER JOIN chapters on chapters.surah_id=%1.surah_id AND %1.text LIKE '%%2%'".arg(translation).arg(trimmedText)
sqlDataSource.load(0)
}

sqlDataSource.query = "select arabic.surah_id,arabic.verse_id,arabic.text,chapters.arabic_name as name, chapters.english_name, chapters.arabic_name, chapters.english_translation from arabic INNER JOIN chapters on chapters.surah_id=arabic.surah_id AND arabic.text LIKE '%%1%'".arg(trimmedText)
sqlDataSource.load(1)
}

busy.running = true
sqlDataSource.query = "SELECT chapters.english_name,quran.arabic,quran.surah_id,quran.verse_id" + translationClause + " FROM quran,chapters WHERE arabic like '%"+text+"%'"+translationLike+" AND quran.surah_id=chapters.surah_id"
sqlDataSource.load()
}
}

attachedObjects: [
CustomSqlDataSource {
property bool translationLoaded: false
property bool arabicLoaded: false
id: sqlDataSource
source: "app/native/assets/dbase/quran.db"
name: "search"

onDataLoaded: {
theDataModel.clear()
theDataModel.insertList(data)
busy.running = false

if (id == 0) {
translationLoaded = true
} else if (id == 1) {
arabicLoaded = true
}

if (translationLoaded && arabicLoaded) {
busy.running = false
}
}
}
},

QTimer {
id: timer
singleShot: true

onTimeout: {
searchField.requestFocus()
}
}
]
}

Expand All @@ -61,15 +114,33 @@ BasePage
ImagePaintDefinition {
id: bg
imageSource: "asset:///images/header_bg.png"
}
},

ComponentDefinition {
id: definition
source: "SurahPage.qml"
}
]

dataModel: GroupDataModel {
id: theDataModel
sortingKeys: ["english_name","verse_id"]
sortingKeys: ["name", "verse_id"]
grouping: ItemGrouping.ByFullValue
}

onTriggered: {
if (indexPath.length > 1)
{
var data = dataModel.data(indexPath)

var surahPage = definition.createObject()
surahPage.surahId = data.surah_id
surahPage.requestedVerse = data.verse_id

properties.navPane.push(surahPage)
}
}

listItemComponents: [

ListItemComponent {
Expand Down Expand Up @@ -105,26 +176,23 @@ BasePage

Container
{
topPadding: 5; bottomPadding: 5; leftPadding: 5; rightPadding: 5
id: itemRoot
leftPadding: 5; rightPadding: 5; bottomPadding: 5
horizontalAlignment: HorizontalAlignment.Fill
preferredWidth: 1280

Label {
id: firstLabel
text: ListItemData.arabic
multiline: true
horizontalAlignment: HorizontalAlignment.Fill
textStyle.color: Color.White
textStyle.textAlign: TextAlign.Center
Divider {
visible: itemRoot.ListItem.indexPath[1] != 0
bottomMargin: 0
}

Label {
id: translationLabel
text: ListItemData.translation
text: ListItemData.text
multiline: true
horizontalAlignment: HorizontalAlignment.Fill
textStyle.color: Color.White
textStyle.textAlign: TextAlign.Center
topMargin: 0
}
}
}
Expand Down
Loading

0 comments on commit 641bfdf

Please sign in to comment.