Pingouin animé (occupation CPU)

crabs_tuxcpu-1.1.1 ©2004-2011 - Christophe CAZAJUS (crabs-mettre_le_signe_at-crabs-world.com)

libtuxcpuanim.a~~ / ANIM / slot.cpp
Makefile anim.qh anim.cpp start.cpp event.cpp slot.cpp cpu.cpp menu.cpp voir.QH voir.cpp proc.cpp
    1 /*
    2 **=============================================================================
    3 ** crabs_tuxcpu-1.1.1 : Pingouin animé (occupation CPU)
    4 ** Copyright (C) 2004-2011 : Christophe CAZAJUS (crabs-mettre_le_signe_at-crabs-world.com)
    5 **
    6 ** Ce source fait partie d'un projet logiciel libre. Vous pouvez le distribuer
    7 ** et/ou le modifier en respectant les termes de la GNU General Public License
    8 ** version 2 ou (suite a votre propre choix) une version ulterieure.
    9 **
   10 ** Ce programme est distribue dans l'espoir qu'il puisse etre utile, mais
   11 ** sans aucune garantie, meme si il est associe a un produit qui vous en
   12 ** propose une. Conformez-vous a la GNU General Public License pour avoir
   13 ** plus de precisions.
   14 **
   15 ** L'auteur ne peut etre tenu responsable de l'utilisation faite des
   16 ** composantes associees a ce projet (en partie ou dans leur totalite).
   17 **
   18 ** Une copie du fichier de la GNU GPL est fournie dans le repertoire DOC
   19 ** de ce projet sous le nom gnu_gpl.txt
   20 **
   21 **=============================================================================
   22 */
   23 #include "anim.qh"
   24 #include <QFileDialog>
   25 
   26 void PerCentAnim::next()
   27     {
   28     int pc = cpu_usage() ;
   29     current = ( pc * (nb-1) / 100 ) ;
   30     showImg() ; nextTimer->start( 100 ) ;
   31     }
   32 
   33 void PerCentAnim::showImg()
   34     {
   35     QPixmap* p = px[current] ;
   36     if ( !p ) return ;
   37     QPalette pal( palette() ) ;
   38     pal.setBrush(backgroundRole(), QBrush(*p));
   39     setPalette(pal);
   40     setMask( p->mask() ) ;
   41     }
   42 
   43 void PerCentAnim::quitter()
   44     {
   45     qApp->quit() ;
   46     }
   47 
   48 void PerCentAnim::nouvelleImage()
   49     {
   50     QString rep= imgFile.section("/",0,-2) ;
   51     QString img = QFileDialog::getOpenFileName( this, "Choisissez une Image",
   52         rep, QString::null ) ;
   53     if ( img.isNull() ) return ;
   54     nextTimer->stop() ;
   55     imode = ImageSeule ; imgFile = img ; start() ;
   56     }
   57 void PerCentAnim::nouveauDirImage()
   58     {
   59     QDir dir( imgDir ) ; dir.cdUp() ;
   60     QString img = QFileDialog::getExistingDirectory( this,
   61         "Choisissez un Repertoire", dir.path() ) ;
   62     if ( img.isNull() ) return ;
   63     nextTimer->stop() ;
   64     imode = ImageAnimee ; imgDir = img ; start() ;
   65     }
   66 
   67 void PerCentAnim::renduRouge()
   68     {
   69     if ( imode != ImageSeule ) return ;
   70     if ( rmode != ModeRouge )
   71         { rmode = ModeRouge ; nextTimer->stop() ; start() ; }
   72     }
   73 void PerCentAnim::renduHaut()
   74     {
   75     if ( imode != ImageSeule ) return ;
   76     if ( rmode != ModeHaut )
   77         { rmode = ModeHaut ; nextTimer->stop() ; start() ; }
   78     }
   79 void PerCentAnim::renduStore()
   80     {
   81     if ( imode != ImageSeule ) return ;
   82     if ( rmode != ModeStore )
   83         { rmode = ModeStore ; nextTimer->stop() ; start() ; }
   84     }
   85 
   86 void PerCentAnim::imageSeule()
   87     {
   88     if ( imode == ImageSeule ) return ;
   89     imode = ImageSeule ; nextTimer->stop() ; start() ;
   90     }
   91 void PerCentAnim::imageAnimee()
   92     {
   93     if ( imode == ImageAnimee ) return ;
   94     imode = ImageAnimee ; nextTimer->stop() ; start() ;
   95     }
   96 
Makefile anim.qh anim.cpp start.cpp event.cpp slot.cpp cpu.cpp menu.cpp voir.QH voir.cpp proc.cpp
libtuxcpuanim.a~~ / ANIM / slot.cpp

Haut de page

Contacter crabs

Date de génération : 22/09/2011 21:48