Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions flameshot.example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@
;; (This option is not available on Windows)
;useJpgForClipboard=false
;
;; [Deprecated] Use legacy Qt X11 screenshot method instead of freedesktop
;; portal. Enable this if your WM has no xdg-desktop-portal (e.g. xmonad, i3).
;; Only effective on X11; ignored on Wayland. (bool)
;; (This option is only available on Linux)
;useX11LegacyScreenshot=false
;
;; Upload to imgur without confirmation (bool)
;uploadWithoutConfirmation=false
;
Expand Down
49 changes: 5 additions & 44 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,50 +174,11 @@
${QM_FILES}
main.cpp)

target_include_directories(
flameshot
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../dbus/>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cli>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/config>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/core>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/arrow>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/pixelate>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/circle>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/circlecount>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/copy>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/exit>
if(ENABLE_IMGUR)
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/imgur>
endif()
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/launcher>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/line>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/marker>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/move>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/pencil>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/pin>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/rectangle>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/redo>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/save>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/invert>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/selection>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/sizeindicator>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/text>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/undo>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/sizeincrease>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/sizedecrease>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/utils>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/widgets>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/widgets/panel>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/widgets/capture>
$<INSTALL_INTERFACE:include/mylib>)
target_include_directories(
flameshot
PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/>
)

target_include_directories(flameshot PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/> # src/
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/>
)

target_link_libraries(
flameshot
Expand Down Expand Up @@ -294,7 +255,7 @@
endif ()

if (NOT USE_OPENSSL)
message(WARNING "OpenSSL is required to upload screenshots")

Check warning on line 258 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2022 x64-portable

OpenSSL is required to upload screenshots

Check warning on line 258 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2022 x64-installer

OpenSSL is required to upload screenshots

Check warning on line 258 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2022 x64-installer

OpenSSL is required to upload screenshots

Check warning on line 258 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2022 x64-portable

OpenSSL is required to upload screenshots
endif ()

target_link_libraries(
Expand Down Expand Up @@ -474,7 +435,7 @@
FILES_MATCHING
PATTERN "*.dll")
else ()
message(WARNING "Unable to find OpenSSL dlls.")

Check warning on line 438 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2022 x64-portable

Unable to find OpenSSL dlls.

Check warning on line 438 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2022 x64-installer

Unable to find OpenSSL dlls.

Check warning on line 438 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2022 x64-installer

Unable to find OpenSSL dlls.

Check warning on line 438 in src/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / VS 2022 x64-portable

Unable to find OpenSSL dlls.
endif ()
endif ()

Expand Down
4 changes: 2 additions & 2 deletions src/cli/commandlineparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors

#include "commandlineparser.h"
#include "abstractlogger.h"
#include "src/utils/globalvalues.h"
#include "utils/abstractlogger.h"
#include "utils/globalvalues.h"
#include <QApplication>
#include <QTextStream>

Expand Down
4 changes: 2 additions & 2 deletions src/cli/commandlineparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#pragma once

#include "src/cli/commandargument.h"
#include "src/cli/commandoption.h"
#include "cli/commandargument.h"
#include "cli/commandoption.h"
#include <QMap>

class CommandLineParser
Expand Down
5 changes: 3 additions & 2 deletions src/config/buttonlistview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors

#include "buttonlistview.h"
#include "src/tools/toolfactory.h"
#include "src/utils/confighandler.h"
#include "tools/toolfactory.h"
#include "utils/confighandler.h"

#include <QListWidgetItem>
#include <algorithm>

Expand Down
2 changes: 1 addition & 1 deletion src/config/buttonlistview.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#pragma once

#include "src/widgets/capture/capturetoolbutton.h"
#include "widgets/capture/capturetoolbutton.h"
#include <QListWidget>

class ButtonListView : public QListWidget
Expand Down
5 changes: 1 addition & 4 deletions src/config/cacheutils.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2021 Jeremy Borgman

#ifndef FLAMESHOT_CACHEUTILS_H
#define FLAMESHOT_CACHEUTILS_H
#pragma once

class QString;
class QRect;

QString getCachePath();
QRect getLastRegion();
void setLastRegion(QRect const& newRegion);

#endif // FLAMESHOT_CACHEUTILS_H
4 changes: 2 additions & 2 deletions src/config/colorpickereditmode.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#pragma once

#include "src/utils/confighandler.h"
#include "src/widgets/colorpickerwidget.h"
#include "utils/confighandler.h"
#include "widgets/colorpickerwidget.h"

class ColorPickerEditMode : public ColorPickerWidget
{
Expand Down
4 changes: 2 additions & 2 deletions src/config/colorpickereditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-FileCopyrightText: 2022 Dearsh Oberoi

#include "colorpickereditor.h"
#include "colorpickereditmode.h"
#include "src/utils/globalvalues.h"
#include "config/colorpickereditmode.h"
#include "utils/globalvalues.h"

#include <QApplication>
#include <QColor>
Expand Down
2 changes: 1 addition & 1 deletion src/config/colorpickereditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#pragma once

#include "QtColorWidgets/color_wheel.hpp"
#include "src/utils/confighandler.h"
#include "utils/confighandler.h"

#include <QWidget>

Expand Down
7 changes: 3 additions & 4 deletions src/config/configerrordetails.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "src/config/configerrordetails.h"

#include "src/utils/abstractlogger.h"
#include "src/utils/confighandler.h"
#include "configerrordetails.h"
#include "utils/abstractlogger.h"
#include "utils/confighandler.h"

#include <QApplication>
#include <QDialogButtonBox>
Expand Down
4 changes: 2 additions & 2 deletions src/config/configerrordetails.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <QDialog>

#pragma once

#include <QDialog>

class ConfigErrorDetails : public QDialog
{
public:
Expand Down
7 changes: 3 additions & 4 deletions src/config/configresolver.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include "src/config/configresolver.h"
#include "src/config/configerrordetails.h"
#include "src/utils/confighandler.h"
#include "configresolver.h"
#include "config/configerrordetails.h"
#include "utils/confighandler.h"

#include "src/utils/valuehandler.h"
#include <QDialogButtonBox>
#include <QLabel>
#include <QSplitter>
Expand Down
21 changes: 10 additions & 11 deletions src/config/configwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors

#include "configwindow.h"
#include "abstractlogger.h"
#include "src/config/configresolver.h"
#include "src/config/filenameeditor.h"
#include "src/config/generalconf.h"
#include "src/config/shortcutswidget.h"
#include "src/config/strftimechooserwidget.h"
#include "src/config/visualseditor.h"
#include "src/utils/colorutils.h"
#include "src/utils/confighandler.h"
#include "src/utils/globalvalues.h"
#include "src/utils/pathinfo.h"
#include "config/configresolver.h"
#include "config/filenameeditor.h"
#include "config/generalconf.h"
#include "config/shortcutswidget.h"
#include "config/visualseditor.h"
#include "utils/colorutils.h"
#include "utils/confighandler.h"
#include "utils/globalvalues.h"
#include "utils/pathinfo.h"

#include <QApplication>
#include <QDialogButtonBox>
#include <QFileSystemWatcher>
Expand Down
7 changes: 4 additions & 3 deletions src/config/filenameeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors

#include "filenameeditor.h"
#include "src/config/strftimechooserwidget.h"
#include "src/utils/confighandler.h"
#include "src/utils/filenamehandler.h"
#include "config/strftimechooserwidget.h"
#include "utils/confighandler.h"
#include "utils/filenamehandler.h"

#include <QHBoxLayout>
#include <QLabel>
#include <QLineEdit>
Expand Down
37 changes: 34 additions & 3 deletions src/config/generalconf.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors

#include "generalconf.h"
#include "src/core/flameshot.h"
#include "src/utils/confighandler.h"
#include "utils/confighandler.h"

#include <QCheckBox>
#include <QComboBox>
#include <QFile>
Expand Down Expand Up @@ -55,6 +56,9 @@ GeneralConf::GeneralConf(QWidget* parent)
initAntialiasingPinZoom();
initUndoLimit();
initInsecurePixelate();
#if defined(Q_OS_LINUX)
initUseX11LegacyScreenshot();
#endif
#ifdef ENABLE_IMGUR
initCopyAndCloseAfterUpload();
initUploadWithoutConfirmation();
Expand Down Expand Up @@ -123,6 +127,9 @@ void GeneralConf::_updateComponents(bool allowEmptySavePath)
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
m_showTray->setChecked(!config.disabledTrayIcon());
#endif
#if defined(Q_OS_LINUX)
m_useX11LegacyScreenshot->setChecked(config.useX11LegacyScreenshot());
#endif
}

void GeneralConf::updateComponents()
Expand Down Expand Up @@ -907,4 +914,28 @@ void GeneralConf::setReverseArrow(bool checked)
void GeneralConf::setInsecurePixelate(bool checked)
{
ConfigHandler().setInsecurePixelate(checked);
}
}

#if defined(Q_OS_LINUX)
void GeneralConf::initUseX11LegacyScreenshot()
{
m_useX11LegacyScreenshot =
new QCheckBox(tr("Use legacy X11 screenshot method (deprecated)"), this);
m_useX11LegacyScreenshot->setToolTip(
tr("Bypass the freedesktop portal and use Qt's native X11 screen "
"capture. Enable this if your window manager lacks "
"xdg-desktop-portal (e.g. xmonad, i3). "
"Only effective on X11; ignored on Wayland."));
m_scrollAreaLayout->addWidget(m_useX11LegacyScreenshot);

connect(m_useX11LegacyScreenshot,
&QCheckBox::clicked,
this,
&GeneralConf::useX11LegacyScreenshotChanged);
}

void GeneralConf::useX11LegacyScreenshotChanged(bool checked)
{
ConfigHandler().setUseX11LegacyScreenshot(checked);
}
#endif
9 changes: 9 additions & 0 deletions src/config/generalconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ private slots:
void setJpegQuality(int v);
void setReverseArrow(bool checked);
void setInsecurePixelate(bool checked);
#if defined(Q_OS_LINUX)
void useX11LegacyScreenshotChanged(bool checked);
#endif

private:
const QString chooseFolder(const QString& currentPath = "");
Expand Down Expand Up @@ -99,6 +102,9 @@ private slots:
void initJpegQuality();
void initReverseArrow();
void initInsecurePixelate();
#if defined(Q_OS_LINUX)
void initUseX11LegacyScreenshot();
#endif

void _updateComponents(bool allowEmptySavePath);

Expand Down Expand Up @@ -147,4 +153,7 @@ private slots:
QSpinBox* m_jpegQuality;
QCheckBox* m_reverseArrow;
QCheckBox* m_insecurePixelate;
#if defined(Q_OS_LINUX)
QCheckBox* m_useX11LegacyScreenshot;
#endif
};
3 changes: 2 additions & 1 deletion src/config/setshortcutwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// SPDX-FileCopyrightText: 2020 Yurii Puchkov at Namecheap & Contributors

#include "setshortcutwidget.h"
#include "src/utils/globalvalues.h"
#include "utils/globalvalues.h"

#include <QIcon>
#include <QKeyEvent>
#include <QLabel>
Expand Down
5 changes: 1 addition & 4 deletions src/config/setshortcutwidget.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2020 Yurii Puchkov at Namecheap & Contributors

#ifndef SETSHORTCUTWIDGET_H
#define SETSHORTCUTWIDGET_H
#pragma once

#include <QDialog>
#include <QKeySequence>
Expand Down Expand Up @@ -33,5 +32,3 @@ private slots:
QString m_modifier;
QKeySequence m_ks;
};

#endif // SETSHORTCUTWIDGET_H
11 changes: 6 additions & 5 deletions src/config/shortcutswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// SPDX-FileCopyrightText: 2020 Yurii Puchkov at Namecheap & Contributors

#include "shortcutswidget.h"
#include "capturetool.h"
#include "setshortcutwidget.h"
#include "src/core/qguiappcurrentscreen.h"
#include "src/utils/globalvalues.h"
#include "toolfactory.h"
#include "config/setshortcutwidget.h"
#include "core/qguiappcurrentscreen.h"
#include "tools/capturetool.h"
#include "tools/toolfactory.h"
#include "utils/globalvalues.h"

#include <QCheckBox>
#include <QCursor>
#include <QDir>
Expand Down
8 changes: 3 additions & 5 deletions src/config/shortcutswidget.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2020 Yurii Puchkov at Namecheap & Contributors

#ifndef HOTKEYSCONFIG_H
#define HOTKEYSCONFIG_H
#pragma once

#include "utils/confighandler.h"

#include "src/utils/confighandler.h"
#include <QStringList>
#include <QVector>
#include <QWidget>
Expand Down Expand Up @@ -54,5 +54,3 @@ private slots:
QCheckBox* m_registerMsScreenclip;
#endif
};

#endif // HOTKEYSCONFIG_H
1 change: 1 addition & 0 deletions src/config/strftimechooserwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors

#include "strftimechooserwidget.h"

#include <QGridLayout>
#include <QMap>
#include <QPushButton>
Expand Down
Loading
Loading