Fix flameshot not exiting when it should (#2223)

* Remove unused methods from Controller

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix flameshot exit bug

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove unnecessary code

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Some more refactoring

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
This commit is contained in:
Haris Gušić
2022-01-04 15:02:06 +01:00
committed by GitHub
parent 179f658cd8
commit 883e55c52d
5 changed files with 4 additions and 22 deletions

View File

@@ -69,7 +69,6 @@ Controller::Controller()
#endif
{
m_appLatestVersion = QStringLiteral(APP_VERSION).replace("v", "");
qApp->setQuitOnLastWindowClosed(false);
QString StyleSheet = CaptureButton::globalStyleSheet();
qApp->setStyleSheet(StyleSheet);
@@ -134,11 +133,6 @@ void Controller::setCheckForUpdatesEnabled(const bool enabled)
}
}
QMap<uint, CaptureRequest>& Controller::requests()
{
return m_requestMap;
}
void Controller::getLatestAvailableVersion()
{
// This features is required for MacOS and Windows user and for Linux users
@@ -535,13 +529,6 @@ void Controller::sendTrayNotification(const QString& text,
}
}
void Controller::updateConfigComponents()
{
if (m_configWindow) {
m_configWindow->updateChildren();
}
}
void Controller::showRecentUploads()
{
static HistoryWidget* historyWidget = nullptr;

View File

@@ -33,14 +33,8 @@ class Controller : public QObject
public:
static Controller* getInstance();
Controller(const Controller&) = delete;
~Controller();
void operator=(const Controller&) = delete;
void setCheckForUpdatesEnabled(const bool enabled);
QMap<uint, CaptureRequest>& requests();
signals:
// TODO remove all parameters from captureTaken and update dependencies
void captureTaken(QPixmap p, const QRect& selection);
@@ -62,8 +56,6 @@ public slots:
const QString& title = QStringLiteral("Flameshot Info"),
const int timeout = 5000);
void updateConfigComponents();
void showRecentUploads();
void exportCapture(QPixmap p, QRect& selection, const CaptureRequest& req);
@@ -84,6 +76,7 @@ public slots: // TODO move these up
private:
Controller();
~Controller();
void getLatestAvailableVersion();
// replace QTimer::singleShot introduced in Qt 5.4
@@ -96,7 +89,6 @@ private:
QString m_appLatestVersion;
bool m_showCheckAppUpdateStatus;
QMap<uint, CaptureRequest> m_requestMap;
QPointer<CaptureWidget> m_captureWindow;
QPointer<InfoWindow> m_infoWindow;
QPointer<CaptureLauncher> m_launcherWindow;

View File

@@ -68,6 +68,7 @@ void FlameshotDaemon::start()
{
if (!m_instance) {
m_instance = new FlameshotDaemon();
qApp->setQuitOnLastWindowClosed(false);
}
}

View File

@@ -84,6 +84,7 @@ CaptureWidget::CaptureWidget(const CaptureRequest& req,
this,
&CaptureWidget::childLeave);
setAttribute(Qt::WA_DeleteOnClose);
setAttribute(Qt::WA_QuitOnClose, false);
m_opacity = m_config.contrastOpacity();
m_uiColor = m_config.uiColor();
m_contrastUiColor = m_config.contrastUiColor();

View File

@@ -22,6 +22,7 @@
CaptureLauncher::CaptureLauncher(QDialog* parent)
: QDialog(parent)
{
qApp->installEventFilter(this); // see eventFilter()
setAttribute(Qt::WA_DeleteOnClose);
setWindowIcon(QIcon(GlobalValues::iconPath()));
m_imageLabel = new ImageLabel(this);