Changeset 11070


Ignore:
Timestamp:
Jul 30, 2010, 10:23:47 PM (12 years ago)
Author:
charles
Message:

(trunk qt) 1. fix icon sizing issue. 2. add a mechanism to get the favicon from the hostname as an alternative to passing in the full announce UR.L

Location:
trunk/qt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/favicon.cc

    r11059 r11070  
    8383Favicons :: find( const QUrl& url )
    8484{
     85    return findFromHost( getHost( url ) );
     86}
     87
     88namespace
     89{
     90    const QSize rightSize( 16, 16 );
     91};
     92
     93QPixmap
     94Favicons :: findFromHost( const QString& host )
     95{
    8596    ensureCacheDirHasBeenScanned( );
    8697
    87     return myPixmaps[ getHost(url) ];
     98    const QPixmap pixmap = myPixmaps[ host ];
     99    return pixmap.size()==rightSize ? pixmap : pixmap.scaled(rightSize);
    88100}
    89101
     
    98110    {
    99111        // add a placholder s.t. we only ping the server once per session
    100         QPixmap tmp( 16, 16 );
     112        QPixmap tmp( rightSize );
    101113        tmp.fill( Qt::transparent );
    102114        myPixmaps.insert( host, tmp );
  • trunk/qt/favicon.h

    r11059 r11070  
    3939        QPixmap find( const QUrl& url );
    4040
     41        /* returns a cached pixmap, or a NULL pixmap if there's no match in the cache */
     42        QPixmap findFromHost( const QString& host );
     43
    4144        /* this will emit a signal when (if) the icon becomes ready */
    4245        void add( const QUrl& url );
Note: See TracChangeset for help on using the changeset viewer.