summaryrefslogtreecommitdiff
authordrw <drw>2005-03-08 22:00:32 (UTC)
committer drw <drw>2005-03-08 22:00:32 (UTC)
commit9b5178ed0e2dbde4357d3de1906201e5772ee935 (patch) (unidiff)
tree514613ea41384c5d160b76af7833e0f60dca393a
parent2b32d3e15f5774ee8f73977d606675e819498614 (diff)
downloadopie-9b5178ed0e2dbde4357d3de1906201e5772ee935.zip
opie-9b5178ed0e2dbde4357d3de1906201e5772ee935.tar.gz
opie-9b5178ed0e2dbde4357d3de1906201e5772ee935.tar.bz2
Better version of icon
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/screenshotapplet/opie-screenshotapplet.control2
-rw-r--r--core/applets/screenshotapplet/screenshot.cpp225
2 files changed, 6 insertions, 221 deletions
diff --git a/core/applets/screenshotapplet/opie-screenshotapplet.control b/core/applets/screenshotapplet/opie-screenshotapplet.control
index 5c0b64d..b0b9466 100644
--- a/core/applets/screenshotapplet/opie-screenshotapplet.control
+++ b/core/applets/screenshotapplet/opie-screenshotapplet.control
@@ -1,10 +1,10 @@
1Package: opie-screenshotapplet 1Package: opie-screenshotapplet
2Files: plugins/applets/libscreenshotapplet.so* 2Files: plugins/applets/libscreenshotapplet.so* screenshotapplet/*.png
3Priority: optional 3Priority: optional
4Section: opie/applets 4Section: opie/applets
5Maintainer: L. J. Potter <lpotter@trolltech.com> 5Maintainer: L. J. Potter <lpotter@trolltech.com>
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal 7Depends: task-opie-minimal
8Description: Screenshot Applet 8Description: Screenshot Applet
9 A screenshot taskbar applet for the Opie environment 9 A screenshot taskbar applet for the Opie environment
10Version: $QPE_VERSION$EXTRAVERSION 10Version: $QPE_VERSION$EXTRAVERSION
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp
index 042f390..1d88aa5 100644
--- a/core/applets/screenshotapplet/screenshot.cpp
+++ b/core/applets/screenshotapplet/screenshot.cpp
@@ -1,281 +1,68 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com 2** Copyright (C) 2002 L.J. Potter ljp@llornkcor.com
3** All rights reserved. 3** All rights reserved.
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13**********************************************************************/ 13**********************************************************************/
14 14
15#include "screenshot.h" 15#include "screenshot.h"
16#include "inputDialog.h" 16#include "inputDialog.h"
17 17
18/* OPIE */ 18/* OPIE */
19#include <opie2/odebug.h> 19#include <opie2/odebug.h>
20#include <opie2/otaskbarapplet.h> 20#include <opie2/otaskbarapplet.h>
21#include <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22#include <qpe/applnk.h> 22#include <qpe/applnk.h>
23#include <qpe/qcopenvelope_qws.h> 23#include <qpe/qcopenvelope_qws.h>
24#include <qpe/resource.h>
24 25
25 26
26/* QT */ 27/* QT */
27#include <qlineedit.h> 28#include <qlineedit.h>
28#include <qdir.h> 29#include <qdir.h>
29#include <qlabel.h> 30#include <qlabel.h>
30#include <qpushbutton.h> 31#include <qpushbutton.h>
31#include <qpainter.h> 32#include <qpainter.h>
32#include <qspinbox.h> 33#include <qspinbox.h>
33#include <qlayout.h> 34#include <qlayout.h>
34#include <qcheckbox.h> 35#include <qcheckbox.h>
35#include <qmessagebox.h> 36#include <qmessagebox.h>
36 37
37/* STD */ 38/* STD */
38#include <stdlib.h> 39#include <stdlib.h>
39#include <sys/socket.h> 40#include <sys/socket.h>
40#include <netinet/in.h> 41#include <netinet/in.h>
41#include <netdb.h> 42#include <netdb.h>
42#include <unistd.h> 43#include <unistd.h>
43 44
44/* XPM */
45static char * snapshot_xpm[] = {
46"32 32 177 2",
47" c None",
48". c #042045",
49"+ c #0D2B47",
50"@ c #0E325E",
51"# c #0D2E50",
52"$ c #0A1C32",
53"% c #0F3A69",
54"& c #164680",
55"* c #165EAE",
56"= c #134D89",
57"- c #0A3A6E",
58"; c #031024",
59"> c #031B36",
60", c #1A5EA3",
61"' c #1862B1",
62") c #1866B9",
63"! c #0F5AAC",
64"~ c #0F56A8",
65"{ c #0C4C96",
66"] c #030918",
67"^ c #060206",
68"/ c #20242C",
69"( c #3E3B3B",
70"_ c #186ABD",
71": c #115EB3",
72"< c #082644",
73"[ c #222C38",
74"} c #5A5859",
75"| c #091921",
76"1 c #1E7EDE",
77"2 c #1A7ADA",
78"3 c #1970CD",
79"4 c #1758A1",
80"5 c #0E529A",
81"6 c #094388",
82"7 c #22364E",
83"8 c #384454",
84"9 c #04162C",
85"0 c #123451",
86"a c #3296B4",
87"b c #298AB1",
88"c c #2484AC",
89"d c #033D86",
90"e c #033677",
91"f c #072C58",
92"g c #525862",
93"h c #5E5E5E",
94"i c #23492A",
95"j c #4FBD3F",
96"k c #50B24C",
97"l c #51C72E",
98"m c #42C64A",
99"n c #2686CA",
100"o c #0B52A4",
101"p c #054A9A",
102"q c #053B7C",
103"r c #2B2325",
104"s c #6E7070",
105"t c #0D240E",
106"u c #1E423E",
107"v c #468ABE",
108"w c #6A8AC2",
109"x c #7EAA8E",
110"y c #84BE4E",
111"z c #65C639",
112"A c #064EA0",
113"B c #0A4DA0",
114"C c #4E5242",
115"D c #62362E",
116"E c #721A1A",
117"F c #6E0A0A",
118"G c #3E0E0E",
119"H c #6AB85E",
120"I c #7E8ECA",
121"J c #929CD4",
122"K c #9EAECA",
123"L c #9EBEAE",
124"M c #8EC26A",
125"N c #32A276",
126"O c #20518C",
127"P c #46566E",
128"Q c #614A51",
129"R c #AE2A26",
130"S c #C41C1A",
131"T c #CE0A0A",
132"U c #A60606",
133"V c #921616",
134"W c #863735",
135"X c #866A66",
136"Y c #9E9EA2",
137"Z c #1E5212",
138"` c #7EC652",
139" . c #B2B2F2",
140".. c #CACAF6",
141"+. c #AECEC6",
142"@. c #92CE72",
143"#. c #42AA86",
144"$. c #365E96",
145"%. c #B82420",
146"&. c #E20E0E",
147"*. c #EF0E0B",
148"=. c #566A86",
149"-. c #92929A",
150";. c #16260E",
151">. c #2E571A",
152",. c #7ED64E",
153"'. c #9ECEB2",
154"). c #C6D5EF",
155"!. c #E2E0FE",
156"~. c #A2DE8A",
157"{. c #4AAA5B",
158"]. c #2A6AB2",
159"^. c #9A7A6E",
160"/. c #D25A52",
161"(. c #F62626",
162"_. c #FA0206",
163":. c #DE1E16",
164"<. c #B63A26",
165"[. c #865A2E",
166"}. c #26568E",
167"|. c #435F7D",
168"1. c #7AE246",
169"2. c #96EA6E",
170"3. c #BEEAAE",
171"4. c #D0EADC",
172"5. c #B6CEFE",
173"6. c #9ADE8A",
174"7. c #2A609A",
175"8. c #7E623E",
176"9. c #CA7A72",
177"0. c #F26E6E",
178"a. c #FE5252",
179"b. c #FA3638",
180"c. c #DA2E28",
181"d. c #9E3E3A",
182"e. c #3E7656",
183"f. c #76CB3A",
184"g. c #90DE44",
185"h. c #A2EE6A",
186"i. c #9EEA9A",
187"j. c #92BEDE",
188"k. c #7ADA7E",
189"l. c #5ECE52",
190"m. c #6A5E52",
191"n. c #A83238",
192"o. c #FA5656",
193"p. c #F29A92",
194"q. c #D29E92",
195"r. c #8A7A62",
196"s. c #05336B",
197"t. c #59C631",
198"u. c #8AD23A",
199"v. c #66E242",
200"w. c #1D6FC1",
201"x. c #E61212",
202"y. c #CA261E",
203"z. c #5A763E",
204"A. c #1E6E9A",
205"B. c #023272",
206"C. c #329696",
207"D. c #2074B6",
208"E. c #3E4E76",
209"F. c #5A525E",
210"G. c #425868",
211"H. c #04448E",
212"I. c #28828A",
213"J. c #2D8593",
214"K. c #12427A",
215"L. c #054696",
216"M. c #042B5E",
217"N. c #134F95",
218"O. c #1E6ABB",
219"P. c #1A5E96",
220"Q. c #022E67",
221"R. c #0C3E7C",
222"S. c #023E8A",
223"T. c #021A3E",
224" ",
225" ",
226" ",
227" . + @ # + ",
228" $ # % & * * = - # $ ",
229"; > % @ = , ' ) ' ! ~ { % @ . ] ^ / ( ",
230"; + ' * ) _ ) ) ' : : ! { { % < . [ ( } ",
231"| @ 1 2 3 _ _ ) ' : : : : 4 5 6 6 # 7 8 } ",
232"9 0 a b b b c _ ) : : ! ! ~ ~ 5 ~ d e f [ 8 g h h } ",
233"| i j k j l m n 3 ) : ! ! ! ~ o o o p 6 q f / r r r s ",
234"t u v w x y y z a 1 3 ' : ! ~ A A B A p = C D E F G ( s ",
235"| u H I J K L M H k N 3 3 : ~ o o 5 O P Q R S T T U V W X Y ",
236"| Z ` J .....+.@.z #.3 _ 3 3 ) $.P W %.S &.*.*.&.S W Q P =.-. ",
237";.>.,.'.).!.!.).~.,.{.) : ) 3 ].h ^./.(._._._.:.<.[.g }.= & |. ",
238";.>.1.2.3.4.4.5.6.,.{._ : : : 7.8.9.0.a.b.b.c.d.} e.4 = 6 q # ",
239";.>.z f.g.h.i.j.k.l.N ) : ! ! 4 m.n.c.o.p.q.r.|.5 { d e e s.. ",
240"t Z l t.f.u.g.1.v.#.w.' : ! ~ ~ 7.|.n.x.y.z.A.A q - e e e B.> ",
241"| 0 c k t.t.l l C.D.) * * ! 5 { B o E.F.F.G.= H.e e e e q B.. ",
242"; + D.I.J.I.I.I.w.) : : * o K.7 - L.= O = }.6 6 e q q e q s.> ",
243"9 + ) ) ) ) ' ' , * : ! ! ! K.< . M.q 6 B N.{ d q e e e e s.9 ",
244"9 # O.) ) ' , , P.* ! ! ! ! = % . . M.e d p L.d B.B.e B.B.Q.9 ",
245"; < ' ' ' ' , , 4 4 ~ ! ! ~ ! 5 e q e e q A H.d q q e e B.Q.9 ",
246"; $ R.K.5 4 4 ' ! ! 4 ~ ! ~ ~ ~ o { B o A A L.S.B.B.B.B.B.Q.> ",
247" ] $ 0 R.= ' ' 4 4 5 4 5 5 o B o B p A A L.d e e B.B.B.Q.9 ",
248" # + - { 4 4 ~ ! o { o L.p p p p p H.S.B.B.s.Q.Q.M.T. ",
249" + s.6 B o o 5 B p L.p p L.p H.q B.Q.Q.Q.Q.M.; ",
250" < # s.- B o B p p L.L.H.L.H.d B.Q.Q.Q.Q.Q.9 ",
251" $ . s.d 6 B A p H.S.L.H.q B.Q.Q.M.M.. ; ",
252" ; 9 . 6 L.p L.d L.H.d Q.M.M.. 9 ; ] ",
253" | > e L.d L.H.e M.. ; ] ] ",
254" > 9 . S.Q.. ; ] ",
255" T.; ] "};
256
257
258using namespace Opie::Core; 45using namespace Opie::Core;
259using namespace Opie::Ui; 46using namespace Opie::Ui;
260 47
261static const char *SCAP_hostname = "www.handhelds.org"; 48static const char *SCAP_hostname = "www.handhelds.org";
262static const int SCAP_port = 80; 49static const int SCAP_port = 80;
263 50
264 51
265ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) 52ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name )
266 : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) 53 : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup )
267{ 54{
268 setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); 55 setFrameStyle( QFrame::PopupPanel | QFrame::Raised );
269 QVBoxLayout *vbox = new QVBoxLayout ( this, 5, 3 ); 56 QVBoxLayout *vbox = new QVBoxLayout ( this, 5, 3 );
270 QHBoxLayout *hbox; 57 QHBoxLayout *hbox;
271 58
272 hbox = new QHBoxLayout ( vbox ); 59 hbox = new QHBoxLayout ( vbox );
273 60
274 QLabel *l = new QLabel ( tr( "Delay" ), this ); 61 QLabel *l = new QLabel ( tr( "Delay" ), this );
275 hbox-> addWidget ( l ); 62 hbox-> addWidget ( l );
276 63
277 delaySpin = new QSpinBox( 0, 60, 1, this, "Spinner" ); 64 delaySpin = new QSpinBox( 0, 60, 1, this, "Spinner" );
278 delaySpin-> setButtonSymbols ( QSpinBox::PlusMinus ); 65 delaySpin-> setButtonSymbols ( QSpinBox::PlusMinus );
279 delaySpin-> setSuffix ( tr( "sec" )); 66 delaySpin-> setSuffix ( tr( "sec" ));
280 delaySpin-> setFocusPolicy( QWidget::NoFocus ); 67 delaySpin-> setFocusPolicy( QWidget::NoFocus );
281 delaySpin-> setValue ( 1 ); 68 delaySpin-> setValue ( 1 );
@@ -494,74 +281,72 @@ void ScreenshotControl::performGrab()
494 } 281 }
495 } 282 }
496 ::close ( sock ); 283 ::close ( sock );
497 } 284 }
498 } 285 }
499 if ( ok ) { 286 if ( ok ) {
500 QMessageBox::information( 0, tr( "Success" ), QString( "<p>%1</p>" ).arg ( tr( "Screenshot was uploaded to %1" )).arg( SCAP_hostname )); 287 QMessageBox::information( 0, tr( "Success" ), QString( "<p>%1</p>" ).arg ( tr( "Screenshot was uploaded to %1" )).arg( SCAP_hostname ));
501 } else { 288 } else {
502 QMessageBox::warning( 0, tr( "Error" ), QString( "<p>%1</p>" ).arg( tr( "Connection to %1 failed." )).arg( SCAP_hostname )); 289 QMessageBox::warning( 0, tr( "Error" ), QString( "<p>%1</p>" ).arg( tr( "Connection to %1 failed." )).arg( SCAP_hostname ));
503 } 290 }
504 } else { 291 } else {
505 QMessageBox::warning( 0, tr( "Error" ),tr("Please set <b>QWS_DISPLAY</b> environmental variable.")); 292 QMessageBox::warning( 0, tr( "Error" ),tr("Please set <b>QWS_DISPLAY</b> environmental variable."));
506 } 293 }
507 } 294 }
508 295
509} 296}
510 297
511 298
512 299
513//=========================================================================== 300//===========================================================================
514 301
515ScreenshotApplet::ScreenshotApplet( QWidget *parent, const char *name ) 302ScreenshotApplet::ScreenshotApplet( QWidget *parent, const char *name )
516 : QWidget( parent, name ) 303 : QWidget( parent, name )
517{ 304{
518 setFixedWidth( AppLnk::smallIconSize()); 305 setFixedHeight( AppLnk::smallIconSize() );
519 306 setFixedWidth( AppLnk::smallIconSize() );
520 QImage img = (const char **)snapshot_xpm; 307 m_icon.convertFromImage( Resource::loadImage( "screenshotapplet/screenshot" ).smoothScale( height(), width() ) );
521 img = img.smoothScale(AppLnk::smallIconSize(), AppLnk::smallIconSize());
522 m_icon.convertFromImage(img);
523} 308}
524 309
525ScreenshotApplet::~ScreenshotApplet() 310ScreenshotApplet::~ScreenshotApplet()
526{ 311{
527} 312}
528 313
529int ScreenshotApplet::position() 314int ScreenshotApplet::position()
530{ 315{
531 return 6; 316 return 6;
532} 317}
533 318
534void ScreenshotApplet::mousePressEvent( QMouseEvent *) 319void ScreenshotApplet::mousePressEvent( QMouseEvent *)
535{ 320{
536 ScreenshotControl *sc = new ScreenshotControl ( ); 321 ScreenshotControl *sc = new ScreenshotControl ( );
537 QPoint curPos = mapToGlobal ( QPoint ( 0, 0 )); 322 QPoint curPos = mapToGlobal ( QPoint ( 0, 0 ));
538 323
539 // windowPosX is the windows position centered above the applets icon. 324 // windowPosX is the windows position centered above the applets icon.
540 // If the icon is near the edge of the screen, the window would leave the visible area 325 // If the icon is near the edge of the screen, the window would leave the visible area
541 // so we check the position against the screen width and correct the difference if needed 326 // so we check the position against the screen width and correct the difference if needed
542 327
543 int screenWidth = qApp->desktop()->width(); 328 int screenWidth = qApp->desktop()->width();
544 int windowPosX = curPos. x ( ) - ( sc-> sizeHint ( ). width ( ) - width ( )) / 2 ; 329 int windowPosX = curPos. x ( ) - ( sc-> sizeHint ( ). width ( ) - width ( )) / 2 ;
545 int ZwindowPosX, XwindowPosX; 330 int ZwindowPosX, XwindowPosX;
546 331
547 // the window would be placed beyond the screen wich doesn't look tooo good 332 // the window would be placed beyond the screen wich doesn't look tooo good
548 if ( (windowPosX + sc-> sizeHint ( ). width ( )) > screenWidth ) { 333 if ( (windowPosX + sc-> sizeHint ( ). width ( )) > screenWidth ) {
549 XwindowPosX = windowPosX + sc-> sizeHint ( ). width ( ) - screenWidth; 334 XwindowPosX = windowPosX + sc-> sizeHint ( ). width ( ) - screenWidth;
550 ZwindowPosX = windowPosX - XwindowPosX - 1; 335 ZwindowPosX = windowPosX - XwindowPosX - 1;
551 } else { 336 } else {
552 ZwindowPosX = windowPosX; 337 ZwindowPosX = windowPosX;
553 } 338 }
554 339
555 sc-> move ( ZwindowPosX, curPos. y ( ) - sc-> sizeHint ( ). height ( ) ); 340 sc-> move ( ZwindowPosX, curPos. y ( ) - sc-> sizeHint ( ). height ( ) );
556 sc-> show ( ); 341 sc-> show ( );
557} 342}
558 343
559void ScreenshotApplet::paintEvent( QPaintEvent* ) 344void ScreenshotApplet::paintEvent( QPaintEvent* )
560{ 345{
561 QPainter p ( this ); 346 QPainter p ( this );
562 p.drawPixmap( 0,0, m_icon ); 347 p.drawPixmap( 0, 2, m_icon );
563} 348}
564 349
565 350
566EXPORT_OPIE_APPLET_v1( ScreenshotApplet ) 351EXPORT_OPIE_APPLET_v1( ScreenshotApplet )
567 352