protux-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Protux-devel] open task : MustuxProperties class


From: Luciano Giordana
Subject: [Protux-devel] open task : MustuxProperties class
Date: Mon, 8 Dec 2003 11:38:07 -0200
User-agent: KMail/1.5

Hi Remon,

Sorry by send this request for email, but it seems savannah is off line due 
attacks recently.

It would be cool if we had a class MustuxProperts so this piece of code


>       QFile file1( rootDir + "/song.properties" );
>       QString line;
>       if ( file1.open( IO_ReadOnly ) )
>               {
>               QTextStream stream( &file1 );
>               while (!stream.eof())
>                       {
>                       QString line = stream.readLine();
>                       line = line.stripWhiteSpace();
>                       if (line.find("title=")>=0)
>                               title=line.mid(line.find("title=")+6);
>                       if (line.find("artists=")>=0)
>                               artists=line.mid(line.find("artists=")+8);
>                       if (line.find("rate=")>=0)
>                               rate=line.mid(line.find("rate=")+5).toInt();
>                       if (line.find("bitDepth=")>=0)
>                               
> bitDepth=line.mid(line.find("bitDepth=")+9).toInt();
>                       if (line.find("activeTrackNumber=")>=0)
>                               
> activeTrackNumber=line.mid(line.find("activeTrackNumber=")+18).toInt();
>                       if (line.find("firstBlock=")>=0)
>                               firstBlock=(long 
> long)line.mid(line.find("firstBlock=")+11).toDouble();
>                       if (line.find("workingBlock=")>=0)
>                               workingBlock=(long 
> long)line.mid(line.find("workingBlock=")+13).toDouble();
>                       if (line.find("hzoom=")>=0)
>                               hzoom=line.mid(line.find("hzoom=")+6).toInt();
>                       if (line.find("editingMode=")>=0)
>                               
> editingMode=line.mid(line.find("editingMode=")+12).toInt();
>                       }
>               PMESG("Reading Song Properties : title=%s rate=%d  
> bitDepth=%d",title.ascii(),rate,bitDepth);
>               file1.close();
>               }


would become

>       MustuxProperties mp = new MustuxProperties( rootDir + 
> "/song.properties" );
>       title=mp->getString("title");
>       artists=mp->getString("artists");
>       rate=mp->getInt("rate");
>       bitDepth=mp->getInt("bitDepth");
>       activeTrackNumber=mp->getInt("activeTrackNumber");
>       firstBlock=mp->getLongLong("firstBlock");
>       workingBlock=mp->getLongLong("workingBlock");
>       hzoom=mp->getInt("hzoom");
>       editingMode=mp->getInt("editingMode");
>       delete mp; // it will close the file
>       PMESG("Reading Song Properties : title=%s rate=%d  
> bitDepth=%d",title.ascii(),rate,bitDepth);



it could be used in many places in the code

If you are able to implement such a class, please let me know so I can keep 
working on code cleaning. Otherwise it is nor urgent, so we cant wait for that.

Thanks alot



-- 
Best Regards
--
Luciano Giordana
Free Software Developer / Musician
Project Protux : Professional Audio Tools for GNU/Linux
http://www.nongnu.org/protux




reply via email to

[Prev in Thread] Current Thread [Next in Thread]