1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Changeset 1916

Show
Ignore:
Timestamp:
05/06/12 20:18:09 (2 years ago)
Author:
kvangend
Message:

Make PieMenu? use small icons around it, again.
This resolves ticket:335.

Location:
trunk/src/view
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/view/ImageCache.cpp

    r1836 r1916  
    5858        { 
    5959                DEBUG4("Image '%s' found in image cache!", ASCII(anImageBaseName)); 
     60                // is the image the right size? 
     61                if (anOutputPixmapPtr->size()!=aSize && aSize!=theDefaultSize) 
     62                { 
     63                        *anOutputPixmapPtr = anOutputPixmapPtr->scaled(aSize, Qt::IgnoreAspectRatio); 
     64                } 
    6065                return true; 
    6166        } 
  • trunk/src/view/PieMenu.cpp

    r1898 r1916  
    4242/// Distance from the pie menu center to the center of the outside icons. 
    4343/// Note: this is in ActionIcon units 
    44 static const qreal CENTER_RADIUS = 20.0; 
    45 static const qreal OUTER_DISTANCE = 2*CENTER_RADIUS*1.36; 
    46 static const qreal TOTAL_RADIUS = OUTER_DISTANCE + 0.5 * CENTER_RADIUS; 
     44static const qreal CENTER_RADIUS = 24.0; 
     45/// When the small outside and center radius circles touch, the proportion 
     46/// between the two is: (1-sin(22.5))/sin(22.5) = 1.613 
     47static const qreal SMALL_RADIUS = CENTER_RADIUS/1.613; 
     48static const qreal OUTER_DISTANCE = CENTER_RADIUS+SMALL_RADIUS; 
     49static const qreal TOTAL_RADIUS = OUTER_DISTANCE + SMALL_RADIUS; 
    4750 
    4851static qreal theActionIconScaling = 1.0; 
     
    6972        Q_ASSERT(aParentPtr!=NULL); 
    7073 
    71         QPixmap myTempPixmap; 
    72         ImageCache::getPixmap(aFileName, QSize(2*CENTER_RADIUS,2*CENTER_RADIUS), &myTempPixmap); 
    73         setPixmap(myTempPixmap); 
    74  
    75         QPointF myOuterPos(OUTER_DISTANCE*cos(anActionType*45.0/180.0*PI) -CENTER_RADIUS, 
    76                                            -OUTER_DISTANCE*sin(anActionType*45.0/180.0*PI) - CENTER_RADIUS); 
    77         QPointF mySInnerPos(-CENTER_RADIUS, -CENTER_RADIUS); 
     74        ImageCache::getPixmap(aFileName, QSize(2*CENTER_RADIUS,2*CENTER_RADIUS), &theCenterPixmap); 
     75        ImageCache::getPixmap(aFileName, QSize(2*SMALL_RADIUS,2*SMALL_RADIUS), &theSmallPixmap); 
     76 
     77        printf("center: %d\n", theCenterPixmap.height()); 
     78        printf("small:  %d\n", theSmallPixmap.height()); 
     79 
     80 
     81        QPointF myOuterPos(OUTER_DISTANCE*cos(anActionType*45.0/180.0*PI) -SMALL_RADIUS, 
     82                                           -OUTER_DISTANCE*sin(anActionType*45.0/180.0*PI) - SMALL_RADIUS); 
     83        QPointF mySInnerPos(-SMALL_RADIUS, -SMALL_RADIUS); 
    7884        QPointF myLInnerPos(-CENTER_RADIUS,-CENTER_RADIUS); 
    7985 
     
    126132        // set the positions for the various states 
    127133        myStartState->assignProperty(this, "pos", mySInnerPos); 
     134        myStartState->assignProperty(this, "pixmap", theSmallPixmap); 
    128135 
    129136        myOuterState->assignProperty(this, "pos", myOuterPos); 
     137        myOuterState->assignProperty(this, "pixmap", theSmallPixmap); 
    130138 
    131139        myInnerState->assignProperty(this, "pos", myLInnerPos); 
     140        myInnerState->assignProperty(this, "pixmap", theCenterPixmap); 
    132141 
    133142        theIconStateMachine.start(); 
  • trunk/src/view/PieMenu.h

    r1898 r1916  
    5959        Q_OBJECT 
    6060        Q_PROPERTY(QPointF pos READ pos WRITE setPos) 
     61        Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap) 
    6162 
    6263public: 
     
    104105        friend class PieMenu; 
    105106 
     107        QPixmap theSmallPixmap; 
     108        QPixmap theCenterPixmap; 
     109 
    106110        // no copy constructor or assignment operators here! 
    107111        Q_DISABLE_COPY ( ActionIcon )