Fixed translations and added feedback from PR

This commit is contained in:
Jeremy Borgman
2020-09-03 11:48:01 -05:00
parent be61406e57
commit 286db9ff69
24 changed files with 4449 additions and 2839 deletions

View File

@@ -7,14 +7,16 @@ find_package(
Widgets
Network
Svg
DBus)
DBus
LinguistTools)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
add_executable(flameshot)
add_executable(Flameshot::flameshot ALIAS flameshot)
add_executable(Flameshot::flameshot ALIAS flameshot)
add_subdirectory(cli)
add_subdirectory(config)
@@ -23,6 +25,27 @@ add_subdirectory(utils)
add_subdirectory(widgets)
add_subdirectory(tools)
qt5_create_translation(
QM_FILES
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_ca.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_de_DE.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_fr.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_es.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_hu.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_ja.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_ka.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_nl.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_pl.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_pt_br.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_ru.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_sk.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_sr.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_tr.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_uk.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_zh_CN.ts
${CMAKE_SOURCE_DIR}/data/translations/Internationalization_zh_TW.ts)
target_sources(
flameshot
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../external/singleapplication/singleapplication.cpp
@@ -30,6 +53,7 @@ target_sources(
${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/src/color_wheel.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../external/Qt-Color-Widgets/include/color_wheel.hpp
${CMAKE_CURRENT_SOURCE_DIR}/../data/graphics.qrc
${QM_FILES}
main.cpp)
target_include_directories(
@@ -67,8 +91,7 @@ target_include_directories(
$<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> # <prefix>/include/mylib
)
$<INSTALL_INTERFACE:include/mylib>)
target_link_libraries(
flameshot
@@ -84,15 +107,21 @@ target_compile_definitions(flameshot PRIVATE APP_VERSION="v0.8.0")
target_compile_definitions(flameshot PRIVATE IMGUR_CLIENT_ID="313baf0c7b4d3ff")
target_compile_definitions(flameshot PRIVATE QAPPLICATION_CLASS=QApplication)
##############################################
foreach(FILE ${QM_FILES})
get_filename_component(F_NAME ${FILE} NAME)
add_custom_command(
TARGET flameshot
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${F_NAME}
${CMAKE_CURRENT_BINARY_DIR}/translations/${F_NAME})
endforeach()
# ######################################################################################################################
# Installation instructions
include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/Flameshot)
install(TARGETS flameshot
EXPORT flameshot-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
install(
TARGETS flameshot
EXPORT flameshot-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

@@ -20,6 +20,7 @@
#include "src/tools/abstracttwopointtool.h"
#include <QPainter>
#include <QPainterPath>
class ArrowTool : public AbstractTwoPointTool {
Q_OBJECT
public:

View File

@@ -62,10 +62,10 @@ QRgb calculate_block_averge(QImage &image, int x_start, int y_start,
assert(x_start + pixel_size < image.width());
assert(y_start + pixel_size < image.height());
auto red_count = 0;
auto blue_count = 0;
auto green_count = 0;
auto pixel_count = 0;
int red_count = 0;
int blue_count = 0;
int green_count = 0;
int pixel_count = 0;
for (auto x = x_start; x < x_start + pixel_size; x++)
{
for (auto y = y_start; y < y_start + pixel_size; y++)
@@ -100,6 +100,11 @@ void BlurTool::process(QPainter &painter, const QPixmap &pixmap,
QImage original_image{source->toImage()};
QImage imageResult{source->toImage()};
unsigned int pixel_size = m_thickness;
if (pixel_size < 1)
{
pixel_size =1;
}
const unsigned int width = source->width();
const unsigned int height = source->height();

View File

@@ -114,7 +114,7 @@ void AppLauncherWidget::launch(const QModelIndex &index) {
tr("Unable to launch in terminal."));
}
} else {
QProcess::startDetached(app_name,{m_tempFile});
QProcess::startDetached(app_name,{m_tempFile});
}
if (!m_keepOpen) {
close();