Reduce dependence on D-Bus (#2003)
* Handle captures without sigslots Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Set {app,organization}Name and version consistently Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Make 'full' dbus-free Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Move CaptureRequest::exportCapture to Controller We need to wait until the upload widget (or similar widgets) have finished before exiting. This must be done using a signal. The problem is that CaptureRequest can't be guaranteed to survive until the widget has finished what it's doing. Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Use QApplication with the 'full' subcommand Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Do unto 'screen' as we did to 'full' Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add FlameshotDaemon singleton class Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Support clipboard hosting for both pixmaps and text * Fix upload handling Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Do not show tray icon if not daemon Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Clean up handling of pin task Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove annoying Qt warning messages The messages were caused by the color wheel. Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix small bug in Controller::exportCapture * Fix --raw output * Make 'gui' dbus-independent Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix accept on select bug Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix compile error on Windows Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Make it work on Windows * Remove obsolete function in main.cpp Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Make 'launcher' work without dbus Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * clang-format, sigh Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Enable CLI parsing on MacOS Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Make 'config' work without dbus Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Small refactor of capture request handling Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove obsolete DBusUtils Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove unused D-Bus sigslots Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove D-Bus methods openConfig, autostartEnabled and trayIconEnabled Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove D-Bus method requestCapture Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove CaptureRequest id mechanism Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix 'launcher' crash Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Handle clipboard notifications properly Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add 'autoCloseIdleDaemon' option Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Document FlameshotDaemon class Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Make 'flameshot gui' run in single-application mode Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add `allowmultipleGuiInstances` config option Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix endless loop with multiple GUI instances Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Move upload confirmation dialog where it belongs Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add the new config options to the GUI as well Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix failing build on Windows Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Handle persistence on MacOS Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * fixed notifications on macos * Fixed display on macos * Reformat tests/action_options.sh Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix infinite recursion in tests/action_options.sh Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> Co-authored-by: Dearsh Oberoi <59907159+deo002@users.noreply.github.com> Co-authored-by: Jeremy Borgman <borgman.jeremy@pm.me>
This commit is contained in:
@@ -49,10 +49,10 @@ CaptureTool* AcceptTool::copy(QObject* parent)
|
||||
void AcceptTool::pressed(CaptureContext& context)
|
||||
{
|
||||
emit requestAction(REQ_CAPTURE_DONE_OK);
|
||||
if (context.request()->tasks() & CaptureRequest::PIN) {
|
||||
if (context.request.tasks() & CaptureRequest::PIN) {
|
||||
QRect geometry = context.selection;
|
||||
geometry.moveTopLeft(geometry.topLeft() + context.widgetOffset);
|
||||
context.request()->addPinTask(geometry);
|
||||
context.request.addTask(CaptureRequest::PIN);
|
||||
}
|
||||
emit requestAction(REQ_CLOSE_GUI);
|
||||
}
|
||||
|
||||
@@ -14,13 +14,3 @@ QPixmap CaptureContext::selectedScreenshotArea() const
|
||||
return screenshot.copy(selection);
|
||||
}
|
||||
}
|
||||
|
||||
CaptureRequest* CaptureContext::request()
|
||||
{
|
||||
return &*Controller::getInstance()->requests().find(requestId);
|
||||
}
|
||||
|
||||
CaptureRequest* CaptureContext::request() const
|
||||
{
|
||||
return &*Controller::getInstance()->requests().find(requestId);
|
||||
}
|
||||
|
||||
@@ -29,9 +29,7 @@ struct CaptureContext
|
||||
int toolSize;
|
||||
// Mode of the capture widget
|
||||
bool fullscreen;
|
||||
uint requestId;
|
||||
CaptureRequest request = CaptureRequest::GRAPHICAL_MODE;
|
||||
|
||||
QPixmap selectedScreenshotArea() const;
|
||||
CaptureRequest* request();
|
||||
CaptureRequest* request() const;
|
||||
};
|
||||
|
||||
@@ -41,7 +41,7 @@ CaptureTool* CopyTool::copy(QObject* parent)
|
||||
|
||||
void CopyTool::pressed(CaptureContext& context)
|
||||
{
|
||||
context.request()->addTask(CaptureRequest::COPY);
|
||||
context.request.addTask(CaptureRequest::COPY);
|
||||
emit requestAction(REQ_CAPTURE_DONE_OK);
|
||||
emit requestAction(REQ_CLOSE_GUI);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,6 @@ CaptureTool* ImgUploaderTool::copy(QObject* parent)
|
||||
void ImgUploaderTool::pressed(CaptureContext& context)
|
||||
{
|
||||
emit requestAction(REQ_CAPTURE_DONE_OK);
|
||||
context.request()->addTask(CaptureRequest::UPLOAD);
|
||||
context.request.addTask(CaptureRequest::UPLOAD);
|
||||
emit requestAction(REQ_CLOSE_GUI);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors
|
||||
|
||||
#include "imguploaderbase.h"
|
||||
#include "src/core/flameshotdaemon.h"
|
||||
#include "src/utils/confighandler.h"
|
||||
#include "src/utils/globalvalues.h"
|
||||
#include "src/utils/history.h"
|
||||
@@ -9,6 +10,7 @@
|
||||
#include "src/widgets/loadspinner.h"
|
||||
#include "src/widgets/notificationwidget.h"
|
||||
#include <QApplication>
|
||||
// FIXME #include <QBuffer>
|
||||
#include <QClipboard>
|
||||
#include <QCursor>
|
||||
#include <QDesktopServices>
|
||||
@@ -157,13 +159,13 @@ void ImgUploaderBase::openURL()
|
||||
|
||||
void ImgUploaderBase::copyURL()
|
||||
{
|
||||
QApplication::clipboard()->setText(m_imageURL.toString());
|
||||
FlameshotDaemon::copyToClipboard(m_imageURL.toString());
|
||||
m_notification->showMessage(tr("URL copied to clipboard."));
|
||||
}
|
||||
|
||||
void ImgUploaderBase::copyImage()
|
||||
{
|
||||
QApplication::clipboard()->setPixmap(m_pixmap);
|
||||
FlameshotDaemon::copyToClipboard(m_pixmap);
|
||||
m_notification->showMessage(tr("Screenshot copied to clipboard."));
|
||||
}
|
||||
|
||||
@@ -173,4 +175,4 @@ void ImgUploaderBase::deleteCurrentImage()
|
||||
HISTORY_FILE_NAME unpackFileName =
|
||||
history.unpackFileName(m_currentImageName);
|
||||
deleteImage(unpackFileName.file, unpackFileName.token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,6 @@ CaptureTool* PinTool::copy(QObject* parent)
|
||||
void PinTool::pressed(CaptureContext& context)
|
||||
{
|
||||
emit requestAction(REQ_CAPTURE_DONE_OK);
|
||||
QRect geometry = context.selection;
|
||||
geometry.setTopLeft(geometry.topLeft() + context.widgetOffset);
|
||||
context.request()->addPinTask(geometry);
|
||||
context.request.addTask(CaptureRequest::PIN);
|
||||
emit requestAction(REQ_CLOSE_GUI);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ CaptureTool* SaveTool::copy(QObject* parent)
|
||||
|
||||
void SaveTool::pressed(CaptureContext& context)
|
||||
{
|
||||
context.request()->addSaveTask();
|
||||
context.request.addSaveTask();
|
||||
emit requestAction(REQ_CAPTURE_DONE_OK);
|
||||
emit requestAction(REQ_CLOSE_GUI);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user