#!/bin/sh # # flitegui-file - front end for flite to read a text file # version 0.2 # # Copyright (C) 2006 menaie@sun.com # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # ###################################################################### export QSHDLG_APP=`basename $0` INPUT=/var/spool/qshdlg/input_$QSHDLG_APP OUTPUT=/var/spool/qshdlg/output_$QSHDLG_APP CONTROL=/var/spool/qshdlg/control_$QSHDLG_APP OPIE_SH=/opt/QtPalmtop/bin/opie-sh TITLE="Flite GUI" FILEDIR=/home/zaurus/Documents/Text_Files MSG="Please select a file:" # check that FILEDIR exists and contains txt files if [ ! -d $FILEDIR ] || [ "`ls $FILEDIR/*.txt 2>/dev/null`" = "" ]; then qshdlg message -h 120 -w 480 -t "$TITLE: Error" -d "Error: $FILEDIR does not contain any text files" -n -v OK exit 1 fi cd $FILEDIR #qcop QPE/System "setSuspendOnOff()" 1 #qcop QPE/System "setScreenSaverMode(int)" 2 if [ "`which qshdlg`" = "" ]; then FILE=`ls -1 *.txt | cut -d. -f1 | $OPIE_SH -i -t "$APPNAME" -L "$MSG" -l -g 2>/dev/null` flite -f ${FILEDIR}/${FILE}.txt else # display a selection box qshdlg custom -A -C message -f lcfont -t "$TITLE: Txt File Reader" -c eucJP & # wait until control initialisation is completed while [ ! -p $CONTROL ] do echo >/dev/null done # display status message echo "$TITLE initialised. loading file list ..." |tee $OUTPUT # populate selection list for FILE in `ls -1 $FILEDIR/*.txt` do if [ -f $FILE ]; then echo 'item(QString)' "`basename $FILE`" > $CONTROL fi done echo 'showSelect()' > $CONTROL # display status message echo "item list loaded." |tee $OUTPUT # wait for user input/selection while [ ! -p $INPUT ] do echo >/dev/null done while read RET < $INPUT do killall flite 2>/dev/null >/dev/null echo "reading $RET." |tee $OUTPUT flite -f ${FILEDIR}/${RET} & done killall flite 2>/dev/null >/dev/null fi #qcop QPE/System "setSuspendOnOff()" 0 #qcop QPE/System "setScreenSaverMode(int)" 100