-rw-r--r-- | core/applets/screenshotapplet/inputDialog.cpp | 67 | ||||
-rw-r--r-- | core/applets/screenshotapplet/inputDialog.h | 30 | ||||
-rw-r--r-- | core/applets/screenshotapplet/screenshot.cpp | 201 | ||||
-rw-r--r-- | core/applets/screenshotapplet/screenshot.h | 8 | ||||
-rw-r--r-- | core/applets/screenshotapplet/screenshotapplet.pro | 4 |
5 files changed, 260 insertions, 50 deletions
diff --git a/core/applets/screenshotapplet/inputDialog.cpp b/core/applets/screenshotapplet/inputDialog.cpp new file mode 100644 index 0000000..da8e276 --- a/dev/null +++ b/core/applets/screenshotapplet/inputDialog.cpp | |||
@@ -0,0 +1,67 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form implementation generated from reading ui file 'inputDialog.ui' | ||
3 | ** | ||
4 | ** Created: Sat Mar 2 07:55:03 2002 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #include "inputDialog.h" | ||
10 | |||
11 | #include <qpe/resource.h> | ||
12 | |||
13 | #include <opie/ofiledialog.h> | ||
14 | |||
15 | #include <qlineedit.h> | ||
16 | #include <qlayout.h> | ||
17 | #include <qvariant.h> | ||
18 | #include <qpushbutton.h> | ||
19 | #include <qwhatsthis.h> | ||
20 | |||
21 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | ||
22 | : QDialog( parent, name, modal, fl ) | ||
23 | { | ||
24 | if ( !name ) | ||
25 | setName( "InputDialog" ); | ||
26 | resize( 234, 115); | ||
27 | setMaximumSize( QSize( 240, 40)); | ||
28 | setCaption( tr(name ) ); | ||
29 | |||
30 | QPushButton *browserButton; | ||
31 | browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); | ||
32 | browserButton->setGeometry( QRect( 205, 10, 22, 22)); | ||
33 | connect( browserButton, SIGNAL(released()),this,SLOT(browse())); | ||
34 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | ||
35 | LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); | ||
36 | } | ||
37 | |||
38 | /* | ||
39 | * Destroys the object and frees any allocated resources | ||
40 | */ | ||
41 | InputDialog::~InputDialog() | ||
42 | { | ||
43 | inputText= LineEdit1->text(); | ||
44 | |||
45 | } | ||
46 | |||
47 | void InputDialog::browse() { | ||
48 | |||
49 | MimeTypes types; | ||
50 | QStringList audio, video, all; | ||
51 | audio << "audio/*"; | ||
52 | audio << "playlist/plain"; | ||
53 | audio << "audio/x-mpegurl"; | ||
54 | |||
55 | video << "video/*"; | ||
56 | video << "playlist/plain"; | ||
57 | |||
58 | all += audio; | ||
59 | all += video; | ||
60 | types.insert("All Media Files", all ); | ||
61 | types.insert("Audio", audio ); | ||
62 | types.insert("Video", video ); | ||
63 | |||
64 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); | ||
65 | LineEdit1->setText(str); | ||
66 | } | ||
67 | |||
diff --git a/core/applets/screenshotapplet/inputDialog.h b/core/applets/screenshotapplet/inputDialog.h new file mode 100644 index 0000000..3e3e36f --- a/dev/null +++ b/core/applets/screenshotapplet/inputDialog.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /**************************************************************************** | ||
2 | ** Form interface generated from reading ui file 'inputDialog.ui' | ||
3 | ** | ||
4 | ** Created: Sat Mar 2 07:54:46 2002 | ||
5 | ** by: The User Interface Compiler (uic) | ||
6 | ** | ||
7 | ** WARNING! All changes made in this file will be lost! | ||
8 | ****************************************************************************/ | ||
9 | #ifndef INPUTDIALOG_H | ||
10 | #define INPUTDIALOG_H | ||
11 | |||
12 | #include <qvariant.h> | ||
13 | #include <qdialog.h> | ||
14 | |||
15 | class QLineEdit; | ||
16 | |||
17 | class InputDialog : public QDialog | ||
18 | { | ||
19 | Q_OBJECT | ||
20 | |||
21 | public: | ||
22 | InputDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); | ||
23 | ~InputDialog(); | ||
24 | QString inputText; | ||
25 | QLineEdit* LineEdit1; | ||
26 | protected slots: | ||
27 | void browse(); | ||
28 | }; | ||
29 | |||
30 | #endif // INPUTDIALOG_H | ||
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp index 8a2a956..4ebdb7a 100644 --- a/core/applets/screenshotapplet/screenshot.cpp +++ b/core/applets/screenshotapplet/screenshot.cpp | |||
@@ -1,199 +1,306 @@ | |||
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" | ||
17 | |||
16 | #include <qapplication.h> | 18 | #include <qapplication.h> |
17 | #include <stdlib.h> | 19 | #include <stdlib.h> |
18 | 20 | ||
19 | 21 | ||
20 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
21 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
22 | #include <qpe/timestring.h> | 24 | #include <qpe/timestring.h> |
23 | #include <qpe/resource.h> | 25 | #include <qpe/resource.h> |
24 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
25 | #include <qpe/applnk.h> | 27 | #include <qpe/applnk.h> |
26 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
29 | #include <qsocket.h> | ||
27 | 30 | ||
31 | #include <qlineedit.h> | ||
28 | #include <qdir.h> | 32 | #include <qdir.h> |
29 | #include <qfileinfo.h> | 33 | #include <qfileinfo.h> |
30 | #include <qpoint.h> | 34 | #include <qpoint.h> |
31 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
32 | #include <qpainter.h> | 36 | #include <qpainter.h> |
33 | #include <qcombobox.h> | 37 | #include <qcombobox.h> |
34 | #include <qspinbox.h> | 38 | #include <qspinbox.h> |
35 | #include <qslider.h> | 39 | #include <qslider.h> |
36 | #include <qlayout.h> | 40 | #include <qlayout.h> |
37 | #include <qframe.h> | 41 | #include <qframe.h> |
38 | #include <qpixmap.h> | 42 | #include <qpixmap.h> |
39 | #include <qregexp.h> | 43 | #include <qregexp.h> |
40 | #include <qstring.h> | 44 | #include <qstring.h> |
41 | #include <qfile.h> | 45 | #include <qfile.h> |
42 | #include <qtimer.h> | 46 | #include <qtimer.h> |
47 | #include <qfile.h> | ||
48 | #include <qdatastream.h> | ||
49 | #include <qcheckbox.h> | ||
50 | |||
43 | 51 | ||
44 | static char * snapshot_xpm[] = { | 52 | static char * snapshot_xpm[] = { |
45 | "16 16 10 1", | 53 | "16 16 10 1", |
46 | " c None", | 54 | " c None", |
47 | ". c #000000", | 55 | ". c #000000", |
48 | "+ c #00C000", | 56 | "+ c #00C000", |
49 | "@ c #585858", | 57 | "@ c #585858", |
50 | "# c #808080", | 58 | "# c #808080", |
51 | "$ c #00FF00", | 59 | "$ c #00FF00", |
52 | "% c #008000", | 60 | "% c #008000", |
53 | "& c #00FFFF", | 61 | "& c #00FFFF", |
54 | "* c #FF0000", | 62 | "* c #FF0000", |
55 | "= c #FFC0C0", | 63 | "= c #FFC0C0", |
56 | " ", | 64 | " ", |
57 | " ... ", | 65 | " ... ", |
58 | " ..+++..@#. ", | 66 | " ..+++..@#. ", |
59 | " .$++++++.#. ", | 67 | " .$++++++.#. ", |
60 | " .%$$++++++. ", | 68 | " .%$$++++++. ", |
61 | " .&%%$$++@***. ", | 69 | " .&%%$$++@***. ", |
62 | " .$&$++$=**@+. ", | 70 | " .$&$++$=**@+. ", |
63 | " .+$$+++@*$%%. ", | 71 | " .+$$+++@*$%%. ", |
64 | " .+++++%+++%%. ", | 72 | " .+++++%+++%%. ", |
65 | " .%%++++..+%%. ", | 73 | " .%%++++..+%%. ", |
66 | " ..%%+++++%%. ", | 74 | " ..%%+++++%%. ", |
67 | " ..%%+++%%. ", | 75 | " ..%%+++%%. ", |
68 | " ..%%+%%. ", | 76 | " ..%%+%%. ", |
69 | " ..%%.. ", | 77 | " ..%%.. ", |
70 | " .. ", | 78 | " .. ", |
71 | " "}; | 79 | " "}; |
72 | 80 | ||
73 | 81 | ||
74 | ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) | 82 | ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name ) |
75 | : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) | 83 | : QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup ) |
76 | { | 84 | { |
77 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); | 85 | setFrameStyle( QFrame::PopupPanel | QFrame::Raised ); |
78 | // qDebug("screenshot control"); | 86 | // qDebug("screenshot control"); |
79 | QVBoxLayout *vbox = new QVBoxLayout( this ); | 87 | QVBoxLayout *vbox = new QVBoxLayout( this ); |
88 | QHBoxLayout *hbox = new QHBoxLayout( this ); | ||
80 | // qDebug("new layout"); | 89 | // qDebug("new layout"); |
81 | delaySpin = new QSpinBox( 0,60,1, this, "Spinner" ); | 90 | delaySpin = new QSpinBox( 0,60,1, this, "Spinner" ); |
82 | // qDebug("new spinbox"); | 91 | // qDebug("new spinbox"); |
83 | delaySpin->setFocusPolicy( QWidget::NoFocus ); | 92 | delaySpin->setFocusPolicy( QWidget::NoFocus ); |
93 | |||
94 | |||
84 | grabItButton= new QPushButton( this, "GrabButton" ); | 95 | grabItButton= new QPushButton( this, "GrabButton" ); |
85 | // qDebug("new pushbutton"); | 96 | // qDebug("new pushbutton"); |
97 | |||
86 | grabItButton ->setFocusPolicy( QWidget::TabFocus ); | 98 | grabItButton ->setFocusPolicy( QWidget::TabFocus ); |
87 | grabItButton->setText(tr("Snapshot")); | 99 | grabItButton->setText(tr("Snapshot")); |
100 | |||
101 | |||
88 | vbox->setMargin( 6 ); | 102 | vbox->setMargin( 6 ); |
89 | vbox->setSpacing( 3 ); | 103 | vbox->setSpacing( 3 ); |
104 | |||
90 | vbox->addWidget( delaySpin); | 105 | vbox->addWidget( delaySpin); |
106 | |||
91 | vbox->setMargin( 6 ); | 107 | vbox->setMargin( 6 ); |
92 | vbox->setSpacing( 3 ); | 108 | vbox->setSpacing( 3 ); |
93 | vbox->addWidget( grabItButton); | 109 | QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
110 | vbox->addItem( spacer ); | ||
111 | |||
112 | saveNamedCheck= new QCheckBox ( "name it", this); | ||
113 | saveNamedCheck-> setFocusPolicy ( QWidget::NoFocus ); | ||
114 | vbox->addWidget( saveNamedCheck); | ||
115 | |||
116 | |||
117 | scapButton = new QPushButton( this, "ScapButton" ); | ||
118 | |||
119 | scapButton ->setFocusPolicy( QWidget::TabFocus ); | ||
120 | scapButton ->setText(tr("scap")); | ||
121 | if( !QFile("/usr/bin/nc").exists()) | ||
122 | scapButton->hide(); | ||
123 | |||
124 | hbox->addWidget( grabItButton); | ||
125 | QSpacerItem* spacer2 = new QSpacerItem( 4, 4, QSizePolicy::Minimum, QSizePolicy::Expanding ); | ||
126 | hbox->addItem( spacer2 ); | ||
127 | hbox->addWidget( scapButton); | ||
128 | |||
129 | vbox->addItem(hbox); | ||
94 | 130 | ||
95 | setFixedHeight( 100 ); | 131 | setFixedHeight( 100 ); |
96 | setFixedWidth( sizeHint().width() ); | 132 | setFixedWidth( sizeHint().width() ); |
97 | setFocusPolicy(QWidget::NoFocus); | 133 | setFocusPolicy(QWidget::NoFocus); |
98 | 134 | ||
99 | grabTimer= new QTimer(this,"grab timer"); | 135 | grabTimer= new QTimer(this,"grab timer"); |
100 | // qDebug("newTimer"); | ||
101 | connect( grabTimer, SIGNAL( timeout() ), this, SLOT( grabTimerDone() ) ); | 136 | connect( grabTimer, SIGNAL( timeout() ), this, SLOT( grabTimerDone() ) ); |
102 | 137 | ||
103 | // Config cfg("Snapshot"); | 138 | delaySpin->setValue(1); |
104 | // cfg.setGroup("General"); | ||
105 | delaySpin->setValue(1); | ||
106 | // delaySpin->setValue(cfg.readNumEntry("delay",0)); | ||
107 | connect( grabItButton, SIGNAL(released()), SLOT(slotGrab()) ); | 139 | connect( grabItButton, SIGNAL(released()), SLOT(slotGrab()) ); |
108 | 140 | connect( scapButton, SIGNAL(released()), SLOT(slotScap()) ); | |
141 | connect(saveNamedCheck, SIGNAL(toggled( bool)), this, SLOT( nameScreenshot(bool)) ); | ||
109 | } | 142 | } |
110 | 143 | ||
111 | void ScreenshotControl::slotGrab() | 144 | void ScreenshotControl::slotGrab() { |
112 | { | ||
113 | // qDebug("SlotGrab"); | 145 | // qDebug("SlotGrab"); |
146 | buttonPushed=1; | ||
147 | hide(); | ||
148 | setFileName=FALSE; | ||
149 | if( saveNamedCheck->isChecked()) { | ||
150 | setFileName=TRUE; | ||
151 | // qDebug("checked"); | ||
152 | InputDialog *fileDlg; | ||
153 | |||
154 | fileDlg = new InputDialog( 0 ,tr("Name of screenshot "),TRUE, 0); | ||
155 | fileDlg->exec(); | ||
156 | fileDlg->raise(); | ||
157 | QString fileName,list; | ||
158 | if( fileDlg->result() == 1 ) { | ||
159 | fileName = fileDlg->LineEdit1->text(); | ||
160 | |||
161 | if(fileName.find("/",0,TRUE)==-1) | ||
162 | FileNamePath = QDir::homeDirPath()+"/Documents/image/png/"+fileName; | ||
163 | // qDebug(fileName); | ||
164 | |||
165 | } | ||
166 | delete fileDlg; | ||
167 | } | ||
168 | if ( delaySpin->value() ) { | ||
169 | grabTimer->start( delaySpin->value() * 1000, true ); | ||
170 | } else { | ||
171 | show(); | ||
172 | } | ||
173 | } | ||
174 | |||
175 | void ScreenshotControl::slotScap() { | ||
176 | buttonPushed=2; | ||
114 | hide(); | 177 | hide(); |
115 | if ( delaySpin->value() ) { | 178 | if ( delaySpin->value() ) { |
116 | grabTimer->start( delaySpin->value() * 1000, true ); | 179 | grabTimer->start( delaySpin->value() * 1000, true ); |
117 | } else { | 180 | } else { |
118 | show(); | 181 | show(); |
119 | } | 182 | } |
120 | } | 183 | } |
121 | 184 | ||
122 | 185 | ||
123 | void ScreenshotControl::grabTimerDone() | 186 | void ScreenshotControl::grabTimerDone() { |
124 | { | ||
125 | performGrab(); | 187 | performGrab(); |
126 | } | 188 | } |
127 | 189 | ||
128 | void ScreenshotControl::savePixmap() | 190 | void ScreenshotControl::savePixmap() { |
129 | { | ||
130 | DocLnk lnk; | 191 | DocLnk lnk; |
131 | QString fileName = "sc_"+TimeString::dateString( QDateTime::currentDateTime(),false,true); | 192 | QString fileName; |
132 | fileName.replace(QRegExp("'"),""); fileName.replace(QRegExp(" "),"_"); fileName.replace(QRegExp(":"),"."); fileName.replace(QRegExp(","),""); | 193 | |
133 | 194 | if( setFileName) { | |
134 | QString dirName = QDir::homeDirPath()+"/Documents/image/png/"; | 195 | fileName=FileNamePath; |
135 | if( !QDir( dirName).exists() ) { | 196 | //not sure why this is needed here, but it forgets fileName |
136 | qDebug("making dir "+dirName); | 197 | // if this is below the braces |
137 | QString msg = "mkdir -p "+dirName; | 198 | |
138 | system(msg.latin1()); | 199 | if(fileName.right(3)!="png") |
200 | fileName=fileName+".png"; | ||
201 | lnk.setFile(fileName); //sets File property | ||
202 | qDebug("saving file "+fileName); | ||
203 | snapshot.save( fileName,"PNG"); | ||
204 | QFileInfo fi( fileName); | ||
205 | lnk.setName( fi.fileName()); //sets file name | ||
206 | |||
207 | if(!lnk.writeLink()) | ||
208 | qDebug("Writing doclink did not work"); | ||
209 | } else { | ||
210 | |||
211 | fileName = "sc_"+TimeString::dateString( QDateTime::currentDateTime(),false,true); | ||
212 | fileName.replace(QRegExp("'"),""); fileName.replace(QRegExp(" "),"_"); fileName.replace(QRegExp(":"),"."); fileName.replace(QRegExp(","),""); | ||
213 | QString dirName = QDir::homeDirPath()+"/Documents/image/png/"; | ||
214 | |||
215 | if( !QDir( dirName).exists() ) { | ||
216 | qDebug("making dir "+dirName); | ||
217 | QString msg = "mkdir -p "+dirName; | ||
218 | system(msg.latin1()); | ||
219 | } | ||
220 | fileName=dirName+fileName; | ||
221 | if(fileName.right(3)!="png") | ||
222 | fileName=fileName+".png"; | ||
223 | lnk.setFile(fileName); //sets File property | ||
224 | qDebug("saving file "+fileName); | ||
225 | snapshot.save( fileName,"PNG"); | ||
226 | QFileInfo fi( fileName); | ||
227 | lnk.setName( fi.fileName()); //sets file name | ||
228 | |||
229 | if(!lnk.writeLink()) | ||
230 | qDebug("Writing doclink did not work"); | ||
231 | |||
139 | } | 232 | } |
140 | fileName=dirName+fileName+".png"; | ||
141 | lnk.setFile(fileName); //sets File property | ||
142 | snapshot.save( fileName,"PNG"); | ||
143 | qDebug("saving file "+fileName); | ||
144 | QFileInfo fi( fileName); | ||
145 | lnk.setName( fi.fileName()); //sets file name | ||
146 | if(!lnk.writeLink()) | ||
147 | qDebug("Writing doclink did not work"); | ||
148 | 233 | ||
149 | QPEApplication::beep(); | 234 | QPEApplication::beep(); |
150 | |||
151 | } | 235 | } |
152 | 236 | ||
153 | void ScreenshotControl::performGrab() | 237 | void ScreenshotControl::performGrab() { |
154 | { | 238 | |
155 | qDebug("grabbing screen"); | 239 | if(buttonPushed ==1) { |
156 | grabTimer->stop(); | 240 | qDebug("grabbing screen"); |
157 | snapshot = QPixmap::grabWindow( QPEApplication::desktop()->winId(),0,0,QApplication::desktop()->width(),QApplication::desktop()->height() ); | 241 | grabTimer->stop(); |
158 | show(); | 242 | snapshot = QPixmap::grabWindow( QPEApplication::desktop()->winId(),0,0,QApplication::desktop()->width(),QApplication::desktop()->height() ); |
159 | savePixmap(); | 243 | show(); |
244 | qApp->processEvents(); | ||
245 | savePixmap(); | ||
246 | } else { | ||
247 | qDebug("scap"); | ||
248 | grabTimer->stop(); | ||
249 | // do scap here | ||
250 | QString cmd; | ||
251 | cmd="cat /dev/fd0 > /tmp/cap"; | ||
252 | system(cmd.latin1()); | ||
253 | // qDebug("echo \"POST /scap/capture.cgi http1.1\" | ||
254 | // echo \"Content-length: 153600\" | ||
255 | // echo \"Content-Type: image/gif\" | ||
256 | // echo \"HOST: www.handhelds.org\" | ||
257 | // echo \"\" | ||
258 | // cat /tmp/cap | nc h1.handhelds.org 80"); | ||
259 | cmd="nc h1.handhelds.org 1011 </tmp/cap"; | ||
260 | qDebug("running command "+cmd); | ||
261 | |||
262 | system(cmd.latin1()); | ||
263 | show(); | ||
264 | } | ||
265 | |||
160 | } | 266 | } |
161 | 267 | ||
162 | void ScreenshotControl::setTime(int newTime) | 268 | void ScreenshotControl::setTime(int newTime) { |
163 | { | ||
164 | delaySpin->setValue(newTime); | 269 | delaySpin->setValue(newTime); |
165 | } | 270 | } |
166 | 271 | ||
272 | void ScreenshotControl::nameScreenshot(bool b) { | ||
273 | |||
274 | |||
275 | } | ||
276 | |||
167 | //=========================================================================== | 277 | //=========================================================================== |
168 | 278 | ||
169 | ScreenshotApplet::ScreenshotApplet( QWidget *parent, const char *name ) | 279 | ScreenshotApplet::ScreenshotApplet( QWidget *parent, const char *name ) |
170 | : QWidget( parent, name ) | 280 | : QWidget( parent, name ) { |
171 | { | ||
172 | // qDebug("beginning applet"); | 281 | // qDebug("beginning applet"); |
173 | setFixedHeight( 18 ); | 282 | setFixedHeight( 18 ); |
174 | setFixedWidth( 14 ); | 283 | setFixedWidth( 14 ); |
175 | vc = new ScreenshotControl; | 284 | vc = new ScreenshotControl; |
176 | // qDebug("new screenshotapplet"); | 285 | // qDebug("new screenshotapplet"); |
177 | } | 286 | } |
178 | 287 | ||
179 | ScreenshotApplet::~ScreenshotApplet() | 288 | ScreenshotApplet::~ScreenshotApplet() { |
180 | { | ||
181 | } | 289 | } |
182 | 290 | ||
183 | void ScreenshotApplet::mousePressEvent( QMouseEvent *) | 291 | void ScreenshotApplet::mousePressEvent( QMouseEvent *) { |
184 | { | ||
185 | // if(!vc) | 292 | // if(!vc) |
186 | vc = new ScreenshotControl; | 293 | vc = new ScreenshotControl; |
187 | QPoint curPos = mapToGlobal( rect().topLeft() ); | 294 | QPoint curPos = mapToGlobal( rect().topLeft() ); |
188 | vc->move( curPos.x()-(vc->sizeHint().width()-width())/2, curPos.y() - 100 ); | 295 | vc->move( curPos.x()-(vc->sizeHint().width()-width())/2, curPos.y() - 100 ); |
189 | vc->show(); | 296 | vc->show(); |
190 | 297 | ||
191 | } | 298 | } |
192 | 299 | ||
193 | void ScreenshotApplet::paintEvent( QPaintEvent* ) | 300 | void ScreenshotApplet::paintEvent( QPaintEvent* ) { |
194 | { | ||
195 | QPainter p(this); | 301 | QPainter p(this); |
196 | qDebug("paint pixmap"); | 302 | qDebug("paint pixmap"); |
197 | p.drawPixmap( 0, 1, ( const char** ) snapshot_xpm ); | 303 | p.drawPixmap( 0, 1, ( const char** ) snapshot_xpm ); |
198 | 304 | ||
199 | } | 305 | } |
306 | |||
diff --git a/core/applets/screenshotapplet/screenshot.h b/core/applets/screenshotapplet/screenshot.h index 82800b9..c8dfeaa 100644 --- a/core/applets/screenshotapplet/screenshot.h +++ b/core/applets/screenshotapplet/screenshot.h | |||
@@ -16,61 +16,67 @@ | |||
16 | #define __SCREENSHOT_APPLET_H__ | 16 | #define __SCREENSHOT_APPLET_H__ |
17 | 17 | ||
18 | 18 | ||
19 | 19 | ||
20 | #include <qwidget.h> | 20 | #include <qwidget.h> |
21 | #include <qframe.h> | 21 | #include <qframe.h> |
22 | #include <qpixmap.h> | 22 | #include <qpixmap.h> |
23 | #include <qguardedptr.h> | 23 | #include <qguardedptr.h> |
24 | #include <qtimer.h> | 24 | #include <qtimer.h> |
25 | 25 | ||
26 | class QComboBox; | 26 | class QComboBox; |
27 | class QCheckBox; | 27 | class QCheckBox; |
28 | class QSpinBox; | 28 | class QSpinBox; |
29 | class QPushButton; | 29 | class QPushButton; |
30 | //class QImage; | 30 | //class QImage; |
31 | 31 | ||
32 | class ScreenshotControl : public QFrame | 32 | class ScreenshotControl : public QFrame |
33 | { | 33 | { |
34 | Q_OBJECT | 34 | Q_OBJECT |
35 | public: | 35 | public: |
36 | ScreenshotControl( QWidget *parent=0, const char *name=0 ); | 36 | ScreenshotControl( QWidget *parent=0, const char *name=0 ); |
37 | void performGrab(); | 37 | void performGrab(); |
38 | 38 | ||
39 | public: | 39 | public: |
40 | QPushButton *grabItButton; | 40 | QPushButton *grabItButton, *scapButton; |
41 | QPixmap snapshot; | 41 | QPixmap snapshot; |
42 | QTimer* grabTimer; | 42 | QTimer* grabTimer; |
43 | QCheckBox *saveNamedCheck; | ||
44 | QString FileNamePath; | ||
45 | bool setFileName; | ||
43 | void slotSave(); | 46 | void slotSave(); |
44 | void slotCopy(); | 47 | void slotCopy(); |
45 | void setTime(int newTime); | 48 | void setTime(int newTime); |
46 | 49 | ||
47 | QSpinBox *delaySpin; | 50 | QSpinBox *delaySpin; |
48 | private: | 51 | private: |
52 | int buttonPushed; | ||
49 | private slots: | 53 | private slots: |
50 | void slotGrab(); | 54 | void slotGrab(); |
55 | void slotScap(); | ||
51 | void savePixmap(); | 56 | void savePixmap(); |
52 | void grabTimerDone(); | 57 | void grabTimerDone(); |
58 | void nameScreenshot(bool); | ||
53 | }; | 59 | }; |
54 | 60 | ||
55 | class ScreenshotApplet : public QWidget | 61 | class ScreenshotApplet : public QWidget |
56 | { | 62 | { |
57 | Q_OBJECT | 63 | Q_OBJECT |
58 | public: | 64 | public: |
59 | ScreenshotApplet( QWidget *parent = 0, const char *name=0 ); | 65 | ScreenshotApplet( QWidget *parent = 0, const char *name=0 ); |
60 | ~ScreenshotApplet(); | 66 | ~ScreenshotApplet(); |
61 | ScreenshotControl *vc; | 67 | ScreenshotControl *vc; |
62 | public slots: | 68 | public slots: |
63 | private: | 69 | private: |
64 | void mousePressEvent( QMouseEvent * ); | 70 | void mousePressEvent( QMouseEvent * ); |
65 | void paintEvent( QPaintEvent* ); | 71 | void paintEvent( QPaintEvent* ); |
66 | 72 | ||
67 | private: | 73 | private: |
68 | QPixmap snapshotPixmap; | 74 | QPixmap snapshotPixmap; |
69 | private slots: | 75 | private slots: |
70 | 76 | ||
71 | 77 | ||
72 | }; | 78 | }; |
73 | 79 | ||
74 | 80 | ||
75 | #endif // __SCREENSHOT_APPLET_H__ | 81 | #endif // __SCREENSHOT_APPLET_H__ |
76 | 82 | ||
diff --git a/core/applets/screenshotapplet/screenshotapplet.pro b/core/applets/screenshotapplet/screenshotapplet.pro index 2fc8a05..4064836 100644 --- a/core/applets/screenshotapplet/screenshotapplet.pro +++ b/core/applets/screenshotapplet/screenshotapplet.pro | |||
@@ -1,27 +1,27 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | HEADERS = screenshot.h screenshotappletimpl.h | 3 | HEADERS = screenshot.h inputDialog.h screenshotappletimpl.h |
4 | SOURCES = screenshot.cpp screenshotappletimpl.cpp | 4 | SOURCES = screenshot.cpp inputDialog.cpp screenshotappletimpl.cpp |
5 | TARGET = screenshotapplet | 5 | TARGET = screenshotapplet |
6 | DESTDIR = $(OPIEDIR)/plugins/applets | 6 | DESTDIR = $(OPIEDIR)/plugins/applets |
7 | INCLUDEPATH += $(OPIEDIR)/include | 7 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH += ../$(OPIEDIR)/include | 8 | DEPENDPATH += ../$(OPIEDIR)/include |
9 | LIBS += -lqpe | 9 | LIBS += -lqpe |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | MOC_DIR=opieobj | 11 | MOC_DIR=opieobj |
12 | OBJECTS_DIR=opieobj | 12 | OBJECTS_DIR=opieobj |
13 | 13 | ||
14 | TRANSLATIONS = ../../../i18n/de/libscreenshotapplet.ts \ | 14 | TRANSLATIONS = ../../../i18n/de/libscreenshotapplet.ts \ |
15 | ../../../i18n/en/libscreenshotapplet.ts \ | 15 | ../../../i18n/en/libscreenshotapplet.ts \ |
16 | ../../../i18n/es/libscreenshotapplet.ts \ | 16 | ../../../i18n/es/libscreenshotapplet.ts \ |
17 | ../../../i18n/fr/libscreenshotapplet.ts \ | 17 | ../../../i18n/fr/libscreenshotapplet.ts \ |
18 | ../../../i18n/hu/libscreenshotapplet.ts \ | 18 | ../../../i18n/hu/libscreenshotapplet.ts \ |
19 | ../../../i18n/ja/libscreenshotapplet.ts \ | 19 | ../../../i18n/ja/libscreenshotapplet.ts \ |
20 | ../../../i18n/ko/libscreenshotapplet.ts \ | 20 | ../../../i18n/ko/libscreenshotapplet.ts \ |
21 | ../../../i18n/no/libscreenshotapplet.ts \ | 21 | ../../../i18n/no/libscreenshotapplet.ts \ |
22 | ../../../i18n/pl/libscreenshotapplet.ts \ | 22 | ../../../i18n/pl/libscreenshotapplet.ts \ |
23 | ../../../i18n/pt/libscreenshotapplet.ts \ | 23 | ../../../i18n/pt/libscreenshotapplet.ts \ |
24 | ../../../i18n/pt_BR/libscreenshotapplet.ts \ | 24 | ../../../i18n/pt_BR/libscreenshotapplet.ts \ |
25 | ../../../i18n/sl/libscreenshotapplet.ts \ | 25 | ../../../i18n/sl/libscreenshotapplet.ts \ |
26 | ../../../i18n/zh_CN/libscreenshotapplet.ts \ | 26 | ../../../i18n/zh_CN/libscreenshotapplet.ts \ |
27 | ../../../i18n/zh_TW/libscreenshotapplet.ts | 27 | ../../../i18n/zh_TW/libscreenshotapplet.ts |