Skip to content

Commit ccd783c

Browse files
添加部分代码注释
1 parent 7ff1df4 commit ccd783c

File tree

6 files changed

+11
-43
lines changed

6 files changed

+11
-43
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# fireshot
2-
fireshot 是一款优秀的跨平台截图工具
2+
fireshot 是一款优秀的跨平台截图工具,项目来自于flameshot的魔改

src/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ endif ()
6666
target_sources(
6767
fireshot
6868
PRIVATE
69-
# ${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/src/QtColorWidgets/color_utils.cpp
70-
# ${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/src/QtColorWidgets/color_wheel.cpp
71-
# ${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/include/QtColorWidgets/color_wheel.hpp
7269
${CMAKE_CURRENT_SOURCE_DIR}/../data/graphics.qrc
7370
${CMAKE_CURRENT_SOURCE_DIR}/../data/flameshot.rc # windows binary icon resource file
7471
${QM_FILES}

src/core/flameshot.cpp

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ Flameshot::Flameshot()
3535
{
3636
QString StyleSheet = CaptureButton::globalStyleSheet();
3737
qApp->setStyleSheet(StyleSheet);
38-
39-
4038
}
4139

4240
Flameshot* Flameshot::instance()
@@ -51,32 +49,17 @@ CaptureWidget* Flameshot::gui(const CaptureRequest& req)
5149
return nullptr;
5250
}
5351

52+
// 创建截图主窗口
5453
if (nullptr == m_captureWindow) {
55-
// TODO is this unnecessary now?
56-
int timeout = 5000; // 5 seconds
57-
const int delay = 100;
58-
QWidget* modalWidget = nullptr;
59-
for (; timeout >= 0; timeout -= delay) {
60-
modalWidget = qApp->activeModalWidget();
61-
if (nullptr == modalWidget) {
62-
break;
63-
}
64-
modalWidget->close();
65-
modalWidget->deleteLater();
66-
QThread::msleep(delay);
67-
}
68-
if (0 == timeout) {
69-
QMessageBox::warning(
70-
nullptr, tr("Error"), tr("Unable to close active modal widgets"));
71-
return nullptr;
72-
}
73-
54+
// 截图并将图片显示成半透明状态,全部都在截图窗口中实现
7455
m_captureWindow = new CaptureWidget(req);
7556

7657
#ifdef Q_OS_WIN
7758
m_captureWindow->show();
7859
#else
60+
// 在linux上必须使用 fullscreen 否则截图之后效果是一个已经缩小的图片来编辑
7961
m_captureWindow->showFullScreen();
62+
8063
#endif
8164
return m_captureWindow;
8265
} else {
@@ -204,6 +187,7 @@ QVersionNumber Flameshot::getVersion()
204187
* @brief Prompt the user to resolve config errors if necessary.
205188
* @return Whether errors were resolved.
206189
*/
190+
//
207191
bool Flameshot::resolveAnyConfigErrors()
208192
{
209193
bool resolved = true;
@@ -344,6 +328,3 @@ bool Flameshot::haveExternalWidget()
344328
{
345329
return m_haveExternalWidget;
346330
}
347-
348-
// STATIC ATTRIBUTES
349-
Flameshot::Origin Flameshot::m_origin = Flameshot::DAEMON;

src/core/flameshot.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ public slots:
5959
Flameshot();
6060
bool resolveAnyConfigErrors();
6161

62-
// class members
63-
static Origin m_origin;
6462
bool m_haveExternalWidget;
6563

64+
// 用来操作激凸的主界面
6665
QPointer<CaptureWidget> m_captureWindow;
6766
QPointer<InfoWindow> m_infoWindow;
6867
QPointer<CaptureLauncher> m_launcherWindow;

src/tools/capturecontext.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
struct CaptureContext
1313
{
14-
// screenshot with modifications
14+
// 叠加效果之后的图片
1515
QPixmap screenshot;
16-
// unmodified screenshot
16+
// 没有经过任何编辑的原始图片
1717
QPixmap origScreenshot;
18-
// Selection area
18+
// 选择的区域
1919
QRect selection;
2020
// Selected tool color
2121
QColor color;

src/widgets/capture/capturewidget.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
// SPDX-License-Identifier: GPL-3.0-or-later
2-
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors
3-
4-
// Based on Lightscreen areadialog.cpp, Copyright 2017 Christian Kaiser
5-
// <[email protected]> released under the GNU GPL2
6-
// <https://www.gnu.org/licenses/gpl-2.0.txt>
7-
8-
// Based on KDE's KSnapshot regiongrabber.cpp, revision 796531, Copyright 2007
9-
// Luca Gugelmann <[email protected]> released under the GNU LGPL
10-
// <http://www.gnu.org/licenses/old-licenses/library.txt>
111

122
#include "capturewidget.h"
133
#include "abstractlogger.h"
@@ -74,6 +64,7 @@ CaptureWidget::CaptureWidget(const CaptureRequest& req,
7464
, m_startMove(false)
7565

7666
{
67+
// 获取当前应用能够撤销的次数
7768
m_undoStack.setUndoLimit(ConfigHandler().undoLimit());
7869
m_context.circleCount = 1;
7970

0 commit comments

Comments
 (0)