summaryrefslogtreecommitdiff
path: root/core/applets/screenshotapplet/screenshot.cpp
authormickeyl <mickeyl>2004-03-01 19:19:37 (UTC)
committer mickeyl <mickeyl>2004-03-01 19:19:37 (UTC)
commitddc3d749af5f7afebf69488b79641771fe246b5b (patch) (side-by-side diff)
tree8ea8614906c568e4677493ef09040724d60dd2d4 /core/applets/screenshotapplet/screenshot.cpp
parentfb0981f47e529f9d1dd77fa005ffa3c3ecedff67 (diff)
downloadopie-ddc3d749af5f7afebf69488b79641771fe246b5b.zip
opie-ddc3d749af5f7afebf69488b79641771fe246b5b.tar.gz
opie-ddc3d749af5f7afebf69488b79641771fe246b5b.tar.bz2
remove duplicated boiler plate code in favour of the OTaskbarApplet template
Diffstat (limited to 'core/applets/screenshotapplet/screenshot.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/screenshotapplet/screenshot.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/core/applets/screenshotapplet/screenshot.cpp b/core/applets/screenshotapplet/screenshot.cpp
index 56a031c..5d6bce4 100644
--- a/core/applets/screenshotapplet/screenshot.cpp
+++ b/core/applets/screenshotapplet/screenshot.cpp
@@ -6,43 +6,46 @@
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "screenshot.h"
#include "inputDialog.h"
-#include <stdlib.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <unistd.h>
-
+/* OPIE */
+#include <opie2/otaskbarapplet.h>
#include <qpe/qpeapplication.h>
#include <qpe/applnk.h>
+/* QT */
#include <qlineedit.h>
#include <qdir.h>
#include <qlabel.h>
#include <qpushbutton.h>
#include <qpainter.h>
#include <qspinbox.h>
#include <qlayout.h>
#include <qcheckbox.h>
#include <qmessagebox.h>
+/* STD */
+#include <stdlib.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <unistd.h>
/* XPM */
static char * snapshot_xpm[] = {
"32 32 177 2",
" c None",
". c #042045",
"+ c #0D2B47",
"@ c #0E325E",
"# c #0D2E50",
"$ c #0A1C32",
"% c #0F3A69",
"& c #164680",
@@ -488,24 +491,29 @@ ScreenshotApplet::ScreenshotApplet( QWidget *parent, const char *name )
{
setFixedWidth( AppLnk::smallIconSize());
QImage img = (const char **)snapshot_xpm;
img = img.smoothScale(AppLnk::smallIconSize(), AppLnk::smallIconSize());
m_icon.convertFromImage(img);
}
ScreenshotApplet::~ScreenshotApplet()
{
}
+int ScreenshotApplet::position()
+{
+ return 6;
+}
+
void ScreenshotApplet::mousePressEvent( QMouseEvent *)
{
ScreenshotControl *sc = new ScreenshotControl ( );
QPoint curPos = mapToGlobal ( QPoint ( 0, 0 ));
// windowPosX is the windows position centered above the applets icon.
// If the icon is near the edge of the screen, the window would leave the visible area
// so we check the position against the screen width and correct the difference if needed
int screenWidth = qApp->desktop()->width();
int windowPosX = curPos. x ( ) - ( sc-> sizeHint ( ). width ( ) - width ( )) / 2 ;
int ZwindowPosX, XwindowPosX;
@@ -519,12 +527,17 @@ void ScreenshotApplet::mousePressEvent( QMouseEvent *)
}
sc-> move ( ZwindowPosX, curPos. y ( ) - sc-> sizeHint ( ). height ( ) );
sc-> show ( );
}
void ScreenshotApplet::paintEvent( QPaintEvent* )
{
QPainter p ( this );
p.drawPixmap( 0,0, m_icon );
}
+Q_EXPORT_INTERFACE()
+{
+ Q_CREATE_INSTANCE( OTaskbarAppletWrapper<ScreenshotApplet> );
+}
+