summaryrefslogtreecommitdiff
authorzecke <zecke>2004-04-08 00:43:00 (UTC)
committer zecke <zecke>2004-04-08 00:43:00 (UTC)
commit5badc8e0aba089d73fdbfb1b1383b937aa30a301 (patch) (side-by-side diff)
tree07c82bb19e05c608a570f7de286e5c31fb9501c2
parent5afca2540a2d6bf733c89ea97748496a679bc576 (diff)
downloadopie-5badc8e0aba089d73fdbfb1b1383b937aa30a301.zip
opie-5badc8e0aba089d73fdbfb1b1383b937aa30a301.tar.gz
opie-5badc8e0aba089d73fdbfb1b1383b937aa30a301.tar.bz2
Allow to take a ScreenShot, Open it directly with drawpad
Comment it and send via email
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/screenshotapplet/screenshot.cpp27
-rw-r--r--core/applets/screenshotapplet/screenshot.h11
2 files changed, 31 insertions, 7 deletions
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp
index 938ea0c..042f390 100644
--- a/core/applets/screenshotapplet/screenshot.cpp
+++ b/core/applets/screenshotapplet/screenshot.cpp
@@ -17,14 +17,14 @@
/* OPIE */
#include <opie2/odebug.h>
#include <opie2/otaskbarapplet.h>
#include <qpe/qpeapplication.h>
#include <qpe/applnk.h>
-using namespace Opie::Core;
-using namespace Opie::Ui;
+#include <qpe/qcopenvelope_qws.h>
+
/* QT */
#include <qlineedit.h>
#include <qdir.h>
#include <qlabel.h>
#include <qpushbutton.h>
@@ -251,12 +251,16 @@ static char * snapshot_xpm[] = {
" $ . s.d 6 B A p H.S.L.H.q B.Q.Q.M.M.. ; ",
" ; 9 . 6 L.p L.d L.H.d Q.M.M.. 9 ; ] ",
" | > e L.d L.H.e M.. ; ] ] ",
" > 9 . S.Q.. ; ] ",
" T.; ] "};
+
+using namespace Opie::Core;
+using namespace Opie::Ui;
+
static const char *SCAP_hostname = "www.handhelds.org";
static const int SCAP_port = 80;
ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name )
: QFrame( parent, name, WDestructiveClose | WStyle_StaysOnTop | WType_Popup )
@@ -289,12 +293,16 @@ ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name )
hbox = new QHBoxLayout ( vbox );
grabItButton = new QPushButton( tr( "File" ), this, "GrabButton" );
grabItButton ->setFocusPolicy( QWidget::TabFocus );
hbox-> addWidget ( grabItButton );
+ QPushButton* drawPadButton = new QPushButton( tr("Opie drawpad"), this, "DrawPadButton" );
+ drawPadButton->setFocusPolicy( QWidget::TabFocus );
+ hbox->addWidget( drawPadButton );
+
scapButton = new QPushButton( tr( "Scap" ), this, "ScapButton" );
scapButton ->setFocusPolicy( QWidget::TabFocus );
hbox-> addWidget ( scapButton );
setFixedSize ( sizeHint ( ));
setFocusPolicy ( QWidget::NoFocus );
@@ -302,12 +310,13 @@ ScreenshotControl::ScreenshotControl( QWidget *parent, const char *name )
grabTimer = new QTimer ( this, "grab timer");
connect ( grabTimer, SIGNAL( timeout()), this, SLOT( performGrab()));
connect ( grabItButton, SIGNAL( clicked()), SLOT( slotGrab()));
connect ( scapButton, SIGNAL( clicked()), SLOT( slotScap()));
+ connect ( drawPadButton, SIGNAL(clicked()), SLOT(slotDrawpad()) );
}
void ScreenshotControl::slotGrab()
{
buttonPushed = 1;
hide();
@@ -347,12 +356,21 @@ void ScreenshotControl::slotScap()
if ( delaySpin->value() )
grabTimer->start( delaySpin->value() * 1000, true );
else
show();
}
+void ScreenshotControl::slotDrawpad()
+{
+ buttonPushed = 3;
+ hide();
+ if ( delaySpin->value() )
+ grabTimer->start( delaySpin->value()*1000, true );
+ else
+ show();
+}
void ScreenshotControl::savePixmap()
{
DocLnk lnk;
QString fileName;
@@ -410,12 +428,17 @@ void ScreenshotControl::performGrab()
if (buttonPushed == 1) {
odebug << "grabbing screen" << oendl;
grabTimer->stop();
show();
qApp->processEvents();
savePixmap();
+ }else if ( buttonPushed == 3 ) {
+ grabTimer->stop();
+ show();
+ QCopEnvelope env("QPE/Application/drawpad", "importPixmap(QPixmap)" );
+ env << snapshot;
} else {
grabTimer->stop();
struct sockaddr_in raddr;
struct hostent *rhost_info;
int sock = -1;
diff --git a/core/applets/screenshotapplet/screenshot.h b/core/applets/screenshotapplet/screenshot.h
index b753583..e7b6040 100644
--- a/core/applets/screenshotapplet/screenshot.h
+++ b/core/applets/screenshotapplet/screenshot.h
@@ -9,14 +9,14 @@
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
-#ifndef __SCREENSHOT_APPLET_H__
-#define __SCREENSHOT_APPLET_H__
+#ifndef SCREENSHOT_APPLET_H__
+#define SCREENSHOT_APPLET_H__
#include <qwidget.h>
#include <qframe.h>
#include <qpixmap.h>
@@ -44,27 +44,28 @@ private:
bool setFileName;
QSpinBox *delaySpin;
int buttonPushed;
private slots:
void slotGrab();
- void slotScap();
+ void slotScap();
+ void slotDrawpad();
void savePixmap();
void performGrab();
};
class ScreenshotApplet : public QWidget {
public:
ScreenshotApplet( QWidget *parent = 0, const char *name=0 );
~ScreenshotApplet();
static int position();
-
+
protected:
void mousePressEvent( QMouseEvent * );
void paintEvent( QPaintEvent* );
-
+
private:
QPixmap m_icon;
};
#endif // __SCREENSHOT_APPLET_H__