mirror of
https://github.com/fergalmoran/flameshot.git
synced 2026-02-01 08:07:07 +00:00
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,6 +49,10 @@ GeneralConf::GeneralConf(QWidget* parent)
|
||||
initSaveAfterCopy();
|
||||
inituploadHistoryMax();
|
||||
initUndoLimit();
|
||||
initAllowMultipleGuiInstances();
|
||||
#if !defined(Q_OS_WIN)
|
||||
initAutoCloseIdleDaemon();
|
||||
#endif
|
||||
|
||||
m_layout->addStretch();
|
||||
|
||||
@@ -73,6 +77,8 @@ void GeneralConf::_updateComponents(bool allowEmptySavePath)
|
||||
m_historyConfirmationToDelete->setChecked(
|
||||
config.historyConfirmationToDelete());
|
||||
m_checkForUpdates->setChecked(config.checkForUpdates());
|
||||
m_allowMultipleGuiInstances->setChecked(config.allowMultipleGuiInstances());
|
||||
m_autoCloseIdleDaemon->setChecked(config.autoCloseIdleDaemon());
|
||||
m_showStartupLaunchMessage->setChecked(config.showStartupLaunchMessage());
|
||||
m_screenshotPathFixedCheck->setChecked(config.savePathFixed());
|
||||
m_uploadHistoryMax->setValue(config.uploadHistoryMax());
|
||||
@@ -106,22 +112,22 @@ void GeneralConf::showDesktopNotificationChanged(bool checked)
|
||||
ConfigHandler().setShowDesktopNotification(checked);
|
||||
}
|
||||
|
||||
void GeneralConf::showTrayIconChanged(bool checked)
|
||||
{
|
||||
auto controller = Controller::getInstance();
|
||||
if (checked) {
|
||||
controller->enableTrayIcon();
|
||||
} else {
|
||||
controller->disableTrayIcon();
|
||||
}
|
||||
}
|
||||
|
||||
void GeneralConf::checkForUpdatesChanged(bool checked)
|
||||
{
|
||||
ConfigHandler().setCheckForUpdates(checked);
|
||||
Controller::getInstance()->setCheckForUpdatesEnabled(checked);
|
||||
}
|
||||
|
||||
void GeneralConf::allowMultipleGuiInstancesChanged(bool checked)
|
||||
{
|
||||
ConfigHandler().setAllowMultipleGuiInstances(checked);
|
||||
}
|
||||
|
||||
void GeneralConf::autoCloseIdleDaemonChanged(bool checked)
|
||||
{
|
||||
ConfigHandler().setAutoCloseIdleDaemon(checked);
|
||||
}
|
||||
|
||||
void GeneralConf::autostartChanged(bool checked)
|
||||
{
|
||||
ConfigHandler().setStartupLaunch(checked);
|
||||
@@ -250,10 +256,9 @@ void GeneralConf::initShowTrayIcon()
|
||||
m_showTray->setToolTip(tr("Show the systemtray icon"));
|
||||
m_scrollAreaLayout->addWidget(m_showTray);
|
||||
|
||||
connect(m_showTray,
|
||||
&QCheckBox::stateChanged,
|
||||
this,
|
||||
&GeneralConf::showTrayIconChanged);
|
||||
connect(m_showTray, &QCheckBox::clicked, this, [](bool checked) {
|
||||
ConfigHandler().setDisabledTrayIcon(!checked);
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -314,6 +319,32 @@ void GeneralConf::initCheckForUpdates()
|
||||
&GeneralConf::checkForUpdatesChanged);
|
||||
}
|
||||
|
||||
void GeneralConf::initAllowMultipleGuiInstances()
|
||||
{
|
||||
m_allowMultipleGuiInstances = new QCheckBox(
|
||||
tr("Allow multiple flameshot GUI instances simultaneously"), this);
|
||||
m_allowMultipleGuiInstances->setToolTip(tr(
|
||||
"This allows you to take screenshots of flameshot itself for example."));
|
||||
m_scrollAreaLayout->addWidget(m_allowMultipleGuiInstances);
|
||||
connect(m_allowMultipleGuiInstances,
|
||||
&QCheckBox::clicked,
|
||||
this,
|
||||
&GeneralConf::allowMultipleGuiInstancesChanged);
|
||||
}
|
||||
|
||||
void GeneralConf::initAutoCloseIdleDaemon()
|
||||
{
|
||||
m_autoCloseIdleDaemon = new QCheckBox(
|
||||
tr("Automatically close daemon when it is not needed"), this);
|
||||
m_autoCloseIdleDaemon->setToolTip(
|
||||
tr("Automatically close daemon when it is not needed"));
|
||||
m_scrollAreaLayout->addWidget(m_autoCloseIdleDaemon);
|
||||
connect(m_autoCloseIdleDaemon,
|
||||
&QCheckBox::clicked,
|
||||
this,
|
||||
&GeneralConf::autoCloseIdleDaemonChanged);
|
||||
}
|
||||
|
||||
void GeneralConf::initAutostart()
|
||||
{
|
||||
m_autostart = new QCheckBox(tr("Launch at startup"), this);
|
||||
|
||||
Reference in New Issue
Block a user