Skip to content

Commit 6d17347

Browse files
整理截图代码实现
1 parent 298bc95 commit 6d17347

25 files changed

+74
-1037
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ set(PROJECT_NAME_CAPITALIZED "FireShot")
1111

1212

1313
option(FLAMESHOT_DEBUG_CAPTURE "Enable mode to make debugging easier" ON)
14-
option(USE_MONOCHROME_ICON "Build using monochrome icon as default" OFF)
1514
option(GENERATE_TS "Regenerate translation source files" OFF)
1615
option(USE_LAUNCHER_ABSOLUTE_PATH "Use absolute path for the desktop launcher" ON)
1716
option(USE_WAYLAND_CLIPBOARD "USE KF Gui Wayland Clipboard" OFF)

data/appdata/org.flameshot.Flameshot.metainfo.xml

Lines changed: 0 additions & 44 deletions
This file was deleted.

data/dbus/org.flameshot.Flameshot.service.in

Lines changed: 0 additions & 3 deletions
This file was deleted.

data/dbus/org.flameshot.Flameshot.xml

Lines changed: 0 additions & 40 deletions
This file was deleted.

data/dbus/org.freedesktop.Notifications.xml

Lines changed: 0 additions & 30 deletions
This file was deleted.

data/desktopEntry/package/org.flameshot.Flameshot.desktop

Lines changed: 0 additions & 44 deletions
This file was deleted.

data/snap/snapcraft.yaml

Lines changed: 0 additions & 108 deletions
This file was deleted.

src/CMakeLists.txt

Lines changed: 4 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,11 @@ endif()
216216
message("Flameshot predefined color palette large: " ${FLAMESHOT_PREDEFINED_COLOR_PALETTE_LARGE})
217217
target_compile_definitions(fireshot PRIVATE PREDEFINED_COLOR_PALETTE_LARGE=${FLAMESHOT_PREDEFINED_COLOR_PALETTE_LARGE})
218218

219+
# 查找git并获取git版本以及当前目录的hash值
219220
find_package (Git)
220221
if (GIT_FOUND)
221222
message("git found: ${GIT_EXECUTABLE} in version ${GIT_VERSION_STRING}")
223+
# git rev-parse --short HEAD
222224
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD OUTPUT_VARIABLE FLAMESHOT_GIT_HASH)
223225
string(REGEX REPLACE "\r*\n$" "" FLAMESHOT_GIT_HASH "${FLAMESHOT_GIT_HASH}")
224226
target_compile_definitions(fireshot PRIVATE FLAMESHOT_GIT_HASH="${FLAMESHOT_GIT_HASH}")
@@ -227,16 +229,15 @@ else()
227229
target_compile_definitions(fireshot PRIVATE FLAMESHOT_GIT_HASH="-")
228230
message("git command is not found")
229231
endif ()
232+
233+
230234
target_compile_definitions(fireshot PRIVATE APP_PREFIX="${CMAKE_INSTALL_PREFIX}")
231235
target_compile_definitions(fireshot PRIVATE APP_VERSION="v${PROJECT_VERSION}")
232236

233237
if (FLAMESHOT_DEBUG_CAPTURE)
234238
target_compile_definitions(fireshot PRIVATE FLAMESHOT_DEBUG_CAPTURE)
235239
endif ()
236240

237-
if (USE_MONOCHROME_ICON)
238-
target_compile_definitions(fireshot PRIVATE USE_MONOCHROME_ICON)
239-
endif ()
240241

241242
foreach (FILE ${QM_FILES})
242243
get_filename_component(F_NAME ${FILE} NAME)
@@ -265,59 +266,6 @@ install(TARGETS fireshot
265266
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
266267
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
267268

268-
if (UNIX)
269-
# Install desktop files, completion and dbus files
270-
configure_file(${CMAKE_SOURCE_DIR}/data/desktopEntry/package/org.fireshot.Flameshot.desktop
271-
${CMAKE_CURRENT_BINARY_DIR}/share/applications/org.fireshot.Flameshot.desktop @ONLY)
272-
273-
configure_file(${CMAKE_SOURCE_DIR}/data/appdata/org.fireshot.Flameshot.metainfo.xml
274-
${CMAKE_CURRENT_BINARY_DIR}/share/metainfo/org.fireshot.Flameshot.metainfo.xml COPYONLY)
275-
276-
configure_file(${CMAKE_SOURCE_DIR}/data/shell-completion/fireshot.bash
277-
${CMAKE_CURRENT_BINARY_DIR}/share/bash-completion/completions/fireshot COPYONLY)
278-
279-
configure_file(${CMAKE_SOURCE_DIR}/data/shell-completion/fireshot.zsh
280-
${CMAKE_CURRENT_BINARY_DIR}/share/zsh/site-functions/_flameshot COPYONLY)
281-
282-
configure_file(${CMAKE_SOURCE_DIR}/data/shell-completion/fireshot.fish
283-
${CMAKE_CURRENT_BINARY_DIR}/share/fish/vendor_completions.d/fireshot.fish COPYONLY)
284-
285-
configure_file(${CMAKE_SOURCE_DIR}/data/dbus/org.fireshot.Flameshot.xml
286-
${CMAKE_CURRENT_BINARY_DIR}/share/dbus-1/interfaces/org.fireshot.Flameshot.xml COPYONLY)
287-
288-
configure_file(${CMAKE_SOURCE_DIR}/data/dbus/org.fireshot.Flameshot.service.in
289-
${CMAKE_CURRENT_BINARY_DIR}/share/dbus-1/services/org.fireshot.Flameshot.service)
290-
291-
# Install man pages
292-
configure_file(${CMAKE_SOURCE_DIR}/data/man/man1/fireshot.1
293-
${CMAKE_CURRENT_BINARY_DIR}/share/man/man1/fireshot.1 COPYONLY)
294-
295-
# Install Icons
296-
configure_file(${CMAKE_SOURCE_DIR}/data/img/hicolor/48x48/apps/org.fireshot.Flameshot.png
297-
${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/48x48/apps/org.fireshot.Flameshot.png COPYONLY)
298-
299-
configure_file(${CMAKE_SOURCE_DIR}/data/img/hicolor/128x128/apps/org.fireshot.Flameshot.png
300-
${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/128x128/apps/org.fireshot.Flameshot.png COPYONLY)
301-
302-
configure_file(${CMAKE_SOURCE_DIR}/data/img/hicolor/scalable/apps/org.fireshot.Flameshot.svg
303-
${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/scalable/apps/org.fireshot.Flameshot.svg COPYONLY)
304-
305-
# Install icon with both names
306-
configure_file(${CMAKE_SOURCE_DIR}/data/img/hicolor/48x48/apps/fireshot.png
307-
${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/48x48/apps/fireshot.png COPYONLY)
308-
309-
configure_file(${CMAKE_SOURCE_DIR}/data/img/hicolor/128x128/apps/fireshot.png
310-
${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/128x128/apps/fireshot.png COPYONLY)
311-
312-
configure_file(${CMAKE_SOURCE_DIR}/data/img/hicolor/scalable/apps/fireshot.svg
313-
${CMAKE_CURRENT_BINARY_DIR}/share/icons/hicolor/scalable/apps/fireshot.svg COPYONLY)
314-
315-
# Install assets
316-
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/share/ DESTINATION ${CMAKE_INSTALL_DATAROOTDIR})
317-
318-
# Install Translations
319-
install(FILES ${QM_FILES} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/fireshot/translations)
320-
endif ()
321269

322270
# windeployqt
323271
if (WIN32)

src/config/styleoverride.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ int StyleOverride::styleHint(StyleHint hint,
1010
const QWidget* widget,
1111
QStyleHintReturn* returnData) const
1212
{
13+
14+
// 当鼠标悬停在工具上时 延时600毫秒出现工具提示
1315
if (hint == SH_ToolTip_WakeUpDelay) {
1416
return 600;
1517
} else {

src/core/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
target_sources(fireshot PRIVATE
22
flameshot.h
33
flameshotdaemon.h
4-
flameshotdbusadapter.h
54
qguiappcurrentscreen.h
65
)
76

87
target_sources(fireshot PRIVATE
98
capturerequest.cpp
109
flameshot.cpp
1110
flameshotdaemon.cpp
12-
flameshotdbusadapter.cpp
1311
qguiappcurrentscreen.cpp
1412
)
1513

0 commit comments

Comments
 (0)