protux-devel
[Top][All Lists]
Advanced

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

Re: [Protux-devel] open task : MustuxProperties class


From: Martin Herren
Subject: Re: [Protux-devel] open task : MustuxProperties class
Date: Mon, 08 Dec 2003 14:42:22 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030320

Luciano Giordana wrote:
Hi Remon,

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

yes, no commits or update possible...

It would be cool if we had a class MustuxProperts

i implemented once the MustuxGlobalProperty class (it's in mustuxlib, but doesn't get compiled for the moment as it's still not used, protux still use its own code for that). It was meant to handle the .protuxrc file, but could probably easily be expanded to handle the song.properties file as well. So in the end there will be (at least) 2 objects of this class, one handling .protuxrc, and one for each song.properties.


/Martin

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









reply via email to

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