Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F86019
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
23 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/lightscreen.pro b/lightscreen.pro
index dfbe2a0..db55f85 100644
--- a/lightscreen.pro
+++ b/lightscreen.pro
@@ -1,103 +1,104 @@
TEMPLATE = app
TARGET = lightscreen
DEFINES += QT_DEPRECATED_WARNINGS
HEADERS += dialogs/areadialog.h \
dialogs/historydialog.h \
dialogs/namingdialog.h \
dialogs/optionsdialog.h \
dialogs/previewdialog.h \
dialogs/updaterdialog.h \
lightscreenwindow.h \
tools/os.h \
tools/screenshot.h \
tools/screenshotmanager.h \
tools/windowpicker.h \
updater/updater.h \
widgets/hotkeywidget.h \
+ tools/fixx11h.h \
tools/uploader/imageuploader.h \
tools/uploader/imguruploader.h \
tools/uploader/pomfuploader.h \
tools/uploader/uploader.h \
widgets/imguroptionswidget.h \
widgets/pomfoptionswidget.h
SOURCES += dialogs/areadialog.cpp \
dialogs/historydialog.cpp \
dialogs/namingdialog.cpp \
dialogs/optionsdialog.cpp \
dialogs/previewdialog.cpp \
dialogs/updaterdialog.cpp \
lightscreenwindow.cpp \
main.cpp \
tools/os.cpp \
tools/screenshot.cpp \
tools/screenshotmanager.cpp \
tools/windowpicker.cpp \
updater/updater.cpp \
widgets/hotkeywidget.cpp \
tools/uploader/imageuploader.cpp \
tools/uploader/imguruploader.cpp \
tools/uploader/pomfuploader.cpp \
tools/uploader/uploader.cpp \
widgets/imguroptionswidget.cpp \
widgets/pomfoptionswidget.cpp
FORMS += dialogs/historydialog.ui \
dialogs/namingdialog.ui \
dialogs/optionsdialog.ui \
lightscreenwindow.ui \
widgets/pomfoptionswidget.ui \
widgets/imguroptionswidget.ui
RESOURCES += lightscreen.qrc
CODECFORSRC = UTF-8
INCLUDEPATH += $$PWD
CONFIG += c++14
QT += core gui widgets network sql multimedia concurrent
include($$PWD/tools/SingleApplication/singleapplication.pri)
include($$PWD/tools/UGlobalHotkey/uglobalhotkey.pri)
windows {
QT += winextras
RC_ICONS += images/LS.ico
# MinGW
contains(QMAKE_CC, gcc){
LIBS += libgdi32 libgcc libuser32 libole32 libshell32 libshlwapi libcomctl32
QMAKE_CXXFLAGS = -Wextra -Wall -Wpointer-arith
}
# MSVC
contains(QMAKE_CC, cl){
LIBS += gdi32.lib user32.lib ole32.lib shell32.lib shlwapi.lib comctl32.lib
DEFINES += _ATL_XP_TARGETING
QMAKE_CFLAGS += /D _USING_V110_SDK71
QMAKE_CXXFLAGS += /D _USING_V110_SDK71
QMAKE_LFLAGS_WINDOWS += /SUBSYSTEM:WINDOWS,5.01
QMAKE_LFLAGS_WINDOWS += /MANIFESTUAC:level=\'asInvoker\'
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE,5.01
}
CONFIG += embed_manifest_exe
#QMAKE_CXXFLAGS_DEBUG += /analyze /W3 /wd6326
}
unix:LIBS += -lX11
unix:QT += x11extras
include (version.pri)
OTHER_FILES += TODO.txt
diff --git a/tools/fixx11h.h b/tools/fixx11h.h
new file mode 100644
index 0000000..078e513
--- /dev/null
+++ b/tools/fixx11h.h
@@ -0,0 +1,331 @@
+/****************************************************************************
+ Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org>
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the "Software"),
+ to deal in the Software without restriction, including without limitation
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ and/or sell copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following conditions:
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ DEALINGS IN THE SOFTWARE.
+ ****************************************************************************/
+//#ifdef don't do this, this file is supposed to be included
+//#define multiple times
+#include <QtGlobal>
+/* Usage:
+ If you get compile errors caused by X11 includes (the line
+ where first error appears contains word like None, Unsorted,
+ Below, etc.), put #include <fixx11h.h> in the .cpp file
+ (not .h file!) between the place where X11 headers are
+ included and the place where the file with compile
+ error is included (or the place where the compile error
+ in the .cpp file occurs).
+ This file remaps X11 #defines to const variables or
+ inline functions. The side effect may be that these
+ symbols may now refer to different variables
+ (e.g. if X11 #defined NoButton, after this file
+ is included NoButton would no longer be X11's
+ NoButton, but Qt::NoButton instead). At this time,
+ there's no conflict known that could cause problems.
+ The original X11 symbols are still accessible
+ (e.g. for None) as X::None, XNone, and also still
+ None, unless name lookup finds different None
+ first (in the current class, etc.)
+ Use 'Unsorted', 'Bool' and 'index' as templates.
+*/
+namespace X
+{
+// template --->
+// Affects: Should be without side effects.
+#ifdef Unsorted
+#ifndef FIXX11H_Unsorted
+ #define FIXX11H_Unsorted
+
+ const int XUnsorted = Unsorted;
+
+ #undef Unsorted
+
+ const int Unsorted = XUnsorted;
+
+ #endif
+ #undef Unsorted
+#endif
+// template <---
+// Affects: Should be without side effects.
+#ifdef None
+#ifndef FIXX11H_None
+ #define FIXX11H_None
+
+ const XID XNone = None;
+
+ #undef None
+
+ const XID None = XNone;
+
+ #endif
+ #undef None
+#endif
+// template --->
+// Affects: Should be without side effects.
+#ifdef Bool
+#ifndef FIXX11H_Bool
+ #define FIXX11H_Bool
+ #ifdef _XTYPEDEF_BOOL /* Xdefs.h has typedef'ed Bool already */
+ #undef Bool
+ #else
+
+ typedef Bool XBool;
+
+ #undef Bool
+
+ typedef XBool Bool;
+
+ #endif
+ #endif
+ #undef Bool
+ #define _XTYPEDEF_BOOL
+#endif
+// template <---
+// Affects: Should be without side effects.
+#ifdef KeyPress
+#ifndef FIXX11H_KeyPress
+ #define FIXX11H_KeyPress
+
+ const int XKeyPress = KeyPress;
+
+ #undef KeyPress
+
+ const int KeyPress = XKeyPress;
+
+ #endif
+ #undef KeyPress
+#endif
+// Affects: Should be without side effects.
+#ifdef KeyRelease
+#ifndef FIXX11H_KeyRelease
+ #define FIXX11H_KeyRelease
+
+ const int XKeyRelease = KeyRelease;
+
+ #undef KeyRelease
+
+ const int KeyRelease = XKeyRelease;
+
+ #endif
+ #undef KeyRelease
+#endif
+// Affects: Should be without side effects.
+#ifdef Above
+#ifndef FIXX11H_Above
+ #define FIXX11H_Above
+
+ const int XAbove = Above;
+
+ #undef Above
+
+ const int Above = XAbove;
+
+ #endif
+ #undef Above
+#endif
+// Affects: Should be without side effects.
+#ifdef Below
+#ifndef FIXX11H_Below
+ #define FIXX11H_Below
+
+ const int XBelow = Below;
+
+ #undef Below
+
+ const int Below = XBelow;
+
+ #endif
+ #undef Below
+#endif
+// Affects: Should be without side effects.
+#ifdef FocusIn
+#ifndef FIXX11H_FocusIn
+ #define FIXX11H_FocusIn
+
+ const int XFocusIn = FocusIn;
+
+ #undef FocusIn
+
+ const int FocusIn = XFocusIn;
+
+ #endif
+ #undef FocusIn
+#endif
+// Affects: Should be without side effects.
+#ifdef FocusOut
+#ifndef FIXX11H_FocusOut
+ #define FIXX11H_FocusOut
+
+ const int XFocusOut = FocusOut;
+
+ #undef FocusOut
+
+ const int FocusOut = XFocusOut;
+
+ #endif
+ #undef FocusOut
+#endif
+// Affects: Should be without side effects.
+#ifdef Always
+#ifndef FIXX11H_Always
+ #define FIXX11H_Always
+
+ const int XAlways = Always;
+
+ #undef Always
+
+ const int Always = XAlways;
+
+ #endif
+ #undef Always
+#endif
+// Affects: Should be without side effects.
+#ifdef Expose
+#ifndef FIXX11H_Expose
+ #define FIXX11H_Expose
+
+ const int XExpose = Expose;
+
+ #undef Expose
+
+ const int Expose = XExpose;
+
+ #endif
+ #undef Expose
+#endif
+// Affects: Should be without side effects.
+#ifdef Success
+#ifndef FIXX11H_Success
+ #define FIXX11H_Success
+
+ const int XSuccess = Success;
+
+ #undef Success
+
+ const int Success = XSuccess;
+
+ #endif
+ #undef Success
+#endif
+// Affects: Should be without side effects.
+#ifdef GrayScale
+#ifndef FIXX11H_GrayScale
+ #define FIXX11H_GrayScale
+
+ const int XGrayScale = GrayScale;
+
+ #undef GrayScale
+
+ const int GrayScale = XGrayScale;
+
+ #endif
+ #undef GrayScale
+#endif
+// Affects: Should be without side effects.
+#ifdef Status
+#ifndef FIXX11H_Status
+ #define FIXX11H_Status
+
+ typedef Status XStatus;
+
+ #undef Status
+
+ typedef XStatus Status;
+
+ #endif
+ #undef Status
+#endif
+// template --->
+// Affects: Should be without side effects.
+#ifdef CursorShape
+#ifndef FIXX11H_CursorShape
+ #define FIXX11H_CursorShape
+
+ const int XCursorShape = CursorShape;
+
+ #undef CursorShape
+
+ const int CursorShape = XCursorShape;
+
+ #endif
+ #undef CursorShape
+#endif
+// template <---
+// template --->
+// Affects: Should be without side effects.
+#ifdef FontChange
+#ifndef FIXX11H_FontChange
+ #define FIXX11H_FontChange
+
+ const int XFontChange = FontChange;
+
+ #undef FontChange
+
+ const int FontChange = XFontChange;
+
+ #endif
+ #undef FontChange
+#endif
+// template <---
+// Affects: Should be without side effects.
+#ifdef NormalState
+#ifndef FIXX11H_NormalState
+ #define FIXX11H_NormalState
+ const int XNormalState = NormalState;
+ #undef NormalState
+ const int NormalState = XNormalState;
+ #endif
+ #undef NormalState
+#endif
+// template --->
+// Affects: Should be without side effects.
+#ifdef index
+#ifndef FIXX11H_index
+ #define FIXX11H_index
+ inline
+ const char *Xindex(const char *s, int c)
+ {
+ return index(s, c);
+ }
+ #undef index
+ inline
+ const char *index(const char *s, int c)
+ {
+ return Xindex(s, c);
+ }
+ #endif
+ #undef index
+#endif
+// template <---
+#ifdef rindex
+// Affects: Should be without side effects.
+ #ifndef FIXX11H_rindex
+ #define FIXX11H_rindex
+ inline
+ const char *Xrindex(const char *s, int c)
+ {
+ return rindex(s, c);
+ }
+ #undef rindex
+ inline
+ const char *rindex(const char *s, int c)
+ {
+ return Xrindex(s, c);
+ }
+ #endif
+ #undef rindex
+#endif
+}
+using namespace X;
\ No newline at end of file
diff --git a/tools/screenshot.cpp b/tools/screenshot.cpp
index 21e5eba..4deaae7 100644
--- a/tools/screenshot.cpp
+++ b/tools/screenshot.cpp
@@ -1,524 +1,525 @@
/*
* Copyright (C) 2017 Christian Kaiser
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <QApplication>
#include <QClipboard>
#include <QDateTime>
#include <QDesktopWidget>
#include <QFileDialog>
#include <QPainter>
#include <QPixmap>
#include <QProcess>
#include <QTextStream>
#include <QScreen>
#include <QStringBuilder>
#include <tools/screenshot.h>
#include <tools/screenshotmanager.h>
#include <tools/windowpicker.h>
#include <tools/uploader/uploader.h>
#include <dialogs/areadialog.h>
#include <tools/os.h>
#ifdef Q_OS_WIN
#include <windows.h>
#endif
#ifdef Q_OS_LINUX
#include <QX11Info>
#include <X11/X.h>
#include <X11/Xlib.h>
+ #include <tools/fixx11h.h>
#endif
Screenshot::Screenshot(QObject *parent, Screenshot::Options options):
QObject(parent),
mOptions(options),
mPixmapDelay(false),
mUnloaded(false),
mUnloadFilename()
{
if (mOptions.format == Screenshot::PNG) {
mOptions.quality = 80;
}
}
Screenshot::~Screenshot()
{
if (!mUnloadFilename.isEmpty()) {
QFile::remove(mUnloadFilename);
}
}
QString Screenshot::getName(const NamingOptions &options, const QString &prefix, const QDir &directory)
{
QString naming;
int naming_largest = 0;
if (options.flip) {
naming = "%1" % prefix;
} else {
naming = prefix % "%1";
}
switch (options.naming) {
case Screenshot::Numeric: // Numeric
// Iterating through the folder to find the largest numeric naming.
for (auto file : directory.entryList(QDir::Files)) {
if (file.contains(prefix)) {
file.chop(file.size() - file.lastIndexOf("."));
file.remove(prefix);
if (file.toInt() > naming_largest) {
naming_largest = file.toInt();
}
}
}
if (options.leadingZeros > 0) {
//Pretty, huh?
QString format;
QTextStream(&format) << "%0" << (options.leadingZeros + 1) << "d";
naming = naming.arg(QString().sprintf(format.toLatin1(), naming_largest + 1));
} else {
naming = naming.arg(naming_largest + 1);
}
break;
case Screenshot::Date: // Date
naming = naming.arg(QLocale().toString(QDateTime::currentDateTime(), options.dateFormat));
break;
case Screenshot::Timestamp: // Timestamp
naming = naming.arg(QDateTime::currentDateTime().toTime_t());
break;
case Screenshot::Empty:
naming = naming.arg("");
break;
}
return naming;
}
const QString &Screenshot::unloadedFileName()
{
return mUnloadFilename;
}
const Screenshot::Options &Screenshot::options()
{
return mOptions;
}
QPixmap &Screenshot::pixmap()
{
return mPixmap;
}
//
void Screenshot::confirm(bool result)
{
if (result) {
save();
} else {
mOptions.result = Screenshot::Cancel;
emit finished();
}
emit cleanup();
mPixmap = QPixmap();
}
void Screenshot::confirmation()
{
emit askConfirmation();
if (mOptions.file) {
unloadPixmap();
}
}
void Screenshot::discard()
{
confirm(false);
}
void Screenshot::markUpload()
{
mOptions.upload = true;
}
void Screenshot::optimize()
{
QProcess *process = new QProcess(this);
// Delete the QProcess once it's done.
connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this , SLOT(optimizationDone()));
connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), process, SLOT(deleteLater()));
QString optiPNG;
#ifdef Q_OS_UNIX
optiPNG = "optipng";
#else
optiPNG = qApp->applicationDirPath() % QDir::separator() % "optipng.exe";
#endif
if (!QFile::exists(optiPNG)) {
emit optimizationDone();
}
process->start(optiPNG, QStringList() << mOptions.fileName);
if (process->state() == QProcess::NotRunning) {
emit optimizationDone();
process->deleteLater();
}
}
void Screenshot::optimizationDone()
{
if (mOptions.upload) {
upload();
} else {
emit finished();
}
}
void Screenshot::save()
{
QString name = "";
QString fileName = "";
Screenshot::Result result = Screenshot::Failure;
if (mOptions.file && !mOptions.saveAs) {
name = newFileName();
} else if (mOptions.file && mOptions.saveAs) {
name = QFileDialog::getSaveFileName(0, tr("Save as.."), newFileName(), "*" % extension());
}
if (!mOptions.replace && QFile::exists(name % extension())) {
// Ugly? You should see my wife!
int count = 0;
int cunt = 0;
QString naming = QFileInfo(name).fileName();
for (auto file : QFileInfo(name % extension()).dir().entryList(QDir::Files)) {
if (file.contains(naming)) {
file.remove(naming);
file.remove(" (");
file.remove(")");
file.remove(extension());
cunt = file.toInt();
if (cunt > count) {
count = cunt;
}
}
}
name = name % " (" % QString::number(count % 1) % ")";
}
if (mOptions.clipboard && !(mOptions.upload && mOptions.urlClipboard)) {
if (mUnloaded) {
mUnloaded = false;
mPixmap = QPixmap(mUnloadFilename);
}
QApplication::clipboard()->setPixmap(mPixmap, QClipboard::Clipboard);
if (!mOptions.file) {
result = Screenshot::Success;
}
}
if (mOptions.file) {
fileName = name % extension();
if (name.isEmpty()) {
result = Screenshot::Cancel;
} else if (mUnloaded) {
result = (QFile::rename(mUnloadFilename, fileName)) ? Screenshot::Success : Screenshot::Failure;
} else if (mPixmap.save(fileName, 0, mOptions.quality)) {
result = Screenshot::Success;
} else {
result = Screenshot::Failure;
}
}
mOptions.fileName = fileName;
mOptions.result = result;
if (!mOptions.result) {
emit finished();
}
if (mOptions.format == Screenshot::PNG && mOptions.optimize && mOptions.file) {
if (!mOptions.upload) {
ScreenshotManager::instance()->saveHistory(mOptions.fileName);
}
optimize();
} else if (mOptions.upload) {
upload();
} else if (mOptions.file) {
ScreenshotManager::instance()->saveHistory(mOptions.fileName);
emit finished();
} else {
emit finished();
}
}
void Screenshot::setPixmap(const QPixmap &pixmap)
{
mPixmap = pixmap;
if (mPixmap.isNull()) {
emit confirm(false);
} else {
confirmation();
}
}
void Screenshot::take()
{
switch (mOptions.mode) {
case Screenshot::WholeScreen:
wholeScreen();
break;
case Screenshot::SelectedArea:
selectedArea();
break;
case Screenshot::ActiveWindow:
activeWindow();
break;
case Screenshot::SelectedWindow:
selectedWindow();
break;
}
if (mPixmapDelay) {
return;
}
if (mPixmap.isNull()) {
confirm(false);
} else {
confirmation();
}
}
void Screenshot::upload()
{
if (mOptions.file) {
Uploader::instance()->upload(mOptions.fileName, mOptions.uploadService);
} else if (unloadPixmap()) {
Uploader::instance()->upload(mUnloadFilename, mOptions.uploadService);
} else {
emit finished();
}
}
void Screenshot::uploadDone(const QString &url)
{
if (mOptions.urlClipboard && !url.isEmpty()) {
QApplication::clipboard()->setText(url, QClipboard::Clipboard);
}
emit finished();
}
void Screenshot::refresh()
{
grabDesktop();
}
//
void Screenshot::activeWindow()
{
#ifdef Q_OS_WIN
HWND fWindow = GetForegroundWindow();
if (fWindow == NULL) {
return;
}
if (fWindow == GetDesktopWindow()) {
wholeScreen();
return;
}
mPixmap = os::grabWindow((WId)GetForegroundWindow());
#endif
#if defined(Q_OS_LINUX)
Window focus;
int revert;
XGetInputFocus(QX11Info::display(), &focus, &revert);
mPixmap = QPixmap::grabWindow(focus);
#endif
}
const QString Screenshot::extension() const
{
switch (mOptions.format) {
case Screenshot::PNG:
return QStringLiteral(".png");
break;
case Screenshot::BMP:
return QStringLiteral(".bmp");
break;
case Screenshot::WEBP:
return QStringLiteral(".webp");
break;
case Screenshot::JPEG:
return QStringLiteral(".jpg");
break;
}
}
void Screenshot::grabDesktop()
{
QRect geometry;
QPoint cursorPosition = QCursor::pos();
if (mOptions.currentMonitor) {
int currentScreen = qApp->desktop()->screenNumber(cursorPosition);
geometry = qApp->desktop()->screen(currentScreen)->geometry();
cursorPosition = cursorPosition - geometry.topLeft();
} else {
int top = 0;
for (QScreen *screen : QGuiApplication::screens()) {
auto screenRect = screen->geometry();
if (screenRect.top() < 0) {
top += screenRect.top() * -1;
}
if (screenRect.left() < 0) {
cursorPosition.setX(cursorPosition.x() + screenRect.width()); //= localCursorPos + screenRect.normalized().topLeft();
}
geometry = geometry.united(screenRect);
}
cursorPosition.setY(cursorPosition.y() + top);
}
mPixmap = QApplication::primaryScreen()->grabWindow(QApplication::desktop()->winId(), geometry.x(), geometry.y(), geometry.width(), geometry.height());
mPixmap.setDevicePixelRatio(QApplication::desktop()->devicePixelRatio());
if (mOptions.cursor && !mPixmap.isNull()) {
QPainter painter(&mPixmap);
auto cursorInfo = os::cursor();
auto cursorPixmap = cursorInfo.first;
cursorPixmap.setDevicePixelRatio(QApplication::desktop()->devicePixelRatio());
#if 0 // Debug cursor position helper
painter.setBrush(QBrush(Qt::darkRed));
painter.setPen(QPen(QBrush(Qt::red), 5));
QRectF rect;
rect.setSize(QSizeF(100, 100));
rect.moveCenter(cursorPosition);
painter.drawRoundRect(rect, rect.size().height()*2, rect.size().height()*2);
#endif
painter.drawPixmap(cursorPosition-cursorInfo.second, cursorPixmap);
}
}
const QString Screenshot::newFileName() const
{
if (!mOptions.directory.exists()) {
mOptions.directory.mkpath(mOptions.directory.path());
}
QString naming = Screenshot::getName(mOptions.namingOptions, mOptions.prefix, mOptions.directory);
QString path = QDir::toNativeSeparators(mOptions.directory.path());
// Cleanup
if (path.at(path.size() - 1) != QDir::separator() && !path.isEmpty()) {
path.append(QDir::separator());
}
QString fileName;
fileName.append(path);
fileName.append(naming);
return fileName;
}
void Screenshot::selectedArea()
{
grabDesktop();
if (mPixmap.isNull()) {
return;
}
AreaDialog selector(this);
int result = selector.exec();
if (result == QDialog::Accepted) {
mPixmap = mPixmap.copy(selector.resultRect());
} else {
mPixmap = QPixmap();
}
}
void Screenshot::selectedWindow()
{
WindowPicker *windowPicker = new WindowPicker;
mPixmapDelay = true;
connect(windowPicker, SIGNAL(pixmap(QPixmap)), this, SLOT(setPixmap(QPixmap)));
}
bool Screenshot::unloadPixmap()
{
if (mUnloaded) {
return true;
}
// Unloading the pixmap to reduce memory usage during previews
mUnloadFilename = QString("%1/.screenshot.%2%3").arg(mOptions.directory.path()).arg(qrand() * qrand() + QDateTime::currentDateTime().toTime_t()).arg(extension());
mUnloaded = mPixmap.save(mUnloadFilename, 0, mOptions.quality);
if (mUnloaded) {
mPixmap = QPixmap();
}
return mUnloaded;
}
void Screenshot::wholeScreen()
{
grabDesktop();
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Wed, Sep 10, 3:13 PM (4 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42599
Default Alt Text
(23 KB)
Attached To
Mode
R63 darkscreen
Attached
Detach File
Event Timeline
Log In to Comment