Major Controller refactor (#2295)
* Change Controller interface to mimic the CLI Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove obsolete handleCaptureTaken Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Extract system tray icon into separate class The implementation is not complete and full of bugs Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove Controller::handleCaptureFailed Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix a QObject connection Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Controller: remove unused includes Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Make check for updates work again Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Move functionality to daemon and tray icon Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Rename SystemTray to TrayIcon Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add missing trayicon.* files Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add missing QDesktopWidget Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix syntax errors Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add missing include Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Include missing QOperatingSystemVersion on Mac Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Move update checking to daemon Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove obsolete method Controller::doLater Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Some cleanup Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Rename Controller to Flameshot Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Final touches Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "capturelauncher.h"
|
||||
#include "./ui_capturelauncher.h"
|
||||
#include "src/core/controller.h"
|
||||
#include "src/core/flameshot.h"
|
||||
#include "src/utils/globalvalues.h"
|
||||
#include "src/utils/screengrabber.h"
|
||||
#include "src/utils/screenshotsaver.h"
|
||||
@@ -75,19 +75,19 @@ void CaptureLauncher::startCapture()
|
||||
additionalDelayToHideUI +
|
||||
ui->delayTime->value() * secondsToMilliseconds);
|
||||
connectCaptureSlots();
|
||||
Controller::getInstance()->requestCapture(req);
|
||||
Flameshot::instance()->requestCapture(req);
|
||||
}
|
||||
|
||||
void CaptureLauncher::connectCaptureSlots() const
|
||||
{
|
||||
connect(Controller::getInstance(),
|
||||
&Controller::captureTaken,
|
||||
connect(Flameshot::instance(),
|
||||
&Flameshot::captureTaken,
|
||||
this,
|
||||
&CaptureLauncher::captureTaken);
|
||||
connect(Controller::getInstance(),
|
||||
&Controller::captureFailed,
|
||||
&CaptureLauncher::onCaptureTaken);
|
||||
connect(Flameshot::instance(),
|
||||
&Flameshot::captureFailed,
|
||||
this,
|
||||
&CaptureLauncher::captureFailed);
|
||||
&CaptureLauncher::onCaptureFailed);
|
||||
}
|
||||
|
||||
void CaptureLauncher::disconnectCaptureSlots() const
|
||||
@@ -97,17 +97,17 @@ void CaptureLauncher::disconnectCaptureSlots() const
|
||||
// (random number, usually from 1 up to 20).
|
||||
// So now it enables signal on "Capture new screenshot" button and disables
|
||||
// on first success of fail.
|
||||
disconnect(Controller::getInstance(),
|
||||
&Controller::captureTaken,
|
||||
disconnect(Flameshot::instance(),
|
||||
&Flameshot::captureTaken,
|
||||
this,
|
||||
&CaptureLauncher::captureTaken);
|
||||
disconnect(Controller::getInstance(),
|
||||
&Controller::captureFailed,
|
||||
&CaptureLauncher::onCaptureTaken);
|
||||
disconnect(Flameshot::instance(),
|
||||
&Flameshot::captureFailed,
|
||||
this,
|
||||
&CaptureLauncher::captureFailed);
|
||||
&CaptureLauncher::onCaptureFailed);
|
||||
}
|
||||
|
||||
void CaptureLauncher::captureTaken(QPixmap screenshot)
|
||||
void CaptureLauncher::onCaptureTaken(QPixmap screenshot)
|
||||
{
|
||||
// MacOS specific, more details in the function disconnectCaptureSlots()
|
||||
disconnectCaptureSlots();
|
||||
@@ -124,7 +124,7 @@ void CaptureLauncher::captureTaken(QPixmap screenshot)
|
||||
ui->launchButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void CaptureLauncher::captureFailed()
|
||||
void CaptureLauncher::onCaptureFailed()
|
||||
{
|
||||
// MacOS specific, more details in the function disconnectCaptureSlots()
|
||||
disconnectCaptureSlots();
|
||||
@@ -135,4 +135,4 @@ void CaptureLauncher::captureFailed()
|
||||
CaptureLauncher::~CaptureLauncher()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user