-rw-r--r-- | core/launcher/launcherview.cpp | 71 |
1 files changed, 36 insertions, 35 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp index dbcb0d7..5daaeff 100644 --- a/core/launcher/launcherview.cpp +++ b/core/launcher/launcherview.cpp | |||
@@ -80,13 +80,13 @@ public: | |||
80 | ++it; | 80 | ++it; |
81 | //qDebug("%p: hidden (should remove)",l); | 81 | //qDebug("%p: hidden (should remove)",l); |
82 | } | 82 | } |
83 | #endif | 83 | #endif |
84 | } | 84 | } |
85 | 85 | ||
86 | QPixmap* busyPixmap() const { return (QPixmap*)&bpm; } | 86 | QPixmap* busyPixmap() const { return (QPixmap*)&bpm[::abs(busystate)]; } |
87 | QIconViewItem* busyItem() const { return bsy; } | 87 | QIconViewItem* busyItem() const { return bsy; } |
88 | void setBigIcons( bool bi ) { bigIcns = bi; } | 88 | void setBigIcons( bool bi ) { bigIcns = bi; } |
89 | 89 | ||
90 | void updateCategoriesAndMimeTypes(); | 90 | void updateCategoriesAndMimeTypes(); |
91 | 91 | ||
92 | void doAutoScroll() | 92 | void doAutoScroll() |
@@ -100,60 +100,61 @@ public: | |||
100 | if ( bsy != c ) { | 100 | if ( bsy != c ) { |
101 | if ( bsy ) | 101 | if ( bsy ) |
102 | bsy-> repaint ( ); | 102 | bsy-> repaint ( ); |
103 | bsy = c; | 103 | bsy = c; |
104 | 104 | ||
105 | if ( bsy ) { | 105 | if ( bsy ) { |
106 | busystate = 5; | ||
107 | for ( int i = 0; i <= 5; i++ ) | ||
108 | bpm [i] = QPixmap ( ); | ||
109 | timerEvent ( 0 ); | ||
106 | busytimer = startTimer ( 150 ); | 110 | busytimer = startTimer ( 150 ); |
107 | busystate = 50; | ||
108 | // not sure what this startTimer is for, maybe i am just to tired. But | ||
109 | // currently that causes 100% cpuload on app launch | ||
110 | //startTimer ( 0 ); | ||
111 | } | 111 | } |
112 | else | 112 | else |
113 | killTimer ( busytimer ); | 113 | killTimer ( busytimer ); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | virtual void timerEvent ( QTimerEvent *te ) | 117 | virtual void timerEvent ( QTimerEvent *te ) |
118 | { | 118 | { |
119 | if ( !te || ( te-> timerId ( ) == busytimer )) { | 119 | if ( !te || ( te-> timerId ( ) == busytimer )) { |
120 | if ( bsy ) { | 120 | if ( bsy ) { |
121 | QPixmap *src = bsy-> QIconViewItem::pixmap(); | 121 | if ( bpm [::abs(busystate)]. isNull ( )) { |
122 | QImage img = src->convertToImage(); | 122 | QPixmap *src = bsy-> QIconViewItem::pixmap(); |
123 | QRgb* rgb; | 123 | QImage img = src->convertToImage(); |
124 | int count; | 124 | QRgb* rgb; |
125 | if ( img.depth() == 32 ) { | 125 | int count; |
126 | rgb = (QRgb*)img.bits(); | 126 | if ( img.depth() == 32 ) { |
127 | count = img.bytesPerLine()/sizeof(QRgb)*img.height(); | 127 | rgb = (QRgb*)img.bits(); |
128 | } else { | 128 | count = img.bytesPerLine()/sizeof(QRgb)*img.height(); |
129 | rgb = img.colorTable(); | 129 | } else { |
130 | count = img.numColors(); | 130 | rgb = img.colorTable(); |
131 | } | 131 | count = img.numColors(); |
132 | int rc, gc, bc; | 132 | } |
133 | int bs = ::abs ( busystate ) + 25; | 133 | int rc, gc, bc; |
134 | colorGroup().highlight().rgb( &rc, &gc, &bc ); | 134 | int bs = ::abs ( busystate * 10 ) + 25; |
135 | rc = rc * bs / 100; | 135 | colorGroup().highlight().rgb( &rc, &gc, &bc ); |
136 | gc = gc * bs / 100; | 136 | rc = rc * bs / 100; |
137 | bc = bc * bs / 100; | 137 | gc = gc * bs / 100; |
138 | bc = bc * bs / 100; | ||
138 | 139 | ||
139 | for ( int r = 0; r < count; r++, rgb++ ) { | 140 | for ( int r = 0; r < count; r++, rgb++ ) { |
140 | int ri = rc + qRed ( *rgb ) * ( 100 - bs ) / 100; | 141 | int ri = rc + qRed ( *rgb ) * ( 100 - bs ) / 100; |
141 | int gi = gc + qGreen ( *rgb ) * ( 100 - bs ) / 100; | 142 | int gi = gc + qGreen ( *rgb ) * ( 100 - bs ) / 100; |
142 | int bi = bc + qBlue ( *rgb ) * ( 100 - bs ) / 100; | 143 | int bi = bc + qBlue ( *rgb ) * ( 100 - bs ) / 100; |
143 | int ai = qAlpha ( *rgb ); | 144 | int ai = qAlpha ( *rgb ); |
144 | *rgb = qRgba ( ri, gi, bi, ai ); | 145 | *rgb = qRgba ( ri, gi, bi, ai ); |
146 | } | ||
147 | |||
148 | bpm [::abs(busystate)].convertFromImage( img ); | ||
145 | } | 149 | } |
146 | |||
147 | bpm.convertFromImage( img ); | ||
148 | |||
149 | bsy-> repaint ( ); | 150 | bsy-> repaint ( ); |
150 | 151 | ||
151 | busystate += 10; | 152 | busystate++; |
152 | if ( busystate > 50 ) | 153 | if ( busystate > 5 ) |
153 | busystate = -40; | 154 | busystate = -4; |
154 | } | 155 | } |
155 | } | 156 | } |
156 | } | 157 | } |
157 | 158 | ||
158 | bool inKeyEvent() const { return ike; } | 159 | bool inKeyEvent() const { return ike; } |
159 | void keyPressEvent(QKeyEvent* e) | 160 | void keyPressEvent(QKeyEvent* e) |
@@ -308,13 +309,13 @@ private: | |||
308 | QRegExp tf; | 309 | QRegExp tf; |
309 | int cf; | 310 | int cf; |
310 | QIconViewItem* bsy; | 311 | QIconViewItem* bsy; |
311 | bool ike; | 312 | bool ike; |
312 | bool bigIcns; | 313 | bool bigIcns; |
313 | QPixmap bgPixmap; | 314 | QPixmap bgPixmap; |
314 | QPixmap bpm; | 315 | QPixmap bpm [6]; |
315 | QColor bgColor; | 316 | QColor bgColor; |
316 | int busytimer; | 317 | int busytimer; |
317 | int busystate; | 318 | int busystate; |
318 | }; | 319 | }; |
319 | 320 | ||
320 | 321 | ||