summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-09-29 23:08:59 (UTC)
committer harlekin <harlekin>2002-09-29 23:08:59 (UTC)
commitb53db7a5a334fdd53bd86e8b50587f1dae41cfba (patch) (unidiff)
treea2a24eea2bebefdbb02302ad57c0c0cbf425683e
parenta54430dbebd980109afdf604c7bfc9b0e15c4fdb (diff)
downloadopie-b53db7a5a334fdd53bd86e8b50587f1dae41cfba.zip
opie-b53db7a5a334fdd53bd86e8b50587f1dae41cfba.tar.gz
opie-b53db7a5a334fdd53bd86e8b50587f1dae41cfba.tar.bz2
temporary workarround to prevent high cpuloads after first app is launched
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 9f86136..dbcb0d7 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -60,97 +60,99 @@ public:
60 QIconView(parent,name), 60 QIconView(parent,name),
61 tf(""), 61 tf(""),
62 cf(0), 62 cf(0),
63 bsy(0), 63 bsy(0),
64 bigIcns(TRUE), 64 bigIcns(TRUE),
65 bgColor(white) 65 bgColor(white)
66 { 66 {
67 sortmeth = Name; 67 sortmeth = Name;
68 hidden.setAutoDelete(TRUE); 68 hidden.setAutoDelete(TRUE);
69 ike = FALSE; 69 ike = FALSE;
70 busytimer = 0; 70 busytimer = 0;
71 calculateGrid( Bottom ); 71 calculateGrid( Bottom );
72 } 72 }
73 73
74 ~LauncherIconView() 74 ~LauncherIconView()
75 { 75 {
76#if 0 // debuggery 76#if 0 // debuggery
77 QListIterator<AppLnk> it(hidden); 77 QListIterator<AppLnk> it(hidden);
78 AppLnk* l; 78 AppLnk* l;
79 while ((l=it.current())) { 79 while ((l=it.current())) {
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; }
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()
93 { 93 {
94 // We don't want rubberbanding (yet) 94 // We don't want rubberbanding (yet)
95 } 95 }
96 96
97 void setBusy(bool on) 97 void setBusy(bool on)
98 { 98 {
99 QIconViewItem *c = on ? currentItem() : 0; 99 QIconViewItem *c = on ? currentItem() : 0;
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 busytimer = startTimer ( 150 ); 106 busytimer = startTimer ( 150 );
107 busystate = 50; 107 busystate = 50;
108 startTimer ( 0 ); 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 );
109 } 111 }
110 else 112 else
111 killTimer ( busytimer ); 113 killTimer ( busytimer );
112 } 114 }
113 } 115 }
114 116
115 virtual void timerEvent ( QTimerEvent *te ) 117 virtual void timerEvent ( QTimerEvent *te )
116 { 118 {
117 if ( !te || ( te-> timerId ( ) == busytimer )) { 119 if ( !te || ( te-> timerId ( ) == busytimer )) {
118 if ( bsy ) { 120 if ( bsy ) {
119 QPixmap *src = bsy-> QIconViewItem::pixmap(); 121 QPixmap *src = bsy-> QIconViewItem::pixmap();
120 QImage img = src->convertToImage(); 122 QImage img = src->convertToImage();
121 QRgb* rgb; 123 QRgb* rgb;
122 int count; 124 int count;
123 if ( img.depth() == 32 ) { 125 if ( img.depth() == 32 ) {
124 rgb = (QRgb*)img.bits(); 126 rgb = (QRgb*)img.bits();
125 count = img.bytesPerLine()/sizeof(QRgb)*img.height(); 127 count = img.bytesPerLine()/sizeof(QRgb)*img.height();
126 } else { 128 } else {
127 rgb = img.colorTable(); 129 rgb = img.colorTable();
128 count = img.numColors(); 130 count = img.numColors();
129 } 131 }
130 int rc, gc, bc; 132 int rc, gc, bc;
131 int bs = ::abs ( busystate ) + 25; 133 int bs = ::abs ( busystate ) + 25;
132 colorGroup().highlight().rgb( &rc, &gc, &bc ); 134 colorGroup().highlight().rgb( &rc, &gc, &bc );
133 rc = rc * bs / 100; 135 rc = rc * bs / 100;
134 gc = gc * bs / 100; 136 gc = gc * bs / 100;
135 bc = bc * bs / 100; 137 bc = bc * bs / 100;
136 138
137 for ( int r = 0; r < count; r++, rgb++ ) { 139 for ( int r = 0; r < count; r++, rgb++ ) {
138 int ri = rc + qRed ( *rgb ) * ( 100 - bs ) / 100; 140 int ri = rc + qRed ( *rgb ) * ( 100 - bs ) / 100;
139 int gi = gc + qGreen ( *rgb ) * ( 100 - bs ) / 100; 141 int gi = gc + qGreen ( *rgb ) * ( 100 - bs ) / 100;
140 int bi = bc + qBlue ( *rgb ) * ( 100 - bs ) / 100; 142 int bi = bc + qBlue ( *rgb ) * ( 100 - bs ) / 100;
141 int ai = qAlpha ( *rgb ); 143 int ai = qAlpha ( *rgb );
142 *rgb = qRgba ( ri, gi, bi, ai ); 144 *rgb = qRgba ( ri, gi, bi, ai );
143 } 145 }
144 146
145 bpm.convertFromImage( img ); 147 bpm.convertFromImage( img );
146 148
147 bsy-> repaint ( ); 149 bsy-> repaint ( );
148 150
149 busystate += 10; 151 busystate += 10;
150 if ( busystate > 50 ) 152 if ( busystate > 50 )
151 busystate = -40; 153 busystate = -40;
152 } 154 }
153 } 155 }
154 } 156 }
155 157
156 bool inKeyEvent() const { return ike; } 158 bool inKeyEvent() const { return ike; }