diff options
author | dknn <yoann.blein@free.fr> | 2012-08-04 09:25:47 (GMT) |
---|---|---|
committer | dknn <yoann.blein@free.fr> | 2012-09-22 09:15:48 (GMT) |
commit | 343f88e3048887e83cc91bb710510b3aa618f779 (patch) | |
tree | c9a5d4cd3b9804c31074ffeec9f2953eedd45042 /Swift/QtUI/ScreenSharing/QtDesktopScreenGrabber.cpp | |
parent | 5ed2b62239eda07de84142e63fad31ccc194d379 (diff) | |
download | swift-contrib-343f88e3048887e83cc91bb710510b3aa618f779.zip swift-contrib-343f88e3048887e83cc91bb710510b3aa618f779.tar.bz2 |
Add basic UI for viewing remote screen
Diffstat (limited to 'Swift/QtUI/ScreenSharing/QtDesktopScreenGrabber.cpp')
-rw-r--r-- | Swift/QtUI/ScreenSharing/QtDesktopScreenGrabber.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Swift/QtUI/ScreenSharing/QtDesktopScreenGrabber.cpp b/Swift/QtUI/ScreenSharing/QtDesktopScreenGrabber.cpp new file mode 100644 index 0000000..a5eeafd --- /dev/null +++ b/Swift/QtUI/ScreenSharing/QtDesktopScreenGrabber.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2012 Yoann Blein + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#include "QtDesktopScreenGrabber.h" + +#include <QImage> +#include <QPixmap> +#include <QApplication> +#include <QDesktopWidget> + +#include <Swiften/ScreenSharing/Image.h> + +/*#include <QImage> +#include <QLabel>*/ + +namespace Swift { + +QtDesktopScreenGrabber::QtDesktopScreenGrabber() +{ + /*Image img = grab(); + QImage qImg(img.data.data(), img.width, img.height, QImage::Format_RGB888); + QLabel *label = new QLabel; + label->setPixmap(QPixmap::fromImage(qImg)); + label->show();*/ +} + +QtDesktopScreenGrabber::~QtDesktopScreenGrabber() +{ +} + +Image QtDesktopScreenGrabber::grab() const +{ + QImage qImg = QPixmap::grabWindow(QApplication::desktop()->winId()).toImage().convertToFormat(QImage::Format_RGB888); + return Image(qImg.width(), qImg.height(), qImg.constBits()); +} + +} |